tangled
alpha
login
or
join now
codexarchonic.nekoweb.org
/
ProjectInfinity
0
fork
atom
Inspired by 2020's April Fools' 20w14infinite Snapshot, this mod brings endless randomly generated dimensions into Minecraft.
0
fork
atom
overview
issues
6
pulls
pipelines
Fix Forge tinting logic
cassian.cc
1 year ago
0fd9f05c
3e836527
+20
-45
3 changed files
expand all
collapse all
unified
split
common
src
main
java
net
lerariemann
infinity
util
PlatformMethods.java
fabric
src
main
java
net
lerariemann
infinity
fabric
client
InfinityModFabricClient.java
forge
src
main
java
net
lerariemann
infinity
forge
client
InfinityModForgeClient.java
+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
92
-
public static int getBookBoxColour(BlockState state, BlockRenderView world, BlockPos pos, int tintIndex) {
93
93
-
if (pos != null) {
94
94
-
return posToColor(pos);
95
95
-
}
96
96
-
return 16777215;
97
97
-
}
98
98
-
99
99
-
public static int getOverlayColorFromComponents(ItemStack stack, int layer) {
100
100
-
if (stack.getNbt() != null) {
101
101
-
int color = stack.getNbt().getInt("key_color");
102
102
-
if (layer == 1) {
103
103
-
return color;
104
104
-
}
105
105
-
}
106
106
-
return 0xFFFFFF;
107
107
-
}
108
108
-
109
109
-
public static int getNeitherPortalColour(BlockState state, BlockRenderView world, BlockPos pos, int tintIndex) {
110
110
-
if (world != null && pos != null) {
111
111
-
BlockEntity blockEntity = world.getBlockEntity(pos);
112
112
-
if (blockEntity instanceof InfinityPortalBlockEntity be) {
113
113
-
Object j = be.getTint();
114
114
-
return (int)j & 0xFFFFFF;
115
115
-
}
116
116
-
}
117
117
-
return 0xFFFFFF;
118
118
-
}
119
119
-
120
120
-
public static int getBiomeBottleColor(BlockState state, BlockRenderView world, BlockPos pos, int tintIndex) {
121
121
-
if (world != null && pos != null) {
122
122
-
BlockEntity blockEntity = world.getBlockEntity(pos);
123
123
-
if (blockEntity instanceof BiomeBottleBlockEntity be) {
124
124
-
Object j = be.getTint();
125
125
-
return (int)j & 0xFFFFFF;
126
126
-
}
127
127
-
}
128
128
-
return 0xFFFFFF;
129
129
-
}
130
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
194
-
* Neoforge-exclusive method of testing if a mob is located in iridescence as far as fluid types are concerned.
155
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
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
32
-
ModItems.F4.get());
33
33
-
ColorProviderRegistry.ITEM.register(InfinityMethods::getOverlayColorFromComponents,
32
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
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
38
-
event.register(PlatformMethods::getNeitherPortalColour, ModBlocks.PORTAL.get());
39
39
-
event.register(PlatformMethods::getBookBoxColour, ModBlocks.BOOK_BOX.get(), ModBlocks.IRIDESCENCE.get());
39
39
+
event.register(InfinityMethods::getBlockEntityColor,
40
40
+
ModBlocks.PORTAL.get(),
41
41
+
ModBlocks.BIOME_BOTTLE.get(),
42
42
+
ModBlocks.CHROMATIC_WOOL.get(),
43
43
+
ModBlocks.CHROMATIC_CARPET.get());
44
44
+
event.register(InfinityMethods::getBookBoxColor,
45
45
+
ModBlocks.BOOK_BOX.get());
40
46
}
41
47
@SubscribeEvent
42
48
public static void registerItemColorHandlers(RegisterColorHandlersEvent.Item event) {
43
43
-
event.register(PlatformMethods::getOverlayColorFromComponents, ModItems.TRANSFINITE_KEY.get(), ModItems.BIOME_BOTTLE_ITEM.get());
49
49
+
event.register(InfinityMethods::getOverlayColorFromComponents,
50
50
+
ModItems.TRANSFINITE_KEY.get(),
51
51
+
ModItems.BIOME_BOTTLE_ITEM.get(),
52
52
+
ModItems.F4.get(),
53
53
+
ModItems.CHROMATIC_WOOL.get(),
54
54
+
ModItems.CHROMATIC_CARPET.get(),
55
55
+
ModItems.CHROMATIC_MATTER.get());
56
56
+
event.register(InfinityMethods::getPortalItemColor,
57
57
+
ModItems.PORTAL_ITEM.get());
44
58
}
45
59
@SubscribeEvent
46
60
public static void registerModelPredicates(FMLClientSetupEvent event) {