Résolu [1.7.x]Extended Entity Properties/Dimension/Particules/Rotation d'un Item
-
Pour l’image en jeu : https://github.com/FFMT/nanotech_mod/blob/master/common/fr/mcnanotech/kevin_68/nanotechmod/main/event/RenderEvent.java#L45-L64
Par contre là c’est sur tout le jeu, il faudrait adapter le code pour mettre seulement sur une partie de l’écran.Pour les particules, aucune idée.
-
Ok merci, ça m’a permis en même temps de comprendre comment marchais le placement x, y avec Tessellator ^^
Encore un petit problème avec les overlays : J’aimerais utilisé une police spécial pour afficher des chiffres, actuellement j’utiliseFMLClientHandler.instance().getClient().fontRenderer.drawStringWithShadow(player.getEntityData().getInteger("numb"), 5, 15, 0xffffff); ``` mais il ne propose pas le changement de police donc y a t'il une fonction qui le propose où je vais devoir essayé de marcher par image :s ?
-
Heu non je ne crois pas qu’il y ait de fonction pour changer la police
-
Aie :s
Je vais essayé de passer par des images alors ._.
Pendant ce temps je continue à m’attaquer à plus dur et j’ai du mal >.<’
J’essaye de créer un(e) EntityItem plus grand(e) enfin une nouvelle entité basé sur son principe (Récupérable par le joueur, temps de récupération/dispawn, tourne sur elle même), j’ai commencé à épuré son codepublic class EntityItem2 extends EntityItem { private static final Logger logger = LogManager.getLogger(); /** * The age of this EntityItem (used to animate it up and down as well as expire it) */ public int age; public int delayBeforeCanPickup; /** * The health of this EntityItem. (For example, damage for tools) */ private String field_145801_f; private String field_145802_g; /** * The EntityItem's random initial float height. */ public float hoverStart; private static final String __OBFID = "CL_00001669"; /** * The maximum age of this EntityItem. The item is expired once this is reached. */ public int lifespan = 6000; public EntityItem2(World par1World, double par2, double par4, double par6) { super(par1World); this.hoverStart = (float)(Math.random() * Math.PI * 2.0D); this.setSize(0.25F, 0.25F); this.yOffset = this.height / 2.0F; this.setPosition(par2, par4, par6); this.rotationYaw = (float)(Math.random() * 360.0D); this.motionX = (double)((float)(Math.random() * 0.20000000298023224D - 0.10000000149011612D)); this.motionY = 0.20000000298023224D; this.motionZ = (double)((float)(Math.random() * 0.20000000298023224D - 0.10000000149011612D)); } public EntityItem2(World par1World, double par2, double par4, double par6, ItemStack par8ItemStack) { this(par1World, par2, par4, par6); this.setEntityItemStack(par8ItemStack); this.lifespan = (par8ItemStack.getItem() == null ? 6000 : par8ItemStack.getItem().getEntityLifespan(par8ItemStack, par1World)); } /** * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to * prevent them from trampling crops */ protected boolean canTriggerWalking() { return false; } public EntityItem2(World par1World) { super(par1World); this.hoverStart = (float)(Math.random() * Math.PI * 2.0D); this.setSize(0.25F, 0.25F); this.yOffset = this.height / 2.0F; } protected void entityInit() { this.getDataWatcher().addObjectByDataType(10, 5); } /** * Called to update the entity's position/logic. */ public void onUpdate() { if (this.getEntityItem() == null) { this.setDead(); } else { super.onUpdate(); if (this.delayBeforeCanPickup > 0) { –this.delayBeforeCanPickup; } this.prevPosX = this.posX; this.prevPosY = this.posY; this.prevPosZ = this.posZ; this.motionY -= 0.03999999910593033D; this.noClip = this.func_145771_j(this.posX, (this.boundingBox.minY + this.boundingBox.maxY) / 2.0D, this.posZ); this.moveEntity(this.motionX, this.motionY, this.motionZ); boolean flag = (int)this.prevPosX != (int)this.posX || (int)this.prevPosY != (int)this.posY || (int)this.prevPosZ != (int)this.posZ; if (flag || this.ticksExisted % 25 == 0) { if (this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)).getMaterial() == Material.lava) { this.motionY = 0.20000000298023224D; this.motionX = (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F); this.motionZ = (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F); this.playSound("random.fizz", 0.4F, 2.0F + this.rand.nextFloat() * 0.4F); } } float f = 0.98F; if (this.onGround) { f = this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ)).slipperiness * 0.98F; } this.motionX *= (double)f; this.motionY *= 0.9800000190734863D; this.motionZ *= (double)f; if (this.onGround) { this.motionY *= -0.5D; } ++this.age; ItemStack item = getDataWatcher().getWatchableObjectItemStack(10); if (!this.worldObj.isRemote && this.age >= lifespan) { this.setDead(); } if (item != null && item.stackSize <= 0) { this.setDead(); } } } /** * Looks for other itemstacks nearby and tries to stack them together */ private void searchForOtherItemsNearby() { return; } /** * Tries to merge this item with the item passed as the parameter. Returns true if successful. Either this item or * the other item will be removed from the world. */ public boolean combineItems(EntityItem par1EntityItem){ return false; } /** * sets the age of the item so that it'll despawn one minute after it has been dropped (instead of five). Used when * items are dropped from players in creative mode */ public void setAgeToCreativeDespawnTime() { this.age = 4800; } /** * Returns if this entity is in water and will end up adding the waters velocity to the entity */ public boolean handleWaterMovement() { return this.worldObj.handleMaterialAcceleration(this.boundingBox, Material.water, this); } /** * Will deal the specified amount of damage to the entity if the entity isn't immune to fire damage. Args: * amountDamage */ protected void dealFireDamage(int par1) { this.attackEntityFrom(DamageSource.inFire, (float)par1); } /** * Called when the entity is attacked. */ public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) { this.setBeenAttacked(); return false; } /** * (abstract) Protected helper method to write subclass entity data to NBT. */ public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) { par1NBTTagCompound.setShort("Age", (short)this.age); par1NBTTagCompound.setInteger("Lifespan", lifespan); if (this.func_145800_j() != null) { par1NBTTagCompound.setString("Thrower", this.field_145801_f); } if (this.func_145798_i() != null) { par1NBTTagCompound.setString("Owner", this.field_145802_g); } if (this.getEntityItem() != null) { par1NBTTagCompound.setTag("Item", this.getEntityItem().writeToNBT(new NBTTagCompound())); } } /** * (abstract) Protected helper method to read subclass entity data from NBT. */ public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) { this.age = par1NBTTagCompound.getShort("Age"); if (par1NBTTagCompound.hasKey("Owner")) { this.field_145802_g = par1NBTTagCompound.getString("Owner"); } if (par1NBTTagCompound.hasKey("Thrower")) { this.field_145801_f = par1NBTTagCompound.getString("Thrower"); } NBTTagCompound nbttagcompound1 = par1NBTTagCompound.getCompoundTag("Item"); this.setEntityItemStack(ItemStack.loadItemStackFromNBT(nbttagcompound1)); ItemStack item = getDataWatcher().getWatchableObjectItemStack(10); if (item == null || item.stackSize <= 0) { this.setDead(); } if (par1NBTTagCompound.hasKey("Lifespan")) { lifespan = par1NBTTagCompound.getInteger("Lifespan"); } } /** * Called by a player entity when they collide with an entity */ public void onCollideWithPlayer(EntityPlayer par1EntityPlayer) { if (!this.worldObj.isRemote) { if (this.delayBeforeCanPickup > 0) { return; } EntityItemPickupEvent event = new EntityItemPickupEvent(par1EntityPlayer, this); if (MinecraftForge.EVENT_BUS.post(event)) { return; } ItemStack itemstack = this.getEntityItem(); int i = itemstack.stackSize; if (this.delayBeforeCanPickup <= 0 && (this.field_145802_g == null || lifespan - this.age <= 200 || this.field_145802_g.equals(par1EntityPlayer.getCommandSenderName())) && (event.getResult() == Result.ALLOW || i <= 0 || true)) { FMLCommonHandler.instance().firePlayerItemPickupEvent(par1EntityPlayer, this); this.worldObj.playSoundAtEntity(par1EntityPlayer, "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); itemstack.stackSize = 0; int ring = par1EntityPlayer.getEntityData().getInteger("ring"); par1EntityPlayer.getEntityData().setInteger("ring",ring+itemstack.stackSize); if (itemstack.stackSize <= 0) { this.setDead(); } } } } public void travelToDimension(int par1) { super.travelToDimension(par1); } /** * Returns the ItemStack corresponding to the Entity (Note: if no item exists, will log an error but still return an * ItemStack containing Block.stone) */ public ItemStack getEntityItem() { ItemStack itemstack = this.getDataWatcher().getWatchableObjectItemStack(10); if (itemstack == null) { if (this.worldObj != null) { logger.error("Item entity " + this.getEntityId() + " has no item?!"); } return new ItemStack(Items.stick); } else { return itemstack; } } /** * Sets the ItemStack for this entity */ public void setEntityItemStack(ItemStack par1ItemStack) { this.getDataWatcher().updateObject(10, par1ItemStack); this.getDataWatcher().setObjectWatched(10); } public String func_145798_i() { return this.field_145802_g; } public void func_145797_a(String p_145797_1_) { this.field_145802_g = p_145797_1_; } public String func_145800_j() { return this.field_145801_f; } public void func_145799_b(String p_145799_1_) { this.field_145801_f = p_145799_1_; } }
Le problème c’est que pour l’agrandir, il faut un render, je l’ai aussi un peu épuré :
@SideOnly(Side.CLIENT) public class RenderItem2 extends Render { private static final ResourceLocation RES_ITEM_GLINT = new ResourceLocation("textures/misc/enchanted_item_glint.png"); /** * The RNG used in RenderItem (for bobbing itemstacks on the ground) */ private Random random = new Random(); public boolean renderWithColor = true; /** * Defines the zLevel of rendering of item on GUI. */ public float zLevel; public static boolean renderInFrame; private static final String __OBFID = "CL_00001003"; public RenderItem2() { this.shadowSize = 0.15F; this.shadowOpaque = 0.75F; } /** * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic * (Render <t extends="" entity)="" and="" this="" method="" has="" signature="" public="" void="" dorender(t="" entity,="" double="" d,="" d1,<br="">* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. */ public void doRender(EntityItem2 par1EntityItem2, double par2, double par4, double par6, float par8, float par9) { ItemStack itemstack = par1EntityItem2.getEntityItem(); if (itemstack.getItem() != null) { System.out.println("Ce code est lu ?"); this.bindEntityTexture(par1EntityItem2); this.random.setSeed(187L); GL11.glPushMatrix(); float f2 = shouldBob() ? MathHelper.sin(((float)par1EntityItem2.age + par9) / 10.0F + par1EntityItem2.hoverStart) * 0.1F + 0.1F : 0F; float f3 = (((float)par1EntityItem2.age + par9) / 20.0F + par1EntityItem2.hoverStart) * (180F / (float)Math.PI); byte b0 = 1; if (par1EntityItem2.getEntityItem().stackSize > 1) { b0 = 2; } b0 = getMiniBlockCount(itemstack, b0); GL11.glTranslatef((float)par2, (float)par4 + f2, (float)par6); GL11.glEnable(GL12.GL_RESCALE_NORMAL); float f7; float f6; int k; if (ForgeHooksClient.renderEntityItem(par1EntityItem2, itemstack, f2, f3, random, renderManager.renderEngine, field_147909_c, b0)) { ; } else // Code Style break here to prevent the patch from editing this line { float f5; if (/*itemstack.getItemSpriteNumber() == 1 &&*/ itemstack.getItem().requiresMultipleRenderPasses()) { if (renderInFrame) { GL11.glScalef(0.5128205F, 0.5128205F, 0.5128205F); GL11.glTranslatef(0.0F, -0.05F, 0.0F); } else { GL11.glScalef(5.5F, 5.5F, 5.5F); } for (int j = 0; j <= itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++j) { this.random.setSeed(187L); IIcon iicon1 = itemstack.getItem().getIcon(itemstack, j); if (this.renderWithColor) { k = itemstack.getItem().getColorFromItemStack(itemstack, j); f5 = (float)(k >> 16 & 255) / 255.0F; f6 = (float)(k >> 8 & 255) / 255.0F; f7 = (float)(k & 255) / 255.0F; GL11.glColor4f(f5, f6, f7, 1.0F); this.renderDroppedItem(par1EntityItem2, iicon1, b0, par9, f5, f6, f7, j); } else { this.renderDroppedItem(par1EntityItem2, iicon1, b0, par9, 1.0F, 1.0F, 1.0F, j); } } } else { if (itemstack != null && itemstack.getItem() instanceof ItemCloth) { GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); } if (renderInFrame) { GL11.glScalef(0.5128205F, 0.5128205F, 0.5128205F); GL11.glTranslatef(0.0F, -0.05F, 0.0F); } else { GL11.glScalef(0.5F, 0.5F, 0.5F); } IIcon iicon = itemstack.getIconIndex(); if (this.renderWithColor) { int i = itemstack.getItem().getColorFromItemStack(itemstack, 0); float f4 = (float)(i >> 16 & 255) / 255.0F; f5 = (float)(i >> 8 & 255) / 255.0F; f6 = (float)(i & 255) / 255.0F; this.renderDroppedItem(par1EntityItem2, iicon, b0, par9, f4, f5, f6); } else { this.renderDroppedItem(par1EntityItem2, iicon, b0, par9, 1.0F, 1.0F, 1.0F); } if (itemstack != null && itemstack.getItem() instanceof ItemCloth) { GL11.glDisable(GL11.GL_BLEND); } } } GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); } } /** * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. */ protected ResourceLocation getEntityTexture(EntityItem2 par1EntityItem2) { return this.renderManager.renderEngine.getResourceLocation(par1EntityItem2.getEntityItem().getItemSpriteNumber()); } /** * Renders a dropped item */ private void renderDroppedItem(EntityItem2 par1EntityItem2, IIcon par2Icon, int par3, float par4, float par5, float par6, float par7) { this.renderDroppedItem(par1EntityItem2, par2Icon, par3, par4, par5, par6, par7, 0); } // JAVADOC METHOD $ renderDroppedItem private void renderDroppedItem(EntityItem2 par1EntityItem2, IIcon par2Icon, int par3, float par4, float par5, float par6, float par7, int pass) { Tessellator tessellator = Tessellator.instance; if (par2Icon == null) { TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager(); ResourceLocation resourcelocation = texturemanager.getResourceLocation(par1EntityItem2.getEntityItem().getItemSpriteNumber()); par2Icon = ((TextureMap)texturemanager.getTexture(resourcelocation)).getAtlasSprite("missingno"); } float f14 = ((IIcon)par2Icon).getMinU(); float f15 = ((IIcon)par2Icon).getMaxU(); float f4 = ((IIcon)par2Icon).getMinV(); float f5 = ((IIcon)par2Icon).getMaxV(); float f6 = 1.0F; float f7 = 0.5F; float f8 = 0.25F; float f10; if (this.renderManager.options.fancyGraphics) { GL11.glPushMatrix(); if (renderInFrame) { GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); } else { GL11.glRotatef((((float)par1EntityItem2.age + par4) / 20.0F + par1EntityItem2.hoverStart) * (180F / (float)Math.PI), 0.0F, 1.0F, 0.0F); } float f9 = 0.0625F; f10 = 0.021875F; ItemStack itemstack = par1EntityItem2.getEntityItem(); int j = itemstack.stackSize; byte b0; if (j < 2) { b0 = 1; } else if (j < 16) { b0 = 2; } else if (j < 32) { b0 = 3; } else { b0 = 4; } b0 = getMiniItemCount(itemstack, b0); GL11.glTranslatef(-f7, -f8, -((f9 + f10) * (float)b0 / 2.0F)); for (int k = 0; k < b0; ++k) { // Makes items offset when in 3D, like when in 2D, looks much better. Considered a vanilla bug... if (k > 0 && shouldSpreadItems()) { float x = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F; float y = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F; float z = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F; GL11.glTranslatef(x, y, f9 + f10); } else { GL11.glTranslatef(0f, 0f, f9 + f10); } if (itemstack.getItemSpriteNumber() == 0) { this.bindTexture(TextureMap.locationBlocksTexture); } else { this.bindTexture(TextureMap.locationItemsTexture); } GL11.glColor4f(par5, par6, par7, 1.0F); ItemRenderer.renderItemIn2D(tessellator, f15, f4, f14, f5, ((IIcon)par2Icon).getIconWidth(), ((IIcon)par2Icon).getIconHeight(), f9); if (itemstack.hasEffect(pass)) { GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDisable(GL11.GL_LIGHTING); this.renderManager.renderEngine.bindTexture(RES_ITEM_GLINT); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); float f11 = 0.76F; GL11.glColor4f(0.5F * f11, 0.25F * f11, 0.8F * f11, 1.0F); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glPushMatrix(); float f12 = 0.125F; GL11.glScalef(f12, f12, f12); float f13 = (float)(Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F; GL11.glTranslatef(f13, 0.0F, 0.0F); GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F); ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, f9); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glScalef(f12, f12, f12); f13 = (float)(Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F; GL11.glTranslatef(-f13, 0.0F, 0.0F); GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F); ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, f9); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthFunc(GL11.GL_LEQUAL); } } GL11.glPopMatrix(); } else { for (int l = 0; l < par3; ++l) { GL11.glPushMatrix(); if (l > 0) { f10 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.3F; float f17 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.3F; float f16 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.3F; GL11.glTranslatef(f10, f17, f16); } if (!renderInFrame) { GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); } GL11.glColor4f(par5, par6, par7, 1.0F); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 1.0F, 0.0F); tessellator.addVertexWithUV((double)(0.0F - f7), (double)(0.0F - f8), 0.0D, (double)f14, (double)f5); tessellator.addVertexWithUV((double)(f6 - f7), (double)(0.0F - f8), 0.0D, (double)f15, (double)f5); tessellator.addVertexWithUV((double)(f6 - f7), (double)(1.0F - f8), 0.0D, (double)f15, (double)f4); tessellator.addVertexWithUV((double)(0.0F - f7), (double)(1.0F - f8), 0.0D, (double)f14, (double)f4); tessellator.draw(); GL11.glPopMatrix(); } } } /** * Render the item's icon or block into the GUI, including the glint effect. */ public void renderEffect(TextureManager manager, int x, int y) { GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDepthMask(false); manager.bindTexture(RES_ITEM_GLINT); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glColor4f(0.5F, 0.25F, 0.8F, 1.0F); this.renderGlint(x * 431278612 + y * 32178161, x - 2, y - 2, 20, 20); GL11.glDepthMask(true); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthFunc(GL11.GL_LEQUAL); } private void renderGlint(int par1, int par2, int par3, int par4, int par5) { for (int j1 = 0; j1 < 2; ++j1) { OpenGlHelper.glBlendFunc(772, 1, 0, 0); float f = 0.00390625F; float f1 = 0.00390625F; float f2 = (float)(Minecraft.getSystemTime() % (long)(3000 + j1 * 1873)) / (3000.0F + (float)(j1 * 1873)) * 256.0F; float f3 = 0.0F; Tessellator tessellator = Tessellator.instance; float f4 = 4.0F; if (j1 == 1) { f4 = -1.0F; } tessellator.startDrawingQuads(); tessellator.addVertexWithUV((double)(par2 + 0), (double)(par3 + par5), (double)this.zLevel, (double)((f2 + (float)par5 * f4) * f), (double)((f3 + (float)par5) * f1)); tessellator.addVertexWithUV((double)(par2 + par4), (double)(par3 + par5), (double)this.zLevel, (double)((f2 + (float)par4 + (float)par5 * f4) * f), (double)((f3 + (float)par5) * f1)); tessellator.addVertexWithUV((double)(par2 + par4), (double)(par3 + 0), (double)this.zLevel, (double)((f2 + (float)par4) * f), (double)((f3 + 0.0F) * f1)); tessellator.addVertexWithUV((double)(par2 + 0), (double)(par3 + 0), (double)this.zLevel, (double)((f2 + 0.0F) * f), (double)((f3 + 0.0F) * f1)); tessellator.draw(); } } /** * Adds a quad to the tesselator at the specified position with the set width and height and color. Args: * tessellator, x, y, width, height, color */ private void renderQuad(Tessellator par1Tessellator, int par2, int par3, int par4, int par5, int par6) { par1Tessellator.startDrawingQuads(); par1Tessellator.setColorOpaque_I(par6); par1Tessellator.addVertex((double)(par2 + 0), (double)(par3 + 0), 0.0D); par1Tessellator.addVertex((double)(par2 + 0), (double)(par3 + par5), 0.0D); par1Tessellator.addVertex((double)(par2 + par4), (double)(par3 + par5), 0.0D); par1Tessellator.addVertex((double)(par2 + par4), (double)(par3 + 0), 0.0D); par1Tessellator.draw(); } public void renderIcon(int par1, int par2, IIcon par3Icon, int par4, int par5) { Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.addVertexWithUV((double)(par1 + 0), (double)(par2 + par5), (double)this.zLevel, (double)par3Icon.getMinU(), (double)par3Icon.getMaxV()); tessellator.addVertexWithUV((double)(par1 + par4), (double)(par2 + par5), (double)this.zLevel, (double)par3Icon.getMaxU(), (double)par3Icon.getMaxV()); tessellator.addVertexWithUV((double)(par1 + par4), (double)(par2 + 0), (double)this.zLevel, (double)par3Icon.getMaxU(), (double)par3Icon.getMinV()); tessellator.addVertexWithUV((double)(par1 + 0), (double)(par2 + 0), (double)this.zLevel, (double)par3Icon.getMinU(), (double)par3Icon.getMinV()); tessellator.draw(); } /** * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. */ protected ResourceLocation getEntityTexture(Entity par1Entity) { return this.getEntityTexture((EntityItem2)par1Entity); } /** * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic * (Render <t extends="" entity)="" and="" this="" method="" has="" signature="" public="" void="" dorender(t="" entity,="" double="" d,="" d1,<br="">* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. */ public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) { this.doRender((EntityItem2)par1Entity, par2, par4, par6, par8, par9); } /*==================================== FORGE START ===========================================*/ /** * Items should spread out when rendered in 3d? * @return */ public boolean shouldSpreadItems() { return true; } /** * Items should have a bob effect * @return */ public boolean shouldBob() { return true; } public byte getMiniBlockCount(ItemStack stack, byte original) { return original; } /** * Allows for a subclass to override how many rendered items appear in a * "mini item 3d stack" * @param stack The item stack * @param original The default amount vanilla would use * @return */ public byte getMiniItemCount(ItemStack stack, byte original) { return original; } /*==================================== FORGE END =============================================*/ }
En ayant mis dans mon ClientProxy
RenderingRegistry.registerEntityRenderingHandler(EntityItem2.class, new RenderItem2());
Pourtant le render n’est pas lu, savez pourquoi ?</t></t>
-
ça n’ira pas comme ça car quand tu drop un item ça spawnera une EntityItem normal.
Depuis le IItemRenderer tu peux changer le rendu de le l’entity item, il faut que tu passe par ça. -
J’avais fait un autre système qui faisait spawn les items
Je vais me renseigner pour IItemRenderer si c’est plus simple, sachant que je n’utilise pas de model spécial, lequel dois-je mettre ? -
Normalement tu as juste a appliquer ça : http://www.minecraftforgefrance.fr/showthread.php?tid=556&pid=6186#pid6186
Mais sur ENTITY à la place de EQUIPPED -
case Entity; :3
ça marche en effet mais l’item ne tourne plus ^^’
ça m’étonnerais que ce soit “GL11.glRotatef” -
@Override public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { if(helper == ItemRendererHelper.ENTITY_ROTATION) { return true; } return false; }
Comme ça ?
-
Ouais merci
Je cherche vraiment les petits problème mais mon item ne tourne pas sur lui même >.<’ -
Même avec le code que j’ai donné juste au dessus ?
-
Enfin il tourne mais pas sur lui même il est en quelque sorte en “orbite”
-
Ah, dans ce cas je ne sais pas. Faudrait que je fasse des tests mais je ne n’ai pas le temps actuellement.
-
Ce n’est pas grave ^^
Merci
Edit Mise à jour du sujet
-
Ajout de deux problèmes :s
-
Pour les barres de faim et de vie, utilise l’event RenderGameOverlayEvent.Pre
if event.type == ElementType.élément voulu)
{
event.setCancel(true);
}
(voir tutoriel sur les événements). -
Merci ^^
Je l’avais essayé en utilisant le RenderGameOverlayEvent.Post (je n’avais pas fait attention à l’évent utilisé, je l’avais juste mis dans la fonction permettant d’afficher mon texte) >.<’