Implement a functioning Blood Tank (#969)

Added a search bar to the Upgrade Tomes Creative Tab
Updated some Altar fluid code (remove deprecated stuff)
Moved Rendering classes into appropriate package
Fix the localization errors on the Demon Crystals
A few cleanups here and there
This commit is contained in:
Arcaratus 2016-12-11 20:28:47 -05:00 committed by Nick Ignoffo
parent d1f4e95a7e
commit aac2623440
40 changed files with 929 additions and 249 deletions

View file

@ -4,10 +4,8 @@ import java.util.Map;
import javax.annotation.Nonnull;
import mezz.jei.api.BlankModPlugin;
import mezz.jei.api.IJeiHelpers;
import mezz.jei.api.IModRegistry;
import mezz.jei.api.JEIPlugin;
import mezz.jei.api.*;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import WayofTime.bloodmagic.api.Constants;
@ -80,6 +78,8 @@ public class BloodMagicPlugin extends BlankModPlugin
}
}
jeiHelper.getSubtypeRegistry().useNbtForSubtypes(Item.getItemFromBlock(ModBlocks.BLOOD_TANK));
registry.addRecipeClickArea(GuiSoulForge.class, 115, 15, 16, 88, Constants.Compat.JEI_CATEGORY_SOULFORGE);
registry.addRecipeCategoryCraftingItem(new ItemStack(ModBlocks.ALTAR), Constants.Compat.JEI_CATEGORY_ALTAR);

View file

@ -15,6 +15,7 @@ public class AlchemyArrayCraftingRecipeHandler implements IRecipeHandler<Alchemy
return AlchemyArrayCraftingRecipeJEI.class;
}
@Deprecated
@Nonnull
@Override
public String getRecipeCategoryUid()
@ -22,6 +23,12 @@ public class AlchemyArrayCraftingRecipeHandler implements IRecipeHandler<Alchemy
return Constants.Compat.JEI_CATEGORY_ALCHEMYARRAY;
}
@Override
public String getRecipeCategoryUid(@Nonnull AlchemyArrayCraftingRecipeJEI recipe)
{
return Constants.Compat.JEI_CATEGORY_ALCHEMYARRAY;
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull AlchemyArrayCraftingRecipeJEI recipe)

View file

@ -15,6 +15,7 @@ public class AlchemyTableRecipeHandler implements IRecipeHandler<AlchemyTableRec
return AlchemyTableRecipeJEI.class;
}
@Deprecated
@Nonnull
@Override
public String getRecipeCategoryUid()
@ -22,6 +23,12 @@ public class AlchemyTableRecipeHandler implements IRecipeHandler<AlchemyTableRec
return Constants.Compat.JEI_CATEGORY_ALCHEMYTABLE;
}
@Override
public String getRecipeCategoryUid(@Nonnull AlchemyTableRecipeJEI recipe)
{
return Constants.Compat.JEI_CATEGORY_ALCHEMYTABLE;
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull AlchemyTableRecipeJEI recipe)

View file

@ -15,6 +15,7 @@ public class AltarRecipeHandler implements IRecipeHandler<AltarRecipeJEI>
return AltarRecipeJEI.class;
}
@Deprecated
@Nonnull
@Override
public String getRecipeCategoryUid()
@ -22,6 +23,12 @@ public class AltarRecipeHandler implements IRecipeHandler<AltarRecipeJEI>
return Constants.Compat.JEI_CATEGORY_ALTAR;
}
@Override
public String getRecipeCategoryUid(@Nonnull AltarRecipeJEI recipe)
{
return Constants.Compat.JEI_CATEGORY_ALTAR;
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull AltarRecipeJEI recipe)

View file

@ -15,6 +15,7 @@ public class ArmourDowngradeRecipeHandler implements IRecipeHandler<ArmourDowngr
return ArmourDowngradeRecipeJEI.class;
}
@Deprecated
@Nonnull
@Override
public String getRecipeCategoryUid()
@ -22,6 +23,13 @@ public class ArmourDowngradeRecipeHandler implements IRecipeHandler<ArmourDowngr
return Constants.Compat.JEI_CATEGORY_ARMOURDOWNGRADE;
}
@Nonnull
@Override
public String getRecipeCategoryUid(ArmourDowngradeRecipeJEI recipe)
{
return Constants.Compat.JEI_CATEGORY_ARMOURDOWNGRADE;
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull ArmourDowngradeRecipeJEI recipe)

View file

@ -15,6 +15,7 @@ public class BindingRecipeHandler implements IRecipeHandler<BindingRecipeJEI>
return BindingRecipeJEI.class;
}
@Deprecated
@Nonnull
@Override
public String getRecipeCategoryUid()
@ -22,6 +23,12 @@ public class BindingRecipeHandler implements IRecipeHandler<BindingRecipeJEI>
return Constants.Compat.JEI_CATEGORY_BINDING;
}
@Override
public String getRecipeCategoryUid(@Nonnull BindingRecipeJEI recipe)
{
return Constants.Compat.JEI_CATEGORY_BINDING;
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull BindingRecipeJEI recipe)

View file

@ -1,10 +1,10 @@
package WayofTime.bloodmagic.compat.jei.forge;
import javax.annotation.Nonnull;
import WayofTime.bloodmagic.api.Constants;
import mezz.jei.api.recipe.IRecipeHandler;
import mezz.jei.api.recipe.IRecipeWrapper;
import WayofTime.bloodmagic.api.Constants;
import javax.annotation.Nonnull;
public class TartaricForgeRecipeHandler implements IRecipeHandler<TartaricForgeRecipeJEI>
{
@ -15,6 +15,7 @@ public class TartaricForgeRecipeHandler implements IRecipeHandler<TartaricForgeR
return TartaricForgeRecipeJEI.class;
}
@Deprecated
@Nonnull
@Override
public String getRecipeCategoryUid()
@ -22,6 +23,12 @@ public class TartaricForgeRecipeHandler implements IRecipeHandler<TartaricForgeR
return Constants.Compat.JEI_CATEGORY_SOULFORGE;
}
@Override
public String getRecipeCategoryUid(@Nonnull TartaricForgeRecipeJEI recipe)
{
return Constants.Compat.JEI_CATEGORY_SOULFORGE;
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull TartaricForgeRecipeJEI recipe)

View file

@ -19,6 +19,7 @@ public class ShapedOrbRecipeHandler implements IRecipeHandler<ShapedBloodOrbReci
return ShapedBloodOrbRecipe.class;
}
@Deprecated
@Nonnull
@Override
public String getRecipeCategoryUid()
@ -26,6 +27,12 @@ public class ShapedOrbRecipeHandler implements IRecipeHandler<ShapedBloodOrbReci
return VanillaRecipeCategoryUid.CRAFTING;
}
@Nonnull
public String getRecipeCategoryUid(@Nonnull ShapedBloodOrbRecipe recipe)
{
return VanillaRecipeCategoryUid.CRAFTING;
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull ShapedBloodOrbRecipe recipe)

View file

@ -17,6 +17,7 @@ public class ShapelessOrbRecipeHandler implements IRecipeHandler<ShapelessBloodO
return ShapelessBloodOrbRecipe.class;
}
@Deprecated
@Nonnull
@Override
public String getRecipeCategoryUid()
@ -24,6 +25,12 @@ public class ShapelessOrbRecipeHandler implements IRecipeHandler<ShapelessBloodO
return VanillaRecipeCategoryUid.CRAFTING;
}
@Override
public String getRecipeCategoryUid(@Nonnull ShapelessBloodOrbRecipe recipe)
{
return VanillaRecipeCategoryUid.CRAFTING;
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull ShapelessBloodOrbRecipe recipe)

View file

@ -1,21 +1,12 @@
package WayofTime.bloodmagic.compat.waila;
import WayofTime.bloodmagic.block.*;
import WayofTime.bloodmagic.compat.waila.provider.*;
import mcp.mobius.waila.api.IWailaRegistrar;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.block.BlockAlchemyArray;
import WayofTime.bloodmagic.block.BlockAltar;
import WayofTime.bloodmagic.block.BlockMimic;
import WayofTime.bloodmagic.block.BlockRitualController;
import WayofTime.bloodmagic.block.BlockTeleposer;
import WayofTime.bloodmagic.block.base.BlockEnumPillar;
import WayofTime.bloodmagic.block.base.BlockEnumPillarCap;
import WayofTime.bloodmagic.block.base.BlockEnumStairs;
import WayofTime.bloodmagic.compat.waila.provider.DataProviderAlchemyArray;
import WayofTime.bloodmagic.compat.waila.provider.DataProviderBloodAltar;
import WayofTime.bloodmagic.compat.waila.provider.DataProviderMimic;
import WayofTime.bloodmagic.compat.waila.provider.DataProviderPillar;
import WayofTime.bloodmagic.compat.waila.provider.DataProviderRitualController;
import WayofTime.bloodmagic.compat.waila.provider.DataProviderTeleposer;
public class WailaCallbackHandler
{
@ -26,6 +17,8 @@ public class WailaCallbackHandler
registrar.registerBodyProvider(new DataProviderTeleposer(), BlockTeleposer.class);
registrar.registerBodyProvider(new DataProviderRitualController(), BlockRitualController.class);
registrar.registerBodyProvider(new DataProviderAlchemyArray(), BlockAlchemyArray.class);
registrar.registerBodyProvider(new DataProviderBloodTank(), BlockBloodTank.class);
registrar.registerNBTProvider(new DataProviderBloodTank(), BlockBloodTank.class);
registrar.registerStackProvider(new DataProviderAlchemyArray(), BlockAlchemyArray.class);
registrar.registerStackProvider(new DataProviderMimic(), BlockMimic.class);
registrar.registerNBTProvider(new DataProviderMimic(), BlockMimic.class);
@ -38,5 +31,6 @@ public class WailaCallbackHandler
registrar.addConfig(Constants.Mod.MODID, Constants.Compat.WAILA_CONFIG_TELEPOSER, true);
registrar.addConfig(Constants.Mod.MODID, Constants.Compat.WAILA_CONFIG_RITUAL, true);
registrar.addConfig(Constants.Mod.MODID, Constants.Compat.WAILA_CONFIG_ARRAY, true);
registrar.addConfig(Constants.Mod.MODID, Constants.Compat.WAILA_CONFIG_BLOOD_TANK, true);
}
}

View file

@ -0,0 +1,81 @@
package WayofTime.bloodmagic.compat.waila.provider;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.block.BlockBloodTank;
import WayofTime.bloodmagic.tile.TileBloodTank;
import WayofTime.bloodmagic.util.helper.TextHelper;
import com.google.common.base.Strings;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidStack;
import java.util.List;
public class DataProviderBloodTank implements IWailaDataProvider
{
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config)
{
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config)
{
return null;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config)
{
if (!config.getConfig(Constants.Compat.WAILA_CONFIG_BLOOD_TANK))
return currenttip;
if (accessor.getPlayer().isSneaking() || config.getConfig(Constants.Compat.WAILA_CONFIG_BYPASS_SNEAK))
{
if (accessor.getBlock() instanceof BlockBloodTank && accessor.getTileEntity() instanceof TileBloodTank)
{
TileBloodTank bloodTank = (TileBloodTank) accessor.getTileEntity();
NBTTagCompound tag = accessor.getNBTData();
int capacity = tag.getInteger(Constants.NBT.ALTAR_CAPACITY);
currenttip.add(TextHelper.localizeEffect("tooltip.BloodMagic.tier", bloodTank.getBlockMetadata() + 1));
currenttip.add(TextHelper.localizeEffect("tooltip.BloodMagic.fluid.capacity") + ": " + capacity + "mB");
tag = tag.getCompoundTag(Constants.NBT.TANK);
FluidStack fluidStack = FluidStack.loadFluidStackFromNBT(tag);
if (!Strings.isNullOrEmpty(tag.getString("FluidName")) && fluidStack != null)
{
currenttip.add(TextHelper.localizeEffect("tooltip.BloodMagic.fluid.type") + ": " + fluidStack.getLocalizedName());
currenttip.add(TextHelper.localizeEffect("tooltip.BloodMagic.fluid.amount") + ": " + tag.getInteger("Amount") + "/" + capacity + "mB");
}
}
}
else
{
currenttip.add(TextHelper.localizeEffect("waila.BloodMagic.sneak"));
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config)
{
return null;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos)
{
if (te != null)
te.writeToNBT(tag);
return tag;
}
}