NEI handler, fixed new fluid rendering

This commit is contained in:
Bob 2022-02-03 00:03:13 +01:00
parent b31a465a08
commit 2538a071ce
7 changed files with 43 additions and 18 deletions

View File

@ -0,0 +1,11 @@
package com.hbm.handler.nei;
import com.hbm.blocks.ModBlocks;
import com.hbm.inventory.recipes.SolidificationRecipes;
public class SolidificationHandler extends NEIUniversalHandler {
public SolidificationHandler() {
super("ntmSolidification", "Solidification", ModBlocks.machine_solidifier, SolidificationRecipes.getRecipes());
}
}

View File

@ -256,18 +256,10 @@ public class FluidTank {
//Used in the GUI rendering, renders correct fluid type in container with progress
@Deprecated //fuck you
public void renderTank(GuiContainer gui, int x, int y, int tx, int ty, int width, int height) {
/*
* A message to 2017 Bob: You know you could have included the texture bind in this method, right?
* Why does it always have to be that one extra line for every fucking gauge, which is only good for being failure points?
* Why did you seriously think that was an acceptable way of doing things?
*/
int i = (fluid * height) / maxFluid;
gui.drawTexturedModalRect(x, y - i, tx, ty - i, width, i);
renderTank(x, y - height, 1, width, height);
}
/** Not yet tested, in theory the UV should loop, allowing a single quad to properly display the tiling fluid texture. */
/** Works flawlessly, now we just have to add alpha compatibility and boom, sexo. */
public void renderTank(int x, int y, double z, int width, int height) {
Minecraft.getMinecraft().getTextureManager().bindTexture(type.getTexture());
@ -279,10 +271,10 @@ public class FluidTank {
double minY = y + (height - i);
double maxY = y + height;
double minU = 1 - i / 16;
double maxU = 1;
double minV = 0;
double maxV = width / 16;
double minV = 1D - i / 16D;
double maxV = 1D;
double minU = 0D;
double maxU = width / 16D;
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();

View File

@ -63,7 +63,7 @@ public class FluidType {
this.symbol = symbol;
this.temperature = temperature;
Collections.addAll(this.traits, traits);
this.texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/fluids/" + name + ".png");
this.texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/fluids/" + name.toLowerCase() + ".png");
this.id = Fluids.registerSelf(this);
}

View File

@ -62,9 +62,11 @@ public class GUIBarrel extends GuiInfoContainer {
int i = tank.mode;
drawTexturedModalRect(guiLeft + 151, guiTop + 34, 176, i * 18, 18, 18);
Minecraft.getMinecraft().getTextureManager().bindTexture(tank.tank.getSheet());
/*Minecraft.getMinecraft().getTextureManager().bindTexture(tank.tank.getSheet());
tank.tank.renderTank(this, guiLeft + 71, guiTop + 69, tank.tank.getTankType().textureX() * FluidTank.x, tank.tank.getTankType().textureY() * FluidTank.y, 16, 52);
tank.tank.renderTank(this, guiLeft + 71 + 16, guiTop + 69, tank.tank.getTankType().textureX() * FluidTank.x, tank.tank.getTankType().textureY() * FluidTank.y, 16, 52);
tank.tank.renderTank(this, guiLeft + 71 + 32, guiTop + 69, tank.tank.getTankType().textureX() * FluidTank.x, tank.tank.getTankType().textureY() * FluidTank.y, 2, 52);
tank.tank.renderTank(this, guiLeft + 71 + 32, guiTop + 69, tank.tank.getTankType().textureX() * FluidTank.x, tank.tank.getTankType().textureY() * FluidTank.y, 2, 52);*/
tank.tank.renderTank(guiLeft + 71, guiTop + 17, this.zLevel, 34, 52);
}
}

View File

@ -3,11 +3,12 @@ package com.hbm.inventory.recipes;
import static com.hbm.inventory.fluid.Fluids.*;
import java.util.HashMap;
import java.util.Map.Entry;
import com.hbm.inventory.FluidStack;
import com.hbm.inventory.OreDictManager.DictFrame;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.items.ItemEnums.EnumTarType;
import com.hbm.items.machine.ItemFluidIcon;
import com.hbm.items.ModItems;
import com.hbm.util.Tuple.Pair;
@ -88,4 +89,20 @@ public class SolidificationRecipes {
public static Pair<Integer, ItemStack> getOutput(FluidType type) {
return recipes.get(type);
}
public static HashMap<ItemStack, ItemStack> getRecipes() {
HashMap<ItemStack, ItemStack> recipes = new HashMap<ItemStack, ItemStack>();
for(Entry<FluidType, Pair<Integer, ItemStack>> entry : SolidificationRecipes.recipes.entrySet()) {
FluidType type = entry.getKey();
int amount = entry.getValue().getKey();
ItemStack out = entry.getValue().getValue().copy();
recipes.put(ItemFluidIcon.make(type, amount), out);
}
return recipes;
}
}

View File

@ -69,6 +69,8 @@ public class NEIConfig implements IConfigureNEI {
}
API.registerRecipeHandler(new LiquefactionHandler());
API.registerUsageHandler(new LiquefactionHandler());
API.registerRecipeHandler(new SolidificationHandler());
API.registerUsageHandler(new SolidificationHandler());
//Some things are even beyond my control...or are they?
API.hideItem(ItemBattery.getEmptyBattery(ModItems.memory));

View File

@ -240,6 +240,7 @@ public class TileMappings {
put(TileEntityDeuteriumExtractor.class, "tileentity_deuterium_extractor");
put(TileEntityDeuteriumTower.class, "tileentity_deuterium_tower");
put(TileEntityMachineLiquefactor.class, "tileentity_liquefactor");
put(TileEntityMachineSolidifier.class, "tileentity_solidifier");
put(TileEntityMachineOilWell.class, "tileentity_derrick");
put(TileEntityMachinePumpjack.class, "tileentity_machine_pumpjack");