Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

61352151511

Forge Modder
  • Joined

  • Last visited

Everything posted by 61352151511

  1. Put a != null check on the getTagCompound as well. I've learned the hard way if you try to get a value from a null tag compound you're gonna have a bad time.
  2. BioWarfareBlocks.registerRenders(); is being called twice is another thing.
  3. Not really enough code to determine that. Where is it being run from, you should have a client proxy with a method kind of like the following: @Override public void registerRenderThings() { ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher(); String id = Reference.MOD_ID.toLowerCase(); mesher.register(GameRegistry.findItem(id, "connected_polished_granite"), 0, new ModelResourceLocation(id + ":connected_polished_granite", "inventory")); mesher.register(GameRegistry.findItem(id, "connected_polished_andesite"), 0, new ModelResourceLocation(id + ":connected_polished_andesite", "inventory")); mesher.register(GameRegistry.findItem(id, "connected_polished_diorite"), 0, new ModelResourceLocation(id + ":connected_polished_diorite", "inventory")); } proxy.registerRenderThings(); Should be called in the init portion of the mod after blocks are registered.
  4. Yes, however your block won't rotate how you would like it to after that, if you just want a normal block that faces one direction only that should work fine.
  5. You're trying to set multiple models for one state. Although I do not think this is the main issue this will cause a problem. The torch json is as follows. { "variants": { "facing=up": { "model": "normal_torch" }, "facing=east": { "model": "normal_torch_wall" }, "facing=south": { "model": "normal_torch_wall", "y": 90 }, "facing=west": { "model": "normal_torch_wall", "y": 180 }, "facing=north": { "model": "normal_torch_wall", "y": 270 } } } You need to put logic in any methods referring to getting the block state to determine what the "facing" value will be and set the variants accordingly. Take a look at BlockTorch
  6. Do you have a blockstates file? You have to have a .json in assets/modid/blockstates with the same name as you register it in GameRegistry.registerBlock Refer to vanilla blockstates files for more.
  7. I helped you on your last thread by giving you a snippet of code. If you can not figure it out let me expand on that. As I am unaware which version you are doing this for or the MCP mappings being used the method you need to override may be different. @Override public void processCommand(ICommandSender sender, String[] args) { if (sender instanceof EntityPlayer) { player.addChatComponentMessage(new ChatComponentText(String.valueOf(((EntityPlayerMP) sender).ping))) } }
  8. If you did infact do everything correct this picture might help you.
  9. private final DefaultResourcePack mcDefaultResourcePack; It's not a static field but it's final, and I get illegal access exception's without it. The only things I've changed are Field field = Minecraft.class.getDeclaredField("defaultResourcePacks"); List rPacks = (List) field.get(Minecraft.getMinecraft()); Now if I don't set the field how am I supposed to add to the default resource packs? Does calling rPacks.add do it?
  10. Thanks, I think I got most of it done however one issue I'm having is getting the field. @SuppressWarnings({"rawtypes", "unchecked"}) public synchronized static void assembleResources() { if (FMLCommonHandler.instance().getEffectiveSide().isClient()) { try { Field field = Minecraft.getMinecraft().getClass().getDeclaredField("defaultResourcePacks"); field.setAccessible(true); Field modField = Field.class.getDeclaredField("modifiers"); modField.setAccessible(true); modField.setInt(field, field.getModifiers() & ~Modifier.FINAL); List rPacks = (List) field.get(Lists.newArrayList()); rPacks.add(new EasyModResourcePack()); field.set(field, rPacks); } catch (Exception e) { LogHelper.warn("An exception was thrown creating resource pack"); LogHelper.warn(e.getMessage() != null ? e.getMessage() : ""); e.printStackTrace(); } } } The line "List rPacks = (List) field.get(Lists.newArrayList());" Throws an error, Can not set java.util.List field net.minecraft.client.Minecraft.defaultResourcePacks to java.util.ArrayList If someone knows how to fix this issue, that would really help. I'm no reflection expert, I wouldn't even consider myself at the level of beginner yet, so I'm probably doing something wrong.
  11. Not sure if this is possible but what I'd like is to generate Strings in a json format within code, and then register that as the model, so instead of having an actual file, it's just done on launch. These will be cached if the user wishes to save them, it basically saves the effort of having to create model files for every block/item. If this is possible could I get some insight on how to do so?
  12. Lucky for you I already have a ping command and it's really simple. @Override public void processCommandPlayer(EntityPlayer player, String[] args) { outputMessage(player, String.valueOf(((EntityPlayerMP) player).ping), false, false); } Don't use outputMessage, it's a method I made. use player.addChatMessage
  13. I'm doing this mod as a collab with someone else, who has a modpack with about 40 mods, most of which aren't updated. He want's to keep it on 1.7.10 for the purpose of having it in his modpack, I don't mind. We do have a 1.8 version of the mod. If the bug is fixable then it would be nice to fix in the 1.7.10 version, if not then it'll have to just be a bug permanently in 1.7.10 I guess
  14. I've made an item which you can drink. However in 1.7.10 (This was fixed in 1. If you eat/drink an item and stop holding right click on the last tick (It seems to be the last tick), then don't change the item you're holding, it continues to consume the item. So for example attempting to eat an enchanted golden apple, you can eat one of them, stop eating at a very specific time, two of the apples will be consumed. This happens with the item I made that you drink and I'd like to find a way around that so it only consumes one. [spoiler=Code] public ItemStack onItemUseFinish(ItemStack stack, World world, EntityPlayer player) { player.addPotionEffect(PotionHelper.createCure(0)); for (CustomCureEffect customEffect : ZombieInfectionAPI.getCustomCureEffects()) { customEffect.run(player, stack); } stack.stackSize = player.capabilities.isCreativeMode ? stack.stackSize : stack.stackSize - 1; if (stack.stackSize == 0) { stack = new ItemStack(Items.glass_bottle); } else { boolean increased = false; for (int i = 0; i < player.inventory.getSizeInventory(); i ++) { if (player.inventory.getStackInSlot(i) != null) { if (player.inventory.getStackInSlot(i).getUnlocalizedName().equalsIgnoreCase("item.glassBottle")) { if (player.inventory.getStackInSlot(i).stackSize < 64) { player.inventory.getStackInSlot(i).stackSize ++; increased = true; break; } } } } if (!increased) { int emptySlotPos = player.inventory.getFirstEmptyStack(); if (emptySlotPos > -1) { player.inventory.setInventorySlotContents(emptySlotPos, new ItemStack(Items.glass_bottle)); } else { player.dropPlayerItemWithRandomChoice(new ItemStack(Items.glass_bottle), false); } } } player.setItemInUse(null, 0); return stack; } public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { player.setItemInUse(stack, getMaxItemUseDuration(stack)); return stack; } public int getMaxItemUseDuration(ItemStack stack) { return 32; } public EnumAction getItemUseAction(ItemStack stack) { return EnumAction.drink; } As you can see I tried sticking "player.setItemInUse(null, 0);" in the onItemUseFinish method, however that didn't seem to solve it. If anyone knows how to fix it, it would really help. Thanks
  15. The bottle issue was fixed. It was 1.7.10 only which didn't have block models. I specifically said in the post "It's fine on 1.8 because of models" The border doesn't help me because I need it on 1.7.10 as well.
  16. Thanks, it goes behind the hotbar now with this. @SubscribeEvent(priority = EventPriority.NORMAL) public void onRender(RenderGameOverlayEvent.Pre event) { if (event.isCanceled() || event.type != ElementType.HOTBAR || TimeInfectedTrackingClient.getSecondsInfected() < 1) return; ScaledResolution sr = new ScaledResolution(minecraftInstance, minecraftInstance.displayWidth, minecraftInstance.displayHeight); GL11.glEnable(GL11.GL_BLEND); GL11.glDepthMask(false); minecraftInstance.renderEngine.bindTexture(new ResourceLocation(Reference.MOD_ID.toLowerCase(), "textures/gui/eyeinfection.png")); drawModalRectWithCustomSizedTexture(0, 0, 0, 0, sr.getScaledWidth(), sr.getScaledHeight(), sr.getScaledWidth(), sr.getScaledHeight()); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthMask(true); } However any hasEffect item renders weirdly.
  17. @SubscribeEvent(priority = EventPriority.NORMAL) public void onRender(RenderGameOverlayEvent.Pre event) { if (event.isCanceled() || event.type != ElementType.HOTBAR || TimeInfectedTrackingClient.getSecondsInfected() < 60) return; ScaledResolution sr = new ScaledResolution(minecraftInstance, minecraftInstance.displayWidth, minecraftInstance.displayHeight); GL11.glEnable(GL11.GL_BLEND); minecraftInstance.renderEngine.bindTexture(new ResourceLocation(Reference.MOD_ID.toLowerCase(), "textures/gui/eyeinfection.png")); drawModalRectWithCustomSizedTexture(0, 0, 0, 0, sr.getScaledWidth(), sr.getScaledHeight(), sr.getScaledWidth(), sr.getScaledHeight()); GL11.glDisable(GL11.GL_BLEND); } The game now looks like this. The isFull3D thing fixed the other issue, thanks.
  18. look this: The JRE System library is Java 8 Update 31, I can launch forge with my mods perfectly fine. Unless somehow, somewhere I do have java 7 on my system (Which I shouldn't because I delete the folders whenever I install an update) Then it does work with java 8. Edit: Which eclipse are you using? I use eclipse luna which may be why, but no idea.
  19. 100% sure it is. I have no trace of java 7 on my computer, only java 8. I use eclipse daily.
  20. What version of java are you on? Try getting java 8
  21. Simply put, I would like to know how to draw the image before/underneath the hotbar. As you can see in the image below the image is drawn after the hotbar. Items are drawn after the image but not shown in the picture. Normally whenever I do stuff with GUI I render it alongside the experience and in the post event. I tried changing to the pre event and the entire blank area of the circle was white and the rest pure red (No opacity at all) I tried keeping it on the post event but changing to ElementType.HOTBAR and got the same result. Any tips would really help. Edit: As well as in 1.7.10 ( Not sure if it happens in 1.8 ) If the last item in the hotbar to be rendered hasEffect() == true, the white appears in the middle again however it does have opacity. @SubscribeEvent(priority = EventPriority.NORMAL) public void onRender(RenderGameOverlayEvent.Post event) { if (event.isCanceled() || event.type != ElementType.EXPERIENCE || TimeInfectedTrackingClient.getSecondsInfected() < 60) return; ScaledResolution sr = new ScaledResolution(minecraftInstance, minecraftInstance.displayWidth, minecraftInstance.displayHeight); minecraftInstance.renderEngine.bindTexture(new ResourceLocation(Reference.MOD_ID.toLowerCase(), "textures/gui/eyeinfection.png")); drawModalRectWithCustomSizedTexture(0, 0, 0, 0, sr.getScaledWidth(), sr.getScaledHeight(), sr.getScaledWidth(), sr.getScaledHeight()); } [spoiler=Rendering] As well as if anyone knows how to get items to render like a glass bottle in hand like [spoiler=This] Instead of like [spoiler=This] In 1.7.10 that would be apprecated. 1.8 works fine because of the models and being able to change the rotation, size, etc. Within the json file.
  22. There's blank lines in vanilla lang files, so it crashes no matter what
  23. Ok I understood half of that, I decided to do: @SubscribeEvent public void onPlayerUpdate(TickEvent.PlayerTickEvent event) { if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) { IBakedModel model = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getItemModel(event.player.getCurrentEquippedItem()); LogHelper.warn(model == null ? "null" : model.toString()); } } Yes I know it has the getEffectiveSide thing you said is bad, however this was just for debugging purposes. The log prints net.minecraftforge.client.model.IFlexibleBakedModel$Wrapper@7e80a98c So the model is not null, no idea what the problem is EDIT: Changing it to LogHelper.warn(model == null ? "null" : model.getTexture().getIconName()); The log says "missingno" So somewhere it gets messed up between the model and the texture, unless getTexture never has a value set (It is deprecated) EDIT 2: Fixed, it was a really dumb mistake. ModelResourceLocation(id + ":connected_polished_granite", "inventory") instead of ModelResourceLocation(id + ":cpg", "inventory")
  24. That made no different at all [spoiler=ClientProxy] @Override public void registerRenderThings() { ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher(); String id = Reference.MOD_ID.toLowerCase(); mesher.register(GameRegistry.findItem(id, "connected_polished_granite"), 0, new ModelResourceLocation(id + ":cpg", "inventory")); mesher.register(GameRegistry.findItem(id, "connected_polished_andesite"), 0, new ModelResourceLocation(id + ":cpa", "inventory")); mesher.register(GameRegistry.findItem(id, "connected_polished_diorite"), 0, new ModelResourceLocation(id + ":cpd", "inventory")); } Took the code out of the ModBlocks.init, moved the init of that to FMLPreInitialization, and did proxy.registerRenderThings in FMLInitialization.

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.