22w43a
This commit is contained in:
1 parent
1c2b1dfa2a
commit
e0b6aae07b
9 files changed
+30
-30
No files matched your search
@@ -205,7 +205,7 @@ public class OptimizedExplosion
|
||||
|
||||
// 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 class OptimizedExplosion
|
||||
ObjectArrayList<Pair<ItemStack, BlockPos>> objectArrayList = new ObjectArrayList<>();
|
||||
Util.shuffle((ObjectArrayList<BlockPos>) 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())
|
||||
{
|
||||
|
||||
@@ -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 @@ public abstract class Explosion_scarpetEventMixin
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,6 @@ package carpet.mixins;
|
||||
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.LightTexture;
|
||||
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;
|
||||
|
||||
@@ -25,7 +25,7 @@ public abstract class ServerPlayer_actionPackMixin implements ServerPlayerEntity
|
||||
}
|
||||
|
||||
@Inject(method = "<init>", 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);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import carpet.CarpetSettings;
|
||||
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 class EntityPlayerMPFake extends ServerPlayer
|
||||
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 class EntityPlayerMPFake extends ServerPlayer
|
||||
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 class EntityPlayerMPFake extends ServerPlayer
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -988,7 +988,7 @@ public class WorldAccess {
|
||||
// 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;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -13,7 +13,7 @@ import com.mojang.blaze3d.vertex.Tesselator;
|
||||
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 class ShapesRenderer
|
||||
|
||||
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 class ShapesRenderer
|
||||
}
|
||||
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 class ShapesRenderer
|
||||
|
||||
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);
|
||||
|
||||
@@ -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 enum ShapeDirection {
|
||||
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 enum ShapeDirection {
|
||||
// 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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user