Cleaned up code and formatting

This commit is contained in:
70000hp 2023-09-04 18:22:31 -04:00
parent bf400c3525
commit 7c1bd3ad40
2 changed files with 53 additions and 80 deletions

View File

@ -29,30 +29,15 @@ public class ItemBombCaller extends Item {
list.add("Aim & click to call an airstrike!");
switch (stack.getItemDamage()) {
case 1:
list.add("Type: Napalm");
break;
case 2:
list.add("Type: Poison gas");
break;
case 3:
list.add("Type: Agent orange");
break;
case 4:
list.add("Type: Atomic bomb");
break;
case 5:
list.add("Type: VT stinger rockets");
break;
case 6:
list.add("Type: PIP OH GOD");
break;
case 7:
list.add("Type: Cloud the cloud oh god the cloud");
break;
default:
list.add("Type: Carpet bombing");
case 0: list.add("Type: Carpet bombing"); break;
case 1: list.add("Type: Napalm"); break;
case 2: list.add("Type: Poison gas"); break;
case 3: list.add("Type: Agent orange"); break;
case 4: list.add("Type: Atomic bomb"); break;
case 5: list.add("Type: VT stinger rockets"); break;
case 6: list.add("Type: PIP OH GOD"); break;
case 7: list.add("Type: Cloud the cloud oh god the cloud"); break;
default: list.add("Type: INVALID, Report it to mod creator");
}
@ -68,32 +53,20 @@ public class ItemBombCaller extends Item {
if(!world.isRemote)
{
EntityBomber bomber;
switch(stack.getItemDamage()) {
case 1:
WorldUtil.loadAndSpawnEntityInWorld(EntityBomber.statFacNapalm(world, x, y, z));
break;
case 2:
WorldUtil.loadAndSpawnEntityInWorld(EntityBomber.statFacChlorine(world, x, y, z));
break;
case 3:
WorldUtil.loadAndSpawnEntityInWorld(EntityBomber.statFacOrange(world, x, y, z));
break;
case 4:
WorldUtil.loadAndSpawnEntityInWorld(EntityBomber.statFacABomb(world, x, y, z));
break;
case 5:
WorldUtil.loadAndSpawnEntityInWorld(EntityBomber.statFacStinger(world, x, y, z));
break;
case 6:
WorldUtil.loadAndSpawnEntityInWorld(EntityBomber.statFacBoxcar(world, x, y, z));
break;
case 7:
WorldUtil.loadAndSpawnEntityInWorld(EntityBomber.statFacPC(world, x, y, z));
default:
WorldUtil.loadAndSpawnEntityInWorld(EntityBomber.statFacCarpet(world, x, y, z));
case 1: bomber = EntityBomber.statFacNapalm(world, x, y, z); break;
case 2: bomber = EntityBomber.statFacChlorine(world, x, y, z); break;
case 3: bomber = EntityBomber.statFacOrange(world, x, y, z); break;
case 4: bomber = EntityBomber.statFacABomb(world, x, y, z); break;
case 5: bomber = EntityBomber.statFacStinger(world, x, y, z); break;
case 6: bomber = EntityBomber.statFacBoxcar(world, x, y, z); break;
case 7: bomber = EntityBomber.statFacPC(world, x, y, z); break;
default: bomber = EntityBomber.statFacCarpet(world, x, y, z);
}
WorldUtil.loadAndSpawnEntityInWorld(bomber);
player.addChatMessage(new ChatComponentText("Called in airstrike!"));
world.playSoundAtEntity(player, "hbm:item.techBleep", 1.0F, 1.0F);

View File

@ -40,8 +40,8 @@ public class WorldUtil {
/*fun fact: this is based off of joinEntityInSurroundings in World
however, since mojang is staffed by field mice, that function is client side only and half-baked
*/
public static void loadAndSpawnEntityInWorld(Entity entity)
{
public static void loadAndSpawnEntityInWorld(Entity entity) {
World world = entity.worldObj;
int chunkX = MathHelper.floor_double(entity.posX / 16.0D);
int chunkZ = MathHelper.floor_double(entity.posZ / 16.0D);