Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Commit

Permalink
tried fixing redstone wire issue, bumped pre
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinsdar committed Jun 5, 2024
1 parent a950b84 commit d89aeaf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import io.github.gregtechintergalactical.gtcore.block.BlockRedstoneWire;
import io.github.gregtechintergalactical.gtcore.block.RedstoneWire;
import muramasa.antimatter.Antimatter;
import muramasa.antimatter.AntimatterAPI;
import muramasa.antimatter.blockentity.pipe.BlockEntityPipe;
import muramasa.antimatter.capability.ICoverHandler;
Expand Down Expand Up @@ -61,12 +62,13 @@ public void onBlockUpdate(BlockPos neighbor) {
}

@Override
public void refreshConnection() {
super.refreshConnection();
public void toggleConnection(Direction side) {
super.toggleConnection(side);
boolean oldConnectedToNonWire = mConnectedToNonWire;
updateConnectionStatus();
if (mConnectedToNonWire || oldConnectedToNonWire) level.updateNeighborsAt(this.getBlockPos(), this.getBlockState().getBlock());
if (updateRedstone()) doRedstoneUpdate(this);
if (mConnectedToNonWire || oldConnectedToNonWire) level.updateNeighborsAt(this.getBlockPos(), this.getBlockState().getBlock());
//Antimatter.LOGGER.info("refresh connection");
}

@Override
Expand All @@ -92,19 +94,22 @@ public int getWeakPower(Direction side){
if (cover.isNode()){
return cover.getWeakPower();
}
if (mRedstone <= 0 || !connects(side)) return 0;
boolean connects = connects(side);
if (mRedstone <= 0 || !connects) return 0;
Block block = level.getBlockState(this.getBlockPos().relative(side)).getBlock();
return CodeUtils.bind4(CodeUtils.divup(mRedstone, MAX_RANGE)- (block instanceof BlockRedstoneWire<?> ? 1: 0));
}

public int getStrongPower(Direction side){
ICover cover = coverHandler.map(c -> c.get(side)).orElse(ICover.empty);
return 0;
/*ICover cover = coverHandler.map(c -> c.get(side)).orElse(ICover.empty);
if (cover.isNode()){
return cover.getStrongPower();
}
if (mRedstone <= 0 || !connects(side)) return 0;
boolean connects = connects(side);
if (mRedstone <= 0 || !connects) return 0;
Block block = level.getBlockState(this.getBlockPos().relative(side)).getBlock();
return CodeUtils.bind4(CodeUtils.divup(mRedstone, MAX_RANGE)- (block instanceof BlockRedstoneWire<?> ? 1: 0));
return CodeUtils.bind4(CodeUtils.divup(mRedstone, MAX_RANGE)- (block instanceof BlockRedstoneWire<?> ? 1: 0));*/
}

public int getComparatorInputOverride(byte aSide) {
Expand Down Expand Up @@ -207,6 +212,7 @@ public void load(CompoundTag tag) {
public CompoundTag getUpdateTag() {
CompoundTag updateTag = super.getUpdateTag();
updateTag.putLong("mRedstone", mRedstone);
updateTag.putBoolean("mConnectedToNonWire", mConnectedToNonWire);
return updateTag;
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ top_file=3157997

maven_group=io.github.gregtechintergalactical
archive_base_name=gtcore
mod_version=0.1.1-pre30
mod_version=0.1.1-pre31

0 comments on commit d89aeaf

Please sign in to comment.