mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
added redstone mode to the ranged collector because jose is a whiny bitch
This commit is contained in:
parent
10439db8ca
commit
ca169cd089
3 changed files with 33 additions and 23 deletions
|
@ -44,6 +44,9 @@ public class BlockRangedCollector extends BlockContainerBase{
|
|||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9){
|
||||
if(this.tryToggleRedstone(world, pos, player)){
|
||||
return true;
|
||||
}
|
||||
if(!world.isRemote){
|
||||
TileEntityRangedCollector breaker = (TileEntityRangedCollector)world.getTileEntity(pos);
|
||||
if(breaker != null){
|
||||
|
|
|
@ -121,11 +121,8 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB
|
|||
TileEntityBase base = (TileEntityBase)tile;
|
||||
if(!world.isRemote && base.isRedstoneToggle()){
|
||||
base.isPulseMode = !base.isPulseMode;
|
||||
tile.markDirty();
|
||||
|
||||
if(tile instanceof TileEntityBase){
|
||||
((TileEntityBase)tile).sendUpdate();
|
||||
}
|
||||
base.markDirty();
|
||||
base.sendUpdate();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -47,10 +47,12 @@ public class TileEntityRangedCollector extends TileEntityInventoryBase implement
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity(){
|
||||
super.updateEntity();
|
||||
if(!this.world.isRemote){
|
||||
if(!this.isRedstonePowered){
|
||||
public boolean isRedstoneToggle(){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activateOnPulse(){
|
||||
ArrayList<EntityItem> items = (ArrayList<EntityItem>)this.world.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(this.pos.getX()-RANGE, this.pos.getY()-RANGE, this.pos.getZ()-RANGE, this.pos.getX()+RANGE, this.pos.getY()+RANGE, this.pos.getZ()+RANGE));
|
||||
if(!items.isEmpty()){
|
||||
for(EntityItem item : items){
|
||||
|
@ -72,6 +74,14 @@ public class TileEntityRangedCollector extends TileEntityInventoryBase implement
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity(){
|
||||
super.updateEntity();
|
||||
if(!this.world.isRemote){
|
||||
if(!this.isRedstonePowered && !this.isPulseMode){
|
||||
this.activateOnPulse();
|
||||
}
|
||||
|
||||
if(this.filter.needsUpdateSend() && this.sendUpdateWithInterval()){
|
||||
this.filter.updateLasts();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue