Merge pull request #495 from Arcaratus/1.8-Rewrite
Finished Water, Lava, and Void sigils
This commit is contained in:
commit
12e764e5be
|
@ -3,6 +3,7 @@ package WayofTime.bloodmagic.altar;
|
|||
import WayofTime.bloodmagic.api.BlockStack;
|
||||
import WayofTime.bloodmagic.api.altar.*;
|
||||
import WayofTime.bloodmagic.block.BlockBloodRune;
|
||||
import WayofTime.bloodmagic.block.BlockBloodStoneBrick;
|
||||
import WayofTime.bloodmagic.registry.ModBlocks;
|
||||
import net.minecraft.block.BlockBeacon;
|
||||
import net.minecraft.block.BlockGlowstone;
|
||||
|
@ -19,7 +20,6 @@ public class BloodAltar {
|
|||
if (checkAltarIsValid(world, pos, i)) {
|
||||
return EnumAltarTier.values()[i];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return EnumAltarTier.ONE;
|
||||
|
@ -47,10 +47,8 @@ public class BloodAltar {
|
|||
return false;
|
||||
}
|
||||
|
||||
public static AltarUpgrade getUpgrades(World world, BlockPos pos, EnumAltarTier altarTier)
|
||||
{
|
||||
if (world.isRemote)
|
||||
{
|
||||
public static AltarUpgrade getUpgrades(World world, BlockPos pos, EnumAltarTier altarTier) {
|
||||
if (world.isRemote) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -119,8 +117,8 @@ public class BloodAltar {
|
|||
}
|
||||
|
||||
private static boolean checkSpecials(AltarComponent altarComponent, BlockStack blockStack) {
|
||||
if (altarComponent.getBlockStack().getBlock() == ModBlocks.bloodStone)
|
||||
// if (blockStack.getBlock() instanceof BlockBloodStone || (blockStack.getBlock() instanceof IAltarComponent && (((IAltarComponent) blockStack.getBlock()).getType(blockStack.getMeta()) == EnumAltarComponent.BLOODSTONE)))
|
||||
if (altarComponent.getBlockStack().getBlock() == ModBlocks.bloodStoneBrick)
|
||||
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)
|
||||
|
|
|
@ -76,10 +76,10 @@ public enum EnumAltarTier {
|
|||
altarComponents.add(new AltarComponent(new BlockPos(-5, i, 5)));
|
||||
}
|
||||
|
||||
altarComponents.add(new AltarComponent(new BlockPos(5, 2, 5), new BlockStack(ModBlocks.bloodStone, 1)));
|
||||
altarComponents.add(new AltarComponent(new BlockPos(5, 2, -5), new BlockStack(ModBlocks.bloodStone, 1)));
|
||||
altarComponents.add(new AltarComponent(new BlockPos(-5, 2, -5), new BlockStack(ModBlocks.bloodStone, 1)));
|
||||
altarComponents.add(new AltarComponent(new BlockPos(-5, 2, 5), new BlockStack(ModBlocks.bloodStone, 1)));
|
||||
altarComponents.add(new AltarComponent(new BlockPos(5, 2, 5), new BlockStack(ModBlocks.bloodStoneBrick, 1)));
|
||||
altarComponents.add(new AltarComponent(new BlockPos(5, 2, -5), new BlockStack(ModBlocks.bloodStoneBrick, 1)));
|
||||
altarComponents.add(new AltarComponent(new BlockPos(-5, 2, -5), new BlockStack(ModBlocks.bloodStoneBrick, 1)));
|
||||
altarComponents.add(new AltarComponent(new BlockPos(-5, 2, 5), new BlockStack(ModBlocks.bloodStoneBrick, 1)));
|
||||
}
|
||||
},
|
||||
FIVE() {
|
||||
|
|
|
@ -24,7 +24,7 @@ public class BlockBloodRune extends Block {
|
|||
public static final PropertyInteger META = PropertyInteger.create("META", 0, names.length - 1);
|
||||
|
||||
public BlockBloodRune() {
|
||||
super(Material.iron);
|
||||
super(Material.rock);
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + ".rune.");
|
||||
setCreativeTab(BloodMagic.tabBloodMagic);
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.PropertyInteger;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockBloodStoneBrick extends Block {
|
||||
|
||||
public static final String[] names = { "normal", "large" };
|
||||
public static final PropertyInteger META = PropertyInteger.create("META", 0, names.length - 1);
|
||||
|
||||
public BlockBloodStoneBrick() {
|
||||
super(Material.rock);
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + ".bloodstonebrick.");
|
||||
setCreativeTab(BloodMagic.tabBloodMagic);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setStepSound(soundTypeStone);
|
||||
setHarvestLevel("pickaxe", 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(META, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return (Integer) state.getValue(META);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state) {
|
||||
return getMetaFromState(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockState createBlockState() {
|
||||
return new BlockState(this, META);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) {
|
||||
return new ItemStack(this, 1, this.getMetaFromState(world.getBlockState(pos)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SuppressWarnings("unchecked")
|
||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list) {
|
||||
for (int i = 0; i < names.length; i++)
|
||||
list.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
}
|
|
@ -38,8 +38,7 @@ public class BlockRitualStone extends Block implements IRitualStone {
|
|||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState()
|
||||
.withProperty(TYPE, EnumRuneType.byMetadata(meta));
|
||||
return this.getDefaultState().withProperty(TYPE, EnumRuneType.byMetadata(meta));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
69
src/main/java/WayofTime/bloodmagic/block/BlockSocket.java
Normal file
69
src/main/java/WayofTime/bloodmagic/block/BlockSocket.java
Normal file
|
@ -0,0 +1,69 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.PropertyInteger;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockSocket extends Block {
|
||||
|
||||
public static final String[] names = { "empty", "filled" };
|
||||
public static final PropertyInteger META = PropertyInteger.create("META", 0, names.length - 1);
|
||||
|
||||
public BlockSocket() {
|
||||
super(Material.iron);
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + ".socket.");
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setStepSound(soundTypeMetal);
|
||||
setHarvestLevel("pickaxe", 2);
|
||||
setCreativeTab(BloodMagic.tabBloodMagic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(META, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return (Integer) state.getValue(META);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state) {
|
||||
return getMetaFromState(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockState createBlockState() {
|
||||
return new BlockState(this, META);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) {
|
||||
return new ItemStack(this, 1, this.getMetaFromState(world.getBlockState(pos)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SuppressWarnings("unchecked")
|
||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list) {
|
||||
for (int i = 0; i < names.length; i++)
|
||||
list.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
}
|
34
src/main/java/WayofTime/bloodmagic/block/BlockSoulForge.java
Normal file
34
src/main/java/WayofTime/bloodmagic/block/BlockSoulForge.java
Normal file
|
@ -0,0 +1,34 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockSoulForge extends Block {
|
||||
|
||||
public BlockSoulForge() {
|
||||
super(Material.iron);
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + ".soulforge.");
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setStepSound(soundTypeMetal);
|
||||
setHarvestLevel("pickaxe", 2);
|
||||
setCreativeTab(BloodMagic.tabBloodMagic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (world.isRemote)
|
||||
return false;
|
||||
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package WayofTime.bloodmagic.item.block;
|
||||
|
||||
import WayofTime.bloodmagic.block.BlockBloodStoneBrick;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemBlockBloodStoneBrick extends ItemBlock {
|
||||
|
||||
public ItemBlockBloodStoneBrick(Block block) {
|
||||
super(block);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
return super.getUnlocalizedName(stack) + BlockBloodStoneBrick.names[stack.getItemDamage()];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int meta) {
|
||||
return meta;
|
||||
}
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
package WayofTime.bloodmagic.item.sigil;
|
||||
|
||||
import WayofTime.bloodmagic.registry.ModPotions;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
|
132
src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilLava.java
Normal file
132
src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilLava.java
Normal file
|
@ -0,0 +1,132 @@
|
|||
package WayofTime.bloodmagic.item.sigil;
|
||||
|
||||
import WayofTime.bloodmagic.api.util.helper.BindableHelper;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
public class ItemSigilLava extends ItemSigilBase {
|
||||
|
||||
public ItemSigilLava() {
|
||||
super("lava", 1000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
if (!world.isRemote && !isUnusable(stack)) {
|
||||
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, true);
|
||||
|
||||
if (movingobjectposition != null) {
|
||||
ItemStack ret = net.minecraftforge.event.ForgeEventFactory.onBucketUse(player, world, stack, movingobjectposition);
|
||||
if (ret != null) return ret;
|
||||
|
||||
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
|
||||
BlockPos blockpos = movingobjectposition.getBlockPos();
|
||||
|
||||
if (!world.isBlockModifiable(player, blockpos)) {
|
||||
return stack;
|
||||
}
|
||||
|
||||
if (!player.canPlayerEdit(blockpos.offset(movingobjectposition.sideHit), movingobjectposition.sideHit, stack)) {
|
||||
return stack;
|
||||
}
|
||||
|
||||
|
||||
BlockPos blockpos1 = blockpos.offset(movingobjectposition.sideHit);
|
||||
|
||||
if (!player.canPlayerEdit(blockpos1, movingobjectposition.sideHit, stack)) {
|
||||
return stack;
|
||||
}
|
||||
|
||||
if (this.canPlaceLava(world, blockpos1) && syphonBatteries(stack, player, getEnergyUsed())) {
|
||||
this.tryPlaceLava(world, blockpos1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
return stack;
|
||||
}
|
||||
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
this.setUnusable(stack, !syphonBatteries(stack, player, getEnergyUsed()));
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos blockPos, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (world.isRemote || !BindableHelper.checkAndSetItemOwner(stack, player) || player.isSneaking() || isUnusable(stack)) {
|
||||
return false;
|
||||
}
|
||||
if (!world.canMineBlockBody(player, blockPos)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TileEntity tile = world.getTileEntity(blockPos);
|
||||
if (tile instanceof IFluidHandler) {
|
||||
FluidStack fluid = new FluidStack(FluidRegistry.LAVA, 1000);
|
||||
int amount = ((IFluidHandler) tile).fill(side, fluid, false);
|
||||
|
||||
if (amount > 0 && syphonBatteries(stack, player, getEnergyUsed())) {
|
||||
((IFluidHandler) tile).fill(side, fluid, true);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
// else if (tile instanceof TESocket) {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
{
|
||||
int x = blockPos.getX();
|
||||
int y = blockPos.getY();
|
||||
int z = blockPos.getZ();
|
||||
|
||||
if (side.getIndex() == 0) --y;
|
||||
if (side.getIndex() == 1) ++y;
|
||||
if (side.getIndex() == 2) --z;
|
||||
if (side.getIndex() == 3) ++z;
|
||||
if (side.getIndex() == 4) --x;
|
||||
if (side.getIndex() == 5) ++x;
|
||||
|
||||
if (!player.canPlayerEdit(new BlockPos(x, y, z), side, stack)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.canPlaceLava(world, new BlockPos(x, y, z)) && syphonBatteries(stack, player, getEnergyUsed())) {
|
||||
return this.tryPlaceLava(world, new BlockPos(x, y, z));
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canPlaceLava(World world, BlockPos blockPos) {
|
||||
if (!world.isAirBlock(blockPos) && world.getBlockState(blockPos).getBlock().getMaterial().isSolid()) {
|
||||
return false;
|
||||
}
|
||||
else if ((world.getBlockState(blockPos).getBlock() == Blocks.lava || world.getBlockState(blockPos).getBlock() == Blocks.flowing_lava) && world.getBlockState(blockPos).getBlock().getMetaFromState(world.getBlockState(blockPos)) == 0) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
world.setBlockState(blockPos, Blocks.lava.getBlockState().getBaseState());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean tryPlaceLava(World worldIn, BlockPos pos) {
|
||||
Material material = worldIn.getBlockState(pos).getBlock().getMaterial();
|
||||
|
||||
return worldIn.isAirBlock(pos) && !material.isSolid();
|
||||
}
|
||||
}
|
108
src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilVoid.java
Normal file
108
src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilVoid.java
Normal file
|
@ -0,0 +1,108 @@
|
|||
package WayofTime.bloodmagic.item.sigil;
|
||||
|
||||
import WayofTime.bloodmagic.api.util.helper.BindableHelper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidBlock;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
public class ItemSigilVoid extends ItemSigilBase {
|
||||
|
||||
public ItemSigilVoid() {
|
||||
super("void", 50);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
if (!world.isRemote && !isUnusable(stack)) {
|
||||
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, true);
|
||||
|
||||
if (movingobjectposition != null) {
|
||||
ItemStack ret = net.minecraftforge.event.ForgeEventFactory.onBucketUse(player, world, stack, movingobjectposition);
|
||||
if (ret != null) return ret;
|
||||
|
||||
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
|
||||
BlockPos blockpos = movingobjectposition.getBlockPos();
|
||||
|
||||
if (!world.isBlockModifiable(player, blockpos)) {
|
||||
return stack;
|
||||
}
|
||||
|
||||
if (!player.canPlayerEdit(blockpos.offset(movingobjectposition.sideHit), movingobjectposition.sideHit, stack)) {
|
||||
return stack;
|
||||
}
|
||||
|
||||
if (!player.canPlayerEdit(blockpos, movingobjectposition.sideHit, stack)) {
|
||||
return stack;
|
||||
}
|
||||
|
||||
if (world.getBlockState(blockpos).getBlock().getMaterial().isLiquid() && syphonBatteries(stack, player, getEnergyUsed())) {
|
||||
world.setBlockToAir(blockpos);
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
return stack;
|
||||
}
|
||||
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
this.setUnusable(stack, !syphonBatteries(stack, player, getEnergyUsed()));
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos blockPos, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (world.isRemote || !BindableHelper.checkAndSetItemOwner(stack, player) || player.isSneaking() || isUnusable(stack)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!world.canMineBlockBody(player, blockPos)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TileEntity tile = world.getTileEntity(blockPos);
|
||||
if (tile instanceof IFluidHandler) {
|
||||
FluidStack amount = ((IFluidHandler) tile).drain(side, 1000, false);
|
||||
|
||||
if (amount != null && amount.amount > 0 && syphonBatteries(stack, player, getEnergyUsed())) {
|
||||
((IFluidHandler) tile).drain(side, 1000, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
{
|
||||
int x = blockPos.getX();
|
||||
int y = blockPos.getY();
|
||||
int z = blockPos.getZ();
|
||||
|
||||
if (side.getIndex() == 0) --y;
|
||||
if (side.getIndex() == 1) ++y;
|
||||
if (side.getIndex() == 2) --z;
|
||||
if (side.getIndex() == 3) ++z;
|
||||
if (side.getIndex() == 4) --x;
|
||||
if (side.getIndex() == 5) ++x;
|
||||
|
||||
if (!player.canPlayerEdit(new BlockPos(x, y, z), side, stack)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (world.getBlockState(new BlockPos(x, y, z)).getBlock() instanceof IFluidBlock && syphonBatteries(stack, player, getEnergyUsed())) {
|
||||
world.setBlockToAir(new BlockPos(x, y, z));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,149 @@
|
|||
package WayofTime.bloodmagic.item.sigil;
|
||||
|
||||
import WayofTime.bloodmagic.api.util.helper.BindableHelper;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
public class ItemSigilWater extends ItemSigilBase {
|
||||
|
||||
public ItemSigilWater() {
|
||||
super("water", 100);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
if (!world.isRemote && !isUnusable(stack)) {
|
||||
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, true);
|
||||
|
||||
if (movingobjectposition != null) {
|
||||
ItemStack ret = net.minecraftforge.event.ForgeEventFactory.onBucketUse(player, world, stack, movingobjectposition);
|
||||
if (ret != null) return ret;
|
||||
|
||||
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
|
||||
BlockPos blockpos = movingobjectposition.getBlockPos();
|
||||
|
||||
if (!world.isBlockModifiable(player, blockpos)) {
|
||||
return stack;
|
||||
}
|
||||
|
||||
if (!player.canPlayerEdit(blockpos.offset(movingobjectposition.sideHit), movingobjectposition.sideHit, stack)) {
|
||||
return stack;
|
||||
}
|
||||
|
||||
BlockPos blockpos1 = blockpos.offset(movingobjectposition.sideHit);
|
||||
|
||||
if (!player.canPlayerEdit(blockpos1, movingobjectposition.sideHit, stack)) {
|
||||
return stack;
|
||||
}
|
||||
|
||||
if (this.canPlaceWater(world, blockpos1) && syphonBatteries(stack, player, getEnergyUsed())) {
|
||||
this.tryPlaceWater(world, blockpos1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
return stack;
|
||||
}
|
||||
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
this.setUnusable(stack, !syphonBatteries(stack, player, getEnergyUsed()));
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos blockPos, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (world.isRemote || !BindableHelper.checkAndSetItemOwner(stack, player) || player.isSneaking() || isUnusable(stack)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!world.canMineBlockBody(player, blockPos)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TileEntity tile = world.getTileEntity(blockPos);
|
||||
if (tile instanceof IFluidHandler) {
|
||||
FluidStack fluid = new FluidStack(FluidRegistry.WATER, 1000);
|
||||
int amount = ((IFluidHandler) tile).fill(side, fluid, false);
|
||||
|
||||
if (amount > 0 && syphonBatteries(stack, player, getEnergyUsed())) {
|
||||
((IFluidHandler) tile).fill(side, fluid, true);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
// else if (tile instanceof TESocket) {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
{
|
||||
int x = blockPos.getX();
|
||||
int y = blockPos.getY();
|
||||
int z = blockPos.getZ();
|
||||
|
||||
if (side.getIndex() == 0) --y;
|
||||
if (side.getIndex() == 1) ++y;
|
||||
if (side.getIndex() == 2) --z;
|
||||
if (side.getIndex() == 3) ++z;
|
||||
if (side.getIndex() == 4) --x;
|
||||
if (side.getIndex() == 5) ++x;
|
||||
|
||||
if (!player.canPlayerEdit(new BlockPos(x, y, z), side, stack)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.canPlaceWater(world, new BlockPos(x, y, z)) && syphonBatteries(stack, player, getEnergyUsed())) {
|
||||
return this.tryPlaceWater(world, new BlockPos(x, y, z));
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canPlaceWater(World world, BlockPos blockPos) {
|
||||
return (world.isAirBlock(blockPos) && !world.getBlockState(blockPos).getBlock().getMaterial().isSolid()) && !((world.getBlockState(blockPos).getBlock() == Blocks.water || world.getBlockState(blockPos).getBlock() == Blocks.flowing_water) && world.getBlockState(blockPos).getBlock().getMetaFromState(world.getBlockState(blockPos)) == 0);
|
||||
}
|
||||
|
||||
public boolean tryPlaceWater(World worldIn, BlockPos pos) {
|
||||
|
||||
Material material = worldIn.getBlockState(pos).getBlock().getMaterial();
|
||||
boolean flag = !material.isSolid();
|
||||
|
||||
if (!worldIn.isAirBlock(pos) && !flag) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
if (worldIn.provider.doesWaterVaporize()) {
|
||||
int i = pos.getX();
|
||||
int j = pos.getY();
|
||||
int k = pos.getZ();
|
||||
worldIn.playSoundEffect((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), "random.fizz", 0.5F, 2.6F + (worldIn.rand.nextFloat() - worldIn.rand.nextFloat()) * 0.8F);
|
||||
|
||||
for (int l = 0; l < 8; ++l) {
|
||||
worldIn.spawnParticle(EnumParticleTypes.SMOKE_LARGE, (double) i + Math.random(), (double) j + Math.random(), (double) k + Math.random(), 0.0D, 0.0D, 0.0D, 0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!worldIn.isRemote && flag && !material.isLiquid()) {
|
||||
worldIn.destroyBlock(pos, true);
|
||||
}
|
||||
|
||||
worldIn.setBlockState(pos, Blocks.water.getDefaultState(), 3);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,17 +1,13 @@
|
|||
package WayofTime.bloodmagic.registry;
|
||||
|
||||
import WayofTime.bloodmagic.block.*;
|
||||
import WayofTime.bloodmagic.item.block.ItemBlockBloodStoneBrick;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.ConfigHandler;
|
||||
import WayofTime.bloodmagic.block.BlockAltar;
|
||||
import WayofTime.bloodmagic.block.BlockBloodRune;
|
||||
import WayofTime.bloodmagic.block.BlockLifeEssence;
|
||||
import WayofTime.bloodmagic.block.BlockRitualController;
|
||||
import WayofTime.bloodmagic.block.BlockRitualStone;
|
||||
import WayofTime.bloodmagic.block.BlockTestSpellBlock;
|
||||
import WayofTime.bloodmagic.item.block.ItemBlockBloodRune;
|
||||
import WayofTime.bloodmagic.item.block.ItemBlockRitualController;
|
||||
import WayofTime.bloodmagic.item.block.ItemBlockRitualStone;
|
||||
|
@ -31,7 +27,7 @@ public class ModBlocks
|
|||
public static Block lifeEssence;
|
||||
|
||||
public static Block crystal;
|
||||
public static Block bloodStone;
|
||||
public static Block bloodStoneBrick;
|
||||
|
||||
public static void init()
|
||||
{
|
||||
|
@ -44,6 +40,8 @@ public class ModBlocks
|
|||
ritualStone = registerBlock(new BlockRitualStone(), ItemBlockRitualStone.class);
|
||||
testSpellBlock = registerBlock(new BlockTestSpellBlock());
|
||||
|
||||
bloodStoneBrick = registerBlock(new BlockBloodStoneBrick(), ItemBlockBloodStoneBrick.class);
|
||||
|
||||
initTiles();
|
||||
}
|
||||
|
||||
|
@ -78,6 +76,8 @@ public class ModBlocks
|
|||
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(ritualStone), 4);
|
||||
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(ritualStone), 5);
|
||||
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(ritualStone), 6);
|
||||
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(bloodStoneBrick), 0);
|
||||
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(bloodStoneBrick), 1);
|
||||
}
|
||||
|
||||
private static Block registerBlock(Block block, Class<? extends ItemBlock> itemBlock, String name) {
|
||||
|
|
|
@ -9,8 +9,7 @@ import WayofTime.bloodmagic.item.ItemActivationCrystal;
|
|||
import WayofTime.bloodmagic.item.ItemBloodOrb;
|
||||
import WayofTime.bloodmagic.item.ItemBucketEssence;
|
||||
import WayofTime.bloodmagic.item.ItemSacrificialDagger;
|
||||
import WayofTime.bloodmagic.item.sigil.ItemSigilAir;
|
||||
import WayofTime.bloodmagic.item.sigil.ItemSigilDivination;
|
||||
import WayofTime.bloodmagic.item.sigil.*;
|
||||
import WayofTime.bloodmagic.util.helper.InventoryRenderHelper;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
@ -33,6 +32,9 @@ public class ModItems {
|
|||
|
||||
public static Item sigilDivination;
|
||||
public static Item sigilAir;
|
||||
public static Item sigilWater;
|
||||
public static Item sigilLava;
|
||||
public static Item sigilVoid;
|
||||
|
||||
public static void init() {
|
||||
bloodOrb = registerItem(new ItemBloodOrb());
|
||||
|
@ -58,6 +60,9 @@ public class ModItems {
|
|||
|
||||
sigilDivination = registerItem(new ItemSigilDivination());
|
||||
sigilAir = registerItem(new ItemSigilAir());
|
||||
sigilWater = registerItem(new ItemSigilWater());
|
||||
sigilLava = registerItem(new ItemSigilLava());
|
||||
sigilVoid = registerItem(new ItemSigilVoid());
|
||||
}
|
||||
|
||||
public static void initRenders() {
|
||||
|
@ -82,6 +87,9 @@ public class ModItems {
|
|||
|
||||
renderHelper.itemRender(sigilDivination);
|
||||
renderHelper.itemRender(sigilAir);
|
||||
renderHelper.itemRender(sigilWater);
|
||||
renderHelper.itemRender(sigilLava);
|
||||
renderHelper.itemRender(sigilVoid);
|
||||
}
|
||||
|
||||
private static Item registerItem(Item item, String name) {
|
||||
|
|
|
@ -21,7 +21,7 @@ import net.minecraftforge.fluids.*;
|
|||
|
||||
public class TileAltar extends TileInventory implements IBloodAltar, IUpdatePlayerListBox, IFluidTank, IFluidHandler {
|
||||
|
||||
private EnumAltarTier altarTier = EnumAltarTier.ONE;
|
||||
private EnumAltarTier altarTier;
|
||||
private AltarUpgrade upgrade = new AltarUpgrade();
|
||||
private int capacity = FluidContainerRegistry.BUCKET_VOLUME * 10;
|
||||
|
||||
|
@ -298,6 +298,7 @@ public class TileAltar extends TileInventory implements IBloodAltar, IUpdatePlay
|
|||
// TODO - Write checking for tier stuff
|
||||
|
||||
EnumAltarTier tier = BloodAltar.getAltarTier(getWorld(), getPos());
|
||||
this.altarTier = tier;
|
||||
|
||||
if (tier.equals(EnumAltarTier.ONE))
|
||||
upgrade = new AltarUpgrade();
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"forge_marker": 1,
|
||||
"defaults": {
|
||||
"textures": { },
|
||||
"model": "cube_all",
|
||||
"uvlock": true
|
||||
},
|
||||
"variants": {
|
||||
"meta": {
|
||||
"0": {
|
||||
"textures": {
|
||||
"all": "bloodmagic:blocks/BloodStoneBrick"
|
||||
}
|
||||
},
|
||||
"1": {
|
||||
"textures": {
|
||||
"all": "bloodmagic:blocks/LargeBloodStoneBrick"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -55,6 +55,9 @@ item.BloodMagic.sigil.air.name=Air Sigil
|
|||
item.BloodMagic.sigil.bloodLight.name=Sigil of the Blood Lamp
|
||||
item.BloodMagic.sigil.compression.name=Sigil of Compression
|
||||
item.BloodMagic.sigil.divination.name=Divination Sigil
|
||||
item.BloodMagic.sigil.water.name=Water Sigil
|
||||
item.BloodMagic.sigil.lava.name=Lava Sigil
|
||||
item.BloodMagic.sigil.void.name=Void Sigil
|
||||
|
||||
# Blocks
|
||||
tile.BloodMagic.fluid.lifeEssence.name=Life Essence
|
||||
|
@ -74,6 +77,9 @@ tile.BloodMagic.rune.augCapacity.name=Rune of Augmented Capacity
|
|||
tile.BloodMagic.rune.orb.name=Rune of the Orb
|
||||
tile.BloodMagic.rune.acceleration.name=Acceleration Rune
|
||||
|
||||
tile.BloodMagic.bloodstonebrick.normal.name=Bloodstone Brick
|
||||
tile.BloodMagic.bloodstonebrick.large.name=Large Bloodstone Brick
|
||||
|
||||
# Tooltips
|
||||
tooltip.BloodMagic.orb.desc=Stores raw Life Essence
|
||||
tooltip.BloodMagic.orb.owner=Added by: %s
|
||||
|
@ -85,6 +91,9 @@ tooltip.BloodMagic.sigil.divination.desc=&oPeer into the soul
|
|||
tooltip.BloodMagic.sigil.divination.currentAltarTier=Current Tier: %d
|
||||
tooltip.BloodMagic.sigil.divination.currentEssence=Current Essence: %d LP
|
||||
tooltip.BloodMagic.sigil.divination.currentAltarCapacity=Current Capacity: %d LP
|
||||
tooltip.BloodMagic.sigil.water.desc=Infinite water, anyone?
|
||||
tooltip.BloodMagic.sigil.lava.desc=HOT! DO NOT EAT
|
||||
tooltip.BloodMagic.sigil.void.desc=Better than a Swiffer®!
|
||||
tooltip.BloodMagic.activationCrystal.weak=Activates low-level rituals
|
||||
tooltip.BloodMagic.activationCrystal.awakened=Activates more powerful rituals
|
||||
tooltip.BloodMagic.activationCrystal.creative=Creative Only - Activates any ritual
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "block/cube_all",
|
||||
"textures": {
|
||||
"all": "bloodmagic:blocks/BloodStoneBrick"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "block/cube_all",
|
||||
"textures": {
|
||||
"all": "bloodmagic:blocks/LargeBloodStoneBrick"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"parent": "bloodmagic:block/BlockBloodStoneBrick0",
|
||||
"display": {
|
||||
"thirdperson": {
|
||||
"rotation": [ 10, -45, 170 ],
|
||||
"translation": [ 0, 1.5, -2.75 ],
|
||||
"scale": [ 0.375, 0.375, 0.375 ]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"parent": "bloodmagic:block/BlockBloodStoneBrick1",
|
||||
"display": {
|
||||
"thirdperson": {
|
||||
"rotation": [ 10, -45, 170 ],
|
||||
"translation": [ 0, 1.5, -2.75 ],
|
||||
"scale": [ 0.375, 0.375, 0.375 ]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent":"bloodmagic:item/ItemModelBase",
|
||||
"textures": {
|
||||
"layer0":"bloodmagic:items/LavaSigil"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent":"bloodmagic:item/ItemModelBase",
|
||||
"textures": {
|
||||
"layer0":"bloodmagic:items/VoidSigil"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent":"bloodmagic:item/ItemModelBase",
|
||||
"textures": {
|
||||
"layer0":"bloodmagic:items/WaterSigil"
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue