Jump to content

Roymond

Forge Modder
  • Posts

    30
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

Roymond's Achievements

Tree Puncher

Tree Puncher (2/8)

2

Reputation

  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);
×
×
  • Create New...

Important Information

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