more stuffs

Lock render is still wip, as are most things. That said, I can render
monolith eyes anywhere now.
This commit is contained in:
StevenRS11 2014-05-20 19:13:26 -04:00
parent 8f9dfea947
commit ef860e295e
15 changed files with 439 additions and 258 deletions

View file

@ -1,15 +1,21 @@
package StevenDimDoors.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.config.DDProperties;
import StevenDimDoors.mod_pocketDim.core.DimLink;
import StevenDimDoors.mod_pocketDim.items.ItemDDKey;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import cpw.mods.fml.common.ICraftingHandler;
import cpw.mods.fml.common.registry.GameRegistry;
import static StevenDimDoors.mod_pocketDim.mod_pocketDim.*;
public class CraftingManager
public class CraftingManager implements ICraftingHandler
{
private CraftingManager() { }
CraftingManager() { }
public static void registerRecipes(DDProperties properties)
{
@ -86,6 +92,55 @@ public class CraftingManager
GameRegistry.addRecipe(new ItemStack(mod_pocketDim.itemGoldenDoor, 1),
"yy", "yy", "yy", 'y', Item.ingotGold);
}
if (properties.CraftingDDKeysAllowed)
{
GameRegistry.addRecipe(new ItemStack(mod_pocketDim.itemDDKey, 1),
" x ", " x ", "yzy", 'y', Item.ingotGold, 'x', Item.ingotIron, 'z', mod_pocketDim.itemStableFabric);
GameRegistry.addRecipe(new ItemStack(mod_pocketDim.itemDDKey, 1),
"z", "z", 'z', mod_pocketDim.itemDDKey);
}
}
@Override
public void onCrafting(EntityPlayer player, ItemStack item, IInventory craftMatrix)
{
if(item.getItem() instanceof ItemDDKey)
{
ItemDDKey keyItem = (ItemDDKey) item.getItem();
ItemStack topKey = null;
ItemStack bottomKey = null;
int topKeySlot = 0;
for(int i = 0; i<craftMatrix.getSizeInventory();i++)
{
ItemStack slot = craftMatrix.getStackInSlot(i);
if(slot!=null)
{
if(topKey==null)
{
topKey = slot;
topKeySlot = i;
}
else
{
bottomKey = slot;
break;
}
}
}
keyItem.addDoorToKey(topKey, bottomKey);
item.setTagCompound(bottomKey.getTagCompound());
player.inventory.addItemStackToInventory(topKey);
}
}
@Override
public void onSmelting(EntityPlayer player, ItemStack item)
{
// TODO Auto-generated method stub
}
}

View file

@ -22,7 +22,6 @@ import StevenDimDoors.mod_pocketDim.core.DDTeleporter;
import StevenDimDoors.mod_pocketDim.core.DimLink;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import StevenDimDoors.mod_pocketDim.items.ItemDDKey;
import StevenDimDoors.mod_pocketDim.items.ItemDDLockCreator;
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoor;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -331,10 +330,7 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, int neighborID)
{
if(this.hasLock(world, x, y, z))
{
return;
}
int metadata = world.getBlockMetadata(x, y, z);
if (isUpperDoorBlock(metadata))
{
@ -342,7 +338,6 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
{
world.setBlock(x, y, z, 0);
}
if (neighborID > 0 && neighborID != this.blockID)
{
this.onNeighborBlockChange(world, x, y - 1, z, neighborID);
@ -358,7 +353,7 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
this.dropBlockAsItem(world, x, y, z, metadata, 0);
}
}
else
else if(!this.hasLock(world, x, y, z))
{
boolean powered = world.isBlockIndirectlyGettingPowered(x, y, z) || world.isBlockIndirectlyGettingPowered(x, y + 1, z);
if ((powered || neighborID > 0 && Block.blocksList[neighborID].canProvidePower()) && neighborID != this.blockID)
@ -490,7 +485,6 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
return false;
}
DimLink link = getLink(world, x, y, z);
ItemStack itemStack;
for(ItemStack item : player.inventory.mainInventory)
{
@ -498,7 +492,7 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
{
if(item.getItem() instanceof ItemDDKey)
{
if(ItemDDKey.getBoundLink(item)==link)
if(((ItemDDKey) item.getItem()).canKeyOpen(link, item))
{
return true;
}

View file

@ -47,7 +47,6 @@ public class DDProperties
public final int WarpDoorItemID;
public final int WorldThreadItemID;
public final int DDKeyItemID;
public final int DDLockCreatorItemID;
/**
@ -77,6 +76,8 @@ public class DDProperties
public final boolean CraftingStableFabricAllowed;
public final boolean CraftingGoldenDimensionalDoorAllowed;
public final boolean CraftingGoldenDoorAllowed;
public final boolean CraftingDDKeysAllowed;
/**
* Loot Flags
@ -149,7 +150,8 @@ public class DDProperties
CraftingStableFabricAllowed = config.get(CATEGORY_CRAFTING, "Allow Crafting Stable Fabric", true).getBoolean(true);
CraftingGoldenDoorAllowed = config.get(CATEGORY_CRAFTING, "Allow Crafting Golden Door", true).getBoolean(true);
CraftingGoldenDimensionalDoorAllowed = config.get(CATEGORY_CRAFTING, "Allow Crafting Golden Dimensional Door", true).getBoolean(true);
CraftingDDKeysAllowed = config.get(CATEGORY_CRAFTING, "Allow Crafting Rift Keys", true).getBoolean(true);
WorldThreadRequirementLevel = config.get(CATEGORY_CRAFTING, "World Thread Requirement Level", 4,
"Controls the amount of World Thread needed to craft Stable Fabric. The number must be an " +
"integer from 1 to 4. The levels change the recipe to use 1, 2, 4, or 8 threads, respectively. The default level is 4.").getInt();
@ -207,7 +209,6 @@ public class DDProperties
GoldenDimensionalDoorItemID = config.getItem("Gold Dim Door Item ID", 5679).getInt();
WorldThreadItemID = config.getItem("World Thread Item ID", 5680).getInt();
DDKeyItemID = config.getItem("Rift Key Item ID", 5681).getInt();
DDLockCreatorItemID = config.getItem("Rift Interlock Item ID", 5682).getInt();
LimboBlockID = config.getTerrainBlock("World Generation Block IDs - must be less than 256", "Limbo Block ID", 217,
"Blocks used for the terrain in Limbo").getInt();

View file

@ -1,14 +1,22 @@
package StevenDimDoors.mod_pocketDim.items;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.blocks.IDimDoor;
import StevenDimDoors.mod_pocketDim.core.DimLink;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
@ -18,8 +26,17 @@ public class ItemDDKey extends Item
{
super(itemID);
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
this.setMaxStackSize(1);
}
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
boolean check = (this.isBound(par1ItemStack) ? par3List.add("Bound") : par3List.add("Unbound"));
return;
}
@Override
public void registerIcons(IconRegister par1IconRegister)
{
@ -30,44 +47,185 @@ public class ItemDDKey extends Item
@SideOnly(Side.CLIENT)
public boolean hasEffect(ItemStack par1ItemStack)
{
return true;
return !this.isBound(par1ItemStack);
}
public static void setBoundDoor(ItemStack itemStack, DimLink link)
public boolean onItemUseFirst(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int side, float playerX, float playerY,
float playerZ)
{
if(world.isRemote)
{
return false;
}
int blockID = world.getBlockId(x, y, z);
//make sure we are dealing with a door
if (!(Block.blocksList[blockID] instanceof IDimDoor))
{
return false;
}
DimLink link = PocketManager.getLink(x, y, z, world);
//dont do anything to doors without links
if (link == null)
{
return false;
}
//make sure we are not trying to mess with a door thats already locked by someone else
if(!this.canKeyOpen(link, itemStack)&&link.isLocked())
{
return false;
}
//see if we can bind this key to this door and lock it
if(setBoundDoor(itemStack, link))
{
link.setLocked(true);
return false;
}
//lastly, just see if we can toggle the door's lock state if its locked.
if(this.canKeyOpen(link, itemStack))
{
link.setLocked(!link.isLocked());
return false;
}
return false;
}
public boolean setBoundDoor(ItemStack itemStack, DimLink link)
{
//dont bind to a door if we already are bound, or if we dont have permission to lock that door
if(this.isBound(itemStack)|| (!this.canKeyOpen(link, itemStack)&&link.isLocked()))
{
return false;
}
//dont bind if the door has a lock already on it, but we can still open it. That would waste the key.
if(link.isLocked())
{
return false;
}
//init tags
if(!itemStack.hasTagCompound())
{
this.initNBTTags(itemStack);
}
//consume this keys ability to create a lock
itemStack.getTagCompound().setBoolean("HasLockedDoor", true);
//create the tag that binds this door to this key
NBTTagCompound tag = new NBTTagCompound();
int x = link.source().getX();
int y = link.source().getY();
int z = link.source().getZ();
tag.setInteger("linkX", x);
tag.setInteger("linkY", y);
tag.setInteger("linkZ", z);
tag.setInteger("linkDimID", link.source().getDimension());
tag.setInteger("x", x);
tag.setInteger("y", y);
tag.setInteger("z", z);
tag.setInteger("dim", link.source().getDimension());
itemStack.setTagCompound(tag);
itemStack.setItemDamage(1);
//add this door's tag to this keys keyring
NBTTagList keyRing = itemStack.getTagCompound().getTagList("DDKeys");
keyRing.appendTag(tag);
itemStack.getTagCompound().setTag("DDKeys", keyRing);
return true;
}
/**
* copies all the tags from the first key onto the second key
* @param givingKey
* @param receivingKey
*/
public void addDoorToKey(ItemStack givingKey, ItemStack receivingKey)
{
//cant copy tags from a key with no tags
if(!givingKey.hasTagCompound())
{
return;
}
//initialize the receiving key
if(!receivingKey.hasTagCompound())
{
this.initNBTTags(receivingKey);
}
//get the tags
NBTTagCompound recevingTags = receivingKey.getTagCompound();
NBTTagCompound sendingTags = (NBTTagCompound) givingKey.getTagCompound().copy();
//copy over the actual tags
for(int i = 0; i<sendingTags.getTagList("DDKeys").tagCount();i++)
{
recevingTags.getTagList("DDKeys").appendTag(sendingTags.getTagList("DDKeys").tagAt(i));
}
}
public static DimLink getBoundLink(ItemStack itemStack)
/**
* see if we could unlock this door if it where locked.
* @param link
* @param itemStack
* @return
*/
public boolean canKeyOpen(DimLink link, ItemStack itemStack)
{
//make sure we have a tag
if (itemStack.hasTagCompound())
{
NBTTagCompound tag = itemStack.getTagCompound();
Integer x = tag.getInteger("linkX");
Integer y = tag.getInteger("linkY");
Integer z = tag.getInteger("linkZ");
Integer dimID = tag.getInteger("linkDimID");
if (x != null && y != null && z != null && dimID != null)
NBTTagList tags = itemStack.getTagCompound().getTagList("DDKeys");
for(int i = 0; i < tags.tagCount(); i++)
{
return PocketManager.getLink(x, y, z, dimID);
NBTTagCompound tag = (NBTTagCompound) tags.tagAt(i);
Integer x = tag.getInteger("x");
Integer y = tag.getInteger("y");
Integer z = tag.getInteger("z");
Integer dimID = tag.getInteger("dim");
if (x != null && y != null && z != null && dimID != null)
{
if (x == link.source().getX() &&
y == link.source().getY() &&
z == link.source().getZ() &&
dimID == link.source().getDimension())
{
return true;
}
}
}
}
return null;
return false;
}
public String getItemStackDisplayName(ItemStack par1ItemStack)
{
return StatCollector.translateToLocal(this.getUnlocalizedName(par1ItemStack) + ".name");
}
public boolean isBound(ItemStack item)
{
if(item.hasTagCompound())
{
if(item.getTagCompound().getBoolean("HasLockedDoor"))
{
return true;
}
}
return false;
}
public void initNBTTags(ItemStack itemStack)
{
itemStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tag = itemStack.getTagCompound();
tag.setTag("DDKeys", new NBTTagList());
itemStack.setTagCompound(tag);
}
}

View file

@ -1,111 +0,0 @@
package StevenDimDoors.mod_pocketDim.items;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.blocks.IDimDoor;
import StevenDimDoors.mod_pocketDim.core.DimLink;
import StevenDimDoors.mod_pocketDim.core.NewDimData;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import StevenDimDoors.mod_pocketDim.items.ItemRiftSignature.Point4DOrientation;
public class ItemDDLockCreator extends Item
{
public ItemDDLockCreator(int itemID)
{
super(itemID);
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
}
@Override
public void registerIcons(IconRegister par1IconRegister)
{
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", ""));
}
@Override
@SideOnly(Side.CLIENT)
public boolean hasEffect(ItemStack itemStack)
{
return itemStack.hasTagCompound();
}
public boolean onItemUseFirst(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int side, float playerX, float playerY, float playerZ)
{
int blockID = world.getBlockId(x, y, z);
if(!(Block.blocksList[blockID] instanceof IDimDoor))
{
return false;
}
DimLink link = PocketManager.getLink(x, y, z, world);
if(link==null)
{
return false;
}
if(itemStack.hasTagCompound())
{
if(link == getBoundLink(itemStack))
{
link.setLocked(!link.isLocked());
return true;
}
return false;
}
setBoundDoor(itemStack,link);
link.setLocked(true);
return true;
}
public static void setBoundDoor(ItemStack itemStack, DimLink link)
{
NBTTagCompound tag = new NBTTagCompound();
int x = link.source().getX();
int y = link.source().getY();
int z = link.source().getZ();
tag.setInteger("linkX", x);
tag.setInteger("linkY", y);
tag.setInteger("linkZ", z);
tag.setInteger("linkDimID", link.source().getDimension());
itemStack.setTagCompound(tag);
itemStack.setItemDamage(1);
}
public DimLink getBoundLink(ItemStack itemStack)
{
if (itemStack.hasTagCompound())
{
NBTTagCompound tag = itemStack.getTagCompound();
Integer x = tag.getInteger("linkX");
Integer y = tag.getInteger("linkY");
Integer z = tag.getInteger("linkZ");
Integer dimID = tag.getInteger("linkDimID");
if (x != null && y != null && z != null && dimID != null)
{
return PocketManager.getLink(x, y, z, dimID);
}
}
return null;
}
public String getItemStackDisplayName(ItemStack par1ItemStack)
{
return StatCollector.translateToLocal(this.getUnlocalizedName(par1ItemStack) + ".name");
}
}

View file

@ -43,7 +43,6 @@ import StevenDimDoors.mod_pocketDim.helpers.ChunkLoaderHelper;
import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper;
import StevenDimDoors.mod_pocketDim.items.ItemBlockDimWall;
import StevenDimDoors.mod_pocketDim.items.ItemDDKey;
import StevenDimDoors.mod_pocketDim.items.ItemDDLockCreator;
import StevenDimDoors.mod_pocketDim.items.ItemDimensionalDoor;
import StevenDimDoors.mod_pocketDim.items.ItemGoldDimDoor;
import StevenDimDoors.mod_pocketDim.items.ItemGoldDoor;
@ -139,7 +138,6 @@ public class mod_pocketDim
public static Item itemUnstableDoor;
public static Item itemStabilizedLinkSignature;
public static Item itemDDKey;
public static Item itemDDLockCreator;
public static BiomeGenBase limboBiome;
public static BiomeGenBase pocketBiome;
@ -214,7 +212,6 @@ public class mod_pocketDim
transTrapdoor = (TransTrapdoor) (new TransTrapdoor(properties.TransTrapdoorID, Material.wood).setHardness(1.0F) .setUnlocalizedName("dimHatch"));
itemDDKey = (new ItemDDKey(properties.DDKeyItemID)).setUnlocalizedName("itemDDKey");
itemDDLockCreator = (new ItemDDLockCreator(properties.DDLockCreatorItemID)).setUnlocalizedName("itemDDLockCreator");
itemGoldenDoor = (new ItemGoldDoor(properties.GoldenDoorItemID, Material.wood)).setUnlocalizedName("itemGoldDoor");
itemGoldenDimensionalDoor = (new ItemGoldDimDoor(properties.GoldenDimensionalDoorItemID, Material.iron, (ItemDoor)this.itemGoldenDoor)).setUnlocalizedName("itemGoldDimDoor");
itemDimensionalDoor = (ItemDimensionalDoor) (new ItemDimensionalDoor(properties.DimensionalDoorItemID, Material.iron, (ItemDoor)Item.doorIron)).setUnlocalizedName("itemDimDoor");
@ -278,8 +275,7 @@ public class mod_pocketDim
LanguageRegistry.addName(itemDimensionalDoor, "Dimensional Door");
LanguageRegistry.addName(itemRiftBlade, "Rift Blade");
LanguageRegistry.addName(itemWorldThread, "World Thread");
LanguageRegistry.addName(itemDDKey, "Unbound Rift Key");
LanguageRegistry.addName(itemDDLockCreator, "Unbound Rift Interlock");
LanguageRegistry.addName(itemDDKey, "Rift Key");
/**
* Add names for multiblock inventory item
@ -300,6 +296,7 @@ public class mod_pocketDim
LanguageRegistry.instance().addStringLocalization("entity.DimDoors.Obelisk.name", "Monolith");
CraftingManager.registerRecipes(properties);
GameRegistry.registerCraftingHandler(new CraftingManager());
DungeonHelper.initialize();
gatewayGenerator = new GatewayGenerator(properties);
GameRegistry.registerWorldGenerator(mod_pocketDim.gatewayGenerator);

View file

@ -1,6 +0,0 @@
package StevenDimDoors.mod_pocketDim.world;
public interface ILockable
{
}

View file

@ -1,16 +1,41 @@
package StevenDimDoors.mod_pocketDimClient;
import static org.lwjgl.opengl.GL11.GL_LIGHTING;
import static org.lwjgl.opengl.GL11.GL_ONE_MINUS_DST_COLOR;
import static org.lwjgl.opengl.GL11.GL_TEXTURE_2D;
import static org.lwjgl.opengl.GL11.GL_ZERO;
import static org.lwjgl.opengl.GL11.glBlendFunc;
import java.nio.FloatBuffer;
import java.util.Iterator;
import java.util.Random;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import net.minecraft.block.material.MapColor;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ActiveRenderInfo;
import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureCompass;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.item.EntityItemFrame;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.storage.MapCoord;
import net.minecraft.world.storage.MapData;
import static org.lwjgl.opengl.GL11.*;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.config.DDProperties;
import StevenDimDoors.mod_pocketDim.core.DimLink;
@ -24,8 +49,12 @@ import cpw.mods.fml.relauncher.SideOnly;
public class RenderDimDoor extends TileEntitySpecialRenderer
{
private FloatBuffer buffer = GLAllocation.createDirectFloatBuffer(16);
private ResourceLocation riftPath= new ResourceLocation(mod_pocketDim.modid + ":textures/other/RIFT.png");
private ResourceLocation warpPath= new ResourceLocation(mod_pocketDim.modid + ":textures/other/WARP.png");
private ResourceLocation keyPath= new ResourceLocation(mod_pocketDim.modid + ":textures/other/Keyhole.png");
private ResourceLocation KeyholeLight= new ResourceLocation(mod_pocketDim.modid + ":textures/other/KeyholeLight.png");
private ResourceLocation keyOutline= new ResourceLocation(mod_pocketDim.modid + ":textures/other/keyOutline.png");
private ResourceLocation keyOutlineLight= new ResourceLocation(mod_pocketDim.modid + ":textures/other/keyOutlineLight.png");
private static final int NETHER_DIMENSION_ID = -1;
private static DDProperties properties = null;
@ -43,19 +72,14 @@ public class RenderDimDoor extends TileEntitySpecialRenderer
double y, double z)
{
// 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);
GL11.glDisable(GL11.GL_LIGHTING);
Random rand = new Random(31100L);
float var13 = 0.75F;
for (int count = 0; count < 16; ++count)
{
GL11.glPushMatrix();
float var15 = 16 - count;
float var16 = 0.2625F;
@ -63,7 +87,7 @@ public class RenderDimDoor extends TileEntitySpecialRenderer
if (count == 0)
{
this.bindTexture(riftPath);
this.bindTexture(warpPath);
// move files into assets/modid and change to new ResourceLocation(modid:/RIFT.png)
var17 = 0.1F;
var15 = 25.0F;
@ -80,92 +104,80 @@ public class RenderDimDoor extends TileEntitySpecialRenderer
GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
var16 = .5F;
}
/**
* float startY = (float)(+(y + (double)var13)); float ratioY =
* startY + ActiveRenderInfo.objectY; float ratioY2 = startY + var15
* + ActiveRenderInfo.objectY; float yConverted = ratioY / ratioY2;
*
* float startZ = (float)(+(z + (double)var13)); float ratioZ =
* startZ + ActiveRenderInfo.objectZ; float ratioZ2 = startZ + var15
* + ActiveRenderInfo.objectZ; float zConverted = ratioZ / ratioZ2;
*
* float startX = (float)(+(x + (double)var13)); float ratioX =
* startX + ActiveRenderInfo.objectX; float ratioX2 = startX + var15
* + ActiveRenderInfo.objectX; float xConverted = ratioX / ratioX2;
*
* yConverted += (float)(y + (double)var13); xConverted += (float)(x
* + (double)var13); zConverted += (float)(z + (double)var13);
**/
GL11.glTranslatef(
Minecraft.getSystemTime() % 200000L / 200000.0F,
0, 0.0F);
GL11.glTranslatef(0,
Minecraft.getSystemTime() % 200000L / 200000.0F,
0.0F);
GL11.glTranslatef(0, 0,
Minecraft.getSystemTime() % 200000L / 200000.0F);
GL11.glTexGeni(GL11.GL_S, GL11.GL_TEXTURE_GEN_MODE,
GL11.GL_OBJECT_LINEAR);
GL11.glTexGeni(GL11.GL_T, GL11.GL_TEXTURE_GEN_MODE,
GL11.GL_OBJECT_LINEAR);
GL11.glTexGeni(GL11.GL_R, GL11.GL_TEXTURE_GEN_MODE,
GL11.GL_OBJECT_LINEAR);
GL11.glTexGeni(GL11.GL_Q, GL11.GL_TEXTURE_GEN_MODE,
GL11.GL_OBJECT_LINEAR);
switch ((tile.orientation % 4) + 4)
{
case 4:
GL11.glTexGen(GL11.GL_S, GL11.GL_OBJECT_PLANE,
this.getFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F));
GL11.glTexGen(GL11.GL_T, GL11.GL_OBJECT_PLANE,
this.getFloatBuffer(0.0F, 0.0F, 1.0F, 0.0F));
GL11.glTexGen(GL11.GL_R, GL11.GL_OBJECT_PLANE,
this.getFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F));
GL11.glTexGen(GL11.GL_Q, GL11.GL_OBJECT_PLANE,
this.getFloatBuffer(1.0F, 0.0F, 0.0F, 0.15F));
break;
case 5:
GL11.glTexGen(GL11.GL_S, GL11.GL_OBJECT_PLANE,
this.getFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F));
GL11.glTexGen(GL11.GL_T, GL11.GL_OBJECT_PLANE,
this.getFloatBuffer(1.0F, 0.0F, 0.0F, 0.0F));
GL11.glTexGen(GL11.GL_R, GL11.GL_OBJECT_PLANE,
this.getFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F));
GL11.glTexGen(GL11.GL_Q, GL11.GL_OBJECT_PLANE,
this.getFloatBuffer(0.0F, 0.0F, 1.0F, 0.15F));
break;
case 6:
GL11.glTexGen(GL11.GL_S, GL11.GL_OBJECT_PLANE,
this.getFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F));
GL11.glTexGen(GL11.GL_T, GL11.GL_OBJECT_PLANE,
this.getFloatBuffer(0.0F, 0.0F, 1.0F, 0.0F));
GL11.glTexGen(GL11.GL_R, GL11.GL_OBJECT_PLANE,
this.getFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F));
GL11.glTexGen(GL11.GL_Q, GL11.GL_OBJECT_PLANE,
this.getFloatBuffer(1.0F, 0.0F, 0.0F, -0.15F));
break;
case 7:
GL11.glTexGen(GL11.GL_S, GL11.GL_OBJECT_PLANE,
this.getFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F));
GL11.glTexGen(GL11.GL_T, GL11.GL_OBJECT_PLANE,
this.getFloatBuffer(1.0F, 0.0F, 0.0F, 0.0F));
GL11.glTexGen(GL11.GL_R, GL11.GL_OBJECT_PLANE,
this.getFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F));
GL11.glTexGen(GL11.GL_Q, GL11.GL_OBJECT_PLANE,
this.getFloatBuffer(0.0F, 0.0F, 1.0F, -0.15F));
break;
}
GL11.glEnable(GL11.GL_TEXTURE_GEN_S);
GL11.glEnable(GL11.GL_TEXTURE_GEN_T);
GL11.glEnable(GL11.GL_TEXTURE_GEN_R);
GL11.glEnable(GL11.GL_TEXTURE_GEN_Q);
GL11.glTranslatef(
Minecraft.getSystemTime() % 200000L / 200000.0F,
0, 0.0F);
GL11.glTranslatef(0,
Minecraft.getSystemTime() % 200000L / 200000.0F,
0.0F);
GL11.glTranslatef(0, 0,
Minecraft.getSystemTime() % 200000L / 200000.0F);
GL11.glTexGeni(GL11.GL_S, GL11.GL_TEXTURE_GEN_MODE,
GL11.GL_OBJECT_LINEAR);
GL11.glTexGeni(GL11.GL_T, GL11.GL_TEXTURE_GEN_MODE,
GL11.GL_OBJECT_LINEAR);
GL11.glTexGeni(GL11.GL_R, GL11.GL_TEXTURE_GEN_MODE,
GL11.GL_OBJECT_LINEAR);
GL11.glTexGeni(GL11.GL_Q, GL11.GL_TEXTURE_GEN_MODE,
GL11.GL_OBJECT_LINEAR);
switch ((tile.orientation % 4) + 4)
{
case 4:
GL11.glTexGen(GL11.GL_S, GL11.GL_OBJECT_PLANE,
this.getFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F));
GL11.glTexGen(GL11.GL_T, GL11.GL_OBJECT_PLANE,
this.getFloatBuffer(0.0F, 0.0F, 1.0F, 0.0F));
GL11.glTexGen(GL11.GL_R, GL11.GL_OBJECT_PLANE,
this.getFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F));
GL11.glTexGen(GL11.GL_Q, GL11.GL_OBJECT_PLANE,
this.getFloatBuffer(1.0F, 0.0F, 0.0F, 0.15F));
break;
case 5:
GL11.glTexGen(GL11.GL_S, GL11.GL_OBJECT_PLANE,
this.getFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F));
GL11.glTexGen(GL11.GL_T, GL11.GL_OBJECT_PLANE,
this.getFloatBuffer(1.0F, 0.0F, 0.0F, 0.0F));
GL11.glTexGen(GL11.GL_R, GL11.GL_OBJECT_PLANE,
this.getFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F));
GL11.glTexGen(GL11.GL_Q, GL11.GL_OBJECT_PLANE,
this.getFloatBuffer(0.0F, 0.0F, 1.0F, 0.15F));
break;
case 6:
GL11.glTexGen(GL11.GL_S, GL11.GL_OBJECT_PLANE,
this.getFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F));
GL11.glTexGen(GL11.GL_T, GL11.GL_OBJECT_PLANE,
this.getFloatBuffer(0.0F, 0.0F, 1.0F, 0.0F));
GL11.glTexGen(GL11.GL_R, GL11.GL_OBJECT_PLANE,
this.getFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F));
GL11.glTexGen(GL11.GL_Q, GL11.GL_OBJECT_PLANE,
this.getFloatBuffer(1.0F, 0.0F, 0.0F, -0.15F));
break;
case 7:
GL11.glTexGen(GL11.GL_S, GL11.GL_OBJECT_PLANE,
this.getFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F));
GL11.glTexGen(GL11.GL_T, GL11.GL_OBJECT_PLANE,
this.getFloatBuffer(1.0F, 0.0F, 0.0F, 0.0F));
GL11.glTexGen(GL11.GL_R, GL11.GL_OBJECT_PLANE,
this.getFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F));
GL11.glTexGen(GL11.GL_Q, GL11.GL_OBJECT_PLANE,
this.getFloatBuffer(0.0F, 0.0F, 1.0F, -0.15F));
break;
}
GL11.glEnable(GL11.GL_TEXTURE_GEN_S);
GL11.glEnable(GL11.GL_TEXTURE_GEN_T);
GL11.glEnable(GL11.GL_TEXTURE_GEN_R);
GL11.glEnable(GL11.GL_TEXTURE_GEN_Q);
GL11.glPopMatrix();
GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glPushMatrix();
@ -259,7 +271,82 @@ public class RenderDimDoor extends TileEntitySpecialRenderer
buffer.flip();
return buffer;
}
private void renderKeyHole(TileEntityDimDoor tile, double x,
double y, double z, int i)
{
if(tile.orientation>3)
{
return;
}
int rotation = (tile.orientation+3)%4;
GL11.glPushMatrix();
GL11.glTranslated(x,y,z);
x= ActiveRenderInfo.objectX;
y = ActiveRenderInfo.objectY;
z = ActiveRenderInfo.objectZ;
GL11.glRotatef(180.0F - 90*rotation, 0.0F, 1.0F, 0.0F);
//GL11.glRotatef((float)(-90 * rotation), 0.0F, 0.0F, 1.0F);
switch (rotation)
{
case 0:
GL11.glTranslatef(-0.5F, .24F, -0.03F);
break;
case 1:
GL11.glTranslatef(-.5F, .24F, .97F);
break;
case 2:
GL11.glTranslatef(.5F, .24F, .97F);
break;
case 3:
GL11.glTranslatef(0.5F, .24F, -0.03F);
}
GL11.glDisable(GL_LIGHTING);
Tessellator tessellator = Tessellator.instance;
GL11.glEnable(GL11.GL_BLEND);
if(i==1)
{
bindTexture(KeyholeLight);
GL11.glColor4d(1, 1, 1, .6);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_DST_COLOR);
}
else
{
bindTexture(keyPath);
GL11.glColor4d(.0, .7, .1, 1);
glBlendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA);
}
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
GL11.glScalef(0.00860625F, 0.00730625F, 0.0086625F);
GL11.glTranslatef(-65.0F, -107.0F, -3.0F);
GL11.glNormal3f(0.0F, 0.0F, -1.0F);
tessellator.startDrawingQuads();
byte b0 = 7;
tessellator.addVertexWithUV((double)(0 - b0), (double)(128 + b0), 0.0D, 0.0D, 1.0D);
tessellator.addVertexWithUV((double)(128 + b0), (double)(128 + b0), 0.0D, 1.0D, 1.0D);
tessellator.addVertexWithUV((double)(128 + b0), (double)(0 - b0), 0.0D, 1.0D, 0.0D);
tessellator.addVertexWithUV((double)(0 - b0), (double)(0 - b0), 0.0D, 0.0D, 0.0D);
tessellator.draw();
GL11.glTranslatef(0.0F, 0.0F, -1.0F);
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
@Override
public void renderTileEntityAt(TileEntity par1TileEntity, double par2, double par4, double par6, float par8)
{
@ -279,7 +366,13 @@ public class RenderDimDoor extends TileEntitySpecialRenderer
if (tile.openOrClosed)
{
renderDimDoorTileEntity((TileEntityDimDoor) par1TileEntity, par2, par4, par6);
for(int i = 0; i<2; i++ )
{
this.renderKeyHole(tile, par2, par4, par6, i);
}
}
}
}
}

View file

@ -39,7 +39,7 @@ public class RenderRift extends TileEntitySpecialRenderer
GL11.glColor4f(.2F, .2F, .2F, 1F);
GL11.glEnable(GL_BLEND);
glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ZERO);
glBlendFunc(GL11.GL_SRC_ALPHA_SATURATE,GL_ONE_MINUS_DST_COLOR);
/**
* just draws the verticies

Binary file not shown.

Before

Width:  |  Height:  |  Size: 345 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 471 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB