@@ -1 +0,0 @@
|
|||||||
Experiment here
|
|
||||||
@@ -15,7 +15,7 @@ apply plugin: 'forge'
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
version = "2.2.1RC1-" + System.getenv("BUILD_NUMBER")
|
version = "2.2.2RC1-" + System.getenv("BUILD_NUMBER")
|
||||||
group= "com.stevenrs11.dimdoors" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
group= "com.stevenrs11.dimdoors" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||||
archivesBaseName = "DimensionalDoors"
|
archivesBaseName = "DimensionalDoors"
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
package StevenDimDoors.experimental;
|
|
||||||
|
|
||||||
import net.minecraftforge.fluids.Fluid;
|
|
||||||
|
|
||||||
public class LiquidCorium extends Fluid
|
|
||||||
{
|
|
||||||
|
|
||||||
public LiquidCorium(String fluidName)
|
|
||||||
{
|
|
||||||
super(fluidName);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,106 +0,0 @@
|
|||||||
package StevenDimDoors.experimental;
|
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
import StevenDimDoors.mod_pocketDim.Point3D;
|
|
||||||
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.entity.EntityLivingBase;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.Icon;
|
|
||||||
import net.minecraft.util.MathHelper;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.fluids.BlockFluidBase;
|
|
||||||
import net.minecraftforge.fluids.BlockFluidFinite;
|
|
||||||
import net.minecraftforge.fluids.Fluid;
|
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
|
||||||
|
|
||||||
public class LiquidCoriumBlock extends BlockFluidFinite
|
|
||||||
{
|
|
||||||
private Icon iconFlowing;
|
|
||||||
private Icon iconStill;
|
|
||||||
|
|
||||||
public static Point3D[] spreadPoints= new Point3D[4];
|
|
||||||
public LiquidCoriumBlock(int id, Fluid fluid, Material material)
|
|
||||||
{
|
|
||||||
super(id, fluid, material);
|
|
||||||
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack)
|
|
||||||
{
|
|
||||||
par1World.setBlock(par2, par3, par4, this.blockID,15,2);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateTick(World world, int x, int y, int z, Random rand)
|
|
||||||
{
|
|
||||||
boolean didChange=false;
|
|
||||||
int fluid = this.getQuantaValue(world, x, y, z);
|
|
||||||
int blockBeneath = world.getBlockId(x, y-1,z);
|
|
||||||
|
|
||||||
if(!(blockBeneath==0||blockBeneath==this.blockID))
|
|
||||||
{
|
|
||||||
for(int xCount=-1;xCount<2;xCount++)
|
|
||||||
{
|
|
||||||
for(int yCount=-1;yCount<1;yCount++)
|
|
||||||
{
|
|
||||||
for(int zCount=-1;zCount<2;zCount++)
|
|
||||||
{
|
|
||||||
int id= world.getBlockId(x+xCount, y+yCount, z+zCount);
|
|
||||||
if(!(id ==0||id==this.blockID||id==Block.bedrock.blockID)&&!(Math.abs(zCount)+Math.abs(yCount)+Math.abs(xCount)>1))
|
|
||||||
{
|
|
||||||
Block block =Block.blocksList[id];
|
|
||||||
if(block.getUnlocalizedName().contains("ore"))
|
|
||||||
{
|
|
||||||
world.setBlock(x+xCount, y+yCount, z+zCount,this.blockID,6,2);
|
|
||||||
}
|
|
||||||
if(fluid>block.blockHardness*2&&yCount==0&&rand.nextInt(3)==0)
|
|
||||||
{
|
|
||||||
didChange=true;;
|
|
||||||
world.setBlock(x+xCount, y+yCount, z+zCount,0);
|
|
||||||
}
|
|
||||||
else if(fluid>block.blockHardness*2+1&&yCount==-1&&!didChange&&rand.nextBoolean())
|
|
||||||
{
|
|
||||||
world.setBlock(x+xCount, y+yCount, z+zCount, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if((fluid==1)&&blockBeneath!=this.blockID&&blockBeneath!=Block.bedrock.blockID)
|
|
||||||
{
|
|
||||||
world.setBlockToAir(x, y, z);
|
|
||||||
world.setBlock(x, y-1, z,Block.bedrock.blockID);
|
|
||||||
}
|
|
||||||
super.updateTick(world, x, y, z, rand);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
@Override
|
|
||||||
public void registerIcons(IconRegister ir)
|
|
||||||
{
|
|
||||||
|
|
||||||
iconStill = ir.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName()+"_still");
|
|
||||||
iconFlowing = ir.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName()+"_flowing");
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public Icon getIcon(int side, int meta)
|
|
||||||
{
|
|
||||||
return side <= 1 ? iconStill : iconFlowing;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -3,11 +3,11 @@ package StevenDimDoors.mod_pocketDim;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.enchantment.Enchantment;
|
import net.minecraft.enchantment.Enchantment;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.util.WeightedRandom;
|
import net.minecraft.util.WeightedRandom;
|
||||||
import net.minecraft.util.WeightedRandomChestContent;
|
import net.minecraft.util.WeightedRandomChestContent;
|
||||||
@@ -19,10 +19,14 @@ import StevenDimDoors.mod_pocketDim.util.WeightedContainer;
|
|||||||
*/
|
*/
|
||||||
public class DDLoot {
|
public class DDLoot {
|
||||||
|
|
||||||
|
private static final String[] SPECIAL_SKULL_OWNERS = new String[] { "stevenrs11", "kamikazekiwi3", "Jaitsu", "XCompWiz", "skyboy026", "Wylker" };
|
||||||
|
|
||||||
private static final double MIN_ITEM_DAMAGE = 0.3;
|
private static final double MIN_ITEM_DAMAGE = 0.3;
|
||||||
private static final double MAX_ITEM_DAMAGE = 0.9;
|
private static final double MAX_ITEM_DAMAGE = 0.9;
|
||||||
private static final int ITEM_ENCHANTMENT_CHANCE = 50;
|
private static final int ITEM_ENCHANTMENT_CHANCE = 50;
|
||||||
private static final int MAX_ITEM_ENCHANTMENT_CHANCE = 100;
|
private static final int MAX_ITEM_ENCHANTMENT_CHANCE = 100;
|
||||||
|
private static final int SPECIAL_SKULL_CHANCE = 20;
|
||||||
|
private static final int MAX_SPECIAL_SKULL_CHANCE = 100;
|
||||||
|
|
||||||
public static final String DIMENSIONAL_DUNGEON_CHEST = "dimensionalDungeonChest";
|
public static final String DIMENSIONAL_DUNGEON_CHEST = "dimensionalDungeonChest";
|
||||||
public static ChestGenHooks DungeonChestInfo = null;
|
public static ChestGenHooks DungeonChestInfo = null;
|
||||||
@@ -49,11 +53,9 @@ public class DDLoot {
|
|||||||
addContent(true, items, Item.diamond.itemID, 40, 1, 2);
|
addContent(true, items, Item.diamond.itemID, 40, 1, 2);
|
||||||
addContent(true, items, Item.emerald.itemID, 20, 1, 2);
|
addContent(true, items, Item.emerald.itemID, 20, 1, 2);
|
||||||
addContent(true, items, Item.appleGold.itemID, 10);
|
addContent(true, items, Item.appleGold.itemID, 10);
|
||||||
addContent(true, items, Item.eyeOfEnder.itemID, 15);
|
|
||||||
addContent(true, items, Item.ghastTear.itemID, 15);
|
|
||||||
|
|
||||||
addContent(properties.FabricOfRealityLootEnabled, items, mod_pocketDim.blockDimWall.blockID, 80, 4, 16);
|
addContent(properties.FabricOfRealityLootEnabled, items, mod_pocketDim.blockDimWall.blockID, 20, 16, 64);
|
||||||
addContent(properties.WorldThreadLootEnabled, items, mod_pocketDim.itemWorldThread.itemID, 90, 2,10);
|
addContent(properties.WorldThreadLootEnabled, items, mod_pocketDim.itemWorldThread.itemID, 80, 2, 8);
|
||||||
|
|
||||||
// Add all the items to our dungeon chest
|
// Add all the items to our dungeon chest
|
||||||
addItemsToContainer(DungeonChestInfo, items);
|
addItemsToContainer(DungeonChestInfo, items);
|
||||||
@@ -194,15 +196,17 @@ public class DDLoot {
|
|||||||
// Insert other random stuff
|
// Insert other random stuff
|
||||||
// 40% chance for a name tag, 35% chance for a glass bottle
|
// 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 an ender pearl, 5% chance for record 11
|
||||||
|
// 30% chance for a ghast tear
|
||||||
addItemWithChance(stacks, random, 40, Item.nameTag, 1);
|
addItemWithChance(stacks, random, 40, Item.nameTag, 1);
|
||||||
addItemWithChance(stacks, random, 35, Item.glassBottle, 1);
|
addItemWithChance(stacks, random, 35, Item.glassBottle, 1);
|
||||||
addItemWithChance(stacks, random, 30, Item.enderPearl, 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, 5, Item.record11, 1);
|
||||||
|
|
||||||
// Finally, there is a 3% chance of adding a player head
|
// Finally, there is a 5% chance of adding a player head
|
||||||
if (random.nextInt(100) < 50) // FIXME: SET TO 50% FOR TESTING, CHANGE TO 3%
|
if (random.nextInt(100) < 5)
|
||||||
{
|
{
|
||||||
stacks.add( new ItemStack(Block.skull) );
|
addGraveSkull(stacks, random);
|
||||||
}
|
}
|
||||||
|
|
||||||
fillChest(stacks, inventory, random);
|
fillChest(stacks, inventory, random);
|
||||||
@@ -270,4 +274,23 @@ public class DDLoot {
|
|||||||
int damage = (int) (item.getMaxDamage() * MathHelper.getRandomDoubleInRange(random, MIN_ITEM_DAMAGE, MAX_ITEM_DAMAGE));
|
int damage = (int) (item.getMaxDamage() * MathHelper.getRandomDoubleInRange(random, MIN_ITEM_DAMAGE, MAX_ITEM_DAMAGE));
|
||||||
return new ItemStack(item, 1, damage);
|
return new ItemStack(item, 1, damage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void addGraveSkull(ArrayList<ItemStack> stacks, Random random)
|
||||||
|
{
|
||||||
|
final int PLAYER_SKULL_METADATA = 3;
|
||||||
|
DeathTracker deathTracker = mod_pocketDim.deathTracker;
|
||||||
|
String skullOwner;
|
||||||
|
if (deathTracker.isEmpty() || (random.nextInt(MAX_SPECIAL_SKULL_CHANCE) < SPECIAL_SKULL_CHANCE))
|
||||||
|
{
|
||||||
|
skullOwner = SPECIAL_SKULL_OWNERS[ random.nextInt(SPECIAL_SKULL_OWNERS.length) ];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
skullOwner = deathTracker.getRandomUsername(random);
|
||||||
|
}
|
||||||
|
ItemStack skull = new ItemStack(Item.skull, 1, PLAYER_SKULL_METADATA);
|
||||||
|
skull.stackTagCompound = new NBTTagCompound();
|
||||||
|
skull.stackTagCompound.setString("SkullOwner", skullOwner);
|
||||||
|
stacks.add(skull);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ import java.io.File;
|
|||||||
|
|
||||||
import net.minecraftforge.common.Configuration;
|
import net.minecraftforge.common.Configuration;
|
||||||
import StevenDimDoors.mod_pocketDim.ticking.CustomLimboPopulator;
|
import StevenDimDoors.mod_pocketDim.ticking.CustomLimboPopulator;
|
||||||
import StevenDimDoors.mod_pocketDim.world.GatewayGenerator;
|
import StevenDimDoors.mod_pocketDim.world.fortresses.DDStructureNetherBridgeStart;
|
||||||
|
import StevenDimDoors.mod_pocketDim.world.gateways.GatewayGenerator;
|
||||||
|
|
||||||
public class DDProperties
|
public class DDProperties
|
||||||
{
|
{
|
||||||
@@ -21,7 +22,6 @@ public class DDProperties
|
|||||||
public final int TransientDoorID;
|
public final int TransientDoorID;
|
||||||
public final int FabricBlockID;
|
public final int FabricBlockID;
|
||||||
public final int RiftBlockID;
|
public final int RiftBlockID;
|
||||||
public final int CoriumBlockID;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* World Generation Block IDs
|
* World Generation Block IDs
|
||||||
@@ -105,6 +105,7 @@ public class DDProperties
|
|||||||
public final int NonTntWeight;
|
public final int NonTntWeight;
|
||||||
public final int ClusterGenerationChance;
|
public final int ClusterGenerationChance;
|
||||||
public final int GatewayGenerationChance;
|
public final int GatewayGenerationChance;
|
||||||
|
public final int FortressGatewayGenerationChance;
|
||||||
public final int MonolithSpawningChance;
|
public final int MonolithSpawningChance;
|
||||||
public final int LimboReturnRange;
|
public final int LimboReturnRange;
|
||||||
public final String CustomSchematicDirectory;
|
public final String CustomSchematicDirectory;
|
||||||
@@ -182,8 +183,6 @@ public class DDProperties
|
|||||||
GoldenDoorID = config.getBlock("Gold Door Block ID", 1980).getInt();
|
GoldenDoorID = config.getBlock("Gold Door Block ID", 1980).getInt();
|
||||||
GoldenDimensionalDoorID = config.getBlock("Gold Dim Door Block ID", 1981).getInt();
|
GoldenDimensionalDoorID = config.getBlock("Gold Dim Door Block ID", 1981).getInt();
|
||||||
|
|
||||||
CoriumBlockID = config.getBlock("Corium Block ID", 900).getInt();
|
|
||||||
|
|
||||||
WarpDoorItemID = config.getItem("Warp Door Item ID", 5670).getInt();
|
WarpDoorItemID = config.getItem("Warp Door Item ID", 5670).getInt();
|
||||||
RiftRemoverItemID = config.getItem("Rift Remover Item ID", 5671).getInt();
|
RiftRemoverItemID = config.getItem("Rift Remover Item ID", 5671).getInt();
|
||||||
StableFabricItemID = config.getItem("Stable Fabric Item ID", 5672).getInt();
|
StableFabricItemID = config.getItem("Stable Fabric Item ID", 5672).getInt();
|
||||||
@@ -220,6 +219,10 @@ public class DDProperties
|
|||||||
"Sets the chance (out of " + GatewayGenerator.MAX_GATEWAY_GENERATION_CHANCE + ") that a Rift Gateway will " +
|
"Sets the chance (out of " + GatewayGenerator.MAX_GATEWAY_GENERATION_CHANCE + ") that a Rift Gateway will " +
|
||||||
"generate in a given chunk. The default chance is 15.").getInt();
|
"generate in a given chunk. The default chance is 15.").getInt();
|
||||||
|
|
||||||
|
FortressGatewayGenerationChance = config.get(Configuration.CATEGORY_GENERAL, "Fortress Gateway Generation Chance", 33,
|
||||||
|
"Sets the chance (out of " + DDStructureNetherBridgeStart.MAX_GATEWAY_GENERATION_CHANCE + ") that a Rift Gateway will " +
|
||||||
|
"generate as part of a Nether Fortress. The default chance is 33.").getInt();
|
||||||
|
|
||||||
LimboBiomeID = config.get(CATEGORY_BIOME, "Limbo Biome ID", 251).getInt();
|
LimboBiomeID = config.get(CATEGORY_BIOME, "Limbo Biome ID", 251).getInt();
|
||||||
PocketBiomeID = config.get(CATEGORY_BIOME, "Pocket Biome ID", 250).getInt();
|
PocketBiomeID = config.get(CATEGORY_BIOME, "Pocket Biome ID", 250).getInt();
|
||||||
|
|
||||||
|
|||||||
102
src/main/java/StevenDimDoors/mod_pocketDim/DeathTracker.java
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
package StevenDimDoors.mod_pocketDim;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
public class DeathTracker
|
||||||
|
{
|
||||||
|
private ArrayList<String> usernameList;
|
||||||
|
private HashSet<String> usernameSet;
|
||||||
|
private String filePath;
|
||||||
|
private boolean modified;
|
||||||
|
|
||||||
|
public DeathTracker(String filePath)
|
||||||
|
{
|
||||||
|
this.usernameList = new ArrayList<String>();
|
||||||
|
this.usernameSet = new HashSet<String>();
|
||||||
|
this.filePath = filePath;
|
||||||
|
this.modified = false;
|
||||||
|
|
||||||
|
readFromFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void readFromFile()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(filePath)));
|
||||||
|
for (String line = reader.readLine(); line != null; line = reader.readLine())
|
||||||
|
{
|
||||||
|
line = line.trim();
|
||||||
|
if (!line.isEmpty())
|
||||||
|
{
|
||||||
|
usernameSet.add(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
reader.close();
|
||||||
|
}
|
||||||
|
catch (FileNotFoundException e) { }
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
System.err.println("An unexpected exception occurred while trying to read DeathTracker data:");
|
||||||
|
System.err.println(e.toString());
|
||||||
|
}
|
||||||
|
usernameList.addAll(usernameSet);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writeToFile()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
PrintWriter writer = new PrintWriter(filePath);
|
||||||
|
for (String username : usernameList)
|
||||||
|
{
|
||||||
|
writer.println(username);
|
||||||
|
}
|
||||||
|
writer.close();
|
||||||
|
modified = false;
|
||||||
|
}
|
||||||
|
catch (FileNotFoundException e)
|
||||||
|
{
|
||||||
|
System.err.println("An unexpected exception occurred while trying to read DeathTracker data:");
|
||||||
|
System.err.println(e.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isModified()
|
||||||
|
{
|
||||||
|
return modified;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isEmpty()
|
||||||
|
{
|
||||||
|
return usernameList.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRandomUsername(Random random)
|
||||||
|
{
|
||||||
|
if (usernameList.isEmpty())
|
||||||
|
{
|
||||||
|
throw new IllegalStateException("Cannot retrieve a random username from an empty list.");
|
||||||
|
}
|
||||||
|
return usernameList.get(random.nextInt(usernameList.size()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean addUsername(String username)
|
||||||
|
{
|
||||||
|
if (usernameSet.add(username))
|
||||||
|
{
|
||||||
|
usernameList.add(username);
|
||||||
|
modified = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,11 +22,9 @@ import net.minecraftforge.event.world.WorldEvent;
|
|||||||
import StevenDimDoors.mod_pocketDim.core.DDTeleporter;
|
import StevenDimDoors.mod_pocketDim.core.DDTeleporter;
|
||||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||||
import StevenDimDoors.mod_pocketDim.items.BaseItemDoor;
|
import StevenDimDoors.mod_pocketDim.items.BaseItemDoor;
|
||||||
import StevenDimDoors.mod_pocketDim.ticking.RiftRegenerator;
|
|
||||||
import StevenDimDoors.mod_pocketDim.util.Point4D;
|
import StevenDimDoors.mod_pocketDim.util.Point4D;
|
||||||
import StevenDimDoors.mod_pocketDim.world.LimboProvider;
|
import StevenDimDoors.mod_pocketDim.world.LimboProvider;
|
||||||
import StevenDimDoors.mod_pocketDim.world.PocketProvider;
|
import StevenDimDoors.mod_pocketDim.world.PocketProvider;
|
||||||
import StevenDimDoors.mod_pocketDim.world.fortresses.DDNetherFortressGenerator;
|
|
||||||
import cpw.mods.fml.client.FMLClientHandler;
|
import cpw.mods.fml.client.FMLClientHandler;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
@@ -43,10 +41,15 @@ public class EventHookContainer
|
|||||||
@ForgeSubscribe(priority = EventPriority.LOW)
|
@ForgeSubscribe(priority = EventPriority.LOW)
|
||||||
public void onMapGen(InitMapGenEvent event)
|
public void onMapGen(InitMapGenEvent event)
|
||||||
{
|
{
|
||||||
if (event.type == InitMapGenEvent.EventType.NETHER_BRIDGE)
|
// Replace the Nether fortress generator with our own only if any gateways would ever generate.
|
||||||
|
// This allows admins to disable our fortress overriding without disabling all gateways.
|
||||||
|
/*
|
||||||
|
if (properties.FortressGatewayGenerationChance > 0 && properties.WorldRiftGenerationEnabled &&
|
||||||
|
event.type == InitMapGenEvent.EventType.NETHER_BRIDGE)
|
||||||
{
|
{
|
||||||
event.newGen = new DDNetherFortressGenerator();
|
event.newGen = new DDNetherFortressGenerator();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
@@ -130,11 +133,6 @@ public class EventHookContainer
|
|||||||
PocketManager.load();
|
PocketManager.load();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PocketManager.isLoaded())
|
|
||||||
{
|
|
||||||
RiftRegenerator.regenerateRiftsInAllWorlds();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event.world != null)
|
if (event.world != null)
|
||||||
{
|
{
|
||||||
this.playMusicForDim(event.world);
|
this.playMusicForDim(event.world);
|
||||||
@@ -148,37 +146,72 @@ public class EventHookContainer
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ForgeSubscribe(priority = EventPriority.HIGHEST)
|
@ForgeSubscribe(priority = EventPriority.HIGHEST)
|
||||||
public boolean LivingDeathEvent(LivingDeathEvent event)
|
public boolean onDeathWithHighPriority(LivingDeathEvent event)
|
||||||
{
|
{
|
||||||
|
// Teleport the entity to Limbo if it's a player in a pocket dimension and
|
||||||
|
// if Limbo preserves player inventories. We'll check again in a low-priority event handler
|
||||||
|
// to give other mods a chance to save the player if Limbo does _not_ preserve inventories.
|
||||||
|
|
||||||
Entity entity = event.entity;
|
Entity entity = event.entity;
|
||||||
|
|
||||||
if (entity instanceof EntityPlayer && properties.LimboEnabled &&
|
if (entity instanceof EntityPlayer && properties.LimboEnabled &&
|
||||||
entity.worldObj.provider instanceof PocketProvider)
|
entity.worldObj.provider instanceof PocketProvider && properties.LimboReturnsInventoryEnabled)
|
||||||
{
|
{
|
||||||
EntityPlayer player = (EntityPlayer) entity;
|
EntityPlayer player = (EntityPlayer) entity;
|
||||||
if (!properties.LimboReturnsInventoryEnabled)
|
mod_pocketDim.deathTracker.addUsername(player.username);
|
||||||
{
|
revivePlayerInLimbo(player);
|
||||||
player.inventory.clearInventory(-1, -1);
|
|
||||||
}
|
|
||||||
player.extinguish();
|
|
||||||
player.clearActivePotions();
|
|
||||||
ChunkCoordinates coords = LimboProvider.getLimboSkySpawn(player.worldObj.rand);
|
|
||||||
Point4D destination = new Point4D((int) (coords.posX+entity.posX), coords.posY, (int) (coords.posZ+entity.posZ ), mod_pocketDim.properties.LimboDimensionID);
|
|
||||||
DDTeleporter.teleportEntity(player, destination, false);
|
|
||||||
player.setHealth(player.getMaxHealth());
|
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ForgeSubscribe(priority = EventPriority.LOWEST)
|
||||||
|
public boolean onDeathWithLowPriority(LivingDeathEvent event)
|
||||||
|
{
|
||||||
|
// This low-priority handler gives mods a chance to save a player from death before we apply
|
||||||
|
// teleporting them to Limbo _without_ preserving their inventory. We also check if the player
|
||||||
|
// died in a pocket dimension and record it, regardless of whether the player will be sent to Limbo.
|
||||||
|
|
||||||
|
Entity entity = event.entity;
|
||||||
|
|
||||||
|
if (entity instanceof EntityPlayer && entity.worldObj.provider instanceof PocketProvider)
|
||||||
|
{
|
||||||
|
EntityPlayer player = (EntityPlayer) entity;
|
||||||
|
mod_pocketDim.deathTracker.addUsername(player.username);
|
||||||
|
|
||||||
|
if (properties.LimboEnabled && !properties.LimboReturnsInventoryEnabled)
|
||||||
|
{
|
||||||
|
player.inventory.clearInventory(-1, -1);
|
||||||
|
revivePlayerInLimbo(player);
|
||||||
|
event.setCanceled(true);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void revivePlayerInLimbo(EntityPlayer player)
|
||||||
|
{
|
||||||
|
player.extinguish();
|
||||||
|
player.clearActivePotions();
|
||||||
|
player.setHealth(player.getMaxHealth());
|
||||||
|
ChunkCoordinates coords = LimboProvider.getLimboSkySpawn(player.worldObj.rand);
|
||||||
|
Point4D destination = new Point4D((int) (coords.posX + player.posX), coords.posY, (int) (coords.posZ + player.posZ ), mod_pocketDim.properties.LimboDimensionID);
|
||||||
|
DDTeleporter.teleportEntity(player, destination, false);
|
||||||
|
}
|
||||||
|
|
||||||
@ForgeSubscribe
|
@ForgeSubscribe
|
||||||
public void onWorldSave(WorldEvent.Save event)
|
public void onWorldSave(WorldEvent.Save event)
|
||||||
{
|
{
|
||||||
if (event.world.provider.dimensionId == 0)
|
if (event.world.provider.dimensionId == 0)
|
||||||
{
|
{
|
||||||
PocketManager.save();
|
PocketManager.save();
|
||||||
|
|
||||||
|
if (mod_pocketDim.deathTracker != null && mod_pocketDim.deathTracker.isModified())
|
||||||
|
{
|
||||||
|
mod_pocketDim.deathTracker.writeToFile();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,39 +0,0 @@
|
|||||||
package StevenDimDoors.mod_pocketDim;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
|
||||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
|
||||||
import net.minecraftforge.common.DimensionManager;
|
|
||||||
import net.minecraftforge.common.network.ForgePacket;
|
|
||||||
import net.minecraftforge.common.network.packet.DimensionRegisterPacket;
|
|
||||||
import cpw.mods.fml.common.IPlayerTracker;
|
|
||||||
|
|
||||||
public class PlayerTracker implements IPlayerTracker
|
|
||||||
{
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPlayerLogin(EntityPlayer player)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPlayerLogout(EntityPlayer player) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPlayerChangedDimension(EntityPlayer player) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPlayerRespawn(EntityPlayer player)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -36,14 +36,15 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||||||
|
|
||||||
public class BlockRift extends Block implements ITileEntityProvider
|
public class BlockRift extends Block implements ITileEntityProvider
|
||||||
{
|
{
|
||||||
private static final float MIN_IMMUNE_HARDNESS = 200.0F;
|
private static final float MIN_IMMUNE_RESISTANCE = 5000.0F;
|
||||||
private static final int BLOCK_DESTRUCTION_RANGE = 4;
|
private static final int BLOCK_DESTRUCTION_RANGE = 4;
|
||||||
private static final int BLOCK_DESTRUCTION_VOLUME = (int) Math.pow(2 * BLOCK_DESTRUCTION_RANGE + 1, 3);
|
private static final int BLOCK_DESTRUCTION_VOLUME = (int) Math.pow(2 * BLOCK_DESTRUCTION_RANGE + 1, 3);
|
||||||
private static final int MAX_BLOCK_SEARCH_CHANCE = 100;
|
private static final int MAX_BLOCK_SEARCH_CHANCE = 100;
|
||||||
private static final int BLOCK_SEARCH_CHANCE = 50;
|
private static final int BLOCK_SEARCH_CHANCE = 50;
|
||||||
private static final int MAX_BLOCK_DESTRUCTION_CHANCE = 100;
|
private static final int MAX_BLOCK_DESTRUCTION_CHANCE = 100;
|
||||||
private static final int BLOCK_DESTRUCTION_CHANCE = 50;
|
private static final int BLOCK_DESTRUCTION_CHANCE = 50;
|
||||||
private static final int WORLD_THREAD_PROBABILITY = 10;
|
private static final int WORLD_THREAD_CHANCE = 5;
|
||||||
|
private static final int MAX_WORLD_THREAD_CHANCE = 100;
|
||||||
|
|
||||||
private final DDProperties properties;
|
private final DDProperties properties;
|
||||||
private final ArrayList<Integer> blocksImmuneToRift;
|
private final ArrayList<Integer> blocksImmuneToRift;
|
||||||
@@ -65,11 +66,11 @@ public class BlockRift extends Block implements ITileEntityProvider
|
|||||||
this.blocksImmuneToRift.add(properties.GoldenDimensionalDoorID);
|
this.blocksImmuneToRift.add(properties.GoldenDimensionalDoorID);
|
||||||
this.blocksImmuneToRift.add(properties.GoldenDoorID);
|
this.blocksImmuneToRift.add(properties.GoldenDoorID);
|
||||||
|
|
||||||
|
this.blocksImmuneToRift.add(Block.blockLapis.blockID);
|
||||||
this.blocksImmuneToRift.add(Block.blockIron.blockID);
|
this.blocksImmuneToRift.add(Block.blockIron.blockID);
|
||||||
|
this.blocksImmuneToRift.add(Block.blockGold.blockID);
|
||||||
this.blocksImmuneToRift.add(Block.blockDiamond.blockID);
|
this.blocksImmuneToRift.add(Block.blockDiamond.blockID);
|
||||||
this.blocksImmuneToRift.add(Block.blockEmerald.blockID);
|
this.blocksImmuneToRift.add(Block.blockEmerald.blockID);
|
||||||
this.blocksImmuneToRift.add(Block.blockGold.blockID);
|
|
||||||
this.blocksImmuneToRift.add(Block.blockLapis.blockID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -191,30 +192,25 @@ public class BlockRift extends Block implements ITileEntityProvider
|
|||||||
if (!isBlockImmune(world, current.getX(), current.getY(), current.getZ()) &&
|
if (!isBlockImmune(world, current.getX(), current.getY(), current.getZ()) &&
|
||||||
random.nextInt(MAX_BLOCK_DESTRUCTION_CHANCE) < BLOCK_DESTRUCTION_CHANCE)
|
random.nextInt(MAX_BLOCK_DESTRUCTION_CHANCE) < BLOCK_DESTRUCTION_CHANCE)
|
||||||
{
|
{
|
||||||
this.spawnWorldThread(world.getBlockId(current.getX(), current.getY(), current.getZ()), world, x, y, z);
|
this.spawnWorldThread(world.getBlockId(current.getX(), current.getY(), current.getZ()), world, x, y, z, random);
|
||||||
world.destroyBlock(current.getX(), current.getY(), current.getZ(), false);
|
world.destroyBlock(current.getX(), current.getY(), current.getZ(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void spawnWorldThread(int blockID,World worldObj,int x,int y,int z )
|
|
||||||
|
private void spawnWorldThread(int blockID, World world, int x, int y, int z, Random random)
|
||||||
{
|
{
|
||||||
if(blockID == 0||!(worldObj.rand.nextInt(100)<this.WORLD_THREAD_PROBABILITY))
|
if (blockID != 0 && (random.nextInt(MAX_WORLD_THREAD_CHANCE) < WORLD_THREAD_CHANCE)
|
||||||
|
&& !(Block.blocksList[blockID] instanceof BlockFlowing ||
|
||||||
|
Block.blocksList[blockID] instanceof BlockFluid ||
|
||||||
|
Block.blocksList[blockID] instanceof IFluidBlock))
|
||||||
{
|
{
|
||||||
return;
|
ItemStack thread = new ItemStack(mod_pocketDim.itemWorldThread, 1);
|
||||||
|
world.spawnEntityInWorld(new EntityItem(world, x, y, z, thread));
|
||||||
}
|
}
|
||||||
if(Block.blocksList[blockID] instanceof BlockFlowing||
|
|
||||||
Block.blocksList[blockID] instanceof BlockFluid||
|
|
||||||
Block.blocksList[blockID] instanceof IFluidBlock)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemStack thread = new ItemStack(mod_pocketDim.itemWorldThread,1);
|
|
||||||
EntityItem threadEntity = new EntityItem(worldObj, x,y,z, thread);
|
|
||||||
worldObj.spawnEntityInWorld(threadEntity);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addAdjacentBlocks(int x, int y, int z, int distance, HashMap<Point3D, Integer> pointDistances, Queue<Point3D> points)
|
private void addAdjacentBlocks(int x, int y, int z, int distance, HashMap<Point3D, Integer> pointDistances, Queue<Point3D> points)
|
||||||
{
|
{
|
||||||
Point3D[] neighbors = new Point3D[] {
|
Point3D[] neighbors = new Point3D[] {
|
||||||
@@ -235,6 +231,16 @@ public class BlockRift extends Block implements ITileEntityProvider
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void regenerateRift(World world, int x, int y, int z, Random random)
|
||||||
|
{
|
||||||
|
if (!this.isBlockImmune(world, x, y, z) && world.getChunkProvider().chunkExists(x >> 4, z >> 4))
|
||||||
|
{
|
||||||
|
int blockID = world.getBlockId(x, y, z);
|
||||||
|
world.setBlock(x, y, z, properties.RiftBlockID);
|
||||||
|
this.spawnWorldThread(blockID, world, x, y, z, random);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lets pistons push through rifts, destroying them
|
* Lets pistons push through rifts, destroying them
|
||||||
*/
|
*/
|
||||||
@@ -362,8 +368,13 @@ public class BlockRift extends Block implements ITileEntityProvider
|
|||||||
Block block = Block.blocksList[world.getBlockId(x, y, z)];
|
Block block = Block.blocksList[world.getBlockId(x, y, z)];
|
||||||
if (block != null)
|
if (block != null)
|
||||||
{
|
{
|
||||||
float hardness = block.getBlockHardness(world, x, y, z);
|
// SenseiKiwi: I've switched to using the block's blast resistance instead of its
|
||||||
return (hardness < 0 || hardness >= MIN_IMMUNE_HARDNESS || blocksImmuneToRift.contains(block.blockID));
|
// hardness since most defensive blocks are meant to defend against explosions and
|
||||||
|
// may have low hardness to make them easier to build with. However, block.getExplosionResistance()
|
||||||
|
// is designed to receive an entity, the source of the blast. We have no entity so
|
||||||
|
// I've set this to access blockResistance directly. Might need changing later.
|
||||||
|
|
||||||
|
return (block.blockResistance >= MIN_IMMUNE_RESISTANCE || blocksImmuneToRift.contains(block.blockID));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,10 +35,10 @@ import StevenDimDoors.mod_pocketDim.watcher.IUpdateWatcher;
|
|||||||
import StevenDimDoors.mod_pocketDim.watcher.UpdateWatcherProxy;
|
import StevenDimDoors.mod_pocketDim.watcher.UpdateWatcherProxy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class regulates all the operations involving the storage and manipulation of dimensions. It handles saving dim data, teleporting the player, and
|
* This class regulates all the operations involving the storage and manipulation of dimensions.
|
||||||
* creating/registering new dimensions as well as loading old dimensions on startup
|
* It handles saving dim data, teleporting the player, and creating/registering new dimensions as
|
||||||
|
* well as loading old dimensions on startup
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public class PocketManager
|
public class PocketManager
|
||||||
{
|
{
|
||||||
private static class InnerDimData extends NewDimData implements IPackable<PackedDimData>
|
private static class InnerDimData extends NewDimData implements IPackable<PackedDimData>
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ public class ItemRiftBlade extends ItemSword
|
|||||||
@Override
|
@Override
|
||||||
public void registerIcons(IconRegister par1IconRegister)
|
public void registerIcons(IconRegister par1IconRegister)
|
||||||
{
|
{
|
||||||
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName());
|
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class ItemRiftSignature extends Item
|
|||||||
|
|
||||||
public void registerIcons(IconRegister par1IconRegister)
|
public void registerIcons(IconRegister par1IconRegister)
|
||||||
{
|
{
|
||||||
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName());
|
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public class itemRiftRemover extends Item
|
|||||||
@Override
|
@Override
|
||||||
public void registerIcons(IconRegister par1IconRegister)
|
public void registerIcons(IconRegister par1IconRegister)
|
||||||
{
|
{
|
||||||
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName());
|
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,7 +1,21 @@
|
|||||||
package StevenDimDoors.mod_pocketDim;
|
package StevenDimDoors.mod_pocketDim;
|
||||||
|
|
||||||
import StevenDimDoors.experimental.LiquidCorium;
|
import java.io.File;
|
||||||
import StevenDimDoors.experimental.LiquidCoriumBlock;
|
|
||||||
|
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.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.ChatMessageComponent;
|
||||||
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
|
import net.minecraftforge.common.DimensionManager;
|
||||||
|
import net.minecraftforge.common.ForgeChunkManager;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
import net.minecraftforge.fluids.Fluid;
|
||||||
import StevenDimDoors.mod_pocketDim.blocks.BlockDimWall;
|
import StevenDimDoors.mod_pocketDim.blocks.BlockDimWall;
|
||||||
import StevenDimDoors.mod_pocketDim.blocks.BlockDimWallPerm;
|
import StevenDimDoors.mod_pocketDim.blocks.BlockDimWallPerm;
|
||||||
import StevenDimDoors.mod_pocketDim.blocks.BlockDoorGold;
|
import StevenDimDoors.mod_pocketDim.blocks.BlockDoorGold;
|
||||||
@@ -36,10 +50,10 @@ import StevenDimDoors.mod_pocketDim.items.ItemWarpDoor;
|
|||||||
import StevenDimDoors.mod_pocketDim.items.ItemWorldThread;
|
import StevenDimDoors.mod_pocketDim.items.ItemWorldThread;
|
||||||
import StevenDimDoors.mod_pocketDim.items.itemRiftRemover;
|
import StevenDimDoors.mod_pocketDim.items.itemRiftRemover;
|
||||||
import StevenDimDoors.mod_pocketDim.ticking.CommonTickHandler;
|
import StevenDimDoors.mod_pocketDim.ticking.CommonTickHandler;
|
||||||
|
import StevenDimDoors.mod_pocketDim.ticking.CustomLimboPopulator;
|
||||||
import StevenDimDoors.mod_pocketDim.ticking.FastRiftRegenerator;
|
import StevenDimDoors.mod_pocketDim.ticking.FastRiftRegenerator;
|
||||||
import StevenDimDoors.mod_pocketDim.ticking.LimboDecay;
|
import StevenDimDoors.mod_pocketDim.ticking.LimboDecay;
|
||||||
import StevenDimDoors.mod_pocketDim.ticking.MobMonolith;
|
import StevenDimDoors.mod_pocketDim.ticking.MobMonolith;
|
||||||
import StevenDimDoors.mod_pocketDim.ticking.CustomLimboPopulator;
|
|
||||||
import StevenDimDoors.mod_pocketDim.ticking.RiftRegenerator;
|
import StevenDimDoors.mod_pocketDim.ticking.RiftRegenerator;
|
||||||
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoor;
|
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoor;
|
||||||
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoorGold;
|
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoorGold;
|
||||||
@@ -47,13 +61,11 @@ import StevenDimDoors.mod_pocketDim.tileentities.TileEntityRift;
|
|||||||
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityTransTrapdoor;
|
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityTransTrapdoor;
|
||||||
import StevenDimDoors.mod_pocketDim.world.BiomeGenLimbo;
|
import StevenDimDoors.mod_pocketDim.world.BiomeGenLimbo;
|
||||||
import StevenDimDoors.mod_pocketDim.world.BiomeGenPocket;
|
import StevenDimDoors.mod_pocketDim.world.BiomeGenPocket;
|
||||||
import StevenDimDoors.mod_pocketDim.world.GatewayGenerator;
|
|
||||||
import StevenDimDoors.mod_pocketDim.world.LimboProvider;
|
import StevenDimDoors.mod_pocketDim.world.LimboProvider;
|
||||||
import StevenDimDoors.mod_pocketDim.world.PocketProvider;
|
import StevenDimDoors.mod_pocketDim.world.PocketProvider;
|
||||||
|
import StevenDimDoors.mod_pocketDim.world.gateways.GatewayGenerator;
|
||||||
import StevenDimDoors.mod_pocketDimClient.ClientPacketHandler;
|
import StevenDimDoors.mod_pocketDimClient.ClientPacketHandler;
|
||||||
import StevenDimDoors.mod_pocketDimClient.ClientTickHandler;
|
import StevenDimDoors.mod_pocketDimClient.ClientTickHandler;
|
||||||
|
|
||||||
import cpw.mods.fml.common.IPlayerTracker;
|
|
||||||
import cpw.mods.fml.common.Mod;
|
import cpw.mods.fml.common.Mod;
|
||||||
import cpw.mods.fml.common.Mod.EventHandler;
|
import cpw.mods.fml.common.Mod.EventHandler;
|
||||||
import cpw.mods.fml.common.Mod.Instance;
|
import cpw.mods.fml.common.Mod.Instance;
|
||||||
@@ -71,26 +83,6 @@ import cpw.mods.fml.common.registry.LanguageRegistry;
|
|||||||
import cpw.mods.fml.common.registry.TickRegistry;
|
import cpw.mods.fml.common.registry.TickRegistry;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
|
||||||
import net.minecraft.entity.EntityEggInfo;
|
|
||||||
import net.minecraft.entity.EntityList;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.EnumToolMaterial;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.ChatMessageComponent;
|
|
||||||
import net.minecraft.world.biome.BiomeGenBase;
|
|
||||||
import net.minecraftforge.common.DimensionManager;
|
|
||||||
import net.minecraftforge.common.ForgeChunkManager;
|
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
|
||||||
import net.minecraftforge.fluids.Fluid;
|
|
||||||
import net.minecraftforge.fluids.FluidRegistry;
|
|
||||||
|
|
||||||
@Mod(modid = mod_pocketDim.modid, name = "Dimensional Doors", version = mod_pocketDim.version)
|
@Mod(modid = mod_pocketDim.modid, name = "Dimensional Doors", version = mod_pocketDim.version)
|
||||||
|
|
||||||
@NetworkMod(clientSideRequired = true, serverSideRequired = false, connectionHandler=ConnectionHandler.class,
|
@NetworkMod(clientSideRequired = true, serverSideRequired = false, connectionHandler=ConnectionHandler.class,
|
||||||
@@ -100,7 +92,7 @@ serverPacketHandlerSpec =
|
|||||||
@SidedPacketHandler(channels = {PacketConstants.CHANNEL_NAME}, packetHandler = ServerPacketHandler.class))
|
@SidedPacketHandler(channels = {PacketConstants.CHANNEL_NAME}, packetHandler = ServerPacketHandler.class))
|
||||||
public class mod_pocketDim
|
public class mod_pocketDim
|
||||||
{
|
{
|
||||||
public static final String version = "1.6.4R2.1.2RC1";
|
public static final String version = "1.6.4R2.2.2RC1";
|
||||||
public static final String modid = "dimdoors";
|
public static final String modid = "dimdoors";
|
||||||
|
|
||||||
//need to clean up
|
//need to clean up
|
||||||
@@ -142,12 +134,9 @@ public class mod_pocketDim
|
|||||||
|
|
||||||
public static DDProperties properties;
|
public static DDProperties properties;
|
||||||
public static CustomLimboPopulator spawner; //Added this field temporarily. Will be refactored out later.
|
public static CustomLimboPopulator spawner; //Added this field temporarily. Will be refactored out later.
|
||||||
public FastRiftRegenerator fastRiftRegenerator;
|
public static FastRiftRegenerator fastRiftRegenerator;
|
||||||
public static GatewayGenerator gatewayGenerator;
|
public static GatewayGenerator gatewayGenerator;
|
||||||
public static PlayerTracker tracker;
|
public static DeathTracker deathTracker;
|
||||||
|
|
||||||
public static Block coriumBlock;
|
|
||||||
public static Fluid coriumFluid;
|
|
||||||
|
|
||||||
public static CreativeTabs dimDoorsCreativeTab = new CreativeTabs("dimDoorsCreativeTab")
|
public static CreativeTabs dimDoorsCreativeTab = new CreativeTabs("dimDoorsCreativeTab")
|
||||||
{
|
{
|
||||||
@@ -177,7 +166,6 @@ public class mod_pocketDim
|
|||||||
EventHookContainer hooks = new EventHookContainer(properties);
|
EventHookContainer hooks = new EventHookContainer(properties);
|
||||||
MinecraftForge.EVENT_BUS.register(hooks);
|
MinecraftForge.EVENT_BUS.register(hooks);
|
||||||
MinecraftForge.TERRAIN_GEN_BUS.register(hooks);
|
MinecraftForge.TERRAIN_GEN_BUS.register(hooks);
|
||||||
gatewayGenerator = new GatewayGenerator(properties);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@@ -192,7 +180,7 @@ public class mod_pocketDim
|
|||||||
spawner = new CustomLimboPopulator(commonTickHandler, properties);
|
spawner = new CustomLimboPopulator(commonTickHandler, properties);
|
||||||
new RiftRegenerator(commonTickHandler); //No need to store the reference
|
new RiftRegenerator(commonTickHandler); //No need to store the reference
|
||||||
LimboDecay decay = new LimboDecay(commonTickHandler, properties);
|
LimboDecay decay = new LimboDecay(commonTickHandler, properties);
|
||||||
this.fastRiftRegenerator = new FastRiftRegenerator(commonTickHandler);
|
fastRiftRegenerator = new FastRiftRegenerator(commonTickHandler);
|
||||||
|
|
||||||
transientDoor = new TransientDoor(properties.TransientDoorID, Material.iron, properties).setHardness(1.0F) .setUnlocalizedName("transientDoor");
|
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");
|
goldenDimensionalDoor = new BlockGoldDimDoor(properties.GoldenDimensionalDoorID, Material.iron, properties).setHardness(1.0F) .setUnlocalizedName("dimDoorGold");
|
||||||
@@ -219,13 +207,10 @@ public class mod_pocketDim
|
|||||||
itemStabilizedLinkSignature = (new ItemStabilizedRiftSignature(properties.StabilizedRiftSignatureItemID)).setUnlocalizedName("itemStabilizedRiftSig");
|
itemStabilizedLinkSignature = (new ItemStabilizedRiftSignature(properties.StabilizedRiftSignatureItemID)).setUnlocalizedName("itemStabilizedRiftSig");
|
||||||
itemWorldThread = (new ItemWorldThread(properties.WorldThreadItemID)).setUnlocalizedName("itemWorldThread");
|
itemWorldThread = (new ItemWorldThread(properties.WorldThreadItemID)).setUnlocalizedName("itemWorldThread");
|
||||||
|
|
||||||
|
|
||||||
mod_pocketDim.limboBiome = (new BiomeGenLimbo(properties.LimboBiomeID));
|
mod_pocketDim.limboBiome = (new BiomeGenLimbo(properties.LimboBiomeID));
|
||||||
mod_pocketDim.pocketBiome = (new BiomeGenPocket(properties.PocketBiomeID));
|
mod_pocketDim.pocketBiome = (new BiomeGenPocket(properties.PocketBiomeID));
|
||||||
|
|
||||||
GameRegistry.registerWorldGenerator(mod_pocketDim.gatewayGenerator);
|
GameRegistry.registerWorldGenerator(mod_pocketDim.gatewayGenerator);
|
||||||
tracker = new PlayerTracker();
|
|
||||||
GameRegistry.registerPlayerTracker(tracker);
|
|
||||||
|
|
||||||
GameRegistry.registerBlock(goldenDoor, "Golden Door");
|
GameRegistry.registerBlock(goldenDoor, "Golden Door");
|
||||||
GameRegistry.registerBlock(goldenDimensionalDoor, "Golden Dimensional Door");
|
GameRegistry.registerBlock(goldenDimensionalDoor, "Golden Dimensional Door");
|
||||||
@@ -288,18 +273,9 @@ public class mod_pocketDim
|
|||||||
EntityList.entityEggs.put(properties.MonolithEntityID, new EntityEggInfo(properties.MonolithEntityID, 0, 0xffffff));
|
EntityList.entityEggs.put(properties.MonolithEntityID, new EntityEggInfo(properties.MonolithEntityID, 0, 0xffffff));
|
||||||
LanguageRegistry.instance().addStringLocalization("entity.DimDoors.Obelisk.name", "Monolith");
|
LanguageRegistry.instance().addStringLocalization("entity.DimDoors.Obelisk.name", "Monolith");
|
||||||
|
|
||||||
|
|
||||||
CraftingManager.registerRecipes(properties);
|
CraftingManager.registerRecipes(properties);
|
||||||
DungeonHelper.initialize();
|
DungeonHelper.initialize();
|
||||||
this.gatewayGenerator.initGateways();
|
gatewayGenerator = new GatewayGenerator(properties);
|
||||||
|
|
||||||
/**
|
|
||||||
coriumFluid = new LiquidCorium("Corium").setDensity(1000).setTemperature(3473).setDensity(9400).setLuminosity(6).setRarity(EnumRarity.rare);
|
|
||||||
coriumBlock = new LiquidCoriumBlock(properties.CoriumBlockID, coriumFluid, Material.lava).setQuantaPerBlock(16).setTickRate(20).setTickRandomly(true).setUnlocalizedName("Corium");
|
|
||||||
FluidRegistry.registerFluid(coriumFluid);
|
|
||||||
GameRegistry.registerBlock(coriumBlock,"Corium");
|
|
||||||
LanguageRegistry.addName(coriumBlock, "Corium");
|
|
||||||
**/
|
|
||||||
|
|
||||||
// Register loot chests
|
// Register loot chests
|
||||||
DDLoot.registerInfo(properties);
|
DDLoot.registerInfo(properties);
|
||||||
@@ -307,7 +283,6 @@ public class mod_pocketDim
|
|||||||
proxy.registerRenderers();
|
proxy.registerRenderers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPostInitialization(FMLPostInitializationEvent event)
|
public void onPostInitialization(FMLPostInitializationEvent event)
|
||||||
{
|
{
|
||||||
@@ -320,6 +295,8 @@ public class mod_pocketDim
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
PocketManager.unload();
|
PocketManager.unload();
|
||||||
|
deathTracker.writeToFile();
|
||||||
|
deathTracker = null;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -330,9 +307,9 @@ public class mod_pocketDim
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onServerStarting(FMLServerStartingEvent event)
|
public void onServerStarting(FMLServerStartingEvent event)
|
||||||
{
|
{
|
||||||
|
|
||||||
//TODO- load dims with forced chunks on server startup here
|
//TODO- load dims with forced chunks on server startup here
|
||||||
|
|
||||||
|
// Register commands with the server
|
||||||
CommandResetDungeons.instance().register(event);
|
CommandResetDungeons.instance().register(event);
|
||||||
CommandCreateDungeonRift.instance().register(event);
|
CommandCreateDungeonRift.instance().register(event);
|
||||||
CommandDeleteAllLinks.instance().register(event);
|
CommandDeleteAllLinks.instance().register(event);
|
||||||
@@ -344,6 +321,10 @@ public class mod_pocketDim
|
|||||||
CommandCreatePocket.instance().register(event);
|
CommandCreatePocket.instance().register(event);
|
||||||
CommandTeleportPlayer.instance().register(event);
|
CommandTeleportPlayer.instance().register(event);
|
||||||
|
|
||||||
|
// Initialize a new DeathTracker
|
||||||
|
String deathTrackerFile = DimensionManager.getCurrentSaveRootDirectory() + "/DimensionalDoors/data/deaths.txt";
|
||||||
|
deathTracker = new DeathTracker(deathTrackerFile);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ChunkLoaderHelper.loadChunkForcedWorlds(event);
|
ChunkLoaderHelper.loadChunkForcedWorlds(event);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package StevenDimDoors.mod_pocketDim.ticking;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.DimensionManager;
|
import net.minecraftforge.common.DimensionManager;
|
||||||
@@ -12,7 +13,9 @@ import StevenDimDoors.mod_pocketDim.util.Point4D;
|
|||||||
|
|
||||||
public class FastRiftRegenerator implements IRegularTickReceiver {
|
public class FastRiftRegenerator implements IRegularTickReceiver {
|
||||||
|
|
||||||
private static final int RIFT_REGENERATION_INTERVAL = 10; //Regenerate random rifts every 10 ticks
|
private static final int RIFT_REGENERATION_INTERVAL = 10; //Regenerate scheduled rifts every 10 ticks
|
||||||
|
private static Random random = new Random();
|
||||||
|
|
||||||
private ArrayList<Point4D> locationsToRegen = new ArrayList<Point4D>();
|
private ArrayList<Point4D> locationsToRegen = new ArrayList<Point4D>();
|
||||||
|
|
||||||
public FastRiftRegenerator(IRegularTickSender sender)
|
public FastRiftRegenerator(IRegularTickSender sender)
|
||||||
@@ -23,31 +26,24 @@ public class FastRiftRegenerator implements IRegularTickReceiver {
|
|||||||
@Override
|
@Override
|
||||||
public void notifyTick()
|
public void notifyTick()
|
||||||
{
|
{
|
||||||
regenerateRiftsInAllWorlds();
|
regenerateScheduledRifts();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void regenerateRiftsInAllWorlds()
|
public void regenerateScheduledRifts()
|
||||||
{
|
{
|
||||||
if (this.locationsToRegen.isEmpty())
|
if (!locationsToRegen.isEmpty())
|
||||||
{
|
{
|
||||||
return;
|
List<Integer> loadedWorlds = (List<Integer>) Arrays.asList(DimensionManager.getIDs());
|
||||||
}
|
for (Point4D point: locationsToRegen)
|
||||||
List<Integer> loadedWorlds = (List<Integer>) Arrays.asList(DimensionManager.getIDs());
|
|
||||||
|
|
||||||
for (Point4D point: this.locationsToRegen)
|
|
||||||
{
|
|
||||||
if (loadedWorlds.contains(point.getDimension()) && PocketManager.getLink(point) != null)
|
|
||||||
{
|
{
|
||||||
World world = DimensionManager.getWorld(point.getDimension());
|
if (loadedWorlds.contains(point.getDimension()) && PocketManager.getLink(point) != null)
|
||||||
|
|
||||||
if (!mod_pocketDim.blockRift.isBlockImmune(world, point.getX(), point.getY(), point.getZ())
|
|
||||||
&& world.getChunkProvider().chunkExists(point.getX() >> 4, point.getZ() >> 4))
|
|
||||||
{
|
{
|
||||||
world.setBlock(point.getX(), point.getY(), point.getZ(), mod_pocketDim.blockRift.blockID);
|
World world = DimensionManager.getWorld(point.getDimension());
|
||||||
|
mod_pocketDim.blockRift.regenerateRift(world, point.getX(), point.getY(), point.getZ(), random);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
locationsToRegen.clear();
|
||||||
}
|
}
|
||||||
this.locationsToRegen.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerRiftForRegen(int x, int y, int z, int dimID)
|
public void registerRiftForRegen(int x, int y, int z, int dimID)
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
package StevenDimDoors.mod_pocketDim.ticking;
|
package StevenDimDoors.mod_pocketDim.ticking;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.DimensionManager;
|
import net.minecraftforge.common.DimensionManager;
|
||||||
import StevenDimDoors.mod_pocketDim.DDProperties;
|
|
||||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||||
import StevenDimDoors.mod_pocketDim.core.DimLink;
|
import StevenDimDoors.mod_pocketDim.core.DimLink;
|
||||||
import StevenDimDoors.mod_pocketDim.core.NewDimData;
|
import StevenDimDoors.mod_pocketDim.core.NewDimData;
|
||||||
@@ -13,6 +16,7 @@ public class RiftRegenerator implements IRegularTickReceiver {
|
|||||||
|
|
||||||
private static final int RIFT_REGENERATION_INTERVAL = 200; //Regenerate random rifts every 200 ticks
|
private static final int RIFT_REGENERATION_INTERVAL = 200; //Regenerate random rifts every 200 ticks
|
||||||
private static final int RIFTS_REGENERATED_PER_DIMENSION = 5;
|
private static final int RIFTS_REGENERATED_PER_DIMENSION = 5;
|
||||||
|
private static Random random = new Random();
|
||||||
|
|
||||||
public RiftRegenerator(IRegularTickSender sender)
|
public RiftRegenerator(IRegularTickSender sender)
|
||||||
{
|
{
|
||||||
@@ -22,16 +26,17 @@ public class RiftRegenerator implements IRegularTickReceiver {
|
|||||||
@Override
|
@Override
|
||||||
public void notifyTick()
|
public void notifyTick()
|
||||||
{
|
{
|
||||||
regenerateRiftsInAllWorlds();
|
regenerateRiftsInLoadedWorlds();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void regenerateRiftsInAllWorlds()
|
private static void regenerateRiftsInLoadedWorlds()
|
||||||
{
|
{
|
||||||
//Regenerate rifts that have been replaced (not permanently removed) by players
|
// Regenerate rifts that have been replaced (not permanently removed) by players
|
||||||
DDProperties properties = DDProperties.instance();
|
// Only do this in dimensions that are currently loaded
|
||||||
|
List<Integer> loadedWorlds = (List<Integer>) Arrays.asList(DimensionManager.getIDs());
|
||||||
for (NewDimData dimension : PocketManager.getDimensions())
|
for (Integer dimensionID : loadedWorlds)
|
||||||
{
|
{
|
||||||
|
NewDimData dimension = PocketManager.getDimensionData(dimensionID);
|
||||||
if (dimension.linkCount() > 0)
|
if (dimension.linkCount() > 0)
|
||||||
{
|
{
|
||||||
World world = DimensionManager.getWorld(dimension.id());
|
World world = DimensionManager.getWorld(dimension.id());
|
||||||
@@ -42,10 +47,7 @@ public class RiftRegenerator implements IRegularTickReceiver {
|
|||||||
{
|
{
|
||||||
DimLink link = dimension.getRandomLink();
|
DimLink link = dimension.getRandomLink();
|
||||||
Point4D source = link.source();
|
Point4D source = link.source();
|
||||||
if (!mod_pocketDim.blockRift.isBlockImmune(world, source.getX(), source.getY(), source.getZ())&& world.getChunkProvider().chunkExists(source.getX() >> 4, source.getZ() >> 4))
|
mod_pocketDim.blockRift.regenerateRift(world, source.getX(), source.getY(), source.getZ(), random);
|
||||||
{
|
|
||||||
world.setBlock(source.getX(), source.getY(), source.getZ(), properties.RiftBlockID);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package StevenDimDoors.mod_pocketDim.world.fortresses;
|
package StevenDimDoors.mod_pocketDim.world.fortresses;
|
||||||
|
|
||||||
|
import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||||
import net.minecraft.world.gen.structure.MapGenNetherBridge;
|
import net.minecraft.world.gen.structure.MapGenNetherBridge;
|
||||||
import net.minecraft.world.gen.structure.MapGenStructureIO;
|
import net.minecraft.world.gen.structure.MapGenStructureIO;
|
||||||
import net.minecraft.world.gen.structure.StructureStart;
|
import net.minecraft.world.gen.structure.StructureStart;
|
||||||
@@ -19,6 +20,6 @@ public class DDNetherFortressGenerator extends MapGenNetherBridge
|
|||||||
|
|
||||||
protected StructureStart getStructureStart(int chunkX, int chunkZ)
|
protected StructureStart getStructureStart(int chunkX, int chunkZ)
|
||||||
{
|
{
|
||||||
return new DDStructureNetherBridgeStart(this.worldObj, this.rand, chunkX, chunkZ);
|
return new DDStructureNetherBridgeStart(this.worldObj, this.rand, chunkX, chunkZ, DDProperties.instance());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,16 +6,15 @@ import java.util.Random;
|
|||||||
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.gen.structure.ComponentNetherBridgeCrossing;
|
|
||||||
import net.minecraft.world.gen.structure.ComponentNetherBridgeThrone;
|
import net.minecraft.world.gen.structure.ComponentNetherBridgeThrone;
|
||||||
import net.minecraft.world.gen.structure.StructureBoundingBox;
|
import net.minecraft.world.gen.structure.StructureBoundingBox;
|
||||||
import net.minecraft.world.gen.structure.StructureComponent;
|
import net.minecraft.world.gen.structure.StructureComponent;
|
||||||
import net.minecraft.world.gen.structure.StructureNetherBridgeStart;
|
import net.minecraft.world.gen.structure.StructureNetherBridgeStart;
|
||||||
|
import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||||
|
|
||||||
public class DDStructureNetherBridgeStart extends StructureNetherBridgeStart
|
public class DDStructureNetherBridgeStart extends StructureNetherBridgeStart
|
||||||
{
|
{
|
||||||
private static int GATEWAY_GENERATION_CHANCE = 1;
|
public static final int MAX_GATEWAY_GENERATION_CHANCE = 100;
|
||||||
private static int MAX_GATEWAY_GENERATION_CHANCE = 3;
|
|
||||||
|
|
||||||
private boolean hasGateway;
|
private boolean hasGateway;
|
||||||
private int minX;
|
private int minX;
|
||||||
@@ -24,7 +23,7 @@ public class DDStructureNetherBridgeStart extends StructureNetherBridgeStart
|
|||||||
|
|
||||||
public DDStructureNetherBridgeStart() { }
|
public DDStructureNetherBridgeStart() { }
|
||||||
|
|
||||||
public DDStructureNetherBridgeStart(World world, Random random, int chunkX, int chunkZ)
|
public DDStructureNetherBridgeStart(World world, Random random, int chunkX, int chunkZ, DDProperties properties)
|
||||||
{
|
{
|
||||||
// StructureNetherBridgeStart handles designing the fortress for us
|
// StructureNetherBridgeStart handles designing the fortress for us
|
||||||
super(world, random, chunkX, chunkZ);
|
super(world, random, chunkX, chunkZ);
|
||||||
@@ -36,7 +35,7 @@ public class DDStructureNetherBridgeStart extends StructureNetherBridgeStart
|
|||||||
hasGateway = false;
|
hasGateway = false;
|
||||||
|
|
||||||
// Randomly decide whether to build a gateway in this fortress
|
// Randomly decide whether to build a gateway in this fortress
|
||||||
if (random.nextInt(MAX_GATEWAY_GENERATION_CHANCE) < GATEWAY_GENERATION_CHANCE)
|
if (random.nextInt(MAX_GATEWAY_GENERATION_CHANCE) < properties.FortressGatewayGenerationChance)
|
||||||
{
|
{
|
||||||
// Search for all the blaze spawners in a fortress
|
// Search for all the blaze spawners in a fortress
|
||||||
spawnerRooms = new ArrayList<ComponentNetherBridgeThrone>();
|
spawnerRooms = new ArrayList<ComponentNetherBridgeThrone>();
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package StevenDimDoors.mod_pocketDim.world;
|
package StevenDimDoors.mod_pocketDim.world.gateways;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
@@ -15,10 +15,7 @@ import StevenDimDoors.mod_pocketDim.core.LinkTypes;
|
|||||||
import StevenDimDoors.mod_pocketDim.core.NewDimData;
|
import StevenDimDoors.mod_pocketDim.core.NewDimData;
|
||||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||||
import StevenDimDoors.mod_pocketDim.items.ItemDimensionalDoor;
|
import StevenDimDoors.mod_pocketDim.items.ItemDimensionalDoor;
|
||||||
import StevenDimDoors.mod_pocketDim.world.gateways.BaseGateway;
|
import StevenDimDoors.mod_pocketDim.world.PocketProvider;
|
||||||
import StevenDimDoors.mod_pocketDim.world.gateways.GatewayLimbo;
|
|
||||||
import StevenDimDoors.mod_pocketDim.world.gateways.GatewaySandstonePillars;
|
|
||||||
import StevenDimDoors.mod_pocketDim.world.gateways.GatewayTwoPillars;
|
|
||||||
import cpw.mods.fml.common.IWorldGenerator;
|
import cpw.mods.fml.common.IWorldGenerator;
|
||||||
|
|
||||||
public class GatewayGenerator implements IWorldGenerator
|
public class GatewayGenerator implements IWorldGenerator
|
||||||
@@ -32,32 +29,30 @@ public class GatewayGenerator implements IWorldGenerator
|
|||||||
private static final int CHUNK_LENGTH = 16;
|
private static final int CHUNK_LENGTH = 16;
|
||||||
private static final int GATEWAY_RADIUS = 4;
|
private static final int GATEWAY_RADIUS = 4;
|
||||||
private static final int MAX_GATEWAY_GENERATION_ATTEMPTS = 10;
|
private static final int MAX_GATEWAY_GENERATION_ATTEMPTS = 10;
|
||||||
private static final int NETHER_CHANCE_CORRECTION = 4;
|
|
||||||
private static final int OVERWORLD_DIMENSION_ID = 0;
|
private static final int OVERWORLD_DIMENSION_ID = 0;
|
||||||
private static final int NETHER_DIMENSION_ID = -1;
|
private static final int NETHER_DIMENSION_ID = -1;
|
||||||
private static final int END_DIMENSION_ID = 1;
|
private static final int END_DIMENSION_ID = 1;
|
||||||
|
|
||||||
private static ArrayList<BaseGateway> gateways;
|
private ArrayList<BaseGateway> gateways;
|
||||||
private static BaseGateway defaultGateway;
|
private BaseGateway defaultGateway;
|
||||||
|
|
||||||
private final DDProperties properties;
|
private final DDProperties properties;
|
||||||
|
|
||||||
public GatewayGenerator(DDProperties properties)
|
public GatewayGenerator(DDProperties properties)
|
||||||
{
|
{
|
||||||
this.properties = properties;
|
this.properties = properties;
|
||||||
|
this.initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initGateways()
|
private void initialize()
|
||||||
{
|
{
|
||||||
gateways=new ArrayList<BaseGateway>();
|
gateways = new ArrayList<BaseGateway>();
|
||||||
this.defaultGateway=new GatewayTwoPillars(this.properties);
|
defaultGateway = new GatewayTwoPillars(properties);
|
||||||
|
|
||||||
//add gateways here
|
// Add gateways here
|
||||||
gateways.add(new GatewaySandstonePillars(this.properties));
|
|
||||||
gateways.add(defaultGateway);
|
gateways.add(defaultGateway);
|
||||||
gateways.add(new GatewayLimbo(this.properties));
|
gateways.add(new GatewaySandstonePillars(properties));
|
||||||
|
gateways.add(new GatewayLimbo(properties));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -79,26 +74,10 @@ public class GatewayGenerator implements IWorldGenerator
|
|||||||
|
|
||||||
int x, y, z;
|
int x, y, z;
|
||||||
int attempts;
|
int attempts;
|
||||||
int correction;
|
|
||||||
boolean valid;
|
boolean valid;
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
DimLink link;
|
DimLink link;
|
||||||
NewDimData dimension;
|
NewDimData dimension;
|
||||||
|
|
||||||
//Check if we're generating things in the Nether
|
|
||||||
if (world.provider.dimensionId == NETHER_DIMENSION_ID)
|
|
||||||
{
|
|
||||||
//The terrain in the Nether makes it much harder for our gateway spawning algorithm to find a spot to place a gateway.
|
|
||||||
//Tests show that only about 15% of attempts succeed. Compensate for this by multiplying the chance of generation
|
|
||||||
//by a correction factor.
|
|
||||||
correction = NETHER_CHANCE_CORRECTION;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//No correction
|
|
||||||
correction = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Randomly decide whether to place a cluster of rifts here
|
//Randomly decide whether to place a cluster of rifts here
|
||||||
if (random.nextInt(MAX_CLUSTER_GENERATION_CHANCE) < properties.ClusterGenerationChance)
|
if (random.nextInt(MAX_CLUSTER_GENERATION_CHANCE) < properties.ClusterGenerationChance)
|
||||||
{
|
{
|
||||||
@@ -136,7 +115,7 @@ public class GatewayGenerator implements IWorldGenerator
|
|||||||
|
|
||||||
//Check if generating structures is enabled and randomly decide whether to place a Rift Gateway here.
|
//Check if generating structures is enabled and randomly decide whether to place a Rift Gateway here.
|
||||||
//This only happens if a rift cluster was NOT generated.
|
//This only happens if a rift cluster was NOT generated.
|
||||||
else if (random.nextInt(MAX_GATEWAY_GENERATION_CHANCE) < properties.GatewayGenerationChance * correction &&
|
else if (random.nextInt(MAX_GATEWAY_GENERATION_CHANCE) < properties.GatewayGenerationChance &&
|
||||||
isStructureGenerationAllowed())
|
isStructureGenerationAllowed())
|
||||||
{
|
{
|
||||||
valid = false;
|
valid = false;
|
||||||
|
Before Width: | Height: | Size: 194 B |
|
Before Width: | Height: | Size: 210 B |
|
Before Width: | Height: | Size: 194 B |
|
Before Width: | Height: | Size: 217 B |
|
Before Width: | Height: | Size: 189 B |
|
Before Width: | Height: | Size: 205 B |
|
Before Width: | Height: | Size: 205 B |
|
Before Width: | Height: | Size: 173 B |
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 234 B |
@@ -6,7 +6,7 @@
|
|||||||
"modid": "dimdoors",
|
"modid": "dimdoors",
|
||||||
"name": "Dimensional Doors",
|
"name": "Dimensional Doors",
|
||||||
"description": "Bend and twist reality itself, creating pocket dimensions, rifts, and much more",
|
"description": "Bend and twist reality itself, creating pocket dimensions, rifts, and much more",
|
||||||
"version": "1.6.4R2.1.2RC1",
|
"version": "1.6.4R2.2.2RC1",
|
||||||
"credits": "Created by StevenRS11, Coded by StevenRS11 and SenseiKiwi, Logo and Testing by Jaitsu",
|
"credits": "Created by StevenRS11, Coded by StevenRS11 and SenseiKiwi, Logo and Testing by Jaitsu",
|
||||||
"logoFile": "/dimdoors_logo.png",
|
"logoFile": "/dimdoors_logo.png",
|
||||||
"mcversion": "",
|
"mcversion": "",
|
||||||
|
|||||||