its a doozie

This commit is contained in:
gnembon committed 2021-03-24 10:35:52 -03:00
1 parent 365892b9ca
commit ab553187c5
43 files changed
+356 -351

No files matched your search

@@ -9,6 +9,8 @@ import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(BaseRangeDecorator.class)
public class BaseRangeDecorator_cleanLogsMixin {
@SuppressWarnings("UnresolvedMixinReference")
@Redirect(method = "getY(Lnet/minecraft/world/gen/decorator/DecoratorContext;Ljava/util/Random;Lnet/minecraft/world/gen/decorator/RangeDecoratorConfig;I)I",
at = @At(value = "INVOKE", target = "Lorg/apache/logging/log4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V")
)
@@ -2,7 +2,7 @@ package carpet.mixins;
import carpet.fakes.BlockStateArgumentInterface;
import net.minecraft.command.argument.BlockStateArgument;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtCompound;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
@@ -11,10 +11,10 @@ import org.spongepowered.asm.mixin.Shadow;
@Mixin(BlockStateArgument.class)
public class BlockStateArgument_scarpetMixin implements BlockStateArgumentInterface
{
@Shadow @Final private @Nullable CompoundTag data;
@Shadow @Final private @Nullable NbtCompound data;
@Override
public CompoundTag getCMTag()
public NbtCompound getCMTag()
{
return data;
}
@@ -8,7 +8,7 @@ import net.minecraft.entity.SpawnReason;
import net.minecraft.entity.mob.ElderGuardianEntity;
import net.minecraft.entity.mob.GuardianEntity;
import net.minecraft.entity.mob.HostileEntity;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
@@ -28,7 +28,7 @@ public abstract class GuardianEntityMixin extends HostileEntity
{
ElderGuardianEntity elderGuardian = new ElderGuardianEntity(EntityType.ELDER_GUARDIAN ,this.world);
elderGuardian.refreshPositionAndAngles(this.getX(), this.getY(), this.getZ(), this.yaw, this.pitch);
elderGuardian.initialize(serverWorld ,this.world.getLocalDifficulty(elderGuardian.getBlockPos()), SpawnReason.CONVERSION, (EntityData)null, (CompoundTag)null);
elderGuardian.initialize(serverWorld ,this.world.getLocalDifficulty(elderGuardian.getBlockPos()), SpawnReason.CONVERSION, (EntityData)null, (NbtCompound)null);
elderGuardian.setAiDisabled(this.isAiDisabled());
if (this.hasCustomName())
@@ -10,7 +10,7 @@ import net.minecraft.block.Blocks;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.block.entity.PistonBlockEntity;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
@@ -128,25 +128,25 @@ public abstract class PistonBlockEntity_movableTEMixin extends BlockEntity imple
}
@Inject(method = "readNbt", at = @At(value = "TAIL"))
private void onFromTag(CompoundTag compoundTag_1, CallbackInfo ci)
private void onFromTag(NbtCompound NbtCompound_1, CallbackInfo ci)
{
if (CarpetSettings.movableBlockEntities && compoundTag_1.contains("carriedTileEntityCM", 10))
if (CarpetSettings.movableBlockEntities && NbtCompound_1.contains("carriedTileEntityCM", 10))
{
if (this.pushedBlock.getBlock() instanceof BlockEntityProvider)
this.carriedBlockEntity = ((BlockEntityProvider) (this.pushedBlock.getBlock())).createBlockEntity(pos, pushedBlock);// this.world);
if (carriedBlockEntity != null) //Can actually be null, as BlockPistonMoving.createNewTileEntity(...) returns null
this.carriedBlockEntity.readNbt(compoundTag_1.getCompound("carriedTileEntityCM"));
this.carriedBlockEntity.readNbt(NbtCompound_1.getCompound("carriedTileEntityCM"));
setCarriedBlockEntity(carriedBlockEntity);
}
}
@Inject(method = "writeNbt", at = @At(value = "RETURN", shift = At.Shift.BEFORE))
private void onToTag(CompoundTag compoundTag_1, CallbackInfoReturnable<CompoundTag> cir)
private void onToTag(NbtCompound NbtCompound_1, CallbackInfoReturnable<NbtCompound> cir)
{
if (CarpetSettings.movableBlockEntities && this.carriedBlockEntity != null)
{
//Leave name "carriedTileEntityCM" instead of "carriedBlockEntityCM" for upgrade compatibility with 1.13.2 movable TE
compoundTag_1.put("carriedTileEntityCM", this.carriedBlockEntity.writeNbt(new CompoundTag()));
NbtCompound_1.put("carriedTileEntityCM", this.carriedBlockEntity.writeNbt(new NbtCompound()));
}
}
}
@@ -41,7 +41,7 @@ public abstract class PistonHandler_customStickyMixin
@Shadow protected abstract boolean tryMove(BlockPos blockPos_1, Direction direction_1);
@Shadow private static boolean isBlockSticky(BlockState block_1) { return false; }
@Shadow private static boolean isAdjacentBlockStuck(BlockState block, BlockState block2) {return false;}
@Shadow protected abstract boolean canMoveAdjacentBlock(BlockPos pos);
@Shadow protected abstract boolean tryMoveAdjacentBlock(BlockPos pos);
// collects information about sticking block when backtracking.
private BlockPos currentPos;
@@ -169,7 +169,7 @@ public abstract class PistonHandler_customStickyMixin
BlockState chainState = world.getBlockState(pos);
// chain is sideways
if (chainState.getBlock() == Blocks.CHAIN && !isChainOnAxis(chainState, motionDirection)
&& !this.canMoveAdjacentBlock(pos))
&& !this.tryMoveAdjacentBlock(pos))
{
cir.setReturnValue(false);
}
@@ -217,7 +217,7 @@ public abstract class PistonHandler_customStickyMixin
if (CarpetSettings.doChainStone)
{
BlockState chainState = world.getBlockState(blockPos3);
if (chainState.getBlock() == Blocks.CHAIN && !isChainOnAxis(chainState, motionDirection) && !canMoveAdjacentBlock(blockPos3))
if (chainState.getBlock() == Blocks.CHAIN && !isChainOnAxis(chainState, motionDirection) && !tryMoveAdjacentBlock(blockPos3))
{
cir.setReturnValue(false);
}
@@ -228,7 +228,7 @@ public abstract class PistonHandler_customStickyMixin
/**
* Custom movement of blocks stuck to the sides of blocks other than slimeblocks like chains
*/
@Inject(method = "canMoveAdjacentBlock", locals = LocalCapture.CAPTURE_FAILHARD, cancellable = true, at = @At(
@Inject(method = "tryMoveAdjacentBlock", locals = LocalCapture.CAPTURE_FAILHARD, cancellable = true, at = @At(
value = "INVOKE",
target = "Lnet/minecraft/block/piston/PistonHandler;isAdjacentBlockStuck(Lnet/minecraft/block/BlockState;Lnet/minecraft/block/BlockState;)Z",
shift = At.Shift.BEFORE
@@ -264,7 +264,7 @@ public abstract class PistonHandler_customStickyMixin
* @param block2
* @return
*/
@Redirect(method = "canMoveAdjacentBlock", at = @At(
@Redirect(method = "tryMoveAdjacentBlock", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/block/piston/PistonHandler;isAdjacentBlockStuck(Lnet/minecraft/block/BlockState;Lnet/minecraft/block/BlockState;)Z")
)
@@ -6,7 +6,7 @@ import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.player.PlayerAbilities;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
@@ -24,15 +24,15 @@ public abstract class PlayerEntity_parrotMixin extends LivingEntity
@Shadow protected abstract void dropShoulderEntities();
@Shadow public abstract CompoundTag getShoulderEntityLeft();
@Shadow public abstract NbtCompound getShoulderEntityLeft();
@Shadow protected abstract void setShoulderEntityLeft(CompoundTag compoundTag_1);
@Shadow protected abstract void setShoulderEntityLeft(NbtCompound NbtCompound_1);
@Shadow protected abstract void setShoulderEntityRight(CompoundTag compoundTag_1);
@Shadow protected abstract void setShoulderEntityRight(NbtCompound NbtCompound_1);
@Shadow public abstract CompoundTag getShoulderEntityRight();
@Shadow public abstract NbtCompound getShoulderEntityRight();
@Shadow protected abstract void dropShoulderEntity(CompoundTag entityNbt);
@Shadow protected abstract void dropShoulderEntity(NbtCompound entityNbt);
protected PlayerEntity_parrotMixin(EntityType<? extends LivingEntity> entityType_1, World world_1)
{
@@ -47,7 +47,7 @@ public abstract class PlayerEntity_parrotMixin extends LivingEntity
}
@Inject(method = "tickMovement", at = @At(value = "INVOKE", shift = At.Shift.AFTER, ordinal = 1,
target = "Lnet/minecraft/entity/player/PlayerEntity;updateShoulderEntity(Lnet/minecraft/nbt/CompoundTag;)V"))
target = "Lnet/minecraft/entity/player/PlayerEntity;updateShoulderEntity(Lnet/minecraft/nbt/NbtCompound;)V"))
private void onTickMovement(CallbackInfo ci)
{
boolean parrots_will_drop = !CarpetSettings.persistentParrots || this.abilities.invulnerable;
@@ -67,13 +67,13 @@ public abstract class PlayerEntity_parrotMixin extends LivingEntity
protected void dismount_left()
{
dropShoulderEntity(this.getShoulderEntityLeft());
this.setShoulderEntityLeft(new CompoundTag());
this.setShoulderEntityLeft(new NbtCompound());
}
protected void dismount_right()
{
dropShoulderEntity(this.getShoulderEntityRight());
this.setShoulderEntityRight(new CompoundTag());
this.setShoulderEntityRight(new NbtCompound());
}
@Inject(method = "damage", at = @At(value = "INVOKE", shift = At.Shift.BEFORE,
@@ -1,7 +1,7 @@
package carpet.mixins;
import com.mojang.authlib.GameProfile;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.network.ClientConnection;
import net.minecraft.text.TranslatableText;
import net.minecraft.server.MinecraftServer;
@@ -31,7 +31,7 @@ public abstract class PlayerManager_fakePlayersMixin
private MinecraftServer server;
@Inject(method = "loadPlayerData", at = @At(value = "RETURN", shift = At.Shift.BEFORE))
private void fixStartingPos(ServerPlayerEntity serverPlayerEntity_1, CallbackInfoReturnable<CompoundTag> cir)
private void fixStartingPos(ServerPlayerEntity serverPlayerEntity_1, CallbackInfoReturnable<NbtCompound> cir)
{
if (serverPlayerEntity_1 instanceof EntityPlayerMPFake)
{
@@ -13,7 +13,7 @@ import net.minecraft.entity.EntityType;
import net.minecraft.entity.SpawnReason;
import net.minecraft.entity.mob.MobEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.tag.BlockTags;
import net.minecraft.util.math.BlockPos;
@@ -175,9 +175,9 @@ public class SpawnHelperMixin
@Redirect(method = "spawnEntitiesInChunk(Lnet/minecraft/entity/SpawnGroup;Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/world/chunk/Chunk;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/world/SpawnHelper$Checker;Lnet/minecraft/world/SpawnHelper$Runner;)V", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/entity/mob/MobEntity;initialize(Lnet/minecraft/world/ServerWorldAccess;Lnet/minecraft/world/LocalDifficulty;Lnet/minecraft/entity/SpawnReason;Lnet/minecraft/entity/EntityData;Lnet/minecraft/nbt/CompoundTag;)Lnet/minecraft/entity/EntityData;"
target = "Lnet/minecraft/entity/mob/MobEntity;initialize(Lnet/minecraft/world/ServerWorldAccess;Lnet/minecraft/world/LocalDifficulty;Lnet/minecraft/entity/SpawnReason;Lnet/minecraft/entity/EntityData;Lnet/minecraft/nbt/NbtCompound;)Lnet/minecraft/entity/EntityData;"
))
private static EntityData spawnEntity(MobEntity mobEntity, ServerWorldAccess serverWorldAccess, LocalDifficulty difficulty, SpawnReason spawnReason, EntityData entityData, CompoundTag entityTag)
private static EntityData spawnEntity(MobEntity mobEntity, ServerWorldAccess serverWorldAccess, LocalDifficulty difficulty, SpawnReason spawnReason, EntityData entityData, NbtCompound entityTag)
{
if (!SpawnReporter.mock_spawns) // WorldAccess
return mobEntity.initialize(serverWorldAccess, difficulty, spawnReason, entityData, entityTag);
@@ -6,7 +6,7 @@ import carpet.script.value.Value;
import carpet.script.value.ValueConversions;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.state.property.Property;
import net.minecraft.tag.Tag;
import org.spongepowered.asm.mixin.Final;
@@ -23,7 +23,7 @@ public class StatePredicate_scarpetMixin implements BlockPredicateInterface
@Shadow @Final private BlockState state;
@Shadow @Final /*@Nullable*/ private CompoundTag nbt;
@Shadow @Final /*@Nullable*/ private NbtCompound nbt;
@Shadow @Final private Set<Property<?>> properties;
@@ -50,7 +50,7 @@ public class StatePredicate_scarpetMixin implements BlockPredicateInterface
}
@Override
public CompoundTag getCMDataTag()
public NbtCompound getCMDataTag()
{
return nbt;
}
@@ -5,7 +5,7 @@ import carpet.script.value.StringValue;
import carpet.script.value.Value;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.tag.Tag;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
@@ -21,7 +21,7 @@ public class TagPredicate_scarpetMixin implements BlockPredicateInterface
@Shadow @Final private Map<String, String> properties;
@Shadow @Final /*@Nullable*/ private CompoundTag nbt;
@Shadow @Final /*@Nullable*/ private NbtCompound nbt;
@Override
public BlockState getCMBlockState()
@@ -45,7 +45,7 @@ public class TagPredicate_scarpetMixin implements BlockPredicateInterface
}
@Override
public CompoundTag getCMDataTag()
public NbtCompound getCMDataTag()
{
return nbt;
}