Lots of fixes.

I also played around with fluids, and added something thats for BR. Its
not permanent here.
This commit is contained in:
StevenRS11 2014-01-18 18:35:11 -05:00
parent 0fcf02e75f
commit 80d828c252
10 changed files with 260 additions and 10 deletions

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.");
}
//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;

View file

@ -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)
@ -138,6 +143,9 @@ public class mod_pocketDim
public static MonolithSpawner spawner; //Added this field temporarily. Will be refactored out later.
public static GatewayGenerator riftGen;
public static PlayerTracker tracker;
public static Block coriumBlock;
public static Fluid coriumFluid;
public static CreativeTabs dimDoorsCreativeTab = new CreativeTabs("dimDoorsCreativeTab")
{
@ -232,7 +240,7 @@ public class mod_pocketDim
DimensionManager.registerProviderType(properties.PocketProviderID, PocketProvider.class, false);
DimensionManager.registerProviderType(properties.LimboProviderID, LimboProvider.class, false);
DimensionManager.registerDimension(properties.LimboDimensionID, properties.LimboProviderID);
LanguageRegistry.addName(goldDoor, "Golden Door");
LanguageRegistry.addName(goldDimDoor, "Golden Dimensional Door");
LanguageRegistry.addName(transientDoor , "transientDoor");
@ -282,8 +290,16 @@ 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
DDLoot.registerInfo(properties);
proxy.loadTextures();

View file

@ -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?
@ -99,6 +101,39 @@ public class MobMonolith extends EntityFlying implements IMob
super.entityInit();
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()
@ -107,12 +142,11 @@ public class MobMonolith extends EntityFlying implements IMob
{
this.setDead();
}
super.onEntityUpdate();
if (this.isEntityAlive() && this.isEntityInsideOpaqueBlock())
if(this.isClipping())
{
this.setDead();
this.moveEntity(0, .1, 0);
}
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);
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;
}

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