
Nicholas Hammond
Members-
Posts
47 -
Joined
-
Last visited
Everything posted by Nicholas Hammond
-
I am aware capabilities will help me write and store data in my world, but I'm honestly very confused how it works. I am trying to store the spawn point of a entity so whenever I reload the game the entity still knows its spawn point which will be used to find its way back home.
-
Help with NBTs and Persistent Data
Nicholas Hammond replied to Nicholas Hammond's topic in Modder Support
1.14.4 -
How do I add an NBT to an entity and have it stay even when quitting the game. Additionally, how do I store data into a separate class and have it still be there when quitting and reloading the game. For example, I have a class called WandererData.class which stores entity data but every time I quit the game it clears the memory from it (the only reason I'm using this method is because I'm having trouble storing data as an NBT on the entity).
-
How to summon glass break particles
Nicholas Hammond replied to Nicholas Hammond's topic in Modder Support
I fixed the issue. The dependencies I was using carried over the World variable and I believe the issue with that is that it didn't render the particles server side, so I casted the world variable into ServerWorld and its corresponding spawnParticles method and it worked! -
How to summon glass break particles
Nicholas Hammond replied to Nicholas Hammond's topic in Modder Support
Nvm, I got it. world.addParticle(new BlockParticleData(ParticleTypes.BLOCK, Blocks.GLASS.getDefaultState()), x, y, z, 3, 3, 3); How do I change the particle range though? Because what I have right now is that the particles spawn when you hit an enemy but the cloud size is too small to see. -
How to summon glass break particles
Nicholas Hammond replied to Nicholas Hammond's topic in Modder Support
Ah ok, could you send an example of the arguments and methods I have to use for that? -
world.addParticle(ParticleTypes.EXPLOSION, x, y, z, 3, 3, 3); Obviously the game doesn't know which block I am referring to when I call ParticleTypes.EXPLOSION so how do I specify that I want the explosion particle for glass?
-
I made a mod which generates an infinite office building in minecraft and this is how it generates when i use my IDE: https://imgur.com/a/RN0VfuD and here's how it generates in my actual minecraft: https://imgur.com/a/aG1RYFG lowkey kinda freaked out on wtf happened. i searched around forge forums and i believe it may have to do with my gradlew file i have no idea tbh. Here is my mod jar: modid-1.0.jar
-
How to spawn structure in flat world
Nicholas Hammond replied to Nicholas Hammond's topic in Modder Support
Okay so today I had the idea of copying the FlatChunkGenerator code and making a new modified generator based on the original code. What can I change from the FlatChunkGenerator code which can generate my structures? Can I copy any of the code from OverworldChunkGenerator since it allows me to generate structures? I also created a new copy of FlatGenerationSettings if that does anything. -
How to spawn structure in flat world
Nicholas Hammond replied to Nicholas Hammond's topic in Modder Support
I ended up honestly replacing my FlatChunkGenerator with OverworldChunkGenerator because I couldn't find the solution -
How to spawn structure in flat world
Nicholas Hammond replied to Nicholas Hammond's topic in Modder Support
Thank you, this was the type of answer I was looking for I believe. How would I do this? I'm not trying to spawn my structure in the actual flat world by the way, I have a custom dimension which uses FlatChunkGenerator so that's why I asked. -
I have watched several videos on the subject and read the code used for flat chunk generation and have narrowed down my issue to this bit of code which adds my world feature into the game. (The variable "feature" is the feature which I'd like to add) for (Biome biome : ForgeRegistries.BIOMES.getValues()) { biome.addFeature(GenerationStage.Decoration.SURFACE_STRUCTURES, Biome.createDecoratedFeature(feature, IFeatureConfig.NO_FEATURE_CONFIG, Placement.NOPE, IPlacementConfig.NO_PLACEMENT_CONFIG)); } Yes, registration is working and this code is being recognized in game, but it will only spawn in non-flat worlds such as the overworld and nether. How do I solve this? Sorry for duplicate posts but it seems that my question is not being assessed in the needed manner
-
How to spawn structure in custom dimension
Nicholas Hammond replied to Nicholas Hammond's topic in Modder Support
I have learned java, it's just very convenient to use MCreator for sample code. -
How to spawn structure in custom dimension
Nicholas Hammond replied to Nicholas Hammond's topic in Modder Support
I will not be rewriting code as it is very helpful when using templates from MCreator. -
How to spawn structure in custom dimension
Nicholas Hammond replied to Nicholas Hammond's topic in Modder Support
One other thing, when you refer to the "example in FlatGenerationSettings" you mean the example I sent? I tried replacing "village" with "backrooms:empty_room" but of course it didn't work. Also, are you suggesting I rewrite my code? -
How to spawn structure in custom dimension
Nicholas Hammond replied to Nicholas Hammond's topic in Modder Support
Thank you for your patience and answering my questions. I will attempt to do what you have recommended, but I still have some trouble understand exactly what I have to do. From my understanding I have to register my structure somewhere? Is this in the chunk generator class or the structure class? I'm surprised this seems so difficult, but you obviously know much more than I do. I hope I can ask further questions if I remain stuck Sorry for the bothering. -
How to spawn structure in custom dimension
Nicholas Hammond replied to Nicholas Hammond's topic in Modder Support
Would I do this using a similar method like the example I used in my previous reply? Sorry but I don't really understand to what you're referring to exactly by DeferredWorkQueue. Is this a simple thing to do? Could you possibly send an example line of code? Sorry for my questions, I'm mostly modifying pre existing code like a template so I don't really know what all of this means.. -
How to spawn structure in custom dimension
Nicholas Hammond replied to Nicholas Hammond's topic in Modder Support
Thank you, this was the type of response I was looking for. But how would I do this exactly? Sorry for bothering, I'm a novice. Would I do this in my Level0ChunkGenerator class? I attempted doing something similar to flatgenerationsettings.getWorldFeatures().put("village", Maps.newHashMap()); but it didn't work. -
How to spawn structure in custom dimension
Nicholas Hammond replied to Nicholas Hammond's topic in Modder Support
My code works however, it's literally just the fact that it doesn't spawn in super flat worlds. I use sample code from a program called MCreator, but that's not really the point. Is there a method like flatGenEnabled or something which I can change? The annotation at the top is actually a tag which allows the class to be implemented into minecraft, if you'd like to know. -
After various tests I found out that my structure spawner works on all dimensions and biomes except on flat worlds. My custom dimension uses a super flat world generator, therefore I believe it does not generate for this reason. Anyway to generate my structure? EmptyRoomStructure code package net.zorathekidlz.backrooms.gen.level0; import net.minecraft.world.WorldType; import net.minecraftforge.common.BiomeManager; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraft.world.server.ServerWorld; import net.minecraft.world.gen.placement.Placement; import net.minecraft.world.gen.placement.IPlacementConfig; import net.minecraft.world.gen.feature.template.Template; import net.minecraft.world.gen.feature.template.PlacementSettings; import net.minecraft.world.gen.feature.template.BlockIgnoreStructureProcessor; import net.minecraft.world.gen.feature.NoFeatureConfig; import net.minecraft.world.gen.feature.IFeatureConfig; import net.minecraft.world.gen.feature.Feature; import net.minecraft.world.gen.Heightmap; import net.minecraft.world.gen.GenerationStage; import net.minecraft.world.gen.ChunkGenerator; import net.minecraft.world.dimension.DimensionType; import net.minecraft.world.biome.Biome; import net.minecraft.world.IWorld; import net.minecraft.util.math.ChunkPos; import net.minecraft.util.math.BlockPos; import net.minecraft.util.Rotation; import net.minecraft.util.ResourceLocation; import net.minecraft.util.Mirror; import net.zorathekidlz.backrooms.BackroomsModElements; import net.zorathekidlz.backrooms.dimensions.level0.Level0ModDimension; import java.util.Random; import java.util.logging.Level; @BackroomsModElements.ModElement.Tag public class EmptyRoomStructure extends BackroomsModElements.ModElement { public EmptyRoomStructure(BackroomsModElements instance) { super(instance, 23); } private static boolean validSpawn(int x, int z){ if(x % 32 == 0 && z % 32 != 0) { return true; } else return false; } @Override public void init(FMLCommonSetupEvent event) { Feature<NoFeatureConfig> feature = new Feature<NoFeatureConfig>(NoFeatureConfig::deserialize) { @Override public boolean place(IWorld iworld, ChunkGenerator generator, Random random, BlockPos pos, NoFeatureConfig config) { int ci = pos.getX(); int ck = pos.getZ(); DimensionType dimensionType = iworld.getDimension().getType(); boolean dimensionCriteria = false; if (dimensionType == Level0ModDimension.type) dimensionCriteria = true; if (!dimensionCriteria) return false; Template template = ((ServerWorld) iworld.getWorld()).getSaveHandler().getStructureTemplateManager() .getTemplateDefaulted(new ResourceLocation("backrooms", "empty_room")); if (template == null){ return false; } if (!validSpawn(ci, ck)){ return false; } Rotation rotation = Rotation.NONE; Mirror mirror = Mirror.NONE; BlockPos spawnTo = new BlockPos(ci, 100, ck); template.addBlocksToWorldChunk(iworld, spawnTo, new PlacementSettings().setRotation(rotation).setRandom(random) .setMirror(mirror).setChunk((ChunkPos) null).setIgnoreEntities(false)); return true; } }; for (Biome biome : ForgeRegistries.BIOMES.getValues()) { biome.addFeature(GenerationStage.Decoration.SURFACE_STRUCTURES, Biome.createDecoratedFeature(feature, IFeatureConfig.NO_FEATURE_CONFIG, Placement.NOPE, IPlacementConfig.NO_PLACEMENT_CONFIG)); } } } Level0ChunkGenerator code package net.zorathekidlz.backrooms.dimensions.level0; import com.google.common.collect.Maps; import net.minecraft.block.Blocks; import net.minecraft.world.IWorld; import net.minecraft.world.biome.Biomes; import net.minecraft.world.biome.provider.BiomeProvider; import net.minecraft.world.gen.ChunkGeneratorType; import net.minecraft.world.gen.FlatChunkGenerator; import net.minecraft.world.gen.FlatGenerationSettings; import net.minecraft.world.gen.FlatLayerInfo; import net.zorathekidlz.backrooms.biomes.BackroomsLevel0Biome; import net.zorathekidlz.backrooms.block.CielingtileBlock; import net.zorathekidlz.backrooms.block.OldmoistcarpetBlock; import net.zorathekidlz.backrooms.gen.level0.EmptyRoomStructure; public class Level0ChunkGenerator extends FlatChunkGenerator { public Level0ChunkGenerator(IWorld world, BiomeProvider biome) { super(world, biome, Level0Settings()); } public static FlatGenerationSettings Level0Settings(){ FlatGenerationSettings flatgenerationsettings = ChunkGeneratorType.FLAT.createSettings(); flatgenerationsettings.setBiome(new BackroomsLevel0Biome.Level0Biome()); flatgenerationsettings.getFlatLayers().add(new FlatLayerInfo(1, Blocks.BEDROCK)); flatgenerationsettings.getFlatLayers().add(new FlatLayerInfo(1, OldmoistcarpetBlock.block)); flatgenerationsettings.getFlatLayers().add(new FlatLayerInfo(4, Blocks.AIR)); flatgenerationsettings.getFlatLayers().add(new FlatLayerInfo(1, CielingtileBlock.block)); flatgenerationsettings.getFlatLayers().add(new FlatLayerInfo(1, Blocks.BEDROCK)); flatgenerationsettings.updateLayers(); return flatgenerationsettings; } }
-
After various tests I found out that my structure spawner works on all dimensions and biomes except on flat worlds. My custom dimension uses a super flat world generator, therefore I believe it does not generate for this reason. Anyway to generate my structure? Level0ChunkGenerator.java EmptyRoomStructure.java
-
So I tested my structure spawner using various different dimensions and they work completely as expected, however, they do not work on super flat worlds nor the dimension I created (which uses super flat generation settings), so I'm assuming the problem roots from that fact. Is there a way to enable my structure to spawn in my dimension if it uses super flat presets to be generated? EmptyRoomStructure.java Level0ChunkGenerator.java