Everything posted by Insane96MCP
-
Get a list of every entity registered and know if it is a mob?
I am missing something I've tried using isAssignableFrom() but it always returns false for every entity if (EntityList.getClass(entity).isAssignableFrom(EntityCreature.class)) //returns false EDIT: Just found out that using something like EntityCreeper.class works (obiviously only for creepers), but I need for every entity that inherits from EntityCreature And for some reasons EntityList.getClass("minecraft:lightning_bolt") returns null crashing the game. EDIT2: Managed to make it. I was doing it the wrong way. It was the opposite. Solution in last post if anyone is intrested
-
Adding a new slot to container returns an IndexOutOfBounds exception
Nope, no exception is given going through addSlotToContainer in the debugger . It happens later
-
Get a list of every entity registered and know if it is a mob?
I'm trying to get a list of every entity in the game and check if it is a mob I've tried doing something like this public static Set<ResourceLocation> entityList = EntityList.getEntityNameList(); public static ArrayList<String> mobsList = new ArrayList<String>(); for (ResourceLocation entity : entityList) { if (EntityList.getClass(entity) instanceof EntityMob) mobsList.add(entity.toString()); //do things with the arraylist } It's obiviously not working since getClass returns a Class and not an Entity What's a better and working way of doing it?
-
Detect another mod's entity
And if I don't have access to source code? So I don't know the Entity class?
-
Adding a new slot to container returns an IndexOutOfBounds exception
I'm trying to copy the anvil container. But as soon as I try to make this.addSlotToContainer(new Slot(...)); and I open the GUI, I get a java.lang.IndexOutOfBoundsException: Index: 39, Size: 39: [11:27:18] [Client thread/FATAL]: Error executing task java.util.concurrent.ExecutionException: java.lang.IndexOutOfBoundsException: Index: 39, Size: 39 at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_141] at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_141] at net.minecraft.util.Util.runTask(Util.java:30) [Util.class:?] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1109) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:407) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_141] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_141] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_141] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_141] 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:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_141] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_141] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_141] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_141] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?] Caused by: java.lang.IndexOutOfBoundsException: Index: 39, Size: 39 at java.util.ArrayList.rangeCheck(Unknown Source) ~[?:1.8.0_141] at java.util.ArrayList.get(Unknown Source) ~[?:1.8.0_141] at net.minecraft.inventory.Container.getSlot(Container.java:135) ~[Container.class:?] at net.minecraft.inventory.Container.setAll(Container.java:554) ~[Container.class:?] at net.minecraft.client.network.NetHandlerPlayClient.handleWindowItems(NetHandlerPlayClient.java:1306) ~[NetHandlerPlayClient.class:?] at net.minecraft.network.play.server.SPacketWindowItems.processPacket(SPacketWindowItems.java:72) ~[SPacketWindowItems.class:?] at net.minecraft.network.play.server.SPacketWindowItems.processPacket(SPacketWindowItems.java:13) ~[SPacketWindowItems.class:?] at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:21) ~[PacketThreadUtil$1.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_141] at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_141] at net.minecraft.util.Util.runTask(Util.java:29) ~[Util.class:?] ... 15 more Here's the code Another problem is that seems like the server is not getting input properly so I can't output nothing from the anvil. But I think that fixing the excpetion will solve this too.
-
Detect another mod's entity
Please don't go off-topic in other peoples' posts.
-
Detect another mod's entity
Is it better use EntityList#getEntityString() or EntityList#getKey().toString()? if (EntityList.getKey(entity).toString().equals("babymobs:zombiechicken")) //or if (EntityList.getEntityString(entity).equals("zombiechicken")
-
Detect another mod's entity
I'm trying to fix a problem with my mod where it checks even some mod's entity that shouldn't. How can I check if an entity is an instanceof another mod's entity (or any way to check if that mob is a mod's entity) without having to make it a dependence? So far this is what I have if (Loader.isModLoaded("babymobs")){ //if (entity instanceof EntityZombieChicken) That would require the mod's import //or //if (entity.getId() == "babymobs:zombiechicken") That's pseudocode, not actually possible ... I think }
-
How do you make your mod able to run in multiple versions in mcmod.info?
I've decided to keep 2 different and separated version so if I have to change something in the future that is not compatible with both versions I'm prepared
-
How do you make your mod able to run in multiple versions in mcmod.info?
And if I have a simple mod that was built in 1.11 and when ported in 1.12 workspace works without changing any code, is it possible to make it multiple version compatible?
-
LivingSpawnEvent gets called on mob even after the mob has already spawned
Yep On the go now to learn how to tag mobs!
-
LivingSpawnEvent gets called on mob even after the mob has already spawned
So I have to tag them after checking them to prevent the loading from disk part?
-
LivingSpawnEvent gets called on mob even after the mob has already spawned
CheckSpawn and SpecialSpawn doesn't work for animals (doesn't get called by an animal) This is the log with System.out.println("checking " + entity); No animals are checked
-
LivingSpawnEvent gets called on mob even after the mob has already spawned
I have a simple code that makes some animals become babies on spawn. But using the LivingSpawnEvent event, all the animals become small after a while. Debugging (System.out.println()), i see it gets called on animals even after they have spawned. Here's the simple event code: @SubscribeEvent public static void LivingSpawnEvent(LivingSpawnEvent event) { EntityLivingBase entity = event.getEntityLiving(); //System.out.println("checking " + entity); if (!(entity instanceof EntityAgeable)) return; EntityAgeable animal = (EntityAgeable)entity; if (animal.getGrowingAge() < 0) return; if (event.getWorld().rand.nextInt(100) < 50) { System.out.println("done to " + animal); int maxAge = 24000; int minAge = 6000; animal.setGrowingAge(-(animal.getEntityWorld().rand.nextInt(maxAge - minAge) + minAge)); } }
-
No logs in GUI or command prompt
Yeah, but I have to open the logs to see them
-
No logs in GUI or command prompt
Yep. But logs exist. But are not outputed in the gui/cmdprompt. The latest.log and the fml-latest logs are created. latest.log
-
No logs in GUI or command prompt
Using the Install Server thing in the Installer
-
No logs in GUI or command prompt
When I try to run my server with a few mods using: java -Xms1024M -Xmx2048M -jar forge-1.11.2-13.20.1.2454-universal.jar pause It gives me a bunch of errors and no logs are shown, in gui neither in command prompt Errors: 2017-09-09 16:53:15,819 ERROR Error processing element Queue: CLASS_NOT_FOUND 2017-09-09 16:53:15,842 ERROR Unable to locate appender ServerGuiConsole for logger com.mojang 2017-09-09 16:53:15,844 ERROR Unable to locate appender ServerGuiConsole for logger 2017-09-09 16:53:15,844 ERROR Unable to locate appender ServerGuiConsole for logger net.minecraft [16:53:15] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLServerTweaker [16:53:15] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLServerTweaker [16:53:15] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLServerTweaker 2017-09-09 16:53:15,887 ERROR Error processing element TerminalConsole: CLASS_NOT_FOUND 2017-09-09 16:53:15,887 ERROR Error processing element TerminalConsole: CLASS_NOT_FOUND 2017-09-09 16:53:15,887 ERROR Error processing element Queue: CLASS_NOT_FOUND 2017-09-09 16:53:15,897 ERROR Unable to locate appender Console for logger com.mojang 2017-09-09 16:53:15,897 ERROR Unable to locate appender ServerGuiConsole for logger com.mojang 2017-09-09 16:53:15,898 ERROR Unable to locate appender FmlConsole for logger 2017-09-09 16:53:15,898 ERROR Unable to locate appender ServerGuiConsole for logger 2017-09-09 16:53:15,898 ERROR Unable to locate appender Console for logger net.minecraft 2017-09-09 16:53:15,898 ERROR Unable to locate appender ServerGuiConsole for logger net.minecraft 2017-09-09 16:53:15,963 ERROR Error processing element TerminalConsole: CLASS_NOT_FOUND 2017-09-09 16:53:15,963 ERROR Error processing element TerminalConsole: CLASS_NOT_FOUND 2017-09-09 16:53:15,964 ERROR Error processing element Queue: CLASS_NOT_FOUND 2017-09-09 16:53:15,970 ERROR Unable to locate appender Console for logger com.mojang 2017-09-09 16:53:15,971 ERROR Unable to locate appender ServerGuiConsole for logger com.mojang 2017-09-09 16:53:15,971 ERROR Unable to locate appender FmlConsole for logger 2017-09-09 16:53:15,971 ERROR Unable to locate appender ServerGuiConsole for logger 2017-09-09 16:53:15,972 ERROR Unable to locate appender Console for logger net.minecraft 2017-09-09 16:53:15,972 ERROR Unable to locate appender ServerGuiConsole for logger net.minecraft I've tried running with nogui too and by double clicking the .jar file, but nothing changes.
-
Get damage dealt in AttackEntityEvent?
I've already tried getting currentHealth and nbt health but they're the same so damageDealt is 0. float currentHealth = entity.getHealth(); NBTTagCompound tagCompound = new NBTTagCompound(); entity.writeToNBT(tagCompound); float entityHealth = tagCompound.getFloat("Health"); float damageDealth = entityHealth - currentHealth;
-
Add item cooldown like Ender Pearls
No, didn't think about that since not everything is in source code (like Diamond Ore generation)
-
Add item cooldown like Ender Pearls
There's a way to add item cooldown like enderpearls do?
-
EntityLivingBase#attackEntityFrom() deals no knockback and doesn't play the death sound
In the event AttackEntityEvent I use target.attackEntityFrom(DamageSource.GENERIC, bonusDamageHealth); the entity is damaged properly but takes no knockback and doesn't play the death sound on death.
-
How to correctly remove ExampleMod with Eclipse?
Oh well, Next mod I'll make I'll edit those files
-
How to correctly remove ExampleMod with Eclipse?
I have my code in a different folder, it's not in the same folder as Forge, so I can keep more project in a Workspace The src folder is from the ExampleMod, that's why I removed it, as said, my sources are in another foler
-
How to correctly remove ExampleMod with Eclipse?
IPS spam blocked by CleanTalk.