From a71c1ee08ce6e9fba5013291295df279f63ad16e Mon Sep 17 00:00:00 2001 From: AlgorithmX2 Date: Mon, 24 Feb 2014 11:27:26 -0600 Subject: [PATCH 1/2] Catch Weird Crash. --- client/render/WorldRender.java | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/client/render/WorldRender.java b/client/render/WorldRender.java index 772bb78e..5091ea11 100644 --- a/client/render/WorldRender.java +++ b/client/render/WorldRender.java @@ -7,6 +7,7 @@ import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.item.ItemStack; import net.minecraft.world.IBlockAccess; import appeng.block.AEBaseBlock; +import appeng.core.AELog; import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.relauncher.Side; @@ -58,13 +59,20 @@ public class WorldRender implements ISimpleBlockRenderingHandler public void renderItemBlock(ItemStack item) { - AEBaseBlock block = (AEBaseBlock) Block.getBlockFromItem( item.getItem() ); - renderer.setRenderBoundsFromBlock( block ); - - renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0; - getRender( block ).renderInventory( block, item, renderer ); - renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0; - + Block blk = Block.getBlockFromItem( item.getItem() ); + if ( blk instanceof AEBaseBlock ) + { + AEBaseBlock block = (AEBaseBlock)blk; + renderer.setRenderBoundsFromBlock( block ); + + renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0; + getRender( block ).renderInventory( block, item, renderer ); + renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0; + } + else + { + AELog.severe( "Invalid render: "+item.getUnlocalizedName() +" as ae block" ); + } } private BaseBlockRender getRender(AEBaseBlock block) From 76aed4f4a82fa722f1a0231588006515a71ba4c9 Mon Sep 17 00:00:00 2001 From: AlgorithmX2 Date: Mon, 24 Feb 2014 12:01:16 -0600 Subject: [PATCH 2/2] Implemented INetworkEncodable --- api | 2 +- container/implementations/ContainerSecurity.java | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/api b/api index 2c9d87df..28e318ff 160000 --- a/api +++ b/api @@ -1 +1 @@ -Subproject commit 2c9d87df822a15136c7446db0d8d3b72b7feb4e5 +Subproject commit 28e318ff1a990aef0131f3156134d4c8b1502364 diff --git a/container/implementations/ContainerSecurity.java b/container/implementations/ContainerSecurity.java index 11c9601d..0d3d0065 100644 --- a/container/implementations/ContainerSecurity.java +++ b/container/implementations/ContainerSecurity.java @@ -8,6 +8,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import appeng.api.AEApi; import appeng.api.config.SecurityPermissions; +import appeng.api.features.INetworkEncodable; import appeng.api.features.IWirelessTermHandler; import appeng.api.implementations.items.IBiometricCard; import appeng.api.storage.ITerminalHost; @@ -136,11 +137,18 @@ public class ContainerSecurity extends ContainerMEMonitorable implements IAEAppE if ( wirelessIn.getHasStack() ) { ItemStack term = wirelessIn.getStack().copy(); - IWirelessTermHandler h = AEApi.instance().registries().wireless().getWirelessTerminalHandler( term ); - - if ( h != null ) + INetworkEncodable netEncodeable = null; + + if ( term.getItem() instanceof INetworkEncodable ) + netEncodeable = (INetworkEncodable) term.getItem(); + + IWirelessTermHandler wTermHandler = AEApi.instance().registries().wireless().getWirelessTerminalHandler( term ); + if ( wTermHandler != null ) + netEncodeable = wTermHandler; + + if ( netEncodeable != null ) { - h.setEncryptionKey( term, "" + securityBox.securityKey, "" ); + netEncodeable.setEncryptionKey( term, "" + securityBox.securityKey, "" ); wirelessIn.putStack( null ); wirelessOut.putStack( term );