Jump to content

Bloopers

Forge Modder
  • Posts

    77
  • Joined

  • Last visited

Everything posted by Bloopers

  1. I removed the part that makes it extend MouseEvent, and then tried launching again and it's the same result. Is there a reason that I should start over?
  2. Welp, there's your problem. You're not supposed to extend the event classes. You're supposed to create a single function that takes a single parameter (of any Event subtype) and mark it with an @EventHandler annotation. Can you please link the tutorial you were using? http://jabelarminecraft.blogspot.com/p/minecraft-modding-extending-reach-of.html
  3. Hello. I've created a custom event with a tutorial from jabelar, that extends MouseEvent, and I've managed to get rid of all error(as the tutorial was for 1.8, there were plenty of errors) - but when I load the game it just doesn't do anything. I think it has to do with the actual registering of the event. In my CommonProxy's init method, I put in MouseEventHandler handler = new MouseEventHandler(); MinecraftForge.EVENT_BUS.register(handler); Is there a different way to register events in 1.10? I'm a complete noob when it comes to events, only done very basic things with them.
  4. It helps if the new stuff is in the same class. Like if you're following a tutorial that used the BlockModelRenderer.renderModelStandard() method and saw it wasn't available any more then you could look at the methods listed in the same class (BlockModelREnderer) and you'll notice that there is a method called BlockModelRenderer.renderModelFlat() and if you look at that method you can guess that it is used in the same way. However, Type Hierarchy won't help you for the two issues you have because a) geMouseOverExtended() is a method from my tutorial so has nothing to do with version, and b) MovingObjectPosition is a class not a method or field. Assuming you copied all my code, you actually have the getMouseOverExtended() method already. However, Eclipse might be complaining about it because it returns a MovingObjectPosition value which it doesn't recognize so then it also won't recognize the method. So actually you only need to fix the MovingObjectPosition and that should also fix the getMouseOverExtended() as well. Now when a whole class gets changed, it means there was a more extensive change that probably needs more thought and can be tricky to figure out. The best way to figure it out is to compare the source code from the older version and the newer version. For example, load a project in 1.8 into Eclipse and check where MovingObjectPosition is used in the Minecraft source. Then also look at your the 1.10 source and look in the same place and see what is now there. It is usually pretty obvious. Anyway, that is what I just did. And I found that MovingObjectPosition has been renamed RayTraceResult. I haven't looked further to see if the class itself has changed, and I'll do that when I get time, but this should give you a good clue on how to fix it. Thank you so much! I have one more question, which I don't think only has to do with the extended reach, but it might be useful to use in other things later on. The ModClass.network thing. In this area if (mov.entityHit != thePlayer ) { SpearMod.network.sendToServer(new MessageExtendedReachAttack( mov.entityHit.getEntityId())); } "network" is underlined. It cannot be resolved or is not a field. But, I already have public static SimpleNetworkWrapper network; in my main mod class. Quick fix tells me to create a field or a constant in my main mod class, but it's already there? If I tell it to do either of those, it'll create public static final String network = null; or public static Object network; But it should already be identified as public static SimpleNetworkWrapper network; as it is in your tutorial?
  5. Where is the object hierarchy window? In eclipse it is called the outline Thank you. How am I supposed to use the Outline/Object Hierarchy and Type Hierarchy to find a new name for things? There are two things that eclipse is telling me don't exist anymore. "MovingObjectPosition" and "getMouseOverExtended"
  6. Where is the object hierarchy window?
  7. Sorry, my message got put inside the quote. I said: Where in the Type Hierarchy would I see stuff with a similar name? This is what I see:
  8. Hello. I would like to create an item with an extended reach(spear) and I'm having some trouble with it. I found a tutorial by Jabelar for 1.8, but there are some things that don't exist anymore that are used in that tutorial.
  9. Okay. I deleted ItemPrimitiveSpearTool and put all of the stuff like EFFECTIVE_ON, and the damage and speed into one class and the item works fine now. Thank you both!
  10. Oh! I meant to have ItemPrimitiveSpear extend ItemPrimitiveSpearTool. Do I not even need the ItemPrimitiveSpearTool class? I expect ToolMaterial to be able to set the durability, enchantability etc using the "primitive" tool material that I have, in the SpearItems class.
  11. Hello. I just added a tool to my mod, and I set the attack damage and attack speed, but when I launch the game and grab the item, it has no attributes, as if it were just a basic item. Here are the classes I used: package bloopers.spearmod.items; import java.util.Set; import com.google.common.collect.Sets; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.SoundEvents; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemTool; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class ItemPrimitiveSpearTool extends ItemTool { private static final Set<Block> EFFECTIVE_ON = Sets.newHashSet(new Block[] {Blocks.SPONGE}); public ItemPrimitiveSpearTool(Item.ToolMaterial material) { super(1.5F, -3.0F, material, EFFECTIVE_ON); } } package bloopers.spearmod.items; import net.minecraft.item.Item; public class ItemPrimitiveSpear extends Item { public ItemPrimitiveSpear(ToolMaterial material) { this.setMaxStackSize(1); } } And then my item init class: package bloopers.spearmod.init; import bloopers.spearmod.items.ItemPrimitiveSpear; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.fml.common.registry.GameRegistry; public class SpearItems { /**********|DECLARE|**********/ public static ItemPrimitiveSpear primitive_spear; public static final Item.ToolMaterial primitive = EnumHelper.addToolMaterial("primitive", 1, 300, 6.0F, 1.0F, 1); public static void init() { /*********************************|INIT ITEMS|***************************************/ //primitive_spear = new ItemPrimitiveSpear(primitive); primitive_spear = (ItemPrimitiveSpear)(new ItemPrimitiveSpear(primitive).setUnlocalizedName("primitive_spear")); } /***********************************************************************************/ public static void register() { /*********************************|REGISTER ITEMS|***************************************/ primitive_spear.setRegistryName("primitive_spear"); GameRegistry.register(primitive_spear); } /***********************************************************************************/ public static void registerRenders() { /*********************************|RENDER ITEMS|***************************************/ registerRender(primitive_spear); } /***********************************************************************************/ private static void registerRender(Item item) { Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation("spear" + ":" + item.getUnlocalizedName() .substring(5), "inventory")); } }
  12. Alright, fixed that. Now when I right click on forgeSrc, then go to Build Path and click Configure Build Path, in the Order and Export tab I click Select All, Apply and then try to search something, it seems to do nothing.
  13. I don't know what I just did but apparently the forge source is completely gone now. All of my class files are full of errors. How do I add the source back into the referenced libraries? Might also be a good idea to point out I'm using Eclipse.
  14. After updating to forge 1.10.2, using CTRL + R to search for class files like ItemBed in the Referenced Libraries > forgeSrc API/Library thing so I can study the code from vanilla minecraft/forge, it doesn't work(it used to) Sorry if this is kind of hard to understand, it's hard to explain. http://prntscr.com/c0h973 ^ Normally this would direct me to the ItemBed class, if that helps.
  15. Actually, now that I look at it, the mod doesn't seem to load at all. It just says 3 mods loaded when I click run. (Mincraft Coder Pack, Forge Mod Loader and Minecraft Forge) ...and I found out what was happening, too! In my "acceptedMinecraftVersions" in the main mod file, I set it to: "[1.10],[1.10.1],1.10.2]" For some reason, it doesn't like whatever I put in and acted as if the mod didn't exist at all. So instead, I replaced it with: "[1.10.2]" only. Now that I launch, the recipe is removed! Do I really need to allow for 1.10, 1.10.1 and 1.10.2 to use this mod, or will it allow it anyway?
  16. I picked up a mod that I had been working on a couple months ago in 1.8 and updated it to 1.10.2. This mod just removed the bed recipe(and added my own, to make it harder to craft) - it worked perfectly in 1.8, but after I update to 1.10.2, it just does the normal bed recipe. This is how I removed the recipes(from a tutorial video) package bloopers.harderbeds; import java.util.Iterator; import java.util.List; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.IRecipe; public class RecipeRemover { public static void removeRecipe(Item item) { List<IRecipe> recipies = CraftingManager.getInstance().getRecipeList(); Iterator<IRecipe> remover = recipies.iterator(); while (remover.hasNext()) { ItemStack itemstack = remover.next().getRecipeOutput(); if(itemstack != null && itemstack.getItem() == item) { remover.remove(); } } } public static void removeRecipe(Block block) { List<IRecipe> recipies = CraftingManager.getInstance().getRecipeList(); Iterator<IRecipe> remover = recipies.iterator(); while (remover.hasNext()) { ItemStack itemstack = remover.next().getRecipeOutput(); if(itemstack != null && itemstack.getItem() == Item.getItemFromBlock(block)) { remover.remove(); } } } } Then, in my PostInit, I put this: RecipeRemover.removeRecipe(Items.BED); Is there a new way to remove recipes, or is there something outdated in this code? Any help is appreciated!
  17. How would I go about using a callback method for this?
  18. I'm trying to create a method that, when holding an item(climbing_hook), the player may be able to "hook" onto walls while crouching and having the hook in hand. This is my event class: package bloopers.climbing.eventhandeler; import com.sun.media.jfxmedia.events.PlayerEvent; import bloopers.climbing.init.ClimbingItems; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.world.World; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class EventOnHeld { @SubscribeEvent public void HeldItem(PlayerInteractEvent event, EntityPlayer player, World world) { if (player.getHeldItemMainhand() != null) { Item item = player.getHeldItemMainhand().getItem(); if (item == ClimbingItems.climbing_hook) { if (player.isSneaking()) { if (player.isCollidedVertically) { player.setVelocity(0.0F, 0.0F, 0.0F); } } } } } } And this is how I am registering it: MinecraftForge.EVENT_BUS.register(new EventOnHeld()); Whenever I launch the game, it loads up and crashes before it reaches the home screen. If I comment out the register thing, minecraft launches fine, but the event can't be registered.
  19. (probably looking super stupid) I still don't really understand.. What is the up method, and how am I supposed to use it?
  20. How can I check? (i'm a big noob when it comes to blocks, i normally make items lol)
  21. I can't figure out what to put in this method, could I get a bit more detail?
  22. I'd like to make it so that the block I have created will only work if there is a block above it(it's meant to hang from the ceiling) I've looked into classes like carpet and plants since the only work if a block is UNDER them but I can't figure out how to make it so that it will be destroyed/can't be placed unless there is a block above. This is the class I have right now: package bloopers.climbing.blocks; import net.minecraft.block.Block; import net.minecraft.block.material.MapColor; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; public class BlockRope extends Block { public static final AxisAlignedBB PILLAR_AABB = new AxisAlignedBB(0.375D, 0.0D, 0.375D, 0.625D, 1.5D, 0.625D); public BlockRope(Material blockMaterialIn, MapColor blockMapColorIn) { super(Material.CLOTH, blockMapColorIn.BROWN); } public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { return PILLAR_AABB; } /** * Used to determine ambient occlusion and culling when rebuilding chunks for render */ public boolean isOpaqueCube(IBlockState state) { return false; } public boolean isFullCube(IBlockState state) { return false; } @Override public boolean isLadder(IBlockState state, IBlockAccess world, BlockPos pos, EntityLivingBase entity) { return true; } }
×
×
  • Create New...

Important Information

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