Jump to content
Search In
  • More options...
Find results that contain...
Find results in...


  • Posts

  • Joined

  • Last visited

FireTamer81's Achievements

Tree Puncher

Tree Puncher (2/8)



  1. Basically just the title My current idea is that I can use the "getDrops" method like in the ShulkerBoxBlock class and apply a "item tag" with the data, but I am not sure if an "item tag" is even a thing nor how to properly use the "getDrops" method (do I retain the loot table for the block). Is there another mod that does something like this that isn't related to container items like shulker boxes, just some type of data? If so a link to it would be the only help I need. If not, then would someone mind explaining how this might be done?
  2. After testing around, any of the previous ways I were doing it would have worked had I just put that one thing in value changing methods... dang
  3. Okay, I got it to work, but only because I found a tutorial for 1.11.2 that had markDirty(); on methods that changed the given values which I then tracked to .setChanged(); in the current version.
  4. Okay, non of the methods or fields are static now. I put the default value in the constructor: public StrongBlockTileEntity(TileEntityType<?> tileEntityType) { super(tileEntityType); this.strongBlockHealth = 3000; } But now it doesn't change when I use the Dev Tool on it. I also changed this part maybe an hour ago because I realized it was stupid. (I think the reason it was stupid was because I was supplying the class extending TileEntity instead of the TileEntityType RegistryObject, but not sure) StrongBlockTileEntity strongBlockTile = new StrongBlockTileEntity();
  5. With what I have above, the value does change and stays at the changed value until the world is unloaded. (If I use the Dev Item I made for damaging it 3 times to get to 2700 it will stay there) Just doesn't save NBT wise
  6. I am currently taking Java Classes with my highschool, so I still a little weak on remembering those things. However, I had it static because the "setInitialBlockHealth()" method cannot be referenced when it isn't static by my "onPlace" method in my block class, so then I have to change all the other methods and the "strongBlockHealth" field to static to match. But that then causes the problem above. The value also doesn't change at all when the field and methods are not static.
  7. My goal with this is to have a block with a "Health Value" to both determine whether it should break and it's current model. I currently have that value being set to 3000 when the block is placed down. I don't understand why, but after mimicking both vanilla and other mod examples of saving NBT data in a TileEntity, mine just won't save. I have gotten the actual value/data to work since I can use the "/data get block" command on it, but it always resets to 0 when I close and reload the world. This is my Block Class: public class WarenaiBlock extends Block { public static final IntegerProperty CRACKED_DIRTY_CLEAN_POLISHED = CustomBlockstateProperties.CRACKED_DIRTY_CLEAN_POLISHED; public WarenaiBlock(Properties properties) { super(properties); this.registerDefaultState(this.stateDefinition.any() .setValue(CRACKED_DIRTY_CLEAN_POLISHED, Integer.valueOf(3))); } protected void createBlockStateDefinition(StateContainer.Builder<Block, BlockState> stateBuilder) { stateBuilder.add(CRACKED_DIRTY_CLEAN_POLISHED); } public void onPlace(BlockState p_220082_1_, World p_220082_2_, BlockPos p_220082_3_, BlockState p_220082_4_, boolean p_220082_5_) { StrongBlockTileEntity.setInitialBlockHealth(); } @Override public boolean hasTileEntity(BlockState state) { return true; } @Override public TileEntity createTileEntity(BlockState state, IBlockReader world) { return new StrongBlockTileEntity(); } This is my TileEntity class: public class StrongBlockTileEntity extends TileEntity { private static int strongBlockHealth; public StrongBlockTileEntity(TileEntityType<?> tileEntityType) { super(tileEntityType); } public StrongBlockTileEntity() { this(TileEntityTypesInit.WARENAI_BLOCK_BLACK_STRONGBLOCK_TILE.get()); } public static void damageStrongBlock(int damageAmount) { int currentBlockHealth = strongBlockHealth; strongBlockHealth = currentBlockHealth - damageAmount; } public void repairStrongBlock(int repairAmount) { int currentBlockHealth = strongBlockHealth; strongBlockHealth = currentBlockHealth + repairAmount; } public static int getStrongBlockHealth() { return strongBlockHealth; } public static void showBlockHealth() { System.out.println("Block Health is: " + getStrongBlockHealth()); } public static void setInitialBlockHealth() { strongBlockHealth = 3000; } /** * Overrides */ @Override public CompoundNBT save(CompoundNBT tags) { super.save(tags); tags.putInt("BlockHealth", this.strongBlockHealth); return tags; } @Override public void load(BlockState state, CompoundNBT tags) { super.load(state, tags); strongBlockHealth = tags.getInt("BlockHealth"); } } I also have two "Development Tools" that I made to manipulate the BlockHealth Value which do work: public class DamageItem extends Item { public DamageItem(Properties properties) { super(properties); } @Override public ActionResultType useOn(ItemUseContext context) { World worldIn = context.getLevel(); BlockPos blockPos = context.getClickedPos(); BlockState blockState = worldIn.getBlockState(blockPos); //Block warenaiClassBlock = blockState.getBlock(); boolean warenaiClassBlock = blockState.getBlock() instanceof WarenaiBlock; if (blockState.hasTileEntity() && warenaiClassBlock) { StrongBlockTileEntity strongBlockTile = new StrongBlockTileEntity(); strongBlockTile.damageStrongBlock(50); //strongBlockTile.showBlockHealth(); return ActionResultType.SUCCESS; } else { return ActionResultType.PASS; } } }
  8. Okay, that's what I thought. So now I just need to figure out how to do the health within the tile entity, and then make it persist even when broken using NBT. I do have one question though: The idea is that this will be a general building block (semi-hard to craft though), so will each of the blocks having a tile entity and all of this stuff affect performance a notable amount, or not because it is fairly simple?
  9. As the name implies I am trying to make a block with a "condition" value. I am doing this because I will be adding future features where a very strong type of block would be useful. I have started out with making a simple custom blockstate property (1-4) which determines the model (Polished, Un-polished, scuffed, cracked). However, I want those 4 states to then be determined by a larger number (more wiggle room with how much damage a certain event can do to this type of block). I was thinking 3000-5000, which I can then say "oh the block durability has to be at 200 to be cracked, but 750 for scuffed". I think the large health number think could be done with a tile entity I also want certain states to be maintained even after it has been picked up such as the larger number (maybe not the 1-4 since I think I would have to do something funky with datagen for my 90 items to have 360 item models), so perhaps NBT (which I have never done before). ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ I could probably figure this out on my own given a good bit of time, but dual-enrollment does not allow much time in a day. So, basically just looking either for a github repos that shows persistent data & some funky tile entities (if that is the best route for the block health thing), or suggestions.
  10. While chugging along making the JSONs by hand (to get an idea of how they need to be generated for each type of block), I cam up with a possibly brilliant idea. Could I somehow make template JSONs and when a new block of a certain type is being generated it will just pull the template and replace certain keywords like "NAME" and "COLOR" instead of all of this getVariantBuilder stuff
  11. I am not sure whether this will help you since I have it in 1.16, but this is the repo for my testing mod for a branch where I made a custom fluid (that uses a grayscale texture and assigns color dynamically). Perhaps it can at least help a little bit. Good luck mate! https://github.com/FireTamer81/1.16.5-Testing-Mod/tree/Custom-Colorable-Fluid
  12. So, I am rewriting my mod in an effort to do it MUCH better. I don't want to have to deal with copying, pasting, and editing 5,280 JSON files (yes I counted), so I am working on datagen. I Want to add the features I was saying "ah, I'll do it later" to, so I am doing them. Etc........ Well, right now I am making a type of block with a custom blockstate property (an integer value of 1-4), which will make it change it's model. I have that done and have it working... with handwritten JSONS. Now I am wanting to do it in datagen since I will be making I think 48 actual full blocks, which would need 288 JSON files. Which I would then be doing something similar for Stair, Slab, Fence, and Wall variants. So basically, I really need to do it datagen, just don't know how. Would any of you folk have suggestions or perhaps github repos that show datagen with custom blockstate properties, or perhaps even just how to use the "getVariantBuilder" thing since I will be doing the whole custom blockstate property to stairs, fences, and walls as well.
  13. Oh boy, that seem complicated.... oh well. Never learn how to do it if I don't try. Would you perhaps know of a couple mods that do either something similar to what I am trying to doing or just make their own ChunkGenerator & NoiseGenerator I could look at on github? Also, thank you for the help mate!
  14. Not sure about custom chunk generators (I haven't done much super complex stuff yet, but working on it). For a time I did try making separate biomes with radical heights and asking them dot around, but I could never get them small enough the normal way through the jsons. What would a custom chunk generator entail?
  15. I remember someone saying something about "Noise Deformation" when I was trying to do a thing with my custom dimension. Not sure how it works or where I would start, I just went with making a making a couple structures and having them placed in the dimension that look somewhat like the spires in this image: Even though I had my quarrels with it such as having a layer of dirt underneath them, and repetitiveness among others, I just wanted to get done with the dimension for a bit of time. Now, I am wanting to polish some stuff a bit and want to understand what replacing the whole structure thing with "noise deformation" would entail. Is it worth the effort, how much effort, is there a lot of math involved, etc.
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.