Jump to content

Recommended Posts

Posted (edited)
package com.twmicro.practical.world.gen.structures;

import com.mojang.serialization.Codec;
import com.twmicro.practical.PracticalMod;
import com.twmicro.practical.Reference;
import com.twmicro.practical.world.gen.structures.pieces.ModernRubyFactoryPiece;
import net.minecraft.util.Rotation;
import net.minecraft.util.SharedSeedRandom;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.util.math.MutableBoundingBox;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.provider.BiomeProvider;
import net.minecraft.world.gen.ChunkGenerator;
import net.minecraft.world.gen.GenerationStage;
import net.minecraft.world.gen.feature.IFeatureConfig;
import net.minecraft.world.gen.feature.NoFeatureConfig;
import net.minecraft.world.gen.feature.structure.*;
import net.minecraft.world.gen.feature.template.TemplateManager;
import net.minecraft.world.gen.settings.StructureSeparationSettings;

import javax.annotation.Nullable;

public class ModernRubyFactory extends Structure<NoFeatureConfig> {
    public ModernRubyFactory(Codec<NoFeatureConfig> codec) {
        super(codec);
    }

    @Override
    public String getStructureName() {
        return Reference.MODERN_RUBY_FACTORY_LOCATION.toString();
    }

    @Override
    public GenerationStage.Decoration func_236396_f_() {
        return GenerationStage.Decoration.SURFACE_STRUCTURES;
    }

    @Nullable
    @Override
    public BlockPos func_236388_a_(IWorldReader p_236388_1_, StructureManager p_236388_2_, BlockPos p_236388_3_, int p_236388_4_, boolean p_236388_5_, long p_236388_6_, StructureSeparationSettings p_236388_8_) {
        return super.func_236388_a_(p_236388_1_, p_236388_2_, p_236388_3_, p_236388_4_, p_236388_5_, p_236388_6_, p_236388_8_);
    }

    @Override
    public Structure.IStartFactory<NoFeatureConfig> getStartFactory() {
        return ModernRubyFactory.Start::new;
    }

    public static class Start extends StructureStart<NoFeatureConfig> {

        public Start(Structure<NoFeatureConfig> p_i225806_1_, int p_i225806_2_, int p_i225806_3_, MutableBoundingBox p_i225806_4_, int p_i225806_5_, long p_i225806_6_) {
            super(p_i225806_1_, p_i225806_2_, p_i225806_3_, p_i225806_4_, p_i225806_5_, p_i225806_6_);
        }

        @Override
        public void func_230364_a_(ChunkGenerator p_230364_1_, TemplateManager p_230364_2_, int p_230364_3_, int p_230364_4_, Biome p_230364_5_, NoFeatureConfig p_230364_6_) {
            int i = p_230364_3_ * 16;
            int j = p_230364_4_ * 16;
            BlockPos blockpos = new BlockPos(i, 90, j);
            Rotation rotation = Rotation.randomRotation(this.rand);
            ModernRubyFactoryPiece.func_236991_a_(p_230364_2_, blockpos, rotation, this.components, this.rand);
            this.recalculateStructureSize();
        }
    }
}

First attempt xD. Please, don't care of name of structure!

 

Also Minecraft writes to log two types of messages:

[11:47:36] [Server thread/ERROR] [minecraft/ChunkManager]: Failed to save chunk -2,-1
java.lang.NullPointerException: null
	at net.minecraft.world.chunk.storage.ChunkSerializer.writeStructures(ChunkSerializer.java:421) ~[?:?] {re:classloading}
	at net.minecraft.world.chunk.storage.ChunkSerializer.write(ChunkSerializer.java:363) ~[?:?] {re:classloading}
	at net.minecraft.world.server.ChunkManager.func_219229_a(ChunkManager.java:705) ~[?:?] {re:classloading}
	at net.minecraft.world.server.ChunkManager.lambda$save$9(ChunkManager.java:374) ~[?:?] {re:classloading}
	at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184) ~[?:1.8.0_251] {}
	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) ~[?:1.8.0_251] {}
	at java.util.Iterator.forEachRemaining(Iterator.java:116) ~[?:1.8.0_251] {}
	at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801) ~[?:1.8.0_251] {}
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482) ~[?:1.8.0_251] {}
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472) ~[?:1.8.0_251] {}
	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) ~[?:1.8.0_251] {}
	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) ~[?:1.8.0_251] {}
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:1.8.0_251] {}
	at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418) ~[?:1.8.0_251] {}
	at net.minecraft.world.server.ChunkManager.save(ChunkManager.java:371) ~[?:?] {re:classloading}
	at net.minecraft.world.server.ServerChunkProvider.save(ServerChunkProvider.java:313) ~[?:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.world.server.ServerWorld.save(ServerWorld.java:703) ~[?:?] {re:classloading}
	at net.minecraft.server.MinecraftServer.save(MinecraftServer.java:546) ~[?:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:82) ~[?:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.server.MinecraftServer.func_240802_v_(MinecraftServer.java:665) ~[?:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.lambda$func_240784_a_$0(MinecraftServer.java:231) ~[?:?] {re:classloading,pl:accesstransformer:B}
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_251] {}
Unknown structure start: practical:modern_ruby_factory

 

2020-07-09_10.51.55.png

Edited by PFEModder
LOG
  • 3 months later...
  • 3 weeks later...

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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