diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockEnclosed.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockEnclosed.java index 1cdfc2953d..d5d1a2cf81 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockEnclosed.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockEnclosed.java @@ -11,6 +11,7 @@ import java.lang.reflect.Field; import java.lang.reflect.Method; +import appeng.tile.networking.TileCableBus; import net.minecraft.block.Block; import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.SoundType; @@ -387,23 +388,12 @@ public TileEntity createNewTileEntity(World world, int metadata) { if (CompatibilityManager.isAppEngLoaded()) { - // Emulate Api.INSTANCE.partHelper().getCombinedInstance( - // TileCableBus.class ) - try - { - IPartHelper apiPart = AEApi.instance().partHelper(); - Class classTileCableBus = Class.forName("appeng.tile.networking.TileCableBus"); - for (Method m : apiPart.getClass().getMethods()) - { - if ("getCombinedInstance".equals(m.getName())) - { - return (TileEntity) ((Class) m.invoke(apiPart, classTileCableBus)).newInstance(); - } - } - } catch (Exception e) - { - e.printStackTrace(); - } + try { + Class cableBusClass = Class.forName("appeng.tile.networking.TileCableBus"); + return (TileEntity) cableBusClass.newInstance(); + }catch (Exception e){ + GalacticraftCore.logger.catching(e); + } } } else if (metadata <= EnumEnclosedBlockType.ALUMINUM_WIRE.getMeta()) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBlockEnclosed.java b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBlockEnclosed.java index 587c47c2e2..e432d362de 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBlockEnclosed.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBlockEnclosed.java @@ -81,11 +81,7 @@ public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos ItemStack itemME = AEApi.instance().definitions().parts().cableGlass().stack(AEColor.TRANSPARENT, 1); itemME.setCount(2); // Fool AppEng into not destroying // anything in the player inventory - if (AEApi.instance().partHelper().placeBus(itemME, origPos, side, playerIn, hand, worldIn) != EnumActionResult.SUCCESS) { - SoundType soundType = this.getBlock().getSoundType(iblockstate, worldIn, pos, playerIn); - worldIn.playSound(playerIn, pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F, soundType.getPlaceSound(), SoundCategory.BLOCKS, (soundType.getVolume() + 1.0F) / 2.0F, - soundType.getPitch() * 0.8F); - } + AEApi.instance().partHelper().placeBus(itemME, origPos, side, playerIn, hand, worldIn); } return EnumActionResult.SUCCESS; } else { @@ -96,6 +92,10 @@ public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos } } + + + + @Override public int getMetadata(int damage) { return damage;