From e0b6aae07be62238b388853c9dd9772c260c84e3 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Wed, 26 Oct 2022 23:26:27 +0200 Subject: [PATCH] 22w43a --- gradle.properties | 4 ++-- .../java/carpet/helpers/OptimizedExplosion.java | 4 ++-- .../mixins/Explosion_scarpetEventMixin.java | 4 ++-- .../mixins/LevelRenderer_scarpetRenderMixin.java | 2 +- .../mixins/ServerPlayer_actionPackMixin.java | 2 +- .../java/carpet/patches/EntityPlayerMPFake.java | 10 +++++----- src/main/java/carpet/script/api/WorldAccess.java | 2 +- .../java/carpet/script/utils/ShapesRenderer.java | 16 ++++++++-------- .../script/utils/shapes/ShapeDirection.java | 16 ++++++++-------- 9 files changed, 30 insertions(+), 30 deletions(-) diff --git a/gradle.properties b/gradle.properties index 45c8a83acf..bd003682d1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,9 +4,9 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://fabricmc.net/use # or better: https://modmuss50.me/fabric.html - minecraft_version=22w42a + minecraft_version=22w43a loader_version=0.14.10 - fabric_version=0.58.0+1.19 + fabric_version=0.65.1+1.19.3 # Mod Properties mod_version = 1.4.85 diff --git a/src/main/java/carpet/helpers/OptimizedExplosion.java b/src/main/java/carpet/helpers/OptimizedExplosion.java index 263e8c2a51..7138678f35 100644 --- a/src/main/java/carpet/helpers/OptimizedExplosion.java +++ b/src/main/java/carpet/helpers/OptimizedExplosion.java @@ -205,7 +205,7 @@ public static void doExplosionB(Explosion e, boolean spawnParticles) // If it is needed, calls scarpet event if (EXPLOSION_OUTCOME.isNeeded() && !world.isClientSide()) { - EXPLOSION_OUTCOME.onExplosion((ServerLevel) world, eAccess.getSource(), e::getSourceMob, eAccess.getX(), eAccess.getY(), eAccess.getZ(), eAccess.getRadius(), eAccess.isFire(), e.getToBlow(), entityList, eAccess.getBlockInteraction()); + EXPLOSION_OUTCOME.onExplosion((ServerLevel) world, eAccess.getSource(), e::getIndirectSourceEntity, eAccess.getX(), eAccess.getY(), eAccess.getZ(), eAccess.getRadius(), eAccess.isFire(), e.getToBlow(), entityList, eAccess.getBlockInteraction()); } boolean damagesTerrain = eAccess.getBlockInteraction() != Explosion.BlockInteraction.NONE; @@ -234,7 +234,7 @@ public static void doExplosionB(Explosion e, boolean spawnParticles) ObjectArrayList> objectArrayList = new ObjectArrayList<>(); Util.shuffle((ObjectArrayList) e.getToBlow(), world.random); - boolean dropFromExplosions = CarpetSettings.xpFromExplosions || e.getSourceMob() instanceof Player; + boolean dropFromExplosions = CarpetSettings.xpFromExplosions || e.getIndirectSourceEntity() instanceof Player; for (BlockPos blockpos : e.getToBlow()) { diff --git a/src/main/java/carpet/mixins/Explosion_scarpetEventMixin.java b/src/main/java/carpet/mixins/Explosion_scarpetEventMixin.java index dd231b1479..2e8e72c3fc 100644 --- a/src/main/java/carpet/mixins/Explosion_scarpetEventMixin.java +++ b/src/main/java/carpet/mixins/Explosion_scarpetEventMixin.java @@ -37,7 +37,7 @@ public abstract class Explosion_scarpetEventMixin @Shadow @Final private Explosion.BlockInteraction blockInteraction; @Shadow @Final private @Nullable Entity source; - @Shadow /*@Nullable*/ public abstract /*@Nullable*/ LivingEntity getSourceMob(); + @Shadow /*@Nullable*/ public abstract /*@Nullable*/ LivingEntity getIndirectSourceEntity(); @Shadow public static float getSeenPercent(Vec3 source, Entity entity) {return 0.0f;} @@ -71,7 +71,7 @@ private void onExplosion(boolean spawnParticles, CallbackInfo ci) { if (EXPLOSION_OUTCOME.isNeeded() && !level.isClientSide()) { - EXPLOSION_OUTCOME.onExplosion((ServerLevel) level, source, this::getSourceMob, x, y, z, radius, fire, toBlow, affectedEntities, blockInteraction); + EXPLOSION_OUTCOME.onExplosion((ServerLevel) level, source, this::getIndirectSourceEntity, x, y, z, radius, fire, toBlow, affectedEntities, blockInteraction); } } } diff --git a/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java b/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java index be3db65aa7..9f8dc129db 100644 --- a/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java +++ b/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java @@ -3,7 +3,6 @@ import carpet.network.CarpetClient; import carpet.script.utils.ShapesRenderer; import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.math.Matrix4f; import net.minecraft.client.Camera; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GameRenderer; @@ -12,6 +11,7 @@ import net.minecraft.client.renderer.RenderBuffers; import net.minecraft.client.renderer.blockentity.BlockEntityRenderDispatcher; import net.minecraft.client.renderer.entity.EntityRenderDispatcher; +import org.joml.Matrix4f; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; diff --git a/src/main/java/carpet/mixins/ServerPlayer_actionPackMixin.java b/src/main/java/carpet/mixins/ServerPlayer_actionPackMixin.java index 07c008fd39..e49cff0117 100644 --- a/src/main/java/carpet/mixins/ServerPlayer_actionPackMixin.java +++ b/src/main/java/carpet/mixins/ServerPlayer_actionPackMixin.java @@ -25,7 +25,7 @@ public EntityPlayerActionPack getActionPack() } @Inject(method = "", at = @At(value = "RETURN")) - private void onServerPlayerEntityContructor(MinecraftServer minecraftServer, ServerLevel serverLevel, GameProfile gameProfile, RemoteChatSession remoteChatSession, CallbackInfo ci) + private void onServerPlayerEntityContructor(MinecraftServer minecraftServer, ServerLevel serverLevel, GameProfile gameProfile, CallbackInfo ci) { this.actionPack = new EntityPlayerActionPack((ServerPlayer) (Object) this); } diff --git a/src/main/java/carpet/patches/EntityPlayerMPFake.java b/src/main/java/carpet/patches/EntityPlayerMPFake.java index 0e89a665f6..3872bd889b 100644 --- a/src/main/java/carpet/patches/EntityPlayerMPFake.java +++ b/src/main/java/carpet/patches/EntityPlayerMPFake.java @@ -4,7 +4,6 @@ import com.mojang.authlib.GameProfile; import net.minecraft.core.UUIDUtil; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.RemoteChatSession; import net.minecraft.network.protocol.PacketFlow; import net.minecraft.network.protocol.game.ClientboundPlayerInfoUpdatePacket; import net.minecraft.network.protocol.game.ClientboundRotateHeadPacket; @@ -62,7 +61,7 @@ public static EntityPlayerMPFake createFake(String username, MinecraftServer ser SkullBlockEntity.updateGameprofile(gameprofile, result::set); gameprofile = result.get(); } - EntityPlayerMPFake instance = new EntityPlayerMPFake(server, worldIn, gameprofile, false, RemoteChatSession.UNVERIFIED); + EntityPlayerMPFake instance = new EntityPlayerMPFake(server, worldIn, gameprofile, false); instance.fixStartingPosition = () -> instance.moveTo(d0, d1, d2, (float) yaw, (float) pitch); server.getPlayerList().placeNewPlayer(new FakeClientConnection(PacketFlow.SERVERBOUND), instance); instance.teleportTo(worldIn, d0, d1, d2, (float)yaw, (float)pitch); @@ -84,7 +83,8 @@ public static EntityPlayerMPFake createShadow(MinecraftServer server, ServerPlay player.connection.disconnect(Component.translatable("multiplayer.disconnect.duplicate_login")); ServerLevel worldIn = player.getLevel();//.getWorld(player.dimension); GameProfile gameprofile = player.getGameProfile(); - EntityPlayerMPFake playerShadow = new EntityPlayerMPFake(server, worldIn, gameprofile, true, player.getChatSession()); + EntityPlayerMPFake playerShadow = new EntityPlayerMPFake(server, worldIn, gameprofile, true); + playerShadow.setChatSession(player.getChatSession()); server.getPlayerList().placeNewPlayer(new FakeClientConnection(PacketFlow.SERVERBOUND), playerShadow); playerShadow.setHealth(player.getHealth()); @@ -102,9 +102,9 @@ public static EntityPlayerMPFake createShadow(MinecraftServer server, ServerPlay return playerShadow; } - private EntityPlayerMPFake(MinecraftServer server, ServerLevel worldIn, GameProfile profile, boolean shadow, RemoteChatSession chatSession) + private EntityPlayerMPFake(MinecraftServer server, ServerLevel worldIn, GameProfile profile, boolean shadow) { - super(server, worldIn, profile, chatSession); + super(server, worldIn, profile); isAShadow = shadow; } diff --git a/src/main/java/carpet/script/api/WorldAccess.java b/src/main/java/carpet/script/api/WorldAccess.java index 52620ba411..71819e3a5c 100644 --- a/src/main/java/carpet/script/api/WorldAccess.java +++ b/src/main/java/carpet/script/api/WorldAccess.java @@ -988,7 +988,7 @@ else throw new InternalExpressionException("Attacking entity needs to be a livin // copy of ServerWorld.createExplosion #TRACK# Explosion explosion = new Explosion(cc.s.getLevel(), source, null, null, pos.x, pos.y, pos.z, powah, createFire, mode){ @Override - public @Nullable LivingEntity getSourceMob() { + public @Nullable LivingEntity getIndirectSourceEntity() { return theAttacker; } }; diff --git a/src/main/java/carpet/script/utils/ShapesRenderer.java b/src/main/java/carpet/script/utils/ShapesRenderer.java index 4b06c04b57..9878c568d4 100644 --- a/src/main/java/carpet/script/utils/ShapesRenderer.java +++ b/src/main/java/carpet/script/utils/ShapesRenderer.java @@ -13,7 +13,7 @@ import com.mojang.blaze3d.vertex.VertexConsumer; import com.mojang.blaze3d.vertex.VertexFormat; import com.mojang.blaze3d.vertex.VertexFormat.Mode; -import com.mojang.math.Vector3f; +import com.mojang.math.Axis; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; import java.util.HashMap; import java.util.Locale; @@ -283,9 +283,9 @@ public void renderLines(PoseStack matrices, Tesselator tessellator, BufferBuilde matrices.translate(v1.x - cx, v1.y - cy, v1.z - cz); ShapeDirection.rotatePoseStackByShapeDirection(matrices, shape.facing, camera1, isitem ? v1 : v1.add(0.5, 0.5, 0.5)); - if (shape.tilt != 0.0f) matrices.mulPose(Vector3f.ZP.rotationDegrees(-shape.tilt)); - if (shape.lean != 0.0f) matrices.mulPose(Vector3f.XP.rotationDegrees(-shape.lean)); - if (shape.turn != 0.0f) matrices.mulPose(Vector3f.YP.rotationDegrees( shape.turn)); + if (shape.tilt != 0.0f) matrices.mulPose(Axis.ZP.rotationDegrees(-shape.tilt)); + if (shape.lean != 0.0f) matrices.mulPose(Axis.XP.rotationDegrees(-shape.lean)); + if (shape.turn != 0.0f) matrices.mulPose(Axis.YP.rotationDegrees( shape.turn)); matrices.scale(shape.scaleX, shape.scaleY, shape.scaleZ); if (!isitem) @@ -295,7 +295,7 @@ public void renderLines(PoseStack matrices, Tesselator tessellator, BufferBuilde } else { // items seems to be flipped by default - matrices.mulPose(Vector3f.YP.rotationDegrees(180)); + matrices.mulPose(Axis.YP.rotationDegrees(180)); } RenderSystem.depthMask(true); @@ -447,9 +447,9 @@ public void renderLines(PoseStack matrices, Tesselator tessellator, BufferBuilde matrices.scale(shape.size* 0.0025f, -shape.size*0.0025f, shape.size*0.0025f); //RenderSystem.scalef(shape.size* 0.0025f, -shape.size*0.0025f, shape.size*0.0025f); - if (shape.tilt!=0.0f) matrices.mulPose(Vector3f.ZP.rotationDegrees(shape.tilt)); - if (shape.lean!=0.0f) matrices.mulPose(Vector3f.XP.rotationDegrees(shape.lean)); - if (shape.turn!=0.0f) matrices.mulPose(Vector3f.YP.rotationDegrees(shape.turn)); + if (shape.tilt!=0.0f) matrices.mulPose(Axis.ZP.rotationDegrees(shape.tilt)); + if (shape.lean!=0.0f) matrices.mulPose(Axis.XP.rotationDegrees(shape.lean)); + if (shape.turn!=0.0f) matrices.mulPose(Axis.YP.rotationDegrees(shape.turn)); matrices.translate(-10*shape.indent, -10*shape.height-9, (-10*renderEpsilon)-10*shape.raise); //if (visibleThroughWalls) RenderSystem.disableDepthTest(); matrices.scale(-1, 1, 1); diff --git a/src/main/java/carpet/script/utils/shapes/ShapeDirection.java b/src/main/java/carpet/script/utils/shapes/ShapeDirection.java index b1a7fcaa0f..1836c3b97d 100644 --- a/src/main/java/carpet/script/utils/shapes/ShapeDirection.java +++ b/src/main/java/carpet/script/utils/shapes/ShapeDirection.java @@ -1,7 +1,7 @@ package carpet.script.utils.shapes; import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.math.Vector3f; +import com.mojang.math.Axis; import net.minecraft.client.Camera; import net.minecraft.world.phys.Vec3; @@ -34,11 +34,11 @@ public static ShapeDirection fromString(String direction) { public static void rotatePoseStackByShapeDirection(PoseStack poseStack, ShapeDirection shapeDirection, Camera camera, Vec3 objectPos) { switch (shapeDirection) { case NORTH -> {} - case SOUTH -> poseStack.mulPose(Vector3f.YP.rotationDegrees(180)); - case EAST -> poseStack.mulPose(Vector3f.YP.rotationDegrees(270)); - case WEST -> poseStack.mulPose(Vector3f.YP.rotationDegrees(90)); - case UP -> poseStack.mulPose(Vector3f.XP.rotationDegrees(90)); - case DOWN -> poseStack.mulPose(Vector3f.XP.rotationDegrees(-90)); + case SOUTH -> poseStack.mulPose(Axis.YP.rotationDegrees(180)); + case EAST -> poseStack.mulPose(Axis.YP.rotationDegrees(270)); + case WEST -> poseStack.mulPose(Axis.YP.rotationDegrees(90)); + case UP -> poseStack.mulPose(Axis.XP.rotationDegrees(90)); + case DOWN -> poseStack.mulPose(Axis.XP.rotationDegrees(-90)); case CAMERA -> poseStack.mulPose(camera.rotation()); case PLAYER -> { final Vec3 vector = objectPos.subtract(camera.getPosition()); @@ -52,8 +52,8 @@ public static void rotatePoseStackByShapeDirection(PoseStack poseStack, ShapeDir // that should work somehow but it doesn't for some reason //matrices.mulPose(new Quaternion( -rotY, rotX, 0, false)); - poseStack.mulPose(Vector3f.YP.rotation(rotX)); - poseStack.mulPose(Vector3f.XP.rotation(-rotY)); + poseStack.mulPose(Axis.YP.rotation(rotX)); + poseStack.mulPose(Axis.XP.rotation(-rotY)); } } }