Fixed door render issue finally

Signed-off-by: StevenRS11 <steven.r.stafford.ii.14@dartmouth.edu>
This commit is contained in:
StevenRS11 2013-03-22 00:58:55 -04:00
parent c812fafc52
commit f800a9a353
5 changed files with 49 additions and 34 deletions

View file

@ -77,7 +77,7 @@ public class CommonTickHandler implements ITickHandler
else
{
dimHelper.getWorld(link.locDimID).setBlockWithNotify(link.locXCoord, link.locYCoord, link.locZCoord, mod_pocketDim.blockRiftID);
TileEntityRift.class.cast(dimHelper.getWorld(link.locDimID).getBlockTileEntity(link.locXCoord, link.locYCoord, link.locZCoord)).hasGrownRifts=true;
}
}
}

View file

@ -1,9 +1,14 @@
package StevenDimDoors.mod_pocketDim;
import java.io.File;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.monster.EntityEnderman;
import net.minecraft.entity.player.EntityPlayer;
@ -15,6 +20,7 @@ import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.client.event.sound.SoundLoadEvent;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.entity.living.LivingFallEvent;
import net.minecraftforge.event.entity.player.PlayerDropsEvent;
@ -24,6 +30,19 @@ import net.minecraftforge.event.world.WorldEvent;
public class EventHookContainer
{
Random rand= new Random();
@SideOnly(Side.CLIENT)
@ForgeSubscribe
public void onSoundLoad(SoundLoadEvent event)
{
File dataDir = Minecraft.getMinecraft().mcDataDir;
// event.manager.soundPoolSounds.addSound("mod/test/sound.ogg", new File(
// dataDir, "resources/mod/test/sound.ogg"));
}
@ForgeSubscribe
public void onWorldLoad(WorldEvent.Load event)
{

View file

@ -181,7 +181,7 @@ public class ItemRiftBlade extends itemDimDoor
{
link.linkOrientation= rotation;
dimHelper.instance.createLink(link);
System.out.println("doingup");
//System.out.println("doingup");
int ExitDimID= dimHelper.dimList.get(par2World.provider.dimensionId).exitDimLink.destDimID;
dimHelper.instance.createLink(link.locDimID, ExitDimID, x, y, z, x, y, z,rotation);
@ -199,7 +199,8 @@ public class ItemRiftBlade extends itemDimDoor
placeDoorBlock(par2World, x, y, z, rotation, mod_pocketDim.transientDoor);
placeDoorBlock(par2World, x, y-1, z, rotation, mod_pocketDim.transientDoor);
}
else
{
@ -213,7 +214,7 @@ public class ItemRiftBlade extends itemDimDoor
{
Boolean didFindThing=false;
MovingObjectPosition hit = this.getMovingObjectPositionFromPlayer(par3EntityPlayer.worldObj, par3EntityPlayer, false );
if(hit!=null)
if(hit!=null&&!par2World.isRemote)
{
if(par2World.getBlockId(hit.blockX, hit.blockY, hit.blockZ)==mod_pocketDim.blockRiftID)
{

View file

@ -25,7 +25,7 @@ public class TransientDoor extends ExitDoor
protected TransientDoor(int par1, Material material)
{
super(par1, Material.air);
super(par1, Material.grass);
// this.blockIndexInTexture = 18;
this.setTextureFile("/PocketBlockTextures.png");
@ -35,9 +35,14 @@ public class TransientDoor extends ExitDoor
return false;
}
public void onBlockAdded(World par1World, int par2, int par3, int par4)
{
public void onBlockAdded(World par1World, int par2, int par3, int par4)
{
this.updateAttatchedTile(par1World, par2, par3, par4);
}
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4)
{
return null;
}
@Override
@ -83,17 +88,9 @@ public class TransientDoor extends ExitDoor
}
public void onPoweredBlockChange(World par1World, int par2, int par3, int par4, boolean par5)
{
}
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4)
{
return super.getCollisionBoundingBoxFromPool(par1World, 0, 0, 0);
}
public int idPicked(World par1World, int par2, int par3, int par4)
@ -107,12 +104,7 @@ public class TransientDoor extends ExitDoor
}
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
return false;
}
/**
* A function to open a door.

View file

@ -30,21 +30,22 @@ public class RenderDimDoor extends TileEntitySpecialRenderer
public void renderDimDoorTileEntity(TileEntityDimDoor tile, double x, double y, double z, float par8)
{
try
{
dimDoor.class.cast(Block.blocksList[mod_pocketDim.dimDoorID]).updateAttatchedTile(tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord).getFullMetadata(tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord);
{
dimDoor.class.cast(Block.blocksList[mod_pocketDim.dimDoorID]).updateAttatchedTile(tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord).getFullMetadata(tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord);
}
catch(Exception e)
{
e.printStackTrace();
}
}
catch(Exception e)
{
e.printStackTrace();
}
float playerX = (float)this.tileEntityRenderer.playerX;
float playerY = (float)this.tileEntityRenderer.playerY;
float playerZ = (float)this.tileEntityRenderer.playerZ;
// float playerX = (float)this.tileEntityRenderer.playerX;
// float playerY = (float)this.tileEntityRenderer.playerY;
// float playerZ = (float)this.tileEntityRenderer.playerZ;
float distance = (float) tile.getDistanceFrom(playerX, playerY, playerZ);
//float distance = (float) tile.getDistanceFrom(playerX, playerY, playerZ);
GL11.glDisable(GL11.GL_LIGHTING);
Random rand = new Random(31100L);
float var13 = 0.75F;
@ -156,6 +157,7 @@ public class RenderDimDoor extends TileEntitySpecialRenderer
Tessellator var24 = Tessellator.instance;
var24.startDrawingQuads();
@ -172,7 +174,7 @@ public class RenderDimDoor extends TileEntitySpecialRenderer
var24.setColorRGBA_F(var21 * var17, var22 * var17, var23 * var17, 1.0F);
if(tile.openOrClosed)
{
switch (tile.orientation)
{
case 0:
@ -268,6 +270,7 @@ public class RenderDimDoor extends TileEntitySpecialRenderer
{
if(mod_pocketDim.enableDoorOpenGL)
{
System.out.println("rendering");
this.renderDimDoorTileEntity((TileEntityDimDoor)par1TileEntity, par2, par4, par6, par8);
}
}