19w38b WIP

This commit is contained in:
gnembon committed 2019-09-18 16:25:08 -03:00
1 parent be82935455
commit 59f2c8f958
31 files changed
+93 -74

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.method_22337(blockEntity_1.getPos());
int i = this.world.getLightmapIndex(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;getLightLevel(Lnet/minecraft/world/Heightmap$Type;II)I"
target = "Lnet/minecraft/world/IWorld;getTopY(Lnet/minecraft/world/Heightmap$Type;II)I"
))
private int getTop(IWorld iWorld, Heightmap.Type var1, int var2, int var3)
{
return iWorld.getLightLevel(CarpetSettings.skipGenerationChecks?Heightmap.Type.OCEAN_FLOOR:Heightmap.Type.OCEAN_FLOOR_WG, var2, var3);
return iWorld.getTopY(CarpetSettings.skipGenerationChecks?Heightmap.Type.OCEAN_FLOOR:Heightmap.Type.OCEAN_FLOOR_WG, var2, var3);
}
}
@@ -22,18 +22,18 @@ public abstract class EntityNavigation_pathfindingMixin
@Shadow @Final protected MobEntity entity;
@Shadow /*@Nullable*/ protected abstract Path findPathTo(Set<BlockPos> set_1, int int_1, boolean boolean_1, int int_2);
@Shadow /*@Nullable*/ protected abstract Path findPathToAny(Set<BlockPos> set_1, int int_1, boolean boolean_1, int int_2);
@Redirect(method = "findPathTo(Lnet/minecraft/util/math/BlockPos;I)Lnet/minecraft/entity/ai/pathing/Path;", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/entity/ai/pathing/EntityNavigation;findPathTo(Ljava/util/Set;IZI)Lnet/minecraft/entity/ai/pathing/Path;"
target = "Lnet/minecraft/entity/ai/pathing/EntityNavigation;findPathToAny(Ljava/util/Set;IZI)Lnet/minecraft/entity/ai/pathing/Path;"
))
private Path pathToBlock(EntityNavigation entityNavigation, Set<BlockPos> set_1, int int_1, boolean boolean_1, int int_2)
{
if (!LoggerRegistry.__pathfinding)
return findPathTo(set_1, int_1, boolean_1, int_2);
return findPathToAny(set_1, int_1, boolean_1, int_2);
long start = System.nanoTime();
Path path = findPathTo(set_1, int_1, boolean_1, int_2);
Path path = findPathToAny(set_1, int_1, boolean_1, int_2);
long finish = System.nanoTime();
float duration = (1.0F*((finish - start)/1000))/1000;
set_1.forEach(b -> PathfindingVisualizer.slowPath(entity, new Vec3d(b), duration, path != null));
@@ -42,14 +42,14 @@ public abstract class EntityNavigation_pathfindingMixin
@Redirect(method = "findPathTo(Lnet/minecraft/entity/Entity;I)Lnet/minecraft/entity/ai/pathing/Path;", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/entity/ai/pathing/EntityNavigation;findPathTo(Ljava/util/Set;IZI)Lnet/minecraft/entity/ai/pathing/Path;"
target = "Lnet/minecraft/entity/ai/pathing/EntityNavigation;findPathToAny(Ljava/util/Set;IZI)Lnet/minecraft/entity/ai/pathing/Path;"
))
private Path pathToEntity(EntityNavigation entityNavigation, Set<BlockPos> set_1, int int_1, boolean boolean_1, int int_2)
{
if (!LoggerRegistry.__pathfinding)
return findPathTo(set_1, int_1, boolean_1, int_2);
return findPathToAny(set_1, int_1, boolean_1, int_2);
long start = System.nanoTime();
Path path = findPathTo(set_1, int_1, boolean_1, int_2);
Path path = findPathToAny(set_1, int_1, boolean_1, int_2);
long finish = System.nanoTime();
float duration = (1.0F*((finish - start)/1000))/1000;
set_1.forEach(b -> PathfindingVisualizer.slowPath(entity, new Vec3d(b), duration, path != null));
@@ -13,10 +13,10 @@ public class FossilFeatureMixin
{
@Redirect(method = "method_13236", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/IWorld;getLightLevel(Lnet/minecraft/world/Heightmap$Type;II)I"
target = "Lnet/minecraft/world/IWorld;getTopY(Lnet/minecraft/world/Heightmap$Type;II)I"
))
private int getTop(IWorld iWorld, Heightmap.Type var1, int var2, int var3)
{
return iWorld.getLightLevel(CarpetSettings.skipGenerationChecks?Heightmap.Type.OCEAN_FLOOR:Heightmap.Type.OCEAN_FLOOR_WG, var2, var3);
return iWorld.getTopY(CarpetSettings.skipGenerationChecks?Heightmap.Type.OCEAN_FLOOR:Heightmap.Type.OCEAN_FLOOR_WG, var2, var3);
}
}
@@ -16,7 +16,7 @@ import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(GameRenderer.class)
public class GameRenderer_pausedShakeMixin
{
@Shadow @Final private MinecraftClient client;
@Shadow @Final private MinecraftClient client; /*
@Redirect(method = "renderCenter", at = @At(
value = "INVOKE",
@@ -32,5 +32,5 @@ public class GameRenderer_pausedShakeMixin
{
worldRenderer.renderEntities(camera_1, visibleRegion_1, float_1);
}
}
}*/
}
@@ -4,7 +4,6 @@ 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;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@@ -14,10 +13,10 @@ public class GravityStructureProcessorMixin
{
@Redirect(method = "process", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/class_4538;getLightLevel(Lnet/minecraft/world/Heightmap$Type;II)I"
target = "Lnet/minecraft/class_4538;getTopY(Lnet/minecraft/world/Heightmap$Type;II)I"
))
private int getTop(class_4538 class_4538, Heightmap.Type var1, int var2, int var3)
{
return class_4538.getLightLevel(CarpetSettings.skipGenerationChecks?Heightmap.Type.WORLD_SURFACE:var1, var2, var3);
return class_4538.getTopY(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;getLightLevel(Lnet/minecraft/world/Heightmap$Type;II)I"
target = "Lnet/minecraft/world/IWorld;getTopY(Lnet/minecraft/world/Heightmap$Type;II)I"
))
private int getTop(IWorld iWorld, Heightmap.Type var1, int var2, int var3)
{
return iWorld.getLightLevel(CarpetSettings.skipGenerationChecks?Heightmap.Type.WORLD_SURFACE:Heightmap.Type.WORLD_SURFACE_WG, var2, var3);
return iWorld.getTopY(CarpetSettings.skipGenerationChecks?Heightmap.Type.WORLD_SURFACE:Heightmap.Type.WORLD_SURFACE_WG, var2, var3);
}
}
@@ -14,7 +14,7 @@ public class MinecraftClientMixin
{
//to inject right before
// this.tickWorlds(booleanSupplier_1);
@Inject(method = "init", at = @At(value = "RETURN")
@Inject(method = "start", at = @At(value = "RETURN")
)
private void onInit(CallbackInfo ci) {
//CM start game hook
@@ -28,12 +28,14 @@ public abstract class MinecraftServer_scarpetMixin extends NonBlockingThreadExec
@Shadow private long field_4557;
@Shadow public abstract boolean executeQueuedTask();
@Override
public void forceTick(BooleanSupplier isAhead)
{
timeReference = field_4557 = SystemUtil.getMeasuringTimeMs();
tick(isAhead);
executeTaskQueue();
executeQueuedTasks();
}
@Inject(method = "tick", at = @At(
@@ -13,10 +13,10 @@ public class OceanRuinGeneratorPieceMixin
{
@Redirect(method = "generate", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/IWorld;getLightLevel(Lnet/minecraft/world/Heightmap$Type;II)I"
target = "Lnet/minecraft/world/IWorld;getTopY(Lnet/minecraft/world/Heightmap$Type;II)I"
))
private int getTop(IWorld iWorld, Heightmap.Type var1, int var2, int var3)
{
return iWorld.getLightLevel(CarpetSettings.skipGenerationChecks?Heightmap.Type.OCEAN_FLOOR:Heightmap.Type.OCEAN_FLOOR_WG, var2, var3);
return iWorld.getTopY(CarpetSettings.skipGenerationChecks?Heightmap.Type.OCEAN_FLOOR:Heightmap.Type.OCEAN_FLOOR_WG, var2, var3);
}
}
@@ -67,14 +67,14 @@ public class PortalForcer_portalSuffocationMixin
@Redirect(method = "method_22391",at = @At(
value = "INVOKE",
target = "Lnet/minecraft/block/pattern/BlockPattern$Result;method_18478(Lnet/minecraft/util/math/Direction;Lnet/minecraft/util/math/BlockPos;DLnet/minecraft/util/math/Vec3d;D)Lnet/minecraft/block/pattern/BlockPattern$TeleportTarget;"
target = "Lnet/minecraft/block/pattern/BlockPattern$Result;getTeleportTarget(Lnet/minecraft/util/math/Direction;Lnet/minecraft/util/math/BlockPos;DLnet/minecraft/util/math/Vec3d;D)Lnet/minecraft/block/pattern/BlockPattern$TeleportTarget;"
))
private BlockPattern.TeleportTarget newResult(BlockPattern.Result portal, Direction direction_1, BlockPos blockPos_1, double height_position_from_top, Vec3d vec3d_1, double width_position)
{
if (CarpetSettings.portalSuffocationFix && CarpetSettings.currentTelepotingEntityBox != null)
{
double entityWidth = CarpetSettings.currentTelepotingEntityBox.getXSize();
double entityHeight = CarpetSettings.currentTelepotingEntityBox.getYSize();
double entityWidth = CarpetSettings.currentTelepotingEntityBox.getXLength();
double entityHeight = CarpetSettings.currentTelepotingEntityBox.getYLength();
if (entityWidth >= portal.getWidth())
{
width_position = 0.5; // will suffocate anyways, placing in the middle
@@ -93,7 +93,7 @@ public class PortalForcer_portalSuffocationMixin
}
}
BlockPattern.TeleportTarget target = portal.method_18478(direction_1, blockPos_1, height_position_from_top, vec3d_1, width_position);
BlockPattern.TeleportTarget target = portal.getTeleportTarget(direction_1, blockPos_1, height_position_from_top, vec3d_1, width_position);
CarpetSettings.fixedPosition = target.pos;
return target;
}
@@ -11,7 +11,7 @@ import org.spongepowered.asm.mixin.injection.Redirect;
public class RenderTickCounter_tickSpeedMixin {
@Redirect(method = "beginRenderTick", at = @At(
value = "FIELD",
target = "Lnet/minecraft/client/render/RenderTickCounter;timeScale:F"
target = "Lnet/minecraft/client/render/RenderTickCounter;tickTime:F"
))
private float adjustTickSpeed(RenderTickCounter counter) {
if (CarpetSettings.smoothClientAnimations)
@@ -17,13 +17,13 @@ public class ShipwreckGeneratorPieceMixin
@Redirect(method = "generate", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/IWorld;getLightLevel(Lnet/minecraft/world/Heightmap$Type;II)I"
target = "Lnet/minecraft/world/IWorld;getTopY(Lnet/minecraft/world/Heightmap$Type;II)I"
))
private int getTop(IWorld iWorld, Heightmap.Type var1, int var2, int var3)
{
if (grounded)
return iWorld.getLightLevel(CarpetSettings.skipGenerationChecks?Heightmap.Type.WORLD_SURFACE:Heightmap.Type.WORLD_SURFACE_WG, var2, var3);
return iWorld.getTopY(CarpetSettings.skipGenerationChecks?Heightmap.Type.WORLD_SURFACE:Heightmap.Type.WORLD_SURFACE_WG, var2, var3);
else
return iWorld.getLightLevel(CarpetSettings.skipGenerationChecks?Heightmap.Type.OCEAN_FLOOR:Heightmap.Type.OCEAN_FLOOR_WG, var2, var3);
return iWorld.getTopY(CarpetSettings.skipGenerationChecks?Heightmap.Type.OCEAN_FLOOR:Heightmap.Type.OCEAN_FLOOR_WG, var2, var3);
}
}
@@ -6,7 +6,7 @@ import net.minecraft.server.world.ServerWorld;
import net.minecraft.structure.StructureStart;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.util.math.MutableIntBoundingBox;
import net.minecraft.util.math.BlockBox;
import net.minecraft.world.IWorld;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.chunk.Chunk;
@@ -58,12 +58,12 @@ public abstract class StructureFeatureMixin implements StructureFeatureInterface
// (x) -> new LongOpenHashSet()).add(chId);
world.getChunk(j, k).addStructureReference(this.getName(), chId); //, ChunkStatus.STRUCTURE_STARTS
MutableIntBoundingBox box = structurestart.getBoundingBox();
BlockBox box = structurestart.getBoundingBox();
structurestart.generateStructure(
world,
generator,
rand,
new MutableIntBoundingBox(
new BlockBox(
pos.getX() - this.getRadius()*16,
pos.getZ() - this.getRadius()*16,
pos.getX() + (this.getRadius()+1)*16,
@@ -116,7 +116,7 @@ public abstract class StructureFeatureMixin implements StructureFeatureInterface
}
}
Biome biome_1 = generator.getBiomeSource().getBiome((chunkpos.getStartX() + 9) >> 2, 0, (chunkpos.getStartZ() + 9) >> 2 );
StructureStart structurestart1 = getStructureStartFactory().create((StructureFeature)(Object)this, chunkpos.x, chunkpos.z, MutableIntBoundingBox.empty(),0,generator.getSeed());
StructureStart structurestart1 = getStructureStartFactory().create((StructureFeature)(Object)this, chunkpos.x, chunkpos.z, BlockBox.empty(),0,generator.getSeed());
structurestart1.initialize(generator, ((ServerWorld)worldIn).getStructureManager() , chunkpos.x, chunkpos.z, biome_1);
structurestart = structurestart1.hasChildren() ? structurestart1 : StructureStart.DEFAULT;
@@ -4,7 +4,6 @@ import carpet.settings.CarpetSettings;
import net.minecraft.class_4538;
import net.minecraft.structure.StructurePiece;
import net.minecraft.world.Heightmap;
import net.minecraft.world.ViewableWorld;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@@ -14,10 +13,10 @@ public class StructurePieceMixin
{
@Redirect(method = "isUnderSeaLevel", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/class_4538;getLightLevel(Lnet/minecraft/world/Heightmap$Type;II)I"
target = "Lnet/minecraft/class_4538;getTopY(Lnet/minecraft/world/Heightmap$Type;II)I"
))
private int getTop(class_4538 class_4538, Heightmap.Type var1, int var2, int var3)
{
return class_4538.getLightLevel(CarpetSettings.skipGenerationChecks?Heightmap.Type.OCEAN_FLOOR:Heightmap.Type.OCEAN_FLOOR_WG, var2, var3);
return class_4538.getTopY(CarpetSettings.skipGenerationChecks?Heightmap.Type.OCEAN_FLOOR:Heightmap.Type.OCEAN_FLOOR_WG, var2, var3);
}
}
@@ -168,7 +168,7 @@ public abstract class VillagerEntity_aiMixin extends AbstractTraderEntity
private boolean method_20642(VillagerEntity villagerEntity_1, BlockPos blockPos_1) {
Path path_1 = villagerEntity_1.getNavigation().findPathTo(blockPos_1, PointOfInterestType.HOME.method_21648());
return path_1 != null && path_1.method_21655();
return path_1 != null && path_1.reachesTarget();
}
@@ -138,7 +138,7 @@ public abstract class WorldChunk_movableTEMixin implements WorldChunkInterface
}
if (newBlockEntity != oldBlockEntity && newBlockEntity != null)
{
newBlockEntity.validate();
newBlockEntity.cancelRemoval();
this.world.setBlockEntity(blockPos_1, newBlockEntity);
newBlockEntity.resetBlock();
}
@@ -0,0 +1,18 @@
package carpet.mixins;
import net.minecraft.client.render.WorldRenderer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(WorldRenderer.class)
public class WorldRenderer_pausedShakeMixin
{
/* todo - figure out proper injections to render entity
@Redirect(method = "method_22710", @At(
value = "INVOKE",
target = "float_1"
))
*/
}
@@ -92,10 +92,10 @@ public abstract class World_movableTEMixin implements WorldInterface
{
BlockState blockState_3 = this.getBlockState(blockPos_1);
if (blockState_3 != blockState_2 && (blockState_3.getLightSubtracted((BlockView) this, blockPos_1) != blockState_2.getLightSubtracted((BlockView) this, blockPos_1) || blockState_3.getLuminance() != blockState_2.getLuminance() || blockState_3.hasSidedTransparency() || blockState_2.hasSidedTransparency()))
if (blockState_3 != blockState_2 && (blockState_3.getOpacity((BlockView) this, blockPos_1) != blockState_2.getOpacity((BlockView) this, blockPos_1) || blockState_3.getLuminance() != blockState_2.getLuminance() || blockState_3.hasSidedTransparency() || blockState_2.hasSidedTransparency()))
{
this.profiler.push("queueCheckLight");
this.getChunkManager().getLightingProvider().enqueueLightUpdate(blockPos_1);
this.getChunkManager().getLightingProvider().checkBlock(blockPos_1);
this.profiler.pop();
}
@@ -46,7 +46,7 @@ public abstract class World_tickMixin implements WorldInterface
@Inject(method = "tickBlockEntities", locals = LocalCapture.CAPTURE_FAILHARD, at = @At(
value = "INVOKE",
target = "Lnet/minecraft/block/entity/BlockEntity;isInvalid()Z",
target = "Lnet/minecraft/block/entity/BlockEntity;isRemoved()Z",
shift = At.Shift.BEFORE,
ordinal = 0
))
@@ -57,17 +57,17 @@ public abstract class World_tickMixin implements WorldInterface
@Redirect(method = "tickBlockEntities", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/block/entity/BlockEntity;isInvalid()Z",
target = "Lnet/minecraft/block/entity/BlockEntity;isRemoved()Z",
ordinal = 0
))
private boolean checkProcessTEs(BlockEntity blockEntity)
{
return blockEntity.isInvalid() || !TickSpeed.process_entities;
return blockEntity.isRemoved() || !TickSpeed.process_entities;
}
@Inject(method = "tickBlockEntities", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/block/entity/BlockEntity;isInvalid()Z",
target = "Lnet/minecraft/block/entity/BlockEntity;isRemoved()Z",
shift = At.Shift.BEFORE,
ordinal = 1
))