The great format and clean up. IMPORTANT: Read below.

All devs and contributors should use the provided formatter settings. 
If your IDE does not support the format, the rules are simple, it is the
default java formatting rules, with 200char line lengths and 1 extra
line after class definitions.
This commit is contained in:
tterrag1098 committed 2015-01-07 19:50:18 -05:00
1 parent 06c5f5930f
commit 82792ed22e
136 files changed
+10365 -11272

No files matched your search

@@ -1,15 +1,12 @@
package com.cricketcraft.chisel.block;
import java.util.List;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
@@ -17,87 +14,83 @@ import net.minecraft.world.World;
import com.cricketcraft.chisel.Chisel;
import com.cricketcraft.chisel.block.tileentity.TileEntityAutoChisel;
import com.cricketcraft.chisel.init.ModBlocks;
import com.cricketcraft.chisel.init.ModItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockAutoChisel extends BlockContainer {
public class BlockAutoChisel extends BlockContainer{
public BlockAutoChisel() {
super(Material.rock);
setHardness(1F);
}
public BlockAutoChisel() {
super(Material.rock);
setHardness(1F);
}
@Override
public int getRenderType() {
return -1;
}
@Override
public int getRenderType() {
return -1;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int metadata, float x1, float y1, float z1) {
TileEntity tile = world.getTileEntity(x, y, z);
if (world.isRemote)
return true;
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int metadata, float x1, float y1, float z1) {
TileEntity tile = world.getTileEntity(x, y, z);
if (world.isRemote)
return true;
if (tile != null && tile instanceof TileEntityAutoChisel && !player.isSneaking()){
player.openGui(Chisel.instance, 1, world, x, y, z);
}
if (tile != null && tile instanceof TileEntityAutoChisel && !player.isSneaking()) {
player.openGui(Chisel.instance, 1, world, x, y, z);
}
return true;
}
return true;
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int par6) {
dropItems(world, x, y, z);
super.breakBlock(world, x, y, z, block, par6);
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int par6) {
dropItems(world, x, y, z);
super.breakBlock(world, x, y, z, block, par6);
}
private void dropItems(World world, int x, int y, int z) {
Random random = new Random();
TileEntity tileEntity = world.getTileEntity(x, y, z);
private void dropItems(World world, int x, int y, int z) {
Random random = new Random();
TileEntity tileEntity = world.getTileEntity(x, y, z);
if (!(tileEntity instanceof TileEntityAutoChisel)) {
return;
}
if (!(tileEntity instanceof TileEntityAutoChisel)) {
return;
}
TileEntityAutoChisel inventory = (TileEntityAutoChisel) world.getTileEntity(x, y, z);
TileEntityAutoChisel inventory = (TileEntityAutoChisel) world.getTileEntity(x, y, z);
for (int c = 0; c < inventory.getSizeInventory(); c++) {
ItemStack stack = inventory.getStackInSlot(c);
for (int c = 0; c < inventory.getSizeInventory(); c++) {
ItemStack stack = inventory.getStackInSlot(c);
if (stack != null && stack.stackSize > 0) {
float rx = random.nextFloat() * 0.8F + 0.1F;
float ry = random.nextFloat() * 0.8F + 0.1F;
float rz = random.nextFloat() * 0.8F + 0.1F;
EntityItem entityItem = new EntityItem(world, x + rx, y + ry, z + rz, stack);
if (stack != null && stack.stackSize > 0) {
float rx = random.nextFloat() * 0.8F + 0.1F;
float ry = random.nextFloat() * 0.8F + 0.1F;
float rz = random.nextFloat() * 0.8F + 0.1F;
EntityItem entityItem = new EntityItem(world, x + rx, y + ry, z + rz, stack);
if (stack.hasTagCompound()) {
entityItem.getEntityItem().setTagCompound((NBTTagCompound) stack.getTagCompound().copy());
}
if (stack.hasTagCompound()) {
entityItem.getEntityItem().setTagCompound((NBTTagCompound) stack.getTagCompound().copy());
}
float factor = 0.05F;
entityItem.motionX = random.nextGaussian() * factor;
entityItem.motionY = random.nextGaussian() * factor + 0.2F;
entityItem.motionZ = random.nextGaussian() * factor;
world.spawnEntityInWorld(entityItem);
stack.stackSize = 0;
}
}
}
float factor = 0.05F;
entityItem.motionX = random.nextGaussian() * factor;
entityItem.motionY = random.nextGaussian() * factor + 0.2F;
entityItem.motionZ = random.nextGaussian() * factor;
world.spawnEntityInWorld(entityItem);
stack.stackSize = 0;
}
}
}
@Override
public TileEntity createNewTileEntity(World var1, int var2) {
return new TileEntityAutoChisel();
}
@Override
public TileEntity createNewTileEntity(World var1, int var2) {
return new TileEntityAutoChisel();
}
}
@@ -5,12 +5,10 @@ import net.minecraft.world.IBlockAccess;
/**
* Created by Pokefenn
*/
public class BlockBeaconBase extends BlockCarvable
{
public class BlockBeaconBase extends BlockCarvable {
@Override
public boolean isBeaconBase(IBlockAccess worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ)
{
return true;
}
@Override
public boolean isBeaconBase(IBlockAccess worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ) {
return true;
}
}
@@ -1,12 +1,7 @@
package com.cricketcraft.chisel.block;
import com.cricketcraft.chisel.Chisel;
import com.cricketcraft.chisel.api.ICarvable;
import com.cricketcraft.chisel.carving.CarvableHelper;
import com.cricketcraft.chisel.carving.CarvableVariation;
import com.cricketcraft.chisel.init.ModTabs;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -15,149 +10,169 @@ import net.minecraft.item.Item;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import java.util.List;
import com.cricketcraft.chisel.Chisel;
import com.cricketcraft.chisel.api.ICarvable;
import com.cricketcraft.chisel.carving.CarvableHelper;
import com.cricketcraft.chisel.carving.CarvableVariation;
import com.cricketcraft.chisel.init.ModTabs;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockCarvable extends Block implements ICarvable {
public CarvableHelper carverHelper;
private boolean isAlpha;
public BlockCarvable() {
this(Material.rock);
}
public CarvableHelper carverHelper;
private boolean isAlpha;
public BlockCarvable(Material m) {
super(m);
carverHelper = new CarvableHelper();
setResistance(10.0F);
setHardness(2.0F);
setCreativeTab(ModTabs.tabOtherChiselBlocks);
}
public BlockCarvable() {
this(Material.rock);
}
public BlockCarvable setStained(boolean a) {
this.isAlpha = a;
return this;
}
public BlockCarvable(Material m) {
super(m);
carverHelper = new CarvableHelper();
setResistance(10.0F);
setHardness(2.0F);
setCreativeTab(ModTabs.tabOtherChiselBlocks);
}
@Override
@SideOnly(Side.CLIENT)
public int getRenderBlockPass() {
return isAlpha ? 1 : 0;
}
public BlockCarvable setStained(boolean a) {
this.isAlpha = a;
return this;
}
@Override
public IIcon getIcon(int side, int metadata) {
return carverHelper.getIcon(side, metadata);
}
@Override
@SideOnly(Side.CLIENT)
public int getRenderBlockPass() {
return isAlpha ? 1 : 0;
}
@Override
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
return carverHelper.getIcon(world, x, y, z, side);
}
@Override
public IIcon getIcon(int side, int metadata) {
return carverHelper.getIcon(side, metadata);
}
@Override
public int damageDropped(int i) {
return i;
}
@Override
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
return carverHelper.getIcon(world, x, y, z, side);
}
@Override
public void registerBlockIcons(IIconRegister register) {
carverHelper.registerBlockIcons("Chisel", this, register);
}
@Override
public int damageDropped(int i) {
return i;
}
@Override
public void getSubBlocks(Item item, CreativeTabs tabs, List list) {
carverHelper.registerSubBlocks(this, tabs, list);
}
@Override
public void registerBlockIcons(IIconRegister register) {
carverHelper.registerBlockIcons("Chisel", this, register);
}
@Override
public int getRenderType() {
return Chisel.RenderCTMId;
}
@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
public int getRenderType() {
return Chisel.RenderCTMId;
}
@Override
public CarvableVariation getVariation(int metadata) {
return carverHelper.getVariation(metadata);
}
public static class SoundType extends Block.SoundType {
public final String soundNameStep;
public final String soundNameBreak;
public final String soundNamePlace;
public static class SoundType extends Block.SoundType {
/**
* Creates a SoundType with automatic names for step and break sounds.
* Sound names dig.soundName and step.soundName must be specified in the
* sounds.json
*
* @param soundName block of the sound. Will automatically be expanded to
* "mod:dig.soundName" and "mod:step.soundName" respectively)
* @param volume default 1.0f
* @param frequency default 1.0f
*/
public SoundType(String soundName, float volume, float frequency) {
super(soundName, volume, frequency);
this.soundNameStep = null;
this.soundNameBreak = null;
this.soundNamePlace = null;
}
public final String soundNameStep;
public final String soundNameBreak;
public final String soundNamePlace;
/**
* Creates a SoundType with manual names for step and break sounds.
* Sound names must be specified in the sounds.json
*
* @param soundNameBreak block break sound
* @param soundNameStep block step sound
* @param volume default 1.0f
* @param frequency default 1.0f
*/
public SoundType(String soundNameBreak, String soundNameStep, float volume, float frequency) {
super(soundNameStep, volume, frequency);
this.soundNameStep = soundNameStep;
this.soundNameBreak = soundNameBreak;
this.soundNamePlace = null;
}
/**
* Creates a SoundType with automatic names for step and break sounds.
* Sound names dig.soundName and step.soundName must be specified in the
* sounds.json
*
* @param soundName
* block of the sound. Will automatically be expanded to
* "mod:dig.soundName" and "mod:step.soundName" respectively)
* @param volume
* default 1.0f
* @param frequency
* default 1.0f
*/
public SoundType(String soundName, float volume, float frequency) {
super(soundName, volume, frequency);
this.soundNameStep = null;
this.soundNameBreak = null;
this.soundNamePlace = null;
}
/**
* Creates a SoundType with manual names for step, break and place
* sounds. Sound names must be specified in the sounds.json
*
* @param soundNameBreak block break sound
* @param soundNameStep block step sound
* @param soundNamePlace block place sound
* @param volume default 1.0f
* @param frequency default 1.0f
*/
public SoundType(String soundNameBreak, String soundNameStep, String soundNamePlace, float volume, float frequency) {
super(soundNameStep, volume, frequency);
this.soundNameStep = soundNameStep;
this.soundNameBreak = soundNameBreak;
this.soundNamePlace = soundNamePlace;
}
/**
* Creates a SoundType with manual names for step and break sounds.
* Sound names must be specified in the sounds.json
*
* @param soundNameBreak
* block break sound
* @param soundNameStep
* block step sound
* @param volume
* default 1.0f
* @param frequency
* default 1.0f
*/
public SoundType(String soundNameBreak, String soundNameStep, float volume, float frequency) {
super(soundNameStep, volume, frequency);
this.soundNameStep = soundNameStep;
this.soundNameBreak = soundNameBreak;
this.soundNamePlace = null;
}
@Override
public String getBreakSound() {
if (soundNameBreak == null)
return Chisel.MOD_ID + ":dig." + this.soundName;
else
return this.soundNameBreak;
}
/**
* Creates a SoundType with manual names for step, break and place
* sounds. Sound names must be specified in the sounds.json
*
* @param soundNameBreak
* block break sound
* @param soundNameStep
* block step sound
* @param soundNamePlace
* block place sound
* @param volume
* default 1.0f
* @param frequency
* default 1.0f
*/
public SoundType(String soundNameBreak, String soundNameStep, String soundNamePlace, float volume, float frequency) {
super(soundNameStep, volume, frequency);
this.soundNameStep = soundNameStep;
this.soundNameBreak = soundNameBreak;
this.soundNamePlace = soundNamePlace;
}
@Override
public String getStepResourcePath() {
if (soundNameStep == null)
return Chisel.MOD_ID + ":step." + this.soundName;
else
return this.soundNameStep;
}
@Override
public String getBreakSound() {
if (soundNameBreak == null)
return Chisel.MOD_ID + ":dig." + this.soundName;
else
return this.soundNameBreak;
}
@Override
public String func_150496_b() {
if (soundNamePlace == null)
return getBreakSound();
else
return this.soundNamePlace;
}
}
@Override
public String getStepResourcePath() {
if (soundNameStep == null)
return Chisel.MOD_ID + ":step." + this.soundName;
else
return this.soundNameStep;
}
@Override
public String func_150496_b() {
if (soundNamePlace == null)
return getBreakSound();
else
return this.soundNamePlace;
}
}
}
@@ -18,71 +18,61 @@ import com.cricketcraft.chisel.init.ModTabs;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockCarvableGlass extends BlockGlass implements ICarvable
{
public CarvableHelper carverHelper;
private boolean isAlpha = false;
public class BlockCarvableGlass extends BlockGlass implements ICarvable {
public BlockCarvableGlass()
{
super(Material.glass, false);
public CarvableHelper carverHelper;
private boolean isAlpha = false;
carverHelper = new CarvableHelper();
setCreativeTab(ModTabs.tabOtherChiselBlocks);
}
public BlockCarvableGlass() {
super(Material.glass, false);
public BlockCarvableGlass setStained(boolean a)
{
this.isAlpha = a;
return this;
}
carverHelper = new CarvableHelper();
setCreativeTab(ModTabs.tabOtherChiselBlocks);
}
@Override
public boolean renderAsNormalBlock()
{
return false;
}
public BlockCarvableGlass setStained(boolean a) {
this.isAlpha = a;
return this;
}
@Override
public int getRenderType()
{
return Chisel.RenderCTMId;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public IIcon getIcon(int side, int metadata)
{
return carverHelper.getIcon(side, metadata);
}
@Override
public int getRenderType() {
return Chisel.RenderCTMId;
}
@Override
public int damageDropped(int i)
{
return i;
}
@Override
public IIcon getIcon(int side, int metadata) {
return carverHelper.getIcon(side, metadata);
}
@Override
public void registerBlockIcons(IIconRegister register)
{
carverHelper.registerBlockIcons("Chisel", this, register);
}
@Override
public int damageDropped(int i) {
return i;
}
@Override
public void getSubBlocks(Item item, CreativeTabs tabs, List list)
{
carverHelper.registerSubBlocks(this, tabs, list);
}
@Override
public void registerBlockIcons(IIconRegister register) {
carverHelper.registerBlockIcons("Chisel", this, register);
}
@Override
public CarvableVariation getVariation(int metadata)
{
return carverHelper.getVariation(metadata);
}
@Override
public void getSubBlocks(Item item, CreativeTabs tabs, List list) {
carverHelper.registerSubBlocks(this, tabs, list);
}
@Override
@SideOnly(Side.CLIENT)
public int getRenderBlockPass()
{
return isAlpha ? 1 : 0;
}
@Override
public CarvableVariation getVariation(int metadata) {
return carverHelper.getVariation(metadata);
}
@Override
@SideOnly(Side.CLIENT)
public int getRenderBlockPass() {
return isAlpha ? 1 : 0;
}
}
@@ -18,66 +18,57 @@ import com.cricketcraft.chisel.init.ModTabs;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockCarvablePane extends BlockPane implements ICarvable
{
public CarvableHelper carverHelper;
public boolean isAlpha;
public class BlockCarvablePane extends BlockPane implements ICarvable {
public BlockCarvablePane(Material material, boolean drops)
{
super("", "", material, drops);
public CarvableHelper carverHelper;
public boolean isAlpha;
carverHelper = new CarvableHelper();
public BlockCarvablePane(Material material, boolean drops) {
super("", "", material, drops);
setCreativeTab(ModTabs.tabOtherChiselBlocks);
}
carverHelper = new CarvableHelper();
public BlockCarvablePane setStained(boolean a)
{
this.isAlpha = a;
return this;
}
setCreativeTab(ModTabs.tabOtherChiselBlocks);
}
@Override
@SideOnly(Side.CLIENT)
public int getRenderBlockPass()
{
return isAlpha ? 1 : 0;
}
public BlockCarvablePane setStained(boolean a) {
this.isAlpha = a;
return this;
}
@Override
public int getRenderType()
{
return BlockMarblePaneRenderer.id;
}
@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 int getRenderType() {
return BlockMarblePaneRenderer.id;
}
@Override
public int damageDropped(int i)
{
return i;
}
@Override
public IIcon getIcon(int side, int metadata) {
return carverHelper.getIcon(side, metadata);
}
@Override
public void registerBlockIcons(IIconRegister register)
{
carverHelper.registerBlockIcons("Chisel", this, register);
}
@Override
public int damageDropped(int i) {
return i;
}
@Override
public void getSubBlocks(Item item, CreativeTabs tabs, List list)
{
carverHelper.registerSubBlocks(this, tabs, list);
}
@Override
public void registerBlockIcons(IIconRegister register) {
carverHelper.registerBlockIcons("Chisel", this, register);
}
@Override
public CarvableVariation getVariation(int metadata)
{
return carverHelper.getVariation(metadata);
}
@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);
}
}
@@ -4,29 +4,30 @@ 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;
}
public BlockCarvablePowered(Material m) {
super(m);
}
/**
* 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;
}
/**
* 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;
}
}
@@ -1,49 +1,53 @@
package com.cricketcraft.chisel.block;
import net.minecraft.block.BlockPumpkin;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
import com.cricketcraft.chisel.Chisel;
import com.cricketcraft.chisel.api.ICarvable;
import com.cricketcraft.chisel.carving.CarvableHelper;
import com.cricketcraft.chisel.carving.CarvableVariation;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.BlockPumpkin;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
public class BlockCarvablePumpkin extends BlockPumpkin implements ICarvable{
public CarvableHelper carverHelper;
public class BlockCarvablePumpkin extends BlockPumpkin implements ICarvable {
@SideOnly(Side.CLIENT)
private IIcon top, face;
public CarvableHelper carverHelper;
private String faceLocation;
@SideOnly(Side.CLIENT)
private IIcon top, face;
public BlockCarvablePumpkin(boolean isOn) {
super(isOn);
if(isOn)
setLightLevel(10.0F);
carverHelper = new CarvableHelper();
}
private String faceLocation;
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta)
{
return side == 1 ? top : (side == 0 ? top : (meta == 2 && side == 2 ? face : (meta == 3 && side == 5 ? face : (meta == 0 && side == 3 ? face : (meta == 1 && side == 4 ? face : this.blockIcon)))));
}
public BlockCarvablePumpkin(boolean isOn) {
super(isOn);
if (isOn)
setLightLevel(10.0F);
carverHelper = new CarvableHelper();
}
@Override
public void registerBlockIcons(IIconRegister icon){
top = icon.registerIcon(Chisel.MOD_ID + ":pumpkin/pumpkin_top");
face = icon.registerIcon(Chisel.MOD_ID + ":" + faceLocation);
this.blockIcon = icon.registerIcon(Chisel.MOD_ID + ":pumpkin/pumpkin_side");
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta) {
return side == 1 ? top : (side == 0 ? top : (meta == 2 && side == 2 ? face : (meta == 3 && side == 5 ? face
: (meta == 0 && side == 3 ? face : (meta == 1 && side == 4 ? face : this.blockIcon)))));
}
@Override
public CarvableVariation getVariation(int metadata) {
return carverHelper.getVariation(metadata);
}
@Override
public void registerBlockIcons(IIconRegister icon) {
top = icon.registerIcon(Chisel.MOD_ID + ":pumpkin/pumpkin_top");
face = icon.registerIcon(Chisel.MOD_ID + ":" + faceLocation);
this.blockIcon = icon.registerIcon(Chisel.MOD_ID + ":pumpkin/pumpkin_side");
}
public void setInformation(String textureLocation){
this.faceLocation = textureLocation;
}
@Override
public CarvableVariation getVariation(int metadata) {
return carverHelper.getVariation(metadata);
}
public void setInformation(String textureLocation) {
this.faceLocation = textureLocation;
}
}
@@ -4,7 +4,6 @@ import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.BlockSand;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
@@ -21,140 +20,153 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockCarvableSand extends BlockSand implements ICarvable {
public CarvableHelper carverHelper;
private boolean isAlpha;
public BlockCarvableSand() {
super();
carverHelper = new CarvableHelper();
setCreativeTab(ModTabs.tabOtherChiselBlocks);
}
public CarvableHelper carverHelper;
private boolean isAlpha;
public BlockCarvableSand setStained(boolean a) {
this.isAlpha = a;
return this;
}
public BlockCarvableSand() {
super();
carverHelper = new CarvableHelper();
setCreativeTab(ModTabs.tabOtherChiselBlocks);
}
@Override
@SideOnly(Side.CLIENT)
public int getRenderBlockPass() {
return isAlpha ? 1 : 0;
}
public BlockCarvableSand setStained(boolean a) {
this.isAlpha = a;
return this;
}
@Override
public IIcon getIcon(int side, int metadata) {
return carverHelper.getIcon(side, metadata);
}
@Override
@SideOnly(Side.CLIENT)
public int getRenderBlockPass() {
return isAlpha ? 1 : 0;
}
@Override
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
return carverHelper.getIcon(world, x, y, z, side);
}
@Override
public IIcon getIcon(int side, int metadata) {
return carverHelper.getIcon(side, metadata);
}
@Override
public int damageDropped(int i) {
return i;
}
@Override
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
return carverHelper.getIcon(world, x, y, z, side);
}
@Override
public void registerBlockIcons(IIconRegister register) {
carverHelper.registerBlockIcons("Chisel", this, register);
}
@Override
public int damageDropped(int i) {
return i;
}
@Override
public void getSubBlocks(Item item, CreativeTabs tabs, List list) {
carverHelper.registerSubBlocks(this, tabs, list);
}
@Override
public void registerBlockIcons(IIconRegister register) {
carverHelper.registerBlockIcons("Chisel", this, register);
}
@Override
public int getRenderType() {
return Chisel.RenderCTMId;
}
@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
public int getRenderType() {
return Chisel.RenderCTMId;
}
@Override
public CarvableVariation getVariation(int metadata) {
return carverHelper.getVariation(metadata);
}
public static class SoundType extends Block.SoundType {
public final String soundNameStep;
public final String soundNameBreak;
public final String soundNamePlace;
public static class SoundType extends Block.SoundType {
/**
* Creates a SoundType with automatic names for step and break sounds.
* Sound names dig.soundName and step.soundName must be specified in the
* sounds.json
*
* @param soundName block of the sound. Will automatically be expanded to
* "mod:dig.soundName" and "mod:step.soundName" respectively)
* @param volume default 1.0f
* @param frequency default 1.0f
*/
public SoundType(String soundName, float volume, float frequency) {
super(soundName, volume, frequency);
this.soundNameStep = null;
this.soundNameBreak = null;
this.soundNamePlace = null;
}
public final String soundNameStep;
public final String soundNameBreak;
public final String soundNamePlace;
/**
* Creates a SoundType with manual names for step and break sounds.
* Sound names must be specified in the sounds.json
*
* @param soundNameBreak block break sound
* @param soundNameStep block step sound
* @param volume default 1.0f
* @param frequency default 1.0f
*/
public SoundType(String soundNameBreak, String soundNameStep, float volume, float frequency) {
super(soundNameStep, volume, frequency);
this.soundNameStep = soundNameStep;
this.soundNameBreak = soundNameBreak;
this.soundNamePlace = null;
}
/**
* Creates a SoundType with automatic names for step and break sounds.
* Sound names dig.soundName and step.soundName must be specified in the
* sounds.json
*
* @param soundName
* block of the sound. Will automatically be expanded to
* "mod:dig.soundName" and "mod:step.soundName" respectively)
* @param volume
* default 1.0f
* @param frequency
* default 1.0f
*/
public SoundType(String soundName, float volume, float frequency) {
super(soundName, volume, frequency);
this.soundNameStep = null;
this.soundNameBreak = null;
this.soundNamePlace = null;
}
/**
* Creates a SoundType with manual names for step, break and place
* sounds. Sound names must be specified in the sounds.json
*
* @param soundNameBreak block break sound
* @param soundNameStep block step sound
* @param soundNamePlace block place sound
* @param volume default 1.0f
* @param frequency default 1.0f
*/
public SoundType(String soundNameBreak, String soundNameStep, String soundNamePlace, float volume, float frequency) {
super(soundNameStep, volume, frequency);
this.soundNameStep = soundNameStep;
this.soundNameBreak = soundNameBreak;
this.soundNamePlace = soundNamePlace;
}
/**
* Creates a SoundType with manual names for step and break sounds.
* Sound names must be specified in the sounds.json
*
* @param soundNameBreak
* block break sound
* @param soundNameStep
* block step sound
* @param volume
* default 1.0f
* @param frequency
* default 1.0f
*/
public SoundType(String soundNameBreak, String soundNameStep, float volume, float frequency) {
super(soundNameStep, volume, frequency);
this.soundNameStep = soundNameStep;
this.soundNameBreak = soundNameBreak;
this.soundNamePlace = null;
}
@Override
public String getBreakSound() {
if (soundNameBreak == null)
return Chisel.MOD_ID + ":dig." + this.soundName;
else
return this.soundNameBreak;
}
/**
* Creates a SoundType with manual names for step, break and place
* sounds. Sound names must be specified in the sounds.json
*
* @param soundNameBreak
* block break sound
* @param soundNameStep
* block step sound
* @param soundNamePlace
* block place sound
* @param volume
* default 1.0f
* @param frequency
* default 1.0f
*/
public SoundType(String soundNameBreak, String soundNameStep, String soundNamePlace, float volume, float frequency) {
super(soundNameStep, volume, frequency);
this.soundNameStep = soundNameStep;
this.soundNameBreak = soundNameBreak;
this.soundNamePlace = soundNamePlace;
}
@Override
public String getStepResourcePath() {
if (soundNameStep == null)
return Chisel.MOD_ID + ":step." + this.soundName;
else
return this.soundNameStep;
}
@Override
public String getBreakSound() {
if (soundNameBreak == null)
return Chisel.MOD_ID + ":dig." + this.soundName;
else
return this.soundNameBreak;
}
@Override
public String func_150496_b() {
if (soundNamePlace == null)
return getBreakSound();
else
return this.soundNamePlace;
}
}
@Override
public String getStepResourcePath() {
if (soundNameStep == null)
return Chisel.MOD_ID + ":step." + this.soundName;
else
return this.soundNameStep;
}
@Override
public String func_150496_b() {
if (soundNamePlace == null)
return getBreakSound();
else
return this.soundNamePlace;
}
}
}
@@ -1,6 +1,5 @@
package com.cricketcraft.chisel.block;
import java.util.Random;
import net.minecraft.block.material.Material;
@@ -14,56 +13,54 @@ import com.cricketcraft.chisel.Configurations;
public class BlockCloud extends BlockCarvable {
public BlockCloud() {
super(Material.ice);
useNeighborBrightness = true;
}
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;
@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;
}
}
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 boolean isOpaqueCube() {
return false;
}
@Override
public int getRenderBlockPass() {
return Configurations.ghostCloud ? 1 : 0;
}
@Override
public int getRenderBlockPass() {
return Configurations.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 boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l) {
return super.shouldSideBeRendered(iblockaccess, i, j, k, 1 - l);
}
@Override
public Item getItemDropped(int par1, Random rand, int par3) {
return Item.getItemFromBlock(this);
}
@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 int quantityDropped(Random rand) {
return rand.nextInt(2);
}
@Override
public Item getItemDropped(int par1, Random rand, int par3) {
return Item.getItemFromBlock(this);
}
@Override
public int quantityDropped(Random rand) {
return rand.nextInt(2);
}
@Override
public int damageDropped(int meta) {
return meta;
}
@Override
public int damageDropped(int meta) {
return meta;
}
}
@@ -10,30 +10,26 @@ import com.cricketcraft.chisel.client.GeneralChiselClient;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
public class BlockConcrete extends BlockCarvable
{
public class BlockConcrete extends BlockCarvable {
public BlockConcrete()
{
super();
}
public BlockConcrete() {
super();
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4)
{
float f = 0.125F;
return AxisAlignedBB.getBoundingBox(par2, par3, par4, (par2 + 1), ((par3 + 1) - f), (par4 + 1));
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) {
float f = 0.125F;
return AxisAlignedBB.getBoundingBox(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(Configurations.concreteVelocity == 0)
return;
@Override
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
if (FMLCommonHandler.instance().getEffectiveSide() != Side.CLIENT)
return;
if (Configurations.concreteVelocity == 0)
return;
GeneralChiselClient.speedupPlayer(world, entity, Configurations.concreteVelocity);
}
GeneralChiselClient.speedupPlayer(world, entity, Configurations.concreteVelocity);
}
}
@@ -2,19 +2,15 @@ package com.cricketcraft.chisel.block;
import com.cricketcraft.chisel.Chisel;
public class BlockEldritch extends BlockCarvable {
public class BlockEldritch extends BlockCarvable
{
public BlockEldritch() {
super();
}
public BlockEldritch()
{
super();
}
@Override
public int getRenderType()
{
return Chisel.RenderEldritchId;
}
@Override
public int getRenderType() {
return Chisel.RenderEldritchId;
}
}
@@ -9,27 +9,27 @@ import net.minecraft.world.World;
import com.cricketcraft.chisel.Chisel;
import com.cricketcraft.chisel.client.GeneralChiselClient;
import com.cricketcraft.chisel.init.ModTabs;
import com.cricketcraft.chisel.utils.General;
public class BlockGrimstone extends BlockCarvable {
public IIcon iconStar;
public BlockGrimstone(Material m) {
super(m);
}
public IIcon iconStar;
@Override
public void randomDisplayTick(World world, int x, int y, int z, Random random) {
if (General.rand.nextInt(4) == 0 && world.isRemote)
GeneralChiselClient.spawnGrimstoneFX(world, this, x, y, z);
}
public BlockGrimstone(Material m) {
super(m);
}
@Override
public void registerBlockIcons(IIconRegister register) {
super.registerBlockIcons(register);
@Override
public void randomDisplayTick(World world, int x, int y, int z, Random random) {
if (General.rand.nextInt(4) == 0 && world.isRemote)
GeneralChiselClient.spawnGrimstoneFX(world, this, x, y, z);
}
iconStar = register.registerIcon(Chisel.MOD_ID + ":grimstone/particles/star");
}
@Override
public void registerBlockIcons(IIconRegister register) {
super.registerBlockIcons(register);
iconStar = register.registerIcon(Chisel.MOD_ID + ":grimstone/particles/star");
}
}
@@ -11,25 +11,26 @@ import com.cricketcraft.chisel.client.GeneralChiselClient;
import com.cricketcraft.chisel.utils.General;
public class BlockHolystone extends BlockCarvable {
public IIcon iconStar;
public BlockHolystone(Material m) {
super(m);
public IIcon iconStar;
this.setLightLevel(0.25F);
}
public BlockHolystone(Material m) {
super(m);
@Override
public void randomDisplayTick(World world, int x, int y, int z, Random random) {
if (General.rand.nextInt(4) == 0 && world.isRemote)
GeneralChiselClient.spawnHolystoneFX(world, this, x, y, z);
}
this.setLightLevel(0.25F);
}
@Override
public void registerBlockIcons(IIconRegister register) {
super.registerBlockIcons(register);
@Override
public void randomDisplayTick(World world, int x, int y, int z, Random random) {
if (General.rand.nextInt(4) == 0 && world.isRemote)
GeneralChiselClient.spawnHolystoneFX(world, this, x, y, z);
}
iconStar = register.registerIcon("Chisel:holystone/particles/star");
}
@Override
public void registerBlockIcons(IIconRegister register) {
super.registerBlockIcons(register);
iconStar = register.registerIcon("Chisel:holystone/particles/star");
}
}
@@ -1,6 +1,5 @@
package com.cricketcraft.chisel.block;
import java.util.Random;
import net.minecraft.block.material.Material;
@@ -8,25 +7,22 @@ import net.minecraft.world.World;
import com.cricketcraft.chisel.client.GeneralChiselClient;
public class BlockLavastone extends BlockMarbleTexturedOre
{
public BlockLavastone(Material mat, String baseIcon)
{
super(mat, baseIcon);
setLightLevel(1F);
}
public class BlockLavastone extends BlockMarbleTexturedOre {
@Override
public void randomDisplayTick(World world, int x, int y, int z, Random random)
{
if(random.nextInt(8) == 0 && world.isRemote)
GeneralChiselClient.spawnLavastoneFX(world, this, x, y, z);
}
public BlockLavastone(Material mat, String baseIcon) {
super(mat, baseIcon);
setLightLevel(1F);
}
@Override
public boolean renderAsNormalBlock()
{
return true;
}
@Override
public void randomDisplayTick(World world, int x, int y, int z, Random random) {
if (random.nextInt(8) == 0 && world.isRemote)
GeneralChiselClient.spawnLavastoneFX(world, this, x, y, z);
}
@Override
public boolean renderAsNormalBlock() {
return true;
}
}
@@ -4,12 +4,12 @@ import net.minecraft.block.material.Material;
public class BlockLeaf extends BlockCarvable {
public BlockLeaf(Material material) {
super(material);
}
public BlockLeaf(Material material) {
super(material);
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean isOpaqueCube() {
return false;
}
}
@@ -8,22 +8,23 @@ 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);
}
public BlockLightstoneCarvable() {
super(Material.glass);
}
@Override
public Item getItemDropped(int i, Random random, int a) {
return Items.glowstone_dust;
}
@Override
public int quantityDropped(Random random) {
return Blocks.glowstone.quantityDropped(random);
}
@Override
public int damageDropped(int i) {
return 0;
}
@Override
public Item getItemDropped(int i, Random random, int a) {
return Items.glowstone_dust;
}
@Override
public int damageDropped(int i) {
return 0;
}
}
@@ -11,47 +11,39 @@ import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockMarbleBookshelf extends BlockCarvable
{
public class BlockMarbleBookshelf extends BlockCarvable {
public BlockMarbleBookshelf()
{
super();
}
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
@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 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 int quantityDropped(Random par1Random)
{
return 3;
}
@Override
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Items.book;
}
@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;
}
@Override
public float getEnchantPowerBonus(World world, int x, int y, int z) {
return 1;
}
}
@@ -14,58 +14,48 @@ import com.cricketcraft.chisel.Chisel;
import com.cricketcraft.chisel.api.ICarvable;
import com.cricketcraft.chisel.carving.CarvableHelper;
import com.cricketcraft.chisel.carving.CarvableVariation;
import com.cricketcraft.chisel.init.ModTabs;
public class BlockMarbleCarpet extends BlockCarpet implements ICarvable
{
public CarvableHelper carverHelper;
public class BlockMarbleCarpet extends BlockCarpet implements ICarvable {
public BlockMarbleCarpet(Material m)
{
carverHelper = new CarvableHelper();
}
public CarvableHelper carverHelper;
public BlockMarbleCarpet(Material m) {
carverHelper = new CarvableHelper();
}
@Override
public IIcon getIcon(int side, int metadata)
{
return carverHelper.getIcon(side, metadata);
}
@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 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 int damageDropped(int i) {
return i;
}
@Override
public void registerBlockIcons(IIconRegister register)
{
carverHelper.registerBlockIcons("Chisel", this, register);
}
@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 void getSubBlocks(Item item, CreativeTabs tabs, List list) {
carverHelper.registerSubBlocks(this, tabs, list);
}
@Override
public int getRenderType()
{
return Chisel.RenderCarpetId;
}
@Override
public int getRenderType() {
return Chisel.RenderCarpetId;
}
@Override
public CarvableVariation getVariation(int metadata)
{
return carverHelper.getVariation(metadata);
}
@Override
public CarvableVariation getVariation(int metadata) {
return carverHelper.getVariation(metadata);
}
}
@@ -15,67 +15,56 @@ import net.minecraft.world.World;
import com.cricketcraft.chisel.api.ICarvable;
import com.cricketcraft.chisel.carving.CarvableHelper;
import com.cricketcraft.chisel.carving.CarvableVariation;
import com.cricketcraft.chisel.init.ModTabs;
public class BlockMarbleIce extends BlockIce implements ICarvable
{
public CarvableHelper carverHelper;
public class BlockMarbleIce extends BlockIce implements ICarvable {
public BlockMarbleIce()
{
super();
carverHelper = new CarvableHelper();
}
public CarvableHelper carverHelper;
@Override
public IIcon getIcon(int side, int metadata)
{
return carverHelper.getIcon(side, metadata);
}
public BlockMarbleIce() {
super();
carverHelper = new CarvableHelper();
}
@Override
public int damageDropped(int i)
{
return 0;
}
@Override
public IIcon getIcon(int side, int metadata) {
return carverHelper.getIcon(side, metadata);
}
@Override
public void registerBlockIcons(IIconRegister register)
{
carverHelper.registerBlockIcons("Chisel", this, register);
}
@Override
public int damageDropped(int i) {
return 0;
}
@Override
public void getSubBlocks(Item item, CreativeTabs tabs, List list)
{
carverHelper.registerSubBlocks(this, tabs, list);
}
@Override
public void registerBlockIcons(IIconRegister register) {
carverHelper.registerBlockIcons("Chisel", this, register);
}
@Override
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6)
{
super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
@Override
public void getSubBlocks(Item item, CreativeTabs tabs, List list) {
carverHelper.registerSubBlocks(this, tabs, list);
}
par2EntityPlayer.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(this)], 1);
par2EntityPlayer.addExhaustion(0.025F);
@Override
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) {
super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
/*
if(this.canSilkHarvest(par1World, par2EntityPlayer, par3, par4, par5, par6) && EnchantmentHelper.getSilkTouchModifier(par2EntityPlayer))
{
ItemStack itemstack = this.createStackedBlock(par6);
par2EntityPlayer.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(this)], 1);
par2EntityPlayer.addExhaustion(0.025F);
if(itemstack != null)
{
this.dropBlockAsItem(par1World, par3, par4, par5, itemstack);
}
}
*/
}
/*
* 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); } }
*/
}
@Override
public CarvableVariation getVariation(int metadata)
{
return carverHelper.getVariation(metadata);
}
@Override
public CarvableVariation getVariation(int metadata) {
return carverHelper.getVariation(metadata);
}
}
@@ -9,43 +9,37 @@ import net.minecraft.world.World;
import com.cricketcraft.chisel.carving.CarvableHelper;
import com.cricketcraft.chisel.init.ModBlocks;
public class BlockMarbleIceStairs extends BlockMarbleStairs
{
public BlockMarbleIceStairs(Block block, int meta, CarvableHelper helper)
{
super(block, meta, helper);
public class BlockMarbleIceStairs extends BlockMarbleStairs {
slipperiness = 0.98F;
setTickRandomly(true);
}
public BlockMarbleIceStairs(Block block, int meta, CarvableHelper helper) {
super(block, meta, helper);
@Override
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6)
{
ModBlocks.ice.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
}
slipperiness = 0.98F;
setTickRandomly(true);
}
@Override
public int quantityDropped(Random par1Random)
{
return ModBlocks.ice.quantityDropped(par1Random);
}
@Override
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) {
ModBlocks.ice.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
}
@Override
public int damageDropped(int i)
{
return 0;
}
@Override
public int quantityDropped(Random par1Random) {
return ModBlocks.ice.quantityDropped(par1Random);
}
@Override
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
{
ModBlocks.ice.updateTick(par1World, par2, par3, par4, par5Random);
}
@Override
public int damageDropped(int i) {
return 0;
}
@Override
public int getMobilityFlag()
{
return 0;
}
@Override
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) {
ModBlocks.ice.updateTick(par1World, par2, par3, par4, par5Random);
}
@Override
public int getMobilityFlag() {
return 0;
}
}
@@ -10,76 +10,75 @@ 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);
BlockMarbleLamp blockUnpowered;
BlockMarbleLamp blockPowered;
boolean powered;
powered = false;
blockUnpowered = this;
blockPowered = new BlockMarbleLamp(this);
public BlockMarbleLamp() {
super(Material.redstoneLight);
setHardness(0.3F);
}
powered = false;
blockUnpowered = this;
blockPowered = new BlockMarbleLamp(this);
public BlockMarbleLamp(BlockMarbleLamp unpoweredVersion) {
super(Material.redstoneLight);
setHardness(0.3F);
}
carverHelper = unpoweredVersion.carverHelper;
public BlockMarbleLamp(BlockMarbleLamp unpoweredVersion) {
super(Material.redstoneLight);
powered = true;
blockUnpowered = unpoweredVersion;
blockPowered = this;
carverHelper = unpoweredVersion.carverHelper;
setLightLevel(1.0F);
setHardness(0.3F);
}
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;
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);
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);
}
}
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 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 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;
/*
* @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); } }
*/
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 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));
}
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
return new ItemStack(blockUnpowered, 1, world.getBlockMetadata(x, y, z));
}
}
@@ -3,7 +3,6 @@ package com.cricketcraft.chisel.block;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.BlockIce;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
@@ -16,67 +15,56 @@ import net.minecraft.world.World;
import com.cricketcraft.chisel.api.ICarvable;
import com.cricketcraft.chisel.carving.CarvableHelper;
import com.cricketcraft.chisel.carving.CarvableVariation;
import com.cricketcraft.chisel.init.ModTabs;
public class BlockMarblePackedIce extends Block implements ICarvable
{
public CarvableHelper carverHelper;
public class BlockMarblePackedIce extends Block implements ICarvable {
public BlockMarblePackedIce()
{
super(Material.ice);
carverHelper = new CarvableHelper();
}
public CarvableHelper carverHelper;
@Override
public IIcon getIcon(int side, int metadata)
{
return carverHelper.getIcon(side, metadata);
}
public BlockMarblePackedIce() {
super(Material.ice);
carverHelper = new CarvableHelper();
}
@Override
public int damageDropped(int i)
{
return 0;
}
@Override
public IIcon getIcon(int side, int metadata) {
return carverHelper.getIcon(side, metadata);
}
@Override
public void registerBlockIcons(IIconRegister register)
{
carverHelper.registerBlockIcons("Chisel", this, register);
}
@Override
public int damageDropped(int i) {
return 0;
}
@Override
public void getSubBlocks(Item item, CreativeTabs tabs, List list)
{
carverHelper.registerSubBlocks(this, tabs, list);
}
@Override
public void registerBlockIcons(IIconRegister register) {
carverHelper.registerBlockIcons("Chisel", this, register);
}
@Override
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6)
{
super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
@Override
public void getSubBlocks(Item item, CreativeTabs tabs, List list) {
carverHelper.registerSubBlocks(this, tabs, list);
}
par2EntityPlayer.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(this)], 1);
par2EntityPlayer.addExhaustion(0.025F);
@Override
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) {
super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
/*
if(this.canSilkHarvest(par1World, par2EntityPlayer, par3, par4, par5, par6) && EnchantmentHelper.getSilkTouchModifier(par2EntityPlayer))
{
ItemStack itemstack = this.createStackedBlock(par6);
par2EntityPlayer.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(this)], 1);
par2EntityPlayer.addExhaustion(0.025F);
if(itemstack != null)
{
this.dropBlockAsItem(par1World, par3, par4, par5, itemstack);
}
}
*/
}
/*
* 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); } }
*/
}
@Override
public CarvableVariation getVariation(int metadata)
{
return carverHelper.getVariation(metadata);
}
@Override
public CarvableVariation getVariation(int metadata) {
return carverHelper.getVariation(metadata);
}
}
@@ -9,43 +9,37 @@ import net.minecraft.world.World;
import com.cricketcraft.chisel.carving.CarvableHelper;
import com.cricketcraft.chisel.init.ModBlocks;
public class BlockMarblePackedIceStairs extends BlockMarbleStairs
{
public BlockMarblePackedIceStairs(Block block, int meta, CarvableHelper helper)
{
super(block, meta, helper);
public class BlockMarblePackedIceStairs extends BlockMarbleStairs {
slipperiness = 0.98F;
setTickRandomly(true);
}
public BlockMarblePackedIceStairs(Block block, int meta, CarvableHelper helper) {
super(block, meta, helper);
@Override
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6)
{
ModBlocks.ice.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
}
slipperiness = 0.98F;
setTickRandomly(true);
}
@Override
public int quantityDropped(Random par1Random)
{
return ModBlocks.ice.quantityDropped(par1Random);
}
@Override
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) {
ModBlocks.ice.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
}
@Override
public int damageDropped(int i)
{
return 0;
}
@Override
public int quantityDropped(Random par1Random) {
return ModBlocks.ice.quantityDropped(par1Random);
}
@Override
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
{
ModBlocks.ice.updateTick(par1World, par2, par3, par4, par5Random);
}
@Override
public int damageDropped(int i) {
return 0;
}
@Override
public int getMobilityFlag()
{
return 0;
}
@Override
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) {
ModBlocks.ice.updateTick(par1World, par2, par3, par4, par5Random);
}
@Override
public int getMobilityFlag() {
return 0;
}
}
@@ -8,33 +8,36 @@ import com.cricketcraft.chisel.carving.CarvableVariation;
import com.cricketcraft.chisel.client.render.BlockMarblePillarRenderer;
public class BlockMarblePillar extends BlockCarvable {
public IIcon sides[] = new IIcon[6];
public BlockMarblePillar(Material m) {
super(m);
}
public IIcon sides[] = new IIcon[6];
@Override
public int getRenderType() {
return BlockMarblePillarRenderer.id;
}
public BlockMarblePillar(Material m) {
super(m);
}
@Override
public IIcon getIcon(int side, int metadata) {
return sides[side];
}
@Override
public int getRenderType() {
return BlockMarblePillarRenderer.id;
}
@Override
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
return sides[side];
}
@Override
public IIcon getIcon(int side, int metadata) {
return sides[side];
}
public IIcon getCtmIcon(int index, int metadata) {
CarvableVariation var = carverHelper.variations.get(metadata);
@Override
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
return sides[side];
}
if (index >= 4) return var.iconTop;
if (var.seamsCtmVert == null) return var.icon;
return var.seamsCtmVert.icons[index];
}
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];
}
}
@@ -16,106 +16,92 @@ 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 class BlockMarbleSlab extends BlockCarvable {
public BlockMarbleSlab(BlockCarvable marble)
{
opaque = true;
public Block master;
public BlockMarbleSlab bottom;
public BlockMarbleSlab top;
public boolean isBottom;
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
public BlockMarbleSlab(BlockCarvable marble) {
opaque = true;
master = marble;
bottom = this;
top = new BlockMarbleSlab(this);
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
isBottom = true;
}
master = marble;
bottom = this;
top = new BlockMarbleSlab(this);
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;
isBottom = true;
}
carverHelper = bottomBlock.carverHelper;
isBottom = false;
}
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;
@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);
}
}
carverHelper = bottomBlock.carverHelper;
isBottom = false;
}
@Override
public void setBlockBoundsForItemRender()
{
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
}
@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 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 void setBlockBoundsForItemRender() {
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@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 int damageDropped(int meta)
{
return meta;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public Item getItemDropped(int par1, Random par2Random, int par3)
{
return Item.getItemFromBlock(bottom);
}
@Override
public int damageDropped(int meta) {
return meta;
}
@Override
public boolean renderAsNormalBlock()
{
return false;
}
@Override
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(bottom);
}
@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 boolean renderAsNormalBlock() {
return false;
}
@Override
public IIcon getIcon(int side, int metadata)
{
return carverHelper.getIcon(side, metadata);
// return master.getIcon(side, metadata);
}
@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 void getSubBlocks(Item block, CreativeTabs tabs, List list)
{
if(isBottom)
super.getSubBlocks(block, tabs, list);
}
@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);
}
}
@@ -17,93 +17,78 @@ import com.cricketcraft.chisel.api.ICarvable;
import com.cricketcraft.chisel.carving.CarvableHelper;
import com.cricketcraft.chisel.carving.CarvableVariation;
import com.cricketcraft.chisel.client.render.BlockMarbleStairsRenderer;
import com.cricketcraft.chisel.init.ModTabs;
public class BlockMarbleStairs extends BlockStairs implements ICarvable
{
CarvableHelper carverHelper;
int blockMeta;
public class BlockMarbleStairs extends BlockStairs implements ICarvable {
public BlockMarbleStairs(Block block, int meta, CarvableHelper helper)
{
super(block, meta);
CarvableHelper carverHelper;
int blockMeta;
this.useNeighborBrightness = true;
carverHelper = helper;
blockMeta = meta;
}
public BlockMarbleStairs(Block block, int meta, CarvableHelper helper) {
super(block, meta);
@Override
public IIcon getIcon(int side, int metadata)
{
return carverHelper.getIcon(side, blockMeta + metadata / 8);
}
this.useNeighborBrightness = true;
carverHelper = helper;
blockMeta = meta;
}
@Override
public int damageDropped(int i)
{
return i & 0x8;
}
@Override
public IIcon getIcon(int side, int metadata) {
return carverHelper.getIcon(side, blockMeta + metadata / 8);
}
@Override
public void registerBlockIcons(IIconRegister register)
{
if(blockMeta == 0)
carverHelper.registerBlockIcons("Chisel", this, register);
}
@Override
public int damageDropped(int i) {
return i & 0x8;
}
@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 void registerBlockIcons(IIconRegister register) {
if (blockMeta == 0)
carverHelper.registerBlockIcons("Chisel", this, register);
}
@Override
public int getRenderType()
{
return BlockMarbleStairsRenderer.id;
}
@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 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();
@Override
public int getRenderType() {
return BlockMarbleStairsRenderer.id;
}
if(l == 0)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 2 | i1 + odd, 2);
}
@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 == 1)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 1 | i1 + odd, 2);
}
if (l == 0) {
par1World.setBlockMetadataWithNotify(par2, par3, par4, 2 | i1 + odd, 2);
}
if(l == 2)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 3 | i1 + odd, 2);
}
if (l == 1) {
par1World.setBlockMetadataWithNotify(par2, par3, par4, 1 | i1 + odd, 2);
}
if(l == 3)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 0 | 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 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);
}
@Override
public CarvableVariation getVariation(int metadata) {
return carverHelper.getVariation(metadata);
}
}
@@ -10,52 +10,45 @@ import com.cricketcraft.chisel.item.ItemCarvable;
import cpw.mods.fml.common.registry.GameRegistry;
public class BlockMarbleStairsMaker
{
public CarvableHelper carverHelper;
BlockMarbleStairs blocks[];
public class BlockMarbleStairsMaker {
//int idStart;
Block blockBase;
String blockName;
public CarvableHelper carverHelper;
BlockMarbleStairs blocks[];
public BlockMarbleStairsMaker(Block base)
{
carverHelper = new CarvableHelper();
blockBase = base;
}
// int idStart;
Block blockBase;
String blockName;
public void create(String name)
{
create(null, name);
}
public BlockMarbleStairsMaker(Block base) {
carverHelper = new CarvableHelper();
blockBase = base;
}
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);
public void create(String name) {
create(null, name);
}
blocks[i].setBlockName(n);
GameRegistry.registerBlock(blocks[i], ItemCarvable.class, n);
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);
for(int meta = 0; meta < 2 && i * 2 + meta < carverHelper.variations.size(); meta++)
{
CarvableVariation variation = carverHelper.variations.get(i * 2 + meta);
blocks[i].setBlockName(n);
GameRegistry.registerBlock(blocks[i], ItemCarvable.class, n);
for(int j = 0; j < 8; j++)
carverHelper.registerVariation(name + ".orientation." + j, variation, blocks[i], j + meta * 8);
for (int meta = 0; meta < 2 && i * 2 + meta < carverHelper.variations.size(); meta++) {
CarvableVariation variation = carverHelper.variations.get(i * 2 + meta);
CraftingManager.getInstance().addRecipe(new ItemStack(blocks[i], 4, meta * 8), new Object[]{"* ", "** ", "***", '*', new ItemStack(blockBase, 1, i * 2 + meta)});
}
for (int j = 0; j < 8; j++)
carverHelper.registerVariation(name + ".orientation." + j, variation, blocks[i], j + meta * 8);
CarvableHelper.chiselBlocks.add(blocks[i]);
}
CraftingManager.getInstance().addRecipe(new ItemStack(blocks[i], 4, meta * 8), new Object[] { "* ", "** ", "***", '*', new ItemStack(blockBase, 1, i * 2 + meta) });
}
}
CarvableHelper.chiselBlocks.add(blocks[i]);
}
}
}
@@ -4,7 +4,7 @@ import net.minecraft.block.Block;
import com.cricketcraft.chisel.carving.CarvableHelper;
public interface BlockMarbleStairsMakerCreator
{
public BlockMarbleStairs create(Block block, int meta, CarvableHelper helper);
public interface BlockMarbleStairsMakerCreator {
public BlockMarbleStairs create(Block block, int meta, CarvableHelper helper);
}
@@ -12,54 +12,47 @@ import net.minecraft.util.IIcon;
import com.cricketcraft.chisel.api.ICarvable;
import com.cricketcraft.chisel.carving.CarvableHelper;
import com.cricketcraft.chisel.carving.CarvableVariation;
import com.cricketcraft.chisel.init.ModTabs;
public class BlockMarbleTexturedOre extends BlockTexturedOre implements ICarvable
{
public CarvableHelper carverHelper;
public class BlockMarbleTexturedOre extends BlockTexturedOre implements ICarvable {
public BlockMarbleTexturedOre(Material mat, String baseIcon)
{
super(mat, baseIcon);
public CarvableHelper carverHelper;
carverHelper = new CarvableHelper();
}
public BlockMarbleTexturedOre(Material mat, String baseIcon) {
super(mat, baseIcon);
public BlockMarbleTexturedOre(Material mat, Block block) {
super(mat, block);
carverHelper = new CarvableHelper();
}
carverHelper = new CarvableHelper();
}
public BlockMarbleTexturedOre(Material mat, Block block) {
super(mat, block);
@Override
public IIcon getIcon(int side, int metadata)
{
return carverHelper.getIcon(side, metadata);
}
carverHelper = new CarvableHelper();
}
@Override
public int damageDropped(int i)
{
return i;
}
@Override
public IIcon getIcon(int side, int metadata) {
return carverHelper.getIcon(side, metadata);
}
@Override
public void registerBlockIcons(IIconRegister register)
{
super.registerBlockIcons(register);
@Override
public int damageDropped(int i) {
return i;
}
carverHelper.registerBlockIcons("Chisel", this, register);
}
@Override
public void registerBlockIcons(IIconRegister register) {
super.registerBlockIcons(register);
@Override
public void getSubBlocks(Item block, CreativeTabs tabs, List list)
{
carverHelper.registerSubBlocks(this, tabs, list);
}
carverHelper.registerBlockIcons("Chisel", this, register);
}
@Override
public CarvableVariation getVariation(int metadata)
{
return carverHelper.getVariation(metadata);
}
@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);
}
}
@@ -10,40 +10,34 @@ import net.minecraft.item.Item;
import net.minecraft.util.IIcon;
import com.cricketcraft.chisel.carving.CarvableHelper;
import com.cricketcraft.chisel.init.ModTabs;
public class BlockMarbleWall extends BlockWall
{
CarvableHelper carverHelper;
public class BlockMarbleWall extends BlockWall {
public BlockMarbleWall(Block block)
{
super(block);
CarvableHelper carverHelper;
carverHelper = new CarvableHelper();
}
public BlockMarbleWall(Block block) {
super(block);
@Override
public IIcon getIcon(int side, int metadata)
{
return carverHelper.getIcon(side, metadata);
}
carverHelper = new CarvableHelper();
}
@Override
public int damageDropped(int i)
{
return i;
}
@Override
public IIcon getIcon(int side, int metadata) {
return carverHelper.getIcon(side, metadata);
}
@Override
public void registerBlockIcons(IIconRegister register)
{
carverHelper.registerBlockIcons("Chisel", this, register);
}
@Override
public int damageDropped(int i) {
return i;
}
@Override
public void getSubBlocks(Item block, CreativeTabs tabs, List list)
{
carverHelper.registerSubBlocks(this, tabs, list);
}
@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);
}
}
@@ -1,12 +1,8 @@
package com.cricketcraft.chisel.block;
import com.cricketcraft.chisel.api.ICarvable;
import com.cricketcraft.chisel.block.tileentity.TileEntityPresent;
import com.cricketcraft.chisel.carving.CarvableHelper;
import com.cricketcraft.chisel.carving.CarvableVariation;
import com.cricketcraft.chisel.inventory.InventoryLargePresent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.Iterator;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockChest;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -25,293 +21,303 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import java.util.Iterator;
import java.util.Random;
import com.cricketcraft.chisel.api.ICarvable;
import com.cricketcraft.chisel.block.tileentity.TileEntityPresent;
import com.cricketcraft.chisel.carving.CarvableHelper;
import com.cricketcraft.chisel.carving.CarvableVariation;
import com.cricketcraft.chisel.inventory.InventoryLargePresent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockPresent extends BlockChest implements ICarvable {
private final Random random = new Random();
private int type;
public CarvableHelper carverHelper;
public BlockPresent(int type) {
super(1);
this.type = type;
carverHelper = new CarvableHelper();
setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0875F, 0.9365F);
}
private final Random random = new Random();
private int type;
public CarvableHelper carverHelper;
public String getKindOfChest(int type){
switch (type){
case 0:
return "textures/blocks/present/presentChest0";
case 1:
return "textures/blocks/present/presentChest1";
case 2:
return "textures/blocks/present/presentChest2";
case 3:
return "textures/blocks/present/presentChest3";
case 4:
return "textures/blocks/present/presentChest4";
case 5:
return "textures/blocks/present/presentChest5";
case 6:
return "textures/blocks/present/presentChest6";
case 7:
return "textures/blocks/present/presentChest7";
case 8:
return "textures/blocks/present/presentChest8";
case 9:
return "textures/blocks/present/presentChest9";
case 10:
return "textures/blocks/present/presentChest10";
case 11:
return "textures/blocks/present/presentChest11";
case 12:
return "textures/blocks/present/presentChest12";
case 13:
return "textures/blocks/present/presentChest13";
case 14:
return "textures/blocks/present/presentChest14";
case 15:
return "textures/blocks/present/presentChest15";
default:
return null;
}
}
public BlockPresent(int type) {
super(1);
this.type = type;
carverHelper = new CarvableHelper();
setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0875F, 0.9365F);
}
private static boolean isCatSittingOnMe(World world, int x, int y, int z) {
Iterator iterator = world.getEntitiesWithinAABB(EntityOcelot.class, AxisAlignedBB.getBoundingBox(x, y + 1, z, x + 1, y + 2, z + 1)).iterator();
EntityOcelot ocelot;
public String getKindOfChest(int type) {
switch (type) {
case 0:
return "textures/blocks/present/presentChest0";
case 1:
return "textures/blocks/present/presentChest1";
case 2:
return "textures/blocks/present/presentChest2";
case 3:
return "textures/blocks/present/presentChest3";
case 4:
return "textures/blocks/present/presentChest4";
case 5:
return "textures/blocks/present/presentChest5";
case 6:
return "textures/blocks/present/presentChest6";
case 7:
return "textures/blocks/present/presentChest7";
case 8:
return "textures/blocks/present/presentChest8";
case 9:
return "textures/blocks/present/presentChest9";
case 10:
return "textures/blocks/present/presentChest10";
case 11:
return "textures/blocks/present/presentChest11";
case 12:
return "textures/blocks/present/presentChest12";
case 13:
return "textures/blocks/present/presentChest13";
case 14:
return "textures/blocks/present/presentChest14";
case 15:
return "textures/blocks/present/presentChest15";
default:
return null;
}
}
do {
if (!iterator.hasNext()) {
return false;
}
private static boolean isCatSittingOnMe(World world, int x, int y, int z) {
Iterator iterator = world.getEntitiesWithinAABB(EntityOcelot.class, AxisAlignedBB.getBoundingBox(x, y + 1, z, x + 1, y + 2, z + 1)).iterator();
EntityOcelot ocelot;
Entity entity = (Entity) iterator.next();
ocelot = (EntityOcelot) entity;
} while (!ocelot.isSitting());
do {
if (!iterator.hasNext()) {
return false;
}
return true;
}
Entity entity = (Entity) iterator.next();
ocelot = (EntityOcelot) entity;
} while (!ocelot.isSitting());
@Override
public boolean isOpaqueCube() {
return false;
}
return true;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public int getRenderType() {
return -1;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLivingBase, ItemStack itemStack) {
Block front = world.getBlock(x, y, z - 1);
Block back = world.getBlock(x, y, z + 1);
Block left = world.getBlock(x - 1, y, z);
Block right = world.getBlock(x + 1, y, z);
byte metadata = 0;
int rot = MathHelper.floor_double((entityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
@Override
public int getRenderType() {
return -1;
}
if (rot == 0) {
metadata = 2;
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLivingBase, ItemStack itemStack) {
Block front = world.getBlock(x, y, z - 1);
Block back = world.getBlock(x, y, z + 1);
Block left = world.getBlock(x - 1, y, z);
Block right = world.getBlock(x + 1, y, z);
byte metadata = 0;
int rot = MathHelper.floor_double((entityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
if (rot == 1) {
metadata = 5;
}
if (rot == 0) {
metadata = 2;
}
if (rot == 2) {
metadata = 3;
}
if (rot == 1) {
metadata = 5;
}
if (rot == 3) {
metadata = 4;
}
if (rot == 2) {
metadata = 3;
}
if (front != this && back != this && left != this && right != this) {
world.setBlockMetadataWithNotify(x, y, z, metadata, 3);
} else {
if ((front == this || back == this) && (metadata == 4 || metadata == 5)) {
if (front == this) {
world.setBlockMetadataWithNotify(x, y, z - 1, metadata, 3);
} else {
world.setBlockMetadataWithNotify(x, y, z + 1, metadata, 3);
}
if (rot == 3) {
metadata = 4;
}
world.setBlockMetadataWithNotify(x, y, z, metadata, 3);
}
if (front != this && back != this && left != this && right != this) {
world.setBlockMetadataWithNotify(x, y, z, metadata, 3);
} else {
if ((front == this || back == this) && (metadata == 4 || metadata == 5)) {
if (front == this) {
world.setBlockMetadataWithNotify(x, y, z - 1, metadata, 3);
} else {
world.setBlockMetadataWithNotify(x, y, z + 1, metadata, 3);
}
if ((left == this || right == this) && (metadata == 2 || metadata == 3)) {
if (left == this) {
world.setBlockMetadataWithNotify(x - 1, y, z, metadata, 3);
} else {
world.setBlockMetadataWithNotify(x + 1, y, z, metadata, 3);
}
world.setBlockMetadataWithNotify(x, y, z, metadata, 3);
}
world.setBlockMetadataWithNotify(x, y, z, metadata, 3);
}
}
}
if ((left == this || right == this) && (metadata == 2 || metadata == 3)) {
if (left == this) {
world.setBlockMetadataWithNotify(x - 1, y, z, metadata, 3);
} else {
world.setBlockMetadataWithNotify(x + 1, y, z, metadata, 3);
}
@Override
public boolean canPlaceBlockAt(World world, int x, int y, int z) {
int l = 0;
world.setBlockMetadataWithNotify(x, y, z, metadata, 3);
}
}
}
if (world.getBlock(x - 1, y, z) == this) {
++l;
}
@Override
public boolean canPlaceBlockAt(World world, int x, int y, int z) {
int l = 0;
if (world.getBlock(x + 1, y, z) == this) {
++l;
}
if (world.getBlock(x - 1, y, z) == this) {
++l;
}
if (world.getBlock(x, y, z - 1) == this) {
++l;
}
if (world.getBlock(x + 1, y, z) == this) {
++l;
}
if (world.getBlock(x, y, z + 1) == this) {
++l;
}
if (world.getBlock(x, y, z - 1) == this) {
++l;
}
return l > 1 ? false : (areSurroundingBlocksMe(world, x, y - 1, z) ? false : (areSurroundingBlocksMe(world, x, y + 1, z) ? false : (areSurroundingBlocksMe(world, x, y, z - 1) ? false : !areSurroundingBlocksMe(world, x, y, z + 1))));
}
if (world.getBlock(x, y, z + 1) == this) {
++l;
}
private boolean areSurroundingBlocksMe(World world, int x, int y, int z) {
return world.getBlock(x, y, z) != this ? false : (world.getBlock(x - 1, y, z) == this ? true : (world.getBlock(x + 1, y, z) == this ? true : (world.getBlock(x, y, z - 1) == this ? true : world.getBlock(x, y, z + 1) == this)));
}
return l > 1 ? false : (areSurroundingBlocksMe(world, x, y - 1, z) ? false : (areSurroundingBlocksMe(world, x, y + 1, z) ? false : (areSurroundingBlocksMe(world, x, y, z - 1) ? false
: !areSurroundingBlocksMe(world, x, y, z + 1))));
}
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block neighbor) {
super.onNeighborBlockChange(world, x, y, z, neighbor);
TileEntityPresent tileEntityPresent = (TileEntityPresent) world.getTileEntity(x, y, z);
private boolean areSurroundingBlocksMe(World world, int x, int y, int z) {
return world.getBlock(x, y, z) != this ? false : (world.getBlock(x - 1, y, z) == this ? true : (world.getBlock(x + 1, y, z) == this ? true : (world.getBlock(x, y, z - 1) == this ? true
: world.getBlock(x, y, z + 1) == this)));
}
if (tileEntityPresent != null) {
tileEntityPresent.updateContainingBlockInfo();
}
}
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block neighbor) {
super.onNeighborBlockChange(world, x, y, z, neighbor);
TileEntityPresent tileEntityPresent = (TileEntityPresent) world.getTileEntity(x, y, z);
@Override
public void breakBlock(World world, int x, int y, int z, Block present, int meta) {
TileEntityPresent tileEntityPresent = (TileEntityPresent) world.getTileEntity(x, y, z);
if (tileEntityPresent != null) {
tileEntityPresent.updateContainingBlockInfo();
}
}
if (tileEntityPresent != null) {
for (int c = 0; c < tileEntityPresent.getSizeInventory(); c++) {
ItemStack itemStack = tileEntityPresent.getStackInSlot(c);
@Override
public void breakBlock(World world, int x, int y, int z, Block present, int meta) {
TileEntityPresent tileEntityPresent = (TileEntityPresent) world.getTileEntity(x, y, z);
if (itemStack != null) {
float f = random.nextFloat() * 0.8F + 0.1F;
float f1 = random.nextFloat() * 0.8F + 0.1F;
EntityItem entityItem;
if (tileEntityPresent != null) {
for (int c = 0; c < tileEntityPresent.getSizeInventory(); c++) {
ItemStack itemStack = tileEntityPresent.getStackInSlot(c);
for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemStack.stackSize > 0; world.spawnEntityInWorld(entityItem)) {
int stack = random.nextInt(21) + 10;
if (itemStack != null) {
float f = random.nextFloat() * 0.8F + 0.1F;
float f1 = random.nextFloat() * 0.8F + 0.1F;
EntityItem entityItem;
if (stack > itemStack.stackSize) {
stack = itemStack.stackSize;
}
for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemStack.stackSize > 0; world.spawnEntityInWorld(entityItem)) {
int stack = random.nextInt(21) + 10;
itemStack.stackSize -= stack;
entityItem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemStack.getItem(), stack, itemStack.getItemDamage()));
float motion = 0.05F;
entityItem.motionX = random.nextGaussian() * motion;
entityItem.motionY = random.nextGaussian() * motion + 0.2F;
entityItem.motionZ = random.nextGaussian() * motion;
if (stack > itemStack.stackSize) {
stack = itemStack.stackSize;
}
if (itemStack.hasTagCompound()) {
entityItem.getEntityItem().setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy());
}
}
}
}
itemStack.stackSize -= stack;
entityItem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemStack.getItem(), stack, itemStack.getItemDamage()));
float motion = 0.05F;
entityItem.motionX = random.nextGaussian() * motion;
entityItem.motionY = random.nextGaussian() * motion + 0.2F;
entityItem.motionZ = random.nextGaussian() * motion;
world.func_147453_f(x, y, z, this);
}
if (itemStack.hasTagCompound()) {
entityItem.getEntityItem().setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy());
}
}
}
}
super.breakBlock(world, x, y, z, this, meta);
}
world.func_147453_f(x, y, z, this);
}
@Override
public TileEntity createNewTileEntity(World world, int par2) {
return new TileEntityPresent(type);
}
super.breakBlock(world, x, y, z, this, meta);
}
@Override
public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int strength) {
if (!canProvidePower()) {
return 0;
} else {
int players = ((TileEntityPresent) world.getTileEntity(x, y, z)).numPlayersUsing;
return MathHelper.clamp_int(players, 0, 15);
}
}
@Override
public TileEntity createNewTileEntity(World world, int par2) {
return new TileEntityPresent(type);
}
@Override
public int isProvidingStrongPower(IBlockAccess world, int x, int y, int z, int strength) {
return strength == 1 ? isProvidingWeakPower(world, x, y, z, strength) : 0;
}
@Override
public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int strength) {
if (!canProvidePower()) {
return 0;
} else {
int players = ((TileEntityPresent) world.getTileEntity(x, y, z)).numPlayersUsing;
return MathHelper.clamp_int(players, 0, 15);
}
}
@Override
public boolean hasComparatorInputOverride() {
return true;
}
@Override
public int isProvidingStrongPower(IBlockAccess world, int x, int y, int z, int strength) {
return strength == 1 ? isProvidingWeakPower(world, x, y, z, strength) : 0;
}
@Override
public int getComparatorInputOverride(World world, int x, int y, int z, int strength) {
return Container.calcRedstoneFromInventory(getInventory(world, x, y, z));
}
@Override
public boolean hasComparatorInputOverride() {
return true;
}
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister register) {
this.blockIcon = register.registerIcon("planks_oak");
}
@Override
public int getComparatorInputOverride(World world, int x, int y, int z, int strength) {
return Container.calcRedstoneFromInventory(getInventory(world, x, y, z));
}
public IInventory getInventory(World world, int x, int y, int z) {
Object object = world.getTileEntity(x, y, z);
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister register) {
this.blockIcon = register.registerIcon("planks_oak");
}
if (object == null) {
return null;
} else if (world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN)) {
return null;
} else if (isCatSittingOnMe(world, x, y, z)) {
return null;
} else if (world.getBlock(x - 1, y, z) == this && (world.isSideSolid(x - 1, y + 1, z, ForgeDirection.DOWN) || isCatSittingOnMe(world, x, y - 1, z))) {
return null;
} else if (world.getBlock(x + 1, y, z) == this && (world.isSideSolid(x + 1, y + 1, z, ForgeDirection.DOWN) || isCatSittingOnMe(world, x, y + 1, z))) {
return null;
} else if (world.getBlock(x, y, z - 1) == this && (world.isSideSolid(x, y + 1, z - 1, ForgeDirection.DOWN) || isCatSittingOnMe(world, x, y, z - 1))) {
return null;
} else if (world.getBlock(x, y, z + 1) == this && (world.isSideSolid(x, y + 1, z + 1, ForgeDirection.DOWN) || isCatSittingOnMe(world, x, y, z + 1))) {
return null;
} else {
if (world.getBlock(x - 1, y, z) == this) {
object = new InventoryLargePresent("container.chestDouble", (TileEntityPresent) world.getTileEntity(x - 1, y, z), (IInventory) object);
}
public IInventory getInventory(World world, int x, int y, int z) {
Object object = world.getTileEntity(x, y, z);
if (world.getBlock(x + 1, y, z) == this) {
object = new InventoryLargePresent("container.chestDouble", (TileEntityPresent) world.getTileEntity(x + 1, y, z), (IInventory) object);
}
if (object == null) {
return null;
} else if (world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN)) {
return null;
} else if (isCatSittingOnMe(world, x, y, z)) {
return null;
} else if (world.getBlock(x - 1, y, z) == this && (world.isSideSolid(x - 1, y + 1, z, ForgeDirection.DOWN) || isCatSittingOnMe(world, x, y - 1, z))) {
return null;
} else if (world.getBlock(x + 1, y, z) == this && (world.isSideSolid(x + 1, y + 1, z, ForgeDirection.DOWN) || isCatSittingOnMe(world, x, y + 1, z))) {
return null;
} else if (world.getBlock(x, y, z - 1) == this && (world.isSideSolid(x, y + 1, z - 1, ForgeDirection.DOWN) || isCatSittingOnMe(world, x, y, z - 1))) {
return null;
} else if (world.getBlock(x, y, z + 1) == this && (world.isSideSolid(x, y + 1, z + 1, ForgeDirection.DOWN) || isCatSittingOnMe(world, x, y, z + 1))) {
return null;
} else {
if (world.getBlock(x - 1, y, z) == this) {
object = new InventoryLargePresent("container.chestDouble", (TileEntityPresent) world.getTileEntity(x - 1, y, z), (IInventory) object);
}
if (world.getBlock(x, y, z - 1) == this) {
object = new InventoryLargePresent("container.chestDouble", (TileEntityPresent) world.getTileEntity(x, y, z - 1), (IInventory) object);
}
if (world.getBlock(x + 1, y, z) == this) {
object = new InventoryLargePresent("container.chestDouble", (TileEntityPresent) world.getTileEntity(x + 1, y, z), (IInventory) object);
}
if (world.getBlock(x, y, z + 1) == this) {
object = new InventoryLargePresent("container.chestDouble", (TileEntityPresent) world.getTileEntity(x, y, z + 1), (IInventory) object);
}
if (world.getBlock(x, y, z - 1) == this) {
object = new InventoryLargePresent("container.chestDouble", (TileEntityPresent) world.getTileEntity(x, y, z - 1), (IInventory) object);
}
return (IInventory) object;
}
}
if (world.getBlock(x, y, z + 1) == this) {
object = new InventoryLargePresent("container.chestDouble", (TileEntityPresent) world.getTileEntity(x, y, z + 1), (IInventory) object);
}
@Override
public CarvableVariation getVariation(int metadata) {
return carverHelper.getVariation(metadata);
}
return (IInventory) object;
}
}
@Override
public CarvableVariation getVariation(int metadata) {
return carverHelper.getVariation(metadata);
}
}
@@ -9,72 +9,63 @@ import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import com.cricketcraft.chisel.client.render.BlockRoadLineRenderer;
import com.cricketcraft.chisel.init.ModTabs;
public class BlockRoadLine extends Block
{
public IIcon aloneIcon;
public IIcon halfLineIcon;
public IIcon fullLineIcon;
public class BlockRoadLine extends Block {
public BlockRoadLine()
{
super(Material.circuits);
public IIcon aloneIcon;
public IIcon halfLineIcon;
public IIcon fullLineIcon;
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);
}
public BlockRoadLine() {
super(Material.circuits);
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4)
{
return null;
}
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);
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) {
return null;
}
@Override
public boolean renderAsNormalBlock()
{
return false;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public int getRenderType()
{
return BlockRoadLineRenderer.id;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{
return World.doesBlockHaveSolidTopSurface(par1World, par2, par3 - 1, par4) || par1World.getBlock(par2, par3 - 1, par4).equals(Blocks.glowstone);
}
@Override
public int getRenderType() {
return BlockRoadLineRenderer.id;
}
@Override
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, Block block)
{
if(par1World.isRemote) return;
@Override
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) {
return World.doesBlockHaveSolidTopSurface(par1World, par2, par3 - 1, par4) || par1World.getBlock(par2, par3 - 1, par4).equals(Blocks.glowstone);
}
if(!this.canPlaceBlockAt(par1World, par2, par3, par4))
{
this.dropBlockAsItem(par1World, par2, par3, par4, 0, 0);
par1World.setBlockToAir(par2, par3, par4);
}
@Override
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, Block block) {
if (par1World.isRemote)
return;
super.onNeighborBlockChange(par1World, par2, par3, par4, block);
}
if (!this.canPlaceBlockAt(par1World, par2, par3, par4)) {
this.dropBlockAsItem(par1World, par2, par3, par4, 0, 0);
par1World.setBlockToAir(par2, par3, par4);
}
@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");
}
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");
}
}
File diff suppressed because it is too large. Load diff
@@ -1,6 +1,5 @@
package com.cricketcraft.chisel.block;
import java.util.Random;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -9,33 +8,29 @@ import net.minecraft.world.World;
import com.cricketcraft.chisel.client.GeneralChiselClient;
public class BlockSnakestoneObsidian extends BlockSnakestone
{
public IIcon[] particles = new IIcon[8];
public class BlockSnakestoneObsidian extends BlockSnakestone {
public BlockSnakestoneObsidian(String iconPrefix)
{
super(iconPrefix);
public IIcon[] particles = new IIcon[8];
flipTopTextures = true;
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);
@Override
public void randomDisplayTick(World world, int x, int y, int z, Random random) {
GeneralChiselClient.spawnSnakestoneObsidianFX(world, this, x, y, z);
}
for(int i = 0; i < particles.length; i++)
{
particles[i] = register.registerIcon(iconPrefix + "particles/" + i);
}
}
@Override
public void registerBlockIcons(IIconRegister register) {
super.registerBlockIcons(register);
for (int i = 0; i < particles.length; i++) {
particles[i] = register.registerIcon(iconPrefix + "particles/" + i);
}
}
}
@@ -7,58 +7,51 @@ import net.minecraft.util.IIcon;
import com.cricketcraft.chisel.client.render.BlockTexturedOreRenderer;
public class BlockTexturedOre extends Block
{
public int currentPass;
public Block base;
public IIcon icon;
String iconFile;
public class BlockTexturedOre extends Block {
public BlockTexturedOre(Material mat, Block base)
{
super(mat);
public int currentPass;
public Block base;
public IIcon icon;
String iconFile;
this.base = base;
}
public BlockTexturedOre(Material mat, Block base) {
super(mat);
public BlockTexturedOre(Material mat, String iconFile)
{
super(mat);
this.base = base;
}
this.iconFile = iconFile;
}
public BlockTexturedOre(Material mat, String iconFile) {
super(mat);
@Override
public boolean renderAsNormalBlock()
{
return false;
}
this.iconFile = iconFile;
}
@Override
public int getRenderType()
{
return BlockTexturedOreRenderer.id;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public int getRenderBlockPass()
{
return 1;
}
@Override
public int getRenderType() {
return BlockTexturedOreRenderer.id;
}
@Override
public boolean canRenderInPass(int pass)
{
currentPass = pass;
@Override
public int getRenderBlockPass() {
return 1;
}
return pass == 1 || pass == 0;
}
@Override
public boolean canRenderInPass(int pass) {
currentPass = pass;
@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);
}
}
@@ -9,38 +9,36 @@ import com.cricketcraft.chisel.Chisel;
import com.cricketcraft.chisel.api.ICarvable;
import com.cricketcraft.chisel.carving.CarvableHelper;
import com.cricketcraft.chisel.carving.CarvableVariation;
import com.cricketcraft.chisel.init.ModTabs;
public class BlockVoidstonePillar extends Block implements ICarvable{
public class BlockVoidstonePillar extends Block implements ICarvable {
public static IIcon topBottom, pillarSide;
public CarvableHelper carvableHelper;
public static IIcon topBottom, pillarSide;
public CarvableHelper carvableHelper;
public BlockVoidstonePillar() {
super(Material.rock);
carvableHelper = new CarvableHelper();
setHardness(5.0F);
setResistance(10.0F);
}
public BlockVoidstonePillar() {
super(Material.rock);
carvableHelper = new CarvableHelper();
setHardness(5.0F);
setResistance(10.0F);
}
@Override
public IIcon getIcon(int side, int meta){
if(side == 0 || side == 1){
return topBottom;
} else {
return pillarSide;
}
}
@Override
public IIcon getIcon(int side, int meta) {
if (side == 0 || side == 1) {
return topBottom;
} else {
return pillarSide;
}
}
@Override
public void registerBlockIcons(IIconRegister icon) {
topBottom = icon.registerIcon(Chisel.MOD_ID + ":voidstone/pillar-top");
pillarSide = icon.registerIcon(Chisel.MOD_ID + ":voidstone/pillar-side");
}
@Override
public void registerBlockIcons(IIconRegister icon){
topBottom = icon.registerIcon(Chisel.MOD_ID + ":voidstone/pillar-top");
pillarSide = icon.registerIcon(Chisel.MOD_ID + ":voidstone/pillar-side");
}
@Override
public CarvableVariation getVariation(int metadata) {
return carvableHelper.getVariation(metadata);
}
@Override
public CarvableVariation getVariation(int metadata) {
return carvableHelper.getVariation(metadata);
}
}
@@ -9,38 +9,36 @@ import com.cricketcraft.chisel.Chisel;
import com.cricketcraft.chisel.api.ICarvable;
import com.cricketcraft.chisel.carving.CarvableHelper;
import com.cricketcraft.chisel.carving.CarvableVariation;
import com.cricketcraft.chisel.init.ModTabs;
public class BlockVoidstonePillar2 extends Block implements ICarvable{
public class BlockVoidstonePillar2 extends Block implements ICarvable {
public static IIcon topBottom, pillarSide;
public CarvableHelper carvableHelper;
public static IIcon topBottom, pillarSide;
public CarvableHelper carvableHelper;
public BlockVoidstonePillar2() {
super(Material.rock);
carvableHelper = new CarvableHelper();
setHardness(5.0F);
setResistance(10.0F);
}
public BlockVoidstonePillar2() {
super(Material.rock);
carvableHelper = new CarvableHelper();
setHardness(5.0F);
setResistance(10.0F);
}
@Override
public IIcon getIcon(int side, int meta){
if(side == 0 || side == 1){
return topBottom;
} else {
return pillarSide;
}
}
@Override
public IIcon getIcon(int side, int meta) {
if (side == 0 || side == 1) {
return topBottom;
} else {
return pillarSide;
}
}
@Override
public void registerBlockIcons(IIconRegister icon) {
topBottom = icon.registerIcon(Chisel.MOD_ID + ":voidstone/animated/pillar-top");
pillarSide = icon.registerIcon(Chisel.MOD_ID + ":voidstone/pillar-side");
}
@Override
public void registerBlockIcons(IIconRegister icon){
topBottom = icon.registerIcon(Chisel.MOD_ID + ":voidstone/animated/pillar-top");
pillarSide = icon.registerIcon(Chisel.MOD_ID + ":voidstone/pillar-side");
}
@Override
public CarvableVariation getVariation(int metadata) {
return carvableHelper.getVariation(metadata);
}
@Override
public CarvableVariation getVariation(int metadata) {
return carvableHelper.getVariation(metadata);
}
}
@@ -3,13 +3,13 @@ package com.cricketcraft.chisel.block;
import net.minecraft.block.material.Material;
public class BlockWaterstone extends BlockMarbleTexturedOre {
public BlockWaterstone(Material mat, String baseIcon) {
super(mat, baseIcon);
}
public BlockWaterstone(Material mat, String baseIcon) {
super(mat, baseIcon);
}
@Override
public boolean renderAsNormalBlock() {
return true;
}
@Override
public boolean renderAsNormalBlock() {
return true;
}
}
@@ -1,8 +1,5 @@
package com.cricketcraft.chisel.block.tileentity;
import com.cricketcraft.chisel.init.ModItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ISidedInventory;
@@ -15,273 +12,278 @@ import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import com.cricketcraft.chisel.init.ModItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class TileEntityAutoChisel extends TileEntity implements ISidedInventory {
private final int BASE = 0, TARGET = 1, OUTPUT = 2, AUTOMATION = 3, STACK = 4, SPEED = 5;
private boolean isAutomated, isStackMode, isFaster;
private static EntityItem ghostItem;
boolean equal = false;
private ItemStack[] inventory = new ItemStack[6];
private String name = "autoChisel";
private final int BASE = 0, TARGET = 1, OUTPUT = 2, AUTOMATION = 3, STACK = 4, SPEED = 5;
private boolean isAutomated, isStackMode, isFaster;
private static EntityItem ghostItem;
boolean equal = false;
private ItemStack[] inventory = new ItemStack[6];
private String name = "autoChisel";
@Override
public boolean canUpdate() {
return true;
}
@Override
public boolean canUpdate() {
return true;
}
@Override
public ItemStack decrStackSize(int slot, int size) {
if (inventory[slot] != null) {
ItemStack is;
if (inventory[slot].stackSize <= size) {
is = inventory[slot];
inventory[slot] = null;
return is;
} else {
is = inventory[slot].splitStack(size);
if (inventory[slot].stackSize == 0)
inventory[slot] = null;
return is;
}
} else
return null;
}
@Override
public ItemStack decrStackSize(int slot, int size) {
if (inventory[slot] != null) {
ItemStack is;
if (inventory[slot].stackSize <= size) {
is = inventory[slot];
inventory[slot] = null;
return is;
} else {
is = inventory[slot].splitStack(size);
if (inventory[slot].stackSize == 0)
inventory[slot] = null;
return is;
}
} else
return null;
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
NBTTagList tags = nbt.getTagList("Items", 10);
inventory = new ItemStack[getSizeInventory()];
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
NBTTagList tags = nbt.getTagList("Items", 10);
inventory = new ItemStack[getSizeInventory()];
for (int i = 0; i < tags.tagCount(); i++) {
NBTTagCompound data = tags.getCompoundTagAt(i);
int j = data.getByte("Slot") & 255;
for (int i = 0; i < tags.tagCount(); i++) {
NBTTagCompound data = tags.getCompoundTagAt(i);
int j = data.getByte("Slot") & 255;
if (j >= 0 && j < inventory.length) {
inventory[j] = ItemStack.loadItemStackFromNBT(data);
}
}
if (j >= 0 && j < inventory.length) {
inventory[j] = ItemStack.loadItemStackFromNBT(data);
}
}
if (nbt.hasKey("CustomName", 8)) {
this.name = nbt.getString("CustomName");
}
}
if (nbt.hasKey("CustomName", 8)) {
this.name = nbt.getString("CustomName");
}
}
@Override
public void updateEntity() {
@Override
public void updateEntity() {
if(inventory[SPEED] == new ItemStack(ModItems.upgrade, 1, 0)){
isFaster = true;
} else {
isFaster = false;
}
if (inventory[SPEED] == new ItemStack(ModItems.upgrade, 1, 0)) {
isFaster = true;
} else {
isFaster = false;
}
if(inventory[AUTOMATION] == new ItemStack(ModItems.upgrade, 1, 1)){
isAutomated = true;
} else {
isAutomated = false;
}
if (inventory[AUTOMATION] == new ItemStack(ModItems.upgrade, 1, 1)) {
isAutomated = true;
} else {
isAutomated = false;
}
if(inventory[STACK] == new ItemStack(ModItems.upgrade, 1, 2)){
isStackMode = true;
} else {
isStackMode = false;
}
if (inventory[STACK] == new ItemStack(ModItems.upgrade, 1, 2)) {
isStackMode = true;
} else {
isStackMode = false;
}
if(isFaster){
if(!worldObj.isRemote && worldObj.getWorldTime() % 10 == 0){
if(inventory[BASE] != null && inventory[TARGET] != null){
if(inventory[BASE].getItem() instanceof ItemBlock && inventory[TARGET].getItem() instanceof ItemBlock){
if(inventory[BASE].getUnlocalizedName().equalsIgnoreCase(inventory[TARGET].getUnlocalizedName())){
if(isStackMode){
if(inventory[BASE].stackSize == inventory[BASE].getMaxStackSize()){
if(inventory[OUTPUT] == null){
inventory[OUTPUT] = new ItemStack(inventory[TARGET].getItem(), 64, inventory[TARGET].getItemDamage());
inventory[BASE] = null;
}
}
} else {
if(inventory[OUTPUT] == null){
inventory[OUTPUT] = new ItemStack(inventory[TARGET].getItem(), 1, inventory[TARGET].getItemDamage());
inventory[BASE].stackSize--;
} else if(inventory[BASE].stackSize != 0){
inventory[OUTPUT].stackSize++;
inventory[BASE].stackSize--;
} else {
inventory[BASE] = null;
}
}
}
}
}
}
} else {
if(!worldObj.isRemote && worldObj.getWorldTime() % 40 == 0){
if(inventory[BASE] != null && inventory[TARGET] != null){
if(inventory[BASE].getItem() instanceof ItemBlock && inventory[TARGET].getItem() instanceof ItemBlock){
if(inventory[BASE].getUnlocalizedName().equalsIgnoreCase(inventory[TARGET].getUnlocalizedName())){
if(isStackMode){
if(inventory[BASE].stackSize == inventory[BASE].getMaxStackSize()){
if(inventory[OUTPUT] == null){
inventory[OUTPUT] = new ItemStack(inventory[TARGET].getItem(), 64, inventory[TARGET].getItemDamage());
inventory[BASE] = null;
}
}
} else {
if(inventory[OUTPUT] == null){
inventory[OUTPUT] = new ItemStack(inventory[TARGET].getItem(), 1, inventory[TARGET].getItemDamage());
inventory[BASE].stackSize--;
} else if(inventory[BASE].stackSize != 0){
inventory[OUTPUT].stackSize++;
inventory[BASE].stackSize--;
} else {
inventory[BASE] = null;
}
}
}
}
}
}
}
if (isFaster) {
if (!worldObj.isRemote && worldObj.getWorldTime() % 10 == 0) {
if (inventory[BASE] != null && inventory[TARGET] != null) {
if (inventory[BASE].getItem() instanceof ItemBlock && inventory[TARGET].getItem() instanceof ItemBlock) {
if (inventory[BASE].getUnlocalizedName().equalsIgnoreCase(inventory[TARGET].getUnlocalizedName())) {
if (isStackMode) {
if (inventory[BASE].stackSize == inventory[BASE].getMaxStackSize()) {
if (inventory[OUTPUT] == null) {
inventory[OUTPUT] = new ItemStack(inventory[TARGET].getItem(), 64, inventory[TARGET].getItemDamage());
inventory[BASE] = null;
}
}
} else {
if (inventory[OUTPUT] == null) {
inventory[OUTPUT] = new ItemStack(inventory[TARGET].getItem(), 1, inventory[TARGET].getItemDamage());
inventory[BASE].stackSize--;
} else if (inventory[BASE].stackSize != 0) {
inventory[OUTPUT].stackSize++;
inventory[BASE].stackSize--;
} else {
inventory[BASE] = null;
}
}
}
}
}
}
} else {
if (!worldObj.isRemote && worldObj.getWorldTime() % 40 == 0) {
if (inventory[BASE] != null && inventory[TARGET] != null) {
if (inventory[BASE].getItem() instanceof ItemBlock && inventory[TARGET].getItem() instanceof ItemBlock) {
if (inventory[BASE].getUnlocalizedName().equalsIgnoreCase(inventory[TARGET].getUnlocalizedName())) {
if (isStackMode) {
if (inventory[BASE].stackSize == inventory[BASE].getMaxStackSize()) {
if (inventory[OUTPUT] == null) {
inventory[OUTPUT] = new ItemStack(inventory[TARGET].getItem(), 64, inventory[TARGET].getItemDamage());
inventory[BASE] = null;
}
}
} else {
if (inventory[OUTPUT] == null) {
inventory[OUTPUT] = new ItemStack(inventory[TARGET].getItem(), 1, inventory[TARGET].getItemDamage());
inventory[BASE].stackSize--;
} else if (inventory[BASE].stackSize != 0) {
inventory[OUTPUT].stackSize++;
inventory[BASE].stackSize--;
} else {
inventory[BASE] = null;
}
}
}
}
}
}
}
markDirty();
}
markDirty();
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
NBTTagList tags = new NBTTagList();
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
NBTTagList tags = new NBTTagList();
for (int i = 0; i < inventory.length; i++) {
if (inventory[i] != null) {
NBTTagCompound data = new NBTTagCompound();
data.setByte("Slot", (byte) i);
inventory[i].writeToNBT(data);
tags.appendTag(data);
}
}
for (int i = 0; i < inventory.length; i++) {
if (inventory[i] != null) {
NBTTagCompound data = new NBTTagCompound();
data.setByte("Slot", (byte) i);
inventory[i].writeToNBT(data);
tags.appendTag(data);
}
}
nbt.setTag("Items", tags);
nbt.setTag("Items", tags);
if (this.hasCustomInventoryName()) {
nbt.setString("CustomName", this.name);
}
}
if (this.hasCustomInventoryName()) {
nbt.setString("CustomName", this.name);
}
}
@Override
public int getSizeInventory() {
return inventory.length;
}
@Override
public int getSizeInventory() {
return inventory.length;
}
@Override
public ItemStack getStackInSlot(int slot) {
return inventory[slot];
}
@Override
public ItemStack getStackInSlot(int slot) {
return inventory[slot];
}
@Override
public ItemStack getStackInSlotOnClosing(int slot) {
if (inventory[slot] != null) {
ItemStack is = inventory[slot];
inventory[slot] = null;
return is;
} else
return null;
}
@Override
public ItemStack getStackInSlotOnClosing(int slot) {
if (inventory[slot] != null) {
ItemStack is = inventory[slot];
inventory[slot] = null;
return is;
} else
return null;
}
@Override
public void setInventorySlotContents(int slot, ItemStack stack) {
inventory[slot] = stack;
@Override
public void setInventorySlotContents(int slot, ItemStack stack) {
inventory[slot] = stack;
if (stack != null && stack.stackSize > getInventoryStackLimit()) {
stack.stackSize = getInventoryStackLimit();
}
markDirty();
}
if (stack != null && stack.stackSize > getInventoryStackLimit()) {
stack.stackSize = getInventoryStackLimit();
}
markDirty();
}
@Override
public String getInventoryName() {
return name;
}
@Override
public String getInventoryName() {
return name;
}
@Override
public final boolean isUseableByPlayer(EntityPlayer player) {
return true;
}
@Override
public final boolean isUseableByPlayer(EntityPlayer player) {
return true;
}
@Override
public int getInventoryStackLimit() {
return 64;
}
@Override
public int getInventoryStackLimit() {
return 64;
}
@Override
public boolean hasCustomInventoryName() {
return false;
}
@Override
public boolean hasCustomInventoryName() {
return false;
}
@Override
public int[] getAccessibleSlotsFromSide(int side) {
return new int[6];
}
@Override
public int[] getAccessibleSlotsFromSide(int side) {
return new int[6];
}
@Override
public boolean isItemValidForSlot(int slot, ItemStack itemStack) {
return true;
}
@Override
public boolean isItemValidForSlot(int slot, ItemStack itemStack) {
return true;
}
@Override
public boolean canInsertItem(int slot, ItemStack itemStack, int side) {
if(isAutomated){
if(side != 0 || side != 1 && slot == BASE){
return true;
}
}
return false;
}
@Override
public boolean canInsertItem(int slot, ItemStack itemStack, int side) {
if (isAutomated) {
if (side != 0 || side != 1 && slot == BASE) {
return true;
}
}
return false;
}
@Override
public boolean canExtractItem(int slot, ItemStack itemStack, int side) {
if(isAutomated){
if(side == 0 || side == 1 && slot == OUTPUT){
return true;
}
}
return false;
}
@Override
public boolean canExtractItem(int slot, ItemStack itemStack, int side) {
if (isAutomated) {
if (side == 0 || side == 1 && slot == OUTPUT) {
return true;
}
}
return false;
}
@Override
public void openInventory() {
}
@Override
public void openInventory() {
}
@Override
public void closeInventory() {
NBTTagList tags = new NBTTagList();
System.out.print(tags);
}
@Override
public void closeInventory() {
NBTTagList tags = new NBTTagList();
System.out.print(tags);
}
@SideOnly(Side.CLIENT)
public EntityItem getItemForRendering(int slot) {
if (ghostItem == null) {
ghostItem = new EntityItem(worldObj);
ghostItem.hoverStart = 0.0F;
}
@SideOnly(Side.CLIENT)
public EntityItem getItemForRendering(int slot) {
if (ghostItem == null) {
ghostItem = new EntityItem(worldObj);
ghostItem.hoverStart = 0.0F;
}
if (inventory[slot] == null) {
return null;
} else {
ghostItem.setEntityItemStack(new ItemStack(inventory[slot].getItem(), 1, inventory[slot].getItemDamage()));
return ghostItem;
}
}
if (inventory[slot] == null) {
return null;
} else {
ghostItem.setEntityItemStack(new ItemStack(inventory[slot].getItem(), 1, inventory[slot].getItemDamage()));
return ghostItem;
}
}
@Override
public Packet getDescriptionPacket() {
NBTTagCompound tag = new NBTTagCompound();
writeToNBT(tag);
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, tag);
}
@Override
public Packet getDescriptionPacket() {
NBTTagCompound tag = new NBTTagCompound();
writeToNBT(tag);
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, tag);
}
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {
readFromNBT(packet.func_148857_g());
}
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {
readFromNBT(packet.func_148857_g());
}
}
@@ -1,125 +1,110 @@
package com.cricketcraft.chisel.block.tileentity;
import com.cricketcraft.chisel.block.BlockPresent;
import com.cricketcraft.chisel.inventory.ContainerPresent;
import com.cricketcraft.chisel.inventory.InventoryLargePresent;
import net.minecraft.block.Block;
import java.util.Iterator;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ContainerChest;
import net.minecraft.inventory.IInventory;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.util.AxisAlignedBB;
import java.util.Iterator;
import java.util.List;
import com.cricketcraft.chisel.inventory.ContainerPresent;
import com.cricketcraft.chisel.inventory.InventoryLargePresent;
public class TileEntityPresent extends TileEntityChest {
public int type;
private int ticksSinceSync;
public TileEntityPresent(int type) {
this.type = type;
}
public int type;
private int ticksSinceSync;
@Override
public boolean isUseableByPlayer(EntityPlayer player) {
return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : player.getDistanceSq(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D) <= 64.0D;
}
public TileEntityPresent(int type) {
this.type = type;
}
@Override
public void updateEntity() {
super.updateEntity();
this.checkForAdjacentChests();
++this.ticksSinceSync;
float f;
@Override
public boolean isUseableByPlayer(EntityPlayer player) {
return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : player.getDistanceSq(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D) <= 64.0D;
}
if (!this.worldObj.isRemote && this.numPlayersUsing != 0 && (this.ticksSinceSync + this.xCoord + this.yCoord + this.zCoord) % 200 == 0)
{
this.numPlayersUsing = 0;
f = 5.0F;
List list = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox((double)((float)this.xCoord - f), (double)((float)this.yCoord - f), (double)((float)this.zCoord - f), (double)((float)(this.xCoord + 1) + f), (double)((float)(this.yCoord + 1) + f), (double)((float)(this.zCoord + 1) + f)));
Iterator iterator = list.iterator();
@Override
public void updateEntity() {
super.updateEntity();
this.checkForAdjacentChests();
++this.ticksSinceSync;
float f;
while (iterator.hasNext())
{
EntityPlayer entityplayer = (EntityPlayer)iterator.next();
if (!this.worldObj.isRemote && this.numPlayersUsing != 0 && (this.ticksSinceSync + this.xCoord + this.yCoord + this.zCoord) % 200 == 0) {
this.numPlayersUsing = 0;
f = 5.0F;
List list = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(this.xCoord - f, this.yCoord - f,
this.zCoord - f, this.xCoord + 1 + f, this.yCoord + 1 + f, this.zCoord + 1 + f));
Iterator iterator = list.iterator();
if (entityplayer.openContainer instanceof ContainerPresent)
{
IInventory iinventory = ((ContainerChest)entityplayer.openContainer).getLowerChestInventory();
while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
if (iinventory == this || iinventory instanceof InventoryLargePresent && ((InventoryLargePresent)iinventory).isPartOfLargePresent(this))
{
++this.numPlayersUsing;
}
}
}
}
if (entityplayer.openContainer instanceof ContainerPresent) {
IInventory iinventory = ((ContainerChest) entityplayer.openContainer).getLowerChestInventory();
this.prevLidAngle = this.lidAngle;
f = 0.1F;
double d2;
if (iinventory == this || iinventory instanceof InventoryLargePresent && ((InventoryLargePresent) iinventory).isPartOfLargePresent(this)) {
++this.numPlayersUsing;
}
}
}
}
if (this.numPlayersUsing > 0 && this.lidAngle == 0.0F && this.adjacentChestZNeg == null && this.adjacentChestXNeg == null)
{
double d1 = (double)this.xCoord + 0.5D;
d2 = (double)this.zCoord + 0.5D;
this.prevLidAngle = this.lidAngle;
f = 0.1F;
double d2;
if (this.adjacentChestZPos != null)
{
d2 += 0.5D;
}
if (this.numPlayersUsing > 0 && this.lidAngle == 0.0F && this.adjacentChestZNeg == null && this.adjacentChestXNeg == null) {
double d1 = this.xCoord + 0.5D;
d2 = this.zCoord + 0.5D;
if (this.adjacentChestXPos != null)
{
d1 += 0.5D;
}
if (this.adjacentChestZPos != null) {
d2 += 0.5D;
}
this.worldObj.playSoundEffect(d1, (double)this.yCoord + 0.5D, d2, "random.chestopen", 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F);
}
if (this.adjacentChestXPos != null) {
d1 += 0.5D;
}
if (this.numPlayersUsing == 0 && this.lidAngle > 0.0F || this.numPlayersUsing > 0 && this.lidAngle < 1.0F)
{
float f1 = this.lidAngle;
this.worldObj.playSoundEffect(d1, this.yCoord + 0.5D, d2, "random.chestopen", 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F);
}
if (this.numPlayersUsing > 0)
{
this.lidAngle += f;
}
else
{
this.lidAngle -= f;
}
if (this.numPlayersUsing == 0 && this.lidAngle > 0.0F || this.numPlayersUsing > 0 && this.lidAngle < 1.0F) {
float f1 = this.lidAngle;
if (this.lidAngle > 1.0F)
{
this.lidAngle = 1.0F;
}
if (this.numPlayersUsing > 0) {
this.lidAngle += f;
} else {
this.lidAngle -= f;
}
float f2 = 0.5F;
if (this.lidAngle > 1.0F) {
this.lidAngle = 1.0F;
}
if (this.lidAngle < f2 && f1 >= f2 && this.adjacentChestZNeg == null && this.adjacentChestXNeg == null)
{
d2 = (double)this.xCoord + 0.5D;
double d0 = (double)this.zCoord + 0.5D;
float f2 = 0.5F;
if (this.adjacentChestZPos != null)
{
d0 += 0.5D;
}
if (this.lidAngle < f2 && f1 >= f2 && this.adjacentChestZNeg == null && this.adjacentChestXNeg == null) {
d2 = this.xCoord + 0.5D;
double d0 = this.zCoord + 0.5D;
if (this.adjacentChestXPos != null)
{
d2 += 0.5D;
}
if (this.adjacentChestZPos != null) {
d0 += 0.5D;
}
this.worldObj.playSoundEffect(d2, (double)this.yCoord + 0.5D, d0, "random.chestclosed", 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F);
}
if (this.adjacentChestXPos != null) {
d2 += 0.5D;
}
if (this.lidAngle < 0.0F)
{
this.lidAngle = 0.0F;
}
}
}
this.worldObj.playSoundEffect(d2, this.yCoord + 0.5D, d0, "random.chestclosed", 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F);
}
if (this.lidAngle < 0.0F) {
this.lidAngle = 0.0F;
}
}
}
}