Jump to content

EverythingGames

Forge Modder
  • Posts

    388
  • Joined

  • Last visited

Everything posted by EverythingGames

  1. Hi Spawn many particles with XYZ offsets.
  2. Hi @OP Check out this post on the Minecraft Forum. These guys seemed to have found a solution, that is if you don't mind a little reflection (hacky solution warning): http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/modification-development/2350828-unequip-equip-animation-on-item-damage
  3. Hi Kind of weird in design, like for example arrays are zero-based. Why did the Minecraft developers do that is beyond me!
  4. Hi Maybe use events and then send packets to call the achievement methods?
  5. Hi I have found myself using a static class only when I am creating subclasses in the super class for the purpose of quickness \ less classes with very little code (I have done this in the item initialization and registry class and created subclasses there). In the item registry class, the methods should be declared "static". If the case is that your subclass references a static variable or method from the super class, the subclass must be static or eclipse will throw errors. Sounds confusing until you try it!
  6. I'm sorry, I also would like to add that in your EntityBlasterBolt class, I think you can extend something like EntityProjectile (I might be remembering incorrectly, I would check but I don't have my project ATM). Hope that helps!
  7. Have you taken a peek at the vanilla arrow? Also, is your custom arrow different from the vanilla arrow? I hope you get this working soon as I know how frustrating it can be to get the code working!
  8. Thanks for the reply, coolAlias. I don't why performing the rendering straight from the RenderHandEvent would be more benificial rather than just having one method (I'd like to know because I may be false on the subject matter). What is this IPerspectiveAwareModel? I haven't heard of this before and I don't know why. If you could briefly describe this to me (if it is benificial to my problem) or provide a link I would greatly appreciate it. Some things to look at in ItemRenderer.class:
  9. I also want to add on the fact of this: Would you like to recieve information on the server / exchange information between the client and the server? If so, you need to send packets. I know that you just want to display something on the screen every tick, bu getting this type of info is useful. Here is an extremely helpful tutorial on packets for the SNW (SimpleNetworkWrapper) by coolAlias: https://github.com/coolAlias/Tutorial-Demo
  10. Hi If you would like to use this (you probably would want to if you cannot modify the vanilla render itself), the RenderPlayerAPI is excellent for rendering the third person player by not event using much code at all. Just add the API to your referenced jars and register a new RenderPlayerBase (you'll understand what that means when you visit the link I'll provide for the API). The only downside to using this is that when releasing your mod you must have the user to install the RenderPlayerAPI mod along with yours. If you don't mind that and want an easy way to obtain the render for the third person player check the mod out here: http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/1283669-render-player-api If you have decided to use the API, check this out: This is done by doing this with the API of course. Create a new class to call your renders: public class CustomRenderPlayer extends ModelPlayerBase { public CustomRenderPlayer(ModelPlayerAPI par1ModelPlayerAPI) { super(par1ModelPlayerAPI); } @Override public void setRotationAngles(float paramFloat1, float paramFloat2, float paramFloat3, float paramFloat4, float paramFloat5, float paramFloat6, net.minecraft.entity.Entity paramEntity) { this.modelPlayer.bipedRightArm.rotateAngleX = 90.0F; } } Register this class in your client proxy: public class ClientProxy extends CommonProxy { @Override public void registerRenderers() { ModelPlayerAPI.register(YourMod.MOD_ID, YourCustomRenderPlayerClass.class); }
  11. Hi You could also do this in an event, if you would like. This can be done using ClientTickEvent or RenderTickEvent (each ran on the client side, I believe), called on the FMLCommonHandler BUS. If the update method is easier, by all means use it. @SubsribeEvent public void clientTickEvent(ClientTickEvent par1ClientTickEvent) { //Make sure to null check the world here } @SubsribeEvent public void renderTickEvent(RenderTickEvent par1RenderTickEvent) { //Make sure to null check the world here } //Register the classes that contain these events in your pre-Init @Mod.EventHandler public void preInitializationEvent(FMLPreInitializationEvent par1FMLPreInitializationEvent) { FMLCommonHandler.instance().bus().register(new YourClassWithTheEvents()); }
  12. Just throwing this out there (please feel encouraged to correct me): I have tried to extend the ItemRenderer class, override the ItemRenderer.renderItemInFirstPerson(float par1Float) and call it in the RenderHandEvent. In the overridden renderItemInFirstPerson, I call another method (exactly the same as the vanilla method func_178095_a in ItemRenderer) called customRenderOne to try and render a new arm just to test. As you all know, my problem is to render the arm to make it look like the player is holding my model (specifically a gun / weapon model) in first person. Here is a trial of some tried code: @SideOnly(Side.CLIENT) public class CustomFirstPerson extends ItemRenderer { private Minecraft mc; private RenderManager renderManager; private RenderItem itemRenderer; public CustomFirstPerson(Minecraft par1Minecraft) { super(par1Minecraft); this.mc = par1Minecraft; this.renderManager = par1Minecraft.getRenderManager(); this.itemRenderer = par1Minecraft.getRenderItem(); } @SubscribeEvent public void renderHandEvent(RenderHandEvent par1RenderHandEvent) { this.renderItemInFirstPerson(1.0F); } @Override public void renderItemInFirstPerson(float par1Float) { try { ItemRenderer itemrenderer = new ItemRenderer(this.mc); EntityPlayerSP entityplayersp = this.mc.thePlayer; Field field1 = ItemRenderer.class.getDeclaredField("equippedProgress"); Field field2 = ItemRenderer.class.getDeclaredField("prevEquippedProgress"); field1.setAccessible(true); field2.setAccessible(true); float equippedProgress = field1.getFloat(itemrenderer); float prevEquippedProgress = field2.getFloat(itemrenderer); float f1 = 1.0F - (prevEquippedProgress + (equippedProgress - prevEquippedProgress) * par1Float); float f2 = entityplayersp.getSwingProgress(par1Float); if(!entityplayersp.isInvisible()) { customRenderOne(entityplayersp, f1, f2); } } catch(Exception par2Exception) { } } private void customRenderOne(AbstractClientPlayer par1AbstractClientPlayer, float par2Float, float par3Float) { float f2 = -0.3F * MathHelper.sin(MathHelper.sqrt_float(par3Float) * (float) Math.PI); float f3 = 0.4F * MathHelper.sin(MathHelper.sqrt_float(par3Float) * (float) Math.PI * 2.0F); float f4 = -0.4F * MathHelper.sin(par3Float * (float) Math.PI); GlStateManager.translate(f2, f3, f4); GlStateManager.translate(0.64000005F, -0.6F, -0.71999997F); GlStateManager.translate(0.0F, par2Float * -0.6F, 0.0F); GlStateManager.rotate(45.0F, 0.0F, 1.0F, 0.0F); float f5 = MathHelper.sin(par3Float * par3Float * (float) Math.PI); float f6 = MathHelper.sin(MathHelper.sqrt_float(par3Float) * (float) Math.PI); GlStateManager.rotate(f6 * 70.0F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(f5 * -20.0F, 0.0F, 0.0F, 1.0F); this.mc.getTextureManager().bindTexture(par1AbstractClientPlayer.getLocationSkin()); GlStateManager.translate(-1.0F, 3.6F, 3.5F); GlStateManager.rotate(120.0F, 0.0F, 0.0F, 1.0F); GlStateManager.rotate(200.0F, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(-135.0F, 0.0F, 1.0F, 0.0F); GlStateManager.scale(1.0F, 1.0F, 1.0F); GlStateManager.translate(5.6F, 0.0F, 0.0F); Render render = this.renderManager.getEntityRenderObject(this.mc.thePlayer); RenderPlayer renderplayer = (RenderPlayer) render; renderplayer.func_177138_b(this.mc.thePlayer); }
  13. I myself just don't see why an animation has to play when the item is refreshed / updated. All the fields are private, and yes, reflection is hacky considering all the work-arounds that you must do to try and get it to work. I did but it was not efficient and extremely hacky. Hope that the Forge Devs work this out as it has caused a lot of trouble with my mods causing me to fall back on IEEP and packets.
  14. Thanks for all the replies, everyone. I have used the RenderHandEvent, and I think RenderPlayer events work, you just have to use the subclasses (pre, post). I tested this by canceling the event and it did indeed not render the player as it was invisible. As far as my problem, TGG pointed out the various functions in the ItemRenderer and RenderPlayer classes, I had a look at them and am still stuck. Im trying my best to see whats going on (haha, too much obfuscated methods). As TGG suggested that I look into various other mods' source code to see how they achieved a custom first person render, most of them use the RenderPlayerAPI. Also I have tried using the functions in the ItemRenderer class, just not much luck. There is a couple of fields obtained with the player instance (I believe only the client, I may be wrong though) called renderArmPitch and renderArmYaw with looks to be the fact of being able to translate the model in first person. Maybe canceling the render hand event and rendering my own hand? I just don't know on too much how, rendering is a bit tricky for myself as far as entities go. I hope to achieve this first person view soon! @SubscribeEvent public void renderHandEvent(RenderHandEvent par1RenderHandEvent) { //do something here } //With player instance void test(EntityPlayer player) { player.renderArmPitch = 0.0F; //there's also prevRenderArmPitch player.renderArmYaw = 0.0F; // there's also prevRenderArmYaw }
  15. Hi I hope this gives you a basic idea: 1.) Gui - An in-game overlay that is displayed on the screen. EG: Hotbar 2.) GuiScreen - Used for displaying something on the screen but halting the player and letting the user have control over the mouse pointer. EG: Pressing "E" to open inventory 3.) GuiContainer - Used for items or blocks that hold items or do a specific job. EG: Opening a chest and the GuiContainer is displayed Extend whatever gui you need in your class and open them using IGuiHandler via your client proxy as gui's are client side (rendering). Make sure you read up on TGG's link in his post.
  16. Check if the player has the specific potion effect or is standing by the block. If they are, then do something.
  17. Hi The drawString method pretty much does what it says on the tin - draws the specified string to your screen at specific coordinates. Call it in whatever event you want at the client. EG: drawString(FONT RENDER OBJECT, "STRING", POSITIONX, POSITIONY, COLOR);
  18. Hi Just add the item to the player's inventory with the specific metadata.
  19. Thanks for the reply, TGG, it helped lead me a lot further. I looked in the RenderPlayer class, and I found the various functions. Is the rendering of the hand in first person canceled when the player is holding an item? Should I override the function that modifies the first person arm - if so which exact function controls the rendering with an item. If you could clear some things up for me and point me in the right direction I would greatly appreciate it! I am seeking to do something along the lines of this: [Courtesy of Last Days Mod]
  20. Hi I'm using version 1.8 but I'm sure things are similar: 1.) Create new entity class extending EntityThrowable 2.) Register the entity in your pre-Init using EntityRegistry 3.) In your item class that you want to spawn the entity from, get an instance of the world and use par2World.spawnEntityInWorld(world, entityLivingBase); 4.) Use whatever model / texture you need
  21. Hi There was a topic on this very same problem a while back (solved), I've even had to switch to IEEP because of this. I have found a close solution - reflection. Setting the equipped progress to 1.0F when setting / changing the NBT of an item. However, checking every tick if the tag is being changed and setting the value to 1.0F causes major rendering problems when trying to switch to another item (It continues to render the same item regardless of what item is actually equipped).
  22. Hi Do what diesieben07 said... the block positions provided in the event. public void blockBreak(BreakEvent evt) { EntityItem item = new EntityItem(evt.world, evt.pos.getX(), evt.pos.getY(), evt.pos.getZ(), new ItemStack(Item.getItemFromBlock(Blocks.glass))); }
  23. Hi I have been working on my mod for some time now, and I have seem to have come to a problem. I can't seem to figure out how to obtain the hand in first person and translate / rotate it accordingly. If I could also add that I only need to do the modifications to the arm when I am holding a certain item. I am using the RenderPlayerAPI core for Minecraft 1.8. Thanks to all in advance! public class CustomRenderPlayer extends ModelPlayerBase { public CustomRenderPlayer(ModelPlayerAPI modelPlayerAPI) { super(modelPlayerAPI); } @Override public void setRotationAngles(float paramFloat1, float paramFloat2, float paramFloat3, float paramFloat4, float paramFloat5, float paramFloat6, net.minecraft.entity.Entity paramEntity) { this.modelPlayer.bipedLeftArm.rotateAngleX = 0.0F; //Not trying to rotate any here - I believe this is only included in third person... (Not what I need) this.modelPlayer.bipedRightArm.rotateAngleX = 0.0F; //Not trying to rotate any here - I believe this is only included in third person... (Not what I need) } }
×
×
  • Create New...

Important Information

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