Jump to content

signat

Members
  • Posts

    5
  • Joined

  • Last visited

signat's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Thank you both for all your help. I also like the idea of creating a using a baked model. I am familiar with the process somewhat from using Unity, but this is obviously quite different. Rather than posting a lot of ignorant questions from this point on, I will just try and do some research on creating baked models for minecraft. Thanks again!
  2. I really like the idea of building the model out of boxes and just coloring each box to match the item texture I was originally using. I don't see how to assign color after something like: this.renderer.addbox() but, I will try and find some reference material on how to build the model this way since its a relatively simple one. Thanks for all your help!
  3. Thank you, Draco! This makes perfect sense. Do you have a suggestion of a model class I can reference to try and figure out what I need to change? I looked around for something that might be rendering my item model (like when its held in hand) but didn't see it.
  4. Thank you, oldcheese! I don't know why I didn't look at RenderArrow in the first place. Adding these lines of code to my RenderThrowingStar class' doRender method gave me the result I was looking for: GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks - 90.0F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks, 0.0F, 0.0F, 1.0F); I do have one follow-up question if you have the time. The open GL coding is something that I have never done before. So, my question is: Now that I have the throwing star oriented correctly, I can see that it has no depth. What I mean is that when looking at the side it renders 16 by 16 but on edge, I can only see a tiny vertical line when thrown. I tried changing this in my ModelThrowingStar class: this.renderer.addBox(0.0F, 0.0F, 0.0F, 16, 16, 0); to this.renderer.addBox(0.0F, 0.0F, 0.0F, 16, 16, 1); Where 1 is supposed to be the depth of the box, but it has no effect. Or if the box is rendered at a depth of 1, there is no texture being applied. Thanks!
  5. Hello, Very new to minecraft modding, but I have been making good progress. I have created a custom throwable entity based mostly on EntitySnowBall that works perfectly. However, when I throw it, the model is always rendered in the same orientation with reference to the world. I would like for its rendered orientation to be based on the player so that its its always thrown on edge (its a throwing star) to look more realistic. Here are what I believe to be the relevant portions of my code. Thank you all for your help! ModelThrowingStar Class @SideOnly(Side.CLIENT) public class ModelThrowingStar extends ModelBase { public ModelRenderer renderer; public ModelThrowingStar() { this.textureWidth = 16; this.textureHeight = 16; this.renderer = new ModelRenderer(this, 0, 0); this.renderer.setRotationPoint(0.0F, 0.0F, 0.0F); this.renderer.addBox(0.0F, 0.0F, 0.0F, 16, 16, 0); } @Override public void render(Entity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float rotationYaw, float rotationPitch, float scale) { this.renderer.render(scale); } RenderThrowingStar Class private final ModelThrowingStar model = new ModelThrowingStar(); @Override public void doRender(EntityThrowingStar entity, double x, double y, double z, float entityYaw, float partialTicks) { GlStateManager.pushMatrix(); GlStateManager.translate(x, y, z); this.bindEntityTexture(entity); model.render(entity, partialTicks, 0f, -1f, 0f, 0f, 0.05f); GlStateManager.popMatrix(); super.doRender(entity, x, y, z, entityYaw, partialTicks); } EntityThrowingStar Class public class EntityThrowingStar extends EntityThrowable{ public EntityThrowingStar(World worldIn) { super(worldIn); } public EntityThrowingStar(World worldIn, EntityLivingBase throwerIn) { super(worldIn, throwerIn); } public EntityThrowingStar(World worldIn, double x, double y, double z) { super(worldIn, x, y, z); } /** * Handler for {@link World#setEntityState} */ @SideOnly(Side.CLIENT) @Override public void handleStatusUpdate(byte id) { if (id == 3) { for (int i = 0; i < 8; ++i) { this.world.spawnParticle(EnumParticleTypes.CRIT, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D); } } } /** * Called when this EntityThrowable hits a block or entity. */ @Override protected void onImpact(RayTraceResult result) { if (result.entityHit != null) { int i = 10; result.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), (float)i); } if (!this.world.isRemote) { this.world.setEntityState(this, (byte)3); this.setDead(); } } } ThrowingStar Class (Item Class with the right click action) @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { ItemStack itemstack = playerIn.getHeldItem(handIn); if (!playerIn.capabilities.isCreativeMode) { itemstack.shrink(1); } worldIn.playSound((EntityPlayer)null, playerIn.posX, playerIn.posY, playerIn.posZ, SoundEvents.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); if (!worldIn.isRemote) { EntityThrowingStar entitythrowingstar = new EntityThrowingStar(worldIn, playerIn); entitythrowingstar.setHeadingFromThrower(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F, 1.5F, 1.0F); worldIn.spawnEntity(entitythrowingstar); } playerIn.addStat(StatList.getObjectUseStats(this)); return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, itemstack); } Please let me know if there is other code I should have posted.
×
×
  • Create New...

Important Information

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