Various Fixes #127

Merged
SenseiKiwi merged 9 commits from master into master 2014-01-19 06:07:38 +00:00
17 changed files with 440 additions and 69 deletions
Showing only changes of commit 15cfe6fc33 - Show all commits

View File

@@ -0,0 +1,13 @@
package StevenDimDoors.experimental;
import net.minecraftforge.fluids.Fluid;
public class LiquidCorium extends Fluid
{
public LiquidCorium(String fluidName)
{
super(fluidName);
}
}

View 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;
}
}

View File

@@ -274,8 +274,6 @@ public class DDTeleporter
{ {
throw new IllegalArgumentException("destination cannot be null."); throw new IllegalArgumentException("destination cannot be null.");
} }
//This beautiful teleport method is based off of xCompWiz's teleport function. //This beautiful teleport method is based off of xCompWiz's teleport function.
WorldServer oldWorld = (WorldServer) entity.worldObj; WorldServer oldWorld = (WorldServer) entity.worldObj;
@@ -372,6 +370,10 @@ public class DDTeleporter
NBTTagCompound entityNBT = new NBTTagCompound(); NBTTagCompound entityNBT = new NBTTagCompound();
entity.isDead = false; entity.isDead = false;
entity.writeMountToNBT(entityNBT); entity.writeMountToNBT(entityNBT);
if(entityNBT.hasNoTags())
{
return entity;
}
entity.isDead = true; entity.isDead = true;
entity = EntityList.createEntityFromNBT(entityNBT, newWorld); 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. // Let's try doing this down here in case this is what's killing NEI.
GameRegistry.onPlayerChangedDimension((EntityPlayer)entity); GameRegistry.onPlayerChangedDimension((EntityPlayer)entity);
} }
DDTeleporter.placeInPortal(entity, newWorld, destination, properties, checkOrientation); DDTeleporter.placeInPortal(entity, newWorld, destination, properties, checkOrientation);
return entity; return entity;

View File

@@ -1,5 +1,7 @@
package StevenDimDoors.mod_pocketDim; package StevenDimDoors.mod_pocketDim;
import StevenDimDoors.experimental.LiquidCorium;
import StevenDimDoors.experimental.LiquidCoriumBlock;
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;
@@ -76,6 +78,7 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityEggInfo; import net.minecraft.entity.EntityEggInfo;
import net.minecraft.entity.EntityList; import net.minecraft.entity.EntityList;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.EnumToolMaterial; import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@@ -84,6 +87,8 @@ import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.DimensionManager; import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.common.ForgeChunkManager; import net.minecraftforge.common.ForgeChunkManager;
import net.minecraftforge.common.MinecraftForge; 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)
@@ -139,6 +144,9 @@ public class mod_pocketDim
public static GatewayGenerator riftGen; public static GatewayGenerator riftGen;
public static PlayerTracker tracker; public static PlayerTracker tracker;
public static Block coriumBlock;
public static Fluid coriumFluid;
public static CreativeTabs dimDoorsCreativeTab = new CreativeTabs("dimDoorsCreativeTab") public static CreativeTabs dimDoorsCreativeTab = new CreativeTabs("dimDoorsCreativeTab")
{ {
@Override @Override
@@ -282,6 +290,14 @@ public class mod_pocketDim
DungeonHelper.initialize(); DungeonHelper.initialize();
this.riftGen.initGateways(); 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 // Register loot chests

View File

@@ -2,6 +2,8 @@ package StevenDimDoors.mod_pocketDim.ticking;
import java.util.List; import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.DataWatcher; import net.minecraft.entity.DataWatcher;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityFlying; import net.minecraft.entity.EntityFlying;
@@ -29,7 +31,7 @@ public class MobMonolith extends EntityFlying implements IMob
float soundTime = 0; float soundTime = 0;
int aggro = 0; int aggro = 0;
byte textureState = 0; byte textureState = 0;
float entityCollisionReduction = 100;
float scaleFactor = 0; float scaleFactor = 0;
int aggroMax; int aggroMax;
int destX = 0; // unused fields? int destX = 0; // unused fields?
@@ -100,6 +102,39 @@ public class MobMonolith extends EntityFlying implements IMob
this.dataWatcher.addObject(16, Byte.valueOf((byte)0)); 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 @Override
public void onEntityUpdate() public void onEntityUpdate()
{ {
@@ -109,10 +144,9 @@ public class MobMonolith extends EntityFlying implements IMob
} }
super.onEntityUpdate(); super.onEntityUpdate();
if(this.isClipping())
if (this.isEntityAlive() && this.isEntityInsideOpaqueBlock())
{ {
this.setDead(); this.moveEntity(0, .1, 0);
} }
EntityPlayer entityPlayer = this.worldObj.getClosestPlayerToEntity(this, 30); EntityPlayer entityPlayer = this.worldObj.getClosestPlayerToEntity(this, 30);

View File

@@ -129,8 +129,8 @@ public class MonolithSpawner implements IRegularTickReceiver {
} }
while (!pocket.isAirBlock(x,jumpHeight+6 , z)&&jumpSanity<20); while (!pocket.isAirBlock(x,jumpHeight+6 , z)&&jumpSanity<20);
Entity monolith = new MobMonolith(pocket); MobMonolith monolith = new MobMonolith(pocket);
monolith.setLocationAndAngles(x, jumpHeight, z, 1, 1); monolith.setLocationAndAngles(x, jumpHeight-(5-monolith.getRenderSizeModifier()*5), z, 1, 1);
pocket.spawnEntityInWorld(monolith); pocket.spawnEntityInWorld(monolith);
didSpawn = true; didSpawn = true;
} }

View File

@@ -16,6 +16,7 @@ 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.gateways.BaseGateway;
import StevenDimDoors.mod_pocketDim.world.gateways.GatewaySandstonePillars;
import StevenDimDoors.mod_pocketDim.world.gateways.GatewayTwoPillars; import StevenDimDoors.mod_pocketDim.world.gateways.GatewayTwoPillars;
import cpw.mods.fml.common.IWorldGenerator; 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 final int END_DIMENSION_ID = 1;
private static ArrayList<BaseGateway> gateways; private static ArrayList<BaseGateway> gateways;
private static BaseGateway defaultGateway;
private final DDProperties properties; private final DDProperties properties;
@@ -48,7 +50,11 @@ public class GatewayGenerator implements IWorldGenerator
public void initGateways() public void initGateways()
{ {
gateways=new ArrayList<BaseGateway>(); 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 @Override
@@ -146,25 +152,23 @@ public class GatewayGenerator implements IWorldGenerator
//Build the gateway if we found a valid location //Build the gateway if we found a valid location
if (valid) if (valid)
{ {
this.gateways.get(random.nextInt(gateways.size())).generate(world, x, y, z); //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
//Create a partial link to a dungeon. ArrayList<BaseGateway> validGateways = new ArrayList<BaseGateway>();
dimension = PocketManager.getDimensionData(world); for(BaseGateway gateway:gateways)
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)
{ {
createStoneGateway(world, x, y, z, random); if(gateway.isLocationValid(world, x, y, z, world.getBiomeGenForCoords(x, z)))
}
else
{ {
createLimboGateway(world, x, y, z, properties.LimboBlockID); validGateways.add(gateway);
} }
}
//Place the shiny transient door into a dungeon //Add default gateway if we where unable to find a suitable gateway
ItemDimensionalDoor.placeDoorBlock(world, x, y, z, 0, mod_pocketDim.transientDoor); 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);
} }
} }
} }

View File

@@ -21,18 +21,41 @@ import net.minecraft.world.biome.BiomeGenBase;
public abstract class BaseGateway public abstract class BaseGateway
{ {
//This pack is what the dungeon initially generates into from this gateway.
protected DungeonPack startingPack; 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 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; protected boolean surfaceGateway;
//TODO not yet implemented
protected int generationWeight; protected int generationWeight;
protected String schematicPath;
//Used to find the doorway for the .schematic
protected GatewayBlockFilter filter; protected GatewayBlockFilter filter;
public BaseGateway(DDProperties properties) public BaseGateway(DDProperties properties)
{ {
filter = new GatewayBlockFilter((short) properties.DimensionalDoorID, (short) properties.TransientDoorID); filter = new GatewayBlockFilter((short) properties.DimensionalDoorID, (short) properties.TransientDoorID,
(short) properties.WarpDoorID);
} }
/** /**
@@ -44,40 +67,24 @@ public abstract class BaseGateway
*/ */
public boolean generate(World world, int x, int y, int z) 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; 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(); orientation = filter.getEntranceOrientation();
schematic.copyToWorld(world, x - doorLocation.getX(), y, z - 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 //schematic.copyToWorld(world, x - doorLocation.getX(), y, z - doorLocation.getZ());
for (int c = 5; c < 240; c++) schematic.copyToWorld(world, x - doorLocation.getX(), y + 1 - doorLocation.getY(), z - doorLocation.getZ());
{
world.setBlock(x, y + c, z, Block.glowStone.blockID);
}
}
}
catch (Exception e)
{
e.printStackTrace();
return false;
} }
this.generateRandomBits(world, x, y, z); this.generateRandomBits(world, x, y, z);
DimLink link = PocketManager.getDimensionData(world).createLink(x, y + 1, z, LinkTypes.DUNGEON, orientation); DimLink link = PocketManager.getDimensionData(world).createLink(x, y + 1, z, LinkTypes.DUNGEON, orientation);
@@ -86,6 +93,29 @@ public abstract class BaseGateway
return true; 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. * Use this function to generate randomized bits of the structure.
* @param world * @param world
@@ -115,7 +145,8 @@ public abstract class BaseGateway
*/ */
public boolean isLocationValid(World world, int x, int y, int z, BiomeGenBase biome) 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() public boolean shouldGenUnderground()
@@ -125,6 +156,11 @@ public abstract class BaseGateway
public boolean isBiomeValid(BiomeGenBase biome) 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();
} }
} }

View File

@@ -9,20 +9,22 @@ import StevenDimDoors.mod_pocketDim.schematic.SchematicFilter;
public class GatewayBlockFilter extends SchematicFilter { public class GatewayBlockFilter extends SchematicFilter {
private short dimensionalDoorID; private short dimensionalDoorID;
private int transientDoorID;
private int warpDoorID;
private int entranceOrientation; private int entranceOrientation;
private Schematic schematic; private Schematic schematic;
private Point3D entranceDoorLocation; private Point3D entranceDoorLocation;
private int transientDoorID;
public GatewayBlockFilter(short dimensionalDoorID, short transientDoorID) public GatewayBlockFilter(short dimensionalDoorID, short transientDoorID, short warpDoorID)
{ {
super("GatewayEntranceFinder"); super("GatewayEntranceFinder");
this.dimensionalDoorID = dimensionalDoorID;
this.entranceDoorLocation = null; this.entranceDoorLocation = null;
this.entranceOrientation = 0; this.entranceOrientation = 0;
this.schematic = null; this.schematic = null;
this.dimensionalDoorID = dimensionalDoorID;
this.transientDoorID = transientDoorID; this.transientDoorID = transientDoorID;
this.warpDoorID = warpDoorID;
} }
public int getEntranceOrientation() { public int getEntranceOrientation() {
@@ -65,6 +67,16 @@ public class GatewayBlockFilter extends SchematicFilter {
return true; 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; return false;
} }

View File

@@ -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)
{
}
}

View File

@@ -6,28 +6,55 @@ import StevenDimDoors.mod_pocketDim.DDProperties;
import StevenDimDoors.mod_pocketDim.mod_pocketDim; import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.dungeon.pack.DungeonPack; import StevenDimDoors.mod_pocketDim.dungeon.pack.DungeonPack;
import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper; import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper;
import net.minecraft.block.Block;
import net.minecraft.world.World; import net.minecraft.world.World;
public class GatewayTwoPillars extends BaseGateway public class GatewayTwoPillars extends BaseGateway
{ {
private GatewayBlockFilter filter; private static final int GATEWAY_RADIUS = 4;
public GatewayTwoPillars(DDProperties properties) public GatewayTwoPillars(DDProperties properties)
{ {
super(properties); super(properties);
super.startingPack=DungeonHelper.instance().getDungeonPack("RUINS"); super.startingPack=DungeonHelper.instance().getDungeonPack("RUINS");
super.isBiomeSpecific=false; super.isBiomeSpecific=false;
super.allowedBiomeNames=null; super.biomeNames=null;
surfaceGateway=true; surfaceGateway=true;
generationWeight = 0; generationWeight = 0;
schematicPath="/schematics/gateways/twoPillars.schematic"; schematicPaths.add("/schematics/gateways/twoPillars.schematic");
} }
@Override @Override
void generateRandomBits(World world, int x, int y, int z) 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

View File

@@ -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

View File

@@ -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
]
}
}