Fix OreDrill; fix getting block in ItemList; some changes in addInformation - need check this
This commit is contained in:
parent
19f7074897
commit
75a33be210
9 changed files with 50 additions and 51 deletions
|
@ -684,7 +684,7 @@ public enum ItemList implements IItemContainer {
|
|||
public Block getBlock() {
|
||||
if (mHasNotBeenSet)
|
||||
throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!");
|
||||
return GT_Utility.getBlockFromStack(getItem());
|
||||
return GT_Utility.getBlockFromItem(getItem());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -101,7 +101,7 @@ public class Textures {
|
|||
BASALT_BRICKS_CRACKED, BASALT_BRICKS_MOSSY, BASALT_BRICKS_CHISELED, BASALT_SMOOTH, OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE, OVERLAY_FRONT_HEAT_EXCHANGER, OVERLAY_FRONT_PROCESSING_ARRAY_ACTIVE,
|
||||
OVERLAY_FRONT_PROCESSING_ARRAY, OVERLAY_FRONT_OIL_DRILL_ACTIVE, OVERLAY_FRONT_OIL_DRILL, OVERLAY_FRONT_DIESEL_ENGINE_ACTIVE, OVERLAY_FRONT_DIESEL_ENGINE, OVERLAY_FRONT_PYROLYSE_OVEN_ACTIVE,
|
||||
OVERLAY_FRONT_PYROLYSE_OVEN, OVERLAY_FRONT_OIL_CRACKER_ACTIVE, OVERLAY_FRONT_OIL_CRACKER, OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE, OVERLAY_FRONT_DISTILLATION_TOWER,
|
||||
OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE, OVERLAY_FRONT_ASSEMBLY_LINE, OVERLAY_FRONT_ADVMINER2_ACTIVE, OVERLAY_FRONT_ADVMINER2, OVERLAY_TOP_CLEANROOM_ACTIVE, OVERLAY_TOP_CLEANROOM;
|
||||
OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE, OVERLAY_FRONT_ASSEMBLY_LINE, OVERLAY_FRONT_ORE_DRILL_ACTIVE, OVERLAY_FRONT_ORE_DRILL, OVERLAY_TOP_CLEANROOM_ACTIVE, OVERLAY_TOP_CLEANROOM;
|
||||
|
||||
/**
|
||||
* Icon for Fresh CFoam
|
||||
|
|
|
@ -86,10 +86,10 @@ public abstract class MetaTileEntity implements IMetaTileEntity {
|
|||
GT_LanguageManager.addStringLocalization("gt.blockmachines." + mName + ".name", aRegionalName);
|
||||
mInventory = new ItemStack[aInvSlotCount];
|
||||
|
||||
if (GT.isClientSide()) {
|
||||
ItemStack tStack = new ItemStack(GregTech_API.sBlockMachines, 1, aID);
|
||||
tStack.getItem().addInformation(tStack, null, new ArrayList<String>(), true);
|
||||
}
|
||||
// if (GT.isClientSide()) {
|
||||
// ItemStack tStack = new ItemStack(GregTech_API.sBlockMachines, 1, aID);
|
||||
// tStack.getItem().addInformation(tStack, null, new ArrayList<String>(), true);
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1018,9 +1018,13 @@ public class GT_Utility {
|
|||
return (Block) aBlock;
|
||||
}
|
||||
|
||||
public static Block getBlockFromStack(Object aStack) {
|
||||
if (isStackInvalid(aStack)) return Blocks.air;
|
||||
return Block.getBlockFromItem(((ItemStack) aStack).getItem());
|
||||
public static Block getBlockFromStack(ItemStack itemStack) {
|
||||
if (isStackInvalid(itemStack)) return Blocks.air;
|
||||
return getBlockFromItem(itemStack.getItem());
|
||||
}
|
||||
|
||||
public static Block getBlockFromItem(Item item) {
|
||||
return Block.getBlockFromItem(item);
|
||||
}
|
||||
|
||||
public static boolean isBlockValid(Object aBlock) {
|
||||
|
|
|
@ -33,14 +33,9 @@ public class GT_Item_Machines
|
|||
if ((tDamage <= 0) || (tDamage >= GregTech_API.METATILEENTITIES.length)) {
|
||||
return;
|
||||
}
|
||||
TileEntity temp = GregTech_API.sBlockMachines.createTileEntity(aPlayer == null ? GT_Values.DW : aPlayer.worldObj, GregTech_API.METATILEENTITIES[tDamage] == null ? 0 : GregTech_API.METATILEENTITIES[tDamage].getTileEntityBaseType());
|
||||
temp.setWorldObj(aPlayer == null ? GT_Values.DW : aPlayer.worldObj);
|
||||
temp.xCoord = 0;
|
||||
temp.yCoord = 0;
|
||||
temp.zCoord = 0;
|
||||
if ((temp instanceof IGregTechTileEntity)) {
|
||||
IGregTechTileEntity tTileEntity = (IGregTechTileEntity) temp;
|
||||
tTileEntity.setInitialValuesAsNBT(new NBTTagCompound(), (short) tDamage);
|
||||
|
||||
if (GregTech_API.METATILEENTITIES[tDamage] != null) {
|
||||
IGregTechTileEntity tTileEntity = GregTech_API.METATILEENTITIES[tDamage].getBaseMetaTileEntity();
|
||||
if (tTileEntity.getDescription() != null) {
|
||||
int i = 0;
|
||||
for (String tDescription : tTileEntity.getDescription()) {
|
||||
|
|
|
@ -36,7 +36,7 @@ public class GT_MetaTileEntity_OreDrillingPlant4 extends GT_MetaTileEntity_OreDr
|
|||
|
||||
@Override
|
||||
protected int getCasingTextureIndex() {
|
||||
return 50;
|
||||
return 62;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -45,7 +45,7 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile
|
|||
|
||||
public GT_MetaTileEntity_OreDrillingPlantBase(int aID, String aName, String aNameRegional) {
|
||||
super(aID, aName, aNameRegional);
|
||||
//initFields();
|
||||
initFields();
|
||||
}
|
||||
|
||||
public GT_MetaTileEntity_OreDrillingPlantBase(String aName) {
|
||||
|
@ -54,24 +54,18 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile
|
|||
}
|
||||
|
||||
private void initFields() {
|
||||
xDrill = getBaseMetaTileEntity().getXCoord();
|
||||
yDrill = getBaseMetaTileEntity().getYCoord();
|
||||
zDrill = getBaseMetaTileEntity().getZCoord();
|
||||
back = ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing());
|
||||
xCenter = xDrill + back.offsetX;
|
||||
zCenter = zDrill + back.offsetZ;
|
||||
isPickingPipes = false;
|
||||
casingBlock = getCasingBlockItem().getBlock();
|
||||
casingMeta = getCasingBlockItem().get(0).getItemDamage();
|
||||
frameMeta = 4096 + getFrameMaterial().mMetaItemSubID;
|
||||
int frameId = 4096 + getFrameMaterial().mMetaItemSubID;
|
||||
frameMeta = GregTech_API.METATILEENTITIES[frameId] != null ? GregTech_API.METATILEENTITIES[frameId].getTileEntityBaseType() : W;
|
||||
casingTextureIndex = getCasingTextureIndex();
|
||||
isPickingPipes = false;
|
||||
}
|
||||
|
||||
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
|
||||
if (aSide == aFacing) {
|
||||
return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[16], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ADVMINER2_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ADVMINER2)};
|
||||
}
|
||||
return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[16]};
|
||||
if (aSide == aFacing)
|
||||
return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[casingTextureIndex],new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ORE_DRILL_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ORE_DRILL)};
|
||||
return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[casingTextureIndex]};
|
||||
}
|
||||
|
||||
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
|
||||
|
@ -194,9 +188,7 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile
|
|||
return new ArrayList<ItemStack>() {{
|
||||
add(new ItemStack(oreBlock, 1, blockMeta));
|
||||
}};
|
||||
} else {
|
||||
return oreBlock.getDrops(getBaseMetaTileEntity().getWorld(), posX, posY, posZ, blockMeta, 1);
|
||||
}
|
||||
} else return oreBlock.getDrops(getBaseMetaTileEntity().getWorld(), posX, posY, posZ, blockMeta, 1);
|
||||
}
|
||||
|
||||
private boolean tryConsumeDrillingFluid() {
|
||||
|
@ -234,12 +226,10 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile
|
|||
if (yHead == yDrill) return; //skip controller block layer
|
||||
|
||||
int radius = getRadiusInChunks() << 4;
|
||||
for (int xOff = -radius; xOff <= radius; xOff++) {
|
||||
for (int zOff = -radius; zOff <= radius; zOff++) {
|
||||
for (int xOff = -radius; xOff <= radius; xOff++)
|
||||
for (int zOff = -radius; zOff <= radius; zOff++)
|
||||
tryAddOreBlockToMineList(xDrill + xOff, yHead, zDrill + zOff);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void tryAddOreBlockToMineList(int x, int y, int z) {
|
||||
Block block = getBaseMetaTileEntity().getBlock(x, y, z);
|
||||
|
@ -247,16 +237,14 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile
|
|||
ChunkPosition blockPos = new ChunkPosition(x, y, z);
|
||||
if (block instanceof GT_Block_Ores_Abstract) {
|
||||
TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntity(x, y, z);
|
||||
if (tTileEntity != null && tTileEntity instanceof GT_TileEntity_Ores && ((GT_TileEntity_Ores) tTileEntity).mNatural && !oreBlockPositions.contains(blockPos)) {
|
||||
if (tTileEntity != null && tTileEntity instanceof GT_TileEntity_Ores && ((GT_TileEntity_Ores) tTileEntity).mNatural && !oreBlockPositions.contains(blockPos))
|
||||
oreBlockPositions.add(blockPos);
|
||||
}
|
||||
} else {
|
||||
ItemData association = GT_OreDictUnificator.getAssociation(new ItemStack(block, 1, blockMeta));
|
||||
if (association != null && association.mPrefix.toString().startsWith("ore") && !oreBlockPositions.contains(blockPos)) {
|
||||
if (association != null && association.mPrefix.toString().startsWith("ore") && !oreBlockPositions.contains(blockPos))
|
||||
oreBlockPositions.add(blockPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean moveOneDown() {
|
||||
if (!isHasMiningPipes()) return false;
|
||||
|
@ -282,21 +270,23 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile
|
|||
|
||||
@Override
|
||||
public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
|
||||
updateCoordinates();
|
||||
//check base layer
|
||||
for (int xOff = -1 + back.offsetX; xOff <= 1 + back.offsetX; xOff++) {
|
||||
for (int zOff = -1 + back.offsetZ; zOff <= 1 + back.offsetZ; zOff++) {
|
||||
if (xOff == 0 && zOff == 0) continue;
|
||||
|
||||
IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xOff, 0, zOff);
|
||||
if (addMaintenanceToMachineList(tTileEntity, casingTextureIndex)
|
||||
|| addInputToMachineList(tTileEntity, casingTextureIndex)
|
||||
|| addOutputToMachineList(tTileEntity, casingTextureIndex)
|
||||
|| addEnergyInputToMachineList(tTileEntity, casingTextureIndex))
|
||||
continue;
|
||||
|
||||
if (!checkCasingBlock(xOff, 0, zOff)) return false;
|
||||
if (!checkCasingBlock(xOff, 0, zOff)
|
||||
&& !addMaintenanceToMachineList(tTileEntity, casingTextureIndex)
|
||||
&& !addInputToMachineList(tTileEntity, casingTextureIndex)
|
||||
&& !addOutputToMachineList(tTileEntity, casingTextureIndex)
|
||||
&& !addEnergyInputToMachineList(tTileEntity, casingTextureIndex))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (mMaintenanceHatches.isEmpty() || mInputHatches.isEmpty() || mOutputBusses.isEmpty() || mEnergyHatches.isEmpty()) return false;
|
||||
if (GT_Utility.getTier(getMaxInputVoltage()) < getMinTier()) return false;
|
||||
//check tower
|
||||
for (int yOff = 1; yOff < 4; yOff++) {
|
||||
if (!checkCasingBlock(back.offsetX, yOff, back.offsetZ)
|
||||
|
@ -310,6 +300,15 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile
|
|||
return checkPipesAndSetYHead();
|
||||
}
|
||||
|
||||
private void updateCoordinates() {
|
||||
xDrill = getBaseMetaTileEntity().getXCoord();
|
||||
yDrill = getBaseMetaTileEntity().getYCoord();
|
||||
zDrill = getBaseMetaTileEntity().getZCoord();
|
||||
back = ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing());
|
||||
xCenter = xDrill + back.offsetX;
|
||||
zCenter = zDrill + back.offsetZ;
|
||||
}
|
||||
|
||||
private boolean checkPipesAndSetYHead() {
|
||||
yHead = yDrill - 1;
|
||||
while (checkBlockAndMeta(xCenter, yHead, zCenter, miningPipeBlock, W)) yHead--;
|
||||
|
@ -321,7 +320,7 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile
|
|||
private boolean checkCasingBlock(int xOff, int yOff, int zOff) {
|
||||
return checkBlockAndMetaOffset(xOff, yOff, zOff, casingBlock, casingMeta);
|
||||
}
|
||||
|
||||
//meta of frame is getTileEntityBaseType; frame should be checked using its drops (possible a high weight operation)
|
||||
private boolean checkFrameBlock(int xOff, int yOff, int zOff) {
|
||||
return checkBlockAndMetaOffset(xOff, yOff, zOff, GregTech_API.sBlockMachines, frameMeta);
|
||||
}
|
||||
|
@ -378,7 +377,8 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile
|
|||
"3x1x3 Base of " + casings,
|
||||
"1x3x1 " + casings + " pillar (Center of base)",
|
||||
"1x3x1 " + getFrameMaterial().mName + " Frame Boxes (Each pillar side and on top)",
|
||||
"1x Input Hatch (Any bottom layer casing)",
|
||||
"1x Input Hatch for drilling fluid (Any bottom layer casing)",
|
||||
"1x Input Bus for mining pipes (Any bottom layer casing; not necessary)",
|
||||
"1x Output Bus (Any bottom layer casing)",
|
||||
"1x Maintenance Hatch (Any bottom layer casing)",
|
||||
"1x " + VN[getMinTier()] + "+ Energy Hatch (Any bottom layer casing)"};
|
||||
|
|
Before Width: | Height: | Size: 439 B After Width: | Height: | Size: 439 B |
Before Width: | Height: | Size: 457 B After Width: | Height: | Size: 457 B |
Loading…
Reference in a new issue