finished aux cooling tower, heavily reduced auto mining drill awfulness

This commit is contained in:
Bob 2021-09-15 19:33:07 +02:00
parent a29f1ab8f8
commit d5c77d90b5
10 changed files with 3140 additions and 119 deletions

View File

@ -29,12 +29,12 @@ public class MachineTowerSmall extends BlockDummyable {
@Override @Override
public int[] getDimensions() { public int[] getDimensions() {
return new int[] {12, 0, 1, 1, 1, 1}; return new int[] {18, 0, 2, 2, 2, 2};
} }
@Override @Override
public int getOffset() { public int getOffset() {
return 1; return 2;
} }
@Override @Override
@ -46,7 +46,7 @@ public class MachineTowerSmall extends BlockDummyable {
for(int i = 2; i <= 6; i++) { for(int i = 2; i <= 6; i++) {
ForgeDirection dr2 = ForgeDirection.getOrientation(i); ForgeDirection dr2 = ForgeDirection.getOrientation(i);
this.makeExtra(world, x + dr2.offsetX, y, z + dr2.offsetZ); this.makeExtra(world, x + dr2.offsetX * 2, y, z + dr2.offsetZ * 2);
} }
} }
} }

View File

@ -48,6 +48,8 @@ private TileEntityMachineMiningDrill nukeBoy;
{ {
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142)); this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142));
} }
this.detectAndSendChanges();
} }
@Override @Override
@ -94,12 +96,10 @@ private TileEntityMachineMiningDrill nukeBoy;
public void detectAndSendChanges() { public void detectAndSendChanges() {
super.detectAndSendChanges(); super.detectAndSendChanges();
for(int i = 0; i < this.crafters.size(); i++) for(int i = 0; i < this.crafters.size(); i++) {
{ ICrafting par1 = (ICrafting) this.crafters.get(i);
ICrafting par1 = (ICrafting)this.crafters.get(i);
if(this.warning != this.nukeBoy.warning) {
if(this.warning != this.nukeBoy.warning)
{
par1.sendProgressBarUpdate(this, 1, this.nukeBoy.warning); par1.sendProgressBarUpdate(this, 1, this.nukeBoy.warning);
} }
} }
@ -109,8 +109,7 @@ private TileEntityMachineMiningDrill nukeBoy;
@Override @Override
public void updateProgressBar(int i, int j) { public void updateProgressBar(int i, int j) {
if(i == 1) if(i == 1) {
{
nukeBoy.warning = j; nukeBoy.warning = j;
} }
} }

View File

@ -63,7 +63,7 @@ public class GUIScreenTemplateFolder extends GuiScreen {
allStacks.add(new ItemStack(ModItems.siren_track, 1, i)); allStacks.add(new ItemStack(ModItems.siren_track, 1, i));
// Fluid IDs // Fluid IDs
for(int i = 1; i < FluidType.values().length; i++) for(int i = 1; i < FluidType.values().length; i++)
if(!FluidType.values()[i].hasNoContainer()) if(!FluidType.values()[i].hasNoID())
allStacks.add(new ItemStack(ModItems.fluid_identifier, 1, i)); allStacks.add(new ItemStack(ModItems.fluid_identifier, 1, i));
// Assembly Templates // Assembly Templates
for(int i = 0; i < AssemblerRecipes.recipeList.size(); i++) for(int i = 0; i < AssemblerRecipes.recipeList.size(); i++)

View File

@ -190,6 +190,7 @@ public class ClientProxy extends ServerProxy {
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityStorageDrum.class, new RenderStorageDrum()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityStorageDrum.class, new RenderStorageDrum());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityChungus.class, new RenderChungus()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityChungus.class, new RenderChungus());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTowerLarge.class, new RenderLargeTower()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTowerLarge.class, new RenderLargeTower());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTowerSmall.class, new RenderSmallTower());
//AMS //AMS
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAMSBase.class, new RenderAMSBase()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAMSBase.class, new RenderAMSBase());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAMSEmitter.class, new RenderAMSEmitter()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAMSEmitter.class, new RenderAMSEmitter());

View File

@ -88,6 +88,7 @@ public class ResourceManager {
public static final IModelCustom chungus = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/chungus.obj")); public static final IModelCustom chungus = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/chungus.obj"));
//Cooling Tower //Cooling Tower
public static final IModelCustom tower_small = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/tower_small.obj"));
public static final IModelCustom tower_large = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/tower_large.obj")); public static final IModelCustom tower_large = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/tower_large.obj"));
//IGen //IGen
@ -353,6 +354,7 @@ public class ResourceManager {
public static final ResourceLocation chungus_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/chungus.png"); public static final ResourceLocation chungus_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/chungus.png");
//Cooling Tower //Cooling Tower
public static final ResourceLocation tower_small_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/tower_small.png");
public static final ResourceLocation tower_large_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/tower_large.png"); public static final ResourceLocation tower_large_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/tower_large.png");
//IGen //IGen

View File

@ -0,0 +1,28 @@
package com.hbm.render.tileentity;
import org.lwjgl.opengl.GL11;
import com.hbm.main.ResourceManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
public class RenderSmallTower extends TileEntitySpecialRenderer {
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) {
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5D, y, z + 0.5D);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glShadeModel(GL11.GL_SMOOTH);
bindTexture(ResourceManager.tower_small_tex);
ResourceManager.tower_small.renderAll();
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glPopMatrix();
}
}

View File

@ -27,11 +27,8 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.tileentity.TileEntityHopper;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
@Spaghetti("if i had a time machine i'd go back to the year 2017 and uppercut myself")
public class TileEntityMachineMiningDrill extends TileEntityMachineBase implements IConsumer, IMiningDrill { public class TileEntityMachineMiningDrill extends TileEntityMachineBase implements IConsumer, IMiningDrill {
public long power; public long power;
@ -47,11 +44,6 @@ public class TileEntityMachineMiningDrill extends TileEntityMachineBase implemen
public float rotation; public float rotation;
SoundLoopMachine sound; SoundLoopMachine sound;
private static final int[] slots_top = new int[] {1};
private static final int[] slots_bottom = new int[] {2, 0};
private static final int[] slots_side = new int[] {0};
Random rand = new Random();
public TileEntityMachineMiningDrill() { public TileEntityMachineMiningDrill() {
super(13); super(13);
} }
@ -76,23 +68,15 @@ public class TileEntityMachineMiningDrill extends TileEntityMachineBase implemen
@Override @Override
public void readFromNBT(NBTTagCompound nbt) { public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt); super.readFromNBT(nbt);
this.power = nbt.getLong("power");
this.power = nbt.getLong("powerTime");
} }
@Override @Override
public void writeToNBT(NBTTagCompound nbt) { public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt); super.writeToNBT(nbt);
nbt.setLong("power", power);
nbt.setLong("powerTime", power);
} }
@Override
public int[] getAccessibleSlotsFromSide(int p_94128_1_)
{
return p_94128_1_ == 0 ? slots_bottom : (p_94128_1_ == 1 ? slots_top : slots_side);
}
public long getPowerScaled(long i) { public long getPowerScaled(long i) {
return (power * i) / maxPower; return (power * i) / maxPower;
} }
@ -100,29 +84,30 @@ public class TileEntityMachineMiningDrill extends TileEntityMachineBase implemen
@Override @Override
public void updateEntity() { public void updateEntity() {
this.consumption = 100;
this.timer = 50;
this.radius = 1;
this.fortune = 0;
UpgradeManager.eval(slots, 10, 12);
this.radius += Math.min(UpgradeManager.getLevel(UpgradeType.EFFECT), 3);
this.consumption += Math.min(UpgradeManager.getLevel(UpgradeType.EFFECT), 3) * 80;
this.timer -= Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3) * 15;
this.consumption += Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3) * 300;
this.consumption -= Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3) * 30;
this.timer += Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3) * 5;
this.fortune += Math.min(UpgradeManager.getLevel(UpgradeType.FORTUNE), 3);
this.timer += Math.min(UpgradeManager.getLevel(UpgradeType.FORTUNE), 3) * 15;
age++;
if(age >= timer)
age -= timer;
if(!worldObj.isRemote) { if(!worldObj.isRemote) {
this.consumption = 100;
this.timer = 50;
this.radius = 1;
this.fortune = 0;
UpgradeManager.eval(slots, 10, 12);
this.radius += Math.min(UpgradeManager.getLevel(UpgradeType.EFFECT), 3);
this.consumption += Math.min(UpgradeManager.getLevel(UpgradeType.EFFECT), 3) * 80;
this.timer -= Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3) * 15;
this.consumption += Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3) * 300;
this.consumption -= Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3) * 30;
this.timer += Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3) * 5;
this.fortune += Math.min(UpgradeManager.getLevel(UpgradeType.FORTUNE), 3);
this.timer += Math.min(UpgradeManager.getLevel(UpgradeType.FORTUNE), 3) * 15;
age++;
if(age >= timer)
age -= timer;
power = Library.chargeTEFromItems(slots, 0, power, maxPower); power = Library.chargeTEFromItems(slots, 0, power, maxPower);
if(power >= consumption) { if(power >= consumption) {
@ -138,48 +123,30 @@ public class TileEntityMachineMiningDrill extends TileEntityMachineBase implemen
for(int i = this.yCoord - 1; i > this.yCoord - 1 - 100; i--) { for(int i = this.yCoord - 1; i > this.yCoord - 1 - 100; i--) {
if(i <= 5) { if(i <= 3) {
//Code 2: The drilling ended //Code 2: The drilling ended
warning = 2; warning = 2;
break; break;
} }
Block b = worldObj.getBlock(this.xCoord, i, this.zCoord);
Block b1 = worldObj.getBlock(this.xCoord, i - 1, this.zCoord);
int meta = worldObj.getBlockMetadata(this.xCoord, i, this.zCoord);
int meta1 = worldObj.getBlockMetadata(this.xCoord, i - 1, this.zCoord);
ItemStack stack = new ItemStack(b.getItemDropped(meta, rand, fortune), b.quantityDropped(meta, fortune, rand), b.damageDropped(meta));
ItemStack stack1 = new ItemStack(b1.getItemDropped(meta1, rand, fortune), b1.quantityDropped(meta1, fortune, rand), b1.damageDropped(meta1));
if(i == this.yCoord - 1 && worldObj.getBlock(this.xCoord, i, this.zCoord) != ModBlocks.drill_pipe) { if(worldObj.getBlock(xCoord, i, zCoord) != ModBlocks.drill_pipe) {
if(this.tryDrill(xCoord, i, zCoord) || worldObj.getBlock(xCoord, i, zCoord).isReplaceable(worldObj, xCoord, i, zCoord)) {
worldObj.setBlock(this.xCoord, i, this.zCoord, ModBlocks.drill_pipe);
break;
} else {
//Code 2: Drill jammed
warning = 1;
break;
}
}
if(b1 == ModBlocks.drill_pipe) {
continue;
} else {
flag = i != this.yCoord - 1; if(worldObj.getBlock(xCoord, i, zCoord).isReplaceable(worldObj, xCoord, i, zCoord) || this.tryDrill(xCoord, i, zCoord)) {
if(!this.drill(this.xCoord, i, this.zCoord, radius)) { if(worldObj.getBlock(xCoord, i, zCoord).isReplaceable(worldObj, xCoord, i, zCoord)) {
if(this.isOreo(this.xCoord, i - 1, this.zCoord) && this.hasSpace(stack1)) { worldObj.setBlock(xCoord, i, zCoord, ModBlocks.drill_pipe);
worldObj.setBlock(this.xCoord, i - 1, this.zCoord, ModBlocks.drill_pipe);
} else {
//Code 2: Drill jammed
warning = 1;
} }
break;
} else {
this.warning = 1;
break;
} }
break;
} }
if(this.drill(xCoord, i, zCoord, radius))
break;
} }
} }
@ -209,38 +176,14 @@ public class TileEntityMachineMiningDrill extends TileEntityMachineBase implemen
//worldObj.setBlock(xCoord - 2, yCoord, zCoord, Blocks.dirt); //worldObj.setBlock(xCoord - 2, yCoord, zCoord, Blocks.dirt);
} }
if(te != null && te instanceof TileEntityChest) { if(te != null && te instanceof IInventory) {
TileEntityChest chest = (TileEntityChest)te; IInventory chest = (IInventory)te;
for(int i = 1; i < 10; i++) for(int i = 1; i < 10; i++)
if(tryFillContainer(chest, i)) if(tryFillContainer(chest, i))
break; break;
} }
if(te != null && te instanceof TileEntityHopper) {
TileEntityHopper hopper = (TileEntityHopper)te;
for(int i = 1; i < 10; i++)
if(tryFillContainer(hopper, i))
break;
}
if(te != null && te instanceof TileEntityCrateIron) {
TileEntityCrateIron hopper = (TileEntityCrateIron)te;
for(int i = 1; i < 10; i++)
if(tryFillContainer(hopper, i))
break;
}
if(te != null && te instanceof TileEntityCrateSteel) {
TileEntityCrateSteel hopper = (TileEntityCrateSteel)te;
for(int i = 1; i < 10; i++)
if(tryFillContainer(hopper, i))
break;
}
if(warning == 0) { if(warning == 0) {
torque += 0.1; torque += 0.1;
if(torque > (100/timer)) if(torque > (100/timer))
@ -386,7 +329,7 @@ public class TileEntityMachineMiningDrill extends TileEntityMachineBase implemen
return true; //true because the block is still there and mining should continue return true; //true because the block is still there and mining should continue
} }
ItemStack stack = new ItemStack(b.getItemDropped(meta, rand, fortune), b.quantityDropped(meta, fortune, rand), b.damageDropped(meta)); ItemStack stack = new ItemStack(b.getItemDropped(meta, worldObj.rand, fortune), b.quantityDropped(meta, fortune, worldObj.rand), b.damageDropped(meta));
//yup that worked //yup that worked
if(stack != null && stack.getItem() == null) { if(stack != null && stack.getItem() == null) {

View File

@ -5,7 +5,6 @@ import com.hbm.inventory.FluidTank;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
@ -22,7 +21,7 @@ public class TileEntityTowerSmall extends TileEntityCondenser {
for(int i = 2; i <= 6; i++) { for(int i = 2; i <= 6; i++) {
ForgeDirection dir = ForgeDirection.getOrientation(i); ForgeDirection dir = ForgeDirection.getOrientation(i);
fillFluid(xCoord + dir.offsetX * 2, yCoord, zCoord + dir.offsetZ * 2, getTact(), type); fillFluid(xCoord + dir.offsetX * 3, yCoord, zCoord + dir.offsetZ * 3, getTact(), type);
} }
} }
@ -33,12 +32,12 @@ public class TileEntityTowerSmall extends TileEntityCondenser {
if(bb == null) { if(bb == null) {
bb = AxisAlignedBB.getBoundingBox( bb = AxisAlignedBB.getBoundingBox(
xCoord - 1, xCoord - 2,
yCoord, yCoord,
zCoord - 1, zCoord - 2,
xCoord + 2, xCoord + 3,
yCoord + 13, yCoord + 20,
zCoord + 2 zCoord + 3
); );
} }

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 16 KiB