Update low-hanging fruit to 1.7.10

This commit is contained in:
CannibalVox 2015-03-04 00:43:28 -06:00
parent fe04c99890
commit 63b0547069
64 changed files with 656 additions and 773 deletions

View file

@ -134,13 +134,13 @@ public class CommonProxy implements IGuiHandler
}
public void updateDoorTE(BaseDimDoor door, World world, int x, int y, int z)
{
TileEntity tile = world.getBlockTileEntity(x, y, z);
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileEntityDimDoor)
{
int metadata = world.getBlockMetadata(x, y, z);
TileEntityDimDoor dimTile = (TileEntityDimDoor) tile;
dimTile.openOrClosed = door.isDoorOnRift(world, x, y, z)&&door.isUpperDoorBlock(metadata);
dimTile.orientation = door.getFullMetadata(world, x, y, z) & 7;
dimTile.orientation = world.getBlockMetadata(x,y,z) & 7;
dimTile.lockStatus = door.getLockStatus(world, x, y, z);
}
}

View file

@ -1,19 +1,10 @@
package StevenDimDoors.mod_pocketDim;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.NetLoginHandler;
import net.minecraft.network.packet.NetHandler;
import net.minecraft.network.packet.Packet1Login;
import net.minecraft.network.packet.Packet250CustomPayload;
import net.minecraft.server.MinecraftServer;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.common.network.ForgePacket;
import net.minecraftforge.common.network.packet.DimensionRegisterPacket;
import StevenDimDoors.mod_pocketDim.core.NewDimData;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import StevenDimDoors.mod_pocketDim.watcher.ClientDimData;
import cpw.mods.fml.common.network.IConnectionHandler;
import cpw.mods.fml.common.network.Player;
public class ConnectionHandler implements IConnectionHandler
{

View file

@ -4,6 +4,8 @@ package StevenDimDoors.mod_pocketDim;
import net.minecraft.block.Block;
import net.minecraft.block.BlockDispenser;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@ -27,19 +29,19 @@ public class CraftingManager implements ICraftingHandler
{
case 1:
GameRegistry.addShapelessRecipe(new ItemStack(mod_pocketDim.itemStableFabric, 1),
Item.enderPearl, mod_pocketDim.itemWorldThread);
Items.ender_pearl, mod_pocketDim.itemWorldThread);
break;
case 2:
GameRegistry.addRecipe(new ItemStack(mod_pocketDim.itemStableFabric, 1),
"yxy", 'x', Item.enderPearl, 'y', mod_pocketDim.itemWorldThread);
"yxy", 'x', Items.ender_pearl, 'y', mod_pocketDim.itemWorldThread);
break;
case 3:
GameRegistry.addRecipe(new ItemStack(mod_pocketDim.itemStableFabric, 1),
" y ", "yxy", " y ", 'x', Item.enderPearl, 'y', mod_pocketDim.itemWorldThread);
" y ", "yxy", " y ", 'x', Items.ender_pearl, 'y', mod_pocketDim.itemWorldThread);
break;
default:
GameRegistry.addRecipe(new ItemStack(mod_pocketDim.itemStableFabric, 1),
"yyy", "yxy", "yyy", 'x', Item.enderPearl, 'y', mod_pocketDim.itemWorldThread);
"yyy", "yxy", "yyy", 'x', Items.ender_pearl, 'y', mod_pocketDim.itemWorldThread);
break;
}
}
@ -47,47 +49,47 @@ public class CraftingManager implements ICraftingHandler
if (properties.CraftingDimensionalDoorAllowed)
{
GameRegistry.addRecipe(new ItemStack(mod_pocketDim.itemDimensionalDoor, 1),
"yxy", 'x', mod_pocketDim.itemStableFabric, 'y', Item.doorIron);
"yxy", 'x', mod_pocketDim.itemStableFabric, 'y', Items.iron_door);
}
if (properties.CraftingUnstableDoorAllowed)
{
GameRegistry.addRecipe(new ItemStack(mod_pocketDim.itemUnstableDoor, 1),
"yxy", 'x', Item.eyeOfEnder, 'y', mod_pocketDim.itemDimensionalDoor);
"yxy", 'x', Items.ender_eye, 'y', mod_pocketDim.itemDimensionalDoor);
}
if (properties.CraftingWarpDoorAllowed)
{
GameRegistry.addRecipe(new ItemStack(mod_pocketDim.itemWarpDoor, 1),
"yxy", 'x', Item.enderPearl, 'y', Item.doorWood);
"yxy", 'x', Items.ender_pearl, 'y', Items.wooden_door);
}
if (properties.CraftingTransTrapdoorAllowed)
{
GameRegistry.addRecipe(new ItemStack(mod_pocketDim.transTrapdoor, 1),
"y", "x", "y", 'x', Item.enderPearl, 'y', Block.trapdoor);
"y", "x", "y", 'x', Items.ender_pearl, 'y', Blocks.trapdoor);
}
if (properties.CraftingRiftSignatureAllowed)
{
GameRegistry.addRecipe(new ItemStack(mod_pocketDim.itemRiftSignature, 1),
" y ", "yxy", " y ", 'x', Item.enderPearl, 'y', Item.ingotIron);
" y ", "yxy", " y ", 'x', Items.ender_pearl, 'y', Items.iron_ingot);
}
if (properties.CraftingRiftRemoverAllowed)
{
GameRegistry.addRecipe(new ItemStack(mod_pocketDim.itemRiftRemover, 1),
"yyy", "yxy", "yyy", 'x', Item.enderPearl, 'y', Item.ingotGold);
"yyy", "yxy", "yyy", 'x', Items.ender_pearl, 'y', Items.gold_ingot);
}
if (properties.CraftingRiftBladeAllowed)
{
GameRegistry.addRecipe(new ItemStack(mod_pocketDim.itemRiftBlade, 1),
"x", "x", "y", 'x', mod_pocketDim.itemStableFabric, 'y', Item.blazeRod);
"x", "x", "y", 'x', mod_pocketDim.itemStableFabric, 'y', Items.blaze_rod);
}
if (properties.CraftingStabilizedRiftSignatureAllowed)
{
GameRegistry.addRecipe(new ItemStack(mod_pocketDim.itemStabilizedRiftSignature, 1),
" y ", "yxy", " y ", 'x', mod_pocketDim.itemStableFabric, 'y', Item.ingotIron);
" y ", "yxy", " y ", 'x', mod_pocketDim.itemStableFabric, 'y', Items.iron_ingot);
}
if (properties.CraftingGoldenDimensionalDoorAllowed)
{
@ -97,7 +99,7 @@ public class CraftingManager implements ICraftingHandler
if (properties.CraftingGoldenDoorAllowed)
{
GameRegistry.addRecipe(new ItemStack(mod_pocketDim.itemGoldenDoor, 1),
"yy", "yy", "yy", 'y', Item.ingotGold);
"yy", "yy", "yy", 'y', Items.gold_ingot);
}
if (properties.CraftingPersonalDimDoorAllowed)
{
@ -114,7 +116,7 @@ public class CraftingManager implements ICraftingHandler
if (properties.CraftingDDKeysAllowed)
{
GameRegistry.addRecipe(new ItemStack(mod_pocketDim.itemDDKey, 1),
" z", " y ", "y ", 'y', Item.ingotGold, 'z', Item.enderPearl);
" z", " y ", "y ", 'y', Items.gold_ingot, 'z', Items.ender_pearl);
GameRegistry.addRecipe(new ItemStack(mod_pocketDim.itemDDKey, 1),
"z", "z", 'z', mod_pocketDim.itemDDKey);
}

View file

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.Random;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.init.Items;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@ -46,34 +47,34 @@ public class DDLoot {
ArrayList<WeightedRandomChestContent> items = new ArrayList<WeightedRandomChestContent>();
addContent(true, items, Item.ingotIron.itemID, 160, 1, 3);
addContent(true, items, Item.coal.itemID, 120, 1, 3);
addContent(true, items, Item.netherQuartz.itemID, 120, 1, 3);
addContent(true, items, Item.enchantedBook.itemID, 100);
addContent(true, items, Item.ingotGold.itemID, 80, 1, 3);
addContent(true, items, Item.diamond.itemID, 40, 1, 2);
addContent(true, items, Item.emerald.itemID, 20, 1, 2);
addContent(true, items, Item.appleGold.itemID, 10);
addContent(true, items, Items.iron_ingot, 160, 1, 3);
addContent(true, items, Items.coal, 120, 1, 3);
addContent(true, items, Items.quartz, 120, 1, 3);
addContent(true, items, Items.book, 100);
addContent(true, items, Items.gold_ingot, 80, 1, 3);
addContent(true, items, Items.diamond, 40, 1, 2);
addContent(true, items, Items.emerald, 20, 1, 2);
addContent(true, items, Items.golden_apple, 10);
addContent(properties.FabricOfRealityLootEnabled, items, mod_pocketDim.blockDimWall.blockID, 20, 16, 64);
addContent(properties.WorldThreadLootEnabled, items, mod_pocketDim.itemWorldThread.itemID, 80, 2, 12);
addContent(properties.FabricOfRealityLootEnabled, items, Item.getItemFromBlock(mod_pocketDim.blockDimWall), 20, 16, 64);
addContent(properties.WorldThreadLootEnabled, items, mod_pocketDim.itemWorldThread, 80, 2, 12);
// Add all the items to our dungeon chest
addItemsToContainer(DungeonChestInfo, items);
}
private static void addContent(boolean include, ArrayList<WeightedRandomChestContent> items,
int itemID, int weight)
Item item, int weight)
{
if (include)
items.add(new WeightedRandomChestContent(itemID, 0, 1, 1, weight));
items.add(new WeightedRandomChestContent(item, 0, 1, 1, weight));
}
private static void addContent(boolean include, ArrayList<WeightedRandomChestContent> items,
int itemID, int weight, int minAmount, int maxAmount)
Item item, int weight, int minAmount, int maxAmount)
{
if (include)
items.add(new WeightedRandomChestContent(itemID, 0, minAmount, maxAmount, weight));
items.add(new WeightedRandomChestContent(item, 0, minAmount, maxAmount, weight));
}
private static void addItemsToContainer(ChestGenHooks container, ArrayList<WeightedRandomChestContent> items)
@ -156,25 +157,25 @@ public class DDLoot {
count = MathHelper.getRandomIntegerInRange(random, 2, 5);
for (k = 0; k < count; k++)
{
stacks.add( new ItemStack(Item.bone, 1) );
stacks.add( new ItemStack(Items.bone, 1) );
}
count = MathHelper.getRandomIntegerInRange(random, 2, 4);
for (k = 0; k < count; k++)
{
stacks.add( new ItemStack(Item.rottenFlesh, 1) );
stacks.add( new ItemStack(Items.rotten_flesh, 1) );
}
// Insert tools
// 30% chance of adding a pickaxe
if (random.nextInt(100) < 30)
{
addModifiedTool(Item.pickaxeIron, stacks, random);
addModifiedTool(Items.iron_pickaxe, stacks, random);
}
// 30% chance of adding a bow and some arrows
if (random.nextInt(100) < 30)
{
addModifiedBow(stacks, random);
stacks.add( new ItemStack(Item.arrow, MathHelper.getRandomIntegerInRange(random, 8, 32)) );
stacks.add( new ItemStack(Items.arrow, MathHelper.getRandomIntegerInRange(random, 8, 32)) );
}
// 10% chance of adding a Rift Blade (no enchants)
if (properties.RiftBladeLootEnabled && random.nextInt(100) < 10)
@ -184,25 +185,25 @@ public class DDLoot {
else
{
// 20% of adding an iron sword, 10% of adding a stone sword
addModifiedSword( getRandomItem(Item.swordIron, Item.swordStone, null, 20, 10, random) , stacks, random);
addModifiedSword( getRandomItem(Items.iron_sword, Items.stone_sword, null, 20, 10, random) , stacks, random);
}
// Insert equipment
// For each piece, 25% of an iron piece, 10% of a chainmail piece
addModifiedEquipment( getRandomItem(Item.helmetIron, Item.helmetChain, null, 25, 10, random) , stacks, random);
addModifiedEquipment( getRandomItem(Item.plateIron, Item.plateChain, null, 25, 10, random) , stacks, random);
addModifiedEquipment( getRandomItem(Item.legsIron, Item.legsChain, null, 25, 10, random) , stacks, random);
addModifiedEquipment( getRandomItem(Item.bootsIron, Item.bootsChain, null, 25, 10, random) , stacks, random);
addModifiedEquipment( getRandomItem(Items.iron_helmet, Items.chainmail_helmet, null, 25, 10, random) , stacks, random);
addModifiedEquipment( getRandomItem(Items.iron_chestplate, Items.chainmail_chestplate, null, 25, 10, random) , stacks, random);
addModifiedEquipment( getRandomItem(Items.iron_leggings, Items.chainmail_leggings, null, 25, 10, random) , stacks, random);
addModifiedEquipment( getRandomItem(Items.iron_boots, Items.iron_boots, null, 25, 10, random) , stacks, random);
// Insert other random stuff
// 40% chance for a name tag, 35% chance for a glass bottle
// 30% chance for an ender pearl, 5% chance for record 11
// 30% chance for a ghast tear
addItemWithChance(stacks, random, 40, Item.nameTag, 1);
addItemWithChance(stacks, random, 35, Item.glassBottle, 1);
addItemWithChance(stacks, random, 30, Item.enderPearl, 1);
addItemWithChance(stacks, random, 30, Item.ghastTear, 1);
addItemWithChance(stacks, random, 5, Item.record11, 1);
addItemWithChance(stacks, random, 40, Items.name_tag, 1);
addItemWithChance(stacks, random, 35, Items.glass_bottle, 1);
addItemWithChance(stacks, random, 30, Items.ender_pearl, 1);
addItemWithChance(stacks, random, 30, Items.ghast_tear, 1);
addItemWithChance(stacks, random, 5, Items.record_11, 1);
// Finally, there is a 5% chance of adding a player head
if (random.nextInt(100) < 5)
@ -239,7 +240,7 @@ public class DDLoot {
private static void addModifiedBow(ArrayList<ItemStack> stacks, Random random)
{
stacks.add( getModifiedItem(Item.bow, random, new Enchantment[] { Enchantment.flame, Enchantment.power, Enchantment.punch }) );
stacks.add( getModifiedItem(Items.bow, random, new Enchantment[] { Enchantment.flame, Enchantment.power, Enchantment.punch }) );
}
private static ItemStack getModifiedItem(Item item, Random random, Enchantment[] enchantments)
@ -289,7 +290,7 @@ public class DDLoot {
{
skullOwner = deathTracker.getRandomUsername(random);
}
ItemStack skull = new ItemStack(Item.skull, 1, PLAYER_SKULL_METADATA);
ItemStack skull = new ItemStack(Items.skull, 1, PLAYER_SKULL_METADATA);
skull.stackTagCompound = new NBTTagCompound();
skull.stackTagCompound.setString("SkullOwner", skullOwner);
stacks.add(skull);

View file

@ -1,20 +1,24 @@
package StevenDimDoors.mod_pocketDim.blocks;
import java.util.Random;
import StevenDimDoors.mod_pocketDim.core.LinkType;
import net.minecraft.block.Block;
import net.minecraft.block.BlockDoor;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.IconFlipped;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemDoor;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
@ -32,23 +36,23 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
protected final DDProperties properties;
@SideOnly(Side.CLIENT)
protected Icon[] upperTextures;
protected IIcon[] upperTextures;
@SideOnly(Side.CLIENT)
protected Icon[] lowerTextures;
protected IIcon[] lowerTextures;
public BaseDimDoor(int blockID, Material material, DDProperties properties)
public BaseDimDoor(Material material, DDProperties properties)
{
super(blockID, material);
super(material);
this.properties = properties;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister)
public void registerBlockIcons(IIconRegister iconRegister)
{
upperTextures = new Icon[2];
lowerTextures = new Icon[2];
upperTextures = new IIcon[2];
lowerTextures = new IIcon[2];
upperTextures[0] = iconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName() + "_upper");
lowerTextures[0] = iconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName() + "_lower");
upperTextures[1] = new IconFlipped(upperTextures[0], true, false);
@ -60,7 +64,7 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
*/
@Override
@SideOnly(Side.CLIENT)
public Icon getIcon(int side, int metadata)
public IIcon getIcon(int side, int metadata)
{
return this.upperTextures[0];
}
@ -88,7 +92,7 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
final int MAGIC_CONSTANT = 1003;
int metadata = this.getFullMetadata(world, x, y, z);
int metadata = world.getBlockMetadata(x, y, z);
int lowMeta = metadata & 7;
lowMeta ^= 4;
@ -112,7 +116,7 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
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));
world.setTileEntity(x, y, z, this.createNewTileEntity(world, world.getBlockMetadata(x, y, z)));
this.updateAttachedTile(world, x, y, z);
}
@ -121,11 +125,11 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
*/
@Override
@SideOnly(Side.CLIENT)
public Icon getBlockTexture(IBlockAccess blockAccess, int x, int y, int z, int side)
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side)
{
if (side != 1 && side != 0)
{
int fullMetadata = this.getFullMetadata(blockAccess, x, y, z);
int fullMetadata = blockAccess.getBlockMetadata(x, y, z);
int orientation = fullMetadata & 3;
boolean reversed = false;
@ -186,13 +190,13 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
public BaseDimDoor updateAttachedTile(World world, int x, int y, int z)
{
mod_pocketDim.proxy.updateDoorTE(this, world, x, y, z);
TileEntity tile = world.getBlockTileEntity(x, y, z);
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileEntityDimDoor)
{
int metadata = world.getBlockMetadata(x, y, z);
TileEntityDimDoor dimTile = (TileEntityDimDoor) tile;
dimTile.openOrClosed = isDoorOnRift(world, x, y, z) && isUpperDoorBlock(metadata);
dimTile.orientation = this.getFullMetadata(world, x, y, z) & 7;
dimTile.orientation = world.getBlockMetadata(x, y, z) & 7;
}
return this;
}
@ -242,7 +246,7 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
@Override
public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
this.setDoorRotation(this.getFullMetadata(par1IBlockAccess, par2, par3, par4));
this.setDoorRotation(par1IBlockAccess.getBlockMetadata(par2, par3, par4));
}
@ -334,24 +338,24 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
* their own) Args: x, y, z, neighbor blockID
*/
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, int neighborID)
public void onNeighborBlockChange(World world, int x, int y, int z, Block neighbor)
{
int metadata = world.getBlockMetadata(x, y, z);
if (isUpperDoorBlock(metadata))
{
if (world.getBlockId(x, y - 1, z) != this.blockID)
if (world.getBlock(x, y - 1, z) != this)
{
world.setBlockToAir(x, y, z);
}
if (neighborID > 0 && neighborID != this.blockID)
if (!neighbor.isAir(world, x, y, z) && neighbor != this)
{
this.onNeighborBlockChange(world, x, y - 1, z, neighborID);
this.onNeighborBlockChange(world, x, y - 1, z, neighbor);
}
}
else
{
if (world.getBlockId(x, y + 1, z) != this.blockID)
if (world.getBlock(x, y + 1, z) != this)
{
world.setBlockToAir(x, y, z);
if (!world.isRemote)
@ -362,9 +366,9 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
else if(this.getLockStatus(world, x, y, z)<=1)
{
boolean powered = world.isBlockIndirectlyGettingPowered(x, y, z) || world.isBlockIndirectlyGettingPowered(x, y + 1, z);
if ((powered || neighborID > 0 && Block.blocksList[neighborID].canProvidePower()) && neighborID != this.blockID)
if ((powered || !neighbor.isAir(world, x, y, z) && neighbor.canProvidePower()) && neighbor != this)
{
this.onPoweredBlockChange(world, x, y, z, powered);
this.func_150014_a(world, x, y, z, powered);
}
}
}
@ -375,22 +379,22 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
*/
@Override
@SideOnly(Side.CLIENT)
public int idPicked(World world, int x, int y, int z)
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player)
{
return this.getDoorItem();
return new ItemStack(this.getDoorItem(), 1, 0);
}
/**
* Returns the ID of the items to drop on destruction.
*/
@Override
public int idDropped(int metadata, Random random, int fortune)
public Item getItemDropped(int metadata, Random random, int fortune)
{
return isUpperDoorBlock(metadata) ? 0 : this.getDrops();
return isUpperDoorBlock(metadata) ? null : this.getDoorItem();
}
@Override
public TileEntity createNewTileEntity(World world)
public TileEntity createNewTileEntity(World world, int metadata)
{
return new TileEntityDimDoor();
}
@ -405,7 +409,7 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
}
// Check that this is the top block of the door
if (world.getBlockId(x, y - 1, z) == this.blockID)
if (world.getBlock(x, y - 1, z) == this)
{
int metadata = world.getBlockMetadata(x, y - 1, z);
boolean canUse = isDoorOpen(metadata);
@ -418,7 +422,7 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
{
// Teleport the entity through the link, if it exists
DimLink link = PocketManager.getLink(x, y, z, world.provider.dimensionId);
if (link != null)
if (link != null && (link.linkType() != LinkType.PERSONAL || entity instanceof EntityPlayer))
{
try
{
@ -433,10 +437,10 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
// 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);
this.func_150014_a(world, x, y, z, false);
}
}
else if (world.getBlockId(x, y + 1, z) == this.blockID)
else if (world.getBlock(x, y + 1, z) == this)
{
enterDimDoor(world, x, y + 1, z, entity);
}
@ -525,20 +529,20 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
@Override
public TileEntity initDoorTE(World world, int x, int y, int z)
{
TileEntity te = this.createNewTileEntity(world);
world.setBlockTileEntity(x, y, z, te);
TileEntity te = this.createNewTileEntity(world, world.getBlockMetadata(x, y, z));
world.setTileEntity(x, y, z, te);
return te;
}
@Override
public void breakBlock(World world, int x, int y, int z, int oldBlockID, int oldMeta)
public void breakBlock(World world, int x, int y, int z, Block oldBlock, int oldMeta)
{
// This function runs on the server side after a block is replaced
// We MUST call super.breakBlock() since it involves removing tile entities
super.breakBlock(world, x, y, z, oldBlockID, oldMeta);
super.breakBlock(world, x, y, z, oldBlock, oldMeta);
// Schedule rift regeneration for this block if it was replaced
if (world.getBlockId(x, y, z) != oldBlockID)
if (world.getBlock(x, y, z) != oldBlock)
{
mod_pocketDim.riftRegenerator.scheduleFastRegeneration(x, y, z, world);
}

View file

@ -6,14 +6,14 @@ import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
@ -25,11 +25,11 @@ 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[3];
private IIcon[] blockIcon = new IIcon[3];
public BlockDimWall(int blockID, int j, Material par2Material)
public BlockDimWall(int j, Material par2Material)
{
super(blockID, par2Material);
super(par2Material);
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
}
@ -65,7 +65,7 @@ public class BlockDimWall extends Block
}
@Override
public void registerIcons(IconRegister par1IconRegister)
public void registerBlockIcons(IIconRegister par1IconRegister)
{
this.blockIcon[0] = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName());
this.blockIcon[1] = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName() + "Perm");
@ -74,7 +74,7 @@ public class BlockDimWall extends Block
@SideOnly(Side.CLIENT)
@Override
public Icon getIcon(int par1, int par2)
public IIcon getIcon(int par1, int par2)
{
switch(par2)
{
@ -99,7 +99,7 @@ public class BlockDimWall extends Block
@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
@SideOnly(Side.CLIENT)
public void getSubBlocks(int unknown, CreativeTabs tab, List subItems)
public void getSubBlocks(Item unknown, CreativeTabs tab, List subItems)
{
for (int ix = 0; ix < 3; ix++)
{
@ -139,9 +139,9 @@ public class BlockDimWall extends Block
// Some mods may override that function and use item IDs outside the range
// of the block list.
int blockID = ((ItemBlock) playerEquip).getBlockID();
Block block = Block.blocksList[blockID];
if (!Block.isNormalCube(blockID) || block instanceof BlockContainer || blockID == this.blockID)
ItemBlock playerEquipItemBlock = (ItemBlock)playerEquip;
Block block = playerEquipItemBlock.field_150939_a;
if (!block.isNormalCube(world, x, y, z) || block instanceof BlockContainer || block == this)
{
return false;
}
@ -151,7 +151,7 @@ public class BlockDimWall extends Block
{
entityPlayer.getCurrentEquippedItem().stackSize--;
}
world.setBlock(x, y, z, entityPlayer.getCurrentEquippedItem().itemID, entityPlayer.getCurrentEquippedItem().getItemDamage(), 0);
world.setBlock(x, y, z, block, playerEquipItemBlock.getMetadata(entityPlayer.getCurrentEquippedItem().getItemDamage()), 0);
}
return true;
}

View file

@ -4,7 +4,7 @@ import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
@ -22,16 +22,16 @@ public class BlockDimWallPerm extends Block
private static final Random random = new Random();
private static DDProperties properties = null;
public BlockDimWallPerm(int i, int j, Material par2Material)
public BlockDimWallPerm(int j, Material par2Material)
{
super(i, Material.ground);
super(Material.ground);
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
if (properties == null)
properties = DDProperties.instance();
}
@Override
public void registerIcons(IconRegister par1IconRegister)
public void registerBlockIcons(IIconRegister par1IconRegister)
{
this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName());
}
@ -87,7 +87,7 @@ public class BlockDimWallPerm extends Block
if (Math.abs(xc) + Math.abs(zc) < random.nextInt(3) + 2 ||
Math.abs(xc) + Math.abs(zc) < random.nextInt(3) + 3)
{
overworld.setBlock(destinationX + xc, destinationY - 1, destinationZ + zc, properties.LimboBlockID);
overworld.setBlock(destinationX + xc, destinationY - 1, destinationZ + zc, mod_pocketDim.blockLimbo);
}
}
}

View file

@ -5,8 +5,7 @@ import java.util.Random;
import net.minecraft.block.BlockDoor;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.IconFlipped;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.util.Icon;
import net.minecraft.item.Item;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
@ -15,9 +14,9 @@ import cpw.mods.fml.relauncher.SideOnly;
public class BlockDoorGold extends BlockDoor
{
public BlockDoorGold(int par1, Material par2Material)
public BlockDoorGold(Material par2Material)
{
super(par1, par2Material);
super( par2Material);
}
@SideOnly(Side.CLIENT)
@ -28,8 +27,8 @@ public class BlockDoorGold extends BlockDoor
@Override
public int idDropped(int par1, Random par2Random, int par3)
public Item getItemDropped(int par1, Random par2Random, int par3)
{
return (par1 & 8) != 0 ? 0 : mod_pocketDim.itemGoldenDoor.itemID;
return (par1 & 8) != 0 ? null : mod_pocketDim.itemGoldenDoor;
}
}

View file

@ -6,12 +6,13 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.BlockDoor;
import net.minecraft.block.material.Material;
import net.minecraft.item.Item;
public class BlockDoorQuartz extends BlockDoor
{
public BlockDoorQuartz(int par1, Material par2Material)
public BlockDoorQuartz(Material par2Material)
{
super(par1, par2Material);
super(par2Material);
}
@SideOnly(Side.CLIENT)
@ -21,8 +22,8 @@ public class BlockDoorQuartz extends BlockDoor
}
@Override
public int idDropped(int par1, Random par2Random, int par3)
public Item getItemDropped(int par1, Random par2Random, int par3)
{
return (par1 & 8) != 0 ? 0 : mod_pocketDim.itemGoldenDoor.itemID;
return (par1 & 8) != 0 ? null : mod_pocketDim.itemGoldenDoor;
}
}

View file

@ -9,21 +9,22 @@ import StevenDimDoors.mod_pocketDim.core.PocketManager;
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoorGold;
import net.minecraft.block.material.Material;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class BlockGoldDimDoor extends BaseDimDoor
{
public BlockGoldDimDoor(int blockID, Material material, DDProperties properties)
public BlockGoldDimDoor(Material material, DDProperties properties)
{
super(blockID, material, properties);
super( material, properties);
}
@Override
public void placeLink(World world, int x, int y, int z)
{
if (!world.isRemote && world.getBlockId(x, y - 1, z) == this.blockID)
if (!world.isRemote && world.getBlock(x, y - 1, z) == this)
{
NewDimData dimension = PocketManager.createDimensionData(world);
DimLink link = dimension.getLink(x, y, z);
@ -35,19 +36,13 @@ public class BlockGoldDimDoor extends BaseDimDoor
}
@Override
public int getDoorItem()
public Item getDoorItem()
{
return mod_pocketDim.itemGoldenDimensionalDoor.itemID;
return mod_pocketDim.itemGoldenDimensionalDoor;
}
@Override
public int getDrops()
{
return mod_pocketDim.itemGoldenDoor.itemID;
}
@Override
public TileEntity createNewTileEntity(World world)
public TileEntity createNewTileEntity(World world, int metadata)
{
return new TileEntityDimDoorGold();
}

View file

@ -4,8 +4,8 @@ import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.util.Icon;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
@ -18,9 +18,9 @@ public class BlockLimbo extends Block
private final int limboDimensionID;
private final LimboDecay decay;
public BlockLimbo(int i, int j, Material par2Material, int limboDimensionID, LimboDecay decay)
public BlockLimbo(int j, Material par2Material, int limboDimensionID, LimboDecay decay)
{
super(i, Material.ground);
super(Material.ground);
this.limboDimensionID = limboDimensionID;
this.decay = decay;
this.setTickRandomly(true);
@ -32,19 +32,19 @@ public class BlockLimbo extends Block
*/
@SideOnly(Side.CLIENT)
@Override
public Icon getBlockTexture(IBlockAccess blockAccess, int x, int y, int z, int side)
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side)
{
return this.getIcon(side, blockAccess.getBlockMetadata(x, y, z));
}
@Override
public void registerIcons(IconRegister iconRegister)
public void registerBlockIcons(IIconRegister iconRegister)
{
this.blockIcon = iconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName());
}
@Override
public Icon getIcon(int par1, int par2)
public IIcon getIcon(int par1, int par2)
{
return this.blockIcon;
}

View file

@ -7,15 +7,18 @@ import java.util.Queue;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFlowing;
import net.minecraft.block.BlockFluid;
import net.minecraft.block.BlockLiquid;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fluids.IFluidBlock;
@ -47,48 +50,48 @@ public class BlockRift extends Block implements ITileEntityProvider
public static final int MAX_WORLD_THREAD_DROP_CHANCE = 1000;
private final DDProperties properties;
private final ArrayList<Integer> blocksImmuneToRift; // List of Vanilla blocks immune to rifts
private final ArrayList<Integer> modBlocksImmuneToRift; // List of DD blocks immune to rifts
private final ArrayList<Block> blocksImmuneToRift; // List of Vanilla blocks immune to rifts
private final ArrayList<Block> modBlocksImmuneToRift; // List of DD blocks immune to rifts
public BlockRift(int i, int j, Material par2Material, DDProperties properties)
public BlockRift(int j, Material par2Material, DDProperties properties)
{
super(i, par2Material);
super(par2Material);
this.setTickRandomly(true);
this.properties = properties;
this.modBlocksImmuneToRift = new ArrayList<Integer>();
this.modBlocksImmuneToRift.add(properties.FabricBlockID);
this.modBlocksImmuneToRift.add(properties.PermaFabricBlockID);
this.modBlocksImmuneToRift.add(properties.DimensionalDoorID);
this.modBlocksImmuneToRift.add(properties.WarpDoorID);
this.modBlocksImmuneToRift.add(properties.TransTrapdoorID);
this.modBlocksImmuneToRift.add(properties.UnstableDoorID);
this.modBlocksImmuneToRift.add(properties.RiftBlockID);
this.modBlocksImmuneToRift.add(properties.TransientDoorID);
this.modBlocksImmuneToRift.add(properties.GoldenDimensionalDoorID);
this.modBlocksImmuneToRift.add(properties.GoldenDoorID);
this.modBlocksImmuneToRift = new ArrayList<Block>();
this.modBlocksImmuneToRift.add(mod_pocketDim.blockDimWall);
this.modBlocksImmuneToRift.add(mod_pocketDim.blockDimWallPerm);
this.modBlocksImmuneToRift.add(mod_pocketDim.dimensionalDoor);
this.modBlocksImmuneToRift.add(mod_pocketDim.warpDoor);
this.modBlocksImmuneToRift.add(mod_pocketDim.transTrapdoor);
this.modBlocksImmuneToRift.add(mod_pocketDim.unstableDoor);
this.modBlocksImmuneToRift.add(mod_pocketDim.blockRift);
this.modBlocksImmuneToRift.add(mod_pocketDim.transientDoor);
this.modBlocksImmuneToRift.add(mod_pocketDim.goldenDimensionalDoor);
this.modBlocksImmuneToRift.add(mod_pocketDim.goldenDoor);
this.blocksImmuneToRift = new ArrayList<Integer>();
this.blocksImmuneToRift = new ArrayList<Block>();
this.blocksImmuneToRift.add(properties.FabricBlockID);
this.blocksImmuneToRift.add(properties.PermaFabricBlockID);
this.blocksImmuneToRift.add(properties.DimensionalDoorID);
this.blocksImmuneToRift.add(properties.WarpDoorID);
this.blocksImmuneToRift.add(properties.TransTrapdoorID);
this.blocksImmuneToRift.add(properties.UnstableDoorID);
this.blocksImmuneToRift.add(properties.RiftBlockID);
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);
this.blocksImmuneToRift.add(Block.blockGold.blockID);
this.blocksImmuneToRift.add(Block.blockDiamond.blockID);
this.blocksImmuneToRift.add(Block.blockEmerald.blockID);
this.blocksImmuneToRift.add(mod_pocketDim.blockDimWall);
this.blocksImmuneToRift.add(mod_pocketDim.blockDimWallPerm);
this.blocksImmuneToRift.add(mod_pocketDim.dimensionalDoor);
this.blocksImmuneToRift.add(mod_pocketDim.warpDoor);
this.blocksImmuneToRift.add(mod_pocketDim.transTrapdoor);
this.blocksImmuneToRift.add(mod_pocketDim.unstableDoor);
this.blocksImmuneToRift.add(mod_pocketDim.blockRift);
this.blocksImmuneToRift.add(mod_pocketDim.transientDoor);
this.blocksImmuneToRift.add(mod_pocketDim.goldenDimensionalDoor);
this.blocksImmuneToRift.add(mod_pocketDim.goldenDoor);
this.blocksImmuneToRift.add(mod_pocketDim.personalDimDoor);
this.blocksImmuneToRift.add(Blocks.lapis_block);
this.blocksImmuneToRift.add(Blocks.iron_block);
this.blocksImmuneToRift.add(Blocks.gold_block);
this.blocksImmuneToRift.add(Blocks.diamond_block);
this.blocksImmuneToRift.add(Blocks.emerald_block);
}
@Override
public void registerIcons(IconRegister par1IconRegister)
public void registerBlockIcons(IIconRegister par1IconRegister)
{
this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName());
}
@ -166,7 +169,7 @@ public class BlockRift extends Block implements ITileEntityProvider
//Randomly decide whether to search for blocks to destroy. This reduces the frequency of search operations,
//moderates performance impact, and controls the apparent speed of block destruction.
if (random.nextInt(MAX_BLOCK_SEARCH_CHANCE) < BLOCK_SEARCH_CHANCE &&
((TileEntityRift) world.getBlockTileEntity(x, y, z)).updateNearestRift() )
((TileEntityRift) world.getTileEntity(x, y, z)).updateNearestRift() )
{
destroyNearbyBlocks(world, x, y, z, random);
}
@ -184,8 +187,8 @@ public class BlockRift extends Block implements ITileEntityProvider
{
if (random.nextInt(MAX_BLOCK_DESTRUCTION_CHANCE) < BLOCK_DESTRUCTION_CHANCE)
{
dropWorldThread(world.getBlockId(target.getX(), target.getY(), target.getZ()), world, x, y, z, random);
world.destroyBlock(target.getX(), target.getY(), target.getZ(), false);
dropWorldThread(world.getBlock(target.getX(), target.getY(), target.getZ()), world, x, y, z, random);
world.func_147480_a(target.getX(), target.getY(), target.getZ(), false);
}
}
}
@ -231,12 +234,11 @@ public class BlockRift extends Block implements ITileEntityProvider
return targets;
}
public void dropWorldThread(int blockID, World world, int x, int y, int z, Random random)
public void dropWorldThread(Block block, World world, int x, int y, int z, Random random)
{
if (blockID != 0 && (random.nextInt(MAX_WORLD_THREAD_DROP_CHANCE) < properties.WorldThreadDropChance)
&& !(Block.blocksList[blockID] instanceof BlockFlowing ||
Block.blocksList[blockID] instanceof BlockFluid ||
Block.blocksList[blockID] instanceof IFluidBlock))
if (!block.isAir(world, x, y, z) && (random.nextInt(MAX_WORLD_THREAD_DROP_CHANCE) < properties.WorldThreadDropChance)
&& !(block instanceof BlockLiquid ||
block instanceof IFluidBlock))
{
ItemStack thread = new ItemStack(mod_pocketDim.itemWorldThread, 1);
world.spawnEntityInWorld(new EntityItem(world, x, y, z, thread));
@ -265,7 +267,8 @@ public class BlockRift extends Block implements ITileEntityProvider
public boolean spreadRift(NewDimData dimension, DimLink parent, World world, Random random)
{
int x, y, z, blockID;
int x, y, z;
Block block = null;
Point4D source = parent.source();
// Find reachable blocks that are vulnerable to rift damage and include air
@ -281,11 +284,11 @@ public class BlockRift extends Block implements ITileEntityProvider
z = target.getZ();
// Create a child, replace the block with a rift, and consider dropping World Thread
blockID = world.getBlockId(x, y, z);
if (world.setBlock(x, y, z, properties.RiftBlockID))
block = world.getBlock(x, y, z);
if (world.setBlock(x, y, z, mod_pocketDim.blockRift))
{
dimension.createChildLink(x, y, z, parent);
dropWorldThread(blockID, world, x, y, z, random);
dropWorldThread(block, world, x, y, z, random);
return true;
}
}
@ -314,7 +317,7 @@ public class BlockRift extends Block implements ITileEntityProvider
ArrayList<Point3D> targets=findReachableBlocks(world, x, y, z, 2, false);
TileEntityRift tile = (TileEntityRift)world.getBlockTileEntity(x, y, z);
TileEntityRift tile = (TileEntityRift)world.getTileEntity(x, y, z);
if(rand.nextBoolean())
@ -335,14 +338,14 @@ public class BlockRift extends Block implements ITileEntityProvider
{
if (world != null && !isBlockImmune(world, x, y, z))
{
return world.setBlock(x, y, z, mod_pocketDim.blockRift.blockID);
return world.setBlock(x, y, z, mod_pocketDim.blockRift);
}
return false;
}
public boolean isBlockImmune(World world, int x, int y, int z)
{
Block block = Block.blocksList[world.getBlockId(x, y, z)];
Block block = world.getBlock(x, y, z);
if (block != null)
{
// SenseiKiwi: I've switched to using the block's blast resistance instead of its
@ -352,8 +355,8 @@ public class BlockRift extends Block implements ITileEntityProvider
// I've set this to access blockResistance directly. Might need changing later.
return (block.blockResistance >= MIN_IMMUNE_RESISTANCE ||
modBlocksImmuneToRift.contains(block.blockID) ||
blocksImmuneToRift.contains(block.blockID));
modBlocksImmuneToRift.contains(block) ||
blocksImmuneToRift.contains(block));
}
return false;
}
@ -362,41 +365,41 @@ public class BlockRift extends Block implements ITileEntityProvider
{
// Check whether the block at the specified location is one of the
// rift-resistant blocks from DD.
Block block = Block.blocksList[world.getBlockId(x, y, z)];
Block block = world.getBlock(x, y, z);
if (block != null)
{
return modBlocksImmuneToRift.contains(block.blockID);
return modBlocksImmuneToRift.contains(block);
}
return false;
}
@Override
public int idPicked(World par1World, int par2, int par3, int par4)
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player)
{
return 0;
return null;
}
@Override
public int idDropped(int par1, Random par2Random, int par3)
public Item getItemDropped(int par1, Random par2Random, int par3)
{
return 0;
return null;
}
@Override
public TileEntity createNewTileEntity(World world)
public TileEntity createNewTileEntity(World world, int metadata)
{
return new TileEntityRift();
}
@Override
public void breakBlock(World world, int x, int y, int z, int oldBlockID, int oldMeta)
public void breakBlock(World world, int x, int y, int z, Block oldBlock, int oldMeta)
{
// This function runs on the server side after a block is replaced
// We MUST call super.breakBlock() since it involves removing tile entities
super.breakBlock(world, x, y, z, oldBlockID, oldMeta);
super.breakBlock(world, x, y, z, oldBlock, oldMeta);
// Schedule rift regeneration for this block if it was changed
if (world.getBlockId(x, y, z) != oldBlockID)
if (world.getBlock(x, y, z) != oldBlock)
{
mod_pocketDim.riftRegenerator.scheduleSlowRegeneration(x, y, z, world);
}

View file

@ -12,15 +12,15 @@ import StevenDimDoors.mod_pocketDim.core.PocketManager;
public class DimensionalDoor extends BaseDimDoor
{
public DimensionalDoor(int blockID, Material material, DDProperties properties)
public DimensionalDoor(Material material, DDProperties properties)
{
super(blockID, material, properties);
super(material, properties);
}
@Override
public void placeLink(World world, int x, int y, int z)
{
if (!world.isRemote && world.getBlockId(x, y - 1, z) == this.blockID)
if (!world.isRemote && world.getBlock(x, y - 1, z) == this)
{
NewDimData dimension = PocketManager.createDimensionData(world);
DimLink link = dimension.getLink(x, y, z);
@ -32,14 +32,8 @@ public class DimensionalDoor extends BaseDimDoor
}
@Override
public int getDoorItem()
public Item getDoorItem()
{
return mod_pocketDim.itemDimensionalDoor.itemID;
}
@Override
public int getDrops()
{
return Item.doorIron.itemID;
return mod_pocketDim.itemDimensionalDoor;
}
}

View file

@ -1,6 +1,7 @@
package StevenDimDoors.mod_pocketDim.blocks;
import net.minecraft.entity.Entity;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
@ -25,9 +26,7 @@ public interface IDimDoor
*/
public void placeLink(World world, int x, int y, int z);
public int getDrops();
public int getDoorItem();
public Item getDoorItem();
public TileEntity initDoorTE(World world, int x, int y, int z);

View file

@ -1,6 +1,7 @@
package StevenDimDoors.mod_pocketDim.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.item.Item;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.config.DDProperties;
@ -12,16 +13,16 @@ import StevenDimDoors.mod_pocketDim.core.PocketManager;
public class PersonalDimDoor extends BaseDimDoor
{
public PersonalDimDoor(int blockID, Material material, DDProperties properties)
public PersonalDimDoor(Material material, DDProperties properties)
{
super(blockID, material, properties);
super( 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)
if (!world.isRemote && world.getBlock(x, y - 1, z) == this)
{
NewDimData dimension = PocketManager.getDimensionData(world);
DimLink link = dimension.getLink(x, y, z);
@ -33,15 +34,9 @@ public class PersonalDimDoor extends BaseDimDoor
}
@Override
public int getDrops()
public Item getDoorItem()
{
return mod_pocketDim.itemQuartzDoor.itemID;
}
@Override
public int getDoorItem()
{
return mod_pocketDim.itemPersonalDoor.itemID;
return mod_pocketDim.itemPersonalDoor;
}
}

View file

@ -9,11 +9,15 @@ 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.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.core.DDTeleporter;
@ -27,14 +31,14 @@ import StevenDimDoors.mod_pocketDim.tileentities.TileEntityTransTrapdoor;
public class TransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntityProvider
{
public TransTrapdoor(int blockID, Material material)
public TransTrapdoor(Material material)
{
super(blockID, material);
super(material);
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
}
@Override
public void registerIcons(IconRegister par1IconRegister)
public void registerBlockIcons(IIconRegister par1IconRegister)
{
this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName());
}
@ -92,20 +96,20 @@ public class TransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntit
{
if(this.checkCanOpen(par1World, par2, par3, par4))
{
super.onPoweredBlockChange(par1World, par2, par3, par4, par5);
super.func_150120_a(par1World, par2, par3, par4, par5);
}
}
@Override
public void enterDimDoor(World world, int x, int y, int z, Entity entity)
{
if (!world.isRemote && isTrapdoorOpen(world.getBlockMetadata(x, y, z)))
if (!world.isRemote && func_150118_d(world.getBlockMetadata(x, y, z)))
{
DimLink link = PocketManager.getLink(x, y, z, world);
if (link != null)
if (link != null && (link.linkType() != LinkType.PERSONAL || entity instanceof EntityPlayer))
{
DDTeleporter.traverseDimDoor(world, link, entity,this);
}
super.onPoweredBlockChange(world, x, y, z, false);
super.func_150120_a(world, x, y, z, false);
}
}
@ -113,11 +117,11 @@ public class TransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntit
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));
world.setTileEntity(x, y, z, this.createNewTileEntity(world, world.getBlockMetadata(x, y, z)));
}
@Override
public TileEntity createNewTileEntity(World world)
public TileEntity createNewTileEntity(World world, int metadata)
{
return new TileEntityTransTrapdoor();
}
@ -138,27 +142,21 @@ public class TransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntit
@Override
@SideOnly(Side.CLIENT)
public int idPicked(World world, int x, int y, int z)
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player)
{
return this.getDoorItem();
return new ItemStack(this.getDoorItem(), 1, 0);
}
@Override
public int idDropped(int metadata, Random random, int fortuneLevel)
public Item getItemDropped(int metadata, Random random, int fortuneLevel)
{
return this.getDrops();
return Item.getItemFromBlock(Blocks.trapdoor);
}
@Override
public int getDoorItem()
public Item getDoorItem()
{
return mod_pocketDim.transTrapdoor.blockID;
}
@Override
public int getDrops()
{
return Block.trapdoor.blockID;
return Item.getItemFromBlock(mod_pocketDim.transTrapdoor);
}
public static boolean isTrapdoorSetLow(int metadata)
@ -169,8 +167,8 @@ public class TransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntit
@Override
public TileEntity initDoorTE(World world, int x, int y, int z)
{
TileEntity te = this.createNewTileEntity(world);
world.setBlockTileEntity(x, y, z, te);
TileEntity te = this.createNewTileEntity(world, world.getBlockMetadata(x, y, z));
world.setTileEntity(x, y, z, te);
return te;
}
@ -181,14 +179,14 @@ public class TransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntit
}
@Override
public void breakBlock(World world, int x, int y, int z, int oldBlockID, int oldMeta)
public void breakBlock(World world, int x, int y, int z, Block oldBlock, int oldMeta)
{
// This function runs on the server side after a block is replaced
// We MUST call super.breakBlock() since it involves removing tile entities
super.breakBlock(world, x, y, z, oldBlockID, oldMeta);
super.breakBlock(world, x, y, z, oldBlock, oldMeta);
// Schedule rift regeneration for this block if it was replaced
if (world.getBlockId(x, y, z) != oldBlockID)
if (world.getBlock(x, y, z) != oldBlock)
{
mod_pocketDim.riftRegenerator.scheduleFastRegeneration(x, y, z, world);
}

View file

@ -1,9 +1,11 @@
package StevenDimDoors.mod_pocketDim.blocks;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.config.DDProperties;
@ -15,9 +17,9 @@ import StevenDimDoors.mod_pocketDim.core.PocketManager;
public class TransientDoor extends BaseDimDoor
{
public TransientDoor(int blockID, Material material, DDProperties properties)
public TransientDoor(Material material, DDProperties properties)
{
super(blockID, material, properties);
super(material, properties);
}
@Override
@ -30,7 +32,7 @@ public class TransientDoor extends BaseDimDoor
}
// Check that this is the top block of the door
if (world.getBlockId(x, y - 1, z) == this.blockID)
if (world.getBlock(x, y - 1, z) == this)
{
boolean canUse = true;
int metadata = world.getBlockMetadata(x, y - 1, z);
@ -45,15 +47,17 @@ public class TransientDoor extends BaseDimDoor
DimLink link = PocketManager.getLink(x, y, z, world.provider.dimensionId);
if (link != null)
{
if (link.linkType() != LinkType.PERSONAL || entity instanceof EntityPlayer) {
DDTeleporter.traverseDimDoor(world, link, entity, this);
// 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.setBlock(x, y, z, mod_pocketDim.blockRift);
world.setBlockToAir(x, y - 1, z);
}
}
}
else if (world.getBlockId(x, y + 1, z) == this.blockID)
}
else if (world.getBlock(x, y + 1, z) == this)
{
enterDimDoor(world, x, y + 1, z, entity);
}
@ -62,7 +66,7 @@ public class TransientDoor extends BaseDimDoor
@Override
public void placeLink(World world, int x, int y, int z)
{
if (!world.isRemote && world.getBlockId(x, y - 1, z) == this.blockID)
if (!world.isRemote && world.getBlock(x, y - 1, z) == this)
{
NewDimData dimension = PocketManager.createDimensionData(world);
DimLink link = dimension.getLink(x, y, z);
@ -74,15 +78,9 @@ public class TransientDoor extends BaseDimDoor
}
@Override
public int getDoorItem()
public Item getDoorItem()
{
return 0;
}
@Override
public int getDrops()
{
return 0;
return null;
}
@Override

View file

@ -1,7 +1,9 @@
package StevenDimDoors.mod_pocketDim.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.config.DDProperties;
@ -9,17 +11,20 @@ import StevenDimDoors.mod_pocketDim.core.LinkType;
import StevenDimDoors.mod_pocketDim.core.NewDimData;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import java.util.ArrayList;
import java.util.Random;
public class UnstableDoor extends BaseDimDoor
{
public UnstableDoor(int blockID, Material material, DDProperties properties)
public UnstableDoor(Material material, DDProperties properties)
{
super(blockID, material, properties);
super(material, properties);
}
@Override
public void placeLink(World world, int x, int y, int z)
{
if (!world.isRemote && world.getBlockId(x, y - 1, z) == this.blockID)
if (!world.isRemote && world.getBlock(x, y - 1, z) == this)
{
NewDimData dimension = PocketManager.getDimensionData(world);
dimension.createLink(x, y, z, LinkType.RANDOM,world.getBlockMetadata(x, y - 1, z));
@ -27,14 +32,14 @@ public class UnstableDoor extends BaseDimDoor
}
@Override
public int getDoorItem()
public Item getDoorItem()
{
return mod_pocketDim.itemUnstableDoor.itemID;
return mod_pocketDim.itemUnstableDoor;
}
@Override
public int getDrops()
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
{
return Item.doorIron.itemID;
return Items.iron_door;
}
}

View file

@ -12,15 +12,15 @@ import StevenDimDoors.mod_pocketDim.core.PocketManager;
public class WarpDoor extends BaseDimDoor
{
public WarpDoor(int blockID, Material material, DDProperties properties)
public WarpDoor(Material material, DDProperties properties)
{
super(blockID, material, properties);
super(material, properties);
}
@Override
public void placeLink(World world, int x, int y, int z)
{
if (!world.isRemote && world.getBlockId(x, y - 1, z) == this.blockID)
if (!world.isRemote && world.getBlock(x, y - 1, z) == this)
{
NewDimData dimension = PocketManager.createDimensionData(world);
DimLink link = dimension.getLink(x, y, z);
@ -32,14 +32,8 @@ public class WarpDoor extends BaseDimDoor
}
@Override
public int getDoorItem()
public Item getDoorItem()
{
return mod_pocketDim.itemWarpDoor.itemID;
}
@Override
public int getDrops()
{
return Item.doorWood.itemID;
return mod_pocketDim.itemWarpDoor;
}
}

View file

@ -4,7 +4,7 @@ import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommand;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ChatMessageComponent;
import net.minecraft.util.ChatComponentText;
/*
* An abstract base class for our Dimensional Doors commands. This cleans up the code a little and provides
@ -85,9 +85,8 @@ public abstract class DDCommandBase extends CommandBase
public static void sendChat(EntityPlayer player, String message)
{
ChatMessageComponent cmp = new ChatMessageComponent();
cmp.addText(message);
player.sendChatToPlayer(cmp);
ChatComponentText text = new ChatComponentText(message);
player.addChatMessage(text);
}
/*

View file

@ -2,56 +2,14 @@ package StevenDimDoors.mod_pocketDim.config;
import java.io.File;
import net.minecraftforge.common.Configuration;
import StevenDimDoors.mod_pocketDim.blocks.BlockRift;
import StevenDimDoors.mod_pocketDim.ticking.CustomLimboPopulator;
import StevenDimDoors.mod_pocketDim.world.fortresses.DDStructureNetherBridgeStart;
import StevenDimDoors.mod_pocketDim.world.gateways.GatewayGenerator;
import net.minecraftforge.common.config.Configuration;
public class DDProperties
{
/**
* Block IDs
*/
public final int UnstableDoorID;
public final int DimensionalDoorID;
public final int GoldenDoorID;
public final int GoldenDimensionalDoorID;
public final int WarpDoorID;
public final int TransTrapdoorID;
public final int TransientDoorID;
public final int FabricBlockID;
public final int RiftBlockID;
public final int QuartzDoorID;
public final int PersonalDimDoorID;
/**
* World Generation Block IDs
*/
public final int LimboBlockID;
public final int PermaFabricBlockID;
/**
* Item IDs
*/
public final int RiftBladeItemID;
public final int RiftSignatureItemID;
public final int GoldenDimensionalDoorItemID;
public final int GoldenDoorItemID;
public final int RiftRemoverItemID;
public final int StableFabricItemID;
public final int StabilizedRiftSignatureItemID;
public final int DimensionalDoorItemID;
public final int UnstableDoorItemID;
public final int WarpDoorItemID;
public final int WorldThreadItemID;
public final int DDKeyItemID;
public final int ItemQuartzDoorID;
public final int ItemPersonalDimDoorID;
/**
* Other IDs
@ -195,38 +153,6 @@ public class DDProperties
DoorRenderEntityID = config.get(CATEGORY_ENTITY, "Door Render Entity ID", 89).getInt();
MonolithEntityID = config.get(CATEGORY_ENTITY, "Monolith Entity ID", 125).getInt();
DimensionalDoorID = config.getBlock("Dimensional Door Block ID", 1970).getInt();
TransTrapdoorID = config.getBlock("Transdimensional Trapdoor Block ID", 1971).getInt();
FabricBlockID =config.getBlock("Fabric Of Reality Block ID", 1973).getInt();
WarpDoorID = config.getBlock("Warp Door Block ID", 1975).getInt();
RiftBlockID = config.getBlock("Rift Block ID", 1977).getInt();
UnstableDoorID = config.getBlock("Unstable Door Block ID", 1978).getInt();
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();
StableFabricItemID = config.getItem("Stable Fabric Item ID", 5672).getInt();
UnstableDoorItemID = config.getItem("Unstable Door Item ID", 5673).getInt();
DimensionalDoorItemID = config.getItem("Dimensional Door Item ID", 5674).getInt();
RiftSignatureItemID = config.getItem("Rift Signature Item ID", 5675).getInt();
RiftBladeItemID = config.getItem("Rift Blade Item ID", 5676).getInt();
StabilizedRiftSignatureItemID = config.getItem("Stabilized Rift Signature Item ID", 5677).getInt();
GoldenDoorItemID = config.getItem("Gold Door Item ID", 5678).getInt();
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();
PermaFabricBlockID = config.getTerrainBlock("World Generation Block IDs - must be less than 256",
"Perma Fabric Block ID", 220, "Blocks used for enclosing pocket dimensions").getInt();
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();
@ -259,14 +185,6 @@ public class DDProperties
PocketBiomeID = config.get(CATEGORY_BIOME, "Pocket Biome ID", 149).getInt();
config.save();
// Unfortunately, there are users out there who have been misconfiguring the worldgen blocks to have IDs above 255.
// This leads to disastrous and cryptic errors in other areas of Minecraft. To prevent headaches, we'll throw
// an exception here if the blocks have invalid IDs.
if (LimboBlockID > 255 || PermaFabricBlockID > 255)
{
throw new IllegalStateException("World generation blocks MUST have block IDs less than 256. Fix your configuration!");
}
}
public static DDProperties initialize(File configFile)

View file

@ -1,8 +1,8 @@
package StevenDimDoors.mod_pocketDim.config;
import java.io.File;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.Configuration;
import java.io.File;
public class DDWorldProperties
{

View file

@ -8,11 +8,9 @@ import net.minecraft.entity.EntityList;
import net.minecraft.entity.item.EntityMinecart;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemDoor;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.packet.Packet41EntityEffect;
import net.minecraft.network.packet.Packet43Experience;
import net.minecraft.network.packet.Packet9Respawn;
import net.minecraft.potion.PotionEffect;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
@ -59,8 +57,8 @@ public class DDTeleporter
int x = destination.getX();
int y = destination.getY();
int z = destination.getZ();
int blockIDTop;
int blockIDBottom;
Block blockTop;
Block blockBottom;
Point3D point;
switch (orientation)
@ -81,19 +79,19 @@ public class DDTeleporter
point = new Point3D(x, y - 1, z);
break;
}
blockIDBottom = world.getBlockId(point.getX(), point.getY(), point.getZ());
blockIDTop = world.getBlockId(point.getX(), point.getY() + 1, point.getZ());
blockBottom = world.getBlock(point.getX(), point.getY(), point.getZ());
blockTop = world.getBlock(point.getX(), point.getY() + 1, point.getZ());
if (Block.blocksList[blockIDBottom] != null)
if (blockBottom != null)
{
if (!Block.blocksList[blockIDBottom].isBlockReplaceable(world, point.getX(), point.getY(), point.getZ()) && world.isBlockOpaqueCube(point.getX(), point.getY(), point.getZ()))
if (!blockBottom.isReplaceable(world, point.getX(), point.getY(), point.getZ()) && world.isBlockNormalCubeDefault(point.getX(), point.getY(), point.getZ(), false))
{
return false;
}
}
if (Block.blocksList[blockIDTop] != null)
if (blockTop != null)
{
if (!Block.blocksList[blockIDTop].isBlockReplaceable(world, point.getX(), point.getY() + 1, point.getZ()))
if (!blockTop.isReplaceable(world, point.getX(), point.getY() + 1, point.getZ()))
{
return false;
}
@ -221,7 +219,7 @@ public class DDTeleporter
}
//Check if the block below that point is actually a door
Block block = Block.blocksList[world.getBlockId(door.getX(), door.getY() - 1, door.getZ())];
Block block = world.getBlock(door.getX(), door.getY() - 1, door.getZ());
if (block==null || !(block instanceof IDimDoor))
{
//Return the pocket's orientation instead
@ -394,7 +392,7 @@ public class DDTeleporter
* Also ensures correct orientation relative to the door.
* @param world - world the player is currently in
* @param link - the link the player is using to teleport; sends the player to its destination
* @param player - the instance of the player to be teleported
* @param entity - the instance of the player to be teleported
*/
public static void traverseDimDoor(World world, DimLink link, Entity entity, Block door)
{
@ -495,7 +493,7 @@ public class DDTeleporter
case POCKET:
return PocketBuilder.generateNewPocket(link, properties, door, DimensionType.POCKET);
case PERSONAL:
return setupPersonalLink(link, properties, entity, door);
return setupPersonalLink(link, properties, (EntityPlayer)entity, door);
case SAFE_EXIT:
return generateSafeExit(link, properties);
case DUNGEON_EXIT:
@ -511,14 +509,14 @@ public class DDTeleporter
}
}
private static boolean setupPersonalLink(DimLink link, DDProperties properties,Entity player, Block door)
private static boolean setupPersonalLink(DimLink link, DDProperties properties,EntityPlayer player, Block door)
{
if(!(player instanceof EntityPlayer))
{
return false;
}
NewDimData dim = PocketManager.getPersonalDimensionForPlayer(player.getEntityName());
NewDimData dim = PocketManager.getPersonalDimensionForPlayer(player.getGameProfile().getId().toString());
if(dim == null)
{
return PocketBuilder.generateNewPersonalPocket(link, properties, player, door);
@ -602,7 +600,7 @@ public class DDTeleporter
{
World startWorld = PocketManager.loadDimension(link.source().getDimension());
World destWorld = PocketManager.loadDimension(link.destination().getDimension());
TileEntity doorTE = startWorld.getBlockTileEntity(link.source().getX(), link.source().getY(), link.point.getZ());
TileEntity doorTE = startWorld.getTileEntity(link.source().getX(), link.source().getY(), link.point.getZ());
if(doorTE instanceof TileEntityDimDoor)
{
if((TileEntityDimDoor.class.cast(doorTE).hasGennedPair))
@ -610,11 +608,11 @@ public class DDTeleporter
return;
}
TileEntityDimDoor.class.cast(doorTE).hasGennedPair=true;
Block blockToReplace = Block.blocksList[destWorld.getBlockId(link.destination().getX(), link.destination().getY(), link.destination().getZ())];
Block blockToReplace = destWorld.getBlock(link.destination().getX(), link.destination().getY(), link.destination().getZ());
if(!destWorld.isAirBlock(link.destination().getX(), link.destination().getY(), link.destination().getZ()))
{
if(!blockToReplace.isBlockReplaceable(destWorld, link.destination().getX(), link.destination().getY(), link.destination().getZ()))
if(!blockToReplace.isReplaceable(destWorld, link.destination().getX(), link.destination().getY(), link.destination().getZ()))
{
return;
}
@ -739,9 +737,9 @@ public class DDTeleporter
// Checking if the block is not an opaque solid is equivalent
// checking for a replaceable block, because we only allow
// exits intersecting blocks on those two surfaces.
if (!world.isBlockNormalCube(x + dx, y, z + dz))
if (!world.isBlockNormalCubeDefault(x + dx, y, z + dz, false))
{
world.setBlock(x + dx, y, z + dz, properties.FabricBlockID, 0, 2);
world.setBlock(x + dx, y, z + dz, mod_pocketDim.blockDimWall, 0, 2);
}
}
}
@ -755,7 +753,7 @@ public class DDTeleporter
{
for (int dz = -1; dz <= 1; dz++)
{
world.setBlock(x + dx, y + dy, z + dz, 0, 0, 2);
world.setBlock(x + dx, y + dy, z + dz, Blocks.air, 0, 2);
}
}
}
@ -768,7 +766,7 @@ public class DDTeleporter
sourceDim.setLinkDestination(reverse, source.getX(), source.getY(), source.getZ());
// Set up the warp door at the destination
orientation = BlockRotator.transformMetadata(orientation, 2, properties.WarpDoorID);
orientation = BlockRotator.transformMetadata(orientation, 2, mod_pocketDim.warpDoor);
ItemDoor.placeDoorBlock(world, x, y + 1, z, orientation, mod_pocketDim.warpDoor);
// Complete the link to the destination

View file

@ -8,6 +8,7 @@ import java.util.Random;
import java.util.Stack;
import java.util.TreeMap;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.watcher.ClientLinkData;
import net.minecraft.item.ItemStack;
import net.minecraft.world.ChunkCoordIntPair;
@ -251,7 +252,7 @@ public abstract class NewDimData implements IPackable<PackedDimData>
for (k = -range; k <= range; k++)
{
distance = getAbsoluteSum(i, j, k);
if (distance > 0 && distance < minDistance && world.getBlockId(x + i, y + j, z + k) == properties.RiftBlockID)
if (distance > 0 && distance < minDistance && world.getBlock(x + i, y + j, z + k) == mod_pocketDim.blockRift)
{
link = getLink(x + i, y + j, z + k);
if (link != null)
@ -290,7 +291,7 @@ public abstract class NewDimData implements IPackable<PackedDimData>
for (k = -range; k <= range; k++)
{
distance = getAbsoluteSum(i, j, k);
if (distance > 0 && world.getBlockId(x + i, y + j, z + k) == properties.RiftBlockID)
if (distance > 0 && world.getBlock(x + i, y + j, z + k) == mod_pocketDim.blockRift)
{
link = getLink(x + i, y + j, z + k);
if (link != null)

View file

@ -11,6 +11,7 @@ import java.util.Random;
import java.util.TreeMap;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntitySign;
@ -113,7 +114,7 @@ public class DungeonSchematic extends Schematic {
applyFilter(finder);
//Flip the entrance's orientation to get the dungeon's orientation
orientation = BlockRotator.transformMetadata(finder.getEntranceOrientation(), 2, Block.doorWood.blockID);
orientation = BlockRotator.transformMetadata(finder.getEntranceOrientation(), 2, Blocks.wooden_door);
entranceDoorLocation = finder.getEntranceDoorLocation();
exitDoorLocations = finder.getExitDoorLocations();
@ -233,7 +234,7 @@ public class DungeonSchematic extends Schematic {
count = tileEntities.tagCount();
for (index = 0; index < count; index++)
{
NBTTagCompound tileTag = (NBTTagCompound) tileEntities.tagAt(index);
NBTTagCompound tileTag = (NBTTagCompound) tileEntities.getCompoundTagAt(index);
//Rewrite its location to be in world coordinates
pocketPoint.setX(tileTag.getInteger("x"));
pocketPoint.setY(tileTag.getInteger("y"));
@ -243,7 +244,7 @@ public class DungeonSchematic extends Schematic {
tileTag.setInteger("y", pocketPoint.getY());
tileTag.setInteger("z", pocketPoint.getZ());
//Load the tile entity and put it in the world
world.setBlockTileEntity(pocketPoint.getX(), pocketPoint.getY(), pocketPoint.getZ(), TileEntity.createAndLoadEntity(tileTag));
world.setTileEntity(pocketPoint.getX(), pocketPoint.getY(), pocketPoint.getZ(), TileEntity.createAndLoadEntity(tileTag));
}
setUpDungeon(PocketManager.createDimensionData(world), world, pocketCenter, turnAngle, entryLink, random, properties, blockSetter);
@ -341,9 +342,9 @@ public class DungeonSchematic extends Schematic {
int z = location.getZ();
if (y >= 0)
{
int blockID = world.getBlockId(x, y, z);
Block block = world.getBlock(x, y, z);
int metadata = world.getBlockMetadata(x, y, z);
blockSetter.setBlock(world, x, y + 1, z, blockID, metadata);
blockSetter.setBlock(world, x, y + 1, z, block, metadata);
}
initDoorTileEntity(world, location);
}
@ -365,7 +366,7 @@ public class DungeonSchematic extends Schematic {
Point3D location = point.clone();
BlockRotator.transformPoint(location, entrance, rotation, pocketCenter);
//Remove frame block
blockSetter.setBlock(world, location.getX(), location.getY(), location.getZ(), 0, 0);
blockSetter.setBlock(world, location.getX(), location.getY(), location.getZ(), Blocks.air, 0);
//Spawn Monolith
if (canSpawn)
{
@ -377,8 +378,8 @@ public class DungeonSchematic extends Schematic {
private static void initDoorTileEntity(World world, Point3D point)
{
Block door = Block.blocksList[world.getBlockId(point.getX(), point.getY(), point.getZ())];
Block door2 = Block.blocksList[world.getBlockId(point.getX(), point.getY() - 1, point.getZ())];
Block door = world.getBlock(point.getX(), point.getY(), point.getZ());
Block door2 = world.getBlock(point.getX(), point.getY() - 1, point.getZ());
if (door instanceof IDimDoor && door2 instanceof IDimDoor)
{
@ -395,7 +396,8 @@ public class DungeonSchematic extends Schematic {
{
final int SEARCH_RANGE = 6;
int x, y, z, block;
int x, y, z;
Block block;
int dx, dy, dz;
for (dy = SEARCH_RANGE; dy >= -SEARCH_RANGE; dy--)
@ -407,12 +409,12 @@ public class DungeonSchematic extends Schematic {
x = pocketCenter.getX() + dx;
y = pocketCenter.getY() + dy;
z = pocketCenter.getZ() + dz;
block = world.getBlockId(x, y, z);
if (block == Block.signWall.blockID || block == Block.signPost.blockID)
block = world.getBlock(x, y, z);
if (block == Blocks.wall_sign || block == Blocks.standing_sign)
{
TileEntitySign signEntity = new TileEntitySign();
signEntity.signText[1] = "Level " + depth;
world.setBlockTileEntity(x, y, z, signEntity);
world.setTileEntity(x, y, z, signEntity);
return;
}
}

View file

@ -7,15 +7,15 @@ public class ModBlockFilter extends SchematicFilter {
private short maxVanillaBlockID;
private short[] exceptions;
private short replacementBlockID;
private Block replacementBlock;
private byte replacementMetadata;
public ModBlockFilter(short maxVanillaBlockID, short[] exceptions, short replacementBlockID, byte replacementMetadata)
public ModBlockFilter(short maxVanillaBlockID, short[] exceptions, Block replacementBlock, byte replacementMetadata)
{
super("ModBlockFilter");
this.maxVanillaBlockID = maxVanillaBlockID;
this.exceptions = exceptions;
this.replacementBlockID = replacementBlockID;
this.replacementBlock = replacementBlock;
this.replacementMetadata = replacementMetadata;
}

View file

@ -5,7 +5,7 @@ import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.Item;
@ -31,13 +31,12 @@ public abstract class BaseItemDoor extends ItemDoor
/**
* door represents the non-dimensional door this item is associated with. Leave null for none.
* @param itemID
* @param material
* @param door
* @param vanillaDoor
*/
public BaseItemDoor(int itemID, Material material, ItemDoor vanillaDoor)
public BaseItemDoor(Material material, ItemDoor vanillaDoor)
{
super(itemID, material);
super( material);
this.setMaxStackSize(64);
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
if (properties == null)
@ -51,7 +50,7 @@ public abstract class BaseItemDoor extends ItemDoor
}
@Override
public void registerIcons(IconRegister par1IconRegister)
public void registerIcons(IIconRegister par1IconRegister)
{
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", ""));
}
@ -134,10 +133,10 @@ public abstract class BaseItemDoor extends ItemDoor
// side
if (side == 1 && !world.isRemote)
{
int blockID = world.getBlockId(x, y, z);
if (blockID != 0)
Block block = world.getBlock(x, y, z);
if (!block.isAir(world, x, y, z))
{
if (!Block.blocksList[blockID].isBlockReplaceable(world, x, y, z))
if (!block.isReplaceable(world, x, y, z))
{
y++;
}
@ -179,7 +178,7 @@ public abstract class BaseItemDoor extends ItemDoor
MovingObjectPosition hit = BaseItemDoor.doRayTrace(player.worldObj, player, true);
if (hit != null)
{
if (world.getBlockId(hit.blockX, hit.blockY, hit.blockZ) == properties.RiftBlockID)
if (world.getBlock(hit.blockX, hit.blockY, hit.blockZ) == mod_pocketDim.blockRift)
{
DimLink link = PocketManager.getLink(hit.blockX, hit.blockY, hit.blockZ, world.provider.dimensionId);
if (link != null)
@ -196,7 +195,7 @@ public abstract class BaseItemDoor extends ItemDoor
placeDoorBlock(world, x, y - 1, z, orientation, doorBlock);
if (!(stack.getItem() instanceof BaseItemDoor))
{
((TileEntityDimDoor) world.getBlockTileEntity(x, y, z)).hasGennedPair = true;
((TileEntityDimDoor) world.getTileEntity(x, y, z)).hasGennedPair = true;
}
if (!player.capabilities.isCreativeMode)
{
@ -213,9 +212,9 @@ public abstract class BaseItemDoor extends ItemDoor
public static boolean canPlace(World world, int x, int y, int z)
{
int id = world.getBlockId(x, y, z);
Block block = world.getBlock(x, y, z);
return (id == properties.RiftBlockID || id == 0 || Block.blocksList[id].blockMaterial.isReplaceable());
return (block == mod_pocketDim.blockRift || block.isAir(world, x, y, z) || block.getMaterial().isReplaceable());
}
/**
@ -236,7 +235,7 @@ public abstract class BaseItemDoor extends ItemDoor
double d1 = par2EntityPlayer.prevPosY + (par2EntityPlayer.posY - par2EntityPlayer.prevPosY) * (double) f
+ (double) (par1World.isRemote ? par2EntityPlayer.getEyeHeight() - par2EntityPlayer.getDefaultEyeHeight() : par2EntityPlayer.getEyeHeight());
double d2 = par2EntityPlayer.prevPosZ + (par2EntityPlayer.posZ - par2EntityPlayer.prevPosZ) * (double) f;
Vec3 vec3 = par1World.getWorldVec3Pool().getVecFromPool(d0, d1, d2);
Vec3 vec3 = Vec3.createVectorHelper (d0, d1, d2);
float f3 = MathHelper.cos(-f2 * 0.017453292F - (float) Math.PI);
float f4 = MathHelper.sin(-f2 * 0.017453292F - (float) Math.PI);
float f5 = -MathHelper.cos(-f1 * 0.017453292F);
@ -249,6 +248,6 @@ public abstract class BaseItemDoor extends ItemDoor
d3 = ((EntityPlayerMP) par2EntityPlayer).theItemInWorldManager.getBlockReachDistance();
}
Vec3 vec31 = vec3.addVector((double) f7 * d3, (double) f6 * d3, (double) f8 * d3);
return par1World.rayTraceBlocks_do_do(vec3, vec31, par3, !par3);
return par1World.rayTraceBlocks(vec3, vec31, par3);
}
}

View file

@ -1,6 +1,7 @@
package StevenDimDoors.mod_pocketDim.items;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
@ -9,14 +10,14 @@ public class ItemBlockDimWall extends ItemBlock
{
private final static String[] subNames = {"Fabric of Reality", "Ancient Fabric" , "Altered Fabric"};
public ItemBlockDimWall(int par1)
public ItemBlockDimWall(Block block)
{
super(par1);
super(block);
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
setHasSubtypes(true);
}
@Override
public void registerIcons(IconRegister par1IconRegister)
public void registerIcons(IIconRegister par1IconRegister)
{
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("tile.", ""));
}

View file

@ -6,7 +6,7 @@ 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.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.Item;
@ -14,7 +14,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.EnumMovingObjectType;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
@ -29,9 +28,9 @@ public class ItemDDKey extends Item
{
public static final int TIME_TO_UNLOCK = 30;
public ItemDDKey(int itemID)
public ItemDDKey()
{
super(itemID);
super();
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
this.setMaxStackSize(1);
@ -55,7 +54,7 @@ public class ItemDDKey extends Item
}
@Override
public void registerIcons(IconRegister par1IconRegister)
public void registerIcons(IIconRegister par1IconRegister)
{
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", ""));
}
@ -87,9 +86,9 @@ public class ItemDDKey extends Item
{
return true;
}
int blockID = world.getBlockId(x, y, z);
Block block = world.getBlock(x, y, z);
// make sure we are dealing with a door
if (!(Block.blocksList[blockID] instanceof IDimDoor))
if (!(block instanceof IDimDoor))
{
return false;
}
@ -146,7 +145,7 @@ public class ItemDDKey extends Item
{
//Raytrace to make sure we are still looking at a door
MovingObjectPosition pos = getMovingObjectPositionFromPlayer(player.worldObj, player, true);
if (pos != null && pos.typeOfHit == EnumMovingObjectType.TILE)
if (pos != null && pos.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
{
//make sure we have a link and it has a lock
DimLink link = PocketManager.getLink(pos.blockX, pos.blockY, pos.blockZ, player.worldObj);
@ -170,13 +169,13 @@ public class ItemDDKey extends Item
* Raytrace to make sure we are still looking at the right block while preparing to remove the lock
*/
@Override
public void onUsingItemTick(ItemStack stack, EntityPlayer player, int count)
public void onUsingTick(ItemStack stack, EntityPlayer player, int count)
{
// no need to check every tick, twice a second instead
if (count % 10 == 0)
{
MovingObjectPosition pos = getMovingObjectPositionFromPlayer(player.worldObj, player, true);
if (pos != null && pos.typeOfHit == EnumMovingObjectType.TILE)
if (pos != null && pos.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
{
DimLink link = PocketManager.getLink(pos.blockX, pos.blockY, pos.blockZ, player.worldObj);
if (link != null && link.hasLock())

View file

@ -12,9 +12,9 @@ import StevenDimDoors.mod_pocketDim.blocks.BaseDimDoor;
public class ItemDimensionalDoor extends BaseItemDoor
{
public ItemDimensionalDoor(int itemID, Material material, ItemDoor door)
public ItemDimensionalDoor(Material material, ItemDoor door)
{
super(itemID, material, door);
super(material, door);
}
@SuppressWarnings({ "rawtypes", "unchecked" })

View file

@ -13,9 +13,9 @@ import StevenDimDoors.mod_pocketDim.blocks.BaseDimDoor;
public class ItemGoldDimDoor extends BaseItemDoor
{
public ItemGoldDimDoor(int itemID, Material material, ItemDoor door)
public ItemGoldDimDoor(Material material, ItemDoor door)
{
super(itemID, material, door);
super(material, door);
}
@SuppressWarnings({ "rawtypes", "unchecked" })

View file

@ -3,7 +3,7 @@ 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.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemDoor;
import net.minecraft.item.ItemStack;
@ -12,14 +12,14 @@ import net.minecraft.world.World;
public class ItemGoldDoor extends ItemDoor
{
public ItemGoldDoor(int par1, Material par2Material)
public ItemGoldDoor(Material par2Material)
{
super(par1, par2Material);
super(par2Material);
this.setMaxStackSize(16);
}
@Override
public void registerIcons(IconRegister par1IconRegister)
public void registerIcons(IIconRegister par1IconRegister)
{
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", ""));
}

View file

@ -12,9 +12,9 @@ import StevenDimDoors.mod_pocketDim.blocks.BaseDimDoor;
public class ItemPersonalDoor extends BaseItemDoor
{
public ItemPersonalDoor(int itemID, Material material, ItemDoor door)
public ItemPersonalDoor(Material material, ItemDoor door)
{
super(itemID, material, door);
super(material, door);
}
@SuppressWarnings({ "rawtypes", "unchecked" })

View file

@ -3,7 +3,7 @@ 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.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemDoor;
import net.minecraft.item.ItemStack;
@ -12,13 +12,13 @@ import net.minecraft.world.World;
public class ItemQuartzDoor extends ItemDoor
{
public ItemQuartzDoor(int par1, Material par2Material)
public ItemQuartzDoor( Material par2Material)
{
super(par1, par2Material);
super(par2Material);
}
@Override
public void registerIcons(IconRegister par1IconRegister)
public void registerIcons(IIconRegister par1IconRegister)
{
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", ""));
}

View file

@ -4,7 +4,7 @@ import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
@ -12,7 +12,7 @@ import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.util.AxisAlignedBB;
@ -31,9 +31,9 @@ public class ItemRiftBlade extends ItemSword
{
private final DDProperties properties;
public ItemRiftBlade(int itemID, DDProperties properties)
public ItemRiftBlade(DDProperties properties)
{
super(itemID, EnumToolMaterial.EMERALD);
super(ToolMaterial.EMERALD);
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
this.properties = properties;
@ -55,7 +55,7 @@ public class ItemRiftBlade extends ItemSword
double var7 = par2EntityPlayer.prevPosX + (par2EntityPlayer.posX - par2EntityPlayer.prevPosX) * var4;
double var9 = par2EntityPlayer.prevPosY + (par2EntityPlayer.posY - par2EntityPlayer.prevPosY) * var4 + 1.62D - par2EntityPlayer.yOffset;
double var11 = par2EntityPlayer.prevPosZ + (par2EntityPlayer.posZ - par2EntityPlayer.prevPosZ) * var4;
Vec3 var13 = par1World.getWorldVec3Pool().getVecFromPool(var7, var9, var11);
Vec3 var13 = Vec3.createVectorHelper(var7, var9, var11);
float var14 = MathHelper.cos(-var6 * 0.017453292F - (float)Math.PI);
float var15 = MathHelper.sin(-var6 * 0.017453292F - (float)Math.PI);
float var16 = -MathHelper.cos(-var5 * 0.017453292F);
@ -68,12 +68,12 @@ public class ItemRiftBlade extends ItemSword
var21 = 7;
}
Vec3 var23 = var13.addVector(var18 * var21, var17 * var21, var20 * var21);
return par1World.rayTraceBlocks_do_do(var13, var23, true, false);
return par1World.rayTraceBlocks(var13, var23, true);
}
private boolean teleportToEntity(ItemStack item, Entity par1Entity, EntityPlayer holder)
{
Vec3 var2 = holder.worldObj.getWorldVec3Pool().getVecFromPool(holder.posX - par1Entity.posX, holder.boundingBox.minY + holder.height / 2.0F - par1Entity.posY + par1Entity.getEyeHeight(), holder.posZ - par1Entity.posZ);
Vec3 var2 = Vec3.createVectorHelper(holder.posX - par1Entity.posX, holder.boundingBox.minY + holder.height / 2.0F - par1Entity.posY + par1Entity.getEyeHeight(), holder.posZ - par1Entity.posZ);
double cooef =( var2.lengthVector()-2.5)/var2.lengthVector();
var2.xCoord*=cooef;
@ -114,7 +114,7 @@ public class ItemRiftBlade extends ItemSword
for (EntityLiving ent : list)
{
Vec3 var3 = player.getLook(1.0F).normalize();
Vec3 var4 = player.worldObj.getWorldVec3Pool().getVecFromPool(ent.posX - player.posX, ent.boundingBox.minY + (ent.height) / 2.0F - ( player.posY + player.getEyeHeight()), ent.posZ - player.posZ);
Vec3 var4 = Vec3.createVectorHelper(ent.posX - player.posX, ent.boundingBox.minY + (ent.height) / 2.0F - ( player.posY + player.getEyeHeight()), ent.posZ - player.posZ);
double var5 = var4.lengthVector();
var4 = var4.normalize();
double var7 = var3.dotProduct(var4);
@ -132,7 +132,7 @@ public class ItemRiftBlade extends ItemSword
int x = hit.blockX;
int y = hit.blockY;
int z = hit.blockZ;
if (world.getBlockId(x, y, z) == properties.RiftBlockID)
if (world.getBlock(x, y, z) == mod_pocketDim.blockRift)
{
if (PocketManager.getLink(x, y, z, world) != null)
{
@ -160,7 +160,7 @@ public class ItemRiftBlade extends ItemSword
}
@Override
public void registerIcons(IconRegister par1IconRegister)
public void registerIcons(IIconRegister par1IconRegister)
{
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", ""));
}
@ -173,7 +173,7 @@ public class ItemRiftBlade extends ItemSword
{
//Don't include a call to super.getIsRepairable()!
//That would cause this sword to accept diamonds as a repair material (since we set material = Diamond).
return mod_pocketDim.itemStableFabric.itemID == par2ItemStack.itemID ? true : false;
return mod_pocketDim.itemStableFabric == par2ItemStack.getItem() ? true : false;
}
/**

View file

@ -1,15 +1,14 @@
package StevenDimDoors.mod_pocketDim.items;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumArmorMaterial;
import net.minecraft.item.ItemArmor;
public class ItemRiftGoggles extends ItemArmor
{
public ItemRiftGoggles(int par1, int par2, int par3)
public ItemRiftGoggles(int par2, int par3)
{
super(par1, EnumArmorMaterial.IRON, par1, par1);
super(ArmorMaterial.IRON, par2, par3);
this.setCreativeTab(CreativeTabs.tabRedstone);
// this.setIconIndex(Item.doorWood.getIconFromDamage(0));
}

View file

@ -2,7 +2,7 @@ package StevenDimDoors.mod_pocketDim.items;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@ -22,9 +22,9 @@ import cpw.mods.fml.relauncher.SideOnly;
public class ItemRiftSignature extends Item
{
public ItemRiftSignature(int itemID)
public ItemRiftSignature()
{
super(itemID);
super();
this.setMaxStackSize(1);
this.setMaxDamage(0);
this.hasSubtypes = true;
@ -40,7 +40,7 @@ public class ItemRiftSignature extends Item
}
@Override
public void registerIcons(IconRegister par1IconRegister)
public void registerIcons(IIconRegister par1IconRegister)
{
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", ""));
}
@ -139,12 +139,12 @@ public class ItemRiftSignature extends Item
public static int adjustYForSpecialBlocks(World world, int x, int y, int z)
{
int targetY = y - 2; // Get the block the player actually clicked on
Block block = Block.blocksList[world.getBlockId(x, targetY, z)];
Block block = world.getBlock(x, targetY, z);
if (block == null)
{
return targetY + 2;
}
if (block.isBlockReplaceable(world, x, targetY, z))
if (block.isReplaceable(world, x, targetY, z))
{
return targetY + 1; // Move block placement down (-2+1) one so its directly over things like snow
}

View file

@ -1,8 +1,10 @@
package StevenDimDoors.mod_pocketDim.items;
import java.util.List;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
@ -18,13 +20,13 @@ import cpw.mods.fml.relauncher.SideOnly;
public class ItemStabilizedRiftSignature extends ItemRiftSignature
{
public ItemStabilizedRiftSignature(int itemID)
public ItemStabilizedRiftSignature()
{
super(itemID);
super();
}
@Override
public void registerIcons(IconRegister par1IconRegister)
public void registerIcons(IIconRegister par1IconRegister)
{
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", ""));
}
@ -74,7 +76,7 @@ public class ItemStabilizedRiftSignature extends ItemRiftSignature
// Check if the player is in creative mode,
// or if the player can pay with an Ender Pearl to create a rift.
if (!player.capabilities.isCreativeMode &&
!player.inventory.consumeInventoryItem(Item.enderPearl.itemID))
!player.inventory.consumeInventoryItem(Items.ender_pearl))
{
mod_pocketDim.sendChat(player, "You don't have any Ender Pearls!");
// I won't do this, but this is the chance to localize chat

View file

@ -1,19 +1,19 @@
package StevenDimDoors.mod_pocketDim.items;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.Item;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
public class ItemStableFabric extends Item
{
public ItemStableFabric(int itemID, int par2)
public ItemStableFabric(int par2)
{
super(itemID);
super();
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
}
@Override
public void registerIcons(IconRegister par1IconRegister)
public void registerIcons(IIconRegister par1IconRegister)
{
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", ""));
}

View file

@ -12,9 +12,9 @@ import StevenDimDoors.mod_pocketDim.blocks.BaseDimDoor;
public class ItemUnstableDoor extends BaseItemDoor
{
public ItemUnstableDoor(int itemID, Material material, ItemDoor door)
public ItemUnstableDoor(Material material, ItemDoor door)
{
super(itemID, material, door);
super( material, door);
}
@SuppressWarnings({ "unchecked", "rawtypes" })

View file

@ -12,9 +12,9 @@ import StevenDimDoors.mod_pocketDim.blocks.BaseDimDoor;
public class ItemWarpDoor extends BaseItemDoor
{
public ItemWarpDoor(int itemID, Material material, ItemDoor door)
public ItemWarpDoor(Material material, ItemDoor door)
{
super(itemID, material, door);
super(material, door);
}
@SuppressWarnings({ "unchecked", "rawtypes" })

View file

@ -1,19 +1,19 @@
package StevenDimDoors.mod_pocketDim.items;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.Item;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
public class ItemWorldThread extends Item
{
public ItemWorldThread(int itemID)
public ItemWorldThread()
{
super(itemID);
super();
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
}
@Override
public void registerIcons(IconRegister par1IconRegister)
public void registerIcons(IIconRegister par1IconRegister)
{
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", ""));
}

View file

@ -18,7 +18,7 @@ public class DispenserBehaviorStabilizedRS extends BehaviorDefaultDispenseItem
int x = dispenser.getXInt();
int y = dispenser.getYInt();
int z = dispenser.getZInt();
EnumFacing facing = BlockDispenser.getFacing(dispenser.getBlockMetadata());
EnumFacing facing = BlockDispenser.func_149937_b(dispenser.getBlockMetadata());
int dx = facing.getFrontOffsetX();
int dy = facing.getFrontOffsetY();
int dz = facing.getFrontOffsetZ();

View file

@ -3,7 +3,7 @@ package StevenDimDoors.mod_pocketDim.items;
import java.util.List;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@ -21,16 +21,16 @@ import cpw.mods.fml.relauncher.SideOnly;
public class itemRiftRemover extends Item
{
public itemRiftRemover(int itemID, Material par2Material)
public itemRiftRemover(Material par2Material)
{
super(itemID);
super();
this.setMaxStackSize(1);
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
this.setMaxDamage(4);
}
@Override
public void registerIcons(IconRegister par1IconRegister)
public void registerIcons(IIconRegister par1IconRegister)
{
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", ""));
}
@ -56,7 +56,7 @@ public class itemRiftRemover extends Item
int hz = hit.blockZ;
NewDimData dimension = PocketManager.createDimensionData(world);
DimLink link = dimension.getLink(hx, hy, hz);
if (world.getBlockId(hx, hy, hz) == mod_pocketDim.blockRift.blockID && link != null &&
if (world.getBlock(hx, hy, hz) == mod_pocketDim.blockRift && link != null &&
player.canPlayerEdit(hx, hy, hz, hit.sideHit, stack))
{
// Invoke onPlayerRightClick()
@ -87,15 +87,15 @@ public class itemRiftRemover extends Item
NewDimData dimension = PocketManager.createDimensionData(world);
DimLink link = dimension.getLink(x, y, z);
if (world.getBlockId(x, y, z) == mod_pocketDim.blockRift.blockID && link != null &&
if (world.getBlock(x, y, z) == mod_pocketDim.blockRift && link != null &&
player.canPlayerEdit(x, y, z, side, stack))
{
// Tell the rift's tile entity to do its removal animation
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
TileEntity tileEntity = world.getTileEntity(x, y, z);
if (tileEntity != null && tileEntity instanceof TileEntityRift)
{
((TileEntityRift) tileEntity).shouldClose = true;
tileEntity.onInventoryChanged();
tileEntity.markDirty();
}
else if (!world.isRemote)
{

View file

@ -4,13 +4,13 @@ import java.io.File;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityEggInfo;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemDoor;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ChatMessageComponent;
import net.minecraft.util.ChatComponentText;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.common.ForgeChunkManager;
@ -85,21 +85,12 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerAboutToStartEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import cpw.mods.fml.common.event.FMLServerStoppedEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.network.NetworkMod.SidedPacketHandler;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.common.registry.TickRegistry;
import cpw.mods.fml.relauncher.Side;
@Mod(modid = mod_pocketDim.modid, name = "Dimensional Doors", version = mod_pocketDim.version)
@NetworkMod(clientSideRequired = true, serverSideRequired = false, connectionHandler=ConnectionHandler.class,
clientPacketHandlerSpec =
@SidedPacketHandler(channels = {PacketConstants.CHANNEL_NAME}, packetHandler = ClientPacketHandler.class),
serverPacketHandlerSpec =
@SidedPacketHandler(channels = {PacketConstants.CHANNEL_NAME}, packetHandler = ServerPacketHandler.class))
public class mod_pocketDim
{
public static final String version = "@VERSION@";
@ -167,9 +158,9 @@ public class mod_pocketDim
public static CreativeTabs dimDoorsCreativeTab = new CreativeTabs("dimDoorsCreativeTab")
{
@Override
public ItemStack getIconItemStack()
public Item getTabIconItem()
{
return new ItemStack(mod_pocketDim.itemDimensionalDoor, 1, 0);
return mod_pocketDim.itemDimensionalDoor;
}
@Override
@ -204,36 +195,36 @@ public class mod_pocketDim
limboDecay = new LimboDecay(properties);
// Initialize blocks and items
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");
transientDoor = new TransientDoor(Material.iron, properties).setHardness(1.0F) .setBlockName("transientDoor");
goldenDimensionalDoor = new BlockGoldDimDoor(Material.iron, properties).setHardness(1.0F) .setBlockName("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");
quartzDoor = new BlockDoorQuartz(Material.rock).setHardness(0.1F).setBlockName("doorQuartz");
personalDimDoor = new PersonalDimDoor(Material.rock,properties).setHardness(0.1F).setBlockName("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");
warpDoor = new WarpDoor(properties.WarpDoorID, Material.wood, properties).setHardness(1.0F) .setUnlocalizedName("dimDoorWarp");
blockRift = (BlockRift) (new BlockRift(properties.RiftBlockID, 0, Material.air, properties).setHardness(1.0F) .setUnlocalizedName("rift"));
blockLimbo = new BlockLimbo(properties.LimboBlockID, 15, Material.iron, properties.LimboDimensionID, limboDecay).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"));
transTrapdoor = (TransTrapdoor) (new TransTrapdoor(properties.TransTrapdoorID, Material.wood).setHardness(1.0F) .setUnlocalizedName("dimHatch"));
goldenDoor = new BlockDoorGold(Material.iron).setHardness(0.1F).setBlockName("doorGold");
blockDimWall = new BlockDimWall(0, Material.iron).setLightLevel(1.0F).setHardness(0.1F).setBlockName("blockDimWall");
blockDimWallPerm = (new BlockDimWallPerm(0, Material.iron)).setLightLevel(1.0F).setBlockUnbreakable().setResistance(6000000.0F).setBlockName("blockDimWallPerm");
warpDoor = new WarpDoor(Material.wood, properties).setHardness(1.0F) .setBlockName("dimDoorWarp");
blockRift = (BlockRift) (new BlockRift(0, Material.air, properties).setHardness(1.0F) .setBlockName("rift"));
blockLimbo = new BlockLimbo(15, Material.iron, properties.LimboDimensionID, limboDecay).setHardness(.2F).setBlockName("BlockLimbo").setLightLevel(.0F);
unstableDoor = (new UnstableDoor(Material.iron, properties).setHardness(.2F).setBlockName("chaosDoor").setLightLevel(.0F) );
dimensionalDoor = (DimensionalDoor) (new DimensionalDoor(Material.iron, properties).setHardness(1.0F).setResistance(2000.0F) .setBlockName("dimDoor"));
transTrapdoor = (TransTrapdoor) (new TransTrapdoor(Material.wood).setHardness(1.0F) .setBlockName("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");
itemWarpDoor = (new ItemWarpDoor(properties.WarpDoorItemID, Material.wood,(ItemDoor)Item.doorWood)).setUnlocalizedName("itemDimDoorWarp");
itemRiftSignature = (new ItemRiftSignature(properties.RiftSignatureItemID)).setUnlocalizedName("itemLinkSignature");
itemRiftRemover = (new itemRiftRemover(properties.RiftRemoverItemID, Material.wood)).setUnlocalizedName("itemRiftRemover");
itemStableFabric = (new ItemStableFabric(properties.StableFabricItemID, 0)).setUnlocalizedName("itemStableFabric");
itemUnstableDoor = (new ItemUnstableDoor(properties.UnstableDoorItemID, Material.iron, null)).setUnlocalizedName("itemChaosDoor");
itemRiftBlade = (new ItemRiftBlade(properties.RiftBladeItemID, properties)).setUnlocalizedName("ItemRiftBlade");
itemStabilizedRiftSignature = (new ItemStabilizedRiftSignature(properties.StabilizedRiftSignatureItemID)).setUnlocalizedName("itemStabilizedRiftSig");
itemWorldThread = (new ItemWorldThread(properties.WorldThreadItemID)).setUnlocalizedName("itemWorldThread");
itemDDKey = (new ItemDDKey()).setUnlocalizedName("itemDDKey");
itemQuartzDoor = (new ItemQuartzDoor(Material.rock)).setUnlocalizedName("itemQuartzDoor");
itemPersonalDoor = (new ItemPersonalDoor(Material.rock, (ItemDoor)this.itemQuartzDoor)).setUnlocalizedName("itemQuartzDimDoor");
itemGoldenDoor = (new ItemGoldDoor(Material.wood)).setUnlocalizedName("itemGoldDoor");
itemGoldenDimensionalDoor = (new ItemGoldDimDoor(Material.iron, (ItemDoor)this.itemGoldenDoor)).setUnlocalizedName("itemGoldDimDoor");
itemDimensionalDoor = (ItemDimensionalDoor) (new ItemDimensionalDoor(Material.iron, (ItemDoor) Items.iron_door)).setUnlocalizedName("itemDimDoor");
itemWarpDoor = (new ItemWarpDoor(Material.wood,(ItemDoor)Items.iron_door)).setUnlocalizedName("itemDimDoorWarp");
itemRiftSignature = (new ItemRiftSignature()).setUnlocalizedName("itemLinkSignature");
itemRiftRemover = (new itemRiftRemover(Material.wood)).setUnlocalizedName("itemRiftRemover");
itemStableFabric = (new ItemStableFabric(0)).setUnlocalizedName("itemStableFabric");
itemUnstableDoor = (new ItemUnstableDoor(Material.iron, null)).setUnlocalizedName("itemChaosDoor");
itemRiftBlade = (new ItemRiftBlade(properties)).setUnlocalizedName("ItemRiftBlade");
itemStabilizedRiftSignature = (new ItemStabilizedRiftSignature()).setUnlocalizedName("itemStabilizedRiftSig");
itemWorldThread = (new ItemWorldThread()).setUnlocalizedName("itemWorldThread");
// Check if other biomes have been registered with the same IDs we want. If so, crash Minecraft
// to notify the user instead of letting it pass and conflicting with Biomes o' Plenty.
@ -311,7 +302,7 @@ public class mod_pocketDim
EntityRegistry.registerModEntity(MobMonolith.class, "Monolith", properties.MonolithEntityID, this, 70, 1, true);
EntityList.IDtoClassMapping.put(properties.MonolithEntityID, MobMonolith.class);
EntityList.entityEggs.put(properties.MonolithEntityID, new EntityEggInfo(properties.MonolithEntityID, 0, 0xffffff));
EntityList.entityEggs.put(properties.MonolithEntityID, new EntityList.EntityEggInfo(properties.MonolithEntityID, 0, 0xffffff));
LanguageRegistry.instance().addStringLocalization("entity.dimdoors.Monolith.name", "Monolith");
CraftingManager.registerRecipes(properties);
@ -320,7 +311,7 @@ public class mod_pocketDim
DungeonHelper.initialize();
gatewayGenerator = new GatewayGenerator(properties);
GameRegistry.registerWorldGenerator(mod_pocketDim.gatewayGenerator);
GameRegistry.registerWorldGenerator(mod_pocketDim.gatewayGenerator, 0);
// Register loot chests
DDLoot.registerInfo(properties);
@ -442,8 +433,7 @@ public class mod_pocketDim
public static void sendChat(EntityPlayer player, String message)
{
ChatMessageComponent cmp = new ChatMessageComponent();
cmp.addText(message);
player.sendChatToPlayer(cmp);
ChatComponentText text = new ChatComponentText(message);
player.addChatComponentMessage(text);
}
}

View file

@ -1,12 +1,12 @@
package StevenDimDoors.mod_pocketDim.schematic;
import net.minecraft.block.Block;
import net.minecraft.block.BlockComparator;
import net.minecraft.block.BlockDoor;
import net.minecraft.block.BlockRedstoneRepeater;
import net.minecraft.block.BlockStairs;
import net.minecraft.block.*;
import StevenDimDoors.mod_pocketDim.Point3D;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import net.minecraft.init.Blocks;
import java.util.HashMap;
import java.util.Map;
public class BlockRotator
{
@ -17,65 +17,65 @@ public class BlockRotator
private final static int BLOCK_ID_COUNT = 4096;
//Provides a fast lookup table for whether blocks have orientations
private final static boolean[] hasOrientations = new boolean[BLOCK_ID_COUNT];
private final static Map<Block, Boolean> hasOrientations = new HashMap<Block, Boolean>();
static
public static void setupOrientations()
{
hasOrientations[Block.dispenser.blockID] = true;
hasOrientations[Block.dropper.blockID] = true;
hasOrientations[Block.stairsStoneBrick.blockID] = true;
hasOrientations[Block.lever.blockID] = true;
hasOrientations[Block.stoneButton.blockID] = true;
hasOrientations[Block.woodenButton.blockID] = true;
hasOrientations[Block.redstoneRepeaterIdle.blockID] = true;
hasOrientations[Block.redstoneRepeaterActive.blockID] = true;
hasOrientations[Block.tripWireSource.blockID] = true;
hasOrientations[Block.torchWood.blockID] = true;
hasOrientations[Block.torchRedstoneIdle.blockID] = true;
hasOrientations[Block.torchRedstoneActive.blockID] = true;
hasOrientations[Block.doorIron.blockID] = true;
hasOrientations[Block.doorWood.blockID] = true;
hasOrientations[Block.pistonBase.blockID] = true;
hasOrientations[Block.pistonStickyBase.blockID] = true;
hasOrientations[Block.pistonExtension.blockID] = true;
hasOrientations[Block.redstoneComparatorIdle.blockID] = true;
hasOrientations[Block.redstoneComparatorActive.blockID] = true;
hasOrientations[Block.signPost.blockID] = true;
hasOrientations[Block.signWall.blockID] = true;
hasOrientations[Block.skull.blockID] = true;
hasOrientations[Block.ladder.blockID] = true;
hasOrientations[Block.vine.blockID] = true;
hasOrientations[Block.anvil.blockID] = true;
hasOrientations[Block.chest.blockID] = true;
hasOrientations[Block.chestTrapped.blockID] = true;
hasOrientations[Block.hopperBlock.blockID] = true;
hasOrientations[Block.stairsNetherBrick.blockID] = true;
hasOrientations[Block.stairsCobblestone.blockID] = true;
hasOrientations[Block.stairsNetherQuartz.blockID] = true;
hasOrientations[Block.stairsSandStone.blockID] = true;
hasOrientations[Block.stairsBrick.blockID] = true;
hasOrientations[Block.stairsWoodBirch.blockID] = true;
hasOrientations[Block.stairsWoodOak.blockID] = true;
hasOrientations[Block.stairsWoodJungle.blockID] = true;
hasOrientations[Block.stairsWoodSpruce.blockID] = true;
hasOrientations[Block.wood.blockID] = true;
hasOrientations[Block.blockNetherQuartz.blockID] = true;
hasOrientations[Block.railPowered.blockID] = true;
hasOrientations[Block.railDetector.blockID] = true;
hasOrientations[Block.railActivator.blockID] = true;
hasOrientations[Block.rail.blockID] = true;
hasOrientations[Block.furnaceBurning.blockID] = true;
hasOrientations[Block.furnaceIdle.blockID] = true;
hasOrientations[Block.bed.blockID] = true;
hasOrientations[mod_pocketDim.dimensionalDoor.blockID] = true;
hasOrientations[mod_pocketDim.warpDoor.blockID] = true;
hasOrientations[mod_pocketDim.goldenDimensionalDoor.blockID] = true;
hasOrientations[mod_pocketDim.personalDimDoor.blockID] = true;
hasOrientations.put(Blocks.dispenser, true);
hasOrientations.put(Blocks.dropper, true);
hasOrientations.put(Blocks.stone_brick_stairs, true);
hasOrientations.put(Blocks.lever, true);
hasOrientations.put(Blocks.stone_button, true);
hasOrientations.put(Blocks.wooden_button, true);
hasOrientations.put(Blocks.unpowered_repeater, true);
hasOrientations.put(Blocks.powered_repeater, true);
hasOrientations.put(Blocks.tripwire_hook, true);
hasOrientations.put(Blocks.torch, true);
hasOrientations.put(Blocks.redstone_torch, true);
hasOrientations.put(Blocks.unlit_redstone_torch, true);
hasOrientations.put(Blocks.iron_door, true);
hasOrientations.put(Blocks.wooden_door, true);
hasOrientations.put(Blocks.piston, true);
hasOrientations.put(Blocks.sticky_piston, true);
hasOrientations.put(Blocks.piston_head, true);
hasOrientations.put(Blocks.powered_comparator, true);
hasOrientations.put(Blocks.unpowered_comparator, true);
hasOrientations.put(Blocks.standing_sign, true);
hasOrientations.put(Blocks.wall_sign, true);
hasOrientations.put(Blocks.skull, true);
hasOrientations.put(Blocks.ladder, true);
hasOrientations.put(Blocks.vine, true);
hasOrientations.put(Blocks.anvil, true);
hasOrientations.put(Blocks.chest, true);
hasOrientations.put(Blocks.trapped_chest, true);
hasOrientations.put(Blocks.hopper, true);
hasOrientations.put(Blocks.nether_brick_stairs, true);
hasOrientations.put(Blocks.stone_stairs, true);
hasOrientations.put(Blocks.quartz_stairs, true);
hasOrientations.put(Blocks.sandstone_stairs, true);
hasOrientations.put(Blocks.brick_stairs, true);
hasOrientations.put(Blocks.birch_stairs, true);
hasOrientations.put(Blocks.oak_stairs, true);
hasOrientations.put(Blocks.jungle_stairs, true);
hasOrientations.put(Blocks.spruce_stairs, true);
hasOrientations.put(Blocks.log, true);
hasOrientations.put(Blocks.log2, true);
hasOrientations.put(Blocks.quartz_block, true);
hasOrientations.put(Blocks.rail, true);
hasOrientations.put(Blocks.activator_rail, true);
hasOrientations.put(Blocks.detector_rail, true);
hasOrientations.put(Blocks.golden_rail, true);
hasOrientations.put(Blocks.furnace, true);
hasOrientations.put(Blocks.lit_furnace, true);
hasOrientations.put(Blocks.bed, true);
hasOrientations.put(mod_pocketDim.dimensionalDoor, true);
hasOrientations.put(mod_pocketDim.warpDoor, true);
hasOrientations.put(mod_pocketDim.goldenDimensionalDoor, true);
hasOrientations.put(mod_pocketDim.personalDimDoor, true);
}
public static int transformMetadata(int metadata, int turns, int blockID)
public static int transformMetadata(int metadata, int turns, Block block)
{
//I changed rotations to reduce the monstrous code we had. It might be
//slightly less efficient, but it's easier to maintain for now. ~SenseiKiwi
@ -84,37 +84,37 @@ public class BlockRotator
turns += 1 << 16;
turns %= 4;
if (hasOrientations[blockID])
if (hasOrientations.containsKey(block) && hasOrientations.get(block))
{
while (turns > 0)
{
metadata = rotateMetadataBy90(metadata, blockID);
metadata = rotateMetadataBy90(metadata, block);
turns--;
}
}
return metadata;
}
private static int rotateMetadataBy90(int metadata, int blockID)
private static int rotateMetadataBy90(int metadata, Block block)
{
//TODO: Replace this horrible function with something prettier. We promise we will for the next version,
//after switching to MC 1.6. PADRE, PLEASE FORGIVE OUR SINS.
if (blockID == Block.wood.blockID)
if (block == Blocks.log || block == Blocks.log2)
{
if (metadata >= 4 && metadata < 12)
{
metadata = (metadata % 8) + 4;
}
}
else if (blockID == Block.blockNetherQuartz.blockID)
else if (block == Blocks.quartz_block)
{
if (metadata == 3 || metadata == 4)
{
metadata = (metadata - 2) % 2 + 3;
}
}
else if (blockID == Block.railPowered.blockID || blockID == Block.railDetector.blockID || blockID == Block.railActivator.blockID)
else if (block == Blocks.golden_rail || block == Blocks.detector_rail || block == Blocks.activator_rail)
{
switch (metadata)
{
@ -159,7 +159,7 @@ public class BlockRotator
break;
}
}
else if (blockID==Block.rail.blockID)
else if (block==Blocks.rail)
{
switch (metadata)
{
@ -183,7 +183,7 @@ public class BlockRotator
break;
}
}
else if (blockID==Block.bed.blockID)
else if (block==Blocks.bed)
{
switch (metadata)
{
@ -213,7 +213,7 @@ public class BlockRotator
break;
}
}
else if (Block.blocksList[blockID] instanceof BlockStairs)
else if (block instanceof BlockStairs)
{
switch (metadata)
@ -244,7 +244,7 @@ public class BlockRotator
break;
}
}
else if (blockID == Block.chest.blockID || blockID == Block.chestTrapped.blockID || blockID == Block.ladder.blockID || blockID == Block.furnaceBurning.blockID|| blockID == Block.furnaceIdle.blockID)
else if (block == Blocks.chest || block == Blocks.trapped_chest || block == Blocks.ladder || block == Blocks.lit_furnace || block == Blocks.furnace)
{
switch (metadata)
{
@ -262,7 +262,7 @@ public class BlockRotator
break;
}
}
else if (blockID == Block.hopperBlock.blockID)
else if (block == Blocks.hopper)
{
switch (metadata)
{
@ -292,7 +292,7 @@ public class BlockRotator
break;
}
}
else if (blockID==Block.vine.blockID)
else if (block==Blocks.vine)
{
switch (metadata)
{
@ -311,7 +311,7 @@ public class BlockRotator
break;
}
}
else if (blockID==Block.signWall.blockID)
else if (block==Blocks.wall_sign)
{
switch (metadata)
{
@ -330,7 +330,7 @@ public class BlockRotator
break;
}
}
else if (blockID==Block.signPost.blockID)
else if (block==Blocks.standing_sign)
{
switch (metadata)
{
@ -384,7 +384,7 @@ public class BlockRotator
break;
}
}
else if(blockID== Block.lever.blockID || blockID == Block.stoneButton.blockID || blockID == Block.woodenButton.blockID || blockID== Block.torchWood.blockID||blockID== Block.torchRedstoneIdle.blockID||blockID== Block.torchRedstoneActive.blockID)
else if(block== Blocks.lever || block == Blocks.stone_button || block == Blocks.wooden_button || block== Blocks.torch||block== Blocks.unlit_redstone_torch||block== Blocks.redstone_torch)
{
switch (metadata)
{
@ -414,7 +414,7 @@ public class BlockRotator
break;
}
}
else if(blockID== Block.pistonBase.blockID||blockID==Block.pistonExtension.blockID||blockID==Block.pistonStickyBase.blockID || blockID == Block.dispenser.blockID || blockID == Block.dropper.blockID)
else if(block== Blocks.piston||block==Blocks.piston_head||block==Blocks.sticky_piston || block == Blocks.dispenser || block == Blocks.dropper)
{
switch (metadata)
{
@ -444,7 +444,7 @@ public class BlockRotator
break;
}
}
else if (Block.blocksList[blockID] instanceof BlockRedstoneRepeater || Block.blocksList[blockID] instanceof BlockDoor || blockID== Block.tripWireSource.blockID || Block.blocksList[blockID] instanceof BlockComparator)
else if (block instanceof BlockRedstoneRepeater || block instanceof BlockDoor || block== Blocks.tripwire_hook || block instanceof BlockRedstoneComparator)
{
switch (metadata)
{

View file

@ -1,8 +1,9 @@
package StevenDimDoors.mod_pocketDim.schematic;
import net.minecraft.block.Block;
import net.minecraft.world.World;
public interface IBlockSetter
{
public void setBlock(World world, int x, int y, int z, int blockID, int metadata);
public void setBlock(World world, int x, int y, int z, Block block, int metadata);
}

View file

@ -27,11 +27,11 @@ public class Schematic {
protected short height;
protected short length;
protected short[] blocks;
protected String[] blocks;
protected byte[] metadata;
protected NBTTagList tileEntities;
protected Schematic(short width, short height, short length, short[] blocks, byte[] metadata, NBTTagList tileEntities)
protected Schematic(short width, short height, short length, String[] blocks, byte[] metadata, NBTTagList tileEntities)
{
this.width = width;
this.height = height;
@ -96,9 +96,9 @@ public class Schematic {
return length;
}
public short getBlockID(int x, int y, int z)
public Block getBlock(int x, int y, int z)
{
return blocks[calculateIndex(x, y, z)];
return (Block)Block.blockRegistry.getObject(blocks[calculateIndex(x, y, z)]);
}
public byte getBlockMetadata(int x, int y, int z)
@ -141,7 +141,7 @@ public class Schematic {
byte[] metadata = null; //block metadata
byte[] lowBits = null; //first 8 bits of the block IDs
byte[] highBits = null; //additional 4 bits of the block IDs
short[] blocks = null; //list of combined block IDs
String[] blocks = null; //list of combined block IDs
NBTTagList tileEntities = null; //storage for tile entities in NBT form
NBTTagCompound schematicTag; //the NBT data extracted from the schematic file
boolean hasExtendedBlockIDs; //indicates whether the schematic contains extended block IDs
@ -186,7 +186,7 @@ public class Schematic {
if (volume > 2 * highBits.length && hasExtendedBlockIDs)
throw new InvalidSchematicException("The schematic has extended block IDs for fewer blocks than its dimensions indicate.");
blocks = new short[volume];
blocks = new String[volume];
if (hasExtendedBlockIDs)
{
//Combine the split block IDs into a single value

View file

@ -21,11 +21,11 @@ public class WorldBlockSetter implements IBlockSetter
this.ignoreAir = ignoreAir;
}
public void setBlock(World world, int x, int y, int z, int blockID, int metadata)
public void setBlock(World world, int x, int y, int z, Block block, int metadata)
{
if (!ignoreAir || blockID != 0)
if (!ignoreAir || !block.isAir(world,x,y,z))
{
world.setBlock(x, y, z, blockID, metadata, flags);
world.setBlock(x, y, z, block, metadata, flags);
}
}
}

View file

@ -3,7 +3,9 @@ package StevenDimDoors.mod_pocketDim.ticking;
import java.util.Random;
import java.util.concurrent.ConcurrentLinkedQueue;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.GameRules;
import net.minecraft.world.World;
@ -99,7 +101,7 @@ public class CustomLimboPopulator implements IRegularTickReceiver {
}
int sanity = 0;
int blockID = 0;
Block block = Blocks.air;
boolean didSpawn = false;
//The following initialization code is based on code from ChunkProviderGenerate.
@ -117,23 +119,23 @@ public class CustomLimboPopulator implements IRegularTickReceiver {
x = chunkX * CHUNK_SIZE + random.nextInt(CHUNK_SIZE);
z = chunkZ * CHUNK_SIZE + random.nextInt(CHUNK_SIZE);
y = MAX_MONOLITH_SPAWN_Y;
blockID = pocket.getBlockId(x, y, z);
block = pocket.getBlock(x, y, z);
while (blockID == 0 &&y>0)
while (block.isAir(pocket, x, y, z) &&y>0)
{
y--;
blockID = pocket.getBlockId(x, y, z);
block = pocket.getBlock(x, y, z);
}
while ((blockID == properties.FabricBlockID || blockID == properties.PermaFabricBlockID) && y > 0)
while ((block == mod_pocketDim.blockDimWall || block == mod_pocketDim.blockDimWallPerm) && y > 0)
{
y--;
blockID = pocket.getBlockId(x, y, z);
block = pocket.getBlock(x, y, z);
}
while (blockID == 0 && y > 0)
while (block.isAir(pocket, x, y, z) && y > 0)
{
y--;
blockID = pocket.getBlockId(x, y, z);
block = pocket.getBlock(x, y, z);
}
if(y > 0)
{
@ -175,7 +177,7 @@ public class CustomLimboPopulator implements IRegularTickReceiver {
int x = chunkX * CHUNK_SIZE + random.nextInt(CHUNK_SIZE);
int z = chunkZ * CHUNK_SIZE + random.nextInt(CHUNK_SIZE);
while (limbo.getBlockId(x, y, z) == 0 && y <255)
while (limbo.getBlock(x, y, z).isAir(limbo, x, y, z) && y <255)
{
y++;
}

View file

@ -3,6 +3,7 @@ package StevenDimDoors.mod_pocketDim.ticking;
import java.util.PriorityQueue;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager;
@ -112,9 +113,9 @@ public class RiftRegenerator implements IRegularTickReceiver {
else
{
// All of the necessary conditions have been met. Restore the rift!
int blockID = world.getBlockId(x, y, z);
if (world.setBlock(x, y, z, blockRift.blockID))
blockRift.dropWorldThread(blockID, world, x, y, z, random);
Block block = world.getBlock(x, y, z);
if (world.setBlock(x, y, z, blockRift))
blockRift.dropWorldThread(block, world, x, y, z, random);
}
}

View file

@ -3,19 +3,12 @@ package StevenDimDoors.mod_pocketDim.tileentities;
import java.util.Random;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.packet.Packet;
import StevenDimDoors.mod_pocketDim.ServerPacketHandler;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.core.DimLink;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import StevenDimDoors.mod_pocketDim.watcher.ClientLinkData;
import net.minecraft.block.Block;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.Packet130UpdateSign;
import net.minecraft.network.packet.Packet250CustomPayload;
import net.minecraft.tileentity.TileEntity;

View file

@ -7,9 +7,6 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.monster.EntityEnderman;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.Packet132TileEntityData;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper;
import StevenDimDoors.mod_pocketDim.ServerPacketHandler;
@ -65,7 +62,7 @@ public class TileEntityRift extends DDTileEntityBase
{
if (PocketManager.getLink(xCoord, yCoord, zCoord, worldObj.provider.dimensionId) == null)
{
if (worldObj.getBlockId(xCoord, yCoord, zCoord) == mod_pocketDim.blockRift.blockID)
if (worldObj.getBlock(xCoord, yCoord, zCoord) == mod_pocketDim.blockRift)
{
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
}
@ -76,7 +73,7 @@ public class TileEntityRift extends DDTileEntityBase
return;
}
if (worldObj.getBlockId(xCoord, yCoord, zCoord) != mod_pocketDim.blockRift.blockID)
if (worldObj.getBlock(xCoord, yCoord, zCoord) != mod_pocketDim.blockRift)
{
invalidate();
return;
@ -154,11 +151,11 @@ public class TileEntityRift extends DDTileEntityBase
for (DimLink riftLink : dimension.findRiftsInRange(worldObj, 6, xCoord, yCoord, zCoord))
{
Point4D location = riftLink.source();
TileEntityRift rift = (TileEntityRift) worldObj.getBlockTileEntity(location.getX(), location.getY(), location.getZ());
TileEntityRift rift = (TileEntityRift) worldObj.getTileEntity(location.getX(), location.getY(), location.getZ());
if (rift != null && !rift.shouldClose)
{
rift.shouldClose = true;
rift.onInventoryChanged();
rift.markDirty();
}
}
}
@ -207,7 +204,7 @@ public class TileEntityRift extends DDTileEntityBase
this.yOffset = 0;
this.xOffset = 0;
}
this.onInventoryChanged();
this.markDirty();
}
@Override

View file

@ -1,6 +1,6 @@
package StevenDimDoors.mod_pocketDim.util;
import net.minecraft.util.WeightedRandomItem;
import net.minecraft.util.WeightedRandom;
/*.
* Implements a simple generic item for using net.minecraft.util.WeightedRandom with objects of type T.
@ -9,7 +9,7 @@ import net.minecraft.util.WeightedRandomItem;
* extending WeightedRandomItem or cases in which we would have to break compatibility with previous serialized
* instances to add support for WeightedRandomItem.
*/
public class WeightedContainer<T> extends WeightedRandomItem {
public class WeightedContainer<T> extends WeightedRandom.Item {
private T data;

View file

@ -2,12 +2,15 @@ package StevenDimDoors.mod_pocketDim.world;
import java.util.Random;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.init.Blocks;
import net.minecraft.world.ChunkCoordIntPair;
import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager;
import StevenDimDoors.mod_pocketDim.config.DDProperties;
import net.minecraftforge.common.ForgeChunkManager;
/**
* Provides methods for applying Limbo decay. Limbo decay refers to the effect that most blocks placed in Limbo
@ -21,31 +24,31 @@ public class LimboDecay {
private static final int SECTION_HEIGHT = 16;
//Provides a reversed list of the block IDs that blocks cycle through during decay.
private final int[] decaySequence;
private final Block[] decaySequence;
private final Random random;
private final DDProperties properties;
private final int[] blocksImmuneToDecay;
private final Block[] blocksImmuneToDecay;
public LimboDecay(DDProperties properties)
{
decaySequence = new int[] {
properties.LimboBlockID,
Block.gravel.blockID,
Block.cobblestone.blockID,
Block.stone.blockID
decaySequence = new Block[] {
mod_pocketDim.blockLimbo,
Blocks.gravel,
Blocks.cobblestone,
Blocks.stone
};
blocksImmuneToDecay = new int[] {
properties.LimboBlockID,
properties.PermaFabricBlockID,
properties.TransientDoorID,
properties.DimensionalDoorID,
properties.WarpDoorID,
properties.RiftBlockID,
properties.UnstableDoorID,
properties.GoldenDoorID,
properties.GoldenDimensionalDoorID
blocksImmuneToDecay = new Block[] {
mod_pocketDim.blockLimbo,
mod_pocketDim.blockDimWallPerm,
mod_pocketDim.transientDoor,
mod_pocketDim.dimensionalDoor,
mod_pocketDim.warpDoor,
mod_pocketDim.blockRift,
mod_pocketDim.unstableDoor,
mod_pocketDim.goldenDoor,
mod_pocketDim.goldenDimensionalDoor
};
this.properties = properties;
@ -90,7 +93,7 @@ public class LimboDecay {
//Obtain the coordinates of active chunks in Limbo. For each section of each chunk,
//pick a random block and try to apply fast decay.
for (Object coordObject : limbo.activeChunkSet)
for (Object coordObject : ForgeChunkManager.getPersistentChunksFor(limbo).keySet())
{
ChunkCoordIntPair chunkCoord = (ChunkCoordIntPair) coordObject;
@ -112,10 +115,10 @@ public class LimboDecay {
*/
private boolean decayBlockFast(World world, int x, int y, int z)
{
int blockID = world.getBlockId(x, y, z);
if (canDecayBlock(blockID))
Block block = world.getBlock(x, y, z);
if (canDecayBlock(block, world, x, y, z))
{
world.setBlock(x, y, z, properties.LimboBlockID);
world.setBlock(x, y, z, mod_pocketDim.blockLimbo);
return true;
}
return false;
@ -127,14 +130,14 @@ public class LimboDecay {
private boolean decayBlock(World world, int x, int y, int z)
{
int index;
int blockID = world.getBlockId(x, y, z);
if (canDecayBlock(blockID))
Block block = world.getBlock(x, y, z);
if (canDecayBlock(block, world, x, y, z))
{
//Loop over the block IDs that decay can go through.
//Find an index matching the current blockID, if any.
for (index = 0; index < decaySequence.length; index++)
{
if (decaySequence[index] == blockID)
if (decaySequence[index] == block)
{
break;
}
@ -155,22 +158,21 @@ public class LimboDecay {
/**
* Checks if a block can decay. We will not decay air, certain DD blocks, or containers.
*/
private boolean canDecayBlock(int blockID)
private boolean canDecayBlock(Block block, World world, int x, int y, int z)
{
if (blockID == 0)
if (block.isAir(world, x, y, z))
{
return false;
}
for (int k = 0; k < blocksImmuneToDecay.length; k++)
{
if (blockID == blocksImmuneToDecay[k])
if (block == blocksImmuneToDecay[k])
{
return false;
}
}
Block block = Block.blocksList[blockID];
return (block == null || !(block instanceof BlockContainer));
}
}

View file

@ -3,7 +3,11 @@ package StevenDimDoors.mod_pocketDim.world;
import java.util.List;
import java.util.Random;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import cpw.mods.fml.common.eventhandler.Event;
import net.minecraft.block.Block;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.init.Blocks;
import net.minecraft.util.IProgressUpdate;
import net.minecraft.util.MathHelper;
import net.minecraft.world.ChunkPosition;
@ -13,9 +17,8 @@ import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.ChunkProviderGenerate;
import net.minecraft.world.gen.NoiseGeneratorOctaves;
import net.minecraft.world.gen.feature.MapGenScatteredFeature;
import net.minecraft.world.gen.structure.MapGenScatteredFeature;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.Event.Result;
import net.minecraftforge.event.terraingen.ChunkProviderEvent;
import StevenDimDoors.mod_pocketDim.config.DDProperties;
import StevenDimDoors.mod_pocketDim.ticking.CustomLimboPopulator;
@ -119,7 +122,7 @@ public class LimboGenerator extends ChunkProviderGenerate
}
@Override
public void replaceBlocksForBiome(int par1, int par2, byte[] par3ArrayOfByte, BiomeGenBase[] par4ArrayOfBiomeGenBase)
public void replaceBlocksForBiome(int par1, int par2, Block[] blocks, byte[] par3ArrayOfByte, BiomeGenBase[] par4ArrayOfBiomeGenBase)
{
}
@ -129,8 +132,8 @@ public class LimboGenerator extends ChunkProviderGenerate
{
//TODO: Wtf? Why do you reinitialize the seed when we already initialized it in the constructor?! ~SenseiKiwi
LimboGenerator.rand.setSeed(chunkX * 341873128712L + chunkZ * 132897987541L);
byte[] var3 = new byte[32768];
this.generateTerrain(chunkX, chunkZ, var3);
Block[] var3 = new Block[32768];
this.func_147424_a(chunkX, chunkZ, var3);
Chunk var4 = new Chunk(this.worldObj, var3, chunkX, chunkZ);
var4.generateSkylightMap();
@ -163,7 +166,7 @@ public class LimboGenerator extends ChunkProviderGenerate
{
ChunkProviderEvent.InitNoiseField event = new ChunkProviderEvent.InitNoiseField(this, par1ArrayOfDouble, par2, par3, par4, par5, par6, par7);
MinecraftForge.EVENT_BUS.post(event);
if (event.getResult() == Result.DENY) return event.noisefield;
if (event.getResult() == Event.Result.DENY) return event.noisefield;
if (par1ArrayOfDouble == null)
{
@ -208,13 +211,13 @@ public class LimboGenerator extends ChunkProviderGenerate
{
for (int var22 = -var19; var22 <= var19; ++var22)
{
float var24 = this.parabolicField[var21 + 2 + (var22 + 2) * 5] / (BiomeGenBase.plains.minHeight + 9.0F);
float var24 = this.parabolicField[var21 + 2 + (var22 + 2) * 5] / (BiomeGenBase.plains.rootHeight + 9.0F);
//this adjusts the height of the terrain
var16 += BiomeGenBase.plains.maxHeight * var24+4;
var17 += BiomeGenBase.plains.minHeight * var24-1;
var16 += BiomeGenBase.plains.heightVariation * var24+4;
var17 += BiomeGenBase.plains.rootHeight * var24-1;
var18 += var24;
}
}
@ -305,7 +308,7 @@ public class LimboGenerator extends ChunkProviderGenerate
return par1ArrayOfDouble;
}
@Override
public void generateTerrain(int par1, int par2, byte[] par3ArrayOfByte)
public void func_147424_a(int par1, int par2, Block[] blocks)
{
byte var4 = 4;
byte var5 = 16;
@ -353,16 +356,16 @@ public class LimboGenerator extends ChunkProviderGenerate
{
if ((var47 += var49) > 0.0D)
{
par3ArrayOfByte[var43 += var44] = (byte)properties.LimboBlockID;
blocks[var43 += var44] = mod_pocketDim.blockLimbo;
}
else if (var12 * 8 + var31 < var6)
{
par3ArrayOfByte[var43 += var44] = (byte)properties.PermaFabricBlockID;
blocks[var43 += var44] = mod_pocketDim.blockDimWallPerm;
}
else
{
par3ArrayOfByte[var43 += var44] = 0;
blocks[var43 += var44] = Blocks.air;
}
}
@ -402,7 +405,7 @@ public class LimboGenerator extends ChunkProviderGenerate
}
@Override
public ChunkPosition findClosestStructure(World var1, String var2,
public ChunkPosition func_147416_a(World var1, String var2,
int var3, int var4, int var5) {
// TODO Auto-generated method stub
return null;

View file

@ -2,6 +2,7 @@ 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.entity.player.EntityPlayerMP;
@ -50,7 +51,7 @@ public class LimboProvider extends WorldProvider
@Override
protected void registerWorldChunkManager()
{
super.worldChunkMgr = new WorldChunkManagerHell(mod_pocketDim.limboBiome,1,1);
super.worldChunkMgr = new WorldChunkManagerHell(mod_pocketDim.limboBiome,1);
}
@Override
@ -73,7 +74,7 @@ public class LimboProvider extends WorldProvider
@Override
public boolean canSnowAt(int x, int y, int z)
public boolean canSnowAt(int x, int y, int z, boolean checkLight)
{
return false;
}
@ -136,8 +137,8 @@ public class LimboProvider extends WorldProvider
@Override
public boolean canCoordinateBeSpawn(int par1, int par2)
{
int var3 = this.worldObj.getFirstUncoveredBlock(par1, par2);
return var3 == properties.LimboBlockID;
Block block = this.worldObj.getTopBlock(par1, par2);
return block == mod_pocketDim.blockLimbo;
}
@Override
public double getHorizon()
@ -148,14 +149,14 @@ public class LimboProvider extends WorldProvider
public Vec3 getSkyColor(Entity cameraEntity, float partialTicks)
{
setCloudRenderer( new CloudRenderBlank());
return this.worldObj.getWorldVec3Pool().getVecFromPool(0, 0, 0);
return Vec3.createVectorHelper(0, 0, 0);
}
@SideOnly(Side.CLIENT)
@Override
public Vec3 getFogColor(float par1, float par2)
{
return this.worldObj.getWorldVec3Pool().getVecFromPool(.2, .2, .2);
return Vec3.createVectorHelper(.2, .2, .2);
}
@Override

View file

@ -4,6 +4,7 @@ import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
@ -264,7 +265,7 @@ public class PocketBuilder
}
//Check if the block below that point is actually a door
Block block = Block.blocksList[world.getBlockId(source.getX(), source.getY() - 1, source.getZ())];
Block block = world.getBlock(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!");
@ -322,7 +323,7 @@ public class PocketBuilder
* @param door
* @return
*/
public static boolean generateNewPersonalPocket(DimLink link, DDProperties properties,Entity player, Block door)
public static boolean generateNewPersonalPocket(DimLink link, DDProperties properties,EntityPlayer player, Block door)
{
//incase a chicken walks in or something
if(!(player instanceof EntityPlayer))
@ -338,7 +339,7 @@ public class PocketBuilder
{
//Register a new dimension
NewDimData parent = PocketManager.getDimensionData(link.source().getDimension());
NewDimData dimension = PocketManager.registerPocket(parent, DimensionType.PERSONAL, player.getEntityName());
NewDimData dimension = PocketManager.registerPocket(parent, DimensionType.PERSONAL, player.getGameProfile().getId().toString());
//Load a world
@ -454,7 +455,7 @@ 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, 0, false, 0);
buildBox(world, center.getX(), center.getY(), center.getZ(), (size / 2), mod_pocketDim.blockDimWallPerm, 0, false, 0);
//check if we are building a personal pocket
int metadata = 0;
@ -466,19 +467,19 @@ public class PocketBuilder
//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, mod_pocketDim.blockDimWall.blockID, metadata,
buildBox(world, center.getX(), center.getY(), center.getZ(), (size / 2) - layer, mod_pocketDim.blockDimWall, 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, doorBlock.blockID);
int doorOrientation = BlockRotator.transformMetadata(BlockRotator.EAST_DOOR_METADATA, orientation - BlockRotator.EAST_DOOR_METADATA + 2, doorBlock);
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, int metadata, boolean placeTnt, int nonTntWeight)
private static void buildBox(World world, int centerX, int centerY, int centerZ, int radius, Block block, int metadata, boolean placeTnt, int nonTntWeight)
{
int x, y, z;
@ -495,14 +496,14 @@ public class PocketBuilder
{
for (z = startZ; z <= endZ; z++)
{
setBlockDirectlySpecial(world, x, startY, z, blockID, metadata, placeTnt, nonTntWeight);
setBlockDirectlySpecial(world, x, endY, z, blockID, metadata, placeTnt, nonTntWeight);
setBlockDirectlySpecial(world, x, startY, z, block, metadata, placeTnt, nonTntWeight);
setBlockDirectlySpecial(world, x, endY, z, block, metadata, placeTnt, nonTntWeight);
}
for (y = startY; y <= endY; y++)
{
setBlockDirectlySpecial(world, x, y, startZ, blockID, metadata, placeTnt, nonTntWeight);
setBlockDirectlySpecial(world, x, y, endZ, blockID, metadata, placeTnt, nonTntWeight);
setBlockDirectlySpecial(world, x, y, startZ, block, metadata, placeTnt, nonTntWeight);
setBlockDirectlySpecial(world, x, y, endZ, block, metadata, placeTnt, nonTntWeight);
}
}
@ -510,31 +511,26 @@ public class PocketBuilder
{
for (z = startZ; z <= endZ; z++)
{
setBlockDirectlySpecial(world, startX, y, z, blockID, metadata, placeTnt, nonTntWeight);
setBlockDirectlySpecial(world, endX, y, z, blockID, metadata, placeTnt, nonTntWeight);
setBlockDirectlySpecial(world, startX, y, z, block, metadata, placeTnt, nonTntWeight);
setBlockDirectlySpecial(world, endX, y, z, block, metadata, placeTnt, nonTntWeight);
}
}
}
private static void setBlockDirectlySpecial(World world, int x, int y, int z, int blockID, int metadata, boolean placeTnt, int nonTntWeight)
private static void setBlockDirectlySpecial(World world, int x, int y, int z, Block block, int metadata, boolean placeTnt, int nonTntWeight)
{
if (placeTnt && random.nextInt(nonTntWeight + 1) == 0)
{
setBlockDirectly(world, x, y, z, Block.tnt.blockID, 1);
setBlockDirectly(world, x, y, z, Blocks.tnt, 1);
}
else
{
setBlockDirectly(world, x, y, z, blockID, metadata);
setBlockDirectly(world, x, y, z, block, metadata);
}
}
private static void setBlockDirectly(World world, int x, int y, int z, int blockID, int metadata)
private static void setBlockDirectly(World world, int x, int y, int z, Block block, int metadata)
{
if (blockID != 0 && Block.blocksList[blockID] == null)
{
return;
}
int cX = x >> 4;
int cZ = z >> 4;
int cY = y >> 4;

View file

@ -2,6 +2,7 @@ package StevenDimDoors.mod_pocketDim.world;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.world.ChunkPosition;
import net.minecraft.world.World;
@ -27,7 +28,7 @@ public class PocketGenerator extends ChunkProviderGenerate
}
@Override
public void generateTerrain(int par1, int par2, byte[] par3ArrayOfByte)
public void func_147424_a(int par1, int par2, Block[] blocks)
{
}
@ -41,7 +42,7 @@ public class PocketGenerator extends ChunkProviderGenerate
@Override
public Chunk provideChunk(int chunkX, int chunkZ)
{
byte[] var3 = new byte[32768];
Block[] var3 = new Block[32768];
Chunk chunk = new Chunk(worldObj, var3, chunkX, chunkZ);
if(!chunk.isTerrainPopulated)
@ -77,7 +78,7 @@ public class PocketGenerator extends ChunkProviderGenerate
}
@Override
public ChunkPosition findClosestStructure(World var1, String var2, int var3, int var4, int var5)
public ChunkPosition func_147416_a(World var1, String var2, int var3, int var4, int var5)
{
return null;
}

View file

@ -6,13 +6,12 @@ import java.util.Random;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraft.world.gen.structure.ComponentNetherBridgeThrone;
import net.minecraft.world.gen.structure.StructureBoundingBox;
import net.minecraft.world.gen.structure.StructureComponent;
import net.minecraft.world.gen.structure.StructureNetherBridgeStart;
import StevenDimDoors.mod_pocketDim.config.DDProperties;
import net.minecraft.world.gen.structure.StructureNetherBridgePieces;
public class DDStructureNetherBridgeStart extends StructureNetherBridgeStart
public class DDStructureNetherBridgeStart extends StructureNetherBridgePieces.Start
{
public static final int MAX_GATEWAY_GENERATION_CHANCE = 100;
@ -26,26 +25,26 @@ public class DDStructureNetherBridgeStart extends StructureNetherBridgeStart
public DDStructureNetherBridgeStart(World world, Random random, int chunkX, int chunkZ, DDProperties properties)
{
// StructureNetherBridgeStart handles designing the fortress for us
super(world, random, chunkX, chunkZ);
super(random, chunkX, chunkZ);
Iterator componentIterator;
StructureComponent component;
StructureBoundingBox bounds;
ArrayList<ComponentNetherBridgeThrone> spawnerRooms;
ArrayList<StructureNetherBridgePieces.Throne> spawnerRooms;
hasGateway = false;
// Randomly decide whether to build a gateway in this fortress
if (random.nextInt(MAX_GATEWAY_GENERATION_CHANCE) < properties.FortressGatewayGenerationChance)
{
// Search for all the blaze spawners in a fortress
spawnerRooms = new ArrayList<ComponentNetherBridgeThrone>();
spawnerRooms = new ArrayList<StructureNetherBridgePieces.Throne>();
componentIterator = this.components.iterator();
while (componentIterator.hasNext())
{
component = (StructureComponent) componentIterator.next();
if (component instanceof ComponentNetherBridgeThrone)
if (component instanceof StructureNetherBridgePieces.Throne)
{
spawnerRooms.add((ComponentNetherBridgeThrone) component);
spawnerRooms.add((StructureNetherBridgePieces.Throne) component);
}
}
@ -78,7 +77,7 @@ public class DDStructureNetherBridgeStart extends StructureNetherBridgeStart
dimensionalTag.setInteger("GatewayMinY", this.minY);
dimensionalTag.setInteger("GatewayMinZ", this.minZ);
}
fortressTag.setCompoundTag("DimensionalDoors", dimensionalTag);
fortressTag.setTag("DimensionalDoors", dimensionalTag);
return fortressTag;
}

View file

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraftforge.common.DimensionManager;
@ -97,9 +98,9 @@ public class GatewayGenerator implements IWorldGenerator
//If the point is within the acceptable altitude range, the block above is empty, and we're
//not building on bedrock, then generate a rift there
if (y >= MIN_RIFT_Y && y <= MAX_RIFT_Y && world.isAirBlock(x, y + 1, z) &&
world.getBlockId(x, y, z) != Block.bedrock.blockID && //<-- Stops Nether roof spawning. DO NOT REMOVE!
world.getBlockId(x, y - 1, z) != Block.bedrock.blockID &&
world.getBlockId(x, y - 2, z) != Block.bedrock.blockID)
world.getBlock(x, y, z) != Blocks.bedrock && //<-- Stops Nether roof spawning. DO NOT REMOVE!
world.getBlock(x, y - 1, z) != Blocks.bedrock &&
world.getBlock(x, y - 2, z) != Blocks.bedrock)
{
//Create a link. If this is not the first time, create a child link and connect it to the first link.
if (link == null)
@ -165,8 +166,8 @@ public class GatewayGenerator implements IWorldGenerator
return (y >= MIN_RIFT_Y &&
y <= MAX_RIFT_Y &&
world.isAirBlock(x, y + 1, z) &&
world.getBlockId(x, y, z) != Block.bedrock.blockID && //<-- Stops Nether roof spawning. DO NOT REMOVE!
world.getBlockId(x, y - 1, z) != Block.bedrock.blockID &&
world.getBlock(x, y, z) != Blocks.bedrock && //<-- Stops Nether roof spawning. DO NOT REMOVE!
world.getBlock(x, y - 1, z) != Blocks.bedrock &&
checkFoundationMaterial(world, x, y - 2, z));
}
@ -175,8 +176,8 @@ public class GatewayGenerator implements IWorldGenerator
//We check the material and opacity to prevent generating gateways on top of trees or houses,
//or on top of strange things like tall grass, water, slabs, or torches.
//We also want to avoid generating things on top of the Nether's bedrock!
Material material = world.getBlockMaterial(x, y, z);
return (material != Material.leaves && material != Material.wood && material != Material.pumpkin
&& world.isBlockOpaqueCube(x, y, z) && world.getBlockId(x, y, z) != Block.bedrock.blockID);
Material material = world.getBlock(x, y, z).getMaterial();
return (material != Material.leaves && material != Material.wood && material != Material.gourd
&& world.isBlockNormalCubeDefault(x, y, z, false) && world.getBlock(x, y, z) != Blocks.bedrock);
}
}

View file

@ -1,11 +1,11 @@
package StevenDimDoors.mod_pocketDimClient;
import net.minecraft.util.IIcon;
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;
@ -79,7 +79,7 @@ public class PrivatePocketRender implements ISimpleBlockRenderingHandler
Tessellator tessellator = Tessellator.instance;
boolean flag = false;
Icon icon = renderer.getBlockIcon(block, world, x, y, z, 2);
IIcon icon = renderer.getBlockIcon(block, world, x, y, z, 2);
@ -144,7 +144,7 @@ public class PrivatePocketRender implements ISimpleBlockRenderingHandler
@Override
public boolean shouldRender3DInInventory()
public boolean shouldRender3DInInventory(int data)
{
// TODO Auto-generated method stub
return true;

View file

@ -31,7 +31,6 @@ 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.*;
@ -352,7 +351,7 @@ public class RenderDimDoor extends TileEntitySpecialRenderer
TileEntityDimDoor tile = (TileEntityDimDoor) par1TileEntity;
try
{
mod_pocketDim.dimensionalDoor.updateAttachedTile(tile.worldObj,
mod_pocketDim.dimensionalDoor.updateAttachedTile(tile.getWorldObj(),
tile.xCoord, tile.yCoord, tile.zCoord);
}
catch (Exception e)

View file

@ -41,7 +41,7 @@ public class RenderTransTrapdoor extends TileEntitySpecialRenderer
{
GL11.glDisable(GL11.GL_LIGHTING);
Random random = new Random(31100L);
int metadata = tile.worldObj.getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord);
int metadata = tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord);
for (int count = 0; count < 16; ++count)
{
@ -112,7 +112,7 @@ public class RenderTransTrapdoor extends TileEntitySpecialRenderer
GL11.glColor4d(var21 * var17, var22 * var17, var23 * var17, 1.0F);
if (TransTrapdoor.isTrapdoorSetLow(metadata))
{
if (BlockTrapDoor.isTrapdoorOpen(metadata))
if (BlockTrapDoor.func_150118_d(metadata))
{
GL11.glVertex3d(x, y+0.2, z);
GL11.glVertex3d(x, y+0.2, z+1);
@ -129,7 +129,7 @@ public class RenderTransTrapdoor extends TileEntitySpecialRenderer
}
else
{
if (BlockTrapDoor.isTrapdoorOpen(metadata))
if (BlockTrapDoor.func_150118_d(metadata))
{
GL11.glVertex3d(x, y+0.95, z);
GL11.glVertex3d(x, y+0.95, z+1);