Cleanup ~

This commit is contained in:
Ellpeck 2016-02-01 17:49:55 +01:00
parent c92aebfe0a
commit 0540313e75
107 changed files with 1075 additions and 1076 deletions

View file

@ -16,14 +16,14 @@ public interface IBookletEntry{
List<IBookletChapter> getChapters(); List<IBookletChapter> getChapters();
void setChapters(List<IBookletChapter> chapters);
String getUnlocalizedName(); String getUnlocalizedName();
String getLocalizedName(); String getLocalizedName();
String getLocalizedNameWithFormatting(); String getLocalizedNameWithFormatting();
void setChapters(List<IBookletChapter> chapters);
void addChapter(IBookletChapter chapter); void addChapter(IBookletChapter chapter);
} }

View file

@ -28,6 +28,7 @@ public abstract class Lens{
/** /**
* Invokes the lens type's behavior on a block * Invokes the lens type's behavior on a block
*
* @param hitBlock The block that was hit * @param hitBlock The block that was hit
* @param tile The tile the lens was invoked from * @param tile The tile the lens was invoked from
* @return If the Reconstructor should stop continuing (return false if you want it to go through blocks) * @return If the Reconstructor should stop continuing (return false if you want it to go through blocks)

View file

@ -40,10 +40,9 @@ import java.util.List;
public class BlockAtomicReconstructor extends BlockContainerBase implements IHudDisplay{ public class BlockAtomicReconstructor extends BlockContainerBase implements IHudDisplay{
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 5);
public static final int NAME_FLAVOR_AMOUNTS_1 = 12; public static final int NAME_FLAVOR_AMOUNTS_1 = 12;
public static final int NAME_FLAVOR_AMOUNTS_2 = 14; public static final int NAME_FLAVOR_AMOUNTS_2 = 14;
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 5);
public BlockAtomicReconstructor(String name){ public BlockAtomicReconstructor(String name){
super(Material.rock, name); super(Material.rock, name);
@ -53,24 +52,6 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
this.setStepSound(soundTypeStone); this.setStepSound(soundTypeStone);
} }
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.EPIC;
}
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
int rotation = BlockPistonBase.getFacingFromEntity(world, pos, player).ordinal();
PosUtil.setMetadata(pos, world, rotation, 2);
super.onBlockPlacedBy(world, pos, state, player, stack);
}
@Override @Override
public boolean isOpaqueCube(){ public boolean isOpaqueCube(){
return false; return false;
@ -139,6 +120,24 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
return TheItemBlock.class; return TheItemBlock.class;
} }
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.EPIC;
}
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
int rotation = BlockPistonBase.getFacingFromEntity(world, pos, player).ordinal();
PosUtil.setMetadata(pos, world, rotation, 2);
super.onBlockPlacedBy(world, pos, state, player, stack);
}
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
public static class TheItemBlock extends ItemBlockBase{ public static class TheItemBlock extends ItemBlockBase{
private long lastSysTime; private long lastSysTime;

View file

@ -31,8 +31,8 @@ import net.minecraft.world.World;
public class BlockBreaker extends BlockContainerBase{ public class BlockBreaker extends BlockContainerBase{
private boolean isPlacer;
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 5); private static final PropertyInteger META = PropertyInteger.create("meta", 0, 5);
private boolean isPlacer;
public BlockBreaker(boolean isPlacer, String name){ public BlockBreaker(boolean isPlacer, String name){
super(Material.rock, name); super(Material.rock, name);
@ -43,11 +43,6 @@ public class BlockBreaker extends BlockContainerBase{
this.setStepSound(soundTypeStone); this.setStepSound(soundTypeStone);
} }
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override @Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(World world, int par2){
return this.isPlacer ? new TileEntityBreaker.TileEntityPlacer() : new TileEntityBreaker(); return this.isPlacer ? new TileEntityBreaker.TileEntityPlacer() : new TileEntityBreaker();
@ -81,6 +76,11 @@ public class BlockBreaker extends BlockContainerBase{
super.onBlockPlacedBy(world, pos, state, player, stack); super.onBlockPlacedBy(world, pos, state, player, stack);
} }
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override @Override
public void breakBlock(World world, BlockPos pos, IBlockState state){ public void breakBlock(World world, BlockPos pos, IBlockState state){
this.dropInventory(world, pos); this.dropInventory(world, pos);

View file

@ -46,11 +46,6 @@ public class BlockCoalGenerator extends BlockContainerBase{
this.setTickRandomly(true); this.setTickRandomly(true);
} }
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override @Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityCoalGenerator(); return new TileEntityCoalGenerator();
@ -85,6 +80,11 @@ public class BlockCoalGenerator extends BlockContainerBase{
return EnumRarity.RARE; return EnumRarity.RARE;
} }
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override @Override
public void breakBlock(World world, BlockPos pos, IBlockState state){ public void breakBlock(World world, BlockPos pos, IBlockState state){
this.dropInventory(world, pos); this.dropInventory(world, pos);

View file

@ -44,17 +44,12 @@ public class BlockCoffeeMachine extends BlockContainerBase{
} }
@Override @Override
protected PropertyInteger getMetaProperty(){ public boolean isFullCube(){
return META;
}
@Override
public boolean isOpaqueCube(){
return false; return false;
} }
@Override @Override
public boolean isFullCube(){ public boolean isOpaqueCube(){
return false; return false;
} }
@ -105,4 +100,9 @@ public class BlockCoffeeMachine extends BlockContainerBase{
super.onBlockPlacedBy(world, pos, state, player, stack); super.onBlockPlacedBy(world, pos, state, player, stack);
} }
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
} }

View file

@ -53,11 +53,6 @@ public class BlockColoredLamp extends BlockBase{
this.isOn = isOn; this.isOn = isOn;
} }
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override @Override
public Item getItemDropped(IBlockState state, Random rand, int par3){ public Item getItemDropped(IBlockState state, Random rand, int par3){
return Item.getItemFromBlock(InitBlocks.blockColoredLamp); return Item.getItemFromBlock(InitBlocks.blockColoredLamp);
@ -128,16 +123,6 @@ public class BlockColoredLamp extends BlockBase{
return this.isOn ? 15 : 0; return this.isOn ? 15 : 0;
} }
@Override
public Class<? extends ItemBlockBase> getItemBlock(){
return TheItemBlock.class;
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.RARE;
}
@Override @Override
protected void registerRendering(){ protected void registerRendering(){
ResourceLocation[] resLocs = new ResourceLocation[allLampTypes.length]; ResourceLocation[] resLocs = new ResourceLocation[allLampTypes.length];
@ -149,6 +134,20 @@ public class BlockColoredLamp extends BlockBase{
ActuallyAdditions.proxy.addRenderVariant(Item.getItemFromBlock(this), resLocs); ActuallyAdditions.proxy.addRenderVariant(Item.getItemFromBlock(this), resLocs);
} }
@Override
public Class<? extends ItemBlockBase> getItemBlock(){
return TheItemBlock.class;
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.RARE;
}
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
public static class TheItemBlock extends ItemBlockBase{ public static class TheItemBlock extends ItemBlockBase{

View file

@ -42,11 +42,6 @@ public class BlockCrystal extends BlockBase{
this.setHarvestLevel("pickaxe", 1); this.setHarvestLevel("pickaxe", 1);
} }
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override @Override
public int damageDropped(IBlockState state){ public int damageDropped(IBlockState state){
return this.getMetaFromState(state); return this.getMetaFromState(state);
@ -60,6 +55,17 @@ public class BlockCrystal extends BlockBase{
} }
} }
@Override
protected void registerRendering(){
ResourceLocation[] resLocs = new ResourceLocation[allCrystals.length];
for(int i = 0; i < allCrystals.length; i++){
String name = this.getBaseName()+allCrystals[i].name;
resLocs[i] = new ResourceLocation(ModUtil.MOD_ID_LOWER, name);
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this, 1, i), new ResourceLocation(ModUtil.MOD_ID_LOWER, name));
}
ActuallyAdditions.proxy.addRenderVariant(Item.getItemFromBlock(this), resLocs);
}
@Override @Override
public Class<? extends ItemBlockBase> getItemBlock(){ public Class<? extends ItemBlockBase> getItemBlock(){
return TheItemBlock.class; return TheItemBlock.class;
@ -71,14 +77,8 @@ public class BlockCrystal extends BlockBase{
} }
@Override @Override
protected void registerRendering(){ protected PropertyInteger getMetaProperty(){
ResourceLocation[] resLocs = new ResourceLocation[allCrystals.length]; return META;
for(int i = 0; i < allCrystals.length; i++){
String name = this.getBaseName()+allCrystals[i].name;
resLocs[i] = new ResourceLocation(ModUtil.MOD_ID_LOWER, name);
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this, 1, i), new ResourceLocation(ModUtil.MOD_ID_LOWER, name));
}
ActuallyAdditions.proxy.addRenderVariant(Item.getItemFromBlock(this), resLocs);
} }
public static class TheItemBlock extends ItemBlockBase{ public static class TheItemBlock extends ItemBlockBase{

View file

@ -41,11 +41,6 @@ public class BlockDirectionalBreaker extends BlockContainerBase{
this.setStepSound(soundTypeStone); this.setStepSound(soundTypeStone);
} }
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override @Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityDirectionalBreaker(); return new TileEntityDirectionalBreaker();
@ -79,6 +74,11 @@ public class BlockDirectionalBreaker extends BlockContainerBase{
super.onBlockPlacedBy(world, pos, state, player, stack); super.onBlockPlacedBy(world, pos, state, player, stack);
} }
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override @Override
public void breakBlock(World world, BlockPos pos, IBlockState state){ public void breakBlock(World world, BlockPos pos, IBlockState state){
this.dropInventory(world, pos); this.dropInventory(world, pos);

View file

@ -39,10 +39,6 @@ public class BlockDropper extends BlockContainerBase{
this.setResistance(10.0F); this.setResistance(10.0F);
this.setStepSound(soundTypeStone); this.setStepSound(soundTypeStone);
} }
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override @Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(World world, int par2){
@ -77,6 +73,11 @@ public class BlockDropper extends BlockContainerBase{
super.onBlockPlacedBy(world, pos, state, player, stack); super.onBlockPlacedBy(world, pos, state, player, stack);
} }
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override @Override
public void breakBlock(World world, BlockPos pos, IBlockState state){ public void breakBlock(World world, BlockPos pos, IBlockState state){
this.dropInventory(world, pos); this.dropInventory(world, pos);

View file

@ -35,12 +35,12 @@ public class BlockFishingNet extends BlockContainerBase{
} }
@Override @Override
public boolean isOpaqueCube(){ public boolean isFullCube(){
return false; return false;
} }
@Override @Override
public boolean isFullCube(){ public boolean isOpaqueCube(){
return false; return false;
} }

View file

@ -44,11 +44,6 @@ public class BlockFluidCollector extends BlockContainerBase{
this.setStepSound(soundTypeStone); this.setStepSound(soundTypeStone);
} }
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override @Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(World world, int par2){
return this.isPlacer ? new TileEntityFluidCollector.TileEntityFluidPlacer() : new TileEntityFluidCollector(); return this.isPlacer ? new TileEntityFluidCollector.TileEntityFluidPlacer() : new TileEntityFluidCollector();
@ -82,6 +77,11 @@ public class BlockFluidCollector extends BlockContainerBase{
super.onBlockPlacedBy(world, pos, state, player, stack); super.onBlockPlacedBy(world, pos, state, player, stack);
} }
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override @Override
public void breakBlock(World world, BlockPos pos, IBlockState state){ public void breakBlock(World world, BlockPos pos, IBlockState state){
this.dropInventory(world, pos); this.dropInventory(world, pos);

View file

@ -48,11 +48,6 @@ public class BlockFurnaceDouble extends BlockContainerBase{
this.setTickRandomly(true); this.setTickRandomly(true);
} }
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override @Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityFurnaceDouble(); return new TileEntityFurnaceDouble();
@ -135,6 +130,11 @@ public class BlockFurnaceDouble extends BlockContainerBase{
super.onBlockPlacedBy(world, pos, state, player, stack); super.onBlockPlacedBy(world, pos, state, player, stack);
} }
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override @Override
public void breakBlock(World world, BlockPos pos, IBlockState state){ public void breakBlock(World world, BlockPos pos, IBlockState state){
this.dropInventory(world, pos); this.dropInventory(world, pos);

View file

@ -35,12 +35,12 @@ public class BlockFurnaceSolar extends BlockContainerBase{
} }
@Override @Override
public boolean isOpaqueCube(){ public boolean isFullCube(){
return false; return false;
} }
@Override @Override
public boolean isFullCube(){ public boolean isOpaqueCube(){
return false; return false;
} }

View file

@ -36,22 +36,31 @@ public class BlockGreenhouseGlass extends BlockContainerBase{
this.setStepSound(soundTypeStone); this.setStepSound(soundTypeStone);
} }
@Override
@SideOnly(Side.CLIENT)
public EnumWorldBlockLayer getBlockLayer(){
return EnumWorldBlockLayer.CUTOUT;
}
@Override @Override
public boolean isFullCube(){ public boolean isFullCube(){
return false; return false;
} }
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side){
IBlockState state = worldIn.getBlockState(pos);
Block block = state.getBlock();
return worldIn.getBlockState(pos.offset(side.getOpposite())) != state || block != this && block != this && super.shouldSideBeRendered(worldIn, pos, side);
}
@Override @Override
public boolean isOpaqueCube(){ public boolean isOpaqueCube(){
return false; return false;
} }
@Override
@SideOnly(Side.CLIENT)
public EnumWorldBlockLayer getBlockLayer(){
return EnumWorldBlockLayer.CUTOUT;
}
@Override @Override
public EnumRarity getRarity(ItemStack stack){ public EnumRarity getRarity(ItemStack stack){
return EnumRarity.EPIC; return EnumRarity.EPIC;
@ -61,13 +70,4 @@ public class BlockGreenhouseGlass extends BlockContainerBase{
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityGreenhouseGlass(); return new TileEntityGreenhouseGlass();
} }
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side){
IBlockState state = worldIn.getBlockState(pos);
Block block = state.getBlock();
return worldIn.getBlockState(pos.offset(side.getOpposite())) != state || block != this && block != this && super.shouldSideBeRendered(worldIn, pos, side);
}
} }

View file

@ -35,8 +35,8 @@ import java.util.Random;
public class BlockGrinder extends BlockContainerBase{ public class BlockGrinder extends BlockContainerBase{
private final boolean isDouble;
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 1); private static final PropertyInteger META = PropertyInteger.create("meta", 0, 1);
private final boolean isDouble;
public BlockGrinder(boolean isDouble, String name){ public BlockGrinder(boolean isDouble, String name){
super(Material.rock, name); super(Material.rock, name);
@ -48,11 +48,6 @@ public class BlockGrinder extends BlockContainerBase{
this.setTickRandomly(true); this.setTickRandomly(true);
} }
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override @Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(World world, int par2){
return this.isDouble ? new TileEntityGrinder.TileEntityGrinderDouble() : new TileEntityGrinder(); return this.isDouble ? new TileEntityGrinder.TileEntityGrinderDouble() : new TileEntityGrinder();
@ -95,6 +90,11 @@ public class BlockGrinder extends BlockContainerBase{
return EnumRarity.EPIC; return EnumRarity.EPIC;
} }
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override @Override
public void breakBlock(World world, BlockPos pos, IBlockState state){ public void breakBlock(World world, BlockPos pos, IBlockState state){
this.dropInventory(world, pos); this.dropInventory(world, pos);

View file

@ -37,11 +37,6 @@ public class BlockLampPowerer extends BlockBase{
this.setStepSound(soundTypeStone); this.setStepSound(soundTypeStone);
} }
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override @Override
public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block neighborBlock){ public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block neighborBlock){
this.updateLamp(world, pos); this.updateLamp(world, pos);
@ -82,4 +77,9 @@ public class BlockLampPowerer extends BlockBase{
public EnumRarity getRarity(ItemStack stack){ public EnumRarity getRarity(ItemStack stack){
return EnumRarity.RARE; return EnumRarity.RARE;
} }
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
} }

View file

@ -42,8 +42,8 @@ public class BlockLaserRelay extends BlockContainerBase{
} }
@Override @Override
protected PropertyInteger getMetaProperty(){ public boolean isFullCube(){
return META; return false;
} }
@Override @Override
@ -57,11 +57,6 @@ public class BlockLaserRelay extends BlockContainerBase{
return false; return false;
} }
@Override
public boolean isFullCube(){
return false;
}
@Override @Override
public IBlockState onBlockPlaced(World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, int meta, EntityLivingBase base){ public IBlockState onBlockPlaced(World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, int meta, EntityLivingBase base){
return this.getStateFromMeta(side.ordinal()); return this.getStateFromMeta(side.ordinal());
@ -97,6 +92,11 @@ public class BlockLaserRelay extends BlockContainerBase{
return EnumRarity.EPIC; return EnumRarity.EPIC;
} }
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override @Override
public TileEntity createNewTileEntity(World world, int i){ public TileEntity createNewTileEntity(World world, int i){
return new TileEntityLaserRelay(); return new TileEntityLaserRelay();

View file

@ -42,16 +42,19 @@ public class BlockMisc extends BlockBase{
this.setHarvestLevel("pickaxe", 1); this.setHarvestLevel("pickaxe", 1);
} }
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override @Override
public int damageDropped(IBlockState state){ public int damageDropped(IBlockState state){
return this.getMetaFromState(state); return this.getMetaFromState(state);
} }
@SuppressWarnings("all")
@SideOnly(Side.CLIENT)
public void getSubBlocks(Item item, CreativeTabs tab, List list){
for(int j = 0; j < allMiscBlocks.length; j++){
list.add(new ItemStack(item, 1, j));
}
}
@Override @Override
protected void registerRendering(){ protected void registerRendering(){
ResourceLocation[] resLocs = new ResourceLocation[allMiscBlocks.length]; ResourceLocation[] resLocs = new ResourceLocation[allMiscBlocks.length];
@ -63,14 +66,6 @@ public class BlockMisc extends BlockBase{
ActuallyAdditions.proxy.addRenderVariant(Item.getItemFromBlock(this), resLocs); ActuallyAdditions.proxy.addRenderVariant(Item.getItemFromBlock(this), resLocs);
} }
@SuppressWarnings("all")
@SideOnly(Side.CLIENT)
public void getSubBlocks(Item item, CreativeTabs tab, List list){
for(int j = 0; j < allMiscBlocks.length; j++){
list.add(new ItemStack(item, 1, j));
}
}
@Override @Override
public Class<? extends ItemBlockBase> getItemBlock(){ public Class<? extends ItemBlockBase> getItemBlock(){
return TheItemBlock.class; return TheItemBlock.class;
@ -81,6 +76,11 @@ public class BlockMisc extends BlockBase{
return stack.getItemDamage() >= allMiscBlocks.length ? EnumRarity.COMMON : allMiscBlocks[stack.getItemDamage()].rarity; return stack.getItemDamage() >= allMiscBlocks.length ? EnumRarity.COMMON : allMiscBlocks[stack.getItemDamage()].rarity;
} }
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
public static class TheItemBlock extends ItemBlockBase{ public static class TheItemBlock extends ItemBlockBase{
public TheItemBlock(Block block){ public TheItemBlock(Block block){

View file

@ -46,11 +46,6 @@ public class BlockOilGenerator extends BlockContainerBase{
this.setTickRandomly(true); this.setTickRandomly(true);
} }
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override @Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityOilGenerator(); return new TileEntityOilGenerator();
@ -83,6 +78,11 @@ public class BlockOilGenerator extends BlockContainerBase{
return EnumRarity.RARE; return EnumRarity.RARE;
} }
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override @Override
public void breakBlock(World world, BlockPos pos, IBlockState state){ public void breakBlock(World world, BlockPos pos, IBlockState state){
this.dropInventory(world, pos); this.dropInventory(world, pos);

View file

@ -32,12 +32,12 @@ public class BlockPhantomBooster extends BlockContainerBase{
} }
@Override @Override
public boolean isOpaqueCube(){ public boolean isFullCube(){
return false; return false;
} }
@Override @Override
public boolean isFullCube(){ public boolean isOpaqueCube(){
return false; return false;
} }

View file

@ -31,6 +31,7 @@ import java.util.List;
public class BlockSlabs extends BlockBase{ public class BlockSlabs extends BlockBase{
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 1);
private Block fullBlock; private Block fullBlock;
private int meta; private int meta;
@ -38,8 +39,6 @@ public class BlockSlabs extends BlockBase{
this(name, fullBlock, 0); this(name, fullBlock, 0);
} }
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 1);
public BlockSlabs(String name, Block fullBlock, int meta){ public BlockSlabs(String name, Block fullBlock, int meta){
super(fullBlock.getMaterial(), name); super(fullBlock.getMaterial(), name);
this.setHardness(1.5F); this.setHardness(1.5F);
@ -48,11 +47,6 @@ public class BlockSlabs extends BlockBase{
this.meta = meta; this.meta = meta;
} }
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override @Override
public void addCollisionBoxesToList(World world, BlockPos pos, IBlockState state, AxisAlignedBB axis, List list, Entity entity){ public void addCollisionBoxesToList(World world, BlockPos pos, IBlockState state, AxisAlignedBB axis, List list, Entity entity){
this.setBlockBoundsBasedOnState(world, pos); this.setBlockBoundsBasedOnState(world, pos);
@ -98,6 +92,11 @@ public class BlockSlabs extends BlockBase{
return EnumRarity.COMMON; return EnumRarity.COMMON;
} }
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
public static class TheItemBlock extends ItemBlockBase{ public static class TheItemBlock extends ItemBlockBase{
public TheItemBlock(Block block){ public TheItemBlock(Block block){

View file

@ -47,18 +47,20 @@ public class BlockSmileyCloud extends BlockContainerBase{
this.setStepSound(soundTypeCloth); this.setStepSound(soundTypeCloth);
this.setTickRandomly(true); this.setTickRandomly(true);
} }
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override @Override
public boolean isOpaqueCube(){ public boolean isFullCube(){
return false; return false;
} }
@Override @Override
public boolean isFullCube(){ public void addCollisionBoxesToList(World world, BlockPos pos, IBlockState state, AxisAlignedBB axis, List list, Entity entity){
this.setBlockBoundsBasedOnState(world, pos);
super.addCollisionBoxesToList(world, pos, state, axis, list, entity);
}
@Override
public boolean isOpaqueCube(){
return false; return false;
} }
@ -88,12 +90,6 @@ public class BlockSmileyCloud extends BlockContainerBase{
return true; return true;
} }
@Override
public void addCollisionBoxesToList(World world, BlockPos pos, IBlockState state, AxisAlignedBB axis, List list, Entity entity){
this.setBlockBoundsBasedOnState(world, pos);
super.addCollisionBoxesToList(world, pos, state, axis, list, entity);
}
@Override @Override
public void setBlockBoundsBasedOnState(IBlockAccess world, BlockPos pos){ public void setBlockBoundsBasedOnState(IBlockAccess world, BlockPos pos){
int meta = PosUtil.getMetadata(pos, world); int meta = PosUtil.getMetadata(pos, world);
@ -148,4 +144,9 @@ public class BlockSmileyCloud extends BlockContainerBase{
super.onBlockPlacedBy(world, pos, state, player, stack); super.onBlockPlacedBy(world, pos, state, player, stack);
} }
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
} }

View file

@ -46,11 +46,6 @@ public class BlockTreasureChest extends BlockBase{
this.setTickRandomly(true); this.setTickRandomly(true);
} }
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, BlockPos pos, IBlockState state, Random rand){ public void randomDisplayTick(World world, BlockPos pos, IBlockState state, Random rand){
@ -80,11 +75,6 @@ public class BlockTreasureChest extends BlockBase{
return true; return true;
} }
@Override
public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player){
return false;
}
@Override @Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){ public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3; int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3;
@ -103,6 +93,11 @@ public class BlockTreasureChest extends BlockBase{
} }
} }
@Override
public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player){
return false;
}
private void dropItems(World world, BlockPos pos){ private void dropItems(World world, BlockPos pos){
for(int i = 0; i < MathHelper.getRandomIntegerInRange(Util.RANDOM, 3, 6); i++){ for(int i = 0; i < MathHelper.getRandomIntegerInRange(Util.RANDOM, 3, 6); i++){
TreasureChestLoot theReturn = WeightedRandom.getRandomItem(Util.RANDOM, ActuallyAdditionsAPI.treasureChestLoot); TreasureChestLoot theReturn = WeightedRandom.getRandomItem(Util.RANDOM, ActuallyAdditionsAPI.treasureChestLoot);
@ -129,4 +124,9 @@ public class BlockTreasureChest extends BlockBase{
public EnumRarity getRarity(ItemStack stack){ public EnumRarity getRarity(ItemStack stack){
return EnumRarity.EPIC; return EnumRarity.EPIC;
} }
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
} }

View file

@ -48,37 +48,12 @@ public class BlockWildPlant extends BlockBushBase{
this.setStepSound(soundTypeGrass); this.setStepSound(soundTypeGrass);
} }
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override @Override
public boolean canBlockStay(World world, BlockPos pos, IBlockState state){ public boolean canBlockStay(World world, BlockPos pos, IBlockState state){
BlockPos offset = PosUtil.offset(pos, 0, -1, 0); BlockPos offset = PosUtil.offset(pos, 0, -1, 0);
return PosUtil.getMetadata(pos, world) == TheWildPlants.RICE.ordinal() ? PosUtil.getMaterial(offset, world) == Material.water : PosUtil.getBlock(offset, world).canSustainPlant(world, offset, EnumFacing.UP, this); return PosUtil.getMetadata(pos, world) == TheWildPlants.RICE.ordinal() ? PosUtil.getMaterial(offset, world) == Material.water : PosUtil.getBlock(offset, world).canSustainPlant(world, offset, EnumFacing.UP, this);
} }
@Override
public Class<? extends ItemBlockBase> getItemBlock(){
return TheItemBlock.class;
}
@Override
public boolean shouldAddCreative(){
return false;
}
@Override
public EnumRarity getRarity(ItemStack stack){
return stack.getItemDamage() >= allWildPlants.length ? EnumRarity.COMMON : allWildPlants[stack.getItemDamage()].rarity;
}
@Override
public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player){
return false;
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public Item getItem(World world, BlockPos pos){ public Item getItem(World world, BlockPos pos){
@ -94,6 +69,17 @@ public class BlockWildPlant extends BlockBushBase{
} }
} }
@Override
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune){
int metadata = state.getBlock().getMetaFromState(state);
return metadata >= allWildPlants.length ? null : allWildPlants[metadata].wildVersionOf.getDrops(world, pos, allWildPlants[metadata].wildVersionOf.getStateFromMeta(7), fortune);
}
@Override
public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player){
return false;
}
@Override @Override
protected void registerRendering(){ protected void registerRendering(){
ResourceLocation[] resLocs = new ResourceLocation[allWildPlants.length]; ResourceLocation[] resLocs = new ResourceLocation[allWildPlants.length];
@ -106,9 +92,23 @@ public class BlockWildPlant extends BlockBushBase{
} }
@Override @Override
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune){ public Class<? extends ItemBlockBase> getItemBlock(){
int metadata = state.getBlock().getMetaFromState(state); return TheItemBlock.class;
return metadata >= allWildPlants.length ? null : allWildPlants[metadata].wildVersionOf.getDrops(world, pos, allWildPlants[metadata].wildVersionOf.getStateFromMeta(7), fortune); }
@Override
public boolean shouldAddCreative(){
return false;
}
@Override
public EnumRarity getRarity(ItemStack stack){
return stack.getItemDamage() >= allWildPlants.length ? EnumRarity.COMMON : allWildPlants[stack.getItemDamage()].rarity;
}
@Override
protected PropertyInteger getMetaProperty(){
return META;
} }
public static class TheItemBlock extends ItemBlockBase{ public static class TheItemBlock extends ItemBlockBase{

View file

@ -44,11 +44,6 @@ public class BlockXPSolidifier extends BlockContainerBase{
this.setStepSound(soundTypeStone); this.setStepSound(soundTypeStone);
} }
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override @Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityXPSolidifier(); return new TileEntityXPSolidifier();
@ -91,6 +86,11 @@ public class BlockXPSolidifier extends BlockContainerBase{
super.onBlockPlacedBy(world, pos, state, player, stack); super.onBlockPlacedBy(world, pos, state, player, stack);
} }
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override @Override
public void breakBlock(World world, BlockPos pos, IBlockState state){ public void breakBlock(World world, BlockPos pos, IBlockState state){
this.dropInventory(world, pos); this.dropInventory(world, pos);

View file

@ -47,10 +47,6 @@ public class BlockBase extends Block{
this.registerRendering(); this.registerRendering();
} }
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
protected String getBaseName(){ protected String getBaseName(){
return this.name; return this.name;
} }
@ -63,13 +59,12 @@ public class BlockBase extends Block{
return true; return true;
} }
public EnumRarity getRarity(ItemStack stack){ protected void registerRendering(){
return EnumRarity.COMMON; ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
} }
@Override public EnumRarity getRarity(ItemStack stack){
protected BlockState createBlockState(){ return EnumRarity.COMMON;
return this.getMetaProperty() == null ? super.createBlockState() : new BlockState(this, this.getMetaProperty());
} }
@Override @Override
@ -82,6 +77,11 @@ public class BlockBase extends Block{
return this.getMetaProperty() == null ? super.getMetaFromState(state) : state.getValue(this.getMetaProperty()); return this.getMetaProperty() == null ? super.getMetaFromState(state) : state.getValue(this.getMetaProperty());
} }
@Override
protected BlockState createBlockState(){
return this.getMetaProperty() == null ? super.createBlockState() : new BlockState(this, this.getMetaProperty());
}
protected PropertyInteger getMetaProperty(){ protected PropertyInteger getMetaProperty(){
return null; return null;
} }

View file

@ -46,10 +46,6 @@ public class BlockBushBase extends BlockBush{
this.registerRendering(); this.registerRendering();
} }
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
protected String getBaseName(){ protected String getBaseName(){
return this.name; return this.name;
} }
@ -62,13 +58,12 @@ public class BlockBushBase extends BlockBush{
return true; return true;
} }
public EnumRarity getRarity(ItemStack stack){ protected void registerRendering(){
return EnumRarity.COMMON; ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
} }
@Override public EnumRarity getRarity(ItemStack stack){
protected BlockState createBlockState(){ return EnumRarity.COMMON;
return this.getMetaProperty() == null ? super.createBlockState() : new BlockState(this, this.getMetaProperty());
} }
@Override @Override
@ -81,6 +76,11 @@ public class BlockBushBase extends BlockBush{
return this.getMetaProperty() == null ? super.getMetaFromState(state) : state.getValue(this.getMetaProperty()); return this.getMetaProperty() == null ? super.getMetaFromState(state) : state.getValue(this.getMetaProperty());
} }
@Override
protected BlockState createBlockState(){
return this.getMetaProperty() == null ? super.createBlockState() : new BlockState(this, this.getMetaProperty());
}
protected PropertyInteger getMetaProperty(){ protected PropertyInteger getMetaProperty(){
return null; return null;
} }

View file

@ -65,10 +65,6 @@ public abstract class BlockContainerBase extends BlockContainer{
this.registerRendering(); this.registerRendering();
} }
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
protected String getBaseName(){ protected String getBaseName(){
return this.name; return this.name;
} }
@ -81,6 +77,10 @@ public abstract class BlockContainerBase extends BlockContainer{
return true; return true;
} }
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
public EnumRarity getRarity(ItemStack stack){ public EnumRarity getRarity(ItemStack stack){
return EnumRarity.COMMON; return EnumRarity.COMMON;
} }
@ -117,6 +117,45 @@ public abstract class BlockContainerBase extends BlockContainer{
} }
} }
public boolean tryToggleRedstone(World world, BlockPos pos, EntityPlayer player){
ItemStack stack = player.getCurrentEquippedItem();
if(stack != null && Block.getBlockFromItem(stack.getItem()) instanceof BlockRedstoneTorch){
TileEntity tile = world.getTileEntity(pos);
if(tile instanceof IRedstoneToggle){
if(!world.isRemote){
((IRedstoneToggle)tile).toggle(!((IRedstoneToggle)tile).isPulseMode());
tile.markDirty();
if(tile instanceof TileEntityBase){
((TileEntityBase)tile).sendUpdate();
}
}
return true;
}
}
return false;
}
@Override
public IBlockState getStateFromMeta(int meta){
return this.getMetaProperty() == null ? super.getStateFromMeta(meta) : this.getDefaultState().withProperty(this.getMetaProperty(), meta);
}
@Override
public int getMetaFromState(IBlockState state){
return this.getMetaProperty() == null ? super.getMetaFromState(state) : state.getValue(this.getMetaProperty());
}
@Override
public void updateTick(World world, BlockPos pos, IBlockState state, Random random){
if(!world.isRemote){
TileEntity tile = world.getTileEntity(pos);
if(tile instanceof IRedstoneToggle && ((IRedstoneToggle)tile).isPulseMode()){
((IRedstoneToggle)tile).activateOnPulse();
}
}
}
@Override @Override
public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block neighborBlock){ public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block neighborBlock){
this.updateRedstoneState(world, pos); this.updateRedstoneState(world, pos);
@ -142,13 +181,8 @@ public abstract class BlockContainerBase extends BlockContainer{
} }
@Override @Override
public void updateTick(World world, BlockPos pos, IBlockState state, Random random){ public void onBlockAdded(World world, BlockPos pos, IBlockState state){
if(!world.isRemote){ this.updateRedstoneState(world, pos);
TileEntity tile = world.getTileEntity(pos);
if(tile instanceof IRedstoneToggle && ((IRedstoneToggle)tile).isPulseMode()){
((IRedstoneToggle)tile).activateOnPulse();
}
}
} }
@Override @Override
@ -203,6 +237,11 @@ public abstract class BlockContainerBase extends BlockContainer{
return 0; return 0;
} }
@Override
protected BlockState createBlockState(){
return this.getMetaProperty() == null ? super.createBlockState() : new BlockState(this, this.getMetaProperty());
}
@Override @Override
public ArrayList<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune){ public ArrayList<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune){
ArrayList<ItemStack> drops = new ArrayList<ItemStack>(); ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
@ -246,45 +285,6 @@ public abstract class BlockContainerBase extends BlockContainer{
return drops; return drops;
} }
@Override
public void onBlockAdded(World world, BlockPos pos, IBlockState state){
this.updateRedstoneState(world, pos);
}
public boolean tryToggleRedstone(World world, BlockPos pos, EntityPlayer player){
ItemStack stack = player.getCurrentEquippedItem();
if(stack != null && Block.getBlockFromItem(stack.getItem()) instanceof BlockRedstoneTorch){
TileEntity tile = world.getTileEntity(pos);
if(tile instanceof IRedstoneToggle){
if(!world.isRemote){
((IRedstoneToggle)tile).toggle(!((IRedstoneToggle)tile).isPulseMode());
tile.markDirty();
if(tile instanceof TileEntityBase){
((TileEntityBase)tile).sendUpdate();
}
}
return true;
}
}
return false;
}
@Override
protected BlockState createBlockState(){
return this.getMetaProperty() == null ? super.createBlockState() : new BlockState(this, this.getMetaProperty());
}
@Override
public IBlockState getStateFromMeta(int meta){
return this.getMetaProperty() == null ? super.getStateFromMeta(meta) : this.getDefaultState().withProperty(this.getMetaProperty(), meta);
}
@Override
public int getMetaFromState(IBlockState state){
return this.getMetaProperty() == null ? super.getMetaFromState(state) : state.getValue(this.getMetaProperty());
}
protected PropertyInteger getMetaProperty(){ protected PropertyInteger getMetaProperty(){
return null; return null;
} }

View file

@ -47,6 +47,49 @@ public class BlockPlant extends BlockCrops{
this.register(); this.register();
} }
private void register(){
this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName());
GameRegistry.registerBlock(this, this.getItemBlock(), this.getBaseName());
if(this.shouldAddCreative()){
this.setCreativeTab(CreativeTab.instance);
}
else{
this.setCreativeTab(null);
}
this.registerRendering();
}
protected String getBaseName(){
return this.name;
}
protected Class<? extends ItemBlockBase> getItemBlock(){
return ItemBlockBase.class;
}
public boolean shouldAddCreative(){
return false;
}
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.RARE;
}
@Override
public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos){
return EnumPlantType.Crop;
}
@Override
public int damageDropped(IBlockState state){
return this.getMetaFromState(state) >= 7 ? this.returnMeta : 0;
}
@Override @Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing facing, float hitX, float hitY, float hitZ){ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing facing, float hitX, float hitY, float hitZ){
if(getMetaFromState(state) >= 7){ if(getMetaFromState(state) >= 7){
@ -73,73 +116,30 @@ public class BlockPlant extends BlockCrops{
return true; return true;
} }
return false; return false;
} } @Override
private void register(){
this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName());
GameRegistry.registerBlock(this, this.getItemBlock(), this.getBaseName());
if(this.shouldAddCreative()){
this.setCreativeTab(CreativeTab.instance);
}
else{
this.setCreativeTab(null);
}
this.registerRendering();
}
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
protected String getBaseName(){
return this.name;
}
protected Class<? extends ItemBlockBase> getItemBlock(){
return ItemBlockBase.class;
}
public boolean shouldAddCreative(){
return false;
}
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.RARE;
}
@Override
public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos){
return EnumPlantType.Crop;
}
@Override
public Item getSeed(){ public Item getSeed(){
return this.seedItem; return this.seedItem;
} }
@Override @Override
public int getDamageValue(World world, BlockPos pos){
return 0;
} @Override
public Item getCrop(){ public Item getCrop(){
return this.returnItem; return this.returnItem;
} }
@Override @Override
public int quantityDropped(IBlockState state, int fortune, Random random){
return this.getMetaFromState(state) >= 7 ? random.nextInt(addDropAmount)+minDropAmount : super.quantityDropped(state, fortune, random);
} @Override
public Item getItemDropped(IBlockState state, Random rand, int par3){ public Item getItemDropped(IBlockState state, Random rand, int par3){
return this.getMetaFromState(state) >= 7 ? this.getCrop() : this.getSeed(); return this.getMetaFromState(state) >= 7 ? this.getCrop() : this.getSeed();
} }
@Override
public int damageDropped(IBlockState state){
return this.getMetaFromState(state) >= 7 ? this.returnMeta : 0;
}
@Override
public int getDamageValue(World world, BlockPos pos){
return 0;
}
@Override
public int quantityDropped(IBlockState state, int fortune, Random random){
return this.getMetaFromState(state) >= 7 ? random.nextInt(addDropAmount)+minDropAmount : super.quantityDropped(state, fortune, random);
}
} }

View file

@ -50,10 +50,6 @@ public class BlockStair extends BlockStairs{
this.registerRendering(); this.registerRendering();
} }
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
protected String getBaseName(){ protected String getBaseName(){
return this.name; return this.name;
} }
@ -66,6 +62,10 @@ public class BlockStair extends BlockStairs{
return true; return true;
} }
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
public EnumRarity getRarity(ItemStack stack){ public EnumRarity getRarity(ItemStack stack){
return EnumRarity.COMMON; return EnumRarity.COMMON;
} }

View file

@ -49,16 +49,9 @@ public class BlockWallAA extends BlockBase{
this.setDefaultState(this.blockState.getBaseState().withProperty(BlockWall.UP, false).withProperty(BlockWall.NORTH, false).withProperty(BlockWall.EAST, false).withProperty(BlockWall.SOUTH, false).withProperty(BlockWall.WEST, false)); this.setDefaultState(this.blockState.getBaseState().withProperty(BlockWall.UP, false).withProperty(BlockWall.NORTH, false).withProperty(BlockWall.EAST, false).withProperty(BlockWall.SOUTH, false).withProperty(BlockWall.WEST, false));
} }
@SuppressWarnings("unchecked")
@Override @Override
@SideOnly(Side.CLIENT) public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos){
public void getSubBlocks(Item item, CreativeTabs tab, List list){ return state.withProperty(BlockWall.UP, !worldIn.isAirBlock(pos.up())).withProperty(BlockWall.NORTH, this.canConnectTo(worldIn, pos.north())).withProperty(BlockWall.EAST, this.canConnectTo(worldIn, pos.east())).withProperty(BlockWall.SOUTH, this.canConnectTo(worldIn, pos.south())).withProperty(BlockWall.WEST, this.canConnectTo(worldIn, pos.west()));
list.add(new ItemStack(item, 1, 0));
}
@Override
public int damageDropped(IBlockState state){
return meta;
} }
@Override @Override
@ -71,11 +64,29 @@ public class BlockWallAA extends BlockBase{
return false; return false;
} }
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side){
return side != EnumFacing.DOWN || super.shouldSideBeRendered(worldIn, pos, side);
}
@Override
public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state){
this.setBlockBoundsBasedOnState(worldIn, pos);
this.maxY = 1.5D;
return super.getCollisionBoundingBox(worldIn, pos, state);
}
@Override @Override
public boolean isOpaqueCube(){ public boolean isOpaqueCube(){
return false; return false;
} }
@Override
public int damageDropped(IBlockState state){
return meta;
}
@Override @Override
public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos){ public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos){
boolean flag = this.canConnectTo(worldIn, pos.north()); boolean flag = this.canConnectTo(worldIn, pos.north());
@ -115,11 +126,11 @@ public class BlockWallAA extends BlockBase{
this.setBlockBounds(f, 0.0F, f2, f1, f4, f3); this.setBlockBounds(f, 0.0F, f2, f1, f4, f3);
} }
@SuppressWarnings("unchecked")
@Override @Override
public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state){ @SideOnly(Side.CLIENT)
this.setBlockBoundsBasedOnState(worldIn, pos); public void getSubBlocks(Item item, CreativeTabs tab, List list){
this.maxY = 1.5D; list.add(new ItemStack(item, 1, 0));
return super.getCollisionBoundingBox(worldIn, pos, state);
} }
public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos){ public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos){
@ -127,22 +138,6 @@ public class BlockWallAA extends BlockBase{
return block != Blocks.barrier && (!(block != this && !(block instanceof BlockFenceGate)) || ((block.getMaterial().isOpaque() && block.isFullCube()) && block.getMaterial() != Material.gourd)); return block != Blocks.barrier && (!(block != this && !(block instanceof BlockFenceGate)) || ((block.getMaterial().isOpaque() && block.isFullCube()) && block.getMaterial() != Material.gourd));
} }
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side){
return side != EnumFacing.DOWN || super.shouldSideBeRendered(worldIn, pos, side);
}
@Override
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos){
return state.withProperty(BlockWall.UP, !worldIn.isAirBlock(pos.up())).withProperty(BlockWall.NORTH, this.canConnectTo(worldIn, pos.north())).withProperty(BlockWall.EAST, this.canConnectTo(worldIn, pos.east())).withProperty(BlockWall.SOUTH, this.canConnectTo(worldIn, pos.south())).withProperty(BlockWall.WEST, this.canConnectTo(worldIn, pos.west()));
}
@Override
protected BlockState createBlockState(){
return new BlockState(this, BlockWall.UP, BlockWall.NORTH, BlockWall.EAST, BlockWall.WEST, BlockWall.SOUTH);
}
@Override @Override
public IBlockState getStateFromMeta(int meta){ public IBlockState getStateFromMeta(int meta){
return this.getDefaultState(); return this.getDefaultState();
@ -152,4 +147,9 @@ public class BlockWallAA extends BlockBase{
public int getMetaFromState(IBlockState state){ public int getMetaFromState(IBlockState state){
return 0; return 0;
} }
@Override
protected BlockState createBlockState(){
return new BlockState(this, BlockWall.UP, BlockWall.NORTH, BlockWall.EAST, BlockWall.WEST, BlockWall.SOUTH);
}
} }

View file

@ -91,11 +91,6 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
this.saveOnClose = saveOnClose; this.saveOnClose = saveOnClose;
} }
@Override
public void drawHoveringText(List list, int x, int y){
super.drawHoveringText(list, x, y);
}
public FontRenderer getFontRenderer(){ public FontRenderer getFontRenderer(){
return this.fontRendererObj; return this.fontRendererObj;
} }
@ -197,6 +192,11 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
} }
} }
@Override
public void drawHoveringText(List list, int x, int y){
super.drawHoveringText(list, x, y);
}
@Override @Override
protected void mouseClicked(int par1, int par2, int par3) throws IOException{ protected void mouseClicked(int par1, int par2, int par3) throws IOException{
this.searchField.mouseClicked(par1, par2, par3); this.searchField.mouseClicked(par1, par2, par3);

View file

@ -50,11 +50,6 @@ public class BookletChapter implements IBookletChapter{
return this.pages; return this.pages;
} }
public BookletChapter setIncomplete(){
this.isIncomplete = true;
return this;
}
@Override @Override
public String getUnlocalizedName(){ public String getUnlocalizedName(){
return this.unlocalizedName; return this.unlocalizedName;
@ -80,6 +75,11 @@ public class BookletChapter implements IBookletChapter{
return this.displayStack; return this.displayStack;
} }
public BookletChapter setIncomplete(){
this.isIncomplete = true;
return this;
}
public BookletChapter setImportant(){ public BookletChapter setImportant(){
this.color = EnumChatFormatting.DARK_GREEN; this.color = EnumChatFormatting.DARK_GREEN;
return this; return this;

View file

@ -33,29 +33,19 @@ public class BookletEntry implements IBookletEntry{
this.color = EnumChatFormatting.RESET; this.color = EnumChatFormatting.RESET;
} }
@Override
public String getUnlocalizedName(){
return this.unlocalizedName;
}
@Override @Override
public List<IBookletChapter> getChapters(){ public List<IBookletChapter> getChapters(){
return this.chapters; return this.chapters;
} }
@Override
public String getLocalizedNameWithFormatting(){
return this.color+this.getLocalizedName();
}
@Override @Override
public void setChapters(List<IBookletChapter> chapters){ public void setChapters(List<IBookletChapter> chapters){
this.chapters = chapters; this.chapters = chapters;
} }
@Override @Override
public void addChapter(IBookletChapter chapter){ public String getUnlocalizedName(){
this.chapters.add(chapter); return this.unlocalizedName;
} }
@Override @Override
@ -63,6 +53,16 @@ public class BookletEntry implements IBookletEntry{
return StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".indexEntry."+this.unlocalizedName+".name"); return StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".indexEntry."+this.unlocalizedName+".name");
} }
@Override
public String getLocalizedNameWithFormatting(){
return this.color+this.getLocalizedName();
}
@Override
public void addChapter(IBookletChapter chapter){
this.chapters.add(chapter);
}
public BookletEntry setImportant(){ public BookletEntry setImportant(){
this.color = EnumChatFormatting.DARK_GREEN; this.color = EnumChatFormatting.DARK_GREEN;
return this; return this;

View file

@ -23,16 +23,16 @@ public class BookletEntryAllSearch extends BookletEntry{
super(unlocalizedName); super(unlocalizedName);
} }
@Override
public void setChapters(List<IBookletChapter> chapters){
this.allChapters = (ArrayList<IBookletChapter>)chapters;
this.chapters = (ArrayList<IBookletChapter>)this.allChapters.clone();
}
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public void addChapter(IBookletChapter chapter){ public void addChapter(IBookletChapter chapter){
this.allChapters.add(chapter); this.allChapters.add(chapter);
this.chapters = (ArrayList<IBookletChapter>)this.allChapters.clone(); this.chapters = (ArrayList<IBookletChapter>)this.allChapters.clone();
} }
@Override
public void setChapters(List<IBookletChapter> chapters){
this.allChapters = (ArrayList<IBookletChapter>)chapters;
this.chapters = (ArrayList<IBookletChapter>)this.allChapters.clone();
}
} }

View file

@ -32,26 +32,11 @@ public class BookletPageAA extends BookletPage{
this.localizationKey = localizationKey; this.localizationKey = localizationKey;
} }
@Override
public ItemStack[] getItemStacksForPage(){
return null;
}
@Override
public String getClickToSeeRecipeString(){
return EnumChatFormatting.GOLD+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".clickToSeeRecipe");
}
@Override @Override
public int getID(){ public int getID(){
return Util.arrayContains(this.chapter.getPages(), this)+1; return Util.arrayContains(this.chapter.getPages(), this)+1;
} }
public BookletPage setNoText(){
this.hasNoText = true;
return this;
}
@Override @Override
public final String getText(){ public final String getText(){
if(this.hasNoText){ if(this.hasNoText){
@ -74,12 +59,12 @@ public class BookletPageAA extends BookletPage{
} }
@Override @Override
public void render(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){ public void renderPre(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
} }
@Override @Override
public void renderPre(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){ public void render(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
} }
@ -88,6 +73,21 @@ public class BookletPageAA extends BookletPage{
} }
@Override
public ItemStack[] getItemStacksForPage(){
return null;
}
@Override
public String getClickToSeeRecipeString(){
return EnumChatFormatting.GOLD+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".clickToSeeRecipe");
}
public BookletPage setNoText(){
this.hasNoText = true;
return this;
}
public BookletPageAA addTextReplacement(String text, int replacement){ public BookletPageAA addTextReplacement(String text, int replacement){
return this.addTextReplacement(text, Integer.toString(replacement)); return this.addTextReplacement(text, Integer.toString(replacement));
} }

View file

@ -72,15 +72,6 @@ public class PageCrafting extends BookletPageAA{
return null; return null;
} }
@Override
@SideOnly(Side.CLIENT)
public void renderPre(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
if(this.recipes[this.recipePos] != null){
Minecraft.getMinecraft().getTextureManager().bindTexture(ClientProxy.bulletForMyValentine ? GuiBooklet.resLocValentine : GuiBooklet.resLoc);
gui.drawRect(gui.getGuiLeft()+27, gui.getGuiTop()+20, 146, 20, 99, 60);
}
}
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@ -175,6 +166,15 @@ public class PageCrafting extends BookletPageAA{
} }
} }
@Override
@SideOnly(Side.CLIENT)
public void renderPre(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
if(this.recipes[this.recipePos] != null){
Minecraft.getMinecraft().getTextureManager().bindTexture(ClientProxy.bulletForMyValentine ? GuiBooklet.resLocValentine : GuiBooklet.resLoc);
gui.drawRect(gui.getGuiLeft()+27, gui.getGuiTop()+20, 146, 20, 99, 60);
}
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void updateScreen(int ticksElapsed){ public void updateScreen(int ticksElapsed){

View file

@ -39,11 +39,6 @@ public class PageCrusherRecipe extends BookletPageAA{
this.addToPagesWithItemStackData(); this.addToPagesWithItemStackData();
} }
@Override
public ItemStack[] getItemStacksForPage(){
return this.recipe == null ? new ItemStack[0] : this.recipe.getRecipeOutputOnes().toArray(new ItemStack[this.recipe.getRecipeOutputOnes().size()]);
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void renderPre(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){ public void renderPre(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
@ -129,4 +124,9 @@ public class PageCrusherRecipe extends BookletPageAA{
} }
} }
} }
@Override
public ItemStack[] getItemStacksForPage(){
return this.recipe == null ? new ItemStack[0] : this.recipe.getRecipeOutputOnes().toArray(new ItemStack[this.recipe.getRecipeOutputOnes().size()]);
}
} }

View file

@ -47,15 +47,6 @@ public class PageFurnace extends BookletPageAA{
return this.result == null ? new ItemStack[0] : new ItemStack[]{this.result}; return this.result == null ? new ItemStack[0] : new ItemStack[]{this.result};
} }
@Override
@SideOnly(Side.CLIENT)
public void renderPre(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
if(this.input != null || this.getInputForOutput(this.result) != null){
Minecraft.getMinecraft().getTextureManager().bindTexture(ClientProxy.bulletForMyValentine ? GuiBooklet.resLocValentine : GuiBooklet.resLoc);
gui.drawRect(gui.getGuiLeft()+37, gui.getGuiTop()+20, 0, 180, 60, 60);
}
}
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@ -98,6 +89,15 @@ public class PageFurnace extends BookletPageAA{
} }
} }
@Override
@SideOnly(Side.CLIENT)
public void renderPre(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
if(this.input != null || this.getInputForOutput(this.result) != null){
Minecraft.getMinecraft().getTextureManager().bindTexture(ClientProxy.bulletForMyValentine ? GuiBooklet.resLocValentine : GuiBooklet.resLoc);
gui.drawRect(gui.getGuiLeft()+37, gui.getGuiTop()+20, 0, 180, 60, 60);
}
}
private ItemStack getInputForOutput(ItemStack output){ private ItemStack getInputForOutput(ItemStack output){
for(Map.Entry o : FurnaceRecipes.instance().getSmeltingList().entrySet()){ for(Map.Entry o : FurnaceRecipes.instance().getSmeltingList().entrySet()){
ItemStack stack = (ItemStack)(o).getValue(); ItemStack stack = (ItemStack)(o).getValue();

View file

@ -43,20 +43,6 @@ public class PageReconstructor extends BookletPageAA{
this.addToPagesWithItemStackData(); this.addToPagesWithItemStackData();
} }
@Override
public ItemStack[] getItemStacksForPage(){
if(this.recipes != null){
ArrayList<ItemStack> stacks = new ArrayList<ItemStack>();
for(LensNoneRecipe recipe : this.recipes){
if(recipe != null){
stacks.addAll(recipe.getOutputs());
}
}
return stacks.toArray(new ItemStack[stacks.size()]);
}
return null;
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void renderPre(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){ public void renderPre(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
@ -125,4 +111,18 @@ public class PageReconstructor extends BookletPageAA{
} }
} }
} }
@Override
public ItemStack[] getItemStacksForPage(){
if(this.recipes != null){
ArrayList<ItemStack> stacks = new ArrayList<ItemStack>();
for(LensNoneRecipe recipe : this.recipes){
if(recipe != null){
stacks.addAll(recipe.getOutputs());
}
}
return stacks.toArray(new ItemStack[stacks.size()]);
}
return null;
}
} }

View file

@ -52,16 +52,6 @@ public class ItemBooklet extends ItemBase implements IHudDisplay{
this.setMaxDamage(0); this.setMaxDamage(0);
} }
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.BOOK.ordinal(), world, (int)player.posX, (int)player.posY, (int)player.posZ);
if(!world.isRemote){
player.triggerAchievement(TheAchievements.OPEN_BOOKLET.ach);
}
return stack;
}
@Override @Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing face, float hitX, float hitY, float hitZ){ public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing face, float hitX, float hitY, float hitZ){
if(player.isSneaking()){ if(player.isSneaking()){
@ -81,6 +71,16 @@ public class ItemBooklet extends ItemBase implements IHudDisplay{
return false; return false;
} }
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.BOOK.ordinal(), world, (int)player.posX, (int)player.posY, (int)player.posZ);
if(!world.isRemote){
player.triggerAchievement(TheAchievements.OPEN_BOOKLET.ach);
}
return stack;
}
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool){ public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool){

View file

@ -48,6 +48,14 @@ public class ItemCrystal extends ItemBase{
return stack.getItemDamage() >= BlockCrystal.allCrystals.length ? EnumRarity.COMMON : BlockCrystal.allCrystals[stack.getItemDamage()].rarity; return stack.getItemDamage() >= BlockCrystal.allCrystals.length ? EnumRarity.COMMON : BlockCrystal.allCrystals[stack.getItemDamage()].rarity;
} }
@SuppressWarnings("all")
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tab, List list){
for(int j = 0; j < BlockCrystal.allCrystals.length; j++){
list.add(new ItemStack(this, 1, j));
}
}
@Override @Override
protected void registerRendering(){ protected void registerRendering(){
ResourceLocation[] resLocs = new ResourceLocation[BlockCrystal.allCrystals.length]; ResourceLocation[] resLocs = new ResourceLocation[BlockCrystal.allCrystals.length];
@ -58,12 +66,4 @@ public class ItemCrystal extends ItemBase{
} }
ActuallyAdditions.proxy.addRenderVariant(this, resLocs); ActuallyAdditions.proxy.addRenderVariant(this, resLocs);
} }
@SuppressWarnings("all")
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tab, List list){
for(int j = 0; j < BlockCrystal.allCrystals.length; j++){
list.add(new ItemStack(this, 1, j));
}
}
} }

View file

@ -107,17 +107,6 @@ public class ItemDrill extends ItemEnergy{
return false; return false;
} }
@Override
protected void registerRendering(){
ResourceLocation[] resLocs = new ResourceLocation[16];
for(int i = 0; i < 16; i++){
String name = this.getBaseName()+TheColoredLampColors.values()[i].name;
resLocs[i] = new ResourceLocation(ModUtil.MOD_ID_LOWER, name);
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this, 1, i), new ResourceLocation(ModUtil.MOD_ID_LOWER, name));
}
ActuallyAdditions.proxy.addRenderVariant(this, resLocs);
}
/** /**
* Checks if a certain Upgrade is installed and returns it as an ItemStack * Checks if a certain Upgrade is installed and returns it as an ItemStack
* *
@ -342,6 +331,17 @@ public class ItemDrill extends ItemEnergy{
return this.getHasUpgradeAsStack(stack, upgrade) != null; return this.getHasUpgradeAsStack(stack, upgrade) != null;
} }
@Override
protected void registerRendering(){
ResourceLocation[] resLocs = new ResourceLocation[16];
for(int i = 0; i < 16; i++){
String name = this.getBaseName()+TheColoredLampColors.values()[i].name;
resLocs[i] = new ResourceLocation(ModUtil.MOD_ID_LOWER, name);
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this, 1, i), new ResourceLocation(ModUtil.MOD_ID_LOWER, name));
}
ActuallyAdditions.proxy.addRenderVariant(this, resLocs);
}
@Override @Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)

View file

@ -79,6 +79,14 @@ public class ItemPhantomConnector extends ItemBase{
} }
} }
public static World getStoredWorld(ItemStack stack){
NBTTagCompound tag = stack.getTagCompound();
if(tag != null){
return DimensionManager.getWorld(tag.getInteger("WorldOfTileStored"));
}
return null;
}
public static BlockPos getStoredPosition(ItemStack stack){ public static BlockPos getStoredPosition(ItemStack stack){
NBTTagCompound tag = stack.getTagCompound(); NBTTagCompound tag = stack.getTagCompound();
if(tag != null){ if(tag != null){
@ -92,14 +100,6 @@ public class ItemPhantomConnector extends ItemBase{
return null; return null;
} }
public static World getStoredWorld(ItemStack stack){
NBTTagCompound tag = stack.getTagCompound();
if(tag != null){
return DimensionManager.getWorld(tag.getInteger("WorldOfTileStored"));
}
return null;
}
public static void clearStorage(ItemStack stack){ public static void clearStorage(ItemStack stack){
stack.setTagCompound(new NBTTagCompound()); stack.setTagCompound(new NBTTagCompound());
} }

View file

@ -47,6 +47,11 @@ public class ItemAllToolAA extends ItemTool{
private ItemStack repairItem; private ItemStack repairItem;
private String repairOredict; private String repairOredict;
public ItemAllToolAA(ToolMaterial toolMat, String repairItem, String unlocalizedName, EnumRarity rarity, int color){
this(toolMat, (ItemStack)null, unlocalizedName, rarity, color);
this.repairOredict = repairItem;
}
public ItemAllToolAA(ToolMaterial toolMat, ItemStack repairItem, String unlocalizedName, EnumRarity rarity, int color){ public ItemAllToolAA(ToolMaterial toolMat, ItemStack repairItem, String unlocalizedName, EnumRarity rarity, int color){
super(4.0F, toolMat, new HashSet<Block>()); super(4.0F, toolMat, new HashSet<Block>());
@ -60,11 +65,6 @@ public class ItemAllToolAA extends ItemTool{
this.register(); this.register();
} }
public ItemAllToolAA(ToolMaterial toolMat, String repairItem, String unlocalizedName, EnumRarity rarity, int color){
this(toolMat, (ItemStack)null, unlocalizedName, rarity, color);
this.repairOredict = repairItem;
}
private void register(){ private void register(){
this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName()); this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName());
GameRegistry.registerItem(this, this.getBaseName()); GameRegistry.registerItem(this, this.getBaseName());
@ -79,11 +79,6 @@ public class ItemAllToolAA extends ItemTool{
this.registerRendering(); this.registerRendering();
} }
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, "itemPaxel"));
ActuallyAdditions.proxy.addRenderVariant(this, new ResourceLocation(ModUtil.MOD_ID_LOWER, "itemPaxel"));
}
protected String getBaseName(){ protected String getBaseName(){
return this.name; return this.name;
} }
@ -92,6 +87,11 @@ public class ItemAllToolAA extends ItemTool{
return true; return true;
} }
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, "itemPaxel"));
ActuallyAdditions.proxy.addRenderVariant(this, new ResourceLocation(ModUtil.MOD_ID_LOWER, "itemPaxel"));
}
@Override @Override
public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ){ public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ){
if(!playerIn.canPlayerEdit(pos.offset(side), side, stack)){ if(!playerIn.canPlayerEdit(pos.offset(side), side, stack)){

View file

@ -26,6 +26,10 @@ public class ItemArmorAA extends ItemArmor{
private String name; private String name;
private EnumRarity rarity; private EnumRarity rarity;
public ItemArmorAA(String name, ArmorMaterial material, int type, ItemStack repairItem, String textureBase){
this(name, material, type, repairItem, textureBase, EnumRarity.RARE);
}
public ItemArmorAA(String name, ArmorMaterial material, int type, ItemStack repairItem, String textureBase, EnumRarity rarity){ public ItemArmorAA(String name, ArmorMaterial material, int type, ItemStack repairItem, String textureBase, EnumRarity rarity){
super(material, 0, type); super(material, 0, type);
this.repairItem = repairItem; this.repairItem = repairItem;
@ -35,10 +39,6 @@ public class ItemArmorAA extends ItemArmor{
this.register(); this.register();
} }
public ItemArmorAA(String name, ArmorMaterial material, int type, ItemStack repairItem, String textureBase){
this(name, material, type, repairItem, textureBase, EnumRarity.RARE);
}
private void register(){ private void register(){
this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName()); this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName());
GameRegistry.registerItem(this, this.getBaseName()); GameRegistry.registerItem(this, this.getBaseName());
@ -52,10 +52,6 @@ public class ItemArmorAA extends ItemArmor{
this.registerRendering(); this.registerRendering();
} }
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
protected String getBaseName(){ protected String getBaseName(){
return this.name; return this.name;
} }
@ -64,6 +60,10 @@ public class ItemArmorAA extends ItemArmor{
return true; return true;
} }
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
@Override @Override
public EnumRarity getRarity(ItemStack stack){ public EnumRarity getRarity(ItemStack stack){
return this.rarity; return this.rarity;

View file

@ -49,10 +49,6 @@ public class ItemAxeAA extends ItemAxe{
this.registerRendering(); this.registerRendering();
} }
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
protected String getBaseName(){ protected String getBaseName(){
return this.name; return this.name;
} }
@ -61,6 +57,10 @@ public class ItemAxeAA extends ItemAxe{
return true; return true;
} }
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
@Override @Override
public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){ public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){
return ItemUtil.areItemsEqual(this.repairItem, stack, false); return ItemUtil.areItemsEqual(this.repairItem, stack, false);

View file

@ -42,10 +42,6 @@ public class ItemBase extends Item{
this.registerRendering(); this.registerRendering();
} }
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
protected String getBaseName(){ protected String getBaseName(){
return this.name; return this.name;
} }
@ -53,4 +49,8 @@ public class ItemBase extends Item{
public boolean shouldAddCreative(){ public boolean shouldAddCreative(){
return true; return true;
} }
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
} }

View file

@ -46,10 +46,6 @@ public class ItemBucketAA extends ItemBucket{
this.registerRendering(); this.registerRendering();
} }
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
protected String getBaseName(){ protected String getBaseName(){
return this.name; return this.name;
} }
@ -58,6 +54,10 @@ public class ItemBucketAA extends ItemBucket{
return true; return true;
} }
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
@Override @Override
public EnumRarity getRarity(ItemStack stack){ public EnumRarity getRarity(ItemStack stack){
return EnumRarity.UNCOMMON; return EnumRarity.UNCOMMON;

View file

@ -53,10 +53,6 @@ public abstract class ItemEnergy extends ItemEnergyContainer{
this.registerRendering(); this.registerRendering();
} }
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
protected String getBaseName(){ protected String getBaseName(){
return this.name; return this.name;
} }
@ -65,6 +61,10 @@ public abstract class ItemEnergy extends ItemEnergyContainer{
return true; return true;
} }
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
@Override @Override
public boolean getShareTag(){ public boolean getShareTag(){
return true; return true;
@ -81,6 +81,12 @@ public abstract class ItemEnergy extends ItemEnergyContainer{
list.add(this.getEnergyStored(stack)+"/"+this.getMaxEnergyStored(stack)+" RF"); list.add(this.getEnergyStored(stack)+"/"+this.getMaxEnergyStored(stack)+" RF");
} }
@Override
@SideOnly(Side.CLIENT)
public boolean hasEffect(ItemStack stack){
return false;
}
@Override @Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@ -106,12 +112,6 @@ public abstract class ItemEnergy extends ItemEnergyContainer{
return energyDif/maxAmount; return energyDif/maxAmount;
} }
@Override
@SideOnly(Side.CLIENT)
public boolean hasEffect(ItemStack stack){
return false;
}
public void setEnergy(ItemStack stack, int energy){ public void setEnergy(ItemStack stack, int energy){
NBTTagCompound compound = stack.getTagCompound(); NBTTagCompound compound = stack.getTagCompound();
if(compound == null){ if(compound == null){

View file

@ -43,10 +43,6 @@ public class ItemFoodBase extends ItemFood{
this.registerRendering(); this.registerRendering();
} }
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
protected String getBaseName(){ protected String getBaseName(){
return this.name; return this.name;
} }
@ -54,4 +50,8 @@ public class ItemFoodBase extends ItemFood{
public boolean shouldAddCreative(){ public boolean shouldAddCreative(){
return true; return true;
} }
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
} }

View file

@ -50,10 +50,6 @@ public class ItemHoeAA extends ItemHoe{
this.registerRendering(); this.registerRendering();
} }
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
protected String getBaseName(){ protected String getBaseName(){
return this.name; return this.name;
} }
@ -62,6 +58,10 @@ public class ItemHoeAA extends ItemHoe{
return true; return true;
} }
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
@Override @Override
public EnumRarity getRarity(ItemStack stack){ public EnumRarity getRarity(ItemStack stack){
return this.rarity; return this.rarity;

View file

@ -49,10 +49,6 @@ public class ItemPickaxeAA extends ItemPickaxe{
this.registerRendering(); this.registerRendering();
} }
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
protected String getBaseName(){ protected String getBaseName(){
return this.name; return this.name;
} }
@ -61,6 +57,10 @@ public class ItemPickaxeAA extends ItemPickaxe{
return true; return true;
} }
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
@Override @Override
public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){ public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){
return ItemUtil.areItemsEqual(this.repairItem, stack, false); return ItemUtil.areItemsEqual(this.repairItem, stack, false);

View file

@ -57,10 +57,6 @@ public class ItemSeed extends ItemSeeds{
this.registerRendering(); this.registerRendering();
} }
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
protected String getBaseName(){ protected String getBaseName(){
return this.name; return this.name;
} }
@ -69,6 +65,10 @@ public class ItemSeed extends ItemSeeds{
return true; return true;
} }
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
@Override @Override
public EnumRarity getRarity(ItemStack stack){ public EnumRarity getRarity(ItemStack stack){
return EnumRarity.RARE; return EnumRarity.RARE;

View file

@ -50,10 +50,6 @@ public class ItemShovelAA extends ItemSpade{
this.registerRendering(); this.registerRendering();
} }
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
protected String getBaseName(){ protected String getBaseName(){
return this.name; return this.name;
} }
@ -62,6 +58,10 @@ public class ItemShovelAA extends ItemSpade{
return true; return true;
} }
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
@Override @Override
public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){ public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){
return ItemUtil.areItemsEqual(this.repairItem, stack, false); return ItemUtil.areItemsEqual(this.repairItem, stack, false);

View file

@ -50,10 +50,6 @@ public class ItemSwordAA extends ItemSword{
this.registerRendering(); this.registerRendering();
} }
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
protected String getBaseName(){ protected String getBaseName(){
return this.name; return this.name;
} }
@ -62,6 +58,10 @@ public class ItemSwordAA extends ItemSword{
return true; return true;
} }
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
protected Class<? extends ItemBlockBase> getItemBlock(){ protected Class<? extends ItemBlockBase> getItemBlock(){
return ItemBlockBase.class; return ItemBlockBase.class;
} }

View file

@ -36,6 +36,10 @@ public abstract class RecipeWrapperWithButton{
}; };
} }
public abstract int getButtonX();
public abstract int getButtonY();
public boolean handleClick(Minecraft mc, int mouseX, int mouseY){ public boolean handleClick(Minecraft mc, int mouseX, int mouseY){
if(this.theButton.mousePressed(mc, mouseX, mouseY)){ if(this.theButton.mousePressed(mc, mouseX, mouseY)){
this.theButton.playPressSound(mc.getSoundHandler()); this.theButton.playPressSound(mc.getSoundHandler());
@ -52,12 +56,9 @@ public abstract class RecipeWrapperWithButton{
return false; return false;
} }
public abstract BookletPage getPage();
public void updateButton(Minecraft mc, int mouseX, int mouseY){ public void updateButton(Minecraft mc, int mouseX, int mouseY){
this.theButton.drawButton(mc, mouseX, mouseY); this.theButton.drawButton(mc, mouseX, mouseY);
} }
public abstract BookletPage getPage();
public abstract int getButtonX();
public abstract int getButtonY();
} }

View file

@ -96,11 +96,6 @@ public class BookletRecipeWrapper extends RecipeWrapperWithButton implements IRe
return this.handleClick(minecraft, mouseX, mouseY); return this.handleClick(minecraft, mouseX, mouseY);
} }
@Override
public BookletPage getPage(){
return this.thePage;
}
@Override @Override
public int getButtonX(){ public int getButtonX(){
return 0; return 0;
@ -110,4 +105,9 @@ public class BookletRecipeWrapper extends RecipeWrapperWithButton implements IRe
public int getButtonY(){ public int getButtonY(){
return 84; return 84;
} }
@Override
public BookletPage getPage(){
return this.thePage;
}
} }

View file

@ -104,11 +104,6 @@ public class CoffeeMachineRecipeWrapper extends RecipeWrapperWithButton implemen
return this.handleClick(minecraft, mouseX, mouseY); return this.handleClick(minecraft, mouseX, mouseY);
} }
@Override
public BookletPage getPage(){
return BookletUtils.getFirstPageForStack(new ItemStack(InitBlocks.blockCoffeeMachine));
}
@Override @Override
public int getButtonX(){ public int getButtonX(){
return 0; return 0;
@ -118,4 +113,9 @@ public class CoffeeMachineRecipeWrapper extends RecipeWrapperWithButton implemen
public int getButtonY(){ public int getButtonY(){
return 70; return 70;
} }
@Override
public BookletPage getPage(){
return BookletUtils.getFirstPageForStack(new ItemStack(InitBlocks.blockCoffeeMachine));
}
} }

View file

@ -93,11 +93,6 @@ public class CrusherRecipeWrapper extends RecipeWrapperWithButton implements IRe
return this.handleClick(minecraft, mouseX, mouseY); return this.handleClick(minecraft, mouseX, mouseY);
} }
@Override
public BookletPage getPage(){
return BookletUtils.getFirstPageForStack(new ItemStack(InitBlocks.blockGrinder));
}
@Override @Override
public int getButtonX(){ public int getButtonX(){
return -5; return -5;
@ -107,4 +102,9 @@ public class CrusherRecipeWrapper extends RecipeWrapperWithButton implements IRe
public int getButtonY(){ public int getButtonY(){
return 26; return 26;
} }
@Override
public BookletPage getPage(){
return BookletUtils.getFirstPageForStack(new ItemStack(InitBlocks.blockGrinder));
}
} }

View file

@ -26,8 +26,8 @@ import javax.annotation.Nonnull;
public class ReconstructorRecipeCategory implements IRecipeCategory{ public class ReconstructorRecipeCategory implements IRecipeCategory{
private IDrawable background;
private static final ItemStack RECONSTRUCTOR = new ItemStack(InitBlocks.blockAtomicReconstructor); private static final ItemStack RECONSTRUCTOR = new ItemStack(InitBlocks.blockAtomicReconstructor);
private IDrawable background;
public ReconstructorRecipeCategory(IGuiHelper helper){ public ReconstructorRecipeCategory(IGuiHelper helper){
this.background = helper.createDrawable(AssetUtil.getGuiLocation("guiNEIAtomicReconstructor"), 0, 0, 96, 60); this.background = helper.createDrawable(AssetUtil.getGuiLocation("guiNEIAtomicReconstructor"), 0, 0, 96, 60);

View file

@ -79,11 +79,6 @@ public class ReconstructorRecipeWrapper extends RecipeWrapperWithButton implemen
return this.handleClick(minecraft, mouseX, mouseY); return this.handleClick(minecraft, mouseX, mouseY);
} }
@Override
public BookletPage getPage(){
return BookletUtils.getFirstPageForStack(new ItemStack(InitBlocks.blockAtomicReconstructor));
}
@Override @Override
public int getButtonX(){ public int getButtonX(){
return 3; return 3;
@ -93,4 +88,9 @@ public class ReconstructorRecipeWrapper extends RecipeWrapperWithButton implemen
public int getButtonY(){ public int getButtonY(){
return 40; return 40;
} }
@Override
public BookletPage getPage(){
return BookletUtils.getFirstPageForStack(new ItemStack(InitBlocks.blockAtomicReconstructor));
}
} }

View file

@ -64,10 +64,6 @@ public class InitOreDict{
addOre(InitItems.itemCrystal, TheCrystals.REDSTONE.ordinal(), "actAddCrystalRed"); addOre(InitItems.itemCrystal, TheCrystals.REDSTONE.ordinal(), "actAddCrystalRed");
} }
private static void addOre(ItemStack stack, String name){
OreDictionary.registerOre(name, stack);
}
private static void addOre(Item item, int meta, String name){ private static void addOre(Item item, int meta, String name){
addOre(new ItemStack(item, 1, meta), name); addOre(new ItemStack(item, 1, meta), name);
} }
@ -76,11 +72,15 @@ public class InitOreDict{
addOre(item, 0, name); addOre(item, 0, name);
} }
private static void addOre(Block block, String name){
addOre(block, 0, name);
}
private static void addOre(Block block, int meta, String name){ private static void addOre(Block block, int meta, String name){
addOre(new ItemStack(block, 1, meta), name); addOre(new ItemStack(block, 1, meta), name);
} }
private static void addOre(Block block, String name){ private static void addOre(ItemStack stack, String name){
addOre(block, 0, name); OreDictionary.registerOre(name, stack);
} }
} }

View file

@ -46,15 +46,13 @@ import java.util.Map;
public class ClientProxy implements IProxy{ public class ClientProxy implements IProxy{
private static Map<ItemStack, ResourceLocation> modelLocationsForRegistering = new HashMap<ItemStack, ResourceLocation>();
private static Map<Item, ResourceLocation[]> modelVariantsForRegistering = new HashMap<Item, ResourceLocation[]>();
public static boolean pumpkinBlurPumpkinBlur; public static boolean pumpkinBlurPumpkinBlur;
public static boolean jingleAllTheWay; public static boolean jingleAllTheWay;
public static boolean bulletForMyValentine; public static boolean bulletForMyValentine;
public static int bookletWordCount; public static int bookletWordCount;
public static int bookletCharCount; public static int bookletCharCount;
private static Map<ItemStack, ResourceLocation> modelLocationsForRegistering = new HashMap<ItemStack, ResourceLocation>();
private static Map<Item, ResourceLocation[]> modelVariantsForRegistering = new HashMap<Item, ResourceLocation[]>();
@Override @Override
public void preInit(FMLPreInitializationEvent event){ public void preInit(FMLPreInitializationEvent event){
@ -101,6 +99,26 @@ public class ClientProxy implements IProxy{
ModelLoader.setCustomStateMapper(block, mapper); ModelLoader.setCustomStateMapper(block, mapper);
} }
private static void countBookletWords(){
bookletWordCount = 0;
bookletCharCount = 0;
for(IBookletEntry entry : ActuallyAdditionsAPI.bookletEntries){
for(IBookletChapter chapter : entry.getChapters()){
for(BookletPage page : chapter.getPages()){
if(page.getText() != null){
bookletWordCount += page.getText().split(" ").length;
bookletCharCount += page.getText().length();
}
}
bookletWordCount += chapter.getLocalizedName().split(" ").length;
bookletCharCount += chapter.getLocalizedName().length();
}
bookletWordCount += entry.getLocalizedName().split(" ").length;
bookletCharCount += entry.getLocalizedName().length();
}
}
@Override @Override
public void init(FMLInitializationEvent event){ public void init(FMLInitializationEvent event){
ModUtil.LOGGER.info("Initializing ClientProxy..."); ModUtil.LOGGER.info("Initializing ClientProxy...");
@ -144,24 +162,4 @@ public class ClientProxy implements IProxy{
public void addRenderVariant(Item item, ResourceLocation... location){ public void addRenderVariant(Item item, ResourceLocation... location){
modelVariantsForRegistering.put(item, location); modelVariantsForRegistering.put(item, location);
} }
private static void countBookletWords(){
bookletWordCount = 0;
bookletCharCount = 0;
for(IBookletEntry entry : ActuallyAdditionsAPI.bookletEntries){
for(IBookletChapter chapter : entry.getChapters()){
for(BookletPage page : chapter.getPages()){
if(page.getText() != null){
bookletWordCount += page.getText().split(" ").length;
bookletCharCount += page.getText().length();
}
}
bookletWordCount += chapter.getLocalizedName().split(" ").length;
bookletCharCount += chapter.getLocalizedName().length();
}
bookletWordCount += entry.getLocalizedName().split(" ").length;
bookletCharCount += entry.getLocalizedName().length();
}
}
} }

View file

@ -43,6 +43,25 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
super(1, "reconstructor"); super(1, "reconstructor");
} }
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
compound.setInteger("CurrentTime", this.currentTime);
this.storage.writeToNBT(compound);
}
@Override
public boolean shouldSyncSlots(){
return true;
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.currentTime = compound.getInteger("CurrentTime");
this.storage.readFromNBT(compound);
}
@Override @Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void updateEntity(){ public void updateEntity(){
@ -107,10 +126,33 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
} }
@Override @Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ public int getX(){
super.writeSyncableNBT(compound, sync); return this.getPos().getX();
compound.setInteger("CurrentTime", this.currentTime); }
this.storage.writeToNBT(compound);
@Override
public int getY(){
return this.getPos().getY();
}
@Override
public int getZ(){
return this.getPos().getZ();
}
@Override
public World getWorldObject(){
return this.getWorld();
}
@Override
public void extractEnergy(int amount){
this.storage.extractEnergy(amount, false);
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return stack != null && stack.getItem() instanceof ILensItem;
} }
@Override @Override
@ -119,18 +161,6 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
this.sendUpdate(); this.sendUpdate();
} }
@Override
public boolean shouldSyncSlots(){
return true;
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.currentTime = compound.getInteger("CurrentTime");
this.storage.readFromNBT(compound);
}
@Override @Override
public int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate){ public int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate){
return this.storage.receiveEnergy(maxReceive, simulate); return this.storage.receiveEnergy(maxReceive, simulate);
@ -156,41 +186,11 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
return this.isItemValidForSlot(slot, stack); return this.isItemValidForSlot(slot, stack);
} }
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return stack != null && stack.getItem() instanceof ILensItem;
}
@Override @Override
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){ public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
return true; return true;
} }
@Override
public int getX(){
return this.getPos().getX();
}
@Override
public int getY(){
return this.getPos().getY();
}
@Override
public int getZ(){
return this.getPos().getZ();
}
@Override
public World getWorldObject(){
return this.getWorld();
}
@Override
public void extractEnergy(int amount){
this.storage.extractEnergy(amount, false);
}
@Override @Override
public int getEnergy(){ public int getEnergy(){
return this.storage.getEnergyStored(); return this.storage.getEnergyStored();

View file

@ -28,8 +28,8 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
public abstract class TileEntityBase extends TileEntity implements ITickable{ public abstract class TileEntityBase extends TileEntity implements ITickable{
protected int ticksElapsed;
public boolean isRedstonePowered; public boolean isRedstonePowered;
protected int ticksElapsed;
public static void init(){ public static void init(){
ModUtil.LOGGER.info("Registering TileEntities..."); ModUtil.LOGGER.info("Registering TileEntities...");
@ -91,15 +91,6 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{
this.writeSyncableNBT(compound, false); this.writeSyncableNBT(compound, false);
} }
@Override
public final void update(){
this.updateEntity();
}
public void updateEntity(){
this.ticksElapsed++;
}
@Override @Override
public final Packet getDescriptionPacket(){ public final Packet getDescriptionPacket(){
NBTTagCompound compound = this.getSyncCompound(); NBTTagCompound compound = this.getSyncCompound();
@ -123,6 +114,16 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{
return !(oldState.getBlock().isAssociatedBlock(newState.getBlock())); return !(oldState.getBlock().isAssociatedBlock(newState.getBlock()));
} }
public void receiveSyncCompound(NBTTagCompound compound){
this.readSyncableNBT(compound, true);
}
public NBTTagCompound getSyncCompound(){
NBTTagCompound tag = new NBTTagCompound();
this.writeSyncableNBT(tag, true);
return tag;
}
public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){ public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){
if(this instanceof IRedstoneToggle){ if(this instanceof IRedstoneToggle){
compound.setBoolean("IsPulseMode", ((IRedstoneToggle)this).isPulseMode()); compound.setBoolean("IsPulseMode", ((IRedstoneToggle)this).isPulseMode());
@ -135,6 +136,15 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{
} }
} }
@Override
public final void update(){
this.updateEntity();
}
public void updateEntity(){
this.ticksElapsed++;
}
public final void setRedstonePowered(boolean powered){ public final void setRedstonePowered(boolean powered){
this.isRedstonePowered = powered; this.isRedstonePowered = powered;
this.markDirty(); this.markDirty();
@ -153,14 +163,4 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{
public final void sendUpdate(){ public final void sendUpdate(){
PacketHandler.theNetwork.sendToAllAround(new PacketUpdateTileEntity(this), new NetworkRegistry.TargetPoint(this.worldObj.provider.getDimensionId(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), 64)); PacketHandler.theNetwork.sendToAllAround(new PacketUpdateTileEntity(this), new NetworkRegistry.TargetPoint(this.worldObj.provider.getDimensionId(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), 64));
} }
public NBTTagCompound getSyncCompound(){
NBTTagCompound tag = new NBTTagCompound();
this.writeSyncableNBT(tag, true);
return tag;
}
public void receiveSyncCompound(NBTTagCompound compound){
this.readSyncableNBT(compound, true);
}
} }

View file

@ -69,6 +69,11 @@ public class TileEntityBreaker extends TileEntityInventoryBase implements IRedst
this.currentTime = compound.getInteger("CurrentTime"); this.currentTime = compound.getInteger("CurrentTime");
} }
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return this.isPlacer;
}
private void doWork(){ private void doWork(){
EnumFacing sideToManipulate = WorldUtil.getDirectionByPistonRotation(PosUtil.getMetadata(this.pos, worldObj)); EnumFacing sideToManipulate = WorldUtil.getDirectionByPistonRotation(PosUtil.getMetadata(this.pos, worldObj));
@ -104,11 +109,6 @@ public class TileEntityBreaker extends TileEntityInventoryBase implements IRedst
return this.isItemValidForSlot(slot, stack); return this.isItemValidForSlot(slot, stack);
} }
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return this.isPlacer;
}
@Override @Override
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){ public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
return true; return true;

View file

@ -117,6 +117,11 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IE
super.readSyncableNBT(compound, sync); super.readSyncableNBT(compound, sync);
} }
@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 isCanola(int slot){ public boolean isCanola(int slot){
return this.slots[slot] != null && this.slots[slot].getItem() == InitItems.itemMisc && this.slots[slot].getItemDamage() == TheMiscItems.CANOLA.ordinal(); return this.slots[slot] != null && this.slots[slot].getItem() == InitItems.itemMisc && this.slots[slot].getItemDamage() == TheMiscItems.CANOLA.ordinal();
} }
@ -126,11 +131,6 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IE
return this.isItemValidForSlot(slot, stack); return this.isItemValidForSlot(slot, stack);
} }
@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);
}
@Override @Override
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){ public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
return slot == 2 && FluidContainerRegistry.containsFluid(this.slots[0], new FluidStack(InitFluids.fluidCanolaOil, FluidContainerRegistry.BUCKET_VOLUME)); return slot == 2 && FluidContainerRegistry.containsFluid(this.slots[0], new FluidStack(InitFluids.fluidCanolaOil, FluidContainerRegistry.BUCKET_VOLUME));

View file

@ -110,13 +110,13 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements
} }
@Override @Override
public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){ public boolean isItemValidForSlot(int i, ItemStack stack){
return this.isItemValidForSlot(slot, stack); return TileEntityFurnace.getItemBurnTime(stack) > 0;
} }
@Override @Override
public boolean isItemValidForSlot(int i, ItemStack stack){ public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){
return TileEntityFurnace.getItemBurnTime(stack) > 0; return this.isItemValidForSlot(slot, stack);
} }
@Override @Override

View file

@ -110,6 +110,11 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
this.brewTime = compound.getInteger("Time"); this.brewTime = compound.getInteger("Time");
} }
@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 void storeCoffee(){ public void storeCoffee(){
if(this.slots[SLOT_COFFEE_BEANS] != null && this.slots[SLOT_COFFEE_BEANS].getItem() == InitItems.itemCoffeeBean){ if(this.slots[SLOT_COFFEE_BEANS] != null && this.slots[SLOT_COFFEE_BEANS].getItem() == InitItems.itemCoffeeBean){
int toAdd = 2; int toAdd = 2;
@ -172,11 +177,6 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
return this.isItemValidForSlot(slot, stack); return this.isItemValidForSlot(slot, stack);
} }
@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)));
}
@Override @Override
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){ public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
return slot == SLOT_OUTPUT || (slot >= 3 && slot < this.slots.length-2 && ItemCoffee.getIngredientFromStack(stack) == null) || slot == SLOT_WATER_OUTPUT; return slot == SLOT_OUTPUT || (slot >= 3 && slot < this.slots.length-2 && ItemCoffee.getIngredientFromStack(stack) == null) || slot == SLOT_WATER_OUTPUT;

View file

@ -45,17 +45,17 @@ public class TileEntityCompost extends TileEntityInventoryBase{
} }
} }
@Override
public boolean shouldSyncSlots(){
return true;
}
@Override @Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync); super.writeSyncableNBT(compound, sync);
compound.setInteger("ConversionTime", this.conversionTime); compound.setInteger("ConversionTime", this.conversionTime);
} }
@Override
public boolean shouldSyncSlots(){
return true;
}
@Override @Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){ public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync); super.readSyncableNBT(compound, sync);
@ -67,24 +67,24 @@ public class TileEntityCompost extends TileEntityInventoryBase{
return AMOUNT; return AMOUNT;
} }
@Override
public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){
return this.isItemValidForSlot(slot, stack);
}
@Override @Override
public boolean isItemValidForSlot(int i, ItemStack stack){ public boolean isItemValidForSlot(int i, ItemStack stack){
return stack.getItem() instanceof ItemMisc && stack.getItemDamage() == TheMiscItems.MASHED_FOOD.ordinal(); return stack.getItem() instanceof ItemMisc && stack.getItemDamage() == TheMiscItems.MASHED_FOOD.ordinal();
} }
@Override
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
return stack.getItem() instanceof ItemFertilizer;
}
@Override @Override
public void markDirty(){ public void markDirty(){
super.markDirty(); super.markDirty();
this.sendUpdate(); this.sendUpdate();
} }
@Override
public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){
return this.isItemValidForSlot(slot, stack);
}
@Override
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
return stack.getItem() instanceof ItemFertilizer;
}
} }

View file

@ -39,6 +39,20 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implem
super(9, "directionalBreaker"); super(9, "directionalBreaker");
} }
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
this.storage.writeToNBT(compound);
compound.setInteger("CurrentTime", this.currentTime);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.storage.readFromNBT(compound);
this.currentTime = compound.getInteger("CurrentTime");
}
@Override @Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void updateEntity(){ public void updateEntity(){
@ -90,17 +104,8 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implem
} }
@Override @Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ public boolean isItemValidForSlot(int i, ItemStack stack){
super.writeSyncableNBT(compound, sync); return false;
this.storage.writeToNBT(compound);
compound.setInteger("CurrentTime", this.currentTime);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.storage.readFromNBT(compound);
this.currentTime = compound.getInteger("CurrentTime");
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@ -113,11 +118,6 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implem
return this.isItemValidForSlot(slot, stack); return this.isItemValidForSlot(slot, stack);
} }
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return false;
}
@Override @Override
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){ public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
return true; return true;

View file

@ -56,6 +56,11 @@ public class TileEntityDropper extends TileEntityInventoryBase implements IRedst
this.currentTime = compound.getInteger("CurrentTime"); this.currentTime = compound.getInteger("CurrentTime");
} }
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return true;
}
private void doWork(){ private void doWork(){
if(this.removeFromInventory(false) != null){ if(this.removeFromInventory(false) != null){
ItemStack stack = this.removeFromInventory(true); ItemStack stack = this.removeFromInventory(true);
@ -85,11 +90,6 @@ public class TileEntityDropper extends TileEntityInventoryBase implements IRedst
return this.isItemValidForSlot(slot, stack); return this.isItemValidForSlot(slot, stack);
} }
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return true;
}
@Override @Override
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){ public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
return true; return true;

View file

@ -66,13 +66,13 @@ public class TileEntityEnergizer extends TileEntityInventoryBase implements IEne
} }
@Override @Override
public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){ public boolean isItemValidForSlot(int i, ItemStack stack){
return this.isItemValidForSlot(slot, stack); return i == 0 && stack.getItem() instanceof IEnergyContainerItem;
} }
@Override @Override
public boolean isItemValidForSlot(int i, ItemStack stack){ public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){
return i == 0 && stack.getItem() instanceof IEnergyContainerItem; return this.isItemValidForSlot(slot, stack);
} }
@Override @Override

View file

@ -70,6 +70,11 @@ public class TileEntityEnervator extends TileEntityInventoryBase implements IEne
super.readSyncableNBT(compound, sync); super.readSyncableNBT(compound, sync);
} }
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return i == 0 && stack.getItem() instanceof IEnergyContainerItem;
}
@Override @Override
public int extractEnergy(EnumFacing from, int maxExtract, boolean simulate){ public int extractEnergy(EnumFacing from, int maxExtract, boolean simulate){
return this.storage.extractEnergy(maxExtract, simulate); return this.storage.extractEnergy(maxExtract, simulate);
@ -100,11 +105,6 @@ public class TileEntityEnervator extends TileEntityInventoryBase implements IEne
return this.isItemValidForSlot(slot, stack); return this.isItemValidForSlot(slot, stack);
} }
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return i == 0 && stack.getItem() instanceof IEnergyContainerItem;
}
@Override @Override
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){ public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
return slot == 1; return slot == 1;

View file

@ -109,6 +109,11 @@ public class TileEntityFeeder extends TileEntityInventoryBase{
} }
} }
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return true;
}
public void feedAnimal(EntityAnimal animal){ public void feedAnimal(EntityAnimal animal){
animal.setInLove(null); animal.setInLove(null);
for(int i = 0; i < 7; i++){ for(int i = 0; i < 7; i++){
@ -124,11 +129,6 @@ public class TileEntityFeeder extends TileEntityInventoryBase{
return this.isItemValidForSlot(slot, stack); return this.isItemValidForSlot(slot, stack);
} }
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return true;
}
@Override @Override
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){ public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
return false; return false;

View file

@ -34,6 +34,24 @@ public class TileEntityFermentingBarrel extends TileEntityInventoryBase implemen
super(4, "fermentingBarrel"); super(4, "fermentingBarrel");
} }
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
compound.setInteger("ProcessTime", this.currentProcessTime);
this.canolaTank.writeToNBT(compound);
NBTTagCompound tag = new NBTTagCompound();
this.oilTank.writeToNBT(tag);
compound.setTag("OilTank", tag);
super.writeSyncableNBT(compound, sync);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
this.currentProcessTime = compound.getInteger("ProcessTime");
this.canolaTank.readFromNBT(compound);
this.oilTank.readFromNBT((NBTTagCompound)compound.getTag("OilTank"));
super.readSyncableNBT(compound, sync);
}
@Override @Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void updateEntity(){ public void updateEntity(){
@ -76,21 +94,8 @@ public class TileEntityFermentingBarrel extends TileEntityInventoryBase implemen
} }
@Override @Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ public boolean isItemValidForSlot(int i, ItemStack stack){
compound.setInteger("ProcessTime", this.currentProcessTime); return (i == 0 && FluidContainerRegistry.containsFluid(stack, new FluidStack(InitFluids.fluidCanolaOil, FluidContainerRegistry.BUCKET_VOLUME))) || (i == 2 && stack.getItem() == Items.bucket);
this.canolaTank.writeToNBT(compound);
NBTTagCompound tag = new NBTTagCompound();
this.oilTank.writeToNBT(tag);
compound.setTag("OilTank", tag);
super.writeSyncableNBT(compound, sync);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
this.currentProcessTime = compound.getInteger("ProcessTime");
this.canolaTank.readFromNBT(compound);
this.oilTank.readFromNBT((NBTTagCompound)compound.getTag("OilTank"));
super.readSyncableNBT(compound, sync);
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@ -113,11 +118,6 @@ public class TileEntityFermentingBarrel extends TileEntityInventoryBase implemen
return this.isItemValidForSlot(slot, stack); return this.isItemValidForSlot(slot, stack);
} }
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return (i == 0 && FluidContainerRegistry.containsFluid(stack, new FluidStack(InitFluids.fluidCanolaOil, FluidContainerRegistry.BUCKET_VOLUME))) || (i == 2 && stack.getItem() == Items.bucket);
}
@Override @Override
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){ public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
return (slot == 1 && stack.getItem() == Items.bucket) || (slot == 3 && FluidContainerRegistry.containsFluid(stack, new FluidStack(InitFluids.fluidOil, FluidContainerRegistry.BUCKET_VOLUME))); return (slot == 1 && stack.getItem() == Items.bucket) || (slot == 3 && FluidContainerRegistry.containsFluid(stack, new FluidStack(InitFluids.fluidOil, FluidContainerRegistry.BUCKET_VOLUME)));

View file

@ -32,6 +32,18 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyRece
private boolean activateOnceWithSignal; private boolean activateOnceWithSignal;
private int oldEnergy; private int oldEnergy;
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
this.storage.writeToNBT(compound);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.storage.readFromNBT(compound);
}
@Override @Override
public void updateEntity(){ public void updateEntity(){
if(!this.worldObj.isRemote){ if(!this.worldObj.isRemote){
@ -113,18 +125,6 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyRece
return compound; return compound;
} }
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
this.storage.writeToNBT(compound);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.storage.readFromNBT(compound);
}
@Override @Override
public int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate){ public int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate){
return this.storage.receiveEnergy(maxReceive, simulate); return this.storage.receiveEnergy(maxReceive, simulate);

View file

@ -29,6 +29,18 @@ public class TileEntityFishingNet extends TileEntityBase{
public int timeUntilNextDrop; public int timeUntilNextDrop;
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
compound.setInteger("TimeUntilNextDrop", this.timeUntilNextDrop);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.timeUntilNextDrop = compound.getInteger("TimeUntilNextDrop");
}
@Override @Override
public void updateEntity(){ public void updateEntity(){
super.updateEntity(); super.updateEntity();
@ -60,16 +72,4 @@ public class TileEntityFishingNet extends TileEntityBase{
} }
} }
} }
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
compound.setInteger("TimeUntilNextDrop", this.timeUntilNextDrop);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.timeUntilNextDrop = compound.getInteger("TimeUntilNextDrop");
}
} }

View file

@ -131,6 +131,20 @@ public class TileEntityFluidCollector extends TileEntityInventoryBase implements
return new FluidTankInfo[]{this.tank.getInfo()}; return new FluidTankInfo[]{this.tank.getInfo()};
} }
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
compound.setInteger("CurrentTime", this.currentTime);
this.tank.writeToNBT(compound);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.currentTime = compound.getInteger("CurrentTime");
this.tank.readFromNBT(compound);
}
@Override @Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void updateEntity(){ public void updateEntity(){
@ -171,30 +185,6 @@ public class TileEntityFluidCollector extends TileEntityInventoryBase implements
} }
} }
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
compound.setInteger("CurrentTime", this.currentTime);
this.tank.writeToNBT(compound);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.currentTime = compound.getInteger("CurrentTime");
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, EnumFacing side){
return this.isItemValidForSlot(slot, stack);
}
@Override @Override
public boolean isItemValidForSlot(int i, ItemStack stack){ public boolean isItemValidForSlot(int i, ItemStack stack){
if(i == 0){ if(i == 0){
@ -208,6 +198,16 @@ public class TileEntityFluidCollector extends TileEntityInventoryBase implements
return false; 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, EnumFacing side){
return this.isItemValidForSlot(slot, stack);
}
@Override @Override
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){ public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
return slot == 1; return slot == 1;

View file

@ -116,6 +116,11 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements
this.storage.readFromNBT(compound); this.storage.readFromNBT(compound);
} }
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && FurnaceRecipes.instance().getSmeltingResult(stack) != null;
}
public boolean canSmeltOn(int theInput, int theOutput){ public boolean canSmeltOn(int theInput, int theOutput){
if(this.slots[theInput] != null){ if(this.slots[theInput] != null){
ItemStack output = FurnaceRecipes.instance().getSmeltingResult(this.slots[theInput]); ItemStack output = FurnaceRecipes.instance().getSmeltingResult(this.slots[theInput]);
@ -165,11 +170,6 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements
return this.isItemValidForSlot(slot, stack); return this.isItemValidForSlot(slot, stack);
} }
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && FurnaceRecipes.instance().getSmeltingResult(stack) != null;
}
@Override @Override
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){ public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
return slot == SLOT_OUTPUT_1 || slot == SLOT_OUTPUT_2; return slot == SLOT_OUTPUT_1 || slot == SLOT_OUTPUT_2;

View file

@ -46,6 +46,18 @@ public class TileEntityFurnaceSolar extends TileEntityBase implements IEnergyPro
return from != EnumFacing.UP; return from != EnumFacing.UP;
} }
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
this.storage.writeToNBT(compound);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.storage.readFromNBT(compound);
}
@Override @Override
public void updateEntity(){ public void updateEntity(){
super.updateEntity(); super.updateEntity();
@ -67,18 +79,6 @@ public class TileEntityFurnaceSolar extends TileEntityBase implements IEnergyPro
} }
} }
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
this.storage.writeToNBT(compound);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.storage.readFromNBT(compound);
}
public boolean hasBlockAbove(){ public boolean hasBlockAbove(){
for(int y = 1; y <= worldObj.getHeight(); y++){ for(int y = 1; y <= worldObj.getHeight(); y++){
BlockPos offset = PosUtil.offset(this.pos, 0, y, 0); BlockPos offset = PosUtil.offset(this.pos, 0, y, 0);

View file

@ -24,6 +24,18 @@ public class TileEntityGreenhouseGlass extends TileEntityBase{
private int timeUntilNextFert; private int timeUntilNextFert;
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){
super.writeSyncableNBT(compound, isForSync);
this.timeUntilNextFert = compound.getInteger("Time");
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){
super.readSyncableNBT(compound, isForSync);
compound.setInteger("Time", this.timeUntilNextFert);
}
@Override @Override
public void updateEntity(){ public void updateEntity(){
super.updateEntity(); super.updateEntity();
@ -66,16 +78,4 @@ public class TileEntityGreenhouseGlass extends TileEntityBase{
} }
return null; return null;
} }
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){
super.writeSyncableNBT(compound, isForSync);
this.timeUntilNextFert = compound.getInteger("Time");
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){
super.readSyncableNBT(compound, isForSync);
compound.setInteger("Time", this.timeUntilNextFert);
}
} }

View file

@ -165,6 +165,11 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
super.readSyncableNBT(compound, sync); super.readSyncableNBT(compound, sync);
} }
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && CrusherRecipeRegistry.getRecipeFromInput(stack) != null;
}
public boolean canCrushOn(int theInput, int theFirstOutput, int theSecondOutput){ public boolean canCrushOn(int theInput, int theFirstOutput, int theSecondOutput){
if(this.slots[theInput] != null){ if(this.slots[theInput] != null){
List<ItemStack> outputOnes = CrusherRecipeRegistry.getOutputOnes(this.slots[theInput]); List<ItemStack> outputOnes = CrusherRecipeRegistry.getOutputOnes(this.slots[theInput]);
@ -258,11 +263,6 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
return this.isItemValidForSlot(slot, stack); 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 @Override
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){ public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
return slot == SLOT_OUTPUT_1_1 || slot == SLOT_OUTPUT_1_2 || slot == SLOT_OUTPUT_2_1 || slot == SLOT_OUTPUT_2_2; return slot == SLOT_OUTPUT_1_1 || slot == SLOT_OUTPUT_1_2 || slot == SLOT_OUTPUT_2_1 || slot == SLOT_OUTPUT_2_2;

View file

@ -32,6 +32,18 @@ public class TileEntityHeatCollector extends TileEntityBase implements IEnergyPr
public EnergyStorage storage = new EnergyStorage(30000); public EnergyStorage storage = new EnergyStorage(30000);
private int oldEnergy; private int oldEnergy;
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){
super.writeSyncableNBT(compound, isForSync);
this.storage.writeToNBT(compound);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){
super.readSyncableNBT(compound, isForSync);
this.storage.readFromNBT(compound);
}
@Override @Override
public void updateEntity(){ public void updateEntity(){
super.updateEntity(); super.updateEntity();
@ -69,18 +81,6 @@ public class TileEntityHeatCollector extends TileEntityBase implements IEnergyPr
} }
} }
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){
super.writeSyncableNBT(compound, isForSync);
this.storage.writeToNBT(compound);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){
super.readSyncableNBT(compound, isForSync);
this.storage.readFromNBT(compound);
}
@Override @Override
public int extractEnergy(EnumFacing from, int maxExtract, boolean simulate){ public int extractEnergy(EnumFacing from, int maxExtract, boolean simulate){
return this.storage.extractEnergy(maxExtract, simulate); return this.storage.extractEnergy(maxExtract, simulate);

View file

@ -447,13 +447,13 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt
} }
@Override @Override
public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){ public boolean isItemValidForSlot(int i, ItemStack stack){
return this.isItemValidForSlot(slot, stack); return i == 0;
} }
@Override @Override
public boolean isItemValidForSlot(int i, ItemStack stack){ public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){
return i == 0; return this.isItemValidForSlot(slot, stack);
} }
@Override @Override

View file

@ -48,11 +48,6 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
this.slots = new ItemStack[itemAmount]; this.slots = new ItemStack[itemAmount];
} }
@Override
public void updateEntity(){
super.updateEntity();
}
@Override @Override
public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){ public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){
super.writeSyncableNBT(compound, isForSync); super.writeSyncableNBT(compound, isForSync);
@ -94,17 +89,44 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
} }
@Override @Override
public void updateEntity(){
super.updateEntity();
}
@Override
public int[] getSlotsForFace(EnumFacing side){
if(this.slots.length > 0){
int[] theInt = new int[slots.length];
for(int i = 0; i < theInt.length; i++){
theInt[i] = i;
}
return theInt;
}
else{
return new int[0];
}
} @Override
public int getInventoryStackLimit(){ public int getInventoryStackLimit(){
return 64; return 64;
} }
@Override @Override
public boolean hasCapability(net.minecraftforge.common.capabilities.Capability<?> capability, net.minecraft.util.EnumFacing facing){
return this.getCapability(capability, facing) != null;
} @Override
public boolean isUseableByPlayer(EntityPlayer player){ public boolean isUseableByPlayer(EntityPlayer player){
return player.getDistanceSq(this.getPos().getX()+0.5D, this.pos.getY()+0.5D, this.pos.getZ()+0.5D) <= 64 && !this.isInvalid() && this.worldObj.getTileEntity(this.pos) == this; return player.getDistanceSq(this.getPos().getX()+0.5D, this.pos.getY()+0.5D, this.pos.getZ()+0.5D) <= 64 && !this.isInvalid() && this.worldObj.getTileEntity(this.pos) == this;
} }
@Override @Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing){
if(facing != null && capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY){
return (T)this.itemHandlers.get(facing);
}
else{
return super.getCapability(capability, facing);
}
} @Override
public void openInventory(EntityPlayer player){ public void openInventory(EntityPlayer player){
} }
@ -187,19 +209,7 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
return stack; return stack;
} }
@Override
public int[] getSlotsForFace(EnumFacing side){
if(this.slots.length > 0){
int[] theInt = new int[slots.length];
for(int i = 0; i < theInt.length; i++){
theInt[i] = i;
}
return theInt;
}
else{
return new int[0];
}
}
@Override @Override
public String getName(){ public String getName(){
@ -216,19 +226,8 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
return new ChatComponentText(StringUtil.localize(this.getName())); return new ChatComponentText(StringUtil.localize(this.getName()));
} }
@Override
public boolean hasCapability(net.minecraftforge.common.capabilities.Capability<?> capability, net.minecraft.util.EnumFacing facing){
return this.getCapability(capability, facing) != null;
}
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing){
if(facing != null && capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY){
return (T)this.itemHandlers.get(facing);
}
else{
return super.getCapability(capability, facing);
}
}
} }

View file

@ -77,6 +77,11 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase implements I
this.storage.readFromNBT(compound); this.storage.readFromNBT(compound);
} }
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return i == SLOT_INPUT;
}
public static boolean canBeRepaired(ItemStack stack){ public static boolean canBeRepaired(ItemStack stack){
return stack != null && stack.getItem().isRepairable(); return stack != null && stack.getItem().isRepairable();
} }
@ -99,11 +104,6 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase implements I
return this.isItemValidForSlot(slot, stack); return this.isItemValidForSlot(slot, stack);
} }
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return i == SLOT_INPUT;
}
@Override @Override
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){ public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
return slot == SLOT_OUTPUT; return slot == SLOT_OUTPUT;

View file

@ -32,25 +32,19 @@ public class TileEntityLaserRelay extends TileEntityBase implements IEnergyRecei
private static final float[] COLOR = new float[]{1F, 0F, 0F}; private static final float[] COLOR = new float[]{1F, 0F, 0F};
@Override @Override
public void updateEntity(){ public void receiveSyncCompound(NBTTagCompound compound){
super.updateEntity();
if(this.worldObj.isRemote){
this.renderParticles();
}
}
@SideOnly(Side.CLIENT)
public void renderParticles(){
if(Util.RANDOM.nextInt(ConfigValues.lessParticles ? 15 : 8) == 0){
BlockPos thisPos = this.pos; BlockPos thisPos = this.pos;
LaserRelayConnectionHandler.Network network = LaserRelayConnectionHandler.getInstance().getNetworkFor(thisPos); if(compound != null){
if(network != null){ LaserRelayConnectionHandler.getInstance().removeRelayFromNetwork(thisPos);
for(LaserRelayConnectionHandler.ConnectionPair aPair : network.connections){
if(aPair.contains(thisPos) && PosUtil.areSamePos(thisPos, aPair.firstRelay)){ NBTTagList list = compound.getTagList("Connections", 10);
PacketParticle.renderParticlesFromAToB(aPair.firstRelay.getX(), aPair.firstRelay.getY(), aPair.firstRelay.getZ(), aPair.secondRelay.getX(), aPair.secondRelay.getY(), aPair.secondRelay.getZ(), ConfigValues.lessParticles ? 1 : Util.RANDOM.nextInt(3)+1, 0.8F, COLOR, 1F); for(int i = 0; i < list.tagCount(); i++){
} LaserRelayConnectionHandler.ConnectionPair pair = LaserRelayConnectionHandler.ConnectionPair.readFromNBT(list.getCompoundTagAt(i));
LaserRelayConnectionHandler.getInstance().addConnection(pair.firstRelay, pair.secondRelay);
} }
} }
else{
LaserRelayConnectionHandler.getInstance().removeRelayFromNetwork(thisPos);
} }
} }
@ -73,19 +67,25 @@ public class TileEntityLaserRelay extends TileEntityBase implements IEnergyRecei
} }
@Override @Override
public void receiveSyncCompound(NBTTagCompound compound){ public void updateEntity(){
BlockPos thisPos = this.pos; super.updateEntity();
if(compound != null){ if(this.worldObj.isRemote){
LaserRelayConnectionHandler.getInstance().removeRelayFromNetwork(thisPos); this.renderParticles();
}
}
NBTTagList list = compound.getTagList("Connections", 10); @SideOnly(Side.CLIENT)
for(int i = 0; i < list.tagCount(); i++){ public void renderParticles(){
LaserRelayConnectionHandler.ConnectionPair pair = LaserRelayConnectionHandler.ConnectionPair.readFromNBT(list.getCompoundTagAt(i)); if(Util.RANDOM.nextInt(ConfigValues.lessParticles ? 15 : 8) == 0){
LaserRelayConnectionHandler.getInstance().addConnection(pair.firstRelay, pair.secondRelay); BlockPos thisPos = this.pos;
LaserRelayConnectionHandler.Network network = LaserRelayConnectionHandler.getInstance().getNetworkFor(thisPos);
if(network != null){
for(LaserRelayConnectionHandler.ConnectionPair aPair : network.connections){
if(aPair.contains(thisPos) && PosUtil.areSamePos(thisPos, aPair.firstRelay)){
PacketParticle.renderParticlesFromAToB(aPair.firstRelay.getX(), aPair.firstRelay.getY(), aPair.firstRelay.getZ(), aPair.secondRelay.getX(), aPair.secondRelay.getY(), aPair.secondRelay.getZ(), ConfigValues.lessParticles ? 1 : Util.RANDOM.nextInt(3)+1, 0.8F, COLOR, 1F);
}
} }
} }
else{
LaserRelayConnectionHandler.getInstance().removeRelayFromNetwork(thisPos);
} }
} }

View file

@ -33,6 +33,20 @@ public class TileEntityLavaFactoryController extends TileEntityBase implements I
private int currentWorkTime; private int currentWorkTime;
private int oldEnergy; private int oldEnergy;
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
this.storage.writeToNBT(compound);
compound.setInteger("WorkTime", this.currentWorkTime);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.storage.readFromNBT(compound);
this.currentWorkTime = compound.getInteger("WorkTime");
}
@Override @Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void updateEntity(){ public void updateEntity(){
@ -56,20 +70,6 @@ public class TileEntityLavaFactoryController extends TileEntityBase implements I
} }
} }
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
this.storage.writeToNBT(compound);
compound.setInteger("WorkTime", this.currentWorkTime);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.storage.readFromNBT(compound);
this.currentWorkTime = compound.getInteger("WorkTime");
}
public int isMultiblock(){ public int isMultiblock(){
BlockPos thisPos = this.pos; BlockPos thisPos = this.pos;
BlockPos[] positions = new BlockPos[]{ BlockPos[] positions = new BlockPos[]{

View file

@ -36,6 +36,18 @@ public class TileEntityLeafGenerator extends TileEntityBase implements IEnergyPr
private int nextUseCounter; private int nextUseCounter;
private int oldEnergy; private int oldEnergy;
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
this.storage.writeToNBT(compound);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.storage.readFromNBT(compound);
}
@Override @Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void updateEntity(){ public void updateEntity(){
@ -94,18 +106,6 @@ public class TileEntityLeafGenerator extends TileEntityBase implements IEnergyPr
} }
} }
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
this.storage.writeToNBT(compound);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.storage.readFromNBT(compound);
}
@Override @Override
public int extractEnergy(EnumFacing from, int maxReceive, boolean simulate){ public int extractEnergy(EnumFacing from, int maxReceive, boolean simulate){
return this.storage.extractEnergy(maxReceive, simulate); return this.storage.extractEnergy(maxReceive, simulate);

View file

@ -136,6 +136,12 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IEnergyR
return false; return false;
} }
private void shootParticles(int endX, int endY, int endZ){
if(!ConfigValues.lessParticles){
PacketHandler.theNetwork.sendToAllAround(new PacketParticle(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), endX, endY, endZ, new float[]{62F/255F, 163F/255F, 74F/255F}, 5, 1.0F), new NetworkRegistry.TargetPoint(worldObj.provider.getDimensionId(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), 96));
}
}
private boolean isBlacklisted(Block block){ private boolean isBlacklisted(Block block){
String reg = block.getRegistryName(); String reg = block.getRegistryName();
if(reg != null && !reg.isEmpty()){ if(reg != null && !reg.isEmpty()){
@ -148,12 +154,6 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IEnergyR
return false; return false;
} }
private void shootParticles(int endX, int endY, int endZ){
if(!ConfigValues.lessParticles){
PacketHandler.theNetwork.sendToAllAround(new PacketParticle(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), endX, endY, endZ, new float[]{62F/255F, 163F/255F, 74F/255F}, 5, 1.0F), new NetworkRegistry.TargetPoint(worldObj.provider.getDimensionId(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), 96));
}
}
@Override @Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync); super.writeSyncableNBT(compound, sync);
@ -170,6 +170,11 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IEnergyR
this.onlyMineOres = compound.getBoolean("OnlyOres"); this.onlyMineOres = compound.getBoolean("OnlyOres");
} }
@Override
public boolean isItemValidForSlot(int slot, ItemStack stack){
return false;
}
@Override @Override
public int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate){ public int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate){
return this.storage.receiveEnergy(maxReceive, simulate); return this.storage.receiveEnergy(maxReceive, simulate);
@ -200,11 +205,6 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IEnergyR
return true; return true;
} }
@Override
public boolean isItemValidForSlot(int slot, ItemStack stack){
return false;
}
@Override @Override
public void onButtonPressed(int buttonID, EntityPlayer player){ public void onButtonPressed(int buttonID, EntityPlayer player){
if(buttonID == 0){ if(buttonID == 0){

View file

@ -116,13 +116,13 @@ public class TileEntityOilGenerator extends TileEntityInventoryBase implements I
} }
@Override @Override
public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){ public boolean isItemValidForSlot(int i, ItemStack stack){
return this.isItemValidForSlot(slot, stack); return FluidContainerRegistry.containsFluid(stack, new FluidStack(InitFluids.fluidOil, FluidContainerRegistry.BUCKET_VOLUME)) && i == 0;
} }
@Override @Override
public boolean isItemValidForSlot(int i, ItemStack stack){ public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){
return FluidContainerRegistry.containsFluid(stack, new FluidStack(InitFluids.fluidOil, FluidContainerRegistry.BUCKET_VOLUME)) && i == 0; return this.isItemValidForSlot(slot, stack);
} }
@Override @Override

View file

@ -47,6 +47,13 @@ public class TileEntityPhantomItemface extends TileEntityPhantomface{
return this.isBoundThingInRange() ? this.getInventory().getInventoryStackLimit() : 0; return this.isBoundThingInRange() ? this.getInventory().getInventoryStackLimit() : 0;
} }
@Override
public void clear(){
if(this.isBoundThingInRange()){
this.getInventory().clear();
}
}
@Override @Override
public void setInventorySlotContents(int i, ItemStack stack){ public void setInventorySlotContents(int i, ItemStack stack){
if(this.isBoundThingInRange()){ if(this.isBoundThingInRange()){
@ -71,13 +78,16 @@ public class TileEntityPhantomItemface extends TileEntityPhantomface{
} }
@Override @Override
public String getName(){ public ItemStack removeStackFromSlot(int index){
return this.name; if(this.isBoundThingInRange()){
return this.getInventory().removeStackFromSlot(index);
}
return null;
} }
@Override @Override
public boolean isBoundThingInRange(){ public String getName(){
return super.isBoundThingInRange() && worldObj.getTileEntity(boundPosition) instanceof IInventory; return this.name;
} }
public ISidedInventory getSided(){ public ISidedInventory getSided(){
@ -94,36 +104,11 @@ public class TileEntityPhantomItemface extends TileEntityPhantomface{
return null; return null;
} }
@Override
public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){
return this.isBoundThingInRange() && (this.getSided() == null || this.getSided().canInsertItem(slot, stack, side));
}
@Override
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
return this.isBoundThingInRange() && (this.getSided() == null || this.getSided().canExtractItem(slot, stack, side));
}
@Override @Override
public boolean isItemValidForSlot(int i, ItemStack stack){ public boolean isItemValidForSlot(int i, ItemStack stack){
return this.isBoundThingInRange() && this.getInventory().isItemValidForSlot(i, stack); return this.isBoundThingInRange() && this.getInventory().isItemValidForSlot(i, stack);
} }
@Override
public ItemStack removeStackFromSlot(int index){
if(this.isBoundThingInRange()){
return this.getInventory().removeStackFromSlot(index);
}
return null;
}
@Override
public void clear(){
if(this.isBoundThingInRange()){
this.getInventory().clear();
}
}
@Override @Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing){ public <T> T getCapability(Capability<T> capability, EnumFacing facing){
if(this.isBoundThingInRange()){ if(this.isBoundThingInRange()){
@ -134,4 +119,19 @@ public class TileEntityPhantomItemface extends TileEntityPhantomface{
} }
return super.getCapability(capability, facing); return super.getCapability(capability, facing);
} }
@Override
public boolean isBoundThingInRange(){
return super.isBoundThingInRange() && worldObj.getTileEntity(boundPosition) instanceof IInventory;
}
@Override
public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){
return this.isBoundThingInRange() && (this.getSided() == null || this.getSided().canInsertItem(slot, stack, side));
}
@Override
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
return this.isBoundThingInRange() && (this.getSided() == null || this.getSided().canExtractItem(slot, stack, side));
}
} }

View file

@ -48,6 +48,30 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements
this.isBreaker = false; this.isBreaker = false;
} }
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
compound.setInteger("Range", this.range);
if(this.boundPosition != null){
compound.setInteger("XCoordOfTileStored", boundPosition.getX());
compound.setInteger("YCoordOfTileStored", boundPosition.getY());
compound.setInteger("ZCoordOfTileStored", boundPosition.getZ());
}
}
@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");
this.range = compound.getInteger("Range");
if(!(x == 0 && y == 0 && z == 0)){
this.boundPosition = new BlockPos(x, y, z);
this.markDirty();
}
}
@Override @Override
public void updateEntity(){ public void updateEntity(){
super.updateEntity(); super.updateEntity();
@ -168,27 +192,8 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements
} }
@Override @Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ public boolean isItemValidForSlot(int i, ItemStack stack){
super.writeSyncableNBT(compound, sync); return !this.isBreaker;
compound.setInteger("Range", this.range);
if(this.boundPosition != null){
compound.setInteger("XCoordOfTileStored", boundPosition.getX());
compound.setInteger("YCoordOfTileStored", boundPosition.getY());
compound.setInteger("ZCoordOfTileStored", boundPosition.getZ());
}
}
@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");
this.range = compound.getInteger("Range");
if(!(x == 0 && y == 0 && z == 0)){
this.boundPosition = new BlockPos(x, y, z);
this.markDirty();
}
} }
@Override @Override
@ -196,11 +201,6 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements
return this.isItemValidForSlot(slot, stack); return this.isItemValidForSlot(slot, stack);
} }
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return !this.isBreaker;
}
@Override @Override
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){ public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
return this.isBreaker; return this.isBreaker;

View file

@ -104,6 +104,16 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
} }
} }
@Override
public boolean isItemValidForSlot(int slot, ItemStack stack){
return false;
}
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing){
return this.capabilities.getCapability(capability, facing);
}
public static int upgradeRange(int defaultRange, World world, BlockPos pos){ public static int upgradeRange(int defaultRange, World world, BlockPos pos){
int newRange = defaultRange; int newRange = defaultRange;
for(int i = 0; i < 3; i++){ for(int i = 0; i < 3; i++){
@ -183,14 +193,4 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){ public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
return false; return false;
} }
@Override
public boolean isItemValidForSlot(int slot, ItemStack stack){
return false;
}
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing){
return this.capabilities.getCapability(capability, facing);
}
} }

View file

@ -32,6 +32,18 @@ public class TileEntityRangedCollector extends TileEntityInventoryBase implement
super(18, "rangedCollector"); super(18, "rangedCollector");
} }
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
compound.setBoolean("Whitelist", this.isWhitelist);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.isWhitelist = compound.getBoolean("Whitelist");
}
@Override @Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void updateEntity(){ public void updateEntity(){
@ -74,15 +86,8 @@ public class TileEntityRangedCollector extends TileEntityInventoryBase implement
} }
@Override @Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ public boolean isItemValidForSlot(int i, ItemStack stack){
super.writeSyncableNBT(compound, sync); return false;
compound.setBoolean("Whitelist", this.isWhitelist);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.isWhitelist = compound.getBoolean("Whitelist");
} }
@Override @Override
@ -90,11 +95,6 @@ public class TileEntityRangedCollector extends TileEntityInventoryBase implement
return this.isItemValidForSlot(slot, stack); return this.isItemValidForSlot(slot, stack);
} }
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return false;
}
@Override @Override
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){ public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
return slot < WHITELIST_START; return slot < WHITELIST_START;

View file

@ -27,17 +27,6 @@ public class TileEntitySmileyCloud extends TileEntityBase implements IStringReac
public int flyHeight; public int flyHeight;
private String nameBefore; private String nameBefore;
@Override
public void updateEntity(){
super.updateEntity();
if(!worldObj.isRemote){
if(!Objects.equals(this.name, this.nameBefore) && this.sendUpdateWithInterval()){
this.nameBefore = this.name;
this.markDirty();
}
}
}
@Override @Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync); super.writeSyncableNBT(compound, sync);
@ -52,6 +41,17 @@ public class TileEntitySmileyCloud extends TileEntityBase implements IStringReac
this.name = compound.getString("Name"); this.name = compound.getString("Name");
} }
@Override
public void updateEntity(){
super.updateEntity();
if(!worldObj.isRemote){
if(!Objects.equals(this.name, this.nameBefore) && this.sendUpdateWithInterval()){
this.nameBefore = this.name;
this.markDirty();
}
}
}
@Override @Override
public void onTextReceived(String text, int textID, EntityPlayer player){ public void onTextReceived(String text, int textID, EntityPlayer player){
this.name = text; this.name = text;

View file

@ -66,13 +66,13 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I
} }
@Override @Override
public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){ public boolean isItemValidForSlot(int i, ItemStack stack){
return this.isItemValidForSlot(slot, stack); return false;
} }
@Override @Override
public boolean isItemValidForSlot(int i, ItemStack stack){ public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){
return false; return this.isItemValidForSlot(slot, stack);
} }
@Override @Override
@ -96,6 +96,7 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I
} }
//TODO Fix XP System to fit points needed in 1.8 (OpenBlocks?) //TODO Fix XP System to fit points needed in 1.8 (OpenBlocks?)
/** /**
* Gets the Player's XP * Gets the Player's XP
* (Excerpted from OpenBlocks' XP system with permission, thanks guys!) * (Excerpted from OpenBlocks' XP system with permission, thanks guys!)

Some files were not shown because too many files have changed in this diff Show more