HalestormXV
Forge Modder-
Posts
328 -
Joined
-
Last visited
Everything posted by HalestormXV
-
[1.11.2] Custom Furnace - Last Step, Saving Data Help [SOLVED]
HalestormXV replied to HalestormXV's topic in Modder Support
BUMP - i'm almost there, and I do recognize what you said Draco but the block is actually switching the state, the TileEnttiy is just calling the switch. Perhaps thats why putting the update in the TileEntity class isn't working because maybe once the block switches the state it needs to let minecraft know? Or maybe I'm just an idiot but like I said this is the first time dabbling in this with 1.11.2 at least so it is probably super easy and I am just missing it. -
[1.11.2] Custom Furnace - Last Step, Saving Data Help [SOLVED]
HalestormXV replied to HalestormXV's topic in Modder Support
Thats done in the blockClass of my furnace: (it already uses the 3 flag which I thought was the update) public static void setState(boolean active, World worldIn, BlockPos pos) { IBlockState state = worldIn.getBlockState(pos); TileEntity tileEntity = worldIn.getTileEntity(pos); if(active) worldIn.setBlockState(pos, eAngelusBlocks.dual_furnace.getDefaultState().withProperty(FACING, state.getValue(FACING)).withProperty(BURNING, true), 3); else worldIn.setBlockState(pos, eAngelusBlocks.dual_furnace.getDefaultState().withProperty(FACING, state.getValue(FACING)).withProperty(BURNING, false), 3); if(tileEntity != null) { tileEntity.validate(); worldIn.setTileEntity(pos, tileEntity); } } In the TileEntity it is done right here: (in the void update() near the end ) if(flag != this.isBurning()) { flag1 = true; DualFurance.setState(this.isBurning(), this.world, this.pos); } } if(flag1) this.markDirty(); } If I call the sendUpdates right below the DualFurance.setState(this.isBurning(), this.world, this.pos) it doesn't seem to do anything. Unless I have to call this in my blockClass since that is where the states are actually being switched and the TileEntity is just calling the method to do the switching? -
[1.11.2] Custom Furnace - Last Step, Saving Data Help [SOLVED]
HalestormXV replied to HalestormXV's topic in Modder Support
Okay that makes sense. So in other words if the block still has some burnTime left in it then we have to update the block to indicate as such. So where would that function be called? At the end of the update() function? Rather than have the this.markDirty() at the end of it I should have the equivalent of a sendUpdates() since that in and of itself does do a markDirty()? -
[1.11.2] Custom Furnace - Last Step, Saving Data Help [SOLVED]
HalestormXV replied to HalestormXV's topic in Modder Support
I didn't need to. I managed to fix 90% of it. I mixed my functions up. I utilized loadAllItems in the write and loadAllItems again in the Read. I should have utilized ItemStackHelper.SaveAllItems in the write and ItemStackHelper.LoadAllItem in the read. The only issue I have left now is the furnace_on texture. The block is not saving the "burning" to true therefore when you log back in or restart the server, everything is still there and the burnTime is calculating and the smelting progress is saved but the block face is not "on" becasue it doesnt realize it is still smelting. Any idea how to remedy that? Can you perhaps save a BlockState to the NBT so the game knows it is still "burning"? And if so how would one go about that? -
[1.11.2] Custom Furnace - Last Step, Saving Data Help [SOLVED]
HalestormXV replied to HalestormXV's topic in Modder Support
Okay so I took a look at the sync code and I have seen that exact code before although it had some added to it: @Override public SPacketUpdateTileEntity getUpdatePacket() { NBTTagCompound nbt = new NBTTagCompound(); this.writeToNBT(nbt); int metadata = getBlockMetadata(); return new SPacketUpdateTileEntity(this.pos, metadata, nbt); } @Override public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt) { this.readFromNBT(pkt.getNbtCompound()); } @Override public NBTTagCompound getUpdateTag() { NBTTagCompound nbt = new NBTTagCompound(); this.writeToNBT(nbt); return nbt; } @Override public void handleUpdateTag(NBTTagCompound tag) { this.readFromNBT(tag); } @Override public NBTTagCompound getTileData() { NBTTagCompound nbt = new NBTTagCompound(); this.writeToNBT(nbt); return nbt; } I tried both the code you linked and the code above and the same issue is occuring. Inventory is clearing itself out. I know now that ItemStackHandler objects (and getCapability()) is what the new and correct standard is but is there a way I can solve this with the current setup? Then going forward utilize the correct standard? I would have no way to know how to convert my current setup to utilzie the above unless it is simply a matter of switching things out. And I do appreciate you showing me the correct way becasue going forward I now know what to do, but hopefully there is a way to fix this with my current setup. -
I figured this out. I brain farted and forgot I could just look at the furnace.json file in the src and mimic it and the same for the lit version. I left the post here though in case anyone else was interested.
-
Alright so I found this outstanding thread here on the forums: That basically provides perfect examples of how to intergrate the ability to spawn structures using NBT data. It is excellent and it works wonderfully. I am having an issue with it though. a post in that thread provided sample code which I utilized to spawn my own structures. Here is the class: https://pastebin.com/RjzU1Zbs - generateStructure And here is my worldGen class: https://pastebin.com/Z64VDCKR (Line 52 is where the alter spawn is) So it works great and the log does indicate the location that my structures are spawning (yes they are supposed to be rare so that spawn chance of 1 is intentional). However, the issue I am running across is the structures are not spreading out. They are spawning in a consolidated area and sometimes ontop of each other. Here is the log: https://pastebin.com/7ZEtK4iD As you can tell the coords are basically on top of each other. I am aware that this is likely beause on my worldGen class my X, Y and Z are in relatively close range of each other. But this is the first time I am working with structures so I can't be too sure. Any ideas on how to spread this out and maybe only make this happen once per chunk so they are not spawning on top of each other and how to make it so they are much more spread out coordiante wise?
-
[SOLVED] [1.11.2] Locking a Chest - Just Need Confirmation
HalestormXV replied to HalestormXV's topic in Modder Support
Yeah it works on both but they are both Dev environment so before I push it live and then find out something is wrong (Which I know is sometimes the only way to do it) I wanted to ask here first. Any thoughts on using the UUID instead of the player name? Would the setPersistentID and getPersistentID be the way to go about that? -
[SOLVED] [1.11.2] Locking a Chest - Just Need Confirmation
HalestormXV replied to HalestormXV's topic in Modder Support
BUMP -
Hey everyone, in my mod I have added in the ability for players to "lock their chest", this is mainly for SMP so that chests owned by players cannot be broken or opened unless they are the player that locked the said chest. This was a relatively simple setup, but it felt as if it was almost too simple. Can someone maybe take a look at this code and tell me if anything is wrong with it? It seems to actually work in my Dev environment, but as we know the Dev environment is the Dev Environment. I wouldn't want to push this to live and then it turns out something was wrong with it from the start. Furthermore, as you can see I commented out some lines Specifically: tileTag.setString("divinationLock_k_pname", player.getPersistentID().toString()); (in the item class) if (!tileTag.getUniqueId("divinationLock").equals(event.getEntityPlayer().getPersistentID())) (in my chest handler) and I had tileTag.setUniqueID("divinationLock_k_pname", player.getPersistentID()); in my item class I think, but I may have erased it. I mainly did those to add UUID support to the item in the event the player changes their name. Is that the correct way to do it? However the UUID support question is last on the prioirty. I just need to know if the code that i have now is accurate and looks as if it can work. And yes I did do debugging of course, but sometimes a fresh set of eyes works wonders. https://pastebin.com/ZcLpgh7Y - Item Class https://pastebin.com/PJFJzqKn - Chest Handler
-
Now last question. Is there possibly a more efficent way to do this then what I have in my mind. In my mind I am thinking of Subscribing to an onLivingUpdate that checks if that value has changed and if it has then it will execute my code. However, that is always running every tick so I worry about efficency and resources, or is there so little impact that it shouldn't matter too much?
-
Excellent and I am imagining that stat gets adjusted by +1 every time a successful trade has been made correct? I'd test on my own but I am actually away from my code at this time.
-
ever traded. So they find any villager and make a trade with any villager -> X hapens. It wouldn't be linked to the specific villager they traded with.
-
Just curious to know if there is a way to detect if a player has traded with a Village. I am trying to write something that will change/record some info but only if the player has traded with a village.
-
[1.11.2] Using NBT to Craft/Create Items?
HalestormXV replied to HalestormXV's topic in Modder Support
Thanks, in doing some testing and information collecting I found more of my users wanted the ability to go "find" alters and use the item on an alter to convert it (kinda how AoA used to work), so onBlockAcitvated is what I will likely be using now. However a custom IRecipe feature might be interesting for other stuff. Thanks for the suggestion. -
I know NBT is super powerful. So I decided to go a different route on one of my mods to break away from the craft me craft you approach. So I have an LivingDeath event that I am subscribed to which works fine. And what the event does is when you kill a hostile mob, if you have an item in your inventory it writes some info to that items NBT. Nothing fansy but it works very well. But what I want to do is be able to rely on that NBT data to craft something else. So is there a way to craft something and check that NBT data first. So for example if I have my item which has 18 kills saved into its NBT I want to be able to "transform" that item via crafting or using maybe a block or something (like right click on one of my custom blocks with the item kinda like Advent of Ascension) and then have that item "transform/be crafted" into another item. In summary is there a way to craft an item or right click a block with the item into something else by first validating that it has the proper NBT values AND then turn it into the new item. (Even if that item is just a subItem)
-
WOW! I am a frigen idiot. How did I forget to change that in my .build. Thats what happens when you rush ladies and gents. Thanks @diesieben07 I resolved it.
-
Having an issue when trying to build my mod. Not sure if it is compiler related or not. But here is the errors I am getting. https://pastebin.com/svLpiTNH Not sure whats wrong exactly? (why or how would you need to declare the message variable final) It works when I do a test. But now that I tried to build it this is happening. Here is the class it is pointing to. https://pastebin.com/mdGEdw7h Not sure whats wrong. Like I said, only showed up when I tried to build the mod. Help is apprecaited. And yes I read the compiler error but I don't know how to fix it or if there really is soemthing wrong or it is just my compiler. Using ItelliJ.
-
[1.11.2] EntityThrowable only Renders Partly?
HalestormXV replied to HalestormXV's topic in Modder Support
Bump - still having this issue unfortuantly. It's one of the only things stopping the release of my mod lol. So any help is appreciated. -
[SOLVED][1.12] Throwable Entity not rendering
HalestormXV replied to JimiIT92's topic in Modder Support
I'm just curious to know how you fixed this? I am having the same issue. The item basicaly mimics a snowball but only renders on the client partially. It doesn't render all the way. And it will only render if you are looking at it from an angle or moving around while firing it. -
[1.11.2] EntityThrowable only Renders Partly?
HalestormXV replied to HalestormXV's topic in Modder Support
Changed them and still the exact same result. Only renders like in the video clip above. Talk about icnredibly frustrating. -
[1.11.2] EntityThrowable only Renders Partly?
HalestormXV replied to HalestormXV's topic in Modder Support
Bump, if anyone might know how to fix this? Here is the link to the example again. And the classes haven't changed. https://www.dropbox.com/s/4k0eibj8zetmnot/Example.mp4?dl=0 -
[1.11.2] Proper Way to Do SubItems Textures Issue
HalestormXV replied to HalestormXV's topic in Modder Support
I see, well last I started coding was 1.7.10 and a little in 1.8.9 and then about 2 weeks ago got back into modding and jumped to 1.11.2, so I imagine quite a bit has changed that I am sure I will encounter along the way. But I thank you for your pateince and for the help. It is greatly apprecaited. -
[1.11.2] Proper Way to Do SubItems Textures Issue
HalestormXV replied to HalestormXV's topic in Modder Support
Looks like I had to make the same change to my block class. Everything seems to be working now and I need to seriously clean up the code a bit for my next gihub push. But for my own edification sake. Was that method I was using a pre 1.11.2 method hense why it was still working? Or has this ModelLoader always been the preferred method?