mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-26 04:59:23 +01:00
Le Cleanup
This commit is contained in:
parent
c7fcdff17e
commit
6b0e24b185
79 changed files with 965 additions and 990 deletions
|
@ -19,15 +19,7 @@ import java.util.ArrayList;
|
|||
|
||||
public class InitAchievements{
|
||||
|
||||
public enum Type{
|
||||
CRAFTING,
|
||||
SMELTING,
|
||||
PICK_UP,
|
||||
MISC
|
||||
}
|
||||
|
||||
public static int pageNumber;
|
||||
|
||||
public static AchievementPage theAchievementPage;
|
||||
public static ArrayList<Achievement> achievementList = new ArrayList<Achievement>();
|
||||
|
||||
|
@ -43,4 +35,11 @@ public class InitAchievements{
|
|||
AchievementPage.registerAchievementPage(theAchievementPage);
|
||||
}
|
||||
|
||||
public enum Type{
|
||||
CRAFTING,
|
||||
SMELTING,
|
||||
PICK_UP,
|
||||
MISC
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -39,10 +39,6 @@ public enum TheAchievements{
|
|||
this(name, x, y, displayStack, hasToHaveBefore, InitAchievements.Type.CRAFTING, false);
|
||||
}
|
||||
|
||||
TheAchievements(String name, int x, int y, ItemStack displayStack, TheAchievements hasToHaveBefore, InitAchievements.Type type){
|
||||
this(name, x, y, displayStack, hasToHaveBefore, type, false);
|
||||
}
|
||||
|
||||
TheAchievements(String name, int x, int y, ItemStack displayStack, TheAchievements hasToHaveBefore, InitAchievements.Type type, boolean special){
|
||||
this.ach = new Achievement("achievement."+ModUtil.MOD_ID_LOWER+"."+name, ModUtil.MOD_ID_LOWER+"."+name, x, y, displayStack, hasToHaveBefore == null ? null : hasToHaveBefore.ach);
|
||||
if(hasToHaveBefore == null){
|
||||
|
@ -54,4 +50,8 @@ public enum TheAchievements{
|
|||
this.ach.registerStat();
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
TheAchievements(String name, int x, int y, ItemStack displayStack, TheAchievements hasToHaveBefore, InitAchievements.Type type){
|
||||
this(name, x, y, displayStack, hasToHaveBefore, type, false);
|
||||
}
|
||||
}
|
|
@ -50,6 +50,14 @@ public class BlockAtomicReconstructor extends BlockContainerBase{
|
|||
return EnumRarity.epic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
|
||||
int rotation = BlockPistonBase.determineOrientation(world, x, y, z, player);
|
||||
world.setBlockMetadataWithNotify(x, y, z, rotation, 2);
|
||||
|
||||
super.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){
|
||||
|
@ -113,14 +121,6 @@ public class BlockAtomicReconstructor extends BlockContainerBase{
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
|
||||
int rotation = BlockPistonBase.determineOrientation(world, x, y, z, player);
|
||||
world.setBlockMetadataWithNotify(x, y, z, rotation, 2);
|
||||
|
||||
super.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
|
|
|
@ -69,6 +69,17 @@ public class BlockBookletStand extends BlockContainerBase{
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = Blocks.planks.getIcon(0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.rare;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
|
||||
int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3;
|
||||
|
@ -99,17 +110,6 @@ public class BlockBookletStand extends BlockContainerBase{
|
|||
super.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = Blocks.planks.getIcon(0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.rare;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i){
|
||||
return new TileEntityBookletStand();
|
||||
|
|
|
@ -93,14 +93,6 @@ public class BlockBreaker extends BlockContainerBase{
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
|
||||
int rotation = BlockPistonBase.determineOrientation(world, x, y, z, player);
|
||||
world.setBlockMetadataWithNotify(x, y, z, rotation, 2);
|
||||
|
||||
super.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
|
@ -114,6 +106,14 @@ public class BlockBreaker extends BlockContainerBase{
|
|||
return EnumRarity.uncommon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
|
||||
int rotation = BlockPistonBase.determineOrientation(world, x, y, z, player);
|
||||
world.setBlockMetadataWithNotify(x, y, z, rotation, 2);
|
||||
|
||||
super.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
this.dropInventory(world, x, y, z);
|
||||
|
|
|
@ -76,26 +76,6 @@ public class BlockCoffeeMachine extends BlockContainerBase{
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
|
||||
int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3;
|
||||
|
||||
if(rotation == 0){
|
||||
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
||||
}
|
||||
if(rotation == 1){
|
||||
world.setBlockMetadataWithNotify(x, y, z, 1, 2);
|
||||
}
|
||||
if(rotation == 2){
|
||||
world.setBlockMetadataWithNotify(x, y, z, 0, 2);
|
||||
}
|
||||
if(rotation == 3){
|
||||
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
||||
}
|
||||
|
||||
super.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
|
@ -117,4 +97,24 @@ public class BlockCoffeeMachine extends BlockContainerBase{
|
|||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.epic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
|
||||
int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3;
|
||||
|
||||
if(rotation == 0){
|
||||
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
||||
}
|
||||
if(rotation == 1){
|
||||
world.setBlockMetadataWithNotify(x, y, z, 1, 2);
|
||||
}
|
||||
if(rotation == 2){
|
||||
world.setBlockMetadataWithNotify(x, y, z, 0, 2);
|
||||
}
|
||||
if(rotation == 3){
|
||||
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
||||
}
|
||||
|
||||
super.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,11 +48,6 @@ public class BlockColoredLamp extends BlockBase{
|
|||
this.isOn = isOn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.rare;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta){
|
||||
|
@ -140,6 +135,11 @@ public class BlockColoredLamp extends BlockBase{
|
|||
return TheItemBlock.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.rare;
|
||||
}
|
||||
|
||||
public static class TheItemBlock extends ItemBlockBase{
|
||||
|
||||
public TheItemBlock(Block block){
|
||||
|
|
|
@ -78,13 +78,13 @@ public class BlockCrystal extends BlockBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return stack.getItemDamage() >= allCrystals.length ? EnumRarity.common : allCrystals[stack.getItemDamage()].rarity;
|
||||
public Class<? extends ItemBlockBase> getItemBlock(){
|
||||
return TheItemBlock.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends ItemBlockBase> getItemBlock(){
|
||||
return TheItemBlock.class;
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return stack.getItemDamage() >= allCrystals.length ? EnumRarity.common : allCrystals[stack.getItemDamage()].rarity;
|
||||
}
|
||||
|
||||
public static class TheItemBlock extends ItemBlockBase{
|
||||
|
|
|
@ -90,14 +90,6 @@ public class BlockDirectionalBreaker extends BlockContainerBase{
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
|
||||
int rotation = BlockPistonBase.determineOrientation(world, x, y, z, player);
|
||||
world.setBlockMetadataWithNotify(x, y, z, rotation, 2);
|
||||
|
||||
super.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
|
@ -111,6 +103,14 @@ public class BlockDirectionalBreaker extends BlockContainerBase{
|
|||
return EnumRarity.epic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
|
||||
int rotation = BlockPistonBase.determineOrientation(world, x, y, z, player);
|
||||
world.setBlockMetadataWithNotify(x, y, z, rotation, 2);
|
||||
|
||||
super.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
this.dropInventory(world, x, y, z);
|
||||
|
|
|
@ -90,14 +90,6 @@ public class BlockDropper extends BlockContainerBase{
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
|
||||
int rotation = BlockPistonBase.determineOrientation(world, x, y, z, player);
|
||||
world.setBlockMetadataWithNotify(x, y, z, rotation, 2);
|
||||
|
||||
super.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
|
@ -111,6 +103,14 @@ public class BlockDropper extends BlockContainerBase{
|
|||
return EnumRarity.rare;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
|
||||
int rotation = BlockPistonBase.determineOrientation(world, x, y, z, player);
|
||||
world.setBlockMetadataWithNotify(x, y, z, rotation, 2);
|
||||
|
||||
super.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
this.dropInventory(world, x, y, z);
|
||||
|
|
|
@ -93,14 +93,6 @@ public class BlockFluidCollector extends BlockContainerBase{
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
|
||||
int rotation = BlockPistonBase.determineOrientation(world, x, y, z, player);
|
||||
world.setBlockMetadataWithNotify(x, y, z, rotation, 2);
|
||||
|
||||
super.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
|
@ -114,6 +106,14 @@ public class BlockFluidCollector extends BlockContainerBase{
|
|||
return EnumRarity.rare;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
|
||||
int rotation = BlockPistonBase.determineOrientation(world, x, y, z, player);
|
||||
world.setBlockMetadataWithNotify(x, y, z, rotation, 2);
|
||||
|
||||
super.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
this.dropInventory(world, x, y, z);
|
||||
|
|
|
@ -131,6 +131,25 @@ public class BlockFurnaceDouble extends BlockContainerBase{
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top");
|
||||
this.onIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"On");
|
||||
this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Front");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockAccess world, int x, int y, int z){
|
||||
return world.getBlockMetadata(x, y, z) > 3 ? 12 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
|
||||
int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3;
|
||||
|
@ -151,25 +170,6 @@ public class BlockFurnaceDouble extends BlockContainerBase{
|
|||
super.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top");
|
||||
this.onIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"On");
|
||||
this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Front");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockAccess world, int x, int y, int z){
|
||||
return world.getBlockMetadata(x, y, z) > 3 ? 12 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
this.dropInventory(world, x, y, z);
|
||||
|
|
|
@ -85,35 +85,6 @@ public class BlockGiantChest extends BlockContainerBase{
|
|||
return EnumRarity.epic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if(tile instanceof TileEntityGiantChest){
|
||||
if(!ItemUtil.contains(((TileEntityGiantChest)tile).slots, new ItemStack(InitItems.itemCrateKeeper), false)){
|
||||
this.dropInventory(world, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack){
|
||||
if(stack.getTagCompound() != null){
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if(tile instanceof TileEntityGiantChest){
|
||||
NBTTagList list = stack.getTagCompound().getTagList("Items", 10);
|
||||
ItemStack[] slots = ((TileEntityGiantChest)tile).slots;
|
||||
|
||||
for(int i = 0; i < list.tagCount(); i++){
|
||||
slots[i] = ItemStack.loadItemStackFromNBT(list.getCompoundTagAt(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.onBlockPlacedBy(world, x, y, z, entity, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune){
|
||||
ArrayList<ItemStack> drops = super.getDrops(world, x, y, z, metadata, fortune);
|
||||
|
@ -147,4 +118,33 @@ public class BlockGiantChest extends BlockContainerBase{
|
|||
|
||||
return drops;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack){
|
||||
if(stack.getTagCompound() != null){
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if(tile instanceof TileEntityGiantChest){
|
||||
NBTTagList list = stack.getTagCompound().getTagList("Items", 10);
|
||||
ItemStack[] slots = ((TileEntityGiantChest)tile).slots;
|
||||
|
||||
for(int i = 0; i < list.tagCount(); i++){
|
||||
slots[i] = ItemStack.loadItemStackFromNBT(list.getCompoundTagAt(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.onBlockPlacedBy(world, x, y, z, entity, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if(tile instanceof TileEntityGiantChest){
|
||||
if(!ItemUtil.contains(((TileEntityGiantChest)tile).slots, new ItemStack(InitItems.itemCrateKeeper), false)){
|
||||
this.dropInventory(world, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,11 +76,6 @@ public class BlockInputter extends BlockContainerBase{
|
|||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.epic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
if(!world.isRemote){
|
||||
|
@ -98,6 +93,11 @@ public class BlockInputter extends BlockContainerBase{
|
|||
return TheItemBlock.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.epic;
|
||||
}
|
||||
|
||||
public static class TheItemBlock extends ItemBlockBase{
|
||||
|
||||
private long lastSysTime;
|
||||
|
|
|
@ -83,11 +83,6 @@ public class BlockLampPowerer extends BlockBase{
|
|||
this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Front");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.rare;
|
||||
}
|
||||
|
||||
private void updateLamp(World world, int x, int y, int z){
|
||||
if(!world.isRemote){
|
||||
WorldPos coords = WorldUtil.getCoordsFromSide(ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z)), world, x, y, z, 0);
|
||||
|
@ -105,4 +100,9 @@ public class BlockLampPowerer extends BlockBase{
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.rare;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,31 +35,6 @@ public class BlockLaserRelay extends BlockContainerBase{
|
|||
this.setStepSound(soundTypeStone);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z){
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
float pixel = 1F/16F;
|
||||
if(meta == 0){
|
||||
this.setBlockBounds(3*pixel, 3*pixel, 3*pixel, 1F-3*pixel, 1F, 1F-3*pixel);
|
||||
}
|
||||
else if(meta == 1){
|
||||
this.setBlockBounds(3*pixel, 0F, 3*pixel, 1F-3*pixel, 1F-3*pixel, 1F-3*pixel);
|
||||
}
|
||||
else if(meta == 2){
|
||||
this.setBlockBounds(3*pixel, 3*pixel, 3*pixel, 1F-3*pixel, 1F-3*pixel, 1F);
|
||||
}
|
||||
else if(meta == 3){
|
||||
this.setBlockBounds(3*pixel, 3*pixel, 0F, 1F-3*pixel, 1F-3*pixel, 1F-3*pixel);
|
||||
}
|
||||
else if(meta == 4){
|
||||
this.setBlockBounds(3*pixel, 3*pixel, 3*pixel, 1F, 1F-3*pixel, 1F-3*pixel);
|
||||
}
|
||||
else if(meta == 5){
|
||||
this.setBlockBounds(0F, 3*pixel, 3*pixel, 1F-3*pixel, 1F-3*pixel, 1F-3*pixel);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock(){
|
||||
return false;
|
||||
|
@ -86,6 +61,31 @@ public class BlockLaserRelay extends BlockContainerBase{
|
|||
return side;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z){
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
float pixel = 1F/16F;
|
||||
if(meta == 0){
|
||||
this.setBlockBounds(3*pixel, 3*pixel, 3*pixel, 1F-3*pixel, 1F, 1F-3*pixel);
|
||||
}
|
||||
else if(meta == 1){
|
||||
this.setBlockBounds(3*pixel, 0F, 3*pixel, 1F-3*pixel, 1F-3*pixel, 1F-3*pixel);
|
||||
}
|
||||
else if(meta == 2){
|
||||
this.setBlockBounds(3*pixel, 3*pixel, 3*pixel, 1F-3*pixel, 1F-3*pixel, 1F);
|
||||
}
|
||||
else if(meta == 3){
|
||||
this.setBlockBounds(3*pixel, 3*pixel, 0F, 1F-3*pixel, 1F-3*pixel, 1F-3*pixel);
|
||||
}
|
||||
else if(meta == 4){
|
||||
this.setBlockBounds(3*pixel, 3*pixel, 3*pixel, 1F, 1F-3*pixel, 1F-3*pixel);
|
||||
}
|
||||
else if(meta == 5){
|
||||
this.setBlockBounds(0F, 3*pixel, 3*pixel, 1F-3*pixel, 1F-3*pixel, 1F-3*pixel);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
|
|
|
@ -54,30 +54,6 @@ public class BlockMiner extends BlockContainerBase{
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.rare;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Front");
|
||||
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i){
|
||||
return new TileEntityMiner();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
this.dropInventory(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||
if(!world.isRemote){
|
||||
|
@ -96,4 +72,28 @@ public class BlockMiner extends BlockContainerBase{
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Front");
|
||||
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.rare;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i){
|
||||
return new TileEntityMiner();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
this.dropInventory(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
}
|
||||
}
|
|
@ -90,13 +90,13 @@ public class BlockMisc extends BlockBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return stack.getItemDamage() >= allMiscBlocks.length ? EnumRarity.common : allMiscBlocks[stack.getItemDamage()].rarity;
|
||||
public Class<? extends ItemBlockBase> getItemBlock(){
|
||||
return TheItemBlock.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends ItemBlockBase> getItemBlock(){
|
||||
return TheItemBlock.class;
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return stack.getItemDamage() >= allMiscBlocks.length ? EnumRarity.common : allMiscBlocks[stack.getItemDamage()].rarity;
|
||||
}
|
||||
|
||||
public static class TheItemBlock extends ItemBlockBase{
|
||||
|
|
|
@ -32,6 +32,10 @@ public class BlockSlabs extends BlockBase{
|
|||
private Block fullBlock;
|
||||
private int meta;
|
||||
|
||||
public BlockSlabs(String name, Block fullBlock){
|
||||
this(name, fullBlock, 0);
|
||||
}
|
||||
|
||||
public BlockSlabs(String name, Block fullBlock, int meta){
|
||||
super(fullBlock.getMaterial(), name);
|
||||
this.setHardness(1.5F);
|
||||
|
@ -40,10 +44,6 @@ public class BlockSlabs extends BlockBase{
|
|||
this.meta = meta;
|
||||
}
|
||||
|
||||
public BlockSlabs(String name, Block fullBlock){
|
||||
this(name, fullBlock, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock(){
|
||||
return false;
|
||||
|
@ -97,13 +97,13 @@ public class BlockSlabs extends BlockBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.common;
|
||||
public Class<? extends ItemBlockBase> getItemBlock(){
|
||||
return TheItemBlock.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends ItemBlockBase> getItemBlock(){
|
||||
return TheItemBlock.class;
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.common;
|
||||
}
|
||||
|
||||
public static class TheItemBlock extends ItemBlockBase{
|
||||
|
|
|
@ -66,6 +66,19 @@ public class BlockSmileyCloud extends BlockContainerBase{
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand){
|
||||
if(Util.RANDOM.nextInt(30) == 0){
|
||||
for(int i = 0; i < 2; i++){
|
||||
double d = Util.RANDOM.nextGaussian()*0.02D;
|
||||
double d1 = Util.RANDOM.nextGaussian()*0.02D;
|
||||
double d2 = Util.RANDOM.nextGaussian()*0.02D;
|
||||
world.spawnParticle("heart", x+Util.RANDOM.nextFloat(), y+0.65+Util.RANDOM.nextFloat(), z+Util.RANDOM.nextFloat(), d, d1, d2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int f6, float f7, float f8, float f9){
|
||||
if(!world.isRemote){
|
||||
|
@ -98,6 +111,28 @@ public class BlockSmileyCloud extends BlockContainerBase{
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = Blocks.wool.getIcon(0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta){
|
||||
return new TileEntitySmileyCloud();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
this.dropInventory(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.rare;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
|
||||
int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3;
|
||||
|
@ -117,39 +152,4 @@ public class BlockSmileyCloud extends BlockContainerBase{
|
|||
|
||||
super.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = Blocks.wool.getIcon(0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta){
|
||||
return new TileEntitySmileyCloud();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
this.dropInventory(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand){
|
||||
if(Util.RANDOM.nextInt(30) == 0){
|
||||
for(int i = 0; i < 2; i++){
|
||||
double d = Util.RANDOM.nextGaussian()*0.02D;
|
||||
double d1 = Util.RANDOM.nextGaussian()*0.02D;
|
||||
double d2 = Util.RANDOM.nextGaussian()*0.02D;
|
||||
world.spawnParticle("heart", x+Util.RANDOM.nextFloat(), y+0.65+Util.RANDOM.nextFloat(), z+Util.RANDOM.nextFloat(), d, d1, d2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.rare;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -144,11 +144,6 @@ public class BlockTreasureChest extends BlockBase{
|
|||
this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Front");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.epic;
|
||||
}
|
||||
|
||||
private void dropItems(World world, int x, int y, int z){
|
||||
for(int i = 0; i < MathHelper.getRandomIntegerInRange(Util.RANDOM, 3, 6); i++){
|
||||
TreasureChestHandler.Return theReturn = (TreasureChestHandler.Return)WeightedRandom.getRandomItem(Util.RANDOM, TreasureChestHandler.returns);
|
||||
|
@ -170,4 +165,9 @@ public class BlockTreasureChest extends BlockBase{
|
|||
itemStack.stackSize = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.epic;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,6 +50,16 @@ public class BlockWildPlant extends BlockBushBase{
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends ItemBlockBase> getItemBlock(){
|
||||
return TheItemBlock.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return stack.getItemDamage() >= allWildPlants.length ? EnumRarity.common : allWildPlants[stack.getItemDamage()].rarity;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata){
|
||||
|
@ -87,16 +97,6 @@ public class BlockWildPlant extends BlockBushBase{
|
|||
return metadata >= allWildPlants.length ? null : allWildPlants[metadata].wildVersionOf.getDrops(world, x, y, z, 7, fortune);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return stack.getItemDamage() >= allWildPlants.length ? EnumRarity.common : allWildPlants[stack.getItemDamage()].rarity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends ItemBlockBase> getItemBlock(){
|
||||
return TheItemBlock.class;
|
||||
}
|
||||
|
||||
public static class TheItemBlock extends ItemBlockBase{
|
||||
|
||||
public TheItemBlock(Block block){
|
||||
|
|
|
@ -91,6 +91,19 @@ public class BlockXPSolidifier extends BlockContainerBase{
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top");
|
||||
this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Front");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.epic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
|
||||
int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3;
|
||||
|
@ -111,19 +124,6 @@ public class BlockXPSolidifier extends BlockContainerBase{
|
|||
super.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top");
|
||||
this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Front");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.epic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
this.dropInventory(world, x, y, z);
|
||||
|
|
|
@ -112,7 +112,7 @@ public class InitBlocks{
|
|||
public static Block blockMiner;
|
||||
|
||||
public static Block blockFireworkBox;
|
||||
|
||||
|
||||
public static Block blockQuartzWall;
|
||||
public static Block blockQuartzStair;
|
||||
public static Block blockQuartzSlab;
|
||||
|
|
|
@ -37,10 +37,6 @@ public class BlockBase extends Block{
|
|||
}
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative(){
|
||||
return true;
|
||||
}
|
||||
|
||||
protected String getBaseName(){
|
||||
return this.name;
|
||||
}
|
||||
|
@ -49,6 +45,10 @@ public class BlockBase extends Block{
|
|||
return ItemBlockBase.class;
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative(){
|
||||
return true;
|
||||
}
|
||||
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.common;
|
||||
}
|
||||
|
|
|
@ -36,10 +36,6 @@ public class BlockBushBase extends BlockBush{
|
|||
}
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative(){
|
||||
return true;
|
||||
}
|
||||
|
||||
protected String getBaseName(){
|
||||
return this.name;
|
||||
}
|
||||
|
@ -48,6 +44,10 @@ public class BlockBushBase extends BlockBush{
|
|||
return ItemBlockBase.class;
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative(){
|
||||
return true;
|
||||
}
|
||||
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.common;
|
||||
}
|
||||
|
|
|
@ -53,10 +53,6 @@ public abstract class BlockContainerBase extends BlockContainer{
|
|||
}
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative(){
|
||||
return true;
|
||||
}
|
||||
|
||||
protected String getBaseName(){
|
||||
return this.name;
|
||||
}
|
||||
|
@ -65,6 +61,10 @@ public abstract class BlockContainerBase extends BlockContainer{
|
|||
return ItemBlockBase.class;
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative(){
|
||||
return true;
|
||||
}
|
||||
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.common;
|
||||
}
|
||||
|
@ -102,30 +102,11 @@ public abstract class BlockContainerBase extends BlockContainer{
|
|||
tile.setInventorySlotContents(i, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasComparatorInputOverride(){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(World world, int x, int y, int z, int meta){
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if(tile instanceof IInventory){
|
||||
return Container.calcRedstoneFromInventory((IInventory)tile);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block){
|
||||
this.updateRedstoneState(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, int x, int y, int z){
|
||||
this.updateRedstoneState(world, x, y, z);
|
||||
}
|
||||
|
||||
public void updateRedstoneState(World world, int x, int y, int z){
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
boolean powered = world.isBlockIndirectlyGettingPowered(x, y, z);
|
||||
|
@ -140,6 +121,34 @@ public abstract class BlockContainerBase extends BlockContainer{
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack){
|
||||
if(stack.getTagCompound() != null){
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if(tile instanceof IEnergySaver){
|
||||
((IEnergySaver)tile).setEnergy(stack.getTagCompound().getInteger("Energy"));
|
||||
}
|
||||
|
||||
if(tile instanceof IFluidSaver){
|
||||
int amount = stack.getTagCompound().getInteger("FluidAmount");
|
||||
|
||||
if(amount > 0){
|
||||
FluidStack[] fluids = new FluidStack[amount];
|
||||
|
||||
for(int i = 0; i < amount; i++){
|
||||
NBTTagCompound compound = stack.getTagCompound().getCompoundTag("Fluid"+i);
|
||||
if(compound != null){
|
||||
fluids[i] = FluidStack.loadFluidStackFromNBT(compound);
|
||||
}
|
||||
}
|
||||
|
||||
((IFluidSaver)tile).setFluids(fluids);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer player){
|
||||
if(!player.capabilities.isCreativeMode){
|
||||
|
@ -147,24 +156,18 @@ public abstract class BlockContainerBase extends BlockContainer{
|
|||
}
|
||||
}
|
||||
|
||||
public boolean tryToggleRedstone(World world, int x, int y, int z, EntityPlayer player){
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
if(stack != null && Block.getBlockFromItem(stack.getItem()) instanceof BlockRedstoneTorch){
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if(tile instanceof IRedstoneToggle){
|
||||
if(!world.isRemote){
|
||||
@Override
|
||||
public boolean hasComparatorInputOverride(){
|
||||
return true;
|
||||
}
|
||||
|
||||
if(((IRedstoneToggle)tile).toggle()){
|
||||
player.addChatComponentMessage(new ChatComponentText("Changed to Redstone Pulse Mode"));
|
||||
}
|
||||
else{
|
||||
player.addChatComponentMessage(new ChatComponentText("Changed to Redstone Deactivation Mode"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public int getComparatorInputOverride(World world, int x, int y, int z, int meta){
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if(tile instanceof IInventory){
|
||||
return Container.calcRedstoneFromInventory((IInventory)tile);
|
||||
}
|
||||
return false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -206,36 +209,33 @@ public abstract class BlockContainerBase extends BlockContainer{
|
|||
|
||||
drops.add(stack);
|
||||
}
|
||||
|
||||
|
||||
return drops;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack){
|
||||
if(stack.getTagCompound() != null){
|
||||
public void onBlockAdded(World world, int x, int y, int z){
|
||||
this.updateRedstoneState(world, x, y, z);
|
||||
}
|
||||
|
||||
public boolean tryToggleRedstone(World world, int x, int y, int z, EntityPlayer player){
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
if(stack != null && Block.getBlockFromItem(stack.getItem()) instanceof BlockRedstoneTorch){
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if(tile instanceof IRedstoneToggle){
|
||||
if(!world.isRemote){
|
||||
|
||||
if(tile instanceof IEnergySaver){
|
||||
((IEnergySaver)tile).setEnergy(stack.getTagCompound().getInteger("Energy"));
|
||||
}
|
||||
|
||||
if(tile instanceof IFluidSaver){
|
||||
int amount = stack.getTagCompound().getInteger("FluidAmount");
|
||||
|
||||
if(amount > 0){
|
||||
FluidStack[] fluids = new FluidStack[amount];
|
||||
|
||||
for(int i = 0; i < amount; i++){
|
||||
NBTTagCompound compound = stack.getTagCompound().getCompoundTag("Fluid"+i);
|
||||
if(compound != null){
|
||||
fluids[i] = FluidStack.loadFluidStackFromNBT(compound);
|
||||
}
|
||||
if(((IRedstoneToggle)tile).toggle()){
|
||||
player.addChatComponentMessage(new ChatComponentText("Changed to Redstone Pulse Mode"));
|
||||
}
|
||||
else{
|
||||
player.addChatComponentMessage(new ChatComponentText("Changed to Redstone Deactivation Mode"));
|
||||
}
|
||||
|
||||
((IFluidSaver)tile).setFluids(fluids);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -51,10 +51,6 @@ public class BlockFluidFlowing extends BlockFluidClassic{
|
|||
}
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative(){
|
||||
return true;
|
||||
}
|
||||
|
||||
protected String getBaseName(){
|
||||
return this.name;
|
||||
}
|
||||
|
@ -63,6 +59,10 @@ public class BlockFluidFlowing extends BlockFluidClassic{
|
|||
return ItemBlockBase.class;
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative(){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDisplace(IBlockAccess world, int x, int y, int z){
|
||||
return !world.getBlock(x, y, z).getMaterial().isLiquid() && super.canDisplace(world, x, y, z);
|
||||
|
|
|
@ -27,7 +27,7 @@ import net.minecraftforge.common.EnumPlantType;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockPlant extends BlockCrops {
|
||||
public class BlockPlant extends BlockCrops{
|
||||
|
||||
public Item seedItem;
|
||||
public Item returnItem;
|
||||
|
@ -56,10 +56,6 @@ public class BlockPlant extends BlockCrops {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative(){
|
||||
return true;
|
||||
}
|
||||
|
||||
protected String getBaseName(){
|
||||
return this.name;
|
||||
}
|
||||
|
@ -68,6 +64,10 @@ public class BlockPlant extends BlockCrops {
|
|||
return ItemBlockBase.class;
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative(){
|
||||
return true;
|
||||
}
|
||||
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.rare;
|
||||
}
|
||||
|
|
|
@ -23,6 +23,10 @@ public class BlockStair extends BlockStairs{
|
|||
|
||||
private String name;
|
||||
|
||||
public BlockStair(Block block, String name){
|
||||
this(block, name, 0);
|
||||
}
|
||||
|
||||
public BlockStair(Block block, String name, int meta){
|
||||
super(block, meta);
|
||||
this.name = name;
|
||||
|
@ -31,10 +35,6 @@ public class BlockStair extends BlockStairs{
|
|||
this.register();
|
||||
}
|
||||
|
||||
public BlockStair(Block block, String name){
|
||||
this(block, name, 0);
|
||||
}
|
||||
|
||||
private void register(){
|
||||
this.setBlockName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName());
|
||||
GameRegistry.registerBlock(this, this.getItemBlock(), this.getBaseName());
|
||||
|
@ -43,10 +43,6 @@ public class BlockStair extends BlockStairs{
|
|||
}
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative(){
|
||||
return true;
|
||||
}
|
||||
|
||||
protected String getBaseName(){
|
||||
return this.name;
|
||||
}
|
||||
|
@ -55,6 +51,10 @@ public class BlockStair extends BlockStairs{
|
|||
return ItemBlockBase.class;
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative(){
|
||||
return true;
|
||||
}
|
||||
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.common;
|
||||
}
|
||||
|
|
|
@ -25,12 +25,16 @@ import net.minecraft.util.IIcon;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockWallAA extends BlockWall {
|
||||
public class BlockWallAA extends BlockWall{
|
||||
|
||||
private String name;
|
||||
private Block baseBlock;
|
||||
private int meta;
|
||||
|
||||
public BlockWallAA(String name, Block base){
|
||||
this(name, base, 0);
|
||||
}
|
||||
|
||||
public BlockWallAA(String name, Block base, int meta){
|
||||
super(base);
|
||||
this.baseBlock = base;
|
||||
|
@ -40,10 +44,6 @@ public class BlockWallAA extends BlockWall {
|
|||
this.register();
|
||||
}
|
||||
|
||||
public BlockWallAA(String name, Block base){
|
||||
this(name, base, 0);
|
||||
}
|
||||
|
||||
private void register(){
|
||||
this.setBlockName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName());
|
||||
GameRegistry.registerBlock(this, this.getItemBlock(), this.getBaseName());
|
||||
|
@ -52,10 +52,6 @@ public class BlockWallAA extends BlockWall {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative(){
|
||||
return true;
|
||||
}
|
||||
|
||||
protected String getBaseName(){
|
||||
return this.name;
|
||||
}
|
||||
|
@ -64,6 +60,10 @@ public class BlockWallAA extends BlockWall {
|
|||
return ItemBlockBase.class;
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative(){
|
||||
return true;
|
||||
}
|
||||
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.common;
|
||||
}
|
||||
|
|
|
@ -22,16 +22,12 @@ public class EntrySet{
|
|||
public BookletEntry entry;
|
||||
public int pageInIndex;
|
||||
|
||||
public EntrySet(BookletPage page, BookletChapter chapter, BookletEntry entry, int pageInIndex){
|
||||
this.setEntry(page, chapter, entry, pageInIndex);
|
||||
}
|
||||
|
||||
public EntrySet(BookletEntry entry){
|
||||
this(null, null, entry, 1);
|
||||
}
|
||||
|
||||
public void removeEntry(){
|
||||
this.setEntry(null, null, null, 1);
|
||||
public EntrySet(BookletPage page, BookletChapter chapter, BookletEntry entry, int pageInIndex){
|
||||
this.setEntry(page, chapter, entry, pageInIndex);
|
||||
}
|
||||
|
||||
public void setEntry(BookletPage page, BookletChapter chapter, BookletEntry entry, int pageInIndex){
|
||||
|
@ -41,15 +37,6 @@ public class EntrySet{
|
|||
this.pageInIndex = pageInIndex;
|
||||
}
|
||||
|
||||
public NBTTagCompound writeToNBT(){
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setInteger("Entry", entry == null ? -1 : InitBooklet.entries.indexOf(entry));
|
||||
compound.setInteger("Chapter", entry == null || chapter == null ? -1 : entry.chapters.indexOf(chapter));
|
||||
compound.setInteger("Page", page == null ? -1 : page.getID());
|
||||
compound.setInteger("PageInIndex", pageInIndex);
|
||||
return compound;
|
||||
}
|
||||
|
||||
public static EntrySet readFromNBT(NBTTagCompound compound){
|
||||
if(compound.hasKey("Entry")){
|
||||
int entry = compound.getInteger("Entry");
|
||||
|
@ -65,4 +52,17 @@ public class EntrySet{
|
|||
}
|
||||
return new EntrySet(null);
|
||||
}
|
||||
|
||||
public void removeEntry(){
|
||||
this.setEntry(null, null, null, 1);
|
||||
}
|
||||
|
||||
public NBTTagCompound writeToNBT(){
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setInteger("Entry", entry == null ? -1 : InitBooklet.entries.indexOf(entry));
|
||||
compound.setInteger("Chapter", entry == null || chapter == null ? -1 : entry.chapters.indexOf(chapter));
|
||||
compound.setInteger("Page", page == null ? -1 : page.getID());
|
||||
compound.setInteger("PageInIndex", pageInIndex);
|
||||
return compound;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,16 +50,13 @@ public class GuiBooklet extends GuiScreen{
|
|||
|
||||
public static final int CHAPTER_BUTTONS_AMOUNT = 13;
|
||||
public static final int INDEX_BUTTONS_OFFSET = 3;
|
||||
|
||||
private static final int[] AND_HIS_NAME_IS = new int[]{Keyboard.KEY_C, Keyboard.KEY_E, Keyboard.KEY_N, Keyboard.KEY_A};
|
||||
public int xSize;
|
||||
public int ySize;
|
||||
public int guiLeft;
|
||||
public int guiTop;
|
||||
|
||||
public EntrySet currentEntrySet = new EntrySet(null);
|
||||
|
||||
public int indexPageAmount;
|
||||
|
||||
public GuiButton buttonForward;
|
||||
public GuiButton buttonBackward;
|
||||
public GuiButton buttonPreviousScreen;
|
||||
|
@ -69,17 +66,13 @@ public class GuiBooklet extends GuiScreen{
|
|||
public GuiButton buttonAchievements;
|
||||
public GuiButton buttonConfig;
|
||||
public GuiButton[] chapterButtons = new GuiButton[CHAPTER_BUTTONS_AMOUNT];
|
||||
|
||||
public GuiButton[] bookmarkButtons = new GuiButton[8];
|
||||
|
||||
public GuiTextField searchField;
|
||||
public GuiScreen parentScreen;
|
||||
private int ticksElapsed;
|
||||
private boolean mousePressed;
|
||||
private boolean tryOpenMainPage;
|
||||
private boolean saveOnClose;
|
||||
|
||||
private static final int[] AND_HIS_NAME_IS = new int[]{Keyboard.KEY_C, Keyboard.KEY_E, Keyboard.KEY_N, Keyboard.KEY_A};
|
||||
private int hisNameIsAt;
|
||||
|
||||
public GuiBooklet(GuiScreen parentScreen, boolean tryOpenMainPage, boolean saveOnClose){
|
||||
|
@ -153,21 +146,6 @@ public class GuiBooklet extends GuiScreen{
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
//For scrolling through pages
|
||||
public void handleMouseInput(){
|
||||
int wheel = Mouse.getEventDWheel();
|
||||
if(wheel != 0){
|
||||
if(wheel > 0){
|
||||
BookletUtils.handleNextPage(this);
|
||||
}
|
||||
else if(wheel < 0){
|
||||
BookletUtils.handlePreviousPage(this);
|
||||
}
|
||||
}
|
||||
super.handleMouseInput();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyTyped(char theChar, int key){
|
||||
if(key == Keyboard.KEY_ESCAPE || (!this.searchField.isFocused() && key == Minecraft.getMinecraft().gameSettings.keyBindInventory.getKeyCode())){
|
||||
|
@ -339,6 +317,21 @@ public class GuiBooklet extends GuiScreen{
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
//For scrolling through pages
|
||||
public void handleMouseInput(){
|
||||
int wheel = Mouse.getEventDWheel();
|
||||
if(wheel != 0){
|
||||
if(wheel > 0){
|
||||
BookletUtils.handleNextPage(this);
|
||||
}
|
||||
else if(wheel < 0){
|
||||
BookletUtils.handlePreviousPage(this);
|
||||
}
|
||||
}
|
||||
super.handleMouseInput();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateScreen(){
|
||||
super.updateScreen();
|
||||
|
|
|
@ -26,6 +26,10 @@ public class TexturedButton extends GuiButton{
|
|||
|
||||
public List textList = new ArrayList();
|
||||
|
||||
public TexturedButton(int id, int x, int y, int texturePosX, int texturePosY, int width, int height){
|
||||
this(id, x, y, texturePosX, texturePosY, width, height, new ArrayList());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public TexturedButton(int id, int x, int y, int texturePosX, int texturePosY, int width, int height, List hoverTextList){
|
||||
super(id, x, y, width, height, "");
|
||||
|
@ -34,10 +38,6 @@ public class TexturedButton extends GuiButton{
|
|||
this.textList.addAll(hoverTextList);
|
||||
}
|
||||
|
||||
public TexturedButton(int id, int x, int y, int texturePosX, int texturePosY, int width, int height){
|
||||
this(id, x, y, texturePosX, texturePosY, width, height, new ArrayList());
|
||||
}
|
||||
|
||||
public void setTexturePos(int x, int y){
|
||||
this.texturePosX = x;
|
||||
this.texturePosY = y;
|
||||
|
|
|
@ -116,7 +116,7 @@ public class CreativeTab extends CreativeTabs{
|
|||
add(InitBlocks.blockPillarQuartzWall);
|
||||
add(InitBlocks.blockPillarQuartzStair);
|
||||
add(InitBlocks.blockPillarQuartzSlab);
|
||||
|
||||
|
||||
add(InitBlocks.blockColoredLamp);
|
||||
add(InitBlocks.blockLampPowerer);
|
||||
add(InitBlocks.blockTreasureChest);
|
||||
|
|
|
@ -39,6 +39,18 @@ public class GuiMiner extends GuiContainer{
|
|||
this.ySize = 93+86;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void initGui(){
|
||||
super.initGui();
|
||||
|
||||
GuiButton buttonMode = new GuiButton(0, guiLeft+xSize/2-51, guiTop+75, 50, 20, "Mode");
|
||||
this.buttonList.add(buttonMode);
|
||||
|
||||
GuiButton buttonReset = new GuiButton(1, guiLeft+xSize/2+1, guiTop+75, 50, 20, "Reset");
|
||||
this.buttonList.add(buttonReset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int x, int y, float f){
|
||||
super.drawScreen(x, y, f);
|
||||
|
@ -63,18 +75,6 @@ public class GuiMiner extends GuiContainer{
|
|||
this.fontRendererObj.drawString(mining, this.guiLeft+this.xSize/2-fontRendererObj.getStringWidth(mining)/2, guiTop+8, StringUtil.DECIMAL_COLOR_GRAY_TEXT);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void initGui(){
|
||||
super.initGui();
|
||||
|
||||
GuiButton buttonMode = new GuiButton(0, guiLeft+xSize/2-51, guiTop+75, 50, 20, "Mode");
|
||||
this.buttonList.add(buttonMode);
|
||||
|
||||
GuiButton buttonReset = new GuiButton(1, guiLeft+xSize/2+1, guiTop+75, 50, 20, "Reset");
|
||||
this.buttonList.add(buttonReset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(GuiButton button){
|
||||
PacketHandler.theNetwork.sendToServer(new PacketGuiButton(miner.xCoord, miner.yCoord, miner.zCoord, miner.getWorldObj(), button.id, Minecraft.getMinecraft().thePlayer));
|
||||
|
|
|
@ -52,14 +52,14 @@ public class ItemSeed extends ItemSeeds{
|
|||
}
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative(){
|
||||
return true;
|
||||
}
|
||||
|
||||
protected String getBaseName(){
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative(){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.rare;
|
||||
|
|
|
@ -36,7 +36,7 @@ import java.util.HashSet;
|
|||
import java.util.Set;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public class ItemAllToolAA extends ItemTool {
|
||||
public class ItemAllToolAA extends ItemTool{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon overlayIcon;
|
||||
|
@ -68,14 +68,14 @@ public class ItemAllToolAA extends ItemTool {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative(){
|
||||
return true;
|
||||
}
|
||||
|
||||
protected String getBaseName(){
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative(){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ){
|
||||
if(!player.canPlayerEdit(x, y, z, side, stack)){
|
||||
|
|
|
@ -50,14 +50,14 @@ public class ItemArmorAA extends ItemArmor{
|
|||
}
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative(){
|
||||
return true;
|
||||
}
|
||||
|
||||
protected String getBaseName(){
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative(){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.rare;
|
||||
|
|
|
@ -22,7 +22,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class ItemAxeAA extends ItemAxe {
|
||||
public class ItemAxeAA extends ItemAxe{
|
||||
|
||||
private String name;
|
||||
private EnumRarity rarity;
|
||||
|
@ -48,14 +48,14 @@ public class ItemAxeAA extends ItemAxe {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative(){
|
||||
return true;
|
||||
}
|
||||
|
||||
protected String getBaseName(){
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative(){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){
|
||||
int[] idsStack = OreDictionary.getOreIDs(stack);
|
||||
|
|
|
@ -34,11 +34,11 @@ public class ItemBase extends Item{
|
|||
}
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative(){
|
||||
return true;
|
||||
}
|
||||
|
||||
protected String getBaseName(){
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative(){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ import net.minecraft.item.ItemBucket;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class ItemBucketAA extends ItemBucket {
|
||||
public class ItemBucketAA extends ItemBucket{
|
||||
|
||||
private String name;
|
||||
|
||||
|
@ -43,14 +43,14 @@ public class ItemBucketAA extends ItemBucket {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative(){
|
||||
return true;
|
||||
}
|
||||
|
||||
protected String getBaseName(){
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative(){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.uncommon;
|
||||
|
|
|
@ -25,7 +25,7 @@ import net.minecraft.world.World;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class ItemEnergy extends ItemEnergyContainer {
|
||||
public abstract class ItemEnergy extends ItemEnergyContainer{
|
||||
|
||||
private String name;
|
||||
|
||||
|
@ -46,14 +46,14 @@ public abstract class ItemEnergy extends ItemEnergyContainer {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative(){
|
||||
return true;
|
||||
}
|
||||
|
||||
protected String getBaseName(){
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative(){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getShareTag(){
|
||||
return true;
|
||||
|
|
|
@ -35,11 +35,11 @@ public class ItemFoodBase extends ItemFood{
|
|||
}
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative(){
|
||||
return true;
|
||||
}
|
||||
|
||||
protected String getBaseName(){
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative(){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class ItemHoeAA extends ItemHoe {
|
||||
public class ItemHoeAA extends ItemHoe{
|
||||
|
||||
private String name;
|
||||
private EnumRarity rarity;
|
||||
|
@ -49,14 +49,14 @@ public class ItemHoeAA extends ItemHoe {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative(){
|
||||
return true;
|
||||
}
|
||||
|
||||
protected String getBaseName(){
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative(){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return this.rarity;
|
||||
|
|
|
@ -48,14 +48,14 @@ public class ItemPickaxeAA extends ItemPickaxe{
|
|||
}
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative(){
|
||||
return true;
|
||||
}
|
||||
|
||||
protected String getBaseName(){
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative(){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){
|
||||
int[] idsStack = OreDictionary.getOreIDs(stack);
|
||||
|
|
|
@ -23,7 +23,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class ItemShovelAA extends ItemSpade {
|
||||
public class ItemShovelAA extends ItemSpade{
|
||||
|
||||
private String name;
|
||||
private EnumRarity rarity;
|
||||
|
@ -49,14 +49,14 @@ public class ItemShovelAA extends ItemSpade {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative(){
|
||||
return true;
|
||||
}
|
||||
|
||||
protected String getBaseName(){
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative(){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){
|
||||
int[] idsStack = OreDictionary.getOreIDs(stack);
|
||||
|
|
|
@ -23,7 +23,7 @@ import net.minecraft.item.ItemSword;
|
|||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class ItemSwordAA extends ItemSword {
|
||||
public class ItemSwordAA extends ItemSword{
|
||||
|
||||
private String name;
|
||||
private EnumRarity rarity;
|
||||
|
@ -49,14 +49,14 @@ public class ItemSwordAA extends ItemSword {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative(){
|
||||
return true;
|
||||
}
|
||||
|
||||
protected String getBaseName(){
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative(){
|
||||
return true;
|
||||
}
|
||||
|
||||
protected Class<? extends ItemBlockBase> getItemBlock(){
|
||||
return ItemBlockBase.class;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,17 @@ import java.util.ArrayList;
|
|||
|
||||
public class LensColor extends Lens{
|
||||
|
||||
public static final int ENERGY_USE = 200;
|
||||
public static final Object[] CONVERTABLE_BLOCKS = new Object[]{
|
||||
Items.dye,
|
||||
Blocks.wool,
|
||||
Blocks.stained_glass,
|
||||
Blocks.stained_glass_pane,
|
||||
Blocks.stained_hardened_clay,
|
||||
Blocks.carpet,
|
||||
InitBlocks.blockColoredLamp,
|
||||
InitBlocks.blockColoredLampOn
|
||||
};
|
||||
//Thanks to xdjackiexd for this, as I couldn't be bothered
|
||||
private static final float[][] possibleColorLensColors = {
|
||||
{158F, 43F, 39F}, //Red
|
||||
|
@ -40,19 +51,6 @@ public class LensColor extends Lens{
|
|||
{86F, 51F, 28F}, //Brown
|
||||
};
|
||||
|
||||
public static final int ENERGY_USE = 200;
|
||||
|
||||
public static final Object[] CONVERTABLE_BLOCKS = new Object[]{
|
||||
Items.dye,
|
||||
Blocks.wool,
|
||||
Blocks.stained_glass,
|
||||
Blocks.stained_glass_pane,
|
||||
Blocks.stained_hardened_clay,
|
||||
Blocks.carpet,
|
||||
InitBlocks.blockColoredLamp,
|
||||
InitBlocks.blockColoredLampOn
|
||||
};
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public boolean invoke(WorldPos hitBlock, TileEntityAtomicReconstructor tile){
|
||||
|
|
|
@ -122,10 +122,9 @@ public class LensNoneRecipeHandler{
|
|||
|
||||
public static class Recipe{
|
||||
|
||||
public int energyUse;
|
||||
private String input;
|
||||
private String output;
|
||||
public int energyUse;
|
||||
|
||||
private ItemStack inputStack;
|
||||
private ItemStack outputStack;
|
||||
|
||||
|
|
|
@ -50,6 +50,25 @@ public class PacketParticle implements IMessage{
|
|||
this.particleSize = particleSize;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void renderParticlesFromAToB(int startX, int startY, int startZ, int endX, int endY, int endZ, int particleAmount, float particleSize, float[] color, float ageMultiplier){
|
||||
World world = Minecraft.getMinecraft().theWorld;
|
||||
|
||||
if(Minecraft.getMinecraft().thePlayer.getDistance(startX, startY, startZ) <= 64 || Minecraft.getMinecraft().thePlayer.getDistance(endX, endY, endZ) <= 64){
|
||||
int difX = startX-endX;
|
||||
int difY = startY-endY;
|
||||
int difZ = startZ-endZ;
|
||||
double distance = Vec3.createVectorHelper(startX, startY, startZ).distanceTo(Vec3.createVectorHelper(endX, endY, endZ));
|
||||
|
||||
for(int times = 0; times < particleAmount/2; times++){
|
||||
for(double i = 0; i <= 1; i += 1/(distance*particleAmount)){
|
||||
EntityColoredParticleFX fx = new EntityColoredParticleFX(world, (difX*i)+endX+0.5, (difY*i)+endY+0.5, (difZ*i)+endZ+0.5, particleSize, color[0], color[1], color[2], ageMultiplier);
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(fx);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf){
|
||||
this.startX = buf.readInt();
|
||||
|
@ -92,23 +111,4 @@ public class PacketParticle implements IMessage{
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void renderParticlesFromAToB(int startX, int startY, int startZ, int endX, int endY, int endZ, int particleAmount, float particleSize, float[] color, float ageMultiplier){
|
||||
World world = Minecraft.getMinecraft().theWorld;
|
||||
|
||||
if(Minecraft.getMinecraft().thePlayer.getDistance(startX, startY, startZ) <= 64 || Minecraft.getMinecraft().thePlayer.getDistance(endX, endY, endZ) <= 64){
|
||||
int difX = startX-endX;
|
||||
int difY = startY-endY;
|
||||
int difZ = startZ-endZ;
|
||||
double distance = Vec3.createVectorHelper(startX, startY, startZ).distanceTo(Vec3.createVectorHelper(endX, endY, endZ));
|
||||
|
||||
for(int times = 0; times < particleAmount/2; times++){
|
||||
for(double i = 0; i <= 1; i += 1/(distance*particleAmount)){
|
||||
EntityColoredParticleFX fx = new EntityColoredParticleFX(world, (difX*i)+endX+0.5, (difY*i)+endY+0.5, (difZ*i)+endZ+0.5, particleSize, color[0], color[1], color[2], ageMultiplier);
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(fx);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,12 +26,6 @@ public class CrusherRecipeRegistry{
|
|||
public static ArrayList<CrusherRecipe> recipes = new ArrayList<CrusherRecipe>();
|
||||
public static ArrayList<SearchCase> searchCases = new ArrayList<SearchCase>();
|
||||
|
||||
public static void addRecipe(String input, String outputOne, int outputOneAmount, String outputTwo, int outputTwoAmount, int outputTwoChance){
|
||||
if(!OreDictionary.getOres(input, false).isEmpty() && !OreDictionary.getOres(outputOne, false).isEmpty() && (outputTwo == null || outputTwo.isEmpty() || !OreDictionary.getOres(outputTwo, false).isEmpty())){
|
||||
recipes.add(new CrusherRecipe(input, outputOne, outputOneAmount, outputTwo, outputTwoAmount, outputTwoChance));
|
||||
}
|
||||
}
|
||||
|
||||
public static void registerFinally(){
|
||||
ArrayList<String> oresNoResult = new ArrayList<String>();
|
||||
int recipeStartedAt = recipes.size();
|
||||
|
@ -86,22 +80,28 @@ public class CrusherRecipeRegistry{
|
|||
return false;
|
||||
}
|
||||
|
||||
public static void addRecipe(ItemStack input, ItemStack outputOne){
|
||||
addRecipe(input, outputOne, null, 0);
|
||||
public static void addRecipe(String input, String outputOne, int outputOneAmount){
|
||||
addRecipe(input, outputOne, outputOneAmount, "", 0, 0);
|
||||
}
|
||||
|
||||
public static void addRecipe(ItemStack input, String outputOne, int outputOneAmount){
|
||||
if(!OreDictionary.getOres(outputOne, false).isEmpty()){
|
||||
recipes.add(new CrusherRecipe(input, outputOne, outputOneAmount));
|
||||
public static void addRecipe(String input, String outputOne, int outputOneAmount, String outputTwo, int outputTwoAmount, int outputTwoChance){
|
||||
if(!OreDictionary.getOres(input, false).isEmpty() && !OreDictionary.getOres(outputOne, false).isEmpty() && (outputTwo == null || outputTwo.isEmpty() || !OreDictionary.getOres(outputTwo, false).isEmpty())){
|
||||
recipes.add(new CrusherRecipe(input, outputOne, outputOneAmount, outputTwo, outputTwoAmount, outputTwoChance));
|
||||
}
|
||||
}
|
||||
|
||||
public static void addRecipe(ItemStack input, ItemStack outputOne){
|
||||
addRecipe(input, outputOne, null, 0);
|
||||
}
|
||||
|
||||
public static void addRecipe(ItemStack input, ItemStack outputOne, ItemStack outputTwo, int outputTwoChance){
|
||||
recipes.add(new CrusherRecipe(input, outputOne, outputTwo, outputTwoChance));
|
||||
}
|
||||
|
||||
public static void addRecipe(String input, String outputOne, int outputOneAmount){
|
||||
addRecipe(input, outputOne, outputOneAmount, "", 0, 0);
|
||||
public static void addRecipe(ItemStack input, String outputOne, int outputOneAmount){
|
||||
if(!OreDictionary.getOres(outputOne, false).isEmpty()){
|
||||
recipes.add(new CrusherRecipe(input, outputOne, outputOneAmount));
|
||||
}
|
||||
}
|
||||
|
||||
public static List<ItemStack> getOutputOnes(ItemStack input){
|
||||
|
@ -130,15 +130,12 @@ public class CrusherRecipeRegistry{
|
|||
|
||||
public static class CrusherRecipe{
|
||||
|
||||
public int outputTwoChance;
|
||||
private String input;
|
||||
|
||||
private String outputOne;
|
||||
private int outputOneAmount;
|
||||
|
||||
private String outputTwo;
|
||||
private int outputTwoAmount;
|
||||
public int outputTwoChance;
|
||||
|
||||
private ItemStack inputStack;
|
||||
private ItemStack outputOneStack;
|
||||
private ItemStack outputTwoStack;
|
||||
|
|
|
@ -30,6 +30,7 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
|
|||
public static final int ENERGY_USE = 1000;
|
||||
public EnergyStorage storage = new EnergyStorage(3000000);
|
||||
private int currentTime;
|
||||
private boolean activateOnceWithSignal;
|
||||
|
||||
public TileEntityAtomicReconstructor(){
|
||||
super(1, "reconstructor");
|
||||
|
@ -111,11 +112,6 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
|
|||
this.storage.readFromNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return stack != null && stack.getItem() instanceof ItemLens;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack stack){
|
||||
super.setInventorySlotContents(i, stack);
|
||||
|
@ -153,6 +149,11 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
|
|||
return this.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return stack != null && stack.getItem() instanceof ItemLens;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack stack, int side){
|
||||
return true;
|
||||
|
@ -168,8 +169,6 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
|
|||
this.storage.setEnergyStored(energy);
|
||||
}
|
||||
|
||||
private boolean activateOnceWithSignal;
|
||||
|
||||
@Override
|
||||
public boolean toggle(){
|
||||
return this.activateOnceWithSignal = !this.activateOnceWithSignal;
|
||||
|
|
|
@ -93,10 +93,6 @@ public abstract class TileEntityBase extends TileEntity{
|
|||
this.ticksElapsed++;
|
||||
}
|
||||
|
||||
public void setRedstonePowered(boolean powered){
|
||||
this.isRedstonePowered = powered;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket(){
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
|
@ -122,6 +118,10 @@ public abstract class TileEntityBase extends TileEntity{
|
|||
|
||||
}
|
||||
|
||||
public void setRedstonePowered(boolean powered){
|
||||
this.isRedstonePowered = powered;
|
||||
}
|
||||
|
||||
protected boolean sendUpdateWithInterval(){
|
||||
if(this.ticksElapsed%ConfigIntValues.TILE_ENTITY_UPDATE_INTERVAL.getValue() == 0){
|
||||
this.sendUpdate();
|
||||
|
|
|
@ -24,6 +24,7 @@ public class TileEntityBreaker extends TileEntityInventoryBase implements IRedst
|
|||
|
||||
public boolean isPlacer;
|
||||
private int currentTime;
|
||||
private boolean activateOnceWithSignal;
|
||||
|
||||
public TileEntityBreaker(int slots, String name){
|
||||
super(slots, name);
|
||||
|
@ -34,18 +35,6 @@ public class TileEntityBreaker extends TileEntityInventoryBase implements IRedst
|
|||
this.isPlacer = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
compound.setInteger("CurrentTime", this.currentTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
this.currentTime = compound.getInteger("CurrentTime");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void updateEntity(){
|
||||
|
@ -65,6 +54,18 @@ public class TileEntityBreaker extends TileEntityInventoryBase implements IRedst
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
compound.setInteger("CurrentTime", this.currentTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
this.currentTime = compound.getInteger("CurrentTime");
|
||||
}
|
||||
|
||||
private void doWork(){
|
||||
ForgeDirection sideToManipulate = ForgeDirection.getOrientation(worldObj.getBlockMetadata(xCoord, yCoord, zCoord));
|
||||
|
||||
|
@ -94,13 +95,13 @@ public class TileEntityBreaker extends TileEntityInventoryBase implements IRedst
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return this.isPlacer;
|
||||
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
||||
return this.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
||||
return this.isItemValidForSlot(slot, stack);
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return this.isPlacer;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -108,21 +109,19 @@ public class TileEntityBreaker extends TileEntityInventoryBase implements IRedst
|
|||
return true;
|
||||
}
|
||||
|
||||
private boolean activateOnceWithSignal;
|
||||
|
||||
@Override
|
||||
public boolean toggle(){
|
||||
return this.activateOnceWithSignal = !this.activateOnceWithSignal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activateOnPulse(){
|
||||
this.doWork();
|
||||
public boolean isRightMode(){
|
||||
return this.activateOnceWithSignal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRightMode(){
|
||||
return this.activateOnceWithSignal;
|
||||
public void activateOnPulse(){
|
||||
this.doWork();
|
||||
}
|
||||
|
||||
public static class TileEntityPlacer extends TileEntityBreaker{
|
||||
|
|
|
@ -55,22 +55,6 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IE
|
|||
return this.storage.getEnergyStored()*i/this.storage.getMaxEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
compound.setInteger("ProcessTime", this.currentProcessTime);
|
||||
this.storage.writeToNBT(compound);
|
||||
this.tank.writeToNBT(compound);
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.currentProcessTime = compound.getInteger("ProcessTime");
|
||||
this.storage.readFromNBT(compound);
|
||||
this.tank.readFromNBT(compound);
|
||||
super.readSyncableNBT(compound, sync);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void updateEntity(){
|
||||
|
@ -117,18 +101,34 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IE
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
compound.setInteger("ProcessTime", this.currentProcessTime);
|
||||
this.storage.writeToNBT(compound);
|
||||
this.tank.writeToNBT(compound);
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.currentProcessTime = compound.getInteger("ProcessTime");
|
||||
this.storage.readFromNBT(compound);
|
||||
this.tank.readFromNBT(compound);
|
||||
super.readSyncableNBT(compound, sync);
|
||||
}
|
||||
|
||||
public boolean isCanola(int slot){
|
||||
return this.slots[slot] != null && this.slots[slot].getItem() == InitItems.itemMisc && this.slots[slot].getItemDamage() == TheMiscItems.CANOLA.ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return (i == 0 && stack.getItem() == InitItems.itemMisc && stack.getItemDamage() == TheMiscItems.CANOLA.ordinal()) || (i == 1 && stack.getItem() == Items.bucket);
|
||||
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
||||
return this.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
||||
return this.isItemValidForSlot(slot, stack);
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return (i == 0 && stack.getItem() == InitItems.itemMisc && stack.getItemDamage() == TheMiscItems.CANOLA.ordinal()) || (i == 1 && stack.getItem() == Items.bucket);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -44,22 +44,6 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements
|
|||
return this.currentBurnTime*i/this.maxBurnTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
compound.setInteger("BurnTime", this.currentBurnTime);
|
||||
compound.setInteger("MaxBurnTime", this.maxBurnTime);
|
||||
this.storage.writeToNBT(compound);
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.currentBurnTime = compound.getInteger("BurnTime");
|
||||
this.maxBurnTime = compound.getInteger("MaxBurnTime");
|
||||
this.storage.readFromNBT(compound);
|
||||
super.readSyncableNBT(compound, sync);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void updateEntity(){
|
||||
|
@ -114,8 +98,19 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return TileEntityFurnace.getItemBurnTime(stack) > 0;
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
compound.setInteger("BurnTime", this.currentBurnTime);
|
||||
compound.setInteger("MaxBurnTime", this.maxBurnTime);
|
||||
this.storage.writeToNBT(compound);
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.currentBurnTime = compound.getInteger("BurnTime");
|
||||
this.maxBurnTime = compound.getInteger("MaxBurnTime");
|
||||
this.storage.readFromNBT(compound);
|
||||
super.readSyncableNBT(compound, sync);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -123,6 +118,11 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements
|
|||
return this.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return TileEntityFurnace.getItemBurnTime(stack) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack stack, int side){
|
||||
return false;
|
||||
|
|
|
@ -71,24 +71,6 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
|
|||
return this.brewTime*i/TIME_USED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
this.storage.writeToNBT(compound);
|
||||
this.tank.writeToNBT(compound);
|
||||
compound.setInteger("Cache", this.coffeeCacheAmount);
|
||||
compound.setInteger("Time", this.brewTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
this.storage.readFromNBT(compound);
|
||||
this.tank.readFromNBT(compound);
|
||||
this.coffeeCacheAmount = compound.getInteger("Cache");
|
||||
this.brewTime = compound.getInteger("Time");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity(){
|
||||
super.updateEntity();
|
||||
|
@ -108,6 +90,24 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
this.storage.writeToNBT(compound);
|
||||
this.tank.writeToNBT(compound);
|
||||
compound.setInteger("Cache", this.coffeeCacheAmount);
|
||||
compound.setInteger("Time", this.brewTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
this.storage.readFromNBT(compound);
|
||||
this.tank.readFromNBT(compound);
|
||||
this.coffeeCacheAmount = compound.getInteger("Cache");
|
||||
this.brewTime = compound.getInteger("Time");
|
||||
}
|
||||
|
||||
public void storeCoffee(){
|
||||
if(this.slots[SLOT_COFFEE_BEANS] != null && this.slots[SLOT_COFFEE_BEANS].getItem() == InitItems.itemCoffeeBean){
|
||||
int toAdd = 2;
|
||||
|
@ -127,7 +127,7 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
|
|||
if(!worldObj.isRemote){
|
||||
if(this.slots[SLOT_INPUT] != null && this.slots[SLOT_INPUT].getItem() == InitItems.itemMisc && this.slots[SLOT_INPUT].getItemDamage() == TheMiscItems.CUP.ordinal() && this.slots[SLOT_OUTPUT] == null && this.coffeeCacheAmount >= CACHE_USE && this.tank.getFluid() != null && this.tank.getFluid().getFluid() == FluidRegistry.WATER && this.tank.getFluidAmount() >= WATER_USE){
|
||||
if(this.storage.getEnergyStored() >= ENERGY_USED){
|
||||
if(this.brewTime % 30 == 0){
|
||||
if(this.brewTime%30 == 0){
|
||||
this.worldObj.playSoundEffect(xCoord, yCoord, zCoord, ModUtil.MOD_ID_LOWER+":coffeeMachine", 0.35F, 1.0F);
|
||||
}
|
||||
|
||||
|
@ -166,13 +166,13 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return (i >= 3 && ItemCoffee.getIngredientFromStack(stack) != null) || (i == SLOT_COFFEE_BEANS && stack.getItem() == InitItems.itemCoffeeBean) || (i == SLOT_INPUT && stack.getItem() == InitItems.itemMisc && stack.getItemDamage() == TheMiscItems.CUP.ordinal()) || (i == SLOT_WATER_INPUT && FluidContainerRegistry.containsFluid(stack, new FluidStack(FluidRegistry.WATER, 1)));
|
||||
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
||||
return this.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
||||
return this.isItemValidForSlot(slot, stack);
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return (i >= 3 && ItemCoffee.getIngredientFromStack(stack) != null) || (i == SLOT_COFFEE_BEANS && stack.getItem() == InitItems.itemCoffeeBean) || (i == SLOT_INPUT && stack.getItem() == InitItems.itemMisc && stack.getItemDamage() == TheMiscItems.CUP.ordinal()) || (i == SLOT_WATER_INPUT && FluidContainerRegistry.containsFluid(stack, new FluidStack(FluidRegistry.WATER, 1)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -26,18 +26,6 @@ public class TileEntityCompost extends TileEntityInventoryBase{
|
|||
super(1, "compost");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
compound.setInteger("ConversionTime", this.conversionTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
this.conversionTime = compound.getInteger("ConversionTime");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity(){
|
||||
super.updateEntity();
|
||||
|
@ -70,13 +58,20 @@ public class TileEntityCompost extends TileEntityInventoryBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit(){
|
||||
return AMOUNT;
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
compound.setInteger("ConversionTime", this.conversionTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return stack.getItem() instanceof ItemMisc && stack.getItemDamage() == TheMiscItems.MASHED_FOOD.ordinal();
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
this.conversionTime = compound.getInteger("ConversionTime");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit(){
|
||||
return AMOUNT;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -84,6 +79,11 @@ public class TileEntityCompost extends TileEntityInventoryBase{
|
|||
return this.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return stack.getItem() instanceof ItemMisc && stack.getItemDamage() == TheMiscItems.MASHED_FOOD.ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack stack, int side){
|
||||
return stack.getItem() instanceof ItemFertilizer;
|
||||
|
|
|
@ -31,6 +31,7 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implem
|
|||
public EnergyStorage storage = new EnergyStorage(10000);
|
||||
private int lastEnergy;
|
||||
private int currentTime;
|
||||
private boolean activateOnceWithSignal;
|
||||
|
||||
public TileEntityDirectionalBreaker(){
|
||||
super(9, "directionalBreaker");
|
||||
|
@ -99,11 +100,6 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implem
|
|||
this.currentTime = compound.getInteger("CurrentTime");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return false;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getEnergyScaled(int i){
|
||||
return this.storage.getEnergyStored()*i/this.storage.getMaxEnergyStored();
|
||||
|
@ -114,6 +110,11 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implem
|
|||
return this.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack stack, int side){
|
||||
return true;
|
||||
|
@ -149,8 +150,6 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implem
|
|||
this.storage.setEnergyStored(energy);
|
||||
}
|
||||
|
||||
private boolean activateOnceWithSignal;
|
||||
|
||||
@Override
|
||||
public boolean toggle(){
|
||||
return this.activateOnceWithSignal = !this.activateOnceWithSignal;
|
||||
|
|
|
@ -18,23 +18,12 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||
public class TileEntityDropper extends TileEntityInventoryBase implements IRedstoneToggle{
|
||||
|
||||
private int currentTime;
|
||||
private boolean activateOnceWithSignal;
|
||||
|
||||
public TileEntityDropper(){
|
||||
super(9, "dropper");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
compound.setInteger("CurrentTime", this.currentTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
this.currentTime = compound.getInteger("CurrentTime");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void updateEntity(){
|
||||
|
@ -54,6 +43,18 @@ public class TileEntityDropper extends TileEntityInventoryBase implements IRedst
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
compound.setInteger("CurrentTime", this.currentTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
this.currentTime = compound.getInteger("CurrentTime");
|
||||
}
|
||||
|
||||
private void doWork(){
|
||||
if(this.removeFromInventory(false) != null){
|
||||
ItemStack stack = this.removeFromInventory(true);
|
||||
|
@ -79,13 +80,13 @@ public class TileEntityDropper extends TileEntityInventoryBase implements IRedst
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return true;
|
||||
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
||||
return this.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
||||
return this.isItemValidForSlot(slot, stack);
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -93,8 +94,6 @@ public class TileEntityDropper extends TileEntityInventoryBase implements IRedst
|
|||
return true;
|
||||
}
|
||||
|
||||
private boolean activateOnceWithSignal;
|
||||
|
||||
@Override
|
||||
public boolean toggle(){
|
||||
return this.activateOnceWithSignal = !this.activateOnceWithSignal;
|
||||
|
|
|
@ -28,18 +28,6 @@ public class TileEntityEnergizer extends TileEntityInventoryBase implements IEne
|
|||
super(2, "energizer");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.storage.writeToNBT(compound);
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.storage.readFromNBT(compound);
|
||||
super.readSyncableNBT(compound, sync);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity(){
|
||||
super.updateEntity();
|
||||
|
@ -66,8 +54,15 @@ public class TileEntityEnergizer extends TileEntityInventoryBase implements IEne
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return i == 0 && stack.getItem() instanceof IEnergyContainerItem;
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.storage.writeToNBT(compound);
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.storage.readFromNBT(compound);
|
||||
super.readSyncableNBT(compound, sync);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -75,6 +70,11 @@ public class TileEntityEnergizer extends TileEntityInventoryBase implements IEne
|
|||
return this.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return i == 0 && stack.getItem() instanceof IEnergyContainerItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack stack, int side){
|
||||
return slot == 1;
|
||||
|
|
|
@ -29,18 +29,6 @@ public class TileEntityEnervator extends TileEntityInventoryBase implements IEne
|
|||
super(2, "enervator");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.storage.writeToNBT(compound);
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.storage.readFromNBT(compound);
|
||||
super.readSyncableNBT(compound, sync);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity(){
|
||||
super.updateEntity();
|
||||
|
@ -76,8 +64,15 @@ public class TileEntityEnervator extends TileEntityInventoryBase implements IEne
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return i == 0 && stack.getItem() instanceof IEnergyContainerItem;
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.storage.writeToNBT(compound);
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.storage.readFromNBT(compound);
|
||||
super.readSyncableNBT(compound, sync);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -110,6 +105,11 @@ public class TileEntityEnervator extends TileEntityInventoryBase implements IEne
|
|||
return this.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return i == 0 && stack.getItem() instanceof IEnergyContainerItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack stack, int side){
|
||||
return slot == 1;
|
||||
|
|
|
@ -38,24 +38,6 @@ public class TileEntityFeeder extends TileEntityInventoryBase{
|
|||
return this.currentTimer*i/TIME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
compound.setInteger("Timer", this.currentTimer);
|
||||
if(sync){
|
||||
compound.setInteger("Animals", this.currentAnimalAmount);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
this.currentTimer = compound.getInteger("Timer");
|
||||
if(sync){
|
||||
this.currentAnimalAmount = compound.getInteger("Animals");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void updateEntity(){
|
||||
|
@ -107,6 +89,24 @@ public class TileEntityFeeder extends TileEntityInventoryBase{
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
compound.setInteger("Timer", this.currentTimer);
|
||||
if(sync){
|
||||
compound.setInteger("Animals", this.currentAnimalAmount);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
this.currentTimer = compound.getInteger("Timer");
|
||||
if(sync){
|
||||
this.currentAnimalAmount = compound.getInteger("Animals");
|
||||
}
|
||||
}
|
||||
|
||||
public void feedAnimal(EntityAnimal animal){
|
||||
animal.func_146082_f(null);
|
||||
for(int i = 0; i < 7; i++){
|
||||
|
@ -118,13 +118,13 @@ public class TileEntityFeeder extends TileEntityInventoryBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return true;
|
||||
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
||||
return this.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
||||
return this.isItemValidForSlot(slot, stack);
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -93,11 +93,6 @@ public class TileEntityFermentingBarrel extends TileEntityInventoryBase implemen
|
|||
super.readSyncableNBT(compound, sync);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return (i == 0 && FluidContainerRegistry.containsFluid(stack, new FluidStack(InitBlocks.fluidCanolaOil, FluidContainerRegistry.BUCKET_VOLUME))) || (i == 2 && stack.getItem() == Items.bucket);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getProcessScaled(int i){
|
||||
return this.currentProcessTime*i/PROCESS_TIME;
|
||||
|
@ -118,6 +113,11 @@ public class TileEntityFermentingBarrel extends TileEntityInventoryBase implemen
|
|||
return this.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return (i == 0 && FluidContainerRegistry.containsFluid(stack, new FluidStack(InitBlocks.fluidCanolaOil, FluidContainerRegistry.BUCKET_VOLUME))) || (i == 2 && stack.getItem() == Items.bucket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack stack, int side){
|
||||
return (slot == 1 && stack.getItem() == Items.bucket) || (slot == 3 && FluidContainerRegistry.containsFluid(stack, new FluidStack(InitBlocks.fluidOil, FluidContainerRegistry.BUCKET_VOLUME)));
|
||||
|
|
|
@ -24,11 +24,10 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||
|
||||
public class TileEntityFireworkBox extends TileEntityBase implements IEnergyReceiver, IRedstoneToggle{
|
||||
|
||||
public EnergyStorage storage = new EnergyStorage(20000);
|
||||
|
||||
private int timeUntilNextFirework;
|
||||
|
||||
public static final int USE_PER_SHOT = 300;
|
||||
public EnergyStorage storage = new EnergyStorage(20000);
|
||||
private int timeUntilNextFirework;
|
||||
private boolean activateOnceWithSignal;
|
||||
|
||||
@Override
|
||||
public void updateEntity(){
|
||||
|
@ -125,8 +124,6 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyRece
|
|||
return true;
|
||||
}
|
||||
|
||||
private boolean activateOnceWithSignal;
|
||||
|
||||
@Override
|
||||
public boolean toggle(){
|
||||
return this.activateOnceWithSignal = !this.activateOnceWithSignal;
|
||||
|
|
|
@ -27,12 +27,16 @@ public class TileEntityFluidCollector extends TileEntityInventoryBase implements
|
|||
public boolean isPlacer;
|
||||
private int lastTankAmount;
|
||||
private int currentTime;
|
||||
private boolean activateOnceWithSignal;
|
||||
|
||||
public TileEntityFluidCollector(int slots, String name){
|
||||
super(slots, name);
|
||||
}
|
||||
|
||||
private boolean activateOnceWithSignal;
|
||||
public TileEntityFluidCollector(){
|
||||
super(2, "fluidCollector");
|
||||
this.isPlacer = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean toggle(){
|
||||
|
@ -49,50 +53,6 @@ public class TileEntityFluidCollector extends TileEntityInventoryBase implements
|
|||
this.doWork();
|
||||
}
|
||||
|
||||
public TileEntityFluidCollector(){
|
||||
super(2, "fluidCollector");
|
||||
this.isPlacer = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill){
|
||||
if(this.isPlacer){
|
||||
return this.tank.fill(resource, doFill);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain){
|
||||
if(!this.isPlacer){
|
||||
return this.tank.drain(resource.amount, doDrain);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain){
|
||||
if(!this.isPlacer){
|
||||
return this.tank.drain(maxDrain, doDrain);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid){
|
||||
return this.isPlacer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid){
|
||||
return !this.isPlacer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from){
|
||||
return new FluidTankInfo[]{this.tank.getInfo()};
|
||||
}
|
||||
|
||||
private void doWork(){
|
||||
ForgeDirection sideToManipulate = ForgeDirection.getOrientation(worldObj.getBlockMetadata(xCoord, yCoord, zCoord));
|
||||
|
||||
|
@ -133,6 +93,45 @@ public class TileEntityFluidCollector extends TileEntityInventoryBase implements
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill){
|
||||
if(this.isPlacer){
|
||||
return this.tank.fill(resource, doFill);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain){
|
||||
if(!this.isPlacer){
|
||||
return this.tank.drain(resource.amount, doDrain);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain){
|
||||
if(!this.isPlacer){
|
||||
return this.tank.drain(maxDrain, doDrain);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid){
|
||||
return this.isPlacer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid){
|
||||
return !this.isPlacer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from){
|
||||
return new FluidTankInfo[]{this.tank.getInfo()};
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void updateEntity(){
|
||||
|
@ -187,6 +186,16 @@ public class TileEntityFluidCollector extends TileEntityInventoryBase implements
|
|||
this.tank.readFromNBT(compound);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getTankScaled(int i){
|
||||
return this.tank.getFluidAmount()*i/this.tank.getCapacity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
||||
return this.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
if(i == 0){
|
||||
|
@ -200,16 +209,6 @@ public class TileEntityFluidCollector extends TileEntityInventoryBase implements
|
|||
return false;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getTankScaled(int i){
|
||||
return this.tank.getFluidAmount()*i/this.tank.getCapacity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
||||
return this.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack stack, int side){
|
||||
return slot == 1;
|
||||
|
|
|
@ -38,22 +38,6 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements
|
|||
super(4, "furnaceDouble");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
compound.setInteger("FirstSmeltTime", this.firstSmeltTime);
|
||||
compound.setInteger("SecondSmeltTime", this.secondSmeltTime);
|
||||
this.storage.writeToNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
this.firstSmeltTime = compound.getInteger("FirstSmeltTime");
|
||||
this.secondSmeltTime = compound.getInteger("SecondSmeltTime");
|
||||
this.storage.readFromNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void updateEntity(){
|
||||
|
@ -115,6 +99,22 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
compound.setInteger("FirstSmeltTime", this.firstSmeltTime);
|
||||
compound.setInteger("SecondSmeltTime", this.secondSmeltTime);
|
||||
this.storage.writeToNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
this.firstSmeltTime = compound.getInteger("FirstSmeltTime");
|
||||
this.secondSmeltTime = compound.getInteger("SecondSmeltTime");
|
||||
this.storage.readFromNBT(compound);
|
||||
}
|
||||
|
||||
public boolean canSmeltOn(int theInput, int theOutput){
|
||||
if(this.slots[theInput] != null){
|
||||
ItemStack output = FurnaceRecipes.smelting().getSmeltingResult(this.slots[theInput]);
|
||||
|
@ -144,11 +144,6 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && FurnaceRecipes.smelting().getSmeltingResult(stack) != null;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getEnergyScaled(int i){
|
||||
return this.storage.getEnergyStored()*i/this.storage.getMaxEnergyStored();
|
||||
|
@ -169,6 +164,11 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements
|
|||
return this.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && FurnaceRecipes.smelting().getSmeltingResult(stack) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack stack, int side){
|
||||
return slot == SLOT_OUTPUT_1 || slot == SLOT_OUTPUT_2;
|
||||
|
|
|
@ -69,22 +69,6 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
compound.setInteger("FirstCrushTime", this.firstCrushTime);
|
||||
compound.setInteger("SecondCrushTime", this.secondCrushTime);
|
||||
this.storage.writeToNBT(compound);
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.firstCrushTime = compound.getInteger("FirstCrushTime");
|
||||
this.secondCrushTime = compound.getInteger("SecondCrushTime");
|
||||
this.storage.readFromNBT(compound);
|
||||
super.readSyncableNBT(compound, sync);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void updateEntity(){
|
||||
|
@ -163,6 +147,22 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
compound.setInteger("FirstCrushTime", this.firstCrushTime);
|
||||
compound.setInteger("SecondCrushTime", this.secondCrushTime);
|
||||
this.storage.writeToNBT(compound);
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.firstCrushTime = compound.getInteger("FirstCrushTime");
|
||||
this.secondCrushTime = compound.getInteger("SecondCrushTime");
|
||||
this.storage.readFromNBT(compound);
|
||||
super.readSyncableNBT(compound, sync);
|
||||
}
|
||||
|
||||
public boolean canCrushOn(int theInput, int theFirstOutput, int theSecondOutput){
|
||||
if(this.slots[theInput] != null){
|
||||
List<ItemStack> outputOnes = CrusherRecipeRegistry.getOutputOnes(this.slots[theInput]);
|
||||
|
@ -236,11 +236,6 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && CrusherRecipeRegistry.getRecipeFromInput(stack) != null;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getEnergyScaled(int i){
|
||||
return this.storage.getEnergyStored()*i/this.storage.getMaxEnergyStored();
|
||||
|
@ -261,6 +256,11 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
|
|||
return this.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && CrusherRecipeRegistry.getRecipeFromInput(stack) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack stack, int side){
|
||||
return slot == SLOT_OUTPUT_1_1 || slot == SLOT_OUTPUT_1_2 || slot == SLOT_OUTPUT_2_1 || slot == SLOT_OUTPUT_2_2;
|
||||
|
|
|
@ -368,32 +368,6 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt
|
|||
this.markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
compound.setInteger("SideToPut", this.sideToPut);
|
||||
compound.setInteger("SlotToPut", this.slotToPutStart);
|
||||
compound.setInteger("SlotToPutEnd", this.slotToPutEnd);
|
||||
compound.setInteger("SideToPull", this.sideToPull);
|
||||
compound.setInteger("SlotToPull", this.slotToPullStart);
|
||||
compound.setInteger("SlotToPullEnd", this.slotToPullEnd);
|
||||
compound.setBoolean("PullWhitelist", this.isPullWhitelist);
|
||||
compound.setBoolean("PutWhitelist", this.isPutWhitelist);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.sideToPut = compound.getInteger("SideToPut");
|
||||
this.slotToPutStart = compound.getInteger("SlotToPut");
|
||||
this.slotToPutEnd = compound.getInteger("SlotToPutEnd");
|
||||
this.sideToPull = compound.getInteger("SideToPull");
|
||||
this.slotToPullStart = compound.getInteger("SlotToPull");
|
||||
this.slotToPullEnd = compound.getInteger("SlotToPullEnd");
|
||||
this.isPullWhitelist = compound.getBoolean("PullWhitelist");
|
||||
this.isPutWhitelist = compound.getBoolean("PutWhitelist");
|
||||
super.readSyncableNBT(compound, sync);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity(){
|
||||
super.updateEntity();
|
||||
|
@ -427,8 +401,29 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return i == 0;
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
compound.setInteger("SideToPut", this.sideToPut);
|
||||
compound.setInteger("SlotToPut", this.slotToPutStart);
|
||||
compound.setInteger("SlotToPutEnd", this.slotToPutEnd);
|
||||
compound.setInteger("SideToPull", this.sideToPull);
|
||||
compound.setInteger("SlotToPull", this.slotToPullStart);
|
||||
compound.setInteger("SlotToPullEnd", this.slotToPullEnd);
|
||||
compound.setBoolean("PullWhitelist", this.isPullWhitelist);
|
||||
compound.setBoolean("PutWhitelist", this.isPutWhitelist);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.sideToPut = compound.getInteger("SideToPut");
|
||||
this.slotToPutStart = compound.getInteger("SlotToPut");
|
||||
this.slotToPutEnd = compound.getInteger("SlotToPutEnd");
|
||||
this.sideToPull = compound.getInteger("SideToPull");
|
||||
this.slotToPullStart = compound.getInteger("SlotToPull");
|
||||
this.slotToPullEnd = compound.getInteger("SlotToPullEnd");
|
||||
this.isPullWhitelist = compound.getBoolean("PullWhitelist");
|
||||
this.isPutWhitelist = compound.getBoolean("PutWhitelist");
|
||||
super.readSyncableNBT(compound, sync);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -436,6 +431,11 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt
|
|||
return this.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return i == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack stack, int side){
|
||||
return slot == 0;
|
||||
|
|
|
@ -31,20 +31,6 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase implements I
|
|||
super(2, "repairer");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
compound.setInteger("NextRepairTick", this.nextRepairTick);
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
this.storage.writeToNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.nextRepairTick = compound.getInteger("NextRepairTick");
|
||||
super.readSyncableNBT(compound, sync);
|
||||
this.storage.readFromNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void updateEntity(){
|
||||
|
@ -77,13 +63,22 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase implements I
|
|||
}
|
||||
}
|
||||
|
||||
public static boolean canBeRepaired(ItemStack stack){
|
||||
return stack != null && stack.getItem().isRepairable();
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
compound.setInteger("NextRepairTick", this.nextRepairTick);
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
this.storage.writeToNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return i == SLOT_INPUT;
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.nextRepairTick = compound.getInteger("NextRepairTick");
|
||||
super.readSyncableNBT(compound, sync);
|
||||
this.storage.readFromNBT(compound);
|
||||
}
|
||||
|
||||
public static boolean canBeRepaired(ItemStack stack){
|
||||
return stack != null && stack.getItem().isRepairable();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
@ -104,6 +99,11 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase implements I
|
|||
return this.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return i == SLOT_INPUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack stack, int side){
|
||||
return slot == SLOT_OUTPUT;
|
||||
|
|
|
@ -30,9 +30,8 @@ import java.util.ArrayList;
|
|||
|
||||
public class TileEntityMiner extends TileEntityInventoryBase implements IEnergyReceiver, IButtonReactor, IEnergySaver{
|
||||
|
||||
public EnergyStorage storage = new EnergyStorage(1000000);
|
||||
public static final int ENERGY_USE_PER_BLOCK = 500;
|
||||
|
||||
public EnergyStorage storage = new EnergyStorage(1000000);
|
||||
public int layerAt = -1;
|
||||
public boolean onlyMineOres;
|
||||
|
||||
|
|
|
@ -51,22 +51,6 @@ public class TileEntityOilGenerator extends TileEntityInventoryBase implements I
|
|||
return this.currentBurnTime*i/BURN_TIME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
compound.setInteger("BurnTime", this.currentBurnTime);
|
||||
this.storage.writeToNBT(compound);
|
||||
this.tank.writeToNBT(compound);
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.currentBurnTime = compound.getInteger("BurnTime");
|
||||
this.storage.readFromNBT(compound);
|
||||
this.tank.readFromNBT(compound);
|
||||
super.readSyncableNBT(compound, sync);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void updateEntity(){
|
||||
|
@ -120,8 +104,19 @@ public class TileEntityOilGenerator extends TileEntityInventoryBase implements I
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return FluidContainerRegistry.containsFluid(stack, new FluidStack(InitBlocks.fluidOil, FluidContainerRegistry.BUCKET_VOLUME)) && i == 0;
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
compound.setInteger("BurnTime", this.currentBurnTime);
|
||||
this.storage.writeToNBT(compound);
|
||||
this.tank.writeToNBT(compound);
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.currentBurnTime = compound.getInteger("BurnTime");
|
||||
this.storage.readFromNBT(compound);
|
||||
this.tank.readFromNBT(compound);
|
||||
super.readSyncableNBT(compound, sync);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -129,6 +124,11 @@ public class TileEntityOilGenerator extends TileEntityInventoryBase implements I
|
|||
return this.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return FluidContainerRegistry.containsFluid(stack, new FluidStack(InitBlocks.fluidOil, FluidContainerRegistry.BUCKET_VOLUME)) && i == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack stack, int side){
|
||||
return slot == 1;
|
||||
|
|
|
@ -45,11 +45,6 @@ public class TileEntityPhantomItemface extends TileEntityPhantomface{
|
|||
return this.isBoundThingInRange() ? this.getInventory().getInventoryStackLimit() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return this.isBoundThingInRange() && this.getInventory().isItemValidForSlot(i, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int i){
|
||||
return this.isBoundThingInRange() ? this.getInventory().getStackInSlotOnClosing(i) : null;
|
||||
|
@ -112,4 +107,9 @@ public class TileEntityPhantomItemface extends TileEntityPhantomface{
|
|||
return this.isBoundThingInRange() && (this.getSided() == null || this.getSided().canExtractItem(slot, stack, side));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return this.isBoundThingInRange() && this.getInventory().isItemValidForSlot(i, stack);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements
|
|||
public int currentTime;
|
||||
public int range;
|
||||
public boolean isBreaker;
|
||||
private boolean activateOnceWithSignal;
|
||||
|
||||
public TileEntityPhantomPlacer(int slots, String name){
|
||||
super(slots, name);
|
||||
|
@ -42,33 +43,6 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements
|
|||
this.isBreaker = false;
|
||||
}
|
||||
|
||||
private void doWork(){
|
||||
if(this.isBreaker){
|
||||
Block blockToBreak = boundPosition.getWorld().getBlock(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ());
|
||||
if(blockToBreak != null && blockToBreak.getBlockHardness(boundPosition.getWorld(), boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()) > -1.0F){
|
||||
ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
|
||||
int meta = boundPosition.getWorld().getBlockMetadata(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ());
|
||||
drops.addAll(blockToBreak.getDrops(boundPosition.getWorld(), boundPosition.getX(), boundPosition.getY(), boundPosition.getZ(), meta, 0));
|
||||
|
||||
if(WorldUtil.addToInventory(this, drops, false)){
|
||||
boundPosition.getWorld().playAuxSFX(2001, boundPosition.getX(), boundPosition.getY(), boundPosition.getZ(), Block.getIdFromBlock(blockToBreak)+(meta << 12));
|
||||
WorldUtil.breakBlockAtSide(ForgeDirection.UNKNOWN, boundPosition.getWorld(), boundPosition.getX(), boundPosition.getY(), boundPosition.getZ());
|
||||
WorldUtil.addToInventory(this, drops, true);
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(boundPosition.getWorld().getBlock(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()).isReplaceable(boundPosition.getWorld(), boundPosition.getX(), boundPosition.getY(), boundPosition.getZ())){
|
||||
int theSlot = WorldUtil.findFirstFilledSlot(this.slots);
|
||||
this.setInventorySlotContents(theSlot, WorldUtil.placeBlockAtSide(ForgeDirection.UNKNOWN, boundPosition.getWorld(), boundPosition.getX(), boundPosition.getY(), boundPosition.getZ(), this.slots[theSlot]));
|
||||
if(this.slots[theSlot] != null && this.slots[theSlot].stackSize <= 0){
|
||||
this.slots[theSlot] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity(){
|
||||
super.updateEntity();
|
||||
|
@ -100,6 +74,45 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasBoundPosition(){
|
||||
if(this.boundPosition != null && this.boundPosition.getWorld() != null){
|
||||
if(this.boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()) instanceof IPhantomTile || (this.xCoord == this.boundPosition.getX() && this.yCoord == this.boundPosition.getY() && this.zCoord == this.boundPosition.getZ() && this.worldObj == this.boundPosition.getWorld())){
|
||||
this.boundPosition = null;
|
||||
return false;
|
||||
}
|
||||
return this.boundPosition.getWorld() == this.worldObj;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void doWork(){
|
||||
if(this.isBreaker){
|
||||
Block blockToBreak = boundPosition.getWorld().getBlock(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ());
|
||||
if(blockToBreak != null && blockToBreak.getBlockHardness(boundPosition.getWorld(), boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()) > -1.0F){
|
||||
ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
|
||||
int meta = boundPosition.getWorld().getBlockMetadata(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ());
|
||||
drops.addAll(blockToBreak.getDrops(boundPosition.getWorld(), boundPosition.getX(), boundPosition.getY(), boundPosition.getZ(), meta, 0));
|
||||
|
||||
if(WorldUtil.addToInventory(this, drops, false)){
|
||||
boundPosition.getWorld().playAuxSFX(2001, boundPosition.getX(), boundPosition.getY(), boundPosition.getZ(), Block.getIdFromBlock(blockToBreak)+(meta << 12));
|
||||
WorldUtil.breakBlockAtSide(ForgeDirection.UNKNOWN, boundPosition.getWorld(), boundPosition.getX(), boundPosition.getY(), boundPosition.getZ());
|
||||
WorldUtil.addToInventory(this, drops, true);
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(boundPosition.getWorld().getBlock(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()).isReplaceable(boundPosition.getWorld(), boundPosition.getX(), boundPosition.getY(), boundPosition.getZ())){
|
||||
int theSlot = WorldUtil.findFirstFilledSlot(this.slots);
|
||||
this.setInventorySlotContents(theSlot, WorldUtil.placeBlockAtSide(ForgeDirection.UNKNOWN, boundPosition.getWorld(), boundPosition.getX(), boundPosition.getY(), boundPosition.getZ(), this.slots[theSlot]));
|
||||
if(this.slots[theSlot] != null && this.slots[theSlot].stackSize <= 0){
|
||||
this.slots[theSlot] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderParticles(){
|
||||
if(Util.RANDOM.nextInt(2) == 0){
|
||||
|
@ -119,18 +132,6 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasBoundPosition(){
|
||||
if(this.boundPosition != null && this.boundPosition.getWorld() != null){
|
||||
if(this.boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()) instanceof IPhantomTile || (this.xCoord == this.boundPosition.getX() && this.yCoord == this.boundPosition.getY() && this.zCoord == this.boundPosition.getZ() && this.worldObj == this.boundPosition.getWorld())){
|
||||
this.boundPosition = null;
|
||||
return false;
|
||||
}
|
||||
return this.boundPosition.getWorld() == this.worldObj;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBoundThingInRange(){
|
||||
return this.hasBoundPosition() && this.boundPosition.toVec().distanceTo(Vec3.createVectorHelper(xCoord, yCoord, zCoord)) <= this.range;
|
||||
|
@ -181,13 +182,13 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return !this.isBreaker;
|
||||
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
||||
return this.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
||||
return this.isItemValidForSlot(slot, stack);
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return !this.isBreaker;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -195,8 +196,6 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements
|
|||
return this.isBreaker;
|
||||
}
|
||||
|
||||
private boolean activateOnceWithSignal;
|
||||
|
||||
@Override
|
||||
public boolean toggle(){
|
||||
return this.activateOnceWithSignal = !this.activateOnceWithSignal;
|
||||
|
|
|
@ -26,6 +26,7 @@ import net.minecraft.world.World;
|
|||
public class TileEntityPhantomface extends TileEntityInventoryBase implements IPhantomTile{
|
||||
|
||||
public static final int RANGE = 16;
|
||||
public static final float[] COLORS = new float[]{93F/255F, 43F/255F, 181F/255F};
|
||||
public WorldPos boundPosition;
|
||||
public BlockPhantom.Type type;
|
||||
public int range;
|
||||
|
@ -33,36 +34,10 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
|
|||
private WorldPos boundPosBefore;
|
||||
private Block boundBlockBefore;
|
||||
|
||||
public static final float[] COLORS = new float[]{93F/255F, 43F/255F, 181F/255F};
|
||||
|
||||
public TileEntityPhantomface(String name){
|
||||
super(0, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
if(this.boundPosition != null){
|
||||
compound.setInteger("XCoordOfTileStored", boundPosition.getX());
|
||||
compound.setInteger("YCoordOfTileStored", boundPosition.getY());
|
||||
compound.setInteger("ZCoordOfTileStored", boundPosition.getZ());
|
||||
compound.setInteger("WorldOfTileStored", boundPosition.getWorld().provider.dimensionId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
int x = compound.getInteger("XCoordOfTileStored");
|
||||
int y = compound.getInteger("YCoordOfTileStored");
|
||||
int z = compound.getInteger("ZCoordOfTileStored");
|
||||
int world = compound.getInteger("WorldOfTileStored");
|
||||
if(!(x == 0 && y == 0 && z == 0)){
|
||||
this.boundPosition = new WorldPos(world, x, y, z);
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity(){
|
||||
super.updateEntity();
|
||||
|
@ -95,6 +70,30 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
if(this.boundPosition != null){
|
||||
compound.setInteger("XCoordOfTileStored", boundPosition.getX());
|
||||
compound.setInteger("YCoordOfTileStored", boundPosition.getY());
|
||||
compound.setInteger("ZCoordOfTileStored", boundPosition.getZ());
|
||||
compound.setInteger("WorldOfTileStored", boundPosition.getWorld().provider.dimensionId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
int x = compound.getInteger("XCoordOfTileStored");
|
||||
int y = compound.getInteger("YCoordOfTileStored");
|
||||
int z = compound.getInteger("ZCoordOfTileStored");
|
||||
int world = compound.getInteger("WorldOfTileStored");
|
||||
if(!(x == 0 && y == 0 && z == 0)){
|
||||
this.boundPosition = new WorldPos(world, x, y, z);
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
public static int upgradeRange(int defaultRange, World world, int x, int y, int z){
|
||||
int newRange = defaultRange;
|
||||
for(int i = 0; i < 3; i++){
|
||||
|
|
|
@ -85,13 +85,13 @@ public class TileEntityRangedCollector extends TileEntityInventoryBase implement
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return false;
|
||||
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
||||
return this.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
||||
return this.isItemValidForSlot(slot, stack);
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -29,18 +29,6 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I
|
|||
super(1, "xpSolidifier");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
compound.setShort("Amount", this.amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
this.amount = compound.getShort("Amount");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity(){
|
||||
super.updateEntity();
|
||||
|
@ -66,8 +54,15 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return false;
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
compound.setShort("Amount", this.amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
this.amount = compound.getShort("Amount");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -75,6 +70,11 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I
|
|||
return this.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack stack, int side){
|
||||
return true;
|
||||
|
|
|
@ -249,14 +249,6 @@ public class WorldUtil{
|
|||
return addToInventory(inventory, start, end, stacks, ForgeDirection.UNKNOWN, actuallyDo);
|
||||
}
|
||||
|
||||
public static boolean addToInventory(IInventory inventory, ArrayList<ItemStack> stacks, boolean actuallyDo){
|
||||
return addToInventory(inventory, stacks, ForgeDirection.UNKNOWN, actuallyDo);
|
||||
}
|
||||
|
||||
public static boolean addToInventory(IInventory inventory, ArrayList<ItemStack> stacks, ForgeDirection side, boolean actuallyDo){
|
||||
return addToInventory(inventory, 0, inventory.getSizeInventory(), stacks, side, actuallyDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an ArrayList of ItemStacks to an Array of slots
|
||||
*
|
||||
|
@ -309,6 +301,14 @@ public class WorldUtil{
|
|||
return working >= stacks.size();
|
||||
}
|
||||
|
||||
public static boolean addToInventory(IInventory inventory, ArrayList<ItemStack> stacks, boolean actuallyDo){
|
||||
return addToInventory(inventory, stacks, ForgeDirection.UNKNOWN, actuallyDo);
|
||||
}
|
||||
|
||||
public static boolean addToInventory(IInventory inventory, ArrayList<ItemStack> stacks, ForgeDirection side, boolean actuallyDo){
|
||||
return addToInventory(inventory, 0, inventory.getSizeInventory(), stacks, side, actuallyDo);
|
||||
}
|
||||
|
||||
public static int findFirstFilledSlot(ItemStack[] slots){
|
||||
for(int i = 0; i < slots.length; i++){
|
||||
if(slots[i] != null){
|
||||
|
|
Loading…
Reference in a new issue