Jump to content

MCRaichu

Members
  • Posts

    63
  • Joined

  • Last visited

Everything posted by MCRaichu

  1. Is that safe? the ID is of type UUID (128bit) and casting it to int (32bit) could cause some trouble, right? EDIT: forget it. I used entityUniqueID not getEntityId() [SOLVED]
  2. okay, so I explained it wrong. after I called openGui from EntityPlayer /** * Opens a GUI with this player, uses FML's IGuiHandler system. * Allows for extension by modders. * * @param mod The mod trying to open a GUI * @param modGuiId GUI ID * @param world Current World * @param x Passed directly to IGuiHandler, data meaningless Typically world X position * @param y Passed directly to IGuiHandler, data meaningless Typically world Y position * @param z Passed directly to IGuiHandler, data meaningless Typically world Z position */ public void openGui(Object mod, int modGuiId, World world, int x, int y, int z) { net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.openGui(this, mod, modGuiId, world, x, y, z); } this is handled on client and server side (getClientGuiElement, getServerGuiElement). How can I access the interacted entity at that point? Which I need to get the inventory.
  3. Hi, I created a custom entity with an inventory (basically like a horse). But I'm struggling opening the gui since openGui only takes the player as an input and I don't know how to get the entity I'm interacting with. Any ideas? Thanks in advance, MCRaichu
  4. Hi, I want to create an item that does not slow down the player while using it, for example a bow allowing to move at normal speed while charging up. My problem is, I can't find where the player is slowed during item usage. Has anyone done this before and figured out a way to do it? Anything helps. Thanks in advance, McRaichu
  5. Looping over all Renderes in PostInit makes sence. I don't have time until sunday to give it a try. May have more question on monday meaning I may bother you again . Thanks again.
  6. Wouldn't that require that I know all models when my mod is loaded? That would make it incompatible with other mods (their entities), right? In your experience, what would be your approach to achieve a kind of visual feedback to differentiate between affected entities and unaffected ones. Maybe I should consider a different idea. I just don't like the particle effects of the potions, I wanted something more solid/bigger.
  7. okay. to answer all you questions. 1.: the code i posted is in the onEvent(RenderLivingEvent.Post<EntityLivingBase> event) function as shown in Post 4 2.: As mentioned in the first post, I want to add something to any entity that is under a potioneffect. The code I posted, with creeper and the box I add, is just for testing. 3.: Using the model makes it easier to adjust the position of what i add, but with a global model that's not possible.
  8. No, the creeper (just a placeholder in my example) should render as normal but the addition, here the "box", should render with a texture of my choice. Currently the box renders with the creeper-texture.
  9. I may have to ask you to get a bit more specific. My understanding was to simply change the model and assign new texture (straight forward). EntityLivingBase entity = event.getEntity(); RenderLivingBase renderer = event.getRenderer(); ModelBase model = renderer.getMainModel(); if(entity instanceof EntityCreeper) { ModelCreeper mr = (ModelCreeper)model; renderer.bindTexture(new ResourceLocation(Gunny.MODID+ ":textures/items/models/vss_item.png")); ModelRenderer box = new ModelRenderer(model, 0, 16); box.addBox(0.0F, -20.0F, 0.0F, 10, 2, 10); mr.body.addChild(box); } Maybe I don't get when the event is called and what the difference of Pre and Post are in this case. Edit: Currently the original creeper-texture is still used.
  10. @SubscribeEvent public void onEvent(RenderLivingEvent.Post<EntityLivingBase> event) { EntityLivingBase entity = event.getEntity(); RenderLivingBase renderer = event.getRenderer(); ModelBase model = renderer.getMainModel(); if(entity instanceof EntityCreeper) { ModelCreeper mr = (ModelCreeper)model; ModelRenderer box = new ModelRenderer(model, 0, 16); box.addBox(0.0F, 0.0F, 0.0F, 10, 2, 10); mr.body.addChild(box); } } I did a small test-code. I love the idea of adding to the model because the added parts move with the entity. But the problem is, I have no idea how to set a different texture for my added parts. is it even possible?
  11. Hi everyone, I want to add a model I have made to entities while they are under a potioneffect. Currently I don't know where to start . Has anyone tried this before? Any tips where to start? For better understanding, I want to create a crystallization disease that creates tiny crystals on the infected entity. Thanks in advance, McRaichu
  12. That actually brings up another question. Since I want to change the model while the player is using the inventory/gui should I set a NBT flag to differentiate between both states? or is there a better soplution? I ask because of so the itemstack needs to know if gui ist open, right?
  13. Thanks for the quick answer. Since I only have two states the first the solution with ItemMeshDefinition makes the most sence. I have seen the ICustomModelLoader in ImmersiveEngineering and I definitly won't do that. Do you have a good example for ItemMeshDefinition ?
  14. okay. my json file (location: assets.gunny.blockstates) { "forge_marker": 1, "defaults": { "model": "gunny:b95_item.obj" }, "variants": { "inventory": [ { "transform": { "thirdperson_lefthand": { "rotation": [ { "x": 0 }, { "y": 0 }, { "z": 0 } ], "translation": [ 0.1, -0.1, 0.5 ], "scale": 0.15 }, "thirdperson_righthand": { "rotation": [ { "x": 0 }, { "y": 270 }, { "z": 0 } ], "translation": [ 0.1, 0.05, 0.2 ], "scale": 0.25 }, "gui": { "rotation": [ { "x": 45 }, { "y": 45 }, { "z": -45 } ], "translation": [ 0.2, -0.15, 0 ], "scale": 0.15 }, "firstperson_righthand": { "rotation": [ { "x": 0 }, { "y": 250 }, { "z": 0 } ], "translation": [ 0.0, 0.15, 0.0 ], "scale": 0.5 }, "firstperson_lefthand": { "rotation": [ { "x": 180 }, { "y": 180 }, { "z": 170 } ], "translation": [ 0, -0.1, 0 ], "scale": 0.5 }, "ground": { "rotation": [ { "x": 45 }, { "y": 0 }, { "z": 0 } ], "scale": 0.2 } } } ] }, "overrides": [ { "predicate": { "loading": 1 }, "model": "gunny:b95_open.obj" } ] } Item: public class B95 extends ItemInternalStorage { final int gun_cooldown = 20; public B95(String name) { super(name, 1); this.setHasSubtypes(true); this.setMaxDamage(0); this.setCreativeTab(Gunny.tabGunny); this.addPropertyOverride(new ResourceLocation("loading"), new IItemPropertyGetter() { @SideOnly(Side.CLIENT) public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) { System.out.println("loading"); return 0.0F; } }); } ... } Registration (domain is already added): ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(Gunny.MODID + ":" + item.getUnlocalizedName().substring(5), "inventory")); Anything else needed, just let me know.
  15. Hi, I have an item using an obj-model (works fine). Now I tried to add a PropertyGetter to switch between two models and it seems it doesn't execute the 'apply' function (currently the function consists of a System.out and a return so no problem there). Any ideas are appreciated. Thanks in adavance, MCRaichu PS: the idea is an item with an inventory that looks different while the gui is open. if there are examples with something similar out there, would be nice to know.
  16. Hi, came up with the same solution 3 minutes ago . For the sake of better understanding, what would be the drawback of actually doing it the FMLMessage-way? Are there any drawbacks, except the delay due to the pakets?
  17. Hi guys, i created a Gui extending GuiScreen, added a GuiHandler and call player.openGui(...) to open it. From this post [1.8.9]Mouse not showing up in gui I found out that you can return null in the getServerGuiElement method of the handler. But, since the gui didn't open I searched for a problem and found out that FMLNetworkHandler.openGui only sends a FMLMessage$OpenGui to the client if getServerGuiElement returns a Container. Therefore I just did the following: public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { if (ID != getGuiID()) { System.err.println("Invalid ID: expected " + getGuiID() + ", received " + ID); } BlockPos pos = new BlockPos(x, y, z); if (world.getBlockState(pos).getBlock() instanceof ConYard) { System.err.println("return gui"); return new Container() { @Override public boolean canInteractWith(EntityPlayer playerIn) { return true; } }; } return null; } And it works. My question would be, is there any other way to open a gui without this little work-around? Regards, McRaichu PS: I started from this tutorial Jabelar's Minecraft Forge Modding Tutorials: Block With Simple GUI. Which had some bugs, like the mouse not showing up.
  18. Thanks guys. The examples helped a lot. @Choonster: why pigs? [sOLVED]
  19. Thanks, I will check it out. Skimming the site, it looks pretty complicated but doable (do you have an example?).
  20. Hi, I want to keep track of how much a certain player used an item and then award the player with an achievement. At this moment I don't have any idea where to start. To better understand what I want, here is an example: I want to keep track of how many apples a player has eaten. After 100 apples I want to give him an achievement. Any Ideas are welcome. Regards, McRaichu
  21. "yep, sounds right" == you are right and yes workbench doesn't ... I missed the ! in !=. crap, 3 hours wasted because of one character. thx, works like a charm now
  22. "yep, sounds right" == you are right and yes workbench doesn't ... I missed the ! in !=. crap, 3 hours wasted because of one character. thx, works like a charm now
  23. yep, sounds right. But for now that is not important (the workbench does the same ). And i tested and it returns true and still the gui doesn't show.
  24. yep, sounds right. But for now that is not important (the workbench does the same ). And i tested and it returns true and still the gui doesn't show.
×
×
  • Create New...

Important Information

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