Merge branch 'HbmMods:master' into master

This commit is contained in:
Vaern 2021-11-29 16:25:47 -08:00 committed by GitHub
commit bb575d9f61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 442 additions and 238 deletions

View File

@ -690,6 +690,7 @@ public class ModBlocks {
public static Block red_wire_coated;
public static Block red_cable;
public static Block red_connector;
public static Block red_pylon;
public static Block cable_switch;
public static Block machine_detector;
@ -1790,6 +1791,7 @@ public class ModBlocks {
red_wire_coated = new WireCoated(Material.iron).setBlockName("red_wire_coated").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":red_wire_coated");
red_cable = new BlockCable(Material.iron).setBlockName("red_cable").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":cable_neo");
rf_cable = new BlockRFCable(Material.iron).setBlockName("rf_cable").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":rf_cable_icon");
red_connector = new ConnectorRedWire(Material.iron).setBlockName("red_connector").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":red_connector");
red_pylon = new PylonRedWire(Material.iron).setBlockName("red_pylon").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":red_pylon");
cable_switch = new CableSwitch(Material.iron).setBlockName("cable_switch").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":cable_switch_off");
machine_detector = new PowerDetector(Material.iron).setBlockName("machine_detector").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_detector_off");
@ -2869,6 +2871,7 @@ public class ModBlocks {
GameRegistry.registerBlock(red_cable, red_cable.getUnlocalizedName());
GameRegistry.registerBlock(red_wire_coated, red_wire_coated.getUnlocalizedName());
GameRegistry.registerBlock(red_connector, red_connector.getUnlocalizedName());
GameRegistry.registerBlock(red_pylon, red_pylon.getUnlocalizedName());
GameRegistry.registerBlock(cable_switch, cable_switch.getUnlocalizedName());
GameRegistry.registerBlock(machine_detector, machine_detector.getUnlocalizedName());

View File

@ -0,0 +1,20 @@
package com.hbm.blocks.network;
import com.hbm.tileentity.network.TileEntityConnector;
import net.minecraft.block.material.Material;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class ConnectorRedWire extends PylonBase {
public ConnectorRedWire(Material mat) {
super(mat);
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return new TileEntityConnector();
}
}

View File

@ -9,12 +9,12 @@ import net.minecraft.world.World;
public class PylonRedWire extends PylonBase {
public PylonRedWire(Material p_i45386_1_) {
super(p_i45386_1_);
public PylonRedWire(Material material) {
super(material);
}
@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
public TileEntity createNewTileEntity(World world, int meta) {
return new TileEntityPylon();
}
}

View File

@ -4,6 +4,8 @@ import java.util.ArrayList;
import java.util.List;
import com.hbm.explosion.ExplosionLarge;
import com.hbm.explosion.ExplosionNT;
import com.hbm.explosion.ExplosionNT.ExAttrib;
import com.hbm.items.ModItems;
import api.hbm.entity.IRadarDetectable.RadarTargetType;
@ -24,11 +26,13 @@ public class EntityMissileDrill extends EntityMissileBaseAdvanced {
public void onImpact() {
for(int i = 0; i < 30; i++)
{
this.worldObj.createExplosion(this, this.posX, this.posY - i, this.posZ, 10F, true);
ExplosionNT explosion = new ExplosionNT(worldObj, this, this.posX, this.posY - i, this.posZ, 10F);
explosion.addAllAttrib(ExAttrib.ERRODE);
explosion.explode(); //an explosion exploded!
}
ExplosionLarge.spawnParticles(worldObj, this.posX, this.posY, this.posZ, 25);
ExplosionLarge.spawnShrapnels(worldObj, this.posX, this.posY, this.posZ, 12);
ExplosionLarge.spawnRubble(worldObj, this.posX, this.posY, this.posZ, 12);
ExplosionLarge.jolt(worldObj, this.posX, this.posY, this.posZ, 10, 50, 1);
}
@Override

View File

@ -202,8 +202,7 @@ public class EntityBulletBase extends Entity implements IProjectile {
return;
}
if(this.config.blackPowder) {
this.setDead();
if(this.config.blackPowder && this.ticksExisted == 1) {
for(int i = 0; i < 15; i++) {
double mod = rand.nextDouble();
@ -215,7 +214,6 @@ public class EntityBulletBase extends Entity implements IProjectile {
double mod = 0.5;
this.worldObj.spawnParticle("flame", this.posX + this.motionX * mod, this.posY + this.motionY * mod, this.posZ + this.motionZ * mod, 0, 0, 0);
return;
}
if(config.maxAge == 0) {

View File

@ -33,7 +33,7 @@ public class ExplosionNT extends Explosion {
private Random explosionRNG = new Random();
private World worldObj;
protected int field_77289_h = 16;
protected int resolution = 16;
protected Map affectedEntities = new HashMap();
public static final List<ExAttrib> nukeAttribs = Arrays.asList(new ExAttrib[] { ExAttrib.FIRE, ExAttrib.NOPARTICLE, ExAttrib.NOSOUND, ExAttrib.NODROP, ExAttrib.NOHURT });
@ -53,8 +53,13 @@ public class ExplosionNT extends Explosion {
return this;
}
public ExplosionNT addAllAttrib(ExAttrib... attrib) {
for(ExAttrib a : attrib) atttributes.add(a);
return this;
}
public ExplosionNT overrideResolution(int res) {
field_77289_h = res;
resolution = res;
return this;
}
@ -69,44 +74,51 @@ public class ExplosionNT extends Explosion {
int i;
int j;
int k;
double d5;
double d6;
double d7;
double currentX;
double currentY;
double currentZ;
for(i = 0; i < this.field_77289_h; ++i) {
for(j = 0; j < this.field_77289_h; ++j) {
for(k = 0; k < this.field_77289_h; ++k) {
if(i == 0 || i == this.field_77289_h - 1 || j == 0 || j == this.field_77289_h - 1 || k == 0 || k == this.field_77289_h - 1) {
double d0 = (double) ((float) i / ((float) this.field_77289_h - 1.0F) * 2.0F - 1.0F);
double d1 = (double) ((float) j / ((float) this.field_77289_h - 1.0F) * 2.0F - 1.0F);
double d2 = (double) ((float) k / ((float) this.field_77289_h - 1.0F) * 2.0F - 1.0F);
double d3 = Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2);
d0 /= d3;
d1 /= d3;
d2 /= d3;
float f1 = this.explosionSize * (0.7F + this.worldObj.rand.nextFloat() * 0.6F);
d5 = this.explosionX;
d6 = this.explosionY;
d7 = this.explosionZ;
for(i = 0; i < this.resolution; ++i) {
for(j = 0; j < this.resolution; ++j) {
for(k = 0; k < this.resolution; ++k) {
if(i == 0 || i == this.resolution - 1 || j == 0 || j == this.resolution - 1 || k == 0 || k == this.resolution - 1) {
double d0 = (double) ((float) i / ((float) this.resolution - 1.0F) * 2.0F - 1.0F);
double d1 = (double) ((float) j / ((float) this.resolution - 1.0F) * 2.0F - 1.0F);
double d2 = (double) ((float) k / ((float) this.resolution - 1.0F) * 2.0F - 1.0F);
double dist = Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2);
d0 /= dist;
d1 /= dist;
d2 /= dist;
float remainingPower = this.explosionSize * (0.7F + this.worldObj.rand.nextFloat() * 0.6F);
currentX = this.explosionX;
currentY = this.explosionY;
currentZ = this.explosionZ;
for(float f2 = 0.3F; f1 > 0.0F; f1 -= f2 * 0.75F) {
int j1 = MathHelper.floor_double(d5);
int k1 = MathHelper.floor_double(d6);
int l1 = MathHelper.floor_double(d7);
Block block = this.worldObj.getBlock(j1, k1, l1);
for(float step = 0.3F; remainingPower > 0.0F; remainingPower -= step * 0.75F) {
int xPos = MathHelper.floor_double(currentX);
int yPos = MathHelper.floor_double(currentY);
int zPos = MathHelper.floor_double(currentZ);
Block block = this.worldObj.getBlock(xPos, yPos, zPos);
if(block.getMaterial() != Material.air) {
float f3 = this.exploder != null ? this.exploder.func_145772_a(this, this.worldObj, j1, k1, l1, block) : block.getExplosionResistance(this.exploder, worldObj, j1, k1, l1, explosionX, explosionY, explosionZ);
f1 -= (f3 + 0.3F) * f2;
float resistance = this.exploder != null ? this.exploder.func_145772_a(this, this.worldObj, xPos, yPos, zPos, block) : block.getExplosionResistance(this.exploder, worldObj, xPos, yPos, zPos, explosionX, explosionY, explosionZ);
remainingPower -= (resistance + 0.3F) * step;
}
if(block != Blocks.air && f1 > 0.0F && (this.exploder == null || this.exploder.func_145774_a(this, this.worldObj, j1, k1, l1, block, f1))) {
hashset.add(new ChunkPosition(j1, k1, l1));
if(block != Blocks.air && remainingPower > 0.0F && (this.exploder == null || this.exploder.func_145774_a(this, this.worldObj, xPos, yPos, zPos, block, remainingPower))) {
hashset.add(new ChunkPosition(xPos, yPos, zPos));
} else if(this.has(ExAttrib.ERRODE) && errosion.containsKey(block)) {
hashset.add(new ChunkPosition(xPos, yPos, zPos));
}
d5 += d0 * (double) f2;
d6 += d1 * (double) f2;
d7 += d2 * (double) f2;
currentX += d0 * (double) step;
currentY += d1 * (double) step;
currentZ += d2 * (double) step;
}
}
}
@ -133,25 +145,25 @@ public class ExplosionNT extends Explosion {
double d4 = entity.getDistance(this.explosionX, this.explosionY, this.explosionZ) / (double) this.explosionSize;
if(d4 <= 1.0D) {
d5 = entity.posX - this.explosionX;
d6 = entity.posY + (double) entity.getEyeHeight() - this.explosionY;
d7 = entity.posZ - this.explosionZ;
double d9 = (double) MathHelper.sqrt_double(d5 * d5 + d6 * d6 + d7 * d7);
currentX = entity.posX - this.explosionX;
currentY = entity.posY + (double) entity.getEyeHeight() - this.explosionY;
currentZ = entity.posZ - this.explosionZ;
double d9 = (double) MathHelper.sqrt_double(currentX * currentX + currentY * currentY + currentZ * currentZ);
if(d9 != 0.0D) {
d5 /= d9;
d6 /= d9;
d7 /= d9;
currentX /= d9;
currentY /= d9;
currentZ /= d9;
double d10 = (double) this.worldObj.getBlockDensity(vec3, entity.boundingBox);
double d11 = (1.0D - d4) * d10;
entity.attackEntityFrom(DamageSource.setExplosionSource(this), (float) ((int) ((d11 * d11 + d11) / 2.0D * 8.0D * (double) this.explosionSize + 1.0D)));
double d8 = EnchantmentProtection.func_92092_a(entity, d11);
entity.motionX += d5 * d8;
entity.motionY += d6 * d8;
entity.motionZ += d7 * d8;
entity.motionX += currentX * d8;
entity.motionY += currentY * d8;
entity.motionZ += currentZ * d8;
if(entity instanceof EntityPlayer) {
this.affectedEntities.put((EntityPlayer) entity, Vec3.createVectorHelper(d5 * d11, d6 * d11, d7 * d11));
this.affectedEntities.put((EntityPlayer) entity, Vec3.createVectorHelper(currentX * d11, currentY * d11, currentZ * d11));
}
}
}
@ -212,7 +224,19 @@ public class ExplosionNT extends Explosion {
}
if(block.getMaterial() != Material.air) {
if(block.canDropFromExplosion(this) && !has(ExAttrib.NODROP)) {
boolean doesErrode = false;
Block errodesInto = Blocks.air;
if(this.has(ExAttrib.ERRODE) && this.explosionRNG.nextFloat() < 0.6F) { //errosion has a 60% chance to occour
if(errosion.containsKey(block)) {
doesErrode = true;
errodesInto = errosion.get(block);
}
}
if(block.canDropFromExplosion(this) && !has(ExAttrib.NODROP) && !doesErrode) {
float chance = 1.0F;
if(!has(ExAttrib.ALLDROP))
@ -225,6 +249,10 @@ public class ExplosionNT extends Explosion {
if(block.isNormalCube()) {
if(doesErrode) {
this.worldObj.setBlock(i, j, k, errodesInto);
}
if(has(ExAttrib.DIGAMMA)) {
this.worldObj.setBlock(i, j, k, ModBlocks.ash_digamma);
@ -300,6 +328,7 @@ public class ExplosionNT extends Explosion {
DIGAMMA_CIRCUIT,
LAVA, //again the same thing but lava
LAVA_V, //again the same thing but volcaniclava
ERRODE, //will turn select blocks into gravel or sand
ALLMOD, //block placer attributes like fire are applied for all destroyed blocks
ALLDROP, //miner TNT!
NODROP, //the opposite
@ -307,5 +336,14 @@ public class ExplosionNT extends Explosion {
NOSOUND,
NOHURT
}
public static final HashMap<Block, Block> errosion = new HashMap();
static {
errosion.put(ModBlocks.concrete, Blocks.gravel);
errosion.put(ModBlocks.concrete_smooth, Blocks.gravel);
errosion.put(ModBlocks.brick_concrete, ModBlocks.brick_concrete_broken);
errosion.put(ModBlocks.brick_concrete_broken, Blocks.gravel);
}
}

View File

@ -4,6 +4,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import com.hbm.interfaces.Untested;
import net.minecraft.init.Blocks;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
@ -25,6 +27,8 @@ public class ExplosionNukeRay {
int startCir;
public boolean isAusf3Complete = false;
private double overrideRange = 0;
public ExplosionNukeRay(World world, int x, int y, int z, int strength, int count, int speed, int length) {
this.world = world;
this.posX = x;
@ -39,6 +43,9 @@ public class ExplosionNukeRay {
//Mk 4.5, must be int32
this.startY = 0;
this.startCir = 0;
//starts at around 80, becomes 8 at length 500
this.overrideRange = Math.max((Math.log(length) * 4 - 2.5D) * 10, 0);
}
/*public void processBunch(int count) {
@ -147,6 +154,7 @@ public class ExplosionNukeRay {
processed += count;
}
@Untested //override range
public void collectTip(int count) {
for(int k = 0; k < count; k++) {
@ -177,12 +185,22 @@ public class ExplosionNukeRay {
res -= Math.pow(world.getBlock((int)x0, (int)y0, (int)z0).getExplosionResistance(null), 1.25);
else
res -= Math.pow(Blocks.air.getExplosionResistance(null), 1.25);
/*
* Blast resistance calculations are still done to preserve the general shape,
* but if the blast were to be stopped within this range we go through with it anyway.
* There is currently no blast resistance limit on this, could change in the future.
*/
boolean inOverrideRange = this.overrideRange >= length;
if(res > 0 && world.getBlock((int)x0, (int)y0, (int)z0) != Blocks.air) {
if((res > 0 || inOverrideRange) && world.getBlock((int)x0, (int)y0, (int)z0) != Blocks.air) {
lastPos = new FloatTriplet(x0, y0, z0);
}
if(res <= 0 || i + 1 >= this.length) {
/*
* Only stop if we are either out of range or if the remaining strength is 0 while being outside the override range
*/
if((res <= 0 && !inOverrideRange) || i + 1 >= this.length) {
if(affectedBlocks.size() < Integer.MAX_VALUE - 100 && lastPos != null)
affectedBlocks.add(new FloatTriplet(lastPos.xCoord, lastPos.yCoord, lastPos.zCoord));
break;

View File

@ -19,7 +19,9 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityXPOrb;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.monster.EntityMagmaCube;
import net.minecraft.entity.monster.EntitySkeleton;
import net.minecraft.entity.monster.EntitySlime;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
@ -287,6 +289,10 @@ public abstract class WeaponAbility {
living.entityDropItem(new ItemStack(Items.skull, 1, 2), 0.0F);
} else if(living instanceof EntityCreeper) {
living.entityDropItem(new ItemStack(Items.skull, 1, 4), 0.0F);
} else if(living instanceof EntityMagmaCube) {
living.entityDropItem(new ItemStack(Items.magma_cream, 3), 0.0F);
} else if(living instanceof EntitySlime) {
living.entityDropItem(new ItemStack(Items.slime_ball, 3), 0.0F);
} else if(living instanceof EntityPlayer) {
ItemStack head = new ItemStack(Items.skull, 1, 3);

View File

@ -1,15 +1,23 @@
package com.hbm.inventory.gui;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map.Entry;
import org.lwjgl.opengl.GL11;
import com.hbm.handler.FluidTypeHandler.FluidType;
import com.hbm.inventory.FluidTank;
import com.hbm.inventory.container.ContainerMachineDiesel;
import com.hbm.lib.RefStrings;
import com.hbm.tileentity.machine.TileEntityMachineDiesel;
import com.hbm.util.I18nUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
public class GUIMachineDiesel extends GuiInfoContainer {
@ -32,20 +40,17 @@ public class GUIMachineDiesel extends GuiInfoContainer {
diFurnace.tank.renderTankInfo(this, mouseX, mouseY, guiLeft + 80, guiTop + 69 - 52, 16, 52);
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 69 - 52, 16, 52, diFurnace.power, diFurnace.powerCap);
String[] text = new String[] { "Accepted Fuels:",
" Diesel (500 HE/t)",
" Petroil (300 HE/t)",
" Biofuel (400 HE/t)",
" Ethanol (200 HE/t)",
" LPG (450 HE/t)",
" Hydrogen (10 HE/t)",
" Leaded Gasoline (1500 HE/t)",
" NITAN Superfuel (5000 HE/t)" };
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36, 16, 16, guiLeft - 8, guiTop + 36 + 16, text);
List<String> text = new ArrayList();
text.add(EnumChatFormatting.YELLOW + "Accepted Fuels:");
for(Entry<FluidType, Integer> entry : TileEntityMachineDiesel.fuels.entrySet()) {
text.add(" " + I18nUtil.resolveKey(entry.getKey().getUnlocalizedName()) + " (" + entry.getValue() + " HE/t)");
}
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36, 16, 16, guiLeft - 8, guiTop + 36 + 16, text.toArray(new String[0]));
String[] text1 = new String[] { "Fuel consumption rate:",
" 10 mB/t",
" 200 mB/s",
" 1 mB/t",
" 20 mB/s",
"(Consumption rate is constant)" };
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36 + 16, 16, 16, guiLeft - 8, guiTop + 36 + 16, text1);

View File

@ -1,15 +1,23 @@
package com.hbm.inventory.gui;
import java.util.ArrayList;
import java.util.List;
import java.util.Map.Entry;
import org.lwjgl.opengl.GL11;
import com.hbm.handler.FluidTypeHandler.FluidType;
import com.hbm.inventory.FluidTank;
import com.hbm.inventory.container.ContainerMachineSelenium;
import com.hbm.lib.RefStrings;
import com.hbm.tileentity.machine.TileEntityMachineDiesel;
import com.hbm.tileentity.machine.TileEntityMachineSeleniumEngine;
import com.hbm.util.I18nUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
public class GUIMachineSelenium extends GuiInfoContainer {
@ -31,26 +39,23 @@ public class GUIMachineSelenium extends GuiInfoContainer {
diFurnace.tank.renderTankInfo(this, mouseX, mouseY, guiLeft + 116, guiTop + 18, 16, 52);
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 8, guiTop + 108, 160, 16, diFurnace.power, diFurnace.powerCap);
List<String> text = new ArrayList();
text.add(EnumChatFormatting.YELLOW + "Accepted Fuels:");
String[] text = new String[] { "Accepted Fuels:",
" Industrial Oil (50 HE/t)",
" Heating Oil (75 HE/t)",
" Hydrogen (500 HE/t)",
" Diesel (225 HE/t)",
" Kerosene (300 HE/t)",
" Reclaimed Oil (100 HE/t)",
" Petroil (125 HE/t)",
" Biofuel (200 HE/t)",
" Leaded Gasoline (700 HE/t)",
" NITAN Superfuel (2500 HE/t)",
"(These numbers are base values,",
"actual output is based",
"on piston count)" };
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36, 16, 16, guiLeft - 8, guiTop + 36 + 16, text);
for(Entry<FluidType, Integer> entry : TileEntityMachineDiesel.fuels.entrySet()) {
text.add(" " + I18nUtil.resolveKey(entry.getKey().getUnlocalizedName()) + " (" + entry.getValue() + " HE/t)");
}
text.add(EnumChatFormatting.ITALIC + "(These numbers are base values,");
text.add(EnumChatFormatting.ITALIC + "actual output is based");
text.add(EnumChatFormatting.ITALIC + "on piston count)");
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36, 16, 16, guiLeft - 8, guiTop + 36 + 16, text.toArray(new String[0]));
String[] text1 = new String[] { "Fuel consumption rate:",
" 5 mB/t",
" 100 mB/s",
" 1 mB/t",
" 20 mB/s",
"(Consumption rate per piston)" };
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36 + 16, 16, 16, guiLeft - 8, guiTop + 36 + 16, text1);

View File

@ -86,6 +86,7 @@ import com.hbm.tileentity.machine.oil.TileEntityMachinePumpjack;
import com.hbm.tileentity.machine.oil.TileEntityMachineRefinery;
import com.hbm.tileentity.machine.oil.TileEntitySpacer;
import com.hbm.tileentity.machine.rbmk.*;
import com.hbm.tileentity.network.TileEntityConnector;
import com.hbm.tileentity.network.TileEntityPylon;
import com.hbm.tileentity.turret.*;
@ -236,6 +237,7 @@ public class ClientProxy extends ServerProxy {
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityFluidDuct.class, new RenderFluidDuct());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRFDuct.class, new RenderRFCable());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPylon.class, new RenderPylon());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityConnector.class, new RenderConnector());
//multiblocks
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityStructureMarker.class, new RenderStructureMaker());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMultiblock.class, new RenderMultiblock());

View File

@ -0,0 +1,28 @@
package com.hbm.render.tileentity;
import org.lwjgl.opengl.GL11;
import com.hbm.main.ResourceManager;
import com.hbm.tileentity.network.TileEntityConnector;
import net.minecraft.tileentity.TileEntity;
public class RenderConnector extends RenderPylonBase {
@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float interp) {
TileEntityConnector con = (TileEntityConnector) te;
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5, y, z + 0.5);
double s = 0.5;
GL11.glScaled(s, s, s);
bindTexture(ResourceManager.universal);
ResourceManager.barrel.renderAll();
GL11.glPopMatrix();
GL11.glPushMatrix();
this.renderSingleLine(con, x, y, z);
GL11.glPopMatrix();
}
}

View File

@ -16,7 +16,7 @@ import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Vec3;
public class RenderPylon extends TileEntitySpecialRenderer {
public class RenderPylon extends RenderPylonBase {
private static final ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":" + "textures/models/ModelPylon.png");
@ -29,83 +29,16 @@ public class RenderPylon extends TileEntitySpecialRenderer {
@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f) {
TileEntityPylon pyl = (TileEntityPylon)te;
GL11.glPushMatrix();
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F - ((1F / 16F) * 14F), (float) z + 0.5F);
GL11.glRotatef(180, 0F, 0F, 1F);
bindTexture(texture);
this.pylon.renderAll(0.0625F);
GL11.glPopMatrix();
GL11.glPushMatrix();
for(int i = 0; i < pyl.connected.size(); i++) {
int[] wire = pyl.connected.get(i);
float wX = (wire[0] - pyl.xCoord) / 2F;
float wY = (wire[1] - pyl.yCoord) / 2F;
float wZ = (wire[2] - pyl.zCoord) / 2F;
float count = 10;
Vec3 delta = Vec3.createVectorHelper((wire[0] - te.xCoord), (wire[1] - te.yCoord), (wire[2] - te.zCoord));
for(float j = 0; j < count; j++) {
float k = j + 1;
double ja = j + 0.5D;
double ix = te.xCoord + 0.5 + delta.xCoord / (double)(count * 2) * ja;
double iy = te.yCoord + 0.5 + delta.yCoord / (double)(count * 2) * ja + 5 - Math.sin(j / count * Math.PI * 0.5);
double iz = te.zCoord + 0.5 + delta.zCoord / (double)(count * 2) * ja;
//te.getWorldObj().spawnParticle("reddust", ix, iy, iz, 0.01 + j * 0.1, 0, 0);
int brightness = te.getWorldObj().getLightBrightnessForSkyBlocks(MathHelper.floor_double(ix), MathHelper.floor_double(iy), MathHelper.floor_double(iz), 0);
int lX = brightness % 65536;
int lY = brightness / 65536;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)lX / 1.0F, (float)lY / 1.0F);
drawPowerLine(
x + 0.5 + (wX * j / count),
y + 5.4 + (wY * j / count) - Math.sin(j / count * Math.PI * 0.5),
z + 0.5 + (wZ * j / count),
x + 0.5 + (wX * k / count),
y + 5.4 + (wY * k / count) - Math.sin(k / count * Math.PI * 0.5),
z + 0.5 + (wZ * k / count));
}
}
GL11.glPushMatrix();
this.renderSingleLine(pyl, x, y, z);
GL11.glPopMatrix();
}
public void drawPowerLine(double x, double y, double z, double a, double b, double c) {
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_CULL_FACE);
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawing(5);
tessellator.setColorOpaque_I(0xBB3311);
tessellator.addVertex(x, y + 0.05F, z);
tessellator.addVertex(x, y - 0.05F, z);
tessellator.addVertex(a, b + 0.05F, c);
tessellator.addVertex(a, b - 0.05F, c);
tessellator.draw();
tessellator.startDrawing(5);
tessellator.setColorOpaque_I(0xBB3311);
tessellator.addVertex(x + 0.05F, y, z);
tessellator.addVertex(x - 0.05F, y, z);
tessellator.addVertex(a + 0.05F, b, c);
tessellator.addVertex(a - 0.05F, b, c);
tessellator.draw();
tessellator.startDrawing(5);
tessellator.setColorOpaque_I(0xBB3311);
tessellator.addVertex(x, y, z + 0.05F);
tessellator.addVertex(x, y, z - 0.05F);
tessellator.addVertex(a, b, c + 0.05F);
tessellator.addVertex(a, b, c - 0.05F);
tessellator.draw();
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_CULL_FACE);
}
}

View File

@ -0,0 +1,136 @@
package com.hbm.render.tileentity;
import org.lwjgl.opengl.GL11;
import com.hbm.tileentity.network.TileEntityPylonBase;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
public abstract class RenderPylonBase extends TileEntitySpecialRenderer {
//TODO: adapt this into a more generic form for multi wire pylons
public void renderSingleLine(TileEntityPylonBase pyl, double x, double y, double z) {
for(int i = 0; i < pyl.connected.size(); i++) {
int[] wire = pyl.connected.get(i);
TileEntity tile = pyl.getWorldObj().getTileEntity(wire[0], wire[1], wire[2]);
if(tile instanceof TileEntityPylonBase) {
TileEntityPylonBase pylon = (TileEntityPylonBase) tile;
Vec3 myOffset = pyl.getMountPos();
Vec3 theirOffset = pylon.getMountPos();
double conX0 = pyl.xCoord + myOffset.xCoord;
double conY0 = pyl.yCoord + myOffset.yCoord;
double conZ0 = pyl.zCoord + myOffset.zCoord;
double conX1 = pylon.xCoord + theirOffset.xCoord;
double conY1 = pylon.yCoord + theirOffset.yCoord;
double conZ1 = pylon.zCoord + theirOffset.zCoord;
double wX = (conX1 - conX0) / 2D;
double wY = (conY1 - conY0) / 2D;
double wZ = (conZ1 - conZ0) / 2D;
float count = 10;
Vec3 delta = Vec3.createVectorHelper(conX1 - conX0, conY1 - conY0, conZ1 - conZ0);
for(float j = 0; j < count; j++) {
float k = j + 1;
double ja = j + 0.5D;
double ix = conX0 + delta.xCoord / (double)(count * 2) * ja;
double iy = conY0 + delta.yCoord / (double)(count * 2) * ja - Math.sin(j / count * Math.PI * 0.5);
double iz = conZ0 + delta.zCoord / (double)(count * 2) * ja;
//pylon.getWorldObj().spawnParticle("reddust", ix, iy, iz, 0.01 + j * 0.1, 0, 0);
int brightness = pyl.getWorldObj().getLightBrightnessForSkyBlocks(MathHelper.floor_double(ix), MathHelper.floor_double(iy), MathHelper.floor_double(iz), 0);
int lX = brightness % 65536;
int lY = brightness / 65536;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)lX / 1.0F, (float)lY / 1.0F);
drawPowerLine(
x + myOffset.xCoord + (wX * j / count),
y + myOffset.yCoord + (wY * j / count) - Math.sin(j / count * Math.PI * 0.5),
z + myOffset.zCoord + (wZ * j / count),
x + myOffset.xCoord + (wX * k / count),
y + myOffset.yCoord + (wY * k / count) - Math.sin(k / count * Math.PI * 0.5),
z + myOffset.zCoord + (wZ * k / count));
}
}
}
}
public void renderLine(World world, TileEntityPylonBase pyl, double x, double y, double z, double x0, double y0, double z0, double x1, double y1, double z1) {
GL11.glTranslated(x, y, z);
float count = 10;
for(float j = 0; j < count; j++) {
float k = j + 1;
double deltaX = x1 - x0;
double deltaY = y1 - y0;
double deltaZ = z1 - z0;
double ja = j + 0.5D;
double ix = pyl.xCoord + x0 + deltaX / (double)(count * 2) * ja;
double iy = pyl.yCoord + y0 + deltaY / (double)(count * 2) * ja - Math.sin(j / count * Math.PI * 0.5);
double iz = pyl.zCoord + z0 + deltaZ / (double)(count * 2) * ja;
int brightness = world.getLightBrightnessForSkyBlocks(MathHelper.floor_double(ix), MathHelper.floor_double(iy), MathHelper.floor_double(iz), 0);
int lX = brightness % 65536;
int lY = brightness / 65536;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)lX / 1.0F, (float)lY / 1.0F);
drawPowerLine(
x0 + (deltaX * j / count),
y0 + (deltaY * j / count) - Math.sin(j / count * Math.PI * 0.5),
z0 + (deltaZ * j / count),
x0 + (deltaX * k / count),
y0 + (deltaY * k / count) - Math.sin(k / count * Math.PI * 0.5),
z0 + (deltaZ * k / count));
}
}
public void drawPowerLine(double x, double y, double z, double a, double b, double c) {
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_CULL_FACE);
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawing(5);
tessellator.setColorOpaque_I(0xBB3311);
tessellator.addVertex(x, y + 0.05F, z);
tessellator.addVertex(x, y - 0.05F, z);
tessellator.addVertex(a, b + 0.05F, c);
tessellator.addVertex(a, b - 0.05F, c);
tessellator.draw();
tessellator.startDrawing(5);
tessellator.setColorOpaque_I(0xBB3311);
tessellator.addVertex(x + 0.05F, y, z);
tessellator.addVertex(x - 0.05F, y, z);
tessellator.addVertex(a + 0.05F, b, c);
tessellator.addVertex(a - 0.05F, b, c);
tessellator.draw();
tessellator.startDrawing(5);
tessellator.setColorOpaque_I(0xBB3311);
tessellator.addVertex(x, y, z + 0.05F);
tessellator.addVertex(x, y, z - 0.05F);
tessellator.addVertex(a, b, c + 0.05F);
tessellator.addVertex(a, b, c - 0.05F);
tessellator.draw();
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_CULL_FACE);
}
}

View File

@ -73,6 +73,7 @@ public class TileMappings {
put(TileEntityGasDuct.class, "tileentity_gas_duct");
put(TileEntityGasDuctSolid.class, "tileentity_gas_duct_solid");
put(TileEntityMachineRTG.class, "tileentity_machine_rtg");
put(TileEntityConnector.class, "tileentity_connector_redwire");
put(TileEntityPylon.class, "tileentity_pylon_redwire");
put(TileEntityStructureMarker.class, "tileentity_structure_marker");
put(TileEntityMachineMiningDrill.class, "tileentity_mining_drill");

View File

@ -28,52 +28,12 @@ public class TileEntityMachineAmgen extends TileEntity implements IEnergyGenerat
if(block == ModBlocks.machine_amgen) {
float rad = ChunkRadiationManager.proxy.getRadiation(worldObj, xCoord, yCoord, zCoord);
power += rad;
ChunkRadiationManager.proxy.decrementRad(worldObj, xCoord, yCoord, zCoord, 5F);
} else if(block == ModBlocks.machine_geo) {
Block b = worldObj.getBlock(xCoord, yCoord - 1, zCoord);
if(b == ModBlocks.geysir_water) {
power += 75;
} else if(b == ModBlocks.geysir_chlorine) {
power += 100;
} else if(b == ModBlocks.geysir_vapor) {
power += 50;
} else if(b == ModBlocks.geysir_nether) {
power += 500;
} else if(b == Blocks.lava) {
power += 100;
if(worldObj.rand.nextInt(1200) == 0) {
worldObj.setBlock(xCoord, yCoord - 1, zCoord, Blocks.obsidian);
}
} else if(b == Blocks.flowing_lava) {
power += 25;
if(worldObj.rand.nextInt(600) == 0) {
worldObj.setBlock(xCoord, yCoord - 1, zCoord, Blocks.cobblestone);
}
}
b = worldObj.getBlock(xCoord, yCoord + 1, zCoord);
if(b == Blocks.lava) {
power += 100;
if(worldObj.rand.nextInt(1200) == 0) {
worldObj.setBlock(xCoord, yCoord + 1, zCoord, Blocks.obsidian);
}
} else if(b == Blocks.flowing_lava) {
power += 25;
if(worldObj.rand.nextInt(600) == 0) {
worldObj.setBlock(xCoord, yCoord + 1, zCoord, Blocks.cobblestone);
}
}
this.checkGeoInteraction(xCoord, yCoord + 1, zCoord);
this.checkGeoInteraction(xCoord, yCoord - 1, zCoord);
}
if(power > maxPower)
@ -83,6 +43,33 @@ public class TileEntityMachineAmgen extends TileEntity implements IEnergyGenerat
this.sendPower(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir);
}
}
private void checkGeoInteraction(int x, int y, int z) {
Block b = worldObj.getBlock(x, y, z);
if(b == ModBlocks.geysir_water) {
power += 75;
} else if(b == ModBlocks.geysir_chlorine) {
power += 100;
} else if(b == ModBlocks.geysir_vapor) {
power += 50;
} else if(b == ModBlocks.geysir_nether) {
power += 500;
} else if(b == Blocks.lava) {
power += 100;
if(worldObj.rand.nextInt(6000) == 0) {
worldObj.setBlock(xCoord, yCoord - 1, zCoord, Blocks.obsidian);
}
} else if(b == Blocks.flowing_lava) {
power += 25;
if(worldObj.rand.nextInt(3000) == 0) {
worldObj.setBlock(xCoord, yCoord - 1, zCoord, Blocks.cobblestone);
}
}
}
@Override
public long getPower() {

View File

@ -1,6 +1,7 @@
package com.hbm.tileentity.machine;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import com.hbm.handler.FluidTypeHandler.FluidType;
@ -132,25 +133,23 @@ public class TileEntityMachineDiesel extends TileEntityMachineBase implements IE
return getHEFromFuel() > 0;
}
public static final HashMap<FluidType, Integer> fuels = new HashMap();
static {
fuels.put(FluidType.HYDROGEN, 10);
fuels.put(FluidType.DIESEL, 500);
fuels.put(FluidType.PETROIL, 300);
fuels.put(FluidType.BIOFUEL, 400);
fuels.put(FluidType.GASOLINE, 1500);
fuels.put(FluidType.NITAN, 5000);
fuels.put(FluidType.LPG, 450);
fuels.put(FluidType.ETHANOL, 200);
}
public int getHEFromFuel() {
FluidType type = tank.getTankType();
if(type.name().equals(FluidType.HYDROGEN.name()))
return 10;
if(type.name().equals(FluidType.DIESEL.name()))
return 500;
if(type.name().equals(FluidType.PETROIL.name()))
return 300;
if(type.name().equals(FluidType.BIOFUEL.name()))
return 400;
if(type.name().equals(FluidType.GASOLINE.name()))
return 1500;
if(type.name().equals(FluidType.NITAN.name()))
return 5000;
if(type.name().equals(FluidType.LPG.name()))
return 450;
if(type.name().equals(FluidType.ETHANOL.name()))
return 200;
return 0;
Integer value = fuels.get(type);
return value != null ? value : null;
}
public void generate() {
@ -166,7 +165,7 @@ public class TileEntityMachineDiesel extends TileEntityMachineBase implements IE
if (soundCycle >= 3)
soundCycle = 0;
tank.setFill(tank.getFill() - 10);
tank.setFill(tank.getFill() - 1);
if (tank.getFill() < 0)
tank.setFill(0);

View File

@ -1,6 +1,7 @@
package com.hbm.tileentity.machine;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import com.hbm.handler.FluidTypeHandler.FluidType;
@ -255,29 +256,27 @@ public class TileEntityMachineSeleniumEngine extends TileEntity implements ISide
return getHEFromFuel() > 0;
}
public static final HashMap<FluidType, Integer> fuels = new HashMap();
static {
fuels.put(FluidType.SMEAR, 50);
fuels.put(FluidType.HEATINGOIL, 75);
fuels.put(FluidType.HYDROGEN, 5);
fuels.put(FluidType.DIESEL, 225);
fuels.put(FluidType.KEROSENE, 300);
fuels.put(FluidType.RECLAIMED, 100);
fuels.put(FluidType.PETROIL, 125);
fuels.put(FluidType.BIOFUEL, 200);
fuels.put(FluidType.GASOLINE, 700);
fuels.put(FluidType.NITAN, 2500);
fuels.put(FluidType.LPG, 200);
fuels.put(FluidType.ETHANOL, 75);
}
public int getHEFromFuel() {
FluidType type = tank.getTankType();
if(type.name().equals(FluidType.SMEAR.name()))
return 50;
if(type.name().equals(FluidType.HEATINGOIL.name()))
return 75;
if(type.name().equals(FluidType.HYDROGEN.name()))
return 5;
if(type.name().equals(FluidType.DIESEL.name()))
return 225;
if(type.name().equals(FluidType.KEROSENE.name()))
return 300;
if(type.name().equals(FluidType.RECLAIMED.name()))
return 100;
if(type.name().equals(FluidType.PETROIL.name()))
return 125;
if(type.name().equals(FluidType.BIOFUEL.name()))
return 200;
if(type.name().equals(FluidType.GASOLINE.name()))
return 700;
if(type.name().equals(FluidType.NITAN.name()))
return 2500;
return 0;
Integer value = fuels.get(type);
return value != null ? value : null;
}
public void generate() {
@ -294,8 +293,8 @@ public class TileEntityMachineSeleniumEngine extends TileEntity implements ISide
if (soundCycle >= 3)
soundCycle = 0;
tank.setFill(tank.getFill() - this.pistonCount * 5);
if (tank.getFill() < 0)
tank.setFill(tank.getFill() - this.pistonCount);
if(tank.getFill() < 0)
tank.setFill(0);
power += getHEFromFuel() * Math.pow(this.pistonCount, 1.15D);

View File

@ -0,0 +1,22 @@
package com.hbm.tileentity.network;
import net.minecraft.util.Vec3;
public class TileEntityConnector extends TileEntityPylonBase {
@Override
public ConnectionType getConnectionType() {
return ConnectionType.SINGLE;
}
@Override
public Vec3 getMountPos() {
return Vec3.createVectorHelper(0.5, 0.5, 0.5);
}
@Override
public double getMaxWireLength() {
return 10;
}
}

View File

@ -14,7 +14,7 @@ public class TileEntityPylon extends TileEntityPylonBase {
@Override
public Vec3 getMountPos() {
return Vec3.createVectorHelper(xCoord + 0.5, yCoord + 5.4, zCoord + 0.5);
return Vec3.createVectorHelper(0.5, 5.4, 0.5);
}
@Override

Binary file not shown.

After

Width:  |  Height:  |  Size: 725 B