Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Roymond

Forge Modder
  • Posts

    30
  • Joined

  • Last visited

Everything posted by Roymond

  1. That's where I thought it would be too, but it appears to only have code travelling to the end. From the BlockEndPortal /** * Triggered whenever an entity collides with this block (enters into the block). Args: world, x, y, z, entity */ public void onEntityCollidedWithBlock(World p_149670_1_, int p_149670_2_, int p_149670_3_, int p_149670_4_, Entity p_149670_5_) { if (p_149670_5_.ridingEntity == null && p_149670_5_.riddenByEntity == null && !p_149670_1_.isRemote) { p_149670_5_.travelToDimension(1); } } [/code I'm going to try poking through the travelToDimension code more. See what I can make of it.
  2. Hello guys and gals, I'm playing around with the idea of making a dimension jumper. For now I have two items, one that will jump back and forth from the Nether to the Overworld, and one that will jump from the overworld to the end. However, when I jump from the end to the overworld, nothing renders. I'm assuming that this is because the jump from the end to the overworld is a bit more complicated than simply telling the server to move the player from dimension 1 to dimension 0. However, for the life of me I cannot find where the code is that explains what is happening when the player enters the end portal while in the end. Could anyone please point in the correct direction?
  3. One follow up question: When I implement the resulting explosion, it destroys the terrain but does not damage the player. Is this because of the fact that I am implementing the create explosion in the event? Here's the updated code: @SubscribeEvent public void explosion(BlockEvent.BreakEvent event){ Block block = event.block; EntityPlayer player = event.getPlayer(); World world = event.world; int x = event.x; int y = event.y; int z = event.z; int blockMetadata = event.blockMetadata; if (!world.isRemote) { if((block == Blocks.grass || block == Blocks.dirt) && EnchantmentHelper.getSilkTouchModifier(player)!=true) { world.createExplosion(player, x, y, z, 3, true); } } }
  4. Apologies. I must have been very tired when I read the docs the first time around because I completely missed that. Also thank you for the suggestion!
  5. I'm noticing now that I am getting a pretty consistent crash with a Null Point Exception and after poking at it with a stick, it seems like the EntityPlayer is being set to null before getting passed to the create explosion. Is there a way to make this more stable? I've thought about checking whether or not the event.Harvester is null before going to the create explosion, but is that the best way?
  6. Hey Modders, I'm testing an idea of an ultra sensitive block that has to be harvested with silk touch else it will explode upon being harvested. For this, I created an event handler which subscribed to the harvest drop event and checks to see if the block was harvested with silk touch and if it isn't, it creates an explosion (Code below) @SubscribeEvent public void explosion(BlockEvent.HarvestDropsEvent event){ if(event.block == Blocks.grass || event.block == Blocks.dirt){ if(event.isSilkTouching == false){ event.world.createExplosion(event.harvester, event.harvester.posX, event.harvester.posY, event.harvester.posZ, 10, false); } } } However, when I load up a newly generated world, I am able to mine up the block, and able to see the explosion but the terrain and the player are unaffected. Could you guys please tell me what I am missing? I've taken a look at the Creeper code as well as the TNT code and it looks to be the same (I've even tried throwing in the condition to check and see if the world is remote and it doesn't change anything)
  7. Looking at it a bit more, you could probably check to see if the item is enchanted before adding the enchantment to it. Keep in mind though, you can't easily remove the enchantment from the item. So if someone were to take off the armor, the armor would still be enchanted.
  8. My first question is why are you calling for "getCurrentArmor" in your if statements when you've already created ItemStacks for those slots just lines above? But realistically, I think that the problem you are having is that you are adding enchantments to armor, EVERY TICK. The code you have there doesn't just add ONE enchantment and stop, it adds "Unbreaking I" to your armor for EVERY tick that condition is true. This eventually leads to a NullPointException (I'm not sure the crash occurs because of how many enchantments you have on the piece or because you take the armor off). The way you made it seem in the first post was that you were going to be modifying the player's dig speed, movement speed, and other things that can be controlled either by potion effects or through EntityPlayer. If you are going to be adding an enchantment to a set of armor while you are wearing it, then this method is not for you.
  9. That is exactly what Abyrnos is saying. The function "onArmorTick" in the custom Armor class is where you would have the series of conditional statements to achieve your goal. It might be a lengthy process and I'd highly recommend writing out all possible combinations.
  10. I have discovered a potential answer to this solution. I simply added ".setContainItem(null)" to the "Items.water_bucket" in my crafting recipe. The final code would looks like this (Note, this is just an example: GameRegistry.addShapelessRecipe( new ItemStack( myItem ), new Object[] { Items.ender_pearl, Items.water_bucket.setContainerItem(null)} ); Hopefully this helps someone in the future.
  11. To provide some further information, here's the event handler class that I have. package net.roymond.testingMod.EventHandler; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.roymond.testingMod.mainClass; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.PlayerEvent; import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent; public class CraftingHandler { public static CraftingHandler INSTANCE = new CraftingHandler(); private CraftingHandler(){ } @SubscribeEvent public void PlayerEvent(ItemCraftedEvent event){ ItemStack craftedItem = event.crafting; if (event.crafting.getItem() == mainClass.roymondBucket){ System.out.println("Desired item has been crafted."); for (int i=0; i< event.player.inventory.mainInventory.length; i++){ System.out.println(event.player.inventory.mainInventory[i]); //Prints each slot out on a line. } if (event.player.inventory.hasItem(Items.bucket)){ System.out.println("Player has Item. Cleared to remove it"); } } } } So this will report to me that the desire item has been crafted and will report back the player's inventory but if you go through the player's inventory you will not see a bucket (Items.bucket). Any ideas on how I can capture this bucket so I can get rid of it?
  12. Hey everyone, I've been playing around with fluids and I want to add a custom recipe to enable a player to get it in survival. I noticed that that when you do craft the item (dust + water bucket), the player gets an extra empty bucket. I assume that this is because Minecraft recognizes that in vanilla recipes (Cake for Example) you don't want to take the bucket from the player. This lead me to believe that I should get a handler that subscribes to ItemCraftedEvent, looks at the event to see if my custom bucket is created and if there is an empty bucket in the players inventory, and removes one bucket using "consumeInventoryItem" However, after further inspection, it appears that empty bucket that is given to the user shows up after the event has been triggered and thus doesn't removed. Is there a good method to handle this situation? Update on 2014/07/30 I have discovered a potential answer to this solution. I simply added ".setContainItem(null)" to the "Items.water_bucket" in my crafting recipe. The final code would looks like this (Note, this is just an example: GameRegistry.addShapelessRecipe( new ItemStack( myItem ), new Object[] { Items.ender_pearl, Items.water_bucket.setContainerItem(null)} );
  13. Hey everyone, I apologize if this is in the incorrect forum, I was in the ForgeGradle forum and saw the post saying no support requests and followed it to here. Basically I was following the instructions put forth by GrygrFlzr and have gotten to the point where I select the base directory for Forge (shown as the folder 1.7.2 here: http://i.imgur.com/f1gd2xd.png ) For some reason though, Eclipse does not allow me to select the project that shows up. I'm sure it's something rather obvious I am missing, but I have been following the instructions so I'm confused as to what could have gone wrong. Any suggestions would be greatly appreciated.
  14. Unfortunately that doesn't seem to work either... At this point, here is the entire class file for the Dimension Watch (I'm calling it the Dimension Watch) package roymond.teleports; import net.minecraft.world.Teleporter; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class dimensionwatch extends Item { double[] position = {0,0,0}; public EntityPlayer player; public dimensionwatch(int par1) { super(par1); // TODO Auto-generated constructor stub } @Override public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer entity) { shift(entity,position); System.out.println(position[0] + " " + position[1] + " " + position[2]); return par1ItemStack; } public double[] shift(EntityPlayer entity, double[] position){ if (entity.ridingEntity == null && entity.riddenByEntity == null && entity instanceof EntityPlayerMP) { EntityPlayerMP thePlayer = (EntityPlayerMP) entity; if (thePlayer.dimension == 1 && !thePlayer.worldObj.isRemote){ thePlayer.travelToDimension(0); thePlayer.setPositionAndUpdate(position[0], position[1]+1, position[2]); //thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, 0, new Teleporter(thePlayer.mcServer.worldServerForDimension(0))); } else if (thePlayer.dimension == 0 && !thePlayer.worldObj.isRemote){ position[0] = entity.posX; position[1] = entity.posY; position[2] = entity.posZ; thePlayer.travelToDimension(1); //thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, 1, new Teleporter(thePlayer.mcServer.worldServerForDimension(1))); } } return position; } } And here is the Item's declaration in the base mod: public Item dimensionSwitcher = new dimensionwatch(500).setUnlocalizedName("dimensionSwitcher").setCreativeTab(CreativeTabs.tabCombat);
  15. Like diesieben07 said, without more description it can be impossible for us to know what is going on. Are you getting error messages? Are there no errors but the models aren't showing up? The first thing I am reminded of when I boot into 1.6.4 is that my items have ID numbers. This won't work in 1.7, you need ID strings (Don't quote me on this, I'm installing the latest forge to test this theory). Did you convert your ID numbers?
  16. I've given this a go and unfortunately it doesn't solve the problem. I'm still experiencing the same issue. When I return to the overworld, I am greeted with a grey screen. The coordinates are the same, and the player does not fall, but the graphics do not render until I reload the world.
  17. Right now, I am using the base Teleporter class from the package "net.minecraft.world" The reason I've been questioning whether I need a custom teleport class is because I'm not building a portal. I am just switching dimensions when the user right clicks on the item.
  18. Right now I am using the "transferPlayerToDimension" function to return to the over world. It requires an EntityPlayerMP, the dimension ID and a teleporter.
  19. I hope your teleportation code isn't in a client side only class. You should look into the ender pearl code, it is pretty straight forward. I'm pretty sure that the class is not Client Side Only. The current code executes switching dimensions when you right click on the item. It's weird because transporting to the end works perfectly. Every time it renders. It's coming back to the Over World that is the problem. Is the code for the End Game Script (after you defeat the dragon and get the player message) worth taking a look at? Or maybe even initial spawn?
  20. One thing I've tried after playing around with a "Emergency Teleport" is the function "setPositionAndUpdate" in the EntityPlayer class. Unfortunately this does not seem to solve the problem when coming back from the end to the OverWorld. I'm going to look into the End Portal Code and hopefully find where they send back to the overworld (skipping the message code). However, if anyone has any ideas I'd greatly appreciate it.
  21. Hey Modders, I'm working on a mod that allows the user to switch dimensions from a GUI menu. The intention is that I will add multiple dimensions at a later date but for now I am just working with the main three that we have in the game. The issue I am currently running into is when I shift from the End (Dimension 1) to the Overworld (Dimension 0). The problem is that the overworld does not render until the player logs out and logs back in. What I mean by does not render is that the screen becomes grey and stays grey until the person relogs. Here's the current code: public double[] shift(EntityPlayer entity, double[] position){ if (entity.ridingEntity == null && entity.riddenByEntity == null && entity instanceof EntityPlayerMP) { if (entity instanceof EntityPlayerMP) { EntityPlayerMP thePlayer = (EntityPlayerMP) entity; if (entity.dimension == 1){ entity.setPosition(position[0], position[1]+1, position[2]); thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, 0, new Teleporter(thePlayer.mcServer.worldServerForDimension(0))); } else if (entity.dimension == 0){ position[0] = entity.posX; position[1] = entity.posY; position[2] = entity.posZ; thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, 1, new Teleporter(thePlayer.mcServer.worldServerForDimension(1))); } } } return position; } Can anyone point me in the right direction as to a tutorial, or a package that I can look investigate to solve my issue?
  22. I think using the Random class like AndyLun said above and then either an if/switch statement could give you exactly what you are looking for. Unless you are expecting that it will always be a pattern in which case you could just increment a counter and when it hits it's max, set it to the first. I wrote this up pretty quick as an example of a generic block. public int idDropped(int par1, Random par2Random, int par3){ int drop = par2Random.nextInt(4); if (drop == 0){ return Item.diamond.itemID; } else if (drop == 1){ return Item.ingotIron.itemID; } else if (drop == 2){ return Item.ingotGold.itemID; } else { return Item.emerald.itemID; } }
  23. Honestly, JAVA is the third/fourth language that I've learned, so the resources that I've used to learn it might not be as effective to you as they were for me. Either way, here are a couple links that I've found to be helpful: Udacity's Intro to Programming - https://www.udacity.com/course/cs046 TheNewBoston's Video Series - Reddit's LearnJava subreddit - http://www.reddit.com/r/learnjava That being said, I went through the entire Udacity course, and then watched a couple videos from TheNewBoston playlist.
  24. Hello Modders! As of this far, I've been coding on one computer. However, as I have multiple computers I would like to expand where I can code by finding a way to store my code somewhere online for me to be able to download it. After some research I recognized that a GIT repository would be the simplest and probably most effective option. However, when I set it up with a clean Forge Dev environment, pushed all the files to the repo and then attempted to clone the repository on another computer, I was unable to launch a build out of Eclipse. Basically my process of how I created the GIT repo are as follows: Downloaded a clean Forge ZIP File Unzipped and installed Forge Dev Environment Tested the environment (Just by launching a build) - It starts fine. Loaded up GIT Bash Navigated to the directory I have set up for the GIT (which has all the files extracted from the clean Forge Dev install) git add --all git commit --all -m "First Commit, Clean Forge" git push --all After everything had been successfully uploaded to BitBucket. I went to the other computer and typed in the following command: git clone https://(username)@bitbucket.org/(username)/(git-name).git Replacing (username) with my username and git-name with the name of my repo. It was at this time that everything should have been downloading to my second computer. Once the download was complete, I changed the work space in eclipse to the one I just downloaded, attempted to launch a build and was presented with the following errors: 2014-01-12 19:23:16 [iNFO] [ForgeModLoader] Forge Mod Loader version 6.4.49.965 for Minecraft 1.6.4 loading 2014-01-12 19:23:16 [iNFO] [ForgeModLoader] Java is Java HotSpot(TM) 64-Bit Server VM, version 1.7.0_45, running on Windows 7:amd64:6.1, installed at C:\Program Files\Java\jre7 2014-01-12 19:23:16 [iNFO] [ForgeModLoader] Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation 2014-01-12 19:23:16 [iNFO] [ForgeModLoader] Loading tweak class name cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker 2014-01-12 19:23:16 [iNFO] [ForgeModLoader] Loading tweak class name cpw.mods.fml.common.launcher.FMLDeobfTweaker 2014-01-12 19:23:16 [iNFO] [ForgeModLoader] Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker 2014-01-12 19:23:16 [iNFO] [ForgeModLoader] Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker 2014-01-12 19:23:16 [iNFO] [ForgeModLoader] Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper 2014-01-12 19:23:17 [iNFO] [sTDOUT] Loaded 40 rules from AccessTransformer config file fml_at.cfg 2014-01-12 19:23:17 [sEVERE] [ForgeModLoader] The binary patch set is missing. Either you are in a development environment, or things are not going to work! 2014-01-12 19:23:18 [iNFO] [ForgeModLoader] Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper 2014-01-12 19:23:18 [iNFO] [sTDOUT] Loaded 110 rules from AccessTransformer config file forge_at.cfg 2014-01-12 19:23:18 [iNFO] [ForgeModLoader] Calling tweak class cpw.mods.fml.common.launcher.FMLDeobfTweaker 2014-01-12 19:23:18 [iNFO] [sTDERR] Exception in thread "main" java.lang.NoClassDefFoundError: cpw/mods/fml/common/LoaderException 2014-01-12 19:23:18 [iNFO] [sTDERR] at java.lang.Class.forName0(Native Method) 2014-01-12 19:23:18 [iNFO] [sTDERR] at java.lang.Class.forName(Unknown Source) 2014-01-12 19:23:18 [iNFO] [sTDERR] at cpw.mods.fml.common.launcher.FMLDeobfTweaker.injectIntoClassLoader(FMLDeobfTweaker.java:31) 2014-01-12 19:23:18 [iNFO] [sTDERR] at net.minecraft.launchwrapper.Launch.launch(Launch.java:111) 2014-01-12 19:23:18 [iNFO] [sTDERR] at net.minecraft.launchwrapper.Launch.main(Launch.java:27) 2014-01-12 19:23:18 [iNFO] [sTDERR] Caused by: java.lang.ClassNotFoundException: cpw.mods.fml.common.LoaderException 2014-01-12 19:23:18 [iNFO] [sTDERR] at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:186) 2014-01-12 19:23:18 [iNFO] [sTDERR] at java.lang.ClassLoader.loadClass(Unknown Source) 2014-01-12 19:23:18 [iNFO] [sTDERR] at java.lang.ClassLoader.loadClass(Unknown Source) 2014-01-12 19:23:18 [iNFO] [sTDERR] ... 5 more 2014-01-12 19:23:18 [iNFO] [sTDERR] Caused by: java.lang.NullPointerException 2014-01-12 19:23:18 [iNFO] [sTDERR] at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:178) 2014-01-12 19:23:18 [iNFO] [sTDERR] ... 7 more Am I doing something wrong? Is there anything that would make this GIT process more effective?
×
×
  • Create New...

Important Information

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