From 9fd313a672a5725bc5771362cdcaf507f340264d Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Mon, 6 May 2024 09:37:01 +0200 Subject: [PATCH 01/12] Update README.md --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index bb67e0936f..e4a03ab825 100644 --- a/README.md +++ b/README.md @@ -30,10 +30,6 @@ For core carpet functionality, this is the right place. Check available download Check [carpet-extra](https://github.com/gnembon/carpet-extra/) add-on mod for more whacky and crazy features, including autocrafting, block-placing dispensers, and even chicken-shearing! -## auto crafting table - -Due to compatibility issues with vanilla and other mods, download [auto crafting table](https://github.com/gnembon/carpet-autoCraftingTable/releases) by Skyrising as a separate add-on to carpet - ## scarpet app store If you want to browse or contribute to the scarpet app store check available apps, go [here](https://github.com/gnembon/scarpet), its free! From c4f8c865205b4f80a2d3eed5647841779e95bc8f Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Wed, 15 May 2024 23:13:40 +0200 Subject: [PATCH 02/12] 24w20a, disable reset_chunk, relight, and chunk load events --- gradle.properties | 2 +- .../carpet/fakes/ChunkHolderInterface.java | 2 +- .../ThreadedAnvilChunkStorageInterface.java | 8 ++--- .../carpet/mixins/AbstractArrowMixin.java | 4 +-- ...ChunkHolder_scarpetChunkCreationMixin.java | 6 ++-- .../ChunkMap_scarpetChunkCreationMixin.java | 33 +++++++++++++------ .../LevelRenderer_scarpetRenderMixin.java | 5 +-- .../mixins/PlayerList_scarpetEventsMixin.java | 7 ++-- .../ServerPlayer_scarpetEventMixin.java | 7 ++-- .../carpet/patches/EntityPlayerMPFake.java | 2 +- .../java/carpet/script/api/Auxiliary.java | 4 +++ .../java/carpet/script/api/WorldAccess.java | 8 +++-- .../java/carpet/script/external/Vanilla.java | 4 +-- 13 files changed, 60 insertions(+), 32 deletions(-) diff --git a/gradle.properties b/gradle.properties index 9217f17811..93d392c71d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=24w18a + minecraft_version=24w20a loader_version=0.15.11 jsr305_version=3.0.2 fabric_version=0.97.8+1.20.6 diff --git a/src/main/java/carpet/fakes/ChunkHolderInterface.java b/src/main/java/carpet/fakes/ChunkHolderInterface.java index d0c633b9ea..6c5464ac70 100644 --- a/src/main/java/carpet/fakes/ChunkHolderInterface.java +++ b/src/main/java/carpet/fakes/ChunkHolderInterface.java @@ -9,5 +9,5 @@ public interface ChunkHolderInterface { - CompletableFuture> setDefaultProtoChunk(ChunkPos chpos, BlockableEventLoop executor, ServerLevel world); + //CompletableFuture> setDefaultProtoChunk(ChunkPos chpos, BlockableEventLoop executor, ServerLevel world); } diff --git a/src/main/java/carpet/fakes/ThreadedAnvilChunkStorageInterface.java b/src/main/java/carpet/fakes/ThreadedAnvilChunkStorageInterface.java index fd1fa762f6..a46c128e2b 100644 --- a/src/main/java/carpet/fakes/ThreadedAnvilChunkStorageInterface.java +++ b/src/main/java/carpet/fakes/ThreadedAnvilChunkStorageInterface.java @@ -7,11 +7,11 @@ public interface ThreadedAnvilChunkStorageInterface { - Map regenerateChunkRegion(List requestedChunks); + //Map regenerateChunkRegion(List requestedChunks); - void relightChunk(ChunkPos pos); + //void relightChunk(ChunkPos pos); - void releaseRelightTicket(ChunkPos pos); + //void releaseRelightTicket(ChunkPos pos); - Iterable getChunksCM(); + //Iterable getChunksCM(); } diff --git a/src/main/java/carpet/mixins/AbstractArrowMixin.java b/src/main/java/carpet/mixins/AbstractArrowMixin.java index bf32429779..e30085978a 100644 --- a/src/main/java/carpet/mixins/AbstractArrowMixin.java +++ b/src/main/java/carpet/mixins/AbstractArrowMixin.java @@ -20,8 +20,8 @@ public abstract class AbstractArrowMixin extends Entity private TrajectoryLogHelper logHelper; public AbstractArrowMixin(EntityType entityType_1, Level world_1) { super(entityType_1, world_1); } - @Inject(method = "(Lnet/minecraft/world/entity/EntityType;Lnet/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 Level level, final ItemStack itemStack, final ItemStack weapon, final CallbackInfo ci) + @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) logHelper = new TrajectoryLogHelper("projectiles"); diff --git a/src/main/java/carpet/mixins/ChunkHolder_scarpetChunkCreationMixin.java b/src/main/java/carpet/mixins/ChunkHolder_scarpetChunkCreationMixin.java index da82d0dd8c..1727b83e73 100644 --- a/src/main/java/carpet/mixins/ChunkHolder_scarpetChunkCreationMixin.java +++ b/src/main/java/carpet/mixins/ChunkHolder_scarpetChunkCreationMixin.java @@ -21,10 +21,11 @@ @Mixin(ChunkHolder.class) public abstract class ChunkHolder_scarpetChunkCreationMixin implements ChunkHolderInterface { - @Shadow protected abstract void updateChunkToSave(CompletableFuture> newChunkFuture, String type); + //@Shadow protected abstract void updateChunkToSave(CompletableFuture> newChunkFuture, String type); - @Shadow @Final private AtomicReferenceArray>> futures; + //@Shadow @Final private AtomicReferenceArray>> futures; + /* @Override public CompletableFuture> setDefaultProtoChunk(ChunkPos chpos, BlockableEventLoop executor, ServerLevel world) { @@ -37,4 +38,5 @@ public CompletableFuture> setDefaultProtoChunk(ChunkPos futures.set(i, completableFuture2); return completableFuture2; } + */ } diff --git a/src/main/java/carpet/mixins/ChunkMap_scarpetChunkCreationMixin.java b/src/main/java/carpet/mixins/ChunkMap_scarpetChunkCreationMixin.java index ff7e9a3d5b..fc300dbbb5 100644 --- a/src/main/java/carpet/mixins/ChunkMap_scarpetChunkCreationMixin.java +++ b/src/main/java/carpet/mixins/ChunkMap_scarpetChunkCreationMixin.java @@ -19,6 +19,7 @@ import net.minecraft.server.MinecraftServer; import net.minecraft.server.TickTask; import net.minecraft.server.level.ChunkHolder; +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; @@ -64,10 +65,6 @@ public abstract class ChunkMap_scarpetChunkCreationMixin implements ThreadedAnvi @Final private ServerLevel level; - @Shadow - @Final - private LongSet entitiesInLevel; - @Shadow @Final private Long2ObjectLinkedOpenHashMap updatingChunkMap; @@ -111,6 +108,10 @@ public abstract class ChunkMap_scarpetChunkCreationMixin implements ThreadedAnvi // in protoChunkToFullChunk // fancier version of the one below, ensuring that the event is triggered when the chunk is actually loaded. + + /* + + @Inject(method = "method_17227", at = @At("HEAD"), remap = false) private void onChunkGeneratedStart(ChunkHolder chunkHolder, ChunkAccess chunkAccess, CallbackInfoReturnable cir) { @@ -146,6 +147,8 @@ private void onChunkGeneratedEnd(ChunkHolder chunkHolder, ChunkAccess chunk, Cal } } + */ + /* simple but a version that doesn't guarantee that the chunk is actually loaded @Inject(method = "convertToFullChunk", at = @At("HEAD")) private void onChunkGeneratedEnd(ChunkHolder chunkHolder, CallbackInfoReturnable>> cir) @@ -167,7 +170,7 @@ private void onChunkGeneratedEnd(ChunkHolder chunkHolder, CallbackInfoReturnable @Unique private void addTicket(ChunkPos pos, ChunkStatus status) { // UNKNOWN - this.distanceManager.addTicket(TicketType.UNKNOWN, pos, 33 + ChunkStatus.getDistance(status), pos); + this.distanceManager.addTicket(TicketType.UNKNOWN, pos, 33 + ChunkLevel.byStatus(status), pos); } @Unique @@ -176,6 +179,8 @@ private void addTicket(ChunkPos pos) this.addTicket(pos, ChunkStatus.EMPTY); } + + /* @Unique private void addRelightTicket(ChunkPos pos) { @@ -190,7 +195,7 @@ public void releaseRelightTicket(ChunkPos pos) () -> "release relight ticket " + pos )); } - + */ @Unique private void tickTicketManager() { @@ -214,6 +219,8 @@ private Set getExistingChunks(Set requestedChunks) return ret; } + + /* @Unique private Set loadExistingChunksFromDisk(Set requestedChunks) { @@ -329,6 +336,8 @@ public void relightChunk(ChunkPos pos) this.waitFor(lightFuture); } + /* + @Override public Map regenerateChunkRegion(List requestedChunksList) { @@ -385,7 +394,7 @@ public Map regenerateChunkRegion(List requestedChunks { ChunkAccess chunk = this.getCurrentChunk(pos); - if (chunk.getStatus().isOrAfter(ChunkStatus.LIGHT.getParent())) + if (chunk.getPersistedStatus().isOrAfter(ChunkStatus.LIGHT.getParent())) { affectedNeighbors.add(chunk); } @@ -399,7 +408,7 @@ public Map regenerateChunkRegion(List requestedChunks // remove entities long longPos = pos.toLong(); - if (this.entitiesInLevel.contains(longPos) && chunk instanceof LevelChunk) + if (chunk instanceof LevelChunk) { ((SimpleEntityLookupInterface) ((ServerWorldInterface) level).getEntityLookupCMPublic()).getChunkEntities(pos).forEach(entity -> { if (!(entity instanceof Player)) @@ -415,7 +424,7 @@ public Map regenerateChunkRegion(List requestedChunks ((LevelChunk) chunk).setLoaded(false); } - if (this.entitiesInLevel.remove(pos.toLong()) && chunk instanceof LevelChunk) + if (chunk instanceof LevelChunk) { this.level.unload((LevelChunk) chunk); // block entities only } @@ -450,7 +459,7 @@ public Map regenerateChunkRegion(List requestedChunks // Also, this is needed to ensure chunks are saved to disk Map targetGenerationStatus = affectedChunks.stream().collect( - Collectors.toMap(ChunkAccess::getPos, ChunkAccess::getStatus) + Collectors.toMap(ChunkAccess::getPos, ChunkAccess::getPersistedStatus) ); for (Entry entry : targetGenerationStatus.entrySet()) @@ -548,9 +557,13 @@ public Map regenerateChunkRegion(List requestedChunks return report; } + + @Override public Iterable getChunksCM() { return getChunks(); } + + */ } diff --git a/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java b/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java index 67119c30d7..f2a71f2b87 100644 --- a/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java +++ b/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java @@ -4,6 +4,7 @@ import carpet.script.utils.ShapesRenderer; import com.mojang.blaze3d.vertex.PoseStack; 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.LevelRenderer; @@ -36,14 +37,14 @@ private void addRenderers(Minecraft minecraft, EntityRenderDispatcher entityRend //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(float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightmapTextureManager, Matrix4f modelViewMatrix, Matrix4f matrix4f, CallbackInfo ci) + private void renderScarpetThings(final DeltaTracker deltaTracker, final boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightmapTextureManager, Matrix4f modelViewMatrix, Matrix4f matrix4f, 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, tickDelta); + CarpetClient.shapes.render(modelViewMatrix, camera, deltaTracker.getGameTimeDeltaPartialTick(false)); } } } diff --git a/src/main/java/carpet/mixins/PlayerList_scarpetEventsMixin.java b/src/main/java/carpet/mixins/PlayerList_scarpetEventsMixin.java index 0619221560..8178a76aef 100644 --- a/src/main/java/carpet/mixins/PlayerList_scarpetEventsMixin.java +++ b/src/main/java/carpet/mixins/PlayerList_scarpetEventsMixin.java @@ -7,6 +7,7 @@ import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.players.PlayerList; +import net.minecraft.world.entity.Entity; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -24,9 +25,9 @@ public class PlayerList_scarpetEventsMixin @Shadow @Final private MinecraftServer server; @Inject(method = "respawn", at = @At("HEAD")) - private void onRespawn(ServerPlayer player, boolean olive, CallbackInfoReturnable cir) + private void onResp(ServerPlayer serverPlayer, boolean olive, Entity.RemovalReason removalReason, CallbackInfoReturnable cir) { - PLAYER_RESPAWNS.onPlayerEvent(player); + PLAYER_RESPAWNS.onPlayerEvent(serverPlayer); } @Inject(method = "broadcastChatMessage(Lnet/minecraft/network/chat/PlayerChatMessage;Lnet/minecraft/server/level/ServerPlayer;Lnet/minecraft/network/chat/ChatType$Bound;)V", @@ -44,7 +45,7 @@ private void cancellableChatMessageEvent(PlayerChatMessage message, ServerPlayer value = "INVOKE", target = "Lnet/minecraft/server/level/ServerPlayer;initInventoryMenu()V" )) - private void invalidatePreviousInstance(ServerPlayer player, boolean alive, CallbackInfoReturnable cir) + private void invalidatePreviousInstance(ServerPlayer player, boolean alive, Entity.RemovalReason removalReason, CallbackInfoReturnable cir) { ((ServerPlayerInterface)player).invalidateEntityObjectReference(); } diff --git a/src/main/java/carpet/mixins/ServerPlayer_scarpetEventMixin.java b/src/main/java/carpet/mixins/ServerPlayer_scarpetEventMixin.java index afba6cde38..1c04d02d54 100644 --- a/src/main/java/carpet/mixins/ServerPlayer_scarpetEventMixin.java +++ b/src/main/java/carpet/mixins/ServerPlayer_scarpetEventMixin.java @@ -14,6 +14,7 @@ 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.phys.Vec3; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -96,18 +97,20 @@ private void setSneakingConditionally(ServerPlayer serverPlayerEntity, boolean s private ResourceKey previousDimension; @Inject(method = "changeDimension", at = @At("HEAD")) - private void logPreviousCoordinates(ServerLevel serverWorld, CallbackInfoReturnable cir) + private void logPreviousCoordinates(DimensionTransitionSupplier serverWorld, CallbackInfoReturnable cir) { previousLocation = position(); previousDimension = level().dimension(); //dimension type } @Inject(method = "changeDimension", at = @At("RETURN")) - private void atChangeDimension(ServerLevel destination, CallbackInfoReturnable cir) + private void atChangeDimension(DimensionTransitionSupplier destinationP, CallbackInfoReturnable cir) { if (PLAYER_CHANGES_DIMENSION.isNeeded()) { ServerPlayer player = (ServerPlayer) (Object)this; + DimensionTransition destinationTransition = destinationP.get(); + ServerLevel destination = destinationTransition.newDimension(); 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 563d1a3ad0..55fb563382 100644 --- a/src/main/java/carpet/patches/EntityPlayerMPFake.java +++ b/src/main/java/carpet/patches/EntityPlayerMPFake.java @@ -213,7 +213,7 @@ protected void checkFallDamage(double y, boolean onGround, BlockState state, Blo } @Override - public Entity changeDimension(ServerLevel serverLevel) + public Entity changeDimension(DimensionTransitionSupplier serverLevel) { super.changeDimension(serverLevel); if (wonGame) { diff --git a/src/main/java/carpet/script/api/Auxiliary.java b/src/main/java/carpet/script/api/Auxiliary.java index 8d917113ec..ca3c22b49f 100644 --- a/src/main/java/carpet/script/api/Auxiliary.java +++ b/src/main/java/carpet/script/api/Auxiliary.java @@ -804,6 +804,8 @@ else if (!interactable && targetBlock == null) expression.addContextFunction("relight", -1, (c, t, lv) -> { + return Value.NULL; + /* CarpetContext cc = (CarpetContext) c; BlockArgument locator = BlockArgument.findIn(cc, lv, 0); BlockPos pos = locator.block.getPos(); @@ -811,6 +813,8 @@ else if (!interactable && targetBlock == null) Vanilla.ChunkMap_relightChunk(world.getChunkSource().chunkMap, new ChunkPos(pos)); WorldTools.forceChunkUpdate(pos, world); return Value.TRUE; + + */ }); // Should this be deprecated for system_info('source_dimension')? diff --git a/src/main/java/carpet/script/api/WorldAccess.java b/src/main/java/carpet/script/api/WorldAccess.java index 8fb2c09b59..ae60ed0d99 100644 --- a/src/main/java/carpet/script/api/WorldAccess.java +++ b/src/main/java/carpet/script/api/WorldAccess.java @@ -637,7 +637,7 @@ else if (!("any".equals(statusString))) forceLoad = lv.get(blockArgument.offset).getBoolean(); } ChunkAccess chunk = ((CarpetContext) c).level().getChunk(pos.getX() >> 4, pos.getZ() >> 4, ChunkStatus.EMPTY, forceLoad); - return chunk == null ? Value.NULL : ValueConversions.of(BuiltInRegistries.CHUNK_STATUS.getKey(chunk.getStatus())); + return chunk == null ? Value.NULL : ValueConversions.of(BuiltInRegistries.CHUNK_STATUS.getKey(chunk.getPersistedStatus())); }); expression.addContextFunction("chunk_tickets", -1, (c, t, lv) -> @@ -921,7 +921,7 @@ else if (item instanceof TridentItem || item instanceof SwordItem) damageAmount = 2; } final int finalDamageAmount = damageAmount; - tool.hurtAndBreak(damageAmount, world, null, () -> { if (finalDamageAmount > 0) toolBroke.setTrue(); } ); + tool.hurtAndBreak(damageAmount, world, null, (i) -> { if (finalDamageAmount > 0) toolBroke.setTrue(); } ); if (!isUsingEffectiveTool) { dropLoot = false; @@ -1586,6 +1586,8 @@ LivingEntity getIndirectSourceEntity() // todo maybe enable chunk blending? expression.addContextFunction("reset_chunk", -1, (c, t, lv) -> { + return Value.NULL; + /* CarpetContext cc = (CarpetContext) c; List requestedChunks = new ArrayList<>(); if (lv.size() == 1) @@ -1643,6 +1645,8 @@ LivingEntity getIndirectSourceEntity() ))); }); return result[0]; + + */ }); expression.addContextFunction("inhabited_time", -1, (c, t, lv) -> diff --git a/src/main/java/carpet/script/external/Vanilla.java b/src/main/java/carpet/script/external/Vanilla.java index 75ee9ab952..76d2508bba 100644 --- a/src/main/java/carpet/script/external/Vanilla.java +++ b/src/main/java/carpet/script/external/Vanilla.java @@ -100,12 +100,12 @@ public static void MinecraftServer_forceTick(MinecraftServer server, BooleanSupp public static void ChunkMap_relightChunk(ChunkMap chunkMap, ChunkPos pos) { - ((ThreadedAnvilChunkStorageInterface) chunkMap).relightChunk(pos); + //((ThreadedAnvilChunkStorageInterface) chunkMap).relightChunk(pos); } public static Map ChunkMap_regenerateChunkRegion(ChunkMap chunkMap, List requestedChunks) { - return ((ThreadedAnvilChunkStorageInterface) chunkMap).regenerateChunkRegion(requestedChunks); + return Map.of(); //return ((ThreadedAnvilChunkStorageInterface) chunkMap).regenerateChunkRegion(requestedChunks); } public static List> Ingredient_getRecipeStacks(Ingredient ingredient) From 9f29f81a7dcf7d376b19b960f8d07204f1bbdfcb Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Wed, 15 May 2024 23:17:32 +0200 Subject: [PATCH 03/12] 1.4.143 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 93d392c71d..54f0502558 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G fabric_version=0.97.8+1.20.6 # Mod Properties - mod_version = 1.4.142 + mod_version = 1.4.143 maven_group = carpet archives_base_name = fabric-carpet From dd1813c917c11df12916d6133e9247ebb419660b Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Wed, 15 May 2024 23:20:53 +0200 Subject: [PATCH 04/12] unsure why this worked --- .../ThreadedLevelLightEngine_scarpetChunkCreationMixin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/carpet/mixins/ThreadedLevelLightEngine_scarpetChunkCreationMixin.java b/src/main/java/carpet/mixins/ThreadedLevelLightEngine_scarpetChunkCreationMixin.java index 964fa8edac..9e79275618 100644 --- a/src/main/java/carpet/mixins/ThreadedLevelLightEngine_scarpetChunkCreationMixin.java +++ b/src/main/java/carpet/mixins/ThreadedLevelLightEngine_scarpetChunkCreationMixin.java @@ -88,7 +88,7 @@ public CompletableFuture relight(ChunkAccess chunk) return CompletableFuture.runAsync( Util.name(() -> { chunk.setLightCorrect(true); - ((ThreadedAnvilChunkStorageInterface) this.chunkMap).releaseRelightTicket(pos); + //((ThreadedAnvilChunkStorageInterface) this.chunkMap).releaseRelightTicket(pos); }, () -> "Release relight ticket " + pos ), From 7a1e152229a2273f90568c9aea76b5d7c20c8cad Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Thu, 16 May 2024 08:55:50 +0200 Subject: [PATCH 05/12] infer release target from minecraft mod container --- src/main/java/carpet/CarpetSettings.java | 6 +++++- src/main/java/carpet/script/external/Vanilla.java | 3 +-- src/main/java/carpet/script/utils/SystemInfo.java | 14 +++++--------- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/main/java/carpet/CarpetSettings.java b/src/main/java/carpet/CarpetSettings.java index 8b83e45416..61253d59d6 100644 --- a/src/main/java/carpet/CarpetSettings.java +++ b/src/main/java/carpet/CarpetSettings.java @@ -10,6 +10,7 @@ import carpet.utils.CommandHelper; import carpet.utils.Messenger; import net.fabricmc.loader.api.FabricLoader; +import net.fabricmc.loader.api.SemanticVersion; import net.minecraft.commands.CommandSourceStack; import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceLocation; @@ -48,7 +49,10 @@ public class CarpetSettings { public static final String carpetVersion = FabricLoader.getInstance().getModContainer("carpet").orElseThrow().getMetadata().getVersion().toString(); - public static final String releaseTarget = "1.20.5"; + public static final int [] releaseTarget = { + ((SemanticVersion)FabricLoader.getInstance().getModContainer("minecraft").orElseThrow().getMetadata().getVersion()).getVersionComponent(1), + ((SemanticVersion)FabricLoader.getInstance().getModContainer("minecraft").orElseThrow().getMetadata().getVersion()).getVersionComponent(2) + }; public static final Logger LOG = LoggerFactory.getLogger("carpet"); public static final ThreadLocal skipGenerationChecks = ThreadLocal.withInitial(() -> false); public static final ThreadLocal impendingFillSkipUpdates = ThreadLocal.withInitial(() -> false); diff --git a/src/main/java/carpet/script/external/Vanilla.java b/src/main/java/carpet/script/external/Vanilla.java index 76d2508bba..f046ae623c 100644 --- a/src/main/java/carpet/script/external/Vanilla.java +++ b/src/main/java/carpet/script/external/Vanilla.java @@ -183,8 +183,7 @@ public static int MinecraftServer_getRunPermissionLevel(MinecraftServer server) return CarpetSettings.runPermissionLevel; } - @Deprecated - public static String MinecraftServer_getReleaseTarget(MinecraftServer server) + public static int [] MinecraftServer_getReleaseTarget(MinecraftServer server) { return CarpetSettings.releaseTarget; } diff --git a/src/main/java/carpet/script/utils/SystemInfo.java b/src/main/java/carpet/script/utils/SystemInfo.java index 7a0d5e77ab..0174d904a9 100644 --- a/src/main/java/carpet/script/utils/SystemInfo.java +++ b/src/main/java/carpet/script/utils/SystemInfo.java @@ -84,16 +84,12 @@ public class SystemInfo put("game_view_distance", c -> new NumericValue(c.server().getPlayerList().getViewDistance())); put("game_mod_name", c -> StringValue.of(c.server().getServerModName())); put("game_version", c -> StringValue.of(c.server().getServerVersion())); - put("game_target", c -> StringValue.of(Vanilla.MinecraftServer_getReleaseTarget(c.server()))); + put("game_target", c -> StringValue.of(String.format("1.%d.%d", + Vanilla.MinecraftServer_getReleaseTarget(c.server())[0], + Vanilla.MinecraftServer_getReleaseTarget(c.server())[1]))); put("game_protocol", c -> NumericValue.of(SharedConstants.getProtocolVersion())); - put("game_major_target", c -> { - String[] vers = Vanilla.MinecraftServer_getReleaseTarget(c.server()).split("\\."); - return NumericValue.of((vers.length > 1) ? Integer.parseInt(vers[1]) : 0); - }); - put("game_minor_target", c -> { - String[] vers = Vanilla.MinecraftServer_getReleaseTarget(c.server()).split("\\."); - return NumericValue.of((vers.length > 2) ? Integer.parseInt(vers[2]) : 0); - }); + 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))); From 9e578e6cc9a019558e49bc1668bb87d3e2eb7ab5 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Wed, 22 May 2024 22:34:21 +0200 Subject: [PATCH 06/12] 24w21a - broken shapes --- gradle.properties | 2 +- .../fakes/PortalProcessorInterface.java | 6 + ...nPacketListenerImpl_customPacketMixin.java | 3 +- .../mixins/Entity_scarpetEventsMixin.java | 9 +- .../mixins/LivingEntity_creativeFlyMixin.java | 9 + .../mixins/PortalProcessor_scarpetMixin.java | 19 + ...erverGamePacketListenerImpl_coreMixin.java | 5 +- .../ServerPlayer_scarpetEventMixin.java | 8 +- ...atewayBlockEntity_creativeNoClipMixin.java | 6 +- .../java/carpet/network/CarpetClient.java | 2 +- .../carpet/patches/EntityPlayerMPFake.java | 8 +- .../script/command/CommandArgument.java | 2 +- .../carpet/script/utils/FeatureGenerator.java | 4 +- .../carpet/script/utils/InputValidator.java | 2 +- .../carpet/script/utils/ShapeDispatcher.java | 2 +- .../carpet/script/utils/ShapesRenderer.java | 419 +++++++++--------- .../carpet/script/value/ValueConversions.java | 2 +- src/main/resources/carpet.mixins.json | 1 + 18 files changed, 274 insertions(+), 235 deletions(-) create mode 100644 src/main/java/carpet/fakes/PortalProcessorInterface.java create mode 100644 src/main/java/carpet/mixins/PortalProcessor_scarpetMixin.java diff --git a/gradle.properties b/gradle.properties index 54f0502558..d94f53dc40 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=24w20a + minecraft_version=24w21a loader_version=0.15.11 jsr305_version=3.0.2 fabric_version=0.97.8+1.20.6 diff --git a/src/main/java/carpet/fakes/PortalProcessorInterface.java b/src/main/java/carpet/fakes/PortalProcessorInterface.java new file mode 100644 index 0000000000..284798e32f --- /dev/null +++ b/src/main/java/carpet/fakes/PortalProcessorInterface.java @@ -0,0 +1,6 @@ +package carpet.fakes; + +public interface PortalProcessorInterface +{ + void setPortalTime(int time); +} diff --git a/src/main/java/carpet/mixins/ClientCommonPacketListenerImpl_customPacketMixin.java b/src/main/java/carpet/mixins/ClientCommonPacketListenerImpl_customPacketMixin.java index 3cd91bf68d..c41fd42826 100644 --- a/src/main/java/carpet/mixins/ClientCommonPacketListenerImpl_customPacketMixin.java +++ b/src/main/java/carpet/mixins/ClientCommonPacketListenerImpl_customPacketMixin.java @@ -2,6 +2,7 @@ import carpet.network.CarpetClient; import net.minecraft.client.multiplayer.ClientCommonPacketListenerImpl; +import net.minecraft.network.DisconnectionDetails; import net.minecraft.network.chat.Component; import net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket; import org.spongepowered.asm.mixin.Mixin; @@ -13,7 +14,7 @@ public class ClientCommonPacketListenerImpl_customPacketMixin { @Inject(method = "onDisconnect", at = @At("HEAD")) - private void onCMDisconnected(Component reason, CallbackInfo ci) + private void onCMDisconnected(DisconnectionDetails reason, CallbackInfo ci) { CarpetClient.disconnect(); } diff --git a/src/main/java/carpet/mixins/Entity_scarpetEventsMixin.java b/src/main/java/carpet/mixins/Entity_scarpetEventsMixin.java index 7a576b466c..ea70b6b99f 100644 --- a/src/main/java/carpet/mixins/Entity_scarpetEventsMixin.java +++ b/src/main/java/carpet/mixins/Entity_scarpetEventsMixin.java @@ -1,9 +1,12 @@ package carpet.mixins; import carpet.fakes.EntityInterface; +import carpet.fakes.PortalProcessorInterface; import carpet.script.EntityEventsGroup; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.PortalProcessor; import net.minecraft.world.phys.Vec3; +import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -15,13 +18,13 @@ public abstract class Entity_scarpetEventsMixin implements EntityInterface { //@Shadow public boolean removed; - @Shadow protected int portalTime; @Shadow private int portalCooldown; @Shadow public abstract boolean isRemoved(); @Shadow private Vec3 position, deltaMovement; + @Shadow @Nullable public PortalProcessor portalProcess; private boolean permanentVehicle; private final EntityEventsGroup events = new EntityEventsGroup((Entity) (Object)this); @@ -61,13 +64,13 @@ public void setPublicNetherPortalCooldown(int what) @Override public int getPortalTimer() { - return portalTime; + return portalProcess.getPortalTime(); } @Override public void setPortalTimer(int amount) { - portalTime = amount; + ((PortalProcessorInterface)portalProcess).setPortalTime(amount); } @Inject(method = "tick", at = @At("HEAD")) diff --git a/src/main/java/carpet/mixins/LivingEntity_creativeFlyMixin.java b/src/main/java/carpet/mixins/LivingEntity_creativeFlyMixin.java index e34908382c..b84b2ade02 100644 --- a/src/main/java/carpet/mixins/LivingEntity_creativeFlyMixin.java +++ b/src/main/java/carpet/mixins/LivingEntity_creativeFlyMixin.java @@ -1,6 +1,7 @@ package carpet.mixins; import carpet.CarpetSettings; +import carpet.patches.EntityPlayerMPFake; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; @@ -47,4 +48,12 @@ private void flyingAltSpeed(float slipperiness, CallbackInfoReturnable ci cir.setReturnValue( getFlyingSpeed() * (float)CarpetSettings.creativeFlySpeed); } } + + @Inject(method = "canChangeDimensions", at = @At("HEAD"), cancellable = true) + private void canChangeDimensions(CallbackInfoReturnable cir) + { + if (CarpetSettings.isCreativeFlying(this)) { + cir.setReturnValue(false); + } + } } diff --git a/src/main/java/carpet/mixins/PortalProcessor_scarpetMixin.java b/src/main/java/carpet/mixins/PortalProcessor_scarpetMixin.java new file mode 100644 index 0000000000..197a497941 --- /dev/null +++ b/src/main/java/carpet/mixins/PortalProcessor_scarpetMixin.java @@ -0,0 +1,19 @@ +package carpet.mixins; + +import carpet.fakes.PortalProcessorInterface; +import net.minecraft.world.entity.PortalProcessor; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; + +@Mixin(PortalProcessor.class) +public class PortalProcessor_scarpetMixin implements PortalProcessorInterface +{ + + @Shadow private int portalTime; + + @Override + public void setPortalTime(int time) + { + portalTime = time; + } +} diff --git a/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_coreMixin.java b/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_coreMixin.java index 4935d30e6a..b0ddb00e49 100644 --- a/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_coreMixin.java +++ b/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_coreMixin.java @@ -3,6 +3,7 @@ import carpet.CarpetServer; import carpet.fakes.ServerGamePacketListenerImplInterface; import net.minecraft.network.Connection; +import net.minecraft.network.DisconnectionDetails; import net.minecraft.network.chat.Component; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; @@ -26,8 +27,8 @@ public ServerGamePacketListenerImpl_coreMixin(final MinecraftServer minecraftSer } @Inject(method = "onDisconnect", at = @At("HEAD")) - private void onPlayerDisconnect(Component reason, CallbackInfo ci) { - CarpetServer.onPlayerLoggedOut(this.player, reason); + private void onPlayerDisconnect(DisconnectionDetails reason, CallbackInfo ci) { + CarpetServer.onPlayerLoggedOut(this.player, reason.reason()); } @Override diff --git a/src/main/java/carpet/mixins/ServerPlayer_scarpetEventMixin.java b/src/main/java/carpet/mixins/ServerPlayer_scarpetEventMixin.java index 1c04d02d54..15531f170c 100644 --- a/src/main/java/carpet/mixins/ServerPlayer_scarpetEventMixin.java +++ b/src/main/java/carpet/mixins/ServerPlayer_scarpetEventMixin.java @@ -97,20 +97,20 @@ private void setSneakingConditionally(ServerPlayer serverPlayerEntity, boolean s private ResourceKey previousDimension; @Inject(method = "changeDimension", at = @At("HEAD")) - private void logPreviousCoordinates(DimensionTransitionSupplier serverWorld, CallbackInfoReturnable cir) + private void logPreviousCoordinates(DimensionTransition serverWorld, CallbackInfoReturnable cir) { previousLocation = position(); previousDimension = level().dimension(); //dimension type } @Inject(method = "changeDimension", at = @At("RETURN")) - private void atChangeDimension(DimensionTransitionSupplier destinationP, CallbackInfoReturnable cir) + private void atChangeDimension(DimensionTransition destinationP, CallbackInfoReturnable cir) { if (PLAYER_CHANGES_DIMENSION.isNeeded()) { ServerPlayer player = (ServerPlayer) (Object)this; - DimensionTransition destinationTransition = destinationP.get(); - ServerLevel destination = destinationTransition.newDimension(); + DimensionTransition 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/mixins/TheEndGatewayBlockEntity_creativeNoClipMixin.java b/src/main/java/carpet/mixins/TheEndGatewayBlockEntity_creativeNoClipMixin.java index 635269db79..a1d9f6903d 100644 --- a/src/main/java/carpet/mixins/TheEndGatewayBlockEntity_creativeNoClipMixin.java +++ b/src/main/java/carpet/mixins/TheEndGatewayBlockEntity_creativeNoClipMixin.java @@ -11,9 +11,5 @@ @Mixin(TheEndGatewayBlockEntity.class) public class TheEndGatewayBlockEntity_creativeNoClipMixin { - @Inject(method = "canEntityTeleport", cancellable = true, at = @At("HEAD")) - private static void checkFlyingCreative(Entity entity, CallbackInfoReturnable cir) - { - if (CarpetSettings.isCreativeFlying(entity)) cir.setReturnValue(false); - } + // removeme } diff --git a/src/main/java/carpet/network/CarpetClient.java b/src/main/java/carpet/network/CarpetClient.java index 59f7f1d4ab..91622bd518 100644 --- a/src/main/java/carpet/network/CarpetClient.java +++ b/src/main/java/carpet/network/CarpetClient.java @@ -45,7 +45,7 @@ public void write(FriendlyByteBuf output) private static LocalPlayer clientPlayer = null; private static boolean isServerCarpet = false; public static String serverCarpetVersion; - public static final ResourceLocation CARPET_CHANNEL = new ResourceLocation("carpet", "hello"); + public static final ResourceLocation CARPET_CHANNEL = ResourceLocation.fromNamespaceAndPath("carpet", "hello"); public static void gameJoined(LocalPlayer player) { diff --git a/src/main/java/carpet/patches/EntityPlayerMPFake.java b/src/main/java/carpet/patches/EntityPlayerMPFake.java index 55fb563382..b3d5d0cc27 100644 --- a/src/main/java/carpet/patches/EntityPlayerMPFake.java +++ b/src/main/java/carpet/patches/EntityPlayerMPFake.java @@ -4,6 +4,7 @@ import com.mojang.authlib.GameProfile; import net.minecraft.core.BlockPos; import net.minecraft.core.UUIDUtil; +import net.minecraft.network.DisconnectionDetails; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.contents.TranslatableContents; import net.minecraft.network.protocol.PacketFlow; @@ -30,6 +31,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.DimensionTransition; import net.minecraft.world.phys.Vec3; import carpet.fakes.ServerPlayerInterface; import carpet.utils.Messenger; @@ -147,10 +149,10 @@ public void kill(Component reason) shakeOff(); if (reason.getContents() instanceof TranslatableContents text && text.getKey().equals("multiplayer.disconnect.duplicate_login")) { - this.connection.onDisconnect(reason); + this.connection.onDisconnect(new DisconnectionDetails(reason)); } else { this.server.tell(new TickTask(this.server.getTickCount(), () -> { - this.connection.onDisconnect(reason); + this.connection.onDisconnect(new DisconnectionDetails(reason)); })); } } @@ -213,7 +215,7 @@ protected void checkFallDamage(double y, boolean onGround, BlockState state, Blo } @Override - public Entity changeDimension(DimensionTransitionSupplier serverLevel) + public Entity changeDimension(DimensionTransition serverLevel) { super.changeDimension(serverLevel); if (wonGame) { diff --git a/src/main/java/carpet/script/command/CommandArgument.java b/src/main/java/carpet/script/command/CommandArgument.java index c34b54c76b..5d0fbabe28 100644 --- a/src/main/java/carpet/script/command/CommandArgument.java +++ b/src/main/java/carpet/script/command/CommandArgument.java @@ -890,7 +890,7 @@ protected void configure(Map config, CarpetScriptHost host) throw { throw error("Custom sting type requires options passed as a list" + " for custom type " + suffix); } - validOptions = ((ListValue) optionsValue).getItems().stream().map(v -> new ResourceLocation(v.getString())).collect(Collectors.toSet()); + validOptions = ((ListValue) optionsValue).getItems().stream().map(v -> ResourceLocation.parse(v.getString())).collect(Collectors.toSet()); } } } diff --git a/src/main/java/carpet/script/utils/FeatureGenerator.java b/src/main/java/carpet/script/utils/FeatureGenerator.java index db1f11a6fa..32f84a3233 100644 --- a/src/main/java/carpet/script/utils/FeatureGenerator.java +++ b/src/main/java/carpet/script/utils/FeatureGenerator.java @@ -75,7 +75,7 @@ public static synchronized Boolean plop(String featureName, ServerLevel world, B { return custom.apply(world).plop(world, pos); } - ResourceLocation id = new ResourceLocation(featureName); + ResourceLocation id = ResourceLocation.parse(featureName); Structure structure = world.registryAccess().registryOrThrow(Registries.STRUCTURE).get(id); if (structure != null) { @@ -129,7 +129,7 @@ public static synchronized Boolean plop(String featureName, ServerLevel world, B @Nullable public static Structure resolveConfiguredStructure(String name, ServerLevel world, BlockPos pos) { - ResourceLocation id = new ResourceLocation(name); + ResourceLocation id = ResourceLocation.parse(name); Structure configuredStructureFeature = world.registryAccess().registryOrThrow(Registries.STRUCTURE).get(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 b27527e278..f33edc36ec 100644 --- a/src/main/java/carpet/script/utils/InputValidator.java +++ b/src/main/java/carpet/script/utils/InputValidator.java @@ -23,7 +23,7 @@ public static ResourceLocation identifierOf(String string) { try { - return new ResourceLocation(string); + return ResourceLocation.parse(string); } catch (ResourceLocationException iie) { diff --git a/src/main/java/carpet/script/utils/ShapeDispatcher.java b/src/main/java/carpet/script/utils/ShapeDispatcher.java index 7ea1fcb483..ab622bd4e9 100644 --- a/src/main/java/carpet/script/utils/ShapeDispatcher.java +++ b/src/main/java/carpet/script/utils/ShapeDispatcher.java @@ -375,7 +375,7 @@ protected void init(Map options, RegistryAccess regs) key = 0; followEntity = -1; - shapeDimension = ResourceKey.create(Registries.DIMENSION, new ResourceLocation(options.get("dim").getString())); + shapeDimension = ResourceKey.create(Registries.DIMENSION, ResourceLocation.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 c044170b06..314fe57023 100644 --- a/src/main/java/carpet/script/utils/ShapesRenderer.java +++ b/src/main/java/carpet/script/utils/ShapesRenderer.java @@ -7,6 +7,8 @@ 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.PoseStack; import com.mojang.blaze3d.vertex.Tesselator; @@ -142,8 +144,7 @@ public void render(Matrix4f modelViewMatrix, Camera camera, float partialTick) //RenderSystem.polygonOffset(-3f, -3f); //RenderSystem.enablePolygonOffset(); - Tesselator tessellator = Tesselator.getInstance(); - BufferBuilder bufferBuilder = tessellator.getBuilder(); + Tesselator tesselator = Tesselator.getInstance(); // render double cameraX = camera.getPosition().x; @@ -166,7 +167,7 @@ public void render(Matrix4f modelViewMatrix, Camera camera, float partialTick) shapes.get(dimensionType).values().forEach(s -> { if ((!s.shape.debug || entityBoxes) && s.shouldRender(dimensionType)) { - s.renderLines(matrices, tessellator, bufferBuilder, cameraX, cameraY, cameraZ, partialTick); + s.renderLines(matrices, tesselator, cameraX, cameraY, cameraZ, partialTick); } }); // faces @@ -174,7 +175,7 @@ public void render(Matrix4f modelViewMatrix, Camera camera, float partialTick) shapes.get(dimensionType).values().forEach(s -> { if ((!s.shape.debug || entityBoxes) && s.shouldRender(dimensionType)) { - s.renderFaces(tessellator, bufferBuilder, cameraX, cameraY, cameraZ, partialTick); + s.renderFaces(tesselator, cameraX, cameraY, cameraZ, partialTick); } }); RenderSystem.lineWidth(1.0F); @@ -190,7 +191,7 @@ public void render(Matrix4f modelViewMatrix, Camera camera, float partialTick) labels.get(dimensionType).values().forEach(s -> { if ((!s.shape.debug || entityBoxes) && s.shouldRender(dimensionType)) { - s.renderLines(matrices, tessellator, bufferBuilder, cameraX, cameraY, cameraZ, partialTick); + s.renderLines(matrices, tesselator, cameraX, cameraY, cameraZ, partialTick); } }); } @@ -266,9 +267,9 @@ public abstract static class RenderedShape 0; i -= 2) @@ -791,7 +792,7 @@ public void renderLines(PoseStack matrices, Tesselator tessellator, BufferBuilde { vec = shape.relativiseRender(client.level, vec, partialTick); } - builder.vertex(vec.x() - cx, vec.y() - cy, vec.z() - cz).color(shape.r, shape.g, shape.b, shape.a).endVertex(); + 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) { @@ -802,15 +803,15 @@ public void renderLines(PoseStack matrices, Tesselator tessellator, BufferBuilde { vec = shape.relativiseRender(client.level, vec, partialTick); } - builder.vertex(vec.x() - cx, vec.y() - cy, vec.z() - cz).color(shape.r, shape.g, shape.b, shape.a).endVertex(); + builder.addVertex((float) (vec.x() - cx), (float) (vec.y() - cy), (float) (vec.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a); } } - tessellator.end(); + BufferUploader.draw(builder.buildOrThrow()); return; } if (shape.mode == 4) { - builder.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR); + BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR); for (int i = 0; i < shape.vertexList.size(); i++) { Vec3 vecA = shape.vertexList.get(i); @@ -830,16 +831,16 @@ public void renderLines(PoseStack matrices, Tesselator tessellator, BufferBuilde { vecC = shape.relativiseRender(client.level, vecC, partialTick); } - builder.vertex(vecA.x() - cx, vecA.y() - cy, vecA.z() - cz).color(shape.r, shape.g, shape.b, shape.a).endVertex(); - builder.vertex(vecB.x() - cx, vecB.y() - cy, vecB.z() - cz).color(shape.r, shape.g, shape.b, shape.a).endVertex(); + 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.vertex(vecB.x() - cx, vecB.y() - cy, vecB.z() - cz).color(shape.r, shape.g, shape.b, shape.a).endVertex(); - builder.vertex(vecC.x() - cx, vecC.y() - cy, vecC.z() - cz).color(shape.r, shape.g, shape.b, shape.a).endVertex(); + 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.vertex(vecC.x() - cx, vecC.y() - cy, vecC.z() - cz).color(shape.r, shape.g, shape.b, shape.a).endVertex(); - builder.vertex(vecA.x() - cx, vecA.y() - cy, vecA.z() - cz).color(shape.r, shape.g, shape.b, shape.a).endVertex(); + 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); } - tessellator.end(); + BufferUploader.draw(builder.buildOrThrow()); } } } @@ -852,28 +853,28 @@ public RenderedSphere(Minecraft client, ShapeDispatcher.ExpiringShape shape) } @Override - public void renderLines(PoseStack matrices, Tesselator tessellator, BufferBuilder bufferBuilder, double cx, double cy, double cz, float partialTick) + public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy, double cz, float partialTick) { if (shape.a == 0.0) { return; } Vec3 vc = shape.relativiseRender(client.level, shape.center, partialTick); - drawSphereWireframe(tessellator, bufferBuilder, + drawSphereWireframe(tesselator, (float) (vc.x - cx), (float) (vc.y - cy), (float) (vc.z - cz), (float) (shape.radius + renderEpsilon), shape.subdivisions, shape.r, shape.g, shape.b, shape.a); } @Override - public void renderFaces(Tesselator tessellator, BufferBuilder bufferBuilder, double cx, double cy, double cz, float partialTick) + public void renderFaces(Tesselator tesselator, double cx, double cy, double cz, float partialTick) { if (shape.fa == 0.0) { return; } Vec3 vc = shape.relativiseRender(client.level, shape.center, partialTick); - drawSphereFaces(tessellator, bufferBuilder, + drawSphereFaces(tesselator, (float) (vc.x - cx), (float) (vc.y - cy), (float) (vc.z - cz), (float) (shape.radius + renderEpsilon), shape.subdivisions, shape.fr, shape.fg, shape.fb, shape.fa); @@ -888,7 +889,7 @@ public RenderedCylinder(Minecraft client, ShapeDispatcher.ExpiringShape shape) } @Override - public void renderLines(PoseStack matrices, Tesselator tessellator, BufferBuilder bufferBuilder, double cx, double cy, double cz, float partialTick) + public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy, double cz, float partialTick) { if (shape.a == 0.0) { @@ -896,7 +897,7 @@ public void renderLines(PoseStack matrices, Tesselator tessellator, BufferBuilde } Vec3 vc = shape.relativiseRender(client.level, shape.center, partialTick); double dir = Mth.sign(shape.height); - drawCylinderWireframe(tessellator, bufferBuilder, + 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, @@ -905,7 +906,7 @@ public void renderLines(PoseStack matrices, Tesselator tessellator, BufferBuilde } @Override - public void renderFaces(Tesselator tessellator, BufferBuilder bufferBuilder, double cx, double cy, double cz, float partialTick) + public void renderFaces(Tesselator tesselator, double cx, double cy, double cz, float partialTick) { if (shape.fa == 0.0) { @@ -913,7 +914,7 @@ public void renderFaces(Tesselator tessellator, BufferBuilder bufferBuilder, dou } Vec3 vc = shape.relativiseRender(client.level, shape.center, partialTick); double dir = Mth.sign(shape.height); - drawCylinderFaces(tessellator, bufferBuilder, + drawCylinderFaces(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, @@ -923,129 +924,129 @@ public void renderFaces(Tesselator tessellator, BufferBuilder bufferBuilder, dou // some raw shit - public static void drawLine(Tesselator tessellator, BufferBuilder builder, float x1, float y1, float z1, float x2, float y2, float z2, float red1, float grn1, float blu1, float alpha) + 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) { - builder.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR); - builder.vertex(x1, y1, z1).color(red1, grn1, blu1, alpha).endVertex(); - builder.vertex(x2, y2, z2).color(red1, grn1, blu1, alpha).endVertex(); - tessellator.end(); + 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.draw(builder.buildOrThrow()); } public static void drawBoxWireGLLines( - Tesselator tessellator, BufferBuilder builder, + Tesselator tesselator, 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) { - builder.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR); + BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR); if (xthick) { - builder.vertex(x1, y1, z1).color(red1, grn2, blu2, alpha).endVertex(); - builder.vertex(x2, y1, z1).color(red1, grn2, blu2, alpha).endVertex(); + builder.addVertex(x1, y1, z1).setColor(red1, grn2, blu2, alpha); + builder.addVertex(x2, y1, z1).setColor(red1, grn2, blu2, alpha); - builder.vertex(x2, y2, z1).color(red1, grn1, blu1, alpha).endVertex(); - builder.vertex(x1, y2, z1).color(red1, grn1, blu1, alpha).endVertex(); + builder.addVertex(x2, y2, z1).setColor(red1, grn1, blu1, alpha); + builder.addVertex(x1, y2, z1).setColor(red1, grn1, blu1, alpha); - builder.vertex(x1, y1, z2).color(red1, grn1, blu1, alpha).endVertex(); - builder.vertex(x2, y1, z2).color(red1, grn1, blu1, alpha).endVertex(); + builder.addVertex(x1, y1, z2).setColor(red1, grn1, blu1, alpha); + builder.addVertex(x2, y1, z2).setColor(red1, grn1, blu1, alpha); - builder.vertex(x1, y2, z2).color(red1, grn1, blu1, alpha).endVertex(); - builder.vertex(x2, y2, z2).color(red1, grn1, blu1, alpha).endVertex(); + builder.addVertex(x1, y2, z2).setColor(red1, grn1, blu1, alpha); + builder.addVertex(x2, y2, z2).setColor(red1, grn1, blu1, alpha); } if (ythick) { - builder.vertex(x1, y1, z1).color(red2, grn1, blu2, alpha).endVertex(); - builder.vertex(x1, y2, z1).color(red2, grn1, blu2, alpha).endVertex(); + builder.addVertex(x1, y1, z1).setColor(red2, grn1, blu2, alpha); + builder.addVertex(x1, y2, z1).setColor(red2, grn1, blu2, alpha); - builder.vertex(x2, y1, z1).color(red1, grn1, blu1, alpha).endVertex(); - builder.vertex(x2, y2, z1).color(red1, grn1, blu1, alpha).endVertex(); + builder.addVertex(x2, y1, z1).setColor(red1, grn1, blu1, alpha); + builder.addVertex(x2, y2, z1).setColor(red1, grn1, blu1, alpha); - builder.vertex(x1, y2, z2).color(red1, grn1, blu1, alpha).endVertex(); - builder.vertex(x1, y1, z2).color(red1, grn1, blu1, alpha).endVertex(); + builder.addVertex(x1, y2, z2).setColor(red1, grn1, blu1, alpha); + builder.addVertex(x1, y1, z2).setColor(red1, grn1, blu1, alpha); - builder.vertex(x2, y1, z2).color(red1, grn1, blu1, alpha).endVertex(); - builder.vertex(x2, y2, z2).color(red1, grn1, blu1, alpha).endVertex(); + builder.addVertex(x2, y1, z2).setColor(red1, grn1, blu1, alpha); + builder.addVertex(x2, y2, z2).setColor(red1, grn1, blu1, alpha); } if (zthick) { - builder.vertex(x1, y1, z1).color(red2, grn2, blu1, alpha).endVertex(); - builder.vertex(x1, y1, z2).color(red2, grn2, blu1, alpha).endVertex(); + builder.addVertex(x1, y1, z1).setColor(red2, grn2, blu1, alpha); + builder.addVertex(x1, y1, z2).setColor(red2, grn2, blu1, alpha); - builder.vertex(x1, y2, z1).color(red1, grn1, blu1, alpha).endVertex(); - builder.vertex(x1, y2, z2).color(red1, grn1, blu1, alpha).endVertex(); + builder.addVertex(x1, y2, z1).setColor(red1, grn1, blu1, alpha); + builder.addVertex(x1, y2, z2).setColor(red1, grn1, blu1, alpha); - builder.vertex(x2, y1, z2).color(red1, grn1, blu1, alpha).endVertex(); - builder.vertex(x2, y1, z1).color(red1, grn1, blu1, alpha).endVertex(); + builder.addVertex(x2, y1, z2).setColor(red1, grn1, blu1, alpha); + builder.addVertex(x2, y1, z1).setColor(red1, grn1, blu1, alpha); - builder.vertex(x2, y2, z1).color(red1, grn1, blu1, alpha).endVertex(); - builder.vertex(x2, y2, z2).color(red1, grn1, blu1, alpha).endVertex(); + builder.addVertex(x2, y2, z1).setColor(red1, grn1, blu1, alpha); + builder.addVertex(x2, y2, z2).setColor(red1, grn1, blu1, alpha); } - tessellator.end(); + BufferUploader.draw(builder.buildOrThrow()); } public static void drawBoxFaces( - Tesselator tessellator, BufferBuilder builder, + Tesselator tesselator, 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) { - builder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR); + BufferBuilder builder = tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR); if (xthick && ythick) { - builder.vertex(x1, y1, z1).color(red1, grn1, blu1, alpha).endVertex(); - builder.vertex(x2, y1, z1).color(red1, grn1, blu1, alpha).endVertex(); - builder.vertex(x2, y2, z1).color(red1, grn1, blu1, alpha).endVertex(); - builder.vertex(x1, y2, z1).color(red1, grn1, blu1, alpha).endVertex(); + 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); if (zthick) { - builder.vertex(x1, y1, z2).color(red1, grn1, blu1, alpha).endVertex(); - builder.vertex(x1, y2, z2).color(red1, grn1, blu1, alpha).endVertex(); - builder.vertex(x2, y2, z2).color(red1, grn1, blu1, alpha).endVertex(); - builder.vertex(x2, y1, z2).color(red1, grn1, blu1, alpha).endVertex(); + 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); } } if (zthick && ythick) { - builder.vertex(x1, y1, z1).color(red1, grn1, blu1, alpha).endVertex(); - builder.vertex(x1, y2, z1).color(red1, grn1, blu1, alpha).endVertex(); - builder.vertex(x1, y2, z2).color(red1, grn1, blu1, alpha).endVertex(); - builder.vertex(x1, y1, z2).color(red1, grn1, blu1, alpha).endVertex(); + 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); if (xthick) { - builder.vertex(x2, y1, z1).color(red1, grn1, blu1, alpha).endVertex(); - builder.vertex(x2, y1, z2).color(red1, grn1, blu1, alpha).endVertex(); - builder.vertex(x2, y2, z2).color(red1, grn1, blu1, alpha).endVertex(); - builder.vertex(x2, y2, z1).color(red1, grn1, blu1, alpha).endVertex(); + 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); } } // now at least drawing one if (zthick && xthick) { - builder.vertex(x1, y1, z1).color(red1, grn1, blu1, alpha).endVertex(); - builder.vertex(x2, y1, z1).color(red1, grn1, blu1, alpha).endVertex(); - builder.vertex(x2, y1, z2).color(red1, grn1, blu1, alpha).endVertex(); - builder.vertex(x1, y1, z2).color(red1, grn1, blu1, alpha).endVertex(); + 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); if (ythick) { - builder.vertex(x1, y2, z1).color(red1, grn1, blu1, alpha).endVertex(); - builder.vertex(x2, y2, z1).color(red1, grn1, blu1, alpha).endVertex(); - builder.vertex(x2, y2, z2).color(red1, grn1, blu1, alpha).endVertex(); - builder.vertex(x1, y2, z2).color(red1, grn1, blu1, alpha).endVertex(); + 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); } } - tessellator.end(); + BufferUploader.draw(builder.buildOrThrow()); } - public static void drawCylinderWireframe(Tesselator tessellator, BufferBuilder builder, + public static void drawCylinderWireframe(Tesselator tesselator, 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) @@ -1066,48 +1067,48 @@ public static void drawCylinderWireframe(Tesselator tessellator, BufferBuilder b for (int dh = 0; dh < hsteps; dh++) { float hh = dh * hstep; - builder.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR); // line loop to line strip + BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR); // line loop to line strip 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.vertex(x + cx, y + cy, z + cz).color(red, grn, blu, alpha).endVertex(); + builder.addVertex(x + cx, y + cy, z + cz).setColor(red, grn, blu, alpha); } - tessellator.end(); + BufferUploader.draw(builder.buildOrThrow()); } if (!isFlat) { for (int i = 0; i <= num_steps180; i++) { - builder.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR); // line loop to line strip + 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.vertex(cx - x, cy + 0, cz + z).color(red, grn, blu, alpha).endVertex(); - builder.vertex(cx + x, cy + 0, cz - z).color(red, grn, blu, alpha).endVertex(); - builder.vertex(cx + x, cy + h, cz - z).color(red, grn, blu, alpha).endVertex(); - builder.vertex(cx - x, cy + h, cz + z).color(red, grn, blu, alpha).endVertex(); - builder.vertex(cx - x, cy + 0, cz + z).color(red, grn, blu, alpha).endVertex(); - tessellator.end(); + 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); + BufferUploader.draw(builder.buildOrThrow()); } } else { - builder.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR); + BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR); for (int i = 0; i <= num_steps180; i++) { float theta = step * i; float x = r * Mth.cos(theta); float z = r * Mth.sin(theta); - builder.vertex(cx - x, cy, cz + z).color(red, grn, blu, alpha).endVertex(); - builder.vertex(cx + x, cy, cz - z).color(red, grn, blu, alpha).endVertex(); + builder.addVertex(cx - x, cy, cz + z).setColor(red, grn, blu, alpha); + builder.addVertex(cx + x, cy, cz - z).setColor(red, grn, blu, alpha); } - tessellator.end(); + BufferUploader.draw(builder.buildOrThrow()); } } @@ -1116,47 +1117,47 @@ else if (axis == Direction.Axis.X) for (int dh = 0; dh < hsteps; dh++) { float hh = dh * hstep; - builder.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR); // line loop to line strip + BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR); // line loop to line strip 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.vertex(x + cx, y + cy, z + cz).color(red, grn, blu, alpha).endVertex(); + builder.addVertex(x + cx, y + cy, z + cz).setColor(red, grn, blu, alpha); } - tessellator.end(); + BufferUploader.draw(builder.buildOrThrow()); } if (!isFlat) { for (int i = 0; i <= num_steps180; i++) { - builder.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR); // line loop to line strip + 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.vertex(cx + 0, cy - y, cz + z).color(red, grn, blu, alpha).endVertex(); - builder.vertex(cx + 0, cy + y, cz - z).color(red, grn, blu, alpha).endVertex(); - builder.vertex(cx + h, cy + y, cz - z).color(red, grn, blu, alpha).endVertex(); - builder.vertex(cx + h, cy - y, cz + z).color(red, grn, blu, alpha).endVertex(); - tessellator.end(); + 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); + BufferUploader.draw(builder.buildOrThrow()); } } else { - builder.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR); + BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR); for (int i = 0; i <= num_steps180; i++) { float theta = step * i; float y = r * Mth.cos(theta); float z = r * Mth.sin(theta); - builder.vertex(cx, cy - y, cz + z).color(red, grn, blu, alpha).endVertex(); - builder.vertex(cx, cy + y, cz - z).color(red, grn, blu, alpha).endVertex(); + builder.addVertex(cx, cy - y, cz + z).setColor(red, grn, blu, alpha); + builder.addVertex(cx, cy + y, cz - z).setColor(red, grn, blu, alpha); } - tessellator.end(); + BufferUploader.draw(builder.buildOrThrow()); } } else if (axis == Direction.Axis.Z) @@ -1164,52 +1165,52 @@ else if (axis == Direction.Axis.Z) for (int dh = 0; dh < hsteps; dh++) { float hh = dh * hstep; - builder.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR); // line loop to line strip + BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR); // line loop to line strip 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.vertex(x + cx, y + cy, z + cz).color(red, grn, blu, alpha).endVertex(); + builder.addVertex(x + cx, y + cy, z + cz).setColor(red, grn, blu, alpha); } - tessellator.end(); + BufferUploader.draw(builder.buildOrThrow()); } if (!isFlat) { for (int i = 0; i <= num_steps180; i++) { - builder.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR); // line loop to line strip + 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.vertex(cx + x, cy - y, cz + 0).color(red, grn, blu, alpha).endVertex(); - builder.vertex(cx - x, cy + y, cz + 0).color(red, grn, blu, alpha).endVertex(); - builder.vertex(cx - x, cy + y, cz + h).color(red, grn, blu, alpha).endVertex(); - builder.vertex(cx + x, cy - y, cz + h).color(red, grn, blu, alpha).endVertex(); - tessellator.end(); + 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); + BufferUploader.draw(builder.buildOrThrow()); } } else { - builder.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR); + BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR); for (int i = 0; i <= num_steps180; i++) { float theta = step * i; float x = r * Mth.cos(theta); float y = r * Mth.sin(theta); - builder.vertex(cx + x, cy - y, cz).color(red, grn, blu, alpha).endVertex(); - builder.vertex(cx - x, cy + y, cz).color(red, grn, blu, alpha).endVertex(); + builder.addVertex(cx + x, cy - y, cz).setColor(red, grn, blu, alpha); + builder.addVertex(cx - x, cy + y, cz).setColor(red, grn, blu, alpha); } - tessellator.end(); + BufferUploader.draw(builder.buildOrThrow()); } } } - public static void drawCylinderFaces(Tesselator tessellator, BufferBuilder builder, + public static void drawCylinderFaces(Tesselator tesselator, 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) @@ -1221,30 +1222,30 @@ public static void drawCylinderFaces(Tesselator tessellator, BufferBuilder build if (axis == Direction.Axis.Y) { - builder.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR); - builder.vertex(cx, cy, cz).color(red, grn, blu, alpha).endVertex(); + 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.vertex(x + cx, cy, z + cz).color(red, grn, blu, alpha).endVertex(); + builder.addVertex(x + cx, cy, z + cz).setColor(red, grn, blu, alpha); } - tessellator.end(); + BufferUploader.draw(builder.buildOrThrow()); if (!isFlat) { - builder.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR); - builder.vertex(cx, cy + h, cz).color(red, grn, blu, alpha).endVertex(); + BufferBuilder builderr = tesselator.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR); + builderr.addVertex(cx, cy + h, 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.vertex(x + cx, cy + h, z + cz).color(red, grn, blu, alpha).endVertex(); + builderr.addVertex(x + cx, cy + h, z + cz).setColor(red, grn, blu, alpha); } - tessellator.end(); + BufferUploader.draw(builderr.buildOrThrow()); - builder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR); // quad strip to quads + 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++) @@ -1252,43 +1253,43 @@ public static void drawCylinderFaces(Tesselator tessellator, BufferBuilder build float theta = step * i; float x = r * Mth.cos(theta); float z = r * Mth.sin(theta); - builder.vertex(cx + xp, cy + 0, cz + zp).color(red, grn, blu, alpha).endVertex(); - builder.vertex(cx + xp, cy + h, cz + zp).color(red, grn, blu, alpha).endVertex(); - builder.vertex(cx + x, cy + h, cz + z).color(red, grn, blu, alpha).endVertex(); - builder.vertex(cx + x, cy + 0, cz + z).color(red, grn, blu, alpha).endVertex(); + 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); xp = x; zp = z; } - tessellator.end(); + BufferUploader.draw(builderrr.buildOrThrow()); } } else if (axis == Direction.Axis.X) { - builder.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR); - builder.vertex(cx, cy, cz).color(red, grn, blu, alpha).endVertex(); + 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.vertex(cx, cy + y, z + cz).color(red, grn, blu, alpha).endVertex(); + builder.addVertex(cx, cy + y, z + cz).setColor(red, grn, blu, alpha); } - tessellator.end(); + BufferUploader.draw(builder.buildOrThrow()); if (!isFlat) { - builder.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR); - builder.vertex(cx + h, cy, cz).color(red, grn, blu, alpha).endVertex(); + BufferBuilder builderr = tesselator.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR); + builderr.addVertex(cx + h, 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.vertex(cx + h, cy + y, cz + z).color(red, grn, blu, alpha).endVertex(); + builderr.addVertex(cx + h, cy + y, cz + z).setColor(red, grn, blu, alpha); } - tessellator.end(); + BufferUploader.draw(builderr.buildOrThrow()); - builder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR); // quad strip to quads + 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++) @@ -1296,42 +1297,42 @@ else if (axis == Direction.Axis.X) float theta = step * i; float y = r * Mth.cos(theta); float z = r * Mth.sin(theta); - builder.vertex(cx + 0, cy + yp, cz + zp).color(red, grn, blu, alpha).endVertex(); - builder.vertex(cx + h, cy + yp, cz + zp).color(red, grn, blu, alpha).endVertex(); - builder.vertex(cx + h, cy + y, cz + z).color(red, grn, blu, alpha).endVertex(); - builder.vertex(cx + 0, cy + y, cz + z).color(red, grn, blu, alpha).endVertex(); + 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); yp = y; zp = z; } - tessellator.end(); + BufferUploader.draw(builderrr.buildOrThrow()); } } else if (axis == Direction.Axis.Z) { - builder.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR); - builder.vertex(cx, cy, cz).color(red, grn, blu, alpha).endVertex(); + 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.vertex(x + cx, cy + y, cz).color(red, grn, blu, alpha).endVertex(); + builder.addVertex(x + cx, cy + y, cz).setColor(red, grn, blu, alpha); } - tessellator.end(); + BufferUploader.draw(builder.buildOrThrow()); if (!isFlat) { - builder.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR); - builder.vertex(cx, cy, cz + h).color(red, grn, blu, alpha).endVertex(); + BufferBuilder builderr = tesselator.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR); + builderr.addVertex(cx, cy, cz + h).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.vertex(x + cx, cy + y, cz + h).color(red, grn, blu, alpha).endVertex(); + builderr.addVertex(x + cx, cy + y, cz + h).setColor(red, grn, blu, alpha); } - tessellator.end(); + BufferUploader.draw(builderr.buildOrThrow()); - builder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR); // quad strip to quads + 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++) @@ -1339,19 +1340,19 @@ else if (axis == Direction.Axis.Z) float theta = step * i; float x = r * Mth.cos(theta); float y = r * Mth.sin(theta); - builder.vertex(cx + xp, cy + yp, cz + 0).color(red, grn, blu, alpha).endVertex(); - builder.vertex(cx + xp, cy + yp, cz + h).color(red, grn, blu, alpha).endVertex(); - builder.vertex(cx + x, cy + y, cz + h).color(red, grn, blu, alpha).endVertex(); - builder.vertex(cx + x, cy + y, cz + 0).color(red, grn, blu, alpha).endVertex(); + 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); xp = x; yp = y; } - tessellator.end(); + BufferUploader.draw(builderrr.buildOrThrow()); } } } - public static void drawSphereWireframe(Tesselator tessellator, BufferBuilder builder, + public static void drawSphereWireframe(Tesselator tesselator, float cx, float cy, float cz, float r, int subd, float red, float grn, float blu, float alpha) @@ -1361,7 +1362,7 @@ public static void drawSphereWireframe(Tesselator tessellator, BufferBuilder bui int num_steps360 = (int) (2 * Math.PI / step) + 1; for (int i = 0; i <= num_steps360; i++) { - builder.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR); + BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR); float theta = step * i; for (int j = 0; j <= num_steps180; j++) { @@ -1369,13 +1370,13 @@ public static void drawSphereWireframe(Tesselator tessellator, BufferBuilder bui 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.vertex(x + cx, y + cy, z + cz).color(red, grn, blu, alpha).endVertex(); + builder.addVertex(x + cx, y + cy, z + cz).setColor(red, grn, blu, alpha); } - tessellator.end(); + BufferUploader.draw(builder.buildOrThrow()); } for (int j = 0; j <= num_steps180; j++) { - builder.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR); // line loop to line strip + BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR); // line loop to line strip float phi = step * j; for (int i = 0; i <= num_steps360; i++) @@ -1384,14 +1385,14 @@ public static void drawSphereWireframe(Tesselator tessellator, BufferBuilder bui 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.vertex(x + cx, y + cy, z + cz).color(red, grn, blu, alpha).endVertex(); + builder.addVertex(x + cx, y + cy, z + cz).setColor(red, grn, blu, alpha); } - tessellator.end(); + BufferUploader.draw(builder.buildOrThrow()); } } - public static void drawSphereFaces(Tesselator tessellator, BufferBuilder builder, + public static void drawSphereFaces(Tesselator tesselator, float cx, float cy, float cz, float r, int subd, float red, float grn, float blu, float alpha) @@ -1404,7 +1405,7 @@ public static void drawSphereFaces(Tesselator tessellator, BufferBuilder builder { float theta = i * step; float thetaprime = theta + step; - builder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR); // quad strip to quads + BufferBuilder builder = tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR); // quad strip to quads float xb = 0; float zb = 0; float xbp = 0; @@ -1418,17 +1419,17 @@ public static void drawSphereFaces(Tesselator tessellator, BufferBuilder builder 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.vertex(xb + cx, yp + cy, zb + cz).color(red, grn, blu, alpha).endVertex(); - builder.vertex(xbp + cx, yp + cy, zbp + cz).color(red, grn, blu, alpha).endVertex(); - builder.vertex(xp + cx, y + cy, zp + cz).color(red, grn, blu, alpha).endVertex(); - builder.vertex(x + cx, y + cy, z + cz).color(red, grn, blu, alpha).endVertex(); + 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); xb = x; zb = z; xbp = xp; zbp = zp; yp = y; } - tessellator.end(); + BufferUploader.draw(builder.buildOrThrow()); } } } diff --git a/src/main/java/carpet/script/value/ValueConversions.java b/src/main/java/carpet/script/value/ValueConversions.java index 80b1c26ac7..8bf58f1d0a 100644 --- a/src/main/java/carpet/script/value/ValueConversions.java +++ b/src/main/java/carpet/script/value/ValueConversions.java @@ -159,7 +159,7 @@ else if (dimensionValue instanceof BlockValue bv) case "overworld", "over_world" -> server.getLevel(Level.OVERWORLD); default -> { ResourceKey dim = null; - ResourceLocation id = new ResourceLocation(dimString); + ResourceLocation id = ResourceLocation.parse(dimString); // not using RegistryKey.of since that one creates on check for (ResourceKey world : (server.levelKeys())) { diff --git a/src/main/resources/carpet.mixins.json b/src/main/resources/carpet.mixins.json index 768da60279..6b68dcff13 100644 --- a/src/main/resources/carpet.mixins.json +++ b/src/main/resources/carpet.mixins.json @@ -157,6 +157,7 @@ "HorseBaseEntity_scarpetMixin", "RandomState_ScarpetMixin", "Biome_scarpetMixin", + "PortalProcessor_scarpetMixin", "BlockEntity_movableBEMixin", "PistonBaseBlock_movableBEMixin", From 36c3501978c6fa93c308de9eed450ce9f96dbde1 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Wed, 22 May 2024 22:35:27 +0200 Subject: [PATCH 07/12] 1.4.144 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index d94f53dc40..054fd39e56 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G fabric_version=0.97.8+1.20.6 # Mod Properties - mod_version = 1.4.143 + mod_version = 1.4.144 maven_group = carpet archives_base_name = fabric-carpet From fed9502562e3aeb2977401b698bb925fd0aa72f0 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Thu, 23 May 2024 00:33:36 +0200 Subject: [PATCH 08/12] fix for scarpet shapes --- .../carpet/script/utils/ShapesRenderer.java | 58 +++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/src/main/java/carpet/script/utils/ShapesRenderer.java b/src/main/java/carpet/script/utils/ShapesRenderer.java index 314fe57023..7d6edd6f5d 100644 --- a/src/main/java/carpet/script/utils/ShapesRenderer.java +++ b/src/main/java/carpet/script/utils/ShapesRenderer.java @@ -710,7 +710,7 @@ public void renderFaces(Tesselator tesselator, double cx, double cy, double cz, } builder.addVertex((float) (vec.x() - cx), (float) (vec.y() - cy), (float) (vec.z() - cz)).setColor(shape.fr, shape.fg, shape.fb, shape.fa); } - BufferUploader.draw(builder.buildOrThrow()); + BufferUploader.drawWithShader(builder.buildOrThrow()); RenderSystem.disableCull(); RenderSystem.depthMask(false); @@ -746,7 +746,7 @@ public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, do 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.draw(builder.buildOrThrow()); + BufferUploader.drawWithShader(builder.buildOrThrow()); if (shape.inneredges) { BufferBuilder builderr = tesselator.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR); @@ -761,7 +761,7 @@ public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, do 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.draw(builderr.buildOrThrow()); + BufferUploader.drawWithShader(builderr.buildOrThrow()); } return; } @@ -806,7 +806,7 @@ public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, do builder.addVertex((float) (vec.x() - cx), (float) (vec.y() - cy), (float) (vec.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a); } } - BufferUploader.draw(builder.buildOrThrow()); + BufferUploader.drawWithShader(builder.buildOrThrow()); return; } if (shape.mode == 4) @@ -840,7 +840,7 @@ public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, do 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.draw(builder.buildOrThrow()); + BufferUploader.drawWithShader(builder.buildOrThrow()); } } } @@ -929,7 +929,7 @@ public static void drawLine(Tesselator tesselator, float x1, float y1, float z1, 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.draw(builder.buildOrThrow()); + BufferUploader.drawWithShader(builder.buildOrThrow()); } public static void drawBoxWireGLLines( @@ -982,7 +982,7 @@ public static void drawBoxWireGLLines( builder.addVertex(x2, y2, z1).setColor(red1, grn1, blu1, alpha); builder.addVertex(x2, y2, z2).setColor(red1, grn1, blu1, alpha); } - BufferUploader.draw(builder.buildOrThrow()); + BufferUploader.drawWithShader(builder.buildOrThrow()); } public static void drawBoxFaces( @@ -1043,7 +1043,7 @@ public static void drawBoxFaces( builder.addVertex(x1, y2, z2).setColor(red1, grn1, blu1, alpha); } } - BufferUploader.draw(builder.buildOrThrow()); + BufferUploader.drawWithShader(builder.buildOrThrow()); } public static void drawCylinderWireframe(Tesselator tesselator, @@ -1076,7 +1076,7 @@ public static void drawCylinderWireframe(Tesselator tesselator, float z = r * Mth.sin(theta); builder.addVertex(x + cx, y + cy, z + cz).setColor(red, grn, blu, alpha); } - BufferUploader.draw(builder.buildOrThrow()); + BufferUploader.drawWithShader(builder.buildOrThrow()); } if (!isFlat) @@ -1094,7 +1094,7 @@ public static void drawCylinderWireframe(Tesselator tesselator, 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.draw(builder.buildOrThrow()); + BufferUploader.drawWithShader(builder.buildOrThrow()); } } else @@ -1108,7 +1108,7 @@ public static void drawCylinderWireframe(Tesselator tesselator, 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.draw(builder.buildOrThrow()); + BufferUploader.drawWithShader(builder.buildOrThrow()); } } @@ -1126,7 +1126,7 @@ else if (axis == Direction.Axis.X) float y = r * Mth.sin(theta); builder.addVertex(x + cx, y + cy, z + cz).setColor(red, grn, blu, alpha); } - BufferUploader.draw(builder.buildOrThrow()); + BufferUploader.drawWithShader(builder.buildOrThrow()); } if (!isFlat) @@ -1143,7 +1143,7 @@ else if (axis == Direction.Axis.X) 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.draw(builder.buildOrThrow()); + BufferUploader.drawWithShader(builder.buildOrThrow()); } } else @@ -1157,7 +1157,7 @@ else if (axis == Direction.Axis.X) 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.draw(builder.buildOrThrow()); + BufferUploader.drawWithShader(builder.buildOrThrow()); } } else if (axis == Direction.Axis.Z) @@ -1174,7 +1174,7 @@ else if (axis == Direction.Axis.Z) float x = r * Mth.sin(theta); builder.addVertex(x + cx, y + cy, z + cz).setColor(red, grn, blu, alpha); } - BufferUploader.draw(builder.buildOrThrow()); + BufferUploader.drawWithShader(builder.buildOrThrow()); } if (!isFlat) { @@ -1190,7 +1190,7 @@ else if (axis == Direction.Axis.Z) 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.draw(builder.buildOrThrow()); + BufferUploader.drawWithShader(builder.buildOrThrow()); } } else @@ -1204,7 +1204,7 @@ else if (axis == Direction.Axis.Z) 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.draw(builder.buildOrThrow()); + BufferUploader.drawWithShader(builder.buildOrThrow()); } } @@ -1231,7 +1231,7 @@ public static void drawCylinderFaces(Tesselator tesselator, float z = r * Mth.sin(theta); builder.addVertex(x + cx, cy, z + cz).setColor(red, grn, blu, alpha); } - BufferUploader.draw(builder.buildOrThrow()); + BufferUploader.drawWithShader(builder.buildOrThrow()); if (!isFlat) { BufferBuilder builderr = tesselator.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR); @@ -1243,7 +1243,7 @@ public static void drawCylinderFaces(Tesselator tesselator, float z = r * Mth.sin(theta); builderr.addVertex(x + cx, cy + h, z + cz).setColor(red, grn, blu, alpha); } - BufferUploader.draw(builderr.buildOrThrow()); + BufferUploader.drawWithShader(builderr.buildOrThrow()); BufferBuilder builderrr = tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR); // quad strip to quads float xp = r * 1; @@ -1260,7 +1260,7 @@ public static void drawCylinderFaces(Tesselator tesselator, xp = x; zp = z; } - BufferUploader.draw(builderrr.buildOrThrow()); + BufferUploader.drawWithShader(builderrr.buildOrThrow()); } } @@ -1275,7 +1275,7 @@ else if (axis == Direction.Axis.X) float z = r * Mth.sin(theta); builder.addVertex(cx, cy + y, z + cz).setColor(red, grn, blu, alpha); } - BufferUploader.draw(builder.buildOrThrow()); + BufferUploader.drawWithShader(builder.buildOrThrow()); if (!isFlat) { BufferBuilder builderr = tesselator.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR); @@ -1287,7 +1287,7 @@ else if (axis == Direction.Axis.X) float z = r * Mth.sin(theta); builderr.addVertex(cx + h, cy + y, cz + z).setColor(red, grn, blu, alpha); } - BufferUploader.draw(builderr.buildOrThrow()); + BufferUploader.drawWithShader(builderr.buildOrThrow()); BufferBuilder builderrr = tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR); // quad strip to quads float yp = r * 1; @@ -1304,7 +1304,7 @@ else if (axis == Direction.Axis.X) yp = y; zp = z; } - BufferUploader.draw(builderrr.buildOrThrow()); + BufferUploader.drawWithShader(builderrr.buildOrThrow()); } } else if (axis == Direction.Axis.Z) @@ -1318,7 +1318,7 @@ else if (axis == Direction.Axis.Z) float y = r * Mth.sin(theta); builder.addVertex(x + cx, cy + y, cz).setColor(red, grn, blu, alpha); } - BufferUploader.draw(builder.buildOrThrow()); + BufferUploader.drawWithShader(builder.buildOrThrow()); if (!isFlat) { BufferBuilder builderr = tesselator.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR); @@ -1330,7 +1330,7 @@ else if (axis == Direction.Axis.Z) float y = r * Mth.sin(theta); builderr.addVertex(x + cx, cy + y, cz + h).setColor(red, grn, blu, alpha); } - BufferUploader.draw(builderr.buildOrThrow()); + BufferUploader.drawWithShader(builderr.buildOrThrow()); BufferBuilder builderrr = tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR); // quad strip to quads float xp = r; @@ -1347,7 +1347,7 @@ else if (axis == Direction.Axis.Z) xp = x; yp = y; } - BufferUploader.draw(builderrr.buildOrThrow()); + BufferUploader.drawWithShader(builderrr.buildOrThrow()); } } } @@ -1372,7 +1372,7 @@ public static void drawSphereWireframe(Tesselator tesselator, float y = r * Mth.cos(phi); builder.addVertex(x + cx, y + cy, z + cz).setColor(red, grn, blu, alpha); } - BufferUploader.draw(builder.buildOrThrow()); + BufferUploader.drawWithShader(builder.buildOrThrow()); } for (int j = 0; j <= num_steps180; j++) { @@ -1387,7 +1387,7 @@ public static void drawSphereWireframe(Tesselator tesselator, float y = r * Mth.cos(phi); builder.addVertex(x + cx, y + cy, z + cz).setColor(red, grn, blu, alpha); } - BufferUploader.draw(builder.buildOrThrow()); + BufferUploader.drawWithShader(builder.buildOrThrow()); } } @@ -1429,7 +1429,7 @@ public static void drawSphereFaces(Tesselator tesselator, zbp = zp; yp = y; } - BufferUploader.draw(builder.buildOrThrow()); + BufferUploader.drawWithShader(builder.buildOrThrow()); } } } From f0ca1e9fa5d063e0f3f1684f6ad7445daa87b8e7 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Wed, 29 May 2024 21:54:27 +0200 Subject: [PATCH 09/12] 1.4.145 for 1.21-pre1 --- gradle.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index 054fd39e56..5098086624 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,13 +3,13 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=24w21a + minecraft_version=1.21-pre1 loader_version=0.15.11 jsr305_version=3.0.2 - fabric_version=0.97.8+1.20.6 + fabric_version=0.99.2+1.21 # Mod Properties - mod_version = 1.4.144 + mod_version = 1.4.145 maven_group = carpet archives_base_name = fabric-carpet From 071f5cf1409faa7dc1876d95bf6dd31fc2fcf7cf Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Wed, 5 Jun 2024 18:34:32 +0200 Subject: [PATCH 10/12] 1.21-pre3 --- gradle.properties | 2 +- src/main/java/carpet/mixins/LivingEntity_creativeFlyMixin.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 5098086624..e89d0f5491 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-pre1 + minecraft_version=1.21-pre3 loader_version=0.15.11 jsr305_version=3.0.2 fabric_version=0.99.2+1.21 diff --git a/src/main/java/carpet/mixins/LivingEntity_creativeFlyMixin.java b/src/main/java/carpet/mixins/LivingEntity_creativeFlyMixin.java index b84b2ade02..5b22f42f24 100644 --- a/src/main/java/carpet/mixins/LivingEntity_creativeFlyMixin.java +++ b/src/main/java/carpet/mixins/LivingEntity_creativeFlyMixin.java @@ -49,7 +49,7 @@ private void flyingAltSpeed(float slipperiness, CallbackInfoReturnable ci } } - @Inject(method = "canChangeDimensions", at = @At("HEAD"), cancellable = true) + @Inject(method = "canUsePortal", at = @At("HEAD"), cancellable = true) private void canChangeDimensions(CallbackInfoReturnable cir) { if (CarpetSettings.isCreativeFlying(this)) { From e12b55e585c5e3c8acc6ce49a3bada72852969f4 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Wed, 5 Jun 2024 18:35:06 +0200 Subject: [PATCH 11/12] 1.4.146 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index e89d0f5491..3be180b805 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G fabric_version=0.99.2+1.21 # Mod Properties - mod_version = 1.4.145 + mod_version = 1.4.146 maven_group = carpet archives_base_name = fabric-carpet From e8ea8494b1a16715eaef623261e7b5c9158230a6 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Thu, 13 Jun 2024 22:28:32 +0200 Subject: [PATCH 12/12] 1.4.147 for 1.21 --- gradle.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index 3be180b805..fcf94f0cbe 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-pre3 + minecraft_version=1.21 loader_version=0.15.11 jsr305_version=3.0.2 fabric_version=0.99.2+1.21 # Mod Properties - mod_version = 1.4.146 + mod_version = 1.4.147 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-Snapshot + release-curse-versions = Minecraft 1.21:1.21 # Whether or not to build another branch on release release-extra-branch = false # The name of the second branch to release