24w05a
This commit is contained in:
1 parent
14d2c1bcd7
commit
dcb45c93b8
17 files changed
+46
-37
No files matched your search
@@ -152,7 +152,7 @@ public class Entities
|
||||
}
|
||||
if (!hasTag && entity instanceof final Mob mob)
|
||||
{
|
||||
mob.finalizeSpawn(serverWorld, serverWorld.getCurrentDifficultyAt(entity.blockPosition()), MobSpawnType.COMMAND, null, null);
|
||||
mob.finalizeSpawn(serverWorld, serverWorld.getCurrentDifficultyAt(entity.blockPosition()), MobSpawnType.COMMAND, null);
|
||||
}
|
||||
if (!serverWorld.tryAddFreshEntityWithPassengers(entity))
|
||||
{
|
||||
|
||||
@@ -827,7 +827,7 @@ public class WorldAccess
|
||||
destTag.putInt("x", targetPos.getX());
|
||||
destTag.putInt("y", targetPos.getY());
|
||||
destTag.putInt("z", targetPos.getZ());
|
||||
be.load(destTag);
|
||||
be.load(destTag, world.registryAccess());
|
||||
be.setChanged();
|
||||
success = true;
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ public abstract class CommandArgument
|
||||
),
|
||||
// operation // not sure if we need it, you have scarpet for that
|
||||
new VanillaUnconfigurableArgument("particle", ParticleArgument::particle,
|
||||
(c, p) -> ValueConversions.of(ParticleArgument.getParticle(c, p)), (c, b) -> SharedSuggestionProvider.suggestResource(c.getSource().getServer().registryAccess().registryOrThrow(Registries.PARTICLE_TYPE).keySet(), b)
|
||||
(c, p) -> ValueConversions.of(ParticleArgument.getParticle(c, p), c.getSource().registryAccess()), (c, b) -> SharedSuggestionProvider.suggestResource(c.getSource().getServer().registryAccess().registryOrThrow(Registries.PARTICLE_TYPE).keySet(), b)
|
||||
),
|
||||
|
||||
// resource / identifier section
|
||||
|
||||
@@ -3,9 +3,8 @@ package carpet.script.utils;
|
||||
import com.mojang.brigadier.StringReader;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import net.minecraft.commands.arguments.ParticleArgument;
|
||||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.core.particles.ParticleOptions;
|
||||
import net.minecraft.core.particles.ParticleType;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.HashMap;
|
||||
@@ -15,7 +14,7 @@ public class ParticleParser
|
||||
{
|
||||
private static final Map<String, ParticleOptions> particleCache = new HashMap<>(); // we reset this on reloads, but probably need something better
|
||||
|
||||
private static ParticleOptions parseParticle(String name, HolderLookup<ParticleType<?>> lookup)
|
||||
private static ParticleOptions parseParticle(String name, RegistryAccess lookup)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -28,7 +27,7 @@ public class ParticleParser
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static ParticleOptions getEffect(@Nullable String name, HolderLookup<ParticleType<?>> lookup)
|
||||
public static ParticleOptions getEffect(@Nullable String name, RegistryAccess lookup)
|
||||
{
|
||||
if (name == null)
|
||||
{
|
||||
|
||||
@@ -185,7 +185,7 @@ public class ShapeDispatcher
|
||||
{
|
||||
try
|
||||
{
|
||||
return ParticleParser.getEffect(name, regs.lookupOrThrow(Registries.PARTICLE_TYPE));
|
||||
return ParticleParser.getEffect(name, regs);
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
|
||||
@@ -54,6 +54,8 @@ import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.entity.ShulkerBoxBlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import org.joml.Matrix4f;
|
||||
import org.joml.Matrix4fStack;
|
||||
|
||||
public class ShapesRenderer
|
||||
{
|
||||
@@ -110,9 +112,12 @@ public class ShapesRenderer
|
||||
labels = new HashMap<>();
|
||||
}
|
||||
|
||||
public void render(PoseStack matrices, Camera camera, float partialTick)
|
||||
public void render(Matrix4f modelViewMatrix, Camera camera, float partialTick)
|
||||
{
|
||||
Runnable token = Carpet.startProfilerSection("Scarpet client");
|
||||
// posestack is not needed anymore - left as TODO to cleanup later
|
||||
PoseStack matrices = new PoseStack();
|
||||
|
||||
//Camera camera = this.client.gameRenderer.getCamera();
|
||||
ClientLevel iWorld = this.client.level;
|
||||
ResourceKey<Level> dimensionType = iWorld.dimension();
|
||||
@@ -151,9 +156,9 @@ public class ShapesRenderer
|
||||
shapes.get(dimensionType).long2ObjectEntrySet().removeIf(
|
||||
entry -> entry.getValue().isExpired(currentTime)
|
||||
);
|
||||
PoseStack matrixStack = RenderSystem.getModelViewStack();
|
||||
matrixStack.pushPose();
|
||||
matrixStack.mulPoseMatrix(matrices.last().pose());
|
||||
Matrix4fStack matrixStack = RenderSystem.getModelViewStack();
|
||||
matrixStack.pushMatrix();
|
||||
matrixStack.mul(matrices.last().pose());
|
||||
RenderSystem.applyModelViewMatrix();
|
||||
|
||||
// lines
|
||||
@@ -173,7 +178,7 @@ public class ShapesRenderer
|
||||
}
|
||||
});
|
||||
RenderSystem.lineWidth(1.0F);
|
||||
matrixStack.popPose();
|
||||
matrixStack.popMatrix();
|
||||
RenderSystem.applyModelViewMatrix();
|
||||
|
||||
}
|
||||
@@ -428,7 +433,7 @@ public class ShapesRenderer
|
||||
BlockEntity.setLevel(client.level);
|
||||
if (shape.blockEntity != null)
|
||||
{
|
||||
BlockEntity.load(shape.blockEntity);
|
||||
BlockEntity.load(shape.blockEntity, client.level.registryAccess());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ public class BlockValue extends Value
|
||||
data = new CompoundTag();
|
||||
return null;
|
||||
}
|
||||
data = be.saveWithoutMetadata();
|
||||
data = be.saveWithoutMetadata(be.getLevel().registryAccess());
|
||||
return data;
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -355,7 +355,7 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa
|
||||
{
|
||||
return customTag == null ? res : new ItemInput(Holder.direct(res.getItem()), customTag);
|
||||
}
|
||||
ItemParser.ItemResult parser = ItemParser.parseForItem(regs.lookupOrThrow(Registries.ITEM), new StringReader(itemString));
|
||||
ItemParser.ItemResult parser = (new ItemParser(regs)).parse(new StringReader(itemString));
|
||||
res = new ItemInput(parser.item(), parser.nbt());
|
||||
|
||||
itemCache.put(itemString, res);
|
||||
|
||||
@@ -134,9 +134,9 @@ public class ValueConversions
|
||||
}
|
||||
|
||||
|
||||
public static Value of(ParticleOptions particle)
|
||||
public static Value of(ParticleOptions particle, RegistryAccess regs)
|
||||
{
|
||||
String repr = particle.writeToString();
|
||||
String repr = particle.writeToString(regs);
|
||||
return StringValue.of(repr.startsWith("minecraft:") ? repr.substring(10) : repr);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user