New explosion animation, CIWS texture, new lil boy texture, bug fixes
@ -9,7 +9,7 @@ achievement.sacrifice.desc=Überlebe den Flammentod.
|
||||
achievement.impossible=Vollkommen unmöglich
|
||||
achievement.impossible.desc=Du kannst diese Errungenschaft nicht bekommen.
|
||||
|
||||
potion.hbm_taint=Verseucht
|
||||
potion.hbm_taint=Verdorben
|
||||
|
||||
hbmfluid.none=Nichts
|
||||
hbmfluid.water=Wasser
|
||||
@ -199,8 +199,8 @@ tile.turret_flamer.name=Flammenwerfergeschütz
|
||||
tile.turret_tau.name=Tauonengeschütz
|
||||
tile.turret_spitfire.name=Geschütz für das ich noch keinen Namen habe [WIP]
|
||||
tile.turret_cwis.name=Phalanx Mk-15 CIWS
|
||||
tile.machine_radar.name=Raketenradar
|
||||
container.radar=Raketenradar
|
||||
tile.machine_radar.name=Radar
|
||||
container.radar=Radar
|
||||
|
||||
item.turret_control.name=Geschützsteuerung
|
||||
item.turret_chip.name=Geschütz-KI-Chip
|
||||
@ -1190,6 +1190,7 @@ tile.yellow_barrel.name=Radioaktives Fass
|
||||
item.designator.name=Kurzdistanz Zielmarkierer
|
||||
item.designator_range.name=Weitstrecken-Zielmarkierer
|
||||
item.designator_manual.name=Manueller Zielmarkierer
|
||||
item.missile_assembly.name=Kleines Raketen-Bauset
|
||||
item.missile_generic.name=HE Rakete
|
||||
item.missile_anti_ballistic.name=Flugabwehrrakete (WIP)
|
||||
item.missile_incendiary.name=Brandrakete
|
||||
@ -1208,7 +1209,8 @@ item.missile_nuclear_cluster.name=Atomare MIRV-Rakete
|
||||
item.missile_endo.name=Endothermische Rakete
|
||||
item.missile_exo.name=Exothermische Rakete
|
||||
item.missile_doomsday.name=Doomsday Rakete
|
||||
item.missile_taint.name=Verseuchte Rakete
|
||||
item.missile_taint.name=Verdorbene Rakete
|
||||
item.missile_micro.name=Mikro-Atomrakete
|
||||
|
||||
item.hazmat_helmet.name=Strahlenschutzhelm
|
||||
item.hazmat_plate.name=Strahlenschutzbrustplatte
|
||||
|
||||
@ -210,8 +210,8 @@ tile.turret_flamer.name=Flamethrower Turret
|
||||
tile.turret_tau.name=Tauon Turret
|
||||
tile.turret_spitfire.name=Turret I have no name for right now [WIP]
|
||||
tile.turret_cwis.name=Phalanx Mk-15 CIWS
|
||||
tile.machine_radar.name=Missile Radar
|
||||
container.radar=Missile Radar
|
||||
tile.machine_radar.name=Radar
|
||||
container.radar=Radar
|
||||
|
||||
item.turret_control.name=Turret Controller
|
||||
item.turret_chip.name=Turret AI-Chip
|
||||
@ -1193,6 +1193,7 @@ tile.yellow_barrel.name=Radioactive Barrel
|
||||
item.designator.name=Short Range Target Designator
|
||||
item.designator_range.name=Long Range Target Designator
|
||||
item.designator_manual.name=Manual Target Designator
|
||||
item.missile_assembly.name=Small Missle Assembly
|
||||
item.missile_generic.name=High Explosive Missile
|
||||
item.missile_anti_ballistic.name=Anti Ballistic Missile (WIP)
|
||||
item.missile_incendiary.name=Incendiary Missile
|
||||
@ -1212,6 +1213,7 @@ item.missile_endo.name=Endothermic Missile
|
||||
item.missile_exo.name=Exothermic Missile
|
||||
item.missile_doomsday.name=Doomsday Missile
|
||||
item.missile_taint.name=Taint-Tipped Missile
|
||||
item.missile_micro.name=Micro-Nuclear Missile
|
||||
|
||||
item.hazmat_helmet.name=Hazmat Helmet
|
||||
item.hazmat_plate.name=Hazmat Chestplate
|
||||
|
||||
2086
assets/hbm/models/mush.hmf
Normal file
2086
assets/hbm/models/mush.obj
Normal file
BIN
assets/hbm/textures/blocks/bomb_emp_side.png
Normal file
|
After Width: | Height: | Size: 500 B |
BIN
assets/hbm/textures/blocks/bomb_emp_top.png
Normal file
|
After Width: | Height: | Size: 575 B |
BIN
assets/hbm/textures/hazmat blocs1.png
Normal file
|
After Width: | Height: | Size: 144 B |
BIN
assets/hbm/textures/hazmat blocs10.png
Normal file
|
After Width: | Height: | Size: 916 B |
BIN
assets/hbm/textures/hazmat blocs11.png
Normal file
|
After Width: | Height: | Size: 849 B |
BIN
assets/hbm/textures/hazmat blocs12.png
Normal file
|
After Width: | Height: | Size: 877 B |
BIN
assets/hbm/textures/hazmat blocs2.png
Normal file
|
After Width: | Height: | Size: 336 B |
BIN
assets/hbm/textures/hazmat blocs3.png
Normal file
|
After Width: | Height: | Size: 356 B |
BIN
assets/hbm/textures/hazmat blocs4.png
Normal file
|
After Width: | Height: | Size: 191 B |
BIN
assets/hbm/textures/hazmat blocs5.png
Normal file
|
After Width: | Height: | Size: 394 B |
BIN
assets/hbm/textures/hazmat blocs6.png
Normal file
|
After Width: | Height: | Size: 501 B |
BIN
assets/hbm/textures/hazmat blocs8.png
Normal file
|
After Width: | Height: | Size: 168 B |
BIN
assets/hbm/textures/hazmat blocs9.png
Normal file
|
After Width: | Height: | Size: 484 B |
BIN
assets/hbm/textures/hazmat blocsDirty1.png
Normal file
|
After Width: | Height: | Size: 563 B |
BIN
assets/hbm/textures/hazmat blocsDirty2.png
Normal file
|
After Width: | Height: | Size: 604 B |
BIN
assets/hbm/textures/hazmat blocsDirty3.png
Normal file
|
After Width: | Height: | Size: 611 B |
BIN
assets/hbm/textures/hazmat blocsDirty4.png
Normal file
|
After Width: | Height: | Size: 592 B |
BIN
assets/hbm/textures/hazmat blocsDirty5.png
Normal file
|
After Width: | Height: | Size: 599 B |
BIN
assets/hbm/textures/hazmat blocsDirty6.png
Normal file
|
After Width: | Height: | Size: 613 B |
BIN
assets/hbm/textures/hazmat blocsDirty7.png
Normal file
|
After Width: | Height: | Size: 603 B |
BIN
assets/hbm/textures/hazmat blocsnuke1.png
Normal file
|
After Width: | Height: | Size: 433 B |
BIN
assets/hbm/textures/hazmat blocsnuke2.png
Normal file
|
After Width: | Height: | Size: 441 B |
|
Before Width: | Height: | Size: 298 B After Width: | Height: | Size: 296 B |
BIN
assets/hbm/textures/items/filter_blue.png
Normal file
|
After Width: | Height: | Size: 343 B |
BIN
assets/hbm/textures/items/missile_assembly.png
Normal file
|
After Width: | Height: | Size: 316 B |
|
Before Width: | Height: | Size: 692 KiB After Width: | Height: | Size: 16 KiB |
BIN
assets/hbm/textures/models/cwis_base.png
Normal file
|
After Width: | Height: | Size: 6.1 KiB |
BIN
assets/hbm/textures/models/cwis_gun.png
Normal file
|
After Width: | Height: | Size: 5.1 KiB |
BIN
assets/hbm/textures/models/cwis_head.png
Normal file
|
After Width: | Height: | Size: 6.1 KiB |
BIN
assets/hbm/textures/models/cwis_rotor.png
Normal file
|
After Width: | Height: | Size: 5.4 KiB |
BIN
assets/hbm/textures/models/fireball.png
Normal file
|
After Width: | Height: | Size: 1.3 MiB |
@ -11,9 +11,7 @@ public class EntityNukeCloudSmall extends Entity {
|
||||
|
||||
public int maxAge = 1000;
|
||||
public int age;
|
||||
public float scale = 0;
|
||||
public float ring = 0;
|
||||
public float height = 0;
|
||||
public float scale = 1;
|
||||
|
||||
public EntityNukeCloudSmall(World p_i1582_1_) {
|
||||
super(p_i1582_1_);
|
||||
@ -21,9 +19,6 @@ public class EntityNukeCloudSmall extends Entity {
|
||||
this.ignoreFrustumCheck = true;
|
||||
this.isImmuneToFire = true;
|
||||
this.age = 0;
|
||||
scale = 0;
|
||||
ring = 0;
|
||||
height = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -57,41 +52,17 @@ public class EntityNukeCloudSmall extends Entity {
|
||||
this.age = 0;
|
||||
this.setDead();
|
||||
}
|
||||
ring += 0.03F;
|
||||
|
||||
if(age < 150)
|
||||
{
|
||||
height = -60F + ((age - 100) * 60 / 50);
|
||||
if(scale < 1.5)
|
||||
{
|
||||
scale += 0.006f;
|
||||
}
|
||||
}
|
||||
|
||||
if(age > 100)
|
||||
{
|
||||
if(scale < 1.5)
|
||||
{
|
||||
scale += 0.02;
|
||||
}
|
||||
} else {
|
||||
scale = 0;
|
||||
}
|
||||
|
||||
this.dataWatcher.updateObject(16, (short)maxAge);
|
||||
this.dataWatcher.updateObject(17, (short)age);
|
||||
this.dataWatcher.updateObject(18, (short)scale);
|
||||
this.dataWatcher.updateObject(19, (short)ring);
|
||||
this.dataWatcher.updateObject(20, (short)height);
|
||||
this.dataWatcher.updateObject(18, (float)scale);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
this.dataWatcher.addObject(16, (short)maxAge);
|
||||
this.dataWatcher.addObject(17, (short)age);
|
||||
this.dataWatcher.addObject(18, (short)scale);
|
||||
this.dataWatcher.addObject(19, (short)ring);
|
||||
this.dataWatcher.addObject(20, (short)height);
|
||||
this.dataWatcher.addObject(18, (float)scale);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -99,17 +70,13 @@ public class EntityNukeCloudSmall extends Entity {
|
||||
maxAge = p_70037_1_.getShort("maxAge");
|
||||
age = p_70037_1_.getShort("age");
|
||||
scale = p_70037_1_.getShort("scale");
|
||||
ring = p_70037_1_.getShort("ring");
|
||||
height = p_70037_1_.getShort("height");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeEntityToNBT(NBTTagCompound p_70014_1_) {
|
||||
p_70014_1_.setShort("maxAge", (short)maxAge);
|
||||
p_70014_1_.setShort("age", (short)age);
|
||||
p_70014_1_.setShort("scale", (short)scale);
|
||||
p_70014_1_.setShort("ring", (short)ring);
|
||||
p_70014_1_.setShort("height", (short)height);
|
||||
p_70014_1_.setFloat("scale", (float)scale);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -72,8 +72,11 @@ public class EntityNukeExplosionMK4 extends Entity {
|
||||
}
|
||||
|
||||
public static EntityNukeExplosionMK4 statFac(World world, int r, double x, double y, double z) {
|
||||
|
||||
r *= 2;
|
||||
|
||||
EntityNukeExplosionMK4 mk4 = new EntityNukeExplosionMK4(world);
|
||||
mk4.strength = (int)(r / 1.5);
|
||||
mk4.strength = (int)(r);
|
||||
mk4.count = (int)(4 * Math.PI * Math.pow(mk4.strength, 2) * 25);
|
||||
mk4.speed = (int)Math.ceil(100000 / mk4.strength);
|
||||
mk4.setPosition(x, y, z);
|
||||
|
||||
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.entity.logic.EntityNukeExplosionMK3;
|
||||
import com.hbm.entity.logic.EntityNukeExplosionMK4;
|
||||
import com.hbm.entity.particle.EntitySmokeFX;
|
||||
import com.hbm.explosion.ExplosionLarge;
|
||||
import com.hbm.explosion.ExplosionParticle;
|
||||
@ -29,15 +30,16 @@ public class EntityMissileMicro extends EntityMissileBaseAdvanced {
|
||||
public void onImpact() {
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
EntityNukeExplosionMK3 entity0 = new EntityNukeExplosionMK3(this.worldObj);
|
||||
/*EntityNukeExplosionMK3 entity0 = new EntityNukeExplosionMK3(this.worldObj);
|
||||
entity0.posX = this.posX;
|
||||
entity0.posY = this.posY;
|
||||
entity0.posZ = this.posZ;
|
||||
entity0.destructionRange = MainRegistry.fatmanRadius;
|
||||
entity0.speed = MainRegistry.blastSpeed;
|
||||
entity0.coefficient = 10.0F;
|
||||
entity0.coefficient = 10.0F;*/
|
||||
|
||||
this.worldObj.spawnEntityInWorld(entity0);
|
||||
this.worldObj.spawnEntityInWorld(EntityNukeExplosionMK4.statFac(worldObj, MainRegistry.fatmanRadius, posX, posY, posZ));
|
||||
|
||||
if(MainRegistry.polaroidID == 11)
|
||||
if(rand.nextInt(100) >= 0)
|
||||
{
|
||||
@ -59,15 +61,17 @@ public class EntityMissileMicro extends EntityMissileBaseAdvanced {
|
||||
public List<ItemStack> getDebris() {
|
||||
List<ItemStack> list = new ArrayList<ItemStack>();
|
||||
|
||||
list.add(new ItemStack(ModItems.wire_aluminium, 4));
|
||||
list.add(new ItemStack(ModItems.plate_titanium, 4));
|
||||
list.add(new ItemStack(ModItems.thruster_small, 1));
|
||||
list.add(new ItemStack(ModItems.hull_small_aluminium, 2));
|
||||
list.add(new ItemStack(ModItems.ducttape, 1));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getDebrisRareDrop() {
|
||||
return new ItemStack(ModItems.warhead_generic_small);
|
||||
return new ItemStack(ModItems.gun_fatman_ammo, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -6,6 +6,7 @@ import java.util.List;
|
||||
import com.hbm.entity.effect.EntityNukeCloudSmall;
|
||||
import com.hbm.entity.logic.EntityNukeExplosionAdvanced;
|
||||
import com.hbm.entity.logic.EntityNukeExplosionMK3;
|
||||
import com.hbm.entity.logic.EntityNukeExplosionMK4;
|
||||
import com.hbm.entity.particle.EntitySmokeFX;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.main.MainRegistry;
|
||||
@ -26,20 +27,22 @@ public class EntityMissileNuclear extends EntityMissileBaseAdvanced {
|
||||
|
||||
@Override
|
||||
public void onImpact() {
|
||||
EntityNukeExplosionMK3 entity = new EntityNukeExplosionMK3(this.worldObj);
|
||||
/*EntityNukeExplosionMK3 entity = new EntityNukeExplosionMK3(this.worldObj);
|
||||
entity.posX = this.posX;
|
||||
entity.posY = this.posY;
|
||||
entity.posZ = this.posZ;
|
||||
entity.destructionRange = MainRegistry.missileRadius;
|
||||
entity.speed = MainRegistry.blastSpeed;
|
||||
entity.coefficient = 10.0F;
|
||||
entity.coefficient = 10.0F;*/
|
||||
|
||||
this.worldObj.spawnEntityInWorld(entity);
|
||||
this.worldObj.spawnEntityInWorld(EntityNukeExplosionMK4.statFac(worldObj, MainRegistry.missileRadius, posX, posY, posZ));
|
||||
|
||||
EntityNukeCloudSmall entity2 = new EntityNukeCloudSmall(this.worldObj, 300);
|
||||
EntityNukeCloudSmall entity2 = new EntityNukeCloudSmall(this.worldObj, 1000);
|
||||
entity2.posX = this.posX;
|
||||
entity2.posY = this.posY/* - 9*/;
|
||||
entity2.posZ = this.posZ;
|
||||
entity2.scale = 2F;
|
||||
entity2.getDataWatcher().updateObject(18, 2F);
|
||||
this.worldObj.spawnEntityInWorld(entity2);
|
||||
}
|
||||
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
package com.hbm.entity.missile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.blocks.bomb.BlockTaint;
|
||||
import com.hbm.explosion.ExplosionThermo;
|
||||
import com.hbm.items.ModItems;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
@ -34,12 +36,19 @@ public class EntityMissileTaint extends EntityMissileBaseAdvanced {
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDebris() {
|
||||
return null;
|
||||
List<ItemStack> list = new ArrayList<ItemStack>();
|
||||
|
||||
list.add(new ItemStack(ModItems.wire_aluminium, 4));
|
||||
list.add(new ItemStack(ModItems.plate_titanium, 4));
|
||||
list.add(new ItemStack(ModItems.hull_small_aluminium, 2));
|
||||
list.add(new ItemStack(ModItems.powder_magic, 1));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getDebrisRareDrop() {
|
||||
return null;
|
||||
return new ItemStack(ModItems.powder_spark_mix, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -288,7 +288,7 @@ public class ExplosionNukeGeneric {
|
||||
|
||||
if (!(entity instanceof EntityPlayerMP
|
||||
&& ((EntityPlayerMP) entity).theItemInWorldManager.getGameType() == GameType.CREATIVE)) {
|
||||
entity.attackEntityFrom(ModDamageSource.blackhole, Float.POSITIVE_INFINITY);
|
||||
entity.attackEntityFrom(ModDamageSource.blackhole, 10000F);
|
||||
}
|
||||
|
||||
if(!(entity instanceof EntityLivingBase) && !(entity instanceof EntityPlayerMP) && !(entity instanceof EntityBlackHole)) {
|
||||
|
||||
@ -149,9 +149,9 @@ public class ExplosionNukeRay {
|
||||
float z0 = (float) (posZ + (vec.zCoord * i));
|
||||
|
||||
if(!world.getBlock((int)x0, (int)y0, (int)z0).getMaterial().isLiquid())
|
||||
res -= Math.pow(world.getBlock((int)x0, (int)y0, (int)z0).getExplosionResistance(null), 1.0);
|
||||
res -= Math.pow(world.getBlock((int)x0, (int)y0, (int)z0).getExplosionResistance(null), 1.25);
|
||||
else
|
||||
res -= Math.pow(Blocks.air.getExplosionResistance(null), 1.0);
|
||||
res -= Math.pow(Blocks.air.getExplosionResistance(null), 1.25);
|
||||
|
||||
if(res > 0 && world.getBlock((int)x0, (int)y0, (int)z0) != Blocks.air) {
|
||||
lastPos = new FloatTriplet(x0, y0, z0);
|
||||
|
||||
@ -1784,6 +1784,14 @@ public class MachineRecipes {
|
||||
list.add(new ItemStack(ModItems.warhead_generic_large, 1));
|
||||
list.add(new ItemStack(ModItems.powder_fire, 16));
|
||||
break;
|
||||
case MISSILE_ASSEMBLY:
|
||||
list.add(new ItemStack(ModItems.hull_small_steel, 1));
|
||||
list.add(new ItemStack(ModItems.hull_small_aluminium, 4));
|
||||
list.add(new ItemStack(ModItems.ingot_steel, 2));
|
||||
list.add(new ItemStack(ModItems.plate_titanium, 6));
|
||||
list.add(new ItemStack(ModItems.wire_aluminium, 6));
|
||||
list.add(new ItemStack(ModItems.canister_kerosene, 3));
|
||||
break;
|
||||
case WT1_CLUSTER:
|
||||
list.add(new ItemStack(ModItems.warhead_generic_small, 1));
|
||||
list.add(new ItemStack(ModItems.pellet_cluster, 4));
|
||||
@ -3122,6 +3130,9 @@ public class MachineRecipes {
|
||||
case WT3_FIRE:
|
||||
output = new ItemStack(ModItems.warhead_incendiary_large, 1);
|
||||
break;
|
||||
case MISSILE_ASSEMBLY:
|
||||
output = new ItemStack(ModItems.missile_assembly, 1);
|
||||
break;
|
||||
case WT1_CLUSTER:
|
||||
output = new ItemStack(ModItems.warhead_cluster_small, 1);
|
||||
break;
|
||||
|
||||
@ -636,7 +636,8 @@ public class ModItems {
|
||||
public static Item fluid_identifier;
|
||||
public static Item fluid_icon;
|
||||
public static Item siren_track;
|
||||
|
||||
|
||||
public static Item missile_assembly;
|
||||
public static Item missile_generic;
|
||||
public static Item missile_anti_ballistic;
|
||||
public static Item missile_incendiary;
|
||||
@ -1742,6 +1743,7 @@ public class ModItems {
|
||||
designator = new ItemDesingator().setUnlocalizedName("designator").setMaxStackSize(1).setCreativeTab(MainRegistry.tabNuke).setTextureName(RefStrings.MODID + ":designator");
|
||||
designator_range = new ItemDesingatorRange().setUnlocalizedName("designator_range").setFull3D().setMaxStackSize(1).setCreativeTab(MainRegistry.tabNuke).setTextureName(RefStrings.MODID + ":designator_range_alt");
|
||||
designator_manual = new ItemDesingatorManual().setUnlocalizedName("designator_manual").setMaxStackSize(1).setCreativeTab(MainRegistry.tabNuke).setTextureName(RefStrings.MODID + ":designator_manual");
|
||||
missile_assembly = new Item().setUnlocalizedName("missile_assembly").setMaxStackSize(1).setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":missile_assembly");
|
||||
missile_generic = new Item().setUnlocalizedName("missile_generic").setMaxStackSize(1).setCreativeTab(MainRegistry.tabNuke).setTextureName(RefStrings.MODID + ":missile_generic");
|
||||
missile_anti_ballistic = new Item().setUnlocalizedName("missile_anti_ballistic").setMaxStackSize(1).setCreativeTab(MainRegistry.tabNuke).setTextureName(RefStrings.MODID + ":missile_anti_ballistic");
|
||||
missile_incendiary = new Item().setUnlocalizedName("missile_incendiary").setMaxStackSize(1).setCreativeTab(MainRegistry.tabNuke).setTextureName(RefStrings.MODID + ":missile_incendiary");
|
||||
@ -2588,6 +2590,7 @@ public class ModItems {
|
||||
GameRegistry.registerItem(toothpicks, toothpicks.getUnlocalizedName());
|
||||
GameRegistry.registerItem(ducttape, ducttape.getUnlocalizedName());
|
||||
GameRegistry.registerItem(catalyst_clay, catalyst_clay.getUnlocalizedName());
|
||||
GameRegistry.registerItem(missile_assembly, missile_assembly.getUnlocalizedName());
|
||||
GameRegistry.registerItem(warhead_generic_small, warhead_generic_small.getUnlocalizedName());
|
||||
GameRegistry.registerItem(warhead_generic_medium, warhead_generic_medium.getUnlocalizedName());
|
||||
GameRegistry.registerItem(warhead_generic_large, warhead_generic_large.getUnlocalizedName());
|
||||
|
||||
@ -37,11 +37,8 @@ public class ItemPill extends ItemFood {
|
||||
}
|
||||
|
||||
if(this == ModItems.plan_c) {
|
||||
player.attackEntityFrom(rand.nextBoolean() ? ModDamageSource.euthanizedSelf : ModDamageSource.euthanizedSelf2, 100);
|
||||
player.attackEntityFrom(rand.nextBoolean() ? ModDamageSource.euthanizedSelf : ModDamageSource.euthanizedSelf2, 100);
|
||||
player.attackEntityFrom(rand.nextBoolean() ? ModDamageSource.euthanizedSelf : ModDamageSource.euthanizedSelf2, 100);
|
||||
player.attackEntityFrom(rand.nextBoolean() ? ModDamageSource.euthanizedSelf : ModDamageSource.euthanizedSelf2, 100);
|
||||
player.attackEntityFrom(rand.nextBoolean() ? ModDamageSource.euthanizedSelf : ModDamageSource.euthanizedSelf2, 100);
|
||||
for(int i = 0; i < 10; i++)
|
||||
player.attackEntityFrom(rand.nextBoolean() ? ModDamageSource.euthanizedSelf : ModDamageSource.euthanizedSelf2, 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,6 +33,7 @@ public class ItemAssemblyTemplate extends Item {
|
||||
TELEPAD, TELEKIT,
|
||||
GEASS_REACTOR,
|
||||
GENERATOR_FRONT,
|
||||
MISSILE_ASSEMBLY,
|
||||
WT1_GENERIC,
|
||||
WT2_GENERIC,
|
||||
WT3_GENERIC,
|
||||
@ -329,6 +330,8 @@ public class ItemAssemblyTemplate extends Item {
|
||||
return 200;
|
||||
case GENERATOR_FRONT:
|
||||
return 200;
|
||||
case MISSILE_ASSEMBLY:
|
||||
return 200;
|
||||
case WT1_GENERIC:
|
||||
return 100;
|
||||
case WT2_GENERIC:
|
||||
|
||||
@ -81,8 +81,10 @@ public class GunLeverActionS extends Item {
|
||||
p_77615_3_.inventory.consumeInventoryItem(ModItems.gun_lever_action_ammo);
|
||||
|
||||
p_77615_1_.damageItem(1, p_77615_3_);
|
||||
|
||||
p_77615_3_.attackEntityFrom(ModDamageSource.suicide, 1000);
|
||||
|
||||
p_77615_3_.attackEntityFrom(ModDamageSource.suicide, 10000);
|
||||
if(!p_77615_3_.capabilities.isCreativeMode)
|
||||
p_77615_3_.setHealth(0.0F);
|
||||
|
||||
p_77615_2_.playSoundAtEntity(p_77615_3_, "hbm:weapon.revolverShootAlt", 5.0F, 0.75F);
|
||||
|
||||
|
||||
@ -86,7 +86,9 @@ public class GunSuicide extends Item {
|
||||
|
||||
if (!p_77615_2_.isRemote)
|
||||
{
|
||||
p_77615_3_.attackEntityFrom(ModDamageSource.suicide, 100000);
|
||||
p_77615_3_.attackEntityFrom(ModDamageSource.suicide, 10000);
|
||||
if(!p_77615_3_.capabilities.isCreativeMode)
|
||||
p_77615_3_.setHealth(0.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
import net.minecraft.client.renderer.entity.RenderSnowball;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import net.minecraftforge.client.model.AdvancedModelLoader;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
@ -19,6 +20,7 @@ import com.hbm.render.block.*;
|
||||
import com.hbm.render.entity.*;
|
||||
import com.hbm.render.item.*;
|
||||
import com.hbm.render.tileentity.*;
|
||||
import com.hbm.render.util.HmfModelLoader;
|
||||
import com.hbm.tileentity.bomb.*;
|
||||
import com.hbm.tileentity.conductor.*;
|
||||
import com.hbm.tileentity.deco.*;
|
||||
@ -33,6 +35,8 @@ public class ClientProxy extends ServerProxy
|
||||
public void registerRenderInfo()
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.register(new ModEventHandlerClient());
|
||||
|
||||
AdvancedModelLoader.registerModelHandler(new HmfModelLoader());
|
||||
|
||||
RenderingRegistry.registerBlockHandler(new RenderTaintBlock());
|
||||
|
||||
@ -125,7 +129,7 @@ public class ClientProxy extends ServerProxy
|
||||
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCrashedBomb.class, new RenderCrashedBomb());
|
||||
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityNukeCloudSmall.class, new RenderSmallNukeAlt());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityNukeCloudSmall.class, new RenderSmallNukeMK3());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityNukeCloudBig.class, new RenderBigNuke());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityCloudFleija.class, new RenderCloudFleija());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityCloudFleijaRainbow.class, new RenderCloudRainbow());
|
||||
|
||||
@ -497,6 +497,8 @@ public class CraftingManager {
|
||||
//GameRegistry.addRecipe(new ItemStack(ModItems.missile_nuclear_cluster, 1), new Object[] { "W", "T", "M", 'W', ModItems.warhead_mirv, 'T', ModItems.fuel_tank_large, 'M', ModItems.thruster_large });
|
||||
//GameRegistry.addRecipe(new ItemStack(ModItems.missile_endo, 1), new Object[] { "W", "T", "M", 'W', ModItems.warhead_thermo_endo, 'T', ModItems.fuel_tank_large, 'M', ModItems.thruster_large });
|
||||
//GameRegistry.addRecipe(new ItemStack(ModItems.missile_exo, 1), new Object[] { "W", "T", "M", 'W', ModItems.warhead_thermo_exo, 'T', ModItems.fuel_tank_large, 'M', ModItems.thruster_large });
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.missile_taint, 1), new Object[] { ModItems.missile_assembly, ModItems.bucket_mud, ModItems.powder_spark_mix, ModItems.powder_magic });
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.missile_micro, 1), new Object[] { ModItems.missile_assembly, ModItems.ducttape, ModItems.gun_fatman_ammo });
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.machine_difurnace_off), 1), new Object[] { "AHA", "TCT", "TPT", 'T', "plateIron", 'A', "plateAluminum", 'S', "plateSteel", 'C', "ingotCopper", 'P', Item.getItemFromBlock(Blocks.piston), 'H', Item.getItemFromBlock(Blocks.hopper) }));
|
||||
//GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.machine_centrifuge), 1), new Object[] { " T ", "RDR", "RSR", 'S', "plateSteel", 'T', ModItems.centrifuge_tower, 'W', ModItems.coil_tungsten, 'R', ModItems.coil_copper, 'D', Item.getItemFromBlock(ModBlocks.machine_difurnace_off) }));
|
||||
|
||||
@ -20,6 +20,7 @@ import net.minecraft.stats.Achievement;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraftforge.client.model.AdvancedModelLoader;
|
||||
import net.minecraftforge.common.AchievementPage;
|
||||
import net.minecraftforge.common.ForgeChunkManager;
|
||||
import net.minecraftforge.common.ForgeChunkManager.LoadingCallback;
|
||||
@ -160,6 +161,7 @@ import com.hbm.lib.Library;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.potion.PotionEffectTaint;
|
||||
import com.hbm.render.util.HmfModelLoader;
|
||||
import com.hbm.tileentity.bomb.TileEntityBombMulti;
|
||||
import com.hbm.tileentity.bomb.TileEntityCrashedBomb;
|
||||
import com.hbm.tileentity.bomb.TileEntityLaunchPad;
|
||||
@ -588,7 +590,7 @@ public class MainRegistry
|
||||
EntityRegistry.registerModEntity(EntityGrenadeFire.class, "entity_grenade_fire", 6, this, 250, 1, true);
|
||||
EntityRegistry.registerModEntity(EntityGrenadeCluster.class, "entity_grenade_cluster", 7, this, 250, 1, true);
|
||||
EntityRegistry.registerModEntity(EntityTestMissile.class, "entity_test_missile", 8, this, 1000, 1, true);
|
||||
EntityRegistry.registerModEntity(EntityNukeCloudSmall.class, "entity_nuke_cloud_small", 9, this, 1000, 1, true);
|
||||
EntityRegistry.registerModEntity(EntityNukeCloudSmall.class, "entity_nuke_cloud_small", 9, this, 10000, 1, true);
|
||||
EntityRegistry.registerModEntity(EntityBullet.class, "entity_bullet", 10, this, 250, 1, true);
|
||||
EntityRegistry.registerModEntity(EntityGrenadeFlare.class, "entity_grenade_flare", 11, this, 500, 1, true);
|
||||
EntityRegistry.registerModEntity(EntityGrenadeElectric.class, "entity_grenade_electric", 12, this, 500, 1, true);
|
||||
|
||||
@ -77,6 +77,10 @@ public class ResourceManager {
|
||||
public static final ResourceLocation turret_flamer_gun_tex = new ResourceLocation(RefStrings.MODID, "textures/models/turret_flamer_gun.png");
|
||||
public static final ResourceLocation turret_tau_rotor_tex = new ResourceLocation(RefStrings.MODID, "textures/models/turret_tau_rotor.png");
|
||||
public static final ResourceLocation turret_tau_gun_tex = new ResourceLocation(RefStrings.MODID, "textures/models/turret_tau_gun.png");
|
||||
public static final ResourceLocation turret_ciws_base_tex = new ResourceLocation(RefStrings.MODID, "textures/models/cwis_base.png");
|
||||
public static final ResourceLocation turret_ciws_rotor_tex = new ResourceLocation(RefStrings.MODID, "textures/models/cwis_rotor.png");
|
||||
public static final ResourceLocation turret_ciws_head_tex = new ResourceLocation(RefStrings.MODID, "textures/models/cwis_head.png");
|
||||
public static final ResourceLocation turret_ciws_gun_tex = new ResourceLocation(RefStrings.MODID, "textures/models/cwis_gun.png");
|
||||
|
||||
//Pumpjack
|
||||
public static final ResourceLocation pumpjack_base_tex = new ResourceLocation(RefStrings.MODID, "textures/models/pumpjack_base.png");
|
||||
|
||||
@ -57,7 +57,6 @@ public class RenderNoCloud extends Render {
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glTranslatef(0.0F, 18F, 0.0F);
|
||||
//ring += 0.1F;
|
||||
GL11.glScalef(p_76986_1_.ring * 10, 30F, p_76986_1_.ring * 10);
|
||||
|
||||
bindTexture(ringTexture);
|
||||
ringModel.renderAll();
|
||||
|
||||
@ -97,7 +97,6 @@ public class RenderSmallNukeAlt extends Render {
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glTranslatef(0.0F, 18F, 0.0F);
|
||||
//ring += 0.1F;
|
||||
GL11.glScalef(p_76986_1_.ring * 10, 30F, p_76986_1_.ring * 10);
|
||||
|
||||
bindTexture(ringTexture);
|
||||
ringModel.renderAll();
|
||||
|
||||
@ -19,7 +19,8 @@ import net.minecraftforge.client.model.IModelCustom;
|
||||
|
||||
public class RenderSmallNukeMK3 extends Render {
|
||||
|
||||
private static final ResourceLocation objTesterModelRL = new ResourceLocation(/*"/assets/" + */RefStrings.MODID, "models/NukeCloudSmall.obj");
|
||||
//what the fuck is all this, i thought you made the resource manager
|
||||
private static final ResourceLocation objTesterModelRL = new ResourceLocation(/*"/assets/" + */RefStrings.MODID, "models/mush.hmf");
|
||||
private IModelCustom blastModel;
|
||||
private ResourceLocation blastTexture;
|
||||
private static final ResourceLocation ringModelRL = new ResourceLocation(/*"/assets/" + */RefStrings.MODID, "models/Ring.obj");
|
||||
@ -31,9 +32,10 @@ public class RenderSmallNukeMK3 extends Render {
|
||||
public float scale = 0;
|
||||
public float ring = 0;
|
||||
|
||||
//can't you just instantiate the AMLs as a whole like a normal person smh
|
||||
public RenderSmallNukeMK3() {
|
||||
blastModel = AdvancedModelLoader.loadModel(objTesterModelRL);
|
||||
blastTexture = new ResourceLocation(RefStrings.MODID, "textures/models/NukeCloudFire.png");
|
||||
blastTexture = new ResourceLocation(RefStrings.MODID, "textures/models/fireball.png");
|
||||
ringModel = AdvancedModelLoader.loadModel(ringModelRL);
|
||||
ringTexture = new ResourceLocation(RefStrings.MODID, "textures/models/Ring2.png");
|
||||
ringBigModel = AdvancedModelLoader.loadModel(ringBigModelRL);
|
||||
@ -46,38 +48,166 @@ public class RenderSmallNukeMK3 extends Render {
|
||||
public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) {
|
||||
render((EntityNukeCloudSmall)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
|
||||
}
|
||||
|
||||
//coreographic analysis of a nuclear blast
|
||||
//by VeeTee McFuckface
|
||||
|
||||
//shockwave: rapidly expanding sphere of compressed air
|
||||
// optional: wave of ground dust, make sphere white to pair it with the flash
|
||||
// use multiple rings if necessary, but make them thinner (maybe fire-y)
|
||||
// duration: something like two seconds, the thing is fast
|
||||
|
||||
//fireball: similar story to the shockwave, but with color
|
||||
// slower expanding bubble that raises upwards
|
||||
// use one of those large donuts for the dust on the ground
|
||||
// optional: dust clouds descending from top to bottom of the sphere (adjust radius based on height for smoothness)
|
||||
// use lighter tone (vapor)
|
||||
// duration: ~5 seconds, maybe less
|
||||
|
||||
//mushroom: large donut to simulate breakthrough of the cloud layer (more vapor)
|
||||
// use more rings around the shaft, make them wobble (use a sine function for the height, look at RR for reference)
|
||||
// make the thing larger, this isn't a children's birthday and your excuses "too big" are shit
|
||||
// make the fireball fade so it looks like the cloud is formed by it
|
||||
// use more rings. really.
|
||||
// more polygons, this is a cloud, not a metal pillar made by a seven-yo
|
||||
// duration: as long as you please
|
||||
|
||||
//
|
||||
|
||||
|
||||
//your other render classes look like shit, write code like a sensible person for once. good luck, you'll need it
|
||||
public void render(EntityNukeCloudSmall cloud, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float)p_76986_2_, (float)p_76986_4_, (float)p_76986_6_);
|
||||
GL11.glTranslatef((float)p_76986_2_, (float)p_76986_4_ + 0.25F, (float)p_76986_6_);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
|
||||
GL11.glColor4f(0.2F, 0.2F, 0.2F, 0.9F);
|
||||
|
||||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
||||
//ResourceManager.sphere_ruv.renderAll();
|
||||
GL11.glScalef(1/0.5F, 1/0.5F, 1/0.5F);
|
||||
|
||||
int a = cloud.age;
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_DST_COLOR);
|
||||
GL11.glScalef(cloud.scale, cloud.scale, cloud.scale);
|
||||
|
||||
GL11.glScalef(a, a, a);
|
||||
ringModel.renderAll();
|
||||
GL11.glScalef(2, 2, 2);
|
||||
ResourceManager.sphere_ruv.renderAll();
|
||||
ResourceManager.sphere_iuv.renderAll();
|
||||
int age = cloud.age;
|
||||
int shockScale = age * 4;
|
||||
int fireScale = (int)((age - 25) * 1.5);
|
||||
|
||||
if(age < 50) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glColor4f(0.2F, 0.2F, 0.2F, 0.9F);
|
||||
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
|
||||
|
||||
GL11.glScalef(shockScale, shockScale, shockScale);
|
||||
GL11.glScalef(2, 2, 2);
|
||||
|
||||
for(float i = 0.9F; i <= 1; i += 0.05F) {
|
||||
GL11.glScalef(i, i, i);
|
||||
ResourceManager.sphere_ruv.renderAll();
|
||||
ResourceManager.sphere_iuv.renderAll();
|
||||
GL11.glScalef(1/i, 1/i, 1/i);
|
||||
}
|
||||
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
|
||||
GL11.glColor4f(0.4F, 0.4F, 0.4F, 1F);
|
||||
|
||||
GL11.glScalef(0.6F, 1F / shockScale * 5, 0.6F);
|
||||
ringModel.renderAll();
|
||||
GL11.glScalef(1.1F, 1F, 1.1F);
|
||||
ringModel.renderAll();
|
||||
GL11.glScalef(1.1F, 1F, 1.1F);
|
||||
ringModel.renderAll();
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
if(age >= 50 && age < 150) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glColor4f(0.4F, 0.15F, 0.0F, 0.9F);
|
||||
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
|
||||
GL11.glTranslatef(0, fireScale * 0.75F, 0);
|
||||
|
||||
GL11.glScalef(fireScale * 0.85F, fireScale, fireScale * 0.85F);
|
||||
|
||||
for(float i = 0.6F; i <= 1; i += 0.2F) {
|
||||
GL11.glScalef(i, i, i);
|
||||
ResourceManager.sphere_ruv.renderAll();
|
||||
GL11.glScalef(1/i, 1/i, 1/i);
|
||||
}
|
||||
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
if(age >= 150) {
|
||||
GL11.glPushMatrix();
|
||||
bindTexture(blastTexture);
|
||||
GL11.glTranslatef(0, -50, 0);
|
||||
GL11.glScalef(6, 6, 6);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
blastModel.renderAll();
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glScalef(1.5F, 1.5F, 1.5F);
|
||||
GL11.glColor4f(0.4F, 0.4F, 0.4F, 1F);
|
||||
GL11.glScalef(10, 10, 10);
|
||||
float f = 1.8F + (((float)Math.sin(((double)age) / 20 + 90) * 0.25F) * 0.5F);
|
||||
float f1 = 1 + ((float)Math.sin(((double)age) / 10) * 0.15F);
|
||||
GL11.glScalef(f, 1, f);
|
||||
GL11.glTranslatef(0, 3.5F + f1 * 0.25F, 0);
|
||||
ringModel.renderAll();
|
||||
GL11.glTranslatef(0, - f1 * 0.25F * 2, 0);
|
||||
ringModel.renderAll();
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
if(age >= 50) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glScalef(2, 2, 2);
|
||||
GL11.glColor4f(0.4F, 0.4F, 0.4F, 1F);
|
||||
float f = (float)Math.min((age - 50) * 0.5, 20);
|
||||
GL11.glScalef(f, 15, f);
|
||||
ringBigModel.renderAll();
|
||||
GL11.glScalef(1.5F, 1, 1.5F);
|
||||
GL11.glTranslatef(0, -0.15F, 0);
|
||||
ringBigModel.renderAll();
|
||||
GL11.glScalef(1.5F, 1, 1.5F);
|
||||
GL11.glTranslatef(0, -0.15F, 0);
|
||||
ringBigModel.renderAll();
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glScalef(2, 2, 2);
|
||||
GL11.glColor4f(0.6F, 0.6F, 0.6F, 1F);
|
||||
float f0 = (float)Math.min((age - 50) * 0.25, 20) * 5F;
|
||||
GL11.glScalef(f0, 15, f0);
|
||||
GL11.glTranslatef(0, 3.5F, 0);
|
||||
ringBigModel.renderAll();
|
||||
GL11.glTranslatef(0, 1F, 0);
|
||||
GL11.glScalef(0.65F, 1, 0.65F);
|
||||
ringModel.renderAll();
|
||||
//GL11.glTranslatef(0, -2F, 0);
|
||||
//ringModel.renderAll();
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
//very professional, i love me some null textures /s
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(Entity p_110775_1_) {
|
||||
return null;
|
||||
|
||||
@ -30,7 +30,7 @@ public class RenderCIWSTurret extends TileEntitySpecialRenderer {
|
||||
pitch = ((TileEntityTurretBase)tileEntity).rotationPitch;
|
||||
}
|
||||
|
||||
this.bindTexture(ResourceManager.universal);
|
||||
this.bindTexture(ResourceManager.turret_ciws_base_tex);
|
||||
ResourceManager.turret_cwis_base.renderAll();
|
||||
|
||||
GL11.glPopMatrix();
|
||||
@ -48,7 +48,7 @@ public class RenderCIWSTurret extends TileEntitySpecialRenderer {
|
||||
|
||||
GL11.glRotated(yaw + 180, 0F, -1F, 0F);
|
||||
|
||||
this.bindTexture(ResourceManager.universal);
|
||||
this.bindTexture(ResourceManager.turret_ciws_rotor_tex);
|
||||
ResourceManager.turret_cwis_rotor.renderAll();
|
||||
|
||||
GL11.glPopMatrix();
|
||||
@ -67,7 +67,7 @@ public class RenderCIWSTurret extends TileEntitySpecialRenderer {
|
||||
GL11.glRotated(yaw + 180, 0F, -1F, 0F);
|
||||
GL11.glRotated(pitch, 1F, 0F, 0F);
|
||||
|
||||
this.bindTexture(ResourceManager.universal);
|
||||
this.bindTexture(ResourceManager.turret_ciws_head_tex);
|
||||
ResourceManager.turret_cwis_head.renderAll();
|
||||
|
||||
GL11.glPopMatrix();
|
||||
@ -87,7 +87,7 @@ public class RenderCIWSTurret extends TileEntitySpecialRenderer {
|
||||
GL11.glRotated(pitch, 1F, 0F, 0F);
|
||||
GL11.glRotated(((TileEntityTurretCIWS)tileEntity).rotation, 0F, 0F, 1F);
|
||||
|
||||
this.bindTexture(ResourceManager.universal);
|
||||
this.bindTexture(ResourceManager.turret_ciws_gun_tex);
|
||||
ResourceManager.turret_cwis_gun.renderAll();
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
@ -28,6 +28,7 @@ public class RenderNukeBoy extends TileEntitySpecialRenderer {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5D, y, z + 0.5D);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
switch(tileEntity.getBlockMetadata())
|
||||
{
|
||||
case 2:
|
||||
@ -46,6 +47,8 @@ public class RenderNukeBoy extends TileEntitySpecialRenderer {
|
||||
|
||||
bindTexture(boyTexture);
|
||||
boyModel.renderAll();
|
||||
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
85
com/hbm/render/util/HbmFace.java
Normal file
@ -0,0 +1,85 @@
|
||||
package com.hbm.render.util;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraftforge.client.model.obj.TextureCoordinate;
|
||||
import net.minecraftforge.client.model.obj.Vertex;
|
||||
|
||||
public class HbmFace {
|
||||
public Vertex[] vertices;
|
||||
public Vertex[] vertexNormals;
|
||||
public Vertex faceNormal;
|
||||
public TextureCoordinate[] textureCoordinates;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addFaceForRender(Tessellator tessellator)
|
||||
{
|
||||
addFaceForRender(tessellator, 0.0005F);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addFaceForRender(Tessellator tessellator, float textureOffset)
|
||||
{
|
||||
if (faceNormal == null)
|
||||
{
|
||||
faceNormal = this.calculateFaceNormal();
|
||||
}
|
||||
|
||||
tessellator.setNormal(faceNormal.x, faceNormal.y, faceNormal.z);
|
||||
|
||||
float averageU = 0F;
|
||||
float averageV = 0F;
|
||||
|
||||
if ((textureCoordinates != null) && (textureCoordinates.length > 0))
|
||||
{
|
||||
for (int i = 0; i < textureCoordinates.length; ++i)
|
||||
{
|
||||
averageU += textureCoordinates[i].u;
|
||||
averageV += textureCoordinates[i].v;
|
||||
}
|
||||
|
||||
averageU = averageU / textureCoordinates.length;
|
||||
averageV = averageV / textureCoordinates.length;
|
||||
}
|
||||
|
||||
float offsetU, offsetV;
|
||||
|
||||
for (int i = 0; i < vertices.length; ++i)
|
||||
{
|
||||
|
||||
if ((textureCoordinates != null) && (textureCoordinates.length > 0))
|
||||
{
|
||||
offsetU = textureOffset;
|
||||
offsetV = textureOffset;
|
||||
|
||||
if (textureCoordinates[i].u > averageU)
|
||||
{
|
||||
offsetU = -offsetU;
|
||||
}
|
||||
if (textureCoordinates[i].v > averageV)
|
||||
{
|
||||
offsetV = -offsetV;
|
||||
}
|
||||
|
||||
tessellator.addVertexWithUV(vertices[i].x, vertices[i].y, vertices[i].z, textureCoordinates[i].u + offsetU, textureCoordinates[i].v + offsetV + (((double)System.currentTimeMillis() % 100000) / 5000D));
|
||||
}
|
||||
else
|
||||
{
|
||||
tessellator.addVertex(vertices[i].x, vertices[i].y, vertices[i].z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Vertex calculateFaceNormal()
|
||||
{
|
||||
Vec3 v1 = Vec3.createVectorHelper(vertices[1].x - vertices[0].x, vertices[1].y - vertices[0].y, vertices[1].z - vertices[0].z);
|
||||
Vec3 v2 = Vec3.createVectorHelper(vertices[2].x - vertices[0].x, vertices[2].y - vertices[0].y, vertices[2].z - vertices[0].z);
|
||||
Vec3 normalVector = null;
|
||||
|
||||
normalVector = v1.crossProduct(v2).normalize();
|
||||
|
||||
return new Vertex((float) normalVector.xCoord, (float) normalVector.yCoord, (float) normalVector.zCoord);
|
||||
}
|
||||
}
|
||||
54
com/hbm/render/util/HbmGroupObject.java
Normal file
@ -0,0 +1,54 @@
|
||||
package com.hbm.render.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
|
||||
public class HbmGroupObject {
|
||||
|
||||
public String name;
|
||||
public ArrayList<HbmFace> faces = new ArrayList<HbmFace>();
|
||||
public int glDrawingMode;
|
||||
|
||||
public HbmGroupObject()
|
||||
{
|
||||
this("");
|
||||
}
|
||||
|
||||
public HbmGroupObject(String name)
|
||||
{
|
||||
this(name, -1);
|
||||
}
|
||||
|
||||
public HbmGroupObject(String name, int glDrawingMode)
|
||||
{
|
||||
this.name = name;
|
||||
this.glDrawingMode = glDrawingMode;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void render()
|
||||
{
|
||||
if (faces.size() > 0)
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawing(glDrawingMode);
|
||||
render(tessellator);
|
||||
tessellator.draw();
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void render(Tessellator tessellator)
|
||||
{
|
||||
if (faces.size() > 0)
|
||||
{
|
||||
for (HbmFace face : faces)
|
||||
{
|
||||
face.addFaceForRender(tessellator);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
656
com/hbm/render/util/HbmModelObject.java
Normal file
@ -0,0 +1,656 @@
|
||||
package com.hbm.render.util;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.resources.IResource;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.IModelCustom;
|
||||
import net.minecraftforge.client.model.ModelFormatException;
|
||||
import net.minecraftforge.client.model.obj.TextureCoordinate;
|
||||
import net.minecraftforge.client.model.obj.Vertex;
|
||||
|
||||
public class HbmModelObject implements IModelCustom {
|
||||
private static Pattern vertexPattern = Pattern.compile("(v( (\\-){0,1}\\d+(\\.\\d+)?){3,4} *\\n)|(v( (\\-){0,1}\\d+(\\.\\d+)?){3,4} *$)");
|
||||
private static Pattern vertexNormalPattern = Pattern.compile("(vn( (\\-){0,1}\\d+(\\.\\d+)?){3,4} *\\n)|(vn( (\\-){0,1}\\d+(\\.\\d+)?){3,4} *$)");
|
||||
private static Pattern textureCoordinatePattern = Pattern.compile("(vt( (\\-){0,1}\\d+\\.\\d+){2,3} *\\n)|(vt( (\\-){0,1}\\d+(\\.\\d+)?){2,3} *$)");
|
||||
private static Pattern face_V_VT_VN_Pattern = Pattern.compile("(f( \\d+/\\d+/\\d+){3,4} *\\n)|(f( \\d+/\\d+/\\d+){3,4} *$)");
|
||||
private static Pattern face_V_VT_Pattern = Pattern.compile("(f( \\d+/\\d+){3,4} *\\n)|(f( \\d+/\\d+){3,4} *$)");
|
||||
private static Pattern face_V_VN_Pattern = Pattern.compile("(f( \\d+//\\d+){3,4} *\\n)|(f( \\d+//\\d+){3,4} *$)");
|
||||
private static Pattern face_V_Pattern = Pattern.compile("(f( \\d+){3,4} *\\n)|(f( \\d+){3,4} *$)");
|
||||
private static Pattern groupObjectPattern = Pattern.compile("([go]( [\\w\\d\\.]+) *\\n)|([go]( [\\w\\d\\.]+) *$)");
|
||||
|
||||
private static Matcher vertexMatcher, vertexNormalMatcher, textureCoordinateMatcher;
|
||||
private static Matcher face_V_VT_VN_Matcher, face_V_VT_Matcher, face_V_VN_Matcher, face_V_Matcher;
|
||||
private static Matcher groupObjectMatcher;
|
||||
|
||||
public ArrayList<Vertex> vertices = new ArrayList<Vertex>();
|
||||
public ArrayList<Vertex> vertexNormals = new ArrayList<Vertex>();
|
||||
public ArrayList<TextureCoordinate> textureCoordinates = new ArrayList<TextureCoordinate>();
|
||||
public ArrayList<HbmGroupObject> groupObjects = new ArrayList<HbmGroupObject>();
|
||||
private HbmGroupObject currentGroupObject;
|
||||
private String fileName;
|
||||
|
||||
public HbmModelObject(ResourceLocation resource) throws ModelFormatException
|
||||
{
|
||||
this.fileName = resource.toString();
|
||||
|
||||
try
|
||||
{
|
||||
IResource res = Minecraft.getMinecraft().getResourceManager().getResource(resource);
|
||||
loadObjModel(res.getInputStream());
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
throw new ModelFormatException("IO Exception reading model format", e);
|
||||
}
|
||||
}
|
||||
|
||||
public HbmModelObject(String filename, InputStream inputStream) throws ModelFormatException
|
||||
{
|
||||
this.fileName = filename;
|
||||
loadObjModel(inputStream);
|
||||
}
|
||||
|
||||
private void loadObjModel(InputStream inputStream) throws ModelFormatException
|
||||
{
|
||||
BufferedReader reader = null;
|
||||
|
||||
String currentLine = null;
|
||||
int lineCount = 0;
|
||||
|
||||
try
|
||||
{
|
||||
reader = new BufferedReader(new InputStreamReader(inputStream));
|
||||
|
||||
while ((currentLine = reader.readLine()) != null)
|
||||
{
|
||||
lineCount++;
|
||||
currentLine = currentLine.replaceAll("\\s+", " ").trim();
|
||||
|
||||
if (currentLine.startsWith("#") || currentLine.length() == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (currentLine.startsWith("v "))
|
||||
{
|
||||
Vertex vertex = parseVertex(currentLine, lineCount);
|
||||
if (vertex != null)
|
||||
{
|
||||
vertices.add(vertex);
|
||||
}
|
||||
}
|
||||
else if (currentLine.startsWith("vn "))
|
||||
{
|
||||
Vertex vertex = parseVertexNormal(currentLine, lineCount);
|
||||
if (vertex != null)
|
||||
{
|
||||
vertexNormals.add(vertex);
|
||||
}
|
||||
}
|
||||
else if (currentLine.startsWith("vt "))
|
||||
{
|
||||
TextureCoordinate textureCoordinate = parseTextureCoordinate(currentLine, lineCount);
|
||||
if (textureCoordinate != null)
|
||||
{
|
||||
textureCoordinates.add(textureCoordinate);
|
||||
}
|
||||
}
|
||||
else if (currentLine.startsWith("f "))
|
||||
{
|
||||
|
||||
if (currentGroupObject == null)
|
||||
{
|
||||
currentGroupObject = new HbmGroupObject("Default");
|
||||
}
|
||||
|
||||
HbmFace face = parseFace(currentLine, lineCount);
|
||||
|
||||
if (face != null)
|
||||
{
|
||||
currentGroupObject.faces.add(face);
|
||||
}
|
||||
}
|
||||
else if (currentLine.startsWith("g ") | currentLine.startsWith("o "))
|
||||
{
|
||||
HbmGroupObject group = parseGroupObject(currentLine, lineCount);
|
||||
|
||||
if (group != null)
|
||||
{
|
||||
if (currentGroupObject != null)
|
||||
{
|
||||
groupObjects.add(currentGroupObject);
|
||||
}
|
||||
}
|
||||
|
||||
currentGroupObject = group;
|
||||
}
|
||||
}
|
||||
|
||||
groupObjects.add(currentGroupObject);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
throw new ModelFormatException("IO Exception reading model format", e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
reader.close();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
// hush
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
inputStream.close();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
// hush
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderAll()
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
if (currentGroupObject != null)
|
||||
{
|
||||
tessellator.startDrawing(currentGroupObject.glDrawingMode);
|
||||
}
|
||||
else
|
||||
{
|
||||
tessellator.startDrawing(GL11.GL_TRIANGLES);
|
||||
}
|
||||
tessellateAll(tessellator);
|
||||
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void tessellateAll(Tessellator tessellator)
|
||||
{
|
||||
for (HbmGroupObject groupObject : groupObjects)
|
||||
{
|
||||
groupObject.render(tessellator);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderOnly(String... groupNames)
|
||||
{
|
||||
for (HbmGroupObject groupObject : groupObjects)
|
||||
{
|
||||
for (String groupName : groupNames)
|
||||
{
|
||||
if (groupName.equalsIgnoreCase(groupObject.name))
|
||||
{
|
||||
groupObject.render();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void tessellateOnly(Tessellator tessellator, String... groupNames) {
|
||||
for (HbmGroupObject groupObject : groupObjects)
|
||||
{
|
||||
for (String groupName : groupNames)
|
||||
{
|
||||
if (groupName.equalsIgnoreCase(groupObject.name))
|
||||
{
|
||||
groupObject.render(tessellator);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderPart(String partName)
|
||||
{
|
||||
for (HbmGroupObject groupObject : groupObjects)
|
||||
{
|
||||
if (partName.equalsIgnoreCase(groupObject.name))
|
||||
{
|
||||
groupObject.render();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void tessellatePart(Tessellator tessellator, String partName) {
|
||||
for (HbmGroupObject groupObject : groupObjects)
|
||||
{
|
||||
if (partName.equalsIgnoreCase(groupObject.name))
|
||||
{
|
||||
groupObject.render(tessellator);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderAllExcept(String... excludedGroupNames)
|
||||
{
|
||||
for (HbmGroupObject groupObject : groupObjects)
|
||||
{
|
||||
boolean skipPart=false;
|
||||
for (String excludedGroupName : excludedGroupNames)
|
||||
{
|
||||
if (excludedGroupName.equalsIgnoreCase(groupObject.name))
|
||||
{
|
||||
skipPart=true;
|
||||
}
|
||||
}
|
||||
if(!skipPart)
|
||||
{
|
||||
groupObject.render();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void tessellateAllExcept(Tessellator tessellator, String... excludedGroupNames)
|
||||
{
|
||||
boolean exclude;
|
||||
for (HbmGroupObject groupObject : groupObjects)
|
||||
{
|
||||
exclude=false;
|
||||
for (String excludedGroupName : excludedGroupNames)
|
||||
{
|
||||
if (excludedGroupName.equalsIgnoreCase(groupObject.name))
|
||||
{
|
||||
exclude=true;
|
||||
}
|
||||
}
|
||||
if(!exclude)
|
||||
{
|
||||
groupObject.render(tessellator);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Vertex parseVertex(String line, int lineCount) throws ModelFormatException
|
||||
{
|
||||
Vertex vertex = null;
|
||||
|
||||
if (isValidVertexLine(line))
|
||||
{
|
||||
line = line.substring(line.indexOf(" ") + 1);
|
||||
String[] tokens = line.split(" ");
|
||||
|
||||
try
|
||||
{
|
||||
if (tokens.length == 2)
|
||||
{
|
||||
return new Vertex(Float.parseFloat(tokens[0]), Float.parseFloat(tokens[1]));
|
||||
}
|
||||
else if (tokens.length == 3)
|
||||
{
|
||||
return new Vertex(Float.parseFloat(tokens[0]), Float.parseFloat(tokens[1]), Float.parseFloat(tokens[2]));
|
||||
}
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
throw new ModelFormatException(String.format("Number formatting error at line %d",lineCount), e);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ModelFormatException("Error parsing entry ('" + line + "'" + ", line " + lineCount + ") in file '" + fileName + "' - Incorrect format");
|
||||
}
|
||||
|
||||
return vertex;
|
||||
}
|
||||
|
||||
private Vertex parseVertexNormal(String line, int lineCount) throws ModelFormatException
|
||||
{
|
||||
Vertex vertexNormal = null;
|
||||
|
||||
if (isValidVertexNormalLine(line))
|
||||
{
|
||||
line = line.substring(line.indexOf(" ") + 1);
|
||||
String[] tokens = line.split(" ");
|
||||
|
||||
try
|
||||
{
|
||||
if (tokens.length == 3)
|
||||
return new Vertex(Float.parseFloat(tokens[0]), Float.parseFloat(tokens[1]), Float.parseFloat(tokens[2]));
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
throw new ModelFormatException(String.format("Number formatting error at line %d",lineCount), e);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ModelFormatException("Error parsing entry ('" + line + "'" + ", line " + lineCount + ") in file '" + fileName + "' - Incorrect format");
|
||||
}
|
||||
|
||||
return vertexNormal;
|
||||
}
|
||||
|
||||
private TextureCoordinate parseTextureCoordinate(String line, int lineCount) throws ModelFormatException
|
||||
{
|
||||
TextureCoordinate textureCoordinate = null;
|
||||
|
||||
if (isValidTextureCoordinateLine(line))
|
||||
{
|
||||
line = line.substring(line.indexOf(" ") + 1);
|
||||
String[] tokens = line.split(" ");
|
||||
|
||||
try
|
||||
{
|
||||
if (tokens.length == 2)
|
||||
return new TextureCoordinate(Float.parseFloat(tokens[0]), 1 - Float.parseFloat(tokens[1]));
|
||||
else if (tokens.length == 3)
|
||||
return new TextureCoordinate(Float.parseFloat(tokens[0]), 1 - Float.parseFloat(tokens[1]), Float.parseFloat(tokens[2]));
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
throw new ModelFormatException(String.format("Number formatting error at line %d",lineCount), e);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ModelFormatException("Error parsing entry ('" + line + "'" + ", line " + lineCount + ") in file '" + fileName + "' - Incorrect format");
|
||||
}
|
||||
|
||||
return textureCoordinate;
|
||||
}
|
||||
|
||||
private HbmFace parseFace(String line, int lineCount) throws ModelFormatException
|
||||
{
|
||||
HbmFace face = null;
|
||||
|
||||
if (isValidFaceLine(line))
|
||||
{
|
||||
face = new HbmFace();
|
||||
|
||||
String trimmedLine = line.substring(line.indexOf(" ") + 1);
|
||||
String[] tokens = trimmedLine.split(" ");
|
||||
String[] subTokens = null;
|
||||
|
||||
if (tokens.length == 3)
|
||||
{
|
||||
if (currentGroupObject.glDrawingMode == -1)
|
||||
{
|
||||
currentGroupObject.glDrawingMode = GL11.GL_TRIANGLES;
|
||||
}
|
||||
else if (currentGroupObject.glDrawingMode != GL11.GL_TRIANGLES)
|
||||
{
|
||||
throw new ModelFormatException("Error parsing entry ('" + line + "'" + ", line " + lineCount + ") in file '" + fileName + "' - Invalid number of points for face (expected 4, found " + tokens.length + ")");
|
||||
}
|
||||
}
|
||||
else if (tokens.length == 4)
|
||||
{
|
||||
if (currentGroupObject.glDrawingMode == -1)
|
||||
{
|
||||
currentGroupObject.glDrawingMode = GL11.GL_QUADS;
|
||||
}
|
||||
else if (currentGroupObject.glDrawingMode != GL11.GL_QUADS)
|
||||
{
|
||||
throw new ModelFormatException("Error parsing entry ('" + line + "'" + ", line " + lineCount + ") in file '" + fileName + "' - Invalid number of points for face (expected 3, found " + tokens.length + ")");
|
||||
}
|
||||
}
|
||||
|
||||
// f v1/vt1/vn1 v2/vt2/vn2 v3/vt3/vn3 ...
|
||||
if (isValidFace_V_VT_VN_Line(line))
|
||||
{
|
||||
face.vertices = new Vertex[tokens.length];
|
||||
face.textureCoordinates = new TextureCoordinate[tokens.length];
|
||||
face.vertexNormals = new Vertex[tokens.length];
|
||||
|
||||
for (int i = 0; i < tokens.length; ++i)
|
||||
{
|
||||
subTokens = tokens[i].split("/");
|
||||
|
||||
face.vertices[i] = vertices.get(Integer.parseInt(subTokens[0]) - 1);
|
||||
face.textureCoordinates[i] = textureCoordinates.get(Integer.parseInt(subTokens[1]) - 1);
|
||||
face.vertexNormals[i] = vertexNormals.get(Integer.parseInt(subTokens[2]) - 1);
|
||||
}
|
||||
|
||||
face.faceNormal = face.calculateFaceNormal();
|
||||
}
|
||||
// f v1/vt1 v2/vt2 v3/vt3 ...
|
||||
else if (isValidFace_V_VT_Line(line))
|
||||
{
|
||||
face.vertices = new Vertex[tokens.length];
|
||||
face.textureCoordinates = new TextureCoordinate[tokens.length];
|
||||
|
||||
for (int i = 0; i < tokens.length; ++i)
|
||||
{
|
||||
subTokens = tokens[i].split("/");
|
||||
|
||||
face.vertices[i] = vertices.get(Integer.parseInt(subTokens[0]) - 1);
|
||||
face.textureCoordinates[i] = textureCoordinates.get(Integer.parseInt(subTokens[1]) - 1);
|
||||
}
|
||||
|
||||
face.faceNormal = face.calculateFaceNormal();
|
||||
}
|
||||
// f v1//vn1 v2//vn2 v3//vn3 ...
|
||||
else if (isValidFace_V_VN_Line(line))
|
||||
{
|
||||
face.vertices = new Vertex[tokens.length];
|
||||
face.vertexNormals = new Vertex[tokens.length];
|
||||
|
||||
for (int i = 0; i < tokens.length; ++i)
|
||||
{
|
||||
subTokens = tokens[i].split("//");
|
||||
|
||||
face.vertices[i] = vertices.get(Integer.parseInt(subTokens[0]) - 1);
|
||||
face.vertexNormals[i] = vertexNormals.get(Integer.parseInt(subTokens[1]) - 1);
|
||||
}
|
||||
|
||||
face.faceNormal = face.calculateFaceNormal();
|
||||
}
|
||||
// f v1 v2 v3 ...
|
||||
else if (isValidFace_V_Line(line))
|
||||
{
|
||||
face.vertices = new Vertex[tokens.length];
|
||||
|
||||
for (int i = 0; i < tokens.length; ++i)
|
||||
{
|
||||
face.vertices[i] = vertices.get(Integer.parseInt(tokens[i]) - 1);
|
||||
}
|
||||
|
||||
face.faceNormal = face.calculateFaceNormal();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ModelFormatException("Error parsing entry ('" + line + "'" + ", line " + lineCount + ") in file '" + fileName + "' - Incorrect format");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ModelFormatException("Error parsing entry ('" + line + "'" + ", line " + lineCount + ") in file '" + fileName + "' - Incorrect format");
|
||||
}
|
||||
|
||||
return face;
|
||||
}
|
||||
|
||||
private HbmGroupObject parseGroupObject(String line, int lineCount) throws ModelFormatException
|
||||
{
|
||||
HbmGroupObject group = null;
|
||||
|
||||
if (isValidGroupObjectLine(line))
|
||||
{
|
||||
String trimmedLine = line.substring(line.indexOf(" ") + 1);
|
||||
|
||||
if (trimmedLine.length() > 0)
|
||||
{
|
||||
group = new HbmGroupObject(trimmedLine);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ModelFormatException("Error parsing entry ('" + line + "'" + ", line " + lineCount + ") in file '" + fileName + "' - Incorrect format");
|
||||
}
|
||||
|
||||
return group;
|
||||
}
|
||||
|
||||
/***
|
||||
* Verifies that the given line from the model file is a valid vertex
|
||||
* @param line the line being validated
|
||||
* @return true if the line is a valid vertex, false otherwise
|
||||
*/
|
||||
private static boolean isValidVertexLine(String line)
|
||||
{
|
||||
if (vertexMatcher != null)
|
||||
{
|
||||
vertexMatcher.reset();
|
||||
}
|
||||
|
||||
vertexMatcher = vertexPattern.matcher(line);
|
||||
return vertexMatcher.matches();
|
||||
}
|
||||
|
||||
/***
|
||||
* Verifies that the given line from the model file is a valid vertex normal
|
||||
* @param line the line being validated
|
||||
* @return true if the line is a valid vertex normal, false otherwise
|
||||
*/
|
||||
private static boolean isValidVertexNormalLine(String line)
|
||||
{
|
||||
if (vertexNormalMatcher != null)
|
||||
{
|
||||
vertexNormalMatcher.reset();
|
||||
}
|
||||
|
||||
vertexNormalMatcher = vertexNormalPattern.matcher(line);
|
||||
return vertexNormalMatcher.matches();
|
||||
}
|
||||
|
||||
/***
|
||||
* Verifies that the given line from the model file is a valid texture coordinate
|
||||
* @param line the line being validated
|
||||
* @return true if the line is a valid texture coordinate, false otherwise
|
||||
*/
|
||||
private static boolean isValidTextureCoordinateLine(String line)
|
||||
{
|
||||
if (textureCoordinateMatcher != null)
|
||||
{
|
||||
textureCoordinateMatcher.reset();
|
||||
}
|
||||
|
||||
textureCoordinateMatcher = textureCoordinatePattern.matcher(line);
|
||||
return textureCoordinateMatcher.matches();
|
||||
}
|
||||
|
||||
/***
|
||||
* Verifies that the given line from the model file is a valid face that is described by vertices, texture coordinates, and vertex normals
|
||||
* @param line the line being validated
|
||||
* @return true if the line is a valid face that matches the format "f v1/vt1/vn1 ..." (with a minimum of 3 points in the face, and a maximum of 4), false otherwise
|
||||
*/
|
||||
private static boolean isValidFace_V_VT_VN_Line(String line)
|
||||
{
|
||||
if (face_V_VT_VN_Matcher != null)
|
||||
{
|
||||
face_V_VT_VN_Matcher.reset();
|
||||
}
|
||||
|
||||
face_V_VT_VN_Matcher = face_V_VT_VN_Pattern.matcher(line);
|
||||
return face_V_VT_VN_Matcher.matches();
|
||||
}
|
||||
|
||||
/***
|
||||
* Verifies that the given line from the model file is a valid face that is described by vertices and texture coordinates
|
||||
* @param line the line being validated
|
||||
* @return true if the line is a valid face that matches the format "f v1/vt1 ..." (with a minimum of 3 points in the face, and a maximum of 4), false otherwise
|
||||
*/
|
||||
private static boolean isValidFace_V_VT_Line(String line)
|
||||
{
|
||||
if (face_V_VT_Matcher != null)
|
||||
{
|
||||
face_V_VT_Matcher.reset();
|
||||
}
|
||||
|
||||
face_V_VT_Matcher = face_V_VT_Pattern.matcher(line);
|
||||
return face_V_VT_Matcher.matches();
|
||||
}
|
||||
|
||||
/***
|
||||
* Verifies that the given line from the model file is a valid face that is described by vertices and vertex normals
|
||||
* @param line the line being validated
|
||||
* @return true if the line is a valid face that matches the format "f v1//vn1 ..." (with a minimum of 3 points in the face, and a maximum of 4), false otherwise
|
||||
*/
|
||||
private static boolean isValidFace_V_VN_Line(String line)
|
||||
{
|
||||
if (face_V_VN_Matcher != null)
|
||||
{
|
||||
face_V_VN_Matcher.reset();
|
||||
}
|
||||
|
||||
face_V_VN_Matcher = face_V_VN_Pattern.matcher(line);
|
||||
return face_V_VN_Matcher.matches();
|
||||
}
|
||||
|
||||
/***
|
||||
* Verifies that the given line from the model file is a valid face that is described by only vertices
|
||||
* @param line the line being validated
|
||||
* @return true if the line is a valid face that matches the format "f v1 ..." (with a minimum of 3 points in the face, and a maximum of 4), false otherwise
|
||||
*/
|
||||
private static boolean isValidFace_V_Line(String line)
|
||||
{
|
||||
if (face_V_Matcher != null)
|
||||
{
|
||||
face_V_Matcher.reset();
|
||||
}
|
||||
|
||||
face_V_Matcher = face_V_Pattern.matcher(line);
|
||||
return face_V_Matcher.matches();
|
||||
}
|
||||
|
||||
/***
|
||||
* Verifies that the given line from the model file is a valid face of any of the possible face formats
|
||||
* @param line the line being validated
|
||||
* @return true if the line is a valid face that matches any of the valid face formats, false otherwise
|
||||
*/
|
||||
private static boolean isValidFaceLine(String line)
|
||||
{
|
||||
return isValidFace_V_VT_VN_Line(line) || isValidFace_V_VT_Line(line) || isValidFace_V_VN_Line(line) || isValidFace_V_Line(line);
|
||||
}
|
||||
|
||||
/***
|
||||
* Verifies that the given line from the model file is a valid group (or object)
|
||||
* @param line the line being validated
|
||||
* @return true if the line is a valid group (or object), false otherwise
|
||||
*/
|
||||
private static boolean isValidGroupObjectLine(String line)
|
||||
{
|
||||
if (groupObjectMatcher != null)
|
||||
{
|
||||
groupObjectMatcher.reset();
|
||||
}
|
||||
|
||||
groupObjectMatcher = groupObjectPattern.matcher(line);
|
||||
return groupObjectMatcher.matches();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return "hmf";
|
||||
}
|
||||
}
|
||||
30
com/hbm/render/util/HmfModelLoader.java
Normal file
@ -0,0 +1,30 @@
|
||||
package com.hbm.render.util;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.IModelCustom;
|
||||
import net.minecraftforge.client.model.IModelCustomLoader;
|
||||
import net.minecraftforge.client.model.ModelFormatException;
|
||||
import net.minecraftforge.client.model.obj.WavefrontObject;
|
||||
|
||||
public class HmfModelLoader implements IModelCustomLoader {
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return "HMF model";
|
||||
}
|
||||
|
||||
private static final String[] types = { "hmf" };
|
||||
|
||||
@Override
|
||||
public String[] getSuffixes()
|
||||
{
|
||||
return types;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IModelCustom loadInstance(ResourceLocation resource) throws ModelFormatException
|
||||
{
|
||||
return new HbmModelObject(resource);
|
||||
}
|
||||
}
|
||||