Added Sky Stone Tracking.

Added Meteorite Compass Block / Item.
Added Meteorite Spawner Debug Item.
Some Refactoring.
This commit is contained in:
AlgorithmX2
2014-03-02 02:35:11 -06:00
parent fb6bb1a964
commit 792249f8fd
62 changed files with 2472 additions and 754 deletions
+2 -1
View File
@@ -12,6 +12,7 @@ import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.util.IOrientable;
import appeng.api.util.IOrientableBlock;
import appeng.block.misc.BlockSkyCompass;
import appeng.block.networking.BlockWireless;
import appeng.client.render.ItemRenderer;
import appeng.me.helpers.IGridProxyable;
@@ -62,7 +63,7 @@ public class AEBaseItemBlock extends ItemBlock
if ( blockType.hasBlockTileEntity() )
{
if ( blockType instanceof BlockWireless )
if ( blockType instanceof BlockWireless || blockType instanceof BlockSkyCompass )
{
forward = ForgeDirection.getOrientation( side );
if ( forward == ForgeDirection.UP || forward == ForgeDirection.DOWN )
+161
View File
@@ -0,0 +1,161 @@
package appeng.block.misc;
import java.util.Arrays;
import java.util.EnumSet;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.block.AEBaseBlock;
import appeng.client.render.BaseBlockRender;
import appeng.client.render.blocks.RenderBlockSkyCompass;
import appeng.core.features.AEFeature;
import appeng.helpers.ICustomCollision;
import appeng.tile.misc.TileSkyCompass;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockSkyCompass extends AEBaseBlock implements ICustomCollision
{
public BlockSkyCompass() {
super( BlockSkyCompass.class, Material.iron );
setfeature( EnumSet.of( AEFeature.Core ) );
setTileEntiy( TileSkyCompass.class );
isOpaque = isFullSize = false;
lightOpacity = 0;
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int direction, int metadata)
{
return Blocks.iron_block.getIcon( direction, metadata );
}
@Override
protected Class<? extends BaseBlockRender> getRenderer()
{
return RenderBlockSkyCompass.class;
}
private void dropTorch(World w, int x, int y, int z)
{
w.func_147480_a( x, y, z, true );
// w.destroyBlock( x, y, z, true );
w.markBlockForUpdate( x, y, z );
}
@Override
public boolean canPlaceBlockAt(World w, int x, int y, int z)
{
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
if ( canPlaceAt( w, x, y, z, dir ) )
return true;
return false;
}
private boolean canPlaceAt(World w, int x, int y, int z, ForgeDirection dir)
{
return w.isSideSolid( x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, dir.getOpposite(), false );
}
@Override
public boolean isValidOrientation(World w, int x, int y, int z, ForgeDirection forward, ForgeDirection up)
{
TileSkyCompass sc = getTileEntity( w, x, y, z );
if ( sc != null )
return false;
return canPlaceAt( w, x, y, z, forward.getOpposite() );
}
@Override
public void onNeighborBlockChange(World w, int x, int y, int z, Block id)
{
TileSkyCompass sc = getTileEntity( w, x, y, z );
ForgeDirection up = sc.getForward();
if ( !canPlaceAt( w, x, y, z, up.getOpposite() ) )
dropTorch( w, x, y, z );
}
@Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxsFromPool(World w, int x, int y, int z, Entity e, boolean isVisual)
{
TileSkyCompass tile = getTileEntity( w, x, y, z );
if ( tile != null )
{
ForgeDirection forward = tile.getForward();
double minX = 0;
double minY = 0;
double minZ = 0;
double maxX = 1;
double maxY = 1;
double maxZ = 1;
switch (forward)
{
case DOWN:
minZ = minX = 5.0 / 16.0;
maxZ = maxX = 11.0 / 16.0;
maxY = 1.0;
minY = 14.0 / 16.0;
break;
case EAST:
minZ = minY = 5.0 / 16.0;
maxZ = maxY = 11.0 / 16.0;
maxX = 2.0 / 16.0;
minX = 0.0;
break;
case NORTH:
minY = minX = 5.0 / 16.0;
maxY = maxX = 11.0 / 16.0;
maxZ = 1.0;
minZ = 14.0 / 16.0;
break;
case SOUTH:
minY = minX = 5.0 / 16.0;
maxY = maxX = 11.0 / 16.0;
maxZ = 2.0 / 16.0;
minZ = 0.0;
break;
case UP:
minZ = minX = 5.0 / 16.0;
maxZ = maxX = 11.0 / 16.0;
maxY = 2.0 / 16.0;
minY = 0.0;
break;
case WEST:
minZ = minY = 5.0 / 16.0;
maxZ = maxY = 11.0 / 16.0;
maxX = 1.0;
minX = 14.0 / 16.0;
break;
default:
break;
}
return Arrays.asList( new AxisAlignedBB[] { AxisAlignedBB.getBoundingBox( minX, minY, minZ, maxX, maxY, maxZ ) } );
}
return Arrays.asList( new AxisAlignedBB[] { AxisAlignedBB.getBoundingBox( 0.0, 0, 0.0, 1.0, 1.0, 1.0 ) } );
}
@Override
public void addCollidingBlockToList(World w, int x, int y, int z, AxisAlignedBB bb, List out, Entity e)
{
}
@Override
public void registerBlockIcons(IIconRegister iconRegistry)
{
// :P
}
}
+1 -1
View File
@@ -27,8 +27,8 @@ import appeng.core.AppEng;
import appeng.core.features.AEFeature;
import appeng.entity.EntityIds;
import appeng.entity.EntityTinyTNTPrimed;
import appeng.helpers.DispenserBehaviorTinyTNT;
import appeng.helpers.ICustomCollision;
import appeng.hooks.DispenserBehaviorTinyTNT;
import cpw.mods.fml.common.registry.EntityRegistry;
public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
+16
View File
@@ -3,6 +3,7 @@ package appeng.block.solids;
import java.util.EnumSet;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
@@ -15,6 +16,7 @@ import net.minecraft.world.World;
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.relauncher.Side;
@@ -110,4 +112,18 @@ public class BlockSkyStone extends AEBaseBlock implements IOrientableBlock
l.add( new ItemStack( i, 1, 3 ) );
}
@Override
public void onBlockAdded(World w, int x, int y, int z)
{
super.onBlockAdded( w, x, y, z );
WorldSettings.getInstance().getCompass().updateArea( w, x, y, z );
}
@Override
public void breakBlock(World w, int x, int y, int z, Block b, int WTF)
{
super.breakBlock( w, x, y, z, b, WTF );
WorldSettings.getInstance().getCompass().updateArea( w, x, y, z );
}
}
+1 -33
View File
@@ -9,15 +9,12 @@ import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.AEApi;
import appeng.api.storage.ICellHandler;
import appeng.api.storage.IMEInventoryHandler;
import appeng.api.storage.StorageChannel;
import appeng.block.AEBaseBlock;
import appeng.client.render.BaseBlockRender;
import appeng.client.render.blocks.RenderMEChest;
import appeng.core.features.AEFeature;
import appeng.core.localization.PlayerMessages;
import appeng.core.sync.GuiBridge;
import appeng.helpers.AENoHandler;
import appeng.tile.storage.TileChest;
import appeng.util.Platform;
@@ -56,36 +53,7 @@ public class BlockChest extends AEBaseBlock
{
ICellHandler ch = AEApi.instance().registries().cell().getHander( cell );
try
{
IMEInventoryHandler ih = tg.getHandler( StorageChannel.ITEMS );
if ( ch != null && ih != null )
{
IMEInventoryHandler mine = ih;
ch.openChestGui( p, tg, ch, mine, cell, StorageChannel.ITEMS );
return true;
}
}
catch (AENoHandler e)
{
// :P
}
try
{
IMEInventoryHandler fh = tg.getHandler( StorageChannel.FLUIDS );
if ( ch != null && fh != null )
{
IMEInventoryHandler mine = fh;
ch.openChestGui( p, tg, ch, mine, cell, StorageChannel.FLUIDS );
return true;
}
}
catch (AENoHandler e)
{
// :P
}
tg.openGui( p, ch, cell, side );
}
p.addChatMessage( PlayerMessages.ChestCannotReadStorageCell.get() );