fix: 修复无线收发器只能传递8频道的问题;修复无线收发器与线缆连接处渲染问题
This commit is contained in:
parent
82eb036023
commit
ab0c913021
|
|
@ -1,6 +1,7 @@
|
|||
package com.extendedae_plus.content.wireless;
|
||||
|
||||
import appeng.api.networking.*;
|
||||
import appeng.api.util.AECableType;
|
||||
import com.extendedae_plus.init.ModBlockEntities;
|
||||
import com.extendedae_plus.init.ModItems;
|
||||
import com.extendedae_plus.wireless.IWirelessEndpoint;
|
||||
|
|
@ -16,6 +17,7 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 无线收发器方块实体(骨架):
|
||||
|
|
@ -38,7 +40,8 @@ public class WirelessTransceiverBlockEntity extends BlockEntity implements IWire
|
|||
public WirelessTransceiverBlockEntity(BlockPos pos, BlockState state) {
|
||||
super(ModBlockEntities.WIRELESS_TRANSCEIVER_BE.get(), pos, state);
|
||||
// 创建 AE2 管理节点
|
||||
this.managedNode = GridHelper.createManagedNode(this, NodeListener.INSTANCE);
|
||||
this.managedNode = GridHelper.createManagedNode(this, NodeListener.INSTANCE)
|
||||
.setFlags(GridFlags.DENSE_CAPACITY);
|
||||
this.managedNode.setIdlePowerUsage(1.0); // 可按需调整基础待机功耗
|
||||
this.managedNode.setTagName("wireless_node");
|
||||
this.managedNode.setInWorldNode(true);
|
||||
|
|
@ -50,6 +53,20 @@ public class WirelessTransceiverBlockEntity extends BlockEntity implements IWire
|
|||
this.slaveLink = new WirelessSlaveLink(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public appeng.api.util.AECableType getCableConnectionType(Direction dir) {
|
||||
// 根据相邻方块的实际连接类型渲染(优先采用相邻主机返回的类型),回退为 GLASS。
|
||||
if (this.level == null) return AECableType.GLASS;
|
||||
var adjacentPos = this.worldPosition.relative(dir);
|
||||
if (!Objects.requireNonNull(this.getLevel()).hasChunkAt(adjacentPos)) return AECableType.GLASS;
|
||||
var adjacentHost = GridHelper.getNodeHost(this.getLevel(), adjacentPos);
|
||||
if (adjacentHost != null) {
|
||||
var t = adjacentHost.getCableConnectionType(dir.getOpposite());
|
||||
if (t != null) return t;
|
||||
}
|
||||
return AECableType.GLASS;
|
||||
}
|
||||
|
||||
/* ===================== IInWorldGridNodeHost ===================== */
|
||||
@Override
|
||||
public @Nullable IGridNode getGridNode(Direction dir) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user