Update to 1.20.1

This commit is contained in:
Tschipp 2023-07-06 18:48:28 +02:00
parent e44ff0ea5b
commit ddbd9d3d84
14 changed files with 51 additions and 141 deletions

View File

@ -82,7 +82,7 @@ public class CarryOnCommon
if (!Constants.COMMON_CONFIG.settings.slownessInCreative && player.isCreative()) if (!Constants.COMMON_CONFIG.settings.slownessInCreative && player.isCreative())
return; return;
player.addEffect(new MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, 1, potionLevel(carry, player.level), false, false)); player.addEffect(new MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, 1, potionLevel(carry, player.level()), false, false));
Inventory inv = player.getInventory(); Inventory inv = player.getInventory();
inv.selected = carry.getSelected(); inv.selected = carry.getSelected();
@ -119,7 +119,7 @@ public class CarryOnCommon
public static void onPlayerAttacked(Player player) public static void onPlayerAttacked(Player player)
{ {
if (Constants.COMMON_CONFIG.settings.dropCarriedWhenHit && !player.level.isClientSide) if (Constants.COMMON_CONFIG.settings.dropCarriedWhenHit && !player.level().isClientSide)
{ {
CarryOnData carry = CarryOnDataManager.getCarryData(player); CarryOnData carry = CarryOnDataManager.getCarryData(player);
if (carry.isCarrying()) if (carry.isCarrying())

View File

@ -274,7 +274,7 @@ public class CarryRenderHelper
if(state.getRenderShape() != RenderShape.MODEL || model.isCustomRenderer() || model.getQuads(state, null, RandomSource.create()).size() <= 0) { if(state.getRenderShape() != RenderShape.MODEL || model.isCustomRenderer() || model.getQuads(state, null, RandomSource.create()).size() <= 0) {
ItemStack stack = new ItemStack(state.getBlock()); ItemStack stack = new ItemStack(state.getBlock());
model = renderer.getModel(stack, player.level, player, 0); model = renderer.getModel(stack, player.level(), player, 0);
} }
Optional<ModelOverride> ov = ModelOverrideHandler.getModelOverride(state, carry.getContentNbt()); Optional<ModelOverride> ov = ModelOverrideHandler.getModelOverride(state, carry.getContentNbt());
@ -282,7 +282,7 @@ public class CarryRenderHelper
{ {
var renderObj = ov.get().getRenderObject(); var renderObj = ov.get().getRenderObject();
if(renderObj.left().isPresent()) if(renderObj.left().isPresent())
model = renderer.getModel(renderObj.left().get(), player.level, player, 0); model = renderer.getModel(renderObj.left().get(), player.level(), player, 0);
} }
return model; return model;
@ -291,14 +291,14 @@ public class CarryRenderHelper
public static Entity getRenderEntity(Player player) public static Entity getRenderEntity(Player player)
{ {
CarryOnData carry = CarryOnDataManager.getCarryData(player); CarryOnData carry = CarryOnDataManager.getCarryData(player);
Entity entity = carry.getEntity(player.level); Entity entity = carry.getEntity(player.level());
if(carry.getActiveScript().isPresent()) if(carry.getActiveScript().isPresent())
{ {
CarryOnScript script = carry.getActiveScript().get(); CarryOnScript script = carry.getActiveScript().get();
ScriptRender render = script.scriptRender(); ScriptRender render = script.scriptRender();
if(render.renderNameEntity().isPresent()) if(render.renderNameEntity().isPresent())
entity = BuiltInRegistries.ENTITY_TYPE.get(render.renderNameEntity().get()).create(player.level); entity = BuiltInRegistries.ENTITY_TYPE.get(render.renderNameEntity().get()).create(player.level());
if(render.renderNBT().isPresent()) if(render.renderNBT().isPresent())
entity.load(render.renderNBT().get()); entity.load(render.renderNBT().get());
@ -313,7 +313,7 @@ public class CarryRenderHelper
if(carry.isCarrying(CarryType.BLOCK)) if(carry.isCarrying(CarryType.BLOCK))
{ {
BlockState state = getRenderState(player); BlockState state = getRenderState(player);
VoxelShape shape = state.getShape(player.level, player.blockPosition()); VoxelShape shape = state.getShape(player.level(), player.blockPosition());
if(shape == null || shape.isEmpty()) if(shape == null || shape.isEmpty())
return 1f; return 1f;
Optional<ModelOverride> ov = ModelOverrideHandler.getModelOverride(state, carry.getContentNbt()); Optional<ModelOverride> ov = ModelOverrideHandler.getModelOverride(state, carry.getContentNbt());
@ -341,7 +341,7 @@ public class CarryRenderHelper
if(carry.isCarrying(CarryType.BLOCK)) if(carry.isCarrying(CarryType.BLOCK))
{ {
BlockState state = getRenderState(player); BlockState state = getRenderState(player);
VoxelShape shape = state.getShape(player.level, player.blockPosition()); VoxelShape shape = state.getShape(player.level(), player.blockPosition());
if(shape == null || shape.isEmpty()) if(shape == null || shape.isEmpty())
return 1f; return 1f;
Optional<ModelOverride> ov = ModelOverrideHandler.getModelOverride(state, carry.getContentNbt()); Optional<ModelOverride> ov = ModelOverrideHandler.getModelOverride(state, carry.getContentNbt());

View File

@ -208,7 +208,7 @@ public class PickupHandler {
Services.PLATFORM.sendPacketToPlayer(Constants.PACKET_ID_START_RIDING, new ClientboundStartRidingPacket(otherPlayer.getId(), true), player); Services.PLATFORM.sendPacketToPlayer(Constants.PACKET_ID_START_RIDING, new ClientboundStartRidingPacket(otherPlayer.getId(), true), player);
carry.setCarryingPlayer(); carry.setCarryingPlayer();
player.swing(InteractionHand.MAIN_HAND, true); player.swing(InteractionHand.MAIN_HAND, true);
player.level.playSound(null, player.getOnPos(), SoundEvents.ARMOR_EQUIP_GENERIC, SoundSource.AMBIENT, 1.0f, 0.5f); player.level().playSound(null, player.getOnPos(), SoundEvents.ARMOR_EQUIP_GENERIC, SoundSource.AMBIENT, 1.0f, 0.5f);
CarryOnDataManager.setCarryData(player, carry); CarryOnDataManager.setCarryData(player, carry);
return true; return true;
@ -230,7 +230,7 @@ public class PickupHandler {
carry.setEntity(entity); carry.setEntity(entity);
entity.remove(RemovalReason.UNLOADED_WITH_PLAYER); entity.remove(RemovalReason.UNLOADED_WITH_PLAYER);
player.level.playSound(null, player.getOnPos(), SoundEvents.ARMOR_EQUIP_GENERIC, SoundSource.AMBIENT, 1.0f, 0.5f); player.level().playSound(null, player.getOnPos(), SoundEvents.ARMOR_EQUIP_GENERIC, SoundSource.AMBIENT, 1.0f, 0.5f);
CarryOnDataManager.setCarryData(player, carry); CarryOnDataManager.setCarryData(player, carry);
player.swing(InteractionHand.MAIN_HAND, true); player.swing(InteractionHand.MAIN_HAND, true);
return true; return true;

View File

@ -45,7 +45,7 @@ public class PlacementHandler
if (player.tickCount == carry.getTick()) if (player.tickCount == carry.getTick())
return false; return false;
Level level = player.getLevel(); Level level = player.level();
BlockState state = carry.getBlock(); BlockState state = carry.getBlock();
BlockPlaceContext context = new BlockPlaceContext(player, InteractionHand.MAIN_HAND, ItemStack.EMPTY, BlockHitResult.miss(player.position(), facing, pos)); BlockPlaceContext context = new BlockPlaceContext(player, InteractionHand.MAIN_HAND, ItemStack.EMPTY, BlockHitResult.miss(player.position(), facing, pos));
@ -106,7 +106,7 @@ public class PlacementHandler
} }
} }
BlockState updatedState = Block.updateFromNeighbourShapes(state, player.level, pos); BlockState updatedState = Block.updateFromNeighbourShapes(state, player.level(), pos);
if (updatedState.getBlock() == state.getBlock()) if (updatedState.getBlock() == state.getBlock())
state = updatedState; state = updatedState;
@ -132,7 +132,7 @@ public class PlacementHandler
if (player.tickCount == carry.getTick()) if (player.tickCount == carry.getTick())
return false; return false;
Level level = player.getLevel(); Level level = player.level();
BlockPlaceContext context = new BlockPlaceContext(player, InteractionHand.MAIN_HAND, ItemStack.EMPTY, BlockHitResult.miss(player.position(), facing, pos)); BlockPlaceContext context = new BlockPlaceContext(player, InteractionHand.MAIN_HAND, ItemStack.EMPTY, BlockHitResult.miss(player.position(), facing, pos));
if (!level.getBlockState(pos).canBeReplaced(context)) if (!level.getBlockState(pos).canBeReplaced(context))
@ -185,7 +185,7 @@ public class PlacementHandler
if (!carry.isCarrying(CarryType.ENTITY) && !carry.isCarrying(CarryType.PLAYER)) if (!carry.isCarrying(CarryType.ENTITY) && !carry.isCarrying(CarryType.PLAYER))
return; return;
Level level = player.level; Level level = player.level();
Entity entityHeld; Entity entityHeld;
if (carry.isCarrying(CarryType.ENTITY)) if (carry.isCarrying(CarryType.ENTITY))
entityHeld = carry.getEntity(level); entityHeld = carry.getEntity(level);
@ -250,7 +250,7 @@ public class PlacementHandler
public static void placeCarriedOnDeath(ServerPlayer oldPlayer, ServerPlayer newPlayer, boolean died) public static void placeCarriedOnDeath(ServerPlayer oldPlayer, ServerPlayer newPlayer, boolean died)
{ {
CarryOnData carry = CarryOnDataManager.getCarryData(oldPlayer); CarryOnData carry = CarryOnDataManager.getCarryData(oldPlayer);
if (oldPlayer.level.getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY) || !died) { if (oldPlayer.level().getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY) || !died) {
if (!carry.isCarrying(CarryType.PLAYER)) { if (!carry.isCarrying(CarryType.PLAYER)) {
CarryOnDataManager.setCarryData(newPlayer, carry); CarryOnDataManager.setCarryData(newPlayer, carry);
newPlayer.getInventory().selected = oldPlayer.getInventory().selected; newPlayer.getInventory().selected = oldPlayer.getInventory().selected;
@ -265,17 +265,17 @@ public class PlacementHandler
{ {
CarryOnData carry = CarryOnDataManager.getCarryData(player); CarryOnData carry = CarryOnDataManager.getCarryData(player);
if (carry.isCarrying(CarryType.ENTITY)) { if (carry.isCarrying(CarryType.ENTITY)) {
Entity entity = carry.getEntity(player.level); Entity entity = carry.getEntity(player.level());
entity.setPos(player.position()); entity.setPos(player.position());
player.level.addFreshEntity(entity); player.level().addFreshEntity(entity);
} else if (carry.isCarrying(CarryType.BLOCK)) { } else if (carry.isCarrying(CarryType.BLOCK)) {
BlockPlaceContext context = new BlockPlaceContext(player, InteractionHand.MAIN_HAND, ItemStack.EMPTY, BlockHitResult.miss(Vec3.atCenterOf(player.blockPosition()), Direction.DOWN, player.blockPosition())); BlockPlaceContext context = new BlockPlaceContext(player, InteractionHand.MAIN_HAND, ItemStack.EMPTY, BlockHitResult.miss(Vec3.atCenterOf(player.blockPosition()), Direction.DOWN, player.blockPosition()));
BlockState state = getPlacementState(carry.getBlock(), player, context, player.blockPosition()); BlockState state = getPlacementState(carry.getBlock(), player, context, player.blockPosition());
BlockPos pos = getDeathPlacementPos(state, player); BlockPos pos = getDeathPlacementPos(state, player);
BlockEntity blockEntity = carry.getBlockEntity(pos); BlockEntity blockEntity = carry.getBlockEntity(pos);
player.level.setBlock(pos, state, 3); player.level().setBlock(pos, state, 3);
if (blockEntity != null) if (blockEntity != null)
player.level.setBlockEntity(blockEntity); player.level().setBlockEntity(blockEntity);
} else if (carry.isCarrying(CarryType.PLAYER)) { } else if (carry.isCarrying(CarryType.PLAYER)) {
player.ejectPassengers(); player.ejectPassengers();
} }
@ -307,7 +307,7 @@ public class PlacementHandler
for(BlockPos potential : potentialPositions) for(BlockPos potential : potentialPositions)
{ {
BlockPlaceContext context = new BlockPlaceContext(player, InteractionHand.MAIN_HAND, ItemStack.EMPTY, BlockHitResult.miss(Vec3.atCenterOf(potential), Direction.DOWN, potential)); BlockPlaceContext context = new BlockPlaceContext(player, InteractionHand.MAIN_HAND, ItemStack.EMPTY, BlockHitResult.miss(Vec3.atCenterOf(potential), Direction.DOWN, potential));
boolean canPlace = state.canSurvive(player.level, potential) && player.level.getBlockState(potential).canBeReplaced(context) && player.level.isUnobstructed(state, potential, CollisionContext.of(player)); boolean canPlace = state.canSurvive(player.level(), potential) && player.level().getBlockState(potential).canBeReplaced(context) && player.level().isUnobstructed(state, potential, CollisionContext.of(player));
if (canPlace) if (canPlace)
return potential; return potential;

View File

@ -75,7 +75,7 @@ public class CommandCarryOn
} }
else if (carry.isCarrying(CarryType.ENTITY)) else if (carry.isCarrying(CarryType.ENTITY))
{ {
Entity entity = carry.getEntity(player.level); Entity entity = carry.getEntity(player.level());
log(source,"Entity: " + entity); log(source,"Entity: " + entity);
log(source,"Entity Name: " + entity.getType()); log(source,"Entity Name: " + entity.getType());
log(source,"NBT: " + carry.getNbt()); log(source,"NBT: " + carry.getNbt());
@ -112,11 +112,14 @@ public class CommandCarryOn
cleared++; cleared++;
} }
int finalCleared = cleared;
if (cleared != 1) if (cleared != 1) {
source.sendSuccess(Component.literal("Cleared " + cleared + " Items!"), true); source.sendSuccess(() -> Component.literal("Cleared " + finalCleared + " Items!"), true);
else }
source.sendSuccess(Component.literal("Cleared " + cleared + " Item!"), true); else {
source.sendSuccess(() -> Component.literal("Cleared " + finalCleared + " Item!"), true);
}
return 1; return 1;
} }
@ -129,18 +132,20 @@ public class CommandCarryOn
PlacementHandler.placeCarried(player); PlacementHandler.placeCarried(player);
cleared++; cleared++;
} }
int finalCleared = cleared;
if (cleared != 1) if (cleared != 1) {
source.sendSuccess(Component.literal("Placed " + cleared + " Items!"), true); source.sendSuccess(() -> Component.literal("Placed " + finalCleared + " Items!"), true);
}
else else
source.sendSuccess(Component.literal("Placed " + cleared + " Item!"), true); source.sendSuccess(() -> Component.literal("Placed " + finalCleared + " Item!"), true);
return 1; return 1;
} }
private static void log(CommandSourceStack source, String toLog) private static void log(CommandSourceStack source, String toLog)
{ {
source.sendSuccess(Component.literal(toLog), true); source.sendSuccess(() -> Component.literal(toLog), true);
Constants.LOG.info(toLog); Constants.LOG.info(toLog);
} }
} }

View File

@ -74,17 +74,15 @@ public record CarryOnScript(
public record ScriptObjectBlock( public record ScriptObjectBlock(
Optional<ResourceKey<Block>> typeNameBlock, Optional<ResourceKey<Block>> typeNameBlock,
MaterialCondition typeMaterial,
NumberBoundCondition typeHardness, NumberBoundCondition typeHardness,
NumberBoundCondition typeResistance, NumberBoundCondition typeResistance,
NBTCondition typeBlockTag NBTCondition typeBlockTag
){ ){
public static final ScriptObjectBlock EMPTY = new ScriptObjectBlock(Optional.empty(), MaterialCondition.NONE, NumberBoundCondition.NONE, NumberBoundCondition.NONE, NBTCondition.NONE); public static final ScriptObjectBlock EMPTY = new ScriptObjectBlock(Optional.empty(), NumberBoundCondition.NONE, NumberBoundCondition.NONE, NBTCondition.NONE);
public static final Codec<ScriptObjectBlock> CODEC = RecordCodecBuilder.create(instance -> public static final Codec<ScriptObjectBlock> CODEC = RecordCodecBuilder.create(instance ->
instance.group( instance.group(
ResourceKey.codec(Registries.BLOCK).optionalFieldOf("name").forGetter(ScriptObjectBlock::typeNameBlock), ResourceKey.codec(Registries.BLOCK).optionalFieldOf("name").forGetter(ScriptObjectBlock::typeNameBlock),
MaterialCondition.CODEC.optionalFieldOf("material", MaterialCondition.NONE).forGetter(ScriptObjectBlock::typeMaterial),
NumberBoundCondition.CODEC.optionalFieldOf("hardness", NumberBoundCondition.NONE).forGetter(ScriptObjectBlock::typeHardness), NumberBoundCondition.CODEC.optionalFieldOf("hardness", NumberBoundCondition.NONE).forGetter(ScriptObjectBlock::typeHardness),
NumberBoundCondition.CODEC.optionalFieldOf("resistance", NumberBoundCondition.NONE).forGetter(ScriptObjectBlock::typeResistance), NumberBoundCondition.CODEC.optionalFieldOf("resistance", NumberBoundCondition.NONE).forGetter(ScriptObjectBlock::typeResistance),
NBTCondition.CODEC.optionalFieldOf("nbt", NBTCondition.NONE).forGetter(ScriptObjectBlock::typeBlockTag) NBTCondition.CODEC.optionalFieldOf("nbt", NBTCondition.NONE).forGetter(ScriptObjectBlock::typeBlockTag)

View File

@ -10,7 +10,6 @@ import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.ServerAdvancementManager; import net.minecraft.server.ServerAdvancementManager;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import net.minecraft.world.scores.Objective; import net.minecraft.world.scores.Objective;
import net.minecraft.world.scores.Score; import net.minecraft.world.scores.Score;
@ -97,91 +96,6 @@ public final class Matchables
} }
} }
public record MaterialCondition(String material) implements Matchable<Material>
{
public static final Codec<MaterialCondition> CODEC = Codec.STRING.xmap(MaterialCondition::new, MaterialCondition::material);
public static final MaterialCondition NONE = new MaterialCondition("");
@Override
public boolean matches(Material material)
{
if (this.material == null || this.material.isEmpty())
return true;
switch (this.material) {
case "air":
return material == Material.AIR;
case "anvil":
return material == Material.HEAVY_METAL;
case "barrier":
return material == Material.BARRIER;
case "cactus":
return material == Material.CACTUS;
case "cake":
return material == Material.CAKE;
case "carpet":
return material == Material.CLOTH_DECORATION;
case "clay":
return material == Material.CLAY;
case "cloth":
return material == Material.WOOL;
case "dragon_egg":
return material == Material.EGG;
case "fire":
return material == Material.FIRE;
case "glass":
return material == Material.GLASS;
case "gourd":
return material == Material.VEGETABLE;
case "grass":
return material == Material.GRASS;
case "ground":
return material == Material.GRASS;
case "ice":
return material == Material.ICE;
case "iron":
return material == Material.METAL;
case "lava":
return material == Material.LAVA;
case "leaves":
return material == Material.LEAVES;
case "packed_ice":
return material == Material.ICE_SOLID;
case "piston":
return material == Material.PISTON;
case "plants":
return material == Material.PLANT;
case "portal":
return material == Material.PORTAL;
case "redstone_light":
return material == Material.BUILDABLE_GLASS;
case "rock":
return material == Material.STONE;
case "sand":
return material == Material.SAND;
case "snow":
return material == Material.TOP_SNOW;
case "sponge":
return material == Material.SPONGE;
case "structure_void":
return material == Material.STRUCTURAL_AIR;
case "tnt":
return material == Material.EXPLOSIVE;
case "vine":
return material == Material.PLANT;
case "water":
return material == Material.WATER;
case "web":
return material == Material.WEB;
case "wood":
return material == Material.WOOD;
default:
return false;
}
}
}
public record AdvancementCondition(String advancement) implements Matchable<ServerPlayer> public record AdvancementCondition(String advancement) implements Matchable<ServerPlayer>
{ {
public static final Codec<AdvancementCondition> CODEC = Codec.STRING.xmap(AdvancementCondition::new, AdvancementCondition::advancement); public static final Codec<AdvancementCondition> CODEC = Codec.STRING.xmap(AdvancementCondition::new, AdvancementCondition::advancement);

View File

@ -8,7 +8,6 @@ import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Material;
import tschipp.carryon.Constants; import tschipp.carryon.Constants;
import tschipp.carryon.common.scripting.CarryOnScript.ScriptObject.ScriptObjectBlock; import tschipp.carryon.common.scripting.CarryOnScript.ScriptObject.ScriptObjectBlock;
import tschipp.carryon.common.scripting.CarryOnScript.ScriptObject.ScriptObjectEntity; import tschipp.carryon.common.scripting.CarryOnScript.ScriptObject.ScriptObjectEntity;
@ -28,13 +27,12 @@ public class ScriptManager
return Optional.empty(); return Optional.empty();
Block block = state.getBlock(); Block block = state.getBlock();
Material material = state.getMaterial();
float hardness = state.getDestroySpeed(level, pos); float hardness = state.getDestroySpeed(level, pos);
float resistance = block.getExplosionResistance(); float resistance = block.getExplosionResistance();
for (CarryOnScript script : SCRIPTS) for (CarryOnScript script : SCRIPTS)
{ {
if (script.isBlock() && matchesAll(script, block, material, hardness, resistance, tag)) if (script.isBlock() && matchesAll(script, block, hardness, resistance, tag))
return Optional.of(script); return Optional.of(script);
} }
@ -76,7 +74,7 @@ public class ScriptManager
return matchname && matchheight && matchwidth && matchhealth && matchnbt; return matchname && matchheight && matchwidth && matchhealth && matchnbt;
} }
private static boolean matchesAll(CarryOnScript script, Block block, Material material, float hardness, float resistance, CompoundTag nbt) private static boolean matchesAll(CarryOnScript script, Block block, float hardness, float resistance, CompoundTag nbt)
{ {
ScriptObjectBlock scBlock = script.scriptObject().block(); ScriptObjectBlock scBlock = script.scriptObject().block();
@ -84,10 +82,9 @@ public class ScriptManager
if(scBlock.typeNameBlock().isPresent()) if(scBlock.typeNameBlock().isPresent())
matchblock = block == BuiltInRegistries.BLOCK.get(scBlock.typeNameBlock().get()); matchblock = block == BuiltInRegistries.BLOCK.get(scBlock.typeNameBlock().get());
boolean matchnbt = scBlock.typeBlockTag().matches(nbt); boolean matchnbt = scBlock.typeBlockTag().matches(nbt);
boolean matchmaterial = scBlock.typeMaterial().matches(material);
boolean matchhardness = scBlock.typeHardness().matches(hardness); boolean matchhardness = scBlock.typeHardness().matches(hardness);
boolean matchresistance = scBlock.typeResistance().matches(resistance); boolean matchresistance = scBlock.typeResistance().matches(resistance);
return matchnbt && matchblock && matchmaterial && matchhardness && matchresistance; return matchnbt && matchblock && matchhardness && matchresistance;
} }
} }

View File

@ -32,7 +32,7 @@ public class ClientboundStartRidingPacket extends PacketBase
@Override @Override
public void handle(Player player) public void handle(Player player)
{ {
Entity otherPlayer = player.level.getEntity(this.entityId); Entity otherPlayer = player.level().getEntity(this.entityId);
if(otherPlayer != null) if(otherPlayer != null)
if(ride) if(ride)
otherPlayer.startRiding(player); otherPlayer.startRiding(player);

View File

@ -21,7 +21,7 @@ public class PlayerMixinFabric
{ {
Player player = ((Player)(Object)this); Player player = ((Player)(Object)this);
CarryOnData carry = CarryOnDataManager.getCarryData(player); CarryOnData carry = CarryOnDataManager.getCarryData(player);
if(carry.isCarrying() && !player.level.isClientSide) if(carry.isCarrying() && !player.level().isClientSide)
PlacementHandler.placeCarried((ServerPlayer)player); PlacementHandler.placeCarried((ServerPlayer)player);
} }

View File

@ -33,7 +33,7 @@
"depends": { "depends": {
"fabricloader": ">=0.14", "fabricloader": ">=0.14",
"fabric-api": "*", "fabric-api": "*",
"minecraft": ">=1.19.3", "minecraft": ">=1.20.1",
"java": ">=17" "java": ">=17"
} }
} }

View File

@ -159,7 +159,7 @@ public class CommonEvents
@SubscribeEvent @SubscribeEvent
public static void onClone(Clone event) public static void onClone(Clone event)
{ {
if (!event.getOriginal().level.isClientSide) if (!event.getOriginal().level().isClientSide)
PlacementHandler.placeCarriedOnDeath((ServerPlayer) event.getOriginal(), (ServerPlayer) event.getEntity(), event.isWasDeath()); PlacementHandler.placeCarriedOnDeath((ServerPlayer) event.getOriginal(), (ServerPlayer) event.getEntity(), event.isWasDeath());
} }

View File

@ -1,5 +1,5 @@
modLoader="javafml" #mandatory modLoader="javafml" #mandatory
loaderVersion="[44,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. loaderVersion="[47,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
license="GNU LGPLv3" license="GNU LGPLv3"
issueTrackerURL="https://github.com/Tschipp/CarryOn/issues" issueTrackerURL="https://github.com/Tschipp/CarryOn/issues"
@ -19,7 +19,7 @@ issueTrackerURL="https://github.com/Tschipp/CarryOn/issues"
# Does this dependency have to exist - if not, ordering below must be specified # Does this dependency have to exist - if not, ordering below must be specified
mandatory=true #mandatory mandatory=true #mandatory
# The version range of the dependency # The version range of the dependency
versionRange="[44,)" #mandatory versionRange="[47,)" #mandatory
# An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory # An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory
ordering="NONE" ordering="NONE"
# Side this dependency is applied on - BOTH, CLIENT or SERVER # Side this dependency is applied on - BOTH, CLIENT or SERVER
@ -28,6 +28,6 @@ issueTrackerURL="https://github.com/Tschipp/CarryOn/issues"
[[dependencies.carryon]] [[dependencies.carryon]]
modId="minecraft" modId="minecraft"
mandatory=true mandatory=true
versionRange="[1.19.3,1.20)" versionRange="[1.20.1,1.21)"
ordering="NONE" ordering="NONE"
side="BOTH" side="BOTH"

View File

@ -1,26 +1,22 @@
# Project # Project
version=2.0.5 version=2.1.0
group=tschipp.carryon group=tschipp.carryon
# Common # Common
minecraft_version=1.19.4 minecraft_version=1.20.1
common_runs_enabled=false common_runs_enabled=false
common_client_run_name=Common Client common_client_run_name=Common Client
common_server_run_name=Common Server common_server_run_name=Common Server
# Forge # Forge
forge_version=45.0.47 forge_version=47.0.49
parchment_mappings=2023.06.26-1.19.4 parchment_mappings=2023.07.02-1.20.1
//forge_ats_enabled=true //forge_ats_enabled=true
# Fabric # Fabric
fabric_version=0.85.0+1.19.4 fabric_version=0.85.0+1.20.1
fabric_loader_version=0.14.21 fabric_loader_version=0.14.21
parchment_mappings_fabric=1.19.4:2023.06.26 parchment_mappings_fabric=1.20.1:2023.07.02
# Quilt
quilt_loader_version=0.16.0-beta.7
quilt_stdlib_version=1.1.0-beta.3+1.18.2
# Mod options # Mod options
mod_name=Carry On mod_name=Carry On