Beginning of 1.7 version

most features disabled.

Signed-off-by: Clienthax <clienthax@gmail.com>
This commit is contained in:
Clienthax
2014-10-27 03:43:35 +00:00
parent 7b77b268bf
commit 905bb3cda6
99 changed files with 1259 additions and 1521 deletions

6
.gitignore vendored Normal file
View File

@@ -0,0 +1,6 @@
.gradle
*.iml
*.ipr
*.iws
out
run

View File

@@ -5,9 +5,13 @@ buildscript {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:1.0-SNAPSHOT'
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
}
}
@@ -18,7 +22,7 @@ group = "com.stevenrs11.dimdoors" // http://maven.apache.org/guides/mini/guide-n
archivesBaseName = "DimensionalDoors"
minecraft {
version = "1.6.4-9.11.1.964"
version = "1.7.10-10.13.2.1232"
replaceIn "mod_pocketDim.java"
replace "@VERSION@", project.version

View File

@@ -3,6 +3,7 @@ package StevenDimDoors.experimental;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
@@ -16,7 +17,7 @@ public class MazeBuilder
{
MazeDesign design = MazeDesigner.generate(random);
Point3D offset = new Point3D(x - design.width() / 2, y - design.height() - 1, z - design.length() / 2);
SphereDecayOperation decay = new SphereDecayOperation(random, 0, 0, Block.stoneBrick.blockID, 2);
SphereDecayOperation decay = new SphereDecayOperation(random, Blocks.air, 0, Blocks.stonebrick, 2);
buildRooms(design.getRoomGraph(), world, offset);
carveDoorways(design.getRoomGraph(), world, offset, decay, random);
@@ -37,7 +38,7 @@ public class MazeBuilder
for (IGraphNode<PartitionNode, DoorwayData> node : roomGraph.nodes())
{
PartitionNode room = node.data();
buildBox(world, offset, room.minCorner(), room.maxCorner(), Block.stoneBrick.blockID, 0);
buildBox(world, offset, room.minCorner(), room.maxCorner(), Blocks.stonebrick, 0);
}
}
@@ -146,28 +147,28 @@ public class MazeBuilder
private static void carveDoorAlongX(World world, int x, int y, int z)
{
setBlockDirectly(world, x, y, z, 0, 0);
setBlockDirectly(world, x, y + 1, z, 0, 0);
setBlockDirectly(world, x + 1, y, z, 0, 0);
setBlockDirectly(world, x + 1, y + 1, z, 0, 0);
setBlockDirectly(world, x, y, z, Blocks.air, 0);
setBlockDirectly(world, x, y + 1, z, Blocks.air, 0);
setBlockDirectly(world, x + 1, y, z, Blocks.air, 0);
setBlockDirectly(world, x + 1, y + 1, z, Blocks.air, 0);
}
private static void carveDoorAlongZ(World world, int x, int y, int z)
{
setBlockDirectly(world, x, y, z, 0, 0);
setBlockDirectly(world, x, y + 1, z, 0, 0);
setBlockDirectly(world, x, y, z + 1, 0, 0);
setBlockDirectly(world, x, y + 1, z + 1, 0, 0);
setBlockDirectly(world, x, y, z, Blocks.air, 0);
setBlockDirectly(world, x, y + 1, z, Blocks.air, 0);
setBlockDirectly(world, x, y, z + 1, Blocks.air, 0);
setBlockDirectly(world, x, y + 1, z + 1, Blocks.air, 0);
}
private static void carveHole(World world, int x, int y, int z)
{
setBlockDirectly(world, x, y, z, 0, 0);
setBlockDirectly(world, x, y + 1, z, 0, 0);
setBlockDirectly(world, x, y, z, Blocks.air, 0);
setBlockDirectly(world, x, y + 1, z, Blocks.air, 0);
}
private static void buildBox(World world, Point3D offset, Point3D minCorner, Point3D maxCorner, int blockID, int metadata)
private static void buildBox(World world, Point3D offset, Point3D minCorner, Point3D maxCorner, Block blockID, int metadata)
{
int minX = minCorner.getX() + offset.getX();
int minY = minCorner.getY() + offset.getY();
@@ -205,9 +206,9 @@ public class MazeBuilder
}
}
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 blockID, int metadata)
{
if (blockID != 0 && Block.blocksList[blockID] == null)
if (blockID.equals(Blocks.air))
{
return;
}
@@ -228,7 +229,6 @@ public class MazeBuilder
extBlockStorage = new ExtendedBlockStorage(cY << 4, !world.provider.hasNoSky);
chunk.getBlockStorageArray()[cY] = extBlockStorage;
}
extBlockStorage.setExtBlockID(localX, y & 15, localZ, blockID);
extBlockStorage.setExtBlockMetadata(localX, y & 15, localZ, metadata);
chunk.setChunkModified();
}

View File

@@ -29,12 +29,12 @@ public class SphereDecayOperation extends WorldOperation
private double centerX;
private double centerY;
private double centerZ;
private int primaryBlockID;
private Block primaryBlockID;
private int primaryMetadata;
private int secondaryBlockID;
private Block secondaryBlockID;
private int secondaryMetadata;
public SphereDecayOperation(Random random, int primaryBlockID, int primaryMetadata, int secondaryBlockID, int secondaryMetadata)
public SphereDecayOperation(Random random, Block primaryBlockID, int primaryMetadata, Block secondaryBlockID, int secondaryMetadata)
{
super("SphereDecayOperation");
this.random = random;

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,22 +1,8 @@
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
public class ConnectionHandler
{
/*
@Override
public String connectionReceived(NetLoginHandler netHandler, INetworkManager manager)
{
@@ -63,4 +49,5 @@ public class ConnectionHandler implements IConnectionHandler
PocketManager.getDimwatcher().onCreated(new ClientDimData(PocketManager.createDimensionDataDangerously(0)));
}
*/
}

View File

@@ -1,21 +1,16 @@
package StevenDimDoors.mod_pocketDim;
import net.minecraft.block.Block;
import StevenDimDoors.mod_pocketDim.config.DDProperties;
import StevenDimDoors.mod_pocketDim.items.behaviors.DispenserBehaviorStabilizedRS;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.BlockDispenser;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.ShapedOreRecipe;
import StevenDimDoors.mod_pocketDim.config.DDProperties;
import StevenDimDoors.mod_pocketDim.core.DDLock;
import StevenDimDoors.mod_pocketDim.items.ItemDDKey;
import StevenDimDoors.mod_pocketDim.items.behaviors.DispenserBehaviorStabilizedRS;
import cpw.mods.fml.common.ICraftingHandler;
import cpw.mods.fml.common.registry.GameRegistry;
public class CraftingManager implements ICraftingHandler
public class CraftingManager
{
CraftingManager() { }
@@ -27,19 +22,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 +42,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 +92,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,13 +109,15 @@ 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);
}
}
//TODO 1.7
/*
@Override
public void onCrafting(EntityPlayer player, ItemStack item, IInventory craftMatrix)
{
@@ -161,7 +158,7 @@ public class CraftingManager implements ICraftingHandler
// TODO Auto-generated method stub
}
*/
public static void registerDispenserBehaviors()
{
// Register the dispenser behaviors for certain DD items

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,31 +47,31 @@ 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.enchanted_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 itemID, int weight)
{
if (include)
items.add(new WeightedRandomChestContent(itemID, 0, 1, 1, weight));
}
private static void addContent(boolean include, ArrayList<WeightedRandomChestContent> items,
int itemID, int weight, int minAmount, int maxAmount)
Item itemID, int weight, int minAmount, int maxAmount)
{
if (include)
items.add(new WeightedRandomChestContent(itemID, 0, minAmount, maxAmount, weight));
@@ -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.chainmail_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

@@ -64,7 +64,7 @@ public class DimData implements Serializable
{
while (k<range)
{
if (world.getBlockId(x+i, y+j, z+k) == properties.RiftBlockID && MathHelper.abs(i)+MathHelper.abs(j)+MathHelper.abs(k)<distance)
if (world.getBlock(x+i, y+j, z+k).equals(mod_pocketDim.blockRift) && MathHelper.abs(i)+MathHelper.abs(j)+MathHelper.abs(k)<distance)
{
if(MathHelper.abs(i)+MathHelper.abs(j)+MathHelper.abs(k)!=0)
{
@@ -104,7 +104,7 @@ public class DimData implements Serializable
{
while (k<range)
{
if(world.getBlockId(x+i, y+j, z+k)==properties.RiftBlockID)
if(world.getBlock(x+i, y+j, z+k).equals(mod_pocketDim.blockRift))
{
if(MathHelper.abs(i)+MathHelper.abs(j)+MathHelper.abs(k)!=0)
{

View File

@@ -1,5 +1,19 @@
package StevenDimDoors.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.config.DDProperties;
import StevenDimDoors.mod_pocketDim.config.DDWorldProperties;
import StevenDimDoors.mod_pocketDim.core.*;
import StevenDimDoors.mod_pocketDim.items.BaseItemDoor;
import StevenDimDoors.mod_pocketDim.items.ItemWarpDoor;
import StevenDimDoors.mod_pocketDim.ticking.RiftRegenerator;
import StevenDimDoors.mod_pocketDim.util.Point4D;
import StevenDimDoors.mod_pocketDim.world.LimboProvider;
import StevenDimDoors.mod_pocketDim.world.PocketProvider;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.audio.SoundManager;
import net.minecraft.client.audio.SoundPoolEntry;
import net.minecraft.entity.Entity;
@@ -11,8 +25,6 @@ import net.minecraft.world.WorldProvider;
import net.minecraft.world.chunk.Chunk;
import net.minecraftforge.client.event.sound.PlayBackgroundMusicEvent;
import net.minecraftforge.client.event.sound.SoundLoadEvent;
import net.minecraftforge.event.EventPriority;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.entity.living.LivingFallEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
@@ -20,22 +32,6 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action;
import net.minecraftforge.event.terraingen.InitMapGenEvent;
import net.minecraftforge.event.world.ChunkEvent;
import net.minecraftforge.event.world.WorldEvent;
import StevenDimDoors.mod_pocketDim.config.DDProperties;
import StevenDimDoors.mod_pocketDim.config.DDWorldProperties;
import StevenDimDoors.mod_pocketDim.core.DDTeleporter;
import StevenDimDoors.mod_pocketDim.core.DimLink;
import StevenDimDoors.mod_pocketDim.core.DimensionType;
import StevenDimDoors.mod_pocketDim.core.NewDimData;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import StevenDimDoors.mod_pocketDim.items.BaseItemDoor;
import StevenDimDoors.mod_pocketDim.items.ItemWarpDoor;
import StevenDimDoors.mod_pocketDim.ticking.RiftRegenerator;
import StevenDimDoors.mod_pocketDim.util.Point4D;
import StevenDimDoors.mod_pocketDim.world.LimboProvider;
import StevenDimDoors.mod_pocketDim.world.PocketProvider;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class EventHookContainer
{
@@ -59,7 +55,7 @@ public class EventHookContainer
this.regenerator = regenerator;
}
@ForgeSubscribe(priority = EventPriority.LOW)
@SubscribeEvent(priority = EventPriority.LOW)
public void onInitMapGen(InitMapGenEvent event)
{
// Replace the Nether fortress generator with our own only if any
@@ -74,9 +70,10 @@ public class EventHookContainer
}
@SideOnly(Side.CLIENT)
@ForgeSubscribe
@SubscribeEvent
public void onSoundLoad(SoundLoadEvent event)
{
/*
event.manager.addSound(mod_pocketDim.modid + ":doorLockRemoved.ogg");
event.manager.addSound(mod_pocketDim.modid + ":doorLocked.ogg");
event.manager.addSound(mod_pocketDim.modid + ":keyLock.ogg");
@@ -90,10 +87,12 @@ public class EventHookContainer
event.manager.addSound(mod_pocketDim.modid + ":riftClose.ogg");
event.manager.addSound(mod_pocketDim.modid + ":riftDoor.ogg");
event.manager.addSound(mod_pocketDim.modid + ":creepy.ogg");
*/
//TODO 1.7 sounds.json
}
@SideOnly(Side.CLIENT)
@ForgeSubscribe
@SubscribeEvent
public void onSoundEffectResult(PlayBackgroundMusicEvent event)
{
if (FMLClientHandler.instance().getClient().thePlayer.worldObj.provider.dimensionId == mod_pocketDim.properties.LimboDimensionID)
@@ -102,7 +101,7 @@ public class EventHookContainer
}
}
@ForgeSubscribe
@SubscribeEvent
public void onPlayerEvent(PlayerInteractEvent event)
{
// Handle all door placement here
@@ -135,7 +134,7 @@ public class EventHookContainer
}
@ForgeSubscribe
@SubscribeEvent
public void onWorldLoad(WorldEvent.Load event)
{
// We need to initialize PocketManager here because onServerAboutToStart
@@ -153,13 +152,13 @@ public class EventHookContainer
}
}
@ForgeSubscribe
@SubscribeEvent
public void onPlayerFall(LivingFallEvent event)
{
event.setCanceled(event.entity.worldObj.provider.dimensionId == properties.LimboDimensionID);
}
@ForgeSubscribe(priority = EventPriority.HIGHEST)
@SubscribeEvent(priority = EventPriority.HIGHEST)
public boolean onDeathWithHighPriority(LivingDeathEvent event)
{
// Teleport the entity to Limbo if it's a player in a pocket dimension
@@ -175,7 +174,7 @@ public class EventHookContainer
if(entity.worldObj.provider instanceof PocketProvider)
{
EntityPlayer player = (EntityPlayer) entity;
mod_pocketDim.deathTracker.addUsername(player.username);
mod_pocketDim.deathTracker.addUsername(player.getDisplayName());//TODO 1.7 uuid
revivePlayerInLimbo(player);
event.setCanceled(true);
return false;
@@ -192,7 +191,7 @@ public class EventHookContainer
return true;
}
@ForgeSubscribe(priority = EventPriority.LOWEST)
@SubscribeEvent(priority = EventPriority.LOWEST)
public boolean onDeathWithLowPriority(LivingDeathEvent event)
{
// This low-priority handler gives mods a chance to save a player from
@@ -206,11 +205,11 @@ public class EventHookContainer
if (entity instanceof EntityPlayer && isValidSourceForLimbo(entity.worldObj.provider))
{
EntityPlayer player = (EntityPlayer) entity;
mod_pocketDim.deathTracker.addUsername(player.username);
mod_pocketDim.deathTracker.addUsername(player.getDisplayName());//TODO 1.7 convert to uuid
if (properties.LimboEnabled && !properties.LimboReturnsInventoryEnabled)
{
player.inventory.clearInventory(-1, -1);
{//TODO 1.7
// player.inventory.clearInventory(-1, -1);
revivePlayerInLimbo(player);
event.setCanceled(true);
}
@@ -240,7 +239,7 @@ public class EventHookContainer
DDTeleporter.teleportEntity(player, destination, false);
}
@ForgeSubscribe
@SubscribeEvent
public void onWorldSave(WorldEvent.Save event)
{
if (event.world.provider.dimensionId == 0)
@@ -254,7 +253,7 @@ public class EventHookContainer
}
}
@ForgeSubscribe
@SubscribeEvent
public void onChunkLoad(ChunkEvent.Load event)
{
// Schedule rift regeneration for any links located in this chunk.
@@ -277,6 +276,8 @@ public class EventHookContainer
{
if (world.isRemote)
{
//TODO 1.7
/*
SoundManager sndManager = FMLClientHandler.instance().getClient().sndManager;
// SenseiKiwi: I've added the following check as a quick fix for a
@@ -298,7 +299,7 @@ public class EventHookContainer
{
sndManager.sndSystem.stop("LimboMusic");
}
}
}*/
}
}
}

View File

@@ -1,22 +1,10 @@
package StevenDimDoors.mod_pocketDim;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import StevenDimDoors.mod_pocketDim.watcher.ClientLinkData;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet250CustomPayload;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import StevenDimDoors.mod_pocketDim.util.Point4D;
import StevenDimDoors.mod_pocketDim.watcher.ClientDimData;
import StevenDimDoors.mod_pocketDim.watcher.IUpdateWatcher;
import cpw.mods.fml.common.network.IPacketHandler;
import cpw.mods.fml.common.network.PacketDispatcher;
import cpw.mods.fml.common.network.Player;
public class ServerPacketHandler implements IPacketHandler
public class ServerPacketHandler
{
//TODO 1.7
/*
public ServerPacketHandler()
{
PocketManager.registerDimWatcher(new DimWatcher());
@@ -138,4 +126,5 @@ public class ServerPacketHandler implements IPacketHandler
e.printStackTrace();
}
}
*/
}

View File

@@ -1,54 +1,55 @@
package StevenDimDoors.mod_pocketDim.blocks;
import java.util.Random;
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.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemDoor;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.config.DDProperties;
import StevenDimDoors.mod_pocketDim.core.DDTeleporter;
import StevenDimDoors.mod_pocketDim.core.DimLink;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import StevenDimDoors.mod_pocketDim.items.ItemDDKey;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoor;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
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.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import java.util.Random;
public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEntityProvider
{
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 +61,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 +89,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 +113,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, 0));
this.updateAttachedTile(world, x, y, z);
}
@@ -121,11 +122,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 +187,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 +243,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 +335,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 neighborID)
{
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).equals(this))
{
world.setBlockToAir(x, y, z);
}
if (neighborID > 0 && neighborID != this.blockID)
if (!neighborID.equals(Blocks.air) && !neighborID.equals(this))
{
this.onNeighborBlockChange(world, x, y - 1, z, neighborID);
}
}
else
{
if (world.getBlockId(x, y + 1, z) != this.blockID)
if (!world.getBlock(x, y + 1, z).equals(this))
{
world.setBlockToAir(x, y, z);
if (!world.isRemote)
@@ -362,9 +363,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 || !neighborID.equals(Blocks.air) && neighborID.canProvidePower()) && !neighborID.equals(this))
{
this.onPoweredBlockChange(world, x, y, z, powered);
this.func_150014_a(world, x, y, z, powered);//onPoweredBlockChange
}
}
}
@@ -373,24 +374,27 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
/**
* only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative)
*/
@Override
//TODO 1.7
/* @Override
@SideOnly(Side.CLIENT)
public int idPicked(World world, int x, int y, int z)
{
return this.getDoorItem();
}
*/
/**
* Returns the ID of the items to drop on destruction.
*/
@Override
public int idDropped(int metadata, Random random, int fortune)
//TODO 1.7
/* @Override
public Item getItemDropped(int metadata, Random random, int fortune)
{
return isUpperDoorBlock(metadata) ? 0 : this.getDrops();
}
*/
@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).equals(this))
{
int metadata = world.getBlockMetadata(x, y - 1, z);
boolean canUse = isDoorOpen(metadata);
@@ -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);//onPoweredBlockChhange
}
}
else if (world.getBlockId(x, y + 1, z) == this.blockID)
else if (world.getBlock(x, y + 1, z).equals(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, 0);
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).equals(oldBlock))
{
mod_pocketDim.riftRegenerator.scheduleFastRegeneration(x, y, z, world);
}

View File

@@ -1,35 +1,34 @@
package StevenDimDoors.mod_pocketDim.blocks;
import java.util.List;
import java.util.Random;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDimClient.PrivatePocketRender;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
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.world.IBlockAccess;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDimClient.PrivatePocketRender;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.List;
import java.util.Random;
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(Material par2Material)
{
super(blockID, par2Material);
super(par2Material);
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
}
@@ -65,7 +64,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 +73,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 +98,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 item, CreativeTabs tab, List subItems)
{
for (int ix = 0; ix < 3; ix++)
{
@@ -139,9 +138,8 @@ 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)
Block block = Block.getBlockFromItem(playerEquip);
if (!block.isNormalCube() || block instanceof BlockContainer || block.equals(this))
{
return false;
}
@@ -151,7 +149,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.getBlockFromItem(entityPlayer.getCurrentEquippedItem().getItem()), entityPlayer.getCurrentEquippedItem().getItemDamage(), 0);
}
return true;
}

View File

@@ -1,37 +1,37 @@
package StevenDimDoors.mod_pocketDim.blocks;
import java.util.Random;
import StevenDimDoors.mod_pocketDim.config.DDProperties;
import StevenDimDoors.mod_pocketDim.core.DDTeleporter;
import StevenDimDoors.mod_pocketDim.helpers.yCoordHelper;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.util.Point4D;
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;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.config.DDProperties;
import StevenDimDoors.mod_pocketDim.core.DDTeleporter;
import StevenDimDoors.mod_pocketDim.helpers.yCoordHelper;
import StevenDimDoors.mod_pocketDim.util.Point4D;
import java.util.Random;
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()
{
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,8 @@ 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);
//TODO 1.7
// overworld.setBlock(destinationX + xc, destinationY - 1, destinationZ + zc, properties.LimboBlockID);
}
}
}

View File

@@ -1,23 +1,19 @@
package StevenDimDoors.mod_pocketDim.blocks;
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.world.IBlockAccess;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.BlockDoor;
import net.minecraft.block.material.Material;
import net.minecraft.item.Item;
import java.util.Random;
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 +24,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

@@ -1,11 +1,11 @@
package StevenDimDoors.mod_pocketDim.blocks;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.config.DDProperties;
import StevenDimDoors.mod_pocketDim.core.DimLink;
import StevenDimDoors.mod_pocketDim.core.LinkType;
import StevenDimDoors.mod_pocketDim.core.NewDimData;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoorGold;
import net.minecraft.block.material.Material;
@@ -15,15 +15,15 @@ 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).equals(this))
{
NewDimData dimension = PocketManager.createDimensionData(world);
DimLink link = dimension.getLink(x, y, z);
@@ -35,19 +35,19 @@ public class BlockGoldDimDoor extends BaseDimDoor
}
@Override
public int getDoorItem()
public net.minecraft.item.Item getDoorItem()
{
return mod_pocketDim.itemGoldenDimensionalDoor.itemID;
return mod_pocketDim.itemGoldenDimensionalDoor;
}
@Override
public int getDrops()
public net.minecraft.item.Item getDrops()
{
return mod_pocketDim.itemGoldenDoor.itemID;
return mod_pocketDim.itemGoldenDoor;
}
@Override
public TileEntity createNewTileEntity(World world)
public TileEntity createNewTileEntity(World world, int metadata)
{
return new TileEntityDimDoorGold();
}

View File

@@ -1,26 +1,26 @@
package StevenDimDoors.mod_pocketDim.blocks;
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.world.IBlockAccess;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.world.LimboDecay;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import java.util.Random;
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 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

@@ -1,38 +1,32 @@
package StevenDimDoors.mod_pocketDim.blocks;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Random;
import StevenDimDoors.mod_pocketDim.Point3D;
import StevenDimDoors.mod_pocketDim.config.DDProperties;
import StevenDimDoors.mod_pocketDim.core.DimLink;
import StevenDimDoors.mod_pocketDim.core.NewDimData;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityRift;
import StevenDimDoors.mod_pocketDim.util.Point4D;
import StevenDimDoors.mod_pocketDimClient.ClosingRiftFX;
import StevenDimDoors.mod_pocketDimClient.GoggleRiftFX;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFlowing;
import net.minecraft.block.BlockFluid;
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.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fluids.IFluidBlock;
import StevenDimDoors.mod_pocketDim.Point3D;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.config.DDProperties;
import StevenDimDoors.mod_pocketDim.core.DimLink;
import StevenDimDoors.mod_pocketDim.core.NewDimData;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityRift;
import StevenDimDoors.mod_pocketDim.util.Point4D;
import StevenDimDoors.mod_pocketDimClient.ClosingRiftFX;
import StevenDimDoors.mod_pocketDimClient.GoggleRiftFX;
import StevenDimDoors.mod_pocketDimClient.RiftFX;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.*;
public class BlockRift extends Block implements ITileEntityProvider
{
@@ -47,15 +41,18 @@ 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(Material par2Material, DDProperties properties)
{
super(i, par2Material);
super(par2Material);
this.setTickRandomly(true);
this.properties = properties;
this.modBlocksImmuneToRift = new ArrayList<Integer>();
//TODO 1.7
this.modBlocksImmuneToRift = new ArrayList<Block>();
/*
this.modBlocksImmuneToRift.add(properties.FabricBlockID);
this.modBlocksImmuneToRift.add(properties.PermaFabricBlockID);
this.modBlocksImmuneToRift.add(properties.DimensionalDoorID);
@@ -66,9 +63,10 @@ public class BlockRift extends Block implements ITileEntityProvider
this.modBlocksImmuneToRift.add(properties.TransientDoorID);
this.modBlocksImmuneToRift.add(properties.GoldenDimensionalDoorID);
this.modBlocksImmuneToRift.add(properties.GoldenDoorID);
*/
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);
@@ -85,10 +83,11 @@ public class BlockRift extends Block implements ITileEntityProvider
this.blocksImmuneToRift.add(Block.blockGold.blockID);
this.blocksImmuneToRift.add(Block.blockDiamond.blockID);
this.blocksImmuneToRift.add(Block.blockEmerald.blockID);
*/
}
@Override
public void registerIcons(IconRegister par1IconRegister)
public void registerBlockIcons(IIconRegister par1IconRegister)
{
this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName());
}
@@ -166,7 +165,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 +183,9 @@ 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);
//TODO 1.7
// world.destroyBlock(target.getX(), target.getY(), target.getZ(), false);
}
}
}
@@ -231,12 +231,14 @@ 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.equals(Blocks.air) && (random.nextInt(MAX_WORLD_THREAD_DROP_CHANCE) < properties.WorldThreadDropChance)
//TODO 1.7
&& !(/*block instanceof BlockFlowing ||
block instanceof BlockFluid ||
*/
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;
Point4D source = parent.source();
// Find reachable blocks that are vulnerable to rift damage and include air
@@ -281,14 +284,15 @@ 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);
//TODO 1.7
/* if (world.setBlock(x, y, z, properties.RiftBlockID))
{
dimension.createChildLink(x, y, z, parent);
dropWorldThread(blockID, world, x, y, z, random);
dropWorldThread(block, world, x, y, z, random);
return true;
}
}
*/ }
return false;
}
@@ -314,7 +318,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 +339,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
@@ -351,9 +355,10 @@ public class BlockRift extends Block implements ITileEntityProvider
// is designed to receive an entity, the source of the blast. We have no entity so
// 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));
//TODO 1.7
return (/*block.blockResistance >= MIN_IMMUNE_RESISTANCE ||*/
modBlocksImmuneToRift.contains(block) ||
blocksImmuneToRift.contains(block));
}
return false;
}
@@ -362,14 +367,16 @@ 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;
}
//TODO 1.7
/*
@Override
public int idPicked(World par1World, int par2, int par3, int par4)
{
@@ -380,23 +387,23 @@ public class BlockRift extends Block implements ITileEntityProvider
public int idDropped(int par1, Random par2Random, int par3)
{
return 0;
}
}*/
@Override
public TileEntity createNewTileEntity(World world)
public TileEntity createNewTileEntity(World world, int meta)
{
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 oldBlockID, 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);
// Schedule rift regeneration for this block if it was changed
if (world.getBlockId(x, y, z) != oldBlockID)
if (!world.getBlock(x, y, z).equals(oldBlockID))
{
mod_pocketDim.riftRegenerator.scheduleSlowRegeneration(x, y, z, world);
}

View File

@@ -1,6 +1,7 @@
package StevenDimDoors.mod_pocketDim.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
@@ -12,15 +13,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).equals(this))
{
NewDimData dimension = PocketManager.createDimensionData(world);
DimLink link = dimension.getLink(x, y, z);
@@ -32,14 +33,14 @@ public class DimensionalDoor extends BaseDimDoor
}
@Override
public int getDoorItem()
public Item getDoorItem()
{
return mod_pocketDim.itemDimensionalDoor.itemID;
return mod_pocketDim.itemDimensionalDoor;
}
@Override
public int getDrops()
public Item getDrops()
{
return Item.doorIron.itemID;
return Items.iron_door;
}
}

View File

@@ -25,9 +25,9 @@ public interface IDimDoor
*/
public void placeLink(World world, int x, int y, int z);
public int getDrops();
public net.minecraft.item.Item getDrops();
public int getDoorItem();
public net.minecraft.item.Item getDoorItem();
public TileEntity initDoorTE(World world, int x, int y, int z);

View File

@@ -12,16 +12,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).equals(this))
{
NewDimData dimension = PocketManager.getDimensionData(world);
DimLink link = dimension.getLink(x, y, z);
@@ -33,15 +33,15 @@ public class PersonalDimDoor extends BaseDimDoor
}
@Override
public int getDrops()
public net.minecraft.item.Item getDrops()
{
return mod_pocketDim.itemQuartzDoor.itemID;
return mod_pocketDim.itemQuartzDoor;
}
@Override
public int getDoorItem()
public net.minecraft.item.Item getDoorItem()
{
return mod_pocketDim.itemPersonalDoor.itemID;
return mod_pocketDim.itemPersonalDoor;
}
}

View File

@@ -9,9 +9,11 @@ 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.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
@@ -27,14 +29,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());
}
@@ -91,13 +93,15 @@ public class TransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntit
public void onPoweredBlockChange(World par1World, int par2, int par3, int par4, boolean par5)
{
if(this.checkCanOpen(par1World, par2, par3, par4))
{
super.onPoweredBlockChange(par1World, par2, par3, par4, par5);
{//TODO 1.7
// super.onPoweredBlockChange(par1World, par2, par3, par4, par5);//onPoweredBlockChange
}
}
@Override
public void enterDimDoor(World world, int x, int y, int z, Entity entity)
{
//TODO 1.7
/*
if (!world.isRemote && isTrapdoorOpen(world.getBlockMetadata(x, y, z)))
{
DimLink link = PocketManager.getLink(x, y, z, world);
@@ -106,18 +110,18 @@ public class TransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntit
DDTeleporter.traverseDimDoor(world, link, entity,this);
}
super.onPoweredBlockChange(world, x, y, z, false);
}
}*/
}
@Override
public void onBlockAdded(World world, int x, int y, int z)
{
this.placeLink(world, x, y, z);
world.setBlockTileEntity(x, y, z, this.createNewTileEntity(world));
world.setTileEntity(x, y, z, this.createNewTileEntity(world, 0));
}
@Override
public TileEntity createNewTileEntity(World world)
public TileEntity createNewTileEntity(World world, int meta)
{
return new TileEntityTransTrapdoor();
}
@@ -136,9 +140,11 @@ public class TransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntit
}
}
//TODO 1.7
/*
@Override
@SideOnly(Side.CLIENT)
public int idPicked(World world, int x, int y, int z)
public Item idPicked(World world, int x, int y, int z)
{
return this.getDoorItem();
}
@@ -147,18 +153,18 @@ public class TransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntit
public int idDropped(int metadata, Random random, int fortuneLevel)
{
return this.getDrops();
}*/
@Override
public net.minecraft.item.Item getDoorItem()
{
return Item.getItemFromBlock(mod_pocketDim.transTrapdoor);
}
@Override
public int getDoorItem()
public net.minecraft.item.Item getDrops()
{
return mod_pocketDim.transTrapdoor.blockID;
}
@Override
public int getDrops()
{
return Block.trapdoor.blockID;
return Item.getItemFromBlock(Blocks.trapdoor);
}
public static boolean isTrapdoorSetLow(int metadata)
@@ -169,8 +175,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, 0);
world.setTileEntity(x, y, z, te);
return te;
}
@@ -181,14 +187,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 oldBlockID, 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);
// Schedule rift regeneration for this block if it was replaced
if (world.getBlockId(x, y, z) != oldBlockID)
if (!world.getBlock(x, y, z).equals(oldBlockID))
{
mod_pocketDim.riftRegenerator.scheduleFastRegeneration(x, y, z, world);
}

View File

@@ -1,5 +1,6 @@
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;
@@ -15,9 +16,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 +31,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).equals(this))
{
boolean canUse = true;
int metadata = world.getBlockMetadata(x, y - 1, z);
@@ -48,12 +49,12 @@ public class TransientDoor extends BaseDimDoor
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).equals(this))
{
enterDimDoor(world, x, y + 1, z, entity);
}
@@ -62,7 +63,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).equals(this))
{
NewDimData dimension = PocketManager.createDimensionData(world);
DimLink link = dimension.getLink(x, y, z);
@@ -74,15 +75,15 @@ public class TransientDoor extends BaseDimDoor
}
@Override
public int getDoorItem()
public net.minecraft.item.Item getDoorItem()
{
return 0;
return null;
}
@Override
public int getDrops()
public net.minecraft.item.Item getDrops()
{
return 0;
return null;
}
@Override

View File

@@ -1,6 +1,7 @@
package StevenDimDoors.mod_pocketDim.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
@@ -11,15 +12,15 @@ import StevenDimDoors.mod_pocketDim.core.PocketManager;
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).equals(this))
{
NewDimData dimension = PocketManager.getDimensionData(world);
dimension.createLink(x, y, z, LinkType.RANDOM,world.getBlockMetadata(x, y - 1, z));
@@ -27,14 +28,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 getDrops()
{
return Item.doorIron.itemID;
return Items.iron_door;
}
}

View File

@@ -1,6 +1,7 @@
package StevenDimDoors.mod_pocketDim.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
@@ -12,15 +13,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).equals(this))
{
NewDimData dimension = PocketManager.createDimensionData(world);
DimLink link = dimension.getLink(x, y, z);
@@ -32,14 +33,14 @@ public class WarpDoor extends BaseDimDoor
}
@Override
public int getDoorItem()
public Item getDoorItem()
{
return mod_pocketDim.itemWarpDoor.itemID;
return mod_pocketDim.itemWarpDoor;
}
@Override
public int getDrops()
public Item getDrops()
{
return Item.doorWood.itemID;
return Items.wooden_door;
}
}

View File

@@ -67,7 +67,7 @@ public class CommandCreateDungeonRift extends DDCommandBase
if (PocketBuilder.generateSelectedDungeonPocket(link, mod_pocketDim.properties, result))
{
// Create a rift to our selected dungeon and notify the player
sender.worldObj.setBlock(x, y + 1, z, mod_pocketDim.blockRift.blockID, 0, 3);
sender.worldObj.setBlock(x, y + 1, z, mod_pocketDim.blockRift, 0, 3);
sendChat(sender, "Created a rift to \"" + result.schematicName() + "\" dungeon (Dimension ID = " + link.destination().getDimension() + ").");
}
else

View File

@@ -56,7 +56,7 @@ public class CommandCreateRandomRift extends DDCommandBase
dimension = PocketManager.getDimensionData(sender.worldObj);
link = dimension.createLink(x, y + 1, z, LinkType.DUNGEON, orientation);
sender.worldObj.setBlock(x, y + 1, z,mod_pocketDim.blockRift.blockID, 0, 3);
sender.worldObj.setBlock(x, y + 1, z,mod_pocketDim.blockRift, 0, 3);
sendChat(sender, "Created a rift to a random dungeon.");
}
else
@@ -76,7 +76,7 @@ public class CommandCreateRandomRift extends DDCommandBase
if (PocketBuilder.generateSelectedDungeonPocket(link, mod_pocketDim.properties, result))
{
// Create a rift to our selected dungeon and notify the player
sender.worldObj.setBlock(x, y + 1, z, mod_pocketDim.blockRift.blockID, 0, 3);
sender.worldObj.setBlock(x, y + 1, z, mod_pocketDim.blockRift, 0, 3);
sendChat(sender, "Created a rift to \"" + result.schematicName() + "\" dungeon (Dimension ID = " + link.destination().getDimension() + ").");
}
else

View File

@@ -71,7 +71,7 @@ public class CommandDeleteRifts extends DDCommandBase
x = location.getX();
y = location.getY();
z = location.getZ();
if (world.getBlockId(x, y, z) == mod_pocketDim.blockRift.blockID)
if (world.getBlock(x, y, z).equals(mod_pocketDim.blockRift))
{
// Remove the rift and its link
world.setBlockToAir(x, y, z);

View File

@@ -62,7 +62,7 @@ public class CommandTeleportPlayer extends DDCommandBase
}
}
// Check if the target player is logged in
targetPlayer = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(command[0]);
targetPlayer = null;//TODO 1.7 MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(command[0]);
if (targetPlayer == null)
{
return DDCommandResult.PLAYER_OFFLINE;

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,7 @@ public abstract class DDCommandBase extends CommandBase
public static void sendChat(EntityPlayer player, String message)
{
ChatMessageComponent cmp = new ChatMessageComponent();
cmp.addText(message);
player.sendChatToPlayer(cmp);
player.addChatMessage(new ChatComponentText(message));
}
/*

View File

@@ -2,56 +2,13 @@ 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
@@ -115,7 +72,7 @@ public class DDProperties
public final int NonTntWeight;
public final int ClusterGenerationChance;
public final int GatewayGenerationChance;
public final int FortressGatewayGenerationChance;
public final int FortressGatewayGenerationChance = 0;
public final int MonolithSpawningChance;
public final int WorldThreadDropChance;
public final int LimboEntryRange;
@@ -195,37 +152,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();
@@ -247,10 +173,11 @@ public class DDProperties
"Sets the chance (out of " + GatewayGenerator.MAX_GATEWAY_GENERATION_CHANCE + ") that a Rift Gateway will " +
"generate in a given chunk. The default chance is 15.").getInt();
FortressGatewayGenerationChance = config.get(Configuration.CATEGORY_GENERAL, "Fortress Gateway Generation Chance", 33,
//TODO 1.7
/* FortressGatewayGenerationChance = config.get(Configuration.CATEGORY_GENERAL, "Fortress Gateway Generation Chance", 33,
"Sets the chance (out of " + DDStructureNetherBridgeStart.MAX_GATEWAY_GENERATION_CHANCE + ") that a Rift Gateway will " +
"generate as part of a Nether Fortress. The default chance is 33.").getInt();
*/
WorldThreadDropChance = config.get(Configuration.CATEGORY_GENERAL, "World Thread Drop Chance", 50,
"Sets the chance (out of " + BlockRift.MAX_WORLD_THREAD_DROP_CHANCE + ") that a rift will " +
"drop World Thread when it destroys a block. The default chance is 50.").getInt();
@@ -260,13 +187,6 @@ public class DDProperties
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,9 @@
package StevenDimDoors.mod_pocketDim.config;
import net.minecraftforge.common.config.Configuration;
import java.io.File;
import net.minecraftforge.common.Configuration;
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,6 @@ public class DDTeleporter
int x = destination.getX();
int y = destination.getY();
int z = destination.getZ();
int blockIDTop;
int blockIDBottom;
Point3D point;
switch (orientation)
@@ -81,19 +77,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());
Block blockBottom = world.getBlock(point.getX(), point.getY(), point.getZ());
Block blockTop = world.getBlock(point.getX(), point.getY() + 1, point.getZ());
if (Block.blocksList[blockIDBottom] != null)
if (!blockBottom.equals(Blocks.air))
{
if (!Block.blocksList[blockIDBottom].isBlockReplaceable(world, point.getX(), point.getY(), point.getZ()) && world.isBlockOpaqueCube(point.getX(), point.getY(), point.getZ()))
if (!blockBottom.getMaterial().isReplaceable() && blockBottom.isOpaqueCube())
{
return false;
}
}
if (Block.blocksList[blockIDTop] != null)
if (!blockTop.equals(Blocks.air))
{
if (!Block.blocksList[blockIDTop].isBlockReplaceable(world, point.getX(), point.getY() + 1, point.getZ()))
if (!blockTop.getMaterial().isReplaceable())
{
return false;
}
@@ -221,7 +217,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
@@ -297,7 +293,8 @@ public class DDTeleporter
// Set the new dimension and inform the client that it's moving to a new world.
player.dimension = destination.getDimension();
player.playerNetServerHandler.sendPacketToPlayer(new Packet9Respawn(player.dimension, (byte)player.worldObj.difficultySetting, newWorld.getWorldInfo().getTerrainType(), newWorld.getHeight(), player.theItemInWorldManager.getGameType()));
//TODO 1.7 packet
// player.playerNetServerHandler.sendPacketToPlayer(new Packet9Respawn(player.dimension, (byte)player.worldObj.difficultySetting, newWorld.getWorldInfo().getTerrainType(), newWorld.getHeight(), player.theItemInWorldManager.getGameType()));
// GreyMaria: Used the safe player entity remover before.
// This should fix an apparently unreported bug where
@@ -320,10 +317,11 @@ public class DDTeleporter
for(Object potionEffect : player.getActivePotionEffects())
{
PotionEffect effect = (PotionEffect)potionEffect;
player.playerNetServerHandler.sendPacketToPlayer(new Packet41EntityEffect(player.entityId, effect));
//TODO 1.7 packet
// player.playerNetServerHandler.sendPacketToPlayer(new Packet41EntityEffect(player.entityId, effect));
}
player.playerNetServerHandler.sendPacketToPlayer(new Packet43Experience(player.experience, player.experienceTotal, player.experienceLevel));
//TODO 1.7 packet
// player.playerNetServerHandler.sendPacketToPlayer(new Packet43Experience(player.experience, player.experienceTotal, player.experienceLevel));
}
// Creates sanity by removing the entity from its old location's chunk entity list, if applicable.
@@ -383,7 +381,7 @@ public class DDTeleporter
newWorld.getChunkProvider().loadChunk(MathHelper.floor_double(entity.posX) >> 4, MathHelper.floor_double(entity.posZ) >> 4);
// Tell Forge we're moving its players so everyone else knows.
// Let's try doing this down here in case this is what's killing NEI.
GameRegistry.onPlayerChangedDimension((EntityPlayer)entity);
//TODO 1.7 packet GameRegistry.onPlayerChangedDimension((EntityPlayer)entity);
}
DDTeleporter.placeInPortal(entity, newWorld, destination, properties, checkOrientation);
return entity;
@@ -518,7 +516,7 @@ public class DDTeleporter
return false;
}
NewDimData dim = PocketManager.getPersonalDimensionForPlayer(player.getEntityName());
NewDimData dim = PocketManager.getPersonalDimensionForPlayer(((EntityPlayer) player).getDisplayName());//TODO 1.7 convert to uuid
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.getMaterial().isReplaceable())
{
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))
{
world.setBlock(x + dx, y, z + dz, properties.FabricBlockID, 0, 2);
if (!world.getBlock(x + dx, y, z + dz).isNormalCube())
{//TODO 1.7
// world.setBlock(x + dx, y, z + dz, properties.FabricBlockID, 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,8 @@ 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);
//TODO 1.7
// orientation = BlockRotator.transformMetadata(orientation, 2, properties.WarpDoorID);
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).equals(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).equals(mod_pocketDim.blockRift))
{
link = getLink(x + i, y + j, z + k);
if (link != null)

View File

@@ -9,8 +9,11 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Random;
import java.util.TreeMap;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
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;
@@ -43,8 +46,8 @@ public class DungeonSchematic extends Schematic {
private static final short STANDARD_DIMENSIONAL_DOOR_ID = 1970;
private static final short STANDARD_TRANSIENT_DOOR_ID = 1979;
private static final short MONOLITH_SPAWN_MARKER_ID = (short) Block.endPortalFrame.blockID;
private static final short EXIT_DOOR_MARKER_ID = (short) Block.sandStone.blockID;
private static final Block MONOLITH_SPAWN_MARKER_ID = Blocks.end_portal_frame;
private static final Block EXIT_DOOR_MARKER_ID = Blocks.sandstone;
private static final int NETHER_DIMENSION_ID = -1;
private int orientation;
@@ -107,6 +110,8 @@ public class DungeonSchematic extends Schematic {
public void applyImportFilters(DDProperties properties)
{
//TODO 1.7
/*
//Search for special blocks (warp doors, dim doors, and end portal frames that mark Monolith spawn points)
SpecialBlockFinder finder = new SpecialBlockFinder(STANDARD_WARP_DOOR_ID, STANDARD_DIMENSIONAL_DOOR_ID,
MONOLITH_SPAWN_MARKER_ID, EXIT_DOOR_MARKER_ID);
@@ -123,7 +128,7 @@ public class DungeonSchematic extends Schematic {
//Filter out mod blocks except some of our own
CompoundFilter standardizer = new CompoundFilter();
standardizer.addFilter(new ModBlockFilter(MAX_VANILLA_BLOCK_ID, MOD_BLOCK_FILTER_EXCEPTIONS,
(short) properties.FabricBlockID, (byte) 0));
mod_pocketDim.itemStableFabric, (byte) 0));
//Also convert standard DD block IDs to local versions
Map<Short, Short> mapping = getAssignedToStandardIDMapping(properties);
@@ -136,6 +141,7 @@ public class DungeonSchematic extends Schematic {
}
}
applyFilter(standardizer);
*/
}
public void applyExportFilters(DDProperties properties)
@@ -143,9 +149,9 @@ public class DungeonSchematic extends Schematic {
//Check if some block IDs assigned by Forge differ from our standard IDs
//If so, change the IDs to standard values
CompoundFilter standardizer = new CompoundFilter();
Map<Short, Short> mapping = getAssignedToStandardIDMapping(properties);
Map<Block, Block> mapping = getAssignedToStandardIDMapping(properties);
for (Entry<Short, Short> entry : mapping.entrySet())
for (Entry<Block, Block> entry : mapping.entrySet())
{
if (entry.getKey() != entry.getValue())
{
@@ -161,15 +167,18 @@ public class DungeonSchematic extends Schematic {
applyFilter(standardizer);
}
private static Map<Short, Short> getAssignedToStandardIDMapping(DDProperties properties)
private static Map<Block, Block> getAssignedToStandardIDMapping(DDProperties properties)
{
//TODO 1.7
//If we ever need this broadly or support other mods, this should be moved to a separate class
TreeMap<Short, Short> mapping = new TreeMap<Short, Short>();
TreeMap<Block, Block> mapping = new TreeMap<Block, Block>();
/*
mapping.put((short) properties.FabricBlockID, STANDARD_FABRIC_OF_REALITY_ID);
mapping.put((short) properties.PermaFabricBlockID, STANDARD_ETERNAL_FABRIC_ID);
mapping.put((short) properties.WarpDoorID, STANDARD_WARP_DOOR_ID);
mapping.put((short) properties.DimensionalDoorID, STANDARD_DIMENSIONAL_DOOR_ID);
mapping.put((short) properties.TransientDoorID, STANDARD_TRANSIENT_DOOR_ID);
*/
return mapping;
}
@@ -194,6 +203,8 @@ public class DungeonSchematic extends Schematic {
public void copyToWorld(World world, Point3D pocketCenter, int targetOrientation, DimLink entryLink,
Random random, DDProperties properties, IBlockSetter blockSetter)
{
//TODO 1.7
/*
//TODO: This function is an improvised solution so we can get the release moving. In the future,
//we should generalize block transformations and implement support for them at the level of Schematic,
//then just use that support from DungeonSchematic instead of making this local fix.
@@ -203,7 +214,7 @@ public class DungeonSchematic extends Schematic {
int index;
int count;
int blockID;
Block blockID;
int blockMeta;
int dx, dy, dz;
Point3D pocketPoint = new Point3D(0, 0, 0);
@@ -233,7 +244,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,10 +254,11 @@ 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);
*/
}
private void setUpDungeon(NewDimData dimension, World world, Point3D pocketCenter, int turnAngle, DimLink entryLink, Random random, DDProperties properties, IBlockSetter blockSetter)
@@ -341,7 +353,7 @@ public class DungeonSchematic extends Schematic {
int z = location.getZ();
if (y >= 0)
{
int blockID = world.getBlockId(x, y, z);
Block blockID = world.getBlock(x, y, z);
int metadata = world.getBlockMetadata(x, y, z);
blockSetter.setBlock(world, x, y + 1, z, blockID, metadata);
}
@@ -365,7 +377,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 +389,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 +407,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 +420,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.equals(Blocks.wall_sign) || block.equals(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

@@ -33,12 +33,12 @@ public class FillContainersOperation extends WorldOperation
@Override
protected boolean applyToBlock(World world, int x, int y, int z)
{
int blockID = world.getBlockId(x, y, z);
Block blockID = world.getBlock(x, y, z);
// Fill empty chests and dispensers
if (Block.blocksList[blockID] instanceof BlockContainer)
if (blockID instanceof BlockContainer)
{
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
TileEntity tileEntity = world.getTileEntity(x, y, z);
// Fill chests
if (tileEntity instanceof TileEntityChest)

View File

@@ -20,8 +20,10 @@ public class ModBlockFilter extends SchematicFilter {
}
@Override
protected boolean applyToBlock(int index, short[] blocks, byte[] metadata)
protected boolean applyToBlock(int index, Block[] blocks, byte[] metadata)
{
//TODO 1.7
/*
int k;
short currentID = blocks[index];
if (currentID > maxVanillaBlockID || (currentID != 0 && Block.blocksList[currentID] == null))
@@ -39,7 +41,7 @@ public class ModBlockFilter extends SchematicFilter {
blocks[index] = replacementBlockID;
metadata[index] = replacementMetadata;
return true;
}
}*/
return false;
}

View File

@@ -3,8 +3,11 @@ package StevenDimDoors.mod_pocketDim.dungeon;
import java.util.ArrayList;
import StevenDimDoors.mod_pocketDim.Point3D;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.schematic.Schematic;
import StevenDimDoors.mod_pocketDim.schematic.SchematicFilter;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
public class SpecialBlockFinder extends SchematicFilter {
@@ -55,27 +58,29 @@ public class SpecialBlockFinder extends SchematicFilter {
}
@Override
protected boolean initialize(Schematic schematic, short[] blocks, byte[] metadata)
protected boolean initialize(Schematic schematic, Block[] blocks, byte[] metadata)
{
this.schematic = schematic;
return true;
}
@Override
protected boolean applyToBlock(int index, short[] blocks, byte[] metadata)
protected boolean applyToBlock(int index, Block[] blocks, byte[] metadata)
{
int indexBelow;
int indexDoubleBelow;
//TODO 1.7
/*
if (blocks[index] == monolithSpawnMarkerID)
{
monolithSpawnLocations.add(schematic.calculatePoint(index));
return true;
}
if (blocks[index] == dimensionalDoorID)
}*/
if (blocks[index].equals(mod_pocketDim.dimensionalDoor))
{
indexBelow = schematic.calculateIndexBelow(index);
if (indexBelow >= 0 && blocks[indexBelow] == dimensionalDoorID)
if (indexBelow >= 0 && blocks[indexBelow].equals(mod_pocketDim.dimensionalDoor))
{
dimensionalDoorLocations.add(schematic.calculatePoint(index));
return true;
@@ -85,18 +90,20 @@ public class SpecialBlockFinder extends SchematicFilter {
return false;
}
}
if (blocks[index] == warpDoorID)
if (blocks[index].equals(mod_pocketDim.warpDoor))
{
indexBelow = schematic.calculateIndexBelow(index);
if (indexBelow >= 0 && blocks[indexBelow] == warpDoorID)
if (indexBelow >= 0 && blocks[indexBelow].equals(mod_pocketDim.warpDoor))
{
indexDoubleBelow = schematic.calculateIndexBelow(indexBelow);
//TODO 1.7
/*
if (indexDoubleBelow >= 0 && blocks[indexDoubleBelow] == exitMarkerID)
{
exitDoorLocations.add(schematic.calculatePoint(index));
return true;
}
else if (entranceDoorLocation == null)
else*/ if (entranceDoorLocation == null)
{
entranceDoorLocation = schematic.calculatePoint(index);
entranceOrientation = (metadata[indexBelow] & 3);

View File

@@ -3,6 +3,7 @@ package StevenDimDoors.mod_pocketDim.helpers;
import java.util.HashMap;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
public class BlockRotationHelper
{
@@ -15,7 +16,7 @@ public class BlockRotationHelper
public void InitializeRotationMap()
{
HashMap<Integer,HashMap<Integer, Integer>> orientation0 = new HashMap<Integer,HashMap<Integer, Integer>>();
HashMap<Block,HashMap<Integer, Integer>> orientation0 = new HashMap<Block,HashMap<Integer, Integer>>();
HashMap<Integer,Integer> stairs0 = new HashMap<Integer,Integer>();
@@ -99,7 +100,7 @@ public class BlockRotationHelper
railsSpecial0.put(9, 8);
HashMap<Integer,HashMap<Integer, Integer>> orientation1 = new HashMap<Integer,HashMap<Integer, Integer>>();
HashMap<Block,HashMap<Integer, Integer>> orientation1 = new HashMap<Block,HashMap<Integer, Integer>>();
HashMap<Integer,Integer> stairs1 = new HashMap<Integer,Integer>();
@@ -183,7 +184,7 @@ public class BlockRotationHelper
railsSpecial1.put(8, 8);
railsSpecial1.put(9, 9);
HashMap<Integer,HashMap<Integer, Integer>> orientation2 = new HashMap<Integer,HashMap<Integer, Integer>>();
HashMap<Block,HashMap<Integer, Integer>> orientation2 = new HashMap<Block,HashMap<Integer, Integer>>();
HashMap<Integer,Integer> stairs2 = new HashMap<Integer,Integer>();
@@ -270,126 +271,125 @@ public class BlockRotationHelper
orientation0.put(Block.stairsBrick.blockID, stairs0);
orientation0.put(Block.stairsCobblestone.blockID, stairs0);
orientation0.put(Block.stairsNetherBrick.blockID, stairs0);
orientation0.put(Block.stairsNetherQuartz.blockID, stairs0);
orientation0.put(Block.stairsSandStone.blockID, stairs0);
orientation0.put(Block.stairsStoneBrick.blockID, stairs0);
orientation0.put(Block.stairsWoodBirch.blockID, stairs0);
orientation0.put(Block.stairsWoodJungle.blockID, stairs0);
orientation0.put(Block.stairsWoodOak.blockID, stairs0);
orientation0.put(Block.stairsWoodSpruce.blockID, stairs0);
orientation0.put(Block.stairsBrick.blockID, stairs0);
orientation0.put(Block.vine.blockID, vine0);
orientation0.put(Block.chest.blockID, chestsLadders0);
orientation0.put(Block.chestTrapped.blockID, chestsLadders0);
orientation0.put(Block.ladder.blockID, chestsLadders0);
orientation0.put(Block.lever.blockID, leverButtonTorch0);
orientation0.put(Block.stoneButton.blockID, leverButtonTorch0);
orientation0.put(Block.woodenButton.blockID, leverButtonTorch0);
orientation0.put(Block.torchRedstoneActive.blockID, leverButtonTorch0);
orientation0.put(Block.torchRedstoneIdle.blockID, leverButtonTorch0);
orientation0.put(Block.torchWood.blockID, leverButtonTorch0);
orientation0.put(Block.pistonBase.blockID,pistonDropperDispenser0);
orientation0.put(Block.pistonExtension.blockID,pistonDropperDispenser0);
orientation0.put(Block.pistonMoving.blockID,pistonDropperDispenser0);
orientation0.put(Block.pistonStickyBase.blockID,pistonDropperDispenser0);
orientation0.put(Block.dropper.blockID,pistonDropperDispenser0);
orientation0.put(Block.dispenser.blockID,pistonDropperDispenser0);
orientation0.put(Block.redstoneComparatorActive.blockID,pistonDropperDispenser0);
orientation0.put(Block.redstoneComparatorIdle.blockID,pistonDropperDispenser0);
orientation0.put(Block.redstoneRepeaterActive.blockID,pistonDropperDispenser0);
orientation0.put(Block.redstoneRepeaterIdle.blockID,pistonDropperDispenser0);
orientation0.put(Block.doorWood.blockID,pistonDropperDispenser0);
orientation0.put(Block.doorIron.blockID,pistonDropperDispenser0);
orientation0.put(Block.tripWireSource.blockID,pistonDropperDispenser0);
orientation0.put(Block.railDetector.blockID,railsSpecial0);
orientation0.put(Block.railActivator.blockID,railsSpecial0);
orientation0.put(Block.railPowered.blockID,railsSpecial0);
orientation0.put(Block.rail.blockID,rails0);
orientation0.put(Blocks.brick_stairs, stairs0);
orientation0.put(Blocks.stone_stairs, stairs0);
orientation0.put(Blocks.nether_brick_stairs, stairs0);
orientation0.put(Blocks.quartz_stairs, stairs0);
orientation0.put(Blocks.sandstone_stairs, stairs0);
orientation0.put(Blocks.stone_brick_stairs, stairs0);
orientation0.put(Blocks.birch_stairs, stairs0);
orientation0.put(Blocks.jungle_stairs, stairs0);
orientation0.put(Blocks.oak_stairs, stairs0);
orientation0.put(Blocks.spruce_stairs, stairs0);
orientation0.put(Blocks.vine, vine0);
orientation0.put(Blocks.chest, chestsLadders0);
orientation0.put(Blocks.trapped_chest, chestsLadders0);
orientation0.put(Blocks.ladder, chestsLadders0);
orientation0.put(Blocks.lever, leverButtonTorch0);
orientation0.put(Blocks.stone_button, leverButtonTorch0);
orientation0.put(Blocks.wooden_button, leverButtonTorch0);
orientation0.put(Blocks.redstone_torch, leverButtonTorch0);
orientation0.put(Blocks.unlit_redstone_torch, leverButtonTorch0);
orientation0.put(Blocks.torch, leverButtonTorch0);
orientation0.put(Blocks.piston,pistonDropperDispenser0);
orientation0.put(Blocks.piston_extension,pistonDropperDispenser0);
orientation0.put(Blocks.piston_head,pistonDropperDispenser0);
orientation0.put(Blocks.sticky_piston,pistonDropperDispenser0);
orientation0.put(Blocks.dropper,pistonDropperDispenser0);
orientation0.put(Blocks.dispenser,pistonDropperDispenser0);
orientation0.put(Blocks.powered_comparator,pistonDropperDispenser0);
orientation0.put(Blocks.unpowered_comparator,pistonDropperDispenser0);
orientation0.put(Blocks.powered_repeater,pistonDropperDispenser0);
orientation0.put(Blocks.unpowered_repeater,pistonDropperDispenser0);
orientation0.put(Blocks.wooden_door,pistonDropperDispenser0);
orientation0.put(Blocks.iron_door,pistonDropperDispenser0);
orientation0.put(Blocks.tripwire,pistonDropperDispenser0);
orientation0.put(Blocks.detector_rail,railsSpecial0);
orientation0.put(Blocks.activator_rail,railsSpecial0);
orientation0.put(Blocks.golden_rail,railsSpecial0);
orientation0.put(Blocks.rail,rails0);
orientation1.put(Block.stairsBrick.blockID, stairs1);
orientation1.put(Block.stairsCobblestone.blockID, stairs1);
orientation1.put(Block.stairsNetherBrick.blockID, stairs1);
orientation1.put(Block.stairsNetherQuartz.blockID, stairs1);
orientation1.put(Block.stairsSandStone.blockID, stairs1);
orientation1.put(Block.stairsStoneBrick.blockID, stairs1);
orientation1.put(Block.stairsWoodBirch.blockID, stairs1);
orientation1.put(Block.stairsWoodJungle.blockID, stairs1);
orientation1.put(Block.stairsWoodOak.blockID, stairs1);
orientation1.put(Block.stairsWoodSpruce.blockID, stairs1);
orientation1.put(Block.stairsBrick.blockID, stairs1);
orientation1.put(Block.vine.blockID, vine1);
orientation1.put(Block.chest.blockID, chestsLadders1);
orientation1.put(Block.chestTrapped.blockID, chestsLadders1);
orientation1.put(Block.ladder.blockID, chestsLadders1);
orientation1.put(Block.lever.blockID, leverButtonTorch1);
orientation1.put(Block.stoneButton.blockID, leverButtonTorch1);
orientation1.put(Block.woodenButton.blockID, leverButtonTorch1);
orientation1.put(Block.torchRedstoneActive.blockID, leverButtonTorch1);
orientation1.put(Block.torchRedstoneIdle.blockID, leverButtonTorch1);
orientation1.put(Block.torchWood.blockID, leverButtonTorch1);
orientation1.put(Block.pistonBase.blockID,pistonDropperDispenser1);
orientation1.put(Block.pistonExtension.blockID,pistonDropperDispenser1);
orientation1.put(Block.pistonMoving.blockID,pistonDropperDispenser1);
orientation1.put(Block.pistonStickyBase.blockID,pistonDropperDispenser1);
orientation1.put(Block.dropper.blockID,pistonDropperDispenser1);
orientation1.put(Block.dispenser.blockID,pistonDropperDispenser1);
orientation1.put(Block.redstoneComparatorActive.blockID,pistonDropperDispenser1);
orientation1.put(Block.redstoneComparatorIdle.blockID,pistonDropperDispenser1);
orientation1.put(Block.redstoneRepeaterActive.blockID,pistonDropperDispenser1);
orientation1.put(Block.redstoneRepeaterIdle.blockID,pistonDropperDispenser1);
orientation1.put(Block.doorWood.blockID,pistonDropperDispenser1);
orientation1.put(Block.doorIron.blockID,pistonDropperDispenser1);
orientation1.put(Block.tripWireSource.blockID,pistonDropperDispenser1);
orientation1.put(Block.railDetector.blockID,railsSpecial1);
orientation1.put(Block.railActivator.blockID,railsSpecial1);
orientation1.put(Block.railPowered.blockID,railsSpecial1);
orientation1.put(Block.rail.blockID,rails1);
orientation1.put(Blocks.brick_stairs, stairs1);
orientation1.put(Blocks.nether_brick_stairs, stairs1);
orientation1.put(Blocks.quartz_stairs, stairs1);
orientation1.put(Blocks.sandstone_stairs, stairs1);
orientation1.put(Blocks.stone_brick_stairs, stairs1);
orientation1.put(Blocks.birch_stairs, stairs1);
orientation1.put(Blocks.jungle_stairs, stairs1);
orientation1.put(Blocks.oak_stairs, stairs1);
orientation1.put(Blocks.spruce_stairs, stairs1);
orientation1.put(Blocks.brick_stairs, stairs1);
orientation1.put(Blocks.vine, vine1);
orientation1.put(Blocks.chest, chestsLadders1);
orientation1.put(Blocks.trapped_chest, chestsLadders1);
orientation1.put(Blocks.ladder, chestsLadders1);
orientation1.put(Blocks.lever, leverButtonTorch1);
orientation1.put(Blocks.stone_button, leverButtonTorch1);
orientation1.put(Blocks.wooden_button, leverButtonTorch1);
orientation1.put(Blocks.redstone_torch, leverButtonTorch1);
orientation1.put(Blocks.unlit_redstone_torch, leverButtonTorch1);
orientation1.put(Blocks.torch, leverButtonTorch1);
orientation1.put(Blocks.piston,pistonDropperDispenser1);
orientation1.put(Blocks.piston_extension,pistonDropperDispenser1);
orientation1.put(Blocks.piston_head,pistonDropperDispenser1);
orientation1.put(Blocks.sticky_piston,pistonDropperDispenser1);
orientation1.put(Blocks.dropper,pistonDropperDispenser1);
orientation1.put(Blocks.dispenser,pistonDropperDispenser1);
orientation1.put(Blocks.powered_comparator,pistonDropperDispenser1);
orientation1.put(Blocks.unpowered_comparator,pistonDropperDispenser1);
orientation1.put(Blocks.powered_repeater,pistonDropperDispenser1);
orientation1.put(Blocks.unpowered_repeater,pistonDropperDispenser1);
orientation1.put(Blocks.wooden_door,pistonDropperDispenser1);
orientation1.put(Blocks.iron_door,pistonDropperDispenser1);
orientation1.put(Blocks.tripwire,pistonDropperDispenser1);
orientation1.put(Blocks.detector_rail,railsSpecial1);
orientation1.put(Blocks.activator_rail,railsSpecial1);
orientation1.put(Blocks.golden_rail,railsSpecial1);
orientation1.put(Blocks.rail,rails1);
orientation2.put(Block.stairsBrick.blockID, stairs2);
orientation2.put(Block.stairsCobblestone.blockID, stairs2);
orientation2.put(Block.stairsNetherBrick.blockID, stairs2);
orientation2.put(Block.stairsNetherQuartz.blockID, stairs2);
orientation2.put(Block.stairsSandStone.blockID, stairs2);
orientation2.put(Block.stairsStoneBrick.blockID, stairs2);
orientation2.put(Block.stairsWoodBirch.blockID, stairs2);
orientation2.put(Block.stairsWoodJungle.blockID, stairs2);
orientation2.put(Block.stairsWoodOak.blockID, stairs2);
orientation2.put(Block.stairsWoodSpruce.blockID, stairs2);
orientation2.put(Block.stairsBrick.blockID, stairs2);
orientation2.put(Block.vine.blockID, vine2);
orientation2.put(Block.chest.blockID, chestsLadders2);
orientation2.put(Block.chestTrapped.blockID, chestsLadders2);
orientation2.put(Block.ladder.blockID, chestsLadders2);
orientation2.put(Block.lever.blockID, leverButtonTorch2);
orientation2.put(Block.stoneButton.blockID, leverButtonTorch2);
orientation2.put(Block.woodenButton.blockID, leverButtonTorch2);
orientation2.put(Block.torchRedstoneActive.blockID, leverButtonTorch2);
orientation2.put(Block.torchRedstoneIdle.blockID, leverButtonTorch2);
orientation2.put(Block.torchWood.blockID, leverButtonTorch2);
orientation2.put(Block.pistonBase.blockID,pistonDropperDispenser2);
orientation2.put(Block.pistonExtension.blockID,pistonDropperDispenser2);
orientation2.put(Block.pistonMoving.blockID,pistonDropperDispenser2);
orientation2.put(Block.pistonStickyBase.blockID,pistonDropperDispenser2);
orientation2.put(Block.dropper.blockID,pistonDropperDispenser2);
orientation2.put(Block.dispenser.blockID,pistonDropperDispenser2);
orientation2.put(Block.redstoneComparatorActive.blockID,pistonDropperDispenser2);
orientation2.put(Block.redstoneComparatorIdle.blockID,pistonDropperDispenser2);
orientation2.put(Block.redstoneRepeaterActive.blockID,pistonDropperDispenser2);
orientation2.put(Block.redstoneRepeaterIdle.blockID,pistonDropperDispenser2);
orientation2.put(Block.doorWood.blockID,pistonDropperDispenser2);
orientation2.put(Block.doorIron.blockID,pistonDropperDispenser2);
orientation2.put(Block.tripWireSource.blockID,pistonDropperDispenser2);
orientation2.put(Block.railDetector.blockID,railsSpecial2);
orientation2.put(Block.railActivator.blockID,railsSpecial2);
orientation2.put(Block.railPowered.blockID,railsSpecial2);
orientation2.put(Block.rail.blockID,rails2);
this.rotationMappings.put(2, orientation2);
this.rotationMappings.put(1, orientation1);
this.rotationMappings.put(0, orientation0);
orientation0.put(Blocks.brick_stairs, stairs2);
orientation0.put(Blocks.stone_stairs, stairs2);
orientation0.put(Blocks.nether_brick_stairs, stairs2);
orientation0.put(Blocks.quartz_stairs, stairs2);
orientation0.put(Blocks.sandstone_stairs, stairs2);
orientation0.put(Blocks.stone_brick_stairs, stairs2);
orientation0.put(Blocks.birch_stairs, stairs2);
orientation0.put(Blocks.jungle_stairs, stairs2);
orientation0.put(Blocks.oak_stairs, stairs2);
orientation0.put(Blocks.spruce_stairs, stairs2);
orientation2.put(Blocks.vine, vine2);
orientation2.put(Blocks.chest, chestsLadders2);
orientation2.put(Blocks.trapped_chest, chestsLadders2);
orientation2.put(Blocks.ladder, chestsLadders2);
orientation2.put(Blocks.lever, leverButtonTorch2);
orientation2.put(Blocks.stone_button, leverButtonTorch2);
orientation2.put(Blocks.wooden_button, leverButtonTorch2);
orientation2.put(Blocks.redstone_torch, leverButtonTorch2);
orientation2.put(Blocks.unlit_redstone_torch, leverButtonTorch2);
orientation2.put(Blocks.torch, leverButtonTorch2);
orientation2.put(Blocks.piston,pistonDropperDispenser2);
orientation2.put(Blocks.piston_extension,pistonDropperDispenser2);
orientation2.put(Blocks.piston_head,pistonDropperDispenser2);
orientation2.put(Blocks.sticky_piston,pistonDropperDispenser2);
orientation2.put(Blocks.dropper,pistonDropperDispenser2);
orientation2.put(Blocks.dispenser,pistonDropperDispenser2);
orientation2.put(Blocks.powered_comparator,pistonDropperDispenser2);
orientation2.put(Blocks.unpowered_comparator,pistonDropperDispenser2);
orientation2.put(Blocks.powered_repeater,pistonDropperDispenser2);
orientation2.put(Blocks.unpowered_repeater,pistonDropperDispenser2);
orientation2.put(Blocks.wooden_door,pistonDropperDispenser2);
orientation2.put(Blocks.iron_door,pistonDropperDispenser2);
orientation2.put(Blocks.tripwire,pistonDropperDispenser2);
orientation2.put(Blocks.detector_rail,railsSpecial2);
orientation2.put(Blocks.activator_rail,railsSpecial2);
orientation2.put(Blocks.golden_rail,railsSpecial2);
orientation2.put(Blocks.rail,rails2);
//TODO 1.7
// this.rotationMappings.put(2, orientation2);
// this.rotationMappings.put(1, orientation1);
// this.rotationMappings.put(0, orientation0);
}
public int getRotatedBlock(int metaData, int desiredOrientation, int blockID)

View File

@@ -32,9 +32,9 @@ public class ChunkLoaderHelper implements LoadingCallback
int y = ticket.getModData().getInteger("goldDimDoorY");
int z = ticket.getModData().getInteger("goldDimDoorZ");
if (world.getBlockId(x, y, z) == mod_pocketDim.properties.GoldenDimensionalDoorID)
if (world.getBlock(x, y, z).equals(mod_pocketDim.goldenDimensionalDoor))
{
IChunkLoader loader = (IChunkLoader) world.getBlockTileEntity(x, y, z);
IChunkLoader loader = (IChunkLoader) world.getTileEntity(x, y, z);
if (!loader.isInitialized())
{
loader.initialize(ticket);

View File

@@ -2,6 +2,7 @@ package StevenDimDoors.mod_pocketDim.helpers;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
@@ -52,22 +53,17 @@ public class yCoordHelper
public static boolean isCoveredBlock(Chunk chunk, int localX, int y, int localZ)
{
int blockID;
Block block;
Material material;
if (y < 0)
return false;
blockID = chunk.getBlockID(localX, y, localZ);
if (blockID == 0)
block = chunk.getBlock(localX, y, localZ);
if (block.equals(Blocks.air))
return false;
block = Block.blocksList[blockID];
if (block == null)
return false;
material = block.blockMaterial;
material = block.getMaterial();
return (material.isLiquid() || !material.isReplaceable());
}
@@ -89,7 +85,7 @@ public class yCoordHelper
Chunk chunk = initializeChunkArea(world, x >> 4, z >> 4);
int height = world.getActualHeight();
int y, dx, dz, blockID, metadata;
int y, dx, dz, metadata;
boolean isSafe;
Block block;
@@ -109,12 +105,11 @@ public class yCoordHelper
{
for (dz = -1; dz <= 1 && isSafe; dz++)
{
blockID = chunk.getBlockID(localX + dx, y, localZ + dz);
block = chunk.getBlock(localX + dx, y, localZ + dz);
metadata = chunk.getBlockMetadata(localX + dx, y, localZ + dz);
block = Block.blocksList[blockID];
if (blockID != 0 && (!block.blockMaterial.isReplaceable() || block.blockMaterial.isLiquid()))
if (!block.equals(Blocks.air) && (!block.getMaterial().isReplaceable() || block.getMaterial().isLiquid()))
{
if (!block.blockMaterial.isReplaceable() && (!block.isOpaqueCube() || block.hasTileEntity(metadata)))
if (!block.getMaterial().isReplaceable() && (!block.isOpaqueCube() || block.hasTileEntity(metadata)))
{
isSafe = false;
}
@@ -152,7 +147,7 @@ public class yCoordHelper
Chunk chunk = initializeChunkArea(world, x >> 4, z >> 4);
int height = world.getActualHeight();
int y, dx, dz, blockID, metadata;
int y, dx, dz, metadata;
boolean isSafe;
boolean hasBlocks;
Block block;
@@ -170,12 +165,11 @@ public class yCoordHelper
{
for (dz = -1; dz <= 1 && isSafe; dz++)
{
blockID = chunk.getBlockID(localX + dx, y, localZ + dz);
block = chunk.getBlock(localX + dx, y, localZ + dz);
metadata = chunk.getBlockMetadata(localX + dx, y, localZ + dz);
block = Block.blocksList[blockID];
if (blockID != 0 && (!block.blockMaterial.isReplaceable() || block.blockMaterial.isLiquid()))
if (!block.equals(Blocks.air) && (!block.getMaterial().isReplaceable() || block.getMaterial().isLiquid()))
{
if (!block.blockMaterial.isReplaceable() && (!block.isOpaqueCube() || block.hasTileEntity(metadata)))
if (!block.getMaterial().isReplaceable() && (!block.isOpaqueCube() || block.hasTileEntity(metadata)))
{
if (layers >= 3)
{
@@ -247,7 +241,7 @@ public class yCoordHelper
{
for (dz = -1; dz <= 1; dz++, index++)
{
if (chunk.getBlockID(localX + dx, y, localZ + dz) != 0)
if (!chunk.getBlock(localX + dx, y, localZ + dz).equals(Blocks.air))
{
gaps[index] = 0;
}

View File

@@ -1,26 +1,26 @@
package StevenDimDoors.mod_pocketDim.items;
import java.util.HashMap;
import java.util.List;
import StevenDimDoors.mod_pocketDim.blocks.BaseDimDoor;
import StevenDimDoors.mod_pocketDim.config.DDProperties;
import StevenDimDoors.mod_pocketDim.core.DimLink;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoor;
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;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemDoor;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.blocks.BaseDimDoor;
import StevenDimDoors.mod_pocketDim.config.DDProperties;
import StevenDimDoors.mod_pocketDim.core.DimLink;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoor;
import java.util.HashMap;
import java.util.List;
public abstract class BaseItemDoor extends ItemDoor
{
@@ -35,9 +35,9 @@ public abstract class BaseItemDoor extends ItemDoor
* @param material
* @param door
*/
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 +51,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 +134,10 @@ public abstract class BaseItemDoor extends ItemDoor
// side
if (side == 1 && !world.isRemote)
{
int blockID = world.getBlockId(x, y, z);
if (blockID != 0)
Block blockID = world.getBlock(x, y, z);
if (!blockID.equals(Blocks.air))
{
if (!Block.blocksList[blockID].isBlockReplaceable(world, x, y, z))
if (!blockID.getMaterial().isReplaceable())
{
y++;
}
@@ -179,7 +179,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).equals(mod_pocketDim.blockRift))
{
DimLink link = PocketManager.getLink(hit.blockX, hit.blockY, hit.blockZ, world.provider.dimensionId);
if (link != null)
@@ -196,7 +196,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 +213,8 @@ 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);
return (id == properties.RiftBlockID || id == 0 || Block.blocksList[id].blockMaterial.isReplaceable());
Block block = world.getBlock(x, y, z);
return (block.equals(mod_pocketDim.blockRift) || block.equals(Blocks.air) || 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.func_147447_a(vec3, vec31, par3, !par3, false);//rayTradeblocks_do_do - not sure on last boolean TODO
}
}

View File

@@ -1,22 +1,23 @@
package StevenDimDoors.mod_pocketDim.items;
import net.minecraft.client.renderer.texture.IconRegister;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
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;
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

@@ -1,37 +1,32 @@
package StevenDimDoors.mod_pocketDim.items;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.EnumMovingObjectType;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.blocks.IDimDoor;
import StevenDimDoors.mod_pocketDim.core.DDLock;
import StevenDimDoors.mod_pocketDim.core.DimLink;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.watcher.ClientLinkData;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import java.util.List;
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 +50,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 +82,9 @@ public class ItemDDKey extends Item
{
return true;
}
int blockID = world.getBlockId(x, y, z);
Block blockID = world.getBlock(x, y, z);
// make sure we are dealing with a door
if (!(Block.blocksList[blockID] instanceof IDimDoor))
if (!(blockID instanceof IDimDoor))
{
return false;
}
@@ -146,7 +141,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)//TODO 1.7 is this right?
{
//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 +165,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)//TODO 1.7 is this right?
{
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

@@ -1,18 +1,15 @@
package StevenDimDoors.mod_pocketDim.items;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import StevenDimDoors.mod_pocketDim.config.DDProperties;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
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.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.util.AxisAlignedBB;
@@ -20,20 +17,16 @@ import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.config.DDProperties;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import com.google.common.collect.Multimap;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.List;
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 +48,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 +61,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.func_147447_a(var13, var23, true, false, false);//TODO might be 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 +107,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 +125,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).equals(mod_pocketDim.blockRift))
{
if (PocketManager.getLink(x, y, z, world) != null)
{
@@ -160,7 +153,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 +166,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.equals(par2ItemStack) ? true : false;
}
/**

View File

@@ -1,7 +1,6 @@
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
@@ -9,7 +8,7 @@ public class ItemRiftGoggles extends ItemArmor
public ItemRiftGoggles(int par1, int par2, int par3)
{
super(par1, EnumArmorMaterial.IRON, par1, par1);
super(ArmorMaterial.IRON, par1, par1);
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.getMaterial().isReplaceable())
{
return targetY + 1; // Move block placement down (-2+1) one so its directly over things like snow
}

View File

@@ -1,30 +1,31 @@
package StevenDimDoors.mod_pocketDim.items;
import java.util.List;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.core.DimLink;
import StevenDimDoors.mod_pocketDim.core.LinkType;
import StevenDimDoors.mod_pocketDim.core.NewDimData;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager;
import java.util.List;
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 +75,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()
{
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,8 @@ 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 = EnumFacing.EAST;//TODO 1.7
// BlockDispenser.getFacing(dispenser.getBlockMetadata());
int dx = facing.getFrontOffsetX();
int dy = facing.getFrontOffsetY();
int dz = facing.getFrontOffsetZ();

View File

@@ -1,36 +1,36 @@
package StevenDimDoors.mod_pocketDim.items;
import java.util.List;
import StevenDimDoors.mod_pocketDim.core.DimLink;
import StevenDimDoors.mod_pocketDim.core.NewDimData;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityRift;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
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;
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.DimLink;
import StevenDimDoors.mod_pocketDim.core.NewDimData;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityRift;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.List;
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).equals(mod_pocketDim.blockRift) && link != null &&
player.canPlayerEdit(hx, hy, hz, hit.sideHit, stack))
{
// Invoke onPlayerRightClick()
@@ -87,15 +87,16 @@ 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).equals(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();
//TODO 1.7
// tileEntity.onInventoryChanged();
}
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;
@@ -60,7 +60,6 @@ import StevenDimDoors.mod_pocketDim.ticking.CustomLimboPopulator;
import StevenDimDoors.mod_pocketDim.ticking.LimboDecayScheduler;
import StevenDimDoors.mod_pocketDim.ticking.MobMonolith;
import StevenDimDoors.mod_pocketDim.ticking.RiftRegenerator;
import StevenDimDoors.mod_pocketDim.ticking.ServerTickHandler;
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoor;
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoorGold;
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityRift;
@@ -85,21 +84,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@";
@@ -156,7 +146,6 @@ public class mod_pocketDim
public static RiftRegenerator riftRegenerator;
public static GatewayGenerator gatewayGenerator;
public static DeathTracker deathTracker;
private static ServerTickHandler serverTickHandler;
private static LimboDecayScheduler limboDecayScheduler;
private static LimboDecay limboDecay;
private static EventHookContainer hooks;
@@ -167,9 +156,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
@@ -195,45 +184,45 @@ public class mod_pocketDim
@EventHandler
public void onInitialization(FMLInitializationEvent event)
{
{//TODO 1.7
// Initialize ServerTickHandler instance
serverTickHandler = new ServerTickHandler();
TickRegistry.registerTickHandler(serverTickHandler, Side.SERVER);
// serverTickHandler = new ServerTickHandler();
// TickRegistry.registerTickHandler(serverTickHandler, Side.SERVER);
// Initialize LimboDecay instance: required for BlockLimbo
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(Material.iron).setLightLevel(1.0F).setHardness(0.1F).setBlockName("blockDimWall");
blockDimWallPerm = (new BlockDimWallPerm()).setLightLevel(1.0F).setBlockUnbreakable().setResistance(6000000.0F).setBlockName("blockDimWallPerm");
warpDoor = new WarpDoor(Material.wood, properties).setHardness(1.0F) .setBlockName("dimDoorWarp");
blockRift = (BlockRift) (new BlockRift(Material.air, properties).setHardness(1.0F) .setBlockName("rift"));
blockLimbo = new BlockLimbo(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.wooden_door)).setUnlocalizedName("itemDimDoorWarp");
itemRiftSignature = (new ItemRiftSignature()).setUnlocalizedName("itemLinkSignature");
itemRiftRemover = (new itemRiftRemover(Material.wood)).setUnlocalizedName("itemRiftRemover");
itemStableFabric = (new ItemStableFabric()).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,16 +300,18 @@ 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);
CraftingManager.registerDispenserBehaviors();
GameRegistry.registerCraftingHandler(new CraftingManager());
//TODO 1.7
// GameRegistry.registerCraftingHandler(new CraftingManager());
DungeonHelper.initialize();
gatewayGenerator = new GatewayGenerator(properties);
GameRegistry.registerWorldGenerator(mod_pocketDim.gatewayGenerator);
//TODO 1.7
// GameRegistry.registerWorldGenerator(mod_pocketDim.gatewayGenerator);
// Register loot chests
DDLoot.registerInfo(properties);
@@ -380,7 +371,8 @@ public class mod_pocketDim
// Unregister all tick receivers from serverTickHandler to avoid leaking
// scheduled tasks between single-player game sessions
serverTickHandler.unregisterReceivers();
//TODO 1.7
// serverTickHandler.unregisterReceivers();
spawner = null;
riftRegenerator = null;
limboDecayScheduler = null;
@@ -404,10 +396,12 @@ public class mod_pocketDim
// Register regular tick receivers
// CustomLimboPopulator should be initialized before any provider instances are created
//TODO 1.7
/*
spawner = new CustomLimboPopulator(serverTickHandler, properties);
riftRegenerator = new RiftRegenerator(serverTickHandler, blockRift);
limboDecayScheduler = new LimboDecayScheduler(serverTickHandler, limboDecay);
*/
hooks.setSessionFields(worldProperties, riftRegenerator);
}
@@ -442,8 +436,6 @@ public class mod_pocketDim
public static void sendChat(EntityPlayer player, String message)
{
ChatMessageComponent cmp = new ChatMessageComponent();
cmp.addText(message);
player.sendChatToPlayer(cmp);
player.addChatMessage(new ChatComponentText(message));
}
}

View File

@@ -1,12 +1,7 @@
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 StevenDimDoors.mod_pocketDim.Point3D;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import net.minecraft.block.Block;
public class BlockRotator
{
@@ -20,7 +15,8 @@ public class BlockRotator
private final static boolean[] hasOrientations = new boolean[BLOCK_ID_COUNT];
static
{
{//TODO 1.7 ... sigh...
/*
hasOrientations[Block.dispenser.blockID] = true;
hasOrientations[Block.dropper.blockID] = true;
hasOrientations[Block.stairsStoneBrick.blockID] = true;
@@ -72,10 +68,10 @@ public class BlockRotator
hasOrientations[mod_pocketDim.warpDoor.blockID] = true;
hasOrientations[mod_pocketDim.goldenDimensionalDoor.blockID] = true;
hasOrientations[mod_pocketDim.personalDimDoor.blockID] = true;
*/
}
public static int transformMetadata(int metadata, int turns, int blockID)
public static int transformMetadata(int metadata, int turns, Block blockID)
{
//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,23 +80,24 @@ public class BlockRotator
turns += 1 << 16;
turns %= 4;
if (hasOrientations[blockID])
{
while (turns > 0)
{
metadata = rotateMetadataBy90(metadata, blockID);
turns--;
}
}
return metadata;
}
private static int rotateMetadataBy90(int metadata, int blockID)
private static int rotateMetadataBy90(int metadata, Block blockID)
{
//TODO O GOD WHAT IS THIS 1.7
/*
//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 (blockID == Blocks.log)
{
if (metadata >= 4 && metadata < 12)
{
@@ -498,6 +495,7 @@ public class BlockRotator
break;
}
}
*/
return metadata;
}

View File

@@ -14,9 +14,9 @@ public class ChunkBlockSetter 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 blockID, int metadata)
{
if ((blockID == 0 && ignoreAir) || (blockID != 0 && Block.blocksList[blockID] == null))
if (ignoreAir)
{
return;
}
@@ -39,7 +39,6 @@ public class ChunkBlockSetter implements IBlockSetter
extBlockStorage = new ExtendedBlockStorage(cY << 4, !world.provider.hasNoSky);
chunk.getBlockStorageArray()[cY] = extBlockStorage;
}
extBlockStorage.setExtBlockID(localX, y & 15, localZ, blockID);
extBlockStorage.setExtBlockMetadata(localX, y & 15, localZ, metadata);
chunk.setChunkModified();
}

View File

@@ -1,5 +1,7 @@
package StevenDimDoors.mod_pocketDim.schematic;
import net.minecraft.block.Block;
import java.util.ArrayList;
public class CompoundFilter extends SchematicFilter {
@@ -18,7 +20,7 @@ public class CompoundFilter extends SchematicFilter {
}
@Override
protected boolean initialize(Schematic schematic, short[] blocks, byte[] metadata)
protected boolean initialize(Schematic schematic, Block[] blocks, byte[] metadata)
{
for (SchematicFilter filter : filters)
{
@@ -44,7 +46,7 @@ public class CompoundFilter extends SchematicFilter {
}
@Override
protected boolean applyToBlock(int index, short[] blocks, byte[] metadata)
protected boolean applyToBlock(int index, Block[] blocks, byte[] metadata)
{
for (SchematicFilter filter : filters)
{

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 blockID, int metadata);
}

View File

@@ -1,16 +1,18 @@
package StevenDimDoors.mod_pocketDim.schematic;
import net.minecraft.block.Block;
public class ReplacementFilter extends SchematicFilter {
private short targetBlock;
private Block targetBlock;
private byte targetMetadata;
private boolean matchMetadata;
private short replacementBlock;
private Block replacementBlock;
private byte replacementMetadata;
private boolean changeMetadata;
public ReplacementFilter(short targetBlock, byte targetMetadata, short replacementBlock, byte replacementMetadata)
public ReplacementFilter(Block targetBlock, byte targetMetadata, Block replacementBlock, byte replacementMetadata)
{
super("ReplacementFilter");
this.targetBlock = targetBlock;
@@ -21,7 +23,7 @@ public class ReplacementFilter extends SchematicFilter {
this.changeMetadata = true;
}
public ReplacementFilter(short targetBlock, short replacementBlock, byte replacementMetadata)
public ReplacementFilter(Block targetBlock, Block replacementBlock, byte replacementMetadata)
{
super("ReplacementFilter");
this.targetBlock = targetBlock;
@@ -31,7 +33,7 @@ public class ReplacementFilter extends SchematicFilter {
this.changeMetadata = true;
}
public ReplacementFilter(short targetBlock, byte targetMetadata, short replacementBlock)
public ReplacementFilter(Block targetBlock, byte targetMetadata, Block replacementBlock)
{
super("ReplacementFilter");
this.targetBlock = targetBlock;
@@ -41,7 +43,7 @@ public class ReplacementFilter extends SchematicFilter {
this.changeMetadata = false;
}
public ReplacementFilter(short targetBlock, short replacementBlock)
public ReplacementFilter(Block targetBlock, Block replacementBlock)
{
super("ReplacementFilter");
this.targetBlock = targetBlock;
@@ -51,9 +53,9 @@ public class ReplacementFilter extends SchematicFilter {
}
@Override
protected boolean applyToBlock(int index, short[] blocks, byte[] metadata)
protected boolean applyToBlock(int index, Block[] blocks, byte[] metadata)
{
if (blocks[index] == targetBlock)
if (blocks[index].equals(targetBlock))
{
if ((matchMetadata && metadata[index] == targetMetadata) || !matchMetadata)
{

View File

@@ -27,11 +27,11 @@ public class Schematic {
protected short height;
protected short length;
protected short[] blocks;
protected Block[] 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, Block[] blocks, byte[] metadata, NBTTagList tileEntities)
{
this.width = width;
this.height = height;
@@ -96,7 +96,7 @@ public class Schematic {
return length;
}
public short getBlockID(int x, int y, int z)
public Block getBlockID(int x, int y, int z)
{
return blocks[calculateIndex(x, y, z)];
}
@@ -132,6 +132,8 @@ public class Schematic {
public static Schematic readFromStream(InputStream schematicStream) throws InvalidSchematicException
{
//TODO 1.7
/*
short width;
short height;
short length;
@@ -212,7 +214,7 @@ public class Schematic {
}
//Get the list of tile entities
tileEntities = schematicTag.getTagList("TileEntities");
tileEntities = (NBTTagList)schematicTag.getTag("TileEntities");
Schematic result = new Schematic(width, height, length, blocks, metadata, tileEntities);
return result;
@@ -226,6 +228,8 @@ public class Schematic {
{
throw new InvalidSchematicException("An unexpected error occurred while trying to decode the schematic.", ex);
}
*/
return null;
}
public static Schematic copyFromWorld(World world, int x, int y, int z, short width, short height, short length, boolean doCompactBounds)
@@ -301,12 +305,14 @@ public class Schematic {
return writeToNBT(width, height, length, blocks, metadata, tileEntities, copyTileEntities);
}
protected static NBTTagCompound writeToNBT(short width, short height, short length, short[] blocks, byte[] metadata,
protected static NBTTagCompound writeToNBT(short width, short height, short length, Block[] blocks, byte[] metadata,
NBTTagList tileEntities, boolean copyTileEntities)
{
//This is the main storage function. Schematics are really compressed NBT tags, so if we can generate
//the tags, most of the work is done. All the other storage functions will rely on this one.
//TODO 1.7
/*
NBTTagCompound schematicTag = new NBTTagCompound("Schematic");
schematicTag.setShort("Width", width);
@@ -341,6 +347,8 @@ public class Schematic {
schematicTag.setTag("TileEntities", tileEntities);
}
return schematicTag;
*/
return null;
}
public void writeToFile(String schematicPath) throws IOException
@@ -376,6 +384,8 @@ public class Schematic {
protected void copyToWorld(World world, int x, int y, int z, IBlockSetter blockSetter)
{
//TODO 1.7
/*
//This isn't implemented as a WorldOperation because it doesn't quite fit the structure of those operations.
//It's not worth the trouble in this case.
int index;
@@ -400,7 +410,7 @@ public class 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
dx = tileTag.getInteger("x") + x;
dy = tileTag.getInteger("y") + y;
@@ -409,7 +419,8 @@ public class Schematic {
tileTag.setInteger("y", dy);
tileTag.setInteger("z", dz);
//Load the tile entity and put it in the world
world.setBlockTileEntity(dx, dy, dz, TileEntity.createAndLoadEntity(tileTag));
world.setTileEntity(dx, dy, dz, TileEntity.createAndLoadEntity(tileTag));
}
*/
}
}

View File

@@ -1,5 +1,7 @@
package StevenDimDoors.mod_pocketDim.schematic;
import net.minecraft.block.Block;
public class SchematicFilter {
private String name;
@@ -14,7 +16,7 @@ public class SchematicFilter {
return name;
}
public boolean apply(Schematic schematic, short[] blocks, byte[] metadata)
public boolean apply(Schematic schematic, Block[] blocks, byte[] metadata)
{
if (!initialize(schematic, blocks, metadata))
return false;
@@ -28,12 +30,12 @@ public class SchematicFilter {
return finish();
}
protected boolean initialize(Schematic schematic, short[] blocks, byte[] metadata)
protected boolean initialize(Schematic schematic, Block[] blocks, byte[] metadata)
{
return true;
}
protected boolean applyToBlock(int index, short[] blocks, byte[] metadata)
protected boolean applyToBlock(int index, Block[] blocks, byte[] metadata)
{
return true;
}

View File

@@ -21,9 +21,9 @@ 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 blockID, int metadata)
{
if (!ignoreAir || blockID != 0)
if (!ignoreAir)
{
world.setBlock(x, y, z, blockID, metadata, flags);
}

View File

@@ -1,5 +1,6 @@
package StevenDimDoors.mod_pocketDim.schematic;
import net.minecraft.block.Block;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
@@ -11,7 +12,7 @@ public class WorldCopyOperation extends WorldOperation
private int originY;
private int originZ;
private int index;
private short[] blockIDs;
private Block[] blockIDs;
private byte[] metadata;
private NBTTagList tileEntities;
@@ -30,7 +31,7 @@ public class WorldCopyOperation extends WorldOperation
originX = x;
originY = y;
originZ = z;
blockIDs = new short[width * height * length];
blockIDs = new Block[width * height * length];
metadata = new byte[width * height * length];
tileEntities = new NBTTagList();
return true;
@@ -39,10 +40,10 @@ public class WorldCopyOperation extends WorldOperation
@Override
protected boolean applyToBlock(World world, int x, int y, int z)
{
blockIDs[index] = (short) world.getBlockId(x, y, z);
blockIDs[index] = world.getBlock(x, y, z);
metadata[index] = (byte) world.getBlockMetadata(x, y, z);
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
TileEntity tileEntity = world.getTileEntity(x, y, z);
if (tileEntity != null)
{
//Extract tile entity data
@@ -59,7 +60,7 @@ public class WorldCopyOperation extends WorldOperation
return true;
}
public short[] getBlockIDs()
public Block[] getBlockIDs()
{
return blockIDs;
}

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 blockID;
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);
blockID = pocket.getBlock(x, y, z);
while (blockID == 0 &&y>0)
while (blockID.equals(Blocks.air) &&y>0)
{
y--;
blockID = pocket.getBlockId(x, y, z);
blockID = pocket.getBlock(x, y, z);
}
while ((blockID == properties.FabricBlockID || blockID == properties.PermaFabricBlockID) && y > 0)
while ((blockID.equals(mod_pocketDim.blockDimWall) || blockID.equals(mod_pocketDim.blockDimWallPerm)) && y > 0)
{
y--;
blockID = pocket.getBlockId(x, y, z);
blockID = pocket.getBlock(x, y, z);
}
while (blockID == 0 && y > 0)
while (blockID.equals(Blocks.air) && y > 0)
{
y--;
blockID = pocket.getBlockId(x, y, z);
blockID = 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).equals(Blocks.air) && y <255)
{
y++;
}

View File

@@ -94,7 +94,7 @@ public class MobMonolith extends EntityFlying implements IMob
protected void applyEntityAttributes()
{
super.applyEntityAttributes();
this.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.maxHealth).setAttribute(57005);
this.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.maxHealth).setBaseValue(57005);
}
@Override

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,8 +113,8 @@ 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))
Block blockID = world.getBlock(x, y, z);
if (world.setBlock(x, y, z, blockRift))
blockRift.dropWorldThread(blockID, world, x, y, z, random);
}
}

View File

@@ -1,5 +1,7 @@
/*
package StevenDimDoors.mod_pocketDim.ticking;
import java.util.ArrayList;
import java.util.EnumSet;
@@ -9,6 +11,8 @@ import cpw.mods.fml.common.TickType;
public class ServerTickHandler implements ITickHandler, IRegularTickSender
{
//TODO rewrite for 1.7
private static final String PROFILING_LABEL = "Dimensional Doors: Server Tick";
private int tickCount = 0;
@@ -79,3 +83,4 @@ public class ServerTickHandler implements ITickHandler, IRegularTickSender
return PROFILING_LABEL; //Used for profiling!
}
}
*/

View File

@@ -3,20 +3,13 @@ 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;
import net.minecraft.network.Packet;
public class TileEntityDimDoor extends DDTileEntityBase
@@ -38,8 +31,8 @@ public class TileEntityDimDoor extends DDTileEntityBase
public Packet getDescriptionPacket()
{
if(PocketManager.getLink(xCoord, yCoord, zCoord, worldObj)!=null)
{
return ServerPacketHandler.createLinkPacket(new ClientLinkData(PocketManager.getLink(xCoord, yCoord, zCoord, worldObj)));
{//todo networking 1.7
// return ServerPacketHandler.createLinkPacket(new ClientLinkData(PocketManager.getLink(xCoord, yCoord, zCoord, worldObj)));
}
return null;
}

View File

@@ -1,27 +1,23 @@
package StevenDimDoors.mod_pocketDim.tileentities;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
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;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.config.DDProperties;
import StevenDimDoors.mod_pocketDim.core.DimLink;
import StevenDimDoors.mod_pocketDim.core.NewDimData;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.util.Point4D;
import StevenDimDoors.mod_pocketDim.util.l_systems.LSystem;
import StevenDimDoors.mod_pocketDim.util.l_systems.LSystem.PolygonStorage;
import StevenDimDoors.mod_pocketDim.watcher.ClientLinkData;
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.util.AxisAlignedBB;
import java.util.List;
import java.util.Random;
public class TileEntityRift extends DDTileEntityBase
{
@@ -65,7 +61,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).equals(mod_pocketDim.blockRift))
{
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
}
@@ -76,7 +72,7 @@ public class TileEntityRift extends DDTileEntityBase
return;
}
if (worldObj.getBlockId(xCoord, yCoord, zCoord) != mod_pocketDim.blockRift.blockID)
if (!worldObj.getBlock(xCoord, yCoord, zCoord).equals(mod_pocketDim.blockRift))
{
invalidate();
return;
@@ -154,11 +150,12 @@ 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();
//TODO 1.7
// rift.onInventoryChanged();
}
}
}
@@ -207,7 +204,8 @@ public class TileEntityRift extends DDTileEntityBase
this.yOffset = 0;
this.xOffset = 0;
}
this.onInventoryChanged();
//TODO 1.7
//this.onInventoryChanged();
}
@Override
@@ -283,7 +281,8 @@ public class TileEntityRift extends DDTileEntityBase
nbt.setFloat("growth", this.growth);
}
//TODO 1.7
/*
@Override
public Packet getDescriptionPacket()
{
@@ -299,7 +298,7 @@ public class TileEntityRift extends DDTileEntityBase
{
readFromNBT(pkt.data);
}
*/
@Override
public float[] getRenderColor(Random rand)
{

View File

@@ -1,6 +1,7 @@
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 +10,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

@@ -10,6 +10,8 @@ import StevenDimDoors.mod_pocketDim.config.DDProperties;
public class CustomCaveGen extends MapGenBase
{
//TODO 1.7
/*
private static DDProperties properties = null;
public CustomCaveGen()
@@ -18,17 +20,13 @@ public class CustomCaveGen extends MapGenBase
properties = DDProperties.instance();
}
/**
* Generates a larger initial cave node than usual. Called 25% of the time.
*/
// Generates a larger initial cave node than usual. Called 25% of the time.
protected void generateLargeCaveNode(long par1, int par3, int par4, byte[] par5ArrayOfByte, double par6, double par8, double par10)
{
this.generateCaveNode(par1, par3, par4, par5ArrayOfByte, par6, par8, par10, 1.0F + this.rand.nextFloat() * 6.0F, 0.0F, 0.0F, -1, -1, 0.5D);
}
/**
* Generates a node in the current cave system recursion tree.
*/
//Generates a node in the current cave system recursion tree.
protected void generateCaveNode(long par1, int par3, int par4, byte[] par5ArrayOfByte, double par6, double par8, double par10, float par12, float par13, float par14, int par15, int par16, double par17)
{
double var19 = par3 * 16 + 8;
@@ -226,9 +224,7 @@ public class CustomCaveGen extends MapGenBase
}
}
/**
* Recursively called by generate() (generate) and optionally by itself.
*/
//Recursively called by generate() (generate) and optionally by itself.
@Override
protected void recursiveGenerate(World par1World, int par2, int par3, int par4, int par5, byte[] par6ArrayOfByte)
{
@@ -267,4 +263,5 @@ public class CustomCaveGen extends MapGenBase
}
}
}
*/
}

View File

@@ -23,12 +23,13 @@ public class DDBiomeGenBase extends BiomeGenBase
{
for (int k = 0; k < biomes.length; k++)
{
if (biomeList[biomes[k]] != null && !(biomeList[biomes[k]] instanceof DDBiomeGenBase))
//TODO 1.7
/* if (biomeList[biomes[k]] != null && !(biomeList[biomes[k]] instanceof DDBiomeGenBase))
{
// Crash Minecraft to avoid having people complain to us about strange things
// that are really the result of silent biome ID conflicts.
throw new IllegalStateException("There is a biome ID conflict between a biome from Dimensional Doors and another biome type. Fix your configuration!");
}
}
*/ }
}
}

View File

@@ -2,8 +2,10 @@ 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;
@@ -21,31 +23,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.goldenDimensionalDoor,
mod_pocketDim.goldenDoor
};
this.properties = properties;
@@ -90,6 +92,8 @@ 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.
//TODO 1.7
/*
for (Object coordObject : limbo.activeChunkSet)
{
ChunkCoordIntPair chunkCoord = (ChunkCoordIntPair) coordObject;
@@ -104,6 +108,7 @@ public class LimboDecay {
decayBlockFast(limbo, x, y, z);
}
}
*/
}
}
@@ -112,10 +117,10 @@ public class LimboDecay {
*/
private boolean decayBlockFast(World world, int x, int y, int z)
{
int blockID = world.getBlockId(x, y, z);
Block blockID = world.getBlock(x, y, z);
if (canDecayBlock(blockID))
{
world.setBlock(x, y, z, properties.LimboBlockID);
world.setBlock(x, y, z, mod_pocketDim.blockLimbo);
return true;
}
return false;
@@ -127,14 +132,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))
{
//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].equals(block))
{
break;
}
@@ -155,22 +160,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)
{
if (blockID == 0)
if (block.equals(Blocks.air))
{
return false;
}
for (int k = 0; k < blocksImmuneToDecay.length; k++)
{
if (blockID == blocksImmuneToDecay[k])
if (block.equals(blocksImmuneToDecay[k]))
{
return false;
}
}
Block block = Block.blocksList[blockID];
return (block == null || !(block instanceof BlockContainer));
}
}

View File

@@ -3,6 +3,7 @@ package StevenDimDoors.mod_pocketDim.world;
import java.util.List;
import java.util.Random;
import cpw.mods.fml.common.eventhandler.Event;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.util.IProgressUpdate;
import net.minecraft.util.MathHelper;
@@ -13,15 +14,15 @@ 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;
public class LimboGenerator extends ChunkProviderGenerate
{
{//TODO rewrite 1.7
private static Random rand;
/** A NoiseGeneratorOctaves used in generating terrain */
@@ -117,13 +118,7 @@ public class LimboGenerator extends ChunkProviderGenerate
{
return super.chunkExists(var1, var2);
}
@Override
public void replaceBlocksForBiome(int par1, int par2, byte[] par3ArrayOfByte, BiomeGenBase[] par4ArrayOfBiomeGenBase)
{
}
/*
@Override
public Chunk provideChunk(int chunkX, int chunkZ)
{
@@ -141,7 +136,7 @@ public class LimboGenerator extends ChunkProviderGenerate
}
return var4;
}
*/
@Override
public Chunk loadChunk(int var1, int var2) {
// TODO Auto-generated method stub
@@ -153,6 +148,7 @@ public class LimboGenerator extends ChunkProviderGenerate
{
}
/*
@Override
public boolean saveChunks(boolean var1, IProgressUpdate var2) {
@@ -163,7 +159,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)
{
@@ -379,7 +375,7 @@ public class LimboGenerator extends ChunkProviderGenerate
}
}
}
*/
@Override
public boolean canSave() {
@@ -401,23 +397,5 @@ public class LimboGenerator extends ChunkProviderGenerate
return biomegenbase == null ? null : (biomegenbase == BiomeGenBase.swampland && par1EnumCreatureType == EnumCreatureType.monster && this.scatteredFeatureGenerator.hasStructureAt(par2, par3, par4) ? this.scatteredFeatureGenerator.getScatteredFeatureSpawnList() : biomegenbase.getSpawnableList(par1EnumCreatureType));
}
@Override
public ChunkPosition findClosestStructure(World var1, String var2,
int var3, int var4, int var5) {
// TODO Auto-generated method stub
return null;
}
@Override
public int getLoadedChunkCount() {
// TODO Auto-generated method stub
return super.getLoadedChunkCount();
}
@Override
public void recreateStructures(int var1, int var2) {
// TODO Auto-generated method stub
}
}

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
@@ -72,12 +73,6 @@ public class LimboProvider extends WorldProvider
}
@Override
public boolean canSnowAt(int x, int y, int z)
{
return false;
}
@Override
protected void generateLightBrightnessTable()
{
@@ -136,8 +131,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.equals(mod_pocketDim.blockLimbo);
}
@Override
public double getHorizon()
@@ -148,14 +143,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

@@ -31,7 +31,7 @@ public class PersonalPocketProvider extends PocketProvider
public Vec3 getSkyColor(Entity cameraEntity, float partialTicks)
{
setCloudRenderer( new CloudRenderBlank());
return this.worldObj.getWorldVec3Pool().getVecFromPool(1,1,1);
return Vec3.createVectorHelper(1,1,1);
}
public boolean isSurfaceWorld()
@@ -61,7 +61,7 @@ public class PersonalPocketProvider extends PocketProvider
@Override
public Vec3 getFogColor(float par1, float par2)
{
return this.worldObj.getWorldVec3Pool().getVecFromPool(1,1,1);
return Vec3.createVectorHelper(1,1,1);
}
@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!");
@@ -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, ((EntityPlayer) player).getDisplayName());
//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 blockID, int metadata, boolean placeTnt, int nonTntWeight)
{
int x, y, z;
@@ -516,11 +517,11 @@ public class PocketBuilder
}
}
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 blockID, 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
{
@@ -528,9 +529,9 @@ public class PocketBuilder
}
}
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 blockID, int metadata)
{
if (blockID != 0 && Block.blocksList[blockID] == null)
if (blockID.equals(Blocks.air))
{
return;
}
@@ -551,7 +552,6 @@ public class PocketBuilder
extBlockStorage = new ExtendedBlockStorage(cY << 4, !world.provider.hasNoSky);
chunk.getBlockStorageArray()[cY] = extBlockStorage;
}
extBlockStorage.setExtBlockID(localX, y & 15, localZ, blockID);
extBlockStorage.setExtBlockMetadata(localX, y & 15, localZ, metadata);
chunk.setChunkModified();
}

View File

@@ -14,6 +14,11 @@ import StevenDimDoors.mod_pocketDim.ticking.CustomLimboPopulator;
public class PocketGenerator extends ChunkProviderGenerate
{
public PocketGenerator(World p_i2006_1_, long p_i2006_2_, boolean p_i2006_4_) {
super(p_i2006_1_, p_i2006_2_, p_i2006_4_);
}
//TODO 1.7
private World worldObj;
private CustomLimboPopulator spawner;
@@ -24,7 +29,7 @@ public class PocketGenerator extends ChunkProviderGenerate
this.worldObj = par1World;
this.spawner = spawner;
}
}/*
@Override
public void generateTerrain(int par1, int par2, byte[] par3ArrayOfByte)
@@ -80,5 +85,5 @@ public class PocketGenerator extends ChunkProviderGenerate
public ChunkPosition findClosestStructure(World var1, String var2, int var3, int var4, int var5)
{
return null;
}
}*/
}

View File

@@ -34,7 +34,7 @@ public class PocketProvider extends WorldProvider
@Override
protected void registerWorldChunkManager()
{
super.worldChunkMgr = new WorldChunkManagerHell(mod_pocketDim.pocketBiome, 1, 1);
super.worldChunkMgr = new WorldChunkManagerHell(mod_pocketDim.pocketBiome, 1);
}
@Override
@@ -47,14 +47,14 @@ public class PocketProvider extends WorldProvider
public Vec3 getSkyColor(Entity cameraEntity, float partialTicks)
{
setCloudRenderer( new CloudRenderBlank());
return this.worldObj.getWorldVec3Pool().getVecFromPool(0d, 0d, 0d);
return Vec3.createVectorHelper(0d, 0d, 0d);
}
@SideOnly(Side.CLIENT)
@Override
public Vec3 getFogColor(float par1, float par2)
{
return this.worldObj.getWorldVec3Pool().getVecFromPool(0d, 0d, 0d);
return Vec3.createVectorHelper(0d, 0d, 0d);
}
@Override
@@ -69,12 +69,6 @@ public class PocketProvider extends WorldProvider
return new PocketGenerator(worldObj, dimensionId, false, spawner);
}
@Override
public boolean canSnowAt(int x, int y, int z)
{
return false;
}
@Override
public boolean canBlockFreeze(int x, int y, int z, boolean byWater)
{

View File

@@ -1,18 +1,19 @@
package StevenDimDoors.mod_pocketDim.world.fortresses;
import java.util.List;
import java.util.Random;
import net.minecraft.block.Block;
import StevenDimDoors.mod_pocketDim.core.DimLink;
import StevenDimDoors.mod_pocketDim.core.LinkType;
import StevenDimDoors.mod_pocketDim.core.NewDimData;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemDoor;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraft.world.gen.structure.StructureBoundingBox;
import net.minecraft.world.gen.structure.StructureComponent;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.core.DimLink;
import StevenDimDoors.mod_pocketDim.core.LinkType;
import StevenDimDoors.mod_pocketDim.core.NewDimData;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import java.util.List;
import java.util.Random;
public class ComponentNetherGateway extends StructureComponent
{
@@ -71,75 +72,75 @@ public class ComponentNetherGateway extends StructureComponent
int NETHER_SLAB_METADATA = 6;
// Set all the blocks in the area of the room to air
this.fillWithBlocks(world, bounds, 0, 2, 0, 6, 6, 6, 0, 0, false);
this.fillWithBlocks(world, bounds, 0, 2, 0, 6, 6, 6, Blocks.air, Blocks.air, false);
// Set up the platform under the gateway
this.fillWithBlocks(world, bounds, 0, 0, 0, 6, 1, 6, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
this.fillWithBlocks(world, bounds, 0, 0, 0, 6, 1, 6, Blocks.nether_brick, Blocks.nether_brick, false);
// Build the fence at the back of the room
this.fillWithBlocks(world, bounds, 1, 2, 6, 5, 2, 6, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
this.fillWithBlocks(world, bounds, 1, 3, 6, 5, 3, 6, Block.netherFence.blockID, Block.netherFence.blockID, false);
this.fillWithBlocks(world, bounds, 1, 2, 6, 5, 2, 6, Blocks.nether_brick, Blocks.nether_brick, false);
this.fillWithBlocks(world, bounds, 1, 3, 6, 5, 3, 6, Blocks.nether_brick_fence, Blocks.nether_brick_fence, false);
// Build the fences at the sides of the room
this.fillWithBlocks(world, bounds, 0, 2, 0, 0, 2, 6, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
this.fillWithBlocks(world, bounds, 0, 3, 0, 0, 3, 6, Block.netherFence.blockID, Block.netherFence.blockID, false);
this.fillWithBlocks(world, bounds, 0, 2, 0, 0, 2, 6, Blocks.nether_brick, Blocks.nether_brick, false);
this.fillWithBlocks(world, bounds, 0, 3, 0, 0, 3, 6, Blocks.nether_brick_fence, Blocks.nether_brick_fence, false);
this.fillWithBlocks(world, bounds, 6, 2, 0, 6, 2, 6, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
this.fillWithBlocks(world, bounds, 6, 3, 0, 6, 3, 6, Block.netherFence.blockID, Block.netherFence.blockID, false);
this.fillWithBlocks(world, bounds, 6, 2, 0, 6, 2, 6, Blocks.nether_brick, Blocks.nether_brick, false);
this.fillWithBlocks(world, bounds, 6, 3, 0, 6, 3, 6, Blocks.nether_brick_fence, Blocks.nether_brick_fence, false);
// Build the fence portions closest to the entrance
this.placeBlockAtCurrentPosition(world, Block.netherBrick.blockID, 0, 1, 2, 0, bounds);
this.placeBlockAtCurrentPosition(world, Block.netherFence.blockID, 0, 1, 3, 0, bounds);
this.placeBlockAtCurrentPosition(world, Blocks.nether_brick, 0, 1, 2, 0, bounds);
this.placeBlockAtCurrentPosition(world, Blocks.nether_brick_fence, 0, 1, 3, 0, bounds);
this.placeBlockAtCurrentPosition(world, Block.netherBrick.blockID, 0, 5, 2, 0, bounds);
this.placeBlockAtCurrentPosition(world, Block.netherFence.blockID, 0, 5, 3, 0, bounds);
this.placeBlockAtCurrentPosition(world, Blocks.nether_brick, 0, 5, 2, 0, bounds);
this.placeBlockAtCurrentPosition(world, Blocks.nether_brick_fence, 0, 5, 3, 0, bounds);
// Build the first layer of the gateway
this.fillWithBlocks(world, bounds, 1, 2, 2, 5, 2, 5, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
this.fillWithMetadataBlocks(world, bounds, 1, 2, 1, 5, 2, 1, Block.stoneSingleSlab.blockID, NETHER_SLAB_METADATA, Block.stoneSingleSlab.blockID, NETHER_SLAB_METADATA, false);
this.fillWithBlocks(world, bounds, 1, 2, 2, 5, 2, 5, Blocks.nether_brick, Blocks.nether_brick, false);
this.fillWithMetadataBlocks(world, bounds, 1, 2, 1, 5, 2, 1, Blocks.stone_slab, NETHER_SLAB_METADATA, Blocks.stone_slab, NETHER_SLAB_METADATA, false);
this.placeBlockAtCurrentPosition(world, Block.stoneSingleSlab.blockID, NETHER_SLAB_METADATA, 1, 2, 2, bounds);
this.placeBlockAtCurrentPosition(world, Block.stoneSingleSlab.blockID, NETHER_SLAB_METADATA, 5, 2, 2, bounds);
this.placeBlockAtCurrentPosition(world, Blocks.stone_slab, NETHER_SLAB_METADATA, 1, 2, 2, bounds);
this.placeBlockAtCurrentPosition(world, Blocks.stone_slab, NETHER_SLAB_METADATA, 5, 2, 2, bounds);
// Build the second layer of the gateway
int orientation = this.getMetadataWithOffset(Block.stairsNetherBrick.blockID, 2);
this.fillWithBlocks(world, bounds, 2, 3, 3, 2, 3, 4, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
this.fillWithBlocks(world, bounds, 4, 3, 3, 4, 3, 4, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
this.placeBlockAtCurrentPosition(world, Block.netherBrick.blockID, 0, 3, 3, 4, bounds);
this.placeBlockAtCurrentPosition(world, Block.stairsNetherBrick.blockID, orientation, 3, 3, 5, bounds);
int orientation = this.getMetadataWithOffset(Blocks.nether_brick_stairs, 2);
this.fillWithBlocks(world, bounds, 2, 3, 3, 2, 3, 4, Blocks.nether_brick, Blocks.nether_brick, false);
this.fillWithBlocks(world, bounds, 4, 3, 3, 4, 3, 4, Blocks.nether_brick, Blocks.nether_brick, false);
this.placeBlockAtCurrentPosition(world, Blocks.nether_brick, 0, 3, 3, 4, bounds);
this.placeBlockAtCurrentPosition(world, Blocks.nether_brick_stairs, orientation, 3, 3, 5, bounds);
// Build the third layer of the gateway
// We add 4 to get the rotated metadata for upside-down stairs
// because Minecraft only supports metadata rotations for normal stairs -_-
this.fillWithMetadataBlocks(world, bounds, 2, 4, 4, 4, 4, 4, Block.stairsNetherBrick.blockID, orientation, Block.stairsNetherBrick.blockID, orientation, false);
this.fillWithMetadataBlocks(world, bounds, 2, 4, 4, 4, 4, 4, Blocks.nether_brick_stairs, orientation, Blocks.nether_brick_stairs, orientation, false);
this.placeBlockAtCurrentPosition(world, Block.stairsNetherBrick.blockID, this.getMetadataWithOffset(Block.stairsNetherBrick.blockID, 0) + 4, 2, 4, 3, bounds);
this.placeBlockAtCurrentPosition(world, Block.stairsNetherBrick.blockID, this.getMetadataWithOffset(Block.stairsNetherBrick.blockID, 1) + 4, 4, 4, 3, bounds);
this.placeBlockAtCurrentPosition(world, Blocks.nether_brick_stairs, this.getMetadataWithOffset(Blocks.nether_brick_stairs, 0) + 4, 2, 4, 3, bounds);
this.placeBlockAtCurrentPosition(world, Blocks.nether_brick_stairs, this.getMetadataWithOffset(Blocks.nether_brick_stairs, 1) + 4, 4, 4, 3, bounds);
// Build the fourth layer of the gateway
this.placeBlockAtCurrentPosition(world, Block.netherBrick.blockID, 0, 3, 5, 3, bounds);
this.placeBlockAtCurrentPosition(world, Blocks.nether_brick, 0, 3, 5, 3, bounds);
this.placeBlockAtCurrentPosition(world, Block.netherrack.blockID, 0, 2, 5, 3, bounds);
this.placeBlockAtCurrentPosition(world, Block.stairsNetherBrick.blockID, this.getMetadataWithOffset(Block.stairsNetherBrick.blockID, 0) + 4, 1, 5, 3, bounds);
this.placeBlockAtCurrentPosition(world, Block.stairsNetherBrick.blockID, this.getMetadataWithOffset(Block.stairsNetherBrick.blockID, 3) + 4, 2, 5, 2, bounds);
this.placeBlockAtCurrentPosition(world, Block.stairsNetherBrick.blockID, this.getMetadataWithOffset(Block.stairsNetherBrick.blockID, 2) + 4, 2, 5, 4, bounds);
this.placeBlockAtCurrentPosition(world, Blocks.netherrack, 0, 2, 5, 3, bounds);
this.placeBlockAtCurrentPosition(world, Blocks.nether_brick_stairs, this.getMetadataWithOffset(Blocks.nether_brick_stairs, 0) + 4, 1, 5, 3, bounds);
this.placeBlockAtCurrentPosition(world, Blocks.nether_brick_stairs, this.getMetadataWithOffset(Blocks.nether_brick_stairs, 3) + 4, 2, 5, 2, bounds);
this.placeBlockAtCurrentPosition(world, Blocks.nether_brick_stairs, this.getMetadataWithOffset(Blocks.nether_brick_stairs, 2) + 4, 2, 5, 4, bounds);
this.placeBlockAtCurrentPosition(world, Block.netherrack.blockID, 0, 4, 5, 3, bounds);
this.placeBlockAtCurrentPosition(world, Block.stairsNetherBrick.blockID, this.getMetadataWithOffset(Block.stairsNetherBrick.blockID, 1) + 4, 5, 5, 3, bounds);
this.placeBlockAtCurrentPosition(world, Block.stairsNetherBrick.blockID, this.getMetadataWithOffset(Block.stairsNetherBrick.blockID, 3) + 4, 4, 5, 2, bounds);
this.placeBlockAtCurrentPosition(world, Block.stairsNetherBrick.blockID, this.getMetadataWithOffset(Block.stairsNetherBrick.blockID, 2) + 4, 4, 5, 4, bounds);
this.placeBlockAtCurrentPosition(world, Blocks.netherrack, 0, 4, 5, 3, bounds);
this.placeBlockAtCurrentPosition(world, Blocks.nether_brick_stairs, this.getMetadataWithOffset(Blocks.nether_brick_stairs, 1) + 4, 5, 5, 3, bounds);
this.placeBlockAtCurrentPosition(world, Blocks.nether_brick_stairs, this.getMetadataWithOffset(Blocks.nether_brick_stairs, 3) + 4, 4, 5, 2, bounds);
this.placeBlockAtCurrentPosition(world, Blocks.nether_brick_stairs, this.getMetadataWithOffset(Blocks.nether_brick_stairs, 2) + 4, 4, 5, 4, bounds);
// Build the top layer of the gateway
this.placeBlockAtCurrentPosition(world, Block.netherFence.blockID, 0, 3, 6, 3, bounds);
this.placeBlockAtCurrentPosition(world, Blocks.nether_brick_fence, 0, 3, 6, 3, bounds);
this.placeBlockAtCurrentPosition(world, Block.fire.blockID, 0, 2, 6, 3, bounds);
this.placeBlockAtCurrentPosition(world, Block.netherFence.blockID, 0, 1, 6, 3, bounds);
this.placeBlockAtCurrentPosition(world, Block.netherFence.blockID, 0, 2, 6, 2, bounds);
this.placeBlockAtCurrentPosition(world, Block.netherFence.blockID, 0, 2, 6, 4, bounds);
this.placeBlockAtCurrentPosition(world, Blocks.fire, 0, 2, 6, 3, bounds);
this.placeBlockAtCurrentPosition(world, Blocks.nether_brick_fence, 0, 1, 6, 3, bounds);
this.placeBlockAtCurrentPosition(world, Blocks.nether_brick_fence, 0, 2, 6, 2, bounds);
this.placeBlockAtCurrentPosition(world, Blocks.nether_brick_fence, 0, 2, 6, 4, bounds);
this.placeBlockAtCurrentPosition(world, Block.fire.blockID, 0, 4, 6, 3, bounds);
this.placeBlockAtCurrentPosition(world, Block.netherFence.blockID, 0, 5, 6, 3, bounds);
this.placeBlockAtCurrentPosition(world, Block.netherFence.blockID, 0, 4, 6, 2, bounds);
this.placeBlockAtCurrentPosition(world, Block.netherFence.blockID, 0, 4, 6, 4, bounds);
this.placeBlockAtCurrentPosition(world, Blocks.fire, 0, 4, 6, 3, bounds);
this.placeBlockAtCurrentPosition(world, Blocks.nether_brick_fence, 0, 5, 6, 3, bounds);
this.placeBlockAtCurrentPosition(world, Blocks.nether_brick_fence, 0, 4, 6, 2, bounds);
this.placeBlockAtCurrentPosition(world, Blocks.nether_brick_fence, 0, 4, 6, 4, bounds);
// Place the transient door
int y = this.getYWithOffset(3);
@@ -152,7 +153,7 @@ public class ComponentNetherGateway extends StructureComponent
// due to the way Minecraft handles structure generation!
if (bounds.isVecInside(x, y, z) && bounds.isVecInside(x, y + 1, z))
{
orientation = this.getMetadataWithOffset(Block.doorWood.blockID, 1);
orientation = this.getMetadataWithOffset(Blocks.wooden_door, 1);
dimension = PocketManager.createDimensionData(world);
link = dimension.getLink(x, y + 1, z);
if (link == null)
@@ -166,7 +167,8 @@ public class ComponentNetherGateway extends StructureComponent
{
for (z = 0; z <= 6; ++z)
{
this.fillCurrentPositionBlocksDownwards(world, Block.netherBrick.blockID, 0, x, -1, z, bounds);
//fillCurrentPositionBlocksDownwards
this.func_151554_b(world, Blocks.nether_brick, 0, x, -1, z, bounds);
}
}

View File

@@ -1,4 +1,5 @@
package StevenDimDoors.mod_pocketDim.world.fortresses;
//TODO 1.7
/*package StevenDimDoors.mod_pocketDim.world.fortresses;
import StevenDimDoors.mod_pocketDim.config.DDProperties;
import net.minecraft.world.gen.structure.MapGenNetherBridge;
@@ -15,7 +16,8 @@ public class DDNetherFortressGenerator extends MapGenNetherBridge
// If we don't do this, Minecraft will crash when a fortress tries to generate.
// Moreover, use Fortress as our structure identifier so that if DD is removed,
// fortresses will generate properly using Vanilla code.
MapGenStructureIO.func_143034_b(DDStructureNetherBridgeStart.class, "Fortress");
// MapGenStructureIO.registerStructure(DDStructureNetherBridgeStart.class, "Fortress");
}
@Override
@@ -24,3 +26,4 @@ public class DDNetherFortressGenerator extends MapGenNetherBridge
return new DDStructureNetherBridgeStart(this.worldObj, this.rand, chunkX, chunkZ, DDProperties.instance());
}
}
*/

View File

@@ -1,145 +0,0 @@
package StevenDimDoors.mod_pocketDim.world.fortresses;
import java.util.ArrayList;
import java.util.Iterator;
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;
public class DDStructureNetherBridgeStart extends StructureNetherBridgeStart
{
public static final int MAX_GATEWAY_GENERATION_CHANCE = 100;
private boolean hasGateway;
private int minX;
private int minY;
private int minZ;
public DDStructureNetherBridgeStart() { }
public DDStructureNetherBridgeStart(World world, Random random, int chunkX, int chunkZ, DDProperties properties)
{
// StructureNetherBridgeStart handles designing the fortress for us
super(world, random, chunkX, chunkZ);
Iterator componentIterator;
StructureComponent component;
StructureBoundingBox bounds;
ArrayList<ComponentNetherBridgeThrone> 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>();
componentIterator = this.components.iterator();
while (componentIterator.hasNext())
{
component = (StructureComponent) componentIterator.next();
if (component instanceof ComponentNetherBridgeThrone)
{
spawnerRooms.add((ComponentNetherBridgeThrone) component);
}
}
// If any spawner rooms were found, choose one to randomly replace
if (!spawnerRooms.isEmpty())
{
hasGateway = true;
component = spawnerRooms.get(random.nextInt(spawnerRooms.size()));
// Store enough data to identify the room when it's going to be built later
bounds = component.getBoundingBox();
minX = bounds.minX;
minY = bounds.minY;
minZ = bounds.minZ;
}
}
}
@Override
public NBTTagCompound func_143021_a(int chunkX, int chunkZ)
{
// We override the function for writing NBT data to add our own gateway data
NBTTagCompound fortressTag = super.func_143021_a(chunkX, chunkZ);
// Add a compound tag with our data
NBTTagCompound dimensionalTag = new NBTTagCompound();
dimensionalTag.setBoolean("HasGateway", this.hasGateway);
if (hasGateway)
{
dimensionalTag.setInteger("GatewayMinX", this.minX);
dimensionalTag.setInteger("GatewayMinY", this.minY);
dimensionalTag.setInteger("GatewayMinZ", this.minZ);
}
fortressTag.setCompoundTag("DimensionalDoors", dimensionalTag);
return fortressTag;
}
@Override
public void func_143020_a(World world, NBTTagCompound fortressTag)
{
// We override the function for reading NBT data to load gateway data
super.func_143020_a(world, fortressTag);
NBTTagCompound dimensionalTag = fortressTag.getCompoundTag("DimensionalDoors");
if (dimensionalTag != null)
{
this.hasGateway = dimensionalTag.getBoolean("HasGateway");
if (hasGateway)
{
minX = dimensionalTag.getInteger("GatewayMinX");
minY = dimensionalTag.getInteger("GatewayMinY");
minZ = dimensionalTag.getInteger("GatewayMinZ");
}
}
}
/**
* Keeps iterating Structure Pieces and spawning them until the checks tell it to stop
*/
@Override
public void generateStructure(World world, Random random, StructureBoundingBox generationBounds)
{
if (hasGateway)
{
// Use a modified version of Vanilla's fortress generation code
// Try to detect the room that we intend to replace with our gateway
Iterator iterator = this.components.iterator();
while (iterator.hasNext())
{
StructureComponent component = (StructureComponent)iterator.next();
StructureBoundingBox bounds = component.getBoundingBox();
if (bounds.intersectsWith(generationBounds))
{
// Check if this is our replacement target
// Checking the location is enough because structures aren't allowed to have
// intersecting bounding boxes - nothing else can have these min coordinates.
if (bounds.minX == this.minX && bounds.minY == this.minY && bounds.minZ == this.minZ)
{
component = ComponentNetherGateway.createFromComponent(component, random);
}
// Now for the last bit of Vanilla's generation code
if (!component.addComponentParts(world, random, generationBounds))
{
iterator.remove();
}
}
}
}
else
{
// Just run the usual structure generation
super.generateStructure(world, random, generationBounds);
}
}
}

View File

@@ -3,8 +3,10 @@ package StevenDimDoors.mod_pocketDim.world.gateways;
import java.util.ArrayList;
import StevenDimDoors.mod_pocketDim.Point3D;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.schematic.Schematic;
import StevenDimDoors.mod_pocketDim.schematic.SchematicFilter;
import net.minecraft.block.Block;
public class GatewayBlockFilter extends SchematicFilter {
@@ -33,41 +35,41 @@ public class GatewayBlockFilter extends SchematicFilter {
}
@Override
protected boolean initialize(Schematic schematic, short[] blocks, byte[] metadata)
protected boolean initialize(Schematic schematic, Block[] blocks, byte[] metadata)
{
this.schematic = schematic;
return true;
}
@Override
protected boolean applyToBlock(int index, short[] blocks, byte[] metadata)
protected boolean applyToBlock(int index, Block[] blocks, byte[] metadata)
{
int indexBelow;
int indexDoubleBelow;
if (blocks[index] == STANDARD_DIMENSIONAL_DOOR_ID)
if (blocks[index].equals(mod_pocketDim.dimensionalDoor))
{
indexBelow = schematic.calculateIndexBelow(index);
if (indexBelow >= 0 && blocks[indexBelow] == STANDARD_DIMENSIONAL_DOOR_ID)
if (indexBelow >= 0 && blocks[indexBelow].equals(mod_pocketDim.dimensionalDoor))
{
entranceDoorLocation = schematic.calculatePoint(index);
entranceOrientation = (metadata[indexBelow] & 3);
return true;
}
}
if (blocks[index] == STANDARD_TRANSIENT_DOOR_ID)
if (blocks[index].equals(mod_pocketDim.transientDoor))
{
indexBelow = schematic.calculateIndexBelow(index);
if (indexBelow >= 0 && blocks[indexBelow] == STANDARD_TRANSIENT_DOOR_ID)
if (indexBelow >= 0 && blocks[indexBelow].equals(mod_pocketDim.transientDoor))
{
entranceDoorLocation = schematic.calculatePoint(index);
entranceOrientation = (metadata[indexBelow] & 3);
return true;
}
}
if (blocks[index] == STANDARD_WARP_DOOR_ID)
if (blocks[index].equals(mod_pocketDim.warpDoor))
{
indexBelow = schematic.calculateIndexBelow(index);
if (indexBelow >= 0 && blocks[indexBelow] == STANDARD_WARP_DOOR_ID)
if (indexBelow >= 0 && blocks[indexBelow].equals(mod_pocketDim.warpDoor))
{
entranceDoorLocation = schematic.calculatePoint(index);
entranceOrientation = (metadata[indexBelow] & 3);

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).equals(Blocks.bedrock) && //<-- Stops Nether roof spawning. DO NOT REMOVE!
!world.getBlock(x, y - 1, z).equals(Blocks.bedrock) &&
!world.getBlock(x, y - 2, z).equals(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).equals(Blocks.bedrock) && //<-- Stops Nether roof spawning. DO NOT REMOVE!
!world.getBlock(x, y - 1, z).equals(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.plants
&& world.getBlock(x, y, z).isOpaqueCube() && !world.getBlock(x, y, z).equals(Blocks.bedrock));
}
}

View File

@@ -1,5 +1,6 @@
package StevenDimDoors.mod_pocketDim.world.gateways;
import net.minecraft.block.Block;
import net.minecraft.item.ItemDoor;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
@@ -18,7 +19,7 @@ public class GatewayLimbo extends BaseGateway
@Override
public boolean generate(World world, int x, int y, int z)
{
int blockID = mod_pocketDim.blockLimbo.blockID;
Block blockID = mod_pocketDim.blockLimbo;
// Build the gateway out of Unraveled Fabric. Since nearly all the blocks in Limbo are of
// that type, there is no point replacing the ground.
world.setBlock(x, y + 3, z + 1, blockID, 0, 3);

View File

@@ -1,6 +1,7 @@
package StevenDimDoors.mod_pocketDim.world.gateways;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.config.DDProperties;
@@ -16,7 +17,7 @@ public class GatewayTwoPillars extends BaseSchematicGateway
@Override
protected void generateRandomBits(World world, int x, int y, int z)
{
final int blockID = Block.stoneBrick.blockID;
final Block block = Blocks.stonebrick;
//Replace some of the ground around the gateway with bricks
for (int xc = -GATEWAY_RADIUS; xc <= GATEWAY_RADIUS; xc++)
@@ -26,19 +27,19 @@ public class GatewayTwoPillars extends BaseSchematicGateway
//Check that the block is supported by an opaque block.
//This prevents us from building over a cliff, on the peak of a mountain,
//or the surface of the ocean or a frozen lake.
if (world.isBlockOpaqueCube(x + xc, y - 1, z + zc))
if (world.getBlock(x + xc, y - 1, z + zc).isOpaqueCube())
{
//Randomly choose whether to place bricks or not. The math is designed so that the
//chances of placing a block decrease as we get farther from the gateway's center.
if (Math.abs(xc) + Math.abs(zc) < world.rand.nextInt(2) + 3)
{
//Place Stone Bricks
world.setBlock(x + xc, y, z + zc, blockID, 0, 3);
world.setBlock(x + xc, y, z + zc, block, 0, 3);
}
else if (Math.abs(xc) + Math.abs(zc) < world.rand.nextInt(3) + 3)
{
//Place Cracked Stone Bricks
world.setBlock(x + xc, y, z + zc, blockID, 2, 3);
world.setBlock(x + xc, y, z + zc, block, 2, 3);
}
}
}

View File

@@ -1,34 +1,23 @@
package StevenDimDoors.mod_pocketDimClient;
import StevenDimDoors.mod_pocketDim.PacketConstants;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import StevenDimDoors.mod_pocketDim.util.Point4D;
import StevenDimDoors.mod_pocketDim.watcher.ClientDimData;
import StevenDimDoors.mod_pocketDim.watcher.ClientLinkData;
import StevenDimDoors.mod_pocketDim.watcher.IUpdateSource;
import StevenDimDoors.mod_pocketDim.watcher.IUpdateWatcher;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.network.IPacketHandler;
import cpw.mods.fml.common.network.Player;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet250CustomPayload;
import net.minecraft.server.integrated.IntegratedServer;
public class ClientPacketHandler implements IPacketHandler, IUpdateSource
public class ClientPacketHandler
{
//TODO 1.7
private IUpdateWatcher<ClientLinkData> linkWatcher;
private IUpdateWatcher<ClientDimData> dimWatcher;
/*
public ClientPacketHandler()
{
PocketManager.getWatchers(this);
}
@Override
public void registerWatchers(IUpdateWatcher<ClientDimData> dimWatcher, IUpdateWatcher<ClientLinkData> linkWatcher)
{
@@ -79,4 +68,5 @@ public class ClientPacketHandler implements IPacketHandler, IUpdateSource
e.printStackTrace();
}
}
*/
}

View File

@@ -35,14 +35,14 @@ public class ClientProxy extends CommonProxy
@Override
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)
{
DimLink link = PocketManager.getLink(x, y, z, world);
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,11 +1,10 @@
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 +78,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 +143,7 @@ public class PrivatePocketRender implements ISimpleBlockRenderingHandler
@Override
public boolean shouldRender3DInInventory()
public boolean shouldRender3DInInventory(int modelid)
{
// TODO Auto-generated method stub
return true;

View File

@@ -1,50 +1,24 @@
package StevenDimDoors.mod_pocketDimClient;
import static org.lwjgl.opengl.GL11.GL_LIGHTING;
import static org.lwjgl.opengl.GL11.GL_ONE_MINUS_DST_COLOR;
import static org.lwjgl.opengl.GL11.GL_TEXTURE_2D;
import static org.lwjgl.opengl.GL11.GL_ZERO;
import static org.lwjgl.opengl.GL11.glBlendFunc;
import java.nio.FloatBuffer;
import java.util.Iterator;
import java.util.Random;
import org.lwjgl.opengl.GL11;
import net.minecraft.block.material.MapColor;
import StevenDimDoors.mod_pocketDim.config.DDProperties;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoor;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ActiveRenderInfo;
import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureCompass;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.item.EntityItemFrame;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.storage.MapCoord;
import net.minecraft.world.storage.MapData;
import org.lwjgl.opengl.GL11;
import java.nio.FloatBuffer;
import java.util.Random;
import static org.lwjgl.opengl.GL11.*;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.config.DDProperties;
import StevenDimDoors.mod_pocketDim.core.DimLink;
import StevenDimDoors.mod_pocketDim.core.NewDimData;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoor;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderDimDoor extends TileEntitySpecialRenderer
{
@@ -352,7 +326,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

@@ -29,7 +29,7 @@ public class RenderMobObelisk extends RenderLiving
}
@Override
public void doRenderLiving(EntityLiving entity, double x, double y, double z, float par8, float par9)
public void doRender(EntityLiving entity, double x, double y, double z, float par8, float par9)
{
final float minScaling = 0;
final float maxScaling = 0.1f;
@@ -39,7 +39,7 @@ public class RenderMobObelisk extends RenderLiving
float aggroScaling = minScaling + (maxScaling - minScaling) * monolith.getAggroProgress();
// Calculate jitter - include entity ID to give Monoliths individual jitters
float time = ((Minecraft.getSystemTime() + 0xF1234568 * monolith.entityId) % 200000) / 50.0F;
float time = ((Minecraft.getSystemTime() + 0xF1234568 * monolith.getEntityId()) % 200000) / 50.0F;
// We use random constants here on purpose just to get different wave forms
double xJitter = aggroScaling * Math.sin(1.1f * time) * Math.sin(0.8f * time);
double yJitter = aggroScaling * Math.sin(1.2f * time) * Math.sin(0.9f * time);
@@ -52,7 +52,7 @@ public class RenderMobObelisk extends RenderLiving
public void render(EntityLiving par1EntityLivingBase, double x, double y, double z, float par8, float par9)
{
if (MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Pre(par1EntityLivingBase, this))) return;
if (MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Pre(par1EntityLivingBase, this, x, y, z))) return;
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_LIGHTING);
@@ -104,7 +104,7 @@ public class RenderMobObelisk extends RenderLiving
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glDepthMask(true);
GL11.glPopMatrix();
MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Post(par1EntityLivingBase, this));
MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Post(par1EntityLivingBase, this, x, y, z));
}
private static float interpolateRotation(float par1, float par2, float par3)

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)
{
@@ -111,8 +111,8 @@ public class RenderTransTrapdoor extends TileEntitySpecialRenderer
}
GL11.glColor4d(var21 * var17, var22 * var17, var23 * var17, 1.0F);
if (TransTrapdoor.isTrapdoorSetLow(metadata))
{
if (BlockTrapDoor.isTrapdoorOpen(metadata))
{//(par0 & 4) != 0;
if ((metadata & 4) != 0)
{
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 ((metadata & 4) != 0)
{
GL11.glVertex3d(x, y+0.95, z);
GL11.glVertex3d(x, y+0.95, z+1);