Résolu Perdu avec les paquets et NBT tags
-
Salut,
J’essaye de faire un panneau avec un GUI pour configurer le signe visible dessus (avec une variable dans le tile), et je n’arrive plus à enregistrer les modifications dans le tileEntity.
À un moment ça a marché à moitié, quand ma variable valait entre 0 et 2 ça sauvegardait bien, par contre à 3 ça mettait 2 et à 4 ça mettait 0, incompréhensible comme problème pour moi. Et là ça ne sauvegarde plus, ça revient à 0 quand je relance le monde. J’ai du changer quelque chose mais je ne vois pas quoi.
Le GUI marche, la variable change bien quand je clique sur mes boutons. C’est un GUI sans inventory vu que le joueur n’a pas besoin d’utiliser de blocks ou items dedans.Voilà les classes concernées par le tileEntity, le GUI et le paquet:
(note: le code n’est pas encore complet pour l’affichage du panneau en fonction des variables, j’essaye de régler ce problème avant):::
package net.killermapper.roadstuff.common.blocks.sign;
import java.util.List;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.killermapper.roadstuff.common.RoadStuff;
import net.killermapper.roadstuff.common.tiles.TileEntityBlockTrafficSign;
import net.killermapper.roadstuff.proxy.ClientProxy;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;public class BlockTrafficSign extends Block
{
public static String[] subBlock = new String[] {“signpost”, “signround”, “signtriangle”, “signsquare”, “signdiamond”, “signrectangle”};
private IIcon signPost, signBase, signRSpeed50;public BlockTrafficSign()
{
super(Material.iron);
this.setCreativeTab(RoadStuff.RoadStuffCreativeTabs);
}public int damageDropped(int metadata)
{
return metadata;
}@SideOnly(Side.CLIENT)
public int getRenderType()
{
return ClientProxy.renderSignPostId;
}public void getSubBlocks(Item item, CreativeTabs tabs, List list)
{
for(int i = 0; i < subBlock.length; i++)
{
list.add(new ItemStack(item, 1, i));
}
}public void registerBlockIcons(IIconRegister iconRegister)
{
this.signBase = iconRegister.registerIcon(RoadStuff.MODID + “:sign/signBase”);
this.signRSpeed50 = iconRegister.registerIcon(RoadStuff.MODID + “:sign/signRSpeed50”);
this.signPost = iconRegister.registerIcon(RoadStuff.MODID + “:sign/signPost”);
}public IIcon getIcon(int side, int metadata)
{
if(side == 3)
{
if(metadata == 2)
{
return this.signBase;
}
if(metadata == 1)
{
return this.signRSpeed50;
}
}
return this.signPost;
}public boolean renderAsNormalBlock()
{
return false;
}public boolean isOpaqueCube()
{
return false;
}public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z)
{
this.minX = 0.3F;
this.minY = 0.0F;
this.minZ = 0.5F;
this.maxX = 0.7F;
this.maxY = 1F;
this.maxZ = 0.65F;if(world.getBlockMetadata(x, y, z) >= 1)
{
this.minX = 0.0F;
this.minZ = 0.5F;
this.maxX = 1F;
this.maxZ = 0.65F;
}
}@Override
public TileEntity createTileEntity(World world, int metadata)
{
return new TileEntityBlockTrafficSign();
}@Override
public boolean hasTileEntity(int metadata)
{
return true;
}public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase living, ItemStack stack)
{
TileEntity tile = world.getTileEntity(x, y, z);
if(tile instanceof TileEntityBlockTrafficSign)
{
int direction = MathHelper.floor_double((double)(living.rotationYaw * 4.0F / 360.0F) + 2.5D) & 3;
((TileEntityBlockTrafficSign)tile).setDirection((byte)direction);
}}
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
{
System.out.println(((TileEntityBlockTrafficSign)world.getTileEntity(x, y, z)).getSignType() + ", client is " + world.isRemote);
if(!world.isRemote)
{
TileEntity tile = world.getTileEntity(x, y, z);
if(tile instanceof TileEntityBlockTrafficSign)
{
TileEntityBlockTrafficSign tileEntity = (TileEntityBlockTrafficSign)tile;
player.addChatMessage(new ChatComponentTranslation(“tile.signdirection.number”, tileEntity.getDirection()));
player.addChatMessage(new ChatComponentTranslation(“tile.signtype.number”, tileEntity.getSignType()));
}
return true;
}
else
{
if(world.getBlockMetadata(x, y, z) != 0)
player.openGui(RoadStuff.instance, 0, world, x, y, z);
return true;
}
}}
:::
:::
package net.killermapper.roadstuff.common.tiles;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;public class TileEntityBlockTrafficSign extends TileEntity
{
private byte direction;
private short signType;@Override
public void readFromNBT(NBTTagCompound compound)
{
super.readFromNBT(compound);
this.direction = compound.getByte(“Direction”);
this.signType = compound.getShort(“SignType”);
}@Override
public void writeToNBT(NBTTagCompound compound)
{
super.writeToNBT(compound);
compound.setByte(“Direction”, this.direction);
compound.setShort(“SignType”, this.signType);
}public byte getDirection()
{
return direction;
}public void setDirection(byte direction)
{
this.direction = direction;
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
}public short getSignType()
{
return signType;
}public void setSignType(short signType)
{
this.signType = signType;
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
}public Packet getDescriptionPacket()
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
this.writeToNBT(nbttagcompound);
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbttagcompound);
}public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt)
{
this.readFromNBT(pkt.func_148857_g());
this.worldObj.markBlockRangeForRenderUpdate(this.xCoord, this.yCoord, this.zCoord, this.xCoord, this.yCoord, this.zCoord);
}
}:::
:::
package net.killermapper.roadstuff.client.gui;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;import com.sun.imageio.plugins.common.I18N;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.killermapper.roadstuff.common.PacketSignType;
import net.killermapper.roadstuff.common.RoadStuff;
import net.killermapper.roadstuff.common.tiles.TileEntityBlockTrafficSign;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.resources.I18n;
import net.minecraft.util.ResourceLocation;@SideOnly(Side.CLIENT)
public class GuiTrafficSign extends GuiScreen
{
private static final ResourceLocation textures = new ResourceLocation(RoadStuff.MODID, “textures/gui/sign/signConfig.png”);
private GuiButton buttonPrevious, buttonNext, buttonQuit;
private TileEntityBlockTrafficSign tileSign;
short currentSign = 0, maxSign = 4;public GuiTrafficSign(TileEntityBlockTrafficSign tile)
{
this.tileSign = tile;
this.allowUserInput = false;
}@Override
public void initGui()
{
buttonList.clear();
Keyboard.enableRepeatEvents(true);
buttonList.add(buttonQuit = new GuiButton(0, width / 2 - 25, height / 2 + 15, 50, 20, I18n.format(“gui.trafficsign.done”)));
buttonList.add(buttonPrevious = new GuiButton(1, width / 2 - 40, height / 2 - 10, 20, 20, “<”));
buttonList.add(buttonNext = new GuiButton(2, width / 2 + 20, height / 2 - 10, 20, 20, “>”));
}@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks)
{
this.drawDefaultBackground();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.getTextureManager().bindTexture(textures);
drawTexturedModalRect(width / 2 - 64, height / 2 - 40, 0, 0, 128, 80);
drawString(fontRendererObj, “Sign Selection”, width / 2 - 35, height / 2 - 28, 100);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.getTextureManager().bindTexture(textures);
drawTexturedModalRect(width / 2 - 8, height / 2 - 8, currentSign * 16, 80, 16, 16);
super.drawScreen(mouseX, mouseY, partialTicks);
}@Override
protected void actionPerformed(GuiButton parButton)
{
if(parButton == buttonQuit)
{
RoadStuff.network.sendToServer(new PacketSignType(this.currentSign, tileSign.xCoord, tileSign.yCoord, tileSign.zCoord));
mc.displayGuiScreen((GuiScreen)null);
}
else if(parButton == buttonPrevious)
currentSign–;
else if(parButton == buttonNext)
currentSign++;if(currentSign < 0)
currentSign = maxSign;
else if(currentSign > 4)
currentSign = 0;
System.out.println("Current selected sign: " + currentSign);
}@Override
public boolean doesGuiPauseGame()
{
return true;
}
}:::
:::
package net.killermapper.roadstuff.common;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import io.netty.buffer.ByteBuf;
import net.killermapper.roadstuff.common.tiles.TileEntityBlockTrafficSign;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.tileentity.TileEntity;public class PacketSignType implements IMessage
{
private short signType;
private int tileX, tileY, tileZ;public PacketSignType()
{}public PacketSignType(short signType, int x, int y, int z)
{
this.signType = signType;
this.tileX = x;
this.tileY = y;
this.tileZ = z;
}@Override
public void fromBytes(ByteBuf buf)
{
this.signType = buf.readShort();
this.tileX = buf.readInt();
this.tileY = buf.readInt();
this.tileZ = buf.readInt();
}@Override
public void toBytes(ByteBuf buf)
{
buf.writeShort(this.signType);
buf.writeInt(this.tileX);
buf.writeInt(this.tileY);
buf.writeInt(this.tileZ);
}public static class Handler implements IMessageHandler <packetsigntype, imessage=“”>{
@Override
public IMessage onMessage(PacketSignType message, MessageContext ctx)
{
TileEntity tile = ctx.getServerHandler().playerEntity.worldObj.getTileEntity(message.tileX, message.tileY, message.tileZ);
if(tile instanceof TileEntityBlockTrafficSign)
{
((TileEntityBlockTrafficSign)tile).setSignType(message.signType);
ctx.getServerHandler().playerEntity.worldObj.markBlockForUpdate(message.tileX, message.tileY, message.tileZ);
}
return null;
}
}
}:::
:::
package net.killermapper.roadstuff.common;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.killermapper.roadstuff.client.gui.RoadStuffGuiHandler;
import net.killermapper.roadstuff.common.blocks.RoadStuffBlocks;
import net.killermapper.roadstuff.common.blocks.TileEntityTest;
import net.killermapper.roadstuff.common.events.EventPlayer;
import net.killermapper.roadstuff.common.init.Chisel;
import net.killermapper.roadstuff.common.init.RoadStuffAchievements;
import net.killermapper.roadstuff.common.init.RoadStuffRecipes;
import net.killermapper.roadstuff.common.items.RoadStuffItems;
import net.killermapper.roadstuff.common.tiles.TileEntityBlockTrafficSign;
import net.killermapper.roadstuff.common.world.OreGeneration;
import net.killermapper.roadstuff.proxy.CommonProxy;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;@Mod(modid = RoadStuff.MODID, name = “Road Stuff”, version = “0.1”)
public class RoadStuff
{
@Instance(“roadstuff”)
public static RoadStuff instance;public static final String MODID = “roadstuff”;
public static SimpleNetworkWrapper network;
OreGeneration oreGen = new OreGeneration();
@SidedProxy(clientSide = “net.killermapper.roadstuff.proxy.ClientProxy”, serverSide = “net.killermapper.roadstuff.proxy.CommonProxy”)
public static CommonProxy proxy;public static CreativeTabs RoadStuffCreativeTabs = new CreativeTabs(“RoadStuff”)
{
@Override
public Item getTabIconItem()
{
return Item.getItemFromBlock(RoadStuffBlocks.blockAsphaltLines01);
}@SideOnly(Side.CLIENT)
public int func_151243_f()
{
return 0;
}
};@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
RoadStuffBlocks.initBlocks();
RoadStuffItems.initItems();
GameRegistry.registerWorldGenerator(oreGen, 0);RoadStuffAchievements.initAchievements();
network = NetworkRegistry.INSTANCE.newSimpleChannel(MODID);
network.registerMessage(PacketSignType.Handler.class, PacketSignType.class, 0, Side.SERVER);if(Loader.isModLoaded(“chisel”))
{
Chisel.sendIMC();
}
}@EventHandler
public void init(FMLInitializationEvent event)
{
GameRegistry.registerTileEntity(TileEntityTest.class, RoadStuff.MODID + “:entityTest”);
GameRegistry.registerTileEntity(TileEntityBlockTrafficSign.class, RoadStuff.MODID + “:entityBlockSign”);FMLCommonHandler.instance().bus().register(new EventPlayer());
// MinecraftForge.EVENT_BUS.register(new EventPlayer());NetworkRegistry.INSTANCE.registerGuiHandler(instance, new RoadStuffGuiHandler());
proxy.registerRender();
RoadStuffRecipes.initRecipes();
}@EventHandler
public void PostInit(FMLPostInitializationEvent event)
{}
}
:::
Je viens de passer ma journée entière dessus et là je suis vraiment à bout, à tous les coups c’est encore un truc tout con qui passe sous mes yeux mais je ne trouve pas… Du coup je m’en remets à vous.
J’en profite au passage pour demander comment faire tourner un ISBRH avec la fonction glRotatef sans que ça ne tourne le chunk entier, mes tentatives ont pour l’instant été des échecs.
Merci d’avance :)</packetsigntype,>
-
" ctx.getServerHandler().playerEntity.worldObj.markBlockForUpdate(message.tileX, message.tileY, message.tileZ);"
Pourquoi faire un markBlockForUpdate ici alors que ta fonction setSignType en fait déjà un ?if(parButton == buttonQuit)
->
if(parButton.id == 0)
c’est plus optimisé comme ça.Par contre je ne comprends pas pourquoi ça ne fonctionne pas comme il faut. Car il n’y a aucune erreur. Faudrait ajouter des System.out.println(signType) aux différents endroit où tu modifies sa valeur.
J’en profite au passage pour demander comment faire tourner un ISBRH avec la fonction glRotatef sans que ça ne tourne le chunk entier, mes tentatives ont pour l’instant été des échecs.
Tu ne peux pas. L’ISBRH n’est pas conçu pour une utilisation directe d’openGL.
-
Il est possible de faire les rotations mais avant le rendu, il va falloir ajouter:
GLStateManager.pushMatrix();
puis effectuer la rotation ainsi:
GLStateManager.rotate(tonAngleEnRadians, x, y, z);
Et à la fin du rendu, ajoute:
GLStateManager.popMatrix();
pushMatrix() et popMatrix permettent de sauvegarder “l’état actuel” des transformations afin d’ajouter les siennes sans mettre en l’air le reste. (en gros)
Voir ce lien pour plus d’infos (anglais)
http://docs.gl/gl2/glPushMatrix -
Ah oui j’avais complètement oublié qu’en ouvrant une nouvelle matrice on peut le faire.
-
Merci pour la rotation, je verrais ça une fois mon problème résolu.
Oui bien vu pour le MarkBlock, j’avais oublié de l’enlever à cet endroit. Et si l’id est mieux pour les boutons, je change
J’ai mis un println un peu partout et j’ai remarqué que la fonction writeToNBT est appelée plein de fois d’un coup, de manière aléatoire quand je clique sur un panneau pour accéder au GUI. Parfois, ça l’appelle une dizaine de fois sans rien faire, juste en me déplaçant.
Aaah j’ai surement trouvé pourquoi ça foire. J’avais posé des panneaux à un moment, qui avaient leur tileEntity associé, et en réorganisant mon code j’ai changé leur nom interne ce qui fait que Minecraft ne les a plus reconnu à un moment. Il les a donc supprimés… mais probablement pas retiré les entités associées… Et du coup le nombre de fois que writeToNBT est appelé correspond à toutes les entités, y compris celles des panneaux disparus. Et le tileEntity du panneau était raté en plus avant que je change mon code. Sur une nouvelle map, les panneaux ont l’air de fonctionner correctement.
J’aurai pensé que Minecraft retirerai les entités en supprimant les blocs manquants… Je me demande si on peut avoir une liste des tileEntities d’une map tiens.Bon à confirmer mais ça a l’air de correspondre au problème donc je pense que c’est à cause de ça.
-
@‘KillerMapper’:
Je me demande si on peut avoir une liste des tileEntities d’une map tiens.
world.loadedTileEntityList
-
Bon ça a l’air de remarcher, bien que parfois ça ne sauvegarde pas les données (pourtant mes println apparaissent bien), visiblement c’est quand ma variable direction vaut autre chose que 0. Du coup je vais voir pour les rotations. GLStateManager n’existe pas en 1.7 il me semble, je crois que c’est depuis la 1.8 seulement…
Edit: faut passer par GL11 au lieu de GLStateManager. Mais je n’arrive pas à faire tourner quoi que ce soif sauf le chunk entier si j’enlève le push et le pop.
-
Désolé je n’avais pas vu la version ^^’
Peux-tu envoyer un extrait de ton code de rendu pour que l’on puisse voir le problème pour la rotation.
-
Le voici:
:::
[size=x-smallpackage net.killermapper.roadstuff.client.render;][size=x-smallimport org.lwjgl.opengl.GL11;]
[size=x-smallimport cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;]
[size=x-smallimport net.killermapper.roadstuff.common.tiles.TileEntityBlockTrafficSign;]
[size=x-smallimport net.killermapper.roadstuff.proxy.ClientProxy;]
[size=x-smallimport net.minecraft.block.Block;]
[size=x-smallimport net.minecraft.client.renderer.RenderBlocks;]
[size=x-smallimport net.minecraft.client.renderer.Tessellator;]
[size=x-smallimport net.minecraft.tileentity.TileEntity;]
[size=x-smallimport net.minecraft.world.IBlockAccess;][size=x-smallpublic class RenderTrafficSign implements ISimpleBlockRenderingHandler]
[size=x-small{]
[size=x-small @Override]
[size=x-small public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)]
[size=x-small {]
[size=x-small Tessellator tessellator = Tessellator.instance;][size=x-small renderer.setRenderBounds(0.4375F, 0.0F, 0.5625F, 0.5625F, 1F, 0.625F);]
[size=x-small this.renderInInventory(tessellator, renderer, block, metadata);]
[size=x-small renderer.setRenderBounds(0.4375F, 0.0F, 0.5F, 0.46875F, 1F, 0.625F);]
[size=x-small this.renderInInventory(tessellator, renderer, block, metadata);]
[size=x-small renderer.setRenderBounds(0.53125F, 0.0F, 0.5F, 0.5625F, 1F, 0.625F);]
[size=x-small this.renderInInventory(tessellator, renderer, block, metadata);][size=x-small if(metadata == 1)]
[size=x-small {]
[size=x-small renderer.setRenderBounds(0.3125F, 0.0F, 0.625F, 0.6875F, 0.0625F, 0.6875F);]
[size=x-small this.renderInInventory(tessellator, renderer, block, metadata);]
[size=x-small renderer.setRenderBounds(0.1875F, 0.0625F, 0.625F, 0.8125F, 0.125F, 0.6875F);]
[size=x-small this.renderInInventory(tessellator, renderer, block, metadata);]
[size=x-small renderer.setRenderBounds(0.125F, 0.125F, 0.625F, 0.875F, 0.1875F, 0.6875F);]
[size=x-small this.renderInInventory(tessellator, renderer, block, metadata);]
[size=x-small renderer.setRenderBounds(0.0625F, 0.1875F, 0.625F, 0.9375F, 0.3125F, 0.6875F);]
[size=x-small this.renderInInventory(tessellator, renderer, block, metadata);]
[size=x-small renderer.setRenderBounds(0.0F, 0.3125F, 0.625F, 1F, 0.6875F, 0.6875F);]
[size=x-small this.renderInInventory(tessellator, renderer, block, metadata);]
[size=x-small renderer.setRenderBounds(0.0625F, 0.6875F, 0.625F, 0.9375F, 0.8125F, 0.6875F);]
[size=x-small this.renderInInventory(tessellator, renderer, block, metadata);]
[size=x-small renderer.setRenderBounds(0.125F, 0.8125F, 0.625F, 0.875F, 0.875F, 0.6875F);]
[size=x-small this.renderInInventory(tessellator, renderer, block, metadata);]
[size=x-small renderer.setRenderBounds(0.1875F, 0.875F, 0.625F, 0.8125F, 0.9375F, 0.6875F);]
[size=x-small this.renderInInventory(tessellator, renderer, block, metadata);]
[size=x-small renderer.setRenderBounds(0.3125F, 0.9375F, 0.625F, 0.6875F, 1F, 0.6875F);]
[size=x-small this.renderInInventory(tessellator, renderer, block, metadata);]
[size=x-small }]
[size=x-small }][size=x-small @Override]
[size=x-small public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)]
[size=x-small {]
[size=x-small TileEntity tile = world.getTileEntity(x, y, z);]
[size=x-small if(tile instanceof TileEntityBlockTrafficSign)]
[size=x-small {]
[size=x-small TileEntityBlockTrafficSign tileSign = (TileEntityBlockTrafficSign)tile;][size=x-small GL11.glPushMatrix();]
[size=x-small GL11.glRotatef(90F * tileSign.getSignDirection(), 0.0F, 1.0F, 0.0F);][size=x-small renderer.setRenderBounds(0.4375F, 0.0F, 0.5625F, 0.5625F, 1F, 0.625F);]
[size=x-small renderer.renderStandardBlock(block, x, y, z);]
[size=x-small renderer.setRenderBounds(0.4375F, 0.0F, 0.5F, 0.46875F, 1F, 0.5625F);]
[size=x-small renderer.renderStandardBlock(block, x, y, z);]
[size=x-small renderer.setRenderBounds(0.53125F, 0.0F, 0.5F, 0.5625F, 1F, 0.5625F);]
[size=x-small renderer.renderStandardBlock(block, x, y, z);][size=x-small if(world.getBlockMetadata(x, y, z) != 0)]
[size=x-small {]
[size=x-small switch(tileSign.getSignShape())]
[size=x-small {]
[size=x-small case 0:]
[size=x-small renderer.setRenderBounds(0.0F, 0.0F, 0.625F, 1F, 1F, 0.6875F);]
[size=x-small renderer.renderStandardBlock(block, x, y, z);]
[size=x-small break;]
[size=x-small case 1:]
[size=x-small renderer.setRenderBounds(0.3125F, 0.0F, 0.625F, 0.6875F, 0.0625F, 0.6875F);]
[size=x-small renderer.renderStandardBlock(block, x, y, z);]
[size=x-small renderer.setRenderBounds(0.1875F, 0.0625F, 0.625F, 0.8125F, 0.125F, 0.6875F);]
[size=x-small renderer.renderStandardBlock(block, x, y, z);]
[size=x-small renderer.setRenderBounds(0.125F, 0.125F, 0.625F, 0.875F, 0.1875F, 0.6875F);]
[size=x-small renderer.renderStandardBlock(block, x, y, z);]
[size=x-small renderer.setRenderBounds(0.0625F, 0.1875F, 0.625F, 0.9375F, 0.3125F, 0.6875F);]
[size=x-small renderer.renderStandardBlock(block, x, y, z);]
[size=x-small renderer.setRenderBounds(0.0F, 0.3125F, 0.625F, 1F, 0.6875F, 0.6875F);]
[size=x-small renderer.renderStandardBlock(block, x, y, z);]
[size=x-small renderer.setRenderBounds(0.0625F, 0.6875F, 0.625F, 0.9375F, 0.8125F, 0.6875F);]
[size=x-small renderer.renderStandardBlock(block, x, y, z);]
[size=x-small renderer.setRenderBounds(0.125F, 0.8125F, 0.625F, 0.875F, 0.875F, 0.6875F);]
[size=x-small renderer.renderStandardBlock(block, x, y, z);]
[size=x-small renderer.setRenderBounds(0.1875F, 0.875F, 0.625F, 0.8125F, 0.9375F, 0.6875F);]
[size=x-small renderer.renderStandardBlock(block, x, y, z);]
[size=x-small renderer.setRenderBounds(0.3125F, 0.9375F, 0.625F, 0.6875F, 1F, 0.6875F);]
[size=x-small renderer.renderStandardBlock(block, x, y, z);]
[size=x-small break;]
[size=x-small case 2:]
[size=x-small renderer.setRenderBounds(0.0F, 0.0F, 0.625F, 1F, 0.25F, 0.6875F);]
[size=x-small renderer.renderStandardBlock(block, x, y, z);]
[size=x-small renderer.setRenderBounds(0.0625F, 0.25F, 0.625F, 0.9375F, 0.375F, 0.6875F);]
[size=x-small renderer.renderStandardBlock(block, x, y, z);]
[size=x-small renderer.setRenderBounds(0.125F, 0.375F, 0.625F, 0.8875F, 0.5F, 0.6875F);]
[size=x-small renderer.renderStandardBlock(block, x, y, z);]
[size=x-small renderer.setRenderBounds(0.1875F, 0.5F, 0.625F, 0.8225F, 0.625F, 0.6875F);]
[size=x-small renderer.renderStandardBlock(block, x, y, z);]
[size=x-small renderer.setRenderBounds(0.25F, 0.625F, 0.625F, 0.75F, 0.75F, 0.6875F);]
[size=x-small renderer.renderStandardBlock(block, x, y, z);]
[size=x-small renderer.setRenderBounds(0.3125F, 0.75F, 0.625F, 0.6875F, 0.875F, 0.6875F);]
[size=x-small renderer.renderStandardBlock(block, x, y, z);]
[size=x-small renderer.setRenderBounds(0.375F, 0.875F, 0.625F, 0.625F, 1F, 0.6875F);]
[size=x-small renderer.renderStandardBlock(block, x, y, z);]
[size=x-small break;]
[size=x-small case 3:]
[size=x-small renderer.setRenderBounds(0.375F, 0.0F, 0.625F, 0.625F, 0.0625F, 0.6875F);]
[size=x-small renderer.renderStandardBlock(block, x, y, z);]
[size=x-small renderer.setRenderBounds(0.3125F, 0.0625F, 0.625F, 0.6875F, 0.125F, 0.6875F);]
[size=x-small renderer.renderStandardBlock(block, x, y, z);]
[size=x-small renderer.setRenderBounds(0.25F, 0.125F, 0.625F, 0.75F, 0.1875F, 0.6875F);]
[size=x-small renderer.renderStandardBlock(block, x, y, z);]
[size=x-small renderer.setRenderBounds(0.1875F, 0.1875F, 0.625F, 0.8125F, 0.25F, 0.6875F);]
[size=x-small renderer.renderStandardBlock(block, x, y, z);]
[size=x-small renderer.setRenderBounds(0.125F, 0.25F, 0.625F, 0.875F, 0.3125F, 0.6875F);]
[size=x-small renderer.renderStandardBlock(block, x, y, z);]
[size=x-small renderer.setRenderBounds(0.0625F, 0.3125F, 0.625F, 0.9375F, 0.375F, 0.6875F);]
[size=x-small renderer.renderStandardBlock(block, x, y, z);]
[size=x-small renderer.setRenderBounds(0.0F, 0.375F, 0.625F, 1F, 0.625F, 0.6875F);]
[size=x-small renderer.renderStandardBlock(block, x, y, z);]
[size=x-small renderer.setRenderBounds(0.0625F, 0.625F, 0.625F, 0.9375F, 0.6875F, 0.6875F);]
[size=x-small renderer.renderStandardBlock(block, x, y, z);]
[size=x-small renderer.setRenderBounds(0.125F, 0.6875F, 0.625F, 0.875F, 0.75F, 0.6875F);]
[size=x-small renderer.renderStandardBlock(block, x, y, z);]
[size=x-small renderer.setRenderBounds(0.1875F, 0.75F, 0.625F, 0.8125F, 0.8125F, 0.6875F);]
[size=x-small renderer.renderStandardBlock(block, x, y, z);]
[size=x-small renderer.setRenderBounds(0.25F, 0.8125F, 0.625F, 0.75F, 0.875F, 0.6875F);]
[size=x-small renderer.renderStandardBlock(block, x, y, z);]
[size=x-small renderer.setRenderBounds(0.3125F, 0.875F, 0.625F, 0.6875F, 0.9375F, 0.6875F);]
[size=x-small renderer.renderStandardBlock(block, x, y, z);]
[size=x-small renderer.setRenderBounds(0.375F, 0.9375F, 0.625F, 0.625F, 1F, 0.6875F);]
[size=x-small renderer.renderStandardBlock(block, x, y, z);]
[size=x-small break;]
[size=x-small }]
[size=x-small }]
[size=x-small GL11.glPopMatrix();]
[size=x-small }]
[size=x-small return true;]
[size=x-small }][size=x-small @Override]
[size=x-small public boolean shouldRender3DInInventory(int modelId)]
[size=x-small {]
[size=x-small return true;]
[size=x-small }][size=x-small @Override]
[size=x-small public int getRenderId()]
[size=x-small {]
[size=x-small return ClientProxy.renderSignPostId;]
[size=x-small }][size=x-small private void renderInInventory(Tessellator tessellator, RenderBlocks renderer, Block block, int metadata)]
[size=x-small {]
[size=x-small GL11.glTranslatef(-0.5F, -0.5F, -0.5F);]
[size=x-small tessellator.startDrawingQuads();]
[size=x-small tessellator.setNormal(0.0F, -1F, 0.0F);]
[size=x-small renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(0, metadata));]
[size=x-small tessellator.draw();]
[size=x-small tessellator.startDrawingQuads();]
[size=x-small tessellator.setNormal(0.0F, 1.0F, 0.0F);]
[size=x-small renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(1, metadata));]
[size=x-small tessellator.draw();]
[size=x-small tessellator.startDrawingQuads();]
[size=x-small tessellator.setNormal(0.0F, 0.0F, -1F);]
[size=x-small renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(2, metadata));]
[size=x-small tessellator.draw();]
[size=x-small tessellator.startDrawingQuads();]
[size=x-small tessellator.setNormal(0.0F, 0.0F, 1.0F);]
[size=x-small renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(3, metadata));]
[size=x-small tessellator.draw();]
[size=x-small tessellator.startDrawingQuads();]
[size=x-small tessellator.setNormal(-1F, 0.0F, 0.0F);]
[size=x-small renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(4, metadata));]
[size=x-small tessellator.draw();]
[size=x-small tessellator.startDrawingQuads();]
[size=x-small tessellator.setNormal(1.0F, 0.0F, 0.0F);]
[size=x-small renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(5, metadata));]
[size=x-small tessellator.draw();]
[size=x-small GL11.glTranslatef(0.5F, 0.5F, 0.5F);]
[size=x-small }][size=x-small}]
:::J’ai aussi demandé sur le forum minecraftforge.net, on me dit que l’ISBRH ne peut pas être tourné avec glRotatef.
Si vous n’avez pas d’idée de votre côté, je vais juste me faire les 3 rotations à la main, tant pis ^^ -
Désolé pour le retard de la réponse mais ça me parait bizarre que l’on puisse pas le tourner dans l’ISBRH…
Mais si tu y arrives pas va effectivement tout faire à la mainSent from my GT-I9000 using Tapatalk 2