diff --git a/gradle.properties b/gradle.properties index cdb32075..f8148cd1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,8 +7,8 @@ org.gradle.configuration-cache=false # Fabric Properties # check https://fabricmc.net/develop/ - minecraft_version=26.1 - loader_version=0.18.4 + minecraft_version=26.2-snapshot-1 + loader_version=0.18.6 loom_version=1.15-SNAPSHOT # Mod Properties @@ -20,7 +20,7 @@ org.gradle.configuration-cache=false # The Curseforge versions "names" or ids for the main branch (comma separated: 1.16.4,1.16.5) # This is needed because CF uses too vague names for prereleases and release candidates # Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN] - release-curse-versions = Minecraft 26:26.1 + release-curse-versions = Minecraft 26:26.2-Snapshot # Whether or not to build another branch on release release-extra-branch = false # The name of the second branch to release diff --git a/src/main/java/carpet/helpers/HopperCounter.java b/src/main/java/carpet/helpers/HopperCounter.java index 92080b8a..3e7cb74e 100644 --- a/src/main/java/carpet/helpers/HopperCounter.java +++ b/src/main/java/carpet/helpers/HopperCounter.java @@ -269,19 +269,19 @@ public class HopperCounter * {@link Block#defaultMapColor()} method as these items have those same colours. */ private static final Map DEFAULTS = Map.ofEntries( - entry(Items.DANDELION, Blocks.YELLOW_WOOL), - entry(Items.POPPY, Blocks.RED_WOOL), - entry(Items.BLUE_ORCHID, Blocks.LIGHT_BLUE_WOOL), - entry(Items.ALLIUM, Blocks.MAGENTA_WOOL), + entry(Items.DANDELION, Blocks.WOOL.yellow()), + entry(Items.POPPY, Blocks.WOOL.red()), + entry(Items.BLUE_ORCHID, Blocks.WOOL.lightBlue()), + entry(Items.ALLIUM, Blocks.WOOL.magenta()), entry(Items.AZURE_BLUET, Blocks.SNOW_BLOCK), - entry(Items.RED_TULIP, Blocks.RED_WOOL), - entry(Items.ORANGE_TULIP, Blocks.ORANGE_WOOL), + entry(Items.RED_TULIP, Blocks.WOOL.red()), + entry(Items.ORANGE_TULIP, Blocks.WOOL.orange()), entry(Items.WHITE_TULIP, Blocks.SNOW_BLOCK), - entry(Items.PINK_TULIP, Blocks.PINK_WOOL), + entry(Items.PINK_TULIP, Blocks.WOOL.pink()), entry(Items.OXEYE_DAISY, Blocks.SNOW_BLOCK), - entry(Items.CORNFLOWER, Blocks.BLUE_WOOL), - entry(Items.WITHER_ROSE, Blocks.BLACK_WOOL), - entry(Items.LILY_OF_THE_VALLEY, Blocks.WHITE_WOOL), + entry(Items.CORNFLOWER, Blocks.WOOL.blue()), + entry(Items.WITHER_ROSE, Blocks.WOOL.black()), + entry(Items.LILY_OF_THE_VALLEY, Blocks.WOOL.white()), entry(Items.BROWN_MUSHROOM, Blocks.BROWN_MUSHROOM_BLOCK), entry(Items.RED_MUSHROOM, Blocks.RED_MUSHROOM_BLOCK), entry(Items.STICK, Blocks.OAK_PLANKS), @@ -289,51 +289,51 @@ public class HopperCounter entry(Items.IRON_INGOT, Blocks.IRON_BLOCK), entry(Items.DIAMOND, Blocks.DIAMOND_BLOCK), entry(Items.NETHERITE_INGOT, Blocks.NETHERITE_BLOCK), - entry(Items.SUNFLOWER, Blocks.YELLOW_WOOL), - entry(Items.LILAC, Blocks.MAGENTA_WOOL), - entry(Items.ROSE_BUSH, Blocks.RED_WOOL), - entry(Items.PEONY, Blocks.PINK_WOOL), - entry(Items.CARROT, Blocks.ORANGE_WOOL), - entry(Items.APPLE, Blocks.RED_WOOL), + entry(Items.SUNFLOWER, Blocks.WOOL.yellow()), + entry(Items.LILAC, Blocks.WOOL.magenta()), + entry(Items.ROSE_BUSH, Blocks.WOOL.red()), + entry(Items.PEONY, Blocks.WOOL.pink()), + entry(Items.CARROT, Blocks.WOOL.orange()), + entry(Items.APPLE, Blocks.WOOL.red()), entry(Items.WHEAT, Blocks.HAY_BLOCK), - entry(Items.PORKCHOP, Blocks.PINK_WOOL), - entry(Items.RABBIT, Blocks.PINK_WOOL), - entry(Items.CHICKEN, Blocks.WHITE_TERRACOTTA), + entry(Items.PORKCHOP, Blocks.WOOL.pink()), + entry(Items.RABBIT, Blocks.WOOL.pink()), + entry(Items.CHICKEN, Blocks.DYED_TERRACOTTA.white()), entry(Items.BEEF, Blocks.NETHERRACK), entry(Items.ENCHANTED_GOLDEN_APPLE, Blocks.GOLD_BLOCK), - entry(Items.COD, Blocks.WHITE_TERRACOTTA), + entry(Items.COD, Blocks.DYED_TERRACOTTA.white()), entry(Items.SALMON, Blocks.ACACIA_PLANKS), - entry(Items.ROTTEN_FLESH, Blocks.BROWN_WOOL), - entry(Items.PUFFERFISH, Blocks.YELLOW_TERRACOTTA), - entry(Items.TROPICAL_FISH, Blocks.ORANGE_WOOL), - entry(Items.POTATO, Blocks.WHITE_TERRACOTTA), - entry(Items.MUTTON, Blocks.RED_WOOL), + entry(Items.ROTTEN_FLESH, Blocks.WOOL.brown()), + entry(Items.PUFFERFISH, Blocks.DYED_TERRACOTTA.orange()), + entry(Items.TROPICAL_FISH, Blocks.WOOL.orange()), + entry(Items.POTATO, Blocks.DYED_TERRACOTTA.white()), + entry(Items.MUTTON, Blocks.WOOL.red()), entry(Items.BEETROOT, Blocks.NETHERRACK), entry(Items.MELON_SLICE, Blocks.MELON), entry(Items.POISONOUS_POTATO, Blocks.SLIME_BLOCK), entry(Items.SPIDER_EYE, Blocks.NETHERRACK), - entry(Items.GUNPOWDER, Blocks.GRAY_WOOL), - entry(Items.TURTLE_SCUTE, Blocks.LIME_WOOL), + entry(Items.GUNPOWDER, Blocks.WOOL.gray()), + entry(Items.TURTLE_SCUTE, Blocks.WOOL.lime()), entry(Items.ARMADILLO_SCUTE, Blocks.ANCIENT_DEBRIS), - entry(Items.FEATHER, Blocks.WHITE_WOOL), - entry(Items.FLINT, Blocks.BLACK_WOOL), + entry(Items.FEATHER, Blocks.WOOL.white()), + entry(Items.FLINT, Blocks.WOOL.black()), entry(Items.LEATHER, Blocks.SPRUCE_PLANKS), entry(Items.GLOWSTONE_DUST, Blocks.GLOWSTONE), - entry(Items.PAPER, Blocks.WHITE_WOOL), + entry(Items.PAPER, Blocks.WOOL.white()), entry(Items.BRICK, Blocks.BRICKS), - entry(Items.INK_SAC, Blocks.BLACK_WOOL), + entry(Items.INK_SAC, Blocks.WOOL.black()), entry(Items.SNOWBALL, Blocks.SNOW_BLOCK), entry(Items.WATER_BUCKET, Blocks.WATER), entry(Items.LAVA_BUCKET, Blocks.LAVA), - entry(Items.MILK_BUCKET, Blocks.WHITE_WOOL), + entry(Items.MILK_BUCKET, Blocks.WOOL.white()), entry(Items.CLAY_BALL, Blocks.CLAY), entry(Items.COCOA_BEANS, Blocks.COCOA), entry(Items.BONE, Blocks.BONE_BLOCK), - entry(Items.COD_BUCKET, Blocks.BROWN_TERRACOTTA), - entry(Items.PUFFERFISH_BUCKET, Blocks.YELLOW_TERRACOTTA), - entry(Items.SALMON_BUCKET, Blocks.PINK_TERRACOTTA), - entry(Items.TROPICAL_FISH_BUCKET, Blocks.ORANGE_TERRACOTTA), - entry(Items.SUGAR, Blocks.WHITE_WOOL), + entry(Items.COD_BUCKET, Blocks.DYED_TERRACOTTA.brown()), + entry(Items.PUFFERFISH_BUCKET, Blocks.DYED_TERRACOTTA.yellow()), + entry(Items.SALMON_BUCKET, Blocks.DYED_TERRACOTTA.pink()), + entry(Items.TROPICAL_FISH_BUCKET, Blocks.DYED_TERRACOTTA.orange()), + entry(Items.SUGAR, Blocks.WOOL.white()), entry(Items.BLAZE_POWDER, Blocks.GOLD_BLOCK), entry(Items.ENDER_PEARL, Blocks.WARPED_PLANKS), entry(Items.NETHER_STAR, Blocks.DIAMOND_BLOCK), @@ -346,13 +346,13 @@ public class HopperCounter entry(Items.HEART_OF_THE_SEA, Blocks.CONDUIT), entry(Items.HONEYCOMB, Blocks.HONEYCOMB_BLOCK), entry(Items.NAME_TAG, Blocks.BONE_BLOCK), - entry(Items.TOTEM_OF_UNDYING, Blocks.YELLOW_TERRACOTTA), + entry(Items.TOTEM_OF_UNDYING, Blocks.DYED_TERRACOTTA.yellow()), entry(Items.TRIDENT, Blocks.PRISMARINE), - entry(Items.GHAST_TEAR, Blocks.WHITE_WOOL), + entry(Items.GHAST_TEAR, Blocks.WOOL.white()), entry(Items.PHANTOM_MEMBRANE, Blocks.BONE_BLOCK), entry(Items.EGG, Blocks.BONE_BLOCK), //entry(Items.,Blocks.), - entry(Items.COPPER_INGOT, Blocks.COPPER_BLOCK), + entry(Items.COPPER_INGOT, Blocks.COPPER_BLOCK.unaffected()), entry(Items.AMETHYST_SHARD, Blocks.AMETHYST_BLOCK)); /** diff --git a/src/main/java/carpet/mixins/Gui_tablistMixin.java b/src/main/java/carpet/mixins/Gui_tablistMixin.java index 128cc36f..f6ea0717 100644 --- a/src/main/java/carpet/mixins/Gui_tablistMixin.java +++ b/src/main/java/carpet/mixins/Gui_tablistMixin.java @@ -3,6 +3,7 @@ package carpet.mixins; import carpet.fakes.PlayerListHudInterface; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.Hud; import net.minecraft.client.gui.components.PlayerTabOverlay; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; @@ -10,7 +11,7 @@ import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; -@Mixin(Gui.class) +@Mixin(Hud.class) public abstract class Gui_tablistMixin { @Shadow diff --git a/src/main/java/carpet/mixins/SystemReport_addScarpetAppsMixin.java b/src/main/java/carpet/mixins/SystemReport_addScarpetAppsMixin.java index b449059e..c68d3b22 100644 --- a/src/main/java/carpet/mixins/SystemReport_addScarpetAppsMixin.java +++ b/src/main/java/carpet/mixins/SystemReport_addScarpetAppsMixin.java @@ -1,7 +1,8 @@ package carpet.mixins; -import java.util.function.Supplier; import java.util.stream.Collectors; + +import net.minecraft.CrashReportDetail; import net.minecraft.SystemReport; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -14,7 +15,7 @@ import carpet.CarpetServer; @Mixin(SystemReport.class) public abstract class SystemReport_addScarpetAppsMixin { - @Shadow public abstract void setDetail(String name, Supplier valueSupplier); + @Shadow public abstract void setDetail(String name, CrashReportDetail valueSupplier); @Inject(method = "", at = @At("RETURN")) private void fillSystemDetails(CallbackInfo info) { diff --git a/src/main/java/carpet/script/utils/FeatureGenerator.java b/src/main/java/carpet/script/utils/FeatureGenerator.java index 5955d889..d5ff798c 100644 --- a/src/main/java/carpet/script/utils/FeatureGenerator.java +++ b/src/main/java/carpet/script/utils/FeatureGenerator.java @@ -40,8 +40,8 @@ import net.minecraft.world.level.levelgen.RandomState; import net.minecraft.world.level.levelgen.VerticalAnchor; import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; import net.minecraft.world.level.levelgen.feature.Feature; +import net.minecraft.world.level.levelgen.feature.configurations.CompositeFeatureConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration; -import net.minecraft.world.level.levelgen.feature.configurations.SimpleRandomFeatureConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.TreeConfiguration; import net.minecraft.world.level.levelgen.feature.featuresize.TwoLayersFeatureSize; import net.minecraft.world.level.levelgen.feature.foliageplacers.BlobFoliagePlacer; @@ -288,7 +288,7 @@ public class FeatureGenerator put("coral_claw", l -> simplePlop(Feature.CORAL_CLAW, FeatureConfiguration.NONE)); put("coral_mushroom", l -> simplePlop(Feature.CORAL_MUSHROOM, FeatureConfiguration.NONE)); - put("coral", l -> simplePlop(Feature.SIMPLE_RANDOM_SELECTOR, new SimpleRandomFeatureConfiguration(HolderSet.direct( + put("coral", l -> simplePlop(Feature.SIMPLE_RANDOM_SELECTOR, new CompositeFeatureConfiguration(HolderSet.direct( PlacementUtils.inlinePlaced(Feature.CORAL_TREE, FeatureConfiguration.NONE), PlacementUtils.inlinePlaced(Feature.CORAL_CLAW, FeatureConfiguration.NONE), PlacementUtils.inlinePlaced(Feature.CORAL_MUSHROOM, FeatureConfiguration.NONE) diff --git a/src/main/java/carpet/script/utils/ShapesRenderer.java b/src/main/java/carpet/script/utils/ShapesRenderer.java index fa77d568..1fc1ef4a 100644 --- a/src/main/java/carpet/script/utils/ShapesRenderer.java +++ b/src/main/java/carpet/script/utils/ShapesRenderer.java @@ -8,7 +8,6 @@ import com.mojang.blaze3d.pipeline.RenderTarget; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.ByteBufferBuilder; import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.Tesselator; import com.mojang.blaze3d.vertex.VertexFormat; import com.mojang.blaze3d.vertex.VertexFormat.Mode; import com.mojang.math.Axis; @@ -144,8 +143,6 @@ public class ShapesRenderer //RenderSystem.polygonOffset(-3f, -3f); //RenderSystem.enablePolygonOffset(); - Tesselator tesselator = Tesselator.getInstance(); - // render double cameraX = camera.position().x; double cameraY = camera.position().y; @@ -177,7 +174,7 @@ public class ShapesRenderer shapes.get(dimensionType).values().forEach(s -> { if ((!s.shape.debug || entityBoxes) && s.shouldRender(dimensionType)) { - s.renderFaces(tesselator, cameraX, cameraY, cameraZ, partialTick, s.shape.seethrough ? onTop : normal); + s.renderFaces(cameraX, cameraY, cameraZ, partialTick, s.shape.seethrough ? onTop : normal); } }); //RenderSystem.lineWidth(1.0F); @@ -289,7 +286,7 @@ public class ShapesRenderer public abstract void renderLines(PoseStack matrices, double cx, double cy, double cz, float partialTick, LevelRenderState levelRenderState, DrawableGizmoPrimitives primitives); - public void renderFaces(Tesselator tesselator, double cx, double cy, double cz, float partialTick, DrawableGizmoPrimitives primitives) + public void renderFaces(double cx, double cy, double cz, float partialTick, DrawableGizmoPrimitives primitives) { } @@ -633,7 +630,7 @@ public class ShapesRenderer } @Override - public void renderFaces(Tesselator tesselator, double cx, double cy, double cz, float partialTick, DrawableGizmoPrimitives primitives) + public void renderFaces(double cx, double cy, double cz, float partialTick, DrawableGizmoPrimitives primitives) { if (shape.fa == 0.0) { @@ -695,7 +692,7 @@ public class ShapesRenderer } @Override - public void renderFaces(Tesselator tesselator, double cx, double cy, double cz, float partialTick, DrawableGizmoPrimitives primitives) + public void renderFaces(double cx, double cy, double cz, float partialTick, DrawableGizmoPrimitives primitives) { if (shape.fa == 0) { @@ -881,7 +878,7 @@ public class ShapesRenderer } @Override - public void renderFaces(Tesselator tesselator, double cx, double cy, double cz, float partialTick, DrawableGizmoPrimitives primitives) + public void renderFaces(double cx, double cy, double cz, float partialTick, DrawableGizmoPrimitives primitives) { if (shape.fa == 0.0) { @@ -920,7 +917,7 @@ public class ShapesRenderer } @Override - public void renderFaces(Tesselator tesselator, double cx, double cy, double cz, float partialTick, DrawableGizmoPrimitives primitives) + public void renderFaces(double cx, double cy, double cz, float partialTick, DrawableGizmoPrimitives primitives) { if (shape.fa == 0.0) { diff --git a/src/main/java/carpet/utils/WoolTool.java b/src/main/java/carpet/utils/WoolTool.java index 761de09c..7d87bdb4 100644 --- a/src/main/java/carpet/utils/WoolTool.java +++ b/src/main/java/carpet/utils/WoolTool.java @@ -3,8 +3,10 @@ package carpet.utils; import carpet.CarpetSettings; import carpet.helpers.HopperCounter; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; import net.minecraft.commands.CommandSourceStack; import net.minecraft.core.BlockPos; @@ -17,6 +19,7 @@ import net.minecraft.world.item.DyeColor; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.ColorCollection; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.MapColor; import net.minecraft.world.phys.Vec3; @@ -35,24 +38,11 @@ public class WoolTool * A map from a wool {@link Block} to its {@link DyeColor} which is used in {@link WoolTool#getWoolColorAtPosition} * to get the colour of wool at a position. */ - private static final Map WOOL_BLOCK_TO_DYE = Map.ofEntries( - entry(Blocks.WHITE_WOOL, DyeColor.WHITE), - entry(Blocks.ORANGE_WOOL, DyeColor.ORANGE), - entry(Blocks.MAGENTA_WOOL, DyeColor.MAGENTA), - entry(Blocks.LIGHT_BLUE_WOOL, DyeColor.LIGHT_BLUE), - entry(Blocks.YELLOW_WOOL, DyeColor.YELLOW), - entry(Blocks.LIME_WOOL, DyeColor.LIME), - entry(Blocks.PINK_WOOL, DyeColor.PINK), - entry(Blocks.GRAY_WOOL, DyeColor.GRAY), - entry(Blocks.LIGHT_GRAY_WOOL, DyeColor.LIGHT_GRAY), - entry(Blocks.CYAN_WOOL, DyeColor.CYAN), - entry(Blocks.PURPLE_WOOL, DyeColor.PURPLE), - entry(Blocks.BLUE_WOOL, DyeColor.BLUE), - entry(Blocks.BROWN_WOOL, DyeColor.BROWN), - entry(Blocks.GREEN_WOOL, DyeColor.GREEN), - entry(Blocks.RED_WOOL, DyeColor.RED), - entry(Blocks.BLACK_WOOL, DyeColor.BLACK) - ); + private static final Map WOOL_BLOCK_TO_DYE = Arrays.stream(DyeColor.values()).collect(Collectors.toUnmodifiableMap( + Blocks.WOOL::pick, // gets the wool block of the colour + color -> color // the value is just the colour itself)) + )); + /** * The method which gets triggered when a player places a carpet, and decides what to do based on the carpet's colour: