Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ minecraft {
jvmArg "-Dfml.coreMods.load=${mixin_loader_class}"
jvmArg "-Dmixin.hotSwap=true"
jvmArg "-Dmixin.checks.interfaces=true"
jvmArg "-Dmixin.debug.export=true"

workingDirectory project.file('run')

Expand All @@ -35,6 +36,7 @@ minecraft {
jvmArg "-Dfml.coreMods.load=${mixin_loader_class}"
jvmArg "-Dmixin.hotSwap=true"
jvmArg "-Dmixin.checks.interfaces=true"
jvmArg "-Dmixin.debug.export=true"

workingDirectory project.file('run')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemBlock;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package mod.beethoven92.betterendforge.common.tileentity;

import mod.beethoven92.betterendforge.common.init.ModTileEntityTypes;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntityChest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,26 @@
import mod.beethoven92.betterendforge.common.tileentity.EChestTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.tileentity.TileEntityLockable;
import net.minecraft.util.math.BlockPos;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(TileEntityChest.class)
public abstract class TileEntityChestMixin extends TileEntityLockable {
public abstract class TileEntityChestMixin extends TileEntity {

@Inject(method = "isChestAt", at = @At("RETURN"), cancellable = true)
private void isChestAt(BlockPos p_174912_1_, CallbackInfoReturnable<Boolean> cir) {
if (this.world == null) {
cir.setReturnValue(false);
} else {
TileEntity tile = this.world.getTileEntity(p_174912_1_);
cir.setReturnValue(!(tile instanceof EChestTileEntity) || ((Object)this) instanceof EChestTileEntity);
}
@Inject(method = "isChestAt", at = @At(value = "RETURN", ordinal = 1), cancellable = true)
private void betterendforge_isChestAt(BlockPos pos, CallbackInfoReturnable<Boolean> cir){
TileEntityChest thisTile = (TileEntityChest)(Object)this;
TileEntity thatTile = this.world.getTileEntity(pos);

boolean thisIsBE = thisTile instanceof EChestTileEntity;
boolean thatIsBE = thatTile instanceof EChestTileEntity;

if(thisIsBE != thatIsBE) cir.setReturnValue(false); //one vanilla chest, one BE, don't connect
else if(thisIsBE && thatIsBE)
cir.setReturnValue(this.world.getBlockState(pos).getBlock() == this.getBlockType());
//else vanilla behavior
}
}