
Mattizin
Members-
Posts
58 -
Joined
-
Last visited
Everything posted by Mattizin
-
First the client and server values are still not synced, client is 0 server is like it should be. And they i placed a logger in my override method and it didnt print anything
-
Sorry for not giving all inormation, i dont really know what you all need for this: GuiHandler: public class GuiHandler implements IGuiHandler { @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { BlockPos pos = new BlockPos(x, y, z); switch(ID) { case 1: { TileEntity te = world.getTileEntity(pos); if (te instanceof TileEntityCharger) { return new ContainerCharger(player.inventory, (TileEntityCharger) te); } } default: { return null; } } } @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { BlockPos pos = new BlockPos(x, y, z); switch(ID) { case 1: { TileEntity te = world.getTileEntity(pos); if (te instanceof TileEntityCharger) { TileEntityCharger containerTileEntity = (TileEntityCharger) te; return new GuiCharger(containerTileEntity, new ContainerCharger(player.inventory, containerTileEntity)); } } default: { return null; } } } } and the part of the BlockCharger: public static final int GUI_ID = 1; ..... @Override public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { // Only execute on the server if (world.isRemote) { return true; } TileEntity te = world.getTileEntity(pos); if (!(te instanceof TileEntityCharger)) { return false; } player.openGui(MattechBiogas.instance, GUI_ID, world, pos.getX(), pos.getY(), pos.getZ()); return true; }
-
Hi, im currently trying to sync a forge Energy Value between the server and client for gui porpuses. I got the tip to do it like the Vanilla Furnace to cache the value in the container and override detectandsendChanges and updateProgressBar I think im missing something obvious, because detectAndSendChanges doesnt even get called This are the aprts of my container: public class ContainerCharger extends Container { private TileEntityCharger te; private int energy; public ContainerCharger(IInventory playerInventory, TileEntityCharger te) { this.te = te; // This container references items out of our own inventory (the 9 slots we hold ourselves) // as well as the slots from the player inventory so that the user can transfer items between // both inventories. The two calls below make sure that slots are defined for both inventories. addOwnSlots(); addPlayerSlots(playerInventory); } @Override public void detectAndSendChanges() { super.detectAndSendChanges(); for(int i = 0; i < this.listeners.size(); i++) { IContainerListener icontainerlistener = (IContainerListener)this.listeners.get(i); if(this.energy != te.getCapability(CapabilityEnergy.ENERGY, null).getEnergyStored()) { icontainerlistener.sendProgressBarUpdate(this, this.energy, this.te.getCapability(CapabilityEnergy.ENERGY, null).getEnergyStored()); } } this.energy = this.te.getCapability(CapabilityEnergy.ENERGY, null).getEnergyStored(); } @SideOnly(Side.CLIENT) public void updateProgressBar(int id, int data) { ((BaseEnergyStorage)this.te.getCapability(CapabilityEnergy.ENERGY, null)).setEnergyStored(data); }
-
Can someone link me to examples/tutorials for Server/Client TE syncing? I havent done that at all til now and i guess i need it because i want to add an energy bar to the gui and the gui is client stuff
-
Thank you very much, that explains that. I will look into snyching after i implemented my own EnergyStorage to draw the actual energy in teh gui
-
SO the client version of the TE will always start the values again from 0, becuase only the server variant loads the data from nbt. And it is no problem that there are 2 different values as long i dont do client side things with the value?
-
Another question: When i store an EnergyStorage object i can only add Energy via storage#receiveEnergy But how do i implement a way the TE produces Energy but cant receive energy from "outside", cables for example?
-
Im relatively new to TEs so how can a TE be on the client and how can i prevent it? Well for just testing stuff a sysout + strg + enter is the easiest or what am i missing?
-
ah, i completely missed this while thinking about it. So i just create a new EnergyStorage object(i want to use teh default implementation) save it in the TileEntity and return this field at getCapability right? I need to figure out why the TE has 2 different values for energy after world loading then... That makes sense, thanks!
-
Hi, Im learning modding at the moment and im at a point where i try to create a solar panel creating the new "forge energy" Overall everything works like it should, but i have a few questions and problems which i want to ask :=) But first the code i use at the moment: So on to my questions: 1. My TileEntities get created with parameters for capacity and transfer, but it seems like i always need 1 constructor without parameters so the TE can be restored on world load, is this correct? If so, do i have to store the capacity and transfer ints also in NBT and not only the current energy? 2. Syncing. Everything works fine when i sysout the energy. When i close and reload the world it seems like there are 2 TEs for the Block, 1 with the old energy value and 1 new one startig from 0 again. syout looks like this: (164 old value) 164 0 2 4 6 8 10 12 14 16 164 164 164 18 20 164 22 24 164 164 26 164 28 164 30 164 32 164 I think i need to sync something between client and server here? 3. How to check if it is day? My solar panel should produce 2 e/t while its daytime, but the method worldObj.isDaytime() returns: false true false true false true while it is night. How should i check for day time? Thats it for now, thanks in advance
-
Hi, where can i find infos/documentation or tutroials about the Tesselator and how it works so i can learn to do special Render things ? Thanks in advance
-
So it has no impact on Survival Gameplay? Because my question is still if i need to check on this field every time i override onItemUse ?
-
Hi, im creating some Items in which i override the onItemUse Method. In every case i saw it has a check of playerIn.canPlayerEdit(pos.offset(facing), facing, stack) which checks of the field allowEdit in the Player capability true is. When is this false and for what is this needed? Do i need to check this in the method onItemUse? Thanks
-
[1.10.2] Ore dropping itself, not the item intended
Mattizin replied to boredherobrine13's topic in Modder Support
Always use @Override if you want to override functions. it will show an error if the method doesnt exist in the same way in the super class -
or you could check if 2 or 1 blocks in the opposite direction of the leaf is also a wood block. This may work, just an idea.
-
What you are doing there makes absolutely no sense and shows us that you dont know much about java... This forum isnt a java learning forum. Learn atleast java basics to try modding.
-
[SOLVED] [1.10.2] Best way for tons of items / blocks?
Mattizin replied to Zootaxz's topic in Modder Support
Do you have an example for the color thingy? I already do this with enums and metadata for my ores and ingots usw. but didnt know about the method for using one model. -
You need to create localization files in resources/asstets/modid/lang/ for your mod. where you specify unlocalizedName=Localized Name
-
[1.7.10] how i can add my block to MC statistics ?
Mattizin replied to terrainwax's topic in Modder Support
Forge does this for all modblocks in 1.9x now? Thats so cool -
Hi, i looked into the other threads of this kind of error but i couldn't get a solution Here is the error with --info: http://pastebin.com/wiHKhk66 Tanks Matt
-
[1.8.9] Cant resolve Error on an easy blockstates Ore Block..
Mattizin replied to Mattizin's topic in Modder Support
Thank you, i understood the conzept now and with helpof your github project i can reproduce it. Thank you all -
[1.8.9] Cant resolve Error on an easy blockstates Ore Block..
Mattizin replied to Mattizin's topic in Modder Support
Thank you, that works now. I just have to rewrite my method to register the blockrenderer for the normal blocks(not meta) because mc crashes when i use my method at the moment when it is loaded in pre init. I commented it out to test only the meta Block and that worked -
[1.8.9] Cant resolve Error on an easy blockstates Ore Block..
Mattizin replied to Mattizin's topic in Modder Support
OK i tried it lookin into your sourcecode and understand it a bit mroe, but i get the same error still.. latest changes are online: https://github.com/M4tt1z1n/Mattech I think im doing something completely wrong here -
[1.8.9] Cant resolve Error on an easy blockstates Ore Block..
Mattizin replied to Mattizin's topic in Modder Support
Ok i think i got the main point of your reply, but can you give me an example how to use the modelbakery for item rendering for blocks with meta? And how to use registry names instead of unlocalized Names? -
[1.8.9] Cant resolve Error on an easy blockstates Ore Block..
Mattizin replied to Mattizin's topic in Modder Support
So i changed every unlocalizedName (of the oreBlock), jsonfiles (models + blockstates) to lowercase... Still get this: [20:59:31] [Client thread/ERROR] [FML]: Model definition for location mattech:ore#inventory not found See latest Github commit https://github.com/M4tt1z1n/Mattech for my changes. I have no clue what im doing wrong here...