Problèmes de Rendu
-
Bonjour/Bonsoir, j’ai créé une boule de glace et un feu glacé, mais leur rendu est buggé (la boule de glace est noire et carrée et le feu glacé a celui du feu (ne trouve pas comment en faire un personnalisé (getRenderType))).
Screens :
:::
:::
Code :
RenderFreezeball.java :
package fr.MrBlockTNT.Dragons.render; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.Render; import net.minecraft.entity.Entity; import net.minecraft.util.IIcon; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import fr.MrBlockTNT.Dragons.core.Dragons; import fr.MrBlockTNT.Dragons.entity.projectile.EntityFreezeball; @SideOnly(Side.CLIENT) public class RenderFreezeball extends Render { private float field_77002_a; private static ResourceLocation texture = new ResourceLocation("dragons:freezeball.png"); public RenderFreezeball(float par1) { this.field_77002_a = par1; } public void doRender(EntityFreezeball par1EntityFreezeball, double par2, double par4, double par6, float par8, float par9) { GL11.glPushMatrix(); //this.bindEntityTexture(par1EntityFreezeball); GL11.glTranslatef((float)par2, (float)par4, (float)par6); GL11.glEnable(GL12.GL_RESCALE_NORMAL); float f2 = this.field_77002_a; GL11.glScalef(f2 / 1.0F, f2 / 1.0F, f2 / 1.0F); IIcon iicon = Dragons.freezeball.getIconFromDamage(0); Tessellator tessellator = Tessellator.instance; float f3 = iicon.getMinU(); float f4 = iicon.getMaxU(); float f5 = iicon.getMinV(); float f6 = iicon.getMaxV(); float f7 = 1.0F; float f8 = 0.5F; float f9 = 0.25F; GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 1.0F, 0.0F); tessellator.addVertexWithUV((double)(0.0F - f8), (double)(0.0F - f9), 0.0D, (double)f3, (double)f6); tessellator.addVertexWithUV((double)(f7 - f8), (double)(0.0F - f9), 0.0D, (double)f4, (double)f6); tessellator.addVertexWithUV((double)(f7 - f8), (double)(1.0F - f9), 0.0D, (double)f4, (double)f5); tessellator.addVertexWithUV((double)(0.0F - f8), (double)(1.0F - f9), 0.0D, (double)f3, (double)f5); tessellator.draw(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); } protected ResourceLocation getEntityTexture(EntityFreezeball par1EntityFreezeball) { return texture; } protected ResourceLocation getEntityTexture(Entity par1Entity) { return this.getEntityTexture((EntityFreezeball)par1Entity); } public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) { this.doRender((EntityFreezeball)par1Entity, par2, par4, par6, par8, par9); } }
BlockFrozenFire.java (le rendu actuel est celui du feu normal, je ne vois pas comment créer le mien)
package fr.MrBlockTNT.Dragons.block; import static net.minecraftforge.common.util.ForgeDirection.DOWN; import static net.minecraftforge.common.util.ForgeDirection.EAST; import static net.minecraftforge.common.util.ForgeDirection.NORTH; import static net.minecraftforge.common.util.ForgeDirection.SOUTH; import static net.minecraftforge.common.util.ForgeDirection.UP; import static net.minecraftforge.common.util.ForgeDirection.WEST; import java.util.IdentityHashMap; import java.util.Map.Entry; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.material.MapColor; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.init.Blocks; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import com.google.common.collect.Maps; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import fr.MrBlockTNT.Dragons.core.Dragons; public class BlockFrozenFire extends Block { @Deprecated private int[] field_149849_a = new int[4096]; @Deprecated private int[] field_149848_b = new int[4096]; @SideOnly(Side.CLIENT) private IIcon[] field_149850_M; public BlockFrozenFire() { super(Material.fire); this.setTickRandomly(true); } public static void func_149843_e() { ((BlockFrozenFire) Dragons.frozenFire).func_149842_a(getIdFromBlock(Blocks.planks), 5, 20); ((BlockFrozenFire) Dragons.frozenFire).func_149842_a(getIdFromBlock(Blocks.double_wooden_slab), 5, 20); ((BlockFrozenFire) Dragons.frozenFire).func_149842_a(getIdFromBlock(Blocks.wooden_slab), 5, 20); ((BlockFrozenFire) Dragons.frozenFire).func_149842_a(getIdFromBlock(Blocks.fence), 5, 20); ((BlockFrozenFire) Dragons.frozenFire).func_149842_a(getIdFromBlock(Blocks.oak_stairs), 5, 20); ((BlockFrozenFire) Dragons.frozenFire).func_149842_a(getIdFromBlock(Blocks.birch_stairs), 5, 20); ((BlockFrozenFire) Dragons.frozenFire).func_149842_a(getIdFromBlock(Blocks.spruce_stairs), 5, 20); ((BlockFrozenFire) Dragons.frozenFire).func_149842_a(getIdFromBlock(Blocks.jungle_stairs), 5, 20); ((BlockFrozenFire) Dragons.frozenFire).func_149842_a(getIdFromBlock(Blocks.log), 5, 5); ((BlockFrozenFire) Dragons.frozenFire).func_149842_a(getIdFromBlock(Blocks.log2), 5, 5); ((BlockFrozenFire) Dragons.frozenFire).func_149842_a(getIdFromBlock(Blocks.leaves), 30, 60); ((BlockFrozenFire) Dragons.frozenFire).func_149842_a(getIdFromBlock(Blocks.leaves2), 30, 60); ((BlockFrozenFire) Dragons.frozenFire).func_149842_a(getIdFromBlock(Blocks.bookshelf), 30, 20); ((BlockFrozenFire) Dragons.frozenFire).func_149842_a(getIdFromBlock(Blocks.tnt), 15, 100); ((BlockFrozenFire) Dragons.frozenFire).func_149842_a(getIdFromBlock(Blocks.tallgrass), 60, 100); ((BlockFrozenFire) Dragons.frozenFire).func_149842_a(getIdFromBlock(Blocks.double_plant), 60, 100); ((BlockFrozenFire) Dragons.frozenFire).func_149842_a(getIdFromBlock(Blocks.yellow_flower), 60, 100); ((BlockFrozenFire) Dragons.frozenFire).func_149842_a(getIdFromBlock(Blocks.red_flower), 60, 100); ((BlockFrozenFire) Dragons.frozenFire).func_149842_a(getIdFromBlock(Blocks.wool), 30, 60); ((BlockFrozenFire) Dragons.frozenFire).func_149842_a(getIdFromBlock(Blocks.vine), 15, 100); ((BlockFrozenFire) Dragons.frozenFire).func_149842_a(getIdFromBlock(Blocks.coal_block), 5, 5); ((BlockFrozenFire) Dragons.frozenFire).func_149842_a(getIdFromBlock(Blocks.hay_block), 60, 20); ((BlockFrozenFire) Dragons.frozenFire).func_149842_a(getIdFromBlock(Blocks.carpet), 60, 20); } @Deprecated public void func_149842_a(int p_149842_1_, int p_149842_2_, int p_149842_3_) { this.setFireInfo((Block)Block.blockRegistry.getObjectById(p_149842_1_), p_149842_2_, p_149842_3_); } public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) { return null; } public boolean isOpaqueCube() { return false; } public boolean renderAsNormalBlock() { return false; } public int getRenderType() { return 3; } public int quantityDropped(Random p_149745_1_) { return 0; } public int tickRate(World p_149738_1_) { return 30; } public void updateTick(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_) { if (p_149674_1_.getGameRules().getGameRuleBooleanValue("doFireTick")) { boolean flag = p_149674_1_.getBlock(p_149674_2_, p_149674_3_ - 1, p_149674_4_).isFireSource(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_, UP); if (!this.canPlaceBlockAt(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_)) { p_149674_1_.setBlockToAir(p_149674_2_, p_149674_3_, p_149674_4_); } if (!flag && p_149674_1_.isRaining() && (p_149674_1_.canLightningStrikeAt(p_149674_2_, p_149674_3_, p_149674_4_) || p_149674_1_.canLightningStrikeAt(p_149674_2_ - 1, p_149674_3_, p_149674_4_) || p_149674_1_.canLightningStrikeAt(p_149674_2_ + 1, p_149674_3_, p_149674_4_) || p_149674_1_.canLightningStrikeAt(p_149674_2_, p_149674_3_, p_149674_4_ - 1) || p_149674_1_.canLightningStrikeAt(p_149674_2_, p_149674_3_, p_149674_4_ + 1))) { p_149674_1_.setBlockToAir(p_149674_2_, p_149674_3_, p_149674_4_); } else { int l = p_149674_1_.getBlockMetadata(p_149674_2_, p_149674_3_, p_149674_4_); if (l < 15) { p_149674_1_.setBlockMetadataWithNotify(p_149674_2_, p_149674_3_, p_149674_4_, l + p_149674_5_.nextInt(3) / 2, 4); } p_149674_1_.scheduleBlockUpdate(p_149674_2_, p_149674_3_, p_149674_4_, this, this.tickRate(p_149674_1_) + p_149674_5_.nextInt(10)); if (!flag && !this.canNeighborBurn(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_)) { if (!World.doesBlockHaveSolidTopSurface(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_) || l > 3) { p_149674_1_.setBlockToAir(p_149674_2_, p_149674_3_, p_149674_4_); } } else if (!flag && !this.canCatchFire(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_, UP) && l == 15 && p_149674_5_.nextInt(4) == 0) { p_149674_1_.setBlockToAir(p_149674_2_, p_149674_3_, p_149674_4_); } else { boolean flag1 = p_149674_1_.isBlockHighHumidity(p_149674_2_, p_149674_3_, p_149674_4_); byte b0 = 0; if (flag1) { b0 = -50; } this.tryCatchFire(p_149674_1_, p_149674_2_ + 1, p_149674_3_, p_149674_4_, 300 + b0, p_149674_5_, l, WEST ); this.tryCatchFire(p_149674_1_, p_149674_2_ - 1, p_149674_3_, p_149674_4_, 300 + b0, p_149674_5_, l, EAST ); this.tryCatchFire(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_, 250 + b0, p_149674_5_, l, UP ); this.tryCatchFire(p_149674_1_, p_149674_2_, p_149674_3_ + 1, p_149674_4_, 250 + b0, p_149674_5_, l, DOWN ); this.tryCatchFire(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_ - 1, 300 + b0, p_149674_5_, l, SOUTH); this.tryCatchFire(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_ + 1, 300 + b0, p_149674_5_, l, NORTH); for (int i1 = p_149674_2_ - 1; i1 <= p_149674_2_ + 1; ++i1) { for (int j1 = p_149674_4_ - 1; j1 <= p_149674_4_ + 1; ++j1) { for (int k1 = p_149674_3_ - 1; k1 <= p_149674_3_ + 4; ++k1) { if (i1 != p_149674_2_ || k1 != p_149674_3_ || j1 != p_149674_4_) { int l1 = 100; if (k1 > p_149674_3_ + 1) { l1 += (k1 - (p_149674_3_ + 1)) * 100; } int i2 = this.getChanceOfNeighborsEncouragingFire(p_149674_1_, i1, k1, j1); if (i2 > 0) { int j2 = (i2 + 40 + p_149674_1_.difficultySetting.getDifficultyId() * 7) / (l + 30); if (flag1) { j2 /= 2; } if (j2 > 0 && p_149674_5_.nextInt(l1) <= j2 && (!p_149674_1_.isRaining() || !p_149674_1_.canLightningStrikeAt(i1, k1, j1)) && !p_149674_1_.canLightningStrikeAt(i1 - 1, k1, p_149674_4_) && !p_149674_1_.canLightningStrikeAt(i1 + 1, k1, j1) && !p_149674_1_.canLightningStrikeAt(i1, k1, j1 - 1) && !p_149674_1_.canLightningStrikeAt(i1, k1, j1 + 1)) { int k2 = l + p_149674_5_.nextInt(5) / 4; if (k2 > 15) { k2 = 15; } p_149674_1_.setBlock(i1, k1, j1, this, k2, 3); } } } } } } } } } } public boolean func_149698_L() { return false; } @Deprecated private void tryCatchFire(World p_149841_1_, int p_149841_2_, int p_149841_3_, int p_149841_4_, int p_149841_5_, Random p_149841_6_, int p_149841_7_) { this.tryCatchFire(p_149841_1_, p_149841_2_, p_149841_3_, p_149841_4_, p_149841_5_, p_149841_6_, p_149841_7_, UP); } private void tryCatchFire(World p_149841_1_, int p_149841_2_, int p_149841_3_, int p_149841_4_, int p_149841_5_, Random p_149841_6_, int p_149841_7_, ForgeDirection face) { int j1 = p_149841_1_.getBlock(p_149841_2_, p_149841_3_, p_149841_4_).getFlammability(p_149841_1_, p_149841_2_, p_149841_3_, p_149841_4_, face); if (p_149841_6_.nextInt(p_149841_5_) < j1) { boolean flag = p_149841_1_.getBlock(p_149841_2_, p_149841_3_, p_149841_4_) == Blocks.tnt; if (p_149841_6_.nextInt(p_149841_7_ + 10) < 5 && !p_149841_1_.canLightningStrikeAt(p_149841_2_, p_149841_3_, p_149841_4_)) { int k1 = p_149841_7_ + p_149841_6_.nextInt(5) / 4; if (k1 > 15) { k1 = 15; } p_149841_1_.setBlock(p_149841_2_, p_149841_3_, p_149841_4_, this, k1, 3); } else { p_149841_1_.setBlockToAir(p_149841_2_, p_149841_3_, p_149841_4_); } if (flag) { Blocks.tnt.onBlockDestroyedByPlayer(p_149841_1_, p_149841_2_, p_149841_3_, p_149841_4_, 1); } } } private boolean canNeighborBurn(World p_149847_1_, int p_149847_2_, int p_149847_3_, int p_149847_4_) { return this.canCatchFire(p_149847_1_, p_149847_2_ + 1, p_149847_3_, p_149847_4_, WEST ) || this.canCatchFire(p_149847_1_, p_149847_2_ - 1, p_149847_3_, p_149847_4_, EAST ) || this.canCatchFire(p_149847_1_, p_149847_2_, p_149847_3_ - 1, p_149847_4_, UP ) || this.canCatchFire(p_149847_1_, p_149847_2_, p_149847_3_ + 1, p_149847_4_, DOWN ) || this.canCatchFire(p_149847_1_, p_149847_2_, p_149847_3_, p_149847_4_ - 1, SOUTH) || this.canCatchFire(p_149847_1_, p_149847_2_, p_149847_3_, p_149847_4_ + 1, NORTH); } private int getChanceOfNeighborsEncouragingFire(World p_149845_1_, int p_149845_2_, int p_149845_3_, int p_149845_4_) { byte b0 = 0; if (!p_149845_1_.isAirBlock(p_149845_2_, p_149845_3_, p_149845_4_)) { return 0; } else { int l = b0; l = this.getChanceToEncourageFire(p_149845_1_, p_149845_2_ + 1, p_149845_3_, p_149845_4_, l, WEST ); l = this.getChanceToEncourageFire(p_149845_1_, p_149845_2_ - 1, p_149845_3_, p_149845_4_, l, EAST ); l = this.getChanceToEncourageFire(p_149845_1_, p_149845_2_, p_149845_3_ - 1, p_149845_4_, l, UP ); l = this.getChanceToEncourageFire(p_149845_1_, p_149845_2_, p_149845_3_ + 1, p_149845_4_, l, DOWN ); l = this.getChanceToEncourageFire(p_149845_1_, p_149845_2_, p_149845_3_, p_149845_4_ - 1, l, SOUTH); l = this.getChanceToEncourageFire(p_149845_1_, p_149845_2_, p_149845_3_, p_149845_4_ + 1, l, NORTH); return l; } } public boolean isCollidable() { return false; } @Deprecated public boolean canBlockCatchFire(IBlockAccess p_149844_1_, int p_149844_2_, int p_149844_3_, int p_149844_4_) { return canCatchFire(p_149844_1_, p_149844_2_, p_149844_3_, p_149844_4_, UP); } @Deprecated public int func_149846_a(World p_149846_1_, int p_149846_2_, int p_149846_3_, int p_149846_4_, int p_149846_5_) { return getChanceToEncourageFire(p_149846_1_, p_149846_2_, p_149846_3_, p_149846_4_, p_149846_5_, UP); } public boolean canPlaceBlockAt(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) { return World.doesBlockHaveSolidTopSurface(p_149742_1_, p_149742_2_, p_149742_3_ - 1, p_149742_4_) || this.canNeighborBurn(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_); } public void onNeighborBlockChange(World p_149695_1_, int p_149695_2_, int p_149695_3_, int p_149695_4_, Block p_149695_5_) { if (!World.doesBlockHaveSolidTopSurface(p_149695_1_, p_149695_2_, p_149695_3_ - 1, p_149695_4_) && !this.canNeighborBurn(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_)) { p_149695_1_.setBlockToAir(p_149695_2_, p_149695_3_, p_149695_4_); } } public void onBlockAdded(World p_149726_1_, int p_149726_2_, int p_149726_3_, int p_149726_4_) { if (p_149726_1_.provider.dimensionId > 0 || !Blocks.portal.func_150000_e(p_149726_1_, p_149726_2_, p_149726_3_, p_149726_4_)) { if (!World.doesBlockHaveSolidTopSurface(p_149726_1_, p_149726_2_, p_149726_3_ - 1, p_149726_4_) && !this.canNeighborBurn(p_149726_1_, p_149726_2_, p_149726_3_, p_149726_4_)) { p_149726_1_.setBlockToAir(p_149726_2_, p_149726_3_, p_149726_4_); } else { p_149726_1_.scheduleBlockUpdate(p_149726_2_, p_149726_3_, p_149726_4_, this, this.tickRate(p_149726_1_) + p_149726_1_.rand.nextInt(10)); } } } @SideOnly(Side.CLIENT) public void randomDisplayTick(World p_149734_1_, int p_149734_2_, int p_149734_3_, int p_149734_4_, Random p_149734_5_) { if (p_149734_5_.nextInt(24) == 0) { p_149734_1_.playSound((double)((float)p_149734_2_ + 0.5F), (double)((float)p_149734_3_ + 0.5F), (double)((float)p_149734_4_ + 0.5F), "fire.fire", 1.0F + p_149734_5_.nextFloat(), p_149734_5_.nextFloat() * 0.7F + 0.3F, false); } int l; float f; float f1; float f2; if (!World.doesBlockHaveSolidTopSurface(p_149734_1_, p_149734_2_, p_149734_3_ - 1, p_149734_4_) && !((BlockFrozenFire) Dragons.frozenFire).canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_ - 1, p_149734_4_, UP)) { if (!((BlockFrozenFire) Dragons.frozenFire).canCatchFire(p_149734_1_, p_149734_2_ - 1, p_149734_3_, p_149734_4_, EAST)) { for (l = 0; l < 2; ++l) { f = (float)p_149734_2_ + p_149734_5_.nextFloat() * 0.1F; f1 = (float)p_149734_3_ + p_149734_5_.nextFloat(); f2 = (float)p_149734_4_ + p_149734_5_.nextFloat(); p_149734_1_.spawnParticle("largesmoke", (double)f, (double)f1, (double)f2, 0.0D, 0.0D, 0.0D); } } if (((BlockFrozenFire) Dragons.frozenFire).canCatchFire(p_149734_1_, p_149734_2_ + 1, p_149734_3_, p_149734_4_, WEST)) { for (l = 0; l < 2; ++l) { f = (float)(p_149734_2_ + 1) - p_149734_5_.nextFloat() * 0.1F; f1 = (float)p_149734_3_ + p_149734_5_.nextFloat(); f2 = (float)p_149734_4_ + p_149734_5_.nextFloat(); p_149734_1_.spawnParticle("largesmoke", (double)f, (double)f1, (double)f2, 0.0D, 0.0D, 0.0D); } } if (((BlockFrozenFire) Dragons.frozenFire).canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_, p_149734_4_ - 1, SOUTH)) { for (l = 0; l < 2; ++l) { f = (float)p_149734_2_ + p_149734_5_.nextFloat(); f1 = (float)p_149734_3_ + p_149734_5_.nextFloat(); f2 = (float)p_149734_4_ + p_149734_5_.nextFloat() * 0.1F; p_149734_1_.spawnParticle("largesmoke", (double)f, (double)f1, (double)f2, 0.0D, 0.0D, 0.0D); } } if (((BlockFrozenFire) Dragons.frozenFire).canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_, p_149734_4_ + 1, NORTH)) { for (l = 0; l < 2; ++l) { f = (float)p_149734_2_ + p_149734_5_.nextFloat(); f1 = (float)p_149734_3_ + p_149734_5_.nextFloat(); f2 = (float)(p_149734_4_ + 1) - p_149734_5_.nextFloat() * 0.1F; p_149734_1_.spawnParticle("largesmoke", (double)f, (double)f1, (double)f2, 0.0D, 0.0D, 0.0D); } } if (((BlockFrozenFire) Dragons.frozenFire).canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_ + 1, p_149734_4_, DOWN)) { for (l = 0; l < 2; ++l) { f = (float)p_149734_2_ + p_149734_5_.nextFloat(); f1 = (float)(p_149734_3_ + 1) - p_149734_5_.nextFloat() * 0.1F; f2 = (float)p_149734_4_ + p_149734_5_.nextFloat(); p_149734_1_.spawnParticle("largesmoke", (double)f, (double)f1, (double)f2, 0.0D, 0.0D, 0.0D); } } } else { for (l = 0; l < 3; ++l) { f = (float)p_149734_2_ + p_149734_5_.nextFloat(); f1 = (float)p_149734_3_ + p_149734_5_.nextFloat() * 0.5F + 0.5F; f2 = (float)p_149734_4_ + p_149734_5_.nextFloat(); p_149734_1_.spawnParticle("largesmoke", (double)f, (double)f1, (double)f2, 0.0D, 0.0D, 0.0D); } } } @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister p_149651_1_) { this.field_149850_M = new IIcon[] {p_149651_1_.registerIcon("dragons:freeze_fire_layer_0"), p_149651_1_.registerIcon("dragons:freeze_fire_layer_1")}; } @SideOnly(Side.CLIENT) public IIcon getFireIcon(int p_149840_1_) { return this.field_149850_M[p_149840_1_]; } @SideOnly(Side.CLIENT) public IIcon getIcon(int p_149691_1_, int p_149691_2_) { return this.field_149850_M[0]; } public MapColor getMapColor(int p_149728_1_) { return MapColor.tntColor; } private static class FireInfo { private int encouragement = 0; private int flammibility = 0; } private IdentityHashMap <block, fireinfo="">blockInfo = Maps.newIdentityHashMap(); public void setFireInfo(Block block, int encouragement, int flammibility) { if (block == Blocks.air) throw new IllegalArgumentException("Tried to set air on fire… This is bad."); int id = Block.getIdFromBlock(block); this.field_149849_a[id] = encouragement; this.field_149848_b[id] = flammibility; FireInfo info = getInfo(block, true); info.encouragement = encouragement; info.flammibility = flammibility; } private FireInfo getInfo(Block block, boolean garentee) { FireInfo ret = blockInfo.get(block); if (ret == null && garentee) { ret = new FireInfo(); blockInfo.put(block, ret); } return ret; } public void rebuildFireInfo() { for (int x = 0; x < 4096; x++) { field_149849_a[x] = 0; field_149848_b[x] = 0; } for (Entry <block, fireinfo="">e : blockInfo.entrySet()) { int id = Block.getIdFromBlock(e.getKey()); if (id >= 0 && id < 4096) { field_149849_a[id] = e.getValue().encouragement; field_149848_b[id] = e.getValue().flammibility; } } } public int getFlammability(Block block) { int id = Block.getIdFromBlock(block); return id >= 0 && id < 4096 ? field_149848_b[id] : 0; } public int getEncouragement(Block block) { int id = Block.getIdFromBlock(block); return id >= 0 && id < 4096 ? field_149849_a[id] : 0; } public boolean canCatchFire(IBlockAccess world, int x, int y, int z, ForgeDirection face) { return world.getBlock(x, y, z).isFlammable(world, x, y, z, face); } public int getChanceToEncourageFire(IBlockAccess world, int x, int y, int z, int oldChance, ForgeDirection face) { int newChance = world.getBlock(x, y, z).getFireSpreadSpeed(world, x, y, z, face); return (newChance > oldChance ? newChance : oldChance); } }
Un peu d’aide ?</block,></block,>
-
UP, un peu d’aide Svp.
-
Client proxy ?
Enregistrement des entités dans la classe principale ? -
ClientProxy (Boules de froid) :
RenderingRegistry.registerEntityRenderingHandler(EntityLargeFreezeball.class, new RenderFreezeball(2.0F)); RenderingRegistry.registerEntityRenderingHandler(EntitySmallFreezeball.class, new RenderFreezeball(0.5F));
Dragons.java (dans init) :
EntityRegistry.registerModEntity(EntitySmallFreezeball.class, "Small Freezeball", 260, this.instance, 80, 1, true); LanguageRegistry.instance().addStringLocalization("entity.Small Freezeball.name", "Freezeball"); EntityRegistry.registerModEntity(EntityLargeFreezeball.class, "Large Freezeball", 261, this.instance, 80, 1, true); LanguageRegistry.instance().addStringLocalization("entity.Large Freezeball.name", "Freezeball");
-
La fonction où tu enregistrer les rendus est bien appelé ?
-
Ouaip c’est la même que pour les Dragons et leur rendu marche.
-
Aucune idée dans ce cas.
-
Ah, si même toi n’as pas d’idée alors là……
Sinon, (hors sujet) quelqu’un ne connaîtrai pas le moyen de récupérer l’état ‘haut’ (pas double) d’une dalle ?
-
Metadata + 8 normalement.
-
D’accord, merci je teste.
EDIT : ça marche, un grand merci
-
UP, help svp
-
Up, encore et toujours ….
-
Up, quelqu’un aurait une idée ?
-
Comme je suis passé sur le tuto du rendu ISBRH (1.6.4) et j’ai donc compris comment créer mon propre “renderType”. Ceci devrait résoudre le problème du feu (je ne testerai sûrement que dans quelques jours)