the ferocious miner

This commit is contained in:
Bob 2022-12-26 15:10:24 +01:00
parent d886024f39
commit 55443398e4
22 changed files with 444 additions and 141 deletions

View File

@ -1,5 +1,3 @@
package api.hbm.entity;
public interface IRadiationImmune {
}
public interface IRadiationImmune { }

View File

@ -1018,7 +1018,7 @@ public class ModBlocks {
public static Block machine_excavator;
public static Block machine_mining_laser;
public static Block barricade;
public static Block barricade; // a sand bag that drops nothing, for automated walling purposes
public static final int guiID_mining_laser = 95;
public static Block machine_assembler;

View File

@ -1,7 +1,5 @@
package com.hbm.blocks.machine;
import java.util.Random;
import com.hbm.blocks.ModBlocks;
import com.hbm.lib.RefStrings;
@ -11,7 +9,6 @@ import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
@ -45,70 +42,22 @@ public class BlockRotatable extends Block {
public IIcon getIcon(int side, int metadata) {
return metadata == 0 && side == 3 ? this.iconFront : (side == metadata ? this.iconFront : this.blockIcon);
}
@Override
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
{
return Item.getItemFromBlock(this);
}
@Override
public void onBlockAdded(World world, int x, int y, int z) {
super.onBlockAdded(world, x, y, z);
//this.setDefaultDirection(world, x, y, z);
}
private void setDefaultDirection(World world, int x, int y, int z) {
if(!world.isRemote)
{
Block block1 = world.getBlock(x, y, z - 1);
Block block2 = world.getBlock(x, y, z + 1);
Block block3 = world.getBlock(x - 1, y, z);
Block block4 = world.getBlock(x + 1, y, z);
byte b0 = 3;
if(block1.func_149730_j() && !block2.func_149730_j())
{
b0 = 3;
}
if(block2.func_149730_j() && !block1.func_149730_j())
{
b0 = 2;
}
if(block3.func_149730_j() && !block4.func_149730_j())
{
b0 = 5;
}
if(block4.func_149730_j() && !block3.func_149730_j())
{
b0 = 4;
}
world.setBlockMetadataWithNotify(x, y, z, b0, 2);
}
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
if(i == 0)
{
if(i == 0) {
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
}
if(i == 1)
{
if(i == 1) {
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
}
if(i == 2)
{
if(i == 2) {
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
}
if(i == 3)
{
if(i == 3) {
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
}
}
}

View File

@ -62,7 +62,6 @@ public class CraneInserter extends BlockCraneBase implements IEnterableBlock {
if(te instanceof ISidedInventory) {
ISidedInventory sided = (ISidedInventory) te;
//access = sided.getAccessibleSlotsFromSide(dir.ordinal());
access = masquerade(sided, dir.ordinal());
}
@ -70,47 +69,6 @@ public class CraneInserter extends BlockCraneBase implements IEnterableBlock {
IInventory inv = (IInventory) te;
addToInventory(inv, access, toAdd, dir.ordinal());
/*int limit = inv.getInventoryStackLimit();
int size = access == null ? inv.getSizeInventory() : access.length;
for(int i = 0; i < size; i++) {
int index = access == null ? i : access[i];
ItemStack stack = inv.getStackInSlot(index);
if(stack != null && toAdd.isItemEqual(stack) && ItemStack.areItemStackTagsEqual(toAdd, stack) && stack.stackSize < Math.min(stack.getMaxStackSize(), limit)) {
int stackLimit = Math.min(stack.getMaxStackSize(), limit);
int amount = Math.min(toAdd.stackSize, stackLimit - stack.stackSize);
stack.stackSize += amount;
toAdd.stackSize -= amount;
if(toAdd.stackSize == 0) {
return;
}
}
}
for(int i = 0; i < size; i++) {
int index = access == null ? i : access[i];
ItemStack stack = inv.getStackInSlot(index);
if(stack == null && inv.isItemValidForSlot(index, stack)) {
int amount = Math.min(toAdd.stackSize, limit);
ItemStack newStack = toAdd.copy();
newStack.stackSize = amount;
inv.setInventorySlotContents(index, newStack);
toAdd.stackSize -= amount;
if(toAdd.stackSize == 0) {
return;
}
}
}*/
}
if(toAdd != null && toAdd.stackSize > 0) {

View File

@ -1,11 +1,15 @@
package com.hbm.handler;
import java.util.HashMap;
import com.hbm.blocks.ModBlocks;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ModItems;
import cpw.mods.fml.common.IFuelHandler;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntityFurnace;
public class FuelHandler implements IFuelHandler {
@ -48,5 +52,20 @@ public class FuelHandler implements IFuelHandler {
return 0;
}
private static HashMap<ComparableStack, Integer> burnCache = new HashMap();
public static int getBurnTimeFromCache(ItemStack stack) {
ComparableStack comp = new ComparableStack(stack).makeSingular();
if(burnCache.containsKey(comp)) {
return burnCache.get(comp);
}
int burnTime = TileEntityFurnace.getItemBurnTime(stack);
burnCache.put(comp, burnTime);
return burnTime;
}
}

View File

@ -32,6 +32,9 @@ public class GUIMachineExcavator extends GuiInfoContainer {
@Override
public void drawScreen(int x, int y, float interp) {
super.drawScreen(x, y, interp);
this.drawElectricityInfo(this, x, y, guiLeft + 220, guiTop + 18, 16, 52, drill.getPower(), drill.maxPower);
this.drill.tank.renderTankInfo(this, x, y, guiLeft + 202, guiTop + 18, 16, 52);
}
@Override
@ -68,7 +71,8 @@ public class GUIMachineExcavator extends GuiInfoContainer {
if(drill.enableDrill) {
drawTexturedModalRect(guiLeft + 6, guiTop + 42, 209, 114, 20, 40);
drawTexturedModalRect(guiLeft + 11, guiTop + 5, 209, 104, 10, 10);
if(drill.getInstalledDrill() != null) drawTexturedModalRect(guiLeft + 11, guiTop + 5, 209, 104, 10, 10);
else if(System.currentTimeMillis() % 1000 < 500) drawTexturedModalRect(guiLeft + 11, guiTop + 5, 219, 104, 10, 10);
}
if(drill.enableCrusher) {
@ -83,12 +87,15 @@ public class GUIMachineExcavator extends GuiInfoContainer {
if(drill.enableVeinMiner) {
drawTexturedModalRect(guiLeft + 78, guiTop + 42, 209, 114, 20, 40);
drawTexturedModalRect(guiLeft + 83, guiTop + 5, 209, 104, 10, 10);
if(drill.canVeinMine()) drawTexturedModalRect(guiLeft + 83, guiTop + 5, 209, 104, 10, 10);
else if(System.currentTimeMillis() % 1000 < 500) drawTexturedModalRect(guiLeft + 83, guiTop + 5, 219, 104, 10, 10);
}
if(drill.enableSilkTouch) {
drawTexturedModalRect(guiLeft + 102, guiTop + 42, 209, 114, 20, 40);
drawTexturedModalRect(guiLeft + 107, guiTop + 5, 209, 104, 10, 10);
if(drill.canSilkTouch()) drawTexturedModalRect(guiLeft + 107, guiTop + 5, 209, 104, 10, 10);
else if(System.currentTimeMillis() % 1000 < 500) drawTexturedModalRect(guiLeft + 107, guiTop + 5, 219, 104, 10, 10);
}
}
}

View File

@ -789,6 +789,7 @@ public class ModItems {
public static Item piston_selenium;
public static Item piston_set;
public static Item drillbit;
//public static Item crystal_energy;
//public static Item pellet_coolant;
@ -3248,6 +3249,7 @@ public class ModItems {
piston_selenium = new Item().setUnlocalizedName("piston_selenium").setCreativeTab(MainRegistry.controlTab).setMaxStackSize(1).setTextureName(RefStrings.MODID + ":piston_selenium");
piston_set = new ItemPistons().setUnlocalizedName("piston_set").setCreativeTab(MainRegistry.controlTab).setMaxStackSize(1);
drillbit = new ItemDrillbit().setUnlocalizedName("drillbit").setCreativeTab(MainRegistry.controlTab).setMaxStackSize(1);
//crystal_energy = new ItemCustomLore().setUnlocalizedName("crystal_energy").setCreativeTab(MainRegistry.controlTab).setMaxStackSize(1).setTextureName(RefStrings.MODID + ":crystal_energy");
//pellet_coolant = new ItemCustomLore().setUnlocalizedName("pellet_coolant").setMaxDamage(41400).setCreativeTab(MainRegistry.controlTab).setMaxStackSize(1).setTextureName(RefStrings.MODID + ":pellet_coolant");
@ -6480,6 +6482,7 @@ public class ModItems {
//Engine Pieces
GameRegistry.registerItem(piston_selenium, piston_selenium.getUnlocalizedName());
GameRegistry.registerItem(piston_set, piston_set.getUnlocalizedName());
GameRegistry.registerItem(drillbit, drillbit.getUnlocalizedName());
//Cells
GameRegistry.registerItem(cell_empty, cell_empty.getUnlocalizedName());

View File

@ -0,0 +1,70 @@
package com.hbm.items.machine;
import java.util.List;
import com.hbm.items.ItemEnumMulti;
import com.hbm.util.EnumUtil;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
public class ItemDrillbit extends ItemEnumMulti {
public ItemDrillbit() {
super(EnumDrillType.class, true, true);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister reg) {
Enum[] enums = theEnum.getEnumConstants();
this.icons = new IIcon[enums.length];
for(int i = 0; i < icons.length; i++) {
Enum num = enums[i];
this.icons[i] = reg.registerIcon(this.getIconString() + "_" + num.name().toLowerCase());
}
}
@Override
public String getUnlocalizedName(ItemStack stack) {
Enum num = EnumUtil.grabEnumSafely(theEnum, stack.getItemDamage());
return super.getUnlocalizedName() + "_" + num.name().toLowerCase();
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
EnumDrillType type = EnumUtil.grabEnumSafely(theEnum, stack.getItemDamage());
list.add(EnumChatFormatting.YELLOW + "Speed: " + ((int) (type.speed * 100)) + "%");
list.add(EnumChatFormatting.YELLOW + "Tier: " + type.tier);
if(type.vein) list.add(EnumChatFormatting.GREEN + "Vein miner");
if(type.silk) list.add(EnumChatFormatting.GREEN + "Silk touch");
}
public static enum EnumDrillType {
STEEL (1.0D, 1, false, false),
STEEL_DIAMOND (1.0D, 1, false, true),
HSS (1.5D, 2, true, false),
HSS_DIAMOND (1.5D, 2, true, true),
DESH (2.5D, 3, true, true),
DESH_DIAMOND (2.5D, 3, true, true);
public double speed;
public int tier;
public boolean vein;
public boolean silk;
private EnumDrillType(double speed, int tier, boolean vein, boolean silk) {
this.speed = speed;
this.tier = tier;
this.vein = vein;
this.silk = silk;
}
}
}

View File

@ -512,9 +512,9 @@ public class HbmWorldGen implements IWorldGenerator {
}
if (WorldConfig.meteorStructure > 0 && rand.nextInt(WorldConfig.meteorStructure) == 0) {
int x = i + rand.nextInt(16);
int z = j + rand.nextInt(16);
if (WorldConfig.meteorStructure > 0 && rand.nextInt(WorldConfig.meteorStructure) == 0 && biome != BiomeGenBase.ocean && biome != BiomeGenBase.deepOcean) {
int x = i + rand.nextInt(16) + 8;
int z = j + rand.nextInt(16) + 8;
CellularDungeonFactory.meteor.generate(world, x, 10, z, rand);

View File

@ -6,12 +6,12 @@ import java.util.List;
import com.google.gson.JsonObject;
import com.google.gson.stream.JsonWriter;
import com.hbm.handler.FuelHandler;
import com.hbm.items.ModItems;
import com.hbm.tileentity.IConfigurableMachine;
import com.hbm.util.ItemStackUtil;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraft.util.EnumChatFormatting;
/**
@ -80,7 +80,8 @@ public class ModuleBurnTime {
}
public int getBurnTime(ItemStack stack) {
int fuel = TileEntityFurnace.getItemBurnTime(stack);
//int fuel = TileEntityFurnace.getItemBurnTime(stack);
int fuel = FuelHandler.getBurnTimeFromCache(stack);
if(fuel == 0)
return 0;

View File

@ -1,12 +1,9 @@
package com.hbm.tileentity;
import java.util.ArrayList;
import java.util.List;
import com.hbm.blocks.BlockDummyable;
import com.hbm.inventory.RecipesCommon.AStack;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ModItems;
import com.hbm.items.tool.ItemBlowtorch;
import com.hbm.util.InventoryUtil;
@ -45,13 +42,13 @@ public interface IRepairable {
TileEntity core = world.getTileEntity(pos[0], pos[1], pos[2]);
if(!(core instanceof IRepairable)) return false;
IRepairable tank = (IRepairable) core;
IRepairable repairable = (IRepairable) core;
if(!tank.isDamaged()) return false;
if(!repairable.isDamaged()) return false;
List<AStack> list = new ArrayList();
if(InventoryUtil.doesPlayerHaveAStacks(player, list, true)) {
if(!world.isRemote) tank.repair();
List<AStack> list = repairable.getRepairMaterials();
if(list == null || list.isEmpty() || InventoryUtil.doesPlayerHaveAStacks(player, list, true)) {
if(!world.isRemote) repairable.repair();
return true;
}

View File

@ -1,35 +1,69 @@
package com.hbm.tileentity.machine;
import java.util.List;
import java.util.Random;
import com.hbm.blocks.ModBlocks;
import com.hbm.blocks.network.CraneInserter;
import com.hbm.entity.item.EntityMovingItem;
import com.hbm.interfaces.IControlReceiver;
import com.hbm.inventory.container.ContainerMachineExcavator;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.inventory.gui.GUIMachineExcavator;
import com.hbm.items.machine.ItemDrillbit;
import com.hbm.items.machine.ItemDrillbit.EnumDrillType;
import com.hbm.lib.Library;
import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.TileEntityMachineBase;
import com.hbm.util.EnumUtil;
import api.hbm.conveyor.IConveyorBelt;
import api.hbm.energy.IEnergyUser;
import api.hbm.fluid.IFluidStandardReceiver;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityMachineExcavator extends TileEntityMachineBase implements IControlReceiver, IGUIProvider {
public class TileEntityMachineExcavator extends TileEntityMachineBase implements IEnergyUser, IFluidStandardReceiver, IControlReceiver, IGUIProvider {
public static final long maxPower = 1_000_000;
public long power;
public boolean operational = false;
public boolean enableDrill = false;
public boolean enableCrusher = false;
public boolean enableWalling = false;
public boolean enableVeinMiner = false;
public boolean enableSilkTouch = false;
protected int ticksWorked = 0;
protected int targetDepth = 0; //0 is the first block below null position
public float drillRotation = 0F;
public float prevDrillRotation = 0F;
public float drillExtension = 0F;
public float prevDrillExtension = 0F;
public FluidTank tank;
public TileEntityMachineExcavator() {
super(14);
this.tank = new FluidTank(Fluids.SULFURIC_ACID, 16_000);
}
@Override
@ -42,20 +76,51 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements
if(!worldObj.isRemote) {
this.power = Library.chargeTEFromItems(slots, 0, this.getPower(), this.getMaxPower());
this.operational = false;
if(this.enableDrill && this.getInstalledDrill() != null && this.power >= this.getPowerConsumption()) {
operational = true;
if(targetDepth < this.yCoord - 4 && tryDrill(5)) {
targetDepth++;
}
} else {
this.targetDepth = 0;
}
NBTTagCompound data = new NBTTagCompound();
data.setBoolean("drill", enableDrill);
data.setBoolean("crusher", enableCrusher);
data.setBoolean("walling", enableWalling);
data.setBoolean("veinminer", enableVeinMiner);
data.setBoolean("silktouch", enableSilkTouch);
data.setBoolean("d", enableDrill);
data.setBoolean("c", enableCrusher);
data.setBoolean("w", enableWalling);
data.setBoolean("v", enableVeinMiner);
data.setBoolean("s", enableSilkTouch);
data.setBoolean("o", operational);
data.setInteger("t", targetDepth);
data.setLong("p", power);
this.networkPack(data, 150);
} else {
this.prevDrillExtension = this.drillExtension;
//this.drillExtension += 0.05F;
if(this.drillExtension != this.targetDepth) {
float diff = Math.abs(this.drillExtension - this.targetDepth);
float speed = Math.max(0.15F, diff / 10F);
if(diff <= speed) {
this.drillExtension = this.targetDepth;
} else {
float sig = Math.signum(this.drillExtension - this.targetDepth);
this.drillExtension -= sig * speed;
}
}
this.prevDrillRotation = this.drillRotation;
this.drillRotation += 15F;
if(this.operational)
this.drillRotation += 15F;
if(this.drillRotation >= 360F) {
this.drillRotation -= 360F;
@ -65,11 +130,188 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements
}
public void networkUnpack(NBTTagCompound nbt) {
this.enableDrill = nbt.getBoolean("drill");
this.enableCrusher = nbt.getBoolean("crusher");
this.enableWalling = nbt.getBoolean("walling");
this.enableVeinMiner = nbt.getBoolean("veinminer");
this.enableSilkTouch = nbt.getBoolean("silktouch");
this.enableDrill = nbt.getBoolean("d");
this.enableCrusher = nbt.getBoolean("c");
this.enableWalling = nbt.getBoolean("w");
this.enableVeinMiner = nbt.getBoolean("v");
this.enableSilkTouch = nbt.getBoolean("s");
this.operational = nbt.getBoolean("o");
this.targetDepth = nbt.getInteger("t");
this.power = nbt.getLong("p");
}
protected int getY() {
return yCoord - targetDepth - 4;
}
/** Works outwards and tries to break a ring, returns true if all rings are broken (or ignorable) and the drill should extend. */
protected boolean tryDrill(int radius) {
int y = getY();
if(targetDepth == 0) {
radius = 1;
}
for(int ring = 1; ring <= radius; ring++) {
boolean ignoreAll = true;
float combinedHardness = 0F;
for(int x = xCoord - ring; x <= xCoord + ring; x++) {
for(int z = zCoord - ring; z <= zCoord + ring; z++) {
/* Process blocks either if we are in the inner ring (1 = 3x3) or if the target block is on the outer edge */
if(ring == 1 || (x == xCoord - ring || x == xCoord + ring || z == zCoord - ring || z == zCoord + ring)) {
Block b = worldObj.getBlock(x, y, z);
if(shouldIgnoreBlock(b, x, y ,z)) continue;
ignoreAll = false;
combinedHardness += b.getBlockHardness(worldObj, x, y, z);
}
}
}
if(!ignoreAll) {
ticksWorked++;
int ticksToWork = (int) Math.ceil(combinedHardness);
if(ticksWorked >= ticksToWork) {
breakBlocks(ring);
buildWall(ring + 1, ring == radius && this.enableWalling);
tryCollect(radius);
ticksWorked = 0;
}
return false;
}
}
buildWall(radius + 1, this.enableWalling);
ticksWorked = 0;
return true;
}
/** breaks and drops all blocks in the specified ring */
protected void breakBlocks(int ring) {
int y = getY();
for(int x = xCoord - ring; x <= xCoord + ring; x++) {
for(int z = zCoord - ring; z <= zCoord + ring; z++) {
if(ring == 1 || (x == xCoord - ring || x == xCoord + ring || z == zCoord - ring || z == zCoord + ring)) {
Block b = worldObj.getBlock(x, y, z);
if(!this.shouldIgnoreBlock(b, x, y, z)) {
b.dropBlockAsItem(worldObj, x, y, z, worldObj.getBlockMetadata(x, y, z), 0 /* fortune */);
worldObj.func_147480_a(x, y, z, false);
}
}
}
}
}
/** builds a wall along the specified ring, replacing fluid blocks. if wallEverything is set, it will also wall off replacable blocks like air or grass */
protected void buildWall(int ring, boolean wallEverything) {
int y = getY();
for(int x = xCoord - ring; x <= xCoord + ring; x++) {
for(int z = zCoord - ring; z <= zCoord + ring; z++) {
Block b = worldObj.getBlock(x, y, z);
if(x == xCoord - ring || x == xCoord + ring || z == zCoord - ring || z == zCoord + ring) {
if(b.isReplaceable(worldObj, x, y, z) && (wallEverything || b.getMaterial().isLiquid())) {
worldObj.setBlock(x, y, z, ModBlocks.barricade);
}
} else {
if(b.getMaterial().isLiquid()) {
worldObj.setBlockToAir(x, y, z);
continue;
}
}
}
}
}
/** pulls up an AABB around the drillbit and tries to either conveyor output or buffer collected items */
protected void tryCollect(int radius) {
int yLevel = getY();
List<EntityItem> items = worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(xCoord - radius, yLevel - 1, zCoord - radius, xCoord + radius + 1, yLevel + 2, zCoord + radius + 1));
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10);
int x = xCoord + dir.offsetX * 4;
int y = yCoord - 3;
int z = zCoord + dir.offsetZ * 4;
TileEntity tile = worldObj.getTileEntity(x, y, z);
if(tile instanceof IInventory) {
supplyContainer((IInventory) tile, items, dir.getOpposite());
}
Block b = worldObj.getBlock(x, y, z);
if(b instanceof IConveyorBelt) {
supplyConveyor((IConveyorBelt) b, items, x, y, z);
}
}
/** places all items into a connected container, if possible */
protected void supplyContainer(IInventory inv, List<EntityItem> items, ForgeDirection dir) {
int side = dir.ordinal();
int[] access = null;
if(inv instanceof ISidedInventory) {
ISidedInventory sided = (ISidedInventory) inv;
access = CraneInserter.masquerade(sided, dir.ordinal());
}
for(EntityItem item : items) {
if(item.isDead) continue;
ItemStack stack = CraneInserter.addToInventory(inv, access, item.getEntityItem(), side);
if(stack == null || stack.stackSize == 0) {
item.setDead();
}
}
}
/** moves all items onto a connected conveyor belt */
protected void supplyConveyor(IConveyorBelt belt, List<EntityItem> items, int x, int y, int z) {
Random rand = worldObj.rand;
for(EntityItem item : items) {
if(item.isDead) continue;
Vec3 base = Vec3.createVectorHelper(x + rand.nextDouble(), y + 0.5, z + rand.nextDouble());
Vec3 vec = belt.getClosestSnappingPosition(worldObj, x, y, z, base);
EntityMovingItem moving = new EntityMovingItem(worldObj);
moving.setPosition(base.xCoord, vec.yCoord, base.zCoord);
moving.setItemStack(item.getEntityItem().copy());
worldObj.spawnEntityInWorld(moving);
item.setDead();
}
}
public int getPowerConsumption() {
return 10_000;
}
public boolean shouldIgnoreBlock(Block block, int x, int y, int z) {
return block.isAir(worldObj, x, y, z) || block.getBlockHardness(worldObj, x, y, z) < 0 || block.getMaterial().isLiquid() || block == Blocks.bedrock;
}
@Override
@ -82,6 +324,24 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements
this.markChanged();
}
public EnumDrillType getInstalledDrill() {
if(slots[4] != null && slots[4].getItem() instanceof ItemDrillbit) {
return EnumUtil.grabEnumSafely(EnumDrillType.class, slots[4].getItemDamage());
}
return null;
}
public boolean canVeinMine() {
EnumDrillType type = getInstalledDrill();
return this.enableVeinMiner && type != null && type.vein;
}
public boolean canSilkTouch() {
EnumDrillType type = getInstalledDrill();
return this.enableSilkTouch && type != null && type.silk;
}
@Override
public boolean hasPermission(EntityPlayer player) {
@ -123,4 +383,29 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements
public double getMaxRenderDistanceSquared() {
return 65536.0D;
}
@Override
public long getPower() {
return this.power;
}
@Override
public void setPower(long power) {
this.power = power;
}
@Override
public long getMaxPower() {
return maxPower;
}
@Override
public FluidTank[] getAllTanks() {
return new FluidTank[] {tank};
}
@Override
public FluidTank[] getReceivingTanks() {
return new FluidTank[] {tank};
}
}

View File

@ -1,5 +1,7 @@
package com.hbm.util;
import java.util.HashSet;
import com.hbm.entity.mob.EntityDuck;
import com.hbm.entity.mob.EntityNuclearCreeper;
import com.hbm.entity.mob.EntityQuackos;
@ -55,18 +57,32 @@ public class ContaminationUtil {
return HbmLivingProps.getRadiation(entity);
}
public static HashSet<Class> immuneEntities = new HashSet();
public static boolean isRadImmune(Entity e) {
if(e instanceof EntityLivingBase && ((EntityLivingBase)e).isPotionActive(HbmPotion.mutation))
return true;
return e instanceof EntityNuclearCreeper ||
e instanceof EntityMooshroom ||
e instanceof EntityZombie ||
e instanceof EntitySkeleton ||
e instanceof EntityQuackos ||
e instanceof EntityOcelot ||
e instanceof IRadiationImmune;
if(immuneEntities.isEmpty()) {
immuneEntities.add(EntityNuclearCreeper.class);
immuneEntities.add(EntityMooshroom.class);
immuneEntities.add(EntityZombie.class);
immuneEntities.add(EntitySkeleton.class);
immuneEntities.add(EntityQuackos.class);
immuneEntities.add(EntityOcelot.class);
immuneEntities.add(IRadiationImmune.class);
}
Class entityClass = e.getClass();
for(Class clazz : immuneEntities) {
if(clazz.isAssignableFrom(entityClass)) return true;
}
if("cyano.lootable.entities.EntityLootableBody".equals(entityClass.getName())) return true;
return false;
}
/// ASBESTOS ///

View File

@ -460,7 +460,7 @@ cannery.firebox.4=One such machine is the stirling engine, which will turn heat
cannery.foundryChannel=Foundry Channel
cannery.foundryChannel.0=Foundry channels are used to transport molten material from a crucible or storage tank into molds.
cannery.foundryChannel.1=Channels can receive material either by pouring from the top - via an outlet or directly form a crucible - or from the side from other channels.
cannery.foundryChannel.1=Channels can receive material either by pouring from the top - via an outlet or directly from a crucible - or from the side from other channels.
cannery.foundryChannel.2=When transporting materials, channels will prioritize blocks like outlets and shallow molds.
cannery.foundryChannel.3=When it cannot supply an outlet or a mold, the material will then flow into a neighboring channel.
cannery.foundryChannel.4=Leftover material can be removed by using a shovel.

View File

Before

Width:  |  Height:  |  Size: 388 B

After

Width:  |  Height:  |  Size: 388 B

View File

Before

Width:  |  Height:  |  Size: 385 B

After

Width:  |  Height:  |  Size: 385 B

View File

Before

Width:  |  Height:  |  Size: 414 B

After

Width:  |  Height:  |  Size: 414 B

View File

Before

Width:  |  Height:  |  Size: 395 B

After

Width:  |  Height:  |  Size: 395 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB