call both neighbour update methods, as some mods use one, some the other

This commit is contained in:
Xander committed 2017-11-19 17:40:26 +08:00
1 parent 41727312bf
commit 1e046a322c
3 files changed
+20 -6

No files matched your search

@@ -16,6 +16,7 @@ import mekanism.common.multiblock.SynchronizedData;
import mekanism.common.multiblock.UpdateProtocol;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.tile.prefab.TileEntityContainerBlock;
import mekanism.common.util.MekanismUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -118,7 +119,7 @@ public abstract class TileEntityMultiblock<T extends SynchronizedData<T>> extend
if(!obj.isAirBlock(world) && (tile == null || tile.getClass() != getClass()))
{
obj.getBlock(world).onNeighborChange(world, obj.getPos(), getPos());
MekanismUtils.notifyNeighborofChange(world, obj, getPos());
}
}
@@ -5,6 +5,7 @@ import mekanism.api.IHeatTransfer;
import mekanism.common.base.FluidHandlerWrapper;
import mekanism.common.base.IFluidHandlerWrapper;
import mekanism.common.capabilities.Capabilities;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.PipeUtils;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.capabilities.Capability;
@@ -30,9 +31,9 @@ public class TileEntityThermalEvaporationValve extends TileEntityThermalEvaporat
{
Coord4D obj = Coord4D.get(this).offset(side);
if(!obj.isAirBlock(world) && !(obj.getTileEntity(world) instanceof TileEntityThermalEvaporationBlock))
if(obj.exists(world) && !obj.isAirBlock(world) && !(obj.getTileEntity(world) instanceof TileEntityThermalEvaporationBlock))
{
obj.getBlock(world).onNeighborChange(world, obj.getPos(), getPos());
MekanismUtils.notifyNeighborofChange(world, obj, this.pos);
}
}
}
@@ -758,8 +758,7 @@ public final class MekanismUtils
if(offset.exists(world))
{
Block block1 = offset.getBlock(world);
block1.onNeighborChange(world, offset.getPos(), coord.getPos());
notifyNeighborofChange(world, offset, coord.getPos());
if(offset.getBlockState(world).isNormalCube())
{
@@ -767,7 +766,7 @@ public final class MekanismUtils
if(offset.exists(world))
{
block1 = offset.getBlock(world);
Block block1 = offset.getBlock(world);
if(block1.getWeakChanges(world, offset.getPos()))
{
@@ -779,6 +778,19 @@ public final class MekanismUtils
}
}
/**
* Calls BOTH neighbour changed functions because nobody can decide on which one to implement.
* @param world world the change exists in
* @param coord neighbor to notify
* @param fromPos pos of our block that updated
*/
@SuppressWarnings("deprecation")//MOJENG
public static void notifyNeighborofChange(World world, Coord4D coord, BlockPos fromPos){
Block block1 = coord.getBlock(world);
block1.onNeighborChange(world, coord.getPos(), fromPos);
block1.neighborChanged(coord.getBlockState(world), world, coord.getPos(), block1, fromPos);
}
/**
* Places a fake bounding block at the defined location.
* @param world - world to place block in