mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-17 03:05:10 +00:00
[ci skip] spotlessApply with the new settings
This commit is contained in:
1 parent
a314fccd1b
commit
8f026dad8f
161 files changed
+14073
-12846
No files matched your search
@@ -1,7 +1,5 @@
|
||||
package team.chisel.block;
|
||||
|
||||
import team.chisel.Chisel;
|
||||
import team.chisel.block.tileentity.TileEntityAutoChisel;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -10,67 +8,70 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import team.chisel.Chisel;
|
||||
import team.chisel.block.tileentity.TileEntityAutoChisel;
|
||||
|
||||
public class BlockAutoChisel extends BlockContainer {
|
||||
|
||||
public BlockAutoChisel() {
|
||||
super(Material.rock);
|
||||
setHardness(1F);
|
||||
setBlockBounds(0.125f, 0, 0.125f, 0.875f, 0.8125f, 0.875f);
|
||||
}
|
||||
public BlockAutoChisel() {
|
||||
super(Material.rock);
|
||||
setHardness(1F);
|
||||
setBlockBounds(0.125f, 0, 0.125f, 0.875f, 0.8125f, 0.875f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return Chisel.renderAutoChiselId;
|
||||
}
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return Chisel.renderAutoChiselId;
|
||||
}
|
||||
|
||||
@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) {
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
private void dropItems(World world, int x, int y, int z) {
|
||||
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);
|
||||
if (stack != null) {
|
||||
dropBlockAsItem(world, x, y, z, stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int c = 0; c < inventory.getSizeInventory(); c++) {
|
||||
ItemStack stack = inventory.getStackInSlot(c);
|
||||
if (stack != null) {
|
||||
dropBlockAsItem(world, x, y, z, stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1, int var2) {
|
||||
return new TileEntityAutoChisel();
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1, int var2) {
|
||||
return new TileEntityAutoChisel();
|
||||
}
|
||||
}
|
||||
@@ -8,16 +8,16 @@ import net.minecraft.world.IBlockAccess;
|
||||
*/
|
||||
public class BlockBeaconBase extends BlockCarvable {
|
||||
|
||||
public BlockBeaconBase() {
|
||||
super();
|
||||
}
|
||||
public BlockBeaconBase() {
|
||||
super();
|
||||
}
|
||||
|
||||
public BlockBeaconBase(Material mat) {
|
||||
super(mat);
|
||||
}
|
||||
public BlockBeaconBase(Material mat) {
|
||||
super(mat);
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
@@ -2,13 +2,6 @@ package team.chisel.block;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
import com.cricketcraft.chisel.api.rendering.ClientUtils;
|
||||
|
||||
import team.chisel.Chisel;
|
||||
import com.cricketcraft.chisel.api.ChiselTabs;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -16,167 +9,163 @@ import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import team.chisel.Chisel;
|
||||
|
||||
import com.cricketcraft.chisel.api.ChiselTabs;
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
import com.cricketcraft.chisel.api.rendering.ClientUtils;
|
||||
|
||||
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 CarvableHelper carverHelper;
|
||||
private boolean isAlpha;
|
||||
|
||||
public BlockCarvable() {
|
||||
this(Material.rock);
|
||||
}
|
||||
public BlockCarvable() {
|
||||
this(Material.rock);
|
||||
}
|
||||
|
||||
public BlockCarvable(Material m) {
|
||||
super(m);
|
||||
if (m == Material.rock || m == Material.iron) {
|
||||
setHarvestLevel("pickaxe", 0);
|
||||
}
|
||||
carverHelper = new CarvableHelper(this);
|
||||
setResistance(10.0F);
|
||||
setHardness(2.0F);
|
||||
setCreativeTab(ChiselTabs.tabOtherChiselBlocks);
|
||||
}
|
||||
public BlockCarvable(Material m) {
|
||||
super(m);
|
||||
if (m == Material.rock || m == Material.iron) {
|
||||
setHarvestLevel("pickaxe", 0);
|
||||
}
|
||||
carverHelper = new CarvableHelper(this);
|
||||
setResistance(10.0F);
|
||||
setHardness(2.0F);
|
||||
setCreativeTab(ChiselTabs.tabOtherChiselBlocks);
|
||||
}
|
||||
|
||||
public BlockCarvable setStained(boolean a) {
|
||||
this.isAlpha = a;
|
||||
return this;
|
||||
}
|
||||
public BlockCarvable setStained(boolean a) {
|
||||
this.isAlpha = a;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderBlockPass() {
|
||||
return isAlpha ? 1 : 0;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderBlockPass() {
|
||||
return isAlpha ? 1 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
return carverHelper.getIcon(side, metadata);
|
||||
}
|
||||
@Override
|
||||
public IIcon getIcon(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
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
carverHelper.registerBlockIcons(Chisel.MOD_ID, this, register);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
carverHelper.registerBlockIcons(Chisel.MOD_ID, this, register);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tabs, List list) {
|
||||
carverHelper.registerSubBlocks(this, tabs, list);
|
||||
}
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tabs, List list) {
|
||||
carverHelper.registerSubBlocks(this, tabs, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return ClientUtils.renderCTMId;
|
||||
}
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return ClientUtils.renderCTMId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
@Override
|
||||
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IVariationInfo getManager(int meta) {
|
||||
return carverHelper.getVariation(meta);
|
||||
}
|
||||
@Override
|
||||
public IVariationInfo getManager(int meta) {
|
||||
return carverHelper.getVariation(meta);
|
||||
}
|
||||
|
||||
public static class SoundType extends Block.SoundType {
|
||||
public static class SoundType extends Block.SoundType {
|
||||
|
||||
public final String soundNameStep;
|
||||
public final String soundNameBreak;
|
||||
public final String soundNamePlace;
|
||||
public final String soundNameStep;
|
||||
public final String soundNameBreak;
|
||||
public final String soundNamePlace;
|
||||
|
||||
/**
|
||||
* 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 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 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 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 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, 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 getBreakSound() {
|
||||
if (soundNameBreak == null)
|
||||
return Chisel.MOD_ID + ":dig." + this.soundName;
|
||||
else
|
||||
return this.soundNameBreak;
|
||||
}
|
||||
@Override
|
||||
public String getBreakSound() {
|
||||
if (soundNameBreak == null) return Chisel.MOD_ID + ":dig." + this.soundName;
|
||||
else return this.soundNameBreak;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStepResourcePath() {
|
||||
if (soundNameStep == null)
|
||||
return Chisel.MOD_ID + ":step." + this.soundName;
|
||||
else
|
||||
return this.soundNameStep;
|
||||
}
|
||||
@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;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String func_150496_b() {
|
||||
if (soundNamePlace == null) return getBreakSound();
|
||||
else return this.soundNamePlace;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,19 @@
|
||||
package team.chisel.block;
|
||||
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EnumCreatureType;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
|
||||
public class BlockCarvableAntiBlock extends BlockCarvableColor implements ICarvable {
|
||||
|
||||
public BlockCarvableAntiBlock() {
|
||||
super(Material.rock);
|
||||
}
|
||||
public BlockCarvableAntiBlock() {
|
||||
super(Material.rock);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess world, int x, int y, int z) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess world, int x, int y, int z) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import team.chisel.block.tileentity.TileEntityCarvableBeacon;
|
||||
import team.chisel.init.ChiselBlocks;
|
||||
|
||||
@@ -22,77 +23,78 @@ import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
|
||||
public class BlockCarvableBeacon extends BlockBeacon implements ICarvable {
|
||||
|
||||
public static int renderId;
|
||||
public static int renderId;
|
||||
|
||||
public CarvableHelper carverHelper;
|
||||
public CarvableHelper carverHelper;
|
||||
|
||||
public BlockCarvableBeacon() {
|
||||
super();
|
||||
setCreativeTab(ChiselTabs.tabOtherChiselBlocks);
|
||||
setLightLevel(5.0F);
|
||||
setBlockTextureName("beacon");
|
||||
carverHelper = new CarvableHelper(this);
|
||||
}
|
||||
public BlockCarvableBeacon() {
|
||||
super();
|
||||
setCreativeTab(ChiselTabs.tabOtherChiselBlocks);
|
||||
setLightLevel(5.0F);
|
||||
setBlockTextureName("beacon");
|
||||
carverHelper = new CarvableHelper(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityCarvableBeacon();
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityCarvableBeacon();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par5, float hitX, float hitY, float hitZ) {
|
||||
if (world.isRemote) {
|
||||
return true;
|
||||
} else {
|
||||
TileEntityCarvableBeacon tileentitybeacon = (TileEntityCarvableBeacon) world.getTileEntity(x, y, z);
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par5, float hitX,
|
||||
float hitY, float hitZ) {
|
||||
if (world.isRemote) {
|
||||
return true;
|
||||
} else {
|
||||
TileEntityCarvableBeacon tileentitybeacon = (TileEntityCarvableBeacon) world.getTileEntity(x, y, z);
|
||||
|
||||
if (tileentitybeacon != null) {
|
||||
player.func_146104_a(tileentitybeacon);
|
||||
}
|
||||
if (tileentitybeacon != null) {
|
||||
player.func_146104_a(tileentitybeacon);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs p_149666_2_, List list) {
|
||||
for (int i = 0; i < 16; i++) {
|
||||
list.add(new ItemStack(item, 1, i));
|
||||
}
|
||||
}
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs p_149666_2_, List list) {
|
||||
for (int i = 0; i < 16; i++) {
|
||||
list.add(new ItemStack(item, 1, i));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
|
||||
return new ItemStack(ChiselBlocks.beacon, 1, world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta) {
|
||||
return meta;
|
||||
}
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
|
||||
return new ItemStack(ChiselBlocks.beacon, 1, world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return renderId;
|
||||
}
|
||||
@Override
|
||||
public int damageDropped(int meta) {
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {
|
||||
super.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return renderId;
|
||||
}
|
||||
|
||||
if (stack.hasDisplayName()) {
|
||||
((TileEntityCarvableBeacon) world.getTileEntity(x, y, z)).func_145999_a(stack.getDisplayName());
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {
|
||||
super.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
|
||||
@Override
|
||||
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
if (stack.hasDisplayName()) {
|
||||
((TileEntityCarvableBeacon) world.getTileEntity(x, y, z)).func_145999_a(stack.getDisplayName());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IVariationInfo getManager(int meta) {
|
||||
return carverHelper.getVariation(meta);
|
||||
}
|
||||
@Override
|
||||
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IVariationInfo getManager(int meta) {
|
||||
return carverHelper.getVariation(meta);
|
||||
}
|
||||
}
|
||||
@@ -9,53 +9,52 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockCarvableBookshelf extends BlockCarvable {
|
||||
|
||||
public BlockCarvableBookshelf() {
|
||||
super(Material.wood);
|
||||
setHarvestLevel("axe", 0);
|
||||
}
|
||||
public BlockCarvableBookshelf() {
|
||||
super(Material.wood);
|
||||
setHarvestLevel("axe", 0);
|
||||
}
|
||||
|
||||
@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 random) {
|
||||
return 3;
|
||||
}
|
||||
@Override
|
||||
public int quantityDropped(Random random) {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int ammount, Random random, int meta) {
|
||||
return Items.book;
|
||||
}
|
||||
@Override
|
||||
public Item getItemDropped(int ammount, Random random, int meta) {
|
||||
return Items.book;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int damage) {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public int damageDropped(int damage) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDamageValue(World world, int x, int y, int z) {
|
||||
return world.getBlockMetadata(x, y, z);
|
||||
}
|
||||
@Override
|
||||
public int getDamageValue(World world, int x, int y, int z) {
|
||||
return world.getBlockMetadata(x, y, z);
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
@@ -2,11 +2,6 @@ package team.chisel.block;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
import com.cricketcraft.chisel.api.rendering.ClientUtils;
|
||||
|
||||
import net.minecraft.block.BlockCarpet;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -15,52 +10,57 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
import com.cricketcraft.chisel.api.rendering.ClientUtils;
|
||||
|
||||
public class BlockCarvableCarpet extends BlockCarpet implements ICarvable {
|
||||
|
||||
public CarvableHelper carverHelper;
|
||||
public CarvableHelper carverHelper;
|
||||
|
||||
public BlockCarvableCarpet(Material m) {
|
||||
carverHelper = new CarvableHelper(this);
|
||||
}
|
||||
public BlockCarvableCarpet(Material m) {
|
||||
carverHelper = new CarvableHelper(this);
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tabs, List list) {
|
||||
carverHelper.registerSubBlocks(this, tabs, list);
|
||||
}
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tabs, List list) {
|
||||
carverHelper.registerSubBlocks(this, tabs, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return ClientUtils.renderCTMId;
|
||||
}
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return ClientUtils.renderCTMId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
@Override
|
||||
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IVariationInfo getManager(int meta) {
|
||||
return carverHelper.getVariation(meta);
|
||||
}
|
||||
@Override
|
||||
public IVariationInfo getManager(int meta) {
|
||||
return carverHelper.getVariation(meta);
|
||||
}
|
||||
}
|
||||
@@ -6,21 +6,21 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class BlockCarvableColor extends BlockCarvable {
|
||||
|
||||
public BlockCarvableColor() {
|
||||
this(Material.rock);
|
||||
}
|
||||
public BlockCarvableColor() {
|
||||
this(Material.rock);
|
||||
}
|
||||
|
||||
public BlockCarvableColor(Material m) {
|
||||
super(m);
|
||||
}
|
||||
public BlockCarvableColor(Material m) {
|
||||
super(m);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean recolourBlock(World world, int x, int y, int z, ForgeDirection side, int color) {
|
||||
int newColor = 15 - color;
|
||||
if (world.getBlockMetadata(x, y, z) != newColor) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, newColor, 3);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean recolourBlock(World world, int x, int y, int z, ForgeDirection side, int color) {
|
||||
int newColor = 15 - color;
|
||||
if (world.getBlockMetadata(x, y, z) != newColor) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, newColor, 3);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import team.chisel.ctmlib.CTM;
|
||||
|
||||
import com.cricketcraft.chisel.api.ChiselTabs;
|
||||
@@ -24,84 +25,84 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockCarvableGlass extends BlockGlass implements ICarvable {
|
||||
|
||||
public CarvableHelper carverHelper;
|
||||
private boolean isAlpha = false;
|
||||
private CTM ctm = CTM.getInstance();
|
||||
public CarvableHelper carverHelper;
|
||||
private boolean isAlpha = false;
|
||||
private CTM ctm = CTM.getInstance();
|
||||
|
||||
public BlockCarvableGlass() {
|
||||
super(Material.glass, false);
|
||||
public BlockCarvableGlass() {
|
||||
super(Material.glass, false);
|
||||
|
||||
carverHelper = new CarvableHelper(this);
|
||||
setCreativeTab(ChiselTabs.tabOtherChiselBlocks);
|
||||
}
|
||||
carverHelper = new CarvableHelper(this);
|
||||
setCreativeTab(ChiselTabs.tabOtherChiselBlocks);
|
||||
}
|
||||
|
||||
public BlockCarvableGlass setStained(boolean a) {
|
||||
this.isAlpha = a;
|
||||
return this;
|
||||
}
|
||||
public BlockCarvableGlass setStained(boolean a) {
|
||||
this.isAlpha = a;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNormalCube() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isNormalCube() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return ClientUtils.renderCTMId;
|
||||
}
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return ClientUtils.renderCTMId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
return carverHelper.getIcon(side, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
|
||||
ForgeDirection face = ForgeDirection.getOrientation(side).getOpposite();
|
||||
int meX = x + face.offsetX;
|
||||
int meY = y + face.offsetY;
|
||||
int meZ = z + face.offsetZ;
|
||||
Block block = world.getBlock(meX, meY, meZ);
|
||||
int meta = world.getBlockMetadata(meX, meY, meZ);
|
||||
Block otherBlock = ctm.getBlockOrFacade(world, x, y, z, face.ordinal());
|
||||
int otherMeta = ctm.getBlockOrFacadeMetadata(world, x, y, z, face.ordinal());
|
||||
return block != otherBlock || meta != otherMeta;
|
||||
}
|
||||
@Override
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
return carverHelper.getIcon(side, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int i) {
|
||||
return i;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
|
||||
ForgeDirection face = ForgeDirection.getOrientation(side).getOpposite();
|
||||
int meX = x + face.offsetX;
|
||||
int meY = y + face.offsetY;
|
||||
int meZ = z + face.offsetZ;
|
||||
Block block = world.getBlock(meX, meY, meZ);
|
||||
int meta = world.getBlockMetadata(meX, meY, meZ);
|
||||
Block otherBlock = ctm.getBlockOrFacade(world, x, y, z, face.ordinal());
|
||||
int otherMeta = ctm.getBlockOrFacadeMetadata(world, x, y, z, face.ordinal());
|
||||
return block != otherBlock || meta != otherMeta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
carverHelper.registerBlockIcons("Chisel", this, register);
|
||||
}
|
||||
@Override
|
||||
public int damageDropped(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@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 IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tabs, List list) {
|
||||
carverHelper.registerSubBlocks(this, tabs, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IVariationInfo getManager(int meta) {
|
||||
return carverHelper.getVariation(meta);
|
||||
}
|
||||
@Override
|
||||
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderBlockPass() {
|
||||
return isAlpha ? 1 : 0;
|
||||
}
|
||||
@Override
|
||||
public IVariationInfo getManager(int meta) {
|
||||
return carverHelper.getVariation(meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderBlockPass() {
|
||||
return isAlpha ? 1 : 0;
|
||||
}
|
||||
}
|
||||
@@ -1,58 +1,59 @@
|
||||
package team.chisel.block;
|
||||
|
||||
import team.chisel.Chisel;
|
||||
import team.chisel.client.render.SubmapManagerBase;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import team.chisel.Chisel;
|
||||
import team.chisel.client.render.SubmapManagerBase;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockCarvableGlow extends BlockCarvableColor {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon glowTexture;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon glowTexture;
|
||||
|
||||
private SubmapManagerBase submapManagerBase;
|
||||
private String glowTexturePath;
|
||||
private SubmapManagerBase submapManagerBase;
|
||||
private String glowTexturePath;
|
||||
|
||||
public BlockCarvableGlow(String glowTexture) {
|
||||
super();
|
||||
setLightLevel(0.5f);
|
||||
this.glowTexturePath = glowTexture;
|
||||
}
|
||||
public BlockCarvableGlow(String glowTexture) {
|
||||
super();
|
||||
setLightLevel(0.5f);
|
||||
this.glowTexturePath = glowTexture;
|
||||
}
|
||||
|
||||
public BlockCarvableGlow(Material mat, String glowTexture) {
|
||||
super(mat);
|
||||
this.glowTexturePath = glowTexture;
|
||||
}
|
||||
public BlockCarvableGlow(Material mat, String glowTexture) {
|
||||
super(mat);
|
||||
this.glowTexturePath = glowTexture;
|
||||
}
|
||||
|
||||
public BlockCarvableGlow(Material material, String glowTexture, SubmapManagerBase submapManagerBase) {
|
||||
super(material);
|
||||
this.glowTexturePath = glowTexture;
|
||||
this.submapManagerBase = submapManagerBase;
|
||||
}
|
||||
public BlockCarvableGlow(Material material, String glowTexture, SubmapManagerBase submapManagerBase) {
|
||||
super(material);
|
||||
this.glowTexturePath = glowTexture;
|
||||
this.submapManagerBase = submapManagerBase;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
super.registerBlockIcons(register);
|
||||
glowTexture = register.registerIcon(Chisel.MOD_ID + ":" + glowTexturePath);
|
||||
}
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
super.registerBlockIcons(register);
|
||||
glowTexture = register.registerIcon(Chisel.MOD_ID + ":" + glowTexturePath);
|
||||
}
|
||||
|
||||
public boolean hasSubmapManager() {
|
||||
return submapManagerBase == null;
|
||||
}
|
||||
public boolean hasSubmapManager() {
|
||||
return submapManagerBase == null;
|
||||
}
|
||||
|
||||
public SubmapManagerBase getSubmapManager() {
|
||||
return hasSubmapManager() ? submapManagerBase : null;
|
||||
}
|
||||
public SubmapManagerBase getSubmapManager() {
|
||||
return hasSubmapManager() ? submapManagerBase : null;
|
||||
}
|
||||
|
||||
public IIcon getGlowTexture() {
|
||||
return glowTexture;
|
||||
}
|
||||
public IIcon getGlowTexture() {
|
||||
return glowTexture;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return Chisel.renderGlowId;
|
||||
}
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return Chisel.renderGlowId;
|
||||
}
|
||||
}
|
||||
@@ -14,29 +14,29 @@ import net.minecraft.world.World;
|
||||
|
||||
public class BlockCarvableGlowstone extends BlockCarvable {
|
||||
|
||||
public BlockCarvableGlowstone() {
|
||||
super(Material.glass);
|
||||
}
|
||||
public BlockCarvableGlowstone() {
|
||||
super(Material.glass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random random) {
|
||||
return Blocks.glowstone.quantityDropped(random);
|
||||
}
|
||||
@Override
|
||||
public int quantityDropped(Random random) {
|
||||
return Blocks.glowstone.quantityDropped(random);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int i, Random random, int a) {
|
||||
return Items.glowstone_dust;
|
||||
}
|
||||
@Override
|
||||
public Item getItemDropped(int i, Random random, int a) {
|
||||
return Items.glowstone_dust;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int i) {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public int damageDropped(int i) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
|
||||
Block glowstone = world.getBlock(x, y, z);
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
return new ItemStack(Item.getItemFromBlock(glowstone), 1, meta);
|
||||
}
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
|
||||
Block glowstone = world.getBlock(x, y, z);
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
return new ItemStack(Item.getItemFromBlock(glowstone), 1, meta);
|
||||
}
|
||||
}
|
||||
@@ -2,11 +2,6 @@ package team.chisel.block;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
import com.cricketcraft.chisel.api.rendering.ClientUtils;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockIce;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -18,58 +13,63 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
import com.cricketcraft.chisel.api.rendering.ClientUtils;
|
||||
|
||||
public class BlockCarvableIce extends BlockIce implements ICarvable {
|
||||
|
||||
public CarvableHelper carverHelper;
|
||||
public CarvableHelper carverHelper;
|
||||
|
||||
public BlockCarvableIce() {
|
||||
super();
|
||||
carverHelper = new CarvableHelper(this);
|
||||
}
|
||||
public BlockCarvableIce() {
|
||||
super();
|
||||
carverHelper = new CarvableHelper(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return ClientUtils.renderCTMId;
|
||||
}
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return ClientUtils.renderCTMId;
|
||||
}
|
||||
|
||||
@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 void registerBlockIcons(IIconRegister register) {
|
||||
carverHelper.registerBlockIcons("Chisel", this, register);
|
||||
}
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
carverHelper.registerBlockIcons("Chisel", this, register);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tabs, List list) {
|
||||
carverHelper.registerSubBlocks(this, tabs, list);
|
||||
}
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tabs, List list) {
|
||||
carverHelper.registerSubBlocks(this, tabs, list);
|
||||
}
|
||||
|
||||
@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 harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) {
|
||||
super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
|
||||
|
||||
par2EntityPlayer.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(this)], 1);
|
||||
par2EntityPlayer.addExhaustion(0.025F);
|
||||
par2EntityPlayer.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(this)], 1);
|
||||
par2EntityPlayer.addExhaustion(0.025F);
|
||||
|
||||
/*
|
||||
* 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); } }
|
||||
*/
|
||||
}
|
||||
/*
|
||||
* 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 IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
@Override
|
||||
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IVariationInfo getManager(int meta) {
|
||||
return carverHelper.getVariation(meta);
|
||||
}
|
||||
@Override
|
||||
public IVariationInfo getManager(int meta) {
|
||||
return carverHelper.getVariation(meta);
|
||||
}
|
||||
}
|
||||
@@ -2,44 +2,45 @@ package team.chisel.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||
|
||||
import team.chisel.init.ChiselBlocks;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import team.chisel.init.ChiselBlocks;
|
||||
|
||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||
|
||||
public class BlockCarvableIceStairs extends BlockCarvableStairs {
|
||||
|
||||
public BlockCarvableIceStairs(Block block, int meta, CarvableHelper helper) {
|
||||
super(block, meta, helper);
|
||||
public BlockCarvableIceStairs(Block block, int meta, CarvableHelper helper) {
|
||||
super(block, meta, helper);
|
||||
|
||||
slipperiness = 0.98F;
|
||||
setTickRandomly(true);
|
||||
}
|
||||
slipperiness = 0.98F;
|
||||
setTickRandomly(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) {
|
||||
ChiselBlocks.ice.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
|
||||
}
|
||||
@Override
|
||||
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) {
|
||||
ChiselBlocks.ice.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random par1Random) {
|
||||
return ChiselBlocks.ice.quantityDropped(par1Random);
|
||||
}
|
||||
@Override
|
||||
public int quantityDropped(Random par1Random) {
|
||||
return ChiselBlocks.ice.quantityDropped(par1Random);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int i) {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public int damageDropped(int i) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) {
|
||||
ChiselBlocks.ice.updateTick(par1World, par2, par3, par4, par5Random);
|
||||
}
|
||||
@Override
|
||||
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) {
|
||||
ChiselBlocks.ice.updateTick(par1World, par2, par3, par4, par5Random);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMobilityFlag() {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public int getMobilityFlag() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -11,71 +11,70 @@ import net.minecraft.world.World;
|
||||
|
||||
public class BlockCarvableLamp extends BlockCarvable {
|
||||
|
||||
BlockCarvableLamp blockUnpowered;
|
||||
BlockCarvableLamp blockPowered;
|
||||
boolean powered;
|
||||
BlockCarvableLamp blockUnpowered;
|
||||
BlockCarvableLamp blockPowered;
|
||||
boolean powered;
|
||||
|
||||
public BlockCarvableLamp() {
|
||||
super(Material.redstoneLight);
|
||||
public BlockCarvableLamp() {
|
||||
super(Material.redstoneLight);
|
||||
|
||||
powered = false;
|
||||
blockUnpowered = this;
|
||||
blockPowered = new BlockCarvableLamp(this);
|
||||
powered = false;
|
||||
blockUnpowered = this;
|
||||
blockPowered = new BlockCarvableLamp(this);
|
||||
|
||||
setHardness(0.3F);
|
||||
}
|
||||
setHardness(0.3F);
|
||||
}
|
||||
|
||||
public BlockCarvableLamp(BlockCarvableLamp unpoweredVersion) {
|
||||
super(Material.redstoneLight);
|
||||
public BlockCarvableLamp(BlockCarvableLamp unpoweredVersion) {
|
||||
super(Material.redstoneLight);
|
||||
|
||||
carverHelper = unpoweredVersion.carverHelper;
|
||||
carverHelper = unpoweredVersion.carverHelper;
|
||||
|
||||
powered = true;
|
||||
blockUnpowered = unpoweredVersion;
|
||||
blockPowered = this;
|
||||
powered = true;
|
||||
blockUnpowered = unpoweredVersion;
|
||||
blockPowered = this;
|
||||
|
||||
setLightLevel(1.0F);
|
||||
setHardness(0.3F);
|
||||
}
|
||||
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;
|
||||
*
|
||||
* 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 void updateTick(World world, int x, int y, int z, Random rand){ if (world.isRemote) return;
|
||||
* if(powered && !world.isBlockIndirectlyGettingPowered(x, y, z)){ int meta=world.getBlockMetadata(x, y, z);
|
||||
* world.setBlock(x, y, z, Block.redstoneLampIdle.blockID, meta, 2); } }
|
||||
*/
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int par1, Random par2Random, int par3) {
|
||||
return Item.getItemFromBlock(blockUnpowered);
|
||||
}
|
||||
@Override
|
||||
public 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));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,35 +1,36 @@
|
||||
package team.chisel.block;
|
||||
|
||||
import team.chisel.Chisel;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import team.chisel.Chisel;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockCarvableLayered extends BlockCarvable {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon baseTexture;
|
||||
private String baseTexLocation;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon baseTexture;
|
||||
private String baseTexLocation;
|
||||
|
||||
public BlockCarvableLayered(Material mat, String baseTexLocation) {
|
||||
super(mat);
|
||||
this.baseTexLocation = baseTexLocation;
|
||||
}
|
||||
public BlockCarvableLayered(Material mat, String baseTexLocation) {
|
||||
super(mat);
|
||||
this.baseTexLocation = baseTexLocation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
super.registerBlockIcons(register);
|
||||
baseTexture = register.registerIcon(Chisel.MOD_ID + ":" + baseTexLocation);
|
||||
}
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
super.registerBlockIcons(register);
|
||||
baseTexture = register.registerIcon(Chisel.MOD_ID + ":" + baseTexLocation);
|
||||
}
|
||||
|
||||
public IIcon getBaseTex() {
|
||||
return baseTexture;
|
||||
}
|
||||
public IIcon getBaseTex() {
|
||||
return baseTexture;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return Chisel.renderLayeredId;
|
||||
}
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return Chisel.renderLayeredId;
|
||||
}
|
||||
}
|
||||
@@ -3,11 +3,6 @@ package team.chisel.block;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
import com.cricketcraft.chisel.api.rendering.ClientUtils;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -20,64 +15,69 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
import com.cricketcraft.chisel.api.rendering.ClientUtils;
|
||||
|
||||
public class BlockCarvablePackedIce extends Block implements ICarvable {
|
||||
|
||||
public CarvableHelper carverHelper;
|
||||
public CarvableHelper carverHelper;
|
||||
|
||||
public BlockCarvablePackedIce() {
|
||||
super(Material.ice);
|
||||
carverHelper = new CarvableHelper(this);
|
||||
this.slipperiness = Blocks.packed_ice.slipperiness;
|
||||
}
|
||||
public BlockCarvablePackedIce() {
|
||||
super(Material.ice);
|
||||
carverHelper = new CarvableHelper(this);
|
||||
this.slipperiness = Blocks.packed_ice.slipperiness;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return ClientUtils.renderCTMId;
|
||||
}
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return ClientUtils.renderCTMId;
|
||||
}
|
||||
|
||||
@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 int quantityDropped(int meta, int fortune, Random random) {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public int quantityDropped(int meta, int fortune, Random random) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
carverHelper.registerBlockIcons("Chisel", this, register);
|
||||
}
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
carverHelper.registerBlockIcons("Chisel", this, register);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tabs, List list) {
|
||||
carverHelper.registerSubBlocks(this, tabs, list);
|
||||
}
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tabs, List list) {
|
||||
carverHelper.registerSubBlocks(this, tabs, list);
|
||||
}
|
||||
|
||||
@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 harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) {
|
||||
super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
|
||||
|
||||
par2EntityPlayer.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(this)], 1);
|
||||
par2EntityPlayer.addExhaustion(0.025F);
|
||||
par2EntityPlayer.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(this)], 1);
|
||||
par2EntityPlayer.addExhaustion(0.025F);
|
||||
|
||||
/*
|
||||
* 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); } }
|
||||
*/
|
||||
}
|
||||
/*
|
||||
* 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 IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
@Override
|
||||
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IVariationInfo getManager(int meta) {
|
||||
return carverHelper.getVariation(meta);
|
||||
}
|
||||
@Override
|
||||
public IVariationInfo getManager(int meta) {
|
||||
return carverHelper.getVariation(meta);
|
||||
}
|
||||
}
|
||||
@@ -2,44 +2,45 @@ package team.chisel.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||
|
||||
import team.chisel.init.ChiselBlocks;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import team.chisel.init.ChiselBlocks;
|
||||
|
||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||
|
||||
public class BlockCarvablePackedIceStairs extends BlockCarvableStairs {
|
||||
|
||||
public BlockCarvablePackedIceStairs(Block block, int meta, CarvableHelper helper) {
|
||||
super(block, meta, helper);
|
||||
public BlockCarvablePackedIceStairs(Block block, int meta, CarvableHelper helper) {
|
||||
super(block, meta, helper);
|
||||
|
||||
slipperiness = 0.98F;
|
||||
setTickRandomly(true);
|
||||
}
|
||||
slipperiness = 0.98F;
|
||||
setTickRandomly(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) {
|
||||
ChiselBlocks.packedice.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
|
||||
}
|
||||
@Override
|
||||
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) {
|
||||
ChiselBlocks.packedice.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random par1Random) {
|
||||
return ChiselBlocks.packedice.quantityDropped(par1Random);
|
||||
}
|
||||
@Override
|
||||
public int quantityDropped(Random par1Random) {
|
||||
return ChiselBlocks.packedice.quantityDropped(par1Random);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int i) {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public int damageDropped(int i) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) {
|
||||
ChiselBlocks.packedice.updateTick(par1World, par2, par3, par4, par5Random);
|
||||
}
|
||||
@Override
|
||||
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) {
|
||||
ChiselBlocks.packedice.updateTick(par1World, par2, par3, par4, par5Random);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMobilityFlag() {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public int getMobilityFlag() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,6 @@ package team.chisel.block;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
|
||||
import team.chisel.client.render.RendererCTMPane;
|
||||
import com.cricketcraft.chisel.api.ChiselTabs;
|
||||
import net.minecraft.block.BlockPane;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -15,66 +9,74 @@ import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import team.chisel.client.render.RendererCTMPane;
|
||||
|
||||
import com.cricketcraft.chisel.api.ChiselTabs;
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
|
||||
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 CarvableHelper carverHelper;
|
||||
public boolean isAlpha;
|
||||
|
||||
public BlockCarvablePane(Material material, boolean drops) {
|
||||
super("", "", material, drops);
|
||||
public BlockCarvablePane(Material material, boolean drops) {
|
||||
super("", "", material, drops);
|
||||
|
||||
carverHelper = new CarvableHelper(this);
|
||||
carverHelper = new CarvableHelper(this);
|
||||
|
||||
setCreativeTab(ChiselTabs.tabOtherChiselBlocks);
|
||||
}
|
||||
setCreativeTab(ChiselTabs.tabOtherChiselBlocks);
|
||||
}
|
||||
|
||||
public BlockCarvablePane setStained(boolean a) {
|
||||
this.isAlpha = a;
|
||||
return this;
|
||||
}
|
||||
public BlockCarvablePane setStained(boolean a) {
|
||||
this.isAlpha = a;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderBlockPass() {
|
||||
return isAlpha ? 1 : 0;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderBlockPass() {
|
||||
return isAlpha ? 1 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RendererCTMPane.id;
|
||||
}
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RendererCTMPane.id;
|
||||
}
|
||||
|
||||
@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 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);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tabs, List list) {
|
||||
carverHelper.registerSubBlocks(this, tabs, list);
|
||||
}
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tabs, List list) {
|
||||
carverHelper.registerSubBlocks(this, tabs, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
@Override
|
||||
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IVariationInfo getManager(int meta) {
|
||||
return carverHelper.getVariation(meta);
|
||||
}
|
||||
@Override
|
||||
public IVariationInfo getManager(int meta) {
|
||||
return carverHelper.getVariation(meta);
|
||||
}
|
||||
}
|
||||
@@ -5,25 +5,26 @@ import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public class BlockCarvablePowered extends BlockCarvable {
|
||||
|
||||
public BlockCarvablePowered(Material m) {
|
||||
super(m);
|
||||
}
|
||||
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;
|
||||
}
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
/**
|
||||
* 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,11 +1,5 @@
|
||||
package team.chisel.block;
|
||||
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
|
||||
import team.chisel.Chisel;
|
||||
import team.chisel.entity.EntityChiselSnowman;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockPumpkin;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -15,111 +9,132 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import team.chisel.Chisel;
|
||||
import team.chisel.entity.EntityChiselSnowman;
|
||||
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockCarvablePumpkin extends BlockPumpkin implements ICarvable {
|
||||
|
||||
public CarvableHelper carverHelper;
|
||||
public CarvableHelper carverHelper;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon top, face;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon top, face;
|
||||
|
||||
private String faceLocation;
|
||||
private String faceLocation;
|
||||
|
||||
public BlockCarvablePumpkin(boolean isOn) {
|
||||
super(isOn);
|
||||
this.setStepSound(Block.soundTypeWood);
|
||||
if (isOn)
|
||||
setLightLevel(10.0F);
|
||||
carverHelper = new CarvableHelper(this);
|
||||
}
|
||||
public BlockCarvablePumpkin(boolean isOn) {
|
||||
super(isOn);
|
||||
this.setStepSound(Block.soundTypeWood);
|
||||
if (isOn) setLightLevel(10.0F);
|
||||
carverHelper = new CarvableHelper(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, int x, int y, int z) {
|
||||
if (world.getBlock(x, y - 1, z) == Blocks.snow && world.getBlock(x, y - 2, z) == Blocks.snow) {
|
||||
if (!world.isRemote) {
|
||||
// Let's grab the pumpkin before we start
|
||||
ItemStack pumpkin = new ItemStack(world.getBlock(x, y, z), world.getBlockMetadata(x, y, z));
|
||||
@Override
|
||||
public void onBlockAdded(World world, int x, int y, int z) {
|
||||
if (world.getBlock(x, y - 1, z) == Blocks.snow && world.getBlock(x, y - 2, z) == Blocks.snow) {
|
||||
if (!world.isRemote) {
|
||||
// Let's grab the pumpkin before we start
|
||||
ItemStack pumpkin = new ItemStack(world.getBlock(x, y, z), world.getBlockMetadata(x, y, z));
|
||||
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
world.setBlock(x, y - 1, z, Blocks.air, 0, 2);
|
||||
world.setBlock(x, y - 2, z, Blocks.air, 0, 2);
|
||||
EntityChiselSnowman snowman = new EntityChiselSnowman(world);
|
||||
snowman.setCurrentItemOrArmor(2, pumpkin);
|
||||
snowman.setLocationAndAngles(x + 0.5D, y - 1.95D, z + 0.5D, 0.0F, 0.0F);
|
||||
world.spawnEntityInWorld(snowman);
|
||||
world.notifyBlockChange(x, y, z, Blocks.air);
|
||||
world.notifyBlockChange(x, y - 1, z, Blocks.air);
|
||||
world.notifyBlockChange(x, y - 2, z, Blocks.air);
|
||||
}
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
world.setBlock(x, y - 1, z, Blocks.air, 0, 2);
|
||||
world.setBlock(x, y - 2, z, Blocks.air, 0, 2);
|
||||
EntityChiselSnowman snowman = new EntityChiselSnowman(world);
|
||||
snowman.setCurrentItemOrArmor(2, pumpkin);
|
||||
snowman.setLocationAndAngles(x + 0.5D, y - 1.95D, z + 0.5D, 0.0F, 0.0F);
|
||||
world.spawnEntityInWorld(snowman);
|
||||
world.notifyBlockChange(x, y, z, Blocks.air);
|
||||
world.notifyBlockChange(x, y - 1, z, Blocks.air);
|
||||
world.notifyBlockChange(x, y - 2, z, Blocks.air);
|
||||
}
|
||||
|
||||
// Spawn some lovely particles
|
||||
for (int c = 0; c < 120; ++c) {
|
||||
world.spawnParticle("snowshovel", x + world.rand.nextDouble(), y - 2 + world.rand.nextDouble() * 2.5D, z + world.rand.nextDouble(), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
} else if (world.getBlock(x, y - 1, z) == Blocks.iron_block || world.getBlock(x, y - 2, z) == Blocks.iron_block) {
|
||||
boolean flag = world.getBlock(x - 1, y - 1, z) == Blocks.iron_block && world.getBlock(x + 1, y - 1, z) == Blocks.iron_block;
|
||||
boolean flag1 = world.getBlock(x, y - 1, z - 1) == Blocks.iron_block && world.getBlock(x, y - 1, z + 1) == Blocks.iron_block;
|
||||
// Spawn some lovely particles
|
||||
for (int c = 0; c < 120; ++c) {
|
||||
world.spawnParticle(
|
||||
"snowshovel",
|
||||
x + world.rand.nextDouble(),
|
||||
y - 2 + world.rand.nextDouble() * 2.5D,
|
||||
z + world.rand.nextDouble(),
|
||||
0.0D,
|
||||
0.0D,
|
||||
0.0D);
|
||||
}
|
||||
} else
|
||||
if (world.getBlock(x, y - 1, z) == Blocks.iron_block || world.getBlock(x, y - 2, z) == Blocks.iron_block) {
|
||||
boolean flag = world.getBlock(x - 1, y - 1, z) == Blocks.iron_block
|
||||
&& world.getBlock(x + 1, y - 1, z) == Blocks.iron_block;
|
||||
boolean flag1 = world.getBlock(x, y - 1, z - 1) == Blocks.iron_block
|
||||
&& world.getBlock(x, y - 1, z + 1) == Blocks.iron_block;
|
||||
|
||||
if (flag || flag1) {
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
world.setBlock(x, y - 1, z, Blocks.air, 0, 2);
|
||||
world.setBlock(x, y - 2, z, Blocks.air, 0, 2);
|
||||
if (flag || flag1) {
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
world.setBlock(x, y - 1, z, Blocks.air, 0, 2);
|
||||
world.setBlock(x, y - 2, z, Blocks.air, 0, 2);
|
||||
|
||||
if (flag) {
|
||||
world.setBlock(x - 1, y - 1, z, Blocks.air, 0, 2);
|
||||
world.setBlock(x + 1, y - 1, z, Blocks.air, 0, 2);
|
||||
} else {
|
||||
world.setBlock(x, y - 1, z - 1, Blocks.air, 0, 2);
|
||||
world.setBlock(x, y - 1, z + 1, Blocks.air, 0, 2);
|
||||
}
|
||||
if (flag) {
|
||||
world.setBlock(x - 1, y - 1, z, Blocks.air, 0, 2);
|
||||
world.setBlock(x + 1, y - 1, z, Blocks.air, 0, 2);
|
||||
} else {
|
||||
world.setBlock(x, y - 1, z - 1, Blocks.air, 0, 2);
|
||||
world.setBlock(x, y - 1, z + 1, Blocks.air, 0, 2);
|
||||
}
|
||||
|
||||
EntityIronGolem ironGolem = new EntityIronGolem(world);
|
||||
ironGolem.setPlayerCreated(true);
|
||||
ironGolem.setLocationAndAngles(x + 0.5D, y - 1.95D, z + 0.5D, 0.0F, 0.0F);
|
||||
world.spawnEntityInWorld(ironGolem);
|
||||
EntityIronGolem ironGolem = new EntityIronGolem(world);
|
||||
ironGolem.setPlayerCreated(true);
|
||||
ironGolem.setLocationAndAngles(x + 0.5D, y - 1.95D, z + 0.5D, 0.0F, 0.0F);
|
||||
world.spawnEntityInWorld(ironGolem);
|
||||
|
||||
world.notifyBlockChange(x, y, z, Blocks.air);
|
||||
world.notifyBlockChange(x, y - 1, z, Blocks.air);
|
||||
world.notifyBlockChange(x, y - 2, z, Blocks.air);
|
||||
world.notifyBlockChange(x, y, z, Blocks.air);
|
||||
world.notifyBlockChange(x, y - 1, z, Blocks.air);
|
||||
world.notifyBlockChange(x, y - 2, z, Blocks.air);
|
||||
|
||||
if (flag) {
|
||||
world.notifyBlockChange(x - 1, y - 1, z, Blocks.air);
|
||||
world.notifyBlockChange(x + 1, y - 1, z, Blocks.air);
|
||||
} else {
|
||||
world.notifyBlockChange(x, y - 1, z - 1, Blocks.air);
|
||||
world.notifyBlockChange(x, y - 1, z + 1, Blocks.air);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (flag) {
|
||||
world.notifyBlockChange(x - 1, y - 1, z, Blocks.air);
|
||||
world.notifyBlockChange(x + 1, y - 1, z, Blocks.air);
|
||||
} else {
|
||||
world.notifyBlockChange(x, y - 1, z - 1, Blocks.air);
|
||||
world.notifyBlockChange(x, y - 1, z + 1, Blocks.air);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@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
|
||||
@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 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
|
||||
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
|
||||
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
@Override
|
||||
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IVariationInfo getManager(int meta) {
|
||||
return carverHelper.getVariation(meta);
|
||||
}
|
||||
@Override
|
||||
public IVariationInfo getManager(int meta) {
|
||||
return carverHelper.getVariation(meta);
|
||||
}
|
||||
|
||||
public void setInformation(String textureLocation) {
|
||||
this.faceLocation = textureLocation;
|
||||
}
|
||||
public void setInformation(String textureLocation) {
|
||||
this.faceLocation = textureLocation;
|
||||
}
|
||||
}
|
||||
@@ -2,13 +2,6 @@ package team.chisel.block;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
import com.cricketcraft.chisel.api.rendering.ClientUtils;
|
||||
|
||||
import team.chisel.Chisel;
|
||||
import com.cricketcraft.chisel.api.ChiselTabs;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockSand;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -16,158 +9,154 @@ import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import team.chisel.Chisel;
|
||||
|
||||
import com.cricketcraft.chisel.api.ChiselTabs;
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
import com.cricketcraft.chisel.api.rendering.ClientUtils;
|
||||
|
||||
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 CarvableHelper carverHelper;
|
||||
private boolean isAlpha;
|
||||
|
||||
public BlockCarvableSand() {
|
||||
super();
|
||||
carverHelper = new CarvableHelper(this);
|
||||
setCreativeTab(ChiselTabs.tabOtherChiselBlocks);
|
||||
}
|
||||
public BlockCarvableSand() {
|
||||
super();
|
||||
carverHelper = new CarvableHelper(this);
|
||||
setCreativeTab(ChiselTabs.tabOtherChiselBlocks);
|
||||
}
|
||||
|
||||
public BlockCarvableSand setStained(boolean a) {
|
||||
this.isAlpha = a;
|
||||
return this;
|
||||
}
|
||||
public BlockCarvableSand setStained(boolean a) {
|
||||
this.isAlpha = a;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderBlockPass() {
|
||||
return isAlpha ? 1 : 0;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderBlockPass() {
|
||||
return isAlpha ? 1 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
return carverHelper.getIcon(side, metadata);
|
||||
}
|
||||
@Override
|
||||
public IIcon getIcon(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);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tabs, List list) {
|
||||
carverHelper.registerSubBlocks(this, tabs, list);
|
||||
}
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tabs, List list) {
|
||||
carverHelper.registerSubBlocks(this, tabs, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return ClientUtils.renderCTMId;
|
||||
}
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return ClientUtils.renderCTMId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
@Override
|
||||
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IVariationInfo getManager(int meta) {
|
||||
return carverHelper.getVariation(meta);
|
||||
}
|
||||
@Override
|
||||
public IVariationInfo getManager(int meta) {
|
||||
return carverHelper.getVariation(meta);
|
||||
}
|
||||
|
||||
public static class SoundType extends Block.SoundType {
|
||||
public static class SoundType extends Block.SoundType {
|
||||
|
||||
public final String soundNameStep;
|
||||
public final String soundNameBreak;
|
||||
public final String soundNamePlace;
|
||||
public final String soundNameStep;
|
||||
public final String soundNameBreak;
|
||||
public final String soundNamePlace;
|
||||
|
||||
/**
|
||||
* 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 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 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 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 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, 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 getBreakSound() {
|
||||
if (soundNameBreak == null)
|
||||
return Chisel.MOD_ID + ":dig." + this.soundName;
|
||||
else
|
||||
return this.soundNameBreak;
|
||||
}
|
||||
@Override
|
||||
public String getBreakSound() {
|
||||
if (soundNameBreak == null) return Chisel.MOD_ID + ":dig." + this.soundName;
|
||||
else return this.soundNameBreak;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStepResourcePath() {
|
||||
if (soundNameStep == null)
|
||||
return Chisel.MOD_ID + ":step." + this.soundName;
|
||||
else
|
||||
return this.soundNameStep;
|
||||
}
|
||||
@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;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String func_150496_b() {
|
||||
if (soundNamePlace == null) return getBreakSound();
|
||||
else return this.soundNamePlace;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package team.chisel.block;
|
||||
|
||||
import static net.minecraftforge.common.util.ForgeDirection.UP;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
@@ -14,126 +16,121 @@ import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.UP;
|
||||
|
||||
public class BlockCarvableSlab extends BlockCarvable {
|
||||
|
||||
public Block master;
|
||||
public BlockCarvableSlab bottom;
|
||||
public BlockCarvableSlab top;
|
||||
public boolean isBottom;
|
||||
public Block master;
|
||||
public BlockCarvableSlab bottom;
|
||||
public BlockCarvableSlab top;
|
||||
public boolean isBottom;
|
||||
|
||||
public BlockCarvableSlab(BlockCarvable marble) {
|
||||
opaque = true;
|
||||
public BlockCarvableSlab(BlockCarvable marble) {
|
||||
opaque = true;
|
||||
|
||||
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
|
||||
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
|
||||
|
||||
master = marble;
|
||||
bottom = this;
|
||||
top = new BlockCarvableSlab(this);
|
||||
master = marble;
|
||||
bottom = this;
|
||||
top = new BlockCarvableSlab(this);
|
||||
|
||||
isBottom = true;
|
||||
}
|
||||
isBottom = true;
|
||||
}
|
||||
|
||||
public BlockCarvableSlab(BlockCarvableSlab bottomBlock) {
|
||||
super();
|
||||
setBlockBounds(0.0F, 0.5F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
master = bottomBlock.master;
|
||||
bottom = bottomBlock;
|
||||
top = this;
|
||||
public BlockCarvableSlab(BlockCarvableSlab bottomBlock) {
|
||||
super();
|
||||
setBlockBounds(0.0F, 0.5F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
master = bottomBlock.master;
|
||||
bottom = bottomBlock;
|
||||
top = this;
|
||||
|
||||
carverHelper = bottomBlock.carverHelper;
|
||||
isBottom = false;
|
||||
}
|
||||
carverHelper = bottomBlock.carverHelper;
|
||||
isBottom = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block setBlockName(String p_149663_1_) {
|
||||
if (this != top) {
|
||||
top.setBlockName(p_149663_1_);
|
||||
}
|
||||
return super.setBlockName(p_149663_1_);
|
||||
}
|
||||
@Override
|
||||
public Block setBlockName(String p_149663_1_) {
|
||||
if (this != top) {
|
||||
top.setBlockName(p_149663_1_);
|
||||
}
|
||||
return super.setBlockName(p_149663_1_);
|
||||
}
|
||||
|
||||
@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 setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) {
|
||||
if (isBottom) {
|
||||
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
|
||||
} else {
|
||||
setBlockBounds(0.0F, 0.5F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsForItemRender() {
|
||||
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
|
||||
}
|
||||
@Override
|
||||
public void setBlockBoundsForItemRender() {
|
||||
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@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);
|
||||
}
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB,
|
||||
List par6List, Entity par7Entity) {
|
||||
setBlockBoundsBasedOnState(par1World, par2, par3, par4);
|
||||
super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta) {
|
||||
return meta;
|
||||
}
|
||||
@Override
|
||||
public int damageDropped(int meta) {
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int par1, Random par2Random, int par3) {
|
||||
return Item.getItemFromBlock(bottom);
|
||||
}
|
||||
@Override
|
||||
public Item getItemDropped(int par1, Random par2Random, int par3) {
|
||||
return Item.getItemFromBlock(bottom);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ItemStack getPickBlock(MovingObjectPosition mop, World world, int x, int y, int z) {
|
||||
return new ItemStack(bottom, 1, world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ItemStack getPickBlock(MovingObjectPosition mop, World world, int x, int y, int z) {
|
||||
return new ItemStack(bottom, 1, world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
return carverHelper.getIcon(side, metadata);
|
||||
// return master.getIcon(side, metadata);
|
||||
}
|
||||
@Override
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
return carverHelper.getIcon(side, metadata);
|
||||
// return master.getIcon(side, metadata);
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public void getSubBlocks(Item block, CreativeTabs tabs, List list) {
|
||||
if (isBottom)
|
||||
super.getSubBlocks(block, tabs, list);
|
||||
}
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public void getSubBlocks(Item block, CreativeTabs tabs, List list) {
|
||||
if (isBottom) super.getSubBlocks(block, tabs, list);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the block is a solid face on the given side, used by placement logic.
|
||||
*
|
||||
* @param world
|
||||
* The current world
|
||||
* @param x
|
||||
* X Position
|
||||
* @param y
|
||||
* Y position
|
||||
* @param z
|
||||
* Z position
|
||||
* @param side
|
||||
* The side to check
|
||||
* @return True if the block is solid on the specified side.
|
||||
*/
|
||||
@Override
|
||||
public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||
return !isBottom && (side == UP);
|
||||
}
|
||||
/**
|
||||
* Checks if the block is a solid face on the given side, used by placement logic.
|
||||
*
|
||||
* @param world The current world
|
||||
* @param x X Position
|
||||
* @param y Y position
|
||||
* @param z Z position
|
||||
* @param side The side to check
|
||||
* @return True if the block is solid on the specified side.
|
||||
*/
|
||||
@Override
|
||||
public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||
return !isBottom && (side == UP);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,11 +2,6 @@ package team.chisel.block;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
|
||||
import team.chisel.client.render.RendererStairs;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockStairs;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -19,75 +14,81 @@ import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import team.chisel.client.render.RendererStairs;
|
||||
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
|
||||
public class BlockCarvableStairs extends BlockStairs implements ICarvable {
|
||||
|
||||
CarvableHelper carverHelper;
|
||||
int blockMeta;
|
||||
CarvableHelper carverHelper;
|
||||
int blockMeta;
|
||||
|
||||
public BlockCarvableStairs(Block block, int meta, CarvableHelper helper) {
|
||||
super(block, meta);
|
||||
public BlockCarvableStairs(Block block, int meta, CarvableHelper helper) {
|
||||
super(block, meta);
|
||||
|
||||
this.useNeighborBrightness = true;
|
||||
carverHelper = helper;
|
||||
blockMeta = meta;
|
||||
}
|
||||
this.useNeighborBrightness = true;
|
||||
carverHelper = helper;
|
||||
blockMeta = meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
return carverHelper.getIcon(side, blockMeta + metadata / 8);
|
||||
}
|
||||
@Override
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
return carverHelper.getIcon(side, blockMeta + metadata / 8);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int i) {
|
||||
return i / 8;
|
||||
}
|
||||
@Override
|
||||
public int damageDropped(int i) {
|
||||
return i / 8;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
if (blockMeta == 0)
|
||||
carverHelper.registerBlockIcons("Chisel", this, register);
|
||||
}
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
if (blockMeta == 0) carverHelper.registerBlockIcons("Chisel", this, register);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
public void getSubBlocks(Item block, CreativeTabs tabs, List list) {
|
||||
list.add(new ItemStack(block, 1, 0));
|
||||
list.add(new ItemStack(block, 1, 8));
|
||||
}
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
public void getSubBlocks(Item block, CreativeTabs tabs, List list) {
|
||||
list.add(new ItemStack(block, 1, 0));
|
||||
list.add(new ItemStack(block, 1, 8));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RendererStairs.id;
|
||||
}
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RendererStairs.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLiving, ItemStack par6ItemStack) {
|
||||
int meta = MathHelper.floor_double((par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
@Override
|
||||
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLiving,
|
||||
ItemStack par6ItemStack) {
|
||||
int meta = MathHelper.floor_double((par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
|
||||
// 0->2 2->3 3->0 1->1
|
||||
meta = meta == 0 ? 2 : meta == 2 ? 3 : meta == 3 ? 0 : 1;
|
||||
// 0->2 2->3 3->0 1->1
|
||||
meta = meta == 0 ? 2 : meta == 2 ? 3 : meta == 3 ? 0 : 1;
|
||||
|
||||
meta += par1World.getBlockMetadata(par2, par3, par4) % 8; // add upside-down-ness
|
||||
meta += par1World.getBlockMetadata(par2, par3, par4) % 8; // add upside-down-ness
|
||||
|
||||
if (par6ItemStack.getItemDamage() >= 8) {
|
||||
meta += 8;
|
||||
}
|
||||
if (par6ItemStack.getItemDamage() >= 8) {
|
||||
meta += 8;
|
||||
}
|
||||
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, meta, 2);
|
||||
}
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, meta, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onBlockPlaced(World world, int x, int y, int z, int side, float hx, float hy, float hz, int damage) {
|
||||
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) {
|
||||
return side != 0 && (side == 1 || hy <= 0.5D) ? damage : damage + 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(blockMeta + (metadata / 8));
|
||||
}
|
||||
@Override
|
||||
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(blockMeta + (metadata / 8));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IVariationInfo getManager(int meta) {
|
||||
return carverHelper.getVariation(blockMeta + (meta / 8));
|
||||
}
|
||||
@Override
|
||||
public IVariationInfo getManager(int meta) {
|
||||
return carverHelper.getVariation(blockMeta + (meta / 8));
|
||||
}
|
||||
}
|
||||
@@ -2,83 +2,86 @@ package team.chisel.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
|
||||
import team.chisel.Chisel;
|
||||
import com.cricketcraft.chisel.api.ChiselTabs;
|
||||
import net.minecraft.block.BlockTorch;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import team.chisel.Chisel;
|
||||
|
||||
import com.cricketcraft.chisel.api.ChiselTabs;
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockCarvableTorch extends BlockTorch implements ICarvable {
|
||||
|
||||
public CarvableHelper carverHelper;
|
||||
private String texLocation;
|
||||
protected boolean emitsParticles = true;
|
||||
public int idx;
|
||||
public CarvableHelper carverHelper;
|
||||
private String texLocation;
|
||||
protected boolean emitsParticles = true;
|
||||
public int idx;
|
||||
|
||||
public BlockCarvableTorch(int idx, String tex) {
|
||||
super();
|
||||
carverHelper = new CarvableHelper(this);
|
||||
setCreativeTab(ChiselTabs.tabOtherChiselBlocks);
|
||||
setLightLevel(0.9375F);
|
||||
setBlockName("torch");
|
||||
this.idx = idx;
|
||||
this.texLocation = tex;
|
||||
}
|
||||
public BlockCarvableTorch(int idx, String tex) {
|
||||
super();
|
||||
carverHelper = new CarvableHelper(this);
|
||||
setCreativeTab(ChiselTabs.tabOtherChiselBlocks);
|
||||
setLightLevel(0.9375F);
|
||||
setBlockName("torch");
|
||||
this.idx = idx;
|
||||
this.texLocation = tex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
@Override
|
||||
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IVariationInfo getManager(int meta) {
|
||||
return carverHelper.getVariation(meta);
|
||||
}
|
||||
@Override
|
||||
public IVariationInfo getManager(int meta) {
|
||||
return carverHelper.getVariation(meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister icon) {
|
||||
this.blockIcon = icon.registerIcon(Chisel.MOD_ID + ":torch/" + texLocation);
|
||||
}
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister icon) {
|
||||
this.blockIcon = icon.registerIcon(Chisel.MOD_ID + ":torch/" + texLocation);
|
||||
}
|
||||
|
||||
public BlockCarvableTorch disableParticles() {
|
||||
this.emitsParticles = false;
|
||||
return this;
|
||||
}
|
||||
public BlockCarvableTorch disableParticles() {
|
||||
this.emitsParticles = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World p_149734_1_, int p_149734_2_, int p_149734_3_, int p_149734_4_, Random p_149734_5_) {
|
||||
if (emitsParticles) {
|
||||
int l = p_149734_1_.getBlockMetadata(p_149734_2_, p_149734_3_, p_149734_4_);
|
||||
double d0 = p_149734_2_ + 0.5F;
|
||||
double d1 = p_149734_3_ + 0.7F;
|
||||
double d2 = p_149734_4_ + 0.5F;
|
||||
double d3 = 0.2199999988079071D;
|
||||
double d4 = 0.27000001072883606D;
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World p_149734_1_, int p_149734_2_, int p_149734_3_, int p_149734_4_,
|
||||
Random p_149734_5_) {
|
||||
if (emitsParticles) {
|
||||
int l = p_149734_1_.getBlockMetadata(p_149734_2_, p_149734_3_, p_149734_4_);
|
||||
double d0 = p_149734_2_ + 0.5F;
|
||||
double d1 = p_149734_3_ + 0.7F;
|
||||
double d2 = p_149734_4_ + 0.5F;
|
||||
double d3 = 0.2199999988079071D;
|
||||
double d4 = 0.27000001072883606D;
|
||||
|
||||
if (l == 1) {
|
||||
p_149734_1_.spawnParticle("smoke", d0 - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
|
||||
p_149734_1_.spawnParticle("flame", d0 - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
|
||||
} else if (l == 2) {
|
||||
p_149734_1_.spawnParticle("smoke", d0 + d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
|
||||
p_149734_1_.spawnParticle("flame", d0 + d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
|
||||
} else if (l == 3) {
|
||||
p_149734_1_.spawnParticle("smoke", d0, d1 + d3, d2 - d4, 0.0D, 0.0D, 0.0D);
|
||||
p_149734_1_.spawnParticle("flame", d0, d1 + d3, d2 - d4, 0.0D, 0.0D, 0.0D);
|
||||
} else if (l == 4) {
|
||||
p_149734_1_.spawnParticle("smoke", d0, d1 + d3, d2 + d4, 0.0D, 0.0D, 0.0D);
|
||||
p_149734_1_.spawnParticle("flame", d0, d1 + d3, d2 + d4, 0.0D, 0.0D, 0.0D);
|
||||
} else {
|
||||
p_149734_1_.spawnParticle("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
||||
p_149734_1_.spawnParticle("flame", d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (l == 1) {
|
||||
p_149734_1_.spawnParticle("smoke", d0 - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
|
||||
p_149734_1_.spawnParticle("flame", d0 - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
|
||||
} else if (l == 2) {
|
||||
p_149734_1_.spawnParticle("smoke", d0 + d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
|
||||
p_149734_1_.spawnParticle("flame", d0 + d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
|
||||
} else if (l == 3) {
|
||||
p_149734_1_.spawnParticle("smoke", d0, d1 + d3, d2 - d4, 0.0D, 0.0D, 0.0D);
|
||||
p_149734_1_.spawnParticle("flame", d0, d1 + d3, d2 - d4, 0.0D, 0.0D, 0.0D);
|
||||
} else if (l == 4) {
|
||||
p_149734_1_.spawnParticle("smoke", d0, d1 + d3, d2 + d4, 0.0D, 0.0D, 0.0D);
|
||||
p_149734_1_.spawnParticle("flame", d0, d1 + d3, d2 + d4, 0.0D, 0.0D, 0.0D);
|
||||
} else {
|
||||
p_149734_1_.spawnParticle("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
||||
p_149734_1_.spawnParticle("flame", d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,6 @@ package team.chisel.block;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockWall;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -11,34 +9,36 @@ import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||
|
||||
public class BlockCarvableWall extends BlockWall {
|
||||
|
||||
CarvableHelper carverHelper;
|
||||
CarvableHelper carverHelper;
|
||||
|
||||
public BlockCarvableWall(Block block) {
|
||||
super(block);
|
||||
public BlockCarvableWall(Block block) {
|
||||
super(block);
|
||||
|
||||
carverHelper = new CarvableHelper(this);
|
||||
}
|
||||
carverHelper = new CarvableHelper(this);
|
||||
}
|
||||
|
||||
@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 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);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
public void getSubBlocks(Item block, CreativeTabs tabs, List list) {
|
||||
carverHelper.registerSubBlocks(this, tabs, list);
|
||||
}
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
public void getSubBlocks(Item block, CreativeTabs tabs, List list) {
|
||||
carverHelper.registerSubBlocks(this, tabs, list);
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@ package team.chisel.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import team.chisel.config.Configurations;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -10,65 +9,67 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import team.chisel.config.Configurations;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
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
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
|
||||
Block block = world.getBlock(x, y, z);
|
||||
if (block == this) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
|
||||
Block block = world.getBlock(x, y, z);
|
||||
if (block == this) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return super.shouldSideBeRendered(world, x, y, z, side);
|
||||
}
|
||||
return super.shouldSideBeRendered(world, x, y, z, side);
|
||||
}
|
||||
|
||||
@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 AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k) {
|
||||
return AxisAlignedBB.getBoundingBox(i + 0.2, j, k + 0.2, i + 0.8, j + 0.2, k + 0.8);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int par1, Random rand, int par3) {
|
||||
return Item.getItemFromBlock(this);
|
||||
}
|
||||
@Override
|
||||
public 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 quantityDropped(Random rand) {
|
||||
return rand.nextInt(2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta) {
|
||||
return meta;
|
||||
}
|
||||
@Override
|
||||
public int damageDropped(int meta) {
|
||||
return meta;
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovementInput;
|
||||
import net.minecraft.util.MovementInputFromOptions;
|
||||
|
||||
import team.chisel.config.Configurations;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
@@ -16,30 +17,35 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockConcrete extends BlockCarvable {
|
||||
|
||||
public BlockConcrete() {
|
||||
super();
|
||||
FMLCommonHandler.instance().bus().register(this);
|
||||
}
|
||||
public BlockConcrete() {
|
||||
super();
|
||||
FMLCommonHandler.instance().bus().register(this);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static MovementInput manualInputCheck;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static MovementInput manualInputCheck;
|
||||
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void speedupPlayer(PlayerTickEvent event) {
|
||||
if (event.phase == Phase.START && event.side.isClient() && event.player.onGround && event.player instanceof EntityPlayerSP) {
|
||||
if (manualInputCheck == null) {
|
||||
manualInputCheck = new MovementInputFromOptions(Minecraft.getMinecraft().gameSettings);
|
||||
}
|
||||
EntityPlayerSP player = (EntityPlayerSP) event.player;
|
||||
Block below = player.worldObj.getBlock(MathHelper.floor_double(player.posX), MathHelper.floor_double(player.posY) - 2, MathHelper.floor_double(player.posZ));
|
||||
if (below == this) {
|
||||
manualInputCheck.updatePlayerMoveState();
|
||||
if (manualInputCheck.moveForward != 0 || manualInputCheck.moveStrafe != 0) {
|
||||
player.motionX *= Configurations.concreteVelocityMult + 0.05;
|
||||
player.motionZ *= Configurations.concreteVelocityMult + 0.05;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void speedupPlayer(PlayerTickEvent event) {
|
||||
if (event.phase == Phase.START && event.side.isClient()
|
||||
&& event.player.onGround
|
||||
&& event.player instanceof EntityPlayerSP) {
|
||||
if (manualInputCheck == null) {
|
||||
manualInputCheck = new MovementInputFromOptions(Minecraft.getMinecraft().gameSettings);
|
||||
}
|
||||
EntityPlayerSP player = (EntityPlayerSP) event.player;
|
||||
Block below = player.worldObj.getBlock(
|
||||
MathHelper.floor_double(player.posX),
|
||||
MathHelper.floor_double(player.posY) - 2,
|
||||
MathHelper.floor_double(player.posZ));
|
||||
if (below == this) {
|
||||
manualInputCheck.updatePlayerMoveState();
|
||||
if (manualInputCheck.moveForward != 0 || manualInputCheck.moveStrafe != 0) {
|
||||
player.motionX *= Configurations.concreteVelocityMult + 0.05;
|
||||
player.motionZ *= Configurations.concreteVelocityMult + 0.05;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,13 +4,13 @@ import team.chisel.Chisel;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,33 +2,33 @@ package team.chisel.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import team.chisel.Chisel;
|
||||
import team.chisel.client.GeneralChiselClient;
|
||||
import team.chisel.utils.General;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import team.chisel.Chisel;
|
||||
import team.chisel.client.GeneralChiselClient;
|
||||
import team.chisel.utils.General;
|
||||
|
||||
public class BlockGrimstone extends BlockCarvable {
|
||||
|
||||
public IIcon iconStar;
|
||||
public IIcon iconStar;
|
||||
|
||||
public BlockGrimstone(Material m) {
|
||||
super(m);
|
||||
}
|
||||
public BlockGrimstone(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.spawnGrimstoneFX(world, this, x, y, z);
|
||||
}
|
||||
@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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
super.registerBlockIcons(register);
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
super.registerBlockIcons(register);
|
||||
|
||||
iconStar = register.registerIcon(Chisel.MOD_ID + ":grimstone/particles/star");
|
||||
}
|
||||
iconStar = register.registerIcon(Chisel.MOD_ID + ":grimstone/particles/star");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,34 +2,34 @@ package team.chisel.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import team.chisel.client.GeneralChiselClient;
|
||||
import team.chisel.utils.General;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import team.chisel.client.GeneralChiselClient;
|
||||
import team.chisel.utils.General;
|
||||
|
||||
public class BlockHolystone extends BlockCarvable {
|
||||
|
||||
public IIcon iconStar;
|
||||
public IIcon iconStar;
|
||||
|
||||
public BlockHolystone(Material m) {
|
||||
super(m);
|
||||
public BlockHolystone(Material m) {
|
||||
super(m);
|
||||
|
||||
this.setLightLevel(0.25F);
|
||||
}
|
||||
this.setLightLevel(0.25F);
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
@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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
super.registerBlockIcons(register);
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
super.registerBlockIcons(register);
|
||||
|
||||
iconStar = register.registerIcon("Chisel:holystone/particles/star");
|
||||
}
|
||||
iconStar = register.registerIcon("Chisel:holystone/particles/star");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,26 +2,26 @@ package team.chisel.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import team.chisel.client.GeneralChiselClient;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import team.chisel.client.GeneralChiselClient;
|
||||
|
||||
public class BlockLavastone extends BlockMultiLayer {
|
||||
|
||||
public BlockLavastone(Material mat, String baseIcon) {
|
||||
super(mat, baseIcon);
|
||||
setLightLevel(1F);
|
||||
}
|
||||
public BlockLavastone(Material mat, String baseIcon) {
|
||||
super(mat, baseIcon);
|
||||
setLightLevel(1F);
|
||||
}
|
||||
|
||||
@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 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;
|
||||
}
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,12 +5,12 @@ import net.minecraft.init.Blocks;
|
||||
|
||||
public class BlockLeaf extends BlockCarvable {
|
||||
|
||||
public BlockLeaf(Material material) {
|
||||
super(material);
|
||||
}
|
||||
public BlockLeaf(Material material) {
|
||||
super(material);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return Blocks.leaves.isOpaqueCube();
|
||||
}
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return Blocks.leaves.isOpaqueCube();
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,6 @@ package team.chisel.block;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -14,52 +10,56 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
|
||||
public class BlockMultiLayer extends BlockMultiLayerBase implements ICarvable {
|
||||
|
||||
public CarvableHelper carverHelper;
|
||||
public CarvableHelper carverHelper;
|
||||
|
||||
public BlockMultiLayer(Material mat, String baseIcon) {
|
||||
super(mat, baseIcon);
|
||||
public BlockMultiLayer(Material mat, String baseIcon) {
|
||||
super(mat, baseIcon);
|
||||
|
||||
carverHelper = new CarvableHelper(this);
|
||||
}
|
||||
carverHelper = new CarvableHelper(this);
|
||||
}
|
||||
|
||||
public BlockMultiLayer(Material mat, Block block) {
|
||||
super(mat, block);
|
||||
public BlockMultiLayer(Material mat, Block block) {
|
||||
super(mat, block);
|
||||
|
||||
carverHelper = new CarvableHelper(this);
|
||||
}
|
||||
carverHelper = new CarvableHelper(this);
|
||||
}
|
||||
|
||||
@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 int damageDropped(int i) {
|
||||
return i;
|
||||
}
|
||||
@Override
|
||||
public int damageDropped(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
super.registerBlockIcons(register);
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
super.registerBlockIcons(register);
|
||||
|
||||
carverHelper.registerBlockIcons("Chisel", this, register);
|
||||
}
|
||||
carverHelper.registerBlockIcons("Chisel", this, register);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
public void getSubBlocks(Item block, CreativeTabs tabs, List list) {
|
||||
carverHelper.registerSubBlocks(this, tabs, list);
|
||||
}
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
public void getSubBlocks(Item block, CreativeTabs tabs, List list) {
|
||||
carverHelper.registerSubBlocks(this, tabs, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
@Override
|
||||
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IVariationInfo getManager(int meta) {
|
||||
return carverHelper.getVariation(meta);
|
||||
}
|
||||
@Override
|
||||
public IVariationInfo getManager(int meta) {
|
||||
return carverHelper.getVariation(meta);
|
||||
}
|
||||
}
|
||||
@@ -1,55 +1,55 @@
|
||||
package team.chisel.block;
|
||||
|
||||
import team.chisel.client.render.RendererMultiLayer;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
|
||||
import team.chisel.client.render.RendererMultiLayer;
|
||||
|
||||
public abstract class BlockMultiLayerBase extends Block {
|
||||
|
||||
public Block base;
|
||||
public IIcon icon;
|
||||
String iconFile;
|
||||
public Block base;
|
||||
public IIcon icon;
|
||||
String iconFile;
|
||||
|
||||
public BlockMultiLayerBase(Material mat, Block base) {
|
||||
super(mat);
|
||||
public BlockMultiLayerBase(Material mat, Block base) {
|
||||
super(mat);
|
||||
|
||||
this.base = base;
|
||||
}
|
||||
this.base = base;
|
||||
}
|
||||
|
||||
public BlockMultiLayerBase(Material mat, String iconFile) {
|
||||
super(mat);
|
||||
public BlockMultiLayerBase(Material mat, String iconFile) {
|
||||
super(mat);
|
||||
|
||||
this.iconFile = iconFile;
|
||||
}
|
||||
this.iconFile = iconFile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RendererMultiLayer.id;
|
||||
}
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RendererMultiLayer.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderBlockPass() {
|
||||
return 1;
|
||||
}
|
||||
@Override
|
||||
public int getRenderBlockPass() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRenderInPass(int pass) {
|
||||
ForgeHooksClient.setRenderPass(pass);
|
||||
return pass == 1 || pass == 0;
|
||||
}
|
||||
@Override
|
||||
public boolean canRenderInPass(int pass) {
|
||||
ForgeHooksClient.setRenderPass(pass);
|
||||
return pass == 1 || pass == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
if (iconFile != null)
|
||||
icon = register.registerIcon(iconFile);
|
||||
}
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
if (iconFile != null) icon = register.registerIcon(iconFile);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,12 +2,6 @@ package team.chisel.block;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
|
||||
import team.chisel.Chisel;
|
||||
import team.chisel.block.tileentity.TileEntityPresent;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -24,206 +18,226 @@ import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import team.chisel.Chisel;
|
||||
import team.chisel.block.tileentity.TileEntityPresent;
|
||||
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockPresent extends Block implements ICarvable {
|
||||
|
||||
public CarvableHelper carverHelper;
|
||||
public CarvableHelper carverHelper;
|
||||
|
||||
private float minX, minY, minZ, maxX, maxY, maxZ;
|
||||
private float minX, minY, minZ, maxX, maxY, maxZ;
|
||||
|
||||
public BlockPresent() {
|
||||
super(Material.wood);
|
||||
carverHelper = new CarvableHelper(this);
|
||||
minX = 0.0625F;
|
||||
minZ = 0.0625F;
|
||||
maxX = 0.9375F;
|
||||
maxY = 0.875F;
|
||||
maxZ = 0.9375F;
|
||||
setBlockBounds(minX, minY, minZ, maxX, maxY, maxZ);
|
||||
}
|
||||
public BlockPresent() {
|
||||
super(Material.wood);
|
||||
carverHelper = new CarvableHelper(this);
|
||||
minX = 0.0625F;
|
||||
minZ = 0.0625F;
|
||||
maxX = 0.9375F;
|
||||
maxY = 0.875F;
|
||||
maxZ = 0.9375F;
|
||||
setBlockBounds(minX, minY, minZ, maxX, maxY, maxZ);
|
||||
}
|
||||
|
||||
public String getModelTexture(int type) {
|
||||
return "textures/blocks/present/presentChest" + type;
|
||||
}
|
||||
public String getModelTexture(int type) {
|
||||
return "textures/blocks/present/presentChest" + type;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||
for (int i = 0; i < 16; i++) {
|
||||
list.add(new ItemStack(item, 1, i));
|
||||
}
|
||||
}
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||
for (int i = 0; i < 16; i++) {
|
||||
list.add(new ItemStack(item, 1, i));
|
||||
}
|
||||
}
|
||||
|
||||
@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 int getRenderType() {
|
||||
return -1;
|
||||
}
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {
|
||||
super.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
int heading = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||
TileEntityPresent te = (TileEntityPresent) world.getTileEntity(x, y, z);
|
||||
world.setBlockMetadataWithNotify(x, y, z, stack.getItemDamage(), 3);
|
||||
te.setRotation(heading);
|
||||
te.findConnections();
|
||||
if (te.isConnected()) {
|
||||
TileEntityPresent other = te.getConnection();
|
||||
other.setRotation(heading);
|
||||
}
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
}
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {
|
||||
super.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
int heading = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||
TileEntityPresent te = (TileEntityPresent) world.getTileEntity(x, y, z);
|
||||
world.setBlockMetadataWithNotify(x, y, z, stack.getItemDamage(), 3);
|
||||
te.setRotation(heading);
|
||||
te.findConnections();
|
||||
if (te.isConnected()) {
|
||||
TileEntityPresent other = te.getConnection();
|
||||
other.setRotation(heading);
|
||||
}
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block present, int meta) {
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block present, int meta) {
|
||||
|
||||
TileEntityPresent tileEntityPresent = (TileEntityPresent) world.getTileEntity(x, y, z);
|
||||
TileEntityPresent tileEntityPresent = (TileEntityPresent) world.getTileEntity(x, y, z);
|
||||
|
||||
if (tileEntityPresent != null) {
|
||||
for (int c = 0; c < tileEntityPresent.getTrueSizeInventory(); c++) {
|
||||
ItemStack itemStack = tileEntityPresent.getTrueStackInSlot(c);
|
||||
if (tileEntityPresent != null) {
|
||||
for (int c = 0; c < tileEntityPresent.getTrueSizeInventory(); c++) {
|
||||
ItemStack itemStack = tileEntityPresent.getTrueStackInSlot(c);
|
||||
|
||||
if (itemStack != null) {
|
||||
dropBlockAsItem(world, x, y, z, itemStack);
|
||||
}
|
||||
}
|
||||
if (itemStack != null) {
|
||||
dropBlockAsItem(world, x, y, z, itemStack);
|
||||
}
|
||||
}
|
||||
|
||||
world.func_147453_f(x, y, z, this);
|
||||
}
|
||||
world.func_147453_f(x, y, z, this);
|
||||
}
|
||||
|
||||
super.breakBlock(world, x, y, z, this, meta);
|
||||
}
|
||||
super.breakBlock(world, x, y, z, this, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int hitX, float hitY, float hitZ, float p_149727_9_) {
|
||||
if (!world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN)) {
|
||||
if (!world.isRemote) {
|
||||
player.openGui(Chisel.instance, 2, world, x, y, z);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int hitX, float hitY,
|
||||
float hitZ, float p_149727_9_) {
|
||||
if (!world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN)) {
|
||||
if (!world.isRemote) {
|
||||
player.openGui(Chisel.instance, 2, world, x, y, z);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
if (world.getTileEntity(x, y, z) instanceof TileEntityPresent)
|
||||
return getBoundingBox((TileEntityPresent) world.getTileEntity(x, y, z));
|
||||
else
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
if (world.getTileEntity(x, y, z) instanceof TileEntityPresent)
|
||||
return getBoundingBox((TileEntityPresent) world.getTileEntity(x, y, z));
|
||||
else return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
if (world.getTileEntity(x, y, z) instanceof TileEntityPresent)
|
||||
return getBoundingBox((TileEntityPresent) world.getTileEntity(x, y, z));
|
||||
else
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
if (world.getTileEntity(x, y, z) instanceof TileEntityPresent)
|
||||
return getBoundingBox((TileEntityPresent) world.getTileEntity(x, y, z));
|
||||
else return null;
|
||||
}
|
||||
|
||||
public AxisAlignedBB getBoundingBox(TileEntityPresent me) {
|
||||
if (me == null) {
|
||||
return AxisAlignedBB.getBoundingBox(minX, minY, minZ, maxX, maxY, maxZ);
|
||||
}
|
||||
int x = me.xCoord, y = me.yCoord, z = me.zCoord;
|
||||
if (me.isConnected()) {
|
||||
ForgeDirection dir = me.getConnectionDir();
|
||||
// warning: magic below! Do not change this conditional
|
||||
if (dir == ForgeDirection.EAST || (me.isParent() && dir == ForgeDirection.SOUTH) || (!me.isParent() && dir == ForgeDirection.SOUTH)) {
|
||||
return AxisAlignedBB.getBoundingBox(x + minX, y + minY, z + minZ, x + maxX + dir.offsetX, y + maxY, z + maxZ + dir.offsetZ);
|
||||
} else {
|
||||
return AxisAlignedBB.getBoundingBox(x + dir.offsetX + minX, y + minY, z + dir.offsetZ + minZ, x + maxX, y + maxY, z + maxZ);
|
||||
}
|
||||
}
|
||||
return AxisAlignedBB.getBoundingBox(x + minX, y + minY, z + minZ, x + maxX, y + maxY, z + maxZ);
|
||||
}
|
||||
public AxisAlignedBB getBoundingBox(TileEntityPresent me) {
|
||||
if (me == null) {
|
||||
return AxisAlignedBB.getBoundingBox(minX, minY, minZ, maxX, maxY, maxZ);
|
||||
}
|
||||
int x = me.xCoord, y = me.yCoord, z = me.zCoord;
|
||||
if (me.isConnected()) {
|
||||
ForgeDirection dir = me.getConnectionDir();
|
||||
// warning: magic below! Do not change this conditional
|
||||
if (dir == ForgeDirection.EAST || (me.isParent() && dir == ForgeDirection.SOUTH)
|
||||
|| (!me.isParent() && dir == ForgeDirection.SOUTH)) {
|
||||
return AxisAlignedBB.getBoundingBox(
|
||||
x + minX,
|
||||
y + minY,
|
||||
z + minZ,
|
||||
x + maxX + dir.offsetX,
|
||||
y + maxY,
|
||||
z + maxZ + dir.offsetZ);
|
||||
} else {
|
||||
return AxisAlignedBB.getBoundingBox(
|
||||
x + dir.offsetX + minX,
|
||||
y + minY,
|
||||
z + dir.offsetZ + minZ,
|
||||
x + maxX,
|
||||
y + maxY,
|
||||
z + maxZ);
|
||||
}
|
||||
}
|
||||
return AxisAlignedBB.getBoundingBox(x + minX, y + minY, z + minZ, x + maxX, y + maxY, z + maxZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
||||
TileEntityPresent te = (TileEntityPresent) world.getTileEntity(x, y, z);
|
||||
if (!te.isConnected()) {
|
||||
setBlockBounds(0.0625F, 0, 0.0625F, 0.9375F, 0.875F, 0.9365F);
|
||||
} else {
|
||||
ForgeDirection dir = te.getConnectionDir();
|
||||
switch (dir) {
|
||||
case EAST:
|
||||
setBlockBounds(0.0625F, 0, 0.0625F, 1, 0.875F, 0.9365F);
|
||||
break;
|
||||
case NORTH:
|
||||
setBlockBounds(0.0625F, 0, 0, 0.9375F, 0.875F, 0.9365F);
|
||||
break;
|
||||
case SOUTH:
|
||||
setBlockBounds(0.0625F, 0, 0.0625F, 0.9375F, 0.875F, 1);
|
||||
break;
|
||||
case WEST:
|
||||
setBlockBounds(0, 0, 0.0625F, 0.9375F, 0.875F, 0.9365F);
|
||||
break;
|
||||
default:
|
||||
setBlockBounds(0.0625F, 0, 0.0625F, 0.9375F, 0.875F, 0.9365F);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
||||
TileEntityPresent te = (TileEntityPresent) world.getTileEntity(x, y, z);
|
||||
if (!te.isConnected()) {
|
||||
setBlockBounds(0.0625F, 0, 0.0625F, 0.9375F, 0.875F, 0.9365F);
|
||||
} else {
|
||||
ForgeDirection dir = te.getConnectionDir();
|
||||
switch (dir) {
|
||||
case EAST:
|
||||
setBlockBounds(0.0625F, 0, 0.0625F, 1, 0.875F, 0.9365F);
|
||||
break;
|
||||
case NORTH:
|
||||
setBlockBounds(0.0625F, 0, 0, 0.9375F, 0.875F, 0.9365F);
|
||||
break;
|
||||
case SOUTH:
|
||||
setBlockBounds(0.0625F, 0, 0.0625F, 0.9375F, 0.875F, 1);
|
||||
break;
|
||||
case WEST:
|
||||
setBlockBounds(0, 0, 0.0625F, 0.9375F, 0.875F, 0.9365F);
|
||||
break;
|
||||
default:
|
||||
setBlockBounds(0.0625F, 0, 0.0625F, 0.9375F, 0.875F, 0.9365F);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(int metadata) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean hasTileEntity(int metadata) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, int metadata) {
|
||||
return new TileEntityPresent();
|
||||
}
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, int metadata) {
|
||||
return new TileEntityPresent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasComparatorInputOverride() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean hasComparatorInputOverride() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(World world, int x, int y, int z, int strength) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if (te instanceof TileEntityPresent) {
|
||||
return Container.calcRedstoneFromInventory((TileEntityPresent) te);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public int getComparatorInputOverride(World world, int x, int y, int z, int strength) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if (te instanceof TileEntityPresent) {
|
||||
return Container.calcRedstoneFromInventory((TileEntityPresent) te);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta) {
|
||||
return meta;
|
||||
}
|
||||
@Override
|
||||
public int damageDropped(int meta) {
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
|
||||
return new ItemStack(this, 1, world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
|
||||
return new ItemStack(this, 1, world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
this.blockIcon = register.registerIcon("planks_oak");
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
this.blockIcon = register.registerIcon("planks_oak");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
@Override
|
||||
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IVariationInfo getManager(int meta) {
|
||||
return carverHelper.getVariation(meta);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public IVariationInfo getManager(int meta) {
|
||||
return carverHelper.getVariation(meta);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package team.chisel.block;
|
||||
|
||||
import team.chisel.Chisel;
|
||||
import team.chisel.config.Configurations;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -10,83 +8,86 @@ import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import team.chisel.Chisel;
|
||||
import team.chisel.config.Configurations;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockRoadLine extends BlockCarvable {
|
||||
|
||||
public IIcon aloneIcon[] = new IIcon[4];
|
||||
public IIcon halfLineIcon[] = new IIcon[4];
|
||||
public IIcon fullLineIcon[] = new IIcon[4];
|
||||
public IIcon aloneIcon[] = new IIcon[4];
|
||||
public IIcon halfLineIcon[] = new IIcon[4];
|
||||
public IIcon fullLineIcon[] = new IIcon[4];
|
||||
|
||||
public BlockRoadLine() {
|
||||
super(Material.circuits);
|
||||
public BlockRoadLine() {
|
||||
super(Material.circuits);
|
||||
|
||||
if (Configurations.useRoadLineTool) {
|
||||
this.setHarvestLevel(Configurations.getRoadLineTool, Configurations.roadLineToolLevel);
|
||||
}
|
||||
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);
|
||||
}
|
||||
if (Configurations.useRoadLineTool) {
|
||||
this.setHarvestLevel(Configurations.getRoadLineTool, Configurations.roadLineToolLevel);
|
||||
}
|
||||
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 AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@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 int getRenderType() {
|
||||
return Chisel.roadLineId;
|
||||
}
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return Chisel.roadLineId;
|
||||
}
|
||||
|
||||
@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 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 void onNeighborBlockChange(World par1World, int par2, int par3, int par4, Block block) {
|
||||
if (par1World.isRemote)
|
||||
return;
|
||||
@Override
|
||||
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, Block block) {
|
||||
if (par1World.isRemote) return;
|
||||
|
||||
if (!this.canPlaceBlockAt(par1World, par2, par3, par4)) {
|
||||
this.dropBlockAsItem(par1World, par2, par3, par4, 0, 0);
|
||||
par1World.setBlockToAir(par2, par3, par4);
|
||||
}
|
||||
if (!this.canPlaceBlockAt(par1World, par2, par3, par4)) {
|
||||
this.dropBlockAsItem(par1World, par2, par3, par4, 0, 0);
|
||||
par1World.setBlockToAir(par2, par3, par4);
|
||||
}
|
||||
|
||||
super.onNeighborBlockChange(par1World, par2, par3, par4, block);
|
||||
}
|
||||
super.onNeighborBlockChange(par1World, par2, par3, par4, block);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister reg) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
String[] texNames = { "white", "yellow", "double-white", "double-yellow" };
|
||||
aloneIcon[i] = reg.registerIcon("Chisel:line-marking/" + texNames[i] + "-center");
|
||||
halfLineIcon[i] = reg.registerIcon("Chisel:line-marking/" + texNames[i] + "-side");
|
||||
fullLineIcon[i] = reg.registerIcon("Chisel:line-marking/" + texNames[i] + "-long");
|
||||
}
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister reg) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
String[] texNames = { "white", "yellow", "double-white", "double-yellow" };
|
||||
aloneIcon[i] = reg.registerIcon("Chisel:line-marking/" + texNames[i] + "-center");
|
||||
halfLineIcon[i] = reg.registerIcon("Chisel:line-marking/" + texNames[i] + "-side");
|
||||
fullLineIcon[i] = reg.registerIcon("Chisel:line-marking/" + texNames[i] + "-long");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
return aloneIcon[metadata % aloneIcon.length];
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
return aloneIcon[metadata % aloneIcon.length];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return getIcon(side, world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return getIcon(side, world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -2,34 +2,35 @@ package team.chisel.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import team.chisel.client.GeneralChiselClient;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import team.chisel.client.GeneralChiselClient;
|
||||
|
||||
public class BlockSnakestoneObsidian extends BlockSnakestone {
|
||||
|
||||
public static IIcon[] particles = new IIcon[8];
|
||||
public static IIcon[] particles = new IIcon[8];
|
||||
|
||||
public BlockSnakestoneObsidian(String iconPrefix) {
|
||||
super(iconPrefix);
|
||||
public BlockSnakestoneObsidian(String iconPrefix) {
|
||||
super(iconPrefix);
|
||||
|
||||
flipTopTextures = true;
|
||||
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 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 registerBlockIcons(IIconRegister register) {
|
||||
super.registerBlockIcons(register);
|
||||
|
||||
for (int i = 0; i < particles.length; i++) {
|
||||
particles[i] = register.registerIcon(iconPrefix + "particles/" + i);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < particles.length; i++) {
|
||||
particles[i] = register.registerIcon(iconPrefix + "particles/" + i);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,12 +4,12 @@ import net.minecraft.block.material.Material;
|
||||
|
||||
public class BlockWaterstone extends BlockMultiLayer {
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -2,41 +2,48 @@ package team.chisel.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import team.chisel.carving.Carving;
|
||||
import team.chisel.item.ItemCarvable;
|
||||
|
||||
import com.cricketcraft.chisel.api.ChiselTabs;
|
||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.api.carving.CarvingUtils;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class CarvableStairsMaker {
|
||||
|
||||
public final CarvableHelper carverHelper;
|
||||
private Block blockBase;
|
||||
public final CarvableHelper carverHelper;
|
||||
private Block blockBase;
|
||||
|
||||
public CarvableStairsMaker(Block base) {
|
||||
blockBase = base;
|
||||
carverHelper = new CarvableHelper(base);
|
||||
}
|
||||
public CarvableStairsMaker(Block base) {
|
||||
blockBase = base;
|
||||
carverHelper = new CarvableHelper(base);
|
||||
}
|
||||
|
||||
public void create(String name, Block[] blocks) {
|
||||
create(null, name, blocks);
|
||||
}
|
||||
public void create(String name, Block[] blocks) {
|
||||
create(null, name, blocks);
|
||||
}
|
||||
|
||||
public void create(IStairsCreator creator, String name, Block[] blocks) {
|
||||
for (int i = 0; i < blocks.length; i++) {
|
||||
String n = name + "." + i;
|
||||
blocks[i] = creator == null ? new BlockCarvableStairs(blockBase, i * 2, carverHelper) : creator.create(blockBase, i * 2, carverHelper);
|
||||
public void create(IStairsCreator creator, String name, Block[] blocks) {
|
||||
for (int i = 0; i < blocks.length; i++) {
|
||||
String n = name + "." + i;
|
||||
blocks[i] = creator == null ? new BlockCarvableStairs(blockBase, i * 2, carverHelper)
|
||||
: creator.create(blockBase, i * 2, carverHelper);
|
||||
|
||||
blocks[i].setBlockName("chisel." + n).setCreativeTab(ChiselTabs.tabStairChiselBlocks);
|
||||
GameRegistry.registerBlock(blocks[i], ItemCarvable.class, n);
|
||||
blocks[i].setBlockName("chisel." + n).setCreativeTab(ChiselTabs.tabStairChiselBlocks);
|
||||
GameRegistry.registerBlock(blocks[i], ItemCarvable.class, n);
|
||||
|
||||
for (int meta = 0; meta < 2 && i * 2 + meta < carverHelper.infoList.size(); meta++) {
|
||||
Carving.chisel.addVariation(name, CarvingUtils.getDefaultVariationFor(blocks[i], meta * 8, i));
|
||||
GameRegistry.addRecipe(new ItemStack(blocks[i], 4, meta * 8), "* ", "** ", "***", '*', new ItemStack(blockBase, 1, i * 2 + meta));
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int meta = 0; meta < 2 && i * 2 + meta < carverHelper.infoList.size(); meta++) {
|
||||
Carving.chisel.addVariation(name, CarvingUtils.getDefaultVariationFor(blocks[i], meta * 8, i));
|
||||
GameRegistry.addRecipe(
|
||||
new ItemStack(blocks[i], 4, meta * 8),
|
||||
"* ",
|
||||
"** ",
|
||||
"***",
|
||||
'*',
|
||||
new ItemStack(blockBase, 1, i * 2 + meta));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
package team.chisel.block;
|
||||
|
||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||
|
||||
public interface IStairsCreator {
|
||||
|
||||
public BlockCarvableStairs create(Block block, int meta, CarvableHelper helper);
|
||||
public BlockCarvableStairs create(Block block, int meta, CarvableHelper helper);
|
||||
}
|
||||
@@ -4,26 +4,23 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IDoubleChest {
|
||||
|
||||
/**
|
||||
* @return The size of this specific chest's inventory. Does not account for the connection.
|
||||
*/
|
||||
int getTrueSizeInventory();
|
||||
/**
|
||||
* @return The size of this specific chest's inventory. Does not account for the connection.
|
||||
*/
|
||||
int getTrueSizeInventory();
|
||||
|
||||
/**
|
||||
* @param slot
|
||||
* The true slot index.
|
||||
* @return The actual stack in this chest's slot. Does not account for the connection.
|
||||
*/
|
||||
ItemStack getTrueStackInSlot(int slot);
|
||||
/**
|
||||
* @param slot The true slot index.
|
||||
* @return The actual stack in this chest's slot. Does not account for the connection.
|
||||
*/
|
||||
ItemStack getTrueStackInSlot(int slot);
|
||||
|
||||
/**
|
||||
* Puts a stack in this chest's real slot at the given true index.
|
||||
*
|
||||
* @param slot
|
||||
* The true slot index.
|
||||
* @param stack
|
||||
* The ItemStack to place in the slot.
|
||||
*/
|
||||
void putStackInTrueSlot(int slot, ItemStack stack);
|
||||
/**
|
||||
* Puts a stack in this chest's real slot at the given true index.
|
||||
*
|
||||
* @param slot The true slot index.
|
||||
* @param stack The ItemStack to place in the slot.
|
||||
*/
|
||||
void putStackInTrueSlot(int slot, ItemStack stack);
|
||||
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import team.chisel.Features;
|
||||
import team.chisel.carving.Carving;
|
||||
import team.chisel.client.GeneralChiselClient;
|
||||
@@ -30,437 +31,450 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class TileEntityAutoChisel extends TileEntity implements ISidedInventory {
|
||||
|
||||
public enum Upgrade {
|
||||
SPEED,
|
||||
AUTOMATION,
|
||||
STACK,
|
||||
REVERSION;
|
||||
|
||||
public String getUnlocalizedName() {
|
||||
if (Features.AUTO_CHISEL_UPGRADES.enabled()) {
|
||||
return "item.upgrade_" + this.name().toLowerCase();
|
||||
}
|
||||
return "chisel.autochisel.upgrade.disabled";
|
||||
}
|
||||
|
||||
public String getLocalizedName() {
|
||||
String ret = StatCollector.translateToLocal("autochisel.slot." + this.name().toLowerCase() + ".tooltip");
|
||||
if (!Features.AUTO_CHISEL_UPGRADES.enabled()) {
|
||||
ret = EnumChatFormatting.RED.toString().concat(ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
public static final int BASE = 0, TARGET = 1, OUTPUT = 2, CHISEL = 3, MIN_UPGRADE = 4;
|
||||
private static final int FAST_SPEED = 1, SLOW_SPEED = 4;
|
||||
|
||||
private int progress = 0;
|
||||
|
||||
private static EntityItem ghostItem;
|
||||
boolean equal = false;
|
||||
private ItemStack[] inventory = new ItemStack[8];
|
||||
private String name = "autoChisel";
|
||||
|
||||
// client animation fields
|
||||
|
||||
// used for floating target
|
||||
public float xRot, yRot, zRot;
|
||||
|
||||
// used for chisel item rotation
|
||||
public static final int maxRot = 60;
|
||||
public static final int rotAmnt = 15;
|
||||
public float chiselRot;
|
||||
public boolean chiseling = false, breakChisel = false;;
|
||||
public int toChisel = 1;
|
||||
|
||||
private ItemStack lastBase;
|
||||
|
||||
@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 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;
|
||||
|
||||
if (j >= 0 && j < inventory.length) {
|
||||
inventory[j] = ItemStack.loadItemStackFromNBT(data);
|
||||
}
|
||||
}
|
||||
|
||||
if (nbt.hasKey("CustomName", 8)) {
|
||||
this.name = nbt.getString("CustomName");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
ItemStack base = inventory[BASE], target = getTarget(), output = inventory[OUTPUT];
|
||||
|
||||
if (!worldObj.isRemote && hasChisel() && base != null && target != null) {
|
||||
if (canBeMadeFrom(base, target)) {
|
||||
if (progress >= (hasUpgrade(Upgrade.SPEED) ? FAST_SPEED : SLOW_SPEED)) {
|
||||
|
||||
// reset progress
|
||||
progress = 0;
|
||||
|
||||
// the max possible for this craft
|
||||
int canBeMade = target.getMaxStackSize();
|
||||
|
||||
// if there are items in the output, they count towards the max we can make
|
||||
if (output != null) {
|
||||
canBeMade -= output.stackSize;
|
||||
}
|
||||
|
||||
// can't make more than we have
|
||||
canBeMade = Math.min(base.stackSize, canBeMade);
|
||||
|
||||
// if we can't make any, forget it
|
||||
if (canBeMade <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// result will always be a copy of the target
|
||||
ItemStack chiseled = target.copy();
|
||||
|
||||
// if we have the stack upgrade, boost the stack size to the max possible, otherwise just one
|
||||
chiseled.stackSize = hasUpgrade(Upgrade.STACK) ? canBeMade : 1;
|
||||
|
||||
if (canChisel(chiseled)) {
|
||||
// if our output is empty, just use the current result
|
||||
if (output == null) {
|
||||
setInventorySlotContents(OUTPUT, chiseled);
|
||||
} else {
|
||||
// otherwise just add our result to the existing stack
|
||||
inventory[OUTPUT].stackSize += chiseled.stackSize;
|
||||
slotChanged(OUTPUT);
|
||||
}
|
||||
|
||||
chiselItem(chiseled.stackSize, target);
|
||||
|
||||
// remove what we made from the stack
|
||||
base.stackSize -= chiseled.stackSize;
|
||||
if (base.stackSize <= 0) {
|
||||
setInventorySlotContents(BASE, null); // clear out 0 size itemstacks
|
||||
}
|
||||
}
|
||||
} else if (worldObj.getTotalWorldTime() % 10 == 0) {
|
||||
progress++;
|
||||
}
|
||||
}
|
||||
} else if (worldObj.isRemote) {
|
||||
if (chiseling) {
|
||||
chiselRot += rotAmnt;
|
||||
if (chiselRot >= maxRot) {
|
||||
chiselItem(0, getTarget());
|
||||
}
|
||||
} else {
|
||||
chiselRot = Math.max(chiselRot - rotAmnt, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ItemStack getTarget() {
|
||||
if (inventory[BASE] != null && hasUpgrade(Upgrade.REVERSION)) {
|
||||
// if we have a reversion upgrade, use that for the target
|
||||
List<ItemStack> possible = Carving.chisel.getItemsForChiseling(inventory[BASE]);
|
||||
return possible.isEmpty() ? null : possible.get(0);
|
||||
} else {
|
||||
return inventory[TARGET];
|
||||
}
|
||||
}
|
||||
|
||||
// lets make sure the user isn't trying to make something from a block that doesn't have this as a valid target
|
||||
private boolean canBeMadeFrom(ItemStack from, ItemStack to) {
|
||||
List<ItemStack> results = Carving.chisel.getItemsForChiseling(from);
|
||||
for (ItemStack s : results) {
|
||||
if (s.getItem() == to.getItem() && s.getItemDamage() == to.getItemDamage()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean canChisel(ItemStack toMerge) {
|
||||
// if the output slot is empty we can merge without checking
|
||||
if (inventory[OUTPUT] == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// need to check NBT as well as item
|
||||
if (!toMerge.isItemEqual(inventory[OUTPUT]) || !ItemStack.areItemStackTagsEqual(toMerge, inventory[OUTPUT])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// we only care about metadata if the item has subtypes
|
||||
if (toMerge.getHasSubtypes() && toMerge.getItemDamage() != inventory[OUTPUT].getItemDamage()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return ((IChiselItem) inventory[CHISEL].getItem()).canChisel(worldObj, inventory[CHISEL], General.getVariation(getTarget()));
|
||||
}
|
||||
|
||||
private boolean hasChisel() {
|
||||
return inventory[CHISEL] != null && inventory[CHISEL].getItem() instanceof IChiselItem && inventory[CHISEL].stackSize >= 1;
|
||||
}
|
||||
|
||||
/** Calls IChiselItem#onChisel() and sends the chisel packet for sound/animation */
|
||||
private void chiselItem(int chiseled, ItemStack target) {
|
||||
if (!worldObj.isRemote) {
|
||||
boolean breakChisel = false;
|
||||
if (((IChiselItem) inventory[CHISEL].getItem()).onChisel(worldObj, inventory[CHISEL], General.getVariation(target))) {
|
||||
inventory[CHISEL].setItemDamage(inventory[CHISEL].getItemDamage() + 1);
|
||||
if (inventory[CHISEL].getItemDamage() >= inventory[CHISEL].getMaxDamage()) {
|
||||
setInventorySlotContents(CHISEL, null);
|
||||
breakChisel = true;
|
||||
}
|
||||
}
|
||||
PacketHandler.INSTANCE.sendToDimension(new MessageAutoChisel(this, chiseled, true, breakChisel), worldObj.provider.dimensionId);
|
||||
} else {
|
||||
if (breakChisel) {
|
||||
worldObj.playSound(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "random.break", 0.8F, 0.8F + worldObj.rand.nextFloat() * 0.4F, false);
|
||||
}
|
||||
GeneralChiselClient.spawnAutoChiselFX(this, lastBase != null ? lastBase : inventory[BASE]);
|
||||
chiseling = false;
|
||||
if (lastBase != null) {
|
||||
lastBase.stackSize -= toChisel;
|
||||
if (lastBase.stackSize <= 0) {
|
||||
lastBase = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
||||
nbt.setTag("Items", tags);
|
||||
|
||||
if (this.hasCustomInventoryName()) {
|
||||
nbt.setString("CustomName", this.name);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return inventory.length;
|
||||
}
|
||||
|
||||
@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 void setInventorySlotContents(int slot, ItemStack stack) {
|
||||
inventory[slot] = stack;
|
||||
|
||||
if (stack != null && stack.stackSize > getInventoryStackLimit()) {
|
||||
stack.stackSize = getInventoryStackLimit();
|
||||
}
|
||||
|
||||
if (worldObj.isRemote && slot == BASE && stack != null) {
|
||||
lastBase = stack.copy();
|
||||
}
|
||||
|
||||
if (!worldObj.isRemote) {
|
||||
slotChanged(slot);
|
||||
}
|
||||
}
|
||||
|
||||
private void slotChanged(int slot) {
|
||||
PacketHandler.INSTANCE.sendToDimension(new MessageSlotUpdate(this, slot, inventory[slot]), worldObj.provider.dimensionId);
|
||||
markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int side) {
|
||||
return new int[] { BASE, TARGET, OUTPUT, CHISEL };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack itemStack) {
|
||||
if (itemStack == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (slot) {
|
||||
case BASE:
|
||||
case TARGET:
|
||||
return !Carving.chisel.getItemsForChiseling(itemStack).isEmpty();
|
||||
case OUTPUT:
|
||||
return false;
|
||||
case CHISEL:
|
||||
return itemStack.getItem() instanceof IChiselItem;
|
||||
default:
|
||||
return Features.AUTO_CHISEL_UPGRADES.enabled() && itemStack.getItem() == ChiselItems.upgrade && Upgrade.values()[slot - MIN_UPGRADE].ordinal() == itemStack.getItemDamage();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack itemStack, int side) {
|
||||
return hasUpgrade(Upgrade.AUTOMATION) && (slot == BASE || slot == TARGET || slot == CHISEL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack itemStack, int side) {
|
||||
return hasUpgrade(Upgrade.AUTOMATION) && slot == OUTPUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public EntityItem getItemForRendering(int slot) {
|
||||
if (ghostItem == null) {
|
||||
ghostItem = new EntityItem(worldObj);
|
||||
ghostItem.hoverStart = 0.0F;
|
||||
}
|
||||
|
||||
if (slot == BASE && lastBase != null) {
|
||||
ghostItem.setEntityItemStack(lastBase.copy());
|
||||
return ghostItem;
|
||||
} else if (slot == TARGET) {
|
||||
ItemStack target = getTarget();
|
||||
if (target != null) {
|
||||
ghostItem.setEntityItemStack(target);
|
||||
return ghostItem;
|
||||
}
|
||||
return null;
|
||||
} else if (inventory[slot] == null) {
|
||||
return null;
|
||||
} else {
|
||||
ghostItem.setEntityItemStack(inventory[slot].copy());
|
||||
return ghostItem;
|
||||
}
|
||||
}
|
||||
|
||||
@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());
|
||||
}
|
||||
|
||||
public boolean hasUpgrade(Upgrade upgrade) {
|
||||
if (Features.AUTO_CHISEL_UPGRADES.enabled()) {
|
||||
ItemStack stack = inventory[MIN_UPGRADE + upgrade.ordinal()];
|
||||
if (stack != null) {
|
||||
return stack.getItem() == ChiselItems.upgrade && stack.getItemDamage() == upgrade.ordinal();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return upgrade == Upgrade.REVERSION ? false : true;
|
||||
}
|
||||
|
||||
public String getSlotTooltipUnloc(int slotNumber) {
|
||||
String base = "autochisel.slot.%s.tooltip";
|
||||
String name = null;
|
||||
if (slotNumber < MIN_UPGRADE) {
|
||||
if (slotNumber == TARGET) {
|
||||
name = "target";
|
||||
} else if (slotNumber == CHISEL) {
|
||||
name = "chisel";
|
||||
}
|
||||
String unloc = name == null ? null : String.format(base, name);
|
||||
return StatCollector.translateToLocal(unloc);
|
||||
} else {
|
||||
return Upgrade.values()[slotNumber - MIN_UPGRADE].getLocalizedName();
|
||||
}
|
||||
}
|
||||
|
||||
public void doChiselAnim(ItemStack lastChiseled, int chiseled, boolean playSound, boolean breakChisel) {
|
||||
this.lastBase = lastChiseled == null ? null : lastChiseled.copy();
|
||||
this.toChisel = chiseled;
|
||||
if (playSound) {
|
||||
this.chiseling = true;
|
||||
}
|
||||
this.breakChisel = breakChisel;
|
||||
}
|
||||
|
||||
public ItemStack getLastBase() {
|
||||
return lastBase == null ? null : lastBase.copy();
|
||||
}
|
||||
public enum Upgrade {
|
||||
|
||||
SPEED,
|
||||
AUTOMATION,
|
||||
STACK,
|
||||
REVERSION;
|
||||
|
||||
public String getUnlocalizedName() {
|
||||
if (Features.AUTO_CHISEL_UPGRADES.enabled()) {
|
||||
return "item.upgrade_" + this.name().toLowerCase();
|
||||
}
|
||||
return "chisel.autochisel.upgrade.disabled";
|
||||
}
|
||||
|
||||
public String getLocalizedName() {
|
||||
String ret = StatCollector.translateToLocal("autochisel.slot." + this.name().toLowerCase() + ".tooltip");
|
||||
if (!Features.AUTO_CHISEL_UPGRADES.enabled()) {
|
||||
ret = EnumChatFormatting.RED.toString().concat(ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
public static final int BASE = 0, TARGET = 1, OUTPUT = 2, CHISEL = 3, MIN_UPGRADE = 4;
|
||||
private static final int FAST_SPEED = 1, SLOW_SPEED = 4;
|
||||
|
||||
private int progress = 0;
|
||||
|
||||
private static EntityItem ghostItem;
|
||||
boolean equal = false;
|
||||
private ItemStack[] inventory = new ItemStack[8];
|
||||
private String name = "autoChisel";
|
||||
|
||||
// client animation fields
|
||||
|
||||
// used for floating target
|
||||
public float xRot, yRot, zRot;
|
||||
|
||||
// used for chisel item rotation
|
||||
public static final int maxRot = 60;
|
||||
public static final int rotAmnt = 15;
|
||||
public float chiselRot;
|
||||
public boolean chiseling = false, breakChisel = false;;
|
||||
public int toChisel = 1;
|
||||
|
||||
private ItemStack lastBase;
|
||||
|
||||
@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 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;
|
||||
|
||||
if (j >= 0 && j < inventory.length) {
|
||||
inventory[j] = ItemStack.loadItemStackFromNBT(data);
|
||||
}
|
||||
}
|
||||
|
||||
if (nbt.hasKey("CustomName", 8)) {
|
||||
this.name = nbt.getString("CustomName");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
ItemStack base = inventory[BASE], target = getTarget(), output = inventory[OUTPUT];
|
||||
|
||||
if (!worldObj.isRemote && hasChisel() && base != null && target != null) {
|
||||
if (canBeMadeFrom(base, target)) {
|
||||
if (progress >= (hasUpgrade(Upgrade.SPEED) ? FAST_SPEED : SLOW_SPEED)) {
|
||||
|
||||
// reset progress
|
||||
progress = 0;
|
||||
|
||||
// the max possible for this craft
|
||||
int canBeMade = target.getMaxStackSize();
|
||||
|
||||
// if there are items in the output, they count towards the max we can make
|
||||
if (output != null) {
|
||||
canBeMade -= output.stackSize;
|
||||
}
|
||||
|
||||
// can't make more than we have
|
||||
canBeMade = Math.min(base.stackSize, canBeMade);
|
||||
|
||||
// if we can't make any, forget it
|
||||
if (canBeMade <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// result will always be a copy of the target
|
||||
ItemStack chiseled = target.copy();
|
||||
|
||||
// if we have the stack upgrade, boost the stack size to the max possible, otherwise just one
|
||||
chiseled.stackSize = hasUpgrade(Upgrade.STACK) ? canBeMade : 1;
|
||||
|
||||
if (canChisel(chiseled)) {
|
||||
// if our output is empty, just use the current result
|
||||
if (output == null) {
|
||||
setInventorySlotContents(OUTPUT, chiseled);
|
||||
} else {
|
||||
// otherwise just add our result to the existing stack
|
||||
inventory[OUTPUT].stackSize += chiseled.stackSize;
|
||||
slotChanged(OUTPUT);
|
||||
}
|
||||
|
||||
chiselItem(chiseled.stackSize, target);
|
||||
|
||||
// remove what we made from the stack
|
||||
base.stackSize -= chiseled.stackSize;
|
||||
if (base.stackSize <= 0) {
|
||||
setInventorySlotContents(BASE, null); // clear out 0 size itemstacks
|
||||
}
|
||||
}
|
||||
} else if (worldObj.getTotalWorldTime() % 10 == 0) {
|
||||
progress++;
|
||||
}
|
||||
}
|
||||
} else if (worldObj.isRemote) {
|
||||
if (chiseling) {
|
||||
chiselRot += rotAmnt;
|
||||
if (chiselRot >= maxRot) {
|
||||
chiselItem(0, getTarget());
|
||||
}
|
||||
} else {
|
||||
chiselRot = Math.max(chiselRot - rotAmnt, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ItemStack getTarget() {
|
||||
if (inventory[BASE] != null && hasUpgrade(Upgrade.REVERSION)) {
|
||||
// if we have a reversion upgrade, use that for the target
|
||||
List<ItemStack> possible = Carving.chisel.getItemsForChiseling(inventory[BASE]);
|
||||
return possible.isEmpty() ? null : possible.get(0);
|
||||
} else {
|
||||
return inventory[TARGET];
|
||||
}
|
||||
}
|
||||
|
||||
// lets make sure the user isn't trying to make something from a block that doesn't have this as a valid target
|
||||
private boolean canBeMadeFrom(ItemStack from, ItemStack to) {
|
||||
List<ItemStack> results = Carving.chisel.getItemsForChiseling(from);
|
||||
for (ItemStack s : results) {
|
||||
if (s.getItem() == to.getItem() && s.getItemDamage() == to.getItemDamage()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean canChisel(ItemStack toMerge) {
|
||||
// if the output slot is empty we can merge without checking
|
||||
if (inventory[OUTPUT] == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// need to check NBT as well as item
|
||||
if (!toMerge.isItemEqual(inventory[OUTPUT]) || !ItemStack.areItemStackTagsEqual(toMerge, inventory[OUTPUT])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// we only care about metadata if the item has subtypes
|
||||
if (toMerge.getHasSubtypes() && toMerge.getItemDamage() != inventory[OUTPUT].getItemDamage()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return ((IChiselItem) inventory[CHISEL].getItem())
|
||||
.canChisel(worldObj, inventory[CHISEL], General.getVariation(getTarget()));
|
||||
}
|
||||
|
||||
private boolean hasChisel() {
|
||||
return inventory[CHISEL] != null && inventory[CHISEL].getItem() instanceof IChiselItem
|
||||
&& inventory[CHISEL].stackSize >= 1;
|
||||
}
|
||||
|
||||
/** Calls IChiselItem#onChisel() and sends the chisel packet for sound/animation */
|
||||
private void chiselItem(int chiseled, ItemStack target) {
|
||||
if (!worldObj.isRemote) {
|
||||
boolean breakChisel = false;
|
||||
if (((IChiselItem) inventory[CHISEL].getItem())
|
||||
.onChisel(worldObj, inventory[CHISEL], General.getVariation(target))) {
|
||||
inventory[CHISEL].setItemDamage(inventory[CHISEL].getItemDamage() + 1);
|
||||
if (inventory[CHISEL].getItemDamage() >= inventory[CHISEL].getMaxDamage()) {
|
||||
setInventorySlotContents(CHISEL, null);
|
||||
breakChisel = true;
|
||||
}
|
||||
}
|
||||
PacketHandler.INSTANCE.sendToDimension(
|
||||
new MessageAutoChisel(this, chiseled, true, breakChisel),
|
||||
worldObj.provider.dimensionId);
|
||||
} else {
|
||||
if (breakChisel) {
|
||||
worldObj.playSound(
|
||||
xCoord + 0.5,
|
||||
yCoord + 0.5,
|
||||
zCoord + 0.5,
|
||||
"random.break",
|
||||
0.8F,
|
||||
0.8F + worldObj.rand.nextFloat() * 0.4F,
|
||||
false);
|
||||
}
|
||||
GeneralChiselClient.spawnAutoChiselFX(this, lastBase != null ? lastBase : inventory[BASE]);
|
||||
chiseling = false;
|
||||
if (lastBase != null) {
|
||||
lastBase.stackSize -= toChisel;
|
||||
if (lastBase.stackSize <= 0) {
|
||||
lastBase = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
||||
nbt.setTag("Items", tags);
|
||||
|
||||
if (this.hasCustomInventoryName()) {
|
||||
nbt.setString("CustomName", this.name);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return inventory.length;
|
||||
}
|
||||
|
||||
@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 void setInventorySlotContents(int slot, ItemStack stack) {
|
||||
inventory[slot] = stack;
|
||||
|
||||
if (stack != null && stack.stackSize > getInventoryStackLimit()) {
|
||||
stack.stackSize = getInventoryStackLimit();
|
||||
}
|
||||
|
||||
if (worldObj.isRemote && slot == BASE && stack != null) {
|
||||
lastBase = stack.copy();
|
||||
}
|
||||
|
||||
if (!worldObj.isRemote) {
|
||||
slotChanged(slot);
|
||||
}
|
||||
}
|
||||
|
||||
private void slotChanged(int slot) {
|
||||
PacketHandler.INSTANCE
|
||||
.sendToDimension(new MessageSlotUpdate(this, slot, inventory[slot]), worldObj.provider.dimensionId);
|
||||
markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int side) {
|
||||
return new int[] { BASE, TARGET, OUTPUT, CHISEL };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack itemStack) {
|
||||
if (itemStack == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (slot) {
|
||||
case BASE:
|
||||
case TARGET:
|
||||
return !Carving.chisel.getItemsForChiseling(itemStack).isEmpty();
|
||||
case OUTPUT:
|
||||
return false;
|
||||
case CHISEL:
|
||||
return itemStack.getItem() instanceof IChiselItem;
|
||||
default:
|
||||
return Features.AUTO_CHISEL_UPGRADES.enabled() && itemStack.getItem() == ChiselItems.upgrade
|
||||
&& Upgrade.values()[slot - MIN_UPGRADE].ordinal() == itemStack.getItemDamage();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack itemStack, int side) {
|
||||
return hasUpgrade(Upgrade.AUTOMATION) && (slot == BASE || slot == TARGET || slot == CHISEL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack itemStack, int side) {
|
||||
return hasUpgrade(Upgrade.AUTOMATION) && slot == OUTPUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public EntityItem getItemForRendering(int slot) {
|
||||
if (ghostItem == null) {
|
||||
ghostItem = new EntityItem(worldObj);
|
||||
ghostItem.hoverStart = 0.0F;
|
||||
}
|
||||
|
||||
if (slot == BASE && lastBase != null) {
|
||||
ghostItem.setEntityItemStack(lastBase.copy());
|
||||
return ghostItem;
|
||||
} else if (slot == TARGET) {
|
||||
ItemStack target = getTarget();
|
||||
if (target != null) {
|
||||
ghostItem.setEntityItemStack(target);
|
||||
return ghostItem;
|
||||
}
|
||||
return null;
|
||||
} else if (inventory[slot] == null) {
|
||||
return null;
|
||||
} else {
|
||||
ghostItem.setEntityItemStack(inventory[slot].copy());
|
||||
return ghostItem;
|
||||
}
|
||||
}
|
||||
|
||||
@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());
|
||||
}
|
||||
|
||||
public boolean hasUpgrade(Upgrade upgrade) {
|
||||
if (Features.AUTO_CHISEL_UPGRADES.enabled()) {
|
||||
ItemStack stack = inventory[MIN_UPGRADE + upgrade.ordinal()];
|
||||
if (stack != null) {
|
||||
return stack.getItem() == ChiselItems.upgrade && stack.getItemDamage() == upgrade.ordinal();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return upgrade == Upgrade.REVERSION ? false : true;
|
||||
}
|
||||
|
||||
public String getSlotTooltipUnloc(int slotNumber) {
|
||||
String base = "autochisel.slot.%s.tooltip";
|
||||
String name = null;
|
||||
if (slotNumber < MIN_UPGRADE) {
|
||||
if (slotNumber == TARGET) {
|
||||
name = "target";
|
||||
} else if (slotNumber == CHISEL) {
|
||||
name = "chisel";
|
||||
}
|
||||
String unloc = name == null ? null : String.format(base, name);
|
||||
return StatCollector.translateToLocal(unloc);
|
||||
} else {
|
||||
return Upgrade.values()[slotNumber - MIN_UPGRADE].getLocalizedName();
|
||||
}
|
||||
}
|
||||
|
||||
public void doChiselAnim(ItemStack lastChiseled, int chiseled, boolean playSound, boolean breakChisel) {
|
||||
this.lastBase = lastChiseled == null ? null : lastChiseled.copy();
|
||||
this.toChisel = chiseled;
|
||||
if (playSound) {
|
||||
this.chiseling = true;
|
||||
}
|
||||
this.breakChisel = breakChisel;
|
||||
}
|
||||
|
||||
public ItemStack getLastBase() {
|
||||
return lastBase == null ? null : lastBase.copy();
|
||||
}
|
||||
}
|
||||
@@ -2,14 +2,15 @@ package team.chisel.block.tileentity;
|
||||
|
||||
import net.minecraft.tileentity.TileEntityBeacon;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class TileEntityCarvableBeacon extends TileEntityBeacon {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public AxisAlignedBB getRenderBoundingBox() {
|
||||
return INFINITE_EXTENT_AABB;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public AxisAlignedBB getRenderBoundingBox() {
|
||||
return INFINITE_EXTENT_AABB;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,5 @@
|
||||
package team.chisel.block.tileentity;
|
||||
|
||||
import team.chisel.init.ChiselBlocks;
|
||||
import team.chisel.network.PacketHandler;
|
||||
import team.chisel.network.message.MessagePresentConnect;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
@@ -17,349 +14,358 @@ import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import team.chisel.init.ChiselBlocks;
|
||||
import team.chisel.network.PacketHandler;
|
||||
import team.chisel.network.message.MessagePresentConnect;
|
||||
|
||||
public class TileEntityPresent extends TileEntity implements IInventory, IDoubleChest {
|
||||
|
||||
private TileEntityPresent connection = null;
|
||||
// If cachedDir is non-null, but connection is null, this present must be
|
||||
// connected to an unloaded present. This is handled appropriately.
|
||||
private ForgeDirection cachedDir = null;
|
||||
private boolean isParent;
|
||||
private final ItemStack[] inventory = new ItemStack[27];
|
||||
private int rotation;
|
||||
private boolean autoSearch = true;
|
||||
private TileEntityPresent connection = null;
|
||||
// If cachedDir is non-null, but connection is null, this present must be
|
||||
// connected to an unloaded present. This is handled appropriately.
|
||||
private ForgeDirection cachedDir = null;
|
||||
private boolean isParent;
|
||||
private final ItemStack[] inventory = new ItemStack[27];
|
||||
private int rotation;
|
||||
private boolean autoSearch = true;
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if (!isConnected() && autoSearch && worldObj != null /* ugh */) {
|
||||
if (cachedDir != null) {
|
||||
connectTo(cachedDir);
|
||||
} else if (!worldObj.isRemote) {
|
||||
findConnections();
|
||||
}
|
||||
autoSearch = false;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if (!isConnected() && autoSearch && worldObj != null /* ugh */) {
|
||||
if (cachedDir != null) {
|
||||
connectTo(cachedDir);
|
||||
} else if (!worldObj.isRemote) {
|
||||
findConnections();
|
||||
}
|
||||
autoSearch = false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isConnected() {
|
||||
return connection != null;
|
||||
}
|
||||
public boolean isConnected() {
|
||||
return connection != null;
|
||||
}
|
||||
|
||||
private boolean connectTo(TileEntityPresent present, ForgeDirection dir) {
|
||||
if (present.getBlockMetadata() == getBlockMetadata() && !present.isConnected() && (present.cachedDir == null || present.cachedDir == dir.getOpposite())
|
||||
&& Math.abs(present.xCoord - xCoord + present.yCoord - yCoord + present.zCoord - zCoord) == 1) {
|
||||
connection = present;
|
||||
connection.connection = this;
|
||||
connection.cachedDir = dir.getOpposite();
|
||||
connection.markDirty();
|
||||
cachedDir = dir;
|
||||
isParent = !present.isParent;
|
||||
markDirty();
|
||||
PacketHandler.INSTANCE.sendToDimension(new MessagePresentConnect(this, dir, true), worldObj.provider.dimensionId);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
private boolean connectTo(TileEntityPresent present, ForgeDirection dir) {
|
||||
if (present.getBlockMetadata() == getBlockMetadata() && !present.isConnected()
|
||||
&& (present.cachedDir == null || present.cachedDir == dir.getOpposite())
|
||||
&& Math.abs(present.xCoord - xCoord + present.yCoord - yCoord + present.zCoord - zCoord) == 1) {
|
||||
connection = present;
|
||||
connection.connection = this;
|
||||
connection.cachedDir = dir.getOpposite();
|
||||
connection.markDirty();
|
||||
cachedDir = dir;
|
||||
isParent = !present.isParent;
|
||||
markDirty();
|
||||
PacketHandler.INSTANCE
|
||||
.sendToDimension(new MessagePresentConnect(this, dir, true), worldObj.provider.dimensionId);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean connectTo(ForgeDirection dir) {
|
||||
int x = xCoord + dir.offsetX, y = yCoord + dir.offsetY, z = zCoord + dir.offsetZ;
|
||||
TileEntity te = getTileSafe(x, y, z);
|
||||
if (te instanceof TileEntityPresent) {
|
||||
return connectTo((TileEntityPresent) te, dir);
|
||||
}
|
||||
return !exists(x, y, z);
|
||||
}
|
||||
public boolean connectTo(ForgeDirection dir) {
|
||||
int x = xCoord + dir.offsetX, y = yCoord + dir.offsetY, z = zCoord + dir.offsetZ;
|
||||
TileEntity te = getTileSafe(x, y, z);
|
||||
if (te instanceof TileEntityPresent) {
|
||||
return connectTo((TileEntityPresent) te, dir);
|
||||
}
|
||||
return !exists(x, y, z);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param preserveDir
|
||||
* If true, this is only a virtual disconnect, meaning the other chest still exists, but is still loaded, so maintain a cachedDir for reconnection upon chunk load.
|
||||
*/
|
||||
public void disconnect(boolean preserveDir) {
|
||||
if (isConnected()) {
|
||||
if (!preserveDir) {
|
||||
this.connection.cachedDir = null;
|
||||
this.cachedDir = null;
|
||||
}
|
||||
this.connection.connection = null;
|
||||
this.connection.markDirty();
|
||||
this.connection = null;
|
||||
this.markDirty();
|
||||
PacketHandler.INSTANCE.sendToDimension(new MessagePresentConnect(this, ForgeDirection.UNKNOWN, false, preserveDir), worldObj.provider.dimensionId);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param preserveDir If true, this is only a virtual disconnect, meaning the other chest still exists, but is still
|
||||
* loaded, so maintain a cachedDir for reconnection upon chunk load.
|
||||
*/
|
||||
public void disconnect(boolean preserveDir) {
|
||||
if (isConnected()) {
|
||||
if (!preserveDir) {
|
||||
this.connection.cachedDir = null;
|
||||
this.cachedDir = null;
|
||||
}
|
||||
this.connection.connection = null;
|
||||
this.connection.markDirty();
|
||||
this.connection = null;
|
||||
this.markDirty();
|
||||
PacketHandler.INSTANCE.sendToDimension(
|
||||
new MessagePresentConnect(this, ForgeDirection.UNKNOWN, false, preserveDir),
|
||||
worldObj.provider.dimensionId);
|
||||
}
|
||||
}
|
||||
|
||||
public TileEntityPresent getConnection() {
|
||||
return connection;
|
||||
}
|
||||
public TileEntityPresent getConnection() {
|
||||
return connection;
|
||||
}
|
||||
|
||||
public ForgeDirection getConnectionDir() {
|
||||
return cachedDir == null ? ForgeDirection.UNKNOWN : cachedDir;
|
||||
}
|
||||
public ForgeDirection getConnectionDir() {
|
||||
return cachedDir == null ? ForgeDirection.UNKNOWN : cachedDir;
|
||||
}
|
||||
|
||||
public boolean isParent() {
|
||||
return isParent || !isConnected();
|
||||
}
|
||||
public boolean isParent() {
|
||||
return isParent || !isConnected();
|
||||
}
|
||||
|
||||
public int getRotation() {
|
||||
return rotation;
|
||||
}
|
||||
public int getRotation() {
|
||||
return rotation;
|
||||
}
|
||||
|
||||
public void setRotation(int rot) {
|
||||
this.rotation = rot;
|
||||
}
|
||||
public void setRotation(int rot) {
|
||||
this.rotation = rot;
|
||||
}
|
||||
|
||||
public void findConnections() {
|
||||
if (!isConnected()) {
|
||||
if (cachedDir != null) {
|
||||
if (connectTo(cachedDir)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
if (dir != ForgeDirection.UP && dir != ForgeDirection.DOWN) {
|
||||
if (connectTo(dir)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public void findConnections() {
|
||||
if (!isConnected()) {
|
||||
if (cachedDir != null) {
|
||||
if (connectTo(cachedDir)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
if (dir != ForgeDirection.UP && dir != ForgeDirection.DOWN) {
|
||||
if (connectTo(dir)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public TileEntityPresent getParent() {
|
||||
return isParent || connection == null ? this : connection;
|
||||
}
|
||||
public TileEntityPresent getParent() {
|
||||
return isParent || connection == null ? this : connection;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getRenderBoundingBox() {
|
||||
return ChiselBlocks.present.getBoundingBox(this);
|
||||
}
|
||||
@Override
|
||||
public AxisAlignedBB getRenderBoundingBox() {
|
||||
return ChiselBlocks.present.getBoundingBox(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
super.writeToNBT(tag);
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
super.writeToNBT(tag);
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
|
||||
for (int i = 0; i < getTrueSizeInventory(); ++i) {
|
||||
if (inventory[i] != null) {
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
nbttagcompound1.setByte("Slot", (byte) i);
|
||||
inventory[i].writeToNBT(nbttagcompound1);
|
||||
nbttaglist.appendTag(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < getTrueSizeInventory(); ++i) {
|
||||
if (inventory[i] != null) {
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
nbttagcompound1.setByte("Slot", (byte) i);
|
||||
inventory[i].writeToNBT(nbttagcompound1);
|
||||
nbttaglist.appendTag(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
|
||||
tag.setTag("Items", nbttaglist);
|
||||
tag.setBoolean("isParent", isParent);
|
||||
tag.setInteger("rotation", rotation);
|
||||
if (cachedDir != null) {
|
||||
tag.setInteger("conDir", cachedDir.ordinal());
|
||||
}
|
||||
}
|
||||
tag.setTag("Items", nbttaglist);
|
||||
tag.setBoolean("isParent", isParent);
|
||||
tag.setInteger("rotation", rotation);
|
||||
if (cachedDir != null) {
|
||||
tag.setInteger("conDir", cachedDir.ordinal());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
super.readFromNBT(tag);
|
||||
NBTTagList nbttaglist = tag.getTagList("Items", 10);
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
super.readFromNBT(tag);
|
||||
NBTTagList nbttaglist = tag.getTagList("Items", 10);
|
||||
|
||||
for (int i = 0; i < nbttaglist.tagCount(); ++i) {
|
||||
NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
|
||||
int j = nbttagcompound1.getByte("Slot") & 255;
|
||||
for (int i = 0; i < nbttaglist.tagCount(); ++i) {
|
||||
NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
|
||||
int j = nbttagcompound1.getByte("Slot") & 255;
|
||||
|
||||
if (j >= 0 && j < getTrueSizeInventory()) {
|
||||
inventory[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
if (j >= 0 && j < getTrueSizeInventory()) {
|
||||
inventory[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
|
||||
this.isParent = tag.getBoolean("isParent");
|
||||
this.isParent = tag.getBoolean("isParent");
|
||||
|
||||
this.rotation = tag.getInteger("rotation");
|
||||
if (tag.hasKey("conDir")) {
|
||||
cachedDir = ForgeDirection.values()[tag.getInteger("conDir")];
|
||||
}
|
||||
autoSearch = true;
|
||||
}
|
||||
this.rotation = tag.getInteger("rotation");
|
||||
if (tag.hasKey("conDir")) {
|
||||
cachedDir = ForgeDirection.values()[tag.getInteger("conDir")];
|
||||
}
|
||||
autoSearch = true;
|
||||
}
|
||||
|
||||
@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());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRefresh(Block oldBlock, Block newBlock, int oldMeta, int newMeta, World world, int x, int y, int z) {
|
||||
// prevent losing TE data when in-world chiseling
|
||||
return oldBlock != newBlock;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRefresh(Block oldBlock, Block newBlock, int oldMeta, int newMeta, World world, int x, int y,
|
||||
int z) {
|
||||
// prevent losing TE data when in-world chiseling
|
||||
return oldBlock != newBlock;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
super.invalidate();
|
||||
if (isConnected()) {
|
||||
disconnect(false);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void invalidate() {
|
||||
super.invalidate();
|
||||
if (isConnected()) {
|
||||
disconnect(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChunkUnload() {
|
||||
super.onChunkUnload();
|
||||
if (isConnected()) {
|
||||
disconnect(true);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onChunkUnload() {
|
||||
super.onChunkUnload();
|
||||
if (isConnected()) {
|
||||
disconnect(true);
|
||||
}
|
||||
}
|
||||
|
||||
private int getAdjustedSlot(int slot) {
|
||||
slot %= getSizeInventory();
|
||||
if (isConnected() && !isParent) {
|
||||
slot = (slot + getTrueSizeInventory()) % getSizeInventory();
|
||||
}
|
||||
return slot;
|
||||
}
|
||||
private int getAdjustedSlot(int slot) {
|
||||
slot %= getSizeInventory();
|
||||
if (isConnected() && !isParent) {
|
||||
slot = (slot + getTrueSizeInventory()) % getSizeInventory();
|
||||
}
|
||||
return slot;
|
||||
}
|
||||
|
||||
private TileEntity getTileSafe(int x, int y, int z) {
|
||||
if (exists(x, y, z)) {
|
||||
return worldObj.getTileEntity(x, y, z);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
private TileEntity getTileSafe(int x, int y, int z) {
|
||||
if (exists(x, y, z)) {
|
||||
return worldObj.getTileEntity(x, y, z);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// private Block getBlockSafe(int x, int y, int z) {
|
||||
// if (exists(x, y, z)) {
|
||||
// return worldObj.getBlock(x, y, z);
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// private int getMetaSafe(int x, int y, int z) {
|
||||
// if (exists(x, y, z)) {
|
||||
// return worldObj.getBlockMetadata(x, y, z);
|
||||
// }
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
private boolean exists(int x, int y, int z) {
|
||||
return worldObj.blockExists(x, y, z);
|
||||
}
|
||||
// private Block getBlockSafe(int x, int y, int z) {
|
||||
// if (exists(x, y, z)) {
|
||||
// return worldObj.getBlock(x, y, z);
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// private int getMetaSafe(int x, int y, int z) {
|
||||
// if (exists(x, y, z)) {
|
||||
// return worldObj.getBlockMetadata(x, y, z);
|
||||
// }
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
private boolean exists(int x, int y, int z) {
|
||||
return worldObj.blockExists(x, y, z);
|
||||
}
|
||||
|
||||
/* IInventory */
|
||||
/* IInventory */
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return isConnected() ? getTrueSizeInventory() + connection.getTrueSizeInventory() : getTrueSizeInventory();
|
||||
}
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return isConnected() ? getTrueSizeInventory() + connection.getTrueSizeInventory() : getTrueSizeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slot) {
|
||||
slot = getAdjustedSlot(slot);
|
||||
if (slot >= getTrueSizeInventory()) {
|
||||
return isConnected() ? connection.inventory[slot % getTrueSizeInventory()] : null;
|
||||
} else {
|
||||
return inventory[slot];
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slot) {
|
||||
slot = getAdjustedSlot(slot);
|
||||
if (slot >= getTrueSizeInventory()) {
|
||||
return isConnected() ? connection.inventory[slot % getTrueSizeInventory()] : null;
|
||||
} else {
|
||||
return inventory[slot];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int slot, int amount) {
|
||||
slot = getAdjustedSlot(slot);
|
||||
ItemStack[] inv = inventory;
|
||||
if (isConnected() && slot >= getTrueSizeInventory()) {
|
||||
inv = connection.inventory;
|
||||
slot %= getTrueSizeInventory();
|
||||
connection.markDirty();
|
||||
}
|
||||
@Override
|
||||
public ItemStack decrStackSize(int slot, int amount) {
|
||||
slot = getAdjustedSlot(slot);
|
||||
ItemStack[] inv = inventory;
|
||||
if (isConnected() && slot >= getTrueSizeInventory()) {
|
||||
inv = connection.inventory;
|
||||
slot %= getTrueSizeInventory();
|
||||
connection.markDirty();
|
||||
}
|
||||
|
||||
if (inv[slot] != null) {
|
||||
ItemStack itemstack;
|
||||
if (inv[slot] != null) {
|
||||
ItemStack itemstack;
|
||||
|
||||
if (inv[slot].stackSize <= amount) {
|
||||
itemstack = inv[slot];
|
||||
inv[slot] = null;
|
||||
this.markDirty();
|
||||
return itemstack;
|
||||
} else {
|
||||
itemstack = inv[slot].splitStack(amount);
|
||||
if (inv[slot].stackSize <= amount) {
|
||||
itemstack = inv[slot];
|
||||
inv[slot] = null;
|
||||
this.markDirty();
|
||||
return itemstack;
|
||||
} else {
|
||||
itemstack = inv[slot].splitStack(amount);
|
||||
|
||||
if (inv[slot].stackSize == 0) {
|
||||
inv[slot] = null;
|
||||
}
|
||||
if (inv[slot].stackSize == 0) {
|
||||
inv[slot] = null;
|
||||
}
|
||||
|
||||
this.markDirty();
|
||||
return itemstack;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
this.markDirty();
|
||||
return itemstack;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot) {
|
||||
return getStackInSlot(slot);
|
||||
}
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot) {
|
||||
return getStackInSlot(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slot, ItemStack stack) {
|
||||
slot = getAdjustedSlot(slot);
|
||||
if (slot < getTrueSizeInventory()) {
|
||||
inventory[slot] = stack;
|
||||
} else if (isConnected()) {
|
||||
connection.inventory[slot % getTrueSizeInventory()] = stack;
|
||||
connection.markDirty();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void setInventorySlotContents(int slot, ItemStack stack) {
|
||||
slot = getAdjustedSlot(slot);
|
||||
if (slot < getTrueSizeInventory()) {
|
||||
inventory[slot] = stack;
|
||||
} else if (isConnected()) {
|
||||
connection.inventory[slot % getTrueSizeInventory()] = stack;
|
||||
connection.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "chisel.present";
|
||||
}
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "chisel.present";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 64;
|
||||
}
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer p_70300_1_) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer p_70300_1_) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
;
|
||||
}
|
||||
@Override
|
||||
public void openInventory() {
|
||||
;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
;
|
||||
}
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* IDoubleChest */
|
||||
/* IDoubleChest */
|
||||
|
||||
@Override
|
||||
public int getTrueSizeInventory() {
|
||||
return inventory.length;
|
||||
}
|
||||
@Override
|
||||
public int getTrueSizeInventory() {
|
||||
return inventory.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getTrueStackInSlot(int slot) {
|
||||
return inventory[slot % getTrueSizeInventory()];
|
||||
}
|
||||
@Override
|
||||
public ItemStack getTrueStackInSlot(int slot) {
|
||||
return inventory[slot % getTrueSizeInventory()];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putStackInTrueSlot(int slot, ItemStack stack) {
|
||||
inventory[slot % getTrueSizeInventory()] = stack;
|
||||
}
|
||||
@Override
|
||||
public void putStackInTrueSlot(int slot, ItemStack stack) {
|
||||
inventory[slot % getTrueSizeInventory()] = stack;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user