Jump to content

61352151511

Forge Modder
  • Posts

    403
  • Joined

  • Last visited

Everything posted by 61352151511

  1. I'm trying to add some rendering to the hotbar for when an items ability cools down. All of the rendering code is below. I've attached three files to show the problem, the first is the hotbar without anything additionally drawn. The second is with the pickaxe ability cooled down, and the third it is on cooldown. As you can see the texture is drawn kind of over the durability bar, I want to know what I can do to solve this. I've tried enabling alpha, that didn't seem to change anything. RenderGameOverlayEvent.Pre broke pretty much the rest of the rendering. Any tips are helpful, basically I need the "highlight" to be in-front of the hotbar, but behind the items being drawn. @SubscribeEvent(priority = EventPriority.NORMAL) public void onRender(RenderGameOverlayEvent.Post event) { if (event.isCanceled() || event.getType() != ElementType.EXPERIENCE) return; NonNullList<ItemStack> inventory = minecraft.player.inventory.mainInventory; for (int i = 0; i < 9; i ++) { ItemStack stack = inventory.get(i); if (stack.isEmpty()) continue; if (stack.getItem() instanceof ItemPickaxe) drawHighlight(i, CooldownReference.pickaxe.isCooledDown()); if (stack.getItem() instanceof ItemSword) drawHighlight(i, CooldownReference.sword.isCooledDown()); if (stack.getItem() instanceof ItemAxe) drawHighlight(i, CooldownReference.axe.isCooledDown()); if (stack.getItem() instanceof ItemSpade) drawHighlight(i, CooldownReference.shovel.isCooledDown()); if (stack.getItem() instanceof ItemHoe) drawHighlight(i, CooldownReference.hoe.isCooledDown()); } } private void drawHighlight(int slot, boolean useable) { ScaledResolution scaledResolution = new ScaledResolution(minecraft); GlStateManager.pushMatrix(); GlStateManager.enableBlend(); GlStateManager.depthMask(false); minecraft.renderEngine.bindTexture(useable ? highlightResourceGreen : highlightResourceRed); drawModalRectWithCustomSizedTexture(((scaledResolution.getScaledWidth() / 2) - 91) + (slot * 20) + 2, scaledResolution.getScaledHeight() - 20, 0, 0, 18, 18, 16, 16); GlStateManager.depthMask(true); GlStateManager.disableBlend(); GlStateManager.popMatrix(); }
  2. I tried searching but got empty results and I'm at a loss. I'm trying to access the text of the titles being displayed to the client. There doesn't seem to be an event for it anywhere, the fields in GuiIngame are protected, and I don't believe I can hook into the PacketReceived event either to see when the client is told to display a title. Any tips would be appreciated, thanks.
  3. 1) Not the section for it 2) Make sure the mods are actually for 1.11 and gotten from a reliable source such as minecraftforums or curseforge
  4. Thank you, I knew ItemStack's couldn't be null anymore, and I searched all of my classes for "null" when I did the update. I missed the fact that just doing "ItemStack result;" would be null and also needed the change. I'll change the code to get rid of that and set the unlocalized name that way.
  5. So from what I'm reading you're basically saying to remove the ObjectHolder annotation? Done, and it still has the same crash. I don't know to be honest. I think I started watching Pahimar's "Let's Mod [Reboot?]" series back for 1.7.10 and it worked, so I never questioned it. I think the reason was to do with getting the mods name in the unlocalized name but I have no idea. If it's something I shouldn't be doing (Is the mod name in the unlocalized name automatically now?) then I'll remove it.
  6. Gonna wait for "someone more advanced" because I still have no information of how to fix it. The items get registered before the recipes attempt to get registered, I don't know why it's printed in the log like that. The exact same thing was printed in the log from 1.7.10 -> 1.10.2 that I'm aware of and the game never crashed that I remember.
  7. Yes all of them, however this is not the issue (Well I really don't think it is) because the objects exist in game when the recipe init is commented out, so they do get registered.
  8. escapemc_ingot = new Item().setUnlocalizedName("escapemc_ingot").setRegistryName("escapemc_ingot").setCreativeTab(TeamMadnessMod.TeamMadnessModMaterialsTab); GameRegistry.register(escapemc_ingot);
  9. So, I'm not sure what is happening here. When I create a new world, the game crashes with this error: http://pastebin.com/UucBkVUG However if I comment out the recipe initialization, everything works fine. All of the code is available on github but the recipe class is here: https://github.com/61352151511/Random-Utilities/blob/1.11/src/main/java/com/sixonethree/randomutilities/common/init/Recipes.java
  10. ItemStack argument was removed. All you need to do is getHeldItem(hand)
  11. Ah, I wasn't aware as I didn't have the time to check, I just kind of guessed that this was the problem based on the error. However doing the instanceof check also makes sure it isn't null, so that should fix it either way.
  12. Before doing anything else, check to make sure the harvester is a player. public void addBlockDrop1(HarvestDropsEvent event) { if (!(event.harvester instanceof EntityPlayer)) return; // Your Code }
  13. It would help to have some code to look at. I can however answer the thing about blockstates, even though they're items, if a model file fails to be found, it searches for a blockstate model it could possibly use. Simply making an item model for "breads" will clear up the block state error.
  14. Yes, but my question is still unanswered. What am I doing wrong? I have a state mapped that combines the colour "red" and "_leaves" so I don't understand what's wrong. Why it continues to look for a rainbowLeaves json instead of red_leaves. The json is loaded because the item models work. It just fails to use it for the block.
  15. I'm still confused, because vanilla does "this.registerBlockWithStateMapper(Blocks.LEAVES, (new StateMap.Builder()).withName(BlockOldLeaf.VARIANT).withSuffix("_leaves").ignore(new IProperty[] {BlockLeaves.CHECK_DECAY, BlockLeaves.DECAYABLE}).build());" in registerAllBlocks of BlockModelShapes, and this allows them to have "oak_leaves" and "spruce_leaves" json files. Could you give an example of what you mean.
  16. this.setCreativeTab(new CreativeTabs("Soul Craft"){ @SideOnly(Side.CLIENT) public Item getTabIconItem() { return ModItems.NoteBook; } }); Don't do that. Make the creative tab somewhere else like a ModTabs class and then reference it. The same way you reference ModItems.NoteBook
  17. So honestly, I don't know what is going on here, because in the actual mod being developed, some of the leaves work, and some of them do not. I've trimmed it down to just one leaf block with 4 subtypes, as well as the sapling for it, and put it into a mod called "Test Mod" with the source-code available at https://github.com/61352151511/Test-Mod The client proxy is where all the registering happens. The first thing that happens in preInit is the block is registered by the GameRegistry (Handled by super.preInit()), then it calls this.registerModels() In here the state maps are created, the first argument is used as the .withName, and the following arguments are put into .ignore, and the appropriate suffix of "_leaves" or "_sapling" is added. So in the end it is "red_leaves" and "orange_leaves", etc. up to green. Then the variants are registered, followed by setting the custom state mappers, and then finally registering the model. Here's what is confusing me. In the log as the game is loading, it talks about missing models for all the possible states of rainbowLeafBlock (http://pastebin.com/kBEFh6aR) Shouldn't the part where the state mapper says the properties check_decay, and decayable are ignored, make it not be concerned about those properties, as well as having it look for the appropriate "color_leaves" block state json rather than the rainbowLeaves one? When viewed in the inventory, the leaves look fine, however upon placing they do not work (purple/black texture). I simply want it so that the game loads without spamming model errors, and that when placed, it acts like normal leaves. I've tried referring to vanilla code on how the leaves are done and from what I can tell, I haven't missed anything, but something is obviously wrong, so some help would be appreciated. Thanks.
  18. What I'm doing during the FMLInitializationEvent: GameRegistry.addSmelting(BlockInit.tenebraeOre, new ItemStack(ItemInit.tenebraeChunk), 0.5F); What happens when I join a world: java.lang.NullPointerException at net.minecraft.item.ItemStack.getMetadata(ItemStack.java:281) ~[forgeSrc-1.9-12.16.0.1832-1.9.jar:?] at net.minecraft.item.crafting.FurnaceRecipes.compareItemStacks(FurnaceRecipes.java:114) ~[forgeSrc-1.9-12.16.0.1832-1.9.jar:?] at net.minecraft.item.crafting.FurnaceRecipes.getSmeltingResult(FurnaceRecipes.java:100) ~[forgeSrc-1.9-12.16.0.1832-1.9.jar:?] at net.minecraft.item.crafting.FurnaceRecipes.addSmeltingRecipe(FurnaceRecipes.java:88) ~[forgeSrc-1.9-12.16.0.1832-1.9.jar:?] at net.minecraft.item.crafting.FurnaceRecipes.addSmelting(FurnaceRecipes.java:80) ~[forgeSrc-1.9-12.16.0.1832-1.9.jar:?] at net.minecraft.item.crafting.FurnaceRecipes.addSmeltingRecipeForBlock(FurnaceRecipes.java:72) ~[forgeSrc-1.9-12.16.0.1832-1.9.jar:?] at net.minecraftforge.fml.common.registry.GameRegistry.addSmelting(GameRegistry.java:225) ~[forgeSrc-1.9-12.16.0.1832-1.9.jar:?] Any reason for this? I think it has something to do with TenebraeOre not having an Item version but it shouldn't need one, and I can't see any vanilla ore having an item version.
  19. So I created a custom context for my mod and it extends Context. This has fields for NoiseGenOctaves, and methods to get them, and a constructor. Just like a regular Context would. Then in the custom dimensions ChunkGenerator this code is ran ContextZylroth ctx = new ContextZylroth(noiseGen1, noiseGen2, noiseGen3, noiseGen4, noiseGen5, noiseGen6, mobSpawnerNoise); ctx = TerrainGen.getModdedNoiseGenerators(world, this.rand, ctx); Which causes a ClassCastException for net.minecraftforge.event.terraingen.InitNoiseGensEvent$Context cannot be cast to com.zalthrion.zylroth.world.dimension.ContextZylroth I'm not quite sure why this happens, to me this code looks right. If someone knows a proper way of creating custom Contexts (If possible) that would be helpful, thanks.
  20. I did, I gave you a direct link to the file and said "Look at PropsBuilder and BiomeProps" That's all the code you need. You then register your biome like new YourBiome((new PropsBuilder("Biome Name")).withRainfall().<allMethodsYouWantToUse>().build());
  21. I looked at Biomes O Plenty to see how they did it when I did a port. Look at PropsBuilder and BiomeProps in https://github.com/Glitchfiend/BiomesOPlenty/blob/BOP-1.9-4.0.x/src/main/java/biomesoplenty/api/biome/BOPBiome.java
  22. As it's likely been a while, try getting to the site again (It could have just been a temporary thing) If this is still happening, have you tried using a different browser? I'm using chrome and am currently able to access files.minecraftforge.net just fine, I don't however know about adfoc because I just use the direct download but I can download files from it.
  23. So here's what I did to get "special rendering" with a json model, I'm sure there's an easier way but this works. http://pastebin.com/GL53Zvhw Just make sure you register the class instance of the event bus.
×
×
  • Create New...

Important Information

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