2021-03-17 22:20:41 [INFO] [STDOUT] [DEBUG] Injecting hooks into class net.minecraft.inventory.ContainerPlayer
2021-03-17 22:20:41 [INFO] [STDOUT] [DEBUG] Successfully injected 1 hook
2021-03-17 22:20:41 [INFO] [STDERR] java.lang.NoSuchMethodError: net.minecraftforge.common.IExtendedEntityProperties.init(Lnet/minecraft/entity/Entity;Lnet/minecraft/world/World;)V
2021-03-17 22:20:41 [INFO] [STDERR] at net.minecraft.entity.Entity.<init>(Entity.java:278)
2021-03-17 22:20:41 [INFO] [STDERR] at net.minecraft.entity.EntityLivingBase.<init>(EntityLivingBase.java:192)
2021-03-17 22:20:41 [INFO] [STDERR] at net.minecraft.entity.player.EntityPlayer.<init>(EntityPlayer.java:187)
2021-03-17 22:20:41 [INFO] [STDERR] at net.minecraft.entity.player.EntityPlayerMP.<init>(EntityPlayerMP.java:170)
2021-03-17 22:20:41 [INFO] [STDERR] at net.minecraft.server.management.ServerConfigurationManager.func_72366_a(ServerConfigurationManager.java:389)
2021-03-17 22:20:41 [INFO] [STDERR] at net.minecraft.server.integrated.IntegratedServerListenThread.func_71747_b(IntegratedServerListenThread.java:91)
2021-03-17 22:20:41 [INFO] [STDERR] at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:691)
2021-03-17 22:20:41 [INFO] [STDERR] at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:587)
2021-03-17 22:20:41 [INFO] [STDERR] at net.minecraft.server.integrated.IntegratedServer.func_71217_p(IntegratedServer.java:129)
2021-03-17 22:20:41 [INFO] [STDERR] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:484)
2021-03-17 22:20:41 [INFO] [STDERR] at net.minecraft.server.ThreadMinecraftServer.run(SourceFile:583)
2021-03-17 22:20:41 [SEVERE] [Minecraft-Server] Encountered an unexpected exception NoSuchMethodError
java.lang.NoSuchMethodError: net.minecraftforge.common.IExtendedEntityProperties.init(Lnet/minecraft/entity/Entity;Lnet/minecraft/world/World;)V
at net.minecraft.entity.Entity.<init>(Entity.java:278)
at net.minecraft.entity.EntityLivingBase.<init>(EntityLivingBase.java:192)
at net.minecraft.entity.player.EntityPlayer.<init>(EntityPlayer.java:187)
at net.minecraft.entity.player.EntityPlayerMP.<init>(EntityPlayerMP.java:170)
at net.minecraft.server.management.ServerConfigurationManager.func_72366_a(ServerConfigurationManager.java:389)
at net.minecraft.server.integrated.IntegratedServerListenThread.func_71747_b(IntegratedServerListenThread.java:91)
at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:691)
at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:587)
at net.minecraft.server.integrated.IntegratedServer.func_71217_p(IntegratedServer.java:129)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:484)
at net.minecraft.server.ThreadMinecraftServer.run(SourceFile:583)
public class ContainerHook {
@Hook(injectOnExit = true)
@SideOnly(Side.CLIENT)
public static void drawGuiContainerBackgroundLayer(GuiInventory inventory, float var1, int var2, int var3) {
Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("textures/gui/container/inventory.png"));
int guiLeft = (inventory.width - 176) / 2;
int guiTop = (inventory.height - 166) / 2;
inventory.drawTexturedModalRect(guiLeft + 86, guiTop + 61, 6, 5, 19, 20);
}
@Hook
public static void onCraftMatrixChanged(ContainerPlayer player, IInventory var1) {
boolean needToAdd = true;
for(Object obj : player.inventorySlots) {
if (obj instanceof ExtendedSlot) {
needToAdd = false;
break;
}
}
if(needToAdd) {
player.addSlotToContainer(new ExtendedSlot(ExtendedPlayer.get(player.thePlayer).inventory, 0, 88, 64, 0));
}
}
}
Сейчас попробуюУ меня есть смутное ощущение что если отключить хуки, то ошибка никак не изменится и проблема вообще не в них...
Обязательно отдельным классом? Я уже исправил, так как увидел инфунельзя объединять контейнер с хуками и HookLoader)
Убрал META-INF все запустилось)Сейчас попробую
@Mod(name = "AmadeusInventory", modid = "amadeusInv")
public class Main extends HookLoader {
public static final String channel = "deusInv";
@Mod.Instance(channel)
public static Main instance;
public List<String> dataAcceptedItems;
@Mod.EventHandler
public void onPre(FMLPreInitializationEvent event) {
instance = this;
MinecraftForge.EVENT_BUS.register(this);
this.dataAcceptedItems = loadList();
}
private List<String> loadList() {
List<String> data = new ArrayList<String>();
return data;
}
@ForgeSubscribe
public void onEntityConstructing(EntityEvent.EntityConstructing event) {
if(event.entity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) event.entity;
if(ExtendedPlayer.get(player) == null) {
ExtendedPlayer.register(player);
}
if(player.getExtendedProperties(ExtendedPlayer.IDENTIFIER) == null) {
player.registerExtendedProperties(ExtendedPlayer.IDENTIFIER, new ExtendedPlayer(player));
}
}
}
@Override
public String[] getASMTransformerClass() {
return new String[]{PrimaryClassTransformer.class.getName()};
}
@Override
protected void registerHooks() {
registerHookContainer("ru.jok1r.amadeusInventory.hooks.ContainerHook");
}
}
public class ContainerHook {
@Hook(injectOnExit = true)
@SideOnly(Side.CLIENT)
public static void drawGuiContainerBackgroundLayer(GuiInventory inventory, float var1, int var2, int var3) {
Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("textures/gui/container/inventory.png"));
int guiLeft = (inventory.width - 176) / 2;
int guiTop = (inventory.height - 166) / 2;
inventory.drawTexturedModalRect(guiLeft + 86, guiTop + 61, 6, 5, 19, 20);
}
@Hook
public static void onCraftMatrixChanged(ContainerPlayer player, IInventory var1) {
boolean needToAdd = true;
for(Object obj : player.inventorySlots) {
if (obj instanceof ExtendedSlot) {
needToAdd = false;
break;
}
}
if(needToAdd) {
player.addSlotToContainer(new ExtendedSlot(ExtendedPlayer.get(player.thePlayer).inventory, 0, 88, 64, 0));
}
}
}
Manifest-Version: 1.0
FMLCorePlugin: ru.jok1r.amadeusInventory.Main
FMLCorePluginContainsFMLMod: true
Created-By: 1.7.0 (Oracle Corporation)
Ок, сейчас попробуюС модом тоже нельзя объединять, скорее всего из-за этого ломается
Да, стоит Все заработало, спасибокрасными буквами в оригинальном посте ДЕЛАЙТЕ КАК В ПРИМЕРАХ НЕ ПЫТАЙТЕСЬ НИ С ЧЕМ ОБЪЕДИНИТЬ ХУКЛОАДЕР
2021-03-18 00:04:36 [INFO] [STDOUT] [DEBUG] Injecting hooks into class net.minecraft.inventory.ContainerPlayer
2021-03-18 00:04:36 [INFO] [STDOUT] [SEVERE] A problem has occured during transformation of class net.minecraft.inventory.ContainerPlayer.
2021-03-18 00:04:36 [INFO] [STDOUT] [SEVERE] Attached hooks:
2021-03-18 00:04:36 [INFO] [STDOUT] [SEVERE] Stack trace:
2021-03-18 00:04:36 [INFO] [STDERR] java.lang.ArrayIndexOutOfBoundsException: -1
2021-03-18 00:04:36 [INFO] [STDERR] at java.util.ArrayList.elementData(ArrayList.java:424)
2021-03-18 00:04:36 [INFO] [STDERR] at java.util.ArrayList.remove(ArrayList.java:501)
2021-03-18 00:04:36 [INFO] [STDERR] at org.objectweb.asm.commons.AdviceAdapter.popValue(AdviceAdapter.java:560)
2021-03-18 00:04:36 [INFO] [STDERR] at org.objectweb.asm.commons.AdviceAdapter.visitMethodInsn(AdviceAdapter.java:423)
2021-03-18 00:04:36 [INFO] [STDERR] at gloomyfolken.hooklib.asm.AsmHook.injectInvokeStatic(AsmHook.java:188)
2021-03-18 00:04:36 [INFO] [STDERR] at gloomyfolken.hooklib.asm.AsmHook.inject(AsmHook.java:85)
2021-03-18 00:04:36 [INFO] [STDERR] at gloomyfolken.hooklib.asm.HookInjector.visitHook(HookInjector.java:33)
2021-03-18 00:04:36 [INFO] [STDERR] at gloomyfolken.hooklib.asm.HookInjector$MethodEnter.onMethodEnter(HookInjector.java:53)
2021-03-18 00:04:36 [INFO] [STDERR] at org.objectweb.asm.commons.AdviceAdapter.visitMethodInsn(AdviceAdapter.java:438)
2021-03-18 00:04:36 [INFO] [STDERR] at org.objectweb.asm.ClassReader.readCode(ClassReader.java:1320)
2021-03-18 00:04:36 [INFO] [STDERR] at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:938)
2021-03-18 00:04:36 [INFO] [STDERR] at org.objectweb.asm.ClassReader.accept(ClassReader.java:669)
2021-03-18 00:04:36 [INFO] [STDERR] at org.objectweb.asm.ClassReader.accept(ClassReader.java:506)
2021-03-18 00:04:36 [INFO] [STDERR] at gloomyfolken.hooklib.asm.HookClassTransformer.transform(HookClassTransformer.java:51)
2021-03-18 00:04:36 [INFO] [STDERR] at gloomyfolken.hooklib.minecraft.MinecraftClassTransformer.transform(MinecraftClassTransformer.java:56)
2021-03-18 00:04:36 [INFO] [STDERR] at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:274)
2021-03-18 00:04:36 [INFO] [STDERR] at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:172)
2021-03-18 00:04:36 [INFO] [STDERR] at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
2021-03-18 00:04:36 [INFO] [STDERR] at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
2021-03-18 00:04:36 [INFO] [STDERR] at net.minecraft.server.management.ServerConfigurationManager.createPlayerForUser(ServerConfigurationManager.java:389)
2021-03-18 00:04:36 [INFO] [STDERR] at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:91)
2021-03-18 00:04:36 [INFO] [STDERR] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:691)
2021-03-18 00:04:36 [INFO] [STDERR] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:587)
2021-03-18 00:04:36 [INFO] [STDERR] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:129)
2021-03-18 00:04:36 [INFO] [STDERR] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:484)
2021-03-18 00:04:36 [INFO] [STDERR] at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:583)
@Hook(targetMethod = "<init>")
public static void addExtended(ContainerPlayer player, InventoryPlayer p_i1819_1_, boolean p_i1819_2_, EntityPlayer p_i1819_3_1) {
System.out.println("qq");
player.addSlotToContainer(new ExtendedSlot(ExtendedPlayer.get(player.thePlayer).inventory, 46, 88, 64, 0));
}
public class AnnotationHooks {
@Hook
public static void messagePlayer(Platform platform, EntityPlayer aPlayer, String aChatMessage, Object... args) {
if (aPlayer instanceof EntityPlayerMP && aChatMessage != null) {
//aPlayer.addChatComponentMessage(new ChatComponentText(aChatMessage));
}
System.out.println("Hooked - " + aChatMessage);
}
@Hook
public static void onItemUseFirst(ItemCropnalyzer cropnalyzer, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
System.out.println("Hooked cropnalyzer");
}
}
[20:50:55] [Server thread/INFO]: Saving chunks for level 'New World'/Overworld
[20:50:55] [Server thread/INFO]: Saving chunks for level 'New World'/Nether
[20:50:55] [Server thread/INFO]: Saving chunks for level 'New World'/The End
[20:50:58] [Server thread/INFO]: [CHAT] Crop name: Pumpkin (by Notch)
[20:50:58] [Server thread/INFO]: [CHAT] Crop size: 3/4
[20:50:58] [Server thread/INFO]: [CHAT] Nutrient storage: 0/100
[20:50:58] [Server thread/INFO]: [CHAT] Water storage: 0/100
[20:50:58] [Server thread/INFO]: [CHAT] Weed-Ex storage: 0/100
[20:50:58] [Server thread/INFO]: [CHAT] GrowthPoints: 587/600
[00:10:39] [Client thread/INFO]: [gloomyfolken.hooklib.example.IC2Hooks:CropnalyzerClick:45]: net.minecraft.client.multiplayer.WorldClient@44033c1b
// объект, к которому я обращаюсь
[00:10:42] [Client thread/INFO]: Saving markers and cfg...
[00:10:42] [Client thread/INFO]: done
[00:10:42] [Server thread/INFO]: Stopping server
[00:10:42] [Server thread/INFO]: Saving players
[00:10:42] [Server thread/INFO]: Saving worlds
[00:10:42] [Server thread/INFO]: Saving chunks for level 'New World'/Overworld
[00:10:42] [Netty Client IO #0/INFO]: Reset configs to client values for com.enderio.core.common.config.ConfigHandler
[00:10:42] [Netty Client IO #0/INFO]: Reset configs to client values for tterrag.wailaplugins.config.WPConfigHandler
[00:10:42] [Server thread/INFO]: Saving chunks for level 'New World'/Nether
[00:10:42] [Server thread/INFO]: Saving chunks for level 'New World'/The End
[00:10:42] [Server thread/INFO]: Saving chunks for level 'New World'/Moon
[00:10:42] [Server thread/INFO]: Saving chunks for level 'New World'/Mars
[00:10:42] [Server thread/INFO]: Saving chunks for level 'New World'/Asteroids
[00:10:43] [Server thread/INFO]: Unloading dimension 0
[00:10:43] [Server thread/INFO]: Unloading dimension -1
[00:10:43] [Server thread/INFO]: Unloading dimension 1
[00:10:43] [Server thread/INFO]: Unloading dimension -28
[00:10:43] [Server thread/INFO]: Unloading dimension -29
[00:10:43] [Server thread/INFO]: Unloading dimension -30
[00:10:45] [AromaBackup-Schedule/INFO]: Stopping Backup Schedule.
[00:10:45] [Client thread/FATAL]: Unreported exception thrown!
java.lang.NoSuchFieldError: isRemote
at gloomyfolken.hooklib.example.IC2Hooks.CropnalyzerClick(IC2Hooks.java:46) ~[IC2Hooks.class:?]
at ic2.core.item.tool.ItemCropnalyzer.onItemUseFirst(ItemCropnalyzer.java) ~[ItemCropnalyzer.class:?]
at net.minecraft.client.multiplayer.PlayerControllerMP.func_78760_a(PlayerControllerMP.java:317) ~[bje.class:?]
at net.minecraft.client.Minecraft.func_147121_ag(Minecraft.java:1447) ~[bao.class:?]
at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1953) ~[bao.class:?]
at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:973) ~[bao.class:?]
at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:898) [bao.class:?]
at net.minecraft.client.main.Main.main(SourceFile:148) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_51]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_51]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_51]
at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_51]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
@Hook(returnCondition = ReturnCondition.ALWAYS, returnAnotherMethod = "CropnalyzerClick")
public static void onItemUseFirst(ItemCropnalyzer cropnalyzer, ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
{
}
public static boolean CropnalyzerClick(ItemCropnalyzer cropnalyzer, ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
{
System.out.println(world.toString());
if (!world.isRemote && !player.isSneaking()) {
...
Поля скорее всего не может найти из-за того что мод с хуками не собран правильно (не применена обфускация кубача). Ровно такой же эффект будет с обычным модом если просто скомпилировать его классы, не прогнав через скриптики реобфускации. Но я думаю ты и так знаешь как собирать моды на нужную тебе версию.