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.RegistryAccess;
|
||||||
import net.minecraft.core.RegistrySetBuilder;
|
import net.minecraft.core.RegistrySetBuilder;
|
||||||
import net.minecraft.core.registries.BuiltInRegistries;
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
import net.minecraft.core.registries.Registries;
|
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
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.Entity;
|
||||||
import net.minecraft.world.entity.player.Inventory;
|
import net.minecraft.world.entity.player.Inventory;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
|
@ -108,6 +105,7 @@ public class CarryOnCommon
|
||||||
|
|
||||||
public static void onCarryTick(ServerPlayer player)
|
public static void onCarryTick(ServerPlayer player)
|
||||||
{
|
{
|
||||||
|
|
||||||
CarryOnData carry = CarryOnDataManager.getCarryData(player);
|
CarryOnData carry = CarryOnDataManager.getCarryData(player);
|
||||||
if(carry.isCarrying())
|
if(carry.isCarrying())
|
||||||
{
|
{
|
||||||
|
|
@ -115,7 +113,7 @@ public class CarryOnCommon
|
||||||
{
|
{
|
||||||
String cmd = carry.getActiveScript().get().scriptEffects().commandLoop();
|
String cmd = carry.getActiveScript().get().scriptEffects().commandLoop();
|
||||||
if(!cmd.isEmpty())
|
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();
|
Inventory inv = player.getInventory();
|
||||||
|
|
@ -153,7 +151,7 @@ public class CarryOnCommon
|
||||||
|
|
||||||
public static void onPlayerAttacked(Player player)
|
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);
|
CarryOnData carry = CarryOnDataManager.getCarryData(player);
|
||||||
if (carry.isCarrying())
|
if (carry.isCarrying())
|
||||||
|
|
|
||||||
|
|
@ -34,11 +34,11 @@ public class CarryOnCommonClient
|
||||||
Player player = mc.player;
|
Player player = mc.player;
|
||||||
if(player != null) {
|
if(player != null) {
|
||||||
CarryOnData carry = CarryOnDataManager.getCarryData(player);
|
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);
|
CarryOnKeybinds.onCarryKey(true);
|
||||||
carry.setKeyPressed(true);
|
carry.setKeyPressed(true);
|
||||||
CarryOnDataManager.setCarryData(player, carry);
|
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);
|
CarryOnKeybinds.onCarryKey(false);
|
||||||
carry.setKeyPressed(false);
|
carry.setKeyPressed(false);
|
||||||
CarryOnDataManager.setCarryData(player, carry);
|
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()
|
public static void onCarryClientTick()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -22,11 +22,13 @@ package tschipp.carryon.client.keybinds;
|
||||||
|
|
||||||
import com.mojang.blaze3d.platform.InputConstants;
|
import com.mojang.blaze3d.platform.InputConstants;
|
||||||
import net.minecraft.client.KeyMapping;
|
import net.minecraft.client.KeyMapping;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import tschipp.carryon.Constants;
|
import tschipp.carryon.Constants;
|
||||||
import tschipp.carryon.networking.serverbound.ServerboundCarryKeyPressedPacket;
|
import tschipp.carryon.networking.serverbound.ServerboundCarryKeyPressedPacket;
|
||||||
import tschipp.carryon.platform.Services;
|
import tschipp.carryon.platform.Services;
|
||||||
|
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
import net.minecraft.client.KeyMapping.Category;
|
||||||
|
|
||||||
public class CarryOnKeybinds
|
public class CarryOnKeybinds
|
||||||
{
|
{
|
||||||
|
|
@ -34,10 +36,13 @@ public class CarryOnKeybinds
|
||||||
|
|
||||||
public static void registerKeybinds(Consumer<KeyMapping> registrar)
|
public static void registerKeybinds(Consumer<KeyMapping> registrar)
|
||||||
{
|
{
|
||||||
|
Category category = Category.register(ResourceLocation.withDefaultNamespace("key.carry.category"));
|
||||||
|
|
||||||
|
|
||||||
if(Services.PLATFORM.isModLoaded("amecsapi"))
|
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
|
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);
|
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.StringReader;
|
||||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||||
import com.mojang.datafixers.util.Either;
|
import com.mojang.datafixers.util.Either;
|
||||||
import com.mojang.serialization.Codec;
|
|
||||||
import com.mojang.serialization.DataResult;
|
import com.mojang.serialization.DataResult;
|
||||||
import net.minecraft.commands.arguments.blocks.BlockStateParser;
|
import net.minecraft.commands.arguments.blocks.BlockStateParser;
|
||||||
import net.minecraft.commands.arguments.blocks.BlockStateParser.BlockResult;
|
import net.minecraft.commands.arguments.blocks.BlockStateParser.BlockResult;
|
||||||
|
|
|
||||||
|
|
@ -20,34 +20,24 @@
|
||||||
|
|
||||||
package tschipp.carryon.client.render;
|
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.blaze3d.vertex.*;
|
||||||
import com.mojang.math.Axis;
|
import com.mojang.math.Axis;
|
||||||
import net.minecraft.client.Minecraft;
|
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.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.entity.EntityRenderDispatcher;
|
||||||
import net.minecraft.client.renderer.item.ItemStackRenderState;
|
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.OverlayTexture;
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlas;
|
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.HumanoidArm;
|
import net.minecraft.world.entity.HumanoidArm;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.inventory.InventoryMenu;
|
|
||||||
import net.minecraft.world.item.ItemDisplayContext;
|
import net.minecraft.world.item.ItemDisplayContext;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.joml.Matrix4f;
|
import org.joml.Matrix4f;
|
||||||
import tschipp.carryon.Constants;
|
import tschipp.carryon.Constants;
|
||||||
import tschipp.carryon.common.carry.CarryOnData;
|
import tschipp.carryon.common.carry.CarryOnData;
|
||||||
|
|
@ -62,16 +52,7 @@ import java.util.*;
|
||||||
public class CarriedObjectRender
|
public class CarriedObjectRender
|
||||||
{
|
{
|
||||||
|
|
||||||
private static final SequencedMap<RenderType, ByteBufferBuilder> builders = new LinkedHashMap<>(Map.of(
|
public static boolean drawFirstPerson(Player player, PoseStack matrix, int light, float partialTicks,SubmitNodeCollector nodeCollector)
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
if(Services.PLATFORM.isModLoaded("firstperson") || Services.PLATFORM.isModLoaded("firstpersonmod"))
|
if(Services.PLATFORM.isModLoaded("firstperson") || Services.PLATFORM.isModLoaded("firstpersonmod"))
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -79,9 +60,9 @@ public class CarriedObjectRender
|
||||||
CarryOnData carry = CarryOnDataManager.getCarryData(player);
|
CarryOnData carry = CarryOnDataManager.getCarryData(player);
|
||||||
try {
|
try {
|
||||||
if (carry.isCarrying(CarryType.BLOCK))
|
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))
|
else if (carry.isCarrying(CarryType.ENTITY))
|
||||||
drawFirstPersonEntity(player, buffer, matrix, light, partialTicks);
|
drawFirstPersonEntity(player, matrix, light, partialTicks,nodeCollector);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
@ -101,7 +82,7 @@ public class CarriedObjectRender
|
||||||
return carry.isCarrying();
|
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.pushPose();
|
||||||
matrix.scale(2.5f, 2.5f, 2.5f);
|
matrix.scale(2.5f, 2.5f, 2.5f);
|
||||||
|
|
@ -128,8 +109,8 @@ public class CarriedObjectRender
|
||||||
|
|
||||||
ItemStack renderStack = CarryRenderHelper.getRenderItemStack(player);
|
ItemStack renderStack = CarryRenderHelper.getRenderItemStack(player);
|
||||||
Minecraft.getInstance().getItemModelResolver().updateForTopItem(renderState, renderStack, ItemDisplayContext.NONE, player.level(), null, 0);
|
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();
|
//RenderSystem.enableCull();
|
||||||
|
|
@ -137,8 +118,10 @@ public class CarriedObjectRender
|
||||||
matrix.popPose();
|
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();
|
EntityRenderDispatcher manager = Minecraft.getInstance().getEntityRenderDispatcher();
|
||||||
|
|
||||||
|
|
||||||
Entity entity = CarryRenderHelper.getRenderEntity(player);
|
Entity entity = CarryRenderHelper.getRenderEntity(player);
|
||||||
CarryOnData carry = CarryOnDataManager.getCarryData(player);
|
CarryOnData carry = CarryOnDataManager.getCarryData(player);
|
||||||
|
|
||||||
|
|
@ -159,7 +142,7 @@ public class CarriedObjectRender
|
||||||
matrix.mulPose(Axis.YP.rotationDegrees(180));
|
matrix.mulPose(Axis.YP.rotationDegrees(180));
|
||||||
matrix.translate(0.0, -height - .2, width * 1.3 + 0.1);
|
matrix.translate(0.0, -height - .2, width * 1.3 + 0.1);
|
||||||
|
|
||||||
manager.setRenderShadow(false);
|
// manager.setRenderShadow(false);
|
||||||
|
|
||||||
Optional<CarryOnScript> res = carry.getActiveScript();
|
Optional<CarryOnScript> res = carry.getActiveScript();
|
||||||
if(res.isPresent())
|
if(res.isPresent())
|
||||||
|
|
@ -175,12 +158,15 @@ public class CarriedObjectRender
|
||||||
((LivingEntity) entity).hurtTime = 0;
|
((LivingEntity) entity).hurtTime = 0;
|
||||||
|
|
||||||
try {
|
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)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
manager.setRenderShadow(true);
|
// manager.setRenderShadow(true);
|
||||||
matrix.popPose();
|
matrix.popPose();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -193,21 +179,17 @@ public class CarriedObjectRender
|
||||||
* @param partialticks
|
* @param partialticks
|
||||||
* @param mat
|
* @param mat
|
||||||
*/
|
*/
|
||||||
public static void drawThirdPerson(float partialticks, Matrix4f mat) {
|
public static void drawThirdPerson(float partialticks, Matrix4f mat,SubmitNodeCollector nodeCollector) {
|
||||||
Minecraft mc = Minecraft.getInstance();
|
Minecraft mc = Minecraft.getInstance();
|
||||||
Level level = mc.level;
|
Level level = mc.level;
|
||||||
int light = 0;
|
|
||||||
int perspective = CarryRenderHelper.getPerspective();
|
int perspective = CarryRenderHelper.getPerspective();
|
||||||
EntityRenderDispatcher manager = mc.getEntityRenderDispatcher();
|
|
||||||
|
|
||||||
PoseStack matrix = new PoseStack();
|
PoseStack matrix = new PoseStack();
|
||||||
matrix.mulPose(mat);
|
matrix.mulPose(mat);
|
||||||
|
|
||||||
//RenderSystem.enableBlend();
|
// RenderSystem.enableBlend();
|
||||||
//RenderSystem.disableCull();
|
// RenderSystem.disableCull();
|
||||||
//RenderSystem.disableDepthTest();
|
// RenderSystem.disableDepthTest();
|
||||||
|
|
||||||
BufferSource buffer = MultiBufferSource.immediateWithBuffers(builders, builders.get(RenderType.glint()));
|
|
||||||
ItemStackRenderState renderState = new ItemStackRenderState();
|
ItemStackRenderState renderState = new ItemStackRenderState();
|
||||||
var layer = renderState.newLayer();
|
var layer = renderState.newLayer();
|
||||||
layer.setRenderType(RenderType.glint());
|
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")))
|
if (perspective == 0 && player == mc.player && !(Services.PLATFORM.isModLoaded("firstperson") || Services.PLATFORM.isModLoaded("firstpersonmod") || Services.PLATFORM.isModLoaded("realcamera")))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
light = manager.getPackedLightCoords(player, partialticks);
|
|
||||||
|
|
||||||
if (carry.isCarrying(CarryType.BLOCK)) {
|
if (carry.isCarrying(CarryType.BLOCK)) {
|
||||||
BlockState state = CarryRenderHelper.getRenderState(player);
|
BlockState state = CarryRenderHelper.getRenderState(player);
|
||||||
|
|
@ -245,7 +226,9 @@ public class CarriedObjectRender
|
||||||
|
|
||||||
//RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
//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();
|
matrix.popPose();
|
||||||
} else if (carry.isCarrying(CarryType.ENTITY)) {
|
} else if (carry.isCarrying(CarryType.ENTITY)) {
|
||||||
|
|
@ -254,7 +237,7 @@ public class CarriedObjectRender
|
||||||
if (entity != null) {
|
if (entity != null) {
|
||||||
CarryRenderHelper.applyEntityTransformations(player, partialticks, matrix, entity);
|
CarryRenderHelper.applyEntityTransformations(player, partialticks, matrix, entity);
|
||||||
|
|
||||||
manager.setRenderShadow(false);
|
// manager.setRenderShadow(false);
|
||||||
|
|
||||||
Optional<CarryOnScript> res = carry.getActiveScript();
|
Optional<CarryOnScript> res = carry.getActiveScript();
|
||||||
res.ifPresent(script -> CarryRenderHelper.performScriptTransformation(matrix, script));
|
res.ifPresent(script -> CarryRenderHelper.performScriptTransformation(matrix, script));
|
||||||
|
|
@ -264,9 +247,9 @@ public class CarriedObjectRender
|
||||||
|
|
||||||
//RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
//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();
|
matrix.popPose();
|
||||||
manager.setRenderShadow(true);
|
// manager.setRenderShadow(true);
|
||||||
matrix.popPose();
|
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;
|
package tschipp.carryon.client.render;
|
||||||
//
|
|
||||||
//import com.mojang.blaze3d.pipeline.BlendFunction;
|
import com.mojang.blaze3d.pipeline.BlendFunction;
|
||||||
//import com.mojang.blaze3d.pipeline.RenderPipeline;
|
import com.mojang.blaze3d.pipeline.RenderPipeline;
|
||||||
//import com.mojang.blaze3d.pipeline.RenderTarget;
|
import com.mojang.blaze3d.platform.DepthTestFunction;
|
||||||
//import com.mojang.blaze3d.platform.DepthTestFunction;
|
import com.mojang.blaze3d.vertex.MeshData;
|
||||||
//import com.mojang.blaze3d.vertex.MeshData;
|
import com.mojang.blaze3d.vertex.VertexFormat;
|
||||||
//import com.mojang.blaze3d.vertex.VertexFormat;
|
import net.minecraft.client.renderer.RenderType;
|
||||||
//import net.minecraft.client.renderer.RenderType;
|
import org.jetbrains.annotations.NotNull;
|
||||||
//import org.jetbrains.annotations.NotNull;
|
|
||||||
//
|
import java.util.IdentityHashMap;
|
||||||
//import java.util.IdentityHashMap;
|
import java.util.Map;
|
||||||
//import java.util.Map;
|
|
||||||
//
|
//Credit: klikli for the idea and code for this wrapper
|
||||||
////Credit: klikli for the idea and code for this wrapper
|
public class CarryOnRenderType extends RenderType {
|
||||||
//public class CarryOnRenderType extends RenderType {
|
|
||||||
//
|
private static final Map<RenderType, RenderType> remappedTypes = new IdentityHashMap<>();
|
||||||
// private static final Map<RenderType, RenderType> remappedTypes = new IdentityHashMap<>();
|
private final RenderPipeline pipeline;
|
||||||
// private final RenderPipeline pipeline;
|
private final RenderType original;
|
||||||
// private final RenderType original;
|
|
||||||
//
|
private CarryOnRenderType(RenderType original, RenderPipeline pipeline) {
|
||||||
// private CarryOnRenderType(RenderType original, RenderPipeline pipeline) {
|
super(String.format("%s_carryon", original.toString()), original.bufferSize(), original.affectsCrumbling(), true, original::setupRenderState, original::clearRenderState);
|
||||||
// super(String.format("%s_carryon", original.toString()), original.bufferSize(), original.affectsCrumbling(), true, original::setupRenderState, original::clearRenderState);
|
this.pipeline = pipeline;
|
||||||
// this.pipeline = pipeline;
|
this.original = original;
|
||||||
// this.original = original;
|
}
|
||||||
// }
|
|
||||||
//
|
public static RenderType remap(RenderType in) {
|
||||||
// public static RenderType remap(RenderType in) {
|
return remappedTypes.computeIfAbsent(in, (type) -> {
|
||||||
// return remappedTypes.computeIfAbsent(in, (type) -> {
|
|
||||||
//
|
//modify the pipeline
|
||||||
// //modify the pipeline
|
var pipeline = toBuilder(in.pipeline())
|
||||||
// var pipeline = toBuilder(in.getRenderPipeline())
|
.withBlend(BlendFunction.TRANSLUCENT)
|
||||||
// .withBlend(BlendFunction.TRANSLUCENT)
|
.withDepthTestFunction(DepthTestFunction.NO_DEPTH_TEST)
|
||||||
// .withDepthTestFunction(DepthTestFunction.NO_DEPTH_TEST)
|
.withCull(false);
|
||||||
// .withCull(false);
|
|
||||||
//
|
return new CarryOnRenderType(type, pipeline.build());
|
||||||
// return new CarryOnRenderType(type, pipeline.build());
|
});
|
||||||
// });
|
}
|
||||||
// }
|
|
||||||
//
|
private static RenderPipeline.Builder toBuilder(RenderPipeline pipeline) {
|
||||||
// private static RenderPipeline.Builder toBuilder(RenderPipeline pipeline) {
|
RenderPipeline.Builder builder = RenderPipeline.builder();
|
||||||
// RenderPipeline.Builder builder = RenderPipeline.builder();
|
builder.withLocation(pipeline.getLocation());
|
||||||
// builder.withLocation(pipeline.getLocation());
|
builder.withFragmentShader(pipeline.getFragmentShader());
|
||||||
// builder.withFragmentShader(pipeline.getFragmentShader());
|
builder.withVertexShader(pipeline.getVertexShader());
|
||||||
// builder.withVertexShader(pipeline.getVertexShader());
|
|
||||||
//
|
if (!pipeline.getShaderDefines().isEmpty()) {
|
||||||
// if (!pipeline.getShaderDefines().isEmpty()) {
|
for (Map.Entry<String, String> entry : pipeline.getShaderDefines().values().entrySet()) {
|
||||||
// for (Map.Entry<String, String> entry : pipeline.getShaderDefines().values().entrySet()) {
|
try {
|
||||||
// try {
|
int parsed = Integer.parseInt(entry.getValue());
|
||||||
// int parsed = Integer.parseInt(entry.getValue());
|
builder.withShaderDefine(entry.getKey(), parsed);
|
||||||
// builder.withShaderDefine(entry.getKey(), parsed);
|
} catch (NumberFormatException e) {
|
||||||
// } catch (NumberFormatException e) {
|
float parsed = Float.parseFloat(entry.getValue());
|
||||||
// float parsed = Float.parseFloat(entry.getValue());
|
builder.withShaderDefine(entry.getKey(), parsed);
|
||||||
// builder.withShaderDefine(entry.getKey(), parsed);
|
}
|
||||||
// }
|
}
|
||||||
// }
|
for (String flag : pipeline.getShaderDefines().flags()) {
|
||||||
// for (String flag : pipeline.getShaderDefines().flags()) {
|
builder.withShaderDefine(flag);
|
||||||
// builder.withShaderDefine(flag);
|
}
|
||||||
// }
|
}
|
||||||
// }
|
|
||||||
//
|
if (!pipeline.getSamplers().isEmpty()) {
|
||||||
// if (!pipeline.getSamplers().isEmpty()) {
|
pipeline.getSamplers().forEach(builder::withSampler);
|
||||||
// pipeline.getSamplers().forEach(builder::withSampler);
|
}
|
||||||
// }
|
|
||||||
//
|
if (!pipeline.getUniforms().isEmpty()) {
|
||||||
// if (!pipeline.getUniforms().isEmpty()) {
|
pipeline.getUniforms().forEach(u -> builder.withUniform(u.name(), u.type()));
|
||||||
// pipeline.getUniforms().forEach(u -> builder.withUniform(u.name(), u.type()));
|
}
|
||||||
// }
|
|
||||||
//
|
builder.withDepthTestFunction(pipeline.getDepthTestFunction());
|
||||||
// builder.withDepthTestFunction(pipeline.getDepthTestFunction());
|
builder.withPolygonMode(pipeline.getPolygonMode());
|
||||||
// builder.withPolygonMode(pipeline.getPolygonMode());
|
builder.withCull(pipeline.isCull());
|
||||||
// builder.withCull(pipeline.isCull());
|
builder.withColorWrite(pipeline.isWriteColor(), pipeline.isWriteAlpha());
|
||||||
// builder.withColorWrite(pipeline.isWriteColor(), pipeline.isWriteAlpha());
|
builder.withDepthWrite(pipeline.isWriteDepth());
|
||||||
// builder.withDepthWrite(pipeline.isWriteDepth());
|
builder.withColorLogic(pipeline.getColorLogic());
|
||||||
// builder.withColorLogic(pipeline.getColorLogic());
|
|
||||||
//
|
if (pipeline.getBlendFunction().isPresent())
|
||||||
// if (pipeline.getBlendFunction().isPresent())
|
builder.withBlend(pipeline.getBlendFunction().get());
|
||||||
// builder.withBlend(pipeline.getBlendFunction().get());
|
else
|
||||||
// else
|
builder.withoutBlend();
|
||||||
// builder.withoutBlend();
|
builder.withVertexFormat(pipeline.getVertexFormat(), pipeline.getVertexFormatMode());
|
||||||
// builder.withVertexFormat(pipeline.getVertexFormat(), pipeline.getVertexFormatMode());
|
builder.withDepthBias(pipeline.getDepthBiasScaleFactor(), pipeline.getDepthBiasConstant());
|
||||||
// builder.withDepthBias(pipeline.getDepthBiasScaleFactor(), pipeline.getDepthBiasConstant());
|
|
||||||
//
|
return builder;
|
||||||
// return builder;
|
}
|
||||||
// }
|
|
||||||
//
|
@Override
|
||||||
// @Override
|
public void draw(@NotNull MeshData meshData) {
|
||||||
// public void draw(@NotNull MeshData meshData) {
|
this.original.draw(meshData);
|
||||||
// this.original.draw(meshData);
|
}
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public @NotNull RenderTarget getRenderTarget() {
|
|
||||||
// return this.original.getRenderTarget();
|
@Override
|
||||||
// }
|
public @NotNull VertexFormat format() {
|
||||||
//
|
return this.original.format();
|
||||||
// @Override
|
}
|
||||||
// public @NotNull RenderPipeline getRenderPipeline() {
|
|
||||||
// return this.pipeline; //get our own modified pipeline
|
@Override
|
||||||
// }
|
public VertexFormat.@NotNull Mode mode() {
|
||||||
//
|
return this.original.mode();
|
||||||
// @Override
|
}
|
||||||
// public @NotNull VertexFormat format() {
|
|
||||||
// return this.original.format();
|
@Override
|
||||||
// }
|
public RenderPipeline pipeline() {
|
||||||
//
|
return this.pipeline; //get our own modified pipeline
|
||||||
// @Override
|
}
|
||||||
// public VertexFormat.@NotNull Mode mode() {
|
}
|
||||||
// return this.original.mode();
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ package tschipp.carryon.common.carry;
|
||||||
|
|
||||||
import com.mojang.serialization.Codec;
|
import com.mojang.serialization.Codec;
|
||||||
import com.mojang.serialization.DataResult;
|
import com.mojang.serialization.DataResult;
|
||||||
import com.mojang.serialization.MapCodec;
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.HolderLookup;
|
import net.minecraft.core.HolderLookup;
|
||||||
import net.minecraft.core.registries.BuiltInRegistries;
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
|
|
@ -50,7 +49,6 @@ import tschipp.carryon.Constants;
|
||||||
import tschipp.carryon.common.scripting.CarryOnScript;
|
import tschipp.carryon.common.scripting.CarryOnScript;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
public class CarryOnData {
|
public class CarryOnData {
|
||||||
|
|
|
||||||
|
|
@ -20,11 +20,6 @@
|
||||||
|
|
||||||
package tschipp.carryon.common.carry;
|
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 net.minecraft.world.entity.player.Player;
|
||||||
import tschipp.carryon.platform.Services;
|
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.CarryOnScript;
|
||||||
import tschipp.carryon.common.scripting.ScriptManager;
|
import tschipp.carryon.common.scripting.ScriptManager;
|
||||||
import tschipp.carryon.networking.clientbound.ClientboundStartRidingOtherPlayerPacket;
|
import tschipp.carryon.networking.clientbound.ClientboundStartRidingOtherPlayerPacket;
|
||||||
import tschipp.carryon.networking.clientbound.ClientboundStartRidingPacket;
|
|
||||||
import tschipp.carryon.platform.Services;
|
import tschipp.carryon.platform.Services;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
@ -142,7 +141,7 @@ public class PickupHandler {
|
||||||
|
|
||||||
String cmd = script.scriptEffects().commandInit();
|
String cmd = script.scriptEffects().commandInit();
|
||||||
if(!cmd.isEmpty())
|
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);
|
carry.setBlock(state, blockEntity, player, pos);
|
||||||
|
|
@ -174,7 +173,7 @@ public class PickupHandler {
|
||||||
if (entity instanceof TamableAnimal tame)
|
if (entity instanceof TamableAnimal tame)
|
||||||
{
|
{
|
||||||
UUID owner = tame.getOwnerReference().getUUID();
|
UUID owner = tame.getOwnerReference().getUUID();
|
||||||
UUID playerID = player.getGameProfile().getId();
|
UUID playerID = player.getGameProfile().id();
|
||||||
if (owner != null && !owner.equals(playerID))
|
if (owner != null && !owner.equals(playerID))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -232,10 +231,10 @@ public class PickupHandler {
|
||||||
if (result.isPresent()) {
|
if (result.isPresent()) {
|
||||||
String cmd = result.get().scriptEffects().commandInit();
|
String cmd = result.get().scriptEffects().commandInit();
|
||||||
if (!cmd.isEmpty())
|
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());
|
Services.PLATFORM.sendPacketToAllPlayers(Constants.PACKET_ID_START_RIDING_OTHER, new ClientboundStartRidingOtherPlayerPacket(player.getId(), otherPlayer.getId(), true), player.level());
|
||||||
carry.setCarryingPlayer();
|
carry.setCarryingPlayer();
|
||||||
player.swing(InteractionHand.MAIN_HAND, true);
|
player.swing(InteractionHand.MAIN_HAND, true);
|
||||||
|
|
@ -257,7 +256,7 @@ public class PickupHandler {
|
||||||
{
|
{
|
||||||
String cmd = result.get().scriptEffects().commandInit();
|
String cmd = result.get().scriptEffects().commandInit();
|
||||||
if(!cmd.isEmpty())
|
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);
|
carry.setEntity(entity);
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@ import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.sounds.SoundEvents;
|
import net.minecraft.sounds.SoundEvents;
|
||||||
import net.minecraft.sounds.SoundSource;
|
import net.minecraft.sounds.SoundSource;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.effect.MobEffectInstance;
|
|
||||||
import net.minecraft.world.effect.MobEffects;
|
import net.minecraft.world.effect.MobEffects;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.Mob;
|
import net.minecraft.world.entity.Mob;
|
||||||
|
|
@ -44,7 +43,6 @@ import net.minecraft.world.level.block.state.properties.Property;
|
||||||
import net.minecraft.world.phys.BlockHitResult;
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||||
import tschipp.carryon.CarryOnCommon;
|
|
||||||
import tschipp.carryon.Constants;
|
import tschipp.carryon.Constants;
|
||||||
import tschipp.carryon.common.carry.CarryOnData.CarryType;
|
import tschipp.carryon.common.carry.CarryOnData.CarryType;
|
||||||
import tschipp.carryon.common.config.ListHandler;
|
import tschipp.carryon.common.config.ListHandler;
|
||||||
|
|
@ -99,7 +97,7 @@ public class PlacementHandler
|
||||||
ScriptEffects effects = carry.getActiveScript().get().scriptEffects();
|
ScriptEffects effects = carry.getActiveScript().get().scriptEffects();
|
||||||
String cmd = effects.commandPlace();
|
String cmd = effects.commandPlace();
|
||||||
if (!cmd.isEmpty())
|
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);
|
level.setBlockAndUpdate(pos, state);
|
||||||
|
|
@ -199,7 +197,7 @@ public class PlacementHandler
|
||||||
ScriptEffects effects = carry.getActiveScript().get().scriptEffects();
|
ScriptEffects effects = carry.getActiveScript().get().scriptEffects();
|
||||||
String cmd = effects.commandPlace();
|
String cmd = effects.commandPlace();
|
||||||
if (!cmd.isEmpty())
|
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);
|
level.addFreshEntity(entity);
|
||||||
|
|
@ -257,20 +255,20 @@ public class PlacementHandler
|
||||||
level.addFreshEntity(entityHeld);
|
level.addFreshEntity(entityHeld);
|
||||||
entityHeld.teleportTo(tempX, tempY, tempZ);
|
entityHeld.teleportTo(tempX, tempY, tempZ);
|
||||||
}
|
}
|
||||||
entityHeld.startRiding(topEntity, false);
|
entityHeld.startRiding(topEntity, false,false);
|
||||||
} else {
|
} else {
|
||||||
if (carry.isCarrying(CarryType.ENTITY)) {
|
if (carry.isCarrying(CarryType.ENTITY)) {
|
||||||
entityHeld.setPos(entityClicked.getX(), entityClicked.getY(), entityClicked.getZ());
|
entityHeld.setPos(entityClicked.getX(), entityClicked.getY(), entityClicked.getZ());
|
||||||
level.addFreshEntity(entityHeld);
|
level.addFreshEntity(entityHeld);
|
||||||
}
|
}
|
||||||
entityHeld.startRiding(topEntity, false);
|
entityHeld.startRiding(topEntity, false,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (carry.getActiveScript().isPresent()) {
|
if (carry.getActiveScript().isPresent()) {
|
||||||
ScriptEffects effects = carry.getActiveScript().get().scriptEffects();
|
ScriptEffects effects = carry.getActiveScript().get().scriptEffects();
|
||||||
String cmd = effects.commandPlace();
|
String cmd = effects.commandPlace();
|
||||||
if (!cmd.isEmpty())
|
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);
|
player.swing(InteractionHand.MAIN_HAND, true);
|
||||||
|
|
|
||||||
|
|
@ -22,10 +22,8 @@ package tschipp.carryon.common.scripting;
|
||||||
|
|
||||||
import com.mojang.serialization.Codec;
|
import com.mojang.serialization.Codec;
|
||||||
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||||
import net.minecraft.advancements.Advancement;
|
|
||||||
import net.minecraft.advancements.AdvancementHolder;
|
import net.minecraft.advancements.AdvancementHolder;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.registries.BuiltInRegistries;
|
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.NbtUtils;
|
import net.minecraft.nbt.NbtUtils;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
|
@ -34,7 +32,6 @@ import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.world.effect.MobEffectInstance;
|
import net.minecraft.world.effect.MobEffectInstance;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
import net.minecraft.world.scores.Objective;
|
import net.minecraft.world.scores.Objective;
|
||||||
import net.minecraft.world.scores.Score;
|
|
||||||
import net.minecraft.world.scores.Scoreboard;
|
import net.minecraft.world.scores.Scoreboard;
|
||||||
import tschipp.carryon.platform.Services;
|
import tschipp.carryon.platform.Services;
|
||||||
|
|
||||||
|
|
@ -127,7 +124,7 @@ public final class Matchables
|
||||||
@Override
|
@Override
|
||||||
public boolean matches(ServerPlayer player)
|
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));
|
AdvancementHolder adv = manager.get(ResourceLocation.parse(advancement.isEmpty() ? "" : advancement));
|
||||||
|
|
||||||
boolean achievement = adv == null ? true : player.getAdvancements().getOrStartProgress(adv).isDone();
|
boolean achievement = adv == null ? true : player.getAdvancements().getOrStartProgress(adv).isDone();
|
||||||
|
|
@ -167,7 +164,7 @@ public final class Matchables
|
||||||
if (cond == null || cond.isEmpty())
|
if (cond == null || cond.isEmpty())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
Scoreboard score = player.getScoreboard();
|
Scoreboard score = player.level().getScoreboard();
|
||||||
String numb;
|
String numb;
|
||||||
String scorename;
|
String scorename;
|
||||||
int iE = cond.indexOf("=");
|
int iE = cond.indexOf("=");
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ package tschipp.carryon.common.scripting;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.registries.BuiltInRegistries;
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.Tag;
|
|
||||||
import net.minecraft.util.ProblemReporter;
|
import net.minecraft.util.ProblemReporter;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
|
|
|
||||||
|
|
@ -20,13 +20,8 @@
|
||||||
|
|
||||||
package tschipp.carryon.common.scripting;
|
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.Codec;
|
||||||
import com.mojang.serialization.DataResult;
|
import com.mojang.serialization.DataResult;
|
||||||
import com.mojang.serialization.JsonOps;
|
|
||||||
import net.minecraft.nbt.CompoundTag;
|
|
||||||
import net.minecraft.nbt.NbtOps;
|
import net.minecraft.nbt.NbtOps;
|
||||||
import net.minecraft.nbt.Tag;
|
import net.minecraft.nbt.Tag;
|
||||||
import net.minecraft.resources.FileToIdConverter;
|
import net.minecraft.resources.FileToIdConverter;
|
||||||
|
|
@ -37,11 +32,9 @@ import net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener;
|
||||||
import net.minecraft.util.profiling.ProfilerFiller;
|
import net.minecraft.util.profiling.ProfilerFiller;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import tschipp.carryon.Constants;
|
import tschipp.carryon.Constants;
|
||||||
import tschipp.carryon.common.carry.CarryOnData;
|
|
||||||
import tschipp.carryon.networking.clientbound.ClientboundSyncScriptsPacket;
|
import tschipp.carryon.networking.clientbound.ClientboundSyncScriptsPacket;
|
||||||
import tschipp.carryon.platform.Services;
|
import tschipp.carryon.platform.Services;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class ScriptReloadListener extends SimpleJsonResourceReloadListener<CarryOnScript>
|
public class ScriptReloadListener extends SimpleJsonResourceReloadListener<CarryOnScript>
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@
|
||||||
|
|
||||||
package tschipp.carryon.mixin;
|
package tschipp.carryon.mixin;
|
||||||
|
|
||||||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
|
|
@ -50,12 +49,6 @@ public abstract class EntityMixin
|
||||||
|
|
||||||
@Shadow public abstract void onPassengerTurned(Entity $$0);
|
@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)
|
@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)
|
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.HumanoidModel;
|
||||||
import net.minecraft.client.model.geom.ModelPart;
|
import net.minecraft.client.model.geom.ModelPart;
|
||||||
import net.minecraft.client.renderer.entity.state.HumanoidRenderState;
|
import net.minecraft.client.renderer.entity.state.HumanoidRenderState;
|
||||||
import net.minecraft.client.renderer.entity.state.PlayerRenderState;
|
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
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.Operation;
|
||||||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
||||||
import net.minecraft.core.NonNullList;
|
import net.minecraft.core.NonNullList;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
|
||||||
import net.minecraft.world.entity.player.Inventory;
|
import net.minecraft.world.entity.player.Inventory;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.ItemStack;
|
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.Unique;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
import tschipp.carryon.common.carry.CarryOnData;
|
import tschipp.carryon.common.carry.CarryOnData;
|
||||||
import tschipp.carryon.common.carry.CarryOnDataManager;
|
import tschipp.carryon.common.carry.CarryOnDataManager;
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@ import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.world.entity.player.Inventory;
|
import net.minecraft.world.entity.player.Inventory;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
|
||||||
import tschipp.carryon.common.carry.CarryOnDataManager;
|
import tschipp.carryon.common.carry.CarryOnDataManager;
|
||||||
|
|
||||||
@Mixin(Minecraft.class)
|
@Mixin(Minecraft.class)
|
||||||
|
|
|
||||||
|
|
@ -21,20 +21,12 @@
|
||||||
package tschipp.carryon.mixin;
|
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.EntityType;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.entity.player.Inventory;
|
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.storage.ValueInput;
|
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.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.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
package tschipp.carryon.mixin;
|
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.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Unique;
|
import org.spongepowered.asm.mixin.Unique;
|
||||||
import tschipp.carryon.client.render.ICarryOnRenderState;
|
import tschipp.carryon.client.render.ICarryOnRenderState;
|
||||||
import tschipp.carryon.common.carry.CarryOnData;
|
import tschipp.carryon.common.carry.CarryOnData;
|
||||||
|
|
||||||
@Mixin(PlayerRenderState.class)
|
@Mixin(HumanoidRenderState.class)
|
||||||
public class PlayerRenderStateMixin implements ICarryOnRenderState {
|
public class PlayerRenderStateMixin implements ICarryOnRenderState {
|
||||||
|
|
||||||
@Unique
|
@Unique
|
||||||
|
|
|
||||||
|
|
@ -20,12 +20,7 @@
|
||||||
|
|
||||||
package tschipp.carryon.networking;
|
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.network.protocol.common.custom.CustomPacketPayload;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
|
||||||
public interface PacketBase extends CustomPacketPayload {
|
public interface PacketBase extends CustomPacketPayload {
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ public record ClientboundStartRidingOtherPlayerPacket(int mount, int rider, bool
|
||||||
|
|
||||||
if(mount != null && rider != null)
|
if(mount != null && rider != null)
|
||||||
if(ride)
|
if(ride)
|
||||||
rider.startRiding(mount, true);
|
rider.startRiding(mount, true,true);
|
||||||
else
|
else
|
||||||
rider.stopRiding();
|
rider.stopRiding();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,12 +20,10 @@
|
||||||
|
|
||||||
package tschipp.carryon.networking.clientbound;
|
package tschipp.carryon.networking.clientbound;
|
||||||
|
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
|
||||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||||
import net.minecraft.network.codec.ByteBufCodecs;
|
import net.minecraft.network.codec.ByteBufCodecs;
|
||||||
import net.minecraft.network.codec.StreamCodec;
|
import net.minecraft.network.codec.StreamCodec;
|
||||||
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import tschipp.carryon.Constants;
|
import tschipp.carryon.Constants;
|
||||||
|
|
|
||||||
|
|
@ -22,16 +22,12 @@ package tschipp.carryon.networking.clientbound;
|
||||||
|
|
||||||
import com.mojang.serialization.Codec;
|
import com.mojang.serialization.Codec;
|
||||||
import com.mojang.serialization.DataResult;
|
import com.mojang.serialization.DataResult;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
|
||||||
import net.minecraft.nbt.NbtOps;
|
import net.minecraft.nbt.NbtOps;
|
||||||
import net.minecraft.nbt.Tag;
|
import net.minecraft.nbt.Tag;
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
|
||||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||||
import net.minecraft.network.codec.ByteBufCodecs;
|
import net.minecraft.network.codec.ByteBufCodecs;
|
||||||
import net.minecraft.network.codec.StreamCodec;
|
import net.minecraft.network.codec.StreamCodec;
|
||||||
import net.minecraft.network.protocol.Packet;
|
|
||||||
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import tschipp.carryon.Constants;
|
import tschipp.carryon.Constants;
|
||||||
import tschipp.carryon.common.scripting.CarryOnScript;
|
import tschipp.carryon.common.scripting.CarryOnScript;
|
||||||
|
|
|
||||||
|
|
@ -20,20 +20,15 @@
|
||||||
|
|
||||||
package tschipp.carryon.networking.serverbound;
|
package tschipp.carryon.networking.serverbound;
|
||||||
|
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
|
||||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||||
import net.minecraft.network.codec.ByteBufCodecs;
|
import net.minecraft.network.codec.ByteBufCodecs;
|
||||||
import net.minecraft.network.codec.StreamCodec;
|
import net.minecraft.network.codec.StreamCodec;
|
||||||
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import tschipp.carryon.Constants;
|
import tschipp.carryon.Constants;
|
||||||
import tschipp.carryon.common.carry.CarryOnData;
|
import tschipp.carryon.common.carry.CarryOnData;
|
||||||
import tschipp.carryon.common.carry.CarryOnDataManager;
|
import tschipp.carryon.common.carry.CarryOnDataManager;
|
||||||
import tschipp.carryon.networking.PacketBase;
|
import tschipp.carryon.networking.PacketBase;
|
||||||
import tschipp.carryon.networking.clientbound.ClientboundStartRidingPacket;
|
|
||||||
import tschipp.carryon.networking.clientbound.ClientboundSyncScriptsPacket;
|
|
||||||
|
|
||||||
public record ServerboundCarryKeyPressedPacket(boolean pressed) implements PacketBase
|
public record ServerboundCarryKeyPressedPacket(boolean pressed) implements PacketBase
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,7 @@
|
||||||
|
|
||||||
package tschipp.carryon.platform.services;
|
package tschipp.carryon.platform.services;
|
||||||
|
|
||||||
import net.minecraft.core.HolderLookup;
|
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
|
||||||
import net.minecraft.network.codec.StreamCodec;
|
import net.minecraft.network.codec.StreamCodec;
|
||||||
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
|
@ -30,12 +28,10 @@ import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import tschipp.carryon.common.carry.CarryOnData;
|
import tschipp.carryon.common.carry.CarryOnData;
|
||||||
import tschipp.carryon.common.carry.CarryOnDataManager;
|
|
||||||
import tschipp.carryon.config.BuiltConfig;
|
import tschipp.carryon.config.BuiltConfig;
|
||||||
import tschipp.carryon.networking.PacketBase;
|
import tschipp.carryon.networking.PacketBase;
|
||||||
|
|
||||||
import java.util.function.BiConsumer;
|
import java.util.function.BiConsumer;
|
||||||
import java.util.function.Function;
|
|
||||||
|
|
||||||
public interface IPlatformHelper {
|
public interface IPlatformHelper {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
plugins {
|
plugins {
|
||||||
id 'multiloader-loader'
|
id 'multiloader-loader'
|
||||||
id 'fabric-loom' version '1.10-SNAPSHOT'
|
id 'fabric-loom' version "${loom_version}"
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
|
@ -32,7 +32,7 @@ dependencies {
|
||||||
modApi("me.shedaniel.cloth:cloth-config-fabric:${cloth_config_version}") {
|
modApi("me.shedaniel.cloth:cloth-config-fabric:${cloth_config_version}") {
|
||||||
exclude(group: "net.fabricmc.fabric-api")
|
exclude(group: "net.fabricmc.fabric-api")
|
||||||
}
|
}
|
||||||
modApi "com.terraformersmc:modmenu:15.0.0-beta.3"
|
modApi "com.terraformersmc:modmenu:16.0.0-rc.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
loom {
|
loom {
|
||||||
|
|
|
||||||
|
|
@ -23,20 +23,13 @@ package tschipp.carryon;
|
||||||
import net.fabricmc.api.ClientModInitializer;
|
import net.fabricmc.api.ClientModInitializer;
|
||||||
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
|
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
|
||||||
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
|
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.network.protocol.common.custom.CustomPacketPayload;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import tschipp.carryon.client.keybinds.CarryOnKeybinds;
|
import tschipp.carryon.client.keybinds.CarryOnKeybinds;
|
||||||
import tschipp.carryon.events.ClientEvents;
|
import tschipp.carryon.events.ClientEvents;
|
||||||
import tschipp.carryon.networking.PacketBase;
|
import tschipp.carryon.networking.PacketBase;
|
||||||
|
|
||||||
import java.util.function.BiConsumer;
|
import java.util.function.BiConsumer;
|
||||||
import java.util.function.Function;
|
|
||||||
|
|
||||||
public class CarryOnFabricClientMod implements ClientModInitializer
|
public class CarryOnFabricClientMod implements ClientModInitializer
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ package tschipp.carryon;
|
||||||
|
|
||||||
import net.fabricmc.api.ModInitializer;
|
import net.fabricmc.api.ModInitializer;
|
||||||
import net.fabricmc.fabric.api.attachment.v1.AttachmentRegistry;
|
import net.fabricmc.fabric.api.attachment.v1.AttachmentRegistry;
|
||||||
import net.fabricmc.fabric.api.attachment.v1.AttachmentSyncPredicate;
|
|
||||||
import net.fabricmc.fabric.api.attachment.v1.AttachmentType;
|
import net.fabricmc.fabric.api.attachment.v1.AttachmentType;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@
|
||||||
|
|
||||||
package tschipp.carryon.compat;
|
package tschipp.carryon.compat;
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.event.Event;
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
|
|
||||||
|
|
@ -20,11 +20,8 @@
|
||||||
|
|
||||||
package tschipp.carryon.events;
|
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.event.lifecycle.v1.ClientTickEvents;
|
||||||
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents;
|
|
||||||
import tschipp.carryon.CarryOnCommonClient;
|
import tschipp.carryon.CarryOnCommonClient;
|
||||||
import tschipp.carryon.client.render.CarriedObjectRender;
|
|
||||||
|
|
||||||
public class ClientEvents {
|
public class ClientEvents {
|
||||||
|
|
||||||
|
|
@ -34,10 +31,6 @@ public class ClientEvents {
|
||||||
CarryOnCommonClient.checkForKeybinds();
|
CarryOnCommonClient.checkForKeybinds();
|
||||||
CarryOnCommonClient.onCarryClientTick();
|
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) -> {
|
UseBlockCallback.EVENT.register((player, world, hand, hitResult) -> {
|
||||||
|
|
||||||
if(world.isClientSide)
|
if(world.isClientSide())
|
||||||
return InteractionResult.PASS;
|
return InteractionResult.PASS;
|
||||||
|
|
||||||
BlockPos pos = hitResult.getBlockPos();
|
BlockPos pos = hitResult.getBlockPos();
|
||||||
|
|
@ -96,7 +96,7 @@ public class CommonEvents {
|
||||||
|
|
||||||
UseEntityCallback.EVENT.register((player, level, hand, entity, hitResult) -> {
|
UseEntityCallback.EVENT.register((player, level, hand, entity, hitResult) -> {
|
||||||
|
|
||||||
if(level.isClientSide)
|
if(level.isClientSide())
|
||||||
return InteractionResult.PASS;
|
return InteractionResult.PASS;
|
||||||
|
|
||||||
CarryOnData carry = CarryOnDataManager.getCarryData(player);
|
CarryOnData carry = CarryOnDataManager.getCarryData(player);
|
||||||
|
|
|
||||||
|
|
@ -21,31 +21,24 @@
|
||||||
package tschipp.carryon.mixin;
|
package tschipp.carryon.mixin;
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.player.AbstractClientPlayer;
|
import net.minecraft.client.player.AbstractClientPlayer;
|
||||||
import net.minecraft.client.renderer.GameRenderer;
|
|
||||||
import net.minecraft.client.renderer.ItemInHandRenderer;
|
import net.minecraft.client.renderer.ItemInHandRenderer;
|
||||||
import net.minecraft.client.renderer.MultiBufferSource;
|
import net.minecraft.client.renderer.SubmitNodeCollector;
|
||||||
import net.minecraft.client.renderer.RenderBuffers;
|
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.entity.player.Player;
|
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
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.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
import tschipp.carryon.client.render.CarriedObjectRender;
|
import tschipp.carryon.client.render.CarriedObjectRender;
|
||||||
import tschipp.carryon.client.render.CarryRenderHelper;
|
|
||||||
import tschipp.carryon.platform.Services;
|
|
||||||
|
|
||||||
@Mixin(ItemInHandRenderer.class)
|
@Mixin(ItemInHandRenderer.class)
|
||||||
public class ItemInHandRendererMixin
|
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)
|
@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 onRenderHand(AbstractClientPlayer player, float partialTicks, float pitch, InteractionHand hand, float pSwingProgress, ItemStack pStack, float pEquippedProgress, PoseStack poseStack, MultiBufferSource buffer, int light, CallbackInfo ci)
|
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();
|
ci.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,17 +20,12 @@
|
||||||
|
|
||||||
package tschipp.carryon.platform;
|
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.PayloadTypeRegistry;
|
||||||
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
|
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.fabricmc.loader.api.FabricLoader;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||||
import net.minecraft.network.codec.StreamCodec;
|
import net.minecraft.network.codec.StreamCodec;
|
||||||
import net.minecraft.network.codec.StreamDecoder;
|
|
||||||
import net.minecraft.network.codec.StreamMemberEncoder;
|
|
||||||
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
|
@ -44,7 +39,6 @@ import tschipp.carryon.networking.PacketBase;
|
||||||
import tschipp.carryon.platform.services.IPlatformHelper;
|
import tschipp.carryon.platform.services.IPlatformHelper;
|
||||||
|
|
||||||
import java.util.function.BiConsumer;
|
import java.util.function.BiConsumer;
|
||||||
import java.util.function.Function;
|
|
||||||
|
|
||||||
public class FabricPlatformHelper implements IPlatformHelper {
|
public class FabricPlatformHelper implements IPlatformHelper {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,14 +23,12 @@ package tschipp.carryon.events;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
|
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.minecraft.world.entity.player.Player;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
|
||||||
import net.minecraftforge.client.event.RenderHandEvent;
|
import net.minecraftforge.client.event.RenderHandEvent;
|
||||||
import net.minecraftforge.client.event.ScreenEvent;
|
import net.minecraftforge.client.event.ScreenEvent;
|
||||||
import net.minecraftforge.event.TickEvent.ClientTickEvent;
|
import net.minecraftforge.event.TickEvent.ClientTickEvent;
|
||||||
import net.minecraftforge.event.TickEvent.Phase;
|
|
||||||
import net.minecraftforge.eventbus.api.listener.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.listener.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
import tschipp.carryon.CarryOnCommonClient;
|
import tschipp.carryon.CarryOnCommonClient;
|
||||||
|
|
@ -47,13 +45,12 @@ public class ClientEvents {
|
||||||
public static boolean renderHand(RenderHandEvent event)
|
public static boolean renderHand(RenderHandEvent event)
|
||||||
{
|
{
|
||||||
Player player = Minecraft.getInstance().player;
|
Player player = Minecraft.getInstance().player;
|
||||||
MultiBufferSource buffer = event.getMultiBufferSource();
|
|
||||||
PoseStack matrix = event.getPoseStack();
|
PoseStack matrix = event.getPoseStack();
|
||||||
int light = event.getPackedLight();
|
int light = event.getPackedLight();
|
||||||
float partialTicks = event.getPartialTick();
|
float partialTicks = event.getPartialTick();
|
||||||
|
SubmitNodeCollector nodes =event.getNodeCollector();
|
||||||
//If true, cancels event
|
//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 {
|
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' }
|
sourceSets.main.resources { srcDir 'src/generated/resources' }
|
||||||
|
|
|
||||||
|
|
@ -21,14 +21,10 @@
|
||||||
package tschipp.carryon;
|
package tschipp.carryon;
|
||||||
|
|
||||||
import net.minecraft.nbt.CompoundTag;
|
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.ModContainer;
|
||||||
import net.neoforged.fml.common.Mod;
|
import net.neoforged.fml.common.Mod;
|
||||||
import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent;
|
import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||||
import net.neoforged.neoforge.attachment.AttachmentType;
|
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.event.RegisterPayloadHandlersEvent;
|
||||||
import net.neoforged.neoforge.network.registration.PayloadRegistrar;
|
import net.neoforged.neoforge.network.registration.PayloadRegistrar;
|
||||||
import net.neoforged.neoforge.registries.DeferredRegister;
|
import net.neoforged.neoforge.registries.DeferredRegister;
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,11 @@
|
||||||
package tschipp.carryon.compat;
|
package tschipp.carryon.compat;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.gui.screens.Screen;
|
import net.minecraft.client.gui.screens.Screen;
|
||||||
import net.minecraft.network.chat.Component;
|
|
||||||
import net.neoforged.fml.ModContainer;
|
import net.neoforged.fml.ModContainer;
|
||||||
import net.neoforged.neoforge.client.gui.IConfigScreenFactory;
|
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.BuiltConfig;
|
||||||
import tschipp.carryon.config.neoforge.ConfigLoaderImpl;
|
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 {
|
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.AbstractConfig;
|
||||||
import com.electronwill.nightconfig.core.UnmodifiableConfig;
|
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.bus.api.SubscribeEvent;
|
||||||
import net.neoforged.fml.ModContainer;
|
import net.neoforged.fml.ModContainer;
|
||||||
import net.neoforged.fml.ModLoadingContext;
|
|
||||||
import net.neoforged.fml.common.EventBusSubscriber;
|
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.config.ModConfig;
|
||||||
import net.neoforged.fml.event.config.ModConfigEvent;
|
import net.neoforged.fml.event.config.ModConfigEvent;
|
||||||
import net.neoforged.neoforge.common.ModConfigSpec;
|
import net.neoforged.neoforge.common.ModConfigSpec;
|
||||||
import net.neoforged.neoforge.common.NeoForge;
|
|
||||||
import net.neoforged.neoforge.server.ServerLifecycleHooks;
|
|
||||||
import tschipp.carryon.Constants;
|
import tschipp.carryon.Constants;
|
||||||
import tschipp.carryon.config.*;
|
import tschipp.carryon.config.*;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
@EventBusSubscriber(modid = Constants.MOD_ID)
|
@EventBusSubscriber(modid = Constants.MOD_ID)
|
||||||
public class ConfigLoaderImpl {
|
public class ConfigLoaderImpl {
|
||||||
|
|
|
||||||
|
|
@ -23,12 +23,11 @@ package tschipp.carryon.events;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
|
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.minecraft.world.entity.player.Player;
|
||||||
import net.neoforged.api.distmarker.Dist;
|
import net.neoforged.api.distmarker.Dist;
|
||||||
import net.neoforged.bus.api.SubscribeEvent;
|
import net.neoforged.bus.api.SubscribeEvent;
|
||||||
import net.neoforged.fml.common.EventBusSubscriber;
|
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.ClientTickEvent;
|
||||||
import net.neoforged.neoforge.client.event.RenderHandEvent;
|
import net.neoforged.neoforge.client.event.RenderHandEvent;
|
||||||
import net.neoforged.neoforge.client.event.RenderLevelStageEvent;
|
import net.neoforged.neoforge.client.event.RenderLevelStageEvent;
|
||||||
|
|
@ -47,19 +46,19 @@ public class ClientEvents {
|
||||||
public static void renderHand(RenderHandEvent event)
|
public static void renderHand(RenderHandEvent event)
|
||||||
{
|
{
|
||||||
Player player = Minecraft.getInstance().player;
|
Player player = Minecraft.getInstance().player;
|
||||||
MultiBufferSource buffer = event.getMultiBufferSource();
|
|
||||||
PoseStack matrix = event.getPoseStack();
|
PoseStack matrix = event.getPoseStack();
|
||||||
int light = event.getPackedLight();
|
int light = event.getPackedLight();
|
||||||
float partialTicks = event.getPartialTick();
|
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);
|
event.setCanceled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@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
|
@SubscribeEvent
|
||||||
|
|
|
||||||
|
|
@ -31,11 +31,9 @@ import net.minecraft.world.entity.Mob;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.ServerLevelAccessor;
|
import net.minecraft.world.level.ServerLevelAccessor;
|
||||||
import net.neoforged.bus.api.Event;
|
|
||||||
import net.neoforged.bus.api.EventPriority;
|
import net.neoforged.bus.api.EventPriority;
|
||||||
import net.neoforged.bus.api.SubscribeEvent;
|
import net.neoforged.bus.api.SubscribeEvent;
|
||||||
import net.neoforged.fml.common.EventBusSubscriber;
|
import net.neoforged.fml.common.EventBusSubscriber;
|
||||||
import net.neoforged.fml.common.Mod;
|
|
||||||
import net.neoforged.neoforge.common.NeoForge;
|
import net.neoforged.neoforge.common.NeoForge;
|
||||||
import net.neoforged.neoforge.common.util.BlockSnapshot;
|
import net.neoforged.neoforge.common.util.BlockSnapshot;
|
||||||
import net.neoforged.neoforge.event.*;
|
import net.neoforged.neoforge.event.*;
|
||||||
|
|
@ -68,7 +66,7 @@ public class CommonEvents
|
||||||
Level level = event.getLevel();
|
Level level = event.getLevel();
|
||||||
BlockPos pos = event.getPos();
|
BlockPos pos = event.getPos();
|
||||||
|
|
||||||
if (level.isClientSide)
|
if (level.isClientSide())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
|
|
@ -122,7 +120,7 @@ public class CommonEvents
|
||||||
Level level = event.getLevel();
|
Level level = event.getLevel();
|
||||||
Entity target = event.getTarget();
|
Entity target = event.getTarget();
|
||||||
|
|
||||||
if (level.isClientSide)
|
if (level.isClientSide())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CarryOnData carry = CarryOnDataManager.getCarryData(player);
|
CarryOnData carry = CarryOnDataManager.getCarryData(player);
|
||||||
|
|
@ -180,7 +178,7 @@ public class CommonEvents
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void onClone(PlayerEvent.Clone event)
|
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());
|
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.bus.api.SubscribeEvent;
|
||||||
import net.neoforged.fml.InterModComms;
|
import net.neoforged.fml.InterModComms;
|
||||||
import net.neoforged.fml.common.EventBusSubscriber;
|
import net.neoforged.fml.common.EventBusSubscriber;
|
||||||
import net.neoforged.fml.common.Mod;
|
|
||||||
import net.neoforged.fml.event.lifecycle.InterModProcessEvent;
|
import net.neoforged.fml.event.lifecycle.InterModProcessEvent;
|
||||||
import tschipp.carryon.Constants;
|
import tschipp.carryon.Constants;
|
||||||
import tschipp.carryon.client.modeloverride.ModelOverrideHandler;
|
|
||||||
import tschipp.carryon.common.config.ListHandler;
|
import tschipp.carryon.common.config.ListHandler;
|
||||||
|
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,8 @@
|
||||||
package tschipp.carryon.events;
|
package tschipp.carryon.events;
|
||||||
|
|
||||||
import net.neoforged.api.distmarker.Dist;
|
import net.neoforged.api.distmarker.Dist;
|
||||||
import net.neoforged.api.distmarker.OnlyIn;
|
|
||||||
import net.neoforged.bus.api.SubscribeEvent;
|
import net.neoforged.bus.api.SubscribeEvent;
|
||||||
import net.neoforged.fml.common.EventBusSubscriber;
|
import net.neoforged.fml.common.EventBusSubscriber;
|
||||||
import net.neoforged.fml.common.Mod;
|
|
||||||
import net.neoforged.neoforge.client.event.RegisterKeyMappingsEvent;
|
import net.neoforged.neoforge.client.event.RegisterKeyMappingsEvent;
|
||||||
import tschipp.carryon.Constants;
|
import tschipp.carryon.Constants;
|
||||||
import tschipp.carryon.client.keybinds.CarryOnKeybinds;
|
import tschipp.carryon.client.keybinds.CarryOnKeybinds;
|
||||||
|
|
|
||||||
|
|
@ -20,12 +20,10 @@
|
||||||
|
|
||||||
package tschipp.carryon.platform;
|
package tschipp.carryon.platform;
|
||||||
|
|
||||||
import net.minecraft.nbt.CompoundTag;
|
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||||
import net.minecraft.network.codec.StreamCodec;
|
import net.minecraft.network.codec.StreamCodec;
|
||||||
import net.minecraft.network.codec.StreamDecoder;
|
|
||||||
import net.minecraft.network.codec.StreamMemberEncoder;
|
|
||||||
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
|
@ -45,7 +43,6 @@ import tschipp.carryon.networking.PacketBase;
|
||||||
import tschipp.carryon.platform.services.IPlatformHelper;
|
import tschipp.carryon.platform.services.IPlatformHelper;
|
||||||
|
|
||||||
import java.util.function.BiConsumer;
|
import java.util.function.BiConsumer;
|
||||||
import java.util.function.Function;
|
|
||||||
|
|
||||||
public class NeoForgePlatformHelper implements IPlatformHelper {
|
public class NeoForgePlatformHelper implements IPlatformHelper {
|
||||||
|
|
||||||
|
|
@ -64,7 +61,7 @@ public class NeoForgePlatformHelper implements IPlatformHelper {
|
||||||
@Override
|
@Override
|
||||||
public boolean isDevelopmentEnvironment() {
|
public boolean isDevelopmentEnvironment() {
|
||||||
|
|
||||||
return !FMLLoader.isProduction();
|
return !FMLLoader.getCurrent().isProduction();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
plugins {
|
plugins {
|
||||||
// see https://fabricmc.net/develop/ for new versions
|
// 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
|
// see https://projects.neoforged.net/neoforged/moddevgradle for new versions
|
||||||
id 'net.neoforged.moddev' version "${mod_dev_version}" apply false
|
id 'net.neoforged.moddev' version "${mod_dev_version}" apply false
|
||||||
}
|
}
|
||||||
|
|
@ -3,34 +3,35 @@ version=2.7.0
|
||||||
group=tschipp.carryon
|
group=tschipp.carryon
|
||||||
|
|
||||||
# Common
|
# Common
|
||||||
minecraft_version=1.21.8
|
minecraft_version=1.21.9
|
||||||
mod_name=Carry On
|
mod_name=Carry On
|
||||||
mod_author=Tschipp, PurpliciousCow
|
mod_author=Tschipp, PurpliciousCow
|
||||||
mod_id=carryon
|
mod_id=carryon
|
||||||
license=GNU LGPLv3
|
license=GNU LGPLv3
|
||||||
credits=
|
credits=
|
||||||
description=Carry On is a simple mod that improves game interaction by allowing players to pick up, carry, and place single block Tile Entities using only their empty hands.
|
description=Carry On is a simple mod that improves game interaction by allowing players to pick up, carry, and place single block Tile Entities using only their empty hands.
|
||||||
minecraft_version_range=[1.21.8, 1.22)
|
minecraft_version_range=[1.21.9, 1.22)
|
||||||
neo_form_version=1.21.8-20250717.133445
|
neo_form_version=1.21.9-20250930.151910
|
||||||
java_version=21
|
java_version=21
|
||||||
parchment_version=2025.07.20
|
parchment_version=2025.10.05
|
||||||
mod_dev_version=2.0.107
|
mod_dev_version=2.0.107
|
||||||
# Forge
|
# Forge
|
||||||
forge_version=58.0.10
|
forge_version=59.0.5
|
||||||
forge_loader_version_range=[57,)
|
forge_loader_version_range=[59,)
|
||||||
parchment_mappings=2025.07.20-1.21.8
|
parchment_mappings=2025.10.05-1.21.9
|
||||||
//forge_ats_enabled=true
|
//forge_ats_enabled=true
|
||||||
|
|
||||||
# Fabric
|
# Fabric
|
||||||
fabric_version=0.132.0+1.21.8
|
fabric_version=0.134.0+1.21.9
|
||||||
fabric_loader_version=0.17.2
|
fabric_loader_version=0.17.3
|
||||||
parchment_mappings_fabric=1.21.8:2025.07.20
|
parchment_mappings_fabric=1.21.9:2025.10.05
|
||||||
|
loom_version=1.11-SNAPSHOT
|
||||||
|
|
||||||
# Neoforge
|
# Neoforge
|
||||||
neoforge_version=21.8.36
|
neoforge_version=21.9.16-beta
|
||||||
neoforge_loader_version_range=[4,)
|
neoforge_loader_version_range=[4,)
|
||||||
neogradle.subsystems.parchment.minecraftVersion=1.21.8
|
neogradle.subsystems.parchment.minecraftVersion=1.21.9
|
||||||
neogradle.subsystems.parchment.mappingsVersion=2025.07.20
|
neogradle.subsystems.parchment.mappingsVersion=2025.10.05
|
||||||
|
|
||||||
|
|
||||||
# Gradle
|
# Gradle
|
||||||
|
|
@ -38,4 +39,4 @@ org.gradle.jvmargs=-Xmx3G
|
||||||
org.gradle.daemon=false
|
org.gradle.daemon=false
|
||||||
|
|
||||||
mixinextras_version=0.3.6
|
mixinextras_version=0.3.6
|
||||||
cloth_config_version=19.0.147
|
cloth_config_version=20.0.148
|
||||||
|
|
@ -12,6 +12,7 @@ pluginManagement {
|
||||||
}
|
}
|
||||||
filter {
|
filter {
|
||||||
includeGroup('net.fabricmc')
|
includeGroup('net.fabricmc')
|
||||||
|
includeGroup('net.fabricmc.unpick')
|
||||||
includeGroup('fabric-loom')
|
includeGroup('fabric-loom')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user