Updated to 1.21
This commit is contained in:
parent
3cfb59b70a
commit
753f19e7b0
|
|
@ -34,8 +34,8 @@ 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 = new ResourceLocation(Constants.MOD_ID, "key_pressed");
|
||||
public static final ResourceLocation PACKET_ID_START_RIDING = new ResourceLocation(Constants.MOD_ID, "start_riding");
|
||||
public static final ResourceLocation PACKET_ID_SYNC_SCRIPTS = new ResourceLocation(Constants.MOD_ID, "sync_scripts");
|
||||
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");
|
||||
|
||||
}
|
||||
|
|
@ -22,6 +22,7 @@ package tschipp.carryon.client.render;
|
|||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.BufferBuilder;
|
||||
import com.mojang.blaze3d.vertex.ByteBufferBuilder;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.Tesselator;
|
||||
import com.mojang.math.Axis;
|
||||
|
|
@ -50,19 +51,21 @@ import tschipp.carryon.common.scripting.CarryOnScript;
|
|||
import tschipp.carryon.common.scripting.CarryOnScript.ScriptRender;
|
||||
import tschipp.carryon.platform.Services;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.SequencedMap;
|
||||
|
||||
public class CarriedObjectRender
|
||||
{
|
||||
|
||||
private static Map<RenderType, BufferBuilder> builders = Map.of(
|
||||
RenderType.glint(), new BufferBuilder(RenderType.glint().bufferSize()),
|
||||
RenderType.glintDirect(), new BufferBuilder(RenderType.glintDirect().bufferSize()),
|
||||
RenderType.glintTranslucent(), new BufferBuilder(RenderType.glintTranslucent().bufferSize()),
|
||||
RenderType.entityGlint(), new BufferBuilder(RenderType.entityGlint().bufferSize()),
|
||||
RenderType.entityGlintDirect(), new BufferBuilder(RenderType.entityGlintDirect().bufferSize())
|
||||
);
|
||||
private static SequencedMap<RenderType, ByteBufferBuilder> builders = new LinkedHashMap<>(Map.of(
|
||||
RenderType.glint(), new ByteBufferBuilder(RenderType.glint().bufferSize()),
|
||||
RenderType.armorEntityGlint(), new ByteBufferBuilder(RenderType.armorEntityGlint().bufferSize()),
|
||||
RenderType.glintTranslucent(), new ByteBufferBuilder(RenderType.glintTranslucent().bufferSize()),
|
||||
RenderType.entityGlint(), new ByteBufferBuilder(RenderType.entityGlint().bufferSize()),
|
||||
RenderType.entityGlintDirect(), new ByteBufferBuilder(RenderType.entityGlintDirect().bufferSize())
|
||||
));
|
||||
|
||||
public static boolean drawFirstPerson(Player player, MultiBufferSource buffer, PoseStack matrix, int light, float partialTicks)
|
||||
{
|
||||
|
|
@ -192,7 +195,7 @@ public class CarriedObjectRender
|
|||
RenderSystem.disableCull();
|
||||
RenderSystem.disableDepthTest();
|
||||
|
||||
BufferSource buffer = MultiBufferSource.immediateWithBuffers(builders, Tesselator.getInstance().getBuilder());
|
||||
BufferSource buffer = MultiBufferSource.immediateWithBuffers(builders, builders.get(RenderType.glint()));
|
||||
|
||||
for (Player player : level.players())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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(new ResourceLocation(name));
|
||||
Block blk = BuiltInRegistries.BLOCK.get(ResourceLocation.parse(name));
|
||||
for(String propName : props.split(",")) {
|
||||
for (Property<?> prop : blk.defaultBlockState().getProperties()) {
|
||||
if (prop.getName().equals(propName))
|
||||
|
|
@ -164,7 +164,7 @@ public class ListHandler {
|
|||
|
||||
private static <T> void addTag(String tag, Map<ResourceLocation, TagKey<T>> tagMap, List<TagKey<T>> tags) {
|
||||
String sub = tag.substring(1);
|
||||
TagKey<T> t = tagMap.get(new ResourceLocation(sub));
|
||||
TagKey<T> t = tagMap.get(ResourceLocation.parse(sub));
|
||||
if (t != null)
|
||||
tags.add(t);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ public final class Matchables
|
|||
public boolean matches(ServerPlayer player)
|
||||
{
|
||||
ServerAdvancementManager manager = player.server.getAdvancements();
|
||||
AdvancementHolder adv = manager.get(new ResourceLocation(advancement.isEmpty() ? "" : advancement));
|
||||
AdvancementHolder adv = manager.get(ResourceLocation.parse(advancement.isEmpty() ? "" : advancement));
|
||||
|
||||
boolean achievement = adv == null ? true : player.getAdvancements().getOrStartProgress(adv).isDone();
|
||||
return achievement;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "tschipp.carryon.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"compatibilityLevel": "JAVA_21",
|
||||
"mixins": [
|
||||
"EntityMixin",
|
||||
"InventoryMixin",
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ package tschipp.carryon.mixin;
|
|||
import com.llamalad7.mixinextras.sugar.Local;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.Camera;
|
||||
import net.minecraft.client.DeltaTracker;
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
import net.minecraft.client.renderer.LevelRenderer;
|
||||
import net.minecraft.client.renderer.LightTexture;
|
||||
|
|
@ -36,9 +37,9 @@ import tschipp.carryon.client.render.CarriedObjectRender;
|
|||
@Mixin(LevelRenderer.class)
|
||||
public class LevelRendererMixin
|
||||
{
|
||||
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/particle/ParticleEngine;render(Lnet/minecraft/client/renderer/LightTexture;Lnet/minecraft/client/Camera;F)V"), method = "renderLevel(FJZLnet/minecraft/client/Camera;Lnet/minecraft/client/renderer/GameRenderer;Lnet/minecraft/client/renderer/LightTexture;Lorg/joml/Matrix4f;Lorg/joml/Matrix4f;)V")
|
||||
private void onRenderLevel(float partialTick, long nanoTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f frustumMatrix, Matrix4f projectionMatrix, CallbackInfo ci, @Local PoseStack poseStack)
|
||||
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/particle/ParticleEngine;render(Lnet/minecraft/client/renderer/LightTexture;Lnet/minecraft/client/Camera;F)V"), method = "renderLevel(Lnet/minecraft/client/DeltaTracker;ZLnet/minecraft/client/Camera;Lnet/minecraft/client/renderer/GameRenderer;Lnet/minecraft/client/renderer/LightTexture;Lorg/joml/Matrix4f;Lorg/joml/Matrix4f;)V")
|
||||
private void onRenderLevel(DeltaTracker deltaTracker, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f frustumMatrix, Matrix4f projectionMatrix, CallbackInfo ci, @Local PoseStack poseStack)
|
||||
{
|
||||
CarriedObjectRender.drawThirdPerson(gameRenderer.getMinecraft().getFrameTime(), poseStack.last().pose());
|
||||
CarriedObjectRender.drawThirdPerson(deltaTracker.getGameTimeDeltaPartialTick(true), poseStack.last().pose());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,6 @@ public class IdentifiableScriptReloadListener extends ScriptReloadListener imple
|
|||
@Override
|
||||
public ResourceLocation getFabricId()
|
||||
{
|
||||
return new ResourceLocation(Constants.MOD_ID, "carryon_scripts");
|
||||
return ResourceLocation.fromNamespaceAndPath(Constants.MOD_ID, "carryon_scripts");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "tschipp.carryon.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"compatibilityLevel": "JAVA_21",
|
||||
"mixins": [
|
||||
"PlayerMixinFabric"
|
||||
],
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
"fabricloader": ">=${fabric_loader_version}",
|
||||
"fabric-api": "*",
|
||||
"minecraft": "${minecraft_version}",
|
||||
"java": ">=17"
|
||||
"java": ">=21"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2,7 +2,7 @@ plugins {
|
|||
id 'idea'
|
||||
id 'java'
|
||||
id 'maven-publish'
|
||||
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
|
||||
id 'net.minecraftforge.gradle' version '[6.0.24,6.2)'
|
||||
id 'org.spongepowered.mixin' version '0.7-SNAPSHOT'
|
||||
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
|
||||
}
|
||||
|
|
@ -35,6 +35,7 @@ mixin {
|
|||
minecraft {
|
||||
mappings channel: 'parchment', version: "${parchment_mappings}"
|
||||
copyIdeResources = true
|
||||
reobf = false
|
||||
|
||||
if (file('src/main/resources/META-INF/accesstransformer.cfg').exists()) {
|
||||
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||
|
|
@ -102,7 +103,7 @@ repositories {
|
|||
dependencies {
|
||||
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
|
||||
compileOnly project(":Common")
|
||||
implementation(annotationProcessor("io.github.llamalad7:mixinextras-common:${mixinextras_version}"))
|
||||
compileOnly(annotationProcessor("io.github.llamalad7:mixinextras-common:${mixinextras_version}"))
|
||||
implementation(annotationProcessor("io.github.llamalad7:mixinextras-forge:${mixinextras_version}"))
|
||||
jarJar(group: 'io.github.llamalad7', name: 'mixinextras-forge', version: "[${mixinextras_version},)")
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public class CarryOnForge {
|
|||
|
||||
private void setup(final FMLCommonSetupEvent event)
|
||||
{
|
||||
network = ChannelBuilder.named(new ResourceLocation(Constants.MOD_ID, "carryonpackets")).simpleChannel();
|
||||
network = ChannelBuilder.named(ResourceLocation.fromNamespaceAndPath(Constants.MOD_ID, "carryonpackets")).simpleChannel();
|
||||
|
||||
CarryOnCommon.registerServerPackets();
|
||||
CarryOnCommon.registerClientPackets();
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ public class ClientEvents {
|
|||
public static void onRenderLevel(RenderLevelStageEvent event)
|
||||
{
|
||||
if(event.getStage() == Stage.AFTER_PARTICLES)
|
||||
CarriedObjectRender.drawThirdPerson(event.getPartialTick(), event.getPoseStack());
|
||||
CarriedObjectRender.drawThirdPerson(Minecraft.getInstance().getTimer().getGameTimeDeltaPartialTick(true), event.getPoseStack());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "tschipp.carryon.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"compatibilityLevel": "JAVA_21",
|
||||
"mixins": [
|
||||
],
|
||||
"client": [
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
plugins {
|
||||
id 'idea'
|
||||
id 'maven-publish'
|
||||
id 'net.neoforged.gradle.userdev' version '7.0.142'
|
||||
id 'net.neoforged.gradle.userdev' version '7.0.145'
|
||||
id 'java-library'
|
||||
}
|
||||
|
||||
|
||||
if (System.getenv('BUILD_NUMBER') != null) {
|
||||
version += "." + System.getenv('BUILD_NUMBER')
|
||||
}
|
||||
|
|
@ -33,6 +34,8 @@ if (file('src/main/resources/META-INF/accesstransformer.cfg').exists()) {
|
|||
runs {
|
||||
// applies to all the run configs below
|
||||
configureEach {
|
||||
systemProperty 'forge.logging.markers', 'REGISTRIES'
|
||||
systemProperty 'forge.logging.console.level', 'debug'
|
||||
modSource project.sourceSets.main
|
||||
}
|
||||
|
||||
|
|
@ -62,7 +65,12 @@ runs {
|
|||
}
|
||||
}
|
||||
|
||||
sourceSets.main.resources.srcDir 'src/generated/resources'
|
||||
sourceSets.main.resources { srcDir 'src/generated/resources' }
|
||||
|
||||
configurations {
|
||||
runtimeClasspath.extendsFrom localRuntime
|
||||
}
|
||||
|
||||
|
||||
tasks.named("test").configure {
|
||||
enabled = false
|
||||
|
|
@ -107,3 +115,10 @@ publishing {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
idea {
|
||||
module {
|
||||
downloadSources = true
|
||||
downloadJavadoc = true
|
||||
}
|
||||
}
|
||||
|
|
@ -22,6 +22,7 @@ package tschipp.carryon;
|
|||
|
||||
import net.neoforged.bus.api.IEventBus;
|
||||
import net.neoforged.bus.api.SubscribeEvent;
|
||||
import net.neoforged.fml.ModContainer;
|
||||
import net.neoforged.fml.common.Mod;
|
||||
import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
import net.neoforged.neoforge.common.NeoForge;
|
||||
|
|
@ -32,17 +33,17 @@ import tschipp.carryon.config.neoforge.ConfigLoaderImpl;
|
|||
@Mod(Constants.MOD_ID)
|
||||
public class CarryOnNeoForge {
|
||||
|
||||
public CarryOnNeoForge(IEventBus bus) {
|
||||
|
||||
public CarryOnNeoForge(ModContainer container) {
|
||||
|
||||
// This method is invoked by the Forge mod loader when it is ready
|
||||
// to load your mod. You can access Forge and Common code in this
|
||||
// project.
|
||||
// Use Forge to bootstrap the Common mod.
|
||||
CarryOnCommon.registerConfig();
|
||||
bus.addListener(this::setup);
|
||||
bus.addListener(this::registerPackets);
|
||||
container.getEventBus().addListener(this::setup);
|
||||
container.getEventBus().addListener(this::registerPackets);
|
||||
|
||||
ConfigLoaderImpl.initialize();
|
||||
ConfigLoaderImpl.initialize(container);
|
||||
}
|
||||
|
||||
private void setup(final FMLCommonSetupEvent event)
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ 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.ModContainer;
|
||||
import net.neoforged.fml.ModLoadingContext;
|
||||
import net.neoforged.fml.common.EventBusSubscriber;
|
||||
import net.neoforged.fml.common.Mod;
|
||||
|
|
@ -45,13 +46,14 @@ public class ConfigLoaderImpl {
|
|||
|
||||
public static final Map<ModConfigSpec, BuiltConfig> CONFIGS = new HashMap<>();
|
||||
|
||||
public static void initialize() {
|
||||
public static void initialize(ModContainer container) {
|
||||
|
||||
ConfigLoaderImpl.CONFIGS.forEach((spec, config) -> {
|
||||
|
||||
if(config.fileName.contains("client"))
|
||||
ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, spec, config.fileName+".toml");
|
||||
container.registerConfig(ModConfig.Type.CLIENT, spec, config.fileName+".toml");
|
||||
else
|
||||
ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, spec, config.fileName+".toml");
|
||||
container.registerConfig(ModConfig.Type.COMMON, spec, config.fileName+".toml");
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ public class ClientEvents {
|
|||
public static void onRenderLevel(RenderLevelStageEvent event)
|
||||
{
|
||||
if(event.getStage() == RenderLevelStageEvent.Stage.AFTER_PARTICLES)
|
||||
CarriedObjectRender.drawThirdPerson(event.getPartialTick(), event.getPoseStack().last().pose());
|
||||
CarriedObjectRender.drawThirdPerson(event.getPartialTick().getGameTimeDeltaPartialTick(true), event.getPoseStack().last().pose());
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ import net.neoforged.neoforge.common.NeoForge;
|
|||
import net.neoforged.neoforge.common.util.BlockSnapshot;
|
||||
import net.neoforged.neoforge.common.util.TriState;
|
||||
import net.neoforged.neoforge.event.*;
|
||||
import net.neoforged.neoforge.event.entity.living.LivingAttackEvent;
|
||||
import net.neoforged.neoforge.event.entity.living.MobSpawnEvent;
|
||||
import net.neoforged.neoforge.event.entity.player.AttackEntityEvent;
|
||||
import net.neoforged.neoforge.event.entity.player.PlayerEvent;
|
||||
|
|
@ -207,7 +206,7 @@ public class CommonEvents
|
|||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void playerAttack(LivingAttackEvent event)
|
||||
public static void playerAttack(AttackEntityEvent event)
|
||||
{
|
||||
if(event.getEntity() instanceof Player player)
|
||||
CarryOnCommon.onPlayerAttacked(player);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "tschipp.carryon.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"compatibilityLevel": "JAVA_21",
|
||||
"mixins": [
|
||||
],
|
||||
"client": [
|
||||
|
|
|
|||
|
|
@ -1,33 +1,33 @@
|
|||
# Project
|
||||
version=2.1.4
|
||||
version=2.2.0
|
||||
group=tschipp.carryon
|
||||
|
||||
# Common
|
||||
minecraft_version=1.20.6
|
||||
minecraft_version=1.21
|
||||
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.6, 1.21)
|
||||
minecraft_version_range=[1.21, 1.22)
|
||||
# Forge
|
||||
forge_version=50.1.7
|
||||
forge_loader_version_range=[49,)
|
||||
forge_version_range=[49,)
|
||||
parchment_mappings=2024.06.16-1.20.6
|
||||
forge_version=51.0.24
|
||||
forge_loader_version_range=[51,)
|
||||
forge_version_range=[51,)
|
||||
parchment_mappings=2024.07.07-1.21
|
||||
//forge_ats_enabled=true
|
||||
|
||||
# Fabric
|
||||
fabric_version=0.100.2+1.20.6
|
||||
fabric_version=0.100.6+1.21
|
||||
fabric_loader_version=0.15.11
|
||||
parchment_mappings_fabric=1.20.6:2024.06.16
|
||||
parchment_mappings_fabric=1.21:2024.07.07
|
||||
|
||||
# Neoforge
|
||||
neoforge_version=20.6.119
|
||||
neoforge_loader_version_range=[2,)
|
||||
neogradle.subsystems.parchment.minecraftVersion=1.20.6
|
||||
neogradle.subsystems.parchment.mappingsVersion=2024.06.16
|
||||
neoforge_version=21.0.81-beta
|
||||
neoforge_loader_version_range=[4,)
|
||||
neogradle.subsystems.parchment.minecraftVersion=1.21
|
||||
neogradle.subsystems.parchment.mappingsVersion=2024.07.07
|
||||
|
||||
|
||||
# Gradle
|
||||
|
|
|
|||
|
|
@ -46,5 +46,5 @@ plugins {
|
|||
}
|
||||
|
||||
rootProject.name = 'CarryOn'
|
||||
include("Common", "Fabric", "NeoForge")
|
||||
//include("Common", "Fabric", "Forge", "NeoForge")
|
||||
//include("Common", "Fabric", "NeoForge")
|
||||
include("Common", "Fabric", "Forge", "NeoForge")
|
||||
Loading…
Reference in New Issue
Block a user