From d11586fdafd12264e1fcf5ec7b90c5e8ddeebd50 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Sun, 18 Aug 2024 19:10:40 +0200 Subject: [PATCH 001/232] update to 24w33a --- gradle.properties | 6 +- .../carpet/commands/PerimeterInfoCommand.java | 3 +- ...DefaultRedstoneWireEvaluatorInferface.java | 10 + .../carpet/fakes/IngredientInterface.java | 2 +- .../java/carpet/helpers/BlockRotator.java | 2 +- .../helpers/EntityPlayerActionPack.java | 8 +- .../java/carpet/helpers/HopperCounter.java | 18 +- .../carpet/helpers/OptimizedExplosion.java | 447 +----------------- .../carpet/helpers/RedstoneWireTurbo.java | 2 +- ...actCauldronBlock_stackableSBoxesMixin.java | 8 +- .../AbstractCraftingMenu_scarpetMixin.java | 22 + ... => AbstractFurnaceMenu_scarpetMixin.java} | 15 +- ...rierBlock_updateSuppressionBlockMixin.java | 7 +- .../ClientPacketListener_explosionMixin.java | 49 ++ ...ltRedstoneWireEvaluator_redstoneMixin.java | 20 + .../carpet/mixins/DispenserBlock_qcMixin.java | 3 +- .../java/carpet/mixins/ExplosionAccessor.java | 27 +- .../mixins/Explosion_optimizedTntMixin.java | 68 ++- .../mixins/Explosion_scarpetEventMixin.java | 52 +- ...lowingFluid_liquidDamageDisabledMixin.java | 4 +- .../Guardian_renewableSpongesMixin.java | 6 +- .../mixins/Ingredient_scarpetMixin.java | 15 +- .../LevelRenderer_scarpetRenderMixin.java | 29 +- .../carpet/mixins/Level_movableBEMixin.java | 11 +- .../mixins/LivingEntity_creativeFlyMixin.java | 5 +- ...MinecraftServer_pingPlayerSampleLimit.java | 2 +- .../mixins/MinecraftServer_scarpetMixin.java | 2 +- .../MinecraftServer_tickspeedMixin.java | 24 +- .../carpet/mixins/NaturalSpawnerMixin.java | 27 +- .../mixins/PickaxeItem_missingToolsMixin.java | 8 +- .../mixins/RecipeManager_scarpetMixin.java | 7 +- .../mixins/RedstoneWireBlock_fastMixin.java | 48 +- .../carpet/mixins/ServerChunkCacheMixin.java | 4 +- .../ServerChunkCache_profilerMixin.java | 41 +- ...PacketListenerImpl_scarpetEventsMixin.java | 10 +- .../mixins/ServerLevel_scarpetMixin.java | 10 +- .../ServerPlayerGameMode_cactusMixin.java | 8 +- .../ServerPlayer_scarpetEventMixin.java | 10 - .../carpet/mixins/ShulkerBoxAccessMixin.java | 5 - .../mixins/SummonCommand_lightningMixin.java | 3 +- .../carpet/patches/EntityPlayerMPFake.java | 4 +- .../java/carpet/script/CarpetEventServer.java | 14 +- src/main/java/carpet/script/api/Entities.java | 8 +- .../java/carpet/script/api/Inventories.java | 28 +- .../java/carpet/script/api/WorldAccess.java | 20 +- .../java/carpet/script/external/Vanilla.java | 6 - .../carpet/script/external/VanillaClient.java | 8 - .../java/carpet/script/utils/BiomeInfo.java | 4 +- .../carpet/script/utils/FeatureGenerator.java | 9 +- .../carpet/script/utils/ShapesRenderer.java | 59 +-- .../java/carpet/script/utils/SystemInfo.java | 2 +- .../java/carpet/script/value/EntityValue.java | 6 +- .../carpet/script/value/ValueConversions.java | 6 + src/main/java/carpet/utils/BlockInfo.java | 4 +- .../carpet/utils/PerimeterDiagnostics.java | 6 +- src/main/java/carpet/utils/SpawnReporter.java | 12 +- src/main/resources/carpet.accesswidener | 2 +- src/main/resources/carpet.mixins.json | 8 +- 58 files changed, 379 insertions(+), 875 deletions(-) create mode 100644 src/main/java/carpet/fakes/DefaultRedstoneWireEvaluatorInferface.java create mode 100644 src/main/java/carpet/mixins/AbstractCraftingMenu_scarpetMixin.java rename src/main/java/carpet/mixins/{RecipeBookMenu_scarpetMixin.java => AbstractFurnaceMenu_scarpetMixin.java} (53%) create mode 100644 src/main/java/carpet/mixins/ClientPacketListener_explosionMixin.java create mode 100644 src/main/java/carpet/mixins/DefaultRedstoneWireEvaluator_redstoneMixin.java diff --git a/gradle.properties b/gradle.properties index d4f14a65..d51b5441 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,10 +3,10 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=1.21.1 + minecraft_version=24w33a loader_version=0.15.11 jsr305_version=3.0.2 - fabric_version=0.99.2+1.21 + fabric_version=0.102.0+1.21 # Mod Properties mod_version = 1.4.147 @@ -17,7 +17,7 @@ org.gradle.jvmargs=-Xmx1G # The Curseforge versions "names" or ids for the main branch (comma separated: 1.16.4,1.16.5) # This is needed because CF uses too vague names for prereleases and release candidates # Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN] - release-curse-versions = Minecraft 1.21.1:1.21.1 + release-curse-versions = Minecraft 1.21.2:1.21.2-Snapshot # Whether or not to build another branch on release release-extra-branch = false # The name of the second branch to release diff --git a/src/main/java/carpet/commands/PerimeterInfoCommand.java b/src/main/java/carpet/commands/PerimeterInfoCommand.java index bc478095..762277e9 100644 --- a/src/main/java/carpet/commands/PerimeterInfoCommand.java +++ b/src/main/java/carpet/commands/PerimeterInfoCommand.java @@ -14,6 +14,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.registries.Registries; import net.minecraft.nbt.CompoundTag; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; @@ -54,7 +55,7 @@ public class PerimeterInfoCommand if (mobId != null) { nbttagcompound.putString("id", mobId); - Entity baseEntity = EntityType.loadEntityRecursive(nbttagcompound, source.getLevel(), (entity_1x) -> { + Entity baseEntity = EntityType.loadEntityRecursive(nbttagcompound, source.getLevel(), EntitySpawnReason.COMMAND, (entity_1x) -> { entity_1x.moveTo(new BlockPos(pos.getX(), source.getLevel().getMinBuildHeight()-10, pos.getZ()), entity_1x.getYRot(), entity_1x. getXRot()); return !source.getLevel().addWithUUID(entity_1x) ? null : entity_1x; }); diff --git a/src/main/java/carpet/fakes/DefaultRedstoneWireEvaluatorInferface.java b/src/main/java/carpet/fakes/DefaultRedstoneWireEvaluatorInferface.java new file mode 100644 index 00000000..b394aaf7 --- /dev/null +++ b/src/main/java/carpet/fakes/DefaultRedstoneWireEvaluatorInferface.java @@ -0,0 +1,10 @@ +package carpet.fakes; + +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; + + +public interface DefaultRedstoneWireEvaluatorInferface +{ + int calculateTargetStrengthCM(final Level level, final BlockPos pos); +} diff --git a/src/main/java/carpet/fakes/IngredientInterface.java b/src/main/java/carpet/fakes/IngredientInterface.java index f6d93854..22ef94e3 100644 --- a/src/main/java/carpet/fakes/IngredientInterface.java +++ b/src/main/java/carpet/fakes/IngredientInterface.java @@ -10,5 +10,5 @@ public interface IngredientInterface * Gets all the stacks of the ingredients for a given item recipe. Also used for {@link carpet.helpers.HopperCounter#guessColor} * to guess the colour of an item to display it prettily */ - List> getRecipeStacks(); + //List> getRecipeStacks(); } diff --git a/src/main/java/carpet/helpers/BlockRotator.java b/src/main/java/carpet/helpers/BlockRotator.java index a815c8da..8584148f 100644 --- a/src/main/java/carpet/helpers/BlockRotator.java +++ b/src/main/java/carpet/helpers/BlockRotator.java @@ -100,7 +100,7 @@ public class BlockRotator } } // Send block update to the block that just have been rotated. - world.neighborChanged(blockpos, block, source.pos()); + world.neighborChanged(blockpos, block, null); return stack; } diff --git a/src/main/java/carpet/helpers/EntityPlayerActionPack.java b/src/main/java/carpet/helpers/EntityPlayerActionPack.java index e0601ea2..f87c302c 100644 --- a/src/main/java/carpet/helpers/EntityPlayerActionPack.java +++ b/src/main/java/carpet/helpers/EntityPlayerActionPack.java @@ -11,7 +11,7 @@ import carpet.script.utils.Tracer; import net.minecraft.commands.arguments.EntityAnchorArgument; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; -import net.minecraft.network.protocol.game.ClientboundSetCarriedItemPacket; +import net.minecraft.network.protocol.game.ClientboundSetHeldSlotPacket; import net.minecraft.network.protocol.game.ServerboundPlayerActionPacket; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; @@ -282,7 +282,7 @@ public class EntityPlayerActionPack public void setSlot(int slot) { player.getInventory().selected = slot-1; - player.connection.send(new ClientboundSetCarriedItemPacket(slot-1)); + player.connection.send(new ClientboundSetHeldSlotPacket(slot-1)); } public enum ActionType @@ -317,9 +317,9 @@ public class EntityPlayerActionPack if (pos.getY() < player.level().getMaxBuildHeight() - (side == Direction.UP ? 1 : 0) && world.mayInteract(player, pos)) { InteractionResult result = player.gameMode.useItemOn(player, world, player.getItemInHand(hand), hand, blockHit); - if (result.consumesAction()) + if (result instanceof InteractionResult.Success success) { - if (result.shouldSwing()) player.swing(hand); + if (success.swingSource() == InteractionResult.SwingSource.SERVER) player.swing(hand); ap.itemUseCooldown = 3; return true; } diff --git a/src/main/java/carpet/helpers/HopperCounter.java b/src/main/java/carpet/helpers/HopperCounter.java index 3e419e83..dc140240 100644 --- a/src/main/java/carpet/helpers/HopperCounter.java +++ b/src/main/java/carpet/helpers/HopperCounter.java @@ -1,7 +1,6 @@ package carpet.helpers; import carpet.CarpetServer; -import carpet.fakes.IngredientInterface; import carpet.fakes.RecipeManagerInterface; import carpet.utils.Messenger; import it.unimi.dsi.fastutil.objects.Object2LongLinkedOpenHashMap; @@ -22,7 +21,7 @@ import net.minecraft.world.item.DyeItem; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; -import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.item.crafting.PlacementInfo; import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.item.crafting.RecipeType; import net.minecraft.world.level.block.AbstractBannerBlock; @@ -32,12 +31,12 @@ import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.material.MapColor; import java.util.ArrayList; -import java.util.Collection; import java.util.Collections; import java.util.EnumMap; import java.util.List; import java.util.Locale; import java.util.Map; +import java.util.Optional; import java.util.stream.Collectors; import static java.util.Map.entry; @@ -376,16 +375,13 @@ public class HopperCounter { for (Recipe r: ((RecipeManagerInterface) CarpetServer.minecraft_server.getRecipeManager()).getAllMatching(type, id, registryAccess)) { - for (Ingredient ingredient: r.getIngredients()) + for (Optional ingredient: r.placementInfo().slotInfo()) { - for (Collection stacks : ((IngredientInterface) (Object) ingredient).getRecipeStacks()) + for(ItemStack stack : ingredient.get().possibleItems()) { - for (ItemStack iStak : stacks) - { - TextColor cand = fromItem(iStak.getItem(), registryAccess); - if (cand != null) - return cand; - } + TextColor cand = fromItem(stack.getItem(), registryAccess); + if (cand != null) + return cand; } } } diff --git a/src/main/java/carpet/helpers/OptimizedExplosion.java b/src/main/java/carpet/helpers/OptimizedExplosion.java index 63bc00b9..f35b6027 100644 --- a/src/main/java/carpet/helpers/OptimizedExplosion.java +++ b/src/main/java/carpet/helpers/OptimizedExplosion.java @@ -1,80 +1,39 @@ package carpet.helpers; //Author: masa -import java.math.RoundingMode; -import java.text.NumberFormat; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import net.minecraft.Util; import net.minecraft.core.BlockPos; -import net.minecraft.core.particles.ParticleTypes; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.sounds.SoundEvents; -import net.minecraft.sounds.SoundSource; -import net.minecraft.util.Mth; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.ai.attributes.Attributes; -import net.minecraft.world.entity.item.ItemEntity; -import net.minecraft.world.entity.item.PrimedTnt; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Explosion; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.chunk.ChunkAccess; import net.minecraft.world.level.material.FluidState; -import net.minecraft.world.level.storage.loot.LootParams; -import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; import carpet.logging.logHelpers.ExplosionLogHelper; import carpet.mixins.ExplosionAccessor; import carpet.CarpetSettings; -import carpet.utils.Messenger; import it.unimi.dsi.fastutil.objects.Object2DoubleOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import it.unimi.dsi.fastutil.objects.ObjectArrayList; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; -import org.apache.commons.lang3.tuple.MutablePair; import org.apache.commons.lang3.tuple.Pair; -import static carpet.script.CarpetEventServer.Event.EXPLOSION_OUTCOME; - public class OptimizedExplosion { - private static List entitylist; - private static Vec3 vec3dmem; - private static long tickmem; - // For disabling the explosion particles and sound - public static int explosionSound = 0; - // masa's optimizations private static Object2DoubleOpenHashMap> densityCache = new Object2DoubleOpenHashMap<>(); - private static MutablePair pairMutable = new MutablePair<>(); private static Object2ObjectOpenHashMap stateCache = new Object2ObjectOpenHashMap<>(); private static Object2ObjectOpenHashMap fluidCache = new Object2ObjectOpenHashMap<>(); private static BlockPos.MutableBlockPos posMutable = new BlockPos.MutableBlockPos(0, 0, 0); private static ObjectOpenHashSet affectedBlockPositionsSet = new ObjectOpenHashSet<>(); private static boolean firstRay; private static boolean rayCalcDone; - private static ArrayList chances = new ArrayList<>(); - private static BlockPos blastChanceLocation; - // Creating entity list for scarpet event - private static List entityList = new ArrayList<>(); - - public static void doExplosionA(Explosion e, ExplosionLogHelper eLogger) { + public static List doExplosionA(Explosion e, ExplosionLogHelper eLogger) { ExplosionAccessor eAccess = (ExplosionAccessor) e; - - entityList.clear(); - boolean eventNeeded = EXPLOSION_OUTCOME.isNeeded() && !eAccess.getLevel().isClientSide(); - blastCalc(e); + + List toBlow; if (!CarpetSettings.explosionNoBlockDamage && eAccess.getDamageSource() != null) { rayCalcDone = false; @@ -88,291 +47,14 @@ public class OptimizedExplosion stateCache.clear(); fluidCache.clear(); - e.getToBlow().addAll(affectedBlockPositionsSet); + toBlow = new ArrayList<>(affectedBlockPositionsSet); affectedBlockPositionsSet.clear(); + } else { + toBlow = Collections.emptyList(); } - - float f3 = eAccess.getRadius() * 2.0F; - int k1 = Mth.floor(eAccess.getX() - (double) f3 - 1.0D); - int l1 = Mth.floor(eAccess.getX() + (double) f3 + 1.0D); - int i2 = Mth.floor(eAccess.getY() - (double) f3 - 1.0D); - int i1 = Mth.floor(eAccess.getY() + (double) f3 + 1.0D); - int j2 = Mth.floor(eAccess.getZ() - (double) f3 - 1.0D); - int j1 = Mth.floor(eAccess.getZ() + (double) f3 + 1.0D); - Vec3 vec3d = new Vec3(eAccess.getX(), eAccess.getY(), eAccess.getZ()); - - if (vec3dmem == null || !vec3dmem.equals(vec3d) || tickmem != eAccess.getLevel().getGameTime()) { - vec3dmem = vec3d; - tickmem = eAccess.getLevel().getGameTime(); - entitylist = eAccess.getLevel().getEntities(null, new AABB(k1, i2, j2, l1, i1, j1)); - explosionSound = 0; - } - - explosionSound++; - - Entity explodingEntity = eAccess.getSource(); - for (int k2 = 0; k2 < entitylist.size(); ++k2) { - Entity entity = entitylist.get(k2); - - - if (entity == explodingEntity) { - // entitylist.remove(k2); - removeFast(entitylist, k2); - k2--; - continue; - } - - if (entity instanceof PrimedTnt && explodingEntity != null && - entity.getX() == explodingEntity.getX() && - entity.getY() == explodingEntity.getY() && - entity.getZ() == explodingEntity.getZ()) { - if (eLogger != null) { - eLogger.onEntityImpacted(entity, new Vec3(0,-0.9923437498509884d, 0)); - } - continue; - } - - if (!entity.ignoreExplosion(e)) { - double d12 = Math.sqrt(entity.distanceToSqr(eAccess.getX(), eAccess.getY(), eAccess.getZ())) / (double) f3; - - if (d12 <= 1.0D) { - double d5 = entity.getX() - eAccess.getX(); - // Change in 1.16 snapshots to fix a bug with TNT jumping - double d7 = (entity instanceof PrimedTnt ? entity.getY() : entity.getEyeY()) - eAccess.getY(); - double d9 = entity.getZ() - eAccess.getZ(); - double d13 = (double) Math.sqrt(d5 * d5 + d7 * d7 + d9 * d9); - - if (d13 != 0.0D) { - d5 = d5 / d13; - d7 = d7 / d13; - d9 = d9 / d13; - double density; - - pairMutable.setLeft(vec3d); - pairMutable.setRight(entity.getBoundingBox()); - density = densityCache.getOrDefault(pairMutable, Double.MAX_VALUE); - - if (density == Double.MAX_VALUE) - { - Pair pair = Pair.of(vec3d, entity.getBoundingBox()); - density = Explosion.getSeenPercent(vec3d, entity); - densityCache.put(pair, density); - } - - // If it is needed, it saves the entity - if (eventNeeded) { - entityList.add(entity); - } - - double d10 = (1.0D - d12) * density; - if (eAccess.getDamageSource() != null) - { - entity.hurt(eAccess.getDamageSource(), - (float) ((int) ((d10 * d10 + d10) / 2.0D * 7.0D * (double) f3 + 1.0D))); - } - double d11 = d10; - - if (entity instanceof LivingEntity lev) { - d11 = d10 * Mth.clamp(1.0 - lev.getAttributeValue(Attributes.EXPLOSION_KNOCKBACK_RESISTANCE), 0.0, 1.0); - } - - if (eLogger != null) { - eLogger.onEntityImpacted(entity, new Vec3(d5 * d11, d7 * d11, d9 * d11)); - } - - entity.setDeltaMovement(entity.getDeltaMovement().add(d5 * d11, d7 * d11, d9 * d11)); - - if (entity instanceof Player player) { - - if (!player.isSpectator() - && (!player.isCreative() || !player.getAbilities().flying)) { //getAbilities - e.getHitPlayers().put(player, new Vec3(d5 * d10, d7 * d10, d9 * d10)); - } - } - } - } - } - } - densityCache.clear(); - } - public static void doExplosionB(Explosion e, boolean spawnParticles) - { - ExplosionAccessor eAccess = (ExplosionAccessor) e; - Level world = eAccess.getLevel(); - double posX = eAccess.getX(); - double posY = eAccess.getY(); - double posZ = eAccess.getZ(); - - // If it is needed, calls scarpet event - if (EXPLOSION_OUTCOME.isNeeded() && !world.isClientSide()) { - 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.KEEP; - - // explosionSound incremented till disabling the explosion particles and sound - if (explosionSound < 100 || explosionSound % 100 == 0) - { - world.playSound(null, posX, posY, posZ, SoundEvents.GENERIC_EXPLODE.value(), SoundSource.BLOCKS, 4.0F, - (1.0F + (world.random.nextFloat() - world.random.nextFloat()) * 0.2F) * 0.7F); - - if (spawnParticles) - { - if (eAccess.getRadius() >= 2.0F && damagesTerrain) - { - world.addParticle(ParticleTypes.EXPLOSION_EMITTER, posX, posY, posZ, 1.0D, 0.0D, 0.0D); - } - else - { - world.addParticle(ParticleTypes.EXPLOSION, posX, posY, posZ, 1.0D, 0.0D, 0.0D); - } - } - } - - if (damagesTerrain) - { - ObjectArrayList> objectArrayList = new ObjectArrayList<>(); - Util.shuffle((ObjectArrayList) e.getToBlow(), world.random); - - boolean dropFromExplosions = CarpetSettings.xpFromExplosions || e.getIndirectSourceEntity() instanceof Player; - - for (BlockPos blockpos : e.getToBlow()) - { - BlockState state = world.getBlockState(blockpos); - Block block = state.getBlock(); - - if (!state.isAir()) - { - if (block.dropFromExplosion(e) && world instanceof ServerLevel serverLevel) - { - BlockEntity blockEntity = state.hasBlockEntity() ? world.getBlockEntity(blockpos) : null; //hasBlockEntity() - - LootParams.Builder lootBuilder = (new LootParams.Builder((ServerLevel)eAccess.getLevel())) - .withParameter(LootContextParams.ORIGIN, Vec3.atCenterOf(blockpos)) - .withParameter(LootContextParams.TOOL, ItemStack.EMPTY) - .withOptionalParameter(LootContextParams.BLOCK_ENTITY, blockEntity) - .withOptionalParameter(LootContextParams.THIS_ENTITY, eAccess.getSource()); - - if (eAccess.getBlockInteraction() == Explosion.BlockInteraction.DESTROY_WITH_DECAY) - lootBuilder.withParameter(LootContextParams.EXPLOSION_RADIUS, eAccess.getRadius()); - - state.spawnAfterBreak(serverLevel, blockpos, ItemStack.EMPTY, dropFromExplosions); - - state.getDrops(lootBuilder).forEach((itemStackx) -> { - method_24023(objectArrayList, itemStackx, blockpos.immutable()); - }); - } - - world.setBlock(blockpos, Blocks.AIR.defaultBlockState(), 3); - block.wasExploded(world, blockpos, e); - } - } - objectArrayList.forEach(p -> Block.popResource(world, p.getRight(), p.getLeft())); - - } - - if (eAccess.isFire()) - { - for (BlockPos blockpos1 : e.getToBlow()) - { - // Use the same Chunk reference because the positions are in the same xz-column - ChunkAccess chunk = world.getChunk(blockpos1.getX() >> 4, blockpos1.getZ() >> 4); - - BlockPos down = blockpos1.below(1); - if (eAccess.getRandom().nextInt(3) == 0 && - chunk.getBlockState(blockpos1).isAir() && - chunk.getBlockState(down).isSolidRender(world, down) - ) - { - world.setBlockAndUpdate(blockpos1, Blocks.FIRE.defaultBlockState()); - } - } - } - } - - // copied from Explosion, need to move the code to the explosion code anyways and use shadows for - // simplicity, its not jarmodding anyways - private static void method_24023(ObjectArrayList> objectArrayList, ItemStack itemStack, BlockPos blockPos) { - int i = objectArrayList.size(); - - for(int j = 0; j < i; ++j) { - Pair pair = objectArrayList.get(j); - ItemStack itemStack2 = pair.getLeft(); - if (ItemEntity.areMergable(itemStack2, itemStack)) { - ItemStack itemStack3 = ItemEntity.merge(itemStack2, itemStack, 16); - objectArrayList.set(j, Pair.of(itemStack3, pair.getRight())); - if (itemStack.isEmpty()) { - return; - } - } - } - - objectArrayList.add(Pair.of(itemStack, blockPos)); - } - - private static void removeFast(List lst, int index) { - if (index < lst.size() - 1) - lst.set(index, lst.get(lst.size() - 1)); - lst.remove(lst.size() - 1); - } - - private static void rayCalcs(Explosion e) { - ExplosionAccessor eAccess = (ExplosionAccessor) e; - boolean first = true; - - for (int j = 0; j < 16; ++j) { - for (int k = 0; k < 16; ++k) { - for (int l = 0; l < 16; ++l) { - if (j == 0 || j == 15 || k == 0 || k == 15 || l == 0 || l == 15) { - double d0 = (double) ((float) j / 15.0F * 2.0F - 1.0F); - double d1 = (double) ((float) k / 15.0F * 2.0F - 1.0F); - double d2 = (double) ((float) l / 15.0F * 2.0F - 1.0F); - double d3 = Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2); - d0 = d0 / d3; - d1 = d1 / d3; - d2 = d2 / d3; - float rand = eAccess.getLevel().random.nextFloat(); - if (CarpetSettings.tntRandomRange >= 0) { - rand = (float) CarpetSettings.tntRandomRange; - } - float f = eAccess.getRadius() * (0.7F + rand * 0.6F); - double d4 = eAccess.getX(); - double d6 = eAccess.getY(); - double d8 = eAccess.getZ(); - - for (float f1 = 0.3F; f > 0.0F; f -= 0.22500001F) { - BlockPos blockpos = BlockPos.containing(d4, d6, d8); - BlockState state = eAccess.getLevel().getBlockState(blockpos); - FluidState fluidState = eAccess.getLevel().getFluidState(blockpos); - - if (!state.isAir()) { - float f2 = Math.max(state.getBlock().getExplosionResistance(), fluidState.getExplosionResistance()); - if (eAccess.getSource() != null) - f2 = eAccess.getSource().getBlockExplosionResistance(e, eAccess.getLevel(), blockpos, state, fluidState, f2); - f -= (f2 + 0.3F) * 0.3F; - } - - if (f > 0.0F && (eAccess.getSource() == null || - eAccess.getSource().shouldBlockExplode(e, eAccess.getLevel(), blockpos, state, f))) - { - affectedBlockPositionsSet.add(blockpos); - } - else if (first) { - return; - } - - first = false; - - d4 += d0 * 0.30000001192092896D; - d6 += d1 * 0.30000001192092896D; - d8 += d2 * 0.30000001192092896D; - } - } - } - } - } + return toBlow; } private static void getAffectedPositionsOnPlaneX(Explosion e, int x, int yStart, int yEnd, int zStart, int zEnd) @@ -454,9 +136,10 @@ public class OptimizedExplosion float rand = eAccess.getLevel().random.nextFloat(); float sizeRand = (CarpetSettings.tntRandomRange >= 0 ? (float) CarpetSettings.tntRandomRange : rand); float size = eAccess.getRadius() * (0.7F + sizeRand * 0.6F); - double posX = eAccess.getX(); - double posY = eAccess.getY(); - double posZ = eAccess.getZ(); + Vec3 vec3 = eAccess.getCenter(); + double posX = vec3.x; + double posY = vec3.y; + double posZ = vec3.z; for (float f1 = 0.3F; size > 0.0F; size -= 0.22500001F) { @@ -508,112 +191,4 @@ public class OptimizedExplosion return false; } - - public static void setBlastChanceLocation(BlockPos p){ - blastChanceLocation = p; - } - - private static void blastCalc(Explosion e){ - ExplosionAccessor eAccess = (ExplosionAccessor) e; - if(blastChanceLocation == null || blastChanceLocation.distToLowCornerSqr(eAccess.getX(), eAccess.getY(), eAccess.getZ()) > 200) return; - chances.clear(); - for (int j = 0; j < 16; ++j) { - for (int k = 0; k < 16; ++k) { - for (int l = 0; l < 16; ++l) { - if (j == 0 || j == 15 || k == 0 || k == 15 || l == 0 || l == 15) { - double d0 = (double) ((float) j / 15.0F * 2.0F - 1.0F); - double d1 = (double) ((float) k / 15.0F * 2.0F - 1.0F); - double d2 = (double) ((float) l / 15.0F * 2.0F - 1.0F); - double d3 = Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2); - d0 = d0 / d3; - d1 = d1 / d3; - d2 = d2 / d3; - float f = eAccess.getRadius() * (0.7F + 0.6F); - double d4 = eAccess.getX(); - double d6 = eAccess.getY(); - double d8 = eAccess.getZ(); - boolean found = false; - - for (float f1 = 0.3F; f > 0.0F; f -= 0.22500001F) { - BlockPos blockpos = BlockPos.containing(d4, d6, d8); - BlockState state = eAccess.getLevel().getBlockState(blockpos); - FluidState fluidState = eAccess.getLevel().getFluidState(blockpos); - - if (!state.isAir()) { - float f2 = Math.max(state.getBlock().getExplosionResistance(), fluidState.getExplosionResistance()); - if (eAccess.getSource() != null) - f2 = eAccess.getSource().getBlockExplosionResistance(e, eAccess.getLevel(), blockpos, state, fluidState, f2); - f -= (f2 + 0.3F) * 0.3F; - } - - if (f > 0.0F && (eAccess.getSource() == null || - eAccess.getSource().shouldBlockExplode(e, eAccess.getLevel(), blockpos, state, f))) { - if(!found && blockpos.equals(blastChanceLocation)){ - chances.add(f); - found = true; - } - } - - d4 += d0 * 0.30000001192092896D; - d6 += d1 * 0.30000001192092896D; - d8 += d2 * 0.30000001192092896D; - } - } - } - } - } - - //showTNTblastChance(e); - } - - private static void showTNTblastChance(Explosion e){ - ExplosionAccessor eAccess = (ExplosionAccessor) e; - double randMax = 0.6F * eAccess.getRadius(); - double total = 0; - boolean fullyBlownUp = false; - boolean first = true; - int rays = 0; - for(float f3 : chances){ - rays++; - double calc = f3 - randMax; - if(calc > 0) fullyBlownUp = true; - double chancePerRay = (Math.abs(calc) / randMax); - if(!fullyBlownUp){ - if(first){ - first = false; - total = chancePerRay; - }else { - total = total * chancePerRay; - } - } - } - if(fullyBlownUp) total = 0; - double chance = 1 - total; - NumberFormat nf = NumberFormat.getNumberInstance(); - nf.setRoundingMode (RoundingMode.DOWN); - nf.setMaximumFractionDigits(2); - for(Player player : eAccess.getLevel().players()){ - Messenger.m(player,"w Pop: ", - "c " + nf.format(chance) + " ", - "^w Chance for the block to be destroyed by the blast: " + chance, - "?" + chance, - "w Remain: ", - String.format("c %.2f ", total), - "^w Chance the block survives the blast: " + total, - "?" + total, - "w Rays: ", - String.format("c %d ", rays), - "^w TNT blast rays going through the block", - "?" + rays, - "w Size: ", - String.format("c %.1f ", eAccess.getRadius()), - "^w TNT blast size", - "?" + eAccess.getRadius(), - "w @: ", - String.format("c [%.1f %.1f %.1f] ", eAccess.getX(), eAccess.getY(), eAccess.getZ()), - "^w TNT blast location X:" + eAccess.getX() + " Y:" + eAccess.getY() + " Z:" + eAccess.getZ(), - "?" + eAccess.getX() + " " + eAccess.getY() + " " + eAccess.getZ() - ); - } - } } diff --git a/src/main/java/carpet/helpers/RedstoneWireTurbo.java b/src/main/java/carpet/helpers/RedstoneWireTurbo.java index 30a1c37d..53bc31a2 100644 --- a/src/main/java/carpet/helpers/RedstoneWireTurbo.java +++ b/src/main/java/carpet/helpers/RedstoneWireTurbo.java @@ -676,7 +676,7 @@ public class RedstoneWireTurbo // call BlockStateBase#neighborChanged directly. This change mostly // restores old behavior, at the cost of bypassing the // max-chained-neighbor-updates server property. - worldIn.getBlockState(upd.self).handleNeighborChanged(worldIn, upd.self, wire, upd.parent, false); + worldIn.getBlockState(upd.self).handleNeighborChanged(worldIn, upd.self, wire, null, false); } } diff --git a/src/main/java/carpet/mixins/AbstractCauldronBlock_stackableSBoxesMixin.java b/src/main/java/carpet/mixins/AbstractCauldronBlock_stackableSBoxesMixin.java index 95cc0dbc..ea7ffa26 100644 --- a/src/main/java/carpet/mixins/AbstractCauldronBlock_stackableSBoxesMixin.java +++ b/src/main/java/carpet/mixins/AbstractCauldronBlock_stackableSBoxesMixin.java @@ -4,7 +4,7 @@ import carpet.CarpetSettings; import net.minecraft.core.BlockPos; import net.minecraft.core.cauldron.CauldronInteraction; import net.minecraft.world.InteractionHand; -import net.minecraft.world.ItemInteractionResult; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.ItemStack; @@ -21,14 +21,14 @@ public class AbstractCauldronBlock_stackableSBoxesMixin { @Redirect(method = "useItemOn", at = @At( value = "INVOKE", - target = "Lnet/minecraft/core/cauldron/CauldronInteraction;interact(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/InteractionHand;Lnet/minecraft/world/item/ItemStack;)Lnet/minecraft/world/ItemInteractionResult;" + target = "Lnet/minecraft/core/cauldron/CauldronInteraction;interact(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/InteractionHand;Lnet/minecraft/world/item/ItemStack;)Lnet/minecraft/world/InteractionResult;" )) - private ItemInteractionResult wrapInteractor(final CauldronInteraction cauldronBehavior, final BlockState blockState, final Level world, final BlockPos blockPos, final Player playerEntity, final InteractionHand hand, final ItemStack itemStack) + private InteractionResult wrapInteractor(final CauldronInteraction cauldronBehavior, final BlockState blockState, final Level world, final BlockPos blockPos, final Player playerEntity, final InteractionHand hand, final ItemStack itemStack) { int count = -1; if (CarpetSettings.shulkerBoxStackSize > 1 && itemStack.getItem() instanceof BlockItem && ((BlockItem)itemStack.getItem()).getBlock() instanceof ShulkerBoxBlock) count = itemStack.getCount(); - ItemInteractionResult result = cauldronBehavior.interact(blockState, world, blockPos, playerEntity, hand, itemStack); + InteractionResult result = cauldronBehavior.interact(blockState, world, blockPos, playerEntity, hand, itemStack); if (count > 0 && result.consumesAction()) { ItemStack current = playerEntity.getItemInHand(hand); diff --git a/src/main/java/carpet/mixins/AbstractCraftingMenu_scarpetMixin.java b/src/main/java/carpet/mixins/AbstractCraftingMenu_scarpetMixin.java new file mode 100644 index 00000000..2bae8f68 --- /dev/null +++ b/src/main/java/carpet/mixins/AbstractCraftingMenu_scarpetMixin.java @@ -0,0 +1,22 @@ +package carpet.mixins; + +import carpet.fakes.AbstractContainerMenuInterface; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.AbstractCraftingMenu; +import net.minecraft.world.inventory.RecipeBookMenu; +import net.minecraft.world.item.crafting.RecipeHolder; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(AbstractCraftingMenu.class) +public class AbstractCraftingMenu_scarpetMixin +{ + @Inject(method = "handlePlacement",at = @At("HEAD"), cancellable = true) + private void selectRecipeCallback(boolean craftAll, boolean b, RecipeHolder recipe, Inventory player, CallbackInfoReturnable cir) { + if(((AbstractContainerMenuInterface) this).callSelectRecipeListener((ServerPlayer) player.player ,recipe,craftAll)) + cir.setReturnValue(RecipeBookMenu.PostPlaceAction.NOTHING); + } +} diff --git a/src/main/java/carpet/mixins/RecipeBookMenu_scarpetMixin.java b/src/main/java/carpet/mixins/AbstractFurnaceMenu_scarpetMixin.java similarity index 53% rename from src/main/java/carpet/mixins/RecipeBookMenu_scarpetMixin.java rename to src/main/java/carpet/mixins/AbstractFurnaceMenu_scarpetMixin.java index e28072b1..8f2facc4 100644 --- a/src/main/java/carpet/mixins/RecipeBookMenu_scarpetMixin.java +++ b/src/main/java/carpet/mixins/AbstractFurnaceMenu_scarpetMixin.java @@ -2,18 +2,21 @@ package carpet.mixins; import carpet.fakes.AbstractContainerMenuInterface; import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.AbstractFurnaceMenu; import net.minecraft.world.inventory.RecipeBookMenu; import net.minecraft.world.item.crafting.RecipeHolder; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -@Mixin(RecipeBookMenu.class) -public class RecipeBookMenu_scarpetMixin { +@Mixin(AbstractFurnaceMenu.class) +public class AbstractFurnaceMenu_scarpetMixin +{ @Inject(method = "handlePlacement",at = @At("HEAD"), cancellable = true) - private void selectRecipeCallback(boolean craftAll, RecipeHolder recipe, ServerPlayer player, CallbackInfo ci) { - if(((AbstractContainerMenuInterface) this).callSelectRecipeListener(player,recipe,craftAll)) - ci.cancel(); + private void selectRecipeCallback(boolean craftAll, boolean b, RecipeHolder recipe, Inventory player, CallbackInfoReturnable cir) { + if(((AbstractContainerMenuInterface) this).callSelectRecipeListener((ServerPlayer) player.player ,recipe,craftAll)) + cir.setReturnValue(RecipeBookMenu.PostPlaceAction.NOTHING); } } diff --git a/src/main/java/carpet/mixins/BarrierBlock_updateSuppressionBlockMixin.java b/src/main/java/carpet/mixins/BarrierBlock_updateSuppressionBlockMixin.java index a4f2cc52..81017c3b 100644 --- a/src/main/java/carpet/mixins/BarrierBlock_updateSuppressionBlockMixin.java +++ b/src/main/java/carpet/mixins/BarrierBlock_updateSuppressionBlockMixin.java @@ -4,6 +4,7 @@ import carpet.CarpetSettings; import carpet.fakes.LevelInterface; import net.minecraft.world.level.redstone.NeighborUpdater; import net.minecraft.util.RandomSource; +import net.minecraft.world.level.redstone.Orientation; import org.spongepowered.asm.mixin.Mixin; import net.minecraft.core.BlockPos; @@ -29,10 +30,10 @@ public class BarrierBlock_updateSuppressionBlockMixin extends Block { } @Override - public void neighborChanged(BlockState state, Level level, BlockPos pos, Block block, BlockPos fromPos, boolean notify) { + public void neighborChanged(BlockState state, Level level, BlockPos pos, Block block, Orientation fromPos, boolean notify) { if (CarpetSettings.updateSuppressionBlock != -1) { - if (fromPos.equals(pos.above())) { - BlockState stateAbove = level.getBlockState(fromPos); + if (true/*fromPos.equals(pos.above())*/) { // todo neighbour updates don't have source + BlockState stateAbove = level.getBlockState(pos.above()); if (stateAbove.is(Blocks.ACTIVATOR_RAIL) && !stateAbove.getValue(PoweredRailBlock.POWERED)) { level.scheduleTick(pos, this, 1); NeighborUpdater updater = ((LevelInterface)level).getNeighborUpdater(); diff --git a/src/main/java/carpet/mixins/ClientPacketListener_explosionMixin.java b/src/main/java/carpet/mixins/ClientPacketListener_explosionMixin.java new file mode 100644 index 00000000..5d50a15e --- /dev/null +++ b/src/main/java/carpet/mixins/ClientPacketListener_explosionMixin.java @@ -0,0 +1,49 @@ +package carpet.mixins; + +import carpet.CarpetSettings; +import net.minecraft.client.Minecraft; +import net.minecraft.client.multiplayer.ClientCommonPacketListenerImpl; +import net.minecraft.client.multiplayer.ClientPacketListener; +import net.minecraft.client.multiplayer.CommonListenerCookie; +import net.minecraft.network.Connection; +import net.minecraft.network.protocol.game.ClientboundExplodePacket; +import net.minecraft.world.phys.Vec3; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(ClientPacketListener.class) +public abstract class ClientPacketListener_explosionMixin extends ClientCommonPacketListenerImpl +{ + + private static Vec3 vec3dmem; + private static long tickmem; + // For disabling the explosion particles and sounds if explosions are stacking up + + protected ClientPacketListener_explosionMixin(final Minecraft minecraft, final Connection connection, final CommonListenerCookie commonListenerCookie) + { + super(minecraft, connection, commonListenerCookie); + } + + + @Inject(method = "handleExplosion", at = @At( + value = "INVOKE", + target = "Lnet/minecraft/client/multiplayer/ClientLevel;playLocalSound(DDDLnet/minecraft/sounds/SoundEvent;Lnet/minecraft/sounds/SoundSource;FFZ)V" + ), cancellable = true) + private void onHandleExplosion(final ClientboundExplodePacket clientboundExplodePacket, final CallbackInfo ci) + { + + if (CarpetSettings.optimizedTNT) + { + Vec3 vec3d = clientboundExplodePacket.center(); + long tick = minecraft.level.getGameTime(); + if (vec3dmem == null || !vec3dmem.equals(vec3d) || tickmem != tick) { + vec3dmem = vec3d; + tickmem = tick; + } else { + ci.cancel(); + } + } + } +} diff --git a/src/main/java/carpet/mixins/DefaultRedstoneWireEvaluator_redstoneMixin.java b/src/main/java/carpet/mixins/DefaultRedstoneWireEvaluator_redstoneMixin.java new file mode 100644 index 00000000..b9be2e28 --- /dev/null +++ b/src/main/java/carpet/mixins/DefaultRedstoneWireEvaluator_redstoneMixin.java @@ -0,0 +1,20 @@ +package carpet.mixins; + +import carpet.fakes.DefaultRedstoneWireEvaluatorInferface; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.redstone.DefaultRedstoneWireEvaluator; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; + +@Mixin(DefaultRedstoneWireEvaluator.class) +public abstract class DefaultRedstoneWireEvaluator_redstoneMixin implements DefaultRedstoneWireEvaluatorInferface +{ + @Shadow protected abstract int calculateTargetStrength(final Level level, final BlockPos blockPos); + + @Override + public int calculateTargetStrengthCM(final Level level, final BlockPos pos) + { + return calculateTargetStrength(level, pos); + } +} diff --git a/src/main/java/carpet/mixins/DispenserBlock_qcMixin.java b/src/main/java/carpet/mixins/DispenserBlock_qcMixin.java index 6444c1a6..958548af 100644 --- a/src/main/java/carpet/mixins/DispenserBlock_qcMixin.java +++ b/src/main/java/carpet/mixins/DispenserBlock_qcMixin.java @@ -1,5 +1,6 @@ package carpet.mixins; +import net.minecraft.world.level.redstone.Orientation; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; @@ -23,7 +24,7 @@ public class DispenserBlock_qcMixin { target = "Lnet/minecraft/world/level/Level;hasNeighborSignal(Lnet/minecraft/core/BlockPos;)Z" ) ) - private boolean carpet_hasQuasiSignal(Level _level, BlockPos above, BlockState state, Level level, BlockPos pos, Block neighborBlock, BlockPos neighborPos, boolean movedByPiston) { + private boolean carpet_hasQuasiSignal(Level _level, BlockPos above, BlockState state, Level level, BlockPos pos, Block neighborBlock, Orientation neighborPos, boolean movedByPiston) { return QuasiConnectivity.hasQuasiSignal(level, pos); } } diff --git a/src/main/java/carpet/mixins/ExplosionAccessor.java b/src/main/java/carpet/mixins/ExplosionAccessor.java index 5b0875ba..e204b241 100644 --- a/src/main/java/carpet/mixins/ExplosionAccessor.java +++ b/src/main/java/carpet/mixins/ExplosionAccessor.java @@ -1,37 +1,22 @@ package carpet.mixins; -import net.minecraft.util.RandomSource; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.level.ServerExplosion; +import net.minecraft.world.phys.Vec3; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; import net.minecraft.world.entity.Entity; -import net.minecraft.world.level.Explosion; -import net.minecraft.world.level.Level; -@Mixin(Explosion.class) +@Mixin(ServerExplosion.class) public interface ExplosionAccessor { @Accessor - boolean isFire(); + ServerLevel getLevel(); @Accessor - Explosion.BlockInteraction getBlockInteraction(); - - @Accessor - Level getLevel(); - - @Accessor - RandomSource getRandom(); - - @Accessor - double getX(); - - @Accessor - double getY(); - - @Accessor - double getZ(); + Vec3 getCenter(); @Accessor float getRadius(); diff --git a/src/main/java/carpet/mixins/Explosion_optimizedTntMixin.java b/src/main/java/carpet/mixins/Explosion_optimizedTntMixin.java index 3cf32d6c..dadd8465 100644 --- a/src/main/java/carpet/mixins/Explosion_optimizedTntMixin.java +++ b/src/main/java/carpet/mixins/Explosion_optimizedTntMixin.java @@ -4,11 +4,12 @@ import carpet.helpers.OptimizedExplosion; import carpet.CarpetSettings; import carpet.logging.LoggerRegistry; import carpet.logging.logHelpers.ExplosionLogHelper; -import it.unimi.dsi.fastutil.objects.ObjectArrayList; -import net.minecraft.core.Holder; -import net.minecraft.core.particles.ParticleOptions; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.monster.breeze.Breeze; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.ServerExplosion; +import net.minecraft.world.level.material.FluidState; import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; @@ -23,75 +24,68 @@ import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.Explosion; import net.minecraft.world.level.ExplosionDamageCalculator; -import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.Vec3; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -@Mixin(value = Explosion.class) +import java.util.List; +import java.util.Optional; + +@Mixin(value = ServerExplosion.class) public abstract class Explosion_optimizedTntMixin { - @Shadow - @Final - private ObjectArrayList toBlow; - - @Shadow @Final private Level level; + @Shadow @Final private ServerLevel level; @Shadow @Nullable public abstract LivingEntity getIndirectSourceEntity(); private ExplosionLogHelper eLogger; - @Inject(method = "explode", at = @At("HEAD"), + @Inject(method = "calculateExplodedPositions", at = @At("HEAD"), cancellable = true) - private void onExplosionA(CallbackInfo ci) + private void calculateExplodedPositionsCM(final CallbackInfoReturnable> cir) { if (CarpetSettings.optimizedTNT && !level.isClientSide && !(getIndirectSourceEntity() instanceof Breeze)) { - OptimizedExplosion.doExplosionA((Explosion) (Object) this, eLogger); - ci.cancel(); + cir.setReturnValue(OptimizedExplosion.doExplosionA((Explosion) (Object) this, eLogger)); } } - @Inject(method = "finalizeExplosion", at = @At("HEAD"), - cancellable = true) - private void onExplosionB(boolean spawnParticles, CallbackInfo ci) + @Inject(method = "interactWithBlocks", at = @At("HEAD")) + private void interactWithBlocksCM(final List list, final CallbackInfo ci) { if (eLogger != null) { - eLogger.setAffectBlocks( ! toBlow.isEmpty()); + eLogger.setAffectBlocks( ! list.isEmpty()); eLogger.onExplosionDone(this.level.getGameTime()); } if (CarpetSettings.explosionNoBlockDamage) { - toBlow.clear(); + list.clear(); } - if (CarpetSettings.optimizedTNT && !level.isClientSide && !(getIndirectSourceEntity() instanceof Breeze)) - { - OptimizedExplosion.doExplosionB((Explosion) (Object) this, spawnParticles); - ci.cancel(); - } - } - //optional due to Overwrite in Lithium - //should kill most checks if no block damage is requested - @Redirect(method = "explode", require = 0, at = @At(value = "INVOKE", - target ="Lnet/minecraft/world/level/Level;getBlockState(Lnet/minecraft/core/BlockPos;)Lnet/minecraft/world/level/block/state/BlockState;")) - private BlockState noBlockCalcsWithNoBLockDamage(Level world, BlockPos pos) - { - if (CarpetSettings.explosionNoBlockDamage) return Blocks.BEDROCK.defaultBlockState(); - return world.getBlockState(pos); } - @Inject(method = "(Lnet/minecraft/world/level/Level;Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/damagesource/DamageSource;Lnet/minecraft/world/level/ExplosionDamageCalculator;DDDFZLnet/minecraft/world/level/Explosion$BlockInteraction;Lnet/minecraft/core/particles/ParticleOptions;Lnet/minecraft/core/particles/ParticleOptions;Lnet/minecraft/core/Holder;)V", + //optional due to Overwrite in Lithium + //should kill most checks if no block damage is requested + @Redirect(method = "calculateExplodedPositions", require = 0, at = @At(value = "INVOKE", + target ="Lnet/minecraft/world/level/ExplosionDamageCalculator;getBlockExplosionResistance(Lnet/minecraft/world/level/Explosion;Lnet/minecraft/world/level/BlockGetter;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/material/FluidState;)Ljava/util/Optional;")) + private Optional noBlockCalcsWithNoBLockDamage(final ExplosionDamageCalculator instance, final Explosion explosion, final BlockGetter blockGetter, final BlockPos blockPos, final BlockState blockState, final FluidState fluidState) + { + if (CarpetSettings.explosionNoBlockDamage) return Optional.of(Blocks.BEDROCK.getExplosionResistance()); + return instance.getBlockExplosionResistance(explosion, blockGetter, blockPos, blockState, fluidState); + } + + @Inject(method = "", at = @At(value = "RETURN")) - private void onExplosionCreated(Level world, Entity entity, DamageSource damageSource, ExplosionDamageCalculator explosionBehavior, double x, double y, double z, float power, boolean createFire, Explosion.BlockInteraction destructionType, ParticleOptions particleOptions, ParticleOptions particleOptions2, Holder soundEvent, CallbackInfo ci) + private void onExplostion(ServerLevel world, Entity entity, DamageSource damageSource, final ExplosionDamageCalculator explosionBehavior, final Vec3 vec3, final float power, final boolean createFire, final Explosion.BlockInteraction destructionType, final CallbackInfo ci) { if (LoggerRegistry.__explosions && ! world.isClientSide) { - eLogger = new ExplosionLogHelper(x, y, z, power, createFire, destructionType, level.registryAccess()); + eLogger = new ExplosionLogHelper(vec3.x, vec3.y, vec3.z, power, createFire, destructionType, level.registryAccess()); } } - @Redirect(method = "explode", + @Redirect(method = "hurtEntities", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/Entity;setDeltaMovement(Lnet/minecraft/world/phys/Vec3;)V")) private void setVelocityAndUpdateLogging(Entity entity, Vec3 velocity) { diff --git a/src/main/java/carpet/mixins/Explosion_scarpetEventMixin.java b/src/main/java/carpet/mixins/Explosion_scarpetEventMixin.java index 12e9bf2b..5985a526 100644 --- a/src/main/java/carpet/mixins/Explosion_scarpetEventMixin.java +++ b/src/main/java/carpet/mixins/Explosion_scarpetEventMixin.java @@ -1,8 +1,6 @@ package carpet.mixins; -import it.unimi.dsi.fastutil.objects.ObjectArrayList; -import net.minecraft.core.Holder; -import net.minecraft.core.particles.ParticleOptions; +import net.minecraft.world.level.ServerExplosion; import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; @@ -14,66 +12,48 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import java.util.ArrayList; import java.util.List; -import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.level.Explosion; -import net.minecraft.world.level.ExplosionDamageCalculator; -import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; +import org.spongepowered.asm.mixin.injection.callback.LocalCapture; import static carpet.script.CarpetEventServer.Event.EXPLOSION_OUTCOME; -@Mixin(value = Explosion.class, priority = 990) +@Mixin(value = ServerExplosion.class, priority = 990) public abstract class Explosion_scarpetEventMixin { - @Shadow @Final private Level level; - @Shadow @Final private double x; - @Shadow @Final private double y; - @Shadow @Final private double z; + @Shadow @Final private ServerLevel level; + @Shadow @Final private Vec3 center; @Shadow @Final private float radius; @Shadow @Final private boolean fire; - @Shadow @Final private ObjectArrayList toBlow; @Shadow @Final private Explosion.BlockInteraction blockInteraction; @Shadow @Final private @Nullable Entity source; @Shadow /*@Nullable*/ public abstract /*@Nullable*/ LivingEntity getIndirectSourceEntity(); - @Shadow public static float getSeenPercent(Vec3 source, Entity entity) {return 0.0f;} + private List affectedEntities = new ArrayList<>(); - private List affectedEntities; - - @Inject(method = "(Lnet/minecraft/world/level/Level;Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/damagesource/DamageSource;Lnet/minecraft/world/level/ExplosionDamageCalculator;DDDFZLnet/minecraft/world/level/Explosion$BlockInteraction;Lnet/minecraft/core/particles/ParticleOptions;Lnet/minecraft/core/particles/ParticleOptions;Lnet/minecraft/core/Holder;)V", - at = @At(value = "RETURN")) - private void onExplosionCreated(Level world, Entity entity, DamageSource damageSource, ExplosionDamageCalculator explosionBehavior, double x, double y, double z, float power, boolean createFire, Explosion.BlockInteraction destructionType, ParticleOptions particleOptions, ParticleOptions particleOptions2, Holder soundEvent, CallbackInfo ci) + @Inject(method = "explode", at = @At("HEAD")) + private void explodeCM(CallbackInfo ci) { - if (EXPLOSION_OUTCOME.isNeeded() && !world.isClientSide()) - { - affectedEntities = new ArrayList<>(); - } + affectedEntities.clear(); } - @Redirect(method = "explode", at=@At( - value = "INVOKE", - target = "Lnet/minecraft/world/level/Explosion;getSeenPercent(Lnet/minecraft/world/phys/Vec3;Lnet/minecraft/world/entity/Entity;)F") - ) - private float onExplosion(Vec3 source, Entity entity) + @Redirect(method = "hurtEntities", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/Entity;onExplosionHit(Lnet/minecraft/world/entity/Entity;)V")) + private void onEntityHit(Entity instance, Entity entity) { - if (affectedEntities != null) - { - affectedEntities.add(entity); - } - return getSeenPercent(source, entity); + affectedEntities.add(instance); + instance.onExplosionHit(entity); } - @Inject(method = "finalizeExplosion", at = @At("HEAD")) - private void onExplosion(boolean spawnParticles, CallbackInfo ci) + @Inject(method = "explode", locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/ServerExplosion;hurtEntities()V", shift = At.Shift.AFTER)) + private void onExplosionDone(CallbackInfo ci, List list) { if (EXPLOSION_OUTCOME.isNeeded() && !level.isClientSide()) { - EXPLOSION_OUTCOME.onExplosion((ServerLevel) level, source, this::getIndirectSourceEntity, x, y, z, radius, fire, toBlow, affectedEntities, blockInteraction); + EXPLOSION_OUTCOME.onExplosion((ServerLevel) level, source, this::getIndirectSourceEntity, center, radius, fire, list, affectedEntities, blockInteraction); } } } diff --git a/src/main/java/carpet/mixins/FlowingFluid_liquidDamageDisabledMixin.java b/src/main/java/carpet/mixins/FlowingFluid_liquidDamageDisabledMixin.java index 933e0980..1990e719 100644 --- a/src/main/java/carpet/mixins/FlowingFluid_liquidDamageDisabledMixin.java +++ b/src/main/java/carpet/mixins/FlowingFluid_liquidDamageDisabledMixin.java @@ -16,14 +16,14 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; public class FlowingFluid_liquidDamageDisabledMixin { @Inject( - method = "canHoldFluid", + method = "canHoldAnyFluid", at = @At( value = "INVOKE", target = "Lnet/minecraft/world/level/block/state/BlockState;blocksMotion()Z" ), cancellable = true ) - private void stopBreakingBlock(BlockGetter world, BlockPos pos, BlockState state, Fluid fluid, CallbackInfoReturnable cir) + private static void stopBreakingBlock(final BlockState state, final CallbackInfoReturnable cir) { if (CarpetSettings.liquidDamageDisabled) { diff --git a/src/main/java/carpet/mixins/Guardian_renewableSpongesMixin.java b/src/main/java/carpet/mixins/Guardian_renewableSpongesMixin.java index 42f5fdad..9ed6a3c0 100644 --- a/src/main/java/carpet/mixins/Guardian_renewableSpongesMixin.java +++ b/src/main/java/carpet/mixins/Guardian_renewableSpongesMixin.java @@ -1,12 +1,10 @@ package carpet.mixins; import carpet.CarpetSettings; -import net.minecraft.nbt.CompoundTag; import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LightningBolt; -import net.minecraft.world.entity.MobSpawnType; -import net.minecraft.world.entity.SpawnGroupData; import net.minecraft.world.entity.monster.ElderGuardian; import net.minecraft.world.entity.monster.Guardian; import net.minecraft.world.entity.monster.Monster; @@ -28,7 +26,7 @@ public abstract class Guardian_renewableSpongesMixin extends Monster { ElderGuardian elderGuardian = new ElderGuardian(EntityType.ELDER_GUARDIAN ,this.level()); elderGuardian.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot()); - elderGuardian.finalizeSpawn(serverWorld ,this.level().getCurrentDifficultyAt(elderGuardian.blockPosition()), MobSpawnType.CONVERSION, null); + elderGuardian.finalizeSpawn(serverWorld ,this.level().getCurrentDifficultyAt(elderGuardian.blockPosition()), EntitySpawnReason.CONVERSION, null); elderGuardian.setNoAi(this.isNoAi()); if (this.hasCustomName()) diff --git a/src/main/java/carpet/mixins/Ingredient_scarpetMixin.java b/src/main/java/carpet/mixins/Ingredient_scarpetMixin.java index 4d33697e..e59c04c5 100644 --- a/src/main/java/carpet/mixins/Ingredient_scarpetMixin.java +++ b/src/main/java/carpet/mixins/Ingredient_scarpetMixin.java @@ -1,24 +1,11 @@ package carpet.mixins; -import carpet.fakes.IngredientInterface; -import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; -import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient; @Mixin(Ingredient.class) -public class Ingredient_scarpetMixin implements IngredientInterface +public class Ingredient_scarpetMixin// implements IngredientInterface { - @Shadow @Final private Ingredient.Value[] values; - @Override - public List> getRecipeStacks() - { - return Arrays.stream(values).map(Ingredient.Value::getItems).toList(); - } } diff --git a/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java b/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java index f2a71f2b..9672f485 100644 --- a/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java +++ b/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java @@ -2,18 +2,20 @@ package carpet.mixins; import carpet.network.CarpetClient; import carpet.script.utils.ShapesRenderer; -import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.framegraph.FrameGraphBuilder; +import com.mojang.blaze3d.framegraph.FramePass; import net.minecraft.client.Camera; -import net.minecraft.client.DeltaTracker; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.GameRenderer; +import net.minecraft.client.renderer.FogParameters; import net.minecraft.client.renderer.LevelRenderer; +import net.minecraft.client.renderer.LevelTargetBundle; 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.Final; 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.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @@ -21,30 +23,25 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(LevelRenderer.class) public class LevelRenderer_scarpetRenderMixin { + @Shadow @Final private LevelTargetBundle targets; + @Inject(method = "", at = @At("RETURN")) private void addRenderers(Minecraft minecraft, EntityRenderDispatcher entityRenderDispatcher, BlockEntityRenderDispatcher blockEntityRenderDispatcher, RenderBuffers renderBuffers, CallbackInfo ci) { CarpetClient.shapes = new ShapesRenderer(minecraft); } - @Inject(method = "renderLevel", at = @At( - value = "INVOKE", - target = "Lnet/minecraft/client/renderer/Sheets;translucentCullBlockSheet()Lnet/minecraft/client/renderer/RenderType;", shift = At.Shift.BEFORE - //target = "Lnet/minecraft/client/render/RenderLayer;getWaterMask()Lnet/minecraft/client/render/RenderLayer;", shift = At.Shift.AFTER - //target = "Lnet/minecraft/client/render/BufferBuilderStorage;getEffectVertexConsumers()Lnet/minecraft/client/render/VertexConsumerProvider$Immediate;", shift = At.Shift.BEFORE - //target = "Lnet/minecraft/client/render/WorldRenderer;renderChunkDebugInfo(Lnet/minecraft/client/render/Camera;)V", shift = At.Shift.AFTER - //target = "Lnet/minecraft/client/render/BackgroundRenderer;method_23792()V", shift = At.Shift.AFTER - //target = "Lnet/minecraft/client/render/BufferBuilderStorage;getEntityVertexConsumers()Lnet/minecraft/client/render/VertexConsumerProvider$Immediate;", shift = At.Shift.AFTER - //target = "Lnet/minecraft/client/render/WorldRenderer;renderChunkDebugInfo(Lnet/minecraft/client/render/Camera;)V", shift = At.Shift.AFTER // before return - )) - private void renderScarpetThings(final DeltaTracker deltaTracker, final boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightmapTextureManager, Matrix4f modelViewMatrix, Matrix4f matrix4f, CallbackInfo ci) + @Inject(method = "addParticlesPass", at = @At("RETURN")) + private void renderScarpetThingsLate(FrameGraphBuilder frameGraphBuilder, Camera camera, LightTexture lightTexture, float f, FogParameters fogParameters, CallbackInfo ci) { // in normal circumstances we want to render shapes at the very end so it appears correctly behind stuff. // we might actually not need to play with render hooks here. //if (!FabricAPIHooks.WORLD_RENDER_EVENTS && CarpetClient.shapes != null ) if (CarpetClient.shapes != null) { - CarpetClient.shapes.render(modelViewMatrix, camera, deltaTracker.getGameTimeDeltaPartialTick(false)); + FramePass pass = frameGraphBuilder.addPass("scarpet_shapes"); + targets.main = pass.readsAndWrites(targets.main); + pass.executes(() -> CarpetClient.shapes.render(null, camera, f)); } } } diff --git a/src/main/java/carpet/mixins/Level_movableBEMixin.java b/src/main/java/carpet/mixins/Level_movableBEMixin.java index d5820368..99929faf 100644 --- a/src/main/java/carpet/mixins/Level_movableBEMixin.java +++ b/src/main/java/carpet/mixins/Level_movableBEMixin.java @@ -5,7 +5,6 @@ import carpet.fakes.LevelInterface; import net.minecraft.core.BlockPos; import net.minecraft.server.level.FullChunkStatus; import net.minecraft.util.profiling.ProfilerFiller; -import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.Block; @@ -28,12 +27,6 @@ public abstract class Level_movableBEMixin implements LevelInterface, LevelAcces @Shadow public abstract LevelChunk getChunkAt(BlockPos blockPos_1); - @Shadow - public abstract BlockState getBlockState(BlockPos blockPos_1); - - //@Shadow - //public abstract ChunkManager getChunkManager(); - @Shadow public abstract void setBlocksDirty(BlockPos blockPos_1, BlockState s1, BlockState s2); @@ -50,8 +43,6 @@ public abstract class Level_movableBEMixin implements LevelInterface, LevelAcces @Shadow public abstract void updateNeighbourForOutputSignal(BlockPos pos, Block block); - //@Shadow public abstract boolean setBlockState(BlockPos pos, BlockState state, int flags); - @Shadow public abstract boolean isDebug(); /** @@ -86,7 +77,7 @@ public abstract class Level_movableBEMixin implements LevelInterface, LevelAcces { BlockState blockState_3 = this.getBlockState(blockPos_1); - if (blockState_3 != blockState_2 && (blockState_3.getLightBlock((BlockGetter) this, blockPos_1) != blockState_2.getLightBlock((BlockGetter) this, blockPos_1) || blockState_3.getLightEmission() != blockState_2.getLightEmission() || blockState_3.useShapeForLightOcclusion() || blockState_2.useShapeForLightOcclusion())) + if (blockState_3 != blockState_2 && (blockState_3.getLightBlock() != blockState_2.getLightBlock() || blockState_3.getLightEmission() != blockState_2.getLightEmission() || blockState_3.useShapeForLightOcclusion() || blockState_2.useShapeForLightOcclusion())) { ProfilerFiller profiler = getProfiler(); profiler.push("queueCheckLight"); diff --git a/src/main/java/carpet/mixins/LivingEntity_creativeFlyMixin.java b/src/main/java/carpet/mixins/LivingEntity_creativeFlyMixin.java index 5b22f42f..24771951 100644 --- a/src/main/java/carpet/mixins/LivingEntity_creativeFlyMixin.java +++ b/src/main/java/carpet/mixins/LivingEntity_creativeFlyMixin.java @@ -25,8 +25,8 @@ public abstract class LivingEntity_creativeFlyMixin extends Entity super(type, world); } - @ModifyConstant(method = "travel", constant = @Constant(floatValue = 0.91F), expect = 2) - private float drag(float original) + @ModifyConstant(method = "travelInAir", constant = @Constant(floatValue = 0.91F), expect = 1) + private float dragAir(float original) { if (CarpetSettings.creativeFlyDrag != 0.09 && (Object)this instanceof Player) { @@ -37,7 +37,6 @@ public abstract class LivingEntity_creativeFlyMixin extends Entity return original; } - @Inject(method = "getFrictionInfluencedSpeed(F)F", at = @At("HEAD"), cancellable = true) private void flyingAltSpeed(float slipperiness, CallbackInfoReturnable cir) { diff --git a/src/main/java/carpet/mixins/MinecraftServer_pingPlayerSampleLimit.java b/src/main/java/carpet/mixins/MinecraftServer_pingPlayerSampleLimit.java index e53249c1..f70925e7 100644 --- a/src/main/java/carpet/mixins/MinecraftServer_pingPlayerSampleLimit.java +++ b/src/main/java/carpet/mixins/MinecraftServer_pingPlayerSampleLimit.java @@ -11,7 +11,7 @@ import net.minecraft.server.MinecraftServer; public abstract class MinecraftServer_pingPlayerSampleLimit { - @ModifyConstant(method = "tickServer", constant = @Constant(intValue = 12), require = 0, allow = 1) + @ModifyConstant(method = "buildPlayerStatus", constant = @Constant(intValue = 12), require = 1) private int modifyPlayerSampleLimit(int value) { return CarpetSettings.pingPlayerListLimit; diff --git a/src/main/java/carpet/mixins/MinecraftServer_scarpetMixin.java b/src/main/java/carpet/mixins/MinecraftServer_scarpetMixin.java index a52d55a0..d92513c9 100644 --- a/src/main/java/carpet/mixins/MinecraftServer_scarpetMixin.java +++ b/src/main/java/carpet/mixins/MinecraftServer_scarpetMixin.java @@ -102,7 +102,7 @@ public abstract class MinecraftServer_scarpetMixin extends ReentrantBlockableEve @Override public void reloadAfterReload(RegistryAccess newRegs) { - resources.managers().updateRegistryTags(); + resources.managers().updateStaticRegistryTags(); getPlayerList().saveAll(); getPlayerList().reloadResources(); functionManager.replaceLibrary(this.resources.managers().getFunctionLibrary()); diff --git a/src/main/java/carpet/mixins/MinecraftServer_tickspeedMixin.java b/src/main/java/carpet/mixins/MinecraftServer_tickspeedMixin.java index 27fde78c..e75fe66c 100644 --- a/src/main/java/carpet/mixins/MinecraftServer_tickspeedMixin.java +++ b/src/main/java/carpet/mixins/MinecraftServer_tickspeedMixin.java @@ -36,42 +36,34 @@ public abstract class MinecraftServer_tickspeedMixin extends ReentrantBlockableE } - @Inject(method = "tickServer", at = @At( + @Inject(method = "autoSave", at = @At( value = "INVOKE", target = "Lnet/minecraft/server/MinecraftServer;saveEverything(ZZZ)Z", // save shift = At.Shift.BEFORE )) - private void startAutosave(BooleanSupplier booleanSupplier_1, CallbackInfo ci) + private void startAutosave(final CallbackInfo ci) { currentSection = CarpetProfiler.start_section(null, "Autosave", CarpetProfiler.TYPE.GENERAL); } - @Inject(method = "tickServer", at = @At( + @Inject(method = "autoSave", at = @At( value = "INVOKE", target = "Lnet/minecraft/server/MinecraftServer;saveEverything(ZZZ)Z", shift = At.Shift.AFTER )) - private void finishAutosave(BooleanSupplier booleanSupplier_1, CallbackInfo ci) + private void finishAutosave(final CallbackInfo ci) { CarpetProfiler.end_current_section(currentSection); } - @Inject(method = "tickChildren", at = @At( - value = "INVOKE", - target = "Lnet/minecraft/server/MinecraftServer;getConnection()Lnet/minecraft/server/network/ServerConnectionListener;", - shift = At.Shift.BEFORE - )) - private void startNetwork(BooleanSupplier booleanSupplier_1, CallbackInfo ci) + @Inject(method = "tickConnection", at = @At("HEAD")) + private void startNetwork(final CallbackInfo ci) { currentSection = CarpetProfiler.start_section(null, "Network", CarpetProfiler.TYPE.GENERAL); } - @Inject(method = "tickChildren", at = @At( - value = "INVOKE", - target = "Lnet/minecraft/server/players/PlayerList;tick()V", - shift = At.Shift.AFTER - )) - private void finishNetwork(BooleanSupplier booleanSupplier_1, CallbackInfo ci) + @Inject(method = "tickConnection", at = @At("RETURN")) + private void finishNetwork(final CallbackInfo ci) { CarpetProfiler.end_current_section(currentSection); } diff --git a/src/main/java/carpet/mixins/NaturalSpawnerMixin.java b/src/main/java/carpet/mixins/NaturalSpawnerMixin.java index 8cd2f826..7ab4f6f5 100644 --- a/src/main/java/carpet/mixins/NaturalSpawnerMixin.java +++ b/src/main/java/carpet/mixins/NaturalSpawnerMixin.java @@ -3,6 +3,7 @@ package carpet.mixins; import carpet.CarpetSettings; import carpet.fakes.LevelInterface; import carpet.utils.SpawnReporter; +import net.minecraft.world.entity.EntitySpawnReason; import org.apache.commons.lang3.tuple.Pair; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; @@ -12,9 +13,9 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import java.util.List; import java.util.Map; import net.minecraft.core.BlockPos; -import net.minecraft.nbt.CompoundTag; import net.minecraft.resources.ResourceKey; import net.minecraft.server.level.ServerLevel; import net.minecraft.tags.BlockTags; @@ -24,7 +25,6 @@ import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.MobCategory; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.SpawnGroupData; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; @@ -133,9 +133,9 @@ public class NaturalSpawnerMixin @Redirect(method = "getMobForSpawn", at = @At( value = "INVOKE", - target = "Lnet/minecraft/world/entity/EntityType;create(Lnet/minecraft/world/level/Level;)Lnet/minecraft/world/entity/Entity;" + target = "Lnet/minecraft/world/entity/EntityType;create(Lnet/minecraft/world/level/Level;Lnet/minecraft/world/entity/EntitySpawnReason;)Lnet/minecraft/world/entity/Entity;" )) - private static Entity create(EntityType entityType, Level world_1) + private static Entity create(final EntityType entityType, final Level world_1, final EntitySpawnReason entitySpawnReason) { if (CarpetSettings.lagFreeSpawning) { @@ -143,11 +143,11 @@ public class NaturalSpawnerMixin if (precookedMobs.containsKey(entityType)) //this mob has been 's but not used yet return precookedMobs.get(entityType); - Entity e = entityType.create(world_1); + Entity e = entityType.create(world_1, entitySpawnReason); precookedMobs.put(entityType, e); return e; } - return entityType.create(world_1); + return entityType.create(world_1, entitySpawnReason); } @Redirect(method = "spawnCategoryForPosition(Lnet/minecraft/world/entity/MobCategory;Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/level/chunk/ChunkAccess;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/NaturalSpawner$SpawnPredicate;Lnet/minecraft/world/level/NaturalSpawner$AfterSpawnCallback;)V", at = @At( @@ -176,9 +176,9 @@ public class NaturalSpawnerMixin @Redirect(method = "spawnCategoryForPosition(Lnet/minecraft/world/entity/MobCategory;Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/level/chunk/ChunkAccess;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/NaturalSpawner$SpawnPredicate;Lnet/minecraft/world/level/NaturalSpawner$AfterSpawnCallback;)V", at = @At( value = "INVOKE", - target = "Lnet/minecraft/world/entity/Mob;finalizeSpawn(Lnet/minecraft/world/level/ServerLevelAccessor;Lnet/minecraft/world/DifficultyInstance;Lnet/minecraft/world/entity/MobSpawnType;Lnet/minecraft/world/entity/SpawnGroupData;)Lnet/minecraft/world/entity/SpawnGroupData;" + target = "Lnet/minecraft/world/entity/Mob;finalizeSpawn(Lnet/minecraft/world/level/ServerLevelAccessor;Lnet/minecraft/world/DifficultyInstance;Lnet/minecraft/world/entity/EntitySpawnReason;Lnet/minecraft/world/entity/SpawnGroupData;)Lnet/minecraft/world/entity/SpawnGroupData;" )) - private static SpawnGroupData spawnEntity(Mob mobEntity, ServerLevelAccessor serverWorldAccess, DifficultyInstance difficulty, MobSpawnType spawnReason, SpawnGroupData entityData) + private static SpawnGroupData spawnEntity(Mob mobEntity, ServerLevelAccessor serverWorldAccess, DifficultyInstance difficulty, EntitySpawnReason spawnReason, SpawnGroupData entityData) { if (!SpawnReporter.mockSpawns) // WorldAccess return mobEntity.finalizeSpawn(serverWorldAccess, difficulty, spawnReason, entityData); @@ -271,17 +271,13 @@ public class NaturalSpawnerMixin @Inject(method = "spawnForChunk", at = @At("HEAD")) // allows to change mobcaps and captures each category try per dimension before it fails due to full mobcaps. private static void checkSpawns(ServerLevel world, LevelChunk chunk, NaturalSpawner.SpawnState info, - boolean spawnAnimals, boolean spawnMonsters, boolean shouldSpawnAnimals, CallbackInfo ci) + List list, CallbackInfo ci) { if (SpawnReporter.trackingSpawns()) { - MobCategory[] var6 = SPAWNING_CATEGORIES; - int var7 = var6.length; + for (MobCategory entityCategory: list) + { - for(int var8 = 0; var8 < var7; ++var8) { - MobCategory entityCategory = var6[var8]; - if ((spawnAnimals || !entityCategory.isFriendly()) && (spawnMonsters || entityCategory.isFriendly()) && (shouldSpawnAnimals || !entityCategory.isPersistent()) ) - { ResourceKey dim = world.dimension(); // getDimensionType; int newCap = entityCategory.getMaxInstancesPerChunk(); //(int) ((double)entityCategory.getCapacity()*(Math.pow(2.0,(SpawnReporter.mobcap_exponent/4)))); int int_2 = SpawnReporter.chunkCounts.get(dim); // eligible chunks for spawning @@ -311,7 +307,6 @@ public class NaturalSpawnerMixin //else //full mobcaps - and key in local_spawns will be missing } - } } } } diff --git a/src/main/java/carpet/mixins/PickaxeItem_missingToolsMixin.java b/src/main/java/carpet/mixins/PickaxeItem_missingToolsMixin.java index a8e9a3f4..201c34df 100644 --- a/src/main/java/carpet/mixins/PickaxeItem_missingToolsMixin.java +++ b/src/main/java/carpet/mixins/PickaxeItem_missingToolsMixin.java @@ -6,7 +6,7 @@ import net.minecraft.tags.TagKey; import net.minecraft.world.item.DiggerItem; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.PickaxeItem; -import net.minecraft.world.item.Tier; +import net.minecraft.world.item.ToolMaterial; import net.minecraft.world.item.component.Tool; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; @@ -18,8 +18,10 @@ import org.spongepowered.asm.mixin.Mixin; public class PickaxeItem_missingToolsMixin extends DiggerItem { - protected PickaxeItem_missingToolsMixin(Tier material, TagKey tag, Properties settings) { - super(material, tag, settings); + + protected PickaxeItem_missingToolsMixin(final ToolMaterial toolMaterial, final TagKey tagKey, final float f, final float g, final Properties properties) + { + super(toolMaterial, tagKey, f, g, properties); } @Override diff --git a/src/main/java/carpet/mixins/RecipeManager_scarpetMixin.java b/src/main/java/carpet/mixins/RecipeManager_scarpetMixin.java index d95593e4..69a67b5a 100644 --- a/src/main/java/carpet/mixins/RecipeManager_scarpetMixin.java +++ b/src/main/java/carpet/mixins/RecipeManager_scarpetMixin.java @@ -6,6 +6,7 @@ import net.minecraft.core.Registry; import net.minecraft.core.RegistryAccess; import net.minecraft.core.registries.Registries; import net.minecraft.world.item.Item; +import net.minecraft.world.item.Items; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -42,9 +43,13 @@ public class RecipeManager_scarpetMixin implements RecipeManagerInterface Collection> typeRecipes = byType.get(type); Registry regs = registryAccess.registryOrThrow(Registries.ITEM); Item item = regs.get(itemId); + if (item == Items.AIR) + { + return List.of(); + } return typeRecipes.stream() .>map(RecipeHolder::value) - .filter(r -> r.getResultItem(registryAccess).getItem() == item) + .filter(r -> r.getResultItem(registryAccess).is(item)) .toList(); } } diff --git a/src/main/java/carpet/mixins/RedstoneWireBlock_fastMixin.java b/src/main/java/carpet/mixins/RedstoneWireBlock_fastMixin.java index 0ac25bd1..6f169425 100644 --- a/src/main/java/carpet/mixins/RedstoneWireBlock_fastMixin.java +++ b/src/main/java/carpet/mixins/RedstoneWireBlock_fastMixin.java @@ -1,9 +1,13 @@ package carpet.mixins; import carpet.CarpetSettings; +import carpet.fakes.DefaultRedstoneWireEvaluatorInferface; import carpet.fakes.RedstoneWireBlockInterface; import carpet.helpers.RedstoneWireTurbo; import com.google.common.collect.Sets; +import net.minecraft.world.level.redstone.DefaultRedstoneWireEvaluator; +import net.minecraft.world.level.redstone.Orientation; +import net.minecraft.world.level.redstone.RedstoneWireEvaluator; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.gen.Accessor; @@ -21,16 +25,15 @@ import net.minecraft.world.level.block.RedStoneWireBlock; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; +import javax.annotation.Nullable; + import static net.minecraft.world.level.block.RedStoneWireBlock.POWER; @Mixin(RedStoneWireBlock.class) public abstract class RedstoneWireBlock_fastMixin implements RedstoneWireBlockInterface { @Shadow - private void updatePowerStrength(Level world_1, BlockPos blockPos_1, BlockState blockState_1) { } - - @Shadow - private int calculateTargetStrength(Level world, BlockPos pos) { return 0; } + private void updatePowerStrength(Level world_1, BlockPos blockPos_1, BlockState blockState_1, @Nullable final Orientation orientation) { } @Override @Accessor("shouldSignal") @@ -40,6 +43,8 @@ public abstract class RedstoneWireBlock_fastMixin implements RedstoneWireBlockIn @Accessor("shouldSignal") public abstract boolean getWiresGivePower(); + private RedstoneWireEvaluator legacy = new DefaultRedstoneWireEvaluator((RedStoneWireBlock)(Object) this); + // = private RedstoneWireTurbo wireTurbo = null; @@ -52,20 +57,22 @@ public abstract class RedstoneWireBlock_fastMixin implements RedstoneWireBlockIn // = - public void fastUpdate(Level world, BlockPos pos, BlockState state, BlockPos source) { + public void fastUpdate(Level world, BlockPos pos, BlockState state, Orientation o) { // [CM] fastRedstoneDust -- update based on carpet rule if (CarpetSettings.fastRedstoneDust) { + BlockPos source = null; // todo this probably removes all improvements from the original method + // so needs to be evaluated if its worth keeping wireTurbo.updateSurroundingRedstone(world, pos, state, source); return; } - updatePowerStrength(world, pos, state); + updatePowerStrength(world, pos, state, o); } /** * @author theosib, soykaf, gnembon */ @Inject(method = "updatePowerStrength", at = @At("HEAD"), cancellable = true) - private void updateLogicAlternative(Level world, BlockPos pos, BlockState state, CallbackInfo cir) { + private void updateLogicAlternative(Level world, BlockPos pos, BlockState state, Orientation orientation, CallbackInfo cir) { if (CarpetSettings.fastRedstoneDust) { updateLogicPublic(world, pos, state); cir.cancel(); @@ -74,7 +81,7 @@ public abstract class RedstoneWireBlock_fastMixin implements RedstoneWireBlockIn @Override public BlockState updateLogicPublic(Level world_1, BlockPos blockPos_1, BlockState blockState_1) { - int i = this.calculateTargetStrength(world_1, blockPos_1); + int i = ((DefaultRedstoneWireEvaluatorInferface)legacy).calculateTargetStrengthCM(world_1, blockPos_1); BlockState blockState = blockState_1; if (blockState_1.getValue(POWER) != i) { blockState_1 = blockState_1.setValue(POWER, i); @@ -107,28 +114,33 @@ public abstract class RedstoneWireBlock_fastMixin implements RedstoneWireBlockIn // = - @Redirect(method = "onPlace", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/RedStoneWireBlock;updatePowerStrength(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;)V")) - private void redirectOnBlockAddedUpdate(RedStoneWireBlock self, Level world_1, BlockPos blockPos_1, BlockState blockState_1) { - fastUpdate(world_1, blockPos_1, blockState_1, null); + @Redirect(method = "onPlace", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/RedStoneWireBlock;updatePowerStrength(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/redstone/Orientation;)V")) + private void redirectOnBlockAddedUpdate(RedStoneWireBlock self, Level world_1, BlockPos blockPos_1, BlockState blockState_1, Orientation o) { + fastUpdate(world_1, blockPos_1, blockState_1, o); } - @Redirect(method = "onRemove", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/RedStoneWireBlock;updatePowerStrength(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;)V")) - private void redirectOnStateReplacedUpdate(RedStoneWireBlock self, Level world_1, BlockPos blockPos_1, BlockState blockState_1) { - fastUpdate(world_1, blockPos_1, blockState_1, null); + @Redirect(method = "onRemove", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/RedStoneWireBlock;updatePowerStrength(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/redstone/Orientation;)V")) + private void redirectOnStateReplacedUpdate(RedStoneWireBlock self, Level world_1, BlockPos blockPos_1, BlockState blockState_1, Orientation o) { + fastUpdate(world_1, blockPos_1, blockState_1, o); } - @Redirect(method = "neighborChanged", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/RedStoneWireBlock;updatePowerStrength(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;)V")) + @Redirect(method = "neighborChanged", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/RedStoneWireBlock;updatePowerStrength(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/redstone/Orientation;)V")) + //private void red(final RedStoneWireBlock instance, final Level level, + // final BlockPos blockPos, final BlockState blockState, final Orientation orientation) private void redirectNeighborUpdateUpdate( RedStoneWireBlock self, Level world_1, BlockPos blockPos_1, BlockState blockState_1, + Orientation o, BlockState blockState_2, Level world_2, BlockPos blockPos_2, Block block_1, - BlockPos blockPos_3, - boolean boolean_1) { - fastUpdate(world_1, blockPos_1, blockState_1, blockPos_3); + Orientation o2, + boolean b + ) + { + fastUpdate(world_1, blockPos_1, blockState_1, o); } } diff --git a/src/main/java/carpet/mixins/ServerChunkCacheMixin.java b/src/main/java/carpet/mixins/ServerChunkCacheMixin.java index 815ed551..8510da44 100644 --- a/src/main/java/carpet/mixins/ServerChunkCacheMixin.java +++ b/src/main/java/carpet/mixins/ServerChunkCacheMixin.java @@ -27,7 +27,7 @@ public abstract class ServerChunkCacheMixin @Shadow @Final private DistanceManager distanceManager; - @Redirect(method = "tickChunks", at = @At( + @Redirect(method = "tickChunks(Lnet/minecraft/util/profiling/ProfilerFiller;JLjava/util/List;)V", at = @At( value = "INVOKE", target = "Lnet/minecraft/server/level/DistanceManager;getNaturalSpawnChunkCount()I" )) @@ -54,7 +54,7 @@ public abstract class ServerChunkCacheMixin } - @Inject(method = "tickChunks", at = @At("RETURN")) + @Inject(method = "tickChunks(Lnet/minecraft/util/profiling/ProfilerFiller;JLjava/util/List;)V", at = @At("RETURN")) private void onFinishSpawnWorldCycle(CallbackInfo ci) { LevelData levelData = this.level.getLevelData(); // levelProperies class diff --git a/src/main/java/carpet/mixins/ServerChunkCache_profilerMixin.java b/src/main/java/carpet/mixins/ServerChunkCache_profilerMixin.java index 6dabe407..201885e1 100644 --- a/src/main/java/carpet/mixins/ServerChunkCache_profilerMixin.java +++ b/src/main/java/carpet/mixins/ServerChunkCache_profilerMixin.java @@ -19,36 +19,13 @@ public abstract class ServerChunkCache_profilerMixin CarpetProfiler.ProfilerToken currentSection; - @Inject(method = "tickChunks", at = @At("HEAD")) + @Inject(method = "tickChunks(Lnet/minecraft/util/profiling/ProfilerFiller;JLjava/util/List;)V", at = @At("HEAD")) private void startSpawningSection(CallbackInfo ci) { currentSection = CarpetProfiler.start_section(level, "Spawning", CarpetProfiler.TYPE.GENERAL); } - @Inject(method = "tickChunks", at = @At( - value = "FIELD", - target = "net/minecraft/server/level/ServerChunkCache.level:Lnet/minecraft/server/level/ServerLevel;", - ordinal = 10 - )) - private void skipChunkTicking(CallbackInfo ci) - { - if (currentSection != null) - { - CarpetProfiler.end_current_section(currentSection); - } - } - - @Inject(method = "tickChunks", at = @At( - value = "INVOKE", - target = "net/minecraft/server/level/ServerLevel.tickChunk(Lnet/minecraft/world/level/chunk/LevelChunk;I)V", - shift = At.Shift.AFTER - )) - private void resumeSpawningSection(CallbackInfo ci) - { - currentSection = CarpetProfiler.start_section(level, "Spawning", CarpetProfiler.TYPE.GENERAL); - } - - @Inject(method = "tickChunks", at = @At("RETURN")) + @Inject(method = "tickChunks(Lnet/minecraft/util/profiling/ProfilerFiller;JLjava/util/List;)V", at = @At("RETURN")) private void stopSpawningSection(CallbackInfo ci) { if (currentSection != null) @@ -56,18 +33,4 @@ public abstract class ServerChunkCache_profilerMixin CarpetProfiler.end_current_section(currentSection); } } - - //@Redirect(method = "tick", at = @At( - // value = "INVOKE", - // target = "Lnet/minecraft/server/level/DistanceManager;purgeStaleTickets()V" - //)) - //private void pauseTicketSystem(DistanceManager distanceManager) - //{ - // pausing expiry of tickets - // that will prevent also chunks from unloading, so require a deep frozen state - //ServerTickRateManager trm = ((MinecraftServerInterface) level.getServer()).getTickRateManager(); - //if (!trm.runsNormally() && trm.deeplyFrozen()) return; - //distanceManager.purgeStaleTickets(); - //} - } diff --git a/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java b/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java index 55011635..ed213d81 100644 --- a/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java +++ b/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java @@ -1,5 +1,6 @@ package carpet.mixins; +import carpet.fakes.EntityInterface; import net.minecraft.network.protocol.game.ServerboundChatCommandPacket; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -51,9 +52,14 @@ public class ServerGamePacketListenerImpl_scarpetEventsMixin { @Shadow public ServerPlayer player; - @Inject(method = "handlePlayerInput", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/ServerPlayer;setPlayerInput(FFZZ)V")) + @Inject(method = "handlePlayerInput", at = @At("HEAD")) private void checkMoves(ServerboundPlayerInputPacket p, CallbackInfo ci) { + // todo this may not ride on the right thread moment, so needs to be checked + + if (!((EntityInterface)player.getVehicle()).isPermanentVehicle()) // won't since that method makes sure its not null + player.setShiftKeyDown(p.isShiftKeyDown()); + if (PLAYER_RIDES.isNeeded() && (p.getXxa() != 0.0F || p.getZza() != 0.0F || p.isJumping() || p.isShiftKeyDown())) { PLAYER_RIDES.onMountControls(player, p.getXxa(), p.getZza(), p.isJumping(), p.isShiftKeyDown()); @@ -246,7 +252,7 @@ public class ServerGamePacketListenerImpl_scarpetEventsMixin { if (PLAYER_CHOOSES_RECIPE.isNeeded()) { - if(PLAYER_CHOOSES_RECIPE.onRecipeSelected(player, packet.getRecipe(), packet.isShiftDown())) ci.cancel(); + if(PLAYER_CHOOSES_RECIPE.onRecipeSelected(player, packet.getRecipe(), packet.isUseMaxItems())) ci.cancel(); } } diff --git a/src/main/java/carpet/mixins/ServerLevel_scarpetMixin.java b/src/main/java/carpet/mixins/ServerLevel_scarpetMixin.java index b9b870b3..edaccc0e 100644 --- a/src/main/java/carpet/mixins/ServerLevel_scarpetMixin.java +++ b/src/main/java/carpet/mixins/ServerLevel_scarpetMixin.java @@ -24,6 +24,7 @@ import net.minecraft.world.level.entity.LevelEntityGetter; import net.minecraft.world.level.entity.PersistentEntitySectionManager; import net.minecraft.world.level.storage.ServerLevelData; import net.minecraft.world.level.storage.WritableLevelData; +import net.minecraft.world.phys.Vec3; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -31,7 +32,6 @@ import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.LocalCapture; import java.util.function.Supplier; @@ -65,8 +65,8 @@ public abstract class ServerLevel_scarpetMixin extends Level implements ServerWo return getGameRules().getBoolean(rule) ? Explosion.BlockInteraction.DESTROY_WITH_DECAY : Explosion.BlockInteraction.DESTROY; } - @Inject(method = "explode", at = @At("HEAD")) - private void handleExplosion(/*@Nullable*/ Entity entity, /*@Nullable*/ DamageSource damageSource, /*@Nullable*/ ExplosionDamageCalculator explosionBehavior, double d, double e, double f, float g, boolean bl, ExplosionInteraction explosionInteraction, ParticleOptions particleOptions, ParticleOptions particleOptions2, Holder soundEvent, CallbackInfoReturnable cir) + @Inject(method = "explode", at = @At("HEAD"), cancellable = true) + private void handleExplosion(final Entity entity, final DamageSource damageSource, final ExplosionDamageCalculator explosionDamageCalculator, final double x, final double y, final double z, final float g, final boolean bl, final ExplosionInteraction explosionInteraction, final ParticleOptions particleOptions, final ParticleOptions particleOptions2, final Holder holder, final CallbackInfo ci) { if (EXPLOSION.isNeeded()) { Explosion.BlockInteraction var10000 = switch (explosionInteraction) { @@ -74,10 +74,12 @@ public abstract class ServerLevel_scarpetMixin extends Level implements ServerWo case BLOCK -> this.getCMDestroyType(GameRules.RULE_BLOCK_EXPLOSION_DROP_DECAY); case MOB -> this.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? this.getCMDestroyType(GameRules.RULE_MOB_EXPLOSION_DROP_DECAY) : Explosion.BlockInteraction.KEEP; case TNT -> this.getCMDestroyType(GameRules.RULE_TNT_EXPLOSION_DROP_DECAY); + case TRIGGER -> Explosion.BlockInteraction.TRIGGER_BLOCK; default -> throw new IncompatibleClassChangeError(); }; - EXPLOSION.onExplosion((ServerLevel) (Object) this, entity, null, d, e, f, g, bl, null, null, var10000); + boolean cancelled = EXPLOSION.onExplosion((ServerLevel) (Object) this, entity, null, new Vec3(x, y, z), g, bl, null, null, var10000); + if (cancelled) ci.cancel(); } } diff --git a/src/main/java/carpet/mixins/ServerPlayerGameMode_cactusMixin.java b/src/main/java/carpet/mixins/ServerPlayerGameMode_cactusMixin.java index d4cb5763..70784fcd 100644 --- a/src/main/java/carpet/mixins/ServerPlayerGameMode_cactusMixin.java +++ b/src/main/java/carpet/mixins/ServerPlayerGameMode_cactusMixin.java @@ -3,7 +3,7 @@ package carpet.mixins; import carpet.helpers.BlockRotator; import net.minecraft.server.level.ServerPlayerGameMode; import net.minecraft.world.InteractionHand; -import net.minecraft.world.ItemInteractionResult; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; @@ -19,13 +19,13 @@ public class ServerPlayerGameMode_cactusMixin @Redirect(method = "useItemOn", at = @At( value = "INVOKE", - target = "Lnet/minecraft/world/level/block/state/BlockState;useItemOn(Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/level/Level;Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/InteractionHand;Lnet/minecraft/world/phys/BlockHitResult;)Lnet/minecraft/world/ItemInteractionResult;" + target = "Lnet/minecraft/world/level/block/state/BlockState;useItemOn(Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/level/Level;Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/InteractionHand;Lnet/minecraft/world/phys/BlockHitResult;)Lnet/minecraft/world/InteractionResult;" )) - private ItemInteractionResult activateWithOptionalCactus(final BlockState blockState, final ItemStack itemStack, final Level world_1, final Player playerEntity_1, final InteractionHand hand_1, final BlockHitResult blockHitResult_1) + private InteractionResult activateWithOptionalCactus(final BlockState blockState, final ItemStack itemStack, final Level world_1, final Player playerEntity_1, final InteractionHand hand_1, final BlockHitResult blockHitResult_1) { boolean flipped = BlockRotator.flipBlockWithCactus(blockState, world_1, playerEntity_1, hand_1, blockHitResult_1); if (flipped) - return ItemInteractionResult.SUCCESS; + return InteractionResult.SUCCESS; return blockState.useItemOn(itemStack, world_1, playerEntity_1, hand_1, blockHitResult_1); } diff --git a/src/main/java/carpet/mixins/ServerPlayer_scarpetEventMixin.java b/src/main/java/carpet/mixins/ServerPlayer_scarpetEventMixin.java index 15531f17..0086150d 100644 --- a/src/main/java/carpet/mixins/ServerPlayer_scarpetEventMixin.java +++ b/src/main/java/carpet/mixins/ServerPlayer_scarpetEventMixin.java @@ -83,16 +83,6 @@ public abstract class ServerPlayer_scarpetEventMixin extends Player implements S } } - @Redirect(method = "setPlayerInput", at = @At( - value = "INVOKE", - target = "Lnet/minecraft/server/level/ServerPlayer;setShiftKeyDown(Z)V" - )) - private void setSneakingConditionally(ServerPlayer serverPlayerEntity, boolean sneaking) - { - if (!((EntityInterface)serverPlayerEntity.getVehicle()).isPermanentVehicle()) // won't since that method makes sure its not null - serverPlayerEntity.setShiftKeyDown(sneaking); - } - private Vec3 previousLocation; private ResourceKey previousDimension; diff --git a/src/main/java/carpet/mixins/ShulkerBoxAccessMixin.java b/src/main/java/carpet/mixins/ShulkerBoxAccessMixin.java index a0d59a4e..7d766a47 100644 --- a/src/main/java/carpet/mixins/ShulkerBoxAccessMixin.java +++ b/src/main/java/carpet/mixins/ShulkerBoxAccessMixin.java @@ -1,11 +1,6 @@ package carpet.mixins; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -import net.minecraft.client.model.ShulkerModel; @Mixin(net.minecraft.client.renderer.blockentity.ShulkerBoxRenderer.class) public interface ShulkerBoxAccessMixin { - @Accessor("model") - ShulkerModel getModel(); } \ No newline at end of file diff --git a/src/main/java/carpet/mixins/SummonCommand_lightningMixin.java b/src/main/java/carpet/mixins/SummonCommand_lightningMixin.java index 97c4d450..c8e13dc4 100644 --- a/src/main/java/carpet/mixins/SummonCommand_lightningMixin.java +++ b/src/main/java/carpet/mixins/SummonCommand_lightningMixin.java @@ -6,6 +6,7 @@ import net.minecraft.server.commands.SummonCommand; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LightningBolt; import net.minecraft.world.entity.animal.horse.SkeletonHorse; @@ -31,7 +32,7 @@ public class SummonCommand_lightningMixin DifficultyInstance localDifficulty_1 = world.getCurrentDifficultyAt(at); boolean boolean_2 = world.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && world.random.nextDouble() < (double)localDifficulty_1.getEffectiveDifficulty() * 0.01D; if (boolean_2) { - SkeletonHorse skeletonHorseEntity_1 = EntityType.SKELETON_HORSE.create(world); + SkeletonHorse skeletonHorseEntity_1 = EntityType.SKELETON_HORSE.create(world, EntitySpawnReason.EVENT); skeletonHorseEntity_1.setTrap(true); skeletonHorseEntity_1.setAge(0); skeletonHorseEntity_1.setPos(entity.getX(), entity.getY(), entity.getZ()); diff --git a/src/main/java/carpet/patches/EntityPlayerMPFake.java b/src/main/java/carpet/patches/EntityPlayerMPFake.java index b3d5d0cc..b4911ab0 100644 --- a/src/main/java/carpet/patches/EntityPlayerMPFake.java +++ b/src/main/java/carpet/patches/EntityPlayerMPFake.java @@ -77,7 +77,7 @@ public class EntityPlayerMPFake extends ServerPlayer EntityPlayerMPFake instance = new EntityPlayerMPFake(server, worldIn, current, ClientInformation.createDefault(), false); instance.fixStartingPosition = () -> instance.moveTo(pos.x, pos.y, pos.z, (float) yaw, (float) pitch); server.getPlayerList().placeNewPlayer(new FakeClientConnection(PacketFlow.SERVERBOUND), instance, new CommonListenerCookie(current, 0, instance.clientInformation(), false)); - instance.teleportTo(worldIn, pos.x, pos.y, pos.z, (float) yaw, (float) pitch); + instance.teleportTo(worldIn, pos.x, pos.y, pos.z, (float) yaw, (float) pitch, true); instance.setHealth(20.0F); instance.unsetRemoved(); instance.getAttribute(Attributes.STEP_HEIGHT).setBaseValue(0.6F); @@ -215,7 +215,7 @@ public class EntityPlayerMPFake extends ServerPlayer } @Override - public Entity changeDimension(DimensionTransition serverLevel) + public Player changeDimension(DimensionTransition serverLevel) { super.changeDimension(serverLevel); if (wonGame) { diff --git a/src/main/java/carpet/script/CarpetEventServer.java b/src/main/java/carpet/script/CarpetEventServer.java index 24de93ac..3d047e27 100644 --- a/src/main/java/carpet/script/CarpetEventServer.java +++ b/src/main/java/carpet/script/CarpetEventServer.java @@ -1051,11 +1051,11 @@ public class CarpetEventServer public static final Event EXPLOSION_OUTCOME = new Event("explosion_outcome", 8, true) { @Override - public void onExplosion(ServerLevel world, Entity e, Supplier attacker, double x, double y, double z, float power, boolean createFire, List affectedBlocks, List affectedEntities, Explosion.BlockInteraction type) + public boolean onExplosion(ServerLevel world, Entity e, Supplier attacker, Vec3 center, float power, boolean createFire, List affectedBlocks, List affectedEntities, Explosion.BlockInteraction type) { handler.call( () -> Arrays.asList( - ListValue.fromTriple(x, y, z), + ValueConversions.of(center), NumericValue.of(power), EntityValue.of(e), EntityValue.of(attacker != null ? attacker.get() : Event.getExplosionCausingEntity(e)), @@ -1067,6 +1067,7 @@ public class CarpetEventServer ListValue.wrap(affectedEntities.stream().map(EntityValue::of)) ), () -> world.getServer().createCommandSourceStack().withLevel(world) ); + return false; } }; @@ -1074,11 +1075,11 @@ public class CarpetEventServer public static final Event EXPLOSION = new Event("explosion", 6, true) { @Override - public void onExplosion(ServerLevel world, Entity e, Supplier attacker, double x, double y, double z, float power, boolean createFire, List affectedBlocks, List affectedEntities, Explosion.BlockInteraction type) + public boolean onExplosion(ServerLevel world, Entity e, Supplier attacker, Vec3 center, float power, boolean createFire, List affectedBlocks, List affectedEntities, Explosion.BlockInteraction type) { - handler.call( + return handler.call( () -> Arrays.asList( - ListValue.fromTriple(x, y, z), + ValueConversions.of(center), NumericValue.of(power), EntityValue.of(e), EntityValue.of(attacker != null ? attacker.get() : Event.getExplosionCausingEntity(e)), @@ -1306,8 +1307,9 @@ public class CarpetEventServer { } - public void onExplosion(ServerLevel world, Entity e, Supplier attacker, double x, double y, double z, float power, boolean createFire, List affectedBlocks, List affectedEntities, Explosion.BlockInteraction type) + public boolean onExplosion(ServerLevel world, Entity e, Supplier attacker, Vec3 center, float power, boolean createFire, List affectedBlocks, List affectedEntities, Explosion.BlockInteraction type) { + return false; } public void onWorldEvent(ServerLevel world, BlockPos pos) diff --git a/src/main/java/carpet/script/api/Entities.java b/src/main/java/carpet/script/api/Entities.java index 744f8c43..68f74866 100644 --- a/src/main/java/carpet/script/api/Entities.java +++ b/src/main/java/carpet/script/api/Entities.java @@ -33,9 +33,9 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntitySelector; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.player.Player; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; @@ -142,7 +142,7 @@ public class Entities Vec3 vec3d = position.vec; ServerLevel serverWorld = cc.level(); - Entity entity = EntityType.loadEntityRecursive(tag, serverWorld, e -> { + Entity entity = EntityType.loadEntityRecursive(tag, serverWorld, EntitySpawnReason.COMMAND, e -> { e.moveTo(vec3d.x, vec3d.y, vec3d.z, e.getYRot(), e.getXRot()); return e; }); @@ -150,9 +150,9 @@ public class Entities { return Value.NULL; } - if (!hasTag && entity instanceof final Mob mob) + if (!hasTag && entity instanceof Mob mob) { - mob.finalizeSpawn(serverWorld, serverWorld.getCurrentDifficultyAt(entity.blockPosition()), MobSpawnType.COMMAND, null); + mob.finalizeSpawn(serverWorld, serverWorld.getCurrentDifficultyAt(entity.blockPosition()), EntitySpawnReason.COMMAND, null); } if (!serverWorld.tryAddFreshEntityWithPassengers(entity)) { diff --git a/src/main/java/carpet/script/api/Inventories.java b/src/main/java/carpet/script/api/Inventories.java index 11bab7e7..51ee8e17 100644 --- a/src/main/java/carpet/script/api/Inventories.java +++ b/src/main/java/carpet/script/api/Inventories.java @@ -21,7 +21,6 @@ import carpet.script.value.Value; import carpet.script.value.ValueConversions; import java.util.ArrayList; -import java.util.Collection; import java.util.List; import java.util.Objects; import java.util.Optional; @@ -44,6 +43,7 @@ import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.AbstractCookingRecipe; import net.minecraft.world.item.crafting.CustomRecipe; +import net.minecraft.world.item.crafting.PlacementInfo; import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.item.crafting.RecipeType; import net.minecraft.world.item.crafting.ShapedRecipe; @@ -83,12 +83,12 @@ public class Inventories Registry blocks = cc.registry(Registries.ITEM); if (lv.isEmpty()) { - return ListValue.wrap(blocks.getTagNames().map(ValueConversions::of)); + return ListValue.wrap(blocks.getTags().map(ValueConversions::of)); } Item item = NBTSerializableValue.parseItem(lv.get(0).getString(), cc.registryAccess()).getItem(); if (lv.size() == 1) { - return ListValue.wrap(blocks.getTags().filter(e -> e.getSecond().stream().anyMatch(h -> (h.value() == item))).map(e -> ValueConversions.of(e.getFirst()))); + return ListValue.wrap(blocks.getTags().filter(e -> e.stream().anyMatch(h -> (h.value() == item))).map(ValueConversions::of)); } String tag = lv.get(1).getString(); Optional> tagSet = blocks.getTag(TagKey.create(Registries.ITEM, InputValidator.identifierOf(tag))); @@ -124,22 +124,20 @@ public class Inventories { ItemStack result = recipe.getResultItem(regs); List ingredientValue = new ArrayList<>(); - recipe.getIngredients().forEach(ingredient -> { - // I am flattening ingredient lists per slot. - // consider recipe_data('wooden_sword','crafting') and ('iron_nugget', 'blasting') and notice difference - // in depths of lists. - List> stacks = Vanilla.Ingredient_getRecipeStacks(ingredient); - if (stacks.isEmpty()) + recipe.placementInfo().slotInfo().forEach(ingredient -> { + if (ingredient.isEmpty()) { ingredientValue.add(Value.NULL); + return; } - else - { - List alternatives = new ArrayList<>(); - stacks.forEach(col -> col.stream().map(is -> ValueConversions.of(is, regs)).forEach(alternatives::add)); - ingredientValue.add(ListValue.wrap(alternatives)); - } + PlacementInfo.SlotInfo value = ingredient.get(); + int position = value.placerOutputPosition(); + + List alternatives = new ArrayList<>(); + value.possibleItems().stream().map(is -> ValueConversions.of(is, regs)).forEach(alternatives::add); + ingredientValue.add(ListValue.wrap(alternatives)); }); + Value recipeSpec; if (recipe instanceof ShapedRecipe shapedRecipe) { diff --git a/src/main/java/carpet/script/api/WorldAccess.java b/src/main/java/carpet/script/api/WorldAccess.java index ae60ed0d..87bc5849 100644 --- a/src/main/java/carpet/script/api/WorldAccess.java +++ b/src/main/java/carpet/script/api/WorldAccess.java @@ -39,6 +39,7 @@ import net.minecraft.core.HolderSet; import net.minecraft.core.QuartPos; import net.minecraft.core.Registry; import net.minecraft.core.RegistryAccess; +import net.minecraft.core.particles.ParticleOptions; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; @@ -50,6 +51,7 @@ import net.minecraft.server.level.Ticket; import net.minecraft.server.level.TicketType; import net.minecraft.sounds.SoundEvents; import net.minecraft.tags.TagKey; +import net.minecraft.world.level.ServerExplosion; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.chunk.PalettedContainer; import net.minecraft.world.level.chunk.status.ChunkStatus; @@ -695,7 +697,7 @@ public class WorldAccess expression.addContextFunction("update", -1, (c, t, lv) -> booleanStateTest(c, "update", lv, (s, p) -> { - ((CarpetContext) c).level().neighborChanged(p, s.getBlock(), p); + ((CarpetContext) c).level().neighborChanged(p, s.getBlock(), null); return true; })); @@ -1071,10 +1073,9 @@ public class WorldAccess } } LivingEntity theAttacker = attacker; - float thePowah = powah; // copy of ServerWorld.createExplosion #TRACK# - Explosion explosion = new Explosion(cc.level(), source, null, null, pos.x, pos.y, pos.z, powah, createFire, mode, ParticleTypes.EXPLOSION, ParticleTypes.EXPLOSION_EMITTER, SoundEvents.GENERIC_EXPLODE) + ServerExplosion explosion = new ServerExplosion(cc.level(), source, null, null, pos, powah, createFire, mode) { @Override @Nullable @@ -1085,16 +1086,11 @@ public class WorldAccess } }; explosion.explode(); - explosion.finalizeExplosion(false); - if (mode == Explosion.BlockInteraction.KEEP) - { - explosion.clearToBlow(); - } - Explosion.BlockInteraction finalMode = mode; + ParticleOptions explosionParticle = explosion.isSmall() ? ParticleTypes.EXPLOSION : ParticleTypes.EXPLOSION_EMITTER; cc.level().players().forEach(spe -> { if (spe.distanceToSqr(pos) < 4096.0D) { - spe.connection.send(new ClientboundExplodePacket(pos.x, pos.y, pos.z, thePowah, explosion.getToBlow(), explosion.getHitPlayers().get(spe), finalMode, ParticleTypes.EXPLOSION, ParticleTypes.EXPLOSION_EMITTER, SoundEvents.GENERIC_EXPLODE)); + spe.connection.send(new ClientboundExplodePacket(pos, Optional.ofNullable(explosion.getHitPlayers().get(spe)), explosionParticle, SoundEvents.GENERIC_EXPLODE)); } }); return Value.TRUE; @@ -1239,13 +1235,13 @@ public class WorldAccess Registry blocks = cc.registry(Registries.BLOCK); if (lv.isEmpty()) { - return ListValue.wrap(blocks.getTagNames().map(ValueConversions::of)); + return ListValue.wrap(blocks.getTags().map(ValueConversions::of)); } BlockArgument blockLocator = BlockArgument.findIn(cc, lv, 0, true); if (blockLocator.offset == lv.size()) { Block target = blockLocator.block.getBlockState().getBlock(); - return ListValue.wrap(blocks.getTags().filter(e -> e.getSecond().stream().anyMatch(h -> (h.value() == target))).map(e -> ValueConversions.of(e.getFirst()))); + return ListValue.wrap(blocks.getTags().filter(e -> e.stream().anyMatch(h -> (h.value() == target))).map(ValueConversions::of)); } String tag = lv.get(blockLocator.offset).getString(); Optional> tagSet = blocks.getTag(TagKey.create(Registries.BLOCK, InputValidator.identifierOf(tag))); diff --git a/src/main/java/carpet/script/external/Vanilla.java b/src/main/java/carpet/script/external/Vanilla.java index f046ae62..4ef3e1b5 100644 --- a/src/main/java/carpet/script/external/Vanilla.java +++ b/src/main/java/carpet/script/external/Vanilla.java @@ -7,7 +7,6 @@ import carpet.fakes.BlockStateArgumentInterface; import carpet.fakes.ChunkTicketManagerInterface; import carpet.fakes.CommandDispatcherInterface; import carpet.fakes.EntityInterface; -import carpet.fakes.IngredientInterface; import carpet.fakes.InventoryBearerInterface; import carpet.fakes.ItemEntityInterface; import carpet.fakes.LivingEntityInterface; @@ -108,11 +107,6 @@ public class Vanilla return Map.of(); //return ((ThreadedAnvilChunkStorageInterface) chunkMap).regenerateChunkRegion(requestedChunks); } - public static List> Ingredient_getRecipeStacks(Ingredient ingredient) - { - return ((IngredientInterface) (Object) ingredient).getRecipeStacks(); - } - public static List> RecipeManager_getAllMatching(RecipeManager recipeManager, RecipeType type, ResourceLocation output, RegistryAccess registryAccess) { return ((RecipeManagerInterface) recipeManager).getAllMatching(type, output, registryAccess); diff --git a/src/main/java/carpet/script/external/VanillaClient.java b/src/main/java/carpet/script/external/VanillaClient.java index 874d15fc..86a0086c 100644 --- a/src/main/java/carpet/script/external/VanillaClient.java +++ b/src/main/java/carpet/script/external/VanillaClient.java @@ -1,13 +1,5 @@ package carpet.script.external; -import carpet.mixins.ShulkerBoxAccessMixin; -import net.minecraft.client.model.ShulkerModel; -import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; -import net.minecraft.world.level.block.entity.ShulkerBoxBlockEntity; - public class VanillaClient { - public static ShulkerModel ShulkerBoxRenderer_model(BlockEntityRenderer shulkerBoxRenderer) { - return ((ShulkerBoxAccessMixin)shulkerBoxRenderer).getModel(); - } } diff --git a/src/main/java/carpet/script/utils/BiomeInfo.java b/src/main/java/carpet/script/utils/BiomeInfo.java index 4cd07760..51aee83d 100644 --- a/src/main/java/carpet/script/utils/BiomeInfo.java +++ b/src/main/java/carpet/script/utils/BiomeInfo.java @@ -23,7 +23,7 @@ public class BiomeInfo { public static final Map> biomeFeatures = new HashMap<>() {{ - put("tags", (w, b) -> ListValue.wrap(w.registryAccess().registryOrThrow(Registries.BIOME).getTags().filter(p -> p.getSecond().stream().anyMatch(h -> h.value() == b)).map(p -> p.getFirst().location()).map(ValueConversions::of))); + put("tags", (w, b) -> ListValue.wrap(w.registryAccess().registryOrThrow(Registries.BIOME).getTags().filter(p -> p.stream().anyMatch(h -> h.value() == b)).map(ValueConversions::of))); put("temperature", (w, b) -> NumericValue.of(b.getBaseTemperature())); put("fog_color", (w, b) -> ValueConversions.ofRGB(b.getSpecialEffects().getFogColor())); put("foliage_color", (w, b) -> ValueConversions.ofRGB(b.getSpecialEffects().getFoliageColorOverride().orElse(4764952))); // client Biome.getDefaultFoliageColor @@ -31,7 +31,7 @@ public class BiomeInfo put("water_color", (w, b) -> ValueConversions.ofRGB(b.getSpecialEffects().getWaterColor())); put("water_fog_color", (w, b) -> ValueConversions.ofRGB(b.getSpecialEffects().getWaterFogColor())); put("humidity", (w, b) -> NumericValue.of(Vanilla.Biome_getClimateSettings(b).downfall())); - put("precipitation", (w, b) -> StringValue.of(b.getPrecipitationAt(new BlockPos(0, w.getSeaLevel(), 0)).name().toLowerCase(Locale.ROOT))); + put("precipitation", (w, b) -> StringValue.of(b.getPrecipitationAt(new BlockPos(0, w.getSeaLevel(), 0), w.getSeaLevel()).name().toLowerCase(Locale.ROOT))); put("features", (w, b) -> { Registry> registry = w.registryAccess().registryOrThrow(Registries.CONFIGURED_FEATURE); return ListValue.wrap( diff --git a/src/main/java/carpet/script/utils/FeatureGenerator.java b/src/main/java/carpet/script/utils/FeatureGenerator.java index 32f84a32..466eea1d 100644 --- a/src/main/java/carpet/script/utils/FeatureGenerator.java +++ b/src/main/java/carpet/script/utils/FeatureGenerator.java @@ -304,8 +304,7 @@ public class FeatureGenerator return spawnCustomStructure( - new JigsawStructure(new Structure.StructureSettings( - l.registryAccess().registryOrThrow(Registries.BIOME).getOrCreateTag(BiomeTags.HAS_BASTION_REMNANT), + new JigsawStructure(new Structure.StructureSettings(l.registryAccess().lookup(Registries.BIOME).orElseThrow().getOrThrow(BiomeTags.HAS_BASTION_REMNANT), Map.of(), GenerationStep.Decoration.SURFACE_STRUCTURES, TerrainAdjustment.NONE @@ -334,7 +333,7 @@ public class FeatureGenerator return spawnCustomStructure( new JigsawStructure(new Structure.StructureSettings( - l.registryAccess().registryOrThrow(Registries.BIOME).getOrCreateTag(BiomeTags.HAS_BASTION_REMNANT), + l.registryAccess().lookup(Registries.BIOME).orElseThrow().getOrThrow(BiomeTags.HAS_BASTION_REMNANT), Map.of(), GenerationStep.Decoration.SURFACE_STRUCTURES, TerrainAdjustment.NONE @@ -363,7 +362,7 @@ public class FeatureGenerator return spawnCustomStructure( new JigsawStructure(new Structure.StructureSettings( - l.registryAccess().registryOrThrow(Registries.BIOME).getOrCreateTag(BiomeTags.HAS_BASTION_REMNANT), + l.registryAccess().lookup(Registries.BIOME).orElseThrow().getOrThrow(BiomeTags.HAS_BASTION_REMNANT), Map.of(), GenerationStep.Decoration.SURFACE_STRUCTURES, TerrainAdjustment.NONE @@ -392,7 +391,7 @@ public class FeatureGenerator return spawnCustomStructure( new JigsawStructure(new Structure.StructureSettings( - l.registryAccess().registryOrThrow(Registries.BIOME).getOrCreateTag(BiomeTags.HAS_BASTION_REMNANT), + l.registryAccess().lookup(Registries.BIOME).orElseThrow().getOrThrow(BiomeTags.HAS_BASTION_REMNANT), Map.of(), GenerationStep.Decoration.SURFACE_STRUCTURES, TerrainAdjustment.NONE diff --git a/src/main/java/carpet/script/utils/ShapesRenderer.java b/src/main/java/carpet/script/utils/ShapesRenderer.java index 7d6edd6f..534e768b 100644 --- a/src/main/java/carpet/script/utils/ShapesRenderer.java +++ b/src/main/java/carpet/script/utils/ShapesRenderer.java @@ -2,7 +2,6 @@ package carpet.script.utils; import carpet.script.CarpetScriptServer; import carpet.script.external.Carpet; -import carpet.script.external.VanillaClient; import carpet.script.utils.shapes.ShapeDirection; import com.mojang.blaze3d.systems.RenderSystem; @@ -12,7 +11,6 @@ import com.mojang.blaze3d.vertex.ByteBufferBuilder; import com.mojang.blaze3d.vertex.DefaultVertexFormat; import com.mojang.blaze3d.vertex.PoseStack; 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.Axis; @@ -26,34 +24,27 @@ import java.util.function.BiFunction; import net.minecraft.client.Camera; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Font; -import net.minecraft.client.model.ShulkerModel; -import net.minecraft.client.model.geom.ModelPart; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.ItemBlockRenderTypes; import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.Sheets; import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; import net.minecraft.client.renderer.texture.OverlayTexture; -import net.minecraft.client.resources.model.Material; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.resources.ResourceKey; import net.minecraft.util.Mth; -import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.level.Level; import net.minecraft.world.level.LightLayer; import net.minecraft.world.level.block.EntityBlock; import net.minecraft.world.level.block.LeavesBlock; import net.minecraft.world.level.block.RenderShape; -import net.minecraft.world.level.block.ShulkerBoxBlock; 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; @@ -160,7 +151,6 @@ public class ShapesRenderer Matrix4fStack matrixStack = RenderSystem.getModelViewStack(); matrixStack.pushMatrix(); matrixStack.mul(matrices.last().pose()); - RenderSystem.applyModelViewMatrix(); // lines RenderSystem.lineWidth(0.5F); @@ -180,7 +170,6 @@ public class ShapesRenderer }); RenderSystem.lineWidth(1.0F); matrixStack.popMatrix(); - RenderSystem.applyModelViewMatrix(); } if (!labels.isEmpty()) @@ -439,15 +428,8 @@ public class ShapesRenderer } } } - if (BlockEntity instanceof ShulkerBoxBlockEntity sbBlockEntity) + if (BlockEntity != null) { - sbrender(sbBlockEntity, partialTick, - matrices, immediate, light, OverlayTexture.NO_OVERLAY); - } - else - { - if (BlockEntity != null) - { BlockEntityRenderer blockEntityRenderer = client.getBlockEntityRenderDispatcher().getRenderer(BlockEntity); if (blockEntityRenderer != null) { @@ -455,7 +437,6 @@ public class ShapesRenderer matrices, immediate, light, OverlayTexture.NO_OVERLAY); } - } } } else @@ -480,44 +461,6 @@ public class ShapesRenderer { return true; } - - // copy and modifiy a bit from net.minecraft.client.renderer.blockentity.ShulkerBoxRenderer.render - public void sbrender(ShulkerBoxBlockEntity shulkerBoxBlockEntity, float f, PoseStack poseStack, MultiBufferSource multiBufferSource, int i, int j) - { - Direction direction = Direction.UP; - if (shulkerBoxBlockEntity.hasLevel()) - { - BlockState blockState = shulkerBoxBlockEntity.getBlockState(); - if (blockState.getBlock() instanceof ShulkerBoxBlock) - { - direction = blockState.getValue(ShulkerBoxBlock.FACING); - } - } - DyeColor dyeColor = shulkerBoxBlockEntity.getColor(); - Material material; - if (dyeColor == null) - { - material = Sheets.DEFAULT_SHULKER_TEXTURE_LOCATION; - } - else - { - material = Sheets.SHULKER_TEXTURE_LOCATION.get(dyeColor.getId()); - } - - poseStack.pushPose(); - poseStack.translate(0.5, 0.5, 0.5); - poseStack.scale(0.9995F, 0.9995F, 0.9995F); - poseStack.mulPose(direction.getRotation()); - poseStack.scale(1.0F, -1.0F, -1.0F); - poseStack.translate(0.0, -1.0, 0.0); - ShulkerModel model = VanillaClient.ShulkerBoxRenderer_model(client.getBlockEntityRenderDispatcher().getRenderer(shulkerBoxBlockEntity)); - ModelPart modelPart = model.getLid(); - modelPart.setPos(0.0F, 24.0F - shulkerBoxBlockEntity.getProgress(f) * 0.5F * 16.0F, 0.0F); - modelPart.yRot = 270.0F * shulkerBoxBlockEntity.getProgress(f) * (float) (Math.PI / 180.0); - VertexConsumer vertexConsumer = material.buffer(multiBufferSource, RenderType::entityCutoutNoCull); - model.renderToBuffer(poseStack, vertexConsumer, i, j, 0xffffffff); - poseStack.popPose(); - } } diff --git a/src/main/java/carpet/script/utils/SystemInfo.java b/src/main/java/carpet/script/utils/SystemInfo.java index 0174d904..4cc8b522 100644 --- a/src/main/java/carpet/script/utils/SystemInfo.java +++ b/src/main/java/carpet/script/utils/SystemInfo.java @@ -165,7 +165,7 @@ public class SystemInfo put("world_gamerules", c -> { Map rules = new HashMap<>(); GameRules gameRules = c.level().getGameRules(); - GameRules.visitGameRuleTypes(new GameRules.GameRuleTypeVisitor() + gameRules.visitGameRuleTypes(new GameRules.GameRuleTypeVisitor() { @Override public > void visit(GameRules.Key key, GameRules.Type type) diff --git a/src/main/java/carpet/script/value/EntityValue.java b/src/main/java/carpet/script/value/EntityValue.java index f3dcc1cc..cdd27777 100644 --- a/src/main/java/carpet/script/value/EntityValue.java +++ b/src/main/java/carpet/script/value/EntityValue.java @@ -25,8 +25,8 @@ import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.StringTag; -import net.minecraft.network.protocol.game.ClientboundSetCarriedItemPacket; import net.minecraft.network.protocol.game.ClientboundSetExperiencePacket; +import net.minecraft.network.protocol.game.ClientboundSetHeldSlotPacket; import net.minecraft.network.protocol.game.ClientboundSetPassengersPacket; import net.minecraft.network.protocol.game.ClientboundTeleportEntityPacket; import net.minecraft.resources.ResourceKey; @@ -457,7 +457,7 @@ public class EntityValue extends Value put("scoreboard_tags", (e, a) -> ListValue.wrap(e.getTags().stream().map(StringValue::new))); put("entity_tags", (e, a) -> { EntityType type = e.getType(); - return ListValue.wrap(e.getServer().registryAccess().registryOrThrow(Registries.ENTITY_TYPE).getTags().filter(entry -> entry.getSecond().stream().anyMatch(h -> h.value() == type)).map(entry -> ValueConversions.of(entry.getFirst()))); + return ListValue.wrap(e.getServer().registryAccess().registryOrThrow(Registries.ENTITY_TYPE).getTags().filter(entry -> entry.stream().anyMatch(h -> h.value() == type)).map(entry -> ValueConversions.of(entry))); }); // deprecated put("has_tag", (e, a) -> BooleanValue.of(e.getTags().contains(a.getString()))); @@ -1019,7 +1019,7 @@ public class EntityValue extends Value if (e instanceof ServerPlayer player) { int slot = NumericValue.asNumber(v).getInt(); - player.connection.send(new ClientboundSetCarriedItemPacket(slot)); + player.connection.send(new ClientboundSetHeldSlotPacket(slot)); } }); diff --git a/src/main/java/carpet/script/value/ValueConversions.java b/src/main/java/carpet/script/value/ValueConversions.java index 8bf58f1d..25555f49 100644 --- a/src/main/java/carpet/script/value/ValueConversions.java +++ b/src/main/java/carpet/script/value/ValueConversions.java @@ -10,6 +10,7 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import net.minecraft.advancements.critereon.MinMaxBounds; import net.minecraft.core.BlockPos; import net.minecraft.core.GlobalPos; +import net.minecraft.core.HolderSet; import net.minecraft.core.Registry; import net.minecraft.core.RegistryAccess; import net.minecraft.core.Vec3i; @@ -189,6 +190,11 @@ public class ValueConversions return of(tagKey.location()); } + public static Value of(HolderSet.Named tagKey) + { + return of(tagKey.key().location()); + } + public static Value of(@Nullable ResourceLocation id) { if (id == null) // should be Value.NULL diff --git a/src/main/java/carpet/utils/BlockInfo.java b/src/main/java/carpet/utils/BlockInfo.java index e1519e85..d5532aca 100644 --- a/src/main/java/carpet/utils/BlockInfo.java +++ b/src/main/java/carpet/utils/BlockInfo.java @@ -9,8 +9,8 @@ import net.minecraft.core.Registry; import net.minecraft.core.registries.Registries; import net.minecraft.network.chat.Component; import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.PathfinderMob; import net.minecraft.world.entity.ai.goal.RandomStrollGoal; import net.minecraft.world.entity.ai.util.DefaultRandomPos; @@ -75,7 +75,7 @@ public class BlockInfo private static Component wander_chances(BlockPos pos, ServerLevel worldIn) { PathfinderMob creature = new ZombifiedPiglin(EntityType.ZOMBIFIED_PIGLIN, worldIn); - creature.finalizeSpawn(worldIn, worldIn.getCurrentDifficultyAt(pos), MobSpawnType.NATURAL, null); + creature.finalizeSpawn(worldIn, worldIn.getCurrentDifficultyAt(pos), EntitySpawnReason.NATURAL, null); creature.moveTo(pos, 0.0F, 0.0F); RandomStrollGoal wander = new RandomStrollGoal(creature, 0.8D); int success = 0; diff --git a/src/main/java/carpet/utils/PerimeterDiagnostics.java b/src/main/java/carpet/utils/PerimeterDiagnostics.java index 0b7be1b6..8fccdfd7 100644 --- a/src/main/java/carpet/utils/PerimeterDiagnostics.java +++ b/src/main/java/carpet/utils/PerimeterDiagnostics.java @@ -6,10 +6,10 @@ import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerLevel; import net.minecraft.tags.FluidTags; import net.minecraft.world.entity.AgeableMob; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.MobCategory; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.SpawnPlacements; import net.minecraft.world.entity.ambient.AmbientCreature; import net.minecraft.world.entity.animal.WaterAnimal; @@ -179,8 +179,8 @@ public class PerimeterDiagnostics if (SpawnPlacements.isSpawnPositionOk(sle.type, worldServer, pos)) { el.moveTo(pos.getX() + 0.5F, pos.getY(), pos.getZ()+0.5F, 0.0F, 0.0F); - return el.checkSpawnObstruction(worldServer) && el.checkSpawnRules(worldServer, MobSpawnType.NATURAL) && - SpawnPlacements.checkSpawnRules(el.getType(),(ServerLevel)el.getCommandSenderWorld(), MobSpawnType.NATURAL, el.blockPosition(), el.getCommandSenderWorld().random) && + return el.checkSpawnObstruction(worldServer) && el.checkSpawnRules(worldServer, EntitySpawnReason.NATURAL) && + SpawnPlacements.checkSpawnRules(el.getType(),(ServerLevel)el.getCommandSenderWorld(), EntitySpawnReason.NATURAL, el.blockPosition(), el.getCommandSenderWorld().random) && worldServer.noCollision(el); // check collision rules once they stop fiddling with them after 1.14.1 } return false; diff --git a/src/main/java/carpet/utils/SpawnReporter.java b/src/main/java/carpet/utils/SpawnReporter.java index 512431c9..106786b3 100644 --- a/src/main/java/carpet/utils/SpawnReporter.java +++ b/src/main/java/carpet/utils/SpawnReporter.java @@ -13,11 +13,11 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.tags.BlockTags; import net.minecraft.util.Mth; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.MobCategory; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.SpawnPlacements; import net.minecraft.world.entity.animal.Ocelot; import net.minecraft.world.item.DyeColor; @@ -421,7 +421,7 @@ public class SpawnReporter Mob mob; try { - mob = (Mob) spawnEntry.type.create(worldIn); + mob = (Mob) spawnEntry.type.create(worldIn, EntitySpawnReason.NATURAL); } catch (Exception e) { @@ -443,9 +443,9 @@ public class SpawnReporter for (int i = 0; i < 20; ++i) { if ( - SpawnPlacements.checkSpawnRules(etype,worldIn, MobSpawnType.NATURAL, pos, worldIn.random) && + SpawnPlacements.checkSpawnRules(etype,worldIn, EntitySpawnReason.NATURAL, pos, worldIn.random) && SpawnPlacements.isSpawnPositionOk(etype, worldIn, pos) && - mob.checkSpawnRules(worldIn, MobSpawnType.NATURAL) + mob.checkSpawnRules(worldIn, EntitySpawnReason.NATURAL) // && mob.canSpawn(worldIn) // entity collisions // mostly - except ocelots ) { @@ -459,7 +459,7 @@ public class SpawnReporter willSpawn += 1; } } - mob.finalizeSpawn(worldIn, worldIn.getCurrentDifficultyAt(mob.blockPosition()), MobSpawnType.NATURAL, null); + mob.finalizeSpawn(worldIn, worldIn.getCurrentDifficultyAt(mob.blockPosition()), EntitySpawnReason.NATURAL, null); // the code invokes onInitialSpawn after getCanSpawHere fits = fits && worldIn.noCollision(mob); @@ -467,7 +467,7 @@ public class SpawnReporter try { - mob = (Mob) spawnEntry.type.create(worldIn); + mob = (Mob) spawnEntry.type.create(worldIn, EntitySpawnReason.NATURAL); } catch (Exception e) { diff --git a/src/main/resources/carpet.accesswidener b/src/main/resources/carpet.accesswidener index 8aa2dafe..de24c461 100644 --- a/src/main/resources/carpet.accesswidener +++ b/src/main/resources/carpet.accesswidener @@ -2,7 +2,6 @@ accessWidener v1 named accessible class net/minecraft/server/level/ChunkMap$DistanceManager accessible class net/minecraft/server/level/ThreadedLevelLightEngine$TaskType -accessible class net/minecraft/world/item/crafting/Ingredient$Value accessible class net/minecraft/world/level/lighting/BlockLightSectionStorage$BlockDataLayerStorageMap accessible class net/minecraft/world/level/border/WorldBorder$BorderExtent accessible class net/minecraft/world/level/border/WorldBorder$StaticBorderExtent @@ -12,6 +11,7 @@ accessible class net/minecraft/world/level/block/entity/SculkSensorBlockEntity$V #TODO fields and methods should be fetched via interfaces unless there is a good reason not to accessible method net/minecraft/world/level/border/WorldBorder getListeners ()Ljava/util/List; +accessible method net/minecraft/world/level/redstone/DefaultRedstoneWireEvaluator calculateTargetStrength (Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;)I accessible method net/minecraft/server/level/DistanceManager purgeStaleTickets ()V #cause I don't want to deal with the interfaces until stuff is stable diff --git a/src/main/resources/carpet.mixins.json b/src/main/resources/carpet.mixins.json index 6b68dcff..9fa3de98 100644 --- a/src/main/resources/carpet.mixins.json +++ b/src/main/resources/carpet.mixins.json @@ -139,7 +139,8 @@ "MerchantResultSlot_scarpetEventMixin", "AbstractContainerMenu_scarpetMixin", "AbstractContainerMenuSubclasses_scarpetMixin", - "RecipeBookMenu_scarpetMixin", + "AbstractCraftingMenu_scarpetMixin", + "AbstractFurnaceMenu_scarpetMixin", "DistanceManager_scarpetMixin", "PoiRecord_scarpetMixin", "ServerLevel_scarpetMixin", @@ -150,7 +151,6 @@ "CommandDispatcher_scarpetCommandsMixin", "RecipeManager_scarpetMixin", - "Ingredient_scarpetMixin", "BlockInput_scarpetMixin", "BlockPredicate_scarpetMixin", "TagPredicate_scarpetMixin", @@ -180,19 +180,21 @@ "ChestBlock_customStickyMixin", "PistonStructureResolver_customStickyMixin", + "DefaultRedstoneWireEvaluator_redstoneMixin", + "CustomPacketPayload_networkStuffMixin", "ServerGamePacketListenerimpl_connectionMixin" ], "client": [ "Minecraft_tickMixin", - "ShulkerBoxAccessMixin", "MinecraftMixin", "Gui_tablistMixin", "PlayerTabOverlayMixin", "PistonHeadRenderer_movableBEMixin", "StructureBlockRenderer_mixin", "ClientPacketListener_clientCommandMixin", + "ClientPacketListener_explosionMixin", "LevelRenderer_fogOffMixin", "LevelRenderer_creativeNoClipMixin", "ClientPacketListener_customPacketsMixin", From f6d5529b07c36b4b544e2f276776726a8adeb1da Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Sun, 18 Aug 2024 19:11:50 +0200 Subject: [PATCH 002/232] 1.4.148 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index d51b5441..7c807fb3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G fabric_version=0.102.0+1.21 # Mod Properties - mod_version = 1.4.147 + mod_version = 1.4.148 maven_group = carpet archives_base_name = fabric-carpet From 6d0c9597cd860494cebc2d81d9eb4dd7cee34353 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Wed, 21 Aug 2024 23:19:15 +0200 Subject: [PATCH 003/232] 24w34a --- gradle.properties | 2 +- .../carpet/commands/PerimeterInfoCommand.java | 2 +- .../helpers/EntityPlayerActionPack.java | 12 ++++---- .../mixins/RedstoneWireBlock_fastMixin.java | 28 +++++++++++-------- ...LightEngine_scarpetChunkCreationMixin.java | 4 +-- .../java/carpet/script/api/WorldAccess.java | 2 +- .../carpet/script/utils/ShapesRenderer.java | 5 ++-- .../java/carpet/script/utils/SystemInfo.java | 4 +-- .../carpet/utils/PerimeterDiagnostics.java | 4 +-- 9 files changed, 34 insertions(+), 29 deletions(-) diff --git a/gradle.properties b/gradle.properties index 7c807fb3..d46e1d2c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=24w33a + minecraft_version=24w34a loader_version=0.15.11 jsr305_version=3.0.2 fabric_version=0.102.0+1.21 diff --git a/src/main/java/carpet/commands/PerimeterInfoCommand.java b/src/main/java/carpet/commands/PerimeterInfoCommand.java index 762277e9..f28885bd 100644 --- a/src/main/java/carpet/commands/PerimeterInfoCommand.java +++ b/src/main/java/carpet/commands/PerimeterInfoCommand.java @@ -56,7 +56,7 @@ public class PerimeterInfoCommand { nbttagcompound.putString("id", mobId); Entity baseEntity = EntityType.loadEntityRecursive(nbttagcompound, source.getLevel(), EntitySpawnReason.COMMAND, (entity_1x) -> { - entity_1x.moveTo(new BlockPos(pos.getX(), source.getLevel().getMinBuildHeight()-10, pos.getZ()), entity_1x.getYRot(), entity_1x. getXRot()); + entity_1x.moveTo(new BlockPos(pos.getX(), source.getLevel().getMinY()-10, pos.getZ()), entity_1x.getYRot(), entity_1x. getXRot()); return !source.getLevel().addWithUUID(entity_1x) ? null : entity_1x; }); if (!(baseEntity instanceof Mob)) diff --git a/src/main/java/carpet/helpers/EntityPlayerActionPack.java b/src/main/java/carpet/helpers/EntityPlayerActionPack.java index f87c302c..4bdd93bf 100644 --- a/src/main/java/carpet/helpers/EntityPlayerActionPack.java +++ b/src/main/java/carpet/helpers/EntityPlayerActionPack.java @@ -314,7 +314,7 @@ public class EntityPlayerActionPack BlockHitResult blockHit = (BlockHitResult) hit; BlockPos pos = blockHit.getBlockPos(); Direction side = blockHit.getDirection(); - if (pos.getY() < player.level().getMaxBuildHeight() - (side == Direction.UP ? 1 : 0) && world.mayInteract(player, pos)) + if (pos.getY() < player.level().getMaxY() - (side == Direction.UP ? 1 : 0) && world.mayInteract(player, pos)) { InteractionResult result = player.gameMode.useItemOn(player, world, player.getItemInHand(hand), hand, blockHit); if (result instanceof InteractionResult.Success success) @@ -402,7 +402,7 @@ public class EntityPlayerActionPack boolean blockBroken = false; if (player.gameMode.getGameModeForPlayer().isCreative()) { - player.gameMode.handleBlockBreakAction(pos, ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, side, player.level().getMaxBuildHeight(), -1); + player.gameMode.handleBlockBreakAction(pos, ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, side, player.level().getMaxY(), -1); ap.blockHitDelay = 5; blockBroken = true; } @@ -410,9 +410,9 @@ public class EntityPlayerActionPack { if (ap.currentBlock != null) { - player.gameMode.handleBlockBreakAction(ap.currentBlock, ServerboundPlayerActionPacket.Action.ABORT_DESTROY_BLOCK, side, player.level().getMaxBuildHeight(), -1); + player.gameMode.handleBlockBreakAction(ap.currentBlock, ServerboundPlayerActionPacket.Action.ABORT_DESTROY_BLOCK, side, player.level().getMaxY(), -1); } - player.gameMode.handleBlockBreakAction(pos, ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, side, player.level().getMaxBuildHeight(), -1); + player.gameMode.handleBlockBreakAction(pos, ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, side, player.level().getMaxY(), -1); boolean notAir = !state.isAir(); if (notAir && ap.curBlockDamageMP == 0) { @@ -435,7 +435,7 @@ public class EntityPlayerActionPack ap.curBlockDamageMP += state.getDestroyProgress(player, player.level(), pos); if (ap.curBlockDamageMP >= 1) { - player.gameMode.handleBlockBreakAction(pos, ServerboundPlayerActionPacket.Action.STOP_DESTROY_BLOCK, side, player.level().getMaxBuildHeight(), -1); + player.gameMode.handleBlockBreakAction(pos, ServerboundPlayerActionPacket.Action.STOP_DESTROY_BLOCK, side, player.level().getMaxY(), -1); ap.currentBlock = null; ap.blockHitDelay = 5; blockBroken = true; @@ -457,7 +457,7 @@ public class EntityPlayerActionPack EntityPlayerActionPack ap = ((ServerPlayerInterface) player).getActionPack(); if (ap.currentBlock == null) return; player.level().destroyBlockProgress(-1, ap.currentBlock, -1); - player.gameMode.handleBlockBreakAction(ap.currentBlock, ServerboundPlayerActionPacket.Action.ABORT_DESTROY_BLOCK, Direction.DOWN, player.level().getMaxBuildHeight(), -1); + player.gameMode.handleBlockBreakAction(ap.currentBlock, ServerboundPlayerActionPacket.Action.ABORT_DESTROY_BLOCK, Direction.DOWN, player.level().getMaxY(), -1); ap.currentBlock = null; } }, diff --git a/src/main/java/carpet/mixins/RedstoneWireBlock_fastMixin.java b/src/main/java/carpet/mixins/RedstoneWireBlock_fastMixin.java index 6f169425..ec5caaf7 100644 --- a/src/main/java/carpet/mixins/RedstoneWireBlock_fastMixin.java +++ b/src/main/java/carpet/mixins/RedstoneWireBlock_fastMixin.java @@ -33,7 +33,7 @@ import static net.minecraft.world.level.block.RedStoneWireBlock.POWER; public abstract class RedstoneWireBlock_fastMixin implements RedstoneWireBlockInterface { @Shadow - private void updatePowerStrength(Level world_1, BlockPos blockPos_1, BlockState blockState_1, @Nullable final Orientation orientation) { } + private void updatePowerStrength(Level world_1, BlockPos blockPos_1, BlockState blockState_1, @Nullable final Orientation orientation, boolean sup) { } @Override @Accessor("shouldSignal") @@ -57,7 +57,7 @@ public abstract class RedstoneWireBlock_fastMixin implements RedstoneWireBlockIn // = - public void fastUpdate(Level world, BlockPos pos, BlockState state, Orientation o) { + public void fastUpdate(Level world, BlockPos pos, BlockState state, Orientation o, boolean sup) { // [CM] fastRedstoneDust -- update based on carpet rule if (CarpetSettings.fastRedstoneDust) { BlockPos source = null; // todo this probably removes all improvements from the original method @@ -65,14 +65,14 @@ public abstract class RedstoneWireBlock_fastMixin implements RedstoneWireBlockIn wireTurbo.updateSurroundingRedstone(world, pos, state, source); return; } - updatePowerStrength(world, pos, state, o); + updatePowerStrength(world, pos, state, o, sup); } /** * @author theosib, soykaf, gnembon */ @Inject(method = "updatePowerStrength", at = @At("HEAD"), cancellable = true) - private void updateLogicAlternative(Level world, BlockPos pos, BlockState state, Orientation orientation, CallbackInfo cir) { + private void updateLogicAlternative(Level world, BlockPos pos, BlockState state, Orientation orientation, boolean sup, CallbackInfo cir) { if (CarpetSettings.fastRedstoneDust) { updateLogicPublic(world, pos, state); cir.cancel(); @@ -114,17 +114,20 @@ public abstract class RedstoneWireBlock_fastMixin implements RedstoneWireBlockIn // = - @Redirect(method = "onPlace", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/RedStoneWireBlock;updatePowerStrength(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/redstone/Orientation;)V")) - private void redirectOnBlockAddedUpdate(RedStoneWireBlock self, Level world_1, BlockPos blockPos_1, BlockState blockState_1, Orientation o) { - fastUpdate(world_1, blockPos_1, blockState_1, o); + @Redirect(method = "onPlace", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/RedStoneWireBlock;updatePowerStrength(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/redstone/Orientation;Z)V")) + private void redirectOnBlockAddedUpdate(RedStoneWireBlock self, Level world_1, BlockPos blockPos_1, BlockState blockState_1, Orientation o, boolean sup) { + fastUpdate(world_1, blockPos_1, blockState_1, o, sup); } - @Redirect(method = "onRemove", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/RedStoneWireBlock;updatePowerStrength(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/redstone/Orientation;)V")) - private void redirectOnStateReplacedUpdate(RedStoneWireBlock self, Level world_1, BlockPos blockPos_1, BlockState blockState_1, Orientation o) { - fastUpdate(world_1, blockPos_1, blockState_1, o); + @Redirect(method = "onRemove", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/RedStoneWireBlock;updatePowerStrength(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/redstone/Orientation;Z)V")) + private void redirectOnStateReplacedUpdate(RedStoneWireBlock self, Level world_1, BlockPos blockPos_1, BlockState blockState_1, Orientation o, boolean sup) { + fastUpdate(world_1, blockPos_1, blockState_1, o, sup); } - @Redirect(method = "neighborChanged", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/RedStoneWireBlock;updatePowerStrength(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/redstone/Orientation;)V")) + @Redirect(method = "neighborChanged", at = @At(value = "INVOKE", target = + "Lnet/minecraft/world/level/block/RedStoneWireBlock;updatePowerStrength(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/redstone/Orientation;Z)V" + //"Lnet/minecraft/world/level/block/RedStoneWireBlock;updatePowerStrength(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/redstone/Orientation;)V" + )) //private void red(final RedStoneWireBlock instance, final Level level, // final BlockPos blockPos, final BlockState blockState, final Orientation orientation) private void redirectNeighborUpdateUpdate( @@ -133,6 +136,7 @@ public abstract class RedstoneWireBlock_fastMixin implements RedstoneWireBlockIn BlockPos blockPos_1, BlockState blockState_1, Orientation o, + boolean sup, BlockState blockState_2, Level world_2, BlockPos blockPos_2, @@ -141,6 +145,6 @@ public abstract class RedstoneWireBlock_fastMixin implements RedstoneWireBlockIn boolean b ) { - fastUpdate(world_1, blockPos_1, blockState_1, o); + fastUpdate(world_1, blockPos_1, blockState_1, o, sup); } } diff --git a/src/main/java/carpet/mixins/ThreadedLevelLightEngine_scarpetChunkCreationMixin.java b/src/main/java/carpet/mixins/ThreadedLevelLightEngine_scarpetChunkCreationMixin.java index 9e792756..61aa4008 100644 --- a/src/main/java/carpet/mixins/ThreadedLevelLightEngine_scarpetChunkCreationMixin.java +++ b/src/main/java/carpet/mixins/ThreadedLevelLightEngine_scarpetChunkCreationMixin.java @@ -61,8 +61,8 @@ public abstract class ThreadedLevelLightEngine_scarpetChunkCreationMixin extends this.addTask(pos.x, pos.z, () -> 0, ThreadedLevelLightEngine.TaskType.PRE_UPDATE, Util.name(() -> { super.propagateLightSources(pos); - int minY = chunk.getMinBuildHeight(); - int maxY = chunk.getMaxBuildHeight(); + int minY = chunk.getMinY(); + int maxY = chunk.getMaxY(); int minX = pos.getMinBlockX(); int minZ = pos.getMinBlockZ(); BlockPos.MutableBlockPos poss = new BlockPos.MutableBlockPos(); diff --git a/src/main/java/carpet/script/api/WorldAccess.java b/src/main/java/carpet/script/api/WorldAccess.java index 87bc5849..d65e08ab 100644 --- a/src/main/java/carpet/script/api/WorldAccess.java +++ b/src/main/java/carpet/script/api/WorldAccess.java @@ -1348,7 +1348,7 @@ public class WorldAccess int biomeZ = QuartPos.fromBlock(pos.getZ()); try { - int i = QuartPos.fromBlock(chunk.getMinBuildHeight()); + int i = QuartPos.fromBlock(chunk.getMinY()); int j = i + QuartPos.fromBlock(chunk.getHeight()) - 1; int k = Mth.clamp(biomeY, i, j); int l = chunk.getSectionIndex(QuartPos.toBlock(k)); diff --git a/src/main/java/carpet/script/utils/ShapesRenderer.java b/src/main/java/carpet/script/utils/ShapesRenderer.java index 534e768b..a7c7a9eb 100644 --- a/src/main/java/carpet/script/utils/ShapesRenderer.java +++ b/src/main/java/carpet/script/utils/ShapesRenderer.java @@ -25,6 +25,7 @@ import net.minecraft.client.Camera; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Font; import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.client.renderer.CoreShaders; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.ItemBlockRenderTypes; import net.minecraft.client.renderer.LightTexture; @@ -121,7 +122,7 @@ public class ShapesRenderer } long currentTime = client.level.getGameTime(); RenderSystem.enableDepthTest(); - RenderSystem.setShader(GameRenderer::getPositionColorShader); + RenderSystem.setShader(CoreShaders.POSITION_COLOR); RenderSystem.depthFunc(515); RenderSystem.enableBlend(); RenderSystem.defaultBlendFunc(); @@ -407,7 +408,7 @@ public class ShapesRenderer if (blockState.getBlock() instanceof LeavesBlock && !Minecraft.useFancyGraphics()) { type = RenderType.solid(); } else { - type = ItemBlockRenderTypes.getRenderType(blockState, false); + type = ItemBlockRenderTypes.getRenderType(blockState); } client.getBlockRenderer().getModelRenderer().renderModel(matrices.last(), immediate.getBuffer(type), blockState, bakedModel, red, green, blue, light, OverlayTexture.NO_OVERLAY); } diff --git a/src/main/java/carpet/script/utils/SystemInfo.java b/src/main/java/carpet/script/utils/SystemInfo.java index 4cc8b522..66ab7a85 100644 --- a/src/main/java/carpet/script/utils/SystemInfo.java +++ b/src/main/java/carpet/script/utils/SystemInfo.java @@ -61,9 +61,9 @@ public class SystemInfo put("world_dimensions", c -> ListValue.wrap(c.server().levelKeys().stream().map(k -> ValueConversions.of(k.location())))); put("world_spawn_point", c -> ValueConversions.of(c.server().overworld().getLevelData().getSpawnPos())); - put("world_bottom", c -> new NumericValue(c.level().getMinBuildHeight())); + put("world_bottom", c -> new NumericValue(c.level().getMinY())); - put("world_top", c -> new NumericValue(c.level().getMaxBuildHeight())); + put("world_top", c -> new NumericValue(c.level().getMaxY())); put("world_center", c -> { WorldBorder worldBorder = c.level().getWorldBorder(); diff --git a/src/main/java/carpet/utils/PerimeterDiagnostics.java b/src/main/java/carpet/utils/PerimeterDiagnostics.java index 8fccdfd7..4c3d754d 100644 --- a/src/main/java/carpet/utils/PerimeterDiagnostics.java +++ b/src/main/java/carpet/utils/PerimeterDiagnostics.java @@ -87,8 +87,8 @@ public class PerimeterDiagnostics PerimeterDiagnostics diagnostic = new PerimeterDiagnostics(worldserver,ctype,el); EntityType type = EntityType.ZOMBIE; if (el != null) type = el.getType(); - int minY = worldserver.getMinBuildHeight(); - int maxY = worldserver.getMaxBuildHeight(); + int minY = worldserver.getMinY(); + int maxY = worldserver.getMaxY(); for (int x = -128; x <= 128; ++x) { for (int z = -128; z <= 128; ++z) From 7ee1baab2c8a3701b3b94f2d8bc0fccd7ac2c3eb Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Wed, 21 Aug 2024 23:20:20 +0200 Subject: [PATCH 004/232] 1.4.149 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index d46e1d2c..191044d5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G fabric_version=0.102.0+1.21 # Mod Properties - mod_version = 1.4.148 + mod_version = 1.4.149 maven_group = carpet archives_base_name = fabric-carpet From 5e89cc6ddbc882241bff2d6f59ed5572e48ca1d1 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Wed, 28 Aug 2024 23:43:40 +0200 Subject: [PATCH 005/232] 24w35a --- gradle.properties | 2 +- src/main/java/carpet/CarpetSettings.java | 2 +- .../carpet/helpers/FertilizableCoral.java | 2 +- .../java/carpet/helpers/HopperCounter.java | 10 +++--- .../logHelpers/ExplosionLogHelper.java | 2 +- ...ingAmethystBlock_movableAmethystMixin.java | 2 +- .../mixins/RecipeManager_scarpetMixin.java | 4 +-- .../java/carpet/script/CarpetContext.java | 2 +- .../java/carpet/script/CarpetEventServer.java | 2 +- .../java/carpet/script/api/Auxiliary.java | 8 ++--- .../java/carpet/script/api/Inventories.java | 8 ++--- .../java/carpet/script/api/WorldAccess.java | 30 ++++++++--------- .../script/command/CommandArgument.java | 6 ++-- .../java/carpet/script/utils/BiomeInfo.java | 4 +-- .../carpet/script/utils/FeatureGenerator.java | 18 +++++------ .../carpet/script/utils/ShapeDispatcher.java | 2 +- .../java/carpet/script/value/BlockValue.java | 4 +-- .../java/carpet/script/value/EntityValue.java | 32 +++++++++---------- .../carpet/script/value/ValueConversions.java | 8 ++--- src/main/java/carpet/utils/BlockInfo.java | 2 +- .../java/carpet/utils/CarpetProfiler.java | 4 +-- src/main/java/carpet/utils/MobAI.java | 2 +- .../java/carpet/utils/SpawnOverrides.java | 4 +-- 23 files changed, 80 insertions(+), 80 deletions(-) diff --git a/gradle.properties b/gradle.properties index 191044d5..d2e4118c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=24w34a + minecraft_version=24w35a loader_version=0.15.11 jsr305_version=3.0.2 fabric_version=0.102.0+1.21 diff --git a/src/main/java/carpet/CarpetSettings.java b/src/main/java/carpet/CarpetSettings.java index 61253d59..c126752f 100644 --- a/src/main/java/carpet/CarpetSettings.java +++ b/src/main/java/carpet/CarpetSettings.java @@ -908,7 +908,7 @@ public class CarpetSettings @Override public String validate(CommandSourceStack source, CarpetRule currentRule, String newValue, String string) { if (source == null) return newValue; // closing or sync - Optional ignoredBlock = source.registryAccess().registryOrThrow(Registries.BLOCK).getOptional(ResourceLocation.tryParse(newValue)); + Optional ignoredBlock = source.registryAccess().lookupOrThrow(Registries.BLOCK).getOptional(ResourceLocation.tryParse(newValue)); if (!ignoredBlock.isPresent()) { Messenger.m(source, "r Unknown block '" + newValue + "'."); return null; diff --git a/src/main/java/carpet/helpers/FertilizableCoral.java b/src/main/java/carpet/helpers/FertilizableCoral.java index 9c8bd43d..3f7447fe 100644 --- a/src/main/java/carpet/helpers/FertilizableCoral.java +++ b/src/main/java/carpet/helpers/FertilizableCoral.java @@ -58,7 +58,7 @@ public interface FertilizableCoral extends BonemealableBlock { MapColor color = blockUnder.getMapColor(worldIn, pos); BlockState properBlock = blockUnder; - HolderSet.Named coralBlocks = worldIn.registryAccess().registryOrThrow(Registries.BLOCK).getTag(BlockTags.CORAL_BLOCKS).orElseThrow(); + HolderSet.Named coralBlocks = worldIn.registryAccess().lookupOrThrow(Registries.BLOCK).get(BlockTags.CORAL_BLOCKS).orElseThrow(); for (Holder block: coralBlocks) { properBlock = block.value().defaultBlockState(); diff --git a/src/main/java/carpet/helpers/HopperCounter.java b/src/main/java/carpet/helpers/HopperCounter.java index dc140240..9f29ac7b 100644 --- a/src/main/java/carpet/helpers/HopperCounter.java +++ b/src/main/java/carpet/helpers/HopperCounter.java @@ -340,8 +340,8 @@ public class HopperCounter if (DEFAULTS.containsKey(item)) return TextColor.fromRgb(appropriateColor(DEFAULTS.get(item).defaultMapColor().col)); if (item instanceof DyeItem dye) return TextColor.fromRgb(appropriateColor(dye.getDyeColor().getMapColor().col)); Block block = null; - final Registry itemRegistry = registryAccess.registryOrThrow(Registries.ITEM); - final Registry blockRegistry = registryAccess.registryOrThrow(Registries.BLOCK); + final Registry itemRegistry = registryAccess.lookupOrThrow(Registries.ITEM); + final Registry blockRegistry = registryAccess.lookupOrThrow(Registries.BLOCK); ResourceLocation id = itemRegistry.getKey(item); if (item instanceof BlockItem blockItem) { @@ -349,7 +349,7 @@ public class HopperCounter } else if (blockRegistry.getOptional(id).isPresent()) { - block = blockRegistry.get(id); + block = blockRegistry.getValue(id); } if (block != null) { @@ -370,8 +370,8 @@ public class HopperCounter if (direct != null) return direct; if (CarpetServer.minecraft_server == null) return WHITE; - ResourceLocation id = registryAccess.registryOrThrow(Registries.ITEM).getKey(item); - for (RecipeType type: registryAccess.registryOrThrow(Registries.RECIPE_TYPE)) + ResourceLocation id = registryAccess.lookupOrThrow(Registries.ITEM).getKey(item); + for (RecipeType type: registryAccess.lookupOrThrow(Registries.RECIPE_TYPE)) { for (Recipe r: ((RecipeManagerInterface) CarpetServer.minecraft_server.getRecipeManager()).getAllMatching(type, id, registryAccess)) { diff --git a/src/main/java/carpet/logging/logHelpers/ExplosionLogHelper.java b/src/main/java/carpet/logging/logHelpers/ExplosionLogHelper.java index 972ec1a5..7ac25d51 100644 --- a/src/main/java/carpet/logging/logHelpers/ExplosionLogHelper.java +++ b/src/main/java/carpet/logging/logHelpers/ExplosionLogHelper.java @@ -80,7 +80,7 @@ public class ExplosionLogHelper messages.add(c((k.pos.equals(pos))?"r - TNT":"w - ", Messenger.dblt((k.pos.equals(pos))?"r":"y", k.pos.x, k.pos.y, k.pos.z), "w dV", Messenger.dblt("d", k.accel.x, k.accel.y, k.accel.z), - "w "+ regs.registryOrThrow(Registries.ENTITY_TYPE).getKey(k.type).getPath(), (v>1)?"l ("+v+")":"" + "w "+ regs.lookupOrThrow(Registries.ENTITY_TYPE).getKey(k.type).getPath(), (v>1)?"l ("+v+")":"" )); }); } diff --git a/src/main/java/carpet/mixins/BuddingAmethystBlock_movableAmethystMixin.java b/src/main/java/carpet/mixins/BuddingAmethystBlock_movableAmethystMixin.java index e18b5e54..af5670b2 100644 --- a/src/main/java/carpet/mixins/BuddingAmethystBlock_movableAmethystMixin.java +++ b/src/main/java/carpet/mixins/BuddingAmethystBlock_movableAmethystMixin.java @@ -34,7 +34,7 @@ public class BuddingAmethystBlock_movableAmethystMixin extends Block { // drawback - not controlled via loottables, but hey if (CarpetSettings.movableAmethyst && stack.getItem() instanceof PickaxeItem && - EnchantmentHelper.getItemEnchantmentLevel(world.registryAccess().registryOrThrow(Registries.ENCHANTMENT).getHolderOrThrow(Enchantments.SILK_TOUCH), stack) > 0 + EnchantmentHelper.getItemEnchantmentLevel(world.registryAccess().lookupOrThrow(Registries.ENCHANTMENT).getOrThrow(Enchantments.SILK_TOUCH), stack) > 0 ) popResource(world, pos, Items.BUDDING_AMETHYST.getDefaultInstance()); } diff --git a/src/main/java/carpet/mixins/RecipeManager_scarpetMixin.java b/src/main/java/carpet/mixins/RecipeManager_scarpetMixin.java index 69a67b5a..90809db1 100644 --- a/src/main/java/carpet/mixins/RecipeManager_scarpetMixin.java +++ b/src/main/java/carpet/mixins/RecipeManager_scarpetMixin.java @@ -41,8 +41,8 @@ public class RecipeManager_scarpetMixin implements RecipeManagerInterface return List.of(); } Collection> typeRecipes = byType.get(type); - Registry regs = registryAccess.registryOrThrow(Registries.ITEM); - Item item = regs.get(itemId); + Registry regs = registryAccess.lookupOrThrow(Registries.ITEM); + Item item = regs.getValue(itemId); if (item == Items.AIR) { return List.of(); diff --git a/src/main/java/carpet/script/CarpetContext.java b/src/main/java/carpet/script/CarpetContext.java index b428c925..e1206aa2 100644 --- a/src/main/java/carpet/script/CarpetContext.java +++ b/src/main/java/carpet/script/CarpetContext.java @@ -62,7 +62,7 @@ public class CarpetContext extends Context public Registry registry(ResourceKey> resourceKey) { - return registryAccess().registryOrThrow(resourceKey); + return registryAccess().lookupOrThrow(resourceKey); } public CommandSourceStack source() diff --git a/src/main/java/carpet/script/CarpetEventServer.java b/src/main/java/carpet/script/CarpetEventServer.java index 3d047e27..9c910ff5 100644 --- a/src/main/java/carpet/script/CarpetEventServer.java +++ b/src/main/java/carpet/script/CarpetEventServer.java @@ -999,7 +999,7 @@ public class CarpetEventServer { return; } - Registry> registry = player.level().registryAccess().registryOrThrow(Registries.STAT_TYPE); + Registry> registry = player.level().registryAccess().lookupOrThrow(Registries.STAT_TYPE); handler.call(() -> Arrays.asList( new EntityValue(player), NBTSerializableValue.nameFromRegistryId(registry.getKey(stat.getType())), diff --git a/src/main/java/carpet/script/api/Auxiliary.java b/src/main/java/carpet/script/api/Auxiliary.java index ca3c22b4..4cb8f5d8 100644 --- a/src/main/java/carpet/script/api/Auxiliary.java +++ b/src/main/java/carpet/script/api/Auxiliary.java @@ -131,7 +131,7 @@ public class Auxiliary CarpetContext cc = (CarpetContext) c; if (lv.isEmpty()) { - return ListValue.wrap(cc.registry(Registries.SOUND_EVENT).holders().map(soundEventReference -> ValueConversions.of(soundEventReference.key().location()))); + return ListValue.wrap(cc.registry(Registries.SOUND_EVENT).listElements().map(soundEventReference -> ValueConversions.of(soundEventReference.key().location()))); } String rawString = lv.get(0).getString(); ResourceLocation soundName = InputValidator.identifierOf(rawString); @@ -176,7 +176,7 @@ public class Auxiliary CarpetContext cc = (CarpetContext) c; if (lv.isEmpty()) { - return ListValue.wrap(cc.registry(Registries.PARTICLE_TYPE).holders().map(particleTypeReference -> ValueConversions.of(particleTypeReference.key().location()))); + return ListValue.wrap(cc.registry(Registries.PARTICLE_TYPE).listElements().map(particleTypeReference -> ValueConversions.of(particleTypeReference.key().location()))); } MinecraftServer ms = cc.server(); ServerLevel world = cc.level(); @@ -1062,7 +1062,7 @@ public class Auxiliary ResourceLocation statName; category = InputValidator.identifierOf(lv.get(1).getString()); statName = InputValidator.identifierOf(lv.get(2).getString()); - StatType type = cc.registry(Registries.STAT_TYPE).get(category); + StatType type = cc.registry(Registries.STAT_TYPE).getValue(category); if (type == null) { return Value.NULL; @@ -1382,7 +1382,7 @@ public class Auxiliary @Nullable private static Stat getStat(StatType type, ResourceLocation id) { - T key = type.getRegistry().get(id); + T key = type.getRegistry().getValue(id); if (key == null || !type.contains(key)) { return null; diff --git a/src/main/java/carpet/script/api/Inventories.java b/src/main/java/carpet/script/api/Inventories.java index 51ee8e17..c7adf517 100644 --- a/src/main/java/carpet/script/api/Inventories.java +++ b/src/main/java/carpet/script/api/Inventories.java @@ -69,10 +69,10 @@ public class Inventories Registry items = cc.registry(Registries.ITEM); if (lv.isEmpty()) { - return ListValue.wrap(items.holders().map(itemReference -> ValueConversions.of(itemReference.key().location()))); + return ListValue.wrap(items.listElements().map(itemReference -> ValueConversions.of(itemReference.key().location()))); } String tag = lv.get(0).getString(); - Optional> itemTag = items.getTag(TagKey.create(Registries.ITEM, InputValidator.identifierOf(tag))); + Optional> itemTag = items.get(TagKey.create(Registries.ITEM, InputValidator.identifierOf(tag))); return itemTag.isEmpty() ? Value.NULL : ListValue.wrap(itemTag.get().stream().map(b -> items.getKey(b.value())).filter(Objects::nonNull).map(ValueConversions::of)); }); @@ -91,7 +91,7 @@ public class Inventories return ListValue.wrap(blocks.getTags().filter(e -> e.stream().anyMatch(h -> (h.value() == item))).map(ValueConversions::of)); } String tag = lv.get(1).getString(); - Optional> tagSet = blocks.getTag(TagKey.create(Registries.ITEM, InputValidator.identifierOf(tag))); + Optional> tagSet = blocks.get(TagKey.create(Registries.ITEM, InputValidator.identifierOf(tag))); return tagSet.isEmpty() ? Value.NULL : BooleanValue.of(tagSet.get().stream().anyMatch(h -> h.value() == item)); }); @@ -107,7 +107,7 @@ public class Inventories if (lv.size() > 1) { String recipeType = lv.get(1).getString(); - type = cc.registry(Registries.RECIPE_TYPE).get(InputValidator.identifierOf(recipeType)); + type = cc.registry(Registries.RECIPE_TYPE).getValue(InputValidator.identifierOf(recipeType)); if (type == null) { throw new InternalExpressionException("Unknown recipe type: " + recipeType); diff --git a/src/main/java/carpet/script/api/WorldAccess.java b/src/main/java/carpet/script/api/WorldAccess.java index d65e08ab..54aa7adc 100644 --- a/src/main/java/carpet/script/api/WorldAccess.java +++ b/src/main/java/carpet/script/api/WorldAccess.java @@ -403,7 +403,7 @@ public class WorldAccess Registry poiReg = cc.registry(Registries.POINT_OF_INTEREST_TYPE); PoiType type = poiReg.getOptional(resource) .orElseThrow(() -> new ThrowStatement(poiTypeString, Throwables.UNKNOWN_POI)); - Holder holder = poiReg.getHolderOrThrow(ResourceKey.create(Registries.POINT_OF_INTEREST_TYPE, resource)); + Holder holder = poiReg.getOrThrow(ResourceKey.create(Registries.POINT_OF_INTEREST_TYPE, resource)); int occupancy = 0; if (locator.offset + 1 < lv.size()) @@ -932,7 +932,7 @@ public class WorldAccess if (dropLoot) { - if (how < 0 || (tag != null && EnchantmentHelper.getItemEnchantmentLevel(world.registryAccess().registryOrThrow(Registries.ENCHANTMENT).getHolderOrThrow(Enchantments.SILK_TOUCH), tool) > 0)) + if (how < 0 || (tag != null && EnchantmentHelper.getItemEnchantmentLevel(world.registryAccess().lookupOrThrow(Registries.ENCHANTMENT).getOrThrow(Enchantments.SILK_TOUCH), tool) > 0)) { Block.popResource(world, where, new ItemStack(state.getBlock())); } @@ -940,7 +940,7 @@ public class WorldAccess { if (how > 0) { - tool.enchant(world.registryAccess().registryOrThrow(Registries.ENCHANTMENT).getHolderOrThrow(Enchantments.FORTUNE), (int) how); + tool.enchant(world.registryAccess().lookupOrThrow(Registries.ENCHANTMENT).getOrThrow(Enchantments.FORTUNE), (int) how); } if (DUMMY_ENTITY == null) { @@ -1222,10 +1222,10 @@ public class WorldAccess Registry blocks = cc.registry(Registries.BLOCK); if (lv.isEmpty()) { - return ListValue.wrap(blocks.holders().map(blockReference -> ValueConversions.of(blockReference.key().location()))); + return ListValue.wrap(blocks.listElements().map(blockReference -> ValueConversions.of(blockReference.key().location()))); } ResourceLocation tag = InputValidator.identifierOf(lv.get(0).getString()); - Optional> tagset = blocks.getTag(TagKey.create(Registries.BLOCK, tag)); + Optional> tagset = blocks.get(TagKey.create(Registries.BLOCK, tag)); return tagset.isEmpty() ? Value.NULL : ListValue.wrap(tagset.get().stream().map(b -> ValueConversions.of(blocks.getKey(b.value())))); }); @@ -1244,7 +1244,7 @@ public class WorldAccess return ListValue.wrap(blocks.getTags().filter(e -> e.stream().anyMatch(h -> (h.value() == target))).map(ValueConversions::of)); } String tag = lv.get(blockLocator.offset).getString(); - Optional> tagSet = blocks.getTag(TagKey.create(Registries.BLOCK, InputValidator.identifierOf(tag))); + Optional> tagSet = blocks.get(TagKey.create(Registries.BLOCK, InputValidator.identifierOf(tag))); return tagSet.isEmpty() ? Value.NULL : BooleanValue.of(blockLocator.block.getBlockState().is(tagSet.get())); }); @@ -1253,7 +1253,7 @@ public class WorldAccess ServerLevel world = cc.level(); if (lv.isEmpty()) { - return ListValue.wrap(cc.registry(Registries.BIOME).holders().map(biomeReference -> ValueConversions.of(biomeReference.key().location()))); + return ListValue.wrap(cc.registry(Registries.BIOME).listElements().map(biomeReference -> ValueConversions.of(biomeReference.key().location()))); } Biome biome; @@ -1298,7 +1298,7 @@ public class WorldAccess if (locator.replacement != null) { - biome = world.registryAccess().registryOrThrow(Registries.BIOME).get(InputValidator.identifierOf(locator.replacement)); + biome = world.registryAccess().lookupOrThrow(Registries.BIOME).getValue(InputValidator.identifierOf(locator.replacement)); if (biome == null) { throw new ThrowStatement(locator.replacement, Throwables.UNKNOWN_BIOME); @@ -1333,7 +1333,7 @@ public class WorldAccess } String biomeName = lv.get(locator.offset).getString(); // from locatebiome command code - Holder biome = cc.registry(Registries.BIOME).getHolder(ResourceKey.create(Registries.BIOME, InputValidator.identifierOf(biomeName))) + Holder biome = cc.registry(Registries.BIOME).get(ResourceKey.create(Registries.BIOME, InputValidator.identifierOf(biomeName))) .orElseThrow(() -> new ThrowStatement(biomeName, Throwables.UNKNOWN_BIOME)); boolean doImmediateUpdate = true; if (lv.size() > locator.offset + 1) @@ -1390,7 +1390,7 @@ public class WorldAccess ); } String simpleStructureName = lv.get(locator.offset).getString().toLowerCase(Locale.ROOT); - Structure structureName = reg.get(InputValidator.identifierOf(simpleStructureName)); + Structure structureName = reg.getValue(InputValidator.identifierOf(simpleStructureName)); if (structureName == null) { return Value.NULL; @@ -1428,7 +1428,7 @@ public class WorldAccess { String reqString = requested.getString(); ResourceLocation id = InputValidator.identifierOf(reqString); - Structure requestedStructure = reg.get(id); + Structure requestedStructure = reg.getValue(id); if (requestedStructure != null) { singleOutput = true; @@ -1436,7 +1436,7 @@ public class WorldAccess } else { - StructureType sss = cc.registry(Registries.STRUCTURE_TYPE).get(id); + StructureType sss = cc.registry(Registries.STRUCTURE_TYPE).getValue(id); reg.entrySet().stream().filter(e -> e.getValue().type() == sss).forEach(e -> structure.add(e.getValue())); } if (structure.isEmpty()) @@ -1515,7 +1515,7 @@ public class WorldAccess return MapValue.wrap(structureList); } String structureName = lv.get(locator.offset).getString().toLowerCase(Locale.ROOT); - return ValueConversions.of(structures.get(reg.get(InputValidator.identifierOf(structureName))), cc.registryAccess()); + return ValueConversions.of(structures.get(reg.getValue(InputValidator.identifierOf(structureName))), cc.registryAccess()); }); expression.addContextFunction("set_structure", -1, (c, t, lv) -> @@ -1759,7 +1759,7 @@ public class WorldAccess if (generator instanceof final NoiseBasedChunkGenerator noiseBasedChunkGenerator) { - Registry densityFunctionRegistry = level.registryAccess().registryOrThrow(Registries.DENSITY_FUNCTION); + Registry densityFunctionRegistry = level.registryAccess().lookupOrThrow(Registries.DENSITY_FUNCTION); NoiseRouter router = noiseBasedChunkGenerator.generatorSettings().value().noiseRouter(); DensityFunction densityFunction = switch (densityFunctionQuery) { @@ -1779,7 +1779,7 @@ public class WorldAccess case "vein_ridged" -> router.veinRidged(); case "vein_gap" -> router.veinGap(); default -> { - DensityFunction result = densityFunctionRegistry.get(InputValidator.identifierOf(densityFunctionQuery)); + DensityFunction result = densityFunctionRegistry.getValue(InputValidator.identifierOf(densityFunctionQuery)); if (result == null) { throw new InternalExpressionException("Density function '" + densityFunctionQuery + "' is not defined in the registies."); diff --git a/src/main/java/carpet/script/command/CommandArgument.java b/src/main/java/carpet/script/command/CommandArgument.java index 5d0fbabe..f269884d 100644 --- a/src/main/java/carpet/script/command/CommandArgument.java +++ b/src/main/java/carpet/script/command/CommandArgument.java @@ -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.getSource().registryAccess()), (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().lookupOrThrow(Registries.PARTICLE_TYPE).keySet(), b) ), // resource / identifier section @@ -235,7 +235,7 @@ public abstract class CommandArgument return ValueConversions.of(res.right().get().key()); } return Value.NULL; - }, (ctx, builder) -> SharedSuggestionProvider.suggestResource(ctx.getSource().getServer().registryAccess().registryOrThrow(Registries.BIOME).keySet(), builder) + }, (ctx, builder) -> SharedSuggestionProvider.suggestResource(ctx.getSource().getServer().registryAccess().lookupOrThrow(Registries.BIOME).keySet(), builder) ), new VanillaUnconfigurableArgument("sound", ResourceLocationArgument::id, (c, p) -> ValueConversions.of(ResourceLocationArgument.getId(c, p)), SuggestionProviders.AVAILABLE_SOUNDS @@ -1278,7 +1278,7 @@ public abstract class CommandArgument suffix, c -> ResourceArgument.resource(c, registry), (c, p) -> ValueConversions.of(ResourceArgument.getResource(c, p, registry).key()), - (c, b) -> SharedSuggestionProvider.suggestResource(c.getSource().getServer().registryAccess().registryOrThrow(registry).keySet(), b) + (c, b) -> SharedSuggestionProvider.suggestResource(c.getSource().getServer().registryAccess().lookupOrThrow(registry).keySet(), b) ); } diff --git a/src/main/java/carpet/script/utils/BiomeInfo.java b/src/main/java/carpet/script/utils/BiomeInfo.java index 51aee83d..aa8c39cd 100644 --- a/src/main/java/carpet/script/utils/BiomeInfo.java +++ b/src/main/java/carpet/script/utils/BiomeInfo.java @@ -23,7 +23,7 @@ public class BiomeInfo { public static final Map> biomeFeatures = new HashMap<>() {{ - put("tags", (w, b) -> ListValue.wrap(w.registryAccess().registryOrThrow(Registries.BIOME).getTags().filter(p -> p.stream().anyMatch(h -> h.value() == b)).map(ValueConversions::of))); + put("tags", (w, b) -> ListValue.wrap(w.registryAccess().lookupOrThrow(Registries.BIOME).getTags().filter(p -> p.stream().anyMatch(h -> h.value() == b)).map(ValueConversions::of))); put("temperature", (w, b) -> NumericValue.of(b.getBaseTemperature())); put("fog_color", (w, b) -> ValueConversions.ofRGB(b.getSpecialEffects().getFogColor())); put("foliage_color", (w, b) -> ValueConversions.ofRGB(b.getSpecialEffects().getFoliageColorOverride().orElse(4764952))); // client Biome.getDefaultFoliageColor @@ -33,7 +33,7 @@ public class BiomeInfo put("humidity", (w, b) -> NumericValue.of(Vanilla.Biome_getClimateSettings(b).downfall())); put("precipitation", (w, b) -> StringValue.of(b.getPrecipitationAt(new BlockPos(0, w.getSeaLevel(), 0), w.getSeaLevel()).name().toLowerCase(Locale.ROOT))); put("features", (w, b) -> { - Registry> registry = w.registryAccess().registryOrThrow(Registries.CONFIGURED_FEATURE); + Registry> registry = w.registryAccess().lookupOrThrow(Registries.CONFIGURED_FEATURE); return ListValue.wrap( b.getGenerationSettings().features().stream().map(step -> ListValue.wrap(step.stream().map(cfp -> diff --git a/src/main/java/carpet/script/utils/FeatureGenerator.java b/src/main/java/carpet/script/utils/FeatureGenerator.java index 466eea1d..a686543e 100644 --- a/src/main/java/carpet/script/utils/FeatureGenerator.java +++ b/src/main/java/carpet/script/utils/FeatureGenerator.java @@ -76,13 +76,13 @@ public class FeatureGenerator return custom.apply(world).plop(world, pos); } ResourceLocation id = ResourceLocation.parse(featureName); - Structure structure = world.registryAccess().registryOrThrow(Registries.STRUCTURE).get(id); + Structure structure = world.registryAccess().lookupOrThrow(Registries.STRUCTURE).getValue(id); if (structure != null) { return plopAnywhere(structure, world, pos, world.getChunkSource().getGenerator(), false); } - ConfiguredFeature configuredFeature = world.registryAccess().registryOrThrow(Registries.CONFIGURED_FEATURE).get(id); + ConfiguredFeature configuredFeature = world.registryAccess().lookupOrThrow(Registries.CONFIGURED_FEATURE).getValue(id); if (configuredFeature != null) { ThreadLocal checks = Vanilla.skipGenerationChecks(world); @@ -96,7 +96,7 @@ public class FeatureGenerator checks.set(false); } } - Optional> structureType = world.registryAccess().registryOrThrow(Registries.STRUCTURE_TYPE).getOptional(id); + Optional> structureType = world.registryAccess().lookupOrThrow(Registries.STRUCTURE_TYPE).getOptional(id); if (structureType.isPresent()) { Structure configuredStandard = getDefaultFeature(structureType.get(), world, pos); @@ -105,7 +105,7 @@ public class FeatureGenerator return plopAnywhere(configuredStandard, world, pos, world.getChunkSource().getGenerator(), false); } } - Feature feature = world.registryAccess().registryOrThrow(Registries.FEATURE).get(id); + Feature feature = world.registryAccess().lookupOrThrow(Registries.FEATURE).getValue(id); if (feature != null) { ConfiguredFeature configuredStandard = getDefaultFeature(feature, world, pos, true); @@ -130,12 +130,12 @@ public class FeatureGenerator public static Structure resolveConfiguredStructure(String name, ServerLevel world, BlockPos pos) { ResourceLocation id = ResourceLocation.parse(name); - Structure configuredStructureFeature = world.registryAccess().registryOrThrow(Registries.STRUCTURE).get(id); + Structure configuredStructureFeature = world.registryAccess().lookupOrThrow(Registries.STRUCTURE).getValue(id); if (configuredStructureFeature != null) { return configuredStructureFeature; } - StructureType structureFeature = world.registryAccess().registryOrThrow(Registries.STRUCTURE_TYPE).get(id); + StructureType structureFeature = world.registryAccess().lookupOrThrow(Registries.STRUCTURE_TYPE).getValue(id); if (structureFeature == null) { return null; @@ -197,7 +197,7 @@ public class FeatureGenerator // TODO allow old types, like vaillage, or bastion Holder existingBiome = world.getBiome(pos); Structure result = null; - for (Structure confstr : world.registryAccess().registryOrThrow(Registries.STRUCTURE).entrySet().stream(). + for (Structure confstr : world.registryAccess().lookupOrThrow(Registries.STRUCTURE).entrySet().stream(). filter(cS -> cS.getValue().type() == structure).map(Map.Entry::getValue).toList()) { result = confstr; @@ -226,7 +226,7 @@ public class FeatureGenerator { return null; } - return world.registryAccess().registryOrThrow(Registries.CONFIGURED_FEATURE).entrySet().stream(). + return world.registryAccess().lookupOrThrow(Registries.CONFIGURED_FEATURE).entrySet().stream(). filter(cS -> cS.getValue().feature() == feature). findFirst().map(Map.Entry::getValue).orElse(null); } @@ -434,7 +434,7 @@ public class FeatureGenerator if (!wireOnly) { - Registry registry3 = world.registryAccess().registryOrThrow(Registries.STRUCTURE); + Registry registry3 = world.registryAccess().lookupOrThrow(Registries.STRUCTURE); world.setCurrentlyGenerating(() -> { Objects.requireNonNull(structure); return registry3.getResourceKey(structure).map(Object::toString).orElseGet(structure::toString); diff --git a/src/main/java/carpet/script/utils/ShapeDispatcher.java b/src/main/java/carpet/script/utils/ShapeDispatcher.java index ab622bd4..0f96aa6b 100644 --- a/src/main/java/carpet/script/utils/ShapeDispatcher.java +++ b/src/main/java/carpet/script/utils/ShapeDispatcher.java @@ -760,7 +760,7 @@ public class ShapeDispatcher { return p -> { ParticleOptions particle; - Registry blocks = p.getServer().registryAccess().registryOrThrow(Registries.BLOCK); + Registry blocks = p.getServer().registryAccess().lookupOrThrow(Registries.BLOCK); if (this.isitem) { if (Block.byItem(this.item.getItem()).defaultBlockState().isAir()) diff --git a/src/main/java/carpet/script/value/BlockValue.java b/src/main/java/carpet/script/value/BlockValue.java index 77fef2f7..13a8c101 100644 --- a/src/main/java/carpet/script/value/BlockValue.java +++ b/src/main/java/carpet/script/value/BlockValue.java @@ -199,7 +199,7 @@ public class BlockValue extends Value @Override public String getString() { - Registry blockRegistry = world.registryAccess().registryOrThrow(Registries.BLOCK); + Registry blockRegistry = world.registryAccess().lookupOrThrow(Registries.BLOCK); return nameFromResource(blockRegistry.getKey(getBlockState().getBlock())); } @@ -250,7 +250,7 @@ public class BlockValue extends Value CompoundTag tag = new CompoundTag(); CompoundTag state = new CompoundTag(); BlockState s = getBlockState(); - state.put("Name", StringTag.valueOf(world.registryAccess().registryOrThrow(Registries.BLOCK).getKey(s.getBlock()).toString())); + state.put("Name", StringTag.valueOf(world.registryAccess().lookupOrThrow(Registries.BLOCK).getKey(s.getBlock()).toString())); Collection> properties = s.getProperties(); if (!properties.isEmpty()) { diff --git a/src/main/java/carpet/script/value/EntityValue.java b/src/main/java/carpet/script/value/EntityValue.java index cdd27777..e9dddb8e 100644 --- a/src/main/java/carpet/script/value/EntityValue.java +++ b/src/main/java/carpet/script/value/EntityValue.java @@ -239,8 +239,8 @@ public class EntityValue extends Value who = who.substring(1); } String booWho = who; - HolderSet.Named> eTagValue = server.registryAccess().registryOrThrow(Registries.ENTITY_TYPE) - .getTag(TagKey.create(Registries.ENTITY_TYPE, InputValidator.identifierOf(who))) + HolderSet.Named> eTagValue = server.registryAccess().lookupOrThrow(Registries.ENTITY_TYPE) + .get(TagKey.create(Registries.ENTITY_TYPE, InputValidator.identifierOf(who))) .orElseThrow(() -> new InternalExpressionException(booWho + " is not a valid entity descriptor")); Set> eTag = eTagValue.stream().map(Holder::value).collect(Collectors.toUnmodifiableSet()); if (positive) @@ -257,7 +257,7 @@ public class EntityValue extends Value } else { - return new EntityClassDescriptor(ANY, e -> !eTag.contains(e.getType()) && e.isAlive(), server.registryAccess().registryOrThrow(Registries.ENTITY_TYPE).stream().filter(et -> !eTag.contains(et))); + return new EntityClassDescriptor(ANY, e -> !eTag.contains(e.getType()) && e.isAlive(), server.registryAccess().lookupOrThrow(Registries.ENTITY_TYPE).stream().filter(et -> !eTag.contains(et))); } } return eDesc; @@ -285,7 +285,7 @@ public class EntityValue extends Value public Value listValue(RegistryAccess regs) { - Registry> entityRegs = regs.registryOrThrow(Registries.ENTITY_TYPE); + Registry> entityRegs = regs.lookupOrThrow(Registries.ENTITY_TYPE); return ListValue.wrap(types.stream().map(et -> nameFromRegistryId(entityRegs.getKey(et)))); } @@ -382,7 +382,7 @@ public class EntityValue extends Value for (ResourceLocation typeId : BuiltInRegistries.ENTITY_TYPE.keySet()) { - EntityType type = BuiltInRegistries.ENTITY_TYPE.get(typeId); + EntityType type = BuiltInRegistries.ENTITY_TYPE.getValue(typeId); String mobType = ValueConversions.simplify(typeId); put(mobType, new EntityClassDescriptor(type, net.minecraft.world.entity.EntitySelector.ENTITY_STILL_ALIVE, Stream.of(type))); put("!" + mobType, new EntityClassDescriptor(ANY, (e) -> e.getType() != type && e.isAlive(), allTypes.stream().filter(et -> et != type))); @@ -445,7 +445,7 @@ public class EntityValue extends Value put("display_name", (e, a) -> new FormattedTextValue(e.getDisplayName())); put("command_name", (e, a) -> new StringValue(e.getScoreboardName())); put("custom_name", (e, a) -> e.hasCustomName() ? new StringValue(e.getCustomName().getString()) : Value.NULL); - put("type", (e, a) -> nameFromRegistryId(e.level().registryAccess().registryOrThrow(Registries.ENTITY_TYPE).getKey(e.getType()))); + put("type", (e, a) -> nameFromRegistryId(e.level().registryAccess().lookupOrThrow(Registries.ENTITY_TYPE).getKey(e.getType()))); put("is_riding", (e, a) -> BooleanValue.of(e.isPassenger())); put("is_ridden", (e, a) -> BooleanValue.of(e.isVehicle())); put("passengers", (e, a) -> ListValue.wrap(e.getPassengers().stream().map(EntityValue::new))); @@ -457,14 +457,14 @@ public class EntityValue extends Value put("scoreboard_tags", (e, a) -> ListValue.wrap(e.getTags().stream().map(StringValue::new))); put("entity_tags", (e, a) -> { EntityType type = e.getType(); - return ListValue.wrap(e.getServer().registryAccess().registryOrThrow(Registries.ENTITY_TYPE).getTags().filter(entry -> entry.stream().anyMatch(h -> h.value() == type)).map(entry -> ValueConversions.of(entry))); + return ListValue.wrap(e.getServer().registryAccess().lookupOrThrow(Registries.ENTITY_TYPE).getTags().filter(entry -> entry.stream().anyMatch(h -> h.value() == type)).map(entry -> ValueConversions.of(entry))); }); // deprecated put("has_tag", (e, a) -> BooleanValue.of(e.getTags().contains(a.getString()))); put("has_scoreboard_tag", (e, a) -> BooleanValue.of(e.getTags().contains(a.getString()))); put("has_entity_tag", (e, a) -> { - Optional>> tag = e.getServer().registryAccess().registryOrThrow(Registries.ENTITY_TYPE).getTag(TagKey.create(Registries.ENTITY_TYPE, InputValidator.identifierOf(a.getString()))); + Optional>> tag = e.getServer().registryAccess().lookupOrThrow(Registries.ENTITY_TYPE).get(TagKey.create(Registries.ENTITY_TYPE, InputValidator.identifierOf(a.getString()))); if (tag.isEmpty()) { return Value.NULL; @@ -572,7 +572,7 @@ public class EntityValue extends Value put("brain", (e, a) -> { String module = a.getString(); - MemoryModuleType moduleType = e.level().registryAccess().registryOrThrow(Registries.MEMORY_MODULE_TYPE).get(InputValidator.identifierOf(module)); + MemoryModuleType moduleType = e.level().registryAccess().lookupOrThrow(Registries.MEMORY_MODULE_TYPE).getValue(InputValidator.identifierOf(module)); if (moduleType == MemoryModuleType.DUMMY) { return Value.NULL; @@ -663,7 +663,7 @@ public class EntityValue extends Value return ListValue.wrap(effects); } String effectName = a.getString(); - Holder potion = BuiltInRegistries.MOB_EFFECT.getHolder(ResourceKey.create(Registries.MOB_EFFECT, InputValidator.identifierOf(effectName))).orElseThrow(() -> new InternalExpressionException("No such an effect: " + effectName)); + Holder potion = BuiltInRegistries.MOB_EFFECT.get(ResourceKey.create(Registries.MOB_EFFECT, InputValidator.identifierOf(effectName))).orElseThrow(() -> new InternalExpressionException("No such an effect: " + effectName)); if (!le.hasEffect(potion)) { return Value.NULL; @@ -833,14 +833,14 @@ public class EntityValue extends Value { return Value.NULL; } - Registry attributes = e.level().registryAccess().registryOrThrow(Registries.ATTRIBUTE); + Registry attributes = e.level().registryAccess().lookupOrThrow(Registries.ATTRIBUTE); if (a == null) { AttributeMap container = el.getAttributes(); - return MapValue.wrap(attributes.holders().filter(container::hasAttribute).collect(Collectors.toMap(aa -> ValueConversions.of(aa.key()), aa -> NumericValue.of(container.getValue(aa))))); + return MapValue.wrap(attributes.listElements().filter(container::hasAttribute).collect(Collectors.toMap(aa -> ValueConversions.of(aa.key()), aa -> NumericValue.of(container.getValue(aa))))); } ResourceLocation id = InputValidator.identifierOf(a.getString()); - Holder attrib = attributes.getHolder(id).orElseThrow( + Holder attrib = attributes.get(id).orElseThrow( () -> new InternalExpressionException("Unknown attribute: " + a.getString()) ); if (!el.getAttributes().hasAttribute(attrib)) @@ -1474,7 +1474,7 @@ public class EntityValue extends Value if (list.size() >= 1 && list.size() <= 6) { String effectName = list.get(0).getString(); - Holder effect = BuiltInRegistries.MOB_EFFECT.getHolder(InputValidator.identifierOf(effectName)).orElseThrow(() -> new InternalExpressionException("No such an effect: " + effectName)); + Holder effect = BuiltInRegistries.MOB_EFFECT.get(InputValidator.identifierOf(effectName)).orElseThrow(() -> new InternalExpressionException("No such an effect: " + effectName)); if (list.size() == 1) { le.removeEffect(effect); @@ -1517,7 +1517,7 @@ public class EntityValue extends Value else { String effectName = v.getString(); - Holder effect = BuiltInRegistries.MOB_EFFECT.getHolder(InputValidator.identifierOf(effectName)).orElseThrow(() -> new InternalExpressionException("No such an effect: " + effectName)); + Holder effect = BuiltInRegistries.MOB_EFFECT.get(InputValidator.identifierOf(effectName)).orElseThrow(() -> new InternalExpressionException("No such an effect: " + effectName)); le.removeEffect(effect); return; } @@ -1743,7 +1743,7 @@ public class EntityValue extends Value } CompoundTag tag = new CompoundTag(); tag.put("Data", getEntity().saveWithoutId(new CompoundTag())); - Registry> reg = getEntity().level().registryAccess().registryOrThrow(Registries.ENTITY_TYPE); + Registry> reg = getEntity().level().registryAccess().lookupOrThrow(Registries.ENTITY_TYPE); tag.put("Name", StringTag.valueOf(reg.getKey(getEntity().getType()).toString())); return tag; } diff --git a/src/main/java/carpet/script/value/ValueConversions.java b/src/main/java/carpet/script/value/ValueConversions.java index 25555f49..72a660d7 100644 --- a/src/main/java/carpet/script/value/ValueConversions.java +++ b/src/main/java/carpet/script/value/ValueConversions.java @@ -99,7 +99,7 @@ public class ValueConversions public static Value of(ItemStack stack, RegistryAccess regs) { return stack == null || stack.isEmpty() ? Value.NULL : ListValue.of( - of(regs.registryOrThrow(Registries.ITEM).getKey(stack.getItem())), + of(regs.lookupOrThrow(Registries.ITEM).getKey(stack.getItem())), new NumericValue(stack.getCount()), NBTSerializableValue.fromStack(stack, regs) ); @@ -368,7 +368,7 @@ public class ValueConversions if (box.maxX() >= box.minX() && box.maxY() >= box.minY() && box.maxZ() >= box.minZ()) { pieces.add(ListValue.of( - NBTSerializableValue.nameFromRegistryId(regs.registryOrThrow(Registries.STRUCTURE_PIECE).getKey(piece.getType())), + NBTSerializableValue.nameFromRegistryId(regs.lookupOrThrow(Registries.STRUCTURE_PIECE).getKey(piece.getType())), (piece.getOrientation() == null) ? Value.NULL : new StringValue(piece.getOrientation().getName()), ListValue.fromTriple(box.minX(), box.minY(), box.minZ()), ListValue.fromTriple(box.maxX(), box.maxY(), box.maxZ()) @@ -457,10 +457,10 @@ public class ValueConversions public static Value ofBlockPredicate(RegistryAccess registryAccess, Predicate blockPredicate) { Vanilla.BlockPredicatePayload payload = Vanilla.BlockPredicatePayload.of(blockPredicate); - Registry blocks = registryAccess.registryOrThrow(Registries.BLOCK); + Registry blocks = registryAccess.lookupOrThrow(Registries.BLOCK); return ListValue.of( payload.state() == null ? Value.NULL : of(blocks.getKey(payload.state().getBlock())), - payload.tagKey() == null ? Value.NULL : of(blocks.getTag(payload.tagKey()).get().key()), + payload.tagKey() == null ? Value.NULL : of(blocks.get(payload.tagKey()).get().key()), MapValue.wrap(payload.properties()), payload.tag() == null ? Value.NULL : new NBTSerializableValue(payload.tag()) ); diff --git a/src/main/java/carpet/utils/BlockInfo.java b/src/main/java/carpet/utils/BlockInfo.java index d5532aca..67b70496 100644 --- a/src/main/java/carpet/utils/BlockInfo.java +++ b/src/main/java/carpet/utils/BlockInfo.java @@ -29,7 +29,7 @@ public class BlockInfo BlockState state = world.getBlockState(pos); Block block = state.getBlock(); String metastring = ""; - final Registry blocks = world.registryAccess().registryOrThrow(Registries.BLOCK); + final Registry blocks = world.registryAccess().lookupOrThrow(Registries.BLOCK); for (net.minecraft.world.level.block.state.properties.Property iproperty : state.getProperties()) { metastring += ", "+iproperty.getName() + '='+state.getValue(iproperty); diff --git a/src/main/java/carpet/utils/CarpetProfiler.java b/src/main/java/carpet/utils/CarpetProfiler.java index a4a02067..dbd0cde2 100644 --- a/src/main/java/carpet/utils/CarpetProfiler.java +++ b/src/main/java/carpet/utils/CarpetProfiler.java @@ -279,11 +279,11 @@ public class CarpetProfiler final RegistryAccess regs = section.getKey().registryAccess(); if (section.getValue() instanceof EntityType) { - id = regs.registryOrThrow(Registries.ENTITY_TYPE).getKey((EntityType) section.getValue()); + id = regs.lookupOrThrow(Registries.ENTITY_TYPE).getKey((EntityType) section.getValue()); } else { - id = regs.registryOrThrow(Registries.BLOCK_ENTITY_TYPE).getKey((BlockEntityType) section.getValue()); + id = regs.lookupOrThrow(Registries.BLOCK_ENTITY_TYPE).getKey((BlockEntityType) section.getValue()); } String name = "minecraft".equals(id.getNamespace())?id.getPath():id.toString(); if (section.getKey().isClientSide) diff --git a/src/main/java/carpet/utils/MobAI.java b/src/main/java/carpet/utils/MobAI.java index 454d234b..5063b879 100644 --- a/src/main/java/carpet/utils/MobAI.java +++ b/src/main/java/carpet/utils/MobAI.java @@ -64,7 +64,7 @@ public class MobAI { types.addAll(type.types); } - return types.stream().map(t -> source.registryAccess().registryOrThrow(Registries.ENTITY_TYPE).getKey(t).getPath()); + return types.stream().map(t -> source.registryAccess().lookupOrThrow(Registries.ENTITY_TYPE).getKey(t).getPath()); } public static Stream availableFor(EntityType entityType) diff --git a/src/main/java/carpet/utils/SpawnOverrides.java b/src/main/java/carpet/utils/SpawnOverrides.java index 575b491d..f12d783d 100644 --- a/src/main/java/carpet/utils/SpawnOverrides.java +++ b/src/main/java/carpet/utils/SpawnOverrides.java @@ -54,7 +54,7 @@ public class SpawnOverrides { public static WeightedRandomList test(StructureManager structureFeatureManager, LongSet foo, MobCategory cat, Structure confExisting, BlockPos where) { - ResourceLocation resource = structureFeatureManager.registryAccess().registryOrThrow(Registries.STRUCTURE).getKey(confExisting); + ResourceLocation resource = structureFeatureManager.registryAccess().lookupOrThrow(Registries.STRUCTURE).getKey(confExisting); ResourceKey key = ResourceKey.create(Registries.STRUCTURE, resource); final Pair spawnData = carpetOverrides.get(Pair.of(cat, key)); if (spawnData == null || !spawnData.getKey().getAsBoolean()) return null; @@ -76,7 +76,7 @@ public class SpawnOverrides { public static boolean isStructureAtPosition(ServerLevel level, ResourceKey structureKey, BlockPos pos) { - final Structure fortressFeature = level.registryAccess().registryOrThrow(Registries.STRUCTURE).get(structureKey); + final Structure fortressFeature = level.registryAccess().lookupOrThrow(Registries.STRUCTURE).getValue(structureKey); if (fortressFeature == null) { return false; } From 00e48df36320b6c1b587336c8f7ab681926eabd5 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Wed, 28 Aug 2024 23:44:32 +0200 Subject: [PATCH 006/232] 1.4.150 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index d2e4118c..f14f3cc4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G fabric_version=0.102.0+1.21 # Mod Properties - mod_version = 1.4.149 + mod_version = 1.4.150 maven_group = carpet archives_base_name = fabric-carpet From 72b298ea5fe97ede953fc711b422aa5e19cffff9 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Wed, 4 Sep 2024 20:23:21 +0200 Subject: [PATCH 007/232] 24w26a --- gradle.properties | 2 +- .../mixins/ChunkMap_scarpetChunkCreationMixin.java | 8 ++++---- .../carpet/mixins/Player_antiCheatDisabledMixin.java | 4 ++-- ...verGamePacketListenerImpl_scarpetEventsMixin.java | 11 +++++++---- src/main/java/carpet/patches/EntityPlayerMPFake.java | 5 +++-- .../carpet/patches/NetHandlerPlayServerFake.java | 7 ++++--- src/main/java/carpet/script/value/EntityValue.java | 12 +++++++----- src/main/java/carpet/utils/CommandHelper.java | 2 +- 8 files changed, 29 insertions(+), 22 deletions(-) diff --git a/gradle.properties b/gradle.properties index f14f3cc4..8aad738e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=24w35a + minecraft_version=24w36a loader_version=0.15.11 jsr305_version=3.0.2 fabric_version=0.102.0+1.21 diff --git a/src/main/java/carpet/mixins/ChunkMap_scarpetChunkCreationMixin.java b/src/main/java/carpet/mixins/ChunkMap_scarpetChunkCreationMixin.java index fc300dbb..c19738a8 100644 --- a/src/main/java/carpet/mixins/ChunkMap_scarpetChunkCreationMixin.java +++ b/src/main/java/carpet/mixins/ChunkMap_scarpetChunkCreationMixin.java @@ -23,7 +23,7 @@ import net.minecraft.server.level.ChunkLevel; import net.minecraft.server.level.ChunkMap; import net.minecraft.server.level.ChunkMap.DistanceManager; import net.minecraft.server.level.ChunkResult; -import net.minecraft.server.level.ChunkTaskPriorityQueueSorter; +//import net.minecraft.server.level.ChunkTaskPriorityQueueSorter; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ThreadedLevelLightEngine; import net.minecraft.server.level.TicketType; @@ -76,9 +76,9 @@ public abstract class ChunkMap_scarpetChunkCreationMixin implements ThreadedAnvi @Final private ThreadedLevelLightEngine lightEngine; - @Shadow - @Final - private ChunkTaskPriorityQueueSorter queueSorter; + //@Shadow + //@Final + //private ChunkTaskPriorityQueueSorter queueSorter; @Shadow @Final diff --git a/src/main/java/carpet/mixins/Player_antiCheatDisabledMixin.java b/src/main/java/carpet/mixins/Player_antiCheatDisabledMixin.java index 8a9625dc..9dc4676a 100644 --- a/src/main/java/carpet/mixins/Player_antiCheatDisabledMixin.java +++ b/src/main/java/carpet/mixins/Player_antiCheatDisabledMixin.java @@ -4,7 +4,7 @@ import carpet.CarpetSettings; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.ElytraItem; +//import net.minecraft.world.item.ElytraItem; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import org.spongepowered.asm.mixin.Mixin; @@ -26,7 +26,7 @@ public abstract class Player_antiCheatDisabledMixin if (CarpetSettings.antiCheatDisabled && (Object)this instanceof ServerPlayer sp && sp.getServer().isDedicatedServer()) { ItemStack itemStack_1 = getItemBySlot(EquipmentSlot.CHEST); - if (itemStack_1.getItem() == Items.ELYTRA && ElytraItem.isFlyEnabled(itemStack_1)) { + if (itemStack_1.getItem() == Items.ELYTRA && !itemStack_1.nextDamageWillBreak()) { startFallFlying(); cir.setReturnValue(true); } diff --git a/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java b/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java index ed213d81..9f75e4ec 100644 --- a/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java +++ b/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java @@ -2,6 +2,7 @@ package carpet.mixins; import carpet.fakes.EntityInterface; import net.minecraft.network.protocol.game.ServerboundChatCommandPacket; +import net.minecraft.world.entity.player.Input; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -57,12 +58,14 @@ public class ServerGamePacketListenerImpl_scarpetEventsMixin { // todo this may not ride on the right thread moment, so needs to be checked - if (!((EntityInterface)player.getVehicle()).isPermanentVehicle()) // won't since that method makes sure its not null - player.setShiftKeyDown(p.isShiftKeyDown()); + Input input = p.input(); - if (PLAYER_RIDES.isNeeded() && (p.getXxa() != 0.0F || p.getZza() != 0.0F || p.isJumping() || p.isShiftKeyDown())) + if (player.getVehicle() != null && !((EntityInterface)player.getVehicle()).isPermanentVehicle()) // won't since that method makes sure its not null + player.setShiftKeyDown(p.input().shift()); + + if (PLAYER_RIDES.isNeeded() && (input.jump() || input.shift() || input.forward() || input.backward() || input.left() || input.right())) { - PLAYER_RIDES.onMountControls(player, p.getXxa(), p.getZza(), p.isJumping(), p.isShiftKeyDown()); + PLAYER_RIDES.onMountControls(player, input.left() == input.right() ? 0 : (input.left() ? -1 : 1 ), input.forward() == input.backward() ? 0 : (input.forward() ? 1 : -1), input.jump(), input.shift()); } } diff --git a/src/main/java/carpet/patches/EntityPlayerMPFake.java b/src/main/java/carpet/patches/EntityPlayerMPFake.java index b4911ab0..ee1cd4dd 100644 --- a/src/main/java/carpet/patches/EntityPlayerMPFake.java +++ b/src/main/java/carpet/patches/EntityPlayerMPFake.java @@ -37,6 +37,7 @@ import carpet.fakes.ServerPlayerInterface; import carpet.utils.Messenger; import java.util.Optional; +import java.util.Set; import java.util.concurrent.CompletableFuture; @SuppressWarnings("EntityConstructor") @@ -77,7 +78,7 @@ public class EntityPlayerMPFake extends ServerPlayer EntityPlayerMPFake instance = new EntityPlayerMPFake(server, worldIn, current, ClientInformation.createDefault(), false); instance.fixStartingPosition = () -> instance.moveTo(pos.x, pos.y, pos.z, (float) yaw, (float) pitch); server.getPlayerList().placeNewPlayer(new FakeClientConnection(PacketFlow.SERVERBOUND), instance, new CommonListenerCookie(current, 0, instance.clientInformation(), false)); - instance.teleportTo(worldIn, pos.x, pos.y, pos.z, (float) yaw, (float) pitch, true); + instance.teleportTo(worldIn, pos.x, pos.y, pos.z, Set.of(), (float) yaw, (float) pitch, true); instance.setHealth(20.0F); instance.unsetRemoved(); instance.getAttribute(Attributes.STEP_HEIGHT).setBaseValue(0.6F); @@ -151,7 +152,7 @@ public class EntityPlayerMPFake extends ServerPlayer if (reason.getContents() instanceof TranslatableContents text && text.getKey().equals("multiplayer.disconnect.duplicate_login")) { this.connection.onDisconnect(new DisconnectionDetails(reason)); } else { - this.server.tell(new TickTask(this.server.getTickCount(), () -> { + this.server.schedule(new TickTask(this.server.getTickCount(), () -> { this.connection.onDisconnect(new DisconnectionDetails(reason)); })); } diff --git a/src/main/java/carpet/patches/NetHandlerPlayServerFake.java b/src/main/java/carpet/patches/NetHandlerPlayServerFake.java index bfdd7f45..7270ff5a 100644 --- a/src/main/java/carpet/patches/NetHandlerPlayServerFake.java +++ b/src/main/java/carpet/patches/NetHandlerPlayServerFake.java @@ -8,7 +8,8 @@ import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.network.CommonListenerCookie; import net.minecraft.server.network.ServerGamePacketListenerImpl; -import net.minecraft.world.entity.RelativeMovement; +import net.minecraft.world.entity.PositionMoveRotation; +import net.minecraft.world.entity.Relative; import java.util.Set; public class NetHandlerPlayServerFake extends ServerGamePacketListenerImpl @@ -33,9 +34,9 @@ public class NetHandlerPlayServerFake extends ServerGamePacketListenerImpl } @Override - public void teleport(double d, double e, double f, float g, float h, Set set) + public void teleport(PositionMoveRotation positionMoveRotation, Set set) { - super.teleport(d, e, f, g, h, set); + super.teleport(positionMoveRotation, set); if (player.serverLevel().getPlayerByUUID(player.getUUID()) != null) { resetPosition(); player.serverLevel().getChunkSource().move(player); diff --git a/src/main/java/carpet/script/value/EntityValue.java b/src/main/java/carpet/script/value/EntityValue.java index e9dddb8e..86daa23a 100644 --- a/src/main/java/carpet/script/value/EntityValue.java +++ b/src/main/java/carpet/script/value/EntityValue.java @@ -49,7 +49,8 @@ import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.MobCategory; import net.minecraft.world.entity.PathfinderMob; import net.minecraft.world.entity.Pose; -import net.minecraft.world.entity.RelativeMovement; +import net.minecraft.world.entity.PositionMoveRotation; +import net.minecraft.world.entity.Relative; import net.minecraft.world.entity.ai.Brain; import net.minecraft.world.entity.ai.attributes.Attribute; import net.minecraft.world.entity.ai.attributes.AttributeMap; @@ -899,10 +900,11 @@ public class EntityValue extends Value if (e instanceof ServerPlayer sp) { // this forces position but doesn't angles for some reason. Need both in the API in the future. - EnumSet set = EnumSet.noneOf(RelativeMovement.class); - set.add(RelativeMovement.X_ROT); - set.add(RelativeMovement.Y_ROT); - sp.connection.teleport(x, y, z, yaw, pitch, set); + EnumSet set = EnumSet.noneOf(Relative.class); + set.add(Relative.X_ROT); + set.add(Relative.Y_ROT); + + sp.connection.teleport(new PositionMoveRotation(new Vec3(x, y, z), Vec3.ZERO, yaw, pitch), set); } else { diff --git a/src/main/java/carpet/utils/CommandHelper.java b/src/main/java/carpet/utils/CommandHelper.java index d6825a91..9b97f652 100644 --- a/src/main/java/carpet/utils/CommandHelper.java +++ b/src/main/java/carpet/utils/CommandHelper.java @@ -23,7 +23,7 @@ public final class CommandHelper { { return; } - server.tell(new TickTask(server.getTickCount(), () -> + server.schedule(new TickTask(server.getTickCount(), () -> { try { for (ServerPlayer player : server.getPlayerList().getPlayers()) { From c5ba9d488526e7483657d7babe331fc98cd760ec Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Wed, 4 Sep 2024 20:24:59 +0200 Subject: [PATCH 008/232] 1.4.151 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 8aad738e..173c8826 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G fabric_version=0.102.0+1.21 # Mod Properties - mod_version = 1.4.150 + mod_version = 1.4.151 maven_group = carpet archives_base_name = fabric-carpet From 148715245fc3a585280c27b356d33c3966602cca Mon Sep 17 00:00:00 2001 From: altrisi Date: Thu, 5 Sep 2024 15:07:13 +0200 Subject: [PATCH 009/232] Set version bound to >1.21.1 --- src/main/resources/fabric.mod.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index bc051461..39e87ae2 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -33,7 +33,7 @@ "accessWidener" : "carpet.accesswidener", "depends": { - "minecraft": ">1.20.1", + "minecraft": ">1.21.1", "fabricloader": ">=0.14.18", "java": ">=21" } From 8f096dadb8d3b33fbeb3dedfe115e4f99e6c2c45 Mon Sep 17 00:00:00 2001 From: altrisi Date: Wed, 11 Sep 2024 14:04:21 +0200 Subject: [PATCH 010/232] Update Fabric Loader dependency in dev Fixes dev not launching during snapshots with the new version bound --- gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 173c8826..48429a96 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ minecraft_version=24w36a - loader_version=0.15.11 + loader_version=0.16.3 jsr305_version=3.0.2 fabric_version=0.102.0+1.21 @@ -25,4 +25,4 @@ org.gradle.jvmargs=-Xmx1G # The "name" or id of the Curseforge version for the secondary branch # This is needed because CF uses too vague names for snapshots # Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN] - release-extra-curse-version = Minecraft 1.20:1.20.4-Snapshot \ No newline at end of file + release-extra-curse-version = Minecraft 1.20:1.20.4-Snapshot From 299b93c215ae59771f4c0885be7411557ea4f3ab Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Wed, 11 Sep 2024 23:02:10 +0200 Subject: [PATCH 011/232] 24w37a --- gradle.properties | 4 ++-- .../java/carpet/mixins/Level_getOtherEntitiesLimited.java | 7 ++----- src/main/java/carpet/mixins/Level_movableBEMixin.java | 5 ++--- .../java/carpet/mixins/MinecraftServer_tickspeedMixin.java | 6 +----- src/main/java/carpet/mixins/ServerLevel_scarpetMixin.java | 5 +++-- src/main/java/carpet/mixins/ServerLevel_tickMixin.java | 4 ++-- 6 files changed, 12 insertions(+), 19 deletions(-) diff --git a/gradle.properties b/gradle.properties index 48429a96..1ff30f66 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,8 +3,8 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=24w36a - loader_version=0.16.3 + minecraft_version=24w37a + loader_version=0.16.5 jsr305_version=3.0.2 fabric_version=0.102.0+1.21 diff --git a/src/main/java/carpet/mixins/Level_getOtherEntitiesLimited.java b/src/main/java/carpet/mixins/Level_getOtherEntitiesLimited.java index 4a6b4a75..aeb60732 100644 --- a/src/main/java/carpet/mixins/Level_getOtherEntitiesLimited.java +++ b/src/main/java/carpet/mixins/Level_getOtherEntitiesLimited.java @@ -2,6 +2,7 @@ package carpet.mixins; import carpet.fakes.LevelInterface; import com.google.common.collect.Lists; +import net.minecraft.util.profiling.Profiler; import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -9,7 +10,6 @@ import org.spongepowered.asm.mixin.Shadow; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Predicate; -import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.boss.EnderDragonPart; import net.minecraft.world.entity.boss.enderdragon.EnderDragon; @@ -24,7 +24,7 @@ public abstract class Level_getOtherEntitiesLimited implements LevelInterface { @Override public List getOtherEntitiesLimited(@Nullable Entity except, AABB box, Predicate predicate, int limit) { - this.getProfiler().incrementCounter("getEntities"); // visit + Profiler.get().incrementCounter("getEntities"); // visit AtomicInteger checkedEntities = new AtomicInteger(); List list = Lists.newArrayList(); try { @@ -55,9 +55,6 @@ public abstract class Level_getOtherEntitiesLimited implements LevelInterface { return list; } - @Shadow - public abstract ProfilerFiller getProfiler(); - @Shadow protected abstract LevelEntityGetter getEntities(); } diff --git a/src/main/java/carpet/mixins/Level_movableBEMixin.java b/src/main/java/carpet/mixins/Level_movableBEMixin.java index 99929faf..0f98fde7 100644 --- a/src/main/java/carpet/mixins/Level_movableBEMixin.java +++ b/src/main/java/carpet/mixins/Level_movableBEMixin.java @@ -4,6 +4,7 @@ import carpet.fakes.WorldChunkInterface; import carpet.fakes.LevelInterface; import net.minecraft.core.BlockPos; import net.minecraft.server.level.FullChunkStatus; +import net.minecraft.util.profiling.Profiler; import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; @@ -39,8 +40,6 @@ public abstract class Level_movableBEMixin implements LevelInterface, LevelAcces @Shadow public abstract void onBlockStateChange(BlockPos blockPos_1, BlockState blockState_1, BlockState blockState_2); - @Shadow public abstract ProfilerFiller getProfiler(); - @Shadow public abstract void updateNeighbourForOutputSignal(BlockPos pos, Block block); @Shadow public abstract boolean isDebug(); @@ -79,7 +78,7 @@ public abstract class Level_movableBEMixin implements LevelInterface, LevelAcces if (blockState_3 != blockState_2 && (blockState_3.getLightBlock() != blockState_2.getLightBlock() || blockState_3.getLightEmission() != blockState_2.getLightEmission() || blockState_3.useShapeForLightOcclusion() || blockState_2.useShapeForLightOcclusion())) { - ProfilerFiller profiler = getProfiler(); + ProfilerFiller profiler = Profiler.get(); profiler.push("queueCheckLight"); this.getChunkSource().getLightEngine().checkBlock(blockPos_1); profiler.pop(); diff --git a/src/main/java/carpet/mixins/MinecraftServer_tickspeedMixin.java b/src/main/java/carpet/mixins/MinecraftServer_tickspeedMixin.java index e75fe66c..aba7780b 100644 --- a/src/main/java/carpet/mixins/MinecraftServer_tickspeedMixin.java +++ b/src/main/java/carpet/mixins/MinecraftServer_tickspeedMixin.java @@ -10,8 +10,6 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import java.util.function.BooleanSupplier; - @Mixin(value = MinecraftServer.class, priority = Integer.MAX_VALUE - 10) public abstract class MinecraftServer_tickspeedMixin extends ReentrantBlockableEventLoop implements MinecraftServerInterface { @@ -26,7 +24,7 @@ public abstract class MinecraftServer_tickspeedMixin extends ReentrantBlockableE // could possibly just inject that mspt selection at the beginning of the loop, but then adding all mspt's to // replace 50L will be a hassle @Inject(method = "runServer", at = @At(value = "INVOKE", shift = At.Shift.AFTER, - target = "Lnet/minecraft/server/MinecraftServer;startMetricsRecordingTick()V")) + target = "Lnet/minecraft/util/profiling/Profiler;get()Lnet/minecraft/util/profiling/ProfilerFiller;")) private void modifiedRunLoop(CallbackInfo ci) { if (CarpetProfiler.tick_health_requested != 0L) @@ -86,6 +84,4 @@ public abstract class MinecraftServer_tickspeedMixin extends ReentrantBlockableE CarpetProfiler.end_tick_profiling((MinecraftServer) (Object)this); } } - - } diff --git a/src/main/java/carpet/mixins/ServerLevel_scarpetMixin.java b/src/main/java/carpet/mixins/ServerLevel_scarpetMixin.java index edaccc0e..412302da 100644 --- a/src/main/java/carpet/mixins/ServerLevel_scarpetMixin.java +++ b/src/main/java/carpet/mixins/ServerLevel_scarpetMixin.java @@ -43,9 +43,10 @@ import static carpet.script.CarpetEventServer.Event.CHUNK_UNLOADED; @Mixin(ServerLevel.class) public abstract class ServerLevel_scarpetMixin extends Level implements ServerWorldInterface { - protected ServerLevel_scarpetMixin(WritableLevelData writableLevelData, ResourceKey resourceKey, RegistryAccess registryAccess, Holder holder, Supplier supplier, boolean bl, boolean bl2, long l, int i) + + protected ServerLevel_scarpetMixin(WritableLevelData writableLevelData, ResourceKey resourceKey, RegistryAccess registryAccess, Holder holder, boolean bl, boolean bl2, long l, int i) { - super(writableLevelData, resourceKey, registryAccess, holder, supplier, bl, bl2, l, i); + super(writableLevelData, resourceKey, registryAccess, holder, bl, bl2, l, i); } @Inject(method = "tickChunk", locals = LocalCapture.CAPTURE_FAILHARD, at = @At( diff --git a/src/main/java/carpet/mixins/ServerLevel_tickMixin.java b/src/main/java/carpet/mixins/ServerLevel_tickMixin.java index 38a19e69..4f3a166a 100644 --- a/src/main/java/carpet/mixins/ServerLevel_tickMixin.java +++ b/src/main/java/carpet/mixins/ServerLevel_tickMixin.java @@ -21,9 +21,9 @@ import net.minecraft.world.level.storage.WritableLevelData; @Mixin(ServerLevel.class) public abstract class ServerLevel_tickMixin extends Level implements LevelInterface { - protected ServerLevel_tickMixin(final WritableLevelData writableLevelData, final ResourceKey resourceKey, final RegistryAccess registryAccess, final Holder holder, final Supplier supplier, final boolean bl, final boolean bl2, final long l, final int i) + protected ServerLevel_tickMixin(final WritableLevelData writableLevelData, final ResourceKey resourceKey, final RegistryAccess registryAccess, final Holder holder, final boolean bl, final boolean bl2, final long l, final int i) { - super(writableLevelData, resourceKey, registryAccess, holder, supplier, bl, bl2, l, i); + super(writableLevelData, resourceKey, registryAccess, holder, bl, bl2, l, i); } private CarpetProfiler.ProfilerToken currentSection; From 29d7f49b52b048893188be2004ac36e6fb7f9089 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Wed, 11 Sep 2024 23:03:42 +0200 Subject: [PATCH 012/232] 1.4.152 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 1ff30f66..9b6a0bb0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G fabric_version=0.102.0+1.21 # Mod Properties - mod_version = 1.4.151 + mod_version = 1.4.152 maven_group = carpet archives_base_name = fabric-carpet From b32de10cf3907e6b3b0f88f01379fe613af59ea7 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Wed, 18 Sep 2024 17:24:23 +0200 Subject: [PATCH 013/232] 24w38a --- gradle.properties | 2 +- src/main/java/carpet/helpers/RedstoneWireTurbo.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 9b6a0bb0..34b784c4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=24w37a + minecraft_version=24w38a loader_version=0.16.5 jsr305_version=3.0.2 fabric_version=0.102.0+1.21 diff --git a/src/main/java/carpet/helpers/RedstoneWireTurbo.java b/src/main/java/carpet/helpers/RedstoneWireTurbo.java index 53bc31a2..57015ed0 100644 --- a/src/main/java/carpet/helpers/RedstoneWireTurbo.java +++ b/src/main/java/carpet/helpers/RedstoneWireTurbo.java @@ -951,7 +951,7 @@ public class RedstoneWireTurbo BlockPos neighborPos = pos.relative(dir); BlockState neighborState = level.getBlockState(neighborPos); - BlockState newState = neighborState.updateShape(dir.getOpposite(), state, level, neighborPos, pos); + BlockState newState = neighborState.updateShape(level, level, neighborPos, dir.getOpposite(), pos, state, level.getRandom()); Block.updateOrDestroy(neighborState, newState, level, neighborPos, Block.UPDATE_CLIENTS); } } From 617e6a987c14d4ede5357a5ff0d759a33959255c Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Wed, 18 Sep 2024 17:25:13 +0200 Subject: [PATCH 014/232] 1.4.153 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 34b784c4..7de37ee2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G fabric_version=0.102.0+1.21 # Mod Properties - mod_version = 1.4.152 + mod_version = 1.4.153 maven_group = carpet archives_base_name = fabric-carpet From ad8680826d8bc6789429167ead9dba628d405b54 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Wed, 25 Sep 2024 19:12:46 +0200 Subject: [PATCH 015/232] fixes #1908 --- src/main/java/carpet/mixins/MinecraftMixin.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/carpet/mixins/MinecraftMixin.java b/src/main/java/carpet/mixins/MinecraftMixin.java index ffe95fb8..613d220e 100644 --- a/src/main/java/carpet/mixins/MinecraftMixin.java +++ b/src/main/java/carpet/mixins/MinecraftMixin.java @@ -15,8 +15,8 @@ public class MinecraftMixin { @Shadow public ClientLevel level; - @Inject(method = "disconnect(Lnet/minecraft/client/gui/screens/Screen;)V", at = @At("HEAD")) - private void onCloseGame(Screen screen, CallbackInfo ci) + @Inject(method = "disconnect(Lnet/minecraft/client/gui/screens/Screen;Z)V", at = @At("HEAD")) + private void onCloseGame(Screen screen, boolean b, CallbackInfo ci) { CarpetClient.disconnect(); } From 85d848c4889ff82ab5093a16552a6e041624a4b7 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Wed, 25 Sep 2024 21:01:11 +0200 Subject: [PATCH 016/232] 24w39a --- gradle.properties | 2 +- .../carpet/api/settings/SettingsManager.java | 6 ++--- .../java/carpet/commands/PlayerCommand.java | 3 ++- .../java/carpet/fakes/FoodDataInterface.java | 8 +++++++ ...ientPacketListener_clientCommandMixin.java | 2 +- .../carpet/mixins/FoodData_scarpetMixin.java | 24 +++++++++++++++++++ .../mixins/LivingEntity_cleanLogsMixin.java | 3 ++- .../LivingEntity_maxCollisionsMixin.java | 4 ++-- .../LivingEntity_scarpetEventsMixin.java | 3 ++- .../carpet/mixins/Player_parrotMixin.java | 7 +++--- .../mixins/Player_scarpetEventsMixin.java | 3 ++- .../mixins/ServerLevel_scarpetMixin.java | 2 ++ .../mixins/WoolCarpetBlock_placeMixin.java | 4 +++- .../carpet/patches/EntityPlayerMPFake.java | 2 +- .../java/carpet/script/CarpetEventServer.java | 4 ++-- .../java/carpet/script/EntityEventsGroup.java | 5 +++- .../script/utils/SnoopyCommandSource.java | 4 ++-- .../java/carpet/script/value/EntityValue.java | 13 +++++----- src/main/java/carpet/utils/Messenger.java | 9 +++---- src/main/java/carpet/utils/WoolTool.java | 3 ++- src/main/resources/carpet.mixins.json | 1 + 21 files changed, 80 insertions(+), 32 deletions(-) create mode 100644 src/main/java/carpet/fakes/FoodDataInterface.java create mode 100644 src/main/java/carpet/mixins/FoodData_scarpetMixin.java diff --git a/gradle.properties b/gradle.properties index 7de37ee2..f115cd8c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=24w38a + minecraft_version=24w39a loader_version=0.16.5 jsr305_version=3.0.2 fabric_version=0.102.0+1.21 diff --git a/src/main/java/carpet/api/settings/SettingsManager.java b/src/main/java/carpet/api/settings/SettingsManager.java index b8a0430f..dc7637e2 100644 --- a/src/main/java/carpet/api/settings/SettingsManager.java +++ b/src/main/java/carpet/api/settings/SettingsManager.java @@ -304,7 +304,7 @@ public class SettingsManager { /** * Calling this method is not supported. */ - public void inspectClientsideCommand(CommandSourceStack source, String string) + public void inspectClientsideCommand(String string) { if (string.startsWith("/" + identifier + " ")) { @@ -316,9 +316,9 @@ public class SettingsManager { if (rules.containsKey(rule) && rules.get(rule).canBeToggledClientSide()) { try { - rules.get(rule).set(source, strOption); + rules.get(rule).set(null, strOption); } catch (InvalidRuleValueException e) { - e.notifySource(rule, source); + //e.notifySource(rule, source); } } } diff --git a/src/main/java/carpet/commands/PlayerCommand.java b/src/main/java/carpet/commands/PlayerCommand.java index 616fd25b..ee25a48d 100644 --- a/src/main/java/carpet/commands/PlayerCommand.java +++ b/src/main/java/carpet/commands/PlayerCommand.java @@ -223,7 +223,8 @@ public class PlayerCommand private static int kill(CommandContext context) { if (cantReMove(context)) return 0; - getPlayer(context).kill(); + ServerPlayer player = getPlayer(context); + player.kill(player.serverLevel()); return 1; } diff --git a/src/main/java/carpet/fakes/FoodDataInterface.java b/src/main/java/carpet/fakes/FoodDataInterface.java new file mode 100644 index 00000000..82dafee8 --- /dev/null +++ b/src/main/java/carpet/fakes/FoodDataInterface.java @@ -0,0 +1,8 @@ +package carpet.fakes; + +public interface FoodDataInterface +{ + float getCMExhaustionLevel(); + + void setExhaustion(float aFloat); +} diff --git a/src/main/java/carpet/mixins/ClientPacketListener_clientCommandMixin.java b/src/main/java/carpet/mixins/ClientPacketListener_clientCommandMixin.java index 6690ea49..d894c38d 100644 --- a/src/main/java/carpet/mixins/ClientPacketListener_clientCommandMixin.java +++ b/src/main/java/carpet/mixins/ClientPacketListener_clientCommandMixin.java @@ -35,7 +35,7 @@ public abstract class ClientPacketListener_clientCommandMixin extends ClientComm if (CarpetServer.minecraft_server == null && !CarpetClient.isCarpet() && minecraft.player != null) { LocalPlayer playerSource = minecraft.player; - CarpetServer.forEachManager(sm -> sm.inspectClientsideCommand(playerSource.createCommandSourceStack(), "/" + string)); + CarpetServer.forEachManager(sm -> sm.inspectClientsideCommand("/" + string)); } } } diff --git a/src/main/java/carpet/mixins/FoodData_scarpetMixin.java b/src/main/java/carpet/mixins/FoodData_scarpetMixin.java new file mode 100644 index 00000000..40b3cf4d --- /dev/null +++ b/src/main/java/carpet/mixins/FoodData_scarpetMixin.java @@ -0,0 +1,24 @@ +package carpet.mixins; + +import carpet.fakes.FoodDataInterface; +import net.minecraft.world.food.FoodData; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; + +@Mixin(FoodData.class) +public class FoodData_scarpetMixin implements FoodDataInterface +{ + @Shadow private float exhaustionLevel; + + @Override + public float getCMExhaustionLevel() + { + return exhaustionLevel; + } + + @Override + public void setExhaustion(float aFloat) + { + exhaustionLevel = aFloat; + } +} diff --git a/src/main/java/carpet/mixins/LivingEntity_cleanLogsMixin.java b/src/main/java/carpet/mixins/LivingEntity_cleanLogsMixin.java index 525d918f..16b5306f 100644 --- a/src/main/java/carpet/mixins/LivingEntity_cleanLogsMixin.java +++ b/src/main/java/carpet/mixins/LivingEntity_cleanLogsMixin.java @@ -1,6 +1,7 @@ package carpet.mixins; import carpet.CarpetSettings; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; @@ -22,6 +23,6 @@ public abstract class LivingEntity_cleanLogsMixin extends Entity @Redirect(method = "die", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/LivingEntity;hasCustomName()Z")) private boolean shouldLogDeaths(LivingEntity livingEntity) { - return livingEntity.hasCustomName() && CarpetSettings.cleanLogs && level().getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES); + return livingEntity.hasCustomName() && CarpetSettings.cleanLogs && livingEntity.getServer().getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES); } } diff --git a/src/main/java/carpet/mixins/LivingEntity_maxCollisionsMixin.java b/src/main/java/carpet/mixins/LivingEntity_maxCollisionsMixin.java index f7168f9a..7adfd1f9 100644 --- a/src/main/java/carpet/mixins/LivingEntity_maxCollisionsMixin.java +++ b/src/main/java/carpet/mixins/LivingEntity_maxCollisionsMixin.java @@ -37,7 +37,7 @@ public abstract class LivingEntity_maxCollisionsMixin extends Entity int maxEntityCramming =-1; if (CarpetSettings.maxEntityCollisions > 0) { - maxEntityCramming = this.level().getGameRules().getInt(GameRules.RULE_MAX_ENTITY_CRAMMING); + maxEntityCramming = this.getServer().getGameRules().getInt(GameRules.RULE_MAX_ENTITY_CRAMMING); entities = ((LevelInterface) this.level()).getOtherEntitiesLimited( this, this.getBoundingBox(), @@ -50,7 +50,7 @@ public abstract class LivingEntity_maxCollisionsMixin extends Entity } if (!entities.isEmpty()) { - if (maxEntityCramming < 0) maxEntityCramming = this.level().getGameRules().getInt(GameRules.RULE_MAX_ENTITY_CRAMMING); + if (maxEntityCramming < 0) maxEntityCramming = this.getServer().getGameRules().getInt(GameRules.RULE_MAX_ENTITY_CRAMMING); if (maxEntityCramming > 0 && entities.size() > maxEntityCramming - 1 && this.random.nextInt(4) == 0) { int candidates = 0; diff --git a/src/main/java/carpet/mixins/LivingEntity_scarpetEventsMixin.java b/src/main/java/carpet/mixins/LivingEntity_scarpetEventsMixin.java index fe461420..0c5b8e9d 100644 --- a/src/main/java/carpet/mixins/LivingEntity_scarpetEventsMixin.java +++ b/src/main/java/carpet/mixins/LivingEntity_scarpetEventsMixin.java @@ -3,6 +3,7 @@ package carpet.mixins; import carpet.fakes.EntityInterface; import carpet.fakes.LivingEntityInterface; import carpet.script.EntityEventsGroup; +import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; @@ -42,7 +43,7 @@ public abstract class LivingEntity_scarpetEventsMixin extends Entity implements target = "Lnet/minecraft/world/entity/LivingEntity;getDamageAfterArmorAbsorb(Lnet/minecraft/world/damagesource/DamageSource;F)F", shift = At.Shift.BEFORE )) - private void entityTakingDamage(DamageSource source, float amount, CallbackInfo ci) + private void entityTakingDamage(ServerLevel serverLevel, DamageSource source, float amount, CallbackInfo ci) { ((EntityInterface)this).getEventContainer().onEvent(EntityEventsGroup.Event.ON_DAMAGE, amount, source); // this is not applicable since its not a playr for sure diff --git a/src/main/java/carpet/mixins/Player_parrotMixin.java b/src/main/java/carpet/mixins/Player_parrotMixin.java index bc29fc66..b7d32283 100644 --- a/src/main/java/carpet/mixins/Player_parrotMixin.java +++ b/src/main/java/carpet/mixins/Player_parrotMixin.java @@ -2,6 +2,7 @@ package carpet.mixins; import carpet.CarpetSettings; import net.minecraft.nbt.CompoundTag; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; @@ -57,7 +58,7 @@ public abstract class Player_parrotMixin extends LivingEntity } } - @Redirect(method = "hurt", at = @At(value = "INVOKE", + @Redirect(method = "hurtServer", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/player/Player;removeEntitiesOnShoulder()V")) private void cancelDropShoulderEntities2(Player playerEntity) { @@ -76,9 +77,9 @@ public abstract class Player_parrotMixin extends LivingEntity this.setShoulderEntityRight(new CompoundTag()); } - @Inject(method = "hurt", at = @At(value = "INVOKE", shift = At.Shift.BEFORE, + @Inject(method = "hurtServer", at = @At(value = "INVOKE", shift = At.Shift.BEFORE, target = "Lnet/minecraft/world/entity/player/Player;removeEntitiesOnShoulder()V")) - private void onDamage(DamageSource damageSource_1, float float_1, CallbackInfoReturnable cir) + private void onDamage(ServerLevel serverLevel, DamageSource damageSource_1, float float_1, CallbackInfoReturnable cir) { if (CarpetSettings.persistentParrots && !this.isShiftKeyDown()) { diff --git a/src/main/java/carpet/mixins/Player_scarpetEventsMixin.java b/src/main/java/carpet/mixins/Player_scarpetEventsMixin.java index 31720265..44411d5a 100644 --- a/src/main/java/carpet/mixins/Player_scarpetEventsMixin.java +++ b/src/main/java/carpet/mixins/Player_scarpetEventsMixin.java @@ -2,6 +2,7 @@ package carpet.mixins; import carpet.fakes.EntityInterface; import carpet.script.EntityEventsGroup; +import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; @@ -36,7 +37,7 @@ public abstract class Player_scarpetEventsMixin extends LivingEntity value = "INVOKE", target = "Lnet/minecraft/world/entity/player/Player;getDamageAfterArmorAbsorb(Lnet/minecraft/world/damagesource/DamageSource;F)F" )) - private void playerTakingDamage(DamageSource source, float amount, CallbackInfo ci) + private void playerTakingDamage(ServerLevel serverLevel, DamageSource source, float amount, CallbackInfo ci) { // version of LivingEntity_scarpetEventsMixin::entityTakingDamage ((EntityInterface)this).getEventContainer().onEvent(EntityEventsGroup.Event.ON_DAMAGE, amount, source); diff --git a/src/main/java/carpet/mixins/ServerLevel_scarpetMixin.java b/src/main/java/carpet/mixins/ServerLevel_scarpetMixin.java index 412302da..fdb12025 100644 --- a/src/main/java/carpet/mixins/ServerLevel_scarpetMixin.java +++ b/src/main/java/carpet/mixins/ServerLevel_scarpetMixin.java @@ -44,6 +44,8 @@ import static carpet.script.CarpetEventServer.Event.CHUNK_UNLOADED; public abstract class ServerLevel_scarpetMixin extends Level implements ServerWorldInterface { + @Shadow public abstract GameRules getGameRules(); + protected ServerLevel_scarpetMixin(WritableLevelData writableLevelData, ResourceKey resourceKey, RegistryAccess registryAccess, Holder holder, boolean bl, boolean bl2, long l, int i) { super(writableLevelData, resourceKey, registryAccess, holder, bl, bl2, l, i); diff --git a/src/main/java/carpet/mixins/WoolCarpetBlock_placeMixin.java b/src/main/java/carpet/mixins/WoolCarpetBlock_placeMixin.java index e5a3239c..0cbe55bf 100644 --- a/src/main/java/carpet/mixins/WoolCarpetBlock_placeMixin.java +++ b/src/main/java/carpet/mixins/WoolCarpetBlock_placeMixin.java @@ -2,6 +2,7 @@ package carpet.mixins; import carpet.utils.WoolTool; import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.WoolCarpetBlock; @@ -17,12 +18,13 @@ public abstract class WoolCarpetBlock_placeMixin extends Block super(block$Settings_1); } + @Override public BlockState getStateForPlacement(BlockPlaceContext context) { BlockState state = super.getStateForPlacement(context); if (context.getPlayer() != null && !context.getLevel().isClientSide) { // getColor() - WoolTool.carpetPlacedAction(((WoolCarpetBlock)(Object)this).getColor(), context.getPlayer(), context.getClickedPos(), (ServerLevel) context.getLevel()); + WoolTool.carpetPlacedAction(((WoolCarpetBlock)(Object)this).getColor(), (ServerPlayer) context.getPlayer(), context.getClickedPos(), (ServerLevel) context.getLevel()); } return state; } diff --git a/src/main/java/carpet/patches/EntityPlayerMPFake.java b/src/main/java/carpet/patches/EntityPlayerMPFake.java index ee1cd4dd..9cec72ea 100644 --- a/src/main/java/carpet/patches/EntityPlayerMPFake.java +++ b/src/main/java/carpet/patches/EntityPlayerMPFake.java @@ -140,7 +140,7 @@ public class EntityPlayerMPFake extends ServerPlayer } @Override - public void kill() + public void kill(ServerLevel level) { kill(Messenger.s("Killed")); } diff --git a/src/main/java/carpet/script/CarpetEventServer.java b/src/main/java/carpet/script/CarpetEventServer.java index 9c910ff5..ea0d099f 100644 --- a/src/main/java/carpet/script/CarpetEventServer.java +++ b/src/main/java/carpet/script/CarpetEventServer.java @@ -884,7 +884,7 @@ public class CarpetEventServer new NumericValue(amount), StringValue.of(source.getMsgId()), source.getEntity() == null ? Value.NULL : new EntityValue(source.getEntity()) - ), target::createCommandSourceStack); + ), () -> target.getServer().createCommandSourceStack()); } }; public static final Event PLAYER_DEALS_DAMAGE = new Event("player_deals_damage", 3, false) @@ -894,7 +894,7 @@ public class CarpetEventServer { return handler.call(() -> Arrays.asList(new EntityValue(source.getEntity()), new NumericValue(amount), new EntityValue(target)), - () -> source.getEntity().createCommandSourceStack() + () -> source.getEntity().getServer().createCommandSourceStack() ); } }; diff --git a/src/main/java/carpet/script/EntityEventsGroup.java b/src/main/java/carpet/script/EntityEventsGroup.java index 7f59f210..6eaf9fc5 100644 --- a/src/main/java/carpet/script/EntityEventsGroup.java +++ b/src/main/java/carpet/script/EntityEventsGroup.java @@ -16,8 +16,11 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import net.minecraft.commands.CommandSourceStack; +import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.player.Player; import net.minecraft.world.phys.Vec3; public class EntityEventsGroup @@ -167,7 +170,7 @@ public class EntityEventsGroup public CarpetEventServer.CallbackResult call(CarpetEventServer.Callback tickCall, Entity entity, Object... args) { assert args.length == argcount - 1; - return tickCall.execute(entity.createCommandSourceStack(), makeArgs(entity, args)); + return tickCall.execute((entity instanceof ServerPlayer player ? player.createCommandSourceStack() : entity.getServer().createCommandSourceStack()), makeArgs(entity, args)); } protected List makeArgs(Entity entity, Object... args) diff --git a/src/main/java/carpet/script/utils/SnoopyCommandSource.java b/src/main/java/carpet/script/utils/SnoopyCommandSource.java index 39d582e2..fc2315db 100644 --- a/src/main/java/carpet/script/utils/SnoopyCommandSource.java +++ b/src/main/java/carpet/script/utils/SnoopyCommandSource.java @@ -67,11 +67,11 @@ public class SnoopyCommandSource extends CommandSourceStack public SnoopyCommandSource(ServerPlayer player, Component[] error, List output) { - super(player, player.position(), player.getRotationVector(), + super(player.commandSource(), player.position(), player.getRotationVector(), player.level() instanceof final ServerLevel serverLevel ? serverLevel : null, player.server.getProfilePermissions(player.getGameProfile()), player.getName().getString(), player.getDisplayName(), player.level().getServer(), player); - this.output = player; + this.output = player.commandSource(); this.position = player.position(); this.world = player.level() instanceof final ServerLevel serverLevel ? serverLevel : null; this.level = player.server.getProfilePermissions(player.getGameProfile()); diff --git a/src/main/java/carpet/script/value/EntityValue.java b/src/main/java/carpet/script/value/EntityValue.java index 86daa23a..6499b0e5 100644 --- a/src/main/java/carpet/script/value/EntityValue.java +++ b/src/main/java/carpet/script/value/EntityValue.java @@ -1,5 +1,6 @@ package carpet.script.value; +import carpet.fakes.FoodDataInterface; import carpet.script.external.Vanilla; import carpet.script.utils.Tracer; import carpet.script.CarpetContext; @@ -302,11 +303,11 @@ public class EntityValue extends Value EntityType.TRIDENT, EntityType.WITHER_SKULL, EntityType.FISHING_BOBBER, EntityType.SHULKER_BULLET ); Set> deads = Set.of( - EntityType.AREA_EFFECT_CLOUD, EntityType.MARKER, EntityType.BOAT, EntityType.END_CRYSTAL, + EntityType.AREA_EFFECT_CLOUD, EntityType.MARKER, EntityType.END_CRYSTAL, EntityType.EVOKER_FANGS, EntityType.EXPERIENCE_ORB, EntityType.EYE_OF_ENDER, EntityType.FALLING_BLOCK, EntityType.ITEM, EntityType.ITEM_FRAME, EntityType.GLOW_ITEM_FRAME, EntityType.LEASH_KNOT, EntityType.LIGHTNING_BOLT, EntityType.PAINTING, - EntityType.TNT, EntityType.ARMOR_STAND, EntityType.CHEST_BOAT + EntityType.TNT, EntityType.ARMOR_STAND ); Set> minecarts = Set.of( @@ -336,7 +337,7 @@ public class EntityValue extends Value ); Set> living = allTypes.stream().filter(et -> - !deads.contains(et) && !projectiles.contains(et) && !minecarts.contains(et) + !deads.contains(et) && !projectiles.contains(et) && !minecarts.contains(et) && !et.is(EntityTypeTags.BOAT) ).collect(Collectors.toSet()); Set> regular = allTypes.stream().filter(et -> @@ -550,7 +551,7 @@ public class EntityValue extends Value put("persistence", (e, a) -> e instanceof Mob mob ? BooleanValue.of(mob.isPersistenceRequired()) : Value.NULL); put("hunger", (e, a) -> e instanceof Player player ? new NumericValue(player.getFoodData().getFoodLevel()) : Value.NULL); put("saturation", (e, a) -> e instanceof Player player ? new NumericValue(player.getFoodData().getSaturationLevel()) : Value.NULL); - put("exhaustion", (e, a) -> e instanceof Player player ? new NumericValue(player.getFoodData().getExhaustionLevel()) : Value.NULL); + put("exhaustion", (e, a) -> e instanceof Player player ? new NumericValue(((FoodDataInterface)player.getFoodData()).getCMExhaustionLevel()) : Value.NULL); put("absorption", (e, a) -> e instanceof Player player ? new NumericValue(player.getAbsorptionAmount()) : Value.NULL); put("xp", (e, a) -> e instanceof Player player ? new NumericValue(player.totalExperience) : Value.NULL); put("xp_level", (e, a) -> e instanceof Player player ? new NumericValue(player.experienceLevel) : Value.NULL); @@ -1040,7 +1041,7 @@ public class EntityValue extends Value } });*/ - put("kill", (e, v) -> e.kill()); + put("kill", (e, v) -> e.kill((ServerLevel) e.level())); put("location", (e, v) -> { if (!(v instanceof ListValue lv)) @@ -1605,7 +1606,7 @@ public class EntityValue extends Value put("exhaustion", (e, v) -> { if (e instanceof Player p) { - p.getFoodData().setExhaustion(NumericValue.asNumber(v).getFloat()); + ((FoodDataInterface)p.getFoodData()).setExhaustion(NumericValue.asNumber(v).getFloat()); } }); diff --git a/src/main/java/carpet/utils/Messenger.java b/src/main/java/carpet/utils/Messenger.java index 36af4c17..fc7695fc 100644 --- a/src/main/java/carpet/utils/Messenger.java +++ b/src/main/java/carpet/utils/Messenger.java @@ -10,6 +10,7 @@ import net.minecraft.network.chat.HoverEvent; import net.minecraft.network.chat.Style; import net.minecraft.network.chat.TextColor; import net.minecraft.server.MinecraftServer; +import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.MobCategory; import net.minecraft.world.entity.player.Player; import net.minecraft.world.phys.Vec3; @@ -243,7 +244,7 @@ public class Messenger } public static void m(Player player, Object ... fields) { - player.sendSystemMessage(Messenger.c(fields)); + ((ServerPlayer)player).sendSystemMessage(Messenger.c(fields)); } /* @@ -287,7 +288,7 @@ public class Messenger public static void send(Player player, Collection lines) { - lines.forEach(message -> player.sendSystemMessage(message)); + lines.forEach(message -> ((ServerPlayer)player).sendSystemMessage(message)); } public static void send(CommandSourceStack source, Collection lines) { @@ -301,7 +302,7 @@ public class Messenger LOG.error("Message not delivered: "+message); server.sendSystemMessage(Component.literal(message)); Component txt = c("gi "+message); - for (Player entityplayer : server.getPlayerList().getPlayers()) + for (ServerPlayer entityplayer : server.getPlayerList().getPlayers()) { entityplayer.sendSystemMessage(txt); } @@ -311,7 +312,7 @@ public class Messenger if (server == null) LOG.error("Message not delivered: "+message.getString()); server.sendSystemMessage(message); - for (Player entityplayer : server.getPlayerList().getPlayers()) + for (ServerPlayer entityplayer : server.getPlayerList().getPlayers()) { entityplayer.sendSystemMessage(message); } diff --git a/src/main/java/carpet/utils/WoolTool.java b/src/main/java/carpet/utils/WoolTool.java index 7d3fa7fa..c8ba39a0 100644 --- a/src/main/java/carpet/utils/WoolTool.java +++ b/src/main/java/carpet/utils/WoolTool.java @@ -10,6 +10,7 @@ import net.minecraft.commands.CommandSourceStack; import net.minecraft.core.BlockPos; import net.minecraft.network.chat.Component; import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; import net.minecraft.tags.BlockTags; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.DyeColor; @@ -60,7 +61,7 @@ public class WoolTool *
  • Green - Prints the contents of the counter of the colour of wool underneath the carpet
  • * */ - public static void carpetPlacedAction(DyeColor color, Player placer, BlockPos pos, ServerLevel worldIn) + public static void carpetPlacedAction(DyeColor color, ServerPlayer placer, BlockPos pos, ServerLevel worldIn) { if (!CarpetSettings.carpets) { diff --git a/src/main/resources/carpet.mixins.json b/src/main/resources/carpet.mixins.json index 9fa3de98..0950f49d 100644 --- a/src/main/resources/carpet.mixins.json +++ b/src/main/resources/carpet.mixins.json @@ -149,6 +149,7 @@ "SystemReport_addScarpetAppsMixin", "CommandNode_scarpetCommandsMixin", "CommandDispatcher_scarpetCommandsMixin", + "FoodData_scarpetMixin", "RecipeManager_scarpetMixin", "BlockInput_scarpetMixin", From 614496729927f97df1a1777b4c69be18ec293134 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Wed, 25 Sep 2024 21:02:34 +0200 Subject: [PATCH 017/232] 1.4.154 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index f115cd8c..71291c18 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G fabric_version=0.102.0+1.21 # Mod Properties - mod_version = 1.4.153 + mod_version = 1.4.154 maven_group = carpet archives_base_name = fabric-carpet From 3a66dd0a9b67b99626b2874137c0e501c5f21822 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Fri, 4 Oct 2024 20:16:39 +0200 Subject: [PATCH 018/232] 24w40a --- docs/scarpet/api/Inventories.md | 10 +- gradle.properties | 4 +- .../carpet/fakes/RecipeManagerInterface.java | 17 -- .../java/carpet/helpers/HopperCounter.java | 234 +++++++++++------- .../AbstractCraftingMenu_scarpetMixin.java | 3 +- .../AbstractFurnaceMenu_scarpetMixin.java | 3 +- .../mixins/RecipeManager_scarpetMixin.java | 55 ---- ...PacketListenerImpl_scarpetEventsMixin.java | 7 +- .../ServerPlayer_scarpetEventMixin.java | 12 +- .../carpet/patches/EntityPlayerMPFake.java | 10 +- .../java/carpet/script/api/Inventories.java | 52 ++-- .../script/command/CommandArgument.java | 9 +- .../java/carpet/script/external/Vanilla.java | 15 -- .../carpet/script/utils/RecipeHelper.java | 57 +++++ .../java/carpet/script/value/EntityValue.java | 4 +- .../carpet/script/value/ValueConversions.java | 8 +- src/main/resources/carpet.mixins.json | 1 - 17 files changed, 269 insertions(+), 232 deletions(-) delete mode 100644 src/main/java/carpet/fakes/RecipeManagerInterface.java delete mode 100644 src/main/java/carpet/mixins/RecipeManager_scarpetMixin.java create mode 100644 src/main/java/carpet/script/utils/RecipeHelper.java diff --git a/docs/scarpet/api/Inventories.md b/docs/scarpet/api/Inventories.md index 23d07352..f6f6561d 100644 --- a/docs/scarpet/api/Inventories.md +++ b/docs/scarpet/api/Inventories.md @@ -70,8 +70,8 @@ Recipe type can take one of the following options: * `'smithing'` - smithing table (1.16+) The return value is a list of available recipes (even if there is only one recipe available). Each recipe contains of - an item triple of the crafting result, list of ingredients, each containing a list of possible variants of the - ingredients in this slot, as item triples, or `null` if its a shaped recipe and a given slot in the patterns is left + an item triple of the crafting results as a list of item stacks, list of ingredients, each containing a list of possible variants of the + ingredients in this slot, as item ids, or `null` if it is a shaped recipe and a given slot in the patterns is left empty, and recipe specification as another list. Possible recipe specs is: * `['shaped', width, height]` - shaped crafting. `width` and `height` can be 1, 2 or 3. * `['shapeless']` - shapeless crafting @@ -79,10 +79,6 @@ Recipe type can take one of the following options: * `['cutting']` - stonecutter recipe * `['special']` - special crafting recipe, typically not present in the crafting menu * `['custom']` - other recipe types - -Note that ingredients are specified as tripes, with count and nbt information. Currently all recipes require always one -of the ingredients, and for some recipes, even if the nbt data for the ingredient is specified (e.g. `dispenser`), it -can accept items of any tags. Also note that some recipes leave some products in the crafting window, and these can be determined using `crafting_remaining_item()` function @@ -97,7 +93,7 @@ Also note that some recipes leave some products in the crafting window, and thes ### `crafting_remaining_item(item)` returns `null` if the item has no remaining item in the crafting window when used as a crafting ingredient, or an -item name that serves as a replacement after crafting is done. Currently it can only be buckets and glass bottles. +item tuple that serves as a replacement after crafting is done. Currently, it can only be buckets and glass bottles. ### `inventory_size(inventory)` diff --git a/gradle.properties b/gradle.properties index 71291c18..84597d12 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,10 +3,10 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=24w39a + minecraft_version=24w40a loader_version=0.16.5 jsr305_version=3.0.2 - fabric_version=0.102.0+1.21 + fabric_version=0.105.1+1.21.2 # Mod Properties mod_version = 1.4.154 diff --git a/src/main/java/carpet/fakes/RecipeManagerInterface.java b/src/main/java/carpet/fakes/RecipeManagerInterface.java deleted file mode 100644 index 78cfe428..00000000 --- a/src/main/java/carpet/fakes/RecipeManagerInterface.java +++ /dev/null @@ -1,17 +0,0 @@ -package carpet.fakes; - -import java.util.List; - -import net.minecraft.core.RegistryAccess; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.crafting.Recipe; -import net.minecraft.world.item.crafting.RecipeType; - -public interface RecipeManagerInterface -{ - /** - * Gets all the recipes for a given item. Also used for {@link carpet.helpers.HopperCounter#guessColor} to guess the - * colour of an item to display it prettily - */ - List> getAllMatching(final RecipeType type, final ResourceLocation itemId, final RegistryAccess registryAccess); -} diff --git a/src/main/java/carpet/helpers/HopperCounter.java b/src/main/java/carpet/helpers/HopperCounter.java index 9f29ac7b..46af906e 100644 --- a/src/main/java/carpet/helpers/HopperCounter.java +++ b/src/main/java/carpet/helpers/HopperCounter.java @@ -1,11 +1,12 @@ package carpet.helpers; import carpet.CarpetServer; -import carpet.fakes.RecipeManagerInterface; +import carpet.script.utils.RecipeHelper; import carpet.utils.Messenger; import it.unimi.dsi.fastutil.objects.Object2LongLinkedOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2LongMap; import net.minecraft.ChatFormatting; +import net.minecraft.core.Holder; import net.minecraft.core.Registry; import net.minecraft.core.RegistryAccess; import net.minecraft.core.registries.Registries; @@ -21,9 +22,9 @@ import net.minecraft.world.item.DyeItem; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; -import net.minecraft.world.item.crafting.PlacementInfo; +import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.item.crafting.Recipe; -import net.minecraft.world.item.crafting.RecipeType; +import net.minecraft.world.level.Level; import net.minecraft.world.level.block.AbstractBannerBlock; import net.minecraft.world.level.block.BeaconBeamBlock; import net.minecraft.world.level.block.Block; @@ -36,7 +37,6 @@ import java.util.EnumMap; import java.util.List; import java.util.Locale; import java.util.Map; -import java.util.Optional; import java.util.stream.Collectors; import static java.util.Map.entry; @@ -101,7 +101,9 @@ public class HopperCounter this.color = color; String hexColor = Integer.toHexString(color.getTextColor()); if (hexColor.length() < 6) + { hexColor = "0".repeat(6 - hexColor.length()) + hexColor; + } this.coloredName = '#' + hexColor + ' ' + color.getName(); } @@ -135,6 +137,7 @@ public class HopperCounter /** * Resets all counters, clearing their items. + * * @param fresh Whether or not to start the clocks going immediately or later. */ public static void resetAll(MinecraftServer server, boolean fresh) @@ -142,7 +145,10 @@ public class HopperCounter for (HopperCounter counter : COUNTERS.values()) { counter.reset(server); - if (fresh) counter.startTick = -1; + if (fresh) + { + counter.startTick = -1; + } } } @@ -158,7 +164,10 @@ public class HopperCounter List temp = counter.format(server, realtime, false); if (temp.size() > 1) { - if (!text.isEmpty()) text.add(Messenger.s("")); + if (!text.isEmpty()) + { + text.add(Messenger.s("")); + } text.addAll(temp); } } @@ -180,7 +189,7 @@ public class HopperCounter { if (brief) { - return Collections.singletonList(Messenger.c("b"+coloredName,"w : ","gi -, -/h, - min ")); + return Collections.singletonList(Messenger.c("b" + coloredName, "w : ", "gi -, -/h, - min ")); } return Collections.singletonList(Messenger.c(coloredName, "w hasn't started counting yet")); } @@ -189,36 +198,36 @@ public class HopperCounter { if (brief) { - return Collections.singletonList(Messenger.c("b"+coloredName,"w : ","wb 0","w , ","wb 0","w /h, ", String.format("wb %.1f ", ticks / (20.0 * 60.0)), "w min")); + return Collections.singletonList(Messenger.c("b" + coloredName, "w : ", "wb 0", "w , ", "wb 0", "w /h, ", String.format("wb %.1f ", ticks / (20.0 * 60.0)), "w min")); } return Collections.singletonList(Messenger.c("w No items for ", coloredName, String.format("w yet (%.2f min.%s)", - ticks / (20.0 * 60.0), (realTime ? " - real time" : "")), - "nb [X]", "^g reset", "!/counter " + color.getName() +" reset")); + ticks / (20.0 * 60.0), (realTime ? " - real time" : "")), + "nb [X]", "^g reset", "!/counter " + color.getName() + " reset")); } if (brief) { - return Collections.singletonList(Messenger.c("b"+coloredName,"w : ", - "wb "+total,"w , ", - "wb "+(total * (20 * 60 * 60) / ticks),"w /h, ", + return Collections.singletonList(Messenger.c("b" + coloredName, "w : ", + "wb " + total, "w , ", + "wb " + (total * (20 * 60 * 60) / ticks), "w /h, ", String.format("wb %.1f ", ticks / (20.0 * 60.0)), "w min" )); } List items = new ArrayList<>(); items.add(Messenger.c("w Items for ", coloredName, - "w (",String.format("wb %.2f", ticks*1.0/(20*60)), "w min"+(realTime?" - real time":"")+"), ", - "w total: ", "wb "+total, "w , (",String.format("wb %.1f",total*1.0*(20*60*60)/ticks),"w /h):", - "nb [X]", "^g reset", "!/counter "+color+" reset" + "w (", String.format("wb %.2f", ticks * 1.0 / (20 * 60)), "w min" + (realTime ? " - real time" : "") + "), ", + "w total: ", "wb " + total, "w , (", String.format("wb %.1f", total * 1.0 * (20 * 60 * 60) / ticks), "w /h):", + "nb [X]", "^g reset", "!/counter " + color + " reset" )); items.addAll(counter.object2LongEntrySet().stream().sorted((e, f) -> Long.compare(f.getLongValue(), e.getLongValue())).map(e -> { Item item = e.getKey(); MutableComponent itemName = Component.translatable(item.getDescriptionId()); Style itemStyle = itemName.getStyle(); - TextColor color = guessColor(item, server.registryAccess()); + TextColor color = guessColor(item, server.overworld()); itemName.setStyle((color != null) ? itemStyle.withColor(color) : itemStyle.withItalic(true)); long count = e.getLongValue(); return Messenger.c("g - ", itemName, - "g : ","wb "+count,"g , ", + "g : ", "wb " + count, "g , ", String.format("wb %.1f", count * (20.0 * 60.0 * 60.0) / ticks), "w /h" ); }).collect(Collectors.toList())); @@ -231,13 +240,25 @@ public class HopperCounter */ public static int appropriateColor(int color) { - if (color == 0) return MapColor.SNOW.col; + if (color == 0) + { + return MapColor.SNOW.col; + } int r = (color >> 16 & 255); int g = (color >> 8 & 255); int b = (color & 255); - if (r < 70) r = 70; - if (g < 70) g = 70; - if (b < 70) b = 70; + if (r < 70) + { + r = 70; + } + if (g < 70) + { + g = 70; + } + if (b < 70) + { + b = 70; + } return (r << 16) + (g << 8) + b; } @@ -271,65 +292,65 @@ public class HopperCounter entry(Items.ROSE_BUSH, Blocks.RED_WOOL), entry(Items.PEONY, Blocks.PINK_WOOL), entry(Items.CARROT, Blocks.ORANGE_WOOL), - entry(Items.APPLE,Blocks.RED_WOOL), - entry(Items.WHEAT,Blocks.HAY_BLOCK), + entry(Items.APPLE, Blocks.RED_WOOL), + entry(Items.WHEAT, Blocks.HAY_BLOCK), entry(Items.PORKCHOP, Blocks.PINK_WOOL), - entry(Items.RABBIT,Blocks.PINK_WOOL), - entry(Items.CHICKEN,Blocks.WHITE_TERRACOTTA), - entry(Items.BEEF,Blocks.NETHERRACK), - entry(Items.ENCHANTED_GOLDEN_APPLE,Blocks.GOLD_BLOCK), - entry(Items.COD,Blocks.WHITE_TERRACOTTA), - entry(Items.SALMON,Blocks.ACACIA_PLANKS), - entry(Items.ROTTEN_FLESH,Blocks.BROWN_WOOL), - entry(Items.PUFFERFISH,Blocks.YELLOW_TERRACOTTA), - entry(Items.TROPICAL_FISH,Blocks.ORANGE_WOOL), - entry(Items.POTATO,Blocks.WHITE_TERRACOTTA), + entry(Items.RABBIT, Blocks.PINK_WOOL), + entry(Items.CHICKEN, Blocks.WHITE_TERRACOTTA), + entry(Items.BEEF, Blocks.NETHERRACK), + entry(Items.ENCHANTED_GOLDEN_APPLE, Blocks.GOLD_BLOCK), + entry(Items.COD, Blocks.WHITE_TERRACOTTA), + entry(Items.SALMON, Blocks.ACACIA_PLANKS), + entry(Items.ROTTEN_FLESH, Blocks.BROWN_WOOL), + entry(Items.PUFFERFISH, Blocks.YELLOW_TERRACOTTA), + entry(Items.TROPICAL_FISH, Blocks.ORANGE_WOOL), + entry(Items.POTATO, Blocks.WHITE_TERRACOTTA), entry(Items.MUTTON, Blocks.RED_WOOL), - entry(Items.BEETROOT,Blocks.NETHERRACK), - entry(Items.MELON_SLICE,Blocks.MELON), - entry(Items.POISONOUS_POTATO,Blocks.SLIME_BLOCK), - entry(Items.SPIDER_EYE,Blocks.NETHERRACK), - entry(Items.GUNPOWDER,Blocks.GRAY_WOOL), - entry(Items.TURTLE_SCUTE,Blocks.LIME_WOOL), - entry(Items.ARMADILLO_SCUTE,Blocks.ANCIENT_DEBRIS), - entry(Items.FEATHER,Blocks.WHITE_WOOL), - entry(Items.FLINT,Blocks.BLACK_WOOL), - entry(Items.LEATHER,Blocks.SPRUCE_PLANKS), - entry(Items.GLOWSTONE_DUST,Blocks.GLOWSTONE), - entry(Items.PAPER,Blocks.WHITE_WOOL), - entry(Items.BRICK,Blocks.BRICKS), - entry(Items.INK_SAC,Blocks.BLACK_WOOL), - entry(Items.SNOWBALL,Blocks.SNOW_BLOCK), - entry(Items.WATER_BUCKET,Blocks.WATER), - entry(Items.LAVA_BUCKET,Blocks.LAVA), - entry(Items.MILK_BUCKET,Blocks.WHITE_WOOL), + entry(Items.BEETROOT, Blocks.NETHERRACK), + entry(Items.MELON_SLICE, Blocks.MELON), + entry(Items.POISONOUS_POTATO, Blocks.SLIME_BLOCK), + entry(Items.SPIDER_EYE, Blocks.NETHERRACK), + entry(Items.GUNPOWDER, Blocks.GRAY_WOOL), + entry(Items.TURTLE_SCUTE, Blocks.LIME_WOOL), + entry(Items.ARMADILLO_SCUTE, Blocks.ANCIENT_DEBRIS), + entry(Items.FEATHER, Blocks.WHITE_WOOL), + entry(Items.FLINT, Blocks.BLACK_WOOL), + entry(Items.LEATHER, Blocks.SPRUCE_PLANKS), + entry(Items.GLOWSTONE_DUST, Blocks.GLOWSTONE), + entry(Items.PAPER, Blocks.WHITE_WOOL), + entry(Items.BRICK, Blocks.BRICKS), + entry(Items.INK_SAC, Blocks.BLACK_WOOL), + entry(Items.SNOWBALL, Blocks.SNOW_BLOCK), + entry(Items.WATER_BUCKET, Blocks.WATER), + entry(Items.LAVA_BUCKET, Blocks.LAVA), + entry(Items.MILK_BUCKET, Blocks.WHITE_WOOL), entry(Items.CLAY_BALL, Blocks.CLAY), - entry(Items.COCOA_BEANS,Blocks.COCOA), - entry(Items.BONE,Blocks.BONE_BLOCK), - entry(Items.COD_BUCKET,Blocks.BROWN_TERRACOTTA), - entry(Items.PUFFERFISH_BUCKET,Blocks.YELLOW_TERRACOTTA), - entry(Items.SALMON_BUCKET,Blocks.PINK_TERRACOTTA), - entry(Items.TROPICAL_FISH_BUCKET,Blocks.ORANGE_TERRACOTTA), - entry(Items.SUGAR,Blocks.WHITE_WOOL), - entry(Items.BLAZE_POWDER,Blocks.GOLD_BLOCK), - entry(Items.ENDER_PEARL,Blocks.WARPED_PLANKS), - entry(Items.NETHER_STAR,Blocks.DIAMOND_BLOCK), - entry(Items.PRISMARINE_CRYSTALS,Blocks.SEA_LANTERN), - entry(Items.PRISMARINE_SHARD,Blocks.PRISMARINE), - entry(Items.RABBIT_HIDE,Blocks.OAK_PLANKS), - entry(Items.CHORUS_FRUIT,Blocks.PURPUR_BLOCK), - entry(Items.SHULKER_SHELL,Blocks.SHULKER_BOX), - entry(Items.NAUTILUS_SHELL,Blocks.BONE_BLOCK), - entry(Items.HEART_OF_THE_SEA,Blocks.CONDUIT), - entry(Items.HONEYCOMB,Blocks.HONEYCOMB_BLOCK), - entry(Items.NAME_TAG,Blocks.BONE_BLOCK), - entry(Items.TOTEM_OF_UNDYING,Blocks.YELLOW_TERRACOTTA), - entry(Items.TRIDENT,Blocks.PRISMARINE), - entry(Items.GHAST_TEAR,Blocks.WHITE_WOOL), - entry(Items.PHANTOM_MEMBRANE,Blocks.BONE_BLOCK), - entry(Items.EGG,Blocks.BONE_BLOCK), + entry(Items.COCOA_BEANS, Blocks.COCOA), + entry(Items.BONE, Blocks.BONE_BLOCK), + entry(Items.COD_BUCKET, Blocks.BROWN_TERRACOTTA), + entry(Items.PUFFERFISH_BUCKET, Blocks.YELLOW_TERRACOTTA), + entry(Items.SALMON_BUCKET, Blocks.PINK_TERRACOTTA), + entry(Items.TROPICAL_FISH_BUCKET, Blocks.ORANGE_TERRACOTTA), + entry(Items.SUGAR, Blocks.WHITE_WOOL), + entry(Items.BLAZE_POWDER, Blocks.GOLD_BLOCK), + entry(Items.ENDER_PEARL, Blocks.WARPED_PLANKS), + entry(Items.NETHER_STAR, Blocks.DIAMOND_BLOCK), + entry(Items.PRISMARINE_CRYSTALS, Blocks.SEA_LANTERN), + entry(Items.PRISMARINE_SHARD, Blocks.PRISMARINE), + entry(Items.RABBIT_HIDE, Blocks.OAK_PLANKS), + entry(Items.CHORUS_FRUIT, Blocks.PURPUR_BLOCK), + entry(Items.SHULKER_SHELL, Blocks.SHULKER_BOX), + entry(Items.NAUTILUS_SHELL, Blocks.BONE_BLOCK), + entry(Items.HEART_OF_THE_SEA, Blocks.CONDUIT), + entry(Items.HONEYCOMB, Blocks.HONEYCOMB_BLOCK), + entry(Items.NAME_TAG, Blocks.BONE_BLOCK), + entry(Items.TOTEM_OF_UNDYING, Blocks.YELLOW_TERRACOTTA), + entry(Items.TRIDENT, Blocks.PRISMARINE), + entry(Items.GHAST_TEAR, Blocks.WHITE_WOOL), + entry(Items.PHANTOM_MEMBRANE, Blocks.BONE_BLOCK), + entry(Items.EGG, Blocks.BONE_BLOCK), //entry(Items.,Blocks.), - entry(Items.COPPER_INGOT,Blocks.COPPER_BLOCK), + entry(Items.COPPER_INGOT, Blocks.COPPER_BLOCK), entry(Items.AMETHYST_SHARD, Blocks.AMETHYST_BLOCK)); /** @@ -337,8 +358,14 @@ public class HopperCounter */ public static TextColor fromItem(Item item, RegistryAccess registryAccess) { - if (DEFAULTS.containsKey(item)) return TextColor.fromRgb(appropriateColor(DEFAULTS.get(item).defaultMapColor().col)); - if (item instanceof DyeItem dye) return TextColor.fromRgb(appropriateColor(dye.getDyeColor().getMapColor().col)); + if (DEFAULTS.containsKey(item)) + { + return TextColor.fromRgb(appropriateColor(DEFAULTS.get(item).defaultMapColor().col)); + } + if (item instanceof DyeItem dye) + { + return TextColor.fromRgb(appropriateColor(dye.getDyeColor().getMapColor().col)); + } Block block = null; final Registry itemRegistry = registryAccess.lookupOrThrow(Registries.ITEM); final Registry blockRegistry = registryAccess.lookupOrThrow(Registries.BLOCK); @@ -353,9 +380,15 @@ public class HopperCounter } if (block != null) { - if (block instanceof AbstractBannerBlock) return TextColor.fromRgb(appropriateColor(((AbstractBannerBlock) block).getColor().getMapColor().col)); - if (block instanceof BeaconBeamBlock) return TextColor.fromRgb(appropriateColor( ((BeaconBeamBlock) block).getColor().getMapColor().col)); - return TextColor.fromRgb(appropriateColor( block.defaultMapColor().col)); + if (block instanceof AbstractBannerBlock) + { + return TextColor.fromRgb(appropriateColor(((AbstractBannerBlock) block).getColor().getMapColor().col)); + } + if (block instanceof BeaconBeamBlock) + { + return TextColor.fromRgb(appropriateColor(((BeaconBeamBlock) block).getColor().getMapColor().col)); + } + return TextColor.fromRgb(appropriateColor(block.defaultMapColor().col)); } return null; } @@ -364,35 +397,48 @@ public class HopperCounter * Guesses the item's colour from the item itself. It first calls {@link HopperCounter#fromItem} to see if it has a * valid colour there, if not just makes a guess, and if that fails just returns null */ - public static TextColor guessColor(Item item, RegistryAccess registryAccess) + public static TextColor guessColor(Item item, Level level) { + RegistryAccess registryAccess = level.registryAccess(); TextColor direct = fromItem(item, registryAccess); - if (direct != null) return direct; - if (CarpetServer.minecraft_server == null) return WHITE; + if (direct != null) + { + return direct; + } + if (CarpetServer.minecraft_server == null) + { + return WHITE; + } ResourceLocation id = registryAccess.lookupOrThrow(Registries.ITEM).getKey(item); - for (RecipeType type: registryAccess.lookupOrThrow(Registries.RECIPE_TYPE)) + if (id == null) { - for (Recipe r: ((RecipeManagerInterface) CarpetServer.minecraft_server.getRecipeManager()).getAllMatching(type, id, registryAccess)) + return null; + } + + for (Recipe r : RecipeHelper.getRecipesForOutput(CarpetServer.minecraft_server.getRecipeManager(), id, level)) + { + for (Ingredient ingredient : r.placementInfo().ingredients()) { - for (Optional ingredient: r.placementInfo().slotInfo()) + for (Holder stack : ingredient.items()) { - for(ItemStack stack : ingredient.get().possibleItems()) + TextColor cand = fromItem(stack.value(), registryAccess); + if (cand != null) { - TextColor cand = fromItem(stack.getItem(), registryAccess); - if (cand != null) - return cand; + return cand; } } } } + return null; } /** * Returns the hopper counter for the given color */ - public static HopperCounter getCounter(DyeColor color) { + public static HopperCounter getCounter(DyeColor color) + { return COUNTERS.get(color); } @@ -417,6 +463,6 @@ public class HopperCounter */ public long getTotalItems() { - return counter.isEmpty()?0:counter.values().longStream().sum(); + return counter.isEmpty() ? 0 : counter.values().longStream().sum(); } } diff --git a/src/main/java/carpet/mixins/AbstractCraftingMenu_scarpetMixin.java b/src/main/java/carpet/mixins/AbstractCraftingMenu_scarpetMixin.java index 2bae8f68..a2b09aa0 100644 --- a/src/main/java/carpet/mixins/AbstractCraftingMenu_scarpetMixin.java +++ b/src/main/java/carpet/mixins/AbstractCraftingMenu_scarpetMixin.java @@ -1,6 +1,7 @@ package carpet.mixins; import carpet.fakes.AbstractContainerMenuInterface; +import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.inventory.AbstractCraftingMenu; @@ -15,7 +16,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; public class AbstractCraftingMenu_scarpetMixin { @Inject(method = "handlePlacement",at = @At("HEAD"), cancellable = true) - private void selectRecipeCallback(boolean craftAll, boolean b, RecipeHolder recipe, Inventory player, CallbackInfoReturnable cir) { + private void selectRecipeCallback(boolean craftAll, boolean b, RecipeHolder recipe, ServerLevel serverLevel, Inventory player, CallbackInfoReturnable cir) { if(((AbstractContainerMenuInterface) this).callSelectRecipeListener((ServerPlayer) player.player ,recipe,craftAll)) cir.setReturnValue(RecipeBookMenu.PostPlaceAction.NOTHING); } diff --git a/src/main/java/carpet/mixins/AbstractFurnaceMenu_scarpetMixin.java b/src/main/java/carpet/mixins/AbstractFurnaceMenu_scarpetMixin.java index 8f2facc4..5f91dc5b 100644 --- a/src/main/java/carpet/mixins/AbstractFurnaceMenu_scarpetMixin.java +++ b/src/main/java/carpet/mixins/AbstractFurnaceMenu_scarpetMixin.java @@ -1,6 +1,7 @@ package carpet.mixins; import carpet.fakes.AbstractContainerMenuInterface; +import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.inventory.AbstractFurnaceMenu; @@ -15,7 +16,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; public class AbstractFurnaceMenu_scarpetMixin { @Inject(method = "handlePlacement",at = @At("HEAD"), cancellable = true) - private void selectRecipeCallback(boolean craftAll, boolean b, RecipeHolder recipe, Inventory player, CallbackInfoReturnable cir) { + private void selectRecipeCallback(boolean craftAll, boolean b, RecipeHolder recipe, ServerLevel level, Inventory player, CallbackInfoReturnable cir) { if(((AbstractContainerMenuInterface) this).callSelectRecipeListener((ServerPlayer) player.player ,recipe,craftAll)) cir.setReturnValue(RecipeBookMenu.PostPlaceAction.NOTHING); } diff --git a/src/main/java/carpet/mixins/RecipeManager_scarpetMixin.java b/src/main/java/carpet/mixins/RecipeManager_scarpetMixin.java deleted file mode 100644 index 90809db1..00000000 --- a/src/main/java/carpet/mixins/RecipeManager_scarpetMixin.java +++ /dev/null @@ -1,55 +0,0 @@ -package carpet.mixins; - -import carpet.fakes.RecipeManagerInterface; -import com.google.common.collect.Multimap; -import net.minecraft.core.Registry; -import net.minecraft.core.RegistryAccess; -import net.minecraft.core.registries.Registries; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.Items; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; - -import java.util.Collection; -import java.util.List; -import java.util.Map; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.crafting.Recipe; -import net.minecraft.world.item.crafting.RecipeHolder; -import net.minecraft.world.item.crafting.RecipeManager; -import net.minecraft.world.item.crafting.RecipeType; - -@Mixin(RecipeManager.class) -public class RecipeManager_scarpetMixin implements RecipeManagerInterface -{ - @Shadow private Multimap, RecipeHolder> byType; - - @Shadow private Map> byName; - - @Override - public List> getAllMatching(RecipeType type, ResourceLocation itemId, RegistryAccess registryAccess) - { - // quiq cheq - RecipeHolder recipe = byName.get(itemId); - if (recipe != null && recipe.value().getType().equals(type)) - { - return List.of(recipe.value()); - } - if (!byType.containsKey(type)) - { - // happens when mods add recipe to the registry without updating recipe manager - return List.of(); - } - Collection> typeRecipes = byType.get(type); - Registry regs = registryAccess.lookupOrThrow(Registries.ITEM); - Item item = regs.getValue(itemId); - if (item == Items.AIR) - { - return List.of(); - } - return typeRecipes.stream() - .>map(RecipeHolder::value) - .filter(r -> r.getResultItem(registryAccess).is(item)) - .toList(); - } -} diff --git a/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java b/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java index 9f75e4ec..e940f70f 100644 --- a/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java +++ b/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java @@ -3,6 +3,7 @@ package carpet.mixins; import carpet.fakes.EntityInterface; import net.minecraft.network.protocol.game.ServerboundChatCommandPacket; import net.minecraft.world.entity.player.Input; +import net.minecraft.world.item.crafting.RecipeManager; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -255,7 +256,11 @@ public class ServerGamePacketListenerImpl_scarpetEventsMixin { if (PLAYER_CHOOSES_RECIPE.isNeeded()) { - if(PLAYER_CHOOSES_RECIPE.onRecipeSelected(player, packet.getRecipe(), packet.isUseMaxItems())) ci.cancel(); + RecipeManager.ServerDisplayInfo displayInfo = player.server.getRecipeManager().getRecipeFromDisplay(packet.recipe()); + if (displayInfo == null) { + return; + } + if(PLAYER_CHOOSES_RECIPE.onRecipeSelected(player, displayInfo.parent().id().location(), packet.useMaxItems())) ci.cancel(); } } diff --git a/src/main/java/carpet/mixins/ServerPlayer_scarpetEventMixin.java b/src/main/java/carpet/mixins/ServerPlayer_scarpetEventMixin.java index 0086150d..2a0e7e49 100644 --- a/src/main/java/carpet/mixins/ServerPlayer_scarpetEventMixin.java +++ b/src/main/java/carpet/mixins/ServerPlayer_scarpetEventMixin.java @@ -14,7 +14,7 @@ import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; -import net.minecraft.world.level.portal.DimensionTransition; +import net.minecraft.world.level.portal.TeleportTransition; import net.minecraft.world.phys.Vec3; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -86,20 +86,20 @@ public abstract class ServerPlayer_scarpetEventMixin extends Player implements S private Vec3 previousLocation; private ResourceKey previousDimension; - @Inject(method = "changeDimension", at = @At("HEAD")) - private void logPreviousCoordinates(DimensionTransition serverWorld, CallbackInfoReturnable cir) + @Inject(method = "teleport", at = @At("HEAD")) + private void logPreviousCoordinates(TeleportTransition serverWorld, CallbackInfoReturnable cir) { previousLocation = position(); previousDimension = level().dimension(); //dimension type } - @Inject(method = "changeDimension", at = @At("RETURN")) - private void atChangeDimension(DimensionTransition destinationP, CallbackInfoReturnable cir) + @Inject(method = "teleport", at = @At("RETURN")) + private void atChangeDimension(TeleportTransition destinationP, CallbackInfoReturnable cir) { if (PLAYER_CHANGES_DIMENSION.isNeeded()) { ServerPlayer player = (ServerPlayer) (Object)this; - DimensionTransition destinationTransition = destinationP; + TeleportTransition destinationTransition = destinationP; ServerLevel destination = destinationTransition.newLevel(); Vec3 to = null; if (!wonGame || previousDimension != Level.END || destination.dimension() != Level.OVERWORLD) diff --git a/src/main/java/carpet/patches/EntityPlayerMPFake.java b/src/main/java/carpet/patches/EntityPlayerMPFake.java index 9cec72ea..f7bbfbe5 100644 --- a/src/main/java/carpet/patches/EntityPlayerMPFake.java +++ b/src/main/java/carpet/patches/EntityPlayerMPFake.java @@ -8,9 +8,9 @@ import net.minecraft.network.DisconnectionDetails; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.contents.TranslatableContents; import net.minecraft.network.protocol.PacketFlow; +import net.minecraft.network.protocol.game.ClientboundEntityPositionSyncPacket; import net.minecraft.network.protocol.game.ClientboundPlayerInfoUpdatePacket; import net.minecraft.network.protocol.game.ClientboundRotateHeadPacket; -import net.minecraft.network.protocol.game.ClientboundTeleportEntityPacket; import net.minecraft.network.protocol.game.ServerboundClientCommandPacket; import net.minecraft.resources.ResourceKey; import net.minecraft.server.MinecraftServer; @@ -31,7 +31,7 @@ import net.minecraft.world.level.GameType; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.SkullBlockEntity; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.portal.DimensionTransition; +import net.minecraft.world.level.portal.TeleportTransition; import net.minecraft.world.phys.Vec3; import carpet.fakes.ServerPlayerInterface; import carpet.utils.Messenger; @@ -84,7 +84,7 @@ public class EntityPlayerMPFake extends ServerPlayer instance.getAttribute(Attributes.STEP_HEIGHT).setBaseValue(0.6F); instance.gameMode.changeGameModeForPlayer(gamemode); server.getPlayerList().broadcastAll(new ClientboundRotateHeadPacket(instance, (byte) (instance.yHeadRot * 256 / 360)), dimensionId);//instance.dimension); - server.getPlayerList().broadcastAll(new ClientboundTeleportEntityPacket(instance), dimensionId);//instance.dimension); + server.getPlayerList().broadcastAll(ClientboundEntityPositionSyncPacket.of(instance), dimensionId);//instance.dimension); //instance.world.getChunkManager(). updatePosition(instance); instance.entityData.set(DATA_PLAYER_MODE_CUSTOMISATION, (byte) 0x7f); // show all model layers (incl. capes) instance.getAbilities().flying = flying; @@ -216,9 +216,9 @@ public class EntityPlayerMPFake extends ServerPlayer } @Override - public Player changeDimension(DimensionTransition serverLevel) + public ServerPlayer teleport(TeleportTransition serverLevel) { - super.changeDimension(serverLevel); + super.teleport(serverLevel); if (wonGame) { ServerboundClientCommandPacket p = new ServerboundClientCommandPacket(ServerboundClientCommandPacket.Action.PERFORM_RESPAWN); connection.handleClientCommand(p); diff --git a/src/main/java/carpet/script/api/Inventories.java b/src/main/java/carpet/script/api/Inventories.java index c7adf517..d1aa2527 100644 --- a/src/main/java/carpet/script/api/Inventories.java +++ b/src/main/java/carpet/script/api/Inventories.java @@ -6,8 +6,8 @@ import carpet.script.argument.FunctionArgument; import carpet.script.exception.InternalExpressionException; import carpet.script.exception.ThrowStatement; import carpet.script.exception.Throwables; -import carpet.script.external.Vanilla; import carpet.script.utils.InputValidator; +import carpet.script.utils.RecipeHelper; import carpet.script.value.BooleanValue; import carpet.script.value.EntityValue; import carpet.script.value.FormattedTextValue; @@ -49,6 +49,7 @@ import net.minecraft.world.item.crafting.RecipeType; import net.minecraft.world.item.crafting.ShapedRecipe; import net.minecraft.world.item.crafting.ShapelessRecipe; import net.minecraft.world.item.crafting.SingleItemRecipe; +import net.minecraft.world.item.crafting.display.SlotDisplay; import net.minecraft.world.phys.Vec3; public class Inventories @@ -103,7 +104,7 @@ public class Inventories throw new InternalExpressionException("'recipe_data' requires at least one argument"); } String recipeName = lv.get(0).getString(); - RecipeType type = RecipeType.CRAFTING; + RecipeType> type = RecipeType.CRAFTING; if (lv.size() > 1) { String recipeType = lv.get(1).getString(); @@ -113,30 +114,44 @@ public class Inventories throw new InternalExpressionException("Unknown recipe type: " + recipeType); } } - List> recipes = Vanilla.RecipeManager_getAllMatching(cc.server().getRecipeManager(), type, InputValidator.identifierOf(recipeName), cc.registryAccess()); + List> recipes = RecipeHelper.getRecipesForOutput(cc.server().getRecipeManager(), type, InputValidator.identifierOf(recipeName), cc.level()); if (recipes.isEmpty()) { return Value.NULL; } List recipesOutput = new ArrayList<>(); RegistryAccess regs = cc.registryAccess(); + SlotDisplay.ResolutionContext context = SlotDisplay.ResolutionContext.forLevel(cc.level()); for (Recipe recipe : recipes) { - ItemStack result = recipe.getResultItem(regs); + List results = new ArrayList<>(); + //ItemStack result = recipe.display().forEach(); getResultItem(regs); + recipe.display().forEach(rd -> rd.result().resolveForStacks(context).forEach(is -> results.add(ValueConversions.of(is, regs)))); + + List ingredientValue = new ArrayList<>(); - recipe.placementInfo().slotInfo().forEach(ingredient -> { - if (ingredient.isEmpty()) + for (Optional info : recipe.placementInfo().slotInfo()) + { + if (info.isEmpty()) { ingredientValue.add(Value.NULL); - return; + continue; } - PlacementInfo.SlotInfo value = ingredient.get(); - int position = value.placerOutputPosition(); + PlacementInfo.SlotInfo value = info.get(); + int ingredientIndex = value.placerOutputPosition(); List alternatives = new ArrayList<>(); - value.possibleItems().stream().map(is -> ValueConversions.of(is, regs)).forEach(alternatives::add); - ingredientValue.add(ListValue.wrap(alternatives)); - }); + recipe.placementInfo().ingredients().get(ingredientIndex).items().forEach(item -> alternatives.add(ValueConversions.of(item.value(), regs))); + if (alternatives.isEmpty()) + { + ingredientValue.add(Value.NULL); + } + else + { + ingredientValue.add(ListValue.wrap(alternatives)); + } + } + Value recipeSpec; if (recipe instanceof ShapedRecipe shapedRecipe) @@ -155,8 +170,8 @@ public class Inventories { recipeSpec = ListValue.of( new StringValue("smelting"), - new NumericValue(abstractCookingRecipe.getCookingTime()), - new NumericValue(abstractCookingRecipe.getExperience()) + new NumericValue(abstractCookingRecipe.cookingTime()), + new NumericValue(abstractCookingRecipe.experience()) ); } else if (recipe instanceof SingleItemRecipe) @@ -172,7 +187,7 @@ public class Inventories recipeSpec = ListValue.of(new StringValue("custom")); } - recipesOutput.add(ListValue.of(ValueConversions.of(result, regs), ListValue.wrap(ingredientValue), recipeSpec)); + recipesOutput.add(ListValue.of(ListValue.wrap(results), ListValue.wrap(ingredientValue), recipeSpec)); } return ListValue.wrap(recipesOutput); }); @@ -181,10 +196,11 @@ public class Inventories { String itemStr = v.get(0).getString(); ResourceLocation id = InputValidator.identifierOf(itemStr); - Registry registry = ((CarpetContext) c).registry(Registries.ITEM); + CarpetContext cc = (CarpetContext) c; + Registry registry = cc.registry(Registries.ITEM); Item item = registry.getOptional(id).orElseThrow(() -> new ThrowStatement(itemStr, Throwables.UNKNOWN_ITEM)); - Item reminder = item.getCraftingRemainingItem(); - return reminder == null ? Value.NULL : NBTSerializableValue.nameFromRegistryId(registry.getKey(reminder)); + ItemStack reminder = item.getCraftingRemainder(); + return reminder.isEmpty() ? Value.NULL : ValueConversions.of(reminder, cc.registryAccess()); }); expression.addContextFunction("inventory_size", -1, (c, t, lv) -> diff --git a/src/main/java/carpet/script/command/CommandArgument.java b/src/main/java/carpet/script/command/CommandArgument.java index f269884d..a4c29a99 100644 --- a/src/main/java/carpet/script/command/CommandArgument.java +++ b/src/main/java/carpet/script/command/CommandArgument.java @@ -55,7 +55,6 @@ import java.util.function.Supplier; import java.util.stream.Collectors; import net.minecraft.ChatFormatting; -import net.minecraft.advancements.AdvancementHolder; import net.minecraft.advancements.critereon.MinMaxBounds; import net.minecraft.commands.CommandBuildContext; import net.minecraft.commands.CommandSourceStack; @@ -204,12 +203,8 @@ public abstract class CommandArgument // resource / identifier section - new VanillaUnconfigurableArgument("recipe", ResourceLocationArgument::id, - (c, p) -> ValueConversions.of(ResourceLocationArgument.getRecipe(c, p).id()), SuggestionProviders.ALL_RECIPES - ), - new VanillaUnconfigurableArgument("advancement", ResourceLocationArgument::id, - (c, p) -> ValueConversions.of(ResourceLocationArgument.getAdvancement(c, p).id()), (ctx, builder) -> SharedSuggestionProvider.suggestResource(ctx.getSource().getServer().getAdvancements().getAllAdvancements().stream().map(AdvancementHolder::id), builder) - ), + new VanillaUnconfigurableArgument("recipe", Registries.RECIPE), + new VanillaUnconfigurableArgument("advancement", Registries.ADVANCEMENT), new VanillaUnconfigurableArgument("lootcondition", ResourceLocationArgument::id, (c, p) -> ValueConversions.of(ResourceLocationArgument.getId(c, p)), (ctx, builder) -> SharedSuggestionProvider.suggestResource(ctx.getSource().getServer().reloadableRegistries().getKeys(Registries.LOOT_CONDITION_TYPE), builder) ), diff --git a/src/main/java/carpet/script/external/Vanilla.java b/src/main/java/carpet/script/external/Vanilla.java index 4ef3e1b5..96ec1a26 100644 --- a/src/main/java/carpet/script/external/Vanilla.java +++ b/src/main/java/carpet/script/external/Vanilla.java @@ -13,13 +13,11 @@ import carpet.fakes.LivingEntityInterface; import carpet.fakes.MinecraftServerInterface; import carpet.fakes.MobEntityInterface; import carpet.fakes.RandomStateVisitorAccessor; -import carpet.fakes.RecipeManagerInterface; import carpet.fakes.AbstractContainerMenuInterface; import carpet.fakes.ServerPlayerInterface; import carpet.fakes.ServerPlayerInteractionManagerInterface; import carpet.fakes.ServerWorldInterface; import carpet.fakes.SpawnHelperInnerInterface; -import carpet.fakes.ThreadedAnvilChunkStorageInterface; import carpet.mixins.Objective_scarpetMixin; import carpet.mixins.PoiRecord_scarpetMixin; import carpet.mixins.Scoreboard_scarpetMixin; @@ -38,10 +36,8 @@ import net.fabricmc.loader.api.ModContainer; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.arguments.blocks.BlockInput; import net.minecraft.core.BlockPos; -import net.minecraft.core.RegistryAccess; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.Tag; -import net.minecraft.resources.ResourceLocation; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ChunkMap; import net.minecraft.server.level.DistanceManager; @@ -62,11 +58,6 @@ import net.minecraft.world.entity.animal.horse.AbstractHorse; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.DataSlot; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.crafting.Ingredient; -import net.minecraft.world.item.crafting.Recipe; -import net.minecraft.world.item.crafting.RecipeManager; -import net.minecraft.world.item.crafting.RecipeType; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.GameRules; import net.minecraft.world.level.NaturalSpawner; @@ -83,7 +74,6 @@ import net.minecraft.world.scores.Objective; import net.minecraft.world.scores.Scoreboard; import net.minecraft.world.scores.criteria.ObjectiveCriteria; -import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -107,11 +97,6 @@ public class Vanilla return Map.of(); //return ((ThreadedAnvilChunkStorageInterface) chunkMap).regenerateChunkRegion(requestedChunks); } - public static List> RecipeManager_getAllMatching(RecipeManager recipeManager, RecipeType type, ResourceLocation output, RegistryAccess registryAccess) - { - return ((RecipeManagerInterface) recipeManager).getAllMatching(type, output, registryAccess); - } - public static int NaturalSpawner_MAGIC_NUMBER() { return SpawnReporter.MAGIC_NUMBER; diff --git a/src/main/java/carpet/script/utils/RecipeHelper.java b/src/main/java/carpet/script/utils/RecipeHelper.java new file mode 100644 index 00000000..c235e84f --- /dev/null +++ b/src/main/java/carpet/script/utils/RecipeHelper.java @@ -0,0 +1,57 @@ +package carpet.script.utils; + +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.crafting.Recipe; +import net.minecraft.world.item.crafting.RecipeManager; +import net.minecraft.world.item.crafting.RecipeType; +import net.minecraft.world.item.crafting.display.RecipeDisplay; +import net.minecraft.world.item.crafting.display.SlotDisplay; +import net.minecraft.world.level.Level; + +import java.util.ArrayList; +import java.util.List; + +public class RecipeHelper +{ + public static List> getRecipesForOutput(RecipeManager recipeManager, RecipeType type, ResourceLocation id, Level level) + { + List> results = new ArrayList<>(); + SlotDisplay.ResolutionContext context = SlotDisplay.ResolutionContext.forLevel(level); + recipeManager.getRecipes().forEach(r -> { + if (r.value().getType() == type) + { + for (RecipeDisplay recipeDisplay : r.value().display()) + { + recipeDisplay.result().resolveForStacks(context).forEach(stack -> { + if (BuiltInRegistries.ITEM.wrapAsHolder(stack.getItem()).unwrapKey().map(ResourceKey::location).orElseThrow(IllegalStateException::new).equals(id)) + { + results.add(r.value()); + } + }); + } + } + }); + return results; + } + + public static List> getRecipesForOutput(RecipeManager recipeManager, ResourceLocation id, Level level) + { + List> results = new ArrayList<>(); + SlotDisplay.ResolutionContext context = SlotDisplay.ResolutionContext.forLevel(level); + recipeManager.getRecipes().forEach(r -> { + for (RecipeDisplay recipeDisplay : r.value().display()) + { + recipeDisplay.result().resolveForStacks(context).forEach(stack -> { + if (BuiltInRegistries.ITEM.wrapAsHolder(stack.getItem()).unwrapKey().map(ResourceKey::location).orElseThrow(IllegalStateException::new).equals(id)) + { + results.add(r.value()); + } + }); + } + + }); + return results; + } +} diff --git a/src/main/java/carpet/script/value/EntityValue.java b/src/main/java/carpet/script/value/EntityValue.java index 6499b0e5..4fbcc5c0 100644 --- a/src/main/java/carpet/script/value/EntityValue.java +++ b/src/main/java/carpet/script/value/EntityValue.java @@ -26,6 +26,8 @@ import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.StringTag; +import net.minecraft.network.protocol.game.ClientboundEntityPositionSyncPacket; +import net.minecraft.network.protocol.game.ClientboundMoveEntityPacket; import net.minecraft.network.protocol.game.ClientboundSetExperiencePacket; import net.minecraft.network.protocol.game.ClientboundSetHeldSlotPacket; import net.minecraft.network.protocol.game.ClientboundSetPassengersPacket; @@ -922,7 +924,7 @@ public class EntityValue extends Value } else { - ((ServerLevel) e.getCommandSenderWorld()).getChunkSource().broadcastAndSend(e, new ClientboundTeleportEntityPacket(e)); + ((ServerLevel) e.getCommandSenderWorld()).getChunkSource().broadcastAndSend(e, ClientboundEntityPositionSyncPacket.of(e)); } } } diff --git a/src/main/java/carpet/script/value/ValueConversions.java b/src/main/java/carpet/script/value/ValueConversions.java index 72a660d7..23c7536e 100644 --- a/src/main/java/carpet/script/value/ValueConversions.java +++ b/src/main/java/carpet/script/value/ValueConversions.java @@ -31,6 +31,7 @@ import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.ai.behavior.PositionTracker; import net.minecraft.world.entity.ai.memory.NearestVisibleLivingEntities; import net.minecraft.world.entity.ai.memory.WalkTarget; +import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; @@ -99,12 +100,17 @@ public class ValueConversions public static Value of(ItemStack stack, RegistryAccess regs) { return stack == null || stack.isEmpty() ? Value.NULL : ListValue.of( - of(regs.lookupOrThrow(Registries.ITEM).getKey(stack.getItem())), + of(stack.getItem(), regs), new NumericValue(stack.getCount()), NBTSerializableValue.fromStack(stack, regs) ); } + public static Value of(Item item, RegistryAccess regs) + { + return of(regs.lookupOrThrow(Registries.ITEM).getKey(item)); + } + public static Value of(Objective objective) { return ListValue.of( diff --git a/src/main/resources/carpet.mixins.json b/src/main/resources/carpet.mixins.json index 0950f49d..dee7b167 100644 --- a/src/main/resources/carpet.mixins.json +++ b/src/main/resources/carpet.mixins.json @@ -151,7 +151,6 @@ "CommandDispatcher_scarpetCommandsMixin", "FoodData_scarpetMixin", - "RecipeManager_scarpetMixin", "BlockInput_scarpetMixin", "BlockPredicate_scarpetMixin", "TagPredicate_scarpetMixin", From 546eff19fae30b9c84cacf7fb5df7036433a148a Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Fri, 4 Oct 2024 20:17:33 +0200 Subject: [PATCH 019/232] 1.4.155 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 84597d12..0aee7ba6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G fabric_version=0.105.1+1.21.2 # Mod Properties - mod_version = 1.4.154 + mod_version = 1.4.155 maven_group = carpet archives_base_name = fabric-carpet From ef8a9fd4a4d501a5ff05aa58b59da7db7dd11a22 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 4 Oct 2024 18:34:12 +0000 Subject: [PATCH 020/232] Merge docs for 'Carpet Mod 1.4.155 for Minecraft 24w40a' --- docs/scarpet/Full.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/docs/scarpet/Full.md b/docs/scarpet/Full.md index 3c70c645..902d3cb1 100644 --- a/docs/scarpet/Full.md +++ b/docs/scarpet/Full.md @@ -4301,8 +4301,8 @@ Recipe type can take one of the following options: * `'smithing'` - smithing table (1.16+) The return value is a list of available recipes (even if there is only one recipe available). Each recipe contains of - an item triple of the crafting result, list of ingredients, each containing a list of possible variants of the - ingredients in this slot, as item triples, or `null` if its a shaped recipe and a given slot in the patterns is left + an item triple of the crafting results as a list of item stacks, list of ingredients, each containing a list of possible variants of the + ingredients in this slot, as item ids, or `null` if it is a shaped recipe and a given slot in the patterns is left empty, and recipe specification as another list. Possible recipe specs is: * `['shaped', width, height]` - shaped crafting. `width` and `height` can be 1, 2 or 3. * `['shapeless']` - shapeless crafting @@ -4310,10 +4310,6 @@ Recipe type can take one of the following options: * `['cutting']` - stonecutter recipe * `['special']` - special crafting recipe, typically not present in the crafting menu * `['custom']` - other recipe types - -Note that ingredients are specified as tripes, with count and nbt information. Currently all recipes require always one -of the ingredients, and for some recipes, even if the nbt data for the ingredient is specified (e.g. `dispenser`), it -can accept items of any tags. Also note that some recipes leave some products in the crafting window, and these can be determined using `crafting_remaining_item()` function @@ -4328,7 +4324,7 @@ Also note that some recipes leave some products in the crafting window, and thes ### `crafting_remaining_item(item)` returns `null` if the item has no remaining item in the crafting window when used as a crafting ingredient, or an -item name that serves as a replacement after crafting is done. Currently it can only be buckets and glass bottles. +item tuple that serves as a replacement after crafting is done. Currently, it can only be buckets and glass bottles. ### `inventory_size(inventory)` From 8acbfa5d90a46217acfd90b09b88a7ce41f6f8e9 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Tue, 8 Oct 2024 21:03:53 +0200 Subject: [PATCH 021/232] 1.21.2-pre1 --- gradle.properties | 2 +- src/main/java/carpet/script/api/Inventories.java | 4 +++- src/main/java/carpet/script/utils/RecipeHelper.java | 10 +++++++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/gradle.properties b/gradle.properties index 0aee7ba6..2a3cc0f6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=24w40a + minecraft_version=1.21.2-pre1 loader_version=0.16.5 jsr305_version=3.0.2 fabric_version=0.105.1+1.21.2 diff --git a/src/main/java/carpet/script/api/Inventories.java b/src/main/java/carpet/script/api/Inventories.java index d1aa2527..1f5b6ea2 100644 --- a/src/main/java/carpet/script/api/Inventories.java +++ b/src/main/java/carpet/script/api/Inventories.java @@ -36,6 +36,7 @@ import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerPlayer; import net.minecraft.tags.TagKey; +import net.minecraft.util.context.ContextMap; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.player.Player; @@ -50,6 +51,7 @@ import net.minecraft.world.item.crafting.ShapedRecipe; import net.minecraft.world.item.crafting.ShapelessRecipe; import net.minecraft.world.item.crafting.SingleItemRecipe; import net.minecraft.world.item.crafting.display.SlotDisplay; +import net.minecraft.world.item.crafting.display.SlotDisplayContext; import net.minecraft.world.phys.Vec3; public class Inventories @@ -121,7 +123,7 @@ public class Inventories } List recipesOutput = new ArrayList<>(); RegistryAccess regs = cc.registryAccess(); - SlotDisplay.ResolutionContext context = SlotDisplay.ResolutionContext.forLevel(cc.level()); + ContextMap context = SlotDisplayContext.fromLevel(cc.level()); for (Recipe recipe : recipes) { List results = new ArrayList<>(); diff --git a/src/main/java/carpet/script/utils/RecipeHelper.java b/src/main/java/carpet/script/utils/RecipeHelper.java index c235e84f..94c484d0 100644 --- a/src/main/java/carpet/script/utils/RecipeHelper.java +++ b/src/main/java/carpet/script/utils/RecipeHelper.java @@ -3,11 +3,12 @@ package carpet.script.utils; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.context.ContextMap; import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.item.crafting.RecipeManager; import net.minecraft.world.item.crafting.RecipeType; import net.minecraft.world.item.crafting.display.RecipeDisplay; -import net.minecraft.world.item.crafting.display.SlotDisplay; +import net.minecraft.world.item.crafting.display.SlotDisplayContext; import net.minecraft.world.level.Level; import java.util.ArrayList; @@ -18,7 +19,9 @@ public class RecipeHelper public static List> getRecipesForOutput(RecipeManager recipeManager, RecipeType type, ResourceLocation id, Level level) { List> results = new ArrayList<>(); - SlotDisplay.ResolutionContext context = SlotDisplay.ResolutionContext.forLevel(level); + + + ContextMap context = SlotDisplayContext.fromLevel(level); recipeManager.getRecipes().forEach(r -> { if (r.value().getType() == type) { @@ -39,7 +42,8 @@ public class RecipeHelper public static List> getRecipesForOutput(RecipeManager recipeManager, ResourceLocation id, Level level) { List> results = new ArrayList<>(); - SlotDisplay.ResolutionContext context = SlotDisplay.ResolutionContext.forLevel(level); + + ContextMap context = SlotDisplayContext.fromLevel(level); recipeManager.getRecipes().forEach(r -> { for (RecipeDisplay recipeDisplay : r.value().display()) { From aa8ebc9c130c223923a7979ea37a6d05b268769f Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Tue, 8 Oct 2024 21:04:50 +0200 Subject: [PATCH 022/232] 1.4.156 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 2a3cc0f6..584903a3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G fabric_version=0.105.1+1.21.2 # Mod Properties - mod_version = 1.4.155 + mod_version = 1.4.156 maven_group = carpet archives_base_name = fabric-carpet From 9e75c3691410dda1cc0580f9c929378c013534e4 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Mon, 14 Oct 2024 15:13:42 +0200 Subject: [PATCH 023/232] 1.21.2-pre3 --- gradle.properties | 2 +- src/main/java/carpet/mixins/LevelChunk_movableBEMixin.java | 3 ++- src/main/java/carpet/script/api/WorldAccess.java | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index 584903a3..32c23882 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=1.21.2-pre1 + minecraft_version=1.21.2-pre3 loader_version=0.16.5 jsr305_version=3.0.2 fabric_version=0.105.1+1.21.2 diff --git a/src/main/java/carpet/mixins/LevelChunk_movableBEMixin.java b/src/main/java/carpet/mixins/LevelChunk_movableBEMixin.java index 9ea44301..77a099a1 100644 --- a/src/main/java/carpet/mixins/LevelChunk_movableBEMixin.java +++ b/src/main/java/carpet/mixins/LevelChunk_movableBEMixin.java @@ -72,6 +72,7 @@ public abstract class LevelChunk_movableBEMixin extends ChunkAccess implements W */ /* @Nullable */ // todo update me to the new version + @Override public BlockState setBlockStateWithBlockEntity(BlockPos blockPos_1, BlockState newBlockState, BlockEntity newBlockEntity, boolean boolean_1) { @@ -154,7 +155,7 @@ public abstract class LevelChunk_movableBEMixin extends ChunkAccess implements W newBlockState.onPlace(this.level, blockPos_1, oldBlockState, boolean_1); //This can call setblockstate! (e.g. hopper does) } - this.unsaved = true; // shouldSave + markUnsaved(); return oldBlockState; } } diff --git a/src/main/java/carpet/script/api/WorldAccess.java b/src/main/java/carpet/script/api/WorldAccess.java index 54aa7adc..1e9aa470 100644 --- a/src/main/java/carpet/script/api/WorldAccess.java +++ b/src/main/java/carpet/script/api/WorldAccess.java @@ -1363,7 +1363,7 @@ public class WorldAccess { WorldTools.forceChunkUpdate(pos, world); } - chunk.setUnsaved(true); + chunk.markUnsaved(); return Value.TRUE; }); From 814e96e5cfec92b0c6d8ef472bd1654cfa694feb Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Mon, 14 Oct 2024 15:14:36 +0200 Subject: [PATCH 024/232] 1.4.157 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 32c23882..0922f485 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G fabric_version=0.105.1+1.21.2 # Mod Properties - mod_version = 1.4.156 + mod_version = 1.4.157 maven_group = carpet archives_base_name = fabric-carpet From e9ee1eff89ca204368677020cfaadf1d6205f593 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Thu, 17 Oct 2024 18:29:03 +0200 Subject: [PATCH 025/232] 1.21.2-rc1 --- gradle.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index 0922f485..90c68673 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,10 +3,10 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=1.21.2-pre3 - loader_version=0.16.5 + minecraft_version=1.21.2-rc1 + loader_version=0.16.7 jsr305_version=3.0.2 - fabric_version=0.105.1+1.21.2 + fabric_version=0.106.0+1.21.2 # Mod Properties mod_version = 1.4.157 From 066b629abe6a012701af6c429feaa839cc01edba Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Tue, 22 Oct 2024 21:25:12 +0200 Subject: [PATCH 026/232] 1.21.2 noop --- gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 90c68673..95c59ae6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=1.21.2-rc1 + minecraft_version=1.21.2 loader_version=0.16.7 jsr305_version=3.0.2 fabric_version=0.106.0+1.21.2 @@ -17,7 +17,7 @@ org.gradle.jvmargs=-Xmx1G # The Curseforge versions "names" or ids for the main branch (comma separated: 1.16.4,1.16.5) # This is needed because CF uses too vague names for prereleases and release candidates # Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN] - release-curse-versions = Minecraft 1.21.2:1.21.2-Snapshot + release-curse-versions = Minecraft 1.21:1.21.2 # Whether or not to build another branch on release release-extra-branch = false # The name of the second branch to release From aea914430a1688af5f97d4f813393e51b43f1d1e Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Tue, 22 Oct 2024 21:25:24 +0200 Subject: [PATCH 027/232] 1.4.158 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 95c59ae6..84e52b0b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G fabric_version=0.106.0+1.21.2 # Mod Properties - mod_version = 1.4.157 + mod_version = 1.4.158 maven_group = carpet archives_base_name = fabric-carpet From 0bf2b5b862c1e45aea50e1567f1e65a918b47501 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Wed, 30 Oct 2024 23:16:13 +0100 Subject: [PATCH 028/232] 24w44a --- docs/scarpet/api/BlocksAndWorldAccess.md | 2 +- gradle.properties | 4 +-- .../java/carpet/helpers/ParticleDisplay.java | 4 +-- .../mixins/Explosion_optimizedTntMixin.java | 4 +-- .../LevelRenderer_scarpetRenderMixin.java | 2 +- .../java/carpet/script/api/Auxiliary.java | 4 +-- .../java/carpet/script/api/WorldAccess.java | 6 ++--- .../carpet/script/utils/FeatureGenerator.java | 4 +-- .../carpet/script/utils/ShapeDispatcher.java | 26 +++++++++---------- 9 files changed, 28 insertions(+), 28 deletions(-) diff --git a/docs/scarpet/api/BlocksAndWorldAccess.md b/docs/scarpet/api/BlocksAndWorldAccess.md index d3f3c10a..a2715a57 100644 --- a/docs/scarpet/api/BlocksAndWorldAccess.md +++ b/docs/scarpet/api/BlocksAndWorldAccess.md @@ -625,7 +625,7 @@ It returns a `map` with a report indicating how many chunks were affected, and h Adds a chunk ticket at a position, which makes the game to keep the designated area centered around `pos` with radius of `radius` loaded for a predefined amount of ticks, defined by `type`. Allowed types -are `portal`: 300 ticks, `teleport`: 5 ticks, and `unknown`: 1 tick. Radius can be from 1 to 32 ticks. +are `portal`: 300 ticks, `teleport`: 40 ticks, and `unknown`: 1 tick. Radius can be from 1 to 32 ticks. This function is tentative - will likely change when chunk ticket API is properly fleshed out. diff --git a/gradle.properties b/gradle.properties index 84e52b0b..36efe1f3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=1.21.2 + minecraft_version=24w44a loader_version=0.16.7 jsr305_version=3.0.2 fabric_version=0.106.0+1.21.2 @@ -17,7 +17,7 @@ org.gradle.jvmargs=-Xmx1G # The Curseforge versions "names" or ids for the main branch (comma separated: 1.16.4,1.16.5) # This is needed because CF uses too vague names for prereleases and release candidates # Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN] - release-curse-versions = Minecraft 1.21:1.21.2 + release-curse-versions = Minecraft 1.22:1.22.0-Snapshot # Whether or not to build another branch on release release-extra-branch = false # The name of the second branch to release diff --git a/src/main/java/carpet/helpers/ParticleDisplay.java b/src/main/java/carpet/helpers/ParticleDisplay.java index 0184375c..733c06ac 100644 --- a/src/main/java/carpet/helpers/ParticleDisplay.java +++ b/src/main/java/carpet/helpers/ParticleDisplay.java @@ -18,7 +18,7 @@ public class ParticleDisplay if (accentParticle != null) player.serverLevel().sendParticles( player, accentParticle, - true, + true, true, to.x, to.y, to.z, count, spread, spread, spread, 0.0); @@ -33,7 +33,7 @@ public class ParticleDisplay player.serverLevel().sendParticles( player, mainParticle, - true, + true, true, delta.x+from.x, delta.y+from.y, delta.z+from.z, 1, 0.0, 0.0, 0.0, 0.0); } diff --git a/src/main/java/carpet/mixins/Explosion_optimizedTntMixin.java b/src/main/java/carpet/mixins/Explosion_optimizedTntMixin.java index dadd8465..43d38cb1 100644 --- a/src/main/java/carpet/mixins/Explosion_optimizedTntMixin.java +++ b/src/main/java/carpet/mixins/Explosion_optimizedTntMixin.java @@ -86,12 +86,12 @@ public abstract class Explosion_optimizedTntMixin } @Redirect(method = "hurtEntities", - at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/Entity;setDeltaMovement(Lnet/minecraft/world/phys/Vec3;)V")) + at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/Entity;push(Lnet/minecraft/world/phys/Vec3;)V")) private void setVelocityAndUpdateLogging(Entity entity, Vec3 velocity) { if (eLogger != null) { eLogger.onEntityImpacted(entity, velocity.subtract(entity.getDeltaMovement())); } - entity.setDeltaMovement(velocity); + entity.push(velocity); } } diff --git a/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java b/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java index 9672f485..4b1f4063 100644 --- a/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java +++ b/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java @@ -32,7 +32,7 @@ public class LevelRenderer_scarpetRenderMixin } @Inject(method = "addParticlesPass", at = @At("RETURN")) - private void renderScarpetThingsLate(FrameGraphBuilder frameGraphBuilder, Camera camera, LightTexture lightTexture, float f, FogParameters fogParameters, CallbackInfo ci) + private void renderScarpetThingsLate(FrameGraphBuilder frameGraphBuilder, Camera camera, float f, FogParameters fogParameters, CallbackInfo ci) { // in normal circumstances we want to render shapes at the very end so it appears correctly behind stuff. // we might actually not need to play with render hooks here. diff --git a/src/main/java/carpet/script/api/Auxiliary.java b/src/main/java/carpet/script/api/Auxiliary.java index 4cb8f5d8..b5b5e9c9 100644 --- a/src/main/java/carpet/script/api/Auxiliary.java +++ b/src/main/java/carpet/script/api/Auxiliary.java @@ -208,14 +208,14 @@ public class Auxiliary { for (ServerPlayer p : (world.players())) { - world.sendParticles(p, particle, true, vec.x, vec.y, vec.z, count, + world.sendParticles(p, particle, true, true, vec.x, vec.y, vec.z, count, spread, spread, spread, speed); } } else { world.sendParticles(player, - particle, true, vec.x, vec.y, vec.z, count, + particle, true, true, vec.x, vec.y, vec.z, count, spread, spread, spread, speed); } diff --git a/src/main/java/carpet/script/api/WorldAccess.java b/src/main/java/carpet/script/api/WorldAccess.java index 1e9aa470..4144d325 100644 --- a/src/main/java/carpet/script/api/WorldAccess.java +++ b/src/main/java/carpet/script/api/WorldAccess.java @@ -151,7 +151,7 @@ public class WorldAccess private static final Map> ticketTypes = Map.of( "portal", TicketType.PORTAL, - "teleport", TicketType.POST_TELEPORT, + "teleport", TicketType.ENDER_PEARL, "unknown", TicketType.UNKNOWN ); // dummy entity for dummy requirements in the loot tables (see snowball) @@ -1694,9 +1694,9 @@ public class WorldAccess { cc.level().getChunkSource().addRegionTicket(TicketType.PORTAL, target, radius, pos); } - else if (ticket == TicketType.POST_TELEPORT) // post teleport + else if (ticket == TicketType.ENDER_PEARL) // post teleport { - cc.level().getChunkSource().addRegionTicket(TicketType.POST_TELEPORT, target, radius, 1); + cc.level().getChunkSource().addRegionTicket(TicketType.ENDER_PEARL, target, radius, target); } else { diff --git a/src/main/java/carpet/script/utils/FeatureGenerator.java b/src/main/java/carpet/script/utils/FeatureGenerator.java index a686543e..79a5e766 100644 --- a/src/main/java/carpet/script/utils/FeatureGenerator.java +++ b/src/main/java/carpet/script/utils/FeatureGenerator.java @@ -261,7 +261,7 @@ public class FeatureGenerator } else { - StructureStart filledStructure = structure.generate( + StructureStart filledStructure = structure.generate(Holder.direct(structure), world.dimension(), world.registryAccess(), generator, generator.getBiomeSource(), seed, world.getStructureManager(), world.getSeed(), chunkPos, 0, world, structureBiomes::contains); if (filledStructure != null && filledStructure.isValid()) @@ -418,7 +418,7 @@ public class FeatureGenerator checks.set(true); try { - StructureStart start = structure.generate(world.registryAccess(), generator, generator.getBiomeSource(), world.getChunkSource().randomState(), world.getStructureManager(), world.getSeed(), new ChunkPos(pos), 0, world, b -> true); + StructureStart start = structure.generate(Holder.direct(structure), world.dimension(), world.registryAccess(), generator, generator.getBiomeSource(), world.getChunkSource().randomState(), world.getStructureManager(), world.getSeed(), new ChunkPos(pos), 0, world, b -> true); if (start == StructureStart.INVALID_START) { return false; diff --git a/src/main/java/carpet/script/utils/ShapeDispatcher.java b/src/main/java/carpet/script/utils/ShapeDispatcher.java index 0f96aa6b..928ec396 100644 --- a/src/main/java/carpet/script/utils/ShapeDispatcher.java +++ b/src/main/java/carpet/script/utils/ShapeDispatcher.java @@ -775,7 +775,7 @@ public class ShapeDispatcher } Vec3 v = relativiseRender(p.level(), this.pos, 0); - p.serverLevel().sendParticles(p, particle, true, v.x, v.y, v.z, 1, 0.0, 0.0, 0.0, 0.0); + p.serverLevel().sendParticles(p, particle, true, true, v.x, v.y, v.z, 1, 0.0, 0.0, 0.0, 0.0); }; } @@ -1070,7 +1070,7 @@ public class ShapeDispatcher ParticleOptions locparticledata = getParticleData(String.format(Locale.ROOT, "dust %.1f %.1f %.1f %.1f", fr, fg, fb, fa), p.level().registryAccess()); for (Vec3 v : getAlterPoint(p)) { - p.serverLevel().sendParticles(p, locparticledata, true, + p.serverLevel().sendParticles(p, locparticledata, true, true, v.x, v.y, v.z, 1, 0.0, 0.0, 0.0, 0.0); } @@ -1297,7 +1297,7 @@ public class ShapeDispatcher double x = radius * Mth.cos(theta) * Mth.cos(phi); double y = radius * Mth.cos(theta) * Mth.sin(phi); double z = radius * Mth.sin(theta); - world.sendParticles(p, particle, true, + world.sendParticles(p, particle, true, true, x + ccx, y + ccy, z + ccz, 1, 0.0, 0.0, 0.0, 0.0); } @@ -1395,7 +1395,7 @@ public class ShapeDispatcher double x = radius * Mth.cos(phi); double y = d; double z = radius * Mth.sin(phi); - world.sendParticles(p, particle, true, x + ccx, y + ccy, z + ccz, 1, 0.0, 0.0, 0.0, 0.0); + world.sendParticles(p, particle, true, true,x + ccx, y + ccy, z + ccz, 1, 0.0, 0.0, 0.0, 0.0); } } else if (axis == Direction.Axis.X) @@ -1407,7 +1407,7 @@ public class ShapeDispatcher double x = d; double y = radius * Mth.cos(phi); double z = radius * Mth.sin(phi); - world.sendParticles(p, particle, true, x + ccx, y + ccy, z + ccz, 1, 0.0, 0.0, 0.0, 0.0); + world.sendParticles(p, particle, true, true, x + ccx, y + ccy, z + ccz, 1, 0.0, 0.0, 0.0, 0.0); } } else // Z @@ -1419,7 +1419,7 @@ public class ShapeDispatcher double x = radius * Mth.sin(phi); double y = radius * Mth.cos(phi); double z = d; - world.sendParticles(p, particle, true, x + ccx, y + ccy, z + ccz, 1, 0.0, 0.0, 0.0, 0.0); + world.sendParticles(p, particle, true, true, x + ccx, y + ccy, z + ccz, 1, 0.0, 0.0, 0.0, 0.0); } } }; @@ -2184,12 +2184,12 @@ public class ShapeDispatcher for (ServerPlayer player : playerList) { ServerLevel world = player.serverLevel(); - world.sendParticles(player, particle, true, + world.sendParticles(player, particle, true, true, (towards.x) / 2 + from.x, (towards.y) / 2 + from.y, (towards.z) / 2 + from.z, particles / 3, towards.x / 6, towards.y / 6, towards.z / 6, 0.0); - world.sendParticles(player, particle, true, + world.sendParticles(player, particle, true, true, from.x, from.y, from.z, 1, 0.0, 0.0, 0.0, 0.0); - world.sendParticles(player, particle, true, + world.sendParticles(player, particle, true, true, to.x, to.y, to.z, 1, 0.0, 0.0, 0.0, 0.0); parts += particles / 3 + 2; } @@ -2201,10 +2201,10 @@ public class ShapeDispatcher for (ServerPlayer player : playerList) { ServerLevel world = player.serverLevel(); - world.sendParticles(player, particle, true, + world.sendParticles(player, particle, true, true, (towards.x) / center + from.x, (towards.y) / center + from.y, (towards.z) / center + from.z, particles / divider, towards.x / dev, towards.y / dev, towards.z / dev, 0.0); - world.sendParticles(player, particle, true, + world.sendParticles(player, particle, true, true, (towards.x) * (1.0 - 1.0 / center) + from.x, (towards.y) * (1.0 - 1.0 / center) + from.y, (towards.z) * (1.0 - 1.0 / center) + from.z, particles / divider, towards.x / dev, towards.y / dev, towards.z / dev, 0.0); } @@ -2232,7 +2232,7 @@ public class ShapeDispatcher Vec3 at = from.add(towards.scale(rand.nextDouble())); for (ServerPlayer player : players) { - player.serverLevel().sendParticles(player, particle, true, + player.serverLevel().sendParticles(player, particle, true, true, at.x, at.y, at.z, 1, 0.0, 0.0, 0.0, 0.0); pcount++; @@ -2253,7 +2253,7 @@ public class ShapeDispatcher { for (ServerPlayer player : players) { - player.serverLevel().sendParticles(player, particle, true, + player.serverLevel().sendParticles(player, particle, true, true, delta.x + from.x, delta.y + from.y, delta.z + from.z, 1, 0.0, 0.0, 0.0, 0.0); pcount++; From 0f6ee18575dfcc487685a48a5040a3dd19be54f9 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Wed, 30 Oct 2024 23:17:19 +0100 Subject: [PATCH 029/232] 1.4.159 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 36efe1f3..cf6947e1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G fabric_version=0.106.0+1.21.2 # Mod Properties - mod_version = 1.4.158 + mod_version = 1.4.159 maven_group = carpet archives_base_name = fabric-carpet From 24ab04019bcd0f7d2d7382c8954fd9e75a36dd61 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 30 Oct 2024 22:24:35 +0000 Subject: [PATCH 030/232] Merge docs for 'Carpet Mod 1.4.159 for Minecraft 24w44a' --- docs/scarpet/Full.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/scarpet/Full.md b/docs/scarpet/Full.md index 902d3cb1..625cd99c 100644 --- a/docs/scarpet/Full.md +++ b/docs/scarpet/Full.md @@ -2954,7 +2954,7 @@ It returns a `map` with a report indicating how many chunks were affected, and h Adds a chunk ticket at a position, which makes the game to keep the designated area centered around `pos` with radius of `radius` loaded for a predefined amount of ticks, defined by `type`. Allowed types -are `portal`: 300 ticks, `teleport`: 5 ticks, and `unknown`: 1 tick. Radius can be from 1 to 32 ticks. +are `portal`: 300 ticks, `teleport`: 40 ticks, and `unknown`: 1 tick. Radius can be from 1 to 32 ticks. This function is tentative - will likely change when chunk ticket API is properly fleshed out. From e7d30ccf7c8b728552bdfd39498fa2985c67a8f3 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Wed, 13 Nov 2024 23:20:39 +0100 Subject: [PATCH 031/232] 24w46a --- gradle.properties | 2 +- src/main/java/carpet/helpers/HopperCounter.java | 10 ++++------ src/main/java/carpet/script/api/Inventories.java | 7 +++---- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/gradle.properties b/gradle.properties index cf6947e1..2af372fc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=24w44a + minecraft_version=24w46a loader_version=0.16.7 jsr305_version=3.0.2 fabric_version=0.106.0+1.21.2 diff --git a/src/main/java/carpet/helpers/HopperCounter.java b/src/main/java/carpet/helpers/HopperCounter.java index 46af906e..3fc8ca68 100644 --- a/src/main/java/carpet/helpers/HopperCounter.java +++ b/src/main/java/carpet/helpers/HopperCounter.java @@ -37,6 +37,7 @@ import java.util.EnumMap; import java.util.List; import java.util.Locale; import java.util.Map; +import java.util.Optional; import java.util.stream.Collectors; import static java.util.Map.entry; @@ -420,13 +421,10 @@ public class HopperCounter { for (Ingredient ingredient : r.placementInfo().ingredients()) { - for (Holder stack : ingredient.items()) + Optional> match = ingredient.items().filter(stack -> fromItem(stack.value(), registryAccess) != null).findFirst(); + if (match.isPresent()) { - TextColor cand = fromItem(stack.value(), registryAccess); - if (cand != null) - { - return cand; - } + return fromItem(match.get().value(), registryAccess); } } } diff --git a/src/main/java/carpet/script/api/Inventories.java b/src/main/java/carpet/script/api/Inventories.java index 1f5b6ea2..e7b45930 100644 --- a/src/main/java/carpet/script/api/Inventories.java +++ b/src/main/java/carpet/script/api/Inventories.java @@ -132,15 +132,14 @@ public class Inventories List ingredientValue = new ArrayList<>(); - for (Optional info : recipe.placementInfo().slotInfo()) + for (int info : recipe.placementInfo().slotsToIngredientIndex()) { - if (info.isEmpty()) + if (info == PlacementInfo.EMPTY_SLOT) { ingredientValue.add(Value.NULL); continue; } - PlacementInfo.SlotInfo value = info.get(); - int ingredientIndex = value.placerOutputPosition(); + int ingredientIndex = info; List alternatives = new ArrayList<>(); recipe.placementInfo().ingredients().get(ingredientIndex).items().forEach(item -> alternatives.add(ValueConversions.of(item.value(), regs))); From a178129e9561d425fbacba13e7fec86a3bf63c2c Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Wed, 13 Nov 2024 23:21:18 +0100 Subject: [PATCH 032/232] 1.4.160 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 2af372fc..1e04fc97 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G fabric_version=0.106.0+1.21.2 # Mod Properties - mod_version = 1.4.159 + mod_version = 1.4.160 maven_group = carpet archives_base_name = fabric-carpet From a83d04e912943df8c4e0847a6c98641a73d2ee2a Mon Sep 17 00:00:00 2001 From: senseiwells Date: Thu, 1 Aug 2024 17:07:30 +0100 Subject: [PATCH 033/232] Fixes #1958 --- .../java/carpet/commands/PlayerCommand.java | 5 ++++ .../carpet/patches/EntityPlayerMPFake.java | 24 ++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/main/java/carpet/commands/PlayerCommand.java b/src/main/java/carpet/commands/PlayerCommand.java index ee25a48d..86753a98 100644 --- a/src/main/java/carpet/commands/PlayerCommand.java +++ b/src/main/java/carpet/commands/PlayerCommand.java @@ -190,6 +190,11 @@ public class PlayerCommand MinecraftServer server = context.getSource().getServer(); PlayerList manager = server.getPlayerList(); + if (EntityPlayerMPFake.isSpawningPlayer(playerName)) + { + Messenger.m(context.getSource(), "r Player ", "rb " + playerName, "r is currently logging on"); + return true; + } if (manager.getPlayerByName(playerName) != null) { Messenger.m(context.getSource(), "r Player ", "rb " + playerName, "r is already logged on"); diff --git a/src/main/java/carpet/patches/EntityPlayerMPFake.java b/src/main/java/carpet/patches/EntityPlayerMPFake.java index f7bbfbe5..271b8e62 100644 --- a/src/main/java/carpet/patches/EntityPlayerMPFake.java +++ b/src/main/java/carpet/patches/EntityPlayerMPFake.java @@ -36,6 +36,7 @@ import net.minecraft.world.phys.Vec3; import carpet.fakes.ServerPlayerInterface; import carpet.utils.Messenger; +import java.util.HashSet; import java.util.Optional; import java.util.Set; import java.util.concurrent.CompletableFuture; @@ -43,6 +44,8 @@ import java.util.concurrent.CompletableFuture; @SuppressWarnings("EntityConstructor") public class EntityPlayerMPFake extends ServerPlayer { + private static final Set spawning = new HashSet<>(); + public Runnable fixStartingPosition = () -> {}; public boolean isAShadow; @@ -69,7 +72,21 @@ public class EntityPlayerMPFake extends ServerPlayer } } GameProfile finalGP = gameprofile; - fetchGameProfile(gameprofile.getName()).thenAcceptAsync(p -> { + + // We need to mark this player as spawning so that we do not + // try to spawn another player with the name while the profile + // is being fetched - preventing multiple players spawning + String name = gameprofile.getName(); + spawning.add(name); + + fetchGameProfile(name).whenCompleteAsync((p, t) -> { + // Always remove the name, even if exception occurs + spawning.remove(name); + if (t != null) + { + return; + } + GameProfile current = finalGP; if (p.isPresent()) { @@ -127,6 +144,11 @@ public class EntityPlayerMPFake extends ServerPlayer return new EntityPlayerMPFake(server, level, profile, cli, false); } + public static boolean isSpawningPlayer(String username) + { + return spawning.contains(username); + } + private EntityPlayerMPFake(MinecraftServer server, ServerLevel worldIn, GameProfile profile, ClientInformation cli, boolean shadow) { super(server, worldIn, profile, cli); From 1f9a1e4a592f424118fa7da5b62347099df688d6 Mon Sep 17 00:00:00 2001 From: Nachito Date: Sat, 3 Feb 2024 18:52:30 -0300 Subject: [PATCH 034/232] Add Spanish Language and Readme --- README-ES.md | 65 +++ README.md | 2 + src/main/java/carpet/CarpetSettings.java | 2 +- .../resources/assets/carpet/lang/es_ar.json | 432 ++++++++++++++++++ 4 files changed, 500 insertions(+), 1 deletion(-) create mode 100644 README-ES.md create mode 100644 src/main/resources/assets/carpet/lang/es_ar.json diff --git a/README-ES.md b/README-ES.md new file mode 100644 index 00000000..3223ddfb --- /dev/null +++ b/README-ES.md @@ -0,0 +1,65 @@ + + +# Fabric Carpet + +[![Development Builds](https://github.com/gnembon/fabric-carpet/actions/workflows/devbuild.yml/badge.svg)](https://github.com/gnembon/fabric-carpet/actions/workflows/devbuild.yml) +[![CurseForge downloads](http://cf.way2muchnoise.eu/full_349239_downloads.svg)](https://www.curseforge.com/minecraft/mc-mods/carpet) +[![Modrinth downloads](https://img.shields.io/modrinth/dt/carpet?label=Modrinth%20downloads&logo=modrinth)](https://modrinth.com/mod/carpet) +[![GitHub downloads](https://img.shields.io/github/downloads/gnembon/fabric-carpet/total?label=Github%20downloads&logo=github)](https://github.com/gnembon/fabric-carpet/releases) +[![GitHub contributors](https://img.shields.io/github/contributors/gnembon/fabric-carpet?label=Contributors&logo=github)](https://github.com/gnembon/fabric-carpet/graphs/contributors) +[![Discord](https://badgen.net/discord/online-members/gn99m4QRY4?icon=discord&label=Discord&list=what)](https://discord.gg/gn99m4QRY4) + +English version of this [docs](https://github.com/gnembon/fabric-carpet/blob/master/README.md) + +Cause all carpets are made of fabric? +Esto es la [Fabric](https://fabricmc.net/) version del Carpet Mod, para Minecraft 1.14.X, 1.15.X, 1.16.X y siguientes. + +Carpet Mod es un mod para Minecraft Vanilla que permite tener un control total de lo que importa desde la perspectiva tecnica del juego. + +* Prueba tus granjas durante varias horas en tan solo unos minutos con el comando [`/tick warp`](https://github.com/gnembon/fabric-carpet/wiki/Commands#usage-tick-warp-ticks-cmd), tan rapido como tu computadora pueda +* ...da un informe detallado de los items producido usando el comando [`hopperCounters`](https://github.com/gnembon/fabric-carpet/wiki/Current-Available-Settings#hoppercounters) +* Ve la mobcap del server, TPS, etc. con actualizaciones en vivo con [`/log`](https://github.com/gnembon/fabric-carpet/wiki/Commands#log) +* Permite a los pistones mover entidades (por ejemplo. cofres) con [`movableBlockEntities`](https://github.com/gnembon/fabric-carpet/wiki/Current-Available-Settings#movableblockentities) +* [Arregla](https://github.com/gnembon/fabric-carpet/wiki/Current-Available-Settings#leadfix) [muchas](https://github.com/gnembon/fabric-carpet/wiki/Current-Available-Settings#portalsuffocationfix) [cosas](https://github.com/gnembon/fabric-carpet/wiki/Current-Available-Settings#unloadedentityfix) + +# ecosistema de Carpet + +Para funcionalidades del ecosistema de carpet este el lugar correcto. Ve las descargas disponibles en [pagina de descargas](https://github.com/gnembon/fabric-carpet/releases) + + + + +## carpet-extra + +Mira [carpet-extra](https://github.com/gnembon/carpet-extra/) addon mod para mas locas y divertidas funcionalidades, incluyendo mesas de crafteo automaticas, dispensers que ponen bloques, hasta trasquilado de pollos! + +## mesa de crafteo automatica + +Debido a problemas de compatibildias con vanilla y otros mods, descarga [mesa de crafteo automatica](https://github.com/gnembon/carpet-autoCraftingTable/releases) por Skyrising como un addon separado para carpet + +## scarpet app store + +Si quieres buscar o contribuir a las app store de scarpet mira las aplicaciones disponibles, ve[aqui](https://github.com/gnembon/scarpet), es gratis! + +## quick-carpet + +Tienes problemas con las snapshots recientes recientes o alguien necesita la version base de carpet?, pero necesita algunas funcionalidades bases de carpet?, checkea la version minima de [quick-carpet](https://github.com/gnembon/quick-carpet/releases). Va a funcionar bien, no vas a poder agregar extensiones o usar apps de scarpet en este por cierto. + +## Otras extensiones hechas por la comunidad para carpet + +Aqui hay una [lista de otras extensiones de carpet](https://github.com/gnembon/fabric-carpet/wiki/List-of-Carpet-extensions) creadas por la comunidad. + +Cualquiera puede crear sus propias opciones de carpeta o extender el lenguaje scarpet con una nueva API, creando una extension de carpet usando esto [extension de carpet plantilla](https://github.com/gnembon/fabric-carpet-extension-example-mod). + +# Como? Que? + +Mira las instrucciones para los mods de carpeta https://fabricmc.net/use/ y pon [carpet...jar](https://github.com/gnembon/fabric-carpet/releases) en la carpeta `mods` junto a los otros mods compatibles. + +Mira la [demostracion de mods](https://www.youtube.com/watch?v=Lt-ooRGpLz4) en youtube para la explicación de cada uno de las opciones y comandos, y checkea la lista de todas las opciones disponibles en la wiki por una lista actualizada de cada opcion. + +# Carpet Mod Settings +Mira la lista [Lista de todas las configuraciones disponibles][settings] en la wiki + +[settings]: https://github.com/gnembon/fabric-carpet/wiki/Current-Available-Settings + +Para versiones anteriores de Minecraft: 1.13 checkea [gnembon/carpetmod](https://github.com/gnembon/carpetmod) y para 1.12 checkea [gnembon/carpetmod112](https://github.com/gnembon/carpetmod112). diff --git a/README.md b/README.md index e4a03ab8..0b835290 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,8 @@ [![GitHub contributors](https://img.shields.io/github/contributors/gnembon/fabric-carpet?label=Contributors&logo=github)](https://github.com/gnembon/fabric-carpet/graphs/contributors) [![Discord](https://badgen.net/discord/online-members/gn99m4QRY4?icon=discord&label=Discord&list=what)](https://discord.gg/gn99m4QRY4) +Version en español de esta [documentacion](https://github.com/gnembon/fabric-carpet/blob/master/README-ES.md) + Cause all carpets are made of fabric? This is the [Fabric](https://fabricmc.net/) version of Carpet Mod, for Minecraft 1.14.X, 1.15.X, 1.16.X and above. diff --git a/src/main/java/carpet/CarpetSettings.java b/src/main/java/carpet/CarpetSettings.java index c126752f..338d1e0b 100644 --- a/src/main/java/carpet/CarpetSettings.java +++ b/src/main/java/carpet/CarpetSettings.java @@ -73,7 +73,7 @@ public class CarpetSettings @Rule( desc = "Sets the language for Carpet", category = FEATURE, - options = {"en_us", "fr_fr", "pt_br", "zh_cn", "zh_tw"}, + options = {"en_us", "fr_fr", "es_ar","pt_br", "zh_cn", "zh_tw"}, strict = true, // the current system doesn't handle fallbacks and other, not defined languages would make unreadable mess. Change later validate = LanguageValidator.class ) diff --git a/src/main/resources/assets/carpet/lang/es_ar.json b/src/main/resources/assets/carpet/lang/es_ar.json new file mode 100644 index 00000000..28abc299 --- /dev/null +++ b/src/main/resources/assets/carpet/lang/es_ar.json @@ -0,0 +1,432 @@ +{ + // Settings command UI elements + + "carpet.settings.command.browse_categories": "Buscar categorias", + "carpet.settings.command.version": "Version", + "carpet.settings.command.list_all_category": "Lista de todas las configuraciones de %s", + "carpet.settings.command.current_settings_header": "Configuraciones actuales de %s", + "carpet.settings.command.switch_to": "Alternar a %s", + "carpet.settings.command.unknown_rule": "Regla desconocida", + "carpet.settings.command.current_from_file_header": "Configuraciones de inicio actual de %s de %s", + "carpet.settings.command.mod_settings_matching": "%s configuraciones correspondientes \"%s\" ", + "carpet.settings.command.all_mod_settings": "Todas las configuraciones de %s", + "carpet.settings.command.tags": "Tags", + "carpet.settings.command.change_permanently": "Cambiar permanentemente", + "carpet.settings.command.change_permanently_tooltip": "Haz click para mantener las configuraciones en %s para que sea permanente.", + "carpet.settings.command.default_set": "La regla %s ahora se establecerá como %s ", + "carpet.settings.command.default_removed": "La regla %s ya no se establecerá al inicio", + "carpet.settings.command.current_value": "Valor actual", + + // Categories + + "carpet.category.bugfix": "Arreglo de Bugs", + "carpet.category.survival": "Supervivencia", + "carpet.category.creative": "Creativo", + "carpet.category.experimental": "Experimental", + "carpet.category.optimization": "Optimizacion", + "carpet.category.feature": "Caracteristicas", + "carpet.category.command": "Comandos", + "carpet.category.tnt": "TNT", + "carpet.category.dispenser": "Dispensandor", + "carpet.category.scarpet": "Scarpet", + "carpet.category.client": "Cliente", + + // Rules + + // allowSpawningOfflinePlayers + "carpet.rule.allowSpawningOfflinePlayers.desc": "Permite aparecer jugadores en modo offline", + + // antiCheatDisabled + "carpet.rule.antiCheatDisabled.desc": "Evita que los jugadores se bugeen al moverse muy rapido", + + "carpet.rule.antiCheatDisabled.extra.0": "... fue expulsado por 'volar'", + "carpet.rule.antiCheatDisabled.extra.1": "Coloca mas confianza en el posicionamiento de los clientes", + "carpet.rule.antiCheatDisabled.extra.2": "Aumenta la distancia de minería permitida por el jugador a 32 bloques", + + // carpetCommandPermissionLevel + "carpet.rule.carpetCommandPermissionLevel.desc": "Nivel de permiso del comando de carpet. Tambien puede ser definido con el archivo .conf", + + // carpets + "carpet.rule.carpets.desc": "Colocar carpets puede causar problemas con carpet para usuarios sin OP", + + // chainStone + "carpet.rule.chainStone.desc": "Las cadenas se van a adherir a otras en los extremos", + + "carpet.rule.chainStone.extra.0": "y se van a adherir a bloques conectados directamente en ellas.", + "carpet.rule.chainStone.extra.1": "con stick_to_all: se van a adherir si no estan visualmente conectadas.", + + // cleanLogs + "carpet.rule.cleanLogs.desc": "Remueve mensajes innecesarios de los logs", + + "carpet.rule.cleanLogs.extra.0": "No muestra 'Maximum sound pool size 247 reached'", + "carpet.rule.cleanLogs.extra.1": "Que es normal con granjas decentes y mecanismos", + + // commandDistance + "carpet.rule.commandDistance.desc": "Habilita el comando /distance para medir la distancia entre puntos en el juego.", + + "carpet.rule.commandDistance.extra.0": "Habilita la accion de poner brown carpets si la rule 'carpets' esta habilitada.", + + // commandDraw + "carpet.rule.commandDraw.desc": "Habilita el comando /draw", + + "carpet.rule.commandDraw.extra.0": "... permite dibujar formas simples o", + "carpet.rule.commandDraw.extra.1": "otras formas que son dificiles de hacer de forma normal.", + + // commandInfo + "carpet.rule.commandInfo.desc": "Habilita el comando /info para bloques", + + "carpet.rule.commandInfo.extra.0": "Habilita tambien la accion de colocar gray carpets", + "carpet.rule.commandInfo.extra.1": "si la regla 'carpets' esta habilitada tambien.", + + // commandLog + "carpet.rule.commandLog.desc": "Habilita el comando /log para monitorear eventos en el chat o overlays", + + // commandPerimeterInfo + "carpet.rule.commandPerimeterInfo.desc": "Habilita el comando /perimeterinfo", + + "carpet.rule.commandPerimeterInfo.extra.0": "... que scanea la zona alrededor para ver las zonas de spawn", + + // commandPlayer + "carpet.rule.commandPlayer.desc": "Habilita el comando /player para controlar/spawnear jugadores.", + + // commandProfile + "carpet.rule.commandProfile.desc": "Habilita el comando /profile para monitorear el rendimiento del juego", + + "carpet.rule.commandProfile.extra.0": "habilita los comandos de /tick ", + + // commandScript + "carpet.rule.commandScript.desc": "Habilita el comando /script", + + "carpet.rule.commandScript.extra.0": "Es un IN-Game Scripting API para el lenguaje de programación Scarpet", + + // commandScriptACE + "carpet.rule.commandScriptACE.desc": "Habilita restricciones para el codigo arbitrario ejecutado por Scarpet", + + "carpet.rule.commandScriptACE.extra.0": "Usuarios que no tienen los permisos necesarios.", + "carpet.rule.commandScriptACE.extra.1": "no van a poder cargar comandos o scripts con scarpet.", + "carpet.rule.commandScriptACE.extra.2": "tambien van a ser los permisos que van a tener", + "carpet.rule.commandScriptACE.extra.3": "cuando corran comandos con run()", + + // commandSpawn + "carpet.rule.commandSpawn.desc": "Habilita el comando /spawn para analizar el spawneo", + + // commandTick + "carpet.rule.commandTick.desc": "Habilita el comando /tick para controlar el reloj interno del juego", + + // commandTrackAI + "carpet.rule.commandTrackAI.desc": "Permite localizar mobs con IA mediante el comando /track", + + // creativeFlyDrag + "carpet.rule.creativeFlyDrag.desc": "Resistencia del Aire en Creativo", + + "carpet.rule.creativeFlyDrag.extra.0": "Incrementar la resistencia va a bajar la velocidad de vuelo", + "carpet.rule.creativeFlyDrag.extra.1": "Asi que hay que ajustar la velocidad acorde", + "carpet.rule.creativeFlyDrag.extra.2": "Con 1.0 de resistencia, usando velocidad de 11 coincide con las velocidades vanilla.", + "carpet.rule.creativeFlyDrag.extra.3": "Configuración puramente del lado del cliente, eso significa", + "carpet.rule.creativeFlyDrag.extra.4": "tenerlo activado en servers dedicados no va a tener ningun efecto", + "carpet.rule.creativeFlyDrag.extra.5": "pero tambien signfica que va a funcionar en servidores vanilla", + + // creativeFlySpeed + "carpet.rule.creativeFlySpeed.desc": "Multiplicador de Velocidad del Modo Creativo", + + "carpet.rule.creativeFlySpeed.extra.0": "Configuración puramente del lado del cliente, eso significa", + "carpet.rule.creativeFlySpeed.extra.1": "que de tenerla no tendra efecto del lado del servidor", + "carpet.rule.creativeFlySpeed.extra.2": "pero tambien significa que funcionaria en servidores vanilla.", + + // creativeNoClip + "carpet.rule.creativeNoClip.desc": "No Clip en Creativo", + + "carpet.rule.creativeNoClip.extra.0": "En servidores tiene que ser puestos en ambos ", + "carpet.rule.creativeNoClip.extra.1": "server y cliente para funcionar correctamente.", + "carpet.rule.creativeNoClip.extra.2": "No tiene efecto si es solo en el server.", + "carpet.rule.creativeNoClip.extra.3": "Puede permitir atravesar paredes", + "carpet.rule.creativeNoClip.extra.4": "Si solo es puesto en carpet del lado del cliente", + "carpet.rule.creativeNoClip.extra.5": "pero requiere alguna para magia para", + "carpet.rule.creativeNoClip.extra.6": "permitir a los jugadores entrar a bloques.", + + // creativePlayersLoadChunks + "carpet.rule.creativePlayersLoadChunks.desc": "Jugadores en Creativo cargan chunks, o no! como los espectadores!", + + "carpet.rule.creativePlayersLoadChunks.extra.0": "alterna el compartamiento si el jugador esta en modo espectador y cambia el gamerule 'spectatorsGenerateChunks.'", + + // ctrlQCraftingFix + "carpet.rule.ctrlQCraftingFix.desc": "Dropear el stack entero tambien funciona desde la UI de Crafteo", + + // customMOTD + "carpet.rule.customMOTD.desc": "Setea un mensaje de MOTD distinto en el cliente cuando quiere conectarse al server", + + "carpet.rule.customMOTD.extra.0": "usa '_' para usar al inicio en server.properties", + + // defaultLoggers + "carpet.rule.defaultLoggers.desc": "Setea unos loggers en su configuracion default para todos los jugadores nuevos", + + "carpet.rule.defaultLoggers.extra.0": "usa csv, como 'tps,mobcaps' para multiples loggers, none para ninguno", + + // desertShrubs + "carpet.rule.desertShrubs.desc": "Los saplings se convierten en Shrubs del desierto si no tienen agua y estan en climas calidos", + + // explosionNoBlockDamage + "carpet.rule.explosionNoBlockDamage.desc": "Explosiones no destruyen bloques", + + // fastRedstoneDust + "carpet.rule.fastRedstoneDust.desc": "Optimizaciones de lag de restone", + + "carpet.rule.fastRedstoneDust.extra.0": "Hecha por Theosib", + "carpet.rule.fastRedstoneDust.extra.1": ".. tambien agrega algunos compartamientos normales y el bug MC-11193", + "carpet.rule.fastRedstoneDust.extra.2": "el uso de los mecanismos como en vanilla no esta asegurado.", + + // fillLimit + "carpet.rule.fillLimit.desc": "[Deprecado] Customizable fill/fillbiome/clone limite de volumen", + + "carpet.rule.fillLimit.extra.0": "Usa la gamerule vanilla. Esta opcion sera removida en la 1.20.0", + + // fillUpdates + "carpet.rule.fillUpdates.desc": "fill/clone/setblock and structure blocks cause block updates", + + // flippinCactus + "carpet.rule.flippinCactus.desc": "Players can flip and rotate blocks when holding cactus", + + "carpet.rule.flippinCactus.extra.0": "No se actualizan los bloques cuando se rotan/voltean", + "carpet.rule.flippinCactus.extra.1": "Se aplica a los pistones, observers, droppers, repetidores, escaleras, glazed terracotta etc...", + + // fogOff + "carpet.rule.fogOff.desc": "Remueve el fog en el nether y en el end", + + "carpet.rule.fogOff.extra.0": "Mejora la visibilidad, pero se ve raro", + + // forceloadLimit + "carpet.rule.forceloadLimit.desc": "Limite customizable de la carga forzada de chunks", + + // hardcodeTNTangle + "carpet.rule.hardcodeTNTangle.desc": "Setea el angulo horizontal aleatorio de la TNT para analizar los mecanismos de TNT", + + "carpet.rule.hardcodeTNTangle.extra.0": "Ponlo en -1 para compartamiento normal", + + // hopperCounters + "carpet.rule.hopperCounters.desc": "hoppers apuntando a lana va a contar items pasando atraves de el", + + "carpet.rule.hopperCounters.extra.0": "Habilita el commando /counter, y las acciones mientras pones alfombras rojas y verdes en lana", + "carpet.rule.hopperCounters.extra.1": "Usa /counter reset para resetear el contador, y /counter para consultar", + "carpet.rule.hopperCounters.extra.2": "En survival, pon una alfombra verde del mismo color lana para consultar, roja para resetear los contadores", + "carpet.rule.hopperCounters.extra.3": "Los contadores son globales y compartidos entre jugadores, 16 canales disponibles", + "carpet.rule.hopperCounters.extra.4": "Los items contados son destruidos, cuenta hasta un stack por tick por hopper", + + // huskSpawningInTemples + "carpet.rule.huskSpawningInTemples.desc": "Los husk solo pueden spawnear en templos", + + // interactionUpdates + "carpet.rule.interactionUpdates.desc": "poner bloques causa block updates ", + + // lagFreeSpawning + "carpet.rule.lagFreeSpawning.desc": "Spawnear requiere mucho menos CPU Y Memoria", + + // language + "carpet.rule.language.desc": "Setea el lenguaje en Carpet", + + // lightEngineMaxBatchSize + "carpet.rule.lightEngineMaxBatchSize.desc": "Cambia el tamaño máximo del lote de tareas ligeras", + + "carpet.rule.lightEngineMaxBatchSize.extra.0": "Permite por una tolerancia de limite mayor de light supression", + "carpet.rule.lightEngineMaxBatchSize.extra.1": "Ponerlo en 5 - Limite default definido por el juego", + + // lightningKillsDropsFix + "carpet.rule.lightningKillsDropsFix.desc": "Los rayos no matan los drops de un mob muerto por un rayo", + + "carpet.rule.lightningKillsDropsFix.extra.0": "Activarlo en true hace que los rayos no borren los drops de los mobs", + "carpet.rule.lightningKillsDropsFix.extra.1": "Arregla [MC-206922](https://bugs.mojang.com/browse/MC-206922).", + + // liquidDamageDisabled + "carpet.rule.liquidDamageDisabled.desc": "Deshabilita romper bloques por liquidos fluyendo", + + // maxEntityCollisions + "carpet.rule.maxEntityCollisions.desc": "Customizable limite de colisiones de entidad, 0 para no tener limites", + + // mergeTNT + "carpet.rule.mergeTNT.desc": "Fusiona entidades TNT fijas activadas", + + // missingTools + "carpet.rule.missingTools.desc": "El vidrio puede ser roto mas rapido con el pico", + + // moreBlueSkulls + "carpet.rule.moreBlueSkulls.desc": "Incrementa las cabezas disparadas por el wither", + + // movableAmethyst + "carpet.rule.movableAmethyst.desc": "Permite los bloques spawneables de amatista moverse", + + "carpet.rule.movableAmethyst.extra.0": "Permite moverlos con pistones", + "carpet.rule.movableAmethyst.extra.1": "tambien añade un drop extra cuand se pica con toque de seda", + + // movableBlockEntities + "carpet.rule.movableBlockEntities.desc": "Pistones pueden mover block entities, como hoppers, cofres etc.", + + // optimizedTNT + "carpet.rule.optimizedTNT.desc": "TNT causa menos lag cuando explota en el mismo lugar y en liquidos", + + // perfPermissionLevel + "carpet.rule.perfPermissionLevel.desc": "Se necesitan permisos para el comando /perf", + + // persistentParrots + "carpet.rule.persistentParrots.desc": "Loros no salen de tus codos hasta que no recibas el daño necesario", + + // piglinsSpawningInBastions + "carpet.rule.piglinsSpawningInBastions.desc": "Piglins van a respawnear en los remenantes de bastions", + + "carpet.rule.piglinsSpawningInBastions.extra.0": "Incluye piglins, brutes, y unos hoglins", + + // pingPlayerListLimit + "carpet.rule.pingPlayerListLimit.desc": "Customizable ping del servidor (menu Multiplayer) lista de jugadores limite", + + // placementRotationFix + "carpet.rule.placementRotationFix.desc": "arregla problema de posicionamiento del bloque cuando el jugador gira rapidamente mientras pone bloques", + + // portalCreativeDelay + "carpet.rule.portalCreativeDelay.desc": "Tiempo necesario en ticks para usar un portal del nether en creativo", + + // portalSurvivalDelay + "carpet.rule.portalSurvivalDelay.desc": "Tiempo necesario en ticks para usar un portal del nether en survival", + + // pushLimit + "carpet.rule.pushLimit.desc": "Limite Customizable de bloques movibles por los Pistones", + + // quasiConnectivity + "carpet.rule.quasiConnectivity.desc": "Pistones, droppers, y dispensers checkean por poder en los bloque(s) sobre ellos.", + + "carpet.rule.quasiConnectivity.extra.0": "Define el rango en que los pistones, droppers, y dispensers checkean por 'quasi power'.", + + // railPowerLimit + "carpet.rule.railPowerLimit.desc": "Rango personalizado de poder de los Railes activables", + + // renewableBlackstone + "carpet.rule.renewableBlackstone.desc": "Generador de Basalto en el nether sin soul sand abajo ", + + "carpet.rule.renewableBlackstone.extra.0": " .. se va a convertir en blackstone ", + + // renewableCoral + "carpet.rule.renewableCoral.desc": "Estructuras de Coral structures van a crecer con polvo de hueso con plantas de coral", + + "carpet.rule.renewableCoral.extra.0": "La ampliación también permite el cultivo a partir de abanicos de coral para una agricultura sostenible fuera de los océanos cálidos.", + + // renewableDeepslate + "carpet.rule.renewableDeepslate.desc": "Lava y agua generan deepslate y cobbled deepslate en la capa Y0", + + // renewableSponges + "carpet.rule.renewableSponges.desc": "Guardianes se convierten en Elder Guardian cuando son alcanzados por un rayo", + + // rotatorBlock + "carpet.rule.rotatorBlock.desc": "Cactus en dispensers rota bloques.", + + "carpet.rule.rotatorBlock.extra.0": "Rota bloques contrario a las agujas del reloj si es posible", + + // scriptsAppStore + "carpet.rule.scriptsAppStore.desc": "Localizacion del repositorio online de las de scarpet", + + "carpet.rule.scriptsAppStore.extra.0": "ponlo en 'none' para deshabilitar.", + "carpet.rule.scriptsAppStore.extra.1": "Apunta a cualquier repositorio de github con apps de scarpet", + "carpet.rule.scriptsAppStore.extra.2": "usando //contents/", + + // scriptsAutoload + "carpet.rule.scriptsAutoload.desc": "Los scripts de Scarpet se autocargan al entrar al mundo", + + "carpet.rule.scriptsAutoload.extra.0": "Si /script esta habilitado", + + // scriptsDebugging + "carpet.rule.scriptsDebugging.desc": "Habilita mensajes de debug en los logs del sistema", + + // scriptsOptimization + "carpet.rule.scriptsOptimization.desc": "Habilita la optimización de scripts", + + // sculkSensorRange + "carpet.rule.sculkSensorRange.desc": "Rango customizable del Sculk Sensor", + + // shulkerSpawningInEndCities + "carpet.rule.shulkerSpawningInEndCities.desc": "Shulkers respawnean en las end cities", + + // silverFishDropGravel + "carpet.rule.silverFishDropGravel.desc": "Silverfish dropea grava cuando se rompe un bloque", + + // simulationDistance + "carpet.rule.simulationDistance.desc": "Cambia la distancia de simulacion del server.", + + "carpet.rule.simulationDistance.extra.0": "Ponlo en 0 para no sustituir las configuraciones del server.", + + // smoothClientAnimations + "carpet.rule.smoothClientAnimations.desc": "Animaciones Fluidas con bajos tps", + + "carpet.rule.smoothClientAnimations.extra.0": "Funciona solo en singleplayer, y va a hacer mas lentos a los jugadores", + + // spawnChunksSize + "carpet.rule.spawnChunksSize.desc": "Cambia el tamaño de los spawn chunks", + + "carpet.rule.spawnChunksSize.extra.0": "Define el nuevo radio", + "carpet.rule.spawnChunksSize.extra.1": "Cambiarlo a 0 - deshabilita los spawn chunks", + + // stackableShulkerBoxes + "carpet.rule.stackableShulkerBoxes.desc": "Las shulker boxes vacias se pueden stackear cuando son tiradas al suelo.", + + "carpet.rule.stackableShulkerBoxes.extra.0": ".. o cuando son manipuladas en el inventario.", + + // structureBlockIgnored + "carpet.rule.structureBlockIgnored.desc": "Cambia el bloque ignorado por el Structure Block", + + // structureBlockLimit + "carpet.rule.structureBlockLimit.desc": "Limite customizable del structure block", + + "carpet.rule.structureBlockLimit.extra.0": "ALERTA: Necesita ser permamente para correcta carga.", + "carpet.rule.structureBlockLimit.extra.1": "Opcion 'structureBlockIgnored' a aire Es recommendado", + "carpet.rule.structureBlockLimit.extra.2": "cuando guardas grandes estructuras.", + "carpet.rule.structureBlockLimit.extra.3": "Requerido en el cliente del jugando editando el bloque de estructura.", + "carpet.rule.structureBlockLimit.extra.4": "'structureBlockOutlineDistance' es requerido por", + "carpet.rule.structureBlockLimit.extra.5": "correcta renderizacion de grandes estructuras", + + // structureBlockOutlineDistance + "carpet.rule.structureBlockOutlineDistance.desc": "Distancia de renderizado del Structure Block de estructura personalizable", + + "carpet.rule.structureBlockOutlineDistance.extra.0": "Necesaria en el cliente para funcionar correctamente.", + + // summonNaturalLightning + "carpet.rule.summonNaturalLightning.desc": "spawnear un rayo tiene los mismo efectos que un rayo natural.", + + // superSecretSetting + "carpet.rule.superSecretSetting.desc": "AKLÑSDLKÑASLJKD REGLA ULTRA SECRETA QUE TIRABA!!! - nachitodev", + + // thickFungusGrowth + "carpet.rule.thickFungusGrowth.desc": "Permite crecer arboles fungi del nether con una base de 3x3", + + "carpet.rule.thickFungusGrowth.extra.0": "Ponerlo en 'all' va a hacer que todos los arboles fungi del nether crezcan en arboles 3x3", + "carpet.rule.thickFungusGrowth.extra.1": "Ponerlo en 'random' will make 6% of all nether fungi grow into 3x3 trees", + "carpet.rule.thickFungusGrowth.extra.2": "(esto siendo consistente con la generación del mundo)", + + // tickSyncedWorldBorders + "carpet.rule.tickSyncedWorldBorders.desc": "hace que los world borders se muevan basados en el tiempo en el juego en vez del tiempo de la vida real", + + "carpet.rule.tickSyncedWorldBorders.extra.0": "Esto tiene efecto cuando el tick rate cambia la velocidad del world border tambien cambia proporcionalmente a el", + + // tntDoNotUpdate + "carpet.rule.tntDoNotUpdate.desc": "la TNT no se actualiza cuando se pone junto a un bloque lo actualize", + + // tntPrimerMomentumRemoved + "carpet.rule.tntPrimerMomentumRemoved.desc": "Remueve el TNT momentum random cuando se prende", + + // tntRandomRange + "carpet.rule.tntRandomRange.desc": "Pone el rango de la explosion de la TNT en un rango especifico", + + "carpet.rule.tntRandomRange.extra.0": "Ponlo a -1 para el compartamiento normal", + + // updateSuppressionBlock + "carpet.rule.updateSuppressionBlock.desc": "Poner un rail activador arriba de un bloque barrier llena a los vecinos updater cuando el stack de rail se apaga.", + + "carpet.rule.updateSuppressionBlock.extra.0": "El numero ingresado es la cantidad de actualizaciones que van a haber en el stack izquierdo", + "carpet.rule.updateSuppressionBlock.extra.1": "-1 lo apaga.", + + // viewDistance + "carpet.rule.viewDistance.desc": "Cambia la distancia de vision del servidor.", + + "carpet.rule.viewDistance.extra.0": "Pon a 0 para no sustituir los valores del server.", + + // xpFromExplosions + "carpet.rule.xpFromExplosions.desc": "La experiencia va a caer con cualquier tipo de explosion", + + // xpNoCooldown + "carpet.rule.xpNoCooldown.desc": "Los jugadores absorben la XP automaticamente sin delay." + +} \ No newline at end of file From 27ccd69c86c25357a2385c47db731b43ec5338b6 Mon Sep 17 00:00:00 2001 From: Nachito Date: Sat, 3 Feb 2024 19:16:52 -0300 Subject: [PATCH 035/232] fix typo --- README-ES.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/README-ES.md b/README-ES.md index 3223ddfb..ab7559a6 100644 --- a/README-ES.md +++ b/README-ES.md @@ -12,17 +12,18 @@ English version of this [docs](https://github.com/gnembon/fabric-carpet/blob/master/README.md) Cause all carpets are made of fabric? + Esto es la [Fabric](https://fabricmc.net/) version del Carpet Mod, para Minecraft 1.14.X, 1.15.X, 1.16.X y siguientes. Carpet Mod es un mod para Minecraft Vanilla que permite tener un control total de lo que importa desde la perspectiva tecnica del juego. * Prueba tus granjas durante varias horas en tan solo unos minutos con el comando [`/tick warp`](https://github.com/gnembon/fabric-carpet/wiki/Commands#usage-tick-warp-ticks-cmd), tan rapido como tu computadora pueda -* ...da un informe detallado de los items producido usando el comando [`hopperCounters`](https://github.com/gnembon/fabric-carpet/wiki/Current-Available-Settings#hoppercounters) +* ...da un informe detallado de los items producido usando el comando [`/hopperCounters`](https://github.com/gnembon/fabric-carpet/wiki/Current-Available-Settings#hoppercounters) * Ve la mobcap del server, TPS, etc. con actualizaciones en vivo con [`/log`](https://github.com/gnembon/fabric-carpet/wiki/Commands#log) -* Permite a los pistones mover entidades (por ejemplo. cofres) con [`movableBlockEntities`](https://github.com/gnembon/fabric-carpet/wiki/Current-Available-Settings#movableblockentities) +* Permite a los pistones mover entidades (por ejemplo. cofres) con [`/movableBlockEntities`](https://github.com/gnembon/fabric-carpet/wiki/Current-Available-Settings#movableblockentities) * [Arregla](https://github.com/gnembon/fabric-carpet/wiki/Current-Available-Settings#leadfix) [muchas](https://github.com/gnembon/fabric-carpet/wiki/Current-Available-Settings#portalsuffocationfix) [cosas](https://github.com/gnembon/fabric-carpet/wiki/Current-Available-Settings#unloadedentityfix) -# ecosistema de Carpet +# ecosistema carpet Para funcionalidades del ecosistema de carpet este el lugar correcto. Ve las descargas disponibles en [pagina de descargas](https://github.com/gnembon/fabric-carpet/releases) @@ -31,7 +32,7 @@ Para funcionalidades del ecosistema de carpet este el lugar correcto. Ve las des ## carpet-extra -Mira [carpet-extra](https://github.com/gnembon/carpet-extra/) addon mod para mas locas y divertidas funcionalidades, incluyendo mesas de crafteo automaticas, dispensers que ponen bloques, hasta trasquilado de pollos! +Mira [carpet-extra](https://github.com/gnembon/carpet-extra/) mod para mas locas y divertidas funcionalidades, incluyendo mesas de crafteo automaticas, dispensers que ponen bloques, hasta trasquilado de pollos! ## mesa de crafteo automatica @@ -39,7 +40,7 @@ Debido a problemas de compatibildias con vanilla y otros mods, descarga [mesa de ## scarpet app store -Si quieres buscar o contribuir a las app store de scarpet mira las aplicaciones disponibles, ve[aqui](https://github.com/gnembon/scarpet), es gratis! +Si quieres buscar o contribuir a las app store de scarpet mira las aplicaciones disponibles, ve [aqui](https://github.com/gnembon/scarpet), es gratis! ## quick-carpet From da95165c8ffff6a477039432f0faa821e5948b35 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Fri, 29 Nov 2024 09:35:34 +0100 Subject: [PATCH 036/232] 1.21.4-rc1 --- gradle.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index 1e04fc97..6ba2cfe3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,10 +3,10 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=24w46a - loader_version=0.16.7 + minecraft_version=1.21.4-rc1 + loader_version=0.16.9 jsr305_version=3.0.2 - fabric_version=0.106.0+1.21.2 + fabric_version=0.109.1+1.21.4 # Mod Properties mod_version = 1.4.160 From 8de22ad2192f38264bcd415d3a41e0678b525ccb Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Tue, 3 Dec 2024 22:47:29 +0100 Subject: [PATCH 037/232] 1.21.4 --- gradle.properties | 6 +++--- src/main/resources/fabric.mod.json | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gradle.properties b/gradle.properties index 6ba2cfe3..a5749528 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,10 +3,10 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=1.21.4-rc1 + minecraft_version=1.21.4 loader_version=0.16.9 jsr305_version=3.0.2 - fabric_version=0.109.1+1.21.4 + fabric_version=0.110.5+1.21.4 # Mod Properties mod_version = 1.4.160 @@ -17,7 +17,7 @@ org.gradle.jvmargs=-Xmx1G # The Curseforge versions "names" or ids for the main branch (comma separated: 1.16.4,1.16.5) # This is needed because CF uses too vague names for prereleases and release candidates # Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN] - release-curse-versions = Minecraft 1.22:1.22.0-Snapshot + release-curse-versions = Minecraft 1.21:1.21.4 # Whether or not to build another branch on release release-extra-branch = false # The name of the second branch to release diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 39e87ae2..0c6ff7ef 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -33,8 +33,8 @@ "accessWidener" : "carpet.accesswidener", "depends": { - "minecraft": ">1.21.1", - "fabricloader": ">=0.14.18", + "minecraft": ">=1.21.4", + "fabricloader": ">=0.16.9", "java": ">=21" } } From d9c7334400ecd75f307806e312a2e64a1cc42302 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Tue, 3 Dec 2024 22:51:46 +0100 Subject: [PATCH 038/232] 1.4.161 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index a5749528..ae6eda1b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G fabric_version=0.110.5+1.21.4 # Mod Properties - mod_version = 1.4.160 + mod_version = 1.4.161 maven_group = carpet archives_base_name = fabric-carpet From b16eec89e7dcb761716a89fb892fead6b361b17a Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Thu, 9 Jan 2025 13:25:48 +0100 Subject: [PATCH 039/232] 25w02a --- gradle.properties | 6 +- .../java/carpet/commands/DrawCommand.java | 8 +- .../fakes/ChunkTicketManagerInterface.java | 16 -- .../carpet/fakes/TicketsFetcherInterface.java | 11 ++ .../carpet/fakes/WorldChunkInterface.java | 2 +- ...ingAmethystBlock_movableAmethystMixin.java | 8 +- .../ChunkGenerator_customMobSpawnsMixin.java | 6 +- .../ChunkMap_scarpetChunkCreationMixin.java | 7 +- .../CloneCommands_fillUpdatesMixin.java | 4 +- ...anceManager_scarpetChunkCreationMixin.java | 25 --- .../mixins/DistanceManager_scarpetMixin.java | 14 +- .../DistanceManager_spawnChunksMixin.java | 55 ------ src/main/java/carpet/mixins/EntityMixin.java | 2 +- .../java/carpet/mixins/FillCommandMixin.java | 4 +- .../carpet/mixins/Item_missingToolsMixin.java | 30 ++++ .../mixins/LevelChunk_fillUpdatesMixin.java | 25 ++- .../mixins/LevelChunk_movableBEMixin.java | 158 +++++++++++------- .../carpet/mixins/Level_fillUpdatesMixin.java | 4 +- .../carpet/mixins/Level_movableBEMixin.java | 76 ++++----- .../mixins/PickaxeItem_missingToolsMixin.java | 36 ---- .../mixins/RedstoneWireBlock_fastMixin.java | 2 +- .../SetBlockCommand_fillUpdatesMixin.java | 4 +- .../StructureTemplate_fillUpdatesMixin.java | 4 +- .../mixins/TicketStorage_scarpetMixin.java | 23 +++ .../java/carpet/script/ScriptCommand.java | 7 +- .../java/carpet/script/api/WorldAccess.java | 28 ++-- .../java/carpet/script/external/Vanilla.java | 6 +- .../java/carpet/script/utils/EntityTools.java | 2 +- src/main/java/carpet/utils/Messenger.java | 11 +- .../carpet/utils/PerimeterDiagnostics.java | 8 +- .../java/carpet/utils/SpawnOverrides.java | 22 +-- src/main/java/carpet/utils/SpawnReporter.java | 25 +-- src/main/resources/carpet.accesswidener | 1 - src/main/resources/carpet.mixins.json | 6 +- 34 files changed, 299 insertions(+), 347 deletions(-) delete mode 100644 src/main/java/carpet/fakes/ChunkTicketManagerInterface.java create mode 100644 src/main/java/carpet/fakes/TicketsFetcherInterface.java delete mode 100644 src/main/java/carpet/mixins/DistanceManager_scarpetChunkCreationMixin.java delete mode 100644 src/main/java/carpet/mixins/DistanceManager_spawnChunksMixin.java create mode 100644 src/main/java/carpet/mixins/Item_missingToolsMixin.java delete mode 100644 src/main/java/carpet/mixins/PickaxeItem_missingToolsMixin.java create mode 100644 src/main/java/carpet/mixins/TicketStorage_scarpetMixin.java diff --git a/gradle.properties b/gradle.properties index ae6eda1b..b21e76d9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,8 +3,8 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=1.21.4 - loader_version=0.16.9 + minecraft_version=25w02a + loader_version=0.16.10 jsr305_version=3.0.2 fabric_version=0.110.5+1.21.4 @@ -17,7 +17,7 @@ org.gradle.jvmargs=-Xmx1G # The Curseforge versions "names" or ids for the main branch (comma separated: 1.16.4,1.16.5) # This is needed because CF uses too vague names for prereleases and release candidates # Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN] - release-curse-versions = Minecraft 1.21:1.21.4 + release-curse-versions = Minecraft 1.21:1.21.5-Snapshot # Whether or not to build another branch on release release-extra-branch = false # The name of the second branch to release diff --git a/src/main/java/carpet/commands/DrawCommand.java b/src/main/java/carpet/commands/DrawCommand.java index df2e544c..d362544a 100644 --- a/src/main/java/carpet/commands/DrawCommand.java +++ b/src/main/java/carpet/commands/DrawCommand.java @@ -240,7 +240,7 @@ public class DrawCommand } if (CarpetSettings.fillUpdates) { - list.forEach(blockpos1 -> world.blockUpdated(blockpos1, world.getBlockState(blockpos1).getBlock())); + list.forEach(blockpos1 -> world.updateNeighborsAt(blockpos1, world.getBlockState(blockpos1).getBlock())); } Messenger.m(ctx.getSource(), "gi Filled " + affected + " blocks"); return affected; @@ -290,7 +290,7 @@ public class DrawCommand if (CarpetSettings.fillUpdates) { - list.forEach(p -> world.blockUpdated(p, world.getBlockState(p).getBlock())); + list.forEach(p -> world.updateNeighborsAt(p, world.getBlockState(p).getBlock())); } Messenger.m(source, "gi Filled " + affected + " blocks"); @@ -389,7 +389,7 @@ public class DrawCommand for (BlockPos blockpos1 : list) { Block blokc = world.getBlockState(blockpos1).getBlock(); - world.blockUpdated(blockpos1, blokc); + world.updateNeighborsAt(blockpos1, blokc); } } @@ -440,7 +440,7 @@ public class DrawCommand for (BlockPos blockpos1 : list) { Block blokc = world.getBlockState(blockpos1).getBlock(); - world.blockUpdated(blockpos1, blokc); + world.updateNeighborsAt(blockpos1, blokc); } } diff --git a/src/main/java/carpet/fakes/ChunkTicketManagerInterface.java b/src/main/java/carpet/fakes/ChunkTicketManagerInterface.java deleted file mode 100644 index 2a01ed8c..00000000 --- a/src/main/java/carpet/fakes/ChunkTicketManagerInterface.java +++ /dev/null @@ -1,16 +0,0 @@ -package carpet.fakes; - -import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; -import net.minecraft.server.level.ChunkHolder; -import net.minecraft.server.level.Ticket; -import net.minecraft.util.SortedArraySet; -import net.minecraft.world.level.ChunkPos; - -public interface ChunkTicketManagerInterface -{ - void changeSpawnChunks(ChunkPos pos, int distance); - - Long2ObjectOpenHashMap>> getTicketsByPosition(); - - void replaceHolder(ChunkHolder oldHolder, ChunkHolder newHolder); -} diff --git a/src/main/java/carpet/fakes/TicketsFetcherInterface.java b/src/main/java/carpet/fakes/TicketsFetcherInterface.java new file mode 100644 index 00000000..7bc6055a --- /dev/null +++ b/src/main/java/carpet/fakes/TicketsFetcherInterface.java @@ -0,0 +1,11 @@ +package carpet.fakes; + +import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; +import net.minecraft.server.level.Ticket; + +import java.util.List; + +public interface TicketsFetcherInterface +{ + Long2ObjectOpenHashMap> getTicketsByPosition(); +} diff --git a/src/main/java/carpet/fakes/WorldChunkInterface.java b/src/main/java/carpet/fakes/WorldChunkInterface.java index d93b0a1d..22a8c1db 100644 --- a/src/main/java/carpet/fakes/WorldChunkInterface.java +++ b/src/main/java/carpet/fakes/WorldChunkInterface.java @@ -6,5 +6,5 @@ import net.minecraft.world.level.block.state.BlockState; public interface WorldChunkInterface { - BlockState setBlockStateWithBlockEntity(BlockPos blockPos, BlockState newBlockState, BlockEntity newBlockEntity, boolean boolean1); + BlockState setBlockStateWithBlockEntity(BlockPos blockPos, BlockState newBlockState, BlockEntity newBlockEntity, int flags); } diff --git a/src/main/java/carpet/mixins/BuddingAmethystBlock_movableAmethystMixin.java b/src/main/java/carpet/mixins/BuddingAmethystBlock_movableAmethystMixin.java index af5670b2..f1adfc67 100644 --- a/src/main/java/carpet/mixins/BuddingAmethystBlock_movableAmethystMixin.java +++ b/src/main/java/carpet/mixins/BuddingAmethystBlock_movableAmethystMixin.java @@ -3,10 +3,10 @@ package carpet.mixins; import carpet.CarpetSettings; import net.minecraft.core.BlockPos; import net.minecraft.core.registries.Registries; +import net.minecraft.tags.ItemTags; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; -import net.minecraft.world.item.PickaxeItem; import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.item.enchantment.Enchantments; import net.minecraft.world.level.Level; @@ -14,12 +14,8 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.BuddingAmethystBlock; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.material.PushReaction; import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(BuddingAmethystBlock.class) public class BuddingAmethystBlock_movableAmethystMixin extends Block { @@ -33,7 +29,7 @@ public class BuddingAmethystBlock_movableAmethystMixin extends Block { // doing it here rather than though loottables since loottables are loaded on reload // drawback - not controlled via loottables, but hey if (CarpetSettings.movableAmethyst && - stack.getItem() instanceof PickaxeItem && + stack.is(ItemTags.PICKAXES) && EnchantmentHelper.getItemEnchantmentLevel(world.registryAccess().lookupOrThrow(Registries.ENCHANTMENT).getOrThrow(Enchantments.SILK_TOUCH), stack) > 0 ) popResource(world, pos, Items.BUDDING_AMETHYST.getDefaultInstance()); diff --git a/src/main/java/carpet/mixins/ChunkGenerator_customMobSpawnsMixin.java b/src/main/java/carpet/mixins/ChunkGenerator_customMobSpawnsMixin.java index 06868170..71f9b48d 100644 --- a/src/main/java/carpet/mixins/ChunkGenerator_customMobSpawnsMixin.java +++ b/src/main/java/carpet/mixins/ChunkGenerator_customMobSpawnsMixin.java @@ -3,6 +3,7 @@ package carpet.mixins; import carpet.utils.SpawnOverrides; import it.unimi.dsi.fastutil.longs.LongSet; import net.minecraft.core.Holder; +import net.minecraft.util.random.WeightedList; import net.minecraft.world.level.StructureManager; import net.minecraft.world.level.levelgen.structure.Structure; import org.spongepowered.asm.mixin.Mixin; @@ -11,7 +12,6 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import net.minecraft.core.BlockPos; -import net.minecraft.util.random.WeightedRandomList; import net.minecraft.world.entity.MobCategory; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.MobSpawnSettings; @@ -31,10 +31,10 @@ public abstract class ChunkGenerator_customMobSpawnsMixin target = "Ljava/util/Map$Entry;getKey()Ljava/lang/Object;" ), cancellable = true) private void checkCMSpawns(Holder holder, StructureManager structureFeatureManager, MobCategory mobCategory, BlockPos blockPos, - CallbackInfoReturnable> cir, + CallbackInfoReturnable> cir, Map map, Iterator var6, Map.Entry entry) { - WeightedRandomList res = SpawnOverrides.test(structureFeatureManager, entry.getValue(), mobCategory, entry.getKey(), blockPos); + WeightedList res = SpawnOverrides.test(structureFeatureManager, entry.getValue(), mobCategory, entry.getKey(), blockPos); if (res != null) { cir.setReturnValue(res); diff --git a/src/main/java/carpet/mixins/ChunkMap_scarpetChunkCreationMixin.java b/src/main/java/carpet/mixins/ChunkMap_scarpetChunkCreationMixin.java index c19738a8..a66e8167 100644 --- a/src/main/java/carpet/mixins/ChunkMap_scarpetChunkCreationMixin.java +++ b/src/main/java/carpet/mixins/ChunkMap_scarpetChunkCreationMixin.java @@ -46,7 +46,6 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import carpet.fakes.ChunkHolderInterface; -import carpet.fakes.ChunkTicketManagerInterface; import carpet.fakes.ServerLightingProviderInterface; import carpet.fakes.ThreadedAnvilChunkStorageInterface; import carpet.script.utils.WorldTools; @@ -165,7 +164,6 @@ public abstract class ChunkMap_scarpetChunkCreationMixin implements ThreadedAnvi this.world.getServer().execute(() -> CHUNK_LOADED.onChunkEvent(this.world, chpos, generated)); } } - */ @Unique private void addTicket(ChunkPos pos, ChunkStatus status) @@ -180,7 +178,6 @@ public abstract class ChunkMap_scarpetChunkCreationMixin implements ThreadedAnvi } - /* @Unique private void addRelightTicket(ChunkPos pos) { @@ -195,7 +192,7 @@ public abstract class ChunkMap_scarpetChunkCreationMixin implements ThreadedAnvi () -> "release relight ticket " + pos )); } - */ + @Unique private void tickTicketManager() { @@ -220,7 +217,7 @@ public abstract class ChunkMap_scarpetChunkCreationMixin implements ThreadedAnvi } - /* + @Unique private Set loadExistingChunksFromDisk(Set requestedChunks) { diff --git a/src/main/java/carpet/mixins/CloneCommands_fillUpdatesMixin.java b/src/main/java/carpet/mixins/CloneCommands_fillUpdatesMixin.java index 7a172441..8e3db97c 100644 --- a/src/main/java/carpet/mixins/CloneCommands_fillUpdatesMixin.java +++ b/src/main/java/carpet/mixins/CloneCommands_fillUpdatesMixin.java @@ -14,10 +14,10 @@ public abstract class CloneCommands_fillUpdatesMixin { @Redirect(method = "clone", at = @At( value = "INVOKE", - target = "Lnet/minecraft/server/level/ServerLevel;blockUpdated(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/Block;)V" + target = "Lnet/minecraft/server/level/ServerLevel;updateNeighborsAt(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/Block;)V" )) private static void conditionalUpdating(ServerLevel serverWorld, BlockPos blockPos_1, Block block_1) { - if (CarpetSettings.fillUpdates) serverWorld.blockUpdated(blockPos_1, block_1); + if (CarpetSettings.fillUpdates) serverWorld.updateNeighborsAt(blockPos_1, block_1); } } diff --git a/src/main/java/carpet/mixins/DistanceManager_scarpetChunkCreationMixin.java b/src/main/java/carpet/mixins/DistanceManager_scarpetChunkCreationMixin.java deleted file mode 100644 index 694aed49..00000000 --- a/src/main/java/carpet/mixins/DistanceManager_scarpetChunkCreationMixin.java +++ /dev/null @@ -1,25 +0,0 @@ -package carpet.mixins; - -import java.util.Set; -import net.minecraft.server.level.ChunkHolder; -import net.minecraft.server.level.DistanceManager; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; - -import carpet.fakes.ChunkTicketManagerInterface; - -@Mixin(DistanceManager.class) -public abstract class DistanceManager_scarpetChunkCreationMixin implements ChunkTicketManagerInterface -{ - @Shadow - @Final - private Set chunksToUpdateFutures; - - @Override - public void replaceHolder(final ChunkHolder oldHolder, final ChunkHolder newHolder) - { - this.chunksToUpdateFutures.remove(oldHolder); - this.chunksToUpdateFutures.add(newHolder); - } -} diff --git a/src/main/java/carpet/mixins/DistanceManager_scarpetMixin.java b/src/main/java/carpet/mixins/DistanceManager_scarpetMixin.java index 120f1f4a..8cd13ce5 100644 --- a/src/main/java/carpet/mixins/DistanceManager_scarpetMixin.java +++ b/src/main/java/carpet/mixins/DistanceManager_scarpetMixin.java @@ -1,23 +1,25 @@ package carpet.mixins; -import carpet.fakes.ChunkTicketManagerInterface; +import carpet.fakes.TicketsFetcherInterface; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; import net.minecraft.server.level.DistanceManager; import net.minecraft.server.level.Ticket; -import net.minecraft.util.SortedArraySet; +import net.minecraft.world.level.TicketStorage; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; +import java.util.List; + @Mixin(DistanceManager.class) -public abstract class DistanceManager_scarpetMixin implements ChunkTicketManagerInterface +public abstract class DistanceManager_scarpetMixin implements TicketsFetcherInterface { - @Shadow @Final private Long2ObjectOpenHashMap>> tickets; + @Shadow @Final private TicketStorage ticketStorage; @Override - public Long2ObjectOpenHashMap>> getTicketsByPosition() + public Long2ObjectOpenHashMap> getTicketsByPosition() { - return tickets; + return ((TicketsFetcherInterface)ticketStorage).getTicketsByPosition(); } } diff --git a/src/main/java/carpet/mixins/DistanceManager_spawnChunksMixin.java b/src/main/java/carpet/mixins/DistanceManager_spawnChunksMixin.java deleted file mode 100644 index e4a24c65..00000000 --- a/src/main/java/carpet/mixins/DistanceManager_spawnChunksMixin.java +++ /dev/null @@ -1,55 +0,0 @@ -package carpet.mixins; - -import carpet.fakes.ChunkTicketManagerInterface; -import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; -import net.minecraft.server.level.DistanceManager; -import net.minecraft.server.level.Ticket; -import net.minecraft.server.level.TicketType; -import net.minecraft.util.SortedArraySet; -import net.minecraft.util.Unit; -import net.minecraft.world.level.ChunkPos; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; - -import java.util.Iterator; - -@Mixin(DistanceManager.class) -public abstract class DistanceManager_spawnChunksMixin implements ChunkTicketManagerInterface -{ - @Shadow @Final private Long2ObjectOpenHashMap>> tickets; - - @Shadow protected abstract void removeTicket(long pos, Ticket ticket); - - @Shadow public abstract void addRegionTicket(TicketType type, ChunkPos pos, int radius, T argument); - - @Override - public void changeSpawnChunks(ChunkPos chunkPos, int distance) - { - long pos = chunkPos.toLong(); - SortedArraySet> set = tickets.get(pos); - Ticket existingTicket = null; - if (set != null) - { - Iterator> iter = set.iterator(); - while(iter.hasNext()) - { - Ticket ticket = iter.next(); - if (ticket.getType() == TicketType.START) - { - existingTicket = ticket; - iter.remove(); - } - } - set.add(existingTicket); - } - // the reason we are removing the ticket this way is that there are sideeffects of removal - if (existingTicket != null) - { - removeTicket(pos, existingTicket); - } - // set optionally new spawn ticket - if (distance > 0) - addRegionTicket(TicketType.START, chunkPos, distance, Unit.INSTANCE); - } -} diff --git a/src/main/java/carpet/mixins/EntityMixin.java b/src/main/java/carpet/mixins/EntityMixin.java index 6c2223ad..589f5111 100644 --- a/src/main/java/carpet/mixins/EntityMixin.java +++ b/src/main/java/carpet/mixins/EntityMixin.java @@ -32,7 +32,7 @@ public abstract class EntityMixin implements EntityInterface return partialTicks == 1.0F ? this.yRot : Mth.lerp(partialTicks, this.yRotO, this.yRot); } - @Inject(method = "isControlledByLocalInstance", at = @At("HEAD"), cancellable = true) + @Inject(method = "isLocalInstanceAuthoritative", at = @At("HEAD"), cancellable = true) private void isFakePlayer(CallbackInfoReturnable cir) { if (getControllingPassenger() instanceof EntityPlayerMPFake) cir.setReturnValue(!level.isClientSide); diff --git a/src/main/java/carpet/mixins/FillCommandMixin.java b/src/main/java/carpet/mixins/FillCommandMixin.java index 344f5ff3..6ab7079e 100644 --- a/src/main/java/carpet/mixins/FillCommandMixin.java +++ b/src/main/java/carpet/mixins/FillCommandMixin.java @@ -14,10 +14,10 @@ public abstract class FillCommandMixin { @Redirect(method = "fillBlocks", at = @At( value = "INVOKE", - target = "Lnet/minecraft/server/level/ServerLevel;blockUpdated(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/Block;)V" + target = "Lnet/minecraft/server/level/ServerLevel;updateNeighborsAt(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/Block;)V" )) private static void conditionalUpdating(ServerLevel serverWorld, BlockPos blockPos_1, Block block_1) { - if (CarpetSettings.fillUpdates) serverWorld.blockUpdated(blockPos_1, block_1); + if (CarpetSettings.fillUpdates) serverWorld.updateNeighborsAt(blockPos_1, block_1); } } diff --git a/src/main/java/carpet/mixins/Item_missingToolsMixin.java b/src/main/java/carpet/mixins/Item_missingToolsMixin.java new file mode 100644 index 00000000..90445ad7 --- /dev/null +++ b/src/main/java/carpet/mixins/Item_missingToolsMixin.java @@ -0,0 +1,30 @@ +package carpet.mixins; + +import carpet.CarpetSettings; +import net.minecraft.core.component.DataComponents; +import net.minecraft.tags.ItemTags; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.component.Tool; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.SoundType; +import net.minecraft.world.level.block.state.BlockState; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(Item.class) +public class Item_missingToolsMixin +{ + @Inject(method = "getDestroySpeed", at = @At("HEAD"), cancellable = true) + public void getDestroySpeed(ItemStack itemStack, BlockState blockState, CallbackInfoReturnable cir) { + if (CarpetSettings.missingTools && blockState.getSoundType() == SoundType.GLASS && itemStack.is(ItemTags.PICKAXES)) + { + Tool tool = itemStack.get(DataComponents.TOOL); + if (tool != null) { + cir.setReturnValue(tool.getMiningSpeed(Blocks.STONE.defaultBlockState())); + } + } + } +} diff --git a/src/main/java/carpet/mixins/LevelChunk_fillUpdatesMixin.java b/src/main/java/carpet/mixins/LevelChunk_fillUpdatesMixin.java index 52b345a8..d0eec071 100644 --- a/src/main/java/carpet/mixins/LevelChunk_fillUpdatesMixin.java +++ b/src/main/java/carpet/mixins/LevelChunk_fillUpdatesMixin.java @@ -2,7 +2,9 @@ package carpet.mixins; import carpet.CarpetSettings; import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.LevelChunk; import org.spongepowered.asm.mixin.Mixin; @@ -25,20 +27,25 @@ public class LevelChunk_fillUpdatesMixin @Redirect(method = "setBlockState", at = @At( value = "INVOKE", - target = "Lnet/minecraft/world/level/block/state/BlockState;onRemove(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Z)V" + target = "Lnet/minecraft/world/level/block/entity/BlockEntity;preRemoveSideEffects(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Z)V" )) - private void onRemovedBlock(BlockState blockState, Level world, BlockPos pos, BlockState state, boolean moved) + private void onPreRemoveSideEffects(BlockEntity blockEntity, BlockPos blockPos_1, BlockState blockState_1, boolean boolean_1) { - if (CarpetSettings.impendingFillSkipUpdates.get()) // doing due dilligence from AbstractBlock onStateReplaced + if (!CarpetSettings.impendingFillSkipUpdates.get()) { - if (blockState.hasBlockEntity() && !blockState.is(state.getBlock())) - { - world.removeBlockEntity(pos); - } + blockEntity.preRemoveSideEffects(blockPos_1, blockState_1, boolean_1); } - else + } + + @Redirect(method = "setBlockState", at = @At( + value = "INVOKE", + target = "Lnet/minecraft/world/level/block/state/BlockState;affectNeighborsAfterRemoval(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/core/BlockPos;Z)V" + )) + private void onAffectNeighborsAfterRemoval(final BlockState instance, final ServerLevel serverLevel, final BlockPos blockPos, final boolean b) + { + if (!CarpetSettings.impendingFillSkipUpdates.get()) { - blockState.onRemove(world, pos, state, moved); + instance.affectNeighborsAfterRemoval(serverLevel, blockPos, b); } } } diff --git a/src/main/java/carpet/mixins/LevelChunk_movableBEMixin.java b/src/main/java/carpet/mixins/LevelChunk_movableBEMixin.java index 77a099a1..43a7d36f 100644 --- a/src/main/java/carpet/mixins/LevelChunk_movableBEMixin.java +++ b/src/main/java/carpet/mixins/LevelChunk_movableBEMixin.java @@ -4,6 +4,10 @@ import carpet.CarpetSettings; import carpet.fakes.WorldChunkInterface; import net.minecraft.core.BlockPos; import net.minecraft.core.Registry; +import net.minecraft.core.SectionPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.profiling.Profiler; +import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelHeightAccessor; @@ -19,6 +23,7 @@ import net.minecraft.world.level.chunk.LevelChunkSection; import net.minecraft.world.level.chunk.UpgradeData; import net.minecraft.world.level.levelgen.Heightmap; import net.minecraft.world.level.levelgen.blending.BlendingData; +import net.minecraft.world.level.lighting.LightEngine; import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; @@ -74,90 +79,119 @@ public abstract class LevelChunk_movableBEMixin extends ChunkAccess implements W // todo update me to the new version @Override public BlockState setBlockStateWithBlockEntity(BlockPos blockPos_1, BlockState newBlockState, BlockEntity newBlockEntity, - boolean boolean_1) + int flags) { - int x = blockPos_1.getX() & 15; + boolean boolean_1 = (flags & 64) != 0; int y = blockPos_1.getY(); - int z = blockPos_1.getZ() & 15; + LevelChunkSection chunkSection = this.getSection(this.getSectionIndex(y)); - if (chunkSection.hasOnlyAir()) + + boolean hadOnlyAir = chunkSection.hasOnlyAir(); + + if (hadOnlyAir && newBlockState.isAir()) { - if (newBlockState.isAir()) - { - return null; - } + return null; } - - boolean boolean_2 = chunkSection.hasOnlyAir(); - BlockState oldBlockState = chunkSection.setBlockState(x, y & 15, z, newBlockState); + + int x = blockPos_1.getX() & 15; + int chunkY = blockPos_1.getY() & 15; + int z = blockPos_1.getZ() & 15; + BlockState oldBlockState = chunkSection.setBlockState(x, chunkY, z, newBlockState); if (oldBlockState == newBlockState) { return null; } - else + Block newBlock = newBlockState.getBlock(); + this.heightmaps.get(Heightmap.Types.MOTION_BLOCKING).update(x, y, z, newBlockState); + this.heightmaps.get(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES).update(x, y, z, newBlockState); + this.heightmaps.get(Heightmap.Types.OCEAN_FLOOR).update(x, y, z, newBlockState); + this.heightmaps.get(Heightmap.Types.WORLD_SURFACE).update(x, y, z, newBlockState); + boolean hasOnlyAir = chunkSection.hasOnlyAir(); + if (hadOnlyAir != hasOnlyAir) { - Block newBlock = newBlockState.getBlock(); - Block oldBlock = oldBlockState.getBlock(); - ((Heightmap) this.heightmaps.get(Heightmap.Types.MOTION_BLOCKING)).update(x, y, z, newBlockState); - ((Heightmap) this.heightmaps.get(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES)).update(x, y, z, newBlockState); - ((Heightmap) this.heightmaps.get(Heightmap.Types.OCEAN_FLOOR)).update(x, y, z, newBlockState); - ((Heightmap) this.heightmaps.get(Heightmap.Types.WORLD_SURFACE)).update(x, y, z, newBlockState); - boolean boolean_3 = chunkSection.hasOnlyAir(); - if (boolean_2 != boolean_3) - { - this.level.getChunkSource().getLightEngine().updateSectionStatus(blockPos_1, boolean_3); + this.level.getChunkSource().getLightEngine().updateSectionStatus(blockPos_1, hasOnlyAir); + this.level.getChunkSource().onSectionEmptinessChanged(chunkPos.x, SectionPos.blockToSectionCoord(y), chunkPos.z, hasOnlyAir); + } + + if (LightEngine.hasDifferentLightProperties(oldBlockState, newBlockState)) { + ProfilerFiller profiler = Profiler.get(); + profiler.push("updateSkyLightSources"); + skyLightSources.update(this, x, chunkY, z); + profiler.popPush("queueCheckLight"); + level.getChunkSource().getLightEngine().checkBlock(blockPos_1); + profiler.pop(); + } + + boolean hadBlockEntity = oldBlockState.hasBlockEntity(); + boolean blockChanged = !oldBlockState.is(newBlock); + + boolean sideEffects = (flags & Block.UPDATE_SKIP_BLOCK_ENTITY_SIDEEFFECTS) == 0; + + if (blockChanged) { + if (level instanceof ServerLevel serverLevel && !(oldBlockState.getBlock() instanceof MovingPistonBlock)) { + if (hadBlockEntity && sideEffects) { + final BlockEntity blockEntity = level.getBlockEntity(blockPos_1); + if (blockEntity != null) { + blockEntity.preRemoveSideEffects(blockPos_1, oldBlockState, boolean_1); + } + } + + if (hadBlockEntity) { + removeBlockEntity(blockPos_1); + } + if ((flags & Block.UPDATE_NEIGHBORS) != 0) { // scary change // so many other places that used to call this regardless if the UPDATE_NEIGHBORS flag was set + oldBlockState.affectNeighborsAfterRemoval(serverLevel, blockPos_1, boolean_1); + } + } else if (hadBlockEntity) { + removeBlockEntity(blockPos_1); } - - if (!this.level.isClientSide) + } + + + + + + + if (chunkSection.getBlockState(x, chunkY, z).getBlock() != newBlock) + { + return null; + } + + if (!level.isClientSide && sideEffects) { + // this updates stuff, schedule ticks - do we want that since its only be called from MovingPistonBlock really? + newBlockState.onPlace(level, blockPos_1, oldBlockState, boolean_1); + } + + BlockEntity oldBlockEntity = null; + if (oldBlockState.hasBlockEntity()) + { + oldBlockEntity = this.getBlockEntity(blockPos_1, LevelChunk.EntityCreationType.CHECK); + if (oldBlockEntity != null && !oldBlockEntity.isValidBlockState(oldBlockState)) { - if (!(oldBlock instanceof MovingPistonBlock))//this is a movableTE special case, if condition wasn't there it would remove the blockentity that was carried for some reason - oldBlockState.onRemove(this.level, blockPos_1, newBlockState, boolean_1);//this kills it - } - else if (oldBlock != newBlock && oldBlock instanceof EntityBlock) - { - this.level.removeBlockEntity(blockPos_1); - } - - if (chunkSection.getBlockState(x, y & 15, z).getBlock() != newBlock) - { - return null; + oldBlockEntity.setBlockState(oldBlockState); + updateBlockEntityTicker(oldBlockEntity); } else { - BlockEntity oldBlockEntity = null; - if (oldBlockState.hasBlockEntity()) + if (newBlockEntity == null) { - oldBlockEntity = this.getBlockEntity(blockPos_1, LevelChunk.EntityCreationType.CHECK); - if (oldBlockEntity != null) + newBlockEntity = ((EntityBlock) newBlock).newBlockEntity(blockPos_1, newBlockState); + if (newBlockEntity != null) { - oldBlockEntity.setBlockState(oldBlockState); - updateBlockEntityTicker(oldBlockEntity); + addAndRegisterBlockEntity(newBlockEntity); } } - - if (oldBlockState.hasBlockEntity()) + if (newBlockEntity != oldBlockEntity && newBlockEntity != null) { - if (newBlockEntity == null) - { - newBlockEntity = ((EntityBlock) newBlock).newBlockEntity(blockPos_1, newBlockState); - } - if (newBlockEntity != oldBlockEntity && newBlockEntity != null) - { - newBlockEntity.clearRemoved(); - this.level.setBlockEntity(newBlockEntity); - newBlockEntity.setBlockState(newBlockState); - updateBlockEntityTicker(newBlockEntity); - } + newBlockEntity.clearRemoved(); + this.level.setBlockEntity(newBlockEntity); + newBlockEntity.setBlockState(newBlockState); + updateBlockEntityTicker(newBlockEntity); } - - if (!this.level.isClientSide) - { - newBlockState.onPlace(this.level, blockPos_1, oldBlockState, boolean_1); //This can call setblockstate! (e.g. hopper does) - } - - markUnsaved(); - return oldBlockState; } } + + markUnsaved(); + return oldBlockState; } } diff --git a/src/main/java/carpet/mixins/Level_fillUpdatesMixin.java b/src/main/java/carpet/mixins/Level_fillUpdatesMixin.java index cb050c7a..0b141729 100644 --- a/src/main/java/carpet/mixins/Level_fillUpdatesMixin.java +++ b/src/main/java/carpet/mixins/Level_fillUpdatesMixin.java @@ -23,11 +23,11 @@ public abstract class Level_fillUpdatesMixin @Redirect(method = "setBlock(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;II)Z", at = @At( //setBlockState main value = "INVOKE", - target = "Lnet/minecraft/world/level/Level;blockUpdated(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/Block;)V" + target = "Lnet/minecraft/world/level/Level;updateNeighborsAt(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/Block;)V" )) private void updateNeighborsMaybe(Level world, BlockPos blockPos, Block block) { - if (!CarpetSettings.impendingFillSkipUpdates.get()) world.blockUpdated(blockPos, block); + if (!CarpetSettings.impendingFillSkipUpdates.get()) world.updateNeighborsAt(blockPos, block); } } diff --git a/src/main/java/carpet/mixins/Level_movableBEMixin.java b/src/main/java/carpet/mixins/Level_movableBEMixin.java index 0f98fde7..d774f158 100644 --- a/src/main/java/carpet/mixins/Level_movableBEMixin.java +++ b/src/main/java/carpet/mixins/Level_movableBEMixin.java @@ -33,17 +33,13 @@ public abstract class Level_movableBEMixin implements LevelInterface, LevelAcces @Shadow public abstract void sendBlockUpdated(BlockPos var1, BlockState var2, BlockState var3, int var4); - - @Shadow - public abstract void updateNeighborsAt(BlockPos blockPos_1, Block block_1); - - @Shadow - public abstract void onBlockStateChange(BlockPos blockPos_1, BlockState blockState_1, BlockState blockState_2); @Shadow public abstract void updateNeighbourForOutputSignal(BlockPos pos, Block block); @Shadow public abstract boolean isDebug(); + @Shadow public abstract void updatePOIOnBlockStateChange(final BlockPos blockPos, final BlockState blockState, final BlockState blockState2); + /** * @author 2No2Name */ @@ -57,7 +53,7 @@ public abstract class Level_movableBEMixin implements LevelInterface, LevelAcces BlockState blockState_2; if (newBlockEntity != null && block_1 instanceof EntityBlock) { - blockState_2 = ((WorldChunkInterface) worldChunk_1).setBlockStateWithBlockEntity(blockPos_1, blockState_1, newBlockEntity, (int_1 & 64) != 0); + blockState_2 = ((WorldChunkInterface) worldChunk_1).setBlockStateWithBlockEntity(blockPos_1, blockState_1, newBlockEntity, int_1); if (newBlockEntity instanceof LidBlockEntity) { scheduleTick(blockPos_1, block_1, 5); @@ -65,56 +61,46 @@ public abstract class Level_movableBEMixin implements LevelInterface, LevelAcces } else { - blockState_2 = worldChunk_1.setBlockState(blockPos_1, blockState_1, (int_1 & 64) != 0); + blockState_2 = worldChunk_1.setBlockState(blockPos_1, blockState_1, int_1); } if (blockState_2 == null) { return false; } - else + + BlockState blockState_3 = this.getBlockState(blockPos_1); + + if (blockState_3 == blockState_1) { - BlockState blockState_3 = this.getBlockState(blockPos_1); - - if (blockState_3 != blockState_2 && (blockState_3.getLightBlock() != blockState_2.getLightBlock() || blockState_3.getLightEmission() != blockState_2.getLightEmission() || blockState_3.useShapeForLightOcclusion() || blockState_2.useShapeForLightOcclusion())) + if (blockState_2 != blockState_3) { - ProfilerFiller profiler = Profiler.get(); - profiler.push("queueCheckLight"); - this.getChunkSource().getLightEngine().checkBlock(blockPos_1); - profiler.pop(); + this.setBlocksDirty(blockPos_1, blockState_2, blockState_3); } - if (blockState_3 == blockState_1) + if ((int_1 & 2) != 0 && (!this.isClientSide || (int_1 & 4) == 0) && (this.isClientSide || worldChunk_1.getFullStatus() != null && worldChunk_1.getFullStatus().isOrAfter(FullChunkStatus.BLOCK_TICKING))) { - if (blockState_2 != blockState_3) - { - this.setBlocksDirty(blockPos_1, blockState_2, blockState_3); - } - - if ((int_1 & 2) != 0 && (!this.isClientSide || (int_1 & 4) == 0) && (this.isClientSide || worldChunk_1.getFullStatus() != null && worldChunk_1.getFullStatus().isOrAfter(FullChunkStatus.BLOCK_TICKING))) - { - this.sendBlockUpdated(blockPos_1, blockState_2, blockState_1, int_1); - } - - if (!this.isClientSide && (int_1 & 1) != 0) - { - this.updateNeighborsAt(blockPos_1, blockState_2.getBlock()); - if (blockState_1.hasAnalogOutputSignal()) - { - updateNeighbourForOutputSignal(blockPos_1, block_1); - } - } - - if ((int_1 & 16) == 0) - { - int int_2 = int_1 & -34; - blockState_2.updateIndirectNeighbourShapes(this, blockPos_1, int_2); // prepare - blockState_1.updateNeighbourShapes(this, blockPos_1, int_2); // updateNeighbours - blockState_1.updateIndirectNeighbourShapes(this, blockPos_1, int_2); // prepare - } - this.onBlockStateChange(blockPos_1, blockState_2, blockState_3); + this.sendBlockUpdated(blockPos_1, blockState_2, blockState_1, int_1); } - return true; + + if (!this.isClientSide && (int_1 & 1) != 0) + { + this.updateNeighborsAt(blockPos_1, blockState_2.getBlock()); + if (blockState_1.hasAnalogOutputSignal()) + { + updateNeighbourForOutputSignal(blockPos_1, block_1); + } + } + + if ((int_1 & 16) == 0) + { + int int_2 = int_1 & -34; + blockState_2.updateIndirectNeighbourShapes(this, blockPos_1, int_2); // prepare + blockState_1.updateNeighbourShapes(this, blockPos_1, int_2); // updateNeighbours + blockState_1.updateIndirectNeighbourShapes(this, blockPos_1, int_2); // prepare + } + updatePOIOnBlockStateChange(blockPos_1, blockState_2, blockState_3); } + return true; } } diff --git a/src/main/java/carpet/mixins/PickaxeItem_missingToolsMixin.java b/src/main/java/carpet/mixins/PickaxeItem_missingToolsMixin.java deleted file mode 100644 index 201c34df..00000000 --- a/src/main/java/carpet/mixins/PickaxeItem_missingToolsMixin.java +++ /dev/null @@ -1,36 +0,0 @@ -package carpet.mixins; - -import carpet.CarpetSettings; -import net.minecraft.core.component.DataComponents; -import net.minecraft.tags.TagKey; -import net.minecraft.world.item.DiggerItem; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.PickaxeItem; -import net.minecraft.world.item.ToolMaterial; -import net.minecraft.world.item.component.Tool; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.SoundType; -import net.minecraft.world.level.block.state.BlockState; -import org.spongepowered.asm.mixin.Mixin; - -@Mixin(PickaxeItem.class) -public class PickaxeItem_missingToolsMixin extends DiggerItem -{ - - - protected PickaxeItem_missingToolsMixin(final ToolMaterial toolMaterial, final TagKey tagKey, final float f, final float g, final Properties properties) - { - super(toolMaterial, tagKey, f, g, properties); - } - - @Override - public float getDestroySpeed(ItemStack stack, BlockState state) { - if (CarpetSettings.missingTools && state.getSoundType() == SoundType.GLASS) - { - final Tool tool = stack.get(DataComponents.TOOL); - return tool != null ? tool.getMiningSpeed(Blocks.STONE.defaultBlockState()) : super.getDestroySpeed(stack, state); - } - return super.getDestroySpeed(stack, state); - } -} diff --git a/src/main/java/carpet/mixins/RedstoneWireBlock_fastMixin.java b/src/main/java/carpet/mixins/RedstoneWireBlock_fastMixin.java index ec5caaf7..5cdceb9a 100644 --- a/src/main/java/carpet/mixins/RedstoneWireBlock_fastMixin.java +++ b/src/main/java/carpet/mixins/RedstoneWireBlock_fastMixin.java @@ -119,7 +119,7 @@ public abstract class RedstoneWireBlock_fastMixin implements RedstoneWireBlockIn fastUpdate(world_1, blockPos_1, blockState_1, o, sup); } - @Redirect(method = "onRemove", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/RedStoneWireBlock;updatePowerStrength(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/redstone/Orientation;Z)V")) + @Redirect(method = "affectNeighborsAfterRemoval", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/RedStoneWireBlock;updatePowerStrength(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/redstone/Orientation;Z)V")) private void redirectOnStateReplacedUpdate(RedStoneWireBlock self, Level world_1, BlockPos blockPos_1, BlockState blockState_1, Orientation o, boolean sup) { fastUpdate(world_1, blockPos_1, blockState_1, o, sup); } diff --git a/src/main/java/carpet/mixins/SetBlockCommand_fillUpdatesMixin.java b/src/main/java/carpet/mixins/SetBlockCommand_fillUpdatesMixin.java index 95df92ef..20c3998a 100644 --- a/src/main/java/carpet/mixins/SetBlockCommand_fillUpdatesMixin.java +++ b/src/main/java/carpet/mixins/SetBlockCommand_fillUpdatesMixin.java @@ -14,10 +14,10 @@ public class SetBlockCommand_fillUpdatesMixin { @Redirect(method = "setBlock", at = @At( value = "INVOKE", - target = "Lnet/minecraft/server/level/ServerLevel;blockUpdated(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/Block;)V" + target = "Lnet/minecraft/server/level/ServerLevel;updateNeighborsAt(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/Block;)V" )) private static void conditionalUpdating(ServerLevel serverWorld, BlockPos blockPos_1, Block block_1) { - if (CarpetSettings.fillUpdates) serverWorld.blockUpdated(blockPos_1, block_1); + if (CarpetSettings.fillUpdates) serverWorld.updateNeighborsAt(blockPos_1, block_1); } } diff --git a/src/main/java/carpet/mixins/StructureTemplate_fillUpdatesMixin.java b/src/main/java/carpet/mixins/StructureTemplate_fillUpdatesMixin.java index bd9cbb44..8d2938b7 100644 --- a/src/main/java/carpet/mixins/StructureTemplate_fillUpdatesMixin.java +++ b/src/main/java/carpet/mixins/StructureTemplate_fillUpdatesMixin.java @@ -15,12 +15,12 @@ public class StructureTemplate_fillUpdatesMixin { @Redirect( method = "placeInWorld", at = @At( value = "INVOKE", - target = "Lnet/minecraft/world/level/ServerLevelAccessor;blockUpdated(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/Block;)V" + target = "Lnet/minecraft/world/level/ServerLevelAccessor;updateNeighborsAt(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/Block;)V" )) private void skipUpdateNeighbours(ServerLevelAccessor serverWorldAccess, BlockPos pos, Block block) { if (!CarpetSettings.impendingFillSkipUpdates.get()) - serverWorldAccess.blockUpdated(pos, block); + serverWorldAccess.updateNeighborsAt(pos, block); } @Redirect(method = "placeInWorld", at = @At( diff --git a/src/main/java/carpet/mixins/TicketStorage_scarpetMixin.java b/src/main/java/carpet/mixins/TicketStorage_scarpetMixin.java new file mode 100644 index 00000000..08cd3d0d --- /dev/null +++ b/src/main/java/carpet/mixins/TicketStorage_scarpetMixin.java @@ -0,0 +1,23 @@ +package carpet.mixins; + +import carpet.fakes.TicketsFetcherInterface; +import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; +import net.minecraft.server.level.Ticket; +import net.minecraft.world.level.TicketStorage; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; + +import java.util.List; + +@Mixin(TicketStorage.class) +public class TicketStorage_scarpetMixin implements TicketsFetcherInterface +{ + @Shadow @Final private Long2ObjectOpenHashMap> tickets; + + @Override + public Long2ObjectOpenHashMap> getTicketsByPosition() + { + return tickets; + } +} diff --git a/src/main/java/carpet/script/ScriptCommand.java b/src/main/java/carpet/script/ScriptCommand.java index e8bc716a..d551f5bd 100644 --- a/src/main/java/carpet/script/ScriptCommand.java +++ b/src/main/java/carpet/script/ScriptCommand.java @@ -675,10 +675,7 @@ public class ScriptCommand if (replacement == null || replacement.test( new BlockInWorld(world, mbpos, true))) { - BlockEntity tileentity = world.getBlockEntity(mbpos); - Clearable.tryClear(tileentity); - - if (block.place(world, mbpos, 2)) + if (block.place(world, mbpos, 2 & Block.UPDATE_SKIP_BLOCK_ENTITY_SIDEEFFECTS)) { ++affected; } @@ -701,7 +698,7 @@ public class ScriptCommand { mbpos.set(x + area.minX(), y + area.minY(), z + area.minZ()); Block blokc = world.getBlockState(mbpos).getBlock(); - world.blockUpdated(mbpos, blokc); + world.updateNeighborsAt(mbpos, blokc); } } } diff --git a/src/main/java/carpet/script/api/WorldAccess.java b/src/main/java/carpet/script/api/WorldAccess.java index 4144d325..5f173ee4 100644 --- a/src/main/java/carpet/script/api/WorldAccess.java +++ b/src/main/java/carpet/script/api/WorldAccess.java @@ -50,6 +50,7 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.Ticket; import net.minecraft.server.level.TicketType; import net.minecraft.sounds.SoundEvents; +import net.minecraft.tags.ItemTags; import net.minecraft.tags.TagKey; import net.minecraft.world.level.ServerExplosion; import net.minecraft.world.level.chunk.ChunkGenerator; @@ -99,12 +100,10 @@ import net.minecraft.world.entity.ai.village.poi.PoiRecord; import net.minecraft.world.entity.ai.village.poi.PoiType; import net.minecraft.world.entity.item.FallingBlockEntity; import net.minecraft.world.item.BlockItem; -import net.minecraft.world.item.DiggerItem; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.item.ShearsItem; -import net.minecraft.world.item.SwordItem; import net.minecraft.world.item.TridentItem; import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.item.enchantment.Enchantments; @@ -149,7 +148,7 @@ public class WorldAccess DIRECTION_MAP.put("x", Direction.EAST); } - private static final Map> ticketTypes = Map.of( + private static final Map ticketTypes = Map.of( "portal", TicketType.PORTAL, "teleport", TicketType.ENDER_PEARL, "unknown", TicketType.UNKNOWN @@ -646,7 +645,7 @@ public class WorldAccess { ServerLevel world = ((CarpetContext) c).level(); DistanceManager foo = world.getChunkSource().chunkMap.getDistanceManager(); - Long2ObjectOpenHashMap>> levelTickets = Vanilla.ChunkTicketManager_getTicketsByPosition(foo); + Long2ObjectOpenHashMap> levelTickets = Vanilla.ChunkTicketManager_getTicketsByPosition(foo); List res = new ArrayList<>(); if (lv.isEmpty()) @@ -654,7 +653,7 @@ public class WorldAccess for (long key : levelTickets.keySet()) { ChunkPos chpos = new ChunkPos(key); - for (Ticket ticket : levelTickets.get(key)) + for (Ticket ticket : levelTickets.get(key)) { res.add(ListValue.of( new StringValue(ticket.getType().toString()), @@ -669,10 +668,10 @@ public class WorldAccess { BlockArgument blockArgument = BlockArgument.findIn((CarpetContext) c, lv, 0); BlockPos pos = blockArgument.block.getPos(); - SortedArraySet> tickets = levelTickets.get(new ChunkPos(pos).toLong()); + List tickets = levelTickets.get(new ChunkPos(pos).toLong()); if (tickets != null) { - for (Ticket ticket : tickets) + for (Ticket ticket : tickets) { res.add(ListValue.of( new StringValue(ticket.getType().toString()), @@ -819,8 +818,7 @@ public class WorldAccess Boolean[] result = new Boolean[]{true}; cc.server().executeBlocking(() -> { - Clearable.tryClear(world.getBlockEntity(targetPos)); - boolean success = world.setBlock(targetPos, finalSourceBlockState, 2); + boolean success = world.setBlock(targetPos, finalSourceBlockState, Block.UPDATE_CLIENTS | Block.UPDATE_SKIP_BLOCK_ENTITY_SIDEEFFECTS ); if (finalData != null) { BlockEntity be = world.getBlockEntity(targetPos); @@ -914,11 +912,11 @@ public class WorldAccess //postMine() durability from item classes float hardness = state.getDestroySpeed(world, where); int damageAmount = 0; - if ((item instanceof DiggerItem && hardness > 0.0) || item instanceof ShearsItem) + if ((tool.is(ItemTags.PICKAXES) && hardness > 0.0) || item instanceof ShearsItem) { damageAmount = 1; } - else if (item instanceof TridentItem || item instanceof SwordItem) + else if (item instanceof TridentItem || tool.is(ItemTags.SWORDS)) { damageAmount = 2; } @@ -1678,7 +1676,7 @@ public class WorldAccess throw new InternalExpressionException("'add_chunk_ticket' requires block position, ticket type and radius"); } String type = lv.get(locator.offset).getString(); - TicketType ticket = ticketTypes.get(type.toLowerCase(Locale.ROOT)); + TicketType ticket = ticketTypes.get(type.toLowerCase(Locale.ROOT)); if (ticket == null) { throw new InternalExpressionException("Unknown ticket type: " + type); @@ -1692,15 +1690,15 @@ public class WorldAccess ChunkPos target = new ChunkPos(pos); if (ticket == TicketType.PORTAL) // portal { - cc.level().getChunkSource().addRegionTicket(TicketType.PORTAL, target, radius, pos); + cc.level().getChunkSource().addTicketWithRadius(TicketType.PORTAL, target, radius); } else if (ticket == TicketType.ENDER_PEARL) // post teleport { - cc.level().getChunkSource().addRegionTicket(TicketType.ENDER_PEARL, target, radius, target); + cc.level().getChunkSource().addTicketWithRadius(TicketType.ENDER_PEARL, target, radius); } else { - cc.level().getChunkSource().addRegionTicket(TicketType.UNKNOWN, target, radius, target); + cc.level().getChunkSource().addTicketWithRadius(TicketType.UNKNOWN, target, radius); } return new NumericValue(ticket.timeout()); }); diff --git a/src/main/java/carpet/script/external/Vanilla.java b/src/main/java/carpet/script/external/Vanilla.java index 96ec1a26..fc5b338b 100644 --- a/src/main/java/carpet/script/external/Vanilla.java +++ b/src/main/java/carpet/script/external/Vanilla.java @@ -4,7 +4,7 @@ import carpet.CarpetSettings; import carpet.fakes.BiomeInterface; import carpet.fakes.BlockPredicateInterface; import carpet.fakes.BlockStateArgumentInterface; -import carpet.fakes.ChunkTicketManagerInterface; +import carpet.fakes.TicketsFetcherInterface; import carpet.fakes.CommandDispatcherInterface; import carpet.fakes.EntityInterface; import carpet.fakes.InventoryBearerInterface; @@ -122,9 +122,9 @@ public class Vanilla return ((ServerWorldInterface) world).getWorldPropertiesCM(); } - public static Long2ObjectOpenHashMap>> ChunkTicketManager_getTicketsByPosition(DistanceManager ticketManager) + public static Long2ObjectOpenHashMap> ChunkTicketManager_getTicketsByPosition(DistanceManager ticketManager) { - return ((ChunkTicketManagerInterface) ticketManager).getTicketsByPosition(); + return ((TicketsFetcherInterface) ticketManager).getTicketsByPosition(); } public static DensityFunction.Visitor RandomState_getVisitor(RandomState randomState) diff --git a/src/main/java/carpet/script/utils/EntityTools.java b/src/main/java/carpet/script/utils/EntityTools.java index 5849e50a..0b7e1cb6 100644 --- a/src/main/java/carpet/script/utils/EntityTools.java +++ b/src/main/java/carpet/script/utils/EntityTools.java @@ -12,7 +12,7 @@ public class EntityTools */ public static void genericJump(Entity e) { - if (!e.onGround() && !e.isInWaterOrBubble() && !e.isInLava()) + if (!e.onGround() && !e.isInLiquid()) { return; } diff --git a/src/main/java/carpet/utils/Messenger.java b/src/main/java/carpet/utils/Messenger.java index fc7695fc..18dabb68 100644 --- a/src/main/java/carpet/utils/Messenger.java +++ b/src/main/java/carpet/utils/Messenger.java @@ -17,6 +17,7 @@ import net.minecraft.world.phys.Vec3; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.net.URI; import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -147,11 +148,11 @@ public class Messenger Style previousStyle = previousMessage.getStyle(); MutableComponent ret = previousMessage; previousMessage.setStyle(switch (desc.charAt(0)) { - case '?' -> previousStyle.withClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, message.substring(1))); - case '!' -> previousStyle.withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, message.substring(1))); - case '^' -> previousStyle.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, c(message.substring(1)))); - case '@' -> previousStyle.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, message.substring(1))); - case '&' -> previousStyle.withClickEvent(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, message.substring(1))); + case '?' -> previousStyle.withClickEvent(new ClickEvent.SuggestCommand(message.substring(1))); + case '!' -> previousStyle.withClickEvent(new ClickEvent.RunCommand(message.substring(1))); + case '^' -> previousStyle.withHoverEvent(new HoverEvent.ShowText(c(message.substring(1)))); + case '@' -> previousStyle.withClickEvent(new ClickEvent.OpenUrl(URI.create(message.substring(1)))); + case '&' -> previousStyle.withClickEvent(new ClickEvent.CopyToClipboard(message.substring(1))); default -> { // Create a new component ret = Component.literal(str); ret.setStyle(parseStyle(desc)); diff --git a/src/main/java/carpet/utils/PerimeterDiagnostics.java b/src/main/java/carpet/utils/PerimeterDiagnostics.java index 4c3d754d..416fd702 100644 --- a/src/main/java/carpet/utils/PerimeterDiagnostics.java +++ b/src/main/java/carpet/utils/PerimeterDiagnostics.java @@ -5,6 +5,7 @@ import java.util.List; import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerLevel; import net.minecraft.tags.FluidTags; +import net.minecraft.util.random.Weighted; import net.minecraft.world.entity.AgeableMob; import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; @@ -162,9 +163,10 @@ public class PerimeterDiagnostics if (sle == null || !worldServer.getChunkSource().getGenerator().getMobsAt(worldServer.getBiome(pos), worldServer.structureManager(), ctype, pos).unwrap().contains(sle)) { sle = null; - for (MobSpawnSettings.SpawnerData sle: worldServer.getChunkSource().getGenerator().getMobsAt(worldServer.getBiome(pos), worldServer.structureManager(), ctype, pos).unwrap()) + for (Weighted wsle: worldServer.getChunkSource().getGenerator().getMobsAt(worldServer.getBiome(pos), worldServer.structureManager(), ctype, pos).unwrap()) { - if (el.getType() == sle.type) + MobSpawnSettings.SpawnerData sle = wsle.value(); + if (el.getType() == sle.type()) { this.sle = sle; break; @@ -176,7 +178,7 @@ public class PerimeterDiagnostics } } - if (SpawnPlacements.isSpawnPositionOk(sle.type, worldServer, pos)) + if (SpawnPlacements.isSpawnPositionOk(sle.type(), worldServer, pos)) { el.moveTo(pos.getX() + 0.5F, pos.getY(), pos.getZ()+0.5F, 0.0F, 0.0F); return el.checkSpawnObstruction(worldServer) && el.checkSpawnRules(worldServer, EntitySpawnReason.NATURAL) && diff --git a/src/main/java/carpet/utils/SpawnOverrides.java b/src/main/java/carpet/utils/SpawnOverrides.java index f12d783d..d4c05f40 100644 --- a/src/main/java/carpet/utils/SpawnOverrides.java +++ b/src/main/java/carpet/utils/SpawnOverrides.java @@ -8,7 +8,7 @@ import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; -import net.minecraft.util.random.WeightedRandomList; +import net.minecraft.util.random.WeightedList; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.MobCategory; import net.minecraft.world.level.StructureManager; @@ -32,28 +32,28 @@ public class SpawnOverrides { static { addOverride(() -> CarpetSettings.huskSpawningInTemples, MobCategory.MONSTER, BuiltinStructures.DESERT_PYRAMID, StructureSpawnOverride.BoundingBoxType.STRUCTURE, - WeightedRandomList.create(new MobSpawnSettings.SpawnerData(EntityType.HUSK, 1, 1, 1)) + WeightedList.of(new MobSpawnSettings.SpawnerData(EntityType.HUSK, 1, 1)) ); addOverride(() -> CarpetSettings.shulkerSpawningInEndCities, MobCategory.MONSTER, BuiltinStructures.END_CITY, StructureSpawnOverride.BoundingBoxType.PIECE, - WeightedRandomList.create(new MobSpawnSettings.SpawnerData(EntityType.SHULKER, 10, 4, 4)) + WeightedList.of(new MobSpawnSettings.SpawnerData(EntityType.SHULKER, 4, 4)) ); addOverride(() -> CarpetSettings.piglinsSpawningInBastions, MobCategory.MONSTER, BuiltinStructures.BASTION_REMNANT, StructureSpawnOverride.BoundingBoxType.PIECE, - WeightedRandomList.create( - new MobSpawnSettings.SpawnerData(EntityType.PIGLIN_BRUTE, 5, 1, 2), - new MobSpawnSettings.SpawnerData(EntityType.PIGLIN, 10, 2, 4), - new MobSpawnSettings.SpawnerData(EntityType.HOGLIN, 2, 1, 2) - ) + WeightedList.builder() + .add(new MobSpawnSettings.SpawnerData(EntityType.PIGLIN_BRUTE,1, 2), 5) + .add(new MobSpawnSettings.SpawnerData(EntityType.PIGLIN, 2, 4), 10) + .add(new MobSpawnSettings.SpawnerData(EntityType.HOGLIN, 1, 2), 2) + .build() ); } public static void addOverride(BooleanSupplier when, MobCategory cat, ResourceKey poo, - StructureSpawnOverride.BoundingBoxType type, WeightedRandomList spawns) { + StructureSpawnOverride.BoundingBoxType type, WeightedList spawns) { carpetOverrides.put(Pair.of(cat, poo), Pair.of(when, new StructureSpawnOverride(type, spawns))); } - public static WeightedRandomList test(StructureManager structureFeatureManager, LongSet foo, - MobCategory cat, Structure confExisting, BlockPos where) { + public static WeightedList test(StructureManager structureFeatureManager, LongSet foo, + MobCategory cat, Structure confExisting, BlockPos where) { ResourceLocation resource = structureFeatureManager.registryAccess().lookupOrThrow(Registries.STRUCTURE).getKey(confExisting); ResourceKey key = ResourceKey.create(Registries.STRUCTURE, resource); final Pair spawnData = carpetOverrides.get(Pair.of(cat, key)); diff --git a/src/main/java/carpet/utils/SpawnReporter.java b/src/main/java/carpet/utils/SpawnReporter.java index 106786b3..0b21446e 100644 --- a/src/main/java/carpet/utils/SpawnReporter.java +++ b/src/main/java/carpet/utils/SpawnReporter.java @@ -12,6 +12,8 @@ import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerLevel; import net.minecraft.tags.BlockTags; import net.minecraft.util.Mth; +import net.minecraft.util.random.Weighted; +import net.minecraft.util.random.WeightedList; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; @@ -389,8 +391,8 @@ public class SpawnReporter } // yeeted from NaturalSpawner - temporary access fix - private static List getSpawnEntries(ServerLevel serverLevel, StructureManager structureManager, ChunkGenerator chunkGenerator, MobCategory mobCategory, BlockPos blockPos, @Nullable Holder holder) { - return NaturalSpawner.isInNetherFortressBounds(blockPos, serverLevel, mobCategory, structureManager) ? NetherFortressStructure.FORTRESS_ENEMIES.unwrap() : chunkGenerator.getMobsAt(holder != null ? holder : serverLevel.getBiome(blockPos), structureManager, mobCategory, blockPos).unwrap(); + private static WeightedList getSpawnEntries(ServerLevel serverLevel, StructureManager structureManager, ChunkGenerator chunkGenerator, MobCategory mobCategory, BlockPos blockPos, @Nullable Holder holder) { + return NaturalSpawner.isInNetherFortressBounds(blockPos, serverLevel, mobCategory, structureManager) ? NetherFortressStructure.FORTRESS_ENEMIES : chunkGenerator.getMobsAt(holder != null ? holder : serverLevel.getBiome(blockPos), structureManager, mobCategory, blockPos); } public static List report(BlockPos pos, ServerLevel worldIn) @@ -407,21 +409,22 @@ public class SpawnReporter for (MobCategory category : cachedMobCategories()) { String categoryCode = String.valueOf(category).substring(0, 3); - List lst = getSpawnEntries(worldIn, worldIn.structureManager(), worldIn.getChunkSource().getGenerator(), category, pos, worldIn.getBiome(pos)); + WeightedList lst = getSpawnEntries(worldIn, worldIn.structureManager(), worldIn.getChunkSource().getGenerator(), category, pos, worldIn.getBiome(pos)); if (lst != null && !lst.isEmpty()) { - for (MobSpawnSettings.SpawnerData spawnEntry : lst) + for (Weighted wspawnEntry : lst.unwrap()) { - if (SpawnPlacements.getPlacementType(spawnEntry.type) == null) + MobSpawnSettings.SpawnerData spawnEntry = wspawnEntry.value(); + if (SpawnPlacements.getPlacementType(spawnEntry.type()) == null) continue; // vanilla bug - boolean canSpawn = SpawnPlacements.isSpawnPositionOk(spawnEntry.type, worldIn, pos); + boolean canSpawn = SpawnPlacements.isSpawnPositionOk(spawnEntry.type(), worldIn, pos); int willSpawn = -1; boolean fits = false; Mob mob; try { - mob = (Mob) spawnEntry.type.create(worldIn, EntitySpawnReason.NATURAL); + mob = (Mob) spawnEntry.type().create(worldIn, EntitySpawnReason.NATURAL); } catch (Exception e) { @@ -467,7 +470,7 @@ public class SpawnReporter try { - mob = (Mob) spawnEntry.type.create(worldIn, EntitySpawnReason.NATURAL); + mob = (Mob) spawnEntry.type().create(worldIn, EntitySpawnReason.NATURAL); } catch (Exception e) { @@ -479,12 +482,12 @@ public class SpawnReporter String mobTypeName = mob.getType().getDescription().getString(); //String pack_size = Integer.toString(mob.getMaxSpawnClusterSize());//String.format("%d-%d", animal.minGroupCount, animal.maxGroupCount); - int weight = spawnEntry.getWeight().asInt(); + int weight = wspawnEntry.weight(); if (canSpawn) { String color = (fits && willSpawn > 0) ? "e" : "gi"; rep.add(Messenger.c( - String.format("%s %s: %s (%d:%d-%d/%d), can: ", color, categoryCode, mobTypeName, weight, spawnEntry.minCount, spawnEntry.maxCount, mob.getMaxSpawnClusterSize()), + String.format("%s %s: %s (%d:%d-%d/%d), can: ", color, categoryCode, mobTypeName, weight, spawnEntry.minCount(), spawnEntry.maxCount(), mob.getMaxSpawnClusterSize()), "l YES", color + " , fit: ", (fits ? "l YES" : "r NO"), @@ -494,7 +497,7 @@ public class SpawnReporter } else { - rep.add(Messenger.c(String.format("gi %s: %s (%d:%d-%d/%d), can: ", categoryCode, mobTypeName, weight, spawnEntry.minCount, spawnEntry.maxCount, mob.getMaxSpawnClusterSize()), "n NO")); + rep.add(Messenger.c(String.format("gi %s: %s (%d:%d-%d/%d), can: ", categoryCode, mobTypeName, weight, spawnEntry.minCount(), spawnEntry.maxCount(), mob.getMaxSpawnClusterSize()), "n NO")); } killEntity(mob); } diff --git a/src/main/resources/carpet.accesswidener b/src/main/resources/carpet.accesswidener index de24c461..fda730bd 100644 --- a/src/main/resources/carpet.accesswidener +++ b/src/main/resources/carpet.accesswidener @@ -13,7 +13,6 @@ accessible class net/minecraft/world/level/block/entity/SculkSensorBlockEntity$V accessible method net/minecraft/world/level/border/WorldBorder getListeners ()Ljava/util/List; accessible method net/minecraft/world/level/redstone/DefaultRedstoneWireEvaluator calculateTargetStrength (Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;)I -accessible method net/minecraft/server/level/DistanceManager purgeStaleTickets ()V #cause I don't want to deal with the interfaces until stuff is stable accessible method net/minecraft/world/level/block/entity/SkullBlockEntity fetchGameProfile (Ljava/lang/String;)Ljava/util/concurrent/CompletableFuture; diff --git a/src/main/resources/carpet.mixins.json b/src/main/resources/carpet.mixins.json index dee7b167..240d70e5 100644 --- a/src/main/resources/carpet.mixins.json +++ b/src/main/resources/carpet.mixins.json @@ -42,11 +42,9 @@ "ChunkHolder_scarpetChunkCreationMixin", "ThreadedLevelLightEngine_scarpetMixin", "DynamicGraphMinFixedPoint_resetChunkInterface", - "DistanceManager_scarpetChunkCreationMixin", "LevelLightEngine_scarpetChunkCreationMixin", "LayerLightEngine_scarpetChunkCreationMixin", "LayerLightSectionStorage_scarpetChunkCreationMixin", - "DistanceManager_spawnChunksMixin", "ThreadedLevelLightEngine_scarpetChunkCreationMixin", "LivingEntity_cleanLogsMixin", "MobMixin", @@ -117,8 +115,7 @@ "InfestedBlock_gravelMixin", "PistonBaseBlock_qcMixin", "DispenserBlock_qcMixin", - - "PickaxeItem_missingToolsMixin", + "Item_missingToolsMixin", "WitherBoss_moreBlueMixin", "ArmorStand_scarpetMarkerMixin", "Entity_scarpetEventsMixin", @@ -142,6 +139,7 @@ "AbstractCraftingMenu_scarpetMixin", "AbstractFurnaceMenu_scarpetMixin", "DistanceManager_scarpetMixin", + "TicketStorage_scarpetMixin", "PoiRecord_scarpetMixin", "ServerLevel_scarpetMixin", "PersistentEntitySectionManager_scarpetMixin", From c241594eb6afb9e44253a6d45d4aaec9d1da555e Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Thu, 9 Jan 2025 13:42:42 +0100 Subject: [PATCH 040/232] 1.4.162 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index b21e76d9..b79a9aa3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G fabric_version=0.110.5+1.21.4 # Mod Properties - mod_version = 1.4.161 + mod_version = 1.4.162 maven_group = carpet archives_base_name = fabric-carpet From fd098151c41704b1b7f84325d1fb59534078476c Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Thu, 16 Jan 2025 12:43:30 +0100 Subject: [PATCH 041/232] 25w03a --- gradle.properties | 2 +- .../carpet/commands/PerimeterInfoCommand.java | 2 +- .../ExperienceOrb_xpNoCooldownMixin.java | 7 ++-- .../Guardian_renewableSpongesMixin.java | 2 +- .../mixins/LevelChunk_fillUpdatesMixin.java | 6 +-- .../mixins/LevelChunk_movableBEMixin.java | 35 +++++++++--------- .../StructureBlockEntity_limitsMixin.java | 4 +- .../mixins/StructureBlockRenderer_mixin.java | 4 +- .../carpet/patches/EntityPlayerMPFake.java | 2 +- .../java/carpet/script/CarpetExpression.java | 37 +++++++++++++++++++ src/main/java/carpet/script/Expression.java | 6 +++ .../java/carpet/script/ScriptCommand.java | 20 ++++++++++ .../java/carpet/script/api/Auxiliary.java | 2 +- src/main/java/carpet/script/api/Entities.java | 2 +- .../java/carpet/script/value/EntityValue.java | 2 +- src/main/java/carpet/utils/BlockInfo.java | 2 +- .../carpet/utils/PerimeterDiagnostics.java | 2 +- src/main/java/carpet/utils/SpawnReporter.java | 2 +- 18 files changed, 100 insertions(+), 39 deletions(-) diff --git a/gradle.properties b/gradle.properties index b79a9aa3..469ac583 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=25w02a + minecraft_version=25w03a loader_version=0.16.10 jsr305_version=3.0.2 fabric_version=0.110.5+1.21.4 diff --git a/src/main/java/carpet/commands/PerimeterInfoCommand.java b/src/main/java/carpet/commands/PerimeterInfoCommand.java index f28885bd..7240fc8a 100644 --- a/src/main/java/carpet/commands/PerimeterInfoCommand.java +++ b/src/main/java/carpet/commands/PerimeterInfoCommand.java @@ -56,7 +56,7 @@ public class PerimeterInfoCommand { nbttagcompound.putString("id", mobId); Entity baseEntity = EntityType.loadEntityRecursive(nbttagcompound, source.getLevel(), EntitySpawnReason.COMMAND, (entity_1x) -> { - entity_1x.moveTo(new BlockPos(pos.getX(), source.getLevel().getMinY()-10, pos.getZ()), entity_1x.getYRot(), entity_1x. getXRot()); + entity_1x.snapTo(new BlockPos(pos.getX(), source.getLevel().getMinY()-10, pos.getZ()), entity_1x.getYRot(), entity_1x. getXRot()); return !source.getLevel().addWithUUID(entity_1x) ? null : entity_1x; }); if (!(baseEntity instanceof Mob)) diff --git a/src/main/java/carpet/mixins/ExperienceOrb_xpNoCooldownMixin.java b/src/main/java/carpet/mixins/ExperienceOrb_xpNoCooldownMixin.java index 0b04c22b..7c590b6e 100644 --- a/src/main/java/carpet/mixins/ExperienceOrb_xpNoCooldownMixin.java +++ b/src/main/java/carpet/mixins/ExperienceOrb_xpNoCooldownMixin.java @@ -19,9 +19,6 @@ public abstract class ExperienceOrb_xpNoCooldownMixin extends Entity @Shadow private int count; - @Shadow - private int value; - public ExperienceOrb_xpNoCooldownMixin(EntityType type, Level world) { super(type, world); @@ -30,13 +27,15 @@ public abstract class ExperienceOrb_xpNoCooldownMixin extends Entity @Shadow protected abstract int repairPlayerItems(ServerPlayer player, int amount); + @Shadow public abstract int getValue(); + @Inject(method = "playerTouch", at = @At("HEAD")) private void addXP(Player player, CallbackInfo ci) { if (CarpetSettings.xpNoCooldown && !level().isClientSide) { player.takeXpDelay = 0; // reducing the count to 1 and leaving vanilla to deal with it while (this.count > 1) { - int remainder = this.repairPlayerItems((ServerPlayer) player, this.value); + int remainder = this.repairPlayerItems((ServerPlayer) player, this.getValue()); if (remainder > 0) { player.giveExperiencePoints(remainder); } diff --git a/src/main/java/carpet/mixins/Guardian_renewableSpongesMixin.java b/src/main/java/carpet/mixins/Guardian_renewableSpongesMixin.java index 9ed6a3c0..d2fc84d3 100644 --- a/src/main/java/carpet/mixins/Guardian_renewableSpongesMixin.java +++ b/src/main/java/carpet/mixins/Guardian_renewableSpongesMixin.java @@ -25,7 +25,7 @@ public abstract class Guardian_renewableSpongesMixin extends Monster if (!this.level().isClientSide && !this.isRemoved() && CarpetSettings.renewableSponges && !((Object)this instanceof ElderGuardian)) { ElderGuardian elderGuardian = new ElderGuardian(EntityType.ELDER_GUARDIAN ,this.level()); - elderGuardian.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot()); + elderGuardian.snapTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot()); elderGuardian.finalizeSpawn(serverWorld ,this.level().getCurrentDifficultyAt(elderGuardian.blockPosition()), EntitySpawnReason.CONVERSION, null); elderGuardian.setNoAi(this.isNoAi()); diff --git a/src/main/java/carpet/mixins/LevelChunk_fillUpdatesMixin.java b/src/main/java/carpet/mixins/LevelChunk_fillUpdatesMixin.java index d0eec071..7b5458ef 100644 --- a/src/main/java/carpet/mixins/LevelChunk_fillUpdatesMixin.java +++ b/src/main/java/carpet/mixins/LevelChunk_fillUpdatesMixin.java @@ -27,13 +27,13 @@ public class LevelChunk_fillUpdatesMixin @Redirect(method = "setBlockState", at = @At( value = "INVOKE", - target = "Lnet/minecraft/world/level/block/entity/BlockEntity;preRemoveSideEffects(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Z)V" + target = "Lnet/minecraft/world/level/block/entity/BlockEntity;preRemoveSideEffects(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;)V" )) - private void onPreRemoveSideEffects(BlockEntity blockEntity, BlockPos blockPos_1, BlockState blockState_1, boolean boolean_1) + private void onPreRemoveSideEffects(BlockEntity blockEntity, BlockPos blockPos_1, BlockState blockState_1) { if (!CarpetSettings.impendingFillSkipUpdates.get()) { - blockEntity.preRemoveSideEffects(blockPos_1, blockState_1, boolean_1); + blockEntity.preRemoveSideEffects(blockPos_1, blockState_1); } } diff --git a/src/main/java/carpet/mixins/LevelChunk_movableBEMixin.java b/src/main/java/carpet/mixins/LevelChunk_movableBEMixin.java index 43a7d36f..6aa9b979 100644 --- a/src/main/java/carpet/mixins/LevelChunk_movableBEMixin.java +++ b/src/main/java/carpet/mixins/LevelChunk_movableBEMixin.java @@ -12,6 +12,7 @@ import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelHeightAccessor; import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.level.block.BaseRailBlock; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.EntityBlock; import net.minecraft.world.level.block.entity.BlockEntity; @@ -81,7 +82,7 @@ public abstract class LevelChunk_movableBEMixin extends ChunkAccess implements W public BlockState setBlockStateWithBlockEntity(BlockPos blockPos_1, BlockState newBlockState, BlockEntity newBlockEntity, int flags) { - boolean boolean_1 = (flags & 64) != 0; + int y = blockPos_1.getY(); LevelChunkSection chunkSection = this.getSection(this.getSectionIndex(y)); @@ -122,37 +123,35 @@ public abstract class LevelChunk_movableBEMixin extends ChunkAccess implements W profiler.pop(); } - boolean hadBlockEntity = oldBlockState.hasBlockEntity(); boolean blockChanged = !oldBlockState.is(newBlock); - + boolean boolean_1 = (flags & 64) != 0; // moved by pistons boolean sideEffects = (flags & Block.UPDATE_SKIP_BLOCK_ENTITY_SIDEEFFECTS) == 0; - if (blockChanged) { + if (blockChanged && oldBlockState.hasBlockEntity()) { if (level instanceof ServerLevel serverLevel && !(oldBlockState.getBlock() instanceof MovingPistonBlock)) { - if (hadBlockEntity && sideEffects) { - final BlockEntity blockEntity = level.getBlockEntity(blockPos_1); + if (sideEffects) { + BlockEntity blockEntity = level.getBlockEntity(blockPos_1); if (blockEntity != null) { - blockEntity.preRemoveSideEffects(blockPos_1, oldBlockState, boolean_1); + blockEntity.preRemoveSideEffects(blockPos_1, oldBlockState); } } + } + removeBlockEntity(blockPos_1); + } - if (hadBlockEntity) { - removeBlockEntity(blockPos_1); - } - if ((flags & Block.UPDATE_NEIGHBORS) != 0) { // scary change // so many other places that used to call this regardless if the UPDATE_NEIGHBORS flag was set + if (blockChanged || newBlock instanceof BaseRailBlock) + { + if (level instanceof ServerLevel serverLevel && !(oldBlockState.getBlock() instanceof MovingPistonBlock)) + { + if ((flags & Block.UPDATE_NEIGHBORS) != 0 || boolean_1) + { oldBlockState.affectNeighborsAfterRemoval(serverLevel, blockPos_1, boolean_1); } - } else if (hadBlockEntity) { - removeBlockEntity(blockPos_1); } } - - - - - if (chunkSection.getBlockState(x, chunkY, z).getBlock() != newBlock) + if (chunkSection.getBlockState(x, chunkY, z).getBlock() != newBlock) { return null; } diff --git a/src/main/java/carpet/mixins/StructureBlockEntity_limitsMixin.java b/src/main/java/carpet/mixins/StructureBlockEntity_limitsMixin.java index f0c758bb..84081048 100644 --- a/src/main/java/carpet/mixins/StructureBlockEntity_limitsMixin.java +++ b/src/main/java/carpet/mixins/StructureBlockEntity_limitsMixin.java @@ -29,14 +29,14 @@ public abstract class StructureBlockEntity_limitsMixin } @ModifyArg( - method = "saveStructure(Z)Z", + method = "saveStructure(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/resources/ResourceLocation;Lnet/minecraft/core/BlockPos;Lnet/minecraft/core/Vec3i;ZLjava/lang/String;Z)Z", at = @At( value = "INVOKE", target = "Lnet/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate;fillFromWorld(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/core/Vec3i;ZLnet/minecraft/world/level/block/Block;)V" ), index = 4 ) - private Block ignoredBlock(Block original) { + private static Block ignoredBlock(Block original) { return CarpetSettings.structureBlockIgnoredBlock; } } diff --git a/src/main/java/carpet/mixins/StructureBlockRenderer_mixin.java b/src/main/java/carpet/mixins/StructureBlockRenderer_mixin.java index 56bd7974..9fddba60 100644 --- a/src/main/java/carpet/mixins/StructureBlockRenderer_mixin.java +++ b/src/main/java/carpet/mixins/StructureBlockRenderer_mixin.java @@ -2,14 +2,14 @@ package carpet.mixins; import carpet.CarpetSettings; import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; -import net.minecraft.client.renderer.blockentity.StructureBlockRenderer; +import net.minecraft.client.renderer.blockentity.BlockEntityWithBoundingBoxRenderer; import net.minecraft.world.level.block.entity.StructureBlockEntity; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -@Mixin(StructureBlockRenderer.class) +@Mixin(BlockEntityWithBoundingBoxRenderer.class) public abstract class StructureBlockRenderer_mixin implements BlockEntityRenderer { @Inject(method = "getViewDistance", at = @At("HEAD"), cancellable = true) diff --git a/src/main/java/carpet/patches/EntityPlayerMPFake.java b/src/main/java/carpet/patches/EntityPlayerMPFake.java index 271b8e62..70b27705 100644 --- a/src/main/java/carpet/patches/EntityPlayerMPFake.java +++ b/src/main/java/carpet/patches/EntityPlayerMPFake.java @@ -93,7 +93,7 @@ public class EntityPlayerMPFake extends ServerPlayer current = p.get(); } EntityPlayerMPFake instance = new EntityPlayerMPFake(server, worldIn, current, ClientInformation.createDefault(), false); - instance.fixStartingPosition = () -> instance.moveTo(pos.x, pos.y, pos.z, (float) yaw, (float) pitch); + instance.fixStartingPosition = () -> instance.snapTo(pos.x, pos.y, pos.z, (float) yaw, (float) pitch); server.getPlayerList().placeNewPlayer(new FakeClientConnection(PacketFlow.SERVERBOUND), instance, new CommonListenerCookie(current, 0, instance.clientInformation(), false)); instance.teleportTo(worldIn, pos.x, pos.y, pos.z, Set.of(), (float) yaw, (float) pitch, true); instance.setHealth(20.0F); diff --git a/src/main/java/carpet/script/CarpetExpression.java b/src/main/java/carpet/script/CarpetExpression.java index 8535812a..ee0f51f5 100644 --- a/src/main/java/carpet/script/CarpetExpression.java +++ b/src/main/java/carpet/script/CarpetExpression.java @@ -141,4 +141,41 @@ public class CarpetExpression throw new CarpetExpressionException("Your thoughts are too deep", null); } } + + public Value explain(ScriptHost host, BlockPos pos) + { + // convert to explain + CarpetScriptServer scriptServer = (CarpetScriptServer) host.scriptServer(); + try + { + Context context = new CarpetContext(host, source, origin). + with("x", (c, t) -> new NumericValue(pos.getX() - origin.getX()).bindTo("x")). + with("y", (c, t) -> new NumericValue(pos.getY() - origin.getY()).bindTo("y")). + with("z", (c, t) -> new NumericValue(pos.getZ() - origin.getZ()).bindTo("z")); + Entity e = source.getEntity(); + if (e == null) + { + Value nullPlayer = Value.NULL.reboundedTo("p"); + context.with("p", (cc, tt) -> nullPlayer); + } + else + { + Value playerValue = new EntityValue(e).bindTo("p"); + context.with("p", (cc, tt) -> playerValue); + } + return scriptServer.events.handleEvents.getWhileDisabled(() -> this.expr.explain(context)); + } + catch (ExpressionException e) + { + throw new CarpetExpressionException(e.getMessage(), e.stack); + } + catch (ArithmeticException ae) + { + throw new CarpetExpressionException("Math doesn't compute... " + ae.getMessage(), null); + } + catch (StackOverflowError soe) + { + throw new CarpetExpressionException("Your thoughts are too deep", null); + } + } } diff --git a/src/main/java/carpet/script/Expression.java b/src/main/java/carpet/script/Expression.java index 7f427a40..a76fa015 100644 --- a/src/main/java/carpet/script/Expression.java +++ b/src/main/java/carpet/script/Expression.java @@ -1251,6 +1251,12 @@ public class Expression return extractOp(optimizeOnlyContext, root, Context.Type.NONE); } + public Value explain(Context context) + { + //todo convert to explain + return Value.NULL; + } + private int treeSize(ExpressionNode node) { return node.op instanceof LazyValue.ContextFreeLazyValue ? 1 : node.args.stream().mapToInt(this::treeSize).sum() + 1; diff --git a/src/main/java/carpet/script/ScriptCommand.java b/src/main/java/carpet/script/ScriptCommand.java index d551f5bd..0a0b2188 100644 --- a/src/main/java/carpet/script/ScriptCommand.java +++ b/src/main/java/carpet/script/ScriptCommand.java @@ -5,6 +5,7 @@ import carpet.script.external.Vanilla; import carpet.script.utils.AppStoreManager; import carpet.script.exception.CarpetExpressionException; import carpet.script.value.FunctionValue; +import carpet.script.value.NumericValue; import carpet.script.value.Value; import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.arguments.StringArgumentType; @@ -358,6 +359,12 @@ public class ScriptCommand boolean success = ss(cc).uninstallApp(cc.getSource(), StringArgumentType.getString(cc, "app")); return success ? 1 : 0; })); + LiteralArgumentBuilder x = literal("explain"). + requires(Vanilla::ServerPlayer_canScriptACE). + then(argument("expr", StringArgumentType.greedyString()).suggests(ScriptCommand::suggestCode). + executes((cc) -> explain( + cc, + StringArgumentType.getString(cc, "expr")))); dispatcher.register(literal("script"). requires(Vanilla::ServerPlayer_canScriptGeneral). @@ -536,6 +543,19 @@ public class ScriptCommand }); } + private static int explain(CommandContext context, String expr) throws CommandSyntaxException + { + CommandSourceStack source = context.getSource(); + CarpetScriptHost host = getHost(context); + return handleCall(source, host, () -> { + CarpetExpression ex = new CarpetExpression(host.main, expr, source, new BlockPos(0, 0, 0)); + ex.explain(host, BlockPos.containing(source.getPosition())); + Carpet.Messenger_message(source, "w Expression: ", "wb " + expr); + Carpet.Messenger_message(source, "w Tokens: ", "wb " + ex.getExpr().toString()); + return NumericValue.ONE; + }); + } + private static int scriptScan(CommandContext context, BlockPos origin, BlockPos a, BlockPos b, String expr) throws CommandSyntaxException { CommandSourceStack source = context.getSource(); diff --git a/src/main/java/carpet/script/api/Auxiliary.java b/src/main/java/carpet/script/api/Auxiliary.java index b5b5e9c9..960d44b7 100644 --- a/src/main/java/carpet/script/api/Auxiliary.java +++ b/src/main/java/carpet/script/api/Auxiliary.java @@ -401,7 +401,7 @@ public class Auxiliary yoffset = -armorstand.getBbHeight() + 0.3; } } - armorstand.moveTo( + armorstand.snapTo( pointLocator.vec.x, //pointLocator.vec.y - ((!interactable && targetBlock == null)?0.41f:((targetBlock==null)?(armorstand.getHeight()+0.41):(armorstand.getHeight()-0.3))), pointLocator.vec.y + yoffset, diff --git a/src/main/java/carpet/script/api/Entities.java b/src/main/java/carpet/script/api/Entities.java index 68f74866..9c478d4b 100644 --- a/src/main/java/carpet/script/api/Entities.java +++ b/src/main/java/carpet/script/api/Entities.java @@ -143,7 +143,7 @@ public class Entities ServerLevel serverWorld = cc.level(); Entity entity = EntityType.loadEntityRecursive(tag, serverWorld, EntitySpawnReason.COMMAND, e -> { - e.moveTo(vec3d.x, vec3d.y, vec3d.z, e.getYRot(), e.getXRot()); + e.snapTo(vec3d.x, vec3d.y, vec3d.z, e.getYRot(), e.getXRot()); return e; }); if (entity == null) diff --git a/src/main/java/carpet/script/value/EntityValue.java b/src/main/java/carpet/script/value/EntityValue.java index 4fbcc5c0..16731668 100644 --- a/src/main/java/carpet/script/value/EntityValue.java +++ b/src/main/java/carpet/script/value/EntityValue.java @@ -911,7 +911,7 @@ public class EntityValue extends Value } else { - e.moveTo(x, y, z, yaw, pitch); + e.snapTo(x, y, z, yaw, pitch); // we were sending to players for not-living entites, that were untracked. Living entities should be tracked. //((ServerWorld) e.getEntityWorld()).getChunkManager().sendToNearbyPlayers(e, new EntityS2CPacket.(e)); if (e instanceof LivingEntity le) diff --git a/src/main/java/carpet/utils/BlockInfo.java b/src/main/java/carpet/utils/BlockInfo.java index 67b70496..ba41f635 100644 --- a/src/main/java/carpet/utils/BlockInfo.java +++ b/src/main/java/carpet/utils/BlockInfo.java @@ -76,7 +76,7 @@ public class BlockInfo { PathfinderMob creature = new ZombifiedPiglin(EntityType.ZOMBIFIED_PIGLIN, worldIn); creature.finalizeSpawn(worldIn, worldIn.getCurrentDifficultyAt(pos), EntitySpawnReason.NATURAL, null); - creature.moveTo(pos, 0.0F, 0.0F); + creature.snapTo(pos, 0.0F, 0.0F); RandomStrollGoal wander = new RandomStrollGoal(creature, 0.8D); int success = 0; for (int i=0; i<1000; i++) diff --git a/src/main/java/carpet/utils/PerimeterDiagnostics.java b/src/main/java/carpet/utils/PerimeterDiagnostics.java index 416fd702..c36f17f6 100644 --- a/src/main/java/carpet/utils/PerimeterDiagnostics.java +++ b/src/main/java/carpet/utils/PerimeterDiagnostics.java @@ -180,7 +180,7 @@ public class PerimeterDiagnostics if (SpawnPlacements.isSpawnPositionOk(sle.type(), worldServer, pos)) { - el.moveTo(pos.getX() + 0.5F, pos.getY(), pos.getZ()+0.5F, 0.0F, 0.0F); + el.snapTo(pos.getX() + 0.5F, pos.getY(), pos.getZ()+0.5F, 0.0F, 0.0F); return el.checkSpawnObstruction(worldServer) && el.checkSpawnRules(worldServer, EntitySpawnReason.NATURAL) && SpawnPlacements.checkSpawnRules(el.getType(),(ServerLevel)el.getCommandSenderWorld(), EntitySpawnReason.NATURAL, el.blockPosition(), el.getCommandSenderWorld().random) && worldServer.noCollision(el); // check collision rules once they stop fiddling with them after 1.14.1 diff --git a/src/main/java/carpet/utils/SpawnReporter.java b/src/main/java/carpet/utils/SpawnReporter.java index 0b21446e..4c96755d 100644 --- a/src/main/java/carpet/utils/SpawnReporter.java +++ b/src/main/java/carpet/utils/SpawnReporter.java @@ -439,7 +439,7 @@ public class SpawnReporter { float f = x + 0.5F; float f1 = z + 0.5F; - mob.moveTo(f, y, f1, worldIn.random.nextFloat() * 360.0F, 0.0F); + mob.snapTo(f, y, f1, worldIn.random.nextFloat() * 360.0F, 0.0F); fits = worldIn.noCollision(mob); EntityType etype = mob.getType(); From 4b1f4be74be275c20ee9d1655c9242c26b45e0bc Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Thu, 16 Jan 2025 12:44:03 +0100 Subject: [PATCH 042/232] 1.4.163 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 469ac583..1679f2e3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G fabric_version=0.110.5+1.21.4 # Mod Properties - mod_version = 1.4.162 + mod_version = 1.4.163 maven_group = carpet archives_base_name = fabric-carpet From 4ffb09c0211025599e84b5fd6ccafb0743e30cf3 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Wed, 22 Jan 2025 20:49:51 +0100 Subject: [PATCH 043/232] 25w04a --- gradle.properties | 2 +- src/main/java/carpet/script/value/EntityValue.java | 2 +- src/main/java/carpet/script/value/NBTSerializableValue.java | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/gradle.properties b/gradle.properties index 1679f2e3..473c0066 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=25w03a + minecraft_version=25w04a loader_version=0.16.10 jsr305_version=3.0.2 fabric_version=0.110.5+1.21.4 diff --git a/src/main/java/carpet/script/value/EntityValue.java b/src/main/java/carpet/script/value/EntityValue.java index 16731668..55ca1f38 100644 --- a/src/main/java/carpet/script/value/EntityValue.java +++ b/src/main/java/carpet/script/value/EntityValue.java @@ -301,7 +301,7 @@ public class EntityValue extends Value EntityType.ARROW, EntityType.DRAGON_FIREBALL, EntityType.FIREWORK_ROCKET, EntityType.FIREBALL, EntityType.LLAMA_SPIT, EntityType.SMALL_FIREBALL, EntityType.SNOWBALL, EntityType.SPECTRAL_ARROW, EntityType.EGG, - EntityType.ENDER_PEARL, EntityType.EXPERIENCE_BOTTLE, EntityType.POTION, + EntityType.ENDER_PEARL, EntityType.EXPERIENCE_BOTTLE, EntityType.SPLASH_POTION, EntityType.LINGERING_POTION, EntityType.TRIDENT, EntityType.WITHER_SKULL, EntityType.FISHING_BOBBER, EntityType.SHULKER_BULLET ); Set> deads = Set.of( diff --git a/src/main/java/carpet/script/value/NBTSerializableValue.java b/src/main/java/carpet/script/value/NBTSerializableValue.java index f6df234c..a3258f7c 100644 --- a/src/main/java/carpet/script/value/NBTSerializableValue.java +++ b/src/main/java/carpet/script/value/NBTSerializableValue.java @@ -32,6 +32,7 @@ import net.minecraft.nbt.EndTag; import net.minecraft.nbt.IntTag; import net.minecraft.nbt.ListTag; import net.minecraft.nbt.LongTag; +import net.minecraft.nbt.NbtOps; import net.minecraft.nbt.NumericTag; import net.minecraft.nbt.StringTag; import net.minecraft.nbt.Tag; @@ -74,7 +75,7 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa { try { - return (new TagParser(new StringReader(nbtString))).readValue(); + return TagParser.parseAsArgument(NbtOps.INSTANCE, new StringReader(nbtString)); } catch (CommandSyntaxException e) { @@ -127,7 +128,7 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa { try { - Tag tag = (new TagParser(new StringReader(nbtString))).readValue(); + Tag tag = TagParser.parseAsArgument(NbtOps.INSTANCE, new StringReader(nbtString)); NBTSerializableValue value = new NBTSerializableValue(tag); value.nbtString = null; return value; From b1a2e33caf467eede50bb8aedf9f2620a71affe4 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Wed, 22 Jan 2025 20:50:20 +0100 Subject: [PATCH 044/232] 1.4.164 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 473c0066..c3082ea3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G fabric_version=0.110.5+1.21.4 # Mod Properties - mod_version = 1.4.163 + mod_version = 1.4.164 maven_group = carpet archives_base_name = fabric-carpet From 6a77d6a3f56f32fed2a16fccb0bd9ce97437ffaf Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Thu, 30 Jan 2025 10:32:44 +0100 Subject: [PATCH 045/232] 25w05a --- gradle.properties | 2 +- .../PistonHeadRenderer_movableBEMixin.java | 8 ++-- .../java/carpet/script/api/Scoreboards.java | 37 +++++++++++++++++-- .../carpet/script/utils/ShapesRenderer.java | 2 +- 4 files changed, 41 insertions(+), 8 deletions(-) diff --git a/gradle.properties b/gradle.properties index c3082ea3..0f64a120 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=25w04a + minecraft_version=25w05a loader_version=0.16.10 jsr305_version=3.0.2 fabric_version=0.110.5+1.21.4 diff --git a/src/main/java/carpet/mixins/PistonHeadRenderer_movableBEMixin.java b/src/main/java/carpet/mixins/PistonHeadRenderer_movableBEMixin.java index 87df4e34..3a8b0e14 100644 --- a/src/main/java/carpet/mixins/PistonHeadRenderer_movableBEMixin.java +++ b/src/main/java/carpet/mixins/PistonHeadRenderer_movableBEMixin.java @@ -10,6 +10,7 @@ import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; import net.minecraft.client.renderer.blockentity.PistonHeadRenderer; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.piston.PistonMovingBlockEntity; +import net.minecraft.world.phys.Vec3; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -27,8 +28,9 @@ public abstract class PistonHeadRenderer_movableBEMixin implements BlockEntityRe } @Inject(method = "render", at = @At(value = "INVOKE", - target = "Lnet/minecraft/client/renderer/blockentity/PistonHeadRenderer;renderBlock(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;Lnet/minecraft/world/level/Level;ZI)V", ordinal = 3)) - private void updateRenderBool(PistonMovingBlockEntity pistonBlockEntity_1, float float_1, PoseStack matrixStack_1, MultiBufferSource layeredVertexConsumerStorage_1, int int_1, int int_2, CallbackInfo ci) + target = "Lnet/minecraft/client/renderer/blockentity/PistonHeadRenderer;renderBlock(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;Lnet/minecraft/world/level/Level;ZI)V", + ordinal = 3)) + private void updateRenderBool(PistonMovingBlockEntity pistonBlockEntity_1, float float_1, PoseStack matrixStack_1, MultiBufferSource layeredVertexConsumerStorage_1, int int_1, int int_2, Vec3 cameraPos, CallbackInfo ci) //private void updateRenderBool(PistonBlockEntity pistonBlockEntity_1, double double_1, double double_2, double double_3, float float_1, class_4587 class_4587_1, class_4597 class_4597_1, int int_1, CallbackInfo ci) { if (!((PistonBlockEntityInterface) pistonBlockEntity_1).isRenderModeSet()) @@ -37,7 +39,7 @@ public abstract class PistonHeadRenderer_movableBEMixin implements BlockEntityRe @Inject(method = "render", at = @At("RETURN"), locals = LocalCapture.NO_CAPTURE) - private void endMethod3576(PistonMovingBlockEntity pistonBlockEntity_1, float partialTicks, PoseStack matrixStack_1, MultiBufferSource layeredVertexConsumerStorage_1, int int_1, int init_2, CallbackInfo ci) + private void endMethod3576(PistonMovingBlockEntity pistonBlockEntity_1, float partialTicks, PoseStack matrixStack_1, MultiBufferSource layeredVertexConsumerStorage_1, int int_1, int init_2, Vec3 cameraPos, CallbackInfo ci) { if (((PistonBlockEntityInterface) pistonBlockEntity_1).getRenderCarriedBlockEntity()) { diff --git a/src/main/java/carpet/script/api/Scoreboards.java b/src/main/java/carpet/script/api/Scoreboards.java index cd282d7e..3e758a70 100644 --- a/src/main/java/carpet/script/api/Scoreboards.java +++ b/src/main/java/carpet/script/api/Scoreboards.java @@ -35,6 +35,7 @@ import net.minecraft.world.scores.ScoreHolder; import net.minecraft.world.scores.Scoreboard; import net.minecraft.world.scores.Team; import net.minecraft.world.scores.criteria.ObjectiveCriteria; +import org.jetbrains.annotations.Nullable; public class Scoreboards { @@ -420,7 +421,7 @@ public class Scoreboards { throw new InternalExpressionException("'team_property' requires a string as the third argument for the property " + propertyVal.getString()); } - Team.CollisionRule collisionRule = Team.CollisionRule.byName(settingVal.getString()); + Team.CollisionRule collisionRule = getCollisionRule(settingVal); if (collisionRule == null) { throw new InternalExpressionException("Unknown value for property " + propertyVal.getString() + ": " + settingVal.getString()); @@ -452,7 +453,7 @@ public class Scoreboards { throw new InternalExpressionException("'team_property' requires a string as the third argument for the property " + propertyVal.getString()); } - Team.Visibility deathMessageVisibility = Team.Visibility.byName(settingVal.getString()); + Team.Visibility deathMessageVisibility = getVisibility(settingVal); if (deathMessageVisibility == null) { throw new InternalExpressionException("Unknown value for property " + propertyVal.getString() + ": " + settingVal.getString()); @@ -490,7 +491,7 @@ public class Scoreboards { throw new InternalExpressionException("'team_property' requires a string as the third argument for the property " + propertyVal.getString()); } - Team.Visibility nametagVisibility = Team.Visibility.byName(settingVal.getString()); + Team.Visibility nametagVisibility = getVisibility(settingVal); if (nametagVisibility == null) { throw new InternalExpressionException("Unknown value for property " + propertyVal.getString() + ": " + settingVal.getString()); @@ -697,5 +698,35 @@ public class Scoreboards } }); } + + @Nullable + private static Team.CollisionRule getCollisionRule(Value settingVal) + { + + final String string = settingVal.getString(); + for (Team.CollisionRule rule : Team.CollisionRule.values()) + { + if (rule.getSerializedName().equalsIgnoreCase(string)) + { + return rule; + } + } + return null; + } + + @Nullable + private static Team.Visibility getVisibility(Value settingVal) + { + + final String string = settingVal.getString(); + for (Team.Visibility rule : Team.Visibility.values()) + { + if (rule.getSerializedName().equalsIgnoreCase(string)) + { + return rule; + } + } + return null; + } } diff --git a/src/main/java/carpet/script/utils/ShapesRenderer.java b/src/main/java/carpet/script/utils/ShapesRenderer.java index a7c7a9eb..54884f37 100644 --- a/src/main/java/carpet/script/utils/ShapesRenderer.java +++ b/src/main/java/carpet/script/utils/ShapesRenderer.java @@ -435,7 +435,7 @@ public class ShapesRenderer if (blockEntityRenderer != null) { blockEntityRenderer.render(BlockEntity, partialTick, - matrices, immediate, light, OverlayTexture.NO_OVERLAY); + matrices, immediate, light, OverlayTexture.NO_OVERLAY, camera1.getPosition()); } } From 2096e5db27251ce2f1ff8954f6f0dc255715e738 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Thu, 30 Jan 2025 10:33:17 +0100 Subject: [PATCH 046/232] 1.4.165 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 0f64a120..1fe0c893 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G fabric_version=0.110.5+1.21.4 # Mod Properties - mod_version = 1.4.164 + mod_version = 1.4.165 maven_group = carpet archives_base_name = fabric-carpet From fc1bc68ed0f2cc52924c8a86f423dcc6c2b3249f Mon Sep 17 00:00:00 2001 From: altrisi Date: Wed, 5 Feb 2025 15:57:45 +0100 Subject: [PATCH 047/232] Update actions versions (#2032) --- .github/workflows/build-on-pr.yml | 7 +++---- .github/workflows/devbuild.yml | 6 +++--- .github/workflows/publish-release.yml | 22 +++++++++++----------- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build-on-pr.yml b/.github/workflows/build-on-pr.yml index ad8e9989..fbc04aa2 100644 --- a/.github/workflows/build-on-pr.yml +++ b/.github/workflows/build-on-pr.yml @@ -7,13 +7,12 @@ on: [pull_request] jobs: Build: - runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up JDK 21 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: 21 @@ -22,7 +21,7 @@ jobs: run: chmod +x gradlew - name: Build with Gradle run: ./gradlew build - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: "Compiled artifacts for Pull Request #${{github.event.number}}" path: build/libs diff --git a/.github/workflows/devbuild.yml b/.github/workflows/devbuild.yml index 15dbeaf7..379e74c8 100644 --- a/.github/workflows/devbuild.yml +++ b/.github/workflows/devbuild.yml @@ -11,9 +11,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up JDK 21 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: 21 @@ -22,7 +22,7 @@ jobs: run: chmod +x gradlew - name: Build with Gradle run: ./gradlew build - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: Compiled artifacts for ${{ github.sha }} path: build/libs diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 68720486..ab90c42e 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -16,7 +16,7 @@ jobs: extra-branch-curse-version: ${{ steps.properties.outputs.release-extra-curse-version }} steps: - name: Checkout the sources - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Determine release type id: type run: | @@ -41,7 +41,7 @@ jobs: if ! ${{ steps.properties.outputs.release-extra-branch }}; then echo "matrix-to-exclude=Snapshots" >> $GITHUB_OUTPUT fi - - uses: actions/github-script@v6 + - uses: actions/github-script@v7 env: READ_VERSION: ${{ steps.properties.outputs.mod_version }} with: @@ -78,11 +78,11 @@ jobs: echo "curse-versions=${{ needs.Get-Properties.outputs.curse-versions }}" >> $GITHUB_OUTPUT fi - name: Checkout the sources - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{ steps.getbranchinfo.outputs.branchname }} - name: Set up JDK 21 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: 21 @@ -97,7 +97,7 @@ jobs: output="$(find build/libs/ ! -name "*-dev.jar" ! -name "*-sources.jar" -type f -printf "%f\n")" echo "jarname=$output" >> $GITHUB_OUTPUT - name: Save build artifacts in the action - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: Artifacts for ${{ matrix.branch }} path: build/libs @@ -111,7 +111,7 @@ jobs: asset_name: ${{ steps.findjar.outputs.jarname }} asset_content_type: application/java-archive - name: Upload to Curseforge - uses: itsmeow/curseforge-upload@v3 + uses: itsmeow/curseforge-upload@v3.1.2 with: token: ${{ secrets.CF_API_TOKEN }} project_id: 349239 @@ -125,7 +125,7 @@ jobs: - name: Ask Gradle to publish run: ./gradlew publish - name: Save publish folder in action's artifacts # Remove when automated - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: Maven publishing artifacts for ${{ matrix.branch }} path: publish/carpet/fabric-carpet/ @@ -149,7 +149,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout the sources - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: master - name: Merge docs @@ -166,15 +166,15 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Carpet sources - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up JDK 21 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: 21 cache: 'gradle' - name: Checkout wiki - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: ${{github.repository}}.wiki path: wiki From 2a2c41ddce47ac5df81cc1b337c3d6b8399dc24a Mon Sep 17 00:00:00 2001 From: altrisi Date: Wed, 5 Feb 2025 16:00:30 +0100 Subject: [PATCH 048/232] Update dependencies in fabric.mod.json --- src/main/resources/fabric.mod.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 0c6ff7ef..bc2c8040 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -33,8 +33,8 @@ "accessWidener" : "carpet.accesswidener", "depends": { - "minecraft": ">=1.21.4", - "fabricloader": ">=0.16.9", + "minecraft": ">1.21.4", + "fabricloader": ">=0.16.10", "java": ">=21" } } From 85803cecbb305abcc6948e11a7f77c88e71994b2 Mon Sep 17 00:00:00 2001 From: Arian Baishya Date: Sun, 19 Jan 2025 20:04:00 -0600 Subject: [PATCH 049/232] fix crash when using MaxEntityCollisions rule in Singleplayer world --- .../mixins/LivingEntity_maxCollisionsMixin.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main/java/carpet/mixins/LivingEntity_maxCollisionsMixin.java b/src/main/java/carpet/mixins/LivingEntity_maxCollisionsMixin.java index 7adfd1f9..90474f0e 100644 --- a/src/main/java/carpet/mixins/LivingEntity_maxCollisionsMixin.java +++ b/src/main/java/carpet/mixins/LivingEntity_maxCollisionsMixin.java @@ -2,6 +2,7 @@ package carpet.mixins; import carpet.CarpetSettings; import carpet.fakes.LevelInterface; +import net.minecraft.server.level.ServerLevel; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -33,12 +34,18 @@ public abstract class LivingEntity_maxCollisionsMixin extends Entity { return; } + + if (!(this.level() instanceof ServerLevel serverLevel)) + { + return; + } + List entities; int maxEntityCramming =-1; if (CarpetSettings.maxEntityCollisions > 0) { - maxEntityCramming = this.getServer().getGameRules().getInt(GameRules.RULE_MAX_ENTITY_CRAMMING); - entities = ((LevelInterface) this.level()).getOtherEntitiesLimited( + maxEntityCramming = serverLevel.getGameRules().getInt(GameRules.RULE_MAX_ENTITY_CRAMMING); + entities = ((LevelInterface) serverLevel).getOtherEntitiesLimited( this, this.getBoundingBox(), EntitySelector.pushableBy(this), @@ -46,11 +53,11 @@ public abstract class LivingEntity_maxCollisionsMixin extends Entity } else { - entities = this.level().getEntities(this, this.getBoundingBox(), EntitySelector.pushableBy(this)); + entities = serverLevel.getEntities(this, this.getBoundingBox(), EntitySelector.pushableBy(this)); } if (!entities.isEmpty()) { - if (maxEntityCramming < 0) maxEntityCramming = this.getServer().getGameRules().getInt(GameRules.RULE_MAX_ENTITY_CRAMMING); + if (maxEntityCramming < 0) maxEntityCramming = serverLevel.getGameRules().getInt(GameRules.RULE_MAX_ENTITY_CRAMMING); if (maxEntityCramming > 0 && entities.size() > maxEntityCramming - 1 && this.random.nextInt(4) == 0) { int candidates = 0; From 7c73a9344c5e300a279bc0856a2908bba710aaa7 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Wed, 5 Feb 2025 21:45:23 +0100 Subject: [PATCH 050/232] 25w06a --- gradle.properties | 2 +- .../helpers/EntityPlayerActionPack.java | 4 +- .../mixins/Player_antiCheatDisabledMixin.java | 15 +++- .../carpet/mixins/ServerChunkCacheMixin.java | 4 +- .../ServerChunkCache_profilerMixin.java | 4 +- ...PacketListenerImpl_scarpetEventsMixin.java | 2 +- .../mixins/ServerLevel_scarpetMixin.java | 4 +- .../carpet/script/utils/ShapesRenderer.java | 69 +++++++++++-------- .../java/carpet/script/value/EntityValue.java | 2 +- 9 files changed, 62 insertions(+), 44 deletions(-) diff --git a/gradle.properties b/gradle.properties index 1fe0c893..0777db32 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=25w05a + minecraft_version=25w06a loader_version=0.16.10 jsr305_version=3.0.2 fabric_version=0.110.5+1.21.4 diff --git a/src/main/java/carpet/helpers/EntityPlayerActionPack.java b/src/main/java/carpet/helpers/EntityPlayerActionPack.java index 4bdd93bf..8595b57f 100644 --- a/src/main/java/carpet/helpers/EntityPlayerActionPack.java +++ b/src/main/java/carpet/helpers/EntityPlayerActionPack.java @@ -274,14 +274,14 @@ public class EntityPlayerActionPack else // one slot { if (selectedSlot == -1) - selectedSlot = inv.selected; + selectedSlot = inv.getSelectedSlot(); dropItemFromSlot(selectedSlot, dropAll); } } public void setSlot(int slot) { - player.getInventory().selected = slot-1; + player.getInventory().setSelectedSlot(slot-1); player.connection.send(new ClientboundSetHeldSlotPacket(slot-1)); } diff --git a/src/main/java/carpet/mixins/Player_antiCheatDisabledMixin.java b/src/main/java/carpet/mixins/Player_antiCheatDisabledMixin.java index 9dc4676a..2a4b6ed0 100644 --- a/src/main/java/carpet/mixins/Player_antiCheatDisabledMixin.java +++ b/src/main/java/carpet/mixins/Player_antiCheatDisabledMixin.java @@ -2,11 +2,15 @@ package carpet.mixins; import carpet.CarpetSettings; import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; //import net.minecraft.world.item.ElytraItem; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; +import net.minecraft.world.level.Level; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -14,18 +18,23 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(Player.class) -public abstract class Player_antiCheatDisabledMixin +public abstract class Player_antiCheatDisabledMixin extends LivingEntity { - @Shadow public abstract ItemStack getItemBySlot(EquipmentSlot equipmentSlot_1); + protected Player_antiCheatDisabledMixin(final EntityType entityType, final Level level) + { + super(entityType, level); + } @Shadow public abstract void startFallFlying(); + @Shadow public abstract Inventory getInventory(); + @Inject(method = "tryToStartFallFlying", at = @At("HEAD"), cancellable = true) private void allowDeploys(CallbackInfoReturnable cir) { if (CarpetSettings.antiCheatDisabled && (Object)this instanceof ServerPlayer sp && sp.getServer().isDedicatedServer()) { - ItemStack itemStack_1 = getItemBySlot(EquipmentSlot.CHEST); + ItemStack itemStack_1 = equipment.get(EquipmentSlot.CHEST); if (itemStack_1.getItem() == Items.ELYTRA && !itemStack_1.nextDamageWillBreak()) { startFallFlying(); cir.setReturnValue(true); diff --git a/src/main/java/carpet/mixins/ServerChunkCacheMixin.java b/src/main/java/carpet/mixins/ServerChunkCacheMixin.java index 8510da44..ce5c0107 100644 --- a/src/main/java/carpet/mixins/ServerChunkCacheMixin.java +++ b/src/main/java/carpet/mixins/ServerChunkCacheMixin.java @@ -27,7 +27,7 @@ public abstract class ServerChunkCacheMixin @Shadow @Final private DistanceManager distanceManager; - @Redirect(method = "tickChunks(Lnet/minecraft/util/profiling/ProfilerFiller;JLjava/util/List;)V", at = @At( + @Redirect(method = "tickChunks(Lnet/minecraft/util/profiling/ProfilerFiller;J)V", at = @At( value = "INVOKE", target = "Lnet/minecraft/server/level/DistanceManager;getNaturalSpawnChunkCount()I" )) @@ -54,7 +54,7 @@ public abstract class ServerChunkCacheMixin } - @Inject(method = "tickChunks(Lnet/minecraft/util/profiling/ProfilerFiller;JLjava/util/List;)V", at = @At("RETURN")) + @Inject(method = "tickChunks(Lnet/minecraft/util/profiling/ProfilerFiller;J)V", at = @At("RETURN")) private void onFinishSpawnWorldCycle(CallbackInfo ci) { LevelData levelData = this.level.getLevelData(); // levelProperies class diff --git a/src/main/java/carpet/mixins/ServerChunkCache_profilerMixin.java b/src/main/java/carpet/mixins/ServerChunkCache_profilerMixin.java index 201885e1..23d4c904 100644 --- a/src/main/java/carpet/mixins/ServerChunkCache_profilerMixin.java +++ b/src/main/java/carpet/mixins/ServerChunkCache_profilerMixin.java @@ -19,13 +19,13 @@ public abstract class ServerChunkCache_profilerMixin CarpetProfiler.ProfilerToken currentSection; - @Inject(method = "tickChunks(Lnet/minecraft/util/profiling/ProfilerFiller;JLjava/util/List;)V", at = @At("HEAD")) + @Inject(method = "tickChunks(Lnet/minecraft/util/profiling/ProfilerFiller;J)V", at = @At("HEAD")) private void startSpawningSection(CallbackInfo ci) { currentSection = CarpetProfiler.start_section(level, "Spawning", CarpetProfiler.TYPE.GENERAL); } - @Inject(method = "tickChunks(Lnet/minecraft/util/profiling/ProfilerFiller;JLjava/util/List;)V", at = @At("RETURN")) + @Inject(method = "tickChunks(Lnet/minecraft/util/profiling/ProfilerFiller;J)V", at = @At("RETURN")) private void stopSpawningSection(CallbackInfo ci) { if (currentSection != null) diff --git a/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java b/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java index e940f70f..6fd5eb02 100644 --- a/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java +++ b/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java @@ -269,7 +269,7 @@ public class ServerGamePacketListenerImpl_scarpetEventsMixin { if (PLAYER_SWITCHES_SLOT.isNeeded() && player.getServer() != null && player.getServer().isSameThread()) { - PLAYER_SWITCHES_SLOT.onSlotSwitch(player, player.getInventory().selected, packet.getSlot()); + PLAYER_SWITCHES_SLOT.onSlotSwitch(player, player.getInventory().getSelectedSlot(), packet.getSlot()); } } diff --git a/src/main/java/carpet/mixins/ServerLevel_scarpetMixin.java b/src/main/java/carpet/mixins/ServerLevel_scarpetMixin.java index fdb12025..db8d929c 100644 --- a/src/main/java/carpet/mixins/ServerLevel_scarpetMixin.java +++ b/src/main/java/carpet/mixins/ServerLevel_scarpetMixin.java @@ -51,13 +51,13 @@ public abstract class ServerLevel_scarpetMixin extends Level implements ServerWo super(writableLevelData, resourceKey, registryAccess, holder, bl, bl2, l, i); } - @Inject(method = "tickChunk", locals = LocalCapture.CAPTURE_FAILHARD, at = @At( + @Inject(method = "tickThunder", locals = LocalCapture.CAPTURE_FAILHARD, at = @At( value = "INVOKE", target = "Lnet/minecraft/server/level/ServerLevel;addFreshEntity(Lnet/minecraft/world/entity/Entity;)Z", shift = At.Shift.BEFORE, ordinal = 1 )) - private void onNaturalLightinig(LevelChunk chunk, int randomTickSpeed, CallbackInfo ci, + private void onNaturalLightinig(LevelChunk chunk, CallbackInfo ci, //ChunkPos chunkPos, boolean bl, int i, int j, Profiler profiler, BlockPos blockPos, boolean bl2) ChunkPos chunkPos, boolean bl, int i, int j, ProfilerFiller profiler, BlockPos blockPos, DifficultyInstance localDifficulty, boolean bl2, LightningBolt lightningEntity) { diff --git a/src/main/java/carpet/script/utils/ShapesRenderer.java b/src/main/java/carpet/script/utils/ShapesRenderer.java index 54884f37..0f30ab68 100644 --- a/src/main/java/carpet/script/utils/ShapesRenderer.java +++ b/src/main/java/carpet/script/utils/ShapesRenderer.java @@ -6,11 +6,12 @@ import carpet.script.utils.shapes.ShapeDirection; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.BufferBuilder; -import com.mojang.blaze3d.vertex.BufferUploader; import com.mojang.blaze3d.vertex.ByteBufferBuilder; import com.mojang.blaze3d.vertex.DefaultVertexFormat; +import com.mojang.blaze3d.vertex.MeshData; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.Tesselator; +import com.mojang.blaze3d.vertex.VertexBuffer; import com.mojang.blaze3d.vertex.VertexFormat; import com.mojang.blaze3d.vertex.VertexFormat.Mode; import com.mojang.math.Axis; @@ -617,6 +618,14 @@ public class ShapesRenderer } } + private static void drawWithShader(MeshData mesh) { + VertexBuffer buffre = mesh.drawState().format().getImmediateDrawVertexBuffer(); + buffre.bind(); + buffre.upload(mesh); + buffre.drawWithShader(RenderSystem.getModelViewMatrix(), RenderSystem.getProjectionMatrix(), RenderSystem.getShader()); + } + + public static class RenderedPolyface extends RenderedShape { private static final VertexFormat.Mode[] faceIndices = new VertexFormat.Mode[]{ @@ -654,7 +663,7 @@ public class ShapesRenderer } builder.addVertex((float) (vec.x() - cx), (float) (vec.y() - cy), (float) (vec.z() - cz)).setColor(shape.fr, shape.fg, shape.fb, shape.fa); } - BufferUploader.drawWithShader(builder.buildOrThrow()); + drawWithShader(builder.buildOrThrow()); RenderSystem.disableCull(); RenderSystem.depthMask(false); @@ -690,7 +699,7 @@ public class ShapesRenderer builder.addVertex((float) (vec.x() - cx), (float) (vec.y() - cy), (float) (vec.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a); } builder.addVertex((float) (vec0.x() - cx), (float) (vec0.y() - cy), (float) (vec0.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a); - BufferUploader.drawWithShader(builder.buildOrThrow()); + drawWithShader(builder.buildOrThrow()); if (shape.inneredges) { BufferBuilder builderr = tesselator.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR); @@ -705,7 +714,7 @@ public class ShapesRenderer builderr.addVertex((float) (vec.x() - cx), (float) (vec.y() - cy), (float) (vec.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a); builderr.addVertex((float) (vec0.x() - cx), (float) (vec0.y() - cy), (float) (vec0.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a); } - BufferUploader.drawWithShader(builderr.buildOrThrow()); + drawWithShader(builderr.buildOrThrow()); } return; } @@ -750,7 +759,7 @@ public class ShapesRenderer builder.addVertex((float) (vec.x() - cx), (float) (vec.y() - cy), (float) (vec.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a); } } - BufferUploader.drawWithShader(builder.buildOrThrow()); + drawWithShader(builder.buildOrThrow()); return; } if (shape.mode == 4) @@ -784,7 +793,7 @@ public class ShapesRenderer builder.addVertex((float) (vecC.x() - cx), (float) (vecC.y() - cy), (float) (vecC.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a); builder.addVertex((float) (vecA.x() - cx), (float) (vecA.y() - cy), (float) (vecA.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a); } - BufferUploader.drawWithShader(builder.buildOrThrow()); + drawWithShader(builder.buildOrThrow()); } } } @@ -873,7 +882,7 @@ public class ShapesRenderer BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR); builder.addVertex(x1, y1, z1).setColor(red1, grn1, blu1, alpha); builder.addVertex(x2, y2, z2).setColor(red1, grn1, blu1, alpha); - BufferUploader.drawWithShader(builder.buildOrThrow()); + drawWithShader(builder.buildOrThrow()); } public static void drawBoxWireGLLines( @@ -926,7 +935,7 @@ public class ShapesRenderer builder.addVertex(x2, y2, z1).setColor(red1, grn1, blu1, alpha); builder.addVertex(x2, y2, z2).setColor(red1, grn1, blu1, alpha); } - BufferUploader.drawWithShader(builder.buildOrThrow()); + drawWithShader(builder.buildOrThrow()); } public static void drawBoxFaces( @@ -987,7 +996,7 @@ public class ShapesRenderer builder.addVertex(x1, y2, z2).setColor(red1, grn1, blu1, alpha); } } - BufferUploader.drawWithShader(builder.buildOrThrow()); + drawWithShader(builder.buildOrThrow()); } public static void drawCylinderWireframe(Tesselator tesselator, @@ -1020,7 +1029,7 @@ public class ShapesRenderer float z = r * Mth.sin(theta); builder.addVertex(x + cx, y + cy, z + cz).setColor(red, grn, blu, alpha); } - BufferUploader.drawWithShader(builder.buildOrThrow()); + drawWithShader(builder.buildOrThrow()); } if (!isFlat) @@ -1038,7 +1047,7 @@ public class ShapesRenderer builder.addVertex(cx + x, cy + h, cz - z).setColor(red, grn, blu, alpha); builder.addVertex(cx - x, cy + h, cz + z).setColor(red, grn, blu, alpha); builder.addVertex(cx - x, cy + 0, cz + z).setColor(red, grn, blu, alpha); - BufferUploader.drawWithShader(builder.buildOrThrow()); + drawWithShader(builder.buildOrThrow()); } } else @@ -1052,7 +1061,7 @@ public class ShapesRenderer builder.addVertex(cx - x, cy, cz + z).setColor(red, grn, blu, alpha); builder.addVertex(cx + x, cy, cz - z).setColor(red, grn, blu, alpha); } - BufferUploader.drawWithShader(builder.buildOrThrow()); + drawWithShader(builder.buildOrThrow()); } } @@ -1070,7 +1079,7 @@ public class ShapesRenderer float y = r * Mth.sin(theta); builder.addVertex(x + cx, y + cy, z + cz).setColor(red, grn, blu, alpha); } - BufferUploader.drawWithShader(builder.buildOrThrow()); + drawWithShader(builder.buildOrThrow()); } if (!isFlat) @@ -1087,7 +1096,7 @@ public class ShapesRenderer builder.addVertex(cx + 0, cy + y, cz - z).setColor(red, grn, blu, alpha); builder.addVertex(cx + h, cy + y, cz - z).setColor(red, grn, blu, alpha); builder.addVertex(cx + h, cy - y, cz + z).setColor(red, grn, blu, alpha); - BufferUploader.drawWithShader(builder.buildOrThrow()); + drawWithShader(builder.buildOrThrow()); } } else @@ -1101,7 +1110,7 @@ public class ShapesRenderer builder.addVertex(cx, cy - y, cz + z).setColor(red, grn, blu, alpha); builder.addVertex(cx, cy + y, cz - z).setColor(red, grn, blu, alpha); } - BufferUploader.drawWithShader(builder.buildOrThrow()); + drawWithShader(builder.buildOrThrow()); } } else if (axis == Direction.Axis.Z) @@ -1118,7 +1127,7 @@ public class ShapesRenderer float x = r * Mth.sin(theta); builder.addVertex(x + cx, y + cy, z + cz).setColor(red, grn, blu, alpha); } - BufferUploader.drawWithShader(builder.buildOrThrow()); + drawWithShader(builder.buildOrThrow()); } if (!isFlat) { @@ -1134,7 +1143,7 @@ public class ShapesRenderer builder.addVertex(cx - x, cy + y, cz + 0).setColor(red, grn, blu, alpha); builder.addVertex(cx - x, cy + y, cz + h).setColor(red, grn, blu, alpha); builder.addVertex(cx + x, cy - y, cz + h).setColor(red, grn, blu, alpha); - BufferUploader.drawWithShader(builder.buildOrThrow()); + drawWithShader(builder.buildOrThrow()); } } else @@ -1148,7 +1157,7 @@ public class ShapesRenderer builder.addVertex(cx + x, cy - y, cz).setColor(red, grn, blu, alpha); builder.addVertex(cx - x, cy + y, cz).setColor(red, grn, blu, alpha); } - BufferUploader.drawWithShader(builder.buildOrThrow()); + drawWithShader(builder.buildOrThrow()); } } @@ -1175,7 +1184,7 @@ public class ShapesRenderer float z = r * Mth.sin(theta); builder.addVertex(x + cx, cy, z + cz).setColor(red, grn, blu, alpha); } - BufferUploader.drawWithShader(builder.buildOrThrow()); + drawWithShader(builder.buildOrThrow()); if (!isFlat) { BufferBuilder builderr = tesselator.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR); @@ -1187,7 +1196,7 @@ public class ShapesRenderer float z = r * Mth.sin(theta); builderr.addVertex(x + cx, cy + h, z + cz).setColor(red, grn, blu, alpha); } - BufferUploader.drawWithShader(builderr.buildOrThrow()); + drawWithShader(builderr.buildOrThrow()); BufferBuilder builderrr = tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR); // quad strip to quads float xp = r * 1; @@ -1204,7 +1213,7 @@ public class ShapesRenderer xp = x; zp = z; } - BufferUploader.drawWithShader(builderrr.buildOrThrow()); + drawWithShader(builderrr.buildOrThrow()); } } @@ -1219,7 +1228,7 @@ public class ShapesRenderer float z = r * Mth.sin(theta); builder.addVertex(cx, cy + y, z + cz).setColor(red, grn, blu, alpha); } - BufferUploader.drawWithShader(builder.buildOrThrow()); + drawWithShader(builder.buildOrThrow()); if (!isFlat) { BufferBuilder builderr = tesselator.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR); @@ -1231,7 +1240,7 @@ public class ShapesRenderer float z = r * Mth.sin(theta); builderr.addVertex(cx + h, cy + y, cz + z).setColor(red, grn, blu, alpha); } - BufferUploader.drawWithShader(builderr.buildOrThrow()); + drawWithShader(builderr.buildOrThrow()); BufferBuilder builderrr = tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR); // quad strip to quads float yp = r * 1; @@ -1248,7 +1257,7 @@ public class ShapesRenderer yp = y; zp = z; } - BufferUploader.drawWithShader(builderrr.buildOrThrow()); + drawWithShader(builderrr.buildOrThrow()); } } else if (axis == Direction.Axis.Z) @@ -1262,7 +1271,7 @@ public class ShapesRenderer float y = r * Mth.sin(theta); builder.addVertex(x + cx, cy + y, cz).setColor(red, grn, blu, alpha); } - BufferUploader.drawWithShader(builder.buildOrThrow()); + drawWithShader(builder.buildOrThrow()); if (!isFlat) { BufferBuilder builderr = tesselator.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR); @@ -1274,7 +1283,7 @@ public class ShapesRenderer float y = r * Mth.sin(theta); builderr.addVertex(x + cx, cy + y, cz + h).setColor(red, grn, blu, alpha); } - BufferUploader.drawWithShader(builderr.buildOrThrow()); + drawWithShader(builderr.buildOrThrow()); BufferBuilder builderrr = tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR); // quad strip to quads float xp = r; @@ -1291,7 +1300,7 @@ public class ShapesRenderer xp = x; yp = y; } - BufferUploader.drawWithShader(builderrr.buildOrThrow()); + drawWithShader(builderrr.buildOrThrow()); } } } @@ -1316,7 +1325,7 @@ public class ShapesRenderer float y = r * Mth.cos(phi); builder.addVertex(x + cx, y + cy, z + cz).setColor(red, grn, blu, alpha); } - BufferUploader.drawWithShader(builder.buildOrThrow()); + drawWithShader(builder.buildOrThrow()); } for (int j = 0; j <= num_steps180; j++) { @@ -1331,7 +1340,7 @@ public class ShapesRenderer float y = r * Mth.cos(phi); builder.addVertex(x + cx, y + cy, z + cz).setColor(red, grn, blu, alpha); } - BufferUploader.drawWithShader(builder.buildOrThrow()); + drawWithShader(builder.buildOrThrow()); } } @@ -1373,7 +1382,7 @@ public class ShapesRenderer zbp = zp; yp = y; } - BufferUploader.drawWithShader(builder.buildOrThrow()); + drawWithShader(builder.buildOrThrow()); } } } diff --git a/src/main/java/carpet/script/value/EntityValue.java b/src/main/java/carpet/script/value/EntityValue.java index 55ca1f38..d6a19a1e 100644 --- a/src/main/java/carpet/script/value/EntityValue.java +++ b/src/main/java/carpet/script/value/EntityValue.java @@ -700,7 +700,7 @@ public class EntityValue extends Value return Value.NULL; }); - put("selected_slot", (e, a) -> e instanceof Player p ? new NumericValue(p.getInventory().selected) : Value.NULL); + put("selected_slot", (e, a) -> e instanceof Player p ? new NumericValue(p.getInventory().getSelectedSlot()) : Value.NULL); put("active_block", (e, a) -> { if (e instanceof ServerPlayer sp) From 4079ef141945fc011dfc5fb1e473400af5ccd4bd Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Wed, 5 Feb 2025 21:46:01 +0100 Subject: [PATCH 051/232] 1.4.166 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 0777db32..df71095b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G fabric_version=0.110.5+1.21.4 # Mod Properties - mod_version = 1.4.165 + mod_version = 1.4.166 maven_group = carpet archives_base_name = fabric-carpet From 9be8d5c77ba4bc1520afd8804bc351fbd6b1ccec Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Thu, 13 Feb 2025 22:38:20 +0100 Subject: [PATCH 052/232] 25w07a --- gradle.properties | 2 +- .../java/carpet/script/api/Scoreboards.java | 7 ++++--- .../java/carpet/script/api/WorldAccess.java | 5 +++-- .../carpet/script/utils/ShapeDispatcher.java | 6 ++++-- .../carpet/script/utils/ShapesRenderer.java | 13 ++++++------- .../java/carpet/script/value/EntityValue.java | 19 ++++++++++--------- .../script/value/NBTSerializableValue.java | 4 ++-- 7 files changed, 30 insertions(+), 26 deletions(-) diff --git a/gradle.properties b/gradle.properties index df71095b..94728650 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=25w06a + minecraft_version=25w07a loader_version=0.16.10 jsr305_version=3.0.2 fabric_version=0.110.5+1.21.4 diff --git a/src/main/java/carpet/script/api/Scoreboards.java b/src/main/java/carpet/script/api/Scoreboards.java index 3e758a70..f903eb0a 100644 --- a/src/main/java/carpet/script/api/Scoreboards.java +++ b/src/main/java/carpet/script/api/Scoreboards.java @@ -26,6 +26,7 @@ import net.minecraft.server.ServerScoreboard; import net.minecraft.server.bossevents.CustomBossEvent; import net.minecraft.server.bossevents.CustomBossEvents; import net.minecraft.server.level.ServerPlayer; +import net.minecraft.util.StringRepresentable; import net.minecraft.world.BossEvent; import net.minecraft.world.scores.DisplaySlot; import net.minecraft.world.scores.Objective; @@ -579,12 +580,12 @@ public class Scoreboards BossEvent.BossBarColor color = (bossBar).getColor(); return color == null ? Value.NULL : StringValue.of(color.getName()); } - BossEvent.BossBarColor color = BossEvent.BossBarColor.byName(propertyValue.getString()); + BossEvent.BossBarColor color = ((StringRepresentable.EnumCodec)BossEvent.BossBarColor.CODEC).byName(propertyValue.getString()); if (color == null) { return Value.NULL; } - bossBar.setColor(BossEvent.BossBarColor.byName(propertyValue.getString())); + bossBar.setColor(color); return Value.TRUE; } case "max" -> { @@ -662,7 +663,7 @@ public class Scoreboards { return StringValue.of(bossBar.getOverlay().getName()); } - BossEvent.BossBarOverlay style = BossEvent.BossBarOverlay.byName(propertyValue.getString()); + BossEvent.BossBarOverlay style = ((StringRepresentable.EnumCodec)BossEvent.BossBarOverlay.CODEC).byName(propertyValue.getString()); if (style == null) { throw new InternalExpressionException("'" + propertyValue.getString() + "' is not a valid value for property " + property); diff --git a/src/main/java/carpet/script/api/WorldAccess.java b/src/main/java/carpet/script/api/WorldAccess.java index 5f173ee4..bf000265 100644 --- a/src/main/java/carpet/script/api/WorldAccess.java +++ b/src/main/java/carpet/script/api/WorldAccess.java @@ -43,6 +43,7 @@ import net.minecraft.core.particles.ParticleOptions; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; +import net.minecraft.nbt.NbtOps; import net.minecraft.resources.ResourceKey; import net.minecraft.server.level.DistanceManager; import net.minecraft.server.level.ServerLevel; @@ -887,7 +888,7 @@ public class WorldAccess ItemStack tool; if (tag != null) { - tool = ItemStack.parseOptional(regs, tag); + tool = ItemStack.CODEC.parse(regs.createSerializationContext(NbtOps.INSTANCE), tag).result().orElse(null); } else { @@ -955,7 +956,7 @@ public class WorldAccess { return Value.NULL; } - return new NBTSerializableValue(() -> tool.saveOptional(regs)); + return new NBTSerializableValue(() -> ItemStack.CODEC.encodeStart(regs.createSerializationContext(NbtOps.INSTANCE), tool).getOrThrow()); }); diff --git a/src/main/java/carpet/script/utils/ShapeDispatcher.java b/src/main/java/carpet/script/utils/ShapeDispatcher.java index 928ec396..5133ab05 100644 --- a/src/main/java/carpet/script/utils/ShapeDispatcher.java +++ b/src/main/java/carpet/script/utils/ShapeDispatcher.java @@ -34,11 +34,13 @@ import net.minecraft.nbt.DoubleTag; import net.minecraft.nbt.FloatTag; import net.minecraft.nbt.IntTag; import net.minecraft.nbt.ListTag; +import net.minecraft.nbt.NbtOps; import net.minecraft.nbt.NbtUtils; import net.minecraft.nbt.StringTag; import net.minecraft.nbt.Tag; import net.minecraft.nbt.NumericTag; import net.minecraft.network.chat.Component; +import net.minecraft.resources.RegistryOps; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.MinecraftServer; @@ -724,7 +726,7 @@ public class ShapeDispatcher } else { - this.item = ItemStack.parseOptional(regs, ((NBTSerializableValue) options.get("item")).getCompoundTag()); + this.item = ItemStack.CODEC.parse(regs.createSerializationContext(NbtOps.INSTANCE), ((NBTSerializableValue) options.get("item")).getCompoundTag() ).result().orElse(null); } blockLight = NumericValue.asNumber(options.getOrDefault("blocklight", optional.get("blocklight"))).getInt(); if (blockLight > 15) @@ -1661,7 +1663,7 @@ public class ShapeDispatcher public Value validate(Map options, MinecraftServer server, Value value) { ItemStack item = ValueConversions.getItemStackFromValue(value, true, server.registryAccess()); - return new NBTSerializableValue(item.saveOptional(server.registryAccess())); + return new NBTSerializableValue(ItemStack.CODEC.encodeStart(server.registryAccess().createSerializationContext(NbtOps.INSTANCE), item).result().orElse(null)); } @Override diff --git a/src/main/java/carpet/script/utils/ShapesRenderer.java b/src/main/java/carpet/script/utils/ShapesRenderer.java index 0f30ab68..062a67e1 100644 --- a/src/main/java/carpet/script/utils/ShapesRenderer.java +++ b/src/main/java/carpet/script/utils/ShapesRenderer.java @@ -26,8 +26,6 @@ import net.minecraft.client.Camera; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Font; import net.minecraft.client.multiplayer.ClientLevel; -import net.minecraft.client.renderer.CoreShaders; -import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.ItemBlockRenderTypes; import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.MultiBufferSource; @@ -123,7 +121,7 @@ public class ShapesRenderer } long currentTime = client.level.getGameTime(); RenderSystem.enableDepthTest(); - RenderSystem.setShader(CoreShaders.POSITION_COLOR); + //RenderSystem.setShader(CoreShaders.POSITION_COLOR); RenderSystem.depthFunc(515); RenderSystem.enableBlend(); RenderSystem.defaultBlendFunc(); @@ -619,10 +617,11 @@ public class ShapesRenderer } private static void drawWithShader(MeshData mesh) { - VertexBuffer buffre = mesh.drawState().format().getImmediateDrawVertexBuffer(); - buffre.bind(); - buffre.upload(mesh); - buffre.drawWithShader(RenderSystem.getModelViewMatrix(), RenderSystem.getProjectionMatrix(), RenderSystem.getShader()); + RenderType.debugTriangleFan().draw(mesh); + //VertexBuffer buffre = mesh.drawState().format().getImmediateDrawVertexBuffer(); + //buffre.bind(); + //buffre.upload(mesh); + //buffre.drawWithShader(RenderSystem.getModelViewMatrix(), RenderSystem.getProjectionMatrix(), RenderType. RenderSystem.getShader()); } diff --git a/src/main/java/carpet/script/value/EntityValue.java b/src/main/java/carpet/script/value/EntityValue.java index d6a19a1e..801a2e8a 100644 --- a/src/main/java/carpet/script/value/EntityValue.java +++ b/src/main/java/carpet/script/value/EntityValue.java @@ -530,15 +530,16 @@ public class EntityValue extends Value put("spawn_point", (e, a) -> { if (e instanceof ServerPlayer spe) { - if (spe.getRespawnPosition() == null) + if (spe.getRespawnConfig() == null) { return Value.FALSE; } + ServerPlayer.RespawnConfig spec = spe.getRespawnConfig(); return ListValue.of( - ValueConversions.of(spe.getRespawnPosition()), - ValueConversions.of(spe.getRespawnDimension()), - new NumericValue(spe.getRespawnAngle()), - BooleanValue.of(spe.isRespawnForced()) + ValueConversions.of(spec.pos()), + ValueConversions.of(spec.dimension()), + new NumericValue(spec.angle()), + BooleanValue.of(spec.forced()) ); } return Value.NULL; @@ -1366,7 +1367,7 @@ public class EntityValue extends Value } if (a == null) { - spe.setRespawnPosition(null, null, 0, false, false); + spe.setRespawnPosition(null, false); } else if (a instanceof ListValue lv) { @@ -1389,7 +1390,7 @@ public class EntityValue extends Value } } } - spe.setRespawnPosition(world, pos, angle, forced, false); + spe.setRespawnPosition(new ServerPlayer.RespawnConfig(world, pos, angle, forced), false); } else if (a instanceof BlockValue bv) { @@ -1397,11 +1398,11 @@ public class EntityValue extends Value { throw new InternalExpressionException("block for spawn modification should be localised in the world"); } - spe.setRespawnPosition(bv.getWorld().dimension(), bv.getPos(), e.getYRot(), true, false); // yaw + spe.setRespawnPosition(new ServerPlayer.RespawnConfig(bv.getWorld().dimension(), bv.getPos(), e.getYRot(), true), false); // yaw } else if (a.isNull()) { - spe.setRespawnPosition(null, null, 0, false, false); + spe.setRespawnPosition(null, false); } else { diff --git a/src/main/java/carpet/script/value/NBTSerializableValue.java b/src/main/java/carpet/script/value/NBTSerializableValue.java index a3258f7c..41535605 100644 --- a/src/main/java/carpet/script/value/NBTSerializableValue.java +++ b/src/main/java/carpet/script/value/NBTSerializableValue.java @@ -108,7 +108,7 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa public static Value fromStack(ItemStack stack, RegistryAccess regs) { NBTSerializableValue value = new NBTSerializableValue(); - value.nbtSupplier = () -> stack.saveOptional(regs); + value.nbtSupplier = () -> ItemStack.CODEC.encodeStart(regs.createSerializationContext(NbtOps.INSTANCE), stack).getOrThrow(); return value; } @@ -346,7 +346,7 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa public static ItemStack parseItem(String itemString, @Nullable CompoundTag customTag, RegistryAccess regs) { if (customTag != null) { - return ItemStack.parseOptional(regs, customTag); + return ItemStack.CODEC.parse(regs.createSerializationContext(NbtOps.INSTANCE), customTag).resultOrPartial().orElse(null); } try { From 31968bb5d28b7d79f37605df6871e3ae940ae9d3 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Thu, 13 Feb 2025 22:39:04 +0100 Subject: [PATCH 053/232] 1.4.167 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 94728650..fb36e1df 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G fabric_version=0.110.5+1.21.4 # Mod Properties - mod_version = 1.4.166 + mod_version = 1.4.167 maven_group = carpet archives_base_name = fabric-carpet From 07de4fb4a58bf8c676f97ff6bb35d0fde85ad22a Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Fri, 14 Feb 2025 13:17:49 +0100 Subject: [PATCH 054/232] commands output reliable return values and new result for `run` if not run directly --- docs/scarpet/api/Auxiliary.md | 18 ++++++++++++++---- .../carpet/network/ServerNetworkHandler.java | 4 +++- src/main/java/carpet/script/api/Auxiliary.java | 10 ++++++++-- .../script/utils/SnoopyCommandSource.java | 12 ++++++------ 4 files changed, 31 insertions(+), 13 deletions(-) diff --git a/docs/scarpet/api/Auxiliary.md b/docs/scarpet/api/Auxiliary.md index 8427523e..5a3915fb 100644 --- a/docs/scarpet/api/Auxiliary.md +++ b/docs/scarpet/api/Auxiliary.md @@ -410,11 +410,21 @@ Runs a vanilla command from the string result of the `expr` and returns a triple intercepted list of output messages, and error message if the command resulted in a failure. Successful commands return `null` as their error. +The command return `null` if the command was not run immediately, but was scheduled for later execution +due to being requested while command was executed. This happens most commonly +when running `run` from a `/script run/invoke` command since that always results in piling up command to run while `script` is being executed. + +The mitigation for this is to use `run` in a separate scheduled function, or use `run` in a `tick` event, or literally in +any other way than directly from a `/script` command, which will ensure that the command runs immediately. +
    -run('fill 1 1 1 10 10 10 air') -> [0, ["Successfully filled 123 blocks"], null]
    -run('give @s stone 4') -> [0, ["Gave 4 [Stone] to gnembon"], null]
    -run('seed') -> [0, ["Seed: [4031384495743822299]"], null]
    -run('sed') -> [0, [], "sed<--[HERE]"] // wrong command
    +run('fill 1 1 1 10 10 10 air') -> [123, ["Successfully filled 123 blocks"], null]
    +run('give @s stone 4') -> [1, ["Gave 4 [Stone] to gnembon"], null]
    +run('seed') -> [-170661413, [Seed: [4031384495743822299]], null]
    +run('sed') -> [-1, [], "sed<--[HERE]"] // wrong command
    +
    +/script run run('setblock 0 0 0 stone') -> null
    +/script run schedule(0, _() -> print(run('setblock 0 0 0 stone'))) -> [1, [Changed the block at 0, 0, 0], null]
     
    ### `save()` diff --git a/src/main/java/carpet/network/ServerNetworkHandler.java b/src/main/java/carpet/network/ServerNetworkHandler.java index 771bbaaa..2770e005 100644 --- a/src/main/java/carpet/network/ServerNetworkHandler.java +++ b/src/main/java/carpet/network/ServerNetworkHandler.java @@ -83,6 +83,7 @@ public class ServerNetworkHandler String id = commandData.getString("id"); List output = new ArrayList<>(); Component[] error = {null}; + int[] returnValue = {0}; if (player.getServer() == null) { error[0] = Component.literal("No Server"); @@ -90,7 +91,7 @@ public class ServerNetworkHandler else { player.getServer().getCommands().performPrefixedCommand( - new SnoopyCommandSource(player, error, output), command + new SnoopyCommandSource(player, error, output, returnValue), command ); } CompoundTag result = new CompoundTag(); @@ -99,6 +100,7 @@ public class ServerNetworkHandler { result.putString("error", error[0].getContents().toString()); } + result.putInt("return", returnValue[0]); ListTag outputResult = new ListTag(); for (Component line : output) { diff --git a/src/main/java/carpet/script/api/Auxiliary.java b/src/main/java/carpet/script/api/Auxiliary.java index 960d44b7..4770a03f 100644 --- a/src/main/java/carpet/script/api/Auxiliary.java +++ b/src/main/java/carpet/script/api/Auxiliary.java @@ -97,6 +97,7 @@ import java.util.HashSet; import java.util.List; import java.util.Locale; import java.util.Map; +import java.util.OptionalLong; import java.util.Set; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Function; @@ -684,12 +685,17 @@ public class Auxiliary try { Component[] error = {null}; + OptionalLong[] returnValue = {OptionalLong.empty()}; List output = new ArrayList<>(); s.getServer().getCommands().performPrefixedCommand( - new SnoopyCommandSource(s, error, output), + new SnoopyCommandSource(s, error, output, returnValue), lv.get(0).getString()); + if (returnValue[0].isEmpty()) + { + return Value.NULL; + } return ListValue.of( - NumericValue.ZERO, + NumericValue.of(returnValue[0].getAsLong()), ListValue.wrap(output.stream().map(FormattedTextValue::new)), FormattedTextValue.of(error[0]) ); diff --git a/src/main/java/carpet/script/utils/SnoopyCommandSource.java b/src/main/java/carpet/script/utils/SnoopyCommandSource.java index fc2315db..74955665 100644 --- a/src/main/java/carpet/script/utils/SnoopyCommandSource.java +++ b/src/main/java/carpet/script/utils/SnoopyCommandSource.java @@ -19,6 +19,7 @@ import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; import java.util.List; +import java.util.OptionalLong; import java.util.function.BinaryOperator; import java.util.function.Supplier; @@ -43,11 +44,11 @@ public class SnoopyCommandSource extends CommandSourceStack private final TaskChainer taskChainer; - public SnoopyCommandSource(CommandSourceStack original, Component[] error, List chatOutput) + public SnoopyCommandSource(CommandSourceStack original, Component[] error, List chatOutput, OptionalLong[] returnValue) { super(CommandSource.NULL, original.getPosition(), original.getRotation(), original.getLevel(), Vanilla.MinecraftServer_getRunPermissionLevel(original.getServer()), original.getTextName(), original.getDisplayName(), original.getServer(), original.getEntity(), false, - CommandResultCallback.EMPTY, EntityAnchorArgument.Anchor.FEET, CommandSigningContext.ANONYMOUS, TaskChainer.immediate(original.getServer())); + (b, i) -> returnValue[0] = OptionalLong.of(i), EntityAnchorArgument.Anchor.FEET, CommandSigningContext.ANONYMOUS, TaskChainer.immediate(original.getServer())); this.output = CommandSource.NULL; this.position = original.getPosition(); this.world = original.getLevel(); @@ -56,7 +57,7 @@ public class SnoopyCommandSource extends CommandSourceStack this.name = original.getDisplayName(); this.server = original.getServer(); this.entity = original.getEntity(); - this.resultConsumer = CommandResultCallback.EMPTY; + this.resultConsumer = (b, i) -> returnValue[0] = OptionalLong.of(i); this.entityAnchor = original.getAnchor(); this.rotation = original.getRotation(); this.error = error; @@ -65,7 +66,7 @@ public class SnoopyCommandSource extends CommandSourceStack this.taskChainer = TaskChainer.immediate(original.getServer()); } - public SnoopyCommandSource(ServerPlayer player, Component[] error, List output) + public SnoopyCommandSource(ServerPlayer player, Component[] error, List output, int [] result) { super(player.commandSource(), player.position(), player.getRotationVector(), player.level() instanceof final ServerLevel serverLevel ? serverLevel : null, @@ -79,7 +80,7 @@ public class SnoopyCommandSource extends CommandSourceStack this.name = player.getDisplayName(); this.server = player.level().getServer(); this.entity = player; - this.resultConsumer = CommandResultCallback.EMPTY; + this.resultConsumer = (b, i) -> result[0] = i; this.entityAnchor = EntityAnchorArgument.Anchor.FEET; this.rotation = player.getRotationVector(); // not a client call really this.error = error; @@ -203,5 +204,4 @@ public class SnoopyCommandSource extends CommandSourceStack { chatOutput.add(message.get()); } - } From 9086db94946c51a5d6ceed672ddce26107e157c7 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Sun, 16 Feb 2025 12:12:57 +0100 Subject: [PATCH 055/232] up loom and gradle --- build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 678f16aa..a84237fa 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '1.6-SNAPSHOT' + id 'fabric-loom' version '1.9-SNAPSHOT' id 'io.github.juuxel.loom-quiltflower' version '1.7.3' id 'maven-publish' } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 509c4a29..21d5e095 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From 14be0aef52d2e147398686a9674d3591fa31f461 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Sun, 16 Feb 2025 18:57:19 +0100 Subject: [PATCH 056/232] extract commonly used class from the Tokenizer --- .../java/carpet/script/CarpetScriptHost.java | 2 +- src/main/java/carpet/script/Expression.java | 140 +++++++++--------- src/main/java/carpet/script/Fluff.java | 10 +- .../java/carpet/script/ScriptCommand.java | 4 +- src/main/java/carpet/script/ScriptHost.java | 2 +- src/main/java/carpet/script/Token.java | 69 +++++++++ src/main/java/carpet/script/Tokenizer.java | 81 +--------- .../script/exception/ExpressionException.java | 16 +- .../InternalExpressionException.java | 4 +- .../exception/ProcessedThrowStatement.java | 2 +- .../script/exception/ThrowStatement.java | 2 +- .../carpet/script/language/Functions.java | 4 +- .../carpet/script/value/FunctionValue.java | 14 +- .../java/carpet/script/value/ThreadValue.java | 6 +- 14 files changed, 172 insertions(+), 184 deletions(-) create mode 100644 src/main/java/carpet/script/Token.java diff --git a/src/main/java/carpet/script/CarpetScriptHost.java b/src/main/java/carpet/script/CarpetScriptHost.java index 7a8d8412..a4c05d6c 100644 --- a/src/main/java/carpet/script/CarpetScriptHost.java +++ b/src/main/java/carpet/script/CarpetScriptHost.java @@ -754,7 +754,7 @@ public class CarpetScriptHost extends ScriptHost } } String sign = ""; - for (Tokenizer.Token tok : Tokenizer.simplepass(arg)) + for (Token tok : Tokenizer.simplepass(arg)) { switch (tok.type) { diff --git a/src/main/java/carpet/script/Expression.java b/src/main/java/carpet/script/Expression.java index a76fa015..90f7f0bc 100644 --- a/src/main/java/carpet/script/Expression.java +++ b/src/main/java/carpet/script/Expression.java @@ -130,7 +130,7 @@ public class Expression return constants.get(surface); } - public List getExpressionSnippet(Tokenizer.Token token) + public List getExpressionSnippet(Token token) { String code = this.getCodeString(); List output = new ArrayList<>(getExpressionSnippetLeftContext(token, code, 1)); @@ -140,7 +140,7 @@ public class Expression return output; } - private static List getExpressionSnippetLeftContext(Tokenizer.Token token, String expr, int contextsize) + private static List getExpressionSnippetLeftContext(Token token, String expr, int contextsize) { List output = new ArrayList<>(); String[] lines = expr.split("\n"); @@ -156,7 +156,7 @@ public class Expression return output; } - private static List getExpressionSnippetContext(Tokenizer.Token token, String expr) + private static List getExpressionSnippetContext(Token token, String expr) { List output = new ArrayList<>(); String[] lines = expr.split("\n"); @@ -173,7 +173,7 @@ public class Expression return output; } - private static List getExpressionSnippetRightContext(Tokenizer.Token token, String expr, int contextsize) + private static List getExpressionSnippetRightContext(Token token, String expr, int contextsize) { List output = new ArrayList<>(); String[] lines = expr.split("\n"); @@ -213,7 +213,7 @@ public class Expression } @Override - public LazyValue lazyEval(Context c, Context.Type t, Expression e, Tokenizer.Token token, LazyValue v, LazyValue v2) + public LazyValue lazyEval(Context c, Context.Type t, Expression e, Token token, LazyValue v, LazyValue v2) { try { @@ -229,7 +229,7 @@ public class Expression public void addLazyBinaryOperatorWithDelegation(String surface, int precedence, boolean leftAssoc, boolean pure, - SexFunction lazyfun) + SexFunction lazyfun) { operators.put(surface, new AbstractLazyOperator(precedence, leftAssoc) { @@ -246,7 +246,7 @@ public class Expression } @Override - public LazyValue lazyEval(Context c, Context.Type type, Expression e, Tokenizer.Token t, LazyValue v1, LazyValue v2) + public LazyValue lazyEval(Context c, Context.Type type, Expression e, Token t, LazyValue v1, LazyValue v2) { try { @@ -266,7 +266,7 @@ public class Expression } public void addLazyFunctionWithDelegation(String name, int numpar, boolean pure, boolean transitive, - QuinnFunction, LazyValue> lazyfun) + QuinnFunction, LazyValue> lazyfun) { functions.put(name, new AbstractLazyFunction(numpar, name) { @@ -283,7 +283,7 @@ public class Expression } @Override - public LazyValue lazyEval(Context c, Context.Type type, Expression e, Tokenizer.Token t, List lv) + public LazyValue lazyEval(Context c, Context.Type type, Expression e, Token t, List lv) { ILazyFunction.checkInterrupts(); try @@ -299,7 +299,7 @@ public class Expression } public void addFunctionWithDelegation(String name, int numpar, boolean pure, boolean transitive, - QuinnFunction, Value> fun) + QuinnFunction, Value> fun) { functions.put(name, new AbstractLazyFunction(numpar, name) { @@ -316,7 +316,7 @@ public class Expression } @Override - public LazyValue lazyEval(Context c, Context.Type type, Expression e, Tokenizer.Token t, List lv) + public LazyValue lazyEval(Context c, Context.Type type, Expression e, Token t, List lv) { try { @@ -356,7 +356,7 @@ public class Expression } @Override - public LazyValue lazyEval(Context c, Context.Type t, Expression e, Tokenizer.Token token, LazyValue v1, LazyValue v2) + public LazyValue lazyEval(Context c, Context.Type t, Expression e, Token token, LazyValue v1, LazyValue v2) { ILazyFunction.checkInterrupts(); try @@ -389,7 +389,7 @@ public class Expression } @Override - public LazyValue lazyEval(Context c, Context.Type t, Expression e, Tokenizer.Token token, LazyValue v1, LazyValue v2) + public LazyValue lazyEval(Context c, Context.Type t, Expression e, Token token, LazyValue v1, LazyValue v2) { try { @@ -404,7 +404,7 @@ public class Expression }); } - public static RuntimeException handleCodeException(Context c, RuntimeException exc, Expression e, Tokenizer.Token token) + public static RuntimeException handleCodeException(Context c, RuntimeException exc, Expression e, Token token) { if (exc instanceof ExitStatement) { @@ -568,7 +568,7 @@ public class Expression } @Override - public LazyValue lazyEval(Context c, Context.Type i, Expression e, Tokenizer.Token t, List lazyParams) + public LazyValue lazyEval(Context c, Context.Type i, Expression e, Token t, List lazyParams) { ILazyFunction.checkInterrupts(); if (numParams >= 0 && lazyParams.size() != numParams) @@ -606,7 +606,7 @@ public class Expression } @Override - public LazyValue lazyEval(Context c, Context.Type i, Expression e, Tokenizer.Token t, List lazyParams) + public LazyValue lazyEval(Context c, Context.Type i, Expression e, Token t, List lazyParams) { ILazyFunction.checkInterrupts(); try @@ -644,7 +644,7 @@ public class Expression } @Override - public LazyValue lazyEval(Context c, Context.Type i, Expression e, Tokenizer.Token t, List lazyParams) + public LazyValue lazyEval(Context c, Context.Type i, Expression e, Token t, List lazyParams) { ILazyFunction.checkInterrupts(); try @@ -676,7 +676,7 @@ public class Expression } @Override - public LazyValue lazyEval(Context c, Context.Type i, Expression e, Tokenizer.Token t, List lazyParams) + public LazyValue lazyEval(Context c, Context.Type i, Expression e, Token t, List lazyParams) { ILazyFunction.checkInterrupts(); try @@ -715,7 +715,7 @@ public class Expression } @Override - public LazyValue lazyEval(Context c, Context.Type i, Expression e, Tokenizer.Token t, List lazyParams) + public LazyValue lazyEval(Context c, Context.Type i, Expression e, Token t, List lazyParams) { try { @@ -730,7 +730,7 @@ public class Expression }); } - public FunctionValue createUserDefinedFunction(Context context, String name, Expression expr, Tokenizer.Token token, List arguments, String varArgs, List outers, LazyValue code) + public FunctionValue createUserDefinedFunction(Context context, String name, Expression expr, Token token, List arguments, String varArgs, List outers, LazyValue code) { if (functions.containsKey(name)) { @@ -799,7 +799,7 @@ public class Expression } @Override - public LazyValue lazyEval(Context c, Context.Type type, Expression expr, Tokenizer.Token token, List lazyParams) + public LazyValue lazyEval(Context c, Context.Type type, Expression expr, Token token, List lazyParams) { c.host.issueDeprecation(copy + "(...)"); return originalFunction.lazyEval(c, type, expr, token, lazyParams); @@ -860,18 +860,18 @@ public class Expression } - private List shuntingYard(Context c) + private List shuntingYard(Context c) { - List outputQueue = new ArrayList<>(); - Stack stack = new ObjectArrayList<>(); + List outputQueue = new ArrayList<>(); + Stack stack = new ObjectArrayList<>(); Tokenizer tokenizer = new Tokenizer(c, this, expression, allowComments, allowNewlineSubstitutions); // stripping lousy but acceptable semicolons - List cleanedTokens = tokenizer.postProcess(); + List cleanedTokens = tokenizer.postProcess(); - Tokenizer.Token lastFunction = null; - Tokenizer.Token previousToken = null; - for (Tokenizer.Token token : cleanedTokens) + Token lastFunction = null; + Token previousToken = null; + for (Token token : cleanedTokens) { switch (token.type) { @@ -880,9 +880,9 @@ public class Expression //break; case LITERAL, HEX_LITERAL: if (previousToken != null && ( - previousToken.type == Tokenizer.Token.TokenType.LITERAL || - previousToken.type == Tokenizer.Token.TokenType.HEX_LITERAL || - previousToken.type == Tokenizer.Token.TokenType.STRINGPARAM)) + previousToken.type == Token.TokenType.LITERAL || + previousToken.type == Token.TokenType.HEX_LITERAL || + previousToken.type == Token.TokenType.STRINGPARAM)) { throw new ExpressionException(c, this, token, "Missing operator"); } @@ -896,11 +896,11 @@ public class Expression lastFunction = token; break; case COMMA: - if (previousToken != null && previousToken.type == Tokenizer.Token.TokenType.OPERATOR) + if (previousToken != null && previousToken.type == Token.TokenType.OPERATOR) { throw new ExpressionException(c, this, previousToken, "Missing parameter(s) for operator "); } - while (!stack.isEmpty() && stack.top().type != Tokenizer.Token.TokenType.OPEN_PAREN) + while (!stack.isEmpty() && stack.top().type != Token.TokenType.OPEN_PAREN) { outputQueue.add(stack.pop()); } @@ -919,7 +919,7 @@ public class Expression case OPERATOR: { if (previousToken != null - && (previousToken.type == Tokenizer.Token.TokenType.COMMA || previousToken.type == Tokenizer.Token.TokenType.OPEN_PAREN)) + && (previousToken.type == Token.TokenType.COMMA || previousToken.type == Token.TokenType.OPEN_PAREN)) { throw new ExpressionException(c, this, token, "Missing parameter(s) for operator '" + token + "'"); } @@ -935,8 +935,8 @@ public class Expression } case UNARY_OPERATOR: { - if (previousToken != null && previousToken.type != Tokenizer.Token.TokenType.OPERATOR - && previousToken.type != Tokenizer.Token.TokenType.COMMA && previousToken.type != Tokenizer.Token.TokenType.OPEN_PAREN) + if (previousToken != null && previousToken.type != Token.TokenType.OPERATOR + && previousToken.type != Token.TokenType.COMMA && previousToken.type != Token.TokenType.OPEN_PAREN) { throw new ExpressionException(c, this, token, "Invalid position for unary operator " + token); } @@ -952,18 +952,18 @@ public class Expression } case OPEN_PAREN: // removed implicit multiplication in this missing code block - if (previousToken != null && previousToken.type == Tokenizer.Token.TokenType.FUNCTION) + if (previousToken != null && previousToken.type == Token.TokenType.FUNCTION) { outputQueue.add(token); } stack.push(token); break; case CLOSE_PAREN: - if (previousToken != null && previousToken.type == Tokenizer.Token.TokenType.OPERATOR) + if (previousToken != null && previousToken.type == Token.TokenType.OPERATOR) { throw new ExpressionException(c, this, previousToken, "Missing parameter(s) for operator " + previousToken); } - while (!stack.isEmpty() && stack.top().type != Tokenizer.Token.TokenType.OPEN_PAREN) + while (!stack.isEmpty() && stack.top().type != Token.TokenType.OPEN_PAREN) { outputQueue.add(stack.pop()); } @@ -972,7 +972,7 @@ public class Expression throw new ExpressionException(c, this, "Mismatched parentheses"); } stack.pop(); - if (!stack.isEmpty() && stack.top().type == Tokenizer.Token.TokenType.FUNCTION) + if (!stack.isEmpty() && stack.top().type == Token.TokenType.FUNCTION) { outputQueue.add(stack.pop()); } @@ -986,7 +986,7 @@ public class Expression } break; } - if (token.type != Tokenizer.Token.TokenType.MARKER) + if (token.type != Token.TokenType.MARKER) { previousToken = token; } @@ -994,8 +994,8 @@ public class Expression while (!stack.isEmpty()) { - Tokenizer.Token element = stack.pop(); - if (element.type == Tokenizer.Token.TokenType.OPEN_PAREN || element.type == Tokenizer.Token.TokenType.CLOSE_PAREN) + Token element = stack.pop(); + if (element.type == Token.TokenType.OPEN_PAREN || element.type == Token.TokenType.CLOSE_PAREN) { throw new ExpressionException(c, this, element, "Mismatched parentheses"); } @@ -1004,12 +1004,12 @@ public class Expression return outputQueue; } - private void shuntOperators(List outputQueue, Stack stack, ILazyOperator o1) + private void shuntOperators(List outputQueue, Stack stack, ILazyOperator o1) { - Tokenizer.Token nextToken = stack.isEmpty() ? null : stack.top(); + Token nextToken = stack.isEmpty() ? null : stack.top(); while (nextToken != null - && (nextToken.type == Tokenizer.Token.TokenType.OPERATOR - || nextToken.type == Tokenizer.Token.TokenType.UNARY_OPERATOR) + && (nextToken.type == Token.TokenType.OPERATOR + || nextToken.type == Token.TokenType.UNARY_OPERATOR) && ((o1.isLeftAssoc() && o1.getPrecedence() <= operators.get(nextToken.surface).getPrecedence()) || (o1.getPrecedence() < operators.get(nextToken.surface).getPrecedence()))) { @@ -1059,15 +1059,15 @@ public class Expression { public LazyValue op; public List args; - public Tokenizer.Token token; - public List range; + public Token token; + public List range; /** * The Value representation of the left parenthesis, used for parsing * varying numbers of function parameters. */ - public static final ExpressionNode PARAMS_START = new ExpressionNode(null, null, Tokenizer.Token.NONE); + public static final ExpressionNode PARAMS_START = new ExpressionNode(null, null, Token.NONE); - public ExpressionNode(LazyValue op, List args, Tokenizer.Token token) + public ExpressionNode(LazyValue op, List args, Token token) { this.op = op; this.args = args; @@ -1076,17 +1076,17 @@ public class Expression range.add(token); } - public static ExpressionNode ofConstant(Value val, Tokenizer.Token token) + public static ExpressionNode ofConstant(Value val, Token token) { return new ExpressionNode(new LazyValue.Constant(val), Collections.emptyList(), token); } } - private ExpressionNode RPNToParseTree(List tokens, Context context) + private ExpressionNode RPNToParseTree(List tokens, Context context) { Stack nodeStack = new ObjectArrayList<>(); - for (Tokenizer.Token token : tokens) + for (Token token : tokens) { switch (token.type) { case UNARY_OPERATOR -> { @@ -1104,7 +1104,7 @@ public class Expression Value constant = getConstantFor(token.surface); if (constant != null) { - token.morph(Tokenizer.Token.TokenType.CONSTANT, token.surface); + token.morph(Token.TokenType.CONSTANT, token.surface); nodeStack.push(new ExpressionNode(LazyValue.ofConstant(constant), Collections.emptyList(), token)); } else @@ -1135,8 +1135,8 @@ public class Expression } if (!isKnown) { - p.add(ExpressionNode.ofConstant(new StringValue(name), token.morphedInto(Tokenizer.Token.TokenType.STRINGPARAM, token.surface))); - token.morph(Tokenizer.Token.TokenType.FUNCTION, "call"); + p.add(ExpressionNode.ofConstant(new StringValue(name), token.morphedInto(Token.TokenType.STRINGPARAM, token.surface))); + token.morph(Token.TokenType.FUNCTION, "call"); } Collections.reverse(p); if (nodeStack.top() == ExpressionNode.PARAMS_START) @@ -1160,11 +1160,11 @@ public class Expression { throw new ExpressionException(context, this, token, "Not a number"); } - token.morph(Tokenizer.Token.TokenType.CONSTANT, token.surface); + token.morph(Token.TokenType.CONSTANT, token.surface); nodeStack.push(ExpressionNode.ofConstant(number, token)); } case STRINGPARAM -> { - token.morph(Tokenizer.Token.TokenType.CONSTANT, token.surface); + token.morph(Token.TokenType.CONSTANT, token.surface); nodeStack.push(ExpressionNode.ofConstant(new StringValue(token.surface), token)); } case HEX_LITERAL -> { @@ -1177,7 +1177,7 @@ public class Expression { throw new ExpressionException(context, this, token, "Not a number"); } - token.morph(Tokenizer.Token.TokenType.CONSTANT, token.surface); + token.morph(Token.TokenType.CONSTANT, token.surface); nodeStack.push(ExpressionNode.ofConstant(hexNumber, token)); } default -> throw new ExpressionException(context, this, token, "Unexpected token '" + token.surface + "'"); @@ -1188,7 +1188,7 @@ public class Expression private LazyValue getAST(Context context) { - List rpn = shuntingYard(context); + List rpn = shuntingYard(context); validate(context, rpn); ExpressionNode root = RPNToParseTree(rpn, context); if (!Vanilla.ScriptServer_scriptOptimizations(((CarpetScriptServer)context.scriptServer()).server)) @@ -1272,7 +1272,7 @@ public class Expression { // ctx is just to report errors, not values evaluation boolean optimized = false; - Tokenizer.Token.TokenType token = node.token.type; + Token.TokenType token = node.token.type; if (!token.isFunctional()) { return false; @@ -1284,7 +1284,7 @@ public class Expression } // function or operator String symbol = node.token.surface; - Fluff.EvalNode operation = ((token == Tokenizer.Token.TokenType.FUNCTION) ? functions : operators).get(symbol); + Fluff.EvalNode operation = ((token == Token.TokenType.FUNCTION) ? functions : operators).get(symbol); Context.Type requestedType = operation.staticType(expectedType); for (ExpressionNode arg : node.args) { @@ -1326,7 +1326,7 @@ public class Expression else { returnNode.op = LazyValue.ofConstant(Value.NULL); - returnNode.token.morph(Tokenizer.Token.TokenType.CONSTANT, ""); + returnNode.token.morph(Token.TokenType.CONSTANT, ""); returnNode.args = Collections.emptyList(); if (scriptsDebugging) { @@ -1370,7 +1370,7 @@ public class Expression { CarpetScriptServer.LOG.info(" - " + symbol + "(" + node.args.size() + ") => " + function + "(" + newargs.size() + ") at line " + (node.token.lineno + 1) + ", node depth " + indent); } - node.token.morph(Tokenizer.Token.TokenType.FUNCTION, function); + node.token.morph(Token.TokenType.FUNCTION, function); node.args = newargs; } } @@ -1382,7 +1382,7 @@ public class Expression { // ctx is just to report errors, not values evaluation boolean optimized = false; - Tokenizer.Token.TokenType token = node.token.type; + Token.TokenType token = node.token.type; if (!token.isFunctional()) { return false; @@ -1396,7 +1396,7 @@ public class Expression } // function or operator - Fluff.EvalNode operation = ((token == Tokenizer.Token.TokenType.FUNCTION) ? functions : operators).get(symbol); + Fluff.EvalNode operation = ((token == Token.TokenType.FUNCTION) ? functions : operators).get(symbol); Context.Type requestedType = operation.staticType(expectedType); for (ExpressionNode arg : node.args) { @@ -1491,7 +1491,7 @@ public class Expression Value ret = ((LazyValue.ContextFreeLazyValue) node.op).evalType(expectedType); return (c, t) -> ret; } - Tokenizer.Token token = node.token; + Token token = node.token; switch (token.type) { case UNARY_OPERATOR: @@ -1526,7 +1526,7 @@ public class Expression } } - private void validate(Context c, List rpn) + private void validate(Context c, List rpn) { /*- * Thanks to Norman Ramsey: @@ -1541,7 +1541,7 @@ public class Expression // push the 'global' scope stack.push(0); - for (Tokenizer.Token token : rpn) + for (Token token : rpn) { switch (token.type) { diff --git a/src/main/java/carpet/script/Fluff.java b/src/main/java/carpet/script/Fluff.java index 0ab2e11d..04286062 100644 --- a/src/main/java/carpet/script/Fluff.java +++ b/src/main/java/carpet/script/Fluff.java @@ -70,7 +70,7 @@ public abstract class Fluff boolean numParamsVaries(); - LazyValue lazyEval(Context c, Context.Type type, Expression expr, Tokenizer.Token token, List lazyParams); + LazyValue lazyEval(Context c, Context.Type type, Expression expr, Token token, List lazyParams); static void checkInterrupts() { @@ -93,7 +93,7 @@ public abstract class Fluff boolean isLeftAssoc(); - LazyValue lazyEval(Context c, Context.Type type, Expression e, Tokenizer.Token t, LazyValue v1, LazyValue v2); + LazyValue lazyEval(Context c, Context.Type type, Expression e, Token t, LazyValue v1, LazyValue v2); } public interface IOperator extends ILazyOperator @@ -187,7 +187,7 @@ public abstract class Fluff } @Override - public LazyValue lazyEval(Context cc, Context.Type type, Expression e, Tokenizer.Token t, List lazyParams) + public LazyValue lazyEval(Context cc, Context.Type type, Expression e, Token t, List lazyParams) { return new LazyValue() @@ -273,7 +273,7 @@ public abstract class Fluff } @Override - public LazyValue lazyEval(Context cc, Context.Type type, Expression e, Tokenizer.Token t, LazyValue v1, LazyValue v2) + public LazyValue lazyEval(Context cc, Context.Type type, Expression e, Token t, LazyValue v1, LazyValue v2) { return (c, typeIgnored) -> { try @@ -308,7 +308,7 @@ public abstract class Fluff } @Override - public LazyValue lazyEval(Context cc, Context.Type type, Expression e, Tokenizer.Token t, LazyValue v1, LazyValue v2) + public LazyValue lazyEval(Context cc, Context.Type type, Expression e, Token t, LazyValue v1, LazyValue v2) { if (v2 != null) { diff --git a/src/main/java/carpet/script/ScriptCommand.java b/src/main/java/carpet/script/ScriptCommand.java index 0a0b2188..18b5c282 100644 --- a/src/main/java/carpet/script/ScriptCommand.java +++ b/src/main/java/carpet/script/ScriptCommand.java @@ -37,9 +37,7 @@ import net.minecraft.commands.arguments.blocks.BlockStateArgument; import net.minecraft.commands.arguments.coordinates.BlockPosArgument; import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.Clearable; import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.pattern.BlockInWorld; import net.minecraft.world.level.levelgen.structure.BoundingBox; @@ -438,7 +436,7 @@ public class ScriptCommand return; } Expression expr = fun.getExpression(); - Tokenizer.Token tok = fun.getToken(); + Token tok = fun.getToken(); List snippet = expr.getExpressionSnippet(tok); Carpet.Messenger_message(source, "wb " + fun.fullName(), "t defined at: line " + (tok.lineno + 1) + " pos " + (tok.linepos + 1)); for (String snippetLine : snippet) diff --git a/src/main/java/carpet/script/ScriptHost.java b/src/main/java/carpet/script/ScriptHost.java index 29cd5233..d067d2ab 100644 --- a/src/main/java/carpet/script/ScriptHost.java +++ b/src/main/java/carpet/script/ScriptHost.java @@ -138,7 +138,7 @@ public abstract class ScriptHost @FunctionalInterface public interface ErrorSnooper { - List apply(Expression expression, Tokenizer.Token token, Context context, String message); + List apply(Expression expression, Token token, Context context, String message); } public ErrorSnooper errorSnooper = null; diff --git a/src/main/java/carpet/script/Token.java b/src/main/java/carpet/script/Token.java new file mode 100644 index 00000000..1340f4b3 --- /dev/null +++ b/src/main/java/carpet/script/Token.java @@ -0,0 +1,69 @@ +package carpet.script; + +public class Token { + enum TokenType { + FUNCTION(true, false), OPERATOR(true, false), UNARY_OPERATOR(true, false), + VARIABLE(false, false), CONSTANT(false, true), + LITERAL(false, true), HEX_LITERAL(false, true), STRINGPARAM(false, true), + OPEN_PAREN(false, true), COMMA(false, true), CLOSE_PAREN(false, true), MARKER(false, true); + + final boolean functional; + final boolean constant; + + TokenType(boolean functional, boolean constant) { + this.functional = functional; + this.constant = constant; + } + + public boolean isFunctional() { + return functional; + } + + public boolean isConstant() { + return constant; + } + } + + public String surface = ""; + public TokenType type; + public int pos; + public int linepos; + public int lineno; + public static final Token NONE = new Token(); + + public Token morphedInto(TokenType newType, String newSurface) { + Token created = new Token(); + created.surface = newSurface; + created.type = newType; + created.pos = pos; + created.linepos = linepos; + created.lineno = lineno; + return created; + } + + public void morph(TokenType type, String s) { + this.type = type; + this.surface = s; + } + + public void append(char c) { + surface += c; + } + + public void append(String s) { + surface += s; + } + + public char charAt(int pos) { + return surface.charAt(pos); + } + + public int length() { + return surface.length(); + } + + @Override + public String toString() { + return surface; + } +} diff --git a/src/main/java/carpet/script/Tokenizer.java b/src/main/java/carpet/script/Tokenizer.java index 90994f00..21917031 100644 --- a/src/main/java/carpet/script/Tokenizer.java +++ b/src/main/java/carpet/script/Tokenizer.java @@ -14,7 +14,7 @@ import java.util.stream.StreamSupport; * Expression tokenizer that allows to iterate over a {@link String} * expression token by token. Blank characters will be skipped. */ -public class Tokenizer implements Iterator +public class Tokenizer implements Iterator { /** * What character to use for decimal separators. @@ -421,83 +421,4 @@ public class Tokenizer implements Iterator throw new InternalExpressionException("remove() not supported"); } - public static class Token - { - enum TokenType - { - FUNCTION(true, false), OPERATOR(true, false), UNARY_OPERATOR(true, false), - VARIABLE(false, false), CONSTANT(false, true), - LITERAL(false, true), HEX_LITERAL(false, true), STRINGPARAM(false, true), - OPEN_PAREN(false, true), COMMA(false, true), CLOSE_PAREN(false, true), MARKER(false, true); - - final boolean functional; - final boolean constant; - - TokenType(boolean functional, boolean constant) - { - this.functional = functional; - this.constant = constant; - } - - public boolean isFunctional() - { - return functional; - } - - public boolean isConstant() - { - return constant; - } - } - - public String surface = ""; - public TokenType type; - public int pos; - public int linepos; - public int lineno; - public static final Token NONE = new Token(); - - public Token morphedInto(TokenType newType, String newSurface) - { - Token created = new Token(); - created.surface = newSurface; - created.type = newType; - created.pos = pos; - created.linepos = linepos; - created.lineno = lineno; - return created; - } - - public void morph(TokenType type, String s) - { - this.type = type; - this.surface = s; - } - - public void append(char c) - { - surface += c; - } - - public void append(String s) - { - surface += s; - } - - public char charAt(int pos) - { - return surface.charAt(pos); - } - - public int length() - { - return surface.length(); - } - - @Override - public String toString() - { - return surface; - } - } } diff --git a/src/main/java/carpet/script/exception/ExpressionException.java b/src/main/java/carpet/script/exception/ExpressionException.java index d0ab1650..a2cdd1f0 100644 --- a/src/main/java/carpet/script/exception/ExpressionException.java +++ b/src/main/java/carpet/script/exception/ExpressionException.java @@ -2,7 +2,7 @@ package carpet.script.exception; import carpet.script.Context; import carpet.script.Expression; -import carpet.script.Tokenizer; +import carpet.script.Token; import carpet.script.external.Carpet; import carpet.script.value.FunctionValue; @@ -16,7 +16,7 @@ import java.util.function.Supplier; public class ExpressionException extends StacklessRuntimeException implements ResolvedException { public final Context context; - public final Tokenizer.Token token; + public final Token token; public final List stack = new ArrayList<>(); private final Supplier lazyMessage; private String cachedMessage = null; @@ -28,15 +28,15 @@ public class ExpressionException extends StacklessRuntimeException implements Re public ExpressionException(Context c, Expression e, String message) { - this(c, e, Tokenizer.Token.NONE, message); + this(c, e, Token.NONE, message); } - public ExpressionException(Context c, Expression e, Tokenizer.Token t, String message) + public ExpressionException(Context c, Expression e, Token t, String message) { this(c, e, t, message, Collections.emptyList()); } - public ExpressionException(Context c, Expression e, Tokenizer.Token t, String message, List stack) + public ExpressionException(Context c, Expression e, Token t, String message, List stack) { super("Error"); this.stack.addAll(stack); @@ -45,7 +45,7 @@ public class ExpressionException extends StacklessRuntimeException implements Re context = c; } - public ExpressionException(Context c, Expression e, Tokenizer.Token t, Supplier messageSupplier, List stack) + public ExpressionException(Context c, Expression e, Token t, Supplier messageSupplier, List stack) { super("Error"); this.stack.addAll(stack); @@ -54,7 +54,7 @@ public class ExpressionException extends StacklessRuntimeException implements Re context = c; } - private static List makeError(Expression expr, @Nullable Tokenizer.Token token, String errmessage) + private static List makeError(Expression expr, @Nullable Token token, String errmessage) { List errMsg = new ArrayList<>(); errmessage += expr.getModuleName() == null ? "" : (" in " + expr.getModuleName()); @@ -76,7 +76,7 @@ public class ExpressionException extends StacklessRuntimeException implements Re return errMsg; } - static synchronized String makeMessage(Context c, Expression e, Tokenizer.Token t, String message) throws ExpressionException + static synchronized String makeMessage(Context c, Expression e, Token t, String message) throws ExpressionException { if (c.getErrorSnooper() != null) { diff --git a/src/main/java/carpet/script/exception/InternalExpressionException.java b/src/main/java/carpet/script/exception/InternalExpressionException.java index ef850ed1..c37acde7 100644 --- a/src/main/java/carpet/script/exception/InternalExpressionException.java +++ b/src/main/java/carpet/script/exception/InternalExpressionException.java @@ -2,7 +2,7 @@ package carpet.script.exception; import carpet.script.Context; import carpet.script.Expression; -import carpet.script.Tokenizer; +import carpet.script.Token; import carpet.script.value.FunctionValue; import java.util.ArrayList; @@ -30,7 +30,7 @@ public class InternalExpressionException extends StacklessRuntimeException * @return The new {@link ExpressionException} (or {@link ProcessedThrowStatement}), * depending on the implementation. */ - public ExpressionException promote(Context c, Expression e, Tokenizer.Token token) + public ExpressionException promote(Context c, Expression e, Token token) { return new ExpressionException(c, e, token, getMessage(), stack); } diff --git a/src/main/java/carpet/script/exception/ProcessedThrowStatement.java b/src/main/java/carpet/script/exception/ProcessedThrowStatement.java index 3768550b..7d5cc7fc 100644 --- a/src/main/java/carpet/script/exception/ProcessedThrowStatement.java +++ b/src/main/java/carpet/script/exception/ProcessedThrowStatement.java @@ -4,7 +4,7 @@ import java.util.List; import carpet.script.Context; import carpet.script.Expression; -import carpet.script.Tokenizer.Token; +import carpet.script.Token; import carpet.script.value.FunctionValue; import carpet.script.value.Value; diff --git a/src/main/java/carpet/script/exception/ThrowStatement.java b/src/main/java/carpet/script/exception/ThrowStatement.java index 40cf10b9..67abccb0 100644 --- a/src/main/java/carpet/script/exception/ThrowStatement.java +++ b/src/main/java/carpet/script/exception/ThrowStatement.java @@ -2,7 +2,7 @@ package carpet.script.exception; import carpet.script.Context; import carpet.script.Expression; -import carpet.script.Tokenizer.Token; +import carpet.script.Token; import carpet.script.value.StringValue; import carpet.script.value.Value; diff --git a/src/main/java/carpet/script/language/Functions.java b/src/main/java/carpet/script/language/Functions.java index 8bc29712..509b7270 100644 --- a/src/main/java/carpet/script/language/Functions.java +++ b/src/main/java/carpet/script/language/Functions.java @@ -4,7 +4,7 @@ import carpet.script.Context; import carpet.script.Expression; import carpet.script.Fluff; import carpet.script.LazyValue; -import carpet.script.Tokenizer; +import carpet.script.Token; import carpet.script.argument.FunctionArgument; import carpet.script.exception.InternalExpressionException; import carpet.script.exception.ReturnStatement; @@ -45,7 +45,7 @@ public class Functions expression.addCustomFunction("call", new Fluff.AbstractLazyFunction(-1, "call") { @Override - public LazyValue lazyEval(Context c, Context.Type t, Expression expr, Tokenizer.Token tok, List lv) + public LazyValue lazyEval(Context c, Context.Type t, Expression expr, Token tok, List lv) { if (lv.isEmpty()) { diff --git a/src/main/java/carpet/script/value/FunctionValue.java b/src/main/java/carpet/script/value/FunctionValue.java index 1cc7f449..db54f1aa 100644 --- a/src/main/java/carpet/script/value/FunctionValue.java +++ b/src/main/java/carpet/script/value/FunctionValue.java @@ -6,7 +6,7 @@ import carpet.script.Expression; import carpet.script.Fluff; import carpet.script.LazyValue; import carpet.script.Module; -import carpet.script.Tokenizer; +import carpet.script.Token; import carpet.script.exception.BreakStatement; import carpet.script.exception.ContinueStatement; import carpet.script.exception.ExpressionException; @@ -28,7 +28,7 @@ import javax.annotation.Nullable; public class FunctionValue extends Value implements Fluff.ILazyFunction { private final Expression expression; - private final Tokenizer.Token token; + private final Token token; private final String name; private final LazyValue body; private Map outerState; @@ -37,7 +37,7 @@ public class FunctionValue extends Value implements Fluff.ILazyFunction private static long variantCounter = 1; private long variant; - private FunctionValue(Expression expression, Tokenizer.Token token, String name, LazyValue body, List args, String varArgs) + private FunctionValue(Expression expression, Token token, String name, LazyValue body, List args, String varArgs) { this.expression = expression; this.token = token; @@ -49,7 +49,7 @@ public class FunctionValue extends Value implements Fluff.ILazyFunction variant = 0L; } - public FunctionValue(Expression expression, Tokenizer.Token token, String name, LazyValue body, List args, String varArgs, Map outerState) + public FunctionValue(Expression expression, Token token, String name, LazyValue body, List args, String varArgs, Map outerState) { this.expression = expression; this.token = token; @@ -214,13 +214,13 @@ public class FunctionValue extends Value implements Fluff.ILazyFunction } @Override - public LazyValue lazyEval(Context c, Context.Type type, Expression e, Tokenizer.Token t, List lazyParams) + public LazyValue lazyEval(Context c, Context.Type type, Expression e, Token t, List lazyParams) { List resolvedParams = unpackArgs(lazyParams, c); return execute(c, type, e, t, resolvedParams, null); } - public LazyValue execute(Context c, Context.Type type, Expression e, Tokenizer.Token t, List params, @Nullable ThreadValue freshNewCallingThread) + public LazyValue execute(Context c, Context.Type type, Expression e, Token t, List params, @Nullable ThreadValue freshNewCallingThread) { assertArgsOk(params, fixedArgs -> { if (fixedArgs) // wrong number of args for fixed args @@ -288,7 +288,7 @@ public class FunctionValue extends Value implements Fluff.ILazyFunction return expression; } - public Tokenizer.Token getToken() + public Token getToken() { return token; } diff --git a/src/main/java/carpet/script/value/ThreadValue.java b/src/main/java/carpet/script/value/ThreadValue.java index e5665557..793a2d5f 100644 --- a/src/main/java/carpet/script/value/ThreadValue.java +++ b/src/main/java/carpet/script/value/ThreadValue.java @@ -2,7 +2,7 @@ package carpet.script.value; import carpet.script.Context; import carpet.script.Expression; -import carpet.script.Tokenizer; +import carpet.script.Token; import carpet.script.exception.ExitStatement; import carpet.script.exception.ExpressionException; import carpet.script.exception.InternalExpressionException; @@ -28,7 +28,7 @@ public class ThreadValue extends LazyListValue private final AtomicReference coLock = new AtomicReference<>(Value.EOL); public final boolean isCoroutine; - public ThreadValue(Value pool, FunctionValue function, Expression expr, Tokenizer.Token token, Context ctx, List args) + public ThreadValue(Value pool, FunctionValue function, Expression expr, Token token, Context ctx, List args) { this.id = sequence++; this.isCoroutine = ctx.host.canSynchronouslyExecute(); @@ -37,7 +37,7 @@ public class ThreadValue extends LazyListValue Thread.yield(); } - public CompletableFuture getCompletableFutureFromFunction(Value pool, FunctionValue function, Expression expr, Tokenizer.Token token, Context ctx, List args) + public CompletableFuture getCompletableFutureFromFunction(Value pool, FunctionValue function, Expression expr, Token token, Context ctx, List args) { ExecutorService executor = ctx.host.getExecutor(pool); ThreadValue callingThread = isCoroutine ? this : null; From 29e139794c99bb9b24a4f1011322d67b0debb690 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Mon, 17 Feb 2025 00:32:13 +0100 Subject: [PATCH 057/232] streamline parsing and evaluation structure --- .../java/carpet/script/CarpetScriptHost.java | 2 +- src/main/java/carpet/script/Expression.java | 29 ++++++----- src/main/java/carpet/script/Tokenizer.java | 49 +++++++------------ 3 files changed, 36 insertions(+), 44 deletions(-) diff --git a/src/main/java/carpet/script/CarpetScriptHost.java b/src/main/java/carpet/script/CarpetScriptHost.java index a4c05d6c..7d6e18a6 100644 --- a/src/main/java/carpet/script/CarpetScriptHost.java +++ b/src/main/java/carpet/script/CarpetScriptHost.java @@ -754,7 +754,7 @@ public class CarpetScriptHost extends ScriptHost } } String sign = ""; - for (Token tok : Tokenizer.simplepass(arg)) + for (Token tok : Tokenizer.simple(arg).parseTokens()) { switch (tok.type) { diff --git a/src/main/java/carpet/script/Expression.java b/src/main/java/carpet/script/Expression.java index 90f7f0bc..ba02535d 100644 --- a/src/main/java/carpet/script/Expression.java +++ b/src/main/java/carpet/script/Expression.java @@ -860,18 +860,13 @@ public class Expression } - private List shuntingYard(Context c) + private List shuntingYard(Context c, List tokens) { List outputQueue = new ArrayList<>(); Stack stack = new ObjectArrayList<>(); - - Tokenizer tokenizer = new Tokenizer(c, this, expression, allowComments, allowNewlineSubstitutions); - // stripping lousy but acceptable semicolons - List cleanedTokens = tokenizer.postProcess(); - Token lastFunction = null; Token previousToken = null; - for (Token token : cleanedTokens) + for (Token token : tokens) { switch (token.type) { @@ -1188,7 +1183,11 @@ public class Expression private LazyValue getAST(Context context) { - List rpn = shuntingYard(context); + Tokenizer tokenizer = new Tokenizer(context, this, expression, allowComments, allowNewlineSubstitutions); + // stripping lousy but acceptable semicolons + List cleanedTokens = Tokenizer.postProcess(tokenizer.parseTokens()); + + List rpn = shuntingYard(context, cleanedTokens); validate(context, rpn); ExpressionNode root = RPNToParseTree(rpn, context); if (!Vanilla.ScriptServer_scriptOptimizations(((CarpetScriptServer)context.scriptServer()).server)) @@ -1197,7 +1196,12 @@ public class Expression } Context optimizeOnlyContext = new Context.ContextForErrorReporting(context); - boolean scriptsDebugging = Vanilla.ScriptServer_scriptDebugging(((CarpetScriptServer)context.scriptServer()).server); + optimizeTree(context, root, optimizeOnlyContext); + return extractOp(optimizeOnlyContext, root, Context.Type.NONE); + } + + private void optimizeTree(Context context, ExpressionNode root, Context optimizeOnlyContext) { + boolean scriptsDebugging = Vanilla.ScriptServer_scriptDebugging(((CarpetScriptServer) context.scriptServer()).server); if (scriptsDebugging) { CarpetScriptServer.LOG.info("Input code size for " + getModuleName() + ": " + treeSize(root) + " nodes, " + treeDepth(root) + " deep"); @@ -1236,7 +1240,7 @@ public class Expression prevTreeSize = treeSize(root); prevTreeDepth = treeDepth(root); } - boolean optimized = optimizeTree(optimizeOnlyContext, root, Context.Type.NONE, 0, scriptsDebugging); + boolean optimized = optimizeConstantsAndPureFunctions(optimizeOnlyContext, root, Context.Type.NONE, 0, scriptsDebugging); if (!optimized) { break; @@ -1248,7 +1252,6 @@ public class Expression } } } - return extractOp(optimizeOnlyContext, root, Context.Type.NONE); } public Value explain(Context context) @@ -1378,7 +1381,7 @@ public class Expression return optimized; } - private boolean optimizeTree(Context ctx, ExpressionNode node, Context.Type expectedType, int indent, boolean scriptsDebugging) + private boolean optimizeConstantsAndPureFunctions(Context ctx, ExpressionNode node, Context.Type expectedType, int indent, boolean scriptsDebugging) { // ctx is just to report errors, not values evaluation boolean optimized = false; @@ -1400,7 +1403,7 @@ public class Expression Context.Type requestedType = operation.staticType(expectedType); for (ExpressionNode arg : node.args) { - if (optimizeTree(ctx, arg, requestedType, indent + 1, scriptsDebugging)) + if (optimizeConstantsAndPureFunctions(ctx, arg, requestedType, indent + 1, scriptsDebugging)) { optimized = true; } diff --git a/src/main/java/carpet/script/Tokenizer.java b/src/main/java/carpet/script/Tokenizer.java index 21917031..e342022b 100644 --- a/src/main/java/carpet/script/Tokenizer.java +++ b/src/main/java/carpet/script/Tokenizer.java @@ -1,20 +1,16 @@ package carpet.script; import carpet.script.exception.ExpressionException; -import carpet.script.exception.InternalExpressionException; import java.util.ArrayList; import java.util.Collections; -import java.util.Iterator; import java.util.List; -import java.util.stream.Collectors; -import java.util.stream.StreamSupport; /** * Expression tokenizer that allows to iterate over a {@link String} * expression token by token. Blank characters will be skipped. */ -public class Tokenizer implements Iterator +public class Tokenizer { /** * What character to use for decimal separators. @@ -53,15 +49,18 @@ public class Tokenizer implements Iterator this.newLinesMarkers = allowNewLineMakers; } - public List postProcess() + public static Tokenizer simple(String input) + { + return new Tokenizer(null, null, input, false, false); + } + + public static List postProcess(List originalTokens) { - Iterable iterable = () -> this; - List originalTokens = StreamSupport.stream(iterable.spliterator(), false).collect(Collectors.toList()); List cleanedTokens = new ArrayList<>(); Token last = null; - while (!originalTokens.isEmpty()) + for (int i = originalTokens.size() - 1; i >= 0; i--) { - Token current = originalTokens.remove(originalTokens.size() - 1); + Token current = originalTokens.get(i); if (current.type == Token.TokenType.MARKER && current.surface.startsWith("//")) { continue; @@ -104,7 +103,16 @@ public class Tokenizer implements Iterator return cleanedTokens; } - @Override + public List parseTokens() + { + List tokens = new ArrayList<>(); + while (hasNext()) + { + tokens.add(next()); + } + return tokens; + } + public boolean hasNext() { return (pos < input.length()); @@ -132,18 +140,6 @@ public class Tokenizer implements Iterator || (tok.type == Token.TokenType.UNARY_OPERATOR && tok.surface.equals(";u")); } - public static List simplepass(String input) - { - Tokenizer tok = new Tokenizer(null, null, input, false, false); - List res = new ArrayList<>(); - while (tok.hasNext()) - { - res.add(tok.next()); - } - return res; - } - - @Override public Token next() { Token token = new Token(); @@ -414,11 +410,4 @@ public class Tokenizer implements Iterator } return previousToken = token; } - - @Override - public void remove() - { - throw new InternalExpressionException("remove() not supported"); - } - } From 6dd7bda6e4d4f38add508447505d467aaa46042f Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Wed, 19 Feb 2025 11:10:02 +0100 Subject: [PATCH 058/232] move gamerule access out of expression, ranames --- .../java/carpet/script/CarpetExpression.java | 15 ++++- .../java/carpet/script/CarpetScriptHost.java | 6 +- src/main/java/carpet/script/Expression.java | 67 ++++++++++--------- 3 files changed, 51 insertions(+), 37 deletions(-) diff --git a/src/main/java/carpet/script/CarpetExpression.java b/src/main/java/carpet/script/CarpetExpression.java index ee0f51f5..a766666d 100644 --- a/src/main/java/carpet/script/CarpetExpression.java +++ b/src/main/java/carpet/script/CarpetExpression.java @@ -12,6 +12,7 @@ import carpet.script.api.WorldAccess; import carpet.script.exception.CarpetExpressionException; import carpet.script.exception.ExpressionException; import carpet.script.external.Carpet; +import carpet.script.external.Vanilla; import carpet.script.value.BlockValue; import carpet.script.value.EntityValue; import carpet.script.value.NumericValue; @@ -20,6 +21,8 @@ import net.minecraft.commands.CommandSourceStack; import net.minecraft.core.BlockPos; import net.minecraft.world.entity.Entity; +import java.util.List; + public class CarpetExpression { private final CommandSourceStack source; @@ -86,7 +89,11 @@ public class CarpetExpression Value playerValue = new EntityValue(e).bindTo("p"); context.with("p", (cc, tt) -> playerValue); } - return scriptServer.events.handleEvents.getWhileDisabled(() -> this.expr.eval(context).getBoolean()); + return scriptServer.events.handleEvents.getWhileDisabled(() -> this.expr.executeAndEvaluate( + context, + Vanilla.ScriptServer_scriptOptimizations(scriptServer.server), + Vanilla.ScriptServer_scriptDebugging(scriptServer.server) ? CarpetScriptServer.LOG::info : null + ).getBoolean()); } catch (ExpressionException e) { @@ -126,7 +133,11 @@ public class CarpetExpression Value playerValue = new EntityValue(e).bindTo("p"); context.with("p", (cc, tt) -> playerValue); } - return scriptServer.events.handleEvents.getWhileDisabled(() -> this.expr.eval(context)); + return scriptServer.events.handleEvents.getWhileDisabled(() -> this.expr.executeAndEvaluate( + context, + Vanilla.ScriptServer_scriptOptimizations(scriptServer.server), + Vanilla.ScriptServer_scriptDebugging(scriptServer.server) ? CarpetScriptServer.LOG::info : null + )); } catch (ExpressionException e) { diff --git a/src/main/java/carpet/script/CarpetScriptHost.java b/src/main/java/carpet/script/CarpetScriptHost.java index 7d6e18a6..a1091199 100644 --- a/src/main/java/carpet/script/CarpetScriptHost.java +++ b/src/main/java/carpet/script/CarpetScriptHost.java @@ -829,7 +829,7 @@ public class CarpetScriptHost extends ScriptHost // TODO: this is just for now - invoke would be able to invoke other hosts scripts assertAppIntegrity(function.getModule()); Context context = new CarpetContext(this, source); - return scriptServer().events.handleEvents.getWhileDisabled(() -> function.getExpression().evalValue( + return scriptServer().events.handleEvents.getWhileDisabled(() -> function.getExpression().evaluatePartial( () -> function.lazyEval(context, Context.VOID, function.getExpression(), function.getToken(), argv), context, Context.VOID @@ -862,7 +862,7 @@ public class CarpetScriptHost extends ScriptHost { assertAppIntegrity(function.getModule()); Context context = new CarpetContext(this, source); - return function.getExpression().evalValue( + return function.getExpression().evaluatePartial( () -> function.execute(context, Context.VOID, function.getExpression(), function.getToken(), argv, null), context, Context.VOID @@ -899,7 +899,7 @@ public class CarpetScriptHost extends ScriptHost { assertAppIntegrity(fun.getModule()); Context context = new CarpetContext(this, source, origin); - return fun.getExpression().evalValue( + return fun.getExpression().evaluatePartial( () -> fun.execute(context, Context.VOID, fun.getExpression(), fun.getToken(), argv, null), context, Context.VOID); diff --git a/src/main/java/carpet/script/Expression.java b/src/main/java/carpet/script/Expression.java index ba02535d..bba8bfcf 100644 --- a/src/main/java/carpet/script/Expression.java +++ b/src/main/java/carpet/script/Expression.java @@ -19,7 +19,6 @@ import carpet.script.exception.IntegrityException; import carpet.script.exception.InternalExpressionException; import carpet.script.exception.ResolvedException; import carpet.script.exception.ReturnStatement; -import carpet.script.external.Vanilla; import carpet.script.language.Arithmetic; import carpet.script.language.ControlFlow; import carpet.script.language.DataStructures; @@ -36,7 +35,9 @@ import it.unimi.dsi.fastutil.Stack; import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import org.apache.commons.lang3.StringUtils; +import javax.annotation.Nullable; import java.math.BigInteger; import java.util.ArrayList; import java.util.Collections; @@ -45,6 +46,7 @@ import java.util.List; import java.util.Map; import java.util.Set; import java.util.function.BiFunction; +import java.util.function.Consumer; import java.util.function.DoubleBinaryOperator; import java.util.function.DoubleToLongFunction; import java.util.function.DoubleUnaryOperator; @@ -1013,16 +1015,16 @@ public class Expression } } - public Value eval(Context c) + public Value executeAndEvaluate(Context c, boolean optimize, @Nullable Consumer logger) { if (ast == null) { - ast = getAST(c); + ast = getAST(c, optimize, logger); } - return evalValue(() -> ast, c, Context.Type.NONE); + return evaluatePartial(() -> ast, c, Context.Type.NONE); } - public Value evalValue(Supplier exprProvider, Context c, Context.Type expectedType) + public Value evaluatePartial(Supplier exprProvider, Context c, Context.Type expectedType) { try { @@ -1181,7 +1183,7 @@ public class Expression return nodeStack.pop(); } - private LazyValue getAST(Context context) + private LazyValue getAST(Context context, boolean optimize, @Nullable Consumer logger) { Tokenizer tokenizer = new Tokenizer(context, this, expression, allowComments, allowNewlineSubstitutions); // stripping lousy but acceptable semicolons @@ -1190,21 +1192,22 @@ public class Expression List rpn = shuntingYard(context, cleanedTokens); validate(context, rpn); ExpressionNode root = RPNToParseTree(rpn, context); - if (!Vanilla.ScriptServer_scriptOptimizations(((CarpetScriptServer)context.scriptServer()).server)) + if (!optimize) { return root.op; } Context optimizeOnlyContext = new Context.ContextForErrorReporting(context); - optimizeTree(context, root, optimizeOnlyContext); + // flipping to full functional representation makes it little underperforming, might be related + // to the fact that operators are running from a bigger pool or function execution is slower + optimizeTree(root, optimizeOnlyContext, logger, false); return extractOp(optimizeOnlyContext, root, Context.Type.NONE); } - private void optimizeTree(Context context, ExpressionNode root, Context optimizeOnlyContext) { - boolean scriptsDebugging = Vanilla.ScriptServer_scriptDebugging(((CarpetScriptServer) context.scriptServer()).server); - if (scriptsDebugging) + private void optimizeTree(ExpressionNode root, Context optimizeOnlyContext, @Nullable Consumer logger, boolean toFunctional) { + if (logger != null) { - CarpetScriptServer.LOG.info("Input code size for " + getModuleName() + ": " + treeSize(root) + " nodes, " + treeDepth(root) + " deep"); + logger.accept("Input code size for " + getModuleName() + ": " + treeSize(root) + " nodes, " + treeDepth(root) + " deep"); } // Defined out here to not need to conditionally assign them with debugging disabled @@ -1217,38 +1220,38 @@ public class Expression changed = false; while (true) { - if (scriptsDebugging) + if (logger != null) { prevTreeSize = treeSize(root); prevTreeDepth = treeDepth(root); } - boolean optimized = compactTree(root, Context.Type.NONE, 0, scriptsDebugging); + boolean optimized = compactTree(root, Context.Type.NONE, 0, logger, toFunctional); if (!optimized) { break; } changed = true; - if (scriptsDebugging) + if (logger != null) { - CarpetScriptServer.LOG.info("Compacted from " + prevTreeSize + " nodes, " + prevTreeDepth + " code depth to " + treeSize(root) + " nodes, " + treeDepth(root) + " code depth"); + logger.accept("Compacted from " + prevTreeSize + " nodes, " + prevTreeDepth + " code depth to " + treeSize(root) + " nodes, " + treeDepth(root) + " code depth"); } } while (true) { - if (scriptsDebugging) + if (logger != null) { prevTreeSize = treeSize(root); prevTreeDepth = treeDepth(root); } - boolean optimized = optimizeConstantsAndPureFunctions(optimizeOnlyContext, root, Context.Type.NONE, 0, scriptsDebugging); + boolean optimized = optimizeConstantsAndPureFunctions(optimizeOnlyContext, root, Context.Type.NONE, 0, logger); if (!optimized) { break; } changed = true; - if (scriptsDebugging) + if (logger != null) { - CarpetScriptServer.LOG.info("Optimized from " + prevTreeSize + " nodes, " + prevTreeDepth + " code depth to " + treeSize(root) + " nodes, " + treeDepth(root) + " code depth"); + logger.accept("Optimized from " + prevTreeSize + " nodes, " + prevTreeDepth + " code depth to " + treeSize(root) + " nodes, " + treeDepth(root) + " code depth"); } } } @@ -1271,7 +1274,7 @@ public class Expression } - private boolean compactTree(ExpressionNode node, Context.Type expectedType, int indent, boolean scriptsDebugging) + private boolean compactTree(ExpressionNode node, Context.Type expectedType, int indent, @Nullable Consumer logger, boolean toFunctional) { // ctx is just to report errors, not values evaluation boolean optimized = false; @@ -1291,7 +1294,7 @@ public class Expression Context.Type requestedType = operation.staticType(expectedType); for (ExpressionNode arg : node.args) { - if (compactTree(arg, requestedType, indent + 1, scriptsDebugging)) + if (compactTree(arg, requestedType, indent + 1, logger, toFunctional)) { optimized = true; } @@ -1321,9 +1324,9 @@ public class Expression returnNode.token = returnNode.args.get(0).token; returnNode.range = returnNode.args.get(0).range; returnNode.args = returnNode.args.get(0).args; - if (scriptsDebugging) + if (logger != null) { - CarpetScriptServer.LOG.info(" - Removed unnecessary tail return of " + returnNode.token.surface + " from function body at line " + (returnNode.token.lineno + 1) + ", node depth " + indent); + logger.accept(" - Removed unnecessary tail return of " + returnNode.token.surface + " from function body at line " + (returnNode.token.lineno + 1) + ", node depth " + indent); } } else @@ -1331,9 +1334,9 @@ public class Expression returnNode.op = LazyValue.ofConstant(Value.NULL); returnNode.token.morph(Token.TokenType.CONSTANT, ""); returnNode.args = Collections.emptyList(); - if (scriptsDebugging) + if (logger != null) { - CarpetScriptServer.LOG.info(" - Removed unnecessary tail return from function body at line " + (returnNode.token.lineno + 1) + ", node depth " + indent); + logger.accept(" - Removed unnecessary tail return from function body at line " + (returnNode.token.lineno + 1) + ", node depth " + indent); } } @@ -1369,9 +1372,9 @@ public class Expression newargs.addAll(optimizedChild.args); } - if (scriptsDebugging) + if (logger != null) { - CarpetScriptServer.LOG.info(" - " + symbol + "(" + node.args.size() + ") => " + function + "(" + newargs.size() + ") at line " + (node.token.lineno + 1) + ", node depth " + indent); + logger.accept(" - " + symbol + "(" + node.args.size() + ") => " + function + "(" + newargs.size() + ") at line " + (node.token.lineno + 1) + ", node depth " + indent); } node.token.morph(Token.TokenType.FUNCTION, function); node.args = newargs; @@ -1381,7 +1384,7 @@ public class Expression return optimized; } - private boolean optimizeConstantsAndPureFunctions(Context ctx, ExpressionNode node, Context.Type expectedType, int indent, boolean scriptsDebugging) + private boolean optimizeConstantsAndPureFunctions(Context ctx, ExpressionNode node, Context.Type expectedType, int indent, @Nullable Consumer logger) { // ctx is just to report errors, not values evaluation boolean optimized = false; @@ -1403,7 +1406,7 @@ public class Expression Context.Type requestedType = operation.staticType(expectedType); for (ExpressionNode arg : node.args) { - if (optimizeConstantsAndPureFunctions(ctx, arg, requestedType, indent + 1, scriptsDebugging)) + if (optimizeConstantsAndPureFunctions(ctx, arg, requestedType, indent + 1, logger)) { optimized = true; } @@ -1470,9 +1473,9 @@ public class Expression result = ((ILazyOperator) operation).lazyEval(ctx, expectedType, this, node.token, args.get(0), args.get(1)).evalValue(null, expectedType); } node.op = LazyValue.ofConstant(result); - if (scriptsDebugging) + if (logger != null) { - CarpetScriptServer.LOG.info(" - " + symbol + "(" + args.stream().map(a -> a.evalValue(null, requestedType).getString()).collect(Collectors.joining(", ")) + ") => " + result.getString() + " at line " + (node.token.lineno + 1) + ", node depth " + indent); + logger.accept(" - " + symbol + "(" + args.stream().map(a -> a.evalValue(null, requestedType).getString()).collect(Collectors.joining(", ")) + ") => " + result.getString() + " at line " + (node.token.lineno + 1) + ", node depth " + indent); } return true; } From 234c176670a579d9cd149bd21f8a5c1f36abade6 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Wed, 19 Feb 2025 11:13:31 +0100 Subject: [PATCH 059/232] small things --- src/main/java/carpet/script/Expression.java | 4 ++-- src/main/java/carpet/script/language/Operators.java | 1 + src/main/java/carpet/script/value/LazyListValue.java | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/carpet/script/Expression.java b/src/main/java/carpet/script/Expression.java index bba8bfcf..3689d1f5 100644 --- a/src/main/java/carpet/script/Expression.java +++ b/src/main/java/carpet/script/Expression.java @@ -1346,14 +1346,13 @@ public class Expression { String operator = pair.getKey(); String function = pair.getValue(); - if ((symbol.equals(operator) || symbol.equals(function)) && node.args.size() > 0) + if ((symbol.equals(operator) || symbol.equals(function)) && !node.args.isEmpty()) { boolean leftOptimizable = operators.get(operator).isLeftAssoc(); ExpressionNode optimizedChild = node.args.get(leftOptimizable ? 0 : (node.args.size() - 1)); String type = optimizedChild.token.surface; if ((type.equals(operator) || type.equals(function)) && (!(optimizedChild.op instanceof LazyValue.ContextFreeLazyValue))) { - optimized = true; List newargs = new ArrayList<>(); if (leftOptimizable) { @@ -1378,6 +1377,7 @@ public class Expression } node.token.morph(Token.TokenType.FUNCTION, function); node.args = newargs; + return true; } } } diff --git a/src/main/java/carpet/script/language/Operators.java b/src/main/java/carpet/script/language/Operators.java index a1c2d1a2..ddad96fe 100644 --- a/src/main/java/carpet/script/language/Operators.java +++ b/src/main/java/carpet/script/language/Operators.java @@ -346,6 +346,7 @@ public class Operators return Value.TRUE; }); expression.addFunctionalEquivalence("==", "equal"); + expression.addBinaryOperator("!=", precedence.get("equal==!="), false, (v1, v2) -> v1.equals(v2) ? Value.FALSE : Value.TRUE); expression.addFunction("unique", lv -> { diff --git a/src/main/java/carpet/script/value/LazyListValue.java b/src/main/java/carpet/script/value/LazyListValue.java index 99ae419c..1e2d183b 100644 --- a/src/main/java/carpet/script/value/LazyListValue.java +++ b/src/main/java/carpet/script/value/LazyListValue.java @@ -56,7 +56,7 @@ public abstract class LazyListValue extends AbstractListValue implements Iterato @Override public String getString() { - return String.format(Locale.ROOT, "[%s, %s, ..., %s)", NumericValue.of(start).getString(), NumericValue.of(start + stepp).getString(), NumericValue.of(limit).getString()); + return String.format(Locale.ROOT, "<%s, %s, ..., %s)", NumericValue.of(start).getString(), NumericValue.of(start + stepp).getString(), NumericValue.of(limit).getString()); } }; } @@ -104,7 +104,7 @@ public abstract class LazyListValue extends AbstractListValue implements Iterato @Override public String getString() { - return String.format(Locale.ROOT, "[%s, %s, ..., %s)", NumericValue.of(start).getString(), NumericValue.of(start + stepp).getString(), NumericValue.of(limit).getString()); + return String.format(Locale.ROOT, "<%s, %s, ..., %s)", NumericValue.of(start).getString(), NumericValue.of(start + stepp).getString(), NumericValue.of(limit).getString()); } }; } From eb1ca9702c872d84a5603f068a662888498fb291 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Wed, 19 Feb 2025 12:30:42 +0100 Subject: [PATCH 060/232] added functional equivalence. Added element, define, modulo, exponent, match, assign, append, swap, opposite, identity, not, unpack, --- src/main/java/carpet/script/Expression.java | 322 +++++++++++++++--- .../carpet/script/language/ControlFlow.java | 7 +- .../script/language/DataStructures.java | 2 +- .../carpet/script/language/Functions.java | 2 +- .../carpet/script/language/Operators.java | 84 ++--- 5 files changed, 306 insertions(+), 111 deletions(-) diff --git a/src/main/java/carpet/script/Expression.java b/src/main/java/carpet/script/Expression.java index 3689d1f5..46114c24 100644 --- a/src/main/java/carpet/script/Expression.java +++ b/src/main/java/carpet/script/Expression.java @@ -111,12 +111,20 @@ public class Expression } private final Map functionalEquivalence = new Object2ObjectOpenHashMap<>(); + private final Map functionalAliases = new Object2ObjectOpenHashMap<>(); - public void addFunctionalEquivalence(String operator, String function) + private void addFunctionalEquivalence(String operator, String function) { assert operators.containsKey(operator); assert functions.containsKey(function); functionalEquivalence.put(operator, function); + functionalAliases.put(operator, function); + } + private void addFunctionalAlias(String operator, String function) + { + assert operators.containsKey(operator); + assert functions.containsKey(function); + functionalAliases.put(operator, function); } private final Map constants = Map.of( @@ -191,7 +199,7 @@ public class Expression } - public void addLazyUnaryOperator(String surface, int precedence, boolean leftAssoc, boolean pure, Function staticTyper, + public void addLazyUnaryOperator(String surface, String function, int precedence, boolean leftAssoc, boolean pure, Function staticTyper, TriFunction lazyfun) { operators.put(surface + "u", new AbstractLazyOperator(precedence, leftAssoc) @@ -227,10 +235,45 @@ public class Expression } } }); + + functions.put(function, new AbstractLazyFunction(1, function) + { + @Override + public boolean pure() + { + return pure; + } + + @Override + public boolean transitive() + { + return false; + } + + @Override + public Context.Type staticType(Context.Type outerType) + { + return staticTyper.apply(outerType); + } + + @Override + public LazyValue lazyEval(Context c, Context.Type t, Expression e, Token token, List v) + { + try + { + return lazyfun.apply(c, t, v.get(0)); + } + catch (RuntimeException exc) + { + throw handleCodeException(c, exc, e, token); + } + } + }); + addFunctionalAlias(surface + "u", function); } - public void addLazyBinaryOperatorWithDelegation(String surface, int precedence, boolean leftAssoc, boolean pure, + public void addLazyBinaryOperatorWithDelegation(String surface, String function, int precedence, boolean leftAssoc, boolean pure, SexFunction lazyfun) { operators.put(surface, new AbstractLazyOperator(precedence, leftAssoc) @@ -260,6 +303,36 @@ public class Expression } } }); + + functions.put(function, new AbstractLazyFunction(2, function) + { + @Override + public boolean pure() + { + return pure; + } + + @Override + public boolean transitive() + { + return false; + } + + @Override + public LazyValue lazyEval(Context c, Context.Type type, Expression e, Token t, List v) + { + try + { + return lazyfun.apply(c, type, e, t, v.get(0), v.get(1)); + } + catch (RuntimeException exc) + { + throw handleCodeException(c, exc, e, t); + } + } + }); + + addFunctionalAlias(surface, function); } public void addCustomFunction(String name, ILazyFunction fun) @@ -333,7 +406,84 @@ public class Expression }); } - public void addLazyBinaryOperator(String surface, int precedence, boolean leftAssoc, boolean pure, Function typer, + public void addLazyBinaryOperator(String surface, String function, int precedence, boolean leftAssoc, boolean pure, Function typer, + QuadFunction lazyfun, TriFunction, LazyValue> multiFun) + { + operators.put(surface, new AbstractLazyOperator(precedence, leftAssoc) + { + + @Override + public boolean pure() + { + return pure; + } + + @Override + public boolean transitive() + { + return false; + } + + @Override + public Context.Type staticType(Context.Type outerType) + { + return typer.apply(outerType); + } + + @Override + public LazyValue lazyEval(Context c, Context.Type t, Expression e, Token token, LazyValue v1, LazyValue v2) + { + ILazyFunction.checkInterrupts(); + try + { + return lazyfun.apply(c, t, v1, v2); + } + catch (RuntimeException exc) + { + throw handleCodeException(c, exc, e, token); + } + } + }); + + functions.put(function, new AbstractLazyFunction(-1, function) + { + @Override + public boolean pure() + { + return true; + } + + @Override + public boolean transitive() + { + return false; + } + + @Override + public Context.Type staticType(Context.Type outerType) + { + return typer.apply(outerType); + } + + @Override + public LazyValue lazyEval(Context c, Context.Type i, Expression e, Token t, List lazyParams) + { + ILazyFunction.checkInterrupts(); + try + { + return multiFun.apply(c, i, lazyParams); + } + catch (RuntimeException exc) + { + throw handleCodeException(c, exc, e, t); + } + } + }); + + addFunctionalEquivalence(surface, function); + } + + public void addLazyBinaryOperator(String surface, String function, int precedence, boolean leftAssoc, boolean pure, Function typer, QuadFunction lazyfun) { operators.put(surface, new AbstractLazyOperator(precedence, leftAssoc) @@ -371,9 +521,45 @@ public class Expression } } }); + + functions.put(function, new AbstractLazyFunction(2, function) + { + @Override + public boolean pure() + { + return pure; + } + + @Override + public boolean transitive() + { + return false; + } + + @Override + public Context.Type staticType(Context.Type outerType) + { + return typer.apply(outerType); + } + + @Override + public LazyValue lazyEval(Context c, Context.Type t, Expression e, Token token, List v) + { + try + { + return lazyfun.apply(c, t, v.get(0), v.get(1)); + } + catch (RuntimeException exc) + { + throw handleCodeException(c, exc, e, token); + } + } + }); + + addFunctionalAlias(surface, function); } - public void addBinaryContextOperator(String surface, int precedence, boolean leftAssoc, boolean pure, boolean transitive, + public void addBinaryContextOperator(String surface, String function, int precedence, boolean leftAssoc, boolean pure, boolean transitive, QuadFunction fun) { operators.put(surface, new AbstractLazyOperator(precedence, leftAssoc) @@ -404,6 +590,37 @@ public class Expression } } }); + + functions.put(function, new AbstractLazyFunction(2, function) + { + @Override + public boolean pure() + { + return pure; + } + + @Override + public boolean transitive() + { + return transitive; + } + + @Override + public LazyValue lazyEval(Context c, Context.Type t, Expression e, Token token, List v) + { + try + { + Value ret = fun.apply(c, t, v.get(0).evalValue(c, Context.NONE), v.get(1).evalValue(c, Context.NONE)); + return (cc, tt) -> ret; + } + catch (RuntimeException exc) + { + throw handleCodeException(c, exc, e, token); + } + } + }); + + addFunctionalAlias(surface, function); } public static RuntimeException handleCodeException(Context c, RuntimeException exc, Expression e, Token token) @@ -433,7 +650,7 @@ public class Expression return new ExpressionException(c, e, token, "Internal error (please report this issue to Carpet) while evaluating: " + exc); } - public void addUnaryOperator(String surface, boolean leftAssoc, Function fun) + public void addUnaryOperator(String surface, String function, boolean leftAssoc, Function fun) { operators.put(surface + "u", new AbstractUnaryOperator(Operators.precedence.get("unary+-!..."), leftAssoc) { @@ -443,18 +660,57 @@ public class Expression return fun.apply(v1); } }); + functions.put(function, new AbstractFunction(1, function) + { + @Override + public Value eval(List v1) + { + return fun.apply(v1.get(0)); + } + }); + addFunctionalAlias(surface + "u", function); } - public void addBinaryOperator(String surface, int precedence, boolean leftAssoc, BiFunction fun) + public void addBinaryOperator(String surface, String function, int precedence, boolean leftAssoc, BiFunction fun, Function, Value> multiFun) { operators.put(surface, new AbstractOperator(precedence, leftAssoc) { @Override - public Value eval(Value v1, Value v2) - { + public Value eval(Value v1, Value v2) { return fun.apply(v1, v2); } }); + + functions.put(function, new AbstractFunction(-1, function) + { + @Override + public Value eval(List parameters) + { + return multiFun.apply(parameters); + } + }); + addFunctionalEquivalence(surface, function); + } + + public void addBinaryOperator(String surface, String name, int precedence, boolean leftAssoc, BiFunction fun) + { + operators.put(surface, new AbstractOperator(precedence, leftAssoc) + { + @Override + public Value eval(Value v1, Value v2) { + return fun.apply(v1, v2); + } + }); + functions.put(name, new AbstractFunction(2, name) + { + @Override + public Value eval(List parameters) + { + return fun.apply(parameters.get(0), parameters.get(1)); + } + }); + + addFunctionalAlias(surface, name); } @@ -623,44 +879,6 @@ public class Expression }); } - public void addPureLazyFunction(String name, int num_params, Function typer, TriFunction, LazyValue> fun) - { - functions.put(name, new AbstractLazyFunction(num_params, name) - { - @Override - public boolean pure() - { - return true; - } - - @Override - public boolean transitive() - { - return false; - } - - @Override - public Context.Type staticType(Context.Type outerType) - { - return typer.apply(outerType); - } - - @Override - public LazyValue lazyEval(Context c, Context.Type i, Expression e, Token t, List lazyParams) - { - ILazyFunction.checkInterrupts(); - try - { - return fun.apply(c, i, lazyParams); - } - catch (RuntimeException exc) - { - throw handleCodeException(c, exc, e, t); - } - } - }); - } - public void addContextFunction(String name, int num_params, TriFunction, Value> fun) { functions.put(name, new AbstractLazyFunction(num_params, name) @@ -859,6 +1077,9 @@ public class Expression Threading.apply(this); Loops.apply(this); DataStructures.apply(this); + for(String op : operators.keySet()) { + assert functionalAliases.containsKey(op) : "Missing function for operator " + op; + } } @@ -1381,6 +1602,13 @@ public class Expression } } } + + if (toFunctional && functionalAliases.containsKey(symbol) && !node.args.isEmpty()) + { + optimized = true; + node.token.morph(Token.TokenType.FUNCTION, functionalAliases.get(symbol)); + } + return optimized; } diff --git a/src/main/java/carpet/script/language/ControlFlow.java b/src/main/java/carpet/script/language/ControlFlow.java index d96d1209..978938aa 100644 --- a/src/main/java/carpet/script/language/ControlFlow.java +++ b/src/main/java/carpet/script/language/ControlFlow.java @@ -22,14 +22,12 @@ public class ControlFlow public static void apply(Expression expression) // public just to get the javadoc right { // needs to be lazy cause of custom contextualization - expression.addLazyBinaryOperator(";", Operators.precedence.get("nextop;"), true, true, t -> Context.Type.VOID, (c, t, lv1, lv2) -> + expression.addLazyBinaryOperator(";", "then", Operators.precedence.get("nextop;"), true, true, t -> Context.Type.VOID, (c, t, lv1, lv2) -> { lv1.evalValue(c, Context.VOID); Value v2 = lv2.evalValue(c, t); return (cc, tt) -> v2; - }); - - expression.addPureLazyFunction("then", -1, t -> Context.Type.VOID, (c, t, lv) -> { + }, (c, t, lv) -> { int imax = lv.size() - 1; for (int i = 0; i < imax; i++) { @@ -38,7 +36,6 @@ public class ControlFlow Value v = lv.get(imax).evalValue(c, t); return (cc, tt) -> v; }); - expression.addFunctionalEquivalence(";", "then"); // obvious lazy due to conditional evaluation of arguments diff --git a/src/main/java/carpet/script/language/DataStructures.java b/src/main/java/carpet/script/language/DataStructures.java index 24adb642..01fa6c80 100644 --- a/src/main/java/carpet/script/language/DataStructures.java +++ b/src/main/java/carpet/script/language/DataStructures.java @@ -188,7 +188,7 @@ public class DataStructures ? ListValue.wrap(map.getMap().entrySet().stream().map(p -> ListValue.of(p.getKey(), p.getValue()))) : Value.NULL); - expression.addBinaryContextOperator(":", Operators.precedence.get("attribute~:"), true, true, false, (ctx, t, container, address) -> + expression.addBinaryContextOperator(":", "element", Operators.precedence.get("attribute~:"), true, true, false, (ctx, t, container, address) -> { if (container instanceof final LContainerValue lcv) { diff --git a/src/main/java/carpet/script/language/Functions.java b/src/main/java/carpet/script/language/Functions.java index 509b7270..2c544be3 100644 --- a/src/main/java/carpet/script/language/Functions.java +++ b/src/main/java/carpet/script/language/Functions.java @@ -126,7 +126,7 @@ public class Functions //assigns const procedure to the lhs, returning its previous value // must be lazy due to RHS being an expression to save to execute - expression.addLazyBinaryOperatorWithDelegation("->", Operators.precedence.get("def->"), false, false, (c, type, e, t, lv1, lv2) -> + expression.addLazyBinaryOperatorWithDelegation("->", "define", Operators.precedence.get("def->"), false, false, (c, type, e, t, lv1, lv2) -> { if (type == Context.MAPDEF) { diff --git a/src/main/java/carpet/script/language/Operators.java b/src/main/java/carpet/script/language/Operators.java index ddad96fe..f097ae8d 100644 --- a/src/main/java/carpet/script/language/Operators.java +++ b/src/main/java/carpet/script/language/Operators.java @@ -41,8 +41,7 @@ public class Operators public static void apply(Expression expression) { - expression.addBinaryOperator("+", precedence.get("addition+-"), true, Value::add); - expression.addFunction("sum", lv -> { + expression.addBinaryOperator("+", "sum", precedence.get("addition+-"), true, Value::add, lv -> { int size = lv.size(); if (size == 0) { @@ -55,10 +54,8 @@ public class Operators } return accumulator; }); - expression.addFunctionalEquivalence("+", "sum"); - expression.addBinaryOperator("-", precedence.get("addition+-"), true, Value::subtract); - expression.addFunction("difference", lv -> { + expression.addBinaryOperator("-", "difference", precedence.get("addition+-"), true, Value::subtract, lv -> { int size = lv.size(); if (size == 0) { @@ -71,10 +68,8 @@ public class Operators } return accumulator; }); - expression.addFunctionalEquivalence("-", "difference"); - expression.addBinaryOperator("*", precedence.get("multiplication*/%"), true, Value::multiply); - expression.addFunction("product", lv -> { + expression.addBinaryOperator("*", "product", precedence.get("multiplication*/%"), true, Value::multiply, lv -> { int size = lv.size(); if (size == 0) { @@ -87,10 +82,8 @@ public class Operators } return accumulator; }); - expression.addFunctionalEquivalence("*", "product"); - expression.addBinaryOperator("/", precedence.get("multiplication*/%"), true, Value::divide); - expression.addFunction("quotient", lv -> { + expression.addBinaryOperator("/", "quotient", precedence.get("multiplication*/%"), true, Value::divide, lv -> { int size = lv.size(); if (size == 0) { @@ -103,11 +96,11 @@ public class Operators } return accumulator; }); - expression.addFunctionalEquivalence("/", "quotient"); - expression.addBinaryOperator("%", precedence.get("multiplication*/%"), true, (v1, v2) -> + expression.addBinaryOperator("%", "modulo", precedence.get("multiplication*/%"), true, (v1, v2) -> NumericValue.asNumber(v1).mod(NumericValue.asNumber(v2))); - expression.addBinaryOperator("^", precedence.get("exponent^"), false, (v1, v2) -> + + expression.addBinaryOperator("^", "exponent", precedence.get("exponent^"), false, (v1, v2) -> new NumericValue(java.lang.Math.pow(NumericValue.asNumber(v1).getDouble(), NumericValue.asNumber(v2).getDouble()))); expression.addFunction("bitwise_and", lv -> { @@ -153,13 +146,11 @@ public class Operators }); // lazy cause RHS is only conditional - expression.addLazyBinaryOperator("&&", precedence.get("and&&"), false, true, t -> Context.Type.BOOLEAN, (c, t, lv1, lv2) -> + expression.addLazyBinaryOperator("&&", "and", precedence.get("and&&"), false, true, t -> Context.Type.BOOLEAN, (c, t, lv1, lv2) -> { // todo check how is optimizations going Value v1 = lv1.evalValue(c, Context.BOOLEAN); return v1.getBoolean() ? lv2 : ((cc, tt) -> v1); - }); - - expression.addPureLazyFunction("and", -1, t -> Context.Type.BOOLEAN, (c, t, lv) -> { + }, (c, t, lv) -> { int last = lv.size() - 1; if (last == -1) { @@ -168,7 +159,7 @@ public class Operators for (LazyValue l : lv.subList(0, last)) { Value val = l.evalValue(c, Context.Type.BOOLEAN); - if (val instanceof final FunctionUnpackedArgumentsValue fuav) + if (val instanceof FunctionUnpackedArgumentsValue fuav) { for (Value it : fuav) { @@ -188,16 +179,13 @@ public class Operators } return lv.get(last); }); - expression.addFunctionalEquivalence("&&", "and"); // lazy cause RHS is only conditional - expression.addLazyBinaryOperator("||", precedence.get("or||"), false, true, t -> Context.Type.BOOLEAN, (c, t, lv1, lv2) -> + expression.addLazyBinaryOperator("||", "or", precedence.get("or||"), false, true, t -> Context.Type.BOOLEAN, (c, t, lv1, lv2) -> { Value v1 = lv1.evalValue(c, Context.BOOLEAN); return v1.getBoolean() ? ((cc, tt) -> v1) : lv2; - }); - - expression.addPureLazyFunction("or", -1, t -> Context.Type.BOOLEAN, (c, t, lv) -> { + }, (c, t, lv) -> { int last = lv.size() - 1; if (last == -1) { @@ -226,13 +214,10 @@ public class Operators } return lv.get(last); }); - expression.addFunctionalEquivalence("||", "or"); - expression.addBinaryOperator("~", precedence.get("attribute~:"), true, Value::in); + expression.addBinaryOperator("~", "match", precedence.get("attribute~:"), true, Value::in); - expression.addBinaryOperator(">", precedence.get("compare>=><=<"), false, (v1, v2) -> - BooleanValue.of(v1.compareTo(v2) > 0)); - expression.addFunction("decreasing", lv -> { + expression.addBinaryOperator(">", "decreasing", precedence.get("compare>=><=<"), false, (v1, v2) -> BooleanValue.of(v1.compareTo(v2) > 0), lv -> { int size = lv.size(); if (size < 2) { @@ -249,11 +234,8 @@ public class Operators } return Value.TRUE; }); - expression.addFunctionalEquivalence(">", "decreasing"); - expression.addBinaryOperator(">=", precedence.get("compare>=><=<"), false, (v1, v2) -> - BooleanValue.of(v1.compareTo(v2) >= 0)); - expression.addFunction("nonincreasing", lv -> { + expression.addBinaryOperator(">=", "nonincreasing", precedence.get("compare>=><=<"), false, (v1, v2) -> BooleanValue.of(v1.compareTo(v2) >= 0), lv -> { int size = lv.size(); if (size < 2) { @@ -270,11 +252,8 @@ public class Operators } return Value.TRUE; }); - expression.addFunctionalEquivalence(">=", "nonincreasing"); - expression.addBinaryOperator("<", precedence.get("compare>=><=<"), false, (v1, v2) -> - BooleanValue.of(v1.compareTo(v2) < 0)); - expression.addFunction("increasing", lv -> { + expression.addBinaryOperator("<", "increasing", precedence.get("compare>=><=<"), false, (v1, v2) -> BooleanValue.of(v1.compareTo(v2) < 0), lv -> { int size = lv.size(); if (size < 2) { @@ -291,11 +270,8 @@ public class Operators } return Value.TRUE; }); - expression.addFunctionalEquivalence("<", "increasing"); - expression.addBinaryOperator("<=", precedence.get("compare>=><=<"), false, (v1, v2) -> - BooleanValue.of(v1.compareTo(v2) <= 0)); - expression.addFunction("nondecreasing", lv -> { + expression.addBinaryOperator("<=", "nondecreasing", precedence.get("compare>=><=<"), false, (v1, v2) -> BooleanValue.of(v1.compareTo(v2) <= 0), lv -> { int size = lv.size(); if (size < 2) { @@ -312,7 +288,7 @@ public class Operators } return Value.TRUE; }); - expression.addFunctionalEquivalence("<=", "nondecreasing"); + expression.addMathematicalBinaryIntFunction("bitwise_shift_left", (num, amount) -> num << amount); expression.addMathematicalBinaryIntFunction("bitwise_shift_right", (num, amount) -> num >>> amount); expression.addMathematicalBinaryIntFunction("bitwise_arithmetic_shift_right", (num, amount) -> num >> amount); @@ -326,9 +302,7 @@ public class Operators expression.addMathematicalUnaryIntFunction("double_to_long_bits", Double::doubleToLongBits); expression.addUnaryFunction("long_to_double_bits", v -> new NumericValue(Double.longBitsToDouble(NumericValue.asNumber(v).getLong()))); - expression.addBinaryOperator("==", precedence.get("equal==!="), false, (v1, v2) -> - v1.equals(v2) ? Value.TRUE : Value.FALSE); - expression.addFunction("equal", lv -> { + expression.addBinaryOperator("==", "equal", precedence.get("equal==!="), false, (v1, v2) -> v1.equals(v2) ? Value.TRUE : Value.FALSE, lv -> { int size = lv.size(); if (size < 2) { @@ -345,11 +319,8 @@ public class Operators } return Value.TRUE; }); - expression.addFunctionalEquivalence("==", "equal"); - expression.addBinaryOperator("!=", precedence.get("equal==!="), false, (v1, v2) -> - v1.equals(v2) ? Value.FALSE : Value.TRUE); - expression.addFunction("unique", lv -> { + expression.addBinaryOperator("!=", "unique", precedence.get("equal==!="), false, (v1, v2) -> v1.equals(v2) ? Value.FALSE : Value.TRUE, lv -> { int size = lv.size(); if (size < 2) { @@ -368,10 +339,9 @@ public class Operators } return Value.TRUE; }); - expression.addFunctionalEquivalence("!=", "unique"); // lazy cause of assignment which is non-trivial - expression.addLazyBinaryOperator("=", precedence.get("assign=<>"), false, false, t -> Context.Type.LVALUE, (c, t, lv1, lv2) -> + expression.addLazyBinaryOperator("=", "assign", precedence.get("assign=<>"), false, false, t -> Context.Type.LVALUE, (c, t, lv1, lv2) -> { Value v1 = lv1.evalValue(c, Context.LVALUE); Value v2 = lv2.evalValue(c); @@ -424,7 +394,7 @@ public class Operators }); // lazy due to assignment - expression.addLazyBinaryOperator("+=", precedence.get("assign=<>"), false, false, t -> Context.Type.LVALUE, (c, t, lv1, lv2) -> + expression.addLazyBinaryOperator("+=", "append", precedence.get("assign=<>"), false, false, t -> Context.Type.LVALUE, (c, t, lv1, lv2) -> { Value v1 = lv1.evalValue(c, Context.LVALUE); Value v2 = lv2.evalValue(c); @@ -493,7 +463,7 @@ public class Operators return boundedLHS; }); - expression.addBinaryContextOperator("<>", precedence.get("assign=<>"), false, false, false, (c, t, v1, v2) -> + expression.addBinaryContextOperator("<>", "swap", precedence.get("assign=<>"), false, false, false, (c, t, v1, v2) -> { if (v1 instanceof final ListValue.ListConstructorValue lcv1 && v2 instanceof final ListValue.ListConstructorValue lcv2) { @@ -541,17 +511,17 @@ public class Operators return lval; }); - expression.addUnaryOperator("-", false, v -> NumericValue.asNumber(v).opposite()); + expression.addUnaryOperator("-", "opposite", false, v -> NumericValue.asNumber(v).opposite()); - expression.addUnaryOperator("+", false, NumericValue::asNumber); + expression.addUnaryOperator("+", "identity", false, NumericValue::asNumber); // could be non-lazy, but who cares - its a small one. - expression.addLazyUnaryOperator("!", precedence.get("unary+-!..."), false, true, x -> Context.Type.BOOLEAN, (c, t, lv) -> + expression.addLazyUnaryOperator("!", "not", precedence.get("unary+-!..."), false, true, x -> Context.Type.BOOLEAN, (c, t, lv) -> lv.evalValue(c, Context.BOOLEAN).getBoolean() ? (cc, tt) -> Value.FALSE : (cc, tt) -> Value.TRUE ); // might need context boolean // lazy because of typed evaluation of the argument - expression.addLazyUnaryOperator("...", Operators.precedence.get("unary+-!..."), false, true, t -> t == Context.Type.LOCALIZATION ? Context.NONE : t, (c, t, lv) -> + expression.addLazyUnaryOperator("...", "unpack", Operators.precedence.get("unary+-!..."), false, true, t -> t == Context.Type.LOCALIZATION ? Context.NONE : t, (c, t, lv) -> { if (t == Context.LOCALIZATION) { From a2c11c676206f7af49c842ed44fa678cdc326f8c Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Wed, 19 Feb 2025 12:31:47 +0100 Subject: [PATCH 061/232] removed wierd token morphs --- src/main/java/carpet/script/Expression.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/carpet/script/Expression.java b/src/main/java/carpet/script/Expression.java index 46114c24..13439f3a 100644 --- a/src/main/java/carpet/script/Expression.java +++ b/src/main/java/carpet/script/Expression.java @@ -1378,11 +1378,11 @@ public class Expression { throw new ExpressionException(context, this, token, "Not a number"); } - token.morph(Token.TokenType.CONSTANT, token.surface); + //token.morph(Token.TokenType.CONSTANT, token.surface); nodeStack.push(ExpressionNode.ofConstant(number, token)); } case STRINGPARAM -> { - token.morph(Token.TokenType.CONSTANT, token.surface); + //token.morph(Token.TokenType.CONSTANT, token.surface); nodeStack.push(ExpressionNode.ofConstant(new StringValue(token.surface), token)); } case HEX_LITERAL -> { @@ -1395,7 +1395,7 @@ public class Expression { throw new ExpressionException(context, this, token, "Not a number"); } - token.morph(Token.TokenType.CONSTANT, token.surface); + //token.morph(Token.TokenType.CONSTANT, token.surface); nodeStack.push(ExpressionNode.ofConstant(hexNumber, token)); } default -> throw new ExpressionException(context, this, token, "Unexpected token '" + token.surface + "'"); @@ -1553,7 +1553,7 @@ public class Expression else { returnNode.op = LazyValue.ofConstant(Value.NULL); - returnNode.token.morph(Token.TokenType.CONSTANT, ""); + returnNode.token.morph(Token.TokenType.CONSTANT, "null"); returnNode.args = Collections.emptyList(); if (logger != null) { From d40d9b706817157a63e6b7e395d40c34e40d3ff4 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Wed, 19 Feb 2025 12:33:36 +0100 Subject: [PATCH 062/232] explain outputs functional target --- .../java/carpet/script/CarpetExpression.java | 3 +- src/main/java/carpet/script/Expression.java | 75 +++++++++++++++- .../java/carpet/script/ScriptCommand.java | 89 +++++++++++++++++-- src/main/java/carpet/script/Token.java | 41 ++++++++- 4 files changed, 197 insertions(+), 11 deletions(-) diff --git a/src/main/java/carpet/script/CarpetExpression.java b/src/main/java/carpet/script/CarpetExpression.java index a766666d..23971947 100644 --- a/src/main/java/carpet/script/CarpetExpression.java +++ b/src/main/java/carpet/script/CarpetExpression.java @@ -153,9 +153,8 @@ public class CarpetExpression } } - public Value explain(ScriptHost host, BlockPos pos) + public List explain(ScriptHost host, BlockPos pos) { - // convert to explain CarpetScriptServer scriptServer = (CarpetScriptServer) host.scriptServer(); try { diff --git a/src/main/java/carpet/script/Expression.java b/src/main/java/carpet/script/Expression.java index 13439f3a..dcf4f419 100644 --- a/src/main/java/carpet/script/Expression.java +++ b/src/main/java/carpet/script/Expression.java @@ -1298,6 +1298,61 @@ public class Expression { return new ExpressionNode(new LazyValue.Constant(val), Collections.emptyList(), token); } + + public List tokensRecursive(Expression expression) { + List tokens = new ArrayList<>(); + switch (token.type) { + case FUNCTION -> { + tokens.add(token); + tokens.add(token.morphedInto(Token.TokenType.OPEN_PAREN, "(")); + if (!args.isEmpty()) { + for (ExpressionNode arg : args) { + List argTokens = arg.tokensRecursive(expression); + tokens.addAll(argTokens); + tokens.add(argTokens.getLast().morphedInto(Token.TokenType.COMMA, ",").disguiseAs(", ", null)); + } + tokens.removeLast(); + } + tokens.add(tokens.getLast().morphedInto(Token.TokenType.CLOSE_PAREN, ")")); + } + case OPERATOR -> { + tokens.addAll(createOperatorArgumentTokens(expression, args.get(0))); + tokens.add(token.disguiseAs(" "+token.surface+" ", null)); + tokens.addAll(createOperatorArgumentTokens(expression, args.get(1))); + } + case UNARY_OPERATOR -> { + tokens.add(token.disguiseAs(" "+StringUtils.chop(token.surface),null)); + tokens.addAll(createOperatorArgumentTokens(expression, args.get(0))); + } + case VARIABLE, LITERAL, HEX_LITERAL, CONSTANT -> tokens.add(token); + case STRINGPARAM -> tokens.add(token.disguiseAs("'"+token.surface+"'", null)); + // these should be parsed out already, but .... + //case LITERAL, STRINGPARAM, HEX_LITERAL, OPEN_PAREN, CLOSE_PAREN, MARKER -> tokens.add(token.morphedInto(token.type, token.surface+"?")); + // CONSTANT ?? + default -> tokens.add(token.disguiseAs("?"+token.surface+"?", null)); + } + return tokens; + } + + public List createOperatorArgumentTokens(Expression expression, ExpressionNode operand) { + boolean needsBrackets = false; + var operators = expression.operators; + if (operators.containsKey(operand.token.surface) && operators.containsKey(token.surface)) { + if (operators.get(operand.token.surface).getPrecedence() < operators.get(token.surface).getPrecedence()) { + needsBrackets = true; + } + } + List argumentTokens = operand.tokensRecursive(expression); + if (!needsBrackets) { + return argumentTokens; + } + List bracketed = new ArrayList<>(); + bracketed.add(argumentTokens.getFirst().morphedInto(Token.TokenType.OPEN_PAREN, "(")); + bracketed.get(0).swapPlace(argumentTokens.getFirst()); + bracketed.addAll(argumentTokens); + bracketed.add(argumentTokens.getLast().morphedInto(Token.TokenType.CLOSE_PAREN, ")")); + return bracketed; + } } @@ -1478,10 +1533,25 @@ public class Expression } } - public Value explain(Context context) + public List explain(Context context) { //todo convert to explain - return Value.NULL; + Tokenizer tokenizer = new Tokenizer(context, this, expression, true, true); + // stripping lousy but acceptable semicolons + List input = tokenizer.parseTokens(); + List cleanedTokens = Tokenizer.postProcess(input); + + List rpn = shuntingYard(context, cleanedTokens); + validate(context, rpn); + ExpressionNode root = RPNToParseTree(rpn, context); + List parsedTokens = root.tokensRecursive(this); + + Context optimizeOnlyContext = new Context.ContextForErrorReporting(context); + // pure functional + optimizeTree(root, optimizeOnlyContext, null, true); + List compileTimeOptimized = root.tokensRecursive(this); + + return compileTimeOptimized; } private int treeSize(ExpressionNode node) @@ -1700,6 +1770,7 @@ public class Expression { result = ((ILazyOperator) operation).lazyEval(ctx, expectedType, this, node.token, args.get(0), args.get(1)).evalValue(null, expectedType); } + node.token.disguiseAs(null, "=>"+result.getString()); node.op = LazyValue.ofConstant(result); if (logger != null) { diff --git a/src/main/java/carpet/script/ScriptCommand.java b/src/main/java/carpet/script/ScriptCommand.java index 18b5c282..109e9d68 100644 --- a/src/main/java/carpet/script/ScriptCommand.java +++ b/src/main/java/carpet/script/ScriptCommand.java @@ -15,14 +15,17 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.brigadier.suggestion.Suggestions; import com.mojang.brigadier.suggestion.SuggestionsBuilder; import net.minecraft.commands.CommandBuildContext; +import net.minecraft.network.chat.Component; import org.apache.commons.lang3.StringUtils; import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; +import java.util.HashMap; import java.util.List; import java.util.Locale; +import java.util.Map; import java.util.Set; import java.util.TreeSet; import java.util.concurrent.CompletableFuture; @@ -41,6 +44,8 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.pattern.BlockInWorld; import net.minecraft.world.level.levelgen.structure.BoundingBox; +import javax.annotation.Nullable; + import static net.minecraft.commands.Commands.argument; import static net.minecraft.commands.Commands.literal; import static net.minecraft.commands.SharedSuggestionProvider.suggest; @@ -359,6 +364,9 @@ public class ScriptCommand })); LiteralArgumentBuilder x = literal("explain"). requires(Vanilla::ServerPlayer_canScriptACE). + executes((cc) -> explain( + cc, + null)). then(argument("expr", StringArgumentType.greedyString()).suggests(ScriptCommand::suggestCode). executes((cc) -> explain( cc, @@ -541,19 +549,88 @@ public class ScriptCommand }); } - private static int explain(CommandContext context, String expr) throws CommandSyntaxException + private static int explain(CommandContext context, @Nullable String expr) throws CommandSyntaxException { CommandSourceStack source = context.getSource(); CarpetScriptHost host = getHost(context); return handleCall(source, host, () -> { - CarpetExpression ex = new CarpetExpression(host.main, expr, source, new BlockPos(0, 0, 0)); - ex.explain(host, BlockPos.containing(source.getPosition())); - Carpet.Messenger_message(source, "w Expression: ", "wb " + expr); - Carpet.Messenger_message(source, "w Tokens: ", "wb " + ex.getExpr().toString()); - return NumericValue.ONE; + CarpetExpression ex = new CarpetExpression(host.main, expr == null ? ( host.main == null ? "" : host.main.code() ) : expr, source, new BlockPos(0, 0, 0)); + List results = ex.explain(host, BlockPos.containing(source.getPosition())); + prettyPrintTokens(source, results); + return NumericValue.of(results.size()); }); } + private static void prettyPrintTokens(CommandSourceStack source, List tokens) { + //Collections.sort(tokens); + // indentations per line + Map indents = new HashMap<>(); + for (Token token : tokens) + { + indents.put(token.lineno, Math.min(indents.getOrDefault(token.lineno, token.linepos), token.linepos)); + } + + + int lastLine = 0; + int lastPos = 0; + List elements = new ArrayList<>(); + for (Token token : tokens) + { + if (token.lineno != lastLine) + { + flushElements(source, elements); + lastLine = token.lineno; + lastPos = indents.getOrDefault(token.lineno, 0); + elements.add(Carpet.Messenger_compose("w " + " ".repeat(lastPos))); + } + //else if (token.linepos > lastPos) + //{ + // lastPos = token.linepos; + //} + elements.add(tokenToComponent(token)); + lastPos += token.surface.length() + 1; + } + flushElements(source, elements); + } + + private static Component tokenToComponent(Token token) + { + String surface = token.surface; + if (!token.display.isEmpty()) + { + surface = token.display; + } + if (token.comment.isEmpty()) { + return Carpet.Messenger_compose(styleForToken(token) + " " + surface); + } + return Carpet.Messenger_compose(styleForToken(token)+"br " + surface, "^gi " + token.comment); + } + + private static String styleForToken(Token token) + { + return switch (token.type) { + case Token.TokenType.LITERAL -> "l"; + case Token.TokenType.HEX_LITERAL -> "e"; + case Token.TokenType.CONSTANT -> "q"; + case Token.TokenType.OPEN_PAREN, Token.TokenType.CLOSE_PAREN, Token.TokenType.COMMA, + Token.TokenType.OPERATOR, Token.TokenType.UNARY_OPERATOR -> "w"; + case Token.TokenType.FUNCTION -> "y"; + case Token.TokenType.VARIABLE -> "y"; + case Token.TokenType.STRINGPARAM -> "c"; + default -> // marker + "w"; + }; + } + + private static void flushElements(CommandSourceStack source, List elements) + { + if (elements.size() > 0) + { + Carpet.Messenger_message(source, elements.toArray(new Component[0])); + elements.clear(); + } + } + private static int scriptScan(CommandContext context, BlockPos origin, BlockPos a, BlockPos b, String expr) throws CommandSyntaxException { CommandSourceStack source = context.getSource(); diff --git a/src/main/java/carpet/script/Token.java b/src/main/java/carpet/script/Token.java index 1340f4b3..adce7e0e 100644 --- a/src/main/java/carpet/script/Token.java +++ b/src/main/java/carpet/script/Token.java @@ -1,6 +1,9 @@ package carpet.script; -public class Token { +import javax.annotation.Nullable; + +public class Token implements Comparable { + enum TokenType { FUNCTION(true, false), OPERATOR(true, false), UNARY_OPERATOR(true, false), VARIABLE(false, false), CONSTANT(false, true), @@ -25,8 +28,11 @@ public class Token { } public String surface = ""; + public String display = ""; + public String comment = ""; public TokenType type; public int pos; + public int ordinal = 0; public int linepos; public int lineno; public static final Token NONE = new Token(); @@ -38,12 +44,31 @@ public class Token { created.pos = pos; created.linepos = linepos; created.lineno = lineno; + created.ordinal = ordinal + 1; return created; } + public void swapPlace(Token other) { + int order = other.ordinal; + other.ordinal = ordinal; + ordinal = order; + } + public void morph(TokenType type, String s) { this.type = type; this.surface = s; + this.display = ""; + this.comment = ""; + } + + public Token disguiseAs(@Nullable String s, @Nullable String s1) { + if (s != null) { + display = s; + } + if (s1 != null) { + comment = s1; + } + return this; } public void append(char c) { @@ -66,4 +91,18 @@ public class Token { public String toString() { return surface; } + + @Override + public int compareTo(Token o) { + // compare by lineno, then by linepos, then by ordinal + if (lineno != o.lineno) + { + return lineno - o.lineno; + } + if (linepos != o.linepos) + { + return linepos - o.linepos; + } + return ordinal - o.ordinal; + } } From f6ec86c20df9bc0c5da9c9c1c03509f546feae18 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Wed, 19 Feb 2025 19:23:36 +0100 Subject: [PATCH 063/232] fix explain printing --- .../java/carpet/script/CarpetExpression.java | 3 +- src/main/java/carpet/script/Expression.java | 4 +- .../java/carpet/script/ScriptCommand.java | 52 ++++++++++++------- 3 files changed, 37 insertions(+), 22 deletions(-) diff --git a/src/main/java/carpet/script/CarpetExpression.java b/src/main/java/carpet/script/CarpetExpression.java index 23971947..31a8111c 100644 --- a/src/main/java/carpet/script/CarpetExpression.java +++ b/src/main/java/carpet/script/CarpetExpression.java @@ -21,6 +21,7 @@ import net.minecraft.commands.CommandSourceStack; import net.minecraft.core.BlockPos; import net.minecraft.world.entity.Entity; +import javax.annotation.Nullable; import java.util.List; public class CarpetExpression @@ -45,7 +46,7 @@ public class CarpetExpression return origin; } - public CarpetExpression(Module module, String expression, CommandSourceStack source, BlockPos origin) + public CarpetExpression(@Nullable Module module, String expression, CommandSourceStack source, BlockPos origin) { this.origin = origin; this.source = source; diff --git a/src/main/java/carpet/script/Expression.java b/src/main/java/carpet/script/Expression.java index dcf4f419..2854b87e 100644 --- a/src/main/java/carpet/script/Expression.java +++ b/src/main/java/carpet/script/Expression.java @@ -70,6 +70,7 @@ public class Expression private boolean allowNewlineSubstitutions = true; private boolean allowComments = false; + @Nullable public Module module = null; public String getModuleName() @@ -83,7 +84,7 @@ public class Expression allowComments = true; } - public void asAModule(Module mi) + public void asAModule(@Nullable Module mi) { module = mi; } @@ -91,6 +92,7 @@ public class Expression /** * Cached AST (Abstract Syntax Tree) (root) of the expression */ + @Nullable private LazyValue ast = null; /** diff --git a/src/main/java/carpet/script/ScriptCommand.java b/src/main/java/carpet/script/ScriptCommand.java index 109e9d68..3161f99c 100644 --- a/src/main/java/carpet/script/ScriptCommand.java +++ b/src/main/java/carpet/script/ScriptCommand.java @@ -19,9 +19,11 @@ import net.minecraft.network.chat.Component; import org.apache.commons.lang3.StringUtils; import java.io.IOException; +import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; +import java.util.Deque; import java.util.HashMap; import java.util.List; import java.util.Locale; @@ -561,34 +563,43 @@ public class ScriptCommand }); } - private static void prettyPrintTokens(CommandSourceStack source, List tokens) { - //Collections.sort(tokens); - // indentations per line + private static void prettyPrintTokens(CommandSourceStack source, List tokens) + { Map indents = new HashMap<>(); for (Token token : tokens) { indents.put(token.lineno, Math.min(indents.getOrDefault(token.lineno, token.linepos), token.linepos)); } + List lines = new ArrayList<>(indents.keySet()); + Collections.sort(lines); + Deque indentsStack = new ArrayDeque<>(lines); - - int lastLine = 0; - int lastPos = 0; List elements = new ArrayList<>(); - for (Token token : tokens) + for (int i = 0; i < tokens.size(); i++) { - if (token.lineno != lastLine) + Token token = tokens.get(i); + if (!indentsStack.isEmpty() && token.lineno == indentsStack.peekFirst()) { flushElements(source, elements); - lastLine = token.lineno; - lastPos = indents.getOrDefault(token.lineno, 0); + indentsStack.pollFirst(); + // remove all elements of intendStack that don't have any more tokens + outer: while (!indentsStack.isEmpty()) + { + int nextLineNo = indentsStack.peekFirst(); + for (int j = i + 1; j < tokens.size(); j++) + { + if (tokens.get(j).lineno == nextLineNo) + { + break outer; + } + } + indentsStack.pollFirst(); + } + + int lastPos = indents.getOrDefault(token.lineno, 0); elements.add(Carpet.Messenger_compose("w " + " ".repeat(lastPos))); } - //else if (token.linepos > lastPos) - //{ - // lastPos = token.linepos; - //} elements.add(tokenToComponent(token)); - lastPos += token.surface.length() + 1; } flushElements(source, elements); } @@ -600,7 +611,8 @@ public class ScriptCommand { surface = token.display; } - if (token.comment.isEmpty()) { + if (token.comment.isEmpty()) + { return Carpet.Messenger_compose(styleForToken(token) + " " + surface); } return Carpet.Messenger_compose(styleForToken(token)+"br " + surface, "^gi " + token.comment); @@ -610,21 +622,21 @@ public class ScriptCommand { return switch (token.type) { case Token.TokenType.LITERAL -> "l"; - case Token.TokenType.HEX_LITERAL -> "e"; + case Token.TokenType.HEX_LITERAL -> "m"; case Token.TokenType.CONSTANT -> "q"; case Token.TokenType.OPEN_PAREN, Token.TokenType.CLOSE_PAREN, Token.TokenType.COMMA, Token.TokenType.OPERATOR, Token.TokenType.UNARY_OPERATOR -> "w"; - case Token.TokenType.FUNCTION -> "y"; + case Token.TokenType.FUNCTION -> "d"; case Token.TokenType.VARIABLE -> "y"; case Token.TokenType.STRINGPARAM -> "c"; default -> // marker - "w"; + "f"; }; } private static void flushElements(CommandSourceStack source, List elements) { - if (elements.size() > 0) + if (!elements.isEmpty()) { Carpet.Messenger_message(source, elements.toArray(new Component[0])); elements.clear(); From 947e13835e2edb2964a586cc3ed41a3ae8fba1a3 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Wed, 19 Feb 2025 19:28:57 +0100 Subject: [PATCH 064/232] 25w08a --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index fb36e1df..8767dbc2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=25w07a + minecraft_version=25w08a loader_version=0.16.10 jsr305_version=3.0.2 fabric_version=0.110.5+1.21.4 From 7087fa8510ad057ba04f9a7ae5e438033b1b2855 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Thu, 20 Feb 2025 09:22:13 +0100 Subject: [PATCH 065/232] tweaks to formatting and optimize map definitions --- src/main/java/carpet/script/Expression.java | 4 ++-- src/main/java/carpet/script/ScriptCommand.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/carpet/script/Expression.java b/src/main/java/carpet/script/Expression.java index 2854b87e..4f238ab2 100644 --- a/src/main/java/carpet/script/Expression.java +++ b/src/main/java/carpet/script/Expression.java @@ -1727,7 +1727,7 @@ public class Expression // a few exceptions which we don't implement in the framework for simplicity for now if (!operation.pure()) { - if (!symbol.equals("->") || expectedType != Context.Type.MAPDEF) + if (!(symbol.equals("->") || symbol.equals("define")) || expectedType != Context.Type.MAPDEF) { return optimized; } @@ -1772,7 +1772,7 @@ public class Expression { result = ((ILazyOperator) operation).lazyEval(ctx, expectedType, this, node.token, args.get(0), args.get(1)).evalValue(null, expectedType); } - node.token.disguiseAs(null, "=>"+result.getString()); + node.token.disguiseAs(null, "=> "+result.getString()); node.op = LazyValue.ofConstant(result); if (logger != null) { diff --git a/src/main/java/carpet/script/ScriptCommand.java b/src/main/java/carpet/script/ScriptCommand.java index 3161f99c..299606ac 100644 --- a/src/main/java/carpet/script/ScriptCommand.java +++ b/src/main/java/carpet/script/ScriptCommand.java @@ -615,7 +615,7 @@ public class ScriptCommand { return Carpet.Messenger_compose(styleForToken(token) + " " + surface); } - return Carpet.Messenger_compose(styleForToken(token)+"br " + surface, "^gi " + token.comment); + return Carpet.Messenger_compose(styleForToken(token)+"u " + surface, "^gi " + token.comment); } private static String styleForToken(Token token) From 1928b4f86691c620c368e16c5f4e3ed55dbeb0d0 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Wed, 26 Feb 2025 18:41:22 +0100 Subject: [PATCH 066/232] improve explain bits to be usable --- .../java/carpet/script/CarpetExpression.java | 4 +-- src/main/java/carpet/script/Expression.java | 13 ++++++-- .../java/carpet/script/ScriptCommand.java | 32 +++++++++++++------ src/main/java/carpet/script/Tokenizer.java | 11 +++++++ 4 files changed, 46 insertions(+), 14 deletions(-) diff --git a/src/main/java/carpet/script/CarpetExpression.java b/src/main/java/carpet/script/CarpetExpression.java index 31a8111c..466e9128 100644 --- a/src/main/java/carpet/script/CarpetExpression.java +++ b/src/main/java/carpet/script/CarpetExpression.java @@ -154,7 +154,7 @@ public class CarpetExpression } } - public List explain(ScriptHost host, BlockPos pos) + public List explain(ScriptHost host, @Nullable String method, @Nullable String style, BlockPos pos) { CarpetScriptServer scriptServer = (CarpetScriptServer) host.scriptServer(); try @@ -174,7 +174,7 @@ public class CarpetExpression Value playerValue = new EntityValue(e).bindTo("p"); context.with("p", (cc, tt) -> playerValue); } - return scriptServer.events.handleEvents.getWhileDisabled(() -> this.expr.explain(context)); + return scriptServer.events.handleEvents.getWhileDisabled(() -> this.expr.explain(context, method, style)); } catch (ExpressionException e) { diff --git a/src/main/java/carpet/script/Expression.java b/src/main/java/carpet/script/Expression.java index 4f238ab2..7150e02c 100644 --- a/src/main/java/carpet/script/Expression.java +++ b/src/main/java/carpet/script/Expression.java @@ -1535,22 +1535,31 @@ public class Expression } } - public List explain(Context context) + public List explain(Context context, @Nullable String method, @Nullable String style) { //todo convert to explain Tokenizer tokenizer = new Tokenizer(context, this, expression, true, true); // stripping lousy but acceptable semicolons List input = tokenizer.parseTokens(); + if (style.equalsIgnoreCase("raw")) { + return input; + } List cleanedTokens = Tokenizer.postProcess(input); + if (style.equalsIgnoreCase("clean")) { + return cleanedTokens; + } List rpn = shuntingYard(context, cleanedTokens); validate(context, rpn); ExpressionNode root = RPNToParseTree(rpn, context); List parsedTokens = root.tokensRecursive(this); + if (style.equalsIgnoreCase("canonical")) { + return parsedTokens; + } Context optimizeOnlyContext = new Context.ContextForErrorReporting(context); // pure functional - optimizeTree(root, optimizeOnlyContext, null, true); + optimizeTree(root, optimizeOnlyContext, null, style.equalsIgnoreCase("functional")); List compileTimeOptimized = root.tokensRecursive(this); return compileTimeOptimized; diff --git a/src/main/java/carpet/script/ScriptCommand.java b/src/main/java/carpet/script/ScriptCommand.java index 299606ac..0b0a84ee 100644 --- a/src/main/java/carpet/script/ScriptCommand.java +++ b/src/main/java/carpet/script/ScriptCommand.java @@ -364,15 +364,27 @@ public class ScriptCommand boolean success = ss(cc).uninstallApp(cc.getSource(), StringArgumentType.getString(cc, "app")); return success ? 1 : 0; })); - LiteralArgumentBuilder x = literal("explain"). - requires(Vanilla::ServerPlayer_canScriptACE). - executes((cc) -> explain( - cc, - null)). - then(argument("expr", StringArgumentType.greedyString()).suggests(ScriptCommand::suggestCode). + + LiteralArgumentBuilder x = literal("explain").requires(Vanilla::ServerPlayer_canScriptACE). + then(argument("style", StringArgumentType.word()).suggests((cc, bb) -> suggest(List.of("raw", "clean", "functional", "canonical", "optimized"), bb)). executes((cc) -> explain( cc, - StringArgumentType.getString(cc, "expr")))); + null, null, StringArgumentType.getString(cc, "style"))). + then(literal("run").then(argument("expr", StringArgumentType.greedyString()).suggests(ScriptCommand::suggestCode). + executes((cc) -> explain( + cc, + StringArgumentType.getString(cc, "expr"), null, StringArgumentType.getString(cc, "style"))))). + then(literal("invoke"). + then(argument("call", StringArgumentType.word()).suggests((cc, bb) -> suggest(suggestFunctionCalls(cc), bb)). + executes((cc) -> explain( + cc, + null, + StringArgumentType.getString(cc, "call"), + StringArgumentType.getString(cc, "style") + )) + ) + ) + ); dispatcher.register(literal("script"). requires(Vanilla::ServerPlayer_canScriptGeneral). @@ -551,13 +563,13 @@ public class ScriptCommand }); } - private static int explain(CommandContext context, @Nullable String expr) throws CommandSyntaxException + private static int explain(CommandContext context, @Nullable String expr, @Nullable String method, String style) throws CommandSyntaxException { CommandSourceStack source = context.getSource(); CarpetScriptHost host = getHost(context); return handleCall(source, host, () -> { - CarpetExpression ex = new CarpetExpression(host.main, expr == null ? ( host.main == null ? "" : host.main.code() ) : expr, source, new BlockPos(0, 0, 0)); - List results = ex.explain(host, BlockPos.containing(source.getPosition())); + CarpetExpression ex = new CarpetExpression(host.main, expr == null ? ( host.main == null ? "" : host.main.code() ) : expr, source, BlockPos.ZERO); + List results = ex.explain(host, method, style, BlockPos.containing(source.getPosition())); prettyPrintTokens(source, results); return NumericValue.of(results.size()); }); diff --git a/src/main/java/carpet/script/Tokenizer.java b/src/main/java/carpet/script/Tokenizer.java index e342022b..abd3e4fa 100644 --- a/src/main/java/carpet/script/Tokenizer.java +++ b/src/main/java/carpet/script/Tokenizer.java @@ -255,6 +255,7 @@ public class Tokenizer } pos++; linepos++; + token.disguiseAs("'"+token.surface+"'", null); } else if (Character.isLetter(ch) || "_".indexOf(ch) >= 0) @@ -298,6 +299,7 @@ public class Tokenizer else if (ch == ',') { token.type = Token.TokenType.COMMA; + token.disguiseAs(", ", null); } else { @@ -379,12 +381,21 @@ public class Tokenizer || (previousToken.type == Token.TokenType.MARKER && (previousToken.surface.equals("{") || previousToken.surface.equals("["))) ) { + token.disguiseAs(token.surface, null); token.surface += "u"; token.type = Token.TokenType.UNARY_OPERATOR; } else { token.type = Token.TokenType.OPERATOR; + if (token.surface.equals(";")) + { + token.disguiseAs(token.surface + " ", null); + } + else + { + token.disguiseAs(" " + token.surface + " ", null); + } } } if (expression != null && context != null && previousToken != null && From 9a62566b2a7149c2c7421f3b6bc5e85fb545e419 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Wed, 26 Feb 2025 20:10:19 +0100 Subject: [PATCH 067/232] 25w09a, broken shapes --- gradle.properties | 2 +- ...istonMovingBlockEntity_movableBEMixin.java | 4 +- .../java/carpet/network/CarpetClient.java | 2 +- .../carpet/network/ClientNetworkHandler.java | 12 ++-- .../carpet/network/ServerNetworkHandler.java | 8 +-- .../carpet/script/utils/ShapeDispatcher.java | 46 +++++++-------- .../carpet/script/utils/ShapesRenderer.java | 56 +++++++++---------- .../java/carpet/script/value/ListValue.java | 6 +- .../script/value/NBTSerializableValue.java | 25 +++++---- 9 files changed, 81 insertions(+), 80 deletions(-) diff --git a/gradle.properties b/gradle.properties index 8767dbc2..5f35971c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=25w08a + minecraft_version=25w09a loader_version=0.16.10 jsr305_version=3.0.2 fabric_version=0.110.5+1.21.4 diff --git a/src/main/java/carpet/mixins/PistonMovingBlockEntity_movableBEMixin.java b/src/main/java/carpet/mixins/PistonMovingBlockEntity_movableBEMixin.java index b7d01d79..c9d07991 100644 --- a/src/main/java/carpet/mixins/PistonMovingBlockEntity_movableBEMixin.java +++ b/src/main/java/carpet/mixins/PistonMovingBlockEntity_movableBEMixin.java @@ -136,12 +136,12 @@ public abstract class PistonMovingBlockEntity_movableBEMixin extends BlockEntity @Inject(method = "loadAdditional", at = @At(value = "TAIL")) private void onFromTag(CompoundTag NbtCompound_1, HolderLookup.Provider registries, CallbackInfo ci) { - if (CarpetSettings.movableBlockEntities && NbtCompound_1.contains("carriedTileEntityCM", 10)) + if (CarpetSettings.movableBlockEntities && NbtCompound_1.contains("carriedTileEntityCM")) { if (this.movedState.getBlock() instanceof EntityBlock) this.carriedBlockEntity = ((EntityBlock) (this.movedState.getBlock())).newBlockEntity(worldPosition, movedState);// this.world); if (carriedBlockEntity != null) //Can actually be null, as BlockPistonMoving.createNewTileEntity(...) returns null - this.carriedBlockEntity.loadWithComponents(NbtCompound_1.getCompound("carriedTileEntityCM"), registries); + this.carriedBlockEntity.loadWithComponents(NbtCompound_1.getCompound("carriedTileEntityCM").orElseThrow(), registries); setCarriedBlockEntity(carriedBlockEntity); } } diff --git a/src/main/java/carpet/network/CarpetClient.java b/src/main/java/carpet/network/CarpetClient.java index 91622bd5..d8893ea2 100644 --- a/src/main/java/carpet/network/CarpetClient.java +++ b/src/main/java/carpet/network/CarpetClient.java @@ -106,7 +106,7 @@ public class CarpetClient ListTag outputTag = (ListTag) tag.get("output"); for (int i = 0; i < outputTag.size(); i++) { - CarpetSettings.LOG.info(" - response: " + Component.Serializer.fromJson(outputTag.getString(i), clientPlayer.registryAccess()).getString()); + CarpetSettings.LOG.info(" - response: " + Component.Serializer.fromJson(outputTag.getString(i).orElseThrow(), clientPlayer.registryAccess()).getString()); } } } diff --git a/src/main/java/carpet/network/ClientNetworkHandler.java b/src/main/java/carpet/network/ClientNetworkHandler.java index 9e463700..2e33e045 100644 --- a/src/main/java/carpet/network/ClientNetworkHandler.java +++ b/src/main/java/carpet/network/ClientNetworkHandler.java @@ -23,18 +23,18 @@ public class ClientNetworkHandler static { - dataHandlers.put(CarpetClient.HI, (p, t) -> onHi(t.getAsString())); + dataHandlers.put(CarpetClient.HI, (p, t) -> onHi(t.asString().orElseThrow())); dataHandlers.put("Rules", (p, t) -> { CompoundTag ruleset = (CompoundTag) t; - for (String ruleKey : ruleset.getAllKeys()) + for (String ruleKey : ruleset.keySet()) { CompoundTag ruleNBT = (CompoundTag) ruleset.get(ruleKey); SettingsManager manager = null; String ruleName; if (ruleNBT.contains("Manager")) { - ruleName = ruleNBT.getString("Rule"); - String managerName = ruleNBT.getString("Manager"); + ruleName = ruleNBT.getString("Rule").orElseThrow(); + String managerName = ruleNBT.getString("Manager").orElseThrow(); if (managerName.equals("carpet")) { manager = CarpetServer.settingsManager; @@ -60,7 +60,7 @@ public class ClientNetworkHandler CarpetRule rule = (manager != null) ? manager.getCarpetRule(ruleName) : null; if (rule != null) { - String value = ruleNBT.getString("Value"); + String value = ruleNBT.getString("Value").orElseThrow(); try { rule.set(null, value); @@ -116,7 +116,7 @@ public class ClientNetworkHandler public static void onServerData(CompoundTag compound, LocalPlayer player) { - for (String key : compound.getAllKeys()) + for (String key : compound.keySet()) { if (dataHandlers.containsKey(key)) { diff --git a/src/main/java/carpet/network/ServerNetworkHandler.java b/src/main/java/carpet/network/ServerNetworkHandler.java index 2770e005..79d8577e 100644 --- a/src/main/java/carpet/network/ServerNetworkHandler.java +++ b/src/main/java/carpet/network/ServerNetworkHandler.java @@ -31,7 +31,7 @@ public class ServerNetworkHandler private static final Set validCarpetPlayers = new HashSet<>(); private static final Map> dataHandlers = Map.of( - CarpetClient.HELLO, (p, t) -> onHello(p, t.getAsString()), + CarpetClient.HELLO, (p, t) -> onHello(p, t.asString().orElseThrow()), "clientCommand", (p, t) -> handleClientCommand(p, (CompoundTag) t) ); @@ -79,8 +79,8 @@ public class ServerNetworkHandler private static void handleClientCommand(ServerPlayer player, CompoundTag commandData) { - String command = commandData.getString("command"); - String id = commandData.getString("id"); + String command = commandData.getString("command").orElseThrow(); + String id = commandData.getString("id").orElseThrow(); List output = new ArrayList<>(); Component[] error = {null}; int[] returnValue = {0}; @@ -116,7 +116,7 @@ public class ServerNetworkHandler public static void onClientData(ServerPlayer player, CompoundTag compound) { - for (String key : compound.getAllKeys()) + for (String key : compound.keySet()) { if (dataHandlers.containsKey(key)) { diff --git a/src/main/java/carpet/script/utils/ShapeDispatcher.java b/src/main/java/carpet/script/utils/ShapeDispatcher.java index 5133ab05..12babace 100644 --- a/src/main/java/carpet/script/utils/ShapeDispatcher.java +++ b/src/main/java/carpet/script/utils/ShapeDispatcher.java @@ -238,7 +238,7 @@ public class ShapeDispatcher public static ExpiringShape fromTag(CompoundTag tag, Level level) { Map options = new HashMap<>(); - for (String key : tag.getAllKeys()) + for (String key : tag.keySet()) { Param decoder = Param.of.get(key); if (decoder == null) @@ -252,7 +252,7 @@ public class ShapeDispatcher Value shapeValue = options.get("shape"); if (shapeValue == null) { - CarpetScriptServer.LOG.info("Shape id missing in " + String.join(", ", tag.getAllKeys())); + CarpetScriptServer.LOG.info("Shape id missing in " + String.join(", ", tag.keySet())); return null; } BiFunction, RegistryAccess, ExpiringShape> factory = ExpiringShape.shapeProviders.get(shapeValue.getString()); @@ -1559,11 +1559,11 @@ public class ShapeDispatcher { if (tag instanceof final ListTag list) { - return ListValue.wrap(list.stream().map(x -> BooleanValue.of(((NumericTag) x).getAsNumber().doubleValue() != 0))); + return ListValue.wrap(list.stream().map(x -> BooleanValue.of(((NumericTag) x).doubleValue() != 0))); } if (tag instanceof final ByteTag booltag) { - return BooleanValue.of(booltag.getAsByte() != 0); + return BooleanValue.of(booltag.byteValue() != 0); } return Value.NULL; } @@ -1599,7 +1599,7 @@ public class ShapeDispatcher @Override public Value decode(Tag tag, Level level) { - return new StringValue(tag.getAsString()); + return new StringValue(tag.asString().get()); } } @@ -1643,9 +1643,9 @@ public class ShapeDispatcher { BlockState bs = NbtUtils.readBlockState(level.holderLookup(Registries.BLOCK), (CompoundTag) tag); CompoundTag compoundTag2 = null; - if (((CompoundTag) tag).contains("TileEntityData", 10)) + if (((CompoundTag) tag).contains("TileEntityData")) { - compoundTag2 = ((CompoundTag) tag).getCompound("TileEntityData"); + compoundTag2 = ((CompoundTag) tag).getCompound("TileEntityData").get(); } return new BlockValue(bs, compoundTag2); } @@ -1724,7 +1724,7 @@ public class ShapeDispatcher @Override public Value decode(Tag tag, Level level) { - return FormattedTextValue.deserialize(tag.getAsString(), level.registryAccess()); + return FormattedTextValue.deserialize(tag.asString().get(), level.registryAccess()); } } @@ -1818,7 +1818,7 @@ public class ShapeDispatcher @Override public Value decode(Tag tag, Level level) { - return BooleanValue.of(((ByteTag) tag).getAsByte() > 0); + return BooleanValue.of(((ByteTag) tag).byteValue() > 0); } } @@ -1832,7 +1832,7 @@ public class ShapeDispatcher @Override public Value decode(Tag tag, Level level) { - return new NumericValue(((FloatTag) tag).getAsFloat()); + return new NumericValue(((FloatTag) tag).floatValue()); } @Override @@ -1871,7 +1871,7 @@ public class ShapeDispatcher @Override public Value decode(Tag tag, Level level) { - return new NumericValue(((FloatTag) tag).getAsFloat()); + return new NumericValue(((FloatTag) tag).floatValue()); } @Override @@ -1892,7 +1892,7 @@ public class ShapeDispatcher @Override public Value decode(Tag tag, Level level) { - return new NumericValue(((IntTag) tag).getAsInt()); + return new NumericValue(((IntTag) tag).intValue()); } @Override @@ -1913,7 +1913,7 @@ public class ShapeDispatcher @Override public Value decode(Tag tag, Level level) { - return new NumericValue(((IntTag) tag).getAsInt()); + return new NumericValue(((IntTag) tag).intValue()); } @Override @@ -1944,7 +1944,7 @@ public class ShapeDispatcher @Override public Value decode(Tag tag, Level level) { - return new NumericValue(((FloatTag) tag).getAsFloat()); + return new NumericValue(((FloatTag) tag).floatValue()); } @Override @@ -2036,9 +2036,9 @@ public class ShapeDispatcher { ListTag ctag = (ListTag) tag; return ListValue.of( - new NumericValue(ctag.getDouble(0)), - new NumericValue(ctag.getDouble(1)), - new NumericValue(ctag.getDouble(2)) + new NumericValue(ctag.getDouble(0).orElseThrow()), + new NumericValue(ctag.getDouble(1).orElseThrow()), + new NumericValue(ctag.getDouble(2).orElseThrow()) ); } @@ -2083,11 +2083,11 @@ public class ShapeDispatcher List points = new ArrayList<>(); for (int i = 0, ll = ltag.size(); i < ll; i++) { - ListTag ptag = ltag.getList(i); + ListTag ptag = ltag.getList(i).orElseThrow(); points.add(ListValue.of( - new NumericValue(ptag.getDouble(0)), - new NumericValue(ptag.getDouble(1)), - new NumericValue(ptag.getDouble(2)) + new NumericValue(ptag.getDouble(0).orElseThrow()), + new NumericValue(ptag.getDouble(1).orElseThrow()), + new NumericValue(ptag.getDouble(2).orElseThrow()) )); } return ListValue.wrap(points); @@ -2122,7 +2122,7 @@ public class ShapeDispatcher @Override public Value decode(Tag tag, Level level) { - return new NumericValue(((IntTag) tag).getAsInt()); + return new NumericValue(((IntTag) tag).intValue()); } @Override @@ -2164,7 +2164,7 @@ public class ShapeDispatcher @Override public Value decode(Tag tag, Level level) { - return new NumericValue(((IntTag) tag).getAsInt()); + return new NumericValue(((IntTag) tag).intValue()); } } diff --git a/src/main/java/carpet/script/utils/ShapesRenderer.java b/src/main/java/carpet/script/utils/ShapesRenderer.java index 062a67e1..000fe48a 100644 --- a/src/main/java/carpet/script/utils/ShapesRenderer.java +++ b/src/main/java/carpet/script/utils/ShapesRenderer.java @@ -11,7 +11,7 @@ import com.mojang.blaze3d.vertex.DefaultVertexFormat; import com.mojang.blaze3d.vertex.MeshData; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.Tesselator; -import com.mojang.blaze3d.vertex.VertexBuffer; +//import com.mojang.blaze3d.vertex.VertexBuffer; import com.mojang.blaze3d.vertex.VertexFormat; import com.mojang.blaze3d.vertex.VertexFormat.Mode; import com.mojang.math.Axis; @@ -120,18 +120,18 @@ public class ShapesRenderer return; } long currentTime = client.level.getGameTime(); - RenderSystem.enableDepthTest(); + ////RenderSystem.enableDepthTest(); //RenderSystem.setShader(CoreShaders.POSITION_COLOR); - RenderSystem.depthFunc(515); - RenderSystem.enableBlend(); - RenderSystem.defaultBlendFunc(); + ////RenderSystem.depthFunc(515); + ////RenderSystem.enableBlend(); + ////RenderSystem.defaultBlendFunc(); // too bright //RenderSystem.blendFuncSeparate(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE, GlStateManager.SrcFactor.ONE, GlStateManager.DstFactor.ZERO); // meh //RenderSystem.blendFuncSeparate(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SrcFactor.ONE, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA); - RenderSystem.disableCull(); - RenderSystem.depthMask(false); + ////RenderSystem.disableCull(); + ////RenderSystem.depthMask(false); //RenderSystem.polygonOffset(-3f, -3f); //RenderSystem.enablePolygonOffset(); @@ -184,10 +184,10 @@ public class ShapesRenderer } }); } - RenderSystem.enableCull(); - RenderSystem.depthMask(true); - RenderSystem.enableBlend(); - RenderSystem.defaultBlendFunc(); + ////RenderSystem.enableCull(); + ////RenderSystem.depthMask(true); + ////RenderSystem.enableBlend(); + ////RenderSystem.defaultBlendFunc(); token.run(); } @@ -196,7 +196,7 @@ public class ShapesRenderer Runnable token = Carpet.startProfilerSection("Scarpet client"); for (int i = 0, count = tag.size(); i < count; i++) { - addShape(tag.getCompound(i)); + addShape(tag.getCompound(i).orElseThrow()); } token.run(); } @@ -209,7 +209,7 @@ public class ShapesRenderer return; } BiFunction> shapeFactory; - shapeFactory = renderedShapes.get(tag.getString("shape")); + shapeFactory = renderedShapes.get(tag.getString("shape").orElseThrow()); if (shapeFactory == null) { CarpetScriptServer.LOG.info("Unrecognized shape: " + tag.getString("shape")); @@ -373,9 +373,9 @@ public class ShapesRenderer matrices.mulPose(Axis.YP.rotationDegrees(180)); } - RenderSystem.depthMask(true); - RenderSystem.enableCull(); - RenderSystem.enableDepthTest(); + ////RenderSystem.depthMask(true); + ////RenderSystem.enableCull(); + ////RenderSystem.enableDepthTest(); blockPos = BlockPos.containing(v1); int light = 0; @@ -409,7 +409,7 @@ public class ShapesRenderer } else { type = ItemBlockRenderTypes.getRenderType(blockState); } - client.getBlockRenderer().getModelRenderer().renderModel(matrices.last(), immediate.getBuffer(type), blockState, bakedModel, red, green, blue, light, OverlayTexture.NO_OVERLAY); + client.getBlockRenderer().getModelRenderer().renderModel(matrices.last(), immediate.getBuffer(type), bakedModel, red, green, blue, light, OverlayTexture.NO_OVERLAY); } // draw the block`s entity part @@ -450,9 +450,9 @@ public class ShapesRenderer } matrices.popPose(); immediate.endBatch(); - RenderSystem.disableCull(); - RenderSystem.disableDepthTest(); - RenderSystem.depthMask(false); + ////RenderSystem.disableCull(); + ////RenderSystem.disableDepthTest(); + ////RenderSystem.depthMask(false); } @@ -484,11 +484,11 @@ public class ShapesRenderer Font textRenderer = client.font; if (shape.doublesided) { - RenderSystem.disableCull(); + //// RenderSystem.disableCull(); TODO culling } else { - RenderSystem.enableCull(); + //// RenderSystem.enableCull(); } matrices.pushPose(); matrices.translate(v1.x - cx, v1.y - cy, v1.z - cz); @@ -527,7 +527,7 @@ public class ShapesRenderer textRenderer.drawInBatch(shape.value, text_x, 0.0F, shape.textcolor, false, matrices.last().pose(), immediate, Font.DisplayMode.NORMAL, shape.textbck, 15728880); immediate.endBatch(); matrices.popPose(); - RenderSystem.enableCull(); + ////RenderSystem.enableCull(); } @Override @@ -617,7 +617,7 @@ public class ShapesRenderer } private static void drawWithShader(MeshData mesh) { - RenderType.debugTriangleFan().draw(mesh); + RenderType.debugLineStrip(1.0).draw(mesh); //VertexBuffer buffre = mesh.drawState().format().getImmediateDrawVertexBuffer(); //buffre.bind(); //buffre.upload(mesh); @@ -645,11 +645,11 @@ public class ShapesRenderer if (shape.doublesided) { - RenderSystem.disableCull(); + ////RenderSystem.disableCull(); // todo culling } else { - RenderSystem.enableCull(); + ////RenderSystem.enableCull(); } BufferBuilder builder = tesselator.begin(faceIndices[shape.mode], DefaultVertexFormat.POSITION_COLOR); @@ -664,8 +664,8 @@ public class ShapesRenderer } drawWithShader(builder.buildOrThrow()); - RenderSystem.disableCull(); - RenderSystem.depthMask(false); + ////RenderSystem.disableCull(); + ////RenderSystem.depthMask(false); //RenderSystem.enableDepthTest(); diff --git a/src/main/java/carpet/script/value/ListValue.java b/src/main/java/carpet/script/value/ListValue.java index dfea2253..0d770809 100644 --- a/src/main/java/carpet/script/value/ListValue.java +++ b/src/main/java/carpet/script/value/ListValue.java @@ -587,13 +587,13 @@ public class ListValue extends AbstractListValue implements ContainerValueInterf { throw new NBTSerializableValue.IncompatibleTypeException(this); } - tags.forEach(t -> tag.add(StringTag.valueOf(t.getAsString()))); + tags.forEach(t -> tag.add(StringTag.valueOf(t.asString().orElseThrow()))); return tag; } // only numbers / mixed types tags.forEach(cases.contains(TagTypeCompat.DBL) - ? (t -> tag.add(DoubleTag.valueOf(((NumericTag) t).getAsDouble()))) - : (t -> tag.add(LongTag.valueOf(((NumericTag) t).getAsLong())))); + ? (t -> tag.add(DoubleTag.valueOf(((NumericTag) t).doubleValue()))) + : (t -> tag.add(LongTag.valueOf(((NumericTag) t).longValue())))); return tag; } diff --git a/src/main/java/carpet/script/value/NBTSerializableValue.java b/src/main/java/carpet/script/value/NBTSerializableValue.java index 41535605..82017897 100644 --- a/src/main/java/carpet/script/value/NBTSerializableValue.java +++ b/src/main/java/carpet/script/value/NBTSerializableValue.java @@ -64,6 +64,7 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa private Tag nbtTag = null; private Supplier nbtSupplier = null; private boolean owned = false; + private static TagParser tagParser = TagParser.create(NbtOps.INSTANCE); private NBTSerializableValue() { @@ -75,7 +76,7 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa { try { - return TagParser.parseAsArgument(NbtOps.INSTANCE, new StringReader(nbtString)); + return tagParser.parseAsArgument( new StringReader(nbtString)); } catch (CommandSyntaxException e) { @@ -128,7 +129,7 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa { try { - Tag tag = TagParser.parseAsArgument(NbtOps.INSTANCE, new StringReader(nbtString)); + Tag tag = tagParser.parseAsArgument(new StringReader(nbtString)); NBTSerializableValue value = new NBTSerializableValue(tag); value.nbtString = null; return value; @@ -386,11 +387,11 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa if (t instanceof final NumericTag number) { // short and byte will never exceed float's precision, even int won't - return t instanceof LongTag || t instanceof IntTag ? NumericValue.of(number.getAsLong()) : NumericValue.of(number.getAsNumber()); + return t instanceof LongTag || t instanceof IntTag ? NumericValue.of(number.longValue()) : NumericValue.of(number.asNumber().orElseThrow()); } - if (t instanceof StringTag) + if (t instanceof StringTag stringTag) { - return StringValue.of(t.getAsString()); + return StringValue.of(stringTag.value()); } if (t instanceof EndTag) { @@ -409,13 +410,13 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa if (t instanceof final CompoundTag ctag) { Map pairs = new HashMap<>(); - for (String key : ctag.getAllKeys()) + for (String key : ctag.keySet()) { pairs.put(new StringValue(key), decodeTagDeep(ctag.get(key))); } return MapValue.wrap(pairs); } - if (t instanceof final CollectionTag ltag) + if (t instanceof final CollectionTag ltag) { List elems = new ArrayList<>(); for (Tag elem : ltag) @@ -478,17 +479,17 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa { return !(ctag).isEmpty(); } - if (tag instanceof final CollectionTag ltag) + if (tag instanceof final CollectionTag ltag) { return !(ltag).isEmpty(); } if (tag instanceof final NumericTag number) { - return number.getAsDouble() != 0.0; + return number.doubleValue() != 0.0; } - if (tag instanceof StringTag) + if (tag instanceof StringTag st) { - return !tag.getAsString().isEmpty(); + return !st.value().isEmpty(); } return true; } @@ -570,7 +571,7 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa boolean modified = false; for (Tag target : targets) { - if (!(target instanceof final CollectionTag targetList)) + if (!(target instanceof final CollectionTag targetList)) { continue; } From 976d614a815faee69792c2c0fab0f10fdb33f4c1 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Wed, 26 Feb 2025 20:10:44 +0100 Subject: [PATCH 068/232] 1.4.168 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 5f35971c..0f2850de 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G fabric_version=0.110.5+1.21.4 # Mod Properties - mod_version = 1.4.167 + mod_version = 1.4.168 maven_group = carpet archives_base_name = fabric-carpet From 5e65a6f89c58cecd7c4524bdf95ede36e3cf9a04 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Wed, 26 Feb 2025 21:56:54 +0100 Subject: [PATCH 069/232] bring shapes to somewhat usable state, still broken and not pretty, missing culling control, text renders or not. --- .../carpet/script/utils/ShapesRenderer.java | 75 +++++++++++-------- 1 file changed, 44 insertions(+), 31 deletions(-) diff --git a/src/main/java/carpet/script/utils/ShapesRenderer.java b/src/main/java/carpet/script/utils/ShapesRenderer.java index 000fe48a..4d25c54d 100644 --- a/src/main/java/carpet/script/utils/ShapesRenderer.java +++ b/src/main/java/carpet/script/utils/ShapesRenderer.java @@ -524,6 +524,8 @@ public class ShapesRenderer text_x = (float) (-textRenderer.width(shape.value.getString())); } MultiBufferSource.BufferSource immediate = MultiBufferSource.immediate(new ByteBufferBuilder(RenderType.TRANSIENT_BUFFER_SIZE)); + // text doesn't appear if backgroud is set + ///script run draw_shape('label', 100, 'pos', [200, 100, 200], 'text', 'Hewwo World!', 'color', 0xffffffff, 'fill', 0x33333333) textRenderer.drawInBatch(shape.value, text_x, 0.0F, shape.textcolor, false, matrices.last().pose(), immediate, Font.DisplayMode.NORMAL, shape.textbck, 15728880); immediate.endBatch(); matrices.popPose(); @@ -616,8 +618,8 @@ public class ShapesRenderer } } - private static void drawWithShader(MeshData mesh) { - RenderType.debugLineStrip(1.0).draw(mesh); + private static void drawWithShader(MeshData mesh, RenderType type) { + type.draw(mesh); //VertexBuffer buffre = mesh.drawState().format().getImmediateDrawVertexBuffer(); //buffre.bind(); //buffre.upload(mesh); @@ -630,6 +632,17 @@ public class ShapesRenderer private static final VertexFormat.Mode[] faceIndices = new VertexFormat.Mode[]{ Mode.LINES, Mode.LINE_STRIP, Mode.DEBUG_LINES, Mode.DEBUG_LINE_STRIP, Mode.TRIANGLES, Mode.TRIANGLE_STRIP, Mode.TRIANGLE_FAN, Mode.QUADS}; + private static final RenderType [] renderTypes = new RenderType[] { + RenderType.debugLineStrip(1), + RenderType.debugLineStrip(1), + RenderType.debugLineStrip(1), + RenderType.debugLineStrip(1), + RenderType.debugLineStrip(1), // TODO wrong + RenderType.debugLineStrip(1), // TODO wrong + RenderType.debugLineStrip(1), + RenderType.debugQuads() + }; + public RenderedPolyface(Minecraft client, ShapeDispatcher.ExpiringShape shape) { super(client, (ShapeDispatcher.Polyface) shape); @@ -662,7 +675,7 @@ public class ShapesRenderer } builder.addVertex((float) (vec.x() - cx), (float) (vec.y() - cy), (float) (vec.z() - cz)).setColor(shape.fr, shape.fg, shape.fb, shape.fa); } - drawWithShader(builder.buildOrThrow()); + drawWithShader(builder.buildOrThrow(), renderTypes[shape.mode]); ////RenderSystem.disableCull(); ////RenderSystem.depthMask(false); @@ -698,7 +711,7 @@ public class ShapesRenderer builder.addVertex((float) (vec.x() - cx), (float) (vec.y() - cy), (float) (vec.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a); } builder.addVertex((float) (vec0.x() - cx), (float) (vec0.y() - cy), (float) (vec0.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a); - drawWithShader(builder.buildOrThrow()); + drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1)); if (shape.inneredges) { BufferBuilder builderr = tesselator.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR); @@ -713,7 +726,7 @@ public class ShapesRenderer builderr.addVertex((float) (vec.x() - cx), (float) (vec.y() - cy), (float) (vec.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a); builderr.addVertex((float) (vec0.x() - cx), (float) (vec0.y() - cy), (float) (vec0.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a); } - drawWithShader(builderr.buildOrThrow()); + drawWithShader(builderr.buildOrThrow(), RenderType.debugLineStrip(1)); } return; } @@ -758,7 +771,7 @@ public class ShapesRenderer builder.addVertex((float) (vec.x() - cx), (float) (vec.y() - cy), (float) (vec.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a); } } - drawWithShader(builder.buildOrThrow()); + drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1)); return; } if (shape.mode == 4) @@ -792,7 +805,7 @@ public class ShapesRenderer builder.addVertex((float) (vecC.x() - cx), (float) (vecC.y() - cy), (float) (vecC.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a); builder.addVertex((float) (vecA.x() - cx), (float) (vecA.y() - cy), (float) (vecA.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a); } - drawWithShader(builder.buildOrThrow()); + drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1)); } } } @@ -881,7 +894,7 @@ public class ShapesRenderer BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR); builder.addVertex(x1, y1, z1).setColor(red1, grn1, blu1, alpha); builder.addVertex(x2, y2, z2).setColor(red1, grn1, blu1, alpha); - drawWithShader(builder.buildOrThrow()); + drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1)); } public static void drawBoxWireGLLines( @@ -934,7 +947,7 @@ public class ShapesRenderer builder.addVertex(x2, y2, z1).setColor(red1, grn1, blu1, alpha); builder.addVertex(x2, y2, z2).setColor(red1, grn1, blu1, alpha); } - drawWithShader(builder.buildOrThrow()); + drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1)); } public static void drawBoxFaces( @@ -995,7 +1008,7 @@ public class ShapesRenderer builder.addVertex(x1, y2, z2).setColor(red1, grn1, blu1, alpha); } } - drawWithShader(builder.buildOrThrow()); + drawWithShader(builder.buildOrThrow(), RenderType.debugQuads()); } public static void drawCylinderWireframe(Tesselator tesselator, @@ -1028,7 +1041,7 @@ public class ShapesRenderer float z = r * Mth.sin(theta); builder.addVertex(x + cx, y + cy, z + cz).setColor(red, grn, blu, alpha); } - drawWithShader(builder.buildOrThrow()); + drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1)); } if (!isFlat) @@ -1046,7 +1059,7 @@ public class ShapesRenderer builder.addVertex(cx + x, cy + h, cz - z).setColor(red, grn, blu, alpha); builder.addVertex(cx - x, cy + h, cz + z).setColor(red, grn, blu, alpha); builder.addVertex(cx - x, cy + 0, cz + z).setColor(red, grn, blu, alpha); - drawWithShader(builder.buildOrThrow()); + drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1)); } } else @@ -1060,7 +1073,7 @@ public class ShapesRenderer builder.addVertex(cx - x, cy, cz + z).setColor(red, grn, blu, alpha); builder.addVertex(cx + x, cy, cz - z).setColor(red, grn, blu, alpha); } - drawWithShader(builder.buildOrThrow()); + drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1)); } } @@ -1078,7 +1091,7 @@ public class ShapesRenderer float y = r * Mth.sin(theta); builder.addVertex(x + cx, y + cy, z + cz).setColor(red, grn, blu, alpha); } - drawWithShader(builder.buildOrThrow()); + drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1)); } if (!isFlat) @@ -1095,7 +1108,7 @@ public class ShapesRenderer builder.addVertex(cx + 0, cy + y, cz - z).setColor(red, grn, blu, alpha); builder.addVertex(cx + h, cy + y, cz - z).setColor(red, grn, blu, alpha); builder.addVertex(cx + h, cy - y, cz + z).setColor(red, grn, blu, alpha); - drawWithShader(builder.buildOrThrow()); + drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1)); } } else @@ -1109,7 +1122,7 @@ public class ShapesRenderer builder.addVertex(cx, cy - y, cz + z).setColor(red, grn, blu, alpha); builder.addVertex(cx, cy + y, cz - z).setColor(red, grn, blu, alpha); } - drawWithShader(builder.buildOrThrow()); + drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1)); } } else if (axis == Direction.Axis.Z) @@ -1126,7 +1139,7 @@ public class ShapesRenderer float x = r * Mth.sin(theta); builder.addVertex(x + cx, y + cy, z + cz).setColor(red, grn, blu, alpha); } - drawWithShader(builder.buildOrThrow()); + drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1)); } if (!isFlat) { @@ -1142,7 +1155,7 @@ public class ShapesRenderer builder.addVertex(cx - x, cy + y, cz + 0).setColor(red, grn, blu, alpha); builder.addVertex(cx - x, cy + y, cz + h).setColor(red, grn, blu, alpha); builder.addVertex(cx + x, cy - y, cz + h).setColor(red, grn, blu, alpha); - drawWithShader(builder.buildOrThrow()); + drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1)); } } else @@ -1156,7 +1169,7 @@ public class ShapesRenderer builder.addVertex(cx + x, cy - y, cz).setColor(red, grn, blu, alpha); builder.addVertex(cx - x, cy + y, cz).setColor(red, grn, blu, alpha); } - drawWithShader(builder.buildOrThrow()); + drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1)); } } @@ -1183,7 +1196,7 @@ public class ShapesRenderer float z = r * Mth.sin(theta); builder.addVertex(x + cx, cy, z + cz).setColor(red, grn, blu, alpha); } - drawWithShader(builder.buildOrThrow()); + drawWithShader(builder.buildOrThrow(), RenderType.debugTriangleFan()); if (!isFlat) { BufferBuilder builderr = tesselator.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR); @@ -1195,7 +1208,7 @@ public class ShapesRenderer float z = r * Mth.sin(theta); builderr.addVertex(x + cx, cy + h, z + cz).setColor(red, grn, blu, alpha); } - drawWithShader(builderr.buildOrThrow()); + drawWithShader(builderr.buildOrThrow(), RenderType.debugTriangleFan()); BufferBuilder builderrr = tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR); // quad strip to quads float xp = r * 1; @@ -1212,7 +1225,7 @@ public class ShapesRenderer xp = x; zp = z; } - drawWithShader(builderrr.buildOrThrow()); + drawWithShader(builderrr.buildOrThrow(), RenderType.debugQuads()); } } @@ -1227,7 +1240,7 @@ public class ShapesRenderer float z = r * Mth.sin(theta); builder.addVertex(cx, cy + y, z + cz).setColor(red, grn, blu, alpha); } - drawWithShader(builder.buildOrThrow()); + drawWithShader(builder.buildOrThrow(), RenderType.debugTriangleFan()); if (!isFlat) { BufferBuilder builderr = tesselator.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR); @@ -1239,7 +1252,7 @@ public class ShapesRenderer float z = r * Mth.sin(theta); builderr.addVertex(cx + h, cy + y, cz + z).setColor(red, grn, blu, alpha); } - drawWithShader(builderr.buildOrThrow()); + drawWithShader(builderr.buildOrThrow(), RenderType.debugTriangleFan()); BufferBuilder builderrr = tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR); // quad strip to quads float yp = r * 1; @@ -1256,7 +1269,7 @@ public class ShapesRenderer yp = y; zp = z; } - drawWithShader(builderrr.buildOrThrow()); + drawWithShader(builderrr.buildOrThrow(), RenderType.debugQuads()); } } else if (axis == Direction.Axis.Z) @@ -1270,7 +1283,7 @@ public class ShapesRenderer float y = r * Mth.sin(theta); builder.addVertex(x + cx, cy + y, cz).setColor(red, grn, blu, alpha); } - drawWithShader(builder.buildOrThrow()); + drawWithShader(builder.buildOrThrow(), RenderType.debugTriangleFan()); if (!isFlat) { BufferBuilder builderr = tesselator.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR); @@ -1282,7 +1295,7 @@ public class ShapesRenderer float y = r * Mth.sin(theta); builderr.addVertex(x + cx, cy + y, cz + h).setColor(red, grn, blu, alpha); } - drawWithShader(builderr.buildOrThrow()); + drawWithShader(builderr.buildOrThrow(), RenderType.debugTriangleFan()); BufferBuilder builderrr = tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR); // quad strip to quads float xp = r; @@ -1299,7 +1312,7 @@ public class ShapesRenderer xp = x; yp = y; } - drawWithShader(builderrr.buildOrThrow()); + drawWithShader(builderrr.buildOrThrow(), RenderType.debugQuads()); } } } @@ -1324,7 +1337,7 @@ public class ShapesRenderer float y = r * Mth.cos(phi); builder.addVertex(x + cx, y + cy, z + cz).setColor(red, grn, blu, alpha); } - drawWithShader(builder.buildOrThrow()); + drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1)); } for (int j = 0; j <= num_steps180; j++) { @@ -1339,7 +1352,7 @@ public class ShapesRenderer float y = r * Mth.cos(phi); builder.addVertex(x + cx, y + cy, z + cz).setColor(red, grn, blu, alpha); } - drawWithShader(builder.buildOrThrow()); + drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1)); } } @@ -1381,7 +1394,7 @@ public class ShapesRenderer zbp = zp; yp = y; } - drawWithShader(builder.buildOrThrow()); + drawWithShader(builder.buildOrThrow(), RenderType.debugQuads()); } } } From d5ef0a89dbaef479d9fd6ef5c62c5cd9f771927a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 26 Feb 2025 21:08:27 +0000 Subject: [PATCH 070/232] Merge docs for 'Carpet Mod 1.4.168 for Minecraft 25w09a' --- docs/scarpet/Full.md | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/docs/scarpet/Full.md b/docs/scarpet/Full.md index 625cd99c..c52f2aa5 100644 --- a/docs/scarpet/Full.md +++ b/docs/scarpet/Full.md @@ -5731,11 +5731,21 @@ Runs a vanilla command from the string result of the `expr` and returns a triple intercepted list of output messages, and error message if the command resulted in a failure. Successful commands return `null` as their error. +The command return `null` if the command was not run immediately, but was scheduled for later execution +due to being requested while command was executed. This happens most commonly +when running `run` from a `/script run/invoke` command since that always results in piling up command to run while `script` is being executed. + +The mitigation for this is to use `run` in a separate scheduled function, or use `run` in a `tick` event, or literally in +any other way than directly from a `/script` command, which will ensure that the command runs immediately. +
    -run('fill 1 1 1 10 10 10 air') -> [0, ["Successfully filled 123 blocks"], null]
    -run('give @s stone 4') -> [0, ["Gave 4 [Stone] to gnembon"], null]
    -run('seed') -> [0, ["Seed: [4031384495743822299]"], null]
    -run('sed') -> [0, [], "sed<--[HERE]"] // wrong command
    +run('fill 1 1 1 10 10 10 air') -> [123, ["Successfully filled 123 blocks"], null]
    +run('give @s stone 4') -> [1, ["Gave 4 [Stone] to gnembon"], null]
    +run('seed') -> [-170661413, [Seed: [4031384495743822299]], null]
    +run('sed') -> [-1, [], "sed<--[HERE]"] // wrong command
    +
    +/script run run('setblock 0 0 0 stone') -> null
    +/script run schedule(0, _() -> print(run('setblock 0 0 0 stone'))) -> [1, [Changed the block at 0, 0, 0], null]
     
    ### `save()` From ac72645cb487445f5307916a9545d49fb1e8a654 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Wed, 26 Feb 2025 22:20:57 +0100 Subject: [PATCH 071/232] fix potential crash. Fixes #2041 --- src/main/java/carpet/CarpetServer.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/carpet/CarpetServer.java b/src/main/java/carpet/CarpetServer.java index ac102ace..65ffb8ad 100644 --- a/src/main/java/carpet/CarpetServer.java +++ b/src/main/java/carpet/CarpetServer.java @@ -40,6 +40,8 @@ import net.minecraft.server.MinecraftServer; import net.minecraft.server.commands.PerfCommand; import net.minecraft.server.level.ServerPlayer; +import javax.annotation.Nullable; + public class CarpetServer // static for now - easier to handle all around the code, its one anyways { public static MinecraftServer minecraft_server; @@ -172,7 +174,7 @@ public class CarpetServer // static for now - easier to handle all around the co scriptServer = null; } - public static void onServerClosed(MinecraftServer server) + public static void onServerClosed(@Nullable MinecraftServer server) { // this for whatever reason gets called multiple times even when joining on SP // so we allow to pass multiple times gating it only on existing server ref @@ -180,7 +182,7 @@ public class CarpetServer // static for now - easier to handle all around the co { if (scriptServer != null) scriptServer.onClose(); // this is a mess, will cleanip onlly when global reference is gone - if (!Vanilla.MinecraftServer_getScriptServer(server).stopAll) { + if (server != null && !Vanilla.MinecraftServer_getScriptServer(server).stopAll) { Vanilla.MinecraftServer_getScriptServer(server).onClose(); } From da5b937e78c949ecea743cf607fb3d31249b48e6 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Tue, 11 Mar 2025 23:13:02 +0100 Subject: [PATCH 072/232] fix broken particle parsing --- docs/scarpet/api/Auxiliary.md | 2 +- gradle.properties | 2 +- src/main/java/carpet/helpers/ParticleDisplay.java | 8 +------- .../logging/logHelpers/PathfindingVisualizer.java | 7 +++++-- src/main/java/carpet/mixins/Villager_aiMixin.java | 3 ++- src/main/java/carpet/script/utils/ShapeDispatcher.java | 10 +++++----- src/main/resources/assets/carpet/scripts/camera.sc | 5 +++-- 7 files changed, 18 insertions(+), 19 deletions(-) diff --git a/docs/scarpet/api/Auxiliary.md b/docs/scarpet/api/Auxiliary.md index 5a3915fb..59d4cb12 100644 --- a/docs/scarpet/api/Auxiliary.md +++ b/docs/scarpet/api/Auxiliary.md @@ -22,7 +22,7 @@ clients will actually be able to receive (they may have more available via resou Renders a cloud of particles `name` centered around `pos` position, by default `count` 10 of them, default `speed` of 0, and to all players nearby, but these options can be changed via optional arguments. Follow vanilla `/particle` command on details on those options. Valid particle names are -for example `'angry_villager', 'item diamond', 'block stone', 'dust 0.8 0.1 0.1 4'`. +for example `'angry_villager', 'item diamond', 'block stone', 'dust{"scale": 4, "color": [0.8, 0.1, 0.1]}'`. Used with no arguments, return the list of available particle names. Note that some of the names do not correspond to a valid particle that can be fed to `particle(...)` function due to a fact that some particles need more configuration diff --git a/gradle.properties b/gradle.properties index 0f2850de..8e6146a6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=25w09a + minecraft_version=1.21.5-pre1 loader_version=0.16.10 jsr305_version=3.0.2 fabric_version=0.110.5+1.21.4 diff --git a/src/main/java/carpet/helpers/ParticleDisplay.java b/src/main/java/carpet/helpers/ParticleDisplay.java index 733c06ac..67ec012e 100644 --- a/src/main/java/carpet/helpers/ParticleDisplay.java +++ b/src/main/java/carpet/helpers/ParticleDisplay.java @@ -1,19 +1,13 @@ package carpet.helpers; -import carpet.script.utils.ParticleParser; -import net.minecraft.core.HolderLookup; import net.minecraft.core.particles.ParticleOptions; -import net.minecraft.core.particles.ParticleType; -import net.minecraft.core.registries.Registries; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.phys.Vec3; public class ParticleDisplay { - public static void drawParticleLine(ServerPlayer player, Vec3 from, Vec3 to, String main, String accent, int count, double spread) + public static void drawParticleLine(ServerPlayer player, Vec3 from, Vec3 to, ParticleOptions mainParticle, ParticleOptions accentParticle, int count, double spread) { - ParticleOptions accentParticle = ParticleParser.getEffect(accent, player.server.registryAccess()); - ParticleOptions mainParticle = ParticleParser.getEffect(main, player.server.registryAccess()); if (accentParticle != null) player.serverLevel().sendParticles( player, diff --git a/src/main/java/carpet/logging/logHelpers/PathfindingVisualizer.java b/src/main/java/carpet/logging/logHelpers/PathfindingVisualizer.java index ff66ee3c..987af8d5 100644 --- a/src/main/java/carpet/logging/logHelpers/PathfindingVisualizer.java +++ b/src/main/java/carpet/logging/logHelpers/PathfindingVisualizer.java @@ -2,6 +2,9 @@ package carpet.logging.logHelpers; import carpet.helpers.ParticleDisplay; import carpet.logging.LoggerRegistry; +import net.minecraft.core.particles.DustParticleOptions; +import net.minecraft.core.particles.ParticleOptions; +import net.minecraft.core.particles.ParticleTypes; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; import net.minecraft.world.phys.Vec3; @@ -31,8 +34,8 @@ public class PathfindingVisualizer if (minDuration < 1) minDuration = 1; - String accent = successful ? "happy_villager" : "angry_villager"; - String color = (miliseconds/minDuration < 2)? "dust 1 1 0 1" : ((miliseconds/minDuration < 4)?"dust 1 0.5 0 1":"dust 1 0 0 1"); + ParticleOptions accent = successful ? ParticleTypes.HAPPY_VILLAGER : ParticleTypes.ANGRY_VILLAGER; + ParticleOptions color = (miliseconds/minDuration < 2)? new DustParticleOptions(0xffffff00, 1) : ((miliseconds/minDuration < 4)?new DustParticleOptions(0xFFFF7700, 1): new DustParticleOptions(0xFFFF0000, 1)); ParticleDisplay.drawParticleLine((ServerPlayer) player, entity.position(), target, color, accent, 5, 0.5); return null; }); diff --git a/src/main/java/carpet/mixins/Villager_aiMixin.java b/src/main/java/carpet/mixins/Villager_aiMixin.java index 359fbcf6..ea0a0b1e 100644 --- a/src/main/java/carpet/mixins/Villager_aiMixin.java +++ b/src/main/java/carpet/mixins/Villager_aiMixin.java @@ -3,6 +3,7 @@ package carpet.mixins; import carpet.helpers.ParticleDisplay; import carpet.utils.Messenger; import carpet.utils.MobAI; +import net.minecraft.core.particles.DustParticleOptions; import net.minecraft.world.entity.ai.village.poi.PoiTypes; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -131,7 +132,7 @@ public abstract class Villager_aiMixin extends AbstractVillager else { - ParticleDisplay.drawParticleLine((ServerPlayer) playerEntity_1, position(), Vec3.atCenterOf(bedPos.pos()), "dust 0 0 0 1", "happy_villager", 100, 0.2); // pos+0.5v + ParticleDisplay.drawParticleLine((ServerPlayer) playerEntity_1, position(), Vec3.atCenterOf(bedPos.pos()), new DustParticleOptions(0xff000000, 1), ParticleTypes.HAPPY_VILLAGER, 100, 0.2); // pos+0.5v } } else if (itemStack_1.getItem() == Items.ROTTEN_FLESH) diff --git a/src/main/java/carpet/script/utils/ShapeDispatcher.java b/src/main/java/carpet/script/utils/ShapeDispatcher.java index 12babace..1251a4e0 100644 --- a/src/main/java/carpet/script/utils/ShapeDispatcher.java +++ b/src/main/java/carpet/script/utils/ShapeDispatcher.java @@ -26,6 +26,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.Registry; import net.minecraft.core.RegistryAccess; +import net.minecraft.core.particles.DustParticleOptions; import net.minecraft.core.particles.ParticleOptions; import net.minecraft.core.registries.Registries; import net.minecraft.nbt.ByteTag; @@ -46,6 +47,7 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; +import net.minecraft.util.ARGB; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.world.entity.Entity; @@ -435,10 +437,8 @@ public class ShapeDispatcher protected ParticleOptions replacementParticle(RegistryAccess regs) { - String particleName = fa == 0 ? - String.format(Locale.ROOT, "dust %.1f %.1f %.1f 1.0", r, g, b) : - String.format(Locale.ROOT, "dust %.1f %.1f %.1f 1.0", fr, fg, fb); - return getParticleData(particleName, regs); + boolean bg = fa == 0; + return new DustParticleOptions(ARGB.colorFromFloat(1.0f, (bg ?r:fr), (bg ?r:fr), (bg ?r:fr)), 1); } @@ -1069,7 +1069,7 @@ public class ShapeDispatcher } if (fa > 0.0f) { - ParticleOptions locparticledata = getParticleData(String.format(Locale.ROOT, "dust %.1f %.1f %.1f %.1f", fr, fg, fb, fa), p.level().registryAccess()); + ParticleOptions locparticledata = new DustParticleOptions(ARGB.colorFromFloat(1.0f, fr, fg, fb), 1); for (Vec3 v : getAlterPoint(p)) { p.serverLevel().sendParticles(p, locparticledata, true, true, diff --git a/src/main/resources/assets/carpet/scripts/camera.sc b/src/main/resources/assets/carpet/scripts/camera.sc index 63cc6c46..f0bfdb96 100644 --- a/src/main/resources/assets/carpet/scripts/camera.sc +++ b/src/main/resources/assets/carpet/scripts/camera.sc @@ -127,8 +127,9 @@ _start_with(points_supplier) -> global_dimension = p~'dimension'; code = abs(hash_code(str(p))-123456); - global_color_a = str('dust %.1f %.1f %.1f 1',(code%10)/10,(((code/10)%10)/10), (((code/100)%10)/10) ); // 'dust 0.1 0.9 0.1 1', - global_color_b = str('dust %.1f %.1f %.1f 1',(((code/1000)%10)/10),(((code/10000)%10)/10), (((code/100000)%10)/10) );// 'dust 0.6 0.6 0.6 1' + + global_color_a = str('dust{"scale": 1, "color": [%.1f, %.1f, %.1f]}',(code%10)/10,(((code/10)%10)/10), (((code/100)%10)/10) ); // 'dust 0.1 0.9 0.1 1', + global_color_b = str('dust{"scale": 1, "color": [%.1f, %.1f, %.1f]}',(((code/1000)%10)/10),(((code/10000)%10)/10), (((code/100000)%10)/10) );// 'dust 0.6 0.6 0.6 1' global_points = call(points_supplier); global_selected_point = null; From ce4cfc5db0292a928127b1c0ab51578cd62ca72f Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Tue, 11 Mar 2025 23:13:17 +0100 Subject: [PATCH 073/232] fix broken player position setting --- src/main/java/carpet/script/value/EntityValue.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/main/java/carpet/script/value/EntityValue.java b/src/main/java/carpet/script/value/EntityValue.java index 801a2e8a..800cf9e6 100644 --- a/src/main/java/carpet/script/value/EntityValue.java +++ b/src/main/java/carpet/script/value/EntityValue.java @@ -903,12 +903,7 @@ public class EntityValue extends Value } if (e instanceof ServerPlayer sp) { - // this forces position but doesn't angles for some reason. Need both in the API in the future. - EnumSet set = EnumSet.noneOf(Relative.class); - set.add(Relative.X_ROT); - set.add(Relative.Y_ROT); - - sp.connection.teleport(new PositionMoveRotation(new Vec3(x, y, z), Vec3.ZERO, yaw, pitch), set); + sp.connection.teleport(x, y, z, yaw, pitch); } else { From 8e3857caa761abf912656021ffa4582a0d5680a0 Mon Sep 17 00:00:00 2001 From: altrisi Date: Sat, 15 Mar 2025 13:40:13 +0100 Subject: [PATCH 074/232] Update to pre2 pre1 has too much graphic corruption --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 8e6146a6..4b5268ba 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=1.21.5-pre1 + minecraft_version=1.21.5-pre2 loader_version=0.16.10 jsr305_version=3.0.2 fabric_version=0.110.5+1.21.4 From 57df043efa29855a181be22cb742d8005d071ddb Mon Sep 17 00:00:00 2001 From: altrisi Date: Sat, 15 Mar 2025 13:42:36 +0100 Subject: [PATCH 075/232] Fix remainder calculation when cauldroning shulker boxes Now handled properly by the game's code --- ...actCauldronBlock_stackableSBoxesMixin.java | 40 ------------------- src/main/resources/carpet.mixins.json | 1 - 2 files changed, 41 deletions(-) delete mode 100644 src/main/java/carpet/mixins/AbstractCauldronBlock_stackableSBoxesMixin.java diff --git a/src/main/java/carpet/mixins/AbstractCauldronBlock_stackableSBoxesMixin.java b/src/main/java/carpet/mixins/AbstractCauldronBlock_stackableSBoxesMixin.java deleted file mode 100644 index ea7ffa26..00000000 --- a/src/main/java/carpet/mixins/AbstractCauldronBlock_stackableSBoxesMixin.java +++ /dev/null @@ -1,40 +0,0 @@ -package carpet.mixins; - -import carpet.CarpetSettings; -import net.minecraft.core.BlockPos; -import net.minecraft.core.cauldron.CauldronInteraction; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.BlockItem; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.AbstractCauldronBlock; -import net.minecraft.world.level.block.ShulkerBoxBlock; -import net.minecraft.world.level.block.state.BlockState; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; - -@Mixin(AbstractCauldronBlock.class) -public class AbstractCauldronBlock_stackableSBoxesMixin -{ - @Redirect(method = "useItemOn", at = @At( - value = "INVOKE", - target = "Lnet/minecraft/core/cauldron/CauldronInteraction;interact(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/InteractionHand;Lnet/minecraft/world/item/ItemStack;)Lnet/minecraft/world/InteractionResult;" - )) - private InteractionResult wrapInteractor(final CauldronInteraction cauldronBehavior, final BlockState blockState, final Level world, final BlockPos blockPos, final Player playerEntity, final InteractionHand hand, final ItemStack itemStack) - { - int count = -1; - if (CarpetSettings.shulkerBoxStackSize > 1 && itemStack.getItem() instanceof BlockItem && ((BlockItem)itemStack.getItem()).getBlock() instanceof ShulkerBoxBlock) - count = itemStack.getCount(); - InteractionResult result = cauldronBehavior.interact(blockState, world, blockPos, playerEntity, hand, itemStack); - if (count > 0 && result.consumesAction()) - { - ItemStack current = playerEntity.getItemInHand(hand); - if (current.getItem() instanceof BlockItem && ((BlockItem)itemStack.getItem()).getBlock() instanceof ShulkerBoxBlock) - current.setCount(count); - } - return result; - } -} diff --git a/src/main/resources/carpet.mixins.json b/src/main/resources/carpet.mixins.json index 240d70e5..366ebf76 100644 --- a/src/main/resources/carpet.mixins.json +++ b/src/main/resources/carpet.mixins.json @@ -98,7 +98,6 @@ "HopperBlockEntity_counterMixin", "AbstractContainerMenu_ctrlQCraftingMixin", "Connection_packetCounterMixin", - "AbstractCauldronBlock_stackableSBoxesMixin", "ItemStack_stackableShulkerBoxesMixin", "ItemEntityMixin", "TntBlock_noUpdateMixin", From 41a7d8df46e9c83e53af83bc4464c6086c866f44 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Fri, 21 Mar 2025 10:57:16 +0100 Subject: [PATCH 076/232] fix some broken shapes and text rendering on background. Still doublesiding doesn't work properly until I got to renderpasses --- .../carpet/script/utils/ShapesRenderer.java | 99 ++++++++++++++----- 1 file changed, 74 insertions(+), 25 deletions(-) diff --git a/src/main/java/carpet/script/utils/ShapesRenderer.java b/src/main/java/carpet/script/utils/ShapesRenderer.java index 4d25c54d..51e7b86a 100644 --- a/src/main/java/carpet/script/utils/ShapesRenderer.java +++ b/src/main/java/carpet/script/utils/ShapesRenderer.java @@ -526,7 +526,7 @@ public class ShapesRenderer MultiBufferSource.BufferSource immediate = MultiBufferSource.immediate(new ByteBufferBuilder(RenderType.TRANSIENT_BUFFER_SIZE)); // text doesn't appear if backgroud is set ///script run draw_shape('label', 100, 'pos', [200, 100, 200], 'text', 'Hewwo World!', 'color', 0xffffffff, 'fill', 0x33333333) - textRenderer.drawInBatch(shape.value, text_x, 0.0F, shape.textcolor, false, matrices.last().pose(), immediate, Font.DisplayMode.NORMAL, shape.textbck, 15728880); + textRenderer.drawInBatch(shape.value, text_x, 0.0F, shape.textcolor, false, matrices.last().pose(), immediate, Font.DisplayMode.SEE_THROUGH, shape.textbck, 15728880); immediate.endBatch(); matrices.popPose(); ////RenderSystem.enableCull(); @@ -629,6 +629,7 @@ public class ShapesRenderer public static class RenderedPolyface extends RenderedShape { + // mode now can only be 4, 5, or 6 private static final VertexFormat.Mode[] faceIndices = new VertexFormat.Mode[]{ Mode.LINES, Mode.LINE_STRIP, Mode.DEBUG_LINES, Mode.DEBUG_LINE_STRIP, Mode.TRIANGLES, Mode.TRIANGLE_STRIP, Mode.TRIANGLE_FAN, Mode.QUADS}; @@ -637,10 +638,10 @@ public class ShapesRenderer RenderType.debugLineStrip(1), RenderType.debugLineStrip(1), RenderType.debugLineStrip(1), - RenderType.debugLineStrip(1), // TODO wrong - RenderType.debugLineStrip(1), // TODO wrong - RenderType.debugLineStrip(1), - RenderType.debugQuads() + RenderType.debugTriangleFan(), // TODO wrong + RenderType.debugTriangleFan(), // TODO wrong + RenderType.debugTriangleFan(), + RenderType.debugQuads() }; public RenderedPolyface(Minecraft client, ShapeDispatcher.ExpiringShape shape) @@ -714,7 +715,7 @@ public class ShapesRenderer drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1)); if (shape.inneredges) { - BufferBuilder builderr = tesselator.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR); + BufferBuilder builderr = tesselator.begin(Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR); for (int i = 1; i < shape.vertexList.size() - 1; i++) { Vec3 vec = shape.vertexList.get(i); @@ -722,7 +723,7 @@ public class ShapesRenderer { vec = shape.relativiseRender(client.level, vec, partialTick); } - + builderr.addVertex((float) (vec0.x() - cx), (float) (vec0.y() - cy), (float) (vec0.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a); builderr.addVertex((float) (vec.x() - cx), (float) (vec.y() - cy), (float) (vec.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a); builderr.addVertex((float) (vec0.x() - cx), (float) (vec0.y() - cy), (float) (vec0.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a); } @@ -776,9 +777,10 @@ public class ShapesRenderer } if (shape.mode == 4) { - BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR); + // for (int i = 0; i < shape.vertexList.size(); i++) { + BufferBuilder builder = tesselator.begin(Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR); Vec3 vecA = shape.vertexList.get(i); if (shape.relative.get(i)) { @@ -799,13 +801,15 @@ public class ShapesRenderer builder.addVertex((float) (vecA.x() - cx), (float) (vecA.y() - cy), (float) (vecA.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a); builder.addVertex((float) (vecB.x() - cx), (float) (vecB.y() - cy), (float) (vecB.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a); - builder.addVertex((float) (vecB.x() - cx), (float) (vecB.y() - cy), (float) (vecB.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a); + //builder.addVertex((float) (vecB.x() - cx), (float) (vecB.y() - cy), (float) (vecB.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a); builder.addVertex((float) (vecC.x() - cx), (float) (vecC.y() - cy), (float) (vecC.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a); - builder.addVertex((float) (vecC.x() - cx), (float) (vecC.y() - cy), (float) (vecC.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a); + //builder.addVertex((float) (vecC.x() - cx), (float) (vecC.y() - cy), (float) (vecC.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a); builder.addVertex((float) (vecA.x() - cx), (float) (vecA.y() - cy), (float) (vecA.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a); + + drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1)); } - drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1)); + //drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1)); } } } @@ -865,7 +869,7 @@ public class ShapesRenderer drawCylinderWireframe(tesselator, (float) (vc.x - cx - dir * renderEpsilon), (float) (vc.y - cy - dir * renderEpsilon), (float) (vc.z - cz - dir * renderEpsilon), (float) (shape.radius + renderEpsilon), (float) (shape.height + 2 * dir * renderEpsilon), shape.axis, - shape.subdivisions, shape.radius == 0, + shape.subdivisions, shape.height == 0, shape.r, shape.g, shape.b, shape.a); } @@ -891,7 +895,7 @@ public class ShapesRenderer public static void drawLine(Tesselator tesselator, float x1, float y1, float z1, float x2, float y2, float z2, float red1, float grn1, float blu1, float alpha) { - BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR); + BufferBuilder builder = tesselator.begin(Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR); builder.addVertex(x1, y1, z1).setColor(red1, grn1, blu1, alpha); builder.addVertex(x2, y2, z2).setColor(red1, grn1, blu1, alpha); drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1)); @@ -904,7 +908,8 @@ public class ShapesRenderer boolean xthick, boolean ythick, boolean zthick, float red1, float grn1, float blu1, float alpha, float red2, float grn2, float blu2) { - BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR); + BufferBuilder builder = tesselator.begin(Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR); + /* old lines not using strip if (xthick) { builder.addVertex(x1, y1, z1).setColor(red1, grn2, blu2, alpha); @@ -946,6 +951,51 @@ public class ShapesRenderer builder.addVertex(x2, y2, z1).setColor(red1, grn1, blu1, alpha); builder.addVertex(x2, y2, z2).setColor(red1, grn1, blu1, alpha); + } + */ + + if (xthick) + + { + builder.addVertex(x1, y1, z1).setColor(red1, grn2, blu2, alpha); + builder.addVertex(x2, y1, z1).setColor(red1, grn2, blu2, alpha); + + builder.addVertex(x2, y2, z1).setColor(red1, grn1, blu1, alpha); + builder.addVertex(x1, y2, z1).setColor(red1, grn1, blu1, alpha); + + builder.addVertex(x1, y2, z2).setColor(red1, grn1, blu1, alpha); + builder.addVertex(x2, y2, z2).setColor(red1, grn1, blu1, alpha); + + builder.addVertex(x2, y1, z2).setColor(red1, grn1, blu1, alpha); + builder.addVertex(x1, y1, z2).setColor(red1, grn1, blu1, alpha); + } + if (ythick) + { + builder.addVertex(x1, y1, z1).setColor(red2, grn1, blu2, alpha); + builder.addVertex(x1, y2, z1).setColor(red2, grn1, blu2, alpha); + + builder.addVertex(x2, y2, z1).setColor(red1, grn1, blu1, alpha); + builder.addVertex(x2, y1, z1).setColor(red1, grn1, blu1, alpha); + + builder.addVertex(x2, y1, z2).setColor(red1, grn1, blu1, alpha); + builder.addVertex(x2, y2, z2).setColor(red1, grn1, blu1, alpha); + + builder.addVertex(x1, y2, z2).setColor(red1, grn1, blu1, alpha); + builder.addVertex(x1, y1, z2).setColor(red1, grn1, blu1, alpha); + } + if (zthick) + { + builder.addVertex(x1, y1, z1).setColor(red2, grn2, blu1, alpha); + builder.addVertex(x1, y1, z2).setColor(red2, grn2, blu1, alpha); + + builder.addVertex(x1, y2, z2).setColor(red1, grn1, blu1, alpha); + builder.addVertex(x1, y2, z1).setColor(red1, grn1, blu1, alpha); + + builder.addVertex(x2, y2, z1).setColor(red1, grn1, blu1, alpha); + builder.addVertex(x2, y2, z2).setColor(red1, grn1, blu1, alpha); + + builder.addVertex(x2, y1, z2).setColor(red1, grn1, blu1, alpha); + builder.addVertex(x2, y1, z1).setColor(red1, grn1, blu1, alpha); } drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1)); } @@ -1062,7 +1112,7 @@ public class ShapesRenderer drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1)); } } - else + /* else { BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR); for (int i = 0; i <= num_steps180; i++) @@ -1074,7 +1124,7 @@ public class ShapesRenderer builder.addVertex(cx + x, cy, cz - z).setColor(red, grn, blu, alpha); } drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1)); - } + }*/ } else if (axis == Direction.Axis.X) @@ -1111,19 +1161,19 @@ public class ShapesRenderer drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1)); } } - else + /*else { - BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR); - for (int i = 0; i <= num_steps180; i++) + BufferBuilder builder = tesselator.begin(Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR); + for (int i = 0; i <= num_steps360+1; i++) { float theta = step * i; float y = r * Mth.cos(theta); float z = r * Mth.sin(theta); - builder.addVertex(cx, cy - y, cz + z).setColor(red, grn, blu, alpha); - builder.addVertex(cx, cy + y, cz - z).setColor(red, grn, blu, alpha); + builder.addVertex(cx, cy + y, cz + z).setColor(red, grn, blu, alpha); + //builder.addVertex(cx, cy + y, cz - z).setColor(red, grn, blu, alpha); } drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1)); - } + }*/ } else if (axis == Direction.Axis.Z) { @@ -1158,7 +1208,7 @@ public class ShapesRenderer drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1)); } } - else + /*else { BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR); for (int i = 0; i <= num_steps180; i++) @@ -1170,8 +1220,7 @@ public class ShapesRenderer builder.addVertex(cx - x, cy + y, cz).setColor(red, grn, blu, alpha); } drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1)); - } - + }*/ } } From 156fc7eb213098d24c9804f05184946e8f82e3a5 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Sat, 22 Mar 2025 15:17:18 +0100 Subject: [PATCH 077/232] improved explain, still hidden --- .../carpet/api/settings/SettingsManager.java | 3 +- .../java/carpet/script/CarpetExpression.java | 11 +- .../java/carpet/script/CarpetScriptHost.java | 16 +- .../carpet/script/CarpetScriptServer.java | 28 +-- src/main/java/carpet/script/Expression.java | 202 ++++++++++++++---- .../java/carpet/script/ScriptCommand.java | 71 +++--- src/main/java/carpet/script/ScriptHost.java | 10 +- src/main/java/carpet/script/Token.java | 5 + src/main/java/carpet/script/Tokenizer.java | 10 +- .../carpet/script/utils/AppStoreManager.java | 4 +- 10 files changed, 246 insertions(+), 114 deletions(-) diff --git a/src/main/java/carpet/api/settings/SettingsManager.java b/src/main/java/carpet/api/settings/SettingsManager.java index dc7637e2..2b4f341b 100644 --- a/src/main/java/carpet/api/settings/SettingsManager.java +++ b/src/main/java/carpet/api/settings/SettingsManager.java @@ -25,6 +25,7 @@ import java.util.function.Predicate; import java.util.stream.Collectors; import java.util.stream.Stream; +import carpet.script.Expression; import com.google.common.collect.Sets; import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.arguments.StringArgumentType; @@ -331,7 +332,7 @@ public class SettingsManager { { if (RuleHelper.getBooleanValue(rule) || (rule.type() == String.class && !rule.value().equals("false"))) { - CarpetServer.scriptServer.addScriptHost(source, rule.scarpetApp, s -> CommandHelper.canUseCommand(s, rule.value()), false, false, true, null); + CarpetServer.scriptServer.addScriptHost(source, rule.scarpetApp, s -> CommandHelper.canUseCommand(s, rule.value()), false, false, true, null, Expression.LoadOverride.DEFAULT); } else { CarpetServer.scriptServer.removeScriptHost(source, rule.scarpetApp, false, true); } diff --git a/src/main/java/carpet/script/CarpetExpression.java b/src/main/java/carpet/script/CarpetExpression.java index 466e9128..9ca41018 100644 --- a/src/main/java/carpet/script/CarpetExpression.java +++ b/src/main/java/carpet/script/CarpetExpression.java @@ -20,6 +20,7 @@ import carpet.script.value.Value; import net.minecraft.commands.CommandSourceStack; import net.minecraft.core.BlockPos; import net.minecraft.world.entity.Entity; +import org.apache.commons.lang3.tuple.Pair; import javax.annotation.Nullable; import java.util.List; @@ -93,8 +94,9 @@ public class CarpetExpression return scriptServer.events.handleEvents.getWhileDisabled(() -> this.expr.executeAndEvaluate( context, Vanilla.ScriptServer_scriptOptimizations(scriptServer.server), + host.loadOverrides, Vanilla.ScriptServer_scriptDebugging(scriptServer.server) ? CarpetScriptServer.LOG::info : null - ).getBoolean()); + ).getLeft().getBoolean()); } catch (ExpressionException e) { @@ -110,7 +112,7 @@ public class CarpetExpression } } - public Value scriptRunCommand(ScriptHost host, BlockPos pos) + public Pair scriptRunCommand(ScriptHost host, BlockPos pos) { CarpetScriptServer scriptServer = (CarpetScriptServer) host.scriptServer(); if (scriptServer.stopAll) @@ -137,6 +139,7 @@ public class CarpetExpression return scriptServer.events.handleEvents.getWhileDisabled(() -> this.expr.executeAndEvaluate( context, Vanilla.ScriptServer_scriptOptimizations(scriptServer.server), + host.loadOverrides, Vanilla.ScriptServer_scriptDebugging(scriptServer.server) ? CarpetScriptServer.LOG::info : null )); } @@ -154,7 +157,7 @@ public class CarpetExpression } } - public List explain(ScriptHost host, @Nullable String method, @Nullable String style, BlockPos pos) + public List explain(ScriptHost host, @Nullable String code, @Nullable String method, @Nullable String style, BlockPos pos) { CarpetScriptServer scriptServer = (CarpetScriptServer) host.scriptServer(); try @@ -174,7 +177,7 @@ public class CarpetExpression Value playerValue = new EntityValue(e).bindTo("p"); context.with("p", (cc, tt) -> playerValue); } - return scriptServer.events.handleEvents.getWhileDisabled(() -> this.expr.explain(context, method, style)); + return scriptServer.events.handleEvents.getWhileDisabled(() -> this.expr.explain(context, code, method, style)); } catch (ExpressionException e) { diff --git a/src/main/java/carpet/script/CarpetScriptHost.java b/src/main/java/carpet/script/CarpetScriptHost.java index a1091199..c9c0314d 100644 --- a/src/main/java/carpet/script/CarpetScriptHost.java +++ b/src/main/java/carpet/script/CarpetScriptHost.java @@ -78,9 +78,9 @@ public class CarpetScriptHost extends ScriptHost public AppStoreManager.StoreNode storeSource; boolean hasCommand; - private CarpetScriptHost(CarpetScriptServer server, @Nullable Module code, boolean perUser, ScriptHost parent, Map config, Map argTypes, Predicate commandValidator, boolean isRuleApp) + private CarpetScriptHost(CarpetScriptServer server, @Nullable Module code, boolean perUser, ScriptHost parent, Map config, Map argTypes, Predicate commandValidator, boolean isRuleApp, Expression.LoadOverride override) { - super(code, server, perUser, parent); + super(code, server, perUser, parent, override); this.saveTimeout = 0; persistenceRequired = true; if (parent == null && code != null) // app, not a global host @@ -99,9 +99,9 @@ public class CarpetScriptHost extends ScriptHost storeSource = null; } - public static CarpetScriptHost create(CarpetScriptServer scriptServer, @Nullable Module module, boolean perPlayer, CommandSourceStack source, Predicate commandValidator, boolean isRuleApp, AppStoreManager.StoreNode storeSource) + public static CarpetScriptHost create(CarpetScriptServer scriptServer, @Nullable Module module, boolean perPlayer, CommandSourceStack source, Predicate commandValidator, boolean isRuleApp, AppStoreManager.StoreNode storeSource, Expression.LoadOverride override) { - CarpetScriptHost host = new CarpetScriptHost(scriptServer, module, perPlayer, null, Collections.emptyMap(), new HashMap<>(), commandValidator, isRuleApp); + CarpetScriptHost host = new CarpetScriptHost(scriptServer, module, perPlayer, null, Collections.emptyMap(), new HashMap<>(), commandValidator, isRuleApp, override); // parse code and convert to expression if (module != null) { @@ -111,7 +111,7 @@ public class CarpetScriptHost extends ScriptHost CarpetExpression ex = new CarpetExpression(host.main, module.code(), source, new BlockPos(0, 0, 0)); ex.getExpr().asATextSource(); host.storeSource = storeSource; - ex.scriptRunCommand(host, BlockPos.containing(source.getPosition())); + host.root = ex.scriptRunCommand(host, BlockPos.containing(source.getPosition())).getRight(); } catch (CarpetExpressionException e) { @@ -132,6 +132,10 @@ public class CarpetScriptHost extends ScriptHost host.storeSource = null; } } + else + { + host.root = Expression.ExpressionNode.ofConstant(Value.NULL, new Token()); + } return host; } @@ -253,7 +257,7 @@ public class CarpetScriptHost extends ScriptHost @Override protected ScriptHost duplicate() { - return new CarpetScriptHost(scriptServer(), main, false, this, appConfig, appArgTypes, commandValidator, isRuleApp); + return new CarpetScriptHost(scriptServer(), main, false, this, appConfig, appArgTypes, commandValidator, isRuleApp, loadOverrides); } @Override diff --git a/src/main/java/carpet/script/CarpetScriptServer.java b/src/main/java/carpet/script/CarpetScriptServer.java index 5345ceae..6b79c557 100644 --- a/src/main/java/carpet/script/CarpetScriptServer.java +++ b/src/main/java/carpet/script/CarpetScriptServer.java @@ -121,7 +121,7 @@ public class CarpetScriptServer extends ScriptServer tickStart = 0L; stopAll = false; holyMoly = server.getCommands().getDispatcher().getRoot().getChildren().stream().map(CommandNode::getName).collect(Collectors.toSet()); - globalHost = CarpetScriptHost.create(this, null, false, null, p -> true, false, null); + globalHost = CarpetScriptHost.create(this, null, false, null, p -> true, false, null, Expression.LoadOverride.DEFAULT); } public void initializeForWorld() @@ -130,7 +130,7 @@ public class CarpetScriptServer extends ScriptServer { for (String moduleName : listAvailableModules(false)) { - addScriptHost(server.createCommandSourceStack(), moduleName, null, true, true, false, null); + addScriptHost(server.createCommandSourceStack(), moduleName, null, true, true, false, null, Expression.LoadOverride.DEFAULT); } } CarpetEventServer.Event.START.onTick(server); @@ -232,8 +232,8 @@ public class CarpetScriptServer extends ScriptServer return name == null ? globalHost : modules.get(name); } - public boolean addScriptHost(CommandSourceStack source, String name, @Nullable Predicate commandValidator, - boolean perPlayer, boolean autoload, boolean isRuleApp, AppStoreManager.StoreNode installer) + public int addScriptHost(CommandSourceStack source, String name, @Nullable Predicate commandValidator, + boolean perPlayer, boolean autoload, boolean isRuleApp, AppStoreManager.StoreNode installer, Expression.LoadOverride override) { Runnable token = Carpet.startProfilerSection("Scarpet load"); if (commandValidator == null) @@ -247,7 +247,7 @@ public class CarpetScriptServer extends ScriptServer { if (isRuleApp) { - return false; + return 0; } removeScriptHost(source, name, false, isRuleApp); reload = true; @@ -256,17 +256,17 @@ public class CarpetScriptServer extends ScriptServer if (module == null) { Carpet.Messenger_message(source, "r Failed to add " + name + " app: App not found"); - return false; + return 0; } CarpetScriptHost newHost; try { - newHost = CarpetScriptHost.create(this, module, perPlayer, source, commandValidator, isRuleApp, installer); + newHost = CarpetScriptHost.create(this, module, perPlayer, source, commandValidator, isRuleApp, installer, override); } catch (LoadException e) { Carpet.Messenger_message(source, "r Failed to add " + name + " app" + (e.getMessage() == null ? "" : ": " + e.getMessage())); - return false; + return 0; } modules.put(name, newHost); @@ -278,7 +278,7 @@ public class CarpetScriptServer extends ScriptServer if (autoload && !newHost.persistenceRequired) { removeScriptHost(source, name, false, false); - return false; + return 0; } String action = (installer != null) ? (reload ? "reinstalled" : "installed") : (reload ? "reloaded" : "loaded"); @@ -292,7 +292,7 @@ public class CarpetScriptServer extends ScriptServer if (isCommandAdded == null) // error should be dispatched { removeScriptHost(source, name, false, isRuleApp); - return false; + return 0; } else if (isCommandAdded) { @@ -330,7 +330,7 @@ public class CarpetScriptServer extends ScriptServer token.run(); long end = System.nanoTime(); LOG.info("App " + name + " loaded in " + (end - start) / 1000000 + " ms"); - return true; + return 1; } public boolean isInvalidCommandRoot(String appName) @@ -458,11 +458,11 @@ public class CarpetScriptServer extends ScriptServer } private record TransferData(boolean perUser, Predicate commandValidator, - boolean isRuleApp) + boolean isRuleApp, Expression.LoadOverride override) { private TransferData(CarpetScriptHost host) { - this(host.perUser, host.commandValidator, host.isRuleApp); + this(host.perUser, host.commandValidator, host.isRuleApp, host.loadOverrides); } } @@ -473,7 +473,7 @@ public class CarpetScriptServer extends ScriptServer apps.keySet().forEach(s -> removeScriptHost(server.createCommandSourceStack(), s, false, false)); CarpetEventServer.Event.clearAllBuiltinEvents(); init(); - apps.forEach((s, data) -> addScriptHost(server.createCommandSourceStack(), s, data.commandValidator, data.perUser, false, data.isRuleApp, null)); + apps.forEach((s, data) -> addScriptHost(server.createCommandSourceStack(), s, data.commandValidator, data.perUser, false, data.isRuleApp, null, data.override)); } public void reAddCommands() diff --git a/src/main/java/carpet/script/Expression.java b/src/main/java/carpet/script/Expression.java index 7150e02c..3105d295 100644 --- a/src/main/java/carpet/script/Expression.java +++ b/src/main/java/carpet/script/Expression.java @@ -36,6 +36,7 @@ import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.ObjectArrayList; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.tuple.Pair; import javax.annotation.Nullable; import java.math.BigInteger; @@ -95,6 +96,9 @@ public class Expression @Nullable private LazyValue ast = null; + @Nullable + private ExpressionNode root = null; + /** * script specific operatos and built-in functions */ @@ -1070,7 +1074,7 @@ public class Expression */ public Expression(String expression) { - this.expression = expression.stripTrailing().replaceAll("\\r\\n?", "\n").replaceAll("\\t", " "); + this.expression = stripExpression(expression); Operators.apply(this); ControlFlow.apply(this); Functions.apply(this); @@ -1084,6 +1088,11 @@ public class Expression } } + private String stripExpression(String expression) + { + return expression.stripTrailing().replaceAll("\\r\\n?", "\n").replaceAll("\\t", " "); + } + private List shuntingYard(Context c, List tokens) { @@ -1238,13 +1247,29 @@ public class Expression } } - public Value executeAndEvaluate(Context c, boolean optimize, @Nullable Consumer logger) + public enum LoadOverride { + DEFAULT("clean"), CANONICAL("canonical"), OPTIMIZED("optimized"), FUNCTIONAL("functional"), FUNCTIONAL_OPTIMIZED("functional_optimized"); + public String equivalent; + LoadOverride(String equivalent) { + this.equivalent = equivalent; + } + } + + public Pair executeAndEvaluate(Context c, boolean optimize, LoadOverride override, @Nullable Consumer logger) { if (ast == null) { - ast = getAST(c, optimize, logger); + boolean functions = false; + if (override != LoadOverride.DEFAULT) { + optimize = override == LoadOverride.OPTIMIZED || override == LoadOverride.FUNCTIONAL_OPTIMIZED; + functions = override == LoadOverride.FUNCTIONAL || override == LoadOverride.FUNCTIONAL_OPTIMIZED; + } + + Pair ret = getAST(c, optimize, functions, logger); + ast = ret.getRight(); + root = ret.getLeft(); } - return evaluatePartial(() -> ast, c, Context.Type.NONE); + return Pair.of(evaluatePartial(() -> ast, c, Context.Type.NONE), root); } public Value evaluatePartial(Supplier exprProvider, Context c, Context.Type expectedType) @@ -1301,30 +1326,30 @@ public class Expression return new ExpressionNode(new LazyValue.Constant(val), Collections.emptyList(), token); } - public List tokensRecursive(Expression expression) { + public List tokensRecursive(Expression expression, List reference, Map, List> referencePointers){ List tokens = new ArrayList<>(); switch (token.type) { case FUNCTION -> { tokens.add(token); - tokens.add(token.morphedInto(Token.TokenType.OPEN_PAREN, "(")); + tokens.add(findToken(token, Token.TokenType.OPEN_PAREN, "(", reference, referencePointers)); if (!args.isEmpty()) { for (ExpressionNode arg : args) { - List argTokens = arg.tokensRecursive(expression); + List argTokens = arg.tokensRecursive(expression, reference, referencePointers); tokens.addAll(argTokens); - tokens.add(argTokens.getLast().morphedInto(Token.TokenType.COMMA, ",").disguiseAs(", ", null)); + tokens.add(findToken(argTokens.getLast(), Token.TokenType.COMMA, ",", reference, referencePointers).disguiseAs(", ", null)); } tokens.removeLast(); } - tokens.add(tokens.getLast().morphedInto(Token.TokenType.CLOSE_PAREN, ")")); + tokens.add(findToken(tokens.getLast(), Token.TokenType.CLOSE_PAREN, ")", reference, referencePointers)); } case OPERATOR -> { - tokens.addAll(createOperatorArgumentTokens(expression, args.get(0))); - tokens.add(token.disguiseAs(" "+token.surface+" ", null)); - tokens.addAll(createOperatorArgumentTokens(expression, args.get(1))); + tokens.addAll(createOperatorArgumentTokens(expression, args.get(0), reference, referencePointers)); + tokens.add(token.disguiseAs(token.surface.equals(";") ? (token.surface+" ") : (" "+token.surface+" "), null)); + tokens.addAll(createOperatorArgumentTokens(expression, args.get(1), reference, referencePointers)); } case UNARY_OPERATOR -> { tokens.add(token.disguiseAs(" "+StringUtils.chop(token.surface),null)); - tokens.addAll(createOperatorArgumentTokens(expression, args.get(0))); + tokens.addAll(createOperatorArgumentTokens(expression, args.get(0), reference, referencePointers)); } case VARIABLE, LITERAL, HEX_LITERAL, CONSTANT -> tokens.add(token); case STRINGPARAM -> tokens.add(token.disguiseAs("'"+token.surface+"'", null)); @@ -1336,7 +1361,29 @@ public class Expression return tokens; } - public List createOperatorArgumentTokens(Expression expression, ExpressionNode operand) { + public Token findToken(Token previous, Token.TokenType type, String expectedSurface, List reference, Map, List> referencePointers) + { + List indices = referencePointers.get(Pair.of(previous.lineno, previous.linepos)); + if (indices == null) + { + return previous.morphedInto(type, expectedSurface); + } + for (int index : indices) + { + if (index + 1 == reference.size()) + { + continue; + } + Token token = reference.get(index + 1); + if (token.type == type) + { + return token.morphedInto(type, expectedSurface); + } + } + return previous.morphedInto(type, expectedSurface); + } + + public List createOperatorArgumentTokens(Expression expression, ExpressionNode operand, List reference, Map, List> referencePointers) { boolean needsBrackets = false; var operators = expression.operators; if (operators.containsKey(operand.token.surface) && operators.containsKey(token.surface)) { @@ -1344,15 +1391,15 @@ public class Expression needsBrackets = true; } } - List argumentTokens = operand.tokensRecursive(expression); + List argumentTokens = operand.tokensRecursive(expression, reference, referencePointers); if (!needsBrackets) { return argumentTokens; } List bracketed = new ArrayList<>(); - bracketed.add(argumentTokens.getFirst().morphedInto(Token.TokenType.OPEN_PAREN, "(")); + bracketed.add(findToken(argumentTokens.getFirst(), Token.TokenType.OPEN_PAREN, "(", reference, referencePointers)); bracketed.get(0).swapPlace(argumentTokens.getFirst()); bracketed.addAll(argumentTokens); - bracketed.add(argumentTokens.getLast().morphedInto(Token.TokenType.CLOSE_PAREN, ")")); + bracketed.add(findToken(argumentTokens.getLast(), Token.TokenType.CLOSE_PAREN, ")", reference, referencePointers)); return bracketed; } } @@ -1367,24 +1414,32 @@ public class Expression case UNARY_OPERATOR -> { ExpressionNode node = nodeStack.pop(); LazyValue result = (c, t) -> operators.get(token.surface).lazyEval(c, t, this, token, node.op, null).evalValue(c, t); - nodeStack.push(new ExpressionNode(result, Collections.singletonList(node), token)); + ExpressionNode newNode = new ExpressionNode(result, Collections.singletonList(node), token); + token.node = newNode; + nodeStack.push(newNode); } case OPERATOR -> { ExpressionNode v1 = nodeStack.pop(); ExpressionNode v2 = nodeStack.pop(); LazyValue result = (c, t) -> operators.get(token.surface).lazyEval(c, t, this, token, v2.op, v1.op).evalValue(c, t); - nodeStack.push(new ExpressionNode(result, List.of(v2, v1), token)); + ExpressionNode newNode = new ExpressionNode(result, List.of(v2, v1), token); + token.node = newNode; + nodeStack.push(newNode); } case VARIABLE -> { Value constant = getConstantFor(token.surface); if (constant != null) { token.morph(Token.TokenType.CONSTANT, token.surface); - nodeStack.push(new ExpressionNode(LazyValue.ofConstant(constant), Collections.emptyList(), token)); + ExpressionNode newNode = new ExpressionNode(LazyValue.ofConstant(constant), Collections.emptyList(), token); + token.node = newNode; + nodeStack.push(newNode); } else { - nodeStack.push(new ExpressionNode(((c, t) -> getOrSetAnyVariable(c, token.surface).evalValue(c, t)), Collections.emptyList(), token)); + ExpressionNode newNode = new ExpressionNode(((c, t) -> getOrSetAnyVariable(c, token.surface).evalValue(c, t)), Collections.emptyList(), token); + token.node = newNode; + nodeStack.push(newNode); } } case FUNCTION -> { @@ -1419,12 +1474,17 @@ public class Expression nodeStack.pop(); } List params = p.stream().map(n -> n.op).collect(Collectors.toList()); - nodeStack.push(new ExpressionNode( + ExpressionNode newNode = new ExpressionNode( (c, t) -> f.lazyEval(c, t, this, token, params).evalValue(c, t), p, token - )); + ); + token.node = newNode; + nodeStack.push(newNode); + } + case OPEN_PAREN -> { + token.node = ExpressionNode.PARAMS_START; + nodeStack.push(ExpressionNode.PARAMS_START); } - case OPEN_PAREN -> nodeStack.push(ExpressionNode.PARAMS_START); case LITERAL -> { Value number; try @@ -1436,11 +1496,15 @@ public class Expression throw new ExpressionException(context, this, token, "Not a number"); } //token.morph(Token.TokenType.CONSTANT, token.surface); - nodeStack.push(ExpressionNode.ofConstant(number, token)); + ExpressionNode newNode = ExpressionNode.ofConstant(number, token); + token.node = newNode; + nodeStack.push(newNode); } case STRINGPARAM -> { //token.morph(Token.TokenType.CONSTANT, token.surface); - nodeStack.push(ExpressionNode.ofConstant(new StringValue(token.surface), token)); + ExpressionNode newNode = ExpressionNode.ofConstant(new StringValue(token.surface), token); + token.node = newNode; + nodeStack.push(newNode); } case HEX_LITERAL -> { Value hexNumber; @@ -1453,7 +1517,9 @@ public class Expression throw new ExpressionException(context, this, token, "Not a number"); } //token.morph(Token.TokenType.CONSTANT, token.surface); - nodeStack.push(ExpressionNode.ofConstant(hexNumber, token)); + ExpressionNode newNode = ExpressionNode.ofConstant(hexNumber, token); + token.node = newNode; + nodeStack.push(newNode); } default -> throw new ExpressionException(context, this, token, "Unexpected token '" + token.surface + "'"); } @@ -1461,7 +1527,7 @@ public class Expression return nodeStack.pop(); } - private LazyValue getAST(Context context, boolean optimize, @Nullable Consumer logger) + private Pair getAST(Context context, boolean optimize, boolean functional, @Nullable Consumer logger) { Tokenizer tokenizer = new Tokenizer(context, this, expression, allowComments, allowNewlineSubstitutions); // stripping lousy but acceptable semicolons @@ -1470,19 +1536,22 @@ public class Expression List rpn = shuntingYard(context, cleanedTokens); validate(context, rpn); ExpressionNode root = RPNToParseTree(rpn, context); - if (!optimize) + if (!optimize && !functional) { - return root.op; + return Pair.of(root, root.op); } Context optimizeOnlyContext = new Context.ContextForErrorReporting(context); // flipping to full functional representation makes it little underperforming, might be related // to the fact that operators are running from a bigger pool or function execution is slower - optimizeTree(root, optimizeOnlyContext, logger, false); - return extractOp(optimizeOnlyContext, root, Context.Type.NONE); + optimizeTree(root, optimizeOnlyContext, logger, optimize, functional); + if (!optimize) { + return Pair.of(root, root.op); + } + return Pair.of(root, extractOp(optimizeOnlyContext, root, Context.Type.NONE)); } - private void optimizeTree(ExpressionNode root, Context optimizeOnlyContext, @Nullable Consumer logger, boolean toFunctional) { + private void optimizeTree(ExpressionNode root, Context optimizeOnlyContext, @Nullable Consumer logger, boolean optimize, boolean toFunctional) { if (logger != null) { logger.accept("Input code size for " + getModuleName() + ": " + treeSize(root) + " nodes, " + treeDepth(root) + " deep"); @@ -1503,7 +1572,7 @@ public class Expression prevTreeSize = treeSize(root); prevTreeDepth = treeDepth(root); } - boolean optimized = compactTree(root, Context.Type.NONE, 0, logger, toFunctional); + boolean optimized = compactTree(root, Context.Type.NONE, 0, logger, optimize, toFunctional); if (!optimized) { break; @@ -1514,7 +1583,7 @@ public class Expression logger.accept("Compacted from " + prevTreeSize + " nodes, " + prevTreeDepth + " code depth to " + treeSize(root) + " nodes, " + treeDepth(root) + " code depth"); } } - while (true) + while (optimize) { if (logger != null) { @@ -1535,10 +1604,48 @@ public class Expression } } - public List explain(Context context, @Nullable String method, @Nullable String style) + public List explain(Context context, @Nullable String code, @Nullable String method, @Nullable String style) { + if (code == null) + { + ExpressionNode node; + if (method != null) + { + FunctionValue function = context.host.getFunction(method); + if (function == null) { + throw new ExpressionException(context, this, "Unknown function " + method); + } + node = function.getToken().node; + if (node == null) { + throw new ExpressionException(context, this, "Function " + method + " is not a compiled function"); + } + } else + { + node = context.host.root; + } + if (node == null || node.token.type == null) { + throw new ExpressionException(context, this, "No code to explain"); + } + + // grab source reference + Tokenizer tokenizer = new Tokenizer(context, this, context.host.main == null ? "" : stripExpression(context.host.main.code()) , true, true); + List input = tokenizer.parseTokens(); + List cleanedTokens = Tokenizer.postProcess(input); + + Map, List> tokenPointers = new HashMap<>(); + for (int i = 0; i < cleanedTokens.size(); i++) { + Token token = cleanedTokens.get(i); + tokenPointers.computeIfAbsent(Pair.of(token.lineno, token.linepos), k -> new ArrayList<>()).add(i); + } + + return node.tokensRecursive(this, cleanedTokens, tokenPointers); + } + if (style == null) { + style = context.host.loadOverrides.equivalent; + } + //todo convert to explain - Tokenizer tokenizer = new Tokenizer(context, this, expression, true, true); + Tokenizer tokenizer = new Tokenizer(context, this, stripExpression(code), true, true); // stripping lousy but acceptable semicolons List input = tokenizer.parseTokens(); if (style.equalsIgnoreCase("raw")) { @@ -1552,15 +1659,22 @@ public class Expression List rpn = shuntingYard(context, cleanedTokens); validate(context, rpn); ExpressionNode root = RPNToParseTree(rpn, context); - List parsedTokens = root.tokensRecursive(this); + + Map, List> tokenPointers = new HashMap<>(); + for (int i = 0; i < cleanedTokens.size(); i++) { + Token token = cleanedTokens.get(i); + tokenPointers.computeIfAbsent(Pair.of(token.lineno, token.linepos), k -> new ArrayList<>()).add(i); + } + + List parsedTokens = root.tokensRecursive(this, cleanedTokens, tokenPointers); if (style.equalsIgnoreCase("canonical")) { return parsedTokens; } Context optimizeOnlyContext = new Context.ContextForErrorReporting(context); // pure functional - optimizeTree(root, optimizeOnlyContext, null, style.equalsIgnoreCase("functional")); - List compileTimeOptimized = root.tokensRecursive(this); + optimizeTree(root, optimizeOnlyContext, null, style.contains("optimized"), style.contains("functional")); + List compileTimeOptimized = root.tokensRecursive(this, cleanedTokens, tokenPointers); return compileTimeOptimized; } @@ -1576,7 +1690,7 @@ public class Expression } - private boolean compactTree(ExpressionNode node, Context.Type expectedType, int indent, @Nullable Consumer logger, boolean toFunctional) + private boolean compactTree(ExpressionNode node, Context.Type expectedType, int indent, @Nullable Consumer logger, boolean optimize, boolean toFunctional) { // ctx is just to report errors, not values evaluation boolean optimized = false; @@ -1596,13 +1710,13 @@ public class Expression Context.Type requestedType = operation.staticType(expectedType); for (ExpressionNode arg : node.args) { - if (compactTree(arg, requestedType, indent + 1, logger, toFunctional)) + if (compactTree(arg, requestedType, indent + 1, logger, optimize, toFunctional)) { optimized = true; } } - if (expectedType != Context.Type.MAPDEF && symbol.equals("->") && node.args.size() == 2) + if (optimize && expectedType != Context.Type.MAPDEF && (symbol.equals("->") || symbol.equals("define") ) && node.args.size() == 2) { String rop = node.args.get(1).token.surface; ExpressionNode returnNode = null; @@ -1648,7 +1762,7 @@ public class Expression { String operator = pair.getKey(); String function = pair.getValue(); - if ((symbol.equals(operator) || symbol.equals(function)) && !node.args.isEmpty()) + if (optimize && (symbol.equals(operator) || symbol.equals(function)) && !node.args.isEmpty()) { boolean leftOptimizable = operators.get(operator).isLeftAssoc(); ExpressionNode optimizedChild = node.args.get(leftOptimizable ? 0 : (node.args.size() - 1)); diff --git a/src/main/java/carpet/script/ScriptCommand.java b/src/main/java/carpet/script/ScriptCommand.java index 0b0a84ee..202a6bab 100644 --- a/src/main/java/carpet/script/ScriptCommand.java +++ b/src/main/java/carpet/script/ScriptCommand.java @@ -294,18 +294,18 @@ public class ScriptCommand LiteralArgumentBuilder a = literal("load").requires(Vanilla::ServerPlayer_canScriptACE). then(argument("app", StringArgumentType.word()). suggests((cc, bb) -> suggest(ss(cc).listAvailableModules(true), bb)). - executes((cc) -> - { - boolean success = ss(cc).addScriptHost(cc.getSource(), StringArgumentType.getString(cc, "app"), null, true, false, false, null); - return success ? 1 : 0; - }). + executes((cc) -> ss(cc).addScriptHost(cc.getSource(), StringArgumentType.getString(cc, "app"), null, true, false, false, null, Expression.LoadOverride.DEFAULT)). + //then(literal("canonical").executes((cc) -> ss(cc).addScriptHost(cc.getSource(), StringArgumentType.getString(cc, "app"), null, true, false, false, null, Expression.LoadOverride.CANONICAL))). + //then(literal("optimized").executes((cc) -> ss(cc).addScriptHost(cc.getSource(), StringArgumentType.getString(cc, "app"), null, true, false, false, null, Expression.LoadOverride.OPTIMIZED))). + //then(literal("functional").executes((cc) -> ss(cc).addScriptHost(cc.getSource(), StringArgumentType.getString(cc, "app"), null, true, false, false, null, Expression.LoadOverride.FUNCTIONAL))). + //then(literal("functional_optimized").executes((cc) -> ss(cc).addScriptHost(cc.getSource(), StringArgumentType.getString(cc, "app"), null, true, false, false, null, Expression.LoadOverride.FUNCTIONAL_OPTIMIZED))). then(literal("global"). - executes((cc) -> - { - boolean success = ss(cc).addScriptHost(cc.getSource(), StringArgumentType.getString(cc, "app"), null, false, false, false, null); - return success ? 1 : 0; - } - ) + executes((cc) -> ss(cc).addScriptHost(cc.getSource(), StringArgumentType.getString(cc, "app"), null, false, false, false, null, Expression.LoadOverride.DEFAULT)) + //. + //then(literal("canonical").executes((cc) -> ss(cc).addScriptHost(cc.getSource(), StringArgumentType.getString(cc, "app"), null, false, false, false, null, Expression.LoadOverride.CANONICAL))). + //then(literal("optimized").executes((cc) -> ss(cc).addScriptHost(cc.getSource(), StringArgumentType.getString(cc, "app"), null, false, false, false, null, Expression.LoadOverride.OPTIMIZED))). + //then(literal("functional").executes((cc) -> ss(cc).addScriptHost(cc.getSource(), StringArgumentType.getString(cc, "app"), null, false, false, false, null, Expression.LoadOverride.FUNCTIONAL))). + //then(literal("functional_optimized").executes((cc) -> ss(cc).addScriptHost(cc.getSource(), StringArgumentType.getString(cc, "app"), null, false, false, false, null, Expression.LoadOverride.FUNCTIONAL_OPTIMIZED))) ) ); LiteralArgumentBuilder f = literal("unload").requires(Vanilla::ServerPlayer_canScriptACE). @@ -366,25 +366,24 @@ public class ScriptCommand })); LiteralArgumentBuilder x = literal("explain").requires(Vanilla::ServerPlayer_canScriptACE). - then(argument("style", StringArgumentType.word()).suggests((cc, bb) -> suggest(List.of("raw", "clean", "functional", "canonical", "optimized"), bb)). - executes((cc) -> explain( - cc, - null, null, StringArgumentType.getString(cc, "style"))). - then(literal("run").then(argument("expr", StringArgumentType.greedyString()).suggests(ScriptCommand::suggestCode). - executes((cc) -> explain( - cc, - StringArgumentType.getString(cc, "expr"), null, StringArgumentType.getString(cc, "style"))))). + executes((cc) -> explain(cc, null, null, null)). + then(literal("expression"). + then(argument("style", StringArgumentType.word()).suggests((cc, bb) -> suggest(List.of("raw", "clean", "functional", "canonical", "optimized", "functional_optimized"), bb)). + then(argument("expr", StringArgumentType.greedyString()).suggests(ScriptCommand::suggestCode). + executes((cc) -> explain(cc, StringArgumentType.getString(cc, "expr"), null, StringArgumentType.getString(cc, "style"))) + ) + ) + ). then(literal("invoke"). then(argument("call", StringArgumentType.word()).suggests((cc, bb) -> suggest(suggestFunctionCalls(cc), bb)). - executes((cc) -> explain( - cc, - null, - StringArgumentType.getString(cc, "call"), - StringArgumentType.getString(cc, "style") - )) + executes((cc) -> explain(cc, null, StringArgumentType.getString(cc, "call"), null)) ) - ) - ); + ). + then(literal("source"). + then(argument("style", StringArgumentType.word()).suggests((cc, bb) -> suggest(List.of("raw", "clean", "functional", "canonical", "optimized", "functional_optimized"), bb)). + executes((cc) -> explain(cc, null, null, StringArgumentType.getString(cc, "style"))) + ) + ); dispatcher.register(literal("script"). requires(Vanilla::ServerPlayer_canScriptGeneral). @@ -559,17 +558,19 @@ public class ScriptCommand CarpetScriptHost host = getHost(context); return handleCall(source, host, () -> { CarpetExpression ex = new CarpetExpression(host.main, expr, source, new BlockPos(0, 0, 0)); - return ex.scriptRunCommand(host, BlockPos.containing(source.getPosition())); + return ex.scriptRunCommand(host, BlockPos.containing(source.getPosition())).getLeft(); }); } - private static int explain(CommandContext context, @Nullable String expr, @Nullable String method, String style) throws CommandSyntaxException + private static int explain(CommandContext context, @Nullable String expr, @Nullable String method, @Nullable String style) throws CommandSyntaxException { CommandSourceStack source = context.getSource(); CarpetScriptHost host = getHost(context); return handleCall(source, host, () -> { - CarpetExpression ex = new CarpetExpression(host.main, expr == null ? ( host.main == null ? "" : host.main.code() ) : expr, source, BlockPos.ZERO); - List results = ex.explain(host, method, style, BlockPos.containing(source.getPosition())); + // expression is irrelevant as we pass approprirate strings for parsing directly + // we only really need access to operators and functions? + CarpetExpression ex = new CarpetExpression(host.main, "", source, BlockPos.ZERO); + List results = ex.explain(host, expr != null ? expr : (style != null? (host.main != null ? host.main.code() : "") :null), method, style, BlockPos.containing(source.getPosition())); prettyPrintTokens(source, results); return NumericValue.of(results.size()); }); @@ -584,6 +585,7 @@ public class ScriptCommand } List lines = new ArrayList<>(indents.keySet()); Collections.sort(lines); + int lineMax = String.valueOf(lines.getLast()).length(); Deque indentsStack = new ArrayDeque<>(lines); List elements = new ArrayList<>(); @@ -609,7 +611,8 @@ public class ScriptCommand } int lastPos = indents.getOrDefault(token.lineno, 0); - elements.add(Carpet.Messenger_compose("w " + " ".repeat(lastPos))); + elements.add(Carpet.Messenger_compose("fi " + " ".repeat(lineMax - String.valueOf(token.lineno).length()) + token.lineno)); + elements.add(Carpet.Messenger_compose("g | " + " ".repeat(lastPos))); } elements.add(tokenToComponent(token)); } @@ -625,7 +628,7 @@ public class ScriptCommand } if (token.comment.isEmpty()) { - return Carpet.Messenger_compose(styleForToken(token) + " " + surface); + return Carpet.Messenger_compose(styleForToken(token) + " " + surface);//, "^gi " + String.format("%s: line %s, pos %s", token.surface, token.lineno, token.linepos)); } return Carpet.Messenger_compose(styleForToken(token)+"u " + surface, "^gi " + token.comment); } @@ -642,7 +645,7 @@ public class ScriptCommand case Token.TokenType.VARIABLE -> "y"; case Token.TokenType.STRINGPARAM -> "c"; default -> // marker - "f"; + "r"; }; } diff --git a/src/main/java/carpet/script/ScriptHost.java b/src/main/java/carpet/script/ScriptHost.java index d067d2ab..4dd06d5f 100644 --- a/src/main/java/carpet/script/ScriptHost.java +++ b/src/main/java/carpet/script/ScriptHost.java @@ -37,6 +37,9 @@ public abstract class ScriptHost private final ScriptServer scriptServer; protected boolean inTermination = false; public boolean strict; + public Expression.LoadOverride loadOverrides; + @Nullable + public Expression.ExpressionNode root; private final Set deprecations = new HashSet<>(); @@ -143,13 +146,14 @@ public abstract class ScriptHost public ErrorSnooper errorSnooper = null; - protected ScriptHost(@Nullable Module code, ScriptServer scriptServer, boolean perUser, ScriptHost parent) + protected ScriptHost(@Nullable Module code, ScriptServer scriptServer, boolean perUser, ScriptHost parent, Expression.LoadOverride loadOverrides) { this.parent = parent; this.main = code; this.perUser = perUser; this.user = null; this.strict = false; + this.loadOverrides = loadOverrides; this.scriptServer = scriptServer; ModuleData moduleData = new ModuleData(code); initializeModuleGlobals(moduleData); @@ -231,6 +235,7 @@ public abstract class ScriptHost protected abstract void runModuleCode(Context c, Module module); // this should be shell out in the executor + @Nullable public FunctionValue getFunction(String name) { return getFunction(main, name); @@ -253,6 +258,7 @@ public abstract class ScriptHost return ret; } + @Nullable private FunctionValue getFunction(Module module, String name) { ModuleData local = getModuleData(module); @@ -286,6 +292,7 @@ public abstract class ScriptHost return target.globalFunctions.get(name); } + @Nullable private ModuleData findModuleDataFromFunctionImports(String name, ModuleData source, int ttl) { if (ttl > 64) @@ -460,6 +467,7 @@ public abstract class ScriptHost this.moduleData.forEach((key, value) -> host.moduleData.put(key, new ModuleData(key, value))); // fixing imports host.moduleData.forEach((module, data) -> data.setImportsBasedOn(host, this.moduleData.get(data.parent))); + host.root = this.root; } public synchronized void handleExpressionException(String msg, ExpressionException exc) diff --git a/src/main/java/carpet/script/Token.java b/src/main/java/carpet/script/Token.java index adce7e0e..c0fa53e8 100644 --- a/src/main/java/carpet/script/Token.java +++ b/src/main/java/carpet/script/Token.java @@ -35,6 +35,10 @@ public class Token implements Comparable { public int ordinal = 0; public int linepos; public int lineno; + + @Nullable + public Expression.ExpressionNode node = null; + public static final Token NONE = new Token(); public Token morphedInto(TokenType newType, String newSurface) { @@ -44,6 +48,7 @@ public class Token implements Comparable { created.pos = pos; created.linepos = linepos; created.lineno = lineno; + created.node = node; created.ordinal = ordinal + 1; return created; } diff --git a/src/main/java/carpet/script/Tokenizer.java b/src/main/java/carpet/script/Tokenizer.java index abd3e4fa..75fd2646 100644 --- a/src/main/java/carpet/script/Tokenizer.java +++ b/src/main/java/carpet/script/Tokenizer.java @@ -388,14 +388,8 @@ public class Tokenizer else { token.type = Token.TokenType.OPERATOR; - if (token.surface.equals(";")) - { - token.disguiseAs(token.surface + " ", null); - } - else - { - token.disguiseAs(" " + token.surface + " ", null); - } + token.disguiseAs(token.surface.equals(";") ? (token.surface + " ") : (" " + token.surface + " "), null); + } } if (expression != null && context != null && previousToken != null && diff --git a/src/main/java/carpet/script/utils/AppStoreManager.java b/src/main/java/carpet/script/utils/AppStoreManager.java index 963cd549..f7536faa 100644 --- a/src/main/java/carpet/script/utils/AppStoreManager.java +++ b/src/main/java/carpet/script/utils/AppStoreManager.java @@ -2,6 +2,7 @@ package carpet.script.utils; import carpet.script.CarpetScriptHost; import carpet.script.CarpetScriptServer; +import carpet.script.Expression; import carpet.script.exception.InternalExpressionException; import carpet.script.external.Carpet; import carpet.script.external.Vanilla; @@ -283,8 +284,7 @@ public class AppStoreManager { return 0; } - boolean success = Vanilla.MinecraftServer_getScriptServer(source.getServer()).addScriptHost(source, nodeInfo.name().replaceFirst("\\.sc$", ""), null, true, false, false, nodeInfo.source()); - return success ? 1 : 0; + return Vanilla.MinecraftServer_getScriptServer(source.getServer()).addScriptHost(source, nodeInfo.name().replaceFirst("\\.sc$", ""), null, true, false, false, nodeInfo.source(), Expression.LoadOverride.DEFAULT); } /** From 0e13f5510a66ce3d758e5187d20e9cb276ed0aa2 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Sat, 22 Mar 2025 15:26:43 +0100 Subject: [PATCH 078/232] 1.21.5-rc1 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 4b5268ba..6f99e547 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=1.21.5-pre2 + minecraft_version=1.21.5-rc1 loader_version=0.16.10 jsr305_version=3.0.2 fabric_version=0.110.5+1.21.4 From 1478154bc7cbd5b939fe3a180da1f78e71d0e5b4 Mon Sep 17 00:00:00 2001 From: gnembon Date: Tue, 25 Mar 2025 20:06:46 +0100 Subject: [PATCH 079/232] 1.21.5 --- gradle.properties | 6 +++--- src/main/java/carpet/script/ScriptCommand.java | 2 +- src/main/resources/fabric.mod.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gradle.properties b/gradle.properties index 6f99e547..8ca118c6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,10 +3,10 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=1.21.5-rc1 + minecraft_version=1.21.5 loader_version=0.16.10 jsr305_version=3.0.2 - fabric_version=0.110.5+1.21.4 + fabric_version=0.119.5+1.21.5 # Mod Properties mod_version = 1.4.168 @@ -17,7 +17,7 @@ org.gradle.jvmargs=-Xmx1G # The Curseforge versions "names" or ids for the main branch (comma separated: 1.16.4,1.16.5) # This is needed because CF uses too vague names for prereleases and release candidates # Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN] - release-curse-versions = Minecraft 1.21:1.21.5-Snapshot + release-curse-versions = Minecraft 1.21:1.21.5 # Whether or not to build another branch on release release-extra-branch = false # The name of the second branch to release diff --git a/src/main/java/carpet/script/ScriptCommand.java b/src/main/java/carpet/script/ScriptCommand.java index 202a6bab..5c73f6b1 100644 --- a/src/main/java/carpet/script/ScriptCommand.java +++ b/src/main/java/carpet/script/ScriptCommand.java @@ -653,7 +653,7 @@ public class ScriptCommand { if (!elements.isEmpty()) { - Carpet.Messenger_message(source, elements.toArray(new Component[0])); + Carpet.Messenger_message(source, (Object []) elements.toArray(new Component[0])); elements.clear(); } } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index bc2c8040..30c160a0 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -33,7 +33,7 @@ "accessWidener" : "carpet.accesswidener", "depends": { - "minecraft": ">1.21.4", + "minecraft": ">=1.21.5", "fabricloader": ">=0.16.10", "java": ">=21" } From 7964cdccc2536423d851fe2a46bed01b8ad3f8f4 Mon Sep 17 00:00:00 2001 From: gnembon Date: Tue, 25 Mar 2025 20:07:07 +0100 Subject: [PATCH 080/232] 1.4.169 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 8ca118c6..eaab5f75 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G fabric_version=0.119.5+1.21.5 # Mod Properties - mod_version = 1.4.168 + mod_version = 1.4.169 maven_group = carpet archives_base_name = fabric-carpet From 5d21d50b8bc692e129e26716ef4b3397e90d592a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 25 Mar 2025 19:24:49 +0000 Subject: [PATCH 081/232] Merge docs for 'Carpet Mod 1.4.169 for Minecraft 1.21.5' --- docs/scarpet/Full.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/scarpet/Full.md b/docs/scarpet/Full.md index c52f2aa5..e59a94f0 100644 --- a/docs/scarpet/Full.md +++ b/docs/scarpet/Full.md @@ -5343,7 +5343,7 @@ clients will actually be able to receive (they may have more available via resou Renders a cloud of particles `name` centered around `pos` position, by default `count` 10 of them, default `speed` of 0, and to all players nearby, but these options can be changed via optional arguments. Follow vanilla `/particle` command on details on those options. Valid particle names are -for example `'angry_villager', 'item diamond', 'block stone', 'dust 0.8 0.1 0.1 4'`. +for example `'angry_villager', 'item diamond', 'block stone', 'dust{"scale": 4, "color": [0.8, 0.1, 0.1]}'`. Used with no arguments, return the list of available particle names. Note that some of the names do not correspond to a valid particle that can be fed to `particle(...)` function due to a fact that some particles need more configuration From 77603e16e9b52856a9abffa9abc9a8210340874e Mon Sep 17 00:00:00 2001 From: gnembon Date: Sun, 6 Apr 2025 00:57:01 +0200 Subject: [PATCH 082/232] crash gently with malformed itemstack data --- src/main/java/carpet/script/api/WorldAccess.java | 4 ++-- src/main/java/carpet/script/utils/ShapeDispatcher.java | 4 ++-- src/main/java/carpet/script/value/NBTSerializableValue.java | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/carpet/script/api/WorldAccess.java b/src/main/java/carpet/script/api/WorldAccess.java index bf000265..8dac488b 100644 --- a/src/main/java/carpet/script/api/WorldAccess.java +++ b/src/main/java/carpet/script/api/WorldAccess.java @@ -888,7 +888,7 @@ public class WorldAccess ItemStack tool; if (tag != null) { - tool = ItemStack.CODEC.parse(regs.createSerializationContext(NbtOps.INSTANCE), tag).result().orElse(null); + tool = ItemStack.CODEC.parse(regs.createSerializationContext(NbtOps.INSTANCE), tag).getOrThrow(s -> new InternalExpressionException("Failed to parse item stack data: " + s)); } else { @@ -956,7 +956,7 @@ public class WorldAccess { return Value.NULL; } - return new NBTSerializableValue(() -> ItemStack.CODEC.encodeStart(regs.createSerializationContext(NbtOps.INSTANCE), tool).getOrThrow()); + return new NBTSerializableValue(() -> ItemStack.CODEC.encodeStart(regs.createSerializationContext(NbtOps.INSTANCE), tool).getOrThrow(s -> new InternalExpressionException("Failed to parse item stack data: " + s))); }); diff --git a/src/main/java/carpet/script/utils/ShapeDispatcher.java b/src/main/java/carpet/script/utils/ShapeDispatcher.java index 1251a4e0..12e1ed2e 100644 --- a/src/main/java/carpet/script/utils/ShapeDispatcher.java +++ b/src/main/java/carpet/script/utils/ShapeDispatcher.java @@ -726,7 +726,7 @@ public class ShapeDispatcher } else { - this.item = ItemStack.CODEC.parse(regs.createSerializationContext(NbtOps.INSTANCE), ((NBTSerializableValue) options.get("item")).getCompoundTag() ).result().orElse(null); + this.item = ItemStack.CODEC.parse(regs.createSerializationContext(NbtOps.INSTANCE), ((NBTSerializableValue) options.get("item")).getCompoundTag() ).getOrThrow(s -> new InternalExpressionException("Failed to parse item stack data: " + s)); } blockLight = NumericValue.asNumber(options.getOrDefault("blocklight", optional.get("blocklight"))).getInt(); if (blockLight > 15) @@ -1663,7 +1663,7 @@ public class ShapeDispatcher public Value validate(Map options, MinecraftServer server, Value value) { ItemStack item = ValueConversions.getItemStackFromValue(value, true, server.registryAccess()); - return new NBTSerializableValue(ItemStack.CODEC.encodeStart(server.registryAccess().createSerializationContext(NbtOps.INSTANCE), item).result().orElse(null)); + return new NBTSerializableValue(ItemStack.CODEC.encodeStart(server.registryAccess().createSerializationContext(NbtOps.INSTANCE), item).getOrThrow(s -> new InternalExpressionException("Failed to parse item stack data: " + s))); } @Override diff --git a/src/main/java/carpet/script/value/NBTSerializableValue.java b/src/main/java/carpet/script/value/NBTSerializableValue.java index 82017897..ecb9e7d9 100644 --- a/src/main/java/carpet/script/value/NBTSerializableValue.java +++ b/src/main/java/carpet/script/value/NBTSerializableValue.java @@ -109,7 +109,7 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa public static Value fromStack(ItemStack stack, RegistryAccess regs) { NBTSerializableValue value = new NBTSerializableValue(); - value.nbtSupplier = () -> ItemStack.CODEC.encodeStart(regs.createSerializationContext(NbtOps.INSTANCE), stack).getOrThrow(); + value.nbtSupplier = () -> ItemStack.CODEC.encodeStart(regs.createSerializationContext(NbtOps.INSTANCE), stack).getOrThrow(s -> new InternalExpressionException("Failed to parse item stack data: " + s)); return value; } @@ -347,7 +347,7 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa public static ItemStack parseItem(String itemString, @Nullable CompoundTag customTag, RegistryAccess regs) { if (customTag != null) { - return ItemStack.CODEC.parse(regs.createSerializationContext(NbtOps.INSTANCE), customTag).resultOrPartial().orElse(null); + return ItemStack.CODEC.parse(regs.createSerializationContext(NbtOps.INSTANCE), customTag).getOrThrow(s -> new InternalExpressionException("Failed to parse item stack data: " + s)); } try { From 22e556f0e9343d742c8b111171d6d3b96588f5de Mon Sep 17 00:00:00 2001 From: gnembon Date: Tue, 8 Apr 2025 16:57:38 +0200 Subject: [PATCH 083/232] 25w15a --- gradle.properties | 4 ++-- .../java/carpet/mixins/CloneCommands_fillUpdatesMixin.java | 7 ++++--- src/main/java/carpet/mixins/FillCommandMixin.java | 7 ++++--- .../carpet/mixins/SetBlockCommand_fillUpdatesMixin.java | 7 ++++--- src/main/java/carpet/script/api/Auxiliary.java | 2 +- src/main/java/carpet/script/utils/SystemInfo.java | 6 +++--- src/main/resources/fabric.mod.json | 2 +- 7 files changed, 19 insertions(+), 16 deletions(-) diff --git a/gradle.properties b/gradle.properties index eaab5f75..f79c4d8a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=1.21.5 + minecraft_version=25w15a loader_version=0.16.10 jsr305_version=3.0.2 fabric_version=0.119.5+1.21.5 @@ -17,7 +17,7 @@ org.gradle.jvmargs=-Xmx1G # The Curseforge versions "names" or ids for the main branch (comma separated: 1.16.4,1.16.5) # This is needed because CF uses too vague names for prereleases and release candidates # Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN] - release-curse-versions = Minecraft 1.21:1.21.5 + release-curse-versions = Minecraft 1.21:1.21.5-Snapshot # Whether or not to build another branch on release release-extra-branch = false # The name of the second branch to release diff --git a/src/main/java/carpet/mixins/CloneCommands_fillUpdatesMixin.java b/src/main/java/carpet/mixins/CloneCommands_fillUpdatesMixin.java index 8e3db97c..1951e915 100644 --- a/src/main/java/carpet/mixins/CloneCommands_fillUpdatesMixin.java +++ b/src/main/java/carpet/mixins/CloneCommands_fillUpdatesMixin.java @@ -5,6 +5,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.server.commands.CloneCommands; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; @@ -14,10 +15,10 @@ public abstract class CloneCommands_fillUpdatesMixin { @Redirect(method = "clone", at = @At( value = "INVOKE", - target = "Lnet/minecraft/server/level/ServerLevel;updateNeighborsAt(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/Block;)V" + target = "Lnet/minecraft/server/level/ServerLevel;updateNeighboursOnBlockSet(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;)V" )) - private static void conditionalUpdating(ServerLevel serverWorld, BlockPos blockPos_1, Block block_1) + private static void conditionalUpdating(ServerLevel serverWorld, BlockPos blockPos_1, BlockState block_1) { - if (CarpetSettings.fillUpdates) serverWorld.updateNeighborsAt(blockPos_1, block_1); + if (CarpetSettings.fillUpdates) serverWorld.updateNeighboursOnBlockSet(blockPos_1, block_1); } } diff --git a/src/main/java/carpet/mixins/FillCommandMixin.java b/src/main/java/carpet/mixins/FillCommandMixin.java index 6ab7079e..936bb00a 100644 --- a/src/main/java/carpet/mixins/FillCommandMixin.java +++ b/src/main/java/carpet/mixins/FillCommandMixin.java @@ -5,6 +5,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.server.commands.FillCommand; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; @@ -14,10 +15,10 @@ public abstract class FillCommandMixin { @Redirect(method = "fillBlocks", at = @At( value = "INVOKE", - target = "Lnet/minecraft/server/level/ServerLevel;updateNeighborsAt(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/Block;)V" + target = "Lnet/minecraft/server/level/ServerLevel;updateNeighboursOnBlockSet(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;)V" )) - private static void conditionalUpdating(ServerLevel serverWorld, BlockPos blockPos_1, Block block_1) + private static void conditionalUpdating(ServerLevel serverWorld, BlockPos blockPos_1, BlockState block_1) { - if (CarpetSettings.fillUpdates) serverWorld.updateNeighborsAt(blockPos_1, block_1); + if (CarpetSettings.fillUpdates) serverWorld.updateNeighboursOnBlockSet(blockPos_1, block_1); } } diff --git a/src/main/java/carpet/mixins/SetBlockCommand_fillUpdatesMixin.java b/src/main/java/carpet/mixins/SetBlockCommand_fillUpdatesMixin.java index 20c3998a..b3780ec4 100644 --- a/src/main/java/carpet/mixins/SetBlockCommand_fillUpdatesMixin.java +++ b/src/main/java/carpet/mixins/SetBlockCommand_fillUpdatesMixin.java @@ -5,6 +5,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.server.commands.SetBlockCommand; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; @@ -14,10 +15,10 @@ public class SetBlockCommand_fillUpdatesMixin { @Redirect(method = "setBlock", at = @At( value = "INVOKE", - target = "Lnet/minecraft/server/level/ServerLevel;updateNeighborsAt(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/Block;)V" + target = "Lnet/minecraft/server/level/ServerLevel;updateNeighboursOnBlockSet(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;)V" )) - private static void conditionalUpdating(ServerLevel serverWorld, BlockPos blockPos_1, Block block_1) + private static void conditionalUpdating(ServerLevel serverWorld, BlockPos blockPos_1, BlockState block_1) { - if (CarpetSettings.fillUpdates) serverWorld.updateNeighborsAt(blockPos_1, block_1); + if (CarpetSettings.fillUpdates) serverWorld.updateNeighboursOnBlockSet(blockPos_1, block_1); } } diff --git a/src/main/java/carpet/script/api/Auxiliary.java b/src/main/java/carpet/script/api/Auxiliary.java index 4770a03f..108bc030 100644 --- a/src/main/java/carpet/script/api/Auxiliary.java +++ b/src/main/java/carpet/script/api/Auxiliary.java @@ -1195,7 +1195,7 @@ public class Auxiliary Path zipRoot = zipfs.getPath("/"); zipValueToJson(zipRoot.resolve("pack.mcmeta"), MapValue.wrap( Map.of(StringValue.of("pack"), MapValue.wrap(Map.of( - StringValue.of("pack_format"), new NumericValue(SharedConstants.getCurrentVersion().getPackVersion(PackType.SERVER_DATA)), + StringValue.of("pack_format"), new NumericValue(SharedConstants.getCurrentVersion().packVersion(PackType.SERVER_DATA)), StringValue.of("description"), StringValue.of(name), StringValue.of("source"), StringValue.of("scarpet") ))) diff --git a/src/main/java/carpet/script/utils/SystemInfo.java b/src/main/java/carpet/script/utils/SystemInfo.java index 66ab7a85..d655f142 100644 --- a/src/main/java/carpet/script/utils/SystemInfo.java +++ b/src/main/java/carpet/script/utils/SystemInfo.java @@ -90,9 +90,9 @@ public class SystemInfo put("game_protocol", c -> NumericValue.of(SharedConstants.getProtocolVersion())); put("game_major_target", c -> NumericValue.of(Vanilla.MinecraftServer_getReleaseTarget(c.server())[0])); put("game_minor_target", c -> NumericValue.of(Vanilla.MinecraftServer_getReleaseTarget(c.server())[1])); - put("game_stable", c -> BooleanValue.of(SharedConstants.getCurrentVersion().isStable())); - put("game_data_version", c -> NumericValue.of(SharedConstants.getCurrentVersion().getDataVersion().getVersion())); - put("game_pack_version", c -> NumericValue.of(SharedConstants.getCurrentVersion().getPackVersion(PackType.SERVER_DATA))); + put("game_stable", c -> BooleanValue.of(SharedConstants.getCurrentVersion().stable())); + put("game_data_version", c -> NumericValue.of(SharedConstants.getCurrentVersion().dataVersion().version())); + put("game_pack_version", c -> NumericValue.of(SharedConstants.getCurrentVersion().packVersion(PackType.SERVER_DATA))); put("server_ip", c -> StringValue.of(c.server().getLocalIp())); put("server_whitelisted", c -> BooleanValue.of(c.server().isEnforceWhitelist())); diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 30c160a0..95673982 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -33,7 +33,7 @@ "accessWidener" : "carpet.accesswidener", "depends": { - "minecraft": ">=1.21.5", + "minecraft": ">=1.21.4", "fabricloader": ">=0.16.10", "java": ">=21" } From ad93655b3451351d5810f9e3b03132ee6cf1186a Mon Sep 17 00:00:00 2001 From: gnembon Date: Tue, 8 Apr 2025 17:02:50 +0200 Subject: [PATCH 084/232] 1.4.170 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index f79c4d8a..5ac246c4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G fabric_version=0.119.5+1.21.5 # Mod Properties - mod_version = 1.4.169 + mod_version = 1.4.170 maven_group = carpet archives_base_name = fabric-carpet From 48747485be92764c3fb4fff7a780a363852a76b1 Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 16 Apr 2025 09:51:32 +0200 Subject: [PATCH 085/232] 25w16a --- gradle.properties | 2 +- .../LevelRenderer_scarpetRenderMixin.java | 4 +-- ...PacketListenerImpl_scarpetEventsMixin.java | 31 ++++++++++--------- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/gradle.properties b/gradle.properties index 5ac246c4..6857231b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=25w15a + minecraft_version=25w16a loader_version=0.16.10 jsr305_version=3.0.2 fabric_version=0.119.5+1.21.5 diff --git a/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java b/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java index 4b1f4063..2a63219a 100644 --- a/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java +++ b/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java @@ -2,11 +2,11 @@ package carpet.mixins; import carpet.network.CarpetClient; import carpet.script.utils.ShapesRenderer; +import com.mojang.blaze3d.buffers.GpuBufferSlice; import com.mojang.blaze3d.framegraph.FrameGraphBuilder; import com.mojang.blaze3d.framegraph.FramePass; import net.minecraft.client.Camera; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.FogParameters; import net.minecraft.client.renderer.LevelRenderer; import net.minecraft.client.renderer.LevelTargetBundle; import net.minecraft.client.renderer.LightTexture; @@ -32,7 +32,7 @@ public class LevelRenderer_scarpetRenderMixin } @Inject(method = "addParticlesPass", at = @At("RETURN")) - private void renderScarpetThingsLate(FrameGraphBuilder frameGraphBuilder, Camera camera, float f, FogParameters fogParameters, CallbackInfo ci) + private void renderScarpetThingsLate(FrameGraphBuilder frameGraphBuilder, Camera camera, float f, GpuBufferSlice fogParameters, CallbackInfo ci) { // in normal circumstances we want to render shapes at the very end so it appears correctly behind stuff. // we might actually not need to play with render hooks here. diff --git a/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java b/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java index 6fd5eb02..7d5453bb 100644 --- a/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java +++ b/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java @@ -180,24 +180,25 @@ public class ServerGamePacketListenerImpl_scarpetEventsMixin } } - @Inject(method = "handlePlayerCommand", at = @At( + @Inject(method = "handlePlayerInput", at = @At( value = "INVOKE", - target = "Lnet/minecraft/server/level/ServerPlayer;setShiftKeyDown(Z)V", - ordinal = 0 + target = "Lnet/minecraft/server/level/ServerPlayer;setLastClientInput(Lnet/minecraft/world/entity/player/Input;)V" )) - private void onStartSneaking(ServerboundPlayerCommandPacket clientCommandC2SPacket_1, CallbackInfo ci) + private void onStartSneaking(ServerboundPlayerInputPacket serverboundPlayerInputPacket, CallbackInfo ci) { - PLAYER_STARTS_SNEAKING.onPlayerEvent(player); - } - - @Inject(method = "handlePlayerCommand", at = @At( - value = "INVOKE", - target = "Lnet/minecraft/server/level/ServerPlayer;setShiftKeyDown(Z)V", - ordinal = 1 - )) - private void onStopSneaking(ServerboundPlayerCommandPacket clientCommandC2SPacket_1, CallbackInfo ci) - { - PLAYER_STOPS_SNEAKING.onPlayerEvent(player); + boolean wasDown = player.isShiftKeyDown(); + boolean isDown = serverboundPlayerInputPacket.input().shift(); + if (wasDown != isDown) + { + if (isDown) + { + PLAYER_STARTS_SNEAKING.onPlayerEvent(player); + } + else + { + PLAYER_STOPS_SNEAKING.onPlayerEvent(player); + } + } } @Inject(method = "handlePlayerCommand", at = @At( From d45f5ba05af6101fa89fa9da3b0287b7059f88c9 Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 16 Apr 2025 09:52:16 +0200 Subject: [PATCH 086/232] 1.4.171 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 6857231b..40629afb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G fabric_version=0.119.5+1.21.5 # Mod Properties - mod_version = 1.4.170 + mod_version = 1.4.171 maven_group = carpet archives_base_name = fabric-carpet From ef6ebac7fbf6337bfa2391c8beccc951e82f9c0c Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 30 Apr 2025 14:11:25 +0200 Subject: [PATCH 087/232] 25w18a --- gradle.properties | 2 +- ...istonMovingBlockEntity_movableBEMixin.java | 28 +++++----- .../mixins/PlayerList_fakePlayersMixin.java | 10 ++-- .../java/carpet/network/CarpetClient.java | 2 +- .../carpet/network/ServerNetworkHandler.java | 2 +- .../java/carpet/script/api/WorldAccess.java | 6 ++- .../carpet/script/utils/ShapeDispatcher.java | 4 +- .../carpet/script/utils/ShapesRenderer.java | 6 ++- .../java/carpet/script/value/EntityValue.java | 54 +++++++++++++------ .../script/value/FormattedTextValue.java | 14 +++-- .../java/carpet/script/value/ScreenValue.java | 3 +- 11 files changed, 88 insertions(+), 43 deletions(-) diff --git a/gradle.properties b/gradle.properties index 40629afb..90cdbbe6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=25w16a + minecraft_version=25w18a loader_version=0.16.10 jsr305_version=3.0.2 fabric_version=0.119.5+1.21.5 diff --git a/src/main/java/carpet/mixins/PistonMovingBlockEntity_movableBEMixin.java b/src/main/java/carpet/mixins/PistonMovingBlockEntity_movableBEMixin.java index c9d07991..5323f670 100644 --- a/src/main/java/carpet/mixins/PistonMovingBlockEntity_movableBEMixin.java +++ b/src/main/java/carpet/mixins/PistonMovingBlockEntity_movableBEMixin.java @@ -15,6 +15,10 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.piston.PistonMovingBlockEntity; import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.storage.TagValueInput; +import net.minecraft.world.level.storage.TagValueOutput; +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.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -134,25 +138,25 @@ public abstract class PistonMovingBlockEntity_movableBEMixin extends BlockEntity } @Inject(method = "loadAdditional", at = @At(value = "TAIL")) - private void onFromTag(CompoundTag NbtCompound_1, HolderLookup.Provider registries, CallbackInfo ci) + private void onFromTag(ValueInput valueInput, CallbackInfo ci) { - if (CarpetSettings.movableBlockEntities && NbtCompound_1.contains("carriedTileEntityCM")) - { - if (this.movedState.getBlock() instanceof EntityBlock) - this.carriedBlockEntity = ((EntityBlock) (this.movedState.getBlock())).newBlockEntity(worldPosition, movedState);// this.world); - if (carriedBlockEntity != null) //Can actually be null, as BlockPistonMoving.createNewTileEntity(...) returns null - this.carriedBlockEntity.loadWithComponents(NbtCompound_1.getCompound("carriedTileEntityCM").orElseThrow(), registries); - setCarriedBlockEntity(carriedBlockEntity); - } + if (CarpetSettings.movableBlockEntities) + valueInput.child("carriedTileEntityCM").ifPresent(tag -> { + if (this.movedState.getBlock() instanceof EntityBlock) + this.carriedBlockEntity = ((EntityBlock) (this.movedState.getBlock())).newBlockEntity(worldPosition, movedState);// this.world); + if (carriedBlockEntity != null) //Can actually be null, as BlockPistonMoving.createNewTileEntity(...) returns null + this.carriedBlockEntity.loadWithComponents(tag); + setCarriedBlockEntity(carriedBlockEntity); + }); } @Inject(method = "saveAdditional", at = @At(value = "RETURN", shift = At.Shift.BEFORE)) - private void onToTag(CompoundTag NbtCompound_1, HolderLookup.Provider registries, CallbackInfo ci) + private void onToTag(ValueOutput valueOutput, CallbackInfo ci) { - if (CarpetSettings.movableBlockEntities && this.carriedBlockEntity != null) + if (CarpetSettings.movableBlockEntities && this.carriedBlockEntity != null && valueOutput instanceof TagValueOutput output) { //Leave name "carriedTileEntityCM" instead of "carriedBlockEntityCM" for upgrade compatibility with 1.13.2 movable TE - NbtCompound_1.put("carriedTileEntityCM", this.carriedBlockEntity.saveWithoutMetadata(registries)); + this.carriedBlockEntity.saveWithoutMetadata(output.child("carriedTileEntityCM")); } } } diff --git a/src/main/java/carpet/mixins/PlayerList_fakePlayersMixin.java b/src/main/java/carpet/mixins/PlayerList_fakePlayersMixin.java index 3cd54ed3..2d8dc9b5 100644 --- a/src/main/java/carpet/mixins/PlayerList_fakePlayersMixin.java +++ b/src/main/java/carpet/mixins/PlayerList_fakePlayersMixin.java @@ -10,6 +10,8 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.network.CommonListenerCookie; import net.minecraft.server.network.ServerGamePacketListenerImpl; import net.minecraft.server.players.PlayerList; +import net.minecraft.util.ProblemReporter; +import net.minecraft.world.level.storage.ValueInput; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -20,6 +22,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import carpet.patches.NetHandlerPlayServerFake; import carpet.patches.EntityPlayerMPFake; +import java.util.Optional; + @Mixin(PlayerList.class) public abstract class PlayerList_fakePlayersMixin { @@ -28,11 +32,11 @@ public abstract class PlayerList_fakePlayersMixin private MinecraftServer server; @Inject(method = "load", at = @At(value = "RETURN", shift = At.Shift.BEFORE)) - private void fixStartingPos(ServerPlayer serverPlayerEntity_1, CallbackInfoReturnable cir) + private void fixStartingPos(ServerPlayer serverPlayer, ProblemReporter problemReporter, CallbackInfoReturnable> cir) { - if (serverPlayerEntity_1 instanceof EntityPlayerMPFake) + if (serverPlayer instanceof EntityPlayerMPFake) { - ((EntityPlayerMPFake) serverPlayerEntity_1).fixStartingPosition.run(); + ((EntityPlayerMPFake) serverPlayer).fixStartingPosition.run(); } } diff --git a/src/main/java/carpet/network/CarpetClient.java b/src/main/java/carpet/network/CarpetClient.java index d8893ea2..a2e83ee2 100644 --- a/src/main/java/carpet/network/CarpetClient.java +++ b/src/main/java/carpet/network/CarpetClient.java @@ -106,7 +106,7 @@ public class CarpetClient ListTag outputTag = (ListTag) tag.get("output"); for (int i = 0; i < outputTag.size(); i++) { - CarpetSettings.LOG.info(" - response: " + Component.Serializer.fromJson(outputTag.getString(i).orElseThrow(), clientPlayer.registryAccess()).getString()); + CarpetSettings.LOG.info(" - response: " + outputTag.getString(i).orElseThrow()); } } } diff --git a/src/main/java/carpet/network/ServerNetworkHandler.java b/src/main/java/carpet/network/ServerNetworkHandler.java index 79d8577e..86e4b0d9 100644 --- a/src/main/java/carpet/network/ServerNetworkHandler.java +++ b/src/main/java/carpet/network/ServerNetworkHandler.java @@ -104,7 +104,7 @@ public class ServerNetworkHandler ListTag outputResult = new ListTag(); for (Component line : output) { - outputResult.add(StringTag.valueOf(Component.Serializer.toJson(line, player.registryAccess()))); + outputResult.add(StringTag.valueOf(line.getString())); } if (!output.isEmpty()) { diff --git a/src/main/java/carpet/script/api/WorldAccess.java b/src/main/java/carpet/script/api/WorldAccess.java index 8dac488b..2794a875 100644 --- a/src/main/java/carpet/script/api/WorldAccess.java +++ b/src/main/java/carpet/script/api/WorldAccess.java @@ -53,6 +53,7 @@ import net.minecraft.server.level.TicketType; import net.minecraft.sounds.SoundEvents; import net.minecraft.tags.ItemTags; import net.minecraft.tags.TagKey; +import net.minecraft.util.ProblemReporter; import net.minecraft.world.level.ServerExplosion; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.chunk.PalettedContainer; @@ -64,6 +65,7 @@ import net.minecraft.world.level.levelgen.NoiseRouter; import net.minecraft.world.level.levelgen.RandomState; import net.minecraft.world.level.levelgen.structure.Structure; import net.minecraft.world.level.levelgen.structure.StructureType; +import net.minecraft.world.level.storage.TagValueInput; import org.apache.commons.lang3.mutable.MutableBoolean; import org.apache.commons.lang3.tuple.Pair; @@ -829,7 +831,9 @@ public class WorldAccess destTag.putInt("x", targetPos.getX()); destTag.putInt("y", targetPos.getY()); destTag.putInt("z", targetPos.getZ()); - be.loadWithComponents(destTag, world.registryAccess()); + try (final ProblemReporter.ScopedCollector reporter = new ProblemReporter.ScopedCollector(be.problemPath(), CarpetScriptServer.LOG)) { + be.loadWithComponents(TagValueInput.create(reporter, world.registryAccess(), destTag)); + } be.setChanged(); success = true; } diff --git a/src/main/java/carpet/script/utils/ShapeDispatcher.java b/src/main/java/carpet/script/utils/ShapeDispatcher.java index 12e1ed2e..041600f0 100644 --- a/src/main/java/carpet/script/utils/ShapeDispatcher.java +++ b/src/main/java/carpet/script/utils/ShapeDispatcher.java @@ -1718,13 +1718,13 @@ public class ShapeDispatcher { value = new FormattedTextValue(Component.literal(value.getString())); } - return StringTag.valueOf(((FormattedTextValue) value).serialize(regs)); + return ((FormattedTextValue) value).serialize(regs); } @Override public Value decode(Tag tag, Level level) { - return FormattedTextValue.deserialize(tag.asString().get(), level.registryAccess()); + return FormattedTextValue.deserialize(tag, level.registryAccess()); } } diff --git a/src/main/java/carpet/script/utils/ShapesRenderer.java b/src/main/java/carpet/script/utils/ShapesRenderer.java index 51e7b86a..53892aab 100644 --- a/src/main/java/carpet/script/utils/ShapesRenderer.java +++ b/src/main/java/carpet/script/utils/ShapesRenderer.java @@ -38,6 +38,7 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.resources.ResourceKey; import net.minecraft.util.Mth; +import net.minecraft.util.ProblemReporter; import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.level.Level; import net.minecraft.world.level.LightLayer; @@ -46,6 +47,7 @@ import net.minecraft.world.level.block.LeavesBlock; import net.minecraft.world.level.block.RenderShape; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.storage.TagValueInput; import net.minecraft.world.phys.Vec3; import org.joml.Matrix4f; import org.joml.Matrix4fStack; @@ -423,7 +425,9 @@ public class ShapesRenderer BlockEntity.setLevel(client.level); if (shape.blockEntity != null) { - BlockEntity.loadWithComponents(shape.blockEntity, client.level.registryAccess()); + try (final ProblemReporter.ScopedCollector reporter = new ProblemReporter.ScopedCollector(BlockEntity.problemPath(), CarpetScriptServer.LOG)) { + BlockEntity.loadWithComponents(TagValueInput.create(reporter, client.level.registryAccess(), shape.blockEntity)); + } } } } diff --git a/src/main/java/carpet/script/value/EntityValue.java b/src/main/java/carpet/script/value/EntityValue.java index 800cf9e6..ea8a983c 100644 --- a/src/main/java/carpet/script/value/EntityValue.java +++ b/src/main/java/carpet/script/value/EntityValue.java @@ -40,6 +40,7 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.tags.EntityTypeTags; import net.minecraft.tags.TagKey; import net.minecraft.util.Mth; +import net.minecraft.util.ProblemReporter; import net.minecraft.world.InteractionHand; import net.minecraft.world.effect.MobEffect; import net.minecraft.world.effect.MobEffectInstance; @@ -73,6 +74,8 @@ import net.minecraft.world.level.GameType; import net.minecraft.world.level.Level; import net.minecraft.world.level.entity.EntityTypeTest; import net.minecraft.world.level.pathfinder.Path; +import net.minecraft.world.level.storage.TagValueInput; +import net.minecraft.world.level.storage.TagValueOutput; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.EntityHitResult; import net.minecraft.world.phys.HitResult; @@ -526,7 +529,7 @@ public class EntityValue extends Value } return Value.NULL; }); - put("home", (e, a) -> e instanceof Mob mob ? (mob.getRestrictRadius() > 0) ? new BlockValue(null, (ServerLevel) e.level(), mob.getRestrictCenter()) : Value.FALSE : Value.NULL); + put("home", (e, a) -> e instanceof Mob mob ? (mob.getHomeRadius() > 0) ? new BlockValue(null, (ServerLevel) e.level(), mob.getHomePosition()) : Value.FALSE : Value.NULL); put("spawn_point", (e, a) -> { if (e instanceof ServerPlayer spe) { @@ -856,12 +859,16 @@ public class EntityValue extends Value }); put("nbt", (e, a) -> { - CompoundTag nbttagcompound = e.saveWithoutId((new CompoundTag())); - if (a == null) - { - return new NBTSerializableValue(nbttagcompound); + try (final ProblemReporter.ScopedCollector reporter = new ProblemReporter.ScopedCollector(e.problemPath(), CarpetScriptServer.LOG)) { + final TagValueOutput output = TagValueOutput.createWithContext(reporter, e.registryAccess()); + e.saveWithoutId(output); + CompoundTag nbttagcompound = output.buildResult(); + if (a == null) + { + return new NBTSerializableValue(nbttagcompound); + } + return new NBTSerializableValue(nbttagcompound).get(a); } - return new NBTSerializableValue(nbttagcompound).get(a); }); put("category", (e, a) -> { @@ -1312,7 +1319,7 @@ public class EntityValue extends Value } if (v.isNull()) { - ec.restrictTo(BlockPos.ZERO, -1); + ec.setHomeTo(BlockPos.ZERO, -1); Map tasks = Vanilla.Mob_getTemporaryTasks(ec); Vanilla.Mob_getAI(ec, false).removeGoal(tasks.get("home")); tasks.remove("home"); @@ -1345,7 +1352,7 @@ public class EntityValue extends Value throw new InternalExpressionException("'home' requires at least one position argument, and optional distance"); } - ec.restrictTo(pos, distance); + ec.setHomeTo(pos, distance); Map tasks = Vanilla.Mob_getTemporaryTasks(ec); if (!tasks.containsKey("home")) { @@ -1675,7 +1682,9 @@ public class EntityValue extends Value Value tagValue = NBTSerializableValue.fromValue(v); if (tagValue instanceof NBTSerializableValue nbtsv) { - e.load(nbtsv.getCompoundTag()); + try (final ProblemReporter.ScopedCollector reporter = new ProblemReporter.ScopedCollector(e.problemPath(), CarpetScriptServer.LOG)) { + e.load(TagValueInput.create(reporter, e.registryAccess(), nbtsv.getCompoundTag())); + } e.setUUID(uUID); } } @@ -1687,9 +1696,16 @@ public class EntityValue extends Value Value tagValue = NBTSerializableValue.fromValue(v); if (tagValue instanceof NBTSerializableValue nbtsv) { - CompoundTag nbttagcompound = e.saveWithoutId((new CompoundTag())); + CompoundTag nbttagcompound; + try (final ProblemReporter.ScopedCollector reporter = new ProblemReporter.ScopedCollector(e.problemPath(), CarpetScriptServer.LOG)) { + final TagValueOutput output = TagValueOutput.createWithContext(reporter, e.registryAccess()); + e.saveWithoutId(output); + nbttagcompound = output.buildResult(); + } nbttagcompound.merge(nbtsv.getCompoundTag()); - e.load(nbttagcompound); + try (final ProblemReporter.ScopedCollector reporter = new ProblemReporter.ScopedCollector(e.problemPath(), CarpetScriptServer.LOG)) { + e.load(TagValueInput.create(reporter, e.registryAccess(), nbttagcompound)); + } e.setUUID(uUID); } } @@ -1742,10 +1758,18 @@ public class EntityValue extends Value { throw new NBTSerializableValue.IncompatibleTypeException(this); } - CompoundTag tag = new CompoundTag(); - tag.put("Data", getEntity().saveWithoutId(new CompoundTag())); - Registry> reg = getEntity().level().registryAccess().lookupOrThrow(Registries.ENTITY_TYPE); - tag.put("Name", StringTag.valueOf(reg.getKey(getEntity().getType()).toString())); + CompoundTag tag; + Entity entity = getEntity(); + try (final ProblemReporter.ScopedCollector reporter = new ProblemReporter.ScopedCollector(entity.problemPath(), CarpetScriptServer.LOG)) { + final TagValueOutput output = TagValueOutput.createWithContext(reporter, entity.registryAccess()); + entity.save(output); + tag = output.buildResult(); + } + + tag.put("Data", tag); + + Registry> reg = entity.level().registryAccess().lookupOrThrow(Registries.ENTITY_TYPE); + tag.put("Name", StringTag.valueOf(reg.getKey(entity.getType()).toString())); return tag; } } diff --git a/src/main/java/carpet/script/value/FormattedTextValue.java b/src/main/java/carpet/script/value/FormattedTextValue.java index b08e0942..3a8c5ee0 100644 --- a/src/main/java/carpet/script/value/FormattedTextValue.java +++ b/src/main/java/carpet/script/value/FormattedTextValue.java @@ -1,9 +1,13 @@ package carpet.script.value; +import carpet.script.exception.InternalExpressionException; +import com.mojang.serialization.DynamicOps; import net.minecraft.core.RegistryAccess; +import net.minecraft.nbt.NbtOps; import net.minecraft.nbt.StringTag; import net.minecraft.nbt.Tag; import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.ComponentSerialization; import net.minecraft.network.chat.MutableComponent; public class FormattedTextValue extends StringValue @@ -86,7 +90,7 @@ public class FormattedTextValue extends StringValue { throw new NBTSerializableValue.IncompatibleTypeException(this); } - return StringTag.valueOf(Component.Serializer.toJson(text, regs)); + return serialize(regs); } @Override @@ -95,14 +99,14 @@ public class FormattedTextValue extends StringValue return combine(this, o); } - public String serialize(RegistryAccess regs) + public Tag serialize(RegistryAccess regs) { - return Component.Serializer.toJson(text, regs); + return ComponentSerialization.CODEC.encodeStart(regs.createSerializationContext(NbtOps.INSTANCE), text).getOrThrow(InternalExpressionException::new);// text.getContents() Component.Serializer.toJson(text, regs); } - public static FormattedTextValue deserialize(String serialized, RegistryAccess regs) + public static FormattedTextValue deserialize(Tag tag, RegistryAccess regs) { - return new FormattedTextValue(Component.Serializer.fromJson(serialized, regs)); + return new FormattedTextValue(ComponentSerialization.CODEC.decode(regs.createSerializationContext(NbtOps.INSTANCE), tag).getOrThrow(InternalExpressionException::new).getFirst()); } public static Component getTextByValue(Value value) diff --git a/src/main/java/carpet/script/value/ScreenValue.java b/src/main/java/carpet/script/value/ScreenValue.java index a3c154ff..84b7ef02 100644 --- a/src/main/java/carpet/script/value/ScreenValue.java +++ b/src/main/java/carpet/script/value/ScreenValue.java @@ -20,6 +20,7 @@ import net.minecraft.commands.CommandSourceStack; import net.minecraft.core.RegistryAccess; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; +import net.minecraft.nbt.NbtOps; import net.minecraft.nbt.Tag; import net.minecraft.network.chat.Component; import net.minecraft.server.level.ServerPlayer; @@ -391,7 +392,7 @@ public class ScreenValue extends Value } else { - nbtList.add(itemStack.save(regs)); + nbtList.add(ItemStack.CODEC.encodeStart(regs.createSerializationContext(NbtOps.INSTANCE), itemStack).getOrThrow(InternalExpressionException::new)); } } return nbtList; From d7bb4f3801180b1d692dad2c7dfbbe8c716f4330 Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 30 Apr 2025 14:12:02 +0200 Subject: [PATCH 088/232] 1.4.172 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 90cdbbe6..549b07da 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G fabric_version=0.119.5+1.21.5 # Mod Properties - mod_version = 1.4.171 + mod_version = 1.4.172 maven_group = carpet archives_base_name = fabric-carpet From 6bed85ef8c21923499fdfaa689fecf5137201cc2 Mon Sep 17 00:00:00 2001 From: gnembon Date: Fri, 2 May 2025 10:35:27 +0200 Subject: [PATCH 089/232] fix --- src/main/java/carpet/script/value/EntityValue.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/main/java/carpet/script/value/EntityValue.java b/src/main/java/carpet/script/value/EntityValue.java index ea8a983c..fb737d0f 100644 --- a/src/main/java/carpet/script/value/EntityValue.java +++ b/src/main/java/carpet/script/value/EntityValue.java @@ -1758,16 +1758,13 @@ public class EntityValue extends Value { throw new NBTSerializableValue.IncompatibleTypeException(this); } - CompoundTag tag; + CompoundTag tag = new CompoundTag(); Entity entity = getEntity(); try (final ProblemReporter.ScopedCollector reporter = new ProblemReporter.ScopedCollector(entity.problemPath(), CarpetScriptServer.LOG)) { final TagValueOutput output = TagValueOutput.createWithContext(reporter, entity.registryAccess()); entity.save(output); - tag = output.buildResult(); + tag.put("Data", output.buildResult()); } - - tag.put("Data", tag); - Registry> reg = entity.level().registryAccess().lookupOrThrow(Registries.ENTITY_TYPE); tag.put("Name", StringTag.valueOf(reg.getKey(entity.getType()).toString())); return tag; From a1e4496cffff65468ad773114568e151f0131ede Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 7 May 2025 19:33:48 +0200 Subject: [PATCH 090/232] 25w19a --- gradle.properties | 2 +- src/main/java/carpet/commands/PlayerCommand.java | 4 ++-- .../carpet/helpers/EntityPlayerActionPack.java | 2 +- .../java/carpet/helpers/ParticleDisplay.java | 4 ++-- ...amePacketListenerImpl_scarpetEventsMixin.java | 2 +- ...erGamePacketListenerimpl_connectionMixin.java | 2 +- .../carpet/network/ServerNetworkHandler.java | 10 +++++----- .../java/carpet/patches/EntityPlayerMPFake.java | 6 +++--- .../carpet/patches/NetHandlerPlayServerFake.java | 4 ++-- .../java/carpet/script/CarpetEventServer.java | 14 +++++++------- .../carpet/script/utils/ShapeDispatcher.java | 16 ++++++++-------- .../carpet/script/utils/SnoopyCommandSource.java | 6 +++--- .../java/carpet/script/value/EntityValue.java | 2 +- .../java/carpet/script/value/ScreenValue.java | 2 +- 14 files changed, 38 insertions(+), 38 deletions(-) diff --git a/gradle.properties b/gradle.properties index 549b07da..2d0a7c01 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=25w18a + minecraft_version=25w19a loader_version=0.16.10 jsr305_version=3.0.2 fabric_version=0.119.5+1.21.5 diff --git a/src/main/java/carpet/commands/PlayerCommand.java b/src/main/java/carpet/commands/PlayerCommand.java index 86753a98..fe7fa328 100644 --- a/src/main/java/carpet/commands/PlayerCommand.java +++ b/src/main/java/carpet/commands/PlayerCommand.java @@ -229,7 +229,7 @@ public class PlayerCommand { if (cantReMove(context)) return 0; ServerPlayer player = getPlayer(context); - player.kill(player.serverLevel()); + player.kill(player.level()); return 1; } @@ -342,7 +342,7 @@ public class PlayerCommand return 0; } - EntityPlayerMPFake.createShadow(player.server, player); + EntityPlayerMPFake.createShadow(player.getServer(), player); return 1; } } diff --git a/src/main/java/carpet/helpers/EntityPlayerActionPack.java b/src/main/java/carpet/helpers/EntityPlayerActionPack.java index 8595b57f..dc73346f 100644 --- a/src/main/java/carpet/helpers/EntityPlayerActionPack.java +++ b/src/main/java/carpet/helpers/EntityPlayerActionPack.java @@ -310,7 +310,7 @@ public class EntityPlayerActionPack case BLOCK: { player.resetLastActionTime(); - ServerLevel world = player.serverLevel(); + ServerLevel world = player.level(); BlockHitResult blockHit = (BlockHitResult) hit; BlockPos pos = blockHit.getBlockPos(); Direction side = blockHit.getDirection(); diff --git a/src/main/java/carpet/helpers/ParticleDisplay.java b/src/main/java/carpet/helpers/ParticleDisplay.java index 67ec012e..d6f2ee61 100644 --- a/src/main/java/carpet/helpers/ParticleDisplay.java +++ b/src/main/java/carpet/helpers/ParticleDisplay.java @@ -9,7 +9,7 @@ public class ParticleDisplay public static void drawParticleLine(ServerPlayer player, Vec3 from, Vec3 to, ParticleOptions mainParticle, ParticleOptions accentParticle, int count, double spread) { - if (accentParticle != null) player.serverLevel().sendParticles( + if (accentParticle != null) player.level().sendParticles( player, accentParticle, true, true, @@ -24,7 +24,7 @@ public class ParticleDisplay delta.lengthSqr() < lineLengthSq; delta = delta.add(incvec.scale(player.level().random.nextFloat()))) { - player.serverLevel().sendParticles( + player.level().sendParticles( player, mainParticle, true, true, diff --git a/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java b/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java index 7d5453bb..f14d6385 100644 --- a/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java +++ b/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java @@ -257,7 +257,7 @@ public class ServerGamePacketListenerImpl_scarpetEventsMixin { if (PLAYER_CHOOSES_RECIPE.isNeeded()) { - RecipeManager.ServerDisplayInfo displayInfo = player.server.getRecipeManager().getRecipeFromDisplay(packet.recipe()); + RecipeManager.ServerDisplayInfo displayInfo = player.getServer().getRecipeManager().getRecipeFromDisplay(packet.recipe()); if (displayInfo == null) { return; } diff --git a/src/main/java/carpet/mixins/ServerGamePacketListenerimpl_connectionMixin.java b/src/main/java/carpet/mixins/ServerGamePacketListenerimpl_connectionMixin.java index 1811168e..386472cd 100644 --- a/src/main/java/carpet/mixins/ServerGamePacketListenerimpl_connectionMixin.java +++ b/src/main/java/carpet/mixins/ServerGamePacketListenerimpl_connectionMixin.java @@ -26,7 +26,7 @@ public class ServerGamePacketListenerimpl_connectionMixin // We should force onto the main thread here // ServerNetworkHandler.handleData can possibly mutate data that isn't // thread safe, and also allows for client commands to be executed - PacketUtils.ensureRunningOnSameThread(serverboundCustomPayloadPacket, (ServerGamePacketListener) this, player.serverLevel()); + PacketUtils.ensureRunningOnSameThread(serverboundCustomPayloadPacket, (ServerGamePacketListener) this, player.level()); ServerNetworkHandler.onClientData(player, cpp.data()); ci.cancel(); } diff --git a/src/main/java/carpet/network/ServerNetworkHandler.java b/src/main/java/carpet/network/ServerNetworkHandler.java index 86e4b0d9..ed394c99 100644 --- a/src/main/java/carpet/network/ServerNetworkHandler.java +++ b/src/main/java/carpet/network/ServerNetworkHandler.java @@ -61,7 +61,7 @@ public class ServerNetworkHandler { CarpetSettings.LOG.warn("Player " + playerEntity.getName().getString() + " joined with another carpet version: " + version); } - DataBuilder data = DataBuilder.create(playerEntity.server); // tickrate related settings are sent on world change + DataBuilder data = DataBuilder.create(playerEntity.getServer()); // tickrate related settings are sent on world change CarpetServer.forEachManager(sm -> sm.getCarpetRules().forEach(data::withRule)); playerEntity.connection.send(data.build()); } @@ -110,7 +110,7 @@ public class ServerNetworkHandler { result.put("output", outputResult); } - player.connection.send(DataBuilder.create(player.server).withCustomNbt("clientCommand", result).build()); + player.connection.send(DataBuilder.create(player.getServer()).withCustomNbt("clientCommand", result).build()); // run command plug to command output, } @@ -137,7 +137,7 @@ public class ServerNetworkHandler } for (ServerPlayer player : remoteCarpetPlayers.keySet()) { - player.connection.send(DataBuilder.create(player.server).withRule(rule).build()); + player.connection.send(DataBuilder.create(player.getServer()).withRule(rule).build()); } } @@ -149,7 +149,7 @@ public class ServerNetworkHandler } for (ServerPlayer player : validCarpetPlayers) { - player.connection.send(DataBuilder.create(player.server).withCustomNbt(command, data).build()); + player.connection.send(DataBuilder.create(player.getServer()).withCustomNbt(command, data).build()); } } @@ -157,7 +157,7 @@ public class ServerNetworkHandler { if (isValidCarpetPlayer(player)) { - player.connection.send(DataBuilder.create(player.server).withCustomNbt(command, data).build()); + player.connection.send(DataBuilder.create(player.getServer()).withCustomNbt(command, data).build()); } } diff --git a/src/main/java/carpet/patches/EntityPlayerMPFake.java b/src/main/java/carpet/patches/EntityPlayerMPFake.java index 70b27705..53a38d9b 100644 --- a/src/main/java/carpet/patches/EntityPlayerMPFake.java +++ b/src/main/java/carpet/patches/EntityPlayerMPFake.java @@ -117,7 +117,7 @@ public class EntityPlayerMPFake extends ServerPlayer { player.getServer().getPlayerList().remove(player); player.connection.disconnect(Component.translatable("multiplayer.disconnect.duplicate_login")); - ServerLevel worldIn = player.serverLevel();//.getWorld(player.dimension); + ServerLevel worldIn = player.level();//.getWorld(player.dimension); GameProfile gameprofile = player.getGameProfile(); EntityPlayerMPFake playerShadow = new EntityPlayerMPFake(server, worldIn, gameprofile, player.clientInformation(), true); playerShadow.setChatSession(player.getChatSession()); @@ -174,7 +174,7 @@ public class EntityPlayerMPFake extends ServerPlayer if (reason.getContents() instanceof TranslatableContents text && text.getKey().equals("multiplayer.disconnect.duplicate_login")) { this.connection.onDisconnect(new DisconnectionDetails(reason)); } else { - this.server.schedule(new TickTask(this.server.getTickCount(), () -> { + this.getServer().schedule(new TickTask(this.getServer().getTickCount(), () -> { this.connection.onDisconnect(new DisconnectionDetails(reason)); })); } @@ -186,7 +186,7 @@ public class EntityPlayerMPFake extends ServerPlayer if (this.getServer().getTickCount() % 10 == 0) { this.connection.resetPosition(); - this.serverLevel().getChunkSource().move(this); + this.level().getChunkSource().move(this); } try { diff --git a/src/main/java/carpet/patches/NetHandlerPlayServerFake.java b/src/main/java/carpet/patches/NetHandlerPlayServerFake.java index 7270ff5a..143e7ad0 100644 --- a/src/main/java/carpet/patches/NetHandlerPlayServerFake.java +++ b/src/main/java/carpet/patches/NetHandlerPlayServerFake.java @@ -37,9 +37,9 @@ public class NetHandlerPlayServerFake extends ServerGamePacketListenerImpl public void teleport(PositionMoveRotation positionMoveRotation, Set set) { super.teleport(positionMoveRotation, set); - if (player.serverLevel().getPlayerByUUID(player.getUUID()) != null) { + if (player.level().getPlayerByUUID(player.getUUID()) != null) { resetPosition(); - player.serverLevel().getChunkSource().move(player); + player.level().getChunkSource().move(player); } } diff --git a/src/main/java/carpet/script/CarpetEventServer.java b/src/main/java/carpet/script/CarpetEventServer.java index ea0d099f..b8b5fe7a 100644 --- a/src/main/java/carpet/script/CarpetEventServer.java +++ b/src/main/java/carpet/script/CarpetEventServer.java @@ -604,7 +604,7 @@ public class CarpetEventServer return handler.call(() -> Arrays.asList( new EntityValue(player), - new BlockValue(null, player.serverLevel(), blockpos), + new BlockValue(null, player.level(), blockpos), StringValue.of(facing.getName()) ), player::createCommandSourceStack); } @@ -624,7 +624,7 @@ public class CarpetEventServer new EntityValue(player), ValueConversions.of(itemstack, player.level().registryAccess()), StringValue.of(enumhand == InteractionHand.MAIN_HAND ? "mainhand" : "offhand"), - new BlockValue(null, player.serverLevel(), blockpos), + new BlockValue(null, player.level(), blockpos), StringValue.of(enumfacing.getName()), ListValue.of( new NumericValue(vec3d.x), @@ -648,7 +648,7 @@ public class CarpetEventServer return Arrays.asList( new EntityValue(player), StringValue.of(enumhand == InteractionHand.MAIN_HAND ? "mainhand" : "offhand"), - new BlockValue(null, player.serverLevel(), blockpos), + new BlockValue(null, player.level(), blockpos), StringValue.of(enumfacing.getName()), ListValue.of( new NumericValue(vec3d.x), @@ -669,7 +669,7 @@ public class CarpetEventServer new EntityValue(player), ValueConversions.of(itemstack, player.level().registryAccess()), StringValue.of(enumhand == InteractionHand.MAIN_HAND ? "mainhand" : "offhand"), - new BlockValue(null, player.serverLevel(), pos) + new BlockValue(null, player.level(), pos) ), player::createCommandSourceStack); } }; @@ -682,7 +682,7 @@ public class CarpetEventServer new EntityValue(player), ValueConversions.of(itemstack, player.level().registryAccess()), StringValue.of(enumhand == InteractionHand.MAIN_HAND ? "mainhand" : "offhand"), - new BlockValue(null, player.serverLevel(), pos) + new BlockValue(null, player.level(), pos) ), player::createCommandSourceStack); return false; } @@ -693,7 +693,7 @@ public class CarpetEventServer public boolean onBlockBroken(ServerPlayer player, BlockPos pos, BlockState previousBS) { return handler.call( - () -> Arrays.asList(new EntityValue(player), new BlockValue(previousBS, player.serverLevel(), pos)), + () -> Arrays.asList(new EntityValue(player), new BlockValue(previousBS, player.level(), pos)), player::createCommandSourceStack ); } @@ -1336,7 +1336,7 @@ public class CarpetEventServer valArgs.add(EntityValue.of(player)); for (Object o : args) { - valArgs.add(ValueConversions.guess(player.serverLevel(), o)); + valArgs.add(ValueConversions.guess(player.level(), o)); } return valArgs; }, player::createCommandSourceStack diff --git a/src/main/java/carpet/script/utils/ShapeDispatcher.java b/src/main/java/carpet/script/utils/ShapeDispatcher.java index 041600f0..d37ae3f8 100644 --- a/src/main/java/carpet/script/utils/ShapeDispatcher.java +++ b/src/main/java/carpet/script/utils/ShapeDispatcher.java @@ -777,7 +777,7 @@ public class ShapeDispatcher } Vec3 v = relativiseRender(p.level(), this.pos, 0); - p.serverLevel().sendParticles(p, particle, true, true, v.x, v.y, v.z, 1, 0.0, 0.0, 0.0, 0.0); + p.level().sendParticles(p, particle, true, true, v.x, v.y, v.z, 1, 0.0, 0.0, 0.0, 0.0); }; } @@ -1072,7 +1072,7 @@ public class ShapeDispatcher ParticleOptions locparticledata = new DustParticleOptions(ARGB.colorFromFloat(1.0f, fr, fg, fb), 1); for (Vec3 v : getAlterPoint(p)) { - p.serverLevel().sendParticles(p, locparticledata, true, true, + p.level().sendParticles(p, locparticledata, true, true, v.x, v.y, v.z, 1, 0.0, 0.0, 0.0, 0.0); } @@ -1282,7 +1282,7 @@ public class ShapeDispatcher { int partno = Math.min(1000, 20 * subdivisions); RandomSource rand = p.level().getRandom(); - ServerLevel world = p.serverLevel(); + ServerLevel world = p.level(); ParticleOptions particle = replacementParticle(world.registryAccess()); Vec3 ccenter = relativiseRender(world, center, 0); @@ -1379,7 +1379,7 @@ public class ShapeDispatcher { int partno = (int) Math.min(1000, Math.sqrt(20 * subdivisions * (1 + height))); RandomSource rand = p.level().getRandom(); - ServerLevel world = p.serverLevel(); + ServerLevel world = p.level(); ParticleOptions particle = replacementParticle(world.registryAccess()); Vec3 ccenter = relativiseRender(world, center, 0); @@ -2185,7 +2185,7 @@ public class ShapeDispatcher int parts = 0; for (ServerPlayer player : playerList) { - ServerLevel world = player.serverLevel(); + ServerLevel world = player.level(); world.sendParticles(player, particle, true, true, (towards.x) / 2 + from.x, (towards.y) / 2 + from.y, (towards.z) / 2 + from.z, particles / 3, towards.x / 6, towards.y / 6, towards.z / 6, 0.0); @@ -2202,7 +2202,7 @@ public class ShapeDispatcher int dev = 2 * divider; for (ServerPlayer player : playerList) { - ServerLevel world = player.serverLevel(); + ServerLevel world = player.level(); world.sendParticles(player, particle, true, true, (towards.x) / center + from.x, (towards.y) / center + from.y, (towards.z) / center + from.z, particles / divider, towards.x / dev, towards.y / dev, towards.z / dev, 0.0); @@ -2234,7 +2234,7 @@ public class ShapeDispatcher Vec3 at = from.add(towards.scale(rand.nextDouble())); for (ServerPlayer player : players) { - player.serverLevel().sendParticles(player, particle, true, true, + player.level().sendParticles(player, particle, true, true, at.x, at.y, at.z, 1, 0.0, 0.0, 0.0, 0.0); pcount++; @@ -2255,7 +2255,7 @@ public class ShapeDispatcher { for (ServerPlayer player : players) { - player.serverLevel().sendParticles(player, particle, true, true, + player.level().sendParticles(player, particle, true, true, delta.x + from.x, delta.y + from.y, delta.z + from.z, 1, 0.0, 0.0, 0.0, 0.0); pcount++; diff --git a/src/main/java/carpet/script/utils/SnoopyCommandSource.java b/src/main/java/carpet/script/utils/SnoopyCommandSource.java index 74955665..71e10508 100644 --- a/src/main/java/carpet/script/utils/SnoopyCommandSource.java +++ b/src/main/java/carpet/script/utils/SnoopyCommandSource.java @@ -70,12 +70,12 @@ public class SnoopyCommandSource extends CommandSourceStack { super(player.commandSource(), player.position(), player.getRotationVector(), player.level() instanceof final ServerLevel serverLevel ? serverLevel : null, - player.server.getProfilePermissions(player.getGameProfile()), player.getName().getString(), player.getDisplayName(), + player.getServer().getProfilePermissions(player.getGameProfile()), player.getName().getString(), player.getDisplayName(), player.level().getServer(), player); this.output = player.commandSource(); this.position = player.position(); this.world = player.level() instanceof final ServerLevel serverLevel ? serverLevel : null; - this.level = player.server.getProfilePermissions(player.getGameProfile()); + this.level = player.getServer().getProfilePermissions(player.getGameProfile()); this.simpleName = player.getName().getString(); this.name = player.getDisplayName(); this.server = player.level().getServer(); @@ -86,7 +86,7 @@ public class SnoopyCommandSource extends CommandSourceStack this.error = error; this.chatOutput = output; this.signingContext = CommandSigningContext.ANONYMOUS; - this.taskChainer = TaskChainer.immediate(player.server); + this.taskChainer = TaskChainer.immediate(player.getServer()); } private SnoopyCommandSource(CommandSource output, Vec3 pos, Vec2 rot, ServerLevel world, int level, String simpleName, Component name, MinecraftServer server, @Nullable Entity entity, CommandResultCallback consumer, EntityAnchorArgument.Anchor entityAnchor, CommandSigningContext context, TaskChainer chainer, diff --git a/src/main/java/carpet/script/value/EntityValue.java b/src/main/java/carpet/script/value/EntityValue.java index fb737d0f..c910fe33 100644 --- a/src/main/java/carpet/script/value/EntityValue.java +++ b/src/main/java/carpet/script/value/EntityValue.java @@ -714,7 +714,7 @@ public class EntityValue extends Value { return Value.NULL; } - return new BlockValue(null, sp.serverLevel(), pos); + return new BlockValue(null, sp.level(), pos); } return Value.NULL; }); diff --git a/src/main/java/carpet/script/value/ScreenValue.java b/src/main/java/carpet/script/value/ScreenValue.java index 84b7ef02..9f436eab 100644 --- a/src/main/java/carpet/script/value/ScreenValue.java +++ b/src/main/java/carpet/script/value/ScreenValue.java @@ -200,7 +200,7 @@ public class ScreenValue extends Value this.screenHandler = null; return false; } - int runPermissionLevel = Vanilla.MinecraftServer_getRunPermissionLevel(player.server); + int runPermissionLevel = Vanilla.MinecraftServer_getRunPermissionLevel(player.getServer()); CommandSourceStack source = player.createCommandSourceStack().withPermission(runPermissionLevel); CarpetScriptHost executingHost = appHost.retrieveForExecution(source, player); try From 74e8a8d2eca9e28a67321d6def21cb5a49457471 Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 7 May 2025 19:36:41 +0200 Subject: [PATCH 091/232] 1.4.173 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 2d0a7c01..3ff3b905 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G fabric_version=0.119.5+1.21.5 # Mod Properties - mod_version = 1.4.172 + mod_version = 1.4.173 maven_group = carpet archives_base_name = fabric-carpet From 52cf8c027a90ba80f49d141d993303ce2cd35b9a Mon Sep 17 00:00:00 2001 From: gnembon Date: Tue, 13 May 2025 23:20:31 +0200 Subject: [PATCH 092/232] 25w20a --- gradle.properties | 2 +- .../carpet/commands/PerimeterInfoCommand.java | 2 +- .../mixins/PerfCommand_permissionMixin.java | 16 ++++++++++------ .../mixins/SummonCommand_lightningMixin.java | 4 ++-- .../java/carpet/mixins/Villager_aiMixin.java | 12 ++++++------ .../carpet/script/command/CommandArgument.java | 12 ++++-------- .../java/carpet/script/value/EntityValue.java | 10 +++++----- .../carpet/script/value/ValueConversions.java | 12 ++++++------ src/main/java/carpet/utils/MobAI.java | 2 +- .../java/carpet/utils/PerimeterDiagnostics.java | 2 +- src/main/java/carpet/utils/SpawnReporter.java | 2 +- 11 files changed, 38 insertions(+), 38 deletions(-) diff --git a/gradle.properties b/gradle.properties index 3ff3b905..394b7899 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=25w19a + minecraft_version=25w20a loader_version=0.16.10 jsr305_version=3.0.2 fabric_version=0.119.5+1.21.5 diff --git a/src/main/java/carpet/commands/PerimeterInfoCommand.java b/src/main/java/carpet/commands/PerimeterInfoCommand.java index 7240fc8a..2d9c8174 100644 --- a/src/main/java/carpet/commands/PerimeterInfoCommand.java +++ b/src/main/java/carpet/commands/PerimeterInfoCommand.java @@ -39,7 +39,7 @@ public class PerimeterInfoCommand BlockPosArgument.getSpawnablePos(c, "center position"), null)). then(argument("mob", resource(commandBuildContext, Registries.ENTITY_TYPE)). - suggests(SuggestionProviders.SUMMONABLE_ENTITIES). + suggests(SuggestionProviders.cast(SuggestionProviders.SUMMONABLE_ENTITIES)). executes( (c) -> perimeterDiagnose( c.getSource(), BlockPosArgument.getSpawnablePos(c, "center position"), diff --git a/src/main/java/carpet/mixins/PerfCommand_permissionMixin.java b/src/main/java/carpet/mixins/PerfCommand_permissionMixin.java index a07fdd4d..d0c9f58f 100644 --- a/src/main/java/carpet/mixins/PerfCommand_permissionMixin.java +++ b/src/main/java/carpet/mixins/PerfCommand_permissionMixin.java @@ -1,20 +1,24 @@ package carpet.mixins; import carpet.CarpetSettings; -import net.minecraft.commands.CommandSourceStack; +import net.minecraft.commands.Commands; +import net.minecraft.commands.PermissionSource; import net.minecraft.server.commands.PerfCommand; +import net.minecraft.server.commands.PermissionCheck; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import org.spongepowered.asm.mixin.injection.Redirect; @Mixin(PerfCommand.class) public class PerfCommand_permissionMixin { - @Inject(method = "method_37340", at = @At("HEAD"), cancellable = true, remap = false) - private static void canRun(CommandSourceStack source, CallbackInfoReturnable cir) + @Redirect(method = "register", at = @At( + value = "INVOKE", + target = "Lnet/minecraft/commands/Commands;hasPermission(I)Lnet/minecraft/server/commands/PermissionCheck;" + )) + private static PermissionCheck canRun(int i) { - cir.setReturnValue(source.hasPermission(CarpetSettings.perfPermissionLevel)); + return Commands.hasPermission(CarpetSettings.perfPermissionLevel); } } diff --git a/src/main/java/carpet/mixins/SummonCommand_lightningMixin.java b/src/main/java/carpet/mixins/SummonCommand_lightningMixin.java index c8e13dc4..9dee70b4 100644 --- a/src/main/java/carpet/mixins/SummonCommand_lightningMixin.java +++ b/src/main/java/carpet/mixins/SummonCommand_lightningMixin.java @@ -25,9 +25,9 @@ public class SummonCommand_lightningMixin private static BlockPos addRiders(Entity entity) { // [CM] SummonNaturalLightning - if statement around - if (CarpetSettings.summonNaturalLightning && entity instanceof LightningBolt && !entity.getCommandSenderWorld().isClientSide) + if (CarpetSettings.summonNaturalLightning && entity instanceof LightningBolt && !entity.level().isClientSide) { - ServerLevel world = (ServerLevel) entity.getCommandSenderWorld(); + ServerLevel world = (ServerLevel) entity.level(); BlockPos at = entity.blockPosition(); DifficultyInstance localDifficulty_1 = world.getCurrentDifficultyAt(at); boolean boolean_2 = world.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && world.random.nextDouble() < (double)localDifficulty_1.getEffectiveDifficulty() * 0.01D; diff --git a/src/main/java/carpet/mixins/Villager_aiMixin.java b/src/main/java/carpet/mixins/Villager_aiMixin.java index ea0a0b1e..2829f9ac 100644 --- a/src/main/java/carpet/mixins/Villager_aiMixin.java +++ b/src/main/java/carpet/mixins/Villager_aiMixin.java @@ -127,7 +127,7 @@ public abstract class Villager_aiMixin extends AbstractVillager if (bedPos == null || bedPos.dimension() != level().dimension()) // get Dimension { setUnhappy(); - ((ServerLevel) getCommandSenderWorld()).sendParticles(new BlockParticleOption(ParticleTypes.BLOCK_MARKER, Blocks.BARRIER.defaultBlockState()), getX(), getY() + getEyeHeight() + 1, getZ(), 1, 0.1, 0.1, 0.1, 0.0); + ((ServerLevel) level()).sendParticles(new BlockParticleOption(ParticleTypes.BLOCK_MARKER, Blocks.BARRIER.defaultBlockState()), getX(), getY() + getEyeHeight() + 1, getZ(), 1, 0.1, 0.1, 0.1, 0.0); } else { @@ -142,7 +142,7 @@ public abstract class Villager_aiMixin extends AbstractVillager } else if (itemStack_1.getItem() instanceof BedItem) { - List list_1 = ((ServerLevel) getCommandSenderWorld()).getPoiManager().getInRange( + List list_1 = ((ServerLevel) level()).getPoiManager().getInRange( type -> type.is(PoiTypes.HOME), blockPosition(), 48, PoiManager.Occupancy.ANY).toList(); @@ -151,16 +151,16 @@ public abstract class Villager_aiMixin extends AbstractVillager Vec3 pv = Vec3.atCenterOf(poi.getPos()); if (!poi.hasSpace()) { - ((ServerLevel) getCommandSenderWorld()).sendParticles(ParticleTypes.HAPPY_VILLAGER, + ((ServerLevel) level()).sendParticles(ParticleTypes.HAPPY_VILLAGER, pv.x, pv.y+1.5, pv.z, 50, 0.1, 0.3, 0.1, 0.0); } else if (canReachHome((Villager)(Object)this, poi.getPos(), poi)) - ((ServerLevel) getCommandSenderWorld()).sendParticles(ParticleTypes.END_ROD, + ((ServerLevel) level()).sendParticles(ParticleTypes.END_ROD, pv.x, pv.y+1, pv.z, 50, 0.1, 0.3, 0.1, 0.0); else - ((ServerLevel) getCommandSenderWorld()).sendParticles(new BlockParticleOption(ParticleTypes.BLOCK_MARKER, Blocks.BARRIER.defaultBlockState()), + ((ServerLevel) level()).sendParticles(new BlockParticleOption(ParticleTypes.BLOCK_MARKER, Blocks.BARRIER.defaultBlockState()), pv.x, pv.y+1, pv.z, 1, 0.1, 0.1, 0.1, 0.0); } @@ -186,7 +186,7 @@ public abstract class Villager_aiMixin extends AbstractVillager { if (MobAI.isTracking(this, MobAI.TrackingType.IRON_GOLEM_SPAWNING)) { - ((ServerLevel) getCommandSenderWorld()).sendParticles(new BlockParticleOption(ParticleTypes.BLOCK_MARKER, Blocks.BARRIER.defaultBlockState()), getX(), getY()+3, getZ(), 1, 0.1, 0.1, 0.1, 0.0); + ((ServerLevel) level()).sendParticles(new BlockParticleOption(ParticleTypes.BLOCK_MARKER, Blocks.BARRIER.defaultBlockState()), getX(), getY()+3, getZ(), 1, 0.1, 0.1, 0.1, 0.0); } } diff --git a/src/main/java/carpet/script/command/CommandArgument.java b/src/main/java/carpet/script/command/CommandArgument.java index a4c29a99..78310667 100644 --- a/src/main/java/carpet/script/command/CommandArgument.java +++ b/src/main/java/carpet/script/command/CommandArgument.java @@ -162,7 +162,7 @@ public abstract class CommandArgument (c, p) -> StringValue.of(EntityAnchorArgument.getAnchor(c, p).name()), false ), new VanillaUnconfigurableArgument("entitytype", c -> ResourceArgument.resource(c, Registries.ENTITY_TYPE), - (c, p) -> ValueConversions.of(ResourceArgument.getSummonableEntityType(c, p).key()), SuggestionProviders.SUMMONABLE_ENTITIES + (c, p) -> ValueConversions.of(ResourceArgument.getSummonableEntityType(c, p).key()), SuggestionProviders.cast(SuggestionProviders.SUMMONABLE_ENTITIES) ), new VanillaUnconfigurableArgument("floatrange", RangeArgument::floatRange, (c, p) -> ValueConversions.of(c.getArgument(p, MinMaxBounds.Doubles.class)), true @@ -205,12 +205,8 @@ public abstract class CommandArgument new VanillaUnconfigurableArgument("recipe", Registries.RECIPE), new VanillaUnconfigurableArgument("advancement", Registries.ADVANCEMENT), - new VanillaUnconfigurableArgument("lootcondition", ResourceLocationArgument::id, - (c, p) -> ValueConversions.of(ResourceLocationArgument.getId(c, p)), (ctx, builder) -> SharedSuggestionProvider.suggestResource(ctx.getSource().getServer().reloadableRegistries().getKeys(Registries.LOOT_CONDITION_TYPE), builder) - ), - new VanillaUnconfigurableArgument("loottable", ResourceLocationArgument::id, - (c, p) -> ValueConversions.of(ResourceLocationArgument.getId(c, p)), LootCommand.SUGGEST_LOOT_TABLE - ), + new VanillaUnconfigurableArgument("lootcondition", Registries.LOOT_CONDITION_TYPE), + new VanillaUnconfigurableArgument("loottable", Registries.LOOT_TABLE), new VanillaUnconfigurableArgument("attribute", Registries.ATTRIBUTE), new VanillaUnconfigurableArgument("boss", ResourceLocationArgument::id, @@ -233,7 +229,7 @@ public abstract class CommandArgument }, (ctx, builder) -> SharedSuggestionProvider.suggestResource(ctx.getSource().getServer().registryAccess().lookupOrThrow(Registries.BIOME).keySet(), builder) ), new VanillaUnconfigurableArgument("sound", ResourceLocationArgument::id, - (c, p) -> ValueConversions.of(ResourceLocationArgument.getId(c, p)), SuggestionProviders.AVAILABLE_SOUNDS + (c, p) -> ValueConversions.of(ResourceLocationArgument.getId(c, p)), SuggestionProviders.cast(SuggestionProviders.AVAILABLE_SOUNDS) ), new VanillaUnconfigurableArgument("storekey", ResourceLocationArgument::id, (c, p) -> ValueConversions.of(ResourceLocationArgument.getId(c, p)), (ctx, builder) -> SharedSuggestionProvider.suggestResource(ctx.getSource().getServer().getCommandStorage().keys(), builder) diff --git a/src/main/java/carpet/script/value/EntityValue.java b/src/main/java/carpet/script/value/EntityValue.java index c910fe33..64e06dfb 100644 --- a/src/main/java/carpet/script/value/EntityValue.java +++ b/src/main/java/carpet/script/value/EntityValue.java @@ -573,7 +573,7 @@ public class EntityValue extends Value { return Value.NULL; } - return ValueConversions.fromPath((ServerLevel) e.getCommandSenderWorld(), path); + return ValueConversions.fromPath((ServerLevel) e.level(), path); } return Value.NULL; }); @@ -624,7 +624,7 @@ public class EntityValue extends Value { return StringValue.of(moddedType); } - MinecraftServer server = p.getCommandSenderWorld().getServer(); + MinecraftServer server = p.level().getServer(); if (server.isDedicatedServer()) { return new StringValue("multiplayer"); @@ -829,7 +829,7 @@ public class EntityValue extends Value case MISS: return Value.NULL; case BLOCK: - return new BlockValue((ServerLevel) e.getCommandSenderWorld(), ((BlockHitResult) hitres).getBlockPos()); + return new BlockValue((ServerLevel) e.level(), ((BlockHitResult) hitres).getBlockPos()); case ENTITY: return new EntityValue(((EntityHitResult) hitres).getEntity()); } @@ -927,7 +927,7 @@ public class EntityValue extends Value } else { - ((ServerLevel) e.getCommandSenderWorld()).getChunkSource().broadcastAndSend(e, ClientboundEntityPositionSyncPacket.of(e)); + ((ServerLevel) e.level()).getChunkSource().broadcastAndSend(e, ClientboundEntityPositionSyncPacket.of(e)); } } } @@ -1376,7 +1376,7 @@ public class EntityValue extends Value List params = lv.getItems(); Vector3Argument blockLocator = Vector3Argument.findIn(params, 0, false, false); BlockPos pos = BlockPos.containing(blockLocator.vec); - ResourceKey world = spe.getCommandSenderWorld().dimension(); + ResourceKey world = spe.level().dimension(); float angle = spe.getYHeadRot(); boolean forced = false; if (params.size() > blockLocator.offset) diff --git a/src/main/java/carpet/script/value/ValueConversions.java b/src/main/java/carpet/script/value/ValueConversions.java index 23c7536e..f9622974 100644 --- a/src/main/java/carpet/script/value/ValueConversions.java +++ b/src/main/java/carpet/script/value/ValueConversions.java @@ -144,7 +144,7 @@ public class ValueConversions { if (dimensionValue instanceof EntityValue) { - return ((EntityValue) dimensionValue).getEntity().getCommandSenderWorld(); + return ((EntityValue) dimensionValue).getEntity().level(); } else if (dimensionValue instanceof BlockValue bv) { @@ -265,7 +265,7 @@ public class ValueConversions } if (v instanceof final BlockPos pos) { - return new BlockValue(null, (ServerLevel) e.getCommandSenderWorld(), pos); + return new BlockValue(null, (ServerLevel) e.level(), pos); } if (v instanceof final Number number) { @@ -277,7 +277,7 @@ public class ValueConversions } if (v instanceof final UUID uuid) { - return ofUUID((ServerLevel) e.getCommandSenderWorld(), uuid); + return ofUUID((ServerLevel) e.level(), uuid); } if (v instanceof final DamageSource source) { @@ -288,16 +288,16 @@ public class ValueConversions } if (v instanceof final Path path) { - return fromPath((ServerLevel) e.getCommandSenderWorld(), path); + return fromPath((ServerLevel) e.level(), path); } if (v instanceof final PositionTracker tracker) { - return new BlockValue(null, (ServerLevel) e.getCommandSenderWorld(), tracker.currentBlockPosition()); + return new BlockValue(null, (ServerLevel) e.level(), tracker.currentBlockPosition()); } if (v instanceof final WalkTarget target) { return ListValue.of( - new BlockValue(null, (ServerLevel) e.getCommandSenderWorld(), target.getTarget().currentBlockPosition()), + new BlockValue(null, (ServerLevel) e.level(), target.getTarget().currentBlockPosition()), new NumericValue(target.getSpeedModifier()), new NumericValue(target.getCloseEnoughDist()) ); diff --git a/src/main/java/carpet/utils/MobAI.java b/src/main/java/carpet/utils/MobAI.java index 5063b879..193b1565 100644 --- a/src/main/java/carpet/utils/MobAI.java +++ b/src/main/java/carpet/utils/MobAI.java @@ -30,7 +30,7 @@ public class MobAI public static boolean isTracking(Entity e, TrackingType type) { - if (e.getCommandSenderWorld().isClientSide()) + if (e.level().isClientSide()) return false; Set currentTrackers = aiTrackers.get(e.getType()); if (currentTrackers == null) diff --git a/src/main/java/carpet/utils/PerimeterDiagnostics.java b/src/main/java/carpet/utils/PerimeterDiagnostics.java index c36f17f6..439f505a 100644 --- a/src/main/java/carpet/utils/PerimeterDiagnostics.java +++ b/src/main/java/carpet/utils/PerimeterDiagnostics.java @@ -182,7 +182,7 @@ public class PerimeterDiagnostics { el.snapTo(pos.getX() + 0.5F, pos.getY(), pos.getZ()+0.5F, 0.0F, 0.0F); return el.checkSpawnObstruction(worldServer) && el.checkSpawnRules(worldServer, EntitySpawnReason.NATURAL) && - SpawnPlacements.checkSpawnRules(el.getType(),(ServerLevel)el.getCommandSenderWorld(), EntitySpawnReason.NATURAL, el.blockPosition(), el.getCommandSenderWorld().random) && + SpawnPlacements.checkSpawnRules(el.getType(),(ServerLevel)el.level(), EntitySpawnReason.NATURAL, el.blockPosition(), el.level().random) && worldServer.noCollision(el); // check collision rules once they stop fiddling with them after 1.14.1 } return false; diff --git a/src/main/java/carpet/utils/SpawnReporter.java b/src/main/java/carpet/utils/SpawnReporter.java index 4c96755d..3c086e4f 100644 --- a/src/main/java/carpet/utils/SpawnReporter.java +++ b/src/main/java/carpet/utils/SpawnReporter.java @@ -382,7 +382,7 @@ public class SpawnReporter } if (entity instanceof Ocelot) { - for (Entity e: entity.getCommandSenderWorld().getEntities(entity, entity.getBoundingBox())) + for (Entity e: entity.level().getEntities(entity, entity.getBoundingBox())) { e.discard(); } From bc42949e0fb2c2f3a7e1a035ca665d8466650cf0 Mon Sep 17 00:00:00 2001 From: gnembon Date: Tue, 13 May 2025 23:21:12 +0200 Subject: [PATCH 093/232] 1.4.174 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 394b7899..205c470a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G fabric_version=0.119.5+1.21.5 # Mod Properties - mod_version = 1.4.173 + mod_version = 1.4.174 maven_group = carpet archives_base_name = fabric-carpet From c34751b365b5783ec985692a2a1954f7312e080b Mon Sep 17 00:00:00 2001 From: replaceitem <40722305+replaceitem@users.noreply.github.com> Date: Fri, 9 May 2025 19:17:44 +0200 Subject: [PATCH 094/232] Fixed scarpet entity value querying invulnerable for players --- src/main/java/carpet/script/value/EntityValue.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/carpet/script/value/EntityValue.java b/src/main/java/carpet/script/value/EntityValue.java index 64e06dfb..07c4d371 100644 --- a/src/main/java/carpet/script/value/EntityValue.java +++ b/src/main/java/carpet/script/value/EntityValue.java @@ -501,7 +501,7 @@ public class EntityValue extends Value put("immune_to_fire", (e, a) -> BooleanValue.of(e.fireImmune())); put("immune_to_frost", (e, a) -> BooleanValue.of(!e.canFreeze())); - put("invulnerable", (e, a) -> BooleanValue.of(e.isInvulnerable())); + put("invulnerable", (e, a) -> BooleanValue.of(e instanceof Player player ? player.getAbilities().invulnerable : e.isInvulnerable())); put("dimension", (e, a) -> nameFromRegistryId(e.level().dimension().location())); // getDimId put("height", (e, a) -> new NumericValue(e.getDimensions(Pose.STANDING).height())); put("width", (e, a) -> new NumericValue(e.getDimensions(Pose.STANDING).width())); From 9ede99f6daabfd0888cbba7287a6d1c220bed37d Mon Sep 17 00:00:00 2001 From: gnembon Date: Tue, 20 May 2025 19:21:26 +0200 Subject: [PATCH 095/232] 25w21a --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 205c470a..77b563a4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=25w20a + minecraft_version=25w21a loader_version=0.16.10 jsr305_version=3.0.2 fabric_version=0.119.5+1.21.5 From aae9640655415ff734be43fa1ff7ffaf723d1abe Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 28 May 2025 22:20:19 +0200 Subject: [PATCH 096/232] 1.21.6 pre 1 --- gradle.properties | 4 ++-- .../mixins/Connection_packetCounterMixin.java | 3 ++- .../mixins/ServerPlayer_scarpetEventMixin.java | 4 ++-- .../mixins/StructureBlockEntity_limitsMixin.java | 13 +++++++++---- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/gradle.properties b/gradle.properties index 77b563a4..7f65c5c8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=25w21a + minecraft_version=1.21.6-pre1 loader_version=0.16.10 jsr305_version=3.0.2 fabric_version=0.119.5+1.21.5 @@ -17,7 +17,7 @@ org.gradle.jvmargs=-Xmx1G # The Curseforge versions "names" or ids for the main branch (comma separated: 1.16.4,1.16.5) # This is needed because CF uses too vague names for prereleases and release candidates # Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN] - release-curse-versions = Minecraft 1.21:1.21.5-Snapshot + release-curse-versions = Minecraft 1.21:1.21.6-Snapshot # Whether or not to build another branch on release release-extra-branch = false # The name of the second branch to release diff --git a/src/main/java/carpet/mixins/Connection_packetCounterMixin.java b/src/main/java/carpet/mixins/Connection_packetCounterMixin.java index c7159e73..3be41624 100644 --- a/src/main/java/carpet/mixins/Connection_packetCounterMixin.java +++ b/src/main/java/carpet/mixins/Connection_packetCounterMixin.java @@ -3,6 +3,7 @@ package carpet.mixins; import carpet.fakes.ClientConnectionInterface; import carpet.logging.logHelpers.PacketCounter; import io.netty.channel.Channel; +import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelHandlerContext; import io.netty.util.concurrent.Future; import io.netty.util.concurrent.GenericFutureListener; @@ -28,7 +29,7 @@ public abstract class Connection_packetCounterMixin implements ClientConnectionI // Add to the packet counter whenever a packet is sent. @Inject(method = "sendPacket", at = @At("HEAD")) - private void packetOutCount(final Packet packet, final PacketSendListener packetSendListener, final boolean bl, final CallbackInfo ci) + private void packetOutCount(Packet packet, ChannelFutureListener channelFutureListener, boolean bl, CallbackInfo ci) { PacketCounter.totalOut++; } diff --git a/src/main/java/carpet/mixins/ServerPlayer_scarpetEventMixin.java b/src/main/java/carpet/mixins/ServerPlayer_scarpetEventMixin.java index 2a0e7e49..372a01b0 100644 --- a/src/main/java/carpet/mixins/ServerPlayer_scarpetEventMixin.java +++ b/src/main/java/carpet/mixins/ServerPlayer_scarpetEventMixin.java @@ -38,8 +38,8 @@ public abstract class ServerPlayer_scarpetEventMixin extends Player implements S @Unique private boolean isInvalidReference = false; - public ServerPlayer_scarpetEventMixin(Level level, BlockPos blockPos, float f, GameProfile gameProfile) { - super(level, blockPos, f, gameProfile); + public ServerPlayer_scarpetEventMixin(Level level, GameProfile gameProfile) { + super(level, gameProfile); } //@Shadow protected abstract void completeUsingItem(); diff --git a/src/main/java/carpet/mixins/StructureBlockEntity_limitsMixin.java b/src/main/java/carpet/mixins/StructureBlockEntity_limitsMixin.java index 84081048..cf47efba 100644 --- a/src/main/java/carpet/mixins/StructureBlockEntity_limitsMixin.java +++ b/src/main/java/carpet/mixins/StructureBlockEntity_limitsMixin.java @@ -9,6 +9,9 @@ import org.spongepowered.asm.mixin.injection.Constant; import org.spongepowered.asm.mixin.injection.ModifyArg; import org.spongepowered.asm.mixin.injection.ModifyConstant; +import java.util.List; +import java.util.stream.Stream; + @Mixin(StructureBlockEntity.class) public abstract class StructureBlockEntity_limitsMixin { @@ -29,14 +32,16 @@ public abstract class StructureBlockEntity_limitsMixin } @ModifyArg( - method = "saveStructure(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/resources/ResourceLocation;Lnet/minecraft/core/BlockPos;Lnet/minecraft/core/Vec3i;ZLjava/lang/String;Z)Z", + method = "saveStructure(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/resources/ResourceLocation;Lnet/minecraft/core/BlockPos;Lnet/minecraft/core/Vec3i;ZLjava/lang/String;ZLjava/util/List;)Z", at = @At( value = "INVOKE", - target = "Lnet/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate;fillFromWorld(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/core/Vec3i;ZLnet/minecraft/world/level/block/Block;)V" + target = "Lnet/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate;fillFromWorld(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/core/Vec3i;ZLjava/util/List;)V" ), index = 4 ) - private static Block ignoredBlock(Block original) { - return CarpetSettings.structureBlockIgnoredBlock; + private static List ignoredBlock(List original) { + if (original.contains(CarpetSettings.structureBlockIgnoredBlock)) + return original; + return Stream.concat(original.stream(), Stream.of(CarpetSettings.structureBlockIgnoredBlock)).toList(); } } From 5f9744e065242643b3307c720c4961480f3b4c20 Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 28 May 2025 22:21:06 +0200 Subject: [PATCH 097/232] 1.4.175 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 7f65c5c8..6c98ee43 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G fabric_version=0.119.5+1.21.5 # Mod Properties - mod_version = 1.4.174 + mod_version = 1.4.175 maven_group = carpet archives_base_name = fabric-carpet From 4afa315bbecdf65c5f04ca49e79479a21aed3245 Mon Sep 17 00:00:00 2001 From: gnembon Date: Tue, 17 Jun 2025 21:05:47 +0200 Subject: [PATCH 098/232] 1.21.6 --- gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 6c98ee43..45ffd457 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=1.21.6-pre1 + minecraft_version=1.21.6 loader_version=0.16.10 jsr305_version=3.0.2 fabric_version=0.119.5+1.21.5 @@ -17,7 +17,7 @@ org.gradle.jvmargs=-Xmx1G # The Curseforge versions "names" or ids for the main branch (comma separated: 1.16.4,1.16.5) # This is needed because CF uses too vague names for prereleases and release candidates # Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN] - release-curse-versions = Minecraft 1.21:1.21.6-Snapshot + release-curse-versions = Minecraft 1.21:1.21.6 # Whether or not to build another branch on release release-extra-branch = false # The name of the second branch to release From d3d874eb70e9e46a707325f4a8567511229d2e12 Mon Sep 17 00:00:00 2001 From: gnembon Date: Tue, 17 Jun 2025 21:06:43 +0200 Subject: [PATCH 099/232] 1.4.176 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 45ffd457..5365ce1e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G fabric_version=0.119.5+1.21.5 # Mod Properties - mod_version = 1.4.175 + mod_version = 1.4.176 maven_group = carpet archives_base_name = fabric-carpet From f8cba9f8626573ea5d202b202503c0f38dd804e4 Mon Sep 17 00:00:00 2001 From: Tom Albrecht Date: Sat, 21 Jun 2025 20:22:19 +0200 Subject: [PATCH 100/232] Fix: Compatibility with polymers moving element holders (#2079) --- .../PistonBaseBlock_movableBEMixin.java | 37 +++++-------------- 1 file changed, 9 insertions(+), 28 deletions(-) diff --git a/src/main/java/carpet/mixins/PistonBaseBlock_movableBEMixin.java b/src/main/java/carpet/mixins/PistonBaseBlock_movableBEMixin.java index ef1a2d3e..8be79845 100644 --- a/src/main/java/carpet/mixins/PistonBaseBlock_movableBEMixin.java +++ b/src/main/java/carpet/mixins/PistonBaseBlock_movableBEMixin.java @@ -3,6 +3,9 @@ package carpet.mixins; import carpet.CarpetSettings; import carpet.fakes.PistonBlockEntityInterface; import com.google.common.collect.Lists; +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; +import com.llamalad7.mixinextras.sugar.Local; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.level.Level; @@ -11,7 +14,6 @@ import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.CommandBlock; import net.minecraft.world.level.block.DirectionalBlock; import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.block.piston.MovingPistonBlock; import net.minecraft.world.level.block.piston.PistonBaseBlock; import net.minecraft.world.level.block.piston.PistonStructureResolver; import net.minecraft.world.level.block.state.BlockState; @@ -105,35 +107,14 @@ public abstract class PistonBaseBlock_movableBEMixin extends DirectionalBlock } } } - - @Inject(method = "moveBlocks", at = @At(value = "INVOKE", shift = At.Shift.BEFORE, - target = "Lnet/minecraft/world/level/Level;setBlockEntity(Lnet/minecraft/world/level/block/entity/BlockEntity;)V", ordinal = 0), - locals = LocalCapture.CAPTURE_FAILHARD) - private void setBlockEntityWithCarried(Level world_1, BlockPos blockPos_1, Direction direction_1, boolean boolean_1, - CallbackInfoReturnable cir, BlockPos blockPos_2, PistonStructureResolver pistonHandler_1, Map map_1, List list_1, - List list_2, List list_3, BlockState[] blockStates_1, Direction direction_2, int int_2, - int int_3, BlockPos blockPos_4, BlockState blockState9, BlockState blockState4) - { - BlockEntity blockEntityPiston = MovingPistonBlock.newMovingBlockEntity(blockPos_4, blockState4, list_2.get(int_3), - direction_1, boolean_1, false); - if (CarpetSettings.movableBlockEntities) - ((PistonBlockEntityInterface) blockEntityPiston).setCarriedBlockEntity(list1_BlockEntities.get().get(int_3)); - world_1.setBlockEntity(blockEntityPiston); - //world_1.setBlockEntity(blockPos_4, blockEntityPiston); - } - - @Redirect(method = "moveBlocks", at = @At(value = "INVOKE", + + @WrapOperation(method = "moveBlocks", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;setBlockEntity(Lnet/minecraft/world/level/block/entity/BlockEntity;)V", ordinal = 0)) - private void dontDoAnything(Level world, BlockEntity blockEntity) + private void setCarriedOnMove(Level instance, BlockEntity blockEntity, Operation original, @Local(ordinal = 1) int int_3) { - } - - @Redirect(method = "moveBlocks", at = @At(value = "INVOKE", - target = "Lnet/minecraft/world/level/block/piston/MovingPistonBlock;newMovingBlockEntity(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/core/Direction;ZZ)Lnet/minecraft/world/level/block/entity/BlockEntity;", - ordinal = 0)) - private BlockEntity returnNull(BlockPos blockPos, BlockState blockState, BlockState blockState2, Direction direction, boolean bl, boolean bl2) - { - return null; + if (CarpetSettings.movableBlockEntities) + ((PistonBlockEntityInterface) blockEntity).setCarriedBlockEntity(list1_BlockEntities.get().get(int_3)); + original.call(instance, blockEntity); } } From 209596f6ee363f324d44469bd3e20ae8cb56c029 Mon Sep 17 00:00:00 2001 From: altrisi Date: Sat, 21 Jun 2025 20:41:13 +0200 Subject: [PATCH 101/232] Replace ThreadLocal with `@Share` injected local variable --- .../mixins/PistonBaseBlock_movableBEMixin.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main/java/carpet/mixins/PistonBaseBlock_movableBEMixin.java b/src/main/java/carpet/mixins/PistonBaseBlock_movableBEMixin.java index 8be79845..17819ff4 100644 --- a/src/main/java/carpet/mixins/PistonBaseBlock_movableBEMixin.java +++ b/src/main/java/carpet/mixins/PistonBaseBlock_movableBEMixin.java @@ -6,6 +6,9 @@ import com.google.common.collect.Lists; import com.llamalad7.mixinextras.injector.wrapoperation.Operation; import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; import com.llamalad7.mixinextras.sugar.Local; +import com.llamalad7.mixinextras.sugar.Share; +import com.llamalad7.mixinextras.sugar.ref.LocalRef; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.level.Level; @@ -35,8 +38,6 @@ public abstract class PistonBaseBlock_movableBEMixin extends DirectionalBlock { super(block$Settings_1); } - - private ThreadLocal> list1_BlockEntities = new ThreadLocal<>(); //Unneccessary ThreadLocal if client and server use different PistonBlock instances @Inject(method = "isPushable", cancellable = true, at = @At(value = "RETURN", ordinal = 3, shift = At.Shift.BEFORE)) private static void movableCMD(BlockState blockState_1, Level world_1, BlockPos blockPos_1, @@ -86,17 +87,17 @@ public abstract class PistonBaseBlock_movableBEMixin extends DirectionalBlock private void onMove(Level world_1, BlockPos blockPos_1, Direction direction_1, boolean boolean_1, CallbackInfoReturnable cir, BlockPos blockPos_2, PistonStructureResolver pistonHandler_1, Map map_1, List list_1, List list_2, List list_3, BlockState[] blockStates_1, - Direction direction_2, int int_2) + Direction direction_2, int int_2, @Share("blockEntities") LocalRef> blockEntities) { //Get the blockEntities and remove them from the world before any magic starts to happen if (CarpetSettings.movableBlockEntities) { - list1_BlockEntities.set(Lists.newArrayList()); + blockEntities.set(Lists.newArrayList()); for (int i = 0; i < list_1.size(); ++i) { BlockPos blockpos = list_1.get(i); BlockEntity blockEntity = (list_2.get(i).hasBlockEntity()) ? world_1.getBlockEntity(blockpos) : null; - list1_BlockEntities.get().add(blockEntity); + blockEntities.get().add(blockEntity); if (blockEntity != null) { //hopefully this call won't have any side effects in the future, such as dropping all the BlockEntity's items @@ -111,10 +112,11 @@ public abstract class PistonBaseBlock_movableBEMixin extends DirectionalBlock @WrapOperation(method = "moveBlocks", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;setBlockEntity(Lnet/minecraft/world/level/block/entity/BlockEntity;)V", ordinal = 0)) - private void setCarriedOnMove(Level instance, BlockEntity blockEntity, Operation original, @Local(ordinal = 1) int int_3) + private void setCarriedOnMove(Level instance, BlockEntity blockEntity, Operation original, + @Local(ordinal = 1) int index, @Share("blockEntities") LocalRef> blockEntities) { if (CarpetSettings.movableBlockEntities) - ((PistonBlockEntityInterface) blockEntity).setCarriedBlockEntity(list1_BlockEntities.get().get(int_3)); + ((PistonBlockEntityInterface) blockEntity).setCarriedBlockEntity(blockEntities.get().get(index)); original.call(instance, blockEntity); } } From 9db103aca339ee69ddd89fd8e9ce7a39b3f65046 Mon Sep 17 00:00:00 2001 From: altrisi Date: Sat, 21 Jun 2025 20:47:39 +0200 Subject: [PATCH 102/232] Disable movableBlockEntities support for sculk sensors Closes #1473 --- .../java/carpet/mixins/PistonBaseBlock_movableBEMixin.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/carpet/mixins/PistonBaseBlock_movableBEMixin.java b/src/main/java/carpet/mixins/PistonBaseBlock_movableBEMixin.java index 17819ff4..5cc5ba95 100644 --- a/src/main/java/carpet/mixins/PistonBaseBlock_movableBEMixin.java +++ b/src/main/java/carpet/mixins/PistonBaseBlock_movableBEMixin.java @@ -56,7 +56,8 @@ public abstract class PistonBaseBlock_movableBEMixin extends DirectionalBlock //Making PISTON_EXTENSION (BlockPistonMoving) pushable would not work as its createNewTileEntity()-method returns null return block != Blocks.ENDER_CHEST && block != Blocks.ENCHANTING_TABLE && block != Blocks.END_GATEWAY && block != Blocks.END_PORTAL && block != Blocks.MOVING_PISTON && - block != Blocks.SPAWNER; + block != Blocks.SPAWNER + && block != Blocks.SCULK_SENSOR && block != Blocks.CALIBRATED_SCULK_SENSOR; // these have weird behaviour and crashes, #1473, also #1885 } @Redirect(method = "isPushable", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/state/BlockState;hasBlockEntity()Z")) From 3cd96cc69629a7a50bfe1222fdad475730457bb7 Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 25 Jun 2025 23:26:03 +0200 Subject: [PATCH 103/232] 1.21.7-rc1 --- gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 5365ce1e..751e7b1f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=1.21.6 + minecraft_version=1.21.7-rc1 loader_version=0.16.10 jsr305_version=3.0.2 fabric_version=0.119.5+1.21.5 @@ -17,7 +17,7 @@ org.gradle.jvmargs=-Xmx1G # The Curseforge versions "names" or ids for the main branch (comma separated: 1.16.4,1.16.5) # This is needed because CF uses too vague names for prereleases and release candidates # Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN] - release-curse-versions = Minecraft 1.21:1.21.6 + release-curse-versions = Minecraft 1.21:1.21.7-Snapshot # Whether or not to build another branch on release release-extra-branch = false # The name of the second branch to release From e5d2c48db345be212f110d8a510d7e7760842432 Mon Sep 17 00:00:00 2001 From: gnembon Date: Mon, 30 Jun 2025 21:16:12 +0200 Subject: [PATCH 104/232] 1.21.7 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 751e7b1f..60893ef9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=1.21.7-rc1 + minecraft_version=1.21.7 loader_version=0.16.10 jsr305_version=3.0.2 fabric_version=0.119.5+1.21.5 From ac6ac98e9d06ee4b35bf3e2a4dbbbd6bd28695d2 Mon Sep 17 00:00:00 2001 From: gnembon Date: Mon, 30 Jun 2025 21:16:30 +0200 Subject: [PATCH 105/232] 1.4.177 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 60893ef9..d4476b61 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G fabric_version=0.119.5+1.21.5 # Mod Properties - mod_version = 1.4.176 + mod_version = 1.4.177 maven_group = carpet archives_base_name = fabric-carpet From 33c4ec28d9e5b0be09389c366124457c27d93a95 Mon Sep 17 00:00:00 2001 From: gnembon Date: Mon, 30 Jun 2025 21:34:05 +0200 Subject: [PATCH 106/232] curseforge compat --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index d4476b61..8968da5b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ org.gradle.jvmargs=-Xmx1G # The Curseforge versions "names" or ids for the main branch (comma separated: 1.16.4,1.16.5) # This is needed because CF uses too vague names for prereleases and release candidates # Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN] - release-curse-versions = Minecraft 1.21:1.21.7-Snapshot + release-curse-versions = Minecraft 1.21:1.21.7 # Whether or not to build another branch on release release-extra-branch = false # The name of the second branch to release From 27e00903c7ffa1d9a5c1270876d50e6954e4922b Mon Sep 17 00:00:00 2001 From: gnembon Date: Thu, 10 Jul 2025 15:17:25 +0200 Subject: [PATCH 107/232] cleanups --- .../mixins/ServerLevel_scarpetMixin.java | 1 - .../java/carpet/script/ScriptCommand.java | 5 ++- .../java/carpet/script/external/Carpet.java | 1 + .../java/carpet/script/external/Vanilla.java | 39 +++++-------------- .../carpet/script/external/VanillaClient.java | 5 --- .../java/carpet/script/value/EntityValue.java | 15 +++---- 6 files changed, 20 insertions(+), 46 deletions(-) delete mode 100644 src/main/java/carpet/script/external/VanillaClient.java diff --git a/src/main/java/carpet/mixins/ServerLevel_scarpetMixin.java b/src/main/java/carpet/mixins/ServerLevel_scarpetMixin.java index db8d929c..81929187 100644 --- a/src/main/java/carpet/mixins/ServerLevel_scarpetMixin.java +++ b/src/main/java/carpet/mixins/ServerLevel_scarpetMixin.java @@ -78,7 +78,6 @@ public abstract class ServerLevel_scarpetMixin extends Level implements ServerWo case MOB -> this.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? this.getCMDestroyType(GameRules.RULE_MOB_EXPLOSION_DROP_DECAY) : Explosion.BlockInteraction.KEEP; case TNT -> this.getCMDestroyType(GameRules.RULE_TNT_EXPLOSION_DROP_DECAY); case TRIGGER -> Explosion.BlockInteraction.TRIGGER_BLOCK; - default -> throw new IncompatibleClassChangeError(); }; boolean cancelled = EXPLOSION.onExplosion((ServerLevel) (Object) this, entity, null, new Vec3(x, y, z), g, bl, null, null, var10000); diff --git a/src/main/java/carpet/script/ScriptCommand.java b/src/main/java/carpet/script/ScriptCommand.java index 5c73f6b1..8383849a 100644 --- a/src/main/java/carpet/script/ScriptCommand.java +++ b/src/main/java/carpet/script/ScriptCommand.java @@ -16,6 +16,7 @@ import com.mojang.brigadier.suggestion.Suggestions; import com.mojang.brigadier.suggestion.SuggestionsBuilder; import net.minecraft.commands.CommandBuildContext; import net.minecraft.network.chat.Component; +import net.minecraft.world.level.GameRules; import org.apache.commons.lang3.StringUtils; import java.io.IOException; @@ -665,7 +666,7 @@ public class ScriptCommand BoundingBox area = BoundingBox.fromCorners(a, b); CarpetExpression cexpr = new CarpetExpression(host.main, expr, source, origin); int int_1 = area.getXSpan() * area.getYSpan() * area.getZSpan(); // X Y Z - if (int_1 > Vanilla.MinecraftServer_getFillLimit(source.getServer()) ) + if (int_1 > source.getServer().getGameRules().getInt(GameRules.RULE_COMMAND_MODIFICATION_BLOCK_LIMIT)) { Carpet.Messenger_message(source, "r too many blocks to evaluate: " + int_1); return 1; @@ -717,7 +718,7 @@ public class ScriptCommand BoundingBox area = BoundingBox.fromCorners(a, b); CarpetExpression cexpr = new CarpetExpression(host.main, expr, source, origin); int int_1 = area.getXSpan() * area.getYSpan() * area.getZSpan(); - if (int_1 > Vanilla.MinecraftServer_getFillLimit(source.getServer())) + if (int_1 > source.getServer().getGameRules().getInt(GameRules.RULE_COMMAND_MODIFICATION_BLOCK_LIMIT)) { Carpet.Messenger_message(source, "r too many blocks to evaluate: " + int_1); return 1; diff --git a/src/main/java/carpet/script/external/Carpet.java b/src/main/java/carpet/script/external/Carpet.java index a6fdc1c6..223fc98b 100644 --- a/src/main/java/carpet/script/external/Carpet.java +++ b/src/main/java/carpet/script/external/Carpet.java @@ -85,6 +85,7 @@ public class Carpet return () -> CarpetProfiler.end_current_section(token); } + // not needed in vanilla public static void MinecraftServer_addScriptServer(MinecraftServer server, CarpetScriptServer scriptServer) { ((MinecraftServerInterface) server).addScriptServer(scriptServer); diff --git a/src/main/java/carpet/script/external/Vanilla.java b/src/main/java/carpet/script/external/Vanilla.java index fc5b338b..942157b6 100644 --- a/src/main/java/carpet/script/external/Vanilla.java +++ b/src/main/java/carpet/script/external/Vanilla.java @@ -1,23 +1,7 @@ package carpet.script.external; import carpet.CarpetSettings; -import carpet.fakes.BiomeInterface; -import carpet.fakes.BlockPredicateInterface; -import carpet.fakes.BlockStateArgumentInterface; -import carpet.fakes.TicketsFetcherInterface; -import carpet.fakes.CommandDispatcherInterface; -import carpet.fakes.EntityInterface; -import carpet.fakes.InventoryBearerInterface; -import carpet.fakes.ItemEntityInterface; -import carpet.fakes.LivingEntityInterface; -import carpet.fakes.MinecraftServerInterface; -import carpet.fakes.MobEntityInterface; -import carpet.fakes.RandomStateVisitorAccessor; -import carpet.fakes.AbstractContainerMenuInterface; -import carpet.fakes.ServerPlayerInterface; -import carpet.fakes.ServerPlayerInteractionManagerInterface; -import carpet.fakes.ServerWorldInterface; -import carpet.fakes.SpawnHelperInnerInterface; +import carpet.fakes.*; import carpet.mixins.Objective_scarpetMixin; import carpet.mixins.PoiRecord_scarpetMixin; import carpet.mixins.Scoreboard_scarpetMixin; @@ -46,7 +30,6 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayerGameMode; import net.minecraft.server.level.Ticket; import net.minecraft.tags.TagKey; -import net.minecraft.util.SortedArraySet; import net.minecraft.world.Container; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; @@ -56,10 +39,10 @@ import net.minecraft.world.entity.ai.goal.GoalSelector; import net.minecraft.world.entity.ai.village.poi.PoiRecord; import net.minecraft.world.entity.animal.horse.AbstractHorse; import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.food.FoodData; import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.DataSlot; import net.minecraft.world.level.ChunkPos; -import net.minecraft.world.level.GameRules; import net.minecraft.world.level.NaturalSpawner; import net.minecraft.world.level.PotentialCalculator; import net.minecraft.world.level.biome.Biome; @@ -207,11 +190,6 @@ public class Vanilla return ((ServerPlayerInterface) player).isInvalidEntityObject(); } - public static String ServerPlayer_getLanguage(ServerPlayer player) - { - return player.clientInformation().language(); - } - public static GoalSelector Mob_getAI(Mob mob, boolean target) { return ((MobEntityInterface) mob).getAI(target); @@ -322,11 +300,6 @@ public class Vanilla return CommandHelper.canUseCommand(player, CarpetSettings.commandScript); } - public static int MinecraftServer_getFillLimit(MinecraftServer server) - { - return server.getGameRules().getInt(GameRules.RULE_COMMAND_MODIFICATION_BLOCK_LIMIT); - } - public static int PoiRecord_getFreeTickets(PoiRecord record) { return ((PoiRecord_scarpetMixin) record).getFreeTickets(); @@ -337,6 +310,14 @@ public class Vanilla ((PoiRecord_scarpetMixin) record).callAcquireTicket(); } + public static double FoodData_getExhaustion(FoodData foodData) { + return ((FoodDataInterface)foodData).getCMExhaustionLevel(); + } + + public static void FoodData_setExhaustion(FoodData foodData, float exhaustion) { + ((FoodDataInterface)foodData).setExhaustion(exhaustion); + } + public record BlockPredicatePayload(BlockState state, TagKey tagKey, Map properties, CompoundTag tag) { public static BlockPredicatePayload of(Predicate blockPredicate) { diff --git a/src/main/java/carpet/script/external/VanillaClient.java b/src/main/java/carpet/script/external/VanillaClient.java deleted file mode 100644 index 86a0086c..00000000 --- a/src/main/java/carpet/script/external/VanillaClient.java +++ /dev/null @@ -1,5 +0,0 @@ -package carpet.script.external; - -public class VanillaClient -{ -} diff --git a/src/main/java/carpet/script/value/EntityValue.java b/src/main/java/carpet/script/value/EntityValue.java index 07c4d371..f6188f45 100644 --- a/src/main/java/carpet/script/value/EntityValue.java +++ b/src/main/java/carpet/script/value/EntityValue.java @@ -1,6 +1,5 @@ package carpet.script.value; -import carpet.fakes.FoodDataInterface; import carpet.script.external.Vanilla; import carpet.script.utils.Tracer; import carpet.script.CarpetContext; @@ -27,11 +26,9 @@ import net.minecraft.core.registries.Registries; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.StringTag; import net.minecraft.network.protocol.game.ClientboundEntityPositionSyncPacket; -import net.minecraft.network.protocol.game.ClientboundMoveEntityPacket; import net.minecraft.network.protocol.game.ClientboundSetExperiencePacket; import net.minecraft.network.protocol.game.ClientboundSetHeldSlotPacket; import net.minecraft.network.protocol.game.ClientboundSetPassengersPacket; -import net.minecraft.network.protocol.game.ClientboundTeleportEntityPacket; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.MinecraftServer; @@ -53,8 +50,6 @@ import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.MobCategory; import net.minecraft.world.entity.PathfinderMob; import net.minecraft.world.entity.Pose; -import net.minecraft.world.entity.PositionMoveRotation; -import net.minecraft.world.entity.Relative; import net.minecraft.world.entity.ai.Brain; import net.minecraft.world.entity.ai.attributes.Attribute; import net.minecraft.world.entity.ai.attributes.AttributeMap; @@ -84,7 +79,6 @@ import net.minecraft.world.phys.Vec3; import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Collection; -import java.util.EnumSet; import java.util.HashMap; import java.util.List; import java.util.Locale; @@ -553,11 +547,11 @@ public class EntityValue extends Value put("swimming", (e, a) -> e.isSwimming() ? Value.TRUE : Value.FALSE); put("swinging", (e, a) -> e instanceof LivingEntity le ? BooleanValue.of(le.swinging) : Value.NULL); put("air", (e, a) -> new NumericValue(e.getAirSupply())); - put("language", (e, a) -> !(e instanceof ServerPlayer p) ? NULL : StringValue.of(Vanilla.ServerPlayer_getLanguage(p))); + put("language", (e, a) -> !(e instanceof ServerPlayer p) ? NULL : StringValue.of(p.clientInformation().language())); put("persistence", (e, a) -> e instanceof Mob mob ? BooleanValue.of(mob.isPersistenceRequired()) : Value.NULL); put("hunger", (e, a) -> e instanceof Player player ? new NumericValue(player.getFoodData().getFoodLevel()) : Value.NULL); put("saturation", (e, a) -> e instanceof Player player ? new NumericValue(player.getFoodData().getSaturationLevel()) : Value.NULL); - put("exhaustion", (e, a) -> e instanceof Player player ? new NumericValue(((FoodDataInterface)player.getFoodData()).getCMExhaustionLevel()) : Value.NULL); + put("exhaustion", (e, a) -> e instanceof Player player ? new NumericValue(Vanilla.FoodData_getExhaustion(player.getFoodData())) : Value.NULL); put("absorption", (e, a) -> e instanceof Player player ? new NumericValue(player.getAbsorptionAmount()) : Value.NULL); put("xp", (e, a) -> e instanceof Player player ? new NumericValue(player.totalExperience) : Value.NULL); put("xp_level", (e, a) -> e instanceof Player player ? new NumericValue(player.experienceLevel) : Value.NULL); @@ -1611,7 +1605,10 @@ public class EntityValue extends Value put("exhaustion", (e, v) -> { if (e instanceof Player p) { - ((FoodDataInterface)p.getFoodData()).setExhaustion(NumericValue.asNumber(v).getFloat()); + Vanilla.FoodData_setExhaustion( + p.getFoodData(), + NumericValue.asNumber(v, "exhaustion").getFloat() + ); } }); From 90ba92847951c0ac8180aa7eb0e19edf23b1b999 Mon Sep 17 00:00:00 2001 From: gnembon Date: Thu, 31 Jul 2025 00:05:05 +0200 Subject: [PATCH 108/232] 1.21.8 noop --- gradle.properties | 4 ++-- src/main/java/carpet/script/CarpetEventServer.java | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 8968da5b..ac006952 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,8 +3,8 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=1.21.7 - loader_version=0.16.10 + minecraft_version=1.21.8 + loader_version=0.16.14 jsr305_version=3.0.2 fabric_version=0.119.5+1.21.5 diff --git a/src/main/java/carpet/script/CarpetEventServer.java b/src/main/java/carpet/script/CarpetEventServer.java index b8b5fe7a..6aa33dd3 100644 --- a/src/main/java/carpet/script/CarpetEventServer.java +++ b/src/main/java/carpet/script/CarpetEventServer.java @@ -502,6 +502,7 @@ public class CarpetEventServer ); } }; + // fixme public static final Event CHUNK_GENERATED = new Event("chunk_generated", 2, true) { @Override @@ -513,6 +514,7 @@ public class CarpetEventServer ); } }; + // fixme public static final Event CHUNK_LOADED = new Event("chunk_loaded", 2, true) { @Override From 49840619f53fac864c65fc21d67deca429a3d213 Mon Sep 17 00:00:00 2001 From: gnembon Date: Thu, 31 Jul 2025 01:43:45 +0200 Subject: [PATCH 109/232] encapsulating isClientSide() --- src/main/java/carpet/mixins/AbstractArrowMixin.java | 2 +- .../java/carpet/mixins/ArmorStand_scarpetMarkerMixin.java | 2 +- src/main/java/carpet/mixins/EntityMixin.java | 2 +- .../carpet/mixins/ExperienceOrb_xpNoCooldownMixin.java | 2 +- .../java/carpet/mixins/Explosion_optimizedTntMixin.java | 4 ++-- src/main/java/carpet/mixins/FallingBlockEntityMixin.java | 2 +- .../carpet/mixins/Guardian_renewableSpongesMixin.java | 2 +- .../java/carpet/mixins/LevelChunk_movableBEMixin.java | 2 +- .../mixins/PistonMovingBlockEntity_movableBEMixin.java | 2 +- src/main/java/carpet/mixins/Player_parrotMixin.java | 2 +- .../java/carpet/mixins/Player_scarpetEventsMixin.java | 6 +++--- src/main/java/carpet/mixins/PrimedTntMixin.java | 6 +++--- .../java/carpet/mixins/SummonCommand_lightningMixin.java | 2 +- src/main/java/carpet/mixins/ThrowableProjectileMixin.java | 2 +- .../java/carpet/mixins/WoolCarpetBlock_placeMixin.java | 2 +- src/main/java/carpet/utils/CarpetProfiler.java | 8 ++++---- 16 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/main/java/carpet/mixins/AbstractArrowMixin.java b/src/main/java/carpet/mixins/AbstractArrowMixin.java index e3008597..8c3d5058 100644 --- a/src/main/java/carpet/mixins/AbstractArrowMixin.java +++ b/src/main/java/carpet/mixins/AbstractArrowMixin.java @@ -23,7 +23,7 @@ public abstract class AbstractArrowMixin extends Entity @Inject(method = "(Lnet/minecraft/world/entity/EntityType;DDDLnet/minecraft/world/level/Level;Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/item/ItemStack;)V", at = @At("RETURN")) private void addLogger(final EntityType entityType, final double x, final double y, final double z, final Level level, final ItemStack itemStack, final ItemStack weapon, final CallbackInfo ci) { - if (LoggerRegistry.__projectiles && !level.isClientSide) + if (LoggerRegistry.__projectiles && !level.isClientSide()) logHelper = new TrajectoryLogHelper("projectiles"); } diff --git a/src/main/java/carpet/mixins/ArmorStand_scarpetMarkerMixin.java b/src/main/java/carpet/mixins/ArmorStand_scarpetMarkerMixin.java index 1a944301..89339e32 100644 --- a/src/main/java/carpet/mixins/ArmorStand_scarpetMarkerMixin.java +++ b/src/main/java/carpet/mixins/ArmorStand_scarpetMarkerMixin.java @@ -29,7 +29,7 @@ public abstract class ArmorStand_scarpetMarkerMixin extends LivingEntity @Inject(method = "readAdditionalSaveData", at = @At("HEAD")) private void checkScarpetMarkerUnloaded(CallbackInfo ci) { - if (!level().isClientSide) + if (!level().isClientSide()) { if (getTags().contains(Auxiliary.MARKER_STRING)) { diff --git a/src/main/java/carpet/mixins/EntityMixin.java b/src/main/java/carpet/mixins/EntityMixin.java index 589f5111..42f09a9c 100644 --- a/src/main/java/carpet/mixins/EntityMixin.java +++ b/src/main/java/carpet/mixins/EntityMixin.java @@ -35,6 +35,6 @@ public abstract class EntityMixin implements EntityInterface @Inject(method = "isLocalInstanceAuthoritative", at = @At("HEAD"), cancellable = true) private void isFakePlayer(CallbackInfoReturnable cir) { - if (getControllingPassenger() instanceof EntityPlayerMPFake) cir.setReturnValue(!level.isClientSide); + if (getControllingPassenger() instanceof EntityPlayerMPFake) cir.setReturnValue(!level.isClientSide()); } } diff --git a/src/main/java/carpet/mixins/ExperienceOrb_xpNoCooldownMixin.java b/src/main/java/carpet/mixins/ExperienceOrb_xpNoCooldownMixin.java index 7c590b6e..9c87a95f 100644 --- a/src/main/java/carpet/mixins/ExperienceOrb_xpNoCooldownMixin.java +++ b/src/main/java/carpet/mixins/ExperienceOrb_xpNoCooldownMixin.java @@ -31,7 +31,7 @@ public abstract class ExperienceOrb_xpNoCooldownMixin extends Entity @Inject(method = "playerTouch", at = @At("HEAD")) private void addXP(Player player, CallbackInfo ci) { - if (CarpetSettings.xpNoCooldown && !level().isClientSide) { + if (CarpetSettings.xpNoCooldown && !level().isClientSide()) { player.takeXpDelay = 0; // reducing the count to 1 and leaving vanilla to deal with it while (this.count > 1) { diff --git a/src/main/java/carpet/mixins/Explosion_optimizedTntMixin.java b/src/main/java/carpet/mixins/Explosion_optimizedTntMixin.java index 43d38cb1..76effd11 100644 --- a/src/main/java/carpet/mixins/Explosion_optimizedTntMixin.java +++ b/src/main/java/carpet/mixins/Explosion_optimizedTntMixin.java @@ -45,7 +45,7 @@ public abstract class Explosion_optimizedTntMixin cancellable = true) private void calculateExplodedPositionsCM(final CallbackInfoReturnable> cir) { - if (CarpetSettings.optimizedTNT && !level.isClientSide && !(getIndirectSourceEntity() instanceof Breeze)) + if (CarpetSettings.optimizedTNT && !level.isClientSide() && !(getIndirectSourceEntity() instanceof Breeze)) { cir.setReturnValue(OptimizedExplosion.doExplosionA((Explosion) (Object) this, eLogger)); } @@ -79,7 +79,7 @@ public abstract class Explosion_optimizedTntMixin at = @At(value = "RETURN")) private void onExplostion(ServerLevel world, Entity entity, DamageSource damageSource, final ExplosionDamageCalculator explosionBehavior, final Vec3 vec3, final float power, final boolean createFire, final Explosion.BlockInteraction destructionType, final CallbackInfo ci) { - if (LoggerRegistry.__explosions && ! world.isClientSide) + if (LoggerRegistry.__explosions && ! world.isClientSide()) { eLogger = new ExplosionLogHelper(vec3.x, vec3.y, vec3.z, power, createFire, destructionType, level.registryAccess()); } diff --git a/src/main/java/carpet/mixins/FallingBlockEntityMixin.java b/src/main/java/carpet/mixins/FallingBlockEntityMixin.java index 2e86c9b2..aec30878 100644 --- a/src/main/java/carpet/mixins/FallingBlockEntityMixin.java +++ b/src/main/java/carpet/mixins/FallingBlockEntityMixin.java @@ -21,7 +21,7 @@ public abstract class FallingBlockEntityMixin extends Entity @Inject(method = "(Lnet/minecraft/world/entity/EntityType;Lnet/minecraft/world/level/Level;)V", at = @At("RETURN")) private void addLogger(EntityType entityType_1, Level world_1, CallbackInfo ci) { - if (LoggerRegistry.__fallingBlocks && !world_1.isClientSide) + if (LoggerRegistry.__fallingBlocks && !world_1.isClientSide()) logHelper = new TrajectoryLogHelper("fallingBlocks"); } diff --git a/src/main/java/carpet/mixins/Guardian_renewableSpongesMixin.java b/src/main/java/carpet/mixins/Guardian_renewableSpongesMixin.java index d2fc84d3..492da31a 100644 --- a/src/main/java/carpet/mixins/Guardian_renewableSpongesMixin.java +++ b/src/main/java/carpet/mixins/Guardian_renewableSpongesMixin.java @@ -22,7 +22,7 @@ public abstract class Guardian_renewableSpongesMixin extends Monster @Override public void thunderHit(ServerLevel serverWorld, LightningBolt lightningEntity) { // isRemoved() - if (!this.level().isClientSide && !this.isRemoved() && CarpetSettings.renewableSponges && !((Object)this instanceof ElderGuardian)) + if (!this.level().isClientSide() && !this.isRemoved() && CarpetSettings.renewableSponges && !((Object)this instanceof ElderGuardian)) { ElderGuardian elderGuardian = new ElderGuardian(EntityType.ELDER_GUARDIAN ,this.level()); elderGuardian.snapTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot()); diff --git a/src/main/java/carpet/mixins/LevelChunk_movableBEMixin.java b/src/main/java/carpet/mixins/LevelChunk_movableBEMixin.java index 6aa9b979..5ef7502a 100644 --- a/src/main/java/carpet/mixins/LevelChunk_movableBEMixin.java +++ b/src/main/java/carpet/mixins/LevelChunk_movableBEMixin.java @@ -156,7 +156,7 @@ public abstract class LevelChunk_movableBEMixin extends ChunkAccess implements W return null; } - if (!level.isClientSide && sideEffects) { + if (!level.isClientSide() && sideEffects) { // this updates stuff, schedule ticks - do we want that since its only be called from MovingPistonBlock really? newBlockState.onPlace(level, blockPos_1, oldBlockState, boolean_1); } diff --git a/src/main/java/carpet/mixins/PistonMovingBlockEntity_movableBEMixin.java b/src/main/java/carpet/mixins/PistonMovingBlockEntity_movableBEMixin.java index 5323f670..8e021890 100644 --- a/src/main/java/carpet/mixins/PistonMovingBlockEntity_movableBEMixin.java +++ b/src/main/java/carpet/mixins/PistonMovingBlockEntity_movableBEMixin.java @@ -125,7 +125,7 @@ public abstract class PistonMovingBlockEntity_movableBEMixin extends BlockEntity //Handle TNT Explosions or other ways the moving Block is broken //Also /setblock will cause this to be called, and drop e.g. a moving chest's contents. // This is MC-40380 (BlockEntities that aren't Inventories drop stuff when setblock is called ) - if (CarpetSettings.movableBlockEntities && this.carriedBlockEntity != null && !this.level.isClientSide && this.level.getBlockState(this.worldPosition).getBlock() == Blocks.AIR) + if (CarpetSettings.movableBlockEntities && this.carriedBlockEntity != null && !this.level.isClientSide() && this.level.getBlockState(this.worldPosition).getBlock() == Blocks.AIR) { BlockState blockState_2; if (this.isSourcePiston) diff --git a/src/main/java/carpet/mixins/Player_parrotMixin.java b/src/main/java/carpet/mixins/Player_parrotMixin.java index b7d32283..ef01e4c6 100644 --- a/src/main/java/carpet/mixins/Player_parrotMixin.java +++ b/src/main/java/carpet/mixins/Player_parrotMixin.java @@ -52,7 +52,7 @@ public abstract class Player_parrotMixin extends LivingEntity private void onTickMovement(CallbackInfo ci) { boolean parrots_will_drop = !CarpetSettings.persistentParrots || this.abilities.invulnerable; - if (!this.level().isClientSide && ((parrots_will_drop && this.fallDistance > 0.5F) || this.isInWater() || this.abilities.flying || isSleeping())) + if (!this.level().isClientSide() && ((parrots_will_drop && this.fallDistance > 0.5F) || this.isInWater() || this.abilities.flying || isSleeping())) { this.removeEntitiesOnShoulder(); } diff --git a/src/main/java/carpet/mixins/Player_scarpetEventsMixin.java b/src/main/java/carpet/mixins/Player_scarpetEventsMixin.java index 44411d5a..9c8fa375 100644 --- a/src/main/java/carpet/mixins/Player_scarpetEventsMixin.java +++ b/src/main/java/carpet/mixins/Player_scarpetEventsMixin.java @@ -58,7 +58,7 @@ public abstract class Player_scarpetEventsMixin extends LivingEntity @Inject(method = "touch", at = @At("HEAD")) private void onEntityCollision(Entity entity, CallbackInfo ci) { - if (PLAYER_COLLIDES_WITH_ENTITY.isNeeded() && !level().isClientSide) + if (PLAYER_COLLIDES_WITH_ENTITY.isNeeded() && !level().isClientSide()) { PLAYER_COLLIDES_WITH_ENTITY.onEntityHandAction((ServerPlayer)(Object)this, entity, null); } @@ -67,7 +67,7 @@ public abstract class Player_scarpetEventsMixin extends LivingEntity @Inject(method = "interactOn", cancellable = true, at = @At("HEAD")) private void doInteract(Entity entity, InteractionHand hand, CallbackInfoReturnable cir) { - if (!level().isClientSide && PLAYER_INTERACTS_WITH_ENTITY.isNeeded()) + if (!level().isClientSide() && PLAYER_INTERACTS_WITH_ENTITY.isNeeded()) { if(PLAYER_INTERACTS_WITH_ENTITY.onEntityHandAction((ServerPlayer) (Object)this, entity, hand)) { cir.setReturnValue(InteractionResult.PASS); @@ -79,7 +79,7 @@ public abstract class Player_scarpetEventsMixin extends LivingEntity @Inject(method = "attack", at = @At("HEAD"), cancellable = true) private void onAttack(Entity target, CallbackInfo ci) { - if (!level().isClientSide && PLAYER_ATTACKS_ENTITY.isNeeded() && target.isAttackable()) + if (!level().isClientSide() && PLAYER_ATTACKS_ENTITY.isNeeded() && target.isAttackable()) { if(PLAYER_ATTACKS_ENTITY.onEntityHandAction((ServerPlayer) (Object)this, target, null)) { ci.cancel(); diff --git a/src/main/java/carpet/mixins/PrimedTntMixin.java b/src/main/java/carpet/mixins/PrimedTntMixin.java index 0328ace3..67213f1f 100644 --- a/src/main/java/carpet/mixins/PrimedTntMixin.java +++ b/src/main/java/carpet/mixins/PrimedTntMixin.java @@ -43,7 +43,7 @@ public abstract class PrimedTntMixin extends Entity implements TntEntityInterfac @Inject(method = "(Lnet/minecraft/world/entity/EntityType;Lnet/minecraft/world/level/Level;)V", at = @At("RETURN")) private void initTNTLoggerPrime(EntityType entityType_1, Level world_1, CallbackInfo ci) { - if (LoggerRegistry.__tnt && !world_1.isClientSide) + if (LoggerRegistry.__tnt && !world_1.isClientSide()) { logHelper = new TNTLogHelper(); } @@ -90,7 +90,7 @@ public abstract class PrimedTntMixin extends Entity implements TntEntityInterfac // Merge code for combining tnt into a single entity if they happen to exist in the same spot, same fuse, no motion CARPET-XCOM if(CarpetSettings.mergeTNT){ Vec3 velocity = getDeltaMovement(); - if(!level().isClientSide && mergeBool && velocity.x == 0 && velocity.y == 0 && velocity.z == 0){ + if(!level().isClientSide() && mergeBool && velocity.x == 0 && velocity.y == 0 && velocity.z == 0){ mergeBool = false; for(Entity entity : level().getEntities(this, this.getBoundingBox())){ if(entity instanceof PrimedTnt && !entity.isRemoved()){ @@ -113,7 +113,7 @@ public abstract class PrimedTntMixin extends Entity implements TntEntityInterfac { // Merge code, merge only tnt that have had a chance to move CARPET-XCOM Vec3 velocity = getDeltaMovement(); - if(!level().isClientSide && (velocity.y != 0 || velocity.x != 0 || velocity.z != 0)){ + if(!level().isClientSide() && (velocity.y != 0 || velocity.x != 0 || velocity.z != 0)){ mergeBool = true; } } diff --git a/src/main/java/carpet/mixins/SummonCommand_lightningMixin.java b/src/main/java/carpet/mixins/SummonCommand_lightningMixin.java index 9dee70b4..0fb72fa2 100644 --- a/src/main/java/carpet/mixins/SummonCommand_lightningMixin.java +++ b/src/main/java/carpet/mixins/SummonCommand_lightningMixin.java @@ -25,7 +25,7 @@ public class SummonCommand_lightningMixin private static BlockPos addRiders(Entity entity) { // [CM] SummonNaturalLightning - if statement around - if (CarpetSettings.summonNaturalLightning && entity instanceof LightningBolt && !entity.level().isClientSide) + if (CarpetSettings.summonNaturalLightning && entity instanceof LightningBolt && !entity.level().isClientSide()) { ServerLevel world = (ServerLevel) entity.level(); BlockPos at = entity.blockPosition(); diff --git a/src/main/java/carpet/mixins/ThrowableProjectileMixin.java b/src/main/java/carpet/mixins/ThrowableProjectileMixin.java index 20533e20..26bb1508 100644 --- a/src/main/java/carpet/mixins/ThrowableProjectileMixin.java +++ b/src/main/java/carpet/mixins/ThrowableProjectileMixin.java @@ -21,7 +21,7 @@ public abstract class ThrowableProjectileMixin extends Entity @Inject(method = "(Lnet/minecraft/world/entity/EntityType;Lnet/minecraft/world/level/Level;)V", at = @At("RETURN")) private void addLogger(EntityType entityType_1, Level world_1, CallbackInfo ci) { - if (LoggerRegistry.__projectiles && !world_1.isClientSide) + if (LoggerRegistry.__projectiles && !world_1.isClientSide()) logHelper = new TrajectoryLogHelper("projectiles"); } diff --git a/src/main/java/carpet/mixins/WoolCarpetBlock_placeMixin.java b/src/main/java/carpet/mixins/WoolCarpetBlock_placeMixin.java index 0cbe55bf..fd2b72e9 100644 --- a/src/main/java/carpet/mixins/WoolCarpetBlock_placeMixin.java +++ b/src/main/java/carpet/mixins/WoolCarpetBlock_placeMixin.java @@ -22,7 +22,7 @@ public abstract class WoolCarpetBlock_placeMixin extends Block public BlockState getStateForPlacement(BlockPlaceContext context) { BlockState state = super.getStateForPlacement(context); - if (context.getPlayer() != null && !context.getLevel().isClientSide) + if (context.getPlayer() != null && !context.getLevel().isClientSide()) { // getColor() WoolTool.carpetPlacedAction(((WoolCarpetBlock)(Object)this).getColor(), (ServerPlayer) context.getPlayer(), context.getClickedPos(), (ServerLevel) context.getLevel()); } diff --git a/src/main/java/carpet/utils/CarpetProfiler.java b/src/main/java/carpet/utils/CarpetProfiler.java index dbd0cde2..9bcf3595 100644 --- a/src/main/java/carpet/utils/CarpetProfiler.java +++ b/src/main/java/carpet/utils/CarpetProfiler.java @@ -140,7 +140,7 @@ public class CarpetProfiler Level world = tok.world; String current_section = (world == null) ? (String) tok.section : - String.format("%s.%s%s", world.dimension().location(), tok.section, world.isClientSide ? " (Client)" : ""); + String.format("%s.%s%s", world.dimension().location(), tok.section, world.isClientSide() ? " (Client)" : ""); SECTION_STATS.addTo(current_section, end_time - tok.start); } } @@ -286,7 +286,7 @@ public class CarpetProfiler id = regs.lookupOrThrow(Registries.BLOCK_ENTITY_TYPE).getKey((BlockEntityType) section.getValue()); } String name = "minecraft".equals(id.getNamespace())?id.getPath():id.toString(); - if (section.getKey().isClientSide) + if (section.getKey().isClientSide()) { name += " (client)"; } @@ -311,7 +311,7 @@ public class CarpetProfiler { if (++total > 10) break; Pair section = sectionEntry.getKey(); - boolean cli = section.getKey().isClientSide; + boolean cli = section.getKey().isClientSide(); Messenger.m(currentRequester, String.format( "%s - %s: ", cli?"gi":"w", sectionName(section)), @@ -325,7 +325,7 @@ public class CarpetProfiler { if (++total > 10) break; Pair section = sectionEntry.getKey(); - boolean cli = section.getKey().isClientSide; + boolean cli = section.getKey().isClientSide(); Messenger.m(currentRequester, String.format( "%s - %s: ", cli?"gi":"w", sectionName(section)), From 134d839625c6a146c3cf2441d169bf9ada4b5976 Mon Sep 17 00:00:00 2001 From: gnembon Date: Thu, 31 Jul 2025 01:57:08 +0200 Subject: [PATCH 110/232] 25w31a --- docs/scarpet/api/Auxiliary.md | 3 ++- gradle.properties | 2 +- .../java/carpet/commands/PlayerCommand.java | 9 ++++--- .../helpers/EntityPlayerActionPack.java | 2 +- .../ChunkMap_scarpetChunkCreationMixin.java | 8 +++--- .../mixins/LevelRenderer_fogOffMixin.java | 3 ++- .../LevelRenderer_scarpetRenderMixin.java | 5 ++-- .../PistonHeadRenderer_movableBEMixin.java | 2 +- .../mixins/PlayerList_fakePlayersMixin.java | 6 +++-- .../carpet/patches/EntityPlayerMPFake.java | 27 ++++++++++--------- .../java/carpet/script/api/Auxiliary.java | 3 ++- .../java/carpet/script/api/WorldAccess.java | 4 +-- .../script/command/CommandArgument.java | 7 ++--- .../carpet/script/utils/ShapesRenderer.java | 3 ++- .../script/utils/SnoopyCommandSource.java | 4 +-- .../java/carpet/script/utils/SystemInfo.java | 3 ++- .../java/carpet/script/utils/WorldTools.java | 1 - .../java/carpet/script/value/EntityValue.java | 8 +++--- 18 files changed, 56 insertions(+), 44 deletions(-) diff --git a/docs/scarpet/api/Auxiliary.md b/docs/scarpet/api/Auxiliary.md index 59d4cb12..b16c292f 100644 --- a/docs/scarpet/api/Auxiliary.md +++ b/docs/scarpet/api/Auxiliary.md @@ -778,7 +778,8 @@ system calls. In all circumstances, these are only provided as read-only. * `game_major_target` - major release target. For 1.12.2, that would be 12 * `game_minor_release` - minor release target. For 1.12.2, that would be 2 * `game_protocol` - protocol version number - * `game_pack_version` - datapack version number + * `game_pack_version` - datapack version number as a version string + * `game_pack_minor_version` - datapack format minor version number * `game_data_version` - data version of the game. Returns an integer, so it can be compared. * `game_stable` - indicating if its a production release or a snapshot diff --git a/gradle.properties b/gradle.properties index ac006952..936f8f08 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=1.21.8 + minecraft_version=25w31a loader_version=0.16.14 jsr305_version=3.0.2 fabric_version=0.119.5+1.21.5 diff --git a/src/main/java/carpet/commands/PlayerCommand.java b/src/main/java/carpet/commands/PlayerCommand.java index fe7fa328..237a9ca5 100644 --- a/src/main/java/carpet/commands/PlayerCommand.java +++ b/src/main/java/carpet/commands/PlayerCommand.java @@ -29,6 +29,7 @@ import net.minecraft.core.UUIDUtil; import net.minecraft.resources.ResourceKey; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; +import net.minecraft.server.players.NameAndId; import net.minecraft.server.players.PlayerList; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.GameType; @@ -164,7 +165,7 @@ public class PlayerCommand return false; } - if (!source.getServer().getPlayerList().isOp(sender.getGameProfile())) + if (!source.getServer().getPlayerList().isOp(sender.nameAndId())) { if (sender != player && !(player instanceof EntityPlayerMPFake)) { @@ -200,7 +201,7 @@ public class PlayerCommand Messenger.m(context.getSource(), "r Player ", "rb " + playerName, "r is already logged on"); return true; } - GameProfile profile = server.getProfileCache().get(playerName).orElse(null); + NameAndId profile = server.nameToIdCache().get(playerName).orElse(null); if (profile == null) { if (!CarpetSettings.allowSpawningOfflinePlayers) @@ -209,7 +210,7 @@ public class PlayerCommand "Banned players can only be summoned in Singleplayer and in servers in off-line mode."); return true; } else { - profile = new GameProfile(UUIDUtil.createOfflinePlayerUUID(playerName), playerName); + profile = new NameAndId(UUIDUtil.createOfflinePlayerUUID(playerName), playerName); } } if (manager.getBans().isBanned(profile)) @@ -337,7 +338,7 @@ public class PlayerCommand Messenger.m(context.getSource(), "r Cannot shadow fake players"); return 0; } - if (player.getServer().isSingleplayerOwner(player.getGameProfile())) { + if (player.getServer().isSingleplayerOwner(player.nameAndId())) { Messenger.m(context.getSource(), "r Cannot shadow single-player server owner"); return 0; } diff --git a/src/main/java/carpet/helpers/EntityPlayerActionPack.java b/src/main/java/carpet/helpers/EntityPlayerActionPack.java index dc73346f..019a33bd 100644 --- a/src/main/java/carpet/helpers/EntityPlayerActionPack.java +++ b/src/main/java/carpet/helpers/EntityPlayerActionPack.java @@ -201,7 +201,7 @@ public class EntityPlayerActionPack if (closest instanceof AbstractHorse && onlyRideables) ((AbstractHorse) closest).mobInteract(player, InteractionHand.MAIN_HAND); else - player.startRiding(closest,true); + player.startRiding(closest,true, true); return this; } public EntityPlayerActionPack dismount() diff --git a/src/main/java/carpet/mixins/ChunkMap_scarpetChunkCreationMixin.java b/src/main/java/carpet/mixins/ChunkMap_scarpetChunkCreationMixin.java index a66e8167..307351fa 100644 --- a/src/main/java/carpet/mixins/ChunkMap_scarpetChunkCreationMixin.java +++ b/src/main/java/carpet/mixins/ChunkMap_scarpetChunkCreationMixin.java @@ -27,7 +27,7 @@ import net.minecraft.server.level.ChunkResult; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ThreadedLevelLightEngine; import net.minecraft.server.level.TicketType; -import net.minecraft.server.level.progress.ChunkProgressListener; + import net.minecraft.util.thread.BlockableEventLoop; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; @@ -83,9 +83,9 @@ public abstract class ChunkMap_scarpetChunkCreationMixin implements ThreadedAnvi @Final private BlockableEventLoop mainThreadExecutor; - @Shadow - @Final - private ChunkProgressListener progressListener; + //@Shadow + //@Final + //private ChunkProgressListener progressListener; @Shadow @Final diff --git a/src/main/java/carpet/mixins/LevelRenderer_fogOffMixin.java b/src/main/java/carpet/mixins/LevelRenderer_fogOffMixin.java index d754a8e0..963cb918 100644 --- a/src/main/java/carpet/mixins/LevelRenderer_fogOffMixin.java +++ b/src/main/java/carpet/mixins/LevelRenderer_fogOffMixin.java @@ -2,13 +2,14 @@ package carpet.mixins; import carpet.CarpetSettings; import net.minecraft.client.renderer.DimensionSpecialEffects; +import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.LevelRenderer; //import net.minecraft.world.dimension.Dimension; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; -@Mixin(value = LevelRenderer.class, priority = 69420) +@Mixin(value = GameRenderer.class, priority = 69420) public class LevelRenderer_fogOffMixin { @Redirect(method = "renderLevel", require = 0, expect = 0, at = @At( diff --git a/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java b/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java index 2a63219a..b49775f4 100644 --- a/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java +++ b/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java @@ -7,12 +7,13 @@ import com.mojang.blaze3d.framegraph.FrameGraphBuilder; import com.mojang.blaze3d.framegraph.FramePass; import net.minecraft.client.Camera; import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.LevelRenderState; import net.minecraft.client.renderer.LevelRenderer; import net.minecraft.client.renderer.LevelTargetBundle; -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 net.minecraft.client.renderer.feature.FeatureRenderDispatcher; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -26,7 +27,7 @@ public class LevelRenderer_scarpetRenderMixin @Shadow @Final private LevelTargetBundle targets; @Inject(method = "", at = @At("RETURN")) - private void addRenderers(Minecraft minecraft, EntityRenderDispatcher entityRenderDispatcher, BlockEntityRenderDispatcher blockEntityRenderDispatcher, RenderBuffers renderBuffers, CallbackInfo ci) + private void addRenderers(Minecraft minecraft, EntityRenderDispatcher entityRenderDispatcher, BlockEntityRenderDispatcher blockEntityRenderDispatcher, RenderBuffers renderBuffers, LevelRenderState levelRenderState, FeatureRenderDispatcher featureRenderDispatcher, CallbackInfo ci) { CarpetClient.shapes = new ShapesRenderer(minecraft); } diff --git a/src/main/java/carpet/mixins/PistonHeadRenderer_movableBEMixin.java b/src/main/java/carpet/mixins/PistonHeadRenderer_movableBEMixin.java index 3a8b0e14..ec90780b 100644 --- a/src/main/java/carpet/mixins/PistonHeadRenderer_movableBEMixin.java +++ b/src/main/java/carpet/mixins/PistonHeadRenderer_movableBEMixin.java @@ -24,7 +24,7 @@ public abstract class PistonHeadRenderer_movableBEMixin implements BlockEntityRe @Inject(method = "", at = @At("TAIL")) private void onInitCM(BlockEntityRendererProvider.Context arguments, CallbackInfo ci) { - dispatcher = arguments.getBlockEntityRenderDispatcher(); + dispatcher = arguments.blockEntityRenderDispatcher(); } @Inject(method = "render", at = @At(value = "INVOKE", diff --git a/src/main/java/carpet/mixins/PlayerList_fakePlayersMixin.java b/src/main/java/carpet/mixins/PlayerList_fakePlayersMixin.java index 2d8dc9b5..8772ea3d 100644 --- a/src/main/java/carpet/mixins/PlayerList_fakePlayersMixin.java +++ b/src/main/java/carpet/mixins/PlayerList_fakePlayersMixin.java @@ -18,6 +18,7 @@ import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; 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.CallbackInfoReturnable; import carpet.patches.NetHandlerPlayServerFake; import carpet.patches.EntityPlayerMPFake; @@ -31,8 +32,9 @@ public abstract class PlayerList_fakePlayersMixin @Final private MinecraftServer server; - @Inject(method = "load", at = @At(value = "RETURN", shift = At.Shift.BEFORE)) - private void fixStartingPos(ServerPlayer serverPlayer, ProblemReporter problemReporter, CallbackInfoReturnable> cir) + // may need to be invoked in the configuration phase on prepareSpawn Task + @Inject(method = "placeNewPlayer", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/ServerPlayer;level()Lnet/minecraft/server/level/ServerLevel;")) + private void fixStartingPos(Connection connection, ServerPlayer serverPlayer, CommonListenerCookie commonListenerCookie, CallbackInfo ci) { if (serverPlayer instanceof EntityPlayerMPFake) { diff --git a/src/main/java/carpet/patches/EntityPlayerMPFake.java b/src/main/java/carpet/patches/EntityPlayerMPFake.java index 53a38d9b..06173201 100644 --- a/src/main/java/carpet/patches/EntityPlayerMPFake.java +++ b/src/main/java/carpet/patches/EntityPlayerMPFake.java @@ -2,8 +2,10 @@ package carpet.patches; import carpet.CarpetSettings; import com.mojang.authlib.GameProfile; +import com.mojang.authlib.properties.PropertyMap; import net.minecraft.core.BlockPos; import net.minecraft.core.UUIDUtil; +import net.minecraft.core.component.DataComponents; import net.minecraft.network.DisconnectionDetails; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.contents.TranslatableContents; @@ -19,7 +21,8 @@ import net.minecraft.server.level.ClientInformation; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.network.CommonListenerCookie; -import net.minecraft.server.players.GameProfileCache; +import net.minecraft.server.players.CachedUserNameToIdResolver; +import net.minecraft.server.players.NameAndId; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EquipmentSlot; @@ -27,6 +30,7 @@ import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.player.Player; import net.minecraft.world.food.FoodData; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.component.ResolvableProfile; import net.minecraft.world.level.GameType; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.SkullBlockEntity; @@ -54,13 +58,14 @@ public class EntityPlayerMPFake extends ServerPlayer { //prolly half of that crap is not necessary, but it works ServerLevel worldIn = server.getLevel(dimensionId); - GameProfileCache.setUsesAuthentication(false); + server.nameToIdCache().resolveOfflineUsers(false); GameProfile gameprofile; try { - gameprofile = server.getProfileCache().get(username).orElse(null); //findByName .orElse(null) + NameAndId res = server.nameToIdCache().get(username).orElseThrow(); //findByName .orElse(null) + gameprofile = new GameProfile(res.id(), res.name()); } finally { - GameProfileCache.setUsesAuthentication(server.isDedicatedServer() && server.usesAuthentication()); + server.nameToIdCache().resolveOfflineUsers(server.isDedicatedServer() && server.usesAuthentication()); } if (gameprofile == null) { @@ -71,7 +76,7 @@ public class EntityPlayerMPFake extends ServerPlayer gameprofile = new GameProfile(UUIDUtil.createOfflinePlayerUUID(username), username); } } - GameProfile finalGP = gameprofile; + //GameProfile finalGP = gameprofile; // We need to mark this player as spawning so that we do not // try to spawn another player with the name while the profile @@ -87,11 +92,8 @@ public class EntityPlayerMPFake extends ServerPlayer return; } - GameProfile current = finalGP; - if (p.isPresent()) - { - current = p.get(); - } + GameProfile current = p.gameProfile(); + EntityPlayerMPFake instance = new EntityPlayerMPFake(server, worldIn, current, ClientInformation.createDefault(), false); instance.fixStartingPosition = () -> instance.snapTo(pos.x, pos.y, pos.z, (float) yaw, (float) pitch); server.getPlayerList().placeNewPlayer(new FakeClientConnection(PacketFlow.SERVERBOUND), instance, new CommonListenerCookie(current, 0, instance.clientInformation(), false)); @@ -109,8 +111,9 @@ public class EntityPlayerMPFake extends ServerPlayer return true; } - private static CompletableFuture> fetchGameProfile(final String name) { - return SkullBlockEntity.fetchGameProfile(name); + private static CompletableFuture fetchGameProfile(final String name) { + final ResolvableProfile resolvableProfile = new ResolvableProfile(Optional.of(name), Optional.empty(), new PropertyMap()); + return resolvableProfile.resolve(); } public static EntityPlayerMPFake createShadow(MinecraftServer server, ServerPlayer player) diff --git a/src/main/java/carpet/script/api/Auxiliary.java b/src/main/java/carpet/script/api/Auxiliary.java index 108bc030..4a58c153 100644 --- a/src/main/java/carpet/script/api/Auxiliary.java +++ b/src/main/java/carpet/script/api/Auxiliary.java @@ -1195,7 +1195,8 @@ public class Auxiliary Path zipRoot = zipfs.getPath("/"); zipValueToJson(zipRoot.resolve("pack.mcmeta"), MapValue.wrap( Map.of(StringValue.of("pack"), MapValue.wrap(Map.of( - StringValue.of("pack_format"), new NumericValue(SharedConstants.getCurrentVersion().packVersion(PackType.SERVER_DATA)), + StringValue.of("min_format"), new NumericValue(SharedConstants.getCurrentVersion().packVersion(PackType.SERVER_DATA).major()), + StringValue.of("max_format"), new NumericValue(SharedConstants.getCurrentVersion().packVersion(PackType.SERVER_DATA).major()), StringValue.of("description"), StringValue.of(name), StringValue.of("source"), StringValue.of("scarpet") ))) diff --git a/src/main/java/carpet/script/api/WorldAccess.java b/src/main/java/carpet/script/api/WorldAccess.java index 2794a875..080791d4 100644 --- a/src/main/java/carpet/script/api/WorldAccess.java +++ b/src/main/java/carpet/script/api/WorldAccess.java @@ -1744,7 +1744,7 @@ public class WorldAccess case "erosion" -> router.erosion(); case "depth" -> router.depth(); case "ridges" -> router.ridges(); - case "initial_density_without_jaggedness" -> router.initialDensityWithoutJaggedness(); + case "preliminary_surface_level" -> router.preliminarySurfaceLevel(); case "final_density" -> router.finalDensity(); case "vein_toggle" -> router.veinToggle(); case "vein_ridged" -> router.veinRidged(); @@ -1776,7 +1776,7 @@ public class WorldAccess case "erosion" -> router.erosion(); case "depth" -> router.depth(); case "ridges" -> router.ridges(); - case "initial_density_without_jaggedness" -> router.initialDensityWithoutJaggedness(); + case "preliminary_surface_level" -> router.preliminarySurfaceLevel(); case "final_density" -> router.finalDensity(); case "vein_toggle" -> router.veinToggle(); case "vein_ridged" -> router.veinRidged(); diff --git a/src/main/java/carpet/script/command/CommandArgument.java b/src/main/java/carpet/script/command/CommandArgument.java index 78310667..4f7da43e 100644 --- a/src/main/java/carpet/script/command/CommandArgument.java +++ b/src/main/java/carpet/script/command/CommandArgument.java @@ -102,6 +102,7 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.server.MinecraftServer; import net.minecraft.server.commands.BossBarCommands; import net.minecraft.server.commands.LootCommand; +import net.minecraft.server.players.NameAndId; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.phys.Vec2; @@ -718,10 +719,10 @@ public abstract class CommandArgument @Override protected Value getValueFromContext(CommandContext context, String param) throws CommandSyntaxException { - Collection profiles = GameProfileArgument.getGameProfiles(context, param); + Collection profiles = GameProfileArgument.getGameProfiles(context, param); if (!single) { - return ListValue.wrap(profiles.stream().map(p -> StringValue.of(p.getName()))); + return ListValue.wrap(profiles.stream().map(p -> StringValue.of(p.name()))); } int size = profiles.size(); if (size == 0) @@ -730,7 +731,7 @@ public abstract class CommandArgument } if (size == 1) { - return StringValue.of(profiles.iterator().next().getName()); + return StringValue.of(profiles.iterator().next().name()); } throw new SimpleCommandExceptionType(Component.literal("Multiple game profiles returned while only one was requested" + " for custom type " + suffix)).create(); } diff --git a/src/main/java/carpet/script/utils/ShapesRenderer.java b/src/main/java/carpet/script/utils/ShapesRenderer.java index 53892aab..d7c1d515 100644 --- a/src/main/java/carpet/script/utils/ShapesRenderer.java +++ b/src/main/java/carpet/script/utils/ShapesRenderer.java @@ -25,6 +25,7 @@ import java.util.function.BiFunction; import net.minecraft.client.Camera; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Font; +import net.minecraft.client.gui.components.debug.DebugScreenEntries; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.renderer.ItemBlockRenderTypes; import net.minecraft.client.renderer.LightTexture; @@ -143,7 +144,7 @@ public class ShapesRenderer double cameraX = camera.getPosition().x; double cameraY = camera.getPosition().y; double cameraZ = camera.getPosition().z; - boolean entityBoxes = client.getEntityRenderDispatcher().shouldRenderHitBoxes(); + boolean entityBoxes = client.debugEntries.isCurrentlyEnabled(DebugScreenEntries.ENTITY_HITBOXES); if (!shapes.isEmpty()) { diff --git a/src/main/java/carpet/script/utils/SnoopyCommandSource.java b/src/main/java/carpet/script/utils/SnoopyCommandSource.java index 71e10508..d55552c9 100644 --- a/src/main/java/carpet/script/utils/SnoopyCommandSource.java +++ b/src/main/java/carpet/script/utils/SnoopyCommandSource.java @@ -70,12 +70,12 @@ public class SnoopyCommandSource extends CommandSourceStack { super(player.commandSource(), player.position(), player.getRotationVector(), player.level() instanceof final ServerLevel serverLevel ? serverLevel : null, - player.getServer().getProfilePermissions(player.getGameProfile()), player.getName().getString(), player.getDisplayName(), + player.getServer().getProfilePermissions(player.nameAndId()), player.getName().getString(), player.getDisplayName(), player.level().getServer(), player); this.output = player.commandSource(); this.position = player.position(); this.world = player.level() instanceof final ServerLevel serverLevel ? serverLevel : null; - this.level = player.getServer().getProfilePermissions(player.getGameProfile()); + this.level = player.getServer().getProfilePermissions(player.nameAndId()); this.simpleName = player.getName().getString(); this.name = player.getDisplayName(); this.server = player.level().getServer(); diff --git a/src/main/java/carpet/script/utils/SystemInfo.java b/src/main/java/carpet/script/utils/SystemInfo.java index d655f142..00e528c3 100644 --- a/src/main/java/carpet/script/utils/SystemInfo.java +++ b/src/main/java/carpet/script/utils/SystemInfo.java @@ -92,7 +92,8 @@ public class SystemInfo put("game_minor_target", c -> NumericValue.of(Vanilla.MinecraftServer_getReleaseTarget(c.server())[1])); put("game_stable", c -> BooleanValue.of(SharedConstants.getCurrentVersion().stable())); put("game_data_version", c -> NumericValue.of(SharedConstants.getCurrentVersion().dataVersion().version())); - put("game_pack_version", c -> NumericValue.of(SharedConstants.getCurrentVersion().packVersion(PackType.SERVER_DATA))); + put("game_pack_version", c -> NumericValue.of(SharedConstants.getCurrentVersion().packVersion(PackType.SERVER_DATA).major())); + put("game_pack_minor_version", c -> NumericValue.of(SharedConstants.getCurrentVersion().packVersion(PackType.SERVER_DATA).minor())); put("server_ip", c -> StringValue.of(c.server().getLocalIp())); put("server_whitelisted", c -> BooleanValue.of(c.server().isEnforceWhitelist())); diff --git a/src/main/java/carpet/script/utils/WorldTools.java b/src/main/java/carpet/script/utils/WorldTools.java index 15f23f77..5851b821 100644 --- a/src/main/java/carpet/script/utils/WorldTools.java +++ b/src/main/java/carpet/script/utils/WorldTools.java @@ -15,7 +15,6 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; -import net.minecraft.server.level.progress.ChunkProgressListener; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.CustomSpawner; import net.minecraft.world.level.Level; diff --git a/src/main/java/carpet/script/value/EntityValue.java b/src/main/java/carpet/script/value/EntityValue.java index f6188f45..6b78a948 100644 --- a/src/main/java/carpet/script/value/EntityValue.java +++ b/src/main/java/carpet/script/value/EntityValue.java @@ -628,7 +628,7 @@ public class EntityValue extends Value { return new StringValue("singleplayer"); } - boolean isowner = server.isSingleplayerOwner(p.getGameProfile()); + boolean isowner = server.isSingleplayerOwner(p.nameAndId()); if (isowner) { return new StringValue("lan_host"); @@ -1217,7 +1217,7 @@ public class EntityValue extends Value put("mount", (e, v) -> { if (v instanceof EntityValue ev) { - e.startRiding(ev.getEntity(), true); + e.startRiding(ev.getEntity(), true, true); } if (e instanceof ServerPlayer sp) { @@ -1233,7 +1233,7 @@ public class EntityValue extends Value } if (v instanceof EntityValue ev) { - ev.getEntity().startRiding(e); + ev.getEntity().startRiding(e, true, true); } else if (v instanceof ListValue lv) { @@ -1241,7 +1241,7 @@ public class EntityValue extends Value { if (element instanceof EntityValue ev) { - ev.getEntity().startRiding(e); + ev.getEntity().startRiding(e, true, true); } } } From 7f7ead1282fa191e43cee53647fd2681bbb432ff Mon Sep 17 00:00:00 2001 From: gnembon Date: Thu, 31 Jul 2025 01:57:39 +0200 Subject: [PATCH 111/232] 1.4.178 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 936f8f08..5273ae1f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G fabric_version=0.119.5+1.21.5 # Mod Properties - mod_version = 1.4.177 + mod_version = 1.4.178 maven_group = carpet archives_base_name = fabric-carpet From 2339db53519eabeeb4549a19bf6e35a116932949 Mon Sep 17 00:00:00 2001 From: gnembon Date: Thu, 31 Jul 2025 01:58:37 +0200 Subject: [PATCH 112/232] change release target --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 5273ae1f..962d6f71 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ org.gradle.jvmargs=-Xmx1G # The Curseforge versions "names" or ids for the main branch (comma separated: 1.16.4,1.16.5) # This is needed because CF uses too vague names for prereleases and release candidates # Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN] - release-curse-versions = Minecraft 1.21:1.21.7 + release-curse-versions = Minecraft 1.21:1.21.9-Snapshot # Whether or not to build another branch on release release-extra-branch = false # The name of the second branch to release From c4968e7933c62003c633d4b22efa6256091738f9 Mon Sep 17 00:00:00 2001 From: gnembon Date: Thu, 31 Jul 2025 02:03:12 +0200 Subject: [PATCH 113/232] remove unneeded widener --- src/main/resources/carpet.accesswidener | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/main/resources/carpet.accesswidener b/src/main/resources/carpet.accesswidener index fda730bd..df9b0bd1 100644 --- a/src/main/resources/carpet.accesswidener +++ b/src/main/resources/carpet.accesswidener @@ -13,7 +13,4 @@ accessible class net/minecraft/world/level/block/entity/SculkSensorBlockEntity$V accessible method net/minecraft/world/level/border/WorldBorder getListeners ()Ljava/util/List; accessible method net/minecraft/world/level/redstone/DefaultRedstoneWireEvaluator calculateTargetStrength (Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;)I -#cause I don't want to deal with the interfaces until stuff is stable -accessible method net/minecraft/world/level/block/entity/SkullBlockEntity fetchGameProfile (Ljava/lang/String;)Ljava/util/concurrent/CompletableFuture; - accessible field net/minecraft/world/level/block/state/BlockBehaviour UPDATE_SHAPE_ORDER [Lnet/minecraft/core/Direction; From 87d31437fc3822941f3650c11b1d166f8576f6f6 Mon Sep 17 00:00:00 2001 From: gnembon Date: Thu, 31 Jul 2025 02:12:22 +0200 Subject: [PATCH 114/232] replaced initial_density_without_jaggedness in router with preliminary_surface_level --- docs/scarpet/api/BlocksAndWorldAccess.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/scarpet/api/BlocksAndWorldAccess.md b/docs/scarpet/api/BlocksAndWorldAccess.md index a2715a57..a4555608 100644 --- a/docs/scarpet/api/BlocksAndWorldAccess.md +++ b/docs/scarpet/api/BlocksAndWorldAccess.md @@ -540,7 +540,7 @@ On top of that, scarpet provides the following list of noises sampled directly f `'barrier_noise'`, `'fluid_level_floodedness_noise'`, `'fluid_level_spread_noise'`, `'lava_noise'`, `'temperature'`, `'vegetation'`, `'continents'`, `'erosion'`, `'depth'`, `'ridges'`, -`'initial_density_without_jaggedness'`, `'final_density'`, `'vein_toggle'`, `'vein_ridged'` and `'vein_gap'` +`'preliminary_surface_level'`, `'final_density'`, `'vein_toggle'`, `'vein_ridged'` and `'vein_gap'`
     // requesting single value
    
    From e9c3cd45c5e96daf1c9066301485bfcfd475fc06 Mon Sep 17 00:00:00 2001
    From: "github-actions[bot]" 
    Date: Thu, 31 Jul 2025 00:14:21 +0000
    Subject: [PATCH 115/232] Merge docs for 'Carpet Mod 1.4.178 for Minecraft
     25w31a'
    
    ---
     docs/scarpet/Full.md | 5 +++--
     1 file changed, 3 insertions(+), 2 deletions(-)
    
    diff --git a/docs/scarpet/Full.md b/docs/scarpet/Full.md
    index e59a94f0..afc40bd4 100644
    --- a/docs/scarpet/Full.md
    +++ b/docs/scarpet/Full.md
    @@ -2869,7 +2869,7 @@ On top of that, scarpet provides the following list of noises sampled directly f
     
     `'barrier_noise'`, `'fluid_level_floodedness_noise'`, `'fluid_level_spread_noise'`, `'lava_noise'`,
     `'temperature'`, `'vegetation'`, `'continents'`, `'erosion'`, `'depth'`, `'ridges'`, 
    -`'initial_density_without_jaggedness'`, `'final_density'`, `'vein_toggle'`, `'vein_ridged'` and `'vein_gap'`
    +`'preliminary_surface_level'`, `'final_density'`, `'vein_toggle'`, `'vein_ridged'` and `'vein_gap'`
     
     
     // requesting single value
    @@ -6099,7 +6099,8 @@ system calls. In all circumstances, these are only provided as read-only.
       * `game_major_target` - major release target. For 1.12.2, that would be 12
       * `game_minor_release` - minor release target. For 1.12.2, that would be 2
       * `game_protocol` - protocol version number
    -  * `game_pack_version` - datapack version number
    +  * `game_pack_version` - datapack version number as a version string
    +  * `game_pack_minor_version` - datapack format minor version number
       * `game_data_version` - data version of the game. Returns an integer, so it can be compared.
       * `game_stable` - indicating if its a production release or a snapshot
       
    
    From 096be5dc20eb516e0332d34e9eb6bf0ebb99fa47 Mon Sep 17 00:00:00 2001
    From: gnembon 
    Date: Thu, 7 Aug 2025 12:56:54 +0200
    Subject: [PATCH 116/232] 25w32a
    
    ---
     gradle.properties | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/gradle.properties b/gradle.properties
    index 962d6f71..d8f86abd 100644
    --- a/gradle.properties
    +++ b/gradle.properties
    @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G
     
     # Fabric Properties
     	# check https://fabricmc.net/develop/
    -	minecraft_version=25w31a
    +	minecraft_version=25w32a
     	loader_version=0.16.14
     	jsr305_version=3.0.2
     	fabric_version=0.119.5+1.21.5
    
    From a0cc5b8a0a7661a7bd59c38ed37477510577ce86 Mon Sep 17 00:00:00 2001
    From: gnembon 
    Date: Thu, 14 Aug 2025 18:17:36 +0200
    Subject: [PATCH 117/232] 25w33a
    
    ---
     gradle.properties                             |  2 +-
     .../mixins/Explosion_scarpetEventMixin.java   |  6 ++--
     .../mixins/ServerLevel_scarpetMixin.java      |  4 ++-
     .../java/carpet/script/api/WorldAccess.java   | 31 ++++++++++---------
     4 files changed, 24 insertions(+), 19 deletions(-)
    
    diff --git a/gradle.properties b/gradle.properties
    index d8f86abd..f2117082 100644
    --- a/gradle.properties
    +++ b/gradle.properties
    @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G
     
     # Fabric Properties
     	# check https://fabricmc.net/develop/
    -	minecraft_version=25w32a
    +	minecraft_version=25w33a
     	loader_version=0.16.14
     	jsr305_version=3.0.2
     	fabric_version=0.119.5+1.21.5
    diff --git a/src/main/java/carpet/mixins/Explosion_scarpetEventMixin.java b/src/main/java/carpet/mixins/Explosion_scarpetEventMixin.java
    index 5985a526..8aeea1cd 100644
    --- a/src/main/java/carpet/mixins/Explosion_scarpetEventMixin.java
    +++ b/src/main/java/carpet/mixins/Explosion_scarpetEventMixin.java
    @@ -8,7 +8,6 @@ import org.spongepowered.asm.mixin.Shadow;
     import org.spongepowered.asm.mixin.injection.At;
     import org.spongepowered.asm.mixin.injection.Inject;
     import org.spongepowered.asm.mixin.injection.Redirect;
    -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
     
     import java.util.ArrayList;
     import java.util.List;
    @@ -17,6 +16,7 @@ import net.minecraft.world.entity.Entity;
     import net.minecraft.world.entity.LivingEntity;
     import net.minecraft.world.level.Explosion;
     import net.minecraft.world.phys.Vec3;
    +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
     import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
     
     import static carpet.script.CarpetEventServer.Event.EXPLOSION_OUTCOME;
    @@ -36,7 +36,7 @@ public abstract class Explosion_scarpetEventMixin
         private List affectedEntities = new ArrayList<>();
     
         @Inject(method = "explode", at = @At("HEAD"))
    -    private void explodeCM(CallbackInfo ci)
    +    private void explodeCM(CallbackInfoReturnable cir)
         {
             affectedEntities.clear();
         }
    @@ -49,7 +49,7 @@ public abstract class Explosion_scarpetEventMixin
         }
     
         @Inject(method = "explode", locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/ServerExplosion;hurtEntities()V", shift = At.Shift.AFTER))
    -    private void onExplosionDone(CallbackInfo ci, List list)
    +    private void onExplosionDone(CallbackInfoReturnable cir, List list)
         {
             if (EXPLOSION_OUTCOME.isNeeded() && !level.isClientSide())
             {
    diff --git a/src/main/java/carpet/mixins/ServerLevel_scarpetMixin.java b/src/main/java/carpet/mixins/ServerLevel_scarpetMixin.java
    index 81929187..a6af3113 100644
    --- a/src/main/java/carpet/mixins/ServerLevel_scarpetMixin.java
    +++ b/src/main/java/carpet/mixins/ServerLevel_scarpetMixin.java
    @@ -4,11 +4,13 @@ import carpet.fakes.ServerWorldInterface;
     import net.minecraft.core.BlockPos;
     import net.minecraft.core.Holder;
     import net.minecraft.core.RegistryAccess;
    +import net.minecraft.core.particles.ExplosionParticleInfo;
     import net.minecraft.core.particles.ParticleOptions;
     import net.minecraft.resources.ResourceKey;
     import net.minecraft.server.level.ServerLevel;
     import net.minecraft.sounds.SoundEvent;
     import net.minecraft.util.profiling.ProfilerFiller;
    +import net.minecraft.util.random.WeightedList;
     import net.minecraft.world.DifficultyInstance;
     import net.minecraft.world.damagesource.DamageSource;
     import net.minecraft.world.entity.Entity;
    @@ -69,7 +71,7 @@ public abstract class ServerLevel_scarpetMixin extends Level implements ServerWo
         }
     
         @Inject(method = "explode", at = @At("HEAD"), cancellable = true)
    -    private void handleExplosion(final Entity entity, final DamageSource damageSource, final ExplosionDamageCalculator explosionDamageCalculator, final double x, final double y, final double z, final float g, final boolean bl, final ExplosionInteraction explosionInteraction, final ParticleOptions particleOptions, final ParticleOptions particleOptions2, final Holder holder, final CallbackInfo ci)
    +    private void handleExplosion(Entity entity, DamageSource damageSource, ExplosionDamageCalculator explosionDamageCalculator, double x, double y, double z, float g, boolean bl, ExplosionInteraction explosionInteraction, ParticleOptions particleOptions, ParticleOptions particleOptions2, WeightedList weightedList, Holder holder, CallbackInfo ci)
         {
             if (EXPLOSION.isNeeded()) {
                 Explosion.BlockInteraction var10000 = switch (explosionInteraction) {
    diff --git a/src/main/java/carpet/script/api/WorldAccess.java b/src/main/java/carpet/script/api/WorldAccess.java
    index 080791d4..9e45dfad 100644
    --- a/src/main/java/carpet/script/api/WorldAccess.java
    +++ b/src/main/java/carpet/script/api/WorldAccess.java
    @@ -28,7 +28,6 @@ import carpet.script.value.StringValue;
     import carpet.script.value.Value;
     import carpet.script.value.ValueConversions;
     
    -import com.mojang.brigadier.exceptions.CommandSyntaxException;
     import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
     import it.unimi.dsi.fastutil.longs.LongSet;
     import net.minecraft.Util;
    @@ -39,6 +38,7 @@ import net.minecraft.core.HolderSet;
     import net.minecraft.core.QuartPos;
     import net.minecraft.core.Registry;
     import net.minecraft.core.RegistryAccess;
    +import net.minecraft.core.particles.ExplosionParticleInfo;
     import net.minecraft.core.particles.ParticleOptions;
     import net.minecraft.core.particles.ParticleTypes;
     import net.minecraft.core.registries.BuiltInRegistries;
    @@ -54,6 +54,7 @@ import net.minecraft.sounds.SoundEvents;
     import net.minecraft.tags.ItemTags;
     import net.minecraft.tags.TagKey;
     import net.minecraft.util.ProblemReporter;
    +import net.minecraft.util.random.WeightedList;
     import net.minecraft.world.level.ServerExplosion;
     import net.minecraft.world.level.chunk.ChunkGenerator;
     import net.minecraft.world.level.chunk.PalettedContainer;
    @@ -71,7 +72,6 @@ import org.apache.commons.lang3.tuple.Pair;
     
     import java.util.ArrayList;
     import java.util.Arrays;
    -import java.util.Collections;
     import java.util.Comparator;
     import java.util.HashMap;
     import java.util.List;
    @@ -85,15 +85,11 @@ import java.util.function.Predicate;
     import java.util.stream.Collectors;
     import java.util.stream.Stream;
     
    -import net.minecraft.commands.arguments.item.ItemInput;
     import net.minecraft.nbt.CompoundTag;
    -import net.minecraft.nbt.Tag;
     import net.minecraft.network.protocol.game.ClientboundExplodePacket;
     import net.minecraft.resources.ResourceLocation;
     import net.minecraft.sounds.SoundSource;
     import net.minecraft.util.Mth;
    -import net.minecraft.util.SortedArraySet;
    -import net.minecraft.world.Clearable;
     import net.minecraft.world.InteractionResult;
     import net.minecraft.world.entity.Entity;
     import net.minecraft.world.entity.EntityType;
    @@ -998,6 +994,12 @@ public class WorldAccess
                 return BooleanValue.of(success);
             });
     
    +        // from ServerLevel = don't wanna mixin this in, as it is PITA
    +        WeightedList DEFAULT_EXPLOSION_BLOCK_PARTICLES = WeightedList.builder()
    +                .add(new ExplosionParticleInfo(ParticleTypes.POOF, 0.5F, 1.0F))
    +                .add(new ExplosionParticleInfo(ParticleTypes.SMOKE, 1.0F, 1.0F))
    +                .build();
    +
             expression.addContextFunction("create_explosion", -1, (c, t, lv) ->
             {
                 if (lv.isEmpty())
    @@ -1078,7 +1080,7 @@ public class WorldAccess
                 LivingEntity theAttacker = attacker;
     
                 // copy of ServerWorld.createExplosion #TRACK#
    -            ServerExplosion explosion = new ServerExplosion(cc.level(), source, null, null, pos, powah, createFire, mode)
    +            ServerExplosion serverExplosion = new ServerExplosion(cc.level(), source, null, null, pos, powah, createFire, mode)
                 {
                     @Override
                     @Nullable
    @@ -1088,14 +1090,15 @@ public class WorldAccess
                         return theAttacker;
                     }
                 };
    -            explosion.explode();
    -            ParticleOptions explosionParticle = explosion.isSmall() ? ParticleTypes.EXPLOSION : ParticleTypes.EXPLOSION_EMITTER;
    -            cc.level().players().forEach(spe -> {
    -                if (spe.distanceToSqr(pos) < 4096.0D)
    -                {
    -                    spe.connection.send(new ClientboundExplodePacket(pos, Optional.ofNullable(explosion.getHitPlayers().get(spe)), explosionParticle, SoundEvents.GENERIC_EXPLODE));
    +            int i = serverExplosion.explode();
    +            ParticleOptions particleOptions3 = serverExplosion.isSmall() ? ParticleTypes.EXPLOSION : ParticleTypes.EXPLOSION_EMITTER;
    +
    +            for (ServerPlayer serverPlayer : cc.level().players()) {
    +                if (serverPlayer.distanceToSqr(pos) < 4096.0) {
    +                    Optional optional = Optional.ofNullable((Vec3)serverExplosion.getHitPlayers().get(serverPlayer));
    +                    serverPlayer.connection.send(new ClientboundExplodePacket(pos, powah, i, optional, particleOptions3, SoundEvents.GENERIC_EXPLODE, DEFAULT_EXPLOSION_BLOCK_PARTICLES));
                     }
    -            });
    +            }
                 return Value.TRUE;
             });
     
    
    From efadc4dadfd35e4cc46cf57123ddabb3f4309209 Mon Sep 17 00:00:00 2001
    From: gnembon 
    Date: Thu, 14 Aug 2025 18:19:54 +0200
    Subject: [PATCH 118/232] 1.4.179
    
    ---
     gradle.properties | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/gradle.properties b/gradle.properties
    index f2117082..03db03ea 100644
    --- a/gradle.properties
    +++ b/gradle.properties
    @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G
     	fabric_version=0.119.5+1.21.5
     
     # Mod Properties
    -	mod_version = 1.4.178
    +	mod_version = 1.4.179
     	maven_group = carpet
     	archives_base_name = fabric-carpet
     
    
    From 5269fee8015db2ec4ef029da078792441df82440 Mon Sep 17 00:00:00 2001
    From: gnembon 
    Date: Wed, 20 Aug 2025 11:54:25 +0200
    Subject: [PATCH 119/232] 25w34b, broken item and be shapes rendered
    
    ---
     gradle.properties                             |  2 +-
     .../java/carpet/commands/PlayerCommand.java   | 22 +++++++--
     .../PistonHeadRenderer_movableBEMixin.java    | 15 +++---
     .../carpet/patches/EntityPlayerMPFake.java    | 47 ++++++++++---------
     .../carpet/script/utils/ShapesRenderer.java   | 16 +++++--
     5 files changed, 65 insertions(+), 37 deletions(-)
    
    diff --git a/gradle.properties b/gradle.properties
    index 03db03ea..a10391f0 100644
    --- a/gradle.properties
    +++ b/gradle.properties
    @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G
     
     # Fabric Properties
     	# check https://fabricmc.net/develop/
    -	minecraft_version=25w33a
    +	minecraft_version=25w34b
     	loader_version=0.16.14
     	jsr305_version=3.0.2
     	fabric_version=0.119.5+1.21.5
    diff --git a/src/main/java/carpet/commands/PlayerCommand.java b/src/main/java/carpet/commands/PlayerCommand.java
    index 237a9ca5..4ad63884 100644
    --- a/src/main/java/carpet/commands/PlayerCommand.java
    +++ b/src/main/java/carpet/commands/PlayerCommand.java
    @@ -30,16 +30,15 @@ import net.minecraft.resources.ResourceKey;
     import net.minecraft.server.MinecraftServer;
     import net.minecraft.server.level.ServerPlayer;
     import net.minecraft.server.players.NameAndId;
    +import net.minecraft.server.players.OldUsersConverter;
     import net.minecraft.server.players.PlayerList;
     import net.minecraft.world.entity.player.Player;
     import net.minecraft.world.level.GameType;
     import net.minecraft.world.level.Level;
     import net.minecraft.world.phys.Vec2;
     import net.minecraft.world.phys.Vec3;
    -import java.util.Collection;
    -import java.util.LinkedHashSet;
    -import java.util.List;
    -import java.util.Set;
    +
    +import java.util.*;
     import java.util.function.Consumer;
     
     import static net.minecraft.commands.Commands.argument;
    @@ -201,7 +200,20 @@ public class PlayerCommand
                 Messenger.m(context.getSource(), "r Player ", "rb " + playerName, "r  is already logged on");
                 return true;
             }
    -        NameAndId profile = server.nameToIdCache().get(playerName).orElse(null);
    +        UUID uuid = OldUsersConverter.convertMobOwnerIfNecessary(server, playerName);
    +        if (uuid == null)
    +        {
    +            if (!CarpetSettings.allowSpawningOfflinePlayers)
    +            {
    +                Messenger.m(context.getSource(), "r Player "+playerName+" is either banned by Mojang, or auth servers are down. " +
    +                        "Banned players can only be summoned in Singleplayer and in servers in off-line mode.");
    +                return true;
    +            } else {
    +                uuid = UUIDUtil.createOfflinePlayerUUID(playerName);
    +            }
    +        }
    +        //GameProfile profile = new GameProfile(uuid, playerName);
    +        NameAndId profile = server.services().nameToIdCache().get(uuid).orElse(null);
             if (profile == null)
             {
                 if (!CarpetSettings.allowSpawningOfflinePlayers)
    diff --git a/src/main/java/carpet/mixins/PistonHeadRenderer_movableBEMixin.java b/src/main/java/carpet/mixins/PistonHeadRenderer_movableBEMixin.java
    index ec90780b..4627ad6c 100644
    --- a/src/main/java/carpet/mixins/PistonHeadRenderer_movableBEMixin.java
    +++ b/src/main/java/carpet/mixins/PistonHeadRenderer_movableBEMixin.java
    @@ -4,10 +4,12 @@ import carpet.CarpetSettings;
     import carpet.fakes.PistonBlockEntityInterface;
     import com.mojang.blaze3d.vertex.PoseStack;
     import net.minecraft.client.renderer.MultiBufferSource;
    +import net.minecraft.client.renderer.SubmitNodeCollector;
     import net.minecraft.client.renderer.blockentity.BlockEntityRenderDispatcher;
     import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
     import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
     import net.minecraft.client.renderer.blockentity.PistonHeadRenderer;
    +import net.minecraft.client.renderer.feature.ModelFeatureRenderer;
     import net.minecraft.world.level.block.entity.BlockEntity;
     import net.minecraft.world.level.block.piston.PistonMovingBlockEntity;
     import net.minecraft.world.phys.Vec3;
    @@ -27,10 +29,10 @@ public abstract class PistonHeadRenderer_movableBEMixin implements BlockEntityRe
             dispatcher = arguments.blockEntityRenderDispatcher();
         }
     
    -    @Inject(method = "render", at = @At(value = "INVOKE",
    -            target = "Lnet/minecraft/client/renderer/blockentity/PistonHeadRenderer;renderBlock(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;Lnet/minecraft/world/level/Level;ZI)V",
    +    @Inject(method = "submit(Lnet/minecraft/world/level/block/piston/PistonMovingBlockEntity;FLcom/mojang/blaze3d/vertex/PoseStack;IILnet/minecraft/world/phys/Vec3;Lnet/minecraft/client/renderer/feature/ModelFeatureRenderer$CrumblingOverlay;Lnet/minecraft/client/renderer/SubmitNodeCollector;)V", at = @At(value = "INVOKE",
    +            target = "Lnet/minecraft/client/renderer/blockentity/PistonHeadRenderer;submitMovingBlock(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/SubmitNodeCollector;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/core/Holder;Lnet/minecraft/world/level/Level;)V",
                 ordinal = 3))
    -    private void updateRenderBool(PistonMovingBlockEntity pistonBlockEntity_1, float float_1, PoseStack matrixStack_1, MultiBufferSource layeredVertexConsumerStorage_1, int int_1, int int_2, Vec3 cameraPos, CallbackInfo ci)
    +    private void updateRenderBool(PistonMovingBlockEntity pistonBlockEntity_1, float f, PoseStack poseStack, int i, int j, Vec3 vec3, ModelFeatureRenderer.CrumblingOverlay crumblingOverlay, SubmitNodeCollector submitNodeCollector, CallbackInfo ci)
         //private void updateRenderBool(PistonBlockEntity pistonBlockEntity_1, double double_1, double double_2, double double_3, float float_1, class_4587 class_4587_1, class_4597 class_4597_1, int int_1, CallbackInfo ci)
         {
             if (!((PistonBlockEntityInterface) pistonBlockEntity_1).isRenderModeSet())
    @@ -38,8 +40,9 @@ public abstract class PistonHeadRenderer_movableBEMixin implements BlockEntityRe
         }
     
     
    -    @Inject(method = "render", at = @At("RETURN"), locals = LocalCapture.NO_CAPTURE)
    -    private void endMethod3576(PistonMovingBlockEntity pistonBlockEntity_1, float partialTicks, PoseStack matrixStack_1, MultiBufferSource layeredVertexConsumerStorage_1, int int_1, int init_2, Vec3 cameraPos, CallbackInfo ci)
    +    @Inject(method = "submit(Lnet/minecraft/world/level/block/piston/PistonMovingBlockEntity;FLcom/mojang/blaze3d/vertex/PoseStack;IILnet/minecraft/world/phys/Vec3;Lnet/minecraft/client/renderer/feature/ModelFeatureRenderer$CrumblingOverlay;Lnet/minecraft/client/renderer/SubmitNodeCollector;)V", at = @At("RETURN"), locals = LocalCapture.NO_CAPTURE)
    +    private void endMethod(PistonMovingBlockEntity pistonBlockEntity_1, float partialTicks, PoseStack matrixStack_1, int i, int j, Vec3 vec3, ModelFeatureRenderer.CrumblingOverlay crumblingOverlay, SubmitNodeCollector submitNodeCollector, CallbackInfo ci)
    +    //private void endMethod3576(PistonMovingBlockEntity pistonBlockEntity_1, float partialTicks, PoseStack matrixStack_1, MultiBufferSource layeredVertexConsumerStorage_1, int int_1, int init_2, Vec3 cameraPos, CallbackInfo ci)
         {
             if (((PistonBlockEntityInterface) pistonBlockEntity_1).getRenderCarriedBlockEntity())
             {
    @@ -53,7 +56,7 @@ public abstract class PistonHeadRenderer_movableBEMixin implements BlockEntityRe
                             pistonBlockEntity_1.getYOff(partialTicks),
                             pistonBlockEntity_1.getZOff(partialTicks)
                     );
    -                dispatcher.render(carriedBlockEntity, partialTicks, matrixStack_1, layeredVertexConsumerStorage_1);
    +                dispatcher.submit(carriedBlockEntity, partialTicks, matrixStack_1, crumblingOverlay, submitNodeCollector);
     
                 }
             }
    diff --git a/src/main/java/carpet/patches/EntityPlayerMPFake.java b/src/main/java/carpet/patches/EntityPlayerMPFake.java
    index 06173201..6486a003 100644
    --- a/src/main/java/carpet/patches/EntityPlayerMPFake.java
    +++ b/src/main/java/carpet/patches/EntityPlayerMPFake.java
    @@ -23,6 +23,7 @@ import net.minecraft.server.level.ServerPlayer;
     import net.minecraft.server.network.CommonListenerCookie;
     import net.minecraft.server.players.CachedUserNameToIdResolver;
     import net.minecraft.server.players.NameAndId;
    +import net.minecraft.server.players.OldUsersConverter;
     import net.minecraft.world.damagesource.DamageSource;
     import net.minecraft.world.entity.Entity;
     import net.minecraft.world.entity.EquipmentSlot;
    @@ -43,6 +44,7 @@ import carpet.utils.Messenger;
     import java.util.HashSet;
     import java.util.Optional;
     import java.util.Set;
    +import java.util.UUID;
     import java.util.concurrent.CompletableFuture;
     
     @SuppressWarnings("EntityConstructor")
    @@ -58,24 +60,21 @@ public class EntityPlayerMPFake extends ServerPlayer
         {
             //prolly half of that crap is not necessary, but it works
             ServerLevel worldIn = server.getLevel(dimensionId);
    -        server.nameToIdCache().resolveOfflineUsers(false);
    +        server.services().nameToIdCache().resolveOfflineUsers(false);
             GameProfile gameprofile;
    -        try {
    -            NameAndId res = server.nameToIdCache().get(username).orElseThrow(); //findByName  .orElse(null)
    -            gameprofile = new GameProfile(res.id(), res.name());
    -        }
    -        finally {
    -            server.nameToIdCache().resolveOfflineUsers(server.isDedicatedServer() && server.usesAuthentication());
    -        }
    -        if (gameprofile == null)
    -        {
    -            if (!CarpetSettings.allowSpawningOfflinePlayers)
    -            {
    -                return false;
    -            } else {
    -                gameprofile = new GameProfile(UUIDUtil.createOfflinePlayerUUID(username), username);
    +
    +            UUID uuid = OldUsersConverter.convertMobOwnerIfNecessary(server, username);
    +            //NameAndId res = server.services().nameToIdCache().get(username).orElseThrow(); //findByName  .orElse(null)
    +            if (uuid == null && CarpetSettings.allowSpawningOfflinePlayers) {
    +                server.services().nameToIdCache().resolveOfflineUsers(server.isDedicatedServer() && server.usesAuthentication());
    +                uuid = UUIDUtil.createOfflinePlayerUUID(username);
                 }
    -        }
    +            if (uuid == null) {
    +                return false; // no uuid, no player
    +            }
    +            gameprofile = new GameProfile(uuid, username);
    +
    +
             //GameProfile finalGP = gameprofile;
     
             // We need to mark this player as spawning so that we do not
    @@ -84,7 +83,7 @@ public class EntityPlayerMPFake extends ServerPlayer
             String name = gameprofile.getName();
             spawning.add(name);
     
    -        fetchGameProfile(name).whenCompleteAsync((p, t) -> {
    +        fetchGameProfile(server, gameprofile.getId()).whenCompleteAsync((p, t) -> {
                 // Always remove the name, even if exception occurs
                 spawning.remove(name);
                 if (t != null)
    @@ -92,7 +91,13 @@ public class EntityPlayerMPFake extends ServerPlayer
                     return;
                 }
     
    -            GameProfile current = p.gameProfile();
    +            GameProfile current;
    +            if (p.getName().isEmpty()) {
    +                current = gameprofile;
    +            }
    +            else {
    +                current = p;
    +            }
     
                 EntityPlayerMPFake instance = new EntityPlayerMPFake(server, worldIn, current, ClientInformation.createDefault(), false);
                 instance.fixStartingPosition = () -> instance.snapTo(pos.x, pos.y, pos.z, (float) yaw, (float) pitch);
    @@ -111,9 +116,9 @@ public class EntityPlayerMPFake extends ServerPlayer
             return true;
         }
     
    -    private static CompletableFuture fetchGameProfile(final String name) {
    -        final ResolvableProfile resolvableProfile = new ResolvableProfile(Optional.of(name), Optional.empty(), new PropertyMap());
    -        return resolvableProfile.resolve();
    +    private static CompletableFuture fetchGameProfile(MinecraftServer server, final UUID name) {
    +        final ResolvableProfile resolvableProfile = ResolvableProfile.createUnresolved(name);
    +        return resolvableProfile.resolveProfile(server.services().profileResolver());
         }
     
         public static EntityPlayerMPFake createShadow(MinecraftServer server, ServerPlayer player)
    diff --git a/src/main/java/carpet/script/utils/ShapesRenderer.java b/src/main/java/carpet/script/utils/ShapesRenderer.java
    index d7c1d515..6e5ad40b 100644
    --- a/src/main/java/carpet/script/utils/ShapesRenderer.java
    +++ b/src/main/java/carpet/script/utils/ShapesRenderer.java
    @@ -4,6 +4,7 @@ import carpet.script.CarpetScriptServer;
     import carpet.script.external.Carpet;
     import carpet.script.utils.shapes.ShapeDirection;
     
    +import com.mojang.blaze3d.platform.Lighting;
     import com.mojang.blaze3d.systems.RenderSystem;
     import com.mojang.blaze3d.vertex.BufferBuilder;
     import com.mojang.blaze3d.vertex.ByteBufferBuilder;
    @@ -32,6 +33,8 @@ import net.minecraft.client.renderer.LightTexture;
     import net.minecraft.client.renderer.MultiBufferSource;
     import net.minecraft.client.renderer.RenderType;
     import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
    +import net.minecraft.client.renderer.entity.state.EntityRenderState;
    +import net.minecraft.client.renderer.item.ItemStackRenderState;
     import net.minecraft.client.renderer.texture.OverlayTexture;
     import net.minecraft.core.BlockPos;
     import net.minecraft.core.Direction;
    @@ -438,8 +441,8 @@ public class ShapesRenderer
                             BlockEntityRenderer blockEntityRenderer = client.getBlockEntityRenderDispatcher().getRenderer(BlockEntity);
                             if (blockEntityRenderer != null)
                             {
    -                            blockEntityRenderer.render(BlockEntity, partialTick,
    -                                    matrices, immediate, light, OverlayTexture.NO_OVERLAY, camera1.getPosition());
    +                            blockEntityRenderer.submit(BlockEntity, partialTick,
    +                                    matrices, light, OverlayTexture.NO_OVERLAY, camera1.getPosition(), null, client.gameRenderer.getFeatureRenderDispatcher().getSubmitNodeStorage());
     
                             }
                     }
    @@ -449,8 +452,13 @@ public class ShapesRenderer
                     if (shape.item != null)
                     {
                         // draw the item
    -                    client.getItemRenderer().renderStatic(shape.item, transformType, light,
    -                            OverlayTexture.NO_OVERLAY, matrices, immediate, client.level, (int) shape.key(client.level.registryAccess()));
    +
    +                    final ItemStackRenderState itemState = new ItemStackRenderState();
    +                    client.getItemModelResolver().updateForTopItem(itemState, shape.item, ItemDisplayContext.FIXED, client.level, null, 0);
    +                    itemState.submit(matrices, client.gameRenderer.getFeatureRenderDispatcher().getSubmitNodeStorage(), light, OverlayTexture.NO_OVERLAY, EntityRenderState.NO_OUTLINE);
    +
    +                    //client.getItemRenderer().renderStatic(shape.item, transformType, light,
    +                    //        OverlayTexture.NO_OVERLAY, matrices, immediate, client.level, (int) shape.key(client.level.registryAccess()));
                     }
                 }
                 matrices.popPose();
    
    From 1edd67217671f863759198d658e15c9af87a04ff Mon Sep 17 00:00:00 2001
    From: gnembon 
    Date: Wed, 20 Aug 2025 11:55:01 +0200
    Subject: [PATCH 120/232] 1.4.180
    
    ---
     gradle.properties | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/gradle.properties b/gradle.properties
    index a10391f0..e2a54057 100644
    --- a/gradle.properties
    +++ b/gradle.properties
    @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G
     	fabric_version=0.119.5+1.21.5
     
     # Mod Properties
    -	mod_version = 1.4.179
    +	mod_version = 1.4.180
     	maven_group = carpet
     	archives_base_name = fabric-carpet
     
    
    From dd5f58f719eeb01be010c445063950e968a5f6a8 Mon Sep 17 00:00:00 2001
    From: gnembon 
    Date: Wed, 27 Aug 2025 09:42:28 +0200
    Subject: [PATCH 121/232] maybe fix for item and be rendering
    
    ---
     .../carpet/mixins/LevelRenderer_scarpetRenderMixin.java     | 6 ++++++
     1 file changed, 6 insertions(+)
    
    diff --git a/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java b/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java
    index b49775f4..0a60dc72 100644
    --- a/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java
    +++ b/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java
    @@ -26,6 +26,10 @@ public class LevelRenderer_scarpetRenderMixin
     {
         @Shadow @Final private LevelTargetBundle targets;
     
    +    @Shadow @Final private FeatureRenderDispatcher featureRenderDispatcher;
    +
    +    @Shadow @Final private RenderBuffers renderBuffers;
    +
         @Inject(method = "", at = @At("RETURN"))
         private void addRenderers(Minecraft minecraft, EntityRenderDispatcher entityRenderDispatcher, BlockEntityRenderDispatcher blockEntityRenderDispatcher, RenderBuffers renderBuffers, LevelRenderState levelRenderState, FeatureRenderDispatcher featureRenderDispatcher, CallbackInfo ci)
         {
    @@ -43,6 +47,8 @@ public class LevelRenderer_scarpetRenderMixin
                 FramePass pass = frameGraphBuilder.addPass("scarpet_shapes");
                 targets.main = pass.readsAndWrites(targets.main);
                 pass.executes(() -> CarpetClient.shapes.render(null, camera, f));
    +            featureRenderDispatcher.renderAllFeatures();
    +            renderBuffers.bufferSource().endLastBatch();
             }
         }
     }
    
    From 9408e40d4a1b9ef0ad5b9133ea778f413fb65cad Mon Sep 17 00:00:00 2001
    From: gnembon 
    Date: Wed, 27 Aug 2025 09:57:17 +0200
    Subject: [PATCH 122/232] 25w35a
    
    ---
     gradle.properties                                    | 2 +-
     src/main/java/carpet/CarpetSettings.java             | 4 ++--
     src/main/java/carpet/patches/EntityPlayerMPFake.java | 6 +++---
     3 files changed, 6 insertions(+), 6 deletions(-)
    
    diff --git a/gradle.properties b/gradle.properties
    index e2a54057..3980ba29 100644
    --- a/gradle.properties
    +++ b/gradle.properties
    @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G
     
     # Fabric Properties
     	# check https://fabricmc.net/develop/
    -	minecraft_version=25w34b
    +	minecraft_version=25w35a
     	loader_version=0.16.14
     	jsr305_version=3.0.2
     	fabric_version=0.119.5+1.21.5
    diff --git a/src/main/java/carpet/CarpetSettings.java b/src/main/java/carpet/CarpetSettings.java
    index 338d1e0b..d2a6bad9 100644
    --- a/src/main/java/carpet/CarpetSettings.java
    +++ b/src/main/java/carpet/CarpetSettings.java
    @@ -708,7 +708,7 @@ public class CarpetSettings
     
                 if (server.isDedicatedServer())
                 {
    -                int vd = (newValue >= 2)?newValue:((ServerInterface) server).getProperties().viewDistance;
    +                int vd = (newValue >= 2)?newValue:((ServerInterface) server).getProperties().viewDistance.get();
                     if (vd != server.getPlayerList().getViewDistance())
                         server.getPlayerList().setViewDistance(vd);
                     return newValue;
    @@ -749,7 +749,7 @@ public class CarpetSettings
     
                 if (server.isDedicatedServer())
                 {
    -                int vd = (newValue >= 2)?newValue:((DedicatedServer) server).getProperties().simulationDistance;
    +                int vd = (newValue >= 2)?newValue:((DedicatedServer) server).getProperties().simulationDistance.get();
                     if (vd != server.getPlayerList().getSimulationDistance())
                         server.getPlayerList().setSimulationDistance(vd);
                     return newValue;
    diff --git a/src/main/java/carpet/patches/EntityPlayerMPFake.java b/src/main/java/carpet/patches/EntityPlayerMPFake.java
    index 6486a003..d7cfe239 100644
    --- a/src/main/java/carpet/patches/EntityPlayerMPFake.java
    +++ b/src/main/java/carpet/patches/EntityPlayerMPFake.java
    @@ -80,10 +80,10 @@ public class EntityPlayerMPFake extends ServerPlayer
             // We need to mark this player as spawning so that we do not
             // try to spawn another player with the name while the profile
             // is being fetched - preventing multiple players spawning
    -        String name = gameprofile.getName();
    +        String name = gameprofile.name();
             spawning.add(name);
     
    -        fetchGameProfile(server, gameprofile.getId()).whenCompleteAsync((p, t) -> {
    +        fetchGameProfile(server, gameprofile.id()).whenCompleteAsync((p, t) -> {
                 // Always remove the name, even if exception occurs
                 spawning.remove(name);
                 if (t != null)
    @@ -92,7 +92,7 @@ public class EntityPlayerMPFake extends ServerPlayer
                 }
     
                 GameProfile current;
    -            if (p.getName().isEmpty()) {
    +            if (p.name().isEmpty()) {
                     current = gameprofile;
                 }
                 else {
    
    From d2d6b7033c9c003b344838f430d32d49f68d6b40 Mon Sep 17 00:00:00 2001
    From: gnembon 
    Date: Wed, 27 Aug 2025 09:57:34 +0200
    Subject: [PATCH 123/232] 1.4.181
    
    ---
     gradle.properties | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/gradle.properties b/gradle.properties
    index 3980ba29..ab57b460 100644
    --- a/gradle.properties
    +++ b/gradle.properties
    @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G
     	fabric_version=0.119.5+1.21.5
     
     # Mod Properties
    -	mod_version = 1.4.180
    +	mod_version = 1.4.181
     	maven_group = carpet
     	archives_base_name = fabric-carpet
     
    
    From 6533716c93514ec11d2f3c3dfe3cd8ad308ed3d6 Mon Sep 17 00:00:00 2001
    From: gnembon 
    Date: Thu, 4 Sep 2025 02:00:50 +0200
    Subject: [PATCH 124/232] fix item and be rendering in shapes
    
    ---
     .../java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java    | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java b/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java
    index 0a60dc72..b9366e8b 100644
    --- a/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java
    +++ b/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java
    @@ -36,7 +36,7 @@ public class LevelRenderer_scarpetRenderMixin
             CarpetClient.shapes = new ShapesRenderer(minecraft);
         }
     
    -    @Inject(method = "addParticlesPass", at = @At("RETURN"))
    +    @Inject(method = "addMainPass", at = @At("RETURN"))
         private void renderScarpetThingsLate(FrameGraphBuilder frameGraphBuilder, Camera camera, float f, GpuBufferSlice fogParameters, CallbackInfo ci)
         {
             // in normal circumstances we want to render shapes at the very end so it appears correctly behind stuff.
    
    From f371e2e8bd867399ab6d47505255b5a174057fce Mon Sep 17 00:00:00 2001
    From: gnembon 
    Date: Thu, 4 Sep 2025 02:08:10 +0200
    Subject: [PATCH 125/232] 25w36b
    
    ---
     gradle.properties                             |  2 +-
     src/main/java/carpet/CarpetServer.java        |  2 +-
     src/main/java/carpet/CarpetSettings.java      |  2 +-
     .../java/carpet/commands/PlayerCommand.java   |  4 +-
     .../fakes/PistonHeadRenderStateInterface.java |  8 ++
     .../mixins/LevelChunk_movableBEMixin.java     |  9 +--
     .../LevelRenderer_scarpetRenderMixin.java     |  9 ++-
     .../mixins/LivingEntity_cleanLogsMixin.java   |  2 +-
     .../PistonHeadRenderState_movableBEMixin.java | 20 +++++
     .../PistonHeadRenderer_movableBEMixin.java    | 69 ++++++++--------
     .../mixins/Player_antiCheatDisabledMixin.java |  2 +-
     .../carpet/mixins/Player_parrotMixin.java     | 73 +++--------------
     ...PacketListenerImpl_scarpetEventsMixin.java |  4 +-
     .../mixins/ServerPlayer_parrotMixin.java      | 80 +++++++++++++++++++
     .../mixins/StructureBlockRenderer_mixin.java  |  3 +-
     .../carpet/network/ServerNetworkHandler.java  | 14 ++--
     .../carpet/patches/EntityPlayerMPFake.java    |  6 +-
     .../patches/TickSyncedBorderExtent.java       |  7 +-
     .../java/carpet/script/CarpetEventServer.java |  8 +-
     .../java/carpet/script/EntityEventsGroup.java |  6 +-
     .../java/carpet/script/annotation/Param.java  |  2 +-
     .../carpet/script/utils/ShapeDispatcher.java  |  2 +-
     .../carpet/script/utils/ShapesRenderer.java   | 15 +++-
     .../script/utils/SnoopyCommandSource.java     |  6 +-
     .../java/carpet/script/value/EntityValue.java | 12 +--
     .../java/carpet/script/value/ScreenValue.java |  2 +-
     .../carpet/script/value/ValueConversions.java |  2 +-
     src/main/java/carpet/utils/WoolTool.java      |  2 +-
     src/main/resources/carpet.mixins.json         |  2 +
     29 files changed, 222 insertions(+), 153 deletions(-)
     create mode 100644 src/main/java/carpet/fakes/PistonHeadRenderStateInterface.java
     create mode 100644 src/main/java/carpet/mixins/PistonHeadRenderState_movableBEMixin.java
     create mode 100644 src/main/java/carpet/mixins/ServerPlayer_parrotMixin.java
    
    diff --git a/gradle.properties b/gradle.properties
    index ab57b460..4a2e6a78 100644
    --- a/gradle.properties
    +++ b/gradle.properties
    @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G
     
     # Fabric Properties
     	# check https://fabricmc.net/develop/
    -	minecraft_version=25w35a
    +	minecraft_version=25w36b
     	loader_version=0.16.14
     	jsr305_version=3.0.2
     	fabric_version=0.119.5+1.21.5
    diff --git a/src/main/java/carpet/CarpetServer.java b/src/main/java/carpet/CarpetServer.java
    index 65ffb8ad..ed85b9c8 100644
    --- a/src/main/java/carpet/CarpetServer.java
    +++ b/src/main/java/carpet/CarpetServer.java
    @@ -162,7 +162,7 @@ public class CarpetServer // static for now - easier to handle all around the co
             LoggerRegistry.playerDisconnected(player);
             extensions.forEach(e -> e.onPlayerLoggedOut(player));
             // first case client, second case server
    -        CarpetScriptServer runningScriptServer = (player.getServer() == null) ? scriptServer : Vanilla.MinecraftServer_getScriptServer(player.getServer());
    +        CarpetScriptServer runningScriptServer = (player.level().getServer() == null) ? scriptServer : Vanilla.MinecraftServer_getScriptServer(player.level().getServer());
             if (runningScriptServer != null && !runningScriptServer.stopAll) {
                 runningScriptServer.onPlayerLoggedOut(player, reason);
             }
    diff --git a/src/main/java/carpet/CarpetSettings.java b/src/main/java/carpet/CarpetSettings.java
    index d2a6bad9..82bba777 100644
    --- a/src/main/java/carpet/CarpetSettings.java
    +++ b/src/main/java/carpet/CarpetSettings.java
    @@ -1006,7 +1006,7 @@ public class CarpetSettings
                         {
                             double from = worldBorder.getSize();
                             double to = worldBorder.getLerpTarget();
    -                        long time = worldBorder.getLerpRemainingTime();
    +                        long time = worldBorder.getLerpTime();
                             worldBorder.lerpSizeBetween(from, to, time);
                         }
                     }
    diff --git a/src/main/java/carpet/commands/PlayerCommand.java b/src/main/java/carpet/commands/PlayerCommand.java
    index 4ad63884..a20934c2 100644
    --- a/src/main/java/carpet/commands/PlayerCommand.java
    +++ b/src/main/java/carpet/commands/PlayerCommand.java
    @@ -350,12 +350,12 @@ public class PlayerCommand
                 Messenger.m(context.getSource(), "r Cannot shadow fake players");
                 return 0;
             }
    -        if (player.getServer().isSingleplayerOwner(player.nameAndId())) {
    +        if (player.level().getServer().isSingleplayerOwner(player.nameAndId())) {
                 Messenger.m(context.getSource(), "r Cannot shadow single-player server owner");
                 return 0;
             }
     
    -        EntityPlayerMPFake.createShadow(player.getServer(), player);
    +        EntityPlayerMPFake.createShadow(player.level().getServer(), player);
             return 1;
         }
     }
    diff --git a/src/main/java/carpet/fakes/PistonHeadRenderStateInterface.java b/src/main/java/carpet/fakes/PistonHeadRenderStateInterface.java
    new file mode 100644
    index 00000000..a1f0f7fc
    --- /dev/null
    +++ b/src/main/java/carpet/fakes/PistonHeadRenderStateInterface.java
    @@ -0,0 +1,8 @@
    +package carpet.fakes;
    +
    +import net.minecraft.client.renderer.blockentity.state.BlockEntityRenderState;
    +
    +public interface PistonHeadRenderStateInterface {
    +    public BlockEntityRenderState getMovedBERenderState();
    +    public void setMovedBERenderState(BlockEntityRenderState state);
    +}
    diff --git a/src/main/java/carpet/mixins/LevelChunk_movableBEMixin.java b/src/main/java/carpet/mixins/LevelChunk_movableBEMixin.java
    index 5ef7502a..155f66d5 100644
    --- a/src/main/java/carpet/mixins/LevelChunk_movableBEMixin.java
    +++ b/src/main/java/carpet/mixins/LevelChunk_movableBEMixin.java
    @@ -18,10 +18,7 @@ import net.minecraft.world.level.block.EntityBlock;
     import net.minecraft.world.level.block.entity.BlockEntity;
     import net.minecraft.world.level.block.piston.MovingPistonBlock;
     import net.minecraft.world.level.block.state.BlockState;
    -import net.minecraft.world.level.chunk.ChunkAccess;
    -import net.minecraft.world.level.chunk.LevelChunk;
    -import net.minecraft.world.level.chunk.LevelChunkSection;
    -import net.minecraft.world.level.chunk.UpgradeData;
    +import net.minecraft.world.level.chunk.*;
     import net.minecraft.world.level.levelgen.Heightmap;
     import net.minecraft.world.level.levelgen.blending.BlendingData;
     import net.minecraft.world.level.lighting.LightEngine;
    @@ -39,8 +36,8 @@ public abstract class LevelChunk_movableBEMixin extends ChunkAccess implements W
         @Final
         Level level;
     
    -    public LevelChunk_movableBEMixin(ChunkPos pos, UpgradeData upgradeData, LevelHeightAccessor heightLimitView, Registry biome, long inhabitedTime, @Nullable LevelChunkSection[] sectionArrayInitializer, @Nullable BlendingData blendingData) {
    -        super(pos, upgradeData, heightLimitView, biome, inhabitedTime, sectionArrayInitializer, blendingData);
    +    public LevelChunk_movableBEMixin(ChunkPos chunkPos, UpgradeData upgradeData, LevelHeightAccessor levelHeightAccessor, PalettedContainerFactory palettedContainerFactory, long l, @Nullable LevelChunkSection[] levelChunkSections, @Nullable BlendingData blendingData) {
    +        super(chunkPos, upgradeData, levelHeightAccessor, palettedContainerFactory, l, levelChunkSections, blendingData);
         }
     
         @Shadow
    diff --git a/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java b/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java
    index b9366e8b..2da7a7b8 100644
    --- a/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java
    +++ b/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java
    @@ -6,14 +6,18 @@ import com.mojang.blaze3d.buffers.GpuBufferSlice;
     import com.mojang.blaze3d.framegraph.FrameGraphBuilder;
     import com.mojang.blaze3d.framegraph.FramePass;
     import net.minecraft.client.Camera;
    +import net.minecraft.client.DeltaTracker;
     import net.minecraft.client.Minecraft;
     import net.minecraft.client.renderer.LevelRenderState;
     import net.minecraft.client.renderer.LevelRenderer;
     import net.minecraft.client.renderer.LevelTargetBundle;
     import net.minecraft.client.renderer.RenderBuffers;
     import net.minecraft.client.renderer.blockentity.BlockEntityRenderDispatcher;
    +import net.minecraft.client.renderer.culling.Frustum;
     import net.minecraft.client.renderer.entity.EntityRenderDispatcher;
     import net.minecraft.client.renderer.feature.FeatureRenderDispatcher;
    +import net.minecraft.util.profiling.ProfilerFiller;
    +import org.joml.Matrix4f;
     import org.spongepowered.asm.mixin.Final;
     import org.spongepowered.asm.mixin.Mixin;
     import org.spongepowered.asm.mixin.Shadow;
    @@ -37,16 +41,17 @@ public class LevelRenderer_scarpetRenderMixin
         }
     
         @Inject(method = "addMainPass", at = @At("RETURN"))
    -    private void renderScarpetThingsLate(FrameGraphBuilder frameGraphBuilder, Camera camera, float f, GpuBufferSlice fogParameters, CallbackInfo ci)
    +    private void renderScarpetThingsLate(FrameGraphBuilder frameGraphBuilder, Frustum frustum, Camera camera, Matrix4f matrix4f, GpuBufferSlice gpuBufferSlice, boolean bl, LevelRenderState levelRenderState, DeltaTracker deltaTracker, ProfilerFiller profilerFiller, CallbackInfo ci)
         {
             // in normal circumstances we want to render shapes at the very end so it appears correctly behind stuff.
             // we might actually not need to play with render hooks here.
             //if (!FabricAPIHooks.WORLD_RENDER_EVENTS && CarpetClient.shapes != null )
             if (CarpetClient.shapes != null)
             {
    +            final float deltaPartialTick = deltaTracker.getGameTimeDeltaPartialTick(false);
                 FramePass pass = frameGraphBuilder.addPass("scarpet_shapes");
                 targets.main = pass.readsAndWrites(targets.main);
    -            pass.executes(() -> CarpetClient.shapes.render(null, camera, f));
    +            pass.executes(() -> CarpetClient.shapes.render(null, camera, deltaPartialTick));
                 featureRenderDispatcher.renderAllFeatures();
                 renderBuffers.bufferSource().endLastBatch();
             }
    diff --git a/src/main/java/carpet/mixins/LivingEntity_cleanLogsMixin.java b/src/main/java/carpet/mixins/LivingEntity_cleanLogsMixin.java
    index 16b5306f..d11d32d4 100644
    --- a/src/main/java/carpet/mixins/LivingEntity_cleanLogsMixin.java
    +++ b/src/main/java/carpet/mixins/LivingEntity_cleanLogsMixin.java
    @@ -23,6 +23,6 @@ public abstract class LivingEntity_cleanLogsMixin extends Entity
         @Redirect(method = "die", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/LivingEntity;hasCustomName()Z"))
         private boolean shouldLogDeaths(LivingEntity livingEntity)
         {
    -        return livingEntity.hasCustomName() && CarpetSettings.cleanLogs && livingEntity.getServer().getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES);
    +        return livingEntity.hasCustomName() && CarpetSettings.cleanLogs && livingEntity.level().getServer().getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES);
         }
     }
    diff --git a/src/main/java/carpet/mixins/PistonHeadRenderState_movableBEMixin.java b/src/main/java/carpet/mixins/PistonHeadRenderState_movableBEMixin.java
    new file mode 100644
    index 00000000..fe719ad6
    --- /dev/null
    +++ b/src/main/java/carpet/mixins/PistonHeadRenderState_movableBEMixin.java
    @@ -0,0 +1,20 @@
    +package carpet.mixins;
    +
    +import carpet.fakes.PistonHeadRenderStateInterface;
    +import net.minecraft.client.renderer.blockentity.state.BlockEntityRenderState;
    +import net.minecraft.client.renderer.blockentity.state.PistonHeadRenderState;
    +import org.spongepowered.asm.mixin.Mixin;
    +
    +@Mixin(PistonHeadRenderState.class)
    +public class PistonHeadRenderState_movableBEMixin implements PistonHeadRenderStateInterface {
    +    private BlockEntityRenderState blockEntityRenderState;
    +    @Override
    +    public BlockEntityRenderState getMovedBERenderState() {
    +        return blockEntityRenderState;
    +    }
    +
    +    @Override
    +    public void setMovedBERenderState(BlockEntityRenderState state) {
    +        this.blockEntityRenderState = state;
    +    }
    +}
    diff --git a/src/main/java/carpet/mixins/PistonHeadRenderer_movableBEMixin.java b/src/main/java/carpet/mixins/PistonHeadRenderer_movableBEMixin.java
    index 4627ad6c..16a9bbd3 100644
    --- a/src/main/java/carpet/mixins/PistonHeadRenderer_movableBEMixin.java
    +++ b/src/main/java/carpet/mixins/PistonHeadRenderer_movableBEMixin.java
    @@ -1,14 +1,16 @@
     package carpet.mixins;
     
     import carpet.CarpetSettings;
    +import carpet.fakes.PistonHeadRenderStateInterface;
     import carpet.fakes.PistonBlockEntityInterface;
     import com.mojang.blaze3d.vertex.PoseStack;
    -import net.minecraft.client.renderer.MultiBufferSource;
    +import net.minecraft.client.Minecraft;
     import net.minecraft.client.renderer.SubmitNodeCollector;
     import net.minecraft.client.renderer.blockentity.BlockEntityRenderDispatcher;
     import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
    -import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
     import net.minecraft.client.renderer.blockentity.PistonHeadRenderer;
    +import net.minecraft.client.renderer.blockentity.state.BlockEntityRenderState;
    +import net.minecraft.client.renderer.blockentity.state.PistonHeadRenderState;
     import net.minecraft.client.renderer.feature.ModelFeatureRenderer;
     import net.minecraft.world.level.block.entity.BlockEntity;
     import net.minecraft.world.level.block.piston.PistonMovingBlockEntity;
    @@ -17,48 +19,51 @@ import org.spongepowered.asm.mixin.Mixin;
     import org.spongepowered.asm.mixin.injection.At;
     import org.spongepowered.asm.mixin.injection.Inject;
     import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
    -import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
     
     @Mixin(PistonHeadRenderer.class)
    -public abstract class PistonHeadRenderer_movableBEMixin implements BlockEntityRenderer
    +public abstract class PistonHeadRenderer_movableBEMixin implements BlockEntityRenderer
     {
         BlockEntityRenderDispatcher dispatcher;
         @Inject(method = "", at = @At("TAIL"))
    -    private void onInitCM(BlockEntityRendererProvider.Context arguments, CallbackInfo ci)
    +    private void onInitCM(CallbackInfo ci)
         {
    -        dispatcher = arguments.blockEntityRenderDispatcher();
    +        dispatcher = Minecraft.getInstance().getBlockEntityRenderDispatcher();
         }
     
    -    @Inject(method = "submit(Lnet/minecraft/world/level/block/piston/PistonMovingBlockEntity;FLcom/mojang/blaze3d/vertex/PoseStack;IILnet/minecraft/world/phys/Vec3;Lnet/minecraft/client/renderer/feature/ModelFeatureRenderer$CrumblingOverlay;Lnet/minecraft/client/renderer/SubmitNodeCollector;)V", at = @At(value = "INVOKE",
    -            target = "Lnet/minecraft/client/renderer/blockentity/PistonHeadRenderer;submitMovingBlock(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/SubmitNodeCollector;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/core/Holder;Lnet/minecraft/world/level/Level;)V",
    -            ordinal = 3))
    -    private void updateRenderBool(PistonMovingBlockEntity pistonBlockEntity_1, float f, PoseStack poseStack, int i, int j, Vec3 vec3, ModelFeatureRenderer.CrumblingOverlay crumblingOverlay, SubmitNodeCollector submitNodeCollector, CallbackInfo ci)
    -    //private void updateRenderBool(PistonBlockEntity pistonBlockEntity_1, double double_1, double double_2, double double_3, float float_1, class_4587 class_4587_1, class_4597 class_4597_1, int int_1, CallbackInfo ci)
    +    @Inject(method = "extractRenderState(Lnet/minecraft/world/level/block/piston/PistonMovingBlockEntity;Lnet/minecraft/client/renderer/blockentity/state/PistonHeadRenderState;FLnet/minecraft/world/phys/Vec3;Lnet/minecraft/client/renderer/feature/ModelFeatureRenderer$CrumblingOverlay;)V",
    +            at = @At("RETURN"))
    +    private void addBE(PistonMovingBlockEntity pistonMovingBlockEntity, PistonHeadRenderState pistonHeadRenderState, float f, Vec3 vec3, ModelFeatureRenderer.CrumblingOverlay crumblingOverlay, CallbackInfo ci)
         {
    -        if (!((PistonBlockEntityInterface) pistonBlockEntity_1).isRenderModeSet())
    -            ((PistonBlockEntityInterface) pistonBlockEntity_1).setRenderCarriedBlockEntity(CarpetSettings.movableBlockEntities && ((PistonBlockEntityInterface) pistonBlockEntity_1).getCarriedBlockEntity() != null);
    -    }
    -
    -
    -    @Inject(method = "submit(Lnet/minecraft/world/level/block/piston/PistonMovingBlockEntity;FLcom/mojang/blaze3d/vertex/PoseStack;IILnet/minecraft/world/phys/Vec3;Lnet/minecraft/client/renderer/feature/ModelFeatureRenderer$CrumblingOverlay;Lnet/minecraft/client/renderer/SubmitNodeCollector;)V", at = @At("RETURN"), locals = LocalCapture.NO_CAPTURE)
    -    private void endMethod(PistonMovingBlockEntity pistonBlockEntity_1, float partialTicks, PoseStack matrixStack_1, int i, int j, Vec3 vec3, ModelFeatureRenderer.CrumblingOverlay crumblingOverlay, SubmitNodeCollector submitNodeCollector, CallbackInfo ci)
    -    //private void endMethod3576(PistonMovingBlockEntity pistonBlockEntity_1, float partialTicks, PoseStack matrixStack_1, MultiBufferSource layeredVertexConsumerStorage_1, int int_1, int init_2, Vec3 cameraPos, CallbackInfo ci)
    -    {
    -        if (((PistonBlockEntityInterface) pistonBlockEntity_1).getRenderCarriedBlockEntity())
    +        if (CarpetSettings.movableBlockEntities)
             {
    -            BlockEntity carriedBlockEntity = ((PistonBlockEntityInterface) pistonBlockEntity_1).getCarriedBlockEntity();
    -            if (carriedBlockEntity != null)
    +            BlockEntity be = ((PistonBlockEntityInterface) pistonMovingBlockEntity).getCarriedBlockEntity();
    +            if (be != null)
                 {
    -                // maybe ??? carriedBlockEntity.setPos(pistonBlockEntity_1.getPos());
    -                //((BlockEntityRenderDispatcherInterface) BlockEntityRenderDispatcher.INSTANCE).renderBlockEntityOffset(carriedBlockEntity, float_1, int_1, BlockRenderLayer.field_20799, bufferBuilder_1, pistonBlockEntity_1.getRenderOffsetX(float_1), pistonBlockEntity_1.getRenderOffsetY(float_1), pistonBlockEntity_1.getRenderOffsetZ(float_1));
    -                matrixStack_1.translate(
    -                        pistonBlockEntity_1.getXOff(partialTicks),
    -                        pistonBlockEntity_1.getYOff(partialTicks),
    -                        pistonBlockEntity_1.getZOff(partialTicks)
    -                );
    -                dispatcher.submit(carriedBlockEntity, partialTicks, matrixStack_1, crumblingOverlay, submitNodeCollector);
    -
    +                float progress = pistonMovingBlockEntity.getProgress(f);
    +                //System.out.println("progress: " + progress);
    +                //if (progress != 0) {
    +                    BlockEntityRenderState res = dispatcher.tryExtractRenderState(be, f, crumblingOverlay);
    +                    if (res != null) {
    +                        ((PistonHeadRenderStateInterface) pistonHeadRenderState).setMovedBERenderState(res);
    +                    }
    +                //}
                 }
             }
         }
    +
    +    @Inject(method = "submit(Lnet/minecraft/client/renderer/blockentity/state/PistonHeadRenderState;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/SubmitNodeCollector;)V",
    +            at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/SubmitNodeCollector;submitMovingBlock(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/block/MovingBlockRenderState;)V",
    +            ordinal = 0))
    +    private void endMethod(PistonHeadRenderState pistonHeadRenderState, PoseStack poseStack, SubmitNodeCollector submitNodeCollector, CallbackInfo ci)
    +    //private void endMethod(PistonMovingBlockEntity pistonBlockEntity_1, float partialTicks, PoseStack matrixStack_1, int i, int j, Vec3 vec3, ModelFeatureRenderer.CrumblingOverlay crumblingOverlay, SubmitNodeCollector submitNodeCollector, CallbackInfo ci)
    +    //private void endMethod3576(PistonMovingBlockEntity pistonBlockEntity_1, float partialTicks, PoseStack matrixStack_1, MultiBufferSource layeredVertexConsumerStorage_1, int int_1, int init_2, Vec3 cameraPos, CallbackInfo ci)
    +    {
    +        if (pistonHeadRenderState instanceof PistonHeadRenderStateInterface mbrsi && pistonHeadRenderState.block != null)
    +            if (mbrsi.getMovedBERenderState() != null) {
    +                BlockEntityRenderState res = mbrsi.getMovedBERenderState();
    +                if (res != null) {
    +                    dispatcher.submit(res, poseStack, submitNodeCollector);
    +                }
    +            }
    +    }
     }
    diff --git a/src/main/java/carpet/mixins/Player_antiCheatDisabledMixin.java b/src/main/java/carpet/mixins/Player_antiCheatDisabledMixin.java
    index 2a4b6ed0..6a9a8469 100644
    --- a/src/main/java/carpet/mixins/Player_antiCheatDisabledMixin.java
    +++ b/src/main/java/carpet/mixins/Player_antiCheatDisabledMixin.java
    @@ -32,7 +32,7 @@ public abstract class Player_antiCheatDisabledMixin extends LivingEntity
         @Inject(method = "tryToStartFallFlying", at = @At("HEAD"), cancellable = true)
         private void allowDeploys(CallbackInfoReturnable cir)
         {
    -        if (CarpetSettings.antiCheatDisabled && (Object)this instanceof ServerPlayer sp && sp.getServer().isDedicatedServer())
    +        if (CarpetSettings.antiCheatDisabled && (Object)this instanceof ServerPlayer sp && sp.level().getServer().isDedicatedServer())
             {
                 ItemStack itemStack_1 = equipment.get(EquipmentSlot.CHEST);
                 if (itemStack_1.getItem() == Items.ELYTRA && !itemStack_1.nextDamageWillBreak()) {
    diff --git a/src/main/java/carpet/mixins/Player_parrotMixin.java b/src/main/java/carpet/mixins/Player_parrotMixin.java
    index ef01e4c6..636747f5 100644
    --- a/src/main/java/carpet/mixins/Player_parrotMixin.java
    +++ b/src/main/java/carpet/mixins/Player_parrotMixin.java
    @@ -1,8 +1,10 @@
     package carpet.mixins;
     
     import carpet.CarpetSettings;
    +import com.mojang.authlib.GameProfile;
     import net.minecraft.nbt.CompoundTag;
     import net.minecraft.server.level.ServerLevel;
    +import net.minecraft.server.level.ServerPlayer;
     import net.minecraft.world.damagesource.DamageSource;
     import net.minecraft.world.entity.EntityType;
     import net.minecraft.world.entity.LivingEntity;
    @@ -21,76 +23,21 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
     @Mixin(Player.class)
     public abstract class Player_parrotMixin extends LivingEntity
     {
    -    @Shadow @Final public Abilities abilities;
    -    
         @Shadow protected abstract void removeEntitiesOnShoulder();
    -    
    -    @Shadow public abstract CompoundTag getShoulderEntityLeft();
    -    
    -    @Shadow protected abstract void setShoulderEntityLeft(CompoundTag NbtCompound_1);
    -    
    -    @Shadow protected abstract void setShoulderEntityRight(CompoundTag NbtCompound_1);
    -    
    -    @Shadow public abstract CompoundTag getShoulderEntityRight();
     
    -    @Shadow protected abstract void respawnEntityOnShoulder(CompoundTag entityNbt);
    +    protected Player_parrotMixin(EntityType entityType, Level level) {
    +        super(entityType, level);
    +    }
     
    -    protected Player_parrotMixin(EntityType entityType_1, Level world_1)
    -    {
    -        super(entityType_1, world_1);
    -    }
    -    
    -    @Redirect(method = "aiStep", at = @At(value = "INVOKE",
    -              target = "Lnet/minecraft/world/entity/player/Player;removeEntitiesOnShoulder()V"))
    -    private void cancelDropShoulderEntities1(Player playerEntity)
    -    {
    -    
    -    }
    -    
    -    @Inject(method = "aiStep", at = @At(value = "INVOKE", shift = At.Shift.AFTER, ordinal = 1,
    -            target = "Lnet/minecraft/world/entity/player/Player;playShoulderEntityAmbientSound(Lnet/minecraft/nbt/CompoundTag;)V"))
    -    private void onTickMovement(CallbackInfo ci)
    -    {
    -        boolean parrots_will_drop = !CarpetSettings.persistentParrots || this.abilities.invulnerable;
    -        if (!this.level().isClientSide() && ((parrots_will_drop && this.fallDistance > 0.5F) || this.isInWater() || this.abilities.flying || isSleeping()))
    -        {
    -            this.removeEntitiesOnShoulder();
    -        }
    -    }
    -    
         @Redirect(method = "hurtServer", at = @At(value = "INVOKE",
                   target = "Lnet/minecraft/world/entity/player/Player;removeEntitiesOnShoulder()V"))
         private void cancelDropShoulderEntities2(Player playerEntity)
         {
    -    
    -    }
    -    
    -    protected void dismount_left()
    -    {
    -        respawnEntityOnShoulder(this.getShoulderEntityLeft());
    -        this.setShoulderEntityLeft(new CompoundTag());
    -    }
    -    
    -    protected void dismount_right()
    -    {
    -        respawnEntityOnShoulder(this.getShoulderEntityRight());
    -        this.setShoulderEntityRight(new CompoundTag());
    -    }
    -    
    -    @Inject(method = "hurtServer", at = @At(value = "INVOKE", shift = At.Shift.BEFORE,
    -            target = "Lnet/minecraft/world/entity/player/Player;removeEntitiesOnShoulder()V"))
    -    private void onDamage(ServerLevel serverLevel, DamageSource damageSource_1, float float_1, CallbackInfoReturnable cir)
    -    {
    -        if (CarpetSettings.persistentParrots && !this.isShiftKeyDown())
    -        {
    -            if (this.random.nextFloat() < ((float_1)/15.0) )
    -            {
    -                this.dismount_left();
    -            }
    -            if (this.random.nextFloat() < ((float_1)/15.0) )
    -            {
    -                this.dismount_right();
    -            }
    +        if (!CarpetSettings.persistentParrots) {
    +            removeEntitiesOnShoulder();
             }
         }
    +    
    +
    +
     }
    diff --git a/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java b/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java
    index f14d6385..a85d6108 100644
    --- a/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java
    +++ b/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java
    @@ -257,7 +257,7 @@ public class ServerGamePacketListenerImpl_scarpetEventsMixin
         {
             if (PLAYER_CHOOSES_RECIPE.isNeeded())
             {
    -            RecipeManager.ServerDisplayInfo displayInfo = player.getServer().getRecipeManager().getRecipeFromDisplay(packet.recipe());
    +            RecipeManager.ServerDisplayInfo displayInfo = player.level().getServer().getRecipeManager().getRecipeFromDisplay(packet.recipe());
                 if (displayInfo == null) {
                     return;
                 }
    @@ -268,7 +268,7 @@ public class ServerGamePacketListenerImpl_scarpetEventsMixin
         @Inject(method = "handleSetCarriedItem", at = @At("HEAD"))
         private void onUpdatedSelectedSLot(ServerboundSetCarriedItemPacket packet, CallbackInfo ci)
         {
    -        if (PLAYER_SWITCHES_SLOT.isNeeded() && player.getServer() != null && player.getServer().isSameThread())
    +        if (PLAYER_SWITCHES_SLOT.isNeeded() && player.level().getServer() != null && player.level().getServer().isSameThread())
             {
                 PLAYER_SWITCHES_SLOT.onSlotSwitch(player, player.getInventory().getSelectedSlot(), packet.getSlot());
             }
    diff --git a/src/main/java/carpet/mixins/ServerPlayer_parrotMixin.java b/src/main/java/carpet/mixins/ServerPlayer_parrotMixin.java
    new file mode 100644
    index 00000000..a393cec3
    --- /dev/null
    +++ b/src/main/java/carpet/mixins/ServerPlayer_parrotMixin.java
    @@ -0,0 +1,80 @@
    +package carpet.mixins;
    +
    +import carpet.CarpetSettings;
    +import com.mojang.authlib.GameProfile;
    +import net.minecraft.nbt.CompoundTag;
    +import net.minecraft.server.level.ServerLevel;
    +import net.minecraft.server.level.ServerPlayer;
    +import net.minecraft.world.damagesource.DamageSource;
    +import net.minecraft.world.entity.player.Player;
    +import net.minecraft.world.level.Level;
    +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.Inject;
    +import org.spongepowered.asm.mixin.injection.Redirect;
    +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
    +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
    +
    +@Mixin(ServerPlayer.class)
    +public abstract class ServerPlayer_parrotMixin extends Player {
    +
    +    @Shadow
    +    public abstract CompoundTag getShoulderEntityLeft();
    +
    +    @Shadow protected abstract void setShoulderEntityLeft(CompoundTag NbtCompound_1);
    +
    +    @Shadow protected abstract void setShoulderEntityRight(CompoundTag NbtCompound_1);
    +
    +    @Shadow public abstract CompoundTag getShoulderEntityRight();
    +
    +    @Shadow protected abstract void respawnEntityOnShoulder(CompoundTag entityNbt);
    +
    +    public ServerPlayer_parrotMixin(Level level, GameProfile gameProfile) {
    +        super(level, gameProfile);
    +    }
    +
    +
    +    protected void dismount_left()
    +    {
    +        respawnEntityOnShoulder(this.getShoulderEntityLeft());
    +        this.setShoulderEntityLeft(new CompoundTag());
    +    }
    +
    +    protected void dismount_right()
    +    {
    +        respawnEntityOnShoulder(this.getShoulderEntityRight());
    +        this.setShoulderEntityRight(new CompoundTag());
    +    }
    +
    +    @Inject(method = "hurtServer", at = @At("HEAD"))
    +    private void onDamage(ServerLevel serverLevel, DamageSource damageSource_1, float float_1, CallbackInfoReturnable cir)
    +    {
    +        if (CarpetSettings.persistentParrots && !this.isShiftKeyDown())
    +        {
    +            if (this.random.nextFloat() < ((float_1)/15.0) )
    +            {
    +                this.dismount_left();
    +            }
    +            if (this.random.nextFloat() < ((float_1)/15.0) )
    +            {
    +                this.dismount_right();
    +            }
    +        }
    +    }
    +
    +
    +    @Redirect(method = "handleShoulderEntities", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/ServerPlayer;removeEntitiesOnShoulder()V"))
    +    private void onRespawnParrotsInstead(ServerPlayer serverPlayer)
    +    {
    +        if (!CarpetSettings.persistentParrots)
    +        {
    +            this.removeEntitiesOnShoulder();
    +            return;
    +        }
    +        if (((getAbilities().invulnerable && this.fallDistance > 0.5F) || this.isInWater() || this.getAbilities().flying || isSleeping() || isInPowderSnow))
    +        {
    +            this.removeEntitiesOnShoulder();
    +        }
    +    }
    +}
    diff --git a/src/main/java/carpet/mixins/StructureBlockRenderer_mixin.java b/src/main/java/carpet/mixins/StructureBlockRenderer_mixin.java
    index 9fddba60..707be33e 100644
    --- a/src/main/java/carpet/mixins/StructureBlockRenderer_mixin.java
    +++ b/src/main/java/carpet/mixins/StructureBlockRenderer_mixin.java
    @@ -3,6 +3,7 @@ package carpet.mixins;
     import carpet.CarpetSettings;
     import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
     import net.minecraft.client.renderer.blockentity.BlockEntityWithBoundingBoxRenderer;
    +import net.minecraft.client.renderer.blockentity.state.BlockEntityWithBoundingBoxRenderState;
     import net.minecraft.world.level.block.entity.StructureBlockEntity;
     import org.spongepowered.asm.mixin.Mixin;
     import org.spongepowered.asm.mixin.injection.At;
    @@ -10,7 +11,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
     import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
     
     @Mixin(BlockEntityWithBoundingBoxRenderer.class)
    -public abstract class StructureBlockRenderer_mixin implements BlockEntityRenderer
    +public abstract class StructureBlockRenderer_mixin implements BlockEntityRenderer
     {
         @Inject(method = "getViewDistance", at = @At("HEAD"), cancellable = true)
         void newLimit(CallbackInfoReturnable cir)
    diff --git a/src/main/java/carpet/network/ServerNetworkHandler.java b/src/main/java/carpet/network/ServerNetworkHandler.java
    index ed394c99..bb32684b 100644
    --- a/src/main/java/carpet/network/ServerNetworkHandler.java
    +++ b/src/main/java/carpet/network/ServerNetworkHandler.java
    @@ -61,7 +61,7 @@ public class ServerNetworkHandler
             {
                 CarpetSettings.LOG.warn("Player " + playerEntity.getName().getString() + " joined with another carpet version: " + version);
             }
    -        DataBuilder data = DataBuilder.create(playerEntity.getServer()); // tickrate related settings are sent on world change
    +        DataBuilder data = DataBuilder.create(playerEntity.level().getServer()); // tickrate related settings are sent on world change
             CarpetServer.forEachManager(sm -> sm.getCarpetRules().forEach(data::withRule));
             playerEntity.connection.send(data.build());
         }
    @@ -84,13 +84,13 @@ public class ServerNetworkHandler
             List output = new ArrayList<>();
             Component[] error = {null};
             int[] returnValue = {0};
    -        if (player.getServer() == null)
    +        if (player.level().getServer() == null)
             {
                 error[0] = Component.literal("No Server");
             }
             else
             {
    -            player.getServer().getCommands().performPrefixedCommand(
    +            player.level().getServer().getCommands().performPrefixedCommand(
                         new SnoopyCommandSource(player, error, output, returnValue), command
                 );
             }
    @@ -110,7 +110,7 @@ public class ServerNetworkHandler
             {
                 result.put("output", outputResult);
             }
    -        player.connection.send(DataBuilder.create(player.getServer()).withCustomNbt("clientCommand", result).build());
    +        player.connection.send(DataBuilder.create(player.level().getServer()).withCustomNbt("clientCommand", result).build());
             // run command plug to command output,
         }
     
    @@ -137,7 +137,7 @@ public class ServerNetworkHandler
             }
             for (ServerPlayer player : remoteCarpetPlayers.keySet())
             {
    -            player.connection.send(DataBuilder.create(player.getServer()).withRule(rule).build());
    +            player.connection.send(DataBuilder.create(player.level().getServer()).withRule(rule).build());
             }
         }
     
    @@ -149,7 +149,7 @@ public class ServerNetworkHandler
             }
             for (ServerPlayer player : validCarpetPlayers)
             {
    -            player.connection.send(DataBuilder.create(player.getServer()).withCustomNbt(command, data).build());
    +            player.connection.send(DataBuilder.create(player.level().getServer()).withCustomNbt(command, data).build());
             }
         }
     
    @@ -157,7 +157,7 @@ public class ServerNetworkHandler
         {
             if (isValidCarpetPlayer(player))
             {
    -            player.connection.send(DataBuilder.create(player.getServer()).withCustomNbt(command, data).build());
    +            player.connection.send(DataBuilder.create(player.level().getServer()).withCustomNbt(command, data).build());
             }
         }
     
    diff --git a/src/main/java/carpet/patches/EntityPlayerMPFake.java b/src/main/java/carpet/patches/EntityPlayerMPFake.java
    index d7cfe239..38ae1d59 100644
    --- a/src/main/java/carpet/patches/EntityPlayerMPFake.java
    +++ b/src/main/java/carpet/patches/EntityPlayerMPFake.java
    @@ -123,7 +123,7 @@ public class EntityPlayerMPFake extends ServerPlayer
     
         public static EntityPlayerMPFake createShadow(MinecraftServer server, ServerPlayer player)
         {
    -        player.getServer().getPlayerList().remove(player);
    +        player.level().getServer().getPlayerList().remove(player);
             player.connection.disconnect(Component.translatable("multiplayer.disconnect.duplicate_login"));
             ServerLevel worldIn = player.level();//.getWorld(player.dimension);
             GameProfile gameprofile = player.getGameProfile();
    @@ -182,7 +182,7 @@ public class EntityPlayerMPFake extends ServerPlayer
             if (reason.getContents() instanceof TranslatableContents text && text.getKey().equals("multiplayer.disconnect.duplicate_login")) {
                 this.connection.onDisconnect(new DisconnectionDetails(reason));
             } else {
    -            this.getServer().schedule(new TickTask(this.getServer().getTickCount(), () -> {
    +            this.level().getServer().schedule(new TickTask(this.level().getServer().getTickCount(), () -> {
                     this.connection.onDisconnect(new DisconnectionDetails(reason));
                 }));
             }
    @@ -191,7 +191,7 @@ public class EntityPlayerMPFake extends ServerPlayer
         @Override
         public void tick()
         {
    -        if (this.getServer().getTickCount() % 10 == 0)
    +        if (this.level().getServer().getTickCount() % 10 == 0)
             {
                 this.connection.resetPosition();
                 this.level().getChunkSource().move(this);
    diff --git a/src/main/java/carpet/patches/TickSyncedBorderExtent.java b/src/main/java/carpet/patches/TickSyncedBorderExtent.java
    index fde797e5..ea90f8c6 100644
    --- a/src/main/java/carpet/patches/TickSyncedBorderExtent.java
    +++ b/src/main/java/carpet/patches/TickSyncedBorderExtent.java
    @@ -81,7 +81,7 @@ public class TickSyncedBorderExtent implements WorldBorder.BorderExtent
         }
     
         @Override
    -    public long getLerpRemainingTime()
    +    public long getLerpTime()
         {
             // Rough estimation
             MinecraftServer server = CarpetServer.minecraft_server;
    @@ -143,10 +143,7 @@ public class TickSyncedBorderExtent implements WorldBorder.BorderExtent
                 {
                     // We do not want to update DelegateBorderChangeListener
                     // This updates borders in other dimensions
    -                if (!(listener instanceof BorderChangeListener.DelegateBorderChangeListener))
    -                {
    -                    listener.onBorderSizeLerping(this.border, this.from, this.to, this.realDuration);
    -                }
    +                listener.onLerpSize(this.border, this.from, this.to, this.realDuration);
                 }
             }
     
    diff --git a/src/main/java/carpet/script/CarpetEventServer.java b/src/main/java/carpet/script/CarpetEventServer.java
    index 6aa33dd3..f627f1fa 100644
    --- a/src/main/java/carpet/script/CarpetEventServer.java
    +++ b/src/main/java/carpet/script/CarpetEventServer.java
    @@ -886,7 +886,7 @@ public class CarpetEventServer
                                     new NumericValue(amount),
                                     StringValue.of(source.getMsgId()),
                                     source.getEntity() == null ? Value.NULL : new EntityValue(source.getEntity())
    -                        ), () -> target.getServer().createCommandSourceStack());
    +                        ), () -> target.level().getServer().createCommandSourceStack());
                 }
             };
             public static final Event PLAYER_DEALS_DAMAGE = new Event("player_deals_damage", 3, false)
    @@ -896,7 +896,7 @@ public class CarpetEventServer
                 {
                     return handler.call(() ->
                                     Arrays.asList(new EntityValue(source.getEntity()), new NumericValue(amount), new EntityValue(target)),
    -                        () -> source.getEntity().getServer().createCommandSourceStack()
    +                        () -> source.getEntity().level().getServer().createCommandSourceStack()
                     );
                 }
             };
    @@ -1108,7 +1108,7 @@ public class CarpetEventServer
                         {
                             handler.call(
                                     () -> Collections.singletonList(new EntityValue(entity)),
    -                                () -> entity.getServer().createCommandSourceStack().withLevel((ServerLevel) entity.level()).withPermission(Vanilla.MinecraftServer_getRunPermissionLevel(entity.getServer()))
    +                                () -> entity.level().getServer().createCommandSourceStack().withLevel((ServerLevel) entity.level()).withPermission(Vanilla.MinecraftServer_getRunPermissionLevel(entity.level().getServer()))
                             );
                         }
                     })).collect(Collectors.toUnmodifiableMap(Map.Entry::getKey, Map.Entry::getValue));
    @@ -1127,7 +1127,7 @@ public class CarpetEventServer
                         {
                             handler.call(
                                     () -> Arrays.asList(new EntityValue(entity), BooleanValue.of(created)),
    -                                () -> entity.getServer().createCommandSourceStack().withLevel((ServerLevel) entity.level()).withPermission(Vanilla.MinecraftServer_getRunPermissionLevel(entity.getServer()))
    +                                () -> entity.level().getServer().createCommandSourceStack().withLevel((ServerLevel) entity.level()).withPermission(Vanilla.MinecraftServer_getRunPermissionLevel(entity.level().getServer()))
                             );
                         }
                     }))
    diff --git a/src/main/java/carpet/script/EntityEventsGroup.java b/src/main/java/carpet/script/EntityEventsGroup.java
    index 6eaf9fc5..900bafeb 100644
    --- a/src/main/java/carpet/script/EntityEventsGroup.java
    +++ b/src/main/java/carpet/script/EntityEventsGroup.java
    @@ -49,7 +49,7 @@ public class EntityEventsGroup
             {
                 return;
             }
    -        CarpetScriptServer scriptServer = Vanilla.MinecraftServer_getScriptServer(entity.getServer());
    +        CarpetScriptServer scriptServer = Vanilla.MinecraftServer_getScriptServer(entity.level().getServer());
             if (scriptServer.stopAll)
             {
                 return; // executed after world is closin down
    @@ -64,7 +64,7 @@ public class EntityEventsGroup
                     iterator.remove();
                     continue;
                 }
    -            if (key.user() != null && entity.getServer().getPlayerList().getPlayerByName(key.user()) == null)
    +            if (key.user() != null && entity.level().getServer().getPlayerList().getPlayerByName(key.user()) == null)
                 {
                     iterator.remove();
                     continue;
    @@ -170,7 +170,7 @@ public class EntityEventsGroup
             public CarpetEventServer.CallbackResult call(CarpetEventServer.Callback tickCall, Entity entity, Object... args)
             {
                 assert args.length == argcount - 1;
    -            return tickCall.execute((entity instanceof ServerPlayer player ? player.createCommandSourceStack() : entity.getServer().createCommandSourceStack()), makeArgs(entity, args));
    +            return tickCall.execute((entity instanceof ServerPlayer player ? player.createCommandSourceStack() : entity.level().getServer().createCommandSourceStack()), makeArgs(entity, args));
             }
     
             protected List makeArgs(Entity entity, Object... args)
    diff --git a/src/main/java/carpet/script/annotation/Param.java b/src/main/java/carpet/script/annotation/Param.java
    index 665d6029..703bece6 100644
    --- a/src/main/java/carpet/script/annotation/Param.java
    +++ b/src/main/java/carpet/script/annotation/Param.java
    @@ -212,7 +212,7 @@ public interface Param
                 registerStrictConverter(Component.class, false, new SimpleTypeConverter<>(FormattedTextValue.class, FormattedTextValue::getText, "text"));
                 registerStrictConverter(Component.class, true, new SimpleTypeConverter<>(StringValue.class, FormattedTextValue::getTextByValue, "text"));
                 registerStrictConverter(ServerPlayer.class, false, new SimpleTypeConverter<>(EntityValue.class,
    -                    v -> EntityValue.getPlayerByValue(v.getEntity().getServer(), v), "online player entity"));
    +                    v -> EntityValue.getPlayerByValue(v.getEntity().level().getServer(), v), "online player entity"));
                 registerStrictConverter(Boolean.class, false, new SimpleTypeConverter<>(BooleanValue.class, BooleanValue::getBoolean, "boolean"));
                 registerStrictConverter(Boolean.class, true, new SimpleTypeConverter<>(NumericValue.class, NumericValue::getBoolean, "boolean"));
             }
    diff --git a/src/main/java/carpet/script/utils/ShapeDispatcher.java b/src/main/java/carpet/script/utils/ShapeDispatcher.java
    index d37ae3f8..fca460ff 100644
    --- a/src/main/java/carpet/script/utils/ShapeDispatcher.java
    +++ b/src/main/java/carpet/script/utils/ShapeDispatcher.java
    @@ -762,7 +762,7 @@ public class ShapeDispatcher
             {
                 return p -> {
                     ParticleOptions particle;
    -                Registry blocks = p.getServer().registryAccess().lookupOrThrow(Registries.BLOCK);
    +                Registry blocks = p.level().getServer().registryAccess().lookupOrThrow(Registries.BLOCK);
                     if (this.isitem)
                     {
                         if (Block.byItem(this.item.getItem()).defaultBlockState().isAir())
    diff --git a/src/main/java/carpet/script/utils/ShapesRenderer.java b/src/main/java/carpet/script/utils/ShapesRenderer.java
    index 6e5ad40b..be4be1e3 100644
    --- a/src/main/java/carpet/script/utils/ShapesRenderer.java
    +++ b/src/main/java/carpet/script/utils/ShapesRenderer.java
    @@ -33,6 +33,7 @@ import net.minecraft.client.renderer.LightTexture;
     import net.minecraft.client.renderer.MultiBufferSource;
     import net.minecraft.client.renderer.RenderType;
     import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
    +import net.minecraft.client.renderer.blockentity.state.BlockEntityRenderState;
     import net.minecraft.client.renderer.entity.state.EntityRenderState;
     import net.minecraft.client.renderer.item.ItemStackRenderState;
     import net.minecraft.client.renderer.texture.OverlayTexture;
    @@ -438,11 +439,17 @@ public class ShapesRenderer
                     }
                     if (BlockEntity != null)
                     {
    -                        BlockEntityRenderer blockEntityRenderer = client.getBlockEntityRenderDispatcher().getRenderer(BlockEntity);
    -                        if (blockEntityRenderer != null)
    +                        BlockEntityRenderer blockEntityRenderer = client.getBlockEntityRenderDispatcher().getRenderer(BlockEntity);
    +                        BlockEntityRenderState state = client.getBlockEntityRenderDispatcher().tryExtractRenderState(BlockEntity, partialTick, null);
    +
    +
    +
    +                        if (blockEntityRenderer != null && state != null)
                             {
    -                            blockEntityRenderer.submit(BlockEntity, partialTick,
    -                                    matrices, light, OverlayTexture.NO_OVERLAY, camera1.getPosition(), null, client.gameRenderer.getFeatureRenderDispatcher().getSubmitNodeStorage());
    +                            // testme partial positions
    +                            blockEntityRenderer.submit(state, matrices,client.gameRenderer.getFeatureRenderDispatcher().getSubmitNodeStorage());
    +                            //blockEntityRenderer.submit(BlockEntity, partialTick,
    +                            //        matrices, light, OverlayTexture.NO_OVERLAY, camera1.getPosition(), null, client.gameRenderer.getFeatureRenderDispatcher().getSubmitNodeStorage());
     
                             }
                     }
    diff --git a/src/main/java/carpet/script/utils/SnoopyCommandSource.java b/src/main/java/carpet/script/utils/SnoopyCommandSource.java
    index d55552c9..720910c9 100644
    --- a/src/main/java/carpet/script/utils/SnoopyCommandSource.java
    +++ b/src/main/java/carpet/script/utils/SnoopyCommandSource.java
    @@ -70,12 +70,12 @@ public class SnoopyCommandSource extends CommandSourceStack
         {
             super(player.commandSource(), player.position(), player.getRotationVector(),
                     player.level() instanceof final ServerLevel serverLevel ? serverLevel : null,
    -                player.getServer().getProfilePermissions(player.nameAndId()), player.getName().getString(), player.getDisplayName(),
    +                player.level().getServer().getProfilePermissions(player.nameAndId()), player.getName().getString(), player.getDisplayName(),
                     player.level().getServer(), player);
             this.output = player.commandSource();
             this.position = player.position();
             this.world = player.level() instanceof final ServerLevel serverLevel ? serverLevel : null;
    -        this.level = player.getServer().getProfilePermissions(player.nameAndId());
    +        this.level = player.level().getServer().getProfilePermissions(player.nameAndId());
             this.simpleName = player.getName().getString();
             this.name = player.getDisplayName();
             this.server = player.level().getServer();
    @@ -86,7 +86,7 @@ public class SnoopyCommandSource extends CommandSourceStack
             this.error = error;
             this.chatOutput = output;
             this.signingContext = CommandSigningContext.ANONYMOUS;
    -        this.taskChainer = TaskChainer.immediate(player.getServer());
    +        this.taskChainer = TaskChainer.immediate(player.level().getServer());
         }
     
         private SnoopyCommandSource(CommandSource output, Vec3 pos, Vec2 rot, ServerLevel world, int level, String simpleName, Component name, MinecraftServer server, @Nullable Entity entity, CommandResultCallback consumer, EntityAnchorArgument.Anchor entityAnchor, CommandSigningContext context, TaskChainer chainer,
    diff --git a/src/main/java/carpet/script/value/EntityValue.java b/src/main/java/carpet/script/value/EntityValue.java
    index 6b78a948..600158b1 100644
    --- a/src/main/java/carpet/script/value/EntityValue.java
    +++ b/src/main/java/carpet/script/value/EntityValue.java
    @@ -134,7 +134,7 @@ public class EntityValue extends Value
         {
             if (entity instanceof ServerPlayer serverPlayer && Vanilla.ServerPlayer_isInvalidEntityObject(serverPlayer))
             {
    -            ServerPlayer newPlayer = entity.getServer().getPlayerList().getPlayer(entity.getUUID());
    +            ServerPlayer newPlayer = entity.level().getServer().getPlayerList().getPlayer(entity.getUUID());
                 if (newPlayer != null)
                 {
                     entity = newPlayer;
    @@ -458,14 +458,14 @@ public class EntityValue extends Value
             put("scoreboard_tags", (e, a) -> ListValue.wrap(e.getTags().stream().map(StringValue::new)));
             put("entity_tags", (e, a) -> {
                 EntityType type = e.getType();
    -            return ListValue.wrap(e.getServer().registryAccess().lookupOrThrow(Registries.ENTITY_TYPE).getTags().filter(entry -> entry.stream().anyMatch(h -> h.value() == type)).map(entry -> ValueConversions.of(entry)));
    +            return ListValue.wrap(e.level().getServer().registryAccess().lookupOrThrow(Registries.ENTITY_TYPE).getTags().filter(entry -> entry.stream().anyMatch(h -> h.value() == type)).map(entry -> ValueConversions.of(entry)));
             });
             // deprecated
             put("has_tag", (e, a) -> BooleanValue.of(e.getTags().contains(a.getString())));
     
             put("has_scoreboard_tag", (e, a) -> BooleanValue.of(e.getTags().contains(a.getString())));
             put("has_entity_tag", (e, a) -> {
    -            Optional>> tag = e.getServer().registryAccess().lookupOrThrow(Registries.ENTITY_TYPE).get(TagKey.create(Registries.ENTITY_TYPE, InputValidator.identifierOf(a.getString())));
    +            Optional>> tag = e.level().getServer().registryAccess().lookupOrThrow(Registries.ENTITY_TYPE).get(TagKey.create(Registries.ENTITY_TYPE, InputValidator.identifierOf(a.getString())));
                 if (tag.isEmpty())
                 {
                     return Value.NULL;
    @@ -505,7 +505,7 @@ public class EntityValue extends Value
             put("despawn_timer", (e, a) -> e instanceof LivingEntity le ? new NumericValue(le.getNoActionTime()) : Value.NULL);
             put("blue_skull", (e, a) -> e instanceof WitherSkull w ? BooleanValue.of(w.isDangerous()) : Value.NULL);
             put("offering_flower", (e, a) -> e instanceof IronGolem ig ? BooleanValue.of(ig.getOfferFlowerTick() > 0) : Value.NULL);
    -        put("item", (e, a) -> e instanceof ItemEntity ie ? ValueConversions.of(ie.getItem(), e.getServer().registryAccess()) : e instanceof ItemFrame frame ? ValueConversions.of(frame.getItem(), e.getServer().registryAccess()) : Value.NULL);
    +        put("item", (e, a) -> e instanceof ItemEntity ie ? ValueConversions.of(ie.getItem(), e.level().getServer().registryAccess()) : e instanceof ItemFrame frame ? ValueConversions.of(frame.getItem(), e.level().getServer().registryAccess()) : Value.NULL);
             put("count", (e, a) -> (e instanceof ItemEntity ie) ? new NumericValue(ie.getItem().getCount()) : Value.NULL);
             put("pickup_delay", (e, a) -> (e instanceof ItemEntity ie) ? new NumericValue(Vanilla.ItemEntity_getPickupDelay(ie)) : Value.NULL);
             put("portal_cooldown", (e, a) -> new NumericValue(Vanilla.Entity_getPublicNetherPortalCooldown(e)));
    @@ -693,7 +693,7 @@ public class EntityValue extends Value
                 }
                 if (e instanceof LivingEntity le)
                 {
    -                return ValueConversions.of(le.getItemBySlot(where), e.getServer().registryAccess());
    +                return ValueConversions.of(le.getItemBySlot(where), e.level().getServer().registryAccess());
                 }
                 return Value.NULL;
             });
    @@ -1376,7 +1376,7 @@ public class EntityValue extends Value
                     if (params.size() > blockLocator.offset)
                     {
                         Value worldValue = params.get(blockLocator.offset);
    -                    world = ValueConversions.dimFromValue(worldValue, spe.getServer()).dimension();
    +                    world = ValueConversions.dimFromValue(worldValue, spe.level().getServer()).dimension();
                         if (params.size() > blockLocator.offset + 1)
                         {
                             angle = NumericValue.asNumber(params.get(blockLocator.offset + 1), "angle").getFloat();
    diff --git a/src/main/java/carpet/script/value/ScreenValue.java b/src/main/java/carpet/script/value/ScreenValue.java
    index 9f436eab..eb1625fe 100644
    --- a/src/main/java/carpet/script/value/ScreenValue.java
    +++ b/src/main/java/carpet/script/value/ScreenValue.java
    @@ -200,7 +200,7 @@ public class ScreenValue extends Value
                 this.screenHandler = null;
                 return false;
             }
    -        int runPermissionLevel = Vanilla.MinecraftServer_getRunPermissionLevel(player.getServer());
    +        int runPermissionLevel = Vanilla.MinecraftServer_getRunPermissionLevel(player.level().getServer());
             CommandSourceStack source = player.createCommandSourceStack().withPermission(runPermissionLevel);
             CarpetScriptHost executingHost = appHost.retrieveForExecution(source, player);
             try
    diff --git a/src/main/java/carpet/script/value/ValueConversions.java b/src/main/java/carpet/script/value/ValueConversions.java
    index f9622974..14780cb4 100644
    --- a/src/main/java/carpet/script/value/ValueConversions.java
    +++ b/src/main/java/carpet/script/value/ValueConversions.java
    @@ -89,7 +89,7 @@ public class ValueConversions
             return ListValue.of(StringValue.of(Colors.mapColourName.get(color)), ofRGB(color.col));
         }
     
    -    public static  Value of(MinMaxBounds range)
    +    public static > Value of(MinMaxBounds range)
         {
             return ListValue.of(
                     range.min().map(NumericValue::of).orElse(Value.NULL),
    diff --git a/src/main/java/carpet/utils/WoolTool.java b/src/main/java/carpet/utils/WoolTool.java
    index c8ba39a0..53387bd2 100644
    --- a/src/main/java/carpet/utils/WoolTool.java
    +++ b/src/main/java/carpet/utils/WoolTool.java
    @@ -109,7 +109,7 @@ public class WoolTool
                         DyeColor under = getWoolColorAtPosition(worldIn, pos.below());
                         if (under == null) return;
                         HopperCounter counter = HopperCounter.getCounter(under);
    -                    counter.reset(placer.getServer());
    +                    counter.reset(placer.level().getServer());
                         List res = new ArrayList<>();
                         res.add(Messenger.s(String.format("%s counter reset",under.toString())));
                         Messenger.send(placer, res);
    diff --git a/src/main/resources/carpet.mixins.json b/src/main/resources/carpet.mixins.json
    index 366ebf76..df0cb888 100644
    --- a/src/main/resources/carpet.mixins.json
    +++ b/src/main/resources/carpet.mixins.json
    @@ -78,6 +78,7 @@
         "ServerGamePacketListenerImpl_scarpetEventsMixin",
         "ServerPlayerGameMode_scarpetEventsMixin",
         "Player_parrotMixin",
    +    "ServerPlayer_parrotMixin",
         "SaplingBlock_desertShrubsMixin",
         "EntityMixin",
         "Guardian_renewableSpongesMixin",
    @@ -189,6 +190,7 @@
         "Gui_tablistMixin",
         "PlayerTabOverlayMixin",
         "PistonHeadRenderer_movableBEMixin",
    +    "PistonHeadRenderState_movableBEMixin",
         "StructureBlockRenderer_mixin",
         "ClientPacketListener_clientCommandMixin",
         "ClientPacketListener_explosionMixin",
    
    From 7ee917716f707f210555e308f11a18245ee663e6 Mon Sep 17 00:00:00 2001
    From: gnembon 
    Date: Thu, 4 Sep 2025 09:33:52 +0200
    Subject: [PATCH 126/232] 1.4.182
    
    ---
     gradle.properties | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/gradle.properties b/gradle.properties
    index 4a2e6a78..a43ad474 100644
    --- a/gradle.properties
    +++ b/gradle.properties
    @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G
     	fabric_version=0.119.5+1.21.5
     
     # Mod Properties
    -	mod_version = 1.4.181
    +	mod_version = 1.4.182
     	maven_group = carpet
     	archives_base_name = fabric-carpet
     
    
    From 0a925c833c74bcc0b8774bd4e27e2f0ded77831d Mon Sep 17 00:00:00 2001
    From: gnembon 
    Date: Tue, 9 Sep 2025 18:09:06 +0200
    Subject: [PATCH 127/232] 25w37a
    
    ---
     gradle.properties                                           | 2 +-
     src/main/java/carpet/fakes/LevelInterface.java              | 3 ++-
     .../mixins/BarrierBlock_updateSuppressionBlockMixin.java    | 4 ++--
     .../carpet/mixins/ChunkMap_scarpetChunkCreationMixin.java   | 5 +++--
     src/main/java/carpet/mixins/Level_tickMixin.java            | 6 +++---
     src/main/java/carpet/script/value/EntityValue.java          | 2 +-
     6 files changed, 12 insertions(+), 10 deletions(-)
    
    diff --git a/gradle.properties b/gradle.properties
    index a43ad474..ddc899c3 100644
    --- a/gradle.properties
    +++ b/gradle.properties
    @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G
     
     # Fabric Properties
     	# check https://fabricmc.net/develop/
    -	minecraft_version=25w36b
    +	minecraft_version=25w37a
     	loader_version=0.16.14
     	jsr305_version=3.0.2
     	fabric_version=0.119.5+1.21.5
    diff --git a/src/main/java/carpet/fakes/LevelInterface.java b/src/main/java/carpet/fakes/LevelInterface.java
    index 583da757..5db348d9 100644
    --- a/src/main/java/carpet/fakes/LevelInterface.java
    +++ b/src/main/java/carpet/fakes/LevelInterface.java
    @@ -1,5 +1,6 @@
     package carpet.fakes;
     
    +import net.minecraft.world.level.redstone.CollectingNeighborUpdater;
     import net.minecraft.world.level.redstone.NeighborUpdater;
     import org.jetbrains.annotations.Nullable;
     
    @@ -21,5 +22,5 @@ public interface LevelInterface
     
         List getOtherEntitiesLimited(@Nullable Entity except, AABB box, Predicate predicate, int limit);
     
    -    NeighborUpdater getNeighborUpdater();
    +    CollectingNeighborUpdater getNeighborUpdater();
     }
    diff --git a/src/main/java/carpet/mixins/BarrierBlock_updateSuppressionBlockMixin.java b/src/main/java/carpet/mixins/BarrierBlock_updateSuppressionBlockMixin.java
    index 81017c3b..3861e07e 100644
    --- a/src/main/java/carpet/mixins/BarrierBlock_updateSuppressionBlockMixin.java
    +++ b/src/main/java/carpet/mixins/BarrierBlock_updateSuppressionBlockMixin.java
    @@ -2,7 +2,7 @@ package carpet.mixins;
     
     import carpet.CarpetSettings;
     import carpet.fakes.LevelInterface;
    -import net.minecraft.world.level.redstone.NeighborUpdater;
    +import net.minecraft.world.level.redstone.CollectingNeighborUpdater;
     import net.minecraft.util.RandomSource;
     import net.minecraft.world.level.redstone.Orientation;
     import org.spongepowered.asm.mixin.Mixin;
    @@ -36,7 +36,7 @@ public class BarrierBlock_updateSuppressionBlockMixin extends Block {
                     BlockState stateAbove = level.getBlockState(pos.above());
                     if (stateAbove.is(Blocks.ACTIVATOR_RAIL) && !stateAbove.getValue(PoweredRailBlock.POWERED)) {
                         level.scheduleTick(pos, this, 1);
    -                    NeighborUpdater updater = ((LevelInterface)level).getNeighborUpdater();
    +                    CollectingNeighborUpdater updater = ((LevelInterface)level).getNeighborUpdater();
                         if (updater instanceof CollectingNeighborUpdaterAccessor cnua)
                             cnua.setCount(cnua.getMaxChainedNeighborUpdates()-CarpetSettings.updateSuppressionBlock);
                     }
    diff --git a/src/main/java/carpet/mixins/ChunkMap_scarpetChunkCreationMixin.java b/src/main/java/carpet/mixins/ChunkMap_scarpetChunkCreationMixin.java
    index 307351fa..6ed8489f 100644
    --- a/src/main/java/carpet/mixins/ChunkMap_scarpetChunkCreationMixin.java
    +++ b/src/main/java/carpet/mixins/ChunkMap_scarpetChunkCreationMixin.java
    @@ -9,6 +9,7 @@ import java.util.Map.Entry;
     import java.util.Set;
     import java.util.concurrent.CompletableFuture;
     import java.util.concurrent.Future;
    +import java.util.function.Consumer;
     import java.util.function.IntFunction;
     import java.util.stream.Collectors;
     
    @@ -94,8 +95,8 @@ public abstract class ChunkMap_scarpetChunkCreationMixin implements ThreadedAnvi
         @Shadow
         protected abstract boolean promoteChunkMap();
     
    -    @Shadow
    -    protected abstract Iterable getChunks();
    +    //@Shadow
    +    //protected abstract void forEachReadyToSendChunk(Consumer consumer); // for getChunks()
     
     
         @Shadow
    diff --git a/src/main/java/carpet/mixins/Level_tickMixin.java b/src/main/java/carpet/mixins/Level_tickMixin.java
    index 63402374..426235aa 100644
    --- a/src/main/java/carpet/mixins/Level_tickMixin.java
    +++ b/src/main/java/carpet/mixins/Level_tickMixin.java
    @@ -2,7 +2,7 @@ package carpet.mixins;
     
     import carpet.fakes.LevelInterface;
     import carpet.utils.CarpetProfiler;
    -import net.minecraft.world.level.redstone.NeighborUpdater;
    +import net.minecraft.world.level.redstone.CollectingNeighborUpdater;
     import org.spongepowered.asm.mixin.Final;
     import org.spongepowered.asm.mixin.Mixin;
     import org.spongepowered.asm.mixin.Shadow;
    @@ -22,7 +22,7 @@ import net.minecraft.world.level.Level;
     public abstract class Level_tickMixin implements LevelInterface
     {
         @Shadow @Final public boolean isClientSide;
    -    @Shadow @Final protected NeighborUpdater neighborUpdater;
    +    @Shadow @Final protected CollectingNeighborUpdater neighborUpdater;
         CarpetProfiler.ProfilerToken currentSection;
         CarpetProfiler.ProfilerToken entitySection;
     
    @@ -30,7 +30,7 @@ public abstract class Level_tickMixin implements LevelInterface
     
         @Override
         @Unique
    -    public NeighborUpdater getNeighborUpdater() {
    +    public CollectingNeighborUpdater getNeighborUpdater() {
             return this.neighborUpdater;
         }
     
    diff --git a/src/main/java/carpet/script/value/EntityValue.java b/src/main/java/carpet/script/value/EntityValue.java
    index 600158b1..5903c3f7 100644
    --- a/src/main/java/carpet/script/value/EntityValue.java
    +++ b/src/main/java/carpet/script/value/EntityValue.java
    @@ -921,7 +921,7 @@ public class EntityValue extends Value
                 }
                 else
                 {
    -                ((ServerLevel) e.level()).getChunkSource().broadcastAndSend(e, ClientboundEntityPositionSyncPacket.of(e));
    +                ((ServerLevel) e.level()).getChunkSource().sendToTrackingPlayersAndSelf(e, ClientboundEntityPositionSyncPacket.of(e));
                 }
             }
         }
    
    From 77c91efbd4d35ad8067da2089eb5e67f65f8b80a Mon Sep 17 00:00:00 2001
    From: gnembon 
    Date: Tue, 9 Sep 2025 18:09:31 +0200
    Subject: [PATCH 128/232] 1.4.183
    
    ---
     gradle.properties | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/gradle.properties b/gradle.properties
    index ddc899c3..ee8546e6 100644
    --- a/gradle.properties
    +++ b/gradle.properties
    @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G
     	fabric_version=0.119.5+1.21.5
     
     # Mod Properties
    -	mod_version = 1.4.182
    +	mod_version = 1.4.183
     	maven_group = carpet
     	archives_base_name = fabric-carpet
     
    
    From a554a4892d893b0ba1750014c2659d239b6bb5f2 Mon Sep 17 00:00:00 2001
    From: gnembon 
    Date: Tue, 16 Sep 2025 23:15:06 +0200
    Subject: [PATCH 129/232] 1.21.9-pre1
    
    ---
     gradle.properties                             |  2 +-
     .../DebugRenderer_scarpetRenderMixin.java     |  2 +-
     .../LevelRenderer_scarpetRenderMixin.java     |  6 ++--
     .../PistonHeadRenderer_movableBEMixin.java    |  7 +++--
     .../carpet/script/utils/ShapesRenderer.java   | 28 +++++++++----------
     .../java/carpet/script/utils/SystemInfo.java  |  2 +-
     .../java/carpet/script/value/EntityValue.java | 12 ++++----
     7 files changed, 31 insertions(+), 28 deletions(-)
    
    diff --git a/gradle.properties b/gradle.properties
    index ee8546e6..3fa62f44 100644
    --- a/gradle.properties
    +++ b/gradle.properties
    @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G
     
     # Fabric Properties
     	# check https://fabricmc.net/develop/
    -	minecraft_version=25w37a
    +	minecraft_version=1.21.9-pre1
     	loader_version=0.16.14
     	jsr305_version=3.0.2
     	fabric_version=0.119.5+1.21.5
    diff --git a/src/main/java/carpet/mixins/DebugRenderer_scarpetRenderMixin.java b/src/main/java/carpet/mixins/DebugRenderer_scarpetRenderMixin.java
    index d7030e8c..e8a9ad06 100644
    --- a/src/main/java/carpet/mixins/DebugRenderer_scarpetRenderMixin.java
    +++ b/src/main/java/carpet/mixins/DebugRenderer_scarpetRenderMixin.java
    @@ -10,7 +10,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
     @Mixin(DebugRenderer.class)
     public class DebugRenderer_scarpetRenderMixin
     {
    -    @Inject(method = "clear", at = @At("HEAD"))
    +    @Inject(method = "refreshRendererList", at = @At("HEAD"))
         private void resetScarpetRenderes(CallbackInfo ci)
         {
             if (CarpetClient.shapes != null)
    diff --git a/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java b/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java
    index 2da7a7b8..66de25e9 100644
    --- a/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java
    +++ b/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java
    @@ -8,7 +8,6 @@ import com.mojang.blaze3d.framegraph.FramePass;
     import net.minecraft.client.Camera;
     import net.minecraft.client.DeltaTracker;
     import net.minecraft.client.Minecraft;
    -import net.minecraft.client.renderer.LevelRenderState;
     import net.minecraft.client.renderer.LevelRenderer;
     import net.minecraft.client.renderer.LevelTargetBundle;
     import net.minecraft.client.renderer.RenderBuffers;
    @@ -16,6 +15,7 @@ import net.minecraft.client.renderer.blockentity.BlockEntityRenderDispatcher;
     import net.minecraft.client.renderer.culling.Frustum;
     import net.minecraft.client.renderer.entity.EntityRenderDispatcher;
     import net.minecraft.client.renderer.feature.FeatureRenderDispatcher;
    +import net.minecraft.client.renderer.state.LevelRenderState;
     import net.minecraft.util.profiling.ProfilerFiller;
     import org.joml.Matrix4f;
     import org.spongepowered.asm.mixin.Final;
    @@ -41,7 +41,7 @@ public class LevelRenderer_scarpetRenderMixin
         }
     
         @Inject(method = "addMainPass", at = @At("RETURN"))
    -    private void renderScarpetThingsLate(FrameGraphBuilder frameGraphBuilder, Frustum frustum, Camera camera, Matrix4f matrix4f, GpuBufferSlice gpuBufferSlice, boolean bl, LevelRenderState levelRenderState, DeltaTracker deltaTracker, ProfilerFiller profilerFiller, CallbackInfo ci)
    +    private void renderScarpetThingsLate(FrameGraphBuilder frameGraphBuilder, Frustum frustum, Matrix4f matrix4f, GpuBufferSlice gpuBufferSlice, boolean bl, LevelRenderState levelRenderState, DeltaTracker deltaTracker, ProfilerFiller profilerFiller, CallbackInfo ci)
         {
             // in normal circumstances we want to render shapes at the very end so it appears correctly behind stuff.
             // we might actually not need to play with render hooks here.
    @@ -51,7 +51,7 @@ public class LevelRenderer_scarpetRenderMixin
                 final float deltaPartialTick = deltaTracker.getGameTimeDeltaPartialTick(false);
                 FramePass pass = frameGraphBuilder.addPass("scarpet_shapes");
                 targets.main = pass.readsAndWrites(targets.main);
    -            pass.executes(() -> CarpetClient.shapes.render(null, camera, deltaPartialTick));
    +            pass.executes(() -> CarpetClient.shapes.render(null, levelRenderState, deltaPartialTick));
                 featureRenderDispatcher.renderAllFeatures();
                 renderBuffers.bufferSource().endLastBatch();
             }
    diff --git a/src/main/java/carpet/mixins/PistonHeadRenderer_movableBEMixin.java b/src/main/java/carpet/mixins/PistonHeadRenderer_movableBEMixin.java
    index 16a9bbd3..9c2a6c75 100644
    --- a/src/main/java/carpet/mixins/PistonHeadRenderer_movableBEMixin.java
    +++ b/src/main/java/carpet/mixins/PistonHeadRenderer_movableBEMixin.java
    @@ -12,6 +12,7 @@ import net.minecraft.client.renderer.blockentity.PistonHeadRenderer;
     import net.minecraft.client.renderer.blockentity.state.BlockEntityRenderState;
     import net.minecraft.client.renderer.blockentity.state.PistonHeadRenderState;
     import net.minecraft.client.renderer.feature.ModelFeatureRenderer;
    +import net.minecraft.client.renderer.state.CameraRenderState;
     import net.minecraft.world.level.block.entity.BlockEntity;
     import net.minecraft.world.level.block.piston.PistonMovingBlockEntity;
     import net.minecraft.world.phys.Vec3;
    @@ -51,10 +52,10 @@ public abstract class PistonHeadRenderer_movableBEMixin implements BlockEntityRe
             }
         }
     
    -    @Inject(method = "submit(Lnet/minecraft/client/renderer/blockentity/state/PistonHeadRenderState;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/SubmitNodeCollector;)V",
    +    @Inject(method = "submit(Lnet/minecraft/client/renderer/blockentity/state/PistonHeadRenderState;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/SubmitNodeCollector;Lnet/minecraft/client/renderer/state/CameraRenderState;)V",
                 at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/SubmitNodeCollector;submitMovingBlock(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/block/MovingBlockRenderState;)V",
                 ordinal = 0))
    -    private void endMethod(PistonHeadRenderState pistonHeadRenderState, PoseStack poseStack, SubmitNodeCollector submitNodeCollector, CallbackInfo ci)
    +    private void endMethod(PistonHeadRenderState pistonHeadRenderState, PoseStack poseStack, SubmitNodeCollector submitNodeCollector, CameraRenderState cameraRenderState, CallbackInfo ci)
         //private void endMethod(PistonMovingBlockEntity pistonBlockEntity_1, float partialTicks, PoseStack matrixStack_1, int i, int j, Vec3 vec3, ModelFeatureRenderer.CrumblingOverlay crumblingOverlay, SubmitNodeCollector submitNodeCollector, CallbackInfo ci)
         //private void endMethod3576(PistonMovingBlockEntity pistonBlockEntity_1, float partialTicks, PoseStack matrixStack_1, MultiBufferSource layeredVertexConsumerStorage_1, int int_1, int init_2, Vec3 cameraPos, CallbackInfo ci)
         {
    @@ -62,7 +63,7 @@ public abstract class PistonHeadRenderer_movableBEMixin implements BlockEntityRe
                 if (mbrsi.getMovedBERenderState() != null) {
                     BlockEntityRenderState res = mbrsi.getMovedBERenderState();
                     if (res != null) {
    -                    dispatcher.submit(res, poseStack, submitNodeCollector);
    +                    dispatcher.submit(res, poseStack, submitNodeCollector, cameraRenderState);
                     }
                 }
         }
    diff --git a/src/main/java/carpet/script/utils/ShapesRenderer.java b/src/main/java/carpet/script/utils/ShapesRenderer.java
    index be4be1e3..c797a228 100644
    --- a/src/main/java/carpet/script/utils/ShapesRenderer.java
    +++ b/src/main/java/carpet/script/utils/ShapesRenderer.java
    @@ -4,7 +4,6 @@ import carpet.script.CarpetScriptServer;
     import carpet.script.external.Carpet;
     import carpet.script.utils.shapes.ShapeDirection;
     
    -import com.mojang.blaze3d.platform.Lighting;
     import com.mojang.blaze3d.systems.RenderSystem;
     import com.mojang.blaze3d.vertex.BufferBuilder;
     import com.mojang.blaze3d.vertex.ByteBufferBuilder;
    @@ -36,6 +35,7 @@ import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
     import net.minecraft.client.renderer.blockentity.state.BlockEntityRenderState;
     import net.minecraft.client.renderer.entity.state.EntityRenderState;
     import net.minecraft.client.renderer.item.ItemStackRenderState;
    +import net.minecraft.client.renderer.state.LevelRenderState;
     import net.minecraft.client.renderer.texture.OverlayTexture;
     import net.minecraft.core.BlockPos;
     import net.minecraft.core.Direction;
    @@ -112,13 +112,13 @@ public class ShapesRenderer
             labels = new HashMap<>();
         }
     
    -    public void render(Matrix4f modelViewMatrix, Camera camera, float partialTick)
    +    public void render(Matrix4f modelViewMatrix, LevelRenderState cameraa, 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();
    +        Camera camera = this.client.gameRenderer.getMainCamera();
             ClientLevel iWorld = this.client.level;
             ResourceKey dimensionType = iWorld.dimension();
             if ((shapes.get(dimensionType) == null || shapes.get(dimensionType).isEmpty()) &&
    @@ -164,7 +164,7 @@ public class ShapesRenderer
                 shapes.get(dimensionType).values().forEach(s -> {
                     if ((!s.shape.debug || entityBoxes) && s.shouldRender(dimensionType))
                     {
    -                    s.renderLines(matrices, tesselator, cameraX, cameraY, cameraZ, partialTick);
    +                    s.renderLines(matrices, tesselator, cameraX, cameraY, cameraZ, partialTick, cameraa);
                     }
                 });
                 // faces
    @@ -187,7 +187,7 @@ public class ShapesRenderer
                 labels.get(dimensionType).values().forEach(s -> {
                     if ((!s.shape.debug || entityBoxes) && s.shouldRender(dimensionType))
                     {
    -                    s.renderLines(matrices, tesselator, cameraX, cameraY, cameraZ, partialTick);
    +                    s.renderLines(matrices, tesselator, cameraX, cameraY, cameraZ, partialTick, cameraa);
                     }
                 });
             }
    @@ -263,7 +263,7 @@ public class ShapesRenderer
             long expiryTick;
             double renderEpsilon;
     
    -        public abstract void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy, double cz, float partialTick);
    +        public abstract void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState);
     
             public void renderFaces(Tesselator tesselator, double cx, double cy, double cz, float partialTick)
             {
    @@ -337,7 +337,7 @@ public class ShapesRenderer
     
             @Override
             public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy,
    -                                double cz, float partialTick)
    +                                double cz, float partialTick, LevelRenderState levelRenderState)
             {
                 if (shape.a == 0.0)
                 {
    @@ -447,7 +447,7 @@ public class ShapesRenderer
                             if (blockEntityRenderer != null && state != null)
                             {
                                 // testme partial positions
    -                            blockEntityRenderer.submit(state, matrices,client.gameRenderer.getFeatureRenderDispatcher().getSubmitNodeStorage());
    +                            blockEntityRenderer.submit(state, matrices,client.gameRenderer.getFeatureRenderDispatcher().getSubmitNodeStorage(), levelRenderState.cameraRenderState);
                                 //blockEntityRenderer.submit(BlockEntity, partialTick,
                                 //        matrices, light, OverlayTexture.NO_OVERLAY, camera1.getPosition(), null, client.gameRenderer.getFeatureRenderDispatcher().getSubmitNodeStorage());
     
    @@ -493,7 +493,7 @@ public class ShapesRenderer
             }
     
             @Override
    -        public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy, double cz, float partialTick)
    +        public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState)
             {
                 if (shape.a == 0.0)
                 {
    @@ -582,7 +582,7 @@ public class ShapesRenderer
             }
     
             @Override
    -        public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy, double cz, float partialTick)
    +        public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState)
             {
                 if (shape.a == 0.0)
                 {
    @@ -626,7 +626,7 @@ public class ShapesRenderer
             }
     
             @Override
    -        public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy, double cz, float partialTick)
    +        public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState)
             {
                 Vec3 v1 = shape.relativiseRender(client.level, shape.from, partialTick);
                 Vec3 v2 = shape.relativiseRender(client.level, shape.to, partialTick);
    @@ -707,7 +707,7 @@ public class ShapesRenderer
     
             @Override
             public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy,
    -                                double cz, float partialTick)
    +                                double cz, float partialTick, LevelRenderState levelRenderState)
             {
                 if (shape.a == 0)
                 {
    @@ -842,7 +842,7 @@ public class ShapesRenderer
             }
     
             @Override
    -        public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy, double cz, float partialTick)
    +        public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState)
             {
                 if (shape.a == 0.0)
                 {
    @@ -878,7 +878,7 @@ public class ShapesRenderer
             }
     
             @Override
    -        public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy, double cz, float partialTick)
    +        public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState)
             {
                 if (shape.a == 0.0)
                 {
    diff --git a/src/main/java/carpet/script/utils/SystemInfo.java b/src/main/java/carpet/script/utils/SystemInfo.java
    index 00e528c3..7ab418b5 100644
    --- a/src/main/java/carpet/script/utils/SystemInfo.java
    +++ b/src/main/java/carpet/script/utils/SystemInfo.java
    @@ -59,7 +59,7 @@ public class SystemInfo
                 return StringValue.of(tlf);
             });
             put("world_dimensions", c -> ListValue.wrap(c.server().levelKeys().stream().map(k -> ValueConversions.of(k.location()))));
    -        put("world_spawn_point", c -> ValueConversions.of(c.server().overworld().getLevelData().getSpawnPos()));
    +        put("world_spawn_point", c -> ValueConversions.of(c.server().overworld().getLevelData().getRespawnData().pos()));
     
             put("world_bottom", c -> new NumericValue(c.level().getMinY()));
     
    diff --git a/src/main/java/carpet/script/value/EntityValue.java b/src/main/java/carpet/script/value/EntityValue.java
    index 5903c3f7..9bedb9ab 100644
    --- a/src/main/java/carpet/script/value/EntityValue.java
    +++ b/src/main/java/carpet/script/value/EntityValue.java
    @@ -17,6 +17,7 @@ import net.minecraft.commands.arguments.selector.EntitySelector;
     import net.minecraft.commands.arguments.selector.EntitySelectorParser;
     import net.minecraft.core.BlockPos;
     import net.minecraft.core.Direction;
    +import net.minecraft.core.GlobalPos;
     import net.minecraft.core.Holder;
     import net.minecraft.core.HolderSet;
     import net.minecraft.core.Registry;
    @@ -69,6 +70,7 @@ import net.minecraft.world.level.GameType;
     import net.minecraft.world.level.Level;
     import net.minecraft.world.level.entity.EntityTypeTest;
     import net.minecraft.world.level.pathfinder.Path;
    +import net.minecraft.world.level.storage.LevelData;
     import net.minecraft.world.level.storage.TagValueInput;
     import net.minecraft.world.level.storage.TagValueOutput;
     import net.minecraft.world.phys.BlockHitResult;
    @@ -533,9 +535,9 @@ public class EntityValue extends Value
                     }
                     ServerPlayer.RespawnConfig spec = spe.getRespawnConfig();
                     return ListValue.of(
    -                        ValueConversions.of(spec.pos()),
    -                        ValueConversions.of(spec.dimension()),
    -                        new NumericValue(spec.angle()),
    +                        ValueConversions.of(spec.respawnData().pos()),
    +                        ValueConversions.of(spec.respawnData().dimension()),
    +                        new NumericValue(spec.respawnData().yaw()),
                             BooleanValue.of(spec.forced())
                     );
                 }
    @@ -1386,7 +1388,7 @@ public class EntityValue extends Value
                             }
                         }
                     }
    -                spe.setRespawnPosition(new ServerPlayer.RespawnConfig(world, pos, angle, forced), false);
    +                spe.setRespawnPosition(new ServerPlayer.RespawnConfig(new LevelData.RespawnData(new GlobalPos(world, pos), angle, 0), forced), false);
                 }
                 else if (a instanceof BlockValue bv)
                 {
    @@ -1394,7 +1396,7 @@ public class EntityValue extends Value
                     {
                         throw new InternalExpressionException("block for spawn modification should be localised in the world");
                     }
    -                spe.setRespawnPosition(new ServerPlayer.RespawnConfig(bv.getWorld().dimension(), bv.getPos(), e.getYRot(), true), false); // yaw
    +                spe.setRespawnPosition(new ServerPlayer.RespawnConfig(new LevelData.RespawnData(new GlobalPos(bv.getWorld().dimension(), bv.getPos()), e.getYRot(), 0), true), false); // yaw
                 }
                 else if (a.isNull())
                 {
    
    From 8a8a81b0070f269ed365c82bc753d3fbfbaa03f6 Mon Sep 17 00:00:00 2001
    From: gnembon 
    Date: Tue, 16 Sep 2025 23:15:41 +0200
    Subject: [PATCH 130/232] 1.4.184
    
    ---
     gradle.properties | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/gradle.properties b/gradle.properties
    index 3fa62f44..6a5cadde 100644
    --- a/gradle.properties
    +++ b/gradle.properties
    @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G
     	fabric_version=0.119.5+1.21.5
     
     # Mod Properties
    -	mod_version = 1.4.183
    +	mod_version = 1.4.184
     	maven_group = carpet
     	archives_base_name = fabric-carpet
     
    
    From 543a8588054db80e59f7c5336f4b3a07f38d7134 Mon Sep 17 00:00:00 2001
    From: gnembon 
    Date: Tue, 30 Sep 2025 19:52:40 +0200
    Subject: [PATCH 131/232] 1.4.185 for 1.21.9
    
    ---
     gradle.properties | 6 +++---
     1 file changed, 3 insertions(+), 3 deletions(-)
    
    diff --git a/gradle.properties b/gradle.properties
    index 6a5cadde..3f43b4f6 100644
    --- a/gradle.properties
    +++ b/gradle.properties
    @@ -3,13 +3,13 @@ org.gradle.jvmargs=-Xmx1G
     
     # Fabric Properties
     	# check https://fabricmc.net/develop/
    -	minecraft_version=1.21.9-pre1
    +	minecraft_version=1.21.9
     	loader_version=0.16.14
     	jsr305_version=3.0.2
     	fabric_version=0.119.5+1.21.5
     
     # Mod Properties
    -	mod_version = 1.4.184
    +	mod_version = 1.4.185
     	maven_group = carpet
     	archives_base_name = fabric-carpet
     
    @@ -17,7 +17,7 @@ org.gradle.jvmargs=-Xmx1G
     	# The Curseforge versions "names" or ids for the main branch (comma separated: 1.16.4,1.16.5)
     	# This is needed because CF uses too vague names for prereleases and release candidates
     	# Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN]
    -	release-curse-versions = Minecraft 1.21:1.21.9-Snapshot
    +	release-curse-versions = Minecraft 1.21:1.21.9
     	# Whether or not to build another branch on release
     	release-extra-branch = false
     	# The name of the second branch to release
    
    From f5b7653cfbf25f35fcfe610031e311951da18087 Mon Sep 17 00:00:00 2001
    From: gnembon 
    Date: Thu, 9 Oct 2025 13:28:20 +0200
    Subject: [PATCH 132/232] 1.4.186 for 1.21.10
    
    ---
     gradle.properties | 6 +++---
     1 file changed, 3 insertions(+), 3 deletions(-)
    
    diff --git a/gradle.properties b/gradle.properties
    index 3f43b4f6..0286acb9 100644
    --- a/gradle.properties
    +++ b/gradle.properties
    @@ -3,13 +3,13 @@ org.gradle.jvmargs=-Xmx1G
     
     # Fabric Properties
     	# check https://fabricmc.net/develop/
    -	minecraft_version=1.21.9
    -	loader_version=0.16.14
    +	minecraft_version=1.21.10
    +	loader_version=0.17.2
     	jsr305_version=3.0.2
     	fabric_version=0.119.5+1.21.5
     
     # Mod Properties
    -	mod_version = 1.4.185
    +	mod_version = 1.4.186
     	maven_group = carpet
     	archives_base_name = fabric-carpet
     
    
    From b48a29b85c2d50155314e2715972e3d13850a5be Mon Sep 17 00:00:00 2001
    From: gnembon 
    Date: Sat, 11 Oct 2025 19:56:14 +0200
    Subject: [PATCH 133/232] 25w41a
    
    ---
     gradle.properties                             |   6 +-
     src/main/java/carpet/CarpetSettings.java      |  50 +-
     .../java/carpet/commands/InfoCommand.java     |   2 +-
     .../java/carpet/commands/PlayerCommand.java   |   7 +-
     .../Guardian_renewableSpongesMixin.java       |   2 +-
     .../LevelRenderer_scarpetRenderMixin.java     |   2 +-
     .../mixins/LivingEntity_cleanLogsMixin.java   |   2 +-
     .../mixins/PerfCommand_permissionMixin.java   |  10 +-
     .../mixins/Player_fakePlayersMixin.java       |   2 +-
     .../java/carpet/script/CarpetScriptHost.java  |  16 +-
     .../java/carpet/script/ScriptCommand.java     |  11 +-
     .../java/carpet/script/external/Vanilla.java  |   3 +-
     .../carpet/script/utils/ShapeDispatcher.java  |  18 +
     .../carpet/script/utils/ShapesRenderer.java   | 546 ++++++++----------
     .../script/utils/SnoopyCommandSource.java     |  19 +-
     .../java/carpet/script/value/EntityValue.java |  26 +-
     .../java/carpet/script/value/ScreenValue.java |   3 +-
     src/main/java/carpet/utils/CommandHelper.java |   9 +-
     src/main/resources/carpet.accesswidener       |   2 +
     19 files changed, 366 insertions(+), 370 deletions(-)
    
    diff --git a/gradle.properties b/gradle.properties
    index 0286acb9..be8ea5ee 100644
    --- a/gradle.properties
    +++ b/gradle.properties
    @@ -3,10 +3,10 @@ org.gradle.jvmargs=-Xmx1G
     
     # Fabric Properties
     	# check https://fabricmc.net/develop/
    -	minecraft_version=1.21.10
    -	loader_version=0.17.2
    +	minecraft_version=25w41a
    +	loader_version=0.17.3
     	jsr305_version=3.0.2
    -	fabric_version=0.119.5+1.21.5
    +	fabric_version=0.134.0+1.21.9
     
     # Mod Properties
     	mod_version = 1.4.186
    diff --git a/src/main/java/carpet/CarpetSettings.java b/src/main/java/carpet/CarpetSettings.java
    index 82bba777..34fc202a 100644
    --- a/src/main/java/carpet/CarpetSettings.java
    +++ b/src/main/java/carpet/CarpetSettings.java
    @@ -12,12 +12,16 @@ import carpet.utils.Messenger;
     import net.fabricmc.loader.api.FabricLoader;
     import net.fabricmc.loader.api.SemanticVersion;
     import net.minecraft.commands.CommandSourceStack;
    +import net.minecraft.commands.Commands;
     import net.minecraft.core.registries.Registries;
     import net.minecraft.resources.ResourceLocation;
     import net.minecraft.server.MinecraftServer;
     import net.minecraft.server.ServerInterface;
     import net.minecraft.server.dedicated.DedicatedServer;
     import net.minecraft.server.level.ServerLevel;
    +import net.minecraft.server.permissions.LevelBasedPermissionSet;
    +import net.minecraft.server.permissions.PermissionCheck;
    +import net.minecraft.server.permissions.PermissionSet;
     import net.minecraft.world.entity.Entity;
     import net.minecraft.world.entity.player.Player;
     import net.minecraft.world.level.Level;
    @@ -56,7 +60,7 @@ public class CarpetSettings
         public static final Logger LOG = LoggerFactory.getLogger("carpet");
         public static final ThreadLocal skipGenerationChecks = ThreadLocal.withInitial(() -> false);
         public static final ThreadLocal impendingFillSkipUpdates = ThreadLocal.withInitial(() -> false);
    -    public static int runPermissionLevel = 2;
    +    public static PermissionSet runPermissionLevel = LevelBasedPermissionSet.GAMEMASTER;
         public static Block structureBlockIgnoredBlock = Blocks.STRUCTURE_VOID;
         private static class LanguageValidator extends Validator {
             @Override public String validate(CommandSourceStack source, CarpetRule currentRule, String newValue, String string) {
    @@ -129,7 +133,7 @@ public class CarpetSettings
     
         private static class CarpetPermissionLevel extends Validator {
             @Override public String validate(CommandSourceStack source, CarpetRule currentRule, String newValue, String string) {
    -            if (source == null || source.hasPermission(4))
    +            if (source == null || Commands.LEVEL_OWNERS.check(source.permissions()))
                     return newValue;
                 return null;
             }
    @@ -423,10 +427,32 @@ public class CarpetSettings
         @Rule(
                 desc = "Required permission level for /perf command",
                 options = {"2", "4"},
    -            category = CREATIVE
    +            category = CREATIVE,
    +            validate = PermissionValidator.class
         )
         public static int perfPermissionLevel = 4;
     
    +    public static class PermissionValidator extends Validator {
    +        @Override
    +        public Integer validate(CommandSourceStack source, CarpetRule currentRule, Integer newValue, String string) {
    +            if (newValue == 2) {
    +                perfPermissionCheck = Commands.LEVEL_GAMEMASTERS;
    +
    +            } else if (newValue == 4) {
    +                perfPermissionCheck = Commands.LEVEL_OWNERS;
    +
    +            }
    +            return newValue;
    +        }
    +
    +        @Override
    +        public String description() {
    +            return "You must have the permission level you are trying to set";
    +        }
    +    }
    +    public static PermissionCheck perfPermissionCheck = Commands.LEVEL_OWNERS;
    +
    +
         @Rule(desc = "Enables /log command to monitor events via chat and overlays", category = COMMAND)
         public static String commandLog = "true";
     
    @@ -476,17 +502,21 @@ public class CarpetSettings
     
         private static class ModulePermissionLevel extends Validator {
             @Override public String validate(CommandSourceStack source, CarpetRule currentRule, String newValue, String string) {
    -            int permissionLevel = switch (newValue) {
    -                    case "false" -> 0;
    -                    case "true", "ops" -> 2;
    -                    case "0", "1", "2", "3", "4" -> Integer.parseInt(newValue);
    +            PermissionCheck permissionLevel = switch (newValue) {
    +                    case "0", "false" -> Commands.LEVEL_ALL;
    +                    case "1" -> Commands.LEVEL_MODERATORS;
    +                    case "2", "true", "ops" -> Commands.LEVEL_GAMEMASTERS;
    +                    case "3" -> Commands.LEVEL_ADMINS;
    +                    case "4" -> Commands.LEVEL_OWNERS;
                         default -> throw new IllegalArgumentException(); // already checked by previous validator
                 	};
    -            if (source != null && !source.hasPermission(permissionLevel))
    +            if (source != null && !permissionLevel.check(source.permissions()))
                     return null;
    -            CarpetSettings.runPermissionLevel = permissionLevel;
    -            if (source != null)
    +            CarpetSettings.runPermissionLevel = LevelBasedPermissionSet.GAMEMASTER;
    +            if (source != null) {
                     CommandHelper.notifyPlayersCommandsChanged(source.getServer());
    +                CarpetSettings.runPermissionLevel =source.permissions();
    +            }
                 return newValue;
             }
             @Override
    diff --git a/src/main/java/carpet/commands/InfoCommand.java b/src/main/java/carpet/commands/InfoCommand.java
    index 4e36964c..b1e5f77a 100644
    --- a/src/main/java/carpet/commands/InfoCommand.java
    +++ b/src/main/java/carpet/commands/InfoCommand.java
    @@ -68,7 +68,7 @@ public class InfoCommand
     
         private static int infoBlock(CommandSourceStack source, BlockPos pos, String grep)
         {
    -        if (!source.hasPermission(Commands.LEVEL_GAMEMASTERS)) {
    +        if (!Commands.LEVEL_GAMEMASTERS.check(source.permissions())) {
                 //check id pos is loaded
                 if (!source.getLevel().hasChunkAt(pos)) {
                     Messenger.m(source, "r Chunk is not loaded");
    diff --git a/src/main/java/carpet/commands/PlayerCommand.java b/src/main/java/carpet/commands/PlayerCommand.java
    index a20934c2..f050915f 100644
    --- a/src/main/java/carpet/commands/PlayerCommand.java
    +++ b/src/main/java/carpet/commands/PlayerCommand.java
    @@ -19,6 +19,7 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException;
     import net.minecraft.SharedConstants;
     import net.minecraft.commands.CommandBuildContext;
     import net.minecraft.commands.CommandSourceStack;
    +import net.minecraft.commands.Commands;
     import net.minecraft.commands.arguments.DimensionArgument;
     import net.minecraft.commands.arguments.GameModeArgument;
     import net.minecraft.commands.arguments.coordinates.RotationArgument;
    @@ -98,13 +99,13 @@ public class PlayerCommand
                                     .then(literal("left").executes(manipulation(ap -> ap.setStrafing(1))))
                                     .then(literal("right").executes(manipulation(ap -> ap.setStrafing(-1))))
                             ).then(literal("spawn").executes(PlayerCommand::spawn)
    -                                .then(literal("in").requires((player) -> player.hasPermission(2))
    +                                .then(literal("in").requires(Commands.hasPermission(Commands.LEVEL_GAMEMASTERS))
                                             .then(argument("gamemode", GameModeArgument.gameMode())
                                             .executes(PlayerCommand::spawn)))
                                     .then(literal("at").then(argument("position", Vec3Argument.vec3()).executes(PlayerCommand::spawn)
                                             .then(literal("facing").then(argument("direction", RotationArgument.rotation()).executes(PlayerCommand::spawn)
                                                     .then(literal("in").then(argument("dimension", DimensionArgument.dimension()).executes(PlayerCommand::spawn)
    -                                                        .then(literal("in").requires((player) -> player.hasPermission(2))
    +                                                        .then(literal("in").requires(Commands.hasPermission(Commands.LEVEL_GAMEMASTERS))
                                                                     .then(argument("gamemode", GameModeArgument.gameMode())
                                                                     .executes(PlayerCommand::spawn)
                                                             )))
    @@ -230,7 +231,7 @@ public class PlayerCommand
                 Messenger.m(context.getSource(), "r Player ", "rb " + playerName, "r  is banned on this server");
                 return true;
             }
    -        if (manager.isUsingWhitelist() && manager.isWhiteListed(profile) && !context.getSource().hasPermission(2))
    +        if (manager.isUsingWhitelist() && manager.isWhiteListed(profile) && !Commands.LEVEL_GAMEMASTERS.check(context.getSource().permissions()))
             {
                 Messenger.m(context.getSource(), "r Whitelisted players can only be spawned by operators");
                 return true;
    diff --git a/src/main/java/carpet/mixins/Guardian_renewableSpongesMixin.java b/src/main/java/carpet/mixins/Guardian_renewableSpongesMixin.java
    index 492da31a..0605d667 100644
    --- a/src/main/java/carpet/mixins/Guardian_renewableSpongesMixin.java
    +++ b/src/main/java/carpet/mixins/Guardian_renewableSpongesMixin.java
    @@ -26,7 +26,7 @@ public abstract class Guardian_renewableSpongesMixin extends Monster
             {
                 ElderGuardian elderGuardian = new ElderGuardian(EntityType.ELDER_GUARDIAN ,this.level());
                 elderGuardian.snapTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
    -            elderGuardian.finalizeSpawn(serverWorld ,this.level().getCurrentDifficultyAt(elderGuardian.blockPosition()), EntitySpawnReason.CONVERSION, null);
    +            elderGuardian.finalizeSpawn(serverWorld ,serverWorld.getCurrentDifficultyAt(elderGuardian.blockPosition()), EntitySpawnReason.CONVERSION, null);
                 elderGuardian.setNoAi(this.isNoAi());
                 
                 if (this.hasCustomName())
    diff --git a/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java b/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java
    index 66de25e9..b6fa65b8 100644
    --- a/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java
    +++ b/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java
    @@ -51,7 +51,7 @@ public class LevelRenderer_scarpetRenderMixin
                 final float deltaPartialTick = deltaTracker.getGameTimeDeltaPartialTick(false);
                 FramePass pass = frameGraphBuilder.addPass("scarpet_shapes");
                 targets.main = pass.readsAndWrites(targets.main);
    -            pass.executes(() -> CarpetClient.shapes.render(null, levelRenderState, deltaPartialTick));
    +            pass.executes(() -> CarpetClient.shapes.render(renderBuffers, levelRenderState, matrix4f, deltaPartialTick));
                 featureRenderDispatcher.renderAllFeatures();
                 renderBuffers.bufferSource().endLastBatch();
             }
    diff --git a/src/main/java/carpet/mixins/LivingEntity_cleanLogsMixin.java b/src/main/java/carpet/mixins/LivingEntity_cleanLogsMixin.java
    index d11d32d4..a6b80dcb 100644
    --- a/src/main/java/carpet/mixins/LivingEntity_cleanLogsMixin.java
    +++ b/src/main/java/carpet/mixins/LivingEntity_cleanLogsMixin.java
    @@ -23,6 +23,6 @@ public abstract class LivingEntity_cleanLogsMixin extends Entity
         @Redirect(method = "die", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/LivingEntity;hasCustomName()Z"))
         private boolean shouldLogDeaths(LivingEntity livingEntity)
         {
    -        return livingEntity.hasCustomName() && CarpetSettings.cleanLogs && livingEntity.level().getServer().getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES);
    +        return livingEntity.hasCustomName() && livingEntity.level() instanceof ServerLevel serverLevel &&  CarpetSettings.cleanLogs && serverLevel.getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES);
         }
     }
    diff --git a/src/main/java/carpet/mixins/PerfCommand_permissionMixin.java b/src/main/java/carpet/mixins/PerfCommand_permissionMixin.java
    index d0c9f58f..6a637df9 100644
    --- a/src/main/java/carpet/mixins/PerfCommand_permissionMixin.java
    +++ b/src/main/java/carpet/mixins/PerfCommand_permissionMixin.java
    @@ -2,9 +2,9 @@ package carpet.mixins;
     
     import carpet.CarpetSettings;
     import net.minecraft.commands.Commands;
    -import net.minecraft.commands.PermissionSource;
     import net.minecraft.server.commands.PerfCommand;
    -import net.minecraft.server.commands.PermissionCheck;
    +import net.minecraft.server.permissions.PermissionCheck;
    +import net.minecraft.server.permissions.PermissionProviderCheck;
     import org.spongepowered.asm.mixin.Mixin;
     import org.spongepowered.asm.mixin.injection.At;
     import org.spongepowered.asm.mixin.injection.Redirect;
    @@ -14,11 +14,11 @@ public class PerfCommand_permissionMixin
     {
         @Redirect(method = "register", at = @At(
                 value = "INVOKE",
    -            target = "Lnet/minecraft/commands/Commands;hasPermission(I)Lnet/minecraft/server/commands/PermissionCheck;"
    +            target = "Lnet/minecraft/commands/Commands;hasPermission(Lnet/minecraft/server/permissions/PermissionCheck;)Lnet/minecraft/server/permissions/PermissionProviderCheck;"
         ))
    -    private static PermissionCheck canRun(int i)
    +    private static PermissionProviderCheck canRun(PermissionCheck permissionCheck)
         {
    -        return Commands.hasPermission(CarpetSettings.perfPermissionLevel);
    +        return Commands.hasPermission(CarpetSettings.perfPermissionCheck);
         }
     
     }
    diff --git a/src/main/java/carpet/mixins/Player_fakePlayersMixin.java b/src/main/java/carpet/mixins/Player_fakePlayersMixin.java
    index 5004a848..a585c0e2 100644
    --- a/src/main/java/carpet/mixins/Player_fakePlayersMixin.java
    +++ b/src/main/java/carpet/mixins/Player_fakePlayersMixin.java
    @@ -14,7 +14,7 @@ public abstract class Player_fakePlayersMixin
          * To make sure player attacks are able to knockback fake players
          */
         @Redirect(
    -            method = "attack",
    +            method = "causeExtraKnockback",
                 at = @At(
                         value = "FIELD",
                         target = "Lnet/minecraft/world/entity/Entity;hurtMarked:Z",
    diff --git a/src/main/java/carpet/script/CarpetScriptHost.java b/src/main/java/carpet/script/CarpetScriptHost.java
    index c9c0314d..073db7e8 100644
    --- a/src/main/java/carpet/script/CarpetScriptHost.java
    +++ b/src/main/java/carpet/script/CarpetScriptHost.java
    @@ -31,6 +31,7 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException;
     import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
     
     import net.minecraft.commands.CommandSourceStack;
    +import net.minecraft.commands.Commands;
     import net.minecraft.core.BlockPos;
     import net.minecraft.nbt.Tag;
     import net.minecraft.network.chat.Component;
    @@ -202,6 +203,17 @@ public class CarpetScriptHost extends ScriptHost
             return command;
         }
     
    +    private static boolean sourceHasPermissionLevel(CommandSourceStack source, int level) {
    +        return switch (level) {
    +            case 0 -> Commands.LEVEL_ALL.check(source.permissions());
    +            case 1 -> Commands.LEVEL_MODERATORS.check(source.permissions());
    +            case 2 -> Commands.LEVEL_GAMEMASTERS.check(source.permissions());
    +            case 3 -> Commands.LEVEL_ADMINS.check(source.permissions());
    +            case 4 -> Commands.LEVEL_OWNERS.check(source.permissions());
    +            default -> false;
    +        };
    +    }
    +
         public Predicate getCommandConfigPermissions() throws CommandSyntaxException
         {
             Value confValue = appConfig.get(StringValue.of("command_permission"));
    @@ -216,13 +228,13 @@ public class CarpetScriptHost extends ScriptHost
                 {
                     throw CommandArgument.error("Numeric permission level for custom commands should be between 1 and 4");
                 }
    -            return s -> s.hasPermission(level);
    +            return s -> sourceHasPermissionLevel(s, level);
             }
             if (!(confValue instanceof final FunctionValue fun))
             {
                 String perm = confValue.getString().toLowerCase(Locale.ROOT);
                 return switch (perm) {
    -                case "ops" -> s -> s.hasPermission(2);
    +                case "ops" -> s -> sourceHasPermissionLevel(s, 2);
                     case "server" -> s -> !(s.getEntity() instanceof ServerPlayer);
                     case "players" -> s -> s.getEntity() instanceof ServerPlayer;
                     case "all" -> s -> true;
    diff --git a/src/main/java/carpet/script/ScriptCommand.java b/src/main/java/carpet/script/ScriptCommand.java
    index 8383849a..3894d757 100644
    --- a/src/main/java/carpet/script/ScriptCommand.java
    +++ b/src/main/java/carpet/script/ScriptCommand.java
    @@ -15,6 +15,7 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException;
     import com.mojang.brigadier.suggestion.Suggestions;
     import com.mojang.brigadier.suggestion.SuggestionsBuilder;
     import net.minecraft.commands.CommandBuildContext;
    +import net.minecraft.commands.Commands;
     import net.minecraft.network.chat.Component;
     import net.minecraft.world.level.GameRules;
     import org.apache.commons.lang3.StringUtils;
    @@ -225,7 +226,7 @@ public class ScriptCommand
                                                             BlockPosArgument.getSpawnablePos(cc, "to"),
                                                             StringArgumentType.getString(cc, "arguments")
                                                     ))))));
    -        LiteralArgumentBuilder i = literal("scan").requires((player) -> player.hasPermission(2)).
    +        LiteralArgumentBuilder i = literal("scan").requires(Commands.hasPermission(Commands.LEVEL_GAMEMASTERS)).
                     then(argument("origin", BlockPosArgument.blockPos()).
                             then(argument("from", BlockPosArgument.blockPos()).
                                     then(argument("to", BlockPosArgument.blockPos()).
    @@ -238,7 +239,7 @@ public class ScriptCommand
                                                             BlockPosArgument.getSpawnablePos(cc, "to"),
                                                             StringArgumentType.getString(cc, "expr")
                                                     ))))));
    -        LiteralArgumentBuilder e = literal("fill").requires((player) -> player.hasPermission(2)).
    +        LiteralArgumentBuilder e = literal("fill").requires(Commands.hasPermission(Commands.LEVEL_GAMEMASTERS)).
                     then(argument("origin", BlockPosArgument.blockPos()).
                             then(argument("from", BlockPosArgument.blockPos()).
                                     then(argument("to", BlockPosArgument.blockPos()).
    @@ -265,7 +266,7 @@ public class ScriptCommand
                                                                                     BlockPredicateArgument.getBlockPredicate(cc, "filter"),
                                                                                     "solid"
                                                                             )))))))));
    -        LiteralArgumentBuilder t = literal("outline").requires((player) -> player.hasPermission(2)).
    +        LiteralArgumentBuilder t = literal("outline").requires(Commands.hasPermission(Commands.LEVEL_GAMEMASTERS)).
                     then(argument("origin", BlockPosArgument.blockPos()).
                             then(argument("from", BlockPosArgument.blockPos()).
                                     then(argument("to", BlockPosArgument.blockPos()).
    @@ -666,7 +667,7 @@ public class ScriptCommand
             BoundingBox area = BoundingBox.fromCorners(a, b);
             CarpetExpression cexpr = new CarpetExpression(host.main, expr, source, origin);
             int int_1 = area.getXSpan() * area.getYSpan() * area.getZSpan(); // X Y Z
    -        if (int_1 > source.getServer().getGameRules().getInt(GameRules.RULE_COMMAND_MODIFICATION_BLOCK_LIMIT))
    +        if (int_1 > source.getLevel().getGameRules().getInt(GameRules.RULE_COMMAND_MODIFICATION_BLOCK_LIMIT))
             {
                 Carpet.Messenger_message(source, "r too many blocks to evaluate: " + int_1);
                 return 1;
    @@ -718,7 +719,7 @@ public class ScriptCommand
             BoundingBox area = BoundingBox.fromCorners(a, b);
             CarpetExpression cexpr = new CarpetExpression(host.main, expr, source, origin);
             int int_1 = area.getXSpan() * area.getYSpan() * area.getZSpan();
    -        if (int_1 > source.getServer().getGameRules().getInt(GameRules.RULE_COMMAND_MODIFICATION_BLOCK_LIMIT))
    +        if (int_1 > source.getLevel().getGameRules().getInt(GameRules.RULE_COMMAND_MODIFICATION_BLOCK_LIMIT))
             {
                 Carpet.Messenger_message(source, "r too many blocks to evaluate: " + int_1);
                 return 1;
    diff --git a/src/main/java/carpet/script/external/Vanilla.java b/src/main/java/carpet/script/external/Vanilla.java
    index 942157b6..4da04a67 100644
    --- a/src/main/java/carpet/script/external/Vanilla.java
    +++ b/src/main/java/carpet/script/external/Vanilla.java
    @@ -29,6 +29,7 @@ import net.minecraft.server.level.ServerLevel;
     import net.minecraft.server.level.ServerPlayer;
     import net.minecraft.server.level.ServerPlayerGameMode;
     import net.minecraft.server.level.Ticket;
    +import net.minecraft.server.permissions.PermissionSet;
     import net.minecraft.tags.TagKey;
     import net.minecraft.world.Container;
     import net.minecraft.world.entity.Entity;
    @@ -140,7 +141,7 @@ public class Vanilla
             ServerNetworkHandler.sendCustomCommand(player, "scShapes", data);
         }
     
    -    public static int MinecraftServer_getRunPermissionLevel(MinecraftServer server)
    +    public static PermissionSet MinecraftServer_getRunPermissionLevel(MinecraftServer server)
         {
             return CarpetSettings.runPermissionLevel;
         }
    diff --git a/src/main/java/carpet/script/utils/ShapeDispatcher.java b/src/main/java/carpet/script/utils/ShapeDispatcher.java
    index fca460ff..9c69224e 100644
    --- a/src/main/java/carpet/script/utils/ShapeDispatcher.java
    +++ b/src/main/java/carpet/script/utils/ShapeDispatcher.java
    @@ -300,7 +300,9 @@ public class ShapeDispatcher
             float lineWidth;
             protected float r, g, b, a;
             protected int color;
    +        protected int argb;
             protected float fr, fg, fb, fa;
    +        protected int fargb;
             protected int fillColor;
             protected int duration = 0;
             private long key;
    @@ -310,6 +312,7 @@ public class ShapeDispatcher
             protected boolean discreteX, discreteY, discreteZ;
             protected ResourceKey shapeDimension;
             protected boolean debug;
    +        protected boolean seethrough;
     
     
             protected ExpiringShape()
    @@ -351,6 +354,11 @@ public class ShapeDispatcher
                 init(options, regs);
             }
     
    +        private int rgba2argb(int color) {
    +            // return shift bits from alpha
    +            return ((color & 0xFF) << 24) + (color >> 8 & 0xFFFFFF);
    +        }
    +
     
             protected void init(Map options, RegistryAccess regs)
             {
    @@ -360,12 +368,14 @@ public class ShapeDispatcher
                 lineWidth = NumericValue.asNumber(options.getOrDefault("line", optional.get("line"))).getFloat();
     
                 fillColor = NumericValue.asNumber(options.getOrDefault("fill", optional.get("fill"))).getInt();
    +            this.fargb = rgba2argb(fillColor);
                 this.fr = (fillColor >> 24 & 0xFF) / 255.0F;
                 this.fg = (fillColor >> 16 & 0xFF) / 255.0F;
                 this.fb = (fillColor >> 8 & 0xFF) / 255.0F;
                 this.fa = (fillColor & 0xFF) / 255.0F;
     
                 color = NumericValue.asNumber(options.getOrDefault("color", optional.get("color"))).getInt();
    +            this.argb = rgba2argb(color);
                 this.r = (color >> 24 & 0xFF) / 255.0F;
                 this.g = (color >> 16 & 0xFF) / 255.0F;
                 this.b = (color >> 8 & 0xFF) / 255.0F;
    @@ -377,6 +387,12 @@ public class ShapeDispatcher
                     debug = options.get("debug").getBoolean();
                 }
     
    +            seethrough = false;
    +            if (options.containsKey("debug"))
    +            {
    +                seethrough = options.get("seethrough").getBoolean();
    +            }
    +
                 key = 0;
                 followEntity = -1;
                 shapeDimension = ResourceKey.create(Registries.DIMENSION, ResourceLocation.parse(options.get("dim").getString()));
    @@ -464,6 +480,7 @@ public class ShapeDispatcher
                 hash ^= followEntity;
                 hash *= 1099511628211L;
                 hash ^= Boolean.hashCode(debug);
    +            hash ^= Boolean.hashCode(seethrough);
                 hash *= 1099511628211L;
                 if (followEntity >= 0)
                 {
    @@ -496,6 +513,7 @@ public class ShapeDispatcher
                     "follow", new NumericValue(-1),
                     "line", new NumericValue(2.0),
                     "debug", Value.FALSE,
    +                "seethrough", Value.FALSE,
                     "fill", new NumericValue(0xffffff00),
                     "snap", new StringValue("xyz")
             );
    diff --git a/src/main/java/carpet/script/utils/ShapesRenderer.java b/src/main/java/carpet/script/utils/ShapesRenderer.java
    index c797a228..a322b869 100644
    --- a/src/main/java/carpet/script/utils/ShapesRenderer.java
    +++ b/src/main/java/carpet/script/utils/ShapesRenderer.java
    @@ -4,14 +4,11 @@ import carpet.script.CarpetScriptServer;
     import carpet.script.external.Carpet;
     import carpet.script.utils.shapes.ShapeDirection;
     
    +import com.mojang.blaze3d.pipeline.RenderTarget;
     import com.mojang.blaze3d.systems.RenderSystem;
    -import com.mojang.blaze3d.vertex.BufferBuilder;
     import com.mojang.blaze3d.vertex.ByteBufferBuilder;
    -import com.mojang.blaze3d.vertex.DefaultVertexFormat;
    -import com.mojang.blaze3d.vertex.MeshData;
     import com.mojang.blaze3d.vertex.PoseStack;
     import com.mojang.blaze3d.vertex.Tesselator;
    -//import com.mojang.blaze3d.vertex.VertexBuffer;
     import com.mojang.blaze3d.vertex.VertexFormat;
     import com.mojang.blaze3d.vertex.VertexFormat.Mode;
     import com.mojang.math.Axis;
    @@ -30,10 +27,12 @@ import net.minecraft.client.multiplayer.ClientLevel;
     import net.minecraft.client.renderer.ItemBlockRenderTypes;
     import net.minecraft.client.renderer.LightTexture;
     import net.minecraft.client.renderer.MultiBufferSource;
    +import net.minecraft.client.renderer.RenderBuffers;
     import net.minecraft.client.renderer.RenderType;
     import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
     import net.minecraft.client.renderer.blockentity.state.BlockEntityRenderState;
     import net.minecraft.client.renderer.entity.state.EntityRenderState;
    +import net.minecraft.client.renderer.gizmos.DrawableGizmoPrimitives;
     import net.minecraft.client.renderer.item.ItemStackRenderState;
     import net.minecraft.client.renderer.state.LevelRenderState;
     import net.minecraft.client.renderer.texture.OverlayTexture;
    @@ -88,7 +87,7 @@ public class ShapesRenderer
                 case DOWN -> poseStack.mulPose(Axis.XP.rotationDegrees(-90));
                 case CAMERA -> poseStack.mulPose(camera.rotation());
                 case PLAYER -> {
    -                Vec3 vector = objectPos.subtract(camera.getPosition());
    +                Vec3 vector = objectPos.subtract(camera.position());
                     double x = vector.x;
                     double y = vector.y;
                     double z = vector.z;
    @@ -112,7 +111,7 @@ public class ShapesRenderer
             labels = new HashMap<>();
         }
     
    -    public void render(Matrix4f modelViewMatrix, LevelRenderState cameraa, float partialTick)
    +    public void render(RenderBuffers renderBuffers, LevelRenderState cameraa, Matrix4f matrix4f, float partialTick)
         {
             Runnable token = Carpet.startProfilerSection("Scarpet client");
             // posestack is not needed anymore - left as TODO to cleanup later
    @@ -145,11 +144,14 @@ public class ShapesRenderer
             Tesselator tesselator = Tesselator.getInstance();
     
             // render
    -        double cameraX = camera.getPosition().x;
    -        double cameraY = camera.getPosition().y;
    -        double cameraZ = camera.getPosition().z;
    +        double cameraX = camera.position().x;
    +        double cameraY = camera.position().y;
    +        double cameraZ = camera.position().z;
             boolean entityBoxes = client.debugEntries.isCurrentlyEnabled(DebugScreenEntries.ENTITY_HITBOXES);
     
    +        final DrawableGizmoPrimitives normal = new DrawableGizmoPrimitives();
    +        final DrawableGizmoPrimitives onTop = new DrawableGizmoPrimitives();
    +
             if (!shapes.isEmpty())
             {
                 shapes.get(dimensionType).long2ObjectEntrySet().removeIf(
    @@ -160,22 +162,21 @@ public class ShapesRenderer
                 matrixStack.mul(matrices.last().pose());
     
                 // lines
    -            RenderSystem.lineWidth(0.5F);
    +            //RenderSystem.lineWidth(0.5F);
                 shapes.get(dimensionType).values().forEach(s -> {
                     if ((!s.shape.debug || entityBoxes) && s.shouldRender(dimensionType))
                     {
    -                    s.renderLines(matrices, tesselator, cameraX, cameraY, cameraZ, partialTick, cameraa);
    +                    s.renderLines(matrices, tesselator, cameraX, cameraY, cameraZ, partialTick, cameraa, s.shape.seethrough ? onTop : normal);
                     }
                 });
                 // faces
    -            RenderSystem.lineWidth(0.1F);
                 shapes.get(dimensionType).values().forEach(s -> {
                     if ((!s.shape.debug || entityBoxes) && s.shouldRender(dimensionType))
                     {
    -                    s.renderFaces(tesselator, cameraX, cameraY, cameraZ, partialTick);
    +                    s.renderFaces(tesselator, cameraX, cameraY, cameraZ, partialTick, s.shape.seethrough ? onTop : normal);
                     }
                 });
    -            RenderSystem.lineWidth(1.0F);
    +            //RenderSystem.lineWidth(1.0F);
                 matrixStack.popMatrix();
     
             }
    @@ -187,10 +188,29 @@ public class ShapesRenderer
                 labels.get(dimensionType).values().forEach(s -> {
                     if ((!s.shape.debug || entityBoxes) && s.shouldRender(dimensionType))
                     {
    -                    s.renderLines(matrices, tesselator, cameraX, cameraY, cameraZ, partialTick, cameraa);
    +                    s.renderLines(matrices, tesselator, cameraX, cameraY, cameraZ, partialTick, cameraa, s.shape.seethrough ? onTop : normal);
                     }
                 });
             }
    +        MultiBufferSource.BufferSource bufferSource = renderBuffers.bufferSource();
    +        bufferSource.endLastBatch();
    +
    +
    +
    +        normal.render(matrices, bufferSource, cameraa.cameraRenderState, matrix4f);
    +        bufferSource.endLastBatch();
    +
    +        if (false) {
    +            final RenderTarget mainRenderTarget = Minecraft.getInstance().getMainRenderTarget();
    +            RenderSystem.getDevice().createCommandEncoder().clearDepthTexture(mainRenderTarget.getDepthTexture(), 1.0);
    +            onTop.render(matrices, bufferSource, cameraa.cameraRenderState, matrix4f);
    +            bufferSource.endLastBatch();
    +
    +            RenderSystem.getDevice().createCommandEncoder().clearDepthTexture(Minecraft.getInstance().getMainRenderTarget().getDepthTexture(), 1.0);
    +
    +        }
    +
    +
             ////RenderSystem.enableCull();
             ////RenderSystem.depthMask(true);
             ////RenderSystem.enableBlend();
    @@ -263,9 +283,9 @@ public class ShapesRenderer
             long expiryTick;
             double renderEpsilon;
     
    -        public abstract void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState);
    +        public abstract void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState, DrawableGizmoPrimitives primitives);
     
    -        public void renderFaces(Tesselator tesselator, double cx, double cy, double cz, float partialTick)
    +        public void renderFaces(Tesselator tesselator, double cx, double cy, double cz, float partialTick, DrawableGizmoPrimitives primitives)
             {
             }
     
    @@ -337,7 +357,7 @@ public class ShapesRenderer
     
             @Override
             public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy,
    -                                double cz, float partialTick, LevelRenderState levelRenderState)
    +                                double cz, float partialTick, LevelRenderState levelRenderState, DrawableGizmoPrimitives primitives)
             {
                 if (shape.a == 0.0)
                 {
    @@ -411,7 +431,7 @@ public class ShapesRenderer
                         float green = (color >> 8 & 0xFF) / 255.0F;
                         float blue = (color & 0xFF) / 255.0F;
                         RenderType type;
    -                    if (blockState.getBlock() instanceof LeavesBlock && !Minecraft.useFancyGraphics()) {
    +                    if (blockState.getBlock() instanceof LeavesBlock && !Minecraft.getInstance().options.cutoutLeaves().get()) {
                             type = RenderType.solid();
                         } else {
                             type = ItemBlockRenderTypes.getRenderType(blockState);
    @@ -493,7 +513,7 @@ public class ShapesRenderer
             }
     
             @Override
    -        public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState)
    +        public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState, DrawableGizmoPrimitives primitives)
             {
                 if (shape.a == 0.0)
                 {
    @@ -582,7 +602,7 @@ public class ShapesRenderer
             }
     
             @Override
    -        public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState)
    +        public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState, DrawableGizmoPrimitives primitives)
             {
                 if (shape.a == 0.0)
                 {
    @@ -590,16 +610,16 @@ public class ShapesRenderer
                 }
                 Vec3 v1 = shape.relativiseRender(client.level, shape.from, partialTick);
                 Vec3 v2 = shape.relativiseRender(client.level, shape.to, partialTick);
    -            drawBoxWireGLLines(tesselator,
    -                    (float) (v1.x - cx - renderEpsilon), (float) (v1.y - cy - renderEpsilon), (float) (v1.z - cz - renderEpsilon),
    -                    (float) (v2.x - cx + renderEpsilon), (float) (v2.y - cy + renderEpsilon), (float) (v2.z - cz + renderEpsilon),
    +            drawBoxWireGLLines(primitives,
    +                    (float) (v1.x - renderEpsilon), (float) (v1.y - renderEpsilon), (float) (v1.z - renderEpsilon),
    +                    (float) (v2.x + renderEpsilon), (float) (v2.y + renderEpsilon), (float) (v2.z + renderEpsilon),
                         v1.x != v2.x, v1.y != v2.y, v1.z != v2.z,
    -                    shape.r, shape.g, shape.b, shape.a, shape.r, shape.g, shape.b
    +                    shape.argb, shape.lineWidth
                 );
             }
     
             @Override
    -        public void renderFaces(Tesselator tesselator, double cx, double cy, double cz, float partialTick)
    +        public void renderFaces(Tesselator tesselator, double cx, double cy, double cz, float partialTick, DrawableGizmoPrimitives primitives)
             {
                 if (shape.fa == 0.0)
                 {
    @@ -609,11 +629,11 @@ public class ShapesRenderer
                 Vec3 v2 = shape.relativiseRender(client.level, shape.to, partialTick);
                 // consider using built-ins
                 //DebugRenderer.drawBox(new Box(v1.x, v1.y, v1.z, v2.x, v2.y, v2.z), 0.5f, 0.5f, 0.5f, 0.5f);//shape.r, shape.g, shape.b, shape.a);
    -            drawBoxFaces(tesselator,
    -                    (float) (v1.x - cx - renderEpsilon), (float) (v1.y - cy - renderEpsilon), (float) (v1.z - cz - renderEpsilon),
    -                    (float) (v2.x - cx + renderEpsilon), (float) (v2.y - cy + renderEpsilon), (float) (v2.z - cz + renderEpsilon),
    +            drawBoxFaces(primitives,
    +                    (float) (v1.x  - renderEpsilon), (float) (v1.y  - renderEpsilon), (float) (v1.z  - renderEpsilon),
    +                    (float) (v2.x  + renderEpsilon), (float) (v2.y  + renderEpsilon), (float) (v2.z  + renderEpsilon),
                         v1.x != v2.x, v1.y != v2.y, v1.z != v2.z,
    -                    shape.fr, shape.fg, shape.fb, shape.fa
    +                    shape.fargb
                 );
             }
         }
    @@ -626,38 +646,29 @@ public class ShapesRenderer
             }
     
             @Override
    -        public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState)
    +        public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState, DrawableGizmoPrimitives primitives)
             {
                 Vec3 v1 = shape.relativiseRender(client.level, shape.from, partialTick);
                 Vec3 v2 = shape.relativiseRender(client.level, shape.to, partialTick);
    -            drawLine(tesselator,
    -                    (float) (v1.x - cx - renderEpsilon), (float) (v1.y - cy - renderEpsilon), (float) (v1.z - cz - renderEpsilon),
    -                    (float) (v2.x - cx + renderEpsilon), (float) (v2.y - cy + renderEpsilon), (float) (v2.z - cz + renderEpsilon),
    -                    shape.r, shape.g, shape.b, shape.a
    +            primitives.addLine(
    +                    new Vec3((v1.x - renderEpsilon), (v1.y - renderEpsilon), (v1.z - renderEpsilon)),
    +                    new Vec3((v2.x + renderEpsilon), (v2.y + renderEpsilon), (v2.z + renderEpsilon)),
    +                    shape.argb, shape.lineWidth
                 );
             }
         }
     
    -    private static void drawWithShader(MeshData mesh, RenderType type) {
    -        type.draw(mesh);
    -        //VertexBuffer buffre = mesh.drawState().format().getImmediateDrawVertexBuffer();
    -        //buffre.bind();
    -        //buffre.upload(mesh);
    -        //buffre.drawWithShader(RenderSystem.getModelViewMatrix(), RenderSystem.getProjectionMatrix(), RenderType. RenderSystem.getShader());
    -    }
    -
    -
         public static class RenderedPolyface extends RenderedShape
         {
             // mode now can only be 4, 5, or 6
             private static final VertexFormat.Mode[] faceIndices = new VertexFormat.Mode[]{
    -                Mode.LINES, Mode.LINE_STRIP, Mode.DEBUG_LINES, Mode.DEBUG_LINE_STRIP, Mode.TRIANGLES, Mode.TRIANGLE_STRIP, Mode.TRIANGLE_FAN, Mode.QUADS};
    +                Mode.LINES, Mode.LINES, Mode.DEBUG_LINES, Mode.DEBUG_LINE_STRIP, Mode.TRIANGLES, Mode.TRIANGLE_STRIP, Mode.TRIANGLE_FAN, Mode.QUADS};
     
             private static final RenderType [] renderTypes = new RenderType[] {
    -                RenderType.debugLineStrip(1),
    -                RenderType.debugLineStrip(1),
    -                RenderType.debugLineStrip(1),
    -                RenderType.debugLineStrip(1),
    +                RenderType.lines(),
    +                RenderType.lines(),
    +                RenderType.lines(),
    +                RenderType.lines(),
                     RenderType.debugTriangleFan(), // TODO wrong
                     RenderType.debugTriangleFan(), // TODO wrong
                     RenderType.debugTriangleFan(),
    @@ -670,7 +681,7 @@ public class ShapesRenderer
             }
     
             @Override
    -        public void renderFaces(Tesselator tesselator, double cx, double cy, double cz, float partialTick)
    +        public void renderFaces(Tesselator tesselator, double cx, double cy, double cz, float partialTick, DrawableGizmoPrimitives primitives)
             {
                 if (shape.fa == 0)
                 {
    @@ -686,7 +697,7 @@ public class ShapesRenderer
                     ////RenderSystem.enableCull();
                 }
     
    -            BufferBuilder builder = tesselator.begin(faceIndices[shape.mode], DefaultVertexFormat.POSITION_COLOR);
    +            //BufferBuilder builder = tesselator.begin(faceIndices[shape.mode], DefaultVertexFormat.POSITION_COLOR);
                 for (int i = 0; i < shape.vertexList.size(); i++)
                 {
                     Vec3 vec = shape.vertexList.get(i);
    @@ -694,9 +705,9 @@ public class ShapesRenderer
                     {
                         vec = shape.relativiseRender(client.level, vec, partialTick);
                     }
    -                builder.addVertex((float) (vec.x() - cx), (float) (vec.y() - cy), (float) (vec.z() - cz)).setColor(shape.fr, shape.fg, shape.fb, shape.fa);
    +                //builder.addVertex((float) (vec.x() - cx), (float) (vec.y() - cy), (float) (vec.z() - cz)).setColor(shape.fr, shape.fg, shape.fb, shape.fa);
                 }
    -            drawWithShader(builder.buildOrThrow(), renderTypes[shape.mode]);
    +            //drawWithShader(builder.buildOrThrow(), renderTypes[shape.mode]);
     
                 ////RenderSystem.disableCull();
                 ////RenderSystem.depthMask(false);
    @@ -707,7 +718,7 @@ public class ShapesRenderer
     
             @Override
             public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy,
    -                                double cz, float partialTick, LevelRenderState levelRenderState)
    +                                double cz, float partialTick, LevelRenderState levelRenderState, DrawableGizmoPrimitives primitives)
             {
                 if (shape.a == 0)
                 {
    @@ -716,7 +727,7 @@ public class ShapesRenderer
     
                 if (shape.mode == 6)
                 {
    -                BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR);
    +                //BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR);
                     Vec3 vec0 = null;
                     for (int i = 0; i < shape.vertexList.size(); i++)
                     {
    @@ -729,13 +740,13 @@ public class ShapesRenderer
                         {
                             vec0 = vec;
                         }
    -                    builder.addVertex((float) (vec.x() - cx), (float) (vec.y() - cy), (float) (vec.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a);
    +                    //builder.addVertex((float) (vec.x() - cx), (float) (vec.y() - cy), (float) (vec.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a);
                     }
    -                builder.addVertex((float) (vec0.x() - cx), (float) (vec0.y() - cy), (float) (vec0.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a);
    -                drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1));
    +                //builder.addVertex((float) (vec0.x() - cx), (float) (vec0.y() - cy), (float) (vec0.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a);
    +                //drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1));
                     if (shape.inneredges)
                     {
    -                    BufferBuilder builderr = tesselator.begin(Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR);
    +                    //BufferBuilder builderr = tesselator.begin(Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR);
                         for (int i = 1; i < shape.vertexList.size() - 1; i++)
                         {
                             Vec3 vec = shape.vertexList.get(i);
    @@ -743,23 +754,23 @@ public class ShapesRenderer
                             {
                                 vec = shape.relativiseRender(client.level, vec, partialTick);
                             }
    -                        builderr.addVertex((float) (vec0.x() - cx), (float) (vec0.y() - cy), (float) (vec0.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a);
    -                        builderr.addVertex((float) (vec.x() - cx), (float) (vec.y() - cy), (float) (vec.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a);
    -                        builderr.addVertex((float) (vec0.x() - cx), (float) (vec0.y() - cy), (float) (vec0.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a);
    +                        //builderr.addVertex((float) (vec0.x() - cx), (float) (vec0.y() - cy), (float) (vec0.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a);
    +                        //builderr.addVertex((float) (vec.x() - cx), (float) (vec.y() - cy), (float) (vec.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a);
    +                        //builderr.addVertex((float) (vec0.x() - cx), (float) (vec0.y() - cy), (float) (vec0.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a);
                         }
    -                    drawWithShader(builderr.buildOrThrow(), RenderType.debugLineStrip(1));
    +                    //drawWithShader(builderr.buildOrThrow(), RenderType.debugLineStrip(1));
                     }
                     return;
                 }
                 if (shape.mode == 5)
                 {
    -                BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR);
    +                //BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR);
                     Vec3 vec = shape.vertexList.get(1);
                     if (shape.relative.get(1))
                     {
                         vec = shape.relativiseRender(client.level, vec, partialTick);
                     }
    -                builder.addVertex((float) (vec.x() - cx), (float) (vec.y() - cy), (float) (vec.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a);
    +                //builder.addVertex((float) (vec.x() - cx), (float) (vec.y() - cy), (float) (vec.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a);
                     int i;
                     for (i = 0; i < shape.vertexList.size(); i += 2)
                     {
    @@ -768,7 +779,7 @@ public class ShapesRenderer
                         {
                             vec = shape.relativiseRender(client.level, vec, partialTick);
                         }
    -                    builder.addVertex((float) (vec.x() - cx), (float) (vec.y() - cy), (float) (vec.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a);
    +                    //builder.addVertex((float) (vec.x() - cx), (float) (vec.y() - cy), (float) (vec.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a);
                     }
                     i = shape.vertexList.size() - 1;
                     for (i -= 1 - i % 2; i > 0; i -= 2)
    @@ -778,7 +789,7 @@ public class ShapesRenderer
                         {
                             vec = shape.relativiseRender(client.level, vec, partialTick);
                         }
    -                    builder.addVertex((float) (vec.x() - cx), (float) (vec.y() - cy), (float) (vec.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a);
    +                    //builder.addVertex((float) (vec.x() - cx), (float) (vec.y() - cy), (float) (vec.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a);
                     }
                     if (shape.inneredges)
                     {
    @@ -789,10 +800,10 @@ public class ShapesRenderer
                             {
                                 vec = shape.relativiseRender(client.level, vec, partialTick);
                             }
    -                        builder.addVertex((float) (vec.x() - cx), (float) (vec.y() - cy), (float) (vec.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a);
    +                        //builder.addVertex((float) (vec.x() - cx), (float) (vec.y() - cy), (float) (vec.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a);
                         }
                     }
    -                drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1));
    +                //drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1));
                     return;
                 }
                 if (shape.mode == 4)
    @@ -800,7 +811,7 @@ public class ShapesRenderer
                     //
                     for (int i = 0; i < shape.vertexList.size(); i++)
                     {
    -                    BufferBuilder builder = tesselator.begin(Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR);
    +                    //BufferBuilder builder = tesselator.begin(Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR);
                         Vec3 vecA = shape.vertexList.get(i);
                         if (shape.relative.get(i))
                         {
    @@ -818,16 +829,16 @@ public class ShapesRenderer
                         {
                             vecC = shape.relativiseRender(client.level, vecC, partialTick);
                         }
    -                    builder.addVertex((float) (vecA.x() - cx), (float) (vecA.y() - cy), (float) (vecA.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a);
    -                    builder.addVertex((float) (vecB.x() - cx), (float) (vecB.y() - cy), (float) (vecB.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a);
    +                    //builder.addVertex((float) (vecA.x() - cx), (float) (vecA.y() - cy), (float) (vecA.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a);
    +                    //builder.addVertex((float) (vecB.x() - cx), (float) (vecB.y() - cy), (float) (vecB.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a);
     
                         //builder.addVertex((float) (vecB.x() - cx), (float) (vecB.y() - cy), (float) (vecB.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a);
    -                    builder.addVertex((float) (vecC.x() - cx), (float) (vecC.y() - cy), (float) (vecC.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a);
    +                    //builder.addVertex((float) (vecC.x() - cx), (float) (vecC.y() - cy), (float) (vecC.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a);
     
                         //builder.addVertex((float) (vecC.x() - cx), (float) (vecC.y() - cy), (float) (vecC.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a);
    -                    builder.addVertex((float) (vecA.x() - cx), (float) (vecA.y() - cy), (float) (vecA.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a);
    +                    //builder.addVertex((float) (vecA.x() - cx), (float) (vecA.y() - cy), (float) (vecA.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a);
     
    -                    drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1));
    +                    //drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1));
                     }
                     //drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1));
                 }
    @@ -842,31 +853,31 @@ public class ShapesRenderer
             }
     
             @Override
    -        public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState)
    +        public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState, DrawableGizmoPrimitives primitives)
             {
                 if (shape.a == 0.0)
                 {
                     return;
                 }
                 Vec3 vc = shape.relativiseRender(client.level, shape.center, partialTick);
    -            drawSphereWireframe(tesselator,
    -                    (float) (vc.x - cx), (float) (vc.y - cy), (float) (vc.z - cz),
    +            drawSphereWireframe(primitives,
    +                    (float) (vc.x), (float) (vc.y), (float) (vc.z),
                         (float) (shape.radius + renderEpsilon), shape.subdivisions,
    -                    shape.r, shape.g, shape.b, shape.a);
    +                    shape.argb, shape.lineWidth);
             }
     
             @Override
    -        public void renderFaces(Tesselator tesselator, double cx, double cy, double cz, float partialTick)
    +        public void renderFaces(Tesselator tesselator, double cx, double cy, double cz, float partialTick, DrawableGizmoPrimitives primitives)
             {
                 if (shape.fa == 0.0)
                 {
                     return;
                 }
                 Vec3 vc = shape.relativiseRender(client.level, shape.center, partialTick);
    -            drawSphereFaces(tesselator,
    -                    (float) (vc.x - cx), (float) (vc.y - cy), (float) (vc.z - cz),
    +            drawSphereFaces(primitives,
    +                    (float) (vc.x ), (float) (vc.y ), (float) (vc.z ),
                         (float) (shape.radius + renderEpsilon), shape.subdivisions,
    -                    shape.fr, shape.fg, shape.fb, shape.fa);
    +                    shape.fargb);
             }
         }
     
    @@ -878,7 +889,7 @@ public class ShapesRenderer
             }
     
             @Override
    -        public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState)
    +        public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState, DrawableGizmoPrimitives primitives)
             {
                 if (shape.a == 0.0)
                 {
    @@ -886,16 +897,16 @@ public class ShapesRenderer
                 }
                 Vec3 vc = shape.relativiseRender(client.level, shape.center, partialTick);
                 double dir = Mth.sign(shape.height);
    -            drawCylinderWireframe(tesselator,
    -                    (float) (vc.x - cx - dir * renderEpsilon), (float) (vc.y - cy - dir * renderEpsilon), (float) (vc.z - cz - dir * renderEpsilon),
    +            drawCylinderWireframe(primitives,
    +                    (float) (vc.x  - dir * renderEpsilon), (float) (vc.y  - dir * renderEpsilon), (float) (vc.z  - dir * renderEpsilon),
                         (float) (shape.radius + renderEpsilon), (float) (shape.height + 2 * dir * renderEpsilon), shape.axis,
                         shape.subdivisions, shape.height == 0,
    -                    shape.r, shape.g, shape.b, shape.a);
    +                    shape.argb, shape.lineWidth);
     
             }
     
             @Override
    -        public void renderFaces(Tesselator tesselator, double cx, double cy, double cz, float partialTick)
    +        public void renderFaces(Tesselator tesselator, double cx, double cy, double cz, float partialTick, DrawableGizmoPrimitives primitives)
             {
                 if (shape.fa == 0.0)
                 {
    @@ -903,188 +914,87 @@ public class ShapesRenderer
                 }
                 Vec3 vc = shape.relativiseRender(client.level, shape.center, partialTick);
                 double dir = Mth.sign(shape.height);
    -            drawCylinderFaces(tesselator,
    -                    (float) (vc.x - cx - dir * renderEpsilon), (float) (vc.y - cy - dir * renderEpsilon), (float) (vc.z - cz - dir * renderEpsilon),
    +            drawCylinderFaces(primitives,
    +                    (float) (vc.x - dir * renderEpsilon), (float) (vc.y - dir * renderEpsilon), (float) (vc.z - dir * renderEpsilon),
                         (float) (shape.radius + renderEpsilon), (float) (shape.height + 2 * dir * renderEpsilon), shape.axis,
                         shape.subdivisions, shape.radius == 0,
    -                    shape.fr, shape.fg, shape.fb, shape.fa);
    +                    shape.fargb);
             }
         }
     
         // some raw shit
     
    -    public static void drawLine(Tesselator tesselator, float x1, float y1, float z1, float x2, float y2, float z2, float red1, float grn1, float blu1, float alpha)
    -    {
    -        BufferBuilder builder = tesselator.begin(Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR);
    -        builder.addVertex(x1, y1, z1).setColor(red1, grn1, blu1, alpha);
    -        builder.addVertex(x2, y2, z2).setColor(red1, grn1, blu1, alpha);
    -        drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1));
    -    }
    -
         public static void drawBoxWireGLLines(
    -            Tesselator tesselator,
    +            DrawableGizmoPrimitives primitives,
                 float x1, float y1, float z1,
                 float x2, float y2, float z2,
                 boolean xthick, boolean ythick, boolean zthick,
    -            float red1, float grn1, float blu1, float alpha, float red2, float grn2, float blu2)
    +            int color, float width)
         {
    -        BufferBuilder builder = tesselator.begin(Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR);
    -        /* old lines not using strip
             if (xthick)
             {
    -            builder.addVertex(x1, y1, z1).setColor(red1, grn2, blu2, alpha);
    -            builder.addVertex(x2, y1, z1).setColor(red1, grn2, blu2, alpha);
    -
    -            builder.addVertex(x2, y2, z1).setColor(red1, grn1, blu1, alpha);
    -            builder.addVertex(x1, y2, z1).setColor(red1, grn1, blu1, alpha);
    -
    -            builder.addVertex(x1, y1, z2).setColor(red1, grn1, blu1, alpha);
    -            builder.addVertex(x2, y1, z2).setColor(red1, grn1, blu1, alpha);
    -
    -            builder.addVertex(x1, y2, z2).setColor(red1, grn1, blu1, alpha);
    -            builder.addVertex(x2, y2, z2).setColor(red1, grn1, blu1, alpha);
    +            primitives.addLine(new Vec3(x1, y1, z1), new Vec3(x2, y1, z1), color, width);
    +            primitives.addLine(new Vec3(x2, y2, z1), new Vec3(x1, y2, z1), color, width);
    +            primitives.addLine(new Vec3(x1, y1, z2), new Vec3(x2, y1, z2), color, width);
    +            primitives.addLine(new Vec3(x1, y2, z2), new Vec3(x2, y2, z2), color, width);
             }
             if (ythick)
             {
    -            builder.addVertex(x1, y1, z1).setColor(red2, grn1, blu2, alpha);
    -            builder.addVertex(x1, y2, z1).setColor(red2, grn1, blu2, alpha);
    -
    -            builder.addVertex(x2, y1, z1).setColor(red1, grn1, blu1, alpha);
    -            builder.addVertex(x2, y2, z1).setColor(red1, grn1, blu1, alpha);
    -
    -            builder.addVertex(x1, y2, z2).setColor(red1, grn1, blu1, alpha);
    -            builder.addVertex(x1, y1, z2).setColor(red1, grn1, blu1, alpha);
    -
    -            builder.addVertex(x2, y1, z2).setColor(red1, grn1, blu1, alpha);
    -            builder.addVertex(x2, y2, z2).setColor(red1, grn1, blu1, alpha);
    +            primitives.addLine(new Vec3(x1, y1, z1), new Vec3(x1, y2, z1), color, width);
    +            primitives.addLine(new Vec3(x2, y1, z1), new Vec3(x2, y2, z1), color, width);
    +            primitives.addLine(new Vec3(x1, y2, z2), new Vec3(x1, y1, z2), color, width);
    +            primitives.addLine(new Vec3(x2, y1, z2), new Vec3(x2, y2, z2), color, width);
             }
             if (zthick)
             {
    -            builder.addVertex(x1, y1, z1).setColor(red2, grn2, blu1, alpha);
    -            builder.addVertex(x1, y1, z2).setColor(red2, grn2, blu1, alpha);
    -
    -            builder.addVertex(x1, y2, z1).setColor(red1, grn1, blu1, alpha);
    -            builder.addVertex(x1, y2, z2).setColor(red1, grn1, blu1, alpha);
    -
    -            builder.addVertex(x2, y1, z2).setColor(red1, grn1, blu1, alpha);
    -            builder.addVertex(x2, y1, z1).setColor(red1, grn1, blu1, alpha);
    -
    -            builder.addVertex(x2, y2, z1).setColor(red1, grn1, blu1, alpha);
    -            builder.addVertex(x2, y2, z2).setColor(red1, grn1, blu1, alpha);
    +            primitives.addLine(new Vec3(x1, y1, z1), new Vec3(x1, y1, z2), color, width);
    +            primitives.addLine(new Vec3(x1, y2, z1), new Vec3(x1, y2, z2), color, width);
    +            primitives.addLine(new Vec3(x2, y1, z2), new Vec3(x2, y1, z1), color, width);
    +            primitives.addLine(new Vec3(x2, y2, z1), new Vec3(x2, y2, z2), color, width);
             }
    -         */
    -
    -        if (xthick)
    -
    -        {
    -            builder.addVertex(x1, y1, z1).setColor(red1, grn2, blu2, alpha);
    -            builder.addVertex(x2, y1, z1).setColor(red1, grn2, blu2, alpha);
    -
    -            builder.addVertex(x2, y2, z1).setColor(red1, grn1, blu1, alpha);
    -            builder.addVertex(x1, y2, z1).setColor(red1, grn1, blu1, alpha);
    -
    -            builder.addVertex(x1, y2, z2).setColor(red1, grn1, blu1, alpha);
    -            builder.addVertex(x2, y2, z2).setColor(red1, grn1, blu1, alpha);
    -
    -            builder.addVertex(x2, y1, z2).setColor(red1, grn1, blu1, alpha);
    -            builder.addVertex(x1, y1, z2).setColor(red1, grn1, blu1, alpha);
    -        }
    -        if (ythick)
    -        {
    -            builder.addVertex(x1, y1, z1).setColor(red2, grn1, blu2, alpha);
    -            builder.addVertex(x1, y2, z1).setColor(red2, grn1, blu2, alpha);
    -
    -            builder.addVertex(x2, y2, z1).setColor(red1, grn1, blu1, alpha);
    -            builder.addVertex(x2, y1, z1).setColor(red1, grn1, blu1, alpha);
    -
    -            builder.addVertex(x2, y1, z2).setColor(red1, grn1, blu1, alpha);
    -            builder.addVertex(x2, y2, z2).setColor(red1, grn1, blu1, alpha);
    -
    -            builder.addVertex(x1, y2, z2).setColor(red1, grn1, blu1, alpha);
    -            builder.addVertex(x1, y1, z2).setColor(red1, grn1, blu1, alpha);
    -        }
    -        if (zthick)
    -        {
    -            builder.addVertex(x1, y1, z1).setColor(red2, grn2, blu1, alpha);
    -            builder.addVertex(x1, y1, z2).setColor(red2, grn2, blu1, alpha);
    -
    -            builder.addVertex(x1, y2, z2).setColor(red1, grn1, blu1, alpha);
    -            builder.addVertex(x1, y2, z1).setColor(red1, grn1, blu1, alpha);
    -
    -            builder.addVertex(x2, y2, z1).setColor(red1, grn1, blu1, alpha);
    -            builder.addVertex(x2, y2, z2).setColor(red1, grn1, blu1, alpha);
    -
    -            builder.addVertex(x2, y1, z2).setColor(red1, grn1, blu1, alpha);
    -            builder.addVertex(x2, y1, z1).setColor(red1, grn1, blu1, alpha);
    -        }
    -        drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1));
         }
     
         public static void drawBoxFaces(
    -            Tesselator tesselator,
    +            DrawableGizmoPrimitives primitives,
                 float x1, float y1, float z1,
                 float x2, float y2, float z2,
                 boolean xthick, boolean ythick, boolean zthick,
    -            float red1, float grn1, float blu1, float alpha)
    +            int argb)
         {
    -        BufferBuilder builder = tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR);
    -
             if (xthick && ythick)
             {
    -            builder.addVertex(x1, y1, z1).setColor(red1, grn1, blu1, alpha);
    -            builder.addVertex(x2, y1, z1).setColor(red1, grn1, blu1, alpha);
    -            builder.addVertex(x2, y2, z1).setColor(red1, grn1, blu1, alpha);
    -            builder.addVertex(x1, y2, z1).setColor(red1, grn1, blu1, alpha);
    +            primitives.addQuad(new Vec3(x1, y1, z1), new Vec3(x2, y1, z1), new Vec3(x2, y2, z1), new Vec3(x1, y2, z1), argb);
                 if (zthick)
                 {
    -                builder.addVertex(x1, y1, z2).setColor(red1, grn1, blu1, alpha);
    -                builder.addVertex(x1, y2, z2).setColor(red1, grn1, blu1, alpha);
    -                builder.addVertex(x2, y2, z2).setColor(red1, grn1, blu1, alpha);
    -                builder.addVertex(x2, y1, z2).setColor(red1, grn1, blu1, alpha);
    +                primitives.addQuad(new Vec3(x1, y1, z2), new Vec3(x1, y2, z2), new Vec3(x2, y2, z2), new Vec3(x2, y1, z2), argb);
                 }
             }
     
    -
             if (zthick && ythick)
             {
    -            builder.addVertex(x1, y1, z1).setColor(red1, grn1, blu1, alpha);
    -            builder.addVertex(x1, y2, z1).setColor(red1, grn1, blu1, alpha);
    -            builder.addVertex(x1, y2, z2).setColor(red1, grn1, blu1, alpha);
    -            builder.addVertex(x1, y1, z2).setColor(red1, grn1, blu1, alpha);
    +            primitives.addQuad(new Vec3(x1, y1, z1), new Vec3(x1, y2, z1), new Vec3(x1, y2, z2), new Vec3(x1, y1, z2), argb);
     
                 if (xthick)
                 {
    -                builder.addVertex(x2, y1, z1).setColor(red1, grn1, blu1, alpha);
    -                builder.addVertex(x2, y1, z2).setColor(red1, grn1, blu1, alpha);
    -                builder.addVertex(x2, y2, z2).setColor(red1, grn1, blu1, alpha);
    -                builder.addVertex(x2, y2, z1).setColor(red1, grn1, blu1, alpha);
    +                primitives.addQuad(new Vec3(x2, y1, z1), new Vec3(x2, y1, z2), new Vec3(x2, y2, z2), new Vec3(x2, y2, z1), argb);
                 }
             }
     
             // now at least drawing one
             if (zthick && xthick)
             {
    -            builder.addVertex(x1, y1, z1).setColor(red1, grn1, blu1, alpha);
    -            builder.addVertex(x2, y1, z1).setColor(red1, grn1, blu1, alpha);
    -            builder.addVertex(x2, y1, z2).setColor(red1, grn1, blu1, alpha);
    -            builder.addVertex(x1, y1, z2).setColor(red1, grn1, blu1, alpha);
    -
    -
    +            primitives.addQuad(new Vec3(x1, y1, z1), new Vec3(x2, y1, z1), new Vec3(x2, y1, z2), new Vec3(x1, y1, z2), argb);
                 if (ythick)
                 {
    -                builder.addVertex(x1, y2, z1).setColor(red1, grn1, blu1, alpha);
    -                builder.addVertex(x2, y2, z1).setColor(red1, grn1, blu1, alpha);
    -                builder.addVertex(x2, y2, z2).setColor(red1, grn1, blu1, alpha);
    -                builder.addVertex(x1, y2, z2).setColor(red1, grn1, blu1, alpha);
    +                primitives.addQuad(new Vec3(x1, y2, z1), new Vec3(x1, y2, z2), new Vec3(x2, y2, z2), new Vec3(x2, y2, z1), argb);
                 }
             }
    -        drawWithShader(builder.buildOrThrow(), RenderType.debugQuads());
         }
     
    -    public static void drawCylinderWireframe(Tesselator tesselator,
    +    public static void drawCylinderWireframe(DrawableGizmoPrimitives primitives,
                                                  float cx, float cy, float cz,
                                                  float r, float h, Direction.Axis axis, int subd, boolean isFlat,
    -                                             float red, float grn, float blu, float alpha)
    +                                             int argb, float width)
         {
             float step = (float) Math.PI / (subd / 2);
             int num_steps180 = (int) (Math.PI / step) + 1;
    @@ -1102,34 +1012,35 @@ public class ShapesRenderer
                 for (int dh = 0; dh < hsteps; dh++)
                 {
                     float hh = dh * hstep;
    -                BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR);  // line loop to line strip
    +                Vec3 from = null;
                     for (int i = 0; i <= num_steps360 + 1; i++)
                     {
                         float theta = step * i;
                         float x = r * Mth.cos(theta);
                         float y = hh;
                         float z = r * Mth.sin(theta);
    -                    builder.addVertex(x + cx, y + cy, z + cz).setColor(red, grn, blu, alpha);
    +                    Vec3 to = new Vec3(x + cx, y + cy, z + cz);
    +                    if (from != null) {
    +                        primitives.addLine(from, to, argb, width);
    +                    }
    +                    from = to;
                     }
    -                drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1));
                 }
     
                 if (!isFlat)
                 {
                     for (int i = 0; i <= num_steps180; i++)
                     {
    -                    BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR); // line loop to line strip
                         float theta = step * i;
                         float x = r * Mth.cos(theta);
     
                         float z = r * Mth.sin(theta);
     
    -                    builder.addVertex(cx - x, cy + 0, cz + z).setColor(red, grn, blu, alpha);
    -                    builder.addVertex(cx + x, cy + 0, cz - z).setColor(red, grn, blu, alpha);
    -                    builder.addVertex(cx + x, cy + h, cz - z).setColor(red, grn, blu, alpha);
    -                    builder.addVertex(cx - x, cy + h, cz + z).setColor(red, grn, blu, alpha);
    -                    builder.addVertex(cx - x, cy + 0, cz + z).setColor(red, grn, blu, alpha);
    -                    drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1));
    +                    primitives.addLine(new Vec3(cx- x, cy+ 0,cz + z), new Vec3(cx + x, cy + 0, cz - z), argb, width);
    +                    primitives.addLine(new Vec3(cx + x, cy + 0, cz - z), new Vec3(cx + x, cy + h, cz - z), argb, width);
    +                    primitives.addLine(new Vec3(cx + x, cy + h, cz - z), new Vec3(cx - x, cy + h, cz + z), argb, width);
    +                    primitives.addLine(new Vec3(cx - x, cy + h, cz + z), new Vec3(cx - x, cy + 0, cz + z), argb, width);
    +
                     }
                 }
                 /* else
    @@ -1152,33 +1063,35 @@ public class ShapesRenderer
                 for (int dh = 0; dh < hsteps; dh++)
                 {
                     float hh = dh * hstep;
    -                BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR); // line loop to line strip
    +                Vec3 from = null;
                     for (int i = 0; i <= num_steps360; i++)
                     {
                         float theta = step * i;
                         float z = r * Mth.cos(theta);
                         float x = hh;
                         float y = r * Mth.sin(theta);
    -                    builder.addVertex(x + cx, y + cy, z + cz).setColor(red, grn, blu, alpha);
    +                    Vec3 to = new Vec3(x + cx, y + cy, z + cz);
    +                    if (from != null) {
    +                        primitives.addLine(from, to, argb, width);
    +                    }
    +                    from = to;
                     }
    -                drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1));
                 }
     
                 if (!isFlat)
                 {
                     for (int i = 0; i <= num_steps180; i++)
                     {
    -                    BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR); // line loop to line strip
                         float theta = step * i;
                         float y = r * Mth.cos(theta);
     
                         float z = r * Mth.sin(theta);
     
    -                    builder.addVertex(cx + 0, cy - y, cz + z).setColor(red, grn, blu, alpha);
    -                    builder.addVertex(cx + 0, cy + y, cz - z).setColor(red, grn, blu, alpha);
    -                    builder.addVertex(cx + h, cy + y, cz - z).setColor(red, grn, blu, alpha);
    -                    builder.addVertex(cx + h, cy - y, cz + z).setColor(red, grn, blu, alpha);
    -                    drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1));
    +                    primitives.addLine(new Vec3(cx + 0, cy - y, cz + z), new Vec3(cx + 0, cy + y, cz - z), argb, width);
    +                    primitives.addLine(new Vec3(cx + 0, cy + y, cz - z), new Vec3(cx + h, cy + y, cz - z), argb, width);
    +                    primitives.addLine(new Vec3(cx + h, cy + y, cz - z), new Vec3(cx + h, cy - y, cz + z), argb, width);
    +                    primitives.addLine(new Vec3(cx + h, cy - y, cz + z), new Vec3(cx + 0, cy - y, cz + z), argb, width);
    +
                     }
                 }
                 /*else
    @@ -1200,32 +1113,33 @@ public class ShapesRenderer
                 for (int dh = 0; dh < hsteps; dh++)
                 {
                     float hh = dh * hstep;
    -                BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR); // line loop to line strip
    +                Vec3 from = null;
                     for (int i = 0; i <= num_steps360; i++)
                     {
                         float theta = step * i;
                         float y = r * Mth.cos(theta);
                         float z = hh;
                         float x = r * Mth.sin(theta);
    -                    builder.addVertex(x + cx, y + cy, z + cz).setColor(red, grn, blu, alpha);
    +                    Vec3 to = new Vec3(x + cx, y + cy, z + cz);
    +                    if (from != null) {
    +                        primitives.addLine(from, to, argb, width);
    +                    }
    +                    from = to;
                     }
    -                drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1));
                 }
                 if (!isFlat)
                 {
                     for (int i = 0; i <= num_steps180; i++)
                     {
    -                    BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR); // line loop to line strip
                         float theta = step * i;
                         float x = r * Mth.cos(theta);
     
                         float y = r * Mth.sin(theta);
     
    -                    builder.addVertex(cx + x, cy - y, cz + 0).setColor(red, grn, blu, alpha);
    -                    builder.addVertex(cx - x, cy + y, cz + 0).setColor(red, grn, blu, alpha);
    -                    builder.addVertex(cx - x, cy + y, cz + h).setColor(red, grn, blu, alpha);
    -                    builder.addVertex(cx + x, cy - y, cz + h).setColor(red, grn, blu, alpha);
    -                    drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1));
    +                    primitives.addLine(new Vec3(cx + x, cy - y, cz + 0), new Vec3(cx - x, cy + y, cz + 0), argb, width);
    +                    primitives.addLine(new Vec3(cx - x, cy + y, cz + 0), new Vec3(cx - x, cy + y, cz + h), argb, width);
    +                    primitives.addLine(new Vec3(cx - x, cy + y, cz + h), new Vec3(cx + x, cy - y, cz + h), argb, width);
    +                    primitives.addLine(new Vec3(cx + x, cy - y, cz + h), new Vec3(cx + x, cy - y, cz + 0), argb, width);
                     }
                 }
                 /*else
    @@ -1244,10 +1158,10 @@ public class ShapesRenderer
             }
         }
     
    -    public static void drawCylinderFaces(Tesselator tesselator,
    +    public static void drawCylinderFaces(DrawableGizmoPrimitives primitives,
                                              float cx, float cy, float cz,
                                              float r, float h, Direction.Axis axis, int subd, boolean isFlat,
    -                                         float red, float grn, float blu, float alpha)
    +                                         int argb)
         {
             float step = (float) Math.PI / (subd / 2);
             //final int num_steps180 = (int) (Math.PI / step) + 1;
    @@ -1255,31 +1169,31 @@ public class ShapesRenderer
     
             if (axis == Direction.Axis.Y)
             {
    -
    -            BufferBuilder builder = tesselator.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR);
    -            builder.addVertex(cx, cy, cz).setColor(red, grn, blu, alpha);
    -            for (int i = 0; i <= num_steps360; i++)
                 {
    -                float theta = step * i;
    -                float x = r * Mth.cos(theta);
    -                float z = r * Mth.sin(theta);
    -                builder.addVertex(x + cx, cy, z + cz).setColor(red, grn, blu, alpha);
    +                final Vec3[] points = new Vec3[num_steps360 + 2];
    +                points[0] = new Vec3(cx, cy, cz);
    +                for (int i = 0; i <= num_steps360; i++) {
    +                    float theta = step * i;
    +                    float x = r * Mth.cos(theta);
    +                    float z = r * Mth.sin(theta);
    +                    points[i + 1] = new Vec3(x + cx, cy, z + cz);
    +                }
    +                primitives.addTriangleFan(points, argb);
                 }
    -            drawWithShader(builder.buildOrThrow(), RenderType.debugTriangleFan());
    +
                 if (!isFlat)
                 {
    -                BufferBuilder builderr = tesselator.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR);
    -                builderr.addVertex(cx, cy + h, cz).setColor(red, grn, blu, alpha);
    +                final Vec3[] points = new Vec3[num_steps360 + 2];
    +                points[0] = new Vec3(cx, cy + h, cz);
                     for (int i = 0; i <= num_steps360; i++)
                     {
                         float theta = step * i;
                         float x = r * Mth.cos(theta);
                         float z = r * Mth.sin(theta);
    -                    builderr.addVertex(x + cx, cy + h, z + cz).setColor(red, grn, blu, alpha);
    +                    points[i + 1] = new Vec3(x + cx, cy + h, z + cz);
                     }
    -                drawWithShader(builderr.buildOrThrow(), RenderType.debugTriangleFan());
    +                primitives.addTriangleFan(points, argb);
     
    -                BufferBuilder builderrr = tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR);  // quad strip to quads
                     float xp = r * 1;
                     float zp = r * 0;
                     for (int i = 1; i <= num_steps360; i++)
    @@ -1287,43 +1201,42 @@ public class ShapesRenderer
                         float theta = step * i;
                         float x = r * Mth.cos(theta);
                         float z = r * Mth.sin(theta);
    -                    builderrr.addVertex(cx + xp, cy + 0, cz + zp).setColor(red, grn, blu, alpha);
    -                    builderrr.addVertex(cx + xp, cy + h, cz + zp).setColor(red, grn, blu, alpha);
    -                    builderrr.addVertex(cx + x, cy + h, cz + z).setColor(red, grn, blu, alpha);
    -                    builderrr.addVertex(cx + x, cy + 0, cz + z).setColor(red, grn, blu, alpha);
    +                    primitives.addQuad(new Vec3(cx + xp, cy + 0, cz + zp), new Vec3(cx + xp, cy + h, cz + zp),
    +                            new Vec3(cx + x, cy + h, cz + z), new Vec3(cx - x, cy + h, cz + z), argb);
                         xp = x;
                         zp = z;
                     }
    -                drawWithShader(builderrr.buildOrThrow(), RenderType.debugQuads());
                 }
     
             }
             else if (axis == Direction.Axis.X)
             {
    -            BufferBuilder builder = tesselator.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR);
    -            builder.addVertex(cx, cy, cz).setColor(red, grn, blu, alpha);
    -            for (int i = 0; i <= num_steps360; i++)
                 {
    -                float theta = step * i;
    -                float y = r * Mth.cos(theta);
    -                float z = r * Mth.sin(theta);
    -                builder.addVertex(cx, cy + y, z + cz).setColor(red, grn, blu, alpha);
    +                Vec3[] points = new Vec3[num_steps360 + 2];
    +                points[0] = new Vec3(cx, cy, cz);
    +                for (int i = 0; i <= num_steps360; i++) {
    +                    float theta = step * i;
    +                    float y = r * Mth.cos(theta);
    +                    float z = r * Mth.sin(theta);
    +                    points[i + 1] = new Vec3(cx, cy + y, cz + z);
    +
    +                }
    +                primitives.addTriangleFan(points, argb);
                 }
    -            drawWithShader(builder.buildOrThrow(), RenderType.debugTriangleFan());
    +
                 if (!isFlat)
                 {
    -                BufferBuilder builderr = tesselator.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR);
    -                builderr.addVertex(cx + h, cy, cz).setColor(red, grn, blu, alpha);
    +                Vec3[] points = new Vec3[num_steps360 + 2];
    +                points[0] = new Vec3(cx + h, cy, cz);
                     for (int i = 0; i <= num_steps360; i++)
                     {
                         float theta = step * i;
                         float y = r * Mth.cos(theta);
                         float z = r * Mth.sin(theta);
    -                    builderr.addVertex(cx + h, cy + y, cz + z).setColor(red, grn, blu, alpha);
    +                    points[i + 1] = new Vec3(cx, cy + y, cz + z);
                     }
    -                drawWithShader(builderr.buildOrThrow(), RenderType.debugTriangleFan());
    +                primitives.addTriangleFan(points, argb);
     
    -                BufferBuilder builderrr = tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR);  // quad strip to quads
                     float yp = r * 1;
                     float zp = r * 0;
                     for (int i = 1; i <= num_steps360; i++)
    @@ -1331,42 +1244,40 @@ public class ShapesRenderer
                         float theta = step * i;
                         float y = r * Mth.cos(theta);
                         float z = r * Mth.sin(theta);
    -                    builderrr.addVertex(cx + 0, cy + yp, cz + zp).setColor(red, grn, blu, alpha);
    -                    builderrr.addVertex(cx + h, cy + yp, cz + zp).setColor(red, grn, blu, alpha);
    -                    builderrr.addVertex(cx + h, cy + y, cz + z).setColor(red, grn, blu, alpha);
    -                    builderrr.addVertex(cx + 0, cy + y, cz + z).setColor(red, grn, blu, alpha);
    +
    +                    primitives.addQuad(new Vec3(cx + 0, cy + yp, cz + zp), new Vec3(cx + h, cy + yp, cz + zp),
    +                            new Vec3(cx + h, cy + y, cz + z), new Vec3(cx + 0, cy + y, cz + z), argb);
                         yp = y;
                         zp = z;
                     }
    -                drawWithShader(builderrr.buildOrThrow(), RenderType.debugQuads());
                 }
             }
             else if (axis == Direction.Axis.Z)
             {
    -            BufferBuilder builder = tesselator.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR);
    -            builder.addVertex(cx, cy, cz).setColor(red, grn, blu, alpha);
    -            for (int i = 0; i <= num_steps360; i++)
                 {
    -                float theta = step * i;
    -                float x = r * Mth.cos(theta);
    -                float y = r * Mth.sin(theta);
    -                builder.addVertex(x + cx, cy + y, cz).setColor(red, grn, blu, alpha);
    +                Vec3[] points = new Vec3[num_steps360 + 2];
    +                points[0] = new Vec3(cx, cy, cz);
    +                for (int i = 0; i <= num_steps360; i++) {
    +                    float theta = step * i;
    +                    float x = r * Mth.cos(theta);
    +                    float y = r * Mth.sin(theta);
    +                    points[i + 1] = new Vec3(x + cx, cy + y, cz);
    +                }
    +                primitives.addTriangleFan(points, argb);
                 }
    -            drawWithShader(builder.buildOrThrow(), RenderType.debugTriangleFan());
                 if (!isFlat)
                 {
    -                BufferBuilder builderr = tesselator.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR);
    -                builderr.addVertex(cx, cy, cz + h).setColor(red, grn, blu, alpha);
    +                Vec3 [] points = new Vec3[num_steps360 + 2];
    +                points[0] = new Vec3(cx, cy, cz + h);
                     for (int i = 0; i <= num_steps360; i++)
                     {
                         float theta = step * i;
                         float x = r * Mth.cos(theta);
                         float y = r * Mth.sin(theta);
    -                    builderr.addVertex(x + cx, cy + y, cz + h).setColor(red, grn, blu, alpha);
    +                    points[i + 1] = new Vec3(x + cx, cy + y, cz + h);
                     }
    -                drawWithShader(builderr.buildOrThrow(), RenderType.debugTriangleFan());
    +                primitives.addTriangleFan(points, argb);
     
    -                BufferBuilder builderrr = tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR);  // quad strip to quads
                     float xp = r;
                     float yp = 0;
                     for (int i = 1; i <= num_steps360; i++)
    @@ -1374,29 +1285,26 @@ public class ShapesRenderer
                         float theta = step * i;
                         float x = r * Mth.cos(theta);
                         float y = r * Mth.sin(theta);
    -                    builderrr.addVertex(cx + xp, cy + yp, cz + 0).setColor(red, grn, blu, alpha);
    -                    builderrr.addVertex(cx + xp, cy + yp, cz + h).setColor(red, grn, blu, alpha);
    -                    builderrr.addVertex(cx + x, cy + y, cz + h).setColor(red, grn, blu, alpha);
    -                    builderrr.addVertex(cx + x, cy + y, cz + 0).setColor(red, grn, blu, alpha);
    +                    primitives.addQuad(new Vec3(cx + xp, cy + yp, cz + 0), new Vec3(cx + xp, cy + yp, cz + h),
    +                            new Vec3(cx + x, cy + y, cz + h), new Vec3(cx + x, cy + y, cz + 0), argb);
                         xp = x;
                         yp = y;
                     }
    -                drawWithShader(builderrr.buildOrThrow(), RenderType.debugQuads());
                 }
             }
         }
     
    -    public static void drawSphereWireframe(Tesselator tesselator,
    +    public static void drawSphereWireframe(DrawableGizmoPrimitives primitives,
                                                float cx, float cy, float cz,
                                                float r, int subd,
    -                                           float red, float grn, float blu, float alpha)
    +                                           int argb, float width)
         {
             float step = (float) Math.PI / (subd / 2);
             int num_steps180 = (int) (Math.PI / step) + 1;
             int num_steps360 = (int) (2 * Math.PI / step) + 1;
             for (int i = 0; i <= num_steps360; i++)
             {
    -            BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR);
    +            Vec3 from = null;
                 float theta = step * i;
                 for (int j = 0; j <= num_steps180; j++)
                 {
    @@ -1404,13 +1312,16 @@ public class ShapesRenderer
                     float x = r * Mth.sin(phi) * Mth.cos(theta);
                     float z = r * Mth.sin(phi) * Mth.sin(theta);
                     float y = r * Mth.cos(phi);
    -                builder.addVertex(x + cx, y + cy, z + cz).setColor(red, grn, blu, alpha);
    +                Vec3 to = new Vec3(x + cx, y + cy, z + cz);
    +                if (from != null) {
    +                    primitives.addLine(from, to, argb, width);
    +                }
    +                from = to;
                 }
    -            drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1));
             }
             for (int j = 0; j <= num_steps180; j++)
             {
    -            BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR); // line loop to line strip
    +            Vec3 from = null;
                 float phi = step * j;
     
                 for (int i = 0; i <= num_steps360; i++)
    @@ -1419,17 +1330,20 @@ public class ShapesRenderer
                     float x = r * Mth.sin(phi) * Mth.cos(theta);
                     float z = r * Mth.sin(phi) * Mth.sin(theta);
                     float y = r * Mth.cos(phi);
    -                builder.addVertex(x + cx, y + cy, z + cz).setColor(red, grn, blu, alpha);
    +                Vec3 to = new Vec3(x + cx, y + cy, z + cz);
    +                if (from != null) {
    +                    primitives.addLine(from, to, argb, width);
    +                }
    +                from = to;
                 }
    -            drawWithShader(builder.buildOrThrow(), RenderType.debugLineStrip(1));
             }
     
         }
     
    -    public static void drawSphereFaces(Tesselator tesselator,
    +    public static void drawSphereFaces(DrawableGizmoPrimitives primitives,
                                            float cx, float cy, float cz,
                                            float r, int subd,
    -                                       float red, float grn, float blu, float alpha)
    +                                       int argb)
         {
     
             float step = (float) Math.PI / (subd / 2);
    @@ -1439,7 +1353,6 @@ public class ShapesRenderer
             {
                 float theta = i * step;
                 float thetaprime = theta + step;
    -            BufferBuilder builder = tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR);  // quad strip to quads
                 float xb = 0;
                 float zb = 0;
                 float xbp = 0;
    @@ -1453,17 +1366,16 @@ public class ShapesRenderer
                     float y = r * Mth.cos(phi);
                     float xp = r * Mth.sin(phi) * Mth.cos(thetaprime);
                     float zp = r * Mth.sin(phi) * Mth.sin(thetaprime);
    -                builder.addVertex(xb + cx, yp + cy, zb + cz).setColor(red, grn, blu, alpha);
    -                builder.addVertex(xbp + cx, yp + cy, zbp + cz).setColor(red, grn, blu, alpha);
    -                builder.addVertex(xp + cx, y + cy, zp + cz).setColor(red, grn, blu, alpha);
    -                builder.addVertex(x + cx, y + cy, z + cz).setColor(red, grn, blu, alpha);
    +
    +                primitives.addQuad(new Vec3(xb + cx, yp + cy, zb + cz), new Vec3(xbp + cx, yp + cy, zbp + cz),
    +                        new Vec3(xp + cx, y + cy, zp + cz), new Vec3(x + cx, y + cy, z + cz), argb);
    +
                     xb = x;
                     zb = z;
                     xbp = xp;
                     zbp = zp;
                     yp = y;
                 }
    -            drawWithShader(builder.buildOrThrow(), RenderType.debugQuads());
             }
         }
     }
    diff --git a/src/main/java/carpet/script/utils/SnoopyCommandSource.java b/src/main/java/carpet/script/utils/SnoopyCommandSource.java
    index 720910c9..d100b6ec 100644
    --- a/src/main/java/carpet/script/utils/SnoopyCommandSource.java
    +++ b/src/main/java/carpet/script/utils/SnoopyCommandSource.java
    @@ -10,6 +10,7 @@ import net.minecraft.network.chat.Component;
     import net.minecraft.server.MinecraftServer;
     import net.minecraft.server.level.ServerLevel;
     import net.minecraft.server.level.ServerPlayer;
    +import net.minecraft.server.permissions.PermissionSet;
     import net.minecraft.util.Mth;
     import net.minecraft.util.TaskChainer;
     import net.minecraft.world.entity.Entity;
    @@ -28,7 +29,7 @@ public class SnoopyCommandSource extends CommandSourceStack
         private final CommandSource output;
         private final Vec3 position;
         private final ServerLevel world;
    -    private final int level;
    +    private final PermissionSet level;
         private final String simpleName;
         private final Component name;
         private final MinecraftServer server;
    @@ -47,8 +48,9 @@ public class SnoopyCommandSource extends CommandSourceStack
         public SnoopyCommandSource(CommandSourceStack original, Component[] error, List chatOutput, OptionalLong[] returnValue)
         {
             super(CommandSource.NULL, original.getPosition(), original.getRotation(), original.getLevel(), Vanilla.MinecraftServer_getRunPermissionLevel(original.getServer()),
    -                original.getTextName(), original.getDisplayName(), original.getServer(), original.getEntity(), false,
    -                (b, i) -> returnValue[0] = OptionalLong.of(i), EntityAnchorArgument.Anchor.FEET, CommandSigningContext.ANONYMOUS, TaskChainer.immediate(original.getServer()));
    +                original.getTextName(), original.getDisplayName(), original.getServer(), original.getEntity()
    +                //,false ,(b, i) -> returnValue[0] = OptionalLong.of(i), EntityAnchorArgument.Anchor.FEET, CommandSigningContext.ANONYMOUS, TaskChainer.immediate(original.getServer())
    +        );
             this.output = CommandSource.NULL;
             this.position = original.getPosition();
             this.world = original.getLevel();
    @@ -89,13 +91,14 @@ public class SnoopyCommandSource extends CommandSourceStack
             this.taskChainer = TaskChainer.immediate(player.level().getServer());
         }
     
    -    private SnoopyCommandSource(CommandSource output, Vec3 pos, Vec2 rot, ServerLevel world, int level, String simpleName, Component name, MinecraftServer server, @Nullable Entity entity, CommandResultCallback consumer, EntityAnchorArgument.Anchor entityAnchor, CommandSigningContext context, TaskChainer chainer,
    +    private SnoopyCommandSource(CommandSource output, Vec3 pos, Vec2 rot, ServerLevel world, PermissionSet level, String simpleName, Component name, MinecraftServer server, @Nullable Entity entity, CommandResultCallback consumer, EntityAnchorArgument.Anchor entityAnchor, CommandSigningContext context, TaskChainer chainer,
                                     Component[] error, List chatOutput
         )
         {
             super(output, pos, rot, world, level,
    -                simpleName, name, server, entity, false,
    -                consumer, entityAnchor, context, chainer);
    +                simpleName, name, server, entity
    +               // , false, consumer, entityAnchor, context, chainer
    +        );
             this.output = output;
             this.position = pos;
             this.rotation = rot;
    @@ -149,13 +152,13 @@ public class SnoopyCommandSource extends CommandSourceStack
         //public ServerCommandSource withSilent() { return this; }
     
         @Override
    -    public CommandSourceStack withPermission(int level)
    +    public CommandSourceStack withPermission(PermissionSet level)
         {
             return this;
         }
     
         @Override
    -    public CommandSourceStack withMaximumPermission(int level)
    +    public CommandSourceStack withMaximumPermission(PermissionSet level)
         {
             return this;
         }
    diff --git a/src/main/java/carpet/script/value/EntityValue.java b/src/main/java/carpet/script/value/EntityValue.java
    index 9bedb9ab..f63526eb 100644
    --- a/src/main/java/carpet/script/value/EntityValue.java
    +++ b/src/main/java/carpet/script/value/EntityValue.java
    @@ -13,6 +13,7 @@ import carpet.script.utils.InputValidator;
     import com.mojang.brigadier.StringReader;
     import com.mojang.brigadier.exceptions.CommandSyntaxException;
     import net.minecraft.commands.CommandSourceStack;
    +import net.minecraft.commands.Commands;
     import net.minecraft.commands.arguments.selector.EntitySelector;
     import net.minecraft.commands.arguments.selector.EntitySelectorParser;
     import net.minecraft.core.BlockPos;
    @@ -35,6 +36,7 @@ import net.minecraft.resources.ResourceLocation;
     import net.minecraft.server.MinecraftServer;
     import net.minecraft.server.level.ServerLevel;
     import net.minecraft.server.level.ServerPlayer;
    +import net.minecraft.server.permissions.LevelBasedPermissionSet;
     import net.minecraft.tags.EntityTypeTags;
     import net.minecraft.tags.TagKey;
     import net.minecraft.util.Mth;
    @@ -120,11 +122,11 @@ public class EntityValue extends Value
                 EntitySelector entitySelector = selectorCache.get(selector);
                 if (entitySelector != null)
                 {
    -                return entitySelector.findEntities(source.withMaximumPermission(4));
    +                return entitySelector.findEntities(source.withMaximumPermission(LevelBasedPermissionSet.OWNER));
                 }
                 entitySelector = new EntitySelectorParser(new StringReader(selector), true).parse();
                 selectorCache.put(selector, entitySelector);
    -            return entitySelector.findEntities(source.withMaximumPermission(4));
    +            return entitySelector.findEntities(source.withMaximumPermission(LevelBasedPermissionSet.OWNER));
             }
             catch (CommandSyntaxException e)
             {
    @@ -599,13 +601,21 @@ public class EntityValue extends Value
             put("permission_level", (e, a) -> {
                 if (e instanceof ServerPlayer spe)
                 {
    -                for (int i = 4; i >= 0; i--)
    +                if (Commands.LEVEL_OWNERS.check(spe.permissions()))
                     {
    -                    if (spe.hasPermissions(i))
    -                    {
    -                        return new NumericValue(i);
    -                    }
    -
    +                    return new NumericValue(4);
    +                }
    +                if (Commands.LEVEL_ADMINS.check(spe.permissions()))
    +                {
    +                    return new NumericValue(3);
    +                }
    +                if (Commands.LEVEL_GAMEMASTERS.check(spe.permissions()))
    +                {
    +                    return new NumericValue(2);
    +                }
    +                if (Commands.LEVEL_MODERATORS.check(spe.permissions()))
    +                {
    +                    return new NumericValue(1);
                     }
                     return new NumericValue(0);
                 }
    diff --git a/src/main/java/carpet/script/value/ScreenValue.java b/src/main/java/carpet/script/value/ScreenValue.java
    index eb1625fe..dd398770 100644
    --- a/src/main/java/carpet/script/value/ScreenValue.java
    +++ b/src/main/java/carpet/script/value/ScreenValue.java
    @@ -24,6 +24,7 @@ import net.minecraft.nbt.NbtOps;
     import net.minecraft.nbt.Tag;
     import net.minecraft.network.chat.Component;
     import net.minecraft.server.level.ServerPlayer;
    +import net.minecraft.server.permissions.PermissionSet;
     import net.minecraft.world.Container;
     import net.minecraft.world.MenuProvider;
     import net.minecraft.world.SimpleContainer;
    @@ -200,7 +201,7 @@ public class ScreenValue extends Value
                 this.screenHandler = null;
                 return false;
             }
    -        int runPermissionLevel = Vanilla.MinecraftServer_getRunPermissionLevel(player.level().getServer());
    +        PermissionSet runPermissionLevel = Vanilla.MinecraftServer_getRunPermissionLevel(player.level().getServer());
             CommandSourceStack source = player.createCommandSourceStack().withPermission(runPermissionLevel);
             CarpetScriptHost executingHost = appHost.retrieveForExecution(source, player);
             try
    diff --git a/src/main/java/carpet/utils/CommandHelper.java b/src/main/java/carpet/utils/CommandHelper.java
    index 9b97f652..0f4064e0 100644
    --- a/src/main/java/carpet/utils/CommandHelper.java
    +++ b/src/main/java/carpet/utils/CommandHelper.java
    @@ -2,6 +2,7 @@ package carpet.utils;
     
     import carpet.CarpetSettings;
     import net.minecraft.commands.CommandSourceStack;
    +import net.minecraft.commands.Commands;
     import net.minecraft.server.MinecraftServer;
     import net.minecraft.server.TickTask;
     import net.minecraft.server.level.ServerPlayer;
    @@ -48,8 +49,12 @@ public final class CommandHelper {
             {
                 case "true"  -> true;
                 case "false" -> false;
    -            case "ops"   -> source.hasPermission(2); // typical for other cheaty commands
    -            case "0", "1", "2", "3", "4" -> source.hasPermission(Integer.parseInt(commandLevelString));
    +            case "ops"   -> Commands.LEVEL_GAMEMASTERS.check(source.permissions()); // typical for other cheaty commands
    +            case "0" ->  Commands.LEVEL_ALL.check(source.permissions());
    +            case "1" -> Commands.LEVEL_MODERATORS.check(source.permissions());
    +            case "2" -> Commands.LEVEL_GAMEMASTERS.check(source.permissions());
    +            case "3" -> Commands.LEVEL_ADMINS.check(source.permissions());
    +            case "4" -> Commands.LEVEL_OWNERS.check(source.permissions());
                 default -> false;
             };
         }
    diff --git a/src/main/resources/carpet.accesswidener b/src/main/resources/carpet.accesswidener
    index df9b0bd1..b5c8fd8a 100644
    --- a/src/main/resources/carpet.accesswidener
    +++ b/src/main/resources/carpet.accesswidener
    @@ -8,8 +8,10 @@ accessible class net/minecraft/world/level/border/WorldBorder$StaticBorderExtent
     accessible class net/minecraft/server/MinecraftServer$ReloadableResources
     accessible class net/minecraft/world/level/biome/Biome$ClimateSettings
     accessible class net/minecraft/world/level/block/entity/SculkSensorBlockEntity$VibrationUser
    +#accessible class net/minecraft/commands/CommandSourceStack
     
     #TODO fields and methods should be fetched via interfaces unless there is a good reason not to
    +#accessible method net/minecraft/commands/CommandSourceStack  (Lnet/minecraft/commands/CommandSource;Lnet/minecraft/world/phys/Vec3;Lnet/minecraft/world/phys/Vec2;Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/server/permissions/PermissionSet;Ljava/lang/String;Lnet/minecraft/network/chat/Component;Lnet/minecraft/server/MinecraftServer;Lnet/minecraft/world/entity/Entity;BLnet/minecraft/commands/CommandResultCallback;Lnet/minecraft/commands/arguments/EntityAnchorArgument$Anchor;Lnet/minecraft/commands/CommandSigningContext;Lnet/minecraft/util/TaskChainer;)V
     accessible method net/minecraft/world/level/border/WorldBorder getListeners ()Ljava/util/List;
     accessible method net/minecraft/world/level/redstone/DefaultRedstoneWireEvaluator calculateTargetStrength (Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;)I
     
    
    From 63aee3ccc2e372f71aaa5be15e6dff6c6263c4f4 Mon Sep 17 00:00:00 2001
    From: gnembon 
    Date: Sat, 11 Oct 2025 19:59:01 +0200
    Subject: [PATCH 134/232] 1.4.187
    
    ---
     gradle.properties                  | 4 ++--
     src/main/resources/fabric.mod.json | 2 +-
     2 files changed, 3 insertions(+), 3 deletions(-)
    
    diff --git a/gradle.properties b/gradle.properties
    index be8ea5ee..2d38930c 100644
    --- a/gradle.properties
    +++ b/gradle.properties
    @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G
     	fabric_version=0.134.0+1.21.9
     
     # Mod Properties
    -	mod_version = 1.4.186
    +	mod_version = 1.4.187
     	maven_group = carpet
     	archives_base_name = fabric-carpet
     
    @@ -17,7 +17,7 @@ org.gradle.jvmargs=-Xmx1G
     	# The Curseforge versions "names" or ids for the main branch (comma separated: 1.16.4,1.16.5)
     	# This is needed because CF uses too vague names for prereleases and release candidates
     	# Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN]
    -	release-curse-versions = Minecraft 1.21:1.21.9
    +	release-curse-versions = Minecraft 1.21:1.21.11-Snapshot
     	# Whether or not to build another branch on release
     	release-extra-branch = false
     	# The name of the second branch to release
    diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json
    index 95673982..5a8a7602 100644
    --- a/src/main/resources/fabric.mod.json
    +++ b/src/main/resources/fabric.mod.json
    @@ -33,7 +33,7 @@
       "accessWidener" : "carpet.accesswidener",
     
       "depends": {
    -    "minecraft": ">=1.21.4",
    +    "minecraft": ">=1.21.10",
         "fabricloader": ">=0.16.10",
         "java": ">=21"
       }
    
    From f2b7aaf28cfbfcd5c75c21b56c3b2cb96073cf06 Mon Sep 17 00:00:00 2001
    From: Calboot 
    Date: Sun, 12 Oct 2025 16:31:37 +0800
    Subject: [PATCH 135/232] Fix #2110
    
    ---
     src/main/java/carpet/patches/EntityPlayerMPFake.java | 10 ++++++++++
     1 file changed, 10 insertions(+)
    
    diff --git a/src/main/java/carpet/patches/EntityPlayerMPFake.java b/src/main/java/carpet/patches/EntityPlayerMPFake.java
    index 38ae1d59..c2ee18f3 100644
    --- a/src/main/java/carpet/patches/EntityPlayerMPFake.java
    +++ b/src/main/java/carpet/patches/EntityPlayerMPFake.java
    @@ -6,6 +6,7 @@ import com.mojang.authlib.properties.PropertyMap;
     import net.minecraft.core.BlockPos;
     import net.minecraft.core.UUIDUtil;
     import net.minecraft.core.component.DataComponents;
    +import net.minecraft.nbt.CompoundTag;
     import net.minecraft.network.DisconnectionDetails;
     import net.minecraft.network.chat.Component;
     import net.minecraft.network.chat.contents.TranslatableContents;
    @@ -24,6 +25,7 @@ import net.minecraft.server.network.CommonListenerCookie;
     import net.minecraft.server.players.CachedUserNameToIdResolver;
     import net.minecraft.server.players.NameAndId;
     import net.minecraft.server.players.OldUsersConverter;
    +import net.minecraft.util.ProblemReporter;
     import net.minecraft.world.damagesource.DamageSource;
     import net.minecraft.world.entity.Entity;
     import net.minecraft.world.entity.EquipmentSlot;
    @@ -37,6 +39,7 @@ import net.minecraft.world.level.Level;
     import net.minecraft.world.level.block.entity.SkullBlockEntity;
     import net.minecraft.world.level.block.state.BlockState;
     import net.minecraft.world.level.portal.TeleportTransition;
    +import net.minecraft.world.level.storage.TagValueInput;
     import net.minecraft.world.phys.Vec3;
     import carpet.fakes.ServerPlayerInterface;
     import carpet.utils.Messenger;
    @@ -100,6 +103,7 @@ public class EntityPlayerMPFake extends ServerPlayer
                 }
     
                 EntityPlayerMPFake instance = new EntityPlayerMPFake(server, worldIn, current, ClientInformation.createDefault(), false);
    +            loadPlayerData(instance);
                 instance.fixStartingPosition = () -> instance.snapTo(pos.x, pos.y, pos.z, (float) yaw, (float) pitch);
                 server.getPlayerList().placeNewPlayer(new FakeClientConnection(PacketFlow.SERVERBOUND), instance, new CommonListenerCookie(current, 0, instance.clientInformation(), false));
                 instance.teleportTo(worldIn, pos.x, pos.y, pos.z, Set.of(), (float) yaw, (float) pitch, true);
    @@ -121,6 +125,11 @@ public class EntityPlayerMPFake extends ServerPlayer
             return resolvableProfile.resolveProfile(server.services().profileResolver());
         }
     
    +    private static void loadPlayerData(EntityPlayerMPFake player) {
    +        Optional playerData = player.level().getServer().getPlayerList().loadPlayerData(player.nameAndId());
    +        playerData.ifPresent(compoundTag -> player.readAdditionalSaveData(TagValueInput.create(ProblemReporter.DISCARDING, player.level().registryAccess(), compoundTag)));
    +    }
    +
         public static EntityPlayerMPFake createShadow(MinecraftServer server, ServerPlayer player)
         {
             player.level().getServer().getPlayerList().remove(player);
    @@ -129,6 +138,7 @@ public class EntityPlayerMPFake extends ServerPlayer
             GameProfile gameprofile = player.getGameProfile();
             EntityPlayerMPFake playerShadow = new EntityPlayerMPFake(server, worldIn, gameprofile, player.clientInformation(), true);
             playerShadow.setChatSession(player.getChatSession());
    +        loadPlayerData(playerShadow);
             server.getPlayerList().placeNewPlayer(new FakeClientConnection(PacketFlow.SERVERBOUND), playerShadow, new CommonListenerCookie(gameprofile, 0, player.clientInformation(), true));
     
             playerShadow.setHealth(player.getHealth());
    
    From ca5f69a4762377aadcbe98e300e354a18159969d Mon Sep 17 00:00:00 2001
    From: gnembon 
    Date: Sun, 12 Oct 2025 14:04:36 +0200
    Subject: [PATCH 136/232] fix return value of run not captured
    
    ---
     .../fakes/CommandSourceStackInterface.java    | 10 +++++++
     .../CommandSourceStack_scarpetMixin.java      | 29 +++++++++++++++++++
     .../script/utils/SnoopyCommandSource.java     |  4 +++
     src/main/resources/carpet.accesswidener       |  3 --
     src/main/resources/carpet.mixins.json         |  1 +
     5 files changed, 44 insertions(+), 3 deletions(-)
     create mode 100644 src/main/java/carpet/fakes/CommandSourceStackInterface.java
     create mode 100644 src/main/java/carpet/mixins/CommandSourceStack_scarpetMixin.java
    
    diff --git a/src/main/java/carpet/fakes/CommandSourceStackInterface.java b/src/main/java/carpet/fakes/CommandSourceStackInterface.java
    new file mode 100644
    index 00000000..7e846dbd
    --- /dev/null
    +++ b/src/main/java/carpet/fakes/CommandSourceStackInterface.java
    @@ -0,0 +1,10 @@
    +package carpet.fakes;
    +
    +import net.minecraft.commands.CommandResultCallback;
    +import net.minecraft.commands.CommandSigningContext;
    +import net.minecraft.commands.arguments.EntityAnchorArgument;
    +import net.minecraft.util.TaskChainer;
    +
    +public interface CommandSourceStackInterface {
    +    void setupPrivates(boolean bl, CommandResultCallback commandResultCallback, EntityAnchorArgument.Anchor anchor, CommandSigningContext commandSigningContext, TaskChainer taskChainer);
    +}
    diff --git a/src/main/java/carpet/mixins/CommandSourceStack_scarpetMixin.java b/src/main/java/carpet/mixins/CommandSourceStack_scarpetMixin.java
    new file mode 100644
    index 00000000..26b33865
    --- /dev/null
    +++ b/src/main/java/carpet/mixins/CommandSourceStack_scarpetMixin.java
    @@ -0,0 +1,29 @@
    +package carpet.mixins;
    +
    +import carpet.fakes.CommandSourceStackInterface;
    +import net.minecraft.commands.CommandResultCallback;
    +import net.minecraft.commands.CommandSigningContext;
    +import net.minecraft.commands.CommandSourceStack;
    +import net.minecraft.commands.arguments.EntityAnchorArgument;
    +import net.minecraft.util.TaskChainer;
    +import org.spongepowered.asm.mixin.Mixin;
    +import org.spongepowered.asm.mixin.Mutable;
    +import org.spongepowered.asm.mixin.Shadow;
    +
    +@Mixin(CommandSourceStack.class)
    +public class CommandSourceStack_scarpetMixin implements CommandSourceStackInterface {
    +    @Mutable @Shadow private boolean silent;
    +    @Mutable @Shadow private CommandResultCallback resultCallback;
    +    @Mutable @Shadow private EntityAnchorArgument.Anchor anchor;
    +    @Mutable @Shadow private CommandSigningContext signingContext;
    +    @Mutable @Shadow private TaskChainer chatMessageChainer;
    +
    +    @Override
    +    public void setupPrivates(boolean bl, CommandResultCallback commandResultCallback, EntityAnchorArgument.Anchor anchor, CommandSigningContext commandSigningContext, TaskChainer taskChainer) {
    +        this.silent = bl;
    +        this.resultCallback = commandResultCallback;
    +        this.anchor = anchor;
    +        this.signingContext = commandSigningContext;
    +        this.chatMessageChainer = taskChainer;
    +    }
    +}
    diff --git a/src/main/java/carpet/script/utils/SnoopyCommandSource.java b/src/main/java/carpet/script/utils/SnoopyCommandSource.java
    index d100b6ec..ef3ee096 100644
    --- a/src/main/java/carpet/script/utils/SnoopyCommandSource.java
    +++ b/src/main/java/carpet/script/utils/SnoopyCommandSource.java
    @@ -1,5 +1,6 @@
     package carpet.script.utils;
     
    +import carpet.fakes.CommandSourceStackInterface;
     import carpet.script.external.Vanilla;
     import net.minecraft.commands.CommandResultCallback;
     import net.minecraft.commands.CommandSigningContext;
    @@ -66,6 +67,7 @@ public class SnoopyCommandSource extends CommandSourceStack
             this.chatOutput = chatOutput;
             this.signingContext = original.getSigningContext();
             this.taskChainer = TaskChainer.immediate(original.getServer());
    +        ((CommandSourceStackInterface) this).setupPrivates(false, (b, i) -> returnValue[0] = OptionalLong.of(i), EntityAnchorArgument.Anchor.FEET, CommandSigningContext.ANONYMOUS, TaskChainer.immediate(original.getServer()));
         }
     
         public SnoopyCommandSource(ServerPlayer player, Component[] error, List output, int [] result)
    @@ -89,6 +91,7 @@ public class SnoopyCommandSource extends CommandSourceStack
             this.chatOutput = output;
             this.signingContext = CommandSigningContext.ANONYMOUS;
             this.taskChainer = TaskChainer.immediate(player.level().getServer());
    +        ((CommandSourceStackInterface) this).setupPrivates(false, (b, i) -> result[0] = i, EntityAnchorArgument.Anchor.FEET, CommandSigningContext.ANONYMOUS, TaskChainer.immediate(player.level().getServer()));
         }
     
         private SnoopyCommandSource(CommandSource output, Vec3 pos, Vec2 rot, ServerLevel world, PermissionSet level, String simpleName, Component name, MinecraftServer server, @Nullable Entity entity, CommandResultCallback consumer, EntityAnchorArgument.Anchor entityAnchor, CommandSigningContext context, TaskChainer chainer,
    @@ -114,6 +117,7 @@ public class SnoopyCommandSource extends CommandSourceStack
             this.chatOutput = chatOutput;
             this.signingContext = context;
             this.taskChainer = chainer;
    +        ((CommandSourceStackInterface) this).setupPrivates(false, consumer, entityAnchor, context, chainer);
         }
     
         @Override
    diff --git a/src/main/resources/carpet.accesswidener b/src/main/resources/carpet.accesswidener
    index b5c8fd8a..23c54edf 100644
    --- a/src/main/resources/carpet.accesswidener
    +++ b/src/main/resources/carpet.accesswidener
    @@ -8,11 +8,8 @@ accessible class net/minecraft/world/level/border/WorldBorder$StaticBorderExtent
     accessible class net/minecraft/server/MinecraftServer$ReloadableResources
     accessible class net/minecraft/world/level/biome/Biome$ClimateSettings
     accessible class net/minecraft/world/level/block/entity/SculkSensorBlockEntity$VibrationUser
    -#accessible class net/minecraft/commands/CommandSourceStack
     
     #TODO fields and methods should be fetched via interfaces unless there is a good reason not to
    -#accessible method net/minecraft/commands/CommandSourceStack  (Lnet/minecraft/commands/CommandSource;Lnet/minecraft/world/phys/Vec3;Lnet/minecraft/world/phys/Vec2;Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/server/permissions/PermissionSet;Ljava/lang/String;Lnet/minecraft/network/chat/Component;Lnet/minecraft/server/MinecraftServer;Lnet/minecraft/world/entity/Entity;BLnet/minecraft/commands/CommandResultCallback;Lnet/minecraft/commands/arguments/EntityAnchorArgument$Anchor;Lnet/minecraft/commands/CommandSigningContext;Lnet/minecraft/util/TaskChainer;)V
     accessible method net/minecraft/world/level/border/WorldBorder getListeners ()Ljava/util/List;
     accessible method net/minecraft/world/level/redstone/DefaultRedstoneWireEvaluator calculateTargetStrength (Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;)I
    -
     accessible field net/minecraft/world/level/block/state/BlockBehaviour UPDATE_SHAPE_ORDER [Lnet/minecraft/core/Direction;
    diff --git a/src/main/resources/carpet.mixins.json b/src/main/resources/carpet.mixins.json
    index df0cb888..5341d9b2 100644
    --- a/src/main/resources/carpet.mixins.json
    +++ b/src/main/resources/carpet.mixins.json
    @@ -148,6 +148,7 @@
         "CommandNode_scarpetCommandsMixin",
         "CommandDispatcher_scarpetCommandsMixin",
         "FoodData_scarpetMixin",
    +    "CommandSourceStack_scarpetMixin",
     
         "BlockInput_scarpetMixin",
         "BlockPredicate_scarpetMixin",
    
    From 9d4babdf5967d1e7eb9561a4ee5e77a197c63cf1 Mon Sep 17 00:00:00 2001
    From: gnembon 
    Date: Sun, 12 Oct 2025 15:26:13 +0200
    Subject: [PATCH 137/232] load moar
    
    ---
     .../java/carpet/patches/EntityPlayerMPFake.java   | 15 ++++++++++++---
     1 file changed, 12 insertions(+), 3 deletions(-)
    
    diff --git a/src/main/java/carpet/patches/EntityPlayerMPFake.java b/src/main/java/carpet/patches/EntityPlayerMPFake.java
    index c2ee18f3..72714a5f 100644
    --- a/src/main/java/carpet/patches/EntityPlayerMPFake.java
    +++ b/src/main/java/carpet/patches/EntityPlayerMPFake.java
    @@ -40,6 +40,7 @@ import net.minecraft.world.level.block.entity.SkullBlockEntity;
     import net.minecraft.world.level.block.state.BlockState;
     import net.minecraft.world.level.portal.TeleportTransition;
     import net.minecraft.world.level.storage.TagValueInput;
    +import net.minecraft.world.level.storage.ValueInput;
     import net.minecraft.world.phys.Vec3;
     import carpet.fakes.ServerPlayerInterface;
     import carpet.utils.Messenger;
    @@ -125,9 +126,17 @@ public class EntityPlayerMPFake extends ServerPlayer
             return resolvableProfile.resolveProfile(server.services().profileResolver());
         }
     
    -    private static void loadPlayerData(EntityPlayerMPFake player) {
    -        Optional playerData = player.level().getServer().getPlayerList().loadPlayerData(player.nameAndId());
    -        playerData.ifPresent(compoundTag -> player.readAdditionalSaveData(TagValueInput.create(ProblemReporter.DISCARDING, player.level().registryAccess(), compoundTag)));
    +    private static void loadPlayerData(EntityPlayerMPFake player)
    +    {
    +        try (ProblemReporter.ScopedCollector scopedCollector = new ProblemReporter.ScopedCollector(player.problemPath(), CarpetSettings.LOG))
    +        {
    +            Optional optional = player.level().getServer().getPlayerList().loadPlayerData(player.nameAndId()).map((compoundTag) -> TagValueInput.create(scopedCollector, player.registryAccess(), compoundTag));
    +            optional.ifPresent( valueInput -> {
    +                player.readAdditionalSaveData(valueInput);
    +                player.loadAndSpawnEnderPearls(valueInput);
    +                player.loadAndSpawnParentVehicle(valueInput);
    +            });
    +        }
         }
     
         public static EntityPlayerMPFake createShadow(MinecraftServer server, ServerPlayer player)
    
    From ce6664af28332062559635b7465fe3ecae3a5e0b Mon Sep 17 00:00:00 2001
    From: Crystal0404 
    Date: Tue, 14 Oct 2025 17:50:10 +0800
    Subject: [PATCH 138/232] gradle-9.1.0 and loom-1.11
    
    ---
     build.gradle                             |  14 ++++----
     gradle.properties                        |   4 +++
     gradle/wrapper/gradle-wrapper.jar        | Bin 61574 -> 45457 bytes
     gradle/wrapper/gradle-wrapper.properties |   3 +-
     gradlew                                  |  40 +++++++++++++----------
     gradlew.bat                              |  25 +++++++-------
     6 files changed, 49 insertions(+), 37 deletions(-)
    
    diff --git a/build.gradle b/build.gradle
    index a84237fa..4e14729d 100644
    --- a/build.gradle
    +++ b/build.gradle
    @@ -1,13 +1,12 @@
     plugins {
    -	id 'fabric-loom' version '1.9-SNAPSHOT'
    -	id 'io.github.juuxel.loom-quiltflower' version '1.7.3'
    +	id 'fabric-loom' version '1.11-SNAPSHOT'
     	id 'maven-publish'
     }
     
    -sourceCompatibility = JavaVersion.VERSION_21
    -targetCompatibility = JavaVersion.VERSION_21
    +base {
    +	archivesName = project.archives_base_name
    +}
     
    -archivesBaseName = project.archives_base_name
     version = project.minecraft_version+'-'+project.mod_version+'+v'+new Date().format('yyMMdd')
     group = project.maven_group
     
    @@ -56,11 +55,14 @@ java {
     	// if it is present.
     	// If you remove this line, sources will not be generated.
     	withSourcesJar()
    +
    +	sourceCompatibility = JavaVersion.VERSION_21
    +	targetCompatibility = JavaVersion.VERSION_21
     }
     
     jar {
     	from("LICENSE") {
    -		rename { "${it}_${project.archivesBaseName}"}
    +		rename { "${it}_${project.archives_base_name}"}
     	}
     }
     
    diff --git a/gradle.properties b/gradle.properties
    index 2d38930c..a080a0a7 100644
    --- a/gradle.properties
    +++ b/gradle.properties
    @@ -1,5 +1,9 @@
     # Done to increase the memory available to gradle.
     org.gradle.jvmargs=-Xmx1G
    +org.gradle.parallel=true
    +
    +# IntelliJ IDEA is not yet fully compatible with configuration cache, see: https://github.com/FabricMC/fabric-loom/issues/1349
    +org.gradle.configuration-cache=false
     
     # Fabric Properties
     	# check https://fabricmc.net/develop/
    diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
    index 943f0cbfa754578e88a3dae77fce6e3dea56edbf..8bdaf60c75ab801e22807dde59e12a8735a34077 100644
    GIT binary patch
    literal 45457
    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 c82=K%QXLKFx%@O{wJjEi6Y56o#$)Bpeg literal 61574 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 ScNgau(U?ep-K_E5zy1%ZQTdPn diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 21d5e095..2e111328 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 65dcd68d..adff685a 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright © 2015-2021 the original authors. +# Copyright © 2015 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -83,10 +85,8 @@ done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -114,7 +114,6 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. @@ -133,10 +132,13 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. @@ -144,7 +146,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -152,7 +154,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -169,7 +171,6 @@ fi # For Cygwin or MSYS, switch paths to Windows format before running java if "$cygwin" || "$msys" ; then APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) JAVACMD=$( cygpath --unix "$JAVACMD" ) @@ -197,16 +198,19 @@ if "$cygwin" || "$msys" ; then done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" # Stop when "xargs" is not available. diff --git a/gradlew.bat b/gradlew.bat index 93e3f59f..c4bdd3ab 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,6 +13,8 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem @if "%DEBUG%"=="" @echo off @rem ########################################################################## @@ -43,11 +45,11 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -57,22 +59,21 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail :execute @rem Setup the command line -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* :end @rem End local scope for the variables with windows NT shell From 6654b5399c201adf2f0319c88935040fae97dfd2 Mon Sep 17 00:00:00 2001 From: Crystal0404 Date: Tue, 14 Oct 2025 18:25:45 +0800 Subject: [PATCH 139/232] place the player before loading the data --- .../java/carpet/patches/EntityPlayerMPFake.java | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/main/java/carpet/patches/EntityPlayerMPFake.java b/src/main/java/carpet/patches/EntityPlayerMPFake.java index 72714a5f..21c5aa47 100644 --- a/src/main/java/carpet/patches/EntityPlayerMPFake.java +++ b/src/main/java/carpet/patches/EntityPlayerMPFake.java @@ -2,11 +2,8 @@ package carpet.patches; import carpet.CarpetSettings; import com.mojang.authlib.GameProfile; -import com.mojang.authlib.properties.PropertyMap; import net.minecraft.core.BlockPos; import net.minecraft.core.UUIDUtil; -import net.minecraft.core.component.DataComponents; -import net.minecraft.nbt.CompoundTag; import net.minecraft.network.DisconnectionDetails; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.contents.TranslatableContents; @@ -22,8 +19,6 @@ import net.minecraft.server.level.ClientInformation; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.network.CommonListenerCookie; -import net.minecraft.server.players.CachedUserNameToIdResolver; -import net.minecraft.server.players.NameAndId; import net.minecraft.server.players.OldUsersConverter; import net.minecraft.util.ProblemReporter; import net.minecraft.world.damagesource.DamageSource; @@ -36,7 +31,6 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.component.ResolvableProfile; import net.minecraft.world.level.GameType; import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.entity.SkullBlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.portal.TeleportTransition; import net.minecraft.world.level.storage.TagValueInput; @@ -104,9 +98,10 @@ public class EntityPlayerMPFake extends ServerPlayer } EntityPlayerMPFake instance = new EntityPlayerMPFake(server, worldIn, current, ClientInformation.createDefault(), false); - loadPlayerData(instance); instance.fixStartingPosition = () -> instance.snapTo(pos.x, pos.y, pos.z, (float) yaw, (float) pitch); server.getPlayerList().placeNewPlayer(new FakeClientConnection(PacketFlow.SERVERBOUND), instance, new CommonListenerCookie(current, 0, instance.clientInformation(), false)); + loadPlayerData(instance); + instance.stopRiding(); // otherwise the created fake player will be on the vehicle instance.teleportTo(worldIn, pos.x, pos.y, pos.z, Set.of(), (float) yaw, (float) pitch, true); instance.setHealth(20.0F); instance.unsetRemoved(); @@ -132,7 +127,7 @@ public class EntityPlayerMPFake extends ServerPlayer { Optional optional = player.level().getServer().getPlayerList().loadPlayerData(player.nameAndId()).map((compoundTag) -> TagValueInput.create(scopedCollector, player.registryAccess(), compoundTag)); optional.ifPresent( valueInput -> { - player.readAdditionalSaveData(valueInput); + player.load(valueInput); player.loadAndSpawnEnderPearls(valueInput); player.loadAndSpawnParentVehicle(valueInput); }); @@ -147,8 +142,8 @@ public class EntityPlayerMPFake extends ServerPlayer GameProfile gameprofile = player.getGameProfile(); EntityPlayerMPFake playerShadow = new EntityPlayerMPFake(server, worldIn, gameprofile, player.clientInformation(), true); playerShadow.setChatSession(player.getChatSession()); - loadPlayerData(playerShadow); server.getPlayerList().placeNewPlayer(new FakeClientConnection(PacketFlow.SERVERBOUND), playerShadow, new CommonListenerCookie(gameprofile, 0, player.clientInformation(), true)); + loadPlayerData(playerShadow); playerShadow.setHealth(player.getHealth()); playerShadow.connection.teleport(player.getX(), player.getY(), player.getZ(), player.getYRot(), player.getXRot()); @@ -179,7 +174,7 @@ public class EntityPlayerMPFake extends ServerPlayer private EntityPlayerMPFake(MinecraftServer server, ServerLevel worldIn, GameProfile profile, ClientInformation cli, boolean shadow) { super(server, worldIn, profile, cli); - isAShadow = shadow; + this.isAShadow = shadow; } @Override From 005faee61283980e979f1c8a79c7097ef1642ca7 Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 15 Oct 2025 03:39:12 +0200 Subject: [PATCH 140/232] cleanup and some preliminary tests --- .../carpet/script/CarpetScriptServer.java | 1 + .../carpet/script/utils/ShapesRenderer.java | 24 +++++++-------- .../resources/assets/carpet/scripts/sctest.sc | 30 +++++++++++++++++++ 3 files changed, 41 insertions(+), 14 deletions(-) create mode 100644 src/main/resources/assets/carpet/scripts/sctest.sc diff --git a/src/main/java/carpet/script/CarpetScriptServer.java b/src/main/java/carpet/script/CarpetScriptServer.java index 6b79c557..d3382518 100644 --- a/src/main/java/carpet/script/CarpetScriptServer.java +++ b/src/main/java/carpet/script/CarpetScriptServer.java @@ -104,6 +104,7 @@ public class CarpetScriptServer extends ScriptServer registerBuiltInApp(Module.carpetNative("ai_tracker", false)); registerBuiltInApp(Module.carpetNative("draw_beta", false)); registerBuiltInApp(Module.carpetNative("shapes", true)); + //registerBuiltInApp(Module.carpetNative("sctest", false)); registerBuiltInApp(Module.carpetNative("distance_beta", false)); } diff --git a/src/main/java/carpet/script/utils/ShapesRenderer.java b/src/main/java/carpet/script/utils/ShapesRenderer.java index a322b869..ad9a2b13 100644 --- a/src/main/java/carpet/script/utils/ShapesRenderer.java +++ b/src/main/java/carpet/script/utils/ShapesRenderer.java @@ -166,7 +166,7 @@ public class ShapesRenderer shapes.get(dimensionType).values().forEach(s -> { if ((!s.shape.debug || entityBoxes) && s.shouldRender(dimensionType)) { - s.renderLines(matrices, tesselator, cameraX, cameraY, cameraZ, partialTick, cameraa, s.shape.seethrough ? onTop : normal); + s.renderLines(matrices, cameraX, cameraY, cameraZ, partialTick, cameraa, s.shape.seethrough ? onTop : normal); } }); // faces @@ -188,7 +188,7 @@ public class ShapesRenderer labels.get(dimensionType).values().forEach(s -> { if ((!s.shape.debug || entityBoxes) && s.shouldRender(dimensionType)) { - s.renderLines(matrices, tesselator, cameraX, cameraY, cameraZ, partialTick, cameraa, s.shape.seethrough ? onTop : normal); + s.renderLines(matrices, cameraX, cameraY, cameraZ, partialTick, cameraa, s.shape.seethrough ? onTop : normal); } }); } @@ -283,7 +283,7 @@ public class ShapesRenderer long expiryTick; double renderEpsilon; - public abstract void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState, DrawableGizmoPrimitives primitives); + public abstract void renderLines(PoseStack matrices, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState, DrawableGizmoPrimitives primitives); public void renderFaces(Tesselator tesselator, double cx, double cy, double cz, float partialTick, DrawableGizmoPrimitives primitives) { @@ -356,7 +356,7 @@ public class ShapesRenderer } @Override - public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy, + public void renderLines(PoseStack matrices, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState, DrawableGizmoPrimitives primitives) { if (shape.a == 0.0) @@ -400,10 +400,6 @@ public class ShapesRenderer matrices.mulPose(Axis.YP.rotationDegrees(180)); } - ////RenderSystem.depthMask(true); - ////RenderSystem.enableCull(); - ////RenderSystem.enableDepthTest(); - blockPos = BlockPos.containing(v1); int light = 0; if (client.level != null) @@ -513,7 +509,7 @@ public class ShapesRenderer } @Override - public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState, DrawableGizmoPrimitives primitives) + public void renderLines(PoseStack matrices, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState, DrawableGizmoPrimitives primitives) { if (shape.a == 0.0) { @@ -602,7 +598,7 @@ public class ShapesRenderer } @Override - public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState, DrawableGizmoPrimitives primitives) + public void renderLines(PoseStack matrices, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState, DrawableGizmoPrimitives primitives) { if (shape.a == 0.0) { @@ -646,7 +642,7 @@ public class ShapesRenderer } @Override - public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState, DrawableGizmoPrimitives primitives) + public void renderLines(PoseStack matrices, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState, DrawableGizmoPrimitives primitives) { Vec3 v1 = shape.relativiseRender(client.level, shape.from, partialTick); Vec3 v2 = shape.relativiseRender(client.level, shape.to, partialTick); @@ -717,7 +713,7 @@ public class ShapesRenderer } @Override - public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy, + public void renderLines(PoseStack matrices, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState, DrawableGizmoPrimitives primitives) { if (shape.a == 0) @@ -853,7 +849,7 @@ public class ShapesRenderer } @Override - public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState, DrawableGizmoPrimitives primitives) + public void renderLines(PoseStack matrices, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState, DrawableGizmoPrimitives primitives) { if (shape.a == 0.0) { @@ -889,7 +885,7 @@ public class ShapesRenderer } @Override - public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState, DrawableGizmoPrimitives primitives) + public void renderLines(PoseStack matrices, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState, DrawableGizmoPrimitives primitives) { if (shape.a == 0.0) { diff --git a/src/main/resources/assets/carpet/scripts/sctest.sc b/src/main/resources/assets/carpet/scripts/sctest.sc new file mode 100644 index 00000000..0647a068 --- /dev/null +++ b/src/main/resources/assets/carpet/scripts/sctest.sc @@ -0,0 +1,30 @@ +__config() -> { + 'commands' -> { + 'shapes ' -> 'test_shapes' + }, + 'arguments' -> { + 'duration' -> {'type' -> 'int', 'min' -> 0, 'max' -> 1000, 'suggest' -> [100]}, + } +}; + + +test_shapes(duration) -> ( + [x, y, z] = pos(player()); + set(x, y, z, 'glass'); + set(x+10, y+10, z+10, 'glass'); + schedule(duration, _(outer(x), outer(y), outer(z)) -> ( + set(x, y, z, 'air'); + set(x+10, y+10, z+10, 'air'); + )); + loop(10, + draw_shape('line', duration, 'from', [x, y, z], 'to', [x+_, y+10, z+10], 'color', 0xff0000ff); + draw_shape('line', duration, 'from', [x, y, z], 'to', [x+10, y+_, z+10], 'color', 0x00ff00ff); + draw_shape('line', duration, 'from', [x, y, z], 'to', [x+10, y+10, z+_], 'color', 0x0000ffff); + ); + loop(20, + sq = _ * _ / 10; + draw_shape('box', duration, 'from', [x+_, y + sq, z], 'to', [x+_ + 2, y+sq + 2, z+2], 'color', 0xff0000ff, 'fill', 0xff000080); + draw_shape('box', duration, 'from', [x, y + _, z + sq], 'to', [x+2, y+_ + 2, z+sq + 2], 'color', 0x00ff00ff, 'fill', 0x00ff0080); + draw_shape('box', duration, 'from', [x + sq, y, z + _], 'to', [x+sq + 2, y+2, z+_ + 2], 'color', 0x0000ffff, 'fill', 0x0000ff80); + ); +); \ No newline at end of file From 0b2ffaca95842f7e0b7c7146d95aea941f476901 Mon Sep 17 00:00:00 2001 From: gnembon Date: Thu, 16 Oct 2025 16:27:50 +0200 Subject: [PATCH 141/232] 25w42a --- gradle.properties | 2 +- .../carpet/mixins/LevelRenderer_fogOffMixin.java | 12 ++++++------ src/main/java/carpet/script/utils/BiomeInfo.java | 13 ++++++++++--- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/gradle.properties b/gradle.properties index a080a0a7..e73d8cda 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ org.gradle.configuration-cache=false # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=25w41a + minecraft_version=25w42a loader_version=0.17.3 jsr305_version=3.0.2 fabric_version=0.134.0+1.21.9 diff --git a/src/main/java/carpet/mixins/LevelRenderer_fogOffMixin.java b/src/main/java/carpet/mixins/LevelRenderer_fogOffMixin.java index 963cb918..8a22e8a7 100644 --- a/src/main/java/carpet/mixins/LevelRenderer_fogOffMixin.java +++ b/src/main/java/carpet/mixins/LevelRenderer_fogOffMixin.java @@ -1,10 +1,10 @@ package carpet.mixins; import carpet.CarpetSettings; -import net.minecraft.client.renderer.DimensionSpecialEffects; import net.minecraft.client.renderer.GameRenderer; -import net.minecraft.client.renderer.LevelRenderer; //import net.minecraft.world.dimension.Dimension; +import net.minecraft.world.attribute.EnvironmentAttribute; +import net.minecraft.world.attribute.EnvironmentAttributeProbe; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; @@ -14,12 +14,12 @@ public class LevelRenderer_fogOffMixin { @Redirect(method = "renderLevel", require = 0, expect = 0, at = @At( value = "INVOKE", - target = "Lnet/minecraft/client/renderer/DimensionSpecialEffects;isFoggyAt(II)Z" + target = "Lnet/minecraft/world/attribute/EnvironmentAttributeProbe;getValue(Lnet/minecraft/world/attribute/EnvironmentAttribute;F)Ljava/lang/Object;" )) - private boolean isReallyThick(DimensionSpecialEffects skyProperties, int x, int z) + private Value isReallyThick(EnvironmentAttributeProbe instance, EnvironmentAttribute environmentAttribute, float f) { - if (CarpetSettings.fogOff) return false; - return skyProperties.isFoggyAt(x, z); + if (CarpetSettings.fogOff) return (Value) Boolean.FALSE; + return instance.getValue(environmentAttribute, f); } } diff --git a/src/main/java/carpet/script/utils/BiomeInfo.java b/src/main/java/carpet/script/utils/BiomeInfo.java index aa8c39cd..5cbb2444 100644 --- a/src/main/java/carpet/script/utils/BiomeInfo.java +++ b/src/main/java/carpet/script/utils/BiomeInfo.java @@ -16,6 +16,8 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Registry; import net.minecraft.core.registries.Registries; import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.attribute.EnvironmentAttribute; +import net.minecraft.world.attribute.EnvironmentAttributes; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; @@ -25,11 +27,12 @@ public class BiomeInfo {{ put("tags", (w, b) -> ListValue.wrap(w.registryAccess().lookupOrThrow(Registries.BIOME).getTags().filter(p -> p.stream().anyMatch(h -> h.value() == b)).map(ValueConversions::of))); put("temperature", (w, b) -> NumericValue.of(b.getBaseTemperature())); - put("fog_color", (w, b) -> ValueConversions.ofRGB(b.getSpecialEffects().getFogColor())); + // todo add per postion query for environmental attributes as well + put("fog_color", (w, b) -> fromEnvironmentalAttribute(w, b, EnvironmentAttributes.FOG_COLOR)); put("foliage_color", (w, b) -> ValueConversions.ofRGB(b.getSpecialEffects().getFoliageColorOverride().orElse(4764952))); // client Biome.getDefaultFoliageColor - put("sky_color", (w, b) -> ValueConversions.ofRGB(b.getSpecialEffects().getSkyColor())); + put("sky_color", (w, b) -> fromEnvironmentalAttribute(w, b, EnvironmentAttributes.SKY_COLOR)); put("water_color", (w, b) -> ValueConversions.ofRGB(b.getSpecialEffects().getWaterColor())); - put("water_fog_color", (w, b) -> ValueConversions.ofRGB(b.getSpecialEffects().getWaterFogColor())); + put("water_fog_color", (w, b) -> fromEnvironmentalAttribute(w, b, EnvironmentAttributes.WATER_FOG_COLOR)); put("humidity", (w, b) -> NumericValue.of(Vanilla.Biome_getClimateSettings(b).downfall())); put("precipitation", (w, b) -> StringValue.of(b.getPrecipitationAt(new BlockPos(0, w.getSeaLevel(), 0), w.getSeaLevel()).name().toLowerCase(Locale.ROOT))); put("features", (w, b) -> { @@ -43,4 +46,8 @@ public class BiomeInfo ); }); }}; + + private static Value fromEnvironmentalAttribute(ServerLevel w, Biome b, EnvironmentAttribute fogColor) { + return ValueConversions.ofRGB(b.getAttributes().applyModifier(fogColor, w.dimensionType().attributes().applyModifier(fogColor, fogColor.defaultValue()))); + } } From c67fc3c3f8c765e61329c8a0b48fd5f46385b257 Mon Sep 17 00:00:00 2001 From: gnembon Date: Thu, 16 Oct 2025 16:28:54 +0200 Subject: [PATCH 142/232] 1.4.188 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index e73d8cda..62300df9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ org.gradle.configuration-cache=false fabric_version=0.134.0+1.21.9 # Mod Properties - mod_version = 1.4.187 + mod_version = 1.4.188 maven_group = carpet archives_base_name = fabric-carpet From 885113ff94629c98011b6cbf0ea3bdbd1adf52b7 Mon Sep 17 00:00:00 2001 From: gnembon Date: Thu, 16 Oct 2025 16:55:45 +0200 Subject: [PATCH 143/232] custom build for 1.21.10 --- gradle.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index 62300df9..17957203 100644 --- a/gradle.properties +++ b/gradle.properties @@ -23,10 +23,10 @@ org.gradle.configuration-cache=false # Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN] release-curse-versions = Minecraft 1.21:1.21.11-Snapshot # Whether or not to build another branch on release - release-extra-branch = false + release-extra-branch = true # The name of the second branch to release - release-extra-branch-name = 1.20.4 + release-extra-branch-name = 1.21.10 # The "name" or id of the Curseforge version for the secondary branch # This is needed because CF uses too vague names for snapshots # Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN] - release-extra-curse-version = Minecraft 1.20:1.20.4-Snapshot + release-extra-curse-version = Minecraft 1.20:1.20.10 From 983d8658f9252f817de8c3a1edfd7d52a6134675 Mon Sep 17 00:00:00 2001 From: gnembon Date: Thu, 16 Oct 2025 17:10:43 +0200 Subject: [PATCH 144/232] revert --- gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 17957203..619ac2c3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -23,10 +23,10 @@ org.gradle.configuration-cache=false # Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN] release-curse-versions = Minecraft 1.21:1.21.11-Snapshot # Whether or not to build another branch on release - release-extra-branch = true + release-extra-branch = false # The name of the second branch to release release-extra-branch-name = 1.21.10 # The "name" or id of the Curseforge version for the secondary branch # This is needed because CF uses too vague names for snapshots # Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN] - release-extra-curse-version = Minecraft 1.20:1.20.10 + release-extra-curse-version = Minecraft 1.21:1.21.10 From f12ce6246030040f56974d3ecbea33e43674a78d Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 22 Oct 2025 10:03:35 +0200 Subject: [PATCH 145/232] 25w43a --- gradle.properties | 2 +- src/main/java/carpet/CarpetSettings.java | 42 ----- .../LevelRenderer_scarpetRenderMixin.java | 15 +- .../WorldBorder_syncedWorldBorderMixin.java | 25 --- .../patches/TickSyncedBorderExtent.java | 170 ------------------ .../carpet/script/utils/ShapesRenderer.java | 104 +++++++---- .../resources/assets/carpet/scripts/sctest.sc | 12 +- src/main/resources/carpet.mixins.json | 1 - 8 files changed, 92 insertions(+), 279 deletions(-) delete mode 100644 src/main/java/carpet/mixins/WorldBorder_syncedWorldBorderMixin.java delete mode 100644 src/main/java/carpet/patches/TickSyncedBorderExtent.java diff --git a/gradle.properties b/gradle.properties index 619ac2c3..2c15fc81 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ org.gradle.configuration-cache=false # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=25w42a + minecraft_version=25w43a loader_version=0.17.3 jsr305_version=3.0.2 fabric_version=0.134.0+1.21.9 diff --git a/src/main/java/carpet/CarpetSettings.java b/src/main/java/carpet/CarpetSettings.java index 34fc202a..a2d55ebd 100644 --- a/src/main/java/carpet/CarpetSettings.java +++ b/src/main/java/carpet/CarpetSettings.java @@ -1011,48 +1011,6 @@ public class CarpetSettings ) public static int sculkSensorRange = 8; - /** - * Listener, we need to update world borders to change whether - * they are currently moving in real time or in game time. - */ - private static class WorldBorderValidator extends Validator - { - @Override - public Boolean validate(CommandSourceStack source, CarpetRule changingRule, Boolean newValue, String userInput) - { - if (changingRule.value() ^ newValue) - { - // Needed for the update - tickSyncedWorldBorders = newValue; - MinecraftServer server = CarpetServer.minecraft_server; - if (server == null) - { - return newValue; - } - for (ServerLevel level : server.getAllLevels()) - { - WorldBorder worldBorder = level.getWorldBorder(); - if (worldBorder.getStatus() != BorderStatus.STATIONARY) - { - double from = worldBorder.getSize(); - double to = worldBorder.getLerpTarget(); - long time = worldBorder.getLerpTime(); - worldBorder.lerpSizeBetween(from, to, time); - } - } - } - return newValue; - } - } - - @Rule( - desc = "Makes world borders move based on in game time instead of real time", - extra = "This has the effect that when the tick rate changes the world border speed also changes proportional to it", - category = FEATURE, - validate = WorldBorderValidator.class - ) - public static boolean tickSyncedWorldBorders = false; - public enum FungusGrowthMode { FALSE, RANDOM, ALL; } diff --git a/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java b/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java index b6fa65b8..6b086080 100644 --- a/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java +++ b/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java @@ -2,9 +2,11 @@ package carpet.mixins; import carpet.network.CarpetClient; import carpet.script.utils.ShapesRenderer; +import com.llamalad7.mixinextras.sugar.Local; import com.mojang.blaze3d.buffers.GpuBufferSlice; import com.mojang.blaze3d.framegraph.FrameGraphBuilder; import com.mojang.blaze3d.framegraph.FramePass; +import com.mojang.blaze3d.resource.GraphicsResourceAllocator; import net.minecraft.client.Camera; import net.minecraft.client.DeltaTracker; import net.minecraft.client.Minecraft; @@ -12,12 +14,11 @@ import net.minecraft.client.renderer.LevelRenderer; import net.minecraft.client.renderer.LevelTargetBundle; import net.minecraft.client.renderer.RenderBuffers; import net.minecraft.client.renderer.blockentity.BlockEntityRenderDispatcher; -import net.minecraft.client.renderer.culling.Frustum; import net.minecraft.client.renderer.entity.EntityRenderDispatcher; import net.minecraft.client.renderer.feature.FeatureRenderDispatcher; import net.minecraft.client.renderer.state.LevelRenderState; -import net.minecraft.util.profiling.ProfilerFiller; import org.joml.Matrix4f; +import org.joml.Vector4f; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -34,14 +35,20 @@ public class LevelRenderer_scarpetRenderMixin @Shadow @Final private RenderBuffers renderBuffers; + @Shadow @Final private LevelRenderState levelRenderState; + @Inject(method = "", at = @At("RETURN")) private void addRenderers(Minecraft minecraft, EntityRenderDispatcher entityRenderDispatcher, BlockEntityRenderDispatcher blockEntityRenderDispatcher, RenderBuffers renderBuffers, LevelRenderState levelRenderState, FeatureRenderDispatcher featureRenderDispatcher, CallbackInfo ci) { CarpetClient.shapes = new ShapesRenderer(minecraft); } - @Inject(method = "addMainPass", at = @At("RETURN")) - private void renderScarpetThingsLate(FrameGraphBuilder frameGraphBuilder, Frustum frustum, Matrix4f matrix4f, GpuBufferSlice gpuBufferSlice, boolean bl, LevelRenderState levelRenderState, DeltaTracker deltaTracker, ProfilerFiller profilerFiller, CallbackInfo ci) + @Inject(method = "renderLevel", at = @At( + value = "INVOKE", + target = "Lnet/minecraft/client/renderer/LevelRenderer;addLateDebugPass(Lcom/mojang/blaze3d/framegraph/FrameGraphBuilder;Lnet/minecraft/client/renderer/state/CameraRenderState;Lcom/mojang/blaze3d/buffers/GpuBufferSlice;Lorg/joml/Matrix4f;)V", + shift = At.Shift.AFTER + )) + private void renderStarpetThingsLate(GraphicsResourceAllocator graphicsResourceAllocator, DeltaTracker deltaTracker, boolean bl, Camera camera, Matrix4f matrix4f, Matrix4f arg5, Matrix4f matrix4f3, GpuBufferSlice gpuBufferSlice, Vector4f vector4f, boolean bl2, CallbackInfo ci, @Local FrameGraphBuilder frameGraphBuilder) { // in normal circumstances we want to render shapes at the very end so it appears correctly behind stuff. // we might actually not need to play with render hooks here. diff --git a/src/main/java/carpet/mixins/WorldBorder_syncedWorldBorderMixin.java b/src/main/java/carpet/mixins/WorldBorder_syncedWorldBorderMixin.java deleted file mode 100644 index 1ab8fcba..00000000 --- a/src/main/java/carpet/mixins/WorldBorder_syncedWorldBorderMixin.java +++ /dev/null @@ -1,25 +0,0 @@ -package carpet.mixins; - -import carpet.CarpetSettings; -import carpet.patches.TickSyncedBorderExtent; -import net.minecraft.world.level.border.WorldBorder; -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.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(WorldBorder.class) -public class WorldBorder_syncedWorldBorderMixin -{ - @Shadow private WorldBorder.BorderExtent extent; - - @Inject(method = "lerpSizeBetween", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/border/WorldBorder;getListeners()Ljava/util/List;")) - private void getExtent(double d, double e, long l, CallbackInfo ci) - { - if (d != e && CarpetSettings.tickSyncedWorldBorders) - { - this.extent = new TickSyncedBorderExtent((WorldBorder) (Object) this, l, d, e); - } - } -} diff --git a/src/main/java/carpet/patches/TickSyncedBorderExtent.java b/src/main/java/carpet/patches/TickSyncedBorderExtent.java deleted file mode 100644 index ea90f8c6..00000000 --- a/src/main/java/carpet/patches/TickSyncedBorderExtent.java +++ /dev/null @@ -1,170 +0,0 @@ -package carpet.patches; - -import carpet.CarpetServer; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.ServerTickRateManager; -import net.minecraft.util.Mth; -import net.minecraft.util.TimeUtil; -import net.minecraft.world.level.border.BorderChangeListener; -import net.minecraft.world.level.border.BorderStatus; -import net.minecraft.world.level.border.WorldBorder; -import net.minecraft.world.phys.shapes.BooleanOp; -import net.minecraft.world.phys.shapes.Shapes; -import net.minecraft.world.phys.shapes.VoxelShape; -import org.jetbrains.annotations.NotNull; - -/** - * This class is essentially a copy of {@link net.minecraft.world.level.border.WorldBorder.MovingBorderExtent} - * but instead of using real time to lerp the border - * this class uses the in game ticks. - */ -@SuppressWarnings("JavadocReference") -public class TickSyncedBorderExtent implements WorldBorder.BorderExtent -{ - private final WorldBorder border; - private final long realDuration; - private final double tickDuration; - private final double from; - private final double to; - - private int ticks; - - public TickSyncedBorderExtent(WorldBorder border, long realDuration, double from, double to) - { - this.border = border; - this.realDuration = realDuration; - this.tickDuration = realDuration / 50.0; - this.from = from; - this.to = to; - this.ticks = 0; - } - - @Override - public double getMinX() - { - int maxSize = this.border.getAbsoluteMaxSize(); - return Mth.clamp(this.border.getCenterX() - this.getSize() / 2.0, -maxSize, maxSize); - } - - @Override - public double getMaxX() - { - int maxSize = this.border.getAbsoluteMaxSize(); - return Mth.clamp(this.border.getCenterX() + this.getSize() / 2.0, -maxSize, maxSize); - } - - @Override - public double getMinZ() - { - int maxSize = this.border.getAbsoluteMaxSize(); - return Mth.clamp(this.border.getCenterZ() - this.getSize() / 2.0, -maxSize, maxSize); - } - - @Override - public double getMaxZ() - { - int maxSize = this.border.getAbsoluteMaxSize(); - return Mth.clamp(this.border.getCenterZ() + this.getSize() / 2.0, -maxSize, maxSize); - } - - @Override - public double getSize() - { - double progress = this.ticks / this.tickDuration; - return progress < 1.0 ? Mth.lerp(progress, this.from, this.to) : this.to; - } - - @Override - public double getLerpSpeed() - { - return Math.abs(this.from - this.to) / this.realDuration; - } - - @Override - public long getLerpTime() - { - // Rough estimation - MinecraftServer server = CarpetServer.minecraft_server; - double ms; - if (server == null) - { - // can this even happen? - ms = 50.0; - } - else - { - ms = ((double)server.getAverageTickTimeNanos())/ TimeUtil.NANOSECONDS_PER_MILLISECOND; - ServerTickRateManager trm = server.tickRateManager(); - if (!trm.isSprinting()) - { - ms = Math.max(ms, trm.millisecondsPerTick()); - } - } - double tps = 1_000.0D / ms; - return (long) ((this.tickDuration - this.ticks) / tps * 1_000); - } - - @Override - public double getLerpTarget() - { - return this.to; - } - - @NotNull - @Override - public BorderStatus getStatus() - { - return this.to < this.from ? BorderStatus.SHRINKING : BorderStatus.GROWING; - } - - @Override - public void onAbsoluteMaxSizeChange() - { - - } - - @Override - public void onCenterChange() - { - - } - - @NotNull - @Override - public WorldBorder.BorderExtent update() - { - if (this.ticks++ % 20 == 0) - { - // We need to update any listeners - // Most importantly those that send updates to the client - // This is because the client logic uses real time - // So if the tick speed has changed we need to tell the client - for (BorderChangeListener listener : this.border.getListeners()) - { - // We do not want to update DelegateBorderChangeListener - // This updates borders in other dimensions - listener.onLerpSize(this.border, this.from, this.to, this.realDuration); - } - } - - return this.ticks >= this.tickDuration ? this.border.new StaticBorderExtent(this.to) : this; - } - - @NotNull - @Override - public VoxelShape getCollisionShape() - { - return Shapes.join( - Shapes.INFINITY, - Shapes.box( - Math.floor(this.getMinX()), - Double.NEGATIVE_INFINITY, - Math.floor(this.getMinZ()), - Math.ceil(this.getMaxX()), - Double.POSITIVE_INFINITY, - Math.ceil(this.getMaxZ()) - ), - BooleanOp.ONLY_FIRST - ); - } -} diff --git a/src/main/java/carpet/script/utils/ShapesRenderer.java b/src/main/java/carpet/script/utils/ShapesRenderer.java index ad9a2b13..8f913d7f 100644 --- a/src/main/java/carpet/script/utils/ShapesRenderer.java +++ b/src/main/java/carpet/script/utils/ShapesRenderer.java @@ -17,6 +17,7 @@ import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; import java.util.HashMap; import java.util.Locale; import java.util.Map; +import java.util.Random; import java.util.function.BiFunction; import net.minecraft.client.Camera; @@ -28,12 +29,13 @@ import net.minecraft.client.renderer.ItemBlockRenderTypes; import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderBuffers; -import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.rendertype.RenderType; import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; import net.minecraft.client.renderer.blockentity.state.BlockEntityRenderState; import net.minecraft.client.renderer.entity.state.EntityRenderState; import net.minecraft.client.renderer.gizmos.DrawableGizmoPrimitives; import net.minecraft.client.renderer.item.ItemStackRenderState; +import net.minecraft.client.renderer.rendertype.RenderTypes; import net.minecraft.client.renderer.state.LevelRenderState; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.core.BlockPos; @@ -428,7 +430,7 @@ public class ShapesRenderer float blue = (color & 0xFF) / 255.0F; RenderType type; if (blockState.getBlock() instanceof LeavesBlock && !Minecraft.getInstance().options.cutoutLeaves().get()) { - type = RenderType.solid(); + type = RenderTypes.solid(); } else { type = ItemBlockRenderTypes.getRenderType(blockState); } @@ -661,14 +663,14 @@ public class ShapesRenderer Mode.LINES, Mode.LINES, Mode.DEBUG_LINES, Mode.DEBUG_LINE_STRIP, Mode.TRIANGLES, Mode.TRIANGLE_STRIP, Mode.TRIANGLE_FAN, Mode.QUADS}; private static final RenderType [] renderTypes = new RenderType[] { - RenderType.lines(), - RenderType.lines(), - RenderType.lines(), - RenderType.lines(), - RenderType.debugTriangleFan(), // TODO wrong - RenderType.debugTriangleFan(), // TODO wrong - RenderType.debugTriangleFan(), - RenderType.debugQuads() + RenderTypes.lines(), + RenderTypes.lines(), + RenderTypes.lines(), + RenderTypes.lines(), + RenderTypes.debugTriangleFan(), // TODO wrong + RenderTypes.debugTriangleFan(), // TODO wrong + RenderTypes.debugTriangleFan(), + RenderTypes.debugQuads() }; public RenderedPolyface(Minecraft client, ShapeDispatcher.ExpiringShape shape) @@ -957,32 +959,46 @@ public class ShapesRenderer boolean xthick, boolean ythick, boolean zthick, int argb) { + Vec3 v111 = new Vec3(x1, y1, z1); + Vec3 v211 = new Vec3(x2, y1, z1); + Vec3 v221 = new Vec3(x2, y2, z1); + Vec3 v121 = new Vec3(x1, y2, z1); + Vec3 v112 = new Vec3(x1, y1, z2); + Vec3 v122 = new Vec3(x1, y2, z2); + Vec3 v222 = new Vec3(x2, y2, z2); + Vec3 v212 = new Vec3(x2, y1, z2); if (xthick && ythick) { - primitives.addQuad(new Vec3(x1, y1, z1), new Vec3(x2, y1, z1), new Vec3(x2, y2, z1), new Vec3(x1, y2, z1), argb); + primitives.addQuad(v111, v211, v221, v121, argb); + primitives.addQuad(v111, v121, v221, v211, argb); if (zthick) { - primitives.addQuad(new Vec3(x1, y1, z2), new Vec3(x1, y2, z2), new Vec3(x2, y2, z2), new Vec3(x2, y1, z2), argb); + primitives.addQuad(v112, v122, v222, v212, argb); + primitives.addQuad(v112, v212, v222, v122, argb); } } if (zthick && ythick) { - primitives.addQuad(new Vec3(x1, y1, z1), new Vec3(x1, y2, z1), new Vec3(x1, y2, z2), new Vec3(x1, y1, z2), argb); + primitives.addQuad(v111, v121, v122, v112, argb); + primitives.addQuad(v111, v112, v122, v121, argb); if (xthick) { - primitives.addQuad(new Vec3(x2, y1, z1), new Vec3(x2, y1, z2), new Vec3(x2, y2, z2), new Vec3(x2, y2, z1), argb); + primitives.addQuad(v211, v212, v222, v221, argb); + primitives.addQuad(v211, v221, v222, v212, argb); } } // now at least drawing one if (zthick && xthick) { - primitives.addQuad(new Vec3(x1, y1, z1), new Vec3(x2, y1, z1), new Vec3(x2, y1, z2), new Vec3(x1, y1, z2), argb); + primitives.addQuad(v111, v211, v212, v112, argb); + primitives.addQuad(v111, v112, v212, v211, argb); if (ythick) { - primitives.addQuad(new Vec3(x1, y2, z1), new Vec3(x1, y2, z2), new Vec3(x2, y2, z2), new Vec3(x2, y2, z1), argb); + primitives.addQuad(v121, v122, v222, v221, argb); + primitives.addQuad(v121, v221, v222, v122, argb); } } } @@ -1174,6 +1190,7 @@ public class ShapesRenderer float z = r * Mth.sin(theta); points[i + 1] = new Vec3(x + cx, cy, z + cz); } + // for some reason triangle fans are double sided primitives.addTriangleFan(points, argb); } @@ -1188,19 +1205,25 @@ public class ShapesRenderer float z = r * Mth.sin(theta); points[i + 1] = new Vec3(x + cx, cy + h, z + cz); } + // for some reason triangle fans are double sided primitives.addTriangleFan(points, argb); float xp = r * 1; float zp = r * 0; + Vec3 previousBottom = new Vec3(cx + xp, cy + 0, cz + zp); + Vec3 previousTop = new Vec3(cx + xp, cy + h, cz + zp); for (int i = 1; i <= num_steps360; i++) { float theta = step * i; float x = r * Mth.cos(theta); float z = r * Mth.sin(theta); - primitives.addQuad(new Vec3(cx + xp, cy + 0, cz + zp), new Vec3(cx + xp, cy + h, cz + zp), - new Vec3(cx + x, cy + h, cz + z), new Vec3(cx - x, cy + h, cz + z), argb); - xp = x; - zp = z; + + Vec3 nextTop = new Vec3(cx + x, cy + h, cz + z); + Vec3 nextBottom = new Vec3(cx + x, cy + 0, cz + z); + primitives.addQuad(previousBottom, previousTop, nextTop, nextBottom, argb); + primitives.addQuad(previousBottom, nextBottom, nextTop, previousTop, argb); + previousTop = nextTop; + previousBottom = nextBottom; } } @@ -1235,16 +1258,20 @@ public class ShapesRenderer float yp = r * 1; float zp = r * 0; + Vec3 previousBottom = new Vec3(cx + 0, cy + yp, cz + zp); + Vec3 previousTop = new Vec3(cx + h, cy + yp, cz + zp); for (int i = 1; i <= num_steps360; i++) { float theta = step * i; float y = r * Mth.cos(theta); float z = r * Mth.sin(theta); - primitives.addQuad(new Vec3(cx + 0, cy + yp, cz + zp), new Vec3(cx + h, cy + yp, cz + zp), - new Vec3(cx + h, cy + y, cz + z), new Vec3(cx + 0, cy + y, cz + z), argb); - yp = y; - zp = z; + Vec3 nextTop = new Vec3(cx + h, cy + y, cz + z); + Vec3 nextBottom = new Vec3(cx + 0, cy + y, cz + z); + primitives.addQuad(previousBottom, previousTop, nextTop, nextBottom, argb); + primitives.addQuad(previousBottom, nextBottom, nextTop, previousTop, argb); + previousTop = nextTop; + previousBottom = nextBottom; } } } @@ -1276,20 +1303,32 @@ public class ShapesRenderer float xp = r; float yp = 0; + Vec3 previousBottom = new Vec3(cx + xp, cy + yp, cz + 0); + Vec3 previousTop = new Vec3(cx + xp, cy + yp, cz + h); for (int i = 1; i <= num_steps360; i++) { float theta = step * i; float x = r * Mth.cos(theta); float y = r * Mth.sin(theta); - primitives.addQuad(new Vec3(cx + xp, cy + yp, cz + 0), new Vec3(cx + xp, cy + yp, cz + h), - new Vec3(cx + x, cy + y, cz + h), new Vec3(cx + x, cy + y, cz + 0), argb); - xp = x; - yp = y; + + Vec3 nextTop = new Vec3(cx + x, cy + y, cz + h); + Vec3 nextBottom = new Vec3(cx + x, cy + y, cz + 0); + primitives.addQuad(previousBottom, previousTop, nextTop, nextBottom, argb); + primitives.addQuad(previousBottom, nextBottom, nextTop, previousTop, argb); + previousTop = nextTop; + previousBottom = nextBottom; } } } } + private static int shuffleColor(int argb) { + int a = 0xff000000 & argb; + argb = (new Random(argb)).nextInt(); + argb = (a) | (0x00ffffff & argb); + return argb; + } + public static void drawSphereWireframe(DrawableGizmoPrimitives primitives, float cx, float cy, float cz, float r, int subd, @@ -1363,8 +1402,13 @@ public class ShapesRenderer float xp = r * Mth.sin(phi) * Mth.cos(thetaprime); float zp = r * Mth.sin(phi) * Mth.sin(thetaprime); - primitives.addQuad(new Vec3(xb + cx, yp + cy, zb + cz), new Vec3(xbp + cx, yp + cy, zbp + cz), - new Vec3(xp + cx, y + cy, zp + cz), new Vec3(x + cx, y + cy, z + cz), argb); + Vec3 v1 = new Vec3(xb + cx, yp + cy, zb + cz); + Vec3 v2 = new Vec3(xbp + cx, yp + cy, zbp + cz); + Vec3 v3 = new Vec3(xp + cx, y + cy, zp + cz); + Vec3 v4 = new Vec3(x + cx, y + cy, z + cz); + + primitives.addQuad(v1, v2, v3, v4, argb); + primitives.addQuad(v1, v4, v3, v2, argb); xb = x; zb = z; diff --git a/src/main/resources/assets/carpet/scripts/sctest.sc b/src/main/resources/assets/carpet/scripts/sctest.sc index 0647a068..0527c74d 100644 --- a/src/main/resources/assets/carpet/scripts/sctest.sc +++ b/src/main/resources/assets/carpet/scripts/sctest.sc @@ -17,14 +17,14 @@ test_shapes(duration) -> ( set(x+10, y+10, z+10, 'air'); )); loop(10, - draw_shape('line', duration, 'from', [x, y, z], 'to', [x+_, y+10, z+10], 'color', 0xff0000ff); - draw_shape('line', duration, 'from', [x, y, z], 'to', [x+10, y+_, z+10], 'color', 0x00ff00ff); - draw_shape('line', duration, 'from', [x, y, z], 'to', [x+10, y+10, z+_], 'color', 0x0000ffff); + draw_shape('line', duration, 'from', [x, y, z], 'to', [x-_, y+10, z+10], 'color', 0xff0000ff); + draw_shape('line', duration, 'from', [x, y, z], 'to', [x-10, y+_, z+10], 'color', 0x00ff00ff); + draw_shape('line', duration, 'from', [x, y, z], 'to', [x-10, y+10, z+_], 'color', 0x0000ffff); ); loop(20, sq = _ * _ / 10; - draw_shape('box', duration, 'from', [x+_, y + sq, z], 'to', [x+_ + 2, y+sq + 2, z+2], 'color', 0xff0000ff, 'fill', 0xff000080); - draw_shape('box', duration, 'from', [x, y + _, z + sq], 'to', [x+2, y+_ + 2, z+sq + 2], 'color', 0x00ff00ff, 'fill', 0x00ff0080); - draw_shape('box', duration, 'from', [x + sq, y, z + _], 'to', [x+sq + 2, y+2, z+_ + 2], 'color', 0x0000ffff, 'fill', 0x0000ff80); + draw_shape('box', duration, 'from', [x+_, y + sq, z], 'to', [x+_ + 2, y+sq + 2, z+2], 'color', 0xff0000ff, 'fill', 0xff000030); + draw_shape('box', duration, 'from', [x, y + _, z + sq], 'to', [x+2, y+_ + 2, z+sq + 2], 'color', 0x00ff00ff, 'fill', 0x00ff0030); + draw_shape('box', duration, 'from', [x + sq, y, z + _], 'to', [x+sq + 2, y+2, z+_ + 2], 'color', 0x0000ffff, 'fill', 0x0000ff30); ); ); \ No newline at end of file diff --git a/src/main/resources/carpet.mixins.json b/src/main/resources/carpet.mixins.json index 5341d9b2..66b5f206 100644 --- a/src/main/resources/carpet.mixins.json +++ b/src/main/resources/carpet.mixins.json @@ -36,7 +36,6 @@ "ServerChunkCache_profilerMixin", "ChunkMap_profilerMixin", "ServerFunctionManager_profilerMixin", - "WorldBorder_syncedWorldBorderMixin", "ChunkMap_scarpetChunkCreationMixin", "LevelEntityGetterAdapter_scarpetMixin", "ChunkHolder_scarpetChunkCreationMixin", From b0ea03d1c3ce84479340e35c34768068331f95b2 Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 22 Oct 2025 10:14:29 +0200 Subject: [PATCH 146/232] 1.4.189 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 2c15fc81..01b53627 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ org.gradle.configuration-cache=false fabric_version=0.134.0+1.21.9 # Mod Properties - mod_version = 1.4.188 + mod_version = 1.4.189 maven_group = carpet archives_base_name = fabric-carpet From 461e64d34c90085a166c314737c4a8ec7534e73b Mon Sep 17 00:00:00 2001 From: gnembon Date: Tue, 28 Oct 2025 23:43:51 +0100 Subject: [PATCH 147/232] 25w44a --- gradle.properties | 2 +- .../java/carpet/mixins/Husk_templesMixin.java | 23 --------------- .../mixins/LivingEntity_cleanLogsMixin.java | 4 +-- .../LivingEntity_maxCollisionsMixin.java | 6 ++-- .../carpet/mixins/Monster_templesMixin.java | 28 +++++++++++++++++++ .../mixins/ServerLevel_scarpetMixin.java | 13 +++++---- .../mixins/SummonCommand_lightningMixin.java | 4 +-- .../java/carpet/script/ScriptCommand.java | 6 ++-- .../script/annotation/package-info.java | 9 ++---- .../java/carpet/script/api/package-info.java | 9 ++---- .../carpet/script/argument/package-info.java | 9 ++---- .../carpet/script/command/package-info.java | 9 ++---- .../carpet/script/exception/package-info.java | 9 ++---- .../carpet/script/external/package-info.java | 9 ++---- .../carpet/script/language/package-info.java | 9 ++---- src/main/java/carpet/script/package-info.java | 9 ++---- .../java/carpet/script/utils/BiomeInfo.java | 4 +-- .../java/carpet/script/utils/SystemInfo.java | 15 ++++++---- .../carpet/script/utils/package-info.java | 9 ++---- .../script/utils/shapes/package-info.java | 9 ++---- .../carpet/script/value/package-info.java | 9 ++---- src/main/resources/carpet.mixins.json | 2 +- 22 files changed, 81 insertions(+), 125 deletions(-) delete mode 100644 src/main/java/carpet/mixins/Husk_templesMixin.java create mode 100644 src/main/java/carpet/mixins/Monster_templesMixin.java diff --git a/gradle.properties b/gradle.properties index 01b53627..66485e13 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ org.gradle.configuration-cache=false # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=25w43a + minecraft_version=25w44a loader_version=0.17.3 jsr305_version=3.0.2 fabric_version=0.134.0+1.21.9 diff --git a/src/main/java/carpet/mixins/Husk_templesMixin.java b/src/main/java/carpet/mixins/Husk_templesMixin.java deleted file mode 100644 index 9877200d..00000000 --- a/src/main/java/carpet/mixins/Husk_templesMixin.java +++ /dev/null @@ -1,23 +0,0 @@ -package carpet.mixins; - -import carpet.CarpetSettings; -import carpet.utils.SpawnOverrides; -import net.minecraft.core.BlockPos; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.entity.monster.Husk; -import net.minecraft.world.level.ServerLevelAccessor; -import net.minecraft.world.level.levelgen.structure.BuiltinStructures; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; - -@Mixin(Husk.class) -public class Husk_templesMixin -{ - @Redirect(method = "checkHuskSpawnRules", at = @At(value = "INVOKE", target="Lnet/minecraft/world/level/ServerLevelAccessor;canSeeSky(Lnet/minecraft/core/BlockPos;)Z")) - private static boolean isSkylightOrTempleVisible(ServerLevelAccessor serverWorldAccess, BlockPos pos) - { - return serverWorldAccess.canSeeSky(pos) || - (CarpetSettings.huskSpawningInTemples && SpawnOverrides.isStructureAtPosition((ServerLevel)serverWorldAccess, BuiltinStructures.DESERT_PYRAMID, pos)); - } -} diff --git a/src/main/java/carpet/mixins/LivingEntity_cleanLogsMixin.java b/src/main/java/carpet/mixins/LivingEntity_cleanLogsMixin.java index a6b80dcb..bd55dcbf 100644 --- a/src/main/java/carpet/mixins/LivingEntity_cleanLogsMixin.java +++ b/src/main/java/carpet/mixins/LivingEntity_cleanLogsMixin.java @@ -5,8 +5,8 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.level.GameRules; import net.minecraft.world.level.Level; +import net.minecraft.world.level.gamerules.GameRules; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; @@ -23,6 +23,6 @@ public abstract class LivingEntity_cleanLogsMixin extends Entity @Redirect(method = "die", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/LivingEntity;hasCustomName()Z")) private boolean shouldLogDeaths(LivingEntity livingEntity) { - return livingEntity.hasCustomName() && livingEntity.level() instanceof ServerLevel serverLevel && CarpetSettings.cleanLogs && serverLevel.getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES); + return livingEntity.hasCustomName() && livingEntity.level() instanceof ServerLevel serverLevel && CarpetSettings.cleanLogs && serverLevel.getGameRules().get(GameRules.SHOW_DEATH_MESSAGES); } } diff --git a/src/main/java/carpet/mixins/LivingEntity_maxCollisionsMixin.java b/src/main/java/carpet/mixins/LivingEntity_maxCollisionsMixin.java index 90474f0e..0e092980 100644 --- a/src/main/java/carpet/mixins/LivingEntity_maxCollisionsMixin.java +++ b/src/main/java/carpet/mixins/LivingEntity_maxCollisionsMixin.java @@ -3,6 +3,7 @@ package carpet.mixins; import carpet.CarpetSettings; import carpet.fakes.LevelInterface; import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.gamerules.GameRules; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -14,7 +15,6 @@ import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntitySelector; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.level.GameRules; import net.minecraft.world.level.Level; @Mixin(LivingEntity.class) @@ -44,7 +44,7 @@ public abstract class LivingEntity_maxCollisionsMixin extends Entity int maxEntityCramming =-1; if (CarpetSettings.maxEntityCollisions > 0) { - maxEntityCramming = serverLevel.getGameRules().getInt(GameRules.RULE_MAX_ENTITY_CRAMMING); + maxEntityCramming = serverLevel.getGameRules().get(GameRules.MAX_ENTITY_CRAMMING); entities = ((LevelInterface) serverLevel).getOtherEntitiesLimited( this, this.getBoundingBox(), @@ -57,7 +57,7 @@ public abstract class LivingEntity_maxCollisionsMixin extends Entity } if (!entities.isEmpty()) { - if (maxEntityCramming < 0) maxEntityCramming = serverLevel.getGameRules().getInt(GameRules.RULE_MAX_ENTITY_CRAMMING); + if (maxEntityCramming < 0) maxEntityCramming = serverLevel.getGameRules().get(GameRules.MAX_ENTITY_CRAMMING); if (maxEntityCramming > 0 && entities.size() > maxEntityCramming - 1 && this.random.nextInt(4) == 0) { int candidates = 0; diff --git a/src/main/java/carpet/mixins/Monster_templesMixin.java b/src/main/java/carpet/mixins/Monster_templesMixin.java new file mode 100644 index 00000000..2108205f --- /dev/null +++ b/src/main/java/carpet/mixins/Monster_templesMixin.java @@ -0,0 +1,28 @@ +package carpet.mixins; + +import carpet.CarpetSettings; +import carpet.utils.SpawnOverrides; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.RandomSource; +import net.minecraft.world.entity.EntitySpawnReason; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.monster.Monster; +import net.minecraft.world.level.ServerLevelAccessor; +import net.minecraft.world.level.levelgen.structure.BuiltinStructures; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Mixin(Monster.class) +public class Monster_templesMixin +{ + @Redirect(method = "checkSurfaceMonstersSpawnRules", at = @At(value = "INVOKE", target="Lnet/minecraft/world/level/ServerLevelAccessor;canSeeSky(Lnet/minecraft/core/BlockPos;)Z")) + private static boolean isSkylightOrTempleVisible(ServerLevelAccessor serverWorldAccess, BlockPos pos, + EntityType entityType, ServerLevelAccessor serverLevelAccessor, EntitySpawnReason entitySpawnReason, BlockPos blockPos, RandomSource randomSource) + { + return serverWorldAccess.canSeeSky(pos) || + (CarpetSettings.huskSpawningInTemples && entityType == EntityType.HUSK && SpawnOverrides.isStructureAtPosition((ServerLevel)serverWorldAccess, BuiltinStructures.DESERT_PYRAMID, pos)); + } +} diff --git a/src/main/java/carpet/mixins/ServerLevel_scarpetMixin.java b/src/main/java/carpet/mixins/ServerLevel_scarpetMixin.java index a6af3113..e03af9c9 100644 --- a/src/main/java/carpet/mixins/ServerLevel_scarpetMixin.java +++ b/src/main/java/carpet/mixins/ServerLevel_scarpetMixin.java @@ -18,7 +18,8 @@ import net.minecraft.world.entity.LightningBolt; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.Explosion; import net.minecraft.world.level.ExplosionDamageCalculator; -import net.minecraft.world.level.GameRules; +import net.minecraft.world.level.gamerules.GameRule; +import net.minecraft.world.level.gamerules.GameRules; import net.minecraft.world.level.Level; import net.minecraft.world.level.chunk.LevelChunk; import net.minecraft.world.level.dimension.DimensionType; @@ -66,8 +67,8 @@ public abstract class ServerLevel_scarpetMixin extends Level implements ServerWo if (LIGHTNING.isNeeded()) LIGHTNING.onWorldEventFlag((ServerLevel) (Object)this, blockPos, bl2?1:0); } - private Explosion.BlockInteraction getCMDestroyType(final GameRules.Key rule) { - return getGameRules().getBoolean(rule) ? Explosion.BlockInteraction.DESTROY_WITH_DECAY : Explosion.BlockInteraction.DESTROY; + private Explosion.BlockInteraction getCMDestroyType(final GameRule rule) { + return getGameRules().get(rule) ? Explosion.BlockInteraction.DESTROY_WITH_DECAY : Explosion.BlockInteraction.DESTROY; } @Inject(method = "explode", at = @At("HEAD"), cancellable = true) @@ -76,9 +77,9 @@ public abstract class ServerLevel_scarpetMixin extends Level implements ServerWo if (EXPLOSION.isNeeded()) { Explosion.BlockInteraction var10000 = switch (explosionInteraction) { case NONE -> Explosion.BlockInteraction.KEEP; - case BLOCK -> this.getCMDestroyType(GameRules.RULE_BLOCK_EXPLOSION_DROP_DECAY); - case MOB -> this.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? this.getCMDestroyType(GameRules.RULE_MOB_EXPLOSION_DROP_DECAY) : Explosion.BlockInteraction.KEEP; - case TNT -> this.getCMDestroyType(GameRules.RULE_TNT_EXPLOSION_DROP_DECAY); + case BLOCK -> this.getCMDestroyType(GameRules.BLOCK_EXPLOSION_DROP_DECAY); + case MOB -> this.getGameRules().get(GameRules.MOB_GRIEFING) ? this.getCMDestroyType(GameRules.MOB_EXPLOSION_DROP_DECAY) : Explosion.BlockInteraction.KEEP; + case TNT -> this.getCMDestroyType(GameRules.TNT_EXPLOSION_DROP_DECAY); case TRIGGER -> Explosion.BlockInteraction.TRIGGER_BLOCK; }; diff --git a/src/main/java/carpet/mixins/SummonCommand_lightningMixin.java b/src/main/java/carpet/mixins/SummonCommand_lightningMixin.java index 0fb72fa2..e6dab685 100644 --- a/src/main/java/carpet/mixins/SummonCommand_lightningMixin.java +++ b/src/main/java/carpet/mixins/SummonCommand_lightningMixin.java @@ -10,7 +10,7 @@ import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LightningBolt; import net.minecraft.world.entity.animal.horse.SkeletonHorse; -import net.minecraft.world.level.GameRules; +import net.minecraft.world.level.gamerules.GameRules; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; @@ -30,7 +30,7 @@ public class SummonCommand_lightningMixin ServerLevel world = (ServerLevel) entity.level(); BlockPos at = entity.blockPosition(); DifficultyInstance localDifficulty_1 = world.getCurrentDifficultyAt(at); - boolean boolean_2 = world.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && world.random.nextDouble() < (double)localDifficulty_1.getEffectiveDifficulty() * 0.01D; + boolean boolean_2 = world.getGameRules().get(GameRules.SPAWN_MOBS) && world.random.nextDouble() < (double)localDifficulty_1.getEffectiveDifficulty() * 0.01D; if (boolean_2) { SkeletonHorse skeletonHorseEntity_1 = EntityType.SKELETON_HORSE.create(world, EntitySpawnReason.EVENT); skeletonHorseEntity_1.setTrap(true); diff --git a/src/main/java/carpet/script/ScriptCommand.java b/src/main/java/carpet/script/ScriptCommand.java index 3894d757..02373ab6 100644 --- a/src/main/java/carpet/script/ScriptCommand.java +++ b/src/main/java/carpet/script/ScriptCommand.java @@ -17,7 +17,7 @@ import com.mojang.brigadier.suggestion.SuggestionsBuilder; import net.minecraft.commands.CommandBuildContext; import net.minecraft.commands.Commands; import net.minecraft.network.chat.Component; -import net.minecraft.world.level.GameRules; +import net.minecraft.world.level.gamerules.GameRules; import org.apache.commons.lang3.StringUtils; import java.io.IOException; @@ -667,7 +667,7 @@ public class ScriptCommand BoundingBox area = BoundingBox.fromCorners(a, b); CarpetExpression cexpr = new CarpetExpression(host.main, expr, source, origin); int int_1 = area.getXSpan() * area.getYSpan() * area.getZSpan(); // X Y Z - if (int_1 > source.getLevel().getGameRules().getInt(GameRules.RULE_COMMAND_MODIFICATION_BLOCK_LIMIT)) + if (int_1 > source.getLevel().getGameRules().get(GameRules.MAX_BLOCK_MODIFICATIONS)) { Carpet.Messenger_message(source, "r too many blocks to evaluate: " + int_1); return 1; @@ -719,7 +719,7 @@ public class ScriptCommand BoundingBox area = BoundingBox.fromCorners(a, b); CarpetExpression cexpr = new CarpetExpression(host.main, expr, source, origin); int int_1 = area.getXSpan() * area.getYSpan() * area.getZSpan(); - if (int_1 > source.getLevel().getGameRules().getInt(GameRules.RULE_COMMAND_MODIFICATION_BLOCK_LIMIT)) + if (int_1 > source.getLevel().getGameRules().get(GameRules.MAX_BLOCK_MODIFICATIONS)) { Carpet.Messenger_message(source, "r too many blocks to evaluate: " + int_1); return 1; diff --git a/src/main/java/carpet/script/annotation/package-info.java b/src/main/java/carpet/script/annotation/package-info.java index 2624cd01..5e27daad 100644 --- a/src/main/java/carpet/script/annotation/package-info.java +++ b/src/main/java/carpet/script/annotation/package-info.java @@ -1,8 +1,3 @@ -@ParametersAreNonnullByDefault -@FieldsAreNonnullByDefault -@MethodsReturnNonnullByDefault +@NullMarked package carpet.script.annotation; - -import net.minecraft.FieldsAreNonnullByDefault; -import net.minecraft.MethodsReturnNonnullByDefault; -import javax.annotation.ParametersAreNonnullByDefault; +import org.jspecify.annotations.NullMarked; diff --git a/src/main/java/carpet/script/api/package-info.java b/src/main/java/carpet/script/api/package-info.java index f919f794..c9730252 100644 --- a/src/main/java/carpet/script/api/package-info.java +++ b/src/main/java/carpet/script/api/package-info.java @@ -1,8 +1,3 @@ -@ParametersAreNonnullByDefault -@FieldsAreNonnullByDefault -@MethodsReturnNonnullByDefault +@NullMarked package carpet.script.api; - -import net.minecraft.FieldsAreNonnullByDefault; -import net.minecraft.MethodsReturnNonnullByDefault; -import javax.annotation.ParametersAreNonnullByDefault; +import org.jspecify.annotations.NullMarked; diff --git a/src/main/java/carpet/script/argument/package-info.java b/src/main/java/carpet/script/argument/package-info.java index 88201df0..89a8f427 100644 --- a/src/main/java/carpet/script/argument/package-info.java +++ b/src/main/java/carpet/script/argument/package-info.java @@ -1,8 +1,3 @@ -@ParametersAreNonnullByDefault -@FieldsAreNonnullByDefault -@MethodsReturnNonnullByDefault +@NullMarked package carpet.script.argument; - -import net.minecraft.FieldsAreNonnullByDefault; -import net.minecraft.MethodsReturnNonnullByDefault; -import javax.annotation.ParametersAreNonnullByDefault; +import org.jspecify.annotations.NullMarked; diff --git a/src/main/java/carpet/script/command/package-info.java b/src/main/java/carpet/script/command/package-info.java index a49b08e9..c9c8ff8b 100644 --- a/src/main/java/carpet/script/command/package-info.java +++ b/src/main/java/carpet/script/command/package-info.java @@ -1,8 +1,3 @@ -@ParametersAreNonnullByDefault -@FieldsAreNonnullByDefault -@MethodsReturnNonnullByDefault +@NullMarked package carpet.script.command; - -import net.minecraft.FieldsAreNonnullByDefault; -import net.minecraft.MethodsReturnNonnullByDefault; -import javax.annotation.ParametersAreNonnullByDefault; +import org.jspecify.annotations.NullMarked; diff --git a/src/main/java/carpet/script/exception/package-info.java b/src/main/java/carpet/script/exception/package-info.java index cb4c4d3e..7ba97419 100644 --- a/src/main/java/carpet/script/exception/package-info.java +++ b/src/main/java/carpet/script/exception/package-info.java @@ -1,8 +1,3 @@ -@ParametersAreNonnullByDefault -@FieldsAreNonnullByDefault -@MethodsReturnNonnullByDefault +@NullMarked package carpet.script.exception; - -import net.minecraft.FieldsAreNonnullByDefault; -import net.minecraft.MethodsReturnNonnullByDefault; -import javax.annotation.ParametersAreNonnullByDefault; +import org.jspecify.annotations.NullMarked; diff --git a/src/main/java/carpet/script/external/package-info.java b/src/main/java/carpet/script/external/package-info.java index 2e80a817..8ec348ba 100644 --- a/src/main/java/carpet/script/external/package-info.java +++ b/src/main/java/carpet/script/external/package-info.java @@ -1,8 +1,3 @@ -@ParametersAreNonnullByDefault -@FieldsAreNonnullByDefault -@MethodsReturnNonnullByDefault +@NullMarked package carpet.script.external; - -import net.minecraft.FieldsAreNonnullByDefault; -import net.minecraft.MethodsReturnNonnullByDefault; -import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file +import org.jspecify.annotations.NullMarked; \ No newline at end of file diff --git a/src/main/java/carpet/script/language/package-info.java b/src/main/java/carpet/script/language/package-info.java index 812e4dc2..02ed63bb 100644 --- a/src/main/java/carpet/script/language/package-info.java +++ b/src/main/java/carpet/script/language/package-info.java @@ -1,8 +1,3 @@ -@ParametersAreNonnullByDefault -@FieldsAreNonnullByDefault -@MethodsReturnNonnullByDefault +@NullMarked package carpet.script.language; - -import net.minecraft.FieldsAreNonnullByDefault; -import net.minecraft.MethodsReturnNonnullByDefault; -import javax.annotation.ParametersAreNonnullByDefault; +import org.jspecify.annotations.NullMarked; diff --git a/src/main/java/carpet/script/package-info.java b/src/main/java/carpet/script/package-info.java index e2c4fe3a..6677c742 100644 --- a/src/main/java/carpet/script/package-info.java +++ b/src/main/java/carpet/script/package-info.java @@ -1,8 +1,3 @@ -@ParametersAreNonnullByDefault -@FieldsAreNonnullByDefault -@MethodsReturnNonnullByDefault +@NullMarked package carpet.script; - -import net.minecraft.FieldsAreNonnullByDefault; -import net.minecraft.MethodsReturnNonnullByDefault; -import javax.annotation.ParametersAreNonnullByDefault; +import org.jspecify.annotations.NullMarked; diff --git a/src/main/java/carpet/script/utils/BiomeInfo.java b/src/main/java/carpet/script/utils/BiomeInfo.java index 5cbb2444..116c9447 100644 --- a/src/main/java/carpet/script/utils/BiomeInfo.java +++ b/src/main/java/carpet/script/utils/BiomeInfo.java @@ -29,9 +29,9 @@ public class BiomeInfo put("temperature", (w, b) -> NumericValue.of(b.getBaseTemperature())); // todo add per postion query for environmental attributes as well put("fog_color", (w, b) -> fromEnvironmentalAttribute(w, b, EnvironmentAttributes.FOG_COLOR)); - put("foliage_color", (w, b) -> ValueConversions.ofRGB(b.getSpecialEffects().getFoliageColorOverride().orElse(4764952))); // client Biome.getDefaultFoliageColor + put("foliage_color", (w, b) -> ValueConversions.ofRGB(b.getSpecialEffects().foliageColorOverride().orElse(4764952))); // client Biome.getDefaultFoliageColor put("sky_color", (w, b) -> fromEnvironmentalAttribute(w, b, EnvironmentAttributes.SKY_COLOR)); - put("water_color", (w, b) -> ValueConversions.ofRGB(b.getSpecialEffects().getWaterColor())); + put("water_color", (w, b) -> ValueConversions.ofRGB(b.getSpecialEffects().waterColor())); put("water_fog_color", (w, b) -> fromEnvironmentalAttribute(w, b, EnvironmentAttributes.WATER_FOG_COLOR)); put("humidity", (w, b) -> NumericValue.of(Vanilla.Biome_getClimateSettings(b).downfall())); put("precipitation", (w, b) -> StringValue.of(b.getPrecipitationAt(new BlockPos(0, w.getSeaLevel(), 0), w.getSeaLevel()).name().toLowerCase(Locale.ROOT))); diff --git a/src/main/java/carpet/script/utils/SystemInfo.java b/src/main/java/carpet/script/utils/SystemInfo.java index 7ab418b5..1c9ab887 100644 --- a/src/main/java/carpet/script/utils/SystemInfo.java +++ b/src/main/java/carpet/script/utils/SystemInfo.java @@ -15,7 +15,9 @@ import carpet.script.value.ValueConversions; import com.sun.management.OperatingSystemMXBean; import net.minecraft.SharedConstants; import net.minecraft.server.packs.PackType; -import net.minecraft.world.level.GameRules; +import net.minecraft.world.level.gamerules.GameRule; +import net.minecraft.world.level.gamerules.GameRuleTypeVisitor; +import net.minecraft.world.level.gamerules.GameRules; import net.minecraft.world.level.border.WorldBorder; import net.minecraft.world.level.storage.LevelData; import net.minecraft.world.level.storage.LevelResource; @@ -166,12 +168,15 @@ public class SystemInfo put("world_gamerules", c -> { Map rules = new HashMap<>(); GameRules gameRules = c.level().getGameRules(); - gameRules.visitGameRuleTypes(new GameRules.GameRuleTypeVisitor() + gameRules.visitGameRuleTypes(new GameRuleTypeVisitor() { @Override - public > void visit(GameRules.Key key, GameRules.Type type) - { - rules.put(StringValue.of(key.getId()), StringValue.of(gameRules.getRule(key).toString())); + public void visitBoolean(GameRule gameRule) { + rules.put(StringValue.of(gameRule.id()), BooleanValue.of(gameRules.get(gameRule))); + } + @Override + public void visitInteger(GameRule gameRule) { + rules.put(StringValue.of(gameRule.id()), NumericValue.of(gameRules.get(gameRule))); } }); return MapValue.wrap(rules); diff --git a/src/main/java/carpet/script/utils/package-info.java b/src/main/java/carpet/script/utils/package-info.java index 61a3a27c..8a3db280 100644 --- a/src/main/java/carpet/script/utils/package-info.java +++ b/src/main/java/carpet/script/utils/package-info.java @@ -1,8 +1,3 @@ -@ParametersAreNonnullByDefault -@FieldsAreNonnullByDefault -@MethodsReturnNonnullByDefault +@NullMarked package carpet.script.utils; - -import net.minecraft.FieldsAreNonnullByDefault; -import net.minecraft.MethodsReturnNonnullByDefault; -import javax.annotation.ParametersAreNonnullByDefault; +import org.jspecify.annotations.NullMarked; diff --git a/src/main/java/carpet/script/utils/shapes/package-info.java b/src/main/java/carpet/script/utils/shapes/package-info.java index 1055bff0..93f16f0c 100644 --- a/src/main/java/carpet/script/utils/shapes/package-info.java +++ b/src/main/java/carpet/script/utils/shapes/package-info.java @@ -1,8 +1,3 @@ -@ParametersAreNonnullByDefault -@FieldsAreNonnullByDefault -@MethodsReturnNonnullByDefault +@NullMarked package carpet.script.utils.shapes; - -import net.minecraft.FieldsAreNonnullByDefault; -import net.minecraft.MethodsReturnNonnullByDefault; -import javax.annotation.ParametersAreNonnullByDefault; +import org.jspecify.annotations.NullMarked; diff --git a/src/main/java/carpet/script/value/package-info.java b/src/main/java/carpet/script/value/package-info.java index 8d3b588e..4eb11f1b 100644 --- a/src/main/java/carpet/script/value/package-info.java +++ b/src/main/java/carpet/script/value/package-info.java @@ -1,8 +1,3 @@ -@ParametersAreNonnullByDefault -@FieldsAreNonnullByDefault -@MethodsReturnNonnullByDefault +@NullMarked package carpet.script.value; - -import net.minecraft.FieldsAreNonnullByDefault; -import net.minecraft.MethodsReturnNonnullByDefault; -import javax.annotation.ParametersAreNonnullByDefault; +import org.jspecify.annotations.NullMarked; diff --git a/src/main/resources/carpet.mixins.json b/src/main/resources/carpet.mixins.json index 66b5f206..c2bd87ed 100644 --- a/src/main/resources/carpet.mixins.json +++ b/src/main/resources/carpet.mixins.json @@ -81,7 +81,7 @@ "SaplingBlock_desertShrubsMixin", "EntityMixin", "Guardian_renewableSpongesMixin", - "Husk_templesMixin", + "Monster_templesMixin", "ChunkGenerator_customMobSpawnsMixin", "ServerChunkCacheMixin", "NaturalSpawnerMixin", From 2ddfdddb89fd7b3841876c65c3daf1388961e1b7 Mon Sep 17 00:00:00 2001 From: gnembon Date: Tue, 28 Oct 2025 23:44:46 +0100 Subject: [PATCH 148/232] 1.4.190 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 66485e13..24a6c147 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ org.gradle.configuration-cache=false fabric_version=0.134.0+1.21.9 # Mod Properties - mod_version = 1.4.189 + mod_version = 1.4.190 maven_group = carpet archives_base_name = fabric-carpet From 0a146e1d4e754d13d355817361e55daa3c4dc77c Mon Sep 17 00:00:00 2001 From: gnembon Date: Tue, 4 Nov 2025 18:04:16 +0100 Subject: [PATCH 149/232] 25w45a --- gradle.properties | 2 +- src/main/java/carpet/CarpetSettings.java | 4 +-- .../carpet/commands/PerimeterInfoCommand.java | 2 +- .../java/carpet/helpers/HopperCounter.java | 6 ++--- src/main/java/carpet/logging/Logger.java | 2 +- .../ChunkMap_scarpetChunkCreationMixin.java | 2 +- .../mixins/MinecraftServer_scarpetMixin.java | 2 +- .../ServerGamePacketListenerImplMixin.java | 2 +- ...PacketListenerImpl_scarpetEventsMixin.java | 6 ++--- ...rverPlayerGameMode_scarpetEventsMixin.java | 2 +- .../StructureBlockEntity_limitsMixin.java | 2 +- ...LightEngine_scarpetChunkCreationMixin.java | 2 +- .../java/carpet/network/CarpetClient.java | 4 +-- .../java/carpet/script/CarpetEventServer.java | 16 ++++++------ .../script/annotation/OutputConverter.java | 4 +-- .../java/carpet/script/api/Auxiliary.java | 14 +++++----- src/main/java/carpet/script/api/Entities.java | 6 ++--- .../java/carpet/script/api/Inventories.java | 6 ++--- .../java/carpet/script/api/Scoreboards.java | 6 ++--- .../java/carpet/script/api/WorldAccess.java | 18 ++++++------- .../script/command/CommandArgument.java | 26 +++++++++---------- .../java/carpet/script/utils/EntityTools.java | 2 +- .../carpet/script/utils/Experimental.java | 2 +- .../carpet/script/utils/FeatureGenerator.java | 6 ++--- .../carpet/script/utils/InputValidator.java | 10 +++---- .../carpet/script/utils/RecipeHelper.java | 10 +++---- .../carpet/script/utils/ShapeDispatcher.java | 6 ++--- .../carpet/script/utils/ShapesRenderer.java | 2 +- .../java/carpet/script/utils/SystemInfo.java | 2 +- .../java/carpet/script/utils/WorldTools.java | 6 ++--- .../java/carpet/script/value/EntityValue.java | 8 +++--- .../script/value/NBTSerializableValue.java | 6 ++--- .../carpet/script/value/ValueConversions.java | 18 ++++++------- .../java/carpet/utils/CarpetProfiler.java | 10 +++---- .../java/carpet/utils/SpawnOverrides.java | 4 +-- src/main/java/carpet/utils/SpawnReporter.java | 4 +-- 36 files changed, 115 insertions(+), 115 deletions(-) diff --git a/gradle.properties b/gradle.properties index 24a6c147..197b1d1a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ org.gradle.configuration-cache=false # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=25w44a + minecraft_version=25w45a loader_version=0.17.3 jsr305_version=3.0.2 fabric_version=0.134.0+1.21.9 diff --git a/src/main/java/carpet/CarpetSettings.java b/src/main/java/carpet/CarpetSettings.java index a2d55ebd..8df84e0d 100644 --- a/src/main/java/carpet/CarpetSettings.java +++ b/src/main/java/carpet/CarpetSettings.java @@ -14,7 +14,7 @@ import net.fabricmc.loader.api.SemanticVersion; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; import net.minecraft.core.registries.Registries; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.Identifier; import net.minecraft.server.MinecraftServer; import net.minecraft.server.ServerInterface; import net.minecraft.server.dedicated.DedicatedServer; @@ -938,7 +938,7 @@ public class CarpetSettings @Override public String validate(CommandSourceStack source, CarpetRule currentRule, String newValue, String string) { if (source == null) return newValue; // closing or sync - Optional ignoredBlock = source.registryAccess().lookupOrThrow(Registries.BLOCK).getOptional(ResourceLocation.tryParse(newValue)); + Optional ignoredBlock = source.registryAccess().lookupOrThrow(Registries.BLOCK).getOptional(Identifier.tryParse(newValue)); if (!ignoredBlock.isPresent()) { Messenger.m(source, "r Unknown block '" + newValue + "'."); return null; diff --git a/src/main/java/carpet/commands/PerimeterInfoCommand.java b/src/main/java/carpet/commands/PerimeterInfoCommand.java index 2d9c8174..26966ae5 100644 --- a/src/main/java/carpet/commands/PerimeterInfoCommand.java +++ b/src/main/java/carpet/commands/PerimeterInfoCommand.java @@ -43,7 +43,7 @@ public class PerimeterInfoCommand executes( (c) -> perimeterDiagnose( c.getSource(), BlockPosArgument.getSpawnablePos(c, "center position"), - getSummonableEntityType(c, "mob").key().location().toString() + getSummonableEntityType(c, "mob").key().identifier().toString() )))); dispatcher.register(command); } diff --git a/src/main/java/carpet/helpers/HopperCounter.java b/src/main/java/carpet/helpers/HopperCounter.java index 3fc8ca68..2cd4a987 100644 --- a/src/main/java/carpet/helpers/HopperCounter.java +++ b/src/main/java/carpet/helpers/HopperCounter.java @@ -14,7 +14,7 @@ import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.chat.Style; import net.minecraft.network.chat.TextColor; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.Identifier; import net.minecraft.server.MinecraftServer; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.DyeColor; @@ -370,7 +370,7 @@ public class HopperCounter Block block = null; final Registry itemRegistry = registryAccess.lookupOrThrow(Registries.ITEM); final Registry blockRegistry = registryAccess.lookupOrThrow(Registries.BLOCK); - ResourceLocation id = itemRegistry.getKey(item); + Identifier id = itemRegistry.getKey(item); if (item instanceof BlockItem blockItem) { block = blockItem.getBlock(); @@ -411,7 +411,7 @@ public class HopperCounter return WHITE; } - ResourceLocation id = registryAccess.lookupOrThrow(Registries.ITEM).getKey(item); + Identifier id = registryAccess.lookupOrThrow(Registries.ITEM).getKey(item); if (id == null) { return null; diff --git a/src/main/java/carpet/logging/Logger.java b/src/main/java/carpet/logging/Logger.java index 86cf5c91..e0476c83 100644 --- a/src/main/java/carpet/logging/Logger.java +++ b/src/main/java/carpet/logging/Logger.java @@ -9,7 +9,7 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.function.Supplier; -import net.minecraft.Util; +import net.minecraft.util.Util; import net.minecraft.network.chat.Component; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.player.Player; diff --git a/src/main/java/carpet/mixins/ChunkMap_scarpetChunkCreationMixin.java b/src/main/java/carpet/mixins/ChunkMap_scarpetChunkCreationMixin.java index 6ed8489f..fa19c497 100644 --- a/src/main/java/carpet/mixins/ChunkMap_scarpetChunkCreationMixin.java +++ b/src/main/java/carpet/mixins/ChunkMap_scarpetChunkCreationMixin.java @@ -15,7 +15,7 @@ import java.util.stream.Collectors; import carpet.fakes.SimpleEntityLookupInterface; import carpet.fakes.ServerWorldInterface; -import net.minecraft.Util; +import net.minecraft.util.Util; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.server.MinecraftServer; import net.minecraft.server.TickTask; diff --git a/src/main/java/carpet/mixins/MinecraftServer_scarpetMixin.java b/src/main/java/carpet/mixins/MinecraftServer_scarpetMixin.java index d92513c9..2bf5418d 100644 --- a/src/main/java/carpet/mixins/MinecraftServer_scarpetMixin.java +++ b/src/main/java/carpet/mixins/MinecraftServer_scarpetMixin.java @@ -2,7 +2,7 @@ package carpet.mixins; import carpet.fakes.MinecraftServerInterface; import carpet.script.CarpetScriptServer; -import net.minecraft.Util; +import net.minecraft.util.Util; import net.minecraft.core.RegistryAccess; import net.minecraft.resources.ResourceKey; import net.minecraft.server.MinecraftServer; diff --git a/src/main/java/carpet/mixins/ServerGamePacketListenerImplMixin.java b/src/main/java/carpet/mixins/ServerGamePacketListenerImplMixin.java index 06aaa474..2f0d6f04 100644 --- a/src/main/java/carpet/mixins/ServerGamePacketListenerImplMixin.java +++ b/src/main/java/carpet/mixins/ServerGamePacketListenerImplMixin.java @@ -5,7 +5,7 @@ import carpet.network.ServerNetworkHandler; import net.minecraft.network.protocol.PacketUtils; import net.minecraft.network.protocol.common.ServerboundCustomPayloadPacket; import net.minecraft.network.protocol.game.ServerGamePacketListener; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.Identifier; import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.network.ServerGamePacketListenerImpl; import org.spongepowered.asm.mixin.Mixin; diff --git a/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java b/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java index a85d6108..b29d46c0 100644 --- a/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java +++ b/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java @@ -72,7 +72,7 @@ public class ServerGamePacketListenerImpl_scarpetEventsMixin @Inject(method = "handlePlayerAction", cancellable = true, at = @At( value = "INVOKE", - target = "Lnet/minecraft/server/level/ServerPlayer;drop(Z)Z", // dropSelectedItem + target = "Lnet/minecraft/server/level/ServerPlayer;drop(Z)V", // dropSelectedItem ordinal = 0, shift = At.Shift.BEFORE )) @@ -96,7 +96,7 @@ public class ServerGamePacketListenerImpl_scarpetEventsMixin @Inject(method = "handlePlayerAction", cancellable = true, at = @At( value = "INVOKE", - target = "Lnet/minecraft/server/level/ServerPlayer;drop(Z)Z", // dropSelectedItem + target = "Lnet/minecraft/server/level/ServerPlayer;drop(Z)V", // dropSelectedItem ordinal = 1, shift = At.Shift.BEFORE )) @@ -261,7 +261,7 @@ public class ServerGamePacketListenerImpl_scarpetEventsMixin if (displayInfo == null) { return; } - if(PLAYER_CHOOSES_RECIPE.onRecipeSelected(player, displayInfo.parent().id().location(), packet.useMaxItems())) ci.cancel(); + if(PLAYER_CHOOSES_RECIPE.onRecipeSelected(player, displayInfo.parent().id().identifier(), packet.useMaxItems())) ci.cancel(); } } diff --git a/src/main/java/carpet/mixins/ServerPlayerGameMode_scarpetEventsMixin.java b/src/main/java/carpet/mixins/ServerPlayerGameMode_scarpetEventsMixin.java index ed3beb6d..5587c438 100644 --- a/src/main/java/carpet/mixins/ServerPlayerGameMode_scarpetEventsMixin.java +++ b/src/main/java/carpet/mixins/ServerPlayerGameMode_scarpetEventsMixin.java @@ -54,7 +54,7 @@ public class ServerPlayerGameMode_scarpetEventsMixin implements ServerPlayerInte @Inject(method = "useItemOn", at = @At( value = "INVOKE", - target = "Lnet/minecraft/advancements/critereon/ItemUsedOnLocationTrigger;trigger(Lnet/minecraft/server/level/ServerPlayer;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/item/ItemStack;)V", + target = "Lnet/minecraft/advancements/criterion/ItemUsedOnLocationTrigger;trigger(Lnet/minecraft/server/level/ServerPlayer;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/item/ItemStack;)V", shift = At.Shift.BEFORE )) private void onBlockActivated(ServerPlayer serverPlayerEntity, Level world, ItemStack stack, InteractionHand hand, BlockHitResult hitResult, CallbackInfoReturnable cir) diff --git a/src/main/java/carpet/mixins/StructureBlockEntity_limitsMixin.java b/src/main/java/carpet/mixins/StructureBlockEntity_limitsMixin.java index cf47efba..fff86f89 100644 --- a/src/main/java/carpet/mixins/StructureBlockEntity_limitsMixin.java +++ b/src/main/java/carpet/mixins/StructureBlockEntity_limitsMixin.java @@ -32,7 +32,7 @@ public abstract class StructureBlockEntity_limitsMixin } @ModifyArg( - method = "saveStructure(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/resources/ResourceLocation;Lnet/minecraft/core/BlockPos;Lnet/minecraft/core/Vec3i;ZLjava/lang/String;ZLjava/util/List;)Z", + method = "saveStructure(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/resources/Identifier;Lnet/minecraft/core/BlockPos;Lnet/minecraft/core/Vec3i;ZLjava/lang/String;ZLjava/util/List;)Z", at = @At( value = "INVOKE", target = "Lnet/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate;fillFromWorld(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/core/Vec3i;ZLjava/util/List;)V" diff --git a/src/main/java/carpet/mixins/ThreadedLevelLightEngine_scarpetChunkCreationMixin.java b/src/main/java/carpet/mixins/ThreadedLevelLightEngine_scarpetChunkCreationMixin.java index 61aa4008..ea0eaa22 100644 --- a/src/main/java/carpet/mixins/ThreadedLevelLightEngine_scarpetChunkCreationMixin.java +++ b/src/main/java/carpet/mixins/ThreadedLevelLightEngine_scarpetChunkCreationMixin.java @@ -2,7 +2,7 @@ package carpet.mixins; import java.util.concurrent.CompletableFuture; import java.util.function.IntSupplier; -import net.minecraft.Util; +import net.minecraft.util.Util; import net.minecraft.core.BlockPos; import net.minecraft.core.SectionPos; import net.minecraft.server.level.ChunkMap; diff --git a/src/main/java/carpet/network/CarpetClient.java b/src/main/java/carpet/network/CarpetClient.java index a2e83ee2..69aef15c 100644 --- a/src/main/java/carpet/network/CarpetClient.java +++ b/src/main/java/carpet/network/CarpetClient.java @@ -11,7 +11,7 @@ import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.Identifier; public class CarpetClient { @@ -45,7 +45,7 @@ public class CarpetClient private static LocalPlayer clientPlayer = null; private static boolean isServerCarpet = false; public static String serverCarpetVersion; - public static final ResourceLocation CARPET_CHANNEL = ResourceLocation.fromNamespaceAndPath("carpet", "hello"); + public static final Identifier CARPET_CHANNEL = Identifier.fromNamespaceAndPath("carpet", "hello"); public static void gameJoined(LocalPlayer player) { diff --git a/src/main/java/carpet/script/CarpetEventServer.java b/src/main/java/carpet/script/CarpetEventServer.java index f627f1fa..e97a46b1 100644 --- a/src/main/java/carpet/script/CarpetEventServer.java +++ b/src/main/java/carpet/script/CarpetEventServer.java @@ -45,7 +45,7 @@ import net.minecraft.core.RegistryAccess; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.Identifier; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; @@ -828,7 +828,7 @@ public class CarpetEventServer public static final Event PLAYER_CHOOSES_RECIPE = new Event("player_chooses_recipe", 3, false) { @Override - public boolean onRecipeSelected(ServerPlayer player, ResourceLocation recipe, boolean fullStack) + public boolean onRecipeSelected(ServerPlayer player, Identifier recipe, boolean fullStack) { return handler.call(() -> Arrays.asList( @@ -936,8 +936,8 @@ public class CarpetEventServer // eligibility already checked in mixin Value fromValue = ListValue.fromTriple(from.x, from.y, from.z); Value toValue = (to == null) ? Value.NULL : ListValue.fromTriple(to.x, to.y, to.z); - Value fromDimStr = NBTSerializableValue.nameFromRegistryId(fromDim.location()); - Value toDimStr = NBTSerializableValue.nameFromRegistryId(dimTo.location()); + Value fromDimStr = NBTSerializableValue.nameFromRegistryId(fromDim.identifier()); + Value toDimStr = NBTSerializableValue.nameFromRegistryId(dimTo.identifier()); handler.call(() -> Arrays.asList(new EntityValue(player), fromValue, fromDimStr, toValue, toDimStr), player::createCommandSourceStack); } @@ -981,12 +981,12 @@ public class CarpetEventServer public static final Event STATISTICS = new Event("statistic", 4, false) { - private ResourceLocation getStatId(Stat stat) + private Identifier getStatId(Stat stat) { return stat.getType().getRegistry().getKey(stat.getValue()); } - private final Set skippedStats = Set.of( + private final Set skippedStats = Set.of( Stats.TIME_SINCE_DEATH, Stats.TIME_SINCE_REST, Stats.PLAY_TIME, @@ -996,7 +996,7 @@ public class CarpetEventServer @Override public void onPlayerStatistic(ServerPlayer player, Stat stat, int amount) { - ResourceLocation id = getStatId(stat); + Identifier id = getStatId(stat); if (skippedStats.contains(id)) { return; @@ -1296,7 +1296,7 @@ public class CarpetEventServer return false; } - public boolean onRecipeSelected(ServerPlayer player, ResourceLocation recipe, boolean fullStack) + public boolean onRecipeSelected(ServerPlayer player, Identifier recipe, boolean fullStack) { return false; } diff --git a/src/main/java/carpet/script/annotation/OutputConverter.java b/src/main/java/carpet/script/annotation/OutputConverter.java index 1562957b..b0219d21 100644 --- a/src/main/java/carpet/script/annotation/OutputConverter.java +++ b/src/main/java/carpet/script/annotation/OutputConverter.java @@ -10,7 +10,7 @@ import net.minecraft.core.GlobalPos; import net.minecraft.core.RegistryAccess; import net.minecraft.nbt.Tag; import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.Identifier; import net.minecraft.world.entity.Entity; import net.minecraft.world.item.ItemStack; import net.minecraft.world.phys.Vec3; @@ -54,7 +54,7 @@ public final class OutputConverter register(BlockPos.class, (v, r) -> ValueConversions.of(v)); register(Vec3.class, (v, r) -> ValueConversions.of(v)); register(ItemStack.class, (v, r) -> ValueConversions.of(v, r)); - register(ResourceLocation.class, (v, r) -> ValueConversions.of(v)); + register(Identifier.class, (v, r) -> ValueConversions.of(v)); register(GlobalPos.class, (v, r) -> ValueConversions.of(v)); } diff --git a/src/main/java/carpet/script/api/Auxiliary.java b/src/main/java/carpet/script/api/Auxiliary.java index 4a58c153..b1541734 100644 --- a/src/main/java/carpet/script/api/Auxiliary.java +++ b/src/main/java/carpet/script/api/Auxiliary.java @@ -53,7 +53,7 @@ import net.minecraft.network.protocol.game.ClientboundSetSubtitleTextPacket; import net.minecraft.network.protocol.game.ClientboundSetTitleTextPacket; import net.minecraft.network.protocol.game.ClientboundSetTitlesAnimationPacket; import net.minecraft.network.protocol.game.ClientboundSoundPacket; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.Identifier; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; @@ -132,10 +132,10 @@ public class Auxiliary CarpetContext cc = (CarpetContext) c; if (lv.isEmpty()) { - return ListValue.wrap(cc.registry(Registries.SOUND_EVENT).listElements().map(soundEventReference -> ValueConversions.of(soundEventReference.key().location()))); + return ListValue.wrap(cc.registry(Registries.SOUND_EVENT).listElements().map(soundEventReference -> ValueConversions.of(soundEventReference.key().identifier()))); } String rawString = lv.get(0).getString(); - ResourceLocation soundName = InputValidator.identifierOf(rawString); + Identifier soundName = InputValidator.identifierOf(rawString); Vector3Argument locator = Vector3Argument.findIn(lv, 1); Holder soundHolder = Holder.direct(SoundEvent.createVariableRangeEvent(soundName)); @@ -177,7 +177,7 @@ public class Auxiliary CarpetContext cc = (CarpetContext) c; if (lv.isEmpty()) { - return ListValue.wrap(cc.registry(Registries.PARTICLE_TYPE).listElements().map(particleTypeReference -> ValueConversions.of(particleTypeReference.key().location()))); + return ListValue.wrap(cc.registry(Registries.PARTICLE_TYPE).listElements().map(particleTypeReference -> ValueConversions.of(particleTypeReference.key().identifier()))); } MinecraftServer ms = cc.server(); ServerLevel world = cc.level(); @@ -1064,8 +1064,8 @@ public class Auxiliary { return Value.NULL; } - ResourceLocation category; - ResourceLocation statName; + Identifier category; + Identifier statName; category = InputValidator.identifierOf(lv.get(1).getString()); statName = InputValidator.identifierOf(lv.get(2).getString()); StatType type = cc.registry(Registries.STAT_TYPE).getValue(category); @@ -1387,7 +1387,7 @@ public class Auxiliary } @Nullable - private static Stat getStat(StatType type, ResourceLocation id) + private static Stat getStat(StatType type, Identifier id) { T key = type.getRegistry().getValue(id); if (key == null || !type.contains(key)) diff --git a/src/main/java/carpet/script/api/Entities.java b/src/main/java/carpet/script/api/Entities.java index 9c478d4b..afa28c93 100644 --- a/src/main/java/carpet/script/api/Entities.java +++ b/src/main/java/carpet/script/api/Entities.java @@ -28,7 +28,7 @@ import java.util.function.Predicate; import net.minecraft.commands.CommandSourceStack; import net.minecraft.core.registries.Registries; import net.minecraft.nbt.CompoundTag; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.Identifier; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; @@ -107,10 +107,10 @@ public class Entities throw new InternalExpressionException("'spawn' function takes mob name, and position to spawn"); } String entityString = lv.get(0).getString(); - ResourceLocation entityId; + Identifier entityId; try { - entityId = ResourceLocation.read(new StringReader(entityString)); + entityId = Identifier.read(new StringReader(entityString)); EntityType type = cc.registry(Registries.ENTITY_TYPE).getOptional(entityId).orElse(null); if (type == null || !type.canSummon()) { diff --git a/src/main/java/carpet/script/api/Inventories.java b/src/main/java/carpet/script/api/Inventories.java index e7b45930..35b1b26d 100644 --- a/src/main/java/carpet/script/api/Inventories.java +++ b/src/main/java/carpet/script/api/Inventories.java @@ -33,7 +33,7 @@ import net.minecraft.core.RegistryAccess; import net.minecraft.core.registries.Registries; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.Identifier; import net.minecraft.server.level.ServerPlayer; import net.minecraft.tags.TagKey; import net.minecraft.util.context.ContextMap; @@ -72,7 +72,7 @@ public class Inventories Registry items = cc.registry(Registries.ITEM); if (lv.isEmpty()) { - return ListValue.wrap(items.listElements().map(itemReference -> ValueConversions.of(itemReference.key().location()))); + return ListValue.wrap(items.listElements().map(itemReference -> ValueConversions.of(itemReference.key().identifier()))); } String tag = lv.get(0).getString(); Optional> itemTag = items.get(TagKey.create(Registries.ITEM, InputValidator.identifierOf(tag))); @@ -196,7 +196,7 @@ public class Inventories expression.addContextFunction("crafting_remaining_item", 1, (c, t, v) -> { String itemStr = v.get(0).getString(); - ResourceLocation id = InputValidator.identifierOf(itemStr); + Identifier id = InputValidator.identifierOf(itemStr); CarpetContext cc = (CarpetContext) c; Registry registry = cc.registry(Registries.ITEM); Item item = registry.getOptional(id).orElseThrow(() -> new ThrowStatement(itemStr, Throwables.UNKNOWN_ITEM)); diff --git a/src/main/java/carpet/script/api/Scoreboards.java b/src/main/java/carpet/script/api/Scoreboards.java index f903eb0a..61248e5b 100644 --- a/src/main/java/carpet/script/api/Scoreboards.java +++ b/src/main/java/carpet/script/api/Scoreboards.java @@ -21,7 +21,7 @@ import java.util.List; import net.minecraft.ChatFormatting; import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.Identifier; import net.minecraft.server.ServerScoreboard; import net.minecraft.server.bossevents.CustomBossEvent; import net.minecraft.server.bossevents.CustomBossEvents; @@ -547,11 +547,11 @@ public class Scoreboards if (lv.isEmpty()) { - return ListValue.wrap(bossBarManager.getEvents().stream().map(CustomBossEvent::getTextId).map(ResourceLocation::toString).map(StringValue::of)); + return ListValue.wrap(bossBarManager.getEvents().stream().map(CustomBossEvent::getTextId).map(Identifier::toString).map(StringValue::of)); } String id = lv.get(0).getString(); - ResourceLocation identifier = InputValidator.identifierOf(id); + Identifier identifier = InputValidator.identifierOf(id); if (lv.size() == 1) { diff --git a/src/main/java/carpet/script/api/WorldAccess.java b/src/main/java/carpet/script/api/WorldAccess.java index 9e45dfad..b651aafa 100644 --- a/src/main/java/carpet/script/api/WorldAccess.java +++ b/src/main/java/carpet/script/api/WorldAccess.java @@ -30,7 +30,7 @@ import carpet.script.value.ValueConversions; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; import it.unimi.dsi.fastutil.longs.LongSet; -import net.minecraft.Util; +import net.minecraft.util.Util; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.Holder; @@ -87,7 +87,7 @@ import java.util.stream.Stream; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.protocol.game.ClientboundExplodePacket; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.Identifier; import net.minecraft.sounds.SoundSource; import net.minecraft.util.Mth; import net.minecraft.world.InteractionResult; @@ -397,7 +397,7 @@ public class WorldAccess return Value.TRUE; } String poiTypeString = poi.getString().toLowerCase(Locale.ROOT); - ResourceLocation resource = InputValidator.identifierOf(poiTypeString); + Identifier resource = InputValidator.identifierOf(poiTypeString); Registry poiReg = cc.registry(Registries.POINT_OF_INTEREST_TYPE); PoiType type = poiReg.getOptional(resource) .orElseThrow(() -> new ThrowStatement(poiTypeString, Throwables.UNKNOWN_POI)); @@ -1228,9 +1228,9 @@ public class WorldAccess Registry blocks = cc.registry(Registries.BLOCK); if (lv.isEmpty()) { - return ListValue.wrap(blocks.listElements().map(blockReference -> ValueConversions.of(blockReference.key().location()))); + return ListValue.wrap(blocks.listElements().map(blockReference -> ValueConversions.of(blockReference.key().identifier()))); } - ResourceLocation tag = InputValidator.identifierOf(lv.get(0).getString()); + Identifier tag = InputValidator.identifierOf(lv.get(0).getString()); Optional> tagset = blocks.get(TagKey.create(Registries.BLOCK, tag)); return tagset.isEmpty() ? Value.NULL : ListValue.wrap(tagset.get().stream().map(b -> ValueConversions.of(blocks.getKey(b.value())))); }); @@ -1259,7 +1259,7 @@ public class WorldAccess ServerLevel world = cc.level(); if (lv.isEmpty()) { - return ListValue.wrap(cc.registry(Registries.BIOME).listElements().map(biomeReference -> ValueConversions.of(biomeReference.key().location()))); + return ListValue.wrap(cc.registry(Registries.BIOME).listElements().map(biomeReference -> ValueConversions.of(biomeReference.key().identifier()))); } Biome biome; @@ -1296,7 +1296,7 @@ public class WorldAccess Climate.quantizeCoord(numberGetOrThrow(weirdness)) ); biome = mnbs.getNoiseBiome(point).value(); - ResourceLocation biomeId = cc.registry(Registries.BIOME).getKey(biome); + Identifier biomeId = cc.registry(Registries.BIOME).getKey(biome); return NBTSerializableValue.nameFromRegistryId(biomeId); } @@ -1317,7 +1317,7 @@ public class WorldAccess // in locatebiome if (locator.offset == lv.size()) { - ResourceLocation biomeId = cc.registry(Registries.BIOME).getKey(biome); + Identifier biomeId = cc.registry(Registries.BIOME).getKey(biome); return NBTSerializableValue.nameFromRegistryId(biomeId); } String biomeFeature = lv.get(locator.offset).getString(); @@ -1433,7 +1433,7 @@ public class WorldAccess if (!requested.isNull()) { String reqString = requested.getString(); - ResourceLocation id = InputValidator.identifierOf(reqString); + Identifier id = InputValidator.identifierOf(reqString); Structure requestedStructure = reg.getValue(id); if (requestedStructure != null) { diff --git a/src/main/java/carpet/script/command/CommandArgument.java b/src/main/java/carpet/script/command/CommandArgument.java index 4f7da43e..cb5fcc41 100644 --- a/src/main/java/carpet/script/command/CommandArgument.java +++ b/src/main/java/carpet/script/command/CommandArgument.java @@ -55,7 +55,7 @@ import java.util.function.Supplier; import java.util.stream.Collectors; import net.minecraft.ChatFormatting; -import net.minecraft.advancements.critereon.MinMaxBounds; +import net.minecraft.advancements.criterion.MinMaxBounds; import net.minecraft.commands.CommandBuildContext; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.SharedSuggestionProvider; @@ -73,7 +73,7 @@ import net.minecraft.commands.arguments.ObjectiveCriteriaArgument; import net.minecraft.commands.arguments.ParticleArgument; import net.minecraft.commands.arguments.RangeArgument; import net.minecraft.commands.arguments.ResourceArgument; -import net.minecraft.commands.arguments.ResourceLocationArgument; +import net.minecraft.commands.arguments.IdentifierArgument; import net.minecraft.commands.arguments.ResourceOrTagArgument; import net.minecraft.commands.arguments.ScoreHolderArgument; import net.minecraft.commands.arguments.ScoreboardSlotArgument; @@ -98,7 +98,7 @@ import net.minecraft.core.Registry; import net.minecraft.core.registries.Registries; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.Identifier; import net.minecraft.server.MinecraftServer; import net.minecraft.server.commands.BossBarCommands; import net.minecraft.server.commands.LootCommand; @@ -210,8 +210,8 @@ public abstract class CommandArgument new VanillaUnconfigurableArgument("loottable", Registries.LOOT_TABLE), new VanillaUnconfigurableArgument("attribute", Registries.ATTRIBUTE), - new VanillaUnconfigurableArgument("boss", ResourceLocationArgument::id, - (c, p) -> ValueConversions.of(ResourceLocationArgument.getId(c, p)), BossBarCommands.SUGGEST_BOSS_BAR + new VanillaUnconfigurableArgument("boss", IdentifierArgument::id, + (c, p) -> ValueConversions.of(IdentifierArgument.getId(c, p)), BossBarCommands.SUGGEST_BOSS_BAR ), new VanillaUnconfigurableArgument("biome", c -> ResourceOrTagArgument.resourceOrTag(c, Registries.BIOME), @@ -229,11 +229,11 @@ public abstract class CommandArgument return Value.NULL; }, (ctx, builder) -> SharedSuggestionProvider.suggestResource(ctx.getSource().getServer().registryAccess().lookupOrThrow(Registries.BIOME).keySet(), builder) ), - new VanillaUnconfigurableArgument("sound", ResourceLocationArgument::id, - (c, p) -> ValueConversions.of(ResourceLocationArgument.getId(c, p)), SuggestionProviders.cast(SuggestionProviders.AVAILABLE_SOUNDS) + new VanillaUnconfigurableArgument("sound", IdentifierArgument::id, + (c, p) -> ValueConversions.of(IdentifierArgument.getId(c, p)), SuggestionProviders.cast(SuggestionProviders.AVAILABLE_SOUNDS) ), - new VanillaUnconfigurableArgument("storekey", ResourceLocationArgument::id, - (c, p) -> ValueConversions.of(ResourceLocationArgument.getId(c, p)), (ctx, builder) -> SharedSuggestionProvider.suggestResource(ctx.getSource().getServer().getCommandStorage().keys(), builder) + new VanillaUnconfigurableArgument("storekey", IdentifierArgument::id, + (c, p) -> ValueConversions.of(IdentifierArgument.getId(c, p)), (ctx, builder) -> SharedSuggestionProvider.suggestResource(ctx.getSource().getServer().getCommandStorage().keys(), builder) ), // default @@ -841,7 +841,7 @@ public abstract class CommandArgument private static class CustomIdentifierArgument extends CommandArgument { - Set validOptions = Collections.emptySet(); + Set validOptions = Collections.emptySet(); protected CustomIdentifierArgument() { @@ -851,13 +851,13 @@ public abstract class CommandArgument @Override protected ArgumentType getArgumentType(CarpetScriptHost host) { - return ResourceLocationArgument.id(); + return IdentifierArgument.id(); } @Override protected Value getValueFromContext(CommandContext context, String param) throws CommandSyntaxException { - ResourceLocation choseValue = ResourceLocationArgument.getId(context, param); + Identifier choseValue = IdentifierArgument.getId(context, param); if (!validOptions.isEmpty() && !validOptions.contains(choseValue)) { throw new SimpleCommandExceptionType(Component.literal("Incorrect value for " + param + ": " + choseValue + " for custom type " + suffix)).create(); @@ -882,7 +882,7 @@ public abstract class CommandArgument { throw error("Custom sting type requires options passed as a list" + " for custom type " + suffix); } - validOptions = ((ListValue) optionsValue).getItems().stream().map(v -> ResourceLocation.parse(v.getString())).collect(Collectors.toSet()); + validOptions = ((ListValue) optionsValue).getItems().stream().map(v -> Identifier.parse(v.getString())).collect(Collectors.toSet()); } } } diff --git a/src/main/java/carpet/script/utils/EntityTools.java b/src/main/java/carpet/script/utils/EntityTools.java index 0b7e1cb6..b3a4b2ce 100644 --- a/src/main/java/carpet/script/utils/EntityTools.java +++ b/src/main/java/carpet/script/utils/EntityTools.java @@ -27,6 +27,6 @@ public class EntityTools float u = e.getYRot() * 0.017453292F; // yaw e.setDeltaMovement(e.getDeltaMovement().add((-Mth.sin(g) * 0.2F), 0.0D, (Mth.cos(u) * 0.2F))); } - e.hasImpulse = true; + e.needsSync = true; } } diff --git a/src/main/java/carpet/script/utils/Experimental.java b/src/main/java/carpet/script/utils/Experimental.java index 79d42834..141b2f35 100644 --- a/src/main/java/carpet/script/utils/Experimental.java +++ b/src/main/java/carpet/script/utils/Experimental.java @@ -9,7 +9,7 @@ import carpet.script.value.ValueConversions; import com.google.common.collect.ImmutableList; import com.mojang.datafixers.util.Pair; import com.mojang.serialization.DynamicOps; -import net.minecraft.Util; +import net.minecraft.util.Util; import net.minecraft.commands.Commands; import net.minecraft.core.Holder; import net.minecraft.core.Registry; diff --git a/src/main/java/carpet/script/utils/FeatureGenerator.java b/src/main/java/carpet/script/utils/FeatureGenerator.java index 79a5e766..f81e0274 100644 --- a/src/main/java/carpet/script/utils/FeatureGenerator.java +++ b/src/main/java/carpet/script/utils/FeatureGenerator.java @@ -23,7 +23,7 @@ import net.minecraft.core.registries.Registries; import net.minecraft.data.worldgen.Pools; import net.minecraft.data.worldgen.ProcessorLists; import net.minecraft.data.worldgen.placement.PlacementUtils; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.Identifier; import net.minecraft.server.level.ServerChunkCache; import net.minecraft.server.level.ServerLevel; import net.minecraft.tags.BiomeTags; @@ -75,7 +75,7 @@ public class FeatureGenerator { return custom.apply(world).plop(world, pos); } - ResourceLocation id = ResourceLocation.parse(featureName); + Identifier id = Identifier.parse(featureName); Structure structure = world.registryAccess().lookupOrThrow(Registries.STRUCTURE).getValue(id); if (structure != null) { @@ -129,7 +129,7 @@ public class FeatureGenerator @Nullable public static Structure resolveConfiguredStructure(String name, ServerLevel world, BlockPos pos) { - ResourceLocation id = ResourceLocation.parse(name); + Identifier id = Identifier.parse(name); Structure configuredStructureFeature = world.registryAccess().lookupOrThrow(Registries.STRUCTURE).getValue(id); if (configuredStructureFeature != null) { diff --git a/src/main/java/carpet/script/utils/InputValidator.java b/src/main/java/carpet/script/utils/InputValidator.java index f33edc36..afee7ecd 100644 --- a/src/main/java/carpet/script/utils/InputValidator.java +++ b/src/main/java/carpet/script/utils/InputValidator.java @@ -4,8 +4,8 @@ import carpet.script.exception.InternalExpressionException; import java.util.Locale; -import net.minecraft.ResourceLocationException; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.IdentifierException; +import net.minecraft.resources.Identifier; public class InputValidator { @@ -19,13 +19,13 @@ public class InputValidator return simplified; } - public static ResourceLocation identifierOf(String string) + public static Identifier identifierOf(String string) { try { - return ResourceLocation.parse(string); + return Identifier.parse(string); } - catch (ResourceLocationException iie) + catch (IdentifierException iie) { throw new InternalExpressionException("Incorrect identifier format '" + string + "': " + iie.getMessage()); } diff --git a/src/main/java/carpet/script/utils/RecipeHelper.java b/src/main/java/carpet/script/utils/RecipeHelper.java index 94c484d0..5536f755 100644 --- a/src/main/java/carpet/script/utils/RecipeHelper.java +++ b/src/main/java/carpet/script/utils/RecipeHelper.java @@ -2,7 +2,7 @@ package carpet.script.utils; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.Identifier; import net.minecraft.util.context.ContextMap; import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.item.crafting.RecipeManager; @@ -16,7 +16,7 @@ import java.util.List; public class RecipeHelper { - public static List> getRecipesForOutput(RecipeManager recipeManager, RecipeType type, ResourceLocation id, Level level) + public static List> getRecipesForOutput(RecipeManager recipeManager, RecipeType type, Identifier id, Level level) { List> results = new ArrayList<>(); @@ -28,7 +28,7 @@ public class RecipeHelper for (RecipeDisplay recipeDisplay : r.value().display()) { recipeDisplay.result().resolveForStacks(context).forEach(stack -> { - if (BuiltInRegistries.ITEM.wrapAsHolder(stack.getItem()).unwrapKey().map(ResourceKey::location).orElseThrow(IllegalStateException::new).equals(id)) + if (BuiltInRegistries.ITEM.wrapAsHolder(stack.getItem()).unwrapKey().map(ResourceKey::identifier).orElseThrow(IllegalStateException::new).equals(id)) { results.add(r.value()); } @@ -39,7 +39,7 @@ public class RecipeHelper return results; } - public static List> getRecipesForOutput(RecipeManager recipeManager, ResourceLocation id, Level level) + public static List> getRecipesForOutput(RecipeManager recipeManager, Identifier id, Level level) { List> results = new ArrayList<>(); @@ -48,7 +48,7 @@ public class RecipeHelper for (RecipeDisplay recipeDisplay : r.value().display()) { recipeDisplay.result().resolveForStacks(context).forEach(stack -> { - if (BuiltInRegistries.ITEM.wrapAsHolder(stack.getItem()).unwrapKey().map(ResourceKey::location).orElseThrow(IllegalStateException::new).equals(id)) + if (BuiltInRegistries.ITEM.wrapAsHolder(stack.getItem()).unwrapKey().map(ResourceKey::identifier).orElseThrow(IllegalStateException::new).equals(id)) { results.add(r.value()); } diff --git a/src/main/java/carpet/script/utils/ShapeDispatcher.java b/src/main/java/carpet/script/utils/ShapeDispatcher.java index 9c69224e..d8136e68 100644 --- a/src/main/java/carpet/script/utils/ShapeDispatcher.java +++ b/src/main/java/carpet/script/utils/ShapeDispatcher.java @@ -43,7 +43,7 @@ import net.minecraft.nbt.NumericTag; import net.minecraft.network.chat.Component; import net.minecraft.resources.RegistryOps; import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.Identifier; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; @@ -119,7 +119,7 @@ public class ShapeDispatcher } params = ShapeDispatcher.parseParams(paramList); } - params.putIfAbsent("dim", new StringValue(world.dimension().location().toString())); + params.putIfAbsent("dim", new StringValue(world.dimension().identifier().toString())); params.putIfAbsent("duration", duration); if (params.containsKey("player")) @@ -395,7 +395,7 @@ public class ShapeDispatcher key = 0; followEntity = -1; - shapeDimension = ResourceKey.create(Registries.DIMENSION, ResourceLocation.parse(options.get("dim").getString())); + shapeDimension = ResourceKey.create(Registries.DIMENSION, Identifier.parse(options.get("dim").getString())); if (options.containsKey("follow")) { followEntity = NumericValue.asNumber(options.getOrDefault("follow", optional.get("follow"))).getInt(); diff --git a/src/main/java/carpet/script/utils/ShapesRenderer.java b/src/main/java/carpet/script/utils/ShapesRenderer.java index 8f913d7f..1c2257f8 100644 --- a/src/main/java/carpet/script/utils/ShapesRenderer.java +++ b/src/main/java/carpet/script/utils/ShapesRenderer.java @@ -430,7 +430,7 @@ public class ShapesRenderer float blue = (color & 0xFF) / 255.0F; RenderType type; if (blockState.getBlock() instanceof LeavesBlock && !Minecraft.getInstance().options.cutoutLeaves().get()) { - type = RenderTypes.solid(); + type = RenderTypes.solidMovingBlock(); } else { type = ItemBlockRenderTypes.getRenderType(blockState); } diff --git a/src/main/java/carpet/script/utils/SystemInfo.java b/src/main/java/carpet/script/utils/SystemInfo.java index 1c9ab887..a49f44d5 100644 --- a/src/main/java/carpet/script/utils/SystemInfo.java +++ b/src/main/java/carpet/script/utils/SystemInfo.java @@ -60,7 +60,7 @@ public class SystemInfo String tlf = serverPath.getName(nodeCount - 2).toString(); return StringValue.of(tlf); }); - put("world_dimensions", c -> ListValue.wrap(c.server().levelKeys().stream().map(k -> ValueConversions.of(k.location())))); + put("world_dimensions", c -> ListValue.wrap(c.server().levelKeys().stream().map(k -> ValueConversions.of(k.identifier())))); put("world_spawn_point", c -> ValueConversions.of(c.server().overworld().getLevelData().getRespawnData().pos())); put("world_bottom", c -> new NumericValue(c.level().getMinY())); diff --git a/src/main/java/carpet/script/utils/WorldTools.java b/src/main/java/carpet/script/utils/WorldTools.java index 5851b821..c2274ec3 100644 --- a/src/main/java/carpet/script/utils/WorldTools.java +++ b/src/main/java/carpet/script/utils/WorldTools.java @@ -4,14 +4,14 @@ package carpet.script.utils; import carpet.script.external.Vanilla; //import net.fabricmc.api.EnvType; //import net.fabricmc.api.Environment; -import net.minecraft.Util; +import net.minecraft.util.Util; import net.minecraft.core.BlockPos; import net.minecraft.core.Holder; import net.minecraft.core.MappedRegistry; import net.minecraft.core.Registry; import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket; import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.Identifier; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; @@ -93,7 +93,7 @@ public class WorldTools /* public static boolean createWorld(MinecraftServer server, String worldKey, Long seed) { - ResourceLocation worldId = new ResourceLocation(worldKey); + Identifier worldId = new Identifier(worldKey); ServerLevel overWorld = server.overworld(); Set> worldKeys = server.levelKeys(); diff --git a/src/main/java/carpet/script/value/EntityValue.java b/src/main/java/carpet/script/value/EntityValue.java index f63526eb..6c7e1e4c 100644 --- a/src/main/java/carpet/script/value/EntityValue.java +++ b/src/main/java/carpet/script/value/EntityValue.java @@ -32,7 +32,7 @@ import net.minecraft.network.protocol.game.ClientboundSetExperiencePacket; import net.minecraft.network.protocol.game.ClientboundSetHeldSlotPacket; import net.minecraft.network.protocol.game.ClientboundSetPassengersPacket; import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.Identifier; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; @@ -385,7 +385,7 @@ public class EntityValue extends Value return (illagers.contains(type) || arthropods.contains(type) || undeads.contains(type) || aquatique.contains(type)) && e.isAlive(); }, allTypes.stream().filter(et -> !regular.contains(et) && living.contains(et)))); - for (ResourceLocation typeId : BuiltInRegistries.ENTITY_TYPE.keySet()) + for (Identifier typeId : BuiltInRegistries.ENTITY_TYPE.keySet()) { EntityType type = BuiltInRegistries.ENTITY_TYPE.getValue(typeId); String mobType = ValueConversions.simplify(typeId); @@ -500,7 +500,7 @@ public class EntityValue extends Value put("immune_to_frost", (e, a) -> BooleanValue.of(!e.canFreeze())); put("invulnerable", (e, a) -> BooleanValue.of(e instanceof Player player ? player.getAbilities().invulnerable : e.isInvulnerable())); - put("dimension", (e, a) -> nameFromRegistryId(e.level().dimension().location())); // getDimId + put("dimension", (e, a) -> nameFromRegistryId(e.level().dimension().identifier())); // getDimId put("height", (e, a) -> new NumericValue(e.getDimensions(Pose.STANDING).height())); put("width", (e, a) -> new NumericValue(e.getDimensions(Pose.STANDING).width())); put("eye_height", (e, a) -> new NumericValue(e.getEyeHeight())); @@ -853,7 +853,7 @@ public class EntityValue extends Value AttributeMap container = el.getAttributes(); return MapValue.wrap(attributes.listElements().filter(container::hasAttribute).collect(Collectors.toMap(aa -> ValueConversions.of(aa.key()), aa -> NumericValue.of(container.getValue(aa))))); } - ResourceLocation id = InputValidator.identifierOf(a.getString()); + Identifier id = InputValidator.identifierOf(a.getString()); Holder attrib = attributes.get(id).orElseThrow( () -> new InternalExpressionException("Unknown attribute: " + a.getString()) ); diff --git a/src/main/java/carpet/script/value/NBTSerializableValue.java b/src/main/java/carpet/script/value/NBTSerializableValue.java index ecb9e7d9..ab9df0b3 100644 --- a/src/main/java/carpet/script/value/NBTSerializableValue.java +++ b/src/main/java/carpet/script/value/NBTSerializableValue.java @@ -37,7 +37,7 @@ import net.minecraft.nbt.NumericTag; import net.minecraft.nbt.StringTag; import net.minecraft.nbt.Tag; import net.minecraft.nbt.TagParser; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.Identifier; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.Container; @@ -113,13 +113,13 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa return value; } - public static Value nameFromRegistryId(@Nullable ResourceLocation id) + public static Value nameFromRegistryId(@Nullable Identifier id) { return StringValue.of(nameFromResource(id)); } @Nullable - public static String nameFromResource(@Nullable ResourceLocation id) + public static String nameFromResource(@Nullable Identifier id) { return id == null ? null : id.getNamespace().equals("minecraft") ? id.getPath() : id.toString(); } diff --git a/src/main/java/carpet/script/value/ValueConversions.java b/src/main/java/carpet/script/value/ValueConversions.java index 14780cb4..9777cea4 100644 --- a/src/main/java/carpet/script/value/ValueConversions.java +++ b/src/main/java/carpet/script/value/ValueConversions.java @@ -7,7 +7,7 @@ import carpet.script.external.Vanilla; import carpet.script.utils.Colors; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; -import net.minecraft.advancements.critereon.MinMaxBounds; +import net.minecraft.advancements.criterion.MinMaxBounds; import net.minecraft.core.BlockPos; import net.minecraft.core.GlobalPos; import net.minecraft.core.HolderSet; @@ -20,7 +20,7 @@ import net.minecraft.core.registries.Registries; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtOps; import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.Identifier; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ColumnPos; import net.minecraft.server.level.ServerLevel; @@ -81,7 +81,7 @@ public class ValueConversions public static Value of(ServerLevel world) { - return of(world.dimension().location()); + return of(world.dimension().identifier()); } public static Value of(MapColor color) @@ -166,11 +166,11 @@ public class ValueConversions case "overworld", "over_world" -> server.getLevel(Level.OVERWORLD); default -> { ResourceKey dim = null; - ResourceLocation id = ResourceLocation.parse(dimString); + Identifier id = Identifier.parse(dimString); // not using RegistryKey.of since that one creates on check for (ResourceKey world : (server.levelKeys())) { - if (id.equals(world.location())) + if (id.equals(world.identifier())) { dim = world; break; @@ -188,7 +188,7 @@ public class ValueConversions public static Value of(ResourceKey dim) { - return of(dim.location()); + return of(dim.identifier()); } public static Value of(TagKey tagKey) @@ -201,7 +201,7 @@ public class ValueConversions return of(tagKey.key().location()); } - public static Value of(@Nullable ResourceLocation id) + public static Value of(@Nullable Identifier id) { if (id == null) // should be Value.NULL { @@ -210,7 +210,7 @@ public class ValueConversions return new StringValue(simplify(id)); } - public static String simplify(ResourceLocation id) + public static String simplify(Identifier id) { if (id == null) // should be Value.NULL { @@ -554,7 +554,7 @@ public class ValueConversions { return NumericValue.of(number); } - if (o instanceof final ResourceLocation resourceLocation) + if (o instanceof final Identifier resourceLocation) { return of(resourceLocation); } diff --git a/src/main/java/carpet/utils/CarpetProfiler.java b/src/main/java/carpet/utils/CarpetProfiler.java index 9bcf3595..1bc694bb 100644 --- a/src/main/java/carpet/utils/CarpetProfiler.java +++ b/src/main/java/carpet/utils/CarpetProfiler.java @@ -7,7 +7,7 @@ import net.minecraft.core.RegistryAccess; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.Identifier; import net.minecraft.server.MinecraftServer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; @@ -140,7 +140,7 @@ public class CarpetProfiler Level world = tok.world; String current_section = (world == null) ? (String) tok.section : - String.format("%s.%s%s", world.dimension().location(), tok.section, world.isClientSide() ? " (Client)" : ""); + String.format("%s.%s%s", world.dimension().identifier(), tok.section, world.isClientSide() ? " (Client)" : ""); SECTION_STATS.addTo(current_section, end_time - tok.start); } } @@ -234,7 +234,7 @@ public class CarpetProfiler for (ResourceKey dim : server.levelKeys()) { - ResourceLocation dimensionId = dim.location(); + Identifier dimensionId = dim.identifier(); boolean hasSomethin = false; for (String section : SECTIONS.keySet()) { @@ -275,7 +275,7 @@ public class CarpetProfiler private static String sectionName(Pair section) { - ResourceLocation id; + Identifier id; final RegistryAccess regs = section.getKey().registryAccess(); if (section.getValue() instanceof EntityType) { @@ -290,7 +290,7 @@ public class CarpetProfiler { name += " (client)"; } - ResourceLocation dimkey = section.getKey().dimension().location(); + Identifier dimkey = section.getKey().dimension().identifier(); String dim = "minecraft".equals(dimkey.getNamespace())?dimkey.getPath():dimkey.toString(); return name+" in "+dim; } diff --git a/src/main/java/carpet/utils/SpawnOverrides.java b/src/main/java/carpet/utils/SpawnOverrides.java index d4c05f40..024d6c14 100644 --- a/src/main/java/carpet/utils/SpawnOverrides.java +++ b/src/main/java/carpet/utils/SpawnOverrides.java @@ -6,7 +6,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.SectionPos; import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.Identifier; import net.minecraft.server.level.ServerLevel; import net.minecraft.util.random.WeightedList; import net.minecraft.world.entity.EntityType; @@ -54,7 +54,7 @@ public class SpawnOverrides { public static WeightedList test(StructureManager structureFeatureManager, LongSet foo, MobCategory cat, Structure confExisting, BlockPos where) { - ResourceLocation resource = structureFeatureManager.registryAccess().lookupOrThrow(Registries.STRUCTURE).getKey(confExisting); + Identifier resource = structureFeatureManager.registryAccess().lookupOrThrow(Registries.STRUCTURE).getKey(confExisting); ResourceKey key = ResourceKey.create(Registries.STRUCTURE, resource); final Pair spawnData = carpetOverrides.get(Pair.of(cat, key)); if (spawnData == null || !spawnData.getKey().getAsBoolean()) return null; diff --git a/src/main/java/carpet/utils/SpawnReporter.java b/src/main/java/carpet/utils/SpawnReporter.java index 3c086e4f..bbcdb166 100644 --- a/src/main/java/carpet/utils/SpawnReporter.java +++ b/src/main/java/carpet/utils/SpawnReporter.java @@ -98,7 +98,7 @@ public class SpawnReporter public static List printMobcapsForDimension(ServerLevel world, boolean multiline) { ResourceKey dim = world.dimension(); - String name = dim.location().getPath(); + String name = dim.identifier().getPath(); List lst = new ArrayList<>(); if (multiline) lst.add(Messenger.s(String.format("Mobcaps for %s:",name))); @@ -314,7 +314,7 @@ public class SpawnReporter private static String getWorldCode(ResourceKey world) { if (world == Level.OVERWORLD) return ""; - return "("+Character.toUpperCase(world.location().getPath().charAt("THE_".length()))+")"; + return "("+Character.toUpperCase(world.identifier().getPath().charAt("THE_".length()))+")"; } public static List makeTrackingReport(Level worldIn) From 35534ecdc2ce0ef0398960b5f2482ac9ae1b157c Mon Sep 17 00:00:00 2001 From: gnembon Date: Tue, 4 Nov 2025 18:05:44 +0100 Subject: [PATCH 150/232] 1.4.191 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 197b1d1a..02eb1683 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ org.gradle.configuration-cache=false fabric_version=0.134.0+1.21.9 # Mod Properties - mod_version = 1.4.190 + mod_version = 1.4.191 maven_group = carpet archives_base_name = fabric-carpet From 8050ed3a1cbbd34a13b171afefed046f53f4f9e4 Mon Sep 17 00:00:00 2001 From: gnembon Date: Tue, 11 Nov 2025 19:59:01 +0100 Subject: [PATCH 151/232] 25w46a --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 02eb1683..d3e542a4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ org.gradle.configuration-cache=false # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=25w45a + minecraft_version=25w46a loader_version=0.17.3 jsr305_version=3.0.2 fabric_version=0.134.0+1.21.9 From db8cec4889c4e1b36fb3904d3cd7151330d5a013 Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 19 Nov 2025 18:55:17 +0100 Subject: [PATCH 152/232] 1.21.11-pre1 --- gradle.properties | 2 +- src/main/java/carpet/helpers/EntityPlayerActionPack.java | 6 +++--- src/main/java/carpet/mixins/AbstractArrowMixin.java | 2 +- .../carpet/mixins/AbstractMinecart_scarpetEventsMixin.java | 2 +- .../java/carpet/mixins/HorseBaseEntity_scarpetMixin.java | 2 +- .../java/carpet/mixins/Level_getOtherEntitiesLimited.java | 2 +- .../carpet/mixins/ServerPlayerGameMode_antiCheatMixin.java | 4 ++-- .../java/carpet/mixins/SummonCommand_lightningMixin.java | 2 +- src/main/java/carpet/mixins/Villager_aiMixin.java | 4 ++-- src/main/java/carpet/script/CarpetEventServer.java | 2 +- src/main/java/carpet/script/external/Vanilla.java | 2 +- src/main/java/carpet/script/value/EntityValue.java | 6 +++--- src/main/java/carpet/script/value/NBTSerializableValue.java | 2 +- src/main/java/carpet/utils/BlockInfo.java | 2 +- src/main/java/carpet/utils/PerimeterDiagnostics.java | 2 +- src/main/java/carpet/utils/SpawnReporter.java | 2 +- 16 files changed, 22 insertions(+), 22 deletions(-) diff --git a/gradle.properties b/gradle.properties index d3e542a4..07d12e46 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ org.gradle.configuration-cache=false # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=25w46a + minecraft_version=1.21.11-pre1 loader_version=0.17.3 jsr305_version=3.0.2 fabric_version=0.134.0+1.21.9 diff --git a/src/main/java/carpet/helpers/EntityPlayerActionPack.java b/src/main/java/carpet/helpers/EntityPlayerActionPack.java index 019a33bd..f172892d 100644 --- a/src/main/java/carpet/helpers/EntityPlayerActionPack.java +++ b/src/main/java/carpet/helpers/EntityPlayerActionPack.java @@ -19,11 +19,11 @@ import net.minecraft.util.Mth; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.animal.horse.AbstractHorse; +import net.minecraft.world.entity.animal.equine.AbstractHorse; import net.minecraft.world.entity.decoration.ItemFrame; import net.minecraft.world.entity.player.Inventory; -import net.minecraft.world.entity.vehicle.Boat; -import net.minecraft.world.entity.vehicle.Minecart; +import net.minecraft.world.entity.vehicle.boat.Boat; +import net.minecraft.world.entity.vehicle.minecart.Minecart; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.BlockHitResult; diff --git a/src/main/java/carpet/mixins/AbstractArrowMixin.java b/src/main/java/carpet/mixins/AbstractArrowMixin.java index 8c3d5058..28e6a98a 100644 --- a/src/main/java/carpet/mixins/AbstractArrowMixin.java +++ b/src/main/java/carpet/mixins/AbstractArrowMixin.java @@ -4,7 +4,7 @@ import carpet.logging.LoggerRegistry; import carpet.logging.logHelpers.TrajectoryLogHelper; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.projectile.AbstractArrow; +import net.minecraft.world.entity.projectile.arrow.AbstractArrow; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.phys.BlockHitResult; diff --git a/src/main/java/carpet/mixins/AbstractMinecart_scarpetEventsMixin.java b/src/main/java/carpet/mixins/AbstractMinecart_scarpetEventsMixin.java index dd9a16b4..0a92d736 100644 --- a/src/main/java/carpet/mixins/AbstractMinecart_scarpetEventsMixin.java +++ b/src/main/java/carpet/mixins/AbstractMinecart_scarpetEventsMixin.java @@ -4,7 +4,7 @@ import carpet.fakes.EntityInterface; import carpet.script.EntityEventsGroup; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.vehicle.AbstractMinecart; +import net.minecraft.world.entity.vehicle.minecart.AbstractMinecart; import net.minecraft.world.level.Level; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; diff --git a/src/main/java/carpet/mixins/HorseBaseEntity_scarpetMixin.java b/src/main/java/carpet/mixins/HorseBaseEntity_scarpetMixin.java index 4e74292d..9079dc17 100644 --- a/src/main/java/carpet/mixins/HorseBaseEntity_scarpetMixin.java +++ b/src/main/java/carpet/mixins/HorseBaseEntity_scarpetMixin.java @@ -3,7 +3,7 @@ package carpet.mixins; import carpet.fakes.InventoryBearerInterface; import net.minecraft.world.Container; import net.minecraft.world.SimpleContainer; -import net.minecraft.world.entity.animal.horse.AbstractHorse; +import net.minecraft.world.entity.animal.equine.AbstractHorse; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; diff --git a/src/main/java/carpet/mixins/Level_getOtherEntitiesLimited.java b/src/main/java/carpet/mixins/Level_getOtherEntitiesLimited.java index aeb60732..0bbf7262 100644 --- a/src/main/java/carpet/mixins/Level_getOtherEntitiesLimited.java +++ b/src/main/java/carpet/mixins/Level_getOtherEntitiesLimited.java @@ -11,7 +11,7 @@ import java.util.List; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Predicate; import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.boss.EnderDragonPart; +import net.minecraft.world.entity.boss.enderdragon.EnderDragonPart; import net.minecraft.world.entity.boss.enderdragon.EnderDragon; import net.minecraft.world.level.Level; import net.minecraft.world.level.entity.LevelEntityGetter; diff --git a/src/main/java/carpet/mixins/ServerPlayerGameMode_antiCheatMixin.java b/src/main/java/carpet/mixins/ServerPlayerGameMode_antiCheatMixin.java index ea8dfa68..64d909ce 100644 --- a/src/main/java/carpet/mixins/ServerPlayerGameMode_antiCheatMixin.java +++ b/src/main/java/carpet/mixins/ServerPlayerGameMode_antiCheatMixin.java @@ -26,7 +26,7 @@ public abstract class ServerPlayerGameMode_antiCheatMixin extends LivingEntity super(entityType, level); } - @Inject(method = "canInteractWithBlock", at = @At("HEAD"), cancellable = true) + @Inject(method = "isWithinBlockInteractionRange", at = @At("HEAD"), cancellable = true) private void canInteractLongRangeBlock(BlockPos pos, double d, CallbackInfoReturnable cir) { double maxRange = blockInteractionRange() + d; @@ -34,7 +34,7 @@ public abstract class ServerPlayerGameMode_antiCheatMixin extends LivingEntity if (CarpetSettings.antiCheatDisabled && maxRange < 1024 && getEyePosition().distanceToSqr(Vec3.atCenterOf(pos)) < 1024) cir.setReturnValue(true); } - @Inject(method = "canInteractWithEntity(Lnet/minecraft/world/phys/AABB;D)Z", at = @At("HEAD"), cancellable = true) + @Inject(method = "isWithinEntityInteractionRange(Lnet/minecraft/world/phys/AABB;D)Z", at = @At("HEAD"), cancellable = true) private void canInteractLongRangeEntity(AABB aabb, double d, CallbackInfoReturnable cir) { double maxRange = entityInteractionRange() + d; diff --git a/src/main/java/carpet/mixins/SummonCommand_lightningMixin.java b/src/main/java/carpet/mixins/SummonCommand_lightningMixin.java index e6dab685..093eabe5 100644 --- a/src/main/java/carpet/mixins/SummonCommand_lightningMixin.java +++ b/src/main/java/carpet/mixins/SummonCommand_lightningMixin.java @@ -9,7 +9,7 @@ import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LightningBolt; -import net.minecraft.world.entity.animal.horse.SkeletonHorse; +import net.minecraft.world.entity.animal.equine.SkeletonHorse; import net.minecraft.world.level.gamerules.GameRules; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; diff --git a/src/main/java/carpet/mixins/Villager_aiMixin.java b/src/main/java/carpet/mixins/Villager_aiMixin.java index 2829f9ac..4451c8ca 100644 --- a/src/main/java/carpet/mixins/Villager_aiMixin.java +++ b/src/main/java/carpet/mixins/Villager_aiMixin.java @@ -29,8 +29,8 @@ import net.minecraft.world.entity.ai.memory.MemoryModuleType; import net.minecraft.world.entity.ai.village.poi.PoiManager; import net.minecraft.world.entity.ai.village.poi.PoiRecord; import net.minecraft.world.entity.ai.village.poi.PoiType; -import net.minecraft.world.entity.npc.AbstractVillager; -import net.minecraft.world.entity.npc.Villager; +import net.minecraft.world.entity.npc.villager.AbstractVillager; +import net.minecraft.world.entity.npc.villager.Villager; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.schedule.Activity; import net.minecraft.world.item.BedItem; diff --git a/src/main/java/carpet/script/CarpetEventServer.java b/src/main/java/carpet/script/CarpetEventServer.java index e97a46b1..677f412d 100644 --- a/src/main/java/carpet/script/CarpetEventServer.java +++ b/src/main/java/carpet/script/CarpetEventServer.java @@ -58,7 +58,7 @@ import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.item.PrimedTnt; -import net.minecraft.world.entity.npc.AbstractVillager; +import net.minecraft.world.entity.npc.villager.AbstractVillager; import net.minecraft.world.entity.projectile.Projectile; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.trading.Merchant; diff --git a/src/main/java/carpet/script/external/Vanilla.java b/src/main/java/carpet/script/external/Vanilla.java index 4da04a67..3a5f1852 100644 --- a/src/main/java/carpet/script/external/Vanilla.java +++ b/src/main/java/carpet/script/external/Vanilla.java @@ -38,7 +38,7 @@ import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.ai.goal.Goal; import net.minecraft.world.entity.ai.goal.GoalSelector; import net.minecraft.world.entity.ai.village.poi.PoiRecord; -import net.minecraft.world.entity.animal.horse.AbstractHorse; +import net.minecraft.world.entity.animal.equine.AbstractHorse; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.food.FoodData; import net.minecraft.world.inventory.AbstractContainerMenu; diff --git a/src/main/java/carpet/script/value/EntityValue.java b/src/main/java/carpet/script/value/EntityValue.java index 6c7e1e4c..e84425ad 100644 --- a/src/main/java/carpet/script/value/EntityValue.java +++ b/src/main/java/carpet/script/value/EntityValue.java @@ -60,13 +60,13 @@ import net.minecraft.world.entity.ai.goal.Goal; import net.minecraft.world.entity.ai.goal.MoveTowardsRestrictionGoal; import net.minecraft.world.entity.ai.memory.ExpirableValue; import net.minecraft.world.entity.ai.memory.MemoryModuleType; -import net.minecraft.world.entity.animal.IronGolem; +import net.minecraft.world.entity.animal.golem.IronGolem; import net.minecraft.world.entity.decoration.ItemFrame; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.projectile.Projectile; -import net.minecraft.world.entity.projectile.WitherSkull; -import net.minecraft.world.entity.vehicle.AbstractMinecart; +import net.minecraft.world.entity.projectile.hurtingprojectile.WitherSkull; +import net.minecraft.world.entity.vehicle.minecart.AbstractMinecart; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.GameType; import net.minecraft.world.level.Level; diff --git a/src/main/java/carpet/script/value/NBTSerializableValue.java b/src/main/java/carpet/script/value/NBTSerializableValue.java index ab9df0b3..1244a417 100644 --- a/src/main/java/carpet/script/value/NBTSerializableValue.java +++ b/src/main/java/carpet/script/value/NBTSerializableValue.java @@ -45,7 +45,7 @@ import net.minecraft.world.WorldlyContainerHolder; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntitySelector; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.animal.horse.AbstractHorse; +import net.minecraft.world.entity.animal.equine.AbstractHorse; import net.minecraft.world.entity.npc.InventoryCarrier; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; diff --git a/src/main/java/carpet/utils/BlockInfo.java b/src/main/java/carpet/utils/BlockInfo.java index ba41f635..fac954e6 100644 --- a/src/main/java/carpet/utils/BlockInfo.java +++ b/src/main/java/carpet/utils/BlockInfo.java @@ -14,7 +14,7 @@ import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.PathfinderMob; import net.minecraft.world.entity.ai.goal.RandomStrollGoal; import net.minecraft.world.entity.ai.util.DefaultRandomPos; -import net.minecraft.world.entity.monster.ZombifiedPiglin; +import net.minecraft.world.entity.monster.zombie.ZombifiedPiglin; import net.minecraft.world.level.LightLayer; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; diff --git a/src/main/java/carpet/utils/PerimeterDiagnostics.java b/src/main/java/carpet/utils/PerimeterDiagnostics.java index 439f505a..74b4f263 100644 --- a/src/main/java/carpet/utils/PerimeterDiagnostics.java +++ b/src/main/java/carpet/utils/PerimeterDiagnostics.java @@ -13,7 +13,7 @@ import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.MobCategory; import net.minecraft.world.entity.SpawnPlacements; import net.minecraft.world.entity.ambient.AmbientCreature; -import net.minecraft.world.entity.animal.WaterAnimal; +import net.minecraft.world.entity.animal.fish.WaterAnimal; import net.minecraft.world.entity.monster.Enemy; import net.minecraft.world.level.NaturalSpawner; import net.minecraft.world.level.biome.MobSpawnSettings; diff --git a/src/main/java/carpet/utils/SpawnReporter.java b/src/main/java/carpet/utils/SpawnReporter.java index bbcdb166..60bf38aa 100644 --- a/src/main/java/carpet/utils/SpawnReporter.java +++ b/src/main/java/carpet/utils/SpawnReporter.java @@ -21,7 +21,7 @@ import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.MobCategory; import net.minecraft.world.entity.SpawnPlacements; -import net.minecraft.world.entity.animal.Ocelot; +import net.minecraft.world.entity.animal.feline.Ocelot; import net.minecraft.world.item.DyeColor; import net.minecraft.world.level.Level; import net.minecraft.world.level.NaturalSpawner; From 68f9e0901fec68996a887493233d7e1b1207dfdd Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 19 Nov 2025 23:38:19 +0100 Subject: [PATCH 153/232] 1.4.192 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 07d12e46..c82d7415 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ org.gradle.configuration-cache=false fabric_version=0.134.0+1.21.9 # Mod Properties - mod_version = 1.4.191 + mod_version = 1.4.192 maven_group = carpet archives_base_name = fabric-carpet From be9eab18ee88cc13f90e3c0ed2d83b76aa0df019 Mon Sep 17 00:00:00 2001 From: altrisi Date: Wed, 26 Nov 2025 13:44:31 +0100 Subject: [PATCH 154/232] Fix wrong color in HopperCounter displays Fixes #2101 --- src/main/java/carpet/helpers/HopperCounter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/carpet/helpers/HopperCounter.java b/src/main/java/carpet/helpers/HopperCounter.java index 2cd4a987..bff480ef 100644 --- a/src/main/java/carpet/helpers/HopperCounter.java +++ b/src/main/java/carpet/helpers/HopperCounter.java @@ -100,7 +100,7 @@ public class HopperCounter { startTick = -1; this.color = color; - String hexColor = Integer.toHexString(color.getTextColor()); + String hexColor = Integer.toHexString(color.getTextColor() & 0xFFFFFF); // don't get alpha if (hexColor.length() < 6) { hexColor = "0".repeat(6 - hexColor.length()) + hexColor; From 02ede92f7616ebc3d084935136b1ea2e746c184a Mon Sep 17 00:00:00 2001 From: altrisi Date: Wed, 26 Nov 2025 22:51:57 +0100 Subject: [PATCH 155/232] `movableBlockEntities` compat with ScalableLux Fixes #2086 --- .../carpet/mixins/LevelChunk_movableBEMixin.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main/java/carpet/mixins/LevelChunk_movableBEMixin.java b/src/main/java/carpet/mixins/LevelChunk_movableBEMixin.java index 155f66d5..4417cfde 100644 --- a/src/main/java/carpet/mixins/LevelChunk_movableBEMixin.java +++ b/src/main/java/carpet/mixins/LevelChunk_movableBEMixin.java @@ -114,18 +114,21 @@ public abstract class LevelChunk_movableBEMixin extends ChunkAccess implements W if (LightEngine.hasDifferentLightProperties(oldBlockState, newBlockState)) { ProfilerFiller profiler = Profiler.get(); profiler.push("updateSkyLightSources"); - skyLightSources.update(this, x, chunkY, z); + if (skyLightSources != null) // compat with ScalableLux aka Starlight port + { + skyLightSources.update(this, x, chunkY, z); + } profiler.popPush("queueCheckLight"); level.getChunkSource().getLightEngine().checkBlock(blockPos_1); profiler.pop(); } boolean blockChanged = !oldBlockState.is(newBlock); - boolean boolean_1 = (flags & 64) != 0; // moved by pistons + boolean movedByPiston = (flags & Block.UPDATE_MOVE_BY_PISTON) != 0; // moved by pistons boolean sideEffects = (flags & Block.UPDATE_SKIP_BLOCK_ENTITY_SIDEEFFECTS) == 0; if (blockChanged && oldBlockState.hasBlockEntity()) { - if (level instanceof ServerLevel serverLevel && !(oldBlockState.getBlock() instanceof MovingPistonBlock)) { + if (level instanceof ServerLevel && !(oldBlockState.getBlock() instanceof MovingPistonBlock)) { if (sideEffects) { BlockEntity blockEntity = level.getBlockEntity(blockPos_1); if (blockEntity != null) { @@ -140,9 +143,9 @@ public abstract class LevelChunk_movableBEMixin extends ChunkAccess implements W { if (level instanceof ServerLevel serverLevel && !(oldBlockState.getBlock() instanceof MovingPistonBlock)) { - if ((flags & Block.UPDATE_NEIGHBORS) != 0 || boolean_1) + if ((flags & Block.UPDATE_NEIGHBORS) != 0 || movedByPiston) { - oldBlockState.affectNeighborsAfterRemoval(serverLevel, blockPos_1, boolean_1); + oldBlockState.affectNeighborsAfterRemoval(serverLevel, blockPos_1, movedByPiston); } } } @@ -155,7 +158,7 @@ public abstract class LevelChunk_movableBEMixin extends ChunkAccess implements W if (!level.isClientSide() && sideEffects) { // this updates stuff, schedule ticks - do we want that since its only be called from MovingPistonBlock really? - newBlockState.onPlace(level, blockPos_1, oldBlockState, boolean_1); + newBlockState.onPlace(level, blockPos_1, oldBlockState, movedByPiston); } BlockEntity oldBlockEntity = null; From 9f8e6f5168879e9b9b447ec563bb93900c6e1943 Mon Sep 17 00:00:00 2001 From: altrisi Date: Wed, 26 Nov 2025 23:16:37 +0100 Subject: [PATCH 156/232] Don't save config until rule value is checked to be valid Found by #2111 --- src/main/java/carpet/api/settings/SettingsManager.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/carpet/api/settings/SettingsManager.java b/src/main/java/carpet/api/settings/SettingsManager.java index 2b4f341b..480cf51e 100644 --- a/src/main/java/carpet/api/settings/SettingsManager.java +++ b/src/main/java/carpet/api/settings/SettingsManager.java @@ -695,16 +695,16 @@ public class SettingsManager { { if (locked()) return 0; if (!rules.containsKey(rule.name())) return 0; - ConfigReadResult conf = readSettingsFromConf(getFile()); - conf.ruleMap().put(rule.name(), stringValue); - writeSettingsToConf(conf); // this may feels weird, but if conf - // is locked, it will never reach this point. try { rule.set(source, stringValue); Messenger.m(source ,"gi "+String.format(tr(TranslationKeys.DEFAULT_SET), RuleHelper.translatedName(rule), stringValue)); } catch (InvalidRuleValueException e) { e.notifySource(rule.name(), source); + return 0; } + ConfigReadResult conf = readSettingsFromConf(getFile()); + conf.ruleMap().put(rule.name(), stringValue); + writeSettingsToConf(conf); return 1; } // removes overrides of the default values in the file From 505280df73446345b2fde889a85ad57e45f5ba49 Mon Sep 17 00:00:00 2001 From: altrisi Date: Wed, 26 Nov 2025 23:28:09 +0100 Subject: [PATCH 157/232] Remove ctrlQCraftingFix as the bug is fixed In 24w33a (1.21.2) according to MC-135971 --- src/main/java/carpet/CarpetSettings.java | 3 - ...tractContainerMenu_ctrlQCraftingMixin.java | 55 ------------------- src/main/resources/carpet.mixins.json | 1 - 3 files changed, 59 deletions(-) delete mode 100644 src/main/java/carpet/mixins/AbstractContainerMenu_ctrlQCraftingMixin.java diff --git a/src/main/java/carpet/CarpetSettings.java b/src/main/java/carpet/CarpetSettings.java index 8df84e0d..177a29c9 100644 --- a/src/main/java/carpet/CarpetSettings.java +++ b/src/main/java/carpet/CarpetSettings.java @@ -156,9 +156,6 @@ public class CarpetSettings @Rule(desc = "Gbhs sgnf sadsgras fhskdpri!!!", category = EXPERIMENTAL) public static boolean superSecretSetting = false; - @Rule(desc = "Dropping entire stacks works also from on the crafting UI result slot", category = {RuleCategory.BUGFIX, SURVIVAL}) - public static boolean ctrlQCraftingFix = false; - @Rule(desc = "Parrots don't get of your shoulders until you receive proper damage", category = {SURVIVAL, FEATURE}) public static boolean persistentParrots = false; diff --git a/src/main/java/carpet/mixins/AbstractContainerMenu_ctrlQCraftingMixin.java b/src/main/java/carpet/mixins/AbstractContainerMenu_ctrlQCraftingMixin.java deleted file mode 100644 index 49620f21..00000000 --- a/src/main/java/carpet/mixins/AbstractContainerMenu_ctrlQCraftingMixin.java +++ /dev/null @@ -1,55 +0,0 @@ -package carpet.mixins; - -import carpet.CarpetSettings; -import org.spongepowered.asm.mixin.Final; -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.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -import net.minecraft.core.NonNullList; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.inventory.AbstractContainerMenu; -import net.minecraft.world.inventory.ClickType; -import net.minecraft.world.inventory.Slot; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; - -@Mixin(AbstractContainerMenu.class) -public abstract class AbstractContainerMenu_ctrlQCraftingMixin -{ - - @Shadow public abstract void clicked(int int_1, int int_2, ClickType slotActionType_1, Player playerEntity_1); - - @Shadow public abstract void broadcastChanges(); - - @Shadow @Final public NonNullList slots; - - @Shadow protected abstract void resetQuickCraft(); - - @Shadow public abstract ItemStack getCarried(); - - @Inject( method = "doClick", at = @At(value = "HEAD"), cancellable = true) - private void onThrowClick(int slotId, int clickData, ClickType actionType, Player playerEntity, CallbackInfo ci) - { - if (actionType == ClickType.THROW && CarpetSettings.ctrlQCraftingFix && this.getCarried().isEmpty() && slotId >= 0) - { - Slot slot_4 = slots.get(slotId); - if (/*slot_4 != null && */slot_4.hasItem() && slot_4.mayPickup(playerEntity)) - { - if(slotId == 0 && clickData == 1) - { - Item craftedItem = slot_4.getItem().getItem(); - while(slot_4.hasItem() && slot_4.getItem().getItem() == craftedItem) - { - this.clicked(slotId, 0, ClickType.THROW, playerEntity); - } - this.broadcastChanges(); - this.resetQuickCraft(); - ci.cancel(); - } - } - } - } -} diff --git a/src/main/resources/carpet.mixins.json b/src/main/resources/carpet.mixins.json index c2bd87ed..0eed301f 100644 --- a/src/main/resources/carpet.mixins.json +++ b/src/main/resources/carpet.mixins.json @@ -96,7 +96,6 @@ "Player_antiCheatDisabledMixin", "ServerPlayerGameMode_antiCheatMixin", "HopperBlockEntity_counterMixin", - "AbstractContainerMenu_ctrlQCraftingMixin", "Connection_packetCounterMixin", "ItemStack_stackableShulkerBoxesMixin", "ItemEntityMixin", From 75a5d4ee128758a9f0a1932a526b774706e1b621 Mon Sep 17 00:00:00 2001 From: altrisi Date: Wed, 26 Nov 2025 23:44:15 +0100 Subject: [PATCH 158/232] Add a way to display stacktrace of StacklessRuntimeException for debug --- .../carpet/script/exception/StacklessRuntimeException.java | 6 ++++++ src/main/java/carpet/script/external/Carpet.java | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/src/main/java/carpet/script/exception/StacklessRuntimeException.java b/src/main/java/carpet/script/exception/StacklessRuntimeException.java index 476e6aef..13938e4c 100644 --- a/src/main/java/carpet/script/exception/StacklessRuntimeException.java +++ b/src/main/java/carpet/script/exception/StacklessRuntimeException.java @@ -1,5 +1,7 @@ package carpet.script.exception; +import carpet.script.external.Carpet; + /** * A type of {@link RuntimeException} that doesn't spend time producing and filling a stacktrace */ @@ -18,6 +20,10 @@ public abstract class StacklessRuntimeException extends RuntimeException @Override public Throwable fillInStackTrace() { + if (Carpet.isDebugEnabled()) + { + return super.fillInStackTrace(); + } return this; } } diff --git a/src/main/java/carpet/script/external/Carpet.java b/src/main/java/carpet/script/external/Carpet.java index 223fc98b..ef7503f8 100644 --- a/src/main/java/carpet/script/external/Carpet.java +++ b/src/main/java/carpet/script/external/Carpet.java @@ -142,6 +142,11 @@ public class Carpet return CarpetSettings.fillUpdates; } + public static boolean isDebugEnabled() + { + return CarpetSettings.superSecretSetting; + } + @Nullable public static Module fetchGlobalModule(String name, boolean allowLibraries) throws IOException { From 2f67690ec3f6d4f7d72ec4d66d29015a2fcb4f37 Mon Sep 17 00:00:00 2001 From: altrisi Date: Thu, 27 Nov 2025 20:01:30 +0100 Subject: [PATCH 159/232] Don't save player twice when shadowing (#2131) Saving has side effects, such as removing enderpearls --- src/main/java/carpet/patches/EntityPlayerMPFake.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/carpet/patches/EntityPlayerMPFake.java b/src/main/java/carpet/patches/EntityPlayerMPFake.java index 21c5aa47..f51b8a9b 100644 --- a/src/main/java/carpet/patches/EntityPlayerMPFake.java +++ b/src/main/java/carpet/patches/EntityPlayerMPFake.java @@ -136,7 +136,6 @@ public class EntityPlayerMPFake extends ServerPlayer public static EntityPlayerMPFake createShadow(MinecraftServer server, ServerPlayer player) { - player.level().getServer().getPlayerList().remove(player); player.connection.disconnect(Component.translatable("multiplayer.disconnect.duplicate_login")); ServerLevel worldIn = player.level();//.getWorld(player.dimension); GameProfile gameprofile = player.getGameProfile(); From 6e32061d8f08b85252516a8215477ed631b749d3 Mon Sep 17 00:00:00 2001 From: altrisi Date: Fri, 28 Nov 2025 19:32:31 +0100 Subject: [PATCH 160/232] Fix native memory leak when drawing scarpet labels Finally fixes #2057 --- .../java/carpet/script/utils/ShapesRenderer.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/carpet/script/utils/ShapesRenderer.java b/src/main/java/carpet/script/utils/ShapesRenderer.java index 1c2257f8..bfbc1937 100644 --- a/src/main/java/carpet/script/utils/ShapesRenderer.java +++ b/src/main/java/carpet/script/utils/ShapesRenderer.java @@ -561,11 +561,14 @@ public class ShapesRenderer { text_x = (float) (-textRenderer.width(shape.value.getString())); } - MultiBufferSource.BufferSource immediate = MultiBufferSource.immediate(new ByteBufferBuilder(RenderType.TRANSIENT_BUFFER_SIZE)); - // text doesn't appear if backgroud is set - ///script run draw_shape('label', 100, 'pos', [200, 100, 200], 'text', 'Hewwo World!', 'color', 0xffffffff, 'fill', 0x33333333) - textRenderer.drawInBatch(shape.value, text_x, 0.0F, shape.textcolor, false, matrices.last().pose(), immediate, Font.DisplayMode.SEE_THROUGH, shape.textbck, 15728880); - immediate.endBatch(); + try (ByteBufferBuilder bbb = new ByteBufferBuilder(RenderType.TRANSIENT_BUFFER_SIZE)) + { + MultiBufferSource.BufferSource immediate = MultiBufferSource.immediate(bbb); + // text doesn't appear if backgroud is set + ///script run draw_shape('label', 100, 'pos', [200, 100, 200], 'text', 'Hewwo World!', 'color', 0xffffffff, 'fill', 0x33333333) + textRenderer.drawInBatch(shape.value, text_x, 0.0F, shape.textcolor, false, matrices.last().pose(), immediate, Font.DisplayMode.SEE_THROUGH, shape.textbck, 15728880); + immediate.endBatch(); + } matrices.popPose(); ////RenderSystem.enableCull(); } From b1455b8c4177f08a3a1cc63948e51dd5e704cf55 Mon Sep 17 00:00:00 2001 From: altrisi Date: Fri, 28 Nov 2025 20:46:09 +0100 Subject: [PATCH 161/232] Add ON_SHELF variant to draw_shape I don't think item and block displays currently work properly though, or maybe I'm not using them properly --- src/main/java/carpet/script/utils/ShapeDispatcher.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/carpet/script/utils/ShapeDispatcher.java b/src/main/java/carpet/script/utils/ShapeDispatcher.java index d8136e68..91edfc35 100644 --- a/src/main/java/carpet/script/utils/ShapeDispatcher.java +++ b/src/main/java/carpet/script/utils/ShapeDispatcher.java @@ -1485,7 +1485,8 @@ public class ShapeDispatcher "HEAD", "GUI", "GROUND", - "FIXED") + "FIXED", + "ON_SHELF") { @Override public Value validate(Map o, MinecraftServer s, Value v) From dbda1d44829be86d0e1be68e7914b0094c70d987 Mon Sep 17 00:00:00 2001 From: altrisi Date: Fri, 28 Nov 2025 23:35:28 +0100 Subject: [PATCH 162/232] Freeze fake players during tick freeze Closes #1691 --- .../java/carpet/fakes/EntityInterface.java | 4 +++ src/main/java/carpet/mixins/EntityMixin.java | 12 +++++++++ .../TickRateManager_fakePlayersMixin.java | 26 +++++++++++++++++++ src/main/resources/carpet.mixins.json | 1 + 4 files changed, 43 insertions(+) create mode 100644 src/main/java/carpet/mixins/TickRateManager_fakePlayersMixin.java diff --git a/src/main/java/carpet/fakes/EntityInterface.java b/src/main/java/carpet/fakes/EntityInterface.java index 80093eda..6234ce07 100644 --- a/src/main/java/carpet/fakes/EntityInterface.java +++ b/src/main/java/carpet/fakes/EntityInterface.java @@ -1,6 +1,9 @@ package carpet.fakes; +import java.util.stream.Stream; + import carpet.script.EntityEventsGroup; +import net.minecraft.world.entity.Entity; public interface EntityInterface { @@ -19,4 +22,5 @@ public interface EntityInterface int getPublicNetherPortalCooldown(); void setPublicNetherPortalCooldown(int what); + Stream cm$getIndirectPassengersStream(); } diff --git a/src/main/java/carpet/mixins/EntityMixin.java b/src/main/java/carpet/mixins/EntityMixin.java index 42f09a9c..4c781b08 100644 --- a/src/main/java/carpet/mixins/EntityMixin.java +++ b/src/main/java/carpet/mixins/EntityMixin.java @@ -6,6 +6,9 @@ import net.minecraft.util.Mth; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.level.Level; + +import java.util.stream.Stream; + import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -37,4 +40,13 @@ public abstract class EntityMixin implements EntityInterface { if (getControllingPassenger() instanceof EntityPlayerMPFake) cir.setReturnValue(!level.isClientSide()); } + + @Shadow + protected abstract Stream getIndirectPassengersStream(); + + @Override + public Stream cm$getIndirectPassengersStream() + { + return this.getIndirectPassengersStream(); + } } diff --git a/src/main/java/carpet/mixins/TickRateManager_fakePlayersMixin.java b/src/main/java/carpet/mixins/TickRateManager_fakePlayersMixin.java new file mode 100644 index 00000000..170ce137 --- /dev/null +++ b/src/main/java/carpet/mixins/TickRateManager_fakePlayersMixin.java @@ -0,0 +1,26 @@ +package carpet.mixins; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; + +import com.llamalad7.mixinextras.injector.ModifyReturnValue; + +import carpet.fakes.EntityInterface; +import carpet.patches.EntityPlayerMPFake; +import net.minecraft.world.TickRateManager; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.player.Player; + +@Mixin(TickRateManager.class) +abstract class TickRateManager_fakePlayersMixin { + @Shadow + abstract boolean runsNormally(); + + @ModifyReturnValue(method = "isEntityFrozen", at = @At("TAIL")) + private boolean handler(boolean alreadyFrozen, Entity entity) { + if (alreadyFrozen) return true; + return !runsNormally() && (entity instanceof EntityPlayerMPFake) + && !((EntityInterface) entity).cm$getIndirectPassengersStream().anyMatch(e -> e instanceof Player && !(e instanceof EntityPlayerMPFake)); + } +} diff --git a/src/main/resources/carpet.mixins.json b/src/main/resources/carpet.mixins.json index 0eed301f..ea6587fa 100644 --- a/src/main/resources/carpet.mixins.json +++ b/src/main/resources/carpet.mixins.json @@ -49,6 +49,7 @@ "MobMixin", "Villager_aiMixin", "Player_fakePlayersMixin", + "TickRateManager_fakePlayersMixin", "ServerGamePacketListenerImpl_coreMixin", "MinecraftServer_scarpetMixin", "ExperienceOrb_xpNoCooldownMixin", From e1503bae72c088908d25b2edcc96c17e41ad1d48 Mon Sep 17 00:00:00 2001 From: altrisi Date: Sat, 29 Nov 2025 03:28:22 +0100 Subject: [PATCH 163/232] More readable check for freezing fake players And properly freeze entities with fake players riding them --- .../TickRateManager_fakePlayersMixin.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/main/java/carpet/mixins/TickRateManager_fakePlayersMixin.java b/src/main/java/carpet/mixins/TickRateManager_fakePlayersMixin.java index 170ce137..75c95e1c 100644 --- a/src/main/java/carpet/mixins/TickRateManager_fakePlayersMixin.java +++ b/src/main/java/carpet/mixins/TickRateManager_fakePlayersMixin.java @@ -2,6 +2,7 @@ package carpet.mixins; 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 com.llamalad7.mixinextras.injector.ModifyReturnValue; @@ -18,9 +19,20 @@ abstract class TickRateManager_fakePlayersMixin { abstract boolean runsNormally(); @ModifyReturnValue(method = "isEntityFrozen", at = @At("TAIL")) - private boolean handler(boolean alreadyFrozen, Entity entity) { + private boolean handler(boolean alreadyFrozen, Entity entity) + { if (alreadyFrozen) return true; - return !runsNormally() && (entity instanceof EntityPlayerMPFake) - && !((EntityInterface) entity).cm$getIndirectPassengersStream().anyMatch(e -> e instanceof Player && !(e instanceof EntityPlayerMPFake)); + if (runsNormally()) return false; + + return !isActualPlayer(entity) && // not carrying players + ((EntityInterface) entity) + .cm$getIndirectPassengersStream() + .noneMatch(TickRateManager_fakePlayersMixin::isActualPlayer); + } + + @Unique + private static boolean isActualPlayer(Entity e) + { + return e instanceof Player && !(e instanceof EntityPlayerMPFake); } } From 469a9356f61b4c2cf83e64d85a32618838d0efb2 Mon Sep 17 00:00:00 2001 From: altrisi Date: Sat, 29 Nov 2025 19:30:54 +0100 Subject: [PATCH 164/232] Fix `player_takes_damage` and `player_deals_damage`: Use correct source Fixes #2042, relates to #2121 --- src/main/java/carpet/script/CarpetEventServer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/carpet/script/CarpetEventServer.java b/src/main/java/carpet/script/CarpetEventServer.java index 677f412d..8ed822e2 100644 --- a/src/main/java/carpet/script/CarpetEventServer.java +++ b/src/main/java/carpet/script/CarpetEventServer.java @@ -886,7 +886,7 @@ public class CarpetEventServer new NumericValue(amount), StringValue.of(source.getMsgId()), source.getEntity() == null ? Value.NULL : new EntityValue(source.getEntity()) - ), () -> target.level().getServer().createCommandSourceStack()); + ), () -> ((ServerPlayer) target).createCommandSourceStack()); } }; public static final Event PLAYER_DEALS_DAMAGE = new Event("player_deals_damage", 3, false) @@ -896,7 +896,7 @@ public class CarpetEventServer { return handler.call(() -> Arrays.asList(new EntityValue(source.getEntity()), new NumericValue(amount), new EntityValue(target)), - () -> source.getEntity().level().getServer().createCommandSourceStack() + () -> ((ServerPlayer) source.getEntity()).createCommandSourceStack() ); } }; From c9b90ab7661f3cf44d6439132196619fdd687629 Mon Sep 17 00:00:00 2001 From: altrisi Date: Sat, 29 Nov 2025 20:41:56 +0100 Subject: [PATCH 165/232] Fix scarpet's `unmountable` attribute --- docs/scarpet/api/Entities.md | 4 ++-- src/main/java/carpet/mixins/Player_scarpetEventsMixin.java | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/scarpet/api/Entities.md b/docs/scarpet/api/Entities.md index 6d37ea3d..31aca4e4 100644 --- a/docs/scarpet/api/Entities.md +++ b/docs/scarpet/api/Entities.md @@ -204,7 +204,7 @@ Entity that `e` rides. ### `query(e, 'unmountable')` -Boolean, true if the entity cannot be mounted. +Boolean, true if the entity cannot be unmounted. ### `(deprecated) query(e, 'tags')` @@ -727,7 +727,7 @@ Mounts the entity to the `other`. ### `modify(e, 'unmountable', boolean)` -Denies or allows an entity to be mounted. +Denies or allows an entity to be unmounted. ### `modify(e, 'drop_passengers')` diff --git a/src/main/java/carpet/mixins/Player_scarpetEventsMixin.java b/src/main/java/carpet/mixins/Player_scarpetEventsMixin.java index 9c8fa375..0d181f5b 100644 --- a/src/main/java/carpet/mixins/Player_scarpetEventsMixin.java +++ b/src/main/java/carpet/mixins/Player_scarpetEventsMixin.java @@ -18,6 +18,7 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.LocalCapture; +import com.llamalad7.mixinextras.injector.ModifyReturnValue; import static carpet.script.CarpetEventServer.Event.PLAYER_ATTACKS_ENTITY; import static carpet.script.CarpetEventServer.Event.PLAYER_DEALS_DAMAGE; @@ -86,4 +87,10 @@ public abstract class Player_scarpetEventsMixin extends LivingEntity } } } + + @ModifyReturnValue(method = "wantsToStopRiding", at = @At("TAIL")) + private boolean dontUnmountFromIfPermanentVehicle(boolean original) + { + return original && !((EntityInterface) this.getVehicle()).isPermanentVehicle(); + } } From 1e6860fdd923ca1d901c136e95e5412ed6536d48 Mon Sep 17 00:00:00 2001 From: altrisi Date: Sat, 29 Nov 2025 21:00:57 +0100 Subject: [PATCH 166/232] Fix `on_player_rides` being called from the wrong thread --- ...PacketListenerImpl_scarpetEventsMixin.java | 55 ++++++++----------- 1 file changed, 24 insertions(+), 31 deletions(-) diff --git a/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java b/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java index b29d46c0..75b4fa98 100644 --- a/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java +++ b/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java @@ -1,6 +1,5 @@ package carpet.mixins; -import carpet.fakes.EntityInterface; import net.minecraft.network.protocol.game.ServerboundChatCommandPacket; import net.minecraft.world.entity.player.Input; import net.minecraft.world.item.crafting.RecipeManager; @@ -48,22 +47,37 @@ import net.minecraft.world.InteractionHand; import net.minecraft.world.item.ItemStack; import net.minecraft.world.phys.BlockHitResult; - @Mixin(ServerGamePacketListenerImpl.class) public class ServerGamePacketListenerImpl_scarpetEventsMixin { @Shadow public ServerPlayer player; - @Inject(method = "handlePlayerInput", at = @At("HEAD")) - private void checkMoves(ServerboundPlayerInputPacket p, CallbackInfo ci) + + + @Inject(method = "handlePlayerInput", at = @At( + value = "INVOKE", + target = "Lnet/minecraft/server/level/ServerPlayer;setLastClientInput(Lnet/minecraft/world/entity/player/Input;)V" + )) + private void checkMovement(ServerboundPlayerInputPacket packet, CallbackInfo ci) { - // todo this may not ride on the right thread moment, so needs to be checked - - Input input = p.input(); - - if (player.getVehicle() != null && !((EntityInterface)player.getVehicle()).isPermanentVehicle()) // won't since that method makes sure its not null - player.setShiftKeyDown(p.input().shift()); + Input input = packet.input(); + + // sneak events + boolean wasDown = player.isShiftKeyDown(); + boolean isDown = input.shift(); + if (wasDown != isDown) + { + if (isDown) + { + PLAYER_STARTS_SNEAKING.onPlayerEvent(player); + } + else + { + PLAYER_STOPS_SNEAKING.onPlayerEvent(player); + } + } + // ride event, which should check for mount? if (PLAYER_RIDES.isNeeded() && (input.jump() || input.shift() || input.forward() || input.backward() || input.left() || input.right())) { PLAYER_RIDES.onMountControls(player, input.left() == input.right() ? 0 : (input.left() ? -1 : 1 ), input.forward() == input.backward() ? 0 : (input.forward() ? 1 : -1), input.jump(), input.shift()); @@ -180,27 +194,6 @@ public class ServerGamePacketListenerImpl_scarpetEventsMixin } } - @Inject(method = "handlePlayerInput", at = @At( - value = "INVOKE", - target = "Lnet/minecraft/server/level/ServerPlayer;setLastClientInput(Lnet/minecraft/world/entity/player/Input;)V" - )) - private void onStartSneaking(ServerboundPlayerInputPacket serverboundPlayerInputPacket, CallbackInfo ci) - { - boolean wasDown = player.isShiftKeyDown(); - boolean isDown = serverboundPlayerInputPacket.input().shift(); - if (wasDown != isDown) - { - if (isDown) - { - PLAYER_STARTS_SNEAKING.onPlayerEvent(player); - } - else - { - PLAYER_STOPS_SNEAKING.onPlayerEvent(player); - } - } - } - @Inject(method = "handlePlayerCommand", at = @At( value = "INVOKE", target = "Lnet/minecraft/server/level/ServerPlayer;setSprinting(Z)V", From 47f5bdf31850a7e65259eebbeeedc08be870ebcd Mon Sep 17 00:00:00 2001 From: altrisi Date: Sat, 29 Nov 2025 21:27:09 +0100 Subject: [PATCH 167/232] Fix `on_player_swaps_hands` firing on stab instead of when it should --- .../mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java b/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java index 75b4fa98..624790e0 100644 --- a/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java +++ b/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java @@ -100,7 +100,7 @@ public class ServerGamePacketListenerImpl_scarpetEventsMixin @Inject(method = "handlePlayerAction", cancellable = true, at = @At( value = "INVOKE", target = "Lnet/minecraft/server/level/ServerPlayer;getItemInHand(Lnet/minecraft/world/InteractionHand;)Lnet/minecraft/world/item/ItemStack;", - ordinal = 0, + ordinal = 1, // not very robust, see spear shift = At.Shift.BEFORE )) private void onHandSwap(ServerboundPlayerActionPacket playerActionC2SPacket_1, CallbackInfo ci) From 2a958920e212eb13889c1ef2e38e4c005e1e3a33 Mon Sep 17 00:00:00 2001 From: altrisi Date: Sat, 29 Nov 2025 21:40:47 +0100 Subject: [PATCH 168/232] Fix `on_player_command` firing on the wrong thread --- .../mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java b/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java index 624790e0..792124b2 100644 --- a/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java +++ b/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java @@ -280,7 +280,7 @@ public class ServerGamePacketListenerImpl_scarpetEventsMixin } } - @Inject(method = "handleChatCommand(Lnet/minecraft/network/protocol/game/ServerboundChatCommandPacket;)V", + @Inject(method = "method_44356", // lambda of handleChatCommand(ServerboundChatCommandPacket) at = @At(value = "HEAD") ) private void onChatCommandMessage(ServerboundChatCommandPacket serverboundChatCommandPacket, CallbackInfo ci) { From aa276e6056fe2b5ffcb723e4e9ba66c9a601dbfc Mon Sep 17 00:00:00 2001 From: altrisi Date: Sat, 29 Nov 2025 22:07:47 +0100 Subject: [PATCH 169/232] Correct fake player perspective when they start riding a boat Fixes #2100 --- .../java/carpet/patches/EntityPlayerMPFake.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/main/java/carpet/patches/EntityPlayerMPFake.java b/src/main/java/carpet/patches/EntityPlayerMPFake.java index f51b8a9b..5db6d5ea 100644 --- a/src/main/java/carpet/patches/EntityPlayerMPFake.java +++ b/src/main/java/carpet/patches/EntityPlayerMPFake.java @@ -26,6 +26,7 @@ import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.vehicle.boat.AbstractBoat; import net.minecraft.world.food.FoodData; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.component.ResolvableProfile; @@ -219,8 +220,21 @@ public class EntityPlayerMPFake extends ServerPlayer // happens with that paper port thingy - not sure what that would fix, but hey // the game not gonna crash violently. } + } - + @Override + public boolean startRiding(Entity entityToRide, boolean force, boolean sendEventAndTriggers) { + if (super.startRiding(entityToRide, force, sendEventAndTriggers)) { + // from ClientPacketListener.handleSetEntityPassengersPacket + if (entityToRide instanceof AbstractBoat) { + this.yRotO = entityToRide.getYRot(); + this.setYRot(entityToRide.getYRot()); + this.setYHeadRot(entityToRide.getYRot()); + } + return true; + } else { + return false; + } } private void shakeOff() From 0292c61c52a24aedd9105b4661927591003fc3d8 Mon Sep 17 00:00:00 2001 From: altrisi Date: Sun, 30 Nov 2025 19:45:21 +0100 Subject: [PATCH 170/232] Remove deprecated `CarpetExtension.customSettingsManager` All extensions I've found using a custom manager have migrated --- src/main/java/carpet/CarpetExtension.java | 8 +------- src/main/java/carpet/CarpetServer.java | 9 --------- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/src/main/java/carpet/CarpetExtension.java b/src/main/java/carpet/CarpetExtension.java index e7a742cd..a22333ef 100644 --- a/src/main/java/carpet/CarpetExtension.java +++ b/src/main/java/carpet/CarpetExtension.java @@ -84,13 +84,7 @@ public interface CarpetExtension * */ default SettingsManager extensionSettingsManager() { - // Warn extensions overriding the other (deprecated) method, go ahead and override this if you want to provide a custom SettingsManager - SettingsManager deprecatedManager = customSettingsManager(); - if (deprecatedManager != null) { - // Extension is providing a manager via the old method (and also hasn't overriden this) - CarpetServer.warnOutdatedManager(this); - } - return customSettingsManager(); + return null; } /** diff --git a/src/main/java/carpet/CarpetServer.java b/src/main/java/carpet/CarpetServer.java index ed85b9c8..41327dbe 100644 --- a/src/main/java/carpet/CarpetServer.java +++ b/src/main/java/carpet/CarpetServer.java @@ -226,14 +226,5 @@ public class CarpetServer // static for now - easier to handle all around the co scriptServer.reload(server); extensions.forEach(e -> e.onReload(server)); } - - private static final Set warnedOutdatedManagerProviders = new HashSet<>(); - static void warnOutdatedManager(CarpetExtension ext) - { - if (warnedOutdatedManagerProviders.add(ext)) - CarpetSettings.LOG.warn(""" - %s is providing a SettingsManager from an outdated method in CarpetExtension! - This behaviour will not work in later Carpet versions and the manager won't be registered!""".formatted(ext.getClass().getName())); - } } From cd9d6251755ba1a101eb61674cc8c1620901811a Mon Sep 17 00:00:00 2001 From: altrisi Date: Sun, 30 Nov 2025 19:51:18 +0100 Subject: [PATCH 171/232] Missed half of the commit --- src/main/java/carpet/CarpetExtension.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/main/java/carpet/CarpetExtension.java b/src/main/java/carpet/CarpetExtension.java index a22333ef..c3277e18 100644 --- a/src/main/java/carpet/CarpetExtension.java +++ b/src/main/java/carpet/CarpetExtension.java @@ -70,12 +70,6 @@ public interface CarpetExtension registerCommands(dispatcher); } - /** - * @deprecated Implement {@link #extensionSettingsManager()} instead - */ - @Deprecated(forRemoval = true) - default carpet.settings.SettingsManager customSettingsManager() {return null;} - /** * Provide your own custom settings manager managed in the same way as base /carpet * command, but separated to its own command as defined in SettingsManager. From 8395fae963444b106b6181ba5f1fb41a09c95649 Mon Sep 17 00:00:00 2001 From: altrisi Date: Mon, 1 Dec 2025 13:36:33 +0100 Subject: [PATCH 172/232] Bump Loom to 1.13 Fix Gradle warning and remove ancient 0.2.1 comment --- build.gradle | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 4e14729d..3db5c988 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '1.11-SNAPSHOT' + id 'fabric-loom' version '1.13-SNAPSHOT' id 'maven-publish' } @@ -25,8 +25,6 @@ dependencies { //modImplementation "net.fabricmc:fabric:${project.fabric_version}" //modCompileOnly fabricApi.module("fabric-rendering-v1", project.fabric_version) - // PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs. - // You may need to force-disable transitiveness on them. compileOnly "com.google.code.findbugs:jsr305:${project.jsr305_version}" } @@ -79,7 +77,7 @@ publishing { repositories { // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. maven { - url "$projectDir/publish" + url = "$projectDir/publish" } } } From 5e8b4ece5b2b2d102ebffabb3f5181ebaee303a4 Mon Sep 17 00:00:00 2001 From: altrisi Date: Mon, 1 Dec 2025 13:46:33 +0100 Subject: [PATCH 173/232] Migrate nullability annotations to jSpecify Mojang has done that, we don't need 3 different sets of annotations --- build.gradle | 2 -- src/main/java/carpet/CarpetServer.java | 2 +- src/main/java/carpet/mixins/RedstoneWireBlock_fastMixin.java | 2 +- src/main/java/carpet/script/CarpetExpression.java | 2 +- src/main/java/carpet/script/CarpetScriptHost.java | 2 +- src/main/java/carpet/script/CarpetScriptServer.java | 2 +- src/main/java/carpet/script/Expression.java | 2 +- src/main/java/carpet/script/ScriptCommand.java | 2 +- src/main/java/carpet/script/ScriptHost.java | 5 ++--- src/main/java/carpet/script/Token.java | 5 ++--- src/main/java/carpet/script/annotation/ListConverter.java | 2 +- src/main/java/carpet/script/annotation/Locator.java | 5 ++--- src/main/java/carpet/script/annotation/MapConverter.java | 2 +- .../java/carpet/script/annotation/OptionalConverter.java | 2 +- src/main/java/carpet/script/annotation/OutputConverter.java | 2 +- src/main/java/carpet/script/annotation/Param.java | 2 +- .../java/carpet/script/annotation/SimpleTypeConverter.java | 2 +- src/main/java/carpet/script/annotation/ValueCaster.java | 2 +- src/main/java/carpet/script/annotation/ValueConverter.java | 2 +- src/main/java/carpet/script/api/Auxiliary.java | 2 +- src/main/java/carpet/script/api/WorldAccess.java | 2 +- src/main/java/carpet/script/argument/BlockArgument.java | 2 +- src/main/java/carpet/script/argument/FileArgument.java | 2 +- src/main/java/carpet/script/argument/FunctionArgument.java | 2 +- src/main/java/carpet/script/argument/Vector3Argument.java | 2 +- src/main/java/carpet/script/command/CommandArgument.java | 2 +- src/main/java/carpet/script/command/CommandToken.java | 2 +- src/main/java/carpet/script/exception/BreakStatement.java | 2 +- src/main/java/carpet/script/exception/ContinueStatement.java | 2 +- src/main/java/carpet/script/exception/ExitStatement.java | 2 +- .../java/carpet/script/exception/ExpressionException.java | 2 +- src/main/java/carpet/script/exception/Throwables.java | 2 +- src/main/java/carpet/script/external/Carpet.java | 2 +- src/main/java/carpet/script/utils/AppStoreManager.java | 2 +- src/main/java/carpet/script/utils/FeatureGenerator.java | 2 +- src/main/java/carpet/script/utils/GlocalFlag.java | 2 +- src/main/java/carpet/script/utils/ParticleParser.java | 2 +- src/main/java/carpet/script/utils/ShapeDispatcher.java | 2 +- src/main/java/carpet/script/utils/WorldTools.java | 2 +- src/main/java/carpet/script/utils/shapes/ShapeDirection.java | 2 +- src/main/java/carpet/script/value/BlockValue.java | 2 +- src/main/java/carpet/script/value/EntityValue.java | 2 +- src/main/java/carpet/script/value/FunctionValue.java | 2 +- src/main/java/carpet/script/value/NBTSerializableValue.java | 2 +- src/main/java/carpet/script/value/ScreenValue.java | 2 +- src/main/java/carpet/script/value/StringValue.java | 2 +- src/main/java/carpet/script/value/Value.java | 2 +- src/main/java/carpet/script/value/ValueConversions.java | 2 +- src/main/java/carpet/utils/WoolTool.java | 2 +- 49 files changed, 51 insertions(+), 56 deletions(-) diff --git a/build.gradle b/build.gradle index 3db5c988..f31ed9b6 100644 --- a/build.gradle +++ b/build.gradle @@ -24,8 +24,6 @@ dependencies { // Fabric API. This is technically optional, but you probably want it anyway. //modImplementation "net.fabricmc:fabric:${project.fabric_version}" //modCompileOnly fabricApi.module("fabric-rendering-v1", project.fabric_version) - - compileOnly "com.google.code.findbugs:jsr305:${project.jsr305_version}" } processResources { diff --git a/src/main/java/carpet/CarpetServer.java b/src/main/java/carpet/CarpetServer.java index 41327dbe..49b6e6ce 100644 --- a/src/main/java/carpet/CarpetServer.java +++ b/src/main/java/carpet/CarpetServer.java @@ -40,7 +40,7 @@ import net.minecraft.server.MinecraftServer; import net.minecraft.server.commands.PerfCommand; import net.minecraft.server.level.ServerPlayer; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; public class CarpetServer // static for now - easier to handle all around the code, its one anyways { diff --git a/src/main/java/carpet/mixins/RedstoneWireBlock_fastMixin.java b/src/main/java/carpet/mixins/RedstoneWireBlock_fastMixin.java index 5cdceb9a..101ef513 100644 --- a/src/main/java/carpet/mixins/RedstoneWireBlock_fastMixin.java +++ b/src/main/java/carpet/mixins/RedstoneWireBlock_fastMixin.java @@ -25,7 +25,7 @@ import net.minecraft.world.level.block.RedStoneWireBlock; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; import static net.minecraft.world.level.block.RedStoneWireBlock.POWER; diff --git a/src/main/java/carpet/script/CarpetExpression.java b/src/main/java/carpet/script/CarpetExpression.java index 9ca41018..f68407e4 100644 --- a/src/main/java/carpet/script/CarpetExpression.java +++ b/src/main/java/carpet/script/CarpetExpression.java @@ -22,7 +22,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.world.entity.Entity; import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; import java.util.List; public class CarpetExpression diff --git a/src/main/java/carpet/script/CarpetScriptHost.java b/src/main/java/carpet/script/CarpetScriptHost.java index 073db7e8..fecd5767 100644 --- a/src/main/java/carpet/script/CarpetScriptHost.java +++ b/src/main/java/carpet/script/CarpetScriptHost.java @@ -41,7 +41,7 @@ import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; import java.math.BigInteger; import java.nio.file.Path; import java.util.ArrayList; diff --git a/src/main/java/carpet/script/CarpetScriptServer.java b/src/main/java/carpet/script/CarpetScriptServer.java index d3382518..c3b08b35 100644 --- a/src/main/java/carpet/script/CarpetScriptServer.java +++ b/src/main/java/carpet/script/CarpetScriptServer.java @@ -31,7 +31,7 @@ import net.minecraft.world.level.storage.LevelResource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; import java.io.IOException; import java.nio.file.FileVisitOption; import java.nio.file.Files; diff --git a/src/main/java/carpet/script/Expression.java b/src/main/java/carpet/script/Expression.java index 3105d295..342a0e69 100644 --- a/src/main/java/carpet/script/Expression.java +++ b/src/main/java/carpet/script/Expression.java @@ -38,7 +38,7 @@ import it.unimi.dsi.fastutil.objects.ObjectArrayList; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; import java.math.BigInteger; import java.util.ArrayList; import java.util.Collections; diff --git a/src/main/java/carpet/script/ScriptCommand.java b/src/main/java/carpet/script/ScriptCommand.java index 02373ab6..d56a1725 100644 --- a/src/main/java/carpet/script/ScriptCommand.java +++ b/src/main/java/carpet/script/ScriptCommand.java @@ -48,7 +48,7 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.pattern.BlockInWorld; import net.minecraft.world.level.levelgen.structure.BoundingBox; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; import static net.minecraft.commands.Commands.argument; import static net.minecraft.commands.Commands.literal; diff --git a/src/main/java/carpet/script/ScriptHost.java b/src/main/java/carpet/script/ScriptHost.java index 4dd06d5f..298b877d 100644 --- a/src/main/java/carpet/script/ScriptHost.java +++ b/src/main/java/carpet/script/ScriptHost.java @@ -10,7 +10,7 @@ import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; import java.nio.file.Path; import java.util.HashMap; import java.util.HashSet; @@ -38,8 +38,7 @@ public abstract class ScriptHost protected boolean inTermination = false; public boolean strict; public Expression.LoadOverride loadOverrides; - @Nullable - public Expression.ExpressionNode root; + public Expression.@Nullable ExpressionNode root; private final Set deprecations = new HashSet<>(); diff --git a/src/main/java/carpet/script/Token.java b/src/main/java/carpet/script/Token.java index c0fa53e8..3138da62 100644 --- a/src/main/java/carpet/script/Token.java +++ b/src/main/java/carpet/script/Token.java @@ -1,6 +1,6 @@ package carpet.script; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; public class Token implements Comparable { @@ -36,8 +36,7 @@ public class Token implements Comparable { public int linepos; public int lineno; - @Nullable - public Expression.ExpressionNode node = null; + public Expression.@Nullable ExpressionNode node = null; public static final Token NONE = new Token(); diff --git a/src/main/java/carpet/script/annotation/ListConverter.java b/src/main/java/carpet/script/annotation/ListConverter.java index b02d501f..6889457f 100644 --- a/src/main/java/carpet/script/annotation/ListConverter.java +++ b/src/main/java/carpet/script/annotation/ListConverter.java @@ -10,7 +10,7 @@ import carpet.script.Context; import carpet.script.value.ListValue; import carpet.script.value.Value; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; /** *

    Converts a given {@link ListValue} into a {@link List} of values converted to {@code }.

    diff --git a/src/main/java/carpet/script/annotation/Locator.java b/src/main/java/carpet/script/annotation/Locator.java index af592743..d38e7435 100644 --- a/src/main/java/carpet/script/annotation/Locator.java +++ b/src/main/java/carpet/script/annotation/Locator.java @@ -20,7 +20,7 @@ import carpet.script.value.BlockValue; import carpet.script.value.FunctionValue; import carpet.script.value.Value; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.ElementType.TYPE_USE; @@ -165,9 +165,8 @@ public interface Locator } } - @Nullable @SuppressWarnings("unchecked") - private static java.util.function.Function getReturnFunction(Class type) + private static java.util.function.@Nullable Function getReturnFunction(Class type) { if (type == BlockArgument.class) { diff --git a/src/main/java/carpet/script/annotation/MapConverter.java b/src/main/java/carpet/script/annotation/MapConverter.java index dc818a24..ce14394a 100644 --- a/src/main/java/carpet/script/annotation/MapConverter.java +++ b/src/main/java/carpet/script/annotation/MapConverter.java @@ -13,7 +13,7 @@ import carpet.script.value.ListValue; import carpet.script.value.MapValue; import carpet.script.value.Value; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; /** *

    Converts a {@link MapValue} to a {@link Map}, converting all of its contents to their respective types.

    diff --git a/src/main/java/carpet/script/annotation/OptionalConverter.java b/src/main/java/carpet/script/annotation/OptionalConverter.java index 462bf83e..506cfdc2 100644 --- a/src/main/java/carpet/script/annotation/OptionalConverter.java +++ b/src/main/java/carpet/script/annotation/OptionalConverter.java @@ -9,7 +9,7 @@ import java.util.Optional; import carpet.script.Context; import carpet.script.value.Value; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; /** *

    {@link ValueConverter} that accepts a parameter to not be present on function call.

    diff --git a/src/main/java/carpet/script/annotation/OutputConverter.java b/src/main/java/carpet/script/annotation/OutputConverter.java index b0219d21..88731023 100644 --- a/src/main/java/carpet/script/annotation/OutputConverter.java +++ b/src/main/java/carpet/script/annotation/OutputConverter.java @@ -25,7 +25,7 @@ import carpet.script.value.StringValue; import carpet.script.value.Value; import carpet.script.value.ValueConversions; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; /** *

    A converter from a given {@link Object} of type T into a {@link Value}, used in order to convert the outputs of methods into usable Scarpet diff --git a/src/main/java/carpet/script/annotation/Param.java b/src/main/java/carpet/script/annotation/Param.java index 703bece6..91beffa9 100644 --- a/src/main/java/carpet/script/annotation/Param.java +++ b/src/main/java/carpet/script/annotation/Param.java @@ -23,7 +23,7 @@ import net.minecraft.network.chat.Component; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.ElementType.TYPE_USE; diff --git a/src/main/java/carpet/script/annotation/SimpleTypeConverter.java b/src/main/java/carpet/script/annotation/SimpleTypeConverter.java index 87c4f25e..6fde9156 100644 --- a/src/main/java/carpet/script/annotation/SimpleTypeConverter.java +++ b/src/main/java/carpet/script/annotation/SimpleTypeConverter.java @@ -18,7 +18,7 @@ import carpet.script.value.NumericValue; import carpet.script.value.Value; import carpet.script.value.ValueConversions; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; /** *

    A simple {@link ValueConverter} implementation that converts from a specified subclass of {@link Value} into {@code } by using a given diff --git a/src/main/java/carpet/script/annotation/ValueCaster.java b/src/main/java/carpet/script/annotation/ValueCaster.java index 6cd2624e..1320f97e 100644 --- a/src/main/java/carpet/script/annotation/ValueCaster.java +++ b/src/main/java/carpet/script/annotation/ValueCaster.java @@ -18,7 +18,7 @@ import carpet.script.value.StringValue; import carpet.script.value.ThreadValue; import carpet.script.value.Value; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; /** *

    Simple {@link ValueConverter} implementation that casts a {@link Value} into one of its subclasses, either for use directly in parameters or diff --git a/src/main/java/carpet/script/annotation/ValueConverter.java b/src/main/java/carpet/script/annotation/ValueConverter.java index 8c916ef4..f2893e40 100644 --- a/src/main/java/carpet/script/annotation/ValueConverter.java +++ b/src/main/java/carpet/script/annotation/ValueConverter.java @@ -14,7 +14,7 @@ import carpet.script.Context; import carpet.script.annotation.Param.Params; import carpet.script.value.Value; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; /** *

    Classes implementing this interface are able to convert {@link Value} instances into {@code }, in order to easily use them in parameters for diff --git a/src/main/java/carpet/script/api/Auxiliary.java b/src/main/java/carpet/script/api/Auxiliary.java index b1541734..94969b00 100644 --- a/src/main/java/carpet/script/api/Auxiliary.java +++ b/src/main/java/carpet/script/api/Auxiliary.java @@ -81,7 +81,7 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonElement; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; import java.io.BufferedWriter; import java.io.IOException; import java.net.URI; diff --git a/src/main/java/carpet/script/api/WorldAccess.java b/src/main/java/carpet/script/api/WorldAccess.java index b651aafa..403641b5 100644 --- a/src/main/java/carpet/script/api/WorldAccess.java +++ b/src/main/java/carpet/script/api/WorldAccess.java @@ -132,7 +132,7 @@ import net.minecraft.world.level.pathfinder.PathComputationType; import net.minecraft.world.level.storage.ServerLevelData; import net.minecraft.world.phys.Vec3; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; import static carpet.script.utils.WorldTools.canHasChunk; diff --git a/src/main/java/carpet/script/argument/BlockArgument.java b/src/main/java/carpet/script/argument/BlockArgument.java index b9f1040d..7219c85a 100644 --- a/src/main/java/carpet/script/argument/BlockArgument.java +++ b/src/main/java/carpet/script/argument/BlockArgument.java @@ -14,7 +14,7 @@ import java.util.NoSuchElementException; import net.minecraft.core.BlockPos; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; public class BlockArgument extends Argument { diff --git a/src/main/java/carpet/script/argument/FileArgument.java b/src/main/java/carpet/script/argument/FileArgument.java index f4853a5a..12d0ea2c 100644 --- a/src/main/java/carpet/script/argument/FileArgument.java +++ b/src/main/java/carpet/script/argument/FileArgument.java @@ -22,7 +22,7 @@ import net.minecraft.nbt.TagTypes; import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.BufferedWriter; diff --git a/src/main/java/carpet/script/argument/FunctionArgument.java b/src/main/java/carpet/script/argument/FunctionArgument.java index b30f2f56..9667dd40 100644 --- a/src/main/java/carpet/script/argument/FunctionArgument.java +++ b/src/main/java/carpet/script/argument/FunctionArgument.java @@ -10,7 +10,7 @@ import carpet.script.value.ListValue; import carpet.script.value.Value; import com.mojang.brigadier.exceptions.CommandSyntaxException; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; import java.util.ArrayList; import java.util.Collections; import java.util.List; diff --git a/src/main/java/carpet/script/argument/Vector3Argument.java b/src/main/java/carpet/script/argument/Vector3Argument.java index 6f475f44..7ca3356c 100644 --- a/src/main/java/carpet/script/argument/Vector3Argument.java +++ b/src/main/java/carpet/script/argument/Vector3Argument.java @@ -14,7 +14,7 @@ import java.util.NoSuchElementException; import net.minecraft.world.entity.Entity; import net.minecraft.world.phys.Vec3; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; public class Vector3Argument extends Argument { diff --git a/src/main/java/carpet/script/command/CommandArgument.java b/src/main/java/carpet/script/command/CommandArgument.java index cb5fcc41..394e1d4e 100644 --- a/src/main/java/carpet/script/command/CommandArgument.java +++ b/src/main/java/carpet/script/command/CommandArgument.java @@ -108,7 +108,7 @@ import net.minecraft.world.level.biome.Biome; import net.minecraft.world.phys.Vec2; import net.minecraft.world.scores.ScoreHolder; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; import static net.minecraft.commands.Commands.argument; diff --git a/src/main/java/carpet/script/command/CommandToken.java b/src/main/java/carpet/script/command/CommandToken.java index 22c06f4f..120816e5 100644 --- a/src/main/java/carpet/script/command/CommandToken.java +++ b/src/main/java/carpet/script/command/CommandToken.java @@ -14,7 +14,7 @@ import java.util.Objects; import net.minecraft.commands.CommandSourceStack; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; import static net.minecraft.commands.Commands.literal; diff --git a/src/main/java/carpet/script/exception/BreakStatement.java b/src/main/java/carpet/script/exception/BreakStatement.java index 40b76a19..4265987c 100644 --- a/src/main/java/carpet/script/exception/BreakStatement.java +++ b/src/main/java/carpet/script/exception/BreakStatement.java @@ -2,7 +2,7 @@ package carpet.script.exception; import carpet.script.value.Value; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; public class BreakStatement extends ExitStatement { diff --git a/src/main/java/carpet/script/exception/ContinueStatement.java b/src/main/java/carpet/script/exception/ContinueStatement.java index 449b15ef..9f2ee9d6 100644 --- a/src/main/java/carpet/script/exception/ContinueStatement.java +++ b/src/main/java/carpet/script/exception/ContinueStatement.java @@ -2,7 +2,7 @@ package carpet.script.exception; import carpet.script.value.Value; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; public class ContinueStatement extends ExitStatement { diff --git a/src/main/java/carpet/script/exception/ExitStatement.java b/src/main/java/carpet/script/exception/ExitStatement.java index b1982332..b6abe8bc 100644 --- a/src/main/java/carpet/script/exception/ExitStatement.java +++ b/src/main/java/carpet/script/exception/ExitStatement.java @@ -2,7 +2,7 @@ package carpet.script.exception; import carpet.script.value.Value; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; /* Exception thrown to terminate execution mid expression (aka return statement) */ public class ExitStatement extends StacklessRuntimeException diff --git a/src/main/java/carpet/script/exception/ExpressionException.java b/src/main/java/carpet/script/exception/ExpressionException.java index a2cdd1f0..98435a12 100644 --- a/src/main/java/carpet/script/exception/ExpressionException.java +++ b/src/main/java/carpet/script/exception/ExpressionException.java @@ -6,7 +6,7 @@ import carpet.script.Token; import carpet.script.external.Carpet; import carpet.script.value.FunctionValue; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; import java.util.ArrayList; import java.util.Collections; import java.util.List; diff --git a/src/main/java/carpet/script/exception/Throwables.java b/src/main/java/carpet/script/exception/Throwables.java index ab345946..e3a4bfd7 100644 --- a/src/main/java/carpet/script/exception/Throwables.java +++ b/src/main/java/carpet/script/exception/Throwables.java @@ -1,6 +1,6 @@ package carpet.script.exception; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; import java.util.HashMap; import java.util.Map; diff --git a/src/main/java/carpet/script/external/Carpet.java b/src/main/java/carpet/script/external/Carpet.java index ef7503f8..9caa5e29 100644 --- a/src/main/java/carpet/script/external/Carpet.java +++ b/src/main/java/carpet/script/external/Carpet.java @@ -33,7 +33,7 @@ import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.player.Player; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; import java.io.IOException; import java.nio.file.FileVisitOption; import java.nio.file.Files; diff --git a/src/main/java/carpet/script/utils/AppStoreManager.java b/src/main/java/carpet/script/utils/AppStoreManager.java index f7536faa..dbcebb1f 100644 --- a/src/main/java/carpet/script/utils/AppStoreManager.java +++ b/src/main/java/carpet/script/utils/AppStoreManager.java @@ -34,7 +34,7 @@ import java.util.stream.Collectors; import org.apache.commons.io.IOUtils; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; /** * A class used to save scarpet app store scripts to disk diff --git a/src/main/java/carpet/script/utils/FeatureGenerator.java b/src/main/java/carpet/script/utils/FeatureGenerator.java index f81e0274..bb11c01c 100644 --- a/src/main/java/carpet/script/utils/FeatureGenerator.java +++ b/src/main/java/carpet/script/utils/FeatureGenerator.java @@ -63,7 +63,7 @@ import net.minecraft.world.level.levelgen.structure.placement.StructurePlacement import net.minecraft.world.level.levelgen.structure.structures.JigsawStructure; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureProcessorList; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; public class FeatureGenerator { diff --git a/src/main/java/carpet/script/utils/GlocalFlag.java b/src/main/java/carpet/script/utils/GlocalFlag.java index 05cced39..01dd8ffc 100644 --- a/src/main/java/carpet/script/utils/GlocalFlag.java +++ b/src/main/java/carpet/script/utils/GlocalFlag.java @@ -1,6 +1,6 @@ package carpet.script.utils; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; import java.util.function.Supplier; public class GlocalFlag extends ThreadLocal diff --git a/src/main/java/carpet/script/utils/ParticleParser.java b/src/main/java/carpet/script/utils/ParticleParser.java index b386f52e..47624b8a 100644 --- a/src/main/java/carpet/script/utils/ParticleParser.java +++ b/src/main/java/carpet/script/utils/ParticleParser.java @@ -6,7 +6,7 @@ import net.minecraft.commands.arguments.ParticleArgument; import net.minecraft.core.RegistryAccess; import net.minecraft.core.particles.ParticleOptions; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; import java.util.HashMap; import java.util.Map; diff --git a/src/main/java/carpet/script/utils/ShapeDispatcher.java b/src/main/java/carpet/script/utils/ShapeDispatcher.java index 91edfc35..ac2d5a7e 100644 --- a/src/main/java/carpet/script/utils/ShapeDispatcher.java +++ b/src/main/java/carpet/script/utils/ShapeDispatcher.java @@ -57,7 +57,7 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.Vec3; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; diff --git a/src/main/java/carpet/script/utils/WorldTools.java b/src/main/java/carpet/script/utils/WorldTools.java index c2274ec3..c3c4064f 100644 --- a/src/main/java/carpet/script/utils/WorldTools.java +++ b/src/main/java/carpet/script/utils/WorldTools.java @@ -34,7 +34,7 @@ import net.minecraft.world.level.levelgen.WorldGenSettings; import net.minecraft.world.level.storage.DerivedLevelData; import net.minecraft.world.level.storage.ServerLevelData; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; import java.io.IOException; import java.nio.file.Path; import java.util.List; diff --git a/src/main/java/carpet/script/utils/shapes/ShapeDirection.java b/src/main/java/carpet/script/utils/shapes/ShapeDirection.java index 29bc08a6..1923007c 100644 --- a/src/main/java/carpet/script/utils/shapes/ShapeDirection.java +++ b/src/main/java/carpet/script/utils/shapes/ShapeDirection.java @@ -1,6 +1,6 @@ package carpet.script.utils.shapes; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; import java.util.Locale; public enum ShapeDirection diff --git a/src/main/java/carpet/script/value/BlockValue.java b/src/main/java/carpet/script/value/BlockValue.java index 13a8c101..f478a658 100644 --- a/src/main/java/carpet/script/value/BlockValue.java +++ b/src/main/java/carpet/script/value/BlockValue.java @@ -40,7 +40,7 @@ import net.minecraft.world.level.chunk.LevelChunk; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.Vec3; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; import static carpet.script.value.NBTSerializableValue.nameFromResource; diff --git a/src/main/java/carpet/script/value/EntityValue.java b/src/main/java/carpet/script/value/EntityValue.java index e84425ad..7065edc3 100644 --- a/src/main/java/carpet/script/value/EntityValue.java +++ b/src/main/java/carpet/script/value/EntityValue.java @@ -80,7 +80,7 @@ import net.minecraft.world.phys.EntityHitResult; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; diff --git a/src/main/java/carpet/script/value/FunctionValue.java b/src/main/java/carpet/script/value/FunctionValue.java index db54f1aa..ae51c07c 100644 --- a/src/main/java/carpet/script/value/FunctionValue.java +++ b/src/main/java/carpet/script/value/FunctionValue.java @@ -23,7 +23,7 @@ import net.minecraft.core.RegistryAccess; import net.minecraft.nbt.StringTag; import net.minecraft.nbt.Tag; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; public class FunctionValue extends Value implements Fluff.ILazyFunction { diff --git a/src/main/java/carpet/script/value/NBTSerializableValue.java b/src/main/java/carpet/script/value/NBTSerializableValue.java index 1244a417..279a40a9 100644 --- a/src/main/java/carpet/script/value/NBTSerializableValue.java +++ b/src/main/java/carpet/script/value/NBTSerializableValue.java @@ -56,7 +56,7 @@ import net.minecraft.world.level.block.entity.ChestBlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.AABB; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; public class NBTSerializableValue extends Value implements ContainerValueInterface { diff --git a/src/main/java/carpet/script/value/ScreenValue.java b/src/main/java/carpet/script/value/ScreenValue.java index dd398770..3f82f3be 100644 --- a/src/main/java/carpet/script/value/ScreenValue.java +++ b/src/main/java/carpet/script/value/ScreenValue.java @@ -59,7 +59,7 @@ import net.minecraft.world.inventory.StonecutterMenu; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.RecipeHolder; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; import static net.minecraft.world.inventory.MenuType.*; diff --git a/src/main/java/carpet/script/value/StringValue.java b/src/main/java/carpet/script/value/StringValue.java index df3df1d5..53475678 100644 --- a/src/main/java/carpet/script/value/StringValue.java +++ b/src/main/java/carpet/script/value/StringValue.java @@ -4,7 +4,7 @@ import net.minecraft.core.RegistryAccess; import net.minecraft.nbt.StringTag; import net.minecraft.nbt.Tag; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; public class StringValue extends Value { diff --git a/src/main/java/carpet/script/value/Value.java b/src/main/java/carpet/script/value/Value.java index 3276b7fc..e53315c5 100644 --- a/src/main/java/carpet/script/value/Value.java +++ b/src/main/java/carpet/script/value/Value.java @@ -15,7 +15,7 @@ import java.util.regex.PatternSyntaxException; import net.minecraft.core.RegistryAccess; import net.minecraft.nbt.Tag; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; public abstract class Value implements Comparable, Cloneable { diff --git a/src/main/java/carpet/script/value/ValueConversions.java b/src/main/java/carpet/script/value/ValueConversions.java index 9777cea4..79111265 100644 --- a/src/main/java/carpet/script/value/ValueConversions.java +++ b/src/main/java/carpet/script/value/ValueConversions.java @@ -60,7 +60,7 @@ import java.util.UUID; import java.util.function.Predicate; import java.util.stream.StreamSupport; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; public class ValueConversions { diff --git a/src/main/java/carpet/utils/WoolTool.java b/src/main/java/carpet/utils/WoolTool.java index 53387bd2..761de09c 100644 --- a/src/main/java/carpet/utils/WoolTool.java +++ b/src/main/java/carpet/utils/WoolTool.java @@ -21,7 +21,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.MapColor; import net.minecraft.world.phys.Vec3; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; import static java.util.Map.entry; From be61641c3df742a22f09983a72bdf64ce275ad0a Mon Sep 17 00:00:00 2001 From: altrisi Date: Mon, 8 Dec 2025 19:38:54 +0100 Subject: [PATCH 174/232] Missed import change to jSpecify --- src/main/java/carpet/script/CarpetEventServer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/carpet/script/CarpetEventServer.java b/src/main/java/carpet/script/CarpetEventServer.java index 8ed822e2..c7a8ecc8 100644 --- a/src/main/java/carpet/script/CarpetEventServer.java +++ b/src/main/java/carpet/script/CarpetEventServer.java @@ -70,7 +70,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.Vec3; -import javax.annotation.Nullable; +import org.jspecify.annotations.Nullable; public class CarpetEventServer { From 6c23ea90a80ee4449375ed5243c269f0e2701d2d Mon Sep 17 00:00:00 2001 From: gnembon Date: Thu, 11 Dec 2025 00:14:37 +0100 Subject: [PATCH 175/232] 1.21.11 --- gradle.properties | 8 ++++---- src/main/resources/fabric.mod.json | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gradle.properties b/gradle.properties index c82d7415..f10e9e69 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,8 +7,8 @@ org.gradle.configuration-cache=false # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=1.21.11-pre1 - loader_version=0.17.3 + minecraft_version=1.21.11 + loader_version=0.18.2 jsr305_version=3.0.2 fabric_version=0.134.0+1.21.9 @@ -21,7 +21,7 @@ org.gradle.configuration-cache=false # The Curseforge versions "names" or ids for the main branch (comma separated: 1.16.4,1.16.5) # This is needed because CF uses too vague names for prereleases and release candidates # Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN] - release-curse-versions = Minecraft 1.21:1.21.11-Snapshot + release-curse-versions = Minecraft 1.21:1.21.11 # Whether or not to build another branch on release release-extra-branch = false # The name of the second branch to release @@ -29,4 +29,4 @@ org.gradle.configuration-cache=false # The "name" or id of the Curseforge version for the secondary branch # This is needed because CF uses too vague names for snapshots # Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN] - release-extra-curse-version = Minecraft 1.21:1.21.10 + release-extra-curse-version = Minecraft 1.21:1.21.10-Snapshot diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 5a8a7602..0ffc258a 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -33,8 +33,8 @@ "accessWidener" : "carpet.accesswidener", "depends": { - "minecraft": ">=1.21.10", - "fabricloader": ">=0.16.10", + "minecraft": ">=1.21.11", + "fabricloader": ">=0.18.2", "java": ">=21" } } From 50ff7aa60f51ec1bdc523acd90b22a4951b3e1a9 Mon Sep 17 00:00:00 2001 From: gnembon Date: Thu, 11 Dec 2025 00:25:41 +0100 Subject: [PATCH 176/232] 1.4.193 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index f10e9e69..67c498cf 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ org.gradle.configuration-cache=false fabric_version=0.134.0+1.21.9 # Mod Properties - mod_version = 1.4.192 + mod_version = 1.4.193 maven_group = carpet archives_base_name = fabric-carpet From 70d2d0194f0e9cdd5185227df795f805d30a76fc Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 11 Dec 2025 01:15:21 +0000 Subject: [PATCH 177/232] Merge docs for 'Carpet Mod 1.4.193 for Minecraft 1.21.11' --- docs/scarpet/Full.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/scarpet/Full.md b/docs/scarpet/Full.md index afc40bd4..3b7f08ec 100644 --- a/docs/scarpet/Full.md +++ b/docs/scarpet/Full.md @@ -3433,7 +3433,7 @@ Entity that `e` rides. ### `query(e, 'unmountable')` -Boolean, true if the entity cannot be mounted. +Boolean, true if the entity cannot be unmounted. ### `(deprecated) query(e, 'tags')` @@ -3956,7 +3956,7 @@ Mounts the entity to the `other`. ### `modify(e, 'unmountable', boolean)` -Denies or allows an entity to be mounted. +Denies or allows an entity to be unmounted. ### `modify(e, 'drop_passengers')` From 0cc4438abdcb98fae98fd36cac2d3f64528623eb Mon Sep 17 00:00:00 2001 From: altrisi Date: Sun, 14 Dec 2025 22:26:55 +0100 Subject: [PATCH 178/232] Fix crash when leaving entity camera in spectator Fixes #2140 --- src/main/java/carpet/mixins/Player_scarpetEventsMixin.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/carpet/mixins/Player_scarpetEventsMixin.java b/src/main/java/carpet/mixins/Player_scarpetEventsMixin.java index 0d181f5b..5454d21a 100644 --- a/src/main/java/carpet/mixins/Player_scarpetEventsMixin.java +++ b/src/main/java/carpet/mixins/Player_scarpetEventsMixin.java @@ -91,6 +91,10 @@ public abstract class Player_scarpetEventsMixin extends LivingEntity @ModifyReturnValue(method = "wantsToStopRiding", at = @At("TAIL")) private boolean dontUnmountFromIfPermanentVehicle(boolean original) { + if (this.getVehicle() == null) { + // may also be called when leaving entity camera in spectator + return original; + } return original && !((EntityInterface) this.getVehicle()).isPermanentVehicle(); } } From 4e160d235a4c6e20906ea30e6d99174dda8fb445 Mon Sep 17 00:00:00 2001 From: altrisi Date: Sun, 14 Dec 2025 22:54:37 +0100 Subject: [PATCH 179/232] Fix docs regarding cancellation of player message and command events Relates to #2137 --- docs/scarpet/api/Events.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/scarpet/api/Events.md b/docs/scarpet/api/Events.md index 59378f9b..e273f3f4 100644 --- a/docs/scarpet/api/Events.md +++ b/docs/scarpet/api/Events.md @@ -318,11 +318,11 @@ Triggered when a player sends a disconnect package or is forcefully disconnected ### `__on_player_message(player, message)` Triggered when a player sends a chat message. +This event can be cancelled by returning `'cancel'`, which prevents the message from being sent. + ### `__on_player_command(player, command)` Triggered when a player runs a command. Command value is returned without the / in front. -This event can be cancelled by returning `'cancel'`, which prevents the message from being sent. - ### `__on_statistic(player, category, event, value)` Triggered when a player statistic changes. Doesn't notify on periodic an rhythmic events, i.e. `time_since_death`, `time_since_rest`, and `played_one_minute` since these are triggered every tick. Event From be1211dda75566f3dcee6597bd49b0aa3d7c6814 Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 17 Dec 2025 17:05:15 +0100 Subject: [PATCH 180/232] mc 26.1-snap-1 --- build.gradle | 11 ++++--- gradle.properties | 9 +++--- gradle/wrapper/gradle-wrapper.properties | 2 +- .../carpet/helpers/FertilizableCoral.java | 6 ++-- .../carpet/helpers/OptimizedExplosion.java | 2 +- .../java/carpet/helpers/ParticleDisplay.java | 2 +- .../AbstractContainerMenu_scarpetMixin.java | 4 +-- .../mixins/ArmorStand_scarpetMarkerMixin.java | 4 +-- .../PieceGeneratorSupplier_plopMixin.java | 2 +- .../mixins/ReloadCommand_reloadAppsMixin.java | 4 +-- ...PacketListenerImpl_scarpetEventsMixin.java | 2 +- .../mixins/SummonCommand_lightningMixin.java | 2 +- .../java/carpet/script/CarpetScriptHost.java | 4 +-- .../java/carpet/script/api/Auxiliary.java | 2 +- .../java/carpet/script/api/WorldAccess.java | 4 +-- .../carpet/script/utils/FeatureGenerator.java | 6 ++-- .../carpet/script/utils/ShapeDispatcher.java | 2 +- .../carpet/script/utils/ShapesRenderer.java | 4 +-- .../java/carpet/script/value/EntityValue.java | 29 ++++++++++--------- .../script/value/NBTSerializableValue.java | 2 +- .../java/carpet/script/value/ScreenValue.java | 10 +++---- .../carpet/utils/PerimeterDiagnostics.java | 2 +- src/main/java/carpet/utils/SpawnReporter.java | 4 +-- src/main/resources/carpet.accesswidener | 2 +- 24 files changed, 61 insertions(+), 60 deletions(-) diff --git a/build.gradle b/build.gradle index f31ed9b6..eef237fa 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '1.13-SNAPSHOT' + id 'net.fabricmc.fabric-loom' version "${loom_version}" id 'maven-publish' } @@ -18,8 +18,7 @@ loom { dependencies { // To change the versions see the gradle.properties file minecraft "com.mojang:minecraft:${project.minecraft_version}" - mappings loom.officialMojangMappings() - modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" + implementation "net.fabricmc:fabric-loader:${project.loader_version}" // Fabric API. This is technically optional, but you probably want it anyway. //modImplementation "net.fabricmc:fabric:${project.fabric_version}" @@ -43,7 +42,7 @@ tasks.withType(JavaCompile).configureEach { it.options.encoding = "UTF-8" // Minecraft 1.20.5 upwards uses Java 21. - it.options.release = 21 + it.options.release = 25 } java { @@ -52,8 +51,8 @@ java { // If you remove this line, sources will not be generated. withSourcesJar() - sourceCompatibility = JavaVersion.VERSION_21 - targetCompatibility = JavaVersion.VERSION_21 + sourceCompatibility = JavaVersion.VERSION_25 + targetCompatibility = JavaVersion.VERSION_25 } jar { diff --git a/gradle.properties b/gradle.properties index 67c498cf..f9cf694a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,10 +7,9 @@ org.gradle.configuration-cache=false # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=1.21.11 - loader_version=0.18.2 - jsr305_version=3.0.2 - fabric_version=0.134.0+1.21.9 + minecraft_version=26.1-snapshot-1 + loader_version=0.18.3 + loom_version=1.14-SNAPSHOT # Mod Properties mod_version = 1.4.193 @@ -21,7 +20,7 @@ org.gradle.configuration-cache=false # The Curseforge versions "names" or ids for the main branch (comma separated: 1.16.4,1.16.5) # This is needed because CF uses too vague names for prereleases and release candidates # Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN] - release-curse-versions = Minecraft 1.21:1.21.11 + release-curse-versions = Minecraft 26:26.1-Snapshot # Whether or not to build another branch on release release-extra-branch = false # The name of the second branch to release diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2e111328..23449a2b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/src/main/java/carpet/helpers/FertilizableCoral.java b/src/main/java/carpet/helpers/FertilizableCoral.java index 3f7447fe..a588ec31 100644 --- a/src/main/java/carpet/helpers/FertilizableCoral.java +++ b/src/main/java/carpet/helpers/FertilizableCoral.java @@ -75,10 +75,10 @@ public interface FertilizableCoral extends BonemealableBlock { } else { - if (worldIn.random.nextInt(10) == 0) + if (worldIn.getRandom().nextInt(10) == 0) { - BlockPos randomPos = pos.offset(worldIn.random.nextInt(16) - 8, worldIn.random.nextInt(8), worldIn.random.nextInt(16) - 8); - if (coralBlocks.contains(worldIn.getBlockState(randomPos).getBlockHolder())) + BlockPos randomPos = pos.offset(worldIn.getRandom().nextInt(16) - 8, worldIn.getRandom().nextInt(8), worldIn.getRandom().nextInt(16) - 8); + if (worldIn.getBlockState(randomPos).is(BlockTags.CORAL_BLOCKS)) { worldIn.setBlock(randomPos, Blocks.WET_SPONGE.defaultBlockState(), Block.UPDATE_ALL); } diff --git a/src/main/java/carpet/helpers/OptimizedExplosion.java b/src/main/java/carpet/helpers/OptimizedExplosion.java index f35b6027..8bb7c9b5 100644 --- a/src/main/java/carpet/helpers/OptimizedExplosion.java +++ b/src/main/java/carpet/helpers/OptimizedExplosion.java @@ -133,7 +133,7 @@ public class OptimizedExplosion double xInc = (xRel / len) * 0.3; double yInc = (yRel / len) * 0.3; double zInc = (zRel / len) * 0.3; - float rand = eAccess.getLevel().random.nextFloat(); + float rand = eAccess.getLevel().getRandom().nextFloat(); float sizeRand = (CarpetSettings.tntRandomRange >= 0 ? (float) CarpetSettings.tntRandomRange : rand); float size = eAccess.getRadius() * (0.7F + sizeRand * 0.6F); Vec3 vec3 = eAccess.getCenter(); diff --git a/src/main/java/carpet/helpers/ParticleDisplay.java b/src/main/java/carpet/helpers/ParticleDisplay.java index d6f2ee61..75fb25bd 100644 --- a/src/main/java/carpet/helpers/ParticleDisplay.java +++ b/src/main/java/carpet/helpers/ParticleDisplay.java @@ -22,7 +22,7 @@ public class ParticleDisplay Vec3 incvec = to.subtract(from).normalize();// multiply(50/sqrt(lineLengthSq)); for (Vec3 delta = new Vec3(0.0,0.0,0.0); delta.lengthSqr() < lineLengthSq; - delta = delta.add(incvec.scale(player.level().random.nextFloat()))) + delta = delta.add(incvec.scale(player.level().getRandom().nextFloat()))) { player.level().sendParticles( player, diff --git a/src/main/java/carpet/mixins/AbstractContainerMenu_scarpetMixin.java b/src/main/java/carpet/mixins/AbstractContainerMenu_scarpetMixin.java index a1a55eec..fc322904 100644 --- a/src/main/java/carpet/mixins/AbstractContainerMenu_scarpetMixin.java +++ b/src/main/java/carpet/mixins/AbstractContainerMenu_scarpetMixin.java @@ -14,7 +14,7 @@ import java.util.List; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.AbstractContainerMenu; -import net.minecraft.world.inventory.ClickType; +import net.minecraft.world.inventory.ContainerInput; import net.minecraft.world.inventory.ContainerListener; import net.minecraft.world.inventory.DataSlot; @@ -26,7 +26,7 @@ public abstract class AbstractContainerMenu_scarpetMixin implements AbstractCont @Shadow @Final private List dataSlots; @Inject(method = "doClick", at = @At("HEAD"), cancellable = true) - private void callSlotClickListener(int slotIndex, int button, ClickType actionType, Player player, CallbackInfo ci) { + private void callSlotClickListener(int slotIndex, int button, ContainerInput actionType, Player player, CallbackInfo ci) { if(!(player instanceof ServerPlayer serverPlayerEntity)) return; for(ContainerListener screenHandlerListener : this.containerListeners) { if(screenHandlerListener instanceof ScreenValue.ScarpetScreenHandlerListener scarpetScreenHandlerListener) { diff --git a/src/main/java/carpet/mixins/ArmorStand_scarpetMarkerMixin.java b/src/main/java/carpet/mixins/ArmorStand_scarpetMarkerMixin.java index 89339e32..531c3d27 100644 --- a/src/main/java/carpet/mixins/ArmorStand_scarpetMarkerMixin.java +++ b/src/main/java/carpet/mixins/ArmorStand_scarpetMarkerMixin.java @@ -31,10 +31,10 @@ public abstract class ArmorStand_scarpetMarkerMixin extends LivingEntity { if (!level().isClientSide()) { - if (getTags().contains(Auxiliary.MARKER_STRING)) + if (entityTags().contains(Auxiliary.MARKER_STRING)) { String prefix = Auxiliary.MARKER_STRING+"_"; - Optional owner = getTags().stream().filter(s -> s.startsWith(prefix)).findFirst(); + Optional owner = entityTags().stream().filter(s -> s.startsWith(prefix)).findFirst(); if (owner.isPresent()) { String hostName = StringUtils.removeStart(owner.get(),prefix); diff --git a/src/main/java/carpet/mixins/PieceGeneratorSupplier_plopMixin.java b/src/main/java/carpet/mixins/PieceGeneratorSupplier_plopMixin.java index 79c4e1c8..0cd7363a 100644 --- a/src/main/java/carpet/mixins/PieceGeneratorSupplier_plopMixin.java +++ b/src/main/java/carpet/mixins/PieceGeneratorSupplier_plopMixin.java @@ -11,7 +11,7 @@ import net.minecraft.world.level.levelgen.structure.pieces.PieceGeneratorSupplie @Mixin(PieceGeneratorSupplier.class) public interface PieceGeneratorSupplier_plopMixin { - @Redirect(method = "method_39845", at = @At( + @Redirect(method = "lambda$simple$0", at = @At( value = "INVOKE", target = "java/util/function/Predicate.test(Ljava/lang/Object;)Z" ), remap = false) diff --git a/src/main/java/carpet/mixins/ReloadCommand_reloadAppsMixin.java b/src/main/java/carpet/mixins/ReloadCommand_reloadAppsMixin.java index f27abc7a..b5f12673 100644 --- a/src/main/java/carpet/mixins/ReloadCommand_reloadAppsMixin.java +++ b/src/main/java/carpet/mixins/ReloadCommand_reloadAppsMixin.java @@ -11,9 +11,9 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(ReloadCommand.class) public class ReloadCommand_reloadAppsMixin { - //method_13530(Lcom/mojang/brigadier/context/CommandContext;)I + //lambda$register$0(Lcom/mojang/brigadier/context/CommandContext;)I // internal of register. - @Inject(method = "method_13530", at = @At("TAIL"), remap = false) + @Inject(method = "lambda$register$0", at = @At("TAIL"), remap = false) private static void onReload(CommandContext context, CallbackInfoReturnable cir) { // can't fetch here the reference to the server diff --git a/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java b/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java index 792124b2..42e0f3e0 100644 --- a/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java +++ b/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java @@ -280,7 +280,7 @@ public class ServerGamePacketListenerImpl_scarpetEventsMixin } } - @Inject(method = "method_44356", // lambda of handleChatCommand(ServerboundChatCommandPacket) + @Inject(method = "lambda$handleChatCommand$0", // lambda of handleChatCommand(ServerboundChatCommandPacket) at = @At(value = "HEAD") ) private void onChatCommandMessage(ServerboundChatCommandPacket serverboundChatCommandPacket, CallbackInfo ci) { diff --git a/src/main/java/carpet/mixins/SummonCommand_lightningMixin.java b/src/main/java/carpet/mixins/SummonCommand_lightningMixin.java index 093eabe5..ca0785c2 100644 --- a/src/main/java/carpet/mixins/SummonCommand_lightningMixin.java +++ b/src/main/java/carpet/mixins/SummonCommand_lightningMixin.java @@ -30,7 +30,7 @@ public class SummonCommand_lightningMixin ServerLevel world = (ServerLevel) entity.level(); BlockPos at = entity.blockPosition(); DifficultyInstance localDifficulty_1 = world.getCurrentDifficultyAt(at); - boolean boolean_2 = world.getGameRules().get(GameRules.SPAWN_MOBS) && world.random.nextDouble() < (double)localDifficulty_1.getEffectiveDifficulty() * 0.01D; + boolean boolean_2 = world.getGameRules().get(GameRules.SPAWN_MOBS) && world.getRandom().nextDouble() < (double)localDifficulty_1.getEffectiveDifficulty() * 0.01D; if (boolean_2) { SkeletonHorse skeletonHorseEntity_1 = EntityType.SKELETON_HORSE.create(world, EntitySpawnReason.EVENT); skeletonHorseEntity_1.setTrap(true); diff --git a/src/main/java/carpet/script/CarpetScriptHost.java b/src/main/java/carpet/script/CarpetScriptHost.java index fecd5767..26f7dc7b 100644 --- a/src/main/java/carpet/script/CarpetScriptHost.java +++ b/src/main/java/carpet/script/CarpetScriptHost.java @@ -961,7 +961,7 @@ public class CarpetScriptHost extends ScriptHost String markerName = Auxiliary.MARKER_STRING + "_" + ((getName() == null) ? "" : getName()); for (ServerLevel world : scriptServer().server.getAllLevels()) { - for (Entity e : world.getEntities(EntityType.ARMOR_STAND, (as) -> as.getTags().contains(markerName))) + for (Entity e : world.getEntities(EntityType.ARMOR_STAND, (as) -> as.entityTags().contains(markerName))) { e.discard(); } @@ -1109,7 +1109,7 @@ public class CarpetScriptHost extends ScriptHost } /** - *

    Creates a {@link Component} using {@link Messenger} that has the locals in the {@code line} snippet with a hover over + *

    Creates a {@link Component} using {@link carper.utils.Messenger} that has the locals in the {@code line} snippet with a hover over * tooltip with the value of the local at that location

    * * @param line The line to find references to locals on diff --git a/src/main/java/carpet/script/api/Auxiliary.java b/src/main/java/carpet/script/api/Auxiliary.java index 94969b00..1e9b5e54 100644 --- a/src/main/java/carpet/script/api/Auxiliary.java +++ b/src/main/java/carpet/script/api/Auxiliary.java @@ -434,7 +434,7 @@ public class Auxiliary CarpetContext cc = (CarpetContext) c; int total = 0; String markerName = MARKER_STRING + "_" + ((cc.host.getName() == null) ? "" : cc.host.getName()); - for (Entity e : cc.level().getEntities(EntityType.ARMOR_STAND, as -> as.getTags().contains(markerName))) + for (Entity e : cc.level().getEntities(EntityType.ARMOR_STAND, as -> as.entityTags().contains(markerName))) { total++; e.discard(); diff --git a/src/main/java/carpet/script/api/WorldAccess.java b/src/main/java/carpet/script/api/WorldAccess.java index 403641b5..0b7bd103 100644 --- a/src/main/java/carpet/script/api/WorldAccess.java +++ b/src/main/java/carpet/script/api/WorldAccess.java @@ -703,7 +703,7 @@ public class WorldAccess booleanStateTest(c, "block_tick", lv, (s, p) -> { ServerLevel w = ((CarpetContext) c).level(); - s.randomTick(w, p, w.random); + s.randomTick(w, p, w.getRandom()); return true; })); @@ -713,7 +713,7 @@ public class WorldAccess ServerLevel w = ((CarpetContext) c).level(); if (s.isRandomlyTicking() || s.getFluidState().isRandomlyTicking()) { - s.randomTick(w, p, w.random); + s.randomTick(w, p, w.getRandom()); } return true; })); diff --git a/src/main/java/carpet/script/utils/FeatureGenerator.java b/src/main/java/carpet/script/utils/FeatureGenerator.java index bb11c01c..f6186fd3 100644 --- a/src/main/java/carpet/script/utils/FeatureGenerator.java +++ b/src/main/java/carpet/script/utils/FeatureGenerator.java @@ -89,7 +89,7 @@ public class FeatureGenerator checks.set(true); try { - return configuredFeature.place(world, world.getChunkSource().getGenerator(), world.random, pos); + return configuredFeature.place(world, world.getChunkSource().getGenerator(), world.getRandom(), pos); } finally { @@ -115,7 +115,7 @@ public class FeatureGenerator checks.set(true); try { - return configuredStandard.place(world, world.getChunkSource().getGenerator(), world.random, pos); + return configuredStandard.place(world, world.getChunkSource().getGenerator(), world.getRandom(), pos); } finally { @@ -161,7 +161,7 @@ public class FeatureGenerator checks.set(true); try { - return feature.place(w, w.getChunkSource().getGenerator(), w.random, p); + return feature.place(w, w.getChunkSource().getGenerator(), w.getRandom(), p); } finally { diff --git a/src/main/java/carpet/script/utils/ShapeDispatcher.java b/src/main/java/carpet/script/utils/ShapeDispatcher.java index ac2d5a7e..50899787 100644 --- a/src/main/java/carpet/script/utils/ShapeDispatcher.java +++ b/src/main/java/carpet/script/utils/ShapeDispatcher.java @@ -2245,7 +2245,7 @@ public class ShapeDispatcher int pcount = 0; if (distance < 100) { - RandomSource rand = players.get(0).level().random; + RandomSource rand = players.get(0).level().getRandom(); int particles = (int) (distance / density) + 1; Vec3 towards = to.subtract(from); for (int i = 0; i < particles; i++) diff --git a/src/main/java/carpet/script/utils/ShapesRenderer.java b/src/main/java/carpet/script/utils/ShapesRenderer.java index bfbc1937..fe50ccac 100644 --- a/src/main/java/carpet/script/utils/ShapesRenderer.java +++ b/src/main/java/carpet/script/utils/ShapesRenderer.java @@ -26,7 +26,6 @@ import net.minecraft.client.gui.Font; import net.minecraft.client.gui.components.debug.DebugScreenEntries; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.renderer.ItemBlockRenderTypes; -import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderBuffers; import net.minecraft.client.renderer.rendertype.RenderType; @@ -43,6 +42,7 @@ import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.resources.ResourceKey; +import net.minecraft.util.LightCoordsUtil; import net.minecraft.util.Mth; import net.minecraft.util.ProblemReporter; import net.minecraft.world.item.ItemDisplayContext; @@ -406,7 +406,7 @@ public class ShapesRenderer int light = 0; if (client.level != null) { - light = LightTexture.pack( + light = LightCoordsUtil.pack( shape.blockLight < 0 ? client.level.getBrightness(LightLayer.BLOCK, blockPos) : shape.blockLight, shape.skyLight < 0 ? client.level.getBrightness(LightLayer.SKY, blockPos) : shape.skyLight ); diff --git a/src/main/java/carpet/script/value/EntityValue.java b/src/main/java/carpet/script/value/EntityValue.java index 7065edc3..13f90b6c 100644 --- a/src/main/java/carpet/script/value/EntityValue.java +++ b/src/main/java/carpet/script/value/EntityValue.java @@ -92,6 +92,7 @@ import java.util.Set; import java.util.UUID; import java.util.function.BiConsumer; import java.util.function.BiFunction; +import java.util.function.BiPredicate; import java.util.function.Predicate; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -297,6 +298,8 @@ public class EntityValue extends Value public static final Map byName = new HashMap<>() {{ List> allTypes = BuiltInRegistries.ENTITY_TYPE.stream().toList(); + BiPredicate, TagKey>> is = (type, tag) -> type.builtInRegistryHolder().is(tag); + // nonliving types Set> projectiles = Set.of( EntityType.ARROW, EntityType.DRAGON_FIREBALL, EntityType.FIREWORK_ROCKET, @@ -340,7 +343,7 @@ public class EntityValue extends Value ); Set> living = allTypes.stream().filter(et -> - !deads.contains(et) && !projectiles.contains(et) && !minecarts.contains(et) && !et.is(EntityTypeTags.BOAT) + !deads.contains(et) && !projectiles.contains(et) && !minecarts.contains(et) && !is.test(et, EntityTypeTags.BOAT) ).collect(Collectors.toSet()); Set> regular = allTypes.stream().filter(et -> @@ -364,17 +367,17 @@ public class EntityValue extends Value // combat groups - put("arthropod", new EntityClassDescriptor(EntityTypeTest.forClass(LivingEntity.class), e -> (e.getType().is(EntityTypeTags.ARTHROPOD) && e.isAlive()), allTypes.stream().filter(arthropods::contains))); - put("!arthropod", new EntityClassDescriptor(EntityTypeTest.forClass(LivingEntity.class), e -> (!e.getType().is(EntityTypeTags.ARTHROPOD) && e.isAlive()), allTypes.stream().filter(et -> !arthropods.contains(et) && living.contains(et)))); + put("arthropod", new EntityClassDescriptor(EntityTypeTest.forClass(LivingEntity.class), e -> (is.test(e.getType(), EntityTypeTags.ARTHROPOD) && e.isAlive()), allTypes.stream().filter(arthropods::contains))); + put("!arthropod", new EntityClassDescriptor(EntityTypeTest.forClass(LivingEntity.class), e -> (!is.test(e.getType(), EntityTypeTags.ARTHROPOD) && e.isAlive()), allTypes.stream().filter(et -> !arthropods.contains(et) && living.contains(et)))); - put("undead", new EntityClassDescriptor(EntityTypeTest.forClass(LivingEntity.class), e -> (e.getType().is(EntityTypeTags.UNDEAD) && e.isAlive()), allTypes.stream().filter(undeads::contains))); - put("!undead", new EntityClassDescriptor(EntityTypeTest.forClass(LivingEntity.class), e -> (!e.getType().is(EntityTypeTags.UNDEAD) && e.isAlive()), allTypes.stream().filter(et -> !undeads.contains(et) && living.contains(et)))); + put("undead", new EntityClassDescriptor(EntityTypeTest.forClass(LivingEntity.class), e -> (is.test(e.getType(), EntityTypeTags.UNDEAD) && e.isAlive()), allTypes.stream().filter(undeads::contains))); + put("!undead", new EntityClassDescriptor(EntityTypeTest.forClass(LivingEntity.class), e -> (!is.test(e.getType(), EntityTypeTags.UNDEAD) && e.isAlive()), allTypes.stream().filter(et -> !undeads.contains(et) && living.contains(et)))); - put("aquatic", new EntityClassDescriptor(EntityTypeTest.forClass(LivingEntity.class), e -> (e.getType().is(EntityTypeTags.AQUATIC) && e.isAlive()), allTypes.stream().filter(aquatique::contains))); - put("!aquatic", new EntityClassDescriptor(EntityTypeTest.forClass(LivingEntity.class), e -> (!e.getType().is(EntityTypeTags.AQUATIC) && e.isAlive()), allTypes.stream().filter(et -> !aquatique.contains(et) && living.contains(et)))); + put("aquatic", new EntityClassDescriptor(EntityTypeTest.forClass(LivingEntity.class), e -> (is.test(e.getType(), EntityTypeTags.AQUATIC) && e.isAlive()), allTypes.stream().filter(aquatique::contains))); + put("!aquatic", new EntityClassDescriptor(EntityTypeTest.forClass(LivingEntity.class), e -> (!is.test(e.getType(), EntityTypeTags.AQUATIC) && e.isAlive()), allTypes.stream().filter(et -> !aquatique.contains(et) && living.contains(et)))); - put("illager", new EntityClassDescriptor(EntityTypeTest.forClass(LivingEntity.class), e -> (e.getType().is(EntityTypeTags.ILLAGER) && e.isAlive()), allTypes.stream().filter(illagers::contains))); - put("!illager", new EntityClassDescriptor(EntityTypeTest.forClass(LivingEntity.class), e -> (!e.getType().is(EntityTypeTags.ILLAGER) && e.isAlive()), allTypes.stream().filter(et -> !illagers.contains(et) && living.contains(et)))); + put("illager", new EntityClassDescriptor(EntityTypeTest.forClass(LivingEntity.class), e -> (is.test(e.getType(), EntityTypeTags.ILLAGER) && e.isAlive()), allTypes.stream().filter(illagers::contains))); + put("!illager", new EntityClassDescriptor(EntityTypeTest.forClass(LivingEntity.class), e -> (!is.test(e.getType(), EntityTypeTags.ILLAGER) && e.isAlive()), allTypes.stream().filter(et -> !illagers.contains(et) && living.contains(et)))); put("regular", new EntityClassDescriptor(EntityTypeTest.forClass(LivingEntity.class), e -> { EntityType type = e.getType(); @@ -457,17 +460,17 @@ public class EntityValue extends Value put("mount", (e, a) -> (e.getVehicle() != null) ? new EntityValue(e.getVehicle()) : Value.NULL); put("unmountable", (e, a) -> BooleanValue.of(Vanilla.Entity_isPermanentVehicle(e))); // deprecated - put("tags", (e, a) -> ListValue.wrap(e.getTags().stream().map(StringValue::new))); + put("tags", (e, a) -> ListValue.wrap(e.entityTags().stream().map(StringValue::new))); - put("scoreboard_tags", (e, a) -> ListValue.wrap(e.getTags().stream().map(StringValue::new))); + put("scoreboard_tags", (e, a) -> ListValue.wrap(e.entityTags().stream().map(StringValue::new))); put("entity_tags", (e, a) -> { EntityType type = e.getType(); return ListValue.wrap(e.level().getServer().registryAccess().lookupOrThrow(Registries.ENTITY_TYPE).getTags().filter(entry -> entry.stream().anyMatch(h -> h.value() == type)).map(entry -> ValueConversions.of(entry))); }); // deprecated - put("has_tag", (e, a) -> BooleanValue.of(e.getTags().contains(a.getString()))); + put("has_tag", (e, a) -> BooleanValue.of(e.entityTags().contains(a.getString()))); - put("has_scoreboard_tag", (e, a) -> BooleanValue.of(e.getTags().contains(a.getString()))); + put("has_scoreboard_tag", (e, a) -> BooleanValue.of(e.entityTags().contains(a.getString()))); put("has_entity_tag", (e, a) -> { Optional>> tag = e.level().getServer().registryAccess().lookupOrThrow(Registries.ENTITY_TYPE).get(TagKey.create(Registries.ENTITY_TYPE, InputValidator.identifierOf(a.getString()))); if (tag.isEmpty()) diff --git a/src/main/java/carpet/script/value/NBTSerializableValue.java b/src/main/java/carpet/script/value/NBTSerializableValue.java index 279a40a9..a46d8981 100644 --- a/src/main/java/carpet/script/value/NBTSerializableValue.java +++ b/src/main/java/carpet/script/value/NBTSerializableValue.java @@ -211,7 +211,7 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa ); if (!list.isEmpty()) { - inventory = (Container) list.get(world.random.nextInt(list.size())); + inventory = (Container) list.get(world.getRandom().nextInt(list.size())); } } diff --git a/src/main/java/carpet/script/value/ScreenValue.java b/src/main/java/carpet/script/value/ScreenValue.java index 3f82f3be..75400726 100644 --- a/src/main/java/carpet/script/value/ScreenValue.java +++ b/src/main/java/carpet/script/value/ScreenValue.java @@ -39,7 +39,7 @@ import net.minecraft.world.inventory.BlastFurnaceMenu; import net.minecraft.world.inventory.BrewingStandMenu; import net.minecraft.world.inventory.CartographyTableMenu; import net.minecraft.world.inventory.ChestMenu; -import net.minecraft.world.inventory.ClickType; +import net.minecraft.world.inventory.ContainerInput; import net.minecraft.world.inventory.ContainerListener; import net.minecraft.world.inventory.CraftingMenu; import net.minecraft.world.inventory.DataSlot; @@ -226,11 +226,11 @@ public class ScreenValue extends Value screenHandler.addSlotListener(new ScarpetScreenHandlerListener() { @Override - public boolean onSlotClick(ServerPlayer player, ClickType actionType, int slot, int button) + public boolean onSlotClick(ServerPlayer player, ContainerInput actionType, int slot, int button) { Map data = new HashMap<>(); data.put(StringValue.of("slot"), slot == AbstractContainerMenu.SLOT_CLICKED_OUTSIDE ? Value.NULL : NumericValue.of(slot)); - if (actionType == ClickType.QUICK_CRAFT) + if (actionType == ContainerInput.QUICK_CRAFT) { data.put(StringValue.of("quick_craft_stage"), NumericValue.of(AbstractContainerMenu.getQuickcraftHeader(button))); button = AbstractContainerMenu.getQuickcraftType(button); @@ -402,7 +402,7 @@ public class ScreenValue extends Value public interface ScarpetScreenHandlerListener extends ContainerListener { - boolean onSlotClick(ServerPlayer player, ClickType actionType, int slot, int button); + boolean onSlotClick(ServerPlayer player, ContainerInput actionType, int slot, int button); boolean onButtonClick(ServerPlayer player, int button); @@ -546,7 +546,7 @@ public class ScreenValue extends Value } } - private static String actionTypeToString(ClickType actionType) + private static String actionTypeToString(ContainerInput actionType) { return switch (actionType) { diff --git a/src/main/java/carpet/utils/PerimeterDiagnostics.java b/src/main/java/carpet/utils/PerimeterDiagnostics.java index 74b4f263..07e3ec82 100644 --- a/src/main/java/carpet/utils/PerimeterDiagnostics.java +++ b/src/main/java/carpet/utils/PerimeterDiagnostics.java @@ -182,7 +182,7 @@ public class PerimeterDiagnostics { el.snapTo(pos.getX() + 0.5F, pos.getY(), pos.getZ()+0.5F, 0.0F, 0.0F); return el.checkSpawnObstruction(worldServer) && el.checkSpawnRules(worldServer, EntitySpawnReason.NATURAL) && - SpawnPlacements.checkSpawnRules(el.getType(),(ServerLevel)el.level(), EntitySpawnReason.NATURAL, el.blockPosition(), el.level().random) && + SpawnPlacements.checkSpawnRules(el.getType(),(ServerLevel)el.level(), EntitySpawnReason.NATURAL, el.blockPosition(), el.level().getRandom()) && worldServer.noCollision(el); // check collision rules once they stop fiddling with them after 1.14.1 } return false; diff --git a/src/main/java/carpet/utils/SpawnReporter.java b/src/main/java/carpet/utils/SpawnReporter.java index 60bf38aa..8651e34c 100644 --- a/src/main/java/carpet/utils/SpawnReporter.java +++ b/src/main/java/carpet/utils/SpawnReporter.java @@ -439,14 +439,14 @@ public class SpawnReporter { float f = x + 0.5F; float f1 = z + 0.5F; - mob.snapTo(f, y, f1, worldIn.random.nextFloat() * 360.0F, 0.0F); + mob.snapTo(f, y, f1, worldIn.getRandom().nextFloat() * 360.0F, 0.0F); fits = worldIn.noCollision(mob); EntityType etype = mob.getType(); for (int i = 0; i < 20; ++i) { if ( - SpawnPlacements.checkSpawnRules(etype,worldIn, EntitySpawnReason.NATURAL, pos, worldIn.random) && + SpawnPlacements.checkSpawnRules(etype,worldIn, EntitySpawnReason.NATURAL, pos, worldIn.getRandom()) && SpawnPlacements.isSpawnPositionOk(etype, worldIn, pos) && mob.checkSpawnRules(worldIn, EntitySpawnReason.NATURAL) // && mob.canSpawn(worldIn) // entity collisions // mostly - except ocelots diff --git a/src/main/resources/carpet.accesswidener b/src/main/resources/carpet.accesswidener index 23c54edf..ef933dbe 100644 --- a/src/main/resources/carpet.accesswidener +++ b/src/main/resources/carpet.accesswidener @@ -1,4 +1,4 @@ -accessWidener v1 named +accessWidener v1 official accessible class net/minecraft/server/level/ChunkMap$DistanceManager accessible class net/minecraft/server/level/ThreadedLevelLightEngine$TaskType From 1c3568907e73c4fbbc5b3ef1a7d67af727f1f000 Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 17 Dec 2025 17:05:45 +0100 Subject: [PATCH 181/232] carpet 26.1-beta-1 --- build.gradle | 8 ++++---- gradle.properties | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index eef237fa..367383ec 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ base { archivesName = project.archives_base_name } -version = project.minecraft_version+'-'+project.mod_version+'+v'+new Date().format('yyMMdd') +version = project.mod_version+'+v'+new Date().format('yyMMdd') group = project.maven_group loom { @@ -26,10 +26,10 @@ dependencies { } processResources { - inputs.property "version", project.version+'+v'+new Date().format('yyMMdd') - + inputs.property "version", project.version + print("\nBuilding version: " + project.version + "\n") filesMatching("fabric.mod.json") { - expand "version": project.mod_version+'+v'+new Date().format('yyMMdd') + expand "version": project.version } } diff --git a/gradle.properties b/gradle.properties index f9cf694a..c97c8acb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ org.gradle.configuration-cache=false loom_version=1.14-SNAPSHOT # Mod Properties - mod_version = 1.4.193 + mod_version = 26.1-beta-1 maven_group = carpet archives_base_name = fabric-carpet From dec9659975c527f917feb637b7f8961289a9e47b Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 17 Dec 2025 21:33:28 +0100 Subject: [PATCH 182/232] update actions --- .github/workflows/build-on-pr.yml | 6 +++--- .github/workflows/devbuild.yml | 6 +++--- .github/workflows/publish-release.yml | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-on-pr.yml b/.github/workflows/build-on-pr.yml index fbc04aa2..3647d0d7 100644 --- a/.github/workflows/build-on-pr.yml +++ b/.github/workflows/build-on-pr.yml @@ -11,11 +11,11 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up JDK 21 + - name: Set up JDK uses: actions/setup-java@v4 with: - distribution: 'temurin' - java-version: 21 + distribution: microsoft + java-version: 25 cache: 'gradle' - name: Grant execute permission to gradlew run: chmod +x gradlew diff --git a/.github/workflows/devbuild.yml b/.github/workflows/devbuild.yml index 379e74c8..e6cfebab 100644 --- a/.github/workflows/devbuild.yml +++ b/.github/workflows/devbuild.yml @@ -12,11 +12,11 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up JDK 21 + - name: Set up JDK uses: actions/setup-java@v4 with: - distribution: 'temurin' - java-version: 21 + distribution: microsoft + java-version: 25 cache: 'gradle' - name: Grant execute permission to gradlew run: chmod +x gradlew diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index ab90c42e..23578a5c 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -81,11 +81,11 @@ jobs: uses: actions/checkout@v4 with: ref: ${{ steps.getbranchinfo.outputs.branchname }} - - name: Set up JDK 21 + - name: Set up JDK uses: actions/setup-java@v4 with: - distribution: 'temurin' - java-version: 21 + distribution: microsoft + java-version: 25 cache: 'gradle' - name: Grant execute permission to gradlew run: chmod +x gradlew @@ -167,11 +167,11 @@ jobs: steps: - name: Checkout Carpet sources uses: actions/checkout@v4 - - name: Set up JDK 21 + - name: Set up JDK uses: actions/setup-java@v4 with: - distribution: 'temurin' - java-version: 21 + distribution: microsoft + java-version: 25 cache: 'gradle' - name: Checkout wiki uses: actions/checkout@v4 From c7429d795a0d8ee1d92a1d4dbc12b3e6be71cd6d Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 17 Dec 2025 21:36:11 +0100 Subject: [PATCH 183/232] update reqs --- src/main/resources/fabric.mod.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 0ffc258a..6d808f17 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -33,8 +33,8 @@ "accessWidener" : "carpet.accesswidener", "depends": { - "minecraft": ">=1.21.11", - "fabricloader": ">=0.18.2", - "java": ">=21" + "minecraft": ">26.0", + "fabricloader": ">=0.18.3", + "java": ">=25" } } From 49bac4fcaf0e7c558e4d4181a7da891d8e5c588b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 17 Dec 2025 21:04:29 +0000 Subject: [PATCH 184/232] Merge docs for 'Carpet Mod 26.1-beta-1 for Minecraft 26.1-snapshot-1' --- docs/scarpet/Full.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/scarpet/Full.md b/docs/scarpet/Full.md index 3b7f08ec..7f0cf592 100644 --- a/docs/scarpet/Full.md +++ b/docs/scarpet/Full.md @@ -5012,11 +5012,11 @@ Triggered when a player sends a disconnect package or is forcefully disconnected ### `__on_player_message(player, message)` Triggered when a player sends a chat message. +This event can be cancelled by returning `'cancel'`, which prevents the message from being sent. + ### `__on_player_command(player, command)` Triggered when a player runs a command. Command value is returned without the / in front. -This event can be cancelled by returning `'cancel'`, which prevents the message from being sent. - ### `__on_statistic(player, category, event, value)` Triggered when a player statistic changes. Doesn't notify on periodic an rhythmic events, i.e. `time_since_death`, `time_since_rest`, and `played_one_minute` since these are triggered every tick. Event From 317c89a6f505cb0d95d30e575c55f904c3ba802e Mon Sep 17 00:00:00 2001 From: Fallen_Breath Date: Thu, 18 Dec 2025 10:47:22 +0800 Subject: [PATCH 185/232] update jdk to 25 in jitpack.yml also switch to Microsoft OpenJDK --- jitpack.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jitpack.yml b/jitpack.yml index 93274d10..14fc78b7 100644 --- a/jitpack.yml +++ b/jitpack.yml @@ -1,3 +1,3 @@ before_install: -- sdk install java 21.0.2-open -- sdk use java 21.0.2-open +- sdk install java 25.0.1-ms +- sdk use java 25.0.1-ms From 5b8220b22f7af73cfd58818dc4c0e49db270e107 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Sun, 21 Dec 2025 10:06:24 -0500 Subject: [PATCH 186/232] fix: Parched not being killed by killEntity() (#2143) --- src/main/java/carpet/utils/SpawnReporter.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/carpet/utils/SpawnReporter.java b/src/main/java/carpet/utils/SpawnReporter.java index 8651e34c..e8183e15 100644 --- a/src/main/java/carpet/utils/SpawnReporter.java +++ b/src/main/java/carpet/utils/SpawnReporter.java @@ -22,6 +22,7 @@ import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.MobCategory; import net.minecraft.world.entity.SpawnPlacements; import net.minecraft.world.entity.animal.feline.Ocelot; +import net.minecraft.world.entity.monster.skeleton.Parched; import net.minecraft.world.item.DyeColor; import net.minecraft.world.level.Level; import net.minecraft.world.level.NaturalSpawner; @@ -380,7 +381,7 @@ public class SpawnReporter e.discard(); } } - if (entity instanceof Ocelot) + if (entity instanceof Ocelot || entity instanceof Parched) { for (Entity e: entity.level().getEntities(entity, entity.getBoundingBox())) { From 0595f0ced79801a50cd81517b018b25ebb101f59 Mon Sep 17 00:00:00 2001 From: altrisi Date: Tue, 23 Dec 2025 01:03:03 +0100 Subject: [PATCH 187/232] Move some things around, add chicken to this version, don't cast Together with the previous commit, closes #2144 --- src/main/java/carpet/utils/SpawnReporter.java | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/main/java/carpet/utils/SpawnReporter.java b/src/main/java/carpet/utils/SpawnReporter.java index e8183e15..3a3cc542 100644 --- a/src/main/java/carpet/utils/SpawnReporter.java +++ b/src/main/java/carpet/utils/SpawnReporter.java @@ -17,12 +17,10 @@ import net.minecraft.util.random.WeightedList; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.MobCategory; import net.minecraft.world.entity.SpawnPlacements; -import net.minecraft.world.entity.animal.feline.Ocelot; -import net.minecraft.world.entity.monster.skeleton.Parched; +import net.minecraft.world.entity.animal.chicken.Chicken; import net.minecraft.world.item.DyeColor; import net.minecraft.world.level.Level; import net.minecraft.world.level.NaturalSpawner; @@ -368,20 +366,22 @@ public class SpawnReporter return report; } - public static void killEntity(LivingEntity entity) + public static void killEntity(Entity entity) { + // Some entities, like Parched and the Warm Chicken Variant also + // require special treatment due to new multi-passenger Jockeys (Camel Husk, etc) + List toRemove = new ArrayList<>(); if (entity.isPassenger()) { - entity.getVehicle().discard(); + Entity vehicle = entity.getVehicle(); + toRemove.addAll(vehicle.getPassengers()); + toRemove.add(vehicle); } if (entity.isVehicle()) { - for (Entity e: entity.getPassengers()) - { - e.discard(); - } + toRemove.addAll(entity.getPassengers()); } - if (entity instanceof Ocelot || entity instanceof Parched) + if (entity instanceof Chicken) // TODO why is the warm chicken special { for (Entity e: entity.level().getEntities(entity, entity.getBoundingBox())) { @@ -389,6 +389,7 @@ public class SpawnReporter } } entity.discard(); + toRemove.forEach(entry -> killEntity(entry)); } // yeeted from NaturalSpawner - temporary access fix From dee2d0fb87fb70e7a412fc685eae473d4489abcd Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 7 Jan 2026 19:02:46 +0100 Subject: [PATCH 188/232] 26.1-snap-2 --- gradle.properties | 4 ++-- .../mixins/LevelChunk_movableBEMixin.java | 2 +- .../LevelEntityGetterAdapter_scarpetMixin.java | 2 +- ...lLightEngine_scarpetChunkCreationMixin.java | 8 ++++---- .../java/carpet/script/CarpetEventServer.java | 6 +++--- .../java/carpet/script/api/WorldAccess.java | 18 +++++++++--------- .../carpet/script/utils/FeatureGenerator.java | 8 ++++---- .../java/carpet/script/utils/WorldTools.java | 6 +++--- 8 files changed, 27 insertions(+), 27 deletions(-) diff --git a/gradle.properties b/gradle.properties index c97c8acb..9a8ada7f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,8 +7,8 @@ org.gradle.configuration-cache=false # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=26.1-snapshot-1 - loader_version=0.18.3 + minecraft_version=26.1-snapshot-2 + loader_version=0.18.4 loom_version=1.14-SNAPSHOT # Mod Properties diff --git a/src/main/java/carpet/mixins/LevelChunk_movableBEMixin.java b/src/main/java/carpet/mixins/LevelChunk_movableBEMixin.java index 4417cfde..19dddc05 100644 --- a/src/main/java/carpet/mixins/LevelChunk_movableBEMixin.java +++ b/src/main/java/carpet/mixins/LevelChunk_movableBEMixin.java @@ -108,7 +108,7 @@ public abstract class LevelChunk_movableBEMixin extends ChunkAccess implements W if (hadOnlyAir != hasOnlyAir) { this.level.getChunkSource().getLightEngine().updateSectionStatus(blockPos_1, hasOnlyAir); - this.level.getChunkSource().onSectionEmptinessChanged(chunkPos.x, SectionPos.blockToSectionCoord(y), chunkPos.z, hasOnlyAir); + this.level.getChunkSource().onSectionEmptinessChanged(chunkPos.x(), SectionPos.blockToSectionCoord(y), chunkPos.z(), hasOnlyAir); } if (LightEngine.hasDifferentLightProperties(oldBlockState, newBlockState)) { diff --git a/src/main/java/carpet/mixins/LevelEntityGetterAdapter_scarpetMixin.java b/src/main/java/carpet/mixins/LevelEntityGetterAdapter_scarpetMixin.java index 51ae9212..b13b77a2 100644 --- a/src/main/java/carpet/mixins/LevelEntityGetterAdapter_scarpetMixin.java +++ b/src/main/java/carpet/mixins/LevelEntityGetterAdapter_scarpetMixin.java @@ -21,7 +21,7 @@ public class LevelEntityGetterAdapter_scarpetMixin imple @Override public List getChunkEntities(ChunkPos chpos) { - return this.sectionStorage.getExistingSectionsInChunk(chpos.toLong()).flatMap(EntitySection::getEntities).collect(Collectors.toList()); + return this.sectionStorage.getExistingSectionsInChunk(chpos.pack()).flatMap(EntitySection::getEntities).collect(Collectors.toList()); } } diff --git a/src/main/java/carpet/mixins/ThreadedLevelLightEngine_scarpetChunkCreationMixin.java b/src/main/java/carpet/mixins/ThreadedLevelLightEngine_scarpetChunkCreationMixin.java index ea0eaa22..7b21034a 100644 --- a/src/main/java/carpet/mixins/ThreadedLevelLightEngine_scarpetChunkCreationMixin.java +++ b/src/main/java/carpet/mixins/ThreadedLevelLightEngine_scarpetChunkCreationMixin.java @@ -46,9 +46,9 @@ public abstract class ThreadedLevelLightEngine_scarpetChunkCreationMixin extends ChunkPos pos = chunk.getPos(); chunk.setLightCorrect(false); - this.addTask(pos.x, pos.z, () -> 0, ThreadedLevelLightEngine.TaskType.PRE_UPDATE, Util.name(() -> { + this.addTask(pos.x(), pos.z(), () -> 0, ThreadedLevelLightEngine.TaskType.PRE_UPDATE, Util.name(() -> { super.setLightEnabled(pos, false); - ((Lighting_scarpetChunkCreationInterface) this).removeLightData(SectionPos.getZeroNode(SectionPos.asLong(pos.x, 0, pos.z))); + ((Lighting_scarpetChunkCreationInterface) this).removeLightData(SectionPos.getZeroNode(SectionPos.asLong(pos.x(), 0, pos.z()))); }, () -> "Remove light data " + pos )); @@ -59,7 +59,7 @@ public abstract class ThreadedLevelLightEngine_scarpetChunkCreationMixin extends { ChunkPos pos = chunk.getPos(); - this.addTask(pos.x, pos.z, () -> 0, ThreadedLevelLightEngine.TaskType.PRE_UPDATE, Util.name(() -> { + this.addTask(pos.x(), pos.z(), () -> 0, ThreadedLevelLightEngine.TaskType.PRE_UPDATE, Util.name(() -> { super.propagateLightSources(pos); int minY = chunk.getMinY(); int maxY = chunk.getMaxY(); @@ -92,7 +92,7 @@ public abstract class ThreadedLevelLightEngine_scarpetChunkCreationMixin extends }, () -> "Release relight ticket " + pos ), - runnable -> this.addTask(pos.x, pos.z, () -> 0, ThreadedLevelLightEngine.TaskType.POST_UPDATE, runnable) + runnable -> this.addTask(pos.x(), pos.z(), () -> 0, ThreadedLevelLightEngine.TaskType.POST_UPDATE, runnable) ); } } diff --git a/src/main/java/carpet/script/CarpetEventServer.java b/src/main/java/carpet/script/CarpetEventServer.java index c7a8ecc8..0c2005dc 100644 --- a/src/main/java/carpet/script/CarpetEventServer.java +++ b/src/main/java/carpet/script/CarpetEventServer.java @@ -509,7 +509,7 @@ public class CarpetEventServer public void onChunkEvent(ServerLevel world, ChunkPos chPos, boolean generated) { handler.call( - () -> Arrays.asList(new NumericValue(chPos.x << 4), new NumericValue(chPos.z << 4)), + () -> Arrays.asList(new NumericValue(chPos.x() << 4), new NumericValue(chPos.z() << 4)), () -> world.getServer().createCommandSourceStack().withLevel(world) ); } @@ -521,7 +521,7 @@ public class CarpetEventServer public void onChunkEvent(ServerLevel world, ChunkPos chPos, boolean generated) { handler.call( - () -> Arrays.asList(new NumericValue(chPos.x << 4), new NumericValue(chPos.z << 4)), + () -> Arrays.asList(new NumericValue(chPos.x() << 4), new NumericValue(chPos.z() << 4)), () -> world.getServer().createCommandSourceStack().withLevel(world) ); } @@ -533,7 +533,7 @@ public class CarpetEventServer public void onChunkEvent(ServerLevel world, ChunkPos chPos, boolean generated) { handler.call( - () -> Arrays.asList(new NumericValue(chPos.x << 4), new NumericValue(chPos.z << 4)), + () -> Arrays.asList(new NumericValue(chPos.x() << 4), new NumericValue(chPos.z() << 4)), () -> world.getServer().createCommandSourceStack().withLevel(world) ); } diff --git a/src/main/java/carpet/script/api/WorldAccess.java b/src/main/java/carpet/script/api/WorldAccess.java index 0b7bd103..a748e752 100644 --- a/src/main/java/carpet/script/api/WorldAccess.java +++ b/src/main/java/carpet/script/api/WorldAccess.java @@ -570,9 +570,9 @@ public class WorldAccess expression.addContextFunction("in_slime_chunk", -1, (c, t, lv) -> { BlockPos pos = BlockArgument.findIn((CarpetContext) c, lv, 0).block.getPos(); - ChunkPos chunkPos = new ChunkPos(pos); + ChunkPos chunkPos = ChunkPos.containing(pos); return BooleanValue.of(WorldgenRandom.seedSlimeChunk( - chunkPos.x, chunkPos.z, + chunkPos.x(), chunkPos.z(), ((CarpetContext) c).level().getSeed(), 987234911L ).nextInt(10) == 0); @@ -624,7 +624,7 @@ public class WorldAccess { force = lv.get(locator.offset).getBoolean(); } - return BooleanValue.of(canHasChunk(((CarpetContext) c).level(), new ChunkPos(pos), null, force)); + return BooleanValue.of(canHasChunk(((CarpetContext) c).level(), ChunkPos.containing(pos), null, force)); }); expression.addContextFunction("generation_status", -1, (c, t, lv) -> @@ -651,14 +651,14 @@ public class WorldAccess { for (long key : levelTickets.keySet()) { - ChunkPos chpos = new ChunkPos(key); + ChunkPos chpos = ChunkPos.unpack(key); for (Ticket ticket : levelTickets.get(key)) { res.add(ListValue.of( new StringValue(ticket.getType().toString()), new NumericValue(33 - ticket.getTicketLevel()), - new NumericValue(chpos.x), - new NumericValue(chpos.z) + new NumericValue(chpos.x()), + new NumericValue(chpos.z()) )); } } @@ -667,7 +667,7 @@ public class WorldAccess { BlockArgument blockArgument = BlockArgument.findIn((CarpetContext) c, lv, 0); BlockPos pos = blockArgument.block.getPos(); - List tickets = levelTickets.get(new ChunkPos(pos).toLong()); + List tickets = levelTickets.get(ChunkPos.containing(pos).pack()); if (tickets != null) { for (Ticket ticket : tickets) @@ -1574,7 +1574,7 @@ public class WorldAccess world.getChunk(chpos.getWorldPosition()).getAllReferences(); if (references.containsKey(configuredStructure) && references.get(configuredStructure) != null) { - references.get(configuredStructure).remove(structureChunkPos.toLong()); + references.get(configuredStructure).remove(structureChunkPos.pack()); } } } @@ -1695,7 +1695,7 @@ public class WorldAccess throw new InternalExpressionException("Ticket radius should be between 1 and 32 chunks"); } // due to types we will wing it: - ChunkPos target = new ChunkPos(pos); + ChunkPos target = ChunkPos.containing(pos); if (ticket == TicketType.PORTAL) // portal { cc.level().getChunkSource().addTicketWithRadius(TicketType.PORTAL, target, radius); diff --git a/src/main/java/carpet/script/utils/FeatureGenerator.java b/src/main/java/carpet/script/utils/FeatureGenerator.java index f6186fd3..5955d889 100644 --- a/src/main/java/carpet/script/utils/FeatureGenerator.java +++ b/src/main/java/carpet/script/utils/FeatureGenerator.java @@ -239,8 +239,8 @@ public class FeatureGenerator ChunkGenerator generator = chunkSource.getGenerator(); ChunkGeneratorStructureState structureState = chunkSource.getGeneratorState(); List structureConfig = structureState.getPlacementsForStructure(Holder.direct(structure)); - ChunkPos chunkPos = new ChunkPos(pos); - boolean couldPlace = structureConfig.stream().anyMatch(p -> p.isStructureChunk(structureState, chunkPos.x, chunkPos.z)); + ChunkPos chunkPos = ChunkPos.containing(pos); + boolean couldPlace = structureConfig.stream().anyMatch(p -> p.isStructureChunk(structureState, chunkPos.x(), chunkPos.z())); if (!couldPlace) { return null; @@ -418,7 +418,7 @@ public class FeatureGenerator checks.set(true); try { - StructureStart start = structure.generate(Holder.direct(structure), world.dimension(), world.registryAccess(), generator, generator.getBiomeSource(), world.getChunkSource().randomState(), world.getStructureManager(), world.getSeed(), new ChunkPos(pos), 0, world, b -> true); + StructureStart start = structure.generate(Holder.direct(structure), world.dimension(), world.registryAccess(), generator, generator.getBiomeSource(), world.getChunkSource().randomState(), world.getStructureManager(), world.getSeed(), ChunkPos.containing(pos), 0, world, b -> true); if (start == StructureStart.INVALID_START) { return false; @@ -426,7 +426,7 @@ public class FeatureGenerator RandomSource rand = RandomSource.create(world.getRandom().nextInt()); int j = pos.getX() >> 4; int k = pos.getZ() >> 4; - long chId = ChunkPos.asLong(j, k); + long chId = ChunkPos.pack(j, k); world.getChunk(j, k).setStartForStructure(structure, start); world.getChunk(j, k).addReferenceForStructure(structure, chId); diff --git a/src/main/java/carpet/script/utils/WorldTools.java b/src/main/java/carpet/script/utils/WorldTools.java index c3c4064f..27dea11b 100644 --- a/src/main/java/carpet/script/utils/WorldTools.java +++ b/src/main/java/carpet/script/utils/WorldTools.java @@ -47,7 +47,7 @@ public class WorldTools public static boolean canHasChunk(ServerLevel world, ChunkPos chpos, @Nullable Map regionCache, boolean deepcheck) { - if (world.getChunk(chpos.x, chpos.z, ChunkStatus.STRUCTURE_STARTS, false) != null) + if (world.getChunk(chpos.x(), chpos.z(), ChunkStatus.STRUCTURE_STARTS, false) != null) { return true; } @@ -159,8 +159,8 @@ public class WorldTools public static void forceChunkUpdate(BlockPos pos, ServerLevel world) { - ChunkPos chunkPos = new ChunkPos(pos); - LevelChunk worldChunk = world.getChunkSource().getChunk(chunkPos.x, chunkPos.z, false); + ChunkPos chunkPos = ChunkPos.containing(pos); + LevelChunk worldChunk = world.getChunkSource().getChunk(chunkPos.x(), chunkPos.z(), false); if (worldChunk != null) { List players = world.getChunkSource().chunkMap.getPlayers(chunkPos, false); From 10be902bcce5002f19a4220fd517b5556636ac46 Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 7 Jan 2026 19:03:13 +0100 Subject: [PATCH 189/232] 26.1-beta-2 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 9a8ada7f..4db2a444 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ org.gradle.configuration-cache=false loom_version=1.14-SNAPSHOT # Mod Properties - mod_version = 26.1-beta-1 + mod_version = 26.1-beta-2 maven_group = carpet archives_base_name = fabric-carpet From 9158f96b9b58b85616b7c5e8579470d948a70c38 Mon Sep 17 00:00:00 2001 From: gnembon Date: Tue, 13 Jan 2026 23:09:32 +0100 Subject: [PATCH 190/232] 26.1-snap-3 --- gradle.properties | 2 +- .../java/carpet/helpers/EntityPlayerActionPack.java | 4 ++-- .../mixins/ItemStack_stackableShulkerBoxesMixin.java | 10 ++++++---- .../carpet/mixins/MinecraftServer_scarpetMixin.java | 2 +- .../java/carpet/mixins/Player_scarpetEventsMixin.java | 4 +++- src/main/java/carpet/script/api/Auxiliary.java | 5 +++-- src/main/java/carpet/script/api/Inventories.java | 2 +- 7 files changed, 17 insertions(+), 12 deletions(-) diff --git a/gradle.properties b/gradle.properties index 4db2a444..33a75fa6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ org.gradle.configuration-cache=false # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=26.1-snapshot-2 + minecraft_version=26.1-snapshot-3 loader_version=0.18.4 loom_version=1.14-SNAPSHOT diff --git a/src/main/java/carpet/helpers/EntityPlayerActionPack.java b/src/main/java/carpet/helpers/EntityPlayerActionPack.java index f172892d..4b2da3fb 100644 --- a/src/main/java/carpet/helpers/EntityPlayerActionPack.java +++ b/src/main/java/carpet/helpers/EntityPlayerActionPack.java @@ -334,13 +334,13 @@ public class EntityPlayerActionPack boolean handWasEmpty = player.getItemInHand(hand).isEmpty(); boolean itemFrameEmpty = (entity instanceof ItemFrame) && ((ItemFrame) entity).getItem().isEmpty(); Vec3 relativeHitPos = entityHit.getLocation().subtract(entity.getX(), entity.getY(), entity.getZ()); - if (entity.interactAt(player, relativeHitPos, hand).consumesAction()) + if (entity.interact(player, hand, relativeHitPos).consumesAction()) { ap.itemUseCooldown = 3; return true; } // fix for SS itemframe always returns CONSUME even if no action is performed - if (player.interactOn(entity, hand).consumesAction() && !(handWasEmpty && itemFrameEmpty)) + if (player.interactOn(entity, hand, relativeHitPos).consumesAction() && !(handWasEmpty && itemFrameEmpty)) { ap.itemUseCooldown = 3; return true; diff --git a/src/main/java/carpet/mixins/ItemStack_stackableShulkerBoxesMixin.java b/src/main/java/carpet/mixins/ItemStack_stackableShulkerBoxesMixin.java index 4f11e6de..79432d89 100644 --- a/src/main/java/carpet/mixins/ItemStack_stackableShulkerBoxesMixin.java +++ b/src/main/java/carpet/mixins/ItemStack_stackableShulkerBoxesMixin.java @@ -3,6 +3,7 @@ package carpet.mixins; import carpet.CarpetSettings; import net.minecraft.core.component.DataComponents; import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.ItemInstance; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.component.ItemContainerContents; import net.minecraft.world.level.block.ShulkerBoxBlock; @@ -11,16 +12,17 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -@Mixin(ItemStack.class) -public class ItemStack_stackableShulkerBoxesMixin +@Mixin(ItemInstance.class) +public interface ItemStack_stackableShulkerBoxesMixin { @Inject(method = "getMaxStackSize", at = @At("HEAD"), cancellable = true) private void getCMMAxStackSize(CallbackInfoReturnable cir) { if (CarpetSettings.shulkerBoxStackSize > 1 - && ((ItemStack)((Object)this)).getItem() instanceof BlockItem blockItem + && ((ItemInstance)((Object)this)) instanceof final ItemStack itemStack + && itemStack.getItem() instanceof BlockItem blockItem && blockItem.getBlock() instanceof ShulkerBoxBlock - && ((ItemStack) ((Object) this)).getOrDefault(DataComponents.CONTAINER, ItemContainerContents.EMPTY).stream().findAny().isEmpty() + && ((ItemStack) ((Object) this)).getOrDefault(DataComponents.CONTAINER, ItemContainerContents.EMPTY).allItemsCopyStream().findAny().isEmpty() ) { cir.setReturnValue(CarpetSettings.shulkerBoxStackSize); } diff --git a/src/main/java/carpet/mixins/MinecraftServer_scarpetMixin.java b/src/main/java/carpet/mixins/MinecraftServer_scarpetMixin.java index 2bf5418d..d0d2337f 100644 --- a/src/main/java/carpet/mixins/MinecraftServer_scarpetMixin.java +++ b/src/main/java/carpet/mixins/MinecraftServer_scarpetMixin.java @@ -102,7 +102,7 @@ public abstract class MinecraftServer_scarpetMixin extends ReentrantBlockableEve @Override public void reloadAfterReload(RegistryAccess newRegs) { - resources.managers().updateStaticRegistryTags(); + resources.managers().updateComponentsAndStaticRegistryTags(); getPlayerList().saveAll(); getPlayerList().reloadResources(); functionManager.replaceLibrary(this.resources.managers().getFunctionLibrary()); diff --git a/src/main/java/carpet/mixins/Player_scarpetEventsMixin.java b/src/main/java/carpet/mixins/Player_scarpetEventsMixin.java index 5454d21a..a84b427a 100644 --- a/src/main/java/carpet/mixins/Player_scarpetEventsMixin.java +++ b/src/main/java/carpet/mixins/Player_scarpetEventsMixin.java @@ -12,6 +12,7 @@ import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; +import net.minecraft.world.phys.Vec3; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -66,10 +67,11 @@ public abstract class Player_scarpetEventsMixin extends LivingEntity } @Inject(method = "interactOn", cancellable = true, at = @At("HEAD")) - private void doInteract(Entity entity, InteractionHand hand, CallbackInfoReturnable cir) + private void doInteract(Entity entity, InteractionHand hand, Vec3 pos, CallbackInfoReturnable cir) { if (!level().isClientSide() && PLAYER_INTERACTS_WITH_ENTITY.isNeeded()) { + // consider using pos now? if(PLAYER_INTERACTS_WITH_ENTITY.onEntityHandAction((ServerPlayer) (Object)this, entity, hand)) { cir.setReturnValue(InteractionResult.PASS); cir.cancel(); diff --git a/src/main/java/carpet/script/api/Auxiliary.java b/src/main/java/carpet/script/api/Auxiliary.java index 1e9b5e54..3a3fb0ad 100644 --- a/src/main/java/carpet/script/api/Auxiliary.java +++ b/src/main/java/carpet/script/api/Auxiliary.java @@ -64,6 +64,7 @@ import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundSource; import net.minecraft.stats.Stat; import net.minecraft.stats.StatType; +import net.minecraft.world.clock.WorldClocks; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EquipmentSlot; @@ -729,7 +730,7 @@ public class Auxiliary expression.addContextFunction("day_time", -1, (c, t, lv) -> { - Value time = new NumericValue(((CarpetContext) c).level().getDayTime()); + Value time = new NumericValue(((CarpetContext) c).level().getOverworldClockTime()); if (!lv.isEmpty()) { long newTime = NumericValue.asNumber(lv.get(0)).getLong(); @@ -737,7 +738,7 @@ public class Auxiliary { newTime = 0; } - ((CarpetContext) c).level().setDayTime(newTime); + ((CarpetContext) c).level().clockManager().setTotalTicks(((CarpetContext) c).registryAccess().getOrThrow(WorldClocks.OVERWORLD), newTime); } return time; }); diff --git a/src/main/java/carpet/script/api/Inventories.java b/src/main/java/carpet/script/api/Inventories.java index 35b1b26d..28b9de22 100644 --- a/src/main/java/carpet/script/api/Inventories.java +++ b/src/main/java/carpet/script/api/Inventories.java @@ -200,7 +200,7 @@ public class Inventories CarpetContext cc = (CarpetContext) c; Registry registry = cc.registry(Registries.ITEM); Item item = registry.getOptional(id).orElseThrow(() -> new ThrowStatement(itemStr, Throwables.UNKNOWN_ITEM)); - ItemStack reminder = item.getCraftingRemainder(); + ItemStack reminder = item.getCraftingRemainder().create(); return reminder.isEmpty() ? Value.NULL : ValueConversions.of(reminder, cc.registryAccess()); }); From d744d06d98cc07c7d47d7eb6c85c47e91a2590d0 Mon Sep 17 00:00:00 2001 From: gnembon Date: Tue, 13 Jan 2026 23:09:57 +0100 Subject: [PATCH 191/232] 26.1-beta-3 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 33a75fa6..864f1393 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ org.gradle.configuration-cache=false loom_version=1.14-SNAPSHOT # Mod Properties - mod_version = 26.1-beta-2 + mod_version = 26.1-beta-3 maven_group = carpet archives_base_name = fabric-carpet From 9820fbf1d188cc4c1d8a072743c1f9d67a91e234 Mon Sep 17 00:00:00 2001 From: gnembon Date: Tue, 20 Jan 2026 22:02:09 +0100 Subject: [PATCH 192/232] 26.1-snap-4 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 864f1393..aa5e4ab1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ org.gradle.configuration-cache=false # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=26.1-snapshot-3 + minecraft_version=26.1-snapshot-4 loader_version=0.18.4 loom_version=1.14-SNAPSHOT From 85e75c4cab0095c8e83a189185537cf70b6786b8 Mon Sep 17 00:00:00 2001 From: gnembon Date: Tue, 27 Jan 2026 22:22:46 +0100 Subject: [PATCH 193/232] 26.1-snap-5 --- gradle.properties | 2 +- src/main/java/carpet/helpers/HopperCounter.java | 3 ++- .../mixins/ServerPlayerGameMode_scarpetEventsMixin.java | 2 +- src/main/java/carpet/script/command/CommandArgument.java | 2 +- src/main/java/carpet/script/value/NBTSerializableValue.java | 6 +++--- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/gradle.properties b/gradle.properties index aa5e4ab1..dfc76cd6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ org.gradle.configuration-cache=false # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=26.1-snapshot-4 + minecraft_version=26.1-snapshot-5 loader_version=0.18.4 loom_version=1.14-SNAPSHOT diff --git a/src/main/java/carpet/helpers/HopperCounter.java b/src/main/java/carpet/helpers/HopperCounter.java index bff480ef..92080b8a 100644 --- a/src/main/java/carpet/helpers/HopperCounter.java +++ b/src/main/java/carpet/helpers/HopperCounter.java @@ -9,6 +9,7 @@ import net.minecraft.ChatFormatting; import net.minecraft.core.Holder; import net.minecraft.core.Registry; import net.minecraft.core.RegistryAccess; +import net.minecraft.core.component.DataComponents; import net.minecraft.core.registries.Registries; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; @@ -365,7 +366,7 @@ public class HopperCounter } if (item instanceof DyeItem dye) { - return TextColor.fromRgb(appropriateColor(dye.getDyeColor().getMapColor().col)); + return TextColor.fromRgb(appropriateColor(Optional.ofNullable(dye.getDefaultInstance().get(DataComponents.DYE)).orElse(DyeColor.WHITE).getMapColor().col)); } Block block = null; final Registry itemRegistry = registryAccess.lookupOrThrow(Registries.ITEM); diff --git a/src/main/java/carpet/mixins/ServerPlayerGameMode_scarpetEventsMixin.java b/src/main/java/carpet/mixins/ServerPlayerGameMode_scarpetEventsMixin.java index 5587c438..25400f96 100644 --- a/src/main/java/carpet/mixins/ServerPlayerGameMode_scarpetEventsMixin.java +++ b/src/main/java/carpet/mixins/ServerPlayerGameMode_scarpetEventsMixin.java @@ -54,7 +54,7 @@ public class ServerPlayerGameMode_scarpetEventsMixin implements ServerPlayerInte @Inject(method = "useItemOn", at = @At( value = "INVOKE", - target = "Lnet/minecraft/advancements/criterion/ItemUsedOnLocationTrigger;trigger(Lnet/minecraft/server/level/ServerPlayer;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/item/ItemStack;)V", + target = "Lnet/minecraft/advancements/criterion/ItemUsedOnLocationTrigger;trigger(Lnet/minecraft/server/level/ServerPlayer;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/item/ItemInstance;)V", shift = At.Shift.BEFORE )) private void onBlockActivated(ServerPlayer serverPlayerEntity, Level world, ItemStack stack, InteractionHand hand, BlockHitResult hitResult, CallbackInfoReturnable cir) diff --git a/src/main/java/carpet/script/command/CommandArgument.java b/src/main/java/carpet/script/command/CommandArgument.java index 394e1d4e..d9b7e1aa 100644 --- a/src/main/java/carpet/script/command/CommandArgument.java +++ b/src/main/java/carpet/script/command/CommandArgument.java @@ -179,7 +179,7 @@ public abstract class CommandArgument // item_predicate ?? //same as item but accepts tags, not sure right now new SlotArgument(), new VanillaUnconfigurableArgument("item", ItemArgument::item, - (c, p) -> ValueConversions.of(ItemArgument.getItem(c, p).createItemStack(1, false), c.getSource().registryAccess()), + (c, p) -> ValueConversions.of(ItemArgument.getItem(c, p).createItemStack(1), c.getSource().registryAccess()), param -> (ctx, builder) -> ctx.getArgument(param, ItemArgument.class).listSuggestions(ctx, builder) ), new VanillaUnconfigurableArgument("message", MessageArgument::message, diff --git a/src/main/java/carpet/script/value/NBTSerializableValue.java b/src/main/java/carpet/script/value/NBTSerializableValue.java index a46d8981..1056f8d1 100644 --- a/src/main/java/carpet/script/value/NBTSerializableValue.java +++ b/src/main/java/carpet/script/value/NBTSerializableValue.java @@ -354,9 +354,9 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa ItemInput res = itemCache.get(itemString); // [SCARY SHIT] persistent caches over server reloads if (res != null) { - return res.createItemStack(1, false); + return res.createItemStack(1); } - ItemParser.ItemResult parser = (new ItemParser(regs)).parse(new StringReader(itemString)); + ItemInput parser = (new ItemParser(regs)).parse(new StringReader(itemString)); res = new ItemInput(parser.item(), parser.components()); itemCache.put(itemString, res); @@ -364,7 +364,7 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa { itemCache.clear(); } - return res.createItemStack(1, false); + return res.createItemStack(1); } catch (CommandSyntaxException e) { From b1aa6844d1c81abfe5d9daa89211f6c9b2e5f953 Mon Sep 17 00:00:00 2001 From: gnembon Date: Tue, 27 Jan 2026 22:25:41 +0100 Subject: [PATCH 194/232] 26.1-beta-4 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index dfc76cd6..a530b575 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ org.gradle.configuration-cache=false loom_version=1.14-SNAPSHOT # Mod Properties - mod_version = 26.1-beta-3 + mod_version = 26.1-beta-4 maven_group = carpet archives_base_name = fabric-carpet From 22c788bf58785a79d495c2e37846992dd5c65093 Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 4 Feb 2026 12:01:39 +0100 Subject: [PATCH 195/232] 26.1-snap-6 --- gradle.properties | 2 +- .../java/carpet/fakes/BrainInterface.java | 10 +++++++++ .../carpet/fakes/ServerWorldInterface.java | 10 --------- .../carpet/mixins/Brain_scarpetMixin.java | 22 +++++++++++++++++++ .../ChunkMap_scarpetChunkCreationMixin.java | 1 - .../mixins/ServerLevel_scarpetMixin.java | 22 +------------------ .../java/carpet/mixins/Villager_aiMixin.java | 4 ++-- .../java/carpet/script/api/Scoreboards.java | 20 +++++++++-------- .../java/carpet/script/api/WorldAccess.java | 11 ++++++---- .../java/carpet/script/external/Vanilla.java | 12 +++++----- .../java/carpet/script/utils/SystemInfo.java | 2 +- .../java/carpet/script/value/EntityValue.java | 11 +++++----- src/main/resources/carpet.mixins.json | 1 + 13 files changed, 68 insertions(+), 60 deletions(-) create mode 100644 src/main/java/carpet/fakes/BrainInterface.java delete mode 100644 src/main/java/carpet/fakes/ServerWorldInterface.java create mode 100644 src/main/java/carpet/mixins/Brain_scarpetMixin.java diff --git a/gradle.properties b/gradle.properties index a530b575..a584fa26 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ org.gradle.configuration-cache=false # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=26.1-snapshot-5 + minecraft_version=26.1-snapshot-6 loader_version=0.18.4 loom_version=1.14-SNAPSHOT diff --git a/src/main/java/carpet/fakes/BrainInterface.java b/src/main/java/carpet/fakes/BrainInterface.java new file mode 100644 index 00000000..d111aec4 --- /dev/null +++ b/src/main/java/carpet/fakes/BrainInterface.java @@ -0,0 +1,10 @@ +package carpet.fakes; + +import net.minecraft.world.entity.ai.memory.MemoryModuleType; +import net.minecraft.world.entity.ai.memory.MemorySlot; + +import java.util.Map; + +public interface BrainInterface { + Map, MemorySlot> getMemoriesCM(); +} diff --git a/src/main/java/carpet/fakes/ServerWorldInterface.java b/src/main/java/carpet/fakes/ServerWorldInterface.java deleted file mode 100644 index 8617acad..00000000 --- a/src/main/java/carpet/fakes/ServerWorldInterface.java +++ /dev/null @@ -1,10 +0,0 @@ -package carpet.fakes; - -import net.minecraft.world.entity.Entity; -import net.minecraft.world.level.entity.LevelEntityGetter; -import net.minecraft.world.level.storage.ServerLevelData; - -public interface ServerWorldInterface { - ServerLevelData getWorldPropertiesCM(); - LevelEntityGetter getEntityLookupCMPublic(); -} diff --git a/src/main/java/carpet/mixins/Brain_scarpetMixin.java b/src/main/java/carpet/mixins/Brain_scarpetMixin.java new file mode 100644 index 00000000..7272908d --- /dev/null +++ b/src/main/java/carpet/mixins/Brain_scarpetMixin.java @@ -0,0 +1,22 @@ +package carpet.mixins; + +import carpet.fakes.BrainInterface; +import net.minecraft.world.entity.ai.Brain; +import net.minecraft.world.entity.ai.memory.MemoryModuleType; +import net.minecraft.world.entity.ai.memory.MemorySlot; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; + +import java.util.Map; + +@Mixin(Brain.class) +public class Brain_scarpetMixin implements BrainInterface { + @Shadow @Final + private Map, MemorySlot> memories; + + @Override + public Map, MemorySlot> getMemoriesCM() { + return memories; + } +} diff --git a/src/main/java/carpet/mixins/ChunkMap_scarpetChunkCreationMixin.java b/src/main/java/carpet/mixins/ChunkMap_scarpetChunkCreationMixin.java index fa19c497..df49f3d2 100644 --- a/src/main/java/carpet/mixins/ChunkMap_scarpetChunkCreationMixin.java +++ b/src/main/java/carpet/mixins/ChunkMap_scarpetChunkCreationMixin.java @@ -14,7 +14,6 @@ import java.util.function.IntFunction; import java.util.stream.Collectors; import carpet.fakes.SimpleEntityLookupInterface; -import carpet.fakes.ServerWorldInterface; import net.minecraft.util.Util; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.server.MinecraftServer; diff --git a/src/main/java/carpet/mixins/ServerLevel_scarpetMixin.java b/src/main/java/carpet/mixins/ServerLevel_scarpetMixin.java index e03af9c9..8646b9b3 100644 --- a/src/main/java/carpet/mixins/ServerLevel_scarpetMixin.java +++ b/src/main/java/carpet/mixins/ServerLevel_scarpetMixin.java @@ -1,6 +1,5 @@ package carpet.mixins; -import carpet.fakes.ServerWorldInterface; import net.minecraft.core.BlockPos; import net.minecraft.core.Holder; import net.minecraft.core.RegistryAccess; @@ -37,14 +36,12 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.LocalCapture; -import java.util.function.Supplier; - import static carpet.script.CarpetEventServer.Event.EXPLOSION; import static carpet.script.CarpetEventServer.Event.LIGHTNING; import static carpet.script.CarpetEventServer.Event.CHUNK_UNLOADED; @Mixin(ServerLevel.class) -public abstract class ServerLevel_scarpetMixin extends Level implements ServerWorldInterface +public abstract class ServerLevel_scarpetMixin extends Level { @Shadow public abstract GameRules getGameRules(); @@ -97,21 +94,4 @@ public abstract class ServerLevel_scarpetMixin extends Level implements ServerWo CHUNK_UNLOADED.onChunkEvent(level, levelChunk.getPos(), false); } } - - @Final - @Shadow - private ServerLevelData serverLevelData; - @Shadow @Final private PersistentEntitySectionManager entityManager; - - @Unique - @Override - public ServerLevelData getWorldPropertiesCM(){ - return serverLevelData; - } - - @Unique - @Override - public LevelEntityGetter getEntityLookupCMPublic() { - return entityManager.getEntityGetter(); - } } diff --git a/src/main/java/carpet/mixins/Villager_aiMixin.java b/src/main/java/carpet/mixins/Villager_aiMixin.java index 4451c8ca..054ad5d6 100644 --- a/src/main/java/carpet/mixins/Villager_aiMixin.java +++ b/src/main/java/carpet/mixins/Villager_aiMixin.java @@ -65,14 +65,14 @@ public abstract class Villager_aiMixin extends AbstractVillager if (MobAI.isTracking(this, MobAI.TrackingType.IRON_GOLEM_SPAWNING)) { long time; - Optional> last_seen = this.brain.getMemories().get(MemoryModuleType.GOLEM_DETECTED_RECENTLY); + Optional last_seen = this.brain.getMemory(MemoryModuleType.GOLEM_DETECTED_RECENTLY); if (!last_seen.isPresent()) { time = 0; } else { - time = last_seen.get().getTimeToLive(); + time = this.brain.getTimeUntilExpiry(MemoryModuleType.GOLEM_DETECTED_RECENTLY); } boolean recentlySeen = time > 0; Optional optional_11 = this.brain.getMemory(MemoryModuleType.LAST_SLEPT); diff --git a/src/main/java/carpet/script/api/Scoreboards.java b/src/main/java/carpet/script/api/Scoreboards.java index 61248e5b..f0e3365c 100644 --- a/src/main/java/carpet/script/api/Scoreboards.java +++ b/src/main/java/carpet/script/api/Scoreboards.java @@ -22,6 +22,7 @@ import java.util.List; import net.minecraft.ChatFormatting; import net.minecraft.network.chat.Component; import net.minecraft.resources.Identifier; +import net.minecraft.server.MinecraftServer; import net.minecraft.server.ServerScoreboard; import net.minecraft.server.bossevents.CustomBossEvent; import net.minecraft.server.bossevents.CustomBossEvents; @@ -539,7 +540,8 @@ public class Scoreboards expression.addContextFunction("bossbar", -1, (c, t, lv) -> { - CustomBossEvents bossBarManager = ((CarpetContext) c).server().getCustomBossEvents(); + MinecraftServer server = ((CarpetContext) c).server(); + CustomBossEvents bossBarManager = server.getCustomBossEvents(); if (lv.size() > 3) { throw new InternalExpressionException("'bossbar' accepts max three arguments"); @@ -547,7 +549,7 @@ public class Scoreboards if (lv.isEmpty()) { - return ListValue.wrap(bossBarManager.getEvents().stream().map(CustomBossEvent::getTextId).map(Identifier::toString).map(StringValue::of)); + return ListValue.wrap(bossBarManager.getEvents().stream().map(CustomBossEvent::customId).map(Identifier::toString).map(StringValue::of)); } String id = lv.get(0).getString(); @@ -559,7 +561,7 @@ public class Scoreboards { return Value.FALSE; } - return StringValue.of(bossBarManager.create(identifier, Component.literal(id)).getTextId().toString()); + return StringValue.of(bossBarManager.create(server.overworld().getRandom(), identifier, Component.literal(id)).customId().toString()); } String property = lv.get(1).getString(); @@ -591,7 +593,7 @@ public class Scoreboards case "max" -> { if (propertyValue == null) { - return NumericValue.of(bossBar.getMax()); + return NumericValue.of(bossBar.max()); } if (!(propertyValue instanceof final NumericValue number)) { @@ -616,7 +618,7 @@ public class Scoreboards if (propertyValue instanceof final ListValue list) { list.getItems().forEach(v -> { - ServerPlayer player = EntityValue.getPlayerByValue(((CarpetContext) c).server(), propertyValue); + ServerPlayer player = EntityValue.getPlayerByValue(server, propertyValue); if (player != null) { bossBar.addPlayer(player); @@ -624,7 +626,7 @@ public class Scoreboards }); return Value.TRUE; } - ServerPlayer player = EntityValue.getPlayerByValue(((CarpetContext) c).server(), propertyValue); + ServerPlayer player = EntityValue.getPlayerByValue(server, propertyValue); if (player != null) { bossBar.addPlayer(player); @@ -641,7 +643,7 @@ public class Scoreboards { bossBar.removeAllPlayers(); list.getItems().forEach(v -> { - ServerPlayer p = EntityValue.getPlayerByValue(((CarpetContext) c).server(), v); + ServerPlayer p = EntityValue.getPlayerByValue(server, v); if (p != null) { bossBar.addPlayer(p); @@ -649,7 +651,7 @@ public class Scoreboards }); return Value.TRUE; } - ServerPlayer p = EntityValue.getPlayerByValue(((CarpetContext) c).server(), propertyValue); + ServerPlayer p = EntityValue.getPlayerByValue(server, propertyValue); bossBar.removeAllPlayers(); if (p != null) { @@ -674,7 +676,7 @@ public class Scoreboards case "value" -> { if (propertyValue == null) { - return NumericValue.of(bossBar.getValue()); + return NumericValue.of(bossBar.value()); } if (!(propertyValue instanceof final NumericValue number)) { diff --git a/src/main/java/carpet/script/api/WorldAccess.java b/src/main/java/carpet/script/api/WorldAccess.java index a748e752..69c663e7 100644 --- a/src/main/java/carpet/script/api/WorldAccess.java +++ b/src/main/java/carpet/script/api/WorldAccess.java @@ -30,6 +30,7 @@ import carpet.script.value.ValueConversions; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; import it.unimi.dsi.fastutil.longs.LongSet; +import net.minecraft.server.MinecraftServer; import net.minecraft.util.Util; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -66,6 +67,7 @@ import net.minecraft.world.level.levelgen.NoiseRouter; import net.minecraft.world.level.levelgen.RandomState; import net.minecraft.world.level.levelgen.structure.Structure; import net.minecraft.world.level.levelgen.structure.StructureType; +import net.minecraft.world.level.saveddata.WeatherData; import net.minecraft.world.level.storage.TagValueInput; import org.apache.commons.lang3.mutable.MutableBoolean; import org.apache.commons.lang3.tuple.Pair; @@ -436,6 +438,7 @@ public class WorldAccess expression.addContextFunction("weather", -1, (c, t, lv) -> { ServerLevel world = ((CarpetContext) c).level(); + MinecraftServer server = world.getServer(); if (lv.isEmpty())//cos it can thunder when raining or when clear. { @@ -443,7 +446,7 @@ public class WorldAccess } Value weather = lv.get(0); - ServerLevelData worldProperties = Vanilla.ServerLevel_getWorldProperties(world); + WeatherData worldProperties = server.getWeatherData(); if (lv.size() == 1) { return new NumericValue(switch (weather.getString().toLowerCase(Locale.ROOT)) @@ -459,9 +462,9 @@ public class WorldAccess int ticks = NumericValue.asNumber(lv.get(1), "tick_time in 'weather'").getInt(); switch (weather.getString().toLowerCase(Locale.ROOT)) { - case "clear" -> world.setWeatherParameters(ticks, 0, false, false); - case "rain" -> world.setWeatherParameters(0, ticks, true, false); - case "thunder" -> world.setWeatherParameters( + case "clear" -> server.setWeatherParameters(ticks, 0, false, false); + case "rain" -> server.setWeatherParameters(0, ticks, true, false); + case "thunder" -> server.setWeatherParameters( 0, ticks,//this is used to set thunder time, idk why... true, diff --git a/src/main/java/carpet/script/external/Vanilla.java b/src/main/java/carpet/script/external/Vanilla.java index 3a5f1852..a7bce205 100644 --- a/src/main/java/carpet/script/external/Vanilla.java +++ b/src/main/java/carpet/script/external/Vanilla.java @@ -35,8 +35,11 @@ import net.minecraft.world.Container; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.ai.Brain; import net.minecraft.world.entity.ai.goal.Goal; import net.minecraft.world.entity.ai.goal.GoalSelector; +import net.minecraft.world.entity.ai.memory.MemoryModuleType; +import net.minecraft.world.entity.ai.memory.MemorySlot; import net.minecraft.world.entity.ai.village.poi.PoiRecord; import net.minecraft.world.entity.animal.equine.AbstractHorse; import net.minecraft.world.entity.item.ItemEntity; @@ -101,11 +104,6 @@ public class Vanilla return ((Scoreboard_scarpetMixin) scoreboard).getObjectivesByCriterion(); } - public static ServerLevelData ServerLevel_getWorldProperties(ServerLevel world) - { - return ((ServerWorldInterface) world).getWorldPropertiesCM(); - } - public static Long2ObjectOpenHashMap> ChunkTicketManager_getTicketsByPosition(DistanceManager ticketManager) { return ((TicketsFetcherInterface) ticketManager).getTicketsByPosition(); @@ -166,6 +164,10 @@ public class Vanilla return MapValue.wrap(ret); } + public static Map, MemorySlot> Brain_getMemories(Brain brain) { + return ((BrainInterface) brain).getMemoriesCM(); + } + public static LevelStorageSource.LevelStorageAccess MinecraftServer_storageSource(MinecraftServer server) { return ((MinecraftServerInterface) server).getCMSession(); diff --git a/src/main/java/carpet/script/utils/SystemInfo.java b/src/main/java/carpet/script/utils/SystemInfo.java index a49f44d5..c6e30b2d 100644 --- a/src/main/java/carpet/script/utils/SystemInfo.java +++ b/src/main/java/carpet/script/utils/SystemInfo.java @@ -78,7 +78,7 @@ public class SystemInfo put("world_time", c -> new NumericValue(c.level().getGameTime())); - put("game_difficulty", c -> StringValue.of(c.server().getWorldData().getDifficulty().getKey())); + put("game_difficulty", c -> StringValue.of(c.server().getWorldData().getDifficulty().getSerializedName())); put("game_hardcore", c -> BooleanValue.of(c.server().getWorldData().isHardcore())); put("game_storage_format", c -> StringValue.of(c.server().getWorldData().getStorageVersionName(c.server().getWorldData().getVersion()))); put("game_default_gamemode", c -> StringValue.of(c.server().getDefaultGameType().getName())); diff --git a/src/main/java/carpet/script/value/EntityValue.java b/src/main/java/carpet/script/value/EntityValue.java index 13f90b6c..9e65e378 100644 --- a/src/main/java/carpet/script/value/EntityValue.java +++ b/src/main/java/carpet/script/value/EntityValue.java @@ -60,6 +60,7 @@ import net.minecraft.world.entity.ai.goal.Goal; import net.minecraft.world.entity.ai.goal.MoveTowardsRestrictionGoal; import net.minecraft.world.entity.ai.memory.ExpirableValue; import net.minecraft.world.entity.ai.memory.MemoryModuleType; +import net.minecraft.world.entity.ai.memory.MemorySlot; import net.minecraft.world.entity.animal.golem.IronGolem; import net.minecraft.world.entity.decoration.ItemFrame; import net.minecraft.world.entity.item.ItemEntity; @@ -589,15 +590,13 @@ public class EntityValue extends Value if (e instanceof LivingEntity livingEntity) { Brain brain = livingEntity.getBrain(); - Map, Optional>> memories = brain.getMemories(); - Optional> optmemory = memories.get(moduleType); - if (optmemory == null || !optmemory.isPresent()) + Map, MemorySlot> memories = Vanilla.Brain_getMemories(brain); + MemorySlot optmemory = memories.get(moduleType); + if (optmemory == null) { return Value.NULL; } - ExpirableValue memory = optmemory.get(); - return ValueConversions.fromTimedMemory(e, memory.getTimeToLive(), memory.getValue()); - } + return ValueConversions.fromTimedMemory(e, optmemory.timeToLive(), optmemory.value()); } return Value.NULL; }); put("gamemode_id", (e, a) -> e instanceof ServerPlayer sp ? new NumericValue(sp.gameMode.getGameModeForPlayer().getId()) : Value.NULL); diff --git a/src/main/resources/carpet.mixins.json b/src/main/resources/carpet.mixins.json index ea6587fa..2b09a204 100644 --- a/src/main/resources/carpet.mixins.json +++ b/src/main/resources/carpet.mixins.json @@ -148,6 +148,7 @@ "CommandDispatcher_scarpetCommandsMixin", "FoodData_scarpetMixin", "CommandSourceStack_scarpetMixin", + "Brain_scarpetMixin", "BlockInput_scarpetMixin", "BlockPredicate_scarpetMixin", From 35a1a1a600170152a469d41be0f4e00d99c4b460 Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 4 Feb 2026 12:02:09 +0100 Subject: [PATCH 196/232] 26.1-beta-5 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index a584fa26..bec1edac 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ org.gradle.configuration-cache=false loom_version=1.14-SNAPSHOT # Mod Properties - mod_version = 26.1-beta-4 + mod_version = 26.1-beta-5 maven_group = carpet archives_base_name = fabric-carpet From e348f8fa6d31cfdda0131e9218266a5a9da34704 Mon Sep 17 00:00:00 2001 From: gnembon Date: Thu, 12 Feb 2026 15:03:16 +0100 Subject: [PATCH 197/232] 26.1-snap-7 --- gradle.properties | 4 +-- .../LevelRenderer_creativeNoClipMixin.java | 2 +- .../mixins/LevelRenderer_fogOffMixin.java | 9 +++---- .../LevelRenderer_scarpetRenderMixin.java | 7 ++--- .../mixins/MinecraftServer_scarpetMixin.java | 5 ++-- .../MinecraftServer_tickspeedMixin.java | 9 ++++--- .../carpet/script/utils/ShapesRenderer.java | 26 ++++++++----------- 7 files changed, 29 insertions(+), 33 deletions(-) diff --git a/gradle.properties b/gradle.properties index bec1edac..f6cb7227 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,9 +7,9 @@ org.gradle.configuration-cache=false # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=26.1-snapshot-6 + minecraft_version=26.1-snapshot-7 loader_version=0.18.4 - loom_version=1.14-SNAPSHOT + loom_version=1.15-SNAPSHOT # Mod Properties mod_version = 26.1-beta-5 diff --git a/src/main/java/carpet/mixins/LevelRenderer_creativeNoClipMixin.java b/src/main/java/carpet/mixins/LevelRenderer_creativeNoClipMixin.java index a281c7ac..30831a8b 100644 --- a/src/main/java/carpet/mixins/LevelRenderer_creativeNoClipMixin.java +++ b/src/main/java/carpet/mixins/LevelRenderer_creativeNoClipMixin.java @@ -10,7 +10,7 @@ import org.spongepowered.asm.mixin.injection.Redirect; @Mixin(LevelRenderer.class) public class LevelRenderer_creativeNoClipMixin { - @Redirect(method = "renderLevel", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/LocalPlayer;isSpectator()Z")) + @Redirect(method = "update", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/LocalPlayer;isSpectator()Z")) private boolean canSeeWorld(LocalPlayer clientPlayerEntity) { return clientPlayerEntity.isSpectator() || (CarpetSettings.creativeNoClip && clientPlayerEntity.isCreative()); diff --git a/src/main/java/carpet/mixins/LevelRenderer_fogOffMixin.java b/src/main/java/carpet/mixins/LevelRenderer_fogOffMixin.java index 8a22e8a7..88f3ea9c 100644 --- a/src/main/java/carpet/mixins/LevelRenderer_fogOffMixin.java +++ b/src/main/java/carpet/mixins/LevelRenderer_fogOffMixin.java @@ -1,24 +1,23 @@ package carpet.mixins; import carpet.CarpetSettings; -import net.minecraft.client.renderer.GameRenderer; -//import net.minecraft.world.dimension.Dimension; +import net.minecraft.client.renderer.fog.environment.AtmosphericFogEnvironment; import net.minecraft.world.attribute.EnvironmentAttribute; import net.minecraft.world.attribute.EnvironmentAttributeProbe; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; -@Mixin(value = GameRenderer.class, priority = 69420) +@Mixin(value = AtmosphericFogEnvironment.class, priority = 69420) public class LevelRenderer_fogOffMixin { - @Redirect(method = "renderLevel", require = 0, expect = 0, at = @At( + @Redirect(method = "setupFog", require = 0, expect = 0, at = @At( value = "INVOKE", target = "Lnet/minecraft/world/attribute/EnvironmentAttributeProbe;getValue(Lnet/minecraft/world/attribute/EnvironmentAttribute;F)Ljava/lang/Object;" )) private Value isReallyThick(EnvironmentAttributeProbe instance, EnvironmentAttribute environmentAttribute, float f) { - if (CarpetSettings.fogOff) return (Value) Boolean.FALSE; + if (CarpetSettings.fogOff) return environmentAttribute.defaultValue(); return instance.getValue(environmentAttribute, f); } diff --git a/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java b/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java index 6b086080..43876e78 100644 --- a/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java +++ b/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java @@ -7,15 +7,16 @@ import com.mojang.blaze3d.buffers.GpuBufferSlice; import com.mojang.blaze3d.framegraph.FrameGraphBuilder; import com.mojang.blaze3d.framegraph.FramePass; import com.mojang.blaze3d.resource.GraphicsResourceAllocator; -import net.minecraft.client.Camera; import net.minecraft.client.DeltaTracker; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.LevelRenderer; import net.minecraft.client.renderer.LevelTargetBundle; import net.minecraft.client.renderer.RenderBuffers; import net.minecraft.client.renderer.blockentity.BlockEntityRenderDispatcher; +import net.minecraft.client.renderer.chunk.ChunkSectionsToRender; import net.minecraft.client.renderer.entity.EntityRenderDispatcher; import net.minecraft.client.renderer.feature.FeatureRenderDispatcher; +import net.minecraft.client.renderer.state.CameraRenderState; import net.minecraft.client.renderer.state.LevelRenderState; import org.joml.Matrix4f; import org.joml.Vector4f; @@ -48,7 +49,7 @@ public class LevelRenderer_scarpetRenderMixin target = "Lnet/minecraft/client/renderer/LevelRenderer;addLateDebugPass(Lcom/mojang/blaze3d/framegraph/FrameGraphBuilder;Lnet/minecraft/client/renderer/state/CameraRenderState;Lcom/mojang/blaze3d/buffers/GpuBufferSlice;Lorg/joml/Matrix4f;)V", shift = At.Shift.AFTER )) - private void renderStarpetThingsLate(GraphicsResourceAllocator graphicsResourceAllocator, DeltaTracker deltaTracker, boolean bl, Camera camera, Matrix4f matrix4f, Matrix4f arg5, Matrix4f matrix4f3, GpuBufferSlice gpuBufferSlice, Vector4f vector4f, boolean bl2, CallbackInfo ci, @Local FrameGraphBuilder frameGraphBuilder) + private void renderScarpetThinsLate(GraphicsResourceAllocator resourceAllocator, DeltaTracker deltaTracker, boolean renderOutline, CameraRenderState cameraState, Matrix4f modelViewMatrix, GpuBufferSlice terrainFog, Vector4f fogColor, boolean shouldRenderSky, ChunkSectionsToRender chunkSectionsToRender, CallbackInfo ci, @Local FrameGraphBuilder frameGraphBuilder) { // in normal circumstances we want to render shapes at the very end so it appears correctly behind stuff. // we might actually not need to play with render hooks here. @@ -58,7 +59,7 @@ public class LevelRenderer_scarpetRenderMixin final float deltaPartialTick = deltaTracker.getGameTimeDeltaPartialTick(false); FramePass pass = frameGraphBuilder.addPass("scarpet_shapes"); targets.main = pass.readsAndWrites(targets.main); - pass.executes(() -> CarpetClient.shapes.render(renderBuffers, levelRenderState, matrix4f, deltaPartialTick)); + pass.executes(() -> CarpetClient.shapes.render(renderBuffers, levelRenderState, modelViewMatrix, deltaPartialTick)); featureRenderDispatcher.renderAllFeatures(); renderBuffers.bufferSource().endLastBatch(); } diff --git a/src/main/java/carpet/mixins/MinecraftServer_scarpetMixin.java b/src/main/java/carpet/mixins/MinecraftServer_scarpetMixin.java index d0d2337f..0e3aa249 100644 --- a/src/main/java/carpet/mixins/MinecraftServer_scarpetMixin.java +++ b/src/main/java/carpet/mixins/MinecraftServer_scarpetMixin.java @@ -34,9 +34,8 @@ public abstract class MinecraftServer_scarpetMixin extends ReentrantBlockableEve { private CarpetScriptServer scriptServer; - public MinecraftServer_scarpetMixin(String string_1) - { - super(string_1); + public MinecraftServer_scarpetMixin(String name, boolean propagatesCrashes) { + super(name, propagatesCrashes); } @Shadow protected abstract void tickServer(BooleanSupplier booleanSupplier_1); diff --git a/src/main/java/carpet/mixins/MinecraftServer_tickspeedMixin.java b/src/main/java/carpet/mixins/MinecraftServer_tickspeedMixin.java index aba7780b..4d52c92a 100644 --- a/src/main/java/carpet/mixins/MinecraftServer_tickspeedMixin.java +++ b/src/main/java/carpet/mixins/MinecraftServer_tickspeedMixin.java @@ -13,13 +13,14 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(value = MinecraftServer.class, priority = Integer.MAX_VALUE - 10) public abstract class MinecraftServer_tickspeedMixin extends ReentrantBlockableEventLoop implements MinecraftServerInterface { - public MinecraftServer_tickspeedMixin(String name) - { - super(name); - } + CarpetProfiler.ProfilerToken currentSection; + public MinecraftServer_tickspeedMixin(String name, boolean propagatesCrashes) { + super(name, propagatesCrashes); + } + // Replaced the above cancelled while statement with this one // could possibly just inject that mspt selection at the beginning of the loop, but then adding all mspt's to // replace 50L will be a hassle diff --git a/src/main/java/carpet/script/utils/ShapesRenderer.java b/src/main/java/carpet/script/utils/ShapesRenderer.java index fe50ccac..b329ee5d 100644 --- a/src/main/java/carpet/script/utils/ShapesRenderer.java +++ b/src/main/java/carpet/script/utils/ShapesRenderer.java @@ -420,21 +420,7 @@ public class ShapesRenderer // draw the block itself if (blockState.getRenderShape() == RenderShape.MODEL) { - - var bakedModel = client.getBlockRenderer().getBlockModel(blockState); - int color = client.getBlockColors().getColor(blockState, client.level, blockPos, 0); - //dont know why there is a 0. - //see https://github.com/senseiwells/EssentialClient/blob/4db1f291936f502304791ee323f369c206b3021d/src/main/java/me/senseiwells/essentialclient/utils/render/RenderHelper.java#L464 - float red = (color >> 16 & 0xFF) / 255.0F; - float green = (color >> 8 & 0xFF) / 255.0F; - float blue = (color & 0xFF) / 255.0F; - RenderType type; - if (blockState.getBlock() instanceof LeavesBlock && !Minecraft.getInstance().options.cutoutLeaves().get()) { - type = RenderTypes.solidMovingBlock(); - } else { - type = ItemBlockRenderTypes.getRenderType(blockState); - } - client.getBlockRenderer().getModelRenderer().renderModel(matrices.last(), immediate.getBuffer(type), bakedModel, red, green, blue, light, OverlayTexture.NO_OVERLAY); + client.getBlockRenderer().renderSingleBlock(blockState, matrices, immediate, light, OverlayTexture.NO_OVERLAY); } // draw the block`s entity part @@ -461,10 +447,19 @@ public class ShapesRenderer BlockEntityRenderState state = client.getBlockEntityRenderDispatcher().tryExtractRenderState(BlockEntity, partialTick, null); + // levelRenderer;;submitBlockEntities does a weird transpose if (blockEntityRenderer != null && state != null) { // testme partial positions + //final Vec3 cameraPos = levelRenderState.cameraRenderState.pos; + //final double camX = cameraPos.x(); + //final double camY = cameraPos.y(); + //final double camZ = cameraPos.z(); + //matrices.translate(blockPos.getX() - camX, blockPos.getY() - camY, blockPos.getZ() - camZ); + //matrices.mulPose(levelRenderState.cameraRenderState.); + + blockEntityRenderer.submit(state, matrices,client.gameRenderer.getFeatureRenderDispatcher().getSubmitNodeStorage(), levelRenderState.cameraRenderState); //blockEntityRenderer.submit(BlockEntity, partialTick, // matrices, light, OverlayTexture.NO_OVERLAY, camera1.getPosition(), null, client.gameRenderer.getFeatureRenderDispatcher().getSubmitNodeStorage()); @@ -477,6 +472,7 @@ public class ShapesRenderer if (shape.item != null) { // draw the item + // this seems to not work now final ItemStackRenderState itemState = new ItemStackRenderState(); client.getItemModelResolver().updateForTopItem(itemState, shape.item, ItemDisplayContext.FIXED, client.level, null, 0); From 463d43c3bcfe54401594fb6b398b48ee25c4bc97 Mon Sep 17 00:00:00 2001 From: gnembon Date: Thu, 12 Feb 2026 15:04:05 +0100 Subject: [PATCH 198/232] 26.1-beta-6 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index f6cb7227..4a7c43b2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ org.gradle.configuration-cache=false loom_version=1.15-SNAPSHOT # Mod Properties - mod_version = 26.1-beta-5 + mod_version = 26.1-beta-6 maven_group = carpet archives_base_name = fabric-carpet From aeee0d5b60e4da9a0c354a6f2f7c13e579429fbc Mon Sep 17 00:00:00 2001 From: gnembon Date: Tue, 17 Feb 2026 21:30:23 +0100 Subject: [PATCH 199/232] 26.1-snap-8 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 4a7c43b2..05eef699 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ org.gradle.configuration-cache=false # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=26.1-snapshot-7 + minecraft_version=26.1-snapshot-8 loader_version=0.18.4 loom_version=1.15-SNAPSHOT From 97f9e28329e632d240ac92f22e945b2364c35a5d Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 18 Feb 2026 17:37:35 +0100 Subject: [PATCH 200/232] 26.1-snap-9 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 05eef699..07f82191 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ org.gradle.configuration-cache=false # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=26.1-snapshot-8 + minecraft_version=26.1-snapshot-9 loader_version=0.18.4 loom_version=1.15-SNAPSHOT From 532f408178206eb3b22a38c216d12a723395384a Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 25 Feb 2026 00:35:20 +0100 Subject: [PATCH 201/232] 26.1-snap-10 --- gradle.properties | 2 +- .../java/carpet/script/utils/ShapesRenderer.java | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/gradle.properties b/gradle.properties index 07f82191..90a209c3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ org.gradle.configuration-cache=false # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=26.1-snapshot-9 + minecraft_version=26.1-snapshot-10 loader_version=0.18.4 loom_version=1.15-SNAPSHOT diff --git a/src/main/java/carpet/script/utils/ShapesRenderer.java b/src/main/java/carpet/script/utils/ShapesRenderer.java index b329ee5d..eadd24fe 100644 --- a/src/main/java/carpet/script/utils/ShapesRenderer.java +++ b/src/main/java/carpet/script/utils/ShapesRenderer.java @@ -25,9 +25,9 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Font; import net.minecraft.client.gui.components.debug.DebugScreenEntries; import net.minecraft.client.multiplayer.ClientLevel; -import net.minecraft.client.renderer.ItemBlockRenderTypes; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderBuffers; +import net.minecraft.client.renderer.block.BlockModelRenderState; import net.minecraft.client.renderer.rendertype.RenderType; import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; import net.minecraft.client.renderer.blockentity.state.BlockEntityRenderState; @@ -49,7 +49,6 @@ import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.level.Level; import net.minecraft.world.level.LightLayer; import net.minecraft.world.level.block.EntityBlock; -import net.minecraft.world.level.block.LeavesBlock; import net.minecraft.world.level.block.RenderShape; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; @@ -420,7 +419,17 @@ public class ShapesRenderer // draw the block itself if (blockState.getRenderShape() == RenderShape.MODEL) { - client.getBlockRenderer().renderSingleBlock(blockState, matrices, immediate, light, OverlayTexture.NO_OVERLAY); + // this is equally wrong position wise as the BE type - need to investigate + var blockRenderDispatcher = client.getBlockRenderer(); + var state = blockRenderDispatcher.getBlockModel(blockState); + BlockModelRenderState renderState = new BlockModelRenderState(); + renderState.model = state; + renderState.block = blockState.getBlock(); + + renderState.submit(matrices, client.gameRenderer.getFeatureRenderDispatcher().getSubmitNodeStorage(), light, OverlayTexture.NO_OVERLAY, EntityRenderState.NO_OUTLINE); + + + //client.getBlockRenderer().renderSingleBlock(blockState, matrices, immediate, light, OverlayTexture.NO_OVERLAY); } // draw the block`s entity part From f508bac9395c06d96bd71dd37dc77ea9d8abf6b5 Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 25 Feb 2026 00:35:37 +0100 Subject: [PATCH 202/232] 26.1-beta-7 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 90a209c3..fd419e61 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ org.gradle.configuration-cache=false loom_version=1.15-SNAPSHOT # Mod Properties - mod_version = 26.1-beta-6 + mod_version = 26.1-beta-7 maven_group = carpet archives_base_name = fabric-carpet From 97a8765b41e49fe9e066694f882805a0a49641a1 Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 4 Mar 2026 01:47:59 +0100 Subject: [PATCH 203/232] 26.1-snap-11 --- gradle.properties | 2 +- .../mixins/LevelRenderer_scarpetRenderMixin.java | 9 +++++---- .../mixins/PistonHeadRenderer_movableBEMixin.java | 4 ++-- src/main/java/carpet/script/utils/ShapesRenderer.java | 10 +++++++--- src/main/resources/carpet.accesswidener | 1 + 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/gradle.properties b/gradle.properties index fd419e61..91bc0362 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ org.gradle.configuration-cache=false # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=26.1-snapshot-10 + minecraft_version=26.1-snapshot-11 loader_version=0.18.4 loom_version=1.15-SNAPSHOT diff --git a/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java b/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java index 43876e78..30979935 100644 --- a/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java +++ b/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java @@ -16,8 +16,9 @@ import net.minecraft.client.renderer.blockentity.BlockEntityRenderDispatcher; import net.minecraft.client.renderer.chunk.ChunkSectionsToRender; import net.minecraft.client.renderer.entity.EntityRenderDispatcher; import net.minecraft.client.renderer.feature.FeatureRenderDispatcher; -import net.minecraft.client.renderer.state.CameraRenderState; -import net.minecraft.client.renderer.state.LevelRenderState; +import net.minecraft.client.renderer.state.GameRenderState; +import net.minecraft.client.renderer.state.level.CameraRenderState; +import net.minecraft.client.renderer.state.level.LevelRenderState; import org.joml.Matrix4f; import org.joml.Vector4f; import org.spongepowered.asm.mixin.Final; @@ -39,14 +40,14 @@ public class LevelRenderer_scarpetRenderMixin @Shadow @Final private LevelRenderState levelRenderState; @Inject(method = "", at = @At("RETURN")) - private void addRenderers(Minecraft minecraft, EntityRenderDispatcher entityRenderDispatcher, BlockEntityRenderDispatcher blockEntityRenderDispatcher, RenderBuffers renderBuffers, LevelRenderState levelRenderState, FeatureRenderDispatcher featureRenderDispatcher, CallbackInfo ci) + private void addRenderers(Minecraft minecraft, EntityRenderDispatcher entityRenderDispatcher, BlockEntityRenderDispatcher blockEntityRenderDispatcher, RenderBuffers renderBuffers, GameRenderState gameRenderState, FeatureRenderDispatcher featureRenderDispatcher, CallbackInfo ci) { CarpetClient.shapes = new ShapesRenderer(minecraft); } @Inject(method = "renderLevel", at = @At( value = "INVOKE", - target = "Lnet/minecraft/client/renderer/LevelRenderer;addLateDebugPass(Lcom/mojang/blaze3d/framegraph/FrameGraphBuilder;Lnet/minecraft/client/renderer/state/CameraRenderState;Lcom/mojang/blaze3d/buffers/GpuBufferSlice;Lorg/joml/Matrix4f;)V", + target = "Lnet/minecraft/client/renderer/LevelRenderer;addLateDebugPass(Lcom/mojang/blaze3d/framegraph/FrameGraphBuilder;Lnet/minecraft/client/renderer/state/level/CameraRenderState;Lcom/mojang/blaze3d/buffers/GpuBufferSlice;Lorg/joml/Matrix4f;)V", shift = At.Shift.AFTER )) private void renderScarpetThinsLate(GraphicsResourceAllocator resourceAllocator, DeltaTracker deltaTracker, boolean renderOutline, CameraRenderState cameraState, Matrix4f modelViewMatrix, GpuBufferSlice terrainFog, Vector4f fogColor, boolean shouldRenderSky, ChunkSectionsToRender chunkSectionsToRender, CallbackInfo ci, @Local FrameGraphBuilder frameGraphBuilder) diff --git a/src/main/java/carpet/mixins/PistonHeadRenderer_movableBEMixin.java b/src/main/java/carpet/mixins/PistonHeadRenderer_movableBEMixin.java index 9c2a6c75..1cde11b8 100644 --- a/src/main/java/carpet/mixins/PistonHeadRenderer_movableBEMixin.java +++ b/src/main/java/carpet/mixins/PistonHeadRenderer_movableBEMixin.java @@ -12,7 +12,7 @@ import net.minecraft.client.renderer.blockentity.PistonHeadRenderer; import net.minecraft.client.renderer.blockentity.state.BlockEntityRenderState; import net.minecraft.client.renderer.blockentity.state.PistonHeadRenderState; import net.minecraft.client.renderer.feature.ModelFeatureRenderer; -import net.minecraft.client.renderer.state.CameraRenderState; +import net.minecraft.client.renderer.state.level.CameraRenderState; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.piston.PistonMovingBlockEntity; import net.minecraft.world.phys.Vec3; @@ -52,7 +52,7 @@ public abstract class PistonHeadRenderer_movableBEMixin implements BlockEntityRe } } - @Inject(method = "submit(Lnet/minecraft/client/renderer/blockentity/state/PistonHeadRenderState;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/SubmitNodeCollector;Lnet/minecraft/client/renderer/state/CameraRenderState;)V", + @Inject(method = "submit(Lnet/minecraft/client/renderer/blockentity/state/PistonHeadRenderState;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/SubmitNodeCollector;Lnet/minecraft/client/renderer/state/level/CameraRenderState;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/SubmitNodeCollector;submitMovingBlock(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/block/MovingBlockRenderState;)V", ordinal = 0)) private void endMethod(PistonHeadRenderState pistonHeadRenderState, PoseStack poseStack, SubmitNodeCollector submitNodeCollector, CameraRenderState cameraRenderState, CallbackInfo ci) diff --git a/src/main/java/carpet/script/utils/ShapesRenderer.java b/src/main/java/carpet/script/utils/ShapesRenderer.java index eadd24fe..699222c0 100644 --- a/src/main/java/carpet/script/utils/ShapesRenderer.java +++ b/src/main/java/carpet/script/utils/ShapesRenderer.java @@ -28,6 +28,7 @@ import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderBuffers; import net.minecraft.client.renderer.block.BlockModelRenderState; +import net.minecraft.client.renderer.entity.DisplayRenderer; import net.minecraft.client.renderer.rendertype.RenderType; import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; import net.minecraft.client.renderer.blockentity.state.BlockEntityRenderState; @@ -35,7 +36,7 @@ import net.minecraft.client.renderer.entity.state.EntityRenderState; import net.minecraft.client.renderer.gizmos.DrawableGizmoPrimitives; import net.minecraft.client.renderer.item.ItemStackRenderState; import net.minecraft.client.renderer.rendertype.RenderTypes; -import net.minecraft.client.renderer.state.LevelRenderState; +import net.minecraft.client.renderer.state.level.LevelRenderState; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -421,10 +422,13 @@ public class ShapesRenderer { // this is equally wrong position wise as the BE type - need to investigate var blockRenderDispatcher = client.getBlockRenderer(); + + var state = blockRenderDispatcher.getBlockModel(blockState); BlockModelRenderState renderState = new BlockModelRenderState(); - renderState.model = state; - renderState.block = blockState.getBlock(); + client.getBlockEntityRenderDispatcher().blockModelResolver.update(renderState, blockState, DisplayRenderer.BLOCK_DISPLAY_CONTEXT ); + //renderState.model = state; + //renderState.block = blockState.getBlock(); renderState.submit(matrices, client.gameRenderer.getFeatureRenderDispatcher().getSubmitNodeStorage(), light, OverlayTexture.NO_OVERLAY, EntityRenderState.NO_OUTLINE); diff --git a/src/main/resources/carpet.accesswidener b/src/main/resources/carpet.accesswidener index ef933dbe..f14ee986 100644 --- a/src/main/resources/carpet.accesswidener +++ b/src/main/resources/carpet.accesswidener @@ -13,3 +13,4 @@ accessible class net/minecraft/world/level/block/entity/SculkSensorBlockEntity$V accessible method net/minecraft/world/level/border/WorldBorder getListeners ()Ljava/util/List; accessible method net/minecraft/world/level/redstone/DefaultRedstoneWireEvaluator calculateTargetStrength (Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;)I accessible field net/minecraft/world/level/block/state/BlockBehaviour UPDATE_SHAPE_ORDER [Lnet/minecraft/core/Direction; +accessible field net/minecraft/client/renderer/blockentity/BlockEntityRenderDispatcher blockModelResolver Lnet/minecraft/client/renderer/block/BlockModelResolver; From ab281914807848043f17554c9a9e6cc5c27c80d0 Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 4 Mar 2026 01:48:38 +0100 Subject: [PATCH 204/232] 26.1-beta-8 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 91bc0362..684414ed 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ org.gradle.configuration-cache=false loom_version=1.15-SNAPSHOT # Mod Properties - mod_version = 26.1-beta-7 + mod_version = 26.1-beta-8 maven_group = carpet archives_base_name = fabric-carpet From 72b09461ca7553093744b02d962549cf3e93c821 Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 11 Mar 2026 16:33:42 +0100 Subject: [PATCH 205/232] 26.1-pre-1 --- gradle.properties | 2 +- src/main/java/carpet/mixins/Gui_tablistMixin.java | 2 +- .../mixins/LevelRenderer_scarpetRenderMixin.java | 6 +++--- .../java/carpet/script/utils/ShapesRenderer.java | 14 +++++++++----- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/gradle.properties b/gradle.properties index 684414ed..bc4f32c5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ org.gradle.configuration-cache=false # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=26.1-snapshot-11 + minecraft_version=26.1-pre-1 loader_version=0.18.4 loom_version=1.15-SNAPSHOT diff --git a/src/main/java/carpet/mixins/Gui_tablistMixin.java b/src/main/java/carpet/mixins/Gui_tablistMixin.java index 47235544..128cc36f 100644 --- a/src/main/java/carpet/mixins/Gui_tablistMixin.java +++ b/src/main/java/carpet/mixins/Gui_tablistMixin.java @@ -19,7 +19,7 @@ public abstract class Gui_tablistMixin @Shadow @Final private PlayerTabOverlay tabList; - @Redirect(method = "renderTabList", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;isLocalServer()Z")) + @Redirect(method = "extractTabList", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;isLocalServer()Z")) private boolean onDraw(Minecraft minecraftClient) { return this.minecraft.isLocalServer() && !((PlayerListHudInterface) tabList).hasFooterOrHeader(); diff --git a/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java b/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java index 30979935..a1593b21 100644 --- a/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java +++ b/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java @@ -19,7 +19,7 @@ import net.minecraft.client.renderer.feature.FeatureRenderDispatcher; import net.minecraft.client.renderer.state.GameRenderState; import net.minecraft.client.renderer.state.level.CameraRenderState; import net.minecraft.client.renderer.state.level.LevelRenderState; -import org.joml.Matrix4f; +import org.joml.Matrix4fc; import org.joml.Vector4f; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; @@ -47,10 +47,10 @@ public class LevelRenderer_scarpetRenderMixin @Inject(method = "renderLevel", at = @At( value = "INVOKE", - target = "Lnet/minecraft/client/renderer/LevelRenderer;addLateDebugPass(Lcom/mojang/blaze3d/framegraph/FrameGraphBuilder;Lnet/minecraft/client/renderer/state/level/CameraRenderState;Lcom/mojang/blaze3d/buffers/GpuBufferSlice;Lorg/joml/Matrix4f;)V", + target = "Lnet/minecraft/client/renderer/LevelRenderer;addLateDebugPass(Lcom/mojang/blaze3d/framegraph/FrameGraphBuilder;Lnet/minecraft/client/renderer/state/level/CameraRenderState;Lcom/mojang/blaze3d/buffers/GpuBufferSlice;Lorg/joml/Matrix4fc;)V", shift = At.Shift.AFTER )) - private void renderScarpetThinsLate(GraphicsResourceAllocator resourceAllocator, DeltaTracker deltaTracker, boolean renderOutline, CameraRenderState cameraState, Matrix4f modelViewMatrix, GpuBufferSlice terrainFog, Vector4f fogColor, boolean shouldRenderSky, ChunkSectionsToRender chunkSectionsToRender, CallbackInfo ci, @Local FrameGraphBuilder frameGraphBuilder) + private void renderScarpetThinsLate(GraphicsResourceAllocator resourceAllocator, DeltaTracker deltaTracker, boolean renderOutline, CameraRenderState cameraState, Matrix4fc modelViewMatrix, GpuBufferSlice terrainFog, Vector4f fogColor, boolean shouldRenderSky, ChunkSectionsToRender chunkSectionsToRender, CallbackInfo ci, @Local FrameGraphBuilder frameGraphBuilder) { // in normal circumstances we want to render shapes at the very end so it appears correctly behind stuff. // we might actually not need to play with render hooks here. diff --git a/src/main/java/carpet/script/utils/ShapesRenderer.java b/src/main/java/carpet/script/utils/ShapesRenderer.java index 699222c0..fa77d568 100644 --- a/src/main/java/carpet/script/utils/ShapesRenderer.java +++ b/src/main/java/carpet/script/utils/ShapesRenderer.java @@ -55,8 +55,9 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.storage.TagValueInput; import net.minecraft.world.phys.Vec3; -import org.joml.Matrix4f; import org.joml.Matrix4fStack; +import org.joml.Matrix4fc; +import org.joml.Quaternionf; public class ShapesRenderer { @@ -113,7 +114,7 @@ public class ShapesRenderer labels = new HashMap<>(); } - public void render(RenderBuffers renderBuffers, LevelRenderState cameraa, Matrix4f matrix4f, float partialTick) + public void render(RenderBuffers renderBuffers, LevelRenderState cameraa, Matrix4fc matrix4f, float partialTick) { Runnable token = Carpet.startProfilerSection("Scarpet client"); // posestack is not needed anymore - left as TODO to cleanup later @@ -161,7 +162,8 @@ public class ShapesRenderer ); Matrix4fStack matrixStack = RenderSystem.getModelViewStack(); matrixStack.pushMatrix(); - matrixStack.mul(matrices.last().pose()); + //matrixStack.mul(matrices.last().pose()); + matrixStack.mul(matrix4f); // lines //RenderSystem.lineWidth(0.5F); @@ -375,6 +377,8 @@ public class ShapesRenderer matrices.translate(0.5, 0.5, 0.5); } + matrices.mulPose(camera1.rotation().conjugate(new Quaternionf())); + matrices.translate(v1.x - cx, v1.y - cy, v1.z - cz); rotatePoseStackByShapeDirection(matrices, shape.facing, camera1, isitem ? v1 : v1.add(0.5, 0.5, 0.5)); if (shape.tilt != 0.0f) @@ -421,10 +425,10 @@ public class ShapesRenderer if (blockState.getRenderShape() == RenderShape.MODEL) { // this is equally wrong position wise as the BE type - need to investigate - var blockRenderDispatcher = client.getBlockRenderer(); + //var blockRenderDispatcher = client.getBlockRenderer(); - var state = blockRenderDispatcher.getBlockModel(blockState); + //var state = blockRenderDispatcher.getBlockModel(blockState); BlockModelRenderState renderState = new BlockModelRenderState(); client.getBlockEntityRenderDispatcher().blockModelResolver.update(renderState, blockState, DisplayRenderer.BLOCK_DISPLAY_CONTEXT ); //renderState.model = state; From 2b99245e604e6f6ec3ff3c686dc952b8f625a033 Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 11 Mar 2026 16:34:06 +0100 Subject: [PATCH 206/232] 26.1-beta-9 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index bc4f32c5..3bb407e3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ org.gradle.configuration-cache=false loom_version=1.15-SNAPSHOT # Mod Properties - mod_version = 26.1-beta-8 + mod_version = 26.1-beta-9 maven_group = carpet archives_base_name = fabric-carpet From 0fc39167babc31f0e47819c8b3296e08f71aaf42 Mon Sep 17 00:00:00 2001 From: altrisi Date: Tue, 24 Mar 2026 17:25:49 +0100 Subject: [PATCH 207/232] Fix #2174 A hack to fix an issue with a hack --- src/main/java/carpet/utils/SpawnReporter.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/carpet/utils/SpawnReporter.java b/src/main/java/carpet/utils/SpawnReporter.java index 3a3cc542..56dd642f 100644 --- a/src/main/java/carpet/utils/SpawnReporter.java +++ b/src/main/java/carpet/utils/SpawnReporter.java @@ -10,6 +10,7 @@ import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceKey; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; import net.minecraft.tags.BlockTags; import net.minecraft.util.Mth; import net.minecraft.util.random.Weighted; @@ -385,7 +386,8 @@ public class SpawnReporter { for (Entity e: entity.level().getEntities(entity, entity.getBoundingBox())) { - e.discard(); + if (!(e instanceof ServerPlayer)) + e.discard(); } } entity.discard(); From 8fb68dab3bf38d1c20ee15e8ee78df1c908edf60 Mon Sep 17 00:00:00 2001 From: altrisi Date: Tue, 24 Mar 2026 17:56:57 +0100 Subject: [PATCH 208/232] Basic elytra flight starting for fake players Resolves #2043 Replaces, therefore closes #2161 --- src/main/java/carpet/helpers/EntityPlayerActionPack.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/carpet/helpers/EntityPlayerActionPack.java b/src/main/java/carpet/helpers/EntityPlayerActionPack.java index 4b2da3fb..599a9318 100644 --- a/src/main/java/carpet/helpers/EntityPlayerActionPack.java +++ b/src/main/java/carpet/helpers/EntityPlayerActionPack.java @@ -468,7 +468,8 @@ public class EntityPlayerActionPack { if (action.limit == 1) { - if (player.onGround()) player.jumpFromGround(); // onGround + if (player.onGround()) player.jumpFromGround(); + else if (!player.onClimbable()) player.tryToStartFallFlying(); } else { From 848f06cb1c4f20b3a06e83559fe029dddd2d5be7 Mon Sep 17 00:00:00 2001 From: altrisi Date: Thu, 26 Mar 2026 01:59:50 +0100 Subject: [PATCH 209/232] Fix memory leak on fake player connection Fixes #2169 --- src/main/java/carpet/patches/FakeClientConnection.java | 9 +++++++++ .../java/carpet/patches/NetHandlerPlayServerFake.java | 6 ------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main/java/carpet/patches/FakeClientConnection.java b/src/main/java/carpet/patches/FakeClientConnection.java index 8a1a1b56..8560257d 100644 --- a/src/main/java/carpet/patches/FakeClientConnection.java +++ b/src/main/java/carpet/patches/FakeClientConnection.java @@ -1,10 +1,14 @@ package carpet.patches; +import org.jspecify.annotations.Nullable; + import carpet.fakes.ClientConnectionInterface; +import io.netty.channel.ChannelFutureListener; import io.netty.channel.embedded.EmbeddedChannel; import net.minecraft.network.Connection; import net.minecraft.network.PacketListener; import net.minecraft.network.ProtocolInfo; +import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.PacketFlow; public class FakeClientConnection extends Connection @@ -21,6 +25,11 @@ public class FakeClientConnection extends Connection public void setReadOnly() { } + + @Override + public void send(Packet packet, @Nullable ChannelFutureListener channelFutureListener, boolean bl) + { + } @Override public void handleDisconnection() diff --git a/src/main/java/carpet/patches/NetHandlerPlayServerFake.java b/src/main/java/carpet/patches/NetHandlerPlayServerFake.java index 143e7ad0..6bdd8c9a 100644 --- a/src/main/java/carpet/patches/NetHandlerPlayServerFake.java +++ b/src/main/java/carpet/patches/NetHandlerPlayServerFake.java @@ -3,7 +3,6 @@ package carpet.patches; import net.minecraft.network.Connection; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.contents.TranslatableContents; -import net.minecraft.network.protocol.Packet; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.network.CommonListenerCookie; @@ -19,11 +18,6 @@ public class NetHandlerPlayServerFake extends ServerGamePacketListenerImpl super(minecraftServer, connection, serverPlayer, i); } - @Override - public void send(final Packet packetIn) - { - } - @Override public void disconnect(Component message) { From 2cf6ec15eb5ea7eb27fba453e383459d0eddd10c Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 1 Apr 2026 11:35:07 +0200 Subject: [PATCH 210/232] 26.1 pro forma vanilla --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 3bb407e3..c792e38e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ org.gradle.configuration-cache=false # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=26.1-pre-1 + minecraft_version=26.1 loader_version=0.18.4 loom_version=1.15-SNAPSHOT From 5f69f6fe3d116bd912a4e869db61fd7b8b8ea258 Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 1 Apr 2026 11:39:12 +0200 Subject: [PATCH 211/232] 26.1 --- gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index c792e38e..cdb32075 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ org.gradle.configuration-cache=false loom_version=1.15-SNAPSHOT # Mod Properties - mod_version = 26.1-beta-9 + mod_version = 26.1 maven_group = carpet archives_base_name = fabric-carpet @@ -20,7 +20,7 @@ org.gradle.configuration-cache=false # The Curseforge versions "names" or ids for the main branch (comma separated: 1.16.4,1.16.5) # This is needed because CF uses too vague names for prereleases and release candidates # Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN] - release-curse-versions = Minecraft 26:26.1-Snapshot + release-curse-versions = Minecraft 26:26.1 # Whether or not to build another branch on release release-extra-branch = false # The name of the second branch to release From 763c0b6273b0cb20018122b549305dfdabbef777 Mon Sep 17 00:00:00 2001 From: altrisi Date: Thu, 2 Apr 2026 03:23:24 +0200 Subject: [PATCH 212/232] Tweak repeated release checker for new versioning scheme --- .github/workflows/publish-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 23578a5c..bc01cc31 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -54,7 +54,7 @@ jobs: })).data; console.log('Previous release was: ' + releases[1].name); for (let release of releases.slice(1)) { - if (release.name.includes(READ_VERSION)) + if (release.name.includes(' ' + READ_VERSION + ' ')) core.setFailed('Version number is the same as a previous release!') } Build-And-Publish: From 2feef04568005ac80edb8dd5d5a429e277c83dad Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 8 Apr 2026 16:53:58 +0200 Subject: [PATCH 213/232] 26.2-snap-1 --- gradle.properties | 6 +- .../java/carpet/helpers/HopperCounter.java | 80 +++++++++---------- .../java/carpet/mixins/Gui_tablistMixin.java | 3 +- .../SystemReport_addScarpetAppsMixin.java | 5 +- .../carpet/script/utils/FeatureGenerator.java | 4 +- .../carpet/script/utils/ShapesRenderer.java | 15 ++-- src/main/java/carpet/utils/WoolTool.java | 26 ++---- 7 files changed, 64 insertions(+), 75 deletions(-) diff --git a/gradle.properties b/gradle.properties index cdb32075..f8148cd1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,8 +7,8 @@ org.gradle.configuration-cache=false # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=26.1 - loader_version=0.18.4 + minecraft_version=26.2-snapshot-1 + loader_version=0.18.6 loom_version=1.15-SNAPSHOT # Mod Properties @@ -20,7 +20,7 @@ org.gradle.configuration-cache=false # The Curseforge versions "names" or ids for the main branch (comma separated: 1.16.4,1.16.5) # This is needed because CF uses too vague names for prereleases and release candidates # Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN] - release-curse-versions = Minecraft 26:26.1 + release-curse-versions = Minecraft 26:26.2-Snapshot # Whether or not to build another branch on release release-extra-branch = false # The name of the second branch to release diff --git a/src/main/java/carpet/helpers/HopperCounter.java b/src/main/java/carpet/helpers/HopperCounter.java index 92080b8a..3e7cb74e 100644 --- a/src/main/java/carpet/helpers/HopperCounter.java +++ b/src/main/java/carpet/helpers/HopperCounter.java @@ -269,19 +269,19 @@ public class HopperCounter * {@link Block#defaultMapColor()} method as these items have those same colours. */ private static final Map DEFAULTS = Map.ofEntries( - entry(Items.DANDELION, Blocks.YELLOW_WOOL), - entry(Items.POPPY, Blocks.RED_WOOL), - entry(Items.BLUE_ORCHID, Blocks.LIGHT_BLUE_WOOL), - entry(Items.ALLIUM, Blocks.MAGENTA_WOOL), + entry(Items.DANDELION, Blocks.WOOL.yellow()), + entry(Items.POPPY, Blocks.WOOL.red()), + entry(Items.BLUE_ORCHID, Blocks.WOOL.lightBlue()), + entry(Items.ALLIUM, Blocks.WOOL.magenta()), entry(Items.AZURE_BLUET, Blocks.SNOW_BLOCK), - entry(Items.RED_TULIP, Blocks.RED_WOOL), - entry(Items.ORANGE_TULIP, Blocks.ORANGE_WOOL), + entry(Items.RED_TULIP, Blocks.WOOL.red()), + entry(Items.ORANGE_TULIP, Blocks.WOOL.orange()), entry(Items.WHITE_TULIP, Blocks.SNOW_BLOCK), - entry(Items.PINK_TULIP, Blocks.PINK_WOOL), + entry(Items.PINK_TULIP, Blocks.WOOL.pink()), entry(Items.OXEYE_DAISY, Blocks.SNOW_BLOCK), - entry(Items.CORNFLOWER, Blocks.BLUE_WOOL), - entry(Items.WITHER_ROSE, Blocks.BLACK_WOOL), - entry(Items.LILY_OF_THE_VALLEY, Blocks.WHITE_WOOL), + entry(Items.CORNFLOWER, Blocks.WOOL.blue()), + entry(Items.WITHER_ROSE, Blocks.WOOL.black()), + entry(Items.LILY_OF_THE_VALLEY, Blocks.WOOL.white()), entry(Items.BROWN_MUSHROOM, Blocks.BROWN_MUSHROOM_BLOCK), entry(Items.RED_MUSHROOM, Blocks.RED_MUSHROOM_BLOCK), entry(Items.STICK, Blocks.OAK_PLANKS), @@ -289,51 +289,51 @@ public class HopperCounter entry(Items.IRON_INGOT, Blocks.IRON_BLOCK), entry(Items.DIAMOND, Blocks.DIAMOND_BLOCK), entry(Items.NETHERITE_INGOT, Blocks.NETHERITE_BLOCK), - entry(Items.SUNFLOWER, Blocks.YELLOW_WOOL), - entry(Items.LILAC, Blocks.MAGENTA_WOOL), - entry(Items.ROSE_BUSH, Blocks.RED_WOOL), - entry(Items.PEONY, Blocks.PINK_WOOL), - entry(Items.CARROT, Blocks.ORANGE_WOOL), - entry(Items.APPLE, Blocks.RED_WOOL), + entry(Items.SUNFLOWER, Blocks.WOOL.yellow()), + entry(Items.LILAC, Blocks.WOOL.magenta()), + entry(Items.ROSE_BUSH, Blocks.WOOL.red()), + entry(Items.PEONY, Blocks.WOOL.pink()), + entry(Items.CARROT, Blocks.WOOL.orange()), + entry(Items.APPLE, Blocks.WOOL.red()), entry(Items.WHEAT, Blocks.HAY_BLOCK), - entry(Items.PORKCHOP, Blocks.PINK_WOOL), - entry(Items.RABBIT, Blocks.PINK_WOOL), - entry(Items.CHICKEN, Blocks.WHITE_TERRACOTTA), + entry(Items.PORKCHOP, Blocks.WOOL.pink()), + entry(Items.RABBIT, Blocks.WOOL.pink()), + entry(Items.CHICKEN, Blocks.DYED_TERRACOTTA.white()), entry(Items.BEEF, Blocks.NETHERRACK), entry(Items.ENCHANTED_GOLDEN_APPLE, Blocks.GOLD_BLOCK), - entry(Items.COD, Blocks.WHITE_TERRACOTTA), + entry(Items.COD, Blocks.DYED_TERRACOTTA.white()), entry(Items.SALMON, Blocks.ACACIA_PLANKS), - entry(Items.ROTTEN_FLESH, Blocks.BROWN_WOOL), - entry(Items.PUFFERFISH, Blocks.YELLOW_TERRACOTTA), - entry(Items.TROPICAL_FISH, Blocks.ORANGE_WOOL), - entry(Items.POTATO, Blocks.WHITE_TERRACOTTA), - entry(Items.MUTTON, Blocks.RED_WOOL), + entry(Items.ROTTEN_FLESH, Blocks.WOOL.brown()), + entry(Items.PUFFERFISH, Blocks.DYED_TERRACOTTA.orange()), + entry(Items.TROPICAL_FISH, Blocks.WOOL.orange()), + entry(Items.POTATO, Blocks.DYED_TERRACOTTA.white()), + entry(Items.MUTTON, Blocks.WOOL.red()), entry(Items.BEETROOT, Blocks.NETHERRACK), entry(Items.MELON_SLICE, Blocks.MELON), entry(Items.POISONOUS_POTATO, Blocks.SLIME_BLOCK), entry(Items.SPIDER_EYE, Blocks.NETHERRACK), - entry(Items.GUNPOWDER, Blocks.GRAY_WOOL), - entry(Items.TURTLE_SCUTE, Blocks.LIME_WOOL), + entry(Items.GUNPOWDER, Blocks.WOOL.gray()), + entry(Items.TURTLE_SCUTE, Blocks.WOOL.lime()), entry(Items.ARMADILLO_SCUTE, Blocks.ANCIENT_DEBRIS), - entry(Items.FEATHER, Blocks.WHITE_WOOL), - entry(Items.FLINT, Blocks.BLACK_WOOL), + entry(Items.FEATHER, Blocks.WOOL.white()), + entry(Items.FLINT, Blocks.WOOL.black()), entry(Items.LEATHER, Blocks.SPRUCE_PLANKS), entry(Items.GLOWSTONE_DUST, Blocks.GLOWSTONE), - entry(Items.PAPER, Blocks.WHITE_WOOL), + entry(Items.PAPER, Blocks.WOOL.white()), entry(Items.BRICK, Blocks.BRICKS), - entry(Items.INK_SAC, Blocks.BLACK_WOOL), + entry(Items.INK_SAC, Blocks.WOOL.black()), entry(Items.SNOWBALL, Blocks.SNOW_BLOCK), entry(Items.WATER_BUCKET, Blocks.WATER), entry(Items.LAVA_BUCKET, Blocks.LAVA), - entry(Items.MILK_BUCKET, Blocks.WHITE_WOOL), + entry(Items.MILK_BUCKET, Blocks.WOOL.white()), entry(Items.CLAY_BALL, Blocks.CLAY), entry(Items.COCOA_BEANS, Blocks.COCOA), entry(Items.BONE, Blocks.BONE_BLOCK), - entry(Items.COD_BUCKET, Blocks.BROWN_TERRACOTTA), - entry(Items.PUFFERFISH_BUCKET, Blocks.YELLOW_TERRACOTTA), - entry(Items.SALMON_BUCKET, Blocks.PINK_TERRACOTTA), - entry(Items.TROPICAL_FISH_BUCKET, Blocks.ORANGE_TERRACOTTA), - entry(Items.SUGAR, Blocks.WHITE_WOOL), + entry(Items.COD_BUCKET, Blocks.DYED_TERRACOTTA.brown()), + entry(Items.PUFFERFISH_BUCKET, Blocks.DYED_TERRACOTTA.yellow()), + entry(Items.SALMON_BUCKET, Blocks.DYED_TERRACOTTA.pink()), + entry(Items.TROPICAL_FISH_BUCKET, Blocks.DYED_TERRACOTTA.orange()), + entry(Items.SUGAR, Blocks.WOOL.white()), entry(Items.BLAZE_POWDER, Blocks.GOLD_BLOCK), entry(Items.ENDER_PEARL, Blocks.WARPED_PLANKS), entry(Items.NETHER_STAR, Blocks.DIAMOND_BLOCK), @@ -346,13 +346,13 @@ public class HopperCounter entry(Items.HEART_OF_THE_SEA, Blocks.CONDUIT), entry(Items.HONEYCOMB, Blocks.HONEYCOMB_BLOCK), entry(Items.NAME_TAG, Blocks.BONE_BLOCK), - entry(Items.TOTEM_OF_UNDYING, Blocks.YELLOW_TERRACOTTA), + entry(Items.TOTEM_OF_UNDYING, Blocks.DYED_TERRACOTTA.yellow()), entry(Items.TRIDENT, Blocks.PRISMARINE), - entry(Items.GHAST_TEAR, Blocks.WHITE_WOOL), + entry(Items.GHAST_TEAR, Blocks.WOOL.white()), entry(Items.PHANTOM_MEMBRANE, Blocks.BONE_BLOCK), entry(Items.EGG, Blocks.BONE_BLOCK), //entry(Items.,Blocks.), - entry(Items.COPPER_INGOT, Blocks.COPPER_BLOCK), + entry(Items.COPPER_INGOT, Blocks.COPPER_BLOCK.unaffected()), entry(Items.AMETHYST_SHARD, Blocks.AMETHYST_BLOCK)); /** diff --git a/src/main/java/carpet/mixins/Gui_tablistMixin.java b/src/main/java/carpet/mixins/Gui_tablistMixin.java index 128cc36f..f6ea0717 100644 --- a/src/main/java/carpet/mixins/Gui_tablistMixin.java +++ b/src/main/java/carpet/mixins/Gui_tablistMixin.java @@ -3,6 +3,7 @@ package carpet.mixins; import carpet.fakes.PlayerListHudInterface; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.Hud; import net.minecraft.client.gui.components.PlayerTabOverlay; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; @@ -10,7 +11,7 @@ import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; -@Mixin(Gui.class) +@Mixin(Hud.class) public abstract class Gui_tablistMixin { @Shadow diff --git a/src/main/java/carpet/mixins/SystemReport_addScarpetAppsMixin.java b/src/main/java/carpet/mixins/SystemReport_addScarpetAppsMixin.java index b449059e..c68d3b22 100644 --- a/src/main/java/carpet/mixins/SystemReport_addScarpetAppsMixin.java +++ b/src/main/java/carpet/mixins/SystemReport_addScarpetAppsMixin.java @@ -1,7 +1,8 @@ package carpet.mixins; -import java.util.function.Supplier; import java.util.stream.Collectors; + +import net.minecraft.CrashReportDetail; import net.minecraft.SystemReport; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -14,7 +15,7 @@ import carpet.CarpetServer; @Mixin(SystemReport.class) public abstract class SystemReport_addScarpetAppsMixin { - @Shadow public abstract void setDetail(String name, Supplier valueSupplier); + @Shadow public abstract void setDetail(String name, CrashReportDetail valueSupplier); @Inject(method = "", at = @At("RETURN")) private void fillSystemDetails(CallbackInfo info) { diff --git a/src/main/java/carpet/script/utils/FeatureGenerator.java b/src/main/java/carpet/script/utils/FeatureGenerator.java index 5955d889..d5ff798c 100644 --- a/src/main/java/carpet/script/utils/FeatureGenerator.java +++ b/src/main/java/carpet/script/utils/FeatureGenerator.java @@ -40,8 +40,8 @@ import net.minecraft.world.level.levelgen.RandomState; import net.minecraft.world.level.levelgen.VerticalAnchor; import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; import net.minecraft.world.level.levelgen.feature.Feature; +import net.minecraft.world.level.levelgen.feature.configurations.CompositeFeatureConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration; -import net.minecraft.world.level.levelgen.feature.configurations.SimpleRandomFeatureConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.TreeConfiguration; import net.minecraft.world.level.levelgen.feature.featuresize.TwoLayersFeatureSize; import net.minecraft.world.level.levelgen.feature.foliageplacers.BlobFoliagePlacer; @@ -288,7 +288,7 @@ public class FeatureGenerator put("coral_claw", l -> simplePlop(Feature.CORAL_CLAW, FeatureConfiguration.NONE)); put("coral_mushroom", l -> simplePlop(Feature.CORAL_MUSHROOM, FeatureConfiguration.NONE)); - put("coral", l -> simplePlop(Feature.SIMPLE_RANDOM_SELECTOR, new SimpleRandomFeatureConfiguration(HolderSet.direct( + put("coral", l -> simplePlop(Feature.SIMPLE_RANDOM_SELECTOR, new CompositeFeatureConfiguration(HolderSet.direct( PlacementUtils.inlinePlaced(Feature.CORAL_TREE, FeatureConfiguration.NONE), PlacementUtils.inlinePlaced(Feature.CORAL_CLAW, FeatureConfiguration.NONE), PlacementUtils.inlinePlaced(Feature.CORAL_MUSHROOM, FeatureConfiguration.NONE) diff --git a/src/main/java/carpet/script/utils/ShapesRenderer.java b/src/main/java/carpet/script/utils/ShapesRenderer.java index fa77d568..1fc1ef4a 100644 --- a/src/main/java/carpet/script/utils/ShapesRenderer.java +++ b/src/main/java/carpet/script/utils/ShapesRenderer.java @@ -8,7 +8,6 @@ import com.mojang.blaze3d.pipeline.RenderTarget; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.ByteBufferBuilder; import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.Tesselator; import com.mojang.blaze3d.vertex.VertexFormat; import com.mojang.blaze3d.vertex.VertexFormat.Mode; import com.mojang.math.Axis; @@ -144,8 +143,6 @@ public class ShapesRenderer //RenderSystem.polygonOffset(-3f, -3f); //RenderSystem.enablePolygonOffset(); - Tesselator tesselator = Tesselator.getInstance(); - // render double cameraX = camera.position().x; double cameraY = camera.position().y; @@ -177,7 +174,7 @@ public class ShapesRenderer shapes.get(dimensionType).values().forEach(s -> { if ((!s.shape.debug || entityBoxes) && s.shouldRender(dimensionType)) { - s.renderFaces(tesselator, cameraX, cameraY, cameraZ, partialTick, s.shape.seethrough ? onTop : normal); + s.renderFaces(cameraX, cameraY, cameraZ, partialTick, s.shape.seethrough ? onTop : normal); } }); //RenderSystem.lineWidth(1.0F); @@ -289,7 +286,7 @@ public class ShapesRenderer public abstract void renderLines(PoseStack matrices, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState, DrawableGizmoPrimitives primitives); - public void renderFaces(Tesselator tesselator, double cx, double cy, double cz, float partialTick, DrawableGizmoPrimitives primitives) + public void renderFaces(double cx, double cy, double cz, float partialTick, DrawableGizmoPrimitives primitives) { } @@ -633,7 +630,7 @@ public class ShapesRenderer } @Override - public void renderFaces(Tesselator tesselator, double cx, double cy, double cz, float partialTick, DrawableGizmoPrimitives primitives) + public void renderFaces(double cx, double cy, double cz, float partialTick, DrawableGizmoPrimitives primitives) { if (shape.fa == 0.0) { @@ -695,7 +692,7 @@ public class ShapesRenderer } @Override - public void renderFaces(Tesselator tesselator, double cx, double cy, double cz, float partialTick, DrawableGizmoPrimitives primitives) + public void renderFaces(double cx, double cy, double cz, float partialTick, DrawableGizmoPrimitives primitives) { if (shape.fa == 0) { @@ -881,7 +878,7 @@ public class ShapesRenderer } @Override - public void renderFaces(Tesselator tesselator, double cx, double cy, double cz, float partialTick, DrawableGizmoPrimitives primitives) + public void renderFaces(double cx, double cy, double cz, float partialTick, DrawableGizmoPrimitives primitives) { if (shape.fa == 0.0) { @@ -920,7 +917,7 @@ public class ShapesRenderer } @Override - public void renderFaces(Tesselator tesselator, double cx, double cy, double cz, float partialTick, DrawableGizmoPrimitives primitives) + public void renderFaces(double cx, double cy, double cz, float partialTick, DrawableGizmoPrimitives primitives) { if (shape.fa == 0.0) { diff --git a/src/main/java/carpet/utils/WoolTool.java b/src/main/java/carpet/utils/WoolTool.java index 761de09c..7d87bdb4 100644 --- a/src/main/java/carpet/utils/WoolTool.java +++ b/src/main/java/carpet/utils/WoolTool.java @@ -3,8 +3,10 @@ package carpet.utils; import carpet.CarpetSettings; import carpet.helpers.HopperCounter; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; import net.minecraft.commands.CommandSourceStack; import net.minecraft.core.BlockPos; @@ -17,6 +19,7 @@ import net.minecraft.world.item.DyeColor; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.ColorCollection; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.MapColor; import net.minecraft.world.phys.Vec3; @@ -35,24 +38,11 @@ public class WoolTool * A map from a wool {@link Block} to its {@link DyeColor} which is used in {@link WoolTool#getWoolColorAtPosition} * to get the colour of wool at a position. */ - private static final Map WOOL_BLOCK_TO_DYE = Map.ofEntries( - entry(Blocks.WHITE_WOOL, DyeColor.WHITE), - entry(Blocks.ORANGE_WOOL, DyeColor.ORANGE), - entry(Blocks.MAGENTA_WOOL, DyeColor.MAGENTA), - entry(Blocks.LIGHT_BLUE_WOOL, DyeColor.LIGHT_BLUE), - entry(Blocks.YELLOW_WOOL, DyeColor.YELLOW), - entry(Blocks.LIME_WOOL, DyeColor.LIME), - entry(Blocks.PINK_WOOL, DyeColor.PINK), - entry(Blocks.GRAY_WOOL, DyeColor.GRAY), - entry(Blocks.LIGHT_GRAY_WOOL, DyeColor.LIGHT_GRAY), - entry(Blocks.CYAN_WOOL, DyeColor.CYAN), - entry(Blocks.PURPLE_WOOL, DyeColor.PURPLE), - entry(Blocks.BLUE_WOOL, DyeColor.BLUE), - entry(Blocks.BROWN_WOOL, DyeColor.BROWN), - entry(Blocks.GREEN_WOOL, DyeColor.GREEN), - entry(Blocks.RED_WOOL, DyeColor.RED), - entry(Blocks.BLACK_WOOL, DyeColor.BLACK) - ); + private static final Map WOOL_BLOCK_TO_DYE = Arrays.stream(DyeColor.values()).collect(Collectors.toUnmodifiableMap( + Blocks.WOOL::pick, // gets the wool block of the colour + color -> color // the value is just the colour itself)) + )); + /** * The method which gets triggered when a player places a carpet, and decides what to do based on the carpet's colour: From 8335a91409c25f7fb311623dec3bcbb4e70f8bbb Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 8 Apr 2026 16:59:39 +0200 Subject: [PATCH 214/232] 26.2-beta-1 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index f8148cd1..04deea3c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ org.gradle.configuration-cache=false loom_version=1.15-SNAPSHOT # Mod Properties - mod_version = 26.1 + mod_version = 26.2-beta-1 maven_group = carpet archives_base_name = fabric-carpet From 29b3836ed9cc13b32e411edabc8f73058c0f857d Mon Sep 17 00:00:00 2001 From: gnembon Date: Thu, 16 Apr 2026 22:55:16 +0200 Subject: [PATCH 215/232] 26.2-snap-3 --- gradle.properties | 2 +- .../java/carpet/helpers/HopperCounter.java | 2 +- .../Guardian_renewableSpongesMixin.java | 3 +- .../LevelRenderer_creativeNoClipMixin.java | 6 +-- .../LevelRenderer_scarpetRenderMixin.java | 15 ++++-- .../carpet/mixins/Monster_templesMixin.java | 3 +- .../PiglinBrute_getPlacementTypeMixin.java | 3 +- .../PistonHeadRenderer_movableBEMixin.java | 2 +- ...rverPlayerGameMode_scarpetEventsMixin.java | 2 +- .../mixins/SummonCommand_lightningMixin.java | 4 +- .../java/carpet/script/CarpetScriptHost.java | 4 +- .../java/carpet/script/api/Auxiliary.java | 7 ++- .../java/carpet/script/api/WorldAccess.java | 3 +- .../script/command/CommandArgument.java | 2 +- .../carpet/script/utils/ShapesRenderer.java | 39 +++++++-------- .../java/carpet/script/value/EntityValue.java | 47 ++++++++++--------- .../carpet/script/value/ValueConversions.java | 2 +- src/main/java/carpet/utils/BlockInfo.java | 4 +- src/main/java/carpet/utils/MobAI.java | 5 +- .../carpet/utils/PerimeterDiagnostics.java | 3 +- .../java/carpet/utils/SpawnOverrides.java | 12 ++--- src/main/java/carpet/utils/SpawnReporter.java | 3 +- 22 files changed, 93 insertions(+), 80 deletions(-) diff --git a/gradle.properties b/gradle.properties index 04deea3c..ff55f673 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ org.gradle.configuration-cache=false # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=26.2-snapshot-1 + minecraft_version=26.2-snapshot-3 loader_version=0.18.6 loom_version=1.15-SNAPSHOT diff --git a/src/main/java/carpet/helpers/HopperCounter.java b/src/main/java/carpet/helpers/HopperCounter.java index 3e7cb74e..bfede835 100644 --- a/src/main/java/carpet/helpers/HopperCounter.java +++ b/src/main/java/carpet/helpers/HopperCounter.java @@ -352,7 +352,7 @@ public class HopperCounter entry(Items.PHANTOM_MEMBRANE, Blocks.BONE_BLOCK), entry(Items.EGG, Blocks.BONE_BLOCK), //entry(Items.,Blocks.), - entry(Items.COPPER_INGOT, Blocks.COPPER_BLOCK.unaffected()), + entry(Items.COPPER_INGOT, Blocks.COPPER_BLOCK.weathering().unaffected()), entry(Items.AMETHYST_SHARD, Blocks.AMETHYST_BLOCK)); /** diff --git a/src/main/java/carpet/mixins/Guardian_renewableSpongesMixin.java b/src/main/java/carpet/mixins/Guardian_renewableSpongesMixin.java index 0605d667..1aac7a94 100644 --- a/src/main/java/carpet/mixins/Guardian_renewableSpongesMixin.java +++ b/src/main/java/carpet/mixins/Guardian_renewableSpongesMixin.java @@ -4,6 +4,7 @@ import carpet.CarpetSettings; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.EntityTypes; import net.minecraft.world.entity.LightningBolt; import net.minecraft.world.entity.monster.ElderGuardian; import net.minecraft.world.entity.monster.Guardian; @@ -24,7 +25,7 @@ public abstract class Guardian_renewableSpongesMixin extends Monster { // isRemoved() if (!this.level().isClientSide() && !this.isRemoved() && CarpetSettings.renewableSponges && !((Object)this instanceof ElderGuardian)) { - ElderGuardian elderGuardian = new ElderGuardian(EntityType.ELDER_GUARDIAN ,this.level()); + ElderGuardian elderGuardian = new ElderGuardian(EntityTypes.ELDER_GUARDIAN ,this.level()); elderGuardian.snapTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot()); elderGuardian.finalizeSpawn(serverWorld ,serverWorld.getCurrentDifficultyAt(elderGuardian.blockPosition()), EntitySpawnReason.CONVERSION, null); elderGuardian.setNoAi(this.isNoAi()); diff --git a/src/main/java/carpet/mixins/LevelRenderer_creativeNoClipMixin.java b/src/main/java/carpet/mixins/LevelRenderer_creativeNoClipMixin.java index 30831a8b..bfd0355d 100644 --- a/src/main/java/carpet/mixins/LevelRenderer_creativeNoClipMixin.java +++ b/src/main/java/carpet/mixins/LevelRenderer_creativeNoClipMixin.java @@ -1,16 +1,16 @@ package carpet.mixins; import carpet.CarpetSettings; +import net.minecraft.client.Camera; import net.minecraft.client.player.LocalPlayer; -import net.minecraft.client.renderer.LevelRenderer; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; -@Mixin(LevelRenderer.class) +@Mixin(Camera.class) public class LevelRenderer_creativeNoClipMixin { - @Redirect(method = "update", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/LocalPlayer;isSpectator()Z")) + @Redirect(method = "extractRenderState", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/LocalPlayer;isSpectator()Z")) private boolean canSeeWorld(LocalPlayer clientPlayerEntity) { return clientPlayerEntity.isSpectator() || (CarpetSettings.creativeNoClip && clientPlayerEntity.isCreative()); diff --git a/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java b/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java index a1593b21..b7ea197e 100644 --- a/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java +++ b/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java @@ -9,9 +9,11 @@ import com.mojang.blaze3d.framegraph.FramePass; import com.mojang.blaze3d.resource.GraphicsResourceAllocator; import net.minecraft.client.DeltaTracker; import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.LevelRenderer; import net.minecraft.client.renderer.LevelTargetBundle; import net.minecraft.client.renderer.RenderBuffers; +import net.minecraft.client.renderer.ShaderManager; import net.minecraft.client.renderer.blockentity.BlockEntityRenderDispatcher; import net.minecraft.client.renderer.chunk.ChunkSectionsToRender; import net.minecraft.client.renderer.entity.EntityRenderDispatcher; @@ -19,6 +21,9 @@ import net.minecraft.client.renderer.feature.FeatureRenderDispatcher; import net.minecraft.client.renderer.state.GameRenderState; import net.minecraft.client.renderer.state.level.CameraRenderState; import net.minecraft.client.renderer.state.level.LevelRenderState; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.resources.model.ModelManager; +import net.minecraft.client.resources.model.sprite.AtlasManager; import org.joml.Matrix4fc; import org.joml.Vector4f; import org.spongepowered.asm.mixin.Final; @@ -40,17 +45,17 @@ public class LevelRenderer_scarpetRenderMixin @Shadow @Final private LevelRenderState levelRenderState; @Inject(method = "", at = @At("RETURN")) - private void addRenderers(Minecraft minecraft, EntityRenderDispatcher entityRenderDispatcher, BlockEntityRenderDispatcher blockEntityRenderDispatcher, RenderBuffers renderBuffers, GameRenderState gameRenderState, FeatureRenderDispatcher featureRenderDispatcher, CallbackInfo ci) + private void addRenderers(EntityRenderDispatcher entityRenderDispatcher, BlockEntityRenderDispatcher blockEntityRenderDispatcher, ModelManager modelManager, TextureManager textureManager, AtlasManager atlasManager, ShaderManager shaderManager, GameRenderer gameRenderer, int width, int height, CallbackInfo ci) { - CarpetClient.shapes = new ShapesRenderer(minecraft); + CarpetClient.shapes = new ShapesRenderer(Minecraft.getInstance()); } - @Inject(method = "renderLevel", at = @At( + @Inject(method = "render", at = @At( value = "INVOKE", target = "Lnet/minecraft/client/renderer/LevelRenderer;addLateDebugPass(Lcom/mojang/blaze3d/framegraph/FrameGraphBuilder;Lnet/minecraft/client/renderer/state/level/CameraRenderState;Lcom/mojang/blaze3d/buffers/GpuBufferSlice;Lorg/joml/Matrix4fc;)V", shift = At.Shift.AFTER )) - private void renderScarpetThinsLate(GraphicsResourceAllocator resourceAllocator, DeltaTracker deltaTracker, boolean renderOutline, CameraRenderState cameraState, Matrix4fc modelViewMatrix, GpuBufferSlice terrainFog, Vector4f fogColor, boolean shouldRenderSky, ChunkSectionsToRender chunkSectionsToRender, CallbackInfo ci, @Local FrameGraphBuilder frameGraphBuilder) + private void renderScarpetThinsLate(GraphicsResourceAllocator resourceAllocator, DeltaTracker deltaTracker, boolean renderOutline, CameraRenderState cameraState, Matrix4fc modelViewMatrix, GpuBufferSlice terrainFog, Vector4f fogColor, boolean shouldRenderSky, CallbackInfo ci, @Local FrameGraphBuilder frameGraphBuilder) { // in normal circumstances we want to render shapes at the very end so it appears correctly behind stuff. // we might actually not need to play with render hooks here. @@ -62,7 +67,7 @@ public class LevelRenderer_scarpetRenderMixin targets.main = pass.readsAndWrites(targets.main); pass.executes(() -> CarpetClient.shapes.render(renderBuffers, levelRenderState, modelViewMatrix, deltaPartialTick)); featureRenderDispatcher.renderAllFeatures(); - renderBuffers.bufferSource().endLastBatch(); + renderBuffers.bufferSource().uploadAndDraw(); } } } diff --git a/src/main/java/carpet/mixins/Monster_templesMixin.java b/src/main/java/carpet/mixins/Monster_templesMixin.java index 2108205f..42c3c065 100644 --- a/src/main/java/carpet/mixins/Monster_templesMixin.java +++ b/src/main/java/carpet/mixins/Monster_templesMixin.java @@ -7,6 +7,7 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.util.RandomSource; import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.EntityTypes; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.monster.Monster; import net.minecraft.world.level.ServerLevelAccessor; @@ -23,6 +24,6 @@ public class Monster_templesMixin EntityType entityType, ServerLevelAccessor serverLevelAccessor, EntitySpawnReason entitySpawnReason, BlockPos blockPos, RandomSource randomSource) { return serverWorldAccess.canSeeSky(pos) || - (CarpetSettings.huskSpawningInTemples && entityType == EntityType.HUSK && SpawnOverrides.isStructureAtPosition((ServerLevel)serverWorldAccess, BuiltinStructures.DESERT_PYRAMID, pos)); + (CarpetSettings.huskSpawningInTemples && entityType == EntityTypes.HUSK && SpawnOverrides.isStructureAtPosition((ServerLevel)serverWorldAccess, BuiltinStructures.DESERT_PYRAMID, pos)); } } diff --git a/src/main/java/carpet/mixins/PiglinBrute_getPlacementTypeMixin.java b/src/main/java/carpet/mixins/PiglinBrute_getPlacementTypeMixin.java index 3b5b9089..e7874790 100644 --- a/src/main/java/carpet/mixins/PiglinBrute_getPlacementTypeMixin.java +++ b/src/main/java/carpet/mixins/PiglinBrute_getPlacementTypeMixin.java @@ -2,6 +2,7 @@ package carpet.mixins; import carpet.CarpetSettings; import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.EntityTypes; import net.minecraft.world.entity.SpawnPlacementType; import net.minecraft.world.entity.SpawnPlacementTypes; import net.minecraft.world.entity.SpawnPlacements; @@ -14,7 +15,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; public class PiglinBrute_getPlacementTypeMixin { @Inject(method = "getPlacementType", at = @At("HEAD"), cancellable = true) private static void getPlacementType(final EntityType entityType, final CallbackInfoReturnable cir) { - if (CarpetSettings.piglinsSpawningInBastions && entityType == EntityType.PIGLIN_BRUTE) { + if (CarpetSettings.piglinsSpawningInBastions && entityType == EntityTypes.PIGLIN_BRUTE) { cir.setReturnValue(SpawnPlacementTypes.ON_GROUND); } } diff --git a/src/main/java/carpet/mixins/PistonHeadRenderer_movableBEMixin.java b/src/main/java/carpet/mixins/PistonHeadRenderer_movableBEMixin.java index 1cde11b8..f9b52e65 100644 --- a/src/main/java/carpet/mixins/PistonHeadRenderer_movableBEMixin.java +++ b/src/main/java/carpet/mixins/PistonHeadRenderer_movableBEMixin.java @@ -43,7 +43,7 @@ public abstract class PistonHeadRenderer_movableBEMixin implements BlockEntityRe float progress = pistonMovingBlockEntity.getProgress(f); //System.out.println("progress: " + progress); //if (progress != 0) { - BlockEntityRenderState res = dispatcher.tryExtractRenderState(be, f, crumblingOverlay); + BlockEntityRenderState res = dispatcher.tryExtractRenderState(be, f, crumblingOverlay, true); if (res != null) { ((PistonHeadRenderStateInterface) pistonHeadRenderState).setMovedBERenderState(res); } diff --git a/src/main/java/carpet/mixins/ServerPlayerGameMode_scarpetEventsMixin.java b/src/main/java/carpet/mixins/ServerPlayerGameMode_scarpetEventsMixin.java index 25400f96..e2d79d70 100644 --- a/src/main/java/carpet/mixins/ServerPlayerGameMode_scarpetEventsMixin.java +++ b/src/main/java/carpet/mixins/ServerPlayerGameMode_scarpetEventsMixin.java @@ -54,7 +54,7 @@ public class ServerPlayerGameMode_scarpetEventsMixin implements ServerPlayerInte @Inject(method = "useItemOn", at = @At( value = "INVOKE", - target = "Lnet/minecraft/advancements/criterion/ItemUsedOnLocationTrigger;trigger(Lnet/minecraft/server/level/ServerPlayer;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/item/ItemInstance;)V", + target = "Lnet/minecraft/advancements/triggers/ItemUsedOnLocationTrigger;trigger(Lnet/minecraft/server/level/ServerPlayer;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/item/ItemInstance;)V", shift = At.Shift.BEFORE )) private void onBlockActivated(ServerPlayer serverPlayerEntity, Level world, ItemStack stack, InteractionHand hand, BlockHitResult hitResult, CallbackInfoReturnable cir) diff --git a/src/main/java/carpet/mixins/SummonCommand_lightningMixin.java b/src/main/java/carpet/mixins/SummonCommand_lightningMixin.java index ca0785c2..c6dc3d1d 100644 --- a/src/main/java/carpet/mixins/SummonCommand_lightningMixin.java +++ b/src/main/java/carpet/mixins/SummonCommand_lightningMixin.java @@ -7,7 +7,7 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntitySpawnReason; -import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.EntityTypes; import net.minecraft.world.entity.LightningBolt; import net.minecraft.world.entity.animal.equine.SkeletonHorse; import net.minecraft.world.level.gamerules.GameRules; @@ -32,7 +32,7 @@ public class SummonCommand_lightningMixin DifficultyInstance localDifficulty_1 = world.getCurrentDifficultyAt(at); boolean boolean_2 = world.getGameRules().get(GameRules.SPAWN_MOBS) && world.getRandom().nextDouble() < (double)localDifficulty_1.getEffectiveDifficulty() * 0.01D; if (boolean_2) { - SkeletonHorse skeletonHorseEntity_1 = EntityType.SKELETON_HORSE.create(world, EntitySpawnReason.EVENT); + SkeletonHorse skeletonHorseEntity_1 = EntityTypes.SKELETON_HORSE.create(world, EntitySpawnReason.EVENT); skeletonHorseEntity_1.setTrap(true); skeletonHorseEntity_1.setAge(0); skeletonHorseEntity_1.setPos(entity.getX(), entity.getY(), entity.getZ()); diff --git a/src/main/java/carpet/script/CarpetScriptHost.java b/src/main/java/carpet/script/CarpetScriptHost.java index 26f7dc7b..890bc6ad 100644 --- a/src/main/java/carpet/script/CarpetScriptHost.java +++ b/src/main/java/carpet/script/CarpetScriptHost.java @@ -38,7 +38,7 @@ import net.minecraft.network.chat.Component; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.EntityTypes; import org.apache.commons.lang3.tuple.Pair; import org.jspecify.annotations.Nullable; @@ -961,7 +961,7 @@ public class CarpetScriptHost extends ScriptHost String markerName = Auxiliary.MARKER_STRING + "_" + ((getName() == null) ? "" : getName()); for (ServerLevel world : scriptServer().server.getAllLevels()) { - for (Entity e : world.getEntities(EntityType.ARMOR_STAND, (as) -> as.entityTags().contains(markerName))) + for (Entity e : world.getEntities(EntityTypes.ARMOR_STAND, (as) -> as.entityTags().contains(markerName))) { e.discard(); } diff --git a/src/main/java/carpet/script/api/Auxiliary.java b/src/main/java/carpet/script/api/Auxiliary.java index 3a3fb0ad..daf55c50 100644 --- a/src/main/java/carpet/script/api/Auxiliary.java +++ b/src/main/java/carpet/script/api/Auxiliary.java @@ -66,11 +66,10 @@ import net.minecraft.stats.Stat; import net.minecraft.stats.StatType; import net.minecraft.world.clock.WorldClocks; import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.EntityTypes; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.decoration.ArmorStand; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.storage.CommandStorage; @@ -382,7 +381,7 @@ public class Auxiliary throw new InternalExpressionException("'create_marker' requires a name and three coordinates, with optional direction, and optional block on its head"); } Level level = cc.level(); - ArmorStand armorstand = new ArmorStand(EntityType.ARMOR_STAND, level); + ArmorStand armorstand = new ArmorStand(EntityTypes.ARMOR_STAND, level); double yoffset; if (targetBlock == null && name == null) { @@ -435,7 +434,7 @@ public class Auxiliary CarpetContext cc = (CarpetContext) c; int total = 0; String markerName = MARKER_STRING + "_" + ((cc.host.getName() == null) ? "" : cc.host.getName()); - for (Entity e : cc.level().getEntities(EntityType.ARMOR_STAND, as -> as.entityTags().contains(markerName))) + for (Entity e : cc.level().getEntities(EntityTypes.ARMOR_STAND, as -> as.entityTags().contains(markerName))) { total++; e.discard(); diff --git a/src/main/java/carpet/script/api/WorldAccess.java b/src/main/java/carpet/script/api/WorldAccess.java index 69c663e7..5499c5b4 100644 --- a/src/main/java/carpet/script/api/WorldAccess.java +++ b/src/main/java/carpet/script/api/WorldAccess.java @@ -56,6 +56,7 @@ import net.minecraft.tags.ItemTags; import net.minecraft.tags.TagKey; import net.minecraft.util.ProblemReporter; import net.minecraft.util.random.WeightedList; +import net.minecraft.world.entity.EntityTypes; import net.minecraft.world.level.ServerExplosion; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.chunk.PalettedContainer; @@ -946,7 +947,7 @@ public class WorldAccess } if (DUMMY_ENTITY == null) { - DUMMY_ENTITY = new FallingBlockEntity(EntityType.FALLING_BLOCK, null); + DUMMY_ENTITY = new FallingBlockEntity(EntityTypes.FALLING_BLOCK, null); } Block.dropResources(state, world, where, be, DUMMY_ENTITY, tool); } diff --git a/src/main/java/carpet/script/command/CommandArgument.java b/src/main/java/carpet/script/command/CommandArgument.java index d9b7e1aa..76ae1901 100644 --- a/src/main/java/carpet/script/command/CommandArgument.java +++ b/src/main/java/carpet/script/command/CommandArgument.java @@ -55,7 +55,7 @@ import java.util.function.Supplier; import java.util.stream.Collectors; import net.minecraft.ChatFormatting; -import net.minecraft.advancements.criterion.MinMaxBounds; +import net.minecraft.advancements.predicates.MinMaxBounds; import net.minecraft.commands.CommandBuildContext; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.SharedSuggestionProvider; diff --git a/src/main/java/carpet/script/utils/ShapesRenderer.java b/src/main/java/carpet/script/utils/ShapesRenderer.java index 1fc1ef4a..d0df2ff3 100644 --- a/src/main/java/carpet/script/utils/ShapesRenderer.java +++ b/src/main/java/carpet/script/utils/ShapesRenderer.java @@ -119,7 +119,7 @@ public class ShapesRenderer // posestack is not needed anymore - left as TODO to cleanup later PoseStack matrices = new PoseStack(); - Camera camera = this.client.gameRenderer.getMainCamera(); + Camera camera = this.client.gameRenderer.mainCamera(); ClientLevel iWorld = this.client.level; ResourceKey dimensionType = iWorld.dimension(); if ((shapes.get(dimensionType) == null || shapes.get(dimensionType).isEmpty()) && @@ -194,20 +194,20 @@ public class ShapesRenderer }); } MultiBufferSource.BufferSource bufferSource = renderBuffers.bufferSource(); - bufferSource.endLastBatch(); + bufferSource.uploadAndDraw(); normal.render(matrices, bufferSource, cameraa.cameraRenderState, matrix4f); - bufferSource.endLastBatch(); + bufferSource.uploadAndDraw(); if (false) { - final RenderTarget mainRenderTarget = Minecraft.getInstance().getMainRenderTarget(); + final RenderTarget mainRenderTarget = Minecraft.getInstance().gameRenderer.mainRenderTarget(); RenderSystem.getDevice().createCommandEncoder().clearDepthTexture(mainRenderTarget.getDepthTexture(), 1.0); onTop.render(matrices, bufferSource, cameraa.cameraRenderState, matrix4f); - bufferSource.endLastBatch(); + bufferSource.uploadAndDraw(); - RenderSystem.getDevice().createCommandEncoder().clearDepthTexture(Minecraft.getInstance().getMainRenderTarget().getDepthTexture(), 1.0); + RenderSystem.getDevice().createCommandEncoder().clearDepthTexture(Minecraft.getInstance().gameRenderer.mainRenderTarget().getDepthTexture(), 1.0); } @@ -366,7 +366,7 @@ public class ShapesRenderer } Vec3 v1 = shape.relativiseRender(client.level, shape.pos, partialTick); - Camera camera1 = client.gameRenderer.getMainCamera(); + Camera camera1 = client.gameRenderer.mainCamera(); matrices.pushPose(); if (!isitem)// blocks should use its center as the origin @@ -415,7 +415,7 @@ public class ShapesRenderer blockState = shape.blockState; - MultiBufferSource.BufferSource immediate = client.renderBuffers().bufferSource(); + MultiBufferSource.BufferSource immediate = client.gameRenderer.renderBuffers().bufferSource(); if (!isitem) { // draw the block itself @@ -431,7 +431,7 @@ public class ShapesRenderer //renderState.model = state; //renderState.block = blockState.getBlock(); - renderState.submit(matrices, client.gameRenderer.getFeatureRenderDispatcher().getSubmitNodeStorage(), light, OverlayTexture.NO_OVERLAY, EntityRenderState.NO_OUTLINE); + renderState.submit(matrices, client.gameRenderer.featureRenderDispatcher().getSubmitNodeStorage(), light, OverlayTexture.NO_OVERLAY, EntityRenderState.NO_OUTLINE); //client.getBlockRenderer().renderSingleBlock(blockState, matrices, immediate, light, OverlayTexture.NO_OVERLAY); @@ -458,7 +458,7 @@ public class ShapesRenderer if (BlockEntity != null) { BlockEntityRenderer blockEntityRenderer = client.getBlockEntityRenderDispatcher().getRenderer(BlockEntity); - BlockEntityRenderState state = client.getBlockEntityRenderDispatcher().tryExtractRenderState(BlockEntity, partialTick, null); + BlockEntityRenderState state = client.getBlockEntityRenderDispatcher().tryExtractRenderState(BlockEntity, partialTick, null, true); // levelRenderer;;submitBlockEntities does a weird transpose @@ -474,7 +474,7 @@ public class ShapesRenderer //matrices.mulPose(levelRenderState.cameraRenderState.); - blockEntityRenderer.submit(state, matrices,client.gameRenderer.getFeatureRenderDispatcher().getSubmitNodeStorage(), levelRenderState.cameraRenderState); + blockEntityRenderer.submit(state, matrices,client.gameRenderer.featureRenderDispatcher().getSubmitNodeStorage(), levelRenderState.cameraRenderState); //blockEntityRenderer.submit(BlockEntity, partialTick, // matrices, light, OverlayTexture.NO_OVERLAY, camera1.getPosition(), null, client.gameRenderer.getFeatureRenderDispatcher().getSubmitNodeStorage()); @@ -490,14 +490,14 @@ public class ShapesRenderer final ItemStackRenderState itemState = new ItemStackRenderState(); client.getItemModelResolver().updateForTopItem(itemState, shape.item, ItemDisplayContext.FIXED, client.level, null, 0); - itemState.submit(matrices, client.gameRenderer.getFeatureRenderDispatcher().getSubmitNodeStorage(), light, OverlayTexture.NO_OVERLAY, EntityRenderState.NO_OUTLINE); + itemState.submit(matrices, client.gameRenderer.featureRenderDispatcher().getSubmitNodeStorage(), light, OverlayTexture.NO_OVERLAY, EntityRenderState.NO_OUTLINE); //client.getItemRenderer().renderStatic(shape.item, transformType, light, // OverlayTexture.NO_OVERLAY, matrices, immediate, client.level, (int) shape.key(client.level.registryAccess())); } } matrices.popPose(); - immediate.endBatch(); + immediate.uploadAndDraw(); ////RenderSystem.disableCull(); ////RenderSystem.disableDepthTest(); ////RenderSystem.depthMask(false); @@ -528,7 +528,7 @@ public class ShapesRenderer return; } Vec3 v1 = shape.relativiseRender(client.level, shape.pos, partialTick); - Camera camera1 = client.gameRenderer.getMainCamera(); + Camera camera1 = client.gameRenderer.mainCamera(); Font textRenderer = client.font; if (shape.doublesided) { @@ -571,14 +571,15 @@ public class ShapesRenderer { text_x = (float) (-textRenderer.width(shape.value.getString())); } - try (ByteBufferBuilder bbb = new ByteBufferBuilder(RenderType.TRANSIENT_BUFFER_SIZE)) - { - MultiBufferSource.BufferSource immediate = MultiBufferSource.immediate(bbb); + //try (ByteBufferBuilder bbb = new ByteBufferBuilder(RenderType.TRANSIENT_BUFFER_SIZE)) + //{ + MultiBufferSource.BufferSource immediate = Minecraft.getInstance().gameRenderer.renderBuffers().bufferSource(); + // text doesn't appear if backgroud is set ///script run draw_shape('label', 100, 'pos', [200, 100, 200], 'text', 'Hewwo World!', 'color', 0xffffffff, 'fill', 0x33333333) textRenderer.drawInBatch(shape.value, text_x, 0.0F, shape.textcolor, false, matrices.last().pose(), immediate, Font.DisplayMode.SEE_THROUGH, shape.textbck, 15728880); - immediate.endBatch(); - } + immediate.uploadAndDraw(); + //} matrices.popPose(); ////RenderSystem.enableCull(); } diff --git a/src/main/java/carpet/script/value/EntityValue.java b/src/main/java/carpet/script/value/EntityValue.java index 9e65e378..38b4c91e 100644 --- a/src/main/java/carpet/script/value/EntityValue.java +++ b/src/main/java/carpet/script/value/EntityValue.java @@ -47,6 +47,7 @@ import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.entity.AgeableMob; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.EntityTypes; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; @@ -303,44 +304,44 @@ public class EntityValue extends Value // nonliving types Set> projectiles = Set.of( - EntityType.ARROW, EntityType.DRAGON_FIREBALL, EntityType.FIREWORK_ROCKET, - EntityType.FIREBALL, EntityType.LLAMA_SPIT, EntityType.SMALL_FIREBALL, - EntityType.SNOWBALL, EntityType.SPECTRAL_ARROW, EntityType.EGG, - EntityType.ENDER_PEARL, EntityType.EXPERIENCE_BOTTLE, EntityType.SPLASH_POTION, EntityType.LINGERING_POTION, - EntityType.TRIDENT, EntityType.WITHER_SKULL, EntityType.FISHING_BOBBER, EntityType.SHULKER_BULLET + EntityTypes.ARROW, EntityTypes.DRAGON_FIREBALL, EntityTypes.FIREWORK_ROCKET, + EntityTypes.FIREBALL, EntityTypes.LLAMA_SPIT, EntityTypes.SMALL_FIREBALL, + EntityTypes.SNOWBALL, EntityTypes.SPECTRAL_ARROW, EntityTypes.EGG, + EntityTypes.ENDER_PEARL, EntityTypes.EXPERIENCE_BOTTLE, EntityTypes.SPLASH_POTION, EntityTypes.LINGERING_POTION, + EntityTypes.TRIDENT, EntityTypes.WITHER_SKULL, EntityTypes.FISHING_BOBBER, EntityTypes.SHULKER_BULLET ); Set> deads = Set.of( - EntityType.AREA_EFFECT_CLOUD, EntityType.MARKER, EntityType.END_CRYSTAL, - EntityType.EVOKER_FANGS, EntityType.EXPERIENCE_ORB, EntityType.EYE_OF_ENDER, - EntityType.FALLING_BLOCK, EntityType.ITEM, EntityType.ITEM_FRAME, EntityType.GLOW_ITEM_FRAME, - EntityType.LEASH_KNOT, EntityType.LIGHTNING_BOLT, EntityType.PAINTING, - EntityType.TNT, EntityType.ARMOR_STAND + EntityTypes.AREA_EFFECT_CLOUD, EntityTypes.MARKER, EntityTypes.END_CRYSTAL, + EntityTypes.EVOKER_FANGS, EntityTypes.EXPERIENCE_ORB, EntityTypes.EYE_OF_ENDER, + EntityTypes.FALLING_BLOCK, EntityTypes.ITEM, EntityTypes.ITEM_FRAME, EntityTypes.GLOW_ITEM_FRAME, + EntityTypes.LEASH_KNOT, EntityTypes.LIGHTNING_BOLT, EntityTypes.PAINTING, + EntityTypes.TNT, EntityTypes.ARMOR_STAND ); Set> minecarts = Set.of( - EntityType.MINECART, EntityType.CHEST_MINECART, EntityType.COMMAND_BLOCK_MINECART, - EntityType.FURNACE_MINECART, EntityType.HOPPER_MINECART, - EntityType.SPAWNER_MINECART, EntityType.TNT_MINECART + EntityTypes.MINECART, EntityTypes.CHEST_MINECART, EntityTypes.COMMAND_BLOCK_MINECART, + EntityTypes.FURNACE_MINECART, EntityTypes.HOPPER_MINECART, + EntityTypes.SPAWNER_MINECART, EntityTypes.TNT_MINECART ); // living mob groups - non-defeault Set> undeads = Set.of( - EntityType.STRAY, EntityType.SKELETON, EntityType.WITHER_SKELETON, - EntityType.ZOMBIE, EntityType.DROWNED, EntityType.ZOMBIE_VILLAGER, - EntityType.ZOMBIE_HORSE, EntityType.SKELETON_HORSE, EntityType.PHANTOM, - EntityType.WITHER, EntityType.ZOGLIN, EntityType.HUSK, EntityType.ZOMBIFIED_PIGLIN + EntityTypes.STRAY, EntityTypes.SKELETON, EntityTypes.WITHER_SKELETON, + EntityTypes.ZOMBIE, EntityTypes.DROWNED, EntityTypes.ZOMBIE_VILLAGER, + EntityTypes.ZOMBIE_HORSE, EntityTypes.SKELETON_HORSE, EntityTypes.PHANTOM, + EntityTypes.WITHER, EntityTypes.ZOGLIN, EntityTypes.HUSK, EntityTypes.ZOMBIFIED_PIGLIN ); Set> arthropods = Set.of( - EntityType.BEE, EntityType.ENDERMITE, EntityType.SILVERFISH, EntityType.SPIDER, - EntityType.CAVE_SPIDER + EntityTypes.BEE, EntityTypes.ENDERMITE, EntityTypes.SILVERFISH, EntityTypes.SPIDER, + EntityTypes.CAVE_SPIDER ); Set> aquatique = Set.of( - EntityType.GUARDIAN, EntityType.TURTLE, EntityType.COD, EntityType.DOLPHIN, EntityType.PUFFERFISH, - EntityType.SALMON, EntityType.SQUID, EntityType.TROPICAL_FISH + EntityTypes.GUARDIAN, EntityTypes.TURTLE, EntityTypes.COD, EntityTypes.DOLPHIN, EntityTypes.PUFFERFISH, + EntityTypes.SALMON, EntityTypes.SQUID, EntityTypes.TROPICAL_FISH ); Set> illagers = Set.of( - EntityType.PILLAGER, EntityType.ILLUSIONER, EntityType.VINDICATOR, EntityType.EVOKER, - EntityType.RAVAGER, EntityType.WITCH + EntityTypes.PILLAGER, EntityTypes.ILLUSIONER, EntityTypes.VINDICATOR, EntityTypes.EVOKER, + EntityTypes.RAVAGER, EntityTypes.WITCH ); Set> living = allTypes.stream().filter(et -> diff --git a/src/main/java/carpet/script/value/ValueConversions.java b/src/main/java/carpet/script/value/ValueConversions.java index 79111265..56d97e2e 100644 --- a/src/main/java/carpet/script/value/ValueConversions.java +++ b/src/main/java/carpet/script/value/ValueConversions.java @@ -7,7 +7,7 @@ import carpet.script.external.Vanilla; import carpet.script.utils.Colors; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; -import net.minecraft.advancements.criterion.MinMaxBounds; +import net.minecraft.advancements.predicates.MinMaxBounds; import net.minecraft.core.BlockPos; import net.minecraft.core.GlobalPos; import net.minecraft.core.HolderSet; diff --git a/src/main/java/carpet/utils/BlockInfo.java b/src/main/java/carpet/utils/BlockInfo.java index fac954e6..3900f111 100644 --- a/src/main/java/carpet/utils/BlockInfo.java +++ b/src/main/java/carpet/utils/BlockInfo.java @@ -10,7 +10,7 @@ import net.minecraft.core.registries.Registries; import net.minecraft.network.chat.Component; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.EntitySpawnReason; -import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.EntityTypes; import net.minecraft.world.entity.PathfinderMob; import net.minecraft.world.entity.ai.goal.RandomStrollGoal; import net.minecraft.world.entity.ai.util.DefaultRandomPos; @@ -74,7 +74,7 @@ public class BlockInfo private static Component wander_chances(BlockPos pos, ServerLevel worldIn) { - PathfinderMob creature = new ZombifiedPiglin(EntityType.ZOMBIFIED_PIGLIN, worldIn); + PathfinderMob creature = new ZombifiedPiglin(EntityTypes.ZOMBIFIED_PIGLIN, worldIn); creature.finalizeSpawn(worldIn, worldIn.getCurrentDifficultyAt(pos), EntitySpawnReason.NATURAL, null); creature.snapTo(pos, 0.0F, 0.0F); RandomStrollGoal wander = new RandomStrollGoal(creature, 0.8D); diff --git a/src/main/java/carpet/utils/MobAI.java b/src/main/java/carpet/utils/MobAI.java index 193b1565..64b71199 100644 --- a/src/main/java/carpet/utils/MobAI.java +++ b/src/main/java/carpet/utils/MobAI.java @@ -17,6 +17,7 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.util.Mth; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.EntityTypes; import net.minecraft.world.phys.Vec3; public class MobAI @@ -78,8 +79,8 @@ public class MobAI public enum TrackingType { - IRON_GOLEM_SPAWNING(Set.of(EntityType.VILLAGER)), - BREEDING(Set.of(EntityType.VILLAGER)); + IRON_GOLEM_SPAWNING(Set.of(EntityTypes.VILLAGER)), + BREEDING(Set.of(EntityTypes.VILLAGER)); public final Set> types; TrackingType(Set> applicableTypes) { diff --git a/src/main/java/carpet/utils/PerimeterDiagnostics.java b/src/main/java/carpet/utils/PerimeterDiagnostics.java index 07e3ec82..b52a88d9 100644 --- a/src/main/java/carpet/utils/PerimeterDiagnostics.java +++ b/src/main/java/carpet/utils/PerimeterDiagnostics.java @@ -9,6 +9,7 @@ import net.minecraft.util.random.Weighted; import net.minecraft.world.entity.AgeableMob; import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.EntityTypes; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.MobCategory; import net.minecraft.world.entity.SpawnPlacements; @@ -86,7 +87,7 @@ public class PerimeterDiagnostics } } PerimeterDiagnostics diagnostic = new PerimeterDiagnostics(worldserver,ctype,el); - EntityType type = EntityType.ZOMBIE; + EntityType type = EntityTypes.ZOMBIE; if (el != null) type = el.getType(); int minY = worldserver.getMinY(); int maxY = worldserver.getMaxY(); diff --git a/src/main/java/carpet/utils/SpawnOverrides.java b/src/main/java/carpet/utils/SpawnOverrides.java index 024d6c14..58113d77 100644 --- a/src/main/java/carpet/utils/SpawnOverrides.java +++ b/src/main/java/carpet/utils/SpawnOverrides.java @@ -9,7 +9,7 @@ import net.minecraft.resources.ResourceKey; import net.minecraft.resources.Identifier; import net.minecraft.server.level.ServerLevel; import net.minecraft.util.random.WeightedList; -import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.EntityTypes; import net.minecraft.world.entity.MobCategory; import net.minecraft.world.level.StructureManager; import net.minecraft.world.level.biome.MobSpawnSettings; @@ -32,16 +32,16 @@ public class SpawnOverrides { static { addOverride(() -> CarpetSettings.huskSpawningInTemples, MobCategory.MONSTER, BuiltinStructures.DESERT_PYRAMID, StructureSpawnOverride.BoundingBoxType.STRUCTURE, - WeightedList.of(new MobSpawnSettings.SpawnerData(EntityType.HUSK, 1, 1)) + WeightedList.of(new MobSpawnSettings.SpawnerData(EntityTypes.HUSK, 1, 1)) ); addOverride(() -> CarpetSettings.shulkerSpawningInEndCities, MobCategory.MONSTER, BuiltinStructures.END_CITY, StructureSpawnOverride.BoundingBoxType.PIECE, - WeightedList.of(new MobSpawnSettings.SpawnerData(EntityType.SHULKER, 4, 4)) + WeightedList.of(new MobSpawnSettings.SpawnerData(EntityTypes.SHULKER, 4, 4)) ); addOverride(() -> CarpetSettings.piglinsSpawningInBastions, MobCategory.MONSTER, BuiltinStructures.BASTION_REMNANT, StructureSpawnOverride.BoundingBoxType.PIECE, WeightedList.builder() - .add(new MobSpawnSettings.SpawnerData(EntityType.PIGLIN_BRUTE,1, 2), 5) - .add(new MobSpawnSettings.SpawnerData(EntityType.PIGLIN, 2, 4), 10) - .add(new MobSpawnSettings.SpawnerData(EntityType.HOGLIN, 1, 2), 2) + .add(new MobSpawnSettings.SpawnerData(EntityTypes.PIGLIN_BRUTE,1, 2), 5) + .add(new MobSpawnSettings.SpawnerData(EntityTypes.PIGLIN, 2, 4), 10) + .add(new MobSpawnSettings.SpawnerData(EntityTypes.HOGLIN, 1, 2), 2) .build() ); diff --git a/src/main/java/carpet/utils/SpawnReporter.java b/src/main/java/carpet/utils/SpawnReporter.java index 56dd642f..35dfc479 100644 --- a/src/main/java/carpet/utils/SpawnReporter.java +++ b/src/main/java/carpet/utils/SpawnReporter.java @@ -18,6 +18,7 @@ import net.minecraft.util.random.WeightedList; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.EntityTypes; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.MobCategory; import net.minecraft.world.entity.SpawnPlacements; @@ -456,7 +457,7 @@ public class SpawnReporter // && mob.canSpawn(worldIn) // entity collisions // mostly - except ocelots ) { - if (etype == EntityType.OCELOT) + if (etype == EntityTypes.OCELOT) { BlockState blockState = worldIn.getBlockState(pos.below()); if ((pos.getY() < worldIn.getSeaLevel()) || !(blockState.is(Blocks.GRASS_BLOCK) || blockState.is(BlockTags.LEAVES))) { From a0f7031d54f215f3560d326ec3c1f88853e4cdf5 Mon Sep 17 00:00:00 2001 From: gnembon Date: Thu, 16 Apr 2026 22:55:52 +0200 Subject: [PATCH 216/232] 26.2-beta-2 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index ff55f673..9cf65422 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ org.gradle.configuration-cache=false loom_version=1.15-SNAPSHOT # Mod Properties - mod_version = 26.2-beta-1 + mod_version = 26.2-beta-2 maven_group = carpet archives_base_name = fabric-carpet From cabaa075dd752d2d5a755cd3242551865b76ce16 Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 22 Apr 2026 16:46:37 +0200 Subject: [PATCH 217/232] 26.2-snap-4 --- gradle.properties | 4 ++-- .../LevelRenderer_scarpetRenderMixin.java | 9 +++++++-- .../carpet/script/utils/ShapesRenderer.java | 20 +++++++++++++++---- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/gradle.properties b/gradle.properties index 9cf65422..66c3a46b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,8 +7,8 @@ org.gradle.configuration-cache=false # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=26.2-snapshot-3 - loader_version=0.18.6 + minecraft_version=26.2-snapshot-4 + loader_version=0.19.2 loom_version=1.15-SNAPSHOT # Mod Properties diff --git a/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java b/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java index b7ea197e..1a045f1d 100644 --- a/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java +++ b/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java @@ -52,10 +52,15 @@ public class LevelRenderer_scarpetRenderMixin @Inject(method = "render", at = @At( value = "INVOKE", - target = "Lnet/minecraft/client/renderer/LevelRenderer;addLateDebugPass(Lcom/mojang/blaze3d/framegraph/FrameGraphBuilder;Lnet/minecraft/client/renderer/state/level/CameraRenderState;Lcom/mojang/blaze3d/buffers/GpuBufferSlice;Lorg/joml/Matrix4fc;)V", + + //target = "Lnet/minecraft/client/renderer/LevelRenderer;addAlwaysOnTopPass(Lcom/mojang/blaze3d/framegraph/FrameGraphBuilder;Lcom/mojang/blaze3d/buffers/GpuBufferSlice;)V", + //target = "Lnet/minecraft/client/renderer/LevelRenderer;submitFeatures(Lnet/minecraft/client/renderer/state/level/LevelRenderState;Lnet/minecraft/client/renderer/SubmitNodeCollector;Z)V", + target = "Lnet/minecraft/client/renderer/LevelRenderer;addMainPass(Lcom/mojang/blaze3d/framegraph/FrameGraphBuilder;Lcom/mojang/blaze3d/buffers/GpuBufferSlice;Lnet/minecraft/client/renderer/state/level/LevelRenderState;Lnet/minecraft/util/profiling/ProfilerFiller;Lnet/minecraft/client/renderer/chunk/ChunkSectionsToRender;)V", + //target = "Lnet/minecraft/client/renderer/LevelRenderer;addLateDebugPass(Lcom/mojang/blaze3d/framegraph/FrameGraphBuilder;Lnet/minecraft/client/renderer/state/level/CameraRenderState;Lcom/mojang/blaze3d/buffers/GpuBufferSlice;Lorg/joml/Matrix4fc;)V", shift = At.Shift.AFTER )) - private void renderScarpetThinsLate(GraphicsResourceAllocator resourceAllocator, DeltaTracker deltaTracker, boolean renderOutline, CameraRenderState cameraState, Matrix4fc modelViewMatrix, GpuBufferSlice terrainFog, Vector4f fogColor, boolean shouldRenderSky, CallbackInfo ci, @Local FrameGraphBuilder frameGraphBuilder) + private void renderScarpetThingsLate(GraphicsResourceAllocator resourceAllocator, DeltaTracker deltaTracker, boolean renderOutline, CameraRenderState cameraState, Matrix4fc modelViewMatrix, GpuBufferSlice terrainFog, Vector4f fogColor, boolean shouldRenderSky, CallbackInfo ci, @Local FrameGraphBuilder frameGraphBuilder) + //private void renderScarpetThinsLate(GraphicsResourceAllocator resourceAllocator, DeltaTracker deltaTracker, boolean renderOutline, CameraRenderState cameraState, Matrix4fc modelViewMatrix, GpuBufferSlice terrainFog, Vector4f fogColor, boolean shouldRenderSky, CallbackInfo ci, @Local FrameGraphBuilder frameGraphBuilder) { // in normal circumstances we want to render shapes at the very end so it appears correctly behind stuff. // we might actually not need to play with render hooks here. diff --git a/src/main/java/carpet/script/utils/ShapesRenderer.java b/src/main/java/carpet/script/utils/ShapesRenderer.java index d0df2ff3..a1e0aaf2 100644 --- a/src/main/java/carpet/script/utils/ShapesRenderer.java +++ b/src/main/java/carpet/script/utils/ShapesRenderer.java @@ -8,6 +8,7 @@ import com.mojang.blaze3d.pipeline.RenderTarget; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.ByteBufferBuilder; import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; import com.mojang.blaze3d.vertex.VertexFormat; import com.mojang.blaze3d.vertex.VertexFormat.Mode; import com.mojang.math.Axis; @@ -23,6 +24,7 @@ import net.minecraft.client.Camera; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Font; import net.minecraft.client.gui.components.debug.DebugScreenEntries; +import net.minecraft.client.gui.font.TextRenderable; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderBuffers; @@ -198,13 +200,13 @@ public class ShapesRenderer - normal.render(matrices, bufferSource, cameraa.cameraRenderState, matrix4f); + normal.submit(client.gameRenderer.featureRenderDispatcher().getSubmitNodeStorage(), cameraa.cameraRenderState, false); bufferSource.uploadAndDraw(); if (false) { final RenderTarget mainRenderTarget = Minecraft.getInstance().gameRenderer.mainRenderTarget(); RenderSystem.getDevice().createCommandEncoder().clearDepthTexture(mainRenderTarget.getDepthTexture(), 1.0); - onTop.render(matrices, bufferSource, cameraa.cameraRenderState, matrix4f); + onTop.submit(client.gameRenderer.featureRenderDispatcher().getSubmitNodeStorage(), cameraa.cameraRenderState, true); bufferSource.uploadAndDraw(); RenderSystem.getDevice().createCommandEncoder().clearDepthTexture(Minecraft.getInstance().gameRenderer.mainRenderTarget().getDepthTexture(), 1.0); @@ -577,8 +579,18 @@ public class ShapesRenderer // text doesn't appear if backgroud is set ///script run draw_shape('label', 100, 'pos', [200, 100, 200], 'text', 'Hewwo World!', 'color', 0xffffffff, 'fill', 0x33333333) - textRenderer.drawInBatch(shape.value, text_x, 0.0F, shape.textcolor, false, matrices.last().pose(), immediate, Font.DisplayMode.SEE_THROUGH, shape.textbck, 15728880); - immediate.uploadAndDraw(); + //textRenderer.drawInBatch(shape.value, text_x, 0.0F, shape.textcolor, false, matrices.last().pose(), immediate, Font.DisplayMode.SEE_THROUGH, shape.textbck, 15728880); + + final Font.PreparedText preparedText = textRenderer.prepareText(shape.value.getVisualOrderText(), text_x, 0.0F, shape.textcolor, false, false,0); + preparedText.visit(new Font.GlyphVisitor() { + @Override + public void acceptRenderable(final TextRenderable renderable) { + final VertexConsumer buffer = immediate.getBuffer(renderable.renderType(Font.DisplayMode.NORMAL)); + renderable.render(matrices.last().pose(), buffer, LightCoordsUtil.FULL_BRIGHT, false); + } + }); + + immediate.uploadAndDraw(); //} matrices.popPose(); ////RenderSystem.enableCull(); From 6e332f9c0bf30454d1ac70a1faa36c6caaa48222 Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 22 Apr 2026 16:47:34 +0200 Subject: [PATCH 218/232] 26.2-beta-3 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 66c3a46b..9874ae91 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ org.gradle.configuration-cache=false loom_version=1.15-SNAPSHOT # Mod Properties - mod_version = 26.2-beta-2 + mod_version = 26.2-beta-3 maven_group = carpet archives_base_name = fabric-carpet From 83aea79da0c860f3bab5626758be7af8841d1958 Mon Sep 17 00:00:00 2001 From: gnembon Date: Sun, 10 May 2026 21:38:16 +0200 Subject: [PATCH 219/232] 26.2-snap-6 --- gradle.properties | 2 +- .../LevelRenderer_scarpetRenderMixin.java | 14 ++-- .../PistonHeadRenderer_movableBEMixin.java | 3 +- .../StructurePiece_scarpetPlopMixin.java | 4 +- .../java/carpet/script/api/Scoreboards.java | 14 +++- .../script/command/CommandArgument.java | 9 ++- .../carpet/script/utils/FeatureGenerator.java | 10 ++- .../carpet/script/utils/ShapesRenderer.java | 74 +++++++++++-------- 8 files changed, 79 insertions(+), 51 deletions(-) diff --git a/gradle.properties b/gradle.properties index 9874ae91..585f88cf 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ org.gradle.configuration-cache=false # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=26.2-snapshot-4 + minecraft_version=26.2-snapshot-6 loader_version=0.19.2 loom_version=1.15-SNAPSHOT diff --git a/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java b/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java index 1a045f1d..9ce4505e 100644 --- a/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java +++ b/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java @@ -14,6 +14,8 @@ import net.minecraft.client.renderer.LevelRenderer; import net.minecraft.client.renderer.LevelTargetBundle; import net.minecraft.client.renderer.RenderBuffers; import net.minecraft.client.renderer.ShaderManager; +import net.minecraft.client.renderer.SubmitNodeCollector; +import net.minecraft.client.renderer.SubmitNodeStorage; import net.minecraft.client.renderer.blockentity.BlockEntityRenderDispatcher; import net.minecraft.client.renderer.chunk.ChunkSectionsToRender; import net.minecraft.client.renderer.entity.EntityRenderDispatcher; @@ -44,6 +46,8 @@ public class LevelRenderer_scarpetRenderMixin @Shadow @Final private LevelRenderState levelRenderState; + @Shadow @Final private SubmitNodeStorage submitNodeStorage; + @Inject(method = "", at = @At("RETURN")) private void addRenderers(EntityRenderDispatcher entityRenderDispatcher, BlockEntityRenderDispatcher blockEntityRenderDispatcher, ModelManager modelManager, TextureManager textureManager, AtlasManager atlasManager, ShaderManager shaderManager, GameRenderer gameRenderer, int width, int height, CallbackInfo ci) { @@ -52,10 +56,10 @@ public class LevelRenderer_scarpetRenderMixin @Inject(method = "render", at = @At( value = "INVOKE", - +target = "Lnet/minecraft/client/renderer/LevelRenderer;addMainPass(Lcom/mojang/blaze3d/framegraph/FrameGraphBuilder;Lnet/minecraft/client/renderer/feature/FeatureRenderDispatcher$PreparedFrame;Lcom/mojang/blaze3d/buffers/GpuBufferSlice;Lnet/minecraft/client/renderer/state/level/LevelRenderState;Lnet/minecraft/util/profiling/ProfilerFiller;Lnet/minecraft/client/renderer/chunk/ChunkSectionsToRender;)V", //target = "Lnet/minecraft/client/renderer/LevelRenderer;addAlwaysOnTopPass(Lcom/mojang/blaze3d/framegraph/FrameGraphBuilder;Lcom/mojang/blaze3d/buffers/GpuBufferSlice;)V", //target = "Lnet/minecraft/client/renderer/LevelRenderer;submitFeatures(Lnet/minecraft/client/renderer/state/level/LevelRenderState;Lnet/minecraft/client/renderer/SubmitNodeCollector;Z)V", - target = "Lnet/minecraft/client/renderer/LevelRenderer;addMainPass(Lcom/mojang/blaze3d/framegraph/FrameGraphBuilder;Lcom/mojang/blaze3d/buffers/GpuBufferSlice;Lnet/minecraft/client/renderer/state/level/LevelRenderState;Lnet/minecraft/util/profiling/ProfilerFiller;Lnet/minecraft/client/renderer/chunk/ChunkSectionsToRender;)V", + //target = "Lnet/minecraft/client/renderer/LevelRenderer;addMainPass(Lcom/mojang/blaze3d/framegraph/FrameGraphBuilder;Lcom/mojang/blaze3d/buffers/GpuBufferSlice;Lnet/minecraft/client/renderer/state/level/LevelRenderState;Lnet/minecraft/util/profiling/ProfilerFiller;Lnet/minecraft/client/renderer/chunk/ChunkSectionsToRender;)V", //target = "Lnet/minecraft/client/renderer/LevelRenderer;addLateDebugPass(Lcom/mojang/blaze3d/framegraph/FrameGraphBuilder;Lnet/minecraft/client/renderer/state/level/CameraRenderState;Lcom/mojang/blaze3d/buffers/GpuBufferSlice;Lorg/joml/Matrix4fc;)V", shift = At.Shift.AFTER )) @@ -70,9 +74,9 @@ public class LevelRenderer_scarpetRenderMixin final float deltaPartialTick = deltaTracker.getGameTimeDeltaPartialTick(false); FramePass pass = frameGraphBuilder.addPass("scarpet_shapes"); targets.main = pass.readsAndWrites(targets.main); - pass.executes(() -> CarpetClient.shapes.render(renderBuffers, levelRenderState, modelViewMatrix, deltaPartialTick)); - featureRenderDispatcher.renderAllFeatures(); - renderBuffers.bufferSource().uploadAndDraw(); + pass.executes(() -> CarpetClient.shapes.render(submitNodeStorage, levelRenderState, modelViewMatrix, deltaPartialTick)); + //featureRenderDispatcher.renderAllFeatures(submitNodeStorage); + //renderBuffers.bufferSource().uploadAndDraw(); } } } diff --git a/src/main/java/carpet/mixins/PistonHeadRenderer_movableBEMixin.java b/src/main/java/carpet/mixins/PistonHeadRenderer_movableBEMixin.java index f9b52e65..08c4adf1 100644 --- a/src/main/java/carpet/mixins/PistonHeadRenderer_movableBEMixin.java +++ b/src/main/java/carpet/mixins/PistonHeadRenderer_movableBEMixin.java @@ -53,7 +53,8 @@ public abstract class PistonHeadRenderer_movableBEMixin implements BlockEntityRe } @Inject(method = "submit(Lnet/minecraft/client/renderer/blockentity/state/PistonHeadRenderState;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/SubmitNodeCollector;Lnet/minecraft/client/renderer/state/level/CameraRenderState;)V", - at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/SubmitNodeCollector;submitMovingBlock(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/block/MovingBlockRenderState;)V", + at = @At(value = "INVOKE", + target = "Lnet/minecraft/client/renderer/SubmitNodeCollector;submitMovingBlock(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/block/MovingBlockRenderState;I)V", ordinal = 0)) private void endMethod(PistonHeadRenderState pistonHeadRenderState, PoseStack poseStack, SubmitNodeCollector submitNodeCollector, CameraRenderState cameraRenderState, CallbackInfo ci) //private void endMethod(PistonMovingBlockEntity pistonBlockEntity_1, float partialTicks, PoseStack matrixStack_1, int i, int j, Vec3 vec3, ModelFeatureRenderer.CrumblingOverlay crumblingOverlay, SubmitNodeCollector submitNodeCollector, CallbackInfo ci) diff --git a/src/main/java/carpet/mixins/StructurePiece_scarpetPlopMixin.java b/src/main/java/carpet/mixins/StructurePiece_scarpetPlopMixin.java index 9d33016e..9d42166c 100644 --- a/src/main/java/carpet/mixins/StructurePiece_scarpetPlopMixin.java +++ b/src/main/java/carpet/mixins/StructurePiece_scarpetPlopMixin.java @@ -13,10 +13,10 @@ public class StructurePiece_scarpetPlopMixin { @Redirect(method = "placeBlock", at = @At( value = "INVOKE", - target = "Lnet/minecraft/world/level/chunk/ChunkAccess;markPosForPostprocessing(Lnet/minecraft/core/BlockPos;)V" + target = "Lnet/minecraft/world/level/chunk/ChunkAccess;markPosForPostProcessing(Lnet/minecraft/core/BlockPos;)V" )) private void markOrNot(ChunkAccess chunk, BlockPos pos) { - if (!CarpetSettings.skipGenerationChecks.get()) chunk.markPosForPostprocessing(pos); + if (!CarpetSettings.skipGenerationChecks.get()) chunk.markPosForPostProcessing(pos); } } diff --git a/src/main/java/carpet/script/api/Scoreboards.java b/src/main/java/carpet/script/api/Scoreboards.java index f0e3365c..260d3abd 100644 --- a/src/main/java/carpet/script/api/Scoreboards.java +++ b/src/main/java/carpet/script/api/Scoreboards.java @@ -18,9 +18,12 @@ import com.google.common.collect.Lists; import java.util.ArrayList; import java.util.List; +import java.util.Optional; +import com.mojang.serialization.DataResult; import net.minecraft.ChatFormatting; import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextColor; import net.minecraft.resources.Identifier; import net.minecraft.server.MinecraftServer; import net.minecraft.server.ServerScoreboard; @@ -36,6 +39,7 @@ import net.minecraft.world.scores.ScoreAccess; import net.minecraft.world.scores.ScoreHolder; import net.minecraft.world.scores.Scoreboard; import net.minecraft.world.scores.Team; +import net.minecraft.world.scores.TeamColor; import net.minecraft.world.scores.criteria.ObjectiveCriteria; import org.jetbrains.annotations.Nullable; @@ -433,18 +437,20 @@ public class Scoreboards case "color" -> { if (!modifying) { - return new StringValue(team.getColor().getName()); + return new StringValue(team.getColor().get().getSerializedName()); } if (!(settingVal instanceof StringValue)) { throw new InternalExpressionException("'team_property' requires a string as the third argument for the property " + propertyVal.getString()); } - ChatFormatting color = ChatFormatting.getByName(settingVal.getString().toUpperCase()); - if (color == null || !color.isColor()) + TeamColor teamColor = TeamColor.byName(settingVal.getString().toLowerCase()); + //DataResult color = TextColor.parseColor(settingVal.getString().toUpperCase()); + //ChatFormatting color = ChatFormatting.valueOf(settingVal.getString().toUpperCase());; + if (teamColor == null) { throw new InternalExpressionException("Unknown value for property " + propertyVal.getString() + ": " + settingVal.getString()); } - team.setColor(color); + team.setColor(Optional.of(teamColor)); } case "deathMessageVisibility" -> { if (!modifying) diff --git a/src/main/java/carpet/script/command/CommandArgument.java b/src/main/java/carpet/script/command/CommandArgument.java index 76ae1901..48cb8886 100644 --- a/src/main/java/carpet/script/command/CommandArgument.java +++ b/src/main/java/carpet/script/command/CommandArgument.java @@ -60,7 +60,7 @@ import net.minecraft.commands.CommandBuildContext; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.SharedSuggestionProvider; import net.minecraft.commands.arguments.AngleArgument; -import net.minecraft.commands.arguments.ColorArgument; +import net.minecraft.commands.arguments.TeamColorArgument; import net.minecraft.commands.arguments.CompoundTagArgument; import net.minecraft.commands.arguments.DimensionArgument; import net.minecraft.commands.arguments.EntityAnchorArgument; @@ -108,6 +108,7 @@ import net.minecraft.world.level.biome.Biome; import net.minecraft.world.phys.Vec2; import net.minecraft.world.scores.ScoreHolder; +import net.minecraft.world.scores.TeamColor; import org.jspecify.annotations.Nullable; import static net.minecraft.commands.Commands.argument; @@ -144,10 +145,10 @@ public abstract class CommandArgument (c, p) -> ValueConversions.ofBlockPredicate(c.getSource().getServer().registryAccess(), BlockPredicateArgument.getBlockPredicate(c, p)), param -> (ctx, builder) -> ctx.getArgument(param, BlockPredicateArgument.class).listSuggestions(ctx, builder) ), - new VanillaUnconfigurableArgument("teamcolor", ColorArgument::color, + new VanillaUnconfigurableArgument("teamcolor", TeamColorArgument::teamColor, (c, p) -> { - ChatFormatting format = ColorArgument.getColor(c, p); - return ListValue.of(StringValue.of(format.getName()), ValueConversions.ofRGB(format.getColor())); + TeamColor format = TeamColorArgument.getTeamColor(c, p); + return ListValue.of(StringValue.of(format.getSerializedName()), ValueConversions.ofRGB(format.rgb())); }, false ), diff --git a/src/main/java/carpet/script/utils/FeatureGenerator.java b/src/main/java/carpet/script/utils/FeatureGenerator.java index d5ff798c..844a843f 100644 --- a/src/main/java/carpet/script/utils/FeatureGenerator.java +++ b/src/main/java/carpet/script/utils/FeatureGenerator.java @@ -47,6 +47,7 @@ import net.minecraft.world.level.levelgen.feature.featuresize.TwoLayersFeatureSi import net.minecraft.world.level.levelgen.feature.foliageplacers.BlobFoliagePlacer; import net.minecraft.world.level.levelgen.feature.foliageplacers.FancyFoliagePlacer; import net.minecraft.world.level.levelgen.feature.stateproviders.BlockStateProvider; +import net.minecraft.world.level.levelgen.feature.stateproviders.RuleBasedStateProvider; import net.minecraft.world.level.levelgen.heightproviders.ConstantHeight; import net.minecraft.world.level.levelgen.structure.BoundingBox; import net.minecraft.world.level.levelgen.structure.Structure; @@ -65,6 +66,8 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureProc import org.jspecify.annotations.Nullable; +import static net.minecraft.world.level.levelgen.feature.configurations.TreeConfiguration.CAN_PLACE_BELOW_TREE_TRUNKS; + public class FeatureGenerator { @Nullable @@ -272,16 +275,19 @@ public class FeatureGenerator return null; } + private static RuleBasedStateProvider belowTrees = RuleBasedStateProvider.ifTrueThenProvide(CAN_PLACE_BELOW_TREE_TRUNKS, Blocks.DIRT); + private static TreeConfiguration.TreeConfigurationBuilder createTree(Block block, Block block2, int i, int j, int k, int l) { - return new TreeConfiguration.TreeConfigurationBuilder(BlockStateProvider.simple(block), new StraightTrunkPlacer(i, j, k), BlockStateProvider.simple(block2), new BlobFoliagePlacer(ConstantInt.of(l), ConstantInt.of(0), 3), new TwoLayersFeatureSize(1, 0, 1)); + return new TreeConfiguration.TreeConfigurationBuilder(BlockStateProvider.simple(block), new StraightTrunkPlacer(i, j, k), BlockStateProvider.simple(block2), new BlobFoliagePlacer(ConstantInt.of(l), ConstantInt.of(0), 3), new TwoLayersFeatureSize(1, 0, 1), belowTrees); } public static final Map> featureMap = new HashMap<>() {{ + // TODO remove this using what place feature is using put("oak_bees", l -> simpleTree(createTree(Blocks.OAK_LOG, Blocks.OAK_LEAVES, 4, 2, 0, 2).ignoreVines().decorators(List.of(new BeehiveDecorator(1.00F))).build())); - put("fancy_oak_bees", l -> simpleTree((new TreeConfiguration.TreeConfigurationBuilder(BlockStateProvider.simple(Blocks.OAK_LOG), new FancyTrunkPlacer(3, 11, 0), BlockStateProvider.simple(Blocks.OAK_LEAVES), new FancyFoliagePlacer(ConstantInt.of(2), ConstantInt.of(4), 4), new TwoLayersFeatureSize(0, 0, 0, OptionalInt.of(4)))).ignoreVines().decorators(List.of(new BeehiveDecorator(1.00F))).build())); + put("fancy_oak_bees", l -> simpleTree((new TreeConfiguration.TreeConfigurationBuilder(BlockStateProvider.simple(Blocks.OAK_LOG), new FancyTrunkPlacer(3, 11, 0), BlockStateProvider.simple(Blocks.OAK_LEAVES), new FancyFoliagePlacer(ConstantInt.of(2), ConstantInt.of(4), 4), new TwoLayersFeatureSize(0, 0, 0, OptionalInt.of(4)), belowTrees)).ignoreVines().decorators(List.of(new BeehiveDecorator(1.00F))).build())); put("birch_bees", l -> simpleTree(createTree(Blocks.BIRCH_LOG, Blocks.BIRCH_LEAVES, 5, 2, 0, 2).ignoreVines().decorators(List.of(new BeehiveDecorator(1.00F))).build())); put("coral_tree", l -> simplePlop(Feature.CORAL_TREE, FeatureConfiguration.NONE)); diff --git a/src/main/java/carpet/script/utils/ShapesRenderer.java b/src/main/java/carpet/script/utils/ShapesRenderer.java index a1e0aaf2..61dfc1af 100644 --- a/src/main/java/carpet/script/utils/ShapesRenderer.java +++ b/src/main/java/carpet/script/utils/ShapesRenderer.java @@ -6,11 +6,10 @@ import carpet.script.utils.shapes.ShapeDirection; import com.mojang.blaze3d.pipeline.RenderTarget; import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.ByteBufferBuilder; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import com.mojang.blaze3d.vertex.VertexFormat; -import com.mojang.blaze3d.vertex.VertexFormat.Mode; +//import com.mojang.blaze3d.vertex.VertexFormat.Mode; import com.mojang.math.Axis; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; @@ -26,8 +25,8 @@ import net.minecraft.client.gui.Font; import net.minecraft.client.gui.components.debug.DebugScreenEntries; import net.minecraft.client.gui.font.TextRenderable; import net.minecraft.client.multiplayer.ClientLevel; -import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.RenderBuffers; +//import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.SubmitNodeStorage; import net.minecraft.client.renderer.block.BlockModelRenderState; import net.minecraft.client.renderer.entity.DisplayRenderer; import net.minecraft.client.renderer.rendertype.RenderType; @@ -115,7 +114,7 @@ public class ShapesRenderer labels = new HashMap<>(); } - public void render(RenderBuffers renderBuffers, LevelRenderState cameraa, Matrix4fc matrix4f, float partialTick) + public void render(SubmitNodeStorage submitNodeStorage, LevelRenderState cameraa, Matrix4fc matrix4f, float partialTick) { Runnable token = Carpet.startProfilerSection("Scarpet client"); // posestack is not needed anymore - left as TODO to cleanup later @@ -169,7 +168,7 @@ public class ShapesRenderer shapes.get(dimensionType).values().forEach(s -> { if ((!s.shape.debug || entityBoxes) && s.shouldRender(dimensionType)) { - s.renderLines(matrices, cameraX, cameraY, cameraZ, partialTick, cameraa, s.shape.seethrough ? onTop : normal); + s.renderLines(matrices, cameraX, cameraY, cameraZ, partialTick, cameraa, s.shape.seethrough ? onTop : normal, submitNodeStorage ); } }); // faces @@ -191,23 +190,23 @@ public class ShapesRenderer labels.get(dimensionType).values().forEach(s -> { if ((!s.shape.debug || entityBoxes) && s.shouldRender(dimensionType)) { - s.renderLines(matrices, cameraX, cameraY, cameraZ, partialTick, cameraa, s.shape.seethrough ? onTop : normal); + s.renderLines(matrices, cameraX, cameraY, cameraZ, partialTick, cameraa, s.shape.seethrough ? onTop : normal, submitNodeStorage ); } }); } - MultiBufferSource.BufferSource bufferSource = renderBuffers.bufferSource(); - bufferSource.uploadAndDraw(); + //MultiBufferSource.BufferSource bufferSource = renderBuffers. bufferSource(); + //bufferSource.uploadAndDraw(); - normal.submit(client.gameRenderer.featureRenderDispatcher().getSubmitNodeStorage(), cameraa.cameraRenderState, false); - bufferSource.uploadAndDraw(); + normal.submit(submitNodeStorage, cameraa.cameraRenderState, false); + //bufferSource.uploadAndDraw(); if (false) { final RenderTarget mainRenderTarget = Minecraft.getInstance().gameRenderer.mainRenderTarget(); RenderSystem.getDevice().createCommandEncoder().clearDepthTexture(mainRenderTarget.getDepthTexture(), 1.0); - onTop.submit(client.gameRenderer.featureRenderDispatcher().getSubmitNodeStorage(), cameraa.cameraRenderState, true); - bufferSource.uploadAndDraw(); + onTop.submit(submitNodeStorage, cameraa.cameraRenderState, true); + //bufferSource.uploadAndDraw(); RenderSystem.getDevice().createCommandEncoder().clearDepthTexture(Minecraft.getInstance().gameRenderer.mainRenderTarget().getDepthTexture(), 1.0); @@ -286,7 +285,7 @@ public class ShapesRenderer long expiryTick; double renderEpsilon; - public abstract void renderLines(PoseStack matrices, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState, DrawableGizmoPrimitives primitives); + public abstract void renderLines(PoseStack matrices, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState, DrawableGizmoPrimitives primitives, SubmitNodeStorage submitNodeStorage); public void renderFaces(double cx, double cy, double cz, float partialTick, DrawableGizmoPrimitives primitives) { @@ -360,7 +359,7 @@ public class ShapesRenderer @Override public void renderLines(PoseStack matrices, double cx, double cy, - double cz, float partialTick, LevelRenderState levelRenderState, DrawableGizmoPrimitives primitives) + double cz, float partialTick, LevelRenderState levelRenderState, DrawableGizmoPrimitives primitives, SubmitNodeStorage submitNodeStorage) { if (shape.a == 0.0) { @@ -417,7 +416,7 @@ public class ShapesRenderer blockState = shape.blockState; - MultiBufferSource.BufferSource immediate = client.gameRenderer.renderBuffers().bufferSource(); + //MultiBufferSource.BufferSource immediate = client.gameRenderer.renderBuffers().bufferSource(); if (!isitem) { // draw the block itself @@ -433,7 +432,7 @@ public class ShapesRenderer //renderState.model = state; //renderState.block = blockState.getBlock(); - renderState.submit(matrices, client.gameRenderer.featureRenderDispatcher().getSubmitNodeStorage(), light, OverlayTexture.NO_OVERLAY, EntityRenderState.NO_OUTLINE); + renderState.submit(matrices, submitNodeStorage, light, OverlayTexture.NO_OVERLAY, EntityRenderState.NO_OUTLINE); //client.getBlockRenderer().renderSingleBlock(blockState, matrices, immediate, light, OverlayTexture.NO_OVERLAY); @@ -476,7 +475,7 @@ public class ShapesRenderer //matrices.mulPose(levelRenderState.cameraRenderState.); - blockEntityRenderer.submit(state, matrices,client.gameRenderer.featureRenderDispatcher().getSubmitNodeStorage(), levelRenderState.cameraRenderState); + blockEntityRenderer.submit(state, matrices,submitNodeStorage, levelRenderState.cameraRenderState); //blockEntityRenderer.submit(BlockEntity, partialTick, // matrices, light, OverlayTexture.NO_OVERLAY, camera1.getPosition(), null, client.gameRenderer.getFeatureRenderDispatcher().getSubmitNodeStorage()); @@ -492,14 +491,14 @@ public class ShapesRenderer final ItemStackRenderState itemState = new ItemStackRenderState(); client.getItemModelResolver().updateForTopItem(itemState, shape.item, ItemDisplayContext.FIXED, client.level, null, 0); - itemState.submit(matrices, client.gameRenderer.featureRenderDispatcher().getSubmitNodeStorage(), light, OverlayTexture.NO_OVERLAY, EntityRenderState.NO_OUTLINE); + itemState.submit(matrices, submitNodeStorage, light, OverlayTexture.NO_OVERLAY, EntityRenderState.NO_OUTLINE); //client.getItemRenderer().renderStatic(shape.item, transformType, light, // OverlayTexture.NO_OVERLAY, matrices, immediate, client.level, (int) shape.key(client.level.registryAccess())); } } matrices.popPose(); - immediate.uploadAndDraw(); + //immediate.uploadAndDraw(); ////RenderSystem.disableCull(); ////RenderSystem.disableDepthTest(); ////RenderSystem.depthMask(false); @@ -523,7 +522,7 @@ public class ShapesRenderer } @Override - public void renderLines(PoseStack matrices, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState, DrawableGizmoPrimitives primitives) + public void renderLines(PoseStack matrices, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState, DrawableGizmoPrimitives primitives, SubmitNodeStorage submitNodeStorage) { if (shape.a == 0.0) { @@ -575,22 +574,33 @@ public class ShapesRenderer } //try (ByteBufferBuilder bbb = new ByteBufferBuilder(RenderType.TRANSIENT_BUFFER_SIZE)) //{ - MultiBufferSource.BufferSource immediate = Minecraft.getInstance().gameRenderer.renderBuffers().bufferSource(); + //MultiBufferSource.BufferSource immediate = Minecraft.getInstance().gameRenderer.renderBuffers().bufferSource(); // text doesn't appear if backgroud is set ///script run draw_shape('label', 100, 'pos', [200, 100, 200], 'text', 'Hewwo World!', 'color', 0xffffffff, 'fill', 0x33333333) //textRenderer.drawInBatch(shape.value, text_x, 0.0F, shape.textcolor, false, matrices.last().pose(), immediate, Font.DisplayMode.SEE_THROUGH, shape.textbck, 15728880); final Font.PreparedText preparedText = textRenderer.prepareText(shape.value.getVisualOrderText(), text_x, 0.0F, shape.textcolor, false, false,0); - preparedText.visit(new Font.GlyphVisitor() { + + /*preparedText.visit(new Font.GlyphVisitor() { @Override public void acceptRenderable(final TextRenderable renderable) { - final VertexConsumer buffer = immediate.getBuffer(renderable.renderType(Font.DisplayMode.NORMAL)); + final VertexConsumer buffer = getVertexBuilder(renderable.renderType(Font.DisplayMode.NORMAL)); renderable.render(matrices.last().pose(), buffer, LightCoordsUtil.FULL_BRIGHT, false); } }); - immediate.uploadAndDraw(); + preparedText.visit(new Font.GlyphVisitor() { + @Override + public void acceptRenderable(final TextRenderable renderable) { + //final VertexConsumer buffer = immediate.getBuffer(renderable.renderType(Font.DisplayMode.NORMAL)); + renderable.render(matrices.last().pose(), buffer, LightCoordsUtil.FULL_BRIGHT, false); + } + }); + + */ + + //immediate.uploadAndDraw(); //} matrices.popPose(); ////RenderSystem.enableCull(); @@ -626,7 +636,7 @@ public class ShapesRenderer } @Override - public void renderLines(PoseStack matrices, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState, DrawableGizmoPrimitives primitives) + public void renderLines(PoseStack matrices, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState, DrawableGizmoPrimitives primitives, SubmitNodeStorage submitNodeStorage) { if (shape.a == 0.0) { @@ -670,7 +680,7 @@ public class ShapesRenderer } @Override - public void renderLines(PoseStack matrices, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState, DrawableGizmoPrimitives primitives) + public void renderLines(PoseStack matrices, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState, DrawableGizmoPrimitives primitives, SubmitNodeStorage submitNodeStorage) { Vec3 v1 = shape.relativiseRender(client.level, shape.from, partialTick); Vec3 v2 = shape.relativiseRender(client.level, shape.to, partialTick); @@ -685,8 +695,8 @@ public class ShapesRenderer public static class RenderedPolyface extends RenderedShape { // mode now can only be 4, 5, or 6 - private static final VertexFormat.Mode[] faceIndices = new VertexFormat.Mode[]{ - Mode.LINES, Mode.LINES, Mode.DEBUG_LINES, Mode.DEBUG_LINE_STRIP, Mode.TRIANGLES, Mode.TRIANGLE_STRIP, Mode.TRIANGLE_FAN, Mode.QUADS}; + //private static final VertexFormat.Mode[] faceIndices = new VertexFormat.Mode[]{ + // Mode.LINES, Mode.LINES, Mode.DEBUG_LINES, Mode.DEBUG_LINE_STRIP, Mode.TRIANGLES, Mode.TRIANGLE_STRIP, Mode.TRIANGLE_FAN, Mode.QUADS}; private static final RenderType [] renderTypes = new RenderType[] { RenderTypes.lines(), @@ -742,7 +752,7 @@ public class ShapesRenderer @Override public void renderLines(PoseStack matrices, double cx, double cy, - double cz, float partialTick, LevelRenderState levelRenderState, DrawableGizmoPrimitives primitives) + double cz, float partialTick, LevelRenderState levelRenderState, DrawableGizmoPrimitives primitives, SubmitNodeStorage submitNodeStorage) { if (shape.a == 0) { @@ -877,7 +887,7 @@ public class ShapesRenderer } @Override - public void renderLines(PoseStack matrices, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState, DrawableGizmoPrimitives primitives) + public void renderLines(PoseStack matrices, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState, DrawableGizmoPrimitives primitives, SubmitNodeStorage submitNodeStorage) { if (shape.a == 0.0) { @@ -913,7 +923,7 @@ public class ShapesRenderer } @Override - public void renderLines(PoseStack matrices, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState, DrawableGizmoPrimitives primitives) + public void renderLines(PoseStack matrices, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState, DrawableGizmoPrimitives primitives, SubmitNodeStorage submitNodeStorage) { if (shape.a == 0.0) { From 50cb5129644ab726a784f661ce920ac49ddb3913 Mon Sep 17 00:00:00 2001 From: gnembon Date: Sun, 10 May 2026 21:38:44 +0200 Subject: [PATCH 220/232] 26.2-beta-4 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 585f88cf..64240aa9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ org.gradle.configuration-cache=false loom_version=1.15-SNAPSHOT # Mod Properties - mod_version = 26.2-beta-3 + mod_version = 26.2-beta-4 maven_group = carpet archives_base_name = fabric-carpet From a06c78f3829c827583b2c82f63b44f4cbd1a232b Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 13 May 2026 15:34:25 +0200 Subject: [PATCH 221/232] 26.2-snap-7 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 64240aa9..c4ea4537 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ org.gradle.configuration-cache=false # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=26.2-snapshot-6 + minecraft_version=26.2-snapshot-7 loader_version=0.19.2 loom_version=1.15-SNAPSHOT From 45e7f29e8214b70d8ddb694e6dc8525c5e6a6613 Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 20 May 2026 21:58:06 +0200 Subject: [PATCH 222/232] 26.2-snap-8 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index c4ea4537..09edb315 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ org.gradle.configuration-cache=false # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=26.2-snapshot-7 + minecraft_version=26.2-snapshot-8 loader_version=0.19.2 loom_version=1.15-SNAPSHOT From 68f25ed9547135c6e5f708df711a1948e8bc34e8 Mon Sep 17 00:00:00 2001 From: jasonxue <103628493+jasonxue1@users.noreply.github.com> Date: Wed, 13 May 2026 00:49:32 +0800 Subject: [PATCH 223/232] Update mixin targets renamed by Mojang in 26.2-snap-5 Fixes #2187 --- src/main/java/carpet/mixins/ChunkAccess_warningsMixin.java | 2 +- .../java/carpet/mixins/WorldGenRegion_scarpetPlopMixin.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/carpet/mixins/ChunkAccess_warningsMixin.java b/src/main/java/carpet/mixins/ChunkAccess_warningsMixin.java index 2be7d8ed..85a11bd8 100644 --- a/src/main/java/carpet/mixins/ChunkAccess_warningsMixin.java +++ b/src/main/java/carpet/mixins/ChunkAccess_warningsMixin.java @@ -12,7 +12,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; public abstract class ChunkAccess_warningsMixin { // failed to mixin into interface. need to mixin in two places that uses it - @Inject(method = "markPosForPostprocessing(Lnet/minecraft/core/BlockPos;)V", + @Inject(method = "markPosForPostProcessing(Lnet/minecraft/core/BlockPos;)V", at =@At("HEAD"), cancellable = true) private void squashWarnings(BlockPos blockPos_1, CallbackInfo ci) { diff --git a/src/main/java/carpet/mixins/WorldGenRegion_scarpetPlopMixin.java b/src/main/java/carpet/mixins/WorldGenRegion_scarpetPlopMixin.java index 23bb45ec..a2cff9f7 100644 --- a/src/main/java/carpet/mixins/WorldGenRegion_scarpetPlopMixin.java +++ b/src/main/java/carpet/mixins/WorldGenRegion_scarpetPlopMixin.java @@ -11,7 +11,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(WorldGenRegion.class) public class WorldGenRegion_scarpetPlopMixin { - @Inject(method = "markPosForPostprocessing", at = @At("HEAD"), cancellable = true) + @Inject(method = "markPosForPostProcessing", at = @At("HEAD"), cancellable = true) private void markOrNot(BlockPos blockPos, CallbackInfo ci) { if (CarpetSettings.skipGenerationChecks.get()) ci.cancel(); From b3309f83cbf1bc1ddcc9b0deeae575eb56052848 Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 27 May 2026 21:59:43 +0200 Subject: [PATCH 224/232] 26.2-pre-1 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 09edb315..d9ef61be 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ org.gradle.configuration-cache=false # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=26.2-snapshot-8 + minecraft_version=26.2-pre-1 loader_version=0.19.2 loom_version=1.15-SNAPSHOT From ff37e4f9c44097c4d935211c9381ee52e547e5b4 Mon Sep 17 00:00:00 2001 From: gnembon Date: Tue, 9 Jun 2026 15:57:05 +0200 Subject: [PATCH 225/232] 26.2-pre-5 --- gradle.properties | 4 ++-- src/main/java/carpet/commands/PerimeterInfoCommand.java | 3 ++- src/main/java/carpet/script/api/Entities.java | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/gradle.properties b/gradle.properties index d9ef61be..dc3b6b46 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,8 +7,8 @@ org.gradle.configuration-cache=false # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=26.2-pre-1 - loader_version=0.19.2 + minecraft_version=26.2-pre-5 + loader_version=0.19.3 loom_version=1.15-SNAPSHOT # Mod Properties diff --git a/src/main/java/carpet/commands/PerimeterInfoCommand.java b/src/main/java/carpet/commands/PerimeterInfoCommand.java index 26966ae5..50206bfe 100644 --- a/src/main/java/carpet/commands/PerimeterInfoCommand.java +++ b/src/main/java/carpet/commands/PerimeterInfoCommand.java @@ -15,6 +15,7 @@ import net.minecraft.core.registries.Registries; import net.minecraft.nbt.CompoundTag; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntitySpawnReason; +import net.minecraft.world.entity.EntitySpawnRequest; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; @@ -55,7 +56,7 @@ public class PerimeterInfoCommand if (mobId != null) { nbttagcompound.putString("id", mobId); - Entity baseEntity = EntityType.loadEntityRecursive(nbttagcompound, source.getLevel(), EntitySpawnReason.COMMAND, (entity_1x) -> { + Entity baseEntity = EntityType.loadEntityRecursive(nbttagcompound, source.getLevel(), new EntitySpawnRequest(EntitySpawnReason.COMMAND, true), (entity_1x) -> { entity_1x.snapTo(new BlockPos(pos.getX(), source.getLevel().getMinY()-10, pos.getZ()), entity_1x.getYRot(), entity_1x. getXRot()); return !source.getLevel().addWithUUID(entity_1x) ? null : entity_1x; }); diff --git a/src/main/java/carpet/script/api/Entities.java b/src/main/java/carpet/script/api/Entities.java index afa28c93..5c290194 100644 --- a/src/main/java/carpet/script/api/Entities.java +++ b/src/main/java/carpet/script/api/Entities.java @@ -34,6 +34,7 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntitySelector; import net.minecraft.world.entity.EntitySpawnReason; +import net.minecraft.world.entity.EntitySpawnRequest; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.player.Player; @@ -142,7 +143,7 @@ public class Entities Vec3 vec3d = position.vec; ServerLevel serverWorld = cc.level(); - Entity entity = EntityType.loadEntityRecursive(tag, serverWorld, EntitySpawnReason.COMMAND, e -> { + Entity entity = EntityType.loadEntityRecursive(tag, serverWorld, new EntitySpawnRequest(EntitySpawnReason.COMMAND, true), e -> { e.snapTo(vec3d.x, vec3d.y, vec3d.z, e.getYRot(), e.getXRot()); return e; }); From 3b5940c208410e6d45b597aef06effb29848412a Mon Sep 17 00:00:00 2001 From: gnembon Date: Tue, 9 Jun 2026 15:57:40 +0200 Subject: [PATCH 226/232] 26.2-beta-5 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index dc3b6b46..bdc3265e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ org.gradle.configuration-cache=false loom_version=1.15-SNAPSHOT # Mod Properties - mod_version = 26.2-beta-4 + mod_version = 26.2-beta-5 maven_group = carpet archives_base_name = fabric-carpet From 0d2c21ada459c0027bed42cf1800ee4bd79974a3 Mon Sep 17 00:00:00 2001 From: altrisi Date: Tue, 16 Jun 2026 14:00:33 +0200 Subject: [PATCH 227/232] Push build error fix for eclipse Was sitting for ~1/2 year uncommitted --- src/main/java/carpet/script/api/Entities.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/carpet/script/api/Entities.java b/src/main/java/carpet/script/api/Entities.java index 5c290194..376a1a4c 100644 --- a/src/main/java/carpet/script/api/Entities.java +++ b/src/main/java/carpet/script/api/Entities.java @@ -178,7 +178,8 @@ public class Entities String who = lv.get(0).getString(); CommandSourceStack source = ((CarpetContext) c).source(); EntityValue.EntityClassDescriptor eDesc = EntityValue.getEntityDescriptor(who, source.getServer()); - List entityList = source.getLevel().getEntities(eDesc.directType, eDesc.filteringPredicate); + @SuppressWarnings("unchecked") // Eclipse's compiler finds an error if the cast isn't there (TODO report to ECJ) + List entityList = (List) source.getLevel().getEntities(eDesc.directType, eDesc.filteringPredicate); return ListValue.wrap(entityList.stream().map(EntityValue::new)); }); From b78995390042aa22bb241cf6f58a87ced771a719 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Tue, 16 Jun 2026 08:17:32 -0400 Subject: [PATCH 228/232] fix: drowned spawns not spawning in Ocean biomes (fixes #2147) (#2180) --- src/main/java/carpet/mixins/NaturalSpawnerMixin.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/carpet/mixins/NaturalSpawnerMixin.java b/src/main/java/carpet/mixins/NaturalSpawnerMixin.java index 7ab4f6f5..15f71ced 100644 --- a/src/main/java/carpet/mixins/NaturalSpawnerMixin.java +++ b/src/main/java/carpet/mixins/NaturalSpawnerMixin.java @@ -4,6 +4,8 @@ import carpet.CarpetSettings; import carpet.fakes.LevelInterface; import carpet.utils.SpawnReporter; import net.minecraft.world.entity.EntitySpawnReason; +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; import org.apache.commons.lang3.tuple.Pair; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; @@ -46,12 +48,12 @@ public class NaturalSpawnerMixin @Shadow @Final private static MobCategory[] SPAWNING_CATEGORIES; - @Redirect(method = "isValidSpawnPostitionForType", - at = @At( + @WrapOperation(method = "isValidSpawnPostitionForType", + at = @At( value = "INVOKE", target = "Lnet/minecraft/server/level/ServerLevel;noCollision(Lnet/minecraft/world/phys/AABB;)Z" )) - private static boolean doesNotCollide(ServerLevel world, AABB bb) + private static boolean doesNotCollide(ServerLevel world, AABB bb, Operation original) { //.doesNotCollide is VERY expensive. On the other side - most worlds are not made of trapdoors in // various configurations, but solid and 'passable' blocks, like air, water grass, etc. @@ -59,7 +61,7 @@ public class NaturalSpawnerMixin // in case something more complex happens - we default to full block collision check if (!CarpetSettings.lagFreeSpawning) { - return world.noCollision(bb); + return original.call(world, bb); } int minX = Mth.floor(bb.minX); int minY = Mth.floor(bb.minY); From 1618df9e8f0b12128200e5a7589441522a7d7f8f Mon Sep 17 00:00:00 2001 From: altrisi Date: Tue, 16 Jun 2026 14:20:07 +0200 Subject: [PATCH 229/232] Use wrapped call in other fallbacks to the original code --- src/main/java/carpet/mixins/NaturalSpawnerMixin.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/carpet/mixins/NaturalSpawnerMixin.java b/src/main/java/carpet/mixins/NaturalSpawnerMixin.java index 15f71ced..e142d2e0 100644 --- a/src/main/java/carpet/mixins/NaturalSpawnerMixin.java +++ b/src/main/java/carpet/mixins/NaturalSpawnerMixin.java @@ -82,7 +82,7 @@ public class NaturalSpawnerMixin } else { - return world.noCollision(bb); + return original.call(world, bb); } } } @@ -105,7 +105,7 @@ public class NaturalSpawnerMixin } else { - return world.noCollision(bb); + return original.call(world, bb); } } } @@ -125,7 +125,7 @@ public class NaturalSpawnerMixin ((block instanceof FenceGateBlock) && !state.getValue(FenceGateBlock.OPEN)) ) { - if (x == minX || x == maxX || z == minZ || z == maxZ) return world.noCollision(bb); + if (x == minX || x == maxX || z == minZ || z == maxZ) return original.call(world, bb); return false; } } @@ -137,7 +137,7 @@ public class NaturalSpawnerMixin value = "INVOKE", target = "Lnet/minecraft/world/entity/EntityType;create(Lnet/minecraft/world/level/Level;Lnet/minecraft/world/entity/EntitySpawnReason;)Lnet/minecraft/world/entity/Entity;" )) - private static Entity create(final EntityType entityType, final Level world_1, final EntitySpawnReason entitySpawnReason) + private static Entity create(final EntityType entityType, final Level world_1, final EntitySpawnReason entitySpawnReason) { if (CarpetSettings.lagFreeSpawning) { From bf55408ff52a29ca0a7c9497c239cc2989bb4381 Mon Sep 17 00:00:00 2001 From: HerobaneNair Date: Tue, 16 Jun 2026 08:43:05 -0500 Subject: [PATCH 230/232] Fixing isLocalInstanceAuthoritative and getKnownMovement for EntityPlayerMPFakes (#2176) Fixes: - At least some spear attacks - Mace attacks (not verified myself) - Fall damage (#2198) Possibly needs further checking that isLocalInstanceAuthoritative doesn't break other things, but I don't have the time right now. Co-authored-by: altrisi --- src/main/java/carpet/mixins/EntityMixin.java | 3 +- .../ServerPlayer_fakeLastMovementMixin.java | 33 +++++++++++++++++++ .../carpet/patches/EntityPlayerMPFake.java | 5 --- src/main/resources/carpet.mixins.json | 1 + 4 files changed, 36 insertions(+), 6 deletions(-) create mode 100644 src/main/java/carpet/mixins/ServerPlayer_fakeLastMovementMixin.java diff --git a/src/main/java/carpet/mixins/EntityMixin.java b/src/main/java/carpet/mixins/EntityMixin.java index 4c781b08..3574ada6 100644 --- a/src/main/java/carpet/mixins/EntityMixin.java +++ b/src/main/java/carpet/mixins/EntityMixin.java @@ -38,7 +38,8 @@ public abstract class EntityMixin implements EntityInterface @Inject(method = "isLocalInstanceAuthoritative", at = @At("HEAD"), cancellable = true) private void isFakePlayer(CallbackInfoReturnable cir) { - if (getControllingPassenger() instanceof EntityPlayerMPFake) cir.setReturnValue(!level.isClientSide()); + // getControllingPassenger() does not return the EntityPlayerMPFake if there are no passengers involved with it + if ((Object) this instanceof EntityPlayerMPFake || getControllingPassenger() instanceof EntityPlayerMPFake) cir.setReturnValue(!level.isClientSide()); } @Shadow diff --git a/src/main/java/carpet/mixins/ServerPlayer_fakeLastMovementMixin.java b/src/main/java/carpet/mixins/ServerPlayer_fakeLastMovementMixin.java new file mode 100644 index 00000000..ab12fa88 --- /dev/null +++ b/src/main/java/carpet/mixins/ServerPlayer_fakeLastMovementMixin.java @@ -0,0 +1,33 @@ +package carpet.mixins; + +import org.objectweb.asm.Opcodes; +import org.spongepowered.asm.mixin.Debug; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; + +import com.llamalad7.mixinextras.injector.ModifyExpressionValue; +import com.mojang.authlib.GameProfile; + +import carpet.patches.EntityPlayerMPFake; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.Vec3; + +@Mixin(ServerPlayer.class) +@Debug(export = true) +public abstract class ServerPlayer_fakeLastMovementMixin extends Player { + public ServerPlayer_fakeLastMovementMixin(Level level, GameProfile gameProfile) { + super(level, gameProfile); + throw new AssertionError(); + } + + @ModifyExpressionValue( + method = {"getKnownMovement", "getKnownSpeed"}, // both because ServerPlayer overrides both to the same "movement" field + at = @At(value = "FIELD", target = "lastKnownClientMovement", opcode = Opcodes.GETFIELD), + require = 2 + ) + private Vec3 bypassClientMovementInfo(Vec3 original) { + return ((Player)this) instanceof EntityPlayerMPFake ? super.getKnownMovement() : original; + } +} diff --git a/src/main/java/carpet/patches/EntityPlayerMPFake.java b/src/main/java/carpet/patches/EntityPlayerMPFake.java index 5db6d5ea..f136eef8 100644 --- a/src/main/java/carpet/patches/EntityPlayerMPFake.java +++ b/src/main/java/carpet/patches/EntityPlayerMPFake.java @@ -267,11 +267,6 @@ public class EntityPlayerMPFake extends ServerPlayer return CarpetSettings.allowListingFakePlayers; } - @Override - protected void checkFallDamage(double y, boolean onGround, BlockState state, BlockPos pos) { - doCheckFallDamage(0.0, y, 0.0, onGround); - } - @Override public ServerPlayer teleport(TeleportTransition serverLevel) { diff --git a/src/main/resources/carpet.mixins.json b/src/main/resources/carpet.mixins.json index 2b09a204..d9b7cf43 100644 --- a/src/main/resources/carpet.mixins.json +++ b/src/main/resources/carpet.mixins.json @@ -49,6 +49,7 @@ "MobMixin", "Villager_aiMixin", "Player_fakePlayersMixin", + "ServerPlayer_fakeLastMovementMixin", "TickRateManager_fakePlayersMixin", "ServerGamePacketListenerImpl_coreMixin", "MinecraftServer_scarpetMixin", From 4791cd886a8ad21a26291f5e75a9e7515535b65c Mon Sep 17 00:00:00 2001 From: altrisi Date: Tue, 16 Jun 2026 15:51:59 +0200 Subject: [PATCH 231/232] Bump minecraft version requirement in json --- src/main/resources/fabric.mod.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 6d808f17..f8b46d4f 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -33,7 +33,7 @@ "accessWidener" : "carpet.accesswidener", "depends": { - "minecraft": ">26.0", + "minecraft": ">26.1", "fabricloader": ">=0.18.3", "java": ">=25" } From dbedd4c91d4956c38874fe9509c48265f0afacf5 Mon Sep 17 00:00:00 2001 From: gnembon Date: Tue, 16 Jun 2026 22:31:33 +0200 Subject: [PATCH 232/232] 26.2 --- gradle.properties | 6 +++--- src/main/resources/fabric.mod.json | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gradle.properties b/gradle.properties index bdc3265e..e61fd155 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,12 +7,12 @@ org.gradle.configuration-cache=false # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=26.2-pre-5 + minecraft_version=26.2 loader_version=0.19.3 loom_version=1.15-SNAPSHOT # Mod Properties - mod_version = 26.2-beta-5 + mod_version = 26.2 maven_group = carpet archives_base_name = fabric-carpet @@ -20,7 +20,7 @@ org.gradle.configuration-cache=false # The Curseforge versions "names" or ids for the main branch (comma separated: 1.16.4,1.16.5) # This is needed because CF uses too vague names for prereleases and release candidates # Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN] - release-curse-versions = Minecraft 26:26.2-Snapshot + release-curse-versions = Minecraft 26:26.2 # Whether or not to build another branch on release release-extra-branch = false # The name of the second branch to release diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index f8b46d4f..b1338171 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -33,8 +33,8 @@ "accessWidener" : "carpet.accesswidener", "depends": { - "minecraft": ">26.1", - "fabricloader": ">=0.18.3", + "minecraft": ">=26.2", + "fabricloader": ">=0.19.3", "java": ">=25" } }