Formatting + set proper frame drop for advanced machines

This commit is contained in:
drcrazy 2018-04-28 13:16:50 +03:00
parent 649a6bf67f
commit 45669e8aa9
43 changed files with 149 additions and 98 deletions

View file

@ -39,7 +39,7 @@ public class BlockAlloySmelter extends BlockMachineBase {
public BlockAlloySmelter() {
super();
this.setCreativeTab(TechRebornCreativeTab.instance);
setCreativeTab(TechRebornCreativeTab.instance);
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, "machines/tier1_machines"));
}

View file

@ -39,7 +39,7 @@ public class BlockCompressor extends BlockMachineBase {
public BlockCompressor() {
super();
this.setCreativeTab(TechRebornCreativeTab.instance);
setCreativeTab(TechRebornCreativeTab.instance);
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, "machines/tier1_machines"));
}

View file

@ -39,7 +39,7 @@ public class BlockElectricFurnace extends BlockMachineBase {
public BlockElectricFurnace() {
super();
this.setCreativeTab(TechRebornCreativeTab.instance);
setCreativeTab(TechRebornCreativeTab.instance);
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, "machines/tier1_machines"));
}

View file

@ -39,7 +39,7 @@ public class BlockExtractor extends BlockMachineBase {
public BlockExtractor() {
super();
this.setCreativeTab(TechRebornCreativeTab.instance);
setCreativeTab(TechRebornCreativeTab.instance);
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, "machines/tier1_machines"));
}

View file

@ -39,7 +39,7 @@ public class BlockGrinder extends BlockMachineBase {
public BlockGrinder() {
super();
this.setCreativeTab(TechRebornCreativeTab.instance);
setCreativeTab(TechRebornCreativeTab.instance);
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, "machines/tier1_machines"));
}

View file

@ -74,64 +74,18 @@ public class BlockPlayerDetector extends BlockMachineBase {
public BlockPlayerDetector() {
super(true);
setCreativeTab(TechRebornCreativeTab.instance);
setHardness(2f);
this.setDefaultState(this.getDefaultState().withProperty(TYPE, "all"));
for (int i = 0; i < types.length; i++) {
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, i, "machines/tier1_machines").setInvVariant("type=" + types[i]));
}
}
@Override
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
return new ItemStack(ModBlocks.PLAYER_DETECTOR, 1, typeNamesList.indexOf(state.getValue(TYPE)));
}
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
return Item.getItemFromBlock(this);
}
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(CreativeTabs creativeTabs, NonNullList<ItemStack> list) {
for (int meta = 0; meta < types.length; meta++) {
list.add(new ItemStack(this, 1, meta));
}
}
// BlockMachineBase
@Override
public TileEntity createNewTileEntity(final World world, final int meta) {
return new TilePlayerDectector();
}
@Override
public boolean canConnectRedstone(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) {
return true;
}
@Override
public boolean canProvidePower(IBlockState state) {
return true;
}
@Override
public int getWeakPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
TileEntity entity = blockAccess.getTileEntity(pos);
if (entity instanceof TilePlayerDectector) {
return ((TilePlayerDectector) entity).isProvidingPower() ? 15 : 0;
}
return 0;
}
@Override
public int getStrongPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
TileEntity entity = blockAccess.getTileEntity(pos);
if (entity instanceof TilePlayerDectector) {
return ((TilePlayerDectector) entity).isProvidingPower() ? 15 : 0;
}
return 0;
}
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer,
ItemStack stack) {
@ -141,7 +95,7 @@ public class BlockPlayerDetector extends BlockMachineBase {
((TilePlayerDectector) tile).owenerUdid = placer.getUniqueID().toString();
}
}
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn,
EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
@ -194,7 +148,7 @@ public class BlockPlayerDetector extends BlockMachineBase {
}
return true;
}
@Override
protected BlockStateContainer createBlockState() {
TYPE = new PropertyString("type", types);
@ -218,4 +172,51 @@ public class BlockPlayerDetector extends BlockMachineBase {
public IMachineGuiHandler getGui() {
return null;
}
// Block
@Override
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
return new ItemStack(ModBlocks.PLAYER_DETECTOR, 1, typeNamesList.indexOf(state.getValue(TYPE)));
}
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
return Item.getItemFromBlock(this);
}
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(CreativeTabs creativeTabs, NonNullList<ItemStack> list) {
for (int meta = 0; meta < types.length; meta++) {
list.add(new ItemStack(this, 1, meta));
}
}
@Override
public boolean canConnectRedstone(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) {
return true;
}
@Override
public boolean canProvidePower(IBlockState state) {
return true;
}
@Override
public int getWeakPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
TileEntity entity = blockAccess.getTileEntity(pos);
if (entity instanceof TilePlayerDectector) {
return ((TilePlayerDectector) entity).isProvidingPower() ? 15 : 0;
}
return 0;
}
@Override
public int getStrongPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
TileEntity entity = blockAccess.getTileEntity(pos);
if (entity instanceof TilePlayerDectector) {
return ((TilePlayerDectector) entity).isProvidingPower() ? 15 : 0;
}
return 0;
}
}

View file

@ -39,7 +39,7 @@ public class BlockRecycler extends BlockMachineBase {
public BlockRecycler() {
super();
this.setCreativeTab(TechRebornCreativeTab.instance);
setCreativeTab(TechRebornCreativeTab.instance);
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, "machines/tier1_machines"));
}
@ -51,6 +51,5 @@ public class BlockRecycler extends BlockMachineBase {
@Override
public IMachineGuiHandler getGui() {
return EGui.RECYCLER;
}
}
}

View file

@ -39,7 +39,7 @@ public class BlockRollingMachine extends BlockMachineBase {
public BlockRollingMachine() {
super();
this.setCreativeTab(TechRebornCreativeTab.instance);
setCreativeTab(TechRebornCreativeTab.instance);
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, "machines/tier1_machines"));
}

View file

@ -39,7 +39,7 @@ public class BlockScrapboxinator extends BlockMachineBase {
public BlockScrapboxinator() {
super();
this.setCreativeTab(TechRebornCreativeTab.instance);
setCreativeTab(TechRebornCreativeTab.instance);
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, "machines/tier1_machines"));
}
@ -52,5 +52,4 @@ public class BlockScrapboxinator extends BlockMachineBase {
public IMachineGuiHandler getGui() {
return EGui.SCRAPBOXINATOR;
}
}