Fix crash on exiting personal pocket dimension #185
38
build.gradle
38
build.gradle
@@ -5,23 +5,24 @@ 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'
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'forge'
|
||||
|
||||
version = "2.2.4-" + System.getenv("BUILD_NUMBER")
|
||||
version = "2.2.5-" + System.getenv("BUILD_NUMBER")
|
||||
group = "com.stevenrs11.dimdoors" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
archivesBaseName = "DimensionalDoors"
|
||||
|
||||
minecraft {
|
||||
version = "1.6.4-9.11.1.964"
|
||||
|
||||
replaceIn "mod_pocketDim.java"
|
||||
replace "@VERSION@", project.version
|
||||
version = "1.7.10-10.13.2.1307-1.7.10"
|
||||
runDir = "eclipse"
|
||||
}
|
||||
|
||||
targetCompatibility = '1.6'
|
||||
@@ -29,21 +30,36 @@ sourceCompatibility = '1.6'
|
||||
|
||||
processResources
|
||||
{
|
||||
// Replace stuff $version and $mcversion in mcmod.info
|
||||
// this will ensure that this task is redone when the versions change.
|
||||
inputs.property "version", project.version
|
||||
inputs.property "mcversion", project.minecraft.version
|
||||
|
||||
// replace stuff in mcmod.info, nothing else
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
include 'mcmod.info'
|
||||
|
||||
// Replace version and mcversion
|
||||
// replace version and mcversion
|
||||
expand 'version':project.version, 'mcversion':project.minecraft.version
|
||||
}
|
||||
|
||||
// Copy everything else
|
||||
// copy everything else, thats not the mcmod.info
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
exclude 'mcmod.info'
|
||||
}
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
allprojects { project ->
|
||||
if (project.plugins.hasPlugin("idea"))
|
||||
{
|
||||
idea { module { inheritOutputDirs = true } }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
jar
|
||||
{
|
||||
destinationDir = new File("build/dist/")
|
||||
manifest {
|
||||
attributes 'FMLAT': 'DimDoors_at.cfg'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 block, int metadata)
|
||||
{
|
||||
int minX = minCorner.getX() + offset.getX();
|
||||
int minY = minCorner.getY() + offset.getY();
|
||||
@@ -183,35 +184,30 @@ public class MazeBuilder
|
||||
{
|
||||
for (z = minZ; z <= maxZ; z++)
|
||||
{
|
||||
setBlockDirectly(world, x, minY, z, blockID, metadata);
|
||||
setBlockDirectly(world, x, maxY, z, blockID, metadata);
|
||||
setBlockDirectly(world, x, minY, z, block, metadata);
|
||||
setBlockDirectly(world, x, maxY, z, block, metadata);
|
||||
}
|
||||
}
|
||||
for (x = minX; x <= maxX; x++)
|
||||
{
|
||||
for (y = minY; y <= maxY; y++)
|
||||
{
|
||||
setBlockDirectly(world, x, y, minZ, blockID, metadata);
|
||||
setBlockDirectly(world, x, y, maxZ, blockID, metadata);
|
||||
setBlockDirectly(world, x, y, minZ, block, metadata);
|
||||
setBlockDirectly(world, x, y, maxZ, block, metadata);
|
||||
}
|
||||
}
|
||||
for (z = minZ; z <= maxZ; z++)
|
||||
{
|
||||
for (y = minY; y <= maxY; y++)
|
||||
{
|
||||
setBlockDirectly(world, minX, y, z, blockID, metadata);
|
||||
setBlockDirectly(world, maxX, y, z, blockID, metadata);
|
||||
setBlockDirectly(world, minX, y, z, block, metadata);
|
||||
setBlockDirectly(world, maxX, y, z, block, metadata);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void setBlockDirectly(World world, int x, int y, int z, int blockID, int metadata)
|
||||
private static void setBlockDirectly(World world, int x, int y, int z, Block block, int metadata)
|
||||
{
|
||||
if (blockID != 0 && Block.blocksList[blockID] == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int cX = x >> 4;
|
||||
int cZ = z >> 4;
|
||||
int cY = y >> 4;
|
||||
@@ -228,7 +224,7 @@ public class MazeBuilder
|
||||
extBlockStorage = new ExtendedBlockStorage(cY << 4, !world.provider.hasNoSky);
|
||||
chunk.getBlockStorageArray()[cY] = extBlockStorage;
|
||||
}
|
||||
extBlockStorage.setExtBlockID(localX, y & 15, localZ, blockID);
|
||||
extBlockStorage.func_150818_a(localX, y & 15, localZ, block);
|
||||
extBlockStorage.setExtBlockMetadata(localX, y & 15, localZ, metadata);
|
||||
chunk.setChunkModified();
|
||||
}
|
||||
|
||||
@@ -29,18 +29,18 @@ public class SphereDecayOperation extends WorldOperation
|
||||
private double centerX;
|
||||
private double centerY;
|
||||
private double centerZ;
|
||||
private int primaryBlockID;
|
||||
private Block primaryBlock;
|
||||
private int primaryMetadata;
|
||||
private int secondaryBlockID;
|
||||
private Block secondaryBlock;
|
||||
private int secondaryMetadata;
|
||||
|
||||
public SphereDecayOperation(Random random, int primaryBlockID, int primaryMetadata, int secondaryBlockID, int secondaryMetadata)
|
||||
public SphereDecayOperation(Random random, Block primaryBlock, int primaryMetadata, Block secondaryBlock, int secondaryMetadata)
|
||||
{
|
||||
super("SphereDecayOperation");
|
||||
this.random = random;
|
||||
this.primaryBlockID = primaryBlockID;
|
||||
this.primaryBlock = primaryBlock;
|
||||
this.primaryMetadata = primaryMetadata;
|
||||
this.secondaryBlockID = secondaryBlockID;
|
||||
this.secondaryBlock = secondaryBlock;
|
||||
this.secondaryMetadata = secondaryMetadata;
|
||||
}
|
||||
|
||||
@@ -72,11 +72,11 @@ public class SphereDecayOperation extends WorldOperation
|
||||
|
||||
if (squareDistance < 0.5 || random.nextDouble() < scaling / squareDistance)
|
||||
{
|
||||
world.setBlock(x, y, z, primaryBlockID, primaryMetadata, 1);
|
||||
world.setBlock(x, y, z, primaryBlock, primaryMetadata, 1);
|
||||
}
|
||||
else if (random.nextDouble() < scaling / squareDistance)
|
||||
{
|
||||
world.setBlock(x, y, z, secondaryBlockID, secondaryMetadata, 1);
|
||||
world.setBlock(x, y, z, secondaryBlock, secondaryMetadata, 1);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -2,6 +2,7 @@ package StevenDimDoors.mod_pocketDim;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import StevenDimDoors.mod_pocketDim.blocks.BaseDimDoor;
|
||||
import StevenDimDoors.mod_pocketDim.config.DDProperties;
|
||||
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoor;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -12,6 +13,8 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
public class CommonProxy implements IGuiHandler
|
||||
{
|
||||
public static String BLOCK_PNG = "/PocketBlockTextures.png";
|
||||
@@ -134,18 +137,19 @@ 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 = door.func_150012_g(world, x,y,z) & 7;
|
||||
dimTile.lockStatus = door.getLockStatus(world, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void registerSidedHooks(DDProperties properties) {
|
||||
new ServerPacketHandler();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,66 +1,56 @@
|
||||
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 StevenDimDoors.mod_pocketDim.network.ClientJoinPacket;
|
||||
import StevenDimDoors.mod_pocketDim.network.DimDoorsNetwork;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent;
|
||||
import cpw.mods.fml.common.network.FMLEmbeddedChannel;
|
||||
import cpw.mods.fml.common.network.FMLNetworkEvent;
|
||||
import cpw.mods.fml.common.network.FMLOutboundHandler;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.network.NetHandlerPlayServer;
|
||||
import net.minecraft.network.Packet;
|
||||
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;
|
||||
import net.minecraftforge.common.network.ForgeMessage;
|
||||
import net.minecraftforge.common.network.ForgeNetworkHandler;
|
||||
|
||||
public class ConnectionHandler implements IConnectionHandler
|
||||
public class ConnectionHandler
|
||||
{
|
||||
@Override
|
||||
public String connectionReceived(NetLoginHandler netHandler, INetworkManager manager)
|
||||
{
|
||||
for(NewDimData data : PocketManager.getDimensions())
|
||||
{
|
||||
try
|
||||
{
|
||||
if(data.isPocketDimension()||data.id()==mod_pocketDim.properties.LimboDimensionID)
|
||||
{
|
||||
Packet250CustomPayload[] pkt = ForgePacket.makePacketSet(new DimensionRegisterPacket(data.id(), DimensionManager.getProviderType(data.id())));
|
||||
manager.addToSendQueue(pkt[0]);
|
||||
}
|
||||
}
|
||||
catch(Exception E)
|
||||
{
|
||||
E.printStackTrace();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@SubscribeEvent
|
||||
public void serverConnectionFromClientEvent(FMLNetworkEvent.ServerConnectionFromClientEvent event) {
|
||||
if (FMLCommonHandler.instance().getSide() == Side.SERVER) {
|
||||
NetHandlerPlayServer server = ((NetHandlerPlayServer)event.handler);
|
||||
FMLEmbeddedChannel channel = NetworkRegistry.INSTANCE.getChannel("FORGE", Side.SERVER);
|
||||
for (NewDimData data : PocketManager.getDimensions()) {
|
||||
try {
|
||||
if (data.isPocketDimension() || data.id() == mod_pocketDim.properties.LimboDimensionID) {
|
||||
channel.writeOutbound(new ForgeMessage.DimensionRegisterMessage(data.id(), DimensionManager.getProviderType(data.id())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connectionOpened(NetHandler netClientHandler, String server, int port, INetworkManager manager) { }
|
||||
|
||||
@Override
|
||||
public void connectionOpened(NetHandler netClientHandler,MinecraftServer server, INetworkManager manager) { }
|
||||
|
||||
@Override
|
||||
public void connectionClosed(INetworkManager manager)
|
||||
{
|
||||
if(PocketManager.isConnected)
|
||||
{
|
||||
PocketManager.unload();
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clientLoggedIn(NetHandler clientHandler, INetworkManager manager, Packet1Login login) { }
|
||||
@SubscribeEvent
|
||||
public void connectionClosed(FMLNetworkEvent.ClientDisconnectionFromServerEvent event)
|
||||
{
|
||||
PocketManager.tryUnload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playerLoggedIn(Player player, NetHandler netHandler, INetworkManager manager)
|
||||
@SubscribeEvent
|
||||
public void playerLoggedIn(PlayerEvent.PlayerLoggedInEvent event)
|
||||
{
|
||||
// Hax... please don't do this! >_<
|
||||
PocketManager.getDimwatcher().onCreated(new ClientDimData(PocketManager.createDimensionDataDangerously(0)));
|
||||
DimDoorsNetwork.sendToPlayer(new ClientJoinPacket(), event.player);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,13 @@
|
||||
package StevenDimDoors.mod_pocketDim;
|
||||
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockDispenser;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -12,10 +16,9 @@ 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 +30,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 +50,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,12 +100,12 @@ 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)
|
||||
{
|
||||
GameRegistry.addRecipe(new ItemStack(mod_pocketDim.itemPersonalDoor,1),
|
||||
"yxy", 'y', mod_pocketDim.itemGoldenDoor, 'x', mod_pocketDim.itemStableFabric);
|
||||
"yxy", 'y', mod_pocketDim.itemQuartzDoor, 'x', mod_pocketDim.itemStableFabric);
|
||||
}
|
||||
if (properties.CraftingQuartzDoorAllowed)
|
||||
{
|
||||
@@ -114,26 +117,26 @@ 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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCrafting(EntityPlayer player, ItemStack item, IInventory craftMatrix)
|
||||
@SubscribeEvent
|
||||
public void onCrafting(PlayerEvent.ItemCraftedEvent event)
|
||||
{
|
||||
if(item.getItem() instanceof ItemDDKey)
|
||||
if(event.crafting.getItem() instanceof ItemDDKey)
|
||||
{
|
||||
ItemDDKey keyItem = (ItemDDKey) item.getItem();
|
||||
ItemDDKey keyItem = (ItemDDKey) event.crafting.getItem();
|
||||
ItemStack topKey = null;
|
||||
ItemStack bottomKey = null;
|
||||
int topKeySlot = 0;
|
||||
|
||||
for(int i = 0; i<craftMatrix.getSizeInventory();i++)
|
||||
for(int i = 0; i<event.craftMatrix.getSizeInventory();i++)
|
||||
{
|
||||
ItemStack slot = craftMatrix.getStackInSlot(i);
|
||||
ItemStack slot = event.craftMatrix.getStackInSlot(i);
|
||||
if(slot!=null)
|
||||
{
|
||||
if(topKey==null)
|
||||
@@ -149,19 +152,12 @@ public class CraftingManager implements ICraftingHandler
|
||||
}
|
||||
}
|
||||
DDLock.addKeys(bottomKey, DDLock.getKeys(topKey));
|
||||
item.setTagCompound(bottomKey.getTagCompound());
|
||||
player.inventory.addItemStackToInventory(topKey);
|
||||
event.crafting.setTagCompound(bottomKey.getTagCompound());
|
||||
event.player.inventory.addItemStackToInventory(topKey);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSmelting(EntityPlayer player, ItemStack item)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public static void registerDispenserBehaviors()
|
||||
{
|
||||
// Register the dispenser behaviors for certain DD items
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -46,34 +47,34 @@ public class DDLoot {
|
||||
|
||||
ArrayList<WeightedRandomChestContent> items = new ArrayList<WeightedRandomChestContent>();
|
||||
|
||||
addContent(true, items, Item.ingotIron.itemID, 160, 1, 3);
|
||||
addContent(true, items, Item.coal.itemID, 120, 1, 3);
|
||||
addContent(true, items, Item.netherQuartz.itemID, 120, 1, 3);
|
||||
addContent(true, items, Item.enchantedBook.itemID, 100);
|
||||
addContent(true, items, Item.ingotGold.itemID, 80, 1, 3);
|
||||
addContent(true, items, Item.diamond.itemID, 40, 1, 2);
|
||||
addContent(true, items, Item.emerald.itemID, 20, 1, 2);
|
||||
addContent(true, items, Item.appleGold.itemID, 10);
|
||||
addContent(true, items, Items.iron_ingot, 160, 1, 3);
|
||||
addContent(true, items, Items.coal, 120, 1, 3);
|
||||
addContent(true, items, Items.quartz, 120, 1, 3);
|
||||
addContent(true, items, Items.book, 100);
|
||||
addContent(true, items, Items.gold_ingot, 80, 1, 3);
|
||||
addContent(true, items, Items.diamond, 40, 1, 2);
|
||||
addContent(true, items, Items.emerald, 20, 1, 2);
|
||||
addContent(true, items, Items.golden_apple, 10);
|
||||
|
||||
addContent(properties.FabricOfRealityLootEnabled, items, mod_pocketDim.blockDimWall.blockID, 20, 16, 64);
|
||||
addContent(properties.WorldThreadLootEnabled, items, mod_pocketDim.itemWorldThread.itemID, 80, 2, 12);
|
||||
addContent(properties.FabricOfRealityLootEnabled, items, Item.getItemFromBlock(mod_pocketDim.blockDimWall), 20, 16, 64);
|
||||
addContent(properties.WorldThreadLootEnabled, items, mod_pocketDim.itemWorldThread, 80, 2, 12);
|
||||
|
||||
// Add all the items to our dungeon chest
|
||||
addItemsToContainer(DungeonChestInfo, items);
|
||||
}
|
||||
|
||||
private static void addContent(boolean include, ArrayList<WeightedRandomChestContent> items,
|
||||
int itemID, int weight)
|
||||
Item item, int weight)
|
||||
{
|
||||
if (include)
|
||||
items.add(new WeightedRandomChestContent(itemID, 0, 1, 1, weight));
|
||||
items.add(new WeightedRandomChestContent(item, 0, 1, 1, weight));
|
||||
}
|
||||
|
||||
private static void addContent(boolean include, ArrayList<WeightedRandomChestContent> items,
|
||||
int itemID, int weight, int minAmount, int maxAmount)
|
||||
Item item, int weight, int minAmount, int maxAmount)
|
||||
{
|
||||
if (include)
|
||||
items.add(new WeightedRandomChestContent(itemID, 0, minAmount, maxAmount, weight));
|
||||
items.add(new WeightedRandomChestContent(item, 0, minAmount, maxAmount, weight));
|
||||
}
|
||||
|
||||
private static void addItemsToContainer(ChestGenHooks container, ArrayList<WeightedRandomChestContent> items)
|
||||
@@ -156,25 +157,25 @@ public class DDLoot {
|
||||
count = MathHelper.getRandomIntegerInRange(random, 2, 5);
|
||||
for (k = 0; k < count; k++)
|
||||
{
|
||||
stacks.add( new ItemStack(Item.bone, 1) );
|
||||
stacks.add( new ItemStack(Items.bone, 1) );
|
||||
}
|
||||
count = MathHelper.getRandomIntegerInRange(random, 2, 4);
|
||||
for (k = 0; k < count; k++)
|
||||
{
|
||||
stacks.add( new ItemStack(Item.rottenFlesh, 1) );
|
||||
stacks.add( new ItemStack(Items.rotten_flesh, 1) );
|
||||
}
|
||||
|
||||
// Insert tools
|
||||
// 30% chance of adding a pickaxe
|
||||
if (random.nextInt(100) < 30)
|
||||
{
|
||||
addModifiedTool(Item.pickaxeIron, stacks, random);
|
||||
addModifiedTool(Items.iron_pickaxe, stacks, random);
|
||||
}
|
||||
// 30% chance of adding a bow and some arrows
|
||||
if (random.nextInt(100) < 30)
|
||||
{
|
||||
addModifiedBow(stacks, random);
|
||||
stacks.add( new ItemStack(Item.arrow, MathHelper.getRandomIntegerInRange(random, 8, 32)) );
|
||||
stacks.add( new ItemStack(Items.arrow, MathHelper.getRandomIntegerInRange(random, 8, 32)) );
|
||||
}
|
||||
// 10% chance of adding a Rift Blade (no enchants)
|
||||
if (properties.RiftBladeLootEnabled && random.nextInt(100) < 10)
|
||||
@@ -184,25 +185,25 @@ public class DDLoot {
|
||||
else
|
||||
{
|
||||
// 20% of adding an iron sword, 10% of adding a stone sword
|
||||
addModifiedSword( getRandomItem(Item.swordIron, Item.swordStone, null, 20, 10, random) , stacks, random);
|
||||
addModifiedSword( getRandomItem(Items.iron_sword, Items.stone_sword, null, 20, 10, random) , stacks, random);
|
||||
}
|
||||
|
||||
// Insert equipment
|
||||
// For each piece, 25% of an iron piece, 10% of a chainmail piece
|
||||
addModifiedEquipment( getRandomItem(Item.helmetIron, Item.helmetChain, null, 25, 10, random) , stacks, random);
|
||||
addModifiedEquipment( getRandomItem(Item.plateIron, Item.plateChain, null, 25, 10, random) , stacks, random);
|
||||
addModifiedEquipment( getRandomItem(Item.legsIron, Item.legsChain, null, 25, 10, random) , stacks, random);
|
||||
addModifiedEquipment( getRandomItem(Item.bootsIron, Item.bootsChain, null, 25, 10, random) , stacks, random);
|
||||
addModifiedEquipment( getRandomItem(Items.iron_helmet, Items.chainmail_helmet, null, 25, 10, random) , stacks, random);
|
||||
addModifiedEquipment( getRandomItem(Items.iron_chestplate, Items.chainmail_chestplate, null, 25, 10, random) , stacks, random);
|
||||
addModifiedEquipment( getRandomItem(Items.iron_leggings, Items.chainmail_leggings, null, 25, 10, random) , stacks, random);
|
||||
addModifiedEquipment( getRandomItem(Items.iron_boots, Items.iron_boots, null, 25, 10, random) , stacks, random);
|
||||
|
||||
// Insert other random stuff
|
||||
// 40% chance for a name tag, 35% chance for a glass bottle
|
||||
// 30% chance for an ender pearl, 5% chance for record 11
|
||||
// 30% chance for a ghast tear
|
||||
addItemWithChance(stacks, random, 40, Item.nameTag, 1);
|
||||
addItemWithChance(stacks, random, 35, Item.glassBottle, 1);
|
||||
addItemWithChance(stacks, random, 30, Item.enderPearl, 1);
|
||||
addItemWithChance(stacks, random, 30, Item.ghastTear, 1);
|
||||
addItemWithChance(stacks, random, 5, Item.record11, 1);
|
||||
addItemWithChance(stacks, random, 40, Items.name_tag, 1);
|
||||
addItemWithChance(stacks, random, 35, Items.glass_bottle, 1);
|
||||
addItemWithChance(stacks, random, 30, Items.ender_pearl, 1);
|
||||
addItemWithChance(stacks, random, 30, Items.ghast_tear, 1);
|
||||
addItemWithChance(stacks, random, 5, Items.record_11, 1);
|
||||
|
||||
// Finally, there is a 5% chance of adding a player head
|
||||
if (random.nextInt(100) < 5)
|
||||
@@ -239,7 +240,7 @@ public class DDLoot {
|
||||
|
||||
private static void addModifiedBow(ArrayList<ItemStack> stacks, Random random)
|
||||
{
|
||||
stacks.add( getModifiedItem(Item.bow, random, new Enchantment[] { Enchantment.flame, Enchantment.power, Enchantment.punch }) );
|
||||
stacks.add( getModifiedItem(Items.bow, random, new Enchantment[] { Enchantment.flame, Enchantment.power, Enchantment.punch }) );
|
||||
}
|
||||
|
||||
private static ItemStack getModifiedItem(Item item, Random random, Enchantment[] enchantments)
|
||||
@@ -289,7 +290,7 @@ public class DDLoot {
|
||||
{
|
||||
skullOwner = deathTracker.getRandomUsername(random);
|
||||
}
|
||||
ItemStack skull = new ItemStack(Item.skull, 1, PLAYER_SKULL_METADATA);
|
||||
ItemStack skull = new ItemStack(Items.skull, 1, PLAYER_SKULL_METADATA);
|
||||
skull.stackTagCompound = new NBTTagCompound();
|
||||
skull.stackTagCompound.setString("SkullOwner", skullOwner);
|
||||
stacks.add(skull);
|
||||
|
||||
@@ -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) == 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)==mod_pocketDim.blockRift)
|
||||
{
|
||||
if(MathHelper.abs(i)+MathHelper.abs(j)+MathHelper.abs(k)!=0)
|
||||
{
|
||||
|
||||
@@ -1,18 +1,24 @@
|
||||
package StevenDimDoors.mod_pocketDim;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import cpw.mods.fml.common.eventhandler.EventPriority;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.ISound;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.client.audio.SoundManager;
|
||||
import net.minecraft.client.audio.SoundPoolEntry;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldProvider;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraftforge.client.event.sound.PlayBackgroundMusicEvent;
|
||||
import net.minecraftforge.client.event.sound.PlaySoundEvent17;
|
||||
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;
|
||||
@@ -59,7 +65,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
|
||||
@@ -73,36 +79,7 @@ public class EventHookContainer
|
||||
*/
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@ForgeSubscribe
|
||||
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");
|
||||
event.manager.addSound(mod_pocketDim.modid + ":keyUnlock.ogg");
|
||||
event.manager.addSound(mod_pocketDim.modid + ":monk.ogg");
|
||||
event.manager.addSound(mod_pocketDim.modid + ":crack.ogg");
|
||||
event.manager.addSound(mod_pocketDim.modid + ":tearing.ogg");
|
||||
event.manager.addSound(mod_pocketDim.modid + ":rift.ogg");
|
||||
event.manager.addSound(mod_pocketDim.modid + ":riftStart.ogg");
|
||||
event.manager.addSound(mod_pocketDim.modid + ":riftEnd.ogg");
|
||||
event.manager.addSound(mod_pocketDim.modid + ":riftClose.ogg");
|
||||
event.manager.addSound(mod_pocketDim.modid + ":riftDoor.ogg");
|
||||
event.manager.addSound(mod_pocketDim.modid + ":creepy.ogg");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@ForgeSubscribe
|
||||
public void onSoundEffectResult(PlayBackgroundMusicEvent event)
|
||||
{
|
||||
if (FMLClientHandler.instance().getClient().thePlayer.worldObj.provider.dimensionId == mod_pocketDim.properties.LimboDimensionID)
|
||||
{
|
||||
this.playMusicForDim(FMLClientHandler.instance().getClient().thePlayer.worldObj);
|
||||
}
|
||||
}
|
||||
|
||||
@ForgeSubscribe
|
||||
@SubscribeEvent
|
||||
public void onPlayerEvent(PlayerInteractEvent event)
|
||||
{
|
||||
// Handle all door placement here
|
||||
@@ -135,31 +112,26 @@ public class EventHookContainer
|
||||
|
||||
}
|
||||
|
||||
@ForgeSubscribe
|
||||
@SubscribeEvent
|
||||
public void onWorldLoad(WorldEvent.Load event)
|
||||
{
|
||||
// We need to initialize PocketManager here because onServerAboutToStart
|
||||
// fires before we can use DimensionManager and onServerStarting fires
|
||||
// after the game tries to generate terrain. If a gateway tries to
|
||||
// generate before PocketManager has initialized, we get a crash.
|
||||
if (!PocketManager.isLoaded())
|
||||
if (!event.world.isRemote && !PocketManager.isLoaded())
|
||||
{
|
||||
PocketManager.load();
|
||||
}
|
||||
|
||||
if (event.world != null)
|
||||
{
|
||||
this.playMusicForDim(event.world);
|
||||
}
|
||||
}
|
||||
|
||||
@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 +147,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.getGameProfile().getName());
|
||||
revivePlayerInLimbo(player);
|
||||
event.setCanceled(true);
|
||||
return false;
|
||||
@@ -192,7 +164,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 +178,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.getGameProfile().getName());
|
||||
|
||||
if (properties.LimboEnabled && !properties.LimboReturnsInventoryEnabled)
|
||||
{
|
||||
player.inventory.clearInventory(-1, -1);
|
||||
player.inventory.clearInventory(null, -1);
|
||||
revivePlayerInLimbo(player);
|
||||
event.setCanceled(true);
|
||||
}
|
||||
@@ -240,7 +212,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 +226,7 @@ public class EventHookContainer
|
||||
}
|
||||
}
|
||||
|
||||
@ForgeSubscribe
|
||||
@SubscribeEvent
|
||||
public void onChunkLoad(ChunkEvent.Load event)
|
||||
{
|
||||
// Schedule rift regeneration for any links located in this chunk.
|
||||
@@ -272,33 +244,4 @@ public class EventHookContainer
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void playMusicForDim(World world)
|
||||
{
|
||||
if (world.isRemote)
|
||||
{
|
||||
SoundManager sndManager = FMLClientHandler.instance().getClient().sndManager;
|
||||
|
||||
// SenseiKiwi: I've added the following check as a quick fix for a
|
||||
// reported crash. This needs to work without a hitch or we have to
|
||||
// stop trying to replace the background music...
|
||||
if (sndManager != null && sndManager.sndSystem != null)
|
||||
{
|
||||
if (world.provider instanceof LimboProvider)
|
||||
{
|
||||
sndManager.sndSystem.stop("BgMusic");
|
||||
SoundPoolEntry soundPoolEntry = sndManager.soundPoolSounds.getRandomSoundFromSoundPool(mod_pocketDim.modid + ":creepy");
|
||||
if (soundPoolEntry != null)
|
||||
{
|
||||
sndManager.sndSystem.backgroundMusic("LimboMusic", soundPoolEntry.getSoundUrl(), soundPoolEntry.getSoundName(), false);
|
||||
sndManager.sndSystem.play("LimboMusic");
|
||||
}
|
||||
}
|
||||
else if (!(world.provider instanceof LimboProvider))
|
||||
{
|
||||
sndManager.sndSystem.stop("LimboMusic");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,18 +4,15 @@ import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import StevenDimDoors.mod_pocketDim.network.*;
|
||||
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;
|
||||
import net.minecraft.network.Packet;
|
||||
|
||||
public class ServerPacketHandler implements IPacketHandler
|
||||
public class ServerPacketHandler
|
||||
{
|
||||
public ServerPacketHandler()
|
||||
{
|
||||
@@ -23,21 +20,18 @@ public class ServerPacketHandler implements IPacketHandler
|
||||
PocketManager.registerLinkWatcher(new LinkWatcher());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player) { }
|
||||
|
||||
private static class DimWatcher implements IUpdateWatcher<ClientDimData>
|
||||
{
|
||||
@Override
|
||||
public void onCreated(ClientDimData message)
|
||||
{
|
||||
sendDimPacket(PacketConstants.CREATE_DIM_PACKET_ID, message);
|
||||
DimDoorsNetwork.sendToAllPlayers(new CreateDimensionPacket(message));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeleted(ClientDimData message)
|
||||
{
|
||||
sendDimPacket(PacketConstants.DELETE_DIM_PACKET_ID, message);
|
||||
DimDoorsNetwork.sendToAllPlayers(new DeleteDimensionPacket(message));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -53,89 +47,19 @@ public class ServerPacketHandler implements IPacketHandler
|
||||
@Override
|
||||
public void onCreated(ClientLinkData message)
|
||||
{
|
||||
sendLinkPacket(PacketConstants.CREATE_LINK_PACKET_ID, message);
|
||||
DimDoorsNetwork.sendToAllPlayers(new CreateLinkPacket(message));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeleted(ClientLinkData message)
|
||||
{
|
||||
sendLinkPacket(PacketConstants.DELETE_LINK_PACKET_ID, message);
|
||||
DimDoorsNetwork.sendToAllPlayers(new DeleteLinkPacket(message));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(ClientLinkData message)
|
||||
{
|
||||
sendLinkPacket(PacketConstants.UPDATE_LINK_PACKET_ID, message);
|
||||
}
|
||||
}
|
||||
|
||||
public static Packet250CustomPayload createLinkPacket(ClientLinkData data)
|
||||
{
|
||||
try
|
||||
{
|
||||
Packet250CustomPayload packet = new Packet250CustomPayload();
|
||||
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
|
||||
DataOutputStream writer = new DataOutputStream(buffer);
|
||||
writer.writeByte(PacketConstants.CREATE_LINK_PACKET_ID);
|
||||
data.write(writer);
|
||||
writer.close();
|
||||
packet.channel = PacketConstants.CHANNEL_NAME;
|
||||
packet.data = buffer.toByteArray();
|
||||
packet.length = packet.data.length;
|
||||
return packet;
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
//This shouldn't happen...
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static void sendDimPacket(byte id, ClientDimData data)
|
||||
{
|
||||
try
|
||||
{
|
||||
Packet250CustomPayload packet = new Packet250CustomPayload();
|
||||
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
|
||||
DataOutputStream writer = new DataOutputStream(buffer);
|
||||
writer.writeByte(id);
|
||||
data.write(writer);
|
||||
writer.close();
|
||||
packet.channel = PacketConstants.CHANNEL_NAME;
|
||||
packet.data = buffer.toByteArray();
|
||||
packet.length = packet.data.length;
|
||||
PacketDispatcher.sendPacketToAllPlayers(packet);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
//This shouldn't happen...
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static void sendLinkPacket(byte id, ClientLinkData message)
|
||||
{
|
||||
try
|
||||
{
|
||||
Packet250CustomPayload packet = new Packet250CustomPayload();
|
||||
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
|
||||
DataOutputStream writer = new DataOutputStream(buffer);
|
||||
writer.writeByte(id);
|
||||
message.write(writer);
|
||||
writer.close();
|
||||
packet.channel = PacketConstants.CHANNEL_NAME;
|
||||
packet.data = buffer.toByteArray();
|
||||
packet.length = packet.data.length;
|
||||
PacketDispatcher.sendPacketToAllPlayers(packet);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
//This shouldn't happen...
|
||||
e.printStackTrace();
|
||||
DimDoorsNetwork.sendToAllPlayers(new UpdateLinkPacket(message));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,24 @@
|
||||
package StevenDimDoors.mod_pocketDim.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import StevenDimDoors.mod_pocketDim.core.LinkType;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockDoor;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.IconFlipped;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemDoor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
@@ -32,23 +36,23 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
|
||||
protected final DDProperties properties;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected Icon[] upperTextures;
|
||||
protected IIcon[] upperTextures;
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected Icon[] lowerTextures;
|
||||
protected IIcon[] lowerTextures;
|
||||
|
||||
public BaseDimDoor(int blockID, Material material, DDProperties properties)
|
||||
public BaseDimDoor(Material material, DDProperties properties)
|
||||
{
|
||||
super(blockID, material);
|
||||
super(material);
|
||||
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IconRegister iconRegister)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
upperTextures = new Icon[2];
|
||||
lowerTextures = new Icon[2];
|
||||
upperTextures = new IIcon[2];
|
||||
lowerTextures = new IIcon[2];
|
||||
upperTextures[0] = iconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName() + "_upper");
|
||||
lowerTextures[0] = iconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName() + "_lower");
|
||||
upperTextures[1] = new IconFlipped(upperTextures[0], true, false);
|
||||
@@ -60,9 +64,9 @@ 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];
|
||||
return upperTextures[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -86,25 +90,22 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
|
||||
return false;
|
||||
}
|
||||
|
||||
final int MAGIC_CONSTANT = 1003;
|
||||
int metadata = this.func_150012_g(world, x, y, z);
|
||||
int newMetadata = metadata & 7;
|
||||
newMetadata ^= 4;
|
||||
|
||||
int metadata = this.getFullMetadata(world, x, y, z);
|
||||
int lowMeta = metadata & 7;
|
||||
lowMeta ^= 4;
|
||||
|
||||
if (isUpperDoorBlock(metadata))
|
||||
if ((metadata & 8) == 0)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y - 1, z, lowMeta, 2);
|
||||
world.markBlockRangeForRenderUpdate(x, y - 1, z, x, y, z);
|
||||
world.setBlockMetadataWithNotify(x, y, z, newMetadata, 2);
|
||||
world.markBlockRangeForRenderUpdate(x, y, z, x, y, z);
|
||||
}
|
||||
else
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, lowMeta, 2);
|
||||
world.markBlockRangeForRenderUpdate(x, y, z, x, y, z);
|
||||
world.setBlockMetadataWithNotify(x, y - 1, z, newMetadata, 2);
|
||||
world.markBlockRangeForRenderUpdate(x, y - 1, z, x, y, z);
|
||||
}
|
||||
|
||||
world.playAuxSFXAtEntity(player, MAGIC_CONSTANT, x, y, z, 0);
|
||||
|
||||
world.playAuxSFXAtEntity(player, 1003, x, y, z, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -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, world.getBlockMetadata(x, y, z)));
|
||||
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 = func_150012_g(blockAccess, 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 = this.func_150012_g(world, 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(func_150012_g(par1IBlockAccess, 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 neighbor)
|
||||
{
|
||||
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
if (isUpperDoorBlock(metadata))
|
||||
{
|
||||
if (world.getBlockId(x, y - 1, z) != this.blockID)
|
||||
if (world.getBlock(x, y - 1, z) != this)
|
||||
{
|
||||
world.setBlockToAir(x, y, z);
|
||||
}
|
||||
if (neighborID > 0 && neighborID != this.blockID)
|
||||
if (!neighbor.isAir(world, x, y, z) && neighbor != this)
|
||||
{
|
||||
this.onNeighborBlockChange(world, x, y - 1, z, neighborID);
|
||||
this.onNeighborBlockChange(world, x, y - 1, z, neighbor);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (world.getBlockId(x, y + 1, z) != this.blockID)
|
||||
if (world.getBlock(x, y + 1, z) != this)
|
||||
{
|
||||
world.setBlockToAir(x, y, z);
|
||||
if (!world.isRemote)
|
||||
@@ -362,9 +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 || !neighbor.isAir(world, x, y, z) && neighbor.canProvidePower()) && neighbor != this)
|
||||
{
|
||||
this.onPoweredBlockChange(world, x, y, z, powered);
|
||||
this.func_150014_a(world, x, y, z, powered);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -375,22 +376,28 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
|
||||
*/
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int idPicked(World world, int x, int y, int z)
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player)
|
||||
{
|
||||
return this.getDoorItem();
|
||||
return new ItemStack(this.getDoorItem(), 1, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ID of the items to drop on destruction.
|
||||
*/
|
||||
@Override
|
||||
public int idDropped(int metadata, Random random, int fortune)
|
||||
public Item getItemDropped(int metadata, Random random, int fortune)
|
||||
{
|
||||
return isUpperDoorBlock(metadata) ? 0 : this.getDrops();
|
||||
return isUpperDoorBlock(metadata) ? null : this.getDoorItem();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world)
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Item getItem(World world, int x, int y, int z) {
|
||||
return this.getDoorItem();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int metadata)
|
||||
{
|
||||
return new TileEntityDimDoor();
|
||||
}
|
||||
@@ -405,7 +412,7 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
|
||||
}
|
||||
|
||||
// Check that this is the top block of the door
|
||||
if (world.getBlockId(x, y - 1, z) == this.blockID)
|
||||
if (world.getBlock(x, y - 1, z) == this)
|
||||
{
|
||||
int metadata = world.getBlockMetadata(x, y - 1, z);
|
||||
boolean canUse = isDoorOpen(metadata);
|
||||
@@ -418,7 +425,7 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
|
||||
{
|
||||
// Teleport the entity through the link, if it exists
|
||||
DimLink link = PocketManager.getLink(x, y, z, world.provider.dimensionId);
|
||||
if (link != null)
|
||||
if (link != null && (link.linkType() != LinkType.PERSONAL || entity instanceof EntityPlayer))
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -433,10 +440,10 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
|
||||
|
||||
// Close the door only after the entity goes through
|
||||
// so players don't have it slam in their faces.
|
||||
this.onPoweredBlockChange(world, x, y, z, false);
|
||||
this.func_150014_a(world, x, y, z, false);
|
||||
}
|
||||
}
|
||||
else if (world.getBlockId(x, y + 1, z) == this.blockID)
|
||||
else if (world.getBlock(x, y + 1, z) == this)
|
||||
{
|
||||
enterDimDoor(world, x, y + 1, z, entity);
|
||||
}
|
||||
@@ -525,20 +532,20 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
|
||||
@Override
|
||||
public TileEntity initDoorTE(World world, int x, int y, int z)
|
||||
{
|
||||
TileEntity te = this.createNewTileEntity(world);
|
||||
world.setBlockTileEntity(x, y, z, te);
|
||||
TileEntity te = this.createNewTileEntity(world, world.getBlockMetadata(x, y, z));
|
||||
world.setTileEntity(x, y, z, te);
|
||||
return te;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, int oldBlockID, int oldMeta)
|
||||
public void breakBlock(World world, int x, int y, int z, Block oldBlock, int oldMeta)
|
||||
{
|
||||
// This function runs on the server side after a block is replaced
|
||||
// We MUST call super.breakBlock() since it involves removing tile entities
|
||||
super.breakBlock(world, x, y, z, oldBlockID, oldMeta);
|
||||
super.breakBlock(world, x, y, z, oldBlock, oldMeta);
|
||||
|
||||
// Schedule rift regeneration for this block if it was replaced
|
||||
if (world.getBlockId(x, y, z) != oldBlockID)
|
||||
if (world.getBlock(x, y, z) != oldBlock)
|
||||
{
|
||||
mod_pocketDim.riftRegenerator.scheduleFastRegeneration(x, y, z, world);
|
||||
}
|
||||
|
||||
@@ -6,14 +6,14 @@ import java.util.Random;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
@@ -25,11 +25,11 @@ public class BlockDimWall extends Block
|
||||
{
|
||||
private static final float SUPER_HIGH_HARDNESS = 10000000000000F;
|
||||
private static final float SUPER_EXPLOSION_RESISTANCE = 18000000F;
|
||||
private Icon[] blockIcon = new Icon[3];
|
||||
private IIcon[] blockIcon = new IIcon[3];
|
||||
|
||||
public BlockDimWall(int blockID, int j, Material par2Material)
|
||||
public BlockDimWall(int j, Material par2Material)
|
||||
{
|
||||
super(blockID, par2Material);
|
||||
super(par2Material);
|
||||
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public class BlockDimWall extends Block
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IconRegister par1IconRegister)
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister)
|
||||
{
|
||||
this.blockIcon[0] = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName());
|
||||
this.blockIcon[1] = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName() + "Perm");
|
||||
@@ -74,7 +74,7 @@ public class BlockDimWall extends Block
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public Icon getIcon(int par1, int par2)
|
||||
public IIcon getIcon(int par1, int par2)
|
||||
{
|
||||
switch(par2)
|
||||
{
|
||||
@@ -99,7 +99,7 @@ public class BlockDimWall extends Block
|
||||
@Override
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(int unknown, CreativeTabs tab, List subItems)
|
||||
public void getSubBlocks(Item unknown, CreativeTabs tab, List subItems)
|
||||
{
|
||||
for (int ix = 0; ix < 3; ix++)
|
||||
{
|
||||
@@ -139,9 +139,9 @@ public class BlockDimWall extends Block
|
||||
// Some mods may override that function and use item IDs outside the range
|
||||
// of the block list.
|
||||
|
||||
int blockID = ((ItemBlock) playerEquip).getBlockID();
|
||||
Block block = Block.blocksList[blockID];
|
||||
if (!Block.isNormalCube(blockID) || block instanceof BlockContainer || blockID == this.blockID)
|
||||
ItemBlock playerEquipItemBlock = (ItemBlock)playerEquip;
|
||||
Block block = playerEquipItemBlock.field_150939_a;
|
||||
if (!block.isNormalCube(world, x, y, z) || block instanceof BlockContainer || block == this)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -151,7 +151,7 @@ public class BlockDimWall extends Block
|
||||
{
|
||||
entityPlayer.getCurrentEquippedItem().stackSize--;
|
||||
}
|
||||
world.setBlock(x, y, z, entityPlayer.getCurrentEquippedItem().itemID, entityPlayer.getCurrentEquippedItem().getItemDamage(), 0);
|
||||
world.setBlock(x, y, z, block, playerEquipItemBlock.getMetadata(entityPlayer.getCurrentEquippedItem().getItemDamage()), 0);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -22,16 +22,16 @@ public class BlockDimWallPerm extends Block
|
||||
private static final Random random = new Random();
|
||||
private static DDProperties properties = null;
|
||||
|
||||
public BlockDimWallPerm(int i, int j, Material par2Material)
|
||||
public BlockDimWallPerm(int j, Material par2Material)
|
||||
{
|
||||
super(i, Material.ground);
|
||||
super(Material.ground);
|
||||
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
|
||||
if (properties == null)
|
||||
properties = DDProperties.instance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IconRegister par1IconRegister)
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister)
|
||||
{
|
||||
this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName());
|
||||
}
|
||||
@@ -87,7 +87,7 @@ public class BlockDimWallPerm extends Block
|
||||
if (Math.abs(xc) + Math.abs(zc) < random.nextInt(3) + 2 ||
|
||||
Math.abs(xc) + Math.abs(zc) < random.nextInt(3) + 3)
|
||||
{
|
||||
overworld.setBlock(destinationX + xc, destinationY - 1, destinationZ + zc, properties.LimboBlockID);
|
||||
overworld.setBlock(destinationX + xc, destinationY - 1, destinationZ + zc, mod_pocketDim.blockLimbo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,9 @@ 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.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
@@ -15,9 +16,9 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockDoorGold extends BlockDoor
|
||||
{
|
||||
public BlockDoorGold(int par1, Material par2Material)
|
||||
public BlockDoorGold(Material par2Material)
|
||||
{
|
||||
super(par1, par2Material);
|
||||
super( par2Material);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -26,10 +27,15 @@ public class BlockDoorGold extends BlockDoor
|
||||
return mod_pocketDim.modid + ":" + this.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int par1, Random par2Random, int par3)
|
||||
{
|
||||
return (par1 & 8) != 0 ? null : mod_pocketDim.itemGoldenDoor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int idDropped(int par1, Random par2Random, int par3)
|
||||
{
|
||||
return (par1 & 8) != 0 ? 0 : mod_pocketDim.itemGoldenDoor.itemID;
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Item getItem(World world, int x, int y, int z) {
|
||||
return mod_pocketDim.itemGoldenDoor;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,12 +6,14 @@ 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 net.minecraft.world.World;
|
||||
|
||||
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 +23,14 @@ 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.itemQuartzDoor;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Item getItem(World world, int x, int y, int z) {
|
||||
return mod_pocketDim.itemQuartzDoor;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,21 +9,22 @@ import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoorGold;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockGoldDimDoor extends BaseDimDoor
|
||||
{
|
||||
|
||||
public BlockGoldDimDoor(int blockID, Material material, DDProperties properties)
|
||||
public BlockGoldDimDoor(Material material, DDProperties properties)
|
||||
{
|
||||
super(blockID, material, properties);
|
||||
super( material, properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void placeLink(World world, int x, int y, int z)
|
||||
{
|
||||
if (!world.isRemote && world.getBlockId(x, y - 1, z) == this.blockID)
|
||||
if (!world.isRemote && world.getBlock(x, y - 1, z) == this)
|
||||
{
|
||||
NewDimData dimension = PocketManager.createDimensionData(world);
|
||||
DimLink link = dimension.getLink(x, y, z);
|
||||
@@ -35,19 +36,13 @@ public class BlockGoldDimDoor extends BaseDimDoor
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDoorItem()
|
||||
public Item getDoorItem()
|
||||
{
|
||||
return mod_pocketDim.itemGoldenDimensionalDoor.itemID;
|
||||
return mod_pocketDim.itemGoldenDimensionalDoor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDrops()
|
||||
{
|
||||
return mod_pocketDim.itemGoldenDoor.itemID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world)
|
||||
public TileEntity createNewTileEntity(World world, int metadata)
|
||||
{
|
||||
return new TileEntityDimDoorGold();
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@ import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
@@ -18,9 +18,9 @@ public class BlockLimbo extends Block
|
||||
private final int limboDimensionID;
|
||||
private final LimboDecay decay;
|
||||
|
||||
public BlockLimbo(int i, int j, Material par2Material, int limboDimensionID, LimboDecay decay)
|
||||
public BlockLimbo(int j, Material par2Material, int limboDimensionID, LimboDecay decay)
|
||||
{
|
||||
super(i, Material.ground);
|
||||
super(Material.ground);
|
||||
this.limboDimensionID = limboDimensionID;
|
||||
this.decay = decay;
|
||||
this.setTickRandomly(true);
|
||||
@@ -32,19 +32,19 @@ public class BlockLimbo extends Block
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public Icon getBlockTexture(IBlockAccess blockAccess, int x, int y, int z, int side)
|
||||
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side)
|
||||
{
|
||||
return this.getIcon(side, blockAccess.getBlockMetadata(x, y, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IconRegister iconRegister)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getIcon(int par1, int par2)
|
||||
public IIcon getIcon(int par1, int par2)
|
||||
{
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@@ -7,15 +7,18 @@ import java.util.Queue;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockFlowing;
|
||||
import net.minecraft.block.BlockFluid;
|
||||
import net.minecraft.block.BlockLiquid;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.IFluidBlock;
|
||||
@@ -47,48 +50,48 @@ public class BlockRift extends Block implements ITileEntityProvider
|
||||
public static final int MAX_WORLD_THREAD_DROP_CHANCE = 1000;
|
||||
|
||||
private final DDProperties properties;
|
||||
private final ArrayList<Integer> blocksImmuneToRift; // List of Vanilla blocks immune to rifts
|
||||
private final ArrayList<Integer> modBlocksImmuneToRift; // List of DD blocks immune to rifts
|
||||
private final ArrayList<Block> blocksImmuneToRift; // List of Vanilla blocks immune to rifts
|
||||
private final ArrayList<Block> modBlocksImmuneToRift; // List of DD blocks immune to rifts
|
||||
|
||||
public BlockRift(int i, int j, Material par2Material, DDProperties properties)
|
||||
public BlockRift(Material par2Material, DDProperties properties)
|
||||
{
|
||||
super(i, par2Material);
|
||||
super(par2Material);
|
||||
this.setTickRandomly(true);
|
||||
this.properties = properties;
|
||||
this.modBlocksImmuneToRift = new ArrayList<Integer>();
|
||||
this.modBlocksImmuneToRift.add(properties.FabricBlockID);
|
||||
this.modBlocksImmuneToRift.add(properties.PermaFabricBlockID);
|
||||
this.modBlocksImmuneToRift.add(properties.DimensionalDoorID);
|
||||
this.modBlocksImmuneToRift.add(properties.WarpDoorID);
|
||||
this.modBlocksImmuneToRift.add(properties.TransTrapdoorID);
|
||||
this.modBlocksImmuneToRift.add(properties.UnstableDoorID);
|
||||
this.modBlocksImmuneToRift.add(properties.RiftBlockID);
|
||||
this.modBlocksImmuneToRift.add(properties.TransientDoorID);
|
||||
this.modBlocksImmuneToRift.add(properties.GoldenDimensionalDoorID);
|
||||
this.modBlocksImmuneToRift.add(properties.GoldenDoorID);
|
||||
this.modBlocksImmuneToRift = new ArrayList<Block>();
|
||||
this.modBlocksImmuneToRift.add(mod_pocketDim.blockDimWall);
|
||||
this.modBlocksImmuneToRift.add(mod_pocketDim.blockDimWallPerm);
|
||||
this.modBlocksImmuneToRift.add(mod_pocketDim.dimensionalDoor);
|
||||
this.modBlocksImmuneToRift.add(mod_pocketDim.warpDoor);
|
||||
this.modBlocksImmuneToRift.add(mod_pocketDim.transTrapdoor);
|
||||
this.modBlocksImmuneToRift.add(mod_pocketDim.unstableDoor);
|
||||
this.modBlocksImmuneToRift.add(mod_pocketDim.blockRift);
|
||||
this.modBlocksImmuneToRift.add(mod_pocketDim.transientDoor);
|
||||
this.modBlocksImmuneToRift.add(mod_pocketDim.goldenDimensionalDoor);
|
||||
this.modBlocksImmuneToRift.add(mod_pocketDim.goldenDoor);
|
||||
|
||||
this.blocksImmuneToRift = new ArrayList<Integer>();
|
||||
this.blocksImmuneToRift = new ArrayList<Block>();
|
||||
|
||||
this.blocksImmuneToRift.add(properties.FabricBlockID);
|
||||
this.blocksImmuneToRift.add(properties.PermaFabricBlockID);
|
||||
this.blocksImmuneToRift.add(properties.DimensionalDoorID);
|
||||
this.blocksImmuneToRift.add(properties.WarpDoorID);
|
||||
this.blocksImmuneToRift.add(properties.TransTrapdoorID);
|
||||
this.blocksImmuneToRift.add(properties.UnstableDoorID);
|
||||
this.blocksImmuneToRift.add(properties.RiftBlockID);
|
||||
this.blocksImmuneToRift.add(properties.TransientDoorID);
|
||||
this.blocksImmuneToRift.add(properties.GoldenDimensionalDoorID);
|
||||
this.blocksImmuneToRift.add(properties.GoldenDoorID);
|
||||
this.blocksImmuneToRift.add(properties.PersonalDimDoorID);
|
||||
this.blocksImmuneToRift.add(Block.blockLapis.blockID);
|
||||
this.blocksImmuneToRift.add(Block.blockIron.blockID);
|
||||
this.blocksImmuneToRift.add(Block.blockGold.blockID);
|
||||
this.blocksImmuneToRift.add(Block.blockDiamond.blockID);
|
||||
this.blocksImmuneToRift.add(Block.blockEmerald.blockID);
|
||||
this.blocksImmuneToRift.add(mod_pocketDim.blockDimWall);
|
||||
this.blocksImmuneToRift.add(mod_pocketDim.blockDimWallPerm);
|
||||
this.blocksImmuneToRift.add(mod_pocketDim.dimensionalDoor);
|
||||
this.blocksImmuneToRift.add(mod_pocketDim.warpDoor);
|
||||
this.blocksImmuneToRift.add(mod_pocketDim.transTrapdoor);
|
||||
this.blocksImmuneToRift.add(mod_pocketDim.unstableDoor);
|
||||
this.blocksImmuneToRift.add(mod_pocketDim.blockRift);
|
||||
this.blocksImmuneToRift.add(mod_pocketDim.transientDoor);
|
||||
this.blocksImmuneToRift.add(mod_pocketDim.goldenDimensionalDoor);
|
||||
this.blocksImmuneToRift.add(mod_pocketDim.goldenDoor);
|
||||
this.blocksImmuneToRift.add(mod_pocketDim.personalDimDoor);
|
||||
this.blocksImmuneToRift.add(Blocks.lapis_block);
|
||||
this.blocksImmuneToRift.add(Blocks.iron_block);
|
||||
this.blocksImmuneToRift.add(Blocks.gold_block);
|
||||
this.blocksImmuneToRift.add(Blocks.diamond_block);
|
||||
this.blocksImmuneToRift.add(Blocks.emerald_block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IconRegister par1IconRegister)
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister)
|
||||
{
|
||||
this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName());
|
||||
}
|
||||
@@ -128,12 +131,8 @@ public class BlockRift extends Block implements ITileEntityProvider
|
||||
public int getRenderType()
|
||||
{
|
||||
// This doesn't do anything yet
|
||||
if (mod_pocketDim.isPlayerWearingGoogles)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return 8;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the given side of this block type should be rendered, if the adjacent block is at the given
|
||||
@@ -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,8 @@ public class BlockRift extends Block implements ITileEntityProvider
|
||||
{
|
||||
if (random.nextInt(MAX_BLOCK_DESTRUCTION_CHANCE) < BLOCK_DESTRUCTION_CHANCE)
|
||||
{
|
||||
dropWorldThread(world.getBlockId(target.getX(), target.getY(), target.getZ()), world, x, y, z, random);
|
||||
world.destroyBlock(target.getX(), target.getY(), target.getZ(), false);
|
||||
dropWorldThread(world.getBlock(target.getX(), target.getY(), target.getZ()), world, x, y, z, random);
|
||||
world.func_147480_a(target.getX(), target.getY(), target.getZ(), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -231,12 +230,11 @@ public class BlockRift extends Block implements ITileEntityProvider
|
||||
return targets;
|
||||
}
|
||||
|
||||
public void dropWorldThread(int blockID, World world, int x, int y, int z, Random random)
|
||||
public void dropWorldThread(Block block, World world, int x, int y, int z, Random random)
|
||||
{
|
||||
if (blockID != 0 && (random.nextInt(MAX_WORLD_THREAD_DROP_CHANCE) < properties.WorldThreadDropChance)
|
||||
&& !(Block.blocksList[blockID] instanceof BlockFlowing ||
|
||||
Block.blocksList[blockID] instanceof BlockFluid ||
|
||||
Block.blocksList[blockID] instanceof IFluidBlock))
|
||||
if (!block.isAir(world, x, y, z) && (random.nextInt(MAX_WORLD_THREAD_DROP_CHANCE) < properties.WorldThreadDropChance)
|
||||
&& !(block instanceof BlockLiquid ||
|
||||
block instanceof IFluidBlock))
|
||||
{
|
||||
ItemStack thread = new ItemStack(mod_pocketDim.itemWorldThread, 1);
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, thread));
|
||||
@@ -265,7 +263,8 @@ public class BlockRift extends Block implements ITileEntityProvider
|
||||
|
||||
public boolean spreadRift(NewDimData dimension, DimLink parent, World world, Random random)
|
||||
{
|
||||
int x, y, z, blockID;
|
||||
int x, y, z;
|
||||
Block block = null;
|
||||
Point4D source = parent.source();
|
||||
|
||||
// Find reachable blocks that are vulnerable to rift damage and include air
|
||||
@@ -281,11 +280,11 @@ public class BlockRift extends Block implements ITileEntityProvider
|
||||
z = target.getZ();
|
||||
|
||||
// Create a child, replace the block with a rift, and consider dropping World Thread
|
||||
blockID = world.getBlockId(x, y, z);
|
||||
if (world.setBlock(x, y, z, properties.RiftBlockID))
|
||||
block = world.getBlock(x, y, z);
|
||||
if (world.setBlock(x, y, z, mod_pocketDim.blockRift))
|
||||
{
|
||||
dimension.createChildLink(x, y, z, parent);
|
||||
dropWorldThread(blockID, world, x, y, z, random);
|
||||
dropWorldThread(block, world, x, y, z, random);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -314,14 +313,13 @@ 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())
|
||||
{
|
||||
//renders an extra little blob on top of the actual rift location so its easier to find. Eventually will only render if the player has the goggles.
|
||||
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new GoggleRiftFX(world,x+.5, y+.5, z+.5, rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D, FMLClientHandler.instance().getClient().effectRenderer));
|
||||
}
|
||||
|
||||
if(tile.shouldClose)
|
||||
{
|
||||
//renders an opposite color effect if it is being closed by the rift remover
|
||||
@@ -335,14 +333,14 @@ public class BlockRift extends Block implements ITileEntityProvider
|
||||
{
|
||||
if (world != null && !isBlockImmune(world, x, y, z))
|
||||
{
|
||||
return world.setBlock(x, y, z, mod_pocketDim.blockRift.blockID);
|
||||
return world.setBlock(x, y, z, mod_pocketDim.blockRift);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isBlockImmune(World world, int x, int y, int z)
|
||||
{
|
||||
Block block = Block.blocksList[world.getBlockId(x, y, z)];
|
||||
Block block = world.getBlock(x, y, z);
|
||||
if (block != null)
|
||||
{
|
||||
// SenseiKiwi: I've switched to using the block's blast resistance instead of its
|
||||
@@ -352,8 +350,8 @@ public class BlockRift extends Block implements ITileEntityProvider
|
||||
// I've set this to access blockResistance directly. Might need changing later.
|
||||
|
||||
return (block.blockResistance >= MIN_IMMUNE_RESISTANCE ||
|
||||
modBlocksImmuneToRift.contains(block.blockID) ||
|
||||
blocksImmuneToRift.contains(block.blockID));
|
||||
modBlocksImmuneToRift.contains(block) ||
|
||||
blocksImmuneToRift.contains(block));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -362,41 +360,41 @@ public class BlockRift extends Block implements ITileEntityProvider
|
||||
{
|
||||
// Check whether the block at the specified location is one of the
|
||||
// rift-resistant blocks from DD.
|
||||
Block block = Block.blocksList[world.getBlockId(x, y, z)];
|
||||
Block block = world.getBlock(x, y, z);
|
||||
if (block != null)
|
||||
{
|
||||
return modBlocksImmuneToRift.contains(block.blockID);
|
||||
return modBlocksImmuneToRift.contains(block);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int idPicked(World par1World, int par2, int par3, int par4)
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player)
|
||||
{
|
||||
return 0;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int idDropped(int par1, Random par2Random, int par3)
|
||||
public Item getItemDropped(int par1, Random par2Random, int par3)
|
||||
{
|
||||
return 0;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world)
|
||||
public TileEntity createNewTileEntity(World world, int metadata)
|
||||
{
|
||||
return new TileEntityRift();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, int oldBlockID, int oldMeta)
|
||||
public void breakBlock(World world, int x, int y, int z, Block oldBlock, int oldMeta)
|
||||
{
|
||||
// This function runs on the server side after a block is replaced
|
||||
// We MUST call super.breakBlock() since it involves removing tile entities
|
||||
super.breakBlock(world, x, y, z, oldBlockID, oldMeta);
|
||||
super.breakBlock(world, x, y, z, oldBlock, oldMeta);
|
||||
|
||||
// Schedule rift regeneration for this block if it was changed
|
||||
if (world.getBlockId(x, y, z) != oldBlockID)
|
||||
if (world.getBlock(x, y, z) != oldBlock)
|
||||
{
|
||||
mod_pocketDim.riftRegenerator.scheduleSlowRegeneration(x, y, z, world);
|
||||
}
|
||||
|
||||
@@ -12,15 +12,15 @@ import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||
|
||||
public class DimensionalDoor extends BaseDimDoor
|
||||
{
|
||||
public DimensionalDoor(int blockID, Material material, DDProperties properties)
|
||||
public DimensionalDoor(Material material, DDProperties properties)
|
||||
{
|
||||
super(blockID, material, properties);
|
||||
super(material, properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void placeLink(World world, int x, int y, int z)
|
||||
{
|
||||
if (!world.isRemote && world.getBlockId(x, y - 1, z) == this.blockID)
|
||||
if (!world.isRemote && world.getBlock(x, y - 1, z) == this)
|
||||
{
|
||||
NewDimData dimension = PocketManager.createDimensionData(world);
|
||||
DimLink link = dimension.getLink(x, y, z);
|
||||
@@ -32,14 +32,8 @@ public class DimensionalDoor extends BaseDimDoor
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDoorItem()
|
||||
public Item getDoorItem()
|
||||
{
|
||||
return mod_pocketDim.itemDimensionalDoor.itemID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDrops()
|
||||
{
|
||||
return Item.doorIron.itemID;
|
||||
return mod_pocketDim.itemDimensionalDoor;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package StevenDimDoors.mod_pocketDim.blocks;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -25,9 +26,7 @@ public interface IDimDoor
|
||||
*/
|
||||
public void placeLink(World world, int x, int y, int z);
|
||||
|
||||
public int getDrops();
|
||||
|
||||
public int getDoorItem();
|
||||
public Item getDoorItem();
|
||||
|
||||
public TileEntity initDoorTE(World world, int x, int y, int z);
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package StevenDimDoors.mod_pocketDim.blocks;
|
||||
|
||||
import StevenDimDoors.mod_pocketDim.world.PersonalPocketProvider;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.world.World;
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
import StevenDimDoors.mod_pocketDim.config.DDProperties;
|
||||
@@ -12,36 +14,33 @@ import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||
public class PersonalDimDoor extends BaseDimDoor
|
||||
{
|
||||
|
||||
public PersonalDimDoor(int blockID, Material material, DDProperties properties)
|
||||
public PersonalDimDoor(Material material, DDProperties properties)
|
||||
{
|
||||
super(blockID, material, properties);
|
||||
super( material, properties);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public void placeLink(World world, int x, int y, int z)
|
||||
{
|
||||
if (!world.isRemote && world.getBlockId(x, y - 1, z) == this.blockID)
|
||||
if (!world.isRemote && world.getBlock(x, y - 1, z) == this)
|
||||
{
|
||||
NewDimData dimension = PocketManager.getDimensionData(world);
|
||||
DimLink link = dimension.getLink(x, y, z);
|
||||
if (link == null)
|
||||
{
|
||||
if (world.provider instanceof PersonalPocketProvider)
|
||||
dimension.createLink(x, y, z, LinkType.LIMBO, world.getBlockMetadata(x, y-1, z));
|
||||
else
|
||||
dimension.createLink(x, y, z, LinkType.PERSONAL, world.getBlockMetadata(x, y - 1, z));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDrops()
|
||||
public Item getDoorItem()
|
||||
{
|
||||
return mod_pocketDim.itemQuartzDoor.itemID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDoorItem()
|
||||
{
|
||||
return mod_pocketDim.itemPersonalDoor.itemID;
|
||||
return mod_pocketDim.itemPersonalDoor;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,11 +9,15 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockTrapDoor;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
import StevenDimDoors.mod_pocketDim.core.DDTeleporter;
|
||||
@@ -27,14 +31,14 @@ import StevenDimDoors.mod_pocketDim.tileentities.TileEntityTransTrapdoor;
|
||||
public class TransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntityProvider
|
||||
{
|
||||
|
||||
public TransTrapdoor(int blockID, Material material)
|
||||
public TransTrapdoor(Material material)
|
||||
{
|
||||
super(blockID, material);
|
||||
super(material);
|
||||
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IconRegister par1IconRegister)
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister)
|
||||
{
|
||||
this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName());
|
||||
}
|
||||
@@ -92,20 +96,20 @@ public class TransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntit
|
||||
{
|
||||
if(this.checkCanOpen(par1World, par2, par3, par4))
|
||||
{
|
||||
super.onPoweredBlockChange(par1World, par2, par3, par4, par5);
|
||||
super.func_150120_a(par1World, par2, par3, par4, par5);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void enterDimDoor(World world, int x, int y, int z, Entity entity)
|
||||
{
|
||||
if (!world.isRemote && isTrapdoorOpen(world.getBlockMetadata(x, y, z)))
|
||||
if (!world.isRemote && func_150118_d(world.getBlockMetadata(x, y, z)))
|
||||
{
|
||||
DimLink link = PocketManager.getLink(x, y, z, world);
|
||||
if (link != null)
|
||||
if (link != null && (link.linkType() != LinkType.PERSONAL || entity instanceof EntityPlayer))
|
||||
{
|
||||
DDTeleporter.traverseDimDoor(world, link, entity,this);
|
||||
}
|
||||
super.onPoweredBlockChange(world, x, y, z, false);
|
||||
super.func_150120_a(world, x, y, z, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,11 +117,11 @@ public class TransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntit
|
||||
public void onBlockAdded(World world, int x, int y, int z)
|
||||
{
|
||||
this.placeLink(world, x, y, z);
|
||||
world.setBlockTileEntity(x, y, z, this.createNewTileEntity(world));
|
||||
world.setTileEntity(x, y, z, this.createNewTileEntity(world, world.getBlockMetadata(x, y, z)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world)
|
||||
public TileEntity createNewTileEntity(World world, int metadata)
|
||||
{
|
||||
return new TileEntityTransTrapdoor();
|
||||
}
|
||||
@@ -138,27 +142,21 @@ public class TransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntit
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int idPicked(World world, int x, int y, int z)
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player)
|
||||
{
|
||||
return this.getDoorItem();
|
||||
return new ItemStack(this.getDoorItem(), 1, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int idDropped(int metadata, Random random, int fortuneLevel)
|
||||
public Item getItemDropped(int metadata, Random random, int fortuneLevel)
|
||||
{
|
||||
return this.getDrops();
|
||||
return Item.getItemFromBlock(Blocks.trapdoor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDoorItem()
|
||||
public Item getDoorItem()
|
||||
{
|
||||
return mod_pocketDim.transTrapdoor.blockID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDrops()
|
||||
{
|
||||
return Block.trapdoor.blockID;
|
||||
return Item.getItemFromBlock(mod_pocketDim.transTrapdoor);
|
||||
}
|
||||
|
||||
public static boolean isTrapdoorSetLow(int metadata)
|
||||
@@ -169,8 +167,8 @@ public class TransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntit
|
||||
@Override
|
||||
public TileEntity initDoorTE(World world, int x, int y, int z)
|
||||
{
|
||||
TileEntity te = this.createNewTileEntity(world);
|
||||
world.setBlockTileEntity(x, y, z, te);
|
||||
TileEntity te = this.createNewTileEntity(world, world.getBlockMetadata(x, y, z));
|
||||
world.setTileEntity(x, y, z, te);
|
||||
return te;
|
||||
}
|
||||
|
||||
@@ -181,14 +179,14 @@ public class TransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntit
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, int oldBlockID, int oldMeta)
|
||||
public void breakBlock(World world, int x, int y, int z, Block oldBlock, int oldMeta)
|
||||
{
|
||||
// This function runs on the server side after a block is replaced
|
||||
// We MUST call super.breakBlock() since it involves removing tile entities
|
||||
super.breakBlock(world, x, y, z, oldBlockID, oldMeta);
|
||||
super.breakBlock(world, x, y, z, oldBlock, oldMeta);
|
||||
|
||||
// Schedule rift regeneration for this block if it was replaced
|
||||
if (world.getBlockId(x, y, z) != oldBlockID)
|
||||
if (world.getBlock(x, y, z) != oldBlock)
|
||||
{
|
||||
mod_pocketDim.riftRegenerator.scheduleFastRegeneration(x, y, z, world);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package StevenDimDoors.mod_pocketDim.blocks;
|
||||
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import StevenDimDoors.mod_pocketDim.config.DDProperties;
|
||||
@@ -15,9 +17,9 @@ import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||
|
||||
public class TransientDoor extends BaseDimDoor
|
||||
{
|
||||
public TransientDoor(int blockID, Material material, DDProperties properties)
|
||||
public TransientDoor(Material material, DDProperties properties)
|
||||
{
|
||||
super(blockID, material, properties);
|
||||
super(material, properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -30,7 +32,7 @@ public class TransientDoor extends BaseDimDoor
|
||||
}
|
||||
|
||||
// Check that this is the top block of the door
|
||||
if (world.getBlockId(x, y - 1, z) == this.blockID)
|
||||
if (world.getBlock(x, y - 1, z) == this)
|
||||
{
|
||||
boolean canUse = true;
|
||||
int metadata = world.getBlockMetadata(x, y - 1, z);
|
||||
@@ -45,15 +47,17 @@ public class TransientDoor extends BaseDimDoor
|
||||
DimLink link = PocketManager.getLink(x, y, z, world.provider.dimensionId);
|
||||
if (link != null)
|
||||
{
|
||||
if (link.linkType() != LinkType.PERSONAL || entity instanceof EntityPlayer) {
|
||||
DDTeleporter.traverseDimDoor(world, link, entity, this);
|
||||
// Turn the door into a rift AFTER teleporting the player.
|
||||
// The door's orientation may be necessary for the teleport.
|
||||
world.setBlock(x, y, z, properties.RiftBlockID);
|
||||
world.setBlock(x, y, z, mod_pocketDim.blockRift);
|
||||
world.setBlockToAir(x, y - 1, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (world.getBlockId(x, y + 1, z) == this.blockID)
|
||||
}
|
||||
else if (world.getBlock(x, y + 1, z) == this)
|
||||
{
|
||||
enterDimDoor(world, x, y + 1, z, entity);
|
||||
}
|
||||
@@ -62,7 +66,7 @@ public class TransientDoor extends BaseDimDoor
|
||||
@Override
|
||||
public void placeLink(World world, int x, int y, int z)
|
||||
{
|
||||
if (!world.isRemote && world.getBlockId(x, y - 1, z) == this.blockID)
|
||||
if (!world.isRemote && world.getBlock(x, y - 1, z) == this)
|
||||
{
|
||||
NewDimData dimension = PocketManager.createDimensionData(world);
|
||||
DimLink link = dimension.getLink(x, y, z);
|
||||
@@ -74,15 +78,9 @@ public class TransientDoor extends BaseDimDoor
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDoorItem()
|
||||
public Item getDoorItem()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDrops()
|
||||
{
|
||||
return 0;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package StevenDimDoors.mod_pocketDim.blocks;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
import StevenDimDoors.mod_pocketDim.config.DDProperties;
|
||||
@@ -9,17 +11,20 @@ import StevenDimDoors.mod_pocketDim.core.LinkType;
|
||||
import StevenDimDoors.mod_pocketDim.core.NewDimData;
|
||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
public class UnstableDoor extends BaseDimDoor
|
||||
{
|
||||
public UnstableDoor(int blockID, Material material, DDProperties properties)
|
||||
public UnstableDoor(Material material, DDProperties properties)
|
||||
{
|
||||
super(blockID, material, properties);
|
||||
super(material, properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void placeLink(World world, int x, int y, int z)
|
||||
{
|
||||
if (!world.isRemote && world.getBlockId(x, y - 1, z) == this.blockID)
|
||||
if (!world.isRemote && world.getBlock(x, y - 1, z) == this)
|
||||
{
|
||||
NewDimData dimension = PocketManager.getDimensionData(world);
|
||||
dimension.createLink(x, y, z, LinkType.RANDOM,world.getBlockMetadata(x, y - 1, z));
|
||||
@@ -27,14 +32,14 @@ public class UnstableDoor extends BaseDimDoor
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDoorItem()
|
||||
public Item getDoorItem()
|
||||
{
|
||||
return mod_pocketDim.itemUnstableDoor.itemID;
|
||||
return mod_pocketDim.itemUnstableDoor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDrops()
|
||||
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
|
||||
{
|
||||
return Item.doorIron.itemID;
|
||||
return Items.iron_door;
|
||||
}
|
||||
}
|
||||
@@ -12,15 +12,15 @@ import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||
|
||||
public class WarpDoor extends BaseDimDoor
|
||||
{
|
||||
public WarpDoor(int blockID, Material material, DDProperties properties)
|
||||
public WarpDoor(Material material, DDProperties properties)
|
||||
{
|
||||
super(blockID, material, properties);
|
||||
super(material, properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void placeLink(World world, int x, int y, int z)
|
||||
{
|
||||
if (!world.isRemote && world.getBlockId(x, y - 1, z) == this.blockID)
|
||||
if (!world.isRemote && world.getBlock(x, y - 1, z) == this)
|
||||
{
|
||||
NewDimData dimension = PocketManager.createDimensionData(world);
|
||||
DimLink link = dimension.getLink(x, y, z);
|
||||
@@ -32,14 +32,8 @@ public class WarpDoor extends BaseDimDoor
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDoorItem()
|
||||
public Item getDoorItem()
|
||||
{
|
||||
return mod_pocketDim.itemWarpDoor.itemID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDrops()
|
||||
{
|
||||
return Item.doorWood.itemID;
|
||||
return mod_pocketDim.itemWarpDoor;
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) == mod_pocketDim.blockRift)
|
||||
{
|
||||
// Remove the rift and its link
|
||||
world.setBlockToAir(x, y, z);
|
||||
|
||||
@@ -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 = MinecraftServer.getServer().getConfigurationManager().func_152612_a(command[0]);
|
||||
if (targetPlayer == null)
|
||||
{
|
||||
return DDCommandResult.PLAYER_OFFLINE;
|
||||
|
||||
@@ -4,7 +4,7 @@ import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.ICommand;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ChatMessageComponent;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
|
||||
/*
|
||||
* An abstract base class for our Dimensional Doors commands. This cleans up the code a little and provides
|
||||
@@ -85,9 +85,8 @@ public abstract class DDCommandBase extends CommandBase
|
||||
|
||||
public static void sendChat(EntityPlayer player, String message)
|
||||
{
|
||||
ChatMessageComponent cmp = new ChatMessageComponent();
|
||||
cmp.addText(message);
|
||||
player.sendChatToPlayer(cmp);
|
||||
ChatComponentText text = new ChatComponentText(message);
|
||||
player.addChatMessage(text);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -2,56 +2,14 @@ package StevenDimDoors.mod_pocketDim.config;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import StevenDimDoors.mod_pocketDim.blocks.BlockRift;
|
||||
import StevenDimDoors.mod_pocketDim.ticking.CustomLimboPopulator;
|
||||
import StevenDimDoors.mod_pocketDim.world.fortresses.DDStructureNetherBridgeStart;
|
||||
import StevenDimDoors.mod_pocketDim.world.gateways.GatewayGenerator;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
public class DDProperties
|
||||
{
|
||||
/**
|
||||
* Block IDs
|
||||
*/
|
||||
|
||||
public final int UnstableDoorID;
|
||||
public final int DimensionalDoorID;
|
||||
public final int GoldenDoorID;
|
||||
public final int GoldenDimensionalDoorID;
|
||||
public final int WarpDoorID;
|
||||
public final int TransTrapdoorID;
|
||||
public final int TransientDoorID;
|
||||
public final int FabricBlockID;
|
||||
public final int RiftBlockID;
|
||||
public final int QuartzDoorID;
|
||||
public final int PersonalDimDoorID;
|
||||
|
||||
|
||||
/**
|
||||
* World Generation Block IDs
|
||||
*/
|
||||
|
||||
public final int LimboBlockID;
|
||||
public final int PermaFabricBlockID;
|
||||
|
||||
/**
|
||||
* Item IDs
|
||||
*/
|
||||
|
||||
public final int RiftBladeItemID;
|
||||
public final int RiftSignatureItemID;
|
||||
public final int GoldenDimensionalDoorItemID;
|
||||
public final int GoldenDoorItemID;
|
||||
public final int RiftRemoverItemID;
|
||||
public final int StableFabricItemID;
|
||||
public final int StabilizedRiftSignatureItemID;
|
||||
public final int DimensionalDoorItemID;
|
||||
public final int UnstableDoorItemID;
|
||||
public final int WarpDoorItemID;
|
||||
public final int WorldThreadItemID;
|
||||
public final int DDKeyItemID;
|
||||
public final int ItemQuartzDoorID;
|
||||
public final int ItemPersonalDimDoorID;
|
||||
|
||||
/**
|
||||
* Other IDs
|
||||
@@ -106,7 +64,7 @@ public class DDProperties
|
||||
public final boolean DoorRenderingEnabled;
|
||||
public final boolean TNFREAKINGT_Enabled;
|
||||
public final boolean MonolithTeleportationEnabled;
|
||||
|
||||
public final boolean DangerousLimboMonolithsDisabled;
|
||||
|
||||
/**
|
||||
* Other
|
||||
@@ -123,7 +81,6 @@ public class DDProperties
|
||||
public final int WorldThreadRequirementLevel;
|
||||
public final String CustomSchematicDirectory;
|
||||
|
||||
|
||||
//Singleton instance
|
||||
private static DDProperties instance = null;
|
||||
//Path for custom dungeons within configuration directory
|
||||
@@ -195,38 +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();
|
||||
LimboProviderID = config.get(CATEGORY_PROVIDER, "Limbo Provider ID", 113).getInt();
|
||||
@@ -235,6 +160,9 @@ public class DDProperties
|
||||
MonolithTeleportationEnabled = config.get(Configuration.CATEGORY_GENERAL, "Enable Monolith Teleportation", true,
|
||||
"Sets whether Monoliths can teleport players").getBoolean(true);
|
||||
|
||||
DangerousLimboMonolithsDisabled = config.get(Configuration.CATEGORY_GENERAL, "Docile Monoliths in Limbo", true,
|
||||
"Sets whether monoliths in Limbo stare at the player rather than attack").getBoolean(true);
|
||||
|
||||
MonolithSpawningChance = config.get(Configuration.CATEGORY_GENERAL, "Monolith Spawning Chance", 28,
|
||||
"Sets the chance (out of " + CustomLimboPopulator.MAX_MONOLITH_SPAWNING_CHANCE + ") that Monoliths will " +
|
||||
"spawn in a given Limbo chunk. The default chance is 28.").getInt();
|
||||
@@ -256,17 +184,9 @@ public class DDProperties
|
||||
"drop World Thread when it destroys a block. The default chance is 50.").getInt();
|
||||
|
||||
LimboBiomeID = config.get(CATEGORY_BIOME, "Limbo Biome ID", 148).getInt();
|
||||
PocketBiomeID = config.get(CATEGORY_BIOME, "Pocket Biome ID", 149).getInt();
|
||||
PocketBiomeID = config.get(CATEGORY_BIOME, "Pocket Biome ID", 147).getInt();
|
||||
|
||||
config.save();
|
||||
|
||||
// Unfortunately, there are users out there who have been misconfiguring the worldgen blocks to have IDs above 255.
|
||||
// This leads to disastrous and cryptic errors in other areas of Minecraft. To prevent headaches, we'll throw
|
||||
// an exception here if the blocks have invalid IDs.
|
||||
if (LimboBlockID > 255 || PermaFabricBlockID > 255)
|
||||
{
|
||||
throw new IllegalStateException("World generation blocks MUST have block IDs less than 256. Fix your configuration!");
|
||||
}
|
||||
}
|
||||
|
||||
public static DDProperties initialize(File configFile)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package StevenDimDoors.mod_pocketDim.config;
|
||||
|
||||
import java.io.File;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import java.io.File;
|
||||
|
||||
public class DDWorldProperties
|
||||
{
|
||||
|
||||
@@ -2,17 +2,22 @@ package StevenDimDoors.mod_pocketDim.core;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import StevenDimDoors.mod_pocketDim.world.LimboProvider;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
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.network.play.server.S07PacketRespawn;
|
||||
import net.minecraft.network.play.server.S1DPacketEntityEffect;
|
||||
import net.minecraft.network.play.server.S1FPacketSetExperience;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
@@ -59,8 +64,8 @@ public class DDTeleporter
|
||||
int x = destination.getX();
|
||||
int y = destination.getY();
|
||||
int z = destination.getZ();
|
||||
int blockIDTop;
|
||||
int blockIDBottom;
|
||||
Block blockTop;
|
||||
Block blockBottom;
|
||||
Point3D point;
|
||||
|
||||
switch (orientation)
|
||||
@@ -81,19 +86,19 @@ public class DDTeleporter
|
||||
point = new Point3D(x, y - 1, z);
|
||||
break;
|
||||
}
|
||||
blockIDBottom = world.getBlockId(point.getX(), point.getY(), point.getZ());
|
||||
blockIDTop = world.getBlockId(point.getX(), point.getY() + 1, point.getZ());
|
||||
blockBottom = world.getBlock(point.getX(), point.getY(), point.getZ());
|
||||
blockTop = world.getBlock(point.getX(), point.getY() + 1, point.getZ());
|
||||
|
||||
if (Block.blocksList[blockIDBottom] != null)
|
||||
if (blockBottom != null)
|
||||
{
|
||||
if (!Block.blocksList[blockIDBottom].isBlockReplaceable(world, point.getX(), point.getY(), point.getZ()) && world.isBlockOpaqueCube(point.getX(), point.getY(), point.getZ()))
|
||||
if (!blockBottom.isReplaceable(world, point.getX(), point.getY(), point.getZ()) && world.isBlockNormalCubeDefault(point.getX(), point.getY(), point.getZ(), false))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (Block.blocksList[blockIDTop] != null)
|
||||
if (blockTop != null)
|
||||
{
|
||||
if (!Block.blocksList[blockIDTop].isBlockReplaceable(world, point.getX(), point.getY() + 1, point.getZ()))
|
||||
if (!blockTop.isReplaceable(world, point.getX(), point.getY() + 1, point.getZ()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -221,7 +226,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 +302,7 @@ 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()));
|
||||
player.playerNetServerHandler.sendPacket(new S07PacketRespawn(player.dimension, player.worldObj.difficultySetting, newWorld.getWorldInfo().getTerrainType(), player.theItemInWorldManager.getGameType()));
|
||||
|
||||
// GreyMaria: Used the safe player entity remover before.
|
||||
// This should fix an apparently unreported bug where
|
||||
@@ -320,10 +325,10 @@ public class DDTeleporter
|
||||
for(Object potionEffect : player.getActivePotionEffects())
|
||||
{
|
||||
PotionEffect effect = (PotionEffect)potionEffect;
|
||||
player.playerNetServerHandler.sendPacketToPlayer(new Packet41EntityEffect(player.entityId, effect));
|
||||
player.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(player.getEntityId(), effect));
|
||||
}
|
||||
|
||||
player.playerNetServerHandler.sendPacketToPlayer(new Packet43Experience(player.experience, player.experienceTotal, player.experienceLevel));
|
||||
player.playerNetServerHandler.sendPacket(new S1FPacketSetExperience(player.experience, player.experienceTotal, player.experienceLevel));
|
||||
}
|
||||
|
||||
// Creates sanity by removing the entity from its old location's chunk entity list, if applicable.
|
||||
@@ -383,7 +388,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);
|
||||
FMLCommonHandler.instance().firePlayerChangedDimensionEvent((EntityPlayer) entity, oldWorld.provider.dimensionId, newWorld.provider.dimensionId);
|
||||
}
|
||||
DDTeleporter.placeInPortal(entity, newWorld, destination, properties, checkOrientation);
|
||||
return entity;
|
||||
@@ -394,7 +399,7 @@ public class DDTeleporter
|
||||
* Also ensures correct orientation relative to the door.
|
||||
* @param world - world the player is currently in
|
||||
* @param link - the link the player is using to teleport; sends the player to its destination
|
||||
* @param player - the instance of the player to be teleported
|
||||
* @param entity - the instance of the player to be teleported
|
||||
*/
|
||||
public static void traverseDimDoor(World world, DimLink link, Entity entity, Block door)
|
||||
{
|
||||
@@ -502,6 +507,15 @@ public class DDTeleporter
|
||||
return generateDungeonExit(link, properties);
|
||||
case UNSAFE_EXIT:
|
||||
return generateUnsafeExit(link);
|
||||
case LIMBO:
|
||||
if(!(entity instanceof EntityPlayer))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Point4D dest = LimboProvider.getLimboSkySpawn((EntityPlayer)entity, DDProperties.instance());
|
||||
link.tail.setDestination(dest);
|
||||
return true;
|
||||
case NORMAL:
|
||||
case REVERSE:
|
||||
case RANDOM:
|
||||
@@ -511,14 +525,15 @@ public class DDTeleporter
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean setupPersonalLink(DimLink link, DDProperties properties,Entity player, Block door)
|
||||
private static boolean setupPersonalLink(DimLink link, DDProperties properties,Entity entity, Block door)
|
||||
{
|
||||
if(!(player instanceof EntityPlayer))
|
||||
if(!(entity instanceof EntityPlayer))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
NewDimData dim = PocketManager.getPersonalDimensionForPlayer(player.getEntityName());
|
||||
EntityPlayer player = (EntityPlayer)entity;
|
||||
NewDimData dim = PocketManager.getPersonalDimensionForPlayer(player.getGameProfile().getId().toString());
|
||||
if(dim == null)
|
||||
{
|
||||
return PocketBuilder.generateNewPersonalPocket(link, properties, player, door);
|
||||
@@ -527,10 +542,10 @@ public class DDTeleporter
|
||||
DimLink personalHomeLink = dim.getLink(dim.origin());
|
||||
if(personalHomeLink!=null)
|
||||
{
|
||||
link.tail.setDestination(personalHomeLink.source());
|
||||
PocketManager.getDimensionData(link.source().getDimension()).setLinkDestination(personalHomeLink, link.source().getX(), link.source().getY(), link.source().getZ());
|
||||
}
|
||||
|
||||
dim.setLinkDestination(link, dim.origin.getX(), dim.origin.getY(), dim.origin.getZ());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -602,7 +617,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 +625,11 @@ public class DDTeleporter
|
||||
return;
|
||||
}
|
||||
TileEntityDimDoor.class.cast(doorTE).hasGennedPair=true;
|
||||
Block blockToReplace = Block.blocksList[destWorld.getBlockId(link.destination().getX(), link.destination().getY(), link.destination().getZ())];
|
||||
Block blockToReplace = destWorld.getBlock(link.destination().getX(), link.destination().getY(), link.destination().getZ());
|
||||
|
||||
if(!destWorld.isAirBlock(link.destination().getX(), link.destination().getY(), link.destination().getZ()))
|
||||
{
|
||||
if(!blockToReplace.isBlockReplaceable(destWorld, link.destination().getX(), link.destination().getY(), link.destination().getZ()))
|
||||
if(!blockToReplace.isReplaceable(destWorld, link.destination().getX(), link.destination().getY(), link.destination().getZ()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -739,9 +754,9 @@ public class DDTeleporter
|
||||
// Checking if the block is not an opaque solid is equivalent
|
||||
// checking for a replaceable block, because we only allow
|
||||
// exits intersecting blocks on those two surfaces.
|
||||
if (!world.isBlockNormalCube(x + dx, y, z + dz))
|
||||
if (!world.isBlockNormalCubeDefault(x + dx, y, z + dz, false))
|
||||
{
|
||||
world.setBlock(x + dx, y, z + dz, properties.FabricBlockID, 0, 2);
|
||||
world.setBlock(x + dx, y, z + dz, mod_pocketDim.blockDimWall, 0, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -755,7 +770,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 +783,7 @@ public class DDTeleporter
|
||||
sourceDim.setLinkDestination(reverse, source.getX(), source.getY(), source.getZ());
|
||||
|
||||
// Set up the warp door at the destination
|
||||
orientation = BlockRotator.transformMetadata(orientation, 2, properties.WarpDoorID);
|
||||
orientation = BlockRotator.transformMetadata(orientation, 2, mod_pocketDim.warpDoor);
|
||||
ItemDoor.placeDoorBlock(world, x, y + 1, z, orientation, mod_pocketDim.warpDoor);
|
||||
|
||||
// Complete the link to the destination
|
||||
|
||||
@@ -14,6 +14,7 @@ public enum LinkType
|
||||
UNSAFE_EXIT(6),
|
||||
REVERSE(7),
|
||||
PERSONAL(8),
|
||||
LIMBO(9),
|
||||
CLIENT(-1337);
|
||||
|
||||
LinkType(int index)
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.util.Random;
|
||||
import java.util.Stack;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
import StevenDimDoors.mod_pocketDim.watcher.ClientLinkData;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.ChunkCoordIntPair;
|
||||
@@ -251,7 +252,7 @@ public abstract class NewDimData implements IPackable<PackedDimData>
|
||||
for (k = -range; k <= range; k++)
|
||||
{
|
||||
distance = getAbsoluteSum(i, j, k);
|
||||
if (distance > 0 && distance < minDistance && world.getBlockId(x + i, y + j, z + k) == properties.RiftBlockID)
|
||||
if (distance > 0 && distance < minDistance && world.getBlock(x + i, y + j, z + k) == mod_pocketDim.blockRift)
|
||||
{
|
||||
link = getLink(x + i, y + j, z + k);
|
||||
if (link != null)
|
||||
@@ -290,7 +291,7 @@ public abstract class NewDimData implements IPackable<PackedDimData>
|
||||
for (k = -range; k <= range; k++)
|
||||
{
|
||||
distance = getAbsoluteSum(i, j, k);
|
||||
if (distance > 0 && world.getBlockId(x + i, y + j, z + k) == properties.RiftBlockID)
|
||||
if (distance > 0 && world.getBlock(x + i, y + j, z + k) == mod_pocketDim.blockRift)
|
||||
{
|
||||
link = getLink(x + i, y + j, z + k);
|
||||
if (link != null)
|
||||
@@ -427,6 +428,7 @@ public abstract class NewDimData implements IPackable<PackedDimData>
|
||||
}
|
||||
|
||||
// Raise deletion event
|
||||
if (linkWatcher != null)
|
||||
linkWatcher.onDeleted(new ClientLinkData(link));
|
||||
target.clear();
|
||||
modified = true;
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package StevenDimDoors.mod_pocketDim.core;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -21,7 +18,6 @@ import StevenDimDoors.mod_pocketDim.saving.PackedDimData;
|
||||
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 StevenDimDoors.mod_pocketDim.watcher.UpdateWatcherProxy;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
@@ -60,13 +56,14 @@ public class PocketManager
|
||||
|
||||
}
|
||||
|
||||
private static class ClientLinkWatcher implements IUpdateWatcher<ClientLinkData>
|
||||
public static class ClientLinkWatcher implements IUpdateWatcher<ClientLinkData>
|
||||
{
|
||||
@Override
|
||||
public void onCreated(ClientLinkData link)
|
||||
{
|
||||
Point4D source = link.point;
|
||||
NewDimData dimension = getDimensionData(source.getDimension());
|
||||
if (dimension != null && dimension.getLink(source.getX(), source.getY(), source.getZ()) == null)
|
||||
dimension.createLink(source, LinkType.CLIENT, 0, link.lock);
|
||||
}
|
||||
|
||||
@@ -75,6 +72,7 @@ public class PocketManager
|
||||
{
|
||||
Point4D source = link.point;
|
||||
NewDimData dimension = getDimensionData(source.getDimension());
|
||||
if (dimension != null && dimension.getLink(source.getX(),source.getY(),source.getZ()) != null)
|
||||
dimension.deleteLink(source.getX(), source.getY(), source.getZ());
|
||||
}
|
||||
|
||||
@@ -83,13 +81,14 @@ public class PocketManager
|
||||
{
|
||||
Point4D source = link.point;
|
||||
NewDimData dimension = getDimensionData(source.getDimension());
|
||||
if (dimension != null) {
|
||||
DimLink dLink = dimension.getLink(source);
|
||||
dLink.lock = link.lock;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class ClientDimWatcher implements IUpdateWatcher<ClientDimData>
|
||||
public static class ClientDimWatcher implements IUpdateWatcher<ClientDimData>
|
||||
{
|
||||
@Override
|
||||
public void onCreated(ClientDimData data)
|
||||
@@ -508,8 +507,7 @@ public class PocketManager
|
||||
*
|
||||
* @param dimensionID
|
||||
* @param parent
|
||||
* @param isPocket
|
||||
* @param isDungeon
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
private static NewDimData registerDimension(int dimensionID, InnerDimData parent, DimensionType type)
|
||||
@@ -571,7 +569,10 @@ public class PocketManager
|
||||
// unfortuantly. I send the dimdata to the client when they
|
||||
// teleport.
|
||||
// Steven
|
||||
DimensionManager.registerDimension(dimensionID, mod_pocketDim.properties.PocketProviderID);
|
||||
int providerID = mod_pocketDim.properties.PocketProviderID;
|
||||
if (type == DimensionType.PERSONAL)
|
||||
providerID = mod_pocketDim.properties.PersonalPocketProviderID;
|
||||
DimensionManager.registerDimension(dimensionID,providerID);
|
||||
}
|
||||
return dimension;
|
||||
}
|
||||
@@ -628,6 +629,13 @@ public class PocketManager
|
||||
return (ArrayList<NewDimData>) rootDimensions.clone();
|
||||
}
|
||||
|
||||
public static void tryUnload() {
|
||||
if (isConnected)
|
||||
unload();
|
||||
isLoading = false;
|
||||
isLoaded = false;
|
||||
}
|
||||
|
||||
public static void unload()
|
||||
{
|
||||
System.out.println("Unloading Pocket Dimensions...");
|
||||
@@ -689,12 +697,7 @@ public class PocketManager
|
||||
return linkWatcher.unregisterReceiver(watcher);
|
||||
}
|
||||
|
||||
public static void getWatchers(IUpdateSource updateSource)
|
||||
{
|
||||
updateSource.registerWatchers(new ClientDimWatcher(), new ClientLinkWatcher());
|
||||
}
|
||||
|
||||
public static void writePacket(DataOutputStream output) throws IOException
|
||||
public static void writePacket(DataOutput output) throws IOException
|
||||
{
|
||||
// Write a very compact description of our dimensions and links to be
|
||||
// sent to a client
|
||||
@@ -716,7 +719,7 @@ public class PocketManager
|
||||
}
|
||||
}
|
||||
|
||||
public static void readPacket(DataInputStream input) throws IOException
|
||||
public static void readPacket(DataInput input) throws IOException
|
||||
{
|
||||
// TODO- figure out why this is getting called so frequently
|
||||
if (isLoaded)
|
||||
|
||||
@@ -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;
|
||||
@@ -36,15 +39,6 @@ import StevenDimDoors.mod_pocketDim.util.Point4D;
|
||||
|
||||
public class DungeonSchematic extends Schematic {
|
||||
|
||||
private static final short MAX_VANILLA_BLOCK_ID = 173;
|
||||
private static final short STANDARD_FABRIC_OF_REALITY_ID = 1973;
|
||||
private static final short STANDARD_ETERNAL_FABRIC_ID = 220;
|
||||
private static final short STANDARD_WARP_DOOR_ID = 1975;
|
||||
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 int NETHER_DIMENSION_ID = -1;
|
||||
|
||||
private int orientation;
|
||||
@@ -52,18 +46,17 @@ public class DungeonSchematic extends Schematic {
|
||||
private ArrayList<Point3D> exitDoorLocations;
|
||||
private ArrayList<Point3D> dimensionalDoorLocations;
|
||||
private ArrayList<Point3D> monolithSpawnLocations;
|
||||
|
||||
private static final short[] MOD_BLOCK_FILTER_EXCEPTIONS = new short[] {
|
||||
STANDARD_FABRIC_OF_REALITY_ID,
|
||||
STANDARD_ETERNAL_FABRIC_ID,
|
||||
STANDARD_WARP_DOOR_ID,
|
||||
STANDARD_DIMENSIONAL_DOOR_ID,
|
||||
STANDARD_TRANSIENT_DOOR_ID
|
||||
};
|
||||
private ArrayList<Block> modBlockFilterExceptions;
|
||||
|
||||
private DungeonSchematic(Schematic source)
|
||||
{
|
||||
super(source);
|
||||
modBlockFilterExceptions = new ArrayList<Block>(5);
|
||||
modBlockFilterExceptions.add(mod_pocketDim.blockDimWall);
|
||||
modBlockFilterExceptions.add(mod_pocketDim.blockDimWallPerm);
|
||||
modBlockFilterExceptions.add(mod_pocketDim.warpDoor);
|
||||
modBlockFilterExceptions.add(mod_pocketDim.dimensionalDoor);
|
||||
modBlockFilterExceptions.add(mod_pocketDim.transientDoor);
|
||||
}
|
||||
|
||||
public int getOrientation()
|
||||
@@ -108,12 +101,12 @@ public class DungeonSchematic extends Schematic {
|
||||
public void applyImportFilters(DDProperties properties)
|
||||
{
|
||||
//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);
|
||||
SpecialBlockFinder finder = new SpecialBlockFinder(mod_pocketDim.warpDoor, mod_pocketDim.dimensionalDoor,
|
||||
Blocks.end_portal_frame, Blocks.sandstone);
|
||||
applyFilter(finder);
|
||||
|
||||
//Flip the entrance's orientation to get the dungeon's orientation
|
||||
orientation = BlockRotator.transformMetadata(finder.getEntranceOrientation(), 2, Block.doorWood.blockID);
|
||||
orientation = BlockRotator.transformMetadata(finder.getEntranceOrientation(), 2, Blocks.wooden_door);
|
||||
|
||||
entranceDoorLocation = finder.getEntranceDoorLocation();
|
||||
exitDoorLocations = finder.getExitDoorLocations();
|
||||
@@ -122,19 +115,10 @@ 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));
|
||||
standardizer.addFilter(new ModBlockFilter(modBlockFilterExceptions,
|
||||
mod_pocketDim.blockDimWall, (byte) 0));
|
||||
|
||||
//Also convert standard DD block IDs to local versions
|
||||
Map<Short, Short> mapping = getAssignedToStandardIDMapping(properties);
|
||||
|
||||
for (Entry<Short, Short> entry : mapping.entrySet())
|
||||
{
|
||||
if (entry.getKey() != entry.getValue())
|
||||
{
|
||||
standardizer.addFilter(new ReplacementFilter(entry.getValue(), entry.getKey()));
|
||||
}
|
||||
}
|
||||
applyFilter(standardizer);
|
||||
}
|
||||
|
||||
@@ -143,36 +127,15 @@ 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);
|
||||
|
||||
for (Entry<Short, Short> entry : mapping.entrySet())
|
||||
{
|
||||
if (entry.getKey() != entry.getValue())
|
||||
{
|
||||
standardizer.addFilter(new ReplacementFilter(entry.getKey(), entry.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
//Filter out mod blocks except some of our own
|
||||
//This comes after ID standardization because the mod block filter relies on standardized IDs
|
||||
standardizer.addFilter(new ModBlockFilter(MAX_VANILLA_BLOCK_ID, MOD_BLOCK_FILTER_EXCEPTIONS,
|
||||
STANDARD_FABRIC_OF_REALITY_ID, (byte) 0));
|
||||
standardizer.addFilter(new ModBlockFilter(modBlockFilterExceptions,
|
||||
mod_pocketDim.blockDimWall, (byte) 0));
|
||||
|
||||
applyFilter(standardizer);
|
||||
}
|
||||
|
||||
private static Map<Short, Short> getAssignedToStandardIDMapping(DDProperties properties)
|
||||
{
|
||||
//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>();
|
||||
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;
|
||||
}
|
||||
|
||||
public static DungeonSchematic copyFromWorld(World world, int x, int y, int z, short width, short height, short length, boolean doCompactBounds)
|
||||
{
|
||||
return new DungeonSchematic(Schematic.copyFromWorld(world, x, y, z, width, height, length, doCompactBounds));
|
||||
@@ -203,7 +166,7 @@ public class DungeonSchematic extends Schematic {
|
||||
|
||||
int index;
|
||||
int count;
|
||||
int blockID;
|
||||
Block block;
|
||||
int blockMeta;
|
||||
int dx, dy, dz;
|
||||
Point3D pocketPoint = new Point3D(0, 0, 0);
|
||||
@@ -219,12 +182,12 @@ public class DungeonSchematic extends Schematic {
|
||||
pocketPoint.setX(dx);
|
||||
pocketPoint.setY(dy);
|
||||
pocketPoint.setZ(dz);
|
||||
blockID = blocks[index];
|
||||
block = blocks[index];
|
||||
BlockRotator.transformPoint(pocketPoint, entranceDoorLocation, turnAngle, pocketCenter);
|
||||
blockMeta = BlockRotator.transformMetadata(metadata[index], turnAngle, blockID);
|
||||
blockMeta = BlockRotator.transformMetadata(metadata[index], turnAngle, block);
|
||||
|
||||
//In the future, we might want to make this more efficient by building whole chunks at a time
|
||||
blockSetter.setBlock(world, pocketPoint.getX(), pocketPoint.getY(), pocketPoint.getZ(), blockID, blockMeta);
|
||||
blockSetter.setBlock(world, pocketPoint.getX(), pocketPoint.getY(), pocketPoint.getZ(), block, blockMeta);
|
||||
index++;
|
||||
}
|
||||
}
|
||||
@@ -233,7 +196,7 @@ public class DungeonSchematic extends Schematic {
|
||||
count = tileEntities.tagCount();
|
||||
for (index = 0; index < count; index++)
|
||||
{
|
||||
NBTTagCompound tileTag = (NBTTagCompound) tileEntities.tagAt(index);
|
||||
NBTTagCompound tileTag = (NBTTagCompound) tileEntities.getCompoundTagAt(index);
|
||||
//Rewrite its location to be in world coordinates
|
||||
pocketPoint.setX(tileTag.getInteger("x"));
|
||||
pocketPoint.setY(tileTag.getInteger("y"));
|
||||
@@ -243,7 +206,7 @@ public class DungeonSchematic extends Schematic {
|
||||
tileTag.setInteger("y", pocketPoint.getY());
|
||||
tileTag.setInteger("z", pocketPoint.getZ());
|
||||
//Load the tile entity and put it in the world
|
||||
world.setBlockTileEntity(pocketPoint.getX(), pocketPoint.getY(), pocketPoint.getZ(), TileEntity.createAndLoadEntity(tileTag));
|
||||
world.setTileEntity(pocketPoint.getX(), pocketPoint.getY(), pocketPoint.getZ(), TileEntity.createAndLoadEntity(tileTag));
|
||||
}
|
||||
|
||||
setUpDungeon(PocketManager.createDimensionData(world), world, pocketCenter, turnAngle, entryLink, random, properties, blockSetter);
|
||||
@@ -341,9 +304,9 @@ public class DungeonSchematic extends Schematic {
|
||||
int z = location.getZ();
|
||||
if (y >= 0)
|
||||
{
|
||||
int blockID = world.getBlockId(x, y, z);
|
||||
Block block = world.getBlock(x, y, z);
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
blockSetter.setBlock(world, x, y + 1, z, blockID, metadata);
|
||||
blockSetter.setBlock(world, x, y + 1, z, block, metadata);
|
||||
}
|
||||
initDoorTileEntity(world, location);
|
||||
}
|
||||
@@ -365,7 +328,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 +340,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 +358,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 +371,12 @@ public class DungeonSchematic extends Schematic {
|
||||
x = pocketCenter.getX() + dx;
|
||||
y = pocketCenter.getY() + dy;
|
||||
z = pocketCenter.getZ() + dz;
|
||||
block = world.getBlockId(x, y, z);
|
||||
if (block == Block.signWall.blockID || block == Block.signPost.blockID)
|
||||
block = world.getBlock(x, y, z);
|
||||
if (block == Blocks.wall_sign || block == Blocks.standing_sign)
|
||||
{
|
||||
TileEntitySign signEntity = new TileEntitySign();
|
||||
signEntity.signText[1] = "Level " + depth;
|
||||
world.setBlockTileEntity(x, y, z, signEntity);
|
||||
world.setTileEntity(x, y, z, signEntity);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 block = world.getBlock(x, y, z);
|
||||
|
||||
// Fill empty chests and dispensers
|
||||
if (Block.blocksList[blockID] instanceof BlockContainer)
|
||||
if (block instanceof BlockContainer)
|
||||
{
|
||||
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
// Fill chests
|
||||
if (tileEntity instanceof TileEntityChest)
|
||||
|
||||
@@ -3,40 +3,40 @@ package StevenDimDoors.mod_pocketDim.dungeon;
|
||||
import net.minecraft.block.Block;
|
||||
import StevenDimDoors.mod_pocketDim.schematic.SchematicFilter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ModBlockFilter extends SchematicFilter {
|
||||
|
||||
private short maxVanillaBlockID;
|
||||
private short[] exceptions;
|
||||
private short replacementBlockID;
|
||||
private List<Block> exceptions;
|
||||
private Block replacementBlock;
|
||||
private byte replacementMetadata;
|
||||
|
||||
public ModBlockFilter(short maxVanillaBlockID, short[] exceptions, short replacementBlockID, byte replacementMetadata)
|
||||
public ModBlockFilter(List<Block> exceptions, Block replacementBlock, byte replacementMetadata)
|
||||
{
|
||||
super("ModBlockFilter");
|
||||
this.maxVanillaBlockID = maxVanillaBlockID;
|
||||
this.exceptions = exceptions;
|
||||
this.replacementBlockID = replacementBlockID;
|
||||
this.replacementBlock = replacementBlock;
|
||||
this.replacementMetadata = replacementMetadata;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean applyToBlock(int index, short[] blocks, byte[] metadata)
|
||||
protected boolean applyToBlock(int index, Block[] blocks, byte[] metadata)
|
||||
{
|
||||
int k;
|
||||
short currentID = blocks[index];
|
||||
if (currentID > maxVanillaBlockID || (currentID != 0 && Block.blocksList[currentID] == null))
|
||||
Block current = blocks[index];
|
||||
if (!Block.blockRegistry.getNameForObject(current).startsWith("minecraft:"))
|
||||
{
|
||||
//This might be a mod block. Check if an exception exists.
|
||||
for (k = 0; k < exceptions.length; k++)
|
||||
for (k = 0; k < exceptions.size(); k++)
|
||||
{
|
||||
if (currentID == exceptions[k])
|
||||
if (current == exceptions.get(k))
|
||||
{
|
||||
//Exception found, not considered a mod block
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//No matching exception found. Replace the block.
|
||||
blocks[index] = replacementBlockID;
|
||||
blocks[index] = replacementBlock;
|
||||
metadata[index] = replacementMetadata;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -5,13 +5,14 @@ import java.util.ArrayList;
|
||||
import StevenDimDoors.mod_pocketDim.Point3D;
|
||||
import StevenDimDoors.mod_pocketDim.schematic.Schematic;
|
||||
import StevenDimDoors.mod_pocketDim.schematic.SchematicFilter;
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
public class SpecialBlockFinder extends SchematicFilter {
|
||||
|
||||
private short warpDoorID;
|
||||
private short dimensionalDoorID;
|
||||
private short monolithSpawnMarkerID;
|
||||
private short exitMarkerID;
|
||||
private Block warpDoor;
|
||||
private Block dimensionalDoor;
|
||||
private Block monolithSpawnMarker;
|
||||
private Block exitMarker;
|
||||
private int entranceOrientation;
|
||||
private Schematic schematic;
|
||||
private Point3D entranceDoorLocation;
|
||||
@@ -19,13 +20,13 @@ public class SpecialBlockFinder extends SchematicFilter {
|
||||
private ArrayList<Point3D> dimensionalDoorLocations;
|
||||
private ArrayList<Point3D> monolithSpawnLocations;
|
||||
|
||||
public SpecialBlockFinder(short warpDoorID, short dimensionalDoorID, short monolithSpawnMarkerID, short exitMarkerID)
|
||||
public SpecialBlockFinder(Block warpDoor, Block dimensionalDoor, Block monolithSpawn, Block exitDoor)
|
||||
{
|
||||
super("SpecialBlockFinder");
|
||||
this.warpDoorID = warpDoorID;
|
||||
this.dimensionalDoorID = dimensionalDoorID;
|
||||
this.monolithSpawnMarkerID = monolithSpawnMarkerID;
|
||||
this.exitMarkerID = exitMarkerID;
|
||||
this.warpDoor = warpDoor;
|
||||
this.dimensionalDoor = dimensionalDoor;
|
||||
this.monolithSpawnMarker = monolithSpawn;
|
||||
this.exitMarker = exitDoor;
|
||||
this.entranceDoorLocation = null;
|
||||
this.entranceOrientation = 0;
|
||||
this.exitDoorLocations = new ArrayList<Point3D>();
|
||||
@@ -55,27 +56,27 @@ 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;
|
||||
|
||||
if (blocks[index] == monolithSpawnMarkerID)
|
||||
if (blocks[index] == monolithSpawnMarker)
|
||||
{
|
||||
monolithSpawnLocations.add(schematic.calculatePoint(index));
|
||||
return true;
|
||||
}
|
||||
if (blocks[index] == dimensionalDoorID)
|
||||
if (blocks[index] == dimensionalDoor)
|
||||
{
|
||||
indexBelow = schematic.calculateIndexBelow(index);
|
||||
if (indexBelow >= 0 && blocks[indexBelow] == dimensionalDoorID)
|
||||
if (indexBelow >= 0 && blocks[indexBelow] == dimensionalDoor)
|
||||
{
|
||||
dimensionalDoorLocations.add(schematic.calculatePoint(index));
|
||||
return true;
|
||||
@@ -85,13 +86,13 @@ public class SpecialBlockFinder extends SchematicFilter {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (blocks[index] == warpDoorID)
|
||||
if (blocks[index] == warpDoor)
|
||||
{
|
||||
indexBelow = schematic.calculateIndexBelow(index);
|
||||
if (indexBelow >= 0 && blocks[indexBelow] == warpDoorID)
|
||||
if (indexBelow >= 0 && blocks[indexBelow] == warpDoor)
|
||||
{
|
||||
indexDoubleBelow = schematic.calculateIndexBelow(indexBelow);
|
||||
if (indexDoubleBelow >= 0 && blocks[indexDoubleBelow] == exitMarkerID)
|
||||
if (indexDoubleBelow >= 0 && blocks[indexDoubleBelow] == exitMarker)
|
||||
{
|
||||
exitDoorLocations.add(schematic.calculatePoint(index));
|
||||
return true;
|
||||
|
||||
@@ -3,10 +3,11 @@ package StevenDimDoors.mod_pocketDim.helpers;
|
||||
import java.util.HashMap;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
|
||||
public class BlockRotationHelper
|
||||
{
|
||||
public HashMap<Integer,HashMap<Integer,HashMap<Integer,Integer>>> rotationMappings = new HashMap<Integer,HashMap<Integer,HashMap<Integer,Integer>>>();
|
||||
public HashMap<Integer,HashMap<Block,HashMap<Integer,Integer>>> rotationMappings = new HashMap<Integer,HashMap<Block,HashMap<Integer,Integer>>>();
|
||||
|
||||
public 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,122 +271,119 @@ 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.brick_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_head,pistonDropperDispenser0);
|
||||
orientation0.put(Blocks.piston_extension,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_hook,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.stone_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.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_head,pistonDropperDispenser1);
|
||||
orientation1.put(Blocks.piston_extension,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_hook,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);
|
||||
orientation2.put(Blocks.brick_stairs, stairs2);
|
||||
orientation2.put(Blocks.stone_stairs, stairs2);
|
||||
orientation2.put(Blocks.nether_brick_stairs, stairs2);
|
||||
orientation2.put(Blocks.quartz_stairs, stairs2);
|
||||
orientation2.put(Blocks.sandstone_stairs, stairs2);
|
||||
orientation2.put(Blocks.stone_brick_stairs, stairs2);
|
||||
orientation2.put(Blocks.birch_stairs, stairs2);
|
||||
orientation2.put(Blocks.jungle_stairs, stairs2);
|
||||
orientation2.put(Blocks.oak_stairs, stairs2);
|
||||
orientation2.put(Blocks.spruce_stairs, stairs2);
|
||||
orientation2.put(Blocks.vine, vine2);
|
||||
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_head,pistonDropperDispenser2);
|
||||
orientation2.put(Blocks.piston_extension,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_hook,pistonDropperDispenser2);
|
||||
orientation2.put(Blocks.detector_rail,railsSpecial2);
|
||||
orientation2.put(Blocks.activator_rail,railsSpecial2);
|
||||
orientation2.put(Blocks.golden_rail,railsSpecial2);
|
||||
orientation2.put(Blocks.rail,rails2);
|
||||
|
||||
this.rotationMappings.put(2, orientation2);
|
||||
this.rotationMappings.put(1, orientation1);
|
||||
|
||||
@@ -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) == 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);
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package StevenDimDoors.mod_pocketDim.helpers;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.*;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
@@ -27,7 +25,7 @@ public class Compactor
|
||||
}
|
||||
}
|
||||
|
||||
public static void write(Collection<? extends NewDimData> values, DataOutputStream output) throws IOException
|
||||
public static void write(Collection<? extends NewDimData> values, DataOutput output) throws IOException
|
||||
{
|
||||
// SenseiKiwi: Just encode the data straight up for now. I'll implement fancier compression later.
|
||||
output.writeInt(values.size());
|
||||
@@ -35,11 +33,11 @@ public class Compactor
|
||||
{
|
||||
output.writeInt(dimension.id());
|
||||
output.writeInt(dimension.root().id());
|
||||
output.writeInt(dimension.type().index);
|
||||
output.writeInt(dimension.linkCount());
|
||||
for (DimLink link : dimension.links())
|
||||
{
|
||||
Point4D.write(link.source(), output);
|
||||
output.writeInt(link.orientation());
|
||||
(new ClientLinkData(link)).write(output);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +54,7 @@ public class Compactor
|
||||
*/
|
||||
}
|
||||
|
||||
public static void readDimensions(DataInputStream input, IDimRegistrationCallback callback) throws IOException
|
||||
public static void readDimensions(DataInput input, IDimRegistrationCallback callback) throws IOException
|
||||
{
|
||||
// Read in the dimensions one by one. Make sure we register root dimensions before
|
||||
// attempting to register the dimensions under them.
|
||||
|
||||
@@ -52,22 +52,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)
|
||||
return false;
|
||||
|
||||
block = Block.blocksList[blockID];
|
||||
block = chunk.getBlock(localX, y, localZ);
|
||||
if (block == null)
|
||||
return false;
|
||||
|
||||
material = block.blockMaterial;
|
||||
material = block.getMaterial();
|
||||
return (material.isLiquid() || !material.isReplaceable());
|
||||
}
|
||||
|
||||
@@ -109,12 +104,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.isAir(world, x, y, z) && (!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;
|
||||
}
|
||||
@@ -170,12 +164,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.isAir(world,x,y,z) && (!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 +240,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).isAir(world, x+dx,y,z+dz))
|
||||
{
|
||||
gaps[index] = 0;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -31,13 +31,12 @@ public abstract class BaseItemDoor extends ItemDoor
|
||||
|
||||
/**
|
||||
* door represents the non-dimensional door this item is associated with. Leave null for none.
|
||||
* @param itemID
|
||||
* @param material
|
||||
* @param door
|
||||
* @param vanillaDoor
|
||||
*/
|
||||
public BaseItemDoor(int itemID, Material material, ItemDoor vanillaDoor)
|
||||
public BaseItemDoor(Material material, ItemDoor vanillaDoor)
|
||||
{
|
||||
super(itemID, material);
|
||||
super( material);
|
||||
this.setMaxStackSize(64);
|
||||
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
|
||||
if (properties == null)
|
||||
@@ -51,7 +50,7 @@ public abstract class BaseItemDoor extends ItemDoor
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IconRegister par1IconRegister)
|
||||
public void registerIcons(IIconRegister par1IconRegister)
|
||||
{
|
||||
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", ""));
|
||||
}
|
||||
@@ -134,10 +133,10 @@ public abstract class BaseItemDoor extends ItemDoor
|
||||
// side
|
||||
if (side == 1 && !world.isRemote)
|
||||
{
|
||||
int blockID = world.getBlockId(x, y, z);
|
||||
if (blockID != 0)
|
||||
Block block = world.getBlock(x, y, z);
|
||||
if (!block.isAir(world, x, y, z))
|
||||
{
|
||||
if (!Block.blocksList[blockID].isBlockReplaceable(world, x, y, z))
|
||||
if (!block.isReplaceable(world, x, y, z))
|
||||
{
|
||||
y++;
|
||||
}
|
||||
@@ -179,7 +178,7 @@ public abstract class BaseItemDoor extends ItemDoor
|
||||
MovingObjectPosition hit = BaseItemDoor.doRayTrace(player.worldObj, player, true);
|
||||
if (hit != null)
|
||||
{
|
||||
if (world.getBlockId(hit.blockX, hit.blockY, hit.blockZ) == properties.RiftBlockID)
|
||||
if (world.getBlock(hit.blockX, hit.blockY, hit.blockZ) == mod_pocketDim.blockRift)
|
||||
{
|
||||
DimLink link = PocketManager.getLink(hit.blockX, hit.blockY, hit.blockZ, world.provider.dimensionId);
|
||||
if (link != null)
|
||||
@@ -196,7 +195,7 @@ public abstract class BaseItemDoor extends ItemDoor
|
||||
placeDoorBlock(world, x, y - 1, z, orientation, doorBlock);
|
||||
if (!(stack.getItem() instanceof BaseItemDoor))
|
||||
{
|
||||
((TileEntityDimDoor) world.getBlockTileEntity(x, y, z)).hasGennedPair = true;
|
||||
((TileEntityDimDoor) world.getTileEntity(x, y, z)).hasGennedPair = true;
|
||||
}
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
@@ -213,9 +212,9 @@ public abstract class BaseItemDoor extends ItemDoor
|
||||
|
||||
public static boolean canPlace(World world, int x, int y, int z)
|
||||
{
|
||||
int id = world.getBlockId(x, y, z);
|
||||
Block block = world.getBlock(x, y, z);
|
||||
|
||||
return (id == properties.RiftBlockID || id == 0 || Block.blocksList[id].blockMaterial.isReplaceable());
|
||||
return (block == mod_pocketDim.blockRift || block.isAir(world, x, y, z) || block.getMaterial().isReplaceable());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -236,7 +235,7 @@ public abstract class BaseItemDoor extends ItemDoor
|
||||
double d1 = par2EntityPlayer.prevPosY + (par2EntityPlayer.posY - par2EntityPlayer.prevPosY) * (double) f
|
||||
+ (double) (par1World.isRemote ? par2EntityPlayer.getEyeHeight() - par2EntityPlayer.getDefaultEyeHeight() : par2EntityPlayer.getEyeHeight());
|
||||
double d2 = par2EntityPlayer.prevPosZ + (par2EntityPlayer.posZ - par2EntityPlayer.prevPosZ) * (double) f;
|
||||
Vec3 vec3 = par1World.getWorldVec3Pool().getVecFromPool(d0, d1, d2);
|
||||
Vec3 vec3 = Vec3.createVectorHelper (d0, d1, d2);
|
||||
float f3 = MathHelper.cos(-f2 * 0.017453292F - (float) Math.PI);
|
||||
float f4 = MathHelper.sin(-f2 * 0.017453292F - (float) Math.PI);
|
||||
float f5 = -MathHelper.cos(-f1 * 0.017453292F);
|
||||
@@ -249,6 +248,6 @@ public abstract class BaseItemDoor extends ItemDoor
|
||||
d3 = ((EntityPlayerMP) par2EntityPlayer).theItemInWorldManager.getBlockReachDistance();
|
||||
}
|
||||
Vec3 vec31 = vec3.addVector((double) f7 * d3, (double) f6 * d3, (double) f8 * d3);
|
||||
return par1World.rayTraceBlocks_do_do(vec3, vec31, par3, !par3);
|
||||
return par1World.rayTraceBlocks(vec3, vec31, par3);
|
||||
}
|
||||
}
|
||||
@@ -1,22 +1,23 @@
|
||||
package StevenDimDoors.mod_pocketDim.items;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
|
||||
public class ItemBlockDimWall extends ItemBlock
|
||||
{
|
||||
private final static String[] subNames = {"Fabric of Reality", "Ancient Fabric" , "Altered Fabric"};
|
||||
private final static String[] subNames = {"tile.blockDimWall", "tile.blockAncientWall" , "tile.blockAlteredWall"};
|
||||
|
||||
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.", ""));
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import java.util.List;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -14,7 +14,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.EnumMovingObjectType;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
@@ -29,9 +28,9 @@ public class ItemDDKey extends Item
|
||||
{
|
||||
public static final int TIME_TO_UNLOCK = 30;
|
||||
|
||||
public ItemDDKey(int itemID)
|
||||
public ItemDDKey()
|
||||
{
|
||||
super(itemID);
|
||||
super();
|
||||
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
|
||||
this.setMaxStackSize(1);
|
||||
|
||||
@@ -46,16 +45,16 @@ public class ItemDDKey extends Item
|
||||
{
|
||||
if (DDLock.hasCreatedLock(par1ItemStack))
|
||||
{
|
||||
par3List.add("Bound");
|
||||
par3List.add(StatCollector.translateToLocal("info.riftkey.bound"));
|
||||
}
|
||||
else
|
||||
{
|
||||
par3List.add("Unbound");
|
||||
par3List.add(StatCollector.translateToLocal("info.riftkey.unbound"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IconRegister par1IconRegister)
|
||||
public void registerIcons(IIconRegister par1IconRegister)
|
||||
{
|
||||
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", ""));
|
||||
}
|
||||
@@ -83,13 +82,13 @@ public class ItemDDKey extends Item
|
||||
return false;
|
||||
}
|
||||
|
||||
if (player.getItemInUse() != null)
|
||||
if (player.inventory.getCurrentItem() != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
int blockID = world.getBlockId(x, y, z);
|
||||
Block block = world.getBlock(x, y, z);
|
||||
// make sure we are dealing with a door
|
||||
if (!(Block.blocksList[blockID] instanceof IDimDoor))
|
||||
if (!(block instanceof IDimDoor))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -146,7 +145,7 @@ public class ItemDDKey extends Item
|
||||
{
|
||||
//Raytrace to make sure we are still looking at a door
|
||||
MovingObjectPosition pos = getMovingObjectPositionFromPlayer(player.worldObj, player, true);
|
||||
if (pos != null && pos.typeOfHit == EnumMovingObjectType.TILE)
|
||||
if (pos != null && pos.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
|
||||
{
|
||||
//make sure we have a link and it has a lock
|
||||
DimLink link = PocketManager.getLink(pos.blockX, pos.blockY, pos.blockZ, player.worldObj);
|
||||
@@ -170,13 +169,13 @@ public class ItemDDKey extends Item
|
||||
* Raytrace to make sure we are still looking at the right block while preparing to remove the lock
|
||||
*/
|
||||
@Override
|
||||
public void onUsingItemTick(ItemStack stack, EntityPlayer player, int count)
|
||||
public void onUsingTick(ItemStack stack, EntityPlayer player, int count)
|
||||
{
|
||||
// no need to check every tick, twice a second instead
|
||||
if (count % 10 == 0)
|
||||
{
|
||||
MovingObjectPosition pos = getMovingObjectPositionFromPlayer(player.worldObj, player, true);
|
||||
if (pos != null && pos.typeOfHit == EnumMovingObjectType.TILE)
|
||||
if (pos != null && pos.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
|
||||
{
|
||||
DimLink link = PocketManager.getLink(pos.blockX, pos.blockY, pos.blockZ, player.worldObj);
|
||||
if (link != null && link.hasLock())
|
||||
|
||||
@@ -12,19 +12,16 @@ 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" })
|
||||
@Override
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
|
||||
{
|
||||
par3List.add("Place on the block under a rift");
|
||||
par3List.add("to activate that rift or place");
|
||||
par3List.add("anywhere else to create a");
|
||||
par3List.add("pocket dimension.");
|
||||
mod_pocketDim.translateAndAdd("info.dimDoor",par3List);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,18 +13,16 @@ 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" })
|
||||
@Override
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
|
||||
{
|
||||
par3List.add("Similar to a Dimensional Door");
|
||||
par3List.add("but keeps a pocket dimension");
|
||||
par3List.add("loaded if placed on the inside.");
|
||||
mod_pocketDim.translateAndAdd("info.goldDimDoor", par3List);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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.", ""));
|
||||
}
|
||||
|
||||
@@ -12,19 +12,16 @@ 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" })
|
||||
@Override
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
|
||||
{
|
||||
par3List.add("Creates a pathway to");
|
||||
par3List.add("Your personal pocket");
|
||||
|
||||
|
||||
mod_pocketDim.translateAndAdd("info.personalDimDoor", par3List);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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.", ""));
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -12,7 +12,7 @@ import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.EnumToolMaterial;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemSword;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
@@ -31,9 +31,9 @@ public class ItemRiftBlade extends ItemSword
|
||||
{
|
||||
private final DDProperties properties;
|
||||
|
||||
public ItemRiftBlade(int itemID, DDProperties properties)
|
||||
public ItemRiftBlade(DDProperties properties)
|
||||
{
|
||||
super(itemID, EnumToolMaterial.EMERALD);
|
||||
super(ToolMaterial.EMERALD);
|
||||
|
||||
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
|
||||
this.properties = properties;
|
||||
@@ -55,7 +55,7 @@ public class ItemRiftBlade extends ItemSword
|
||||
double var7 = par2EntityPlayer.prevPosX + (par2EntityPlayer.posX - par2EntityPlayer.prevPosX) * var4;
|
||||
double var9 = par2EntityPlayer.prevPosY + (par2EntityPlayer.posY - par2EntityPlayer.prevPosY) * var4 + 1.62D - par2EntityPlayer.yOffset;
|
||||
double var11 = par2EntityPlayer.prevPosZ + (par2EntityPlayer.posZ - par2EntityPlayer.prevPosZ) * var4;
|
||||
Vec3 var13 = par1World.getWorldVec3Pool().getVecFromPool(var7, var9, var11);
|
||||
Vec3 var13 = Vec3.createVectorHelper(var7, var9, var11);
|
||||
float var14 = MathHelper.cos(-var6 * 0.017453292F - (float)Math.PI);
|
||||
float var15 = MathHelper.sin(-var6 * 0.017453292F - (float)Math.PI);
|
||||
float var16 = -MathHelper.cos(-var5 * 0.017453292F);
|
||||
@@ -68,12 +68,12 @@ public class ItemRiftBlade extends ItemSword
|
||||
var21 = 7;
|
||||
}
|
||||
Vec3 var23 = var13.addVector(var18 * var21, var17 * var21, var20 * var21);
|
||||
return par1World.rayTraceBlocks_do_do(var13, var23, true, false);
|
||||
return par1World.rayTraceBlocks(var13, var23, true);
|
||||
}
|
||||
|
||||
private boolean teleportToEntity(ItemStack item, Entity par1Entity, EntityPlayer holder)
|
||||
{
|
||||
Vec3 var2 = holder.worldObj.getWorldVec3Pool().getVecFromPool(holder.posX - par1Entity.posX, holder.boundingBox.minY + holder.height / 2.0F - par1Entity.posY + par1Entity.getEyeHeight(), holder.posZ - par1Entity.posZ);
|
||||
Vec3 var2 = Vec3.createVectorHelper(holder.posX - par1Entity.posX, holder.boundingBox.minY + holder.height / 2.0F - par1Entity.posY + par1Entity.getEyeHeight(), holder.posZ - par1Entity.posZ);
|
||||
|
||||
double cooef =( var2.lengthVector()-2.5)/var2.lengthVector();
|
||||
var2.xCoord*=cooef;
|
||||
@@ -114,7 +114,7 @@ public class ItemRiftBlade extends ItemSword
|
||||
for (EntityLiving ent : list)
|
||||
{
|
||||
Vec3 var3 = player.getLook(1.0F).normalize();
|
||||
Vec3 var4 = player.worldObj.getWorldVec3Pool().getVecFromPool(ent.posX - player.posX, ent.boundingBox.minY + (ent.height) / 2.0F - ( player.posY + player.getEyeHeight()), ent.posZ - player.posZ);
|
||||
Vec3 var4 = Vec3.createVectorHelper(ent.posX - player.posX, ent.boundingBox.minY + (ent.height) / 2.0F - ( player.posY + player.getEyeHeight()), ent.posZ - player.posZ);
|
||||
double var5 = var4.lengthVector();
|
||||
var4 = var4.normalize();
|
||||
double var7 = var3.dotProduct(var4);
|
||||
@@ -132,7 +132,7 @@ public class ItemRiftBlade extends ItemSword
|
||||
int x = hit.blockX;
|
||||
int y = hit.blockY;
|
||||
int z = hit.blockZ;
|
||||
if (world.getBlockId(x, y, z) == properties.RiftBlockID)
|
||||
if (world.getBlock(x, y, z) == mod_pocketDim.blockRift)
|
||||
{
|
||||
if (PocketManager.getLink(x, y, z, world) != null)
|
||||
{
|
||||
@@ -160,7 +160,7 @@ public class ItemRiftBlade extends ItemSword
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IconRegister par1IconRegister)
|
||||
public void registerIcons(IIconRegister par1IconRegister)
|
||||
{
|
||||
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", ""));
|
||||
}
|
||||
@@ -173,7 +173,7 @@ public class ItemRiftBlade extends ItemSword
|
||||
{
|
||||
//Don't include a call to super.getIsRepairable()!
|
||||
//That would cause this sword to accept diamonds as a repair material (since we set material = Diamond).
|
||||
return mod_pocketDim.itemStableFabric.itemID == par2ItemStack.itemID ? true : false;
|
||||
return mod_pocketDim.itemStableFabric == par2ItemStack.getItem() ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -184,7 +184,6 @@ public class ItemRiftBlade extends ItemSword
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
|
||||
{
|
||||
par3List.add("Opens temporary doors on rifts");
|
||||
par3List.add("and has a teleport attack.");
|
||||
mod_pocketDim.translateAndAdd("info.riftblade", par3List);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
package StevenDimDoors.mod_pocketDim.items;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.EnumArmorMaterial;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
|
||||
public class ItemRiftGoggles extends ItemArmor
|
||||
{
|
||||
|
||||
public ItemRiftGoggles(int par1, int par2, int par3)
|
||||
public ItemRiftGoggles(int par2, int par3)
|
||||
{
|
||||
super(par1, EnumArmorMaterial.IRON, par1, par1);
|
||||
super(ArmorMaterial.IRON, par2, par3);
|
||||
this.setCreativeTab(CreativeTabs.tabRedstone);
|
||||
// this.setIconIndex(Item.doorWood.getIconFromDamage(0));
|
||||
}
|
||||
|
||||
@@ -2,12 +2,13 @@ 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;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
@@ -22,9 +23,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 +41,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.", ""));
|
||||
}
|
||||
@@ -118,13 +119,11 @@ public class ItemRiftSignature extends Item
|
||||
Point4DOrientation source = getSource(par1ItemStack);
|
||||
if (source != null)
|
||||
{
|
||||
par3List.add("Leads to (" + source.getX() + ", " + source.getY() + ", " + source.getZ() + ") at dimension #" + source.getDimension());
|
||||
par3List.add(StatCollector.translateToLocalFormatted("info.riftSignature.bound", source.getX(), source.getY(), source.getZ(), source.getDimension()));
|
||||
}
|
||||
else
|
||||
{
|
||||
par3List.add("First click stores a location;");
|
||||
par3List.add("second click creates a pair of");
|
||||
par3List.add("rifts linking the two locations.");
|
||||
mod_pocketDim.translateAndAdd("info.riftSignature.unbound", par3List);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,12 +138,12 @@ public class ItemRiftSignature extends Item
|
||||
public static int adjustYForSpecialBlocks(World world, int x, int y, int z)
|
||||
{
|
||||
int targetY = y - 2; // Get the block the player actually clicked on
|
||||
Block block = Block.blocksList[world.getBlockId(x, targetY, z)];
|
||||
Block block = world.getBlock(x, targetY, z);
|
||||
if (block == null)
|
||||
{
|
||||
return targetY + 2;
|
||||
}
|
||||
if (block.isBlockReplaceable(world, x, targetY, z))
|
||||
if (block.isReplaceable(world, x, targetY, z))
|
||||
{
|
||||
return targetY + 1; // Move block placement down (-2+1) one so its directly over things like snow
|
||||
}
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package StevenDimDoors.mod_pocketDim.items;
|
||||
|
||||
import java.util.List;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
@@ -18,13 +21,13 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemStabilizedRiftSignature extends ItemRiftSignature
|
||||
{
|
||||
public ItemStabilizedRiftSignature(int itemID)
|
||||
public ItemStabilizedRiftSignature()
|
||||
{
|
||||
super(itemID);
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IconRegister par1IconRegister)
|
||||
public void registerIcons(IIconRegister par1IconRegister)
|
||||
{
|
||||
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", ""));
|
||||
}
|
||||
@@ -74,7 +77,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
|
||||
@@ -167,13 +170,12 @@ public class ItemStabilizedRiftSignature extends ItemRiftSignature
|
||||
Point4DOrientation source = getSource(par1ItemStack);
|
||||
if (source != null)
|
||||
{
|
||||
par3List.add("Leads to (" + source.getX() + ", " + source.getY() + ", " + source.getZ() + ") at dimension #" + source.getDimension());
|
||||
String text = StatCollector.translateToLocalFormatted("info.riftSignature.bound", source.getX(), source.getY(), source.getZ(), source.getDimension());
|
||||
par3List.add(text);
|
||||
}
|
||||
else
|
||||
{
|
||||
par3List.add("First click stores a location,");
|
||||
par3List.add("other clicks create rifts linking");
|
||||
par3List.add("the first and last locations together.");
|
||||
mod_pocketDim.translateAndAdd("info.riftSignature.stable", par3List);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
package StevenDimDoors.mod_pocketDim.items;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.Item;
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
|
||||
public class ItemStableFabric extends Item
|
||||
{
|
||||
public ItemStableFabric(int itemID, int par2)
|
||||
public ItemStableFabric(int par2)
|
||||
{
|
||||
super(itemID);
|
||||
super();
|
||||
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IconRegister par1IconRegister)
|
||||
public void registerIcons(IIconRegister par1IconRegister)
|
||||
{
|
||||
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", ""));
|
||||
}
|
||||
|
||||
@@ -6,22 +6,23 @@ import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemDoor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
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" })
|
||||
@Override
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
|
||||
{
|
||||
par3List.add("Caution: Leads to random destination");
|
||||
par3List.add(StatCollector.translateToLocal("info.chaosDoor"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,19 +12,16 @@ 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" })
|
||||
@Override
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
|
||||
{
|
||||
par3List.add("Place on the block under");
|
||||
par3List.add("a rift to create a portal,");
|
||||
par3List.add("or place anywhere in a");
|
||||
par3List.add("pocket dimension to exit.");
|
||||
mod_pocketDim.translateAndAdd("info.warpDoor",par3List);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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.", ""));
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ public class DispenserBehaviorStabilizedRS extends BehaviorDefaultDispenseItem
|
||||
int x = dispenser.getXInt();
|
||||
int y = dispenser.getYInt();
|
||||
int z = dispenser.getZInt();
|
||||
EnumFacing facing = BlockDispenser.getFacing(dispenser.getBlockMetadata());
|
||||
EnumFacing facing = BlockDispenser.func_149937_b(dispenser.getBlockMetadata());
|
||||
int dx = facing.getFrontOffsetX();
|
||||
int dy = facing.getFrontOffsetY();
|
||||
int dz = facing.getFrontOffsetZ();
|
||||
|
||||
@@ -3,7 +3,7 @@ package StevenDimDoors.mod_pocketDim.items;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -21,16 +21,16 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class itemRiftRemover extends Item
|
||||
{
|
||||
public itemRiftRemover(int itemID, Material par2Material)
|
||||
public itemRiftRemover(Material par2Material)
|
||||
{
|
||||
super(itemID);
|
||||
super();
|
||||
this.setMaxStackSize(1);
|
||||
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
|
||||
this.setMaxDamage(4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IconRegister par1IconRegister)
|
||||
public void registerIcons(IIconRegister par1IconRegister)
|
||||
{
|
||||
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", ""));
|
||||
}
|
||||
@@ -56,7 +56,7 @@ public class itemRiftRemover extends Item
|
||||
int hz = hit.blockZ;
|
||||
NewDimData dimension = PocketManager.createDimensionData(world);
|
||||
DimLink link = dimension.getLink(hx, hy, hz);
|
||||
if (world.getBlockId(hx, hy, hz) == mod_pocketDim.blockRift.blockID && link != null &&
|
||||
if (world.getBlock(hx, hy, hz) == mod_pocketDim.blockRift && link != null &&
|
||||
player.canPlayerEdit(hx, hy, hz, hit.sideHit, stack))
|
||||
{
|
||||
// Invoke onPlayerRightClick()
|
||||
@@ -87,15 +87,15 @@ public class itemRiftRemover extends Item
|
||||
|
||||
NewDimData dimension = PocketManager.createDimensionData(world);
|
||||
DimLink link = dimension.getLink(x, y, z);
|
||||
if (world.getBlockId(x, y, z) == mod_pocketDim.blockRift.blockID && link != null &&
|
||||
if (world.getBlock(x, y, z) == mod_pocketDim.blockRift && link != null &&
|
||||
player.canPlayerEdit(x, y, z, side, stack))
|
||||
{
|
||||
// Tell the rift's tile entity to do its removal animation
|
||||
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (tileEntity != null && tileEntity instanceof TileEntityRift)
|
||||
{
|
||||
((TileEntityRift) tileEntity).shouldClose = true;
|
||||
tileEntity.onInventoryChanged();
|
||||
tileEntity.markDirty();
|
||||
}
|
||||
else if (!world.isRemote)
|
||||
{
|
||||
@@ -130,8 +130,6 @@ public class itemRiftRemover extends Item
|
||||
@Override
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
|
||||
{
|
||||
par3List.add("Use near exposed rift");
|
||||
par3List.add("to remove it and");
|
||||
par3List.add("any nearby rifts.");
|
||||
mod_pocketDim.translateAndAdd("info.riftRemover",par3List);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,23 @@
|
||||
package StevenDimDoors.mod_pocketDim;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
import StevenDimDoors.mod_pocketDim.network.DimDoorsNetwork;
|
||||
import StevenDimDoors.mod_pocketDim.schematic.BlockRotator;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.event.*;
|
||||
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.util.StatCollector;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.common.ForgeChunkManager;
|
||||
@@ -65,7 +72,6 @@ import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoor;
|
||||
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoorGold;
|
||||
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityRift;
|
||||
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityTransTrapdoor;
|
||||
import StevenDimDoors.mod_pocketDim.util.l_systems.LSystem;
|
||||
import StevenDimDoors.mod_pocketDim.world.BiomeGenLimbo;
|
||||
import StevenDimDoors.mod_pocketDim.world.BiomeGenPocket;
|
||||
import StevenDimDoors.mod_pocketDim.world.DDBiomeGenBase;
|
||||
@@ -74,35 +80,19 @@ import StevenDimDoors.mod_pocketDim.world.LimboProvider;
|
||||
import StevenDimDoors.mod_pocketDim.world.PersonalPocketProvider;
|
||||
import StevenDimDoors.mod_pocketDim.world.PocketProvider;
|
||||
import StevenDimDoors.mod_pocketDim.world.gateways.GatewayGenerator;
|
||||
import StevenDimDoors.mod_pocketDimClient.ClientPacketHandler;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.EventHandler;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
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@";
|
||||
public static final String version = "2.2.5-test";
|
||||
public static final String modid = "dimdoors";
|
||||
|
||||
//TODO need a place to stick all these constants
|
||||
@@ -148,8 +138,6 @@ public class mod_pocketDim
|
||||
public static BiomeGenBase limboBiome;
|
||||
public static BiomeGenBase pocketBiome;
|
||||
|
||||
public static boolean isPlayerWearingGoogles = false;
|
||||
|
||||
public static DDProperties properties;
|
||||
public static DDWorldProperties worldProperties;
|
||||
public static CustomLimboPopulator spawner; //Added this field temporarily. Will be refactored out later.
|
||||
@@ -167,15 +155,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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTranslatedTabLabel()
|
||||
{
|
||||
return "Dimensional Doors";
|
||||
return mod_pocketDim.itemDimensionalDoor;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -191,6 +173,10 @@ public class mod_pocketDim
|
||||
hooks = new EventHookContainer(properties);
|
||||
MinecraftForge.EVENT_BUS.register(hooks);
|
||||
MinecraftForge.TERRAIN_GEN_BUS.register(hooks);
|
||||
|
||||
proxy.registerSidedHooks(properties);
|
||||
|
||||
DimDoorsNetwork.init();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@@ -198,42 +184,42 @@ public class mod_pocketDim
|
||||
{
|
||||
// Initialize ServerTickHandler instance
|
||||
serverTickHandler = new ServerTickHandler();
|
||||
TickRegistry.registerTickHandler(serverTickHandler, Side.SERVER);
|
||||
FMLCommonHandler.instance().bus().register(serverTickHandler);
|
||||
|
||||
// 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").setBlockTextureName("itemGoldDimDoor");
|
||||
|
||||
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").setBlockTextureName("itemQuartzDoor");
|
||||
personalDimDoor = new PersonalDimDoor(Material.rock,properties).setHardness(0.1F).setBlockName("dimDoorPersonal").setBlockTextureName("itemQuartzDimDoor");
|
||||
|
||||
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").setBlockTextureName("itemGoldDoor");
|
||||
blockDimWall = new BlockDimWall(0, Material.iron).setLightLevel(1.0F).setHardness(0.1F).setBlockName("blockDimWall");
|
||||
blockDimWallPerm = (new BlockDimWallPerm(0, Material.iron)).setLightLevel(1.0F).setBlockUnbreakable().setResistance(6000000.0F).setBlockName("blockDimWallPerm");
|
||||
warpDoor = new WarpDoor(Material.wood, properties).setHardness(1.0F) .setBlockName("dimDoorWarp").setBlockTextureName("itemDimDoorWarp");
|
||||
blockLimbo = new BlockLimbo(15, Material.iron, properties.LimboDimensionID, limboDecay).setHardness(.2F).setBlockName("BlockLimbo").setLightLevel(.0F);
|
||||
unstableDoor = (new UnstableDoor(Material.iron, properties).setHardness(.2F).setBlockName("chaosDoor").setLightLevel(.0F).setBlockTextureName("itemChaosDoor") );
|
||||
dimensionalDoor = (DimensionalDoor) (new DimensionalDoor(Material.iron, properties).setHardness(1.0F).setResistance(2000.0F) .setBlockName("dimDoor").setBlockTextureName("itemDimDoor"));
|
||||
transTrapdoor = (TransTrapdoor) (new TransTrapdoor(Material.wood).setHardness(1.0F) .setBlockName("dimHatch"));
|
||||
blockRift = (BlockRift) (new BlockRift(Material.fire, properties).setHardness(1.0F) .setBlockName("rift"));
|
||||
|
||||
itemDDKey = (new ItemDDKey(properties.DDKeyItemID)).setUnlocalizedName("itemDDKey");
|
||||
itemQuartzDoor = (new ItemQuartzDoor(properties.QuartzDoorID, Material.rock)).setUnlocalizedName("itemQuartzDoor");
|
||||
itemPersonalDoor = (new ItemPersonalDoor(properties.PersonalDimDoorID, Material.rock, (ItemDoor)this.itemQuartzDoor)).setUnlocalizedName("itemQuartzDimDoor");
|
||||
itemGoldenDoor = (new ItemGoldDoor(properties.GoldenDoorItemID, Material.wood)).setUnlocalizedName("itemGoldDoor");
|
||||
itemGoldenDimensionalDoor = (new ItemGoldDimDoor(properties.GoldenDimensionalDoorItemID, Material.iron, (ItemDoor)this.itemGoldenDoor)).setUnlocalizedName("itemGoldDimDoor");
|
||||
itemDimensionalDoor = (ItemDimensionalDoor) (new ItemDimensionalDoor(properties.DimensionalDoorItemID, Material.iron, (ItemDoor)Item.doorIron)).setUnlocalizedName("itemDimDoor");
|
||||
itemWarpDoor = (new ItemWarpDoor(properties.WarpDoorItemID, Material.wood,(ItemDoor)Item.doorWood)).setUnlocalizedName("itemDimDoorWarp");
|
||||
itemRiftSignature = (new ItemRiftSignature(properties.RiftSignatureItemID)).setUnlocalizedName("itemLinkSignature");
|
||||
itemRiftRemover = (new itemRiftRemover(properties.RiftRemoverItemID, Material.wood)).setUnlocalizedName("itemRiftRemover");
|
||||
itemStableFabric = (new ItemStableFabric(properties.StableFabricItemID, 0)).setUnlocalizedName("itemStableFabric");
|
||||
itemUnstableDoor = (new ItemUnstableDoor(properties.UnstableDoorItemID, Material.iron, null)).setUnlocalizedName("itemChaosDoor");
|
||||
itemRiftBlade = (new ItemRiftBlade(properties.RiftBladeItemID, properties)).setUnlocalizedName("ItemRiftBlade");
|
||||
itemStabilizedRiftSignature = (new ItemStabilizedRiftSignature(properties.StabilizedRiftSignatureItemID)).setUnlocalizedName("itemStabilizedRiftSig");
|
||||
itemWorldThread = (new ItemWorldThread(properties.WorldThreadItemID)).setUnlocalizedName("itemWorldThread");
|
||||
itemDDKey = (new ItemDDKey()).setUnlocalizedName("itemDDKey");
|
||||
itemQuartzDoor = (new ItemQuartzDoor(Material.rock)).setUnlocalizedName("itemQuartzDoor");
|
||||
itemPersonalDoor = (new ItemPersonalDoor(Material.rock, (ItemDoor)this.itemQuartzDoor)).setUnlocalizedName("itemQuartzDimDoor");
|
||||
itemGoldenDoor = (new ItemGoldDoor(Material.wood)).setUnlocalizedName("itemGoldDoor");
|
||||
itemGoldenDimensionalDoor = (new ItemGoldDimDoor(Material.iron, (ItemDoor)this.itemGoldenDoor)).setUnlocalizedName("itemGoldDimDoor");
|
||||
itemDimensionalDoor = (ItemDimensionalDoor) (new ItemDimensionalDoor(Material.iron, (ItemDoor) Items.iron_door)).setUnlocalizedName("itemDimDoor");
|
||||
itemWarpDoor = (new ItemWarpDoor(Material.wood,(ItemDoor)Items.iron_door)).setUnlocalizedName("itemDimDoorWarp");
|
||||
itemRiftSignature = (new ItemRiftSignature()).setUnlocalizedName("itemLinkSignature");
|
||||
itemRiftRemover = (new itemRiftRemover(Material.wood)).setUnlocalizedName("itemRiftRemover");
|
||||
itemStableFabric = (new ItemStableFabric(0)).setUnlocalizedName("itemStableFabric");
|
||||
itemUnstableDoor = (new ItemUnstableDoor(Material.iron, null)).setUnlocalizedName("itemChaosDoor");
|
||||
itemRiftBlade = (new ItemRiftBlade(properties)).setUnlocalizedName("ItemRiftBlade");
|
||||
itemStabilizedRiftSignature = (new ItemStabilizedRiftSignature()).setUnlocalizedName("itemStabilizedRiftSig");
|
||||
itemWorldThread = (new ItemWorldThread()).setUnlocalizedName("itemWorldThread");
|
||||
|
||||
// Check if other biomes have been registered with the same IDs we want. If so, crash Minecraft
|
||||
// to notify the user instead of letting it pass and conflicting with Biomes o' Plenty.
|
||||
@@ -243,21 +229,37 @@ public class mod_pocketDim
|
||||
mod_pocketDim.limboBiome = (new BiomeGenLimbo(properties.LimboBiomeID));
|
||||
mod_pocketDim.pocketBiome = (new BiomeGenPocket(properties.PocketBiomeID));
|
||||
|
||||
GameRegistry.registerBlock(quartzDoor, "Quartz Door");
|
||||
GameRegistry.registerBlock(personalDimDoor, "Personal Dimensional Door");
|
||||
GameRegistry.registerBlock(goldenDoor, "Golden Door");
|
||||
GameRegistry.registerBlock(goldenDimensionalDoor, "Golden Dimensional Door");
|
||||
GameRegistry.registerBlock(unstableDoor, "Unstable Door");
|
||||
GameRegistry.registerBlock(warpDoor, "Warp Door");
|
||||
GameRegistry.registerBlock(quartzDoor, null, "Quartz Door");
|
||||
GameRegistry.registerBlock(personalDimDoor, null, "Personal Dimensional Door");
|
||||
GameRegistry.registerBlock(goldenDoor, null, "Golden Door");
|
||||
GameRegistry.registerBlock(goldenDimensionalDoor, null, "Golden Dimensional Door");
|
||||
GameRegistry.registerBlock(unstableDoor, null, "Unstable Door");
|
||||
GameRegistry.registerBlock(warpDoor, null, "Warp Door");
|
||||
GameRegistry.registerBlock(blockRift, "Rift");
|
||||
GameRegistry.registerBlock(blockLimbo, "Unraveled Fabric");
|
||||
GameRegistry.registerBlock(dimensionalDoor, "Dimensional Door");
|
||||
GameRegistry.registerBlock(dimensionalDoor, null, "Dimensional Door");
|
||||
GameRegistry.registerBlock(transTrapdoor,"Transdimensional Trapdoor");
|
||||
GameRegistry.registerBlock(blockDimWallPerm, "Fabric of RealityPerm");
|
||||
GameRegistry.registerBlock(transientDoor, "transientDoor");
|
||||
GameRegistry.registerItem(itemDDKey, "Rift Key");
|
||||
GameRegistry.registerItem(itemQuartzDoor, "Quartz Door Item");
|
||||
GameRegistry.registerItem(itemPersonalDoor, "Personal Dimensional Door Item");
|
||||
GameRegistry.registerItem(itemGoldenDoor, "Golden Door Item");
|
||||
GameRegistry.registerItem(itemGoldenDimensionalDoor, "Golden Dimensional Door Item");
|
||||
GameRegistry.registerItem(itemDimensionalDoor, "Dimensional Door Item");
|
||||
GameRegistry.registerItem(itemWarpDoor, "Warp Door Item");
|
||||
GameRegistry.registerItem(itemRiftSignature, "Rift Signature");
|
||||
GameRegistry.registerItem(itemRiftRemover, "Rift Remover");
|
||||
GameRegistry.registerItem(itemStableFabric, "Stable Fabric Item");
|
||||
GameRegistry.registerItem(itemUnstableDoor, "Unstable Door Item");
|
||||
GameRegistry.registerItem(itemRiftBlade, "Rift Blade");
|
||||
GameRegistry.registerItem(itemStabilizedRiftSignature, "Stabilized Rift Signature");
|
||||
GameRegistry.registerItem(itemWorldThread, "World Thread");
|
||||
|
||||
GameRegistry.registerBlock(blockDimWall, ItemBlockDimWall.class, "Fabric of Reality");
|
||||
|
||||
BlockRotator.setupOrientations();
|
||||
|
||||
if (!DimensionManager.registerProviderType(properties.PocketProviderID, PocketProvider.class, false))
|
||||
throw new IllegalStateException("There is a provider ID conflict between PocketProvider from Dimensional Doors and another provider type. Fix your configuration!");
|
||||
if (!DimensionManager.registerProviderType(properties.LimboProviderID, LimboProvider.class, false))
|
||||
@@ -267,43 +269,6 @@ public class mod_pocketDim
|
||||
|
||||
DimensionManager.registerDimension(properties.LimboDimensionID, properties.LimboProviderID);
|
||||
|
||||
LanguageRegistry.addName(goldenDoor, "Golden Door");
|
||||
LanguageRegistry.addName(goldenDimensionalDoor, "Golden Dimensional Door");
|
||||
LanguageRegistry.addName(transientDoor , "Transient Door");
|
||||
LanguageRegistry.addName(blockRift , "Rift");
|
||||
LanguageRegistry.addName(blockLimbo , "Unraveled Fabric");
|
||||
LanguageRegistry.addName(warpDoor , "Warp Door");
|
||||
LanguageRegistry.addName(unstableDoor , "Unstable Door");
|
||||
LanguageRegistry.addName(blockDimWall , "Fabric of Reality");
|
||||
LanguageRegistry.addName(blockDimWallPerm , "Eternal Fabric");
|
||||
LanguageRegistry.addName(dimensionalDoor, "Dimensional Door");
|
||||
LanguageRegistry.addName(transTrapdoor, "Transdimensional Trapdoor");
|
||||
|
||||
LanguageRegistry.addName(itemWarpDoor, "Warp Door");
|
||||
LanguageRegistry.addName(itemRiftSignature, "Rift Signature");
|
||||
LanguageRegistry.addName(itemGoldenDoor, "Golden Door");
|
||||
LanguageRegistry.addName(itemGoldenDimensionalDoor, "Golden Dimensional Door");
|
||||
LanguageRegistry.addName(itemStabilizedRiftSignature, "Stabilized Rift Signature");
|
||||
LanguageRegistry.addName(itemRiftRemover, "Rift Remover");
|
||||
LanguageRegistry.addName(itemStableFabric, "Stable Fabric");
|
||||
LanguageRegistry.addName(itemUnstableDoor, "Unstable Door");
|
||||
LanguageRegistry.addName(itemDimensionalDoor, "Dimensional Door");
|
||||
LanguageRegistry.addName(itemRiftBlade, "Rift Blade");
|
||||
LanguageRegistry.addName(itemWorldThread, "World Thread");
|
||||
LanguageRegistry.addName(itemDDKey, "Rift Key");
|
||||
LanguageRegistry.addName(itemQuartzDoor, "Quartz Door");
|
||||
LanguageRegistry.addName(itemPersonalDoor, "Personal Dimensional Door");
|
||||
|
||||
|
||||
/**
|
||||
* Add names for multiblock inventory item
|
||||
*/
|
||||
LanguageRegistry.addName(new ItemStack(blockDimWall, 1, 0), "Fabric of Reality");
|
||||
LanguageRegistry.addName(new ItemStack(blockDimWall, 1, 1), "Ancient Fabric");
|
||||
LanguageRegistry.addName(new ItemStack(blockDimWall, 1, 2), "Altered Fabric");
|
||||
|
||||
LanguageRegistry.instance().addStringLocalization("itemGroup.dimDoorsCustomTab", "en_US", "Dimensional Doors Items");
|
||||
|
||||
GameRegistry.registerTileEntity(TileEntityDimDoor.class, "TileEntityDimDoor");
|
||||
GameRegistry.registerTileEntity(TileEntityRift.class, "TileEntityRift");
|
||||
GameRegistry.registerTileEntity(TileEntityTransTrapdoor.class, "TileEntityDimHatch");
|
||||
@@ -311,51 +276,31 @@ 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));
|
||||
LanguageRegistry.instance().addStringLocalization("entity.dimdoors.Monolith.name", "Monolith");
|
||||
EntityList.entityEggs.put(properties.MonolithEntityID, new EntityList.EntityEggInfo(properties.MonolithEntityID, 0, 0xffffff));
|
||||
|
||||
CraftingManager.registerRecipes(properties);
|
||||
CraftingManager.registerDispenserBehaviors();
|
||||
GameRegistry.registerCraftingHandler(new CraftingManager());
|
||||
FMLCommonHandler.instance().bus().register(new CraftingManager());
|
||||
|
||||
DungeonHelper.initialize();
|
||||
gatewayGenerator = new GatewayGenerator(properties);
|
||||
GameRegistry.registerWorldGenerator(mod_pocketDim.gatewayGenerator);
|
||||
GameRegistry.registerWorldGenerator(mod_pocketDim.gatewayGenerator, 0);
|
||||
|
||||
// Register loot chests
|
||||
DDLoot.registerInfo(properties);
|
||||
proxy.loadTextures();
|
||||
proxy.registerRenderers();
|
||||
FMLCommonHandler.instance().bus().register(new ConnectionHandler());
|
||||
}
|
||||
|
||||
LSystem.generateLSystem("terdragon", LSystem.TERDRAGON, 4);
|
||||
LSystem.generateLSystem("terdragon", LSystem.TERDRAGON, 5);
|
||||
// LSystem.generateLSystem("terdragon", LSystem.TERDRAGON, 6); //degenerate
|
||||
LSystem.generateLSystem("terdragon", LSystem.TERDRAGON, 7);
|
||||
// LSystem.generateLSystem("terdragon", LSystem.TERDRAGON, 8);
|
||||
// LSystem.generateLSystem("terdragon", LSystem.TERDRAGON, 9);
|
||||
|
||||
|
||||
// LSystem.generateLSystem("vortex", LSystem.VORTEX, 8);
|
||||
LSystem.generateLSystem("vortex", LSystem.VORTEX, 9);
|
||||
LSystem.generateLSystem("vortex", LSystem.VORTEX, 10);
|
||||
LSystem.generateLSystem("vortex", LSystem.VORTEX, 11);
|
||||
// LSystem.generateLSystem("vortex", LSystem.VORTEX, 12);
|
||||
|
||||
LSystem.generateLSystem("twindragon", LSystem.TWINDRAGON, 7);
|
||||
LSystem.generateLSystem("twindragon", LSystem.TWINDRAGON, 8);
|
||||
LSystem.generateLSystem("twindragon", LSystem.TWINDRAGON, 9);
|
||||
LSystem.generateLSystem("twindragon", LSystem.TWINDRAGON, 10);
|
||||
// LSystem.generateLSystem("twindragon", LSystem.TWINDRAGON, 11);
|
||||
|
||||
|
||||
LSystem.generateLSystem("dragon", LSystem.DRAGON, 8);
|
||||
LSystem.generateLSystem("dragon", LSystem.DRAGON, 9);
|
||||
LSystem.generateLSystem("dragon", LSystem.DRAGON, 10);
|
||||
LSystem.generateLSystem("dragon", LSystem.DRAGON, 11);
|
||||
// LSystem.generateLSystem("dragon", LSystem.DRAGON, 12);
|
||||
// LSystem.generateLSystem("dragon", LSystem.DRAGON, 13);
|
||||
|
||||
|
||||
public static void translateAndAdd(String key, List list) {
|
||||
for (int i=0;i<10;i++) {
|
||||
if (StatCollector.canTranslate(key+Integer.toString(i))) {
|
||||
String line = StatCollector.translateToLocal(key + Integer.toString(i));
|
||||
list.add(line);
|
||||
} else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@@ -442,8 +387,7 @@ public class mod_pocketDim
|
||||
|
||||
public static void sendChat(EntityPlayer player, String message)
|
||||
{
|
||||
ChatMessageComponent cmp = new ChatMessageComponent();
|
||||
cmp.addText(message);
|
||||
player.sendChatToPlayer(cmp);
|
||||
ChatComponentText text = new ChatComponentText(message);
|
||||
player.addChatComponentMessage(text);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package StevenDimDoors.mod_pocketDim.network;
|
||||
|
||||
import StevenDimDoors.mod_pocketDim.core.NewDimData;
|
||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class ClientJoinPacket extends DimDoorsPacket {
|
||||
@Override
|
||||
public void write(ByteArrayDataOutput out) {
|
||||
try {
|
||||
PocketManager.writePacket(out);
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(ByteArrayDataInput in) {
|
||||
try {
|
||||
PocketManager.readPacket(in);
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleClient(World world, EntityPlayer player) {
|
||||
NewDimData dimensionData = PocketManager.getDimensionData(player.worldObj);
|
||||
|
||||
if (dimensionData.isPocketDimension())
|
||||
player.worldObj.provider.registerWorld(player.worldObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleServer(World world, EntityPlayerMP player) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package StevenDimDoors.mod_pocketDim.network;
|
||||
|
||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||
import StevenDimDoors.mod_pocketDim.watcher.ClientDimData;
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class CreateDimensionPacket extends DimDoorsPacket {
|
||||
private ClientDimData dimensionData = null;
|
||||
|
||||
public CreateDimensionPacket() {}
|
||||
public CreateDimensionPacket(ClientDimData data) {
|
||||
this.dimensionData = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(ByteArrayDataOutput out) {
|
||||
if (dimensionData != null) {
|
||||
try {
|
||||
dimensionData.write(out);
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(ByteArrayDataInput in) {
|
||||
try {
|
||||
dimensionData = ClientDimData.read(in);
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleClient(World world, EntityPlayer player) {
|
||||
PocketManager.getDimwatcher().onCreated(dimensionData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleServer(World world, EntityPlayerMP player) {
|
||||
//Shouldn't be here
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package StevenDimDoors.mod_pocketDim.network;
|
||||
|
||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||
import StevenDimDoors.mod_pocketDim.watcher.ClientLinkData;
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class CreateLinkPacket extends DimDoorsPacket {
|
||||
|
||||
private ClientLinkData clientLinkData = null;
|
||||
|
||||
public CreateLinkPacket() {
|
||||
}
|
||||
|
||||
public CreateLinkPacket(ClientLinkData data) {
|
||||
this.clientLinkData = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(ByteArrayDataOutput out) {
|
||||
if (clientLinkData != null) {
|
||||
try {
|
||||
clientLinkData.write(out);
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(ByteArrayDataInput in) {
|
||||
try {
|
||||
clientLinkData = ClientLinkData.read(in);
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleClient(World world, EntityPlayer player) {
|
||||
PocketManager.getLinkWatcher().onCreated(clientLinkData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleServer(World world, EntityPlayerMP player) {
|
||||
//Shouldn't be here
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package StevenDimDoors.mod_pocketDim.network;
|
||||
|
||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||
import StevenDimDoors.mod_pocketDim.watcher.ClientDimData;
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class DeleteDimensionPacket extends DimDoorsPacket {
|
||||
private ClientDimData dimensionData = null;
|
||||
|
||||
public DeleteDimensionPacket() {}
|
||||
public DeleteDimensionPacket(ClientDimData dimensionData) {
|
||||
this.dimensionData = dimensionData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(ByteArrayDataOutput out) {
|
||||
if (dimensionData != null) {
|
||||
try {
|
||||
dimensionData.write(out);
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(ByteArrayDataInput in) {
|
||||
try {
|
||||
dimensionData = ClientDimData.read(in);
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleClient(World world, EntityPlayer player) {
|
||||
PocketManager.getDimwatcher().onDeleted(dimensionData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleServer(World world, EntityPlayerMP player) {
|
||||
//Shouldn't be here
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package StevenDimDoors.mod_pocketDim.network;
|
||||
|
||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||
import StevenDimDoors.mod_pocketDim.watcher.ClientDimData;
|
||||
import StevenDimDoors.mod_pocketDim.watcher.ClientLinkData;
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class DeleteLinkPacket extends DimDoorsPacket {
|
||||
private ClientLinkData linkData;
|
||||
|
||||
public DeleteLinkPacket() {}
|
||||
public DeleteLinkPacket(ClientLinkData linkData) {
|
||||
this.linkData = linkData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(ByteArrayDataOutput out) {
|
||||
if (linkData != null) {
|
||||
try {
|
||||
linkData.write(out);
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(ByteArrayDataInput in) {
|
||||
try {
|
||||
linkData = ClientLinkData.read(in);
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleClient(World world, EntityPlayer player) {
|
||||
PocketManager.getLinkWatcher().onDeleted(linkData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleServer(World world, EntityPlayerMP player) {
|
||||
//Shouldn't be here
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package StevenDimDoors.mod_pocketDim.network;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.network.FMLEmbeddedChannel;
|
||||
import cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec;
|
||||
import cpw.mods.fml.common.network.FMLOutboundHandler;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandler;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.network.NetHandlerPlayServer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import java.util.EnumMap;
|
||||
|
||||
@ChannelHandler.Sharable
|
||||
public class DimDoorsNetwork extends FMLIndexedMessageToMessageCodec<DimDoorsPacket> {
|
||||
|
||||
private static final DimDoorsNetwork INSTANCE = new DimDoorsNetwork();
|
||||
private static final EnumMap<Side, FMLEmbeddedChannel> channels = Maps.newEnumMap(Side.class);
|
||||
|
||||
public static void init() {
|
||||
if (!channels.isEmpty())
|
||||
return;
|
||||
|
||||
INSTANCE.addDiscriminator(0, ClientJoinPacket.class);
|
||||
INSTANCE.addDiscriminator(1, CreateDimensionPacket.class);
|
||||
INSTANCE.addDiscriminator(2, DeleteDimensionPacket.class);
|
||||
INSTANCE.addDiscriminator(3, CreateLinkPacket.class);
|
||||
INSTANCE.addDiscriminator(4, DeleteLinkPacket.class);
|
||||
INSTANCE.addDiscriminator(5, UpdateLinkPacket.class);
|
||||
|
||||
channels.putAll(NetworkRegistry.INSTANCE.newChannel("DimDoors", INSTANCE));
|
||||
}
|
||||
|
||||
public void encodeInto(ChannelHandlerContext ctx, DimDoorsPacket msg, ByteBuf target) throws Exception {
|
||||
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||
msg.write(out);
|
||||
target.writeBytes(out.toByteArray());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decodeInto(ChannelHandlerContext ctx, ByteBuf source, DimDoorsPacket msg) {
|
||||
ByteArrayDataInput in = ByteStreams.newDataInput(source.array());
|
||||
|
||||
in.skipBytes(1);
|
||||
msg.read(in);
|
||||
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient())
|
||||
handleClient(msg);
|
||||
else
|
||||
handleServer(ctx, msg);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private void handleClient(DimDoorsPacket msg) {
|
||||
msg.handleClient(Minecraft.getMinecraft().theWorld, Minecraft.getMinecraft().thePlayer);
|
||||
}
|
||||
|
||||
private void handleServer(ChannelHandlerContext ctx, DimDoorsPacket msg) {
|
||||
EntityPlayerMP player = ((NetHandlerPlayServer)ctx.channel().attr(NetworkRegistry.NET_HANDLER).get()).playerEntity;
|
||||
msg.handleServer(player.worldObj, player);
|
||||
}
|
||||
|
||||
public static void sendToAllPlayers(DimDoorsPacket packet) {
|
||||
channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALL);
|
||||
channels.get(Side.SERVER).writeAndFlush(packet);
|
||||
}
|
||||
|
||||
public static void sendToServer(DimDoorsPacket packet) {
|
||||
channels.get(Side.CLIENT).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.TOSERVER);
|
||||
channels.get(Side.CLIENT).writeAndFlush(packet);
|
||||
}
|
||||
|
||||
public static void sendToPlayer(DimDoorsPacket packet, EntityPlayer player) {
|
||||
channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER);
|
||||
channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player);
|
||||
channels.get(Side.SERVER).writeAndFlush(packet);
|
||||
}
|
||||
|
||||
public static void sendToVicinity(DimDoorsPacket packet, TileEntity entity, double distance) {
|
||||
channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT);
|
||||
|
||||
NetworkRegistry.TargetPoint vicinity = new NetworkRegistry.TargetPoint(entity.getWorldObj().provider.dimensionId, entity.xCoord + 0.5, entity.yCoord + 0.5, entity.zCoord + 0.5, distance);
|
||||
channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(vicinity);
|
||||
channels.get(Side.SERVER).writeAndFlush(packet);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package StevenDimDoors.mod_pocketDim.network;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class DimDoorsPacket {
|
||||
public abstract void write(ByteArrayDataOutput out);
|
||||
public abstract void read(ByteArrayDataInput in);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public abstract void handleClient(World world, EntityPlayer player);
|
||||
|
||||
public abstract void handleServer(World world, EntityPlayerMP player);
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package StevenDimDoors.mod_pocketDim.network;
|
||||
|
||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||
import StevenDimDoors.mod_pocketDim.watcher.ClientLinkData;
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class UpdateLinkPacket extends DimDoorsPacket {
|
||||
private ClientLinkData linkData = null;
|
||||
|
||||
public UpdateLinkPacket() {}
|
||||
public UpdateLinkPacket(ClientLinkData linkData) {
|
||||
this.linkData = linkData;
|
||||
}
|
||||
@Override
|
||||
public void write(ByteArrayDataOutput out) {
|
||||
if (linkData != null) {
|
||||
try {
|
||||
linkData.write(out);
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(ByteArrayDataInput in) {
|
||||
try {
|
||||
linkData = ClientLinkData.read(in);
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleClient(World world, EntityPlayer player) {
|
||||
PocketManager.getLinkWatcher().update(linkData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleServer(World world, EntityPlayerMP player) {
|
||||
//Shouldn't be here
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
package StevenDimDoors.mod_pocketDim.schematic;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockComparator;
|
||||
import net.minecraft.block.BlockDoor;
|
||||
import net.minecraft.block.BlockRedstoneRepeater;
|
||||
import net.minecraft.block.BlockStairs;
|
||||
import net.minecraft.block.*;
|
||||
import StevenDimDoors.mod_pocketDim.Point3D;
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
import net.minecraft.init.Blocks;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class BlockRotator
|
||||
{
|
||||
@@ -17,65 +17,65 @@ public class BlockRotator
|
||||
private final static int BLOCK_ID_COUNT = 4096;
|
||||
|
||||
//Provides a fast lookup table for whether blocks have orientations
|
||||
private final static boolean[] hasOrientations = new boolean[BLOCK_ID_COUNT];
|
||||
private final static Map<Block, Boolean> hasOrientations = new HashMap<Block, Boolean>();
|
||||
|
||||
static
|
||||
public static void setupOrientations()
|
||||
{
|
||||
hasOrientations[Block.dispenser.blockID] = true;
|
||||
hasOrientations[Block.dropper.blockID] = true;
|
||||
hasOrientations[Block.stairsStoneBrick.blockID] = true;
|
||||
hasOrientations[Block.lever.blockID] = true;
|
||||
hasOrientations[Block.stoneButton.blockID] = true;
|
||||
hasOrientations[Block.woodenButton.blockID] = true;
|
||||
hasOrientations[Block.redstoneRepeaterIdle.blockID] = true;
|
||||
hasOrientations[Block.redstoneRepeaterActive.blockID] = true;
|
||||
hasOrientations[Block.tripWireSource.blockID] = true;
|
||||
hasOrientations[Block.torchWood.blockID] = true;
|
||||
hasOrientations[Block.torchRedstoneIdle.blockID] = true;
|
||||
hasOrientations[Block.torchRedstoneActive.blockID] = true;
|
||||
hasOrientations[Block.doorIron.blockID] = true;
|
||||
hasOrientations[Block.doorWood.blockID] = true;
|
||||
hasOrientations[Block.pistonBase.blockID] = true;
|
||||
hasOrientations[Block.pistonStickyBase.blockID] = true;
|
||||
hasOrientations[Block.pistonExtension.blockID] = true;
|
||||
hasOrientations[Block.redstoneComparatorIdle.blockID] = true;
|
||||
hasOrientations[Block.redstoneComparatorActive.blockID] = true;
|
||||
hasOrientations[Block.signPost.blockID] = true;
|
||||
hasOrientations[Block.signWall.blockID] = true;
|
||||
hasOrientations[Block.skull.blockID] = true;
|
||||
hasOrientations[Block.ladder.blockID] = true;
|
||||
hasOrientations[Block.vine.blockID] = true;
|
||||
hasOrientations[Block.anvil.blockID] = true;
|
||||
hasOrientations[Block.chest.blockID] = true;
|
||||
hasOrientations[Block.chestTrapped.blockID] = true;
|
||||
hasOrientations[Block.hopperBlock.blockID] = true;
|
||||
hasOrientations[Block.stairsNetherBrick.blockID] = true;
|
||||
hasOrientations[Block.stairsCobblestone.blockID] = true;
|
||||
hasOrientations[Block.stairsNetherQuartz.blockID] = true;
|
||||
hasOrientations[Block.stairsSandStone.blockID] = true;
|
||||
hasOrientations[Block.stairsBrick.blockID] = true;
|
||||
hasOrientations[Block.stairsWoodBirch.blockID] = true;
|
||||
hasOrientations[Block.stairsWoodOak.blockID] = true;
|
||||
hasOrientations[Block.stairsWoodJungle.blockID] = true;
|
||||
hasOrientations[Block.stairsWoodSpruce.blockID] = true;
|
||||
hasOrientations[Block.wood.blockID] = true;
|
||||
hasOrientations[Block.blockNetherQuartz.blockID] = true;
|
||||
hasOrientations[Block.railPowered.blockID] = true;
|
||||
hasOrientations[Block.railDetector.blockID] = true;
|
||||
hasOrientations[Block.railActivator.blockID] = true;
|
||||
hasOrientations[Block.rail.blockID] = true;
|
||||
hasOrientations[Block.furnaceBurning.blockID] = true;
|
||||
hasOrientations[Block.furnaceIdle.blockID] = true;
|
||||
hasOrientations[Block.bed.blockID] = true;
|
||||
|
||||
hasOrientations[mod_pocketDim.dimensionalDoor.blockID] = true;
|
||||
hasOrientations[mod_pocketDim.warpDoor.blockID] = true;
|
||||
hasOrientations[mod_pocketDim.goldenDimensionalDoor.blockID] = true;
|
||||
hasOrientations[mod_pocketDim.personalDimDoor.blockID] = true;
|
||||
hasOrientations.put(Blocks.dispenser, true);
|
||||
hasOrientations.put(Blocks.dropper, true);
|
||||
hasOrientations.put(Blocks.stone_brick_stairs, true);
|
||||
hasOrientations.put(Blocks.lever, true);
|
||||
hasOrientations.put(Blocks.stone_button, true);
|
||||
hasOrientations.put(Blocks.wooden_button, true);
|
||||
hasOrientations.put(Blocks.unpowered_repeater, true);
|
||||
hasOrientations.put(Blocks.powered_repeater, true);
|
||||
hasOrientations.put(Blocks.tripwire_hook, true);
|
||||
hasOrientations.put(Blocks.torch, true);
|
||||
hasOrientations.put(Blocks.redstone_torch, true);
|
||||
hasOrientations.put(Blocks.unlit_redstone_torch, true);
|
||||
hasOrientations.put(Blocks.iron_door, true);
|
||||
hasOrientations.put(Blocks.wooden_door, true);
|
||||
hasOrientations.put(Blocks.piston, true);
|
||||
hasOrientations.put(Blocks.sticky_piston, true);
|
||||
hasOrientations.put(Blocks.piston_head, true);
|
||||
hasOrientations.put(Blocks.powered_comparator, true);
|
||||
hasOrientations.put(Blocks.unpowered_comparator, true);
|
||||
hasOrientations.put(Blocks.standing_sign, true);
|
||||
hasOrientations.put(Blocks.wall_sign, true);
|
||||
hasOrientations.put(Blocks.skull, true);
|
||||
hasOrientations.put(Blocks.ladder, true);
|
||||
hasOrientations.put(Blocks.vine, true);
|
||||
hasOrientations.put(Blocks.anvil, true);
|
||||
hasOrientations.put(Blocks.chest, true);
|
||||
hasOrientations.put(Blocks.trapped_chest, true);
|
||||
hasOrientations.put(Blocks.hopper, true);
|
||||
hasOrientations.put(Blocks.nether_brick_stairs, true);
|
||||
hasOrientations.put(Blocks.stone_stairs, true);
|
||||
hasOrientations.put(Blocks.quartz_stairs, true);
|
||||
hasOrientations.put(Blocks.sandstone_stairs, true);
|
||||
hasOrientations.put(Blocks.brick_stairs, true);
|
||||
hasOrientations.put(Blocks.birch_stairs, true);
|
||||
hasOrientations.put(Blocks.oak_stairs, true);
|
||||
hasOrientations.put(Blocks.jungle_stairs, true);
|
||||
hasOrientations.put(Blocks.spruce_stairs, true);
|
||||
hasOrientations.put(Blocks.log, true);
|
||||
hasOrientations.put(Blocks.log2, true);
|
||||
hasOrientations.put(Blocks.quartz_block, true);
|
||||
hasOrientations.put(Blocks.rail, true);
|
||||
hasOrientations.put(Blocks.activator_rail, true);
|
||||
hasOrientations.put(Blocks.detector_rail, true);
|
||||
hasOrientations.put(Blocks.golden_rail, true);
|
||||
hasOrientations.put(Blocks.furnace, true);
|
||||
hasOrientations.put(Blocks.lit_furnace, true);
|
||||
hasOrientations.put(Blocks.bed, true);
|
||||
|
||||
hasOrientations.put(mod_pocketDim.dimensionalDoor, true);
|
||||
hasOrientations.put(mod_pocketDim.warpDoor, true);
|
||||
hasOrientations.put(mod_pocketDim.goldenDimensionalDoor, true);
|
||||
hasOrientations.put(mod_pocketDim.personalDimDoor, true);
|
||||
}
|
||||
|
||||
public static int transformMetadata(int metadata, int turns, int blockID)
|
||||
public static int transformMetadata(int metadata, int turns, Block block)
|
||||
{
|
||||
//I changed rotations to reduce the monstrous code we had. It might be
|
||||
//slightly less efficient, but it's easier to maintain for now. ~SenseiKiwi
|
||||
@@ -84,37 +84,37 @@ public class BlockRotator
|
||||
turns += 1 << 16;
|
||||
turns %= 4;
|
||||
|
||||
if (hasOrientations[blockID])
|
||||
if (hasOrientations.containsKey(block) && hasOrientations.get(block))
|
||||
{
|
||||
while (turns > 0)
|
||||
{
|
||||
metadata = rotateMetadataBy90(metadata, blockID);
|
||||
metadata = rotateMetadataBy90(metadata, block);
|
||||
turns--;
|
||||
}
|
||||
}
|
||||
return metadata;
|
||||
}
|
||||
|
||||
private static int rotateMetadataBy90(int metadata, int blockID)
|
||||
private static int rotateMetadataBy90(int metadata, Block block)
|
||||
{
|
||||
//TODO: Replace this horrible function with something prettier. We promise we will for the next version,
|
||||
//after switching to MC 1.6. PADRE, PLEASE FORGIVE OUR SINS.
|
||||
|
||||
if (blockID == Block.wood.blockID)
|
||||
if (block == Blocks.log || block == Blocks.log2)
|
||||
{
|
||||
if (metadata >= 4 && metadata < 12)
|
||||
{
|
||||
metadata = (metadata % 8) + 4;
|
||||
}
|
||||
}
|
||||
else if (blockID == Block.blockNetherQuartz.blockID)
|
||||
else if (block == Blocks.quartz_block)
|
||||
{
|
||||
if (metadata == 3 || metadata == 4)
|
||||
{
|
||||
metadata = (metadata - 2) % 2 + 3;
|
||||
}
|
||||
}
|
||||
else if (blockID == Block.railPowered.blockID || blockID == Block.railDetector.blockID || blockID == Block.railActivator.blockID)
|
||||
else if (block == Blocks.golden_rail || block == Blocks.detector_rail || block == Blocks.activator_rail)
|
||||
{
|
||||
switch (metadata)
|
||||
{
|
||||
@@ -159,7 +159,7 @@ public class BlockRotator
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (blockID==Block.rail.blockID)
|
||||
else if (block==Blocks.rail)
|
||||
{
|
||||
switch (metadata)
|
||||
{
|
||||
@@ -183,7 +183,7 @@ public class BlockRotator
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (blockID==Block.bed.blockID)
|
||||
else if (block==Blocks.bed)
|
||||
{
|
||||
switch (metadata)
|
||||
{
|
||||
@@ -213,7 +213,7 @@ public class BlockRotator
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (Block.blocksList[blockID] instanceof BlockStairs)
|
||||
else if (block instanceof BlockStairs)
|
||||
{
|
||||
|
||||
switch (metadata)
|
||||
@@ -244,7 +244,7 @@ public class BlockRotator
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (blockID == Block.chest.blockID || blockID == Block.chestTrapped.blockID || blockID == Block.ladder.blockID || blockID == Block.furnaceBurning.blockID|| blockID == Block.furnaceIdle.blockID)
|
||||
else if (block == Blocks.chest || block == Blocks.trapped_chest || block == Blocks.ladder || block == Blocks.lit_furnace || block == Blocks.furnace)
|
||||
{
|
||||
switch (metadata)
|
||||
{
|
||||
@@ -262,7 +262,7 @@ public class BlockRotator
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (blockID == Block.hopperBlock.blockID)
|
||||
else if (block == Blocks.hopper)
|
||||
{
|
||||
switch (metadata)
|
||||
{
|
||||
@@ -292,7 +292,7 @@ public class BlockRotator
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (blockID==Block.vine.blockID)
|
||||
else if (block==Blocks.vine)
|
||||
{
|
||||
switch (metadata)
|
||||
{
|
||||
@@ -311,7 +311,7 @@ public class BlockRotator
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (blockID==Block.signWall.blockID)
|
||||
else if (block==Blocks.wall_sign)
|
||||
{
|
||||
switch (metadata)
|
||||
{
|
||||
@@ -330,7 +330,7 @@ public class BlockRotator
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (blockID==Block.signPost.blockID)
|
||||
else if (block==Blocks.standing_sign)
|
||||
{
|
||||
switch (metadata)
|
||||
{
|
||||
@@ -384,7 +384,7 @@ public class BlockRotator
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(blockID== Block.lever.blockID || blockID == Block.stoneButton.blockID || blockID == Block.woodenButton.blockID || blockID== Block.torchWood.blockID||blockID== Block.torchRedstoneIdle.blockID||blockID== Block.torchRedstoneActive.blockID)
|
||||
else if(block== Blocks.lever || block == Blocks.stone_button || block == Blocks.wooden_button || block== Blocks.torch||block== Blocks.unlit_redstone_torch||block== Blocks.redstone_torch)
|
||||
{
|
||||
switch (metadata)
|
||||
{
|
||||
@@ -414,7 +414,7 @@ public class BlockRotator
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(blockID== Block.pistonBase.blockID||blockID==Block.pistonExtension.blockID||blockID==Block.pistonStickyBase.blockID || blockID == Block.dispenser.blockID || blockID == Block.dropper.blockID)
|
||||
else if(block== Blocks.piston||block==Blocks.piston_head||block==Blocks.sticky_piston || block == Blocks.dispenser || block == Blocks.dropper)
|
||||
{
|
||||
switch (metadata)
|
||||
{
|
||||
@@ -444,7 +444,7 @@ public class BlockRotator
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (Block.blocksList[blockID] instanceof BlockRedstoneRepeater || Block.blocksList[blockID] instanceof BlockDoor || blockID== Block.tripWireSource.blockID || Block.blocksList[blockID] instanceof BlockComparator)
|
||||
else if (block instanceof BlockRedstoneRepeater || block instanceof BlockDoor || block== Blocks.tripwire_hook || block instanceof BlockRedstoneComparator)
|
||||
{
|
||||
switch (metadata)
|
||||
{
|
||||
|
||||
@@ -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 block, int metadata)
|
||||
{
|
||||
if ((blockID == 0 && ignoreAir) || (blockID != 0 && Block.blocksList[blockID] == null))
|
||||
if (block.isAir(world, x, y, z) && ignoreAir)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -39,7 +39,7 @@ 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.func_150818_a(localX, y & 15, localZ, block);
|
||||
extBlockStorage.setExtBlockMetadata(localX, y & 15, localZ, metadata);
|
||||
chunk.setChunkModified();
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package StevenDimDoors.mod_pocketDim.schematic;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IBlockSetter
|
||||
{
|
||||
public void setBlock(World world, int x, int y, int z, int blockID, int metadata);
|
||||
public void setBlock(World world, int x, int y, int z, Block block, int metadata);
|
||||
}
|
||||
|
||||
@@ -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,7 +53,7 @@ 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)
|
||||
{
|
||||
|
||||
@@ -6,11 +6,14 @@ import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.nbt.NBTTagString;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
@@ -27,12 +30,23 @@ 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, String[] blockPalette, short[] blockIds, byte[] metadata, NBTTagList tileEntities)
|
||||
{
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.length = length;
|
||||
this.metadata = metadata;
|
||||
this.tileEntities = tileEntities;
|
||||
|
||||
if (blockPalette != null)
|
||||
loadBlockList(blockPalette, blockIds);
|
||||
}
|
||||
|
||||
protected Schematic(short width, short height, short length, Block[] blocks, byte[] metadata, NBTTagList tileEntities) {
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.length = length;
|
||||
@@ -53,6 +67,20 @@ public class Schematic {
|
||||
this.tileEntities = source.tileEntities;
|
||||
}
|
||||
|
||||
private void loadBlockList(String[] blockPalette, short[] blockIds) {
|
||||
this.blocks = new Block[blockIds.length];
|
||||
|
||||
Block[] blockObjPalette = new Block[blockPalette.length];
|
||||
|
||||
for (int i = 0; i < blockPalette.length; i++) {
|
||||
blockObjPalette[i] = (Block)Block.blockRegistry.getObject(blockPalette[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < blockIds.length; i++) {
|
||||
this.blocks[i] = blockObjPalette[blockIds[i]];
|
||||
}
|
||||
}
|
||||
|
||||
public int calculateIndex(int x, int y, int z)
|
||||
{
|
||||
if (x < 0 || x >= width)
|
||||
@@ -96,9 +124,9 @@ public class Schematic {
|
||||
return length;
|
||||
}
|
||||
|
||||
public short getBlockID(int x, int y, int z)
|
||||
public Block getBlock(int x, int y, int z)
|
||||
{
|
||||
return blocks[calculateIndex(x, y, z)];
|
||||
return (Block)Block.blockRegistry.getObject(blocks[calculateIndex(x, y, z)]);
|
||||
}
|
||||
|
||||
public byte getBlockMetadata(int x, int y, int z)
|
||||
@@ -124,9 +152,7 @@ public class Schematic {
|
||||
|
||||
public static Schematic readFromResource(String resourcePath) throws InvalidSchematicException
|
||||
{
|
||||
//We need an instance of a class in the mod to retrieve a resource
|
||||
Schematic empty = new Schematic((short) 0, (short) 0, (short) 0, null, null, null);
|
||||
InputStream schematicStream = empty.getClass().getResourceAsStream(resourcePath);
|
||||
InputStream schematicStream = Schematic.class.getResourceAsStream(resourcePath);
|
||||
return readFromStream(schematicStream);
|
||||
}
|
||||
|
||||
@@ -141,7 +167,8 @@ public class Schematic {
|
||||
byte[] metadata = null; //block metadata
|
||||
byte[] lowBits = null; //first 8 bits of the block IDs
|
||||
byte[] highBits = null; //additional 4 bits of the block IDs
|
||||
short[] blocks = null; //list of combined block IDs
|
||||
short[] blockIds = null; //list of combined block IDs
|
||||
String[] blockPalette = null;
|
||||
NBTTagList tileEntities = null; //storage for tile entities in NBT form
|
||||
NBTTagCompound schematicTag; //the NBT data extracted from the schematic file
|
||||
boolean hasExtendedBlockIDs; //indicates whether the schematic contains extended block IDs
|
||||
@@ -173,6 +200,19 @@ public class Schematic {
|
||||
if (length < 0)
|
||||
throw new InvalidSchematicException("The schematic cannot have a negative length.");
|
||||
|
||||
|
||||
NBTTagList nbtPalette = schematicTag.getTagList("Palette", 8);
|
||||
|
||||
if (nbtPalette.tagCount() < 1) {
|
||||
throw new InvalidSchematicException("The schematic must have a valid block palette.");
|
||||
}
|
||||
|
||||
blockPalette = new String[nbtPalette.tagCount()];
|
||||
|
||||
for (int i = 0; i < nbtPalette.tagCount(); i++) {
|
||||
blockPalette[i] = nbtPalette.getStringTagAt(i);
|
||||
}
|
||||
|
||||
//load block info
|
||||
lowBits = schematicTag.getByteArray("Blocks");
|
||||
highBits = schematicTag.getByteArray("AddBlocks");
|
||||
@@ -186,7 +226,7 @@ public class Schematic {
|
||||
if (volume > 2 * highBits.length && hasExtendedBlockIDs)
|
||||
throw new InvalidSchematicException("The schematic has extended block IDs for fewer blocks than its dimensions indicate.");
|
||||
|
||||
blocks = new short[volume];
|
||||
blockIds = new short[volume];
|
||||
if (hasExtendedBlockIDs)
|
||||
{
|
||||
//Combine the split block IDs into a single value
|
||||
@@ -194,12 +234,12 @@ public class Schematic {
|
||||
int index;
|
||||
for (index = 0; index < pairs; index += 2)
|
||||
{
|
||||
blocks[index] = (short) (((highBits[index >> 1] & 0x0F) << 8) + (lowBits[index] & 0xFF));
|
||||
blocks[index + 1] = (short) (((highBits[index >> 1] & 0xF0) << 4) + (lowBits[index + 1] & 0xFF));
|
||||
blockIds[index] = (short) (((highBits[index >> 1] & 0x0F) << 8) + (lowBits[index] & 0xFF));
|
||||
blockIds[index + 1] = (short) (((highBits[index >> 1] & 0xF0) << 4) + (lowBits[index + 1] & 0xFF));
|
||||
}
|
||||
if (index < volume)
|
||||
{
|
||||
blocks[index] = lowBits[index >> 1];
|
||||
blockIds[index] = lowBits[index >> 1];
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -207,14 +247,21 @@ public class Schematic {
|
||||
//Copy the blockIDs
|
||||
for (int index = 0; index < volume; index++)
|
||||
{
|
||||
blocks[index] = (short) (lowBits[index] & 0xFF);
|
||||
blockIds[index] = (short) (lowBits[index] & 0xFF);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < blockIds.length; i++) {
|
||||
int paletteIndex = blockIds[i];
|
||||
if (paletteIndex < 0 || paletteIndex >= blockPalette.length) {
|
||||
throw new InvalidSchematicException("Block entry referenced a non-existant palette entry.");
|
||||
}
|
||||
}
|
||||
|
||||
//Get the list of tile entities
|
||||
tileEntities = schematicTag.getTagList("TileEntities");
|
||||
tileEntities = schematicTag.getTagList("TileEntities", 10);
|
||||
|
||||
Schematic result = new Schematic(width, height, length, blocks, metadata, tileEntities);
|
||||
Schematic result = new Schematic(width, height, length, blockPalette, blockIds, metadata, tileEntities);
|
||||
return result;
|
||||
}
|
||||
catch (InvalidSchematicException ex)
|
||||
@@ -266,7 +313,7 @@ public class Schematic {
|
||||
//Short and sweet ^_^
|
||||
WorldCopyOperation copier = new WorldCopyOperation();
|
||||
copier.apply(world, x, y, z, width, height, length);
|
||||
return new Schematic(width, height, length, copier.getBlockIDs(), copier.getMetadata(), copier.getTileEntities());
|
||||
return new Schematic(width, height, length, copier.getBlocks(), copier.getMetadata(), copier.getTileEntities());
|
||||
}
|
||||
|
||||
private static boolean encodeBlockIDs(short[] blocks, byte[] lowBits, byte[] highBits)
|
||||
@@ -291,6 +338,20 @@ public class Schematic {
|
||||
return hasHighBits;
|
||||
}
|
||||
|
||||
private static void reduceToPalette(Block[] blocks, List<String> blockPalette, short[] blockIds) {
|
||||
for (int i = 0; i < blocks.length; i++) {
|
||||
String blockName = Block.blockRegistry.getNameForObject(blocks[i]);
|
||||
int blockIndex = blockPalette.indexOf(blockName);
|
||||
|
||||
if (blockIndex < 0) {
|
||||
blockIndex = blockPalette.size();
|
||||
blockPalette.add(blockName);
|
||||
}
|
||||
|
||||
blockIds[i] = (short)blockIndex;
|
||||
}
|
||||
}
|
||||
|
||||
public NBTTagCompound writeToNBT()
|
||||
{
|
||||
return writeToNBT(true);
|
||||
@@ -301,13 +362,13 @@ 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.
|
||||
|
||||
NBTTagCompound schematicTag = new NBTTagCompound("Schematic");
|
||||
NBTTagCompound schematicTag = new NBTTagCompound();
|
||||
|
||||
schematicTag.setShort("Width", width);
|
||||
schematicTag.setShort("Length", length);
|
||||
@@ -316,9 +377,13 @@ public class Schematic {
|
||||
schematicTag.setTag("Entities", new NBTTagList());
|
||||
schematicTag.setString("Materials", "Alpha");
|
||||
|
||||
List<String> blockPalette = new LinkedList<String>();
|
||||
short[] blockIds = new short[blocks.length];
|
||||
reduceToPalette(blocks, blockPalette, blockIds);
|
||||
|
||||
byte[] lowBits = new byte[blocks.length];
|
||||
byte[] highBits = new byte[(blocks.length >> 1) + (blocks.length & 1)];
|
||||
boolean hasExtendedIDs = encodeBlockIDs(blocks, lowBits, highBits);
|
||||
boolean hasExtendedIDs = encodeBlockIDs(blockIds, lowBits, highBits);
|
||||
|
||||
schematicTag.setByteArray("Blocks", lowBits);
|
||||
schematicTag.setByteArray("Data", metadata);
|
||||
@@ -400,7 +465,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 +474,7 @@ 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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -21,11 +21,11 @@ public class WorldBlockSetter implements IBlockSetter
|
||||
this.ignoreAir = ignoreAir;
|
||||
}
|
||||
|
||||
public void setBlock(World world, int x, int y, int z, int blockID, int metadata)
|
||||
public void setBlock(World world, int x, int y, int z, Block block, int metadata)
|
||||
{
|
||||
if (!ignoreAir || blockID != 0)
|
||||
if (!ignoreAir || !block.isAir(world,x,y,z))
|
||||
{
|
||||
world.setBlock(x, y, z, blockID, metadata, flags);
|
||||
world.setBlock(x, y, z, block, metadata, flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,14 +12,14 @@ public class WorldCopyOperation extends WorldOperation
|
||||
private int originY;
|
||||
private int originZ;
|
||||
private int index;
|
||||
private short[] blockIDs;
|
||||
private Block[] blocks;
|
||||
private byte[] metadata;
|
||||
private NBTTagList tileEntities;
|
||||
|
||||
public WorldCopyOperation()
|
||||
{
|
||||
super("WorldCopyOperation");
|
||||
blockIDs = null;
|
||||
blocks = null;
|
||||
metadata = null;
|
||||
tileEntities = null;
|
||||
}
|
||||
@@ -30,7 +31,7 @@ public class WorldCopyOperation extends WorldOperation
|
||||
originX = x;
|
||||
originY = y;
|
||||
originZ = z;
|
||||
blockIDs = new short[width * height * length];
|
||||
blocks = 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);
|
||||
blocks[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,9 +60,9 @@ public class WorldCopyOperation extends WorldOperation
|
||||
return true;
|
||||
}
|
||||
|
||||
public short[] getBlockIDs()
|
||||
public Block[] getBlocks()
|
||||
{
|
||||
return blockIDs;
|
||||
return blocks;
|
||||
}
|
||||
|
||||
public byte[] getMetadata()
|
||||
|
||||
@@ -3,7 +3,9 @@ package StevenDimDoors.mod_pocketDim.ticking;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.world.GameRules;
|
||||
import net.minecraft.world.World;
|
||||
@@ -99,7 +101,7 @@ public class CustomLimboPopulator implements IRegularTickReceiver {
|
||||
}
|
||||
|
||||
int sanity = 0;
|
||||
int blockID = 0;
|
||||
Block block = Blocks.air;
|
||||
boolean didSpawn = false;
|
||||
|
||||
//The following initialization code is based on code from ChunkProviderGenerate.
|
||||
@@ -117,23 +119,23 @@ public class CustomLimboPopulator implements IRegularTickReceiver {
|
||||
x = chunkX * CHUNK_SIZE + random.nextInt(CHUNK_SIZE);
|
||||
z = chunkZ * CHUNK_SIZE + random.nextInt(CHUNK_SIZE);
|
||||
y = MAX_MONOLITH_SPAWN_Y;
|
||||
blockID = pocket.getBlockId(x, y, z);
|
||||
block = pocket.getBlock(x, y, z);
|
||||
|
||||
while (blockID == 0 &&y>0)
|
||||
while (block.isAir(pocket, x, y, z) &&y>0)
|
||||
{
|
||||
y--;
|
||||
blockID = pocket.getBlockId(x, y, z);
|
||||
block = pocket.getBlock(x, y, z);
|
||||
|
||||
}
|
||||
while ((blockID == properties.FabricBlockID || blockID == properties.PermaFabricBlockID) && y > 0)
|
||||
while ((block == mod_pocketDim.blockDimWall || block == mod_pocketDim.blockDimWallPerm) && y > 0)
|
||||
{
|
||||
y--;
|
||||
blockID = pocket.getBlockId(x, y, z);
|
||||
block = pocket.getBlock(x, y, z);
|
||||
}
|
||||
while (blockID == 0 && y > 0)
|
||||
while (block.isAir(pocket, x, y, z) && y > 0)
|
||||
{
|
||||
y--;
|
||||
blockID = pocket.getBlockId(x, y, z);
|
||||
block = pocket.getBlock(x, y, z);
|
||||
}
|
||||
if(y > 0)
|
||||
{
|
||||
@@ -175,7 +177,7 @@ public class CustomLimboPopulator implements IRegularTickReceiver {
|
||||
int x = chunkX * CHUNK_SIZE + random.nextInt(CHUNK_SIZE);
|
||||
int z = chunkZ * CHUNK_SIZE + random.nextInt(CHUNK_SIZE);
|
||||
|
||||
while (limbo.getBlockId(x, y, z) == 0 && y <255)
|
||||
while (limbo.getBlock(x, y, z).isAir(limbo, x, y, z) && y <255)
|
||||
{
|
||||
y++;
|
||||
}
|
||||
|
||||
@@ -50,6 +50,10 @@ public class MobMonolith extends EntityFlying implements IMob
|
||||
properties = DDProperties.instance();
|
||||
}
|
||||
|
||||
public boolean isDangerous() {
|
||||
return properties.MonolithTeleportationEnabled && (properties.LimboDimensionID != worldObj.provider.dimensionId || !properties.DangerousLimboMonolithsDisabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void damageEntity(DamageSource par1DamageSource, float par2)
|
||||
{
|
||||
@@ -94,7 +98,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
|
||||
@@ -127,7 +131,7 @@ public class MobMonolith extends EntityFlying implements IMob
|
||||
public void onEntityUpdate()
|
||||
{
|
||||
// Remove this Monolith if it's not in Limbo or in a pocket dimension
|
||||
if (!(this.worldObj.provider instanceof LimboProvider || this.worldObj.provider instanceof PocketProvider))
|
||||
if (!(this.worldObj.provider.dimensionId == properties.LimboDimensionID|| this.worldObj.provider instanceof PocketProvider))
|
||||
{
|
||||
this.setDead();
|
||||
super.onEntityUpdate();
|
||||
@@ -145,7 +149,7 @@ public class MobMonolith extends EntityFlying implements IMob
|
||||
if (player != null)
|
||||
{
|
||||
this.facePlayer(player);
|
||||
if (!this.worldObj.isRemote && !(this.worldObj.provider instanceof LimboProvider))
|
||||
if (!this.worldObj.isRemote && isDangerous())
|
||||
{
|
||||
// Play sounds on the server side, if the player isn't in Limbo.
|
||||
// Limbo is excluded to avoid drowning out its background music.
|
||||
@@ -158,7 +162,7 @@ public class MobMonolith extends EntityFlying implements IMob
|
||||
if (visibility)
|
||||
{
|
||||
// Only spawn particles on the client side and outside Limbo
|
||||
if (this.worldObj.isRemote && !(this.worldObj.provider instanceof LimboProvider))
|
||||
if (this.worldObj.isRemote && isDangerous())
|
||||
{
|
||||
this.spawnParticles(player);
|
||||
}
|
||||
@@ -166,7 +170,7 @@ public class MobMonolith extends EntityFlying implements IMob
|
||||
// Teleport the target player if various conditions are met
|
||||
if (aggro >= MAX_AGGRO && !this.worldObj.isRemote &&
|
||||
properties.MonolithTeleportationEnabled && !player.capabilities.isCreativeMode &&
|
||||
!(this.worldObj.provider instanceof LimboProvider))
|
||||
isDangerous())
|
||||
{
|
||||
this.aggro = 0;
|
||||
Point4D destination = LimboProvider.getLimboSkySpawn(player, properties);
|
||||
@@ -187,9 +191,12 @@ public class MobMonolith extends EntityFlying implements IMob
|
||||
// Rapidly increase the aggro level if this Monolith can see the player
|
||||
if (visibility)
|
||||
{
|
||||
if (this.worldObj.provider instanceof LimboProvider)
|
||||
if (this.worldObj.provider.dimensionId == properties.LimboDimensionID)
|
||||
{
|
||||
if (isDangerous())
|
||||
aggro++;
|
||||
else
|
||||
aggro += 36;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -199,19 +206,20 @@ public class MobMonolith extends EntityFlying implements IMob
|
||||
}
|
||||
else
|
||||
{
|
||||
if (aggro > aggroCap)
|
||||
{
|
||||
if (isDangerous()) {
|
||||
if (aggro > aggroCap) {
|
||||
// Decrease aggro over time
|
||||
aggro--;
|
||||
}
|
||||
else if (player != null && (aggro < aggroCap))
|
||||
{
|
||||
} else if (player != null && (aggro < aggroCap)) {
|
||||
// Increase aggro if a player is within range and aggro < aggroCap
|
||||
aggro++;
|
||||
}
|
||||
} else
|
||||
aggro -= 3;
|
||||
}
|
||||
// Clamp the aggro level
|
||||
aggro = (short) MathHelper.clamp_int(aggro, 0, MAX_AGGRO);
|
||||
int maxAggro = isDangerous()?MAX_AGGRO:180;
|
||||
aggro = (short) MathHelper.clamp_int(aggro, 0, maxAggro);
|
||||
this.dataWatcher.updateObject(AGGRO_WATCHER_INDEX, Short.valueOf(aggro));
|
||||
}
|
||||
else
|
||||
|
||||
@@ -3,6 +3,7 @@ package StevenDimDoors.mod_pocketDim.ticking;
|
||||
import java.util.PriorityQueue;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
@@ -112,9 +113,9 @@ public class RiftRegenerator implements IRegularTickReceiver {
|
||||
else
|
||||
{
|
||||
// All of the necessary conditions have been met. Restore the rift!
|
||||
int blockID = world.getBlockId(x, y, z);
|
||||
if (world.setBlock(x, y, z, blockRift.blockID))
|
||||
blockRift.dropWorldThread(blockID, world, x, y, z, random);
|
||||
Block block = world.getBlock(x, y, z);
|
||||
if (world.setBlock(x, y, z, blockRift))
|
||||
blockRift.dropWorldThread(block, world, x, y, z, random);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
package StevenDimDoors.mod_pocketDim.ticking;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import StevenDimDoors.mod_pocketDim.core.DDTeleporter;
|
||||
import cpw.mods.fml.common.ITickHandler;
|
||||
import cpw.mods.fml.common.TickType;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
public class ServerTickHandler implements ITickHandler, IRegularTickSender
|
||||
public class ServerTickHandler implements IRegularTickSender
|
||||
{
|
||||
private static final String PROFILING_LABEL = "Dimensional Doors: Server Tick";
|
||||
|
||||
@@ -32,10 +34,19 @@ public class ServerTickHandler implements ITickHandler, IRegularTickSender
|
||||
receivers.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tickStart(EnumSet<TickType> type, Object... tickData)
|
||||
{
|
||||
if (type.equals(EnumSet.of(TickType.SERVER)))
|
||||
@SubscribeEvent
|
||||
public void tickEvent(TickEvent event) {
|
||||
if (event.side != Side.SERVER)
|
||||
return;
|
||||
|
||||
if (event.phase == TickEvent.Phase.START)
|
||||
tickStart(event.type);
|
||||
else if (event.phase == TickEvent.Phase.END)
|
||||
tickEnd(event.type);
|
||||
}
|
||||
|
||||
private void tickStart(TickEvent.Type type) {
|
||||
if (type.equals(EnumSet.of(TickEvent.Type.SERVER)))
|
||||
{
|
||||
for (RegularTickReceiverInfo info : receivers)
|
||||
{
|
||||
@@ -54,8 +65,7 @@ public class ServerTickHandler implements ITickHandler, IRegularTickSender
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tickEnd(EnumSet<TickType> type, Object... tickData)
|
||||
private void tickEnd(TickEvent.Type type)
|
||||
{
|
||||
for (RegularTickReceiverInfo info : receivers)
|
||||
{
|
||||
@@ -66,16 +76,4 @@ public class ServerTickHandler implements ITickHandler, IRegularTickSender
|
||||
}
|
||||
tickCount++; //There is no need to reset the counter. Let it overflow.
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumSet<TickType> ticks()
|
||||
{
|
||||
return EnumSet.of(TickType.SERVER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLabel()
|
||||
{
|
||||
return PROFILING_LABEL; //Used for profiling!
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,21 +2,17 @@ package StevenDimDoors.mod_pocketDim.tileentities;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import StevenDimDoors.mod_pocketDim.network.CreateLinkPacket;
|
||||
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.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
|
||||
|
||||
public class TileEntityDimDoor extends DDTileEntityBase
|
||||
@@ -37,11 +33,27 @@ public class TileEntityDimDoor extends DDTileEntityBase
|
||||
@Override
|
||||
public Packet getDescriptionPacket()
|
||||
{
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
writeToNBT(tag);
|
||||
if(PocketManager.getLink(xCoord, yCoord, zCoord, worldObj)!=null)
|
||||
{
|
||||
return ServerPacketHandler.createLinkPacket(new ClientLinkData(PocketManager.getLink(xCoord, yCoord, zCoord, worldObj)));
|
||||
ClientLinkData linkData = new ClientLinkData(PocketManager.getLink(xCoord, yCoord, zCoord, worldObj));
|
||||
NBTTagCompound link = new NBTTagCompound();
|
||||
linkData.writeToNBT(link);
|
||||
tag.setTag("Link", link);
|
||||
}
|
||||
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||
NBTTagCompound tag = pkt.func_148857_g();
|
||||
readFromNBT(tag);
|
||||
|
||||
if (tag.hasKey("Link")) {
|
||||
ClientLinkData linkData = ClientLinkData.readFromNBT(tag.getCompoundTag("Link"));
|
||||
PocketManager.getLinkWatcher().onCreated(linkData);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,13 +3,15 @@ package StevenDimDoors.mod_pocketDim.tileentities;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import StevenDimDoors.mod_pocketDim.network.CreateLinkPacket;
|
||||
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.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import StevenDimDoors.mod_pocketDim.ServerPacketHandler;
|
||||
@@ -19,8 +21,6 @@ import StevenDimDoors.mod_pocketDim.core.DimLink;
|
||||
import StevenDimDoors.mod_pocketDim.core.NewDimData;
|
||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||
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;
|
||||
|
||||
public class TileEntityRift extends DDTileEntityBase
|
||||
@@ -49,7 +49,6 @@ public class TileEntityRift extends DDTileEntityBase
|
||||
public int spawnedEndermenID = 0;
|
||||
|
||||
public int riftRotation = random.nextInt(360);
|
||||
public int renderKey = random.nextInt(LSystem.curves.size());
|
||||
public float growth = 0;
|
||||
|
||||
public TileEntityRift()
|
||||
@@ -65,7 +64,7 @@ public class TileEntityRift extends DDTileEntityBase
|
||||
{
|
||||
if (PocketManager.getLink(xCoord, yCoord, zCoord, worldObj.provider.dimensionId) == null)
|
||||
{
|
||||
if (worldObj.getBlockId(xCoord, yCoord, zCoord) == mod_pocketDim.blockRift.blockID)
|
||||
if (worldObj.getBlock(xCoord, yCoord, zCoord) == mod_pocketDim.blockRift)
|
||||
{
|
||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
}
|
||||
@@ -76,7 +75,7 @@ public class TileEntityRift extends DDTileEntityBase
|
||||
return;
|
||||
}
|
||||
|
||||
if (worldObj.getBlockId(xCoord, yCoord, zCoord) != mod_pocketDim.blockRift.blockID)
|
||||
if (worldObj.getBlock(xCoord, yCoord, zCoord) != mod_pocketDim.blockRift)
|
||||
{
|
||||
invalidate();
|
||||
return;
|
||||
@@ -154,18 +153,18 @@ public class TileEntityRift extends DDTileEntityBase
|
||||
for (DimLink riftLink : dimension.findRiftsInRange(worldObj, 6, xCoord, yCoord, zCoord))
|
||||
{
|
||||
Point4D location = riftLink.source();
|
||||
TileEntityRift rift = (TileEntityRift) worldObj.getBlockTileEntity(location.getX(), location.getY(), location.getZ());
|
||||
TileEntityRift rift = (TileEntityRift) worldObj.getTileEntity(location.getX(), location.getY(), location.getZ());
|
||||
if (rift != null && !rift.shouldClose)
|
||||
{
|
||||
rift.shouldClose = true;
|
||||
rift.onInventoryChanged();
|
||||
rift.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (growth == 0 && !worldObj.isRemote)
|
||||
if (growth <= 0 && !worldObj.isRemote)
|
||||
{
|
||||
DimLink link = PocketManager.getLink(this.xCoord, this.yCoord, this.zCoord, worldObj);
|
||||
if (link != null)
|
||||
if (link != null && !worldObj.isRemote)
|
||||
{
|
||||
dimension.deleteLink(link);
|
||||
}
|
||||
@@ -207,7 +206,7 @@ public class TileEntityRift extends DDTileEntityBase
|
||||
this.yOffset = 0;
|
||||
this.xOffset = 0;
|
||||
}
|
||||
this.onInventoryChanged();
|
||||
this.markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -263,7 +262,6 @@ public class TileEntityRift extends DDTileEntityBase
|
||||
this.shouldClose = nbt.getBoolean("shouldClose");
|
||||
this.spawnedEndermenID = nbt.getInteger("spawnedEndermenID");
|
||||
this.riftRotation = nbt.getInteger("riftRotation");
|
||||
this.renderKey = nbt.getInteger("renderKey");
|
||||
this.growth = nbt.getFloat("growth");
|
||||
|
||||
}
|
||||
@@ -278,7 +276,6 @@ public class TileEntityRift extends DDTileEntityBase
|
||||
nbt.setInteger("zOffset", this.zOffset);
|
||||
nbt.setBoolean("shouldClose", this.shouldClose);
|
||||
nbt.setInteger("spawnedEndermenID", this.spawnedEndermenID);
|
||||
nbt.setInteger("renderKey", this.renderKey);
|
||||
nbt.setInteger("riftRotation", this.riftRotation);
|
||||
nbt.setFloat("growth", this.growth);
|
||||
|
||||
@@ -287,17 +284,30 @@ public class TileEntityRift extends DDTileEntityBase
|
||||
@Override
|
||||
public Packet getDescriptionPacket()
|
||||
{
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
writeToNBT(tag);
|
||||
|
||||
if(PocketManager.getLink(xCoord, yCoord, zCoord, worldObj)!=null)
|
||||
{
|
||||
return ServerPacketHandler.createLinkPacket(new ClientLinkData(PocketManager.getLink(xCoord, yCoord, zCoord, worldObj)));
|
||||
ClientLinkData linkData = new ClientLinkData(PocketManager.getLink(xCoord, yCoord, zCoord, worldObj));
|
||||
|
||||
NBTTagCompound link = new NBTTagCompound();
|
||||
linkData.writeToNBT(link);
|
||||
|
||||
tag.setTag("Link", link);
|
||||
}
|
||||
return null;
|
||||
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(INetworkManager net, Packet132TileEntityData pkt)
|
||||
{
|
||||
readFromNBT(pkt.data);
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||
NBTTagCompound tag = pkt.func_148857_g();
|
||||
readFromNBT(tag);
|
||||
|
||||
if (tag.hasKey("Link")) {
|
||||
ClientLinkData linkData = ClientLinkData.readFromNBT(tag.getCompoundTag("Link"));
|
||||
PocketManager.getLinkWatcher().onCreated(linkData);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -305,11 +315,4 @@ public class TileEntityRift extends DDTileEntityBase
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public PolygonStorage getCurve()
|
||||
{
|
||||
|
||||
|
||||
return (LSystem.curves.get(renderKey));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package StevenDimDoors.mod_pocketDim.util;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.*;
|
||||
|
||||
import StevenDimDoors.mod_pocketDim.Point3D;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
|
||||
public final class Point4D implements Comparable<Point4D>
|
||||
@@ -180,7 +179,16 @@ public final class Point4D implements Comparable<Point4D>
|
||||
return "(" + x + ", " + y + ", " + z + ", " + dimension + ")";
|
||||
}
|
||||
|
||||
public static void write(Point4D point, DataOutputStream stream) throws IOException
|
||||
public static void writeToNBT(Point4D point, NBTTagCompound tag) {
|
||||
if (point != null) {
|
||||
tag.setInteger("X", point.x);
|
||||
tag.setInteger("Y", point.y);
|
||||
tag.setInteger("Z", point.z);
|
||||
tag.setInteger("Dimension", point.dimension);
|
||||
}
|
||||
}
|
||||
|
||||
public static void write(Point4D point, DataOutput stream) throws IOException
|
||||
{
|
||||
stream.writeBoolean(point != null);
|
||||
if (point != null)
|
||||
@@ -192,7 +200,7 @@ public final class Point4D implements Comparable<Point4D>
|
||||
}
|
||||
}
|
||||
|
||||
public static Point4D read(DataInputStream stream) throws IOException
|
||||
public static Point4D read(DataInput stream) throws IOException
|
||||
{
|
||||
if (stream.readBoolean())
|
||||
{
|
||||
@@ -203,4 +211,8 @@ public final class Point4D implements Comparable<Point4D>
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static Point4D readFromNBT(NBTTagCompound tag) {
|
||||
return new Point4D(tag.getInteger("X"), tag.getInteger("Y"), tag.getInteger("Z"), tag.getInteger("Dimension"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package StevenDimDoors.mod_pocketDim.util;
|
||||
|
||||
import net.minecraft.util.WeightedRandomItem;
|
||||
import net.minecraft.util.WeightedRandom;
|
||||
|
||||
/*.
|
||||
* Implements a simple generic item for using net.minecraft.util.WeightedRandom with objects of type T.
|
||||
@@ -9,7 +9,7 @@ import net.minecraft.util.WeightedRandomItem;
|
||||
* extending WeightedRandomItem or cases in which we would have to break compatibility with previous serialized
|
||||
* instances to add support for WeightedRandomItem.
|
||||
*/
|
||||
public class WeightedContainer<T> extends WeightedRandomItem {
|
||||
public class WeightedContainer<T> extends WeightedRandom.Item {
|
||||
|
||||
private T data;
|
||||
|
||||
|
||||
@@ -1,557 +0,0 @@
|
||||
package StevenDimDoors.mod_pocketDim.util.l_systems;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import javax.swing.SwingUtilities;
|
||||
import org.poly2tri.Poly2Tri;
|
||||
import org.poly2tri.geometry.polygon.Polygon;
|
||||
import org.poly2tri.geometry.polygon.PolygonPoint;
|
||||
import org.poly2tri.triangulation.TriangulationPoint;
|
||||
import org.poly2tri.triangulation.delaunay.DelaunayTriangle;
|
||||
|
||||
|
||||
public class LSystem
|
||||
{
|
||||
public static ArrayList<PolygonStorage> curves = new ArrayList<PolygonStorage>();
|
||||
|
||||
/**
|
||||
* An array containing the args to generate a curve.
|
||||
* index 0 = rules
|
||||
* index 1 = angle
|
||||
* index 2 = start string
|
||||
*/
|
||||
public static final String[] TERDRAGON = {"F>+F----F++++F-","60","F"};
|
||||
public static final String[] DRAGON = {"X>X+YF:Y>FX-Y","90","FX"};
|
||||
public static final String[] TWINDRAGON = {"X>X+YF:Y>FX-Y","90","FX--FX"};
|
||||
public static final String[] VORTEX = {"X>X+YF:Y>FX-Y","90","FX---FX"};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Generates a fractal curve
|
||||
* @param args: 0 = rules, 1 = angle, 2 = start
|
||||
* @param steps
|
||||
* @return
|
||||
*/
|
||||
public static void generateLSystem(String key, String[] args, int steps)
|
||||
{
|
||||
//Parse the rules from the first index
|
||||
String[] rules = args[0].split(":");
|
||||
HashMap<String, String> lSystemsRule = new HashMap<String, String>();
|
||||
|
||||
for (String rule : rules)
|
||||
{
|
||||
String[] parts = rule.split(">");
|
||||
lSystemsRule.put(parts[0], parts[1]);
|
||||
}
|
||||
|
||||
//get the angle for each turn
|
||||
int angle = Integer.parseInt(args[1]);
|
||||
|
||||
|
||||
//String to hold the output
|
||||
//Initialize with starting string
|
||||
String output = args[2];
|
||||
|
||||
//generate the l-system
|
||||
output = (generate(args[2], steps, lSystemsRule));
|
||||
|
||||
//get the boundary of the polygon
|
||||
PolygonStorage polygon = getBoundary(convertToPoints(angle, output, (steps)));
|
||||
|
||||
//replace the boundary of the polygon with a series of points representing triangles for rendering
|
||||
polygon.points = tesselate(polygon);
|
||||
|
||||
curves.add(polygon);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Naively returns all of the points comprising the fractal
|
||||
* @param input
|
||||
* @return
|
||||
*/
|
||||
public static PolygonStorage getSpaceFillingCurve(ArrayList<double[]> input)
|
||||
{
|
||||
// store max x and y values to create bounding box
|
||||
int maxY = Integer.MIN_VALUE;
|
||||
int maxX = Integer.MIN_VALUE;
|
||||
int minY = Integer.MAX_VALUE;
|
||||
int minX = Integer.MAX_VALUE;
|
||||
|
||||
// store confirmed duplicates here
|
||||
HashSet<Point> duplicates = new HashSet<Point>();
|
||||
|
||||
// store possible singles here
|
||||
HashSet<Point> singles = new HashSet<Point>();
|
||||
|
||||
// list to store confirmed singles and output in the correct order
|
||||
ArrayList<Point> output = new ArrayList<Point>();
|
||||
|
||||
// sort into Hashmaps and hashsets to make contains operations possible,
|
||||
// while testing for duplicates
|
||||
for (double[] point : input)
|
||||
{
|
||||
// convert doubles to ints and record min/max values
|
||||
|
||||
int xCoord = (int) Math.round(point[0]);
|
||||
int yCoord = (int) Math.round(point[1]);
|
||||
|
||||
if (xCoord > maxX)
|
||||
{
|
||||
maxX = xCoord;
|
||||
}
|
||||
if (xCoord < minX)
|
||||
{
|
||||
minX = xCoord;
|
||||
}
|
||||
|
||||
if (yCoord > maxY)
|
||||
{
|
||||
maxY = yCoord;
|
||||
}
|
||||
if (yCoord < minY)
|
||||
{
|
||||
minY = yCoord;
|
||||
}
|
||||
output.add(new Point(xCoord, yCoord));
|
||||
}
|
||||
return new PolygonStorage(output, maxX, maxY, minX, minY);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes an unordered list of points comprising a fractal curve and builds a
|
||||
* closed polygon around it
|
||||
*
|
||||
* @param input
|
||||
* @return
|
||||
*/
|
||||
public static PolygonStorage getBoundary(ArrayList<double[]> input)
|
||||
{
|
||||
// store max x and y values to create bounding box
|
||||
int maxY = Integer.MIN_VALUE;
|
||||
int maxX = Integer.MIN_VALUE;
|
||||
int minY = Integer.MAX_VALUE;
|
||||
int minX = Integer.MAX_VALUE;
|
||||
|
||||
// store confirmed duplicates here
|
||||
HashSet<Point> duplicates = new HashSet<Point>();
|
||||
|
||||
// store possible singles here
|
||||
HashSet<Point> singles = new HashSet<Point>();
|
||||
|
||||
// list to store confirmed singles and output in the correct order
|
||||
ArrayList<Point> output = new ArrayList<Point>();
|
||||
|
||||
// sort into Hashmaps and hashsets to make contains operations possible,
|
||||
// while testing for duplicates
|
||||
for (double[] point : input)
|
||||
{
|
||||
// convert doubles to ints and record min/max values
|
||||
|
||||
int xCoord = (int) Math.round(point[0]);
|
||||
int yCoord = (int) Math.round(point[1]);
|
||||
|
||||
if (xCoord > maxX)
|
||||
{
|
||||
maxX = xCoord;
|
||||
}
|
||||
if (xCoord < minX)
|
||||
{
|
||||
minX = xCoord;
|
||||
}
|
||||
|
||||
if (yCoord > maxY)
|
||||
{
|
||||
maxY = yCoord;
|
||||
}
|
||||
if (yCoord < minY)
|
||||
{
|
||||
minY = yCoord;
|
||||
}
|
||||
singles.add(new Point(xCoord, yCoord));
|
||||
|
||||
}
|
||||
|
||||
// find a suitable starting point
|
||||
Point startPoint = new Point(minX, minY);
|
||||
Point prevPoint = (Point) startPoint.clone();
|
||||
|
||||
while (startPoint.y < maxY)
|
||||
{
|
||||
if (singles.contains(startPoint))
|
||||
{
|
||||
break;
|
||||
}
|
||||
startPoint.y++;
|
||||
}
|
||||
|
||||
// record the first point so we know where to stop
|
||||
final Point firstPoint = (Point) startPoint.clone();
|
||||
|
||||
// determine the direction to start searching from
|
||||
Point direction = getVector(prevPoint, startPoint);
|
||||
|
||||
//output.add(startPoint);
|
||||
|
||||
// loop around in a clockwise circle, jumping to the next point when we
|
||||
// find it and resetting the direction to start seaching from
|
||||
// to the last found point. This ensures we always find the next
|
||||
// *outside* point
|
||||
do
|
||||
{
|
||||
// get the next point
|
||||
direction = rotateCounterClockwise(direction);
|
||||
Point target = new Point(startPoint.x + direction.x, startPoint.y + direction.y);
|
||||
|
||||
// see if that point is part of our fractal curve
|
||||
if (singles.contains(target))
|
||||
{
|
||||
if(target.equals(firstPoint))
|
||||
{
|
||||
output.remove(output.get(output.size()-1));
|
||||
break;
|
||||
}
|
||||
// get the vector to start from for the next cycle
|
||||
direction = getVector(startPoint, target);
|
||||
|
||||
// prune zero width spikes
|
||||
if ((output.size() > 1 && output.get(output.size() - 2).equals(target)))
|
||||
{
|
||||
output.remove(output.size() - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if(output.contains(target)&&!target.equals(output.get(0)))
|
||||
{
|
||||
int index = output.indexOf(target);
|
||||
while(output.size()>index)
|
||||
{
|
||||
output.remove(output.size()-1);
|
||||
}
|
||||
|
||||
}
|
||||
output.add(target);
|
||||
}
|
||||
startPoint = target;
|
||||
}
|
||||
}
|
||||
while (!(output.get(output.size() - 1).equals(firstPoint) && output.size() > 1) && output.size() < singles.size());
|
||||
|
||||
return new PolygonStorage(output, maxX, maxY, minX, minY);
|
||||
}
|
||||
|
||||
/**
|
||||
* using a point as a 2d vector, normalize it (sorta)
|
||||
*
|
||||
* @param origin
|
||||
* @param destination
|
||||
* @return
|
||||
*/
|
||||
public static Point getVector(Point origin, Point destination)
|
||||
{
|
||||
int[] normals = { origin.x - destination.x, origin.y - destination.y };
|
||||
|
||||
for (int i = 0; i < normals.length; i++)
|
||||
{
|
||||
if (normals[i] > 0)
|
||||
{
|
||||
normals[i] = 1;
|
||||
}
|
||||
else if (normals[i] == 0)
|
||||
{
|
||||
normals[i] = 0;
|
||||
}
|
||||
else if (normals[i] < 0)
|
||||
{
|
||||
normals[i] = -1;
|
||||
}
|
||||
}
|
||||
return new Point(normals[0], normals[1]);
|
||||
}
|
||||
|
||||
/**
|
||||
* rotate a normal around the origin
|
||||
*
|
||||
* @param previous
|
||||
* @return
|
||||
*/
|
||||
public static Point rotateCounterClockwise(Point previous)
|
||||
{
|
||||
Point point = new Point();
|
||||
|
||||
point.x = (int) (previous.x * Math.cos(Math.toRadians(90)) - previous.y * Math.sin(Math.toRadians(90)));
|
||||
point.y = (int) (previous.x * Math.sin(Math.toRadians(90)) + previous.y * Math.cos(Math.toRadians(90)));
|
||||
|
||||
return point;
|
||||
}
|
||||
|
||||
/**
|
||||
* Take an l-system string and convert it into a series of points on a
|
||||
* cartesian grid. Designed to keep terdragons oriented the same direction
|
||||
* regardless of iterations
|
||||
*
|
||||
* @param angle
|
||||
* @param system
|
||||
* @param generations
|
||||
* @return
|
||||
*/
|
||||
public static ArrayList<double[]> convertToPoints(double angle, String system, int generations)
|
||||
{
|
||||
|
||||
// determine the starting point and rotation to begin drawing from
|
||||
int rotation = (generations % 2) == 0 ? 2 : 4;
|
||||
double[] currentState = { ((generations + rotation) % 4) * 90, 0, 0 };
|
||||
|
||||
// the output for a totally unordered list of points defining the curve
|
||||
ArrayList<double[]> output = new ArrayList<double[]>();
|
||||
|
||||
// the stack used to deal with branching l-systems that use [ and ]
|
||||
ArrayDeque<double[]> state = new ArrayDeque<double[]>();
|
||||
|
||||
// perform the rules corresponding to each symbol in the l-system
|
||||
for (Character ch : system.toCharArray())
|
||||
{
|
||||
double motion = 1;
|
||||
|
||||
// move forward
|
||||
if (ch == 'F')
|
||||
{
|
||||
currentState[1] -= (Math.cos(Math.toRadians(currentState[0])) * motion);
|
||||
currentState[2] -= (Math.sin(Math.toRadians(currentState[0])) * motion);
|
||||
output.add(new double[] { currentState[1], currentState[2] });
|
||||
|
||||
}
|
||||
// start branch
|
||||
if (ch == '[')
|
||||
{
|
||||
|
||||
state.push(currentState.clone());
|
||||
}
|
||||
// turn left
|
||||
if (ch == '-')
|
||||
{
|
||||
currentState = new double[] { (double) ((currentState[0] - angle) % 360), currentState[1], currentState[2] };
|
||||
}
|
||||
// turn right
|
||||
if (ch == '+')
|
||||
{
|
||||
currentState[0] = ((currentState[0] + angle) % 360);
|
||||
|
||||
}
|
||||
// end branch and return to previous fork
|
||||
if (ch == ']')
|
||||
{
|
||||
currentState = state.pop();
|
||||
}
|
||||
}
|
||||
return output;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* grow and l-system string based on the rules provided in the args
|
||||
*
|
||||
* @param start
|
||||
* @param steps
|
||||
* @param lSystemsRule
|
||||
* @return
|
||||
*/
|
||||
public static String generate(String start, int steps, HashMap<String, String> lSystemsRule)
|
||||
{
|
||||
|
||||
while (steps > 0)
|
||||
{
|
||||
StringBuilder output = new StringBuilder();
|
||||
|
||||
for (Character ch : start.toCharArray())
|
||||
{
|
||||
// get the rule applicable for the variable
|
||||
String data = lSystemsRule.get(ch.toString());
|
||||
|
||||
// handle constants for rule-less symbols
|
||||
if (data == null)
|
||||
{
|
||||
data = ch.toString();
|
||||
}
|
||||
output.append(data);
|
||||
}
|
||||
steps--;
|
||||
start = output.toString();
|
||||
}
|
||||
return start;
|
||||
}
|
||||
|
||||
// a data container class to transmit the important information about the polygon
|
||||
public static class PolygonStorage
|
||||
{
|
||||
public PolygonStorage(ArrayList<Point> points, int maxX, int maxY, int minX, int minY)
|
||||
{
|
||||
this.points = points;
|
||||
this.maxX = maxX;
|
||||
this.maxY = maxY;
|
||||
this.minX = minX;
|
||||
this.minY = minY;
|
||||
}
|
||||
public ArrayList<Point> points;
|
||||
|
||||
public int maxX;
|
||||
public int maxY;
|
||||
public int minX;
|
||||
public int minY;
|
||||
}
|
||||
|
||||
|
||||
public static ArrayList<Point> tesselate(PolygonStorage polygon)
|
||||
{
|
||||
ArrayList <Point> points = new ArrayList<Point>();
|
||||
|
||||
ArrayList <PolygonPoint> polyPoints = new ArrayList<PolygonPoint>();
|
||||
|
||||
for(int i = 0; i<polygon.points.size();i++)
|
||||
{
|
||||
polyPoints.add(new PolygonPoint(polygon.points.get(i).x, polygon.points.get(i).y));
|
||||
|
||||
}
|
||||
|
||||
Polygon poly = new Polygon(polyPoints);
|
||||
Poly2Tri.triangulate(poly);
|
||||
|
||||
ArrayList<DelaunayTriangle> tris =(ArrayList<DelaunayTriangle>) poly.getTriangles();
|
||||
|
||||
for(DelaunayTriangle tri : tris)
|
||||
{
|
||||
for(TriangulationPoint tpoint : tri.points)
|
||||
{
|
||||
points.add(new Point((int)tpoint.getX(),(int) tpoint.getY()));
|
||||
}
|
||||
}
|
||||
return points;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
public static ArrayList<Point> tesselate(Polygon polygon)
|
||||
{
|
||||
ArrayList<Point> points = new ArrayList<Point>();
|
||||
|
||||
Tessellator tess = new Tessellator();
|
||||
double[] verticesC1 = new double[polygon.points.size()*3];
|
||||
for(int i = 0; i< verticesC1.length; i+=3)
|
||||
{
|
||||
Point point = polygon.points.get(i/3);
|
||||
verticesC1[i]= point.x;
|
||||
verticesC1[i+1]= point.y;
|
||||
verticesC1[i+2]= 0;
|
||||
|
||||
}
|
||||
|
||||
tess.gluBeginPolygon();
|
||||
|
||||
for(int i = 0; i <polygon.points.size(); i++)
|
||||
{
|
||||
tess.gluTessVertex(verticesC1, i*3, i);
|
||||
}
|
||||
|
||||
tess.gluEndPolygon();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//Prints out the result of the tessellation.
|
||||
for(int i = 0; i < tess.primitives.size(); i++) {
|
||||
System.out.println(tess.primitives.get(i).toString());
|
||||
}
|
||||
//To draw the shape it is now a simple matter to put the vertex data you passed in initially into a VBO, and the indices returned
|
||||
//into an IBO (Index VBO). You have the types of the primitives and the number of indices for each one. Drawing the result should
|
||||
//be a walk in the park, as long as you have read the appropriate tutorials here or elsewhere.
|
||||
|
||||
|
||||
for(int i = 0; i < tess.primitives.size(); i++)
|
||||
{
|
||||
|
||||
Primitive prim = tess.primitives.get(i);
|
||||
ArrayList<Integer> vIndex = prim.vertices;
|
||||
|
||||
if(prim.type==GL11.GL_TRIANGLE_STRIP)
|
||||
{
|
||||
for(Integer ii = 0; ii < vIndex.size()-1;ii++)
|
||||
{
|
||||
points.add(new Point((int)verticesC1[vIndex.get(ii)*3],(int) verticesC1[vIndex.get(ii)*3+1]));
|
||||
points.add(new Point((int)verticesC1[vIndex.get(ii+1)*3],(int) verticesC1[vIndex.get(ii+1)*3+1]));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(prim.type==GL11.GL_TRIANGLES)
|
||||
{
|
||||
for(Integer ii = 0; ii < vIndex.size();ii++)
|
||||
{
|
||||
points.add(new Point((int)verticesC1[vIndex.get(ii)*3],(int) verticesC1[vIndex.get(ii)*3+1]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
if(prim.type==GL11.GL_TRIANGLE_FAN)
|
||||
{
|
||||
Integer firstIndex = vIndex.get(0);
|
||||
// points.add(new Point((int)verticesC1[vIndex.get(firstIndex)],(int) verticesC1[vIndex.get(firstIndex)+1]));
|
||||
|
||||
Integer[] vertexList = new Integer[vIndex.size()*3];
|
||||
for(Integer ii = 0; ii < vIndex.size()-2;ii++)
|
||||
{
|
||||
vertexList[ii*3] = vIndex.get(0);
|
||||
vertexList[ii*3+1] = vIndex.get(ii+1);
|
||||
vertexList[ii*3+2] = vIndex.get(ii+2);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
for(Integer vertex : vertexList)
|
||||
{
|
||||
if(vertex!=null)
|
||||
{
|
||||
points.add(new Point((int)(verticesC1[vertex*3]),(int)(verticesC1[vertex*3+1])));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
System.out.println(vertexList);
|
||||
|
||||
|
||||
}
|
||||
|
||||
//points.add(new Point((int)verticesC1[vIndex.get(firstIndex)],(int) verticesC1[vIndex.get(firstIndex)+1]));
|
||||
// points.add(new Point((int)verticesC1[vIndex.get(ii)*3],(int) verticesC1[vIndex.get(ii)+1]));
|
||||
// points.add(new Point((int)verticesC1[vIndex.get(ii+1)*3],(int) verticesC1[vIndex.get(ii+1)*3+1]));
|
||||
|
||||
// points.add(new Point((int)verticesC1[index],(int)verticesC1[index+1]));
|
||||
// System.out.println(verticesC1[index]+","+verticesC1[index+1]+","+verticesC1[index+2]);
|
||||
|
||||
|
||||
|
||||
}
|
||||
//System.out.println(tess.primitives.get(i).toString());
|
||||
}
|
||||
return points;
|
||||
|
||||
}
|
||||
**/
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
package StevenDimDoors.mod_pocketDim.watcher;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.*;
|
||||
|
||||
import StevenDimDoors.mod_pocketDim.core.DimensionType;
|
||||
import StevenDimDoors.mod_pocketDim.core.NewDimData;
|
||||
|
||||
@@ -27,14 +26,14 @@ public class ClientDimData
|
||||
this.type = dimension.type();
|
||||
}
|
||||
|
||||
public void write(DataOutputStream output) throws IOException
|
||||
public void write(DataOutput output) throws IOException
|
||||
{
|
||||
output.writeInt(ID);
|
||||
output.writeInt(rootID);
|
||||
output.writeInt(type.index);
|
||||
}
|
||||
|
||||
public static ClientDimData read(DataInputStream input) throws IOException
|
||||
public static ClientDimData read(DataInput input) throws IOException
|
||||
{
|
||||
int id = input.readInt();
|
||||
int rootID = input.readInt();
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package StevenDimDoors.mod_pocketDim.watcher;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.*;
|
||||
|
||||
import StevenDimDoors.mod_pocketDim.core.DDLock;
|
||||
import StevenDimDoors.mod_pocketDim.core.DimLink;
|
||||
import StevenDimDoors.mod_pocketDim.core.LinkType;
|
||||
import StevenDimDoors.mod_pocketDim.util.Point4D;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class ClientLinkData
|
||||
{
|
||||
@@ -36,7 +36,7 @@ public class ClientLinkData
|
||||
|
||||
}
|
||||
|
||||
public void write(DataOutputStream output) throws IOException
|
||||
public void write(DataOutput output) throws IOException
|
||||
{
|
||||
Point4D.write(point, output);
|
||||
output.writeInt(this.type.index);
|
||||
@@ -50,7 +50,24 @@ public class ClientLinkData
|
||||
}
|
||||
}
|
||||
|
||||
public static ClientLinkData read(DataInputStream input) throws IOException
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
tag.setInteger("Type", this.type.index);
|
||||
|
||||
if (this.lock != null) {
|
||||
NBTTagCompound lock = new NBTTagCompound();
|
||||
lock.setBoolean("State", this.lock.getLockState());
|
||||
lock.setInteger("Key", this.lock.getLockKey());
|
||||
tag.setTag("Lock", lock);
|
||||
}
|
||||
|
||||
if (this.point != null) {
|
||||
NBTTagCompound point = new NBTTagCompound();
|
||||
Point4D.writeToNBT(this.point, point);
|
||||
tag.setTag("Point", point);
|
||||
}
|
||||
}
|
||||
|
||||
public static ClientLinkData read(DataInput input) throws IOException
|
||||
{
|
||||
Point4D point = Point4D.read(input);
|
||||
LinkType type = LinkType.getLinkTypeFromIndex(input.readInt());
|
||||
@@ -61,4 +78,17 @@ public class ClientLinkData
|
||||
}
|
||||
return new ClientLinkData(point, type, lock);
|
||||
}
|
||||
|
||||
public static ClientLinkData readFromNBT(NBTTagCompound tag) {
|
||||
LinkType type = LinkType.getLinkTypeFromIndex(tag.getInteger("Type"));
|
||||
Point4D point = null;
|
||||
if (tag.hasKey("Point"))
|
||||
point = Point4D.readFromNBT(tag.getCompoundTag("Point"));
|
||||
DDLock lock = null;
|
||||
if (tag.hasKey("Lock")) {
|
||||
NBTTagCompound lockTag = tag.getCompoundTag("Lock");
|
||||
lock = new DDLock(lockTag.getBoolean("State"),lockTag.getInteger("Key"));
|
||||
}
|
||||
return new ClientLinkData(point, type, lock);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
package StevenDimDoors.mod_pocketDim.watcher;
|
||||
|
||||
import StevenDimDoors.mod_pocketDim.util.Point4D;
|
||||
|
||||
public interface IUpdateSource
|
||||
{
|
||||
public void registerWatchers(IUpdateWatcher<ClientDimData> dimWatcher, IUpdateWatcher<ClientLinkData> linkWatcher);
|
||||
}
|
||||
@@ -2,7 +2,9 @@ package StevenDimDoors.mod_pocketDim.world;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.MapGenBase;
|
||||
@@ -21,15 +23,15 @@ public class CustomCaveGen extends MapGenBase
|
||||
/**
|
||||
* 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)
|
||||
protected void generateLargeCaveNode(long par1, int par3, int par4, Block[] blocks, 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);
|
||||
this.generateCaveNode(par1, par3, par4, blocks, 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.
|
||||
*/
|
||||
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)
|
||||
protected void generateCaveNode(long par1, int par3, int par4, Block[] blocks, double par6, double par8, double par10, float par12, float par13, float par14, int par15, int par16, double par17)
|
||||
{
|
||||
double var19 = par3 * 16 + 8;
|
||||
double var21 = par4 * 16 + 8;
|
||||
@@ -81,8 +83,8 @@ public class CustomCaveGen extends MapGenBase
|
||||
|
||||
if (!var54 && par15 == var27 && par12 > 1.0F && par16 > 0)
|
||||
{
|
||||
this.generateCaveNode(var25.nextLong(), par3, par4, par5ArrayOfByte, par6, par8, par10, var25.nextFloat() * 0.5F + 0.5F, par13 - ((float)Math.PI / 2F), par14 / 3.0F, par15, par16, 1.0D);
|
||||
this.generateCaveNode(var25.nextLong(), par3, par4, par5ArrayOfByte, par6, par8, par10, var25.nextFloat() * 0.5F + 0.5F, par13 + ((float)Math.PI / 2F), par14 / 3.0F, par15, par16, 1.0D);
|
||||
this.generateCaveNode(var25.nextLong(), par3, par4, blocks, par6, par8, par10, var25.nextFloat() * 0.5F + 0.5F, par13 - ((float)Math.PI / 2F), par14 / 3.0F, par15, par16, 1.0D);
|
||||
this.generateCaveNode(var25.nextLong(), par3, par4, blocks, par6, par8, par10, var25.nextFloat() * 0.5F + 0.5F, par13 + ((float)Math.PI / 2F), par14 / 3.0F, par15, par16, 1.0D);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -151,7 +153,7 @@ public class CustomCaveGen extends MapGenBase
|
||||
|
||||
if (var44 >= 0 && var44 < 128)
|
||||
{
|
||||
if (par5ArrayOfByte[var45] == Block.waterMoving.blockID || par5ArrayOfByte[var45] == Block.waterStill.blockID)
|
||||
if (blocks[var45] == Blocks.flowing_water || blocks[var45] == Blocks.water)
|
||||
{
|
||||
var58 = true;
|
||||
}
|
||||
@@ -185,26 +187,26 @@ public class CustomCaveGen extends MapGenBase
|
||||
|
||||
if (var51 > -0.7D && var59 * var59 + var51 * var51 + var46 * var46 < 1.0D)
|
||||
{
|
||||
byte var53 = par5ArrayOfByte[var48];
|
||||
Block var53 = blocks[var48];
|
||||
|
||||
if (var53 == Block.grass.blockID)
|
||||
if (var53 == Blocks.grass)
|
||||
{
|
||||
var49 = true;
|
||||
}
|
||||
|
||||
if (var53 == properties.LimboBlockID || var53 == Block.dirt.blockID || var53 == Block.grass.blockID)
|
||||
if (var53 == mod_pocketDim.blockLimbo || var53 == Blocks.dirt || var53 == Blocks.grass)
|
||||
{
|
||||
if (var50 < 10)
|
||||
{
|
||||
par5ArrayOfByte[var48] = (byte)Block.lavaMoving.blockID;
|
||||
blocks[var48] = Blocks.flowing_lava;
|
||||
}
|
||||
else
|
||||
{
|
||||
par5ArrayOfByte[var48] = 0;
|
||||
blocks[var48] = Blocks.air;
|
||||
|
||||
if (var49 && par5ArrayOfByte[var48 - 1] == Block.dirt.blockID)
|
||||
if (var49 && blocks[var48 - 1] == Blocks.dirt)
|
||||
{
|
||||
par5ArrayOfByte[var48 - 1] = this.worldObj.getBiomeGenForCoords(var42 + par3 * 16, var45 + par4 * 16).topBlock;
|
||||
blocks[var48 - 1] = this.worldObj.getBiomeGenForCoords(var42 + par3 * 16, var45 + par4 * 16).topBlock;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -230,7 +232,7 @@ public class CustomCaveGen extends MapGenBase
|
||||
* 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)
|
||||
protected void func_151538_a(World par1World, int par2, int par3, int par4, int par5, Block[] blocks)
|
||||
{
|
||||
int var7 = this.rand.nextInt(this.rand.nextInt(this.rand.nextInt(40) + 1) + 1);
|
||||
|
||||
@@ -248,7 +250,7 @@ public class CustomCaveGen extends MapGenBase
|
||||
|
||||
if (this.rand.nextInt(4) == 0)
|
||||
{
|
||||
this.generateLargeCaveNode(this.rand.nextLong(), par4, par5, par6ArrayOfByte, var9, var11, var13);
|
||||
this.generateLargeCaveNode(this.rand.nextLong(), par4, par5, blocks, var9, var11, var13);
|
||||
var15 += this.rand.nextInt(4);
|
||||
}
|
||||
|
||||
@@ -263,7 +265,7 @@ public class CustomCaveGen extends MapGenBase
|
||||
var19 *= this.rand.nextFloat() * this.rand.nextFloat() * 3.0F + 1.0F;
|
||||
}
|
||||
|
||||
this.generateCaveNode(this.rand.nextLong(), par4, par5, par6ArrayOfByte, var9, var11, var13, var19, var17, var18, 0, 0, 1.0D);
|
||||
this.generateCaveNode(this.rand.nextLong(), par4, par5, blocks, var9, var11, var13, var19, var17, var18, 0, 0, 1.0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public class DDBiomeGenBase extends BiomeGenBase
|
||||
{
|
||||
for (int k = 0; k < biomes.length; k++)
|
||||
{
|
||||
if (biomeList[biomes[k]] != null && !(biomeList[biomes[k]] instanceof DDBiomeGenBase))
|
||||
if (getBiomeGenArray()[biomes[k]] != null && !(getBiomeGenArray()[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.
|
||||
|
||||
@@ -2,12 +2,15 @@ package StevenDimDoors.mod_pocketDim.world;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.ChunkCoordIntPair;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import StevenDimDoors.mod_pocketDim.config.DDProperties;
|
||||
import net.minecraftforge.common.ForgeChunkManager;
|
||||
|
||||
/**
|
||||
* Provides methods for applying Limbo decay. Limbo decay refers to the effect that most blocks placed in Limbo
|
||||
@@ -21,37 +24,49 @@ 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 Block[] decaySequence = null;
|
||||
|
||||
private final Random random;
|
||||
private final DDProperties properties;
|
||||
private final int[] blocksImmuneToDecay;
|
||||
private Block[] blocksImmuneToDecay = null;
|
||||
|
||||
public LimboDecay(DDProperties properties)
|
||||
{
|
||||
decaySequence = new int[] {
|
||||
properties.LimboBlockID,
|
||||
Block.gravel.blockID,
|
||||
Block.cobblestone.blockID,
|
||||
Block.stone.blockID
|
||||
};
|
||||
|
||||
blocksImmuneToDecay = new int[] {
|
||||
properties.LimboBlockID,
|
||||
properties.PermaFabricBlockID,
|
||||
properties.TransientDoorID,
|
||||
properties.DimensionalDoorID,
|
||||
properties.WarpDoorID,
|
||||
properties.RiftBlockID,
|
||||
properties.UnstableDoorID,
|
||||
properties.GoldenDoorID,
|
||||
properties.GoldenDimensionalDoorID
|
||||
};
|
||||
|
||||
this.properties = properties;
|
||||
this.random = new Random();
|
||||
}
|
||||
|
||||
public Block[] getDecaySequence() {
|
||||
if (decaySequence == null) {
|
||||
decaySequence = new Block[] {
|
||||
mod_pocketDim.blockLimbo,
|
||||
Blocks.gravel,
|
||||
Blocks.cobblestone,
|
||||
Blocks.stone
|
||||
};
|
||||
}
|
||||
|
||||
return decaySequence;
|
||||
}
|
||||
|
||||
public Block[] getBlocksImmuneToDecay() {
|
||||
if (blocksImmuneToDecay == null) {
|
||||
blocksImmuneToDecay = new Block[] {
|
||||
mod_pocketDim.blockLimbo,
|
||||
mod_pocketDim.blockDimWallPerm,
|
||||
mod_pocketDim.transientDoor,
|
||||
mod_pocketDim.dimensionalDoor,
|
||||
mod_pocketDim.warpDoor,
|
||||
mod_pocketDim.blockRift,
|
||||
mod_pocketDim.unstableDoor,
|
||||
mod_pocketDim.goldenDoor,
|
||||
mod_pocketDim.goldenDimensionalDoor
|
||||
};
|
||||
}
|
||||
|
||||
return blocksImmuneToDecay;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the blocks orthogonally around a given location (presumably the location of an Unraveled Fabric block)
|
||||
* and applies Limbo decay to them. This gives the impression that decay spreads outward from Unraveled Fabric.
|
||||
@@ -90,7 +105,7 @@ public class LimboDecay {
|
||||
|
||||
//Obtain the coordinates of active chunks in Limbo. For each section of each chunk,
|
||||
//pick a random block and try to apply fast decay.
|
||||
for (Object coordObject : limbo.activeChunkSet)
|
||||
for (Object coordObject : ForgeChunkManager.getPersistentChunksFor(limbo).keySet())
|
||||
{
|
||||
ChunkCoordIntPair chunkCoord = (ChunkCoordIntPair) coordObject;
|
||||
|
||||
@@ -112,10 +127,10 @@ public class LimboDecay {
|
||||
*/
|
||||
private boolean decayBlockFast(World world, int x, int y, int z)
|
||||
{
|
||||
int blockID = world.getBlockId(x, y, z);
|
||||
if (canDecayBlock(blockID))
|
||||
Block block = world.getBlock(x, y, z);
|
||||
if (canDecayBlock(block, world, x, y, z))
|
||||
{
|
||||
world.setBlock(x, y, z, properties.LimboBlockID);
|
||||
world.setBlock(x, y, z, mod_pocketDim.blockLimbo);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -127,14 +142,14 @@ public class LimboDecay {
|
||||
private boolean decayBlock(World world, int x, int y, int z)
|
||||
{
|
||||
int index;
|
||||
int blockID = world.getBlockId(x, y, z);
|
||||
if (canDecayBlock(blockID))
|
||||
Block block = world.getBlock(x, y, z);
|
||||
if (canDecayBlock(block, world, x, y, z))
|
||||
{
|
||||
//Loop over the block IDs that decay can go through.
|
||||
//Find an index matching the current blockID, if any.
|
||||
for (index = 0; index < decaySequence.length; index++)
|
||||
for (index = 0; index < getDecaySequence().length; index++)
|
||||
{
|
||||
if (decaySequence[index] == blockID)
|
||||
if (getDecaySequence()[index] == block)
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -146,7 +161,7 @@ public class LimboDecay {
|
||||
//last ID in the array, which is the first one that all blocks decay into.
|
||||
//We assume that Unraveled Fabric is NOT decayable. Otherwise, this will go out of bounds!
|
||||
|
||||
world.setBlock(x, y, z, decaySequence[index - 1]);
|
||||
world.setBlock(x, y, z, getDecaySequence()[index - 1]);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -155,22 +170,21 @@ public class LimboDecay {
|
||||
/**
|
||||
* Checks if a block can decay. We will not decay air, certain DD blocks, or containers.
|
||||
*/
|
||||
private boolean canDecayBlock(int blockID)
|
||||
private boolean canDecayBlock(Block block, World world, int x, int y, int z)
|
||||
{
|
||||
if (blockID == 0)
|
||||
if (block.isAir(world, x, y, z))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int k = 0; k < blocksImmuneToDecay.length; k++)
|
||||
for (int k = 0; k < getBlocksImmuneToDecay().length; k++)
|
||||
{
|
||||
if (blockID == blocksImmuneToDecay[k])
|
||||
if (block == getBlocksImmuneToDecay()[k])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Block block = Block.blocksList[blockID];
|
||||
return (block == null || !(block instanceof BlockContainer));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,11 @@ package StevenDimDoors.mod_pocketDim.world;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.EnumCreatureType;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.IProgressUpdate;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.ChunkPosition;
|
||||
@@ -13,9 +17,8 @@ import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
import net.minecraft.world.gen.ChunkProviderGenerate;
|
||||
import net.minecraft.world.gen.NoiseGeneratorOctaves;
|
||||
import net.minecraft.world.gen.feature.MapGenScatteredFeature;
|
||||
import net.minecraft.world.gen.structure.MapGenScatteredFeature;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.Event.Result;
|
||||
import net.minecraftforge.event.terraingen.ChunkProviderEvent;
|
||||
import StevenDimDoors.mod_pocketDim.config.DDProperties;
|
||||
import StevenDimDoors.mod_pocketDim.ticking.CustomLimboPopulator;
|
||||
@@ -119,7 +122,7 @@ public class LimboGenerator extends ChunkProviderGenerate
|
||||
}
|
||||
|
||||
@Override
|
||||
public void replaceBlocksForBiome(int par1, int par2, byte[] par3ArrayOfByte, BiomeGenBase[] par4ArrayOfBiomeGenBase)
|
||||
public void replaceBlocksForBiome(int par1, int par2, Block[] blocks, byte[] par3ArrayOfByte, BiomeGenBase[] par4ArrayOfBiomeGenBase)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -129,8 +132,8 @@ public class LimboGenerator extends ChunkProviderGenerate
|
||||
{
|
||||
//TODO: Wtf? Why do you reinitialize the seed when we already initialized it in the constructor?! ~SenseiKiwi
|
||||
LimboGenerator.rand.setSeed(chunkX * 341873128712L + chunkZ * 132897987541L);
|
||||
byte[] var3 = new byte[32768];
|
||||
this.generateTerrain(chunkX, chunkZ, var3);
|
||||
Block[] var3 = new Block[32768];
|
||||
this.func_147424_a(chunkX, chunkZ, var3);
|
||||
Chunk var4 = new Chunk(this.worldObj, var3, chunkX, chunkZ);
|
||||
var4.generateSkylightMap();
|
||||
|
||||
@@ -163,7 +166,7 @@ public class LimboGenerator extends ChunkProviderGenerate
|
||||
{
|
||||
ChunkProviderEvent.InitNoiseField event = new ChunkProviderEvent.InitNoiseField(this, par1ArrayOfDouble, par2, par3, par4, par5, par6, par7);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
if (event.getResult() == Result.DENY) return event.noisefield;
|
||||
if (event.getResult() == Event.Result.DENY) return event.noisefield;
|
||||
|
||||
if (par1ArrayOfDouble == null)
|
||||
{
|
||||
@@ -208,13 +211,13 @@ public class LimboGenerator extends ChunkProviderGenerate
|
||||
{
|
||||
for (int var22 = -var19; var22 <= var19; ++var22)
|
||||
{
|
||||
float var24 = this.parabolicField[var21 + 2 + (var22 + 2) * 5] / (BiomeGenBase.plains.minHeight + 9.0F);
|
||||
float var24 = this.parabolicField[var21 + 2 + (var22 + 2) * 5] / (BiomeGenBase.plains.rootHeight + 9.0F);
|
||||
|
||||
|
||||
//this adjusts the height of the terrain
|
||||
|
||||
var16 += BiomeGenBase.plains.maxHeight * var24+4;
|
||||
var17 += BiomeGenBase.plains.minHeight * var24-1;
|
||||
var16 += BiomeGenBase.plains.heightVariation * var24+4;
|
||||
var17 += BiomeGenBase.plains.rootHeight * var24-1;
|
||||
var18 += var24;
|
||||
}
|
||||
}
|
||||
@@ -305,7 +308,7 @@ public class LimboGenerator extends ChunkProviderGenerate
|
||||
return par1ArrayOfDouble;
|
||||
}
|
||||
@Override
|
||||
public void generateTerrain(int par1, int par2, byte[] par3ArrayOfByte)
|
||||
public void func_147424_a(int par1, int par2, Block[] blocks)
|
||||
{
|
||||
byte var4 = 4;
|
||||
byte var5 = 16;
|
||||
@@ -353,16 +356,16 @@ public class LimboGenerator extends ChunkProviderGenerate
|
||||
{
|
||||
if ((var47 += var49) > 0.0D)
|
||||
{
|
||||
par3ArrayOfByte[var43 += var44] = (byte)properties.LimboBlockID;
|
||||
blocks[var43 += var44] = mod_pocketDim.blockLimbo;
|
||||
}
|
||||
else if (var12 * 8 + var31 < var6)
|
||||
{
|
||||
par3ArrayOfByte[var43 += var44] = (byte)properties.PermaFabricBlockID;
|
||||
blocks[var43 += var44] = mod_pocketDim.blockDimWallPerm;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
par3ArrayOfByte[var43 += var44] = 0;
|
||||
blocks[var43 += var44] = Blocks.air;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -402,7 +405,7 @@ public class LimboGenerator extends ChunkProviderGenerate
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChunkPosition findClosestStructure(World var1, String var2,
|
||||
public ChunkPosition func_147416_a(World var1, String var2,
|
||||
int var3, int var4, int var5) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
|
||||
@@ -2,6 +2,7 @@ package StevenDimDoors.mod_pocketDim.world;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -50,7 +51,7 @@ public class LimboProvider extends WorldProvider
|
||||
@Override
|
||||
protected void registerWorldChunkManager()
|
||||
{
|
||||
super.worldChunkMgr = new WorldChunkManagerHell(mod_pocketDim.limboBiome,1,1);
|
||||
super.worldChunkMgr = new WorldChunkManagerHell(mod_pocketDim.limboBiome,1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -73,7 +74,7 @@ public class LimboProvider extends WorldProvider
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canSnowAt(int x, int y, int z)
|
||||
public boolean canSnowAt(int x, int y, int z, boolean checkLight)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -136,8 +137,8 @@ public class LimboProvider extends WorldProvider
|
||||
@Override
|
||||
public boolean canCoordinateBeSpawn(int par1, int par2)
|
||||
{
|
||||
int var3 = this.worldObj.getFirstUncoveredBlock(par1, par2);
|
||||
return var3 == properties.LimboBlockID;
|
||||
Block block = this.worldObj.getTopBlock(par1, par2);
|
||||
return block == mod_pocketDim.blockLimbo;
|
||||
}
|
||||
@Override
|
||||
public double getHorizon()
|
||||
@@ -148,14 +149,14 @@ public class LimboProvider extends WorldProvider
|
||||
public Vec3 getSkyColor(Entity cameraEntity, float partialTicks)
|
||||
{
|
||||
setCloudRenderer( new CloudRenderBlank());
|
||||
return this.worldObj.getWorldVec3Pool().getVecFromPool(0, 0, 0);
|
||||
return Vec3.createVectorHelper(0, 0, 0);
|
||||
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public Vec3 getFogColor(float par1, float par2)
|
||||
{
|
||||
return this.worldObj.getWorldVec3Pool().getVecFromPool(.2, .2, .2);
|
||||
return Vec3.createVectorHelper(.2, .2, .2);
|
||||
|
||||
}
|
||||
@Override
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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!");
|
||||
@@ -285,7 +286,7 @@ public class PocketBuilder
|
||||
{
|
||||
throw new IllegalArgumentException("properties cannot be null.");
|
||||
}
|
||||
if (link.hasDestination())
|
||||
if (link.linkType() != LinkType.PERSONAL && link.hasDestination())
|
||||
{
|
||||
throw new IllegalArgumentException("link cannot have a destination assigned already.");
|
||||
}
|
||||
@@ -322,7 +323,7 @@ public class PocketBuilder
|
||||
* @param door
|
||||
* @return
|
||||
*/
|
||||
public static boolean generateNewPersonalPocket(DimLink link, DDProperties properties,Entity player, Block door)
|
||||
public static boolean generateNewPersonalPocket(DimLink link, DDProperties properties,EntityPlayer player, Block door)
|
||||
{
|
||||
//incase a chicken walks in or something
|
||||
if(!(player instanceof EntityPlayer))
|
||||
@@ -338,7 +339,7 @@ public class PocketBuilder
|
||||
{
|
||||
//Register a new dimension
|
||||
NewDimData parent = PocketManager.getDimensionData(link.source().getDimension());
|
||||
NewDimData dimension = PocketManager.registerPocket(parent, DimensionType.PERSONAL, player.getEntityName());
|
||||
NewDimData dimension = PocketManager.registerPocket(parent, DimensionType.PERSONAL, player.getGameProfile().getId().toString());
|
||||
|
||||
|
||||
//Load a world
|
||||
@@ -454,7 +455,7 @@ public class PocketBuilder
|
||||
BlockRotator.transformPoint(center, door, orientation - BlockRotator.EAST_DOOR_METADATA, door);
|
||||
|
||||
//Build the outer layer of Eternal Fabric
|
||||
buildBox(world, center.getX(), center.getY(), center.getZ(), (size / 2), properties.PermaFabricBlockID, 0, false, 0);
|
||||
buildBox(world, center.getX(), center.getY(), center.getZ(), (size / 2), mod_pocketDim.blockDimWallPerm, 0, false, 0);
|
||||
|
||||
//check if we are building a personal pocket
|
||||
int metadata = 0;
|
||||
@@ -466,19 +467,19 @@ public class PocketBuilder
|
||||
//Build the (wallThickness - 1) layers of Fabric of Reality
|
||||
for (int layer = 1; layer < wallThickness; layer++)
|
||||
{
|
||||
buildBox(world, center.getX(), center.getY(), center.getZ(), (size / 2) - layer, mod_pocketDim.blockDimWall.blockID, metadata,
|
||||
buildBox(world, center.getX(), center.getY(), center.getZ(), (size / 2) - layer, mod_pocketDim.blockDimWall, metadata,
|
||||
layer < (wallThickness - 1) && properties.TNFREAKINGT_Enabled, properties.NonTntWeight);
|
||||
}
|
||||
|
||||
//MazeBuilder.generate(world, x, y, z, random);
|
||||
|
||||
//Build the door
|
||||
int doorOrientation = BlockRotator.transformMetadata(BlockRotator.EAST_DOOR_METADATA, orientation - BlockRotator.EAST_DOOR_METADATA + 2, doorBlock.blockID);
|
||||
int doorOrientation = BlockRotator.transformMetadata(BlockRotator.EAST_DOOR_METADATA, orientation - BlockRotator.EAST_DOOR_METADATA + 2, doorBlock);
|
||||
ItemDimensionalDoor.placeDoorBlock(world, x, y - 1, z, doorOrientation, doorBlock);
|
||||
|
||||
}
|
||||
|
||||
private static void buildBox(World world, int centerX, int centerY, int centerZ, int radius, int blockID, int metadata, boolean placeTnt, int nonTntWeight)
|
||||
private static void buildBox(World world, int centerX, int centerY, int centerZ, int radius, Block block, int metadata, boolean placeTnt, int nonTntWeight)
|
||||
{
|
||||
int x, y, z;
|
||||
|
||||
@@ -495,14 +496,14 @@ public class PocketBuilder
|
||||
{
|
||||
for (z = startZ; z <= endZ; z++)
|
||||
{
|
||||
setBlockDirectlySpecial(world, x, startY, z, blockID, metadata, placeTnt, nonTntWeight);
|
||||
setBlockDirectlySpecial(world, x, endY, z, blockID, metadata, placeTnt, nonTntWeight);
|
||||
setBlockDirectlySpecial(world, x, startY, z, block, metadata, placeTnt, nonTntWeight);
|
||||
setBlockDirectlySpecial(world, x, endY, z, block, metadata, placeTnt, nonTntWeight);
|
||||
}
|
||||
|
||||
for (y = startY; y <= endY; y++)
|
||||
{
|
||||
setBlockDirectlySpecial(world, x, y, startZ, blockID, metadata, placeTnt, nonTntWeight);
|
||||
setBlockDirectlySpecial(world, x, y, endZ, blockID, metadata, placeTnt, nonTntWeight);
|
||||
setBlockDirectlySpecial(world, x, y, startZ, block, metadata, placeTnt, nonTntWeight);
|
||||
setBlockDirectlySpecial(world, x, y, endZ, block, metadata, placeTnt, nonTntWeight);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -510,31 +511,26 @@ public class PocketBuilder
|
||||
{
|
||||
for (z = startZ; z <= endZ; z++)
|
||||
{
|
||||
setBlockDirectlySpecial(world, startX, y, z, blockID, metadata, placeTnt, nonTntWeight);
|
||||
setBlockDirectlySpecial(world, endX, y, z, blockID, metadata, placeTnt, nonTntWeight);
|
||||
setBlockDirectlySpecial(world, startX, y, z, block, metadata, placeTnt, nonTntWeight);
|
||||
setBlockDirectlySpecial(world, endX, y, z, block, metadata, placeTnt, nonTntWeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void setBlockDirectlySpecial(World world, int x, int y, int z, int blockID, int metadata, boolean placeTnt, int nonTntWeight)
|
||||
private static void setBlockDirectlySpecial(World world, int x, int y, int z, Block block, int metadata, boolean placeTnt, int nonTntWeight)
|
||||
{
|
||||
if (placeTnt && random.nextInt(nonTntWeight + 1) == 0)
|
||||
{
|
||||
setBlockDirectly(world, x, y, z, Block.tnt.blockID, 1);
|
||||
setBlockDirectly(world, x, y, z, Blocks.tnt, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
setBlockDirectly(world, x, y, z, blockID, metadata);
|
||||
setBlockDirectly(world, x, y, z, block, metadata);
|
||||
}
|
||||
}
|
||||
|
||||
private static void setBlockDirectly(World world, int x, int y, int z, int blockID, int metadata)
|
||||
private static void setBlockDirectly(World world, int x, int y, int z, Block block, int metadata)
|
||||
{
|
||||
if (blockID != 0 && Block.blocksList[blockID] == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int cX = x >> 4;
|
||||
int cZ = z >> 4;
|
||||
int cY = y >> 4;
|
||||
@@ -551,7 +547,7 @@ public class PocketBuilder
|
||||
extBlockStorage = new ExtendedBlockStorage(cY << 4, !world.provider.hasNoSky);
|
||||
chunk.getBlockStorageArray()[cY] = extBlockStorage;
|
||||
}
|
||||
extBlockStorage.setExtBlockID(localX, y & 15, localZ, blockID);
|
||||
extBlockStorage.func_150818_a(localX, y & 15, localZ, block);
|
||||
extBlockStorage.setExtBlockMetadata(localX, y & 15, localZ, metadata);
|
||||
chunk.setChunkModified();
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package StevenDimDoors.mod_pocketDim.world;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.EnumCreatureType;
|
||||
import net.minecraft.world.ChunkPosition;
|
||||
import net.minecraft.world.World;
|
||||
@@ -27,7 +28,7 @@ public class PocketGenerator extends ChunkProviderGenerate
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateTerrain(int par1, int par2, byte[] par3ArrayOfByte)
|
||||
public void func_147424_a(int par1, int par2, Block[] blocks)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -41,7 +42,7 @@ public class PocketGenerator extends ChunkProviderGenerate
|
||||
@Override
|
||||
public Chunk provideChunk(int chunkX, int chunkZ)
|
||||
{
|
||||
byte[] var3 = new byte[32768];
|
||||
Block[] var3 = new Block[32768];
|
||||
Chunk chunk = new Chunk(worldObj, var3, chunkX, chunkZ);
|
||||
|
||||
if(!chunk.isTerrainPopulated)
|
||||
@@ -77,7 +78,7 @@ public class PocketGenerator extends ChunkProviderGenerate
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChunkPosition findClosestStructure(World var1, String var2, int var3, int var4, int var5)
|
||||
public ChunkPosition func_147416_a(World var1, String var2, int var3, int var4, int var5)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user