
EverythingGames
Forge Modder-
Posts
388 -
Joined
-
Last visited
Everything posted by EverythingGames
-
[1.8] Techne Model Not Corresponding To Player
EverythingGames replied to EverythingGames's topic in Modder Support
It does not rotate with the player. Everything else is fine. -
It's more complicated with blocks, as @coolAlias said, but its basically the same as the item code I provided, just a little more code in the base block class. This class includes more features such as block sound, material, hardness, resistance, tool harvest, random generation, etc. Really handy when creating many blocks and items if I should say so myself.
-
Hi, I have a techne model and rendered it during the RenderPlayerEvent. The model is 100% correct, but the model doesn't stay on the player's back, as it is a backpack model. I want it to be physically attached to the player's back so that wherever the player is moving, looking, etc., the backpack is always in the correct position. Here is my model code and rendering code: Model: public class ModelPlayerBackpack extends ModelBase { protected static final ResourceLocation RESOURCE_LOCATION = new ResourceLocation(Main.MOD_ID + ":" + "textures/player/playerbackpack.png"); protected ModelRenderer baseOne; protected ModelRenderer baseTwo; protected ModelRenderer sideOne; protected ModelRenderer sideTwo; protected ModelRenderer pouchOne; protected ModelRenderer pouchTwo; public ModelPlayerBackpack() { this.textureWidth = 64; this.textureHeight = 64; this.baseOne = new ModelRenderer(this, 0, 52); this.baseOne.addBox(-3.0F, -5.5F, -0.5F, 6, 11, 1); this.baseOne.setRotationPoint(0.0F, 6.0F, 2.5F); this.baseOne.setTextureSize(64, 64); this.baseOne.mirror = true; this.setRotation(this.baseOne, 0.0F, 0.0F, 0.0F); this.baseTwo = new ModelRenderer(this, 0, 42); this.baseTwo.addBox(-2.5F, -4.5F, -0.5F, 5, 9, 1); this.baseTwo.setRotationPoint(0.0F, 6.0F, 3.5F); this.baseTwo.setTextureSize(64, 64); this.baseTwo.mirror = true; this.setRotation(this.baseTwo, 0.0F, 0.0F, 0.0F); this.sideOne = new ModelRenderer(this, 0, 32); this.sideOne.addBox(-1.0F, -4.0F, 0.0F, 2, 8, 2); this.sideOne.setRotationPoint(4.0F, 6.0F, 3.0F); this.sideOne.setTextureSize(64, 64); this.sideOne.mirror = true; this.setRotation(this.sideOne, 0.0F, 0.0F, 0.0F); this.sideTwo = new ModelRenderer(this, 0, 32); this.sideTwo.addBox(-1.0F, -4.0F, 0.0F, 2, 8, 2); this.sideTwo.setRotationPoint(-4.0F, 6.0F, 3.0F); this.sideTwo.setTextureSize(64, 64); this.sideTwo.mirror = true; this.setRotation(this.sideTwo, 0.0F, 0.0F, 0.0F); this.pouchOne = new ModelRenderer(this, 14, 59); this.pouchOne.addBox(-2.0F, -1.5F, 0.0F, 4, 3, 2); this.pouchOne.setRotationPoint(0.0F, 4.0F, 4.0F); this.pouchOne.setTextureSize(64, 64); this.pouchOne.mirror = true; this.setRotation(this.pouchOne, 0.0F, 0.0F, 0.0F); this.pouchTwo = new ModelRenderer(this, 14, 59); this.pouchTwo.addBox(-2.0F, -1.5F, 0.0F, 4, 3, 2); this.pouchTwo.setRotationPoint(0.0F, 8.0F, 4.0F); this.pouchTwo.setTextureSize(64, 64); this.pouchTwo.mirror = true; this.setRotation(this.pouchTwo, 0.0F, 0.0F, 0.0F); } public void setRotation(ModelRenderer par1ModelRenderer, float par2Float, float par3Float, float par4Float) { par1ModelRenderer.rotateAngleX = par2Float; par1ModelRenderer.rotateAngleY = par3Float; par1ModelRenderer.rotateAngleZ = par4Float; } @Override public void setRotationAngles(float par1Float, float par2Float, float par3Float, float par4Float, float par5Float, float par6Float, Entity par7Entity) { super.setRotationAngles(par1Float, par2Float, par3Float, par4Float, par5Float, par6Float, par7Entity); } @Override public void render(Entity par1Entity, float par2Float, float par3Float, float par4Float, float par5Float, float par6Float, float par7Float) { super.render(par1Entity, par2Float, par3Float, par4Float, par5Float, par6Float, par7Float); this.setRotationAngles(par2Float, par3Float, par4Float, par5Float, par6Float, par7Float, par1Entity); this.baseOne.render(par7Float); this.baseTwo.render(par7Float); this.sideOne.render(par7Float); this.sideTwo.render(par7Float); this.pouchOne.render(par7Float); this.pouchTwo.render(par7Float); } } Render: public class RenderModelPlayerBackpack { private ModelPlayerBackpack modelPlayerBackpack = new ModelPlayerBackpack(); @SubscribeEvent public void renderPlayerEvent(RenderPlayerEvent.Pre par1RenderPlayerEvent) { Minecraft.getMinecraft().getTextureManager().bindTexture(this.modelPlayerBackpack.RESOURCE_LOCATION); this.modelPlayerBackpack.render(Minecraft.getMinecraft().thePlayer, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); } }
-
This is a bad example! PlayerTickEvent will fire for every player, so in that case you would need IExtendedEntityProperties additionally to store the tick count. Wow I did not know that! Guess I learned something today. @OP don't use PlayerTickEvent, much more events out there!
-
IThreadListener may help, maybe.
-
[1.7.10] Right-click action (place a block) and swimming
EverythingGames replied to TheiTay's topic in Modder Support
Hi For the title, set entitySwing to true in a ticker to call at a steady pace, this will enable the vanilla "right click action". Do this while tesing if the player is swimming. -
Solved [1.8]NBTTag keeps reseting
EverythingGames replied to Hamster_Furtif's topic in Modder Support
The reply right above yours already mentioned that ItemStack NBT is automatically synced from server -> client, but that is not going to help the OP - he's trying to change the NBT from a GUI, so he definitely needs packets. No getting around that. Totally didn't see your post above @coolAlias! -
Hi If your doing this to delay an Item, you must use NBT as item fields are singletons. There are a vast amount of events / methods: EVENTS: * ServerTickEvent (every tick called server side) * ClientTickEvent (every tick called client side) * WorldTickEvent (every tick called for the world when player joined) * PlayerTickEvent (every tick called for the player when in a world) * RenderTickEvent (only when rendering) * LivingUpdateEvent (only on entities) * RenderGameOverlayEvent (only in GUI's) METHODS: * onUpdate(args) (called in Item.class) Use this piece of code to increment: private int count; @SubscribeEvent public void playerTickEvent(PlayerTickEvent event) //CHOOSE THE EVENT THAT BEST SUITS YOUR NEEDS { if(this.count < SOMEINTEGER) { this.count++; } else { this.count = 0; //EXECUTE YOUR METHOD HERE } }
-
Solved [1.8]NBTTag keeps reseting
EverythingGames replied to Hamster_Furtif's topic in Modder Support
I've never run in to this problem with my NBT for items. I don't think you'll need packets because I believe the item NBT gets updated on the client from the server by default, but you can try. Look into SimpleNetworkWrapper - there are a couple tutorials on it in the Tutorials Section. Even though it probably works, I wouldn't advise setting the integer while checking if the NBT is null. At first glance I though you were setting a new NBTTagCompound every time. Try this instead: if(stack.getTagCompound() == null) { stack.setTagCompound(new NBTTagCompound()); } else { //Do your setting and getting here } -
[SOLVED] [1.8] Changing Player Skin
EverythingGames replied to EverythingGames's topic in Modder Support
Thanks for the reply, @Ernio. I didn't have much time today earlier, but I took a quick look around in AbstractClientPlayer, RenderPlayer, and some of the methods in those pertaining to the player skin. The only time it returns a ResourceLocation locally (not downloaded) is when the player uses the default skin - Minecraft has to resort to the Steve / Alex player skin. Maybe I could find the method that returns true or false based on a custom skin and utilize reflection to return false there every time. Then I could again use reflection to change the method that grabs the Steve / Alex player skin and return my own ResourceLocation there. In theory, it might work, I'll try what I said and see if I can figure a solution. If someone has a better one, let me know. Thanks. -
Hi Check this out. Its really simple, yet you only need one line of code when registering items not counting the item field: public class ItemRegistry { public static ItemBase YOUR_ITEM; public static void registerItems() { ItemRegistry.YOUR_ITEM = new ItemBase(64, "youritem"); } } public class ItemBase extends Item { public ItemBase(int maxStackSize, String unlocalizedName) { this.setUnlocalizedName(unlocalizedName); this.setMaxStackSize(maxStackSize); GameRegistry.registerItem(this, unlocalizedName); } } You may add extra parameters to your ItemBase constructor such as a CreativeTab if you would like. So simple, yet effective. If you need to add methods to your item such as onItemRightClick for example, use this code in your ItemRegistry class instead: public static ItemBase YOUR_ITEM; public static void registerItems() { ItemRegistry.YOUR_ITEM = new YourItem(); } In your YourItem.class, do this: public class YourItem extends ItemBase //must include specific constructor { public YourItem() //No parameters, call super here { super(64, "youritem"); //@Param: int maxStackSize, String name } //Now you have a class to include regular item methods }
-
Hi I believe something is wrong in public void updateScreen() because I had a similar problem. Try using your own ticker via an event.
-
Hi How would I go about changing the player's skin (not using the Mojang servers of course)? I tried binding a pre-made skin during the RenderPlayerEvent.Pre but that seems to do absolutely nothing. Does anyone know how to achieve this without creating a new player model (seems like to much work considering I would probably write a new RenderPlayer class)? Thanks in advance!
-
Hi I believe the FOVUpdateEvent is fired on the MinecraftForge.EVENT_BUS. You can check here or use your IDE : https://dl.dropboxusercontent.com/s/h777x7ugherqs0w/forgeevents.html
-
[1.8] Binding Texture With Texture Manager
EverythingGames replied to EverythingGames's topic in Modder Support
I have most of it done. I appreciate your help @coolAlias. I have a class implementing IPerspectiveAwareModel and have registered it on the ModelBakeEvent. I'm pretty sure I still have to register the render for the item anyway? The tricky part for my item is that I want to de-render cuboids based on first person / third person etc. If you could just help me out on the the handlePerspective() method I think we can conclude this topic! By the way, why is almost everything deprecated? public class ModelItem implements IPerspectiveAwareModel { private IBakedModel modelItem; @Override public List getFaceQuads(EnumFacing par1EnumFacing) { return this.modelItem.getFaceQuads(par1EnumFacing); } @Override public List getGeneralQuads() { return this.modelItem.getGeneralQuads(); } @Override public boolean isAmbientOcclusion() { return this.modelItem.isAmbientOcclusion(); } @Override public boolean isGui3d() { return this.modelItem.isGui3d(); } @Override public boolean isBuiltInRenderer() { return this.modelItem.isBuiltInRenderer(); } @Override public TextureAtlasSprite getTexture() { return this.modelItem.getTexture(); } @Override public ItemCameraTransforms getItemCameraTransforms() { return this.modelItem.getItemCameraTransforms(); } @Override public Pair<IBakedModel, Matrix4f> handlePerspective(TransformType par1TransformType) { switch(par1TransformType) { case FIRST_PERSON: //What should I do here break; case THIRD_PERSON: //What should I do here break; case GUI: //What should I do here break; default: break; } return null; //What should I return here } -
[1.8] Binding Texture With Texture Manager
EverythingGames replied to EverythingGames's topic in Modder Support
UPDATE: ModelBakeEvent, correct? -
[1.8] Binding Texture With Texture Manager
EverythingGames replied to EverythingGames's topic in Modder Support
How do I return an IPerspectiveAwareModel for my item? Do I do this in getModel? If so, how do I cast it to a ModelResourceLocation? Thanks again. -
[SOLVED] [1.8] Custom Main Menu
EverythingGames replied to EverythingGames's topic in Modder Support
Yes, it works without it. My computer is definitely compatible with the new loading screen. I'm guessing I should turn it off in the config.properties? -
[1.8] Binding Texture With Texture Manager
EverythingGames replied to EverythingGames's topic in Modder Support
Actually, what interfaces would I need to implement from my model class to be able to: 1.) Make changes to a specific quad (bind skin texture to .JSON cuboid) 2.) Return different models based on perspective (first person, third person, etc.) I am guessing I should use IPerspectiveAwareModel and IFlexibleBakedModel? If you can tell me I would really like to know so I can start out. Also, with defining quads, are you just defining the cuboids within a .JSON model (that kind of scares me because my .JSON's have like 100 some odd cuboids...)? I know what some methods mean, but most kind of confuse me, especially when looking at TGG's code in MinecraftByExample. If you could clear up some stuff on what interfaces I need to implement and what those key methods in the interface do, I should be good to go on my own and be able to solve some minor problems that should arise. Thanks for all the help so far! -
[1.8] Binding Texture With Texture Manager
EverythingGames replied to EverythingGames's topic in Modder Support
Thanks. So basically I need to create an IModel to hold two models and return that in the getModel method as a ModelResourceLocation? I like your hack in one of your other posts, seems a lot easier. I didn't know that you could call GL rotation / translation functions in getModel! -
[1.8] Binding Texture With Texture Manager
EverythingGames replied to EverythingGames's topic in Modder Support
I was reading his code on the smart item model for the chessboard. It was going great, but then it got quite confusing. I don't know how exactly I'm supposed to manipulate my .JSON with my item and this interface with my item... I'm terribly confused, I'm sorry I'm not understanding this, rendering has not been my cup of tea. -
[1.8] Binding Texture With Texture Manager
EverythingGames replied to EverythingGames's topic in Modder Support
Thanks @coolAlias for the link! I'll go take a look! -
Hi This is more of a question then it is a problem, considering the fact that I have done custom main menu's in the past. It seems that ever since forge started displaying the text on load-up (when the Mojang logo appears and the forge anvil is in the bottom right corner), my custom main menu's don't work. I've checked the code a billion times, nothing is wrong. The way that I'd hook my menu was by testing if the current screen was the main menu, and if it was, change it to my own. What is causing this and how do I fix it? Thanks.
-
[1.8] Binding Texture With Texture Manager
EverythingGames replied to EverythingGames's topic in Modder Support
Thank you @delpi. I've read through this tutorial and wondered why this was for version 1.8, considering the class seen in the tutorial implements IItemRenderer (a deprecated interface that was considered "unusable" because of the new modeling / rendering system). No problem, I can probably use that, but I would really like to have this done the right way with the new system. I really don't know how to use these: (don't quote me on some wrong interface / class names) * IBakedModel * IFlexibleModel * IPerspectiveAwareModel I wish there was some 1.8 tutorials on this so I don't have to guess my way throughout my code. Nevertheless, I'm still going to try. Things for myself to accomplish: 1.) Render player arms as a separate model through .JSON and bind the player skin to it 2.) Render the separate arms with my custom model 3.) Learn how properly control when and how an item is rendered with the new system (1.8 rendering / modeling methods) That's all I need to do, then rendering can be a thing of the pass. I appreciate all previous and future posts, I'm going to go see if TGG has any tutorials. Thanks! -
[1.8] Binding Texture With Texture Manager
EverythingGames replied to EverythingGames's topic in Modder Support
I was sleepy when I wrote that code - I meant to put: boolean isFirstPerson = Minecraft.getMinecraft().gameSettings.isThirdPersonView == 0; The "isThirdPerson" is an integer, not a boolean (though my code returns a boolean value based on what isThirdPersonView is / returns), but anyway, I'll try IPerspectiveAwareModel.