SkyStone Mining finalized.
Added Ice meteorite spawn. Fixed Crash with Meteorite Spawning.
This commit is contained in:
parent
58992d0786
commit
500558982f
3 changed files with 54 additions and 6 deletions
|
@ -13,12 +13,15 @@ import net.minecraft.util.IIcon;
|
|||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.core.WorldSettings;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.helpers.LocationRotation;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -34,12 +37,27 @@ public class BlockSkyStone extends AEBaseBlock implements IOrientableBlock
|
|||
@SideOnly(Side.CLIENT)
|
||||
IIcon SmallBrick;
|
||||
|
||||
@SubscribeEvent
|
||||
public void breakFaster(PlayerEvent.BreakSpeed Ev)
|
||||
{
|
||||
if ( Ev.block == this && Ev.originalSpeed > 7 || Ev.metadata > 0 )
|
||||
Ev.newSpeed /= 0.1;
|
||||
}
|
||||
|
||||
public BlockSkyStone() {
|
||||
super( BlockSkyStone.class, Material.rock );
|
||||
setfeature( EnumSet.of( AEFeature.Core ) );
|
||||
setHardness( 50 );
|
||||
hasSubtypes = true;
|
||||
blockResistance = 150.0f;
|
||||
setHarvestLevel( "pickaxe", 3, 0 );
|
||||
MinecraftForge.EVENT_BUS.register( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta)
|
||||
{
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -55,7 +55,8 @@ public class WorldSettings extends Configuration
|
|||
{
|
||||
if ( instance == null )
|
||||
{
|
||||
File world = DimensionManager.getWorld( 0 ).getSaveHandler().getWorldDirectory();
|
||||
File world = DimensionManager.getCurrentSaveRootDirectory();
|
||||
|
||||
File f = new File( world.getPath() + File.separatorChar + "AE2" );
|
||||
|
||||
if ( !f.exists() || !f.isDirectory() )
|
||||
|
|
|
@ -111,6 +111,28 @@ public class MeteoritePlacer
|
|||
|
||||
};
|
||||
|
||||
private class FalloutSnow extends FalloutCopy
|
||||
{
|
||||
|
||||
public FalloutSnow(World w, int x, int y, int z) {
|
||||
super( w, x, y, z );
|
||||
}
|
||||
|
||||
public int adjustCrator()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
public void getOther(World w, int x, int y, int z, double a)
|
||||
{
|
||||
if ( a > 0.7 )
|
||||
put( w, x, y, z, Blocks.snow );
|
||||
else if ( a > 0.5 )
|
||||
put( w, x, y, z, Blocks.ice );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
int minBLocks = 200;
|
||||
HashSet<Block> validSpawn = new HashSet();
|
||||
HashSet<Block> invalidSpawn = new HashSet();
|
||||
|
@ -140,6 +162,8 @@ public class MeteoritePlacer
|
|||
validSpawn.add( Blocks.diamond_ore );
|
||||
validSpawn.add( Blocks.redstone_ore );
|
||||
validSpawn.add( Blocks.hardened_clay );
|
||||
validSpawn.add( Blocks.ice );
|
||||
validSpawn.add( Blocks.snow );
|
||||
|
||||
invalidSpawn.add( skystone );
|
||||
invalidSpawn.add( Blocks.planks );
|
||||
|
@ -168,6 +192,8 @@ public class MeteoritePlacer
|
|||
type = new FalloutSand( w, x, y, z );
|
||||
else if ( blk == Blocks.hardened_clay )
|
||||
type = new FalloutCopy( w, x, y, z );
|
||||
else if ( blk == Blocks.ice || blk == Blocks.snow )
|
||||
type = new FalloutSnow( w, x, y, z );
|
||||
|
||||
int realValidBlocks = 0;
|
||||
|
||||
|
@ -283,10 +309,11 @@ public class MeteoritePlacer
|
|||
|
||||
private void Decay(World w, int x, int y, int z)
|
||||
{
|
||||
double randomShit = 0;
|
||||
|
||||
for (int i = x - 30; i < x + 30; i++)
|
||||
for (int j = y - 9; j < y + 30; j++)
|
||||
for (int k = z - 30; k < z + 30; k++)
|
||||
for (int j = y - 9; j < y + 30; j++)
|
||||
{
|
||||
Block blk = w.getBlock( i, j, k );
|
||||
if ( blk == Blocks.lava )
|
||||
|
@ -304,7 +331,7 @@ public class MeteoritePlacer
|
|||
w.setBlock( i, j, k, blk_b, meta_b, 3 );
|
||||
w.setBlock( i, j + 1, k, blk );
|
||||
}
|
||||
else
|
||||
else if ( randomShit < 100 * crator )
|
||||
{
|
||||
double dx = i - x;
|
||||
double dy = j - y;
|
||||
|
@ -314,10 +341,12 @@ public class MeteoritePlacer
|
|||
Block xf = w.getBlock( i, j - 1, k );
|
||||
if ( !xf.isReplaceable( w, i, j - 1, k ) )
|
||||
{
|
||||
double height = crator * 0.1 - Math.abs( dist - crator * 1.7 );
|
||||
double extrRange = Math.random() * 0.6;
|
||||
double height = crator * (extrRange + 0.2) - Math.abs( dist - crator * 1.7 );
|
||||
|
||||
if ( xf != blk && height > 0 && Math.random() > 0.5 )
|
||||
if ( xf != blk && height > 0 && Math.random() > 0.6 )
|
||||
{
|
||||
randomShit++;
|
||||
type.getRandomFall( w, i, j, k );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue