mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 00:38:35 +01:00
Fixed Server
This commit is contained in:
parent
9661f9e817
commit
7671b408c8
4 changed files with 25 additions and 27 deletions
|
@ -86,15 +86,12 @@ public class ItemLaserWrench extends Item implements IActAddItemOrBlock{
|
||||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){
|
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){
|
||||||
WorldPos coords = ItemPhantomConnector.getStoredPosition(stack);
|
WorldPos coords = ItemPhantomConnector.getStoredPosition(stack);
|
||||||
if(coords != null){
|
if(coords != null){
|
||||||
World world = coords.getWorld();
|
list.add(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".boundTo.desc")+":");
|
||||||
if(world != null){
|
list.add("X: "+coords.getX());
|
||||||
list.add(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".boundTo.desc")+":");
|
list.add("Y: "+coords.getY());
|
||||||
list.add("X: "+coords.getX());
|
list.add("Z: "+coords.getZ());
|
||||||
list.add("Y: "+coords.getY());
|
list.add(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".inWorld.desc")+" "+coords.getWorldID());
|
||||||
list.add("Z: "+coords.getZ());
|
list.add(EnumChatFormatting.ITALIC+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".clearStorage.desc"));
|
||||||
list.add(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".inWorld.desc")+" "+world.provider.dimensionId);
|
|
||||||
list.add(EnumChatFormatting.ITALIC+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".clearStorage.desc"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,6 @@ import net.minecraft.util.ChatComponentText;
|
||||||
import net.minecraft.util.EnumChatFormatting;
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.DimensionManager;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -82,8 +81,8 @@ public class ItemPhantomConnector extends Item implements IActAddItemOrBlock{
|
||||||
int x = tag.getInteger("XCoordOfTileStored");
|
int x = tag.getInteger("XCoordOfTileStored");
|
||||||
int y = tag.getInteger("YCoordOfTileStored");
|
int y = tag.getInteger("YCoordOfTileStored");
|
||||||
int z = tag.getInteger("ZCoordOfTileStored");
|
int z = tag.getInteger("ZCoordOfTileStored");
|
||||||
World world = DimensionManager.getWorld(tag.getInteger("WorldOfTileStored"));
|
int world = tag.getInteger("WorldOfTileStored");
|
||||||
if(!(x == 0 && y == 0 && z == 0) && world != null){
|
if(!(x == 0 && y == 0 && z == 0)){
|
||||||
return new WorldPos(world, x, y, z);
|
return new WorldPos(world, x, y, z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -126,15 +125,12 @@ public class ItemPhantomConnector extends Item implements IActAddItemOrBlock{
|
||||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){
|
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){
|
||||||
WorldPos coords = getStoredPosition(stack);
|
WorldPos coords = getStoredPosition(stack);
|
||||||
if(coords != null){
|
if(coords != null){
|
||||||
World world = coords.getWorld();
|
list.add(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".boundTo.desc")+":");
|
||||||
if(world != null){
|
list.add("X: "+coords.getX());
|
||||||
list.add(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".boundTo.desc")+":");
|
list.add("Y: "+coords.getY());
|
||||||
list.add("X: "+coords.getX());
|
list.add("Z: "+coords.getZ());
|
||||||
list.add("Y: "+coords.getY());
|
list.add(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".inWorld.desc")+" "+coords.getWorldID());
|
||||||
list.add("Z: "+coords.getZ());
|
list.add(EnumChatFormatting.ITALIC+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".clearStorage.desc"));
|
||||||
list.add(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".inWorld.desc")+" "+world.provider.dimensionId);
|
|
||||||
list.add(EnumChatFormatting.ITALIC+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".clearStorage.desc"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,6 @@ import ellpeck.actuallyadditions.util.WorldUtil;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.Vec3;
|
import net.minecraft.util.Vec3;
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.common.DimensionManager;
|
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -215,11 +213,10 @@ public class LaserRelayConnectionHandler{
|
||||||
public static ConnectionPair readFromNBT(NBTTagCompound compound, String name){
|
public static ConnectionPair readFromNBT(NBTTagCompound compound, String name){
|
||||||
WorldPos[] pos = new WorldPos[2];
|
WorldPos[] pos = new WorldPos[2];
|
||||||
for(int i = 0; i < pos.length; i++){
|
for(int i = 0; i < pos.length; i++){
|
||||||
World aWorld = DimensionManager.getWorld(compound.getInteger("world"+name+i));
|
|
||||||
int anX = compound.getInteger("x"+name+i);
|
int anX = compound.getInteger("x"+name+i);
|
||||||
int aY = compound.getInteger("y"+name+i);
|
int aY = compound.getInteger("y"+name+i);
|
||||||
int aZ = compound.getInteger("z"+name+i);
|
int aZ = compound.getInteger("z"+name+i);
|
||||||
pos[i] = new WorldPos(aWorld, anX, aY, aZ);
|
pos[i] = new WorldPos(compound.getInteger("world"+name+i), anX, aY, aZ);
|
||||||
}
|
}
|
||||||
return new ConnectionPair(pos[0], pos[1]);
|
return new ConnectionPair(pos[0], pos[1]);
|
||||||
}
|
}
|
||||||
|
@ -236,7 +233,7 @@ public class LaserRelayConnectionHandler{
|
||||||
public void writeToNBT(NBTTagCompound compound, String name){
|
public void writeToNBT(NBTTagCompound compound, String name){
|
||||||
for(int i = 0; i < 2; i++){
|
for(int i = 0; i < 2; i++){
|
||||||
WorldPos relay = i == 0 ? this.firstRelay : this.secondRelay;
|
WorldPos relay = i == 0 ? this.firstRelay : this.secondRelay;
|
||||||
compound.setInteger("world"+name+i, relay.getWorld().provider.dimensionId);
|
compound.setInteger("world"+name+i, relay.getWorldID());
|
||||||
compound.setInteger("x"+name+i, relay.getX());
|
compound.setInteger("x"+name+i, relay.getX());
|
||||||
compound.setInteger("y"+name+i, relay.getY());
|
compound.setInteger("y"+name+i, relay.getY());
|
||||||
compound.setInteger("z"+name+i, relay.getZ());
|
compound.setInteger("z"+name+i, relay.getZ());
|
||||||
|
|
|
@ -26,12 +26,20 @@ public class WorldPos{
|
||||||
private int worldID;
|
private int worldID;
|
||||||
|
|
||||||
public WorldPos(World world, int x, int y, int z){
|
public WorldPos(World world, int x, int y, int z){
|
||||||
this.worldID = world.provider.dimensionId;
|
this(world.provider.dimensionId, x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
public WorldPos(int worldID, int x, int y, int z){
|
||||||
|
this.worldID = worldID;
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
this.z = z;
|
this.z = z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getWorldID(){
|
||||||
|
return this.worldID;
|
||||||
|
}
|
||||||
|
|
||||||
public TileEntity getTileEntity(){
|
public TileEntity getTileEntity(){
|
||||||
return this.getWorld() != null ? this.getWorld().getTileEntity(this.x, this.y, this.z) : null;
|
return this.getWorld() != null ? this.getWorld().getTileEntity(this.x, this.y, this.z) : null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue