Skip to content

Commit

Permalink
Squashing bugs:
Browse files Browse the repository at this point in the history
- Updated TFC dependency (Closes #48).
- Added sandSilica ore dictionary registration to just after items (Closes #47).
- Fixed missing energy gauge bottom pixel (Closes #44).
- Added lang entries to GUI tooltips (Closes #43).
- Fixed glass block mold knapping recipe (Closes #42).
- Wire drawing recipes will now ignore alpha (Closes #41).
  • Loading branch information
DisasterMoo committed Apr 13, 2020
1 parent b33a87a commit 5c71b33
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 33 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ apply plugin: 'net.minecraftforge.gradle.forge'
if (System.getenv('VERSION') != null) {
version = System.getenv('VERSION')
} else {
version = "MC1.12.2-1.2.6"
version = "1.2.9"
}
group = "tfctech"
archivesBaseName = "TFCTech-Unofficial"
Expand Down
Binary file not shown.
4 changes: 1 addition & 3 deletions src/main/java/tfctech/TFCTech.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import tfctech.client.TechGuiHandler;
import tfctech.network.PacketLatexUpdate;
import tfctech.network.PacketTileEntityUpdate;
import tfctech.objects.items.TechItems;
import tfctech.registry.TechFoodTraits;

@SuppressWarnings("WeakerAccess")
Expand All @@ -23,7 +22,7 @@ public class TFCTech
public static final String MODID = "tfctech";
public static final String NAME = "TFCTech Unofficial";
public static final String VERSION = "@VERSION@";
public static final String DEPENDENCIES = "required-after:tfc@[0.29.4,);after:ic2;after:gregtech";
public static final String DEPENDENCIES = "required-after:tfc@[1.0.0,);after:ic2;after:gregtech";

@Mod.Instance
private static TFCTech instance = null;
Expand Down Expand Up @@ -54,7 +53,6 @@ public void init(FMLInitializationEvent event)
FMLInterModComms.sendMessage("waila", "register", "tfctech.compat.waila.WailaPlugin.callbackRegister");
FMLInterModComms.sendFunctionMessage("theoneprobe", "getTheOneProbe", "tfctech.compat.waila.TOPPlugin");
TechFoodTraits.init();
TechItems.init();
}

@EventHandler
Expand Down
9 changes: 5 additions & 4 deletions src/main/java/tfctech/client/gui/GuiElectricForge.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.io.IOException;

import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.util.ResourceLocation;
Expand Down Expand Up @@ -40,7 +41,7 @@ protected void renderHoveredToolTip(int mouseX, int mouseY)
if (mouseX >= guiLeft + 153 && mouseX <= guiLeft + 153 + 18 && mouseY >= guiTop + 6 && mouseY <= guiTop + 6 + 59)
{
int energy = tile.getField(1);
drawHoveringText(String.format("%s RF/%s RF", energy, tile.getEnergyCapacity()), mouseX, mouseY);
drawHoveringText(I18n.format("tooltip.tfctech.gui.energy_format", energy, tile.getEnergyCapacity()), mouseX, mouseY);
}
super.renderHoveredToolTip(mouseX, mouseY);
}
Expand Down Expand Up @@ -70,13 +71,13 @@ protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, i
drawTexturedModalRect(guiLeft + 8, guiTop + 66 - temperaturePixels, 36, 54, 15, 5);

// Draw the energy bar
int energyPixels = 59 * tile.getField(1) / tile.getEnergyCapacity();
int emptyPixels = 59 - energyPixels;
int energyPixels = 60 * tile.getField(1) / tile.getEnergyCapacity();
int emptyPixels = 60 - energyPixels;
drawTexturedModalRect(guiLeft + 153, guiTop + 6, 0, 0, 18, emptyPixels);
drawTexturedModalRect(guiLeft + 153, guiTop + 6 + emptyPixels, 18, emptyPixels, 18, energyPixels);

//Draw the temperature value (for higher than brilliant white)
String temp = String.format("%s C", targetTemperature);
String temp = I18n.format("tooltip.tfctech.gui.electric_forge.temperature_format", targetTemperature);
int x = guiLeft + 41 - fontRenderer.getStringWidth(temp) / 2;
int y = guiTop + 15;
fontRenderer.drawString(temp, x, y, 0x000000);
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/tfctech/client/gui/GuiInductionCrucible.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package tfctech.client.gui;

import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;

Expand All @@ -21,7 +22,7 @@ protected void renderHoveredToolTip(int mouseX, int mouseY)
if (mouseX >= guiLeft + 8 && mouseX <= guiLeft + 8 + 16 && mouseY >= guiTop + 79 && mouseY <= guiTop + 79 + 57)
{
int energy = tile.getField(1);
drawHoveringText(String.format("%s RF/%s RF", energy, ((TEInductionCrucible) tile).getEnergyCapacity()), mouseX, mouseY);
drawHoveringText(I18n.format("tooltip.tfctech.gui.energy_format", energy, ((TEInductionCrucible) tile).getEnergyCapacity()), mouseX, mouseY);
}
super.renderHoveredToolTip(mouseX, mouseY);
}
Expand All @@ -33,8 +34,8 @@ protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, i

// Draw the energy bar
mc.getTextureManager().bindTexture(TechGuiHandler.GUI_ELEMENTS);
int energyPixels = 59 * tile.getField(1) / ((TEInductionCrucible) tile).getEnergyCapacity();
int emptyPixels = 59 - energyPixels;
int energyPixels = 60 * tile.getField(1) / ((TEInductionCrucible) tile).getEnergyCapacity();
int emptyPixels = 60 - energyPixels;
drawTexturedModalRect(guiLeft + 7, guiTop + 78, 0, 0, 18, emptyPixels);
drawTexturedModalRect(guiLeft + 7, guiTop + 78 + emptyPixels, 18, emptyPixels, 18, energyPixels);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ public void render(Entity entity, float f, float f1, float f2, float f3, float f
float r = ((wireColor >> 16) & 0xFF) / 255F;
float g = ((wireColor >> 8) & 0xFF) / 255F;
float b = (wireColor & 0xFF) / 255F;
float a = ((wireColor >> 24) & 0xFF) / 255F;
float a = 0xFF; // ignore alpha, make it always 100%

GlStateManager.color(r, g, b, a);
this.wire.render(f5);
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/tfctech/compat/jei/TechJEIPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.fluids.capability.IFluidHandlerItem;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;

import mezz.jei.api.IModPlugin;
import mezz.jei.api.IModRegistry;
Expand Down Expand Up @@ -109,8 +109,7 @@ public void register(IModRegistry registry)
List<CastingRecipeWrapper> castingList = new ArrayList<>();
TFCRegistries.METALS.getValuesCollection()
.forEach(metal -> {
//noinspection deprecation
if (ReflectionHelper.getPrivateValue(Metal.class, metal, "usable").equals(true))
if (ObfuscationReflectionHelper.getPrivateValue(Metal.class, metal, "usable").equals(true))
{
for (ItemTechMetal.ItemType type : ItemTechMetal.ItemType.values())
{
Expand Down
11 changes: 6 additions & 5 deletions src/main/java/tfctech/objects/items/TechItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.registries.IForgeRegistry;

Expand Down Expand Up @@ -197,8 +197,7 @@ public boolean hasContainerItem(ItemStack stack)

for (Metal metal : TFCRegistries.METALS.getValuesCollection())
{
//noinspection deprecation
if (ReflectionHelper.getPrivateValue(Metal.class, metal, "usable").equals(false))
if (ObfuscationReflectionHelper.getPrivateValue(Metal.class, metal, "usable").equals(false))
continue;
//noinspection ConstantConditions
metalItems.add(register(r, "metal/" + metal.getRegistryName().getPath().toLowerCase() + "_strip", ItemTechMetal.ItemType.create(metal, ItemTechMetal.ItemType.STRIP), CT_METAL));
Expand Down Expand Up @@ -245,12 +244,14 @@ public boolean hasContainerItem(ItemStack stack)
OreDictionary.registerOre(((ItemMiscTech) item).getOreDictionary(), item);
}
}
// This is probably safe since block registers first than items across all mods
registerTFCOreDict();
}

/**
* Add missing ore dictionary to TFC
* Register new ore dictionaries to TFC
*/
public static void init()
private static void registerTFCOreDict()
{
BlocksTFC.getAllBlockRockVariants().forEach(x -> {
if (x.getType() == Rock.Type.SAND && isSilica(x))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import net.minecraftforge.fluids.capability.FluidTankPropertiesWrapper;
import net.minecraftforge.fluids.capability.IFluidHandler;
import net.minecraftforge.fluids.capability.IFluidTankProperties;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

Expand Down Expand Up @@ -139,8 +139,8 @@ public int fill(FluidStack resource, boolean doFill)
if (resource != null)
{
Metal metal = FluidsTFC.getMetalFromFluid(resource.getFluid());
//noinspection ConstantConditions,deprecation
if (metal != null && ReflectionHelper.getPrivateValue(Metal.class, metal, "usable").equals(true))
//noinspection ConstantConditions
if (metal != null && ObfuscationReflectionHelper.getPrivateValue(Metal.class, metal, "usable").equals(true))
{
int fillAmount = tank.fill(resource, doFill);
if (fillAmount == tank.getFluidAmount())
Expand Down
16 changes: 6 additions & 10 deletions src/main/java/tfctech/registry/TechRecipes.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.registries.IForgeRegistry;
import net.minecraftforge.registries.IForgeRegistryModifiable;
Expand Down Expand Up @@ -118,8 +118,7 @@ public static void onRegisterAnvilRecipeEvent(RegistryEvent.Register<AnvilRecipe

for (Metal metal : TFCRegistries.METALS.getValuesCollection())
{
//noinspection deprecation
if (ReflectionHelper.getPrivateValue(Metal.class, metal, "usable").equals(false))
if (ObfuscationReflectionHelper.getPrivateValue(Metal.class, metal, "usable").equals(false))
continue;
IIngredient<ItemStack> ingredient;
//Register all wires
Expand Down Expand Up @@ -175,7 +174,7 @@ public static void onRegisterKnappingRecipeEvent(RegistryEvent.Register<Knapping
r.registerAll(
new KnappingRecipeSimple(KnappingType.CLAY, true, new ItemStack(TechItems.UNFIRED_RACKWHEEL_PIECE), "XXXXX", "X XXX", "X XX", "XX X", "XXXXX").setRegistryName("clay_rackwheel_piece"),
new KnappingRecipeSimple(KnappingType.CLAY, true, new ItemStack(TechItems.UNFIRED_MOLD_PANE), "XXXXX", "X X", "X X", "X X", "XXXXX").setRegistryName("clay_mold_pane"),
new KnappingRecipeSimple(KnappingType.CLAY, true, new ItemStack(TechItems.UNFIRED_MOLD_BLOCK), "X X", "X X", "X X", "X X", "XXXXX").setRegistryName("clay_mold_block")
new KnappingRecipeSimple(KnappingType.CLAY, true, new ItemStack(TechItems.UNFIRED_MOLD_BLOCK), "X X", "X X", "X X", "X X", " XXX ").setRegistryName("clay_mold_block")
);
}

Expand Down Expand Up @@ -221,8 +220,7 @@ public static void onRegisterWireDrawingRecipeEvent(RegistryEvent.Register<WireD
//Register all wires
for (Metal metal : TFCRegistries.METALS.getValuesCollection())
{
//noinspection deprecation
if (ReflectionHelper.getPrivateValue(Metal.class, metal, "usable").equals(false))
if (ObfuscationReflectionHelper.getPrivateValue(Metal.class, metal, "usable").equals(false))
continue;
for (int i = 4; i > 0; i--)
{
Expand All @@ -249,8 +247,7 @@ public static void onRegisterWeldingRecipeEvent(RegistryEvent.Register<WeldingRe
// Tier V-VI = Steel sleeve
for (Metal metal : TFCRegistries.METALS.getValuesCollection())
{
//noinspection deprecation
if (ReflectionHelper.getPrivateValue(Metal.class, metal, "usable").equals(false))
if (ObfuscationReflectionHelper.getPrivateValue(Metal.class, metal, "usable").equals(false))
continue;
IIngredient<ItemStack> ingredient1 = IIngredient.of(new ItemStack(ItemTechMetal.get(metal, ItemTechMetal.ItemType.RACKWHEEL)));
IIngredient<ItemStack> ingredient2;
Expand Down Expand Up @@ -295,8 +292,7 @@ public static void onRegisterCraftingRecipeEvent(RegistryEvent.Register<IRecipe>
ResourceLocation groupScrew = new ResourceLocation(MODID, "screw");
for (Metal metal : TFCRegistries.METALS.getValuesCollection())
{
//noinspection deprecation
if (ReflectionHelper.getPrivateValue(Metal.class, metal, "usable").equals(false))
if (ObfuscationReflectionHelper.getPrivateValue(Metal.class, metal, "usable").equals(false))
continue;

/*
Expand Down
5 changes: 5 additions & 0 deletions src/main/resources/assets/tfctech/lang/en_us.lang
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ tooltip.tfctech.smeltery.invalid=Smeltery structure not formed
## Status
tooltip.tfctech.wiredraw.low_tier=Drawing Plate is too low tier!

## GUIs
tooltip.tfctech.gui.energy_format=%s RF/%s RF
tooltip.tfctech.gui.electric_forge.temperature_format=%s ºC


#Config
config.tfctech=TFCTech
config.tfctech.tooltip=Settings for TFCTech
Expand Down

0 comments on commit 5c71b33

Please sign in to comment.