Fixed Controller adding air to its controllable and updating constantly, closes #32

This commit is contained in:
Buuz135 2022-05-05 20:08:43 +02:00
parent 4640bc7baf
commit cd1da8175a
2 changed files with 3 additions and 2 deletions

View File

@ -95,7 +95,7 @@ dependencies {
implementation fg.deobf (project.dependencies.create('com.hrznstudio:titanium:1.18.2-3.5.0-32'))
compileOnly fg.deobf("mezz.jei:jei-1.18.2:9.5.3.143:api")
runtimeOnly fg.deobf("mezz.jei:jei-1.18.2:9.5.3.143")
//runtimeOnly fg.deobf("curse.maven:refined-storage-243076:3569563")
runtimeOnly fg.deobf("curse.maven:refined-storage-243076:3712882")
implementation fg.deobf("curse.maven:the-one-probe-245211:3671753")
//implementation fg.deobf("curse.maven:allthecompressed-514045:3723881")
//runtimeOnly fg.deobf("curse.maven:create-328085:3600402")

View File

@ -63,6 +63,7 @@ public class DrawerControllerTile extends ControllableDrawerTile<DrawerControlle
public void serverTick(Level level, BlockPos pos, BlockState state, DrawerControllerTile blockEntity) {
super.serverTick(level, pos, state, blockEntity);
if (this.connectedDrawers.getConnectedDrawers().size() != this.connectedDrawers.getHandlers().size()) {
this.connectedDrawers.getConnectedDrawers().removeIf(aLong -> !(this.getLevel().getBlockEntity(BlockPos.of(aLong)) instanceof ControllableDrawerTile<?>));
this.connectedDrawers.setLevel(getLevel());
this.connectedDrawers.rebuild();
markForUpdate();
@ -147,7 +148,7 @@ public class DrawerControllerTile extends ControllableDrawerTile<DrawerControlle
public void addConnectedDrawers(LinkingToolItem.ActionMode action, BlockPos... positions) {
for (BlockPos position : positions) {
if (level.getBlockState(position).is(FunctionalStorage.DRAWER_CONTROLLER.getLeft().get())) continue;
if (this.getBlockPos().closerThan(position, FunctionalStorageConfig.DRAWER_CONTROLLER_LINKING_RANGE)) {
if (this.getBlockPos().closerThan(position, FunctionalStorageConfig.DRAWER_CONTROLLER_LINKING_RANGE) && this.getLevel().getBlockEntity(position) instanceof ControllableDrawerTile<?>) {
if (action == LinkingToolItem.ActionMode.ADD) {
if (!connectedDrawers.getConnectedDrawers().contains(position.asLong()))
this.connectedDrawers.getConnectedDrawers().add(position.asLong());