merged SenseiKiwi changes

This commit is contained in:
StevenRS11 2013-06-16 01:50:23 -04:00
parent a2eb4cf524
commit 0752c032d3
9 changed files with 515 additions and 555 deletions

View file

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Random;
import net.minecraft.item.Item;
import net.minecraft.util.WeightedRandomChestContent;
import net.minecraftforge.common.ChestGenHooks;
@ -27,9 +28,9 @@ public class DDLoot {
public static ChestGenHooks DungeonChestInfo = null;
private static final int CHEST_SIZE = 5;
private static final int COMMON_LOOT_WEIGHT = 10; //As common as iron ingots
private static final int UNCOMMON_LOOT_WEIGHT = 5; //As common as iron armor loot
private static final int RARE_LOOT_WEIGHT = 3; //As common as diamonds
private static final int COMMON_LOOT_WEIGHT = 9; //1 less than weight of iron ingots
private static final int UNCOMMON_LOOT_WEIGHT = 4; //1 less than weight of iron armor
private static final int RARE_LOOT_WEIGHT = 1; //Same weight as music discs, golden apple
private static final int DUNGEON_CHEST_WEIGHT_INFLATION = 10; // (weight of iron ingots in dungeon) / (weight of iron ingots in other chests)
public static void registerInfo()
@ -113,6 +114,19 @@ public class DDLoot {
}
}
//I've added a minor hack here to make enchanted books more common
//If this is necessary for more items, create an override table and use that
//rather than hardcoding the changes below
final int enchantedBookID = Item.enchantedBook.itemID;
for (WeightedRandomChestContent item : container.values())
{
if (item.theItemId.itemID == enchantedBookID)
{
item.itemWeight = 3;
break;
}
}
//Return merged list
return new ArrayList<WeightedRandomChestContent>( container.values() );
}

View file

@ -7,11 +7,8 @@ import java.util.Random;
import net.minecraft.world.World;
public class DungeonGenerator implements Serializable
{
public int weight;
public String schematicPath;
public ArrayList<HashMap> sideRifts = new ArrayList<HashMap>();
@ -22,21 +19,10 @@ public class DungeonGenerator implements Serializable
public int exitDoorsSoFar=0;
public int deadEndsSoFar=0;
public DungeonGenerator(int weight, String schematicPath, Boolean isOpen)
{
this.weight=weight;
this.schematicPath=schematicPath;
this.isOpen=isOpen;
}
}

View file

@ -173,7 +173,7 @@ public class SchematicLoader
}
public int transformMetadata(int metadata, int orientation, int blockID)
{
if(mod_pocketDim.dungeonHelper.metadataFlipList.contains(blockID))
if (DungeonHelper.instance().metadataFlipList.contains(blockID))
{
@ -984,8 +984,7 @@ public class SchematicLoader
if(world.getBlockTileEntity(i+xCooe, j+yCooe, k+zCooe) instanceof TileEntityChest)
{
TileEntityChest chest = (TileEntityChest) world.getBlockTileEntity(i+xCooe, j+yCooe, k+zCooe);
ChestGenHooks info = ChestGenHooks.getInfo(DDLoot.DIMENSIONAL_DUNGEON_CHEST);
ChestGenHooks info = DDLoot.DungeonChestInfo;
WeightedRandomChestContent.generateChestContents(rand, info.getItems(rand), (TileEntityChest)world.getBlockTileEntity(i+xCooe, j+yCooe, k+zCooe), info.getCount(rand));
}
if(world.getBlockTileEntity(i+xCooe, j+yCooe, k+zCooe) instanceof TileEntityDispenser)

View file

@ -8,6 +8,7 @@ import StevenDimDoors.mod_pocketDim.DimData;
import StevenDimDoors.mod_pocketDim.DungeonGenerator;
import StevenDimDoors.mod_pocketDim.LinkData;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper;
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommandSender;
@ -27,8 +28,9 @@ public class CommandAddDungeonRift extends CommandBase
@Override
public void processCommand(ICommandSender var1, String[] var2)
{
DungeonHelper dungeonHelper = DungeonHelper.instance();
if(var2==null||this.getCommandSenderAsPlayer(var1).worldObj.isRemote)
{
return;
@ -54,7 +56,7 @@ public class CommandAddDungeonRift extends CommandBase
}
else if(var2.length!=0&&var2[0].equals("list"))
{
for(DungeonGenerator dungeonGen : mod_pocketDim.dungeonHelper.registeredDungeons)
for(DungeonGenerator dungeonGen : dungeonHelper.registeredDungeons)
{
String dungeonName =dungeonGen.schematicPath;
if(dungeonName.contains("DimDoors_Custom_schematics"))
@ -69,7 +71,7 @@ public class CommandAddDungeonRift extends CommandBase
}
for(DungeonGenerator dungeonGen : mod_pocketDim.dungeonHelper.customDungeons)
for(DungeonGenerator dungeonGen : dungeonHelper.customDungeons)
{
String dungeonName =dungeonGen.schematicPath;
if(dungeonName.contains("DimDoors_Custom_schematics"))
@ -89,7 +91,7 @@ public class CommandAddDungeonRift extends CommandBase
else if(var2.length!=0)
{
for(DungeonGenerator dungeonGen : mod_pocketDim.dungeonHelper.registeredDungeons)
for(DungeonGenerator dungeonGen : dungeonHelper.registeredDungeons)
{
String dungeonName =dungeonGen.schematicPath.toLowerCase();
@ -113,7 +115,7 @@ public class CommandAddDungeonRift extends CommandBase
}
for(DungeonGenerator dungeonGen : mod_pocketDim.dungeonHelper.customDungeons)
for(DungeonGenerator dungeonGen : dungeonHelper.customDungeons)
{
String dungeonName =dungeonGen.schematicPath.toLowerCase();

View file

@ -8,11 +8,11 @@ import net.minecraft.entity.player.EntityPlayer;
import StevenDimDoors.mod_pocketDim.DDProperties;
import StevenDimDoors.mod_pocketDim.DungeonGenerator;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper;
public class CommandEndDungeonCreation extends CommandBase
{
private static DDProperties properties = null;
private static Pattern nameFilter = Pattern.compile("[A-Za-z0-9_]+");
public CommandEndDungeonCreation()
{
@ -28,9 +28,11 @@ public class CommandEndDungeonCreation extends CommandBase
@Override
public void processCommand(ICommandSender var1, String[] var2)
{
DungeonHelper dungeonHelper = DungeonHelper.instance();
EntityPlayer player = this.getCommandSenderAsPlayer(var1);
if(!mod_pocketDim.dungeonHelper.customDungeonStatus.containsKey(player.worldObj.provider.dimensionId))
if (!dungeonHelper.customDungeonStatus.containsKey(player.worldObj.provider.dimensionId))
{
if(var2.length<2)
{
@ -59,13 +61,12 @@ public class CommandEndDungeonCreation extends CommandBase
else if(!player.worldObj.isRemote)
{
//Check that the dungeon name is valid to prevent directory traversal and other forms of abuse
if (nameFilter.matcher(var2[0]).matches())
if (DungeonHelper.NamePattern.matcher(var2[0]).matches())
{
DungeonGenerator newDungeon = mod_pocketDim.dungeonHelper.exportDungeon(player.worldObj, x, y, z, properties.CustomSchematicDirectory + "/" + var2[0] + ".schematic");
player.sendChatToPlayer("created dungeon schematic in " + properties.CustomSchematicDirectory +"/"+var2[0]+".schematic");
mod_pocketDim.dungeonHelper.customDungeons.add(newDungeon);
DungeonGenerator newDungeon = dungeonHelper.exportDungeon(player.worldObj, x, y, z, properties.CustomSchematicDirectory + "/" + var2[0] + ".schematic");
player.sendChatToPlayer("created dungeon schematic in " + properties.CustomSchematicDirectory + "/" + var2[0]+".schematic");
if(mod_pocketDim.dungeonHelper.customDungeonStatus.containsKey(player.worldObj.provider.dimensionId)&&!player.worldObj.isRemote)
if (dungeonHelper.customDungeonStatus.containsKey(player.worldObj.provider.dimensionId) && !player.worldObj.isRemote)
{
// mod_pocketDim.dungeonHelper.customDungeonStatus.remove(player.worldObj.provider.dimensionId);
// dimHelper.instance.teleportToPocket(player.worldObj, mod_pocketDim.dungeonHelper.customDungeonStatus.get(player.worldObj.provider.dimensionId), player);

View file

@ -53,7 +53,7 @@ public class CommandStartDungeonCreation extends CommandBase
// dimHelper.instance.teleportToPocket(player.worldObj, link, player);
mod_pocketDim.dungeonHelper.customDungeonStatus.put(link.destDimID, dimHelper.instance.getLinkDataFromCoords(link.destXCoord, link.destYCoord, link.destZCoord, link.destDimID));
DungeonHelper.instance().customDungeonStatus.put(link.destDimID, dimHelper.instance.getLinkDataFromCoords(link.destXCoord, link.destYCoord, link.destZCoord, link.destDimID));
this.getCommandSenderAsPlayer(var1).sendChatToPlayer("DimID = "+ link.destDimID);
}

File diff suppressed because it is too large Load diff

View file

@ -978,7 +978,7 @@ public class dimHelper extends DimensionManager
if(isRandomRift)
{
mod_pocketDim.dungeonHelper.generateDungeonlink(link);
DungeonHelper.instance().generateDungeonlink(link);
}

View file

@ -96,7 +96,6 @@ public class mod_pocketDim
public static SchematicLoader loader;
public static pocketTeleporter teleporter;
public static DungeonHelper dungeonHelper;
public static ICommand printDimData;
public static ICommand removeRiftsCommand;
@ -158,7 +157,6 @@ public class mod_pocketDim
loader = new SchematicLoader();
teleporter = new pocketTeleporter();
dungeonHelper= new DungeonHelper();
printDimData = new CommandPrintDimData();
removeRiftsCommand = new CommandDeleteRifts();
@ -170,19 +168,6 @@ public class mod_pocketDim
startDungeonCreation = new CommandStartDungeonCreation();
tracker = new PlayerRespawnTracker();
riftGen = new RiftGenerator();
File file= new File(properties.CustomSchematicDirectory);
file.mkdir();
String helpFile = "/mods/DimDoors/How_to_add_dungeons.txt";
if(new File(helpFile).exists())
{
copyfile.copyFile(helpFile, file+"/How_to_add_dungeons.txt");
}
dungeonHelper.importCustomDungeons(properties.CustomSchematicDirectory);
dungeonHelper.registerBaseDungeons();
dungeonHelper.registerDungeonTypeTags();
}
@Init
@ -250,7 +235,6 @@ public class mod_pocketDim
LanguageRegistry.addName(itemDimDoor, "Dimensional Door");
LanguageRegistry.addName(itemRiftBlade , "Rift Blade");
TickRegistry.registerTickHandler(new ClientTickHandler(), Side.CLIENT);
TickRegistry.registerTickHandler(new CommonTickHandler(), Side.SERVER);
@ -391,8 +375,8 @@ public class mod_pocketDim
mod_pocketDim.blocksImmuneToRift.add(Block.blockLapis.blockID);
mod_pocketDim.blocksImmuneToRift.add(Block.bedrock.blockID);
dungeonHelper.registerFlipBlocks();
DungeonHelper.create();
proxy.loadTextures();
proxy.registerRenderers();
}