mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-25 14:24:25 +00:00
qf
This commit is contained in:
1 parent
531e55a013
commit
4bbfd2f68e
4 files changed
+27
-5
No files matched your search
@@ -14,6 +14,8 @@ import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
|||||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||||
|
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
@Mod(modid = FluidCraft.MODID, version = FluidCraft.VERSION, useMetadata = true)
|
@Mod(modid = FluidCraft.MODID, version = FluidCraft.VERSION, useMetadata = true)
|
||||||
public class FluidCraft {
|
public class FluidCraft {
|
||||||
|
|
||||||
@@ -26,8 +28,11 @@ public class FluidCraft {
|
|||||||
@SidedProxy(clientSide = "com.glodblock.github.proxy.ClientProxy", serverSide = "com.glodblock.github.proxy.CommonProxy")
|
@SidedProxy(clientSide = "com.glodblock.github.proxy.ClientProxy", serverSide = "com.glodblock.github.proxy.CommonProxy")
|
||||||
public static CommonProxy proxy;
|
public static CommonProxy proxy;
|
||||||
|
|
||||||
|
public static Logger log;
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void onPreInit(FMLPreInitializationEvent event) {
|
public void onPreInit(FMLPreInitializationEvent event) {
|
||||||
|
log = event.getModLog();
|
||||||
ModAndClassUtil.init();
|
ModAndClassUtil.init();
|
||||||
proxy.preInit(event);
|
proxy.preInit(event);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.glodblock.github.client.render;
|
package com.glodblock.github.client.render;
|
||||||
|
|
||||||
|
import com.glodblock.github.util.ModAndClassUtil;
|
||||||
|
import gregtech.api.unification.material.Materials;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||||
@@ -24,7 +26,9 @@ public class DropColourHandler {
|
|||||||
public int getColour(FluidStack fluidStack) {
|
public int getColour(FluidStack fluidStack) {
|
||||||
Fluid fluid = fluidStack.getFluid();
|
Fluid fluid = fluidStack.getFluid();
|
||||||
int colour = fluid.getColor(fluidStack);
|
int colour = fluid.getColor(fluidStack);
|
||||||
return colour != -1 ? colour : getColour(fluid);
|
if (ModAndClassUtil.GT && colour == 0xFFFFFFFF)
|
||||||
|
return runBidAidFix(fluidStack);
|
||||||
|
return colour != 0xFFFFFFFF ? colour : getColour(fluid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getColour(Fluid fluid) {
|
public int getColour(Fluid fluid) {
|
||||||
@@ -33,7 +37,7 @@ public class DropColourHandler {
|
|||||||
return cached;
|
return cached;
|
||||||
}
|
}
|
||||||
int colour = fluid.getColor();
|
int colour = fluid.getColor();
|
||||||
if (colour == -1) {
|
if (colour == 0xFFFFFFFF) {
|
||||||
TextureAtlasSprite sprite = Minecraft.getMinecraft().getTextureMapBlocks()
|
TextureAtlasSprite sprite = Minecraft.getMinecraft().getTextureMapBlocks()
|
||||||
.getTextureExtry(fluid.getStill().toString());
|
.getTextureExtry(fluid.getStill().toString());
|
||||||
if (sprite != null && sprite.getFrameCount() > 0) {
|
if (sprite != null && sprite.getFrameCount() > 0) {
|
||||||
@@ -59,4 +63,12 @@ public class DropColourHandler {
|
|||||||
return colour;
|
return colour;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Need to find a better way to replace this.
|
||||||
|
private int runBidAidFix(FluidStack fluidStack) {
|
||||||
|
if (fluidStack.isFluidEqual(Materials.Helium.getFluid(1))) {
|
||||||
|
return 0xFFFCFF90;
|
||||||
|
}
|
||||||
|
return getColour(fluidStack.getFluid());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -45,14 +45,14 @@ public class ClientProxy extends CommonProxy {
|
|||||||
super.init(event);
|
super.init(event);
|
||||||
Minecraft.getMinecraft().getItemColors().registerItemColorHandler((s, i) -> {
|
Minecraft.getMinecraft().getItemColors().registerItemColorHandler((s, i) -> {
|
||||||
FluidStack fluid = ItemFluidDrop.getFluidStack(s);
|
FluidStack fluid = ItemFluidDrop.getFluidStack(s);
|
||||||
return fluid != null ? dropColourHandler.getColour(fluid) : -1;
|
return fluid != null ? dropColourHandler.getColour(fluid) : 0xFFFFFFFF;
|
||||||
}, FCItems.FLUID_DROP);
|
}, FCItems.FLUID_DROP);
|
||||||
Minecraft.getMinecraft().getItemColors().registerItemColorHandler((s, i) -> {
|
Minecraft.getMinecraft().getItemColors().registerItemColorHandler((s, i) -> {
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
return -1;
|
return 0xFFFFFFFF;
|
||||||
}
|
}
|
||||||
FluidStack fluid = ItemFluidPacket.getFluidStack(s);
|
FluidStack fluid = ItemFluidPacket.getFluidStack(s);
|
||||||
return fluid != null ? fluid.getFluid().getColor(fluid) : -1;
|
return fluid != null ? fluid.getFluid().getColor(fluid) : 0xFFFFFFFF;
|
||||||
}, FCItems.FLUID_PACKET);
|
}, FCItems.FLUID_PACKET);
|
||||||
Minecraft.getMinecraft().getItemColors().registerItemColorHandler((s, i) -> AEColor.TRANSPARENT.getVariantByTintIndex(i), FCItems.PART_FLUID_PATTERN_TERMINAL);
|
Minecraft.getMinecraft().getItemColors().registerItemColorHandler((s, i) -> AEColor.TRANSPARENT.getVariantByTintIndex(i), FCItems.PART_FLUID_PATTERN_TERMINAL);
|
||||||
Minecraft.getMinecraft().getItemColors().registerItemColorHandler((s, i) -> AEColor.TRANSPARENT.getVariantByTintIndex(i), FCItems.PART_EXTENDED_FLUID_PATTERN_TERMINAL);
|
Minecraft.getMinecraft().getItemColors().registerItemColorHandler((s, i) -> AEColor.TRANSPARENT.getVariantByTintIndex(i), FCItems.PART_EXTENDED_FLUID_PATTERN_TERMINAL);
|
||||||
|
|||||||
@@ -5,11 +5,16 @@ import net.minecraftforge.fml.common.Loader;
|
|||||||
public final class ModAndClassUtil {
|
public final class ModAndClassUtil {
|
||||||
|
|
||||||
public static boolean AUTO_P = false;
|
public static boolean AUTO_P = false;
|
||||||
|
public static boolean GT = false;
|
||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
if (Loader.isModLoaded("packagedauto")) {
|
if (Loader.isModLoaded("packagedauto")) {
|
||||||
AUTO_P = true;
|
AUTO_P = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Loader.isModLoaded("gregtech")) {
|
||||||
|
GT = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user