Fixed rotations and rift regen. Sorta.

This commit is contained in:
StevenRS11
2014-01-26 00:00:20 -05:00
parent f36767b07b
commit a13fc069eb
3 changed files with 57 additions and 18 deletions

View File

@@ -77,21 +77,6 @@ public class BlockRift extends Block implements ITileEntityProvider
this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName());
}
//sends a packet informing the client that there is a link present so it renders properly. (when placed)
@Override
public void onBlockAdded(World par1World, int par2, int par3, int par4)
{
try
{
// PacketHandler.onLinkCreatedPacket(dimHelper.instance.getLinkDataFromCoords(par2, par3, par4, par1World));
}
catch(Exception e)
{
e.printStackTrace();
}
// this.updateTick(par1World, par2, par3, par4, new Random());
}
@Override
public boolean isCollidable()
{

View File

@@ -25,6 +25,7 @@ public class BlockRotator
hasOrientations[Block.stairsStoneBrick.blockID] = true;
hasOrientations[Block.lever.blockID] = true;
hasOrientations[Block.stoneButton.blockID] = true;
hasOrientations[Block.woodenButton.blockID] = true;
hasOrientations[Block.redstoneRepeaterIdle.blockID] = true;
hasOrientations[Block.redstoneRepeaterActive.blockID] = true;
hasOrientations[Block.tripWireSource.blockID] = true;
@@ -62,6 +63,9 @@ public class BlockRotator
hasOrientations[Block.railDetector.blockID] = true;
hasOrientations[Block.railActivator.blockID] = true;
hasOrientations[Block.rail.blockID] = true;
hasOrientations[Block.furnaceBurning.blockID] = true;
hasOrientations[Block.furnaceIdle.blockID] = true;
hasOrientations[Block.bed.blockID] = true;
hasOrientations[mod_pocketDim.dimensionalDoor.blockID] = true;
hasOrientations[mod_pocketDim.warpDoor.blockID] = true;
@@ -176,6 +180,36 @@ public class BlockRotator
break;
}
}
else if (blockID==Block.bed.blockID)
{
switch (metadata)
{
case 2:
metadata = 1;
break;
case 1:
metadata = 0;
break;
case 0:
metadata = 3;
break;
case 3:
metadata = 2;
break;
case 10:
metadata = 9;
break;
case 9:
metadata = 8;
break;
case 8:
metadata = 11;
break;
case 11:
metadata = 10;
break;
}
}
else if (Block.blocksList[blockID] instanceof BlockStairs)
{
@@ -207,7 +241,7 @@ public class BlockRotator
break;
}
}
else if (blockID == Block.chest.blockID || blockID == Block.chestTrapped.blockID || blockID == Block.ladder.blockID || blockID == Block.hopperBlock.blockID)
else if (blockID == Block.chest.blockID || blockID == Block.chestTrapped.blockID || blockID == Block.ladder.blockID || blockID == Block.hopperBlock.blockID|| blockID == Block.furnaceBurning.blockID|| blockID == Block.furnaceIdle.blockID)
{
switch (metadata)
{
@@ -318,7 +352,7 @@ public class BlockRotator
break;
}
}
else if(blockID== Block.lever.blockID||blockID== Block.stoneButton.blockID||blockID== Block.woodenButton.blockID||blockID== Block.torchWood.blockID||blockID== Block.torchRedstoneIdle.blockID||blockID== Block.torchRedstoneActive.blockID)
else if(blockID== Block.lever.blockID||blockID== Block.stoneButton.blockID||blockID== Block.stoneButton.blockID||blockID== Block.woodenButton.blockID||blockID== Block.torchWood.blockID||blockID== Block.torchRedstoneIdle.blockID||blockID== Block.torchRedstoneActive.blockID)
{
switch (metadata)
{

View File

@@ -1,7 +1,10 @@
package StevenDimDoors.mod_pocketDim.tileentities;
import StevenDimDoors.mod_pocketDim.ServerPacketHandler;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.blocks.IDimDoor;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import net.minecraft.block.Block;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.Packet130UpdateSign;
@@ -36,6 +39,23 @@ public class TileEntityDimDoor extends TileEntity
return null;
}
public void invalidate()
{
this.tileEntityInvalid = true;
if(this.worldObj.getBlockId(xCoord, yCoord, zCoord)==0&&!this.worldObj.isRemote)
{
if(PocketManager.getLink(xCoord, yCoord, zCoord, worldObj)!=null)
{
this.worldObj.setBlock(xCoord, yCoord, zCoord, mod_pocketDim.blockRift.blockID);
}
else if(PocketManager.getLink(xCoord, yCoord+1, zCoord, worldObj)!=null)
{
this.worldObj.setBlock(xCoord, yCoord+1, zCoord, mod_pocketDim.blockRift.blockID,0,2);
}
}
}
@Override
public void readFromNBT(NBTTagCompound nbt)
{