Jump to content

RafaelVN

Members
  • Posts

    27
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

RafaelVN's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. already tried to draw FMLNetworkHandler.openGui in the actionPerformed ?
  2. I think you must implement the method getIcon as you made with getUnlocalizedName type: @Override public String getIcon(int meta) { if (meta == 0){return texture0} if (meta == 1){return texture1} if (meta == 2){return texture2} if (meta == 3){return texture3} if (meta == 4){return texture4} if (meta == 5){return texture5} return texture0; }
  3. hi, I'm trying to create a custom Recipe class, I'm trying to base myself in FurnaceRecipes class, but watching me her code came across a lot of weird names like func_151394_a among others and tried to search the web for your references and unique that I could find has only these two: func_151393_a: addSmelting () to blocks func_151396_a: addSmelting () to item then I know that it's more like an request than for a more doubts I would like to know if someone knows this Class I could to give me his translation = b. ty for attention.
  4. like that ? http://www.minecraftforge.net/wiki/Creating_NBT_for_items
  5. I think the gui the constructor must pass the argument a container this way : public MyGuiContainer (InventoryPlayer ivPlayer, MyTileEntity tileEntity) { super (new MyContainer (ivPlayer, tileEntity)); // Other things }
  6. exact, before I was using TileEntity to implement iMessage, but he has a constructor with arguments, then i made following the example of the inner class and got = b. thanks for listening
  7. hello again, follow the tutorial that showed me and creates a code but I'm having trouble, he is returning me excpetion. below is the code and the result of the console: IMessage package teste; import io.netty.buffer.ByteBuf; import cpw.mods.fml.common.network.ByteBufUtils; import cpw.mods.fml.common.network.simpleimpl.IMessage; public class InductionFurnacePowerPacket implements IMessage { public static final String POWER_SWITCH_MSG = "0"; public String text; public InductionFurnacePowerPacket(String text) { this.text = text; } @Override public void fromBytes(ByteBuf buf) { text = ByteBufUtils.readUTF8String(buf); } @Override public void toBytes(ByteBuf buf) { ByteBufUtils.writeUTF8String(buf, text); } } IMessageHandler (its my TileEntity so i will show onMessage) : @Override public IMessage onMessage(InductionFurnacePowerPacket message, MessageContext ctx) { System.out.println(String.format("Received %s from %s", message.text, ctx.getServerHandler().playerEntity.getDisplayName())); if (message.text == InductionFurnacePowerPacket.POWER_SWITCH_MSG) { powerFlag = !powerFlag; } return null; } init() networkWrapper = NetworkRegistry.INSTANCE.newSimpleChannel("myChannel"); networkWrapper.registerMessage(InductionFurnaceTileEntity.class, InductionFurnacePowerPacket.class, 0, Side.SERVER); actionPerformed (send packet): @Override protected void actionPerformed(GuiButton button) { switch (button.id) { case 0: System.out.println("clique detect"); testemod.networkWrapper .sendToServer(new InductionFurnacePowerPacket( InductionFurnacePowerPacket.POWER_SWITCH_MSG)); } } the exception [02:25:29] [server thread/ERROR] [FML]: FMLIndexedMessageCodec exception caught io.netty.handler.codec.DecoderException: java.lang.InstantiationException: teste.InductionFurnacePowerPacket at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:99) ~[MessageToMessageDecoder.class:?] at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) ~[MessageToMessageCodec.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:?] at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) [EmbeddedChannel.class:?] at cpw.mods.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:86) [FMLProxyPacket.class:?] at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) [NetworkManager.class:?] at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) [NetworkSystem.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) [integratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?] Caused by: java.lang.InstantiationException: teste.InductionFurnacePowerPacket at java.lang.Class.newInstance(Unknown Source) ~[?:1.7.0_45] at cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:75) ~[FMLIndexedMessageToMessageCodec.class:?] at cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:17) ~[FMLIndexedMessageToMessageCodec.class:?] at io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81) ~[MessageToMessageCodec$2.class:?] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89) ~[MessageToMessageDecoder.class:?] ... 13 more [02:25:29] [server thread/ERROR] [FML]: SimpleChannelHandlerWrapper exception io.netty.handler.codec.DecoderException: java.lang.InstantiationException: teste.InductionFurnacePowerPacket at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:99) ~[MessageToMessageDecoder.class:?] at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) ~[MessageToMessageCodec.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:?] at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) [EmbeddedChannel.class:?] at cpw.mods.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:86) [FMLProxyPacket.class:?] at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) [NetworkManager.class:?] at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) [NetworkSystem.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) [integratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?] Caused by: java.lang.InstantiationException: teste.InductionFurnacePowerPacket at java.lang.Class.newInstance(Unknown Source) ~[?:1.7.0_45] at cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:75) ~[FMLIndexedMessageToMessageCodec.class:?] at cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:17) ~[FMLIndexedMessageToMessageCodec.class:?] at io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81) ~[MessageToMessageCodec$2.class:?] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89) ~[MessageToMessageDecoder.class:?] ... 13 more [02:25:29] [server thread/ERROR] [FML]: There was a critical exception handling a packet on channel myChannel io.netty.handler.codec.DecoderException: java.lang.InstantiationException: teste.InductionFurnacePowerPacket at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:99) ~[MessageToMessageDecoder.class:?] at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) ~[MessageToMessageCodec.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) ~[DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) ~[DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) ~[DefaultChannelPipeline.class:?] at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) ~[EmbeddedChannel.class:?] at cpw.mods.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:86) [FMLProxyPacket.class:?] at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) [NetworkManager.class:?] at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) [NetworkSystem.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) [integratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?] Caused by: java.lang.InstantiationException: teste.InductionFurnacePowerPacket at java.lang.Class.newInstance(Unknown Source) ~[?:1.7.0_45] at cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:75) ~[FMLIndexedMessageToMessageCodec.class:?] at cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:17) ~[FMLIndexedMessageToMessageCodec.class:?] at io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81) ~[MessageToMessageCodec$2.class:?] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89) ~[MessageToMessageDecoder.class:?] ... 13 more what am I doing wrong?
  8. hey, had no idea that there was this feature, I will try to develop something with it and say if able, thank you for help friend = b.
  9. hi, I'm adding a button to my furnace which has functionality to act as an activator (such as a button on and off), however as the gui is in the client side I have no way to get the server TileEntity to change it, I do not know how I can do this by client, already tried using Conteiner.detectAndSendChanges () to try to update the TileEntity on 2 sides did not have more success (it seems that only works the server to the client not the reverse). follows my code of gui and container: package teste; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.Slot; import net.minecraft.inventory.SlotFurnace; import net.minecraft.item.ItemStack; public class InductionFurnaceContainer extends Container { private InductionFurnaceTileEntity tileEntity; public int lastBurnTime; public int lastItemBurnTime; public int[] lastCookTime = new int[5]; // the flag of my button control public int lastPowerFlag; public InductionFurnaceContainer(InventoryPlayer ivPlayer, InductionFurnaceTileEntity tileEntity) { this.tileEntity = tileEntity; // cria os slots em relação do numero do slot com a sua posição na gui // 0-4 - stocks // 5-9 - place // 11-4 - result for (int i = 0; i < 5; i++) { addSlotToContainer(new Slot(tileEntity, InductionFurnaceTileEntity.INGREDIENT_STOCK[i], 42, 25 + (18 * i))); addSlotToContainer(new InductionFurnaceLockedSlot(tileEntity, InductionFurnaceTileEntity.INGREDIENT_PLACE[i], 120, 25 + (18 * i))); addSlotToContainer(new SlotFurnace(ivPlayer.player, tileEntity, InductionFurnaceTileEntity.RESULT[i], 198, 25 + (18 * i))); } // 15 - fuel addSlotToContainer(new Slot(tileEntity, InductionFurnaceTileEntity.FUEL_PLACE, 120, 135)); // 16-43 Player inventory back // 44-52 Player inventory hand int i; for (i = 0; i < 3; ++i) { for (int j = 0; j < 9; ++j) { this.addSlotToContainer(new Slot(ivPlayer, j + (i * 9) + 9, 48 + (18 * j), 175 + (18 * i))); } } for (i = 0; i < 9; ++i) { this.addSlotToContainer(new Slot(ivPlayer, i, 48 + (18 * i), 233)); } } // ids : // 0-4 cookTime[] // 5 burnTime; // 6 currentItemBurnTime @Override public void addCraftingToCrafters(ICrafting iCraftting) { System.out.println("add"); super.addCraftingToCrafters(iCraftting); for (int i = 0; i < 5; i++) { iCraftting.sendProgressBarUpdate(this, i, tileEntity.cookTime[i]); } iCraftting.sendProgressBarUpdate(this, 5, tileEntity.burnTime); iCraftting.sendProgressBarUpdate(this, 6, tileEntity.currentItemBurnTime); iCraftting.sendProgressBarUpdate(this, 7, tileEntity.powerFlag ? 1 : 0); } // public void addPowerFlagToCraftters(ICrafting iCraftting) { // super.addCraftingToCrafters(iCraftting); // iCraftting.sendProgressBarUpdate(this, 7, tileEntity.powerFlag ? 1 : 0); // } @Override // quanda a gui ativada, constantemente detecta mudança e caso haja alguma, // chama update no client public void detectAndSendChanges() { super.detectAndSendChanges(); System.out.println("detect :" + tileEntity.powerFlag); // eu acho que se refere a cada player que tem ativo o bloco for (int ic = 0; ic < crafters.size(); ic++) { ICrafting iCraftting = (ICrafting) crafters.get(ic); for (int i = 0; i < 5; i++) { if (lastCookTime[i] != tileEntity.cookTime[i]) { iCraftting.sendProgressBarUpdate(this, i, tileEntity.cookTime[i]); } } if (lastBurnTime != tileEntity.burnTime) { iCraftting.sendProgressBarUpdate(this, 5, tileEntity.burnTime); } if (lastItemBurnTime != tileEntity.currentItemBurnTime) { iCraftting.sendProgressBarUpdate(this, 6, tileEntity.currentItemBurnTime); } boolean b = lastPowerFlag == 1 ? true : false; if (b != tileEntity.powerFlag) { iCraftting.sendProgressBarUpdate(this, 7, tileEntity.powerFlag ? 1 : 0); } } lastCookTime = tileEntity.cookTime.clone(); lastBurnTime = tileEntity.burnTime; lastItemBurnTime = tileEntity.currentItemBurnTime; lastPowerFlag = tileEntity.powerFlag ? 1 : 0; } // no client e recebidos os valores atualizados do tileentity do server @Override public void updateProgressBar(int varId, int newValue) { System.out.println("update"); if (varId >= 0 && varId <= 4) { tileEntity.cookTime[varId] = newValue; } if (varId == 5) tileEntity.burnTime = newValue; if (varId == 6) tileEntity.currentItemBurnTime = newValue; if (varId == 7) tileEntity.powerFlag = newValue == 1 ? true : false; } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slot) { return null; } @Override public boolean canInteractWith(EntityPlayer player) { return tileEntity.isUseableByPlayer(player); } } package teste; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; public class InductionFurnaceGui extends GuiContainer { public static final ResourceLocation texture = new ResourceLocation( testemod.MODID, "textures/gui/InductionFurnaceGui.png"); public static final ResourceLocation addons = new ResourceLocation( testemod.MODID, "textures/gui/InductionFurnaceAddons.png"); public InductionFurnaceTileEntity tileEntity; // public InductionFurnaceContainer container; public InductionFurnaceGui(InventoryPlayer ivPlayer, InductionFurnaceTileEntity tileEntity) { super(new InductionFurnaceContainer(ivPlayer, tileEntity)); this.tileEntity = tileEntity; this.xSize = 256; this.ySize = 256; } @Override protected void drawGuiContainerForegroundLayer(int par1, int par2) { String name = tileEntity.isInvNameLocalized() ? tileEntity.getInvName() : I18n.format(tileEntity.getInvName(), new Object[0]); String inventoryName = I18n .format("container.inventory", new Object[0]); fontRendererObj.drawString(name, xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 13, 4210752); fontRendererObj.drawString(inventoryName, xSize / 2 - this.fontRendererObj.getStringWidth(inventoryName) / 2, 163 - 8, 4210752); } @Override protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { GL11.glColor4f(1F, 1F, 1F, 1F); Minecraft.getMinecraft().getTextureManager().bindTexture(texture); drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); Minecraft.getMinecraft().getTextureManager().bindTexture(addons); if (tileEntity.isBurning()) { drawTexturedModalRect(guiLeft + 120, guiTop + 25, 0, 0, 16, 88); int k = this.tileEntity.getBurnTimeRemainingScaled(29); drawTexturedModalRect(guiLeft + 114, guiTop + 119, 16, 0, k + 1, 10); } for (int i = 0; i < 5; i++) { int k = tileEntity.getCookProgressScaled(10, i); drawTexturedModalRect(guiLeft + 137, guiTop + 38 + (18 * i) - (k + 1), 16, 20 - (k + 1), 1, k + 1); } } public void initGui() { super.initGui(); this.buttonList.add(new customButton(0, guiLeft + 15, guiTop + 15, 16, 16, "no use")); } @Override protected void actionPerformed(GuiButton button) { switch (button.id) { case 0: System.out.println("clique detect"); tileEntity.powerFlag = !tileEntity.powerFlag; inventorySlots.detectAndSendChanges(); } } }
  10. hi diesieben07, is just that, besides the more thanks to your tip managed to find a flaw in my code a look: @Override public void updateEntity() { boolean flag1 = burnTime > 0; boolean flag2 = false; if (isBurning()) { burnTime--; } if (!worldObj.isRemote) { if (burnTime == 0 && canSmelt()) { currentItemBurnTime = burnTime = getItemBurnTime(slots[1]); if (isBurning()) { flag2 = true; if (slots[1] != null) { slots[1].stackSize--; if (slots[1].stackSize == 0) { slots[1] = slots[1].getItem().getContainerItem( slots[1]); } } } } if (isBurning() && canSmelt()) { cookTime++; if (cookTime == furnaceSpeed) { cookTime = 0; smeltItem(); // Exactly here !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! flag2 = true; // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! } } else { cookTime = 0; } if (flag1 != isBurning()) { flag2 = true; InductionFurnaceBlock.updateFurnaceBlockState(burnTime > 0, worldObj, xCoord, yCoord, zCoord); } } if (flag2) { markDirty(); } } at the point where I scored in the code before I was using the first flag, so it was not detected when a particular item was cooked in the furnace, only when I changed something myself. very grateful for the help friend.
  11. Hi, I learned how to create a custom furnace following steps of a tutorial I saw recently developed a code that near the end, I'm just having some problems with respect to reading and writing of NBTTags (which is responsible in this case to allow the information of TileEntitys persist before the savegames), more specifically, my code so it works in a way, my question really is with respect to the criteria that the game system uses to make the call of the writeToNBT TileEntitys, in my case it only calls when I click on esc and then open the menu screen, the otherwise happens passively with auto saved. Only in the first case (when i click esc) the call only happens when some block changes its inventory (or retreat when I put any item in any slot), otherwise the call does not happen (to test so I put a System.out.println ("write ") in writeToNBT and looked in the console ) if the change happens without my intervene (as an item to be cooked and stored in slot 3) when I click the esc the call to writeToNBT not happen (as if the system does not could sees the change), then I thought it would be boring as eg for a player if he put 8 iron ingot and at a given time that 4 has been completed and then without even interact with the furnace he decides to leave the game. then when he returns he looks the furnace and observes the 8 iron ingot intact. It may seem little since it can count on the passive update (and thus ensure that a huge amount stay without being updated), but I'm a little detail and wanted to fix that little problem. What I really want to know if it is possible to force the system to call the call writeToNBT at a desired time (more precisely when the player click esc and open the menu) and thus ensure that the NBT be updated at the right time. if you want to look at learning the code follows the link from my repository in git hub (will not do that here not to make the topic get bigger than it already was , besides the more you forgive me if I could not express myself more briefly, I am foreign and do not speak english well). https://github.com/RafaelVN/Learning-Repository Thank you for your attention and for the help.
  12. ah. then i missed that, ty man you help me a lot .
  13. hi, I'm trying to create a block that when in the world he is facing the player who placed it (as well as furnaces etc ...). Follow my code: Block class: package teste; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; 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.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; public class InductionFurnace extends Block implements ITileEntityProvider { public final static int BOTTOM_SIDE = 0; public final static int TOP_SIDE = 1; public final static int NORTH_SIDE = 2; public final static int SOUTH_SIDE = 3; public final static int WEST_SIDE = 4; public final static int EAST_SIDE = 5; private IIcon top; private IIcon bottom; private IIcon left; private IIcon right; private IIcon front; private IIcon back; private IIcon skinBase; public static boolean isBurning = true; protected InductionFurnace(Material mat) { super(mat); System.out.println("Block criado :" + toString()); } @Override public boolean onBlockActivated(World p_149727_1_, int p_149727_2_, int p_149727_3_, int p_149727_4_, EntityPlayer p_149727_5_, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) { // Minecraft.getMinecraft().displayGuiScreen(new GuiBasic()); return super.onBlockActivated(p_149727_1_, p_149727_2_, p_149727_3_, p_149727_4_, p_149727_5_, p_149727_6_, p_149727_7_, p_149727_8_, p_149727_9_); } @Override public TileEntity createNewTileEntity(World world, int meta) { System.out.println(meta); System.out.println("Tile Entity criado :" + toString()); Item.getItemFromBlock(this); return new MyFirstTileEntity(); // this.getDrops(world, x, y, z, metadata, fortune) } @Override public void registerBlockIcons(IIconRegister iconRegister) { top = iconRegister.registerIcon("testemod:MachinePlateBorded"); bottom = iconRegister.registerIcon("testemod:MachineLogisticEntrance"); left = iconRegister.registerIcon("testemod:MachinePlateFanLeft"); right = iconRegister.registerIcon("testemod:MachinePlateFanRight"); back = iconRegister.registerIcon("testemod:MachineBack"); front = iconRegister.registerIcon("testemod:" + (isBurning ? "InductionFurnaceFrontActive" : "InductionFurnaceFront")); skinBase = iconRegister.registerIcon("testemod:MachinePlateBorded"); } @Override public IIcon getIcon(int side, int meta) { switch (side) { case InductionFurnace.BOTTOM_SIDE: return bottom; case InductionFurnace.TOP_SIDE: return top; case InductionFurnace.NORTH_SIDE: return back; case InductionFurnace.SOUTH_SIDE: return front; case InductionFurnace.WEST_SIDE: return right; case InductionFurnace.EAST_SIDE: return left; } return skinBase; } @Override public Item getItemDropped(int par1, Random random, int par3) { return Item.getItemFromBlock(testemod.myFirstContainerBlock); } @Override public Item getItem(World world, int par2, int par3, int par4) { return Item.getItemFromBlock(testemod.myFirstContainerBlock); } @Override public void onBlockAdded(World world, int x, int y, int z) { super.onBlockAdded(world, x, y, z); direction(world, x, y, z); } @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack p_149689_6_) { int l = MathHelper .floor_double((double) (player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; if (l == 0) { world.setBlockMetadataWithNotify(x, y, z, 2, 2); } if (l == 1) { world.setBlockMetadataWithNotify(x, y, z, 5, 2); } if (l == 2) { world.setBlockMetadataWithNotify(x, y, z, 3, 2); } if (l == 3) { world.setBlockMetadataWithNotify(x, y, z, 4, 2); } } public void direction(World world, int x, int y, int z) { if (!world.isRemote) { Block direction1 = world.getBlock(x, y, z - 1); Block direction2 = world.getBlock(x, y, z + 1); Block direction3 = world.getBlock(x - 1, y, z - 1); Block direction4 = world.getBlock(x + 1, y, z - 1); byte byte0 = 3; if (direction1.func_149730_j() && !direction2.func_149730_j()) { byte0 = 3; } if (direction2.func_149730_j() && !direction1.func_149730_j()) { byte0 = 2; } if (direction3.func_149730_j() && !direction4.func_149730_j()) { byte0 = 5; } if (direction4.func_149730_j() && !direction3.func_149730_j()) { byte0 = 4; } world.setBlockMetadataWithNotify(x, y, z, byte0, 2); } } public static void updateFurnaceBlockState(boolean p_149931_0_, World world, int x, int y, int z) { int direction = world.getBlockMetadata(x, y, z); // TileEntity tileentity = world.getTileEntity(p_149931_2_, p_149931_3_, // p_149931_4_); // field_149934_M = true; // if (p_149931_0_) { // world.setBlock(p_149931_2_, p_149931_3_, p_149931_4_, // Blocks.lit_furnace); // } else { // world.setBlock(p_149931_2_, p_149931_3_, p_149931_4_, // Blocks.furnace); // } // field_149934_M = false; world.setBlockMetadataWithNotify(x, y, z, direction, 2); // if (tileentity != null) // { // tileentity.validate(); // p_149931_1_.setTileEntity(p_149931_2_, p_149931_3_, p_149931_4_, // tileentity); // } } // @Override // public void breakBlock(World world, int x, int y, int z, Block block, // int meta) { // } @Override public void randomDisplayTick(World world, int x, int y, int z, Random random) { int direction = world.getBlockMetadata(x, y, z); float xx = (float) (x + 0.5F); float yy = (float) (y + random.nextFloat() * 6.0F / 16.0F); float zz = (float) (z + 0.5F); float zz2 = 0.52F; float xx2 = random.nextFloat() * 0.6F - 0.3F; switch (direction) { case 4: { world.spawnParticle("smoke", (double) (xx - zz2), (double) yy, (double) (zz + xx2), 0.0D, 0.0D, 0.0D); world.spawnParticle("flame", (double) (xx - zz2), (double) yy, (double) (zz + xx2), 0.0D, 0.0D, 0.0D); } case 5: { world.spawnParticle("smoke", (double) (xx + zz2), (double) yy, (double) (zz + xx2), 0.0D, 0.0D, 0.0D); world.spawnParticle("flame", (double) (xx + zz2), (double) yy, (double) (zz + xx2), 0.0D, 0.0D, 0.0D); } case 2: { world.spawnParticle("smoke", (double) (xx + xx2), (double) yy, (double) (zz - zz2), 0.0D, 0.0D, 0.0D); world.spawnParticle("flame", (double) (xx + xx2), (double) yy, (double) (zz - zz2), 0.0D, 0.0D, 0.0D); } case 3: { world.spawnParticle("smoke", (double) (xx + xx2), (double) yy, (double) (zz + zz2), 0.0D, 0.0D, 0.0D); world.spawnParticle("flame", (double) (xx + xx2), (double) yy, (double) (zz + zz2), 0.0D, 0.0D, 0.0D); } } } } main class: package teste; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; 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.FMLPreInitializationEvent; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.registry.GameRegistry; @Mod(modid = testemod.MODID, name = testemod.NAME, version = testemod.VERSION) public class testemod { public static final String MODID = "testemod"; public static final String NAME = "Testemod"; public static final String VERSION = "1.0"; public static Block myFirstContainerBlock; @Instance ( "testemod" ) public static testemod instance; @SidedProxy ( clientSide = "teste.ClientProxy", serverSide = "teste.CommonProxy" ) public static CommonProxy proxy; @EventHandler public void preinit(FMLPreInitializationEvent event) { myFirstContainerBlock = new InductionFurnace(Material.rock) .setHardness(0.5F).setStepSound(Block.soundTypeStone) .setBlockName("myFirstContainerBlock") .setCreativeTab(CreativeTabs.tabBlock); GameRegistry.registerBlock(myFirstContainerBlock, "myFirstContainerBlock"); NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy); } } Well, the problem is simple, do not block the orientation of the way I want, they just keep the default orientation. see the result: https://fbcdn-sphotos-b-a.akamaihd.net/hphotos-ak-xap1/t31.0-8/q83/p526x395/1801159_758967554192629_5029193513560918574_o.jpg[/img] https://scontent-a-mia.xx.fbcdn.net/hphotos-xfa1/t31.0-8/q83/p526x395/1655482_758967677525950_4610313450111996101_o.jpg[/img] I wonder what's wrong in my code does not work the way I want, and I'm grateful for the help.
  14. https://scontent-b-mia.xx.fbcdn.net/hphotos-xpf1/t31.0-8/10454347_758074337615284_8019490234765203264_o.jpg[/img] it seems that the minecraft works with a default resolution, before I was using a smaller image and in the end the minecraft stretched to reset the rest Thank you friend for the help = b
×
×
  • Create New...

Important Information

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