Skip to content

Commit

Permalink
we gotta move these color TVs
Browse files Browse the repository at this point in the history
  • Loading branch information
HbmMods committed Nov 25, 2023
1 parent 3473fa1 commit 022a93d
Show file tree
Hide file tree
Showing 28 changed files with 843 additions and 401 deletions.
3 changes: 3 additions & 0 deletions changelog
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
* The map will scan loaded chunks instantly, unloaded chunks have a limit of 5 chunk loads per tick to prevent excessive lag
* The chunk load limit can be adjusted in the machine config file
* The map will show terrain height between Y:50 and Y:128, anything outside that range is truncated
* Radars now have a second GUI which allows the use of a battery, as well as linking the radar to other machines
* By using the number keys, the radar can now launch missiles, ABMs or artillery at the current aimed at position
* The turbofan's afterburner now adds a 33% efficiency bonus for every level. This means that instead of the efficiency remaining constant between levels, a tier 3 upgrade will yield double efficiency.
* Reduced the flarestack's base energy efficiency
* Trenchmaster armor is now unbreakable
Expand All @@ -31,6 +33,7 @@
* Remodeled the anti-ballistic missile
* Anti-ballistic missiles now use predictive targeting as well as a heightened sensor range of 1,000 blocks (instead of 500) which should make them a lot more effective
* Anti-ballistic missiles accelerate 4x faster than normal missiles and have a 50% higher top-speed
* Anti-ballistic missiles can now load their own chunks, allowing them to get to far away incoming missiles without getting stuck
* PWRs that have recently been close to unloaded chunks now have a 40 tick timeframe where they are "frozen", only trying to connect to a fluid network but not doing any fission, this should reduce the amount of meltdowns caused by chunkloading

## Fixed
Expand Down
12 changes: 8 additions & 4 deletions src/main/java/api/hbm/entity/RadarEntry.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,33 @@ public class RadarEntry {
public int posY;
public int posZ;
public int dim;
public int entityID;
/** Whether this radar entry should be counted for the redstone output */
public boolean redstone;

public RadarEntry() { } //blank ctor for packets

public RadarEntry(String name, int level, int x, int y, int z, int dim, boolean redstone) {
public RadarEntry(String name, int level, int x, int y, int z, int dim, int entityID, boolean redstone) {
this.unlocalizedName = name;
this.blipLevel = level;
this.posX = x;
this.posY = y;
this.posZ = z;
this.dim = dim;
this.entityID = entityID;
this.redstone = redstone;
}

public RadarEntry(IRadarDetectableNT detectable, Entity entity, boolean redstone) {
this(detectable.getUnlocalizedName(), detectable.getBlipLevel(), (int) Math.floor(entity.posX), (int) Math.floor(entity.posY), (int) Math.floor(entity.posZ), entity.dimension, redstone);
this(detectable.getUnlocalizedName(), detectable.getBlipLevel(), (int) Math.floor(entity.posX), (int) Math.floor(entity.posY), (int) Math.floor(entity.posZ), entity.dimension, entity.getEntityId(), redstone);
}

public RadarEntry(IRadarDetectable detectable, Entity entity) {
this(detectable.getTargetType().name, detectable.getTargetType().ordinal(), (int) Math.floor(entity.posX), (int) Math.floor(entity.posY), (int) Math.floor(entity.posZ), entity.dimension, entity.motionY < 0);
this(detectable.getTargetType().name, detectable.getTargetType().ordinal(), (int) Math.floor(entity.posX), (int) Math.floor(entity.posY), (int) Math.floor(entity.posZ), entity.dimension, entity.getEntityId(), entity.motionY < 0);
}

public RadarEntry(EntityPlayer player) {
this(player.getDisplayName(), IRadarDetectableNT.PLAYER, (int) Math.floor(player.posX), (int) Math.floor(player.posY), (int) Math.floor(player.posZ), player.dimension, true);
this(player.getDisplayName(), IRadarDetectableNT.PLAYER, (int) Math.floor(player.posX), (int) Math.floor(player.posY), (int) Math.floor(player.posZ), player.dimension, player.getEntityId(), true);
}

public void fromBytes(ByteBuf buf) {
Expand All @@ -49,6 +51,7 @@ public void fromBytes(ByteBuf buf) {
this.posY = buf.readInt();
this.posZ = buf.readInt();
this.dim = buf.readShort();
this.entityID = buf.readInt();
}

public void toBytes(ByteBuf buf) {
Expand All @@ -58,5 +61,6 @@ public void toBytes(ByteBuf buf) {
buf.writeInt(this.posY);
buf.writeInt(this.posZ);
buf.writeShort(this.dim);
buf.writeInt(this.entityID);
}
}
5 changes: 4 additions & 1 deletion src/main/java/com/hbm/blocks/ModBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -1057,8 +1057,9 @@ public static void mainRegistry()
public static Block launch_table;

public static Block soyuz_launcher;

public static Block machine_radar;
public static Block radar_screen;

public static Block machine_turbofan;
public static Block machine_turbinegas;
Expand Down Expand Up @@ -2164,6 +2165,7 @@ private static void initializeBlock() {

launch_pad = new LaunchPad(Material.iron).setBlockName("launch_pad").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.missileTab).setBlockTextureName(RefStrings.MODID + ":launch_pad");
machine_radar = new MachineRadar(Material.iron).setBlockName("machine_radar").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.missileTab).setBlockTextureName(RefStrings.MODID + ":machine_radar");
radar_screen = new MachineRadarScreen(Material.iron).setBlockName("radar_screen").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.missileTab).setBlockTextureName(RefStrings.MODID + ":block_steel");

machine_missile_assembly = new MachineMissileAssembly(Material.iron).setBlockName("machine_missile_assembly").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.missileTab).setBlockTextureName(RefStrings.MODID + ":machine_missile_assembly");
compact_launcher = new CompactLauncher(Material.iron).setBlockName("compact_launcher").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.missileTab).setBlockTextureName(RefStrings.MODID + ":compact_launcher");
Expand Down Expand Up @@ -3504,6 +3506,7 @@ private static void registerBlock() {
GameRegistry.registerBlock(sat_dock, sat_dock.getUnlocalizedName());
GameRegistry.registerBlock(soyuz_capsule, soyuz_capsule.getUnlocalizedName());
GameRegistry.registerBlock(machine_radar, machine_radar.getUnlocalizedName());
GameRegistry.registerBlock(radar_screen, radar_screen.getUnlocalizedName());

//Guide
GameRegistry.registerBlock(book_guide, book_guide.getUnlocalizedName());
Expand Down
193 changes: 1 addition & 192 deletions src/main/java/com/hbm/blocks/bomb/LaunchPad.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,27 @@

import java.util.Random;

import org.apache.logging.log4j.Level;

import com.hbm.blocks.ModBlocks;
import com.hbm.config.GeneralConfig;
import com.hbm.entity.missile.*;
import com.hbm.entity.missile.EntityMissileTier0.*;
import com.hbm.entity.missile.EntityMissileTier1.*;
import com.hbm.entity.missile.EntityMissileTier2.*;
import com.hbm.entity.missile.EntityMissileTier3.*;
import com.hbm.entity.missile.EntityMissileTier4.*;
import com.hbm.interfaces.IBomb;
import com.hbm.interfaces.Spaghetti;
import com.hbm.items.ModItems;
import com.hbm.main.MainRegistry;
import com.hbm.tileentity.bomb.TileEntityLaunchPad;

import api.hbm.item.IDesignatorItem;
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;

public class LaunchPad extends BlockContainer implements IBomb {

public TileEntityLaunchPad tetn = new TileEntityLaunchPad();
public static boolean keepInventory = false;
private final static Random field_149933_a = new Random();

Expand All @@ -51,11 +35,6 @@ public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
return new TileEntityLaunchPad();
}

@Override
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {
return Item.getItemFromBlock(ModBlocks.launch_pad);
}

@Override
public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) {
if(!keepInventory) {
Expand Down Expand Up @@ -137,186 +116,16 @@ public boolean renderAsNormalBlock() {
return false;
}

@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;

if(i == 0) {
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
}
if(i == 1) {
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
}
if(i == 2) {
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
}
if(i == 3) {
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
}
}

/*
* @Override public void setBlockBoundsBasedOnState(IBlockAccess
* p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_) { float f
* = 0.0625F; this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F); }
*
* @Override public AxisAlignedBB getCollisionBoundingBoxFromPool(World
* world, int x, int y, int z) { float f = 0.0625F;
* this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 8*f, 1.0F); return
* AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ,
* x + this.maxX, y + this.maxY, z + this.maxZ); }
*/

@Override
@SideOnly(Side.CLIENT)
public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) {
return Item.getItemFromBlock(ModBlocks.launch_pad);
}

@Spaghetti("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA *takes breath* AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")
@Override
public BombReturnCode explode(World world, int x, int y, int z) {

TileEntityLaunchPad entity = (TileEntityLaunchPad) world.getTileEntity(x, y, z);

if(entity.slots[0] == null || world.isRemote)
return BombReturnCode.ERROR_MISSING_COMPONENT;

if(entity.slots[1] != null && entity.slots[1].getItem() instanceof IDesignatorItem && entity.power >= 75000) {

if(!((IDesignatorItem)entity.slots[1].getItem()).isReady(world, entity.slots[1], x, y, z))
return BombReturnCode.ERROR_MISSING_COMPONENT;

int xCoord = entity.slots[1].stackTagCompound.getInteger("xCoord");
int zCoord = entity.slots[1].stackTagCompound.getInteger("zCoord");

if(xCoord == entity.xCoord && zCoord == entity.zCoord) {
xCoord += 1;
}

Entity missile = null;

if(entity.slots[0].getItem() == ModItems.missile_generic) {
missile = new EntityMissileGeneric(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
}
if(entity.slots[0].getItem() == ModItems.missile_incendiary) {
missile = new EntityMissileIncendiary(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
}
if(entity.slots[0].getItem() == ModItems.missile_cluster) {
missile = new EntityMissileCluster(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
}
if(entity.slots[0].getItem() == ModItems.missile_buster) {
missile = new EntityMissileBunkerBuster(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
}
if(entity.slots[0].getItem() == ModItems.missile_strong) {
missile = new EntityMissileStrong(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
}
if(entity.slots[0].getItem() == ModItems.missile_incendiary_strong) {
missile = new EntityMissileIncendiaryStrong(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
}
if(entity.slots[0].getItem() == ModItems.missile_cluster_strong) {
missile = new EntityMissileClusterStrong(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
}
if(entity.slots[0].getItem() == ModItems.missile_buster_strong) {
missile = new EntityMissileBusterStrong(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
}
if(entity.slots[0].getItem() == ModItems.missile_burst) {
missile = new EntityMissileBurst(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
}
if(entity.slots[0].getItem() == ModItems.missile_inferno) {
missile = new EntityMissileInferno(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
}
if(entity.slots[0].getItem() == ModItems.missile_rain) {
missile = new EntityMissileRain(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
}
if(entity.slots[0].getItem() == ModItems.missile_drill) {
missile = new EntityMissileDrill(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
}
if(entity.slots[0].getItem() == ModItems.missile_nuclear) {
missile = new EntityMissileNuclear(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
}
if(entity.slots[0].getItem() == ModItems.missile_endo) {
missile = new EntityMissileEndo(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
}
if(entity.slots[0].getItem() == ModItems.missile_exo) {
missile = new EntityMissileExo(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
}
if(entity.slots[0].getItem() == ModItems.missile_nuclear_cluster) {
missile = new EntityMissileMirv(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
}
if(entity.slots[0].getItem() == ModItems.missile_doomsday) {
missile = new EntityMissileDoomsday(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
}
if(entity.slots[0].getItem() == ModItems.missile_taint) {
missile = new EntityMissileTaint(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
}
if(entity.slots[0].getItem() == ModItems.missile_micro) {
missile = new EntityMissileMicro(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
}
if(entity.slots[0].getItem() == ModItems.missile_bhole) {
missile = new EntityMissileBHole(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
}
if(entity.slots[0].getItem() == ModItems.missile_schrabidium) {
missile = new EntityMissileSchrabidium(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
}
if(entity.slots[0].getItem() == ModItems.missile_emp) {
missile = new EntityMissileEMP(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
}
if(entity.slots[0].getItem() == ModItems.missile_emp_strong) {
missile = new EntityMissileEMPStrong(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
}
if(entity.slots[0].getItem() == ModItems.missile_volcano) {
missile = new EntityMissileVolcano(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
}
if(entity.slots[0].getItem() == ModItems.missile_shuttle) {
missile = new EntityMissileShuttle(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
}

if(missile != null) {
world.spawnEntityInWorld(missile);
world.playSoundEffect(x, y, z, "hbm:weapon.missileTakeOff", 2.0F, 1.0F);
entity.power -= 75000;
entity.slots[0] = null;

if(GeneralConfig.enableExtendedLogging)
MainRegistry.logger.log(Level.INFO, "[MISSILE] Tried to launch missile at " + x + " / " + y + " / " + z + " to " + xCoord + " / " + zCoord + "!");
return BombReturnCode.LAUNCHED;
}
}

if(entity.slots[0] != null && entity.slots[0].getItem() == ModItems.missile_carrier && entity.power >= 75000) {
EntityCarrier missile = new EntityCarrier(world);
missile.posX = x + 0.5F;
missile.posY = y + 1F;
missile.posZ = z + 0.5F;

if(entity.slots[1] != null)
missile.setPayload(entity.slots[1]);

world.spawnEntityInWorld(missile);
entity.power -= 75000;

entity.slots[0] = null;
entity.slots[1] = null;
world.playSoundEffect(x, y, z, "hbm:entity.rocketTakeoff", 100.0F, 1.0F);
return BombReturnCode.LAUNCHED;
}

if(entity.slots[0] != null && entity.slots[0].getItem() == ModItems.missile_anti_ballistic && entity.power >= 75000) {
EntityMissileAntiBallistic missile = new EntityMissileAntiBallistic(world);
missile.posX = x + 0.5F;
missile.posY = y + 0.5F;
missile.posZ = z + 0.5F;

world.spawnEntityInWorld(missile);
entity.power -= 75000;

entity.slots[0] = null;
world.playSoundEffect(x, y, z, "hbm:weapon.missileTakeOff", 2.0F, 1.0F);
return BombReturnCode.LAUNCHED;
}

return BombReturnCode.ERROR_MISSING_COMPONENT;
return entity.launchFromDesignator();
}

}
2 changes: 1 addition & 1 deletion src/main/java/com/hbm/blocks/machine/MachineRadar.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer p
return true;
}

if(world.isRemote) {
if(world.isRemote && !player.isSneaking()) {
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z);
return true;
} else if(!player.isSneaking()) {
Expand Down
Loading

0 comments on commit 022a93d

Please sign in to comment.