Jump to content

Goosey

Members
  • Posts

    18
  • Joined

  • Last visited

Everything posted by Goosey

  1. https://github.com/NotAFlyingGoose/GooseMod
  2. I've implemented this, but I am still getting errors when trying to add my custom biome
  3. I can't find any method named get in ResourceKey
  4. It's what it said to do here. Again it was the only resource I had on this.
  5. My FMLCommonSetupEvent is being fired, I've debugged the method call but nothing seems out of the ordinary.
  6. I've been trying to implement a custom biome and I've run across an error that crashes my game when trying to create a new world and disallows me to enter any existing worlds. I followed this tutorial for making biomes (with one or two changes to class names and method names). My code looks like this and the exception is this What exactly am I missing? I understand that the tutorial is for 1.16, but I couldn't find anything for 1.17 and so far it hasn't been that difficult to implement it into my project. Did they add a step in 1.17?
  7. I figured it out, thanks. It turns out I had to use event.getGeneration().addStructureStart() instead of event.getGeneration().getStructures().add() among a few other things like updating my version of forge.
  8. The post you linked is for 1.16, I doubt the code would work for 1.17
  9. The code which utilizes BiomeLoadingEvent I have already shown above but here it is again: This code for the feature is this: And the code for the structure piece is this: I mainly took advantage of the many examples in vanilla to make the above two classes
  10. My mod is for minecraft 1.17.1, forge 37.0.67. Should I move my project to 37.0.95? I utilize BiomeLoadingEvent at line 68 in my code, but that alone did not add structures to the game. I also had to use reflection to add my own StructureFeatureConfiguration.
  11. A long time ago I tried to make a Minecraft mod (key word is tried). I knew a lot less about Java back then and I mainly relied on the tutorial videos I found. Recently I decided to try and get back into it, and I found it was really fun! I've started doing things that I had no chance of figuring out how to do last time like implementing custom mobs and even bosses. The biggest problem is that there are close to no tutorials or any actual useful documentation for forge 1.17.1, but because of my increased skill level since my last modding attempt, I haven't had to rely on tutorials that much I recently started trying to add custom entity spawning to the game, but couldn't figure out how to do it in the current forge version. Eventually I just decided to use reflection to add my own data into the vanilla map of "spawners" in net.minecraft.world.level.biome.MobSpawnSettings. This obviously isn't the intended way to add custom entity spawning to the game but because I can't find anything on this subject online, I did it and it works. Entity spawning isn't the main subject of this post, but it gives you the backstory of what I'm about to do (or more specifically, what I did). After that, I wanted to add my own custom structure. I decided to add an RV that spawns in deserts and mesa biomes so I just looked at how vanilla adds structures. I created all the proper java classes for the structure itself (The Feature class and the Pieces class) and created a StructureFeature field and a ConfiguredStructureFeature from that Feature. Then in a similar fashion to what I did with the entities, In biomes I wanted my structure to spawn in, I added my ConfiguredStructureFeature to "structureStarts" in net.minecraft.world.level.biome.BiomeGenerationSettings using reflection. On top of that I also added my own StructureFeatureConfiguration to "BUILTIN_OVERWORLD" from net.minecraft.world.level.levelgen.NoiseGeneratorSettings. If you're wondering, it works... kind of When I create a new world, It will spawn the structures but after I exit that world it will take a long time to load the world and there are many EOFExceptions in the console. I did the best job I could do with debugging and found that the error was happening while loading the NBT data for structures in every chunk. It is having a lot of trouble when trying to do something having to do with structure references. I have done my best to try and see exactly what is going wrong in the code and how I can fix it, but frankly, I'm stumped and I have no idea of how to fix it. Honestly the way to fix it is probably to stop using reflection and to just properly register my structures, but I don't know how to do that. After I've exhausted every single solution I can think of, I finally decided to come here and ask for help. My code for world generation:
  12. Yes but how do I make all nearby entities start panicking
  13. I'm making a mob like zombified piglin except instead of all the mobs getting mad at you I want to make it do they all go into a panic. How can I do this?
  14. I fixed it by making a liquidblock for the fluid, which I didn't do (correctly). Additionaly, I made the class extend FlowingFluid instead of ForgeFlowingFluid.
  15. I made a model for an custom entity in blockbench but the code that blockbench generated didn't work for 1.17.1 My question is how do you model and render an entity in 1.17.1 There aren't a lot of tutorials out there for forge 1.17.1 which is why I ask here
  16. public abstract class NitroglycerinFluid extends ForgeFlowingFluid { // Directly reference a log4j logger. private static final Logger LOGGER = LogManager.getLogger(); protected NitroglycerinFluid(Properties properties) { super(properties); } public static Properties createProperties() { return new Properties(() -> ModFluids.NITROGLYCERIN, () -> ModFluids.FLOWING_NITROGLYCERIN, FluidAttributes.builder(new ResourceLocation("sussybakaplus:block/nitroglycerin_still"), new ResourceLocation("sussybakaplus:block/nitroglycerin_flow")).overlay(new ResourceLocation("sussybakaplus:block/nitroglycerin_overlay")).density(3000).viscosity(1000).luminosity(15).temperature(1300)).tickRate(1).canMultiply().bucket(() -> ModItems.NITROGLYCERIN_BUCKET).block(() -> ModBlocks.NITROGLYCERIN); } @Override public boolean isSource(FluidState state) { return false; } @Override public int getAmount(FluidState state) { return state.getValue(LEVEL); } public void animateTick(Level p_76445_, BlockPos p_76446_, FluidState p_76447_, Random p_76448_) { LOGGER.info("animate"); if (!p_76447_.isSource() && !p_76447_.getValue(FALLING)) { if (p_76448_.nextInt(64) == 0) { p_76445_.playLocalSound((double)p_76446_.getX() + 0.5D, (double)p_76446_.getY() + 0.5D, (double)p_76446_.getZ() + 0.5D, SoundEvents.WATER_AMBIENT, SoundSource.BLOCKS, p_76448_.nextFloat() * 0.25F + 0.75F, p_76448_.nextFloat() + 0.5F, false); } } else if (p_76448_.nextInt(10) == 0) { p_76445_.addParticle(ParticleTypes.UNDERWATER, (double)p_76446_.getX() + p_76448_.nextDouble(), (double)p_76446_.getY() + p_76448_.nextDouble(), (double)p_76446_.getZ() + p_76448_.nextDouble(), 0.0D, 0.0D, 0.0D); } } @Nullable public ParticleOptions getDripParticle() { return ParticleTypes.DRIPPING_WATER; } @Override protected void beforeDestroyingBlock(LevelAccessor accessor, BlockPos pos, BlockState state) { BlockEntity blockentity = state.hasBlockEntity() ? accessor.getBlockEntity(pos) : null; LOGGER.info("spread to " + state.getBlock().getRegistryName().toString()); if (state.getBlock().getRegistryName().getPath().equals("fire")) { float f = 4.0F; Minecraft.getInstance().level.explode(null, pos.getX(), pos.getY(), pos.getZ(), f, Explosion.BlockInteraction.BREAK); } //Block.dropResources(state, accessor, pos, blockentity); } @Override public void tick(Level level, BlockPos pos, FluidState state) { //super.tick(level, pos, state); LOGGER.info("tick"); if (this.hasBurningNeighbors(level, pos)) { LOGGER.info("EXPLODING!!!"); float f = 4.0F; level.explode(null, pos.getX(), pos.getY(), pos.getZ(), f, Explosion.BlockInteraction.BREAK); } else { LOGGER.info(pos.toShortString() + " doesn't have any buring neighbors"); } } private boolean hasBurningNeighbors(LevelReader levelReader, BlockPos pos) { for(Direction direction : Direction.values()) { if (this.isBurning(levelReader, pos.relative(direction))) { return true; } } return false; } private boolean isBurning(LevelReader levelReader, BlockPos pos) { return (pos.getY() < levelReader.getMinBuildHeight() || pos.getY() >= levelReader.getMaxBuildHeight() || levelReader.hasChunkAt(pos)) && levelReader.getBlockState(pos).isBurning(levelReader, pos); } protected float getExplosionResistance() { return 0.0F; } public int getTickDelay(LevelReader p_76226_) { return p_76226_.dimensionType().ultraWarm() ? 1 : 1; } protected boolean isRandomlyTicking() { return true; } public Optional<SoundEvent> getPickupSound() { return Optional.of(SoundEvents.BUCKET_FILL); } } My Fluid Class
  17. I've made a simple custom fluid which overrides it's tick method in order to run some checks for any nearby burning blocks. Using the debugger and some breakpoints, I'm able to see that while the tick method for FlowingFluid is being run, my method which overrides that one isn't.
×
×
  • Create New...

Important Information

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