fixed rift sig shine issue- moved to NBT data
fixed NEI bug Signed-off-by: StevenRS11 <stevenrs11@aol.com>
This commit is contained in:
@@ -23,7 +23,7 @@ public class BlockRift extends BlockContainer
|
||||
|
||||
protected BlockRift(int i, int j, Material par2Material)
|
||||
{
|
||||
super(i, Material.snow);
|
||||
super(i, Material.air);
|
||||
setTickRandomly(true);
|
||||
// this.setCreativeTab(CreativeTabs.tabBlock);
|
||||
this.setLightOpacity(14);
|
||||
|
||||
@@ -67,8 +67,9 @@ public class EventHookContainer
|
||||
|
||||
|
||||
|
||||
for(WorldServer world : dimHelper.getWorlds())
|
||||
for(Integer ids : dimHelper.getIDs())
|
||||
{
|
||||
World world = dimHelper.getWorld(ids);
|
||||
int linkCount=0;
|
||||
|
||||
if(dimHelper.dimList.containsKey(world.provider.dimensionId))
|
||||
@@ -141,24 +142,7 @@ public class EventHookContainer
|
||||
|
||||
|
||||
|
||||
//need to propely separate client/server
|
||||
int face = event.face;
|
||||
switch (face) {
|
||||
case 0: y = y-1;
|
||||
break;
|
||||
case 1: y=y+1;
|
||||
break;
|
||||
case 2: z=z-1;
|
||||
break;
|
||||
case 3: z=z+1;
|
||||
break;
|
||||
case 4: x=x-1;
|
||||
break;
|
||||
case 5: x=x+1 ;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if(event.entityPlayer.getHeldItem()!=null)
|
||||
{
|
||||
@@ -226,7 +210,7 @@ public class EventHookContainer
|
||||
@ForgeSubscribe
|
||||
public void onPlayerDrops(PlayerDropsEvent event)
|
||||
{
|
||||
mod_pocketDim.limboSpawnInventory=event.drops;
|
||||
mod_pocketDim.limboSpawnInventory.put(event.entityPlayer.username, event.drops);
|
||||
}
|
||||
|
||||
@ForgeSubscribe
|
||||
|
||||
@@ -41,7 +41,7 @@ public class PlayerRespawnTracker implements IPlayerTracker
|
||||
if(!player.worldObj.isRemote)
|
||||
{
|
||||
|
||||
for(EntityItem drop : mod_pocketDim.limboSpawnInventory)
|
||||
for(EntityItem drop : mod_pocketDim.limboSpawnInventory.get(player.username))
|
||||
{
|
||||
|
||||
player.inventory.addItemStackToInventory(drop.getEntityItem());
|
||||
|
||||
@@ -40,6 +40,7 @@ import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
public class dimHelper extends DimensionManager
|
||||
@@ -228,15 +229,16 @@ public class dimHelper extends DimensionManager
|
||||
{
|
||||
PotionEffect effect = (PotionEffect)potionEffect;
|
||||
player.playerNetServerHandler.sendPacketToPlayer(new Packet41EntityEffect(player.entityId, effect));
|
||||
|
||||
}
|
||||
|
||||
player.playerNetServerHandler.sendPacketToPlayer(new Packet43Experience(player.experience, player.experienceTotal, player.experienceLevel));
|
||||
|
||||
|
||||
}
|
||||
|
||||
WorldServer.class.cast(newWorld).theChunkProviderServer.loadChunk(MathHelper.floor_double(entity.posX) >> 4, MathHelper.floor_double(entity.posZ) >> 4);
|
||||
|
||||
|
||||
|
||||
}
|
||||
WorldServer.class.cast(newWorld).theChunkProviderServer.loadChunk(MathHelper.floor_double(entity.posX) >> 4, MathHelper.floor_double(entity.posZ) >> 4);
|
||||
}
|
||||
|
||||
|
||||
@@ -251,12 +253,13 @@ public class dimHelper extends DimensionManager
|
||||
{
|
||||
oldWorld.getChunkFromChunkCoords(entX, entZ).removeEntity(entity);
|
||||
oldWorld.getChunkFromChunkCoords(entX, entZ).isModified = true;
|
||||
|
||||
}
|
||||
|
||||
oldWorld.loadedEntityList.remove(entity);
|
||||
|
||||
oldWorld.releaseEntitySkin(entity);
|
||||
|
||||
entity.isDead = false;
|
||||
// entity.isDead = false;
|
||||
|
||||
if (!(entity instanceof EntityPlayer))
|
||||
{
|
||||
@@ -285,7 +288,7 @@ public class dimHelper extends DimensionManager
|
||||
|
||||
entity.worldObj.updateEntityWithOptionalForce(entity, false);
|
||||
|
||||
new pocketTeleporter((WorldServer) newWorld, link).placeInPortal(entity, 0, 0, 0, 0);
|
||||
mod_pocketDim.teleporter.placeInPortal(entity, newWorld, link);
|
||||
|
||||
|
||||
if ((entity != null) && (cart != null))
|
||||
@@ -346,6 +349,10 @@ public class dimHelper extends DimensionManager
|
||||
|
||||
|
||||
this.teleportEntity(world, entity, linkData);
|
||||
if(entity instanceof EntityPlayerMP)
|
||||
{
|
||||
GameRegistry.onPlayerChangedDimension((EntityPlayer)entity);
|
||||
}
|
||||
|
||||
entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, "mob.endermen.portal", 1.0F, 1.0F);
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -35,12 +36,15 @@ public class itemLinkSignature extends Item
|
||||
public boolean hasEffect(ItemStack par1ItemStack)
|
||||
{
|
||||
// adds effect if item has a link stored
|
||||
int key=par1ItemStack.getItemDamage();
|
||||
LinkData linkData= dimHelper.instance.interDimLinkList.get(key);
|
||||
if(linkData!=null)
|
||||
|
||||
|
||||
if(par1ItemStack.hasTagCompound())
|
||||
{
|
||||
if(par1ItemStack.stackTagCompound.getBoolean("isCreated"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -65,33 +69,27 @@ public class itemLinkSignature extends Item
|
||||
{
|
||||
|
||||
//par1ItemStack= par2EntityPlayer.getCurrentEquippedItem();
|
||||
Integer[] linkCoords =this.readFromNBT(par1ItemStack);
|
||||
|
||||
|
||||
|
||||
key=par1ItemStack.getItemDamage();
|
||||
linkData = dimHelper.instance.interDimLinkList.get(key);
|
||||
//System.out.println(key);
|
||||
int offset = 2;
|
||||
if(linkData!=null&&key!=0)
|
||||
if(par1ItemStack.getTagCompound()!=null)
|
||||
{
|
||||
if(par1ItemStack.getTagCompound().getBoolean("isCreated"))
|
||||
{
|
||||
// checks to see if the item has a link stored, if so, it creates it
|
||||
if(par3World.getBlockId(par4, par5, par6)==Block.snow.blockID)
|
||||
{
|
||||
offset = 1;
|
||||
}
|
||||
dimHelper.instance.createLink(par3World.provider.dimensionId, linkData.destDimID, par4, par5+offset, par6, linkData.destXCoord, linkData.destYCoord, linkData.destZCoord);
|
||||
dimHelper.instance.createLink(linkData.destDimID, par3World.provider.dimensionId, linkData.destXCoord, linkData.destYCoord, linkData.destZCoord,par4, par5+offset, par6);
|
||||
dimHelper.instance.createLink(par3World.provider.dimensionId, linkCoords[3], par4, par5+offset, par6, linkCoords[0], linkCoords[1], linkCoords[2]);
|
||||
dimHelper.instance.createLink(linkCoords[3], par3World.provider.dimensionId, linkCoords[0], linkCoords[1], linkCoords[2],par4, par5+offset, par6);
|
||||
|
||||
--par1ItemStack.stackSize;
|
||||
par2EntityPlayer.sendChatToPlayer("Rift Created");
|
||||
if(par2EntityPlayer.capabilities.isCreativeMode)
|
||||
{
|
||||
par2EntityPlayer.sendChatToPlayer("Rift Signature Cleared");
|
||||
|
||||
par2EntityPlayer.inventory.mainInventory[par2EntityPlayer.inventory.currentItem] = new ItemStack(this, 1, 0);
|
||||
|
||||
|
||||
}
|
||||
par1ItemStack.stackTagCompound=null;
|
||||
/**
|
||||
else
|
||||
{
|
||||
@@ -100,6 +98,7 @@ public class itemLinkSignature extends Item
|
||||
}
|
||||
**/
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(par3World.getBlockId(par4, par5, par6)==Block.snow.blockID)
|
||||
@@ -108,16 +107,12 @@ public class itemLinkSignature extends Item
|
||||
}
|
||||
//otherwise, it creates the first half of the link. Next click will complete it.
|
||||
key= dimHelper.instance.createUniqueInterDimLinkKey();
|
||||
linkData= new LinkData(par3World.provider.dimensionId,par4, par5+offset, par6);
|
||||
this.writeToNBT(par1ItemStack, par4, par5+offset, par6,par3World.provider.dimensionId);
|
||||
|
||||
|
||||
dimHelper.instance.interDimLinkList.put(key, linkData);
|
||||
par1ItemStack.setItemDamage(key);
|
||||
|
||||
PacketHandler.linkKeyPacket(linkData, key);
|
||||
par2EntityPlayer.sendChatToPlayer("Rift Signature Stored");
|
||||
|
||||
par2EntityPlayer.inventory.mainInventory[par2EntityPlayer.inventory.currentItem] = new ItemStack(this, 1, key);
|
||||
|
||||
}
|
||||
|
||||
@@ -138,10 +133,15 @@ public class itemLinkSignature extends Item
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
|
||||
{
|
||||
|
||||
LinkData linkData = dimHelper.instance.interDimLinkList.get(par1ItemStack.getItemDamage());
|
||||
if(linkData!=null)
|
||||
if(par1ItemStack.hasTagCompound())
|
||||
{
|
||||
par3List.add(String.valueOf("Leads to dim "+linkData.destDimID +" at depth "+dimHelper.instance.getDimDepth(linkData.destDimID)));
|
||||
if(par1ItemStack.stackTagCompound.getBoolean("isCreated"))
|
||||
{
|
||||
Integer[] coords = this.readFromNBT(par1ItemStack);
|
||||
par3List.add(String.valueOf("Leads to dim "+coords[3] +" with depth "+dimHelper.instance.getDimDepth(dimHelper.instance.getDimDepth(coords[3]))));
|
||||
par3List.add("at x="+coords[0]+" y="+coords[1]+" z="+coords[3]);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
@@ -154,6 +154,59 @@ public class itemLinkSignature extends Item
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void writeToNBT(ItemStack itemStack,int x, int y, int z, int dimID)
|
||||
{
|
||||
NBTTagCompound tag;
|
||||
|
||||
if(itemStack.hasTagCompound())
|
||||
{
|
||||
tag = itemStack.getTagCompound();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
tag= new NBTTagCompound();
|
||||
}
|
||||
|
||||
tag.setInteger("linkX", x);
|
||||
tag.setInteger("linkY", y);
|
||||
tag.setInteger("linkZ", z);
|
||||
tag.setInteger("linkDimID", dimID);
|
||||
tag.setBoolean("isCreated", true);
|
||||
|
||||
itemStack.setTagCompound(tag);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the stack fields from a NBT object.
|
||||
*/
|
||||
public Integer[] readFromNBT(ItemStack itemStack)
|
||||
{
|
||||
|
||||
NBTTagCompound tag;
|
||||
Integer[] linkCoords = new Integer[5];
|
||||
if(itemStack.hasTagCompound())
|
||||
{
|
||||
tag = itemStack.getTagCompound();
|
||||
|
||||
if(!tag.getBoolean("isCreated"))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
linkCoords[0]=tag.getInteger("linkX");
|
||||
linkCoords[1]=tag.getInteger("linkY");
|
||||
linkCoords[2]=tag.getInteger("linkZ");
|
||||
linkCoords[3]=tag.getInteger("linkDimID");
|
||||
|
||||
|
||||
}
|
||||
return linkCoords;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreated(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@ package StevenDimDoors.mod_pocketDim;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -55,7 +56,7 @@ public class mod_pocketDim
|
||||
{
|
||||
|
||||
|
||||
public static final String version = "1.5.1R1.3.3B2";
|
||||
public static final String version = "1.5.1R1.3.3RC2";
|
||||
public static final String modid = "DimensionalDoors";
|
||||
|
||||
//need to clean up
|
||||
@@ -65,6 +66,7 @@ public class mod_pocketDim
|
||||
@Instance("PocketDimensions")
|
||||
public static mod_pocketDim instance = new mod_pocketDim();
|
||||
public static SchematicLoader loader = new SchematicLoader();
|
||||
public static pocketTeleporter teleporter = new pocketTeleporter();
|
||||
|
||||
public static final ICommand removeRiftsCommand = new CommandDeleteRifts();
|
||||
public static final ICommand pruneDimsCommand = new CommandPruneDims();
|
||||
@@ -129,7 +131,7 @@ public class mod_pocketDim
|
||||
|
||||
public static PlayerRespawnTracker tracker= new PlayerRespawnTracker();
|
||||
|
||||
public static ArrayList<EntityItem> limboSpawnInventory=new ArrayList<EntityItem>();
|
||||
public static HashMap<String,ArrayList<EntityItem>> limboSpawnInventory=new HashMap<String,ArrayList<EntityItem>>();
|
||||
|
||||
public static ArrayList blocksImmuneToRift= new ArrayList();
|
||||
public static ArrayList<DungeonGenerator> registeredDungeons = new ArrayList<DungeonGenerator>();
|
||||
|
||||
@@ -34,6 +34,7 @@ public class pocketProvider extends WorldProvider
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void setAllowedSpawnTypes(boolean allowHostile, boolean allowPeaceful)
|
||||
{
|
||||
super.setAllowedSpawnTypes(false, false);
|
||||
|
||||
@@ -7,33 +7,37 @@ import net.minecraft.world.Teleporter;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
|
||||
public class pocketTeleporter extends Teleporter
|
||||
public class pocketTeleporter
|
||||
{
|
||||
int x,y,z;
|
||||
World world;
|
||||
|
||||
LinkData sendingLink;
|
||||
|
||||
|
||||
public pocketTeleporter(WorldServer par1WorldServer, LinkData link)
|
||||
public pocketTeleporter()
|
||||
|
||||
{
|
||||
|
||||
|
||||
super(par1WorldServer);
|
||||
this.x=link.destXCoord;
|
||||
this.y=link.destYCoord;
|
||||
this.z=link.destZCoord;
|
||||
this.sendingLink=link;
|
||||
world = par1WorldServer;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a new portal near an entity.
|
||||
*/
|
||||
@Override
|
||||
public void placeInPortal(Entity par1Entity, double par2, double par4, double par6, float par8)
|
||||
|
||||
public void placeInPortal(Entity par1Entity, WorldServer world, LinkData link)
|
||||
{
|
||||
|
||||
|
||||
this.x=link.destXCoord;
|
||||
this.y=link.destYCoord;
|
||||
this.z=link.destZCoord;
|
||||
this.sendingLink=link;
|
||||
|
||||
|
||||
|
||||
if(par1Entity instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) par1Entity;
|
||||
@@ -206,9 +210,5 @@ public class pocketTeleporter extends Teleporter
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void func_85189_a(long par1)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user