Started on miner.

Doesn't actually do anything yet though.
This commit is contained in:
Ellpeck 2015-12-06 02:16:52 +01:00
parent b7ee376254
commit 80434f4e6d
9 changed files with 148 additions and 0 deletions

View file

@ -22,6 +22,7 @@ import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText; import net.minecraft.util.ChatComponentText;
@ -44,6 +45,11 @@ public class BlockAtomicReconstructor extends BlockContainerBase{
this.setStepSound(soundTypeStone); this.setStepSound(soundTypeStone);
} }
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.epic;
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){ public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){

View file

@ -0,0 +1,76 @@
/*
* This file ("BlockMiner.java") is part of the Actually Additions Mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015 Ellpeck
*/
package ellpeck.actuallyadditions.blocks;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.blocks.base.BlockContainerBase;
import ellpeck.actuallyadditions.tile.TileEntityMiner;
import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
public class BlockMiner extends BlockContainerBase{
@SideOnly(Side.CLIENT)
private IIcon frontIcon;
@SideOnly(Side.CLIENT)
private IIcon topIcon;
public BlockMiner(String name){
super(Material.rock, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(8F);
this.setResistance(30F);
this.setStepSound(soundTypeStone);
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta){
return side == 0 ? this.frontIcon : (side == 1 ? this.topIcon : this.blockIcon);
}
@Override
public boolean isOpaqueCube(){
return false;
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.rare;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconReg){
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Front");
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top");
}
@Override
public TileEntity createNewTileEntity(World world, int i){
return new TileEntityMiner();
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
this.dropInventory(world, x, y, z);
super.breakBlock(world, x, y, z, block, par6);
}
}

View file

@ -108,10 +108,12 @@ public class InitBlocks{
public static Block blockAtomicReconstructor; public static Block blockAtomicReconstructor;
public static Block blockBookletStand; public static Block blockBookletStand;
public static Block blockMiner;
public static void init(){ public static void init(){
ModUtil.LOGGER.info("Initializing Blocks..."); ModUtil.LOGGER.info("Initializing Blocks...");
blockMiner = new BlockMiner("blockMiner");
blockBookletStand = new BlockBookletStand("blockBookStand"); blockBookletStand = new BlockBookletStand("blockBookStand");
blockAtomicReconstructor = new BlockAtomicReconstructor("blockAtomicReconstructor"); blockAtomicReconstructor = new BlockAtomicReconstructor("blockAtomicReconstructor");
blockCrystal = new BlockCrystal("blockCrystal"); blockCrystal = new BlockCrystal("blockCrystal");

View file

@ -64,6 +64,7 @@ public class CreativeTab extends CreativeTabs{
add(InitBlocks.blockCoffeeMachine); add(InitBlocks.blockCoffeeMachine);
add(InitBlocks.blockXPSolidifier); add(InitBlocks.blockXPSolidifier);
add(InitBlocks.blockMiner);
add(InitBlocks.blockGreenhouseGlass); add(InitBlocks.blockGreenhouseGlass);
add(InitBlocks.blockGrinder); add(InitBlocks.blockGrinder);
add(InitBlocks.blockGrinderDouble); add(InitBlocks.blockGrinderDouble);

View file

@ -70,6 +70,7 @@ public abstract class TileEntityBase extends TileEntity{
GameRegistry.registerTileEntity(TileEntityLaserRelay.class, ModUtil.MOD_ID_LOWER+":tileEntityLaserRelay"); GameRegistry.registerTileEntity(TileEntityLaserRelay.class, ModUtil.MOD_ID_LOWER+":tileEntityLaserRelay");
GameRegistry.registerTileEntity(TileEntityAtomicReconstructor.class, ModUtil.MOD_ID_LOWER+":tileEntityAtomicReconstructor"); GameRegistry.registerTileEntity(TileEntityAtomicReconstructor.class, ModUtil.MOD_ID_LOWER+":tileEntityAtomicReconstructor");
GameRegistry.registerTileEntity(TileEntityBookletStand.class, ModUtil.MOD_ID_LOWER+":tileEntityBookletStand"); GameRegistry.registerTileEntity(TileEntityBookletStand.class, ModUtil.MOD_ID_LOWER+":tileEntityBookletStand");
GameRegistry.registerTileEntity(TileEntityMiner.class, ModUtil.MOD_ID_LOWER+":tileEntityMiner");
} }
@Override @Override

View file

@ -0,0 +1,62 @@
/*
* This file ("TileEntityMiner.java") is part of the Actually Additions Mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015 Ellpeck
*/
package ellpeck.actuallyadditions.tile;
import cofh.api.energy.EnergyStorage;
import cofh.api.energy.IEnergyReceiver;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityMiner extends TileEntityBase implements IEnergyReceiver{
public EnergyStorage storage = new EnergyStorage(800000);
@Override
@SuppressWarnings("unchecked")
public void updateEntity(){
super.updateEntity();
if(!this.worldObj.isRemote){
}
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
this.storage.writeToNBT(compound);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.storage.readFromNBT(compound);
}
@Override
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate){
return this.storage.receiveEnergy(maxReceive, simulate);
}
@Override
public int getEnergyStored(ForgeDirection from){
return this.storage.getEnergyStored();
}
@Override
public int getMaxEnergyStored(ForgeDirection from){
return this.storage.getMaxEnergyStored();
}
@Override
public boolean canConnectEnergy(ForgeDirection from){
return true;
}
}