This commit is contained in:
gnembon committed 2019-08-28 20:23:32 -03:00
1 parent 8a956fa9bc
commit 628a350ea1
23 files changed
+82 -83

No files matched your search

@@ -41,7 +41,7 @@ public abstract class BlockEntityRenderDispatcher_movableTEMixin implements Bloc
this.cameraEntity.getPos().z - zOffset) < blockEntity_1.getSquaredRenderDistance())
{
GuiLighting.enable();
int i = this.world.getLightmapIndex(blockEntity_1.getPos(), 0);
int i = this.world.method_22337(blockEntity_1.getPos());
int j = i % 65536;
int k = i / 65536;
RenderSystem.glMultiTexCoord2f(GL20.GL_TEXTURE1, (float) j, (float) k);
@@ -13,10 +13,10 @@ public class BuriedTreasureGeneratorPieceMixin
{
@Redirect(method = "generate", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/IWorld;getTop(Lnet/minecraft/world/Heightmap$Type;II)I"
target = "Lnet/minecraft/world/IWorld;getLightLevel(Lnet/minecraft/world/Heightmap$Type;II)I"
))
private int getTop(IWorld iWorld, Heightmap.Type var1, int var2, int var3)
{
return iWorld.getTop(CarpetSettings.skipGenerationChecks?Heightmap.Type.OCEAN_FLOOR:Heightmap.Type.OCEAN_FLOOR_WG, var2, var3);
return iWorld.getLightLevel(CarpetSettings.skipGenerationChecks?Heightmap.Type.OCEAN_FLOOR:Heightmap.Type.OCEAN_FLOOR_WG, var2, var3);
}
}
@@ -5,6 +5,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.CarpetBlock;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.server.world.ServerWorld;
import org.spongepowered.asm.mixin.Mixin;
@Mixin(CarpetBlock.class)
@@ -21,7 +22,7 @@ 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(), context.getWorld());
WoolTool.carpetPlacedAction(((CarpetBlock)(Object)this).getColor(), context.getPlayer(), context.getBlockPos(), (ServerWorld) context.getWorld());
}
return state;
}
@@ -13,10 +13,10 @@ public class FossilFeatureMixin
{
@Redirect(method = "method_13236", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/IWorld;getTop(Lnet/minecraft/world/Heightmap$Type;II)I"
target = "Lnet/minecraft/world/IWorld;getLightLevel(Lnet/minecraft/world/Heightmap$Type;II)I"
))
private int getTop(IWorld iWorld, Heightmap.Type var1, int var2, int var3)
{
return iWorld.getTop(CarpetSettings.skipGenerationChecks?Heightmap.Type.OCEAN_FLOOR:Heightmap.Type.OCEAN_FLOOR_WG, var2, var3);
return iWorld.getLightLevel(CarpetSettings.skipGenerationChecks?Heightmap.Type.OCEAN_FLOOR:Heightmap.Type.OCEAN_FLOOR_WG, var2, var3);
}
}
@@ -1,6 +1,7 @@
package carpet.mixins;
import carpet.settings.CarpetSettings;
import net.minecraft.class_4538;
import net.minecraft.structure.processor.GravityStructureProcessor;
import net.minecraft.world.Heightmap;
import net.minecraft.world.ViewableWorld;
@@ -13,10 +14,10 @@ public class GravityStructureProcessorMixin
{
@Redirect(method = "process", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/ViewableWorld;getTop(Lnet/minecraft/world/Heightmap$Type;II)I"
target = "Lnet/minecraft/class_4538;getLightLevel(Lnet/minecraft/world/Heightmap$Type;II)I"
))
private int getTop(ViewableWorld viewableWorld, Heightmap.Type var1, int var2, int var3)
private int getTop(class_4538 class_4538, Heightmap.Type var1, int var2, int var3)
{
return viewableWorld.getTop(CarpetSettings.skipGenerationChecks?Heightmap.Type.WORLD_SURFACE:var1, var2, var3);
return class_4538.getLightLevel(CarpetSettings.skipGenerationChecks?Heightmap.Type.WORLD_SURFACE:var1, var2, var3);
}
}
@@ -13,10 +13,10 @@ public class IglooGeneratorPieceMixin
{
@Redirect(method = "generate", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/IWorld;getTop(Lnet/minecraft/world/Heightmap$Type;II)I"
target = "Lnet/minecraft/world/IWorld;getLightLevel(Lnet/minecraft/world/Heightmap$Type;II)I"
))
private int getTop(IWorld iWorld, Heightmap.Type var1, int var2, int var3)
{
return iWorld.getTop(CarpetSettings.skipGenerationChecks?Heightmap.Type.WORLD_SURFACE:Heightmap.Type.WORLD_SURFACE_WG, var2, var3);
return iWorld.getLightLevel(CarpetSettings.skipGenerationChecks?Heightmap.Type.WORLD_SURFACE:Heightmap.Type.WORLD_SURFACE_WG, var2, var3);
}
}
@@ -13,10 +13,10 @@ public class OceanRuinGeneratorPieceMixin
{
@Redirect(method = "generate", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/IWorld;getTop(Lnet/minecraft/world/Heightmap$Type;II)I"
target = "Lnet/minecraft/world/IWorld;getLightLevel(Lnet/minecraft/world/Heightmap$Type;II)I"
))
private int getTop(IWorld iWorld, Heightmap.Type var1, int var2, int var3)
{
return iWorld.getTop(CarpetSettings.skipGenerationChecks?Heightmap.Type.OCEAN_FLOOR:Heightmap.Type.OCEAN_FLOOR_WG, var2, var3);
return iWorld.getLightLevel(CarpetSettings.skipGenerationChecks?Heightmap.Type.OCEAN_FLOOR:Heightmap.Type.OCEAN_FLOOR_WG, var2, var3);
}
}
@@ -111,7 +111,7 @@ public abstract class PistonBlockEntity_movableTEMixin extends BlockEntity imple
else
blockState_2 = Block.getRenderingState(this.pushedBlock, this.world, this.pos);
((WorldInterface) (this.world)).setBlockStateWithBlockEntity(this.pos, blockState_2, this.carriedBlockEntity, 3);
this.world.breakBlock(this.pos, true);
this.world.breakBlock(this.pos, true, null);
}
}
@@ -1,12 +1,12 @@
package carpet.mixins;
import carpet.settings.CarpetSettings;
import carpet.helpers.BlockSaplingHelper;
import carpet.settings.CarpetSettings;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.SaplingBlock;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IWorld;
import net.minecraft.world.biome.Biomes;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@@ -19,13 +19,13 @@ import java.util.Random;
public abstract class SaplingBlockMixin
{
@Inject(method = "generate", at = @At(value = "INVOKE", shift = At.Shift.BEFORE,
target = "Lnet/minecraft/block/sapling/SaplingGenerator;generate(Lnet/minecraft/world/IWorld;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;Ljava/util/Random;)Z"),
target = "Lnet/minecraft/block/sapling/SaplingGenerator;generate(Lnet/minecraft/world/IWorld;Lnet/minecraft/world/gen/chunk/ChunkGenerator;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;Ljava/util/Random;)Z"),
cancellable = true)
private void onGenerate(IWorld iWorld_1, BlockPos blockPos_1, BlockState blockState_1, Random random_1, CallbackInfo ci)
private void onGenerate(ServerWorld serverWorld_1, BlockPos blockPos_1, BlockState blockState_1, Random random_1, CallbackInfo ci)
{
if(CarpetSettings.desertShrubs && iWorld_1.getBiome(blockPos_1) == Biomes.DESERT && !BlockSaplingHelper.hasWater(iWorld_1, blockPos_1))
if(CarpetSettings.desertShrubs && serverWorld_1.getBiome(blockPos_1) == Biomes.DESERT && !BlockSaplingHelper.hasWater(serverWorld_1, blockPos_1))
{
iWorld_1.setBlockState(blockPos_1, Blocks.DEAD_BUSH.getDefaultState(), 3);
serverWorld_1.setBlockState(blockPos_1, Blocks.DEAD_BUSH.getDefaultState(), 3);
ci.cancel();
}
}
@@ -7,7 +7,6 @@ import net.minecraft.server.world.ServerChunkManager;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.SpawnHelper;
import net.minecraft.world.World;
import net.minecraft.world.chunk.WorldChunk;
import net.minecraft.world.dimension.DimensionType;
import net.minecraft.world.level.LevelProperties;
@@ -77,10 +76,10 @@ public abstract class ServerChunkManagerMixin
@Redirect(method = "method_20801", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/SpawnHelper;spawnEntitiesInChunk(Lnet/minecraft/entity/EntityCategory;Lnet/minecraft/world/World;Lnet/minecraft/world/chunk/WorldChunk;Lnet/minecraft/util/math/BlockPos;)V"
target = "Lnet/minecraft/world/SpawnHelper;spawnEntitiesInChunk(Lnet/minecraft/entity/EntityCategory;Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/world/chunk/WorldChunk;Lnet/minecraft/util/math/BlockPos;)V"
))
// inject our repeat of spawns if more spawn ticks per tick are chosen.
private void spawnMultipleTimes(EntityCategory entityCategory_1, World world_1, WorldChunk worldChunk_1, BlockPos blockPos_1)
private void spawnMultipleTimes(EntityCategory entityCategory_1, ServerWorld world_1, WorldChunk worldChunk_1, BlockPos blockPos_1)
{
for (int i = 0; i < SpawnReporter.spawn_tries.get(entityCategory_1); i++)
{
@@ -17,13 +17,13 @@ public class ShipwreckGeneratorPieceMixin
@Redirect(method = "generate", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/IWorld;getTop(Lnet/minecraft/world/Heightmap$Type;II)I"
target = "Lnet/minecraft/world/IWorld;getLightLevel(Lnet/minecraft/world/Heightmap$Type;II)I"
))
private int getTop(IWorld iWorld, Heightmap.Type var1, int var2, int var3)
{
if (grounded)
return iWorld.getTop(CarpetSettings.skipGenerationChecks?Heightmap.Type.WORLD_SURFACE:Heightmap.Type.WORLD_SURFACE_WG, var2, var3);
return iWorld.getLightLevel(CarpetSettings.skipGenerationChecks?Heightmap.Type.WORLD_SURFACE:Heightmap.Type.WORLD_SURFACE_WG, var2, var3);
else
return iWorld.getTop(CarpetSettings.skipGenerationChecks?Heightmap.Type.OCEAN_FLOOR:Heightmap.Type.OCEAN_FLOOR_WG, var2, var3);
return iWorld.getLightLevel(CarpetSettings.skipGenerationChecks?Heightmap.Type.OCEAN_FLOOR:Heightmap.Type.OCEAN_FLOOR_WG, var2, var3);
}
}
@@ -1,7 +1,7 @@
package carpet.mixins;
import carpet.settings.CarpetSettings;
import carpet.fakes.WorldInterface;
import carpet.settings.CarpetSettings;
import carpet.utils.SpawnReporter;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
@@ -9,6 +9,7 @@ import net.minecraft.entity.EntityCategory;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.mob.MobEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.MathHelper;
@@ -19,9 +20,7 @@ import net.minecraft.world.World;
import net.minecraft.world.chunk.WorldChunk;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.util.Map;
@@ -33,9 +32,9 @@ public class SpawnHelperMixin
@Redirect(method = "spawnEntitiesInChunk", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/World;doesNotCollide(Lnet/minecraft/util/math/Box;)Z"
target = "Lnet/minecraft/server/world/ServerWorld;doesNotCollide(Lnet/minecraft/util/math/Box;)Z"
))
private static boolean doesNotCollide(World world, Box bb)
private static boolean doesNotCollide(ServerWorld world, Box bb)
{
//.doesNotCollide is VERY expensive. On the other side - most worlds are not made of trapdoors in
// various configurations, but solid and 'passable' blocks, like air, water grass, etc.
@@ -88,9 +87,9 @@ public class SpawnHelperMixin
@Redirect(method = "spawnEntitiesInChunk", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/World;spawnEntity(Lnet/minecraft/entity/Entity;)Z"
target = "Lnet/minecraft/server/world/ServerWorld;spawnEntity(Lnet/minecraft/entity/Entity;)Z"
))
private static boolean spawnEntity(World world, Entity entity_1)
private static boolean spawnEntity(ServerWorld world, Entity entity_1)
{
if (CarpetSettings.lagFreeSpawning)
// we used the mob - next time we will create a new one when needed
@@ -114,7 +113,7 @@ public class SpawnHelperMixin
target = "Lnet/minecraft/entity/player/PlayerEntity;squaredDistanceTo(DDD)D"
))
private static double getSqDistanceTo(PlayerEntity playerEntity, double double_1, double double_2, double double_3,
EntityCategory entityCategory_1, World world_1, WorldChunk worldChunk_1, BlockPos blockPos_1)
EntityCategory entityCategory_1, ServerWorld world_1, WorldChunk worldChunk_1, BlockPos blockPos_1)
{
double distanceTo = playerEntity.squaredDistanceTo(double_1, double_2, double_3);
if (CarpetSettings.lagFreeSpawning && distanceTo > 16384.0D && entityCategory_1 != EntityCategory.CREATURE)
@@ -32,11 +32,12 @@ public abstract class StructureFeatureMixin implements StructureFeatureInterface
@Shadow public abstract StructureFeature.StructureStartFactory getStructureStartFactory();
@Override
public boolean plopAnywhere(IWorld world, BlockPos pos)
public boolean plopAnywhere(ServerWorld world, BlockPos pos)
{
return plopAnywhere(world, pos, world.getChunkManager().getChunkGenerator());
return plopAnywhere(world, pos, world.method_14178().getChunkGenerator());
}
public boolean plopAnywhere(IWorld world, BlockPos pos, ChunkGenerator<? extends ChunkGeneratorConfig> generator)
@Override
public boolean plopAnywhere(ServerWorld world, BlockPos pos, ChunkGenerator<? extends ChunkGeneratorConfig> generator)
{
if (world.isClient())
return false;
@@ -60,6 +61,7 @@ public abstract class StructureFeatureMixin implements StructureFeatureInterface
MutableIntBoundingBox box = structurestart.getBoundingBox();
structurestart.generateStructure(
world,
generator,
rand,
new MutableIntBoundingBox(
pos.getX() - this.getRadius()*16,
@@ -102,7 +104,7 @@ public abstract class StructureFeatureMixin implements StructureFeatureInterface
ChunkPos chunkpos = new ChunkPos(packedChunkPos);
StructureStart structurestart;
Chunk ichunk = worldIn.getChunk(chunkpos.x, chunkpos.z, ChunkStatus.STRUCTURE_STARTS);
Chunk ichunk = worldIn.getChunk(chunkpos.x, chunkpos.z, ChunkStatus.STRUCTURE_STARTS, false);
if (ichunk != null)
{
@@ -1,6 +1,7 @@
package carpet.mixins;
import carpet.settings.CarpetSettings;
import net.minecraft.class_4538;
import net.minecraft.structure.StructurePiece;
import net.minecraft.world.Heightmap;
import net.minecraft.world.ViewableWorld;
@@ -13,10 +14,10 @@ public class StructurePieceMixin
{
@Redirect(method = "isUnderSeaLevel", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/ViewableWorld;getTop(Lnet/minecraft/world/Heightmap$Type;II)I"
target = "Lnet/minecraft/class_4538;getLightLevel(Lnet/minecraft/world/Heightmap$Type;II)I"
))
private int getTop(ViewableWorld viewableWorld, Heightmap.Type var1, int var2, int var3)
private int getTop(class_4538 class_4538, Heightmap.Type var1, int var2, int var3)
{
return viewableWorld.getTop(CarpetSettings.skipGenerationChecks?Heightmap.Type.OCEAN_FLOOR:Heightmap.Type.OCEAN_FLOOR_WG, var2, var3);
return class_4538.getLightLevel(CarpetSettings.skipGenerationChecks?Heightmap.Type.OCEAN_FLOOR:Heightmap.Type.OCEAN_FLOOR_WG, var2, var3);
}
}