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

@ -44,10 +44,7 @@ import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.ISpecialArmor;
import net.minecraftforge.common.ISpecialArmor.ArmorProperties;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidBlock;
import net.minecraftforge.fluids.IFluidHandler;
import net.minecraftforge.fml.common.discovery.ASMDataTable;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
@ -570,7 +567,7 @@ public class Utils
*/
public static boolean canCombine(ItemStack stack1, ItemStack stack2)
{
if (stack1 == null)
if (stack1 == null || stack1.isItemStackDamageable() ^ stack2.isItemStackDamageable())
{
return false;
}
@ -580,11 +577,6 @@ public class Utils
return true;
}
if (stack1.isItemStackDamageable() ^ stack2.isItemStackDamageable())
{
return false;
}
return stack1.getItem() == stack2.getItem() && stack1.getItemDamage() == stack2.getItemDamage() && ItemStack.areItemStackTagsEqual(stack1, stack2);
}
@ -1126,67 +1118,6 @@ public class Utils
return true;
}
//Shamelessly ripped off of CoFH Lib
public static boolean fillContainerFromHandler(World world, IFluidHandler handler, EntityPlayer player, FluidStack tankFluid)
{
ItemStack container = player.getHeldItemMainhand();
if (FluidContainerRegistry.isEmptyContainer(container))
{
ItemStack returnStack = FluidContainerRegistry.fillFluidContainer(tankFluid, container);
FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(returnStack);
if (fluid == null || returnStack == null)
{
return false;
}
if (!player.capabilities.isCreativeMode)
{
if (container.stackSize == 1)
{
container = container.copy();
player.inventory.setInventorySlotContents(player.inventory.currentItem, returnStack);
} else if (!player.inventory.addItemStackToInventory(returnStack))
{
return false;
}
handler.drain(EnumFacing.UP, fluid.amount, true);
container.stackSize--;
if (container.stackSize <= 0)
{
container = null;
}
} else
{
handler.drain(EnumFacing.UP, fluid.amount, true);
}
return true;
}
return false;
}
//Shamelessly ripped off of CoFH Lib
public static boolean fillHandlerWithContainer(World world, IFluidHandler handler, EntityPlayer player)
{
ItemStack container = player.getHeldItemMainhand();
FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(container);
if (fluid != null)
{
if (handler.fill(EnumFacing.UP, fluid, false) == fluid.amount || player.capabilities.isCreativeMode)
{
if (world.isRemote)
{
return true;
}
handler.fill(EnumFacing.UP, fluid, true);
if (!player.capabilities.isCreativeMode)
{
player.inventory.setInventorySlotContents(player.inventory.currentItem, consumeItem(container));
}
return true;
}
}
return false;
}
//Shamelessly ripped off of CoFH Lib
public static ItemStack consumeItem(ItemStack stack)
{

View file

@ -9,10 +9,11 @@ import java.util.Set;
import javax.annotation.Nullable;
import WayofTime.bloodmagic.client.key.KeyBindings;
import WayofTime.bloodmagic.client.render.model.CustomModelFactory;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.block.model.*;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.player.EntityPlayer;
@ -49,7 +50,7 @@ import WayofTime.bloodmagic.api.registry.RitualRegistry;
import WayofTime.bloodmagic.api.ritual.Ritual;
import WayofTime.bloodmagic.api.ritual.RitualComponent;
import WayofTime.bloodmagic.client.hud.HUDElement;
import WayofTime.bloodmagic.client.render.RenderFakeBlocks;
import WayofTime.bloodmagic.client.render.block.RenderFakeBlocks;
import WayofTime.bloodmagic.item.ItemRitualDiviner;
import WayofTime.bloodmagic.item.sigil.ItemSigilHolding;
import WayofTime.bloodmagic.network.BloodMagicPacketHandler;
@ -222,6 +223,12 @@ public class ClientHandler
@SubscribeEvent
public void onModelBake(ModelBakeEvent event)
{
ModelResourceLocation location = new ModelResourceLocation("bloodmagic:BlockBloodTank", "inventory");
IBakedModel model = event.getModelRegistry().getObject(location);
if (model instanceof IBakedModel)
event.getModelRegistry().putObject(location, new CustomModelFactory(model));
if (BloodMagic.isDev() && SUPPRESS_ASSET_ERRORS)
return;
@ -369,7 +376,7 @@ public class ClientHandler
break;
}
RenderFakeBlocks.drawFakeBlock(texture, minX, minY, minZ, world);
RenderFakeBlocks.drawFakeBlock(texture, minX, minY, minZ);
}
}
@ -433,7 +440,7 @@ public class ClientHandler
break;
}
RenderFakeBlocks.drawFakeBlock(texture, minX, minY, minZ, world);
RenderFakeBlocks.drawFakeBlock(texture, minX, minY, minZ);
}
}

View file

@ -174,7 +174,7 @@ public class InventoryRenderHelper
*
* @return The class name of the given Item
*/
private static String getClassName(Item item)
public static String getClassName(Item item)
{
return item instanceof ItemBlock ? Block.getBlockFromItem(item).getClass().getSimpleName() : item.getClass().getSimpleName();
}