satellite rework, more soyuz stuff, new textures
@ -45,6 +45,12 @@ achievement.nuclear=Atomwissenschaft
|
||||
achievement.nuclear.desc=Bobmazon Level 5 (Urankernbrennstoff)
|
||||
achievement.hidden=Versteckter Katalog
|
||||
achievement.hidden.desc=Töte einen Enderman mit einem fallenden Güterwagon wärend du brennst und mehr als 250 RADs hast.
|
||||
achievement.horizonsStart=The Horizons?
|
||||
achievement.horizonsStart.desc=Sende einen netten Typen zum Mond.
|
||||
achievement.horizonsEnd=The Horizons.
|
||||
achievement.horizonsEnd.desc=Bring Tom nach Hause.
|
||||
achievement.horizonsBonus=The Horizons!
|
||||
achievement.horizonsBonus.desc=mist kacke mist kacke mist kacke mist kacke mist kacke mist kacke mist kacke mist kacke mist kacke mist kacke mist kacke mist kacke mist kacke mist kacke mist kacke
|
||||
|
||||
potion.hbm_taint=Verdorben
|
||||
potion.hbm_mutation=Verdorbenes Herz
|
||||
@ -474,6 +480,8 @@ tile.machine_reactor_small.name=Atomreaktor
|
||||
container.reactorSmall=Atomreaktor
|
||||
tile.machine_controller.name=Reaktorfernsteuerung
|
||||
container.reactorControl=Reaktorfernsteuerung
|
||||
tile.soyuz_capsule.name=Landekapsel
|
||||
container.soyuzCapsule=Landekapsel
|
||||
|
||||
tile.barrel_plastic.name=Sicheres Fass™
|
||||
tile.barrel_corroded.name=Verrostetes Fass
|
||||
@ -1484,6 +1492,7 @@ item.ammo_12gauge.name=Kaliber 12 Schrot
|
||||
item.ammo_12gauge_incendiary.name=Kaliber 12 Schrot (Brand)
|
||||
item.ammo_12gauge_shrapnel.name=Kaliber 12 Schrot (Schrapnell)
|
||||
item.ammo_12gauge_du.name=Kaliber 12 Schrot (Uranbeschichtung)
|
||||
item.ammo_12gauge_marauder.name=Kaliber 12 Taktische Anti-Marauder Schrotpatrone
|
||||
item.ammo_20gauge.name=Kaliber 20 Schrot
|
||||
item.ammo_20gauge_slug.name=Kaliber 20 Brenneke
|
||||
item.ammo_20gauge_flechette.name=Kaliber 20 Flechet
|
||||
@ -1889,7 +1898,7 @@ item.missile_custom.name=Spezialgefertigte Rakete
|
||||
|
||||
item.missile_carrier.name=HTR-01 Trägerrakete
|
||||
item.missile_soyuz.name=Soyuz-FG
|
||||
item.missile_soyuz_lander.name=Soyuz-Orbitalmodul
|
||||
item.missile_soyuz_lander.name=Orbitalmodul
|
||||
item.sat_mapper.name=Oberflächen-Abtastungssatellit
|
||||
item.sat_scanner.name=Satellit mit Tiefenscanning-Modul
|
||||
item.sat_radar.name=Radar-Überwachungssatellit
|
||||
|
||||
@ -45,6 +45,12 @@ achievement.nuclear=Atomic Science
|
||||
achievement.nuclear.desc=Bobmazon Level 5 (Uranium Fuel)
|
||||
achievement.hidden=Hidden Catalog
|
||||
achievement.hidden.desc=Kill an enderman with a falling boxcar while being on fire and having more than 250 RADs.
|
||||
achievement.horizonsStart=The Horizons?
|
||||
achievement.horizonsStart.desc=Send a lad to the moon.
|
||||
achievement.horizonsEnd=The Horizons.
|
||||
achievement.horizonsEnd.desc=Send Tom home.
|
||||
achievement.horizonsBonus=The Horizons!
|
||||
achievement.horizonsBonus.desc=oh poop oh crap oh poop oh crap oh poop oh crap oh poop oh crap oh poop oh crap oh poop oh crap oh poop oh crap oh poop oh crap oh poop oh crap oh poop oh crap
|
||||
|
||||
potion.hbm_taint=Tainted
|
||||
potion.hbm_mutation=Tainted Heart
|
||||
@ -474,6 +480,8 @@ tile.machine_reactor_small.name=Nuclear Reactor
|
||||
container.reactorSmall=Nuclear Reactor
|
||||
tile.machine_controller.name=Reactor Remote Control Block
|
||||
container.reactorControl=Reactor Remote Control Block
|
||||
tile.soyuz_capsule.name=Cargo Landing Capsule
|
||||
container.soyuzCapsule=Cargo Landing Capsule
|
||||
|
||||
tile.barrel_plastic.name=Safe Barrel™
|
||||
tile.barrel_corroded.name=Corroded Barrel
|
||||
@ -1484,6 +1492,7 @@ item.ammo_12gauge.name=12 Gauge Buckshot
|
||||
item.ammo_12gauge_incendiary.name=12 Gauge Buckshot (Incendiary)
|
||||
item.ammo_12gauge_shrapnel.name=12 Gauge Buckshot (Shrapnel)
|
||||
item.ammo_12gauge_du.name=12 Gauge Buckshot (Uranium Coated)
|
||||
item.ammo_12gauge_marauder.name=12 Gauge Tactical Anti-Marauder Shell
|
||||
item.ammo_20gauge.name=20 Gauge Buckshot
|
||||
item.ammo_20gauge_slug.name=20 Gauge Brenneke Slug
|
||||
item.ammo_20gauge_flechette.name=20 Gauge Flechette Shell
|
||||
@ -1889,7 +1898,7 @@ item.missile_custom.name=Custom Missile
|
||||
|
||||
item.missile_carrier.name=HTR-01 Carrier Rocket
|
||||
item.missile_soyuz.name=Soyuz-FG
|
||||
item.missile_soyuz_lander.name=Soyuz Orbital Module
|
||||
item.missile_soyuz_lander.name=Orbital Module
|
||||
item.sat_mapper.name=Surface Mapping Satellite
|
||||
item.sat_scanner.name=Satellite with Depth-Resource Scanning Module
|
||||
item.sat_radar.name=Radar Survey Satellite
|
||||
|
||||
@ -132,6 +132,7 @@
|
||||
"entity.chopperCrashingLoop": {"category": "hostile", "sounds": [{"name": "entity/chopperCrashingLoop", "stream": true}]},
|
||||
"entity.oldExplosion": {"category": "ambient", "sounds": [{"name": "entity/oldExplosion", "stream": false}]},
|
||||
"entity.rocketTakeoff": {"category": "player", "sounds": [{"name": "entity/rocketTakeoff", "stream": false}]},
|
||||
"entity.soyuzTakeoff": {"category": "player", "sounds": [{"name": "entity/soyuzTakeoff", "stream": false}]},
|
||||
"entity.bombDet": {"category": "player", "sounds": ["entity/bombDet1", "entity/bombDet2", "entity/bombDet3"]},
|
||||
"entity.bombWhistle": {"category": "player", "sounds": [{"name": "entity/bombWhistle", "stream": false}]},
|
||||
"entity.bomberLoop": {"category": "player", "sounds": [{"name": "entity/bomber1", "stream": false}]},
|
||||
@ -167,5 +168,6 @@
|
||||
"alarm.easAlarm": {"category": "record", "sounds": [{"name": "alarm/easAlarm", "stream": false}]},
|
||||
"alarm.airRaid": {"category": "record", "sounds": [{"name": "alarm/airRaid", "stream": true}]},
|
||||
"alarm.classic": {"category": "record", "sounds": [{"name": "alarm/classicSiren", "stream": false}]},
|
||||
"alarm.gambit": {"category": "record", "sounds": [{"name": "alarm/gambit", "stream": true}]}
|
||||
"alarm.gambit": {"category": "record", "sounds": [{"name": "alarm/gambit", "stream": true}]},
|
||||
"alarm.soyuzed": {"category": "record", "sounds": [{"name": "alarm/soyuzed", "stream": false}]}
|
||||
}
|
||||
|
||||
BIN
assets/hbm/sounds/alarm/soyuzed.ogg
Normal file
BIN
assets/hbm/textures/blocks/block_euphemium
Normal file
|
After Width: | Height: | Size: 297 B |
BIN
assets/hbm/textures/blocks/soyuz_capsule.png
Normal file
|
After Width: | Height: | Size: 377 B |
BIN
assets/hbm/textures/gui/satellites/gui_sat_coord.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
BIN
assets/hbm/textures/items/ammo_12gauge_marauder.png
Normal file
|
After Width: | Height: | Size: 381 B |
|
Before Width: | Height: | Size: 288 B After Width: | Height: | Size: 363 B |
|
Before Width: | Height: | Size: 232 B After Width: | Height: | Size: 358 B |
|
Before Width: | Height: | Size: 291 B After Width: | Height: | Size: 340 B |
|
Before Width: | Height: | Size: 279 B After Width: | Height: | Size: 357 B |
|
Before Width: | Height: | Size: 307 B After Width: | Height: | Size: 359 B |
|
Before Width: | Height: | Size: 308 B After Width: | Height: | Size: 369 B |
|
Before Width: | Height: | Size: 300 B After Width: | Height: | Size: 336 B |
|
Before Width: | Height: | Size: 285 B After Width: | Height: | Size: 327 B |
|
Before Width: | Height: | Size: 308 B After Width: | Height: | Size: 352 B |
BIN
assets/hbm/textures/items/sat_coord.png
Normal file
|
After Width: | Height: | Size: 280 B |
|
Before Width: | Height: | Size: 662 B After Width: | Height: | Size: 822 B |
BIN
assets/hbm/textures/items/sat_gerald_mask.png
Normal file
|
After Width: | Height: | Size: 303 B |
BIN
assets/hbm/textures/items/soyuz_0.png
Normal file
|
After Width: | Height: | Size: 245 B |
BIN
assets/hbm/textures/items/soyuz_1.png
Normal file
|
After Width: | Height: | Size: 253 B |
BIN
assets/hbm/textures/items/soyuz_2.png
Normal file
|
After Width: | Height: | Size: 355 B |
@ -5,9 +5,7 @@ import com.hbm.explosion.ExplosionLarge;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.tool.ItemSatChip;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.saveddata.SatelliteSaveStructure;
|
||||
import com.hbm.saveddata.SatelliteSaveStructure.SatelliteType;
|
||||
import com.hbm.saveddata.SatelliteSavedData;
|
||||
import com.hbm.saveddata.satellites.Satellite;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -118,33 +116,10 @@ public class EntityCarrier extends EntityThrowable {
|
||||
}
|
||||
|
||||
if(payload.getItem() instanceof ItemSatChip) {
|
||||
SatelliteSavedData data = (SatelliteSavedData)worldObj.perWorldStorage.loadData(SatelliteSavedData.class, "satellites");
|
||||
if(data == null) {
|
||||
worldObj.perWorldStorage.setData("satellites", new SatelliteSavedData(worldObj));
|
||||
|
||||
data = (SatelliteSavedData)worldObj.perWorldStorage.loadData(SatelliteSavedData.class, "satellites");
|
||||
}
|
||||
|
||||
|
||||
int freq = ItemSatChip.getFreq(payload);
|
||||
|
||||
if(!data.isFreqTaken(freq)) {
|
||||
if(payload.getItem() == ModItems.sat_mapper)
|
||||
data.satellites.add(new SatelliteSaveStructure(freq, SatelliteType.MAPPER, this.dimension));
|
||||
if(payload.getItem() == ModItems.sat_scanner)
|
||||
data.satellites.add(new SatelliteSaveStructure(freq, SatelliteType.SCANNER, this.dimension));
|
||||
if(payload.getItem() == ModItems.sat_radar)
|
||||
data.satellites.add(new SatelliteSaveStructure(freq, SatelliteType.RADAR, this.dimension));
|
||||
if(payload.getItem() == ModItems.sat_laser)
|
||||
data.satellites.add(new SatelliteSaveStructure(freq, SatelliteType.LASER, this.dimension));
|
||||
if(payload.getItem() == ModItems.sat_foeq)
|
||||
data.satellites.add(new SatelliteSaveStructure(freq, SatelliteType.RELAY, this.dimension));
|
||||
if(payload.getItem() == ModItems.sat_resonator)
|
||||
data.satellites.add(new SatelliteSaveStructure(freq, SatelliteType.RESONATOR, this.dimension));
|
||||
if(payload.getItem() == ModItems.sat_miner)
|
||||
data.satellites.add(new SatelliteSaveStructure(freq, SatelliteType.MINER, this.dimension));
|
||||
|
||||
data.markDirty();
|
||||
}
|
||||
|
||||
Satellite.orbit(worldObj, Satellite.getIDFromItem(payload.getItem()), freq, posX, posY, posZ);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,12 +2,17 @@ package com.hbm.entity.missile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.explosion.ExplosionLarge;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.tool.ItemSatChip;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.saveddata.satellites.Satellite;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
@ -21,6 +26,7 @@ public class EntitySoyuz extends Entity {
|
||||
public int mode;
|
||||
public int targetX;
|
||||
public int targetZ;
|
||||
boolean memed = false;
|
||||
|
||||
private ItemStack[] payload;
|
||||
|
||||
@ -48,6 +54,11 @@ public class EntitySoyuz extends Entity {
|
||||
for(Entity e : list) {
|
||||
e.setFire(15);
|
||||
e.attackEntityFrom(ModDamageSource.exhaust, 100.0F);
|
||||
|
||||
if(!memed && e instanceof EntityPlayer) {
|
||||
memed = true;
|
||||
worldObj.playSoundEffect(posX, posY, posZ, "hbm:alarm.soyuzed", 100, 1.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,7 +92,29 @@ public class EntitySoyuz extends Entity {
|
||||
private void deployPayload() {
|
||||
|
||||
if(mode == 0 && payload != null) {
|
||||
|
||||
|
||||
if(payload[0] != null) {
|
||||
|
||||
ItemStack load = payload[0];
|
||||
|
||||
if(load.getItem() == ModItems.flame_pony) {
|
||||
ExplosionLarge.spawnTracers(worldObj, posX, posY, posZ, 25);
|
||||
for(Object p : worldObj.playerEntities)
|
||||
((EntityPlayer)p).triggerAchievement(MainRegistry.achSpace);
|
||||
}
|
||||
|
||||
if(load.getItem() == ModItems.sat_foeq) {
|
||||
for(Object p : worldObj.playerEntities)
|
||||
((EntityPlayer)p).triggerAchievement(MainRegistry.achFOEQ);
|
||||
}
|
||||
|
||||
if(load.getItem() instanceof ItemSatChip) {
|
||||
|
||||
int freq = ItemSatChip.getFreq(load);
|
||||
|
||||
Satellite.orbit(worldObj, Satellite.getIDFromItem(load.getItem()), freq, posX, posY, posZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(mode == 1) {
|
||||
|
||||
@ -71,6 +71,7 @@ public class BulletConfigSyncingUtil {
|
||||
public static int G12_INCENDIARY = i++;
|
||||
public static int G12_SHRAPNEL = i++;
|
||||
public static int G12_DU = i++;
|
||||
public static int G12_AM = i++;
|
||||
|
||||
public static int LR22_NORMAL = i++;
|
||||
public static int LR22_AP = i++;
|
||||
@ -178,6 +179,7 @@ public class BulletConfigSyncingUtil {
|
||||
configSet.add(new ConfigKeyPair(Gun12GaugeFactory.get12GaugeFireConfig(), G12_INCENDIARY));
|
||||
configSet.add(new ConfigKeyPair(Gun12GaugeFactory.get12GaugeShrapnelConfig(), G12_SHRAPNEL));
|
||||
configSet.add(new ConfigKeyPair(Gun12GaugeFactory.get12GaugeDUConfig(), G12_DU));
|
||||
configSet.add(new ConfigKeyPair(Gun12GaugeFactory.get12GaugeAMConfig(), G12_AM));
|
||||
|
||||
configSet.add(new ConfigKeyPair(Gun22LRFactory.get22LRConfig(), LR22_NORMAL));
|
||||
configSet.add(new ConfigKeyPair(Gun22LRFactory.get22LRAPConfig(), LR22_AP));
|
||||
|
||||
@ -1691,6 +1691,8 @@ public class GUIHandler implements IGuiHandler {
|
||||
return new GUIScreenDesignator(player);
|
||||
case ModItems.guiID_item_sat_interface:
|
||||
return new GUIScreenSatInterface(player);
|
||||
case ModItems.guiID_item_sat_coord:
|
||||
return new GUIScreenSatCoord(player);
|
||||
case ModItems.guiID_item_box:
|
||||
return new GUILeadBox(new ContainerLeadBox(player, player.inventory, new InventoryLeadBox(player.getHeldItem())));
|
||||
case ModItems.guiID_item_bobmazon:
|
||||
|
||||
@ -2,12 +2,19 @@ package com.hbm.handler.guncfg;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.hbm.entity.projectile.EntityBulletBase;
|
||||
import com.hbm.handler.BulletConfigSyncingUtil;
|
||||
import com.hbm.handler.BulletConfiguration;
|
||||
import com.hbm.handler.GunConfiguration;
|
||||
import com.hbm.interfaces.IBulletHurtBehavior;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.potion.HbmPotion;
|
||||
import com.hbm.render.util.RenderScreenOverlay.Crosshair;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
|
||||
public class Gun12GaugeFactory {
|
||||
|
||||
public static GunConfiguration getUboinikConfig() {
|
||||
@ -40,6 +47,7 @@ public class Gun12GaugeFactory {
|
||||
config.config.add(BulletConfigSyncingUtil.G12_INCENDIARY);
|
||||
config.config.add(BulletConfigSyncingUtil.G12_SHRAPNEL);
|
||||
config.config.add(BulletConfigSyncingUtil.G12_DU);
|
||||
config.config.add(BulletConfigSyncingUtil.G12_AM);
|
||||
|
||||
return config;
|
||||
}
|
||||
@ -76,6 +84,7 @@ public class Gun12GaugeFactory {
|
||||
config.config.add(BulletConfigSyncingUtil.G12_INCENDIARY);
|
||||
config.config.add(BulletConfigSyncingUtil.G12_SHRAPNEL);
|
||||
config.config.add(BulletConfigSyncingUtil.G12_DU);
|
||||
config.config.add(BulletConfigSyncingUtil.G12_AM);
|
||||
|
||||
return config;
|
||||
}
|
||||
@ -132,5 +141,29 @@ public class Gun12GaugeFactory {
|
||||
|
||||
return bullet;
|
||||
}
|
||||
|
||||
public static BulletConfiguration get12GaugeAMConfig() {
|
||||
|
||||
BulletConfiguration bullet = BulletConfigFactory.standardBuckshotConfig();
|
||||
|
||||
bullet.ammo = ModItems.ammo_12gauge_marauder;
|
||||
bullet.wear = 20;
|
||||
bullet.dmgMin = 100;
|
||||
bullet.dmgMax = 500;
|
||||
bullet.leadChance = 50;
|
||||
|
||||
bullet.bHurt = new IBulletHurtBehavior() {
|
||||
|
||||
@Override
|
||||
public void behaveEntityHurt(EntityBulletBase bullet, Entity hit) {
|
||||
|
||||
if(hit instanceof EntityLivingBase)
|
||||
((EntityLivingBase)hit).addPotionEffect(new PotionEffect(HbmPotion.bang.id, 20, 0));
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
return bullet;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -2025,7 +2025,7 @@ public class MachineRecipes {
|
||||
if(name.length() > 5 && name.substring(0, 5).equals("ingot")) {
|
||||
ItemStack dust = getDustByName(name.substring(5));
|
||||
|
||||
if(dust != null) {
|
||||
if(dust != null && dust.getItem() != ModItems.scrap) {
|
||||
|
||||
for(ItemStack stack : matches) {
|
||||
shredderRecipes.put(new StackWrapper(stack), dust);
|
||||
@ -2034,7 +2034,7 @@ public class MachineRecipes {
|
||||
} else if(name.length() > 3 && name.substring(0, 3).equals("ore")) {
|
||||
ItemStack dust = getDustByName(name.substring(3));
|
||||
|
||||
if(dust != null) {
|
||||
if(dust != null && dust.getItem() != ModItems.scrap) {
|
||||
|
||||
dust.stackSize = 2;
|
||||
|
||||
@ -2045,7 +2045,7 @@ public class MachineRecipes {
|
||||
} else if(name.length() > 5 && name.substring(0, 5).equals("block")) {
|
||||
ItemStack dust = getDustByName(name.substring(5));
|
||||
|
||||
if(dust != null) {
|
||||
if(dust != null && dust.getItem() != ModItems.scrap) {
|
||||
|
||||
dust.stackSize = 9;
|
||||
|
||||
@ -2056,7 +2056,7 @@ public class MachineRecipes {
|
||||
} else if(name.length() > 3 && name.substring(0, 3).equals("gem")) {
|
||||
ItemStack dust = getDustByName(name.substring(3));
|
||||
|
||||
if(dust != null) {
|
||||
if(dust != null && dust.getItem() != ModItems.scrap) {
|
||||
|
||||
for(ItemStack stack : matches) {
|
||||
shredderRecipes.put(new StackWrapper(stack), dust);
|
||||
@ -2065,7 +2065,6 @@ public class MachineRecipes {
|
||||
} else if(name.length() > 3 && name.substring(0, 4).equals("dust")) {
|
||||
|
||||
for(ItemStack stack : matches) {
|
||||
System.out.println("DUST Added " + stack.getDisplayName() + " to dust");
|
||||
shredderRecipes.put(new StackWrapper(stack), new ItemStack(ModItems.dust));
|
||||
}
|
||||
}
|
||||
|
||||
@ -189,8 +189,6 @@ public class GUIRadiobox extends GuiInfoContainer {
|
||||
protected void save() {
|
||||
|
||||
rectify();
|
||||
|
||||
//TODO: send packet here
|
||||
}
|
||||
|
||||
|
||||
|
||||
139
com/hbm/inventory/gui/GUIScreenSatCoord.java
Normal file
@ -0,0 +1,139 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.gui.GUIRadioRec.RadioButton;
|
||||
import com.hbm.items.tool.ItemSatInterface;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.SatLaserPacket;
|
||||
import com.hbm.saveddata.satellites.Satellite.CoordActions;
|
||||
import com.hbm.saveddata.satellites.Satellite.InterfaceActions;
|
||||
import com.hbm.saveddata.satellites.Satellite.Interfaces;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIScreenSatCoord extends GuiScreen {
|
||||
|
||||
protected static final ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/satellites/gui_sat_coord.png");
|
||||
protected int xSize = 176;
|
||||
protected int ySize = 126;
|
||||
protected int guiLeft;
|
||||
protected int guiTop;
|
||||
private final EntityPlayer player;
|
||||
int x;
|
||||
int z;
|
||||
|
||||
private GuiTextField xField;
|
||||
private GuiTextField yField;
|
||||
private GuiTextField zField;
|
||||
|
||||
public GUIScreenSatCoord(EntityPlayer player) {
|
||||
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
this.guiLeft = (this.width - this.xSize) / 2;
|
||||
this.guiTop = (this.height - this.ySize) / 2;
|
||||
|
||||
Keyboard.enableRepeatEvents(true);
|
||||
this.xField = new GuiTextField(this.fontRendererObj, guiLeft + 66, guiTop + 21, 48, 12);
|
||||
this.xField.setTextColor(-1);
|
||||
this.xField.setDisabledTextColour(-1);
|
||||
this.xField.setEnableBackgroundDrawing(false);
|
||||
this.xField.setMaxStringLength(5);
|
||||
this.yField = new GuiTextField(this.fontRendererObj, guiLeft + 66, guiTop + 56, 48, 12);
|
||||
this.yField.setTextColor(-1);
|
||||
this.yField.setDisabledTextColour(-1);
|
||||
this.yField.setEnableBackgroundDrawing(false);
|
||||
this.yField.setMaxStringLength(5);
|
||||
this.zField = new GuiTextField(this.fontRendererObj, guiLeft + 66, guiTop + 92, 48, 12);
|
||||
this.zField.setTextColor(-1);
|
||||
this.zField.setDisabledTextColour(-1);
|
||||
this.zField.setEnableBackgroundDrawing(false);
|
||||
this.zField.setMaxStringLength(5);
|
||||
}
|
||||
|
||||
protected void mouseClicked(int i, int j, int k)
|
||||
{
|
||||
super.mouseClicked(i, j, k);
|
||||
this.xField.mouseClicked(i, j, k);
|
||||
if(ItemSatInterface.currentSat.coordAcs.contains(CoordActions.HAS_Y)) this.yField.mouseClicked(i, j, k);
|
||||
this.zField.mouseClicked(i, j, k);
|
||||
|
||||
if(i >= this.guiLeft + 133 && i < this.guiLeft + 133 + 18 && j >= this.guiTop + 52 && j < this.guiTop + 52 + 18 && player != null) {
|
||||
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("hbm:item.techBleep"), 1.0F));
|
||||
|
||||
PacketDispatcher.wrapper.sendToServer(new SatLaserPacket(x, z, ItemSatInterface.getFreq(player.getHeldItem())));
|
||||
}
|
||||
}
|
||||
|
||||
public void drawScreen(int mouseX, int mouseY, float f)
|
||||
{
|
||||
this.drawDefaultBackground();
|
||||
this.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
this.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesGuiPauseGame() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
|
||||
this.xField.drawTextBox();
|
||||
if(ItemSatInterface.currentSat.coordAcs.contains(CoordActions.HAS_Y)) this.yField.drawTextBox();
|
||||
this.zField.drawTextBox();
|
||||
}
|
||||
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
if(ItemSatInterface.currentSat != null) {
|
||||
|
||||
drawTexturedModalRect(guiLeft + 120, guiTop + 17, 194, 0, 7, 7);
|
||||
|
||||
if(ItemSatInterface.currentSat.satIface == Interfaces.SAT_COORD) {
|
||||
|
||||
drawTexturedModalRect(guiLeft + 120, guiTop + 25, 194, 0, 7, 7);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void keyTyped(char p_73869_1_, int p_73869_2_) {
|
||||
|
||||
|
||||
if (this.xField.textboxKeyTyped(p_73869_1_, p_73869_2_)) {
|
||||
} else if (ItemSatInterface.currentSat.coordAcs.contains(CoordActions.HAS_Y) && this.yField.textboxKeyTyped(p_73869_1_, p_73869_2_)) {
|
||||
} else if (this.zField.textboxKeyTyped(p_73869_1_, p_73869_2_)) {
|
||||
} else {
|
||||
|
||||
super.keyTyped(p_73869_1_, p_73869_2_);
|
||||
}
|
||||
|
||||
if (p_73869_2_ == 1 || p_73869_2_ == this.mc.gameSettings.keyBindInventory.getKeyCode())
|
||||
{
|
||||
this.mc.thePlayer.closeScreen();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -7,14 +7,12 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.entity.missile.EntityMissileBaseAdvanced;
|
||||
import com.hbm.inventory.MachineRecipes;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.tool.ItemSatChip;
|
||||
import com.hbm.items.tool.ItemSatInterface;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.SatLaserPacket;
|
||||
import com.hbm.saveddata.SatelliteSaveStructure;
|
||||
import com.hbm.saveddata.SatelliteSaveStructure.SatelliteType;
|
||||
import com.hbm.saveddata.satellites.Satellite.InterfaceActions;
|
||||
import com.hbm.saveddata.satellites.Satellite.Interfaces;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
@ -30,13 +28,12 @@ import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class GUIScreenSatInterface extends GuiScreen {
|
||||
|
||||
protected static final ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_sat_interface.png");
|
||||
protected static final ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/satellites/gui_sat_interface.png");
|
||||
protected int xSize = 216;
|
||||
protected int ySize = 216;
|
||||
protected int guiLeft;
|
||||
protected int guiTop;
|
||||
private final EntityPlayer player;
|
||||
protected SatelliteSaveStructure connectedSat;
|
||||
int x;
|
||||
int z;
|
||||
|
||||
@ -50,15 +47,15 @@ public class GUIScreenSatInterface extends GuiScreen {
|
||||
|
||||
protected void mouseClicked(int i, int j, int k) {
|
||||
|
||||
if(connectedSat != null && connectedSat.satelliteType == SatelliteType.LASER) {
|
||||
if(ItemSatInterface.currentSat != null && ItemSatInterface.currentSat.ifaceAcs.contains(InterfaceActions.CAN_CLICK)) {
|
||||
|
||||
if(i >= this.guiLeft + 8 && i < this.guiLeft + 208 && j >= this.guiTop + 8 && j < this.guiTop + 208 && player != null) {
|
||||
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("hbm:item.techBleep"), 1.0F));
|
||||
|
||||
|
||||
int x = this.x - guiLeft + i - 8 - 100;
|
||||
int z = this.z - guiTop + j - 8 - 100;
|
||||
PacketDispatcher.wrapper.sendToServer(new SatLaserPacket(x, z, connectedSat.satelliteID));
|
||||
PacketDispatcher.wrapper.sendToServer(new SatLaserPacket(x, z, ItemSatInterface.getFreq(player.getHeldItem())));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -80,13 +77,6 @@ public class GUIScreenSatInterface extends GuiScreen {
|
||||
|
||||
x = (int) player.posX;
|
||||
z = (int) player.posZ;
|
||||
|
||||
if(ItemSatInterface.satData != null && player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.sat_interface) {
|
||||
|
||||
int freq = ItemSatChip.getFreq(player.getHeldItem());
|
||||
|
||||
connectedSat = ItemSatInterface.satData.getSatFromFreq(freq);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -96,8 +86,7 @@ public class GUIScreenSatInterface extends GuiScreen {
|
||||
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
|
||||
if(connectedSat != null && connectedSat.satelliteType == SatelliteType.LASER) {
|
||||
|
||||
if(ItemSatInterface.currentSat != null && ItemSatInterface.currentSat.ifaceAcs.contains(InterfaceActions.SHOW_COORDS)) {
|
||||
|
||||
if(i >= this.guiLeft + 8 && i < this.guiLeft + 208 && j >= this.guiTop + 8 && j < this.guiTop + 208 && player != null) {
|
||||
|
||||
@ -113,27 +102,23 @@ public class GUIScreenSatInterface extends GuiScreen {
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
if(connectedSat == null) {
|
||||
if(ItemSatInterface.currentSat == null) {
|
||||
drawNotConnected();
|
||||
} else if(connectedSat.satDim != player.dimension) {
|
||||
drawNoService();
|
||||
} else {
|
||||
switch(connectedSat.satelliteType) {
|
||||
|
||||
if(ItemSatInterface.currentSat.satIface != Interfaces.SAT_PANEL) {
|
||||
drawNoService();
|
||||
return;
|
||||
}
|
||||
|
||||
case LASER:
|
||||
case MAPPER:
|
||||
drawMap(); break;
|
||||
|
||||
case RADAR:
|
||||
drawRadar(); break;
|
||||
|
||||
case SCANNER:
|
||||
drawScan(); break;
|
||||
|
||||
case RELAY:
|
||||
case RESONATOR:
|
||||
case MINER:
|
||||
drawNoService(); break;
|
||||
if(ItemSatInterface.currentSat.ifaceAcs.contains(InterfaceActions.HAS_MAP)) {
|
||||
drawMap();
|
||||
}
|
||||
if(ItemSatInterface.currentSat.ifaceAcs.contains(InterfaceActions.HAS_ORES)) {
|
||||
drawScan();
|
||||
}
|
||||
if(ItemSatInterface.currentSat.ifaceAcs.contains(InterfaceActions.HAS_RADAR)) {
|
||||
drawRadar();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,8 +36,12 @@ public class GUISoyuzLauncher extends GuiInfoContainer {
|
||||
launcher.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 26, guiTop + 36, 16, 52);
|
||||
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 49, guiTop + 72, 6, 34, launcher.power, launcher.maxPower);
|
||||
|
||||
//this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 43, guiTop + 17, 18, 18, mouseX, mouseY, new String[]{"The Soyuz goes here"} );
|
||||
//this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 43, guiTop + 35, 18, 18, mouseX, mouseY, new String[]{"Designator for cargo mode"} );
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 43, guiTop + 17, 18, 18, mouseX, mouseY, new String[]{"The Soyuz goes here"} );
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 43, guiTop + 35, 18, 18, mouseX, mouseY, new String[]{"Designator only for CARGO MODE"} );
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 133, guiTop + 17, 18, 18, mouseX, mouseY, new String[]{"The payload for SATELLITE MODE"} );
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 133, guiTop + 35, 18, 18, mouseX, mouseY, new String[]{"The orbital module for special payloads"} );
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 88, guiTop + 17, 18, 18, mouseX, mouseY, new String[]{"SATELLITE MODE"} );
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 88, guiTop + 35, 18, 18, mouseX, mouseY, new String[]{"CARGO MODE"} );
|
||||
}
|
||||
|
||||
protected void mouseClicked(int x, int y, int i) {
|
||||
@ -100,6 +104,16 @@ public class GUISoyuzLauncher extends GuiInfoContainer {
|
||||
int k = launcher.mode;
|
||||
drawTexturedModalRect(guiLeft + 88, guiTop + 17 + k * 18, 176, 18 + k * 18, 18, 18);
|
||||
|
||||
int l = launcher.orbital();
|
||||
|
||||
if(l > 0)
|
||||
drawTexturedModalRect(guiLeft + 115, guiTop + 35, 176 + (l - 1) * 18, 0, 18, 18);
|
||||
|
||||
int m = launcher.satellite();
|
||||
|
||||
if(m > 0)
|
||||
drawTexturedModalRect(guiLeft + 115, guiTop + 17, 176 + (m - 1) * 18, 0, 18, 18);
|
||||
|
||||
if(launcher.starting)
|
||||
drawTexturedModalRect(guiLeft + 151, guiTop + 17, 176, 54, 18, 18);
|
||||
|
||||
|
||||
@ -1037,11 +1037,13 @@ public class ModItems {
|
||||
public static Item sat_gerald;
|
||||
public static Item sat_chip;
|
||||
public static Item sat_interface;
|
||||
public static Item sat_coord;
|
||||
|
||||
public static Item ammo_12gauge;
|
||||
public static Item ammo_12gauge_incendiary;
|
||||
public static Item ammo_12gauge_shrapnel;
|
||||
public static Item ammo_12gauge_du;
|
||||
public static Item ammo_12gauge_marauder;
|
||||
public static Item ammo_20gauge;
|
||||
public static Item ammo_20gauge_slug;
|
||||
public static Item ammo_20gauge_flechette;
|
||||
@ -1806,6 +1808,7 @@ public class ModItems {
|
||||
public static final int guiID_item_sat_interface = 101;
|
||||
public static final int guiID_item_box = 102;
|
||||
public static final int guiID_item_bobmazon = 103;
|
||||
public static final int guiID_item_sat_coord = 104;
|
||||
|
||||
public static Item mysteryshovel;
|
||||
public static Item memory;
|
||||
@ -2581,7 +2584,7 @@ public class ModItems {
|
||||
missile_emp = new Item().setUnlocalizedName("missile_emp").setMaxStackSize(1).setCreativeTab(MainRegistry.missileTab).setTextureName(RefStrings.MODID + ":missile_emp");
|
||||
missile_carrier = new Item().setUnlocalizedName("missile_carrier").setMaxStackSize(1).setCreativeTab(MainRegistry.missileTab).setTextureName(RefStrings.MODID + ":missile_carrier");
|
||||
missile_soyuz = new ItemSoyuz().setUnlocalizedName("missile_soyuz").setMaxStackSize(1).setCreativeTab(MainRegistry.missileTab).setTextureName(RefStrings.MODID + ":soyuz");
|
||||
missile_soyuz_lander = new Item().setUnlocalizedName("missile_soyuz_lander").setMaxStackSize(1).setCreativeTab(MainRegistry.missileTab).setTextureName(RefStrings.MODID + ":soyuz_lander");
|
||||
missile_soyuz_lander = new ItemCustomLore().setUnlocalizedName("missile_soyuz_lander").setMaxStackSize(1).setCreativeTab(MainRegistry.missileTab).setTextureName(RefStrings.MODID + ":soyuz_lander");
|
||||
missile_custom = new ItemCustomMissile().setUnlocalizedName("missile_custom").setMaxStackSize(1).setCreativeTab(null).setTextureName(RefStrings.MODID + ":missile_custom");
|
||||
sat_mapper = new ItemSatChip().setUnlocalizedName("sat_mapper").setMaxStackSize(1).setCreativeTab(MainRegistry.missileTab).setTextureName(RefStrings.MODID + ":sat_mapper");
|
||||
sat_scanner = new ItemSatChip().setUnlocalizedName("sat_scanner").setMaxStackSize(1).setCreativeTab(MainRegistry.missileTab).setTextureName(RefStrings.MODID + ":sat_scanner");
|
||||
@ -2593,6 +2596,7 @@ public class ModItems {
|
||||
sat_gerald = new ItemSatChip().setUnlocalizedName("sat_gerald").setMaxStackSize(1).setCreativeTab(MainRegistry.missileTab).setTextureName(RefStrings.MODID + ":sat_gerald");
|
||||
sat_chip = new ItemSatChip().setUnlocalizedName("sat_chip").setMaxStackSize(1).setCreativeTab(MainRegistry.missileTab).setTextureName(RefStrings.MODID + ":sat_chip");
|
||||
sat_interface = new ItemSatInterface().setUnlocalizedName("sat_interface").setMaxStackSize(1).setCreativeTab(MainRegistry.missileTab).setTextureName(RefStrings.MODID + ":sat_interface");
|
||||
sat_coord = new ItemSatInterface().setUnlocalizedName("sat_coord").setMaxStackSize(1).setCreativeTab(MainRegistry.missileTab).setTextureName(RefStrings.MODID + ":sat_coord");
|
||||
|
||||
mp_thruster_10_kerosene = new ItemMissile().makeThruster(FuelType.KEROSENE, 1F, 1.5F, PartSize.SIZE_10).setHealth(10F) .setUnlocalizedName("mp_thruster_10_kerosene");
|
||||
mp_thruster_10_kerosene_tec = new ItemMissile().makeThruster(FuelType.KEROSENE, 1F, 1.5F, PartSize.SIZE_10).setHealth(15F).setRarity(Rarity.COMMON).setUnlocalizedName("mp_thruster_10_kerosene_tec");
|
||||
@ -2747,6 +2751,7 @@ public class ModItems {
|
||||
ammo_12gauge_incendiary = new ItemAmmo().setUnlocalizedName("ammo_12gauge_incendiary").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":ammo_12gauge_incendiary");
|
||||
ammo_12gauge_shrapnel = new ItemAmmo().setUnlocalizedName("ammo_12gauge_shrapnel").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":ammo_12gauge_shrapnel");
|
||||
ammo_12gauge_du = new ItemAmmo().setUnlocalizedName("ammo_12gauge_du").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":ammo_12gauge_du");
|
||||
ammo_12gauge_marauder = new ItemAmmo().setUnlocalizedName("ammo_12gauge_marauder").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":ammo_12gauge_marauder");
|
||||
ammo_20gauge = new ItemAmmo().setUnlocalizedName("ammo_20gauge").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":ammo_20gauge");
|
||||
ammo_20gauge_slug = new ItemAmmo().setUnlocalizedName("ammo_20gauge_slug").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":ammo_20gauge_slug");
|
||||
ammo_20gauge_flechette = new ItemAmmo().setUnlocalizedName("ammo_20gauge_flechette").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":ammo_20gauge_flechette");
|
||||
@ -4605,6 +4610,7 @@ public class ModItems {
|
||||
GameRegistry.registerItem(sat_gerald, sat_gerald.getUnlocalizedName());
|
||||
GameRegistry.registerItem(sat_chip, sat_chip.getUnlocalizedName());
|
||||
GameRegistry.registerItem(sat_interface, sat_interface.getUnlocalizedName());
|
||||
GameRegistry.registerItem(sat_coord, sat_coord.getUnlocalizedName());
|
||||
|
||||
//Guns
|
||||
GameRegistry.registerItem(gun_revolver_iron, gun_revolver_iron.getUnlocalizedName());
|
||||
@ -4715,6 +4721,7 @@ public class ModItems {
|
||||
GameRegistry.registerItem(ammo_12gauge_incendiary, ammo_12gauge_incendiary.getUnlocalizedName());
|
||||
GameRegistry.registerItem(ammo_12gauge_shrapnel, ammo_12gauge_shrapnel.getUnlocalizedName());
|
||||
GameRegistry.registerItem(ammo_12gauge_du, ammo_12gauge_du.getUnlocalizedName());
|
||||
GameRegistry.registerItem(ammo_12gauge_marauder, ammo_12gauge_marauder.getUnlocalizedName());
|
||||
GameRegistry.registerItem(ammo_20gauge, ammo_20gauge.getUnlocalizedName());
|
||||
GameRegistry.registerItem(ammo_20gauge_slug, ammo_20gauge_slug.getUnlocalizedName());
|
||||
GameRegistry.registerItem(ammo_20gauge_flechette, ammo_20gauge_flechette.getUnlocalizedName());
|
||||
|
||||
@ -736,6 +736,11 @@ public class ItemCustomLore extends Item {
|
||||
{
|
||||
list.add("High in fiber, high in glass. Everything the body needs.");
|
||||
}
|
||||
|
||||
if(this == ModItems.missile_soyuz_lander)
|
||||
{
|
||||
list.add("Doubles as a crappy lander!");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -2,17 +2,24 @@ package com.hbm.items.special;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.lib.RefStrings;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
public class ItemSoyuz extends Item {
|
||||
|
||||
IIcon[] icons = new IIcon[3];
|
||||
|
||||
public ItemSoyuz() {
|
||||
this.setHasSubtypes(true);
|
||||
}
|
||||
@ -20,9 +27,9 @@ public class ItemSoyuz extends Item {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
list.add(new ItemStack(item, 1, 0));
|
||||
list.add(new ItemStack(item, 1, 1));
|
||||
list.add(new ItemStack(item, 1, 2));
|
||||
|
||||
for(int i = 0; i < icons.length; i++)
|
||||
list.add(new ItemStack(item, 1, i));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -52,4 +59,19 @@ public class ItemSoyuz extends Item {
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister reg)
|
||||
{
|
||||
for(int i = 0; i < icons.length; i++) {
|
||||
icons[i] = reg.registerIcon(RefStrings.MODID + ":soyuz_" + i);
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(int meta)
|
||||
{
|
||||
int j = MathHelper.clamp_int(meta, 0, icons.length - 1);
|
||||
return icons[j];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -5,7 +5,10 @@ import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.SatPanelPacket;
|
||||
import com.hbm.saveddata.SatelliteSavedData;
|
||||
import com.hbm.saveddata.satellites.Satellite;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@ -14,30 +17,36 @@ import net.minecraft.world.World;
|
||||
|
||||
public class ItemSatInterface extends ItemSatChip {
|
||||
|
||||
public static SatelliteSavedData satData;
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static Satellite currentSat;
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
|
||||
|
||||
if(world.isRemote)
|
||||
player.openGui(MainRegistry.instance, ModItems.guiID_item_sat_interface, world, 0, 0, 0);
|
||||
if(world.isRemote) {
|
||||
|
||||
if(this == ModItems.sat_interface)
|
||||
player.openGui(MainRegistry.instance, ModItems.guiID_item_sat_interface, world, 0, 0, 0);
|
||||
if(this == ModItems.sat_coord)
|
||||
player.openGui(MainRegistry.instance, ModItems.guiID_item_sat_coord, world, 0, 0, 0);
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
//TODO: fix this shit
|
||||
public void onUpdate(ItemStack stack, World world, Entity entity, int i, boolean b) {
|
||||
|
||||
if(!world.isRemote && entity instanceof EntityPlayerMP) {
|
||||
SatelliteSavedData data = (SatelliteSavedData)entity.worldObj.perWorldStorage.loadData(SatelliteSavedData.class, "satellites");
|
||||
|
||||
if(data != null) {
|
||||
for(int j = 0; j < data.satellites.size(); j++) {
|
||||
PacketDispatcher.wrapper.sendTo(new SatPanelPacket(data.satellites.get(j)), (EntityPlayerMP) entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(world.isRemote || !(entity instanceof EntityPlayerMP))
|
||||
return;
|
||||
|
||||
if(((EntityPlayerMP)entity).getHeldItem() != stack)
|
||||
return;
|
||||
|
||||
Satellite sat = SatelliteSavedData.getData(world).getSatFromFreq(this.getFreq(stack));
|
||||
|
||||
if(sat != null && entity.ticksExisted % 2 == 0) {
|
||||
PacketDispatcher.wrapper.sendTo(new SatPanelPacket(sat), (EntityPlayerMP) entity);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -30,6 +30,10 @@ public class ItemAmmo extends Item {
|
||||
list.add(EnumChatFormatting.YELLOW + "* Heavy Metal");
|
||||
list.add(EnumChatFormatting.RED + "- Highly increased wear");
|
||||
}
|
||||
if(this == ModItems.ammo_12gauge_marauder) {
|
||||
list.add(EnumChatFormatting.BLUE + "+ Instantly removes annoying and unbalanced enemies");
|
||||
list.add(EnumChatFormatting.YELLOW + "* No drawbacks lole");
|
||||
}
|
||||
|
||||
//20 GAUGE
|
||||
if(this == ModItems.ammo_20gauge_flechette) {
|
||||
|
||||
@ -56,6 +56,7 @@ import com.hbm.lib.Library;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.potion.HbmPotion;
|
||||
import com.hbm.saveddata.satellites.Satellite;
|
||||
import com.hbm.tileentity.bomb.*;
|
||||
import com.hbm.tileentity.conductor.*;
|
||||
import com.hbm.tileentity.deco.*;
|
||||
@ -211,6 +212,9 @@ public class MainRegistry
|
||||
public static Achievement bobOil;
|
||||
public static Achievement bobNuclear;
|
||||
public static Achievement bobHidden;
|
||||
public static Achievement horizonsStart;
|
||||
public static Achievement horizonsEnd;
|
||||
public static Achievement horizonsBonus;
|
||||
|
||||
public static boolean enableDebugMode = true;
|
||||
public static boolean enableMycelium = false;
|
||||
@ -358,6 +362,7 @@ public class MainRegistry
|
||||
HbmPotion.init();
|
||||
BulletConfigSyncingUtil.loadConfigsForSync();
|
||||
CellularDungeonFactory.init();
|
||||
Satellite.register();
|
||||
|
||||
Library.superuser.add("192af5d7-ed0f-48d8-bd89-9d41af8524f8");
|
||||
Library.superuser.add("5aee1e3d-3767-4987-a222-e7ce1fbdf88e");
|
||||
@ -1030,6 +1035,10 @@ public class MainRegistry
|
||||
bobOil = new Achievement("achievement.oil", "oil", 4, 4, ModItems.bob_oil, bobChemistry).initIndependentStat().registerStat();
|
||||
bobNuclear = new Achievement("achievement.nuclear", "nuclear", 6, 4, ModItems.bob_nuclear, bobOil).initIndependentStat().registerStat();
|
||||
bobHidden = new Achievement("achievement.hidden", "hidden", 8, 4, ModItems.gun_dampfmaschine, bobNuclear).initIndependentStat().registerStat();
|
||||
|
||||
horizonsStart = new Achievement("achievement.horizonsStart", "horizonsStart", -2, 6, ModItems.sat_gerald, null).initIndependentStat().registerStat();
|
||||
horizonsEnd = new Achievement("achievement.horizonsEnd", "horizonsEnd", 0, 6, ModItems.sat_gerald, horizonsStart).initIndependentStat().registerStat();
|
||||
horizonsBonus = new Achievement("achievement.horizonsBonus", "horizonsBonus", 2, 6, ModItems.sat_gerald, horizonsEnd).initIndependentStat().registerStat().setSpecial();
|
||||
|
||||
AchievementPage.registerAchievementPage(new AchievementPage("Nuclear Tech", new Achievement[]{
|
||||
achSacrifice,
|
||||
@ -1049,7 +1058,10 @@ public class MainRegistry
|
||||
bobChemistry,
|
||||
bobOil,
|
||||
bobNuclear,
|
||||
bobHidden
|
||||
bobHidden,
|
||||
horizonsStart,
|
||||
horizonsEnd,
|
||||
horizonsBonus
|
||||
}));
|
||||
|
||||
//MUST be initialized AFTER achievements!!
|
||||
|
||||
@ -61,7 +61,7 @@ public class PacketDispatcher {
|
||||
wrapper.registerMessage(TERadarPacket.Handler.class, TERadarPacket.class, i++, Side.CLIENT);
|
||||
//Siren packet for looped sounds
|
||||
wrapper.registerMessage(TERadarDestructorPacket.Handler.class, TERadarDestructorPacket.class, i++, Side.CLIENT);
|
||||
//Signals server to perform orbital strike
|
||||
//Signals server to perform orbital strike, among other things
|
||||
wrapper.registerMessage(SatLaserPacket.Handler.class, SatLaserPacket.class, i++, Side.SERVER);
|
||||
//Universal package for sending small info packs back to server
|
||||
wrapper.registerMessage(AuxButtonPacket.Handler.class, AuxButtonPacket.class, i++, Side.SERVER);
|
||||
@ -91,6 +91,8 @@ public class PacketDispatcher {
|
||||
wrapper.registerMessage(NBTPacket.Handler.class, NBTPacket.class, i++, Side.CLIENT);
|
||||
//Aux Particle Packet, New Technology: like the APP but with NBT
|
||||
wrapper.registerMessage(AuxParticlePacketNT.Handler.class, AuxParticlePacketNT.class, i++, Side.CLIENT);
|
||||
//Signals server to do coord based satellite stuff
|
||||
wrapper.registerMessage(SatCoordPacket.Handler.class, SatCoordPacket.class, i++, Side.SERVER);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
71
com/hbm/packet/SatCoordPacket.java
Normal file
@ -0,0 +1,71 @@
|
||||
package com.hbm.packet;
|
||||
|
||||
import com.hbm.items.tool.ItemSatInterface;
|
||||
import com.hbm.saveddata.SatelliteSavedData;
|
||||
import com.hbm.saveddata.satellites.Satellite;
|
||||
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
public class SatCoordPacket implements IMessage {
|
||||
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
int freq;
|
||||
|
||||
public SatCoordPacket()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public SatCoordPacket(int x, int y, int z, int freq)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.freq = freq;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
x = buf.readInt();
|
||||
y = buf.readInt();
|
||||
z = buf.readInt();
|
||||
freq = buf.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
buf.writeInt(x);
|
||||
buf.writeInt(y);
|
||||
buf.writeInt(z);
|
||||
buf.writeInt(freq);
|
||||
}
|
||||
|
||||
public static class Handler implements IMessageHandler<SatCoordPacket, IMessage> {
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(SatCoordPacket m, MessageContext ctx) {
|
||||
|
||||
EntityPlayer p = ctx.getServerHandler().playerEntity;
|
||||
|
||||
if(p.getHeldItem() != null && p.getHeldItem().getItem() instanceof ItemSatInterface) {
|
||||
|
||||
int freq = ItemSatInterface.getFreq(p.getHeldItem());
|
||||
|
||||
if(freq == m.freq) {
|
||||
Satellite sat = SatelliteSavedData.getData(p.worldObj).getSatFromFreq(m.freq);
|
||||
|
||||
if(sat != null)
|
||||
sat.onCoordAction(p.worldObj, m.x, m.y, m.z);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
package com.hbm.packet;
|
||||
|
||||
import com.hbm.entity.logic.EntityDeathBlast;
|
||||
import com.hbm.saveddata.SatelliteSaveStructure;
|
||||
import com.hbm.items.tool.ItemSatInterface;
|
||||
import com.hbm.saveddata.SatelliteSavedData;
|
||||
import com.hbm.saveddata.satellites.Satellite;
|
||||
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
@ -51,31 +51,18 @@ public class SatLaserPacket implements IMessage {
|
||||
public IMessage onMessage(SatLaserPacket m, MessageContext ctx) {
|
||||
|
||||
EntityPlayer p = ctx.getServerHandler().playerEntity;
|
||||
|
||||
SatelliteSavedData data = (SatelliteSavedData)p.worldObj.perWorldStorage.loadData(SatelliteSavedData.class, "satellites");
|
||||
if(data == null) {
|
||||
p.worldObj.perWorldStorage.setData("satellites", new SatelliteSavedData(p.worldObj));
|
||||
|
||||
data = (SatelliteSavedData)p.worldObj.perWorldStorage.loadData(SatelliteSavedData.class, "satellites");
|
||||
}
|
||||
|
||||
SatelliteSaveStructure sat = data.getSatFromFreq(m.freq);
|
||||
|
||||
if(sat != null) {
|
||||
if(sat.lastOp + 10000 < System.currentTimeMillis()) {
|
||||
sat.lastOp = System.currentTimeMillis();
|
||||
|
||||
int y = p.worldObj.getHeightValue(m.x, m.z);
|
||||
|
||||
//ExplosionLarge.explodeFire(p.worldObj, m.x, y, m.z, 50, true, true, true);
|
||||
EntityDeathBlast blast = new EntityDeathBlast(p.worldObj);
|
||||
blast.posX = m.x;
|
||||
blast.posY = y;
|
||||
blast.posZ = m.z;
|
||||
|
||||
p.worldObj.spawnEntityInWorld(blast);
|
||||
}
|
||||
}
|
||||
|
||||
if(p.getHeldItem() != null && p.getHeldItem().getItem() instanceof ItemSatInterface) {
|
||||
|
||||
int freq = ItemSatInterface.getFreq(p.getHeldItem());
|
||||
|
||||
if(freq == m.freq) {
|
||||
Satellite sat = SatelliteSavedData.getData(p.worldObj).getSatFromFreq(m.freq);
|
||||
|
||||
if(sat != null)
|
||||
sat.onClick(p.worldObj, m.x, m.z);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -1,50 +1,65 @@
|
||||
package com.hbm.packet;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import com.hbm.items.tool.ItemSatInterface;
|
||||
import com.hbm.saveddata.SatelliteSaveStructure;
|
||||
import com.hbm.saveddata.SatelliteSaveStructure.SatelliteType;
|
||||
import com.hbm.saveddata.SatelliteSavedData;
|
||||
import com.hbm.saveddata.satellites.Satellite;
|
||||
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
|
||||
public class SatPanelPacket implements IMessage {
|
||||
|
||||
int id;
|
||||
int dim;
|
||||
SatelliteType type;
|
||||
long lastOp;
|
||||
|
||||
PacketBuffer buffer;
|
||||
int type;
|
||||
|
||||
public SatPanelPacket() {
|
||||
|
||||
}
|
||||
|
||||
public SatPanelPacket(SatelliteSaveStructure sat) {
|
||||
id = sat.satelliteID;
|
||||
dim = sat.satDim;
|
||||
type = sat.satelliteType;
|
||||
lastOp = sat.lastOp;
|
||||
public SatPanelPacket(Satellite sat) {
|
||||
type = sat.getID();
|
||||
|
||||
this.buffer = new PacketBuffer(Unpooled.buffer());
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
sat.writeToNBT(nbt);
|
||||
|
||||
try {
|
||||
buffer.writeNBTTagCompoundToBuffer(nbt);
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
id = buf.readInt();
|
||||
dim = buf.readInt();
|
||||
type = SatelliteType.getEnum(buf.readInt());
|
||||
lastOp = buf.readLong();
|
||||
|
||||
type = buf.readInt();
|
||||
|
||||
if (buffer == null) {
|
||||
buffer = new PacketBuffer(Unpooled.buffer());
|
||||
}
|
||||
buffer.writeBytes(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
buf.writeInt(id);
|
||||
buf.writeInt(dim);
|
||||
buf.writeInt(type.getID());
|
||||
buf.writeLong(lastOp);
|
||||
|
||||
buf.writeInt(type);
|
||||
|
||||
if (buffer == null) {
|
||||
buffer = new PacketBuffer(Unpooled.buffer());
|
||||
}
|
||||
buf.writeBytes(buffer);
|
||||
}
|
||||
|
||||
public static class Handler implements IMessageHandler<SatPanelPacket, IMessage> {
|
||||
@ -53,19 +68,15 @@ public class SatPanelPacket implements IMessage {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IMessage onMessage(SatPanelPacket m, MessageContext ctx) {
|
||||
|
||||
EntityPlayer p = Minecraft.getMinecraft().thePlayer;
|
||||
Minecraft.getMinecraft();
|
||||
|
||||
try {
|
||||
|
||||
if(ItemSatInterface.satData == null) {
|
||||
ItemSatInterface.satData = new SatelliteSavedData(p.worldObj);
|
||||
}
|
||||
NBTTagCompound nbt = m.buffer.readNBTTagCompoundFromBuffer();
|
||||
ItemSatInterface.currentSat = Satellite.create(m.type);
|
||||
|
||||
SatelliteSaveStructure sat = new SatelliteSaveStructure(m.id, m.type, m.dim);
|
||||
sat.lastOp = m.lastOp;
|
||||
ItemSatInterface.satData.satellites.add(sat);
|
||||
|
||||
ItemSatInterface.satData.satCount = ItemSatInterface.satData.satellites.size();
|
||||
if(nbt != null)
|
||||
ItemSatInterface.currentSat.readFromNBT(nbt);
|
||||
|
||||
} catch (Exception x) {
|
||||
}
|
||||
|
||||
@ -1,65 +0,0 @@
|
||||
package com.hbm.saveddata;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class SatelliteSaveStructure {
|
||||
|
||||
public int satelliteID;
|
||||
public int satDim;
|
||||
public SatelliteType satelliteType;
|
||||
public long lastOp;
|
||||
|
||||
public SatelliteSaveStructure() { }
|
||||
|
||||
public SatelliteSaveStructure(int id, SatelliteType type, int dim) {
|
||||
satelliteID = id;
|
||||
satelliteType = type;
|
||||
satDim = dim;
|
||||
}
|
||||
|
||||
public enum SatelliteType {
|
||||
|
||||
//Prints map remotely
|
||||
MAPPER,
|
||||
//Displays entities
|
||||
RADAR,
|
||||
//Prints map, ores only
|
||||
SCANNER,
|
||||
//Does nothing
|
||||
RELAY,
|
||||
//Death ray
|
||||
LASER,
|
||||
//Allows use of AMS
|
||||
RESONATOR,
|
||||
//Farms ores for free
|
||||
MINER;
|
||||
|
||||
public static SatelliteType getEnum(int i) {
|
||||
if(i < SatelliteType.values().length)
|
||||
return SatelliteType.values()[i];
|
||||
else
|
||||
return SatelliteType.RELAY;
|
||||
}
|
||||
|
||||
public int getID() {
|
||||
return Arrays.asList(SatelliteType.values()).indexOf(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound nbt, int index) {
|
||||
satelliteID = nbt.getInteger("sat_" + index + "_id");
|
||||
satelliteType = SatelliteType.getEnum(nbt.getInteger("sat_" + index + "_type"));
|
||||
satDim = nbt.getInteger("sat_" + index + "_dim");
|
||||
lastOp = nbt.getLong("sat_" + index + "_op");
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound nbt, int index) {
|
||||
nbt.setInteger("sat_" + index + "_id", satelliteID);
|
||||
nbt.setInteger("sat_" + index + "_type", satelliteType.getID());
|
||||
nbt.setInteger("sat_" + index + "_dim", satDim);
|
||||
nbt.setLong("sat_" + index + "_op", lastOp);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,7 +1,9 @@
|
||||
package com.hbm.saveddata;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.hbm.saveddata.satellites.Satellite;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
@ -9,9 +11,7 @@ import net.minecraft.world.WorldSavedData;
|
||||
|
||||
public class SatelliteSavedData extends WorldSavedData {
|
||||
|
||||
public int satCount;
|
||||
|
||||
public List<SatelliteSaveStructure> satellites = new ArrayList();
|
||||
public HashMap<Integer, Satellite> sats = new HashMap();
|
||||
|
||||
private World worldObj;
|
||||
|
||||
@ -31,34 +31,60 @@ public class SatelliteSavedData extends WorldSavedData {
|
||||
return getSatFromFreq(freq) != null;
|
||||
}
|
||||
|
||||
public SatelliteSaveStructure getSatFromFreq(int freq) {
|
||||
public Satellite getSatFromFreq(int freq) {
|
||||
|
||||
for(SatelliteSaveStructure sat : satellites)
|
||||
if(sat.satelliteID == freq)
|
||||
return sat;
|
||||
|
||||
return null;
|
||||
return sats.get(freq);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
satCount = nbt.getInteger("satCount");
|
||||
int satCount = nbt.getInteger("satCount");
|
||||
|
||||
for(int i = 0; i < satCount; i++) {
|
||||
SatelliteSaveStructure struct = new SatelliteSaveStructure();
|
||||
struct.readFromNBT(nbt, i);
|
||||
|
||||
satellites.add(struct);
|
||||
Satellite sat = Satellite.create(nbt.getInteger("sat_id_" + i));
|
||||
sat.readFromNBT((NBTTagCompound) nbt.getTag("sat_data_" + i));
|
||||
|
||||
int freq = nbt.getInteger("sat_freq_" + i);
|
||||
|
||||
sats.put(freq, sat);
|
||||
|
||||
System.out.println("Loaded sat" + i + " " + sat.getClass().getSimpleName());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
nbt.setInteger("satCount", satellites.size());
|
||||
nbt.setInteger("satCount", sats.size());
|
||||
|
||||
for(int i = 0; i < satellites.size(); i++) {
|
||||
satellites.get(i).writeToNBT(nbt, i);
|
||||
}
|
||||
int i = 0;
|
||||
|
||||
for(Entry<Integer, Satellite> struct : sats.entrySet()) {
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
struct.getValue().writeToNBT(data);
|
||||
|
||||
nbt.setInteger("sat_id_" + i, struct.getValue().getID());
|
||||
nbt.setTag("sat_data_" + i, data);
|
||||
nbt.setInteger("sat_freq_" + i, struct.getKey());
|
||||
i++;
|
||||
|
||||
System.out.println("Saved sat" + i + " " + struct.getValue().getClass().getSimpleName());
|
||||
}
|
||||
}
|
||||
|
||||
public static SatelliteSavedData getData(World worldObj) {
|
||||
|
||||
SatelliteSavedData data = (SatelliteSavedData)worldObj.perWorldStorage.loadData(SatelliteSavedData.class, "satellites");
|
||||
if(data == null) {
|
||||
worldObj.perWorldStorage.setData("satellites", new SatelliteSavedData(worldObj));
|
||||
|
||||
data = (SatelliteSavedData)worldObj.perWorldStorage.loadData(SatelliteSavedData.class, "satellites");
|
||||
}
|
||||
|
||||
data.worldObj = worldObj;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
123
com/hbm/saveddata/satellites/Satellite.java
Normal file
@ -0,0 +1,123 @@
|
||||
package com.hbm.saveddata.satellites;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.saveddata.SatelliteSavedData;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class Satellite {
|
||||
|
||||
public static List<Class> satellites = new ArrayList();
|
||||
public static HashMap<Item, Class> itemToClass = new HashMap();
|
||||
|
||||
public static enum InterfaceActions {
|
||||
HAS_MAP, //lets the interface display loaded chunks
|
||||
CAN_CLICK, //enables onClick events
|
||||
SHOW_COORDS, //enables coordinates as a mouse tooltip
|
||||
HAS_RADAR, //lets the interface display loaded entities
|
||||
HAS_ORES //like HAS_MAP but only shows ores
|
||||
}
|
||||
|
||||
public static enum CoordActions {
|
||||
HAS_Y //enables the Y-coord field which is disabled by default
|
||||
}
|
||||
|
||||
public static enum Interfaces {
|
||||
NONE, //does not interact with any sat interface (i.e. asteroid miners)
|
||||
SAT_PANEL, //allows to interact with the sat interface panel (for graphical applications)
|
||||
SAT_COORD //allows to interact with the sat coord remote (for teleportation or other coord related actions)
|
||||
}
|
||||
|
||||
public List<InterfaceActions> ifaceAcs = new ArrayList();
|
||||
public List<CoordActions> coordAcs = new ArrayList();
|
||||
public Interfaces satIface = Interfaces.NONE;
|
||||
|
||||
public static void register() {
|
||||
|
||||
registerSatellite(SatelliteMapper.class, ModItems.sat_mapper);
|
||||
registerSatellite(SatelliteScanner.class, ModItems.sat_scanner);
|
||||
registerSatellite(SatelliteRadar.class, ModItems.sat_radar);
|
||||
registerSatellite(SatelliteLaser.class, ModItems.sat_laser);
|
||||
registerSatellite(SatelliteResonator.class, ModItems.sat_resonator);
|
||||
registerSatellite(SatelliteRelay.class, ModItems.sat_foeq);
|
||||
registerSatellite(SatelliteMiner.class, ModItems.sat_miner);
|
||||
registerSatellite(SatelliteHorizons.class, ModItems.sat_gerald);
|
||||
}
|
||||
|
||||
private static void registerSatellite(Class<? extends Satellite> sat, Item item) {
|
||||
|
||||
satellites.add(sat);
|
||||
itemToClass.put(item, sat);
|
||||
}
|
||||
|
||||
public static void orbit(World world, int id, int freq, double x, double y, double z) {
|
||||
|
||||
Satellite sat = create(id);
|
||||
|
||||
if(sat != null && !world.isRemote) {
|
||||
SatelliteSavedData data = SatelliteSavedData.getData(world);
|
||||
data.sats.put(freq, sat);
|
||||
sat.onOrbit(world, x, y, z);
|
||||
data.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
public static Satellite create(int id) {
|
||||
|
||||
Satellite sat = null;
|
||||
|
||||
try {
|
||||
Class c = satellites.get(id);
|
||||
sat = (Satellite) c.newInstance();
|
||||
} catch(Exception ex) {
|
||||
|
||||
}
|
||||
|
||||
return sat;
|
||||
}
|
||||
|
||||
public static int getIDFromItem(Item item) {
|
||||
|
||||
Class<? extends Satellite> sat = itemToClass.get(item);
|
||||
int i = satellites.indexOf(sat);
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
public int getID() {
|
||||
return satellites.indexOf(this.getClass());
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound nbt) { }
|
||||
|
||||
public void readFromNBT(NBTTagCompound nbt) { }
|
||||
|
||||
/**
|
||||
* Called when the satellite reaches space, used to trigger achievements and other funny stuff.
|
||||
* @param x posX of the rocket
|
||||
* @param y ditto
|
||||
* @param z ditto
|
||||
*/
|
||||
public void onOrbit(World world, double x, double y, double z) { }
|
||||
|
||||
/**
|
||||
* Called by the sat interface when clicking on the screen
|
||||
* @param x the x-coordinate translated from the on-screen coords to actual world coordinates
|
||||
* @param z ditto
|
||||
*/
|
||||
public void onClick(World world, int x, int z) { }
|
||||
|
||||
/**
|
||||
* Called by the coord sat interface
|
||||
* @param x the specified x-coordinate
|
||||
* @param y ditto
|
||||
* @param z ditto
|
||||
*/
|
||||
public void onCoordAction(World world, int x, int y, int z) { }
|
||||
}
|
||||
19
com/hbm/saveddata/satellites/SatelliteHorizons.java
Normal file
@ -0,0 +1,19 @@
|
||||
package com.hbm.saveddata.satellites;
|
||||
|
||||
import com.hbm.main.MainRegistry;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class SatelliteHorizons extends Satellite {
|
||||
|
||||
public SatelliteHorizons() {
|
||||
this.satIface = Interfaces.SAT_COORD;
|
||||
}
|
||||
|
||||
public void onOrbit(World world, double x, double y, double z) {
|
||||
|
||||
for(Object p : world.playerEntities)
|
||||
((EntityPlayer)p).triggerAchievement(MainRegistry.horizonsStart);
|
||||
}
|
||||
}
|
||||
42
com/hbm/saveddata/satellites/SatelliteLaser.java
Normal file
@ -0,0 +1,42 @@
|
||||
package com.hbm.saveddata.satellites;
|
||||
|
||||
import com.hbm.entity.logic.EntityDeathBlast;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class SatelliteLaser extends Satellite {
|
||||
|
||||
public long lastOp;
|
||||
|
||||
public SatelliteLaser() {
|
||||
this.ifaceAcs.add(InterfaceActions.HAS_MAP);
|
||||
this.ifaceAcs.add(InterfaceActions.SHOW_COORDS);
|
||||
this.ifaceAcs.add(InterfaceActions.CAN_CLICK);
|
||||
this.satIface = Interfaces.SAT_PANEL;
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
nbt.setLong("lastOp", lastOp);
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
lastOp = nbt.getLong("lastOp");
|
||||
}
|
||||
|
||||
public void onClick(World world, int x, int z) {
|
||||
|
||||
if(lastOp + 10000 < System.currentTimeMillis()) {
|
||||
lastOp = System.currentTimeMillis();
|
||||
|
||||
int y = world.getHeightValue(x, z);
|
||||
|
||||
EntityDeathBlast blast = new EntityDeathBlast(world);
|
||||
blast.posX = x;
|
||||
blast.posY = y;
|
||||
blast.posZ = z;
|
||||
|
||||
world.spawnEntityInWorld(blast);
|
||||
}
|
||||
}
|
||||
}
|
||||
9
com/hbm/saveddata/satellites/SatelliteMapper.java
Normal file
@ -0,0 +1,9 @@
|
||||
package com.hbm.saveddata.satellites;
|
||||
|
||||
public class SatelliteMapper extends Satellite {
|
||||
|
||||
public SatelliteMapper() {
|
||||
this.ifaceAcs.add(InterfaceActions.HAS_MAP);
|
||||
this.satIface = Interfaces.SAT_PANEL;
|
||||
}
|
||||
}
|
||||
20
com/hbm/saveddata/satellites/SatelliteMiner.java
Normal file
@ -0,0 +1,20 @@
|
||||
package com.hbm.saveddata.satellites;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class SatelliteMiner extends Satellite {
|
||||
|
||||
public long lastOp;
|
||||
|
||||
public SatelliteMiner() {
|
||||
this.satIface = Interfaces.NONE;
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
nbt.setLong("lastOp", lastOp);
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
lastOp = nbt.getLong("lastOp");
|
||||
}
|
||||
}
|
||||
10
com/hbm/saveddata/satellites/SatelliteRadar.java
Normal file
@ -0,0 +1,10 @@
|
||||
package com.hbm.saveddata.satellites;
|
||||
|
||||
public class SatelliteRadar extends Satellite {
|
||||
|
||||
public SatelliteRadar() {
|
||||
this.ifaceAcs.add(InterfaceActions.HAS_MAP);
|
||||
this.ifaceAcs.add(InterfaceActions.HAS_RADAR);
|
||||
this.satIface = Interfaces.SAT_PANEL;
|
||||
}
|
||||
}
|
||||
19
com/hbm/saveddata/satellites/SatelliteRelay.java
Normal file
@ -0,0 +1,19 @@
|
||||
package com.hbm.saveddata.satellites;
|
||||
|
||||
import com.hbm.main.MainRegistry;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class SatelliteRelay extends Satellite {
|
||||
|
||||
public SatelliteRelay() {
|
||||
this.satIface = Interfaces.NONE;
|
||||
}
|
||||
|
||||
public void onOrbit(World world, double x, double y, double z) {
|
||||
|
||||
for(Object p : world.playerEntities)
|
||||
((EntityPlayer)p).triggerAchievement(MainRegistry.achFOEQ);
|
||||
}
|
||||
}
|
||||
9
com/hbm/saveddata/satellites/SatelliteResonator.java
Normal file
@ -0,0 +1,9 @@
|
||||
package com.hbm.saveddata.satellites;
|
||||
|
||||
public class SatelliteResonator extends Satellite {
|
||||
|
||||
public SatelliteResonator() {
|
||||
this.coordAcs.add(CoordActions.HAS_Y);
|
||||
this.satIface = Interfaces.SAT_COORD;
|
||||
}
|
||||
}
|
||||
9
com/hbm/saveddata/satellites/SatelliteScanner.java
Normal file
@ -0,0 +1,9 @@
|
||||
package com.hbm.saveddata.satellites;
|
||||
|
||||
public class SatelliteScanner extends Satellite {
|
||||
|
||||
public SatelliteScanner() {
|
||||
this.ifaceAcs.add(InterfaceActions.HAS_ORES);
|
||||
this.satIface = Interfaces.SAT_PANEL;
|
||||
}
|
||||
}
|
||||
@ -20,8 +20,8 @@ import com.hbm.lib.ModDamageSource;
|
||||
import com.hbm.packet.AuxElectricityPacket;
|
||||
import com.hbm.packet.AuxGaugePacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.saveddata.SatelliteSaveStructure.SatelliteType;
|
||||
import com.hbm.saveddata.SatelliteSavedData;
|
||||
import com.hbm.saveddata.satellites.SatelliteResonator;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@ -551,7 +551,7 @@ public class TileEntityAMSBase extends TileEntity implements ISidedInventory, IS
|
||||
int i3 = ItemSatChip.getFreq(slots[15]);
|
||||
|
||||
if(data.getSatFromFreq(i1) != null && data.getSatFromFreq(i2) != null && data.getSatFromFreq(i3) != null &&
|
||||
data.getSatFromFreq(i1).satelliteType.getID() == SatelliteType.RESONATOR.getID() && data.getSatFromFreq(i2).satelliteType.getID() == SatelliteType.RESONATOR.getID() && data.getSatFromFreq(i3).satelliteType.getID() == SatelliteType.RESONATOR.getID() &&
|
||||
data.getSatFromFreq(i1) instanceof SatelliteResonator && data.getSatFromFreq(i2) instanceof SatelliteResonator && data.getSatFromFreq(i3) instanceof SatelliteResonator &&
|
||||
i1 != i2 && i1 != i3 && i2 != i3)
|
||||
return true;
|
||||
|
||||
|
||||
@ -6,9 +6,9 @@ import java.util.Random;
|
||||
import com.hbm.entity.missile.EntityMinerRocket;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.tool.ItemSatChip;
|
||||
import com.hbm.saveddata.SatelliteSaveStructure;
|
||||
import com.hbm.saveddata.SatelliteSaveStructure.SatelliteType;
|
||||
import com.hbm.saveddata.SatelliteSavedData;
|
||||
import com.hbm.saveddata.satellites.Satellite;
|
||||
import com.hbm.saveddata.satellites.SatelliteMiner;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -204,19 +204,22 @@ public class TileEntityMachineSatDock extends TileEntity implements ISidedInvent
|
||||
if(data != null && slots[15] != null) {
|
||||
int freq = ItemSatChip.getFreq(slots[15]);
|
||||
|
||||
SatelliteSaveStructure sat = data.getSatFromFreq(freq);
|
||||
Satellite sat = data.getSatFromFreq(freq);
|
||||
|
||||
int delay = 10 * 60 * 1000;
|
||||
|
||||
if(sat != null && sat.satelliteID == freq && sat.satelliteType.name().equals(SatelliteType.MINER.name())) {
|
||||
if(sat.lastOp + delay < System.currentTimeMillis()) {
|
||||
if(sat != null && sat instanceof SatelliteMiner) {
|
||||
|
||||
SatelliteMiner miner = (SatelliteMiner)sat;
|
||||
|
||||
if(miner.lastOp + delay < System.currentTimeMillis()) {
|
||||
|
||||
EntityMinerRocket rocket = new EntityMinerRocket(worldObj);
|
||||
rocket.posX = xCoord + 0.5;
|
||||
rocket.posY = 300;
|
||||
rocket.posZ = zCoord + 0.5;
|
||||
worldObj.spawnEntityInWorld(rocket);
|
||||
sat.lastOp = System.currentTimeMillis();
|
||||
miner.lastOp = System.currentTimeMillis();
|
||||
data.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@ -75,7 +75,7 @@ public class TileEntitySoyuzLauncher extends TileEntityMachineBase implements IS
|
||||
countdown = maxCount;
|
||||
starting = false;
|
||||
} else if(countdown > 0) {
|
||||
countdown--;
|
||||
countdown-=30; //TODO: remove speedy countdown
|
||||
|
||||
if(countdown % 100 == 0 && countdown > 0)
|
||||
worldObj.playSoundEffect(xCoord, yCoord, zCoord, "hbm:alarm.hatch", 100F, 1.1F);
|
||||
@ -175,12 +175,18 @@ public class TileEntitySoyuzLauncher extends TileEntityMachineBase implements IS
|
||||
soyuz.setLocationAndAngles(xCoord + 0.5, yCoord + 5, zCoord + 0.5, 0, 0);
|
||||
worldObj.spawnEntityInWorld(soyuz);
|
||||
|
||||
worldObj.playSoundEffect(xCoord, yCoord, zCoord, "hbm:entity.soyuzTakeoff", 100F, 1.1F);
|
||||
|
||||
tanks[0].setFill(tanks[0].getFill() - req);
|
||||
tanks[1].setFill(tanks[1].getFill() - req);
|
||||
power -= pow;
|
||||
|
||||
if(mode == 0) {
|
||||
soyuz.setSat(slots[2]);
|
||||
|
||||
if(this.orbital() == 2)
|
||||
slots[3] = null;
|
||||
|
||||
slots[2] = null;
|
||||
}
|
||||
|
||||
@ -202,10 +208,7 @@ public class TileEntitySoyuzLauncher extends TileEntityMachineBase implements IS
|
||||
|
||||
public boolean canLaunch() {
|
||||
|
||||
if(mode == 0 && slots[2] == null)
|
||||
return false;
|
||||
|
||||
return hasRocket() && hasFuel() && hasRocket() && hasPower() && (designator() == 0 || designator() == 2);
|
||||
return hasRocket() && hasFuel() && hasRocket() && hasPower() && designator() != 1 && orbital() != 1 && satellite() != 1;
|
||||
}
|
||||
|
||||
public boolean hasFuel() {
|
||||
@ -264,6 +267,9 @@ public class TileEntitySoyuzLauncher extends TileEntityMachineBase implements IS
|
||||
return slots[0] != null && slots[0].getItem() == ModItems.missile_soyuz;
|
||||
}
|
||||
|
||||
//0: designator not required
|
||||
//1: designator required but not present
|
||||
//2: designator present
|
||||
public int designator() {
|
||||
|
||||
if(mode == 0)
|
||||
@ -272,6 +278,36 @@ public class TileEntitySoyuzLauncher extends TileEntityMachineBase implements IS
|
||||
return 2;
|
||||
return 1;
|
||||
}
|
||||
|
||||
//0: sat not required
|
||||
//1: sat required but not present
|
||||
//2: sat present
|
||||
public int satellite() {
|
||||
|
||||
if(mode == 1)
|
||||
return 0;
|
||||
|
||||
if(slots[2] != null) {
|
||||
return 2;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
//0: module not required
|
||||
//1: module required but not present
|
||||
//2: module present
|
||||
public int orbital() {
|
||||
|
||||
if(mode == 1)
|
||||
return 0;
|
||||
|
||||
if(slots[2] != null && slots[2].getItem() == ModItems.sat_gerald) {
|
||||
if(slots[3] != null && slots[3].getItem() == ModItems.missile_soyuz_lander)
|
||||
return 2;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
|
||||