mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-22 19:39:24 +01:00
Added a method to the API to figure out which type a laser relay has
This commit is contained in:
parent
aa75418653
commit
8f65ac4683
2 changed files with 22 additions and 16 deletions
|
@ -11,6 +11,7 @@
|
|||
package de.ellpeck.actuallyadditions.api.laser;
|
||||
|
||||
import io.netty.util.internal.ConcurrentSet;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
@ -30,13 +31,11 @@ public interface ILaserRelayConnectionHandler{
|
|||
|
||||
Network getNetworkFor(BlockPos relay, World world);
|
||||
|
||||
@Deprecated
|
||||
boolean addConnection(BlockPos firstRelay, BlockPos secondRelay, World world);
|
||||
|
||||
@Deprecated
|
||||
boolean addConnection(BlockPos firstRelay, BlockPos secondRelay, World world, boolean suppressConnectionRender);
|
||||
|
||||
boolean addConnection(BlockPos firstRelay, BlockPos secondRelay, LaserType type, World world);
|
||||
|
||||
boolean addConnection(BlockPos firstRelay, BlockPos secondRelay, LaserType type, World world, boolean suppressConnectionRender);
|
||||
|
||||
LaserType getTypeFromLaser(TileEntity tile);
|
||||
|
||||
LaserType getTypeFromLsaer(BlockPos pos, World world);
|
||||
}
|
||||
|
|
|
@ -15,9 +15,11 @@ import de.ellpeck.actuallyadditions.api.laser.ILaserRelayConnectionHandler;
|
|||
import de.ellpeck.actuallyadditions.api.laser.LaserType;
|
||||
import de.ellpeck.actuallyadditions.api.laser.Network;
|
||||
import de.ellpeck.actuallyadditions.mod.data.WorldData;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelay;
|
||||
import io.netty.util.internal.ConcurrentSet;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
@ -109,16 +111,6 @@ public final class LaserRelayConnectionHandler implements ILaserRelayConnectionH
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addConnection(BlockPos firstRelay, BlockPos secondRelay, World world){
|
||||
return this.addConnection(firstRelay, secondRelay, null, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addConnection(BlockPos firstRelay, BlockPos secondRelay, World world, boolean suppressConnectionRender){
|
||||
return this.addConnection(firstRelay, secondRelay, null, world, suppressConnectionRender);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addConnection(BlockPos firstRelay, BlockPos secondRelay, LaserType type, World world){
|
||||
return this.addConnection(firstRelay, secondRelay, type, world, false);
|
||||
|
@ -170,4 +162,19 @@ public final class LaserRelayConnectionHandler implements ILaserRelayConnectionH
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LaserType getTypeFromLaser(TileEntity tile){
|
||||
if(tile instanceof TileEntityLaserRelay){
|
||||
return ((TileEntityLaserRelay)tile).type;
|
||||
}
|
||||
else{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public LaserType getTypeFromLsaer(BlockPos pos, World world){
|
||||
return this.getTypeFromLaser(world.getTileEntity(pos));
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue