mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
Closes #872
There dad u got ur thingy also who put these null itemstacks here bad
This commit is contained in:
parent
c6c43fe5a8
commit
f2b24c3318
17 changed files with 125 additions and 19 deletions
|
@ -126,7 +126,7 @@ public final class ActuallyAdditionsAPI{
|
||||||
* @param outputTwoChance The chance of the second output (0 won't occur at all, 100 will all the time)
|
* @param outputTwoChance The chance of the second output (0 won't occur at all, 100 will all the time)
|
||||||
*/
|
*/
|
||||||
public static void addCrusherRecipe(ItemStack input, ItemStack outputOne, ItemStack outputTwo, int outputTwoChance){
|
public static void addCrusherRecipe(ItemStack input, ItemStack outputOne, ItemStack outputTwo, int outputTwoChance){
|
||||||
CRUSHER_RECIPES.add(new CrusherRecipe(input, outputOne, outputTwo, outputTwoChance));
|
CRUSHER_RECIPES.add(new CrusherRecipe(input, outputOne, outputTwo == null ? ItemStack.EMPTY : outputTwo, outputTwoChance));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
package de.ellpeck.actuallyadditions.api.misc;
|
||||||
|
|
||||||
|
public interface IDisableableItem {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents an item that can be disabled in the configuration of the mod.
|
||||||
|
* If this returns true, assume the item is not registered with the game, but may still be instantiated.
|
||||||
|
* @return If the item has not been registered with the Forge Registry.
|
||||||
|
*/
|
||||||
|
public boolean isDisabled();
|
||||||
|
|
||||||
|
}
|
|
@ -129,6 +129,8 @@ public class ActuallyAdditions{
|
||||||
InitBooklet.postInit();
|
InitBooklet.postInit();
|
||||||
proxy.postInit(event);
|
proxy.postInit(event);
|
||||||
|
|
||||||
|
ConfigurationHandler.redefineConfigs();
|
||||||
|
|
||||||
ModUtil.LOGGER.info("PostInitialization Finished.");
|
ModUtil.LOGGER.info("PostInitialization Finished.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class EntryButton extends GuiButton{
|
||||||
this.mouseDragged(minecraft, mouseX, mouseY);
|
this.mouseDragged(minecraft, mouseX, mouseY);
|
||||||
|
|
||||||
int textOffsetX = 0;
|
int textOffsetX = 0;
|
||||||
if(StackUtil.isValid(this.stackToRender)){
|
if(StackUtil.isValid(this.stackToRender == null ? ItemStack.EMPTY : this.stackToRender)){
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
AssetUtil.renderStackToGui(this.stackToRender, this.x-4, this.y, 0.725F);
|
AssetUtil.renderStackToGui(this.stackToRender, this.x-4, this.y, 0.725F);
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.popMatrix();
|
||||||
|
|
|
@ -13,6 +13,7 @@ package de.ellpeck.actuallyadditions.mod.booklet.chapter;
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
||||||
|
import de.ellpeck.actuallyadditions.api.misc.IDisableableItem;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -38,6 +39,7 @@ public class BookletChapter implements IBookletChapter{
|
||||||
this.identifier = identifier;
|
this.identifier = identifier;
|
||||||
this.entry = entry;
|
this.entry = entry;
|
||||||
this.displayStack = displayStack;
|
this.displayStack = displayStack;
|
||||||
|
if(displayStack.getItem() instanceof IDisableableItem && ((IDisableableItem) displayStack.getItem()).isDisabled()) displayStack = ItemStack.EMPTY;
|
||||||
this.priority = priority;
|
this.priority = priority;
|
||||||
this.color = TextFormatting.RESET;
|
this.color = TextFormatting.RESET;
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.util.crafting.BlankRecipe;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.IRecipe;
|
import net.minecraft.item.crafting.IRecipe;
|
||||||
import net.minecraft.item.crafting.Ingredient;
|
import net.minecraft.item.crafting.Ingredient;
|
||||||
|
@ -128,8 +129,13 @@ public class PageCrafting extends BookletPage{
|
||||||
Ingredient[] ings = new Ingredient[9];
|
Ingredient[] ings = new Ingredient[9];
|
||||||
int width = 3;
|
int width = 3;
|
||||||
int height = 3;
|
int height = 3;
|
||||||
|
|
||||||
if(recipe instanceof ShapedRecipes){
|
if(recipe instanceof BlankRecipe){
|
||||||
|
this.recipeTypeLocKey = "tooltip."+ModUtil.MOD_ID+".disabled";
|
||||||
|
gui.addOrModifyItemRenderer(recipe.getRecipeOutput(), startX+100, startY+25, 1F, false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if(recipe instanceof ShapedRecipes){
|
||||||
ShapedRecipes shaped = (ShapedRecipes)recipe;
|
ShapedRecipes shaped = (ShapedRecipes)recipe;
|
||||||
width = shaped.recipeWidth;
|
width = shaped.recipeWidth;
|
||||||
height = shaped.recipeHeight;
|
height = shaped.recipeHeight;
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class ConfigurationHandler{
|
||||||
redefineConfigs();
|
redefineConfigs();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void redefineConfigs(){
|
public static void redefineConfigs(){
|
||||||
ConfigValues.defineConfigValues(config);
|
ConfigValues.defineConfigValues(config);
|
||||||
|
|
||||||
if(config.hasChanged()){
|
if(config.hasChanged()){
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.creative;
|
package de.ellpeck.actuallyadditions.mod.creative;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.api.misc.IDisableableItem;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
|
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||||
|
@ -349,7 +350,7 @@ public class CreativeTab extends CreativeTabs{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add(Item item){
|
public void add(Item item){
|
||||||
if(item != null){
|
if(item != null && (!(item instanceof IDisableableItem) || (item instanceof IDisableableItem && !((IDisableableItem) item).isDisabled()))){
|
||||||
item.getSubItems(INSTANCE, this.list);
|
item.getSubItems(INSTANCE, this.list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,20 +10,24 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.items.base;
|
package de.ellpeck.actuallyadditions.mod.items.base;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.api.misc.IDisableableItem;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.config.ConfigurationHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.ContainerEnergizer;
|
import de.ellpeck.actuallyadditions.mod.inventory.ContainerEnergizer;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemArmor;
|
import net.minecraft.item.ItemArmor;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public class ItemArmorAA extends ItemArmor{
|
public class ItemArmorAA extends ItemArmor implements IDisableableItem{
|
||||||
|
|
||||||
private final ItemStack repairItem;
|
private final ItemStack repairItem;
|
||||||
private final String name;
|
private final String name;
|
||||||
private final EnumRarity rarity;
|
private final EnumRarity rarity;
|
||||||
|
private final boolean disabled;
|
||||||
|
|
||||||
public ItemArmorAA(String name, ArmorMaterial material, int type, ItemStack repairItem){
|
public ItemArmorAA(String name, ArmorMaterial material, int type, ItemStack repairItem){
|
||||||
this(name, material, type, repairItem, EnumRarity.RARE);
|
this(name, material, type, repairItem, EnumRarity.RARE);
|
||||||
}
|
}
|
||||||
|
@ -33,8 +37,8 @@ public class ItemArmorAA extends ItemArmor{
|
||||||
this.repairItem = repairItem;
|
this.repairItem = repairItem;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.rarity = rarity;
|
this.rarity = rarity;
|
||||||
|
this.disabled = ConfigurationHandler.config.getBoolean("Disable: " + StringUtil.badTranslate(name), "Tool Control", false, "This will disable the " + StringUtil.badTranslate(name) +". It will not be registered.");
|
||||||
this.register();
|
if(!disabled) this.register();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void register(){
|
private void register(){
|
||||||
|
@ -64,4 +68,9 @@ public class ItemArmorAA extends ItemArmor{
|
||||||
public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){
|
public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){
|
||||||
return StackUtil.isValid(this.repairItem) && ItemUtil.areItemsEqual(this.repairItem, stack, false);
|
return StackUtil.isValid(this.repairItem) && ItemUtil.areItemsEqual(this.repairItem, stack, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDisabled() {
|
||||||
|
return disabled;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,18 +10,22 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.items.base;
|
package de.ellpeck.actuallyadditions.mod.items.base;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.api.misc.IDisableableItem;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.config.ConfigurationHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemHoe;
|
import net.minecraft.item.ItemHoe;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public class ItemHoeAA extends ItemHoe{
|
public class ItemHoeAA extends ItemHoe implements IDisableableItem {
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
private final EnumRarity rarity;
|
private final EnumRarity rarity;
|
||||||
private final ItemStack repairItem;
|
private final ItemStack repairItem;
|
||||||
|
private final boolean disabled;
|
||||||
|
|
||||||
public ItemHoeAA(Item.ToolMaterial toolMat, ItemStack repairItem, String unlocalizedName, EnumRarity rarity){
|
public ItemHoeAA(Item.ToolMaterial toolMat, ItemStack repairItem, String unlocalizedName, EnumRarity rarity){
|
||||||
super(toolMat);
|
super(toolMat);
|
||||||
|
@ -30,7 +34,8 @@ public class ItemHoeAA extends ItemHoe{
|
||||||
this.name = unlocalizedName;
|
this.name = unlocalizedName;
|
||||||
this.rarity = rarity;
|
this.rarity = rarity;
|
||||||
|
|
||||||
this.register();
|
this.disabled = ConfigurationHandler.config.getBoolean("Disable: " + StringUtil.badTranslate(name), "Tool Control", false, "This will disable the " + StringUtil.badTranslate(name) +". It will not be registered.");
|
||||||
|
if(!disabled) this.register();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void register(){
|
private void register(){
|
||||||
|
@ -61,4 +66,9 @@ public class ItemHoeAA extends ItemHoe{
|
||||||
public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){
|
public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){
|
||||||
return ItemUtil.areItemsEqual(this.repairItem, stack, false);
|
return ItemUtil.areItemsEqual(this.repairItem, stack, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDisabled() {
|
||||||
|
return disabled;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,18 +10,22 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.items.base;
|
package de.ellpeck.actuallyadditions.mod.items.base;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.api.misc.IDisableableItem;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.config.ConfigurationHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.ItemSword;
|
import net.minecraft.item.ItemSword;
|
||||||
|
|
||||||
public class ItemSwordAA extends ItemSword{
|
public class ItemSwordAA extends ItemSword implements IDisableableItem {
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
private final EnumRarity rarity;
|
private final EnumRarity rarity;
|
||||||
private final ItemStack repairItem;
|
private final ItemStack repairItem;
|
||||||
|
private final boolean disabled;
|
||||||
|
|
||||||
public ItemSwordAA(ToolMaterial toolMat, ItemStack repairItem, String unlocalizedName, EnumRarity rarity){
|
public ItemSwordAA(ToolMaterial toolMat, ItemStack repairItem, String unlocalizedName, EnumRarity rarity){
|
||||||
super(toolMat);
|
super(toolMat);
|
||||||
|
@ -30,7 +34,8 @@ public class ItemSwordAA extends ItemSword{
|
||||||
this.name = unlocalizedName;
|
this.name = unlocalizedName;
|
||||||
this.rarity = rarity;
|
this.rarity = rarity;
|
||||||
|
|
||||||
this.register();
|
this.disabled = ConfigurationHandler.config.getBoolean("Disable: " + StringUtil.badTranslate(name), "Tool Control", false, "This will disable the " + StringUtil.badTranslate(name) +". It will not be registered.");
|
||||||
|
if(!disabled) this.register();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void register(){
|
private void register(){
|
||||||
|
@ -65,4 +70,9 @@ public class ItemSwordAA extends ItemSword{
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack){
|
||||||
return this.rarity;
|
return this.rarity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDisabled() {
|
||||||
|
return disabled;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,9 +10,12 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.items.base;
|
package de.ellpeck.actuallyadditions.mod.items.base;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.api.misc.IDisableableItem;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.config.ConfigurationHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -21,12 +24,13 @@ import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class ItemToolAA extends ItemTool{
|
public class ItemToolAA extends ItemTool implements IDisableableItem{
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
private final EnumRarity rarity;
|
private final EnumRarity rarity;
|
||||||
private final ItemStack repairItem;
|
private final ItemStack repairItem;
|
||||||
private String repairOredict;
|
private String repairOredict;
|
||||||
|
private final boolean disabled;
|
||||||
|
|
||||||
public ItemToolAA(float attack, float speed, ToolMaterial toolMat, String repairItem, String unlocalizedName, EnumRarity rarity, Set<Block> effectiveStuff){
|
public ItemToolAA(float attack, float speed, ToolMaterial toolMat, String repairItem, String unlocalizedName, EnumRarity rarity, Set<Block> effectiveStuff){
|
||||||
this(attack, speed, toolMat, (ItemStack)null, unlocalizedName, rarity, effectiveStuff);
|
this(attack, speed, toolMat, (ItemStack)null, unlocalizedName, rarity, effectiveStuff);
|
||||||
|
@ -39,8 +43,8 @@ public class ItemToolAA extends ItemTool{
|
||||||
this.repairItem = repairItem;
|
this.repairItem = repairItem;
|
||||||
this.name = unlocalizedName;
|
this.name = unlocalizedName;
|
||||||
this.rarity = rarity;
|
this.rarity = rarity;
|
||||||
|
this.disabled = ConfigurationHandler.config.getBoolean("Disable: " + StringUtil.badTranslate(unlocalizedName), "Tool Control", false, "This will disable the " + StringUtil.badTranslate(unlocalizedName) +". It will not be registered.");
|
||||||
this.register();
|
if(!disabled) this.register();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void register(){
|
private void register(){
|
||||||
|
@ -82,4 +86,9 @@ public class ItemToolAA extends ItemTool{
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDisabled() {
|
||||||
|
return disabled;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.util;
|
package de.ellpeck.actuallyadditions.mod.util;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.api.misc.IDisableableItem;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.NonNullList;
|
import net.minecraft.util.NonNullList;
|
||||||
|
|
||||||
|
@ -33,8 +35,10 @@ public final class StackUtil{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isValid(ItemStack stack){
|
public static boolean isValid(ItemStack stack){//Stacks are nonnull. If we are making null stacks we're stupid anyway.
|
||||||
return stack != null && !stack.isEmpty();
|
Item i = stack.getItem();
|
||||||
|
if(i instanceof IDisableableItem) return !((IDisableableItem) i).isDisabled();
|
||||||
|
return !stack.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack getNull(){
|
public static ItemStack getNull(){
|
||||||
|
|
|
@ -46,6 +46,11 @@ public final class StringUtil{
|
||||||
return net.minecraft.util.text.translation.I18n.translateToLocal(langKey);
|
return net.minecraft.util.text.translation.I18n.translateToLocal(langKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")//Configs why must you need to be translated.
|
||||||
|
public static String badTranslate(String someUnlocAAItemName) {
|
||||||
|
return net.minecraft.util.text.translation.I18n.translateToLocal("item.actuallyadditions."+someUnlocAAItemName+".name");
|
||||||
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public static void drawSplitString(FontRenderer renderer, String strg, int x, int y, int width, int color, boolean shadow){
|
public static void drawSplitString(FontRenderer renderer, String strg, int x, int y, int width, int color, boolean shadow){
|
||||||
List<String> list = renderer.listFormattedStringToWidth(strg, width);
|
List<String> list = renderer.listFormattedStringToWidth(strg, width);
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
package de.ellpeck.actuallyadditions.mod.util.crafting;
|
||||||
|
|
||||||
|
import net.minecraft.inventory.InventoryCrafting;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.crafting.IRecipe;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.registries.IForgeRegistryEntry;
|
||||||
|
|
||||||
|
|
||||||
|
public class BlankRecipe extends IForgeRegistryEntry.Impl<IRecipe> implements IRecipe{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean matches(InventoryCrafting inv, World worldIn) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getCraftingResult(InventoryCrafting inv) {
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canFit(int width, int height) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getRecipeOutput() {
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.util.crafting;
|
package de.ellpeck.actuallyadditions.mod.util.crafting;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.api.misc.IDisableableItem;
|
||||||
import de.ellpeck.actuallyadditions.mod.RegistryHandler;
|
import de.ellpeck.actuallyadditions.mod.RegistryHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
@ -37,6 +38,8 @@ public final class RecipeHelper{
|
||||||
* This adds the recipe to the list of crafting recipes. Cares about names.
|
* This adds the recipe to the list of crafting recipes. Cares about names.
|
||||||
*/
|
*/
|
||||||
public static void addRecipe(String name, IRecipe rec){
|
public static void addRecipe(String name, IRecipe rec){
|
||||||
|
Item i = rec.getRecipeOutput().getItem();
|
||||||
|
if(i instanceof IDisableableItem && ((IDisableableItem) i).isDisabled()) rec = new BlankRecipe();
|
||||||
if(rec.getRegistryName() == null){
|
if(rec.getRegistryName() == null){
|
||||||
RECIPE_LIST.add(rec.setRegistryName(new ResourceLocation(MODID, name)));
|
RECIPE_LIST.add(rec.setRegistryName(new ResourceLocation(MODID, name)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
itemGroup.actuallyadditions=Actually Additions
|
itemGroup.actuallyadditions=Actually Additions
|
||||||
achievement.page.actuallyadditions=Actually Additions
|
achievement.page.actuallyadditions=Actually Additions
|
||||||
actuallyadditions.lolWutHowUDoDis.name=This is bugged. Throw it away. Please.
|
actuallyadditions.lolWutHowUDoDis.name=This is bugged. Throw it away. Please.
|
||||||
|
tooltip.actuallyadditions.disabled=Disabled Object
|
||||||
|
|
||||||
#Fluids
|
#Fluids
|
||||||
fluid.actuallyadditions.refinedcanolaoil=Refined Canola Oil
|
fluid.actuallyadditions.refinedcanolaoil=Refined Canola Oil
|
||||||
|
|
Loading…
Reference in a new issue