Finished the Altar
This commit is contained in:
parent
c086c23915
commit
225016e030
|
@ -4,6 +4,7 @@ import WayofTime.bloodmagic.api.BlockStack;
|
|||
import WayofTime.bloodmagic.api.altar.*;
|
||||
import WayofTime.bloodmagic.block.BlockBloodRune;
|
||||
import WayofTime.bloodmagic.block.BlockBloodStoneBrick;
|
||||
import WayofTime.bloodmagic.block.BlockCrystal;
|
||||
import WayofTime.bloodmagic.registry.ModBlocks;
|
||||
import net.minecraft.block.BlockBeacon;
|
||||
import net.minecraft.block.BlockGlowstone;
|
||||
|
@ -131,9 +132,9 @@ public class BloodAltar {
|
|||
if (blockStack.getBlock() instanceof BlockBloodStoneBrick || (blockStack.getBlock() instanceof IAltarComponent && (((IAltarComponent) blockStack.getBlock()).getType(blockStack.getMeta()) == EnumAltarComponent.BLOODSTONE)))
|
||||
return true;
|
||||
|
||||
// if (altarComponent.getBlockStack().getBlock() == ModBlocks.crystal)
|
||||
// if (blockStack.getBlock() instanceof BlockCrystal || (blockStack.getBlock() instanceof IAltarComponent && (((IAltarComponent) blockStack.getBlock()).getType(blockStack.getMeta()) == EnumAltarComponent.CRYSTAL)))
|
||||
// return true;
|
||||
if (altarComponent.getBlockStack().getBlock() == ModBlocks.crystal)
|
||||
if (blockStack.getBlock() instanceof BlockCrystal || (blockStack.getBlock() instanceof IAltarComponent && (((IAltarComponent) blockStack.getBlock()).getType(blockStack.getMeta()) == EnumAltarComponent.CRYSTAL)))
|
||||
return true;
|
||||
|
||||
if (altarComponent.getBlockStack().getBlock() == Blocks.glowstone)
|
||||
if (blockStack.getBlock() instanceof BlockGlowstone || (blockStack.getBlock() instanceof IAltarComponent && (((IAltarComponent) blockStack.getBlock()).getType(blockStack.getMeta()) == EnumAltarComponent.GLOWSTONE)))
|
||||
|
|
|
@ -48,6 +48,8 @@ public class Constants {
|
|||
public static final String ALTAR_ACCELERATION_UPGRADES = "accelerationUpgrades";
|
||||
public static final String ALTAR_DEMON_BLOOD_DURATION = "demonBloodDuration";
|
||||
public static final String ALTAR_COOLDOWN_AFTER_CRAFTING = "cooldownAfterCrafting";
|
||||
|
||||
public static final String ALTARMAKER_CURRENT_TIER = "currentTier";
|
||||
}
|
||||
|
||||
public static class Mod {
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockBloodLight extends Block {
|
||||
|
||||
public BlockBloodLight() {
|
||||
super(Material.cloth);
|
||||
|
||||
setUnlocalizedName(Constants.Mod.MODID + ".bloodLight");
|
||||
setCreativeTab(BloodMagic.tabBloodMagic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public EnumWorldBlockLayer getBlockLayer()
|
||||
{
|
||||
return EnumWorldBlockLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue() {
|
||||
return 15;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean addDestroyEffects(World world, BlockPos pos, net.minecraft.client.particle.EffectRenderer effectRenderer) {
|
||||
if (world.getBlockState(pos).getBlock() == this) {
|
||||
Random random = new Random();
|
||||
float f = 1.0F;
|
||||
float f1 = f * 0.6F + 0.4F;
|
||||
float f2 = f * f * 0.7F - 0.5F;
|
||||
float f3 = f * f * 0.6F - 0.7F;
|
||||
effectRenderer.spawnEffectParticle(EnumParticleTypes.REDSTONE.getParticleID(), pos.getX() + 0.5D + random.nextGaussian() / 8, pos.getY() + 0.5D, pos.getZ() + 0.5D + random.nextGaussian() / 8, f1, f2, f3);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand) {
|
||||
if (rand.nextInt(3) != 0) {
|
||||
float f = 1.0F;
|
||||
float f1 = f * 0.6F + 0.4F;
|
||||
float f2 = f * f * 0.7F - 0.5F;
|
||||
float f3 = f * f * 0.6F - 0.7F;
|
||||
worldIn.spawnParticle(EnumParticleTypes.REDSTONE, pos.getX() + 0.5D + rand.nextGaussian() / 8, pos.getY() + 0.5D, pos.getZ() + 0.5D + rand.nextGaussian() / 8, f1, f2, f3);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) {
|
||||
this.setBlockBounds(0.35F, 0.35F, 0.35F, 0.65F, 0.65F, 0.65F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random par1Random) {
|
||||
return 0;
|
||||
}
|
||||
}
|
21
src/main/java/WayofTime/bloodmagic/block/BlockCrystal.java
Normal file
21
src/main/java/WayofTime/bloodmagic/block/BlockCrystal.java
Normal file
|
@ -0,0 +1,21 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.block.base.BlockString;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class BlockCrystal extends BlockString {
|
||||
public static final String[] names = {"normal", "brick"};
|
||||
|
||||
public BlockCrystal() {
|
||||
super(Material.rock, names);
|
||||
|
||||
setUnlocalizedName(Constants.Mod.MODID + ".crystal.");
|
||||
setCreativeTab(BloodMagic.tabBloodMagic);
|
||||
setStepSound(soundTypeStone);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setHarvestLevel("pickaxe", 2);
|
||||
}
|
||||
}
|
130
src/main/java/WayofTime/bloodmagic/item/ItemAltarMaker.java
Normal file
130
src/main/java/WayofTime/bloodmagic/item/ItemAltarMaker.java
Normal file
|
@ -0,0 +1,130 @@
|
|||
package WayofTime.bloodmagic.item;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.altar.BloodAltar;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.altar.AltarComponent;
|
||||
import WayofTime.bloodmagic.api.altar.EnumAltarTier;
|
||||
import WayofTime.bloodmagic.api.altar.IAltarManipulator;
|
||||
import WayofTime.bloodmagic.block.BlockAltar;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemAltarMaker extends Item implements IAltarManipulator {
|
||||
|
||||
private EnumAltarTier tierToBuild = EnumAltarTier.ONE;
|
||||
|
||||
public ItemAltarMaker() {
|
||||
super();
|
||||
setUnlocalizedName(Constants.Mod.MODID + ".altarMaker");
|
||||
setCreativeTab(BloodMagic.tabBloodMagic);
|
||||
setMaxStackSize(1);
|
||||
setFull3D();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
|
||||
tooltip.add(StatCollector.translateToLocal("tooltip.BloodMagic.currentTier") + " " + ((stack.getTagCompound() != null ? stack.getTagCompound().getInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER) : 0) + 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
|
||||
if (!player.capabilities.isCreativeMode || world.isRemote) return itemStack;
|
||||
|
||||
if (itemStack.getTagCompound() == null) {
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
itemStack.setTagCompound(tag);
|
||||
itemStack.getTagCompound().setInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER, 0);
|
||||
}
|
||||
if (player.isSneaking()) {
|
||||
if (itemStack.getTagCompound().getInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER) >= EnumAltarTier.MAXTIERS - 1) {
|
||||
itemStack.getTagCompound().setInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER, 0);
|
||||
setTierToBuild(EnumAltarTier.values()[itemStack.getTagCompound().getInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER)]);
|
||||
player.addChatComponentMessage(new ChatComponentTranslation(StatCollector.translateToLocal("misc.altarMaker.setTier"), itemStack.getTagCompound().getInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER) + 1));
|
||||
return itemStack;
|
||||
}
|
||||
else {
|
||||
itemStack.getTagCompound().setInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER, itemStack.getTagCompound().getInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER) + 1);
|
||||
setTierToBuild(EnumAltarTier.values()[itemStack.getTagCompound().getInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER)]);
|
||||
player.addChatComponentMessage(new ChatComponentTranslation(StatCollector.translateToLocal("misc.altarMaker.setTier"), itemStack.getTagCompound().getInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER) + 1));
|
||||
return itemStack;
|
||||
}
|
||||
}
|
||||
|
||||
MovingObjectPosition mop = getMovingObjectPositionFromPlayer(world, player, false);
|
||||
if (mop == null || mop.typeOfHit == MovingObjectPosition.MovingObjectType.MISS || mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY) return itemStack;
|
||||
|
||||
if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && world.getBlockState(mop.getBlockPos()).getBlock() instanceof BlockAltar) {
|
||||
|
||||
player.addChatComponentMessage(new ChatComponentTranslation(StatCollector.translateToLocal("misc.altarMaker.building"), tierToBuild));
|
||||
buildAltar(world, mop.getBlockPos());
|
||||
|
||||
world.markBlockForUpdate(mop.getBlockPos());
|
||||
}
|
||||
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
public void setTierToBuild(EnumAltarTier tierToBuild) {
|
||||
this.tierToBuild = tierToBuild;
|
||||
}
|
||||
|
||||
public void buildAltar(World world, BlockPos pos) {
|
||||
|
||||
if (world.isRemote) return;
|
||||
|
||||
if (tierToBuild == EnumAltarTier.ONE) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (AltarComponent altarComponent : tierToBuild.getAltarComponents()) {
|
||||
BlockPos componentPos = pos.add(altarComponent.getOffset());
|
||||
IBlockState blockState = altarComponent.getBlockStack().getBlock().getStateFromMeta(altarComponent.getBlockStack().getMeta());
|
||||
|
||||
if (altarComponent.getBlockStack().getBlock().equals(Blocks.air))
|
||||
world.setBlockState(componentPos, Blocks.stonebrick.getStateFromMeta(0));
|
||||
else
|
||||
world.setBlockState(componentPos, blockState);
|
||||
|
||||
world.markBlockForUpdate(componentPos);
|
||||
}
|
||||
|
||||
world.markBlockForUpdate(pos);
|
||||
}
|
||||
|
||||
public String destroyAltar(EntityPlayer player) {
|
||||
World world = player.worldObj;
|
||||
if (world.isRemote) return "";
|
||||
|
||||
MovingObjectPosition mop = getMovingObjectPositionFromPlayer(world, player, false);
|
||||
BlockPos pos = mop.getBlockPos();
|
||||
EnumAltarTier altarTier = BloodAltar.getAltarTier(world, pos);
|
||||
|
||||
if (altarTier.equals(EnumAltarTier.ONE)) return "" + altarTier.toInt();
|
||||
else {
|
||||
for (AltarComponent altarComponent : altarTier.getAltarComponents()) {
|
||||
BlockPos componentPos = pos.add(altarComponent.getOffset());
|
||||
|
||||
world.setBlockToAir(componentPos);
|
||||
world.markBlockForUpdate(componentPos);
|
||||
}
|
||||
}
|
||||
|
||||
world.markBlockForUpdate(pos);
|
||||
return "" + altarTier.toInt();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package WayofTime.bloodmagic.item.block;
|
||||
|
||||
import WayofTime.bloodmagic.block.BlockCrystal;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemBlockCrystal extends ItemBlock {
|
||||
|
||||
public ItemBlockCrystal(Block block) {
|
||||
super(block);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
return super.getUnlocalizedName(stack) + BlockCrystal.names[stack.getItemDamage()];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int meta) {
|
||||
return meta;
|
||||
}
|
||||
}
|
|
@ -20,6 +20,7 @@ public class ModBlocks {
|
|||
public static Block bloodRune;
|
||||
public static Block ritualController;
|
||||
public static Block ritualStone;
|
||||
public static Block bloodLight;
|
||||
public static Block testSpellBlock;
|
||||
public static Block pedestal;
|
||||
public static Block teleposer;
|
||||
|
@ -37,9 +38,11 @@ public class ModBlocks {
|
|||
bloodRune = registerBlock(new BlockBloodRune(), ItemBlockBloodRune.class);
|
||||
ritualController = registerBlock(new BlockRitualController(), ItemBlockRitualController.class);
|
||||
ritualStone = registerBlock(new BlockRitualStone(), ItemBlockRitualStone.class);
|
||||
bloodLight = registerBlock(new BlockBloodLight());
|
||||
testSpellBlock = registerBlock(new BlockTestSpellBlock());
|
||||
pedestal = registerBlock(new BlockPedestal(), ItemBlockPedestal.class);
|
||||
teleposer = registerBlock(new BlockTeleposer());
|
||||
crystal = registerBlock(new BlockCrystal(), ItemBlockCrystal.class);
|
||||
bloodStoneBrick = registerBlock(new BlockBloodStoneBrick(), ItemBlockBloodStoneBrick.class);
|
||||
|
||||
initTiles();
|
||||
|
@ -77,6 +80,9 @@ public class ModBlocks {
|
|||
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(ritualStone), 6);
|
||||
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(bloodStoneBrick), 0);
|
||||
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(bloodStoneBrick), 1);
|
||||
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(crystal), 0);
|
||||
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(crystal), 1);
|
||||
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(bloodLight));
|
||||
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(pedestal), 0);
|
||||
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(pedestal), 1);
|
||||
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(teleposer));
|
||||
|
|
|
@ -6,10 +6,7 @@ import WayofTime.bloodmagic.api.BloodMagicAPI;
|
|||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.orb.BloodOrb;
|
||||
import WayofTime.bloodmagic.api.registry.OrbRegistry;
|
||||
import WayofTime.bloodmagic.item.ItemActivationCrystal;
|
||||
import WayofTime.bloodmagic.item.ItemBloodOrb;
|
||||
import WayofTime.bloodmagic.item.ItemBucketEssence;
|
||||
import WayofTime.bloodmagic.item.ItemSacrificialDagger;
|
||||
import WayofTime.bloodmagic.item.*;
|
||||
import WayofTime.bloodmagic.item.armour.ItemLivingArmour;
|
||||
import WayofTime.bloodmagic.item.gear.ItemPackSacrifice;
|
||||
import WayofTime.bloodmagic.item.gear.ItemPackSelfSacrifice;
|
||||
|
@ -47,6 +44,8 @@ public class ModItems {
|
|||
public static Item livingArmourLegs;
|
||||
public static Item livingArmourBoots;
|
||||
|
||||
public static Item altarMaker;
|
||||
|
||||
public static void init() {
|
||||
bloodOrb = registerItem(new ItemBloodOrb());
|
||||
BloodMagicAPI.setOrbItem(bloodOrb);
|
||||
|
@ -81,6 +80,8 @@ public class ModItems {
|
|||
livingArmourChest = registerItem(new ItemLivingArmour(1), "ItemLivingArmourChest");
|
||||
livingArmourLegs = registerItem(new ItemLivingArmour(2), "ItemLivingArmourLegs");
|
||||
livingArmourBoots = registerItem(new ItemLivingArmour(3), "ItemLivingArmourBoots");
|
||||
|
||||
altarMaker = registerItem(new ItemAltarMaker());
|
||||
}
|
||||
|
||||
public static void initRenders() {
|
||||
|
@ -115,6 +116,8 @@ public class ModItems {
|
|||
renderHelper.itemRender(livingArmourChest);
|
||||
renderHelper.itemRender(livingArmourLegs);
|
||||
renderHelper.itemRender(livingArmourBoots);
|
||||
|
||||
renderHelper.itemRender(altarMaker);
|
||||
}
|
||||
|
||||
private static Item registerItem(Item item, String name) {
|
||||
|
|
|
@ -28,7 +28,7 @@ public class TileAltar extends TileInventory implements IBloodAltar, ITickable,
|
|||
protected FluidStack fluidOutput = new FluidStack(BlockLifeEssence.getLifeEssence(), 0);
|
||||
protected FluidStack fluidInput = new FluidStack(BlockLifeEssence.getLifeEssence(), 0);
|
||||
private EnumAltarTier altarTier = EnumAltarTier.ONE;
|
||||
private AltarUpgrade upgrade = new AltarUpgrade();
|
||||
private AltarUpgrade upgrade;
|
||||
private int capacity = FluidContainerRegistry.BUCKET_VOLUME * 10;
|
||||
private FluidStack fluid = new FluidStack(BloodMagicAPI.getLifeEssence(), 0);
|
||||
private int liquidRequired; //mB
|
||||
|
@ -316,15 +316,40 @@ public class TileAltar extends TileInventory implements IBloodAltar, ITickable,
|
|||
EnumAltarTier tier = BloodAltar.getAltarTier(getWorld(), getPos());
|
||||
this.altarTier = tier;
|
||||
|
||||
if (tier.equals(EnumAltarTier.ONE))
|
||||
upgrade = new AltarUpgrade();
|
||||
else
|
||||
upgrade = BloodAltar.getUpgrades(getWorld(), pos, tier);
|
||||
upgrade = BloodAltar.getUpgrades(getWorld(), pos, tier);
|
||||
|
||||
if (this.fluid.amount > this.capacity)
|
||||
this.fluid.amount = this.capacity;
|
||||
if (tier.equals(EnumAltarTier.ONE)) {
|
||||
upgrade = null;
|
||||
isUpgraded = false;
|
||||
this.consumptionMultiplier = 0;
|
||||
this.efficiencyMultiplier = 1;
|
||||
this.sacrificeEfficiencyMultiplier = 0;
|
||||
this.selfSacrificeEfficiencyMultiplier = 0;
|
||||
this.capacityMultiplier = 1;
|
||||
this.orbCapacityMultiplier = 1;
|
||||
this.dislocationMultiplier = 1;
|
||||
this.accelerationUpgrades = 0;
|
||||
return;
|
||||
}
|
||||
else if (!tier.equals(EnumAltarTier.ONE) && upgrade != null) {
|
||||
this.isUpgraded = true;
|
||||
this.consumptionMultiplier = (float) (0.20 * upgrade.getSpeedCount());
|
||||
this.efficiencyMultiplier = (float) Math.pow(0.85, upgrade.getEfficiencyCount());
|
||||
this.sacrificeEfficiencyMultiplier = (float) (0.10 * upgrade.getSacrificeCount());
|
||||
this.selfSacrificeEfficiencyMultiplier = (float) (0.10 * upgrade.getSelfSacrificeCount());
|
||||
this.capacityMultiplier = (float) ((1 * Math.pow(1.10, upgrade.getBetterCapacityCount()) + 0.20 * upgrade.getCapacityCount()));
|
||||
this.dislocationMultiplier = (float) (Math.pow(1.2, upgrade.getDisplacementCount()));
|
||||
this.orbCapacityMultiplier = (float) (1 + 0.02 * upgrade.getOrbCapacityCount());
|
||||
this.capacity = (int) (FluidContainerRegistry.BUCKET_VOLUME * 10 * capacityMultiplier);
|
||||
this.bufferCapacity = (int) (FluidContainerRegistry.BUCKET_VOLUME * 1 * capacityMultiplier);
|
||||
this.accelerationUpgrades = upgrade.getAccelerationCount();
|
||||
}
|
||||
|
||||
getWorld().markBlockForUpdate(pos);
|
||||
if (this.fluid.amount > this.capacity) this.fluid.amount = this.capacity;
|
||||
if (this.fluidOutput.amount > this.bufferCapacity) this.fluidOutput.amount = this.bufferCapacity;
|
||||
if (this.fluidInput.amount > this.bufferCapacity) this.fluidInput.amount = this.bufferCapacity;
|
||||
|
||||
worldObj.markBlockForUpdate(pos);
|
||||
}
|
||||
|
||||
public int fillMainTank(int amount) {
|
||||
|
|
|
@ -21,6 +21,7 @@ public class Utils {
|
|||
|
||||
/**
|
||||
* Used for inserting an ItemStack with a stacksize of 1 to a tile's inventory at slot 0.
|
||||
* Returns {@code true} if the ItemStack is inserted, {@code false} otherwise
|
||||
* <p/>
|
||||
* EG: Block Altar
|
||||
*
|
||||
|
|
|
@ -1,15 +1,21 @@
|
|||
package WayofTime.bloodmagic.util.handler;
|
||||
|
||||
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
|
||||
import WayofTime.bloodmagic.block.BlockAltar;
|
||||
import WayofTime.bloodmagic.item.ItemAltarMaker;
|
||||
import WayofTime.bloodmagic.item.gear.ItemPackSacrifice;
|
||||
import WayofTime.bloodmagic.registry.ModBlocks;
|
||||
import WayofTime.bloodmagic.registry.ModItems;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.event.entity.living.LivingHurtEvent;
|
||||
import net.minecraftforge.event.entity.player.FillBucketEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
|
@ -55,4 +61,12 @@ public class EventHandler {
|
|||
event.result = result;
|
||||
event.setResult(Event.Result.ALLOW);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void harvestEvent(PlayerEvent.HarvestCheck event) {
|
||||
if (event.block != null && event.block instanceof BlockAltar && event.entityPlayer != null && event.entityPlayer instanceof EntityPlayerMP && event.entityPlayer.getCurrentEquippedItem() != null && event.entityPlayer.getCurrentEquippedItem().getItem() instanceof ItemAltarMaker) {
|
||||
ItemAltarMaker altarMaker = (ItemAltarMaker) event.entityPlayer.getCurrentEquippedItem().getItem();
|
||||
event.entityPlayer.addChatComponentMessage(new ChatComponentTranslation(StatCollector.translateToLocal("misc.altarMaker.destroy"), altarMaker.destroyAltar(event.entityPlayer)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue