Cave pumpkin

This commit is contained in:
paulevsGitch 2021-03-20 06:13:11 +03:00
parent 72113034ea
commit 3dcafa522c
40 changed files with 474 additions and 49 deletions

View file

@ -1,13 +1,15 @@
package ru.betterend.mixin.common;
import com.google.common.collect.Multimap;
import net.minecraft.entity.attribute.EntityAttribute;
import net.minecraft.entity.attribute.EntityAttributeModifier;
import net.minecraft.item.ArmorItem;
import java.util.UUID;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
import java.util.UUID;
import com.google.common.collect.Multimap;
import net.minecraft.entity.attribute.EntityAttribute;
import net.minecraft.entity.attribute.EntityAttributeModifier;
import net.minecraft.item.ArmorItem;
@Mixin(ArmorItem.class)
public interface ArmorItemAccessor {

View file

@ -14,8 +14,8 @@ import net.minecraft.nbt.NbtHelper;
import net.minecraft.structure.Structure;
import net.minecraft.structure.StructurePlacementData;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.StructureWorldAccess;
import net.minecraft.world.Heightmap.Type;
import net.minecraft.world.StructureWorldAccess;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
import net.minecraft.world.gen.feature.EndPortalFeature;

View file

@ -13,6 +13,7 @@ import net.minecraft.block.Blocks;
import net.minecraft.block.PaneBlock;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.decoration.EndCrystalEntity;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.structure.Structure;
import net.minecraft.structure.StructurePlacementData;
import net.minecraft.util.math.BlockPos;
@ -27,6 +28,7 @@ import net.minecraft.world.gen.feature.EndSpikeFeatureConfig;
import ru.betterend.BetterEnd;
import ru.betterend.util.BlocksHelper;
import ru.betterend.util.StructureHelper;
import ru.betterend.util.WorldDataUtil;
import ru.betterend.world.generator.GeneratorOptions;
@Mixin(EndSpikeFeature.class)
@ -43,7 +45,24 @@ public class EndSpikeFeatureMixin {
int x = spike.getCenterX();
int z = spike.getCenterZ();
int radius = spike.getRadius();
int minY = world.getChunk(x >> 4, z >> 4).sampleHeightmap(Type.WORLD_SURFACE, x & 15, z);
int minY = 0;
long lx = (long) x;
long lz = (long) z;
if (lx * lx + lz * lz < 10000) {
String pillarID = String.format("%d_%d", x, z);
CompoundTag pillar = WorldDataUtil.getCompoundTag("pillars");
boolean haveValue = pillar.contains(pillarID);
minY = haveValue ? pillar.getInt(pillarID) : world.getChunk(x >> 4, z >> 4).sampleHeightmap(Type.WORLD_SURFACE, x & 15, z);
if (!haveValue) {
pillar.putInt(pillarID, minY);
WorldDataUtil.saveFile();
}
}
else {
minY = world.getChunk(x >> 4, z >> 4).sampleHeightmap(Type.WORLD_SURFACE, x & 15, z);
}
int maxY = minY + spike.getHeight() - 64;
if (GeneratorOptions.replacePillars() && be_radiusInRange(radius)) {

View file

@ -34,7 +34,7 @@ import ru.betterend.world.generator.GeneratorOptions;
public class ServerWorldMixin {
@Inject(method = "<init>*", at = @At("TAIL"))
private void be_onServerWorldInit(MinecraftServer server, Executor workerExecutor, LevelStorage.Session session, ServerWorldProperties properties, RegistryKey<World> registryKey, DimensionType dimensionType, WorldGenerationProgressListener worldGenerationProgressListener, ChunkGenerator chunkGenerator, boolean debugWorld, long l, List<Spawner> list, boolean bl, CallbackInfo info) {
File beData = new File(FabricLoader.getInstance().getGameDir().getParent().toString(), "saves/" + properties.getLevelName() + "/betterend_data.nbt");
File beData = new File(FabricLoader.getInstance().getGameDir().getParent().toString(), "saves/" + properties.getLevelName() + "/data/betterend_data.nbt");
ModMetadata meta = FabricLoader.getInstance().getModContainer(BetterEnd.MOD_ID).get().getMetadata();
String version = BetterEnd.isDevEnvironment() ? "development" : meta.getVersion().toString();