21w37a
This commit is contained in:
1 parent
70754dbfe8
commit
bc175509a2
24 files changed
+155
-113
No files matched your search
@@ -494,7 +494,7 @@ public class CarpetEventServer
|
||||
{
|
||||
return Arrays.asList(
|
||||
new EntityValue(player),
|
||||
new BlockValue(null, player.getServerWorld(), blockpos),
|
||||
new BlockValue(null, player.method_37908(), blockpos),
|
||||
StringValue.of(facing.getName())
|
||||
);
|
||||
}, player::getCommandSource);
|
||||
@@ -515,7 +515,7 @@ public class CarpetEventServer
|
||||
new EntityValue(player),
|
||||
ValueConversions.of(itemstack),
|
||||
StringValue.of(enumhand == Hand.MAIN_HAND ? "mainhand" : "offhand"),
|
||||
new BlockValue(null, player.getServerWorld(), blockpos),
|
||||
new BlockValue(null, player.method_37908(), blockpos),
|
||||
StringValue.of(enumfacing.getName()),
|
||||
ListValue.of(
|
||||
new NumericValue(vec3d.x),
|
||||
@@ -539,7 +539,7 @@ public class CarpetEventServer
|
||||
return Arrays.asList(
|
||||
new EntityValue(player),
|
||||
StringValue.of(enumhand == Hand.MAIN_HAND ? "mainhand" : "offhand"),
|
||||
new BlockValue(null, player.getServerWorld(), blockpos),
|
||||
new BlockValue(null, player.method_37908(), blockpos),
|
||||
StringValue.of(enumfacing.getName()),
|
||||
ListValue.of(
|
||||
new NumericValue(vec3d.x),
|
||||
@@ -559,7 +559,7 @@ public class CarpetEventServer
|
||||
new EntityValue(player),
|
||||
ValueConversions.of(itemstack),
|
||||
StringValue.of(enumhand == Hand.MAIN_HAND ? "mainhand" : "offhand"),
|
||||
new BlockValue(null, player.getServerWorld(), pos)
|
||||
new BlockValue(null, player.method_37908(), pos)
|
||||
), player::getCommandSource);
|
||||
}
|
||||
};
|
||||
@@ -569,7 +569,7 @@ public class CarpetEventServer
|
||||
public void onBlockBroken(ServerPlayerEntity player, BlockPos pos, BlockState previousBS)
|
||||
{
|
||||
handler.call(
|
||||
() -> Arrays.asList(new EntityValue(player), new BlockValue(previousBS, player.getServerWorld(), pos)),
|
||||
() -> Arrays.asList(new EntityValue(player), new BlockValue(previousBS, player.method_37908(), pos)),
|
||||
player::getCommandSource
|
||||
);
|
||||
}
|
||||
@@ -1083,7 +1083,7 @@ public class CarpetEventServer
|
||||
valArgs.add(EntityValue.of(player));
|
||||
for (Object o: args)
|
||||
{
|
||||
valArgs.add(ValueConversions.guess(player.getServerWorld(), o));
|
||||
valArgs.add(ValueConversions.guess(player.method_37908(), o));
|
||||
}
|
||||
return valArgs;
|
||||
}, player::getCommandSource
|
||||
|
||||
@@ -84,6 +84,7 @@ import net.minecraft.util.math.BlockBox;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.world.Heightmap;
|
||||
@@ -91,6 +92,7 @@ import net.minecraft.world.LightType;
|
||||
import net.minecraft.world.SpawnHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.biome.source.BiomeCoords;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.chunk.ChunkStatus;
|
||||
import net.minecraft.world.chunk.WorldChunk;
|
||||
@@ -1176,7 +1178,19 @@ public class WorldAccess {
|
||||
ServerWorld world = cc.s.getWorld();
|
||||
BlockPos pos = locator.block.getPos();
|
||||
Chunk chunk = world.getChunk(pos.getX() >> 4, pos.getZ() >> 4, ChunkStatus.BIOMES);
|
||||
((BiomeArrayInterface)chunk.getBiomeArray()).setBiomeAtIndex(pos, world, biome);
|
||||
if (chunk instanceof WorldChunk) return Value.FALSE; // questinoalble, but it makes sense
|
||||
int biomeX = BiomeCoords.fromBlock(pos.getX());
|
||||
int biomeY = BiomeCoords.fromBlock(pos.getY());
|
||||
int biomeZ = BiomeCoords.fromBlock(pos.getZ());
|
||||
try {
|
||||
int i = BiomeCoords.fromBlock(chunk.getBottomY());
|
||||
int j = i + BiomeCoords.fromBlock(chunk.getHeight()) - 1;
|
||||
int k = MathHelper.clamp(biomeY, i, j);
|
||||
int l = chunk.getSectionIndex(BiomeCoords.toBlock(k));
|
||||
chunk.getSection(l).method_38294().setSync(biomeX & 3, k & 3, biomeZ & 3, biome);
|
||||
} catch (Throwable var8) {
|
||||
return Value.FALSE;
|
||||
}
|
||||
if (doImmediateUpdate) WorldTools.forceChunkUpdate(pos, world);
|
||||
return Value.TRUE;
|
||||
});
|
||||
|
||||
@@ -46,9 +46,9 @@ public class BiomeInfo
|
||||
)
|
||||
);
|
||||
});
|
||||
put("structures", (w, b) -> {
|
||||
Registry<ConfiguredStructureFeature<?,?>> registry = w.getRegistryManager().get(Registry.CONFIGURED_STRUCTURE_FEATURE_KEY);
|
||||
return ListValue.wrap(b.getGenerationSettings().getStructureFeatures().stream().map(str -> ValueConversions.of(registry.getId(str.get()))));
|
||||
});
|
||||
//put("structures", (w, b) -> {
|
||||
// Registry<ConfiguredStructureFeature<?,?>> registry = w.getRegistryManager().get(Registry.CONFIGURED_STRUCTURE_FEATURE_KEY);
|
||||
// return ListValue.wrap(b.getGenerationSettings().getStructureFeatures().stream().map(str -> ValueConversions.of(registry.getId(str.get()))));
|
||||
//});
|
||||
}};
|
||||
}
|
||||
@@ -582,8 +582,8 @@ public class ShapeDispatcher
|
||||
Collections.singletonList(p),
|
||||
particle,
|
||||
density,
|
||||
relativiseRender(p.getServerWorld(), from, 0),
|
||||
relativiseRender(p.getServerWorld(), to, 0)
|
||||
relativiseRender(p.world, from, 0),
|
||||
relativiseRender(p.world, to, 0)
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -661,8 +661,8 @@ public class ShapeDispatcher
|
||||
if (p.world.getRegistryKey() == shapeDimension) drawParticleLine(
|
||||
Collections.singletonList(p),
|
||||
particle,
|
||||
relativiseRender(p.getServerWorld(), from, 0),
|
||||
relativiseRender(p.getServerWorld(), to, 0),
|
||||
relativiseRender(p.world, from, 0),
|
||||
relativiseRender(p.world, to, 0),
|
||||
density
|
||||
);
|
||||
};
|
||||
@@ -718,7 +718,7 @@ public class ShapeDispatcher
|
||||
ParticleEffect particle = replacementParticle();
|
||||
int partno = Math.min(1000,20*subdivisions);
|
||||
Random rand = p.world.getRandom();
|
||||
ServerWorld world = p.getServerWorld();
|
||||
ServerWorld world = p.method_37908();
|
||||
|
||||
Vec3d ccenter = relativiseRender(world, center, 0 );
|
||||
|
||||
@@ -796,7 +796,7 @@ public class ShapeDispatcher
|
||||
ParticleEffect particle = replacementParticle();
|
||||
int partno = (int)Math.min(1000,Math.sqrt(20*subdivisions*(1+height)));
|
||||
Random rand = p.world.getRandom();
|
||||
ServerWorld world = p.getServerWorld();
|
||||
ServerWorld world = p.method_37908();
|
||||
|
||||
Vec3d ccenter = relativiseRender(world, center, 0 );
|
||||
|
||||
@@ -1275,7 +1275,7 @@ public class ShapeDispatcher
|
||||
int parts = 0;
|
||||
for (ServerPlayerEntity player : playerList)
|
||||
{
|
||||
ServerWorld world = player.getServerWorld();
|
||||
ServerWorld world = player.method_37908();
|
||||
world.spawnParticles(player, particle, true,
|
||||
(towards.x)/2+from.x, (towards.y)/2+from.y, (towards.z)/2+from.z, particles/3,
|
||||
towards.x/6, towards.y/6, towards.z/6, 0.0);
|
||||
@@ -1292,7 +1292,7 @@ public class ShapeDispatcher
|
||||
int dev = 2*divider;
|
||||
for (ServerPlayerEntity player : playerList)
|
||||
{
|
||||
ServerWorld world = player.getServerWorld();
|
||||
ServerWorld world = player.method_37908();
|
||||
world.spawnParticles(player, particle, true,
|
||||
(towards.x)/center+from.x, (towards.y)/center+from.y, (towards.z)/center+from.z, particles/divider,
|
||||
towards.x/dev, towards.y/dev, towards.z/dev, 0.0);
|
||||
@@ -1313,7 +1313,7 @@ public class ShapeDispatcher
|
||||
int pcount = 0;
|
||||
if (distance < 100)
|
||||
{
|
||||
Random rand = players.get(0).getServerWorld().random;
|
||||
Random rand = players.get(0).world.random;
|
||||
int particles = (int)(distance/density)+1;
|
||||
Vec3d towards = to.subtract(from);
|
||||
for (int i = 0; i < particles; i++)
|
||||
@@ -1321,7 +1321,7 @@ public class ShapeDispatcher
|
||||
Vec3d at = from.add(towards.multiply( rand.nextDouble()));
|
||||
for (ServerPlayerEntity player : players)
|
||||
{
|
||||
player.getServerWorld().spawnParticles(player, particle, true,
|
||||
player.method_37908().spawnParticles(player, particle, true,
|
||||
at.x, at.y, at.z, 1,
|
||||
0.0, 0.0, 0.0, 0.0);
|
||||
pcount ++;
|
||||
@@ -1339,7 +1339,7 @@ public class ShapeDispatcher
|
||||
{
|
||||
for (ServerPlayerEntity player : players)
|
||||
{
|
||||
player.getServerWorld().spawnParticles(player, particle, true,
|
||||
player.method_37908().spawnParticles(player, particle, true,
|
||||
delta.x+from.x, delta.y+from.y, delta.z+from.z, 1,
|
||||
0.0, 0.0, 0.0, 0.0);
|
||||
pcount ++;
|
||||
|
||||
@@ -110,7 +110,11 @@ public class WorldTools
|
||||
//chunkGenerator2 = GeneratorOptions.createOverworldGenerator(server.getRegistryManager().get(Registry.BIOME_KEY), server.getRegistryManager().get(Registry.NOISE_SETTINGS_WORLDGEN), (seed==null)?l:seed);
|
||||
|
||||
// from world/gen/GeneratorOptions
|
||||
chunkGenerator2 = new NoiseChunkGenerator(MultiNoiseBiomeSource.createVanillaSource(server.getRegistryManager().get(Registry.BIOME_KEY), seed), seed, () -> {
|
||||
//chunkGenerator2 = new NoiseChunkGenerator(MultiNoiseBiomeSource.createVanillaSource(server.getRegistryManager().get(Registry.BIOME_KEY), seed), seed, () -> {
|
||||
// return server.getRegistryManager().get(Registry.CHUNK_GENERATOR_SETTINGS_KEY).getOrThrow(ChunkGeneratorSettings.OVERWORLD);
|
||||
//});
|
||||
|
||||
chunkGenerator2 = new NoiseChunkGenerator(MultiNoiseBiomeSource.Preset.OVERWORLD.getBiomeSource(server.getRegistryManager().get(Registry.BIOME_KEY)), seed, () -> {
|
||||
return server.getRegistryManager().get(Registry.CHUNK_GENERATOR_SETTINGS_KEY).getOrThrow(ChunkGeneratorSettings.OVERWORLD);
|
||||
});
|
||||
|
||||
@@ -142,7 +146,7 @@ public class WorldTools
|
||||
List<ServerPlayerEntity> nearbyPlayers = world.getPlayers(p -> pos.getSquaredDistance(p.getX(), pos.getY(), p.getZ(), true) < vvd);
|
||||
if (!nearbyPlayers.isEmpty())
|
||||
{
|
||||
ChunkDataS2CPacket packet = new ChunkDataS2CPacket(worldChunk);
|
||||
ChunkDataS2CPacket packet = new ChunkDataS2CPacket(worldChunk, world.getLightingProvider(), null, null, false); // false seems to update neighbours as well.
|
||||
ChunkPos chpos = new ChunkPos(pos);
|
||||
nearbyPlayers.forEach(p -> p.networkHandler.sendPacket(packet));
|
||||
}
|
||||
|
||||
@@ -118,13 +118,12 @@ public class BlockValue extends Value
|
||||
if (world != null && pos != null)
|
||||
{
|
||||
BlockEntity be = getBlockEntity(world, pos);
|
||||
NbtCompound tag = new NbtCompound();
|
||||
if (be == null)
|
||||
{
|
||||
data = tag;
|
||||
data = new NbtCompound();
|
||||
return null;
|
||||
}
|
||||
data = be.writeNbt(tag);
|
||||
data = be.method_38244(); // toNBT
|
||||
return data;
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -763,7 +763,7 @@ public class EntityValue extends Value
|
||||
ServerPlayerInteractionManagerInterface manager = (ServerPlayerInteractionManagerInterface) (((ServerPlayerEntity) e).interactionManager);
|
||||
BlockPos pos = manager.getCurrentBreakingBlock();
|
||||
if (pos == null) return Value.NULL;
|
||||
return new BlockValue(null, ((ServerPlayerEntity) e).getServerWorld(), pos);
|
||||
return new BlockValue(null, (ServerWorld) e.world, pos);
|
||||
}
|
||||
return Value.NULL;
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user