This commit is contained in:
gnembon committed 2025-01-16 12:43:30 +01:00
1 parent c241594eb6
commit fd098151c4
18 files changed
+100 -39

No files matched your search

@@ -19,9 +19,6 @@ public abstract class ExperienceOrb_xpNoCooldownMixin extends Entity
@Shadow
private int count;
@Shadow
private int value;
public ExperienceOrb_xpNoCooldownMixin(EntityType<?> type, Level world)
{
super(type, world);
@@ -30,13 +27,15 @@ public abstract class ExperienceOrb_xpNoCooldownMixin extends Entity
@Shadow
protected abstract int repairPlayerItems(ServerPlayer player, int amount);
@Shadow public abstract int getValue();
@Inject(method = "playerTouch", at = @At("HEAD"))
private void addXP(Player player, CallbackInfo ci) {
if (CarpetSettings.xpNoCooldown && !level().isClientSide) {
player.takeXpDelay = 0;
// reducing the count to 1 and leaving vanilla to deal with it
while (this.count > 1) {
int remainder = this.repairPlayerItems((ServerPlayer) player, this.value);
int remainder = this.repairPlayerItems((ServerPlayer) player, this.getValue());
if (remainder > 0) {
player.giveExperiencePoints(remainder);
}
@@ -25,7 +25,7 @@ public abstract class Guardian_renewableSpongesMixin extends Monster
if (!this.level().isClientSide && !this.isRemoved() && CarpetSettings.renewableSponges && !((Object)this instanceof ElderGuardian))
{
ElderGuardian elderGuardian = new ElderGuardian(EntityType.ELDER_GUARDIAN ,this.level());
elderGuardian.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
elderGuardian.snapTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
elderGuardian.finalizeSpawn(serverWorld ,this.level().getCurrentDifficultyAt(elderGuardian.blockPosition()), EntitySpawnReason.CONVERSION, null);
elderGuardian.setNoAi(this.isNoAi());
@@ -27,13 +27,13 @@ public class LevelChunk_fillUpdatesMixin
@Redirect(method = "setBlockState", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/level/block/entity/BlockEntity;preRemoveSideEffects(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Z)V"
target = "Lnet/minecraft/world/level/block/entity/BlockEntity;preRemoveSideEffects(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;)V"
))
private void onPreRemoveSideEffects(BlockEntity blockEntity, BlockPos blockPos_1, BlockState blockState_1, boolean boolean_1)
private void onPreRemoveSideEffects(BlockEntity blockEntity, BlockPos blockPos_1, BlockState blockState_1)
{
if (!CarpetSettings.impendingFillSkipUpdates.get())
{
blockEntity.preRemoveSideEffects(blockPos_1, blockState_1, boolean_1);
blockEntity.preRemoveSideEffects(blockPos_1, blockState_1);
}
}
@@ -12,6 +12,7 @@ import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelHeightAccessor;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.BaseRailBlock;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.entity.BlockEntity;
@@ -81,7 +82,7 @@ public abstract class LevelChunk_movableBEMixin extends ChunkAccess implements W
public BlockState setBlockStateWithBlockEntity(BlockPos blockPos_1, BlockState newBlockState, BlockEntity newBlockEntity,
int flags)
{
boolean boolean_1 = (flags & 64) != 0;
int y = blockPos_1.getY();
LevelChunkSection chunkSection = this.getSection(this.getSectionIndex(y));
@@ -122,37 +123,35 @@ public abstract class LevelChunk_movableBEMixin extends ChunkAccess implements W
profiler.pop();
}
boolean hadBlockEntity = oldBlockState.hasBlockEntity();
boolean blockChanged = !oldBlockState.is(newBlock);
boolean boolean_1 = (flags & 64) != 0; // moved by pistons
boolean sideEffects = (flags & Block.UPDATE_SKIP_BLOCK_ENTITY_SIDEEFFECTS) == 0;
if (blockChanged) {
if (blockChanged && oldBlockState.hasBlockEntity()) {
if (level instanceof ServerLevel serverLevel && !(oldBlockState.getBlock() instanceof MovingPistonBlock)) {
if (hadBlockEntity && sideEffects) {
final BlockEntity blockEntity = level.getBlockEntity(blockPos_1);
if (sideEffects) {
BlockEntity blockEntity = level.getBlockEntity(blockPos_1);
if (blockEntity != null) {
blockEntity.preRemoveSideEffects(blockPos_1, oldBlockState, boolean_1);
blockEntity.preRemoveSideEffects(blockPos_1, oldBlockState);
}
}
}
removeBlockEntity(blockPos_1);
}
if (hadBlockEntity) {
removeBlockEntity(blockPos_1);
}
if ((flags & Block.UPDATE_NEIGHBORS) != 0) { // scary change // so many other places that used to call this regardless if the UPDATE_NEIGHBORS flag was set
if (blockChanged || newBlock instanceof BaseRailBlock)
{
if (level instanceof ServerLevel serverLevel && !(oldBlockState.getBlock() instanceof MovingPistonBlock))
{
if ((flags & Block.UPDATE_NEIGHBORS) != 0 || boolean_1)
{
oldBlockState.affectNeighborsAfterRemoval(serverLevel, blockPos_1, boolean_1);
}
} else if (hadBlockEntity) {
removeBlockEntity(blockPos_1);
}
}
if (chunkSection.getBlockState(x, chunkY, z).getBlock() != newBlock)
if (chunkSection.getBlockState(x, chunkY, z).getBlock() != newBlock)
{
return null;
}
@@ -29,14 +29,14 @@ public abstract class StructureBlockEntity_limitsMixin
}
@ModifyArg(
method = "saveStructure(Z)Z",
method = "saveStructure(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/resources/ResourceLocation;Lnet/minecraft/core/BlockPos;Lnet/minecraft/core/Vec3i;ZLjava/lang/String;Z)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate;fillFromWorld(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/core/Vec3i;ZLnet/minecraft/world/level/block/Block;)V"
),
index = 4
)
private Block ignoredBlock(Block original) {
private static Block ignoredBlock(Block original) {
return CarpetSettings.structureBlockIgnoredBlock;
}
}
@@ -2,14 +2,14 @@ package carpet.mixins;
import carpet.CarpetSettings;
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
import net.minecraft.client.renderer.blockentity.StructureBlockRenderer;
import net.minecraft.client.renderer.blockentity.BlockEntityWithBoundingBoxRenderer;
import net.minecraft.world.level.block.entity.StructureBlockEntity;
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.callback.CallbackInfoReturnable;
@Mixin(StructureBlockRenderer.class)
@Mixin(BlockEntityWithBoundingBoxRenderer.class)
public abstract class StructureBlockRenderer_mixin implements BlockEntityRenderer<StructureBlockEntity>
{
@Inject(method = "getViewDistance", at = @At("HEAD"), cancellable = true)