21w05a
This commit is contained in:
1 parent
71a8dcc31e
commit
50eae09c17
5 files changed
+18
-13
No files matched your search
@@ -3,6 +3,7 @@ package carpet.fakes;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.world.HeightLimitView;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.biome.source.BiomeSource;
|
||||
import net.minecraft.world.gen.ChunkRandom;
|
||||
@@ -12,5 +13,5 @@ import net.minecraft.world.gen.feature.FeatureConfig;
|
||||
public interface StructureFeatureInterface<C>
|
||||
{
|
||||
boolean plopAnywhere(ServerWorld world, BlockPos pos, ChunkGenerator generator, boolean wireOnly,Biome biome, FeatureConfig config);
|
||||
boolean shouldStartPublicAt(ChunkGenerator chunkGenerator, BiomeSource biomeSource, long l, ChunkRandom chunkRandom, int i, int j, Biome biome, ChunkPos chunkPos, C featureConfig);
|
||||
boolean shouldStartPublicAt(ChunkGenerator chunkGenerator, BiomeSource biomeSource, long l, ChunkRandom chunkRandom, int i, int j, Biome biome, ChunkPos chunkPos, C featureConfig, HeightLimitView heightLimitView);
|
||||
}
|
||||
@@ -156,12 +156,14 @@ public class FeatureGenerator
|
||||
ConfiguredStructureFeature<?, ?> configuredFeature = biome.getGenerationSettings().method_30978(structure.configure(null));
|
||||
if (configuredFeature == null || configuredFeature.config == null) return null;
|
||||
ChunkPos chunkPos2 = structure.getStartChunk(params, seed, chunkRandom, chunkPos.x, chunkPos.z); //find some chunk I guess
|
||||
if (chunkPos.x == chunkPos2.x && chunkPos.z == chunkPos2.z && ((StructureFeatureInterface)structure).shouldStartPublicAt(generator, generator.getBiomeSource(), seed, chunkRandom, chunkPos.x, chunkPos.z, biome, chunkPos, configuredFeature.config)) // should start at
|
||||
// using here world for heightview, rather than chunk since we - unlike vanilla, want to avoid creating any chunks even on the
|
||||
// structure starts level - lets see where would that take us.
|
||||
if (chunkPos.x == chunkPos2.x && chunkPos.z == chunkPos2.z && ((StructureFeatureInterface)structure).shouldStartPublicAt(generator, generator.getBiomeSource(), seed, chunkRandom, chunkPos.x, chunkPos.z, biome, chunkPos, configuredFeature.config, world)) // should start at
|
||||
{
|
||||
if (!computeBox) return StructureStart.DEFAULT;
|
||||
StructureManager manager = world.getStructureManager();
|
||||
StructureStart<T> structureStart3 = structure.getStructureStartFactory().create((StructureFeature<T>) configuredFeature.feature, chunkPos.x, chunkPos.z, BlockBox.empty(), 0, seed);
|
||||
structureStart3.init(world.getRegistryManager(), generator, manager, chunkPos.x, chunkPos.z, biome, (T) configuredFeature.config);
|
||||
structureStart3.init(world.getRegistryManager(), generator, manager, chunkPos.x, chunkPos.z, biome, (T) configuredFeature.config, world);
|
||||
if (!structureStart3.hasChildren()) return null;
|
||||
return structureStart3;
|
||||
}
|
||||
|
||||
@@ -4,11 +4,12 @@ import carpet.utils.WoolTool;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.CarpetBlock;
|
||||
import net.minecraft.class_5815;
|
||||
import net.minecraft.item.ItemPlacementContext;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
||||
@Mixin(CarpetBlock.class)
|
||||
@Mixin(class_5815.class) // WoolCarpetBlock
|
||||
public abstract class CarpetBlockMixin extends Block
|
||||
{
|
||||
|
||||
@@ -21,8 +22,8 @@ public abstract class CarpetBlockMixin extends Block
|
||||
{
|
||||
BlockState state = super.getPlacementState(context);
|
||||
if (context.getPlayer() != null && !context.getWorld().isClient)
|
||||
{
|
||||
WoolTool.carpetPlacedAction(((CarpetBlock)(Object)this).getColor(), context.getPlayer(), context.getBlockPos(), (ServerWorld) context.getWorld());
|
||||
{ // getColor()
|
||||
WoolTool.carpetPlacedAction(((class_5815)(Object)this).method_33635(), context.getPlayer(), context.getBlockPos(), (ServerWorld) context.getWorld());
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import net.minecraft.structure.StructureStart;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.util.math.BlockBox;
|
||||
import net.minecraft.world.HeightLimitView;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.biome.source.BiomeSource;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
@@ -28,7 +29,7 @@ public abstract class StructureFeatureMixin<C extends FeatureConfig> implements
|
||||
|
||||
@Shadow public abstract StructureFeature.StructureStartFactory getStructureStartFactory();
|
||||
|
||||
@Shadow protected abstract boolean shouldStartAt(ChunkGenerator chunkGenerator, BiomeSource biomeSource, long l, ChunkRandom chunkRandom, int i, int j, Biome biome, ChunkPos chunkPos, C featureConfig);
|
||||
@Shadow protected abstract boolean shouldStartAt(ChunkGenerator chunkGenerator, BiomeSource biomeSource, long worldSeed, ChunkRandom random, int chunkX, int chunkZ, Biome biome, ChunkPos chunkPos, C config, HeightLimitView heightLimitView);
|
||||
|
||||
@Override
|
||||
public boolean plopAnywhere(ServerWorld world, BlockPos pos, ChunkGenerator generator, boolean wireOnly, Biome biome, FeatureConfig config)
|
||||
@@ -107,7 +108,7 @@ public abstract class StructureFeatureMixin<C extends FeatureConfig> implements
|
||||
StructureStart structurestart1 = getStructureStartFactory().create((StructureFeature)(Object)this, chunkpos.x, chunkpos.z, BlockBox.empty(),0,worldIn.getSeed());
|
||||
if (config == null)
|
||||
config = new DefaultFeatureConfig();
|
||||
structurestart1.init(worldIn.getRegistryManager(), generator, worldIn.getStructureManager() , chunkpos.x, chunkpos.z, biome_1, config);
|
||||
structurestart1.init(worldIn.getRegistryManager(), generator, worldIn.getStructureManager() , chunkpos.x, chunkpos.z, biome_1, config, ichunk);
|
||||
structurestart = structurestart1.hasChildren() ? structurestart1 : StructureStart.DEFAULT;
|
||||
|
||||
if (structurestart.hasChildren())
|
||||
@@ -120,8 +121,8 @@ public abstract class StructureFeatureMixin<C extends FeatureConfig> implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldStartPublicAt(ChunkGenerator chunkGenerator, BiomeSource biomeSource, long l, ChunkRandom chunkRandom, int i, int j, Biome biome, ChunkPos chunkPos, C featureConfig)
|
||||
public boolean shouldStartPublicAt(ChunkGenerator chunkGenerator, BiomeSource biomeSource, long l, ChunkRandom chunkRandom, int i, int j, Biome biome, ChunkPos chunkPos, C featureConfig, HeightLimitView heightLimitView)
|
||||
{
|
||||
return shouldStartAt(chunkGenerator, biomeSource, l, chunkRandom, i, j, biome, chunkPos, featureConfig);
|
||||
return shouldStartAt(chunkGenerator, biomeSource, l, chunkRandom, i, j, biome, chunkPos, featureConfig, heightLimitView);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user