Minor Changes
Fixed indentation and removed pointless annotations.
This commit is contained in:
@@ -15,26 +15,26 @@ import net.minecraft.command.ICommandSender;
|
|||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public class CommandCreateDungeonRift extends DDCommandBase
|
public class CommandCreateDungeonRift extends DDCommandBase
|
||||||
{
|
{
|
||||||
private static CommandCreateDungeonRift instance = null;
|
private static CommandCreateDungeonRift instance = null;
|
||||||
|
|
||||||
private CommandCreateDungeonRift()
|
private CommandCreateDungeonRift()
|
||||||
{
|
{
|
||||||
super("dd-rift", "<dungeon name | 'list' | 'random'>");
|
super("dd-rift", "<dungeon name | 'list' | 'random'>");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CommandCreateDungeonRift instance()
|
public static CommandCreateDungeonRift instance()
|
||||||
{
|
{
|
||||||
if (instance == null)
|
if (instance == null)
|
||||||
instance = new CommandCreateDungeonRift();
|
instance = new CommandCreateDungeonRift();
|
||||||
|
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getCommandUsage(ICommandSender sender) {
|
public String getCommandUsage(ICommandSender sender)
|
||||||
|
{
|
||||||
return "Usage: /dd-rift <dungeon name>\r\n" +
|
return "Usage: /dd-rift <dungeon name>\r\n" +
|
||||||
" /dd-rift list\r\n" +
|
" /dd-rift list\r\n" +
|
||||||
" /dd-rift random";
|
" /dd-rift random";
|
||||||
@@ -45,7 +45,7 @@ public class CommandCreateDungeonRift extends DDCommandBase
|
|||||||
{
|
{
|
||||||
NewDimData dimension;
|
NewDimData dimension;
|
||||||
DungeonHelper dungeonHelper = DungeonHelper.instance();
|
DungeonHelper dungeonHelper = DungeonHelper.instance();
|
||||||
|
|
||||||
if (sender.worldObj.isRemote)
|
if (sender.worldObj.isRemote)
|
||||||
{
|
{
|
||||||
return DDCommandResult.SUCCESS;
|
return DDCommandResult.SUCCESS;
|
||||||
@@ -58,15 +58,15 @@ public class CommandCreateDungeonRift extends DDCommandBase
|
|||||||
{
|
{
|
||||||
return DDCommandResult.TOO_MANY_ARGUMENTS;
|
return DDCommandResult.TOO_MANY_ARGUMENTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (command[0].equals("list"))
|
if (command[0].equals("list"))
|
||||||
{
|
{
|
||||||
Collection<String> dungeonNames = dungeonHelper.getDungeonNames();
|
Collection<String> dungeonNames = dungeonHelper.getDungeonNames();
|
||||||
for (String name : dungeonNames)
|
for (String name : dungeonNames)
|
||||||
{
|
{
|
||||||
sendChat(sender,(name));
|
sendChat(sender, name);
|
||||||
}
|
}
|
||||||
sendChat(sender,(""));
|
sendChat(sender, "");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -79,12 +79,12 @@ public class CommandCreateDungeonRift extends DDCommandBase
|
|||||||
|
|
||||||
if (command[0].equals("random"))
|
if (command[0].equals("random"))
|
||||||
{
|
{
|
||||||
|
|
||||||
dimension = PocketManager.getDimensionData(sender.worldObj);
|
|
||||||
link = dimension.createLink(x, y + 1, z, LinkTypes.DUNGEON,orientation);
|
|
||||||
sender.worldObj.setBlock(x, y + 1, z,mod_pocketDim.blockRift.blockID,0,3);
|
|
||||||
|
|
||||||
sendChat(sender,("Created a rift to a random dungeon."));
|
dimension = PocketManager.getDimensionData(sender.worldObj);
|
||||||
|
link = dimension.createLink(x, y + 1, z, LinkTypes.DUNGEON, orientation);
|
||||||
|
sender.worldObj.setBlock(x, y + 1, z,mod_pocketDim.blockRift.blockID, 0, 3);
|
||||||
|
|
||||||
|
sendChat(sender, "Created a rift to a random dungeon.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -94,17 +94,17 @@ public class CommandCreateDungeonRift extends DDCommandBase
|
|||||||
result = findDungeonByPartialName(command[0], dungeonHelper.getUntaggedDungeons());
|
result = findDungeonByPartialName(command[0], dungeonHelper.getUntaggedDungeons());
|
||||||
}
|
}
|
||||||
//Check if we found any matches
|
//Check if we found any matches
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
//Create a rift to our selected dungeon and notify the player
|
//Create a rift to our selected dungeon and notify the player
|
||||||
//TODO currently crashes, need to create the dimension first
|
//TODO currently crashes, need to create the dimension first
|
||||||
dimension = PocketManager.getDimensionData(sender.worldObj);
|
dimension = PocketManager.getDimensionData(sender.worldObj);
|
||||||
link = dimension.createLink(x, y + 1, z, LinkTypes.DUNGEON,orientation);
|
link = dimension.createLink(x, y + 1, z, LinkTypes.DUNGEON, orientation);
|
||||||
PocketBuilder.generateSelectedDungeonPocket(link, mod_pocketDim.properties, result);
|
PocketBuilder.generateSelectedDungeonPocket(link, mod_pocketDim.properties, result);
|
||||||
|
|
||||||
sender.worldObj.setBlock(x, y + 1, z,mod_pocketDim.blockRift.blockID,0,3);
|
sender.worldObj.setBlock(x, y + 1, z, mod_pocketDim.blockRift.blockID, 0, 3);
|
||||||
sendChat(sender,("Created a rift to \"" + result.schematicName() + "\" dungeon (Dimension ID = " + link.destination().getDimension() + ")."));
|
sendChat(sender, "Created a rift to \"" + result.schematicName() + "\" dungeon (Dimension ID = " + link.destination().getDimension() + ").");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//No matches!
|
//No matches!
|
||||||
@@ -114,7 +114,7 @@ public class CommandCreateDungeonRift extends DDCommandBase
|
|||||||
}
|
}
|
||||||
return DDCommandResult.SUCCESS;
|
return DDCommandResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
private DungeonData findDungeonByPartialName(String query, Collection<DungeonData> dungeons)
|
private DungeonData findDungeonByPartialName(String query, Collection<DungeonData> dungeons)
|
||||||
{
|
{
|
||||||
//Search for the shortest dungeon name that contains the lowercase query string.
|
//Search for the shortest dungeon name that contains the lowercase query string.
|
||||||
@@ -122,12 +122,12 @@ public class CommandCreateDungeonRift extends DDCommandBase
|
|||||||
String normalQuery = query.toLowerCase();
|
String normalQuery = query.toLowerCase();
|
||||||
DungeonData bestMatch = null;
|
DungeonData bestMatch = null;
|
||||||
int matchLength = Integer.MAX_VALUE;
|
int matchLength = Integer.MAX_VALUE;
|
||||||
|
|
||||||
for (DungeonData dungeon : dungeons)
|
for (DungeonData dungeon : dungeons)
|
||||||
{
|
{
|
||||||
//We need to extract the file's name. Comparing against schematicPath could
|
//We need to extract the file's name. Comparing against schematicPath could
|
||||||
//yield false matches if the query string is contained within the path.
|
//yield false matches if the query string is contained within the path.
|
||||||
|
|
||||||
dungeonName = dungeon.schematicName().toLowerCase();
|
dungeonName = dungeon.schematicName().toLowerCase();
|
||||||
if (dungeonName.length() < matchLength && dungeonName.contains(normalQuery))
|
if (dungeonName.length() < matchLength && dungeonName.contains(normalQuery))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ public class TileEntityRift extends TileEntity
|
|||||||
private boolean hasUpdated = false;
|
private boolean hasUpdated = false;
|
||||||
|
|
||||||
public HashMap<Integer, double[]> renderingCenters = new HashMap<Integer, double[]>();
|
public HashMap<Integer, double[]> renderingCenters = new HashMap<Integer, double[]>();
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public DimLink nearestRiftData;
|
public DimLink nearestRiftData;
|
||||||
public int spawnedEndermenID=0;
|
public int spawnedEndermenID=0;
|
||||||
DataWatcher watcher = new DataWatcher();
|
DataWatcher watcher = new DataWatcher();
|
||||||
@@ -156,7 +155,6 @@ public class TileEntityRift extends TileEntity
|
|||||||
{
|
{
|
||||||
if (random.nextInt(30) == 0)
|
if (random.nextInt(30) == 0)
|
||||||
{
|
{
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
List<Entity> list = worldObj.getEntitiesWithinAABB(EntityEnderman.class,
|
List<Entity> list = worldObj.getEntitiesWithinAABB(EntityEnderman.class,
|
||||||
AxisAlignedBB.getBoundingBox(xCoord - 9, yCoord - 3, zCoord - 9, xCoord + 9, yCoord + 3, zCoord + 9));
|
AxisAlignedBB.getBoundingBox(xCoord - 9, yCoord - 3, zCoord - 9, xCoord + 9, yCoord + 3, zCoord + 9));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user