Updated to 1.21.11
This commit is contained in:
parent
20a40c1487
commit
f147e801cc
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
package tschipp.carryon;
|
package tschipp.carryon;
|
||||||
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.Identifier;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import tschipp.carryon.common.config.CarryConfig;
|
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.Common COMMON_CONFIG = new CarryConfig.Common();
|
||||||
public static final CarryConfig.Client CLIENT_CONFIG = new CarryConfig.Client();
|
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 Identifier PACKET_ID_KEY_PRESSED = Identifier.fromNamespaceAndPath(Constants.MOD_ID, "key_pressed");
|
||||||
public static final ResourceLocation PACKET_ID_START_RIDING = ResourceLocation.fromNamespaceAndPath(Constants.MOD_ID, "start_riding");
|
public static final Identifier PACKET_ID_START_RIDING = Identifier.fromNamespaceAndPath(Constants.MOD_ID, "start_riding");
|
||||||
public static final ResourceLocation PACKET_ID_SYNC_SCRIPTS = ResourceLocation.fromNamespaceAndPath(Constants.MOD_ID, "sync_scripts");
|
public static final Identifier PACKET_ID_SYNC_SCRIPTS = Identifier.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 Identifier PACKET_ID_START_RIDING_OTHER = Identifier.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_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 com.mojang.blaze3d.platform.InputConstants;
|
||||||
import net.minecraft.client.KeyMapping;
|
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.Constants;
|
||||||
import tschipp.carryon.networking.serverbound.ServerboundCarryKeyPressedPacket;
|
import tschipp.carryon.networking.serverbound.ServerboundCarryKeyPressedPacket;
|
||||||
import tschipp.carryon.platform.Services;
|
import tschipp.carryon.platform.Services;
|
||||||
|
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import net.minecraft.client.KeyMapping.Category;
|
|
||||||
|
|
||||||
public class CarryOnKeybinds
|
public class CarryOnKeybinds
|
||||||
{
|
{
|
||||||
|
|
@ -36,7 +36,7 @@ public class CarryOnKeybinds
|
||||||
|
|
||||||
public static void registerKeybinds(Consumer<KeyMapping> registrar)
|
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);
|
carryKey = new KeyMapping("key.carry.desc", InputConstants.KEY_LSHIFT, category);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,14 +20,13 @@
|
||||||
|
|
||||||
package tschipp.carryon.client.render;
|
package tschipp.carryon.client.render;
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.*;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import com.mojang.math.Axis;
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.RenderType;
|
|
||||||
import net.minecraft.client.renderer.SubmitNodeCollector;
|
import net.minecraft.client.renderer.SubmitNodeCollector;
|
||||||
import net.minecraft.client.renderer.entity.EntityRenderDispatcher;
|
import net.minecraft.client.renderer.entity.EntityRenderDispatcher;
|
||||||
import net.minecraft.client.renderer.entity.state.EntityRenderState;
|
import net.minecraft.client.renderer.entity.state.EntityRenderState;
|
||||||
import net.minecraft.client.renderer.item.ItemStackRenderState;
|
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.state.CameraRenderState;
|
||||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||||
import net.minecraft.world.entity.Entity;
|
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.item.ItemStack;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
import tschipp.carryon.Constants;
|
|
||||||
import tschipp.carryon.common.carry.CarryOnData;
|
import tschipp.carryon.common.carry.CarryOnData;
|
||||||
import tschipp.carryon.common.carry.CarryOnData.CarryType;
|
import tschipp.carryon.common.carry.CarryOnData.CarryType;
|
||||||
import tschipp.carryon.common.carry.CarryOnDataManager;
|
import tschipp.carryon.common.carry.CarryOnDataManager;
|
||||||
import tschipp.carryon.common.scripting.CarryOnScript;
|
|
||||||
import tschipp.carryon.common.scripting.CarryOnScript.ScriptRender;
|
import tschipp.carryon.common.scripting.CarryOnScript.ScriptRender;
|
||||||
import tschipp.carryon.platform.Services;
|
import tschipp.carryon.platform.Services;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
public class CarriedObjectRender
|
public class CarriedObjectRender
|
||||||
{
|
{
|
||||||
public static boolean draw(Player player, PoseStack matrix, int light, float partialTicks,SubmitNodeCollector nodeCollector, boolean firstPerson)
|
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);
|
CarryOnData carry = CarryOnDataManager.getCarryData(player);
|
||||||
ItemStackRenderState renderState = new ItemStackRenderState();
|
ItemStackRenderState renderState = new ItemStackRenderState();
|
||||||
var layer = renderState.newLayer();
|
var layer = renderState.newLayer();
|
||||||
layer.setRenderType(RenderType.glint());
|
layer.setRenderType(RenderTypes.glint());
|
||||||
|
|
||||||
matrix.pushPose();
|
matrix.pushPose();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import com.mojang.math.Axis;
|
import com.mojang.math.Axis;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.core.registries.BuiltInRegistries;
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
import net.minecraft.util.Mth;
|
|
||||||
import net.minecraft.util.ProblemReporter;
|
import net.minecraft.util.ProblemReporter;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.EntitySpawnReason;
|
import net.minecraft.world.entity.EntitySpawnReason;
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
package tschipp.carryon.client.render;
|
package tschipp.carryon.client.render;
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
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.SubmitNodeCollector;
|
||||||
import net.minecraft.client.renderer.entity.RenderLayerParent;
|
import net.minecraft.client.renderer.entity.RenderLayerParent;
|
||||||
import net.minecraft.client.renderer.entity.layers.RenderLayer;
|
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.InteractionHand;
|
||||||
import net.minecraft.world.effect.MobEffectInstance;
|
import net.minecraft.world.effect.MobEffectInstance;
|
||||||
import net.minecraft.world.effect.MobEffects;
|
import net.minecraft.world.effect.MobEffects;
|
||||||
import net.minecraft.world.entity.AgeableMob;
|
import net.minecraft.world.entity.*;
|
||||||
import net.minecraft.world.entity.Entity;
|
|
||||||
import net.minecraft.world.entity.Entity.RemovalReason;
|
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.animal.Animal;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.level.GameType;
|
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.DoorBlock;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
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.block.state.properties.Property;
|
||||||
import net.minecraft.world.level.storage.TagValueOutput;
|
import net.minecraft.world.level.storage.TagValueOutput;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,6 @@ package tschipp.carryon.common.carry;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
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.server.level.ServerPlayer;
|
||||||
import net.minecraft.sounds.SoundEvents;
|
import net.minecraft.sounds.SoundEvents;
|
||||||
import net.minecraft.sounds.SoundSource;
|
import net.minecraft.sounds.SoundSource;
|
||||||
|
|
@ -31,16 +29,16 @@ import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.effect.MobEffects;
|
import net.minecraft.world.effect.MobEffects;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.Mob;
|
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.ItemStack;
|
||||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||||
import net.minecraft.world.level.GameRules;
|
|
||||||
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.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
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.BlockStateProperties;
|
||||||
import net.minecraft.world.level.block.state.properties.Property;
|
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.BlockHitResult;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||||
|
|
@ -292,7 +290,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().get(GameRules.KEEP_INVENTORY) || !died) {
|
||||||
if (!carry.isCarrying(CarryType.PLAYER)) {
|
if (!carry.isCarrying(CarryType.PLAYER)) {
|
||||||
CarryOnDataManager.setCarryData(newPlayer, carry);
|
CarryOnDataManager.setCarryData(newPlayer, carry);
|
||||||
newPlayer.getInventory().setSelectedSlot(oldPlayer.getInventory().getSelectedSlot());
|
newPlayer.getInventory().setSelectedSlot(oldPlayer.getInventory().getSelectedSlot());
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,8 @@ import net.minecraft.commands.Commands;
|
||||||
import net.minecraft.commands.arguments.EntityArgument;
|
import net.minecraft.commands.arguments.EntityArgument;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
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.entity.Entity;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import tschipp.carryon.Constants;
|
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").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.Registry;
|
||||||
import net.minecraft.core.registries.BuiltInRegistries;
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.Identifier;
|
||||||
import net.minecraft.tags.TagKey;
|
import net.minecraft.tags.TagKey;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
|
|
@ -119,8 +119,8 @@ public class ListHandler {
|
||||||
ALLOWED_TILES_TAGS.clear();
|
ALLOWED_TILES_TAGS.clear();
|
||||||
PROPERTY_EXCEPTION_CLASSES.clear();
|
PROPERTY_EXCEPTION_CLASSES.clear();
|
||||||
|
|
||||||
Map<ResourceLocation, TagKey<Block>> blocktags = BuiltInRegistries.BLOCK.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<ResourceLocation, TagKey<EntityType<?>>> entitytags = BuiltInRegistries.ENTITY_TYPE.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));
|
List<String> forbidden = new ArrayList<>(List.of(Constants.COMMON_CONFIG.blacklist.forbiddenTiles));
|
||||||
forbidden.add("#carryon:block_blacklist");
|
forbidden.add("#carryon:block_blacklist");
|
||||||
|
|
@ -152,7 +152,7 @@ public class ListHandler {
|
||||||
continue;
|
continue;
|
||||||
String name = propString.substring(0, propString.indexOf("["));
|
String name = propString.substring(0, propString.indexOf("["));
|
||||||
String props = propString.substring(propString.indexOf("[") + 1, 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(String propName : props.split(",")) {
|
||||||
for (Property<?> prop : blk.defaultBlockState().getProperties()) {
|
for (Property<?> prop : blk.defaultBlockState().getProperties()) {
|
||||||
if (prop.getName().equals(propName))
|
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);
|
String sub = tag.substring(1);
|
||||||
TagKey<T> t = tagMap.get(ResourceLocation.parse(sub));
|
TagKey<T> t = tagMap.get(Identifier.parse(sub));
|
||||||
if (t != null)
|
if (t != null)
|
||||||
tags.add(t);
|
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++)
|
for (int i = 0; i < entries.size(); i++)
|
||||||
{
|
{
|
||||||
String curr = entries.get(i);
|
String curr = entries.get(i);
|
||||||
|
|
@ -181,7 +181,7 @@ public class ListHandler {
|
||||||
{
|
{
|
||||||
String[] filter = curr.replace("*", ",").split(",");
|
String[] filter = curr.replace("*", ",").split(",");
|
||||||
|
|
||||||
for (ResourceLocation key : keys)
|
for (Identifier key : keys)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (containsAll(key.toString(), filter))
|
if (containsAll(key.toString(), filter))
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ import net.minecraft.advancements.AdvancementHolder;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.NbtUtils;
|
import net.minecraft.nbt.NbtUtils;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.Identifier;
|
||||||
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;
|
||||||
|
|
@ -35,7 +35,10 @@ import net.minecraft.world.scores.Objective;
|
||||||
import net.minecraft.world.scores.Scoreboard;
|
import net.minecraft.world.scores.Scoreboard;
|
||||||
import tschipp.carryon.platform.Services;
|
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
|
public final class Matchables
|
||||||
{
|
{
|
||||||
|
|
@ -125,7 +128,7 @@ public final class Matchables
|
||||||
public boolean matches(ServerPlayer player)
|
public boolean matches(ServerPlayer player)
|
||||||
{
|
{
|
||||||
ServerAdvancementManager manager = player.level().getServer().getAdvancements();
|
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();
|
boolean achievement = adv == null ? true : player.getAdvancements().getOrStartProgress(adv).isDone();
|
||||||
return achievement;
|
return achievement;
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ import com.mojang.serialization.DataResult;
|
||||||
import net.minecraft.nbt.NbtOps;
|
import net.minecraft.nbt.NbtOps;
|
||||||
import net.minecraft.nbt.Tag;
|
import net.minecraft.nbt.Tag;
|
||||||
import net.minecraft.resources.FileToIdConverter;
|
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.level.ServerPlayer;
|
||||||
import net.minecraft.server.packs.resources.ResourceManager;
|
import net.minecraft.server.packs.resources.ResourceManager;
|
||||||
import net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener;
|
import net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener;
|
||||||
|
|
@ -45,7 +45,7 @@ public class ScriptReloadListener extends SimpleJsonResourceReloadListener<Carry
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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();
|
ScriptManager.SCRIPTS.clear();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,17 @@
|
||||||
package tschipp.carryon.mixin;
|
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.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;
|
||||||
import net.minecraft.client.renderer.entity.EntityRendererProvider.Context;
|
import net.minecraft.client.renderer.entity.EntityRendererProvider.Context;
|
||||||
import net.minecraft.client.renderer.entity.LivingEntityRenderer;
|
import net.minecraft.client.renderer.entity.LivingEntityRenderer;
|
||||||
import net.minecraft.client.renderer.entity.player.AvatarRenderer;
|
import net.minecraft.client.renderer.entity.player.AvatarRenderer;
|
||||||
import net.minecraft.client.renderer.entity.state.AvatarRenderState;
|
import net.minecraft.client.renderer.entity.state.AvatarRenderState;
|
||||||
import net.minecraft.world.entity.Avatar;
|
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;
|
import tschipp.carryon.client.render.CarryingItemRenderLayer;
|
||||||
|
|
||||||
@Mixin(AvatarRenderer.class)
|
@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"))
|
@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) {
|
public void init(EntityRendererProvider.Context context, boolean slim, CallbackInfo info) {
|
||||||
//Player
|
//Player
|
||||||
this.addLayer(new CarryingItemRenderLayer<PlayerModel>(this));
|
this.addLayer(new CarryingItemRenderLayer<>(this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
package tschipp.carryon.mixin;
|
package tschipp.carryon.mixin;
|
||||||
|
|
||||||
|
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
import net.minecraft.world.entity.Entity;
|
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.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
|
||||||
|
|
||||||
import tschipp.carryon.Constants;
|
import tschipp.carryon.Constants;
|
||||||
import tschipp.carryon.common.carry.CarryOnData;
|
import tschipp.carryon.common.carry.CarryOnData;
|
||||||
import tschipp.carryon.common.carry.CarryOnData.CarryType;
|
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.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
import tschipp.carryon.common.carry.CarryOnData;
|
import tschipp.carryon.common.carry.CarryOnData;
|
||||||
import tschipp.carryon.common.carry.CarryOnDataManager;
|
|
||||||
import tschipp.carryon.common.carry.CarryOnData.CarryType;
|
import tschipp.carryon.common.carry.CarryOnData.CarryType;
|
||||||
|
import tschipp.carryon.common.carry.CarryOnDataManager;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ package tschipp.carryon.mixin;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.entity.state.HumanoidRenderState;
|
import net.minecraft.client.renderer.entity.state.HumanoidRenderState;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Unique;
|
import org.spongepowered.asm.mixin.Unique;
|
||||||
import tschipp.carryon.client.render.ICarryOnRenderState;
|
import tschipp.carryon.client.render.ICarryOnRenderState;
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ package tschipp.carryon.platform.services;
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraft.network.codec.StreamCodec;
|
import net.minecraft.network.codec.StreamCodec;
|
||||||
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
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.ServerLevel;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.world.entity.player.Player;
|
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);
|
<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())
|
for(ServerPlayer p : level.players())
|
||||||
sendPacketToPlayer(id, packet, p);
|
sendPacketToPlayer(id, packet, p);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,11 @@
|
||||||
"PlayerMixin"
|
"PlayerMixin"
|
||||||
],
|
],
|
||||||
"client": [
|
"client": [
|
||||||
|
"AvatarRendererMixin",
|
||||||
|
"EntityRendererMixin",
|
||||||
"HumanoidModelMixin",
|
"HumanoidModelMixin",
|
||||||
"MinecraftMixin",
|
"MinecraftMixin",
|
||||||
"PlayerRenderStateMixin",
|
"PlayerRenderStateMixin"
|
||||||
"EntityRendererMixin",
|
|
||||||
"AvatarRendererMixin"
|
|
||||||
],
|
],
|
||||||
"server": [
|
"server": [
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ dependencies {
|
||||||
modApi("me.shedaniel.cloth:cloth-config-fabric:${cloth_config_version}") {
|
modApi("me.shedaniel.cloth:cloth-config-fabric:${cloth_config_version}") {
|
||||||
exclude(group: "net.fabricmc.fabric-api")
|
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 {
|
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.AttachmentRegistry;
|
||||||
import net.fabricmc.fabric.api.attachment.v1.AttachmentType;
|
import net.fabricmc.fabric.api.attachment.v1.AttachmentType;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.Identifier;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import tschipp.carryon.common.carry.CarryOnData;
|
import tschipp.carryon.common.carry.CarryOnData;
|
||||||
import tschipp.carryon.config.fabric.ConfigLoaderImpl;
|
import tschipp.carryon.config.fabric.ConfigLoaderImpl;
|
||||||
import tschipp.carryon.events.CommonEvents;
|
import tschipp.carryon.events.CommonEvents;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class CarryOnFabricMod implements ModInitializer {
|
public class CarryOnFabricMod implements ModInitializer {
|
||||||
|
|
||||||
public static final AttachmentType<CarryOnData> CARRY_ON_DATA_ATTACHMENT_TYPE = AttachmentRegistry.create(
|
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
|
builder -> builder
|
||||||
.initializer(() -> new CarryOnData(new CompoundTag()))
|
.initializer(() -> new CarryOnData(new CompoundTag()))
|
||||||
.persistent(CarryOnData.CODEC)
|
.persistent(CarryOnData.CODEC)
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,10 @@ import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.Path;
|
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 {
|
public class ConfigLoaderImpl {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@
|
||||||
package tschipp.carryon.events;
|
package tschipp.carryon.events;
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
|
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
|
||||||
import net.fabricmc.fabric.api.entity.event.v1.ServerLivingEntityEvents;
|
|
||||||
import net.fabricmc.fabric.api.entity.event.v1.ServerPlayerEvents;
|
import net.fabricmc.fabric.api.entity.event.v1.ServerPlayerEvents;
|
||||||
import net.fabricmc.fabric.api.event.lifecycle.v1.CommonLifecycleEvents;
|
import net.fabricmc.fabric.api.event.lifecycle.v1.CommonLifecycleEvents;
|
||||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
|
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
|
||||||
|
|
@ -34,7 +33,6 @@ import net.minecraft.core.Direction;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.server.packs.PackType;
|
import net.minecraft.server.packs.PackType;
|
||||||
import net.minecraft.world.InteractionResult;
|
import net.minecraft.world.InteractionResult;
|
||||||
import net.minecraft.world.level.GameRules;
|
|
||||||
import tschipp.carryon.CarryOnCommon;
|
import tschipp.carryon.CarryOnCommon;
|
||||||
import tschipp.carryon.common.carry.CarryOnData;
|
import tschipp.carryon.common.carry.CarryOnData;
|
||||||
import tschipp.carryon.common.carry.CarryOnData.CarryType;
|
import tschipp.carryon.common.carry.CarryOnData.CarryType;
|
||||||
|
|
|
||||||
|
|
@ -34,9 +34,10 @@ import tschipp.carryon.common.carry.CarryOnDataManager;
|
||||||
@Mixin(Screen.class)
|
@Mixin(Screen.class)
|
||||||
public class ScreenMixin
|
public class ScreenMixin
|
||||||
{
|
{
|
||||||
@Inject(at = @At(value = "TAIL"), method = "init(Lnet/minecraft/client/Minecraft;II)V")
|
@Inject(at = @At(value = "TAIL"), method = "init(II)V")
|
||||||
private void onInit(Minecraft mc, int i, int j, CallbackInfo ci)
|
private void onInit(int width, int height, CallbackInfo ci)
|
||||||
{
|
{
|
||||||
|
Minecraft mc = Minecraft.getInstance();
|
||||||
Player player = mc.player;
|
Player player = mc.player;
|
||||||
if((Object)this instanceof AbstractContainerScreen && player != null)
|
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.RegistryFriendlyByteBuf;
|
||||||
import net.minecraft.network.codec.StreamCodec;
|
import net.minecraft.network.codec.StreamCodec;
|
||||||
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
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.server.level.ServerPlayer;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import tschipp.carryon.CarryOnFabricClientMod;
|
import tschipp.carryon.CarryOnFabricClientMod;
|
||||||
|
|
@ -90,13 +90,13 @@ public class FabricPlatformHelper implements IPlatformHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendPacketToServer(ResourceLocation id, PacketBase packet)
|
public void sendPacketToServer(Identifier id, PacketBase packet)
|
||||||
{
|
{
|
||||||
CarryOnFabricClientMod.sendPacketToServer(packet);
|
CarryOnFabricClientMod.sendPacketToServer(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendPacketToPlayer(ResourceLocation id, PacketBase packet, ServerPlayer player)
|
public void sendPacketToPlayer(Identifier id, PacketBase packet, ServerPlayer player)
|
||||||
{
|
{
|
||||||
ServerPlayNetworking.send(player, packet);
|
ServerPlayNetworking.send(player, packet);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,15 +21,15 @@
|
||||||
package tschipp.carryon.scripting;
|
package tschipp.carryon.scripting;
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.resource.IdentifiableResourceReloadListener;
|
import net.fabricmc.fabric.api.resource.IdentifiableResourceReloadListener;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.Identifier;
|
||||||
import tschipp.carryon.Constants;
|
import tschipp.carryon.Constants;
|
||||||
import tschipp.carryon.common.scripting.ScriptReloadListener;
|
import tschipp.carryon.common.scripting.ScriptReloadListener;
|
||||||
|
|
||||||
public class IdentifiableScriptReloadListener extends ScriptReloadListener implements IdentifiableResourceReloadListener
|
public class IdentifiableScriptReloadListener extends ScriptReloadListener implements IdentifiableResourceReloadListener
|
||||||
{
|
{
|
||||||
@Override
|
@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": {
|
"depends": {
|
||||||
"fabricloader": ">=${fabric_loader_version}",
|
"fabricloader": ">=${fabric_loader_version}",
|
||||||
"fabric-api": "*",
|
"fabric-api": "*",
|
||||||
"minecraft": "${minecraft_version}",
|
"minecraft": "${minecraft_version_range_fabric}",
|
||||||
"java": ">=21"
|
"java": ">=${java_version}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
plugins {
|
plugins {
|
||||||
id 'multiloader-loader'
|
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.spongepowered.mixin' version '0.7-SNAPSHOT'
|
||||||
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
|
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
package tschipp.carryon;
|
package tschipp.carryon;
|
||||||
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.Identifier;
|
||||||
import net.minecraftforge.eventbus.api.listener.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.listener.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||||
|
|
@ -52,7 +52,7 @@ public class CarryOnForge {
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void setup(final FMLCommonSetupEvent event)
|
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.registerServerPackets();
|
||||||
CarryOnCommon.registerClientPackets();
|
CarryOnCommon.registerClientPackets();
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,10 @@ import net.minecraftforge.fml.config.ModConfig;
|
||||||
import net.minecraftforge.fml.event.config.ModConfigEvent;
|
import net.minecraftforge.fml.event.config.ModConfigEvent;
|
||||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||||
import tschipp.carryon.Constants;
|
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.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
package tschipp.carryon.events;
|
package tschipp.carryon.events;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.Identifier;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.world.InteractionResult;
|
import net.minecraft.world.InteractionResult;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
|
|
@ -94,7 +94,7 @@ public class CommonEvents
|
||||||
} else {
|
} else {
|
||||||
PlacementHandler.tryPlaceEntity((ServerPlayer) player, pos, event.getFace(), (pPos, toPlace) -> {
|
PlacementHandler.tryPlaceEntity((ServerPlayer) player, pos, event.getFace(), (pPos, toPlace) -> {
|
||||||
if (toPlace instanceof Mob mob) {
|
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 !FinalizeSpawn.BUS.post(checkSpawn);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -224,7 +224,7 @@ public class CommonEvents
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void onAttachCapabilities(AttachCapabilitiesEvent.Entities event) {
|
public static void onAttachCapabilities(AttachCapabilitiesEvent.Entities event) {
|
||||||
if (event.getObject() instanceof Player) {
|
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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ package tschipp.carryon.platform;
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraft.network.codec.StreamCodec;
|
import net.minecraft.network.codec.StreamCodec;
|
||||||
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
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.ServerLevel;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
|
@ -106,13 +106,13 @@ public class ForgePlatformHelper implements IPlatformHelper {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendPacketToServer(ResourceLocation id, PacketBase packet)
|
public void sendPacketToServer(Identifier id, PacketBase packet)
|
||||||
{
|
{
|
||||||
CarryOnForge.network.send(packet, PacketDistributor.SERVER.noArg());
|
CarryOnForge.network.send(packet, PacketDistributor.SERVER.noArg());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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));
|
CarryOnForge.network.send(packet, PacketDistributor.PLAYER.with(player));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,10 @@ import net.neoforged.fml.config.ModConfig;
|
||||||
import net.neoforged.fml.event.config.ModConfigEvent;
|
import net.neoforged.fml.event.config.ModConfigEvent;
|
||||||
import net.neoforged.neoforge.common.ModConfigSpec;
|
import net.neoforged.neoforge.common.ModConfigSpec;
|
||||||
import tschipp.carryon.Constants;
|
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.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
package tschipp.carryon.events;
|
package tschipp.carryon.events;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.Identifier;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.util.TriState;
|
import net.minecraft.util.TriState;
|
||||||
import net.minecraft.world.InteractionResult;
|
import net.minecraft.world.InteractionResult;
|
||||||
|
|
@ -36,7 +36,10 @@ import net.neoforged.bus.api.SubscribeEvent;
|
||||||
import net.neoforged.fml.common.EventBusSubscriber;
|
import net.neoforged.fml.common.EventBusSubscriber;
|
||||||
import net.neoforged.neoforge.common.NeoForge;
|
import net.neoforged.neoforge.common.NeoForge;
|
||||||
import net.neoforged.neoforge.common.util.BlockSnapshot;
|
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.MobSpawnEvent;
|
import net.neoforged.neoforge.event.entity.living.MobSpawnEvent;
|
||||||
import net.neoforged.neoforge.event.entity.player.AttackEntityEvent;
|
import net.neoforged.neoforge.event.entity.player.AttackEntityEvent;
|
||||||
import net.neoforged.neoforge.event.entity.player.PlayerEvent;
|
import net.neoforged.neoforge.event.entity.player.PlayerEvent;
|
||||||
|
|
@ -148,7 +151,7 @@ public class CommonEvents
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void onDatapackRegister(AddServerReloadListenersEvent event)
|
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
|
@SubscribeEvent
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,8 @@ package tschipp.carryon.platform;
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||||
import net.minecraft.network.codec.StreamCodec;
|
import net.minecraft.network.codec.StreamCodec;
|
||||||
|
|
||||||
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
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.server.level.ServerPlayer;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.neoforged.fml.ModList;
|
import net.neoforged.fml.ModList;
|
||||||
|
|
@ -100,12 +99,12 @@ public class NeoForgePlatformHelper implements IPlatformHelper {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendPacketToServer(ResourceLocation id, PacketBase packet) {
|
public void sendPacketToServer(Identifier id, PacketBase packet) {
|
||||||
CarryOnNeoForgeClient.sendPacketToServer(packet);
|
CarryOnNeoForgeClient.sendPacketToServer(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendPacketToPlayer(ResourceLocation id, PacketBase packet, ServerPlayer player) {
|
public void sendPacketToPlayer(Identifier id, PacketBase packet, ServerPlayer player) {
|
||||||
PacketDistributor.sendToPlayer(player, packet);
|
PacketDistributor.sendToPlayer(player, packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,8 @@ processResources {
|
||||||
"forge_version": forge_version,
|
"forge_version": forge_version,
|
||||||
"forge_loader_version_range": forge_loader_version_range,
|
"forge_loader_version_range": forge_loader_version_range,
|
||||||
'credits' : credits,
|
'credits' : credits,
|
||||||
'java_version' : java_version
|
'java_version' : java_version,
|
||||||
|
'minecraft_version_range_fabric' : minecraft_version_range_fabric,
|
||||||
]
|
]
|
||||||
|
|
||||||
var jsonExpandProps = expandProps.collectEntries {
|
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
|
# Project
|
||||||
version=2.8.0
|
version=2.9.0
|
||||||
group=tschipp.carryon
|
group=tschipp.carryon
|
||||||
|
|
||||||
# Common
|
# Common
|
||||||
minecraft_version=1.21.9
|
minecraft_version=1.21.11
|
||||||
mod_name=Carry On
|
mod_name=Carry On
|
||||||
mod_author=Tschipp, PurpliciousCow
|
mod_author=Tschipp, PurpliciousCow
|
||||||
mod_id=carryon
|
mod_id=carryon
|
||||||
license=GNU LGPLv3
|
license=GNU LGPLv3
|
||||||
credits=
|
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.
|
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)
|
minecraft_version_range=[1.21.11, 26)
|
||||||
neo_form_version=1.21.9-20250930.151910
|
minecraft_version_range_fabric=>=1.21.11 <26
|
||||||
|
neo_form_version=1.21.11-20251209.172050
|
||||||
java_version=21
|
java_version=21
|
||||||
parchment_version=2025.10.05
|
parchment_version=2025.12.20
|
||||||
parchment_game_version=1.21.9
|
parchment_game_version=1.21.11
|
||||||
mod_dev_version=2.0.115
|
mod_dev_version=2.0.134
|
||||||
# Forge
|
# Forge
|
||||||
forge_version= 59.0.5
|
forge_version=61.0.3
|
||||||
forge_loader_version_range=[59,)
|
forge_loader_version_range=[61,)
|
||||||
parchment_mappings=2025.10.05-1.21.9
|
parchment_mappings=2025.12.20-1.21.11
|
||||||
//forge_ats_enabled=true
|
//forge_ats_enabled=true
|
||||||
|
|
||||||
# Fabric
|
# Fabric
|
||||||
fabric_version=0.134.0+1.21.9
|
fabric_version=0.140.2+1.21.11
|
||||||
fabric_loader_version=0.17.3
|
fabric_loader_version=0.18.4
|
||||||
parchment_mappings_fabric=1.21.9:2025.10.05
|
parchment_mappings_fabric=1.21.11:2025.12.20
|
||||||
loom_version=1.11-SNAPSHOT
|
loom_version=1.13-SNAPSHOT
|
||||||
|
|
||||||
# Neoforge
|
# Neoforge
|
||||||
neoforge_version=21.9.16-beta
|
neoforge_version=21.11.14-beta
|
||||||
neoforge_loader_version_range=[4,)
|
neoforge_loader_version_range=[4,)
|
||||||
neogradle.subsystems.parchment.minecraftVersion=1.21.9
|
neogradle.subsystems.parchment.minecraftVersion=1.21.11
|
||||||
neogradle.subsystems.parchment.mappingsVersion=2025.10.05
|
neogradle.subsystems.parchment.mappingsVersion=2025.12.20
|
||||||
|
|
||||||
|
|
||||||
# Gradle
|
# Gradle
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user