mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-28 07:36:01 +00:00
Fix runtime texture errors, fixed JEI errors, fixed damage display, fixed naming
This commit is contained in:
1 parent
cfe3546785
commit
89905c836b
53 files changed
+173
-41
No files matched your search
@@ -452,7 +452,7 @@ public class ClientProxy extends CommonProxy
|
||||
|
||||
for(int i = 0; i < EnumColor.DYES.length; i++)
|
||||
{
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.GlowPanel), i, new ModelResourceLocation("mekanism:glow_panel", "inventory"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.GlowPanel), i, new ModelResourceLocation("mekanism:glowpanel", "inventory"));
|
||||
}
|
||||
|
||||
for(MachineType type : MachineType.values())
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
package mekanism.client.jei;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mezz.jei.api.ingredients.IIngredientHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
public class GasStackHelper implements IIngredientHelper<GasStack>
|
||||
{
|
||||
@Override
|
||||
public List<GasStack> expandSubtypes(List<GasStack> contained)
|
||||
{
|
||||
return contained;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public GasStack getMatch(Iterable<GasStack> ingredients, GasStack toMatch)
|
||||
{
|
||||
for(GasStack stack : ingredients)
|
||||
{
|
||||
if(toMatch.getGas() == stack.getGas())
|
||||
{
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName(GasStack ingredient)
|
||||
{
|
||||
return ingredient.getGas().getLocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueId(GasStack ingredient)
|
||||
{
|
||||
return "gas:" + ingredient.getGas().getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getWildcardId(GasStack ingredient)
|
||||
{
|
||||
return getUniqueId(ingredient);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModId(GasStack ingredient)
|
||||
{
|
||||
return ingredient.getGas().getIcon().getResourceDomain();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<Color> getColors(GasStack ingredient)
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack cheatIngredient(GasStack ingredient, boolean fullStack)
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getErrorInfo(GasStack ingredient)
|
||||
{
|
||||
Objects.ToStringHelper toStringHelper = Objects.toStringHelper(GasStack.class);
|
||||
|
||||
Gas gas = ingredient.getGas();
|
||||
|
||||
if(gas != null)
|
||||
{
|
||||
toStringHelper.add("Gas", gas.getLocalizedName());
|
||||
}
|
||||
else {
|
||||
toStringHelper.add("Gas", "null");
|
||||
}
|
||||
|
||||
toStringHelper.add("Amount", ingredient.amount);
|
||||
|
||||
return toStringHelper.toString();
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,11 @@ package mekanism.client.jei;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.api.gas.GasRegistry;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.client.gui.GuiChemicalCrystallizer;
|
||||
import mekanism.client.gui.GuiChemicalDissolutionChamber;
|
||||
import mekanism.client.gui.GuiChemicalInfuser;
|
||||
@@ -109,10 +111,15 @@ import mezz.jei.api.IModRegistry;
|
||||
import mezz.jei.api.ISubtypeRegistry;
|
||||
import mezz.jei.api.ISubtypeRegistry.ISubtypeInterpreter;
|
||||
import mezz.jei.api.JEIPlugin;
|
||||
import mezz.jei.api.ingredients.IIngredientRenderer;
|
||||
import mezz.jei.api.ingredients.IModIngredientRegistration;
|
||||
import mezz.jei.api.recipe.IRecipeCategory;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
@JEIPlugin
|
||||
public class MekanismJEI extends BlankModPlugin
|
||||
@@ -151,6 +158,32 @@ public class MekanismJEI extends BlankModPlugin
|
||||
registry.registerSubtypeInterpreter(Item.getItemFromBlock(MekanismBlocks.Transmitter), NBT_INTERPRETER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIngredients(IModIngredientRegistration registry)
|
||||
{
|
||||
List<GasStack> list = GasRegistry.getRegisteredGasses().stream().filter(g -> g.isVisible()).map(g -> new GasStack(g, Fluid.BUCKET_VOLUME)).collect(Collectors.toList());
|
||||
registry.register(GasStack.class, list, new GasStackHelper(), new IIngredientRenderer() {
|
||||
@Override
|
||||
public void render(Minecraft minecraft, int xPosition, int yPosition, Object ingredient)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getTooltip(Minecraft minecraft, Object ingredient)
|
||||
{
|
||||
List<String> tooltip = new ArrayList<String>();
|
||||
return tooltip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FontRenderer getFontRenderer(Minecraft minecraft, Object ingredient)
|
||||
{
|
||||
return minecraft.fontRendererObj;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(IModRegistry registry)
|
||||
{
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
package mekanism.client.jei.machine;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import mekanism.common.recipe.inputs.AdvancedMachineInput;
|
||||
import mekanism.common.recipe.inputs.ItemStackInput;
|
||||
import mekanism.common.recipe.machines.ChanceMachineRecipe;
|
||||
import mekanism.common.recipe.outputs.ChanceOutput;
|
||||
import mekanism.common.recipe.outputs.ItemStackOutput;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -32,7 +29,7 @@ public class ChanceMachineRecipeWrapper extends BlankRecipeWrapper
|
||||
public void getIngredients(IIngredients ingredients)
|
||||
{
|
||||
ChanceOutput output = (ChanceOutput)recipe.getOutput();
|
||||
ingredients.setInput(ItemStack.class, ((AdvancedMachineInput)recipe.getInput()).itemStack);
|
||||
ingredients.setInput(ItemStack.class, ((ItemStackInput)recipe.getInput()).ingredient);
|
||||
ingredients.setOutputs(ItemStack.class, Arrays.asList(output.primaryOutput, output.secondaryOutput));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package mekanism.client.jei.machine;
|
||||
|
||||
import mekanism.common.recipe.inputs.AdvancedMachineInput;
|
||||
import mekanism.common.recipe.inputs.ItemStackInput;
|
||||
import mekanism.common.recipe.machines.BasicMachineRecipe;
|
||||
import mekanism.common.recipe.outputs.ItemStackOutput;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
@@ -22,7 +22,7 @@ public class MachineRecipeWrapper extends BlankRecipeWrapper
|
||||
@Override
|
||||
public void getIngredients(IIngredients ingredients)
|
||||
{
|
||||
ingredients.setInput(ItemStack.class, ((AdvancedMachineInput)recipe.getInput()).itemStack);
|
||||
ingredients.setInput(ItemStack.class, ((ItemStackInput)recipe.getInput()).ingredient);
|
||||
ingredients.setOutput(ItemStack.class, ((ItemStackOutput)recipe.getOutput()).output);
|
||||
}
|
||||
}
|
||||
@@ -310,7 +310,7 @@ public class ItemBlockEnergyCube extends ItemBlock implements IEnergizedItem, IS
|
||||
@Override
|
||||
public double getDurabilityForDisplay(ItemStack stack)
|
||||
{
|
||||
return 1D-(getEnergy(stack)/getMaxEnergy(stack));
|
||||
return getEnergy(stack)/getMaxEnergy(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -336,7 +336,7 @@ public class ItemBlockGasTank extends ItemBlock implements IGasItem, ISustainedI
|
||||
@Override
|
||||
public double getDurabilityForDisplay(ItemStack stack)
|
||||
{
|
||||
return 1D-((getGas(stack) != null ? (double)getGas(stack).amount : 0D)/(double)getMaxGas(stack));
|
||||
return (getGas(stack) != null ? (double)getGas(stack).amount : 0D)/(double)getMaxGas(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -52,7 +52,7 @@ public class ItemEnergized extends ItemMekanism implements IEnergizedItem, ISpec
|
||||
@Override
|
||||
public double getDurabilityForDisplay(ItemStack stack)
|
||||
{
|
||||
return 1D-(getEnergy(stack)/getMaxEnergy(stack));
|
||||
return getEnergy(stack)/getMaxEnergy(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -111,7 +111,7 @@ public class ItemFlamethrower extends ItemMekanism implements IGasItem
|
||||
@Override
|
||||
public double getDurabilityForDisplay(ItemStack stack)
|
||||
{
|
||||
return 1D-((getGas(stack) != null ? (double)getGas(stack).amount : 0D)/(double)getMaxGas(stack));
|
||||
return (getGas(stack) != null ? (double)getGas(stack).amount : 0D)/(double)getMaxGas(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -51,7 +51,7 @@ public class ItemJetpack extends ItemArmor implements IGasItem, ISpecialArmor
|
||||
@Override
|
||||
public double getDurabilityForDisplay(ItemStack stack)
|
||||
{
|
||||
return 1D-((getGas(stack) != null ? (double)getGas(stack).amount : 0D)/(double)getMaxGas(stack));
|
||||
return (getGas(stack) != null ? (double)getGas(stack).amount : 0D)/(double)getMaxGas(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -64,7 +64,7 @@ public class ItemScubaTank extends ItemArmor implements IGasItem
|
||||
@Override
|
||||
public double getDurabilityForDisplay(ItemStack stack)
|
||||
{
|
||||
return 1D-((getGas(stack) != null ? (double)getGas(stack).amount : 0D)/(double)getMaxGas(stack));
|
||||
return (getGas(stack) != null ? (double)getGas(stack).amount : 0D)/(double)getMaxGas(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,9 +3,9 @@ package mekanism.common.multipart;
|
||||
import java.util.Random;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.MekanismBlocks;
|
||||
import mekanism.common.block.states.BlockStateFacing;
|
||||
import mekanism.common.multipart.BlockStateTransmitter.TransmitterType.Size;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -47,6 +47,7 @@ public class BlockGlowPanel extends Block implements ITileEntityProvider
|
||||
public BlockGlowPanel()
|
||||
{
|
||||
super(Material.PISTON);
|
||||
setCreativeTab(Mekanism.tabMekanism);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -53,6 +53,11 @@ public class BlockStateTransmitter extends ExtendedBlockState
|
||||
{
|
||||
return name().toLowerCase();
|
||||
}
|
||||
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
return unlocalizedName;
|
||||
}
|
||||
|
||||
public Size getSize()
|
||||
{
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.util.Random;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.MekanismBlocks;
|
||||
import mekanism.common.Tier.BaseTier;
|
||||
import mekanism.common.base.ITierItem;
|
||||
@@ -69,7 +70,8 @@ public class BlockTransmitter extends Block implements ITileEntityProvider
|
||||
|
||||
public BlockTransmitter()
|
||||
{
|
||||
super(Material.WOOD);
|
||||
super(Material.PISTON);
|
||||
setCreativeTab(Mekanism.tabMekanism);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -158,7 +158,7 @@ public class ItemBlockTransmitter extends ItemBlock implements ITierItem
|
||||
public String getUnlocalizedName(ItemStack stack)
|
||||
{
|
||||
TransmitterType type = TransmitterType.get(stack.getItemDamage());
|
||||
String name = type.getName();
|
||||
String name = type.getUnlocalizedName();
|
||||
|
||||
if(type.hasTiers())
|
||||
{
|
||||
|
||||
@@ -123,7 +123,7 @@ public class BinRecipe implements IRecipe
|
||||
@Override
|
||||
public ItemStack getRecipeOutput()
|
||||
{
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -114,7 +114,7 @@ public class ItemHohlraum extends ItemMekanism implements IGasItem
|
||||
@Override
|
||||
public double getDurabilityForDisplay(ItemStack stack)
|
||||
{
|
||||
return 1D-((getGas(stack) != null ? (double)getGas(stack).amount : 0D)/(double)getMaxGas(stack));
|
||||
return (getGas(stack) != null ? (double)getGas(stack).amount : 0D)/(double)getMaxGas(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user