Cleaned up fork code, restored carry transformations
This commit is contained in:
parent
326880d40b
commit
4ca8a885da
71
.vscode/launch.json
vendored
71
.vscode/launch.json
vendored
|
|
@ -1,71 +0,0 @@
|
|||
{
|
||||
"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"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -36,13 +36,9 @@ public class CarryOnKeybinds
|
|||
|
||||
public static void registerKeybinds(Consumer<KeyMapping> registrar)
|
||||
{
|
||||
Category category = Category.register(ResourceLocation.withDefaultNamespace("key.carry.category"));
|
||||
Category category = Category.register(ResourceLocation.fromNamespaceAndPath(Constants.MOD_ID,"key.carry.category"));
|
||||
|
||||
|
||||
if(Services.PLATFORM.isModLoaded("amecsapi"))
|
||||
carryKey = new KeyMapping("key.carry.desc", InputConstants.KEY_LSHIFT, category);
|
||||
else
|
||||
carryKey = new KeyMapping("key.carry.desc", Services.PLATFORM.getPlatformName().equals("Forge") ? InputConstants.KEY_LSHIFT : InputConstants.UNKNOWN.getValue(), category);
|
||||
carryKey = new KeyMapping("key.carry.desc", InputConstants.KEY_LSHIFT, category);
|
||||
|
||||
registrar.accept(carryKey);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import net.minecraft.client.Minecraft;
|
|||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.SubmitNodeCollector;
|
||||
import net.minecraft.client.renderer.entity.EntityRenderDispatcher;
|
||||
import net.minecraft.client.renderer.entity.state.EntityRenderState;
|
||||
import net.minecraft.client.renderer.item.ItemStackRenderState;
|
||||
import net.minecraft.client.renderer.state.CameraRenderState;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
|
|
@ -57,9 +58,9 @@ public class CarriedObjectRender
|
|||
CarryOnData carry = CarryOnDataManager.getCarryData(player);
|
||||
try {
|
||||
if (carry.isCarrying(CarryType.BLOCK))
|
||||
drawBlock(player, matrix, light, CarryRenderHelper.getRenderState(player), nodeCollector, firstPerson);
|
||||
drawBlock(player, matrix, light, CarryRenderHelper.getRenderState(player), nodeCollector, firstPerson, partialTicks);
|
||||
else if (carry.isCarrying(CarryType.ENTITY))
|
||||
drawEntity(player, matrix, light, partialTicks,nodeCollector, firstPerson);
|
||||
drawEntity(player, matrix, light, partialTicks, nodeCollector, firstPerson);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
@ -79,37 +80,20 @@ public class CarriedObjectRender
|
|||
return carry.isCarrying();
|
||||
}
|
||||
|
||||
private static void drawBlock(Player player, PoseStack matrix, int light, BlockState state,SubmitNodeCollector nodeCollector, boolean firstPerson)
|
||||
private static void drawBlock(Player player, PoseStack matrix, int light, BlockState state, SubmitNodeCollector nodeCollector, boolean firstPerson, float partialTicks)
|
||||
{
|
||||
matrix.pushPose();
|
||||
if (firstPerson){
|
||||
matrix.scale(2.5f, 2.5f, 2.5f);
|
||||
matrix.translate(0, -0.5, -1);
|
||||
}else{
|
||||
matrix.scale(0.6f, 0.6f, 0.6f);
|
||||
matrix.translate(0, 0.5, -0.8);
|
||||
matrix.mulPose(Axis.ZN.rotationDegrees(180));
|
||||
|
||||
}
|
||||
|
||||
CarryOnData carry = CarryOnDataManager.getCarryData(player);
|
||||
ItemStackRenderState renderState = new ItemStackRenderState();
|
||||
var layer = renderState.newLayer();
|
||||
layer.setRenderType(RenderType.glint());
|
||||
|
||||
if (Constants.CLIENT_CONFIG.facePlayer != CarryRenderHelper.isChest(state.getBlock())) {
|
||||
matrix.mulPose(Axis.YP.rotationDegrees(180));
|
||||
matrix.mulPose(Axis.XN.rotationDegrees(8));
|
||||
} else {
|
||||
matrix.mulPose(Axis.XP.rotationDegrees(8));
|
||||
}
|
||||
matrix.pushPose();
|
||||
|
||||
if(carry.getActiveScript().isPresent())
|
||||
CarryRenderHelper.performScriptTransformation(matrix, carry.getActiveScript().get());
|
||||
PoseStack renderPose = CarryRenderHelper.setupBlockTransformations(player, matrix, carry, firstPerson);
|
||||
|
||||
ItemStack renderStack = CarryRenderHelper.getRenderItemStack(player);
|
||||
Minecraft.getInstance().getItemModelResolver().updateForTopItem(renderState, renderStack, ItemDisplayContext.NONE, player.level(), null, 0);
|
||||
renderState.submit(matrix, nodeCollector, light, OverlayTexture.NO_OVERLAY, 0);
|
||||
renderState.submit(renderPose, nodeCollector, light, OverlayTexture.NO_OVERLAY, 0);
|
||||
matrix.popPose();
|
||||
}
|
||||
|
||||
|
|
@ -119,50 +103,36 @@ public class CarriedObjectRender
|
|||
Entity entity = CarryRenderHelper.getRenderEntity(player);
|
||||
CarryOnData carry = CarryOnDataManager.getCarryData(player);
|
||||
|
||||
if (entity != null)
|
||||
{
|
||||
Vec3 playerpos = CarryRenderHelper.getExactPos(player, partialTicks);
|
||||
if (entity == null)
|
||||
return;
|
||||
|
||||
entity.setPos(playerpos.x, playerpos.y, playerpos.z);
|
||||
entity.xRotO = 0.0f;
|
||||
entity.yRotO = 0.0f;
|
||||
entity.setYHeadRot(0.0f);
|
||||
Vec3 playerpos = CarryRenderHelper.getExactPos(player, partialTicks);
|
||||
|
||||
float height = entity.getBbHeight();
|
||||
float width = entity.getBbWidth();
|
||||
matrix.pushPose();
|
||||
matrix.mulPose(Axis.YP.rotationDegrees(180));
|
||||
if (firstPerson){
|
||||
matrix.scale(0.8f, 0.8f, 0.8f);
|
||||
matrix.translate(0.0, -height - .2, width * 1.3 + 0.1);
|
||||
}else{
|
||||
float multiplier = Math.min(9.9f, height * width) ;
|
||||
matrix.scale((10 - multiplier) * 0.08f, (10 - multiplier) * 0.08f, (10 - multiplier) * 0.08f);
|
||||
matrix.translate(0.0, height / 2 + -(height / 4) + 0.5f, width - 0.1 < 0.7 ? width - 0.1 + (0.7 - (width - 0.1)) : width - 0.1);
|
||||
matrix.mulPose(Axis.ZN.rotationDegrees(180));
|
||||
}
|
||||
entity.setPos(playerpos.x, playerpos.y, playerpos.z);
|
||||
entity.xRotO = 0.0f;
|
||||
entity.yRotO = 0.0f;
|
||||
entity.setYHeadRot(0.0f);
|
||||
|
||||
Optional<CarryOnScript> res = carry.getActiveScript();
|
||||
if(res.isPresent())
|
||||
{
|
||||
CarryOnScript script = res.get();
|
||||
CarryRenderHelper.performScriptTransformation(matrix, script);
|
||||
}
|
||||
matrix.pushPose();
|
||||
|
||||
if(Constants.CLIENT_CONFIG.rotateEntitiesSideways)
|
||||
matrix.mulPose(Axis.YP.rotationDegrees(90));
|
||||
CarryRenderHelper.setupEntityTransformations(player, matrix, carry, firstPerson);
|
||||
|
||||
if (entity instanceof LivingEntity)
|
||||
((LivingEntity) entity).hurtTime = 0;
|
||||
if (entity instanceof LivingEntity)
|
||||
((LivingEntity) entity).hurtTime = 0;
|
||||
|
||||
try {
|
||||
manager.submit(manager.extractEntity(entity, 0), new CameraRenderState(), 0, 0, 0, matrix, nodeCollector);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
try {
|
||||
EntityRenderState renderState = manager.extractEntity(entity, 0);
|
||||
renderState.shadowPieces.clear();
|
||||
renderState.lightCoords = light;
|
||||
manager.submit(renderState, new CameraRenderState(), 0, 0, 0, matrix, nodeCollector);
|
||||
}
|
||||
catch (Exception ignored)
|
||||
{
|
||||
}
|
||||
|
||||
matrix.popPose();
|
||||
if(!firstPerson)
|
||||
matrix.popPose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,108 +0,0 @@
|
|||
// package tschipp.carryon.client.render;
|
||||
|
||||
// import com.mojang.blaze3d.pipeline.BlendFunction;
|
||||
// import com.mojang.blaze3d.pipeline.RenderPipeline;
|
||||
// import com.mojang.blaze3d.platform.DepthTestFunction;
|
||||
// import com.mojang.blaze3d.vertex.MeshData;
|
||||
// import com.mojang.blaze3d.vertex.VertexFormat;
|
||||
// import net.minecraft.client.renderer.RenderType;
|
||||
// import org.jetbrains.annotations.NotNull;
|
||||
|
||||
// import java.util.IdentityHashMap;
|
||||
// import java.util.Map;
|
||||
|
||||
// //Credit: klikli for the idea and code for this wrapper
|
||||
// public class CarryOnRenderType extends RenderType {
|
||||
|
||||
// private static final Map<RenderType, RenderType> remappedTypes = new IdentityHashMap<>();
|
||||
// private final RenderPipeline pipeline;
|
||||
// private final RenderType original;
|
||||
|
||||
// private CarryOnRenderType(RenderType original, RenderPipeline pipeline) {
|
||||
// super(String.format("%s_carryon", original.toString()), original.bufferSize(), original.affectsCrumbling(), true, original::setupRenderState, original::clearRenderState);
|
||||
// this.pipeline = pipeline;
|
||||
// this.original = original;
|
||||
// }
|
||||
|
||||
// public static RenderType remap(RenderType in) {
|
||||
// return remappedTypes.computeIfAbsent(in, (type) -> {
|
||||
|
||||
// //modify the pipeline
|
||||
// var pipeline = toBuilder(in.pipeline())
|
||||
// .withBlend(BlendFunction.TRANSLUCENT)
|
||||
// .withDepthTestFunction(DepthTestFunction.NO_DEPTH_TEST)
|
||||
// .withCull(false);
|
||||
|
||||
// return new CarryOnRenderType(type, pipeline.build());
|
||||
// });
|
||||
// }
|
||||
|
||||
// private static RenderPipeline.Builder toBuilder(RenderPipeline pipeline) {
|
||||
// RenderPipeline.Builder builder = RenderPipeline.builder();
|
||||
// builder.withLocation(pipeline.getLocation());
|
||||
// builder.withFragmentShader(pipeline.getFragmentShader());
|
||||
// builder.withVertexShader(pipeline.getVertexShader());
|
||||
|
||||
// if (!pipeline.getShaderDefines().isEmpty()) {
|
||||
// for (Map.Entry<String, String> entry : pipeline.getShaderDefines().values().entrySet()) {
|
||||
// try {
|
||||
// int parsed = Integer.parseInt(entry.getValue());
|
||||
// builder.withShaderDefine(entry.getKey(), parsed);
|
||||
// } catch (NumberFormatException e) {
|
||||
// float parsed = Float.parseFloat(entry.getValue());
|
||||
// builder.withShaderDefine(entry.getKey(), parsed);
|
||||
// }
|
||||
// }
|
||||
// for (String flag : pipeline.getShaderDefines().flags()) {
|
||||
// builder.withShaderDefine(flag);
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (!pipeline.getSamplers().isEmpty()) {
|
||||
// pipeline.getSamplers().forEach(builder::withSampler);
|
||||
// }
|
||||
|
||||
// if (!pipeline.getUniforms().isEmpty()) {
|
||||
// pipeline.getUniforms().forEach(u -> builder.withUniform(u.name(), u.type()));
|
||||
// }
|
||||
|
||||
// builder.withDepthTestFunction(pipeline.getDepthTestFunction());
|
||||
// builder.withPolygonMode(pipeline.getPolygonMode());
|
||||
// builder.withCull(pipeline.isCull());
|
||||
// builder.withColorWrite(pipeline.isWriteColor(), pipeline.isWriteAlpha());
|
||||
// builder.withDepthWrite(pipeline.isWriteDepth());
|
||||
// builder.withColorLogic(pipeline.getColorLogic());
|
||||
|
||||
// if (pipeline.getBlendFunction().isPresent())
|
||||
// builder.withBlend(pipeline.getBlendFunction().get());
|
||||
// else
|
||||
// builder.withoutBlend();
|
||||
// builder.withVertexFormat(pipeline.getVertexFormat(), pipeline.getVertexFormatMode());
|
||||
// builder.withDepthBias(pipeline.getDepthBiasScaleFactor(), pipeline.getDepthBiasConstant());
|
||||
|
||||
// return builder;
|
||||
// }
|
||||
|
||||
// @Override
|
||||
// public void draw(@NotNull MeshData meshData) {
|
||||
// this.original.draw(meshData);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
// @Override
|
||||
// public @NotNull VertexFormat format() {
|
||||
// return this.original.format();
|
||||
// }
|
||||
|
||||
// @Override
|
||||
// public VertexFormat.@NotNull Mode mode() {
|
||||
// return this.original.mode();
|
||||
// }
|
||||
|
||||
// @Override
|
||||
// public RenderPipeline pipeline() {
|
||||
// return this.pipeline; //get our own modified pipeline
|
||||
// }
|
||||
// }
|
||||
|
|
@ -34,6 +34,7 @@ import net.minecraft.world.entity.player.Player;
|
|||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.ChestBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.storage.TagValueInput;
|
||||
import net.minecraft.world.level.storage.ValueInput;
|
||||
|
|
@ -74,91 +75,60 @@ public class CarryRenderHelper
|
|||
return Axis.YP.rotationDegrees(getExactBodyRotationDegrees(entity, partialticks));
|
||||
}
|
||||
|
||||
public static void applyGeneralTransformations(Player player, float partialticks, PoseStack matrix)
|
||||
public static void applyGeneralTransformations(Player player, PoseStack matrix)
|
||||
{
|
||||
int perspective = CarryRenderHelper.getPerspective();
|
||||
Quaternionf playerrot = CarryRenderHelper.getExactBodyRotation(player, partialticks);
|
||||
Vec3 playerpos = CarryRenderHelper.getExactPos(player, partialticks);
|
||||
Vec3 cameraPos = Minecraft.getInstance().gameRenderer.getMainCamera().getPosition();
|
||||
Vec3 offset = playerpos.subtract(cameraPos);
|
||||
Pose pose = player.getPose();
|
||||
|
||||
matrix.pushPose();
|
||||
matrix.translate(offset.x, offset.y, offset.z);
|
||||
|
||||
if (perspective == 2)
|
||||
playerrot.mul(Axis.YP.rotationDegrees(180));
|
||||
matrix.mulPose(playerrot);
|
||||
|
||||
matrix.pushPose();
|
||||
matrix.scale(0.6f, 0.6f, 0.6f);
|
||||
|
||||
if (perspective == 2)
|
||||
matrix.translate(0, 0, -1.35);
|
||||
matrix.translate(0, 0, -1.35);
|
||||
|
||||
if (doSneakCheck(player))
|
||||
{
|
||||
matrix.translate(0, -0.4, 0);
|
||||
}
|
||||
|
||||
if (pose == Pose.SWIMMING)
|
||||
if (pose == Pose.SWIMMING || pose == Pose.FALL_FLYING)
|
||||
{
|
||||
float f = player.getSwimAmount(partialticks);
|
||||
float f3 = player.isInWater() ? -90.0F - player.xRotO : -90.0F;
|
||||
float f4 = Mth.lerp(f, 0.0F, f3);
|
||||
if (perspective == 2)
|
||||
{
|
||||
matrix.translate(0, 0, 1.35);
|
||||
matrix.mulPose(Axis.XP.rotationDegrees(f4));
|
||||
}
|
||||
else
|
||||
matrix.mulPose(Axis.XN.rotationDegrees(f4));
|
||||
|
||||
matrix.translate(0, -1.5, -1.848);
|
||||
if (perspective == 2)
|
||||
matrix.translate(0, 0, 2.38);
|
||||
matrix.translate(0, 0, 2.5);
|
||||
matrix.mulPose(Axis.XP.rotationDegrees(90));
|
||||
}
|
||||
|
||||
if (pose == Pose.FALL_FLYING)
|
||||
{
|
||||
float f1 = player.getFallFlyingTicks() + partialticks;
|
||||
float f2 = Mth.clamp(f1 * f1 / 100.0F, 0.0F, 1.0F);
|
||||
if (!player.isAutoSpinAttack())
|
||||
{
|
||||
if (perspective == 2)
|
||||
matrix.translate(0, 0, 1.35);
|
||||
|
||||
if (perspective == 2)
|
||||
matrix.mulPose(Axis.XP.rotationDegrees(f2 * (-90.0F - player.xRotO)));
|
||||
else
|
||||
matrix.mulPose(Axis.XN.rotationDegrees(f2 * (-90.0F - player.xRotO)));
|
||||
}
|
||||
|
||||
Vec3 viewVector = player.getViewVector(partialticks);
|
||||
Vec3 deltaMovement = player.getDeltaMovement();
|
||||
double d0 = deltaMovement.horizontalDistanceSqr();
|
||||
double d1 = deltaMovement.horizontalDistanceSqr();
|
||||
if (d0 > 0.0D && d1 > 0.0D)
|
||||
{
|
||||
double d2 = (deltaMovement.x * viewVector.x + deltaMovement.z * viewVector.z) / (Math.sqrt(d0) * Math.sqrt(d1));
|
||||
double d3 = deltaMovement.x * viewVector.z - deltaMovement.z * viewVector.x;
|
||||
|
||||
matrix.mulPose(Axis.YP.rotation((float) (Math.signum(d3) * Math.acos(d2))));
|
||||
}
|
||||
|
||||
if (perspective != 2)
|
||||
matrix.translate(0, 0, -1.35);
|
||||
matrix.translate(0, -0.2, 0);
|
||||
}
|
||||
|
||||
matrix.translate(0, 1.6, 0.65);
|
||||
matrix.translate(0, -0.5, 0.65);
|
||||
}
|
||||
|
||||
public static void applyBlockTransformations(Player player, float partialticks, PoseStack matrix, Block block)
|
||||
{
|
||||
//int perspective = CarryRenderHelper.getPerspective();
|
||||
public static PoseStack setupBlockTransformations(Player player, PoseStack matrix, CarryOnData carry, boolean firstPerson) {
|
||||
if (firstPerson) {
|
||||
matrix.scale(2.5f, 2.5f, 2.5f);
|
||||
matrix.translate(0, -0.5, -1);
|
||||
|
||||
applyGeneralTransformations(player, partialticks, matrix);
|
||||
if (Constants.CLIENT_CONFIG.facePlayer != CarryRenderHelper.isChest(carry.getBlock().getBlock())) {
|
||||
matrix.mulPose(Axis.YP.rotationDegrees(180));
|
||||
matrix.mulPose(Axis.XN.rotationDegrees(8));
|
||||
} else {
|
||||
matrix.mulPose(Axis.XP.rotationDegrees(8));
|
||||
}
|
||||
carry.getActiveScript().ifPresent(script -> CarryRenderHelper.performScriptTransformation(matrix, script));
|
||||
|
||||
return matrix;
|
||||
} else {
|
||||
CarryRenderHelper.applyBlockTransformations(player, matrix, carry.getBlock().getBlock());
|
||||
carry.getActiveScript().ifPresent(script -> CarryRenderHelper.performScriptTransformation(matrix, script));
|
||||
|
||||
PoseStack.Pose p = matrix.last();
|
||||
PoseStack copy = new PoseStack();
|
||||
copy.mulPose(p.pose());
|
||||
matrix.popPose();
|
||||
|
||||
return copy;
|
||||
}
|
||||
}
|
||||
|
||||
public static void applyBlockTransformations(Player player, PoseStack matrix, Block block)
|
||||
{
|
||||
matrix.mulPose(Axis.ZN.rotationDegrees(180));
|
||||
applyGeneralTransformations(player, matrix);
|
||||
|
||||
if (Constants.CLIENT_CONFIG.facePlayer != CarryRenderHelper.isChest(block))
|
||||
{
|
||||
|
|
@ -167,59 +137,67 @@ public class CarryRenderHelper
|
|||
// matrix.translate(0, 0, -0.4);
|
||||
matrix.mulPose(Axis.YP.rotationDegrees(180));
|
||||
}
|
||||
// if(perspective == 1)
|
||||
// {
|
||||
// matrix.pushPose();
|
||||
// //matrix.mulPose(Axis.YP.rotationDegrees(180));
|
||||
// matrix.popPose();
|
||||
// }
|
||||
|
||||
//else if ((ModList.get().isLoaded("realrender") || ModList.get().isLoaded("rfpr")) && perspective == 0)
|
||||
// matrix.translate(0, 0, 0.4);
|
||||
//matrix.mulPose(Axis.YP.rotationDegrees(180));
|
||||
|
||||
|
||||
|
||||
float height = getRenderHeight(player);
|
||||
float offset = (height - 1f) / 1.2f;
|
||||
matrix.translate(0, -offset, 0);
|
||||
}
|
||||
|
||||
public static void applyEntityTransformations(Player player, float partialticks, PoseStack matrix, Entity entity)
|
||||
public static void setupEntityTransformations(Player player, PoseStack matrix, CarryOnData carry, boolean firstPerson) {
|
||||
|
||||
Entity entity = carry.getEntity(player.level());
|
||||
|
||||
float height = entity.getBbHeight();
|
||||
float width = entity.getBbWidth();
|
||||
|
||||
if(firstPerson) {
|
||||
matrix.mulPose(Axis.YP.rotationDegrees(180));
|
||||
|
||||
matrix.scale(0.8f, 0.8f, 0.8f);
|
||||
matrix.translate(0.0, -height - .2, width * 1.3 + 0.1);
|
||||
|
||||
carry.getActiveScript().ifPresent(script -> CarryRenderHelper.performScriptTransformation(matrix, script));
|
||||
|
||||
if(Constants.CLIENT_CONFIG.rotateEntitiesSideways)
|
||||
matrix.mulPose(Axis.YP.rotationDegrees(90));
|
||||
}
|
||||
else {
|
||||
applyEntityTransformations(player, matrix, entity);
|
||||
|
||||
carry.getActiveScript().ifPresent(script -> CarryRenderHelper.performScriptTransformation(matrix, script));
|
||||
}
|
||||
}
|
||||
|
||||
public static void applyEntityTransformations(Player player, PoseStack matrix, Entity entity)
|
||||
{
|
||||
int perspective = CarryRenderHelper.getPerspective();
|
||||
Pose pose = player.getPose();
|
||||
|
||||
applyGeneralTransformations(player, partialticks, matrix);
|
||||
applyGeneralTransformations(player, matrix);
|
||||
|
||||
if (perspective == 2)
|
||||
matrix.translate(0, -1.6, 0.65);
|
||||
else
|
||||
matrix.translate(0, -1.6, -0.65);
|
||||
matrix.mulPose(Axis.XP.rotationDegrees(180));
|
||||
|
||||
matrix.translate(0, -3.1, -0.65);
|
||||
matrix.scale(1.666f, 1.666f, 1.666f);
|
||||
|
||||
float height = entity.getBbHeight();
|
||||
float width = entity.getBbWidth();
|
||||
float multiplier = height * width;
|
||||
float multiplier = Math.min(9.9f, height * width) ;
|
||||
entity.yo = 0.0f;
|
||||
entity.yRotO = 0.0f;
|
||||
entity.setYHeadRot(0.0f);
|
||||
entity.xo = 0.0f;
|
||||
entity.xRotO = 0.0f;
|
||||
|
||||
if (perspective == 2)
|
||||
matrix.mulPose(Axis.YP.rotationDegrees(180));
|
||||
|
||||
matrix.scale((10 - multiplier) * 0.08f, (10 - multiplier) * 0.08f, (10 - multiplier) * 0.08f);
|
||||
matrix.translate(0.0, height / 2 + -(height / 4) + 1, width - 0.1 < 0.7 ? width - 0.1 + (0.7 - (width - 0.1)) : width - 0.1);
|
||||
|
||||
if(doSneakCheck(player))
|
||||
matrix.translate(0, -0.4, 0);
|
||||
|
||||
if (pose == Pose.SWIMMING || pose == Pose.FALL_FLYING)
|
||||
{
|
||||
matrix.mulPose(Axis.XN.rotationDegrees(90));
|
||||
matrix.translate(0, -0.2 * height, 0);
|
||||
|
||||
if (pose == Pose.FALL_FLYING)
|
||||
matrix.translate(0, 0, 0.2);
|
||||
matrix.mulPose(Axis.XN.rotationDegrees(180));
|
||||
matrix.translate(0, 0.2 * height - 2, -0.5);
|
||||
}
|
||||
|
||||
if(Constants.CLIENT_CONFIG.rotateEntitiesSideways)
|
||||
|
|
@ -463,7 +441,7 @@ public class CarryRenderHelper
|
|||
|
||||
public static boolean isChest(Block block)
|
||||
{
|
||||
return block == Blocks.CHEST || block == Blocks.ENDER_CHEST || block == Blocks.TRAPPED_CHEST;
|
||||
return block == Blocks.CHEST || block == Blocks.ENDER_CHEST || block == Blocks.TRAPPED_CHEST || block instanceof ChestBlock;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package tschipp.carryon.client.render;
|
|||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.model.PlayerModel;
|
||||
import net.minecraft.client.renderer.SubmitNodeCollector;
|
||||
import net.minecraft.client.renderer.entity.RenderLayerParent;
|
||||
|
|
@ -16,7 +17,7 @@ public class CarryingItemRenderLayer<M extends PlayerModel> extends RenderLayer<
|
|||
public void submit(PoseStack poseStack, SubmitNodeCollector nodeCollector, int packedLight,
|
||||
AvatarRenderState renderState, float yRot, float xRot) {
|
||||
if (renderState instanceof ICarryOnRenderState carryOnRenderState){
|
||||
CarriedObjectRender.draw(carryOnRenderState.getPlayer(), poseStack, packedLight, 0, nodeCollector,false);
|
||||
CarriedObjectRender.draw(carryOnRenderState.getPlayer(), poseStack, packedLight, Minecraft.getInstance().getDeltaTracker().getGameTimeDeltaPartialTick(true), nodeCollector,false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public record ClothConfigCompat(BuiltConfig client, BuiltConfig common, Runnable
|
|||
public static Screen getConfigScreen(BuiltConfig client, BuiltConfig common, Screen parentScreen, Runnable onSave) {
|
||||
ConfigBuilder builder = ConfigBuilder.create()
|
||||
.setParentScreen(parentScreen)
|
||||
.setTitle(Component.translatable("key.carry.category"));
|
||||
.setTitle(Component.translatable("key.category.carryon.key.carry.category"));
|
||||
|
||||
buildConfigType(client, builder, "Client Config");
|
||||
buildConfigType(common, builder, "Common Config");
|
||||
|
|
|
|||
|
|
@ -12,5 +12,5 @@
|
|||
"carryon.category.custompickupconditions.custompickupconditionsentities": "Benutzerdefinierte Bedingungen für Entitäten",
|
||||
|
||||
"key.carry.desc": "Carry",
|
||||
"key.carry.category": "Carry On"
|
||||
"key.category.carryon.key.carry.category": "Carry On"
|
||||
}
|
||||
|
|
@ -12,5 +12,5 @@
|
|||
"carryon.category.custompickupconditions.custompickupconditionsentities": "suoᴉʇᴉpuoƆ dnʞɔᴉԀ ʎʇᴉʇuƎ ɯoʇsnƆ",
|
||||
|
||||
"key.carry.desc": "ʎɹɹɐƆ",
|
||||
"key.carry.category": "uO ʎɹɹɐƆ"
|
||||
"key.category.carryon.key.carry.category": "uO ʎɹɹɐƆ"
|
||||
}
|
||||
|
|
@ -12,5 +12,5 @@
|
|||
"carryon.category.custompickupconditions.custompickupconditionsentities": "Custom Entity Pickup Conditions",
|
||||
|
||||
"key.carry.desc": "Carry",
|
||||
"key.carry.category": "Carry On"
|
||||
"key.category.carryon.key.carry.category": "Carry On"
|
||||
}
|
||||
|
|
@ -12,5 +12,5 @@
|
|||
"carryon.category.custompickupconditions.custompickupconditionsentities": "Condiciones Personalizadas de Recogida de Entidades",
|
||||
|
||||
"key.carry.desc": "Cargar",
|
||||
"key.carry.category": "Carry On"
|
||||
"key.category.carryon.key.carry.category": "Carry On"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,5 +12,5 @@
|
|||
"carryon.category.custompickupconditions.custompickupconditionsentities": "Condiciones Personalizadas para Recoger Entidades",
|
||||
|
||||
"key.carry.desc": "Recoger",
|
||||
"key.carry.category": "Carry On"
|
||||
"key.category.carryon.key.carry.category": "Carry On"
|
||||
}
|
||||
|
|
@ -12,5 +12,5 @@
|
|||
"carryon.category.custompickupconditions.custompickupconditionsentities": "Customizar condiciones para recoger entidades",
|
||||
|
||||
"key.carry.desc": "Agarrar",
|
||||
"key.carry.category": "Carry On"
|
||||
"key.category.carryon.key.carry.category": "Carry On"
|
||||
}
|
||||
|
|
@ -12,5 +12,5 @@
|
|||
"carryon.category.custompickupconditions.custompickupconditionsentities": "Conditions de ramassage d'entités personalisés",
|
||||
|
||||
"key.carry.desc": "Saisir",
|
||||
"key.carry.category": "Carry On"
|
||||
"key.category.carryon.key.carry.category": "Carry On"
|
||||
}
|
||||
|
|
@ -12,5 +12,5 @@
|
|||
"carryon.category.custompickupconditions.custompickupconditionsentities": "Egyedi entitás felvételi feltételek",
|
||||
|
||||
"key.carry.desc": "Cipelés",
|
||||
"key.carry.category": "Carry On"
|
||||
"key.category.carryon.key.carry.category": "Carry On"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,5 +12,5 @@
|
|||
"carryon.category.custompickupconditions.custompickupconditionsentities": "Condizioni di prelievo entità personalizzate",
|
||||
|
||||
"key.carry.desc": "Afferra",
|
||||
"key.carry.category": "Carry On Mod"
|
||||
"key.category.carryon.key.carry.category": "Carry On Mod"
|
||||
}
|
||||
|
|
@ -12,5 +12,5 @@
|
|||
"carryon.category.custompickupconditions.custompickupconditionsentities": "カスタムエンティティ持ち上げ条件",
|
||||
|
||||
"key.carry.desc": "Carry",
|
||||
"key.carry.category": "Carry On"
|
||||
"key.category.carryon.key.carry.category": "Carry On"
|
||||
}
|
||||
|
|
@ -12,5 +12,5 @@
|
|||
"carryon.category.custompickupconditions.custompickupconditionsentities": "맞춤형 개체 들기 조건",
|
||||
|
||||
"key.carry.desc": "들고 나르기",
|
||||
"key.carry.category": "Carry On"
|
||||
"key.category.carryon.key.carry.category": "Carry On"
|
||||
}
|
||||
|
|
@ -12,5 +12,5 @@
|
|||
"carryon.category.custompickupconditions.custompickupconditionsentities": "Пользовательские условия поднятия сущности",
|
||||
|
||||
"key.carry.desc": "Поднять",
|
||||
"key.carry.category": "Carry On"
|
||||
"key.category.carryon.key.carry.category": "Carry On"
|
||||
}
|
||||
|
|
@ -13,5 +13,5 @@
|
|||
"carryon.category.custompickupconditions.custompickupconditionsentities": "Özel Varlık Alma Durumları",
|
||||
|
||||
"key.carry.desc": "Taşı",
|
||||
"key.carry.category": "Carry On"
|
||||
"key.category.carryon.key.carry.category": "Carry On"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,5 +12,5 @@
|
|||
"carryon.category.custompickupconditions.custompickupconditionsentities": "Користувацькі умови підбору сутностей",
|
||||
|
||||
"key.carry.desc": "Нести",
|
||||
"key.carry.category": "Carry On"
|
||||
"key.category.carryon.key.carry.category": "Carry On"
|
||||
}
|
||||
|
|
@ -12,5 +12,5 @@
|
|||
"carryon.category.custompickupconditions.custompickupconditionsentities": "自定义抱起实体条件",
|
||||
|
||||
"key.carry.desc": "抱起",
|
||||
"key.carry.category": "搬运"
|
||||
"key.category.carryon.key.carry.category": "搬运"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,5 +12,5 @@
|
|||
"carryon.category.custompickupconditions.custompickupconditionsentities": "自訂實體拾取條件",
|
||||
|
||||
"key.carry.desc": "攜帶",
|
||||
"key.carry.category": "Carry On"
|
||||
"key.category.carryon.key.carry.category": "Carry On"
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user