Inspired by 2020's April Fools' 20w14infinite Snapshot, this mod brings endless randomly generated dimensions into Minecraft.

Fix Forge tinting logic

+20 -45
+2 -40
common/src/main/java/net/lerariemann/infinity/util/PlatformMethods.java
··· 89 89 return (int)(256 * ((r + 1)/2)) + 256*((int)(256 * ((g + 1)/2)) + 256*(int)(256 * ((b + 1)/2))); 90 90 } 91 91 92 - public static int getBookBoxColour(BlockState state, BlockRenderView world, BlockPos pos, int tintIndex) { 93 - if (pos != null) { 94 - return posToColor(pos); 95 - } 96 - return 16777215; 97 - } 98 - 99 - public static int getOverlayColorFromComponents(ItemStack stack, int layer) { 100 - if (stack.getNbt() != null) { 101 - int color = stack.getNbt().getInt("key_color"); 102 - if (layer == 1) { 103 - return color; 104 - } 105 - } 106 - return 0xFFFFFF; 107 - } 108 - 109 - public static int getNeitherPortalColour(BlockState state, BlockRenderView world, BlockPos pos, int tintIndex) { 110 - if (world != null && pos != null) { 111 - BlockEntity blockEntity = world.getBlockEntity(pos); 112 - if (blockEntity instanceof InfinityPortalBlockEntity be) { 113 - Object j = be.getTint(); 114 - return (int)j & 0xFFFFFF; 115 - } 116 - } 117 - return 0xFFFFFF; 118 - } 119 - 120 - public static int getBiomeBottleColor(BlockState state, BlockRenderView world, BlockPos pos, int tintIndex) { 121 - if (world != null && pos != null) { 122 - BlockEntity blockEntity = world.getBlockEntity(pos); 123 - if (blockEntity instanceof BiomeBottleBlockEntity be) { 124 - Object j = be.getTint(); 125 - return (int)j & 0xFFFFFF; 126 - } 127 - } 128 - return 0xFFFFFF; 129 - } 130 - 131 92 @ExpectPlatform 132 93 public static <T extends Item> void addAfter(RegistrySupplier<T> blockItem, RegistryKey<ItemGroup> group, Item item) { 133 94 throw new AssertionError(); ··· 191 152 } 192 153 193 154 /** 194 - * Neoforge-exclusive method of testing if a mob is located in iridescence as far as fluid types are concerned. 155 + * Forge-exclusive method of testing if a mob is located in iridescence as far as fluid types are concerned. 195 156 * Used only in mixins, to fix the neoforge loader stripping mobs of ability to swim in non-water fluids. 196 157 * On Fabric, returns false. 197 158 */ ··· 199 160 public static boolean acidTest(Entity entity, boolean eyes) { 200 161 throw new AssertionError(); 201 162 } 163 + 202 164 @ExpectPlatform 203 165 public static double acidHeightTest(Entity entity) { 204 166 throw new AssertionError();
+1 -2
fabric/src/main/java/net/lerariemann/infinity/fabric/client/InfinityModFabricClient.java
··· 29 29 ColorProviderRegistry.ITEM.register(InfinityMethods::getOverlayColorFromComponents, 30 30 ModItems.TRANSFINITE_KEY.get(), 31 31 ModItems.BIOME_BOTTLE_ITEM.get(), 32 - ModItems.F4.get()); 33 - ColorProviderRegistry.ITEM.register(InfinityMethods::getOverlayColorFromComponents, 32 + ModItems.F4.get(), 34 33 ModItems.CHROMATIC_WOOL.get(), 35 34 ModItems.CHROMATIC_CARPET.get(), 36 35 ModItems.CHROMATIC_MATTER.get());
+17 -3
forge/src/main/java/net/lerariemann/infinity/forge/client/InfinityModForgeClient.java
··· 5 5 import net.lerariemann.infinity.registry.core.ModBlocks; 6 6 import net.lerariemann.infinity.registry.core.ModItemFunctions; 7 7 import net.lerariemann.infinity.registry.core.ModItems; 8 + import net.lerariemann.infinity.util.InfinityMethods; 8 9 import net.lerariemann.infinity.util.PlatformMethods; 9 10 import net.lerariemann.infinity.compat.forge.ModConfigFactory; 10 11 import net.minecraft.client.render.RenderLayer; ··· 35 36 // Apply colour handlers to tint Neither Portals and Book Boxes. 36 37 @SubscribeEvent 37 38 public static void registerBlockColorHandlers(RegisterColorHandlersEvent.Block event) { 38 - event.register(PlatformMethods::getNeitherPortalColour, ModBlocks.PORTAL.get()); 39 - event.register(PlatformMethods::getBookBoxColour, ModBlocks.BOOK_BOX.get(), ModBlocks.IRIDESCENCE.get()); 39 + event.register(InfinityMethods::getBlockEntityColor, 40 + ModBlocks.PORTAL.get(), 41 + ModBlocks.BIOME_BOTTLE.get(), 42 + ModBlocks.CHROMATIC_WOOL.get(), 43 + ModBlocks.CHROMATIC_CARPET.get()); 44 + event.register(InfinityMethods::getBookBoxColor, 45 + ModBlocks.BOOK_BOX.get()); 40 46 } 41 47 @SubscribeEvent 42 48 public static void registerItemColorHandlers(RegisterColorHandlersEvent.Item event) { 43 - event.register(PlatformMethods::getOverlayColorFromComponents, ModItems.TRANSFINITE_KEY.get(), ModItems.BIOME_BOTTLE_ITEM.get()); 49 + event.register(InfinityMethods::getOverlayColorFromComponents, 50 + ModItems.TRANSFINITE_KEY.get(), 51 + ModItems.BIOME_BOTTLE_ITEM.get(), 52 + ModItems.F4.get(), 53 + ModItems.CHROMATIC_WOOL.get(), 54 + ModItems.CHROMATIC_CARPET.get(), 55 + ModItems.CHROMATIC_MATTER.get()); 56 + event.register(InfinityMethods::getPortalItemColor, 57 + ModItems.PORTAL_ITEM.get()); 44 58 } 45 59 @SubscribeEvent 46 60 public static void registerModelPredicates(FMLClientSetupEvent event) {