Jump to content

Adityagupta

Members
  • Posts

    54
  • Joined

  • Last visited

Everything posted by Adityagupta

  1. I registered the event handler, and fall distance to 0 didn't work either. Also, PlayerTickEvent doesn't work, but the way I did it, the fall speed is lowered, but the fall damage is not.
  2. Hi Everybody, I am making a simple mod that deploys a parachute whenever the player is sneaking, but I can't get it to negate fall damage. My code is as follows: package org.devoxx4kids.forge.mods; import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class Parachute { @SubscribeEvent public void deployParachute(LivingUpdateEvent event) { if (!(event.entity instanceof EntityPlayer)) { return; } if (!((EntityPlayer) event.entity).isAirBorne || !((EntityPlayer) event.entity).isSneaking()) { return; } event.entity.motionY = -0.05; event.entity.fallDistance = -10; } } The "event.entity.fallDistance = -10" line is for negating damage, but it doesn't work. Can someone tell me what I am doing wrong?
  3. Thanks!! It all worked perfectly. The inventory block renderer was the thing I was missing.
  4. That's probably what I missed. What is the inventory block renderer and how do I register it? I'm guessing it renders the blocks in the inventory, but I don't know if that's right. I also don't know how to register it. Can you tell me what it is and how to register it?
  5. Thanks! It all worked except for the ItemBlock texture. I got the placed block texture and model to work, but the ItemBlock doesn't work. Blockstate file: { "variants": { "normal": { "model": "mymods:enderBlock" } } } Block model file: { "ambientocclusion": false, "textures": { "particle": "blocks/stone", "base": "blocks/stone", "pole": "blocks/emerald_block" }, "elements": [ { "from": [ 2, 0, 0 ], "to": [ 14, 1, 16 ], "shade": false, "faces": { "down": { "uv": [ 2, 0, 14, 16 ], "texture": "#base" }, "up": { "uv": [ 2, 0, 14, 16 ], "texture": "#base" }, "east": { "uv": [ 16, 0, 0, 1 ], "texture": "#base" }, "west": { "uv": [ 0, 0, 16, 1 ], "texture": "#base" }, "north": { "uv": [ 14, 0, 2, 1 ], "texture": "#base" }, "south": { "uv": [ 2, 0, 14, 1 ], "texture": "#base" } } }, { "from": [ 7, 1, 6 ], "to": [ 9, 8, 10 ], "shade": false, "faces": { "up": { "uv": [ 7, 6, 9, 10 ], "texture": "#pole" }, "east": { "uv": [ 6, 1, 10, 8 ], "texture": "#pole" }, "west": { "uv": [ 6, 1, 10, 8 ], "texture": "#pole" }, "north": { "uv": [ 7, 1, 9, 8 ], "texture": "#pole" }, "south": { "uv": [ 7, 1, 9, 8 ], "texture": "#pole" } } } ] } The block model file is long because I wanted it to have a cool shape. Item model file: { "parent": "mymods:block/enderBlock", "display": { "thirdperson": { "rotation": [ 10, -45, 170 ], "translation": [ 0, 1.5, -2.75 ], "scale": [ 0.375, 0.375, 0.375 ] } } } Can you tell me what I am doing wrong?
  6. The "setBlockState()" method worked really well, thanks for that tip. The link you gave me on the first bullet looks interesting, but I don't see how it makes a block model/texture. Do I just make a file with that code or something similar, or do I need to make a class like that one to get the block to render? Also, for the last one, my question is how do I change the in-game name of my stairs, do I need to do it in the IBlockState implemented by its superconstructor's parameter, or do I have to do it somewhere else?
  7. Hi everybody, I am updating my mods to 1.8, and I have a few questions as to how I can do so: What are the blockstate, block model, and item model files you need for textures/names of blocks/items? The "setBlock(x, y, z, block)" method in the "World" class doesn't exist, what is the alternative? I noticed that stairs use "IBlockState"s in the superconstructor, but there is no way to set the name, so do I need a blockstate file or something for that?
  8. When I do the "gradlew build" command to package my mod into a .jar file, the name of the .jar file is always "modid-1.0", even if I change the modid or version. Does anybody know why the name is so weird?
  9. Thanks, I didn't know that it was so easy. I thought it was supposed to be a .zip file because that is what Minecraft Wiki told me, but a .jar file works too.
  10. Hi Everyone, I'm trying to package my 1.7.10 mod into a .zip file, but I don't know how. Minecraft Wiki only has tutorials for 1.6.4 and below, and I can't find any tutorials anywhere else. Does anyone know how to package my mod? Thanks
  11. I've been trying to make a new command for a while now, but everything I do crashes my game. Does anyone know how to make a new command?
  12. Never mind, I figured it out. Apparently, the method getItemInUse() made me crash while the method getHeldItem() didn't.
  13. I am trying to make a mod that lets you throw nether stars like ninja shurikens. For that, I am trying to check a player's held item, but whenever I do, my game crashes. My code is as follows: package org.devoxx4kids.forge.mods; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.util.ChatComponentText; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action; import cpw.mods.fml.common.eventhandler.SubscribeEvent; public class NinjaSkills { @SubscribeEvent public void throwShuriken(PlayerInteractEvent event){ if (event.action != Action.RIGHT_CLICK_AIR && event.action != Action.RIGHT_CLICK_BLOCK) { return; } if (event.entityPlayer.getItemInUse().getItem() != Items.nether_star) { return; } event.entityPlayer.addChatMessage(new ChatComponentText("You threw a shuriken!")); } } I have tried checking a player's held item in MANY other mods, but it never works.
  14. That didn't work, there was no way to get the player or the player's name from those events.
  15. How would I make it run on the server and not the client? I tried the @SideOnly(Side.SERVER) annotation, but that didn't work.
  16. My mod is a simple one that logs a message in the server console when a player joins or leaves a world. The login message worked, but the logout one did not. I am using the FMLCommonHandler.instance().bus() bus. My code: package org.forge.plugins; import net.minecraft.entity.item.EntityTNTPrimed; import net.minecraftforge.event.entity.EntityJoinWorldEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.PlayerEvent; public class PlayerEntryExit { @SubscribeEvent public void logIn(PlayerEvent.PlayerLoggedInEvent event) { System.out.println(event.player.getGameProfile().getName() + " logged in."); } @SubscribeEvent public void logOut(PlayerEvent.PlayerLoggedOutEvent event) { System.out.println(event.player.getGameProfile().getName() + " logged out."); } }
  17. That worked, but does anyone know why there are so many differnet buses?
  18. My forge version is 1.7.10. I didn't know you could use the # button, thanks for sharing that tip. Also, where would I find the FML bus, and not the regular EVENT_BUS? In the MinecraftForge class, the only buses are EVENT_BUS, ORE_GEN_BUS, and TERRAIN_GEN_BUS.
  19. I am making a simple mod that makes a console message when a player logs in/logs out of a game. The logging in thing is working, but the logging out thing isn't. My code is: package org.forge.plugins; import net.minecraft.entity.item.EntityTNTPrimed; import net.minecraftforge.event.entity.EntityJoinWorldEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.PlayerEvent; public class PlayerEntryExit { @SubscribeEvent public void init(PlayerEvent.PlayerLoggedInEvent event) { System.out.println(event.player.getGameProfile().getName() + " logged in"); } @SubscribeEvent public void init(PlayerEvent.PlayerLoggedOutEvent event) { System.out.println(event.player.getGameProfile().getName() + " logged out"); } }
  20. I did register the event, but it still didn't do anything. Also, like I said above, I delete my code if it doesn't work.
  21. That didn't work either, it just didn't do anything.
  22. I already deleted that code, but how would i use World.getCurrentTime to check if 20 ticks passed without a loop?
  23. The ItemBlock thing makes sense, but it is still giving me a NullPointerException.
  24. I tried the subclassing thing, but it didn't work. It just gave me a huge stacktrace which I couldn't find the top of. Also, I tried using a while loop with the World.getCurrentTime thing, but it didn't work either.
  25. Neither of those work, when I make a new TNT, I can't change it's size, and there is no World.getCurrentWorldTime method.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.