Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

End_KG

Members
  • Joined

  • Last visited

  1. I wanna render player sign(like nameplate ) onto screen whatever how far the player is,but i've tried many ways to achive it but i was faild. There are two ways I tried but faild before. 1. use gluProject to map player location to screen pos,as a result,I got an incorrect screen pos. 2.render infos I need into world directly when RenderWorldLastEvent was fired,as a result,those infos didn't render when I am far away. i wonder that is there a way to let me cover 3d coordinates to screen pos and render onto screen whatever how far the player is? I am sorry for my poor english and thanks a lot!
  2. I wanna render player sign(like nameplate ) onto screen whatever how far the player is,but i've tried many ways to achive it but i was faild. There are two ways I tried but faild before. 1. use gluProject to map player location to screen pos,as a result,I got an incorrect screen pos. 2.render infos I need into world directly when RenderWorldLastEvent was fired,as a result,those infos didn't render when I am far away. i wonder that is there a way to let me cover 3d coordinates to screen pos and render onto screen whatever how far the player is? I am sorry for my poor english and thanks a lot!
  3. Okay! GuiHandler: public class GuiHandler implements IGuiHandler { public static final int GuiCanshe = 0, GuiLuzao = 1, GuiZhuguo = 2; @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { switch (ID) { case GuiCanshe: TileEntityCanshe tileEntityCanshe = (TileEntityCanshe) world.getTileEntity(x, y, z); return new ContainerCanshe(player.inventory, tileEntityCanshe); case GuiZhuguo: TileEntityZhuguo tileEntityZhuguo = (TileEntityZhuguo) world.getTileEntity(x, y, z); return new ContainerZhuguo(player.inventory, tileEntityZhuguo); case GuiLuzao: TileEntityLuzao tileEntityLuzao = (TileEntityLuzao) world.getTileEntity(x, y, z); return new ContainerLuzao(player.inventory, tileEntityLuzao); default: return null; } } @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { switch (ID) { case GuiCanshe: TileEntityCanshe tileEntityCanshe = (TileEntityCanshe) world.getTileEntity(x, y, z); return new GuiCanshe(player.inventory, tileEntityCanshe); case GuiZhuguo: TileEntityZhuguo tileEntityZhuguo = (TileEntityZhuguo) world.getTileEntity(x, y, z); return new GuiZhuguo(player.inventory, tileEntityZhuguo); case GuiLuzao: TileEntityLuzao tileEntityLuzao = (TileEntityLuzao) world.getTileEntity(x, y, z); return new GuiLuzao(player.inventory, tileEntityLuzao); default: return null; } } } Gui: public class GuiCanshe extends GuiContainer { private static final ResourceLocation backgroundimage = new ResourceLocation(Strings.Te + "textures/gui/GuiCanshe.png"); private final TileEntityCanshe tile; public GuiCanshe(InventoryPlayer iP, TileEntityCanshe TEC) { super(new ContainerCanshe(iP, TEC)); this.tile = TEC; xSize = 176; ySize = 166; } @Override public void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { this.fontRendererObj.drawString("Can She", 7, 4, 4210752); } @Override protected void drawGuiContainerBackgroundLayer(float f, int var1, int var2) { this.mc.getTextureManager().bindTexture(backgroundimage); var1 = (this.width - xSize) / 2; var2 = (this.height - ySize) / 2; drawTexturedModalRect(var1, var2, 0, 0, xSize, ySize); if (tile.haveFeed()) { drawTexturedModalRect(var1, var2, 0, 166, 176, 86); } else { drawTexturedModalRect(var1 + 96, var2 + 14, 241, 13, 15, 15); } if (tile.getItem(0) == null) { drawTexturedModalRect(var1 + 67, var2 + 15, 244, 0, 12, 13); } if (tile.isBecomeMoth()) { final int maxsize = 23; float BT = tile.beMothTime * 1.0F; drawTexturedModalRect(var1 + 76, var2 + 52, 176, 0, (int) (maxsize * ((float) tile.nowBeMothTime / BT)), 3); } return; } } Block: public class Canshe extends BlockContainer { public Canshe(CreativeTabs c, Material m, String name) { super(m); this.setBlockName(name); this.setCreativeTab(c); this.setHardness(3f); this.setHarvestLevel("axe", 0); } @Override public int getRenderType() { return -1; } public Item getItemDropped(int a, Random b, int c) { return Item.getItemFromBlock(JiuZhouBlocks.Canshe); } @Override public boolean isOpaqueCube() { return false; } @Override public boolean renderAsNormalBlock() { return false; } @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister Icon) { this.blockIcon = Icon.registerIcon("log_oak"); } public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int par1, float par2, float par3, float par4) { if (world.isRemote) { return true; } if (entityPlayer.isSneaking()) { return true; } entityPlayer.openGui(JiuZhouMod.instance, GuiHandler.GuiCanshe, world, x, y, z); return true; } @Override public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { return new TileEntityCanshe(); } }
  4. Hello! I Install own Mod in my client , and it can work well,but when I try to open it and let it show its guis then the game suddenly collapsed. I don't know what's causing this,and I hope to get helps,My English is not good,I hope you understand what I'm saying,Thanks in advance! Here's my log and my code. [13:36:31] [server thread/ERROR]: Encountered an unexpected exception java.lang.AbstractMethodError at net.minecraft.inventory.Slot.func_75211_c(Slot.java:67) ~[aay.class:?] at net.minecraft.inventory.Container.func_75138_a(SourceFile:64) ~[zs.class:?] at inc.jiuzhou.mod.client.gui.containers.ContainerCanshe.func_75132_a(ContainerCanshe.java:116) ~[ContainerCanshe.class:?] at cpw.mods.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:88) ~[FMLNetworkHandler.class:?] at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2209) ~[yz.class:?] at inc.jiuzhou.mod.common.textile.blocks.Canshe.func_149727_a(Canshe.java:66) ~[Canshe.class:?] at net.minecraft.server.management.ItemInWorldManager.func_73078_a(ItemInWorldManager.java:376) ~[mx.class:?] at net.minecraft.network.NetHandlerPlayServer.func_147346_a(NetHandlerPlayServer.java:556) ~[nh.class:?] at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.func_148833_a(SourceFile:60) ~[jo.class:?] at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.func_148833_a(SourceFile:9) ~[jo.class:?] at net.minecraft.network.NetworkManager.func_74428_b(NetworkManager.java:212) ~[ej.class:?] at net.minecraft.network.NetworkSystem.func_151269_c(NetworkSystem.java:165) ~[nc.class:?] at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:659) ~[MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:547) ~[MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.func_71217_p(IntegratedServer.java:186) ~[bsx.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:427) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:685) [?:?] import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; 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.item.ItemStack; import inc.jiuzhou.mod.common.BlockFunction.tileEntities.TileEntityCanshe; import inc.jiuzhou.mod.common.core.JiuZhouItems; public class ContainerCanshe extends Container { private TileEntityCanshe tile; private int nowBeMothTime; private int beMothTime; private int makeTime; private int nowMakeTime; public ContainerCanshe(InventoryPlayer inventory, TileEntityCanshe TileEntity) { tile = TileEntity; bindPlayerInventory(inventory); bindGuiSlot(); } @Override public boolean canInteractWith(EntityPlayer player) { return true; } protected void bindPlayerInventory(InventoryPlayer inventoryPlayer) { for (int i = 0; i < 3; i++) { for (int j = 0; j < 9; j++) { addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); } } for (int i = 0; i < 9; i++) { addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 142)); } } private void bindGuiSlot() { addSlotToContainer(new Slot(tile, 0, 65, 13) { @Override public boolean isItemValid(ItemStack is) { return tile.haveFeed() ? is.getItem().equals(JiuZhouItems.Can) : false; } }); addSlotToContainer(new Slot(tile, 1, 95, 13) { @Override public boolean isItemValid(ItemStack is) { return is.getItem().equals(JiuZhouItems.Sangye); } }); addSlotToContainer(new Slot(tile, 2, 48, 46) { @Override public boolean isItemValid(ItemStack is) { return is.getItem().equals(JiuZhouItems.Jian); } }); addSlotToContainer(new Slot(tile, 3, 112, 46) { @Override public boolean isItemValid(ItemStack is) { return false; } }); } @Override public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) { return null; } @SideOnly(Side.CLIENT) public void updateProgressBar(int par1, int par2) { if (par1 == 0) { this.tile.nowBeMothTime = par2; } if (par1 == 1) { this.tile.MakeTime = par2; } if (par1 == 2) { this.tile.nowMakeTime = par2; } } @Override public void detectAndSendChanges() { super.detectAndSendChanges(); for (int i = 0; i < this.crafters.size(); ++i) { ICrafting icrafting = (ICrafting) this.crafters.get(i); if (this.nowBeMothTime != this.tile.nowBeMothTime) { icrafting.sendProgressBarUpdate(this, 0, this.tile.nowBeMothTime); } if (this.makeTime != this.tile.MakeTime) { icrafting.sendProgressBarUpdate(this, 1, this.tile.MakeTime); } if (this.nowMakeTime != this.tile.nowMakeTime) { icrafting.sendProgressBarUpdate(this, 2, this.tile.nowMakeTime); } } }

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.