Jump to content

DragonFerocity

Members
  • Posts

    114
  • Joined

  • Last visited

Everything posted by DragonFerocity

  1. Hello, I'm recently getting back to updating my mod (from 1.12.2), but I'm running into an issue. I went through the Getting Started section on the MCForge Docs page (https://mcforge.readthedocs.io/en/1.15.x/gettingstarted/#from-zero-to-modding), running the "gradlew genEclipseRuns". (When I run "gradlew build" obviously there are a bunch of errors that I need to fix) My issue is that in Eclipse, when I run my mod, it is still using Minecraft 1.12.2 so it doesn't encounter any errors. How can I make my Eclipse Project use Minecraft 1.16.2 and actually give me the errors that "gradlew build" does? (One of the errors is: src\main\java\com\DragonFerocity\expanded\blocks\ModBlock.java:8: error: cannot find symbol import net.minecraft.block.material.MapColor; But if I look at the "ModBlock.java" file in Eclipse and go to the definition of "MapColor", MapColor exists when obviously it's been changed) Thanks, EDIT: I think I have fixed it, not entirely sure how, but I double checked that everything in my build.gradle was correct and made a few adjustments.
  2. Hey guys, I'm attempting to implement custom villager trades for a mod I'm working on. I can't seem to get it to work, I followed the instructions here in this article, but I can't get a villager to spawn with the trade I'm wanting to add. Here's my code: SellTrades.java public class SellTrades implements EntityVillager.ITradeList { private ItemStack itemToSell; private EntityVillager.PriceInfo sellPrice; private boolean enchant; public SellTrades(Item sell, EntityVillager.PriceInfo price, boolean shouldBeEnchanted) { itemToSell = new ItemStack(sell, 1); sellPrice = price; enchant = shouldBeEnchanted; } public SellTrades(ItemStack sell, EntityVillager.PriceInfo price, boolean shouldBeEnchanted) { itemToSell = sell; sellPrice = price; enchant = shouldBeEnchanted; } @Override public void addMerchantRecipe(IMerchant merchant, MerchantRecipeList recipeList, Random random) { if (enchant) itemToSell = EnchantmentHelper.addRandomEnchantment(random, new ItemStack(this.itemToSell.getItem(), 1, this.itemToSell.getMetadata()), 5 + random.nextInt(15), false); ItemStack itemstack = new ItemStack(Items.EMERALD, sellPrice.getPrice(random)); recipeList.add(new MerchantRecipe(itemstack, itemToSell)); } } Which works well. This allows me to specify a new trade with an item the villager is selling, and a price range for the number of emeralds required to buy said item. So, according to the article linked above, I need to add a recipe to the villagers using my class. Here's how I did that: VillagerRegistry.VillagerCareer smith = ForgeRegistries.VILLAGER_PROFESSIONS.getValue(new ResourceLocation("minecraft:smith")).getCareer(3); smith.addTrade(1, new SellTrades(BlockHandler.iMithrilPickaxe, new EntityVillager.PriceInfo(8, 11), true)); These two lines of code are in my ServerProxy/CommonProxy class. Initially, I had them in my init() method, and then I moved it to my preInit() method. Is this the correct way to register the trade? The article linked above doesn't mention anything about having to register the trade so I'm thinking I don't need to. Thanks,
  3. Hey guys, I'm not posting any code because that's not what I'm having trouble with. Here's my issue: I have successfully created a new dimension and it works properly. I can teleport there using an item and teleport back (although it crashes when teleporting to and fro because of an unrelated issue that would be solved if I can solve this issue.). I would like to be able to create a structure that the player has to interact with (like the nether portal) but made out of something else other than obsidian, but you still have to light it to "activate" it. I'd then like that portal to teleport the player to my custom dimension and have it create a portal of the same type (not a nether portal) at the "same" location in my dimension so the player can leave. Basically, a Nether Portal to another dimension made out of different materials is what I'd like to achieve. As far as I can tell, I have two options: Don't create a teleporter, or create a CoreMod... The WorldServer class by default uses the vanilla teleporter class, thus when you call the Entity.changeDimension function, it get's the current WorldServer's teleporter type and creates a new teleporter of that type, which happens to be a Nether Portal. Thus when I call the Entity.changeDimension function, it creates a nether portal in the dimension I'm leaving and the custom dimension I'm going to. I want a custom teleporter to be created instead but I don't think that's possible. I've looked into the possibility of creating my own WorldServer class that has the teleporter I want, however that won't affect the Overworld or the Nether. Only my dimension (thus a nether portal would still be created in whatever dimension I'm coming from.) If I used CoreMod stuff instead, I could override the WorldServer class with the proper fields, but that would also require overriding the Entity.ChangeDimension function and a few other things as well. What would you suggest I do? Or is there an easier way to do what I want? Is there a way to change the players dimension without it creating a nether portal in both dimensions? Thanks,
  4. Okay, am I getting the second parameter (the IRenderFactory) correctly? I found this thread which said to use RenderingRegistry.registerEntityRenderingHandler(EntityNewEntity.class, RenderNewEntity::new); Now that I have that implemented, my entity has the same texture as the player for some reason
  5. On my end, they both show as deprecated. These are the two different ones that I see: RenderingRegistry.registerEntityRenderingHandler(entityClass, renderFactory); RenderingRegistry.registerEntityRenderingHandler(entityClass, renderer); And both show Deprecated. use the factory version during Preinitialization. TODO Will be removed in 1.11.
  6. Is there another way to register entities now? Whenever I type in this function, Eclipse says "Deprecated. use the factory version during Preinitialization. TODO Will be removed in 1.11." What should I do instead? EDIT: I already have EntityEntry entry = EntityEntryBuilder.create() .entity(MyEntity.class) .id(new ResourceLocation(...), ID++) .name("my_entity") .egg(0xFFFFFF, 0xAAAAAA) .tracker(64, 20, false) .build(); event.getRegistry().register(entry); implemented. I'm assuming I still need to register the render though?
  7. Here's the difference in the files between my last version and the version that's giving me errors.
  8. I went back to version 14.23.0.2491 and the problems still persist. However, it does build correct now when I run gradlew build
  9. I guess I downloaded the most recent. Should I go back to the last stable?
  10. Are there eclipse files in the src directory? I couldn't see any. One thing I did try was creating a new project from scratch using forge, then I edited the build.gradle file with the correct info and copied my src folder over to the new project. The same thing occured.
  11. Hey guys, I don't know what I did, but after upgrading my mod to 1.12.2 from 1.12, many things seem to have broken. Here's my steps: I updated my build.gradle file (you can see it below) I ran gradlew clean Ran gradlew setupDecompWorkspace Ran gradlew eclipse Now things are broken. Whenever I run my mod from eclipse, it keeps telling me that every single one of my items are being registered twice If I run gradlew build, it tells me that there a variable that I can clearly see doesn't exist: As far as I know I didn't change anything significant between upgrading from 1.12.2 from 1.12. I can post more code, or a link to my github if needed. Your help is appreciated.
  12. Unfortunately no. However, 2017 opens Java files and has syntax highlighting.
  13. I'm just going to go ahead and ignore your ignorance. The Eclipse IDE is one of the worse I've ever used. It will import classes only when I copy/paste code. When I type, it won't. Plus sorry for being a person that likes to import classes before I start using them.
  14. Strange. When typing my import statements, Eclipse wasn't able to find DimensionManager until I opened it using ctrl+shift+t.
  15. Are there any good custom dimension tutorials out there for 1.11.2 or 1.12? All the ones I can find are for much earlier versions and reference a class in Forge called DimensionManager which seems to not exist anymore. Thanks,
  16. Hey, I'm running a Minecraft server with my mod currently. I have some custom Gui's that I've made for a few items in my mod. The Gui's open when I'm in a single player game, but they do not open when I'm on the server. I'm not sure how to debug this, and I followed several tutorials for how to make custom Gui's. Here's my GuiHandler.java class: public class GuiHandler implements IGuiHandler { @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { TileEntity tileEntity = world.getTileEntity(new BlockPos(x, y, z)); if (tileEntity != null) { if (ID == BlockHandler.GUI_ENUM.ALLOY_FURNACE.ordinal()) { return new ModContainerAlloyFurnace(player.inventory, (ModTileEntityAlloyFurnace)tileEntity); } else if (ID == BlockHandler.GUI_ENUM.CRAFTING_TABLE.ordinal()) { return new ModCraftingTable.InterfaceCraftingTable(world, new BlockPos(x, y, z)); } else if (ID == BlockHandler.GUI_ENUM.CAMPFIRE.ordinal()) { return new ModContainerCampfire(player.inventory, (ModTileEntityCampfire)tileEntity); } } return null; } @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { TileEntity tileEntity = world.getTileEntity(new BlockPos(x, y, z)); if (tileEntity != null) { if (ID == BlockHandler.GUI_ENUM.ALLOY_FURNACE.ordinal()) { return new ModGuiAlloyFurnace(player.inventory, (ModTileEntityAlloyFurnace)tileEntity); } else if (ID == BlockHandler.GUI_ENUM.CRAFTING_TABLE.ordinal()) { return new GuiCrafting(player.inventory, world, new BlockPos(x, y, z)); } else if (ID == BlockHandler.GUI_ENUM.CAMPFIRE.ordinal()) { return new ModGuiCampfire(player.inventory, (ModTileEntityCampfire)tileEntity); } } return null; } } Am I missing something? I have this piece of code in my ServerProxy.java (which is the common proxy) public void preInit() { GameRegistry.registerWorldGenerator(new OreGen(), 0); NetworkRegistry.INSTANCE.registerGuiHandler(ExpandedAesthetics.instance, new GuiHandler()); } Do I also need to put this in the Client Proxy? (Here's my github repo)
  17. The function inside returns false, and !false = true, therefore it goes inside the if. I should have been more clear. I think the problem is that I set the material type to rock, and it seems to check if it's harvestable based on the material, not that function I overrode alone. EDIT: Setting it's material type to something that can be mined by hand; dirt, grass, wood...; fixed it.
  18. Hey, I'm trying to make one of my custom ores drop itself when mined by hand. I ran across this article and did what it suggested: ModOre::getHarvestTool @Override public String getHarvestTool(IBlockState state) { if (this == BlockHandler.copperOre) return null; else return this.harvestTool[getMetaFromState(state)]; } However, this doesn't work. When I debug, it gets to this point in the forge code: ForgeHooks::blockStrength public static float blockStrength(@Nonnull IBlockState state, @Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos) { float hardness = state.getBlockHardness(world, pos); if (hardness < 0.0F) { return 0.0F; } if (!canHarvestBlock(state.getBlock(), player, world, pos)) { return player.getDigSpeed(state, pos) / hardness / 100F; } else { return player.getDigSpeed(state, pos) / hardness / 30F; } } And it always goes into the second if, meaning that canHarvestBlock is returning false, even though I return null above. I'm not sure what I'm doing wrong, as setting the harvest level to 0 or -1 doesn't fix it and setting the harvest tool to null also doesn't fix it. Here's a link to my git repo if you want all the code
  19. Okay, so I should be setting the variant to type on all of them? I found that the following also works if I set their resource location path and then create a separate item model file for each. register(ibCampfire, 0, "expanded:oak_campfire"); register(ibLitCampfire, 0, "expanded:oak_campfire"); register(ibCampfire, 1, "expanded:spruce_campfire"); register(ibLitCampfire, 1, "expanded:spruce_campfire"); register(ibCampfire, 2, "expanded:birch_campfire"); register(ibLitCampfire, 2, "expanded:birch_campfire"); register(ibCampfire, 3, "expanded:jungle_campfire"); register(ibLitCampfire, 3, "expanded:jungle_campfire"); register(ibCampfire, 4, "expanded:acacia_campfire"); register(ibLitCampfire, 4, "expanded:acacia_campfire"); register(ibCampfire, 5, "expanded:dark_oak_campfire"); register(ibLitCampfire, 5, "expanded:dark_oak_campfire");
  20. That unfortunately didn't fix it. It didn't break anything though.
×
×
  • Create New...

Important Information

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