[Pas Faisable] Rendre un item pêchable
-
Je regarde ça dès que je vais sur le pc
-
Malheureusement forge ne permet pas ça, il n’y a rien de prévu pour

La seule solution pour l’instant est de créé une nouvelle canne à pêche. -
ou utiliser la reflexion sur celle existante non?
-
@‘robin4002’:
Malheureusement forge ne permet pas ça, il n’y a rien de prévu pour

La seule solution pour l’instant est de créé une nouvelle canne à pêche.Tu pense que si je code un hook pour ça, forge acceptera le pull request ?
-
En effet, il y a trois liste dans EntityFishHook (field_146039_d, field_146041_e et field_146041_f) donc ça doit être possible avec la réflexion.
-
Je pensais pas que ça demanderait tant de chose…
-
@‘Noxon’:
Je pensais pas que ça demanderait tant de chose…
La pêche, c’est du sérieux bonhomme !
-
Donc du coup je laisse tomber ? x)
-
try { List fixedSizeList = ObfuscationReflectionHelper.getPrivateValue(EntityFishHook.class, null, "field_146036_f"); List <weightedrandomfishable>fishList = new LinkedList<weightedrandomfishable>(fixedSizeList); System.out.println(fishList.size()); fishList.add(new WeightedRandomFishable(new ItemStack(itemTutoriel), 1000)); ObfuscationReflectionHelper.setPrivateValue(EntityFishHook.class, null, fishList, "field_146036_f"); } catch(Exception ex) { System.err.println("Reflexion error when adding fish"); ex.printStackTrace(); }Reflexion error when adding fish cpw.mods.fml.relauncher.ReflectionHelper$UnableToAccessFieldException: java.lang.IllegalAccessException: Can not set static final java.util.List field net.minecraft.entity.projectile.EntityFishHook.field_146036_f to java.util.LinkedList at cpw.mods.fml.relauncher.ReflectionHelper.setPrivateValue(ReflectionHelper.java:147) at cpw.mods.fml.common.ObfuscationReflectionHelper.setPrivateValue(ObfuscationReflectionHelper.java:91) at fr.minecraftforgefrance.tutoriel.common.ModTutoriel.init(ModTutoriel.java:102) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) at com.google.common.eventbus.EventBus.post(EventBus.java:267) at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:209) at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:188) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) at com.google.common.eventbus.EventBus.post(EventBus.java:267) at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:119) at cpw.mods.fml.common.Loader.initializeMods(Loader.java:677) at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:268) at net.minecraft.client.Minecraft.startGame(Minecraft.java:583) at net.minecraft.client.Minecraft.run(Minecraft.java:890) at net.minecraft.client.main.Main.main(Main.java:112) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) Caused by: java.lang.IllegalAccessException: Can not set static final java.util.List field net.minecraft.entity.projectile.EntityFishHook.field_146036_f to java.util.LinkedList at sun.reflect.UnsafeFieldAccessorImpl.throwFinalFieldIllegalAccessException(Unknown Source) at sun.reflect.UnsafeFieldAccessorImpl.throwFinalFieldIllegalAccessException(Unknown Source) at sun.reflect.UnsafeQualifiedStaticObjectFieldAccessorImpl.set(Unknown Source) at java.lang.reflect.Field.set(Unknown Source) at cpw.mods.fml.relauncher.ReflectionHelper.setPrivateValue(ReflectionHelper.java:143) … 38 moreImpossible avec la réflexion. Faudrait faire un coremods avec un access transformer pour le final et passe le private en static.</weightedrandomfishable></weightedrandomfishable>
-
Okay merci quand même.

Je ferais autrement !