personal pockets DONE

This commit is contained in:
StevenRS11 2014-05-26 19:38:01 -04:00
parent d8fecd07b3
commit 16d7bfcda6
31 changed files with 794 additions and 54 deletions

View file

@ -1,18 +1,24 @@
package StevenDimDoors.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.config.DDProperties;
import StevenDimDoors.mod_pocketDim.core.DDLock;
import StevenDimDoors.mod_pocketDim.core.DimLink;
import StevenDimDoors.mod_pocketDim.items.ItemDDKey;
import static StevenDimDoors.mod_pocketDim.mod_pocketDim.itemDimensionalDoor;
import static StevenDimDoors.mod_pocketDim.mod_pocketDim.itemRiftBlade;
import static StevenDimDoors.mod_pocketDim.mod_pocketDim.itemRiftRemover;
import static StevenDimDoors.mod_pocketDim.mod_pocketDim.itemRiftSignature;
import static StevenDimDoors.mod_pocketDim.mod_pocketDim.itemStableFabric;
import static StevenDimDoors.mod_pocketDim.mod_pocketDim.itemUnstableDoor;
import static StevenDimDoors.mod_pocketDim.mod_pocketDim.itemWarpDoor;
import static StevenDimDoors.mod_pocketDim.mod_pocketDim.transTrapdoor;
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 net.minecraftforge.oredict.ShapedOreRecipe;
import StevenDimDoors.mod_pocketDim.config.DDProperties;
import StevenDimDoors.mod_pocketDim.core.DDLock;
import StevenDimDoors.mod_pocketDim.items.ItemDDKey;
import cpw.mods.fml.common.ICraftingHandler;
import cpw.mods.fml.common.registry.GameRegistry;
import static StevenDimDoors.mod_pocketDim.mod_pocketDim.*;
public class CraftingManager implements ICraftingHandler
{
@ -92,6 +98,18 @@ public class CraftingManager implements ICraftingHandler
{
GameRegistry.addRecipe(new ItemStack(mod_pocketDim.itemGoldenDoor, 1),
"yy", "yy", "yy", 'y', Item.ingotGold);
}
if (properties.CraftingPersonalDimDoorAllowed)
{
GameRegistry.addRecipe(new ItemStack(mod_pocketDim.itemPersonalDoor,1),
"yxy", 'y', mod_pocketDim.itemGoldenDoor, 'x', mod_pocketDim.itemStableFabric);
}
if (properties.CraftingQuartzDoorAllowed)
{
GameRegistry.addRecipe(new ShapedOreRecipe(mod_pocketDim.itemQuartzDoor, new Object[]{
"yy", "yy", "yy", Character.valueOf('y'), "oreQuartz"}));
}
if (properties.CraftingDDKeysAllowed)
{

View file

@ -14,8 +14,10 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDimClient.PrivatePocketRender;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -23,7 +25,7 @@ public class BlockDimWall extends Block
{
private static final float SUPER_HIGH_HARDNESS = 10000000000000F;
private static final float SUPER_EXPLOSION_RESISTANCE = 18000000F;
private Icon[] blockIcon = new Icon[2];
private Icon[] blockIcon = new Icon[3];
public BlockDimWall(int blockID, int j, Material par2Material)
{
@ -34,7 +36,7 @@ public class BlockDimWall extends Block
@Override
public float getBlockHardness(World world, int x, int y, int z)
{
if (world.getBlockMetadata(x, y, z) == 0)
if (world.getBlockMetadata(x, y, z) != 1)
{
return this.blockHardness;
}
@ -47,7 +49,7 @@ public class BlockDimWall extends Block
@Override
public float getExplosionResistance(Entity entity, World world, int x, int y, int z, double explosionX, double explosionY, double explosionZ)
{
if (world.getBlockMetadata(x, y, z) == 0)
if (world.getBlockMetadata(x, y, z) != 1)
{
return super.getExplosionResistance(entity, world, x, y, z, explosionX, explosionY, explosionZ);
}
@ -57,25 +59,41 @@ public class BlockDimWall extends Block
}
}
public int getRenderType()
{
return PrivatePocketRender.renderID;
}
@Override
public void registerIcons(IconRegister par1IconRegister)
{
this.blockIcon[0] = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName());
this.blockIcon[1] = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName() + "Perm");
this.blockIcon[2] = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName() + "Personal");
}
@SideOnly(Side.CLIENT)
@Override
public Icon getIcon(int par1, int par2)
{
return (par2 != 1) ? blockIcon[0] : blockIcon[1];
switch(par2)
{
case 0:
return blockIcon[0];
case 1:
return blockIcon[1];
case 2:
return blockIcon[2];
default:
return blockIcon[0];
}
}
@Override
public int damageDropped(int metadata)
{
//Return 0 to avoid dropping Ancient Fabric even if the player somehow manages to break it
return 0;
return metadata == 1 ? 0 : 2;
}
@Override
@ -83,7 +101,7 @@ public class BlockDimWall extends Block
@SideOnly(Side.CLIENT)
public void getSubBlocks(int unknown, CreativeTabs tab, List subItems)
{
for (int ix = 0; ix < 2; ix++)
for (int ix = 0; ix < 3; ix++)
{
subItems.add(new ItemStack(this, 1, ix));
}
@ -110,7 +128,7 @@ public class BlockDimWall extends Block
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9)
{
//Check if the metadata value is 0 -- we don't want the user to replace Ancient Fabric
if (entityPlayer.getCurrentEquippedItem() != null && world.getBlockMetadata(x, y, z) == 0)
if (entityPlayer.getCurrentEquippedItem() != null && world.getBlockMetadata(x, y, z) != 1)
{
Item playerEquip = entityPlayer.getCurrentEquippedItem().getItem();

View file

@ -33,8 +33,4 @@ public class BlockDoorGold extends BlockDoor
{
return (par1 & 8) != 0 ? 0 : mod_pocketDim.itemGoldenDoor.itemID;
}
}

View file

@ -0,0 +1,28 @@
package StevenDimDoors.mod_pocketDim.blocks;
import java.util.Random;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.BlockDoor;
import net.minecraft.block.material.Material;
public class BlockDoorQuartz extends BlockDoor
{
public BlockDoorQuartz(int par1, Material par2Material)
{
super(par1, par2Material);
}
@SideOnly(Side.CLIENT)
protected String getTextureName()
{
return mod_pocketDim.modid + ":" + this.getUnlocalizedName();
}
@Override
public int idDropped(int par1, Random par2Random, int par3)
{
return (par1 & 8) != 0 ? 0 : mod_pocketDim.itemGoldenDoor.itemID;
}
}

View file

@ -65,6 +65,7 @@ public class BlockRift extends Block implements ITileEntityProvider
this.blocksImmuneToRift.add(properties.TransientDoorID);
this.blocksImmuneToRift.add(properties.GoldenDimensionalDoorID);
this.blocksImmuneToRift.add(properties.GoldenDoorID);
this.blocksImmuneToRift.add(properties.PersonalDimDoorID);
this.blocksImmuneToRift.add(Block.blockLapis.blockID);
this.blocksImmuneToRift.add(Block.blockIron.blockID);

View file

@ -0,0 +1,41 @@
package StevenDimDoors.mod_pocketDim.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.config.DDProperties;
import StevenDimDoors.mod_pocketDim.core.DimLink;
import StevenDimDoors.mod_pocketDim.core.LinkTypes;
import StevenDimDoors.mod_pocketDim.core.NewDimData;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
public class PersonalDimDoor extends BaseDimDoor
{
public PersonalDimDoor(int blockID, Material material, DDProperties properties)
{
super(blockID, material, properties);
// TODO Auto-generated constructor stub
}
@Override
public void placeLink(World world, int x, int y, int z)
{
if (!world.isRemote && world.getBlockId(x, y - 1, z) == this.blockID)
{
NewDimData dimension = PocketManager.getDimensionData(world);
DimLink link = dimension.getLink(x, y, z);
if (link == null)
{
dimension.createLink(x, y, z, LinkTypes.PERSONAL, world.getBlockMetadata(x, y - 1, z));
}
}
}
@Override
public int getDrops()
{
// TODO Auto-generated method stub
return 0;
}
}

View file

@ -23,6 +23,9 @@ public class DDProperties
public final int TransientDoorID;
public final int FabricBlockID;
public final int RiftBlockID;
public final int QuartzDoorID;
public final int PersonalDimDoorID;
/**
* World Generation Block IDs
@ -47,7 +50,8 @@ public class DDProperties
public final int WarpDoorItemID;
public final int WorldThreadItemID;
public final int DDKeyItemID;
public final int ItemQuartzDoorID;
public final int ItemPersonalDimDoorID;
/**
* Other IDs
@ -58,6 +62,7 @@ public class DDProperties
public final int LimboDimensionID;
public final int LimboProviderID;
public final int PocketProviderID;
public final int PersonalPocketProviderID;
public final int DoorRenderEntityID;
public final int MonolithEntityID;
@ -77,7 +82,8 @@ public class DDProperties
public final boolean CraftingGoldenDimensionalDoorAllowed;
public final boolean CraftingGoldenDoorAllowed;
public final boolean CraftingDDKeysAllowed;
public final boolean CraftingQuartzDoorAllowed;
public final boolean CraftingPersonalDimDoorAllowed;
/**
* Loot Flags
@ -151,6 +157,8 @@ public class DDProperties
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);
CraftingQuartzDoorAllowed = config.get(CATEGORY_CRAFTING, "Allow Crafting Quartz Doors", true).getBoolean(true);
CraftingPersonalDimDoorAllowed = config.get(CATEGORY_CRAFTING, "Allow Crafting Personal Dim Doors", 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 " +
@ -196,6 +204,8 @@ public class DDProperties
TransientDoorID = config.getBlock("Transient Door Block ID", 1979).getInt();
GoldenDoorID = config.getBlock("Gold Door Block ID", 1980).getInt();
GoldenDimensionalDoorID = config.getBlock("Gold Dim Door Block ID", 1981).getInt();
QuartzDoorID = config.getBlock("Quartz Door Block ID", 1982).getInt();
PersonalDimDoorID = config.getBlock("Personal Dim Door ID", 1983).getInt();
WarpDoorItemID = config.getItem("Warp Door Item ID", 5670).getInt();
RiftRemoverItemID = config.getItem("Rift Remover Item ID", 5671).getInt();
@ -209,6 +219,8 @@ 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();
ItemQuartzDoorID = config.getItem("Quartz Door Item ID", 5681).getInt();
ItemPersonalDimDoorID = config.getItem("Personal Dim Door ID", 5681).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();
@ -218,6 +230,7 @@ public class DDProperties
LimboDimensionID = config.get(CATEGORY_DIMENSION, "Limbo Dimension ID", -23).getInt();
PocketProviderID = config.get(CATEGORY_PROVIDER, "Pocket Provider ID", 124).getInt();
LimboProviderID = config.get(CATEGORY_PROVIDER, "Limbo Provider ID", 113).getInt();
PersonalPocketProviderID = config.get(CATEGORY_PROVIDER, "Personal Pocket Provider ID", 125).getInt();
MonolithTeleportationEnabled = config.get(Configuration.CATEGORY_GENERAL, "Enable Monolith Teleportation", true,
"Sets whether Monoliths can teleport players").getBoolean(true);

View file

@ -23,6 +23,7 @@ import net.minecraftforge.common.DimensionManager;
import StevenDimDoors.mod_pocketDim.Point3D;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.blocks.BaseDimDoor;
import StevenDimDoors.mod_pocketDim.blocks.IDimDoor;
import StevenDimDoors.mod_pocketDim.config.DDProperties;
import StevenDimDoors.mod_pocketDim.helpers.yCoordHelper;
import StevenDimDoors.mod_pocketDim.items.ItemDimensionalDoor;
@ -251,15 +252,14 @@ public class DDTeleporter
}
//Check if the block below that point is actually a door
int blockID = world.getBlockId(door.getX(), door.getY() - 1, door.getZ());
if (blockID != properties.DimensionalDoorID && blockID != properties.WarpDoorID &&
blockID != properties.TransientDoorID && blockID != properties.UnstableDoorID
&& blockID != properties.GoldenDimensionalDoorID)
Block block = Block.blocksList[world.getBlockId(door.getX(), door.getY() - 1, door.getZ())];
if (block==null || !(block instanceof IDimDoor))
{
//Return the pocket's orientation instead
return PocketManager.getDimensionData(door.getDimension()).orientation();
}
//Return the orientation portion of its metadata
return world.getBlockMetadata(door.getX(), door.getY() - 1, door.getZ()) & 3;
}
@ -458,7 +458,7 @@ public class DDTeleporter
return;
}
if (!initializeDestination(link, DDProperties.instance(),door))
if (!initializeDestination(link, DDProperties.instance(),entity,door))
{
return;
}
@ -471,7 +471,7 @@ public class DDTeleporter
entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, "mob.endermen.portal", 1.0F, 1.0F);
}
}
else
else
{
buildExitDoor(door, link, DDProperties.instance());
entity = teleportEntity(entity, link.destination(), link.linkType() != LinkTypes.UNSAFE_EXIT);
@ -479,9 +479,9 @@ public class DDTeleporter
}
}
private static boolean initializeDestination(DimLink link, DDProperties properties, Block door)
private static boolean initializeDestination(DimLink link, DDProperties properties, Entity entity, Block door)
{
if (link.hasDestination())
if (link.hasDestination()&&link.linkType()!=LinkTypes.PERSONAL)
{
if(PocketManager.isBlackListed(link.destination().getDimension()))
{
@ -500,6 +500,8 @@ public class DDTeleporter
return PocketBuilder.generateNewDungeonPocket(link, properties);
case LinkTypes.POCKET:
return PocketBuilder.generateNewPocket(link, properties,door);
case LinkTypes.PERSONAL:
return setupPersonalLink(link, properties, entity, door);
case LinkTypes.SAFE_EXIT:
return generateSafeExit(link, properties);
case LinkTypes.DUNGEON_EXIT:
@ -514,6 +516,29 @@ public class DDTeleporter
throw new IllegalArgumentException("link has an unrecognized link type.");
}
}
private static boolean setupPersonalLink(DimLink link, DDProperties properties,Entity player, Block door)
{
if(!(player instanceof EntityPlayer))
{
return false;
}
NewDimData dim = PocketManager.getPersonalDimensionForPlayer(player.getEntityName());
if(dim == null)
{
return PocketBuilder.generateNewPersonalPocket(link, properties, player, door);
}
DimLink personalHomeLink = dim.getLink(dim.origin());
if(personalHomeLink!=null)
{
PocketManager.getDimensionData(link.source().getDimension()).setDestination(personalHomeLink, link.source().getX(), link.source().getY(), link.source().getZ());
}
dim.setDestination(link, dim.origin.getX(), dim.origin.getY(), dim.origin.getZ());
return true;
}
private static Point4D getRandomDestination()
{

View file

@ -5,7 +5,7 @@ public class LinkTypes
private LinkTypes() { }
public static final int ENUM_MIN = 0;
public static final int ENUM_MAX = 7;
public static final int ENUM_MAX = 8;
public static final int CLIENT_SIDE = -1337;
@ -18,4 +18,6 @@ public class LinkTypes
public static final int SAFE_EXIT = 5;
public static final int UNSAFE_EXIT = 6;
public static final int REVERSE = 7;
public static final int PERSONAL = 8;
}

View file

@ -7,6 +7,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.DimensionManager;
@ -137,6 +138,9 @@ public class PocketManager
//ArrayList that stores the dimension IDs of any dimension that has been deleted.
private static ArrayList<Integer> dimensionIDBlackList = null;
//Stores all the personal pocket mappings
private static HashMap<String, NewDimData> personalPocketsMapping = null;
public static boolean isLoaded()
{
return isLoaded;
@ -161,6 +165,7 @@ public class PocketManager
dimensionData = new HashMap<Integer, InnerDimData>();
rootDimensions = new ArrayList<NewDimData>();
dimensionIDBlackList = new ArrayList<Integer>();
personalPocketsMapping = new HashMap<String, NewDimData>();
if(FMLCommonHandler.instance().getEffectiveSide().isClient())
{
@ -277,7 +282,14 @@ public class PocketManager
{
try
{
DimensionManager.registerDimension(dimension.id(), properties.PocketProviderID);
if(personalPocketsMapping.containsValue(dimension))
{
DimensionManager.registerDimension(dimension.id(), properties.PersonalPocketProviderID);
}
else
{
DimensionManager.registerDimension(dimension.id(), properties.PocketProviderID);
}
}
catch (Exception e)
{
@ -412,6 +424,21 @@ public class PocketManager
return registerDimension(world.provider.dimensionId, null, false, false);
}
public static NewDimData registerPersonalPocket(NewDimData parent, String playerName)
{
if (parent == null)
{
throw new IllegalArgumentException("parent cannot be null. A pocket dimension must always have a parent dimension.");
}
DDProperties properties = DDProperties.instance();
int dimensionID = DimensionManager.getNextFreeDimId();
DimensionManager.registerDimension(dimensionID, properties.PersonalPocketProviderID);
NewDimData data = registerDimension(dimensionID, (InnerDimData) parent, true, false);
personalPocketsMapping.put(playerName, data);
return data;
}
public static NewDimData registerPocket(NewDimData parent, boolean isDungeon)
{
if (parent == null)
@ -539,6 +566,7 @@ public class PocketManager
unregisterPockets();
dimensionData = null;
personalPocketsMapping = null;
rootDimensions = null;
isLoaded = false;
isConnected = false;
@ -647,4 +675,24 @@ public class PocketManager
{
return linkWatcher;
}
public static NewDimData getPersonalDimensionForPlayer(String name)
{
if(personalPocketsMapping.containsKey(name))
{
return personalPocketsMapping.get(name);
}
return null;
}
public static void setPersonalPocketsMapping(HashMap<String, NewDimData> ppMap)
{
personalPocketsMapping = ppMap;
}
public static HashMap<String, NewDimData> getPersonalPocketMapping()
{
// TODO Auto-generated method stub
return personalPocketsMapping;
}
}

View file

@ -0,0 +1,6 @@
package StevenDimDoors.mod_pocketDim.helpers;
public class PersonalPocketHelper
{
}

View file

@ -7,7 +7,7 @@ import StevenDimDoors.mod_pocketDim.mod_pocketDim;
public class ItemBlockDimWall extends ItemBlock
{
private final static String[] subNames = {"Fabric of Reality", "Ancient Fabric"};
private final static String[] subNames = {"Fabric of Reality", "Ancient Fabric" , "Altered Fabric"};
public ItemBlockDimWall(int par1)
{

View file

@ -0,0 +1,35 @@
package StevenDimDoors.mod_pocketDim.items;
import java.util.List;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemDoor;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.blocks.BaseDimDoor;
public class ItemPersonalDoor extends BaseItemDoor
{
public ItemPersonalDoor(int itemID, Material material, ItemDoor door)
{
super(itemID, material, door);
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Creates a pathway to");
par3List.add("Your personal pocket");
}
@Override
protected BaseDimDoor getDoortoItemMapping()
{
return (BaseDimDoor) mod_pocketDim.personalDimDoor;
}
}

View file

@ -0,0 +1,58 @@
package StevenDimDoors.mod_pocketDim.items;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemDoor;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class ItemQuartzDoor extends ItemDoor
{
public ItemQuartzDoor(int par1, Material par2Material)
{
super(par1, par2Material);
}
@Override
public void registerIcons(IconRegister par1IconRegister)
{
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", ""));
}
@Override
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
{
if (par7 != 1)
{
return false;
}
else
{
++par5;
Block block = mod_pocketDim.quartzDoor;
if (par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack) && par2EntityPlayer.canPlayerEdit(par4, par5 + 1, par6, par7, par1ItemStack))
{
if (!block.canPlaceBlockAt(par3World, par4, par5, par6))
{
return false;
}
else
{
int i1 = MathHelper.floor_double((par2EntityPlayer.rotationYaw + 180.0F) * 4.0F / 360.0F - 0.5D) & 3;
placeDoorBlock(par3World, par4, par5, par6, i1, block);
--par1ItemStack.stackSize;
return true;
}
}
else
{
return false;
}
}
}
}

View file

@ -1,7 +1,6 @@
package StevenDimDoors.mod_pocketDim;
import java.io.File;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
@ -19,10 +18,12 @@ import net.minecraftforge.common.MinecraftForge;
import StevenDimDoors.mod_pocketDim.blocks.BlockDimWall;
import StevenDimDoors.mod_pocketDim.blocks.BlockDimWallPerm;
import StevenDimDoors.mod_pocketDim.blocks.BlockDoorGold;
import StevenDimDoors.mod_pocketDim.blocks.BlockDoorQuartz;
import StevenDimDoors.mod_pocketDim.blocks.BlockGoldDimDoor;
import StevenDimDoors.mod_pocketDim.blocks.BlockLimbo;
import StevenDimDoors.mod_pocketDim.blocks.BlockRift;
import StevenDimDoors.mod_pocketDim.blocks.DimensionalDoor;
import StevenDimDoors.mod_pocketDim.blocks.PersonalDimDoor;
import StevenDimDoors.mod_pocketDim.blocks.TransTrapdoor;
import StevenDimDoors.mod_pocketDim.blocks.TransientDoor;
import StevenDimDoors.mod_pocketDim.blocks.UnstableDoor;
@ -46,6 +47,8 @@ import StevenDimDoors.mod_pocketDim.items.ItemDDKey;
import StevenDimDoors.mod_pocketDim.items.ItemDimensionalDoor;
import StevenDimDoors.mod_pocketDim.items.ItemGoldDimDoor;
import StevenDimDoors.mod_pocketDim.items.ItemGoldDoor;
import StevenDimDoors.mod_pocketDim.items.ItemPersonalDoor;
import StevenDimDoors.mod_pocketDim.items.ItemQuartzDoor;
import StevenDimDoors.mod_pocketDim.items.ItemRiftBlade;
import StevenDimDoors.mod_pocketDim.items.ItemRiftSignature;
import StevenDimDoors.mod_pocketDim.items.ItemStabilizedRiftSignature;
@ -64,11 +67,11 @@ import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoor;
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoorGold;
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityRift;
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityTransTrapdoor;
import StevenDimDoors.mod_pocketDim.util.DDLogger;
import StevenDimDoors.mod_pocketDim.world.BiomeGenLimbo;
import StevenDimDoors.mod_pocketDim.world.BiomeGenPocket;
import StevenDimDoors.mod_pocketDim.world.DDBiomeGenBase;
import StevenDimDoors.mod_pocketDim.world.LimboProvider;
import StevenDimDoors.mod_pocketDim.world.PersonalPocketProvider;
import StevenDimDoors.mod_pocketDim.world.PocketProvider;
import StevenDimDoors.mod_pocketDim.world.gateways.GatewayGenerator;
import StevenDimDoors.mod_pocketDimClient.ClientPacketHandler;
@ -113,6 +116,8 @@ public class mod_pocketDim
@Instance("PocketDimensions")
public static mod_pocketDim instance = new mod_pocketDim();
public static Block quartzDoor;
public static Block personalDimDoor;
public static Block transientDoor;
public static Block warpDoor;
public static Block goldenDoor;
@ -138,6 +143,8 @@ public class mod_pocketDim
public static Item itemUnstableDoor;
public static Item itemStabilizedLinkSignature;
public static Item itemDDKey;
public static Item itemQuartzDoor;
public static Item itemPersonalDoor;
public static BiomeGenBase limboBiome;
public static BiomeGenBase pocketBiome;
@ -201,6 +208,9 @@ public class mod_pocketDim
transientDoor = new TransientDoor(properties.TransientDoorID, Material.iron, properties).setHardness(1.0F) .setUnlocalizedName("transientDoor");
goldenDimensionalDoor = new BlockGoldDimDoor(properties.GoldenDimensionalDoorID, Material.iron, properties).setHardness(1.0F) .setUnlocalizedName("dimDoorGold");
quartzDoor = new BlockDoorQuartz(properties.QuartzDoorID, Material.rock).setHardness(0.1F).setUnlocalizedName("doorQuartz");
personalDimDoor = new PersonalDimDoor(properties.PersonalDimDoorID, Material.rock,properties).setHardness(0.1F).setUnlocalizedName("dimDoorPersonal");
goldenDoor = new BlockDoorGold(properties.GoldenDoorID, Material.iron).setHardness(0.1F).setUnlocalizedName("doorGold");
blockDimWall = new BlockDimWall(properties.FabricBlockID, 0, Material.iron).setLightValue(1.0F).setHardness(0.1F).setUnlocalizedName("blockDimWall");
blockDimWallPerm = (new BlockDimWallPerm(properties.PermaFabricBlockID, 0, Material.iron)).setLightValue(1.0F).setBlockUnbreakable().setResistance(6000000.0F).setUnlocalizedName("blockDimWallPerm");
@ -212,6 +222,8 @@ public class mod_pocketDim
transTrapdoor = (TransTrapdoor) (new TransTrapdoor(properties.TransTrapdoorID, Material.wood).setHardness(1.0F) .setUnlocalizedName("dimHatch"));
itemDDKey = (new ItemDDKey(properties.DDKeyItemID)).setUnlocalizedName("itemDDKey");
itemQuartzDoor = (new ItemQuartzDoor(properties.QuartzDoorID, Material.rock)).setUnlocalizedName("itemQuartzDoor");
itemPersonalDoor = (new ItemPersonalDoor(properties.PersonalDimDoorID, Material.rock, (ItemDoor)this.itemQuartzDoor)).setUnlocalizedName("itemQuartzDimDoor");
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");
@ -232,6 +244,8 @@ public class mod_pocketDim
mod_pocketDim.limboBiome = (new BiomeGenLimbo(properties.LimboBiomeID));
mod_pocketDim.pocketBiome = (new BiomeGenPocket(properties.PocketBiomeID));
GameRegistry.registerBlock(quartzDoor, "Quartz Door");
GameRegistry.registerBlock(personalDimDoor, "Personal Dimensional Door");
GameRegistry.registerBlock(goldenDoor, "Golden Door");
GameRegistry.registerBlock(goldenDimensionalDoor, "Golden Dimensional Door");
GameRegistry.registerBlock(unstableDoor, "Unstable Door");
@ -249,6 +263,8 @@ public class mod_pocketDim
throw new IllegalStateException("There is a provider ID conflict between PocketProvider from Dimensional Doors and another provider type. Fix your configuration!");
if (!DimensionManager.registerProviderType(properties.LimboProviderID, LimboProvider.class, false))
throw new IllegalStateException("There is a provider ID conflict between LimboProvider from Dimensional Doors and another provider type. Fix your configuration!");
if (!DimensionManager.registerProviderType(properties.PersonalPocketProviderID, PersonalPocketProvider.class, false))
throw new IllegalStateException("There is a provider ID conflict between LimboProvider from Dimensional Doors and another provider type. Fix your configuration!");
DimensionManager.registerDimension(properties.LimboDimensionID, properties.LimboProviderID);

View file

@ -7,6 +7,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map.Entry;
import net.minecraftforge.common.DimensionManager;
import StevenDimDoors.mod_pocketDim.Point3D;
@ -59,6 +60,15 @@ public class DDSaveHandler
PocketManager.createAndRegisterBlacklist(blacklist);
}
// Load the personal pockets mapping
File personalPocketMap = new File(basePath+"personalPockets.txt");
HashMap<String, Integer> ppMap = new HashMap<String, Integer>();
if(personalPocketMap.exists())
{
PersonalPocketMappingProcessor ppMappingProcessor = new PersonalPocketMappingProcessor();
ppMap = readPersonalPocketsMapping(personalPocketMap,ppMappingProcessor);
}
// List any dimension data files and read each dimension
DimDataProcessor reader = new DimDataProcessor();
HashMap<Integer, PackedDimData> packedDims = new HashMap<Integer, PackedDimData>();
@ -82,7 +92,17 @@ public class DDSaveHandler
{
linksToUnpack.addAll(packedDim.Links);
}
return unpackDimData(packedDims) && unpackLinkData(linksToUnpack);
unpackDimData(packedDims);
unpackLinkData(linksToUnpack);
HashMap<String, NewDimData> personalPocketsMap = new HashMap<String, NewDimData>();
for(Entry<String, Integer> pair : ppMap.entrySet())
{
personalPocketsMap.put(pair.getKey(), PocketManager.getDimensionData(pair.getValue()));
}
PocketManager.setPersonalPocketsMapping(personalPocketsMap);
return true;
}
/**
@ -270,6 +290,9 @@ public class DDSaveHandler
// Create and write the blackList
writeBlacklist(blacklist, savePath);
//create and write personal pocket mapping
writePersonalPocketMap(PocketManager.getPersonalPocketMapping(), savePath);
// Write the dimension save data
boolean succeeded = true;
DimDataProcessor writer = new DimDataProcessor();
@ -312,6 +335,32 @@ public class DDSaveHandler
}
}
private static boolean writePersonalPocketMap(HashMap<String, NewDimData> hashMap, String savePath)
{
try
{
HashMap<String, Integer> ppMap = new HashMap<String, Integer>();
for(Entry<String, NewDimData> pair : hashMap.entrySet())
{
ppMap.put(pair.getKey(), pair.getValue().id());
}
PersonalPocketMappingProcessor writer = new PersonalPocketMappingProcessor();
File tempFile = new File(savePath + "/personalPockets.tmp");
File saveFile = new File(savePath + "/personalPockets.txt");
writer.writeToFile(tempFile, ppMap);
saveFile.delete();
tempFile.renameTo(saveFile);
return true;
}
catch (Exception e)
{
System.err.println("Could not save personal pockets mapping. The following error occurred:");
printException(e, true);
return false;
}
}
private static boolean writeDimension(IPackable<PackedDimData> dimension, DimDataProcessor writer, String basePath, String backupPath)
{
try
@ -378,7 +427,6 @@ public class DDSaveHandler
public static List<Integer> readBlacklist(File blacklistFile, BlacklistProcessor reader)
{
try
{
return reader.readFromFile(blacklistFile);
@ -388,6 +436,18 @@ public class DDSaveHandler
e.printStackTrace();
return null;
}
}
public static HashMap<String,Integer> readPersonalPocketsMapping(File ppMap, PersonalPocketMappingProcessor reader)
{
try
{
return reader.readFromFile(ppMap);
}
catch (Exception e)
{
e.printStackTrace();
return null;
}
}
}

View file

@ -0,0 +1,79 @@
package StevenDimDoors.mod_pocketDim.saving;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import StevenDimDoors.mod_pocketDim.util.BaseConfigurationProcessor;
import StevenDimDoors.mod_pocketDim.util.ConfigurationProcessingException;
public class PersonalPocketMappingProcessor extends BaseConfigurationProcessor<HashMap<String, Integer>>
{
@Override
public HashMap<String, Integer> readFromStream(InputStream inputStream) throws ConfigurationProcessingException
{
try
{
JsonReader reader = new JsonReader(new InputStreamReader(inputStream, "UTF-8"));
HashMap<String, Integer> data = this.createPersonalPocketsMapFromJson(reader);
reader.close();
return data;
}
catch (IOException e)
{
e.printStackTrace();
throw new ConfigurationProcessingException("Could not read personal pocket mapping");
}
}
private HashMap<String, Integer> createPersonalPocketsMapFromJson(JsonReader reader) throws IOException
{
HashMap<String, Integer> ppMap;
ppMap = this.createMapFromJson(reader);
return ppMap;
}
private HashMap<String, Integer> createMapFromJson(JsonReader reader) throws IOException
{
HashMap<String, Integer> map = new HashMap<String, Integer>();
reader.beginObject();
while(reader.peek()!= JsonToken.END_OBJECT)
{
map.put(reader.nextName(), reader.nextInt());
}
reader.endObject();
return map;
}
@Override
public void writeToStream(OutputStream outputStream, HashMap<String, Integer> data) throws ConfigurationProcessingException
{
GsonBuilder gsonBuilder = new GsonBuilder();
Gson gson = gsonBuilder.setPrettyPrinting().create();
try
{
outputStream.write(gson.toJson(data).getBytes("UTF-8"));
outputStream.close();
}
catch (IOException e)
{
// not sure if this is kosher, we need it to explode, but not by throwing the IO exception.
throw new ConfigurationProcessingException("Incorrectly formatted save data");
}
}
}

View file

@ -70,6 +70,8 @@ public class BlockRotator
hasOrientations[mod_pocketDim.dimensionalDoor.blockID] = true;
hasOrientations[mod_pocketDim.warpDoor.blockID] = true;
hasOrientations[mod_pocketDim.goldenDimensionalDoor.blockID] = true;
hasOrientations[mod_pocketDim.personalDimDoor.blockID] = true;
}

View file

@ -0,0 +1,85 @@
package StevenDimDoors.mod_pocketDim.world;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.util.Vec3;
import net.minecraft.world.WorldProvider;
import net.minecraft.world.biome.WorldChunkManagerHell;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraftforge.client.IRenderHandler;
import net.minecraftforge.common.DimensionManager;
import StevenDimDoors.mod_pocketDim.CloudRenderBlank;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.config.DDProperties;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import StevenDimDoors.mod_pocketDim.ticking.CustomLimboPopulator;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class PersonalPocketProvider extends PocketProvider
{
private DDProperties properties;
private CustomLimboPopulator spawner;
private IRenderHandler skyRenderer;
public PersonalPocketProvider()
{
super();
}
@Override
public Vec3 getSkyColor(Entity cameraEntity, float partialTicks)
{
setCloudRenderer( new CloudRenderBlank());
return this.worldObj.getWorldVec3Pool().getVecFromPool(.89, .89, .89);
}
public boolean isSurfaceWorld()
{
return false;
}
@Override
protected void generateLightBrightnessTable()
{
float f = 0.0F;
for (int i = 0; i <= 15; ++i)
{
float f1 = 1.0F - (float)i / 15.0F;
this.lightBrightnessTable[i] = (15);
}
}
@Override
public double getHorizon()
{
return worldObj.getHeight()-256;
}
@SideOnly(Side.CLIENT)
@Override
public Vec3 getFogColor(float par1, float par2)
{
return this.worldObj.getWorldVec3Pool().getVecFromPool(.89, .89, .89);
}
@Override
public int getRespawnDimension(EntityPlayerMP player)
{
return this.dimensionId;
}
//TODO only owning player can respawn here
@Override
public boolean canRespawnHere()
{
return true;
}
@Override
public int getActualHeight()
{
return -256;
}
}

View file

@ -3,6 +3,8 @@ package StevenDimDoors.mod_pocketDim.world;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
@ -10,6 +12,7 @@ import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
import net.minecraftforge.common.DimensionManager;
import StevenDimDoors.experimental.MazeBuilder;
import StevenDimDoors.mod_pocketDim.Point3D;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.blocks.IDimDoor;
import StevenDimDoors.mod_pocketDim.config.DDProperties;
import StevenDimDoors.mod_pocketDim.core.DimLink;
@ -261,10 +264,8 @@ public class PocketBuilder
}
//Check if the block below that point is actually a door
int blockID = world.getBlockId(source.getX(), source.getY() - 1, source.getZ());
if (blockID != properties.DimensionalDoorID && blockID != properties.WarpDoorID &&
blockID != properties.TransientDoorID &&
blockID != properties.GoldenDimensionalDoorID)
Block block = Block.blocksList[world.getBlockId(source.getX(), source.getY() - 1, source.getZ())];
if (block==null || !(block instanceof IDimDoor))
{
throw new IllegalStateException("The link's source is not a door block. It should be impossible to traverse a rift without a door!");
}
@ -273,8 +274,8 @@ public class PocketBuilder
int orientation = world.getBlockMetadata(source.getX(), source.getY() - 1, source.getZ()) & 3;
return orientation;
}
public static boolean generateNewPocket(DimLink link, int size, int wallThickness, DDProperties properties, Block door)
public static void validatePocketSetup(DimLink link, int size, int wallThickness, DDProperties properties, Block door)
{
if (link == null)
{
@ -311,13 +312,73 @@ public class PocketBuilder
{
throw new IllegalArgumentException("size must be large enough to fit the specified wall thickness and some air space.");
}
}
public static boolean generateNewPersonalPocket(DimLink link, DDProperties properties,Entity player, Block door)
{
//incase a chicken walks in or something
if(!(player instanceof EntityPlayer))
{
return false;
}
int wallThickness = DEFAULT_POCKET_WALL_THICKNESS;
int size = DEFAULT_POCKET_SIZE;
validatePocketSetup(link, size, wallThickness, properties, door);
try
{
//Register a new dimension
NewDimData parent = PocketManager.getDimensionData(link.source().getDimension());
NewDimData dimension = PocketManager.registerPersonalPocket(parent, player.getEntityName());
//Load a world
World world = PocketManager.loadDimension(dimension.id());
if (world == null || world.provider == null)
{
System.err.println("Could not initialize dimension for a pocket!");
return false;
}
//Calculate the destination point
Point4D dest = LimboProvider.getLimboSkySpawn((EntityPlayer) player, properties);
Point4D source = link.source();
int destinationY = yCoordHelper.adjustDestinationY(link.source().getY(), world.getHeight(), wallThickness + 1, size);
int orientation = getDoorOrientation(source, properties);
//Place a link leading back out of the pocket
DimLink reverseLink = dimension.createLink(dest.getX(), destinationY, dest.getZ(), LinkTypes.REVERSE,(link.orientation()+2)%4);
parent.setDestination(reverseLink, source.getX(), source.getY(), source.getZ());
//Build the actual pocket area
buildPocket(world, dest.getX(), destinationY, dest.getZ(), orientation, size, wallThickness, properties, door);
//Finish up destination initialization
dimension.initializePocket(dest.getX(), destinationY, dest.getZ(), orientation, link);
dimension.setFilled(true);
return true;
}
catch (Exception e)
{
e.printStackTrace();
return false;
}
}
public static boolean generateNewPocket(DimLink link, int size, int wallThickness, DDProperties properties, Block door)
{
validatePocketSetup(link, size, wallThickness, properties, door);
try
{
//Register a new dimension
NewDimData parent = PocketManager.getDimensionData(link.source().getDimension());
NewDimData dimension = PocketManager.registerPocket(parent, false);
//Load a world
World world = PocketManager.loadDimension(dimension.id());
@ -385,23 +446,30 @@ public class PocketBuilder
BlockRotator.transformPoint(center, door, orientation - BlockRotator.EAST_DOOR_METADATA, door);
//Build the outer layer of Eternal Fabric
buildBox(world, center.getX(), center.getY(), center.getZ(), (size / 2), properties.PermaFabricBlockID, false, 0);
buildBox(world, center.getX(), center.getY(), center.getZ(), (size / 2), properties.PermaFabricBlockID, 0, false, 0);
//check if we are building a personal pocket
int metadata = 0;
if(world.provider instanceof PersonalPocketProvider)
{
metadata = 2;
}
//Build the (wallThickness - 1) layers of Fabric of Reality
for (int layer = 1; layer < wallThickness; layer++)
{
buildBox(world, center.getX(), center.getY(), center.getZ(), (size / 2) - layer, properties.FabricBlockID,
buildBox(world, center.getX(), center.getY(), center.getZ(), (size / 2) - layer, mod_pocketDim.blockDimWall.blockID, metadata,
layer < (wallThickness - 1) && properties.TNFREAKINGT_Enabled, properties.NonTntWeight);
}
//MazeBuilder.generate(world, x, y, z, random);
//Build the door
int doorOrientation = BlockRotator.transformMetadata(BlockRotator.EAST_DOOR_METADATA, orientation - BlockRotator.EAST_DOOR_METADATA + 2, properties.DimensionalDoorID);
int doorOrientation = BlockRotator.transformMetadata(BlockRotator.EAST_DOOR_METADATA, orientation - BlockRotator.EAST_DOOR_METADATA + 2, doorBlock.blockID);
ItemDimensionalDoor.placeDoorBlock(world, x, y - 1, z, doorOrientation, doorBlock);
}
private static void buildBox(World world, int centerX, int centerY, int centerZ, int radius, int blockID, boolean placeTnt, int nonTntWeight)
private static void buildBox(World world, int centerX, int centerY, int centerZ, int radius, int blockID, int metadata, boolean placeTnt, int nonTntWeight)
{
int x, y, z;
@ -418,14 +486,14 @@ public class PocketBuilder
{
for (z = startZ; z <= endZ; z++)
{
setBlockDirectlySpecial(world, x, startY, z, blockID, 0, placeTnt, nonTntWeight);
setBlockDirectlySpecial(world, x, endY, z, blockID, 0, placeTnt, nonTntWeight);
setBlockDirectlySpecial(world, x, startY, z, blockID, metadata, placeTnt, nonTntWeight);
setBlockDirectlySpecial(world, x, endY, z, blockID, metadata, placeTnt, nonTntWeight);
}
for (y = startY; y <= endY; y++)
{
setBlockDirectlySpecial(world, x, y, startZ, blockID, 0, placeTnt, nonTntWeight);
setBlockDirectlySpecial(world, x, y, endZ, blockID, 0, placeTnt, nonTntWeight);
setBlockDirectlySpecial(world, x, y, startZ, blockID, metadata, placeTnt, nonTntWeight);
setBlockDirectlySpecial(world, x, y, endZ, blockID, metadata, placeTnt, nonTntWeight);
}
}
@ -433,8 +501,8 @@ public class PocketBuilder
{
for (z = startZ; z <= endZ; z++)
{
setBlockDirectlySpecial(world, startX, y, z, blockID, 0, placeTnt, nonTntWeight);
setBlockDirectlySpecial(world, endX, y, z, blockID, 0, placeTnt, nonTntWeight);
setBlockDirectlySpecial(world, startX, y, z, blockID, metadata, placeTnt, nonTntWeight);
setBlockDirectlySpecial(world, endX, y, z, blockID, metadata, placeTnt, nonTntWeight);
}
}
}

View file

@ -19,8 +19,8 @@ import cpw.mods.fml.relauncher.SideOnly;
public class PocketProvider extends WorldProvider
{
private DDProperties properties;
private CustomLimboPopulator spawner;
private IRenderHandler skyRenderer;
protected CustomLimboPopulator spawner;
protected IRenderHandler skyRenderer;
public PocketProvider()
{

View file

@ -24,9 +24,11 @@ public class ClientProxy extends CommonProxy
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());
//MinecraftForgeClient.preloadTexture(RIFT2_PNG);
RenderingRegistry.registerEntityRenderingHandler(MobMonolith.class, new RenderMobObelisk(.5F));
RenderingRegistry.registerBlockHandler(new PrivatePocketRender(RenderingRegistry.getNextAvailableRenderId()));
}
@Override

View file

@ -0,0 +1,139 @@
package StevenDimDoors.mod_pocketDimClient;
import org.lwjgl.opengl.GL11;
import net.minecraft.block.Block;
import net.minecraft.block.BlockGrass;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.Icon;
import net.minecraft.world.IBlockAccess;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
public class PrivatePocketRender implements ISimpleBlockRenderingHandler
{
public static int renderID;
public PrivatePocketRender(int renderID)
{
super();
PrivatePocketRender.renderID = renderID;
}
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
{
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
{
float par5 = .5F;
float par6 = .5F;
float par7 = .5F;
Tessellator tessellator = Tessellator.instance;
boolean flag = false;
float f3 = 0.5F;
float f4 = 1.0F;
float f5 = 0.8F;
float f6 = 0.6F;
float f7 = f4 * par5;
float f8 = f4 * par6;
float f9 = f4 * par7;
float f10 = f3;
float f11 = f5;
float f12 = f6;
float f13 = f3;
float f14 = f5;
float f15 = f6;
float f16 = f3;
float f17 = f5;
float f18 = f6;
if (block != Block.grass)
{
f10 = f3 * par5;
f11 = f5 * par5;
f12 = f6 * par5;
f13 = f3 * par6;
f14 = f5 * par6;
f15 = f6 * par6;
f16 = f3 * par7;
f17 = f5 * par7;
f18 = f6 * par7;
}
tessellator.setColorOpaque_F(.89F, .89F, .89F);
if (renderer.renderAllFaces || block.shouldSideBeRendered(world, x, y - 1, z, 0))
{
renderer.renderFaceYNeg(block, (double)x, (double)y, (double)z, renderer.getBlockIcon(block, world, x, y, z, 0));
flag = true;
}
if (renderer.renderAllFaces || block.shouldSideBeRendered(world, x, y + 1, z, 1))
{
renderer.renderFaceYPos(block, (double)x, (double)y, (double)z, renderer.getBlockIcon(block, world, x, y, z, 1));
flag = true;
}
Icon icon;
if (renderer.renderAllFaces || block.shouldSideBeRendered(world, x, y, z - 1, 2))
{
icon = renderer.getBlockIcon(block, world, x, y, z, 2);
renderer.renderFaceZNeg(block, (double)x, (double)y, (double)z, icon);
flag = true;
}
if (renderer.renderAllFaces || block.shouldSideBeRendered(world, x, y, z + 1, 3))
{
icon = renderer.getBlockIcon(block, world, x, y, z, 3);
renderer.renderFaceZPos(block, (double)x, (double)y, (double)z, icon);
flag = true;
}
if (renderer.renderAllFaces || block.shouldSideBeRendered(world, x - 1, y, z, 4))
{
icon = renderer.getBlockIcon(block, world, x, y, z, 4);
renderer.renderFaceXNeg(block, (double)x, (double)y, (double)z, icon);
flag = true;
}
if (renderer.renderAllFaces || block.shouldSideBeRendered(world, x + 1, y, z, 5))
{
icon = renderer.getBlockIcon(block, world, x, y, z, 5);
renderer.renderFaceXPos(block, (double)x, (double)y, (double)z, icon);
flag = true;
}
return flag;
}
@Override
public boolean shouldRender3DInInventory()
{
// TODO Auto-generated method stub
return true;
}
@Override
public int getRenderId()
{
// TODO Auto-generated method stub
return renderID;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 217 B

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB