Merge branch 'HbmMods:master' into master

This commit is contained in:
George Paton 2024-02-02 16:52:17 +11:00 committed by GitHub
commit 25e01b3742
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
36 changed files with 865 additions and 225 deletions

View File

@ -10,4 +10,9 @@
* If I see one more person complaining about the chances I'm reducing it down to 10%
* Catalytic reformers now have a tooltip informing about the need for a catalytic converter
* Several guns now have reload animations including most .357 revolvers and Samuel
* Updated stealth missile texture
* Updated stealth missile texture
* Some of the larger oil machines now render using display lists which should make them somewhat more performant
* Glyphid diggers can no longer yeet multiblocks or blocks with tile entity
## Fixed
* Fixed dupe caused by shift-clicking ashes out of the bricked furnace

View File

@ -987,6 +987,7 @@ public class ModBlocks {
public static Block fraction_spacer;
public static Block machine_catalytic_cracker;
public static Block machine_catalytic_reformer;
public static Block machine_hydrotreater;
public static Block machine_coker;
public static Block machine_boiler_off;
@ -2253,6 +2254,7 @@ public class ModBlocks {
fraction_spacer = new FractionSpacer(Material.iron).setBlockName("fraction_spacer").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
machine_catalytic_cracker = new MachineCatalyticCracker(Material.iron).setBlockName("machine_catalytic_cracker").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
machine_catalytic_reformer = new MachineCatalyticReformer(Material.iron).setBlockName("machine_catalytic_reformer").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
machine_hydrotreater = new MachineHydrotreater(Material.iron).setBlockName("machine_hydrotreater").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
machine_coker = new MachineCoker(Material.iron).setBlockName("machine_coker").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
machine_autosaw = new MachineAutosaw().setBlockName("machine_autosaw").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
machine_excavator = new MachineExcavator().setBlockName("machine_excavator").setHardness(5.0F).setResistance(100.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
@ -3361,6 +3363,7 @@ public class ModBlocks {
register(fraction_spacer);
register(machine_catalytic_cracker);
register(machine_catalytic_reformer);
register(machine_hydrotreater);
register(machine_coker);
register(machine_autosaw);
register(machine_excavator);

View File

@ -6,6 +6,15 @@ import java.util.function.Function;
import com.hbm.blocks.IBlockMulti;
import com.hbm.config.MobConfig;
import com.hbm.entity.mob.*;
import com.hbm.entity.mob.glyphid.EntityGlyphid;
import com.hbm.entity.mob.glyphid.EntityGlyphidBehemoth;
import com.hbm.entity.mob.glyphid.EntityGlyphidBlaster;
import com.hbm.entity.mob.glyphid.EntityGlyphidBombardier;
import com.hbm.entity.mob.glyphid.EntityGlyphidBrawler;
import com.hbm.entity.mob.glyphid.EntityGlyphidBrenda;
import com.hbm.entity.mob.glyphid.EntityGlyphidDigger;
import com.hbm.entity.mob.glyphid.EntityGlyphidNuclear;
import com.hbm.entity.mob.glyphid.EntityGlyphidScout;
import com.hbm.handler.pollution.PollutionHandler;
import com.hbm.handler.pollution.PollutionHandler.PollutionType;
import com.hbm.items.ModItems;

View File

@ -0,0 +1,43 @@
package com.hbm.blocks.machine;
import com.hbm.blocks.BlockDummyable;
import com.hbm.tileentity.TileEntityProxyCombo;
import com.hbm.tileentity.machine.oil.TileEntityMachineHydrotreater;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class MachineHydrotreater extends BlockDummyable {
public MachineHydrotreater(Material mat) {
super(mat);
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
if(meta >= 12) return new TileEntityMachineHydrotreater();
if(meta >= 6) return new TileEntityProxyCombo().fluid().power();
return null;
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
return standardOpenBehavior(world, x, y, z, player, side);
}
@Override public int[] getDimensions() { return new int[] {6, 0, 1, 1, 1, 1}; }
@Override public int getOffset() { return 1; }
@Override
protected void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
super.fillSpace(world, x, y, z, dir, o);
this.makeExtra(world, x - dir.offsetX + 1, y, z - dir.offsetZ + 1);
this.makeExtra(world, x - dir.offsetX + 1, y, z - dir.offsetZ - 1);
this.makeExtra(world, x - dir.offsetX - 1, y, z - dir.offsetZ + 1);
this.makeExtra(world, x - dir.offsetX - 1, y, z - dir.offsetZ - 1);
}
}

View File

@ -16,6 +16,15 @@ import com.hbm.entity.missile.EntityMissileTier3.*;
import com.hbm.entity.missile.EntityMissileTier4.*;
import com.hbm.entity.mob.*;
import com.hbm.entity.mob.botprime.*;
import com.hbm.entity.mob.glyphid.EntityGlyphid;
import com.hbm.entity.mob.glyphid.EntityGlyphidBehemoth;
import com.hbm.entity.mob.glyphid.EntityGlyphidBlaster;
import com.hbm.entity.mob.glyphid.EntityGlyphidBombardier;
import com.hbm.entity.mob.glyphid.EntityGlyphidBrawler;
import com.hbm.entity.mob.glyphid.EntityGlyphidBrenda;
import com.hbm.entity.mob.glyphid.EntityGlyphidDigger;
import com.hbm.entity.mob.glyphid.EntityGlyphidNuclear;
import com.hbm.entity.mob.glyphid.EntityGlyphidScout;
import com.hbm.entity.mob.siege.*;
import com.hbm.entity.particle.*;
import com.hbm.entity.projectile.*;

View File

@ -2,7 +2,7 @@ package com.hbm.entity.effect;
import java.util.List;
import com.hbm.entity.mob.EntityGlyphid;
import com.hbm.entity.mob.glyphid.EntityGlyphid;
import com.hbm.extprop.HbmLivingProps;
import com.hbm.handler.radiation.ChunkRadiationManager;
import com.hbm.inventory.fluid.FluidType;

View File

@ -1,16 +1,17 @@
package com.hbm.entity.logic;
import com.hbm.config.MobConfig;
import com.hbm.entity.mob.EntityGlyphid;
import static com.hbm.entity.mob.EntityGlyphid.*;
import com.hbm.entity.mob.EntityGlyphidNuclear;
import com.hbm.entity.mob.EntityGlyphidScout;
import com.hbm.entity.mob.glyphid.EntityGlyphid;
import com.hbm.entity.mob.glyphid.EntityGlyphidNuclear;
import com.hbm.entity.mob.glyphid.EntityGlyphidScout;
import com.hbm.main.MainRegistry;
import net.minecraft.entity.Entity;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import static com.hbm.entity.mob.glyphid.EntityGlyphid.*;
import java.util.List;
public class EntityWaypoint extends Entity {

View File

@ -1,4 +1,4 @@
package com.hbm.entity.mob;
package com.hbm.entity.mob.glyphid;
import java.util.Arrays;
import java.util.Collections;
@ -7,6 +7,7 @@ import java.util.List;
import com.hbm.blocks.ModBlocks;
import com.hbm.config.MobConfig;
import com.hbm.entity.logic.EntityWaypoint;
import com.hbm.entity.mob.EntityParasiteMaggot;
import com.hbm.entity.pathfinder.PathFinderUtils;
import com.hbm.explosion.vanillant.ExplosionVNT;
import com.hbm.explosion.vanillant.standard.*;
@ -114,9 +115,17 @@ public class EntityGlyphid extends EntityMob {
@Override
protected void applyEntityAttributes() {
super.applyEntityAttributes();
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(30D);
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1D);
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(5D);
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(GlyphidStats.getStats().getGrunt().health);
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(GlyphidStats.getStats().getGrunt().speed);
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(GlyphidStats.getStats().getGrunt().damage);
}
public int getDivisorPerArmorPoint() {
return GlyphidStats.getStats().getGrunt().divisor;
}
public float getDamageThreshold() {
return GlyphidStats.getStats().getGrunt().damageThreshold;
}
@Override
@ -290,43 +299,9 @@ public class EntityGlyphid extends EntityMob {
if(source.getEntity() instanceof EntityGlyphid) {
return false;
}
if(!source.isDamageAbsolute() && !source.isUnblockable() && !worldObj.isRemote && !source.isFireDamage() && !source.getDamageType().equals(ModDamageSource.s_cryolator)) {
byte armor = this.dataWatcher.getWatchableObjectByte(DW_ARMOR);
if(armor != 0) { //if at least one bit of armor is present
if(amount < getDamageThreshold()) return false;
//chances of armor being broken off
if(amount > 1 && isArmorBroken(amount)) {
breakOffArmor();
amount *= 0.25F;
}
amount -= getDamageThreshold();
if(amount < 0) return true;
}
amount = this.calculateDamage(amount);
}
if(source.isFireDamage()) {
amount *= 0.7F;
} else if(source.getDamageType().equals("player")) {
amount *= getScale() < 1.25 ? 1.5 : getScale() < 1.3 ? 0.8 : 0.5;
} else if(source == ModDamageSource.acid || source.equals(new DamageSource(ModDamageSource.s_acid))){
amount = 0;
} else if(source == DamageSource.inWall) {
amount *= 15F;
}
if(this.isPotionActive(HbmPotion.phosphorus.getId())){
amount *= 1.5F;
}
boolean alive = this.getHealth() > 0;
boolean wasAttacked = super.attackEntityFrom(source, amount);
boolean wasAttacked = GlyphidStats.getStats().handleAttack(this, source, amount);
if(alive && this.getHealth() <= 0) {
if(doesInfectedSpawnMaggots() && this.dataWatcher.getWatchableObjectByte(DW_SUBTYPE) == TYPE_INFECTED) {
@ -348,6 +323,11 @@ public class EntityGlyphid extends EntityMob {
return wasAttacked;
}
/** Provides a direct entrypoint from outside to access the superclass' implementation because otherwise we end up wwith infinite recursion */
public boolean attackSuperclass(DamageSource source, float amount) {
return super.attackEntityFrom(source, amount);
}
public boolean doesInfectedSpawnMaggots() {
return true;
@ -364,7 +344,7 @@ public class EntityGlyphid extends EntityMob {
for(int i = 0; i < 5; i++) {
if((armor & (1 << i)) > 0) {
divisor++;
divisor += getDivisorPerArmorPoint();
}
}
@ -373,10 +353,6 @@ public class EntityGlyphid extends EntityMob {
return amount;
}
public float getDamageThreshold() {
return 0.5F;
}
public void breakOffArmor() {
byte armor = this.dataWatcher.getWatchableObjectByte(DW_ARMOR);
List<Integer> indices = Arrays.asList(0, 1, 2, 3, 4);

View File

@ -1,4 +1,4 @@
package com.hbm.entity.mob;
package com.hbm.entity.mob.glyphid;
import com.hbm.entity.effect.EntityMist;
import com.hbm.entity.projectile.EntityChemical;
@ -36,10 +36,14 @@ public class EntityGlyphidBehemoth extends EntityGlyphid {
@Override
protected void applyEntityAttributes() {
super.applyEntityAttributes();
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(130D);
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.8D);
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(25D);
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(GlyphidStats.getStats().getBehemoth().health);
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(GlyphidStats.getStats().getBehemoth().speed);
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(GlyphidStats.getStats().getBehemoth().damage);
}
@Override public int getDivisorPerArmorPoint() { return GlyphidStats.getStats().getBehemoth().divisor; }
@Override public float getDamageThreshold() { return GlyphidStats.getStats().getBehemoth().damageThreshold; }
public int timer = 120;
int breathTime = 0;
@ -63,11 +67,6 @@ public class EntityGlyphidBehemoth extends EntityGlyphid {
timer = 120;
}
}
}
@Override
public boolean attackEntityAsMob(Entity victum) {
return super.attackEntityAsMob(victum);
}
@Override
@ -108,25 +107,4 @@ public class EntityGlyphidBehemoth extends EntityGlyphid {
public int swingDuration() {
return 100;
}
@Override
public float calculateDamage(float amount) {
byte armor = this.dataWatcher.getWatchableObjectByte(17);
int divisor = 1;
for(int i = 0; i < 5; i++) {
if((armor & (1 << i)) > 0) {
divisor += 4;
}
}
amount /= divisor;
return amount;
}
@Override
public float getDamageThreshold() {
return 2.5F;
}
}

View File

@ -1,4 +1,4 @@
package com.hbm.entity.mob;
package com.hbm.entity.mob.glyphid;
import com.hbm.main.ResourceManager;
@ -26,38 +26,19 @@ public class EntityGlyphidBlaster extends EntityGlyphidBombardier {
@Override
protected void applyEntityAttributes() {
super.applyEntityAttributes();
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(50D);
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1D);
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(10D);
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(GlyphidStats.getStats().getBlaster().health);
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(GlyphidStats.getStats().getBlaster().speed);
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(GlyphidStats.getStats().getBlaster().damage);
}
@Override public int getDivisorPerArmorPoint() { return GlyphidStats.getStats().getBlaster().divisor; }
@Override public float getDamageThreshold() { return GlyphidStats.getStats().getBlaster().damageThreshold; }
@Override
public boolean isArmorBroken(float amount) {
return this.rand.nextInt(100) <= Math.min(Math.pow(amount * 0.25, 2), 100);
}
@Override
public float calculateDamage(float amount) {
byte armor = this.dataWatcher.getWatchableObjectByte(17);
int divisor = 1;
for(int i = 0; i < 5; i++) {
if((armor & (1 << i)) > 0) {
divisor += 2;
}
}
amount /= divisor;
return amount;
}
@Override
public float getDamageThreshold() {
return 1.0F;
}
@Override
public float getBombDamage() {
return 15F;

View File

@ -1,4 +1,4 @@
package com.hbm.entity.mob;
package com.hbm.entity.mob.glyphid;
import com.hbm.entity.projectile.EntityAcidBomb;
import com.hbm.main.ResourceManager;
@ -28,9 +28,14 @@ public class EntityGlyphidBombardier extends EntityGlyphid {
@Override
protected void applyEntityAttributes() {
super.applyEntityAttributes();
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20D);
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(GlyphidStats.getStats().getBombardier().health);
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(GlyphidStats.getStats().getBombardier().speed);
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(GlyphidStats.getStats().getBombardier().damage);
}
@Override public int getDivisorPerArmorPoint() { return GlyphidStats.getStats().getBombardier().divisor; }
@Override public float getDamageThreshold() { return GlyphidStats.getStats().getBombardier().damageThreshold; }
@Override
public void onUpdate() {
super.onUpdate();

View File

@ -1,4 +1,4 @@
package com.hbm.entity.mob;
package com.hbm.entity.mob.glyphid;
import com.hbm.main.ResourceManager;
@ -26,35 +26,16 @@ public class EntityGlyphidBrawler extends EntityGlyphid {
@Override
protected void applyEntityAttributes() {
super.applyEntityAttributes();
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(50D);
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1D);
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(10D);
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(GlyphidStats.getStats().getBrawler().health);
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(GlyphidStats.getStats().getBrawler().speed);
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(GlyphidStats.getStats().getBrawler().damage);
}
@Override public int getDivisorPerArmorPoint() { return GlyphidStats.getStats().getBrawler().divisor; }
@Override public float getDamageThreshold() { return GlyphidStats.getStats().getBrawler().damageThreshold; }
@Override
public boolean isArmorBroken(float amount) {
return this.rand.nextInt(100) <= Math.min(Math.pow(amount * 0.25, 2), 100);
}
@Override
public float calculateDamage(float amount) {
byte armor = this.dataWatcher.getWatchableObjectByte(17);
float divisor = 1;
for(int i = 0; i < 5; i++) {
if((armor & (1 << i)) > 0) {
divisor += 3;
}
}
amount /= divisor;
return amount;
}
@Override
public float getDamageThreshold() {
return 1.0F;
}
}

View File

@ -1,4 +1,4 @@
package com.hbm.entity.mob;
package com.hbm.entity.mob.glyphid;
import com.hbm.entity.effect.EntityMist;
import com.hbm.inventory.fluid.Fluids;
@ -32,39 +32,20 @@ public class EntityGlyphidBrenda extends EntityGlyphid {
@Override
protected void applyEntityAttributes() {
super.applyEntityAttributes();
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(250D);
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.2D);
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(50D);
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(GlyphidStats.getStats().getBrenda().health);
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(GlyphidStats.getStats().getBrenda().speed);
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(GlyphidStats.getStats().getBrenda().damage);
}
@Override public int getDivisorPerArmorPoint() { return GlyphidStats.getStats().getBrenda().divisor; }
@Override public float getDamageThreshold() { return GlyphidStats.getStats().getBrenda().damageThreshold; }
@Override
public boolean isArmorBroken(float amount) {
// amount < 5 ? 5 : amount < 10 ? 3 : 2;
return this.rand.nextInt(100) <= Math.min(Math.pow(amount * 0.12, 2), 100);
}
@Override
public float calculateDamage(float amount) {
byte armor = this.dataWatcher.getWatchableObjectByte(17);
int divisor = 1;
for(int i = 0; i < 5; i++) {
if((armor & (1 << i)) > 0) {
divisor += 5;
}
}
amount /= divisor;
return amount;
}
@Override
public float getDamageThreshold() {
return 10F;
}
@Override
public void onDeath(DamageSource source) {
super.onDeath(source);

View File

@ -1,5 +1,6 @@
package com.hbm.entity.mob;
package com.hbm.entity.mob.glyphid;
import com.hbm.blocks.BlockDummyable;
import com.hbm.blocks.ModBlocks;
import com.hbm.entity.projectile.EntityRubble;
import com.hbm.lib.Library;
@ -38,17 +39,21 @@ public class EntityGlyphidDigger extends EntityGlyphid {
@Override
protected void applyEntityAttributes() {
super.applyEntityAttributes();
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(50D);
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1D);
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(5D);
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(GlyphidStats.getStats().getDigger().health);
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(GlyphidStats.getStats().getDigger().speed);
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(GlyphidStats.getStats().getDigger().damage);
}
@Override public int getDivisorPerArmorPoint() { return GlyphidStats.getStats().getDigger().divisor; }
@Override public float getDamageThreshold() { return GlyphidStats.getStats().getDigger().damageThreshold; }
public int timer = 0;
@Override
public void onUpdate(){
super.onUpdate();
Entity e = this.getEntityToAttack();
if (e != null) {
if (e != null && this.isEntityAlive()) {
this.lastX = e.posX;
this.lastY = e.posY;
@ -60,9 +65,8 @@ public class EntityGlyphidDigger extends EntityGlyphid {
}
}
}
/**
* Mainly composed of crusty old power fist code, with some touch ups
**/
/** Mainly composed of crusty old power fist code, with some touch ups **/
public void groundSlam(){
if (!worldObj.isRemote && entityToAttack instanceof EntityLivingBase && this.getDistanceToEntity(entityToAttack) < 30) {
Entity e = this.getEntityToAttack();
@ -128,7 +132,7 @@ public class EntityGlyphidDigger extends EntityGlyphid {
Block b = worldObj.getBlock(x1, y1, z1);
float k = b.getExplosionResistance(this, worldObj, x1, y1, z1, posX, posY, posZ);
if (k < ModBlocks.concrete.getExplosionResistance(this) && b.isNormalCube()) {
if (k < ModBlocks.concrete.getExplosionResistance(this) && b.isNormalCube() && !(b instanceof BlockDummyable) && worldObj.getTileEntity(x1, y1, z1) == null) {
EntityRubble rubble = new EntityRubble(worldObj);
rubble.posX = x1 + 0.5F;

View File

@ -1,7 +1,8 @@
package com.hbm.entity.mob;
package com.hbm.entity.mob.glyphid;
import com.hbm.blocks.ModBlocks;
import com.hbm.entity.logic.EntityWaypoint;
import com.hbm.entity.mob.EntityParasiteMaggot;
import com.hbm.explosion.vanillant.ExplosionVNT;
import com.hbm.explosion.vanillant.standard.BlockAllocatorStandard;
import com.hbm.explosion.vanillant.standard.BlockMutatorDebris;
@ -45,6 +46,17 @@ public class EntityGlyphidNuclear extends EntityGlyphid {
return 2D;
}
@Override
protected void applyEntityAttributes() {
super.applyEntityAttributes();
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(GlyphidStats.getStats().getNuclear().health);
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(GlyphidStats.getStats().getNuclear().speed);
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(GlyphidStats.getStats().getNuclear().damage);
}
@Override public int getDivisorPerArmorPoint() { return GlyphidStats.getStats().getNuclear().divisor; }
@Override public float getDamageThreshold() { return GlyphidStats.getStats().getNuclear().damageThreshold; }
@Override
public void onUpdate() {
super.onUpdate();
@ -86,42 +98,11 @@ public class EntityGlyphidNuclear extends EntityGlyphid {
}
}
@Override
protected void applyEntityAttributes() {
super.applyEntityAttributes();
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(100D);
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.8D);
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(50D);
}
@Override
public boolean isArmorBroken(float amount) {
return this.rand.nextInt(100) <= Math.min(Math.pow(amount * 0.12, 2), 100);
}
@Override
public float calculateDamage(float amount) {
byte armor = this.dataWatcher.getWatchableObjectByte(17);
int divisor = 1;
for(int i = 0; i < 5; i++) {
if((armor & (1 << i)) > 0) {
divisor += 5;
}
}
amount /= divisor;
return amount;
}
@Override
public float getDamageThreshold() {
return 10F;
}
@Override
public boolean doesInfectedSpawnMaggots() {
return false;

View File

@ -1,4 +1,4 @@
package com.hbm.entity.mob;
package com.hbm.entity.mob.glyphid;
import com.hbm.blocks.ModBlocks;
import com.hbm.config.MobConfig;
@ -54,19 +54,22 @@ public class EntityGlyphidScout extends EntityGlyphid {
return 0.75D;
}
@Override
protected void applyEntityAttributes() {
super.applyEntityAttributes();
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(GlyphidStats.getStats().getScout().health);
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(GlyphidStats.getStats().getScout().speed);
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(GlyphidStats.getStats().getScout().damage);
}
@Override public int getDivisorPerArmorPoint() { return GlyphidStats.getStats().getScout().divisor; }
@Override public float getDamageThreshold() { return GlyphidStats.getStats().getScout().damageThreshold; }
@Override
public boolean isArmorBroken(float amount) {
return this.rand.nextInt(100) <= Math.min(Math.pow(amount, 2), 100);
}
@Override
protected void applyEntityAttributes() {
super.applyEntityAttributes();
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20D);
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.5D);
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(2D);
}
@Override
public void onUpdate() {
super.onUpdate();

View File

@ -0,0 +1,129 @@
package com.hbm.entity.mob.glyphid;
import com.hbm.lib.ModDamageSource;
import com.hbm.potion.HbmPotion;
import net.minecraft.util.DamageSource;
public abstract class GlyphidStats {
public static GlyphidStats GLYPHID_STATS_70K = new GlyphidStats70K();
public static GlyphidStats GLYPHID_STATS_NT = new GlyphidStatsNT();
public static GlyphidStats getStats() {
return GLYPHID_STATS_70K;
}
protected StatBundle statsGrunt;
protected StatBundle statsBombardier;
protected StatBundle statsBrawler;
protected StatBundle statsDigger;
protected StatBundle statsBlaster;
protected StatBundle statsBehemoth;
protected StatBundle statsBrenda;
protected StatBundle statsNuclear;
protected StatBundle statsScout;
public static class StatBundle {
public final double health;
public final double speed;
public final double damage;
public final int divisor;
public final float damageThreshold;
public StatBundle(double health, double speed, double damage, int divisor, float damageThreshold) {
this.health = health;
this.speed = speed;
this.damage = damage;
this.divisor = divisor;
this.damageThreshold = damageThreshold;
}
}
public abstract boolean handleAttack(EntityGlyphid glyphid, DamageSource source, float amount);
/** Tier 1 */ public StatBundle getGrunt() { return statsGrunt; }
/** Tier 1 Ranged */ public StatBundle getBombardier() { return statsBombardier; }
/** Tier 2 */ public StatBundle getBrawler() { return statsBrawler; }
/** Tier 2 Specialist */ public StatBundle getDigger() { return statsDigger; }
/** Tier 2 Ranged */ public StatBundle getBlaster() { return statsBlaster; }
/** Tier 3 */ public StatBundle getBehemoth() { return statsBehemoth; }
/** Tier 4 */ public StatBundle getBrenda() { return statsBrenda; }
/** Tier 4 Specialist */ public StatBundle getNuclear() { return statsNuclear; }
/** Tier 0 */ public StatBundle getScout() { return statsScout; }
public static class GlyphidStats70K extends GlyphidStats {
public GlyphidStats70K() {
this.statsGrunt = new StatBundle(30D, 1D, 5D, 1, 0.5F);
this.statsBombardier = new StatBundle(20D, 1D, 5D, 1, 0.5F);
this.statsBrawler = new StatBundle(50D, 1D, 10D, 3, 1F);
this.statsDigger = new StatBundle(50D, 1D, 5D, 1, 0.5F);
this.statsBlaster = new StatBundle(50D, 1D, 10D, 2, 1F);
this.statsBehemoth = new StatBundle(130D, 0.8D, 25D, 4, 2.5F);
this.statsBrenda = new StatBundle(250D, 1.2D, 50D, 5, 10F);
this.statsNuclear = new StatBundle(100D, 0.8D, 50D, 5, 10F);
this.statsScout = new StatBundle(20D, 1.5D, 2D, 1, 0.5F);
}
@Override
public boolean handleAttack(EntityGlyphid glyphid, DamageSource source, float amount) {
if(!source.isDamageAbsolute() && !source.isUnblockable() && !glyphid.worldObj.isRemote && !source.isFireDamage() && !source.getDamageType().equals(ModDamageSource.s_cryolator)) {
byte armor = glyphid.getDataWatcher().getWatchableObjectByte(glyphid.DW_ARMOR);
if(armor != 0) { //if at least one bit of armor is present
if(amount < glyphid.getDamageThreshold()) return false;
//chances of armor being broken off
if(amount > 1 && glyphid.isArmorBroken(amount)) {
glyphid.breakOffArmor();
amount *= 0.25F;
}
amount -= glyphid.getDamageThreshold();
if(amount < 0) return true;
}
amount = glyphid.calculateDamage(amount);
}
if(source.isFireDamage()) {
amount *= 0.7F;
} else if(source.getDamageType().equals("player")) {
amount *= glyphid.getScale() < 1.25 ? 1.5 : glyphid.getScale() < 1.3 ? 0.8 : 0.5;
} else if(source == ModDamageSource.acid || ModDamageSource.s_acid.equals(source.getDamageType())){
amount = 0;
} else if(source == DamageSource.inWall) {
amount *= 15F;
}
if(glyphid.isPotionActive(HbmPotion.phosphorus.getId())){
amount *= 1.5F;
}
return glyphid.attackSuperclass(source, amount);
}
}
public static class GlyphidStatsNT extends GlyphidStats {
public GlyphidStatsNT() {
this.statsGrunt = new StatBundle(30D, 1D, 5D, 1, 0.5F);
this.statsBombardier = new StatBundle(20D, 1D, 5D, 1, 0.5F);
this.statsBrawler = new StatBundle(50D, 1D, 10D, 3, 1F);
this.statsDigger = new StatBundle(50D, 1D, 5D, 1, 0.5F);
this.statsBlaster = new StatBundle(50D, 1D, 10D, 2, 1F);
this.statsBehemoth = new StatBundle(130D, 0.8D, 25D, 4, 2.5F);
this.statsBrenda = new StatBundle(250D, 1.2D, 50D, 5, 10F);
this.statsNuclear = new StatBundle(100D, 0.8D, 50D, 5, 10F);
this.statsScout = new StatBundle(20D, 1.5D, 2D, 1, 0.5F);
}
@Override
public boolean handleAttack(EntityGlyphid glyphid, DamageSource source, float amount) {
return true;
}
}
}

View File

@ -1,6 +1,6 @@
package com.hbm.entity.projectile;
import com.hbm.entity.mob.EntityGlyphid;
import com.hbm.entity.mob.glyphid.EntityGlyphid;
import com.hbm.lib.ModDamageSource;
import net.minecraft.nbt.NBTTagCompound;

View File

@ -4,7 +4,7 @@ import java.awt.Color;
import java.util.List;
import com.hbm.blocks.ModBlocks;
import com.hbm.entity.mob.EntityGlyphid;
import com.hbm.entity.mob.glyphid.EntityGlyphid;
import com.hbm.extprop.HbmLivingProps;
import com.hbm.handler.radiation.ChunkRadiationManager;
import com.hbm.inventory.fluid.FluidType;

View File

@ -10,9 +10,10 @@ import java.util.UUID;
import com.hbm.config.MobConfig;
import com.hbm.config.RadiationConfig;
import com.hbm.entity.mob.glyphid.EntityGlyphid;
import com.hbm.entity.mob.glyphid.EntityGlyphidDigger;
import com.hbm.entity.mob.glyphid.EntityGlyphidScout;
import com.hbm.entity.mob.EntityGlyphidDigger;
import com.hbm.entity.mob.EntityGlyphidScout;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
@ -332,7 +333,7 @@ public class PollutionHandler {
PollutionData data = getPollutionData(world, (int) Math.floor(event.x), (int) Math.floor(event.y), (int) Math.floor(event.z));
if(data == null) return;
if(living instanceof IMob) {
if(living instanceof IMob && !(living instanceof EntityGlyphid)) {
if(data.pollution[PollutionType.SOOT.ordinal()] > RadiationConfig.buffMobThreshold) {
if(living.getEntityAttribute(SharedMonsterAttributes.maxHealth) != null && living.getEntityAttribute(SharedMonsterAttributes.maxHealth).getModifier(maxHealth) == null) living.getEntityAttribute(SharedMonsterAttributes.maxHealth).applyModifier(new AttributeModifier(maxHealth, "Soot Anger Health Increase", 1D, 1));

View File

@ -49,7 +49,7 @@ public class ContainerFurnaceBrick extends Container {
var3 = var5.copy();
if(par2 <= 3) {
if(!this.mergeItemStack(var5, 3, this.inventorySlots.size(), true)) {
if(!this.mergeItemStack(var5, 4, this.inventorySlots.size(), true)) {
return null;
}
} else {

View File

@ -0,0 +1,107 @@
package com.hbm.inventory.container;
import com.hbm.inventory.SlotTakeOnly;
import com.hbm.items.ModItems;
import com.hbm.items.machine.IItemFluidIdentifier;
import com.hbm.tileentity.machine.oil.TileEntityMachineHydrotreater;
import api.hbm.energy.IBatteryItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerMachineHydrotreater extends Container {
private TileEntityMachineHydrotreater hydrotreater;
public ContainerMachineHydrotreater(InventoryPlayer invPlayer, TileEntityMachineHydrotreater tedf) {
hydrotreater = tedf;
//Battery
this.addSlotToContainer(new Slot(tedf, 0, 17, 90));
//Canister Input
this.addSlotToContainer(new Slot(tedf, 1, 35, 90));
//Canister Output
this.addSlotToContainer(new SlotTakeOnly(tedf, 2, 35, 108));
//Hydrogen Input
this.addSlotToContainer(new Slot(tedf, 3, 53, 90));
//Hydrogen Output
this.addSlotToContainer(new SlotTakeOnly(tedf, 4, 53, 108));
//Desulfated Oil Input
this.addSlotToContainer(new Slot(tedf, 5, 125, 90));
//Desulfated Oil Output
this.addSlotToContainer(new SlotTakeOnly(tedf, 6, 125, 108));
//Sour Gas Input
this.addSlotToContainer(new Slot(tedf, 7, 143, 90));
//Sour Gas Oil Output
this.addSlotToContainer(new SlotTakeOnly(tedf, 8, 143, 108));
//Fluid ID
this.addSlotToContainer(new Slot(tedf, 9, 17, 108));
//Catalyst
this.addSlotToContainer(new Slot(tedf, 10, 89, 36));
for(int i = 0; i < 3; i++) {
for(int j = 0; j < 9; j++) {
this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 156 + i * 18));
}
}
for(int i = 0; i < 9; i++) {
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 214));
}
}
@Override
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2) {
ItemStack var3 = null;
Slot var4 = (Slot) this.inventorySlots.get(par2);
if(var4 != null && var4.getHasStack()) {
ItemStack var5 = var4.getStack();
var3 = var5.copy();
if(par2 <= 10) {
if(!this.mergeItemStack(var5, 11, this.inventorySlots.size(), true)) {
return null;
}
} else {
if(var3.getItem() instanceof IBatteryItem) {
if(!this.mergeItemStack(var5, 0, 1, false)) {
return null;
}
} else if(var3.getItem() instanceof IItemFluidIdentifier) {
if(!this.mergeItemStack(var5, 9, 10, false)) {
return null;
}
} else if(var3.getItem() == ModItems.catalytic_converter) {
if(!this.mergeItemStack(var5, 10, 11, false)) {
return null;
}
} else {
if(!this.mergeItemStack(var5, 1, 2, false))
if(!this.mergeItemStack(var5, 3, 4, false))
if(!this.mergeItemStack(var5, 5, 6, false))
if(!this.mergeItemStack(var5, 7, 8, false))
return null;
}
}
if(var5.stackSize == 0) {
var4.putStack((ItemStack) null);
} else {
var4.onSlotChanged();
}
}
return var3;
}
@Override
public boolean canInteractWith(EntityPlayer player) {
return hydrotreater.isUseableByPlayer(player);
}
}

View File

@ -15,6 +15,7 @@ import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.TEFluidPacket;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import io.netty.buffer.ByteBuf;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.item.Item;
@ -300,5 +301,18 @@ public class FluidTank {
this.pressure = nbt.getShort(s + "_p");
}
public void serialize(ByteBuf buf) {
buf.writeInt(fluid);
buf.writeInt(maxFluid);
buf.writeInt(type.getID());
buf.writeShort((short) pressure);
}
public void deserialize(ByteBuf buf) {
fluid = buf.readInt();
maxFluid = buf.readInt();
type = Fluids.fromID(buf.readInt());
pressure = buf.readShort();
}
}

View File

@ -0,0 +1,73 @@
package com.hbm.inventory.gui;
import java.util.ArrayList;
import java.util.List;
import org.lwjgl.opengl.GL11;
import com.hbm.inventory.container.ContainerMachineHydrotreater;
import com.hbm.items.ModItems;
import com.hbm.lib.RefStrings;
import com.hbm.tileentity.machine.oil.TileEntityMachineHydrotreater;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
public class GUIMachineHydrotreater extends GuiInfoContainer {
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_hydrotreater.png");
private TileEntityMachineHydrotreater refinery;
public GUIMachineHydrotreater(InventoryPlayer invPlayer, TileEntityMachineHydrotreater tedf) {
super(new ContainerMachineHydrotreater(invPlayer, tedf));
refinery = tedf;
this.xSize = 176;
this.ySize = 238;
}
@Override
public void drawScreen(int mouseX, int mouseY, float f) {
super.drawScreen(mouseX, mouseY, f);
refinery.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 35, guiTop + 70 - 52, 16, 52);
refinery.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 53, guiTop + 70 - 52, 16, 52);
refinery.tanks[2].renderTankInfo(this, mouseX, mouseY, guiLeft + 125, guiTop + 70 - 52, 16, 52);
refinery.tanks[3].renderTankInfo(this, mouseX, mouseY, guiLeft + 143, guiTop + 70 - 52, 16, 52);
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 17, guiTop + 70 - 52, 16, 52, refinery.power, refinery.maxPower);
if(this.mc.thePlayer.inventory.getItemStack() == null && this.isMouseOverSlot(this.inventorySlots.getSlot(10), mouseX, mouseY) && !this.inventorySlots.getSlot(10).getHasStack()) {
List<Object[]> lines = new ArrayList();
ItemStack converter = new ItemStack(ModItems.catalytic_converter);
lines.add(new Object[] {converter});
lines.add(new Object[] {converter.getDisplayName()});
this.drawStackText(lines, mouseX, mouseY, this.fontRendererObj);
}
}
@Override
protected void drawGuiContainerForegroundLayer(int i, int j) {
String name = this.refinery.hasCustomInventoryName() ? this.refinery.getInventoryName() : I18n.format(this.refinery.getInventoryName());
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 5, 0xffffff);
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
int j = (int) (refinery.power * 54 / refinery.maxPower);
drawTexturedModalRect(guiLeft + 17, guiTop + 70 - j, 176, 52 - j, 16, j);
refinery.tanks[0].renderTank(guiLeft + 35, guiTop + 70, this.zLevel, 16, 52);
refinery.tanks[1].renderTank(guiLeft + 53, guiTop + 70, this.zLevel, 16, 52);
refinery.tanks[2].renderTank(guiLeft + 125, guiTop + 70, this.zLevel, 16, 52);
refinery.tanks[3].renderTank(guiLeft + 143, guiTop + 70, this.zLevel, 16, 52);
}
}

View File

@ -0,0 +1,84 @@
package com.hbm.inventory.recipes;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map.Entry;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.stream.JsonWriter;
import com.hbm.inventory.FluidStack;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.recipes.loader.SerializableRecipe;
import com.hbm.items.machine.ItemFluidIcon;
import com.hbm.util.Tuple.Triplet;
import net.minecraft.item.ItemStack;
public class HydrotreatingRecipes extends SerializableRecipe {
private static HashMap<FluidType, Triplet<FluidStack, FluidStack, FluidStack>> recipes = new HashMap();
@Override
public void registerDefaults() {
}
public static Triplet<FluidStack, FluidStack, FluidStack> getOutput(FluidType type) {
return recipes.get(type);
}
public static HashMap<Object, Object[]> getRecipes() {
HashMap<Object, Object[]> map = new HashMap<Object, Object[]>();
for(Entry<FluidType, Triplet<FluidStack, FluidStack, FluidStack>> recipe : recipes.entrySet()) {
map.put(new ItemStack[] {
ItemFluidIcon.make(recipe.getKey(), 1000),
ItemFluidIcon.make(recipe.getValue().getX().type, recipe.getValue().getX().fill * 10) },
new ItemStack[] {
ItemFluidIcon.make(recipe.getValue().getY().type, recipe.getValue().getY().fill * 10),
ItemFluidIcon.make(recipe.getValue().getZ().type, recipe.getValue().getZ().fill * 10) });
}
return map;
}
@Override
public String getFileName() {
return "hbmHydrotreating.json";
}
@Override
public Object getRecipeObject() {
return recipes;
}
@Override
public void readRecipe(JsonElement recipe) {
JsonObject obj = (JsonObject) recipe;
FluidType input = Fluids.fromName(obj.get("input").getAsString());
FluidStack hydrogen = this.readFluidStack(obj.get("hydrogen").getAsJsonArray());
FluidStack output1 = this.readFluidStack(obj.get("output1").getAsJsonArray());
FluidStack output2 = this.readFluidStack(obj.get("output2").getAsJsonArray());
recipes.put(input, new Triplet(hydrogen, output1, output2));
}
@Override
public void writeRecipe(Object recipe, JsonWriter writer) throws IOException {
Entry<FluidType, Triplet<FluidStack, FluidStack, FluidStack>> rec = (Entry<FluidType, Triplet<FluidStack, FluidStack, FluidStack>>) recipe;
writer.name("input").value(rec.getKey().getName());
writer.name("hydrogen"); this.writeFluidStack(rec.getValue().getX(), writer);
writer.name("output1"); this.writeFluidStack(rec.getValue().getY(), writer);
writer.name("output2"); this.writeFluidStack(rec.getValue().getZ(), writer);
}
@Override
public void deleteRecipes() {
recipes.clear();
}
}

View File

@ -52,6 +52,7 @@ public abstract class SerializableRecipe {
recipeHandlers.add(new FractionRecipes());
recipeHandlers.add(new CrackingRecipes());
recipeHandlers.add(new ReformingRecipes());
recipeHandlers.add(new HydrotreatingRecipes());
recipeHandlers.add(new LiquefactionRecipes());
recipeHandlers.add(new SolidificationRecipes());
recipeHandlers.add(new CokerRecipes());

View File

@ -66,6 +66,14 @@ import com.hbm.entity.missile.EntityMissileTier3.*;
import com.hbm.entity.missile.EntityMissileTier4.*;
import com.hbm.entity.mob.*;
import com.hbm.entity.mob.botprime.*;
import com.hbm.entity.mob.glyphid.EntityGlyphid;
import com.hbm.entity.mob.glyphid.EntityGlyphidBehemoth;
import com.hbm.entity.mob.glyphid.EntityGlyphidBlaster;
import com.hbm.entity.mob.glyphid.EntityGlyphidBombardier;
import com.hbm.entity.mob.glyphid.EntityGlyphidBrawler;
import com.hbm.entity.mob.glyphid.EntityGlyphidBrenda;
import com.hbm.entity.mob.glyphid.EntityGlyphidNuclear;
import com.hbm.entity.mob.glyphid.EntityGlyphidScout;
import com.hbm.entity.mob.siege.*;
import com.hbm.entity.particle.*;
import com.hbm.entity.projectile.*;
@ -294,6 +302,7 @@ public class ClientProxy extends ServerProxy {
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineAutosaw.class, new RenderAutosaw());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineVacuumDistill.class, new RenderVacuumDistill());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineCatalyticReformer.class, new RenderCatalyticReformer());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineHydrotreater.class, new RenderHydrotreater());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineCoker.class, new RenderCoker());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityFan.class, new RenderFan());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPistonInserter.class, new RenderPistonInserter());

View File

@ -80,12 +80,13 @@ public class ResourceManager {
public static final IModelCustom refinery_exploded = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/refinery_exploded.obj"));
public static final IModelCustom fraction_tower = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/machines/fraction_tower.obj"));
public static final IModelCustom fraction_spacer = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/machines/fraction_spacer.obj"));
public static final IModelCustom cracking_tower = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/cracking_tower.obj"));
public static final IModelCustom catalytic_reformer = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/catalytic_reformer.obj"));
public static final IModelCustom cracking_tower = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/cracking_tower.obj")).asDisplayList();
public static final IModelCustom catalytic_reformer = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/catalytic_reformer.obj")).asDisplayList();
public static final IModelCustom hydrotreater = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/hydrotreater.obj")).asDisplayList();
public static final IModelCustom liquefactor = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/liquefactor.obj"));
public static final IModelCustom solidifier = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/solidifier.obj"));
public static final IModelCustom compressor = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/compressor.obj"));
public static final IModelCustom coker = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/coker.obj"));
public static final IModelCustom coker = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/coker.obj")).asDisplayList();
//Flare Stack
public static final IModelCustom oilflare = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/flare_stack.obj"));
@ -479,6 +480,7 @@ public class ResourceManager {
public static final ResourceLocation fraction_spacer_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/fraction_spacer.png");
public static final ResourceLocation cracking_tower_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/cracking_tower.png");
public static final ResourceLocation catalytic_reformer_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/catalytic_reformer.png");
public static final ResourceLocation hydrotreater_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/hydrotreater.png");
public static final ResourceLocation liquefactor_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/liquefactor.png");
public static final ResourceLocation solidifier_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/solidifier.png");
public static final ResourceLocation compressor_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/compressor.png");

View File

@ -2,7 +2,7 @@ package com.hbm.render.entity.mob;
import org.lwjgl.opengl.GL11;
import com.hbm.entity.mob.EntityGlyphid;
import com.hbm.entity.mob.glyphid.EntityGlyphid;
import com.hbm.lib.RefStrings;
import com.hbm.main.ResourceManager;

View File

@ -2,8 +2,8 @@ package com.hbm.render.entity.mob;
import org.lwjgl.opengl.GL11;
import com.hbm.entity.mob.EntityGlyphid;
import com.hbm.entity.mob.EntityGlyphidNuclear;
import com.hbm.entity.mob.glyphid.EntityGlyphid;
import com.hbm.entity.mob.glyphid.EntityGlyphidNuclear;
import com.hbm.main.ResourceManager;
import net.minecraft.client.Minecraft;

View File

@ -0,0 +1,52 @@
package com.hbm.render.tileentity;
import org.lwjgl.opengl.GL11;
import com.hbm.blocks.ModBlocks;
import com.hbm.main.ResourceManager;
import com.hbm.render.item.ItemRenderBase;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.client.IItemRenderer;
public class RenderHydrotreater extends TileEntitySpecialRenderer implements IItemRendererProvider {
@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float f) {
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5, y, z + 0.5);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glShadeModel(GL11.GL_SMOOTH);
bindTexture(ResourceManager.hydrotreater_tex);
ResourceManager.hydrotreater.renderAll();
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glPopMatrix();
}
@Override
public Item getItemForRenderer() {
return Item.getItemFromBlock(ModBlocks.machine_hydrotreater);
}
@Override
public IItemRenderer getRenderer() {
return new ItemRenderBase() {
public void renderInventory() {
GL11.glTranslated(0, -4, 0);
GL11.glScaled(4, 4, 4);
}
public void renderCommon() {
GL11.glScaled(0.5, 0.5, 0.5);
GL11.glShadeModel(GL11.GL_SMOOTH);
bindTexture(ResourceManager.hydrotreater_tex);
ResourceManager.hydrotreater.renderAll();
GL11.glShadeModel(GL11.GL_FLAT);
}};
}
}

View File

@ -2,7 +2,7 @@ package com.hbm.tileentity.deco;
import java.util.List;
import com.hbm.entity.mob.EntityGlyphid;
import com.hbm.entity.mob.glyphid.EntityGlyphid;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

View File

@ -55,7 +55,7 @@ public class TileEntityMachineCatalyticReformer extends TileEntityMachineBase im
if(!worldObj.isRemote) {
this.updateConnections();
if(this.worldObj.getTotalWorldTime() % 20 == 0) this.updateConnections();
power = Library.chargeTEFromItems(slots, 0, power, maxPower);
tanks[0].setType(9, slots);
tanks[0].loadTank(1, 2, slots);

View File

@ -0,0 +1,208 @@
package com.hbm.tileentity.machine.oil;
import com.hbm.inventory.FluidStack;
import com.hbm.inventory.container.ContainerMachineHydrotreater;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.inventory.gui.GUIMachineHydrotreater;
import com.hbm.inventory.recipes.HydrotreatingRecipes;
import com.hbm.items.ModItems;
import com.hbm.lib.Library;
import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.IPersistentNBT;
import com.hbm.tileentity.TileEntityMachineBase;
import com.hbm.util.Tuple.Triplet;
import com.hbm.util.fauxpointtwelve.DirPos;
import api.hbm.energy.IEnergyUser;
import api.hbm.fluid.IFluidStandardTransceiver;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityMachineHydrotreater extends TileEntityMachineBase implements IEnergyUser, IFluidStandardTransceiver, IPersistentNBT, IGUIProvider {
public long power;
public static final long maxPower = 1_000_000;
public FluidTank[] tanks;
public TileEntityMachineHydrotreater() {
super(11);
this.tanks = new FluidTank[4];
this.tanks[0] = new FluidTank(Fluids.OIL, 64_000);
this.tanks[1] = new FluidTank(Fluids.HYDROGEN, 64_000);
this.tanks[2] = new FluidTank(Fluids.NONE, 24_000);
this.tanks[3] = new FluidTank(Fluids.SOURGAS, 24_000);
}
@Override
public String getName() {
return "container.hydrotreater";
}
@Override
public void updateEntity() {
if(!worldObj.isRemote) {
if(this.worldObj.getTotalWorldTime() % 20 == 0) this.updateConnections();
power = Library.chargeTEFromItems(slots, 0, power, maxPower);
tanks[0].setType(9, slots);
tanks[0].loadTank(1, 2, slots);
tanks[1].loadTank(3, 4, slots);
reform();
tanks[2].unloadTank(5, 6, slots);
tanks[3].unloadTank(7, 8, slots);
for(DirPos pos : getConPos()) {
for(int i = 2; i < 4; i++) {
if(tanks[i].getFill() > 0) {
this.sendFluid(tanks[i], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
}
}
}
}
}
private void reform() {
Triplet<FluidStack, FluidStack, FluidStack> out = HydrotreatingRecipes.getOutput(tanks[0].getTankType());
if(out == null) {
tanks[2].setTankType(Fluids.NONE);
tanks[3].setTankType(Fluids.NONE);
return;
}
tanks[1].setTankType(out.getX().type);
tanks[2].setTankType(out.getY().type);
tanks[3].setTankType(out.getZ().type);
if(power < 20_000) return;
if(tanks[0].getFill() < 50) return;
if(tanks[1].getFill() < out.getX().fill) return;
if(slots[10] == null || slots[10].getItem() != ModItems.catalytic_converter) return;
if(tanks[2].getFill() + out.getY().fill > tanks[2].getMaxFill()) return;
if(tanks[3].getFill() + out.getZ().fill > tanks[3].getMaxFill()) return;
tanks[0].setFill(tanks[0].getFill() - 50);
tanks[1].setFill(tanks[1].getFill() - out.getX().fill);
tanks[2].setFill(tanks[2].getFill() + out.getY().fill);
tanks[3].setFill(tanks[3].getFill() + out.getZ().fill);
power -= 20_000;
}
private void updateConnections() {
for(DirPos pos : getConPos()) {
this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
this.trySubscribe(tanks[0].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
this.trySubscribe(tanks[1].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
}
}
public DirPos[] getConPos() {
return new DirPos[] {
new DirPos(xCoord + 2, yCoord, zCoord + 1, Library.POS_X),
new DirPos(xCoord + 2, yCoord, zCoord - 1, Library.POS_X),
new DirPos(xCoord - 2, yCoord, zCoord + 1, Library.NEG_X),
new DirPos(xCoord - 2, yCoord, zCoord - 1, Library.NEG_X),
new DirPos(xCoord + 1, yCoord, zCoord + 2, Library.POS_Z),
new DirPos(xCoord - 1, yCoord, zCoord + 2, Library.POS_Z),
new DirPos(xCoord + 1, yCoord, zCoord - 2, Library.NEG_Z),
new DirPos(xCoord - 1, yCoord, zCoord - 2, Library.NEG_Z)
};
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
power = nbt.getLong("power");
tanks[0].readFromNBT(nbt, "t0");
tanks[1].readFromNBT(nbt, "t1");
tanks[2].readFromNBT(nbt, "t2");
tanks[3].readFromNBT(nbt, "t3");
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
nbt.setLong("power", power);
tanks[0].writeToNBT(nbt, "t0");
tanks[1].writeToNBT(nbt, "t1");
tanks[2].writeToNBT(nbt, "t2");
tanks[3].writeToNBT(nbt, "t3");
}
AxisAlignedBB bb = null;
@Override
public AxisAlignedBB getRenderBoundingBox() {
if(bb == null) {
bb = AxisAlignedBB.getBoundingBox(
xCoord - 1,
yCoord,
zCoord - 1,
xCoord + 2,
yCoord + 7,
zCoord + 2
);
}
return bb;
}
@Override
@SideOnly(Side.CLIENT)
public double getMaxRenderDistanceSquared() {
return 65536.0D;
}
@Override public long getPower() { return power; }
@Override public void setPower(long power) { this.power = power; }
@Override public long getMaxPower() { return maxPower; }
@Override public FluidTank[] getAllTanks() { return tanks; }
@Override public FluidTank[] getSendingTanks() { return new FluidTank[] {tanks[2], tanks[3]}; }
@Override public FluidTank[] getReceivingTanks() { return new FluidTank[] {tanks[0], tanks[1]}; }
@Override public boolean canConnect(ForgeDirection dir) { return dir != ForgeDirection.UNKNOWN && dir != ForgeDirection.DOWN; }
@Override public boolean canConnect(FluidType type, ForgeDirection dir) { return dir != ForgeDirection.UNKNOWN && dir != ForgeDirection.DOWN; }
@Override
public void writeNBT(NBTTagCompound nbt) {
if(tanks[0].getFill() == 0 && tanks[1].getFill() == 0 && tanks[2].getFill() == 0 && tanks[3].getFill() == 0) return;
NBTTagCompound data = new NBTTagCompound();
for(int i = 0; i < 4; i++) this.tanks[i].writeToNBT(data, "" + i);
nbt.setTag(NBT_PERSISTENT_KEY, data);
}
@Override
public void readNBT(NBTTagCompound nbt) {
NBTTagCompound data = nbt.getCompoundTag(NBT_PERSISTENT_KEY);
for(int i = 0; i < 4; i++) this.tanks[i].readFromNBT(data, "" + i);
}
@Override
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new ContainerMachineHydrotreater(player.inventory, this);
}
@Override
@SideOnly(Side.CLIENT)
public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new GUIMachineHydrotreater(player.inventory, this);
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB