Jump to content

minipopov1

Members
  • Posts

    16
  • Joined

  • Last visited

Everything posted by minipopov1

  1. So i fail to draw this, so i stick 2 textures, one for my panel and another for my container.
  2. Hi, Does minecraft limit the texture size ? I create an image (512*512) which contains my gui. BUt when i m trying to load my gui, i ve got 4 gui(i think it s 256*256). How can i create a gui more tall than 256? Thanks for reading
  3. So, i never succeed in doing sync my tile entity in 1.6.4... But in 1.7.2 with the simple network wrapper, i sync my tile entity well. Thanks for your help anyway
  4. Cause i wanna make mod for minecraft 1.6.4. There is no 1.7.2 mod pack on FTB. So i must make a custom packet to get the tile entity of server and copy it over the tile entity client?
  5. SimpleNetworkWrapper work on minecraft forge 1.6.4 or it implements with forge 1.7? My IDE don't know this class, IMessage, IMessageHandler, and method for register a channel
  6. i was looking the wiki => http://www.minecraftforge.net/wiki/Category:Tutorial
  7. I don't see this tutorial. Only tutorial on packetHanlder. I ll search on google
  8. Sorry, i don't resolve my problem. I change this to my function: public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are) { StrikingMachineTileEntity tileEntity = (StrikingMachineTileEntity) world.getBlockTileEntity(x, y, z); if (tileEntity == null || player.isSneaking()){ return false; } ByteArrayOutputStream bos = new ByteArrayOutputStream(; DataOutputStream outputStream = new DataOutputStream(bos); try { outputStream.writeInt(x); outputStream.writeInt(y); outputStream.writeInt(z); } catch (Exception ex) { ex.printStackTrace(); } Packet250CustomPayload packet = new Packet250CustomPayload(); packet.channel = Utilities.CHANNEL; packet.data = bos.toByteArray(); packet.length = bos.size(); player.openGui(Utilities.instance, GUIHandler.GUI_STRINKINGMACHINE, world, x, y, z); return true; } And to update, i make my packet handler and i try to copy the tile entity from the server to the client. @Override public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player) { DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(packet.data)); try{ int x = inputStream.readInt(); int y = inputStream.readInt(); int z = inputStream.readInt(); EntityPlayerMP playerMP = (EntityPlayerMP)player; TileEntity te = playerMP.worldObj.getBlockTileEntity(x, y, z); if(te != null){ if(te instanceof StrikingMachineTileEntity){ StrikingMachineTileEntity tet = (StrikingMachineTileEntity)te; playerMP.worldObj.markBlockForUpdate(x, y, z); } } } catch (IOException e){ e.printStackTrace(); } } But it doesn't work. What's wrong in my code???
  9. Ok, thanks dude i see where is the probleme now. I ll try to fix it.
  10. I don't understand why i need packet handler. Cause if i set : public int famount = 10000; And in my gui i set my function getFluidAmount from : public int getFluidAmount(){ return tank.getFluidAmount(); } to public int getFluidAmount(){ return famout; } My function return to my gui 10000. So packet handler is needed for my tileentity to get the value of one of his var? That s something strange..?
  11. OK, i never use this. I m going search a tutorial on minecraft forge
  12. Hello, I m doing my first mod and i wanna to make a block which use water. In gui i want see how many water are in this block. So, this is my tile entity of my block public class StrikingMachineTileEntity extends TileEntity implements ISidedInventory, IFluidHandler { public class Tank extends GenericFluidTank{ public Tank(int capacity) { super(capacity); } @Override public boolean canAccept(FluidStack fluid){ switch(fluid.fluidID) { case 1: return true; default: return false; } } } public Tank tank; ... @Override public int fill(ForgeDirection from, FluidStack resource, boolean doFill) { return tank.fill(resource, doFill); } @Override public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) { return tank.drain(resource, doDrain); } @Override public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) { return tank.drain(maxDrain, doDrain); } @Override public boolean canFill(ForgeDirection from, Fluid fluid) { return true; } @Override public boolean canDrain(ForgeDirection from, Fluid fluid) { return true; } @Override public FluidTankInfo[] getTankInfo(ForgeDirection from) { return new FluidTankInfo[]{tank.getInfo()}; } public int getFluidAmount(){ return tank.getFluidAmount(); } public FluidStack getFluid() { return tank.getFluid(); } public int getCapacity(){ return tank.getCapacity(); } } Now this is my class for my tnak public class GenericFluidTank implements IFluidTank{ private FluidStack fluid; private boolean changeType; private int capacity; public GenericFluidTank(FluidStack type, int capacity) { if(type == null) { fluid = new FluidStack(0, 0); this.changeType = true; } else fluid = FluidUtils.copy(type, 0); this.capacity = capacity; } public GenericFluidTank(int capacity){ this(null, capacity); } @Override public int getCapacity(){ return capacity; } @Override public FluidStack getFluid() { return fluid.copy(); } @Override public FluidTankInfo getInfo() { return new FluidTankInfo(this); } @Override public int fill(FluidStack resource, boolean doFill) { if(resource == null || resource.fluidID < 0){ return 0; } if(!canAccept(resource)){ return 0; } Console.println("Fluid amout before : " +this.getFluidAmount()); int tofill = Math.min(getCapacity()-this.fluid.amount, resource.amount); if(doFill && tofill > 0) { if(!this.fluid.isFluidEqual(resource)){ this.fluid = copy(resource, fluid.amount+tofill); }else{ this.fluid.amount+=tofill; } onLiquidChanged(); } Console.println("Fluid amout after : " +this.getFluidAmount()); return tofill; } @Override public FluidStack drain(int maxDrain, boolean doDrain) { if(fluid.amount == 0 || maxDrain <= 0) return null; int todrain = Math.min(maxDrain, fluid.amount); if(doDrain && todrain > 0) { fluid.amount-=todrain; onLiquidChanged(); } return FluidUtils.copy(fluid, todrain); } public FluidStack drain(FluidStack resource, boolean doDrain) { if (resource == null || !resource.isFluidEqual(fluid)) return null; return drain(resource.amount, doDrain); } public void onLiquidChanged() { } public boolean canAccept(FluidStack type){ return type == null || type.fluidID <= 0 || (fluid.amount == 0 && changeType) || fluid.isFluidEqual(type); } public static FluidStack copy(FluidStack liquid, int quantity) { liquid = liquid.copy(); liquid.amount = quantity; return liquid; } public NBTTagCompound toTag() { return FluidUtils.write(fluid, new NBTTagCompound()); } public void fromTag(NBTTagCompound tag) { fluid = FluidUtils.read(tag); } @Override public int getFluidAmount() { return this.fluid.amount; } } And now my class for my gui @Override protected void drawGuiContainerBackgroundLayer(float f, int i, int j) { // TODO Auto-generated method stub GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(background); int var5 = (this.width - this.xSize) / 2; int var6 = (this.height - this.ySize) / 2; this.drawTexturedModalRect(var5, var6, 0, 0, this.xSize, this.ySize); // Progress Bar int x = (this.width - this.xSize) / 2; int y = (this.height - this.ySize) / 2; double ratioPixelBar = (double) 112/tileEntity.getCapacity(); int stored = tileEntity.tank.getFluidAmount(); Console.println("Fluid amount for gui :" +stored); //int stored = (int)(tileEntity.( ) *ratioPixelBar); //int stored = 0; this.drawTexturedModalRect(x + 32, y + 24, 0, 166, stored, 7); } Well, now i ll show you the output So when i don't open the machine block, we can see the fluid amount up 2014-06-14 14:44:11 [iNFOS] [sTDOUT] Fluid amout before : 0 2014-06-14 14:44:11 [iNFOS] [sTDOUT] Fluid amout after : 0 2014-06-14 14:44:11 [iNFOS] [sTDOUT] Fluid amout before : 0 2014-06-14 14:44:11 [iNFOS] [sTDOUT] Fluid amout after : 90 2014-06-14 14:44:11 [iNFOS] [sTDOUT] Fluid amout before : 90 2014-06-14 14:44:11 [iNFOS] [sTDOUT] Fluid amout after : 90 2014-06-14 14:44:11 [iNFOS] [sTDOUT] Fluid amout before : 90 2014-06-14 14:44:11 [iNFOS] [sTDOUT] Fluid amout after : 180 2014-06-14 14:44:11 [iNFOS] [sTDOUT] Fluid amout before : 180 2014-06-14 14:44:11 [iNFOS] [sTDOUT] Fluid amout after : 180 2014-06-14 14:44:11 [iNFOS] [sTDOUT] Fluid amout before : 180 2014-06-14 14:44:11 [iNFOS] [sTDOUT] Fluid amout after : 268 2014-06-14 14:44:11 [iNFOS] [sTDOUT] Fluid amout before : 268 ... 2014-06-14 14:44:34 [iNFOS] [sTDOUT] Fluid amout after : 12000 2014-06-14 14:44:34 [iNFOS] [sTDOUT] Fluid amout before : 12000 I get the fluidamount by the function in my GenericTankFluid (getFluidAmount); But the probleme is when i open the gui 2014-06-14 14:44:42 [iNFOS] [sTDOUT] Fluid amount for gui :0 Somebody can tell me where my fluid is gone? i don't realy understand why i don't get the good value. While i open the gui, i can already see this line 2014-06-14 14:44:42 [iNFOS] [sTDOUT] Fluid amount for gui :0 2014-06-14 14:44:42 [iNFOS] [sTDOUT] Fluid amout before : 12000 2014-06-14 14:44:42 [iNFOS] [sTDOUT] Fluid amout after : 12000 Tanks if people read all my post ^^
  13. Hello, I wanna make a machine block who can contain fluid, so in tileEntity class i must add IFluidTank. To insert the fluid, i would use thermal expansion with fluiduct. But i don't see any api to do this. I search another mod which use TE like this one https://github.com/Vexatos/ThermalQuarry and i don't see api. So, is my mod must be compatible with cofh? Or thermal expansion or whatever?
  14. Hum, ok, so i m gonna probably set user cfg to do this.. but i don't think that is realy good. Thanks for your answer
  15. Hello, I m working on my first mod and i would know what leave can drop. I want retrive the id of sapling from leave. For exemple if i have itemStak of oak's leave, i wanna retrive the oak sapling. Someone know hos to do this work?
×
×
  • Create New...

Important Information

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