mirror of
https://github.com/GTNewHorizons/Gadomancy.git
synced 2026-11-21 20:42:12 +00:00
- NEI Integration: Removed invalid golem placers.
This commit is contained in:
1 parent
1f2576b5af
commit
cc1cf37b78
3 files changed
+29
-12
No files matched your search
@@ -1,5 +1,6 @@
|
||||
package makeo.gadomancy.common.integration;
|
||||
|
||||
import makeo.gadomancy.common.items.ItemFakeGolemPlacer;
|
||||
import makeo.gadomancy.common.registration.RegisteredBlocks;
|
||||
import makeo.gadomancy.common.registration.RegisteredItems;
|
||||
import makeo.gadomancy.common.utils.Injector;
|
||||
@@ -7,6 +8,9 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -33,10 +37,21 @@ public class IntegrationNEI extends IntegrationMod {
|
||||
hideItem(new ItemStack(RegisteredItems.itemFakeLootbag, 1, Short.MAX_VALUE));
|
||||
hideItem(new ItemStack(RegisteredBlocks.blockExtendedNodeJar, 1, Short.MAX_VALUE));
|
||||
hideItem(new ItemStack(RegisteredItems.itemExtendedNodeJar, 1, Short.MAX_VALUE));
|
||||
hideItem(new ItemStack(RegisteredItems.itemFakeGolemPlacer, 1, Short.MAX_VALUE));
|
||||
hideItem(new ItemStack(RegisteredItems.itemFakeGolemPlacer, 1, Short.MAX_VALUE)); //This does... nothing? ffs.
|
||||
hideItem(new ItemStack(RegisteredItems.itemTransformationFocus, 1, Short.MAX_VALUE));
|
||||
}
|
||||
|
||||
public static void checkItems(ArrayList items) {
|
||||
Iterator iterator = items.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Object item = iterator.next();
|
||||
if (item != null && item instanceof ItemStack && ((ItemStack) item).getItem() != null &&
|
||||
((ItemStack) item).getItem() instanceof ItemFakeGolemPlacer) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void hideItem(ItemStack item) {
|
||||
nei.invokeMethod("hideItem", ItemStack.class, item);
|
||||
}
|
||||
|
||||
@@ -92,16 +92,6 @@ public final class MiscUtils {
|
||||
return new NetworkRegistry.TargetPoint(world.provider.dimensionId, target.getX(), target.getY(), target.getZ(), range);
|
||||
}
|
||||
|
||||
public static EntityPlayer getOnlinePlayerByUUIDClient(UUID playerUUID) {
|
||||
List<EntityPlayerMP> players = Minecraft.getMinecraft().getIntegratedServer().getConfigurationManager().playerEntityList;
|
||||
for(EntityPlayerMP player : players) {
|
||||
if(player.getGameProfile().getId().equals(playerUUID)) {
|
||||
return player;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
//Nothing to see here. Please move on.
|
||||
public static boolean isANotApprovedOrMisunderstoodPersonFromMoreDoor(EntityPlayer player) {
|
||||
int uuHash = player.getUniqueID().hashCode();
|
||||
|
||||
@@ -24,6 +24,7 @@ public class GadomancyTransformer extends AccessTransformer {
|
||||
public static final String NAME_WANDMANAGER = "thaumcraft.common.items.wands.WandManager";
|
||||
public static final String NAME_NODE_RENDERER = "thaumcraft.client.renderers.tile.TileNodeRenderer";
|
||||
public static final String NAME_RENDER_EVENT_HANDLER = "thaumcraft.client.lib.RenderEventHandler";
|
||||
public static final String NAME_NEI_ITEMPANEL = "codechicken.nei.ItemPanel";
|
||||
|
||||
public GadomancyTransformer() throws IOException {}
|
||||
|
||||
@@ -31,7 +32,7 @@ public class GadomancyTransformer extends AccessTransformer {
|
||||
public byte[] transform(String name, String transformedName, byte[] bytes) {
|
||||
boolean needsTransform = transformedName.equalsIgnoreCase(NAME_ENCHANTMENT_HELPER) ||
|
||||
name.equalsIgnoreCase(NAME_WANDMANAGER) || name.equalsIgnoreCase(NAME_NODE_RENDERER)
|
||||
|| name.equalsIgnoreCase(NAME_RENDER_EVENT_HANDLER);
|
||||
|| name.equalsIgnoreCase(NAME_RENDER_EVENT_HANDLER) || name.equals(NAME_NEI_ITEMPANEL);
|
||||
if(!needsTransform) return super.transform(name, transformedName, bytes);
|
||||
|
||||
FMLLog.info("[GadomancyTransformer] Transforming " + name + ": " + transformedName);
|
||||
@@ -124,6 +125,17 @@ public class GadomancyTransformer extends AccessTransformer {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if(name.equalsIgnoreCase(NAME_NEI_ITEMPANEL)) {
|
||||
for (MethodNode mn : node.methods) {
|
||||
if(mn.name.equals("updateItemList")) {
|
||||
InsnList newInstructions = new InsnList();
|
||||
newInstructions.add(new VarInsnNode(Opcodes.ALOAD, 0));
|
||||
newInstructions.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "makeo/gadomancy/common/integration/IntegrationNEI",
|
||||
"checkItems", "(Ljava/util/ArrayList;)V", false));
|
||||
newInstructions.add(mn.instructions);
|
||||
mn.instructions = newInstructions;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS);
|
||||
|
||||
Reference in new issue
Block a user