Everything posted by 61352151511
-
[1.7.10] [SOLVED] Checking Player for Custom Armor w/ NBT Data
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.
-
[1.8]Blocks item model not working?
BioWarfareBlocks.registerRenders(); is being called twice is another thing.
-
[1.8]Blocks item model not working?
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.
-
[1.8]Blocks item model not working?
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.
-
[1.8]Blocks item model not working?
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
-
[1.8]Blocks item model not working?
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.
-
How to get the EntityPlayerMP from the command sender
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))) } }
-
[1.7.10]Where do I find the Vanilla Files?
If you did infact do everything correct this picture might help you.
-
[1.8] Generate model file internally?
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?
-
[1.8] Generate model file internally?
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.
-
[1.8] Generate model file internally?
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?
-
[1.7.10 & 1.8] get a players ping to a server?
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
-
[1.7.10] How to handle vanilla bug of two items being consumed?
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
-
[1.7.10] How to handle vanilla bug of two items being consumed?
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
-
[1.7.10/1.8] Drawing beneath the hotbar.
That worked Thanks!
-
[1.7.10/1.8] Drawing beneath the hotbar.
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.
-
[1.7.10/1.8] Drawing beneath the hotbar.
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.
-
[1.7.10/1.8] Drawing beneath the hotbar.
@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.
-
[1.7.10] Random crash error
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.
-
[1.7.10] Random crash error
100% sure it is. I have no trace of java 7 on my computer, only java 8. I use eclipse daily.
-
[1.7.10] Random crash error
What version of java are you on? Try getting java 8
-
[1.7.10/1.8] Drawing beneath the hotbar.
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.
-
Minecraft keeps crashing when try to start using run tool in eclipse
There's blank lines in vanilla lang files, so it crashes no matter what
-
[1.8] Can't get block to render in inventory
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")
-
[1.8] Can't get block to render in inventory
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.
IPS spam blocked by CleanTalk.