mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-20 20:32:24 +00:00
Lots of changes, fixed a few crashes, and minor bugs. Also, doesnt need Asielib anymore
This commit is contained in:
1 parent
333c1d6596
commit
fd4351711a
146 files changed
+12167
-9527
No files matched your search
Executable → Regular
+94
-83
@@ -1,83 +1,94 @@
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import info.jbcs.minecraft.chisel.CarvableHelper;
|
||||
import info.jbcs.minecraft.chisel.CarvableVariation;
|
||||
import info.jbcs.minecraft.chisel.Chisel;
|
||||
import info.jbcs.minecraft.chisel.api.Carvable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public class BlockCarvable extends Block implements Carvable {
|
||||
public CarvableHelper carverHelper;
|
||||
private boolean isAlpha;
|
||||
|
||||
public BlockCarvable() {
|
||||
this(Material.rock);
|
||||
}
|
||||
|
||||
public BlockCarvable(Material m) {
|
||||
super(m);
|
||||
|
||||
carverHelper = new CarvableHelper();
|
||||
|
||||
setCreativeTab(Chisel.tabChisel);
|
||||
}
|
||||
|
||||
public BlockCarvable setStained(boolean a) {
|
||||
this.isAlpha = a;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderBlockPass()
|
||||
{
|
||||
return isAlpha ? 1 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
return carverHelper.getIcon(side, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){
|
||||
return carverHelper.getIcon(world, x, y, z, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
carverHelper.registerBlockIcons("Chisel",this,register);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tabs, List list){
|
||||
carverHelper.registerSubBlocks(this,tabs,list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return Chisel.RenderCTMId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
|
||||
}
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import info.jbcs.minecraft.chisel.api.ICarvable;
|
||||
import info.jbcs.minecraft.chisel.carving.CarvableHelper;
|
||||
import info.jbcs.minecraft.chisel.carving.CarvableVariation;
|
||||
import info.jbcs.minecraft.chisel.Chisel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public class BlockCarvable extends Block implements ICarvable
|
||||
{
|
||||
public CarvableHelper carverHelper;
|
||||
private boolean isAlpha;
|
||||
|
||||
public BlockCarvable()
|
||||
{
|
||||
this(Material.rock);
|
||||
}
|
||||
|
||||
public BlockCarvable(Material m)
|
||||
{
|
||||
super(m);
|
||||
|
||||
carverHelper = new CarvableHelper();
|
||||
|
||||
setCreativeTab(Chisel.tabChisel);
|
||||
}
|
||||
|
||||
public BlockCarvable setStained(boolean a)
|
||||
{
|
||||
this.isAlpha = a;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderBlockPass()
|
||||
{
|
||||
return isAlpha ? 1 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int metadata)
|
||||
{
|
||||
return carverHelper.getIcon(side, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
return carverHelper.getIcon(world, x, y, z, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int i)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register)
|
||||
{
|
||||
carverHelper.registerBlockIcons("Chisel", this, register);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tabs, List list)
|
||||
{
|
||||
carverHelper.registerSubBlocks(this, tabs, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return Chisel.RenderCTMId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(int metadata)
|
||||
{
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
|
||||
}
|
||||
Executable → Regular
+87
-77
@@ -1,77 +1,87 @@
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import info.jbcs.minecraft.chisel.CarvableHelper;
|
||||
import info.jbcs.minecraft.chisel.CarvableVariation;
|
||||
import info.jbcs.minecraft.chisel.Chisel;
|
||||
import info.jbcs.minecraft.chisel.api.Carvable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.BlockGlass;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class BlockCarvableGlass extends BlockGlass implements Carvable {
|
||||
public CarvableHelper carverHelper;
|
||||
private boolean isAlpha = false;
|
||||
|
||||
public BlockCarvableGlass() {
|
||||
super(Material.glass, false);
|
||||
|
||||
carverHelper = new CarvableHelper();
|
||||
|
||||
setCreativeTab(Chisel.tabChisel);
|
||||
}
|
||||
|
||||
public BlockCarvableGlass setStained(boolean a) {
|
||||
this.isAlpha = a;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return Chisel.RenderCTMId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
return carverHelper.getIcon(side, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
carverHelper.registerBlockIcons("Chisel",this,register);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tabs, List list){
|
||||
carverHelper.registerSubBlocks(this,tabs,list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderBlockPass()
|
||||
{
|
||||
return isAlpha ? 1 : 0;
|
||||
}
|
||||
}
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import info.jbcs.minecraft.chisel.api.ICarvable;
|
||||
import info.jbcs.minecraft.chisel.carving.CarvableHelper;
|
||||
import info.jbcs.minecraft.chisel.carving.CarvableVariation;
|
||||
import info.jbcs.minecraft.chisel.Chisel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.BlockGlass;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class BlockCarvableGlass extends BlockGlass implements ICarvable
|
||||
{
|
||||
public CarvableHelper carverHelper;
|
||||
private boolean isAlpha = false;
|
||||
|
||||
public BlockCarvableGlass()
|
||||
{
|
||||
super(Material.glass, false);
|
||||
|
||||
carverHelper = new CarvableHelper();
|
||||
|
||||
setCreativeTab(Chisel.tabChisel);
|
||||
}
|
||||
|
||||
public BlockCarvableGlass setStained(boolean a)
|
||||
{
|
||||
this.isAlpha = a;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return Chisel.RenderCTMId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int metadata)
|
||||
{
|
||||
return carverHelper.getIcon(side, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int i)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register)
|
||||
{
|
||||
carverHelper.registerBlockIcons("Chisel", this, register);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tabs, List list)
|
||||
{
|
||||
carverHelper.registerSubBlocks(this, tabs, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(int metadata)
|
||||
{
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderBlockPass()
|
||||
{
|
||||
return isAlpha ? 1 : 0;
|
||||
}
|
||||
}
|
||||
Executable → Regular
+82
-74
@@ -1,74 +1,82 @@
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import info.jbcs.minecraft.chisel.CarvableHelper;
|
||||
import info.jbcs.minecraft.chisel.CarvableVariation;
|
||||
import info.jbcs.minecraft.chisel.Chisel;
|
||||
import info.jbcs.minecraft.chisel.api.Carvable;
|
||||
import info.jbcs.minecraft.chisel.render.BlockMarblePaneRenderer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockPane;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class BlockCarvablePane extends BlockPane implements Carvable {
|
||||
public CarvableHelper carverHelper;
|
||||
private boolean isAlpha;
|
||||
|
||||
public BlockCarvablePane(Material material, boolean drops) {
|
||||
super("", "", material, drops);
|
||||
|
||||
carverHelper = new CarvableHelper();
|
||||
|
||||
setCreativeTab(Chisel.tabChisel);
|
||||
}
|
||||
|
||||
public BlockCarvablePane setStained(boolean a) {
|
||||
this.isAlpha = a;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderBlockPass()
|
||||
{
|
||||
return isAlpha ? 1 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return BlockMarblePaneRenderer.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
return carverHelper.getIcon(side, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
carverHelper.registerBlockIcons("Chisel",this,register);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tabs, List list){
|
||||
carverHelper.registerSubBlocks(this,tabs,list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
}
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import info.jbcs.minecraft.chisel.api.ICarvable;
|
||||
import info.jbcs.minecraft.chisel.carving.CarvableHelper;
|
||||
import info.jbcs.minecraft.chisel.carving.CarvableVariation;
|
||||
import info.jbcs.minecraft.chisel.Chisel;
|
||||
import info.jbcs.minecraft.chisel.client.render.BlockMarblePaneRenderer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.BlockPane;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class BlockCarvablePane extends BlockPane implements ICarvable
|
||||
{
|
||||
public CarvableHelper carverHelper;
|
||||
public boolean isAlpha;
|
||||
|
||||
public BlockCarvablePane(Material material, boolean drops)
|
||||
{
|
||||
super("", "", material, drops);
|
||||
|
||||
carverHelper = new CarvableHelper();
|
||||
|
||||
setCreativeTab(Chisel.tabChisel);
|
||||
}
|
||||
|
||||
public BlockCarvablePane setStained(boolean a)
|
||||
{
|
||||
this.isAlpha = a;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderBlockPass()
|
||||
{
|
||||
return isAlpha ? 1 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return BlockMarblePaneRenderer.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int metadata)
|
||||
{
|
||||
return carverHelper.getIcon(side, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int i)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register)
|
||||
{
|
||||
carverHelper.registerBlockIcons("Chisel", this, register);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tabs, List list)
|
||||
{
|
||||
carverHelper.registerSubBlocks(this, tabs, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(int metadata)
|
||||
{
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
}
|
||||
Executable → Regular
+36
-32
@@ -1,32 +1,36 @@
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public class BlockCarvablePowered extends BlockCarvable {
|
||||
public BlockCarvablePowered(Material m) {
|
||||
super(m);
|
||||
}
|
||||
|
||||
/**
|
||||
* Can this block provide power. Only wire currently seems to have this
|
||||
* change based on its state.
|
||||
*/
|
||||
@Override
|
||||
public boolean canProvidePower() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the block is emitting indirect/weak redstone power on the
|
||||
* specified side. If isBlockNormalCube returns true, standard redstone
|
||||
* propagation rules will apply instead and this will not be called. Args:
|
||||
* World, X, Y, Z, side. Note that the side is reversed - eg it is 1 (up)
|
||||
* when checking the bottom of the block.
|
||||
*/
|
||||
@Override
|
||||
public int isProvidingWeakPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) {
|
||||
return 15;
|
||||
}
|
||||
|
||||
}
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public class BlockCarvablePowered extends BlockCarvable
|
||||
{
|
||||
public BlockCarvablePowered(Material m)
|
||||
{
|
||||
super(m);
|
||||
}
|
||||
|
||||
/**
|
||||
* Can this block provide power. Only wire currently seems to have this
|
||||
* change based on its state.
|
||||
*/
|
||||
@Override
|
||||
public boolean canProvidePower()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the block is emitting indirect/weak redstone power on the
|
||||
* specified side. If isBlockNormalCube returns true, standard redstone
|
||||
* propagation rules will apply instead and this will not be called. Args:
|
||||
* World, X, Y, Z, side. Note that the side is reversed - eg it is 1 (up)
|
||||
* when checking the bottom of the block.
|
||||
*/
|
||||
@Override
|
||||
public int isProvidingWeakPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
|
||||
{
|
||||
return 15;
|
||||
}
|
||||
|
||||
}
|
||||
Executable → Regular
+81
-67
@@ -1,67 +1,81 @@
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockCloud extends BlockCarvable {
|
||||
|
||||
public BlockCloud() {
|
||||
super(Material.ice);
|
||||
|
||||
useNeighborBrightness = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World world, int i, int j, int k, Entity entity) {
|
||||
entity.fallDistance = 0.0F;
|
||||
|
||||
if (entity.motionY < 0.0D) {
|
||||
entity.motionY *= 0.0050000000000000001D;
|
||||
} else if(entity.motionY>0){
|
||||
entity.motionY+=0.0285;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderBlockPass() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
return super.shouldSideBeRendered(iblockaccess, i, j, k, 1 - l);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k) {
|
||||
return AxisAlignedBB.getBoundingBox(i+0.2, j, k+0.2, i+0.8, j+0.2, k+0.8);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int par1, Random rand, int par3) {
|
||||
return Item.getItemFromBlock(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random rand) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import info.jbcs.minecraft.chisel.Chisel;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockCloud extends BlockCarvable
|
||||
{
|
||||
|
||||
public BlockCloud()
|
||||
{
|
||||
super(Material.ice);
|
||||
|
||||
useNeighborBrightness = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World world, int i, int j, int k, Entity entity)
|
||||
{
|
||||
entity.fallDistance = 0.0F;
|
||||
|
||||
if(entity.motionY < 0.0D)
|
||||
{
|
||||
entity.motionY *= 0.0050000000000000001D;
|
||||
} else if(entity.motionY > 0)
|
||||
{
|
||||
entity.motionY += 0.0285;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getRenderBlockPass()
|
||||
{
|
||||
return Chisel.ghostCloud ? 1 : 0;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l)
|
||||
{
|
||||
return super.shouldSideBeRendered(iblockaccess, i, j, k, 1 - l);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k)
|
||||
{
|
||||
return AxisAlignedBB.getBoundingBox(i + 0.2, j, k + 0.2, i + 0.8, j + 0.2, k + 0.8);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int par1, Random rand, int par3)
|
||||
{
|
||||
return Item.getItemFromBlock(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random rand)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Executable → Regular
+37
-33
@@ -1,33 +1,37 @@
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import info.jbcs.minecraft.chisel.Chisel;
|
||||
import info.jbcs.minecraft.chisel.GeneralChiselClient;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
public class BlockConcrete extends BlockCarvable {
|
||||
|
||||
public BlockConcrete() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) {
|
||||
float f = 0.125F;
|
||||
return AxisAlignedBB.getAABBPool().getAABB(par2, par3, par4, (par2 + 1), ((par3 + 1) - f), (par4 + 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide() != Side.CLIENT)
|
||||
return;
|
||||
if(Chisel.concreteVelocity==0)
|
||||
return;
|
||||
|
||||
GeneralChiselClient.speedupPlayer(world,entity,Chisel.concreteVelocity);
|
||||
}
|
||||
|
||||
}
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import info.jbcs.minecraft.chisel.Chisel;
|
||||
import info.jbcs.minecraft.chisel.client.GeneralChiselClient;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
public class BlockConcrete extends BlockCarvable
|
||||
{
|
||||
|
||||
public BlockConcrete()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
float f = 0.125F;
|
||||
return AxisAlignedBB.getAABBPool().getAABB(par2, par3, par4, (par2 + 1), ((par3 + 1) - f), (par4 + 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity)
|
||||
{
|
||||
if(FMLCommonHandler.instance().getEffectiveSide() != Side.CLIENT)
|
||||
return;
|
||||
if(Chisel.concreteVelocity == 0)
|
||||
return;
|
||||
|
||||
GeneralChiselClient.speedupPlayer(world, entity, Chisel.concreteVelocity);
|
||||
}
|
||||
|
||||
}
|
||||
Executable → Regular
+20
-17
@@ -1,17 +1,20 @@
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import info.jbcs.minecraft.chisel.Chisel;
|
||||
|
||||
|
||||
public class BlockEldritch extends BlockCarvable {
|
||||
|
||||
public BlockEldritch() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return Chisel.RenderEldritchId;
|
||||
}
|
||||
|
||||
}
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import info.jbcs.minecraft.chisel.Chisel;
|
||||
|
||||
|
||||
public class BlockEldritch extends BlockCarvable
|
||||
{
|
||||
|
||||
public BlockEldritch()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return Chisel.RenderEldritchId;
|
||||
}
|
||||
|
||||
}
|
||||
Executable → Regular
+39
-35
@@ -1,35 +1,39 @@
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import info.jbcs.minecraft.chisel.GeneralChiselClient;
|
||||
import info.jbcs.minecraft.utilities.General;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockHolystone extends BlockCarvable{
|
||||
public IIcon iconStar;
|
||||
|
||||
public BlockHolystone(Material m) {
|
||||
super(m);
|
||||
|
||||
this.setLightLevel(0.25F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random random) {
|
||||
if(General.rand.nextInt(4)==0)
|
||||
GeneralChiselClient.spawnHolystoneFX(world,this,x,y,z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
super.registerBlockIcons(register);
|
||||
|
||||
iconStar=register.registerIcon("Chisel:holystone/particles/star");
|
||||
}
|
||||
|
||||
}
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import info.jbcs.minecraft.chisel.client.GeneralChiselClient;
|
||||
import info.jbcs.minecraft.utilities.General;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockHolystone extends BlockCarvable
|
||||
{
|
||||
public IIcon iconStar;
|
||||
|
||||
public BlockHolystone(Material m)
|
||||
{
|
||||
super(m);
|
||||
|
||||
this.setLightLevel(0.25F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random random)
|
||||
{
|
||||
if(General.rand.nextInt(4) == 0)
|
||||
GeneralChiselClient.spawnHolystoneFX(world, this, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register)
|
||||
{
|
||||
super.registerBlockIcons(register);
|
||||
|
||||
iconStar = register.registerIcon("Chisel:holystone/particles/star");
|
||||
}
|
||||
|
||||
}
|
||||
Executable → Regular
+25
-22
@@ -1,22 +1,25 @@
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
|
||||
import info.jbcs.minecraft.chisel.GeneralChiselClient;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockLavastone extends BlockMarbleTexturedOre {
|
||||
public BlockLavastone(Material mat, String baseIcon) {
|
||||
super(mat, baseIcon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random random) {
|
||||
if(random.nextInt(8)==0)
|
||||
GeneralChiselClient.spawnLavastoneFX(world,this,x,y,z);
|
||||
}
|
||||
|
||||
}
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
|
||||
import info.jbcs.minecraft.chisel.client.GeneralChiselClient;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockLavastone extends BlockMarbleTexturedOre
|
||||
{
|
||||
public BlockLavastone(Material mat, String baseIcon)
|
||||
{
|
||||
super(mat, baseIcon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random random)
|
||||
{
|
||||
if(random.nextInt(8) == 0)
|
||||
GeneralChiselClient.spawnLavastoneFX(world, this, x, y, z);
|
||||
}
|
||||
|
||||
}
|
||||
Executable → Regular
+35
-27
@@ -1,27 +1,35 @@
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class BlockLightstoneCarvable extends BlockCarvable {
|
||||
public BlockLightstoneCarvable() {
|
||||
super(Material.glass);
|
||||
}
|
||||
|
||||
@Override public int quantityDropped(Random random) {
|
||||
return Blocks.glowstone.quantityDropped(random);
|
||||
}
|
||||
|
||||
@Override public Item getItemDropped(int i,Random random,int a) {
|
||||
return Items.glowstone_dust;
|
||||
}
|
||||
|
||||
@Override public int damageDropped(int i) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class BlockLightstoneCarvable extends BlockCarvable
|
||||
{
|
||||
public BlockLightstoneCarvable()
|
||||
{
|
||||
super(Material.glass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random random)
|
||||
{
|
||||
return Blocks.glowstone.quantityDropped(random);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int i, Random random, int a)
|
||||
{
|
||||
return Items.glowstone_dust;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int i)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
Executable → Regular
+58
-51
@@ -1,51 +1,58 @@
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockMarbleBookshelf extends BlockCarvable {
|
||||
|
||||
public BlockMarbleBookshelf() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
if(side<2)
|
||||
return Blocks.planks.getBlockTextureFromSide(side);
|
||||
return super.getIcon(side, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){
|
||||
if(side<2)
|
||||
return Blocks.planks.getBlockTextureFromSide(side);
|
||||
return super.getIcon(world, x, y, z, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random par1Random) {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int par1, Random par2Random, int par3) {
|
||||
return Items.book;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getEnchantPowerBonus(World world, int x, int y, int z) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockMarbleBookshelf extends BlockCarvable
|
||||
{
|
||||
|
||||
public BlockMarbleBookshelf()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata)
|
||||
{
|
||||
if(side < 2)
|
||||
return Blocks.planks.getBlockTextureFromSide(side);
|
||||
return super.getIcon(side, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
if(side < 2)
|
||||
return Blocks.planks.getBlockTextureFromSide(side);
|
||||
return super.getIcon(world, x, y, z, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random par1Random)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int par1, Random par2Random, int par3)
|
||||
{
|
||||
return Items.book;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getEnchantPowerBonus(World world, int x, int y, int z)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
Executable → Regular
+72
-63
@@ -1,63 +1,72 @@
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import info.jbcs.minecraft.chisel.CarvableHelper;
|
||||
import info.jbcs.minecraft.chisel.CarvableVariation;
|
||||
import info.jbcs.minecraft.chisel.Chisel;
|
||||
import info.jbcs.minecraft.chisel.api.Carvable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.BlockCarpet;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public class BlockMarbleCarpet extends BlockCarpet implements Carvable {
|
||||
public CarvableHelper carverHelper;
|
||||
|
||||
public BlockMarbleCarpet(Material m) {
|
||||
carverHelper = new CarvableHelper();
|
||||
|
||||
setCreativeTab(Chisel.tabChisel);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
return carverHelper.getIcon(side, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){
|
||||
return carverHelper.getIcon(world, x, y, z, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
carverHelper.registerBlockIcons("Chisel",this,register);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tabs, List list){
|
||||
carverHelper.registerSubBlocks(this,tabs,list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return Chisel.RenderCarpetId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
|
||||
}
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import info.jbcs.minecraft.chisel.api.ICarvable;
|
||||
import info.jbcs.minecraft.chisel.carving.CarvableHelper;
|
||||
import info.jbcs.minecraft.chisel.carving.CarvableVariation;
|
||||
import info.jbcs.minecraft.chisel.Chisel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.BlockCarpet;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public class BlockMarbleCarpet extends BlockCarpet implements ICarvable
|
||||
{
|
||||
public CarvableHelper carverHelper;
|
||||
|
||||
public BlockMarbleCarpet(Material m)
|
||||
{
|
||||
carverHelper = new CarvableHelper();
|
||||
|
||||
setCreativeTab(Chisel.tabChisel);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int metadata)
|
||||
{
|
||||
return carverHelper.getIcon(side, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
return carverHelper.getIcon(world, x, y, z, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int i)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register)
|
||||
{
|
||||
carverHelper.registerBlockIcons("Chisel", this, register);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tabs, List list)
|
||||
{
|
||||
carverHelper.registerSubBlocks(this, tabs, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return Chisel.RenderCarpetId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(int metadata)
|
||||
{
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
|
||||
}
|
||||
Executable → Regular
+113
-99
@@ -1,99 +1,113 @@
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import info.jbcs.minecraft.chisel.CarvableHelper;
|
||||
import info.jbcs.minecraft.chisel.CarvableVariation;
|
||||
import info.jbcs.minecraft.chisel.Chisel;
|
||||
import info.jbcs.minecraft.chisel.api.Carvable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockIce;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.stats.StatList;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockMarbleIce extends BlockIce implements Carvable {
|
||||
public CarvableHelper carverHelper;
|
||||
|
||||
public BlockMarbleIce() {
|
||||
super();
|
||||
|
||||
carverHelper = new CarvableHelper();
|
||||
|
||||
setCreativeTab(Chisel.tabChisel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
return carverHelper.getIcon(side, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int i) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
carverHelper.registerBlockIcons("Chisel", this, register);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tabs, List list) {
|
||||
carverHelper.registerSubBlocks(this, tabs, list);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the player destroys a block with an item that can harvest it.
|
||||
* (i, j, k) are the coordinates of the block and l is the block's
|
||||
* subtype/damage.
|
||||
*/
|
||||
@Override
|
||||
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) {
|
||||
if (!Chisel.dropIceShards){
|
||||
super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
|
||||
return;
|
||||
}
|
||||
|
||||
par2EntityPlayer.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(this)], 1);
|
||||
par2EntityPlayer.addExhaustion(0.025F);
|
||||
|
||||
if(par1World.isRemote)
|
||||
return;
|
||||
|
||||
if (this.canSilkHarvest(par1World, par2EntityPlayer, par3, par4, par5, par6) && EnchantmentHelper.getSilkTouchModifier(par2EntityPlayer)) {
|
||||
ItemStack itemstack = this.createStackedBlock(par6);
|
||||
|
||||
if (itemstack != null) {
|
||||
this.dropBlockAsItem(par1World, par3, par4, par5, itemstack);
|
||||
}
|
||||
} else {
|
||||
int i1 = EnchantmentHelper.getFortuneModifier(par2EntityPlayer);
|
||||
this.dropBlockAsItem(par1World, par3, par4, par5, par6, i1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int par1, Random par2Random, int par3) {
|
||||
return Chisel.dropIceShards ? Chisel.itemIceshard : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random par1Random) {
|
||||
return Chisel.dropIceShards ? 1 + par1Random.nextInt(5) : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
|
||||
}
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import info.jbcs.minecraft.chisel.api.ICarvable;
|
||||
import info.jbcs.minecraft.chisel.carving.CarvableHelper;
|
||||
import info.jbcs.minecraft.chisel.carving.CarvableVariation;
|
||||
import info.jbcs.minecraft.chisel.Chisel;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockIce;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.stats.StatList;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockMarbleIce extends BlockIce implements ICarvable
|
||||
{
|
||||
public CarvableHelper carverHelper;
|
||||
|
||||
public BlockMarbleIce()
|
||||
{
|
||||
super();
|
||||
|
||||
carverHelper = new CarvableHelper();
|
||||
|
||||
setCreativeTab(Chisel.tabChisel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int metadata)
|
||||
{
|
||||
return carverHelper.getIcon(side, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int i)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register)
|
||||
{
|
||||
carverHelper.registerBlockIcons("Chisel", this, register);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tabs, List list)
|
||||
{
|
||||
carverHelper.registerSubBlocks(this, tabs, list);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the player destroys a block with an item that can harvest it.
|
||||
* (i, j, k) are the coordinates of the block and l is the block's
|
||||
* subtype/damage.
|
||||
*/
|
||||
@Override
|
||||
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6)
|
||||
{
|
||||
if(!Chisel.dropIceShards)
|
||||
{
|
||||
super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
|
||||
return;
|
||||
}
|
||||
|
||||
par2EntityPlayer.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(this)], 1);
|
||||
par2EntityPlayer.addExhaustion(0.025F);
|
||||
|
||||
if(par1World.isRemote)
|
||||
return;
|
||||
|
||||
if(this.canSilkHarvest(par1World, par2EntityPlayer, par3, par4, par5, par6) && EnchantmentHelper.getSilkTouchModifier(par2EntityPlayer))
|
||||
{
|
||||
ItemStack itemstack = this.createStackedBlock(par6);
|
||||
|
||||
if(itemstack != null)
|
||||
{
|
||||
this.dropBlockAsItem(par1World, par3, par4, par5, itemstack);
|
||||
}
|
||||
} else
|
||||
{
|
||||
int i1 = EnchantmentHelper.getFortuneModifier(par2EntityPlayer);
|
||||
this.dropBlockAsItem(par1World, par3, par4, par5, par6, i1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int par1, Random par2Random, int par3)
|
||||
{
|
||||
return Chisel.dropIceShards ? Chisel.itemIceshard : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random par1Random)
|
||||
{
|
||||
return Chisel.dropIceShards ? 1 + par1Random.nextInt(5) : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(int metadata)
|
||||
{
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
|
||||
}
|
||||
Executable → Regular
+51
-44
@@ -1,44 +1,51 @@
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import info.jbcs.minecraft.chisel.CarvableHelper;
|
||||
import info.jbcs.minecraft.chisel.Chisel;
|
||||
import info.jbcs.minecraft.chisel.ChiselBlocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockMarbleIceStairs extends BlockMarbleStairs {
|
||||
public BlockMarbleIceStairs(Block block,int meta, CarvableHelper helper) {
|
||||
super(block,meta,helper);
|
||||
|
||||
slipperiness = 0.98F;
|
||||
setTickRandomly(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) {
|
||||
ChiselBlocks.blockIce.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random par1Random) {
|
||||
return ChiselBlocks.blockIce.quantityDropped(par1Random);
|
||||
}
|
||||
@Override
|
||||
public int damageDropped(int i) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) {
|
||||
ChiselBlocks.blockIce.updateTick(par1World, par2, par3, par4, par5Random);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMobilityFlag() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import info.jbcs.minecraft.chisel.carving.CarvableHelper;
|
||||
import info.jbcs.minecraft.chisel.ChiselBlocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockMarbleIceStairs extends BlockMarbleStairs
|
||||
{
|
||||
public BlockMarbleIceStairs(Block block, int meta, CarvableHelper helper)
|
||||
{
|
||||
super(block, meta, helper);
|
||||
|
||||
slipperiness = 0.98F;
|
||||
setTickRandomly(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6)
|
||||
{
|
||||
ChiselBlocks.blockIce.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random par1Random)
|
||||
{
|
||||
return ChiselBlocks.blockIce.quantityDropped(par1Random);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int i)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
|
||||
{
|
||||
ChiselBlocks.blockIce.updateTick(par1World, par2, par3, par4, par5Random);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMobilityFlag()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Executable → Regular
+95
-85
@@ -1,85 +1,95 @@
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockMarbleLamp extends BlockCarvable {
|
||||
BlockMarbleLamp blockUnpowered;
|
||||
BlockMarbleLamp blockPowered;
|
||||
boolean powered;
|
||||
|
||||
public BlockMarbleLamp() {
|
||||
super(Material.redstoneLight);
|
||||
|
||||
powered=false;
|
||||
blockUnpowered=this;
|
||||
blockPowered=new BlockMarbleLamp(this);
|
||||
|
||||
setHardness(0.3F);
|
||||
}
|
||||
|
||||
public BlockMarbleLamp(BlockMarbleLamp unpoweredVersion) {
|
||||
super(Material.redstoneLight);
|
||||
|
||||
carverHelper=unpoweredVersion.carverHelper;
|
||||
|
||||
powered=true;
|
||||
blockUnpowered=unpoweredVersion;
|
||||
blockPowered=this;
|
||||
|
||||
setLightLevel(1.0F);
|
||||
setHardness(0.3F);
|
||||
}
|
||||
|
||||
|
||||
public void checkPower(World world, int x, int y, int z){
|
||||
if (world.isRemote) return;
|
||||
|
||||
boolean isGettingPower=world.isBlockIndirectlyGettingPowered(x, y, z);
|
||||
int meta=world.getBlockMetadata(x, y, z);
|
||||
|
||||
if (powered && !isGettingPower) {
|
||||
world.setBlock(x, y, z, blockUnpowered, meta, 2);
|
||||
} else if (!powered && isGettingPower) {
|
||||
world.setBlock(x, y, z, blockPowered, meta, 2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, int x, int y, int z){
|
||||
checkPower(world,x,y,z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block){
|
||||
checkPower(world,x,y,z);
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random rand){
|
||||
if (world.isRemote) return;
|
||||
|
||||
if(powered && !world.isBlockIndirectlyGettingPowered(x, y, z)){
|
||||
int meta=world.getBlockMetadata(x, y, z);
|
||||
world.setBlock(x, y, z, Block.redstoneLampIdle.blockID, meta, 2);
|
||||
}
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int par1, Random par2Random, int par3){
|
||||
return Item.getItemFromBlock(blockUnpowered);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z){
|
||||
return new ItemStack(blockUnpowered, 1, world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
|
||||
}
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockMarbleLamp extends BlockCarvable
|
||||
{
|
||||
BlockMarbleLamp blockUnpowered;
|
||||
BlockMarbleLamp blockPowered;
|
||||
boolean powered;
|
||||
|
||||
public BlockMarbleLamp()
|
||||
{
|
||||
super(Material.redstoneLight);
|
||||
|
||||
powered = false;
|
||||
blockUnpowered = this;
|
||||
blockPowered = new BlockMarbleLamp(this);
|
||||
|
||||
setHardness(0.3F);
|
||||
}
|
||||
|
||||
public BlockMarbleLamp(BlockMarbleLamp unpoweredVersion)
|
||||
{
|
||||
super(Material.redstoneLight);
|
||||
|
||||
carverHelper = unpoweredVersion.carverHelper;
|
||||
|
||||
powered = true;
|
||||
blockUnpowered = unpoweredVersion;
|
||||
blockPowered = this;
|
||||
|
||||
setLightLevel(1.0F);
|
||||
setHardness(0.3F);
|
||||
}
|
||||
|
||||
|
||||
public void checkPower(World world, int x, int y, int z)
|
||||
{
|
||||
if(world.isRemote) return;
|
||||
|
||||
boolean isGettingPower = world.isBlockIndirectlyGettingPowered(x, y, z);
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
if(powered && !isGettingPower)
|
||||
{
|
||||
world.setBlock(x, y, z, blockUnpowered, meta, 2);
|
||||
} else if(!powered && isGettingPower)
|
||||
{
|
||||
world.setBlock(x, y, z, blockPowered, meta, 2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, int x, int y, int z)
|
||||
{
|
||||
checkPower(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block)
|
||||
{
|
||||
checkPower(world, x, y, z);
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random rand){
|
||||
if (world.isRemote) return;
|
||||
|
||||
if(powered && !world.isBlockIndirectlyGettingPowered(x, y, z)){
|
||||
int meta=world.getBlockMetadata(x, y, z);
|
||||
world.setBlock(x, y, z, Block.redstoneLampIdle.blockID, meta, 2);
|
||||
}
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int par1, Random par2Random, int par3)
|
||||
{
|
||||
return Item.getItemFromBlock(blockUnpowered);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
|
||||
{
|
||||
return new ItemStack(blockUnpowered, 1, world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
|
||||
}
|
||||
Executable → Regular
+45
-39
@@ -1,39 +1,45 @@
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import info.jbcs.minecraft.chisel.CarvableVariation;
|
||||
import info.jbcs.minecraft.chisel.render.BlockMarblePillarRenderer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public class BlockMarblePillar extends BlockCarvable{
|
||||
public IIcon sides[]=new IIcon[6];
|
||||
|
||||
public BlockMarblePillar(Material m) {
|
||||
super(m);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return BlockMarblePillarRenderer.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
return sides[side];
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){
|
||||
return sides[side];
|
||||
}
|
||||
|
||||
public IIcon getCtmIcon(int index, int metadata){
|
||||
CarvableVariation var=carverHelper.variations.get(metadata);
|
||||
|
||||
if(index>=4) return var.iconTop;
|
||||
if(var.seamsCtmVert==null) return var.icon;
|
||||
return var.seamsCtmVert.icons[index];
|
||||
}
|
||||
|
||||
}
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import info.jbcs.minecraft.chisel.carving.CarvableVariation;
|
||||
import info.jbcs.minecraft.chisel.client.render.BlockMarblePillarRenderer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public class BlockMarblePillar extends BlockCarvable
|
||||
{
|
||||
public IIcon sides[] = new IIcon[6];
|
||||
|
||||
public BlockMarblePillar(Material m)
|
||||
{
|
||||
super(m);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return BlockMarblePillarRenderer.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int metadata)
|
||||
{
|
||||
return sides[side];
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
return sides[side];
|
||||
}
|
||||
|
||||
public IIcon getCtmIcon(int index, int metadata)
|
||||
{
|
||||
CarvableVariation var = carverHelper.variations.get(metadata);
|
||||
|
||||
if(index >= 4) return var.iconTop;
|
||||
if(var.seamsCtmVert == null) return var.icon;
|
||||
return var.seamsCtmVert.icons[index];
|
||||
}
|
||||
|
||||
}
|
||||
Executable → Regular
+122
-107
@@ -1,107 +1,122 @@
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockMarbleSlab extends BlockCarvable {
|
||||
public Block master;
|
||||
public BlockMarbleSlab bottom;
|
||||
public BlockMarbleSlab top;
|
||||
public boolean isBottom;
|
||||
|
||||
public BlockMarbleSlab(BlockCarvable marble) {
|
||||
opaque = true;
|
||||
|
||||
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
|
||||
|
||||
master = marble;
|
||||
bottom = this;
|
||||
top = new BlockMarbleSlab(this);
|
||||
|
||||
isBottom = true;
|
||||
}
|
||||
|
||||
public BlockMarbleSlab(BlockMarbleSlab bottomBlock) {
|
||||
super();
|
||||
|
||||
setBlockBounds(0.0F, 0.5F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
master = bottomBlock.master;
|
||||
bottom = bottomBlock;
|
||||
top = this;
|
||||
|
||||
carverHelper=bottomBlock.carverHelper;
|
||||
isBottom=false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) {
|
||||
if (isBottom) {
|
||||
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
|
||||
} else {
|
||||
setBlockBounds(0.0F, 0.5F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsForItemRender() {
|
||||
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity) {
|
||||
setBlockBoundsBasedOnState(par1World, par2, par3, par4);
|
||||
super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta) {
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int par1, Random par2Random, int par3) {
|
||||
return Item.getItemFromBlock(bottom);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ItemStack getPickBlock(MovingObjectPosition mop, World world, int x, int y, int z) {
|
||||
return new ItemStack(bottom, 1, world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
return carverHelper.getIcon(side, metadata);
|
||||
// return master.getIcon(side, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item block, CreativeTabs tabs, List list){
|
||||
if(isBottom) super.getSubBlocks(block,tabs,list);
|
||||
}
|
||||
|
||||
}
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockMarbleSlab extends BlockCarvable
|
||||
{
|
||||
public Block master;
|
||||
public BlockMarbleSlab bottom;
|
||||
public BlockMarbleSlab top;
|
||||
public boolean isBottom;
|
||||
|
||||
public BlockMarbleSlab(BlockCarvable marble)
|
||||
{
|
||||
opaque = true;
|
||||
|
||||
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
|
||||
|
||||
master = marble;
|
||||
bottom = this;
|
||||
top = new BlockMarbleSlab(this);
|
||||
|
||||
isBottom = true;
|
||||
}
|
||||
|
||||
public BlockMarbleSlab(BlockMarbleSlab bottomBlock)
|
||||
{
|
||||
super();
|
||||
|
||||
setBlockBounds(0.0F, 0.5F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
master = bottomBlock.master;
|
||||
bottom = bottomBlock;
|
||||
top = this;
|
||||
|
||||
carverHelper = bottomBlock.carverHelper;
|
||||
isBottom = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
|
||||
{
|
||||
if(isBottom)
|
||||
{
|
||||
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
|
||||
} else
|
||||
{
|
||||
setBlockBounds(0.0F, 0.5F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsForItemRender()
|
||||
{
|
||||
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity)
|
||||
{
|
||||
setBlockBoundsBasedOnState(par1World, par2, par3, par4);
|
||||
super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta)
|
||||
{
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int par1, Random par2Random, int par3)
|
||||
{
|
||||
return Item.getItemFromBlock(bottom);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ItemStack getPickBlock(MovingObjectPosition mop, World world, int x, int y, int z)
|
||||
{
|
||||
return new ItemStack(bottom, 1, world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int metadata)
|
||||
{
|
||||
return carverHelper.getIcon(side, metadata);
|
||||
// return master.getIcon(side, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item block, CreativeTabs tabs, List list)
|
||||
{
|
||||
if(isBottom) super.getSubBlocks(block, tabs, list);
|
||||
}
|
||||
|
||||
}
|
||||
Executable → Regular
+110
-100
@@ -1,100 +1,110 @@
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import info.jbcs.minecraft.chisel.CarvableHelper;
|
||||
import info.jbcs.minecraft.chisel.CarvableVariation;
|
||||
import info.jbcs.minecraft.chisel.Chisel;
|
||||
import info.jbcs.minecraft.chisel.api.Carvable;
|
||||
import info.jbcs.minecraft.chisel.render.BlockMarbleStairsRenderer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockStairs;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockMarbleStairs extends BlockStairs implements Carvable {
|
||||
CarvableHelper carverHelper;
|
||||
int blockMeta;
|
||||
|
||||
public BlockMarbleStairs(Block block,int meta, CarvableHelper helper) {
|
||||
super(block, meta);
|
||||
|
||||
this.useNeighborBrightness = true;
|
||||
setCreativeTab(Chisel.tabChisel);
|
||||
carverHelper=helper;
|
||||
blockMeta=meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
return carverHelper.getIcon(side, blockMeta+metadata/8);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int i) {
|
||||
return i&0x8;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
if(blockMeta==0)
|
||||
carverHelper.registerBlockIcons("Chisel",this,register);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item block, CreativeTabs tabs, List list){
|
||||
list.add(new ItemStack(block, 1, 0));
|
||||
list.add(new ItemStack(block, 1, 8));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return BlockMarbleStairsRenderer.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLiving, ItemStack par6ItemStack){
|
||||
int l = MathHelper.floor_double((par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
int i1 = par1World.getBlockMetadata(par2, par3, par4) & 4;
|
||||
int odd=par6ItemStack.getItemDamage();
|
||||
|
||||
if (l == 0)
|
||||
{
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, 2 | i1 + odd, 2);
|
||||
}
|
||||
|
||||
if (l == 1)
|
||||
{
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, 1 | i1 + odd, 2);
|
||||
}
|
||||
|
||||
if (l == 2)
|
||||
{
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, 3 | i1 + odd, 2);
|
||||
}
|
||||
|
||||
if (l == 3)
|
||||
{
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, 0 | i1 + odd, 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int onBlockPlaced(World world, int x, int y, int z, int side, float hx, float hy, float hz, int damage){
|
||||
// int res=super.onBlockPlaced();
|
||||
return side != 0 && (side == 1 || hy <= 0.5D) ? damage : damage | 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
}
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import info.jbcs.minecraft.chisel.api.ICarvable;
|
||||
import info.jbcs.minecraft.chisel.carving.CarvableHelper;
|
||||
import info.jbcs.minecraft.chisel.carving.CarvableVariation;
|
||||
import info.jbcs.minecraft.chisel.Chisel;
|
||||
import info.jbcs.minecraft.chisel.client.render.BlockMarbleStairsRenderer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockStairs;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockMarbleStairs extends BlockStairs implements ICarvable
|
||||
{
|
||||
CarvableHelper carverHelper;
|
||||
int blockMeta;
|
||||
|
||||
public BlockMarbleStairs(Block block, int meta, CarvableHelper helper)
|
||||
{
|
||||
super(block, meta);
|
||||
|
||||
this.useNeighborBrightness = true;
|
||||
setCreativeTab(Chisel.tabChisel);
|
||||
carverHelper = helper;
|
||||
blockMeta = meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int metadata)
|
||||
{
|
||||
return carverHelper.getIcon(side, blockMeta + metadata / 8);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int i)
|
||||
{
|
||||
return i & 0x8;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register)
|
||||
{
|
||||
if(blockMeta == 0)
|
||||
carverHelper.registerBlockIcons("Chisel", this, register);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item block, CreativeTabs tabs, List list)
|
||||
{
|
||||
list.add(new ItemStack(block, 1, 0));
|
||||
list.add(new ItemStack(block, 1, 8));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return BlockMarbleStairsRenderer.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLiving, ItemStack par6ItemStack)
|
||||
{
|
||||
int l = MathHelper.floor_double((par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
int i1 = par1World.getBlockMetadata(par2, par3, par4) & 4;
|
||||
int odd = par6ItemStack.getItemDamage();
|
||||
|
||||
if(l == 0)
|
||||
{
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, 2 | i1 + odd, 2);
|
||||
}
|
||||
|
||||
if(l == 1)
|
||||
{
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, 1 | i1 + odd, 2);
|
||||
}
|
||||
|
||||
if(l == 2)
|
||||
{
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, 3 | i1 + odd, 2);
|
||||
}
|
||||
|
||||
if(l == 3)
|
||||
{
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, 0 | i1 + odd, 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int onBlockPlaced(World world, int x, int y, int z, int side, float hx, float hy, float hz, int damage)
|
||||
{
|
||||
// int res=super.onBlockPlaced();
|
||||
return side != 0 && (side == 1 || hy <= 0.5D) ? damage : damage | 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(int metadata)
|
||||
{
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
}
|
||||
Executable → Regular
+61
-55
@@ -1,55 +1,61 @@
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import info.jbcs.minecraft.chisel.CarvableHelper;
|
||||
import info.jbcs.minecraft.chisel.CarvableVariation;
|
||||
import info.jbcs.minecraft.chisel.item.ItemCarvable;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class BlockMarbleStairsMaker {
|
||||
public CarvableHelper carverHelper;
|
||||
BlockMarbleStairs blocks[];
|
||||
|
||||
int idStart;
|
||||
Block blockBase;
|
||||
String blockName;
|
||||
|
||||
public BlockMarbleStairsMaker(Block base){
|
||||
carverHelper=new CarvableHelper();
|
||||
|
||||
blockBase=base;
|
||||
}
|
||||
|
||||
public void create(String name){
|
||||
create(null, name);
|
||||
}
|
||||
|
||||
public void create(BlockMarbleStairsMakerCreator creator, String name){
|
||||
blocks=new BlockMarbleStairs[carverHelper.variations.size()/2];
|
||||
|
||||
for(int i=0;i<blocks.length;i++){
|
||||
String n=name+"."+i;
|
||||
blocks[i]=creator==null?
|
||||
new BlockMarbleStairs(blockBase, i*2, carverHelper):
|
||||
creator.create(blockBase, i*2, carverHelper);
|
||||
|
||||
blocks[i].setBlockName(n);
|
||||
GameRegistry.registerBlock(blocks[i], ItemCarvable.class, n);
|
||||
|
||||
for(int meta=0;meta<2 && i*2+meta<carverHelper.variations.size();meta++){
|
||||
CarvableVariation variation=carverHelper.variations.get(i*2+meta);
|
||||
|
||||
for(int j=0;j<8;j++)
|
||||
carverHelper.registerVariation(name+".orientation."+j,variation,blocks[i],j+meta*8);
|
||||
|
||||
CraftingManager.getInstance().addRecipe(new ItemStack(blocks[i], 4, meta*8), new Object[] { "* ", "** ", "***", '*', new ItemStack(blockBase, 1, i*2+meta)});
|
||||
}
|
||||
|
||||
CarvableHelper.chiselBlocks.add(blocks[i]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import info.jbcs.minecraft.chisel.carving.CarvableHelper;
|
||||
import info.jbcs.minecraft.chisel.carving.CarvableVariation;
|
||||
import info.jbcs.minecraft.chisel.item.ItemCarvable;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class BlockMarbleStairsMaker
|
||||
{
|
||||
public CarvableHelper carverHelper;
|
||||
BlockMarbleStairs blocks[];
|
||||
|
||||
int idStart;
|
||||
Block blockBase;
|
||||
String blockName;
|
||||
|
||||
public BlockMarbleStairsMaker(Block base)
|
||||
{
|
||||
carverHelper = new CarvableHelper();
|
||||
|
||||
blockBase = base;
|
||||
}
|
||||
|
||||
public void create(String name)
|
||||
{
|
||||
create(null, name);
|
||||
}
|
||||
|
||||
public void create(BlockMarbleStairsMakerCreator creator, String name)
|
||||
{
|
||||
blocks = new BlockMarbleStairs[carverHelper.variations.size() / 2];
|
||||
|
||||
for(int i = 0; i < blocks.length; i++)
|
||||
{
|
||||
String n = name + "." + i;
|
||||
blocks[i] = creator == null ?
|
||||
new BlockMarbleStairs(blockBase, i * 2, carverHelper) :
|
||||
creator.create(blockBase, i * 2, carverHelper);
|
||||
|
||||
blocks[i].setBlockName(n);
|
||||
GameRegistry.registerBlock(blocks[i], ItemCarvable.class, n);
|
||||
|
||||
for(int meta = 0; meta < 2 && i * 2 + meta < carverHelper.variations.size(); meta++)
|
||||
{
|
||||
CarvableVariation variation = carverHelper.variations.get(i * 2 + meta);
|
||||
|
||||
for(int j = 0; j < 8; j++)
|
||||
carverHelper.registerVariation(name + ".orientation." + j, variation, blocks[i], j + meta * 8);
|
||||
|
||||
CraftingManager.getInstance().addRecipe(new ItemStack(blocks[i], 4, meta * 8), new Object[]{"* ", "** ", "***", '*', new ItemStack(blockBase, 1, i * 2 + meta)});
|
||||
}
|
||||
|
||||
CarvableHelper.chiselBlocks.add(blocks[i]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Executable → Regular
+9
-8
@@ -1,8 +1,9 @@
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import info.jbcs.minecraft.chisel.CarvableHelper;
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
public interface BlockMarbleStairsMakerCreator {
|
||||
public BlockMarbleStairs create(Block block,int meta, CarvableHelper helper);
|
||||
}
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import info.jbcs.minecraft.chisel.carving.CarvableHelper;
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
public interface BlockMarbleStairsMakerCreator
|
||||
{
|
||||
public BlockMarbleStairs create(Block block, int meta, CarvableHelper helper);
|
||||
}
|
||||
Executable → Regular
+60
-53
@@ -1,53 +1,60 @@
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import info.jbcs.minecraft.chisel.CarvableHelper;
|
||||
import info.jbcs.minecraft.chisel.CarvableVariation;
|
||||
import info.jbcs.minecraft.chisel.Chisel;
|
||||
import info.jbcs.minecraft.chisel.api.Carvable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class BlockMarbleTexturedOre extends BlockTexturedOre implements Carvable {
|
||||
public CarvableHelper carverHelper;
|
||||
|
||||
public BlockMarbleTexturedOre(Material mat, String baseIcon) {
|
||||
super(mat, baseIcon);
|
||||
|
||||
carverHelper = new CarvableHelper();
|
||||
|
||||
setCreativeTab(Chisel.tabChisel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
return carverHelper.getIcon(side, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
super.registerBlockIcons(register);
|
||||
|
||||
carverHelper.registerBlockIcons("Chisel",this,register);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item block, CreativeTabs tabs, List list){
|
||||
carverHelper.registerSubBlocks(this,tabs,list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
}
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import info.jbcs.minecraft.chisel.api.ICarvable;
|
||||
import info.jbcs.minecraft.chisel.carving.CarvableHelper;
|
||||
import info.jbcs.minecraft.chisel.carving.CarvableVariation;
|
||||
import info.jbcs.minecraft.chisel.Chisel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class BlockMarbleTexturedOre extends BlockTexturedOre implements ICarvable
|
||||
{
|
||||
public CarvableHelper carverHelper;
|
||||
|
||||
public BlockMarbleTexturedOre(Material mat, String baseIcon)
|
||||
{
|
||||
super(mat, baseIcon);
|
||||
|
||||
carverHelper = new CarvableHelper();
|
||||
|
||||
setCreativeTab(Chisel.tabChisel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int metadata)
|
||||
{
|
||||
return carverHelper.getIcon(side, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int i)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register)
|
||||
{
|
||||
super.registerBlockIcons(register);
|
||||
|
||||
carverHelper.registerBlockIcons("Chisel", this, register);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item block, CreativeTabs tabs, List list)
|
||||
{
|
||||
carverHelper.registerSubBlocks(this, tabs, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(int metadata)
|
||||
{
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
}
|
||||
Executable → Regular
+51
-45
@@ -1,45 +1,51 @@
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import info.jbcs.minecraft.chisel.CarvableHelper;
|
||||
import info.jbcs.minecraft.chisel.Chisel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockWall;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class BlockMarbleWall extends BlockWall {
|
||||
CarvableHelper carverHelper;
|
||||
|
||||
public BlockMarbleWall(Block block) {
|
||||
super(block);
|
||||
|
||||
carverHelper = new CarvableHelper();
|
||||
|
||||
setCreativeTab(Chisel.tabChisel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
return carverHelper.getIcon(side, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
carverHelper.registerBlockIcons("Chisel",this,register);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item block, CreativeTabs tabs, List list){
|
||||
carverHelper.registerSubBlocks(this,tabs,list);
|
||||
}
|
||||
}
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import info.jbcs.minecraft.chisel.carving.CarvableHelper;
|
||||
import info.jbcs.minecraft.chisel.Chisel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockWall;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class BlockMarbleWall extends BlockWall
|
||||
{
|
||||
CarvableHelper carverHelper;
|
||||
|
||||
public BlockMarbleWall(Block block)
|
||||
{
|
||||
super(block);
|
||||
|
||||
carverHelper = new CarvableHelper();
|
||||
|
||||
setCreativeTab(Chisel.tabChisel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int metadata)
|
||||
{
|
||||
return carverHelper.getIcon(side, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int i)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register)
|
||||
{
|
||||
carverHelper.registerBlockIcons("Chisel", this, register);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item block, CreativeTabs tabs, List list)
|
||||
{
|
||||
carverHelper.registerSubBlocks(this, tabs, list);
|
||||
}
|
||||
}
|
||||
Executable → Regular
+81
-71
@@ -1,71 +1,81 @@
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import info.jbcs.minecraft.chisel.Chisel;
|
||||
import info.jbcs.minecraft.chisel.render.BlockRoadLineRenderer;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockRoadLine extends Block {
|
||||
public IIcon aloneIcon;
|
||||
public IIcon halfLineIcon;
|
||||
public IIcon fullLineIcon;
|
||||
|
||||
public BlockRoadLine() {
|
||||
super(Material.circuits);
|
||||
|
||||
this.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 0.00390625f, 1.0f);
|
||||
// this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.0625F, 1.0F);
|
||||
|
||||
setCreativeTab(Chisel.tabChisel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return BlockRoadLineRenderer.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) {
|
||||
return par1World.doesBlockHaveSolidTopSurface(par1World, par2, par3 - 1, par4) || par1World.getBlock(par2, par3 - 1, par4).equals(Blocks.glowstone);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, Block block) {
|
||||
if (par1World.isRemote) return;
|
||||
|
||||
if (! this.canPlaceBlockAt(par1World, par2, par3, par4)) {
|
||||
this.dropBlockAsItem(par1World, par2, par3, par4, 0, 0);
|
||||
par1World.setBlockToAir(par2, par3, par4);
|
||||
}
|
||||
|
||||
super.onNeighborBlockChange(par1World, par2, par3, par4, block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister reg) {
|
||||
blockIcon = aloneIcon = reg.registerIcon("Chisel:line-marking/white-center");
|
||||
halfLineIcon = reg.registerIcon("Chisel:line-marking/white-side");
|
||||
fullLineIcon = reg.registerIcon("Chisel:line-marking/white-long");
|
||||
}
|
||||
|
||||
}
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import info.jbcs.minecraft.chisel.Chisel;
|
||||
import info.jbcs.minecraft.chisel.client.render.BlockRoadLineRenderer;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockRoadLine extends Block
|
||||
{
|
||||
public IIcon aloneIcon;
|
||||
public IIcon halfLineIcon;
|
||||
public IIcon fullLineIcon;
|
||||
|
||||
public BlockRoadLine()
|
||||
{
|
||||
super(Material.circuits);
|
||||
|
||||
this.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 0.00390625f, 1.0f);
|
||||
// this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.0625F, 1.0F);
|
||||
|
||||
setCreativeTab(Chisel.tabChisel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return BlockRoadLineRenderer.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
return par1World.doesBlockHaveSolidTopSurface(par1World, par2, par3 - 1, par4) || par1World.getBlock(par2, par3 - 1, par4).equals(Blocks.glowstone);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, Block block)
|
||||
{
|
||||
if(par1World.isRemote) return;
|
||||
|
||||
if(!this.canPlaceBlockAt(par1World, par2, par3, par4))
|
||||
{
|
||||
this.dropBlockAsItem(par1World, par2, par3, par4, 0, 0);
|
||||
par1World.setBlockToAir(par2, par3, par4);
|
||||
}
|
||||
|
||||
super.onNeighborBlockChange(par1World, par2, par3, par4, block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister reg)
|
||||
{
|
||||
blockIcon = aloneIcon = reg.registerIcon("Chisel:line-marking/white-center");
|
||||
halfLineIcon = reg.registerIcon("Chisel:line-marking/white-side");
|
||||
fullLineIcon = reg.registerIcon("Chisel:line-marking/white-long");
|
||||
}
|
||||
|
||||
}
|
||||
Executable → Regular
+575
-405
@@ -1,406 +1,576 @@
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import info.jbcs.minecraft.chisel.Chisel;
|
||||
import info.jbcs.minecraft.chisel.render.BlockSnakeStoneRenderer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockSnakestone extends Block {
|
||||
static final int SEC_HEAD = 0;
|
||||
static final int SEC_DOWN = 4;
|
||||
static final int SEC_UP = 8;
|
||||
static final int SEC_HOR = 12;
|
||||
|
||||
static final int SIDE_B = 0;
|
||||
static final int SIDE_T = 1;
|
||||
static final int SIDE_N = 2;
|
||||
static final int SIDE_S = 3;
|
||||
static final int SIDE_W = 4;
|
||||
static final int SIDE_E = 5;
|
||||
|
||||
String iconPrefix;
|
||||
IIcon iconFaceLeft;
|
||||
IIcon iconFaceRight;
|
||||
IIcon iconCross;
|
||||
IIcon iconFace;
|
||||
IIcon iconTopTip;
|
||||
IIcon iconTopSide;
|
||||
IIcon iconBottom;
|
||||
IIcon iconBottomSide;
|
||||
IIcon iconBottomTip;
|
||||
IIcon iconLeftDown;
|
||||
IIcon iconRightDown;
|
||||
IIcon iconLeftUp;
|
||||
IIcon iconRightUp;
|
||||
IIcon iconLeftTip;
|
||||
IIcon iconSide;
|
||||
IIcon iconRightTip;
|
||||
IIcon iconTop;
|
||||
|
||||
public boolean flipTopTextures;
|
||||
|
||||
public BlockSnakestone(String iconPrefix) {
|
||||
super(Material.rock);
|
||||
setHardness(1.5F);
|
||||
setResistance(10.0F);
|
||||
setStepSound(Block.soundTypeStone);
|
||||
setCreativeTab(Chisel.tabChisel);
|
||||
flipTopTextures=false;
|
||||
|
||||
this.iconPrefix = iconPrefix;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return BlockSnakeStoneRenderer.id;
|
||||
}
|
||||
|
||||
static final int[] rotRemap={0, 3, 1, 2};
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta > 3) return;
|
||||
|
||||
if(rotateHead(world, x, y, z)!=-1)
|
||||
return;
|
||||
|
||||
int rot = rotRemap[(MathHelper.floor_double(entity.rotationYaw * 4.0 / 360.0 + 0.5) ) & 3];
|
||||
|
||||
world.setBlockMetadataWithNotify(x, y, z, rot, 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onBlockPlaced(World world, int x, int y, int z, int side, float hx, float hy, float hz, int meta) {
|
||||
if (meta <= 3) return meta;
|
||||
|
||||
if(rotateBodyPart(world,x,y,z)){
|
||||
return world.getBlockMetadata(x,y,z);
|
||||
}
|
||||
|
||||
if(side==0 || side==1) meta=14;
|
||||
if(side==2 || side==3) meta=13;
|
||||
if(side==4 || side==5) meta=12;
|
||||
|
||||
world.setBlockMetadataWithNotify(x, y, z, meta, 2);
|
||||
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
||||
int kind = world.getBlockMetadata(x, y, z) & 0xC;
|
||||
|
||||
if (kind == 0) {
|
||||
rotateHead(world, x, y, z);
|
||||
} else {
|
||||
rotateBodyPart(world, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
public int[] getConnections(World world, int ox, int oy, int oz) {
|
||||
int index=0;
|
||||
int[] res={-1,-1,-1,-1,-1,-1,-1};
|
||||
|
||||
for (int direction = 0; direction < 6; direction++) {
|
||||
int x=ox, y=oy, z=oz;
|
||||
switch (direction) {
|
||||
case 0: z--; break;
|
||||
case 1: z++; break;
|
||||
case 2: x--; break;
|
||||
case 3: x++; break;
|
||||
case 4: y--; break;
|
||||
case 5: y++; break;
|
||||
}
|
||||
|
||||
if ( !world.getBlock(x, y, z).equals(this) ) continue;
|
||||
boolean match=false;
|
||||
|
||||
int px1=x,px2=x;
|
||||
int py1=y,py2=y;
|
||||
int pz1=z,pz2=z;
|
||||
|
||||
int meta=world.getBlockMetadata(x,y,z);
|
||||
if((meta&0xc) == 4 || (meta&0xc) == 8){
|
||||
if((meta&4) == 4) py1--; else py1++;
|
||||
|
||||
switch (meta&3) {
|
||||
case 0: pz2--; break;
|
||||
case 1: pz2++; break;
|
||||
case 2: px2--; break;
|
||||
case 3: px2++; break;
|
||||
}
|
||||
} else if(meta==12){
|
||||
px1--; px2++;
|
||||
} else if(meta==13){
|
||||
pz1--; pz2++;
|
||||
} else if(meta==14){
|
||||
py1--; py2++;
|
||||
} else if(meta==15){
|
||||
match=true;
|
||||
} else if(meta<4){
|
||||
match=true;
|
||||
}
|
||||
|
||||
if(! match){
|
||||
Block b1=world.getBlock(px1, py1, pz1);
|
||||
Block b2=world.getBlock(px2, py2, pz2);
|
||||
|
||||
|
||||
if(b1 != this || b2 != this)
|
||||
match=true;
|
||||
|
||||
if(ox==px1 && oy==py1 && oz==pz1)
|
||||
match=true;
|
||||
|
||||
if(ox==px2 && oy==py2 && oz==pz2)
|
||||
match=true;
|
||||
}
|
||||
|
||||
if(match)
|
||||
res[index++]=direction;
|
||||
}
|
||||
|
||||
if(index!=5)
|
||||
res[index]=-1;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
public boolean rotateBodyPart(World world, int x, int y, int z) {
|
||||
int[] con=getConnections(world,x,y,z);
|
||||
int blockMeta=world.getBlockMetadata(x, y, z);
|
||||
int kind=blockMeta&0xc;
|
||||
|
||||
if(con[1]==-1) return false;
|
||||
if(con[2]!=-1) return false;
|
||||
|
||||
int meta=15;
|
||||
|
||||
if(con[0]==2 && con[1]==3){
|
||||
meta=12;
|
||||
} else if(con[0]==0 && con[1]==1){
|
||||
meta=13;
|
||||
} else if(con[0]==4 && con[1]==5){
|
||||
meta=14;
|
||||
} else if(con[1]==4){
|
||||
meta=SEC_DOWN|con[0];
|
||||
} else if(con[1]==5){
|
||||
meta=SEC_UP|con[0];
|
||||
}
|
||||
|
||||
if(blockMeta!=meta)
|
||||
world.setBlockMetadataWithNotify(x, y, z, meta, 3);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public int rotateHead(World world, int x, int y, int z) {
|
||||
int[] con=getConnections(world,x,y,z);
|
||||
|
||||
if (con[1]>=0 && con[1]<4) return -1;
|
||||
|
||||
int meta=-1;
|
||||
switch (con[0]) {
|
||||
case 0: meta=1; break;
|
||||
case 1: meta=0; break;
|
||||
case 2: meta=3; break;
|
||||
case 3: meta=2; break;
|
||||
}
|
||||
|
||||
if(meta==-1) return -1;
|
||||
|
||||
world.setBlock(x, y, z, this, meta, 3);
|
||||
return meta;
|
||||
}
|
||||
|
||||
public boolean connectedTo(World par1World, int x, int y, int z, int direction) {
|
||||
switch (direction) {
|
||||
case 0: return par1World.getBlock(x, y, z - 1).equals(this);
|
||||
case 1: return par1World.getBlock(x, y, z + 1).equals(this);
|
||||
case 2: return par1World.getBlock(x - 1, y, z).equals(this);
|
||||
case 3: return par1World.getBlock(x + 1, y, z).equals(this);
|
||||
case 4: return par1World.getBlock(x, y - 1, z).equals(this);
|
||||
case 5: return par1World.getBlock(x, y + 1, z).equals(this);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
int type = meta & 0xc;
|
||||
int orient = meta & 0x3;
|
||||
|
||||
switch(meta | (side<<4)){
|
||||
|
||||
case(SEC_HOR | 0 | (SIDE_B<<4)): return iconBottomTip;
|
||||
case(SEC_HOR | 0 | (SIDE_T<<4)): return iconTopSide;
|
||||
case(SEC_HOR | 0 | (SIDE_N<<4)): return iconSide;
|
||||
case(SEC_HOR | 0 | (SIDE_S<<4)): return iconSide;
|
||||
case(SEC_HOR | 0 | (SIDE_W<<4)): return iconCross;
|
||||
case(SEC_HOR | 0 | (SIDE_E<<4)): return iconCross;
|
||||
|
||||
case(SEC_HOR | 1 | (SIDE_B<<4)): return iconBottomTip;
|
||||
case(SEC_HOR | 1 | (SIDE_T<<4)): return iconTopSide;
|
||||
case(SEC_HOR | 1 | (SIDE_N<<4)): return iconCross;
|
||||
case(SEC_HOR | 1 | (SIDE_S<<4)): return iconCross;
|
||||
case(SEC_HOR | 1 | (SIDE_W<<4)): return iconSide;
|
||||
case(SEC_HOR | 1 | (SIDE_E<<4)): return iconSide;
|
||||
|
||||
case(SEC_HOR | 2 | (SIDE_B<<4)): return iconCross;
|
||||
case(SEC_HOR | 2 | (SIDE_T<<4)): return iconCross;
|
||||
case(SEC_HOR | 2 | (SIDE_N<<4)): return iconSide;
|
||||
case(SEC_HOR | 2 | (SIDE_S<<4)): return iconSide;
|
||||
case(SEC_HOR | 2 | (SIDE_W<<4)): return iconSide;
|
||||
case(SEC_HOR | 2 | (SIDE_E<<4)): return iconSide;
|
||||
|
||||
case(SEC_HOR | 3 | (SIDE_B<<4)): return iconBottom;
|
||||
case(SEC_HOR | 3 | (SIDE_T<<4)): return iconTop;
|
||||
case(SEC_HOR | 3 | (SIDE_N<<4)): return iconSide;
|
||||
case(SEC_HOR | 3 | (SIDE_S<<4)): return iconSide;
|
||||
case(SEC_HOR | 3 | (SIDE_W<<4)): return iconSide;
|
||||
case(SEC_HOR | 3 | (SIDE_E<<4)): return iconSide;
|
||||
|
||||
case(SEC_DOWN | 0 | (SIDE_B<<4)): return iconCross;
|
||||
case(SEC_DOWN | 0 | (SIDE_T<<4)): return iconTopTip;
|
||||
case(SEC_DOWN | 0 | (SIDE_N<<4)): return iconCross;
|
||||
case(SEC_DOWN | 0 | (SIDE_S<<4)): return iconRightTip;
|
||||
case(SEC_DOWN | 0 | (SIDE_W<<4)): return iconLeftDown;
|
||||
case(SEC_DOWN | 0 | (SIDE_E<<4)): return iconRightDown;
|
||||
|
||||
case(SEC_DOWN | 1 | (SIDE_B<<4)): return iconCross;
|
||||
case(SEC_DOWN | 1 | (SIDE_T<<4)): return iconTopTip;
|
||||
case(SEC_DOWN | 1 | (SIDE_N<<4)): return iconLeftTip;
|
||||
case(SEC_DOWN | 1 | (SIDE_S<<4)): return iconCross;
|
||||
case(SEC_DOWN | 1 | (SIDE_W<<4)): return iconRightDown;
|
||||
case(SEC_DOWN | 1 | (SIDE_E<<4)): return iconLeftDown;
|
||||
|
||||
case(SEC_DOWN | 2 | (SIDE_B<<4)): return iconCross;
|
||||
case(SEC_DOWN | 2 | (SIDE_T<<4)): return iconTopTip;
|
||||
case(SEC_DOWN | 2 | (SIDE_N<<4)): return iconRightDown;
|
||||
case(SEC_DOWN | 2 | (SIDE_S<<4)): return iconLeftDown;
|
||||
case(SEC_DOWN | 2 | (SIDE_W<<4)): return iconCross;
|
||||
case(SEC_DOWN | 2 | (SIDE_E<<4)): return iconLeftTip;
|
||||
|
||||
case(SEC_DOWN | 3 | (SIDE_B<<4)): return iconCross;
|
||||
case(SEC_DOWN | 3 | (SIDE_T<<4)): return iconTopTip;
|
||||
case(SEC_DOWN | 3 | (SIDE_N<<4)): return iconLeftDown;
|
||||
case(SEC_DOWN | 3 | (SIDE_S<<4)): return iconRightDown;
|
||||
case(SEC_DOWN | 3 | (SIDE_W<<4)): return iconRightTip;
|
||||
case(SEC_DOWN | 3 | (SIDE_E<<4)): return iconCross;
|
||||
|
||||
case(SEC_UP | 0 | (SIDE_B<<4)): return iconBottomSide;
|
||||
case(SEC_UP | 0 | (SIDE_T<<4)): return iconCross;
|
||||
case(SEC_UP | 0 | (SIDE_N<<4)): return iconCross;
|
||||
case(SEC_UP | 0 | (SIDE_S<<4)): return iconLeftTip;
|
||||
case(SEC_UP | 0 | (SIDE_W<<4)): return iconLeftUp;
|
||||
case(SEC_UP | 0 | (SIDE_E<<4)): return iconRightUp;
|
||||
|
||||
case(SEC_UP | 1 | (SIDE_B<<4)): return iconBottomSide;
|
||||
case(SEC_UP | 1 | (SIDE_T<<4)): return iconCross;
|
||||
case(SEC_UP | 1 | (SIDE_N<<4)): return iconRightTip;
|
||||
case(SEC_UP | 1 | (SIDE_S<<4)): return iconCross;
|
||||
case(SEC_UP | 1 | (SIDE_W<<4)): return iconRightUp;
|
||||
case(SEC_UP | 1 | (SIDE_E<<4)): return iconLeftUp;
|
||||
|
||||
case(SEC_UP | 2 | (SIDE_B<<4)): return iconBottomSide;
|
||||
case(SEC_UP | 2 | (SIDE_T<<4)): return iconCross;
|
||||
case(SEC_UP | 2 | (SIDE_N<<4)): return iconRightUp;
|
||||
case(SEC_UP | 2 | (SIDE_S<<4)): return iconLeftUp;
|
||||
case(SEC_UP | 2 | (SIDE_W<<4)): return iconCross;
|
||||
case(SEC_UP | 2 | (SIDE_E<<4)): return iconRightTip;
|
||||
|
||||
case(SEC_UP | 3 | (SIDE_B<<4)): return iconBottomSide;
|
||||
case(SEC_UP | 3 | (SIDE_T<<4)): return iconCross;
|
||||
case(SEC_UP | 3 | (SIDE_N<<4)): return iconLeftUp;
|
||||
case(SEC_UP | 3 | (SIDE_S<<4)): return iconRightUp;
|
||||
case(SEC_UP | 3 | (SIDE_W<<4)): return iconLeftTip;
|
||||
case(SEC_UP | 3 | (SIDE_E<<4)): return iconCross;
|
||||
|
||||
case(SEC_HEAD | 0 | (SIDE_B<<4)): return iconBottomSide;
|
||||
case(SEC_HEAD | 0 | (SIDE_T<<4)): return iconTopTip;
|
||||
case(SEC_HEAD | 0 | (SIDE_N<<4)): return iconFace;
|
||||
case(SEC_HEAD | 0 | (SIDE_S<<4)): return iconCross;
|
||||
case(SEC_HEAD | 0 | (SIDE_W<<4)): return iconFaceLeft;
|
||||
case(SEC_HEAD | 0 | (SIDE_E<<4)): return iconFaceRight;
|
||||
|
||||
case(SEC_HEAD | 1 | (SIDE_B<<4)): return iconBottomSide;
|
||||
case(SEC_HEAD | 1 | (SIDE_T<<4)): return iconTopTip;
|
||||
case(SEC_HEAD | 1 | (SIDE_N<<4)): return iconCross;
|
||||
case(SEC_HEAD | 1 | (SIDE_S<<4)): return iconFace;
|
||||
case(SEC_HEAD | 1 | (SIDE_W<<4)): return iconFaceRight;
|
||||
case(SEC_HEAD | 1 | (SIDE_E<<4)): return iconFaceLeft;
|
||||
|
||||
case(SEC_HEAD | 2 | (SIDE_B<<4)): return iconBottomSide;
|
||||
case(SEC_HEAD | 2 | (SIDE_T<<4)): return iconTopTip;
|
||||
case(SEC_HEAD | 2 | (SIDE_N<<4)): return iconFaceRight;
|
||||
case(SEC_HEAD | 2 | (SIDE_S<<4)): return iconFaceLeft;
|
||||
case(SEC_HEAD | 2 | (SIDE_W<<4)): return iconFace;
|
||||
case(SEC_HEAD | 2 | (SIDE_E<<4)): return iconCross;
|
||||
|
||||
case(SEC_HEAD | 3 | (SIDE_B<<4)): return iconBottomSide;
|
||||
case(SEC_HEAD | 3 | (SIDE_T<<4)): return iconTopTip;
|
||||
case(SEC_HEAD | 3 | (SIDE_N<<4)): return iconFaceLeft;
|
||||
case(SEC_HEAD | 3 | (SIDE_S<<4)): return iconFaceRight;
|
||||
case(SEC_HEAD | 3 | (SIDE_W<<4)): return iconCross;
|
||||
case(SEC_HEAD | 3 | (SIDE_E<<4)): return iconFace;
|
||||
|
||||
}
|
||||
|
||||
return iconCross;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tabs, List list) {
|
||||
list.add(new ItemStack(item, 1, 1));
|
||||
list.add(new ItemStack(item, 1, 13));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta) {
|
||||
if (meta < 4) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 13;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
iconFaceLeft = register.registerIcon(iconPrefix + "face-left");
|
||||
iconFaceRight = register.registerIcon(iconPrefix + "face-right");
|
||||
iconFace = register.registerIcon(iconPrefix + "face");
|
||||
|
||||
iconLeftUp = register.registerIcon(iconPrefix + "left-up");
|
||||
iconLeftDown = register.registerIcon(iconPrefix + "left-down");
|
||||
iconLeftTip = register.registerIcon(iconPrefix + "left-tip");
|
||||
|
||||
iconRightUp = register.registerIcon(iconPrefix + "right-up");
|
||||
iconRightDown = register.registerIcon(iconPrefix + "right-down");
|
||||
iconRightTip = register.registerIcon(iconPrefix + "right-tip");
|
||||
|
||||
iconTop = register.registerIcon(iconPrefix + "top");
|
||||
iconTopTip = register.registerIcon(iconPrefix + "top-tip");
|
||||
iconTopSide = register.registerIcon(iconPrefix + "top-side");
|
||||
|
||||
iconBottom = register.registerIcon(iconPrefix + "bot");
|
||||
iconBottomTip = register.registerIcon(iconPrefix + "bot-tip");
|
||||
iconBottomSide = register.registerIcon(iconPrefix + "bot-side");
|
||||
|
||||
iconCross = register.registerIcon(iconPrefix + "crosssection");
|
||||
iconSide = register.registerIcon(iconPrefix + "side");
|
||||
}
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import info.jbcs.minecraft.chisel.Chisel;
|
||||
import info.jbcs.minecraft.chisel.client.render.BlockSnakeStoneRenderer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockSnakestone extends Block
|
||||
{
|
||||
static final int SEC_HEAD = 0;
|
||||
static final int SEC_DOWN = 4;
|
||||
static final int SEC_UP = 8;
|
||||
static final int SEC_HOR = 12;
|
||||
|
||||
static final int SIDE_B = 0;
|
||||
static final int SIDE_T = 1;
|
||||
static final int SIDE_N = 2;
|
||||
static final int SIDE_S = 3;
|
||||
static final int SIDE_W = 4;
|
||||
static final int SIDE_E = 5;
|
||||
|
||||
String iconPrefix;
|
||||
IIcon iconFaceLeft;
|
||||
IIcon iconFaceRight;
|
||||
IIcon iconCross;
|
||||
IIcon iconFace;
|
||||
IIcon iconTopTip;
|
||||
IIcon iconTopSide;
|
||||
IIcon iconBottom;
|
||||
IIcon iconBottomSide;
|
||||
IIcon iconBottomTip;
|
||||
IIcon iconLeftDown;
|
||||
IIcon iconRightDown;
|
||||
IIcon iconLeftUp;
|
||||
IIcon iconRightUp;
|
||||
IIcon iconLeftTip;
|
||||
IIcon iconSide;
|
||||
IIcon iconRightTip;
|
||||
IIcon iconTop;
|
||||
|
||||
public boolean flipTopTextures;
|
||||
|
||||
public BlockSnakestone(String iconPrefix)
|
||||
{
|
||||
super(Material.rock);
|
||||
setHardness(1.5F);
|
||||
setResistance(10.0F);
|
||||
setStepSound(Block.soundTypeStone);
|
||||
setCreativeTab(Chisel.tabChisel);
|
||||
flipTopTextures = false;
|
||||
|
||||
this.iconPrefix = iconPrefix;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return BlockSnakeStoneRenderer.id;
|
||||
}
|
||||
|
||||
static final int[] rotRemap = {0, 3, 1, 2};
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack)
|
||||
{
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if(meta > 3) return;
|
||||
|
||||
if(rotateHead(world, x, y, z) != -1)
|
||||
return;
|
||||
|
||||
int rot = rotRemap[(MathHelper.floor_double(entity.rotationYaw * 4.0 / 360.0 + 0.5)) & 3];
|
||||
|
||||
world.setBlockMetadataWithNotify(x, y, z, rot, 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onBlockPlaced(World world, int x, int y, int z, int side, float hx, float hy, float hz, int meta)
|
||||
{
|
||||
if(meta <= 3) return meta;
|
||||
|
||||
if(rotateBodyPart(world, x, y, z))
|
||||
{
|
||||
return world.getBlockMetadata(x, y, z);
|
||||
}
|
||||
|
||||
if(side == 0 || side == 1) meta = 14;
|
||||
if(side == 2 || side == 3) meta = 13;
|
||||
if(side == 4 || side == 5) meta = 12;
|
||||
|
||||
world.setBlockMetadataWithNotify(x, y, z, meta, 2);
|
||||
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block)
|
||||
{
|
||||
int kind = world.getBlockMetadata(x, y, z) & 0xC;
|
||||
|
||||
if(kind == 0)
|
||||
{
|
||||
rotateHead(world, x, y, z);
|
||||
} else
|
||||
{
|
||||
rotateBodyPart(world, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
public int[] getConnections(World world, int ox, int oy, int oz)
|
||||
{
|
||||
int index = 0;
|
||||
int[] res = {-1, -1, -1, -1, -1, -1, -1};
|
||||
|
||||
for(int direction = 0; direction < 6; direction++)
|
||||
{
|
||||
int x = ox, y = oy, z = oz;
|
||||
switch(direction)
|
||||
{
|
||||
case 0:
|
||||
z--;
|
||||
break;
|
||||
case 1:
|
||||
z++;
|
||||
break;
|
||||
case 2:
|
||||
x--;
|
||||
break;
|
||||
case 3:
|
||||
x++;
|
||||
break;
|
||||
case 4:
|
||||
y--;
|
||||
break;
|
||||
case 5:
|
||||
y++;
|
||||
break;
|
||||
}
|
||||
|
||||
if(!world.getBlock(x, y, z).equals(this)) continue;
|
||||
boolean match = false;
|
||||
|
||||
int px1 = x, px2 = x;
|
||||
int py1 = y, py2 = y;
|
||||
int pz1 = z, pz2 = z;
|
||||
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if((meta & 0xc) == 4 || (meta & 0xc) == 8)
|
||||
{
|
||||
if((meta & 4) == 4) py1--;
|
||||
else py1++;
|
||||
|
||||
switch(meta & 3)
|
||||
{
|
||||
case 0:
|
||||
pz2--;
|
||||
break;
|
||||
case 1:
|
||||
pz2++;
|
||||
break;
|
||||
case 2:
|
||||
px2--;
|
||||
break;
|
||||
case 3:
|
||||
px2++;
|
||||
break;
|
||||
}
|
||||
} else if(meta == 12)
|
||||
{
|
||||
px1--;
|
||||
px2++;
|
||||
} else if(meta == 13)
|
||||
{
|
||||
pz1--;
|
||||
pz2++;
|
||||
} else if(meta == 14)
|
||||
{
|
||||
py1--;
|
||||
py2++;
|
||||
} else if(meta == 15)
|
||||
{
|
||||
match = true;
|
||||
} else if(meta < 4)
|
||||
{
|
||||
match = true;
|
||||
}
|
||||
|
||||
if(!match)
|
||||
{
|
||||
Block b1 = world.getBlock(px1, py1, pz1);
|
||||
Block b2 = world.getBlock(px2, py2, pz2);
|
||||
|
||||
|
||||
if(b1 != this || b2 != this)
|
||||
match = true;
|
||||
|
||||
if(ox == px1 && oy == py1 && oz == pz1)
|
||||
match = true;
|
||||
|
||||
if(ox == px2 && oy == py2 && oz == pz2)
|
||||
match = true;
|
||||
}
|
||||
|
||||
if(match)
|
||||
res[index++] = direction;
|
||||
}
|
||||
|
||||
if(index != 5)
|
||||
res[index] = -1;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
public boolean rotateBodyPart(World world, int x, int y, int z)
|
||||
{
|
||||
int[] con = getConnections(world, x, y, z);
|
||||
int blockMeta = world.getBlockMetadata(x, y, z);
|
||||
int kind = blockMeta & 0xc;
|
||||
|
||||
if(con[1] == -1) return false;
|
||||
if(con[2] != -1) return false;
|
||||
|
||||
int meta = 15;
|
||||
|
||||
if(con[0] == 2 && con[1] == 3)
|
||||
{
|
||||
meta = 12;
|
||||
} else if(con[0] == 0 && con[1] == 1)
|
||||
{
|
||||
meta = 13;
|
||||
} else if(con[0] == 4 && con[1] == 5)
|
||||
{
|
||||
meta = 14;
|
||||
} else if(con[1] == 4)
|
||||
{
|
||||
meta = SEC_DOWN | con[0];
|
||||
} else if(con[1] == 5)
|
||||
{
|
||||
meta = SEC_UP | con[0];
|
||||
}
|
||||
|
||||
if(blockMeta != meta)
|
||||
world.setBlockMetadataWithNotify(x, y, z, meta, 3);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public int rotateHead(World world, int x, int y, int z)
|
||||
{
|
||||
int[] con = getConnections(world, x, y, z);
|
||||
|
||||
if(con[1] >= 0 && con[1] < 4) return -1;
|
||||
|
||||
int meta = -1;
|
||||
switch(con[0])
|
||||
{
|
||||
case 0:
|
||||
meta = 1;
|
||||
break;
|
||||
case 1:
|
||||
meta = 0;
|
||||
break;
|
||||
case 2:
|
||||
meta = 3;
|
||||
break;
|
||||
case 3:
|
||||
meta = 2;
|
||||
break;
|
||||
}
|
||||
|
||||
if(meta == -1) return -1;
|
||||
|
||||
world.setBlock(x, y, z, this, meta, 3);
|
||||
return meta;
|
||||
}
|
||||
|
||||
public boolean connectedTo(World par1World, int x, int y, int z, int direction)
|
||||
{
|
||||
switch(direction)
|
||||
{
|
||||
case 0:
|
||||
return par1World.getBlock(x, y, z - 1).equals(this);
|
||||
case 1:
|
||||
return par1World.getBlock(x, y, z + 1).equals(this);
|
||||
case 2:
|
||||
return par1World.getBlock(x - 1, y, z).equals(this);
|
||||
case 3:
|
||||
return par1World.getBlock(x + 1, y, z).equals(this);
|
||||
case 4:
|
||||
return par1World.getBlock(x, y - 1, z).equals(this);
|
||||
case 5:
|
||||
return par1World.getBlock(x, y + 1, z).equals(this);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
int type = meta & 0xc;
|
||||
int orient = meta & 0x3;
|
||||
|
||||
switch(meta | (side << 4))
|
||||
{
|
||||
|
||||
case (SEC_HOR | 0 | (SIDE_B << 4)):
|
||||
return iconBottomTip;
|
||||
case (SEC_HOR | 0 | (SIDE_T << 4)):
|
||||
return iconTopSide;
|
||||
case (SEC_HOR | 0 | (SIDE_N << 4)):
|
||||
return iconSide;
|
||||
case (SEC_HOR | 0 | (SIDE_S << 4)):
|
||||
return iconSide;
|
||||
case (SEC_HOR | 0 | (SIDE_W << 4)):
|
||||
return iconCross;
|
||||
case (SEC_HOR | 0 | (SIDE_E << 4)):
|
||||
return iconCross;
|
||||
|
||||
case (SEC_HOR | 1 | (SIDE_B << 4)):
|
||||
return iconBottomTip;
|
||||
case (SEC_HOR | 1 | (SIDE_T << 4)):
|
||||
return iconTopSide;
|
||||
case (SEC_HOR | 1 | (SIDE_N << 4)):
|
||||
return iconCross;
|
||||
case (SEC_HOR | 1 | (SIDE_S << 4)):
|
||||
return iconCross;
|
||||
case (SEC_HOR | 1 | (SIDE_W << 4)):
|
||||
return iconSide;
|
||||
case (SEC_HOR | 1 | (SIDE_E << 4)):
|
||||
return iconSide;
|
||||
|
||||
case (SEC_HOR | 2 | (SIDE_B << 4)):
|
||||
return iconCross;
|
||||
case (SEC_HOR | 2 | (SIDE_T << 4)):
|
||||
return iconCross;
|
||||
case (SEC_HOR | 2 | (SIDE_N << 4)):
|
||||
return iconSide;
|
||||
case (SEC_HOR | 2 | (SIDE_S << 4)):
|
||||
return iconSide;
|
||||
case (SEC_HOR | 2 | (SIDE_W << 4)):
|
||||
return iconSide;
|
||||
case (SEC_HOR | 2 | (SIDE_E << 4)):
|
||||
return iconSide;
|
||||
|
||||
case (SEC_HOR | 3 | (SIDE_B << 4)):
|
||||
return iconBottom;
|
||||
case (SEC_HOR | 3 | (SIDE_T << 4)):
|
||||
return iconTop;
|
||||
case (SEC_HOR | 3 | (SIDE_N << 4)):
|
||||
return iconSide;
|
||||
case (SEC_HOR | 3 | (SIDE_S << 4)):
|
||||
return iconSide;
|
||||
case (SEC_HOR | 3 | (SIDE_W << 4)):
|
||||
return iconSide;
|
||||
case (SEC_HOR | 3 | (SIDE_E << 4)):
|
||||
return iconSide;
|
||||
|
||||
case (SEC_DOWN | 0 | (SIDE_B << 4)):
|
||||
return iconCross;
|
||||
case (SEC_DOWN | 0 | (SIDE_T << 4)):
|
||||
return iconTopTip;
|
||||
case (SEC_DOWN | 0 | (SIDE_N << 4)):
|
||||
return iconCross;
|
||||
case (SEC_DOWN | 0 | (SIDE_S << 4)):
|
||||
return iconRightTip;
|
||||
case (SEC_DOWN | 0 | (SIDE_W << 4)):
|
||||
return iconLeftDown;
|
||||
case (SEC_DOWN | 0 | (SIDE_E << 4)):
|
||||
return iconRightDown;
|
||||
|
||||
case (SEC_DOWN | 1 | (SIDE_B << 4)):
|
||||
return iconCross;
|
||||
case (SEC_DOWN | 1 | (SIDE_T << 4)):
|
||||
return iconTopTip;
|
||||
case (SEC_DOWN | 1 | (SIDE_N << 4)):
|
||||
return iconLeftTip;
|
||||
case (SEC_DOWN | 1 | (SIDE_S << 4)):
|
||||
return iconCross;
|
||||
case (SEC_DOWN | 1 | (SIDE_W << 4)):
|
||||
return iconRightDown;
|
||||
case (SEC_DOWN | 1 | (SIDE_E << 4)):
|
||||
return iconLeftDown;
|
||||
|
||||
case (SEC_DOWN | 2 | (SIDE_B << 4)):
|
||||
return iconCross;
|
||||
case (SEC_DOWN | 2 | (SIDE_T << 4)):
|
||||
return iconTopTip;
|
||||
case (SEC_DOWN | 2 | (SIDE_N << 4)):
|
||||
return iconRightDown;
|
||||
case (SEC_DOWN | 2 | (SIDE_S << 4)):
|
||||
return iconLeftDown;
|
||||
case (SEC_DOWN | 2 | (SIDE_W << 4)):
|
||||
return iconCross;
|
||||
case (SEC_DOWN | 2 | (SIDE_E << 4)):
|
||||
return iconLeftTip;
|
||||
|
||||
case (SEC_DOWN | 3 | (SIDE_B << 4)):
|
||||
return iconCross;
|
||||
case (SEC_DOWN | 3 | (SIDE_T << 4)):
|
||||
return iconTopTip;
|
||||
case (SEC_DOWN | 3 | (SIDE_N << 4)):
|
||||
return iconLeftDown;
|
||||
case (SEC_DOWN | 3 | (SIDE_S << 4)):
|
||||
return iconRightDown;
|
||||
case (SEC_DOWN | 3 | (SIDE_W << 4)):
|
||||
return iconRightTip;
|
||||
case (SEC_DOWN | 3 | (SIDE_E << 4)):
|
||||
return iconCross;
|
||||
|
||||
case (SEC_UP | 0 | (SIDE_B << 4)):
|
||||
return iconBottomSide;
|
||||
case (SEC_UP | 0 | (SIDE_T << 4)):
|
||||
return iconCross;
|
||||
case (SEC_UP | 0 | (SIDE_N << 4)):
|
||||
return iconCross;
|
||||
case (SEC_UP | 0 | (SIDE_S << 4)):
|
||||
return iconLeftTip;
|
||||
case (SEC_UP | 0 | (SIDE_W << 4)):
|
||||
return iconLeftUp;
|
||||
case (SEC_UP | 0 | (SIDE_E << 4)):
|
||||
return iconRightUp;
|
||||
|
||||
case (SEC_UP | 1 | (SIDE_B << 4)):
|
||||
return iconBottomSide;
|
||||
case (SEC_UP | 1 | (SIDE_T << 4)):
|
||||
return iconCross;
|
||||
case (SEC_UP | 1 | (SIDE_N << 4)):
|
||||
return iconRightTip;
|
||||
case (SEC_UP | 1 | (SIDE_S << 4)):
|
||||
return iconCross;
|
||||
case (SEC_UP | 1 | (SIDE_W << 4)):
|
||||
return iconRightUp;
|
||||
case (SEC_UP | 1 | (SIDE_E << 4)):
|
||||
return iconLeftUp;
|
||||
|
||||
case (SEC_UP | 2 | (SIDE_B << 4)):
|
||||
return iconBottomSide;
|
||||
case (SEC_UP | 2 | (SIDE_T << 4)):
|
||||
return iconCross;
|
||||
case (SEC_UP | 2 | (SIDE_N << 4)):
|
||||
return iconRightUp;
|
||||
case (SEC_UP | 2 | (SIDE_S << 4)):
|
||||
return iconLeftUp;
|
||||
case (SEC_UP | 2 | (SIDE_W << 4)):
|
||||
return iconCross;
|
||||
case (SEC_UP | 2 | (SIDE_E << 4)):
|
||||
return iconRightTip;
|
||||
|
||||
case (SEC_UP | 3 | (SIDE_B << 4)):
|
||||
return iconBottomSide;
|
||||
case (SEC_UP | 3 | (SIDE_T << 4)):
|
||||
return iconCross;
|
||||
case (SEC_UP | 3 | (SIDE_N << 4)):
|
||||
return iconLeftUp;
|
||||
case (SEC_UP | 3 | (SIDE_S << 4)):
|
||||
return iconRightUp;
|
||||
case (SEC_UP | 3 | (SIDE_W << 4)):
|
||||
return iconLeftTip;
|
||||
case (SEC_UP | 3 | (SIDE_E << 4)):
|
||||
return iconCross;
|
||||
|
||||
case (SEC_HEAD | 0 | (SIDE_B << 4)):
|
||||
return iconBottomSide;
|
||||
case (SEC_HEAD | 0 | (SIDE_T << 4)):
|
||||
return iconTopTip;
|
||||
case (SEC_HEAD | 0 | (SIDE_N << 4)):
|
||||
return iconFace;
|
||||
case (SEC_HEAD | 0 | (SIDE_S << 4)):
|
||||
return iconCross;
|
||||
case (SEC_HEAD | 0 | (SIDE_W << 4)):
|
||||
return iconFaceLeft;
|
||||
case (SEC_HEAD | 0 | (SIDE_E << 4)):
|
||||
return iconFaceRight;
|
||||
|
||||
case (SEC_HEAD | 1 | (SIDE_B << 4)):
|
||||
return iconBottomSide;
|
||||
case (SEC_HEAD | 1 | (SIDE_T << 4)):
|
||||
return iconTopTip;
|
||||
case (SEC_HEAD | 1 | (SIDE_N << 4)):
|
||||
return iconCross;
|
||||
case (SEC_HEAD | 1 | (SIDE_S << 4)):
|
||||
return iconFace;
|
||||
case (SEC_HEAD | 1 | (SIDE_W << 4)):
|
||||
return iconFaceRight;
|
||||
case (SEC_HEAD | 1 | (SIDE_E << 4)):
|
||||
return iconFaceLeft;
|
||||
|
||||
case (SEC_HEAD | 2 | (SIDE_B << 4)):
|
||||
return iconBottomSide;
|
||||
case (SEC_HEAD | 2 | (SIDE_T << 4)):
|
||||
return iconTopTip;
|
||||
case (SEC_HEAD | 2 | (SIDE_N << 4)):
|
||||
return iconFaceRight;
|
||||
case (SEC_HEAD | 2 | (SIDE_S << 4)):
|
||||
return iconFaceLeft;
|
||||
case (SEC_HEAD | 2 | (SIDE_W << 4)):
|
||||
return iconFace;
|
||||
case (SEC_HEAD | 2 | (SIDE_E << 4)):
|
||||
return iconCross;
|
||||
|
||||
case (SEC_HEAD | 3 | (SIDE_B << 4)):
|
||||
return iconBottomSide;
|
||||
case (SEC_HEAD | 3 | (SIDE_T << 4)):
|
||||
return iconTopTip;
|
||||
case (SEC_HEAD | 3 | (SIDE_N << 4)):
|
||||
return iconFaceLeft;
|
||||
case (SEC_HEAD | 3 | (SIDE_S << 4)):
|
||||
return iconFaceRight;
|
||||
case (SEC_HEAD | 3 | (SIDE_W << 4)):
|
||||
return iconCross;
|
||||
case (SEC_HEAD | 3 | (SIDE_E << 4)):
|
||||
return iconFace;
|
||||
|
||||
}
|
||||
|
||||
return iconCross;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tabs, List list)
|
||||
{
|
||||
list.add(new ItemStack(item, 1, 1));
|
||||
list.add(new ItemStack(item, 1, 13));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta)
|
||||
{
|
||||
if(meta < 4)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 13;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register)
|
||||
{
|
||||
iconFaceLeft = register.registerIcon(iconPrefix + "face-left");
|
||||
iconFaceRight = register.registerIcon(iconPrefix + "face-right");
|
||||
iconFace = register.registerIcon(iconPrefix + "face");
|
||||
|
||||
iconLeftUp = register.registerIcon(iconPrefix + "left-up");
|
||||
iconLeftDown = register.registerIcon(iconPrefix + "left-down");
|
||||
iconLeftTip = register.registerIcon(iconPrefix + "left-tip");
|
||||
|
||||
iconRightUp = register.registerIcon(iconPrefix + "right-up");
|
||||
iconRightDown = register.registerIcon(iconPrefix + "right-down");
|
||||
iconRightTip = register.registerIcon(iconPrefix + "right-tip");
|
||||
|
||||
iconTop = register.registerIcon(iconPrefix + "top");
|
||||
iconTopTip = register.registerIcon(iconPrefix + "top-tip");
|
||||
iconTopSide = register.registerIcon(iconPrefix + "top-side");
|
||||
|
||||
iconBottom = register.registerIcon(iconPrefix + "bot");
|
||||
iconBottomTip = register.registerIcon(iconPrefix + "bot-tip");
|
||||
iconBottomSide = register.registerIcon(iconPrefix + "bot-side");
|
||||
|
||||
iconCross = register.registerIcon(iconPrefix + "crosssection");
|
||||
iconSide = register.registerIcon(iconPrefix + "side");
|
||||
}
|
||||
}
|
||||
Executable → Regular
+41
-37
@@ -1,37 +1,41 @@
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
|
||||
|
||||
import info.jbcs.minecraft.chisel.GeneralChiselClient;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockSnakestoneObsidian extends BlockSnakestone {
|
||||
public IIcon[] particles=new IIcon[8];
|
||||
|
||||
public BlockSnakestoneObsidian(String iconPrefix) {
|
||||
super(iconPrefix);
|
||||
|
||||
flipTopTextures=true;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random random) {
|
||||
GeneralChiselClient.spawnSnakestoneObsidianFX(world,this,x,y,z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
super.registerBlockIcons(register);
|
||||
|
||||
for(int i=0;i<particles.length;i++){
|
||||
particles[i]=register.registerIcon(iconPrefix + "particles/"+i);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
|
||||
import info.jbcs.minecraft.chisel.client.GeneralChiselClient;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockSnakestoneObsidian extends BlockSnakestone
|
||||
{
|
||||
public IIcon[] particles = new IIcon[8];
|
||||
|
||||
public BlockSnakestoneObsidian(String iconPrefix)
|
||||
{
|
||||
super(iconPrefix);
|
||||
|
||||
flipTopTextures = true;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random random)
|
||||
{
|
||||
GeneralChiselClient.spawnSnakestoneObsidianFX(world, this, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register)
|
||||
{
|
||||
super.registerBlockIcons(register);
|
||||
|
||||
for(int i = 0; i < particles.length; i++)
|
||||
{
|
||||
particles[i] = register.registerIcon(iconPrefix + "particles/" + i);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Executable → Regular
+88
-79
@@ -1,79 +1,88 @@
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import info.jbcs.minecraft.chisel.Chisel;
|
||||
import info.jbcs.minecraft.chisel.GeneralChiselClient;
|
||||
import info.jbcs.minecraft.chisel.render.BlockSpikesRenderer;
|
||||
import info.jbcs.minecraft.utilities.General;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
public class BlockSpikes extends Block {
|
||||
public IIcon iconBase;
|
||||
public IIcon iconSpike;
|
||||
|
||||
public BlockSpikes(Material mat) {
|
||||
super(Material.circuits);
|
||||
|
||||
this.setCreativeTab(CreativeTabs.tabDecorations);
|
||||
this.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f / 16, 1.0f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT)
|
||||
return;
|
||||
|
||||
// int damage = (int) (entity.motionY*10);
|
||||
// if(damage!=0)
|
||||
// System.out.println(damage);
|
||||
|
||||
double dy=entity.posY-entity.prevPosY;
|
||||
if(dy!=0)
|
||||
System.out.println(dy);
|
||||
|
||||
// System.out.println(entity.speedInAir);
|
||||
|
||||
|
||||
GeneralChiselClient.speedupPlayer(world, entity, Chisel.concreteVelocity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return BlockSpikesRenderer.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
blockIcon = iconBase = register.registerIcon(General.getName(this) + "base");
|
||||
iconSpike = register.registerIcon(General.getName(this) + "spike");
|
||||
}
|
||||
}
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import info.jbcs.minecraft.chisel.Chisel;
|
||||
import info.jbcs.minecraft.chisel.client.GeneralChiselClient;
|
||||
import info.jbcs.minecraft.chisel.client.render.BlockSpikesRenderer;
|
||||
import info.jbcs.minecraft.utilities.General;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
public class BlockSpikes extends Block
|
||||
{
|
||||
public IIcon iconBase;
|
||||
public IIcon iconSpike;
|
||||
|
||||
public BlockSpikes(Material mat)
|
||||
{
|
||||
super(Material.circuits);
|
||||
|
||||
this.setCreativeTab(CreativeTabs.tabDecorations);
|
||||
this.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f / 16, 1.0f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity)
|
||||
{
|
||||
if(FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT)
|
||||
return;
|
||||
|
||||
// int damage = (int) (entity.motionY*10);
|
||||
// if(damage!=0)
|
||||
// System.out.println(damage);
|
||||
|
||||
double dy = entity.posY - entity.prevPosY;
|
||||
if(dy != 0)
|
||||
System.out.println(dy);
|
||||
|
||||
// System.out.println(entity.speedInAir);
|
||||
|
||||
|
||||
GeneralChiselClient.speedupPlayer(world, entity, Chisel.concreteVelocity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return BlockSpikesRenderer.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register)
|
||||
{
|
||||
blockIcon = iconBase = register.registerIcon(General.getName(this) + "base");
|
||||
iconSpike = register.registerIcon(General.getName(this) + "spike");
|
||||
}
|
||||
}
|
||||
@@ -1,55 +1,63 @@
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import info.jbcs.minecraft.chisel.render.BlockTexturedOreRenderer;
|
||||
import info.jbcs.minecraft.chisel.client.render.BlockTexturedOreRenderer;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class BlockTexturedOre extends Block {
|
||||
public int currentPass;
|
||||
public Block base;
|
||||
public IIcon icon;
|
||||
String iconFile;
|
||||
public class BlockTexturedOre extends Block
|
||||
{
|
||||
public int currentPass;
|
||||
public Block base;
|
||||
public IIcon icon;
|
||||
String iconFile;
|
||||
|
||||
public BlockTexturedOre(Material mat, Block base) {
|
||||
super(mat);
|
||||
public BlockTexturedOre(Material mat, Block base)
|
||||
{
|
||||
super(mat);
|
||||
|
||||
this.base = base;
|
||||
}
|
||||
this.base = base;
|
||||
}
|
||||
|
||||
public BlockTexturedOre(Material mat, String iconFile) {
|
||||
super(mat);
|
||||
public BlockTexturedOre(Material mat, String iconFile)
|
||||
{
|
||||
super(mat);
|
||||
|
||||
this.iconFile=iconFile;
|
||||
}
|
||||
this.iconFile = iconFile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return BlockTexturedOreRenderer.id;
|
||||
}
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return BlockTexturedOreRenderer.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderBlockPass() {
|
||||
return 1;
|
||||
}
|
||||
@Override
|
||||
public int getRenderBlockPass()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRenderInPass(int pass) {
|
||||
currentPass = pass;
|
||||
@Override
|
||||
public boolean canRenderInPass(int pass)
|
||||
{
|
||||
currentPass = pass;
|
||||
|
||||
return pass == 1 || pass == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
if(iconFile!=null)
|
||||
icon=register.registerIcon(iconFile);
|
||||
}
|
||||
return pass == 1 || pass == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register)
|
||||
{
|
||||
if(iconFile != null)
|
||||
icon = register.registerIcon(iconFile);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user