Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
de388366ca | ||
|
|
b66040bf03 | ||
|
|
47910dbf61 | ||
|
|
f147e801cc |
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
package tschipp.carryon;
|
||||
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import tschipp.carryon.common.config.CarryConfig;
|
||||
|
|
@ -34,10 +34,10 @@ public class Constants {
|
|||
public static final CarryConfig.Common COMMON_CONFIG = new CarryConfig.Common();
|
||||
public static final CarryConfig.Client CLIENT_CONFIG = new CarryConfig.Client();
|
||||
|
||||
public static final ResourceLocation PACKET_ID_KEY_PRESSED = ResourceLocation.fromNamespaceAndPath(Constants.MOD_ID, "key_pressed");
|
||||
public static final ResourceLocation PACKET_ID_START_RIDING = ResourceLocation.fromNamespaceAndPath(Constants.MOD_ID, "start_riding");
|
||||
public static final ResourceLocation PACKET_ID_SYNC_SCRIPTS = ResourceLocation.fromNamespaceAndPath(Constants.MOD_ID, "sync_scripts");
|
||||
public static final ResourceLocation PACKET_ID_START_RIDING_OTHER = ResourceLocation.fromNamespaceAndPath(Constants.MOD_ID, "start_riding_other");
|
||||
public static final ResourceLocation PACKET_ID_SYNC_CARRY_ON_DATA = ResourceLocation.fromNamespaceAndPath(Constants.MOD_ID, "sync_carry_data");
|
||||
public static final Identifier PACKET_ID_KEY_PRESSED = Identifier.fromNamespaceAndPath(Constants.MOD_ID, "key_pressed");
|
||||
public static final Identifier PACKET_ID_START_RIDING = Identifier.fromNamespaceAndPath(Constants.MOD_ID, "start_riding");
|
||||
public static final Identifier PACKET_ID_SYNC_SCRIPTS = Identifier.fromNamespaceAndPath(Constants.MOD_ID, "sync_scripts");
|
||||
public static final Identifier PACKET_ID_START_RIDING_OTHER = Identifier.fromNamespaceAndPath(Constants.MOD_ID, "start_riding_other");
|
||||
public static final Identifier PACKET_ID_SYNC_CARRY_ON_DATA = Identifier.fromNamespaceAndPath(Constants.MOD_ID, "sync_carry_data");
|
||||
|
||||
}
|
||||
|
|
@ -22,13 +22,13 @@ package tschipp.carryon.client.keybinds;
|
|||
|
||||
import com.mojang.blaze3d.platform.InputConstants;
|
||||
import net.minecraft.client.KeyMapping;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.client.KeyMapping.Category;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import tschipp.carryon.Constants;
|
||||
import tschipp.carryon.networking.serverbound.ServerboundCarryKeyPressedPacket;
|
||||
import tschipp.carryon.platform.Services;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
import net.minecraft.client.KeyMapping.Category;
|
||||
|
||||
public class CarryOnKeybinds
|
||||
{
|
||||
|
|
@ -36,7 +36,7 @@ public class CarryOnKeybinds
|
|||
|
||||
public static void registerKeybinds(Consumer<KeyMapping> registrar)
|
||||
{
|
||||
Category category = Category.register(ResourceLocation.fromNamespaceAndPath(Constants.MOD_ID,"key.carry.category"));
|
||||
Category category = Category.register(Identifier.fromNamespaceAndPath(Constants.MOD_ID,"key.carry.category"));
|
||||
|
||||
carryKey = new KeyMapping("key.carry.desc", InputConstants.KEY_LSHIFT, category);
|
||||
|
||||
|
|
|
|||
|
|
@ -20,14 +20,13 @@
|
|||
|
||||
package tschipp.carryon.client.render;
|
||||
|
||||
import com.mojang.blaze3d.vertex.*;
|
||||
import com.mojang.math.Axis;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.SubmitNodeCollector;
|
||||
import net.minecraft.client.renderer.entity.EntityRenderDispatcher;
|
||||
import net.minecraft.client.renderer.entity.state.EntityRenderState;
|
||||
import net.minecraft.client.renderer.item.ItemStackRenderState;
|
||||
import net.minecraft.client.renderer.rendertype.RenderTypes;
|
||||
import net.minecraft.client.renderer.state.CameraRenderState;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
|
|
@ -38,16 +37,12 @@ import net.minecraft.world.item.ItemDisplayContext;
|
|||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import tschipp.carryon.Constants;
|
||||
import tschipp.carryon.common.carry.CarryOnData;
|
||||
import tschipp.carryon.common.carry.CarryOnData.CarryType;
|
||||
import tschipp.carryon.common.carry.CarryOnDataManager;
|
||||
import tschipp.carryon.common.scripting.CarryOnScript;
|
||||
import tschipp.carryon.common.scripting.CarryOnScript.ScriptRender;
|
||||
import tschipp.carryon.platform.Services;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class CarriedObjectRender
|
||||
{
|
||||
public static boolean draw(Player player, PoseStack matrix, int light, float partialTicks,SubmitNodeCollector nodeCollector, boolean firstPerson)
|
||||
|
|
@ -85,7 +80,7 @@ public class CarriedObjectRender
|
|||
CarryOnData carry = CarryOnDataManager.getCarryData(player);
|
||||
ItemStackRenderState renderState = new ItemStackRenderState();
|
||||
var layer = renderState.newLayer();
|
||||
layer.setRenderType(RenderType.glint());
|
||||
layer.setRenderType(RenderTypes.glint());
|
||||
|
||||
matrix.pushPose();
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import com.mojang.blaze3d.vertex.PoseStack;
|
|||
import com.mojang.math.Axis;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.util.ProblemReporter;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntitySpawnReason;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
package tschipp.carryon.client.render;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.model.PlayerModel;
|
||||
import net.minecraft.client.model.player.PlayerModel;
|
||||
import net.minecraft.client.renderer.SubmitNodeCollector;
|
||||
import net.minecraft.client.renderer.entity.RenderLayerParent;
|
||||
import net.minecraft.client.renderer.entity.layers.RenderLayer;
|
||||
|
|
|
|||
|
|
@ -29,13 +29,8 @@ import net.minecraft.util.ProblemReporter;
|
|||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
import net.minecraft.world.entity.AgeableMob;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.*;
|
||||
import net.minecraft.world.entity.Entity.RemovalReason;
|
||||
import net.minecraft.world.entity.EntityReference;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.MobCategory;
|
||||
import net.minecraft.world.entity.TamableAnimal;
|
||||
import net.minecraft.world.entity.animal.Animal;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.level.GameType;
|
||||
|
|
@ -43,7 +38,6 @@ import net.minecraft.world.level.Level;
|
|||
import net.minecraft.world.level.block.DoorBlock;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.properties.DoubleBlockHalf;
|
||||
import net.minecraft.world.level.block.state.properties.Property;
|
||||
import net.minecraft.world.level.storage.TagValueOutput;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
|
@ -108,6 +102,9 @@ public class PickupHandler {
|
|||
nbt = output.buildResult();
|
||||
}
|
||||
|
||||
Optional<CarryOnScript> result = ScriptManager.inspectBlock(state, level, pos, nbt);
|
||||
boolean overrideChecks = result.map(CarryOnScript::overrideChecks).orElse(false);
|
||||
|
||||
if(!ListHandler.isPermitted(state.getBlock()))
|
||||
return false;
|
||||
|
||||
|
|
@ -115,10 +112,10 @@ public class PickupHandler {
|
|||
if(hasPropertyType(state, DoorBlock.HALF))
|
||||
return false;
|
||||
|
||||
if(state.getDestroySpeed(level, pos) == -1 && !player.isCreative() && !Constants.COMMON_CONFIG.settings.pickupUnbreakableBlocks)
|
||||
if(!overrideChecks && (state.getDestroySpeed(level, pos) == -1 && !player.isCreative() && !Constants.COMMON_CONFIG.settings.pickupUnbreakableBlocks))
|
||||
return false;
|
||||
|
||||
if(blockEntity == null && !Constants.COMMON_CONFIG.settings.pickupAllBlocks)
|
||||
if(!overrideChecks && (blockEntity == null && !Constants.COMMON_CONFIG.settings.pickupAllBlocks))
|
||||
return false;
|
||||
|
||||
//Check if TE is locked
|
||||
|
|
@ -139,7 +136,6 @@ public class PickupHandler {
|
|||
if(!doPickup)
|
||||
return false;
|
||||
|
||||
Optional<CarryOnScript> result = ScriptManager.inspectBlock(state, level, pos, nbt);
|
||||
if(result.isPresent())
|
||||
{
|
||||
CarryOnScript script = result.get();
|
||||
|
|
@ -190,17 +186,20 @@ public class PickupHandler {
|
|||
}
|
||||
}
|
||||
|
||||
Optional<CarryOnScript> result = ScriptManager.inspectEntity(entity);
|
||||
boolean overrideChecks = result.map(CarryOnScript::overrideChecks).orElse(false);
|
||||
|
||||
if(!ListHandler.isPermitted(entity))
|
||||
{
|
||||
//We can pick up baby animals even if the grown up animal is blacklisted.
|
||||
if(!(entity instanceof AgeableMob ageableMob && Constants.COMMON_CONFIG.settings.allowBabies && (ageableMob.getAge() < 0 || ageableMob.isBaby())))
|
||||
if(!overrideChecks && (!(entity instanceof AgeableMob ageableMob && Constants.COMMON_CONFIG.settings.allowBabies && (ageableMob.getAge() < 0 || ageableMob.isBaby()))))
|
||||
return false;
|
||||
}
|
||||
|
||||
//Non-Creative only guards
|
||||
if(!player.isCreative())
|
||||
{
|
||||
if(!Constants.COMMON_CONFIG.settings.pickupHostileMobs && entity.getType().getCategory() == MobCategory.MONSTER)
|
||||
if(!overrideChecks && (!Constants.COMMON_CONFIG.settings.pickupHostileMobs && entity.getType().getCategory() == MobCategory.MONSTER))
|
||||
return false;
|
||||
|
||||
if(Constants.COMMON_CONFIG.settings.maxEntityHeight < entity.getBbHeight() || Constants.COMMON_CONFIG.settings.maxEntityWidth < entity.getBbWidth())
|
||||
|
|
@ -220,7 +219,6 @@ public class PickupHandler {
|
|||
|
||||
CarryOnData carry = CarryOnDataManager.getCarryData(player);
|
||||
|
||||
Optional<CarryOnScript> result = ScriptManager.inspectEntity(entity);
|
||||
if(result.isPresent())
|
||||
{
|
||||
CarryOnScript script = result.get();
|
||||
|
|
|
|||
|
|
@ -22,8 +22,6 @@ package tschipp.carryon.common.carry;
|
|||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.server.TickTask;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
|
|
@ -31,16 +29,16 @@ import net.minecraft.world.InteractionHand;
|
|||
import net.minecraft.world.effect.MobEffects;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.Mob;
|
||||
import net.minecraft.world.entity.animal.horse.Horse;
|
||||
import net.minecraft.world.entity.animal.equine.Horse;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||
import net.minecraft.world.level.GameRules;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
import net.minecraft.world.level.block.state.properties.Property;
|
||||
import net.minecraft.world.level.gamerules.GameRules;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
|
|
@ -292,7 +290,7 @@ public class PlacementHandler
|
|||
public static void placeCarriedOnDeath(ServerPlayer oldPlayer, ServerPlayer newPlayer, boolean died)
|
||||
{
|
||||
CarryOnData carry = CarryOnDataManager.getCarryData(oldPlayer);
|
||||
if (oldPlayer.level().getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY) || !died) {
|
||||
if (oldPlayer.level().getGameRules().get(GameRules.KEEP_INVENTORY) || !died) {
|
||||
if (!carry.isCarrying(CarryType.PLAYER)) {
|
||||
CarryOnDataManager.setCarryData(newPlayer, carry);
|
||||
newPlayer.getInventory().setSelectedSlot(oldPlayer.getInventory().getSelectedSlot());
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@ import net.minecraft.commands.Commands;
|
|||
import net.minecraft.commands.arguments.EntityArgument;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.server.permissions.Permission;
|
||||
import net.minecraft.server.permissions.PermissionLevel;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import tschipp.carryon.Constants;
|
||||
|
|
@ -54,11 +56,11 @@ public class CommandCarryOn
|
|||
|
||||
.then(Commands.literal("clear").executes(cmd -> handleClear(cmd.getSource(), Collections.singleton(cmd.getSource().getPlayerOrException()))))
|
||||
|
||||
.then(Commands.literal("clear").then(Commands.argument("target", EntityArgument.players()).requires(src -> src.hasPermission(2)).executes(cmd -> handleClear(cmd.getSource(), EntityArgument.getPlayers(cmd, "target")))))
|
||||
.then(Commands.literal("clear").then(Commands.argument("target", EntityArgument.players()).requires(src -> src.permissions().hasPermission(new Permission.HasCommandLevel(PermissionLevel.GAMEMASTERS))).executes(cmd -> handleClear(cmd.getSource(), EntityArgument.getPlayers(cmd, "target")))))
|
||||
|
||||
.then(Commands.literal("place").requires(src -> src.hasPermission(2)).executes(cmd -> handlePlace(cmd.getSource(), Collections.singleton(cmd.getSource().getPlayerOrException()))))
|
||||
.then(Commands.literal("place").requires(src -> src.permissions().hasPermission(new Permission.HasCommandLevel(PermissionLevel.GAMEMASTERS))).executes(cmd -> handlePlace(cmd.getSource(), Collections.singleton(cmd.getSource().getPlayerOrException()))))
|
||||
|
||||
.then(Commands.literal("place").then(Commands.argument("target", EntityArgument.players()).requires(src -> src.hasPermission(2)).executes(cmd -> handlePlace(cmd.getSource(), EntityArgument.getPlayers(cmd, "target")))))
|
||||
.then(Commands.literal("place").then(Commands.argument("target", EntityArgument.players()).requires(src -> src.permissions().hasPermission(new Permission.HasCommandLevel(PermissionLevel.GAMEMASTERS))).executes(cmd -> handlePlace(cmd.getSource(), EntityArgument.getPlayers(cmd, "target")))))
|
||||
|
||||
;
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ package tschipp.carryon.common.config;
|
|||
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
|
|
@ -119,8 +119,8 @@ public class ListHandler {
|
|||
ALLOWED_TILES_TAGS.clear();
|
||||
PROPERTY_EXCEPTION_CLASSES.clear();
|
||||
|
||||
Map<ResourceLocation, TagKey<Block>> blocktags = BuiltInRegistries.BLOCK.listTagIds().collect(Collectors.toMap(t -> t.location(), t -> t));
|
||||
Map<ResourceLocation, TagKey<EntityType<?>>> entitytags = BuiltInRegistries.ENTITY_TYPE.listTagIds().collect(Collectors.toMap(t -> t.location(), t -> t));
|
||||
Map<Identifier, TagKey<Block>> blocktags = BuiltInRegistries.BLOCK.listTagIds().collect(Collectors.toMap(t -> t.location(), t -> t));
|
||||
Map<Identifier, TagKey<EntityType<?>>> entitytags = BuiltInRegistries.ENTITY_TYPE.listTagIds().collect(Collectors.toMap(t -> t.location(), t -> t));
|
||||
|
||||
List<String> forbidden = new ArrayList<>(List.of(Constants.COMMON_CONFIG.blacklist.forbiddenTiles));
|
||||
forbidden.add("#carryon:block_blacklist");
|
||||
|
|
@ -152,7 +152,7 @@ public class ListHandler {
|
|||
continue;
|
||||
String name = propString.substring(0, propString.indexOf("["));
|
||||
String props = propString.substring(propString.indexOf("[") + 1, propString.indexOf("]"));
|
||||
Block blk = BuiltInRegistries.BLOCK.get(ResourceLocation.parse(name)).get().value();
|
||||
Block blk = BuiltInRegistries.BLOCK.get(Identifier.parse(name)).get().value();
|
||||
for(String propName : props.split(",")) {
|
||||
for (Property<?> prop : blk.defaultBlockState().getProperties()) {
|
||||
if (prop.getName().equals(propName))
|
||||
|
|
@ -162,16 +162,16 @@ public class ListHandler {
|
|||
}
|
||||
}
|
||||
|
||||
private static <T> void addTag(String tag, Map<ResourceLocation, TagKey<T>> tagMap, List<TagKey<T>> tags) {
|
||||
private static <T> void addTag(String tag, Map<Identifier, TagKey<T>> tagMap, List<TagKey<T>> tags) {
|
||||
String sub = tag.substring(1);
|
||||
TagKey<T> t = tagMap.get(ResourceLocation.parse(sub));
|
||||
TagKey<T> t = tagMap.get(Identifier.parse(sub));
|
||||
if (t != null)
|
||||
tags.add(t);
|
||||
}
|
||||
|
||||
private static <T> void addWithWildcards(List<String> entries, Set<String> toAddTo, Registry<T> registry, Map<ResourceLocation, TagKey<T>> tags, List<TagKey<T>> toAddTags) {
|
||||
private static <T> void addWithWildcards(List<String> entries, Set<String> toAddTo, Registry<T> registry, Map<Identifier, TagKey<T>> tags, List<TagKey<T>> toAddTags) {
|
||||
|
||||
ResourceLocation[] keys = registry.keySet().toArray(new ResourceLocation[0]);
|
||||
Identifier[] keys = registry.keySet().toArray(new Identifier[0]);
|
||||
for (int i = 0; i < entries.size(); i++)
|
||||
{
|
||||
String curr = entries.get(i);
|
||||
|
|
@ -181,7 +181,7 @@ public class ListHandler {
|
|||
{
|
||||
String[] filter = curr.replace("*", ",").split(",");
|
||||
|
||||
for (ResourceLocation key : keys)
|
||||
for (Identifier key : keys)
|
||||
{
|
||||
|
||||
if (containsAll(key.toString(), filter))
|
||||
|
|
|
|||
|
|
@ -39,12 +39,13 @@ public record CarryOnScript(
|
|||
ScriptObject scriptObject,
|
||||
ScriptConditions scriptConditions,
|
||||
ScriptRender scriptRender,
|
||||
ScriptEffects scriptEffects)
|
||||
ScriptEffects scriptEffects,
|
||||
boolean overrideChecks)
|
||||
{
|
||||
|
||||
public boolean isValid()
|
||||
{
|
||||
return (isBlock() ^ isEntity()) && (scriptConditions != ScriptConditions.EMPTY || scriptRender != ScriptRender.EMPTY || scriptEffects != ScriptEffects.EMPTY);
|
||||
return (isBlock() ^ isEntity()) && (scriptConditions != ScriptConditions.EMPTY || scriptRender != ScriptRender.EMPTY || scriptEffects != ScriptEffects.EMPTY || overrideChecks);
|
||||
}
|
||||
|
||||
public boolean isBlock()
|
||||
|
|
@ -63,7 +64,8 @@ public record CarryOnScript(
|
|||
ScriptObject.CODEC.fieldOf("object").forGetter(CarryOnScript::scriptObject),
|
||||
ScriptConditions.CODEC.optionalFieldOf("conditions", ScriptConditions.EMPTY).forGetter(CarryOnScript::scriptConditions),
|
||||
ScriptRender.CODEC.optionalFieldOf("render", ScriptRender.EMPTY).forGetter(CarryOnScript::scriptRender),
|
||||
ScriptEffects.CODEC.optionalFieldOf("effects", ScriptEffects.EMPTY).forGetter(CarryOnScript::scriptEffects)
|
||||
ScriptEffects.CODEC.optionalFieldOf("effects", ScriptEffects.EMPTY).forGetter(CarryOnScript::scriptEffects),
|
||||
Codec.BOOL.optionalFieldOf("override_checks", false).forGetter(CarryOnScript::overrideChecks)
|
||||
).apply(instance, CarryOnScript::new)
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import net.minecraft.advancements.AdvancementHolder;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtUtils;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.server.ServerAdvancementManager;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
|
|
@ -35,7 +35,10 @@ import net.minecraft.world.scores.Objective;
|
|||
import net.minecraft.world.scores.Scoreboard;
|
||||
import tschipp.carryon.platform.Services;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public final class Matchables
|
||||
{
|
||||
|
|
@ -125,7 +128,7 @@ public final class Matchables
|
|||
public boolean matches(ServerPlayer player)
|
||||
{
|
||||
ServerAdvancementManager manager = player.level().getServer().getAdvancements();
|
||||
AdvancementHolder adv = manager.get(ResourceLocation.parse(advancement.isEmpty() ? "" : advancement));
|
||||
AdvancementHolder adv = manager.get(Identifier.parse(advancement.isEmpty() ? "" : advancement));
|
||||
|
||||
boolean achievement = adv == null ? true : player.getAdvancements().getOrStartProgress(adv).isDone();
|
||||
return achievement;
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import com.mojang.serialization.DataResult;
|
|||
import net.minecraft.nbt.NbtOps;
|
||||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.resources.FileToIdConverter;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.server.packs.resources.ResourceManager;
|
||||
import net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener;
|
||||
|
|
@ -45,7 +45,7 @@ public class ScriptReloadListener extends SimpleJsonResourceReloadListener<Carry
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void apply(Map<ResourceLocation, CarryOnScript> scripts, @NotNull ResourceManager resourceManager, @NotNull ProfilerFiller profilerFiller)
|
||||
protected void apply(Map<Identifier, CarryOnScript> scripts, @NotNull ResourceManager resourceManager, @NotNull ProfilerFiller profilerFiller)
|
||||
{
|
||||
ScriptManager.SCRIPTS.clear();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,18 +1,17 @@
|
|||
package tschipp.carryon.mixin;
|
||||
|
||||
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.CallbackInfo;
|
||||
|
||||
import net.minecraft.client.entity.ClientAvatarEntity;
|
||||
import net.minecraft.client.model.PlayerModel;
|
||||
import net.minecraft.client.model.player.PlayerModel;
|
||||
import net.minecraft.client.renderer.entity.EntityRendererProvider;
|
||||
import net.minecraft.client.renderer.entity.EntityRendererProvider.Context;
|
||||
import net.minecraft.client.renderer.entity.LivingEntityRenderer;
|
||||
import net.minecraft.client.renderer.entity.player.AvatarRenderer;
|
||||
import net.minecraft.client.renderer.entity.state.AvatarRenderState;
|
||||
import net.minecraft.world.entity.Avatar;
|
||||
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.CallbackInfo;
|
||||
import tschipp.carryon.client.render.CarryingItemRenderLayer;
|
||||
|
||||
@Mixin(AvatarRenderer.class)
|
||||
|
|
@ -25,6 +24,6 @@ public abstract class AvatarRendererMixin<AvatarlikeEntity extends Avatar & Clie
|
|||
@Inject(method = "<init>(Lnet/minecraft/client/renderer/entity/EntityRendererProvider$Context;Z)V", at = @At("RETURN"))
|
||||
public void init(EntityRendererProvider.Context context, boolean slim, CallbackInfo info) {
|
||||
//Player
|
||||
this.addLayer(new CarryingItemRenderLayer<PlayerModel>(this));
|
||||
this.addLayer(new CarryingItemRenderLayer<>(this));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
package tschipp.carryon.mixin;
|
||||
|
||||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
|
|
@ -34,9 +35,6 @@ import org.spongepowered.asm.mixin.injection.At;
|
|||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
||||
|
||||
import tschipp.carryon.Constants;
|
||||
import tschipp.carryon.common.carry.CarryOnData;
|
||||
import tschipp.carryon.common.carry.CarryOnData.CarryType;
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@ import org.spongepowered.asm.mixin.injection.At;
|
|||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import tschipp.carryon.common.carry.CarryOnData;
|
||||
import tschipp.carryon.common.carry.CarryOnDataManager;
|
||||
import tschipp.carryon.common.carry.CarryOnData.CarryType;
|
||||
import tschipp.carryon.common.carry.CarryOnDataManager;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ package tschipp.carryon.mixin;
|
|||
|
||||
import net.minecraft.client.renderer.entity.state.HumanoidRenderState;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import tschipp.carryon.client.render.ICarryOnRenderState;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ package tschipp.carryon.platform.services;
|
|||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.network.codec.StreamCodec;
|
||||
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
|
|
@ -63,11 +63,11 @@ public interface IPlatformHelper {
|
|||
|
||||
<T extends PacketBase, B extends FriendlyByteBuf> void registerClientboundPacket(CustomPacketPayload.Type<T> type, Class<T> clazz, StreamCodec<B, T> codec, BiConsumer<T, Player> handler, Object... args);
|
||||
|
||||
void sendPacketToServer(ResourceLocation id, PacketBase packet);
|
||||
void sendPacketToServer(Identifier id, PacketBase packet);
|
||||
|
||||
void sendPacketToPlayer(ResourceLocation id, PacketBase packet, ServerPlayer player);
|
||||
void sendPacketToPlayer(Identifier id, PacketBase packet, ServerPlayer player);
|
||||
|
||||
default void sendPacketToAllPlayers(ResourceLocation id, PacketBase packet, ServerLevel level) {
|
||||
default void sendPacketToAllPlayers(Identifier id, PacketBase packet, ServerLevel level) {
|
||||
for(ServerPlayer p : level.players())
|
||||
sendPacketToPlayer(id, packet, p);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@
|
|||
"PlayerMixin"
|
||||
],
|
||||
"client": [
|
||||
"AvatarRendererMixin",
|
||||
"EntityRendererMixin",
|
||||
"HumanoidModelMixin",
|
||||
"MinecraftMixin",
|
||||
"PlayerRenderStateMixin",
|
||||
"EntityRendererMixin",
|
||||
"AvatarRendererMixin"
|
||||
"PlayerRenderStateMixin"
|
||||
],
|
||||
"server": [
|
||||
],
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ dependencies {
|
|||
modApi("me.shedaniel.cloth:cloth-config-fabric:${cloth_config_version}") {
|
||||
exclude(group: "net.fabricmc.fabric-api")
|
||||
}
|
||||
modApi "com.terraformersmc:modmenu:16.0.0-rc.1"
|
||||
modApi "com.terraformersmc:modmenu:17.0.0-beta.1"
|
||||
}
|
||||
|
||||
loom {
|
||||
|
|
|
|||
|
|
@ -24,17 +24,18 @@ import net.fabricmc.api.ModInitializer;
|
|||
import net.fabricmc.fabric.api.attachment.v1.AttachmentRegistry;
|
||||
import net.fabricmc.fabric.api.attachment.v1.AttachmentType;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import tschipp.carryon.common.carry.CarryOnData;
|
||||
import tschipp.carryon.config.fabric.ConfigLoaderImpl;
|
||||
import tschipp.carryon.events.CommonEvents;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class CarryOnFabricMod implements ModInitializer {
|
||||
|
||||
public static final AttachmentType<CarryOnData> CARRY_ON_DATA_ATTACHMENT_TYPE = AttachmentRegistry.create(
|
||||
ResourceLocation.fromNamespaceAndPath(Constants.MOD_ID, "carry_on_data"),
|
||||
Identifier.fromNamespaceAndPath(Constants.MOD_ID, "carry_on_data"),
|
||||
builder -> builder
|
||||
.initializer(() -> new CarryOnData(new CompoundTag()))
|
||||
.persistent(CarryOnData.CODEC)
|
||||
|
|
|
|||
|
|
@ -30,7 +30,10 @@ import java.io.File;
|
|||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Path;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ConfigLoaderImpl {
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ import net.minecraft.core.Direction;
|
|||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.server.packs.PackType;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.level.GameRules;
|
||||
import tschipp.carryon.CarryOnCommon;
|
||||
import tschipp.carryon.common.carry.CarryOnData;
|
||||
import tschipp.carryon.common.carry.CarryOnData.CarryType;
|
||||
|
|
@ -160,7 +159,19 @@ public class CommonEvents {
|
|||
CarryOnCommon.onRiderDisconnected(handler.getPlayer());
|
||||
});
|
||||
|
||||
//TODO: drop carried when attacked
|
||||
ServerLivingEntityEvents.ALLOW_DEATH.register((entity, damageSource, damageAmount) -> {
|
||||
if(entity instanceof ServerPlayer sp) {
|
||||
CarryOnCommon.onRiderDisconnected(sp);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
ServerLivingEntityEvents.ALLOW_DAMAGE.register((entity, source, amount) -> {
|
||||
if(entity instanceof ServerPlayer sp) {
|
||||
CarryOnCommon.onPlayerAttacked(sp);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,9 +34,10 @@ import tschipp.carryon.common.carry.CarryOnDataManager;
|
|||
@Mixin(Screen.class)
|
||||
public class ScreenMixin
|
||||
{
|
||||
@Inject(at = @At(value = "TAIL"), method = "init(Lnet/minecraft/client/Minecraft;II)V")
|
||||
private void onInit(Minecraft mc, int i, int j, CallbackInfo ci)
|
||||
@Inject(at = @At(value = "TAIL"), method = "init(II)V")
|
||||
private void onInit(int width, int height, CallbackInfo ci)
|
||||
{
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
Player player = mc.player;
|
||||
if((Object)this instanceof AbstractContainerScreen && player != null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import net.minecraft.network.FriendlyByteBuf;
|
|||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||
import net.minecraft.network.codec.StreamCodec;
|
||||
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import tschipp.carryon.CarryOnFabricClientMod;
|
||||
|
|
@ -90,13 +90,13 @@ public class FabricPlatformHelper implements IPlatformHelper {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void sendPacketToServer(ResourceLocation id, PacketBase packet)
|
||||
public void sendPacketToServer(Identifier id, PacketBase packet)
|
||||
{
|
||||
CarryOnFabricClientMod.sendPacketToServer(packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPacketToPlayer(ResourceLocation id, PacketBase packet, ServerPlayer player)
|
||||
public void sendPacketToPlayer(Identifier id, PacketBase packet, ServerPlayer player)
|
||||
{
|
||||
ServerPlayNetworking.send(player, packet);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,15 +21,15 @@
|
|||
package tschipp.carryon.scripting;
|
||||
|
||||
import net.fabricmc.fabric.api.resource.IdentifiableResourceReloadListener;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import tschipp.carryon.Constants;
|
||||
import tschipp.carryon.common.scripting.ScriptReloadListener;
|
||||
|
||||
public class IdentifiableScriptReloadListener extends ScriptReloadListener implements IdentifiableResourceReloadListener
|
||||
{
|
||||
@Override
|
||||
public ResourceLocation getFabricId()
|
||||
public Identifier getFabricId()
|
||||
{
|
||||
return ResourceLocation.fromNamespaceAndPath(Constants.MOD_ID, "carryon_scripts");
|
||||
return Identifier.fromNamespaceAndPath(Constants.MOD_ID, "carryon_scripts");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@
|
|||
"depends": {
|
||||
"fabricloader": ">=${fabric_loader_version}",
|
||||
"fabric-api": "*",
|
||||
"minecraft": "${minecraft_version}",
|
||||
"java": ">=21"
|
||||
"minecraft": "${minecraft_version_range_fabric}",
|
||||
"java": ">=${java_version}"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
plugins {
|
||||
id 'multiloader-loader'
|
||||
id 'net.minecraftforge.gradle' version '[6.0.36,6.2)'
|
||||
id 'net.minecraftforge.gradle' version '[6.0.46,6.2)'
|
||||
id 'org.spongepowered.mixin' version '0.7-SNAPSHOT'
|
||||
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
package tschipp.carryon;
|
||||
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraftforge.eventbus.api.listener.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
|
|
@ -52,7 +52,7 @@ public class CarryOnForge {
|
|||
@SubscribeEvent
|
||||
public static void setup(final FMLCommonSetupEvent event)
|
||||
{
|
||||
network = ChannelBuilder.named(ResourceLocation.fromNamespaceAndPath(Constants.MOD_ID, "carryonpackets")).simpleChannel();
|
||||
network = ChannelBuilder.named(Identifier.fromNamespaceAndPath(Constants.MOD_ID, "carryonpackets")).simpleChannel();
|
||||
|
||||
CarryOnCommon.registerServerPackets();
|
||||
CarryOnCommon.registerClientPackets();
|
||||
|
|
|
|||
|
|
@ -30,7 +30,10 @@ import net.minecraftforge.fml.config.ModConfig;
|
|||
import net.minecraftforge.fml.event.config.ModConfigEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import tschipp.carryon.Constants;
|
||||
import tschipp.carryon.config.*;
|
||||
import tschipp.carryon.config.AnnotationData;
|
||||
import tschipp.carryon.config.BuiltCategory;
|
||||
import tschipp.carryon.config.BuiltConfig;
|
||||
import tschipp.carryon.config.PropertyData;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
package tschipp.carryon.events;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
|
|
@ -36,6 +36,7 @@ import net.minecraftforge.event.*;
|
|||
import net.minecraftforge.event.TickEvent.ServerTickEvent;
|
||||
import net.minecraftforge.event.entity.EntityJoinLevelEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingAttackEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingDeathEvent;
|
||||
import net.minecraftforge.event.entity.living.MobSpawnEvent.FinalizeSpawn;
|
||||
import net.minecraftforge.event.entity.player.AttackEntityEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
|
|
@ -94,7 +95,7 @@ public class CommonEvents
|
|||
} else {
|
||||
PlacementHandler.tryPlaceEntity((ServerPlayer) player, pos, event.getFace(), (pPos, toPlace) -> {
|
||||
if (toPlace instanceof Mob mob) {
|
||||
FinalizeSpawn checkSpawn = new FinalizeSpawn(mob, (ServerLevelAccessor) level, pPos.x, pPos.y, pPos.z, level.getCurrentDifficultyAt(new BlockPos((int) pPos.x, (int) pPos.y, (int) pPos.z)), EntitySpawnReason.EVENT, null, null, null);
|
||||
FinalizeSpawn checkSpawn = new FinalizeSpawn(mob, (ServerLevelAccessor) level, pPos.x, pPos.y, pPos.z, ((ServerLevelAccessor) level).getCurrentDifficultyAt(new BlockPos((int) pPos.x, (int) pPos.y, (int) pPos.z)), EntitySpawnReason.EVENT, null, null, null);
|
||||
return !FinalizeSpawn.BUS.post(checkSpawn);
|
||||
}
|
||||
return true;
|
||||
|
|
@ -224,7 +225,7 @@ public class CommonEvents
|
|||
@SubscribeEvent
|
||||
public static void onAttachCapabilities(AttachCapabilitiesEvent.Entities event) {
|
||||
if (event.getObject() instanceof Player) {
|
||||
event.addCapability(ResourceLocation.fromNamespaceAndPath(Constants.MOD_ID, "carry_on_data"), new CarryOnDataCapabilityProvider());
|
||||
event.addCapability(Identifier.fromNamespaceAndPath(Constants.MOD_ID, "carry_on_data"), new CarryOnDataCapabilityProvider());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -242,4 +243,11 @@ public class CommonEvents
|
|||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onPlayerDie(LivingDeathEvent event) {
|
||||
if(event.getEntity() instanceof ServerPlayer sp) {
|
||||
CarryOnCommon.onRiderDisconnected(sp);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ package tschipp.carryon.platform;
|
|||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.network.codec.StreamCodec;
|
||||
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
|
|
@ -106,13 +106,13 @@ public class ForgePlatformHelper implements IPlatformHelper {
|
|||
|
||||
|
||||
@Override
|
||||
public void sendPacketToServer(ResourceLocation id, PacketBase packet)
|
||||
public void sendPacketToServer(Identifier id, PacketBase packet)
|
||||
{
|
||||
CarryOnForge.network.send(packet, PacketDistributor.SERVER.noArg());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPacketToPlayer(ResourceLocation id, PacketBase packet, ServerPlayer player)
|
||||
public void sendPacketToPlayer(Identifier id, PacketBase packet, ServerPlayer player)
|
||||
{
|
||||
CarryOnForge.network.send(packet, PacketDistributor.PLAYER.with(player));
|
||||
}
|
||||
|
|
@ -128,7 +128,7 @@ public class ForgePlatformHelper implements IPlatformHelper {
|
|||
var cap = player.getCapability(CarryOnDataCapabilityProvider.CARRY_ON_DATA_CAPABILITY).orElse(new CarryOnDataCapability());
|
||||
cap.setCarryData(data);
|
||||
if(!player.level().isClientSide()) {
|
||||
sendPacketToAllPlayers(Constants.PACKET_ID_SYNC_SCRIPTS, new ClientboundSyncCarryDataPacket(player.getId(), data), (ServerLevel) player.level());
|
||||
sendPacketToAllPlayers(Constants.PACKET_ID_SYNC_CARRY_ON_DATA, new ClientboundSyncCarryDataPacket(player.getId(), data), (ServerLevel) player.level());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,10 @@ import net.neoforged.fml.config.ModConfig;
|
|||
import net.neoforged.fml.event.config.ModConfigEvent;
|
||||
import net.neoforged.neoforge.common.ModConfigSpec;
|
||||
import tschipp.carryon.Constants;
|
||||
import tschipp.carryon.config.*;
|
||||
import tschipp.carryon.config.AnnotationData;
|
||||
import tschipp.carryon.config.BuiltCategory;
|
||||
import tschipp.carryon.config.BuiltConfig;
|
||||
import tschipp.carryon.config.PropertyData;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
package tschipp.carryon.events;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.util.TriState;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
|
|
@ -36,7 +36,11 @@ import net.neoforged.bus.api.SubscribeEvent;
|
|||
import net.neoforged.fml.common.EventBusSubscriber;
|
||||
import net.neoforged.neoforge.common.NeoForge;
|
||||
import net.neoforged.neoforge.common.util.BlockSnapshot;
|
||||
import net.neoforged.neoforge.event.*;
|
||||
import net.neoforged.neoforge.event.AddServerReloadListenersEvent;
|
||||
import net.neoforged.neoforge.event.OnDatapackSyncEvent;
|
||||
import net.neoforged.neoforge.event.RegisterCommandsEvent;
|
||||
import net.neoforged.neoforge.event.TagsUpdatedEvent;
|
||||
import net.neoforged.neoforge.event.entity.living.LivingDeathEvent;
|
||||
import net.neoforged.neoforge.event.entity.living.MobSpawnEvent;
|
||||
import net.neoforged.neoforge.event.entity.player.AttackEntityEvent;
|
||||
import net.neoforged.neoforge.event.entity.player.PlayerEvent;
|
||||
|
|
@ -148,7 +152,7 @@ public class CommonEvents
|
|||
@SubscribeEvent
|
||||
public static void onDatapackRegister(AddServerReloadListenersEvent event)
|
||||
{
|
||||
event.addListener(ResourceLocation.fromNamespaceAndPath(Constants.MOD_ID, "scripts"), new ScriptReloadListener());
|
||||
event.addListener(Identifier.fromNamespaceAndPath(Constants.MOD_ID, "scripts"), new ScriptReloadListener());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
|
@ -217,4 +221,11 @@ public class CommonEvents
|
|||
CarryOnCommon.onRiderDisconnected(player);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onPlayerDie(LivingDeathEvent event) {
|
||||
if(event.getEntity() instanceof ServerPlayer sp) {
|
||||
CarryOnCommon.onRiderDisconnected(sp);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,9 +23,8 @@ package tschipp.carryon.platform;
|
|||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||
import net.minecraft.network.codec.StreamCodec;
|
||||
|
||||
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.neoforged.fml.ModList;
|
||||
|
|
@ -100,12 +99,12 @@ public class NeoForgePlatformHelper implements IPlatformHelper {
|
|||
|
||||
|
||||
@Override
|
||||
public void sendPacketToServer(ResourceLocation id, PacketBase packet) {
|
||||
public void sendPacketToServer(Identifier id, PacketBase packet) {
|
||||
CarryOnNeoForgeClient.sendPacketToServer(packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPacketToPlayer(ResourceLocation id, PacketBase packet, ServerPlayer player) {
|
||||
public void sendPacketToPlayer(Identifier id, PacketBase packet, ServerPlayer player) {
|
||||
PacketDistributor.sendToPlayer(player, packet);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -100,7 +100,8 @@ processResources {
|
|||
"forge_version": forge_version,
|
||||
"forge_loader_version_range": forge_loader_version_range,
|
||||
'credits' : credits,
|
||||
'java_version' : java_version
|
||||
'java_version' : java_version,
|
||||
'minecraft_version_range_fabric' : minecraft_version_range_fabric,
|
||||
]
|
||||
|
||||
var jsonExpandProps = expandProps.collectEntries {
|
||||
|
|
|
|||
|
|
@ -1,14 +0,0 @@
|
|||
|
||||
### Expected Behavior
|
||||
|
||||
|
||||
### Actual Behavior
|
||||
|
||||
|
||||
### Steps to Reproduce
|
||||
|
||||
|
||||
### Version of Minecraft, Carry On, Forge/Fabric
|
||||
|
||||
|
||||
### Screenshots encouraged
|
||||
|
|
@ -1,38 +1,39 @@
|
|||
# Project
|
||||
version=2.8.0
|
||||
version=2.9.1
|
||||
group=tschipp.carryon
|
||||
|
||||
# Common
|
||||
minecraft_version=1.21.9
|
||||
minecraft_version=1.21.11
|
||||
mod_name=Carry On
|
||||
mod_author=Tschipp, PurpliciousCow
|
||||
mod_id=carryon
|
||||
license=GNU LGPLv3
|
||||
credits=
|
||||
description=Carry On is a simple mod that improves game interaction by allowing players to pick up, carry, and place single block Tile Entities using only their empty hands.
|
||||
minecraft_version_range=[1.21.9, 1.22)
|
||||
neo_form_version=1.21.9-20250930.151910
|
||||
minecraft_version_range=[1.21.11, 26)
|
||||
minecraft_version_range_fabric=>=1.21.11 <26
|
||||
neo_form_version=1.21.11-20251209.172050
|
||||
java_version=21
|
||||
parchment_version=2025.10.05
|
||||
parchment_game_version=1.21.9
|
||||
mod_dev_version=2.0.115
|
||||
parchment_version=2025.12.20
|
||||
parchment_game_version=1.21.11
|
||||
mod_dev_version=2.0.134
|
||||
# Forge
|
||||
forge_version= 59.0.5
|
||||
forge_loader_version_range=[59,)
|
||||
parchment_mappings=2025.10.05-1.21.9
|
||||
forge_version=61.0.3
|
||||
forge_loader_version_range=[61,)
|
||||
parchment_mappings=2025.12.20-1.21.11
|
||||
//forge_ats_enabled=true
|
||||
|
||||
# Fabric
|
||||
fabric_version=0.134.0+1.21.9
|
||||
fabric_loader_version=0.17.3
|
||||
parchment_mappings_fabric=1.21.9:2025.10.05
|
||||
loom_version=1.11-SNAPSHOT
|
||||
fabric_version=0.140.2+1.21.11
|
||||
fabric_loader_version=0.18.4
|
||||
parchment_mappings_fabric=1.21.11:2025.12.20
|
||||
loom_version=1.13-SNAPSHOT
|
||||
|
||||
# Neoforge
|
||||
neoforge_version=21.9.16-beta
|
||||
neoforge_version=21.11.14-beta
|
||||
neoforge_loader_version_range=[4,)
|
||||
neogradle.subsystems.parchment.minecraftVersion=1.21.9
|
||||
neogradle.subsystems.parchment.mappingsVersion=2025.10.05
|
||||
neogradle.subsystems.parchment.minecraftVersion=1.21.11
|
||||
neogradle.subsystems.parchment.mappingsVersion=2025.12.20
|
||||
|
||||
|
||||
# Gradle
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user