From f87e7a4ee8db005e294879bfff2f08e0906c3ef1 Mon Sep 17 00:00:00 2001 From: AlgorithmX2 Date: Tue, 13 May 2014 23:33:48 -0500 Subject: [PATCH 1/2] Fixed Right Click Terminal Slots. --- container/AEBaseContainer.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/container/AEBaseContainer.java b/container/AEBaseContainer.java index 41bc5fdd..ec595a52 100644 --- a/container/AEBaseContainer.java +++ b/container/AEBaseContainer.java @@ -806,7 +806,10 @@ public abstract class AEBaseContainer extends Container if ( slotItem != null ) { IAEItemStack ais = slotItem.copy(); - long stackSize = Math.min( ais.getItemStack().getMaxStackSize(), ais.getStackSize() ); + long maxSize = ais.getItemStack().getMaxStackSize(); + ais.setStackSize( maxSize ); + ais = cellInv.extractItems( ais, Actionable.SIMULATE, mySrc ); + long stackSize = Math.min( maxSize, ais.getStackSize() ); ais.setStackSize( (stackSize + 1) >> 1 ); ais = Platform.poweredExtraction( powerSrc, cellInv, ais, mySrc ); if ( ais != null ) From 9ba1b133d78ceab6f2a7f0719384de3daef125e4 Mon Sep 17 00:00:00 2001 From: AlgorithmX2 Date: Wed, 14 May 2014 10:55:45 -0500 Subject: [PATCH 2/2] Fixed Bug: #0432 - Weird Inventory behavior in Quartz Cutting Knife Removed logging from Migration Items. Improved logging for http://openeye.openmods.info/crashes/42defba4fcc4c4571a45edaaba3af4c3 Improved logging for http://openeye.openmods.info/crashes/cbda180edb2fba39c4fe27a7f5266fec --- .../implementations/ContainerQuartzKnife.java | 2 +- items/parts/ItemMultiPart.java | 2 + me/NetworkEventBus.java | 49 +++++++++++-------- migration/OldItemPart.java | 3 +- util/item/AEItemStack.java | 9 ++-- 5 files changed, 37 insertions(+), 28 deletions(-) diff --git a/container/implementations/ContainerQuartzKnife.java b/container/implementations/ContainerQuartzKnife.java index 97725d9a..5e8cdd9b 100644 --- a/container/implementations/ContainerQuartzKnife.java +++ b/container/implementations/ContainerQuartzKnife.java @@ -151,7 +151,7 @@ public class ContainerQuartzKnife extends AEBaseContainer implements IAEAppEngIn @Override public void setInventorySlotContents(int var1, ItemStack var2) { - if ( var2 == null ) + if ( var2 == null && Platform.isServer() ) makePlate(); } diff --git a/items/parts/ItemMultiPart.java b/items/parts/ItemMultiPart.java index 823144b8..fd031e90 100644 --- a/items/parts/ItemMultiPart.java +++ b/items/parts/ItemMultiPart.java @@ -17,6 +17,7 @@ import appeng.api.implementations.items.IItemGroup; import appeng.api.parts.IPart; import appeng.api.parts.IPartItem; import appeng.core.AEConfig; +import appeng.core.AELog; import appeng.core.features.AEFeature; import appeng.core.features.AEFeatureHandler; import appeng.core.features.ItemStackSrc; @@ -60,6 +61,7 @@ public class ItemMultiPart extends AEBaseItem implements IPartItem, IItemGroup } catch (Throwable e) { + AELog.integration(e); return null; // part not supported.. } diff --git a/me/NetworkEventBus.java b/me/NetworkEventBus.java index b401e82d..476818ff 100644 --- a/me/NetworkEventBus.java +++ b/me/NetworkEventBus.java @@ -80,36 +80,43 @@ public class NetworkEventBus return; readClasses.add( c ); - for (Method m : c.getMethods()) + try { - MENetworkEventSubscribe s = m.getAnnotation( MENetworkEventSubscribe.class ); - if ( s != null ) + for (Method m : c.getMethods()) { - Class types[] = m.getParameterTypes(); - if ( types.length == 1 ) + MENetworkEventSubscribe s = m.getAnnotation( MENetworkEventSubscribe.class ); + if ( s != null ) { - if ( MENetworkEvent.class.isAssignableFrom( types[0] ) ) + Class types[] = m.getParameterTypes(); + if ( types.length == 1 ) { - - Hashtable classEvents = events.get( types[0] ); - if ( classEvents == null ) - events.put( types[0], classEvents = new Hashtable() ); - - MENetworkEventInfo thisEvent = classEvents.get( listAs ); - if ( thisEvent == null ) - thisEvent = new MENetworkEventInfo(); - - thisEvent.Add( types[0], c, m ); - - classEvents.put( listAs, thisEvent ); + if ( MENetworkEvent.class.isAssignableFrom( types[0] ) ) + { + + Hashtable classEvents = events.get( types[0] ); + if ( classEvents == null ) + events.put( types[0], classEvents = new Hashtable() ); + + MENetworkEventInfo thisEvent = classEvents.get( listAs ); + if ( thisEvent == null ) + thisEvent = new MENetworkEventInfo(); + + thisEvent.Add( types[0], c, m ); + + classEvents.put( listAs, thisEvent ); + } + else + throw new RuntimeException( "Invalid ME Network Event Subscriber, " + m.getName() + "s Parameter must extend MENetworkEvent." ); } else - throw new RuntimeException( "Invalid ME Network Event Subscriber, " + m.getName() + "s Parameter must extend MENetworkEvent." ); + throw new RuntimeException( "Invalid ME Network Event Subscriber, " + m.getName() + " must have exactly 1 parameter." ); } - else - throw new RuntimeException( "Invalid ME Network Event Subscriber, " + m.getName() + " must have exactly 1 parameter." ); } } + catch(Throwable t ) + { + throw new RuntimeException( "Error while adding "+c.getName()+" to event bus", t ); + } } diff --git a/migration/OldItemPart.java b/migration/OldItemPart.java index 52242618..bd96d7e6 100644 --- a/migration/OldItemPart.java +++ b/migration/OldItemPart.java @@ -18,6 +18,7 @@ import appeng.api.implementations.items.IItemGroup; import appeng.api.parts.IPart; import appeng.api.parts.IPartItem; import appeng.core.AEConfig; +import appeng.core.AELog; import appeng.core.features.AEFeature; import appeng.core.features.ItemStackSrc; import appeng.core.localization.GuiText; @@ -74,7 +75,7 @@ public class OldItemPart extends AEBaseItem implements IPartItem, IItemGroup, II } catch (Throwable e) { - e.printStackTrace(); + AELog.integration(e); return null; // part not supported.. } diff --git a/util/item/AEItemStack.java b/util/item/AEItemStack.java index 5044eaf7..da3f337a 100644 --- a/util/item/AEItemStack.java +++ b/util/item/AEItemStack.java @@ -2,8 +2,9 @@ package appeng.util.item; import io.netty.buffer.ByteBuf; +import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; -import java.io.DataInput; +import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.util.List; @@ -18,8 +19,6 @@ import appeng.api.storage.data.IAEItemStack; import appeng.api.storage.data.IAETagCompound; import appeng.util.Platform; -import com.google.common.io.ByteStreams; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -329,8 +328,8 @@ public final class AEItemStack extends AEStack implements IAEItemS byte[] bd = new byte[len]; data.readBytes( bd ); - DataInput di = ByteStreams.newDataInput( bd ); - d.setTag( "tag", CompressedStreamTools.read( di ) ); + ByteArrayInputStream di = new ByteArrayInputStream( bd ); + d.setTag( "tag", CompressedStreamTools.read( new DataInputStream( di) ) ); } // long priority = getPacketValue( PriorityType, data );