From e9382e64a9c5a8741da104c9e021a383fa88c91c Mon Sep 17 00:00:00 2001 From: Aidan Brady Date: Sat, 16 Nov 2013 17:23:50 -0500 Subject: [PATCH] Fixes! --- .../mekanism/common/block/BlockMachine.java | 45 ++++++++++++++++++- .../client/InductionClientProxy.java | 2 - .../induction/client/SoundHandler.java | 31 ------------- 3 files changed, 44 insertions(+), 34 deletions(-) delete mode 100644 common/mekanism/induction/client/SoundHandler.java diff --git a/common/mekanism/common/block/BlockMachine.java b/common/mekanism/common/block/BlockMachine.java index 24dd9be7a..3cd5346d8 100644 --- a/common/mekanism/common/block/BlockMachine.java +++ b/common/mekanism/common/block/BlockMachine.java @@ -44,7 +44,6 @@ import mekanism.common.tileentity.TileEntityOsmiumCompressor; import mekanism.common.tileentity.TileEntityPurificationChamber; import mekanism.common.tileentity.TileEntityTeleporter; import mekanism.common.util.MekanismUtils; -import mekanism.generators.common.block.BlockGenerator.GeneratorType; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; @@ -54,6 +53,7 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -601,6 +601,23 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds break; } + if(tileEntity instanceof TileEntityLogisticalSorter) + { + if(!((TileEntityLogisticalSorter)tileEntity).hasInventory()) + { + for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) + { + TileEntity tile = Object3D.get(tileEntity).getFromSide(dir).getTileEntity(world); + + if(tileEntity instanceof IInventory) + { + change = dir.getOpposite().ordinal(); + break; + } + } + } + } + tileEntity.setFacing((short)change); world.notifyBlocksOfNeighborChange(x, y, z, blockID); return true; @@ -738,6 +755,32 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds { return 0; } + + @Override + public void onNeighborBlockChange(World world, int x, int y, int z, int id) + { + if(!world.isRemote) + { + if(world.getBlockTileEntity(x, y, z) instanceof TileEntityLogisticalSorter) + { + TileEntityLogisticalSorter tileEntity = (TileEntityLogisticalSorter)world.getBlockTileEntity(x, y, z); + + if(!tileEntity.hasInventory()) + { + for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) + { + TileEntity tile = Object3D.get(tileEntity).getFromSide(dir).getTileEntity(world); + + if(tile instanceof IInventory) + { + tileEntity.setFacing((short)dir.getOpposite().ordinal()); + return; + } + } + } + } + } + } @Override public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) diff --git a/common/mekanism/induction/client/InductionClientProxy.java b/common/mekanism/induction/client/InductionClientProxy.java index 97a4531d1..ca029458d 100644 --- a/common/mekanism/induction/client/InductionClientProxy.java +++ b/common/mekanism/induction/client/InductionClientProxy.java @@ -34,8 +34,6 @@ public class InductionClientProxy extends InductionCommonProxy @Override public void registerRenderers() { - MinecraftForge.EVENT_BUS.register(SoundHandler.INSTANCE); - RenderingRegistry.registerBlockHandler(BlockRenderingHandler.INSTANCE); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTesla.class, new RenderTesla()); diff --git a/common/mekanism/induction/client/SoundHandler.java b/common/mekanism/induction/client/SoundHandler.java deleted file mode 100644 index a65d00bf8..000000000 --- a/common/mekanism/induction/client/SoundHandler.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * - */ -package mekanism.induction.client; - -import mekanism.induction.common.MekanismInduction; -import net.minecraftforge.client.event.sound.SoundLoadEvent; -import net.minecraftforge.event.ForgeSubscribe; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -/** - * @author Calclavia - * - */ -@SideOnly(Side.CLIENT) -public class SoundHandler -{ - public static final SoundHandler INSTANCE = new SoundHandler(); - - public static final String[] SOUND_FILES = { "Shock1.ogg", "Shock2.ogg", "Shock3.ogg", "Shock4.ogg", "Shock5.ogg", "Shock6.ogg", "Shock7.ogg" }; - - @ForgeSubscribe - public void loadSoundEvents(SoundLoadEvent event) - { - for (int i = 0; i < SOUND_FILES.length; i++) - { - event.manager.addSound(MekanismInduction.PREFIX + SOUND_FILES[i]); - } - } -}