Various Fixes #127
13
src/main/java/StevenDimDoors/experimental/LiquidCorium.java
Normal file
13
src/main/java/StevenDimDoors/experimental/LiquidCorium.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package StevenDimDoors.experimental;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
public class LiquidCorium extends Fluid
|
||||
{
|
||||
|
||||
public LiquidCorium(String fluidName)
|
||||
{
|
||||
super(fluidName);
|
||||
}
|
||||
|
||||
}
|
||||
106
src/main/java/StevenDimDoors/experimental/LiquidCoriumBlock.java
Normal file
106
src/main/java/StevenDimDoors/experimental/LiquidCoriumBlock.java
Normal file
@@ -0,0 +1,106 @@
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -274,8 +274,6 @@ public class DDTeleporter
|
||||
{
|
||||
throw new IllegalArgumentException("destination cannot be null.");
|
||||
}
|
||||
|
||||
|
||||
//This beautiful teleport method is based off of xCompWiz's teleport function.
|
||||
|
||||
WorldServer oldWorld = (WorldServer) entity.worldObj;
|
||||
@@ -372,6 +370,10 @@ public class DDTeleporter
|
||||
NBTTagCompound entityNBT = new NBTTagCompound();
|
||||
entity.isDead = false;
|
||||
entity.writeMountToNBT(entityNBT);
|
||||
if(entityNBT.hasNoTags())
|
||||
{
|
||||
return entity;
|
||||
}
|
||||
entity.isDead = true;
|
||||
entity = EntityList.createEntityFromNBT(entityNBT, newWorld);
|
||||
|
||||
@@ -411,6 +413,7 @@ public class DDTeleporter
|
||||
// Let's try doing this down here in case this is what's killing NEI.
|
||||
GameRegistry.onPlayerChangedDimension((EntityPlayer)entity);
|
||||
|
||||
|
||||
}
|
||||
DDTeleporter.placeInPortal(entity, newWorld, destination, properties, checkOrientation);
|
||||
return entity;
|
||||
|
||||
@@ -87,7 +87,6 @@ public class DungeonSchematic extends Schematic {
|
||||
|
||||
public static DungeonSchematic readFromFile(File schematicFile) throws FileNotFoundException, InvalidSchematicException
|
||||
{
|
||||
// TODO: fix resource leak
|
||||
return readFromStream(new FileInputStream(schematicFile));
|
||||
}
|
||||
|
||||
@@ -168,6 +167,7 @@ public class DungeonSchematic extends Schematic {
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package StevenDimDoors.mod_pocketDim;
|
||||
|
||||
import StevenDimDoors.experimental.LiquidCorium;
|
||||
import StevenDimDoors.experimental.LiquidCoriumBlock;
|
||||
import StevenDimDoors.mod_pocketDim.blocks.BlockDimWall;
|
||||
import StevenDimDoors.mod_pocketDim.blocks.BlockDimWallPerm;
|
||||
import StevenDimDoors.mod_pocketDim.blocks.BlockDoorGold;
|
||||
@@ -76,6 +78,7 @@ 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;
|
||||
@@ -84,6 +87,8 @@ 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)
|
||||
|
||||
@@ -139,6 +144,9 @@ public class mod_pocketDim
|
||||
public static GatewayGenerator riftGen;
|
||||
public static PlayerTracker tracker;
|
||||
|
||||
public static Block coriumBlock;
|
||||
public static Fluid coriumFluid;
|
||||
|
||||
public static CreativeTabs dimDoorsCreativeTab = new CreativeTabs("dimDoorsCreativeTab")
|
||||
{
|
||||
@Override
|
||||
@@ -282,6 +290,14 @@ public class mod_pocketDim
|
||||
DungeonHelper.initialize();
|
||||
this.riftGen.initGateways();
|
||||
|
||||
coriumFluid = new LiquidCorium("Corium").setDensity(1000).setTemperature(3473).setDensity(9400).setLuminosity(6).setRarity(EnumRarity.rare);
|
||||
coriumBlock = new LiquidCoriumBlock(900, 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
|
||||
|
||||
@@ -378,7 +378,6 @@ public class Schematic {
|
||||
{
|
||||
for (dx = 0; dx < width; dx++)
|
||||
{
|
||||
|
||||
setBlockDirectly(world, x + dx, y + dy, z + dz, blocks[index], metadata[index]);
|
||||
index++;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package StevenDimDoors.mod_pocketDim.ticking;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.DataWatcher;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityFlying;
|
||||
@@ -29,7 +31,7 @@ public class MobMonolith extends EntityFlying implements IMob
|
||||
float soundTime = 0;
|
||||
int aggro = 0;
|
||||
byte textureState = 0;
|
||||
|
||||
float entityCollisionReduction = 100;
|
||||
float scaleFactor = 0;
|
||||
int aggroMax;
|
||||
int destX = 0; // unused fields?
|
||||
@@ -100,6 +102,39 @@ public class MobMonolith extends EntityFlying implements IMob
|
||||
this.dataWatcher.addObject(16, Byte.valueOf((byte)0));
|
||||
}
|
||||
|
||||
public boolean isClipping()
|
||||
{
|
||||
|
||||
int i = MathHelper.floor_double(this.boundingBox.minX);
|
||||
int j = MathHelper.floor_double(this.boundingBox.maxX + 1.0D);
|
||||
int k = MathHelper.floor_double(this.boundingBox.minY);
|
||||
int l = MathHelper.floor_double(this.boundingBox.maxY + 1.0D);
|
||||
int i1 = MathHelper.floor_double(this.boundingBox.minZ);
|
||||
int j1 = MathHelper.floor_double(this.boundingBox.maxZ + 1.0D);
|
||||
|
||||
for (int k1 = i; k1 < j; ++k1)
|
||||
{
|
||||
for (int l1 = k; l1 < l; ++l1)
|
||||
{
|
||||
for (int i2 = i1; i2 < j1; ++i2)
|
||||
{
|
||||
if(!this.worldObj.isAirBlock(k1, l1, i2))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isEntityAlive()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityUpdate()
|
||||
{
|
||||
@@ -109,10 +144,9 @@ public class MobMonolith extends EntityFlying implements IMob
|
||||
}
|
||||
|
||||
super.onEntityUpdate();
|
||||
|
||||
if (this.isEntityAlive() && this.isEntityInsideOpaqueBlock())
|
||||
if(this.isClipping())
|
||||
{
|
||||
this.setDead();
|
||||
this.moveEntity(0, .1, 0);
|
||||
}
|
||||
|
||||
EntityPlayer entityPlayer = this.worldObj.getClosestPlayerToEntity(this, 30);
|
||||
|
||||
@@ -129,8 +129,8 @@ public class MonolithSpawner implements IRegularTickReceiver {
|
||||
}
|
||||
while (!pocket.isAirBlock(x,jumpHeight+6 , z)&&jumpSanity<20);
|
||||
|
||||
Entity monolith = new MobMonolith(pocket);
|
||||
monolith.setLocationAndAngles(x, jumpHeight, z, 1, 1);
|
||||
MobMonolith monolith = new MobMonolith(pocket);
|
||||
monolith.setLocationAndAngles(x, jumpHeight-(5-monolith.getRenderSizeModifier()*5), z, 1, 1);
|
||||
pocket.spawnEntityInWorld(monolith);
|
||||
didSpawn = true;
|
||||
}
|
||||
|
||||
@@ -36,6 +36,8 @@ public class TileEntityRift extends TileEntity
|
||||
private static final int MAX_ANCESTOR_LINKS = 3;
|
||||
private static final int ENDERMAN_SPAWNING_CHANCE = 1;
|
||||
private static final int MAX_ENDERMAN_SPAWNING_CHANCE = 32;
|
||||
private static final int RIFT_SPREAD_CHANCE = 1;
|
||||
private static final int MAX_RIFT_SPREAD_CHANCE = 256;
|
||||
|
||||
private static Random random = new Random();
|
||||
|
||||
@@ -299,20 +301,13 @@ public class TileEntityRift extends TileEntity
|
||||
|
||||
public void grow(DDProperties properties)
|
||||
{
|
||||
if (worldObj.isRemote || hasGrownRifts || !properties.RiftSpreadEnabled || random.nextInt(5) == 0)
|
||||
if (worldObj.isRemote || hasGrownRifts || !properties.RiftSpreadEnabled
|
||||
|| random.nextInt(MAX_RIFT_SPREAD_CHANCE) < RIFT_SPREAD_CHANCE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
NewDimData dimension = PocketManager.getDimensionData(worldObj);
|
||||
|
||||
if(random.nextInt(dimension.findRiftsInRange(this.worldObj, 5, xCoord, yCoord, zCoord).size()+1)<2)
|
||||
{
|
||||
if(random.nextInt(7)!=0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
DimLink link = dimension.getLink(xCoord, yCoord, zCoord);
|
||||
|
||||
if (countAncestorLinks(link) > MAX_ANCESTOR_LINKS)
|
||||
@@ -320,8 +315,11 @@ public class TileEntityRift extends TileEntity
|
||||
return;
|
||||
}
|
||||
|
||||
//FIXME: This condition would prevent people from creating rooms of densely packed rifts... ~SenseiKiwi
|
||||
if (updateNearestRift())
|
||||
// The probability of rifts trying to spread increases if more rifts are nearby
|
||||
// Players should see rifts spread faster within clusters than at the edges of clusters
|
||||
// Also, single rifts CANNOT spread.
|
||||
int nearRifts = dimension.findRiftsInRange(this.worldObj, 5, xCoord, yCoord, zCoord).size();
|
||||
if (nearRifts == 0 || random.nextInt(nearRifts) == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -343,7 +341,7 @@ public class TileEntityRift extends TileEntity
|
||||
{
|
||||
dimension.createChildLink(x, y, z, link);
|
||||
hasGrownRifts = true;
|
||||
return;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -16,6 +16,7 @@ import StevenDimDoors.mod_pocketDim.core.NewDimData;
|
||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||
import StevenDimDoors.mod_pocketDim.items.ItemDimensionalDoor;
|
||||
import StevenDimDoors.mod_pocketDim.world.gateways.BaseGateway;
|
||||
import StevenDimDoors.mod_pocketDim.world.gateways.GatewaySandstonePillars;
|
||||
import StevenDimDoors.mod_pocketDim.world.gateways.GatewayTwoPillars;
|
||||
import cpw.mods.fml.common.IWorldGenerator;
|
||||
|
||||
@@ -36,6 +37,7 @@ public class GatewayGenerator implements IWorldGenerator
|
||||
private static final int END_DIMENSION_ID = 1;
|
||||
|
||||
private static ArrayList<BaseGateway> gateways;
|
||||
private static BaseGateway defaultGateway;
|
||||
|
||||
private final DDProperties properties;
|
||||
|
||||
@@ -48,7 +50,11 @@ public class GatewayGenerator implements IWorldGenerator
|
||||
public void initGateways()
|
||||
{
|
||||
gateways=new ArrayList<BaseGateway>();
|
||||
gateways.add(new GatewayTwoPillars(this.properties));
|
||||
this.defaultGateway=new GatewayTwoPillars(this.properties);
|
||||
|
||||
//add gateways here
|
||||
gateways.add(new GatewaySandstonePillars(this.properties));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -146,25 +152,23 @@ public class GatewayGenerator implements IWorldGenerator
|
||||
//Build the gateway if we found a valid location
|
||||
if (valid)
|
||||
{
|
||||
this.gateways.get(random.nextInt(gateways.size())).generate(world, x, y, z);
|
||||
/**
|
||||
//Create a partial link to a dungeon.
|
||||
dimension = PocketManager.getDimensionData(world);
|
||||
link = dimension.createLink(x, y + 1, z, LinkTypes.DUNGEON, 0);
|
||||
|
||||
//If the current dimension isn't Limbo, build a Rift Gateway out of Stone Bricks
|
||||
if (dimension.id() != properties.LimboDimensionID)
|
||||
//TODO I feel like this is slow and should be optimized. We are linear time with total # of generation restrictions
|
||||
//Create an array and copy valid gateways into it
|
||||
ArrayList<BaseGateway> validGateways = new ArrayList<BaseGateway>();
|
||||
for(BaseGateway gateway:gateways)
|
||||
{
|
||||
createStoneGateway(world, x, y, z, random);
|
||||
}
|
||||
else
|
||||
if(gateway.isLocationValid(world, x, y, z, world.getBiomeGenForCoords(x, z)))
|
||||
{
|
||||
createLimboGateway(world, x, y, z, properties.LimboBlockID);
|
||||
validGateways.add(gateway);
|
||||
}
|
||||
|
||||
//Place the shiny transient door into a dungeon
|
||||
ItemDimensionalDoor.placeDoorBlock(world, x, y, z, 0, mod_pocketDim.transientDoor);
|
||||
**/
|
||||
}
|
||||
//Add default gateway if we where unable to find a suitable gateway
|
||||
if(validGateways.isEmpty())
|
||||
{
|
||||
validGateways.add(this.defaultGateway);
|
||||
}
|
||||
//randomly select a gateway from the pool of viable gateways
|
||||
validGateways.get(random.nextInt(validGateways.size())).generate(world, x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,19 +21,41 @@ import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
public abstract class BaseGateway
|
||||
{
|
||||
//This pack is what the dungeon initially generates into from this gateway.
|
||||
protected DungeonPack startingPack;
|
||||
|
||||
/**Flag that determines if this gateway is tied to a specific biome.
|
||||
*For compatabilities sake, we are just using string comparison to check.
|
||||
**/
|
||||
protected boolean isBiomeSpecific;
|
||||
protected ArrayList<String> allowedBiomeNames;
|
||||
|
||||
/**
|
||||
* List of biome names that we check against. Is by default a whitelist, but the isBiomeValid method
|
||||
* can be overriden for specific gateways. For example, any biome containing 'forest' would be valid if we added 'forest',
|
||||
* even from other mods.
|
||||
*/
|
||||
protected ArrayList<String> biomeNames = new ArrayList<String>();
|
||||
|
||||
/**
|
||||
* List containing all the .schematics attached to this gateway. Selection is random by default,
|
||||
* but can be overriden for specific gateways in getSchematicToBuild
|
||||
*/
|
||||
protected ArrayList<String> schematicPaths= new ArrayList<String>();
|
||||
|
||||
//TODO not yet implemented
|
||||
protected boolean surfaceGateway;
|
||||
|
||||
//TODO not yet implemented
|
||||
protected int generationWeight;
|
||||
protected String schematicPath;
|
||||
|
||||
//Used to find the doorway for the .schematic
|
||||
protected GatewayBlockFilter filter;
|
||||
|
||||
|
||||
public BaseGateway(DDProperties properties)
|
||||
{
|
||||
//not using DD properties because sometimes its IDS can be wrong, but require it so we dont init too early
|
||||
filter = new GatewayBlockFilter((short) mod_pocketDim.dimensionalDoor.blockID,(short) mod_pocketDim.transientDoor.blockID);
|
||||
filter = new GatewayBlockFilter((short) properties.DimensionalDoorID, (short) properties.TransientDoorID,
|
||||
(short) properties.WarpDoorID);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -45,40 +67,24 @@ public abstract class BaseGateway
|
||||
*/
|
||||
public boolean generate(World world, int x, int y, int z)
|
||||
{
|
||||
/**
|
||||
* We have two cases here. The gateway may or may not specify a schematic to load from. If it does, we need to line up the door in the schematic with the given rift.
|
||||
* I tried doing this by taking the difference between the selected coords for the door, and the position of the door relative to the bounds of the .schematic,
|
||||
* but it doesnt work. It seems like it should, though. Odd.
|
||||
*
|
||||
* Now we have a new issue- we get an index array out of bounds. One of the exported *blocks* is -69.
|
||||
*
|
||||
*/
|
||||
Point3D doorLocation= new Point3D(0,0,0);
|
||||
int orientation = 0;
|
||||
try
|
||||
{
|
||||
if(this.schematicPath!=null)
|
||||
{
|
||||
Schematic schematic = Schematic.readFromResource(schematicPath);
|
||||
schematic.applyFilter(filter);
|
||||
|
||||
doorLocation = filter.getEntranceDoorLocation();
|
||||
if (this.hasSchematic())
|
||||
{
|
||||
Schematic schematic = this.getSchematicToBuild(world, x, y, z);
|
||||
|
||||
schematic.applyFilter(filter);
|
||||
Point3D doorLocation = filter.getEntranceDoorLocation();
|
||||
orientation = filter.getEntranceOrientation();
|
||||
|
||||
schematic.copyToWorld(world, x-schematic.getWidth()+doorLocation.getX(), y-schematic.getHeight()+doorLocation.getY(), z-schematic.getLength()+doorLocation.getZ());
|
||||
// I suspect that the location used below is wrong. Gateways should be placed vertically based on
|
||||
// the Y position of the surface where they belong. I'm pretty sure including doorLocation.getY()
|
||||
// messes up the calculation. ~SenseiKiwi
|
||||
|
||||
//TODO debug code to easily locate the rifts
|
||||
for(int c = 0; c<240; c++)
|
||||
{
|
||||
world.setBlock(x, y+c, z,Block.glowStone.blockID);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
//schematic.copyToWorld(world, x - doorLocation.getX(), y, z - doorLocation.getZ());
|
||||
schematic.copyToWorld(world, x - doorLocation.getX(), y + 1 - doorLocation.getY(), z - doorLocation.getZ());
|
||||
}
|
||||
|
||||
this.generateRandomBits(world, x, y, z);
|
||||
|
||||
DimLink link = PocketManager.getDimensionData(world).createLink(x, y + 1, z, LinkTypes.DUNGEON, orientation);
|
||||
@@ -87,6 +93,29 @@ public abstract class BaseGateway
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a .schematic to generate for this gateway
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @return
|
||||
*/
|
||||
public Schematic getSchematicToBuild(World world, int x, int y, int z)
|
||||
{
|
||||
//TODO- refine selection criteria here, this is the default case
|
||||
try
|
||||
{
|
||||
return Schematic.readFromResource(schematicPaths.get(world.rand.nextInt(schematicPaths.size())));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
System.err.println("Could not load schematic for gateway");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this function to generate randomized bits of the structure.
|
||||
* @param world
|
||||
@@ -116,17 +145,22 @@ public abstract class BaseGateway
|
||||
*/
|
||||
public boolean isLocationValid(World world, int x, int y, int z, BiomeGenBase biome)
|
||||
{
|
||||
return false;
|
||||
//TODO- refine condition here as warranted
|
||||
return this.isBiomeValid(biome);
|
||||
}
|
||||
|
||||
public boolean shouldGenUnderground()
|
||||
{
|
||||
return !surfaceGateway;
|
||||
}
|
||||
|
||||
public boolean isBiomeValid(BiomeGenBase biome)
|
||||
{
|
||||
return this.isBiomeSpecific||this.allowedBiomeNames.contains(biome.biomeName.toLowerCase());
|
||||
return !this.isBiomeSpecific || this.biomeNames.contains(biome.biomeName.toLowerCase());
|
||||
}
|
||||
|
||||
|
||||
public boolean hasSchematic()
|
||||
{
|
||||
return this.schematicPaths != null && !this.schematicPaths.isEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,20 +9,21 @@ import StevenDimDoors.mod_pocketDim.schematic.SchematicFilter;
|
||||
public class GatewayBlockFilter extends SchematicFilter {
|
||||
|
||||
private short dimensionalDoorID;
|
||||
private int transientDoorID;
|
||||
private int warpDoorID;
|
||||
private int entranceOrientation;
|
||||
private Schematic schematic;
|
||||
private Point3D entranceDoorLocation;
|
||||
private int transientDoorID;
|
||||
|
||||
|
||||
public GatewayBlockFilter(short dimensionalDoorID,short transientDoorID)
|
||||
public GatewayBlockFilter(short dimensionalDoorID, short transientDoorID, short warpDoorID)
|
||||
{
|
||||
super("GatewayEnteranceFinder");
|
||||
this.dimensionalDoorID = dimensionalDoorID;
|
||||
super("GatewayEntranceFinder");
|
||||
this.entranceDoorLocation = null;
|
||||
this.entranceOrientation = 0;
|
||||
this.schematic = null;
|
||||
this.dimensionalDoorID = dimensionalDoorID;
|
||||
this.transientDoorID = transientDoorID;
|
||||
this.warpDoorID = warpDoorID;
|
||||
}
|
||||
|
||||
public int getEntranceOrientation() {
|
||||
@@ -45,7 +46,6 @@ public class GatewayBlockFilter extends SchematicFilter {
|
||||
{
|
||||
int indexBelow;
|
||||
int indexDoubleBelow;
|
||||
System.out.println(blocks[index]);
|
||||
if (blocks[index] == dimensionalDoorID)
|
||||
{
|
||||
indexBelow = schematic.calculateIndexBelow(index);
|
||||
@@ -66,8 +66,17 @@ public class GatewayBlockFilter extends SchematicFilter {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (blocks[index] == warpDoorID)
|
||||
{
|
||||
indexBelow = schematic.calculateIndexBelow(index);
|
||||
if (indexBelow >= 0 && blocks[indexBelow] == warpDoorID)
|
||||
{
|
||||
entranceDoorLocation = schematic.calculatePoint(index);
|
||||
entranceOrientation = (metadata[indexBelow] & 3);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package StevenDimDoors.mod_pocketDim.world.gateways;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
import StevenDimDoors.mod_pocketDim.dungeon.pack.DungeonPack;
|
||||
import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
|
||||
public class GatewaySandstonePillars extends BaseGateway
|
||||
{
|
||||
|
||||
private static final int GATEWAY_RADIUS = 4;
|
||||
|
||||
public GatewaySandstonePillars(DDProperties properties)
|
||||
{
|
||||
super(properties);
|
||||
super.startingPack=DungeonHelper.instance().getDungeonPack("RUINS");
|
||||
super.isBiomeSpecific=true;
|
||||
super.biomeNames.add("desert");
|
||||
surfaceGateway=true;
|
||||
generationWeight = 0;
|
||||
schematicPaths.add("/schematics/gateways/sandstonePillars.schematic");
|
||||
|
||||
}
|
||||
@Override
|
||||
public boolean generate(World world, int x, int y, int z)
|
||||
{
|
||||
//simple to transform the generation location here.
|
||||
//Do you think this is the best way to do this?
|
||||
return super.generate(world, x, y+2, z);
|
||||
}
|
||||
@Override
|
||||
public void generateRandomBits(World world, int x, int y, int z)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,28 +6,55 @@ import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
import StevenDimDoors.mod_pocketDim.dungeon.pack.DungeonPack;
|
||||
import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class GatewayTwoPillars extends BaseGateway
|
||||
{
|
||||
|
||||
private GatewayBlockFilter filter;
|
||||
private static final int GATEWAY_RADIUS = 4;
|
||||
|
||||
public GatewayTwoPillars(DDProperties properties)
|
||||
{
|
||||
super(properties);
|
||||
super.startingPack=DungeonHelper.instance().getDungeonPack("RUINS");
|
||||
super.isBiomeSpecific=false;
|
||||
super.allowedBiomeNames=null;
|
||||
super.biomeNames=null;
|
||||
surfaceGateway=true;
|
||||
generationWeight = 0;
|
||||
schematicPath="/schematics/gateways/twoPillars.schematic";
|
||||
schematicPaths.add("/schematics/gateways/twoPillars.schematic");
|
||||
|
||||
}
|
||||
@Override
|
||||
void generateRandomBits(World world, int x, int y, int z)
|
||||
{
|
||||
final int blockID = Block.stoneBrick.blockID;
|
||||
|
||||
//Replace some of the ground around the gateway with bricks
|
||||
for (int xc = -GATEWAY_RADIUS; xc <= GATEWAY_RADIUS; xc++)
|
||||
{
|
||||
for (int zc= -GATEWAY_RADIUS; zc <= GATEWAY_RADIUS; zc++)
|
||||
{
|
||||
//Check that the block is supported by an opaque block.
|
||||
//This prevents us from building over a cliff, on the peak of a mountain,
|
||||
//or the surface of the ocean or a frozen lake.
|
||||
if (world.isBlockOpaqueCube(x + xc, y - 2, z + zc))
|
||||
{
|
||||
//Randomly choose whether to place bricks or not. The math is designed so that the
|
||||
//chances of placing a block decrease as we get farther from the gateway's center.
|
||||
if (Math.abs(xc) + Math.abs(zc) < world.rand.nextInt(2) + 3)
|
||||
{
|
||||
//Place Stone Bricks
|
||||
world.setBlock(x + xc, y - 1, z + zc, blockID, 0, 3);
|
||||
}
|
||||
else if (Math.abs(xc) + Math.abs(zc) < world.rand.nextInt(3) + 3)
|
||||
{
|
||||
//Place Cracked Stone Bricks
|
||||
world.setBlock(x + xc, y - 1, z + zc, blockID, 2, 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 9.7 KiB |
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"animation":
|
||||
{
|
||||
"frametime": 3,
|
||||
"frames":
|
||||
[
|
||||
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
11,
|
||||
12,
|
||||
13,
|
||||
14,
|
||||
15
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"animation":
|
||||
{
|
||||
"frametime": 3,
|
||||
"frames":
|
||||
[
|
||||
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
11,
|
||||
12,
|
||||
13,
|
||||
14,
|
||||
15,
|
||||
16,
|
||||
17,
|
||||
18,
|
||||
19,
|
||||
18,
|
||||
17,
|
||||
16,
|
||||
15,
|
||||
14,
|
||||
13,
|
||||
12,
|
||||
11,
|
||||
10,
|
||||
9,
|
||||
8,
|
||||
7,
|
||||
6,
|
||||
5,
|
||||
4,
|
||||
3,
|
||||
2,
|
||||
1
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user