Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/15/20 in all areas

  1. My world type generates only 1 biome. So I use SingleBiomeProvider.
    1 point
  2. Its because calling the deprecated version looks like this: world.getBlockState(pos).getBlock().getShape(world.getBlockState(pos),pos) Notice how getBlockState is called twice? Now, this is how you call the BlockState version: world.getBlockState(pos).getShape(pos)
    1 point
  3. Hi This example project might help (mbe20) https://github.com/TheGreyGhost/MinecraftByExample You are probably missing one of these methods: // When the world loads from disk, the server needs to send the TileEntity information to the client // it uses getUpdatePacket(), getUpdateTag(), onDataPacket(), and handleUpdateTag() to do this: // getUpdatePacket() and onDataPacket() are used for one-at-a-time TileEntity updates // getUpdateTag() and handleUpdateTag() are used by vanilla to collate together into a single chunk update packet Cheers TGG
    1 point
  4. The filenames of many of your mods suggest you downloaded them from a Bad Website (such as 9 minecraft or something). Mods hosted on these sites are often doing so without permission, and may have outdated or modified/tampered with versions. You should only download mods from curseforge.com or directly from the mod authors website. See https://stopmodreposts.org/ for more information and a list of bad websites to definitely not download mods from. I would delete all of your mods, and redownload them from curseforge.
    1 point
  5. Hi Yeah it's a bit weird. It helps to know the history- originally there was just the Block class with those methods, and you had to pass a 4-bit 'metadata' to most functions. Then Mojang added BlockStates which was more-or-less Block plus metadata. So they put a 'deprecated' onto the Block functions to say "don't call these Block functions any more, call the BlockStates instead". Not really what @deprecated is intended for, but then again Minecraft isn't an API by any stretch of the imagination either. Just ignore it is what I usually do... if it breaks next version update, I'll fix it along with the other 50 things that got broken -TGG
    1 point
  6. Yeah, looks like you simply forgot a step. Call ModLoadingContext#registerConfig to do the actual registration. I personally just do it in my mod's constructor method, not sure if there's a better place for it.
    1 point
  7. I assume there's one on the client and one on the server. The one on the client likely doesn't know what ticksLifeTime is because it is initialized in the constructor, but when it spawns on the client it doesn't use that constructor use the EntityDataManager field in the Entity class to store your lifetime and alive count.
    1 point
  8. Hi Mojang means "Call the corresponding BlockState function, don't call the Block function". It doesn't mean "you must not override this method when you extend the Block class". Basically you can ignore the @deprecated, it's just an advice that there might be a better way. In this case (extending the block class), there is no better way. -TGG
    1 point
  9. Hi >Thanks for the response! So to do this, would I basically need to add a value for every modified block containing the location and energy values (and potentially the block type as well) of each block? Yeah, pretty much. You might use (say) a HashMap of BlockPos vs energy value for all blocks which are are partially depleted. The block type is stored already (in the World) so you don't need to store that. You might also need some sort of second datastructure (eg HashSet) for blocks which are permanently depleted. I think you also need to decide how the game should react if the data structures get too big and you need to cull them from memory. What's your game mechanic for that? eg Do you strip out the depleted blocks which are a long way away? ("Natural energy regenerates instantly when there are no spellcasters within X radius") If too many blocks get fully depleted in an area, does it destroy the entire chunk? ("If the flow of natural energy is sufficiently disturbed, then all natural energy in the area sickens and dies") If those have an unacceptable game impact, you might need to split your data structure into chunks and store them in parallel with normal world data. i.e. hook into the chunk loading and unloading events, and load+unload your own datastructures in parallel with those. WorldSavedData might not be suitable for storing large amounts of data (I'm not sure); you may need to write your own datastructures on disk similar to how the chunk system does it, i.e. allows you to modify chunks within the file without having to rewrite the entire file. That would be more complicated but it would still work if you're careful. -TGG
    1 point
  10. Mojang marked them as deprecated. Deprecated means "do not call this function." They aren't deprecated in the BlockState class because you're supposed to call the methods in the blockstate class. I'm sure if you searched the forums you'd find a dozen threads about this. Its been like this since IBlockState was introduced (1.10ish) No. I'm not sure what you're trying to do, but no. That would be Wrong.
    1 point
  11. Hi I don't think it's possible to directly add this information to vanilla blocks. If it were your own blocks, you could have blockstates for each one (say 16 levels) or a tileentity. However it's certainly possible to maintain a parallel data structure of your own which stores the energy level for every block (or perhaps more efficiently - every partially depleted block) - you can store it in WorldSavedData, and can update it regularly using server world tick. You may need to be careful about chunks loading in or out (not trying to update information for chunks which have been unloaded because the player is a long way away, for example) but it wouldn't be particularly difficult. If there are other mods which seem to do something similar, you could look at their source code too. -TGG
    1 point
  12. Hi This link might help with some background information on VoxelShapes and why you might need them. https://greyminecraftcoder.blogspot.com/2020/02/block-shapes-voxelshapes-1144.html -TGG
    1 point
  13. Howdy This example project might be helpful https://github.com/TheGreyGhost/MinecraftByExample see mbe02 The blue patch is caused by incorrect VoxelShape (default is full cube), if you set that correctly the problem will be be fixed -TGG
    1 point
  14. Yes the VoxelShape methods are what you use for this. I just checked in my version it is.
    1 point
  15. I believe you do this via Block.Properties::notSolid or something similar.
    1 point
  16. My mod add a new world type which generates only my biome. My biome is made by 1 block and fluids. WorldType: public class TestWorldType extends WorldType { public TestWorldType() { super("testworld"); } @Override public ChunkGenerator<?> createChunkGenerator(World world) { if (world.getDimension().getType() == DimensionType.OVERWORLD) { OverworldGenSettings overworldGenSettings = new OverworldGenSettings(); SingleBiomeProviderSettings biomeProviderSettings = new SingleBiomeProviderSettings(world.getWorldInfo()); biomeProviderSettings.setBiome(TestWorld.TEST_BIOME); overworldGenSettings.setDefaultBlock(TestWorld.TEST_BLOCK.getDefaultState()); return new OverworldChunkGenerator(world, new SingleBiomeProvider(biomeProviderSettings), overworldGenSettings); } else return super.createChunkGenerator(world); } } Biome(I refered to PlainsBiome): public class TestBiome extends Biome { private static final BlockState WATER = Blocks.WATER.getDefaultState(); private static final BlockState LAVA = Blocks.LAVA.getDefaultState(); public static final BlockState TEST_BLOCK_STATE = TestWorld.TEST_BLOCK.getDefaultState(); public static final TreeFeatureConfig TEST_TREE_CONFIG = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(TEST_BLOCK_STATE), new SimpleBlockStateProvider(TEST_BLOCK_STATE), new BlobFoliagePlacer(2, 0))).baseHeight(4).heightRandA(2).foliageHeight(3).ignoreVines().setSapling((IPlantable) TestWorld.TEST_BLOCK).build(); public static final BlockStateProvidingFeatureConfig HAY_PILE_CONFIG = new BlockStateProvidingFeatureConfig(new SimpleBlockStateProvider(TestWorld.TEST_BLOCK.getDefaultState())); public TestBiome() { super((new Builder()).surfaceBuilder(SurfaceBuilder.DEFAULT, new SurfaceBuilderConfig(TEST_BLOCK_STATE, TEST_BLOCK_STATE, TEST_BLOCK_STATE)).precipitation(RainType.RAIN).category(Category.PLAINS).depth(0.125F).scale(0.05F).temperature(0.8F).downfall(0.4F).waterColor(4159204).waterFogColor(329011).parent((String) null)); TestVillagePools.init(); this.addStructure(Feature.VILLAGE.withConfiguration(new VillageConfig("village/test/town_centers", 6))); this.addCarver(GenerationStage.Carving.AIR, Biome.createCarver(new TestCaveWorldCarver(ProbabilityConfig::deserialize, 256), new ProbabilityConfig(0.14285715F))); this.addCarver(GenerationStage.Carving.AIR, Biome.createCarver(new TestCanyonWorldCarver(ProbabilityConfig::deserialize), new ProbabilityConfig(0.02F))); this.addFeature(GenerationStage.Decoration.LOCAL_MODIFICATIONS, new TestLakesFeature(BlockStateFeatureConfig::func_227271_a_).withConfiguration(new BlockStateFeatureConfig(WATER)).withPlacement(Placement.WATER_LAKE.func_227446_a_(new ChanceConfig(4)))); this.addFeature(GenerationStage.Decoration.LOCAL_MODIFICATIONS, new TestLakesFeature(BlockStateFeatureConfig::func_227271_a_).withConfiguration(new BlockStateFeatureConfig(LAVA)).withPlacement(Placement.LAVA_LAKE.func_227446_a_(new ChanceConfig(80)))); this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, Feature.NORMAL_TREE.withConfiguration(TEST_TREE_CONFIG).withPlacement(Placement.COUNT_EXTRA_HEIGHTMAP.func_227446_a_(new AtSurfaceWithExtraConfig(0, 0.05F, 1)))); this.addFeature(GenerationStage.Decoration.SURFACE_STRUCTURES, Feature.VILLAGE.withConfiguration(new VillageConfig("village/plains/town_centers", 6)).withPlacement(Placement.NOPE.func_227446_a_(IPlacementConfig.NO_PLACEMENT_CONFIG))); this.addSpawn(EntityClassification.CREATURE, new SpawnListEntry(EntityType.SHEEP, 12, 4, 4)); this.addSpawn(EntityClassification.CREATURE, new SpawnListEntry(EntityType.PIG, 10, 4, 4)); this.addSpawn(EntityClassification.CREATURE, new SpawnListEntry(EntityType.CHICKEN, 10, 4, 4)); this.addSpawn(EntityClassification.CREATURE, new SpawnListEntry(EntityType.COW, 8, 4, 4)); this.addSpawn(EntityClassification.CREATURE, new SpawnListEntry(EntityType.HORSE, 5, 2, 6)); this.addSpawn(EntityClassification.CREATURE, new SpawnListEntry(EntityType.DONKEY, 1, 1, 3)); this.addSpawn(EntityClassification.AMBIENT, new SpawnListEntry(EntityType.BAT, 10, 8, 8)); this.addSpawn(EntityClassification.MONSTER, new SpawnListEntry(EntityType.SPIDER, 100, 4, 4)); this.addSpawn(EntityClassification.MONSTER, new SpawnListEntry(EntityType.ZOMBIE, 95, 4, 4)); this.addSpawn(EntityClassification.MONSTER, new SpawnListEntry(EntityType.ZOMBIE_VILLAGER, 5, 1, 1)); this.addSpawn(EntityClassification.MONSTER, new SpawnListEntry(EntityType.SKELETON, 100, 4, 4)); this.addSpawn(EntityClassification.MONSTER, new SpawnListEntry(EntityType.CREEPER, 100, 4, 4)); this.addSpawn(EntityClassification.MONSTER, new SpawnListEntry(EntityType.SLIME, 100, 4, 4)); this.addSpawn(EntityClassification.MONSTER, new SpawnListEntry(EntityType.ENDERMAN, 10, 1, 4)); this.addSpawn(EntityClassification.MONSTER, new SpawnListEntry(EntityType.WITCH, 5, 1, 1)); } }
    1 point
  17. RegistryEvent.MissingMappings<T extends IForgeRegistryEntry<T>>, where T is the registry type you want to remap (e.g. Block, Item, Biome).
    1 point
  18. There's an event for this, MissingMappingEvent? Something like that. You don't change the registry name at runtime, you just give it the new name and then when the event is fired (which will be fired for any missing mapping) you can hook in go "oh, that name, that's X now" and Forge will update the old stuff to the new.
    1 point
  19. I've been trying to create a block with minecraft forge and I'm making a new custom enchantment table. I created the block but I'm having trouble with the GUI. It works but when I right click on the block, the GUI immediately closes. Here's my code: GuiBE ContainerBE BlockBEnchanter
    1 point
  20. 1.12 is no longer supported on this forum. Please update to a modern version of Minecraft to receive support.
    0 points
×
×
  • Create New...

Important Information

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