mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 08:48:34 +01:00
Generified the Phantom Connector
This commit is contained in:
parent
ded48b524d
commit
383461d1f3
4 changed files with 18 additions and 21 deletions
|
@ -2,8 +2,7 @@ package ellpeck.actuallyadditions.items;
|
|||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.tile.TileEntityPhantomPlacer;
|
||||
import ellpeck.actuallyadditions.tile.TileEntityPhantomface;
|
||||
import ellpeck.actuallyadditions.tile.IPhantomTile;
|
||||
import ellpeck.actuallyadditions.util.*;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
@ -32,21 +31,10 @@ public class ItemPhantomConnector extends Item implements INameableItem{
|
|||
//Passing Data to Phantoms
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if(tile != null){
|
||||
//Passing to Face
|
||||
if(tile instanceof TileEntityPhantomface){
|
||||
//Passing to Phantom
|
||||
if(tile instanceof IPhantomTile){
|
||||
if(this.checkHasConnection(stack, player, tile)){
|
||||
((TileEntityPhantomface)tile).boundPosition = this.getStoredPosition(stack);
|
||||
this.clearStorage(stack);
|
||||
player.addChatComponentMessage(new ChatComponentText(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connected.desc")));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//Passing to Placer
|
||||
else if(tile instanceof TileEntityPhantomPlacer){
|
||||
if(this.checkHasConnection(stack, player, tile)){
|
||||
((TileEntityPhantomPlacer)tile).boundPosition = this.getStoredPosition(stack);
|
||||
tile.markDirty();
|
||||
((IPhantomTile)tile).setBoundPosition(this.getStoredPosition(stack));
|
||||
this.clearStorage(stack);
|
||||
player.addChatComponentMessage(new ChatComponentText(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connected.desc")));
|
||||
return true;
|
||||
|
@ -66,11 +54,8 @@ public class ItemPhantomConnector extends Item implements INameableItem{
|
|||
return true;
|
||||
}
|
||||
else{
|
||||
if(tile instanceof TileEntityPhantomPlacer){
|
||||
((TileEntityPhantomPlacer)tile).boundPosition = null;
|
||||
}
|
||||
if(tile instanceof TileEntityPhantomface){
|
||||
((TileEntityPhantomface)tile).boundPosition = null;
|
||||
if(tile instanceof IPhantomTile){
|
||||
((IPhantomTile)tile).setBoundPosition(null);
|
||||
}
|
||||
player.addChatComponentMessage(new ChatComponentText(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.unbound.desc")));
|
||||
return false;
|
||||
|
|
|
@ -28,4 +28,6 @@ public interface IPhantomTile{
|
|||
* @return The range the tile currently has
|
||||
*/
|
||||
int getRange();
|
||||
|
||||
void setBoundPosition(WorldPos pos);
|
||||
}
|
||||
|
|
|
@ -129,6 +129,11 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements
|
|||
return this.range;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBoundPosition(WorldPos pos){
|
||||
this.boundPosition = pos == null ? null : pos.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
super.writeToNBT(compound);
|
||||
|
|
|
@ -145,6 +145,11 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
|
|||
return this.range;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBoundPosition(WorldPos pos){
|
||||
this.boundPosition = pos == null ? null : pos.copy();
|
||||
}
|
||||
|
||||
public static class TileEntityPhantomLiquiface extends TileEntityPhantomface implements IFluidHandler{
|
||||
|
||||
public TileEntityPhantomLiquiface(){
|
||||
|
|
Loading…
Reference in a new issue