This commit is contained in:
gnembon committed 2024-08-21 23:19:15 +02:00
1 parent f6d5529b07
commit 6d0c9597cd
9 files changed
+34 -29

No files matched your search

@@ -56,7 +56,7 @@ public class PerimeterInfoCommand
{
nbttagcompound.putString("id", mobId);
Entity baseEntity = EntityType.loadEntityRecursive(nbttagcompound, source.getLevel(), EntitySpawnReason.COMMAND, (entity_1x) -> {
entity_1x.moveTo(new BlockPos(pos.getX(), source.getLevel().getMinBuildHeight()-10, pos.getZ()), entity_1x.getYRot(), entity_1x. getXRot());
entity_1x.moveTo(new BlockPos(pos.getX(), source.getLevel().getMinY()-10, pos.getZ()), entity_1x.getYRot(), entity_1x. getXRot());
return !source.getLevel().addWithUUID(entity_1x) ? null : entity_1x;
});
if (!(baseEntity instanceof Mob))
@@ -314,7 +314,7 @@ public class EntityPlayerActionPack
BlockHitResult blockHit = (BlockHitResult) hit;
BlockPos pos = blockHit.getBlockPos();
Direction side = blockHit.getDirection();
if (pos.getY() < player.level().getMaxBuildHeight() - (side == Direction.UP ? 1 : 0) && world.mayInteract(player, pos))
if (pos.getY() < player.level().getMaxY() - (side == Direction.UP ? 1 : 0) && world.mayInteract(player, pos))
{
InteractionResult result = player.gameMode.useItemOn(player, world, player.getItemInHand(hand), hand, blockHit);
if (result instanceof InteractionResult.Success success)
@@ -402,7 +402,7 @@ public class EntityPlayerActionPack
boolean blockBroken = false;
if (player.gameMode.getGameModeForPlayer().isCreative())
{
player.gameMode.handleBlockBreakAction(pos, ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, side, player.level().getMaxBuildHeight(), -1);
player.gameMode.handleBlockBreakAction(pos, ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, side, player.level().getMaxY(), -1);
ap.blockHitDelay = 5;
blockBroken = true;
}
@@ -410,9 +410,9 @@ public class EntityPlayerActionPack
{
if (ap.currentBlock != null)
{
player.gameMode.handleBlockBreakAction(ap.currentBlock, ServerboundPlayerActionPacket.Action.ABORT_DESTROY_BLOCK, side, player.level().getMaxBuildHeight(), -1);
player.gameMode.handleBlockBreakAction(ap.currentBlock, ServerboundPlayerActionPacket.Action.ABORT_DESTROY_BLOCK, side, player.level().getMaxY(), -1);
}
player.gameMode.handleBlockBreakAction(pos, ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, side, player.level().getMaxBuildHeight(), -1);
player.gameMode.handleBlockBreakAction(pos, ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, side, player.level().getMaxY(), -1);
boolean notAir = !state.isAir();
if (notAir && ap.curBlockDamageMP == 0)
{
@@ -435,7 +435,7 @@ public class EntityPlayerActionPack
ap.curBlockDamageMP += state.getDestroyProgress(player, player.level(), pos);
if (ap.curBlockDamageMP >= 1)
{
player.gameMode.handleBlockBreakAction(pos, ServerboundPlayerActionPacket.Action.STOP_DESTROY_BLOCK, side, player.level().getMaxBuildHeight(), -1);
player.gameMode.handleBlockBreakAction(pos, ServerboundPlayerActionPacket.Action.STOP_DESTROY_BLOCK, side, player.level().getMaxY(), -1);
ap.currentBlock = null;
ap.blockHitDelay = 5;
blockBroken = true;
@@ -457,7 +457,7 @@ public class EntityPlayerActionPack
EntityPlayerActionPack ap = ((ServerPlayerInterface) player).getActionPack();
if (ap.currentBlock == null) return;
player.level().destroyBlockProgress(-1, ap.currentBlock, -1);
player.gameMode.handleBlockBreakAction(ap.currentBlock, ServerboundPlayerActionPacket.Action.ABORT_DESTROY_BLOCK, Direction.DOWN, player.level().getMaxBuildHeight(), -1);
player.gameMode.handleBlockBreakAction(ap.currentBlock, ServerboundPlayerActionPacket.Action.ABORT_DESTROY_BLOCK, Direction.DOWN, player.level().getMaxY(), -1);
ap.currentBlock = null;
}
},
@@ -33,7 +33,7 @@ import static net.minecraft.world.level.block.RedStoneWireBlock.POWER;
public abstract class RedstoneWireBlock_fastMixin implements RedstoneWireBlockInterface {
@Shadow
private void updatePowerStrength(Level world_1, BlockPos blockPos_1, BlockState blockState_1, @Nullable final Orientation orientation) { }
private void updatePowerStrength(Level world_1, BlockPos blockPos_1, BlockState blockState_1, @Nullable final Orientation orientation, boolean sup) { }
@Override
@Accessor("shouldSignal")
@@ -57,7 +57,7 @@ public abstract class RedstoneWireBlock_fastMixin implements RedstoneWireBlockIn
// =
public void fastUpdate(Level world, BlockPos pos, BlockState state, Orientation o) {
public void fastUpdate(Level world, BlockPos pos, BlockState state, Orientation o, boolean sup) {
// [CM] fastRedstoneDust -- update based on carpet rule
if (CarpetSettings.fastRedstoneDust) {
BlockPos source = null; // todo this probably removes all improvements from the original method
@@ -65,14 +65,14 @@ public abstract class RedstoneWireBlock_fastMixin implements RedstoneWireBlockIn
wireTurbo.updateSurroundingRedstone(world, pos, state, source);
return;
}
updatePowerStrength(world, pos, state, o);
updatePowerStrength(world, pos, state, o, sup);
}
/**
* @author theosib, soykaf, gnembon
*/
@Inject(method = "updatePowerStrength", at = @At("HEAD"), cancellable = true)
private void updateLogicAlternative(Level world, BlockPos pos, BlockState state, Orientation orientation, CallbackInfo cir) {
private void updateLogicAlternative(Level world, BlockPos pos, BlockState state, Orientation orientation, boolean sup, CallbackInfo cir) {
if (CarpetSettings.fastRedstoneDust) {
updateLogicPublic(world, pos, state);
cir.cancel();
@@ -114,17 +114,20 @@ public abstract class RedstoneWireBlock_fastMixin implements RedstoneWireBlockIn
// =
@Redirect(method = "onPlace", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/RedStoneWireBlock;updatePowerStrength(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/redstone/Orientation;)V"))
private void redirectOnBlockAddedUpdate(RedStoneWireBlock self, Level world_1, BlockPos blockPos_1, BlockState blockState_1, Orientation o) {
fastUpdate(world_1, blockPos_1, blockState_1, o);
@Redirect(method = "onPlace", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/RedStoneWireBlock;updatePowerStrength(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/redstone/Orientation;Z)V"))
private void redirectOnBlockAddedUpdate(RedStoneWireBlock self, Level world_1, BlockPos blockPos_1, BlockState blockState_1, Orientation o, boolean sup) {
fastUpdate(world_1, blockPos_1, blockState_1, o, sup);
}
@Redirect(method = "onRemove", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/RedStoneWireBlock;updatePowerStrength(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/redstone/Orientation;)V"))
private void redirectOnStateReplacedUpdate(RedStoneWireBlock self, Level world_1, BlockPos blockPos_1, BlockState blockState_1, Orientation o) {
fastUpdate(world_1, blockPos_1, blockState_1, o);
@Redirect(method = "onRemove", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/RedStoneWireBlock;updatePowerStrength(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/redstone/Orientation;Z)V"))
private void redirectOnStateReplacedUpdate(RedStoneWireBlock self, Level world_1, BlockPos blockPos_1, BlockState blockState_1, Orientation o, boolean sup) {
fastUpdate(world_1, blockPos_1, blockState_1, o, sup);
}
@Redirect(method = "neighborChanged", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/RedStoneWireBlock;updatePowerStrength(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/redstone/Orientation;)V"))
@Redirect(method = "neighborChanged", at = @At(value = "INVOKE", target =
"Lnet/minecraft/world/level/block/RedStoneWireBlock;updatePowerStrength(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/redstone/Orientation;Z)V"
//"Lnet/minecraft/world/level/block/RedStoneWireBlock;updatePowerStrength(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/redstone/Orientation;)V"
))
//private void red(final RedStoneWireBlock instance, final Level level,
// final BlockPos blockPos, final BlockState blockState, final Orientation orientation)
private void redirectNeighborUpdateUpdate(
@@ -133,6 +136,7 @@ public abstract class RedstoneWireBlock_fastMixin implements RedstoneWireBlockIn
BlockPos blockPos_1,
BlockState blockState_1,
Orientation o,
boolean sup,
BlockState blockState_2,
Level world_2,
BlockPos blockPos_2,
@@ -141,6 +145,6 @@ public abstract class RedstoneWireBlock_fastMixin implements RedstoneWireBlockIn
boolean b
)
{
fastUpdate(world_1, blockPos_1, blockState_1, o);
fastUpdate(world_1, blockPos_1, blockState_1, o, sup);
}
}
@@ -61,8 +61,8 @@ public abstract class ThreadedLevelLightEngine_scarpetChunkCreationMixin extends
this.addTask(pos.x, pos.z, () -> 0, ThreadedLevelLightEngine.TaskType.PRE_UPDATE, Util.name(() -> {
super.propagateLightSources(pos);
int minY = chunk.getMinBuildHeight();
int maxY = chunk.getMaxBuildHeight();
int minY = chunk.getMinY();
int maxY = chunk.getMaxY();
int minX = pos.getMinBlockX();
int minZ = pos.getMinBlockZ();
BlockPos.MutableBlockPos poss = new BlockPos.MutableBlockPos();
@@ -1348,7 +1348,7 @@ public class WorldAccess
int biomeZ = QuartPos.fromBlock(pos.getZ());
try
{
int i = QuartPos.fromBlock(chunk.getMinBuildHeight());
int i = QuartPos.fromBlock(chunk.getMinY());
int j = i + QuartPos.fromBlock(chunk.getHeight()) - 1;
int k = Mth.clamp(biomeY, i, j);
int l = chunk.getSectionIndex(QuartPos.toBlock(k));
@@ -25,6 +25,7 @@ import net.minecraft.client.Camera;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Font;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.renderer.CoreShaders;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.client.renderer.ItemBlockRenderTypes;
import net.minecraft.client.renderer.LightTexture;
@@ -121,7 +122,7 @@ public class ShapesRenderer
}
long currentTime = client.level.getGameTime();
RenderSystem.enableDepthTest();
RenderSystem.setShader(GameRenderer::getPositionColorShader);
RenderSystem.setShader(CoreShaders.POSITION_COLOR);
RenderSystem.depthFunc(515);
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
@@ -407,7 +408,7 @@ public class ShapesRenderer
if (blockState.getBlock() instanceof LeavesBlock && !Minecraft.useFancyGraphics()) {
type = RenderType.solid();
} else {
type = ItemBlockRenderTypes.getRenderType(blockState, false);
type = ItemBlockRenderTypes.getRenderType(blockState);
}
client.getBlockRenderer().getModelRenderer().renderModel(matrices.last(), immediate.getBuffer(type), blockState, bakedModel, red, green, blue, light, OverlayTexture.NO_OVERLAY);
}
@@ -61,9 +61,9 @@ public class SystemInfo
put("world_dimensions", c -> ListValue.wrap(c.server().levelKeys().stream().map(k -> ValueConversions.of(k.location()))));
put("world_spawn_point", c -> ValueConversions.of(c.server().overworld().getLevelData().getSpawnPos()));
put("world_bottom", c -> new NumericValue(c.level().getMinBuildHeight()));
put("world_bottom", c -> new NumericValue(c.level().getMinY()));
put("world_top", c -> new NumericValue(c.level().getMaxBuildHeight()));
put("world_top", c -> new NumericValue(c.level().getMaxY()));
put("world_center", c -> {
WorldBorder worldBorder = c.level().getWorldBorder();
@@ -87,8 +87,8 @@ public class PerimeterDiagnostics
PerimeterDiagnostics diagnostic = new PerimeterDiagnostics(worldserver,ctype,el);
EntityType<?> type = EntityType.ZOMBIE;
if (el != null) type = el.getType();
int minY = worldserver.getMinBuildHeight();
int maxY = worldserver.getMaxBuildHeight();
int minY = worldserver.getMinY();
int maxY = worldserver.getMaxY();
for (int x = -128; x <= 128; ++x)
{
for (int z = -128; z <= 128; ++z)