mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-08-10 17:55:44 +00:00
Merge branch 'HbmMods:master' into MachineOverlay
This commit is contained in:
commit
5f762d45b1
29
changelog
29
changelog
@ -1,28 +1,7 @@
|
||||
## Changed
|
||||
* Removed advanced alloy
|
||||
* All recipes that used to have AA in it now use something else
|
||||
* AA tools and armor remain for now, although they are uncraftable
|
||||
* Steel and titanium armor now have some DT and DR, making them roughly on-par with the old AA
|
||||
* Buffed durability for steel and titanium tool materials
|
||||
* Steel tools now deal more damage (still not as much as titanium) and has diamond harvest level
|
||||
* AA custom machine blocks have been replaced with bronze ones which make more sense in progression, since AA was too close to steel anyway
|
||||
* Renamed "worker's alloy" to "desh" to avoid confusion
|
||||
* Seriously why did this have two names?
|
||||
* Industrial grade and minecraft grade copper ingots now have the "ingot" suffix
|
||||
* Changed the microchip assembler recipe duration so that it matches with the demand of one soldering station
|
||||
* Blast furnace speed with hot air blast can now be increased to 500% (uses the same amount of hot air blast as before)
|
||||
* Updated all oil well GUI textures
|
||||
* There's now only two upgrade slots instead of three
|
||||
* All legacy pixel gauges have been replaced with smooth ones (watz, ZIRNOX, CCGT) making them more accurate
|
||||
|
||||
## Fixed
|
||||
* AUTOCAL
|
||||
* Fixed `listen` command failing if the buffer is empty
|
||||
* Fixed variable substitution failing when there is a trailing $ sign
|
||||
* Fixed concat prefixing all output with "t " for some reason
|
||||
* Eval(r) now uses a special mode for variable substitution that forces empty variables to be interpreted as "0"
|
||||
* Fixed things not intended to be used in the blast furnace (scrap, lava) being usable fuels
|
||||
* Fixed blast furnace swallowing container items left behind by fuels, instead fuels with containers will not be accepted at all
|
||||
* Fixed the blast furnace NEI screen listing "0 HE" for every recipe even though it's not an electric machine
|
||||
* Fixed flue gas not having an inventory texture
|
||||
* Potentially fixed issue with Angelica where tile entity culling would cause cargo elevators to not render on certain angles
|
||||
* Fixed the blast furnace not performing stack size checks correctly, outputting items when it shouldn't
|
||||
* Fixed cargo elevators not rendering past a distance of 100 blocks
|
||||
* Fixed cargo elevator syncing range being only 100 blocks, meaning that elevators taller than that don't work properly
|
||||
* Fixed held block being placed when not sneaking when opening the cable diode's GUI
|
||||
@ -1,6 +1,6 @@
|
||||
mod_version=1.0.27
|
||||
# Empty build number makes a release type
|
||||
mod_build_number=5719
|
||||
mod_build_number=5758
|
||||
|
||||
credits=HbMinecraft,\
|
||||
\ rodolphito (explosion algorithms),\
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package api.hbm.block;
|
||||
|
||||
@Deprecated
|
||||
public interface IPileNeutronReceiver {
|
||||
|
||||
public void receiveNeutrons(int n);
|
||||
|
||||
@ -15,12 +15,24 @@ public interface ISlotMonitorProvider {
|
||||
/** Returns an array of available slot monitors, which should ideally mirror the available slots of that container */
|
||||
public SlotMonitor[] getMonitors();
|
||||
|
||||
/** Returns the slot contents of that index, so that the monitors can detect changes */
|
||||
/** Returns the ORIGIANL ItemStack of that index, so that the monitors can detect changes */
|
||||
public ItemStack getSlotAt(int index);
|
||||
|
||||
/** Returns the amount of that slot at that index. Some storages may use int64 datatypes so we have to account for those too somehow, since ItemStacks cannot handle that. */
|
||||
public long getAmountAt(int index);
|
||||
|
||||
/** Removes the given number of items from that slot, returns the amount left to remove if the stack was smaller than the supplied amount */
|
||||
public long useUpItem(int index, long amount);
|
||||
|
||||
/** Adds the given number of items to that slot, returns the amount that couldn't be added due to stack limits */
|
||||
public long addItem(int index, long amount);
|
||||
|
||||
/** Sets the slot contents, returns the number of items that couldn't be added */
|
||||
public long setupType(int index, ItemStack zeroStack, long amount);
|
||||
|
||||
/** Whether this container allows types to be set via the access terminal */
|
||||
public boolean allowTypeSetting();
|
||||
|
||||
/** Whether this storage unit is reachable by the access point */
|
||||
public boolean isAvailableToCache(StackCache cache);
|
||||
|
||||
|
||||
@ -35,11 +35,13 @@ public class SlotMonitor {
|
||||
public long stacksize;
|
||||
public int meta;
|
||||
public NBTTagCompound nbt;
|
||||
|
||||
|
||||
protected boolean hasAvailabilityChanged = false;
|
||||
protected boolean forceTypeUpdate = false;
|
||||
|
||||
public SlotMonitor(int index, ISlotMonitorProvider parent) {
|
||||
this.hasAvailabilityChanged = true;
|
||||
this.forceTypeUpdate = true;
|
||||
this.index = index;
|
||||
this.parent = parent;
|
||||
}
|
||||
@ -101,9 +103,7 @@ public class SlotMonitor {
|
||||
else if(nbt != null && stack.hasTagCompound() && !nbt.equals(stack.stackTagCompound)) hasTypeChanged = true;
|
||||
}
|
||||
|
||||
if(hasTypeChanged) {
|
||||
|
||||
System.out.println("Type changed!");
|
||||
if(hasTypeChanged || forceTypeUpdate) {
|
||||
|
||||
// remove from all existing monitors
|
||||
Iterator<CacheSlot> iterator = viewedBy.iterator();
|
||||
@ -111,7 +111,6 @@ public class SlotMonitor {
|
||||
CacheSlot slot = iterator.next();
|
||||
slot.removeMonitor(this);
|
||||
iterator.remove();
|
||||
System.out.println("Removing");
|
||||
}
|
||||
|
||||
// set updated traits
|
||||
@ -130,17 +129,14 @@ public class SlotMonitor {
|
||||
// find new monitors
|
||||
if(pneumoNet != null) {
|
||||
|
||||
System.out.println("Adding to new network...");
|
||||
|
||||
for(StackCache cache : pneumoNet.accessors) {
|
||||
System.out.println("Adding to cache...");
|
||||
if(!cache.hasExpired && parent.isAvailableToCache(cache)) {
|
||||
cache.addToCache(this);
|
||||
System.out.println("Added!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
forceTypeUpdate = false;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -46,6 +46,61 @@ public class StackCache {
|
||||
cache.addMonitor(monitor);
|
||||
}
|
||||
|
||||
public CacheSlot getSlotFromStack(ItemStack stack) {
|
||||
return getSlotFromStack(stack.getItem(), stack.getItemDamage(), stack.stackTagCompound);
|
||||
}
|
||||
|
||||
public CacheSlot getSlotFromStack(Item item, int meta, NBTTagCompound nbt) {
|
||||
long monitorIdentity = getStackIdentity(item, meta, nbt);
|
||||
return cacheSlots.get(monitorIdentity);
|
||||
}
|
||||
|
||||
/** Uses up items and returns how many of the requested items could be removed, with no desyncs that number should always be equal to the supplied amount */
|
||||
public long consumeItemsAndReturnQuantity(ItemStack stack, long amount) {
|
||||
long stackIdentity = getStackIdentity(stack.getItem(), stack.getItemDamage(), stack.stackTagCompound);
|
||||
CacheSlot cache = this.cacheSlots.get(stackIdentity);
|
||||
if(cache == null) return 0;
|
||||
long originalAmount = amount;
|
||||
|
||||
for(SlotMonitor monitor : cache.monitors) {
|
||||
ItemStack original = monitor.parent.getSlotAt(monitor.index);
|
||||
long checkIdentity = getStackIdentity(original);
|
||||
if(checkIdentity != stackIdentity) continue;
|
||||
amount = monitor.parent.useUpItem(monitor.index, amount);
|
||||
if(amount <= 0) break;
|
||||
}
|
||||
|
||||
return originalAmount - amount;
|
||||
}
|
||||
|
||||
/** Adds a stack to the system and returns the amount that did not fit */
|
||||
public long addItemsAndReturnQuantity(ItemStack stack, long amount) {
|
||||
long stackIdentity = getStackIdentity(stack.getItem(), stack.getItemDamage(), stack.stackTagCompound);
|
||||
CacheSlot cache = this.cacheSlots.get(stackIdentity);
|
||||
|
||||
if(cache != null) for(SlotMonitor monitor : cache.monitors) {
|
||||
ItemStack original = monitor.parent.getSlotAt(monitor.index);
|
||||
long checkIdentity = getStackIdentity(original);
|
||||
if(checkIdentity != stackIdentity) continue;
|
||||
amount = monitor.parent.addItem(monitor.index, amount);
|
||||
if(amount <= 0) break;
|
||||
}
|
||||
|
||||
if(amount > 0) {
|
||||
CacheSlot nullCache = this.cacheSlots.get(getNullIdentity());
|
||||
if(nullCache != null) { // quite ironic, isn't it?
|
||||
for(SlotMonitor monitor : nullCache.monitors) {
|
||||
if(!monitor.parent.allowTypeSetting()) continue;
|
||||
if(monitor.parent.getSlotAt(monitor.index) != null) continue;
|
||||
amount = monitor.parent.setupType(monitor.index, stack, amount);
|
||||
if(amount <= 0) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return amount;
|
||||
}
|
||||
|
||||
public void dissolveCache() {
|
||||
for(Entry<Long, CacheSlot> cacheEntry : cacheSlots.entrySet()) {
|
||||
cacheEntry.getValue().destroy();
|
||||
@ -131,10 +186,25 @@ public class StackCache {
|
||||
}
|
||||
}
|
||||
|
||||
public static long getNullIdentity() {
|
||||
return 0; //getStackIdentity(null, 0, null);
|
||||
}
|
||||
|
||||
public static long getStackIdentity(ItemStack stack) {
|
||||
if(stack == null) return getNullIdentity();
|
||||
return getStackIdentity(stack.getItem(), stack.getItemDamage(), stack.stackTagCompound);
|
||||
}
|
||||
|
||||
public static long getStackIdentity(Item item, int meta, NBTTagCompound nbt) {
|
||||
long identity = Item.getIdFromItem(item) * 27644437;
|
||||
identity += meta * 27644437;
|
||||
if(nbt != null) identity += nbt.toString().hashCode();
|
||||
if(item == null) return getNullIdentity();
|
||||
return getStackIdentity(Item.getIdFromItem(item), meta, nbt);
|
||||
}
|
||||
|
||||
public static long getStackIdentity(int item, int meta, NBTTagCompound nbt) {
|
||||
long identity = item * 27644437;
|
||||
identity += meta;
|
||||
identity *= 27644437;
|
||||
if(nbt != null) identity += nbt.hashCode();
|
||||
return identity;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package api.hbm.redstoneoverradio;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public interface IRORInteractive extends IRORInfo {
|
||||
|
||||
public static String NAME_SEPARATOR = "!";
|
||||
@ -9,7 +11,7 @@ public interface IRORInteractive extends IRORInfo {
|
||||
public static String EX_NAME = "Exception: Multiple Name Separators";
|
||||
public static String EX_FORMAT = "Exception: Parameter in Invalid Format";
|
||||
|
||||
/** Runs a function on the ROR component, usually causing the component to change or do something. Returns are optional. */
|
||||
/** Runs a function on the ROR component, usually causing the component to change or do something. Returns are unused for now. */
|
||||
public String runRORFunction(String name, String[] params);
|
||||
|
||||
/** Extracts the command name from a full command string */
|
||||
@ -18,7 +20,7 @@ public interface IRORInteractive extends IRORInfo {
|
||||
String[] parts = input.split(NAME_SEPARATOR);
|
||||
if(parts.length <= 0 || parts.length > 2) throw new RORFunctionException(EX_NAME);
|
||||
if(parts[0].isEmpty()) throw new RORFunctionException(EX_NULL);
|
||||
return parts[0];
|
||||
return parts[0].toLowerCase(Locale.US);
|
||||
}
|
||||
|
||||
/** Extracts the param list from a full command string */
|
||||
@ -34,7 +36,9 @@ public interface IRORInteractive extends IRORInfo {
|
||||
|
||||
public static int parseInt(String val, int min, int max) {
|
||||
int result = 0;
|
||||
try { result = Integer.parseInt(val); } catch(Exception x) { throw new RORFunctionException(EX_FORMAT); };
|
||||
try { result = Integer.parseInt(val); } catch(Exception x) {
|
||||
try { result = (int) Math.round(Double.parseDouble(val)); } catch(Exception y) { throw new RORFunctionException(EX_FORMAT); }
|
||||
}
|
||||
if(result < min || result > max) throw new RORFunctionException(EX_FORMAT);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -16,9 +16,13 @@ public interface ITooltipProvider {
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext);
|
||||
|
||||
public default void addStandardInfo(ItemStack stack, EntityPlayer player, List list, boolean ext) {
|
||||
this.addStandardInfo(stack, ((Block) this).getUnlocalizedName() + ".desc", player, list, ext);
|
||||
}
|
||||
|
||||
public default void addStandardInfo(ItemStack stack, String name, EntityPlayer player, List list, boolean ext) {
|
||||
|
||||
if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
|
||||
for(String s : I18nUtil.resolveKeyArray(((Block)this).getUnlocalizedName() + ".desc")) list.add(EnumChatFormatting.YELLOW + s);
|
||||
for(String s : I18nUtil.resolveKeyArray(name)) list.add(EnumChatFormatting.YELLOW + s);
|
||||
} else {
|
||||
list.add(EnumChatFormatting.DARK_GRAY + "" + EnumChatFormatting.ITALIC +"Hold <" +
|
||||
EnumChatFormatting.YELLOW + "" + EnumChatFormatting.ITALIC + "LSHIFT" +
|
||||
|
||||
@ -12,11 +12,7 @@ import com.hbm.blocks.machine.fusion.*;
|
||||
import com.hbm.blocks.machine.pile.*;
|
||||
import com.hbm.blocks.machine.rbmk.*;
|
||||
import com.hbm.blocks.network.*;
|
||||
import com.hbm.blocks.network.pneumatic.PneumoStorageAccess;
|
||||
import com.hbm.blocks.network.pneumatic.PneumoStorageClutter;
|
||||
import com.hbm.blocks.network.pneumatic.PneumoStorageMono;
|
||||
import com.hbm.blocks.network.pneumatic.PneumoTube;
|
||||
import com.hbm.blocks.network.pneumatic.PneumoTubePaintableBlock;
|
||||
import com.hbm.blocks.network.pneumatic.*;
|
||||
import com.hbm.blocks.rail.*;
|
||||
import com.hbm.blocks.test.*;
|
||||
import com.hbm.blocks.turret.*;
|
||||
@ -229,14 +225,14 @@ public class ModBlocks {
|
||||
public static Block block_foam;
|
||||
public static Block block_coke;
|
||||
public static Block block_graphite;
|
||||
public static Block block_graphite_drilled;
|
||||
public static Block block_graphite_fuel;
|
||||
public static Block block_graphite_plutonium;
|
||||
public static Block block_graphite_rod;
|
||||
public static Block block_graphite_source;
|
||||
public static Block block_graphite_lithium;
|
||||
public static Block block_graphite_tritium;
|
||||
public static Block block_graphite_detector;
|
||||
@Deprecated public static Block block_graphite_drilled;
|
||||
@Deprecated public static Block block_graphite_fuel;
|
||||
@Deprecated public static Block block_graphite_plutonium;
|
||||
@Deprecated public static Block block_graphite_rod;
|
||||
@Deprecated public static Block block_graphite_source;
|
||||
@Deprecated public static Block block_graphite_lithium;
|
||||
@Deprecated public static Block block_graphite_tritium;
|
||||
@Deprecated public static Block block_graphite_detector;
|
||||
public static Block block_boron;
|
||||
public static Block block_lanthanium;
|
||||
public static Block block_ra226;
|
||||
@ -578,7 +574,7 @@ public class ModBlocks {
|
||||
public static Block seal_hatch;
|
||||
|
||||
public static Block cargo_elevator;
|
||||
|
||||
|
||||
public static Block vault_door;
|
||||
public static Block blast_door;
|
||||
public static Block sliding_blast_door;
|
||||
@ -595,6 +591,7 @@ public class ModBlocks {
|
||||
public static Block round_airlock_door;
|
||||
public static Block sliding_seal_door;
|
||||
public static Block water_door;
|
||||
public static Block cargo_door;
|
||||
|
||||
public static Block door_metal;
|
||||
public static Block door_office;
|
||||
@ -807,6 +804,8 @@ public class ModBlocks {
|
||||
public static Block pneumatic_storage_access;
|
||||
public static Block pneumatic_storage_clutter;
|
||||
public static Block pneumatic_storage_mono;
|
||||
public static Block pneumatic_storage_importer;
|
||||
public static Block pneumatic_storage_exporter;
|
||||
|
||||
public static Block fan;
|
||||
public static Block piston_inserter;
|
||||
@ -852,6 +851,10 @@ public class ModBlocks {
|
||||
public static Block custom_machine;
|
||||
public static Block cm_anchor;
|
||||
|
||||
public static Block pile_brick;
|
||||
public static Block pile_block;
|
||||
public static Block pile_device;
|
||||
|
||||
public static Block pwr_fuel;
|
||||
public static Block pwr_control;
|
||||
public static Block pwr_channel;
|
||||
@ -914,9 +917,7 @@ public class ModBlocks {
|
||||
public static Block teleanchor;
|
||||
public static Block field_disturber;
|
||||
|
||||
public static Block machine_rtg_grey;
|
||||
@Deprecated public static Block machine_minirtg;
|
||||
@Deprecated public static Block machine_powerrtg;
|
||||
public static Block machine_rtg;
|
||||
public static Block machine_radiolysis;
|
||||
public static Block machine_hephaestus;
|
||||
|
||||
@ -1649,8 +1650,8 @@ public class ModBlocks {
|
||||
|
||||
waste_earth = new WasteEarth(Material.ground, true).setBlockName("waste_earth").setStepSound(Block.soundTypeGrass).setCreativeTab(MainRegistry.blockTab).setHardness(0.6F).setBlockTextureName(RefStrings.MODID + ":waste_earth");
|
||||
waste_mycelium = new WasteEarth(Material.ground, true).setBlockName("waste_mycelium").setStepSound(Block.soundTypeGrass).setLightLevel(1F).setCreativeTab(MainRegistry.blockTab).setHardness(0.6F).setBlockTextureName(RefStrings.MODID + ":waste_mycelium_side");
|
||||
waste_trinitite = new BlockOre(Material.sand).noFortune().setBlockName("waste_trinitite").setStepSound(Block.soundTypeSand).setCreativeTab(MainRegistry.blockTab).setHardness(0.5F).setResistance(2.5F).setBlockTextureName(RefStrings.MODID + ":waste_trinitite");
|
||||
waste_trinitite_red = new BlockOre(Material.sand).noFortune().setBlockName("waste_trinitite_red").setStepSound(Block.soundTypeSand).setCreativeTab(MainRegistry.blockTab).setHardness(0.5F).setResistance(2.5F).setBlockTextureName(RefStrings.MODID + ":waste_trinitite_red");
|
||||
waste_trinitite = new BlockTrinitite(Material.sand).noFortune().setBlockName("waste_trinitite").setStepSound(Block.soundTypeSand).setCreativeTab(MainRegistry.blockTab).setHardness(0.5F).setResistance(2.5F).setBlockTextureName(RefStrings.MODID + ":waste_trinitite");
|
||||
waste_trinitite_red = new BlockTrinitite(Material.sand).noFortune().setBlockName("waste_trinitite_red").setStepSound(Block.soundTypeSand).setCreativeTab(MainRegistry.blockTab).setHardness(0.5F).setResistance(2.5F).setBlockTextureName(RefStrings.MODID + ":waste_trinitite_red");
|
||||
waste_log = new WasteLog(Material.wood).setBlockName("waste_log").setStepSound(Block.soundTypeWood).setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(2.5F);
|
||||
waste_leaves = new WasteLeaves(Material.leaves).setBlockName("waste_leaves").setStepSound(Block.soundTypeGrass).setCreativeTab(MainRegistry.blockTab).setHardness(0.1F).setBlockTextureName(RefStrings.MODID + ":waste_leaves");
|
||||
waste_planks = new BlockOre(Material.wood).setBlockName("waste_planks").setStepSound(Block.soundTypeWood).setCreativeTab(MainRegistry.blockTab).setHardness(0.5F).setResistance(2.5F).setBlockTextureName(RefStrings.MODID + ":waste_planks");
|
||||
@ -1840,9 +1841,7 @@ public class ModBlocks {
|
||||
teleanchor = new MachineTeleanchor().setBlockName("teleanchor").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
field_disturber = new MachineFieldDisturber().setBlockName("field_disturber").setHardness(5.0F).setResistance(200.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":field_disturber");
|
||||
|
||||
machine_rtg_grey = new MachineRTG(Material.iron).setBlockName("machine_rtg_grey").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":rtg");
|
||||
machine_minirtg = new MachineMiniRTG(Material.iron).setBlockName("machine_minirtg").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":rtg_cell");
|
||||
machine_powerrtg = new MachineMiniRTG(Material.iron).setBlockName("machine_powerrtg").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":rtg_polonium");
|
||||
machine_rtg = new MachineRTG(Material.iron).setBlockName("machine_rtg_grey").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":rtg");
|
||||
machine_radiolysis = new MachineRadiolysis(Material.iron).setBlockName("machine_radiolysis").setHardness(10.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel_machine");
|
||||
machine_hephaestus = new MachineHephaestus(Material.iron).setBlockName("machine_hephaestus").setHardness(10.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel_machine");
|
||||
|
||||
@ -1910,11 +1909,13 @@ public class ModBlocks {
|
||||
drone_crate_provider = new DroneDock().setBlockName("drone_crate_provider").setHardness(0.1F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":drone_crate_provider");
|
||||
drone_crate_requester = new DroneDock().setBlockName("drone_crate_requester").setHardness(0.1F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":drone_crate_requester");
|
||||
|
||||
pneumatic_tube = new PneumoTube().setBlockName("pneumatic_tube").setStepSound(ModSoundTypes.pipe).setHardness(0.1F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pneumatic_tube");
|
||||
pneumatic_tube = new PneumoTube().setBlockName("pneumatic_tube").setStepSound(ModSoundTypes.pipe).setHardness(2F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pneumatic_tube");
|
||||
pneumatic_tube_paintable = new PneumoTubePaintableBlock().setBlockName("pneumatic_tube_paintable").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
pneumatic_storage_access = new PneumoStorageAccess().setBlockName("pneumatic_storage_access").setStepSound(ModSoundTypes.pipe).setHardness(0.1F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":pneumatic_storage_access");
|
||||
pneumatic_storage_clutter = new PneumoStorageClutter().setBlockName("pneumatic_storage_clutter").setStepSound(ModSoundTypes.pipe).setHardness(0.1F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":pneumatic_storage_clutter");
|
||||
pneumatic_storage_mono = new PneumoStorageMono().setBlockName("pneumatic_storage_mono").setStepSound(ModSoundTypes.pipe).setHardness(0.1F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":pneumatic_storage_mono");
|
||||
pneumatic_storage_access = new PneumoStorageAccess().setBlockName("pneumatic_storage_access").setStepSound(ModSoundTypes.pipe).setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pneumatic_storage_access");
|
||||
pneumatic_storage_clutter = new PneumoStorageClutter().setBlockName("pneumatic_storage_clutter").setStepSound(ModSoundTypes.pipe).setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pneumatic_storage_clutter");
|
||||
pneumatic_storage_mono = new PneumoStorageMono().setBlockName("pneumatic_storage_mono").setStepSound(ModSoundTypes.pipe).setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pneumatic_storage_mono");
|
||||
pneumatic_storage_importer = new PneumoStorageImporter().setBlockName("pneumatic_storage_importer").setStepSound(ModSoundTypes.pipe).setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pneumatic_storage_importer");
|
||||
pneumatic_storage_exporter = new PneumoStorageExporter().setBlockName("pneumatic_storage_exporter").setStepSound(ModSoundTypes.pipe).setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pneumatic_storage_exporter");
|
||||
|
||||
chain = new BlockChain(Material.iron).setBlockName("dungeon_chain").setHardness(0.25F).setResistance(2.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":chain");
|
||||
|
||||
@ -1961,18 +1962,22 @@ public class ModBlocks {
|
||||
cm_heat = new BlockCMHeat(Material.iron, RefStrings.MODID +":cm_heat_top").setBlockName("cm_heat").setCreativeTab(MainRegistry.machineTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":cm_heat_side");
|
||||
custom_machine = new BlockCustomMachine().setBlockName("custom_machine").setCreativeTab(MainRegistry.machineTab).setLightLevel(1F).setHardness(5.0F).setResistance(10.0F);
|
||||
cm_anchor = new BlockCMAnchor().setBlockName("custom_machine_anchor").setCreativeTab(MainRegistry.machineTab).setHardness(5.0F).setResistance(10.0F);
|
||||
|
||||
pile_brick = new BlockPileBrick().setBlockName("pile_brick").setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pile_brick");
|
||||
pile_device = new BlockPileDevice().setBlockName("pile_device").setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
pile_block = new BlockPile().setBlockName("pile_block").setStepSound(Block.soundTypeMetal).setHardness(15.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pile_block");
|
||||
|
||||
pwr_fuel = new BlockPillarPWR(Material.iron, RefStrings.MODID + ":pwr_fuel_top").setBlockName("pwr_fuel").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pwr_fuel_side");
|
||||
pwr_control = new BlockPillarPWR(Material.iron, RefStrings.MODID + ":pwr_control_top").setBlockName("pwr_control").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pwr_control_side");
|
||||
pwr_channel = new BlockPillarPWR(Material.iron, RefStrings.MODID + ":pwr_channel_top").setBlockName("pwr_channel").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pwr_channel_side");
|
||||
pwr_heatex = new BlockGenericPWR(Material.iron).setBlockName("pwr_heatex").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pwr_heatex");
|
||||
pwr_heatsink = new BlockGenericPWR(Material.iron).setBlockName("pwr_heatsink").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pwr_heatsink");
|
||||
pwr_neutron_source = new BlockGenericPWR(Material.iron).setBlockName("pwr_neutron_source").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pwr_neutron_source");
|
||||
pwr_reflector = new BlockGenericPWR(Material.iron).setBlockName("pwr_reflector").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pwr_reflector");
|
||||
pwr_casing = new BlockGenericPWR(Material.iron).setBlockName("pwr_casing").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pwr_casing");
|
||||
pwr_port = new BlockGenericPWR(Material.iron).setBlockName("pwr_port").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pwr_port");
|
||||
pwr_heatex = new BlockGenericTooltip(Material.iron).setBlockName("pwr_heatex").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pwr_heatex");
|
||||
pwr_heatsink = new BlockGenericTooltip(Material.iron).setBlockName("pwr_heatsink").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pwr_heatsink");
|
||||
pwr_neutron_source = new BlockGenericTooltip(Material.iron).setBlockName("pwr_neutron_source").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pwr_neutron_source");
|
||||
pwr_reflector = new BlockGenericTooltip(Material.iron).setBlockName("pwr_reflector").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pwr_reflector");
|
||||
pwr_casing = new BlockGenericTooltip(Material.iron).setBlockName("pwr_casing").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pwr_casing");
|
||||
pwr_port = new BlockGenericTooltip(Material.iron).setBlockName("pwr_port").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pwr_port");
|
||||
pwr_controller = new MachinePWRController(Material.iron).setBlockName("pwr_controller").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pwr_casing_blank");
|
||||
pwr_block = new BlockPWR(Material.iron).setBlockName("pwr_block").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":pwr_block");
|
||||
pwr_block = new BlockPWR(Material.iron).setBlockName("pwr_block").setHardness(15.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":pwr_block");
|
||||
|
||||
fusion_heater = new BlockPillar(Material.iron, RefStrings.MODID + ":fusion_heater_top").setBlockName("fusion_heater").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":fusion_heater_side");
|
||||
fusion_hatch = new FusionHatch(Material.iron).setBlockName("fusion_hatch").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":fusion_hatch");
|
||||
@ -2019,7 +2024,7 @@ public class ModBlocks {
|
||||
seal_hatch = new BlockHatch(Material.iron).setBlockName("seal_hatch").setHardness(Float.POSITIVE_INFINITY).setResistance(Float.POSITIVE_INFINITY).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":seal_hatch_3");
|
||||
|
||||
cargo_elevator = new BlockCargoElevator().setBlockName("cargo_elevator").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
|
||||
|
||||
vault_door = new BlockDoorGeneric(Material.iron, DoorDecl.VAULT_DOOR).setBlockName("vault_door").setHardness(10.0F).setResistance(1_000.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":concrete");
|
||||
blast_door = new BlastDoor(Material.iron).setBlockName("blast_door").setHardness(10.0F).setResistance(1_000.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":blast_door");
|
||||
|
||||
@ -2035,6 +2040,7 @@ public class ModBlocks {
|
||||
round_airlock_door = new BlockDoorGeneric(Material.iron, DoorDecl.ROUND_AIRLOCK_DOOR).setBlockName("round_airlock_door").setHardness(10.0F).setResistance(1_000.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
sliding_seal_door = new BlockDoorGeneric(Material.iron, DoorDecl.SLIDING_SEAL_DOOR).setBlockName("sliding_seal_door").setHardness(10.0F).setResistance(1_000.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
water_door = new BlockDoorGeneric(Material.iron, DoorDecl.WATER_DOOR).setBlockName("water_door").setHardness(5.0F).setResistance(50.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
cargo_door = new BlockDoorGeneric(Material.iron, DoorDecl.CARGO_DOOR).setBlockName("cargo_door").setHardness(5.0F).setResistance(50.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
|
||||
door_metal = new BlockModDoor(Material.iron).setBlockName("door_metal").setHardness(5.0F).setResistance(5.0F).setBlockTextureName(RefStrings.MODID + ":door_metal");
|
||||
door_office = new BlockModDoor(Material.iron).setBlockName("door_office").setHardness(10.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":door_office");
|
||||
@ -2348,7 +2354,6 @@ public class ModBlocks {
|
||||
|
||||
logic_block = new LogicBlock().setBlockName("logic_block").setBlockTextureName(RefStrings.MODID + ":logic_block");
|
||||
logic_block_invis = new LogicBlockInvis().setBlockName("logic_block_invis").setBlockTextureName(RefStrings.MODID + ":logic_block");
|
||||
|
||||
}
|
||||
|
||||
private static void registerBlock() {
|
||||
@ -2943,7 +2948,7 @@ public class ModBlocks {
|
||||
|
||||
//Hooh
|
||||
GameRegistry.registerBlock(cargo_elevator, cargo_elevator.getUnlocalizedName());
|
||||
|
||||
|
||||
//Vault Door
|
||||
GameRegistry.registerBlock(vault_door, vault_door.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(blast_door, blast_door.getUnlocalizedName());
|
||||
@ -2965,6 +2970,7 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(round_airlock_door, round_airlock_door.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(sliding_seal_door, sliding_seal_door.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(water_door, water_door.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(cargo_door, cargo_door.getUnlocalizedName());
|
||||
|
||||
//Crates
|
||||
register(crate_iron, ItemBlockStorageCrate.class);
|
||||
@ -3056,9 +3062,7 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(machine_radgen, machine_radgen.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_cyclotron, machine_cyclotron.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_exposure_chamber, machine_exposure_chamber.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_rtg_grey, machine_rtg_grey.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_minirtg, machine_minirtg.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_powerrtg, machine_powerrtg.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_rtg, machine_rtg.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_radiolysis, machine_radiolysis.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_hephaestus, machine_hephaestus.getUnlocalizedName());
|
||||
|
||||
@ -3130,12 +3134,12 @@ public class ModBlocks {
|
||||
register(red_pylon_medium_wood_transformer);
|
||||
register(red_pylon_medium_steel);
|
||||
register(red_pylon_medium_steel_transformer);
|
||||
GameRegistry.registerBlock(red_pylon_large, ItemBlockBase.class, red_pylon_large.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(substation, ItemBlockBase.class, substation.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(cable_switch, cable_switch.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(cable_detector, cable_detector.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(cable_diode, ItemBlockBase.class, cable_diode.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_detector, machine_detector.getUnlocalizedName());
|
||||
register(red_pylon_large);
|
||||
register(substation);
|
||||
register(cable_switch);
|
||||
register(cable_detector);
|
||||
register(cable_diode);
|
||||
register(machine_detector);
|
||||
|
||||
register(fluid_duct_neo);
|
||||
register(fluid_duct_box);
|
||||
@ -3183,6 +3187,8 @@ public class ModBlocks {
|
||||
register(pneumatic_storage_access);
|
||||
register(pneumatic_storage_clutter);
|
||||
register(pneumatic_storage_mono);
|
||||
register(pneumatic_storage_importer);
|
||||
register(pneumatic_storage_exporter);
|
||||
register(fan);
|
||||
register(piston_inserter);
|
||||
|
||||
@ -3319,6 +3325,11 @@ public class ModBlocks {
|
||||
register(cm_flux);
|
||||
register(cm_heat);
|
||||
register(cm_anchor);
|
||||
|
||||
//Chicago Pile
|
||||
register(pile_brick);
|
||||
register(pile_device);
|
||||
register(pile_block);
|
||||
|
||||
//PWR
|
||||
register(pwr_fuel);
|
||||
|
||||
@ -104,7 +104,7 @@ public class BlockCrate extends BlockFalling {
|
||||
BlockCrate.addToListWithWeight(metalList, Item.getItemFromBlock(ModBlocks.machine_reactor_breeding), 6);
|
||||
BlockCrate.addToListWithWeight(metalList, Item.getItemFromBlock(ModBlocks.machine_wood_burner), 10);
|
||||
BlockCrate.addToListWithWeight(metalList, Item.getItemFromBlock(ModBlocks.machine_diesel), 8);
|
||||
BlockCrate.addToListWithWeight(metalList, Item.getItemFromBlock(ModBlocks.machine_rtg_grey), 4);
|
||||
BlockCrate.addToListWithWeight(metalList, Item.getItemFromBlock(ModBlocks.machine_rtg), 4);
|
||||
BlockCrate.addToListWithWeight(metalList, Item.getItemFromBlock(ModBlocks.red_pylon), 9);
|
||||
BlockCrate.addToListWithWeight(metalList, new ItemStack(ModItems.battery_pack, 1, EnumBatteryPack.BATTERY_LEAD.ordinal()), 10);
|
||||
BlockCrate.addToListWithWeight(metalList, Item.getItemFromBlock(ModBlocks.machine_electric_furnace_off), 8);
|
||||
|
||||
@ -34,7 +34,7 @@ public class BlockDecoCT extends BlockOre implements IBlockCT {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon[] getFragments(IBlockAccess world, int x, int y, int z) {
|
||||
public IIcon[] getFragments(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return rec.fragCache;
|
||||
}
|
||||
|
||||
|
||||
@ -36,7 +36,7 @@ public class BlockNTMGlassCT extends BlockNTMGlass implements IBlockCT {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon[] getFragments(IBlockAccess world, int x, int y, int z) {
|
||||
public IIcon[] getFragments(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return rec.fragCache;
|
||||
}
|
||||
}
|
||||
|
||||
@ -159,7 +159,7 @@ public class BlockOre extends Block {
|
||||
living.addPotionEffect(new PotionEffect(HbmPotion.radiation.id, 30 * 20, 2));
|
||||
}
|
||||
if(this == ModBlocks.waste_trinitite || this == ModBlocks.waste_trinitite_red) {
|
||||
living.addPotionEffect(new PotionEffect(HbmPotion.radiation.id, 30 * 20, 0));
|
||||
living.addPotionEffect(new PotionEffect(HbmPotion.radiation.id, 5 * 20, 2));
|
||||
}
|
||||
if(this == ModBlocks.brick_jungle_ooze) {
|
||||
living.addPotionEffect(new PotionEffect(HbmPotion.radiation.id, 15 * 20, 9));
|
||||
@ -178,8 +178,12 @@ public class BlockOre extends Block {
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
super.randomDisplayTick(world, x, y, z, rand);
|
||||
|
||||
if(this == ModBlocks.waste_trinitite || this == ModBlocks.waste_trinitite_red || this == ModBlocks.block_trinitite || this == ModBlocks.block_waste) {
|
||||
world.spawnParticle("townaura", x + rand.nextFloat(), y + 1.1F, z + rand.nextFloat(), 0.0D, 0.0D, 0.0D);
|
||||
if(this == ModBlocks.block_trinitite || this == ModBlocks.block_waste) {
|
||||
world.spawnParticle("townaura", x + rand.nextFloat(), y + 1.0625, z + rand.nextFloat(), 0, 0, 0);
|
||||
}
|
||||
|
||||
if((this == ModBlocks.waste_trinitite || this == ModBlocks.waste_trinitite_red) && rand.nextInt(5) == 0) {
|
||||
world.spawnParticle("townaura", x + rand.nextFloat(), y + 1.0625, z + rand.nextFloat(), 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,14 +1,19 @@
|
||||
package com.hbm.blocks.generic;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.extprop.HbmPlayerProps;
|
||||
import com.hbm.inventory.recipes.PedestalRecipes;
|
||||
import com.hbm.inventory.recipes.PedestalRecipes.PedestalRecipe;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.armor.ItemModDefuser;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.particle.helper.ExplosionSmallCreator;
|
||||
import com.hbm.util.Compat;
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@ -18,6 +23,7 @@ import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.monster.EntityCreeper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@ -194,8 +200,24 @@ public class BlockPedestal extends BlockContainer {
|
||||
|
||||
public ItemStack item;
|
||||
|
||||
@Override public boolean canUpdate() { return false; }
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote && worldObj.getTotalWorldTime() % 20 == 0) {
|
||||
|
||||
if(this.item != null) {
|
||||
if(item.getItem() == ModItems.protection_charm) pushPedestalEntry(worldObj, PedestalEntryType.CHARM_OF_PROTECTION, xCoord, yCoord, zCoord);
|
||||
if(item.getItem() == ModItems.meteor_charm) pushPedestalEntry(worldObj, PedestalEntryType.METEORITE_CHARM, xCoord, yCoord, zCoord);
|
||||
if(worldObj.getTotalWorldTime() % 60 == 0 && item.getItem() == ModItems.defuser_gold) castrateCreepers();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void castrateCreepers() {
|
||||
List<EntityCreeper> creepers = worldObj.getEntitiesWithinAABB(EntityCreeper.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1).expand(25, 25, 25));
|
||||
for(EntityCreeper creeper : creepers) ItemModDefuser.castrateCreeper(creeper, null, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
@ -224,4 +246,48 @@ public class BlockPedestal extends BlockContainer {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static HashMap<Integer, List<PedestalEntry>> pedestalEntries = new HashMap();
|
||||
|
||||
public static void pushPedestalEntry(World world, PedestalEntryType type, int x, int y, int z) {
|
||||
PedestalEntry entry = new PedestalEntry(type, x, y, z, world.getTotalWorldTime());
|
||||
|
||||
int dim = world.provider.dimensionId;
|
||||
List<PedestalEntry> entries = pedestalEntries.get(dim);
|
||||
|
||||
if(entries == null) {
|
||||
entries = new ArrayList();
|
||||
pedestalEntries.put(dim, entries);
|
||||
}
|
||||
entries.add(entry);
|
||||
}
|
||||
|
||||
public static final int timeout = 60; //3 seconds
|
||||
|
||||
public static void checkPedestalEntries(int dim, long currentTime) {
|
||||
List<PedestalEntry> entries = getEntriesForDimension(dim);
|
||||
if(entries == null) return;
|
||||
entries.removeIf(x -> { return x.timestamp < currentTime - timeout; });
|
||||
}
|
||||
|
||||
public static List<PedestalEntry> getEntriesForDimension(int dim) {
|
||||
return pedestalEntries.get(dim);
|
||||
}
|
||||
|
||||
public static class PedestalEntry {
|
||||
public PedestalEntryType type;
|
||||
public BlockPos pos;
|
||||
public long timestamp;
|
||||
|
||||
public PedestalEntry(PedestalEntryType type, int x, int y, int z, long timestamp) {
|
||||
this.type = type;
|
||||
this.pos = new BlockPos(x, y, z);
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
}
|
||||
|
||||
public static enum PedestalEntryType {
|
||||
CHARM_OF_PROTECTION,
|
||||
METEORITE_CHARM
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ public class BlockSellafieldSlaked extends Block {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister reg) {
|
||||
icons = new IIcon[4];
|
||||
icons[0] = reg.registerIcon(RefStrings.MODID + ":sellafield_slaked");
|
||||
this.blockIcon = icons[0] = reg.registerIcon(RefStrings.MODID + ":sellafield_slaked");
|
||||
icons[1] = reg.registerIcon(RefStrings.MODID + ":sellafield_slaked_1");
|
||||
icons[2] = reg.registerIcon(RefStrings.MODID + ":sellafield_slaked_2");
|
||||
icons[3] = reg.registerIcon(RefStrings.MODID + ":sellafield_slaked_3");
|
||||
|
||||
41
src/main/java/com/hbm/blocks/generic/BlockTrinitite.java
Normal file
41
src/main/java/com/hbm/blocks/generic/BlockTrinitite.java
Normal file
@ -0,0 +1,41 @@
|
||||
package com.hbm.blocks.generic;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public class BlockTrinitite extends BlockOre {
|
||||
|
||||
public IIcon[] icons;
|
||||
|
||||
public BlockTrinitite(Material mat) {
|
||||
super(mat);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return icons[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister reg) {
|
||||
icons = new IIcon[4];
|
||||
|
||||
for(int i = 0; i < 4; i++) icons[i] = reg.registerIcon(this.getTextureName() + "." + i);
|
||||
this.blockIcon = icons[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
long l = (long) (x * 3129871) ^ (long)y * 116129781L ^ (long)z;
|
||||
l = l * l * 42317861L + l * 11L;
|
||||
int i = (int)(l >> 16 & 3L);
|
||||
return icons[(int)(Math.abs(i) % icons.length)];
|
||||
}
|
||||
}
|
||||
@ -19,33 +19,20 @@ public class BlockWand extends Block {
|
||||
setBlockBounds(1F/16F, 1F/16F, 1F/16F, 15F/16F, 15F/16F, 15F/16F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
@Override public int getRenderType() { return renderID; }
|
||||
@Override public boolean isOpaqueCube() { return false; }
|
||||
@Override public boolean renderAsNormalBlock() { return false; }
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return renderID;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
|
||||
Block block = world.getBlock(x, y, z);
|
||||
|
||||
return block != this;
|
||||
}
|
||||
|
||||
}
|
||||
@ -9,6 +9,7 @@ import com.hbm.blocks.IBlockSideRotation;
|
||||
import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.interfaces.IControlReceiver;
|
||||
import com.hbm.interfaces.NotableComments;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
@ -73,6 +74,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
*
|
||||
* @author hbm, Mellow
|
||||
*/
|
||||
@NotableComments
|
||||
public class BlockWandTandem extends BlockContainer implements IBlockSideRotation, INBTBlockTransformable, IGUIProvider, ILookOverlay {
|
||||
|
||||
private IIcon iconTop;
|
||||
|
||||
@ -9,9 +9,9 @@ import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class BlockGenericPWR extends BlockGeneric implements ITooltipProvider {
|
||||
public class BlockGenericTooltip extends BlockGeneric implements ITooltipProvider {
|
||||
|
||||
public BlockGenericPWR(Material material) {
|
||||
public BlockGenericTooltip(Material material) {
|
||||
super(material);
|
||||
}
|
||||
|
||||
@ -43,7 +43,7 @@ public class BlockHadronCoil extends Block implements IBlockCT, ITooltipProvider
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon[] getFragments(IBlockAccess world, int x, int y, int z) {
|
||||
public IIcon[] getFragments(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return rec.fragCache;
|
||||
}
|
||||
|
||||
|
||||
@ -55,7 +55,7 @@ public class BlockICF extends BlockContainer implements IBlockCT {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon[] getFragments(IBlockAccess world, int x, int y, int z) {
|
||||
public IIcon[] getFragments(IBlockAccess world, int x, int y, int z, int side) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if(meta == 1) return recPort.fragCache;
|
||||
return rec.fragCache;
|
||||
|
||||
@ -62,7 +62,7 @@ public class BlockPWR extends BlockContainer implements IBlockCT {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon[] getFragments(IBlockAccess world, int x, int y, int z) {
|
||||
public IIcon[] getFragments(IBlockAccess world, int x, int y, int z, int side) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if(meta == 1) return recPort.fragCache;
|
||||
return rec.fragCache;
|
||||
|
||||
@ -202,7 +202,7 @@ public abstract class FoundryCastingBase extends BlockContainer implements ICruc
|
||||
}
|
||||
|
||||
if(cast.type != null && cast.amount > 0) {
|
||||
text.add(EnumChatFormatting.YELLOW + cast.type.names[0] + ": " + cast.amount + " / " + cast.getCapacity());
|
||||
text.add(EnumChatFormatting.YELLOW + cast.type.getLocalizedName() + ": " + cast.amount + " / " + cast.getCapacity());
|
||||
}
|
||||
|
||||
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(this.getUnlocalizedName() + ".name"), 0xFF4000, 0x401000, text);
|
||||
|
||||
@ -204,7 +204,7 @@ public class FoundryOutlet extends BlockContainer implements ICrucibleAcceptor,
|
||||
List<String> text = new ArrayList();
|
||||
|
||||
if(outlet.filter != null) {
|
||||
text.add(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("foundry.filter", outlet.filter.names[0]));
|
||||
text.add(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("foundry.filter", outlet.filter.getLocalizedName()));
|
||||
}
|
||||
if(outlet.invertFilter) {
|
||||
text.add(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("foundry.invertFilter"));
|
||||
|
||||
@ -1,36 +0,0 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import com.hbm.tileentity.machine.TileEntityMachineMiniRTG;
|
||||
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class MachineMiniRTG extends BlockContainer {
|
||||
|
||||
public MachineMiniRTG(Material mat) {
|
||||
super(mat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileEntityMachineMiniRTG();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return MachineRTG.renderID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@ -187,7 +187,7 @@ public class MachinePWRController extends BlockContainer implements ITooltipProv
|
||||
errored = true;
|
||||
}
|
||||
|
||||
private void sendError(World world, int x, int y, int z, String message, EntityPlayer player) {
|
||||
public static void sendError(World world, int x, int y, int z, String message, EntityPlayer player) {
|
||||
|
||||
if(player instanceof EntityPlayerMP) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
|
||||
@ -47,7 +47,7 @@ public class MachineRTG extends BlockContainer {
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
|
||||
if(this == ModBlocks.machine_rtg_grey)
|
||||
if(this == ModBlocks.machine_rtg)
|
||||
return new TileEntityMachineRTG();
|
||||
|
||||
return null;
|
||||
@ -60,7 +60,7 @@ public class MachineRTG extends BlockContainer {
|
||||
return true;
|
||||
} else if(!player.isSneaking())
|
||||
{
|
||||
if(this == ModBlocks.machine_rtg_grey) {
|
||||
if(this == ModBlocks.machine_rtg) {
|
||||
TileEntityMachineRTG entity = (TileEntityMachineRTG) world.getTileEntity(x, y, z);
|
||||
if(entity != null)
|
||||
{
|
||||
@ -78,7 +78,7 @@ public class MachineRTG extends BlockContainer {
|
||||
{
|
||||
if (!keepInventory)
|
||||
{
|
||||
if (this == ModBlocks.machine_rtg_grey) {
|
||||
if (this == ModBlocks.machine_rtg) {
|
||||
TileEntityMachineRTG tileentityfurnace = (TileEntityMachineRTG) p_149749_1_.getTileEntity(p_149749_2_,
|
||||
p_149749_3_, p_149749_4_);
|
||||
|
||||
|
||||
@ -1,41 +1,12 @@
|
||||
package com.hbm.blocks.machine.pile;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.blocks.generic.BlockFlammable;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.ParticleBurstPacket;
|
||||
|
||||
import api.hbm.block.IToolable;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class BlockGraphite extends BlockFlammable implements IToolable {
|
||||
public class BlockGraphite extends BlockFlammable {
|
||||
|
||||
public BlockGraphite(Material mat, int en, int flam) {
|
||||
super(mat, en, flam);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onScrew(World world, EntityPlayer player, int x, int y, int z, int side, float fX, float fY, float fZ, ToolType tool) {
|
||||
|
||||
if(tool != ToolType.HAND_DRILL)
|
||||
return false;
|
||||
|
||||
if(!world.isRemote) {
|
||||
world.setBlock(x, y, z, ModBlocks.block_graphite_drilled, side / 2, 3);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new ParticleBurstPacket(x, y, z, Block.getIdFromBlock(this), 0), new TargetPoint(world.provider.dimensionId, x, y, z, 50));
|
||||
world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, this.stepSound.func_150496_b(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
|
||||
|
||||
BlockGraphiteRod.ejectItem(world, x, y, z, ForgeDirection.getOrientation(side), new ItemStack(ModItems.ingot_graphite));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -19,6 +19,7 @@ import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@Deprecated
|
||||
public class BlockGraphiteBreedingFuel extends BlockGraphiteDrilledTE implements IToolable {
|
||||
|
||||
@Override
|
||||
|
||||
@ -9,6 +9,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
@Deprecated
|
||||
public class BlockGraphiteBreedingProduct extends BlockGraphiteDrilledBase implements IToolable {
|
||||
|
||||
@Override
|
||||
|
||||
@ -12,6 +12,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@Deprecated
|
||||
public class BlockGraphiteDrilled extends BlockGraphiteDrilledBase implements IToolable {
|
||||
|
||||
@Override
|
||||
|
||||
@ -26,6 +26,7 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@Deprecated
|
||||
public abstract class BlockGraphiteDrilledBase extends BlockFlammable implements IToolable, IInsertable {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
@ -4,6 +4,7 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@Deprecated
|
||||
public abstract class BlockGraphiteDrilledTE extends BlockGraphiteDrilledBase implements ITileEntityProvider {
|
||||
|
||||
public BlockGraphiteDrilledTE() {
|
||||
|
||||
@ -21,6 +21,7 @@ import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@Deprecated
|
||||
public class BlockGraphiteFuel extends BlockGraphiteDrilledTE implements IToolable, IBlowable {
|
||||
|
||||
@Override
|
||||
|
||||
@ -19,6 +19,7 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@Deprecated
|
||||
public class BlockGraphiteNeutronDetector extends BlockGraphiteDrilledTE {
|
||||
|
||||
@Override
|
||||
|
||||
@ -13,6 +13,7 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@Deprecated
|
||||
public class BlockGraphiteRod extends BlockGraphiteDrilledBase implements IToolable {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
@ -13,6 +13,7 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@Deprecated
|
||||
public class BlockGraphiteSource extends BlockGraphiteDrilledTE implements IToolable {
|
||||
|
||||
@Override
|
||||
|
||||
156
src/main/java/com/hbm/blocks/machine/pile/BlockPile.java
Normal file
156
src/main/java/com/hbm/blocks/machine/pile/BlockPile.java
Normal file
@ -0,0 +1,156 @@
|
||||
package com.hbm.blocks.machine.pile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.blocks.machine.MachinePWRController;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.render.block.ct.CT;
|
||||
import com.hbm.render.block.ct.CTStitchReceiver;
|
||||
import com.hbm.render.block.ct.IBlockCT;
|
||||
import com.hbm.tileentity.machine.pile.TileEntityPileBaseMK2;
|
||||
import com.hbm.tileentity.machine.pile.TileEntityPileCore;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import api.hbm.block.IToolable;
|
||||
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.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class BlockPile extends BlockContainer implements IBlockCT, IToolable, ILookOverlay {
|
||||
|
||||
/** Blank dummy, the pile is mostly composed of that */
|
||||
public static final int META_DUMMY = 0;
|
||||
/** The core, gets its own TE and runs the simulation, only one per pile */
|
||||
public static final int META_CORE = 1;
|
||||
/** Channel mid segment for channel intersect checks */
|
||||
public static final int META_CHANNEL = 2;
|
||||
/** Startpoint of the channel */
|
||||
public static final int META_FUEL_IN = 3;
|
||||
/** Endpoint of the fuel channel */
|
||||
public static final int META_FUEL_OUT = 4;
|
||||
/** Startpoint of the ventilation channel */
|
||||
public static final int META_AIR_IN = 5;
|
||||
/** Endpoint of the ventilation channel */
|
||||
public static final int META_AIR_OUT = 6;
|
||||
/** Control rod channel */
|
||||
public static final int META_CONTROL = 7;
|
||||
/** Edge of our pile "cube" to prevent channels from being drilled there */
|
||||
public static final int META_EDGE = 8;
|
||||
|
||||
@SideOnly(Side.CLIENT) public CTStitchReceiver rec;
|
||||
@SideOnly(Side.CLIENT) public CTStitchReceiver recTop;
|
||||
@SideOnly(Side.CLIENT) public CTStitchReceiver recChanIn;
|
||||
@SideOnly(Side.CLIENT) public CTStitchReceiver recChanOut;
|
||||
@SideOnly(Side.CLIENT) public CTStitchReceiver recCon;
|
||||
@SideOnly(Side.CLIENT) public CTStitchReceiver recCore;
|
||||
|
||||
@SideOnly(Side.CLIENT) protected IIcon iconTop;
|
||||
|
||||
public BlockPile() { super(Material.iron); }
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
if(meta == META_CORE) return new TileEntityPileCore();
|
||||
return new TileEntityPileBaseMK2();
|
||||
}
|
||||
|
||||
@Override public int getRenderType() { return CT.renderID; }
|
||||
@Override public Item getItemDropped(int i, Random rand, int j) { return null; }
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister reg) {
|
||||
super.registerBlockIcons(reg);
|
||||
this.iconTop = reg.registerIcon(RefStrings.MODID + ":pile_block_top");
|
||||
|
||||
this.rec = IBlockCT.primeReceiver(reg, this.blockIcon.getIconName(), this.blockIcon);
|
||||
this.recTop = IBlockCT.primeReceiver(reg, this.iconTop.getIconName(), this.iconTop);
|
||||
this.recChanIn = IBlockCT.primeReceiver(reg, RefStrings.MODID + ":pile_block_input", this.blockIcon);
|
||||
this.recChanOut = IBlockCT.primeReceiver(reg, RefStrings.MODID + ":pile_block_output", this.blockIcon);
|
||||
this.recCon = IBlockCT.primeReceiver(reg, RefStrings.MODID + ":pile_block_control_top", this.iconTop);
|
||||
this.recCore = IBlockCT.primeReceiver(reg, RefStrings.MODID + ":pile_block_core", this.iconTop);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon[] getFragments(IBlockAccess world, int x, int y, int z, int side) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if(side == 0 || side == 1) return meta == META_CONTROL ? recCon.fragCache : recTop.fragCache;
|
||||
if(meta == META_FUEL_IN || meta == META_AIR_IN) return recChanIn.fragCache;
|
||||
if(meta == META_FUEL_OUT || meta == META_AIR_OUT) return recChanOut.fragCache;
|
||||
if(meta == META_CORE) return recCore.fragCache;
|
||||
return rec.fragCache;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if(tile instanceof TileEntityPileBaseMK2) {
|
||||
TileEntityPileBaseMK2 pile = (TileEntityPileBaseMK2) tile;
|
||||
world.removeTileEntity(x, y, z);
|
||||
if(pile.coreY >= 0) world.setBlock(x, y, z, ModBlocks.pile_brick);
|
||||
|
||||
TileEntityPileCore core = pile.getCore();
|
||||
if(core != null && !core.isInvalid()) core.destroy();
|
||||
|
||||
} else {
|
||||
world.removeTileEntity(x, y, z);
|
||||
world.setBlock(x, y, z, ModBlocks.pile_brick);
|
||||
}
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onScrew(World world, EntityPlayer player, int x, int y, int z, int side, float fX, float fY, float fZ, ToolType tool) {
|
||||
|
||||
if(tool == tool.HAND_DRILL) {
|
||||
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if(tile instanceof TileEntityPileCore || world.getBlockMetadata(x, y, z) == META_CORE) {
|
||||
MachinePWRController.sendError(world, x, y, z, "Cannot intersect core", player);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(tile instanceof TileEntityPileBaseMK2) {
|
||||
if(world.isRemote) return true;
|
||||
TileEntityPileCore core = ((TileEntityPileBaseMK2) tile).getCore();
|
||||
if(core != null) {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(side).getOpposite();
|
||||
return core.drillChannel(x, y, z, dir, player);
|
||||
}
|
||||
}
|
||||
|
||||
MachinePWRController.sendError(world, x, y, z, "No core found", player);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printHook(Pre event, World world, int x, int y, int z) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
List<String> text = new ArrayList();
|
||||
if(meta == META_FUEL_IN) text.add("Fuel Loading Port");
|
||||
if(meta == META_FUEL_OUT) text.add("Fuel Ejection Port");
|
||||
if(meta == META_AIR_IN) text.add("Air Inlet");
|
||||
if(meta == META_AIR_OUT) text.add("Air Outlet");
|
||||
if(meta == META_CONTROL) text.add("Control Rod Channel");
|
||||
if(!text.isEmpty()) ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
||||
}
|
||||
}
|
||||
150
src/main/java/com/hbm/blocks/machine/pile/BlockPileBrick.java
Normal file
150
src/main/java/com/hbm/blocks/machine/pile/BlockPileBrick.java
Normal file
@ -0,0 +1,150 @@
|
||||
package com.hbm.blocks.machine.pile;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.blocks.machine.MachinePWRController;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.machine.pile.TileEntityPileBaseMK2;
|
||||
import com.hbm.tileentity.machine.pile.TileEntityPileCore;
|
||||
import com.hbm.tileentity.machine.pile.TileEntityPileCore.PileOrientation;
|
||||
|
||||
import api.hbm.block.IToolable;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class BlockPileBrick extends Block implements IToolable {
|
||||
|
||||
@SideOnly(Side.CLIENT) protected IIcon iconTop;
|
||||
@SideOnly(Side.CLIENT) protected IIcon iconSide;
|
||||
|
||||
public BlockPileBrick() {
|
||||
super(Material.rock);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister reg) {
|
||||
super.registerBlockIcons(reg);
|
||||
this.iconTop = reg.registerIcon(RefStrings.MODID + ":pile_brick_top");
|
||||
this.iconSide = reg.registerIcon(RefStrings.MODID + ":pile_brick_side");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
if(side == 0 || side == 1) return this.iconTop;
|
||||
if(side == 4 || side == 5) return this.iconSide;
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
|
||||
public static final int MIN_V_SIZE = 5;
|
||||
public static final int MIN_H_SIZE = 5;
|
||||
public static final int MAX_V_SIZE = 15;
|
||||
public static final int MAX_H_SIZE = 15;
|
||||
|
||||
@Override
|
||||
public boolean onScrew(World world, EntityPlayer player, int x, int y, int z, int side, float fX, float fY, float fZ, ToolType tool) {
|
||||
|
||||
if(tool == tool.HAND_DRILL) {
|
||||
if(side == 0 || side == 1) return false;
|
||||
if(world.isRemote) return true;
|
||||
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(side).getOpposite();
|
||||
ForgeDirection dirLeft = dir.getRotation(ForgeDirection.DOWN);
|
||||
|
||||
int negHeight = 0;
|
||||
int posHeight = 0;
|
||||
int left = 0;
|
||||
int right = 0;
|
||||
int depth = 0;
|
||||
|
||||
/// PROBE DIMENSIONS ///
|
||||
// height
|
||||
for(int i = 1; i <= MAX_V_SIZE - 1; i++) { if(world.getBlock(x, y + i, z) != this) break; posHeight = i; }
|
||||
for(int i = 1; i <= MAX_V_SIZE - posHeight - 1; i++) { if(world.getBlock(x, y - i, z) != this) break; negHeight = i; }
|
||||
// side width
|
||||
for(int i = 1; i <= MAX_H_SIZE - 1; i++) { if(world.getBlock(x + dirLeft.offsetX * i, y, z + dirLeft.offsetZ * i) != this) break; left = i; }
|
||||
for(int i = 1; i <= MAX_H_SIZE - left - 1; i++) { if(world.getBlock(x - dirLeft.offsetX * i, y, z - dirLeft.offsetZ * i) != this) break; right = i; }
|
||||
// depth
|
||||
for(int i = 1; i <= MAX_H_SIZE; i++) { if(world.getBlock(x + dir.offsetX * i, y, z + dir.offsetZ * i) != this) break; depth = i; }
|
||||
|
||||
/// SIZE CHECKS ///
|
||||
if(posHeight + negHeight + 1 < MIN_V_SIZE) {
|
||||
MachinePWRController.sendError(world, x, y + posHeight, z, "Height too low (<" + MIN_V_SIZE + ")", player);
|
||||
MachinePWRController.sendError(world, x, y - negHeight, z, "Height too low (<" + MIN_V_SIZE + ")", player);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(left + right + 1 < MIN_H_SIZE) {
|
||||
MachinePWRController.sendError(world, x + dirLeft.offsetX * left, y, z + dirLeft.offsetZ * right, "Width too low (<" + MIN_H_SIZE + ")", player);
|
||||
MachinePWRController.sendError(world, x - dirLeft.offsetX * right, y, z - dirLeft.offsetZ * right, "Width too low (<" + MIN_H_SIZE + ")", player);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(depth + 1 < MIN_H_SIZE) {
|
||||
MachinePWRController.sendError(world, x + dir.offsetX * depth, y, z + dir.offsetZ * depth, "Depth too low (<" + MIN_H_SIZE + ")", player);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// CORE EDGE CHECK ///
|
||||
if(posHeight == 0 || negHeight == 0 || left == 0 || right == 0) {
|
||||
MachinePWRController.sendError(world, x, y, z, "Core cannot be on an edge", player);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// VOLUME CHECK ///
|
||||
for(int h = -negHeight; h <= posHeight; h++) {
|
||||
for(int v = -left; v <= right; v++) {
|
||||
for(int d = 0; d <= depth; d++) {
|
||||
int iX = x - dirLeft.offsetX * v + dir.offsetX * d;
|
||||
int iY = y + h;
|
||||
int iZ = z - dirLeft.offsetZ * v + dir.offsetZ * d;
|
||||
|
||||
if(world.getBlock(iX, iY, iZ) != this) {
|
||||
MachinePWRController.sendError(world, iX, iY, iZ, "Graphite block missing", player);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// BUILD ///
|
||||
for(int h = -negHeight; h <= posHeight; h++) {
|
||||
for(int v = -left; v <= right; v++) {
|
||||
for(int d = 0; d <= depth; d++) {
|
||||
int iX = x - dirLeft.offsetX * v + dir.offsetX * d;
|
||||
int iY = y + h;
|
||||
int iZ = z - dirLeft.offsetZ * v + dir.offsetZ * d;
|
||||
|
||||
if(x == iX && y == iY && z == iZ) {
|
||||
world.setBlock(iX, iY, iZ, ModBlocks.pile_block, BlockPile.META_CORE, 3);
|
||||
TileEntityPileCore core = (TileEntityPileCore) world.getTileEntity(iX, iY, iZ);
|
||||
core.orientation = PileOrientation.getOrientation(dir);
|
||||
core.setupSize(posHeight + negHeight + 1, left + right + 1, depth + 1);
|
||||
} else {
|
||||
int edgeCount = 0;
|
||||
if(h == -negHeight || h == posHeight) edgeCount++;
|
||||
if(v == -left || v == right) edgeCount++;
|
||||
if(d == 0 || d == depth) edgeCount++;
|
||||
boolean isEdge = edgeCount > 1;
|
||||
world.setBlock(iX, iY, iZ, ModBlocks.pile_block, isEdge ? BlockPile.META_EDGE : BlockPile.META_DUMMY, 3);
|
||||
TileEntityPileBaseMK2 pile = (TileEntityPileBaseMK2) world.getTileEntity(iX, iY, iZ);
|
||||
pile.setCore(x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
187
src/main/java/com/hbm/blocks/machine/pile/BlockPileDevice.java
Normal file
187
src/main/java/com/hbm/blocks/machine/pile/BlockPileDevice.java
Normal file
@ -0,0 +1,187 @@
|
||||
package com.hbm.blocks.machine.pile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.IBlockMulti;
|
||||
import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.main.NTMSounds;
|
||||
import com.hbm.tileentity.machine.pile.TileEntityPileControl;
|
||||
import com.hbm.tileentity.machine.pile.TileEntityPileLoader;
|
||||
import com.hbm.tileentity.machine.pile.TileEntityPileVent;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class BlockPileDevice extends BlockContainer implements IBlockMulti, ILookOverlay, ITooltipProvider {
|
||||
|
||||
public static final int ITEM_META_LOADER = 0;
|
||||
public static final int ITEM_META_VENT = 1;
|
||||
public static final int ITEM_META_CONTROL = 2;
|
||||
|
||||
public static final int BLOCK_META_LOADER = 0;
|
||||
public static final int BLOCK_META_VENT = 4;
|
||||
public static final int BLOCK_META_CONTROL = 8;
|
||||
|
||||
public BlockPileDevice() {
|
||||
super(Material.iron);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSubCount() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||
for(int i = 0; i < getSubCount(); ++i) {
|
||||
list.add(new ItemStack(item, 1, i));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
meta -= meta % 4;
|
||||
if(meta == BLOCK_META_LOADER) return new TileEntityPileLoader();
|
||||
if(meta == BLOCK_META_VENT) return new TileEntityPileVent();
|
||||
if(meta == BLOCK_META_CONTROL) return new TileEntityPileControl();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override public int getRenderType() { return -1; }
|
||||
@Override public boolean isOpaqueCube() { return false; }
|
||||
@Override public boolean renderAsNormalBlock() { return false; }
|
||||
|
||||
@Override
|
||||
public int onBlockPlaced(World world, int x, int y, int z, int side, float fx, float fy, float fz, int meta) {
|
||||
int metaOffset = itemMetaToBlockMeta(meta);
|
||||
// side is reduced by 2 because UP and DOWN (0 and 1) aren't relevant
|
||||
// therefore, all item metas (device subtypes) are neatly packed into 4 metas each
|
||||
side = MathHelper.clamp_int(side - 2, 0, 3);
|
||||
return metaOffset + side;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
meta -= meta % 4;
|
||||
|
||||
if(meta == BLOCK_META_LOADER) {
|
||||
if(world.isRemote) return true;
|
||||
|
||||
TileEntityPileLoader tile = (TileEntityPileLoader) world.getTileEntity(x, y, z);
|
||||
|
||||
if(tile.level <= 0 && !tile.loading) {
|
||||
|
||||
if(player.getHeldItem() != null && tile.stack == null && tile.isItemLoadable(player.getHeldItem())) {
|
||||
tile.stack = player.getHeldItem().copy();
|
||||
tile.stack.stackSize = 1;
|
||||
player.getHeldItem().stackSize--;
|
||||
world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, NTMSounds.UPGRADE_PLUG, 1F, 1F);
|
||||
return true;
|
||||
}
|
||||
|
||||
tile.loading = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
|
||||
if(world.getBlockMetadata(x, y, z) != BLOCK_META_CONTROL) return;
|
||||
|
||||
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||
if(i == 0) world.setBlockMetadataWithNotify(x, y, z, BLOCK_META_CONTROL + 0, 2);
|
||||
if(i == 1) world.setBlockMetadataWithNotify(x, y, z, BLOCK_META_CONTROL + 3, 2);
|
||||
if(i == 2) world.setBlockMetadataWithNotify(x, y, z, BLOCK_META_CONTROL + 1, 2);
|
||||
if(i == 3) world.setBlockMetadataWithNotify(x, y, z, BLOCK_META_CONTROL + 2, 2);
|
||||
}
|
||||
|
||||
public static int itemMetaToBlockMeta(int meta) {
|
||||
if(meta >= ITEM_META_CONTROL) return BLOCK_META_CONTROL;
|
||||
if(meta == ITEM_META_VENT) return BLOCK_META_VENT;
|
||||
return BLOCK_META_LOADER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta) {
|
||||
if(meta >= BLOCK_META_CONTROL) return ITEM_META_CONTROL;
|
||||
if(meta >= BLOCK_META_VENT) return ITEM_META_VENT;
|
||||
return ITEM_META_LOADER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if(meta >= BLOCK_META_CONTROL) return side.ordinal() == meta % 4 + 2;
|
||||
if(meta >= BLOCK_META_VENT) return false;
|
||||
if(meta >= BLOCK_META_LOADER) return side.ordinal() == meta % 4 + 2;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
|
||||
this.addStandardInfo(stack, this.getUnlocalizedName(stack) + ".desc", player, list, ext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printHook(Pre event, World world, int x, int y, int z) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
List<String> text = new ArrayList();
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if(tile instanceof TileEntityPileLoader) {
|
||||
TileEntityPileLoader device = (TileEntityPileLoader) tile;
|
||||
text.add("Index: " + device.chanNum);
|
||||
if(device.syncStack != null) text.add("Loading: " + device.syncStack.getDisplayName());
|
||||
}
|
||||
|
||||
if(tile instanceof TileEntityPileVent) {
|
||||
TileEntityPileVent device = (TileEntityPileVent) tile;
|
||||
text.add("Index: " + device.chanNum);
|
||||
}
|
||||
|
||||
if(tile instanceof TileEntityPileControl) {
|
||||
TileEntityPileControl device = (TileEntityPileControl) tile;
|
||||
text.add("Index: " + device.chanNum);
|
||||
text.add("Extraction level: " + (int) + (device.level * 100) + "%");
|
||||
}
|
||||
|
||||
if(!text.isEmpty())
|
||||
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedNameFromItemMeta(this.damageDropped(meta)) + ".name"), 0xffff00, 0x404000, text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
return getUnlocalizedNameFromItemMeta(stack.getItemDamage());
|
||||
}
|
||||
|
||||
public String getUnlocalizedNameFromItemMeta(int meta) {
|
||||
meta = Math.abs(meta % 3); // recitfy
|
||||
if(meta == ITEM_META_LOADER) return this.getUnlocalizedName() + ".loader";
|
||||
if(meta == ITEM_META_VENT) return this.getUnlocalizedName() + ".vent";
|
||||
if(meta == ITEM_META_CONTROL) return this.getUnlocalizedName() + ".control";
|
||||
return this.getUnlocalizedName();
|
||||
}
|
||||
}
|
||||
@ -1,32 +1,35 @@
|
||||
package com.hbm.blocks.network;
|
||||
|
||||
import api.hbm.block.IToolable;
|
||||
import api.hbm.energymk2.IEnergyConnectorBlock;
|
||||
import api.hbm.energymk2.IEnergyConnectorMK2;
|
||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||
import api.hbm.energymk2.IEnergyReceiverMK2.ConnectionPriority;
|
||||
import api.hbm.energymk2.Nodespace;
|
||||
import api.hbm.energymk2.Nodespace.PowerNode;
|
||||
import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.interfaces.IControlReceiver;
|
||||
import com.hbm.inventory.gui.GUIDiode;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.Compat;
|
||||
import com.hbm.util.EnumUtil;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.BlockPistonBase;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
@ -37,28 +40,16 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CableDiode extends BlockContainer implements IEnergyConnectorBlock, ILookOverlay, IToolable, ITooltipProvider {
|
||||
public class CableDiode extends BlockContainer implements IEnergyConnectorBlock, ILookOverlay, ITooltipProvider {
|
||||
|
||||
public CableDiode(Material mat) {
|
||||
super(mat);
|
||||
}
|
||||
|
||||
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return renderID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
@Override public int getRenderType() { return renderID; }
|
||||
@Override public boolean isOpaqueCube() { return false; }
|
||||
@Override public boolean renderAsNormalBlock() { return false; }
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@ -72,61 +63,31 @@ public class CableDiode extends BlockContainer implements IEnergyConnectorBlock,
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnect(IBlockAccess world, int x, int y, int z, ForgeDirection dir) {
|
||||
return true;
|
||||
}
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float fX, float fY, float fZ) {
|
||||
|
||||
@Override
|
||||
public boolean onScrew(World world, EntityPlayer player, int x, int y, int z, int side, float fX, float fY, float fZ, ToolType tool) {
|
||||
|
||||
TileEntityDiode te = (TileEntityDiode)world.getTileEntity(x, y, z);
|
||||
|
||||
if(world.isRemote)
|
||||
return true;
|
||||
|
||||
if(tool == ToolType.SCREWDRIVER) {
|
||||
if(te.level < 11)
|
||||
te.level++;
|
||||
te.markDirty();
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(tool == ToolType.HAND_DRILL) {
|
||||
if(te.level > 1)
|
||||
te.level--;
|
||||
te.markDirty();
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(tool == ToolType.DEFUSER) {
|
||||
int p = te.priority.ordinal() + 1;
|
||||
if(p > 4) p = 0;
|
||||
te.priority = ConnectionPriority.values()[p];
|
||||
te.markDirty();
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
if(!player.isSneaking()) {
|
||||
if(world.isRemote) FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnect(IBlockAccess world, int x, int y, int z, ForgeDirection dir) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
|
||||
list.add(EnumChatFormatting.GOLD + "Limits throughput and restricts flow direction");
|
||||
list.add(EnumChatFormatting.YELLOW + "Use screwdriver to increase throughput");
|
||||
list.add(EnumChatFormatting.YELLOW + "Use hand drill to decrease throughput");
|
||||
list.add(EnumChatFormatting.YELLOW + "Use defuser to change network priority");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printHook(Pre event, World world, int x, int y, int z) {
|
||||
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
|
||||
if(!(te instanceof TileEntityDiode))
|
||||
return;
|
||||
if(!(te instanceof TileEntityDiode)) return;
|
||||
|
||||
TileEntityDiode diode = (TileEntityDiode) te;
|
||||
|
||||
@ -142,36 +103,47 @@ public class CableDiode extends BlockContainer implements IEnergyConnectorBlock,
|
||||
return new TileEntityDiode();
|
||||
}
|
||||
|
||||
public static class TileEntityDiode extends TileEntityLoadedBase implements IEnergyReceiverMK2 {
|
||||
public static class TileEntityDiode extends TileEntityLoadedBase implements IEnergyReceiverMK2, IControlReceiver, IGUIProvider {
|
||||
|
||||
/** Used as an intra-tick tracker for how much energy has been transmitted, resets to 0 each tick and maxes out based on transfer */
|
||||
private long power;
|
||||
private boolean recursionBrake = false;
|
||||
private int pulses = 0;
|
||||
public ConnectionPriority priority = ConnectionPriority.NORMAL;
|
||||
public long limit = 1_000;
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
level = nbt.getInteger("level");
|
||||
priority = ConnectionPriority.values()[nbt.getByte("p")];
|
||||
if(nbt.hasKey("level")) {
|
||||
this.limit = (long) Math.pow(10, nbt.getInteger("level"));
|
||||
} else {
|
||||
this.limit = nbt.getLong("limit");
|
||||
}
|
||||
this.priority = ConnectionPriority.values()[nbt.getByte("p")];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setInteger("level", level);
|
||||
nbt.setLong("limit", limit);
|
||||
nbt.setByte("p", (byte) this.priority.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
this.writeToNBT(nbt);
|
||||
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbt);
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeByte((byte) priority.ordinal());
|
||||
buf.writeLong(limit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||
this.readFromNBT(pkt.func_148857_g());
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
priority = EnumUtil.grabEnumSafely(ConnectionPriority.class, buf.readByte());
|
||||
limit = buf.readLong();
|
||||
}
|
||||
|
||||
int level = 1;
|
||||
|
||||
private ForgeDirection getDir() {
|
||||
return ForgeDirection.getOrientation(this.getBlockMetadata()).getOpposite();
|
||||
}
|
||||
@ -181,34 +153,22 @@ public class CableDiode extends BlockContainer implements IEnergyConnectorBlock,
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
|
||||
if(dir == getDir())
|
||||
continue;
|
||||
|
||||
if(dir == getDir()) continue;
|
||||
this.trySubscribe(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir);
|
||||
}
|
||||
|
||||
pulses = 0;
|
||||
this.setPower(0); //tick is over, reset our allowed transfe
|
||||
this.setPower(0); //tick is over, reset our allowed transfer
|
||||
this.networkPackNT(15);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnect(ForgeDirection dir) {
|
||||
return dir != getDir();
|
||||
}
|
||||
|
||||
/** Used as an intra-tick tracker for how much energy has been transmitted, resets to 0 each tick and maxes out based on transfer */
|
||||
private long power;
|
||||
private boolean recursionBrake = false;
|
||||
private int pulses = 0;
|
||||
public ConnectionPriority priority = ConnectionPriority.NORMAL;
|
||||
@Override public boolean canConnect(ForgeDirection dir) { return dir != getDir(); }
|
||||
|
||||
@Override
|
||||
public long transferPower(long power) {
|
||||
|
||||
if(recursionBrake)
|
||||
return power;
|
||||
if(recursionBrake) return power;
|
||||
|
||||
pulses++;
|
||||
if(this.getPower() >= this.getMaxPower() || pulses > 10) return power; //if we have already maxed out transfer or max pulses, abort
|
||||
@ -241,29 +201,27 @@ public class CableDiode extends BlockContainer implements IEnergyConnectorBlock,
|
||||
return power;
|
||||
}
|
||||
|
||||
@Override public long getReceiverSpeed() { return this.getMaxPower() - this.getPower(); }
|
||||
@Override public long getMaxPower() { return this.limit; }
|
||||
@Override public long getPower() { return Math.min(power, this.getMaxPower()); }
|
||||
@Override public void setPower(long power) { this.power = power; }
|
||||
@Override public ConnectionPriority getPriority() { return this.priority; }
|
||||
|
||||
@Override
|
||||
public long getReceiverSpeed() {
|
||||
return this.getMaxPower() - this.getPower();
|
||||
public boolean hasPermission(EntityPlayer player) {
|
||||
return player.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 128;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getMaxPower() {
|
||||
return (long) Math.pow(10, level);
|
||||
public void receiveControl(NBTTagCompound data) {
|
||||
if(data.hasKey("limit")) this.limit = data.getLong("limit");
|
||||
if(data.hasKey("priority")) this.priority = EnumUtil.grabEnumSafely(ConnectionPriority.class, data.getByte("priority"));
|
||||
if(limit < 0) limit = 0;
|
||||
if(limit > 10_000_000_000L) limit = 10_000_000_000L;
|
||||
this.markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getPower() {
|
||||
return Math.min(power, this.getMaxPower());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPower(long power) {
|
||||
this.power = power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConnectionPriority getPriority() {
|
||||
return this.priority;
|
||||
}
|
||||
@Override public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { return new GUIDiode(this); }
|
||||
@Override public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { return null; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ public class RadioAUTOCAL extends BlockDummyable {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override public int[] getDimensions() { return new int[] {1, 0, 0, 0, 0 ,0}; }
|
||||
@Override public int[] getDimensions() { return new int[] {1, 0, 0, 0, 0, 0}; }
|
||||
@Override public int getOffset() { return 0; }
|
||||
|
||||
@Override
|
||||
|
||||
@ -40,7 +40,7 @@ public class WireCoated extends BlockContainer implements IBlockCT {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon[] getFragments(IBlockAccess world, int x, int y, int z) {
|
||||
public IIcon[] getFragments(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return rec.fragCache;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,13 +1,27 @@
|
||||
package com.hbm.blocks.network.pneumatic;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.config.ServerConfig;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.network.pneumatic.TileEntityPneumoStorageClutter;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class PneumoStorageClutter extends BlockContainer {
|
||||
@ -30,4 +44,129 @@ public class PneumoStorageClutter extends BlockContainer {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int i, Random rand, int j) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||
|
||||
if(dropInv) {
|
||||
TileEntityPneumoStorageClutter storage = (TileEntityPneumoStorageClutter) world.getTileEntity(x, y, z);
|
||||
Random rand = world.rand;
|
||||
if(storage != null) {
|
||||
for(int i = 0; i < storage.getSizeInventory(); ++i) {
|
||||
ItemStack itemstack = storage.getStackInSlot(i);
|
||||
if(itemstack != null) {
|
||||
float offsetX = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float offsetY = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float offsetZ = rand.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
while(itemstack.stackSize > 0) {
|
||||
int split = rand.nextInt(21) + 10;
|
||||
if(split > itemstack.stackSize) split = itemstack.stackSize;
|
||||
itemstack.stackSize -= split;
|
||||
EntityItem entityitem = new EntityItem(world, x + offsetX, y + offsetY, z + offsetZ, new ItemStack(itemstack.getItem(), split, itemstack.getItemDamage()));
|
||||
|
||||
if(itemstack.hasTagCompound()) {
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
float intensity = 0.05F;
|
||||
entityitem.motionX = rand.nextGaussian() * intensity;
|
||||
entityitem.motionY = rand.nextGaussian() * intensity + 0.2F;
|
||||
entityitem.motionZ = rand.nextGaussian() * intensity;
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
world.func_147453_f(x, y, z, block);
|
||||
}
|
||||
}
|
||||
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
}
|
||||
|
||||
private static boolean dropInv = true;
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
||||
|
||||
if(!world.isRemote && !ServerConfig.CRATE_KEEP_CONTENTS.get()) {
|
||||
if(!player.capabilities.isCreativeMode) {
|
||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(this)));
|
||||
}
|
||||
dropInv = true;
|
||||
boolean flag = world.setBlockToAir(x, y, z);
|
||||
return flag;
|
||||
}
|
||||
|
||||
if(!player.capabilities.isCreativeMode && !world.isRemote && willHarvest) {
|
||||
|
||||
ItemStack drop = new ItemStack(this);
|
||||
ISidedInventory inv = (ISidedInventory)world.getTileEntity(x, y, z);
|
||||
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
|
||||
if(inv != null) {
|
||||
|
||||
for(int i = 0; i < inv.getSizeInventory(); i++) {
|
||||
ItemStack stack = inv.getStackInSlot(i);
|
||||
if(stack == null) continue;
|
||||
NBTTagCompound slot = new NBTTagCompound();
|
||||
stack.writeToNBT(slot);
|
||||
nbt.setTag("slot" + i, slot);
|
||||
}
|
||||
}
|
||||
|
||||
if(!nbt.hasNoTags()) {
|
||||
drop.stackTagCompound = nbt;
|
||||
}
|
||||
|
||||
if(inv instanceof TileEntityPneumoStorageClutter) {
|
||||
TileEntityPneumoStorageClutter crate = (TileEntityPneumoStorageClutter) inv;
|
||||
if (crate.hasCustomInventoryName()) {
|
||||
drop.setStackDisplayName(crate.getInventoryName());
|
||||
}
|
||||
}
|
||||
|
||||
if(drop.hasTagCompound()) {
|
||||
try {
|
||||
byte[] abyte = CompressedStreamTools.compress(drop.stackTagCompound);
|
||||
|
||||
if(abyte.length > 6000) {
|
||||
player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.RED + "Warning: Container NBT exceeds 6kB, contents will be ejected!"));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(this)));
|
||||
return world.setBlockToAir(x, y, z);
|
||||
}
|
||||
|
||||
} catch(IOException e) { }
|
||||
}
|
||||
|
||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, drop));
|
||||
}
|
||||
|
||||
dropInv = false;
|
||||
boolean flag = world.setBlockToAir(x, y, z);
|
||||
dropInv = true;
|
||||
|
||||
return flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {
|
||||
|
||||
TileEntityPneumoStorageClutter inv = (TileEntityPneumoStorageClutter) world.getTileEntity(x, y, z);
|
||||
|
||||
if(inv != null && stack.hasTagCompound()) {
|
||||
for(int i = 0; i < inv.getSizeInventory(); i++) {
|
||||
inv.setInventorySlotContents(i, ItemStack.loadItemStackFromNBT(stack.stackTagCompound.getCompoundTag("slot" + i)));
|
||||
}
|
||||
if(stack.hasDisplayName()) inv.setCustomName(stack.getDisplayName());
|
||||
}
|
||||
|
||||
super.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,72 @@
|
||||
package com.hbm.blocks.network.pneumatic;
|
||||
|
||||
import com.hbm.blocks.machine.BlockMachineBase;
|
||||
import com.hbm.tileentity.network.pneumatic.TileEntityPneumoStorageExporter;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class PneumoStorageExporter extends BlockMachineBase {
|
||||
|
||||
public PneumoStorageExporter() {
|
||||
super(Material.iron, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityPneumoStorageExporter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
|
||||
if(!(te instanceof ISidedInventory)) return;
|
||||
|
||||
ISidedInventory tileentityfurnace = (ISidedInventory) te;
|
||||
|
||||
if(tileentityfurnace != null) {
|
||||
|
||||
for(int i = 9; i < tileentityfurnace.getSizeInventory(); ++i) {
|
||||
|
||||
ItemStack itemstack = tileentityfurnace.getStackInSlot(i);
|
||||
|
||||
if(itemstack != null) {
|
||||
|
||||
float mX = world.rand.nextFloat() * 0.8F + 0.1F;
|
||||
float mY = world.rand.nextFloat() * 0.8F + 0.1F;
|
||||
float mZ = world.rand.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
while(itemstack.stackSize > 0) {
|
||||
|
||||
int amount = world.rand.nextInt(21) + 10;
|
||||
if(amount > itemstack.stackSize) amount = itemstack.stackSize;
|
||||
|
||||
itemstack.stackSize -= amount;
|
||||
EntityItem entityitem = new EntityItem(world, x + mX, y + mY, z + mZ, new ItemStack(itemstack.getItem(), amount, itemstack.getItemDamage()));
|
||||
|
||||
if(itemstack.hasTagCompound())
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
|
||||
float motion = 0.05F;
|
||||
entityitem.motionX = (float) world.rand.nextGaussian() * motion;
|
||||
entityitem.motionY = (float) world.rand.nextGaussian() * motion + 0.2F;
|
||||
entityitem.motionZ = (float) world.rand.nextGaussian() * motion;
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
world.func_147453_f(x, y, z, block);
|
||||
}
|
||||
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package com.hbm.blocks.network.pneumatic;
|
||||
|
||||
import com.hbm.blocks.machine.BlockMachineBase;
|
||||
import com.hbm.tileentity.network.pneumatic.TileEntityPneumoStorageImporter;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class PneumoStorageImporter extends BlockMachineBase {
|
||||
|
||||
public PneumoStorageImporter() {
|
||||
super(Material.iron, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityPneumoStorageImporter();
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,16 @@
|
||||
package com.hbm.blocks.network.pneumatic;
|
||||
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.network.pneumatic.TileEntityPneumoStorageMono;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@ -13,7 +22,58 @@ public class PneumoStorageMono extends BlockContainer {
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return null;
|
||||
return new TileEntityPneumoStorageMono();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
if(world.isRemote) return true;
|
||||
if(!player.isSneaking()) {
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
||||
|
||||
if(!player.capabilities.isCreativeMode && !world.isRemote && willHarvest) {
|
||||
|
||||
TileEntityPneumoStorageMono inv = (TileEntityPneumoStorageMono) world.getTileEntity(x, y, z);
|
||||
ItemStack drop = new ItemStack(this);
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
|
||||
if(inv != null) {
|
||||
for(int i = 0; i < 3; i++) {
|
||||
ItemStack stack = inv.getStackInSlot(i);
|
||||
if(stack == null) continue;
|
||||
NBTTagCompound slot = new NBTTagCompound();
|
||||
stack.writeToNBT(slot);
|
||||
nbt.setTag("slot" + i, slot);
|
||||
nbt.setInteger("amount" + i, inv.amounts[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if(!nbt.hasNoTags()) drop.stackTagCompound = nbt;
|
||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, drop));
|
||||
}
|
||||
|
||||
return world.setBlockToAir(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {
|
||||
|
||||
TileEntityPneumoStorageMono inv = (TileEntityPneumoStorageMono) world.getTileEntity(x, y, z);
|
||||
|
||||
if(inv != null && stack.hasTagCompound()) {
|
||||
for(int i = 0; i < 3; i++) {
|
||||
inv.setInventorySlotContents(i, ItemStack.loadItemStackFromNBT(stack.stackTagCompound.getCompoundTag("slot" + i)));
|
||||
inv.amounts[i] = stack.stackTagCompound.getInteger("amount" + i);
|
||||
}
|
||||
}
|
||||
|
||||
super.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
}
|
||||
}
|
||||
95
src/main/java/com/hbm/commands/CommandWikiRender.java
Normal file
95
src/main/java/com/hbm/commands/CommandWikiRender.java
Normal file
@ -0,0 +1,95 @@
|
||||
package com.hbm.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.hbm.inventory.gui.GUIScreenWikiRender;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemDepletedFuel;
|
||||
import com.hbm.items.machine.ItemFluidDuct;
|
||||
import com.hbm.items.machine.ItemRBMKPellet;
|
||||
import com.hbm.main.MainRegistry;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.FMLLaunchHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.command.WrongUsageException;
|
||||
import net.minecraft.command.PlayerNotFoundException;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraftforge.client.ClientCommandHandler;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.init.Blocks;
|
||||
|
||||
// horribly written command so you can render more than fucking guns without having to decompile the JAR
|
||||
public class CommandWikiRender extends CommandBase {
|
||||
|
||||
public static void register() {
|
||||
if(FMLLaunchHandler.side() != Side.CLIENT) return;
|
||||
ClientCommandHandler.instance.registerCommand(new CommandWikiRender());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return "ntmwikirender";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandUsage(ICommandSender sender) {
|
||||
return String.format(Locale.US, "%s/%s <type> %s- Render screenshots of a selected item type (e.g ItemGunBaseNT). Intended for developers and wiki editors only.", EnumChatFormatting.GREEN,
|
||||
getCommandName(), EnumChatFormatting.LIGHT_PURPLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCommandSenderUseCommand(ICommandSender sender) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processCommand(ICommandSender sender, String[] args) {
|
||||
if(!(sender instanceof EntityPlayer)) {
|
||||
throw new PlayerNotFoundException();
|
||||
}
|
||||
|
||||
if(args.length == 0) {
|
||||
throw new WrongUsageException(getCommandUsage(sender), new Object[0]);
|
||||
}
|
||||
|
||||
MainRegistry.logger.info("Taking a screenshot of " + args[0]);
|
||||
|
||||
List<Item> ignoredItems = Arrays.asList(ModItems.achievement_icon, Items.spawn_egg, Item.getItemFromBlock(Blocks.mob_spawner));
|
||||
|
||||
List<Class<? extends Item>> collapsedClasses = Arrays.asList(ItemRBMKPellet.class, ItemDepletedFuel.class, ItemFluidDuct.class);
|
||||
|
||||
String prefix = args[0];
|
||||
int slotScale = 16;
|
||||
boolean ignoreNonNTM = true;
|
||||
|
||||
List<ItemStack> stacks = new ArrayList<ItemStack>();
|
||||
for(Object reg : Item.itemRegistry) {
|
||||
Item item = (Item) reg;
|
||||
if(ignoreNonNTM && !Item.itemRegistry.getNameForObject(item).startsWith("hbm:"))
|
||||
continue;
|
||||
if(ignoredItems.contains(item))
|
||||
continue;
|
||||
if(!item.getClass().getSimpleName().equalsIgnoreCase(args[0])
|
||||
&& (net.minecraft.block.Block.getBlockFromItem(item) == null || !net.minecraft.block.Block.getBlockFromItem(item).getClass().getSimpleName().equalsIgnoreCase(args[0])))
|
||||
continue;
|
||||
if(collapsedClasses.contains(item.getClass())) {
|
||||
stacks.add(new ItemStack(item));
|
||||
} else {
|
||||
item.getSubItems(item, null, stacks);
|
||||
}
|
||||
}
|
||||
|
||||
Minecraft.getMinecraft().thePlayer.closeScreen();
|
||||
FMLCommonHandler.instance().showGuiScreen(new GUIScreenWikiRender(stacks.toArray(new ItemStack[0]), prefix, "wiki-block-renders-256", slotScale));
|
||||
}
|
||||
}
|
||||
@ -5,8 +5,7 @@ import net.minecraftforge.common.config.Configuration;
|
||||
public class MobConfig {
|
||||
|
||||
public static boolean enableMaskman = true;
|
||||
public static int maskmanDelay = 60 * 60 * 60;
|
||||
public static int maskmanChance = 3;
|
||||
public static int maskmanDelay = 20 * 60; // 20 minutes
|
||||
public static int maskmanMinRad = 50;
|
||||
public static boolean maskmanUnderground = true;
|
||||
|
||||
@ -78,8 +77,7 @@ public class MobConfig {
|
||||
final String CATEGORY = CommonConfig.CATEGORY_MOBS;
|
||||
|
||||
enableMaskman = CommonConfig.createConfigBool(config, CATEGORY, "12.M00_enableMaskman", "Whether mask man should spawn", true);
|
||||
maskmanDelay = CommonConfig.createConfigInt(config, CATEGORY, "12.M01_maskmanDelay", "How many world ticks need to pass for a check to be performed", 60 * 60 * 60);
|
||||
maskmanChance = CommonConfig.createConfigInt(config, CATEGORY, "12.M02_maskmanChance", "1:x chance to spawn mask man, must be at least 1", 3);
|
||||
maskmanDelay = CommonConfig.createConfigInt(config, CATEGORY, "12.M01_maskmanTimer", "How many world seconds need to pass for mask man to spawn, if the requirements are met", 20 * 60);
|
||||
maskmanMinRad = CommonConfig.createConfigInt(config, CATEGORY, "12.M03_maskmanMinRad", "The amount of radiation needed for mask man to spawn", 50);
|
||||
maskmanUnderground = CommonConfig.createConfigBool(config, CATEGORY, "12.M04_maskmanUnderound", "Whether players need to be underground for mask man to spawn", true);
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ public class VersatileConfig {
|
||||
|
||||
public static int getSchrabOreChance() {
|
||||
if(GeneralConfig.enableLBSM) return GeneralConfig.schrabRate;
|
||||
return 100;
|
||||
return 250;
|
||||
}
|
||||
|
||||
public static void applyPotionSickness(EntityLivingBase entity, int duration) {
|
||||
|
||||
@ -32,7 +32,6 @@ public class WorldConfig {
|
||||
public static int bedrockOilSpawn = 200;
|
||||
public static int meteoriteSpawn = 500;
|
||||
|
||||
public static boolean newBedrockOres = true;
|
||||
public static int bedrockIronSpawn = 100;
|
||||
public static int bedrockCopperSpawn = 200;
|
||||
public static int bedrockBoraxSpawn = 50;
|
||||
@ -150,7 +149,6 @@ public class WorldConfig {
|
||||
bedrockOilSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.22_bedrockOilSpawnRate", "Spawns a bedrock oil node every nTH chunk", 200);
|
||||
meteoriteSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.23_meteoriteSpawnRate", "Spawns a fallen meteorite every nTH chunk", 200);
|
||||
|
||||
newBedrockOres = CommonConfig.createConfigBool(config, CATEGORY_OREGEN, "2.NB_newBedrockOres", "Enables the newer genreric bedrock ores", true);
|
||||
bedrockIronSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.B00_bedrockIronWeight", "Spawn weight for iron bedrock ore", 100);
|
||||
bedrockCopperSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.B01_bedrockCopperWeight", "Spawn weight for copper bedrock ore", 200);
|
||||
bedrockBoraxSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.B02_bedrockBoraxWeight", "Spawn weight for borax bedrock ore", 50);
|
||||
|
||||
@ -230,9 +230,6 @@ public class MineralRecipes {
|
||||
addBilletToIngot(ModItems.ingot_hes, ModItems.billet_hes);
|
||||
addBilletToIngot(ModItems.ingot_australium, ModItems.billet_australium);*/
|
||||
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.billet_balefire_gold, 1), new Object[] { ModItems.billet_au198, ModItems.cell_antimatter, ModItems.pellet_charged });
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.billet_flashlead, 2), new Object[] { ModItems.billet_balefire_gold, ModItems.billet_pb209, ModItems.cell_antimatter });
|
||||
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.pellet_rtg), new Object[] { ModItems.billet_pu238, ModItems.billet_pu238, ModItems.billet_pu238, IRON.plate() }));
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.pellet_rtg_radium), new Object[] { ModItems.billet_ra226, ModItems.billet_ra226, ModItems.billet_ra226, IRON.plate() }));
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.pellet_rtg_weak), new Object[] { ModItems.billet_u238, ModItems.billet_u238, ModItems.billet_pu238, IRON.plate() }));
|
||||
|
||||
@ -62,20 +62,19 @@ public class ToolRecipes {
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.elec_pickaxe, 1), new Object[] { "RDM", " PB", " P ", 'P', ANY_PLASTIC.ingot(), 'D', DURA.ingot(), 'R', DURA.bolt(), 'M', ModItems.motor, 'B', EnumBatteryPack.BATTERY_LEAD.stack() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.elec_axe, 1), new Object[] { " DP", "RRM", " PB", 'P', ANY_PLASTIC.ingot(), 'D', DURA.ingot(), 'R', DURA.bolt(), 'M', ModItems.motor, 'B', EnumBatteryPack.BATTERY_LEAD.stack() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.elec_shovel, 1), new Object[] { " P", "RRM", " B", 'P', ANY_PLASTIC.ingot(), 'D', DURA.ingot(), 'R', DURA.bolt(), 'M', ModItems.motor, 'B', EnumBatteryPack.BATTERY_LEAD.stack() });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.centri_stick, 1), new Object[] { ModItems.centrifuge_element, ModItems.energy_core, KEY_STICK });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.smashing_hammer, 1), new Object[] { "STS", "SPS", " P ", 'S', STEEL.block(), 'T', W.block(), 'P', ANY_PLASTIC.ingot() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.meteorite_sword, 1), new Object[] { " B", "GB ", "SG ", 'B', ModItems.blade_meteorite, 'G', GOLD.plate(), 'S', KEY_STICK });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.dwarven_pickaxe, 1), new Object[] { "CIC", " S ", " S ", 'C', CU.ingot(), 'I', IRON.ingot(), 'S', KEY_STICK });
|
||||
|
||||
//Super pickaxes
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.bismuth_pickaxe, 1), new Object[] { " BM", "BPB", "TB ", 'B', ModItems.ingot_bismuth, 'M', ModItems.ingot_meteorite, 'P', ModItems.starmetal_pickaxe, 'T', W.bolt() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.bismuth_pickaxe, 1), new Object[] { " BM", "BPB", "TB ", 'B', BI.ingot(), 'M', ModItems.ingot_meteorite, 'P', ModItems.starmetal_pickaxe, 'T', W.bolt() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.volcanic_pickaxe, 1), new Object[] { " BM", "BPB", "TB ", 'B', ModItems.gem_volcanic, 'M', ModItems.ingot_meteorite, 'P', ModItems.starmetal_pickaxe, 'T', W.bolt() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.chlorophyte_pickaxe, 1), new Object[] { " SD", "APS", "FA ", 'S', ModItems.blades_steel, 'D', ModItems.powder_chlorophyte, 'A', FIBER.ingot(), 'P', ModItems.bismuth_pickaxe, 'F', DURA.bolt() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.chlorophyte_pickaxe, 1), new Object[] { " SD", "APS", "FA ", 'S', ModItems.blades_steel, 'D', ModItems.powder_chlorophyte, 'A', FIBER.ingot(), 'P', ModItems.volcanic_pickaxe, 'F', DURA.bolt() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.mese_pickaxe, 1), new Object[] { " SD", "APS", "FA ", 'S', ModItems.blades_desh, 'D', ModItems.powder_dineutronium, 'A', ModItems.plate_paa, 'P', ModItems.chlorophyte_pickaxe, 'F', ModItems.shimmer_handle });
|
||||
|
||||
//Super Axes
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.bismuth_axe, 1), new Object[] { " BM", "BPB", "TB ", 'B', ModItems.ingot_bismuth, 'M', ModItems.ingot_meteorite, 'P', ModItems.starmetal_axe, 'T', W.bolt() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.bismuth_axe, 1), new Object[] { " BM", "BPB", "TB ", 'B', BI.ingot(), 'M', ModItems.ingot_meteorite, 'P', ModItems.starmetal_axe, 'T', W.bolt() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.volcanic_axe, 1), new Object[] { " BM", "BPB", "TB ", 'B', ModItems.gem_volcanic, 'M', ModItems.ingot_meteorite, 'P', ModItems.starmetal_axe, 'T', W.bolt() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.chlorophyte_axe, 1), new Object[] { " SD", "APS", "FA ", 'S', ModItems.blades_steel, 'D', ModItems.powder_chlorophyte, 'A', FIBER.ingot(), 'P', ModItems.bismuth_axe, 'F', DURA.bolt() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.chlorophyte_axe, 1), new Object[] { " SD", "APS", "FA ", 'S', ModItems.blades_steel, 'D', ModItems.powder_chlorophyte, 'A', FIBER.ingot(), 'P', ModItems.volcanic_axe, 'F', DURA.bolt() });
|
||||
@ -111,7 +110,7 @@ public class ToolRecipes {
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.oil_detector, 1), new Object[] { "W I", "WCI", "PPP", 'W', GOLD.wireFine(), 'I', CU.ingot(), 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ANALOG), 'P', STEEL.plate() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.turret_chip, 1), new Object[] { "WWW", "CPC", "WWW", 'W', GOLD.wireFine(), 'P', ANY_PLASTIC.ingot(), 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED), });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.survey_scanner, 1), new Object[] { "SWS", " G ", "PCP", 'W', GOLD.wireFine(), 'P', ANY_PLASTIC.ingot(), 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED), 'S', STEEL.plate(), 'G', GOLD.ingot() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.geiger_counter, 1), new Object[] { "GPP", "WCS", "WBB", 'W', GOLD.wireFine(), 'P', ANY_RUBBER.ingot(), 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.BASIC), 'G', GOLD.ingot(), 'S', STEEL.plate(), 'B', ModItems.ingot_beryllium });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.geiger_counter, 1), new Object[] { "GPP", "WCS", "WBB", 'W', GOLD.wireFine(), 'P', ANY_RUBBER.ingot(), 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.BASIC), 'G', GOLD.ingot(), 'S', STEEL.plate(), 'B', BE.ingot() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.dosimeter, 1), new Object[] { "WGW", "WCW", "WBW", 'W', KEY_PLANKS, 'G', KEY_ANYPANE, 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.VACUUM_TUBE), 'B', BE.ingot() });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModBlocks.geiger), new Object[] { ModItems.geiger_counter });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.digamma_diagnostic), new Object[] { ModItems.geiger_counter, PO210.billet(), ASBESTOS.ingot() });
|
||||
|
||||
@ -1,5 +1,9 @@
|
||||
package com.hbm.entity.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.explosion.vanillant.ExplosionVNT;
|
||||
import com.hbm.explosion.vanillant.standard.ExplosionEffectTiny;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
|
||||
@ -76,6 +80,21 @@ public abstract class EntityMovingConveyorObject extends Entity {
|
||||
if(this.ticksExisted <= 5) {
|
||||
return;
|
||||
}
|
||||
|
||||
// cram check every 20s
|
||||
if((ticksExisted + this.getEntityId()) % 400 == 0) {
|
||||
List<EntityMovingConveyorObject> objs = worldObj.getEntitiesWithinAABB(EntityMovingConveyorObject.class, this.boundingBox.expand(0.125, 0.125, 0.125));
|
||||
if(objs.size() >= 25) {
|
||||
for(EntityMovingConveyorObject obj : objs) obj.setDead();
|
||||
ExplosionVNT vnt = new ExplosionVNT(worldObj, posX, posY + 0.125, posZ, 1, this);
|
||||
vnt.setSFX(new ExplosionEffectTiny());
|
||||
vnt.explode();
|
||||
int x = (int) Math.floor(posX);
|
||||
int y = (int) Math.floor(posY);
|
||||
int z = (int) Math.floor(posZ);
|
||||
if(worldObj.getBlock(x, y, z) instanceof IConveyorBelt) worldObj.func_147480_a(x, y, z, false);
|
||||
}
|
||||
}
|
||||
|
||||
int blockX = (int) Math.floor(posX);
|
||||
int blockY = (int) Math.floor(posY);
|
||||
|
||||
@ -122,6 +122,7 @@ public class EntityMovingItem extends EntityMovingConveyorObject implements ICon
|
||||
|
||||
this.setDead();
|
||||
EntityItem item = new EntityItem(worldObj, posX + motionX * 2, posY + motionY * 2, posZ + motionZ * 2, this.getItemStack());
|
||||
item.lifespan = 60 * 20;
|
||||
item.motionX = this.motionX * 2;
|
||||
item.motionY = 0.1;
|
||||
item.motionZ = this.motionZ * 2;
|
||||
|
||||
@ -160,9 +160,7 @@ public class EntityFBI extends EntityMob implements IRangedAttackMob {
|
||||
canDestroy.add(ModBlocks.crate_iron);
|
||||
canDestroy.add(ModBlocks.crate_steel);
|
||||
canDestroy.add(ModBlocks.machine_diesel);
|
||||
canDestroy.add(ModBlocks.machine_rtg_grey);
|
||||
canDestroy.add(ModBlocks.machine_minirtg);
|
||||
canDestroy.add(ModBlocks.machine_powerrtg);
|
||||
canDestroy.add(ModBlocks.machine_rtg);
|
||||
canDestroy.add(ModBlocks.machine_cyclotron);
|
||||
canDestroy.add(Blocks.chest);
|
||||
canDestroy.add(Blocks.trapped_chest);
|
||||
|
||||
@ -92,25 +92,18 @@ public class EntityMaskMan extends EntityMob implements IBossDisplayData, IRadia
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeath(DamageSource p_70645_1_) {
|
||||
super.onDeath(p_70645_1_);
|
||||
public void onDeath(DamageSource source) {
|
||||
super.onDeath(source);
|
||||
|
||||
List<EntityPlayer> players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, this.boundingBox.expand(50, 50, 50));
|
||||
List<EntityPlayer> players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, this.boundingBox.expand(100, 100, 100));
|
||||
|
||||
for(EntityPlayer player : players) {
|
||||
player.triggerAchievement(MainRegistry.bossMaskman);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAIEnabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canDespawn() {
|
||||
return false;
|
||||
}
|
||||
@Override public boolean isAIEnabled() { return true; }
|
||||
@Override protected boolean canDespawn() { return false; }
|
||||
|
||||
@Override
|
||||
protected void dropFewItems(boolean bool, int i) {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package com.hbm.entity.mob.ai;
|
||||
|
||||
import com.hbm.entity.projectile.EntityBulletBaseNT;
|
||||
import com.hbm.handler.BulletConfigSyncingUtil;
|
||||
import com.hbm.entity.projectile.EntityBulletBaseMK4;
|
||||
import com.hbm.items.weapon.sedna.factory.XFactory762mm;
|
||||
|
||||
import net.minecraft.entity.EntityCreature;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@ -9,51 +9,51 @@ import net.minecraft.entity.ai.EntityAIBase;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
public class EntityAIMaskmanMinigun extends EntityAIBase {
|
||||
|
||||
|
||||
private EntityCreature owner;
|
||||
private EntityLivingBase target;
|
||||
int delay;
|
||||
int timer;
|
||||
private EntityLivingBase target;
|
||||
int delay;
|
||||
int timer;
|
||||
|
||||
public EntityAIMaskmanMinigun(EntityCreature owner, boolean checkSight, boolean nearbyOnly, int delay) {
|
||||
this.owner = owner;
|
||||
this.delay = delay;
|
||||
timer = delay;
|
||||
this.timer = delay;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldExecute() {
|
||||
|
||||
EntityLivingBase entity = this.owner.getAttackTarget();
|
||||
|
||||
if(entity == null) {
|
||||
return false;
|
||||
|
||||
} else {
|
||||
this.target = entity;
|
||||
double dist = Vec3.createVectorHelper(target.posX - owner.posX, target.posY - owner.posY, target.posZ - owner.posZ).lengthVector();
|
||||
return dist > 5 && dist < 10;
|
||||
}
|
||||
EntityLivingBase entity = this.owner.getAttackTarget();
|
||||
|
||||
if(entity == null || !entity.isEntityAlive()) {
|
||||
return false;
|
||||
} else {
|
||||
this.target = entity;
|
||||
double dist = Vec3.createVectorHelper(target.posX - owner.posX, target.posY - owner.posY, target.posZ - owner.posZ).lengthVector();
|
||||
return dist > 5 && dist < 10;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean continueExecuting() {
|
||||
return this.shouldExecute() || !this.owner.getNavigator().noPath();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTask() {
|
||||
|
||||
public boolean continueExecuting() {
|
||||
return this.shouldExecute() || !this.owner.getNavigator().noPath();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTask() {
|
||||
|
||||
timer--;
|
||||
|
||||
|
||||
// TEST
|
||||
if(target != null) this.owner.getLookHelper().setLookPositionWithEntity(this.target, 15F, 15F);
|
||||
|
||||
if(timer <= 0) {
|
||||
timer = delay;
|
||||
|
||||
EntityBulletBaseNT bullet = new EntityBulletBaseNT(owner.worldObj, BulletConfigSyncingUtil.MASKMAN_BULLET, owner, target, 1.0F, 0);
|
||||
EntityBulletBaseMK4 bullet = new EntityBulletBaseMK4(this.owner, XFactory762mm.r762_fmj, 5F, 0.075F, -1.5, -1.5, 0);
|
||||
owner.worldObj.spawnEntityInWorld(bullet);
|
||||
owner.playSound("hbm:weapon.calShoot", 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
this.owner.rotationYaw = this.owner.rotationYawHead;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -223,6 +223,13 @@ public class EntityGlyphid extends EntityMob implements IResistanceProvider {
|
||||
@Override
|
||||
protected void updateEntityActionState() {
|
||||
super.updateEntityActionState();
|
||||
|
||||
// re-scan for new targets every so often
|
||||
// every third glyphid does not do this, so you cannot "juggle" hordes on purpose
|
||||
if(this.getEntityId() % 3 > 0 && (this.getEntityId() + this.ticksExisted) % 100 == 0) {
|
||||
Entity newTarget = this.findPlayerToAttack();
|
||||
if(newTarget != null) this.setTarget(newTarget);
|
||||
}
|
||||
|
||||
if(!this.isPotionActive(Potion.blindness)) {
|
||||
if (!this.hasPath()) {
|
||||
|
||||
@ -5,12 +5,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.bomb.BlockDetonatable;
|
||||
import com.hbm.entity.effect.EntityCloudFleijaRainbow;
|
||||
import com.hbm.entity.effect.EntityEMPBlast;
|
||||
import com.hbm.entity.logic.EntityNukeExplosionMK3;
|
||||
import com.hbm.entity.logic.EntityNukeExplosionMK5;
|
||||
import com.hbm.explosion.ExplosionLarge;
|
||||
import com.hbm.explosion.ExplosionNukeGeneric;
|
||||
import com.hbm.explosion.vanillant.ExplosionVNT;
|
||||
import com.hbm.explosion.vanillant.standard.BlockAllocatorStandard;
|
||||
import com.hbm.explosion.vanillant.standard.BlockMutatorFire;
|
||||
@ -25,7 +19,6 @@ import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.potion.HbmPotion;
|
||||
import com.hbm.util.ArmorUtil;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.Tuple.Pair;
|
||||
|
||||
@ -34,7 +27,6 @@ import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
@ -182,29 +174,6 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
return;
|
||||
}
|
||||
|
||||
if(worldObj.isRemote && config.style == BulletConfiguration.STYLE_TAU) {
|
||||
if(trailNodes.isEmpty()) {
|
||||
this.ignoreFrustumCheck = true;
|
||||
trailNodes.add(new Pair<Vec3, Double>(Vec3.createVectorHelper(-motionX * 2, -motionY * 2, -motionZ * 2), 0D));
|
||||
} else {
|
||||
trailNodes.add(new Pair<Vec3, Double>(Vec3.createVectorHelper(0, 0, 0), 1D));
|
||||
}
|
||||
}
|
||||
|
||||
if(worldObj.isRemote && this.config.blackPowder && this.ticksExisted == 1) {
|
||||
|
||||
for(int i = 0; i < 15; i++) {
|
||||
double mod = rand.nextDouble();
|
||||
this.worldObj.spawnParticle("smoke", this.posX, this.posY, this.posZ,
|
||||
(this.motionX + rand.nextGaussian() * 0.05) * mod,
|
||||
(this.motionY + rand.nextGaussian() * 0.05) * mod,
|
||||
(this.motionZ + rand.nextGaussian() * 0.05) * mod);
|
||||
}
|
||||
|
||||
double mod = 0.5;
|
||||
this.worldObj.spawnParticle("flame", this.posX + this.motionX * mod, this.posY + this.motionY * mod, this.posZ + this.motionZ * mod, 0, 0, 0);
|
||||
}
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
if(config.maxAge == 0) {
|
||||
@ -251,7 +220,7 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
boolean hRic = rand.nextInt(100) < config.HBRC;
|
||||
boolean doesRic = config.doesRicochet && hRic;
|
||||
|
||||
if(!config.isSpectral && !doesRic) {
|
||||
if(!doesRic) {
|
||||
this.setPosition(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord);
|
||||
this.onBlockImpact(mop.blockX, mop.blockY, mop.blockZ, mop.sideHit);
|
||||
}
|
||||
@ -293,7 +262,6 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
worldObj.playSoundAtEntity(this, "hbm:weapon.gBounce", 1.0F, 1.0F);
|
||||
|
||||
this.setPosition(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord);
|
||||
onRicochet(mop.blockX, mop.blockY, mop.blockZ);
|
||||
|
||||
//worldObj.setBlock((int) Math.floor(posX), (int) Math.floor(posY), (int) Math.floor(posZ), Blocks.dirt);
|
||||
|
||||
@ -304,10 +272,6 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
}
|
||||
}
|
||||
|
||||
/*this.posX += (mop.hitVec.xCoord - this.posX) * 0.6;
|
||||
this.posY += (mop.hitVec.yCoord - this.posY) * 0.6;
|
||||
this.posZ += (mop.hitVec.zCoord - this.posZ) * 0.6;*/
|
||||
|
||||
this.motionX *= config.bounceMod;
|
||||
this.motionY *= config.bounceMod;
|
||||
this.motionZ *= config.bounceMod;
|
||||
@ -380,7 +344,7 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
config.bntImpact.behaveBlockHit(this, bX, bY, bZ, sideHit);
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
if(!config.liveAfterImpact && !config.isSpectral && bY > -1 && !this.inGround) this.setDead();
|
||||
if(bY > -1 && !this.inGround) this.setDead();
|
||||
if(!config.doesPenetrate && bY == -1) this.setDead();
|
||||
}
|
||||
|
||||
@ -394,24 +358,6 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
if(worldObj.rand.nextInt(3) == 0 && worldObj.getBlock((int)posX, (int)posY, (int)posZ - 1) == Blocks.air) worldObj.setBlock((int)posX, (int)posY, (int)posZ - 1, Blocks.fire);
|
||||
}
|
||||
|
||||
if(config.emp > 0)
|
||||
ExplosionNukeGeneric.empBlast(this.worldObj, (int)(this.posX + 0.5D), (int)(this.posY + 0.5D), (int)(this.posZ + 0.5D), config.emp);
|
||||
|
||||
if(config.emp > 3) {
|
||||
if (!this.worldObj.isRemote) {
|
||||
|
||||
EntityEMPBlast cloud = new EntityEMPBlast(this.worldObj, config.emp);
|
||||
cloud.posX = this.posX;
|
||||
cloud.posY = this.posY + 0.5F;
|
||||
cloud.posZ = this.posZ;
|
||||
|
||||
this.worldObj.spawnEntityInWorld(cloud);
|
||||
}
|
||||
}
|
||||
|
||||
if(config.jolt > 0 && !worldObj.isRemote)
|
||||
ExplosionLarge.jolt(worldObj, posX, posY, posZ, config.jolt, 150, 0.25);
|
||||
|
||||
if(config.explosive > 0 && !worldObj.isRemote) {
|
||||
//worldObj.newExplosion(this.thrower, posX, posY, posZ, config.explosive, config.incendiary > 0, config.blockDamage);
|
||||
ExplosionVNT vnt = new ExplosionVNT(worldObj, posX, posY, posZ, config.explosive, this.thrower);
|
||||
@ -424,32 +370,6 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
vnt.explode();
|
||||
}
|
||||
|
||||
if(config.shrapnel > 0 && !worldObj.isRemote)
|
||||
ExplosionLarge.spawnShrapnels(worldObj, posX, posY, posZ, config.shrapnel);
|
||||
|
||||
if(config.rainbow > 0 && !worldObj.isRemote) {
|
||||
EntityNukeExplosionMK3 ex = EntityNukeExplosionMK3.statFacFleija(worldObj, posX, posY, posZ, config.rainbow);
|
||||
if(!ex.isDead) {
|
||||
this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "random.explode", 100.0f, this.worldObj.rand.nextFloat() * 0.1F + 0.9F);
|
||||
worldObj.spawnEntityInWorld(ex);
|
||||
|
||||
EntityCloudFleijaRainbow cloud = new EntityCloudFleijaRainbow(this.worldObj, config.rainbow);
|
||||
cloud.posX = this.posX;
|
||||
cloud.posY = this.posY;
|
||||
cloud.posZ = this.posZ;
|
||||
this.worldObj.spawnEntityInWorld(cloud);
|
||||
}
|
||||
}
|
||||
|
||||
if(config.nuke > 0 && !worldObj.isRemote) {
|
||||
worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(worldObj, config.nuke, posX, posY, posZ));
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "muke");
|
||||
if(MainRegistry.polaroidID == 11 || rand.nextInt(100) == 0) data.setBoolean("balefire", true);
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, posX, posY + 0.5, posZ), new TargetPoint(dimension, posX, posY, posZ, 250));
|
||||
worldObj.playSoundEffect(posX, posY, posZ, "hbm:weapon.mukeExplosion", 15.0F, 1.0F);
|
||||
}
|
||||
|
||||
if(config.destroysBlocks && !worldObj.isRemote) {
|
||||
if(block.getBlockHardness(worldObj, bX, bY, bZ) <= 120)
|
||||
worldObj.func_147480_a(bX, bY, bZ, false);
|
||||
@ -463,30 +383,15 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
}
|
||||
}
|
||||
|
||||
//for when a bullet dies by hitting a block
|
||||
private void onRicochet(int bX, int bY, int bZ) {
|
||||
|
||||
if(config.bntRicochet != null)
|
||||
config.bntRicochet.behaveBlockRicochet(this, bX, bY, bZ);
|
||||
}
|
||||
|
||||
//for when a bullet dies by hitting an entity
|
||||
private void onEntityImpact(Entity e) {
|
||||
onEntityHurt(e);
|
||||
onBlockImpact(-1, -1, -1, -1);
|
||||
|
||||
if(config.bntHit != null)
|
||||
config.bntHit.behaveEntityHit(this, e);
|
||||
|
||||
//this.setDead();
|
||||
}
|
||||
|
||||
//for when a bullet hurts an entity, not necessarily dying
|
||||
private void onEntityHurt(Entity e) {
|
||||
|
||||
if(config.bntHurt != null)
|
||||
config.bntHurt.behaveEntityHurt(this, e);
|
||||
|
||||
if(config.incendiary > 0 && !worldObj.isRemote) {
|
||||
e.setFire(config.incendiary);
|
||||
}
|
||||
@ -501,19 +406,6 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
((EntityLivingBase)e).addPotionEffect(new PotionEffect(effect));
|
||||
}
|
||||
}
|
||||
|
||||
if(config.instakill && e instanceof EntityLivingBase && !worldObj.isRemote) {
|
||||
|
||||
if(!(e instanceof EntityPlayer && ((EntityPlayer)e).capabilities.isCreativeMode))
|
||||
((EntityLivingBase)e).setHealth(0.0F);
|
||||
}
|
||||
|
||||
if(config.caustic > 0 && e instanceof EntityPlayer){
|
||||
ArmorUtil.damageSuit((EntityPlayer)e, 0, config.caustic);
|
||||
ArmorUtil.damageSuit((EntityPlayer)e, 1, config.caustic);
|
||||
ArmorUtil.damageSuit((EntityPlayer)e, 2, config.caustic);
|
||||
ArmorUtil.damageSuit((EntityPlayer)e, 3, config.caustic);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -521,11 +413,6 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
return this.config.doesPenetrate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSpectral() {
|
||||
return this.config.isSpectral;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int selfDamageDelay() {
|
||||
return this.config.selfDamageDelay;
|
||||
|
||||
@ -127,53 +127,4 @@ public class ExplosionBalefire
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*private void breakColumn(int x, int z)
|
||||
{
|
||||
int dist = this.radius2 - (x * x + z * z);
|
||||
if (dist > 0)
|
||||
{
|
||||
int pX = posX + x;
|
||||
int pZ = posZ + z;
|
||||
|
||||
int y = worldObj.getHeightValue(pX, pZ);
|
||||
float strength = (float)dist / (float) this.radius;
|
||||
|
||||
while(y > 0) {
|
||||
|
||||
if(strength <= 10) {
|
||||
if(worldObj.rand.nextInt(10) == 0) {
|
||||
worldObj.setBlock(pX, y + 1, pZ, ModBlocks.balefire);
|
||||
|
||||
if(worldObj.getBlock(pX, y, pZ) == ModBlocks.block_schrabidium_cluster)
|
||||
worldObj.setBlock(pX, y, pZ, ModBlocks.block_euphemium_cluster, worldObj.getBlockMetadata(pX, y, pZ), 3);
|
||||
}
|
||||
|
||||
if(worldObj.getBlock(pX, y, pZ) == Blocks.stone)
|
||||
worldObj.setBlock(pX, y, pZ, ModBlocks.sellafield_slaked);
|
||||
if(worldObj.getBlock(pX, y - 1, pZ) == Blocks.stone)
|
||||
worldObj.setBlock(pX, y - 1, pZ, ModBlocks.sellafield_slaked);
|
||||
if(worldObj.getBlock(pX, y - 2, pZ) == Blocks.stone)
|
||||
worldObj.setBlock(pX, y - 2, pZ, ModBlocks.sellafield_slaked);
|
||||
if(worldObj.getBlock(pX, y - 3, pZ) == Blocks.stone)
|
||||
worldObj.setBlock(pX, y - 3, pZ, ModBlocks.sellafield_slaked);
|
||||
if(worldObj.getBlock(pX, y - 4, pZ) == Blocks.stone)
|
||||
worldObj.setBlock(pX, y - 4, pZ, ModBlocks.sellafield_slaked);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
float hardness = worldObj.getBlock(pX, y, pZ).getBlockHardness(worldObj, pX, y, pZ);
|
||||
|
||||
if(worldObj.getBlock(pX, y, pZ).getMaterial().isLiquid())
|
||||
hardness = Blocks.air.getBlockHardness(worldObj, pX, y + 1, pZ);
|
||||
|
||||
strength -= hardness;
|
||||
|
||||
worldObj.setBlockToAir(pX, y, pZ);
|
||||
|
||||
y--;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@ -25,35 +25,43 @@ public class HbmPlayerProps implements IExtendedEntityProperties {
|
||||
public static final String key = "NTM_EXT_PLAYER";
|
||||
public EntityPlayer player;
|
||||
|
||||
public boolean hasReceivedBook = false;
|
||||
|
||||
/* Toggles for keybind */
|
||||
public boolean enableHUD = true;
|
||||
public boolean enableBackpack = true;
|
||||
public boolean enableMagnet = true;
|
||||
|
||||
/** Keybind tracking */
|
||||
private boolean[] keysPressed = new boolean[EnumKeybind.values().length];
|
||||
|
||||
|
||||
/* Dashes for bismuth armor/cloud in a bottle */
|
||||
public boolean dashActivated = true;
|
||||
|
||||
public static final int dashCooldownLength = 5;
|
||||
public int dashCooldown = 0;
|
||||
|
||||
public int totalDashCount = 0;
|
||||
public int stamina = 0;
|
||||
public static final int dashCooldownLength = 5;
|
||||
|
||||
public static final int plinkCooldownLength = 10;
|
||||
/** Cooldown for armor plinking noise when canceling damage */
|
||||
public int plinkCooldown = 0;
|
||||
public static final int plinkCooldownLength = 10;
|
||||
|
||||
/** Shield infusion */
|
||||
public float shield = 0;
|
||||
public float maxShield = 0;
|
||||
public int lastDamage = 0;
|
||||
public static final float shieldCap = 100;
|
||||
|
||||
/** Latnern repair/destroy count */
|
||||
public int reputation;
|
||||
|
||||
/** Hack for allowing ladders on multiblocks */
|
||||
public boolean isOnLadder = false;
|
||||
|
||||
/** Pulling the pin on a grenade - it's a player prop instead of an NBT trait */
|
||||
public int grenadeDeployment;
|
||||
|
||||
/** Maskman timer */
|
||||
public int maskManTimer = 0;
|
||||
|
||||
public HbmPlayerProps(EntityPlayer player) {
|
||||
this.player = player;
|
||||
@ -187,7 +195,6 @@ public class HbmPlayerProps implements IExtendedEntityProperties {
|
||||
public void init(Entity entity, World world) { }
|
||||
|
||||
public void serialize(ByteBuf buf) {
|
||||
buf.writeBoolean(this.hasReceivedBook);
|
||||
buf.writeFloat(this.shield);
|
||||
buf.writeFloat(this.maxShield);
|
||||
buf.writeBoolean(this.enableBackpack);
|
||||
@ -199,7 +206,6 @@ public class HbmPlayerProps implements IExtendedEntityProperties {
|
||||
|
||||
public void deserialize(ByteBuf buf) {
|
||||
if(buf.readableBytes() > 0) {
|
||||
this.hasReceivedBook = buf.readBoolean();
|
||||
this.shield = buf.readFloat();
|
||||
this.maxShield = buf.readFloat();
|
||||
this.enableBackpack = buf.readBoolean();
|
||||
@ -216,7 +222,6 @@ public class HbmPlayerProps implements IExtendedEntityProperties {
|
||||
|
||||
NBTTagCompound props = new NBTTagCompound();
|
||||
|
||||
props.setBoolean("hasReceivedBook", hasReceivedBook);
|
||||
props.setFloat("shield", shield);
|
||||
props.setFloat("maxShield", maxShield);
|
||||
props.setBoolean("enableBackpack", enableBackpack);
|
||||
@ -224,6 +229,7 @@ public class HbmPlayerProps implements IExtendedEntityProperties {
|
||||
props.setBoolean("enableHUD", enableHUD);
|
||||
props.setInteger("reputation", reputation);
|
||||
props.setBoolean("isOnLadder", isOnLadder);
|
||||
props.setInteger("maskManTimer", maskManTimer);
|
||||
|
||||
nbt.setTag("HbmPlayerProps", props);
|
||||
}
|
||||
@ -235,7 +241,6 @@ public class HbmPlayerProps implements IExtendedEntityProperties {
|
||||
NBTTagCompound props = (NBTTagCompound) nbt.getTag("HbmPlayerProps");
|
||||
|
||||
if(props != null) {
|
||||
this.hasReceivedBook = props.getBoolean("hasReceivedBook");
|
||||
this.shield = props.getFloat("shield");
|
||||
this.maxShield = props.getFloat("maxShield");
|
||||
this.enableBackpack = props.getBoolean("enableBackpack");
|
||||
@ -243,6 +248,7 @@ public class HbmPlayerProps implements IExtendedEntityProperties {
|
||||
this.enableHUD = props.getBoolean("enableHUD");
|
||||
this.reputation = props.getInteger("reputation");
|
||||
this.isOnLadder = props.getBoolean("isOnLadder");
|
||||
this.maskManTimer = props.getInteger("maskManTimer");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,12 @@
|
||||
package com.hbm.handler;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.blocks.generic.BlockPedestal;
|
||||
import com.hbm.blocks.generic.BlockPedestal.PedestalEntry;
|
||||
import com.hbm.blocks.generic.BlockPedestal.PedestalEntryType;
|
||||
import com.hbm.config.GeneralConfig;
|
||||
import com.hbm.config.MobConfig;
|
||||
import com.hbm.config.WorldConfig;
|
||||
@ -13,6 +17,7 @@ import com.hbm.entity.mob.EntityMaskMan;
|
||||
import com.hbm.entity.mob.EntityRADBeast;
|
||||
import com.hbm.entity.projectile.EntityMeteor;
|
||||
import com.hbm.extprop.HbmLivingProps;
|
||||
import com.hbm.extprop.HbmPlayerProps;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.util.ContaminationUtil;
|
||||
@ -29,6 +34,7 @@ import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.ChatStyle;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.EnumDifficulty;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.ForgeEventFactory;
|
||||
|
||||
@ -40,38 +46,49 @@ public class BossSpawnHandler {
|
||||
public static void rollTheDice(World world) {
|
||||
|
||||
/*
|
||||
* Spawns every 3 hours with a 33% chance if
|
||||
* Spawns every 20 minutes if
|
||||
* - the player is 3 blocks below the surface
|
||||
* - the player has at least 50 RAD
|
||||
* - the player has either crafted or placed an ore acidizer before
|
||||
*/
|
||||
if(MobConfig.enableMaskman) {
|
||||
|
||||
if(world.getTotalWorldTime() % MobConfig.maskmanDelay == 0) {
|
||||
|
||||
if(world.rand.nextInt(MobConfig.maskmanChance) == 0 && !world.playerEntities.isEmpty() && world.provider.isSurfaceWorld()) { //33% chance only if there is a player online
|
||||
|
||||
EntityPlayer player = (EntityPlayer) world.playerEntities.get(world.rand.nextInt(world.playerEntities.size())); //choose a random player
|
||||
int id = Item.getIdFromItem(Item.getItemFromBlock(ModBlocks.machine_crystallizer));
|
||||
|
||||
StatBase statCraft = StatList.objectCraftStats[id];
|
||||
StatBase statPlace = StatList.objectUseStats[id];
|
||||
|
||||
if(!(player instanceof EntityPlayerMP)) return;
|
||||
EntityPlayerMP playerMP = (EntityPlayerMP) player;
|
||||
|
||||
boolean acidizerStat = !GeneralConfig.enableStatReRegistering || (statCraft != null && playerMP.func_147099_x().writeStat(statCraft) > 0)|| (statPlace != null && playerMP.func_147099_x().writeStat(statPlace) > 0);
|
||||
|
||||
if(acidizerStat && ContaminationUtil.getRads(player) >= MobConfig.maskmanMinRad && (world.getHeightValue((int)player.posX, (int)player.posZ) > player.posY + 3 || !MobConfig.maskmanUnderground)) { //if the player has more than 50 RAD and is underground
|
||||
|
||||
player.addChatComponentMessage(new ChatComponentText("The mask man is about to claim another victim.").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED)));
|
||||
|
||||
if(MobConfig.enableMaskman && world.getTotalWorldTime() % 20 == 0 && world.provider.isSurfaceWorld() && world.difficultySetting != EnumDifficulty.PEACEFUL) {
|
||||
|
||||
for(Object o : world.playerEntities) {
|
||||
if(!(o instanceof EntityPlayerMP)) return;
|
||||
EntityPlayerMP player = (EntityPlayerMP) o;
|
||||
|
||||
int id = Item.getIdFromItem(Item.getItemFromBlock(ModBlocks.machine_crystallizer));
|
||||
StatBase statCraft = StatList.objectCraftStats[id];
|
||||
StatBase statPlace = StatList.objectUseStats[id];
|
||||
|
||||
boolean acidizerStat = !GeneralConfig.enableStatReRegistering || (statCraft != null && player.func_147099_x().writeStat(statCraft) > 0)|| (statPlace != null && player.func_147099_x().writeStat(statPlace) > 0);
|
||||
boolean hasRads = ContaminationUtil.getRads(player) >= MobConfig.maskmanMinRad;
|
||||
boolean underground = world.getHeightValue((int) Math.floor(player.posX), (int) Math.floor(player.posZ)) > player.posY + 3 || !MobConfig.maskmanUnderground;
|
||||
|
||||
if(acidizerStat && hasRads && underground) {
|
||||
HbmPlayerProps data = HbmPlayerProps.getData(player);
|
||||
|
||||
data.maskManTimer++;
|
||||
|
||||
if(data.maskManTimer == MobConfig.maskmanDelay - 60) {
|
||||
player.addChatComponentMessage(new ChatComponentText("The mask man draws near.").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED)));
|
||||
}
|
||||
|
||||
if(data.maskManTimer >= MobConfig.maskmanDelay) {
|
||||
data.maskManTimer = 0;
|
||||
|
||||
double spawnX = player.posX + world.rand.nextGaussian() * 20;
|
||||
double spawnZ = player.posZ + world.rand.nextGaussian() * 20;
|
||||
double spawnY = world.getHeightValue((int)spawnX, (int)spawnZ);
|
||||
|
||||
trySpawn(world, (float)spawnX, (float)spawnY, (float)spawnZ, new EntityMaskMan(world));
|
||||
double spawnY = world.getHeightValue((int) Math.floor(spawnX), (int) Math.floor(spawnZ));
|
||||
if(trySpawn(world, (float) spawnX, (float) spawnY, (float) spawnZ, new EntityMaskMan(world))) {
|
||||
player.addChatComponentMessage(new ChatComponentText("The mask man is about to claim another victim.").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED)));
|
||||
} else {
|
||||
player.addChatComponentMessage(new ChatComponentText("Seems like mask man couldn't come today.").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.BLUE)));
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
HbmPlayerProps.getData(player).maskManTimer = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -169,8 +186,7 @@ public class BossSpawnHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private static void trySpawn(World world, float x, float y, float z, EntityLiving e) {
|
||||
|
||||
private static boolean trySpawn(World world, float x, float y, float z, EntityLiving e) {
|
||||
e.setLocationAndAngles(x, y, z, world.rand.nextFloat() * 360.0F, 0.0F);
|
||||
Result canSpawn = ForgeEventFactory.canEntitySpawn(e, world, x, y, z);
|
||||
|
||||
@ -179,7 +195,10 @@ public class BossSpawnHandler {
|
||||
world.spawnEntityInWorld(e);
|
||||
ForgeEventFactory.doSpecialSpawn(e, world, x, y, z);
|
||||
e.onSpawnWithEgg(null);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void markFBI(EntityPlayer player) {
|
||||
@ -216,9 +235,22 @@ public class BossSpawnHandler {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// only check if either charm is not present
|
||||
if(!repell || strike) {
|
||||
int x = (int) Math.floor(p.posX);
|
||||
int z = (int) Math.floor(p.posZ);
|
||||
|
||||
List<PedestalEntry> entries = BlockPedestal.getEntriesForDimension(world.provider.dimensionId);
|
||||
if(entries != null) for(PedestalEntry entry : entries) {
|
||||
if(Math.abs(entry.pos.getX() - x) <= 100 && Math.abs(entry.pos.getZ() - z) <= 100) {
|
||||
if(entry.type == PedestalEntryType.CHARM_OF_PROTECTION) repell = true;
|
||||
if(entry.type == PedestalEntryType.METEORITE_CHARM) strike = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(strike)
|
||||
spawnMeteorAtPlayer(p, repell);
|
||||
if(strike) spawnMeteorAtPlayer(p, repell);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,7 +16,6 @@ public class BulletConfigSyncingUtil {
|
||||
|
||||
public static int TURBINE = i++;
|
||||
|
||||
public static int MASKMAN_BULLET = i++;
|
||||
public static int MASKMAN_ORB = i++;
|
||||
public static int MASKMAN_BOLT = i++;
|
||||
public static int MASKMAN_ROCKET = i++;
|
||||
@ -32,7 +31,6 @@ public class BulletConfigSyncingUtil {
|
||||
|
||||
configSet.put(TURBINE, GunEnergyFactory.getTurbineConfig());
|
||||
|
||||
configSet.put(MASKMAN_BULLET, GunNPCFactory.getMaskmanBullet());
|
||||
configSet.put(MASKMAN_ORB, GunNPCFactory.getMaskmanOrb());
|
||||
configSet.put(MASKMAN_BOLT, GunNPCFactory.getMaskmanBolt());
|
||||
configSet.put(MASKMAN_ROCKET, GunNPCFactory.getMaskmanRocket());
|
||||
|
||||
@ -4,32 +4,24 @@ import java.util.List;
|
||||
|
||||
import com.hbm.entity.projectile.EntityBulletBaseNT;
|
||||
import com.hbm.entity.projectile.EntityBulletBaseNT.*;
|
||||
import com.hbm.handler.guncfg.BulletConfigFactory;
|
||||
import com.hbm.inventory.RecipesCommon.ComparableStack;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.particle.SpentCasing;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EntityDamageSourceIndirect;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
@Deprecated
|
||||
public class BulletConfiguration implements Cloneable {
|
||||
|
||||
//what item this specific configuration consumes
|
||||
public ComparableStack ammo;
|
||||
//how many ammo units one item restores
|
||||
public int ammoCount = 1;
|
||||
//how fast the bullet is (in sanics per second, or sps)
|
||||
public float velocity;
|
||||
//spread of bullets in gaussian range
|
||||
public float spread;
|
||||
//weapon durability reduced (centered around 10)
|
||||
public int wear;
|
||||
//greatest amount of pellets created each shot
|
||||
public int bulletsMin;
|
||||
//least amount of pellets created each shot
|
||||
@ -60,39 +52,16 @@ public class BulletConfiguration implements Cloneable {
|
||||
|
||||
//whether or not the bullet should penetrate mobs
|
||||
public boolean doesPenetrate;
|
||||
//disables collisions with blocks entirely
|
||||
public boolean isSpectral;
|
||||
//whether or not the bullet should break glass
|
||||
public boolean doesBreakGlass;
|
||||
//bullets still call the impact function when hitting blocks but do not get destroyed
|
||||
public boolean liveAfterImpact;
|
||||
|
||||
//creates a "muzzle flash" and a ton of smoke with every projectile spawned
|
||||
public boolean blackPowder = false;
|
||||
|
||||
//bullet effects
|
||||
public List<PotionEffect> effects;
|
||||
public int incendiary;
|
||||
public int emp;
|
||||
public boolean blockDamage = true;
|
||||
public float explosive;
|
||||
public double jolt;
|
||||
public int rainbow;
|
||||
public int nuke;
|
||||
public int shrapnel;
|
||||
public int chlorine;
|
||||
public int leadChance;
|
||||
public int caustic;
|
||||
public boolean destroysBlocks;
|
||||
public boolean instakill;
|
||||
/*public IBulletHurtBehavior bHurt;
|
||||
public IBulletHitBehavior bHit;
|
||||
public IBulletRicochetBehavior bRicochet;
|
||||
public IBulletImpactBehavior bImpact;
|
||||
public IBulletUpdateBehavior bUpdate;*/
|
||||
public IBulletHurtBehaviorNT bntHurt;
|
||||
public IBulletHitBehaviorNT bntHit;
|
||||
public IBulletRicochetBehaviorNT bntRicochet;
|
||||
public IBulletImpactBehaviorNT bntImpact;
|
||||
public IBulletUpdateBehaviorNT bntUpdate;
|
||||
|
||||
@ -104,17 +73,6 @@ public class BulletConfiguration implements Cloneable {
|
||||
public int plink;
|
||||
//vanilla particle FX
|
||||
public String vPFX = "";
|
||||
public SpentCasing spentCasing;
|
||||
|
||||
//energy projectiles
|
||||
//power consumed per shot
|
||||
public int dischargePerShot;
|
||||
//unlocalised firing mode name
|
||||
public String modeName;
|
||||
//firing mode text colour
|
||||
public EnumChatFormatting chatColour = EnumChatFormatting.WHITE;
|
||||
//firing rate
|
||||
public int firingRate;
|
||||
|
||||
public String damageType = ModDamageSource.s_bullet;
|
||||
public boolean dmgProj = true;
|
||||
@ -122,23 +80,14 @@ public class BulletConfiguration implements Cloneable {
|
||||
public boolean dmgExplosion = false;
|
||||
public boolean dmgBypass = false;
|
||||
|
||||
public static final int STYLE_NONE = -1;
|
||||
public static final int STYLE_NORMAL = 0;
|
||||
public static final int STYLE_PISTOL = 1;
|
||||
public static final int STYLE_FLECHETTE = 2;
|
||||
public static final int STYLE_PELLET = 3;
|
||||
public static final int STYLE_BOLT = 4;
|
||||
public static final int STYLE_FOLLY = 5;
|
||||
public static final int STYLE_ROCKET = 6;
|
||||
public static final int STYLE_STINGER = 7;
|
||||
public static final int STYLE_GRENADE = 10;
|
||||
public static final int STYLE_BF = 11;
|
||||
public static final int STYLE_ORB = 12;
|
||||
public static final int STYLE_METEOR = 13;
|
||||
public static final int STYLE_APDS = 14;
|
||||
public static final int STYLE_BLADE = 15;
|
||||
public static final int STYLE_TAU = 17;
|
||||
public static final int STYLE_LEADBURSTER = 18;
|
||||
|
||||
public static final int PLINK_NONE = 0;
|
||||
public static final int PLINK_BULLET = 1;
|
||||
@ -149,10 +98,7 @@ public class BulletConfiguration implements Cloneable {
|
||||
public static final int BOLT_LACUNAE = 0;
|
||||
public static final int BOLT_NIGHTMARE = 1;
|
||||
public static final int BOLT_LASER = 2;
|
||||
public static final int BOLT_ZOMG = 3;
|
||||
public static final int BOLT_WORM = 4;
|
||||
public static final int BOLT_GLASS_CYAN = 5;
|
||||
public static final int BOLT_GLASS_BLUE = 6;
|
||||
|
||||
public BulletConfiguration setToBolt(int trail) {
|
||||
|
||||
@ -172,37 +118,6 @@ public class BulletConfiguration implements Cloneable {
|
||||
return this;
|
||||
}
|
||||
|
||||
public BulletConfiguration getChlorophyte() {
|
||||
this.bntUpdate = BulletConfigFactory.getHomingBehavior(30, 180);
|
||||
this.bntHurt = BulletConfigFactory.getPenHomingBehavior();
|
||||
this.dmgMin *= 2F;
|
||||
this.dmgMax *= 2F;
|
||||
this.wear *= 0.5;
|
||||
this.velocity *= 0.3;
|
||||
this.doesRicochet = false;
|
||||
this.doesPenetrate = true;
|
||||
this.vPFX = "greendust";
|
||||
|
||||
if(this.spentCasing != null) {
|
||||
int[] colors = this.spentCasing.getColors();
|
||||
this.spentCasing = this.spentCasing.clone();
|
||||
|
||||
if(colors != null && colors.length > 0) {
|
||||
int[] colorClone = new int[colors.length];
|
||||
for(int i = 0; i < colors.length; i++) colorClone[i] = colors[i];
|
||||
colorClone[colorClone.length - 1] = 0x659750; // <- standard chlorophyte coloring in last place
|
||||
this.spentCasing.setColor(colorClone).register(this.spentCasing.getName() + "Cl");
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public BulletConfiguration setToHoming(ItemStack ammo) {
|
||||
this.ammo = new ComparableStack(ammo);
|
||||
return getChlorophyte();
|
||||
}
|
||||
|
||||
public BulletConfiguration accuracyMod(float mod) {
|
||||
|
||||
this.spread *= mod;
|
||||
|
||||
@ -23,7 +23,6 @@ public class BulletConfigFactory {
|
||||
|
||||
bullet.velocity = 5.0F;
|
||||
bullet.spread = defaultSpread;
|
||||
bullet.wear = 10;
|
||||
bullet.bulletsMin = 1;
|
||||
bullet.bulletsMax = 1;
|
||||
bullet.gravity = 0D;
|
||||
@ -49,7 +48,6 @@ public class BulletConfigFactory {
|
||||
|
||||
bullet.velocity = 2.0F;
|
||||
bullet.spread = defaultSpread;
|
||||
bullet.wear = 10;
|
||||
bullet.bulletsMin = 1;
|
||||
bullet.bulletsMax = 1;
|
||||
bullet.gravity = 0.005D;
|
||||
@ -75,7 +73,6 @@ public class BulletConfigFactory {
|
||||
|
||||
bullet.velocity = 2.0F;
|
||||
bullet.spread = defaultSpread;
|
||||
bullet.wear = 10;
|
||||
bullet.bulletsMin = 1;
|
||||
bullet.bulletsMax = 1;
|
||||
bullet.gravity = 0.035D;
|
||||
|
||||
@ -33,7 +33,6 @@ public class GunNPCFactory {
|
||||
bullet.ammo = new ComparableStack(ModItems.coin_maskman);
|
||||
bullet.velocity = 0.25F;
|
||||
bullet.spread = 0.000F;
|
||||
bullet.wear = 10;
|
||||
bullet.bulletsMin = 1;
|
||||
bullet.bulletsMax = 1;
|
||||
bullet.dmgMin = 100;
|
||||
@ -85,7 +84,6 @@ public class GunNPCFactory {
|
||||
bullet.spread = 0.0F;
|
||||
bullet.dmgMin = 15;
|
||||
bullet.dmgMax = 20;
|
||||
bullet.wear = 10;
|
||||
bullet.leadChance = 0;
|
||||
bullet.explosive = 0.5F;
|
||||
bullet.setToBolt(BulletConfiguration.BOLT_LACUNAE);
|
||||
@ -95,22 +93,6 @@ public class GunNPCFactory {
|
||||
return bullet;
|
||||
}
|
||||
|
||||
public static BulletConfiguration getMaskmanBullet() {
|
||||
|
||||
BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig();
|
||||
|
||||
bullet.ammo = new ComparableStack(ModItems.coin_maskman);
|
||||
bullet.spread = 0.0F;
|
||||
bullet.dmgMin = 5;
|
||||
bullet.dmgMax = 10;
|
||||
bullet.wear = 10;
|
||||
bullet.leadChance = 15;
|
||||
bullet.style = BulletConfiguration.STYLE_FLECHETTE;
|
||||
bullet.vPFX = "bluedust";
|
||||
|
||||
return bullet;
|
||||
}
|
||||
|
||||
public static BulletConfiguration getMaskmanTracer() {
|
||||
|
||||
BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig();
|
||||
@ -119,7 +101,6 @@ public class GunNPCFactory {
|
||||
bullet.spread = 0.0F;
|
||||
bullet.dmgMin = 15;
|
||||
bullet.dmgMax = 20;
|
||||
bullet.wear = 10;
|
||||
bullet.leadChance = 0;
|
||||
bullet.setToBolt(BulletConfiguration.BOLT_NIGHTMARE);
|
||||
bullet.vPFX = "reddust";
|
||||
|
||||
@ -41,9 +41,11 @@ public class PressRecipeHandler extends TemplateRecipeHandler implements ICompat
|
||||
return "pressing";
|
||||
}
|
||||
public LinkedList<RecipeTransferRect> transferRectsRec = new LinkedList<RecipeTransferRect>();
|
||||
public LinkedList<RecipeTransferRect> transferRectsGui = new LinkedList<RecipeTransferRect>();
|
||||
public LinkedList<RecipeTransferRect> transferRectsPress = new LinkedList<RecipeTransferRect>();
|
||||
public LinkedList<RecipeTransferRect> transferRectsEPress = new LinkedList<RecipeTransferRect>();
|
||||
public LinkedList<Class<? extends GuiContainer>> guiRec = new LinkedList<Class<? extends GuiContainer>>();
|
||||
public LinkedList<Class<? extends GuiContainer>> guiGui = new LinkedList<Class<? extends GuiContainer>>();
|
||||
public LinkedList<Class<? extends GuiContainer>> guiPress = new LinkedList<Class<? extends GuiContainer>>();
|
||||
public LinkedList<Class<? extends GuiContainer>> guiEPress = new LinkedList<Class<? extends GuiContainer>>();
|
||||
|
||||
public class SmeltingSet extends TemplateRecipeHandler.CachedRecipe {
|
||||
PositionedStack input;
|
||||
@ -130,21 +132,24 @@ public class PressRecipeHandler extends TemplateRecipeHandler implements ICompat
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiContainer> getGuiClass() {
|
||||
// return GUIMachineShredder.class;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
transferRectsGui = new LinkedList<RecipeTransferRect>();
|
||||
guiGui = new LinkedList<Class<? extends GuiContainer>>();
|
||||
transferRectsPress = new LinkedList<RecipeTransferRect>();
|
||||
transferRectsEPress = new LinkedList<RecipeTransferRect>();
|
||||
guiPress = new LinkedList<Class<? extends GuiContainer>>();
|
||||
guiEPress = new LinkedList<Class<? extends GuiContainer>>();
|
||||
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(74 + 6, 23, 24, 18), "pressing"));
|
||||
transferRectsGui.add(new RecipeTransferRect(new Rectangle(74 + 6 + 18, 23, 24, 18), "pressing"));
|
||||
guiGui.add(GUIMachinePress.class);
|
||||
guiGui.add(GUIMachineEPress.class);
|
||||
transferRectsPress.add(new RecipeTransferRect(new Rectangle(74 + 6 + 18, 23, 24, 18), "pressing"));
|
||||
transferRectsEPress.add(new RecipeTransferRect(new Rectangle(13 + 6 + 18, 23, 24, 18), "pressing"));
|
||||
guiPress.add(GUIMachinePress.class);
|
||||
guiEPress.add(GUIMachineEPress.class);
|
||||
RecipeTransferRectHandler.registerRectsToGuis(getRecipeTransferRectGuis(), transferRects);
|
||||
RecipeTransferRectHandler.registerRectsToGuis(guiGui, transferRectsGui);
|
||||
RecipeTransferRectHandler.registerRectsToGuis(guiPress, transferRectsPress);
|
||||
RecipeTransferRectHandler.registerRectsToGuis(guiEPress, transferRectsEPress);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -9,7 +9,7 @@ public class RTGRecipeHandler extends NEIUniversalHandler {
|
||||
|
||||
public RTGRecipeHandler() {
|
||||
super("RTG", new ItemStack[] {
|
||||
new ItemStack(ModBlocks.machine_rtg_grey),
|
||||
new ItemStack(ModBlocks.machine_rtg),
|
||||
new ItemStack(ModBlocks.machine_difurnace_rtg_off)
|
||||
}, ItemRTGPellet.getRecipeMap());
|
||||
}
|
||||
|
||||
@ -320,7 +320,7 @@ public class OreDictManager {
|
||||
public static final DictFrame ANY_CONCRETE = new DictFrame("Concrete"); //no any prefix means that any has to be appended with the any() or anys() getters, registering works with the any (i.e. no shape) setter
|
||||
public static final DictGroup ANY_TAR = new DictGroup("Tar", KEY_OIL_TAR, KEY_COAL_TAR, KEY_CRACK_TAR, KEY_WOOD_TAR);
|
||||
/** Any special post-RBMK gating material, namely bismuth and arsenic */
|
||||
public static final DictFrame ANY_BISMOID = new DictFrame("AnyBismoid");
|
||||
public static final DictGroup ANY_BISMOID = new DictGroup("AnyBismoid", BI, AS);
|
||||
public static final DictFrame ANY_ASH = new DictFrame("Ash");
|
||||
|
||||
|
||||
@ -501,7 +501,6 @@ public class OreDictManager {
|
||||
for(int i = 0; i < 16; i++) { ANY_CONCRETE.any(new ItemStack(ModBlocks.concrete_colored, 1, i)); }
|
||||
for(int i = 0; i < 16; i++) { ANY_CONCRETE.any(new ItemStack(ModBlocks.concrete_colored_ext, 1, i)); }
|
||||
ANY_COKE .gem(fromAll(coke, EnumCokeType.class)).block(fromAll(block_coke, EnumCokeType.class));
|
||||
ANY_BISMOID .ingot(ingot_bismuth, ingot_arsenic).nugget(nugget_bismuth, nugget_arsenic).block(block_bismuth);
|
||||
ANY_ASH .any(fromOne(ModItems.powder_ash, EnumAshType.WOOD), fromOne(ModItems.powder_ash, EnumAshType.COAL), fromOne(ModItems.powder_ash, EnumAshType.MISC), fromOne(ModItems.powder_ash, EnumAshType.FLY), fromOne(ModItems.powder_ash, EnumAshType.SOOT));
|
||||
|
||||
/*
|
||||
@ -666,6 +665,7 @@ public class OreDictManager {
|
||||
.addPrefix(LIGHTBARREL, true).addPrefix(HEAVYBARREL, true).addPrefix(LIGHTRECEIVER, true).addPrefix(HEAVYRECEIVER, true);
|
||||
ANY_BISMOIDBRONZE.addPrefix(INGOT, true).addPrefix(CASTPLATE, true).addPrefix(LIGHTBARREL, true).addPrefix(HEAVYBARREL, true).addPrefix(LIGHTRECEIVER, true).addPrefix(HEAVYRECEIVER, true);
|
||||
ANY_TAR.addPrefix(ANY, false);
|
||||
ANY_BISMOID.addPrefix(NUGGET, true).addPrefix(INGOT, true).addPrefix(BLOCK, true);
|
||||
}
|
||||
|
||||
private static boolean recursionBrake = false;
|
||||
|
||||
@ -16,10 +16,10 @@ public class SlotPattern extends Slot {
|
||||
public SlotPattern(IInventory inv, int index, int x, int y) {
|
||||
super(inv, index, x, y);
|
||||
}
|
||||
|
||||
public SlotPattern(IInventory inv, int index, int x, int y, boolean allowStackSize) {
|
||||
super(inv, index, x, y);
|
||||
this.allowStackSize = allowStackSize;
|
||||
|
||||
public SlotPattern allowStackSize() {
|
||||
this.allowStackSize = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -29,7 +29,7 @@ public class SlotPattern extends Slot {
|
||||
|
||||
@Override
|
||||
public int getSlotStackLimit() {
|
||||
return 1;
|
||||
return allowStackSize ? 64 : 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -37,7 +37,7 @@ public class SlotPattern extends Slot {
|
||||
if (stack != null) {
|
||||
stack = stack.copy();
|
||||
|
||||
if (!allowStackSize)
|
||||
if(!allowStackSize)
|
||||
stack.stackSize = 1;
|
||||
}
|
||||
super.putStack(stack);
|
||||
|
||||
@ -24,7 +24,7 @@ public class ContainerAutocrafter extends ContainerBase {
|
||||
this.addSlotToContainer(new SlotPattern(tedf, j + i * 3, 44 + j * 18, 22 + i * 18));
|
||||
}
|
||||
}
|
||||
this.addSlotToContainer(new SlotPattern(tedf, 9, 116, 40, true));
|
||||
this.addSlotToContainer(new SlotPattern(tedf, 9, 116, 40).allowStackSize());
|
||||
|
||||
/* RECIPE */
|
||||
addSlots(tedf,10, 44, 86, 3, 3);
|
||||
|
||||
@ -22,20 +22,20 @@ public class ContainerElectricFurnace extends Container {
|
||||
|
||||
diFurnace = tedf;
|
||||
|
||||
this.addSlotToContainer(new Slot(tedf, 0, 56, 53));
|
||||
this.addSlotToContainer(new Slot(tedf, 1, 56, 17));
|
||||
this.addSlotToContainer(new SlotSmelting(invPlayer.player, tedf, 2, 116, 35));
|
||||
this.addSlotToContainer(new Slot(tedf, 0, 152, 54));
|
||||
this.addSlotToContainer(new Slot(tedf, 1, 20, 35));
|
||||
this.addSlotToContainer(new SlotSmelting(invPlayer.player, tedf, 2, 80, 35));
|
||||
//Upgrades
|
||||
this.addSlotToContainer(new SlotUpgrade(tedf, 3, 147, 34));
|
||||
this.addSlotToContainer(new SlotUpgrade(tedf, 3, 111, 34));
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
for(int j = 0; j < 9; j++) {
|
||||
this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
|
||||
this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 104 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142));
|
||||
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 162));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -23,24 +23,24 @@ private TileEntityMachineEPress nukeBoy;
|
||||
nukeBoy = tedf;
|
||||
|
||||
//Battery
|
||||
this.addSlotToContainer(new Slot(tedf, 0, 44, 53));
|
||||
this.addSlotToContainer(new Slot(tedf, 0, 152, 54));
|
||||
//Stamp
|
||||
this.addSlotToContainer(new Slot(tedf, 1, 80, 17));
|
||||
this.addSlotToContainer(new Slot(tedf, 1, 19, 15));
|
||||
//Input
|
||||
this.addSlotToContainer(new Slot(tedf, 2, 80, 53));
|
||||
this.addSlotToContainer(new Slot(tedf, 2, 19, 51));
|
||||
//Output
|
||||
this.addSlotToContainer(new SlotCraftingOutput(invPlayer.player, tedf, 3, 140, 35));
|
||||
this.addSlotToContainer(new SlotCraftingOutput(invPlayer.player, tedf, 3, 79, 33));
|
||||
//Upgrade
|
||||
this.addSlotToContainer(new SlotUpgrade(tedf, 4, 44, 21));
|
||||
this.addSlotToContainer(new SlotUpgrade(tedf, 4, 111, 32));
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
for(int j = 0; j < 9; j++) {
|
||||
this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
|
||||
this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 104 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142));
|
||||
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 162));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -19,28 +19,27 @@ public class ContainerMachineOilWell extends Container {
|
||||
well = tedf;
|
||||
|
||||
// Battery
|
||||
this.addSlotToContainer(new Slot(tedf, 0, 8, 53));
|
||||
this.addSlotToContainer(new Slot(tedf, 0, 8, 58));
|
||||
// Canister Input
|
||||
this.addSlotToContainer(new Slot(tedf, 1, 80, 17));
|
||||
this.addSlotToContainer(new Slot(tedf, 1, 94, 22));
|
||||
// Canister Output
|
||||
this.addSlotToContainer(new SlotTakeOnly(tedf, 2, 80, 53));
|
||||
this.addSlotToContainer(new SlotTakeOnly(tedf, 2, 94, 58));
|
||||
// Gas Input
|
||||
this.addSlotToContainer(new Slot(tedf, 3, 125, 17));
|
||||
this.addSlotToContainer(new Slot(tedf, 3, 130, 22));
|
||||
// Gas Output
|
||||
this.addSlotToContainer(new SlotTakeOnly(tedf, 4, 125, 53));
|
||||
this.addSlotToContainer(new SlotTakeOnly(tedf, 4, 130, 58));
|
||||
//Upgrades
|
||||
this.addSlotToContainer(new Slot(tedf, 5, 152, 17));
|
||||
this.addSlotToContainer(new Slot(tedf, 6, 152, 35));
|
||||
this.addSlotToContainer(new Slot(tedf, 7, 152, 53));
|
||||
this.addSlotToContainer(new Slot(tedf, 5, 156, 36));
|
||||
this.addSlotToContainer(new Slot(tedf, 6, 156, 54));
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
for(int j = 0; j < 9; j++) {
|
||||
this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
|
||||
this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 12 + j * 18, 108 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142));
|
||||
this.addSlotToContainer(new Slot(invPlayer, i, 12 + i * 18, 166));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -33,12 +33,12 @@ public class ContainerMachinePress extends Container {
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
for(int j = 0; j < 9; j++) {
|
||||
this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 120 + i * 18));
|
||||
this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 132 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 178));
|
||||
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 190));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3,59 +3,507 @@ package com.hbm.inventory.container;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.hbm.inventory.SlotNonRetarded;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.ContainerNBTCommsPacket;
|
||||
import com.hbm.tileentity.network.pneumatic.TileEntityPneumoStorageAccess;
|
||||
import com.hbm.util.ItemStackUtil;
|
||||
import com.hbm.util.EnumUtil;
|
||||
import com.hbm.util.InventoryUtil;
|
||||
|
||||
import api.hbm.ntl.StackCache;
|
||||
import api.hbm.ntl.StackCache.CacheSlot;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
public class ContainerPneumoStorageAccess extends Container {
|
||||
public class ContainerPneumoStorageAccess extends Container implements ICustomPayloadReceiver {
|
||||
|
||||
protected TileEntityPneumoStorageAccess access;
|
||||
protected InventoryPneumoStorageAccess inventory;
|
||||
protected EntityPlayer player;
|
||||
protected String searchString = "";
|
||||
|
||||
public static boolean detailedSearch = false;
|
||||
|
||||
/** On the server, this is used to find changes in the system and then send them to the client. On the client, this is just to keep track of all items. */
|
||||
protected LinkedHashMap<Long, CacheSlotDummy> cachedEntries = new LinkedHashMap();
|
||||
/** Server to client queue, contains NBT tags that represents deltas yet to be sent to the client */
|
||||
public LinkedList<NBTTagCompound> s2cQueue = new LinkedList();
|
||||
|
||||
public void setSorter(Comparator<CacheSlotDummy> sorter) {
|
||||
this.listingStart = 0;
|
||||
this.sorter = sorter;
|
||||
this.rebuildClientIndex();
|
||||
}
|
||||
|
||||
public void setSearchString(String search) {
|
||||
this.listingStart = 0;
|
||||
this.searchString = search.toLowerCase(Locale.US);
|
||||
this.rebuildClientIndex();
|
||||
}
|
||||
|
||||
/** Used to temporarily store the previous CacheSlot contents to calculate deltas with (i.e. detect changes) */
|
||||
public static class CacheSlotDummy {
|
||||
|
||||
public final ItemStack displayStack;
|
||||
public long stacksize;
|
||||
public final int itemId;
|
||||
public final int meta;
|
||||
public final NBTTagCompound nbt;
|
||||
|
||||
public CacheSlotDummy(ItemStack displayStack, long stacksize) {
|
||||
this.displayStack = displayStack;
|
||||
this.stacksize = stacksize;
|
||||
this.itemId = Item.getIdFromItem(displayStack.getItem());
|
||||
this.meta = displayStack.getItemDamage();
|
||||
if(displayStack.hasTagCompound()) this.nbt = (NBTTagCompound) displayStack.stackTagCompound.copy();
|
||||
else this.nbt = null;
|
||||
}
|
||||
|
||||
public CacheSlotDummy(CacheSlot original) {
|
||||
this(original.displayStack.copy(), original.stacksize);
|
||||
}
|
||||
}
|
||||
|
||||
public static final int GRID_SIZE = 6 * 8;
|
||||
public static final int DELTAS_PER_MSG = 6 * 8;
|
||||
public static final int SLOT_CLICK_ID_REFRESH = -666;
|
||||
|
||||
public int listingStart = 0;
|
||||
public int listingSize = 0;
|
||||
|
||||
public int getStackCount() {
|
||||
return listingSize;
|
||||
}
|
||||
|
||||
/** Serverside, creates a new delta for a new item stack */
|
||||
public void pushNewItem(ItemStack zeroStack, long amount) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setByte("type", (byte) DeltaType.NEW_TYPE.ordinal());
|
||||
zeroStack.writeToNBT(data);
|
||||
data.setLong("amount", amount);
|
||||
s2cQueue.add(data);
|
||||
}
|
||||
|
||||
/** Serverside, creates a new delta for an amount update */
|
||||
public void updateCount(long hash, long amount) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setByte("type", (byte) DeltaType.COUNT_CHANGE.ordinal());
|
||||
data.setLong("hash", hash);
|
||||
data.setLong("amount", amount);
|
||||
s2cQueue.add(data);
|
||||
}
|
||||
|
||||
/** Serverside, bunches up deltas into NBTTagLists and sends them, 48 (DELTAS_PER_MSG) at a time */
|
||||
public void processDeltasAndSync(EntityPlayerMP playerMP) {
|
||||
if(s2cQueue.isEmpty()) return;
|
||||
|
||||
NBTTagList list = null;
|
||||
|
||||
while(!s2cQueue.isEmpty()) {
|
||||
if(list == null) list = new NBTTagList();
|
||||
list.appendTag(s2cQueue.removeFirst());
|
||||
if(list.tagCount() >= DELTAS_PER_MSG) { bonVoyage(list, playerMP); list = null; }
|
||||
}
|
||||
|
||||
if(list != null) bonVoyage(list, playerMP);
|
||||
}
|
||||
|
||||
/** Wraps the NBTTagList into a master compound tag and sends it to the client */
|
||||
public void bonVoyage(NBTTagList list, EntityPlayerMP playerMP) {
|
||||
NBTTagCompound masterTag = new NBTTagCompound();
|
||||
masterTag.setTag("list", list);
|
||||
PacketDispatcher.wrapper.sendTo(new ContainerNBTCommsPacket(playerMP.currentWindowId, masterTag), playerMP);
|
||||
}
|
||||
|
||||
/** Compares the original access stack cache with the one we have buffered to detect changes and pushes them to the s2c sending queue */
|
||||
public void checkAndSyncCache() {
|
||||
if(this.access.cache == null || this.access.cache.hasExpired) return;
|
||||
|
||||
for(Entry<Long, CacheSlot> entry : this.access.cache.cacheSlots.entrySet()) {
|
||||
|
||||
Long hash = entry.getKey();
|
||||
if(hash == StackCache.getNullIdentity()) continue;
|
||||
|
||||
CacheSlotDummy existingCache = this.cachedEntries.get(hash);
|
||||
CacheSlot properCache = entry.getValue();
|
||||
|
||||
// if the previous entries already contain this type, check for amount change
|
||||
if(existingCache != null) {
|
||||
if(existingCache.stacksize != properCache.stacksize) {
|
||||
this.updateCount(hash, properCache.stacksize);
|
||||
existingCache.stacksize = properCache.stacksize;
|
||||
}
|
||||
// if not, add that type to our index
|
||||
} else {
|
||||
existingCache = new CacheSlotDummy(properCache);
|
||||
existingCache.stacksize = properCache.stacksize;
|
||||
this.cachedEntries.put(hash, existingCache);
|
||||
this.pushNewItem(existingCache.displayStack, existingCache.stacksize);
|
||||
}
|
||||
}
|
||||
|
||||
if(player instanceof EntityPlayerMP) processDeltasAndSync((EntityPlayerMP) this.player);
|
||||
}
|
||||
|
||||
public ContainerPneumoStorageAccess(InventoryPlayer invPlayer, TileEntityPneumoStorageAccess access) {
|
||||
this.access = access;
|
||||
this.inventory = new InventoryPneumoStorageAccess(access);
|
||||
this.player = invPlayer.player;
|
||||
|
||||
for(int i = 0; i < 6; i++) {
|
||||
for(int j = 0; j < 8; j++) {
|
||||
this.addSlotToContainer(new SlotNonRetarded(inventory, j + i * 8, 8 + j * 18, 17 + i * 18));
|
||||
}
|
||||
int hOffset = 34;
|
||||
|
||||
for(int i = 0; i < 6; i++) for(int j = 0; j < 8; j++) {
|
||||
this.addSlotToContainer(new SlotPneumo(inventory, j + i * 8, 8 + j * 18 + hOffset, 17 + i * 18));
|
||||
}
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
for(int j = 0; j < 9; j++) {
|
||||
this.addSlotToContainer(new SlotNonRetarded(invPlayer, j + i * 9 + 9, 8 + j * 18, 169 + i * 18));
|
||||
}
|
||||
for(int i = 0; i < 3; i++) for(int j = 0; j < 9; j++) {
|
||||
this.addSlotToContainer(new SlotNonRetarded(invPlayer, j + i * 9 + 9, 8 + j * 18 + hOffset, 169 + i * 18));
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
this.addSlotToContainer(new SlotNonRetarded(invPlayer, i, 8 + i * 18, 227));
|
||||
this.addSlotToContainer(new SlotNonRetarded(invPlayer, i, 8 + i * 18 + hOffset, 227));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack slotClick(int index, int button, int mode, EntityPlayer player) {
|
||||
if(mode == 6) return null;
|
||||
|
||||
if(index == SLOT_CLICK_ID_REFRESH) {
|
||||
this.listingStart = mode;
|
||||
this.detectAndSendChanges();
|
||||
return null;
|
||||
}
|
||||
|
||||
boolean client = player.worldObj.isRemote;
|
||||
boolean leftClick = button == 0 && mode == 0;
|
||||
boolean rightClick = button == 1 && mode == 0;
|
||||
boolean shiftClick = button == 0 && mode == 1;
|
||||
|
||||
if(index >= 0 && index < GRID_SIZE) {
|
||||
if(!client) return null;
|
||||
SlotPneumo slot = (SlotPneumo) this.getSlot(index);
|
||||
long hash = StackCache.getStackIdentity(slot.getStack());
|
||||
ItemStack held = player.inventory.getItemStack();
|
||||
long heldHash = StackCache.getStackIdentity(held);
|
||||
if(leftClick) {
|
||||
if(held != null && hash != heldHash) held = null;
|
||||
else if(held != null && hash == heldHash) {
|
||||
held.stackSize += slot.amount;
|
||||
held.stackSize = Math.min(held.stackSize, held.getMaxStackSize());
|
||||
} else if(held == null && slot.getHasStack()) {
|
||||
held = slot.getStack().copy();
|
||||
held.stackSize = (int) Math.min(slot.amount, held.getMaxStackSize());
|
||||
}
|
||||
this.player.inventory.setItemStack(held);
|
||||
sendClickToServer(ClickType.LEFT_CLICK, hash);
|
||||
return null;
|
||||
}
|
||||
if(rightClick) {
|
||||
if(held != null && hash != heldHash) held.stackSize--;
|
||||
else if(held != null && hash == heldHash) {
|
||||
held.stackSize += 1;
|
||||
held.stackSize = Math.min(held.stackSize, held.getMaxStackSize());
|
||||
} else if(held == null && slot.getHasStack()) {
|
||||
held = slot.getStack().copy();
|
||||
held.stackSize = 1;
|
||||
}
|
||||
if(held != null && held.stackSize <= 0) held = null;
|
||||
this.player.inventory.setItemStack(held);
|
||||
sendClickToServer(ClickType.RIGHT_CLICK, hash);
|
||||
return null;
|
||||
}
|
||||
if(shiftClick) { sendClickToServer(ClickType.SHIFT_CLICK, hash); return null; }
|
||||
|
||||
// shift clicking an item from the player inv to the storage
|
||||
} else if(index >= GRID_SIZE && index < this.inventorySlots.size()) {
|
||||
|
||||
Slot slot = this.getSlot(index);
|
||||
|
||||
if(shiftClick && slot.getHasStack()) {
|
||||
ItemStack stack = slot.getStack().copy();
|
||||
if(this.access.cache == null || this.access.cache.hasExpired) return null;
|
||||
StackCache cache = this.access.cache;
|
||||
int remainder = (int) cache.addItemsAndReturnQuantity(stack, stack.stackSize);
|
||||
slot.decrStackSize(stack.stackSize - remainder);
|
||||
if(remainder <= 0) slot.putStack(null);
|
||||
slot.onSlotChanged();
|
||||
detectAndSendChanges();
|
||||
return null; // technically not needed but we don't have to run 500,000 lines of code that ends up doing nothing
|
||||
}
|
||||
}
|
||||
|
||||
inventory.updateListing();
|
||||
this.detectAndSendChanges();
|
||||
return super.slotClick(index, button, mode, player);
|
||||
}
|
||||
|
||||
public void sendClickToServer(ClickType type, long hash) {
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setByte("type", (byte) type.ordinal());
|
||||
data.setLong("hash", hash);
|
||||
PacketDispatcher.wrapper.sendToServer(new ContainerNBTCommsPacket(this.windowId, data));
|
||||
}
|
||||
|
||||
public long[] previousStackSizes = new long[GRID_SIZE];
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
|
||||
// skip the first 6*8 slots, i.e. all the ones visible in the access grid
|
||||
for(int i = GRID_SIZE; i < this.inventorySlots.size(); i++) {
|
||||
ItemStack stack0 = ((Slot) this.inventorySlots.get(i)).getStack();
|
||||
ItemStack stack1 = (ItemStack) this.inventoryItemStacks.get(i);
|
||||
|
||||
if(!ItemStack.areItemStacksEqual(stack1, stack0)) {
|
||||
stack1 = stack0 == null ? null : stack0.copy();
|
||||
this.inventoryItemStacks.set(i, stack1);
|
||||
|
||||
for(int j = 0; j < this.crafters.size(); ++j) {
|
||||
((ICrafting) this.crafters.get(j)).sendSlotContents(this, i, stack1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boolean isServer = !this.access.getWorldObj().isRemote;
|
||||
|
||||
if(isServer) {
|
||||
checkAndSyncCache();
|
||||
} else {
|
||||
rebuildClientIndex();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return access.getDistanceFrom(player.posX, player.posY, player.posZ) <= 15 * 15;
|
||||
}
|
||||
|
||||
/** For S2C to send deltas updating the available items */
|
||||
public static enum DeltaType {
|
||||
NEW_TYPE,
|
||||
COUNT_CHANGE;
|
||||
}
|
||||
|
||||
public static enum ClickType {
|
||||
LEFT_CLICK,
|
||||
RIGHT_CLICK,
|
||||
SHIFT_CLICK
|
||||
}
|
||||
|
||||
@Override
|
||||
public void acceptData(Side side, int windowId, NBTTagCompound data) {
|
||||
if(windowId != this.windowId) return;
|
||||
|
||||
if(side == Side.CLIENT) {
|
||||
NBTTagList list = data.getTagList("list", 10);
|
||||
|
||||
for(int i = 0; i < list.tagCount(); i++) {
|
||||
NBTTagCompound line = list.getCompoundTagAt(i);
|
||||
DeltaType type = EnumUtil.grabEnumSafely(DeltaType.class, line.getByte("type"));
|
||||
|
||||
if(type == DeltaType.NEW_TYPE) {
|
||||
ItemStack stack = ItemStack.loadItemStackFromNBT(line);
|
||||
long amount = line.getLong("amount");
|
||||
long hash = StackCache.getStackIdentity(stack);
|
||||
CacheSlotDummy dummy = new CacheSlotDummy(stack, amount);
|
||||
this.cachedEntries.put(hash, dummy);
|
||||
|
||||
} else if(type == DeltaType.COUNT_CHANGE) {
|
||||
long hash = line.getLong("hash");
|
||||
CacheSlotDummy dummy = this.cachedEntries.get(hash);
|
||||
if(dummy != null) dummy.stacksize = line.getLong("amount");
|
||||
}
|
||||
}
|
||||
|
||||
rebuildClientIndex();
|
||||
|
||||
} else {
|
||||
if(this.access.cache == null || this.access.cache.hasExpired) return;
|
||||
ClickType type = EnumUtil.grabEnumSafely(ClickType.class, data.getByte("type"));
|
||||
long hash = data.getLong("hash");
|
||||
CacheSlotDummy cache = this.cachedEntries.get(hash);
|
||||
ItemStack held = this.player.inventory.getItemStack();
|
||||
long heldHash = StackCache.getStackIdentity(held);
|
||||
|
||||
// left click
|
||||
if(type == ClickType.LEFT_CLICK || type == ClickType.RIGHT_CLICK) {
|
||||
|
||||
// if we drop an item onto a different stack, or no stack at all, deposit
|
||||
if(hash != heldHash && held != null) {
|
||||
int toDeposit = type == ClickType.LEFT_CLICK ? held.stackSize : 1;
|
||||
held.stackSize -= toDeposit;
|
||||
int leftover = (int) this.access.cache.addItemsAndReturnQuantity(held, toDeposit);
|
||||
held.stackSize += leftover;
|
||||
this.player.inventory.setItemStack(null);
|
||||
if(held.stackSize > 0) InventoryUtil.tryAddItemToInventory(player.inventory.mainInventory, held);
|
||||
detectAndSendChanges();
|
||||
return;
|
||||
}
|
||||
|
||||
// if our hand is empty or we have the same type, withdraw
|
||||
if(cache != null && (held == null || hash == heldHash)) {
|
||||
ItemStack stack = cache.displayStack.copy();
|
||||
int alreadyHeld = held == null ? 0 : held.stackSize;
|
||||
int capacity = stack.getMaxStackSize() - alreadyHeld;
|
||||
if(type == ClickType.RIGHT_CLICK && capacity > 1) capacity = 1;
|
||||
int toGrab = (int) Math.min(capacity, cache.stacksize);
|
||||
int grabbed = (int) this.access.cache.consumeItemsAndReturnQuantity(stack, toGrab);
|
||||
stack.stackSize = alreadyHeld + grabbed;
|
||||
this.player.inventory.setItemStack(stack);
|
||||
detectAndSendChanges();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(type == ClickType.SHIFT_CLICK && cache != null) {
|
||||
ItemStack stack = cache.displayStack.copy();
|
||||
int originalStacksize = (int) Math.min(stack.getMaxStackSize(), cache.stacksize);
|
||||
stack.stackSize = originalStacksize;
|
||||
ItemStack ret = InventoryUtil.tryAddItemToInventory(player.inventory.mainInventory, stack);
|
||||
int remainder = ret == null ? 0 : ret.stackSize;
|
||||
int itemsUsed = originalStacksize - remainder;
|
||||
this.access.cache.consumeItemsAndReturnQuantity(stack, itemsUsed);
|
||||
detectAndSendChanges();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void rebuildClientIndex() {
|
||||
|
||||
List<CacheSlotDummy> cacheSlots = new ArrayList(this.cachedEntries.size());
|
||||
cacheSlots.addAll(this.cachedEntries.values());
|
||||
cacheSlots.removeIf(x -> { return x.stacksize <= 0; });
|
||||
|
||||
if(this.searchString != null && !this.searchString.isEmpty()) {
|
||||
if(!detailedSearch) {
|
||||
cacheSlots.removeIf(x -> {
|
||||
return !x.displayStack.getDisplayName().toLowerCase(Locale.US).contains(searchString);
|
||||
});
|
||||
} else {
|
||||
cacheSlots.removeIf(x -> {
|
||||
boolean contains = x.displayStack.getDisplayName().toLowerCase(Locale.US).contains(searchString);
|
||||
List<String> toolTip = new ArrayList();
|
||||
if(!contains) {
|
||||
x.displayStack.getItem().addInformation(x.displayStack, MainRegistry.proxy.me(), toolTip, MainRegistry.proxy.advancedTooltips());
|
||||
for(String string : toolTip) {
|
||||
if(string.toLowerCase(Locale.US).contains(searchString)) {
|
||||
contains = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return !contains;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
listingSize = cacheSlots.size();
|
||||
Collections.sort(cacheSlots, this.sorter);
|
||||
int size = cacheSlots.size();
|
||||
|
||||
int offset = listingStart * 8;
|
||||
|
||||
for(int i = 0; i < inventory.slots.length; i++) {
|
||||
int grabIndex = offset + i;
|
||||
if(grabIndex < size) {
|
||||
CacheSlotDummy cacheSlot = cacheSlots.get(grabIndex);
|
||||
SlotPneumo slot = (SlotPneumo) this.inventorySlots.get(i);
|
||||
if(cacheSlot.displayStack != null) {
|
||||
slot.putStack(cacheSlot.displayStack.copy());
|
||||
slot.amount = cacheSlot.stacksize;
|
||||
} else {
|
||||
slot.putStack(null);
|
||||
slot.amount = 0;
|
||||
}
|
||||
} else {
|
||||
inventory.slots[i] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static final Comparator<CacheSlotDummy> SORT_BY_STACK_SIZE = new Comparator<CacheSlotDummy>() {
|
||||
@Override
|
||||
public int compare(CacheSlotDummy o1, CacheSlotDummy o2) {
|
||||
if(o1.stacksize > o2.stacksize) return -1; if(o1.stacksize < o2.stacksize) return 1;
|
||||
if(o1.itemId < o2.itemId) return -1; if(o1.itemId > o2.itemId) return 1;
|
||||
if(o1.meta < o2.meta) return -1; if(o1.meta > o2.meta) return 1;
|
||||
if(o1.nbt == null && o2.nbt != null) return -1; if(o1.nbt != null && o2.nbt == null) return 1;
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
public static final Comparator<CacheSlotDummy> SORT_BY_ID = new Comparator<CacheSlotDummy>() {
|
||||
@Override
|
||||
public int compare(CacheSlotDummy o1, CacheSlotDummy o2) {
|
||||
if(o1.itemId < o2.itemId) return -1; if(o1.itemId > o2.itemId) return 1;
|
||||
if(o1.meta < o2.meta) return -1; if(o1.meta > o2.meta) return 1;
|
||||
if(o1.stacksize > o2.stacksize) return -1; if(o1.stacksize < o2.stacksize) return 1;
|
||||
if(o1.nbt == null && o2.nbt != null) return -1; if(o1.nbt != null && o2.nbt == null) return 1;
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
public static final Comparator<CacheSlotDummy> SORT_BY_INTERNAL = new Comparator<CacheSlotDummy>() {
|
||||
@Override
|
||||
public int compare(CacheSlotDummy o1, CacheSlotDummy o2) {
|
||||
String name1 = o1.displayStack.getItem().getUnlocalizedName(o1.displayStack);
|
||||
String name2 = o2.displayStack.getItem().getUnlocalizedName(o2.displayStack);
|
||||
int compare = name1.compareToIgnoreCase(name2);
|
||||
if(compare != 0) return compare;
|
||||
return SORT_BY_ID.compare(o1, o2);
|
||||
}
|
||||
};
|
||||
|
||||
public static final Comparator<CacheSlotDummy> SORT_BY_LOCALIZED = new Comparator<CacheSlotDummy>() {
|
||||
@Override
|
||||
public int compare(CacheSlotDummy o1, CacheSlotDummy o2) {
|
||||
String name1 = o1.displayStack.getItem().getItemStackDisplayName(o1.displayStack);
|
||||
String name2 = o2.displayStack.getItem().getItemStackDisplayName(o2.displayStack);
|
||||
int compare = name1.compareToIgnoreCase(name2);
|
||||
if(compare != 0) return compare;
|
||||
return SORT_BY_ID.compare(o1, o2);
|
||||
}
|
||||
};
|
||||
|
||||
protected static Comparator<CacheSlotDummy> sorter = SORT_BY_STACK_SIZE;
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class SlotPneumo extends SlotNonRetarded {
|
||||
|
||||
public long amount;
|
||||
|
||||
public SlotPneumo(IInventory inventory, int id, int x, int y) {
|
||||
super(inventory, id, x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTakeStack(EntityPlayer player) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/** This inventory instance only exists to prepare the contents of a StackCache in such a way that we can use it in a container. */
|
||||
public static class InventoryPneumoStorageAccess implements IInventory {
|
||||
|
||||
@ -66,42 +514,12 @@ public class ContainerPneumoStorageAccess extends Container {
|
||||
this.slots = new ItemStack[getSizeInventory()];
|
||||
this.cache = access.cache;
|
||||
}
|
||||
|
||||
public void updateListing() { // DEMO
|
||||
if(this.cache == null) return;
|
||||
List<CacheSlot> cacheSlots = new ArrayList(cache.cacheSlots.size());
|
||||
cacheSlots.addAll(cache.cacheSlots.values());
|
||||
cacheSlots.removeIf(x -> { return x.stacksize <= 0; });
|
||||
Collections.sort(cacheSlots, SORT_BY_STACK_SIZE);
|
||||
int size = cacheSlots.size();
|
||||
|
||||
for(int i = 0; i < slots.length; i++) {
|
||||
if(i < size) {
|
||||
CacheSlot cache = cacheSlots.get(i);
|
||||
if(cache.displayStack != null) {
|
||||
slots[i] = cache.displayStack.copy();
|
||||
ItemStackUtil.addTooltipToStack(slots[i], "x" + cache.stacksize, "in " + cache.monitors.size() + " stacks");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static final Comparator<CacheSlot> SORT_BY_STACK_SIZE = new Comparator<CacheSlot>() {
|
||||
@Override
|
||||
public int compare(CacheSlot o1, CacheSlot o2) {
|
||||
if(o1.stacksize > o2.stacksize) return 1; if(o1.stacksize < o2.stacksize) return -1;
|
||||
if(o1.itemId < o2.itemId) return 1; if(o1.itemId > o2.itemId) return -1;
|
||||
if(o1.meta < o2.meta) return 1; if(o1.meta > o2.meta) return -1;
|
||||
if(o1.nbt == null && o2.nbt != null) return 1; if(o1.nbt != null && o2.nbt == null) return -1;
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
@Override public int getSizeInventory() { return 6 * 9; }
|
||||
@Override public int getSizeInventory() { return GRID_SIZE; }
|
||||
@Override public ItemStack getStackInSlot(int slot) { return slots[slot]; }
|
||||
@Override public int getInventoryStackLimit() { return 64; }
|
||||
|
||||
@Override public int getInventoryStackLimit() { return 1; }
|
||||
@Override public ItemStack decrStackSize(int slot, int amount) { return null; }
|
||||
@Override public void setInventorySlotContents(int slot, ItemStack stack) { this.slots[slot] = stack; }
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot) {
|
||||
@ -113,22 +531,11 @@ public class ContainerPneumoStorageAccess extends Container {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slot, ItemStack stack) {
|
||||
this.slots[slot] = stack;
|
||||
}
|
||||
|
||||
@Override public String getInventoryName() { return "null"; }
|
||||
@Override public boolean hasCustomInventoryName() { return false; }
|
||||
@Override public boolean isItemValidForSlot(int slot, ItemStack stack) { return false; }
|
||||
|
||||
@Override
|
||||
public void markDirty() {
|
||||
|
||||
}
|
||||
|
||||
@Override public void markDirty() { }
|
||||
@Override public boolean isUseableByPlayer(EntityPlayer player) { return true; }
|
||||
|
||||
@Override public void openInventory() { }
|
||||
@Override public void closeInventory() { }
|
||||
}
|
||||
|
||||
@ -0,0 +1,73 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.inventory.SlotPattern;
|
||||
import com.hbm.tileentity.network.pneumatic.TileEntityPneumoStorageExporter;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerPneumoStorageExporter extends ContainerBase {
|
||||
|
||||
public ContainerPneumoStorageExporter(InventoryPlayer invPlayer, TileEntityPneumoStorageExporter exporter) {
|
||||
super(invPlayer, exporter);
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
this.addSlotToContainer(new SlotPattern(exporter, i, 17 + (i % 3) * 18, 17 + (i / 3) * 18).allowStackSize());
|
||||
}
|
||||
|
||||
addTakeOnlySlots(exporter, 9, 80, 17, 3, 3);
|
||||
playerInv(invPlayer, 103);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack slotClick(int index, int button, int mode, EntityPlayer player) {
|
||||
|
||||
//L/R: 0
|
||||
//M3: 3
|
||||
//SHIFT: 1
|
||||
//DRAG: 5
|
||||
|
||||
if(index < 0 || index >= 9) {
|
||||
return super.slotClick(index, button, mode, player);
|
||||
}
|
||||
|
||||
Slot slot = this.getSlot(index);
|
||||
ItemStack ret = null;
|
||||
ItemStack held = player.inventory.getItemStack();
|
||||
|
||||
if(slot.getHasStack()) ret = slot.getStack().copy();
|
||||
slot.putStack(held);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||
ItemStack slotOriginal = null;
|
||||
Slot slot = (Slot) this.inventorySlots.get(index);
|
||||
|
||||
if(slot != null && slot.getHasStack()) {
|
||||
ItemStack slotStack = slot.getStack();
|
||||
slotOriginal = slotStack.copy();
|
||||
|
||||
if(index <= tile.getSizeInventory() - 1) {
|
||||
if(!this.mergeItemStack(slotStack, tile.getSizeInventory(), this.inventorySlots.size(), true)) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
if(slotStack.stackSize == 0) {
|
||||
slot.putStack(null);
|
||||
} else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
|
||||
slot.onPickupFromSlot(player, slotStack);
|
||||
}
|
||||
|
||||
return slotOriginal;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.tileentity.network.pneumatic.TileEntityPneumoStorageImporter;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
public class ContainerPneumoStorageImporter extends ContainerBase {
|
||||
|
||||
public ContainerPneumoStorageImporter(InventoryPlayer invPlayer, TileEntityPneumoStorageImporter importer) {
|
||||
super(invPlayer, importer);
|
||||
|
||||
addSlots(importer, 0, 62, 17, 3, 3);
|
||||
playerInv(invPlayer, 103);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.inventory.SlotPattern;
|
||||
import com.hbm.tileentity.network.pneumatic.TileEntityPneumoStorageMono;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerPneumoStorageMono extends ContainerBase {
|
||||
|
||||
public ContainerPneumoStorageMono(InventoryPlayer invPlayer, TileEntityPneumoStorageMono storage) {
|
||||
super(invPlayer, storage);
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
this.addSlotToContainer(new SlotPattern(storage, i, 8, 17 + i * 18));
|
||||
}
|
||||
|
||||
playerInv(invPlayer, 99);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slot) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack slotClick(int index, int button, int mode, EntityPlayer player) {
|
||||
|
||||
//L/R: 0
|
||||
//M3: 3
|
||||
//SHIFT: 1
|
||||
//DRAG: 5
|
||||
|
||||
if(index < 0 || index >= 3) {
|
||||
return super.slotClick(index, button, mode, player);
|
||||
}
|
||||
|
||||
Slot slot = this.getSlot(index);
|
||||
TileEntityPneumoStorageMono mono = (TileEntityPneumoStorageMono) this.tile;
|
||||
if(mono.amounts[index] > 0 && slot.getHasStack()) return null;
|
||||
|
||||
ItemStack ret = null;
|
||||
ItemStack held = player.inventory.getItemStack();
|
||||
|
||||
if(slot.getHasStack()) ret = slot.getStack().copy();
|
||||
slot.putStack(held);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public interface ICustomPayloadReceiver {
|
||||
|
||||
public void acceptData(Side side, int windowsId, NBTTagCompound data);
|
||||
}
|
||||
@ -412,7 +412,7 @@ public class Fluids {
|
||||
CONCRETE = new FluidType("CONCRETE", 0xA2A2A2, 0, 0, 0, EnumSymbol.NONE).addTraits(LIQUID);
|
||||
DHC = new FluidType("DHC", 0xD2AFFF, 0, 0, 0, EnumSymbol.NONE).addTraits(GASEOUS);
|
||||
AIRBLAST = new FluidType("AIRBLAST", 0xFFDADA, 0, 3, 0, EnumSymbol.NONE).setTemp(1_200).addTraits(GASEOUS);
|
||||
FLUE = new FluidType(155, "FLUE", 0x131313, 1, 4, 1, EnumSymbol.NONE).addContainers(new CD_Gastank(0xFF4545, 0xFFE97F)).addTraits(new FT_Flammable(10_000), GASEOUS, new FT_Polluting().burn(PollutionType.SOOT, SOOT_GAS).release(PollutionType.SOOT, SOOT_GAS * 25));
|
||||
FLUE = new FluidType(155, "FLUE", 0x131313, 1, 4, 1, EnumSymbol.NONE).addContainers(new CD_Gastank(0xFF4545, 0xFFE97F)).addTraits(new FT_Flammable(25_000), GASEOUS, new FT_Polluting().burn(PollutionType.SOOT, SOOT_GAS).release(PollutionType.SOOT, SOOT_GAS * 25));
|
||||
|
||||
// ^ ^ ^ ^ ^ ^ ^ ^
|
||||
//ADD NEW FLUIDS HERE
|
||||
|
||||
@ -44,7 +44,7 @@ public class GUICrystallizer extends GuiInfoContainer {
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = this.acidomatic.hasCustomInventoryName() ? this.acidomatic.getInventoryName() : I18n.format(this.acidomatic.getInventoryName());
|
||||
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(name, 70 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
|
||||
95
src/main/java/com/hbm/inventory/gui/GUIDiode.java
Normal file
95
src/main/java/com/hbm/inventory/gui/GUIDiode.java
Normal file
@ -0,0 +1,95 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import com.hbm.blocks.network.CableDiode.TileEntityDiode;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toserver.NBTControlPacket;
|
||||
import com.hbm.util.EnumUtil;
|
||||
|
||||
import api.hbm.energymk2.IEnergyReceiverMK2.ConnectionPriority;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GUIDiode extends GuiScreen {
|
||||
|
||||
protected final TileEntityDiode diode;
|
||||
|
||||
private GuiTextField textThroughput;
|
||||
private GuiButton buttonPriority;
|
||||
private int priority;
|
||||
|
||||
public GUIDiode(TileEntityDiode diode) {
|
||||
this.diode = diode;
|
||||
this.priority = diode.priority.ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
Keyboard.enableRepeatEvents(true);
|
||||
|
||||
textThroughput = new GuiTextField(fontRendererObj, this.width / 2 - 150, 100, 90, 20);
|
||||
textThroughput.setText("" + diode.limit);
|
||||
textThroughput.setMaxStringLength(11);
|
||||
|
||||
buttonPriority = new GuiButton(0, this.width / 2 + 20, 100, 90, 20, diode.priority.name());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
||||
drawDefaultBackground();
|
||||
|
||||
drawString(fontRendererObj, "Throughput:", this.width / 2 - 150, 80, 0xA0A0A0);
|
||||
drawString(fontRendererObj, "(max. 10,000,000,000 HE)", this.width / 2 - 150, 90, 0xA0A0A0);
|
||||
textThroughput.drawTextBox();
|
||||
|
||||
drawString(fontRendererObj, "Priority:", this.width / 2 + 20, 80, 0xA0A0A0);
|
||||
buttonPriority.drawButton(mc, mouseX, mouseY);
|
||||
|
||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGuiClosed() {
|
||||
Keyboard.enableRepeatEvents(false);
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setByte("priority", (byte) priority);
|
||||
|
||||
try { data.setLong("limit", Long.parseLong(textThroughput.getText())); } catch(Exception ex) {}
|
||||
|
||||
PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, diode.xCoord, diode.yCoord, diode.zCoord));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char typedChar, int keyCode) {
|
||||
super.keyTyped(typedChar, keyCode);
|
||||
if(textThroughput.textboxKeyTyped(typedChar, keyCode)) return;
|
||||
|
||||
if(keyCode == 1 || keyCode == this.mc.gameSettings.keyBindInventory.getKeyCode()) {
|
||||
this.mc.thePlayer.closeScreen();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) {
|
||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
textThroughput.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
|
||||
if(buttonPriority.mousePressed(mc, mouseX, mouseY)) {
|
||||
this.priority++;
|
||||
if(priority >= ConnectionPriority.values().length) priority = 0;
|
||||
buttonPriority.displayString = EnumUtil.grabEnumSafely(ConnectionPriority.class, priority).name();
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
}
|
||||
}
|
||||
|
||||
@Override public boolean doesGuiPauseGame() { return false; }
|
||||
}
|
||||
@ -41,7 +41,7 @@ public class GUIFusionTorus extends GuiInfoContainer {
|
||||
torus.coolantTanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 188, guiTop + 46, 16, 52);
|
||||
torus.coolantTanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 206, guiTop + 46, 16, 52);
|
||||
|
||||
FusionRecipe recipe = (FusionRecipe) FusionRecipes.INSTANCE.recipeNameMap.get(this.torus.fusionModule.recipe);
|
||||
FusionRecipe recipe = (FusionRecipe) this.torus.fusionModule.getRecipe();
|
||||
|
||||
if(recipe != null) {
|
||||
drawCustomInfoStat(mouseX, mouseY, guiLeft + 43, guiTop + 115, 18, 18, mouseX, mouseY, EnumChatFormatting.GREEN + "-> " + EnumChatFormatting.RESET + BobMathUtil.getShortNumber(torus.klystronEnergy) + "KyU / " + BobMathUtil.getShortNumber(recipe.ignitionTemp) + "KyU");
|
||||
@ -70,7 +70,7 @@ public class GUIFusionTorus extends GuiInfoContainer {
|
||||
protected void mouseClicked(int x, int y, int button) {
|
||||
super.mouseClicked(x, y, button);
|
||||
|
||||
if(this.checkClick(x, y, 43, 80, 18, 18)) GUIScreenRecipeSelector.openSelector(FusionRecipes.INSTANCE, torus, torus.fusionModule.recipe, 0, ItemBlueprints.grabPool(torus.slots[1]), this);
|
||||
if(this.checkClick(x, y, 43, 80, 18, 18)) GUIScreenRecipeSelector.openSelector(FusionRecipes.INSTANCE, torus, torus.fusionModule.getRecipeName(), 0, ItemBlueprints.grabPool(torus.slots[1]), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -103,7 +103,7 @@ public class GUIFusionTorus extends GuiInfoContainer {
|
||||
drawTexturedModalRect(guiLeft + 98, guiTop + 91, 0, 250, j, 6);
|
||||
}
|
||||
|
||||
FusionRecipe recipe = FusionRecipes.INSTANCE.recipeNameMap.get(torus.fusionModule.recipe);
|
||||
FusionRecipe recipe = (FusionRecipe) torus.fusionModule.getRecipe();
|
||||
|
||||
// power LED
|
||||
if(recipe != null && torus.power >= recipe.power) drawTexturedModalRect(guiLeft + 160, guiTop + 115, 246, 14, 8, 8);
|
||||
|
||||
@ -47,8 +47,8 @@ public class GUIMachineAssemblyFactory extends GuiInfoContainer {
|
||||
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 234, guiTop + 18, 16, 92, assembler.power, assembler.maxPower);
|
||||
|
||||
for(int i = 0; i < 4; i++) if(guiLeft + 6 + (i % 2) * 109 <= mouseX && guiLeft + 6 + (i % 2) * 109 + 18 > mouseX && guiTop + 53 + (i / 2) * 56 < mouseY && guiTop + 53 + (i / 2) * 56 + 18 >= mouseY) {
|
||||
if(this.assembler.assemblerModule[i].recipe != null && AssemblyMachineRecipes.INSTANCE.recipeNameMap.containsKey(this.assembler.assemblerModule[i].recipe)) {
|
||||
GenericRecipe recipe = (GenericRecipe) AssemblyMachineRecipes.INSTANCE.recipeNameMap.get(this.assembler.assemblerModule[i].recipe);
|
||||
if(this.assembler.assemblerModule[i].getRecipeName() != null && AssemblyMachineRecipes.INSTANCE.recipeNameMap.containsKey(this.assembler.assemblerModule[i].getRecipeName())) {
|
||||
GenericRecipe recipe = this.assembler.assemblerModule[i].getRecipe();
|
||||
GUIElements.drawHoveringTextRecipe(recipe.print(), mouseX, mouseY, this.fontRendererObj, itemRender, this.width, this.height);
|
||||
} else {
|
||||
this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("gui.recipe.setRecipe"), mouseX, mouseY);
|
||||
@ -60,7 +60,7 @@ public class GUIMachineAssemblyFactory extends GuiInfoContainer {
|
||||
protected void mouseClicked(int x, int y, int button) {
|
||||
super.mouseClicked(x, y, button);
|
||||
|
||||
for(int i = 0; i < 4; i++) if(this.checkClick(x, y, 6 + (i % 2) * 109, 53 + (i / 2) * 56, 18, 18)) GUIScreenRecipeSelector.openSelector(AssemblyMachineRecipes.INSTANCE, assembler, assembler.assemblerModule[i].recipe, i, ItemBlueprints.grabPool(assembler.slots[4 + i * 14]), this);
|
||||
for(int i = 0; i < 4; i++) if(this.checkClick(x, y, 6 + (i % 2) * 109, 53 + (i / 2) * 56, 18, 18)) GUIScreenRecipeSelector.openSelector(AssemblyMachineRecipes.INSTANCE, assembler, assembler.assemblerModule[i].getRecipeName(), i, ItemBlueprints.grabPool(assembler.slots[4 + i * 14]), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -87,7 +87,7 @@ public class GUIMachineAssemblyFactory extends GuiInfoContainer {
|
||||
}
|
||||
|
||||
for(int g = 0; g < 4; g++) {
|
||||
GenericRecipe recipe = AssemblyMachineRecipes.INSTANCE.recipeNameMap.get(assembler.assemblerModule[g].recipe);
|
||||
GenericRecipe recipe = assembler.assemblerModule[g].getRecipe();
|
||||
|
||||
/// LEFT LED
|
||||
if(assembler.didProcess[g]) {
|
||||
@ -105,7 +105,7 @@ public class GUIMachineAssemblyFactory extends GuiInfoContainer {
|
||||
}
|
||||
|
||||
for(int g = 0; g < 4; g++) {
|
||||
GenericRecipe recipe = AssemblyMachineRecipes.INSTANCE.recipeNameMap.get(assembler.assemblerModule[g].recipe);
|
||||
GenericRecipe recipe = assembler.assemblerModule[g].getRecipe();
|
||||
|
||||
this.renderItem(recipe != null ? recipe.getIcon() : TEMPLATE_FOLDER, 7 + (g % 2) * 109, 54 + (g / 2) * 56);
|
||||
|
||||
|
||||
@ -42,8 +42,8 @@ public class GUIMachineAssemblyMachine extends GuiInfoContainer {
|
||||
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 18, 16, 61, assembler.power, assembler.maxPower);
|
||||
|
||||
if(guiLeft + 7 <= mouseX && guiLeft + 7 + 18 > mouseX && guiTop + 125 < mouseY && guiTop + 125 + 18 >= mouseY) {
|
||||
if(this.assembler.assemblerModule.recipe != null && AssemblyMachineRecipes.INSTANCE.recipeNameMap.containsKey(this.assembler.assemblerModule.recipe)) {
|
||||
GenericRecipe recipe = (GenericRecipe) AssemblyMachineRecipes.INSTANCE.recipeNameMap.get(this.assembler.assemblerModule.recipe);
|
||||
if(this.assembler.assemblerModule.getRecipeName() != null && AssemblyMachineRecipes.INSTANCE.recipeNameMap.containsKey(this.assembler.assemblerModule.getRecipeName())) {
|
||||
GenericRecipe recipe = this.assembler.assemblerModule.getRecipe();
|
||||
GUIElements.drawHoveringTextRecipe(recipe.print(), mouseX, mouseY, this.fontRendererObj, itemRender, this.width, this.height);
|
||||
} else {
|
||||
this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("gui.recipe.setRecipe"), mouseX, mouseY);
|
||||
@ -55,7 +55,7 @@ public class GUIMachineAssemblyMachine extends GuiInfoContainer {
|
||||
protected void mouseClicked(int x, int y, int button) {
|
||||
super.mouseClicked(x, y, button);
|
||||
|
||||
if(this.checkClick(x, y, 7, 125, 18, 18)) GUIScreenRecipeSelector.openSelector(AssemblyMachineRecipes.INSTANCE, assembler, assembler.assemblerModule.recipe, 0, ItemBlueprints.grabPool(assembler.slots[1]), this);
|
||||
if(this.checkClick(x, y, 7, 125, 18, 18)) GUIScreenRecipeSelector.openSelector(AssemblyMachineRecipes.INSTANCE, assembler, assembler.assemblerModule.getRecipeName(), 0, ItemBlueprints.grabPool(assembler.slots[1]), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -77,10 +77,10 @@ public class GUIMachineAssemblyMachine extends GuiInfoContainer {
|
||||
|
||||
if(assembler.assemblerModule.progress > 0) {
|
||||
int j = (int) Math.ceil(70 * assembler.assemblerModule.progress);
|
||||
drawTexturedModalRect(guiLeft + 62, guiTop + 126, 176, 61, j, 16);
|
||||
drawTexturedModalRect(guiLeft + 62, guiTop + 126, 176, 61 + (assembler.assemblerModule.restrictedMode ? 16 : 0), j, 16);
|
||||
}
|
||||
|
||||
GenericRecipe recipe = AssemblyMachineRecipes.INSTANCE.recipeNameMap.get(assembler.assemblerModule.recipe);
|
||||
GenericRecipe recipe = assembler.assemblerModule.getRecipe();
|
||||
|
||||
/// LEFT LED
|
||||
if(assembler.didProcess) {
|
||||
|
||||
@ -47,8 +47,8 @@ public class GUIMachineChemicalFactory extends GuiInfoContainer {
|
||||
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 224, guiTop + 18, 16, 68, chemplant.power, chemplant.maxPower);
|
||||
|
||||
for(int i = 0; i < 4; i++) if(guiLeft + 74 <= mouseX && guiLeft + 74 + 18 > mouseX && guiTop + 19 + i * 22 < mouseY && guiTop + 19 + i * 22 + 18 >= mouseY) {
|
||||
if(this.chemplant.chemplantModule[i].recipe != null && ChemicalPlantRecipes.INSTANCE.recipeNameMap.containsKey(this.chemplant.chemplantModule[i].recipe)) {
|
||||
GenericRecipe recipe = (GenericRecipe) ChemicalPlantRecipes.INSTANCE.recipeNameMap.get(this.chemplant.chemplantModule[i].recipe);
|
||||
if(this.chemplant.chemplantModule[i].getRecipeName() != null && ChemicalPlantRecipes.INSTANCE.recipeNameMap.containsKey(this.chemplant.chemplantModule[i].getRecipeName())) {
|
||||
GenericRecipe recipe = this.chemplant.chemplantModule[i].getRecipe();
|
||||
GUIElements.drawHoveringTextRecipe(recipe.print(), mouseX, mouseY, this.fontRendererObj, itemRender, this.width, this.height);
|
||||
} else {
|
||||
this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("gui.recipe.setRecipe"), mouseX, mouseY);
|
||||
@ -60,7 +60,7 @@ public class GUIMachineChemicalFactory extends GuiInfoContainer {
|
||||
protected void mouseClicked(int x, int y, int button) {
|
||||
super.mouseClicked(x, y, button);
|
||||
|
||||
for(int i = 0; i < 4; i++) if(this.checkClick(x, y, 74, 19 + i * 22, 18, 18)) GUIScreenRecipeSelector.openSelector(ChemicalPlantRecipes.INSTANCE, chemplant, chemplant.chemplantModule[i].recipe, i, ItemBlueprints.grabPool(chemplant.slots[4 + i * 7]), this);
|
||||
for(int i = 0; i < 4; i++) if(this.checkClick(x, y, 74, 19 + i * 22, 18, 18)) GUIScreenRecipeSelector.openSelector(ChemicalPlantRecipes.INSTANCE, chemplant, chemplant.chemplantModule[i].getRecipeName(), i, ItemBlueprints.grabPool(chemplant.slots[4 + i * 7]), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -87,7 +87,7 @@ public class GUIMachineChemicalFactory extends GuiInfoContainer {
|
||||
}
|
||||
|
||||
for(int g = 0; g < 4; g++) {
|
||||
GenericRecipe recipe = ChemicalPlantRecipes.INSTANCE.recipeNameMap.get(chemplant.chemplantModule[g].recipe);
|
||||
GenericRecipe recipe = chemplant.chemplantModule[g].getRecipe();
|
||||
|
||||
/// LEFT LED
|
||||
if(chemplant.didProcess[g]) {
|
||||
@ -105,7 +105,7 @@ public class GUIMachineChemicalFactory extends GuiInfoContainer {
|
||||
}
|
||||
|
||||
for(int g = 0; g < 4; g++) { // not a great way of doing it but at least we eliminate state leak bullshit
|
||||
GenericRecipe recipe = ChemicalPlantRecipes.INSTANCE.recipeNameMap.get(chemplant.chemplantModule[g].recipe);
|
||||
GenericRecipe recipe = chemplant.chemplantModule[g].getRecipe();
|
||||
|
||||
this.renderItem(recipe != null ? recipe.getIcon() : TEMPLATE_FOLDER, 75, 20 + g * 22);
|
||||
|
||||
|
||||
@ -43,8 +43,8 @@ public class GUIMachineChemicalPlant extends GuiInfoContainer {
|
||||
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 18, 16, 61, chemplant.power, chemplant.maxPower);
|
||||
|
||||
if(guiLeft + 7 <= mouseX && guiLeft + 7 + 18 > mouseX && guiTop + 125 < mouseY && guiTop + 125 + 18 >= mouseY) {
|
||||
if(this.chemplant.chemplantModule.recipe != null && ChemicalPlantRecipes.INSTANCE.recipeNameMap.containsKey(this.chemplant.chemplantModule.recipe)) {
|
||||
GenericRecipe recipe = (GenericRecipe) ChemicalPlantRecipes.INSTANCE.recipeNameMap.get(this.chemplant.chemplantModule.recipe);
|
||||
if(this.chemplant.chemplantModule.getRecipe() != null && ChemicalPlantRecipes.INSTANCE.recipeNameMap.containsKey(this.chemplant.chemplantModule.getRecipeName())) {
|
||||
GenericRecipe recipe = this.chemplant.chemplantModule.getRecipe();
|
||||
GUIElements.drawHoveringTextRecipe(recipe.print(), mouseX, mouseY, this.fontRendererObj, itemRender, this.width, this.height);
|
||||
} else {
|
||||
this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("gui.recipe.setRecipe"), mouseX, mouseY);
|
||||
@ -56,7 +56,7 @@ public class GUIMachineChemicalPlant extends GuiInfoContainer {
|
||||
protected void mouseClicked(int x, int y, int button) {
|
||||
super.mouseClicked(x, y, button);
|
||||
|
||||
if(this.checkClick(x, y, 7, 125, 18, 18)) GUIScreenRecipeSelector.openSelector(ChemicalPlantRecipes.INSTANCE, chemplant, chemplant.chemplantModule.recipe, 0, ItemBlueprints.grabPool(chemplant.slots[1]), this);
|
||||
if(this.checkClick(x, y, 7, 125, 18, 18)) GUIScreenRecipeSelector.openSelector(ChemicalPlantRecipes.INSTANCE, chemplant, chemplant.chemplantModule.getRecipeName(), 0, ItemBlueprints.grabPool(chemplant.slots[1]), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -78,10 +78,10 @@ public class GUIMachineChemicalPlant extends GuiInfoContainer {
|
||||
|
||||
if(chemplant.chemplantModule.progress > 0) {
|
||||
int j = (int) Math.ceil(70 * chemplant.chemplantModule.progress);
|
||||
drawTexturedModalRect(guiLeft + 62, guiTop + 126, 176, 61, j, 16);
|
||||
drawTexturedModalRect(guiLeft + 62, guiTop + 126, 176, 61 + (chemplant.chemplantModule.restrictedMode ? 16 : 0), j, 16);
|
||||
}
|
||||
|
||||
GenericRecipe recipe = ChemicalPlantRecipes.INSTANCE.recipeNameMap.get(chemplant.chemplantModule.recipe);
|
||||
GenericRecipe recipe = chemplant.chemplantModule.getRecipe();
|
||||
|
||||
/// LEFT LED
|
||||
if(chemplant.didProcess) {
|
||||
|
||||
@ -47,7 +47,7 @@ public class GUIMachineCyclotron extends GuiInfoContainer {
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = this.cyclotron.hasCustomInventoryName() ? this.cyclotron.getInventoryName() : I18n.format(this.cyclotron.getInventoryName());
|
||||
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(name, 79 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 15, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIMachineEPress extends GuiInfoContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_epress.png");
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_electric_press.png");
|
||||
private TileEntityMachineEPress press;
|
||||
|
||||
public GUIMachineEPress(InventoryPlayer invPlayer, TileEntityMachineEPress tedf) {
|
||||
@ -20,21 +20,21 @@ public class GUIMachineEPress extends GuiInfoContainer {
|
||||
press = tedf;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 166;
|
||||
this.ySize = 186;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||
super.drawScreen(mouseX, mouseY, f);
|
||||
|
||||
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 17, guiTop + 69 - 52, 16, 52, press.power, press.maxPower);
|
||||
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 52 - 34, 16, 34, press.power, press.maxPower);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer( int i, int j) {
|
||||
String name = this.press.hasCustomInventoryName() ? this.press.getInventoryName() : I18n.format(this.press.getInventoryName());
|
||||
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(name, 89 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
@ -44,10 +44,10 @@ public class GUIMachineEPress extends GuiInfoContainer {
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
int i = (int) (press.power * 52 / press.maxPower);
|
||||
drawTexturedModalRect(guiLeft + 17, guiTop + 69 - i, 176, 52 - i, 16, i);
|
||||
int i = (int) (press.power * 34 / press.maxPower);
|
||||
drawTexturedModalRect(guiLeft + 152, guiTop + 52 - i, 176, 34 - i, 16, i);
|
||||
|
||||
int k = (int) (press.renderPress * 16 / press.maxPress);
|
||||
this.drawTexturedModalRect(guiLeft + 79, guiTop + 35, 192, 0, 18, k);
|
||||
this.drawTexturedModalRect(guiLeft + 18, guiTop + 33, 192, 0, 18, k);
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,35 +15,35 @@ import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
public class GUIMachineElectricFurnace extends GuiInfoContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/GUIElectricFurnace.png");
|
||||
private TileEntityMachineElectricFurnace diFurnace;
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_electric_furnace.png");
|
||||
private TileEntityMachineElectricFurnace furnace;
|
||||
|
||||
public GUIMachineElectricFurnace(InventoryPlayer invPlayer, TileEntityMachineElectricFurnace tedf) {
|
||||
super(new ContainerElectricFurnace(invPlayer, tedf));
|
||||
diFurnace = tedf;
|
||||
public GUIMachineElectricFurnace(InventoryPlayer invPlayer, TileEntityMachineElectricFurnace furnace) {
|
||||
super(new ContainerElectricFurnace(invPlayer, furnace));
|
||||
this.furnace = furnace;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 166;
|
||||
this.ySize = 186;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||
super.drawScreen(mouseX, mouseY, f);
|
||||
|
||||
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 20, guiTop + 69 - 52, 16, 52, diFurnace.power, diFurnace.maxPower);
|
||||
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 52 - 34, 16, 34, furnace.power, furnace.maxPower);
|
||||
|
||||
String[] upgradeText = new String[3];
|
||||
upgradeText[0] = I18nUtil.resolveKey("desc.gui.upgrade");
|
||||
upgradeText[1] = I18nUtil.resolveKey("desc.gui.upgrade.speed");
|
||||
upgradeText[2] = I18nUtil.resolveKey("desc.gui.upgrade.power");
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 151, guiTop + 19, 8, 8, mouseX, mouseY, upgradeText);
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 115, guiTop + 19, 8, 8, mouseX, mouseY, upgradeText);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = this.diFurnace.hasCustomInventoryName() ? this.diFurnace.getInventoryName() : I18n.format(this.diFurnace.getInventoryName());
|
||||
String name = this.furnace.hasCustomInventoryName() ? this.furnace.getInventoryName() : I18n.format(this.furnace.getInventoryName());
|
||||
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(name, 70 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
@ -58,22 +58,23 @@ public class GUIMachineElectricFurnace extends GuiInfoContainer {
|
||||
//if initial ZE is still present, it'll be used instead
|
||||
//works so that container packets can still be used
|
||||
//efficiency!
|
||||
if(diFurnace.isInvalid() && diFurnace.getWorldObj().getTileEntity(diFurnace.xCoord, diFurnace.yCoord, diFurnace.zCoord) instanceof TileEntityMachineElectricFurnace)
|
||||
diFurnace = (TileEntityMachineElectricFurnace) diFurnace.getWorldObj().getTileEntity(diFurnace.xCoord, diFurnace.yCoord, diFurnace.zCoord);
|
||||
if(furnace.isInvalid() && furnace.getWorldObj().getTileEntity(furnace.xCoord, furnace.yCoord, furnace.zCoord) instanceof TileEntityMachineElectricFurnace)
|
||||
furnace = (TileEntityMachineElectricFurnace) furnace.getWorldObj().getTileEntity(furnace.xCoord, furnace.yCoord, furnace.zCoord);
|
||||
|
||||
if(diFurnace.hasPower()) {
|
||||
int i = (int)diFurnace.getPowerScaled(52);
|
||||
drawTexturedModalRect(guiLeft + 20, guiTop + 69 - i, 200, 52 - i, 16, i);
|
||||
if(furnace.hasPower()) {
|
||||
int p = (int) furnace.getPowerScaled(34);
|
||||
drawTexturedModalRect(guiLeft + 152, guiTop + 52 - p, 176, 64 - p, 16, p);
|
||||
}
|
||||
|
||||
if(diFurnace.getWorldObj().getBlock(diFurnace.xCoord, diFurnace.yCoord, diFurnace.zCoord) == ModBlocks.machine_electric_furnace_on) {
|
||||
drawTexturedModalRect(guiLeft + 56, guiTop + 35, 176, 0, 16, 16);
|
||||
if(furnace.getWorldObj().getBlock(furnace.xCoord, furnace.yCoord, furnace.zCoord) == ModBlocks.machine_electric_furnace_on) {
|
||||
drawTexturedModalRect(guiLeft + 45, guiTop + 20, 192, 12, 18, 16);
|
||||
drawTexturedModalRect(guiLeft + 46, guiTop + 47, 192, 28, 18, 16);
|
||||
}
|
||||
|
||||
int j1 = diFurnace.getProgressScaled(24);
|
||||
drawTexturedModalRect(guiLeft + 79, guiTop + 34, 176, 17, j1 + 1, 17);
|
||||
int p = furnace.getProgressScaled(28);
|
||||
drawTexturedModalRect(guiLeft + 43, guiTop + 36, 176, 0, p, 12);
|
||||
|
||||
this.drawInfoPanel(guiLeft + 151, guiTop + 19, 8, 8, 8);
|
||||
this.drawInfoPanel(guiLeft + 115, guiTop + 19, 8, 8, 8);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -21,19 +21,19 @@ public class GUIMachineOilWell extends GuiInfoContainer {
|
||||
super(new ContainerMachineOilWell(invPlayer, tedf));
|
||||
derrick = tedf;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 166;
|
||||
this.xSize = 184;
|
||||
this.ySize = 190;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||
super.drawScreen(mouseX, mouseY, f);
|
||||
|
||||
derrick.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 62, guiTop + 69 - 52, 16, 52);
|
||||
derrick.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 107, guiTop + 69 - 52, 16, 52);
|
||||
derrick.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 76, guiTop + 74 - 52, 16, 52);
|
||||
derrick.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 112, guiTop + 74 - 52, 16, 52);
|
||||
|
||||
if(derrick.tanks.length >= 3) {
|
||||
derrick.tanks[2].renderTankInfo(this, mouseX, mouseY, guiLeft + 40, guiTop + 37, 6, 32);
|
||||
derrick.tanks[2].renderTankInfo(this, mouseX, mouseY, guiLeft + 54, guiTop + 45, 6, 32);
|
||||
}
|
||||
|
||||
String[] upgradeText = new String[4];
|
||||
@ -41,17 +41,17 @@ public class GUIMachineOilWell extends GuiInfoContainer {
|
||||
upgradeText[1] = I18nUtil.resolveKey("desc.gui.upgrade.speed");
|
||||
upgradeText[2] = I18nUtil.resolveKey("desc.gui.upgrade.power");
|
||||
upgradeText[3] = I18nUtil.resolveKey("desc.gui.upgrade.afterburner");
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 156, guiTop + 3, 8, 8, mouseX, mouseY, upgradeText);
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 160, guiTop + 21, 8, 8, mouseX, mouseY, upgradeText);
|
||||
|
||||
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 8, guiTop + 17, 16, 34, derrick.power, derrick.getMaxPower());
|
||||
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 8, guiTop + 22, 16, 34, derrick.power, derrick.getMaxPower());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer( int i, int j) {
|
||||
String name = this.derrick.hasCustomInventoryName() ? this.derrick.getInventoryName() : I18n.format(this.derrick.getInventoryName());
|
||||
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
this.fontRendererObj.drawString(name, 126 - this.fontRendererObj.getStringWidth(name) / 2, 10, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 12, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -61,24 +61,24 @@ public class GUIMachineOilWell extends GuiInfoContainer {
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
int i = (int)(derrick.getPower() * 34 / derrick.getMaxPower());
|
||||
drawTexturedModalRect(guiLeft + 8, guiTop + 51 - i, 176, 34 - i, 16, i);
|
||||
drawTexturedModalRect(guiLeft + 8, guiTop + 56 - i, 184, 34 - i, 16, i);
|
||||
|
||||
int k = derrick.indicator;
|
||||
|
||||
if(k != 0)
|
||||
drawTexturedModalRect(guiLeft + 35, guiTop + 17, 176 + (k - 1) * 16, 52, 16, 16);
|
||||
drawTexturedModalRect(guiLeft + 50, guiTop + 19, 184 + (k - 1) * 14, 34, 14, 14);
|
||||
|
||||
if(derrick.tanks.length < 3) {
|
||||
drawTexturedModalRect(guiLeft + 34, guiTop + 36, 192, 0, 18, 34);
|
||||
drawTexturedModalRect(guiLeft + 48, guiTop + 44, 200, 0, 18, 34);
|
||||
}
|
||||
|
||||
derrick.tanks[0].renderTank(guiLeft + 62, guiTop + 69, this.zLevel, 16, 52);
|
||||
derrick.tanks[1].renderTank(guiLeft + 107, guiTop + 69, this.zLevel, 16, 52);
|
||||
derrick.tanks[0].renderTank(guiLeft + 76, guiTop + 74, this.zLevel, 16, 52);
|
||||
derrick.tanks[1].renderTank(guiLeft + 112, guiTop + 74, this.zLevel, 16, 52);
|
||||
|
||||
if(derrick.tanks.length > 2) {
|
||||
derrick.tanks[2].renderTank(guiLeft + 40, guiTop + 69, this.zLevel, 6, 32);
|
||||
derrick.tanks[2].renderTank(guiLeft + 54, guiTop + 77, this.zLevel, 6, 32);
|
||||
}
|
||||
|
||||
this.drawInfoPanel(guiLeft + 156, guiTop + 3, 8, 8, 8);
|
||||
this.drawInfoPanel(guiLeft + 160, guiTop + 21, 8, 8, 8);
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,8 +44,8 @@ public class GUIMachinePUREX extends GuiInfoContainer {
|
||||
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 18, 16, 61, purex.power, purex.maxPower);
|
||||
|
||||
if(guiLeft + 7 <= mouseX && guiLeft + 7 + 18 > mouseX && guiTop + 125 < mouseY && guiTop + 125 + 18 >= mouseY) {
|
||||
if(this.purex.purexModule.recipe != null && PUREXRecipes.INSTANCE.recipeNameMap.containsKey(this.purex.purexModule.recipe)) {
|
||||
GenericRecipe recipe = (GenericRecipe) PUREXRecipes.INSTANCE.recipeNameMap.get(this.purex.purexModule.recipe);
|
||||
if(this.purex.purexModule.getRecipe() != null && PUREXRecipes.INSTANCE.recipeNameMap.containsKey(this.purex.purexModule.getRecipe())) {
|
||||
GenericRecipe recipe = this.purex.purexModule.getRecipe();
|
||||
GUIElements.drawHoveringTextRecipe(recipe.print(), mouseX, mouseY, this.fontRendererObj, itemRender, this.width, this.height);
|
||||
} else {
|
||||
this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("gui.recipe.setRecipe"), mouseX, mouseY);
|
||||
@ -57,7 +57,7 @@ public class GUIMachinePUREX extends GuiInfoContainer {
|
||||
protected void mouseClicked(int x, int y, int button) {
|
||||
super.mouseClicked(x, y, button);
|
||||
|
||||
if(this.checkClick(x, y, 7, 125, 18, 18)) GUIScreenRecipeSelector.openSelector(PUREXRecipes.INSTANCE, purex, purex.purexModule.recipe, 0, ItemBlueprints.grabPool(purex.slots[1]), this);
|
||||
if(this.checkClick(x, y, 7, 125, 18, 18)) GUIScreenRecipeSelector.openSelector(PUREXRecipes.INSTANCE, purex, purex.purexModule.getRecipeName(), 0, ItemBlueprints.grabPool(purex.slots[1]), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -82,7 +82,7 @@ public class GUIMachinePUREX extends GuiInfoContainer {
|
||||
drawTexturedModalRect(guiLeft + 62, guiTop + 126, 176, 61, j, 16);
|
||||
}
|
||||
|
||||
GenericRecipe recipe = PUREXRecipes.INSTANCE.recipeNameMap.get(purex.purexModule.recipe);
|
||||
GenericRecipe recipe = purex.purexModule.getRecipe();
|
||||
|
||||
/// LEFT LED
|
||||
if(purex.didProcess) {
|
||||
|
||||
@ -47,15 +47,15 @@ public class GUIMachinePlasmaForge extends GuiInfoContainer {
|
||||
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 18, 16, 62, forge.power, forge.maxPower);
|
||||
|
||||
if(guiLeft + 7 <= mouseX && guiLeft + 7 + 18 > mouseX && guiTop + 80 < mouseY && guiTop + 80 + 18 >= mouseY) {
|
||||
if(this.forge.plasmaModule.recipe != null && PlasmaForgeRecipes.INSTANCE.recipeNameMap.containsKey(this.forge.plasmaModule.recipe)) {
|
||||
GenericRecipe recipe = (GenericRecipe) PlasmaForgeRecipes.INSTANCE.recipeNameMap.get(this.forge.plasmaModule.recipe);
|
||||
if(this.forge.plasmaModule.getRecipeName() != null && PlasmaForgeRecipes.INSTANCE.recipeNameMap.containsKey(this.forge.plasmaModule.getRecipeName())) {
|
||||
GenericRecipe recipe = this.forge.plasmaModule.getRecipe();
|
||||
GUIElements.drawHoveringTextRecipe(recipe.print(), mouseX, mouseY, this.fontRendererObj, itemRender, this.width, this.height);
|
||||
} else {
|
||||
this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("gui.recipe.setRecipe"), mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
|
||||
PlasmaForgeRecipe recipe = (PlasmaForgeRecipe) PlasmaForgeRecipes.INSTANCE.recipeNameMap.get(forge.plasmaModule.recipe);
|
||||
PlasmaForgeRecipe recipe = (PlasmaForgeRecipe) forge.plasmaModule.getRecipe();
|
||||
|
||||
if(recipe != null) {
|
||||
drawCustomInfoStat(mouseX, mouseY, guiLeft + 25, guiTop + 115, 18, 18, mouseX, mouseY, EnumChatFormatting.GREEN + "-> " + EnumChatFormatting.RESET + BobMathUtil.getShortNumber(forge.plasmaEnergySync) + "TU / " + BobMathUtil.getShortNumber(recipe.ignitionTemp) + "TU");
|
||||
@ -102,7 +102,7 @@ public class GUIMachinePlasmaForge extends GuiInfoContainer {
|
||||
protected void mouseClicked(int x, int y, int button) {
|
||||
super.mouseClicked(x, y, button);
|
||||
|
||||
if(this.checkClick(x, y, 7, 80, 18, 18)) GUIScreenRecipeSelector.openSelector(PlasmaForgeRecipes.INSTANCE, forge, forge.plasmaModule.recipe, 0, ItemBlueprints.grabPool(forge.slots[1]), this);
|
||||
if(this.checkClick(x, y, 7, 80, 18, 18)) GUIScreenRecipeSelector.openSelector(PlasmaForgeRecipes.INSTANCE, forge, forge.plasmaModule.getRecipeName(), 0, ItemBlueprints.grabPool(forge.slots[1]), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -127,7 +127,7 @@ public class GUIMachinePlasmaForge extends GuiInfoContainer {
|
||||
drawTexturedModalRect(guiLeft + 62, guiTop + 81, 176, 62, j, 16);
|
||||
}
|
||||
|
||||
PlasmaForgeRecipe recipe = (PlasmaForgeRecipe) PlasmaForgeRecipes.INSTANCE.recipeNameMap.get(forge.plasmaModule.recipe);
|
||||
PlasmaForgeRecipe recipe = (PlasmaForgeRecipe) forge.plasmaModule.getRecipe();
|
||||
|
||||
/// LEFT LED
|
||||
if(forge.didProcess) {
|
||||
|
||||
@ -42,8 +42,8 @@ public class GUIMachinePrecAss extends GuiInfoContainer {
|
||||
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 18, 16, 61, assembler.power, assembler.maxPower);
|
||||
|
||||
if(guiLeft + 7 <= mouseX && guiLeft + 7 + 18 > mouseX && guiTop + 125 < mouseY && guiTop + 125 + 18 >= mouseY) {
|
||||
if(this.assembler.assemblerModule.recipe != null && PrecAssRecipes.INSTANCE.recipeNameMap.containsKey(this.assembler.assemblerModule.recipe)) {
|
||||
GenericRecipe recipe = (GenericRecipe) PrecAssRecipes.INSTANCE.recipeNameMap.get(this.assembler.assemblerModule.recipe);
|
||||
if(this.assembler.assemblerModule.getRecipeName() != null && PrecAssRecipes.INSTANCE.recipeNameMap.containsKey(this.assembler.assemblerModule.getRecipeName())) {
|
||||
GenericRecipe recipe = this.assembler.assemblerModule.getRecipe();
|
||||
GUIElements.drawHoveringTextRecipe(recipe.print(), mouseX, mouseY, this.fontRendererObj, itemRender, this.width, this.height);
|
||||
} else {
|
||||
this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("gui.recipe.setRecipe"), mouseX, mouseY);
|
||||
@ -55,7 +55,7 @@ public class GUIMachinePrecAss extends GuiInfoContainer {
|
||||
protected void mouseClicked(int x, int y, int button) {
|
||||
super.mouseClicked(x, y, button);
|
||||
|
||||
if(this.checkClick(x, y, 7, 125, 18, 18)) GUIScreenRecipeSelector.openSelector(PrecAssRecipes.INSTANCE, assembler, assembler.assemblerModule.recipe, 0, ItemBlueprints.grabPool(assembler.slots[1]), this);
|
||||
if(this.checkClick(x, y, 7, 125, 18, 18)) GUIScreenRecipeSelector.openSelector(PrecAssRecipes.INSTANCE, assembler, assembler.assemblerModule.getRecipeName(), 0, ItemBlueprints.grabPool(assembler.slots[1]), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -80,7 +80,7 @@ public class GUIMachinePrecAss extends GuiInfoContainer {
|
||||
drawTexturedModalRect(guiLeft + 62, guiTop + 126, 176, 61, j, 16);
|
||||
}
|
||||
|
||||
GenericRecipe recipe = PrecAssRecipes.INSTANCE.recipeNameMap.get(assembler.assemblerModule.recipe);
|
||||
GenericRecipe recipe = assembler.assemblerModule.getRecipe();
|
||||
|
||||
/// LEFT LED
|
||||
if(assembler.didProcess) {
|
||||
|
||||
@ -14,7 +14,7 @@ import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIMachinePress extends GuiInfoContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_press.png");
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_press.png");
|
||||
private TileEntityMachinePress press;
|
||||
|
||||
public GUIMachinePress(InventoryPlayer invPlayer, TileEntityMachinePress tedf) {
|
||||
@ -22,7 +22,7 @@ public class GUIMachinePress extends GuiInfoContainer {
|
||||
press = tedf;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 202;
|
||||
this.ySize = 214;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -37,7 +37,7 @@ public class GUIMachinePress extends GuiInfoContainer {
|
||||
protected void drawGuiContainerForegroundLayer( int i, int j) {
|
||||
String name = this.press.hasCustomInventoryName() ? this.press.getInventoryName() : I18n.format(this.press.getInventoryName());
|
||||
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 5, 0xffffff);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
@ -48,11 +48,11 @@ public class GUIMachinePress extends GuiInfoContainer {
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
if(press.burnTime >= 20) {
|
||||
this.drawTexturedModalRect(guiLeft + 27, guiTop + 36, 0, 202, 14, 14);
|
||||
this.drawTexturedModalRect(guiLeft + 26, guiTop + 36, 0, 214, 14, 14);
|
||||
}
|
||||
|
||||
int k = (int) (press.renderPress * 16 / press.maxPress);
|
||||
this.drawTexturedModalRect(guiLeft + 79, guiTop + 35, 14, 202, 18, k);
|
||||
this.drawTexturedModalRect(guiLeft + 79, guiTop + 35, 15, 214, 18, k);
|
||||
|
||||
double i = (double) press.speed / (double) press.maxSpeed;
|
||||
GUIElements.drawSmoothGauge(guiLeft + 34, guiTop + 25, this.zLevel, i, 5, 2, 1, 0x7f0000);
|
||||
|
||||
@ -52,7 +52,7 @@ public class GUIMachineRTG extends GuiInfoContainer {
|
||||
protected void drawGuiContainerForegroundLayer( int i, int j) {
|
||||
String name = this.rtg.hasCustomInventoryName() ? this.rtg.getInventoryName() : I18n.format(this.rtg.getInventoryName());
|
||||
|
||||
this.fontRendererObj.drawString(name, 13 ,7, 10925486);
|
||||
this.fontRendererObj.drawString(name, 60 - this.fontRendererObj.getStringWidth(name) / 2, 7, 10925486);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIMachineShredder extends GuiInfoContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_shredder.png");
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_shredder.png");
|
||||
private TileEntityMachineShredder diFurnace;
|
||||
|
||||
public GUIMachineShredder(InventoryPlayer invPlayer, TileEntityMachineShredder tedf) {
|
||||
@ -45,7 +45,7 @@ public class GUIMachineShredder extends GuiInfoContainer {
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = this.diFurnace.hasCustomInventoryName() ? this.diFurnace.getInventoryName() : I18n.format(this.diFurnace.getInventoryName());
|
||||
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(name, 106 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ package com.hbm.inventory.gui;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.inventory.gui.element.GUIElements;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerMachineTurbineGas;
|
||||
@ -25,96 +26,95 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIMachineTurbineGas extends GuiInfoContainer {
|
||||
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/generators/gui_turbinegas.png");
|
||||
private static ResourceLocation gauge_tex = new ResourceLocation(RefStrings.MODID + ":textures/gui/gauges/button_big.png");
|
||||
private TileEntityMachineTurbineGas turbinegas;
|
||||
|
||||
|
||||
int yStart;
|
||||
int slidStart;
|
||||
|
||||
|
||||
public GUIMachineTurbineGas(InventoryPlayer invPlayer, TileEntityMachineTurbineGas te) {
|
||||
super(new ContainerMachineTurbineGas(invPlayer, te));
|
||||
turbinegas = te;
|
||||
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 223;
|
||||
}
|
||||
|
||||
|
||||
//@Override
|
||||
protected void mouseClicked(int x, int y, int i) {
|
||||
|
||||
|
||||
super.mouseClicked(x, y, i);
|
||||
|
||||
|
||||
slidStart = turbinegas.powerSliderPos;
|
||||
yStart = y;
|
||||
|
||||
|
||||
if(Math.sqrt(Math.pow((x - guiLeft - 88), 2) + Math.pow((y - guiTop - 40), 2)) <= 8) { //start-stop circular button
|
||||
|
||||
|
||||
if(turbinegas.counter == 0 || turbinegas.counter == 579) {
|
||||
|
||||
|
||||
int state = turbinegas.state - 1; //offline(0) to startup(-1), online(1) to offline(0)
|
||||
|
||||
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setInteger("state", state);
|
||||
PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, turbinegas.xCoord, turbinegas.yCoord, turbinegas.zCoord));
|
||||
}
|
||||
else
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(turbinegas.state == 1 && x > guiLeft + 74 && x <= guiLeft + 74 + 29 && y >= guiTop + 86 && y < guiTop + 86 + 13) { //auto mode button
|
||||
|
||||
|
||||
boolean automode = !turbinegas.autoMode;
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setBoolean("autoMode", automode);
|
||||
PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, turbinegas.xCoord, turbinegas.yCoord, turbinegas.zCoord));
|
||||
}
|
||||
|
||||
|
||||
if(turbinegas.state == 1 && (guiTop + 97 - slidStart) <= yStart && (guiTop + 103 - slidStart) > yStart && guiLeft + 36 < x && guiLeft + 52 >= x) { //power slider
|
||||
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setBoolean("autoMode", false); //if you click the slider with automode on, turns off automode
|
||||
PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, turbinegas.xCoord, turbinegas.yCoord, turbinegas.zCoord));
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void mouseClickMove(int x, int y, int p_146273_3_, long p_146273_4_) {
|
||||
|
||||
|
||||
super.mouseClickMove(x, y, p_146273_3_, p_146273_4_);
|
||||
|
||||
|
||||
int slidPos = turbinegas.powerSliderPos;
|
||||
|
||||
|
||||
if(!turbinegas.autoMode && turbinegas.state == 1 && guiLeft + 36 < x && guiLeft + 52 >= x && guiTop + 37 < y && guiTop + 103 >= y) { //area in which the slider can move
|
||||
|
||||
|
||||
if((guiTop + 97 - slidStart) <= yStart && (guiTop + 103 - slidStart) > yStart) {
|
||||
slidPos = guiTop + 100 - y;
|
||||
|
||||
if(slidPos > 60)
|
||||
|
||||
if(slidPos > 60)
|
||||
slidPos = 60;
|
||||
else if(slidPos < 0)
|
||||
slidPos = 0;
|
||||
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setDouble("slidPos", slidPos);
|
||||
PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, turbinegas.xCoord, turbinegas.yCoord, turbinegas.zCoord));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||
|
||||
|
||||
super.drawScreen(mouseX, mouseY, f);
|
||||
|
||||
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 26, guiTop + 108, 142, 16, turbinegas.power, turbinegas.getMaxPower());
|
||||
|
||||
|
||||
if(turbinegas.state == 1) {
|
||||
double consumption = turbinegas.fuelMaxCons.containsKey(turbinegas.tanks[0].getTankType()) ? turbinegas.fuelMaxCons.get(turbinegas.tanks[0].getTankType()) : 5D;
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 36, guiTop + 36, 16, 66, mouseX, mouseY, new String[] {"Fuel consumption: " + 20 * (consumption * 0.05D + consumption * turbinegas.throttle / 100) + " mb/s"});
|
||||
@ -122,20 +122,20 @@ public class GUIMachineTurbineGas extends GuiInfoContainer {
|
||||
else {
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 36, guiTop + 36, 16, 66, mouseX, mouseY, new String[] {"Generator offline"});
|
||||
}
|
||||
|
||||
|
||||
if(turbinegas.temp >= 20)
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 133, guiTop + 23, 8, 72, mouseX, mouseY, new String[] {"Temperature: " + (turbinegas.temp) + "°C"});
|
||||
else
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 133, guiTop + 23, 8, 72, mouseX, mouseY, new String[] {"Temperature: 20°C"});
|
||||
|
||||
|
||||
turbinegas.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 8, guiTop + 16, 16, 48);
|
||||
turbinegas.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 8, guiTop + 70, 16, 32);
|
||||
turbinegas.tanks[2].renderTankInfo(this, mouseX, mouseY, guiLeft + 147, guiTop + 61, 16, 36);
|
||||
turbinegas.tanks[3].renderTankInfo(this, mouseX, mouseY, guiLeft + 147, guiTop + 21, 16, 36);
|
||||
|
||||
|
||||
String[] info = I18nUtil.resolveKeyArray("desc.gui.turbinegas.automode");
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 34, 16, 16, guiLeft - 8, guiTop + 44 + 16, info);
|
||||
|
||||
|
||||
List<String> fuels = new ArrayList();
|
||||
fuels.add(I18nUtil.resolveKey("desc.gui.turbinegas.fuels"));
|
||||
for(FluidType type : Fluids.getInNiceOrder()) {
|
||||
@ -144,25 +144,25 @@ public class GUIMachineTurbineGas extends GuiInfoContainer {
|
||||
}
|
||||
}
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 34 + 16, 16, 16, guiLeft - 8, guiTop + 44 + 16, fuels);
|
||||
|
||||
|
||||
String[] warning = I18nUtil.resolveKeyArray("desc.gui.turbinegas.warning");
|
||||
if(turbinegas.tanks[0].getFill() < 5000 || turbinegas.tanks[1].getFill() < 1000)
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 34 + 32, 16, 16, guiLeft - 8, guiTop + 44 + 16, warning);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float iinterpolation, int x, int y) {
|
||||
|
||||
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); //the main thing
|
||||
|
||||
|
||||
if(turbinegas.autoMode)
|
||||
drawTexturedModalRect(guiLeft + 74, guiTop + 86, 194, 11, 29, 13); //auto mode button
|
||||
else
|
||||
drawTexturedModalRect(guiLeft + 74, guiTop + 86, 194, 24, 29, 13);
|
||||
|
||||
|
||||
switch(turbinegas.state) {
|
||||
case 0:
|
||||
drawTexturedModalRect(guiLeft + 80, guiTop + 32, 178, 38, 16, 16); //red button
|
||||
@ -178,36 +178,36 @@ public class GUIMachineTurbineGas extends GuiInfoContainer {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
drawTexturedModalRect(guiLeft + 36, guiTop + 97 - turbinegas.powerSliderPos, 178, 0, 16, 6); //power slider
|
||||
|
||||
|
||||
int power = (int) (turbinegas.power * 142 / turbinegas.maxPower); //power storage
|
||||
drawTexturedModalRect(guiLeft + 26, guiTop + 109, 0, 223, power, 16);
|
||||
|
||||
drawRPMGauge(turbinegas.rpm);
|
||||
|
||||
GUIElements.drawSmoothTextureModalCircle(guiLeft + 64, guiTop + 16, this.zLevel, 176, 64, 48, 48, (double) turbinegas.rpm / 100);
|
||||
drawThermometer(turbinegas.temp);
|
||||
|
||||
|
||||
this.drawInfoPanel(guiLeft - 16, guiTop + 34, 16, 16, 3); //info
|
||||
this.drawInfoPanel(guiLeft - 16, guiTop + 34 + 16, 16, 16, 2); //fuels
|
||||
if((turbinegas.tanks[0].getFill()) < 5000 || turbinegas.tanks[1].getFill() < 1000)
|
||||
this.drawInfoPanel(guiLeft - 16, guiTop + 34 + 32, 16, 16, 7);
|
||||
if(turbinegas.tanks[0].getFill() == 0 || turbinegas.tanks[1].getFill() == 0)
|
||||
this.drawInfoPanel(guiLeft - 16, guiTop + 34 + 32, 16, 16, 6);
|
||||
|
||||
|
||||
turbinegas.tanks[0].renderTank(guiLeft + 8, guiTop + 65, this.zLevel, 16, 48);
|
||||
turbinegas.tanks[1].renderTank(guiLeft + 8, guiTop + 103, this.zLevel, 16, 32);
|
||||
turbinegas.tanks[2].renderTank(guiLeft + 147, guiTop + 98, this.zLevel, 16, 36);
|
||||
turbinegas.tanks[3].renderTank(guiLeft + 147, guiTop + 58, this.zLevel, 16, 36);
|
||||
}
|
||||
|
||||
|
||||
int numberToDisplay = 0; //for startup
|
||||
int digitNumber = 0;
|
||||
int digitNumber = 0;
|
||||
int exponent = 0;
|
||||
|
||||
|
||||
public void displayStartup() {
|
||||
|
||||
|
||||
if(numberToDisplay < 8888888 && turbinegas.counter < 60) { //48 frames needed to complete
|
||||
|
||||
|
||||
digitNumber++;
|
||||
if(digitNumber == 9) {
|
||||
digitNumber = 1;
|
||||
@ -215,66 +215,66 @@ public class GUIMachineTurbineGas extends GuiInfoContainer {
|
||||
}
|
||||
numberToDisplay += Math.pow(10, exponent);
|
||||
}
|
||||
|
||||
|
||||
if(turbinegas.counter > 50)
|
||||
numberToDisplay = 0;
|
||||
|
||||
|
||||
drawPowerMeterDisplay(numberToDisplay);
|
||||
}
|
||||
|
||||
|
||||
protected void drawPowerMeterDisplay(int number) { //display code
|
||||
|
||||
|
||||
int firstDigitX = 65;
|
||||
int firstDigitY = 62;
|
||||
|
||||
|
||||
int[] digit = new int[7];
|
||||
|
||||
|
||||
for(int i = 6; i >= 0; i--) { //creates an array of digits that represent the numbers
|
||||
|
||||
|
||||
digit[i] = (int) (number % 10);
|
||||
|
||||
|
||||
number = number / 10;
|
||||
|
||||
|
||||
drawTexturedModalRect(guiLeft + firstDigitX + i * 7, guiTop + 9 + firstDigitY, 194 + digit[i] * 5, 0, 5, 11);
|
||||
}
|
||||
|
||||
|
||||
int uselessZeros = 0;
|
||||
|
||||
|
||||
for(int i = 0; i < 6; i++) { //counts how much zeros there are before the number, to display 57 instead of 000057
|
||||
|
||||
|
||||
if(digit[i] == 0)
|
||||
uselessZeros++;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
for(int i = 0; i < uselessZeros; i++) { //turns off the useless zeros
|
||||
|
||||
|
||||
drawTexturedModalRect(guiLeft + firstDigitX + i * 7, guiTop + 9 + firstDigitY, 244, 0, 5, 11);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void drawThermometer(int temp) {
|
||||
|
||||
|
||||
int xPos = guiLeft + 136;
|
||||
int yPos = guiTop + 28;
|
||||
|
||||
|
||||
int width = 2;
|
||||
int height = 64;
|
||||
|
||||
|
||||
int maxTemp = 800;
|
||||
|
||||
|
||||
double uMin = (176D / 256D);
|
||||
double uMax = (178D / 256D);
|
||||
double vMin = ((64D - 64 * temp / maxTemp) / 256D);
|
||||
double vMax = (64D / 256D);
|
||||
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
|
||||
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV(xPos, yPos + height, this.zLevel, uMin, vMax);
|
||||
tessellator.addVertexWithUV(xPos + width, yPos + height, this.zLevel, uMax, vMax);
|
||||
@ -284,41 +284,41 @@ public class GUIMachineTurbineGas extends GuiInfoContainer {
|
||||
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
|
||||
protected void drawRPMGauge(int position) {
|
||||
|
||||
int xPos = guiLeft + 64;
|
||||
int yPos = guiTop + 16;
|
||||
|
||||
int squareSideLenght = 48;
|
||||
|
||||
double uMin = (48D / 4848D) * position;
|
||||
double uMax = (48D / 4848D) * (position + 1);
|
||||
double vMin = 0D;
|
||||
double vMax = 1D;
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(gauge_tex); //long boi
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV(xPos, yPos + squareSideLenght, this.zLevel, uMin, vMax);
|
||||
tessellator.addVertexWithUV(xPos + squareSideLenght, yPos + squareSideLenght, this.zLevel, uMax, vMax);
|
||||
tessellator.addVertexWithUV(xPos + squareSideLenght, yPos, this.zLevel,uMax, vMin);
|
||||
tessellator.addVertexWithUV(xPos, yPos, this.zLevel, uMin, vMin);
|
||||
tessellator.draw();
|
||||
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
|
||||
// protected void drawRPMGauge(int position) {
|
||||
//
|
||||
// int xPos = guiLeft + 64;
|
||||
// int yPos = guiTop + 16;
|
||||
//
|
||||
// int squareSideLenght = 48;
|
||||
//
|
||||
// double uMin = (48D / 4848D) * position;
|
||||
// double uMax = (48D / 4848D) * (position + 1);
|
||||
// double vMin = 0D;
|
||||
// double vMax = 1D;
|
||||
//
|
||||
// GL11.glEnable(GL11.GL_BLEND);
|
||||
//
|
||||
// Minecraft.getMinecraft().getTextureManager().bindTexture(gauge_tex); //long boi
|
||||
//
|
||||
// Tessellator tessellator = Tessellator.instance;
|
||||
//
|
||||
// tessellator.startDrawingQuads();
|
||||
// tessellator.addVertexWithUV(xPos, yPos + squareSideLenght, this.zLevel, uMin, vMax);
|
||||
// tessellator.addVertexWithUV(xPos + squareSideLenght, yPos + squareSideLenght, this.zLevel, uMax, vMax);
|
||||
// tessellator.addVertexWithUV(xPos + squareSideLenght, yPos, this.zLevel,uMax, vMin);
|
||||
// tessellator.addVertexWithUV(xPos, yPos, this.zLevel, uMin, vMin);
|
||||
// tessellator.draw();
|
||||
//
|
||||
// GL11.glDisable(GL11.GL_BLEND);
|
||||
// }
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
//useless piece of shit, at least for now
|
||||
String name = this.turbinegas.hasCustomInventoryName() ? this.turbinegas.getInventoryName() : I18n.format(this.turbinegas.getInventoryName());
|
||||
|
||||
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 94, 4210752);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user