winnetrie Posted March 7, 2018 Posted March 7, 2018 So this is how my constructor looks like for my slabs class: public static final PropertyEnum<BlockBaseSlabColoredA.EnumType> COLOR = PropertyEnum.<BlockBaseSlabColoredA.EnumType>create("color", BlockBaseSlabColoredA.EnumType.class); private final Block modelBlock; private final IBlockState modelState; public BlockBaseSlabColoredA(String name, IBlockState state) { super(state.getMaterial()); this.modelBlock = state.getBlock(); this.modelState = state; IBlockState iblockstate = this.blockState.getBaseState().withProperty(COLOR, BlockBaseSlabColoredA.EnumType.WHITE); if(!this.isDouble()){ iblockstate = iblockstate.withProperty(HALF, EnumBlockHalf.BOTTOM).withProperty(COLOR, BlockBaseSlabColoredA.EnumType.WHITE); } this.setDefaultState(iblockstate); setUnlocalizedName(name); setRegistryName(name); setCreativeTab(CreativeTabs.BUILDING_BLOCKS); setHardness(this.modelState.getBlockHardness(null, null)); setResistance(this.modelBlock.getExplosionResistance(null, null, null, null)); setSoundType(this.modelBlock.getSoundType(null, null, null, null)); setHarvestLevel(this.modelBlock.getHarvestTool(state), this.modelBlock.getHarvestLevel(state)); setLightLevel(0.0F); this.useNeighborBrightness = true; BlockInit.BLOCKS.add(this); } As you can see i have alot of "null" here. I guess i should not do this, but how do i get all these arguments? Quote Try out my new Modpack for MC 1.15.2 https://www.curseforge.com/minecraft/modpacks/terran-civilization
winnetrie Posted March 7, 2018 Author Posted March 7, 2018 Alright i have added this in my class now: @Override public float getExplosionResistance(World world, BlockPos pos, @Nullable Entity exploder, Explosion explosion) { return this.modelBlock.getExplosionResistance(world, pos, exploder, explosion); } @Override public float getBlockHardness(IBlockState blockState, World worldIn, BlockPos pos) { return this.modelState.getBlockHardness(worldIn, pos); } @Override public SoundType getSoundType(IBlockState state, World world, BlockPos pos, @Nullable Entity entity) { return this.modelBlock.getSoundType(state, world, pos, entity); } It all works and no errors. I also deleted those setters in the constructor ofcourse. I hope this is how it should be done. Quote Try out my new Modpack for MC 1.15.2 https://www.curseforge.com/minecraft/modpacks/terran-civilization
Draco18s Posted March 7, 2018 Posted March 7, 2018 I did this for a tile entity of mine. It's a massive headache. The way I went around doing it was to register a dimension, use that dimension as the place to "store" the block/TE information that I wanted. I mapped the six slots in my TE to six locations in the extra dimension (while possible to have two TEs use the same locations, it's not a concern, as the TE checks the BlockPos and if it isn't correct, changes it--there would be GC overhead involved, but the likelyhood that a player does this is small). The chunks in that dimension are chunkloaded while my TE has need of them (any given TE will chunkload at most 1 chunk). And of course, in order to get the world reference, I had to pass things through my Proxy class because the client and server worlds are different. This was less of a hassle than creating a World object that wasn't connected to anything at all (also possible). Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
winnetrie Posted March 7, 2018 Author Posted March 7, 2018 Ok i have no idea how to create this "fake" world. How do i do this? Quote Try out my new Modpack for MC 1.15.2 https://www.curseforge.com/minecraft/modpacks/terran-civilization
Draco18s Posted March 7, 2018 Posted March 7, 2018 https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/src/main/java/com/draco18s/industry/world/FakeWorld.java Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
winnetrie Posted March 7, 2018 Author Posted March 7, 2018 15 minutes ago, Draco18s said: https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/src/main/java/com/draco18s/industry/world/FakeWorld.java I'm sorry, but i fail to see or understand how this is usefull to me and how i even should use this. Quote Try out my new Modpack for MC 1.15.2 https://www.curseforge.com/minecraft/modpacks/terran-civilization
Draco18s Posted March 7, 2018 Posted March 7, 2018 The Fake World code is sprawling and in several files. If you're interested in knowing what I did, peruse my repository. Everything you need is there. I recommend starting here: https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/src/main/java/com/draco18s/industry/entities/TileEntityFilter.java#L169 Follow the references. If you have specific questions, ask. Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
jabelar Posted March 7, 2018 Posted March 7, 2018 A fake world is the proper way to do it, but you could probably be sneaky and place the block somewhere very, very unlikely to cause trouble, like a bedrock location, temporarily and then put it back to bedrock. So basically, set hardness and stuff to some default fixed value in the constructor. Then during world generation run a loop once that takes a bedrock location, cycles through the list of blocks you want to create slabs for, place the block, grab the properties, replace with next block, grab the properties, and so on then put back the bedrock when done. Also, if you only want to handle vanilla blocks you could probably just hardcode the values. A bit of a pain, but you figure out the values (maybe even algorithmically with a simple mod/program) and then read them in. Quote Check out my tutorials here: http://jabelarminecraft.blogspot.com/
winnetrie Posted March 7, 2018 Author Posted March 7, 2018 That looks like a lot of work for something small. I will set it manually for now! Quote Try out my new Modpack for MC 1.15.2 https://www.curseforge.com/minecraft/modpacks/terran-civilization
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.