some mild work on porting to 1.21.9
This commit is contained in:
parent
ece3ed7ff2
commit
eadfba05e8
71
.vscode/launch.json
vendored
Normal file
71
.vscode/launch.json
vendored
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "java",
|
||||
"request": "launch",
|
||||
"name": "NeoForge Client (:NeoForge)",
|
||||
"presentation": {
|
||||
"group": "Mod Development - NeoForge",
|
||||
"order": 0
|
||||
},
|
||||
"projectName": "NeoForge",
|
||||
"mainClass": "net.neoforged.devlaunch.Main",
|
||||
"args": [
|
||||
"@/home/hanro/Documents/GitHub/CarryOn/NeoForge/build/moddev/clientRunProgramArgs.txt"
|
||||
],
|
||||
"vmArgs": [
|
||||
"@/home/hanro/Documents/GitHub/CarryOn/NeoForge/build/moddev/clientRunVmArgs.txt",
|
||||
"-Dfml.modFolders\u003dcarryon%%/home/hanro/Documents/GitHub/CarryOn/NeoForge/bin/main"
|
||||
],
|
||||
"cwd": "${workspaceFolder}/NeoForge/run",
|
||||
"env": {},
|
||||
"console": "internalConsole",
|
||||
"shortenCommandLine": "none"
|
||||
},
|
||||
{
|
||||
"type": "java",
|
||||
"request": "launch",
|
||||
"name": "NeoForge Data (:NeoForge)",
|
||||
"presentation": {
|
||||
"group": "Mod Development - NeoForge",
|
||||
"order": 1
|
||||
},
|
||||
"projectName": "NeoForge",
|
||||
"mainClass": "net.neoforged.devlaunch.Main",
|
||||
"args": [
|
||||
"@/home/hanro/Documents/GitHub/CarryOn/NeoForge/build/moddev/dataRunProgramArgs.txt"
|
||||
],
|
||||
"vmArgs": [
|
||||
"@/home/hanro/Documents/GitHub/CarryOn/NeoForge/build/moddev/dataRunVmArgs.txt",
|
||||
"-Dfml.modFolders\u003dcarryon%%/home/hanro/Documents/GitHub/CarryOn/NeoForge/bin/main"
|
||||
],
|
||||
"cwd": "${workspaceFolder}/NeoForge/run",
|
||||
"env": {},
|
||||
"console": "internalConsole",
|
||||
"shortenCommandLine": "none"
|
||||
},
|
||||
{
|
||||
"type": "java",
|
||||
"request": "launch",
|
||||
"name": "NeoForge Server (:NeoForge)",
|
||||
"presentation": {
|
||||
"group": "Mod Development - NeoForge",
|
||||
"order": 2
|
||||
},
|
||||
"projectName": "NeoForge",
|
||||
"mainClass": "net.neoforged.devlaunch.Main",
|
||||
"args": [
|
||||
"@/home/hanro/Documents/GitHub/CarryOn/NeoForge/build/moddev/serverRunProgramArgs.txt"
|
||||
],
|
||||
"vmArgs": [
|
||||
"@/home/hanro/Documents/GitHub/CarryOn/NeoForge/build/moddev/serverRunVmArgs.txt",
|
||||
"-Dfml.modFolders\u003dcarryon%%/home/hanro/Documents/GitHub/CarryOn/NeoForge/bin/main"
|
||||
],
|
||||
"cwd": "${workspaceFolder}/NeoForge/run",
|
||||
"env": {},
|
||||
"console": "internalConsole",
|
||||
"shortenCommandLine": "none"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -26,10 +26,7 @@ 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;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
|
|
@ -108,6 +105,7 @@ public class CarryOnCommon
|
|||
|
||||
public static void onCarryTick(ServerPlayer player)
|
||||
{
|
||||
|
||||
CarryOnData carry = CarryOnDataManager.getCarryData(player);
|
||||
if(carry.isCarrying())
|
||||
{
|
||||
|
|
@ -115,7 +113,7 @@ public class CarryOnCommon
|
|||
{
|
||||
String cmd = carry.getActiveScript().get().scriptEffects().commandLoop();
|
||||
if(!cmd.isEmpty())
|
||||
player.getServer().getCommands().performPrefixedCommand(player.getServer().createCommandSourceStack(), "/execute as " + player.getGameProfile().getName() + " run " + cmd);
|
||||
player.level().getServer().getCommands().performPrefixedCommand(player.level().getServer().createCommandSourceStack(), "/execute as " + player.getGameProfile().name() + " run " + cmd);
|
||||
}
|
||||
|
||||
Inventory inv = player.getInventory();
|
||||
|
|
@ -153,7 +151,7 @@ public class CarryOnCommon
|
|||
|
||||
public static void onPlayerAttacked(Player player)
|
||||
{
|
||||
if (Constants.COMMON_CONFIG.settings.dropCarriedWhenHit && !player.level().isClientSide)
|
||||
if (Constants.COMMON_CONFIG.settings.dropCarriedWhenHit && !player.level().isClientSide())
|
||||
{
|
||||
CarryOnData carry = CarryOnDataManager.getCarryData(player);
|
||||
if (carry.isCarrying())
|
||||
|
|
|
|||
|
|
@ -34,11 +34,11 @@ public class CarryOnCommonClient
|
|||
Player player = mc.player;
|
||||
if(player != null) {
|
||||
CarryOnData carry = CarryOnDataManager.getCarryData(player);
|
||||
if ((CarryOnKeybinds.carryKey.isUnbound() ? player.isShiftKeyDown() : (CarryOnKeybinds.carryKey.isDown() || checkMouse())) && !carry.isKeyPressed()) {
|
||||
if ((CarryOnKeybinds.carryKey.isUnbound() ? player.isShiftKeyDown() : (CarryOnKeybinds.carryKey.isDown())) && !carry.isKeyPressed()) {
|
||||
CarryOnKeybinds.onCarryKey(true);
|
||||
carry.setKeyPressed(true);
|
||||
CarryOnDataManager.setCarryData(player, carry);
|
||||
} else if (!(CarryOnKeybinds.carryKey.isUnbound() ? player.isShiftKeyDown() : (CarryOnKeybinds.carryKey.isDown() || checkMouse()) ) && carry.isKeyPressed()) {
|
||||
} else if (!(CarryOnKeybinds.carryKey.isUnbound() ? player.isShiftKeyDown() : (CarryOnKeybinds.carryKey.isDown() ) ) && carry.isKeyPressed()) {
|
||||
CarryOnKeybinds.onCarryKey(false);
|
||||
carry.setKeyPressed(false);
|
||||
CarryOnDataManager.setCarryData(player, carry);
|
||||
|
|
@ -46,11 +46,6 @@ public class CarryOnCommonClient
|
|||
}
|
||||
}
|
||||
|
||||
private static boolean checkMouse()
|
||||
{
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
return (CarryOnKeybinds.carryKey.matchesMouse(0) && mc.mouseHandler.isLeftPressed()) || (CarryOnKeybinds.carryKey.matchesMouse(1) && mc.mouseHandler.isRightPressed()) || (CarryOnKeybinds.carryKey.matchesMouse(3) && mc.mouseHandler.isMiddlePressed());
|
||||
}
|
||||
|
||||
public static void onCarryClientTick()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -22,11 +22,13 @@ package tschipp.carryon.client.keybinds;
|
|||
|
||||
import com.mojang.blaze3d.platform.InputConstants;
|
||||
import net.minecraft.client.KeyMapping;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import tschipp.carryon.Constants;
|
||||
import tschipp.carryon.networking.serverbound.ServerboundCarryKeyPressedPacket;
|
||||
import tschipp.carryon.platform.Services;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
import net.minecraft.client.KeyMapping.Category;
|
||||
|
||||
public class CarryOnKeybinds
|
||||
{
|
||||
|
|
@ -34,10 +36,13 @@ public class CarryOnKeybinds
|
|||
|
||||
public static void registerKeybinds(Consumer<KeyMapping> registrar)
|
||||
{
|
||||
Category category = Category.register(ResourceLocation.withDefaultNamespace("key.carry.category"));
|
||||
|
||||
|
||||
if(Services.PLATFORM.isModLoaded("amecsapi"))
|
||||
carryKey = new ConflictFreeKeyMapping("key.carry.desc", InputConstants.KEY_LSHIFT, "key.carry.category");
|
||||
carryKey = new KeyMapping("key.carry.desc", InputConstants.KEY_LSHIFT, category);
|
||||
else
|
||||
carryKey = new ConflictFreeKeyMapping("key.carry.desc", Services.PLATFORM.getPlatformName().equals("Forge") ? InputConstants.KEY_LSHIFT : InputConstants.UNKNOWN.getValue(), "key.carry.category");
|
||||
carryKey = new KeyMapping("key.carry.desc", Services.PLATFORM.getPlatformName().equals("Forge") ? InputConstants.KEY_LSHIFT : InputConstants.UNKNOWN.getValue(), category);
|
||||
|
||||
registrar.accept(carryKey);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
* GNU Lesser General Public License v3
|
||||
* Copyright (C) 2024 Tschipp
|
||||
* mrtschipp@gmail.com
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package tschipp.carryon.client.keybinds;
|
||||
|
||||
import com.mojang.blaze3d.platform.InputConstants.Type;
|
||||
import net.minecraft.client.KeyMapping;
|
||||
|
||||
public class ConflictFreeKeyMapping extends KeyMapping
|
||||
{
|
||||
public ConflictFreeKeyMapping(String $$0, int $$1, String $$2)
|
||||
{
|
||||
super($$0, $$1, $$2);
|
||||
}
|
||||
|
||||
public ConflictFreeKeyMapping(String $$0, Type $$1, int $$2, String $$3)
|
||||
{
|
||||
super($$0, $$1, $$2, $$3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean same(KeyMapping $$0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -23,7 +23,6 @@ package tschipp.carryon.client.modeloverride;
|
|||
import com.mojang.brigadier.StringReader;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.mojang.datafixers.util.Either;
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.DataResult;
|
||||
import net.minecraft.commands.arguments.blocks.BlockStateParser;
|
||||
import net.minecraft.commands.arguments.blocks.BlockStateParser.BlockResult;
|
||||
|
|
|
|||
|
|
@ -20,34 +20,24 @@
|
|||
|
||||
package tschipp.carryon.client.render;
|
||||
|
||||
import com.mojang.blaze3d.pipeline.BlendFunction;
|
||||
import com.mojang.blaze3d.pipeline.RenderPipeline;
|
||||
import com.mojang.blaze3d.pipeline.RenderTarget;
|
||||
import com.mojang.blaze3d.platform.DepthTestFunction;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.textures.GpuTexture;
|
||||
import com.mojang.blaze3d.vertex.*;
|
||||
import com.mojang.math.Axis;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.MultiBufferSource.BufferSource;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.ShaderDefines;
|
||||
import net.minecraft.client.renderer.SubmitNodeCollector;
|
||||
import net.minecraft.client.renderer.entity.EntityRenderDispatcher;
|
||||
import net.minecraft.client.renderer.item.ItemStackRenderState;
|
||||
import net.minecraft.client.renderer.state.CameraRenderState;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlas;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.HumanoidArm;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.inventory.InventoryMenu;
|
||||
import net.minecraft.world.item.ItemDisplayContext;
|
||||
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.jetbrains.annotations.NotNull;
|
||||
import org.joml.Matrix4f;
|
||||
import tschipp.carryon.Constants;
|
||||
import tschipp.carryon.common.carry.CarryOnData;
|
||||
|
|
@ -62,16 +52,7 @@ import java.util.*;
|
|||
public class CarriedObjectRender
|
||||
{
|
||||
|
||||
private static final 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)
|
||||
public static boolean drawFirstPerson(Player player, PoseStack matrix, int light, float partialTicks,SubmitNodeCollector nodeCollector)
|
||||
{
|
||||
if(Services.PLATFORM.isModLoaded("firstperson") || Services.PLATFORM.isModLoaded("firstpersonmod"))
|
||||
return false;
|
||||
|
|
@ -79,9 +60,9 @@ public class CarriedObjectRender
|
|||
CarryOnData carry = CarryOnDataManager.getCarryData(player);
|
||||
try {
|
||||
if (carry.isCarrying(CarryType.BLOCK))
|
||||
drawFirstPersonBlock(player, buffer, matrix, light, CarryRenderHelper.getRenderState(player));
|
||||
drawFirstPersonBlock(player, matrix, light, CarryRenderHelper.getRenderState(player), nodeCollector);
|
||||
else if (carry.isCarrying(CarryType.ENTITY))
|
||||
drawFirstPersonEntity(player, buffer, matrix, light, partialTicks);
|
||||
drawFirstPersonEntity(player, matrix, light, partialTicks,nodeCollector);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
@ -101,7 +82,7 @@ public class CarriedObjectRender
|
|||
return carry.isCarrying();
|
||||
}
|
||||
|
||||
private static void drawFirstPersonBlock(Player player, MultiBufferSource buffer, PoseStack matrix, int light, BlockState state)
|
||||
private static void drawFirstPersonBlock(Player player, PoseStack matrix, int light, BlockState state,SubmitNodeCollector nodeCollector)
|
||||
{
|
||||
matrix.pushPose();
|
||||
matrix.scale(2.5f, 2.5f, 2.5f);
|
||||
|
|
@ -128,8 +109,8 @@ public class CarriedObjectRender
|
|||
|
||||
ItemStack renderStack = CarryRenderHelper.getRenderItemStack(player);
|
||||
Minecraft.getInstance().getItemModelResolver().updateForTopItem(renderState, renderStack, ItemDisplayContext.NONE, player.level(), null, 0);
|
||||
renderState.render(matrix, buffer, light, OverlayTexture.NO_OVERLAY);
|
||||
|
||||
//renderState.render(matrix, light, OverlayTexture.NO_OVERLAY);
|
||||
renderState.submit(matrix, nodeCollector, light, OverlayTexture.NO_OVERLAY, 0);
|
||||
|
||||
|
||||
//RenderSystem.enableCull();
|
||||
|
|
@ -137,8 +118,10 @@ public class CarriedObjectRender
|
|||
matrix.popPose();
|
||||
}
|
||||
|
||||
private static void drawFirstPersonEntity(Player player, MultiBufferSource buffer, PoseStack matrix, int light, float partialTicks) {
|
||||
private static void drawFirstPersonEntity(Player player, PoseStack matrix, int light, float partialTicks,SubmitNodeCollector nodeCollector) {
|
||||
EntityRenderDispatcher manager = Minecraft.getInstance().getEntityRenderDispatcher();
|
||||
|
||||
|
||||
Entity entity = CarryRenderHelper.getRenderEntity(player);
|
||||
CarryOnData carry = CarryOnDataManager.getCarryData(player);
|
||||
|
||||
|
|
@ -159,7 +142,7 @@ public class CarriedObjectRender
|
|||
matrix.mulPose(Axis.YP.rotationDegrees(180));
|
||||
matrix.translate(0.0, -height - .2, width * 1.3 + 0.1);
|
||||
|
||||
manager.setRenderShadow(false);
|
||||
// manager.setRenderShadow(false);
|
||||
|
||||
Optional<CarryOnScript> res = carry.getActiveScript();
|
||||
if(res.isPresent())
|
||||
|
|
@ -175,12 +158,15 @@ public class CarriedObjectRender
|
|||
((LivingEntity) entity).hurtTime = 0;
|
||||
|
||||
try {
|
||||
manager.render(entity, 0, 0, 0, 0f, matrix, buffer, light);
|
||||
manager.submit(manager.extractEntity(entity, 0), new CameraRenderState(), 0, 0, 0, matrix, nodeCollector);
|
||||
// manager.render(entity, 0, 0, 0, 0f, matrix, buffer, light);
|
||||
//nodeCollector.submit
|
||||
//manager.getRenderer(entity).submit(new EntityRenderState(), matrix, nodeCollector, null);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
manager.setRenderShadow(true);
|
||||
// manager.setRenderShadow(true);
|
||||
matrix.popPose();
|
||||
|
||||
}
|
||||
|
|
@ -193,21 +179,17 @@ public class CarriedObjectRender
|
|||
* @param partialticks
|
||||
* @param mat
|
||||
*/
|
||||
public static void drawThirdPerson(float partialticks, Matrix4f mat) {
|
||||
public static void drawThirdPerson(float partialticks, Matrix4f mat,SubmitNodeCollector nodeCollector) {
|
||||
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();
|
||||
|
||||
BufferSource buffer = MultiBufferSource.immediateWithBuffers(builders, builders.get(RenderType.glint()));
|
||||
// RenderSystem.enableBlend();
|
||||
// RenderSystem.disableCull();
|
||||
// RenderSystem.disableDepthTest();
|
||||
ItemStackRenderState renderState = new ItemStackRenderState();
|
||||
var layer = renderState.newLayer();
|
||||
layer.setRenderType(RenderType.glint());
|
||||
|
|
@ -221,7 +203,6 @@ public class CarriedObjectRender
|
|||
if (perspective == 0 && player == mc.player && !(Services.PLATFORM.isModLoaded("firstperson") || Services.PLATFORM.isModLoaded("firstpersonmod") || Services.PLATFORM.isModLoaded("realcamera")))
|
||||
continue;
|
||||
|
||||
light = manager.getPackedLightCoords(player, partialticks);
|
||||
|
||||
if (carry.isCarrying(CarryType.BLOCK)) {
|
||||
BlockState state = CarryRenderHelper.getRenderState(player);
|
||||
|
|
@ -245,7 +226,9 @@ public class CarriedObjectRender
|
|||
|
||||
//RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
renderState.render(copy, buffer, light, OverlayTexture.NO_OVERLAY);
|
||||
renderState.submit(copy, null, 0, OverlayTexture.NO_OVERLAY, 0);
|
||||
|
||||
// renderState.render(copy, buffer, light, OverlayTexture.NO_OVERLAY);
|
||||
|
||||
matrix.popPose();
|
||||
} else if (carry.isCarrying(CarryType.ENTITY)) {
|
||||
|
|
@ -254,7 +237,7 @@ public class CarriedObjectRender
|
|||
if (entity != null) {
|
||||
CarryRenderHelper.applyEntityTransformations(player, partialticks, matrix, entity);
|
||||
|
||||
manager.setRenderShadow(false);
|
||||
// manager.setRenderShadow(false);
|
||||
|
||||
Optional<CarryOnScript> res = carry.getActiveScript();
|
||||
res.ifPresent(script -> CarryRenderHelper.performScriptTransformation(matrix, script));
|
||||
|
|
@ -264,9 +247,9 @@ public class CarriedObjectRender
|
|||
|
||||
//RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
manager.render(entity, 0, 0, 0, 0f, matrix, buffer, light);
|
||||
// manager.render(entity, 0, 0, 0, 0f, matrix, buffer, light);
|
||||
matrix.popPose();
|
||||
manager.setRenderShadow(true);
|
||||
// manager.setRenderShadow(true);
|
||||
matrix.popPose();
|
||||
}
|
||||
}
|
||||
|
|
@ -278,16 +261,7 @@ public class CarriedObjectRender
|
|||
}
|
||||
|
||||
}
|
||||
buffer.endLastBatch();
|
||||
|
||||
buffer.endBatch(RenderType.entitySolid(TextureAtlas.LOCATION_BLOCKS));
|
||||
buffer.endBatch(RenderType.entityCutout(TextureAtlas.LOCATION_BLOCKS));
|
||||
buffer.endBatch(RenderType.entityCutoutNoCull(TextureAtlas.LOCATION_BLOCKS));
|
||||
buffer.endBatch(RenderType.entitySmoothCutout(TextureAtlas.LOCATION_BLOCKS));
|
||||
|
||||
//RenderSystem.enableDepthTest();
|
||||
//RenderSystem.enableCull();
|
||||
//RenderSystem.disableBlend();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,111 +1,108 @@
|
|||
//package tschipp.carryon.client.render;
|
||||
//
|
||||
//import com.mojang.blaze3d.pipeline.BlendFunction;
|
||||
//import com.mojang.blaze3d.pipeline.RenderPipeline;
|
||||
//import com.mojang.blaze3d.pipeline.RenderTarget;
|
||||
//import com.mojang.blaze3d.platform.DepthTestFunction;
|
||||
//import com.mojang.blaze3d.vertex.MeshData;
|
||||
//import com.mojang.blaze3d.vertex.VertexFormat;
|
||||
//import net.minecraft.client.renderer.RenderType;
|
||||
//import org.jetbrains.annotations.NotNull;
|
||||
//
|
||||
//import java.util.IdentityHashMap;
|
||||
//import java.util.Map;
|
||||
//
|
||||
////Credit: klikli for the idea and code for this wrapper
|
||||
//public class CarryOnRenderType extends RenderType {
|
||||
//
|
||||
// private static final Map<RenderType, RenderType> remappedTypes = new IdentityHashMap<>();
|
||||
// private final RenderPipeline pipeline;
|
||||
// private final RenderType original;
|
||||
//
|
||||
// private CarryOnRenderType(RenderType original, RenderPipeline pipeline) {
|
||||
// super(String.format("%s_carryon", original.toString()), original.bufferSize(), original.affectsCrumbling(), true, original::setupRenderState, original::clearRenderState);
|
||||
// this.pipeline = pipeline;
|
||||
// this.original = original;
|
||||
// }
|
||||
//
|
||||
// public static RenderType remap(RenderType in) {
|
||||
// return remappedTypes.computeIfAbsent(in, (type) -> {
|
||||
//
|
||||
// //modify the pipeline
|
||||
// var pipeline = toBuilder(in.getRenderPipeline())
|
||||
// .withBlend(BlendFunction.TRANSLUCENT)
|
||||
// .withDepthTestFunction(DepthTestFunction.NO_DEPTH_TEST)
|
||||
// .withCull(false);
|
||||
//
|
||||
// return new CarryOnRenderType(type, pipeline.build());
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// private static RenderPipeline.Builder toBuilder(RenderPipeline pipeline) {
|
||||
// RenderPipeline.Builder builder = RenderPipeline.builder();
|
||||
// builder.withLocation(pipeline.getLocation());
|
||||
// builder.withFragmentShader(pipeline.getFragmentShader());
|
||||
// builder.withVertexShader(pipeline.getVertexShader());
|
||||
//
|
||||
// if (!pipeline.getShaderDefines().isEmpty()) {
|
||||
// for (Map.Entry<String, String> entry : pipeline.getShaderDefines().values().entrySet()) {
|
||||
// try {
|
||||
// int parsed = Integer.parseInt(entry.getValue());
|
||||
// builder.withShaderDefine(entry.getKey(), parsed);
|
||||
// } catch (NumberFormatException e) {
|
||||
// float parsed = Float.parseFloat(entry.getValue());
|
||||
// builder.withShaderDefine(entry.getKey(), parsed);
|
||||
// }
|
||||
// }
|
||||
// for (String flag : pipeline.getShaderDefines().flags()) {
|
||||
// builder.withShaderDefine(flag);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (!pipeline.getSamplers().isEmpty()) {
|
||||
// pipeline.getSamplers().forEach(builder::withSampler);
|
||||
// }
|
||||
//
|
||||
// if (!pipeline.getUniforms().isEmpty()) {
|
||||
// pipeline.getUniforms().forEach(u -> builder.withUniform(u.name(), u.type()));
|
||||
// }
|
||||
//
|
||||
// builder.withDepthTestFunction(pipeline.getDepthTestFunction());
|
||||
// builder.withPolygonMode(pipeline.getPolygonMode());
|
||||
// builder.withCull(pipeline.isCull());
|
||||
// builder.withColorWrite(pipeline.isWriteColor(), pipeline.isWriteAlpha());
|
||||
// builder.withDepthWrite(pipeline.isWriteDepth());
|
||||
// builder.withColorLogic(pipeline.getColorLogic());
|
||||
//
|
||||
// if (pipeline.getBlendFunction().isPresent())
|
||||
// builder.withBlend(pipeline.getBlendFunction().get());
|
||||
// else
|
||||
// builder.withoutBlend();
|
||||
// builder.withVertexFormat(pipeline.getVertexFormat(), pipeline.getVertexFormatMode());
|
||||
// builder.withDepthBias(pipeline.getDepthBiasScaleFactor(), pipeline.getDepthBiasConstant());
|
||||
//
|
||||
// return builder;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void draw(@NotNull MeshData meshData) {
|
||||
// this.original.draw(meshData);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public @NotNull RenderTarget getRenderTarget() {
|
||||
// return this.original.getRenderTarget();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public @NotNull RenderPipeline getRenderPipeline() {
|
||||
// return this.pipeline; //get our own modified pipeline
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public @NotNull VertexFormat format() {
|
||||
// return this.original.format();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public VertexFormat.@NotNull Mode mode() {
|
||||
// return this.original.mode();
|
||||
// }
|
||||
//}
|
||||
package tschipp.carryon.client.render;
|
||||
|
||||
import com.mojang.blaze3d.pipeline.BlendFunction;
|
||||
import com.mojang.blaze3d.pipeline.RenderPipeline;
|
||||
import com.mojang.blaze3d.platform.DepthTestFunction;
|
||||
import com.mojang.blaze3d.vertex.MeshData;
|
||||
import com.mojang.blaze3d.vertex.VertexFormat;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
//Credit: klikli for the idea and code for this wrapper
|
||||
public class CarryOnRenderType extends RenderType {
|
||||
|
||||
private static final Map<RenderType, RenderType> remappedTypes = new IdentityHashMap<>();
|
||||
private final RenderPipeline pipeline;
|
||||
private final RenderType original;
|
||||
|
||||
private CarryOnRenderType(RenderType original, RenderPipeline pipeline) {
|
||||
super(String.format("%s_carryon", original.toString()), original.bufferSize(), original.affectsCrumbling(), true, original::setupRenderState, original::clearRenderState);
|
||||
this.pipeline = pipeline;
|
||||
this.original = original;
|
||||
}
|
||||
|
||||
public static RenderType remap(RenderType in) {
|
||||
return remappedTypes.computeIfAbsent(in, (type) -> {
|
||||
|
||||
//modify the pipeline
|
||||
var pipeline = toBuilder(in.pipeline())
|
||||
.withBlend(BlendFunction.TRANSLUCENT)
|
||||
.withDepthTestFunction(DepthTestFunction.NO_DEPTH_TEST)
|
||||
.withCull(false);
|
||||
|
||||
return new CarryOnRenderType(type, pipeline.build());
|
||||
});
|
||||
}
|
||||
|
||||
private static RenderPipeline.Builder toBuilder(RenderPipeline pipeline) {
|
||||
RenderPipeline.Builder builder = RenderPipeline.builder();
|
||||
builder.withLocation(pipeline.getLocation());
|
||||
builder.withFragmentShader(pipeline.getFragmentShader());
|
||||
builder.withVertexShader(pipeline.getVertexShader());
|
||||
|
||||
if (!pipeline.getShaderDefines().isEmpty()) {
|
||||
for (Map.Entry<String, String> entry : pipeline.getShaderDefines().values().entrySet()) {
|
||||
try {
|
||||
int parsed = Integer.parseInt(entry.getValue());
|
||||
builder.withShaderDefine(entry.getKey(), parsed);
|
||||
} catch (NumberFormatException e) {
|
||||
float parsed = Float.parseFloat(entry.getValue());
|
||||
builder.withShaderDefine(entry.getKey(), parsed);
|
||||
}
|
||||
}
|
||||
for (String flag : pipeline.getShaderDefines().flags()) {
|
||||
builder.withShaderDefine(flag);
|
||||
}
|
||||
}
|
||||
|
||||
if (!pipeline.getSamplers().isEmpty()) {
|
||||
pipeline.getSamplers().forEach(builder::withSampler);
|
||||
}
|
||||
|
||||
if (!pipeline.getUniforms().isEmpty()) {
|
||||
pipeline.getUniforms().forEach(u -> builder.withUniform(u.name(), u.type()));
|
||||
}
|
||||
|
||||
builder.withDepthTestFunction(pipeline.getDepthTestFunction());
|
||||
builder.withPolygonMode(pipeline.getPolygonMode());
|
||||
builder.withCull(pipeline.isCull());
|
||||
builder.withColorWrite(pipeline.isWriteColor(), pipeline.isWriteAlpha());
|
||||
builder.withDepthWrite(pipeline.isWriteDepth());
|
||||
builder.withColorLogic(pipeline.getColorLogic());
|
||||
|
||||
if (pipeline.getBlendFunction().isPresent())
|
||||
builder.withBlend(pipeline.getBlendFunction().get());
|
||||
else
|
||||
builder.withoutBlend();
|
||||
builder.withVertexFormat(pipeline.getVertexFormat(), pipeline.getVertexFormatMode());
|
||||
builder.withDepthBias(pipeline.getDepthBiasScaleFactor(), pipeline.getDepthBiasConstant());
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(@NotNull MeshData meshData) {
|
||||
this.original.draw(meshData);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public @NotNull VertexFormat format() {
|
||||
return this.original.format();
|
||||
}
|
||||
|
||||
@Override
|
||||
public VertexFormat.@NotNull Mode mode() {
|
||||
return this.original.mode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderPipeline pipeline() {
|
||||
return this.pipeline; //get our own modified pipeline
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ package tschipp.carryon.common.carry;
|
|||
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.DataResult;
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
|
|
@ -50,7 +49,6 @@ import tschipp.carryon.Constants;
|
|||
import tschipp.carryon.common.scripting.CarryOnScript;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
public class CarryOnData {
|
||||
|
|
|
|||
|
|
@ -20,11 +20,6 @@
|
|||
|
||||
package tschipp.carryon.common.carry;
|
||||
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.syncher.EntityDataAccessor;
|
||||
import net.minecraft.network.syncher.EntityDataSerializers;
|
||||
import net.minecraft.network.syncher.SynchedEntityData;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import tschipp.carryon.platform.Services;
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,6 @@ import tschipp.carryon.common.pickupcondition.PickupConditionHandler;
|
|||
import tschipp.carryon.common.scripting.CarryOnScript;
|
||||
import tschipp.carryon.common.scripting.ScriptManager;
|
||||
import tschipp.carryon.networking.clientbound.ClientboundStartRidingOtherPlayerPacket;
|
||||
import tschipp.carryon.networking.clientbound.ClientboundStartRidingPacket;
|
||||
import tschipp.carryon.platform.Services;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
|
@ -142,7 +141,7 @@ public class PickupHandler {
|
|||
|
||||
String cmd = script.scriptEffects().commandInit();
|
||||
if(!cmd.isEmpty())
|
||||
player.getServer().getCommands().performPrefixedCommand(player.getServer().createCommandSourceStack(), "/execute as " + player.getGameProfile().getName() + " run " + cmd);
|
||||
player.level().getServer().getCommands().performPrefixedCommand(player.level().getServer().createCommandSourceStack(), "/execute as " + player.getGameProfile().name() + " run " + cmd);
|
||||
}
|
||||
|
||||
carry.setBlock(state, blockEntity, player, pos);
|
||||
|
|
@ -174,7 +173,7 @@ public class PickupHandler {
|
|||
if (entity instanceof TamableAnimal tame)
|
||||
{
|
||||
UUID owner = tame.getOwnerReference().getUUID();
|
||||
UUID playerID = player.getGameProfile().getId();
|
||||
UUID playerID = player.getGameProfile().id();
|
||||
if (owner != null && !owner.equals(playerID))
|
||||
return false;
|
||||
}
|
||||
|
|
@ -232,10 +231,10 @@ public class PickupHandler {
|
|||
if (result.isPresent()) {
|
||||
String cmd = result.get().scriptEffects().commandInit();
|
||||
if (!cmd.isEmpty())
|
||||
player.getServer().getCommands().performPrefixedCommand(player.getServer().createCommandSourceStack(), "/execute as " + player.getGameProfile().getName() + " run " + cmd);
|
||||
player.level().getServer().getCommands().performPrefixedCommand(player.level().getServer().createCommandSourceStack(), "/execute as " + player.getGameProfile().name() + " run " + cmd);
|
||||
}
|
||||
|
||||
otherPlayer.startRiding(player, true);
|
||||
otherPlayer.startRiding(player, true,true);
|
||||
Services.PLATFORM.sendPacketToAllPlayers(Constants.PACKET_ID_START_RIDING_OTHER, new ClientboundStartRidingOtherPlayerPacket(player.getId(), otherPlayer.getId(), true), player.level());
|
||||
carry.setCarryingPlayer();
|
||||
player.swing(InteractionHand.MAIN_HAND, true);
|
||||
|
|
@ -257,7 +256,7 @@ public class PickupHandler {
|
|||
{
|
||||
String cmd = result.get().scriptEffects().commandInit();
|
||||
if(!cmd.isEmpty())
|
||||
player.getServer().getCommands().performPrefixedCommand(player.getServer().createCommandSourceStack(), "/execute as " + player.getGameProfile().getName() + " run " + cmd);
|
||||
player.level().getServer().getCommands().performPrefixedCommand(player.level().getServer().createCommandSourceStack(), "/execute as " + player.getGameProfile().name() + " run " + cmd);
|
||||
}
|
||||
|
||||
carry.setEntity(entity);
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ import net.minecraft.server.level.ServerPlayer;
|
|||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.Mob;
|
||||
|
|
@ -44,7 +43,6 @@ import net.minecraft.world.level.block.state.properties.Property;
|
|||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
import tschipp.carryon.CarryOnCommon;
|
||||
import tschipp.carryon.Constants;
|
||||
import tschipp.carryon.common.carry.CarryOnData.CarryType;
|
||||
import tschipp.carryon.common.config.ListHandler;
|
||||
|
|
@ -99,7 +97,7 @@ public class PlacementHandler
|
|||
ScriptEffects effects = carry.getActiveScript().get().scriptEffects();
|
||||
String cmd = effects.commandPlace();
|
||||
if (!cmd.isEmpty())
|
||||
player.getServer().getCommands().performPrefixedCommand(player.getServer().createCommandSourceStack(), "/execute as " + player.getGameProfile().getName() + " run " + cmd);
|
||||
player.level().getServer().getCommands().performPrefixedCommand(player.level().getServer().createCommandSourceStack(), "/execute as " + player.getGameProfile().name() + " run " + cmd);
|
||||
}
|
||||
|
||||
level.setBlockAndUpdate(pos, state);
|
||||
|
|
@ -199,7 +197,7 @@ public class PlacementHandler
|
|||
ScriptEffects effects = carry.getActiveScript().get().scriptEffects();
|
||||
String cmd = effects.commandPlace();
|
||||
if (!cmd.isEmpty())
|
||||
player.getServer().getCommands().performPrefixedCommand(player.getServer().createCommandSourceStack(), "/execute as " + player.getGameProfile().getName() + " run " + cmd);
|
||||
player.level().getServer().getCommands().performPrefixedCommand(player.level().getServer().createCommandSourceStack(), "/execute as " + player.getGameProfile().name() + " run " + cmd);
|
||||
}
|
||||
|
||||
level.addFreshEntity(entity);
|
||||
|
|
@ -257,20 +255,20 @@ public class PlacementHandler
|
|||
level.addFreshEntity(entityHeld);
|
||||
entityHeld.teleportTo(tempX, tempY, tempZ);
|
||||
}
|
||||
entityHeld.startRiding(topEntity, false);
|
||||
entityHeld.startRiding(topEntity, false,false);
|
||||
} else {
|
||||
if (carry.isCarrying(CarryType.ENTITY)) {
|
||||
entityHeld.setPos(entityClicked.getX(), entityClicked.getY(), entityClicked.getZ());
|
||||
level.addFreshEntity(entityHeld);
|
||||
}
|
||||
entityHeld.startRiding(topEntity, false);
|
||||
entityHeld.startRiding(topEntity, false,false);
|
||||
}
|
||||
|
||||
if (carry.getActiveScript().isPresent()) {
|
||||
ScriptEffects effects = carry.getActiveScript().get().scriptEffects();
|
||||
String cmd = effects.commandPlace();
|
||||
if (!cmd.isEmpty())
|
||||
player.getServer().getCommands().performPrefixedCommand(player.getServer().createCommandSourceStack(), "/execute as " + player.getGameProfile().getName() + " run " + cmd);
|
||||
player.level().getServer().getCommands().performPrefixedCommand(player.level().getServer().createCommandSourceStack(), "/execute as " + player.getGameProfile().name() + " run " + cmd);
|
||||
}
|
||||
|
||||
player.swing(InteractionHand.MAIN_HAND, true);
|
||||
|
|
|
|||
|
|
@ -22,10 +22,8 @@ package tschipp.carryon.common.scripting;
|
|||
|
||||
import com.mojang.serialization.Codec;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||
import net.minecraft.advancements.Advancement;
|
||||
import net.minecraft.advancements.AdvancementHolder;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtUtils;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
|
@ -34,7 +32,6 @@ import net.minecraft.server.level.ServerPlayer;
|
|||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraft.world.scores.Objective;
|
||||
import net.minecraft.world.scores.Score;
|
||||
import net.minecraft.world.scores.Scoreboard;
|
||||
import tschipp.carryon.platform.Services;
|
||||
|
||||
|
|
@ -127,7 +124,7 @@ public final class Matchables
|
|||
@Override
|
||||
public boolean matches(ServerPlayer player)
|
||||
{
|
||||
ServerAdvancementManager manager = player.getServer().getAdvancements();
|
||||
ServerAdvancementManager manager = player.level().getServer().getAdvancements();
|
||||
AdvancementHolder adv = manager.get(ResourceLocation.parse(advancement.isEmpty() ? "" : advancement));
|
||||
|
||||
boolean achievement = adv == null ? true : player.getAdvancements().getOrStartProgress(adv).isDone();
|
||||
|
|
@ -167,7 +164,7 @@ public final class Matchables
|
|||
if (cond == null || cond.isEmpty())
|
||||
return true;
|
||||
|
||||
Scoreboard score = player.getScoreboard();
|
||||
Scoreboard score = player.level().getScoreboard();
|
||||
String numb;
|
||||
String scorename;
|
||||
int iE = cond.indexOf("=");
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ package tschipp.carryon.common.scripting;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.util.ProblemReporter;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
|
|
|
|||
|
|
@ -20,13 +20,8 @@
|
|||
|
||||
package tschipp.carryon.common.scripting;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.DataResult;
|
||||
import com.mojang.serialization.JsonOps;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtOps;
|
||||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.resources.FileToIdConverter;
|
||||
|
|
@ -37,11 +32,9 @@ import net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener;
|
|||
import net.minecraft.util.profiling.ProfilerFiller;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import tschipp.carryon.Constants;
|
||||
import tschipp.carryon.common.carry.CarryOnData;
|
||||
import tschipp.carryon.networking.clientbound.ClientboundSyncScriptsPacket;
|
||||
import tschipp.carryon.platform.Services;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
public class ScriptReloadListener extends SimpleJsonResourceReloadListener<CarryOnScript>
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@
|
|||
|
||||
package tschipp.carryon.mixin;
|
||||
|
||||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
|
|
@ -50,12 +49,6 @@ public abstract class EntityMixin
|
|||
|
||||
@Shadow public abstract void onPassengerTurned(Entity $$0);
|
||||
|
||||
@ModifyExpressionValue(method = "startRiding(Lnet/minecraft/world/entity/Entity;Z)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/EntityType;canSerialize()Z"))
|
||||
private boolean onStartRidingCheck(boolean original, Entity entity, boolean force) {
|
||||
if (force && entity instanceof Player) return true;
|
||||
return original;
|
||||
}
|
||||
|
||||
@Inject(method = "positionRider(Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/entity/Entity$MoveFunction;)V", at = @At("HEAD"), cancellable = true)
|
||||
private void onPositionPassenger(Entity entity, MoveFunction move, CallbackInfo ci)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ package tschipp.carryon.mixin;
|
|||
import net.minecraft.client.model.HumanoidModel;
|
||||
import net.minecraft.client.model.geom.ModelPart;
|
||||
import net.minecraft.client.renderer.entity.state.HumanoidRenderState;
|
||||
import net.minecraft.client.renderer.entity.state.PlayerRenderState;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ package tschipp.carryon.mixin;
|
|||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
|
||||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
||||
import net.minecraft.core.NonNullList;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
|
@ -33,7 +32,6 @@ import org.spongepowered.asm.mixin.Shadow;
|
|||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import tschipp.carryon.common.carry.CarryOnData;
|
||||
import tschipp.carryon.common.carry.CarryOnDataManager;
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ import net.minecraft.client.Minecraft;
|
|||
import net.minecraft.world.entity.player.Inventory;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import tschipp.carryon.common.carry.CarryOnDataManager;
|
||||
|
||||
@Mixin(Minecraft.class)
|
||||
|
|
|
|||
|
|
@ -21,20 +21,12 @@
|
|||
package tschipp.carryon.mixin;
|
||||
|
||||
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.syncher.EntityDataAccessor;
|
||||
import net.minecraft.network.syncher.EntityDataSerializers;
|
||||
import net.minecraft.network.syncher.SynchedEntityData;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.storage.ValueInput;
|
||||
import net.minecraft.world.level.storage.ValueOutput;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
package tschipp.carryon.mixin;
|
||||
|
||||
import net.minecraft.client.renderer.entity.state.PlayerRenderState;
|
||||
import net.minecraft.client.renderer.entity.state.HumanoidRenderState;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import tschipp.carryon.client.render.ICarryOnRenderState;
|
||||
import tschipp.carryon.common.carry.CarryOnData;
|
||||
|
||||
@Mixin(PlayerRenderState.class)
|
||||
@Mixin(HumanoidRenderState.class)
|
||||
public class PlayerRenderStateMixin implements ICarryOnRenderState {
|
||||
|
||||
@Unique
|
||||
|
|
|
|||
|
|
@ -20,12 +20,7 @@
|
|||
|
||||
package tschipp.carryon.networking;
|
||||
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||
import net.minecraft.network.codec.StreamCodec;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
|
||||
public interface PacketBase extends CustomPacketPayload {
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public record ClientboundStartRidingOtherPlayerPacket(int mount, int rider, bool
|
|||
|
||||
if(mount != null && rider != null)
|
||||
if(ride)
|
||||
rider.startRiding(mount, true);
|
||||
rider.startRiding(mount, true,true);
|
||||
else
|
||||
rider.stopRiding();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,12 +20,10 @@
|
|||
|
||||
package tschipp.carryon.networking.clientbound;
|
||||
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||
import net.minecraft.network.codec.ByteBufCodecs;
|
||||
import net.minecraft.network.codec.StreamCodec;
|
||||
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import tschipp.carryon.Constants;
|
||||
|
|
|
|||
|
|
@ -22,16 +22,12 @@ package tschipp.carryon.networking.clientbound;
|
|||
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.DataResult;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtOps;
|
||||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||
import net.minecraft.network.codec.ByteBufCodecs;
|
||||
import net.minecraft.network.codec.StreamCodec;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import tschipp.carryon.Constants;
|
||||
import tschipp.carryon.common.scripting.CarryOnScript;
|
||||
|
|
|
|||
|
|
@ -20,20 +20,15 @@
|
|||
|
||||
package tschipp.carryon.networking.serverbound;
|
||||
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||
import net.minecraft.network.codec.ByteBufCodecs;
|
||||
import net.minecraft.network.codec.StreamCodec;
|
||||
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import tschipp.carryon.Constants;
|
||||
import tschipp.carryon.common.carry.CarryOnData;
|
||||
import tschipp.carryon.common.carry.CarryOnDataManager;
|
||||
import tschipp.carryon.networking.PacketBase;
|
||||
import tschipp.carryon.networking.clientbound.ClientboundStartRidingPacket;
|
||||
import tschipp.carryon.networking.clientbound.ClientboundSyncScriptsPacket;
|
||||
|
||||
public record ServerboundCarryKeyPressedPacket(boolean pressed) implements PacketBase
|
||||
{
|
||||
|
|
|
|||
|
|
@ -20,9 +20,7 @@
|
|||
|
||||
package tschipp.carryon.platform.services;
|
||||
|
||||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||
import net.minecraft.network.codec.StreamCodec;
|
||||
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
|
@ -30,12 +28,10 @@ import net.minecraft.server.level.ServerLevel;
|
|||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import tschipp.carryon.common.carry.CarryOnData;
|
||||
import tschipp.carryon.common.carry.CarryOnDataManager;
|
||||
import tschipp.carryon.config.BuiltConfig;
|
||||
import tschipp.carryon.networking.PacketBase;
|
||||
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
public interface IPlatformHelper {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
plugins {
|
||||
id 'multiloader-loader'
|
||||
id 'fabric-loom' version '1.10-SNAPSHOT'
|
||||
id 'fabric-loom' version "${loom_version}"
|
||||
}
|
||||
|
||||
repositories {
|
||||
|
|
@ -32,7 +32,7 @@ dependencies {
|
|||
modApi("me.shedaniel.cloth:cloth-config-fabric:${cloth_config_version}") {
|
||||
exclude(group: "net.fabricmc.fabric-api")
|
||||
}
|
||||
modApi "com.terraformersmc:modmenu:15.0.0-beta.3"
|
||||
modApi "com.terraformersmc:modmenu:16.0.0-rc.1"
|
||||
}
|
||||
|
||||
loom {
|
||||
|
|
|
|||
|
|
@ -23,20 +23,13 @@ package tschipp.carryon;
|
|||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
|
||||
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
|
||||
import net.fabricmc.fabric.api.networking.v1.PacketByteBufs;
|
||||
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import tschipp.carryon.client.keybinds.CarryOnKeybinds;
|
||||
import tschipp.carryon.events.ClientEvents;
|
||||
import tschipp.carryon.networking.PacketBase;
|
||||
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class CarryOnFabricClientMod implements ClientModInitializer
|
||||
{
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ package tschipp.carryon;
|
|||
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import net.fabricmc.fabric.api.attachment.v1.AttachmentRegistry;
|
||||
import net.fabricmc.fabric.api.attachment.v1.AttachmentSyncPredicate;
|
||||
import net.fabricmc.fabric.api.attachment.v1.AttachmentType;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@
|
|||
|
||||
package tschipp.carryon.compat;
|
||||
|
||||
import net.fabricmc.fabric.api.event.Event;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
|
|
|
|||
|
|
@ -20,11 +20,8 @@
|
|||
|
||||
package tschipp.carryon.events;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents;
|
||||
import tschipp.carryon.CarryOnCommonClient;
|
||||
import tschipp.carryon.client.render.CarriedObjectRender;
|
||||
|
||||
public class ClientEvents {
|
||||
|
||||
|
|
@ -34,10 +31,6 @@ public class ClientEvents {
|
|||
CarryOnCommonClient.checkForKeybinds();
|
||||
CarryOnCommonClient.onCarryClientTick();
|
||||
});
|
||||
|
||||
WorldRenderEvents.LAST.register(event -> {
|
||||
CarriedObjectRender.drawThirdPerson(event.tickCounter().getGameTimeDeltaPartialTick(true), new PoseStack().last().pose());
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public class CommonEvents {
|
|||
|
||||
UseBlockCallback.EVENT.register((player, world, hand, hitResult) -> {
|
||||
|
||||
if(world.isClientSide)
|
||||
if(world.isClientSide())
|
||||
return InteractionResult.PASS;
|
||||
|
||||
BlockPos pos = hitResult.getBlockPos();
|
||||
|
|
@ -96,7 +96,7 @@ public class CommonEvents {
|
|||
|
||||
UseEntityCallback.EVENT.register((player, level, hand, entity, hitResult) -> {
|
||||
|
||||
if(level.isClientSide)
|
||||
if(level.isClientSide())
|
||||
return InteractionResult.PASS;
|
||||
|
||||
CarryOnData carry = CarryOnDataManager.getCarryData(player);
|
||||
|
|
|
|||
|
|
@ -21,31 +21,24 @@
|
|||
package tschipp.carryon.mixin;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.player.AbstractClientPlayer;
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
import net.minecraft.client.renderer.ItemInHandRenderer;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.RenderBuffers;
|
||||
import net.minecraft.client.renderer.SubmitNodeCollector;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
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.CarriedObjectRender;
|
||||
import tschipp.carryon.client.render.CarryRenderHelper;
|
||||
import tschipp.carryon.platform.Services;
|
||||
|
||||
@Mixin(ItemInHandRenderer.class)
|
||||
public class ItemInHandRendererMixin
|
||||
{
|
||||
@Inject(at = @At(value = "HEAD"), method = "renderArmWithItem(Lnet/minecraft/client/player/AbstractClientPlayer;FFLnet/minecraft/world/InteractionHand;FLnet/minecraft/world/item/ItemStack;FLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;I)V", cancellable = true)
|
||||
private void onRenderHand(AbstractClientPlayer player, float partialTicks, float pitch, InteractionHand hand, float pSwingProgress, ItemStack pStack, float pEquippedProgress, PoseStack poseStack, MultiBufferSource buffer, int light, CallbackInfo ci)
|
||||
@Inject(at = @At(value = "HEAD"), method = "renderArmWithItem(Lnet/minecraft/client/player/AbstractClientPlayer;FFLnet/minecraft/world/InteractionHand;FLnet/minecraft/world/item/ItemStack;FLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/SubmitNodeCollector;I)V", cancellable = true)
|
||||
private void renderArmWithItem(AbstractClientPlayer player, float partialTick, float pitch, InteractionHand hand, float swingProgress, ItemStack item, float equippedProgress, PoseStack poseStack, SubmitNodeCollector nodeCollector, int packedLight, CallbackInfo ci)
|
||||
{
|
||||
if(CarryRenderHelper.getPerspective() == 0 && CarriedObjectRender.drawFirstPerson(player, buffer, poseStack, light, partialTicks))
|
||||
if(CarriedObjectRender.drawFirstPerson(player, poseStack, packedLight, partialTick,nodeCollector))
|
||||
ci.cancel();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,17 +20,12 @@
|
|||
|
||||
package tschipp.carryon.platform;
|
||||
|
||||
import net.fabricmc.fabric.api.networking.v1.PacketByteBufs;
|
||||
import net.fabricmc.fabric.api.networking.v1.PayloadTypeRegistry;
|
||||
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
|
||||
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking.PlayPayloadHandler;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||
import net.minecraft.network.codec.StreamCodec;
|
||||
import net.minecraft.network.codec.StreamDecoder;
|
||||
import net.minecraft.network.codec.StreamMemberEncoder;
|
||||
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
|
@ -44,7 +39,6 @@ import tschipp.carryon.networking.PacketBase;
|
|||
import tschipp.carryon.platform.services.IPlatformHelper;
|
||||
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class FabricPlatformHelper implements IPlatformHelper {
|
||||
|
||||
|
|
|
|||
|
|
@ -23,14 +23,12 @@ package tschipp.carryon.events;
|
|||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.SubmitNodeCollector;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.event.RenderHandEvent;
|
||||
import net.minecraftforge.client.event.ScreenEvent;
|
||||
import net.minecraftforge.event.TickEvent.ClientTickEvent;
|
||||
import net.minecraftforge.event.TickEvent.Phase;
|
||||
import net.minecraftforge.eventbus.api.listener.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import tschipp.carryon.CarryOnCommonClient;
|
||||
|
|
@ -47,13 +45,12 @@ public class ClientEvents {
|
|||
public static boolean renderHand(RenderHandEvent event)
|
||||
{
|
||||
Player player = Minecraft.getInstance().player;
|
||||
MultiBufferSource buffer = event.getMultiBufferSource();
|
||||
PoseStack matrix = event.getPoseStack();
|
||||
int light = event.getPackedLight();
|
||||
float partialTicks = event.getPartialTick();
|
||||
|
||||
SubmitNodeCollector nodes =event.getNodeCollector();
|
||||
//If true, cancels event
|
||||
return CarriedObjectRender.drawFirstPerson(player, buffer, matrix, light, partialTicks) && CarryRenderHelper.getPerspective() == 0;
|
||||
return CarriedObjectRender.drawFirstPerson(player, matrix, light, partialTicks,nodes) && CarryRenderHelper.getPerspective() == 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ neoForge {
|
|||
|
||||
|
||||
dependencies {
|
||||
api "me.shedaniel.cloth:cloth-config-neoforge:${cloth_config_version}"
|
||||
compileOnly "me.shedaniel.cloth:cloth-config-neoforge:${cloth_config_version}"
|
||||
}
|
||||
|
||||
sourceSets.main.resources { srcDir 'src/generated/resources' }
|
||||
|
|
|
|||
|
|
@ -21,14 +21,10 @@
|
|||
package tschipp.carryon;
|
||||
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
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.attachment.AttachmentType;
|
||||
import net.neoforged.neoforge.client.gui.ConfigurationScreen;
|
||||
import net.neoforged.neoforge.common.NeoForge;
|
||||
import net.neoforged.neoforge.network.event.RegisterPayloadHandlersEvent;
|
||||
import net.neoforged.neoforge.network.registration.PayloadRegistrar;
|
||||
import net.neoforged.neoforge.registries.DeferredRegister;
|
||||
|
|
|
|||
|
|
@ -1,18 +1,11 @@
|
|||
package tschipp.carryon.compat;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.neoforged.fml.ModContainer;
|
||||
import net.neoforged.neoforge.client.gui.IConfigScreenFactory;
|
||||
import tschipp.carryon.config.AnnotationData;
|
||||
import tschipp.carryon.config.BuiltCategory;
|
||||
import tschipp.carryon.config.BuiltConfig;
|
||||
import tschipp.carryon.config.neoforge.ConfigLoaderImpl;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public record ClothConfigCompatNeo(BuiltConfig client, BuiltConfig common) implements IConfigScreenFactory {
|
||||
|
||||
|
|
|
|||
|
|
@ -22,25 +22,16 @@ 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.ModContainer;
|
||||
import net.neoforged.fml.ModLoadingContext;
|
||||
import net.neoforged.fml.common.EventBusSubscriber;
|
||||
import net.neoforged.fml.common.Mod;
|
||||
import net.neoforged.fml.config.IConfigSpec;
|
||||
import net.neoforged.fml.config.ModConfig;
|
||||
import net.neoforged.fml.event.config.ModConfigEvent;
|
||||
import net.neoforged.neoforge.common.ModConfigSpec;
|
||||
import net.neoforged.neoforge.common.NeoForge;
|
||||
import net.neoforged.neoforge.server.ServerLifecycleHooks;
|
||||
import tschipp.carryon.Constants;
|
||||
import tschipp.carryon.config.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@EventBusSubscriber(modid = Constants.MOD_ID)
|
||||
public class ConfigLoaderImpl {
|
||||
|
|
|
|||
|
|
@ -23,12 +23,11 @@ package tschipp.carryon.events;
|
|||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.SubmitNodeCollector;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.bus.api.SubscribeEvent;
|
||||
import net.neoforged.fml.common.EventBusSubscriber;
|
||||
import net.neoforged.fml.common.Mod;
|
||||
import net.neoforged.neoforge.client.event.ClientTickEvent;
|
||||
import net.neoforged.neoforge.client.event.RenderHandEvent;
|
||||
import net.neoforged.neoforge.client.event.RenderLevelStageEvent;
|
||||
|
|
@ -47,19 +46,19 @@ public class ClientEvents {
|
|||
public static void renderHand(RenderHandEvent event)
|
||||
{
|
||||
Player player = Minecraft.getInstance().player;
|
||||
MultiBufferSource buffer = event.getMultiBufferSource();
|
||||
PoseStack matrix = event.getPoseStack();
|
||||
int light = event.getPackedLight();
|
||||
float partialTicks = event.getPartialTick();
|
||||
SubmitNodeCollector nodes =event.getSubmitNodeCollector();
|
||||
|
||||
if(CarriedObjectRender.drawFirstPerson(player, buffer, matrix, light, partialTicks) && CarryRenderHelper.getPerspective() == 0)
|
||||
if(CarriedObjectRender.drawFirstPerson(player, matrix, light, partialTicks,nodes) && CarryRenderHelper.getPerspective() == 0)
|
||||
event.setCanceled(true);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onRenderLevel(RenderLevelStageEvent.AfterParticles event)
|
||||
public static void onRenderLevel(RenderLevelStageEvent.AfterEntities event)
|
||||
{
|
||||
CarriedObjectRender.drawThirdPerson(event.getPartialTick().getGameTimeDeltaPartialTick(true), event.getPoseStack().last().pose());
|
||||
CarriedObjectRender.drawThirdPerson(event.getLevelRenderer().getTicks(), event.getPoseStack().last().pose());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
|
|
|||
|
|
@ -31,11 +31,9 @@ import net.minecraft.world.entity.Mob;
|
|||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.ServerLevelAccessor;
|
||||
import net.neoforged.bus.api.Event;
|
||||
import net.neoforged.bus.api.EventPriority;
|
||||
import net.neoforged.bus.api.SubscribeEvent;
|
||||
import net.neoforged.fml.common.EventBusSubscriber;
|
||||
import net.neoforged.fml.common.Mod;
|
||||
import net.neoforged.neoforge.common.NeoForge;
|
||||
import net.neoforged.neoforge.common.util.BlockSnapshot;
|
||||
import net.neoforged.neoforge.event.*;
|
||||
|
|
@ -68,7 +66,7 @@ public class CommonEvents
|
|||
Level level = event.getLevel();
|
||||
BlockPos pos = event.getPos();
|
||||
|
||||
if (level.isClientSide)
|
||||
if (level.isClientSide())
|
||||
return;
|
||||
|
||||
boolean success = false;
|
||||
|
|
@ -122,7 +120,7 @@ public class CommonEvents
|
|||
Level level = event.getLevel();
|
||||
Entity target = event.getTarget();
|
||||
|
||||
if (level.isClientSide)
|
||||
if (level.isClientSide())
|
||||
return;
|
||||
|
||||
CarryOnData carry = CarryOnDataManager.getCarryData(player);
|
||||
|
|
@ -180,7 +178,7 @@ public class CommonEvents
|
|||
@SubscribeEvent
|
||||
public static void onClone(PlayerEvent.Clone event)
|
||||
{
|
||||
if (!event.getOriginal().level().isClientSide)
|
||||
if (!event.getOriginal().level().isClientSide())
|
||||
PlacementHandler.placeCarriedOnDeath((ServerPlayer) event.getOriginal(), (ServerPlayer) event.getEntity(), event.isWasDeath());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,10 +24,8 @@ import net.neoforged.bus.api.EventPriority;
|
|||
import net.neoforged.bus.api.SubscribeEvent;
|
||||
import net.neoforged.fml.InterModComms;
|
||||
import net.neoforged.fml.common.EventBusSubscriber;
|
||||
import net.neoforged.fml.common.Mod;
|
||||
import net.neoforged.fml.event.lifecycle.InterModProcessEvent;
|
||||
import tschipp.carryon.Constants;
|
||||
import tschipp.carryon.client.modeloverride.ModelOverrideHandler;
|
||||
import tschipp.carryon.common.config.ListHandler;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
|
|
|||
|
|
@ -21,10 +21,8 @@
|
|||
package tschipp.carryon.events;
|
||||
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.api.distmarker.OnlyIn;
|
||||
import net.neoforged.bus.api.SubscribeEvent;
|
||||
import net.neoforged.fml.common.EventBusSubscriber;
|
||||
import net.neoforged.fml.common.Mod;
|
||||
import net.neoforged.neoforge.client.event.RegisterKeyMappingsEvent;
|
||||
import tschipp.carryon.Constants;
|
||||
import tschipp.carryon.client.keybinds.CarryOnKeybinds;
|
||||
|
|
|
|||
|
|
@ -20,12 +20,10 @@
|
|||
|
||||
package tschipp.carryon.platform;
|
||||
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||
import net.minecraft.network.codec.StreamCodec;
|
||||
import net.minecraft.network.codec.StreamDecoder;
|
||||
import net.minecraft.network.codec.StreamMemberEncoder;
|
||||
|
||||
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
|
@ -45,7 +43,6 @@ import tschipp.carryon.networking.PacketBase;
|
|||
import tschipp.carryon.platform.services.IPlatformHelper;
|
||||
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class NeoForgePlatformHelper implements IPlatformHelper {
|
||||
|
||||
|
|
@ -64,7 +61,7 @@ public class NeoForgePlatformHelper implements IPlatformHelper {
|
|||
@Override
|
||||
public boolean isDevelopmentEnvironment() {
|
||||
|
||||
return !FMLLoader.isProduction();
|
||||
return !FMLLoader.getCurrent().isProduction();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
plugins {
|
||||
// see https://fabricmc.net/develop/ for new versions
|
||||
id 'fabric-loom' version '1.10-SNAPSHOT' apply false
|
||||
id 'fabric-loom' version "${loom_version}" apply false
|
||||
// see https://projects.neoforged.net/neoforged/moddevgradle for new versions
|
||||
id 'net.neoforged.moddev' version "${mod_dev_version}" apply false
|
||||
}
|
||||
|
|
@ -3,34 +3,35 @@ version=2.7.0
|
|||
group=tschipp.carryon
|
||||
|
||||
# Common
|
||||
minecraft_version=1.21.8
|
||||
minecraft_version=1.21.9
|
||||
mod_name=Carry On
|
||||
mod_author=Tschipp, PurpliciousCow
|
||||
mod_id=carryon
|
||||
license=GNU LGPLv3
|
||||
credits=
|
||||
description=Carry On is a simple mod that improves game interaction by allowing players to pick up, carry, and place single block Tile Entities using only their empty hands.
|
||||
minecraft_version_range=[1.21.8, 1.22)
|
||||
neo_form_version=1.21.8-20250717.133445
|
||||
minecraft_version_range=[1.21.9, 1.22)
|
||||
neo_form_version=1.21.9-20250930.151910
|
||||
java_version=21
|
||||
parchment_version=2025.07.20
|
||||
parchment_version=2025.10.05
|
||||
mod_dev_version=2.0.107
|
||||
# Forge
|
||||
forge_version=58.0.10
|
||||
forge_loader_version_range=[57,)
|
||||
parchment_mappings=2025.07.20-1.21.8
|
||||
forge_version=59.0.5
|
||||
forge_loader_version_range=[59,)
|
||||
parchment_mappings=2025.10.05-1.21.9
|
||||
//forge_ats_enabled=true
|
||||
|
||||
# Fabric
|
||||
fabric_version=0.132.0+1.21.8
|
||||
fabric_loader_version=0.17.2
|
||||
parchment_mappings_fabric=1.21.8:2025.07.20
|
||||
fabric_version=0.134.0+1.21.9
|
||||
fabric_loader_version=0.17.3
|
||||
parchment_mappings_fabric=1.21.9:2025.10.05
|
||||
loom_version=1.11-SNAPSHOT
|
||||
|
||||
# Neoforge
|
||||
neoforge_version=21.8.36
|
||||
neoforge_version=21.9.16-beta
|
||||
neoforge_loader_version_range=[4,)
|
||||
neogradle.subsystems.parchment.minecraftVersion=1.21.8
|
||||
neogradle.subsystems.parchment.mappingsVersion=2025.07.20
|
||||
neogradle.subsystems.parchment.minecraftVersion=1.21.9
|
||||
neogradle.subsystems.parchment.mappingsVersion=2025.10.05
|
||||
|
||||
|
||||
# Gradle
|
||||
|
|
@ -38,4 +39,4 @@ org.gradle.jvmargs=-Xmx3G
|
|||
org.gradle.daemon=false
|
||||
|
||||
mixinextras_version=0.3.6
|
||||
cloth_config_version=19.0.147
|
||||
cloth_config_version=20.0.148
|
||||
|
|
@ -12,6 +12,7 @@ pluginManagement {
|
|||
}
|
||||
filter {
|
||||
includeGroup('net.fabricmc')
|
||||
includeGroup('net.fabricmc.unpick')
|
||||
includeGroup('fabric-loom')
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user