Everything posted by jokekid
-
[1.8](apparently not so)little question about a player and his pets
public class WolfTamingEvent { private static EntityTameable entity = null; @SubscribeEvent public void onEntityInteract(EntityInteractEvent event){ EntityPlayer player = event.entityPlayer; if(event.target instanceof EntityTameable){ entity = (EntityTameable) event.target; } } @SubscribeEvent public void onLivingSetAttackTargetEvent(LivingSetAttackTargetEvent event){ if(event.entity instanceof EntityTameable && event.target == null && event.entity == entity){ System.out.println("you just tamed a entity"); } } } this seems to work, thanks for the help so far!
-
[1.8](apparently not so)little question about a player and his pets
so, when can i register the entity's UUID in the player's UUID set? is there any event for when a tameable entity gets tamed? or is there a simpler way to deal with this. some insight: this is for 1.8 and im currently dealing with vanilla wolves EDIT: im assuming EntityInteractEvent, please correct me if im wrong EDIT2: when using this code to check if the eventHandler is working: @SubscribeEvent public void onEntityInteract(EntityInteractEvent event){ EntityPlayer player = event.entityPlayer; if(event.target instanceof EntityTameable){ EntityTameable targetTame = (EntityTameable) event.target; System.out.println("you interacted with a tameable entity"); } } the printed line comes out twice per interaction... EDIT3: so yeah, that event obviously runs before the entity is being tamed, even if that interaction is going to tame it, so i still don't know when to register the entity's UUID into the player's Set...
-
[1.8](apparently not so)little question about a player and his pets
Ok, i'm assuming here i'll be making a IExtendedEntityProperties class for the player. So, while i have some experience in java overall (basic stuff), i'm having a hard time following your instructions, for instance, what type of list should i use to store the player's pets? you said i should use a WeakHashMap, but for some reason my eclipse refuses to show me source code, so i have no idea how to use it...
-
[1.8](apparently not so)little question about a player and his pets
does the player's entity store some list of entities he has tamed, or is this purely tamed entity sided? basically i wanna make levellable wolves, so on experience pickup i wanna give all the wolves a player has tamed an amount of experience.
-
Deeper exampleMod
i have no idea where to post this, since it's a download, but it's not a functionnal mod, it's just a blank mod i wrote for myself with a bit more standard classes than the exampleMod packed with the forge source download. basically this covers how i make the blank mod before i start doing any specifics, which is: -Proxy package with both common and client proxy classes, both setup in the main mod file. -Events package with an empty event handler class which is registered in the main mod file. -Reference class where i store constants for mod ID, version, and proxy class locations. -Main mod class with everything stated above registered, mod instance declared as "instance", all 3 init handlers (pre, init and post) and comments telling what you should register where. I hope this is for use to anyone who feels kinda lazy and doesnt wanna spend 20 or so minutes setting up the very basics of a mod package. Link: https://www.dropbox.com/s/m5eepq1t98pt4cl/better%20exampleMod.rar?dl=0 Note to people not knowing IDEs: refactor stuff, if you dont know what it is, look it up and do it.
-
[1.8]can't spawn a entity that extends EntityFlying?
well, that actually fixed the spawning thing, weird that you cant spawn a ghast though anyway, since i already went through the trouble of making a new class for "aggressive flyers" ima be using that. thanks for the help everyone.
-
[1.8]can't spawn a entity that extends EntityFlying?
i'm using forge 1.8-11.14.3.1450 how do i update to the newer forge? and if you wanna know what happens when summoning/spawning a entity that extends EntityFlying just try spawning a ghast. chat says "unable to summon object" and the console gives this: [18:32:05] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: java.lang.reflect.InvocationTargetException [18:32:05] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [18:32:05] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) [18:32:05] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) [18:32:05] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at java.lang.reflect.Constructor.newInstance(Unknown Source) [18:32:05] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.entity.EntityList.createEntityByID(EntityList.java:224) [18:32:05] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.item.ItemMonsterPlacer.spawnCreature(ItemMonsterPlacer.java:201) [18:32:05] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.item.ItemMonsterPlacer.onItemUse(ItemMonsterPlacer.java:107) [18:32:05] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraftforge.common.ForgeHooks.onPlaceItemIntoWorld(ForgeHooks.java:570) [18:32:05] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.item.ItemStack.onItemUse(ItemStack.java:146) [18:32:05] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.management.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:488) [18:32:05] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:624) [18:32:05] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:67) [18:32:05] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:114) [18:32:05] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:24) [18:32:05] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [18:32:05] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at java.util.concurrent.FutureTask.run(Unknown Source) [18:32:05] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:714) [18:32:05] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:727) [18:32:05] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:669) [18:32:05] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:171) [18:32:05] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:540) [18:32:05] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at java.lang.Thread.run(Unknown Source) [18:32:05] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: Caused by: java.lang.NullPointerException [18:32:05] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at com.jokekid.dungeons.mobs.eoc.EntityEoC.applyEntityAttributes(EntityEoC.java:36) [18:32:05] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.entity.EntityLivingBase.<init>(EntityLivingBase.java:161) [18:32:05] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.entity.EntityLiving.<init>(EntityLiving.java:77) [18:32:05] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.entity.EntityFlying.<init>(EntityFlying.java:14) [18:32:05] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at com.jokekid.dungeons.mobs.eoc.EntityEoC.<init>(EntityEoC.java:14) [18:32:05] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: ... 22 more [18:32:05] [server thread/WARN]: Skipping Entity with id 4 and i posted the vanilla class so you guys didnt need to search for it, i already posted my entire repo before
-
[1.8]can't spawn a entity that extends EntityFlying?
what you are looking at is the ghast class, not my own entity class, and yes, first i copy necesary methods, make sure it works, and then i edit them as i need. if i could, this thread wouldnt exist, you CANT spawn entities that extend the EntityFlying class, that's not a question, it's a fact. ok, didnt know that, will fix. alright, i think i got this thing solved, i made a new class mixing both the entityMob class and entityFlying class, now it spawns and flies. and i think i found the method that allows you to spawn a mob or not, i'll edit this post later when confirmed EDIT: so i changed the registering to what you said, and now they don't work anymore... in case i misunderstood, here's the non-functional code: public static void createEntity(Class entityClass, String entityName, int solidColor, int spotColor){ EntityRegistry.registerModEntity(entityClass, entityName, nextId, DungeonsMain.instance, 64, 1, true); EntityList.entityEggs.put(Integer.valueOf(nextId), new EntityList.EntityEggInfo(nextId, solidColor, spotColor)); nextId++; } nextId is a static int that starts at 0. and i tried giving the registerModEntity the 2 int values for the egg colors and the method doesn't exist...
-
[1.8]can't spawn a entity that extends EntityFlying?
it's based on the ghast's entity code: http://pastebin.com/yiZvJzYc so, i dont know how to make an entity fly without it being a FlyingEntity, cuz if it's a FlyingEntity you can't spawn it using the egg or command... EDIT: also, how the hell am i supposed to register a entity without a ID? and while the egg thing may be unnecesary, it sure helps to have a spawn item instead of using commands
-
[1.8]can't spawn a entity that extends EntityFlying?
first of all, all that "junk" is to have all mob stuff located in one class, and it helps... second of all, this doesn't have anything to do with my issue, ive been messing around with the EntityEoC's extension, and if it extends entityMob it CAN be spawned, but it will fall through the floor because it's a noClip entity, and should be flying around...
-
[1.8]can't spawn a entity that extends EntityFlying?
what do you mean exactly? do you mean i should get rid of this line: EntityRegistry.registerGlobalEntityID(entityClass, entityName, id);?
-
[1.8]can't spawn a entity that extends EntityFlying?
https://github.com/jokekid/DungeonMod sorry, but the thing is, i cant spawn a vanilla ghast either, the error seems to come from the constructor, where it calls it's super constructor (FlyingEntity's)
-
[1.8]can't spawn a entity that extends EntityFlying?
so im making a new flying mob, right now i just have the entity class done, so i thought i'd try it out, but for some reason i can't spawn it, not through the egg nor command, so i thought i did something wrong somewhere, but then i noticed i cant spawn a ghast either, and i get the same error for both. i really need to be able to spawn this creature at will, specially since im making some custom AI tasks that i obviously need to test...
-
How to make reverse gravity
somewhere is learning java, somewhere is learning basic modding, somewhere is NOT a coremod
-
[1.8] cloning a zombie turns into a blob of boxes
well, that was an easy fix, thanks a lot, working as it should now
-
[1.8] cloning a zombie turns into a blob of boxes
For my mod im adding some mobs, so the first i wanted to add was the simplest, a mummy. Basically this mummy is the same as a zombie, just with different spawn rules and changed attack/speed attributes. so i've tried this 2 ways so far: one was to make entity, model and render classes extend the zombie's counterparts; this kinda worked, but even if i override the getResourceLocation() methodS to return the custom texture, it would still spawn with a zombie texture. The other was to make the three classes practically the same as the zombie classes, but with some refactored methods (obviously not the ones that were overriding their super counterparts), the problem here is this: so now the texture is loading properly (only changed the head so far), but as you can see the model's not rendering as it should at all... here's my repo: https://github.com/jokekid/DungeonMod the files are in the mobs/mummy folder. (the commented part in the model's setRotationAngles() wasn't commented before and i had the same issue)
-
[gitHub]How do i submit a WIP mod to github?
i know some GIT, and i know some forge modding, but seeing how weird the eclipse workspace gets setup with forge, i have no idea how to get this working on gitHub...
IPS spam blocked by CleanTalk.