
zerofall
Members-
Posts
32 -
Joined
-
Last visited
Converted
-
Gender
Undisclosed
-
Personal Text
I am new!
zerofall's Achievements

Tree Puncher (2/8)
0
Reputation
-
Great! That works. Now how do I tell that event to only render when right-click is being held? On the onRightClick method I set a flag to true, but how do I set it to false when right-click isn't being held any more?
-
I'm actually trying to go for something that behaves more like this: https://youtu.be/IjVQVAt7j0U?t=38 Does that give a better idea?
-
Yes, I do.
-
I would like to learn how to render a block in the world (a set distance from the player) when a player holds right-click on an item. Can anybody point me in the right direction? Here is what I have so far: @Override public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand) { Vec3d look = playerIn.getLookVec(); float distance = 10.0F; double dx = playerIn.posX + (look.xCoord * distance); double dy = playerIn.posY + (look.yCoord * distance); double dz = playerIn.posZ + (look.zCoord * distance); BlockPos position = new BlockPos(dx, dy, dz); //RENDER THE BLOCK AT THE POSITION ABOVE return super.onItemRightClick(itemStackIn, worldIn, playerIn, hand); }
-
Thanks! Here are some snippets of code I used to get this working: private static Method dropFewItems; private static Method dropEquipment; private static Method addRandomDrop; Boolean deobf = (Boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment"); dropFewItems = EntityLivingBase.class.getDeclaredMethod(deobf ? "dropFewItems" : "func_70628_a", boolean.class, int.class); dropEquipment = EntityLivingBase.class.getDeclaredMethod(deobf ? "dropEquipment" : "func_82160_b", boolean.class, int.class); addRandomDrop = EntityLivingBase.class.getDeclaredMethod(deobf ? "addRandomDrop" : "func_82164_bB"); dropFewItems.setAccessible(true); dropEquipment.setAccessible(true); addRandomDrop.setAccessible(true);
-
Great advice, its working great now. I should add that I had to call getDeclaredMethod on EntityLivingBase.class, not the mob's class (if anybody else runs into this same problem). The only thing left is: addRandomDrop. I checked methods.csv on the most recent MCP, and I can't find it. I found another mod that uses is, and decompiled to find func_82164_bB... but after some googling, I feel like that maps to something regarding armor. Am I missing something here?
-
I am trying to change a mob's drops as if they were killed with Looting, but without using an enchanted item. The best I could come up with is to hook into LivingDropsEvent, and do this: if (!mob.isChild() && mob.worldObj.getGameRules().getBoolean("doMobLoot")) { mob.capturedDrops.clear(); mob.captureDrops = true; try { Method dropFewItems = mob.getClass().getMethod("dropFewItems", boolean.class, int.class); Method dropEquipment = mob.getClass().getMethod("dropEquipment", boolean.class, int.class); Method addRandomDrop = mob.getClass().getMethod("addRandomDrop"); dropFewItems.invoke(mob, true, customLootingLevel); dropEquipment.invoke(mob, true, customLootingLevel); if (mob.worldObj.rand.nextFloat() < 0.025F + (float)customLootingLevel* 0.01F) { addRandomDrop.invoke(mob); } mob.captureDrops = false; event.drops.clear(); event.drops.addAll(mob.capturedDrops); } I now have 2 probems: 1. I am getting this error: java.lang.NoSuchMethodException: net.minecraft.entity.passive.EntityChicken.dropFewItems(boolean, int) 2. I realized this might break when its re-obfuscated because the method names change. What is the best way to do this?
-
Sure, ya registry name would work. I guess I'm hoping for something like this: anyItem.json: { "parent":"test:item/standard_item", "textures": { "layer0":"test:items/#this.registryName#" } }
-
Thanks for the tips. So I can use 1 JSON file with 100 lines instead of 100 JSON files... but I am still wondering if there is a way to have 1 short, dynamic JSON file that passes in the unlocalized name instead? Or maybe a way to do this that goes around JSON files all together?
-
I'm not sure if I understand what you mean, but I think I am already doing this. Example JSON files: standard_item.json { "parent":"builtin/generated", "display": { "thirdperson": { "rotation": [ -90, 0, 0 ], "translation": [ 0, 1, -3 ], "scale": [ 0.55, 0.55, 0.55 ] }, "firstperson": { "rotation": [ 0, -135, 25 ], "translation": [ 0, 4, 2 ], "scale": [ 1.7, 1.7, 1.7 ] } } } exampleItem1.json: { "parent":"test:item/standard_item", "textures": { "layer0":"test:items/exampleItem1" } } Code used to register model: public static void registerRenderer(Item item) { Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.modId + ":" + item.getUnlocalizedName().substring(5), "inventory")); } My problem is that for the "exampleItem1.json" file... I have tons of them... and SURELY there is a way around that. Is there a way that I can have them all use the same JSON file, and pass in the unlocalized name as a variable into the JSON file (or something like that)?
-
I am working on a mod that has LOTS of items (not blocks), and I am getting tired of creating so many JSON item model files. They are all the EXACT same, except for the "layer0" path (and the image names are all the same as the unlocalized names). Is there a way around this so I don't have a hundred JSON files that are almost identical?
-
That worked! Thanks so much. Here is the code that worked for me: ResourceLocation fluidTexture = FluidRegistry.LAVA.getStill(); TextureAtlasSprite sprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(fluidTexture.toString()); Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture); this.drawTexturedModalRect(0, 0, sprite, 16, 16);
-
I tried this: ResourceLocation fluidTexture = FluidRegistry.LAVA.getStill(); TextureAtlasSprite sprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(fluidTexture.toString()); Minecraft.getMinecraft().renderEngine.bindTexture(fluidTexture); this.drawTexturedModalRect(0, 0, sprite, 16, 16); I also tried to bring over the 1.7.10 code you pointed me to, but GL and rendering are my weakest areas, so I wasn't sure how to update it.
-
Just tried what you described, and I'm still seeing the "no texture" texture (although I may be doing it wrong). I also looked at the link you provided, and I don't think it will work for 1.8. I think things like Tesselator and startDrawingQuads are gone now. Do you have a working code example for 1.8? Or know where I could find one?
-
How do I render lava in my GUI? I tried this: ResourceLocation fluidTexture = FluidRegistry.LAVA.getStill(); Minecraft.getMinecraft().renderEngine.bindTexture(fluidTexture); this.drawModalRectWithCustomSizedTexture(0, 0, 0, 0, 16, 16, 16, 16); But I just get a square with "no texture". What is the right way to do this in 1.8.x?