Jump to content

perigrine3

Members
  • Posts

    55
  • Joined

  • Last visited

Everything posted by perigrine3

  1. I want to change the dimension for the player to the Nether upon death. I tried this but it didn't work. public class globalEvents { public void onDeath(livingDeathEvent event) { if(event.entity instanceof EntityPlayer) { entity.changeDimension(-1); } } } Please help?
  2. Damn. Okay. Thank you.
  3. I'm trying to figure out how to open the crafting table GUI when a custom block is right-clicked. Ideas?
  4. I did but I got rid of that. //Removes items from Creative Tabs// @SubscribeEvent public void hideFromCreative(FMLPostInitializationEvent event) { /*/Swords/*/ { Item.IRON_SWORD.setCreativeTab(null); Item.WOODEN_SWORD.setCreativeTab(null);  Item.STONE_SWORD.setCreativeTab(null); Item.DIAMOND_SWORD.setCreativeTab(null); Item.GOLDEN_SWORD.setCreativeTab(null); } This is what I have now.
  5. I don't think I understand it any better than I did before. //Removes items from Creative Tabs// @SubscribeEvent public void hideFromCreative(FMLPostInitializationEvent event) { /*/Swords/*/ { Item.IRON_SWORD.setCreativeTab(null); Item.WOODEN_SWORD.setCreativeTab(null); Item.STONE_SWORD.setCreativeTab(null); Item.DIAMOND_SWORD.setCreativeTab(null); Item.GOLDEN_SWORD.setCreativeTab(null); } If this is wrong, can someone PLEASE explain in Layman's terms how to fix it and why it is wrong? And can someone please give me an alternate solution? A different way to remove items and blocks from all creative tabs? Even just a way to repress the creative tabs would be fantastic.
  6. //Removes items from Creative Tabs// @SubscribeEvent public void setCreativeTab(IForgeRegistry item) { ForgeRegistries.ITEMS.setCreativeTab(null); Item.registerItems(FMLPostInitializationEvent event) { /*/Swords/*/ { Items.IRON_SWORD.setCreativeTab(null); Items.WOODEN_SWORD.setCreativeTab(null); Items.STONE_SWORD.setCreativeTab(null); Items.DIAMOND_SWORD.setCreativeTab(null); Items.GOLDEN_SWORD.setCreativeTab(null); } I'm unsure as to how to correctly format this. Can somebody please show me what I'm doing wrong?
  7. I found an event that should work I think. It would have to activate as soon as the game loads, without crashing it, so I chose "FMLPostInitializationEvent". Now what I'm doing is listing out all of the item's I need to remove. However, I also have some blocks to remove. Would I call on them by say "Blocks" instead of "Items"?
  8. Then how would I use the items registry correctly? Also, I figured it needed to be an event method. So like the event handler I made for repressing entities from spawning?
  9. I'm probably wrong again, but what the heck. Are either of these correct? 1) @SubscribeEvent public void setCreativeTab(IForgeRegistry item) { ForgeRegistries.ITEMS.setCreativeTab(null); } 2) @SubscribeEvent public Item setCreativeTab(CreativeTabs tab) { ForgeRegistries.ITEMS.setCreativeTab(null); } If not, please tell me why not, and if so, please tell me why. Also, what are the constants of Items.class? Could you give a link?
  10. Alright, that makes sense, and I'm glad that this is working out so well so far. Now to move on to disabling the items: So I assume that the code for this looks like item.setCreativeTab(null), but what I am wondering is how do I get specific items to hide? How do I reference them in a get statement? My first guess would be to use an "if" statement, like the one in my "onEntityJoin" event. Here's what I'm thinking: public void hideCreativeItems(String item) { if (item.getItem() instanceof /*/WHATEVER ITEM/*/) { } item.setCreativeTab(null); } I'm probably wrong about the string part because I'm still unsure as to how to use those. Please fix my code as necessary.
  11. Thank you.
  12. How would I go about canceling the EntityJoinWorldEvent? Can you give an example of how to format it? I was looking here for examples so I could get a basic idea of how to use it and formulate a complete "Event Handler" as I understand it's called (https://www.programcreek.com/java-api-examples/?class=net.minecraftforge.event.entity.EntityJoinWorldEvent&method=setCanceled), but I figure if I can see one designed specifically for my problem, I may have a much better time solving it. This is what I have so far... public class RemoveStuff { //Removes all entities upon spawning// @SubscribeEvent(priority = EventPriority.HIGHEST) public void OnEntitySpawn(EntityJoinWorldEvent event) { if (event.getEntity() instanceof /*/WHATEVER ENTITY/*/) { } event.setCanceled(boolean true); } Am I close? Furthermore, how do I call on the item to set it's creative tab to null? Is that what the hashtag is for? To let you know where to specify what said Item/Event is?
  13. Thank you a lot, but I have another question; what are the # hashtags for? I've seen them a lot in other forums and modding assistance, but I have no clue what they mean?
  14. I was inspired by the game Farcry Primal to create a Minecraft mod similar to it, mainly only implementing the Stone Age survival concept. However, to do this, some mobs things must be removed because they don't fit in. For example, zombies, creepers, endermen, skeletons, spiders, cave spiders, silverfish, iron weapons, pickaxes, and basically everything else in Minecraft. In other words, I'm attempting to turn Minecraft into another game by adding a mod. I'm pretty sure that I have to call EntityJoinWorldEvent to replace entities (from what I've read from modder forums), but I'm not sure how to use it to REMOVE entities. Furthermore, I need a way to remove/replace ITEMS in Minecraft, because the stone age didn't have iron weapons (or swords, pickaxes, etc.). And finally, I need a way to remove villages and structures, although this one I can just suggest that the player turns it off. I feel like this is a lot, but I know that other mods have done stuff like this, so therefore it's possible.
  15. I think I figured it out, but I think I'll just replace the items not to break to Dirt/Grass, Stone, Diamond, and Obsidian blocks. If I find anything else I don't want being destroyed, I'll add it in.
  16. I'm using 1.12.2. I'm still kinda new to coding, so how would getting the itemstack dropped by the block help me prevent it from being destroyed?
  17. No. Really? Obviously, that's literally what I said, I just don't know how.
  18. I'm making a Giant right now, and I wanted to make it so that, when it walks, trees are "crushed" under it. I figured, "well the Ender Dragon does something like that", so I went into its .class file and found the part for "canEntityDestroy", so I began making a new EntityAI class. Now, my goal is to change the code so that, instead of only preserving Command Blocks, Iron Bars, and the End Gateway, it will preserve everything BUT trees and wood planks. I know I could just add in every type of existing block, but I don't want to do that because I don't have the time (or the sanity) for such endeavors. SO, if anybody has any ideas as to how to make it so that I can list what TO destroy rather than what NOT to destroy, I'd like to hear them. Here's the code from EntityDragon.class: private boolean destroyBlocksInAABB(AxisAlignedBB p_70972_1_) { int i = MathHelper.floor(p_70972_1_.minX); int j = MathHelper.floor(p_70972_1_.minY); int k = MathHelper.floor(p_70972_1_.minZ); int l = MathHelper.floor(p_70972_1_.maxX); int i1 = MathHelper.floor(p_70972_1_.maxY); int j1 = MathHelper.floor(p_70972_1_.maxZ); boolean flag = false; boolean flag1 = false; for (int k1 = i; k1 <= l; ++k1) { for (int l1 = j; l1 <= i1; ++l1) { for (int i2 = k; i2 <= j1; ++i2) { BlockPos blockpos = new BlockPos(k1, l1, i2); IBlockState iblockstate = this.world.getBlockState(blockpos); Block block = iblockstate.getBlock(); if (!block.isAir(iblockstate, this.world, blockpos) && iblockstate.getMaterial() != Material.FIRE) { if (!this.world.getGameRules().getBoolean("mobGriefing")) { flag = true; } else if (block.canEntityDestroy(iblockstate, this.world, blockpos, this) && net.minecraftforge.event.ForgeEventFactory.onEntityDestroyBlock(this, blockpos, iblockstate)) { if (block != Blocks.COMMAND_BLOCK && block != Blocks.REPEATING_COMMAND_BLOCK && block != Blocks.CHAIN_COMMAND_BLOCK && block != Blocks.IRON_BARS && block != Blocks.END_GATEWAY) { flag1 = this.world.setBlockToAir(blockpos) || flag1; } else { flag = true; } } else { flag = true; } } } } } if (flag1) { double d0 = p_70972_1_.minX + (p_70972_1_.maxX - p_70972_1_.minX) * (double)this.rand.nextFloat(); double d1 = p_70972_1_.minY + (p_70972_1_.maxY - p_70972_1_.minY) * (double)this.rand.nextFloat(); double d2 = p_70972_1_.minZ + (p_70972_1_.maxZ - p_70972_1_.minZ) * (double)this.rand.nextFloat(); this.world.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, d0, d1, d2, 0.0D, 0.0D, 0.0D); } return flag; } Thanks for your help!
  19. Yeah it is, but it works now. I tested it and fixed it. It was funny lol, I tried using the Amulet and the boots appeared floating over my head, the chestplate on my leggings, and the leggings on my chestplate lmao.
  20. Why do I want to check the key of the event? I set it to 'M'. Like double check it you mean? HOLY S*** I THINK I JUST GOT IT!!! THE CODE RETURNED WITHOUT ERRORS!!! I just have to test in in Minecraft now to see if it actually does what I want, but I think I got it! It's been so long since I came up without errors. :C
  21. Inside an OnKeyInput event. I don't need multiplayer. I know there needs to be some sort of function command before I put "player.inventory.armorInventory..." though, right? Like an access modifier and then something like that "OnKeyInput" thing. It's in the code as: public void onKeyInput(InputEvent.KeyInputEvent event) and then brackets after that, which is where I'm putting the Minecraft.getMinecraft().player.inventory.armorInventory.set(armorIndex, itemStack);
  22. Lol, not really. I suck at focusing on the things I probably SHOULD be doing instead. So, I've been at it for a while, but I honestly don't know how to get the armor slot index like Cadiboo said to. Rn, all I have is Minecraft.getMinecraft().player.inventory.armorInventory.set(armorIndex, itemStack); but idk which access modifiers to use, or what "get" thing to use to get the armor slot index. I think I have a basic idea of what that means; it's calling for it, but idk how to DO that... :3 Help...?
  23. Thank you Cabidoo! Also, I see what you're saying: but that's actually how I work. I look at things other people have made, and I take it apart and put it back together. By doing so, I learn something about it. I do that with everything in life. What I was saying is that, if you build me this thing that I'm asking for, I can learn something from it. I understand the gist of coding. I have learned AppleScript, I am learning JavaScript, and I am learning Twine (even though that doesn't really count as a coding language because it's like MCreator for JavaScript, but it does require a level of coding so I'm including it). I'm not COMPLETELY stupid. I didn't think of it that way, DavidM, I suppose you are right. However, I did make this awesome mod for a weapon that you can throw and teleport to with a keybind, at which point it is returned to your inventory. WITH MCREATOR. I made it have a spin cycle while it flies through the air, and I got it to work smoothly (for the most part ) over the course of two years. I think it really just depends on who's using MCreator, and whether their creative or not. But I'm sure you're going to keep arguing with me, so I don't know why I bother. Anyways, I WILL go learn Java, I was just trying to make this mod as quickly as possible for my little brother and sister to play because we all love that show and Minecraft, so I told them I would make both of them a mod for it. I'm just a sucker for details, so I wanted this to work as I saw it in my head. Thank you for giving me an answer Cabidoo. I am going to play with that and see if I can get this b**** to work. Also, if you want to try a sample of that mod I was talking about, I'm going to attach it. Even though I doubt anybody will actually try it... TeleBlade Sample Mod.jar
  24. FURTHERMORE, I know the difference, I just make that mistake all the time. Usually I catch myself though. I know because I've been learning JavaScript, and I'm working on an interactive story.
  25. Also, if you guys help me, I can finish this project and begin learning to code Java.
×
×
  • Create New...

Important Information

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