Résolu Probleme render
-
Bonsoir,
J’ai un problème avec mon render de ma dynamite sa affiche une fleche a la place
-
Il va falloir en dire beaucoup plus et donner les classes concernées
-
quand je clique droit pour lancer ma dynamite elle affiche une fleche qui tombe… quelle class je doit te montrer ?
-
La classe de la dynamite, et du rendu
-
Et le client proxy aussi
Envoyé de mon RAINBOW LITE 4G en utilisant Tapatalk
-
render
package com.mod.olicraft.Dynamite; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.Render; import net.minecraft.entity.Entity; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import com.mod.olicraft.Dynamite.WeaponModResources; import com.mod.olicraft.Dynamite.EntityDynamite; //weaponMod public class RenderDynamite extends Render { public void renderDynamite(EntityDynamite entityarrow, double d, double d1, double d2, float f, float f1) { bindEntityTexture(entityarrow); GL11.glPushMatrix(); GL11.glTranslatef((float) d, (float) d1, (float) d2); GL11.glRotatef(entityarrow.rotationYaw + 90F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(entityarrow.prevRotationPitch + (entityarrow.rotationPitch - entityarrow.prevRotationPitch) * f1, 0.0F, 0.0F, 1.0F); Tessellator tessellator = Tessellator.instance; int i = 0; float f2 = 0.0F; float f3 = 0.5F; float f4 = (0 + i * 10) / 32F; float f5 = (5 + i * 10) / 32F; float f6 = 0.0F; float f7 = 0.15625F; float f8 = (5 + i * 10) / 32F; float f9 = (10 + i * 10) / 32F; float f10 = 0.05625F; GL11.glEnable(32826 /*GL_RESCALE_NORMAL_EXT*/); float f11 = -f1; if (f11 > 0.0F) { float f12 = -MathHelper.sin(f11 * 3F) * f11; GL11.glRotatef(f12, 0.0F, 0.0F, 1.0F); } GL11.glRotatef(45F, 1.0F, 0.0F, 0.0F); GL11.glScalef(f10, f10, f10); GL11.glTranslatef(-4F, 0.0F, 0.0F); GL11.glNormal3f(f10, 0.0F, 0.0F); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-7D, -2D, -2D, f6, f8); tessellator.addVertexWithUV(-7D, -2D, 2D, f7, f8); tessellator.addVertexWithUV(-7D, 2D, 2D, f7, f9); tessellator.addVertexWithUV(-7D, 2D, -2D, f6, f9); tessellator.draw(); GL11.glNormal3f(-f10, 0.0F, 0.0F); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-7D, 2D, -2D, f6, f8); tessellator.addVertexWithUV(-7D, 2D, 2D, f7, f8); tessellator.addVertexWithUV(-7D, -2D, 2D, f7, f9); tessellator.addVertexWithUV(-7D, -2D, -2D, f6, f9); tessellator.draw(); for (int j = 0; j < 4; j++) { GL11.glRotatef(90F, 1.0F, 0.0F, 0.0F); GL11.glNormal3f(0.0F, 0.0F, f10); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-8D, -2D, 0.0D, f2, f4); tessellator.addVertexWithUV(8D, -2D, 0.0D, f3, f4); tessellator.addVertexWithUV(8D, 2D, 0.0D, f3, f5); tessellator.addVertexWithUV(-8D, 2D, 0.0D, f2, f5); tessellator.draw(); } GL11.glDisable(32826 ); GL11.glPopMatrix(); } public float pitch = 40F; @Override public void doRender(Entity entity, double d, double d1, double d2, float f, float f1) { renderDynamite((EntityDynamite) entity, d, d1, d2, f, f1); } @Override protected ResourceLocation getEntityTexture(Entity entity) { return WeaponModResources.Textures.DYNAMITE; } }
item dynamite
package com.mod.olicraft.items; import com.mod.olicraft.Dynamite.EntityDynamite; import java.util.Random; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class ItemDynamite extends Item { public ItemDynamite(String id) { maxStackSize = 64; } public int getItemEnchantability() { return 0; } public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) { if(entityplayer.inventory.consumeInventoryItem(this)) { world.playSoundAtEntity(entityplayer, "game.tnt.primed", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 0.8F)); if(!world.isRemote) { world.spawnEntityInWorld(new EntityDynamite(world, entityplayer, 40 + itemRand.nextInt(10))); } } return itemstack; } public boolean shouldRotateAroundWhenRendering() { return true; } public boolean isFull3D() { return true; } }
client proxy
package com.mod.olicraft.proxy; import com.mod.olicraft.Dynamite.EntityDynamite; import com.mod.olicraft.Dynamite.RenderDynamite; import cpw.mods.fml.client.registry.RenderingRegistry; public class ClientProxy extends CommonProxy { @Override public void registerRenders() { RenderingRegistry.registerEntityRenderingHandler(EntityDynamite.class, new RenderDynamite()); } }
-
Tu peut envoyé ta class EntityDynamite aussi
et dans ta class principal tu a bien mis cette ligneEntityRegistry.registerModEntity(EntityDynamite.class, "Dynamite", 7, this, 64, 20, true);
-
ses bon mon probleme et regler merci