BloodMagic/src/main/java/WayofTime/bloodmagic/api/BlockStack.java
Tombenpotter 7e8aec8652 Huge commit for the Pull-Request.
Added a lot of things:
- Blood Tank
- Teleposition Sigil
- Transposition Sigil
- Cobblestone/Netherrack/Obisidian generation Ritual
- Tree Cutter Ritual
- Pump Ritual
- Altar Builder Ritual
- Block Placing Ritual
- Portal Ritual
- Teleportation System and API Components
- Cross pattern Area Descriptor
- Two reagents and their textures for the sigils’ crafting

Fixed:
- Teleposer not teleporting entities correctly

And probably other things I forgot!
2016-02-18 17:25:11 +01:00

48 lines
1.2 KiB
Java

package WayofTime.bloodmagic.api;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.registry.GameData;
@Getter
@EqualsAndHashCode(exclude = {"state"})
public class BlockStack
{
private final Block block;
private final int meta;
private final IBlockState state;
public BlockStack(Block block, int meta)
{
this.block = block;
this.meta = meta;
this.state = block.getStateFromMeta(meta);
}
public BlockStack(Block block)
{
this(block, 0);
}
public static BlockStack getStackFromPos(World world, BlockPos pos)
{
IBlockState state = world.getBlockState(pos);
return new BlockStack(state.getBlock(), state.getBlock().getMetaFromState(state));
}
public ItemStack getItemStack()
{
return new ItemStack(block, 1, meta);
}
@Override
public String toString()
{
return GameData.getBlockRegistry().getNameForObject(getBlock()) + ":" + getMeta();
}
}