started work on 1.20.6
This commit is contained in:
parent
75ca33bb8d
commit
b574f5b509
|
|
@ -22,6 +22,11 @@ package tschipp.carryon;
|
|||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.core.RegistrySetBuilder;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
|
|
@ -42,6 +47,14 @@ import tschipp.carryon.platform.Services;
|
|||
|
||||
public class CarryOnCommon
|
||||
{
|
||||
public static final RegistrySetBuilder BUILDER = new RegistrySetBuilder();
|
||||
|
||||
public static HolderLookup.Provider createLookup() {
|
||||
RegistryAccess.Frozen registryaccess$frozen = RegistryAccess.fromRegistryOfRegistries(BuiltInRegistries.REGISTRY);
|
||||
HolderLookup.Provider holderlookup$provider = BUILDER.build(registryaccess$frozen);
|
||||
return holderlookup$provider;
|
||||
}
|
||||
|
||||
public static void registerServerPackets(Object... args)
|
||||
{
|
||||
Services.PLATFORM.registerServerboundPacket(
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import net.minecraft.commands.arguments.blocks.BlockStateParser;
|
|||
import net.minecraft.commands.arguments.blocks.BlockStateParser.BlockResult;
|
||||
import net.minecraft.commands.arguments.item.ItemParser;
|
||||
import net.minecraft.commands.arguments.item.ItemParser.ItemResult;
|
||||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
|
@ -41,7 +42,7 @@ import java.util.Map;
|
|||
|
||||
public class ModelOverride
|
||||
{
|
||||
public static Codec<ModelOverride> CODEC = Codec.STRING.comapFlatMap(ModelOverride::of, override -> override.raw);
|
||||
//public static Codec<ModelOverride> CODEC = Codec.STRING.comapFlatMap(ModelOverride::of, override -> override.raw);
|
||||
|
||||
private String raw;
|
||||
private BlockResult parsedBlock;
|
||||
|
|
@ -58,8 +59,8 @@ public class ModelOverride
|
|||
|
||||
parsedRHS.ifLeft(res -> {
|
||||
ItemStack stack = new ItemStack(res.item());
|
||||
if(res.nbt() != null)
|
||||
stack.setTag(res.nbt());
|
||||
if(res.components() != null)
|
||||
stack.applyComponents(res.components());
|
||||
this.renderObject = Either.left(stack);
|
||||
});
|
||||
|
||||
|
|
@ -69,7 +70,7 @@ public class ModelOverride
|
|||
});
|
||||
}
|
||||
|
||||
public static DataResult<ModelOverride> of(String str)
|
||||
public static DataResult<ModelOverride> of(String str, HolderLookup.Provider provider)
|
||||
{
|
||||
if(!str.contains("->"))
|
||||
return DataResult.error(() -> str + " must contain -> Arrow!");
|
||||
|
|
@ -98,7 +99,7 @@ public class ModelOverride
|
|||
Either<ItemResult, BlockResult> either;
|
||||
try {
|
||||
if(type == Type.ITEM)
|
||||
either = Either.left(ItemParser.parseForItem(BuiltInRegistries.ITEM.asLookup(), new StringReader(to)));
|
||||
either = Either.left(new ItemParser(provider).parse(new StringReader(to)));
|
||||
else
|
||||
either = Either.right(BlockStateParser.parseForBlock(BuiltInRegistries.BLOCK.asLookup(), to, true));
|
||||
}catch (CommandSyntaxException e) {
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
package tschipp.carryon.client.modeloverride;
|
||||
|
||||
import com.mojang.serialization.DataResult;
|
||||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import tschipp.carryon.Constants;
|
||||
|
|
@ -34,13 +35,13 @@ public class ModelOverrideHandler
|
|||
{
|
||||
private static List<ModelOverride> OVERRIDES = new ArrayList<>();
|
||||
|
||||
public static void initModelOverrides()
|
||||
public static void initModelOverrides(HolderLookup.Provider provider)
|
||||
{
|
||||
OVERRIDES.clear();
|
||||
|
||||
for(String ov : Constants.CLIENT_CONFIG.modelOverrides)
|
||||
{
|
||||
addFromString(ov);
|
||||
addFromString(ov, provider);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -54,9 +55,9 @@ public class ModelOverrideHandler
|
|||
return Optional.empty();
|
||||
}
|
||||
|
||||
public static void addFromString(String str)
|
||||
public static void addFromString(String str, HolderLookup.Provider provider)
|
||||
{
|
||||
DataResult<ModelOverride> res = ModelOverride.of(str);
|
||||
DataResult<ModelOverride> res = ModelOverride.of(str, provider);
|
||||
if(res.result().isPresent())
|
||||
{
|
||||
ModelOverride override = res.result().get();
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ import net.minecraft.world.item.ItemStack;
|
|||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import org.joml.Matrix4f;
|
||||
import tschipp.carryon.Constants;
|
||||
import tschipp.carryon.common.carry.CarryOnData;
|
||||
import tschipp.carryon.common.carry.CarryOnData.CarryType;
|
||||
|
|
@ -175,15 +176,18 @@ public class CarriedObjectRender
|
|||
/**
|
||||
* Draws the third person view of entities and blocks
|
||||
* @param partialticks
|
||||
* @param matrix
|
||||
* @param mat
|
||||
*/
|
||||
public static void drawThirdPerson(float partialticks, PoseStack matrix) {
|
||||
public static void drawThirdPerson(float partialticks, Matrix4f mat) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
Level level = mc.level;
|
||||
int light = 0;
|
||||
int perspective = CarryRenderHelper.getPerspective();
|
||||
EntityRenderDispatcher manager = mc.getEntityRenderDispatcher();
|
||||
|
||||
PoseStack matrix = new PoseStack();
|
||||
matrix.mulPose(mat);
|
||||
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.disableCull();
|
||||
RenderSystem.disableDepthTest();
|
||||
|
|
@ -222,7 +226,7 @@ public class CarriedObjectRender
|
|||
|
||||
PoseStack.Pose p = matrix.last();
|
||||
PoseStack copy = new PoseStack();
|
||||
copy.mulPoseMatrix(p.pose());
|
||||
copy.mulPose(p.pose());
|
||||
matrix.popPose();
|
||||
|
||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ package tschipp.carryon.common.carry;
|
|||
|
||||
import com.mojang.serialization.DataResult;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtOps;
|
||||
|
|
@ -63,7 +64,7 @@ public class CarryOnData {
|
|||
if(data.contains("activeScript"))
|
||||
{
|
||||
DataResult<CarryOnScript> res = CarryOnScript.CODEC.parse(NbtOps.INSTANCE, data.get("activeScript"));
|
||||
this.activeScript = res.getOrThrow(false, (s) -> {throw new RuntimeException("Failed to decode activeScript during CarryOnData serialization: " + s);});
|
||||
this.activeScript = res.getOrThrow((s) -> {throw new RuntimeException("Failed to decode activeScript during CarryOnData serialization: " + s);});
|
||||
}
|
||||
|
||||
if(data.contains("selected"))
|
||||
|
|
@ -78,7 +79,7 @@ public class CarryOnData {
|
|||
if(activeScript != null)
|
||||
{
|
||||
DataResult<Tag> res = CarryOnScript.CODEC.encodeStart(NbtOps.INSTANCE, activeScript);
|
||||
Tag tag = res.getOrThrow(false, (s) -> {throw new RuntimeException("Failed to encode activeScript during CarryOnData serialization: " + s);});
|
||||
Tag tag = res.getOrThrow((s) -> {throw new RuntimeException("Failed to encode activeScript during CarryOnData serialization: " + s);});
|
||||
nbt.put("activeScript", tag);
|
||||
}
|
||||
nbt.putInt("selected", this.selectedSlot);
|
||||
|
|
@ -106,7 +107,7 @@ public class CarryOnData {
|
|||
|
||||
if(tile != null)
|
||||
{
|
||||
CompoundTag tileData = tile.saveWithId();
|
||||
CompoundTag tileData = tile.saveWithId(tile.getLevel().registryAccess());
|
||||
nbt.put("tile", tileData);
|
||||
}
|
||||
}
|
||||
|
|
@ -120,7 +121,7 @@ public class CarryOnData {
|
|||
}
|
||||
|
||||
@Nullable
|
||||
public BlockEntity getBlockEntity(BlockPos pos)
|
||||
public BlockEntity getBlockEntity(BlockPos pos, HolderLookup.Provider lookup)
|
||||
{
|
||||
if(this.type != CarryType.BLOCK)
|
||||
throw new IllegalStateException("Called getBlockEntity on data that contained " + this.type);
|
||||
|
|
@ -128,7 +129,7 @@ public class CarryOnData {
|
|||
if(!nbt.contains("tile"))
|
||||
return null;
|
||||
|
||||
return BlockEntity.loadStatic(pos, this.getBlock(), nbt.getCompound("tile"));
|
||||
return BlockEntity.loadStatic(pos, this.getBlock(), nbt.getCompound("tile"), lookup);
|
||||
}
|
||||
|
||||
public void setEntity(Entity entity)
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ public class PickupHandler {
|
|||
BlockState state = level.getBlockState(pos);
|
||||
CompoundTag nbt = null;
|
||||
if(blockEntity != null)
|
||||
nbt = blockEntity.saveWithId();
|
||||
nbt = blockEntity.saveWithId(level.registryAccess());
|
||||
|
||||
if(!ListHandler.isPermitted(state.getBlock()))
|
||||
return false;
|
||||
|
|
@ -228,7 +228,7 @@ public class PickupHandler {
|
|||
Services.PLATFORM.sendPacketToPlayer(Constants.PACKET_ID_START_RIDING, new ClientboundStartRidingPacket(otherPlayer.getId(), true), player);
|
||||
carry.setCarryingPlayer();
|
||||
player.swing(InteractionHand.MAIN_HAND, true);
|
||||
player.level().playSound(null, player.getOnPos(), SoundEvents.ARMOR_EQUIP_GENERIC, SoundSource.AMBIENT, 1.0f, 0.5f);
|
||||
player.level().playSound(null, player.getOnPos(), SoundEvents.ARMOR_EQUIP_GENERIC.value(), SoundSource.AMBIENT, 1.0f, 0.5f);
|
||||
CarryOnDataManager.setCarryData(player, carry);
|
||||
return true;
|
||||
|
||||
|
|
@ -250,7 +250,7 @@ public class PickupHandler {
|
|||
carry.setEntity(entity);
|
||||
entity.remove(RemovalReason.UNLOADED_WITH_PLAYER);
|
||||
|
||||
player.level().playSound(null, player.getOnPos(), SoundEvents.ARMOR_EQUIP_GENERIC, SoundSource.AMBIENT, 1.0f, 0.5f);
|
||||
player.level().playSound(null, player.getOnPos(), SoundEvents.ARMOR_EQUIP_GENERIC.value(), SoundSource.AMBIENT, 1.0f, 0.5f);
|
||||
CarryOnDataManager.setCarryData(player, carry);
|
||||
player.swing(InteractionHand.MAIN_HAND, true);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ public class PlacementHandler
|
|||
|
||||
context = new BlockPlaceContext(player, InteractionHand.MAIN_HAND, ItemStack.EMPTY, BlockHitResult.miss(player.position(), facing, pos));
|
||||
|
||||
BlockEntity blockEntity = carry.getBlockEntity(pos);
|
||||
BlockEntity blockEntity = carry.getBlockEntity(pos, level.registryAccess());
|
||||
|
||||
state = getPlacementState(state, player, context, pos);
|
||||
|
||||
|
|
@ -295,7 +295,7 @@ public class PlacementHandler
|
|||
BlockPlaceContext context = new BlockPlaceContext(player, InteractionHand.MAIN_HAND, ItemStack.EMPTY, BlockHitResult.miss(Vec3.atCenterOf(player.blockPosition()), Direction.DOWN, player.blockPosition()));
|
||||
BlockState state = getPlacementState(carry.getBlock(), player, context, player.blockPosition());
|
||||
BlockPos pos = getDeathPlacementPos(state, player);
|
||||
BlockEntity blockEntity = carry.getBlockEntity(pos);
|
||||
BlockEntity blockEntity = carry.getBlockEntity(pos, player.level().registryAccess());
|
||||
player.level().setBlock(pos, state, 3);
|
||||
if (blockEntity != null)
|
||||
player.level().setBlockEntity(blockEntity);
|
||||
|
|
|
|||
|
|
@ -263,7 +263,7 @@ public final class Matchables
|
|||
for (MobEffectInstance effect : fx)
|
||||
{
|
||||
int amp = effect.getAmplifier();
|
||||
String name = BuiltInRegistries.MOB_EFFECT.getKey(effect.getEffect()).toString();
|
||||
String name = effect.getEffect().getRegisteredName();
|
||||
|
||||
if (names.contains(name))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ public class ScriptReloadListener extends SimpleJsonResourceReloadListener
|
|||
if (player != null)
|
||||
{
|
||||
DataResult<Tag> result = Codec.list(CarryOnScript.CODEC).encodeStart(NbtOps.INSTANCE, ScriptManager.SCRIPTS);
|
||||
Tag tag = result.getOrThrow(false, s -> {throw new RuntimeException("Error while synching Carry On Scripts: " + s);});
|
||||
Tag tag = result.getOrThrow(s -> {throw new RuntimeException("Error while synching Carry On Scripts: " + s);});
|
||||
|
||||
Services.PLATFORM.sendPacketToPlayer(Constants.PACKET_ID_SYNC_SCRIPTS, new ClientboundSyncScriptsPacket(tag), player);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ package tschipp.carryon.config;
|
|||
|
||||
//Many Thanks to ThatGravyBoat for this template!
|
||||
|
||||
import net.minecraft.core.HolderLookup;
|
||||
import tschipp.carryon.client.modeloverride.ModelOverrideHandler;
|
||||
import tschipp.carryon.common.config.ListHandler;
|
||||
import tschipp.carryon.common.pickupcondition.PickupConditionHandler;
|
||||
|
|
@ -53,10 +54,10 @@ public class ConfigLoader {
|
|||
Services.PLATFORM.registerConfig(config);
|
||||
}
|
||||
|
||||
public static void onConfigLoaded() {
|
||||
public static void onConfigLoaded(HolderLookup.Provider provider) {
|
||||
ListHandler.initConfigLists();
|
||||
PickupConditionHandler.initPickupConditions();
|
||||
ModelOverrideHandler.initModelOverrides();
|
||||
ModelOverrideHandler.initModelOverrides(provider);
|
||||
}
|
||||
|
||||
public static BuiltCategory buildCategory(String categoryDesc, Object object) throws IllegalAccessException {
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ package tschipp.carryon.mixin;
|
|||
|
||||
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.syncher.SynchedEntityData;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
|
|
@ -40,9 +41,9 @@ public abstract class PlayerMixin extends LivingEntity {
|
|||
super(type, level);
|
||||
}
|
||||
|
||||
@Inject(method = "defineSynchedData()V", at = @At("RETURN"))
|
||||
private void onDefineSynchedData(CallbackInfo info) {
|
||||
this.entityData.define(CarryOnDataManager.CARRY_DATA_KEY, new CompoundTag());
|
||||
@Inject(method = "defineSynchedData(Lnet/minecraft/network/syncher/SynchedEntityData$Builder;)V", at = @At("RETURN"))
|
||||
private void onDefineSynchedData(SynchedEntityData.Builder builder, CallbackInfo ci) {
|
||||
builder.define(CarryOnDataManager.CARRY_DATA_KEY, new CompoundTag());
|
||||
}
|
||||
|
||||
@Inject(method = "addAdditionalSaveData(Lnet/minecraft/nbt/CompoundTag;)V", at = @At("RETURN"))
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ public record ClientboundSyncScriptsPacket(Tag serialized) implements PacketBase
|
|||
public void handle(Player player)
|
||||
{
|
||||
DataResult<List<CarryOnScript>> res = Codec.list(CarryOnScript.CODEC).parse(NbtOps.INSTANCE, serialized);
|
||||
List<CarryOnScript> scripts = res.getOrThrow(false, (s) -> {throw new RuntimeException("Failed deserializing carry on scripts on the client: " + s);});
|
||||
List<CarryOnScript> scripts = res.getOrThrow((s) -> {throw new RuntimeException("Failed deserializing carry on scripts on the client: " + s);});
|
||||
ScriptManager.SCRIPTS.clear();
|
||||
ScriptManager.SCRIPTS.addAll(scripts);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
package tschipp.carryon.platform.services;
|
||||
|
||||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
|
@ -63,5 +64,4 @@ public interface IPlatformHelper {
|
|||
void sendPacketToServer(ResourceLocation id, PacketBase packet);
|
||||
|
||||
void sendPacketToPlayer(ResourceLocation id, PacketBase packet, ServerPlayer player);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ plugins {
|
|||
id 'java'
|
||||
id 'maven-publish'
|
||||
id 'idea'
|
||||
id 'fabric-loom' version '1.5-SNAPSHOT'
|
||||
id 'fabric-loom' version '1.6-SNAPSHOT'
|
||||
}
|
||||
base {
|
||||
archivesName = "${mod_id}-fabric-${minecraft_version}"
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ public class CommonEvents {
|
|||
|
||||
CommonLifecycleEvents.TAGS_LOADED.register((registries, client) -> {
|
||||
if(!client)
|
||||
ConfigLoader.onConfigLoaded();
|
||||
ConfigLoader.onConfigLoaded(registries);
|
||||
});
|
||||
|
||||
UseBlockCallback.EVENT.register((player, world, hand, hitResult) -> {
|
||||
|
|
|
|||
|
|
@ -119,6 +119,9 @@ dependencies {
|
|||
filename = filename.substring(0, lastDash) + ":" + filename.substring(lastDash+1, filename.length());
|
||||
implementation fg.deobf("blank:${filename}")
|
||||
}
|
||||
|
||||
// Hack fix for now, force jopt-simple to be exactly 5.0.4 because Mojang ships that version, but some transitive dependencies request 6.0+
|
||||
implementation('net.sf.jopt-simple:jopt-simple:5.0.4') { version { strictly '5.0.4' } }
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
|
|
|
|||
|
|
@ -22,13 +22,21 @@ package tschipp.carryon.config.forge;
|
|||
|
||||
import com.electronwill.nightconfig.core.AbstractConfig;
|
||||
import com.electronwill.nightconfig.core.UnmodifiableConfig;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.common.ForgeConfigSpec;
|
||||
import net.minecraftforge.common.util.LogicalSidedProvider;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import net.minecraftforge.fml.ModLoadingContext;
|
||||
import net.minecraftforge.fml.config.IConfigSpec;
|
||||
import net.minecraftforge.fml.config.ModConfig;
|
||||
import net.minecraftforge.fml.event.config.ModConfigEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import net.minecraftforge.fml.loading.FMLServiceProvider;
|
||||
import net.minecraftforge.server.ServerLifecycleHooks;
|
||||
import tschipp.carryon.config.*;
|
||||
|
||||
import java.util.*;
|
||||
|
|
@ -52,12 +60,27 @@ public class ConfigLoaderImpl {
|
|||
|
||||
public static void onConfigLoad(ModConfigEvent.Loading loading) {
|
||||
loadConfig(loading.getConfig().getSpec());
|
||||
ConfigLoader.onConfigLoaded();
|
||||
|
||||
|
||||
DistExecutor.safeRunWhenOn(Dist.CLIENT, () -> () -> {
|
||||
ConfigLoader.onConfigLoaded(Minecraft.getInstance().level.registryAccess());
|
||||
});
|
||||
|
||||
DistExecutor.safeRunWhenOn(Dist.DEDICATED_SERVER, () -> () -> {
|
||||
ConfigLoader.onConfigLoaded(ServerLifecycleHooks.getCurrentServer().registryAccess());
|
||||
});
|
||||
}
|
||||
|
||||
public static void onConfigReload(ModConfigEvent.Reloading loading) {
|
||||
loadConfig(loading.getConfig().getSpec());
|
||||
ConfigLoader.onConfigLoaded();
|
||||
|
||||
DistExecutor.safeRunWhenOn(Dist.CLIENT, () -> () -> {
|
||||
ConfigLoader.onConfigLoaded(Minecraft.getInstance().level.registryAccess());
|
||||
});
|
||||
|
||||
DistExecutor.safeRunWhenOn(Dist.DEDICATED_SERVER, () -> () -> {
|
||||
ConfigLoader.onConfigLoaded(ServerLifecycleHooks.getCurrentServer().registryAccess());
|
||||
});
|
||||
}
|
||||
|
||||
private static void loadConfig(IConfigSpec<ForgeConfigSpec> spec) {
|
||||
|
|
|
|||
|
|
@ -93,13 +93,9 @@ public class ClientEvents {
|
|||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@SubscribeEvent
|
||||
public static void onClientTick(ClientTickEvent event)
|
||||
public static void onClientTick(ClientTickEvent.Post event)
|
||||
{
|
||||
if(event.phase == Phase.END)
|
||||
{
|
||||
CarryOnCommonClient.checkForKeybinds();
|
||||
CarryOnCommonClient.onCarryClientTick();
|
||||
}
|
||||
|
||||
CarryOnCommonClient.checkForKeybinds();
|
||||
CarryOnCommonClient.onCarryClientTick();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -172,15 +172,14 @@ public class CommonEvents
|
|||
@SubscribeEvent
|
||||
public static void onTagsUpdate(TagsUpdatedEvent event)
|
||||
{
|
||||
ConfigLoader.onConfigLoaded();
|
||||
ConfigLoader.onConfigLoaded(event.getRegistryAccess());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onServerTick(ServerTickEvent event)
|
||||
public static void onServerTick(ServerTickEvent.Post event)
|
||||
{
|
||||
if (event.phase == Phase.END)
|
||||
for (ServerPlayer player : event.getServer().getPlayerList().getPlayers())
|
||||
CarryOnCommon.onCarryTick(player);
|
||||
for (ServerPlayer player : event.getServer().getPlayerList().getPlayers())
|
||||
CarryOnCommon.onCarryTick(player);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ public class ModBusEvents {
|
|||
ListHandler.addAllowedStacking(str);
|
||||
break;
|
||||
case "addModelOverride":
|
||||
ModelOverrideHandler.addFromString(str);
|
||||
//ModelOverrideHandler.addFromString(str, event);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
plugins {
|
||||
id 'idea'
|
||||
id 'maven-publish'
|
||||
id 'net.neoforged.gradle.userdev' version '7.0.81'
|
||||
id 'net.neoforged.gradle.userdev' version '7.0.142'
|
||||
id 'java-library'
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,8 +22,11 @@ package tschipp.carryon.config.neoforge;
|
|||
|
||||
import com.electronwill.nightconfig.core.AbstractConfig;
|
||||
import com.electronwill.nightconfig.core.UnmodifiableConfig;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.bus.api.IEventBus;
|
||||
import net.neoforged.bus.api.SubscribeEvent;
|
||||
import net.neoforged.fml.DistExecutor;
|
||||
import net.neoforged.fml.ModLoadingContext;
|
||||
import net.neoforged.fml.common.Mod;
|
||||
import net.neoforged.fml.config.IConfigSpec;
|
||||
|
|
@ -54,12 +57,24 @@ public class ConfigLoaderImpl {
|
|||
@SubscribeEvent
|
||||
public static void onConfigLoad(ModConfigEvent.Loading loading) {
|
||||
loadConfig(loading.getConfig().getSpec());
|
||||
ConfigLoader.onConfigLoaded();
|
||||
DistExecutor.safeRunWhenOn(Dist.CLIENT, () -> () -> {
|
||||
ConfigLoader.onConfigLoaded(Minecraft.getInstance().level.registryAccess());
|
||||
});
|
||||
|
||||
DistExecutor.safeRunWhenOn(Dist.DEDICATED_SERVER, () -> () -> {
|
||||
ConfigLoader.onConfigLoaded(ServerLifecycleHooks.getCurrentServer().registryAccess());
|
||||
});
|
||||
}
|
||||
@SubscribeEvent
|
||||
public static void onConfigReload(ModConfigEvent.Reloading loading) {
|
||||
loadConfig(loading.getConfig().getSpec());
|
||||
ConfigLoader.onConfigLoaded();
|
||||
DistExecutor.safeRunWhenOn(Dist.CLIENT, () -> () -> {
|
||||
ConfigLoader.onConfigLoaded(Minecraft.getInstance().level.registryAccess());
|
||||
});
|
||||
|
||||
DistExecutor.safeRunWhenOn(Dist.DEDICATED_SERVER, () -> () -> {
|
||||
ConfigLoader.onConfigLoaded(ServerLifecycleHooks.getCurrentServer().registryAccess());
|
||||
});
|
||||
}
|
||||
|
||||
private static void loadConfig(IConfigSpec<ModConfigSpec> spec) {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ subprojects {
|
|||
|
||||
apply plugin: 'java'
|
||||
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
|
||||
java.withSourcesJar()
|
||||
java.withJavadocJar()
|
||||
|
||||
|
|
@ -55,7 +55,7 @@ subprojects {
|
|||
tasks.withType(JavaCompile).configureEach {
|
||||
|
||||
it.options.encoding = 'UTF-8'
|
||||
it.options.release = 17
|
||||
it.options.release = 21
|
||||
}
|
||||
|
||||
processResources {
|
||||
|
|
|
|||
|
|
@ -1,33 +1,33 @@
|
|||
# Project
|
||||
version=2.1.3
|
||||
version=2.1.4
|
||||
group=tschipp.carryon
|
||||
|
||||
# Common
|
||||
minecraft_version=1.20.4
|
||||
minecraft_version=1.20.6
|
||||
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.20.4, 1.21)
|
||||
minecraft_version_range=[1.20.6, 1.21)
|
||||
# Forge
|
||||
forge_version=49.0.30
|
||||
forge_version=50.1.7
|
||||
forge_loader_version_range=[49,)
|
||||
forge_version_range=[49,)
|
||||
parchment_mappings=1.20.3-2023.12.31-1.20.4
|
||||
parchment_mappings=2024.06.16-1.20.6
|
||||
//forge_ats_enabled=true
|
||||
|
||||
# Fabric
|
||||
fabric_version=0.96.3+1.20.4
|
||||
fabric_loader_version=0.15.7
|
||||
parchment_mappings_fabric=1.20.3:2023.12.31
|
||||
fabric_version=0.100.2+1.20.6
|
||||
fabric_loader_version=0.15.11
|
||||
parchment_mappings_fabric=1.20.6:2024.06.16
|
||||
|
||||
# Neoforge
|
||||
neoforge_version=20.4.163-beta
|
||||
neoforge_version=20.6.119
|
||||
neoforge_loader_version_range=[2,)
|
||||
neogradle.subsystems.parchment.minecraftVersion=1.20.3
|
||||
neogradle.subsystems.parchment.mappingsVersion=2023.12.31
|
||||
neogradle.subsystems.parchment.minecraftVersion=1.20.6
|
||||
neogradle.subsystems.parchment.mappingsVersion=2024.06.16
|
||||
|
||||
|
||||
# Gradle
|
||||
|
|
|
|||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
|
|
@ -1,7 +1,6 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user