Fixed Transdimensional Trapdoor and More #87

Merged
SenseiKiwi merged 17 commits from rewrite into DevBranch 2013-09-09 05:08:07 +00:00
27 changed files with 528 additions and 440 deletions

View File

@@ -58,7 +58,7 @@ public class DDLoot {
addContent(properties.DimensionalDoorLootEnabled, items, mod_pocketDim.itemDimDoor.itemID, UNCOMMON_LOOT_WEIGHT);
addContent(properties.WarpDoorLootEnabled, items, mod_pocketDim.itemExitDoor.itemID, UNCOMMON_LOOT_WEIGHT);
addContent(properties.TransTrapdoorLootEnabled, items, mod_pocketDim.dimHatch.blockID, UNCOMMON_LOOT_WEIGHT);
addContent(properties.TransTrapdoorLootEnabled, items, mod_pocketDim.transTrapdoor.blockID, UNCOMMON_LOOT_WEIGHT);
addContent(properties.RiftSignatureLootEnabled, items, mod_pocketDim.itemLinkSignature.itemID, UNCOMMON_LOOT_WEIGHT);
addContent(properties.StableFabricLootEnabled, items, mod_pocketDim.itemStableFabric.itemID, UNCOMMON_LOOT_WEIGHT);
addContent(properties.RiftRemoverLootEnabled, items, mod_pocketDim.itemRiftRemover.itemID, UNCOMMON_LOOT_WEIGHT);

View File

@@ -69,8 +69,9 @@ public class EventHookContainer
public boolean LivingDeathEvent(LivingDeathEvent event)
{
Entity entity = event.entity;
if (entity instanceof EntityPlayer && entity.worldObj.provider instanceof PocketProvider
&& properties.LimboEnabled)
if (entity instanceof EntityPlayer && properties.LimboEnabled &&
entity.worldObj.provider instanceof PocketProvider)
{
EntityPlayer player = (EntityPlayer) entity;
if (!properties.LimboReturnsInventoryEnabled)
@@ -78,7 +79,8 @@ public class EventHookContainer
player.inventory.clearInventory(-1, -1);
}
ChunkCoordinates coords = LimboProvider.getLimboSkySpawn(player.worldObj.rand);
DDTeleporter.teleportEntity(player, new Point4D(coords.posX, coords.posY, coords.posZ, mod_pocketDim.properties.LimboDimensionID));
Point4D destination = new Point4D(coords.posX, coords.posY, coords.posZ, mod_pocketDim.properties.LimboDimensionID);
DDTeleporter.teleportEntity(player, destination, false);
player.setEntityHealth(player.getMaxHealth());
event.setCanceled(true);
return false;

View File

@@ -3,19 +3,17 @@ package StevenDimDoors.mod_pocketDim.blocks;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.BlockDoor;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.DDProperties;
@@ -32,10 +30,6 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
{
protected final DDProperties properties;
private Icon blockIconBottom;
protected boolean isBlockContainer=true;
private boolean isTileProvider = true;
public BaseDimDoor(int blockID, Material material, DDProperties properties)
{
@@ -139,7 +133,7 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
{
//FIXME: We need to set door generation flags on the tile entities. Ignoring that for now. ~SenseiKiwi
this.placeDimDoor(world, x, y, z);
this.placeLink(world, x, y, z);
world.setBlockTileEntity(x, y, z, this.createNewTileEntity(world));
this.updateAttachedTile(world, x, y, z);
}
@@ -185,6 +179,7 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
tile.openOrClosed = this.isDoorOpen( par1World, par2, par3, par4);
tile.orientation = this.getFullMetadata(par1World, par2, par3, par4) & 7;
}
private void setDoorRotation(int par1)
{
float var2 = 0.1875F;
@@ -368,19 +363,38 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
@Override
public void enterDimDoor(World world, int x, int y, int z, Entity entity)
{
int var12 = (int) (MathHelper.floor_double((double) ((entity.rotationYaw + 90) * 4.0F / 360.0F) + 0.5D) & 3);
int orientation = world.getBlockMetadata(x, y - 1, z);
if (!world.isRemote && (orientation >= 4 && orientation <= 7) && (orientation - 4) == var12 &&
world.getBlockId(x, y - 1, z) == this.blockID)
// We need to ignore particle entities
if (world.isRemote || entity instanceof EntityFX)
{
this.onPoweredBlockChange(world, x, y, z, false);
return;
}
// Check that this is the top block of the door
if (world.getBlockId(x, y - 1, z) == this.blockID)
{
int metadata = world.getBlockMetadata(x, y - 1, z);
boolean canUse = isDoorOpen(metadata);
if (canUse && entity instanceof EntityLiving)
{
// Don't check for non-living entities since it might not work right
canUse = isEntityFacingDoor(metadata, (EntityLiving) entity);
}
if (canUse)
{
// Teleport the entity through the link, if it exists
DimLink link = PocketManager.getLink(x, y, z, world.provider.dimensionId);
if (link != null)
{
DDTeleporter.traverseDimDoor(world, link, entity);
}
// Close the door only after the entity goes through
// so players don't have it slam in their faces.
this.onPoweredBlockChange(world, x, y, z, false);
}
}
else if (world.getBlockId(x, y + 1, z) == this.blockID)
{
enterDimDoor(world, x, y + 1, z, entity);
}
}
@@ -389,4 +403,18 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
{
return this.blockID;
}
protected static boolean isDoorOpen(int metadata)
{
return (metadata & 4) != 0;
}
protected static boolean isEntityFacingDoor(int metadata, EntityLiving entity)
{
// Although any entity has the proper fields for this check,
// we should only apply it to living entities since things
// like Minecarts might come in backwards.
int direction = (int) (MathHelper.floor_double((double) ((entity.rotationYaw + 90) * 4.0F / 360.0F) + 0.5D) & 3);
return ((metadata & 3) == direction);
}
}

View File

@@ -67,7 +67,7 @@ public class BlockDimWallPerm extends Block
//FIXME: Shouldn't we make the player's destination safe BEFORE teleporting him?!
//player.setPositionAndUpdate( x, y, z );
Point4D destination = new Point4D(destinationX, destinationY, destinationZ, 0);
DDTeleporter.teleportEntity(player, destination);
DDTeleporter.teleportEntity(player, destination, false);
//player.setPositionAndUpdate( x, y, z );

View File

@@ -18,7 +18,7 @@ public class DimensionalDoor extends BaseDimDoor
}
@Override
public void placeDimDoor(World world, int x, int y, int z)
public void placeLink(World world, int x, int y, int z)
{
if (!world.isRemote && world.getBlockId(x, y - 1, z) == this.blockID)
{

View File

@@ -7,7 +7,7 @@ public interface IDimDoor
{
public void enterDimDoor(World world, int x, int y, int z, Entity entity);
public void placeDimDoor(World world, int x, int y, int z);
public void placeLink(World world, int x, int y, int z);
public int getDrops();
}

View File

@@ -0,0 +1,118 @@
package StevenDimDoors.mod_pocketDim.blocks;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockTrapDoor;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.core.DDTeleporter;
import StevenDimDoors.mod_pocketDim.core.DimLink;
import StevenDimDoors.mod_pocketDim.core.LinkTypes;
import StevenDimDoors.mod_pocketDim.core.NewDimData;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityTransTrapdoor;
public class TransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntityProvider
{
public TransTrapdoor(int blockID, Material material)
{
super(blockID, material);
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
}
@Override
public void registerIcons(IconRegister par1IconRegister)
{
this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2());
}
//Teleports the player to the exit link of that dimension, assuming it is a pocket
@Override
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity)
{
enterDimDoor(world, x, y, z, entity);
}
@Override
public void enterDimDoor(World world, int x, int y, int z, Entity entity)
{
if (!world.isRemote && isTrapdoorOpen(world.getBlockMetadata(x, y, z)))
{
this.onPoweredBlockChange(world, x, y, z, false);
DimLink link = PocketManager.getLink(x, y, z, world);
if (link != null)
{
DDTeleporter.traverseDimDoor(world, link, entity);
}
}
}
@Override
public void onBlockAdded(World world, int x, int y, int z)
{
this.placeLink(world, x, y, z);
world.setBlockTileEntity(x, y, z, this.createNewTileEntity(world));
this.updateAttachedTile(world, x, y, z);
}
public void updateTick(World world, int x, int y, int z, Random random)
{
TileEntityTransTrapdoor tile = (TileEntityTransTrapdoor) world.getBlockTileEntity(x, y, z);
tile.hasRift = PocketManager.getLink(x, y, z, world) != null;
}
@Override
public TileEntity createNewTileEntity(World world)
{
return new TileEntityTransTrapdoor();
}
public void updateAttachedTile(World world, int x, int y, int z)
{
TileEntity tile = world.getBlockTileEntity(x, y, z);
if (tile instanceof TileEntityTransTrapdoor)
{
TileEntityTransTrapdoor trapdoorTile = (TileEntityTransTrapdoor) tile;
trapdoorTile.hasRift = (PocketManager.getLink(x, y, z, world) != null);
}
}
@Override
public void placeLink(World world, int x, int y, int z)
{
if (!world.isRemote)
{
NewDimData dimension = PocketManager.getDimensionData(world);
DimLink link = dimension.getLink(x, y, z);
if (link == null && dimension.isPocketDimension())
{
dimension.createLink(x, y, z, LinkTypes.UNSAFE_EXIT);
}
}
}
@Override
public int idDropped(int metadata, Random random, int fortuneLevel)
{
return getDrops();
}
@Override
public int getDrops()
{
return Block.trapdoor.blockID;
}
public static boolean isTrapdoorSetLow(int metadata)
{
return (metadata & 8) == 0;
}
}

View File

@@ -1,9 +1,10 @@
package StevenDimDoors.mod_pocketDim.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.DDProperties;
import StevenDimDoors.mod_pocketDim.core.DDTeleporter;
@@ -22,26 +23,44 @@ public class TransientDoor extends BaseDimDoor
@Override
public void enterDimDoor(World world, int x, int y, int z, Entity entity)
{
//TODO: Would it kill us to use REASONABLE variable names? <_< ~SenseiKiwi
int var12 = (int) (MathHelper.floor_double((double) ((entity.rotationYaw + 90) * 4.0F / 360.0F) + 0.5D) & 3);
int orientation = world.getBlockMetadata(x, y - 1, z);
if (!world.isRemote && orientation == var12 && world.getBlockId(x, y - 1, z) == this.blockID)
// We need to ignore particle entities
if (world.isRemote || entity instanceof EntityFX)
{
return;
}
// Check that this is the top block of the door
if (world.getBlockId(x, y - 1, z) == this.blockID)
{
boolean canUse = true;
int metadata = world.getBlockMetadata(x, y - 1, z);
if (canUse && entity instanceof EntityLiving)
{
// Don't check for non-living entities since it might not work right
canUse = BaseDimDoor.isEntityFacingDoor(metadata, (EntityLiving) entity);
}
if (canUse)
{
// Teleport the entity through the link, if it exists
DimLink link = PocketManager.getLink(x, y, z, world.provider.dimensionId);
if (link != null)
{
DDTeleporter.traverseDimDoor(world, link, entity);
//Turn the transient door into a rift AFTER teleporting the entity.
//The door's orientation may be needed for generating a room at the link's destination.
// Turn the door into a rift AFTER teleporting the player.
// The door's orientation may be necessary for the teleport.
world.setBlock(x, y, z, properties.RiftBlockID);
world.setBlockToAir(x, y - 1, z);
}
}
}
else if (world.getBlockId(x, y + 1, z) == this.blockID)
{
enterDimDoor(world, x, y + 1, z, entity);
}
}
@Override
public void placeDimDoor(World world, int x, int y, int z)
public void placeLink(World world, int x, int y, int z)
{
if (!world.isRemote && world.getBlockId(x, y - 1, z) == this.blockID)
{

View File

@@ -16,7 +16,7 @@ public class UnstableDoor extends BaseDimDoor
}
@Override
public void placeDimDoor(World world, int x, int y, int z)
public void placeLink(World world, int x, int y, int z)
{
if (!world.isRemote && world.getBlockId(x, y - 1, z) == this.blockID)
{

View File

@@ -17,7 +17,7 @@ public class WarpDoor extends BaseDimDoor
}
@Override
public void placeDimDoor(World world, int x, int y, int z)
public void placeLink(World world, int x, int y, int z)
{
if (!world.isRemote && world.getBlockId(x, y - 1, z) == this.blockID)
{

View File

@@ -1,128 +0,0 @@
package StevenDimDoors.mod_pocketDim.blocks;
import java.util.Random;
import net.minecraft.block.BlockTrapDoor;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoor;
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimHatch;
import StevenDimDoors.mod_pocketDim.world.PocketProvider;
public class dimHatch extends BlockTrapDoor implements IDimDoor, ITileEntityProvider
{
public dimHatch(int par1,int par2, Material par2Material)
{
super(par1, Material.iron);
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
// this.setTextureFile("/PocketBlockTextures.png");
// this.blockIndexInTexture = 16;
}
public void registerIcons(IconRegister par1IconRegister)
{
this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2());
}
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
{
int var10 = par1World.getBlockMetadata(par2, par3, par4);
par1World.setBlockMetadataWithNotify(par2, par3, par4, var10 ^ 4,2);
par1World.playAuxSFXAtEntity(par5EntityPlayer, 1003, par2, par3, par4, 0);
return true;
}
}
//Teleports the player to the exit link of that dimension, assuming it is a pocket
public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity)
{
int num = par1World.getBlockMetadata(par2, par3, par4);
if (!par1World.isRemote&&(num>3&&num<8||num>11)&&par1World.provider instanceof PocketProvider)
{
this.onPoweredBlockChange(par1World, par2, par3, par4, false);
/* FIXME: No point in fixing the following code when it's going to be rewritten later anyway. ~SenseiKiwi
NewDimData newDimData = (NewDimData) dimHelper.PocketManager.dimList.get(par1World.provider.dimensionId);
ILinkData exitLink=newDimData.exitDimLink;
exitLink.locDimID=par1World.provider.dimensionId;
PocketManager.instance.traverseDimDoor(par1World, exitLink, par5Entity);*/
}
}
public void onPoweredBlockChange(World par1World, int par2, int par3, int par4, boolean par5)
{
int var6 = par1World.getBlockMetadata(par2, par3, par4);
boolean var7 = (var6 & 4) > 0;
if (var7 != par5)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, var6 ^ 4,2);
par1World.playAuxSFXAtEntity((EntityPlayer)null, 1003, par2, par3, par4, 0);
}
}
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
{
TileEntityDimHatch tile = (TileEntityDimHatch) par1World.getBlockTileEntity(par2, par3, par4);
tile.hasRift = PocketManager.getLink(par2, par3, par4, par1World)!=null;
tile.metaData = par1World.getBlockMetadata(par2, par3, par4);
tile.isShut = this.isTrapdoorOpen(par4);
}
@Override
public TileEntity createNewTileEntity(World world)
{
return new TileEntityDimHatch();
}
public dimHatch updateAttachedTile(World world, int x, int y, int z)
{
TileEntity tile = world.getBlockTileEntity(x, y, z);
if (tile instanceof TileEntityDimHatch)
{
TileEntityDimHatch dimTile = (TileEntityDimHatch) tile;
dimTile.hasRift = PocketManager.getLink(x, y, z, world)!=null;
dimTile.metaData = world.getBlockMetadata(x, y, z);
dimTile.isShut = this.isTrapdoorOpen( world.getBlockMetadata(x, y, z));
}
return this;
}
@Override
public void enterDimDoor(World world, int x, int y, int z, Entity entity) {
// TODO Auto-generated method stub
}
@Override
public void placeDimDoor(World world, int x, int y, int z) {
// TODO Auto-generated method stub
}
@Override
public void onBlockAdded(World world, int x, int y, int z)
{
world.setBlockTileEntity(x, y, z, this.createNewTileEntity(world));
this.updateAttachedTile(world, x, y, z);
}
@Override
public int getDrops() {
// TODO Auto-generated method stub
return 0;
}
}

View File

@@ -39,98 +39,98 @@ public class DDTeleporter
private DDTeleporter() { }
private static void placeInPortal(Entity entity, WorldServer world, Point4D destination, DDProperties properties)
private static void placeInPortal(Entity entity, WorldServer world, Point4D destination, DDProperties properties, boolean checkOrientation)
{
int x = destination.getX();
int y = destination.getY();
int z = destination.getZ();
int orientation = getDestinationOrientation(destination, properties);
int orientation;
if (checkOrientation)
{
orientation = getDestinationOrientation(destination, properties);
entity.rotationYaw = (orientation * 90) + 90;
}
else
{
//Teleport the entity to the precise destination point
orientation = -1;
}
if (entity instanceof EntityPlayer)
{
EntityPlayer player = (EntityPlayer) entity;
player.rotationYaw=(orientation*90)+90;
if(orientation==2||orientation==6)
switch (orientation)
{
player.setPositionAndUpdate( x+1.5, y-1, z+.5 );
}
else if(orientation==3||orientation==7)
{
player.setPositionAndUpdate( x+.5, y-1, z+1.5 );
}
else if(orientation==0||orientation==4)
{
player.setPositionAndUpdate(x-.5, y-1, z+.5);
}
else if(orientation==1||orientation==5)
{
player.setPositionAndUpdate(x+.5, y-1, z-.5);
}
else
{
player.setPositionAndUpdate(x, y-1, z);
case 0:
player.setPositionAndUpdate(x - 0.5, y - 1, z + 0.5);
break;
case 1:
player.setPositionAndUpdate(x + 0.5, y - 1, z - 0.5);
break;
case 2:
player.setPositionAndUpdate(x + 1.5, y - 1, z + 0.5);
break;
case 3:
player.setPositionAndUpdate(x + 0.5, y - 1, z + 1.5);
break;
default:
player.setPositionAndUpdate(x, y - 1, z);
break;
}
}
else if (entity instanceof EntityMinecart)
{
entity.motionX=0;
entity.motionZ=0;
entity.motionY=0;
entity.rotationYaw=(orientation*90)+90;
entity.motionX = 0;
entity.motionZ = 0;
entity.motionY = 0;
if(orientation==2||orientation==6)
switch (orientation)
{
DDTeleporter.setEntityPosition(entity, x+1.5, y, z+.5 );
entity.motionX =.39;
case 0:
DDTeleporter.setEntityPosition(entity, x - 0.5, y, z + 0.5);
entity.motionX = -0.39;
entity.worldObj.updateEntityWithOptionalForce(entity, false);
break;
case 1:
DDTeleporter.setEntityPosition(entity, x + 0.5, y, z - 0.5);
entity.motionZ = -0.39;
entity.worldObj.updateEntityWithOptionalForce(entity, false);
break;
case 2:
DDTeleporter.setEntityPosition(entity, x + 1.5, y, z + 0.5);
entity.motionX = 0.39;
entity.worldObj.updateEntityWithOptionalForce(entity, false);
break;
case 3:
DDTeleporter.setEntityPosition(entity, x + 0.5, y, z + 1.5 );
entity.motionZ = 0.39;
entity.worldObj.updateEntityWithOptionalForce(entity, false);
break;
default:
DDTeleporter.setEntityPosition(entity, x, y, z);
break;
}
else if(orientation==3||orientation==7)
{
DDTeleporter.setEntityPosition(entity, x+.5, y, z+1.5 );
entity.motionZ =.39;
entity.worldObj.updateEntityWithOptionalForce(entity, false);
}
else if(orientation==0||orientation==4)
{
DDTeleporter.setEntityPosition(entity,x-.5, y, z+.5);
entity.motionX =-.39;
entity.worldObj.updateEntityWithOptionalForce(entity, false);
}
else if(orientation==1||orientation==5)
{
DDTeleporter.setEntityPosition(entity,x+.5, y, z-.5);
entity.motionZ =-.39;
entity.worldObj.updateEntityWithOptionalForce(entity, false);
}
else
{
DDTeleporter.setEntityPosition(entity,x, y, z);
}
}
else if (entity instanceof Entity)
switch (orientation)
{
entity.rotationYaw=(orientation*90)+90;
if(orientation==2||orientation==6)
{
DDTeleporter.setEntityPosition(entity, x+1.5, y, z+.5 );
}
else if(orientation==3||orientation==7)
{
DDTeleporter.setEntityPosition(entity, x+.5, y, z+1.5 );
}
else if(orientation==0||orientation==4)
{
DDTeleporter.setEntityPosition(entity,x-.5, y, z+.5);
}
else if(orientation==1||orientation==5)
{
DDTeleporter.setEntityPosition(entity,x+.5, y, z-.5);
}
else
{
DDTeleporter.setEntityPosition(entity,x, y, z);
case 0:
setEntityPosition(entity, x - 0.5, y, z + 0.5);
break;
case 1:
setEntityPosition(entity, x + 0.5, y, z - 0.5);
break;
case 2:
setEntityPosition(entity, x + 1.5, y, z + 0.5);
break;
case 3:
setEntityPosition(entity, x + 0.5, y, z + 1.5);
break;
default:
setEntityPosition(entity, x, y, z);
break;
}
}
}
@@ -164,7 +164,7 @@ public class DDTeleporter
return world.getBlockMetadata(door.getX(), door.getY() - 1, door.getZ()) & 3;
}
public static Entity teleportEntity(Entity entity, Point4D destination)
public static Entity teleportEntity(Entity entity, Point4D destination, boolean checkOrientation)
{
if (entity == null)
{
@@ -185,7 +185,7 @@ public class DDTeleporter
// Is something riding? Handle it first.
if (entity.riddenByEntity != null)
{
return teleportEntity(entity.riddenByEntity, destination);
return teleportEntity(entity.riddenByEntity, destination, checkOrientation);
}
// Are we riding something? Dismount and tell the mount to go first.
@@ -193,7 +193,7 @@ public class DDTeleporter
if (cart != null)
{
entity.mountEntity(null);
cart = teleportEntity(cart, destination);
cart = teleportEntity(cart, destination, checkOrientation);
// We keep track of both so we can remount them on the other side.
}
@@ -211,7 +211,7 @@ public class DDTeleporter
// GreyMaria: What is this even accomplishing? We're doing the exact same thing at the end of this all.
// TODO Check to see if this is actually vital.
DDTeleporter.placeInPortal(entity, newWorld, destination, properties);
DDTeleporter.placeInPortal(entity, newWorld, destination, properties, checkOrientation);
if (difDest) // Are we moving our target to a new dimension?
{
@@ -306,7 +306,7 @@ public class DDTeleporter
GameRegistry.onPlayerChangedDimension((EntityPlayer)entity);
}
DDTeleporter.placeInPortal(entity, newWorld, destination, properties);
DDTeleporter.placeInPortal(entity, newWorld, destination, properties, checkOrientation);
return entity;
}
@@ -355,13 +355,13 @@ public class DDTeleporter
Point4D randomDestination = getRandomDestination();
if (randomDestination != null)
{
entity = teleportEntity(entity, randomDestination);
entity = teleportEntity(entity, randomDestination, true);
entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, "mob.endermen.portal", 1.0F, 1.0F);
}
}
else
{
entity = teleportEntity(entity, link.destination());
entity = teleportEntity(entity, link.destination(), link.linkType() != LinkTypes.UNSAFE_EXIT);
entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, "mob.endermen.portal", 1.0F, 1.0F);
}
}
@@ -436,9 +436,9 @@ public class DDTeleporter
private static boolean generateUnsafeExit(DimLink link)
{
// An unsafe exit teleports the user to exactly the same coordinates
// as the link source, except located at the dimension's root dimension.
// This is very risky, as we make no effort to clear an air pocket or
// An unsafe exit teleports the user to the first available air space
// in the pocket's root dimension. X and Z are kept roughly the same
// as the source location, but Y is set by searching down. We don't
// place a platform at the destination. We also don't place a reverse
// link at the destination, so it's a one-way trip. Good luck!
@@ -449,13 +449,20 @@ public class DDTeleporter
if (current.isPocketDimension())
{
Point4D source = link.source();
current.root().setDestination(link, source.getX(), source.getY(), source.getZ());
return true;
}
else
World world = PocketManager.loadDimension(current.root().id());
if (world == null)
{
return false;
}
Point3D destination = yCoordHelper.findDropPoint(world, source.getX(), source.getY(), source.getZ());
if (destination != null)
{
current.root().setDestination(link, source.getX(), source.getY(), source.getZ());
return true;
}
}
return false;
}
private static boolean generateSafeExit(DimLink link, DDProperties properties)

View File

@@ -439,6 +439,10 @@ public abstract class NewDimData
{
throw new IllegalStateException("The dimension has already been initialized.");
}
if (orientation < 0 || orientation > 3)
{
throw new IllegalArgumentException("orientation must be between 0 and 3, inclusive.");
}
setDestination(incoming, originX, originY, originZ);
this.origin = incoming.destination();

View File

@@ -218,6 +218,71 @@ public class yCoordHelper
return target;
}
public static Point3D findDropPoint(World world, int x, int y, int z)
{
/*// Find a simple 2-block-high air gap
// Search across a 3x3 column
int localX = x < 0 ? (x % 16) + 16 : (x % 16);
int localZ = z < 0 ? (z % 16) + 16 : (z % 16);
int cornerX = x - localX;
int cornerZ = z - localZ;
localX = MathHelper.clamp_int(localX, 1, 14);
localZ = MathHelper.clamp_int(localZ, 1, 14);
Chunk chunk = initializeChunkArea(world, x >> 4, z >> 4);
int height = world.getActualHeight();
int y, dx, dz, blockID;
boolean isSafe;
boolean hasBlocks;
Block block;
int layers = 0;
// Check if a 3x3 layer of blocks is empty
// If we find a layer that contains replaceable blocks, it can
// serve as the base where we'll place the player and door.
for (y = Math.min(startY + 2, height - 1); y >= 0; y--)
{
isSafe = true;
hasBlocks = false;
for (dx = -1; dx <= 1 && isSafe; dx++)
{
for (dz = -1; dz <= 1 && isSafe; dz++)
{
blockID = chunk.getBlockID(localX + dx, y, localZ + dz);
if (blockID != 0)
{
block = Block.blocksList[blockID];
if (!block.blockMaterial.isReplaceable())
{
if (layers >= 3)
{
return new Point3D(localX + cornerX, y + 1, localZ + cornerZ);
}
isSafe = false;
}
hasBlocks = true;
}
}
}
if (isSafe)
{
layers++;
if (hasBlocks)
{
if (layers >= 3)
{
return new Point3D(localX + cornerX, y, localZ + cornerZ);
}
layers = 0;
}
}
}
return null;*/
// Temporary measure to not break the build
return new Point3D(x, y - 2, z);
}
public static int adjustDestinationY(int y, int worldHeight, int entranceY, int dungeonHeight)
{
//The goal here is to guarantee that the dungeon fits within the vertical bounds

View File

@@ -17,10 +17,10 @@ import StevenDimDoors.mod_pocketDim.blocks.BlockDimWallPerm;
import StevenDimDoors.mod_pocketDim.blocks.BlockLimbo;
import StevenDimDoors.mod_pocketDim.blocks.BlockRift;
import StevenDimDoors.mod_pocketDim.blocks.DimensionalDoor;
import StevenDimDoors.mod_pocketDim.blocks.TransTrapdoor;
import StevenDimDoors.mod_pocketDim.blocks.TransientDoor;
import StevenDimDoors.mod_pocketDim.blocks.UnstableDoor;
import StevenDimDoors.mod_pocketDim.blocks.WarpDoor;
import StevenDimDoors.mod_pocketDim.blocks.dimHatch;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper;
import StevenDimDoors.mod_pocketDim.items.ItemBlockDimWall;
@@ -38,8 +38,8 @@ import StevenDimDoors.mod_pocketDim.ticking.MobMonolith;
import StevenDimDoors.mod_pocketDim.ticking.MonolithSpawner;
import StevenDimDoors.mod_pocketDim.ticking.RiftRegenerator;
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoor;
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimHatch;
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityRift;
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityTransTrapdoor;
import StevenDimDoors.mod_pocketDim.world.BiomeGenLimbo;
import StevenDimDoors.mod_pocketDim.world.BiomeGenPocket;
import StevenDimDoors.mod_pocketDim.world.GatewayGenerator;
@@ -95,7 +95,7 @@ public class mod_pocketDim
public static Block blockLimbo;
public static DimensionalDoor dimensionalDoor;
public static Block blockDimWall;
public static Block dimHatch;
public static TransTrapdoor transTrapdoor;
public static Block blockDimWallPerm;
public static BlockRift blockRift;
@@ -168,8 +168,7 @@ public class mod_pocketDim
blockLimbo = new BlockLimbo(properties.LimboBlockID, 15, Material.iron, properties.LimboDimensionID, decay).setHardness(.2F).setUnlocalizedName("BlockLimbo").setLightValue(.0F);
unstableDoor = (new UnstableDoor(properties.UnstableDoorID, Material.iron, properties).setHardness(.2F).setUnlocalizedName("chaosDoor").setLightValue(.0F) );
dimensionalDoor = (DimensionalDoor) (new DimensionalDoor(properties.DimensionalDoorID, Material.iron, properties).setHardness(1.0F).setResistance(2000.0F) .setUnlocalizedName("dimDoor"));
dimHatch = (new dimHatch(properties.TransTrapdoorID, 84, Material.iron)).setHardness(1.0F) .setUnlocalizedName("dimHatch");
// dimRail = (new DimRail(dimRailID, 88, false)).setHardness(.5F) .setUnlocalizedName("dimRail");
transTrapdoor = (TransTrapdoor) (new TransTrapdoor(properties.TransTrapdoorID, Material.wood).setHardness(1.0F) .setUnlocalizedName("dimHatch"));
itemDimDoor = (new ItemDimensionalDoor(properties.DimensionalDoorItemID, Material.iron)).setUnlocalizedName("itemDimDoor");
itemExitDoor = (new ItemWarpDoor(properties.WarpDoorItemID, Material.wood)).setUnlocalizedName("itemDimDoorWarp");
@@ -190,7 +189,7 @@ public class mod_pocketDim
GameRegistry.registerBlock(blockRift, "Rift");
GameRegistry.registerBlock(blockLimbo, "Unraveled Fabric");
GameRegistry.registerBlock(dimensionalDoor, "Dimensional Door");
GameRegistry.registerBlock(dimHatch,"Transdimensional Trapdoor");
GameRegistry.registerBlock(transTrapdoor,"Transdimensional Trapdoor");
GameRegistry.registerBlock(blockDimWallPerm, "Fabric of RealityPerm");
GameRegistry.registerBlock(transientDoor, "transientDoor");
@@ -208,7 +207,7 @@ public class mod_pocketDim
LanguageRegistry.addName(blockDimWall , "Fabric of Reality");
LanguageRegistry.addName(blockDimWallPerm , "Eternal Fabric");
LanguageRegistry.addName(dimensionalDoor, "Dimensional Door");
LanguageRegistry.addName(dimHatch, "Transdimensional Trapdoor");
LanguageRegistry.addName(transTrapdoor, "Transdimensional Trapdoor");
LanguageRegistry.addName(itemExitDoor, "Warp Door");
LanguageRegistry.addName(itemLinkSignature , "Rift Signature");
@@ -230,7 +229,7 @@ public class mod_pocketDim
GameRegistry.registerTileEntity(TileEntityDimDoor.class, "TileEntityDimDoor");
GameRegistry.registerTileEntity(TileEntityRift.class, "TileEntityRift");
GameRegistry.registerTileEntity(TileEntityDimHatch.class, "TileEntityDimHatch");
GameRegistry.registerTileEntity(TileEntityTransTrapdoor.class, "TileEntityDimHatch");
EntityRegistry.registerModEntity(MobMonolith.class, "Monolith", properties.MonolithEntityID, this, 70, 1, true);
EntityList.IDtoClassMapping.put(properties.MonolithEntityID, MobMonolith.class);
@@ -273,12 +272,12 @@ public class mod_pocketDim
}
if(properties.CraftingTransTrapdoorAllowed)
{
GameRegistry.addRecipe(new ItemStack(dimHatch, 1), new Object[]
GameRegistry.addRecipe(new ItemStack(transTrapdoor, 1), new Object[]
{
" y ", " x ", " y ", 'x', Item.enderPearl, 'y', Block.trapdoor
});
GameRegistry.addRecipe(new ItemStack(dimHatch, 1), new Object[]
GameRegistry.addRecipe(new ItemStack(transTrapdoor, 1), new Object[]
{
" y ", " x ", " y ", 'x', mod_pocketDim.itemStableFabric, 'y', Block.trapdoor
});

View File

@@ -7,7 +7,6 @@ import net.minecraft.block.BlockRedstoneRepeater;
import net.minecraft.block.BlockStairs;
import StevenDimDoors.mod_pocketDim.Point3D;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.blocks.BaseDimDoor;
public class BlockRotator
{
@@ -379,7 +378,7 @@ public class BlockRotator
break;
}
}
else if(Block.blocksList[blockID] instanceof BlockRedstoneRepeater || Block.blocksList[blockID] instanceof BlockDoor || Block.blocksList[blockID] instanceof BaseDimDoor || blockID== Block.tripWireSource.blockID || Block.blocksList[blockID] instanceof BlockComparator)
else if (Block.blocksList[blockID] instanceof BlockRedstoneRepeater || Block.blocksList[blockID] instanceof BlockDoor || blockID== Block.tripWireSource.blockID || Block.blocksList[blockID] instanceof BlockComparator)
{
switch (metadata)
{

View File

@@ -24,8 +24,9 @@ public class LimboDecay implements IRegularTickReceiver {
//Provides a reversed list of the block IDs that blocks cycle through during decay.
private final int[] decaySequence;
private Random random;
private DDProperties properties = null;
private final Random random;
private final DDProperties properties;
private final int[] blocksImmuneToDecay;
public LimboDecay(IRegularTickSender tickSender, DDProperties properties)
{
@@ -36,6 +37,16 @@ public class LimboDecay implements IRegularTickReceiver {
Block.stone.blockID
};
blocksImmuneToDecay = new int[] {
properties.LimboBlockID,
properties.PermaFabricBlockID,
properties.TransientDoorID,
properties.DimensionalDoorID,
properties.WarpDoorID,
properties.RiftBlockID,
properties.UnstableDoorID
};
this.properties = properties;
this.random = new Random();
tickSender.registerForTicking(this, LIMBO_DECAY_INTERVAL, false);
@@ -151,12 +162,22 @@ public class LimboDecay implements IRegularTickReceiver {
}
/**
* Checks if a block can decay. We will not decay air, Unraveled Fabric, Eternal Fabric, or containers.
* Checks if a block can decay. We will not decay air, certain DD blocks, or containers.
*/
private boolean canDecayBlock(int blockID)
{
if (blockID == 0 || blockID == properties.LimboBlockID || blockID == properties.PermaFabricBlockID)
if (blockID == 0)
{
return false;
}
for (int k = 0; k < blocksImmuneToDecay.length; k++)
{
if (blockID == blocksImmuneToDecay[k])
{
return false;
}
}
Block block = Block.blocksList[blockID];
return (block == null || !(block instanceof BlockContainer));

View File

@@ -150,7 +150,7 @@ public class MobMonolith extends EntityFlying implements IMob
(int) this.posY + 500,
(int) this.posZ + MathHelper.getRandomIntegerInRange(rand, -250, 250),
properties.LimboDimensionID);
DDTeleporter.teleportEntity(entityPlayer, destination);
DDTeleporter.teleportEntity(entityPlayer, destination, false);
this.aggro = 0;
entityPlayer.worldObj.playSoundAtEntity(entityPlayer,"mods.DimDoors.sfx.crack",13, 1);

View File

@@ -1,78 +0,0 @@
package StevenDimDoors.mod_pocketDim.tileentities;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class TileEntityDimHatch extends TileEntity
{
public boolean hasRift;
public boolean isShut;
public int metaData;
public boolean shouldRefresh(int oldID, int newID, int oldMeta, int newMeta, World world, int x, int y, int z)
{
if(newID==0&&PocketManager.getLink(x, y, z, world)!=null)
{
world.setBlock(x, y, z, mod_pocketDim.blockRift.blockID);
}
return true;
}
public boolean canUpdate()
{
return true;
}
public void updateEntity()
{
System.out.println(this.worldObj.getBlockMetadata(xCoord, yCoord, zCoord));
}
@Override
public void readFromNBT(NBTTagCompound nbt)
{
super.readFromNBT(nbt);
int i = nbt.getInteger(("Size"));
try
{
this.hasRift = nbt.getBoolean("hasRift");
this.isShut = nbt.getBoolean("isShut");
this.metaData = nbt.getInteger("metaData");
}
catch (Exception e)
{
}
}
@Override
public void writeToNBT(NBTTagCompound nbt)
{
int i = 0;
super.writeToNBT(nbt);
nbt.setBoolean("hasRift", this.hasRift);
nbt.setBoolean("isShut", this.isShut);
nbt.setInteger("metaData", this.metaData);
}
}

View File

@@ -0,0 +1,55 @@
package StevenDimDoors.mod_pocketDim.tileentities;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class TileEntityTransTrapdoor extends TileEntity
{
public boolean hasRift;
@Override
public boolean shouldRefresh(int oldID, int newID, int oldMeta, int newMeta, World world, int x, int y, int z)
{
if (newID == 0 && PocketManager.getLink(x, y, z, world) != null)
{
world.setBlock(x, y, z, mod_pocketDim.blockRift.blockID);
}
return true;
}
@Override
public boolean canUpdate()
{
return true;
}
@Override
public void updateEntity()
{
}
@Override
public void readFromNBT(NBTTagCompound nbt)
{
super.readFromNBT(nbt);
try
{
this.hasRift = nbt.getBoolean("hasRift");
}
catch (Exception e)
{
}
}
@Override
public void writeToNBT(NBTTagCompound nbt)
{
super.writeToNBT(nbt);
nbt.setBoolean("hasRift", this.hasRift);
}
}

View File

@@ -30,6 +30,7 @@ public class GatewayGenerator implements IWorldGenerator
private static final int NETHER_CHANCE_CORRECTION = 4;
private static final int OVERWORLD_DIMENSION_ID = 0;
private static final int NETHER_DIMENSION_ID = -1;
private static final int END_DIMENSION_ID = 1;
private final DDProperties properties;
@@ -43,8 +44,9 @@ public class GatewayGenerator implements IWorldGenerator
{
//Don't generate rifts or gateways if the rift generation flag is disabled,
//the current world is a pocket dimension, or the world is remote.
if ((!properties.WorldRiftGenerationEnabled && !(world.provider instanceof LimboProvider)) ||
world.provider instanceof PocketProvider || world.isRemote)
//Also don't generate anything in The End.
if (world.isRemote || (!properties.WorldRiftGenerationEnabled && !(world.provider instanceof LimboProvider)) ||
(world.provider instanceof PocketProvider) || (world.provider.dimensionId == END_DIMENSION_ID))
{
return;
}

View File

@@ -17,14 +17,6 @@ import cpw.mods.fml.relauncher.SideOnly;
public class PocketProvider extends WorldProvider
{
public int exitXCoord;
public int exitYCoord;
public int exitZCoord;
public int exitDimID;
public boolean hasNoSky = true;
public boolean isSavingSchematic= false;
public int dimToSave;
private DDProperties properties;
private MonolithSpawner spawner;
@@ -38,8 +30,7 @@ public class PocketProvider extends WorldProvider
@Override
protected void registerWorldChunkManager()
{
super.worldChunkMgr = new WorldChunkManagerHell(mod_pocketDim.pocketBiome,1,1);
//this.dimensionId = ConfigAtum.dimensionID;
super.worldChunkMgr = new WorldChunkManagerHell(mod_pocketDim.pocketBiome, 1, 1);
}
@Override
@@ -48,28 +39,18 @@ public class PocketProvider extends WorldProvider
return (dimensionId == 0 ? null : "DimensionalDoors/pocketDimID" + dimensionId);
}
public void saveAsSchematic(int id)
{
this.isSavingSchematic=true;
this.dimensionId=id;
}
@Override
public Vec3 getSkyColor(Entity cameraEntity, float partialTicks)
{
setCloudRenderer( new CloudRenderBlank());
return this.worldObj.getWorldVec3Pool().getVecFromPool((double)0, (double)0, (double)0);
}
@SideOnly(Side.CLIENT)
@Override
public Vec3 getFogColor(float par1, float par2)
{
return this.worldObj.getWorldVec3Pool().getVecFromPool((double)0, (double)0, (double)0);
}
@Override
@@ -90,6 +71,7 @@ public class PocketProvider extends WorldProvider
return false;
}
@Override
public boolean canBlockFreeze(int x, int y, int z, boolean byWater)
{
return false;
@@ -104,6 +86,7 @@ public class PocketProvider extends WorldProvider
return "PocketDim " + this.dimensionId;
}
@Override
public int getRespawnDimension(EntityPlayerMP player)
{
int respawnDim;
@@ -124,8 +107,15 @@ public class PocketProvider extends WorldProvider
return respawnDim;
}
@Override
public boolean canRespawnHere()
{
return false;
}
@Override
public int getActualHeight()
{
return 256;
}
}

View File

@@ -3,7 +3,7 @@ import net.minecraft.src.ModLoader;
import StevenDimDoors.mod_pocketDim.CommonProxy;
import StevenDimDoors.mod_pocketDim.ticking.MobMonolith;
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoor;
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimHatch;
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityTransTrapdoor;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
@@ -16,7 +16,7 @@ public class ClientProxy extends CommonProxy
{
//MinecraftForgeClient.preloadTexture(BLOCK_PNG);
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityDimDoor.class, new RenderDimDoor());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityDimHatch.class, new RenderDimTrapDoor());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTransTrapdoor.class, new RenderTransTrapdoor());
//This code activates the new rift rendering, as well as a bit of code in TileEntityRift
//ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRift.class, new RenderRift());

View File

@@ -31,7 +31,7 @@ public class ClosingRiftFX extends EntityFX
this.field_92047_az = par14EffectRenderer;
this.particleScale *= .55F;
this.particleMaxAge = 30 + this.rand.nextInt(16);
this.noClip = false;
this.noClip = true;
}
public void func_92045_e(boolean par1)

View File

@@ -31,7 +31,7 @@ public class GoggleRiftFX extends EntityFireworkSparkFX
this.field_92047_az = par14EffectRenderer;
this.particleScale *= .55F;
this.particleMaxAge = 30 + this.rand.nextInt(16);
this.noClip = false;
this.noClip = true;
}
public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
{

View File

@@ -12,33 +12,31 @@ import org.lwjgl.opengl.GL11;
import StevenDimDoors.mod_pocketDim.DDProperties;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.blocks.dimHatch;
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoor;
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimHatch;
import StevenDimDoors.mod_pocketDim.blocks.TransTrapdoor;
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityTransTrapdoor;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderDimTrapDoor extends TileEntitySpecialRenderer
public class RenderTransTrapdoor extends TileEntitySpecialRenderer
{
FloatBuffer field_76908_a = GLAllocation.createDirectFloatBuffer(16);
private FloatBuffer field_76908_a = GLAllocation.createDirectFloatBuffer(16);
private static DDProperties properties = null;
public RenderDimTrapDoor()
public RenderTransTrapdoor()
{
if (properties == null)
properties = DDProperties.instance();
}
private static DDProperties properties = null;
/**
* Renders the dimdoor.
*/
public void renderDimHatchTileEntity(TileEntityDimHatch tile, double x, double y, double z, float par8)
public void renderTransTrapdoorTileEntity(TileEntityTransTrapdoor tile, double x, double y, double z, float par8)
{
try
{
( (dimHatch) mod_pocketDim.dimHatch).updateAttachedTile(tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord);
mod_pocketDim.transTrapdoor.updateAttachedTile(tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord);
}
catch(Exception e)
{
@@ -52,10 +50,8 @@ public class RenderDimTrapDoor extends TileEntitySpecialRenderer
//float distance = (float) tile.getDistanceFrom(playerX, playerY, playerZ);
GL11.glDisable(GL11.GL_LIGHTING);
Random rand = new Random(31100L);
float var13 = 0.75F;
Random random = new Random(31100L);
int metadata = tile.worldObj.getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord);
for (int count = 0; count < 16; ++count)
{
@@ -82,8 +78,6 @@ public class RenderDimTrapDoor extends TileEntitySpecialRenderer
var16 = .5F;
}
GL11.glTranslatef( (float)(Minecraft.getSystemTime() % 200000L) / 200000.0F,0, 0.0F);
GL11.glTranslatef(0, (float)(Minecraft.getSystemTime() % 200000L) / 200000.0F, 0.0F);
@@ -116,12 +110,9 @@ public class RenderDimTrapDoor extends TileEntitySpecialRenderer
GL11.glBegin(GL11.GL_QUADS);
float var21 = rand.nextFloat() * 0.5F + 0.1F;
float var22 = rand.nextFloat() * 0.4F + 0.4F;
float var23 = rand.nextFloat() * 0.6F + 0.5F;
float var21 = random.nextFloat() * 0.5F + 0.1F;
float var22 = random.nextFloat() * 0.4F + 0.4F;
float var23 = random.nextFloat() * 0.6F + 0.5F;
if (count == 0)
{
@@ -129,29 +120,9 @@ public class RenderDimTrapDoor extends TileEntitySpecialRenderer
var22 = 1.0F;
}
GL11.glColor4d(var21 * var17, var22 * var17, var23 * var17, 1.0F);
if(tile.metaData>7)
if (TransTrapdoor.isTrapdoorSetLow(metadata))
{
if(tile.isShut)
{
GL11.glVertex3d(x, y+0.85, z);
GL11.glVertex3d(x, y+0.85, z+1);
GL11.glVertex3d(x+1 , y+0.85 , z+1);
GL11.glVertex3d(x+1 , y+0.85 , z);
}
else
{
GL11.glVertex3d(x, y+0.95, z);
GL11.glVertex3d(x, y+0.95, z+1);
GL11.glVertex3d(x+1 , y+0.95 , z+1);
GL11.glVertex3d(x+1 , y+0.95 , z);
}
}
else
{
if(tile.isShut)
if (TransTrapdoor.isTrapdoorOpen(metadata))
{
GL11.glVertex3d(x, y+0.2, z);
GL11.glVertex3d(x, y+0.2, z+1);
@@ -165,11 +136,25 @@ public class RenderDimTrapDoor extends TileEntitySpecialRenderer
GL11.glVertex3d(x+1 , y+0.15 , z+1);
GL11.glVertex3d(x+1 , y+0.15 , z);
}
}
else
{
if (TransTrapdoor.isTrapdoorOpen(metadata))
{
GL11.glVertex3d(x, y+0.95, z);
GL11.glVertex3d(x, y+0.95, z+1);
GL11.glVertex3d(x+1 , y+0.95 , z+1);
GL11.glVertex3d(x+1 , y+0.95 , z);
}
else
{
GL11.glVertex3d(x, y+0.85, z);
GL11.glVertex3d(x, y+0.85, z+1);
GL11.glVertex3d(x+1 , y+0.85 , z+1);
GL11.glVertex3d(x+1 , y+0.85 , z);
}
}
GL11.glEnd();
GL11.glPopMatrix();
GL11.glMatrixMode(GL11.GL_MODELVIEW);
}
@@ -194,7 +179,7 @@ public class RenderDimTrapDoor extends TileEntitySpecialRenderer
{
if (properties.DoorRenderingEnabled)
{
this.renderDimHatchTileEntity((TileEntityDimHatch)par1TileEntity, par2, par4, par6, par8);
this.renderTransTrapdoorTileEntity((TileEntityTransTrapdoor)par1TileEntity, par2, par4, par6, par8);
}
}
}

View File

@@ -31,7 +31,7 @@ public class RiftFX extends EntityFX
this.field_92047_az = par14EffectRenderer;
this.particleScale *= 0.75F;
this.particleMaxAge = 40 + this.rand.nextInt(26);
this.noClip = false;
this.noClip = true;
}
public void func_92045_e(boolean par1)