Merge branch 'HbmMods:master' into cargo-door
29
changelog
@ -3,8 +3,35 @@
|
||||
* Watz powerplant now has OC and RoR integration
|
||||
* The automatic thresher now has a fluid port on the bottom as well
|
||||
* The foundry basins and outlet filters now use the properly translated name instead of the internal name for the material
|
||||
* Removed config for new bedrock ores
|
||||
* New ores are the default anyway and old bedrock ores are now properly deprecated
|
||||
* Existing setups will continue to work for now
|
||||
* Old bedrock ore items still exist but are no longer listed in the creative tab
|
||||
* Removed recipe for the small single block steam turbine
|
||||
* We have steam engines and industrial turbines are really not that expensive
|
||||
* "oh no, i have to build an actually good looking setup now if i want to build a zirnox!" yeah you do
|
||||
* Updated light brick texture
|
||||
* The maximum character limit on RoR channels is now the same for all RoR devices, being 15
|
||||
* This does not include special RoR interactive devices that don't use GUI text fields like the RoR terminal or the AUTOCAL units
|
||||
* Pile output rods like the bred uranium and the plutonium rods can no longer be dismantled using the anvil, the PUREX is now mandatory
|
||||
* If too many conveyor item entities intersect with one another, they explode
|
||||
* The conveyor belt the items were on is broken, preventing further item buildup
|
||||
* Items that leave the covneyor belt, usually by trying to enter a full inserter, now have a shortened lifespan of 1 minute instead of 5
|
||||
* Base steam production per consumed heat has been increased by 50% on the ZIRNOX
|
||||
* Both radioisotope cell variants have been finally removed after being deprecated for a while
|
||||
* Selfchargers now have a tooltip explaining the hazards of using them in a battery socket
|
||||
* The alternate recipe for the assembler in the assembler now uses integrated circuits instead of analog ones
|
||||
* Added an alternate chemical plant recipe that uses a smaller selection of items and ICs instead of ACs
|
||||
* Flashgold and flashlead are now made in the PUREX instead of the crafting table
|
||||
* The flashgold recipe now yields two billets instead of one
|
||||
* Slightly changed the HSS ingot texture to not look identical to steel except slightly greenish
|
||||
|
||||
## Fixed
|
||||
* Fixed AUTOCAL's number comparison functions not working with variable substitution as advertised
|
||||
* Fixed broken thorium ore centrifuging recipe shown in NEI
|
||||
* Fixed industrial turbine not properly saving its energy values, causing the flywheel to stop on relog
|
||||
* Fixed industrial turbine not properly saving its energy values, causing the flywheel to stop on relog
|
||||
* Fixed lapis dust to cobalt shredder recipe not using oredict
|
||||
* Fixed AUTOCAL's file opening buttons not working on some systems, it will fall back to opening the folder instead
|
||||
* Fixed some recipes not using ore dict when they should
|
||||
* Fixed `anyBismoid` group not being a proper group, causing other mods' bismuth and arsenic to not be included
|
||||
* Fixed RoR gauge not using SI suffixes on values below 0
|
||||
@ -30,6 +30,9 @@ public interface ISlotMonitorProvider {
|
||||
/** 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,7 +103,7 @@ public class SlotMonitor {
|
||||
else if(nbt != null && stack.hasTagCompound() && !nbt.equals(stack.stackTagCompound)) hasTypeChanged = true;
|
||||
}
|
||||
|
||||
if(hasTypeChanged) {
|
||||
if(hasTypeChanged || forceTypeUpdate) {
|
||||
|
||||
// remove from all existing monitors
|
||||
Iterator<CacheSlot> iterator = viewedBy.iterator();
|
||||
@ -134,6 +136,7 @@ public class SlotMonitor {
|
||||
}
|
||||
}
|
||||
|
||||
forceTypeUpdate = false;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -90,6 +90,7 @@ public class StackCache {
|
||||
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;
|
||||
@ -195,9 +196,11 @@ public class StackCache {
|
||||
}
|
||||
|
||||
public static long getStackIdentity(Item item, int meta, NBTTagCompound nbt) {
|
||||
if(item == null) return getNullIdentity();
|
||||
long identity = Item.getIdFromItem(item) * 27644437;
|
||||
identity += meta * 27644437;
|
||||
if(nbt != null) identity += nbt.toString().hashCode();
|
||||
identity += meta;
|
||||
identity *= 27644437;
|
||||
if(nbt != null) identity += nbt.hashCode();
|
||||
return identity;
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,6 +14,7 @@ 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.PneumoStorageImporter;
|
||||
import com.hbm.blocks.network.pneumatic.PneumoStorageMono;
|
||||
import com.hbm.blocks.network.pneumatic.PneumoTube;
|
||||
import com.hbm.blocks.network.pneumatic.PneumoTubePaintableBlock;
|
||||
@ -808,6 +809,7 @@ 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 fan;
|
||||
public static Block piston_inserter;
|
||||
@ -915,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;
|
||||
|
||||
@ -1841,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");
|
||||
|
||||
@ -1911,11 +1909,12 @@ 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(null).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(null).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(null).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(null).setBlockTextureName(RefStrings.MODID + ":pneumatic_storage_importer");
|
||||
|
||||
chain = new BlockChain(Material.iron).setBlockName("dungeon_chain").setHardness(0.25F).setResistance(2.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":chain");
|
||||
|
||||
@ -2350,7 +2349,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() {
|
||||
@ -3059,9 +3057,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());
|
||||
|
||||
@ -3186,6 +3182,7 @@ public class ModBlocks {
|
||||
register(pneumatic_storage_access);
|
||||
register(pneumatic_storage_clutter);
|
||||
register(pneumatic_storage_mono);
|
||||
register(pneumatic_storage_importer);
|
||||
register(fan);
|
||||
register(piston_inserter);
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@ -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,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,33 @@
|
||||
package com.hbm.blocks.network.pneumatic;
|
||||
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.network.pneumatic.TileEntityPneumoStorageImporter;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class PneumoStorageImporter extends BlockContainer {
|
||||
|
||||
public PneumoStorageImporter() {
|
||||
super(Material.iron);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityPneumoStorageImporter();
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,12 @@
|
||||
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.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@ -13,7 +18,16 @@ 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;
|
||||
}
|
||||
}
|
||||
@ -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() }));
|
||||
|
||||
@ -68,14 +68,14 @@ public class ToolRecipes {
|
||||
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 +111,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);
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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);
|
||||
@ -103,7 +101,6 @@ public class GunNPCFactory {
|
||||
bullet.spread = 0.0F;
|
||||
bullet.dmgMin = 5;
|
||||
bullet.dmgMax = 10;
|
||||
bullet.wear = 10;
|
||||
bullet.leadChance = 15;
|
||||
bullet.style = BulletConfiguration.STYLE_FLECHETTE;
|
||||
bullet.vPFX = "bluedust";
|
||||
@ -119,7 +116,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";
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -3,18 +3,23 @@ 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.interfaces.NotableComments;
|
||||
import com.hbm.inventory.SlotNonRetarded;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.ContainerCustomPayloadPacket;
|
||||
import com.hbm.packet.toclient.ContainerNBTCommsPacket;
|
||||
import com.hbm.tileentity.network.pneumatic.TileEntityPneumoStorageAccess;
|
||||
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;
|
||||
@ -22,148 +27,210 @@ 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;
|
||||
|
||||
@NotableComments // i long for the day when i never have to look at this fucking horseshit ever again
|
||||
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 String STACK_SIZE_KEY = "PNEUMO_STACK_SIZE";
|
||||
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 SlotPneumo(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));
|
||||
}
|
||||
|
||||
updateListing();
|
||||
this.detectAndSendChanges();
|
||||
}
|
||||
|
||||
public void updateListing() { // DEMO
|
||||
if(this.access.cache == null || this.access.cache.hasExpired) return;
|
||||
StackCache cache = this.access.cache;
|
||||
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 < inventory.slots.length; i++) {
|
||||
if(i < size) {
|
||||
CacheSlot cacheSlot = cacheSlots.get(i);
|
||||
if(cacheSlot.displayStack != null) {
|
||||
inventory.slots[i] = cacheSlot.displayStack.copy();
|
||||
}
|
||||
} else {
|
||||
inventory.slots[i] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 boolean canInteractWith(EntityPlayer player) {
|
||||
return access.getDistanceFrom(player.posX, player.posY, player.posZ) <= 15 * 15;
|
||||
}
|
||||
|
||||
@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) {
|
||||
boolean client = player.worldObj.isRemote;
|
||||
if(!client) return null;
|
||||
SlotPneumo slot = (SlotPneumo) this.getSlot(index);
|
||||
long hash = StackCache.getStackIdentity(slot.getStack());
|
||||
ItemStack held = player.inventory.getItemStack();
|
||||
|
||||
if(slot.getHasStack()) {
|
||||
|
||||
// left click, can't hold an item and provides a full stack to the held item
|
||||
if(leftClick || rightClick) {
|
||||
ItemStack stack = slot.getStack().copy();
|
||||
|
||||
int alreadyHeld = held == null ? 0 : held.stackSize;
|
||||
int capacity = stack.getMaxStackSize() - alreadyHeld;
|
||||
if(rightClick && capacity > 1) capacity = 1;
|
||||
int toGrab = (int) Math.min(capacity, slot.amount);
|
||||
|
||||
if(capacity > 0 && (held == null || StackCache.getStackIdentity(held) == StackCache.getStackIdentity(stack))) {
|
||||
if(client) {
|
||||
stack.stackSize = toGrab + alreadyHeld;
|
||||
player.inventory.setItemStack(stack);
|
||||
} else {
|
||||
if(this.access.cache == null || this.access.cache.hasExpired) return null;
|
||||
StackCache cache = this.access.cache;
|
||||
stack.stackSize = (int) cache.consumeItemsAndReturnQuantity(stack, toGrab) + alreadyHeld;
|
||||
player.inventory.setItemStack(stack);
|
||||
}
|
||||
|
||||
return null; // for some reason we gotta terminate here and not below
|
||||
}
|
||||
|
||||
// shift click, works even if there's a held stack, serverside only and the nwe just sync
|
||||
} else if(shiftClick && !client) {
|
||||
ItemStack stack = slot.getStack().copy();
|
||||
if(this.access.cache == null || this.access.cache.hasExpired) return null;
|
||||
StackCache cache = this.access.cache;
|
||||
int originalStacksize = (int) Math.min(stack.getMaxStackSize(), slot.amount);
|
||||
stack.stackSize = originalStacksize;
|
||||
ItemStack ret = InventoryUtil.tryAddItemToInventory(player.inventory.mainInventory, stack);
|
||||
int remainder = ret == null ? 0 : ret.stackSize;
|
||||
int itemsUsed = originalStacksize - remainder;
|
||||
cache.consumeItemsAndReturnQuantity(stack, itemsUsed);
|
||||
detectAndSendChanges();
|
||||
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(held != null) {
|
||||
int toDeposit = rightClick ? 1 : held.stackSize;
|
||||
player.inventory.getItemStack().stackSize -= toDeposit;
|
||||
if(player.inventory.getItemStack().stackSize <= 0) player.inventory.setItemStack(null);
|
||||
if(this.access.cache == null || this.access.cache.hasExpired) return null;
|
||||
StackCache cache = this.access.cache;
|
||||
int remainder = (int) cache.addItemsAndReturnQuantity(held, toDeposit);
|
||||
if(remainder > 0) {
|
||||
ItemStack copy = held.copy();
|
||||
copy.stackSize = remainder;
|
||||
InventoryUtil.tryAddItemToInventory(player.inventory.mainInventory, copy);
|
||||
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.stackSize <= 0) held = null;
|
||||
this.player.inventory.setItemStack(held);
|
||||
sendClickToServer(ClickType.RIGHT_CLICK, hash);
|
||||
return null;
|
||||
}
|
||||
|
||||
return slot.getHasStack() ? slot.getStack().copy() : 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()) {
|
||||
@ -179,36 +246,25 @@ public class ContainerPneumoStorageAccess extends Container implements ICustomPa
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
return super.slotClick(index, button, mode, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCraftingToCrafters(ICrafting crafting) {
|
||||
super.addCraftingToCrafters(crafting);
|
||||
}
|
||||
|
||||
/** Used only on the client side to set the contents of a slot after a sync */
|
||||
@Override
|
||||
public void putStackInSlot(int index, ItemStack slot) {
|
||||
this.getSlot(index).putStack(slot);
|
||||
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];
|
||||
|
||||
/**
|
||||
* All syncing is done using the ICrafting interface (which only EntityPlayerMP implements), each single slot change is one entire fucking
|
||||
* packet that is sent like a massive pile of pricks to each client. Who cares, right. Issue is, this interface only supports sending of
|
||||
* ItemStacks and integer values with integer keys for the progress bars. We need longs which are indexed, so at least an extra byte along
|
||||
* with that. After some fucking about I decided, well vanilla container code is complete fucking shit anyway, why bother with any of that?
|
||||
* Instead, we just skip all the syncing for that and use our custom crap packet. Depending on whether the stack, the count, or both has changed,
|
||||
* we send the requested data in a single packet.
|
||||
*/
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
this.updateListing();
|
||||
|
||||
// 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++) {
|
||||
@ -225,80 +281,209 @@ public class ContainerPneumoStorageAccess extends Container implements ICustomPa
|
||||
}
|
||||
}
|
||||
|
||||
// custom horseshit scum fuck
|
||||
boolean isServer = !this.access.getWorldObj().isRemote;
|
||||
|
||||
NBTTagList list = new NBTTagList();
|
||||
|
||||
if(this.access.cache != null && !this.access.cache.hasExpired) for(int i = 0; i < GRID_SIZE; i++) {
|
||||
PneumoMesageType msg = null;
|
||||
SlotPneumo slot = (SlotPneumo) this.inventorySlots.get(i);
|
||||
ItemStack actualStack = slot.getStack();
|
||||
long cachedSize = slot.amount;
|
||||
CacheSlot cacheSlot = actualStack != null ? this.access.cache.getSlotFromStack(actualStack) : null;
|
||||
long actualSize = cacheSlot != null ? cacheSlot.stacksize : 0;
|
||||
if(actualSize <= 0) actualStack = null;
|
||||
ItemStack cachedStack = (ItemStack) this.inventoryItemStacks.get(i);
|
||||
|
||||
if(!ItemStack.areItemStacksEqual(cachedStack, actualStack)) msg = PneumoMesageType.UPDATE_TYPE;
|
||||
|
||||
if(cachedSize != actualSize || actualSize > 0 /* HACK: solve this by moving the listing change to the container class and writing the correct amounts on init */) {
|
||||
if(msg == PneumoMesageType.UPDATE_TYPE) msg = PneumoMesageType.UPDATE_ALL;
|
||||
if(msg == null) msg = PneumoMesageType.UPDATE_COUNT;
|
||||
}
|
||||
|
||||
if(msg != null) {
|
||||
cachedStack = actualStack == null ? null : actualStack.copy();
|
||||
this.inventoryItemStacks.set(i, cachedStack);
|
||||
slot.amount = actualSize;
|
||||
|
||||
NBTTagCompound listEntry = new NBTTagCompound();
|
||||
listEntry.setByte(KEY_TYPE, (byte) msg.ordinal());
|
||||
listEntry.setByte(KEY_SLOT_INDEX, (byte) i);
|
||||
if(msg == PneumoMesageType.UPDATE_ALL || msg == PneumoMesageType.UPDATE_COUNT) {
|
||||
listEntry.setLong(KEY_LONG_COUNT, actualSize);
|
||||
}
|
||||
if(msg == PneumoMesageType.UPDATE_ALL || msg == PneumoMesageType.UPDATE_TYPE) if(actualStack != null) actualStack.writeToNBT(listEntry);
|
||||
|
||||
list.appendTag(listEntry);
|
||||
}
|
||||
}
|
||||
|
||||
if(list.tagCount() > 0) {
|
||||
NBTTagCompound masterTag = new NBTTagCompound();
|
||||
masterTag.setTag("list", list);
|
||||
for(Object o : this.crafters) {
|
||||
if(o instanceof EntityPlayerMP) {
|
||||
EntityPlayerMP playerMP = (EntityPlayerMP) o;
|
||||
PacketDispatcher.wrapper.sendTo(new ContainerCustomPayloadPacket(playerMP.currentWindowId, masterTag), playerMP);
|
||||
}
|
||||
}
|
||||
if(isServer) {
|
||||
checkAndSyncCache();
|
||||
} else {
|
||||
rebuildClientIndex();
|
||||
}
|
||||
}
|
||||
|
||||
public static final String KEY_TYPE = "t";
|
||||
public static final String KEY_SLOT_INDEX = "s";
|
||||
public static final String KEY_LONG_COUNT = "lc";
|
||||
public static enum PneumoMesageType {
|
||||
UPDATE_COUNT,
|
||||
UPDATE_TYPE,
|
||||
UPDATE_ALL;
|
||||
@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(int windowId, NBTTagCompound data) {
|
||||
public void acceptData(Side side, int windowId, NBTTagCompound data) {
|
||||
if(windowId != this.windowId) return;
|
||||
|
||||
NBTTagList list = data.getTagList("list", 10);
|
||||
|
||||
for(int i = 0; i < list.tagCount(); i++) {
|
||||
NBTTagCompound listEntry = list.getCompoundTagAt(i);
|
||||
PneumoMesageType msg = EnumUtil.grabEnumSafely(PneumoMesageType.class, listEntry.getByte(KEY_TYPE));
|
||||
int slotIndex = listEntry.getByte(KEY_SLOT_INDEX);
|
||||
SlotPneumo slot = (SlotPneumo) this.inventorySlots.get(slotIndex);
|
||||
if(msg == PneumoMesageType.UPDATE_ALL || msg == PneumoMesageType.UPDATE_COUNT) slot.amount = listEntry.getLong(KEY_LONG_COUNT);
|
||||
if(msg == PneumoMesageType.UPDATE_ALL || msg == PneumoMesageType.UPDATE_TYPE) slot.putStack(ItemStack.loadItemStackFromNBT(listEntry));
|
||||
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) {
|
||||
@ -332,7 +517,7 @@ public class ContainerPneumoStorageAccess extends Container implements ICustomPa
|
||||
|
||||
@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; }
|
||||
|
||||
|
||||
@ -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,52 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,9 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public interface ICustomPayloadReceiver {
|
||||
|
||||
public void acceptData(int windowsId, NBTTagCompound data);
|
||||
public void acceptData(Side side, int windowsId, NBTTagCompound data);
|
||||
}
|
||||
|
||||
@ -2,8 +2,9 @@ package com.hbm.inventory.gui;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import static com.hbm.inventory.gui.element.GUIElements.*;
|
||||
import com.hbm.inventory.container.ContainerPneumoStorageAccess;
|
||||
@ -15,43 +16,131 @@ import com.hbm.util.BobMathUtil;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIPneumoStorageAccess extends GuiInfoContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/storage/gui_pneumatic_access.png");
|
||||
protected TileEntityPneumoStorageAccess access;
|
||||
protected ContainerPneumoStorageAccess container;
|
||||
protected GuiTextField search;
|
||||
|
||||
protected int scrollIndex = 0;
|
||||
protected int scrollBounds = 1;
|
||||
protected boolean wasClicking = false;
|
||||
protected boolean draggingScroll = false;
|
||||
protected boolean wasMouseinGUI = false;
|
||||
|
||||
protected static int sorting = 0;
|
||||
protected static boolean startFocussed = false;
|
||||
|
||||
public GUIPneumoStorageAccess(InventoryPlayer invPlayer, TileEntityPneumoStorageAccess access) {
|
||||
super(new ContainerPneumoStorageAccess(invPlayer, access));
|
||||
this.container = (ContainerPneumoStorageAccess) this.inventorySlots;
|
||||
this.access = access;
|
||||
|
||||
this.xSize = 176;
|
||||
this.xSize = 176 + 34;
|
||||
this.ySize = 251;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
Keyboard.enableRepeatEvents(true);
|
||||
search = new GuiTextField(this.fontRendererObj, guiLeft + 45 + 34, guiTop + 127, 86, 12);
|
||||
search.setTextColor(0xffffff);
|
||||
search.setDisabledTextColour(0xa0a0a0);
|
||||
search.setEnableBackgroundDrawing(false);
|
||||
search.setMaxStringLength(50);
|
||||
search.setText("");
|
||||
|
||||
if(this.startFocussed) search.setFocused(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int x, int y, float interp) {
|
||||
|
||||
this.wasMouseinGUI = this.checkClick(x, y, 0, 0, xSize, ySize);
|
||||
|
||||
this.scrollBounds = (int) Math.ceil(container.getStackCount() / 8D - 6D);
|
||||
if(this.scrollBounds < 1) this.scrollBounds = 1;
|
||||
if(this.scrollIndex < 0) this.setScroll(0);
|
||||
if(this.scrollIndex > scrollBounds) this.setScroll(scrollBounds);
|
||||
|
||||
boolean isClicking = Mouse.isButtonDown(0);
|
||||
if(!isClicking) this.draggingScroll = false;
|
||||
|
||||
if(!wasClicking && isClicking && guiLeft + 153 + 34 <= x && guiLeft + 153 + 34 + 14 > x && guiTop + 16 < y && guiTop + 16 + 108 >= y) {
|
||||
draggingScroll = true;
|
||||
}
|
||||
|
||||
if(draggingScroll) {
|
||||
int range = 92; // 106 scroll bar size, -7 pixels on top and bottom
|
||||
int sY = MathHelper.clamp_int(y - guiTop - 24, 0, 92);
|
||||
double scrollFrac = (double) sY / (double) range;
|
||||
int row = (int) Math.round(scrollBounds * scrollFrac);
|
||||
this.setScroll(row);
|
||||
}
|
||||
|
||||
this.wasClicking = isClicking;
|
||||
|
||||
super.drawScreen(x, y, interp);
|
||||
|
||||
//TODO localization
|
||||
this.drawCustomInfoStat(x, y, guiLeft + 7, guiTop + 7, 18, 18, x, y, "Sorting: " + EnumChatFormatting.YELLOW + "Amount");
|
||||
this.drawCustomInfoStat(x, y, guiLeft + 7, guiTop + 25, 18, 18, x, y, "Sorting: " + EnumChatFormatting.YELLOW + "Item ID");
|
||||
this.drawCustomInfoStat(x, y, guiLeft + 7, guiTop + 43, 18, 18, x, y, "Sorting: " + EnumChatFormatting.YELLOW + "Name");
|
||||
this.drawCustomInfoStat(x, y, guiLeft + 7, guiTop + 61, 18, 18, x, y, "Sorting: " + EnumChatFormatting.YELLOW + "Internal Name");
|
||||
|
||||
this.drawCustomInfoStat(x, y, guiLeft + 7, guiTop + 79, 18, 18, x, y, "Focus search by default: " + (this.startFocussed ? EnumChatFormatting.GREEN + "ON" : EnumChatFormatting.RED + "OFF"));
|
||||
this.drawCustomInfoStat(x, y, guiLeft + 7, guiTop + 97, 18, 18, x, y, "Inlude tooltips in search: " + (this.container.detailedSearch ? EnumChatFormatting.GREEN + "ON" : EnumChatFormatting.RED + "OFF"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int x, int y, int i) {
|
||||
super.mouseClicked(x, y, i);
|
||||
|
||||
if(this.checkClick(x, y, 7, 7, 18, 18)) { this.click(); this.sorting = 0; this.scrollIndex = 0; this.container.setSorter(this.container.SORT_BY_STACK_SIZE); }
|
||||
if(this.checkClick(x, y, 7, 25, 18, 18)) { this.click(); this.sorting = 1; this.scrollIndex = 0; this.container.setSorter(this.container.SORT_BY_ID); }
|
||||
if(this.checkClick(x, y, 7, 43, 18, 18)) { this.click(); this.sorting = 2; this.scrollIndex = 0; this.container.setSorter(this.container.SORT_BY_LOCALIZED); }
|
||||
if(this.checkClick(x, y, 7, 61, 18, 18)) { this.click(); this.sorting = 3; this.scrollIndex = 0; this.container.setSorter(this.container.SORT_BY_INTERNAL); }
|
||||
|
||||
if(this.checkClick(x, y, 7, 79, 18, 18)) { this.click(); this.startFocussed = !this.startFocussed; }
|
||||
if(this.checkClick(x, y, 7, 97, 18, 18)) { this.click(); this.container.detailedSearch = !this.container.detailedSearch; container.setSearchString(search.getText()); }
|
||||
|
||||
search.mouseClicked(x, y, i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMouseInput() {
|
||||
|
||||
int scrollDir = Mouse.getEventDWheel();
|
||||
|
||||
if(scrollDir != 0 && wasMouseinGUI) {
|
||||
|
||||
if(scrollDir > 0) scrollDir = 1;
|
||||
if(scrollDir < 0) scrollDir = -1;
|
||||
this.setScroll(this.getScroll() - scrollDir);
|
||||
return;
|
||||
}
|
||||
|
||||
super.handleMouseInput();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = "container.pneumoStorageAccess";
|
||||
String name = I18n.format("container.pneumoStorageAccess");
|
||||
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 5, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
this.fontRendererObj.drawString(name, 34 + 176 / 2 - this.fontRendererObj.getStringWidth(name) / 2, 5, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 34 + 8, this.ySize - 96 + 2, 4210752);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
@ -79,7 +168,50 @@ public class GUIPneumoStorageAccess extends GuiInfoContainer {
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
drawTexturedModalRect(guiLeft + 34, guiTop, 0, 0, 176, ySize);
|
||||
|
||||
drawTexturedModalRect(guiLeft, guiTop, 176, 15, 32, 122);
|
||||
|
||||
drawTexturedModalRect(guiLeft + 7, guiTop + 7 + this.sorting * 18, 208, 0, 18, 18);
|
||||
if(this.startFocussed) drawTexturedModalRect(guiLeft + 7, guiTop + 79, 208, 18, 18, 18);
|
||||
if(this.container.detailedSearch) drawTexturedModalRect(guiLeft + 7, guiTop + 97, 208, 18, 18, 18);
|
||||
|
||||
drawTexturedModalRect(guiLeft + 34 + getScrollBarXPos(), guiTop + getScrollBarYPos(), draggingScroll ? 188 : 176, 0, 12, 15);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0, 2, 0);
|
||||
search.drawTextBox();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public int getScrollBarXPos() {
|
||||
return 154;
|
||||
}
|
||||
|
||||
public int getScrollBarYPos() {
|
||||
int scrollArea = 106 - 15; // bar height minus the scroll knob's height
|
||||
double scrollProgress = (double) container.listingStart / (double) scrollBounds;
|
||||
if(scrollProgress > 1) {
|
||||
scrollProgress = 1;
|
||||
this.setScroll(scrollBounds);
|
||||
refreshContainer();
|
||||
}
|
||||
int scrollYPos = 17 + (int) (scrollProgress * scrollArea);
|
||||
return scrollYPos;
|
||||
}
|
||||
|
||||
public int getScroll() {
|
||||
return MathHelper.clamp_int(scrollIndex, 0, scrollBounds);
|
||||
}
|
||||
|
||||
public void setScroll(int scroll) {
|
||||
int prevScroll = getScroll();
|
||||
this.scrollIndex = MathHelper.clamp_int(scroll, 0, scrollBounds);
|
||||
if(prevScroll != this.scrollIndex) refreshContainer();
|
||||
}
|
||||
|
||||
public void refreshContainer() {
|
||||
this.mc.playerController.windowClick(this.inventorySlots.windowId, ContainerPneumoStorageAccess.SLOT_CLICK_ID_REFRESH, 0, this.scrollIndex, this.mc.thePlayer);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -98,4 +230,22 @@ public class GUIPneumoStorageAccess extends GuiInfoContainer {
|
||||
if(font == null) font = this.fontRendererObj;
|
||||
GUIElements.drawHoveringText(list, x, y, font, itemRender, width, height, STANDARD_HEADER_OFFSET, STANDARD_LINE_DIST, STANDARD_COLOR_BACKGROUND, STANDARD_COLOR_BACKGROUND, 0xD57C4F, 0xAB4223);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char c, int b) {
|
||||
|
||||
if(search.textboxKeyTyped(c, b)) {
|
||||
this.scrollIndex = 0;
|
||||
container.setSearchString(search.getText());
|
||||
return;
|
||||
}
|
||||
|
||||
super.keyTyped(c, b);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGuiClosed() {
|
||||
super.onGuiClosed();
|
||||
Keyboard.enableRepeatEvents(false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,8 +3,10 @@ package com.hbm.inventory.gui;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerPneumoStorageClutter;
|
||||
import com.hbm.inventory.gui.element.GUIElements;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.network.pneumatic.TileEntityPneumoStorageClutter;
|
||||
import com.hbm.tileentity.network.pneumatic.TileEntityPneumoTube;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
@ -27,11 +29,15 @@ public class GUIPneumoStorageClutter extends GuiInfoContainer {
|
||||
@Override
|
||||
public void drawScreen(int x, int y, float interp) {
|
||||
super.drawScreen(x, y, interp);
|
||||
|
||||
this.drawCustomInfoStat(x, y, guiLeft + 174, guiTop + 36, 20, 8, x, y, "Compressor: " + storage.compair.getPressure() + " PU", "Max range: " + TileEntityPneumoTube.getRangeFromPressure(storage.compair.getPressure()) + "m");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int x, int y, int i) {
|
||||
super.mouseClicked(x, y, i);
|
||||
|
||||
clickSendFlag(storage, x, y, 174, 36, 20, 8, "pressure");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -47,5 +53,8 @@ public class GUIPneumoStorageClutter extends GuiInfoContainer {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
drawTexturedModalRect(guiLeft + 174 + 4 * (storage.compair.getPressure() - 1), guiTop + 36, 200, 0, 4, 8);
|
||||
GUIElements.drawSmoothGauge(guiLeft + 184, guiTop + 25, this.zLevel, (double) storage.compair.getFill() / (double) storage.compair.getMaxFill(), 5, 2, 1, 0xCA6C43, 0xAB4223);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,42 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerPneumoStorageImporter;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.network.pneumatic.TileEntityPneumoStorageImporter;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIPneumoStorageImporter extends GuiContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/storage/gui_pneumatic_importer.png");
|
||||
private TileEntityPneumoStorageImporter importer;
|
||||
|
||||
public GUIPneumoStorageImporter(InventoryPlayer invPlayer, TileEntityPneumoStorageImporter importer) {
|
||||
super(new ContainerPneumoStorageImporter(invPlayer, importer));
|
||||
this.importer = importer;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 186;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = this.importer.hasCustomInventoryName() ? this.importer.getInventoryName() : I18n.format(this.importer.getInventoryName());
|
||||
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 5, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,77 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerPneumoStorageMono;
|
||||
import com.hbm.inventory.gui.element.GUIElements;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.network.pneumatic.TileEntityPneumoStorageMono;
|
||||
import com.hbm.tileentity.network.pneumatic.TileEntityPneumoTube;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIPneumoStorageMono extends GuiInfoContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/storage/gui_pneumatic_mono.png");
|
||||
protected TileEntityPneumoStorageMono storage;
|
||||
|
||||
public GUIPneumoStorageMono(InventoryPlayer invPlayer, TileEntityPneumoStorageMono storage) {
|
||||
super(new ContainerPneumoStorageMono(invPlayer, storage));
|
||||
this.storage = storage;
|
||||
|
||||
this.xSize = 200;
|
||||
this.ySize = 181;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int x, int y, float interp) {
|
||||
super.drawScreen(x, y, interp);
|
||||
|
||||
this.drawCustomInfoStat(x, y, guiLeft + 174, guiTop + 36, 20, 8, x, y, "Compressor: " + storage.compair.getPressure() + " PU", "Max range: " + TileEntityPneumoTube.getRangeFromPressure(storage.compair.getPressure()) + "m");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int x, int y, int i) {
|
||||
super.mouseClicked(x, y, i);
|
||||
|
||||
clickSendFlag(storage, x, y, 174, 36, 20, 8, "pressure");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = this.storage.hasCustomInventoryName() ? this.storage.getInventoryName() : I18n.format(this.storage.getInventoryName());
|
||||
|
||||
this.fontRendererObj.drawString(name, 176 / 2 - this.fontRendererObj.getStringWidth(name) / 2, 5, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
|
||||
for(int k = 0; k < 3; k++) {
|
||||
if(this.storage.slots[k] != null) {
|
||||
int amount = this.storage.amounts[k];
|
||||
String percent = " (" + (((int) (amount * 1000D / (double) storage.CAPACITY)) / 10D) + "%)";
|
||||
this.fontRendererObj.drawString(String.format(Locale.US, "%,d", amount) + percent, 50, 22 + k * 18, 0x000000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
if(this.storage.slots[i] != null) {
|
||||
int bar = this.storage.amounts[i] * 124 / this.storage.CAPACITY;
|
||||
drawTexturedModalRect(guiLeft + 44, guiTop + 17 + i * 18, 0, 181, bar, 16);
|
||||
}
|
||||
}
|
||||
|
||||
drawTexturedModalRect(guiLeft + 174 + 4 * (storage.compair.getPressure() - 1), guiTop + 36, 200, 0, 4, 8);
|
||||
GUIElements.drawSmoothGauge(guiLeft + 184, guiTop + 25, this.zLevel, (double) storage.compair.getFill() / (double) storage.compair.getMaxFill(), 5, 2, 1, 0xCA6C43, 0xAB4223);
|
||||
}
|
||||
}
|
||||
@ -8,17 +8,13 @@ import com.hbm.inventory.container.ContainerPneumoTube;
|
||||
import com.hbm.inventory.gui.element.GUIElements;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.module.ModulePatternMatcher;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toserver.NBTControlPacket;
|
||||
import com.hbm.tileentity.network.pneumatic.TileEntityPneumoTube;
|
||||
import com.hbm.uninos.networkproviders.PneumaticNetwork;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
@ -68,22 +64,13 @@ public class GUIPneumoTube extends GuiInfoContainer {
|
||||
super.mouseClicked(x, y, i);
|
||||
|
||||
if(!endpointOnly) {
|
||||
click(x, y, 7, 52, 18, 18, "redstone");
|
||||
click(x, y, 6, 36, 20, 8, "pressure");
|
||||
click(x, y, 151, 16, 18, 18, "receive");
|
||||
click(x, y, 151, 52, 18, 18, "send");
|
||||
clickSendFlag(tube, x, y, 7, 52, 18, 18, "redstone");
|
||||
clickSendFlag(tube, x, y, 6, 36, 20, 8, "pressure");
|
||||
clickSendFlag(tube, x, y, 151, 16, 18, 18, "receive");
|
||||
clickSendFlag(tube, x, y, 151, 52, 18, 18, "send");
|
||||
}
|
||||
|
||||
click(x, y, 128, 30, 14, 26, "whitelist");
|
||||
}
|
||||
|
||||
public void click(int x, int y, int left, int top, int sizeX, int sizeY, String name) {
|
||||
if(checkClick(x, y, left, top, sizeX, sizeY)) {
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setBoolean(name, true);
|
||||
PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, tube.xCoord, tube.yCoord, tube.zCoord));
|
||||
}
|
||||
clickSendFlag(tube, x, y, 128, 30, 14, 26, "whitelist");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -51,7 +51,7 @@ public class GUIScreenRBMKDisplay extends GuiScreen {
|
||||
label[i] = new GuiTextField(this.fontRendererObj, guiLeft + 27 + oX, guiTop + 73 + oY + i * 54, 85 - oX * 2, 14);
|
||||
GUIScreenRBMKKeyPad.setupTextFieldStandard(label[i], 30, display.displays[i].label);
|
||||
rtty[i] = new GuiTextField(this.fontRendererObj, guiLeft + 27 + oX, guiTop + 55 + oY + i * 54, 85 - oX * 2, 14);
|
||||
GUIScreenRBMKKeyPad.setupTextFieldStandard(rtty[i], 10, display.displays[i].rtty);
|
||||
GUIScreenRBMKKeyPad.setupTextFieldStandard(rtty[i], GUIScreenRadioTorch.MAX_CHAN_LENGTH, display.displays[i].rtty);
|
||||
|
||||
active[i] = display.displays[i].active;
|
||||
polling[i] = display.displays[i].polling;
|
||||
|
||||
@ -56,7 +56,7 @@ public class GUIScreenRBMKGauge extends GuiScreen {
|
||||
label[i] = new GuiTextField(this.fontRendererObj, guiLeft + 175 + oX, guiTop + 55 + oY + i * 36, 72 - oX * 2, 14);
|
||||
GUIScreenRBMKKeyPad.setupTextFieldStandard(label[i], 15, gauge.gauges[i].label);
|
||||
rtty[i] = new GuiTextField(this.fontRendererObj, guiLeft + 27 + oX, guiTop + 73 + oY + i * 36, 72 - oX * 2, 14);
|
||||
GUIScreenRBMKKeyPad.setupTextFieldStandard(rtty[i], 10, gauge.gauges[i].rtty);
|
||||
GUIScreenRBMKKeyPad.setupTextFieldStandard(rtty[i], GUIScreenRadioTorch.MAX_CHAN_LENGTH, gauge.gauges[i].rtty);
|
||||
min[i] = new GuiTextField(this.fontRendererObj, guiLeft + 121 + oX, guiTop + 73 + oY + i * 36, 52 - oX * 2, 14);
|
||||
GUIScreenRBMKKeyPad.setupTextFieldStandard(min[i], 32, gauge.gauges[i].min + "");
|
||||
max[i] = new GuiTextField(this.fontRendererObj, guiLeft + 195 + oX, guiTop + 73 + oY + i * 36, 52 - oX * 2, 14);
|
||||
|
||||
@ -51,7 +51,7 @@ public class GUIScreenRBMKGraph extends GuiScreen {
|
||||
label[i] = new GuiTextField(this.fontRendererObj, guiLeft + 27 + oX, guiTop + 73 + oY + i * 54, 72 - oX * 2, 14);
|
||||
GUIScreenRBMKKeyPad.setupTextFieldStandard(label[i], 30, graph.graphs[i].label);
|
||||
rtty[i] = new GuiTextField(this.fontRendererObj, guiLeft + 27 + oX, guiTop + 55 + oY + i * 54, 72 - oX * 2, 14);
|
||||
GUIScreenRBMKKeyPad.setupTextFieldStandard(rtty[i], 10, graph.graphs[i].rtty);
|
||||
GUIScreenRBMKKeyPad.setupTextFieldStandard(rtty[i], GUIScreenRadioTorch.MAX_CHAN_LENGTH, graph.graphs[i].rtty);
|
||||
min[i] = new GuiTextField(this.fontRendererObj, guiLeft + 175 + oX, guiTop + 55 + oY + i * 54, 72 - oX * 2, 14);
|
||||
GUIScreenRBMKKeyPad.setupTextFieldStandard(min[i], 15, graph.graphs[i].minBound ? graph.graphs[i].min + "" : "");
|
||||
max[i] = new GuiTextField(this.fontRendererObj, guiLeft + 175 + oX, guiTop + 73 + oY + i * 54, 72 - oX * 2, 14);
|
||||
|
||||
@ -56,7 +56,7 @@ public class GUIScreenRBMKIndicator extends GuiScreen {
|
||||
label[i] = new GuiTextField(this.fontRendererObj, guiLeft + 175 + oX, guiTop + 37 + oY + i * 36, 72 - oX * 2, 14);
|
||||
GUIScreenRBMKKeyPad.setupTextFieldStandard(label[i], 15, indicator.indicators[i].label);
|
||||
rtty[i] = new GuiTextField(this.fontRendererObj, guiLeft + 27 + oX, guiTop + 55 + oY + i * 36, 72 - oX * 2, 14);
|
||||
GUIScreenRBMKKeyPad.setupTextFieldStandard(rtty[i], 10, indicator.indicators[i].rtty);
|
||||
GUIScreenRBMKKeyPad.setupTextFieldStandard(rtty[i], GUIScreenRadioTorch.MAX_CHAN_LENGTH, indicator.indicators[i].rtty);
|
||||
min[i] = new GuiTextField(this.fontRendererObj, guiLeft + 121 + oX, guiTop + 55 + oY + i * 36, 52 - oX * 2, 14);
|
||||
GUIScreenRBMKKeyPad.setupTextFieldStandard(min[i], 32, indicator.indicators[i].min + "");
|
||||
max[i] = new GuiTextField(this.fontRendererObj, guiLeft + 195 + oX, guiTop + 55 + oY + i * 36, 52 - oX * 2, 14);
|
||||
|
||||
@ -66,7 +66,7 @@ public class GUIScreenRBMKKeyPad extends GuiScreen {
|
||||
label[i] = new GuiTextField(this.fontRendererObj, guiLeft + 175 + oX, guiTop + 55 + oY + i * 36, 72 - oX * 2, 14);
|
||||
setupTextFieldStandard(label[i], 15, keypad.keys[i].label);
|
||||
rtty[i] = new GuiTextField(this.fontRendererObj, guiLeft + 27 + oX, guiTop + 73 + oY + i * 36, 72 - oX * 2, 14);
|
||||
setupTextFieldStandard(rtty[i], 10, keypad.keys[i].rtty);
|
||||
setupTextFieldStandard(rtty[i], GUIScreenRadioTorch.MAX_CHAN_LENGTH, keypad.keys[i].rtty);
|
||||
cmd[i] = new GuiTextField(this.fontRendererObj, guiLeft + 121 + oX, guiTop + 73 + oY + i * 36, 126 - oX * 2, 14);
|
||||
setupTextFieldStandard(cmd[i], 32, keypad.keys[i].command);
|
||||
|
||||
|
||||
@ -52,7 +52,7 @@ public class GUIScreenRBMKLever extends GuiScreen {
|
||||
|
||||
for(int i = 0; i < 2; i++) {
|
||||
rtty[i] = new GuiTextField(this.fontRendererObj, guiLeft + 27 + oX, guiTop + 55 + oY + i * 54, 72 - oX * 2, 14);
|
||||
GUIScreenRBMKKeyPad.setupTextFieldStandard(rtty[i], 10, lever.levers[i].rtty);
|
||||
GUIScreenRBMKKeyPad.setupTextFieldStandard(rtty[i], GUIScreenRadioTorch.MAX_CHAN_LENGTH, lever.levers[i].rtty);
|
||||
label[i] = new GuiTextField(this.fontRendererObj, guiLeft + 175 + oX, guiTop + 55 + oY + i * 54, 72 - oX * 2, 14);
|
||||
GUIScreenRBMKKeyPad.setupTextFieldStandard(label[i], 15, lever.levers[i].label);
|
||||
cmdOn[i] = new GuiTextField(this.fontRendererObj, guiLeft + 45 + oX, guiTop + 73 + oY + i * 54, 81 - oX * 2, 14);
|
||||
|
||||
@ -1,434 +1,452 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import java.awt.Desktop;
|
||||
import java.io.File;
|
||||
import java.io.PrintWriter;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toserver.NBTControlPacket;
|
||||
import com.hbm.tileentity.network.TileEntityRadioAUTOCAL;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIScreenRadioAUTOCAL extends GuiScreen {
|
||||
|
||||
protected static final ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/machine/gui_rtty_autocal.png");
|
||||
protected TileEntityRadioAUTOCAL autocal;
|
||||
|
||||
protected int xSize = 170;
|
||||
protected int ySize = 138;
|
||||
protected int guiLeft;
|
||||
protected int guiTop;
|
||||
|
||||
public GUIScreenRadioAUTOCAL(TileEntityRadioAUTOCAL autocal) {
|
||||
this.autocal = autocal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
this.guiLeft = (this.width - this.xSize) / 2;
|
||||
this.guiTop = (this.height - this.ySize) / 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||
this.drawDefaultBackground();
|
||||
this.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
this.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int x, int y, int i) {
|
||||
super.mouseClicked(x, y, i);
|
||||
|
||||
NBTTagCompound data = null;
|
||||
|
||||
if(checkClick(x, y, 8, 36, 18, 18)) { data = new NBTTagCompound(); data.setBoolean("on", true); }
|
||||
if(checkClick(x, y, 28, 36, 18, 18)) { data = new NBTTagCompound(); data.setBoolean("ignore", true); }
|
||||
if(checkClick(x, y, 48, 36, 18, 18)) { data = new NBTTagCompound(); data.setBoolean("auto", true); }
|
||||
|
||||
// open folder and generate new script file
|
||||
if(checkClick(x, y, 104, 36, 18, 18)) {
|
||||
try {
|
||||
File uploadFolder = new File(MainRegistry.configDir.getParentFile(), "hbmComputerUpload");
|
||||
File script = new File(uploadFolder, "script.txt");
|
||||
if(!uploadFolder.exists()) uploadFolder.mkdir();
|
||||
if(!script.exists()) script.createNewFile();
|
||||
script.setExecutable(false);
|
||||
Desktop.getDesktop().browse(script.toURI());
|
||||
} catch(Throwable ex) { MainRegistry.logger.error("Couldn't open link", ex); }
|
||||
}
|
||||
|
||||
// open folder and generate new doc file
|
||||
if(checkClick(x, y, 144, 36, 18, 18)) {
|
||||
try {
|
||||
File uploadFolder = new File(MainRegistry.configDir.getParentFile(), "hbmComputerUpload");
|
||||
File doc = new File(uploadFolder, "documentation.md");
|
||||
if(!uploadFolder.exists()) uploadFolder.mkdir();
|
||||
if(!doc.exists()) {
|
||||
doc.createNewFile();
|
||||
try {
|
||||
PrintWriter printer = new PrintWriter(doc, StandardCharsets.US_ASCII.name());
|
||||
for(String line : DOCS) printer.println(line);
|
||||
printer.close();
|
||||
} catch(Throwable e) { }
|
||||
}
|
||||
Desktop.getDesktop().browse(doc.toURI());
|
||||
} catch(Throwable ex) { MainRegistry.logger.error("Couldn't open link", ex); }
|
||||
}
|
||||
|
||||
if(checkClick(x, y, 84, 36, 18, 18)) {
|
||||
try {
|
||||
File uploadFolder = new File(MainRegistry.configDir.getParentFile(), "hbmComputerUpload");
|
||||
File script = new File(uploadFolder, "script.txt");
|
||||
if(!uploadFolder.exists()) uploadFolder.mkdir();
|
||||
if(!script.exists()) {
|
||||
script.createNewFile();
|
||||
script.setExecutable(false);
|
||||
return;
|
||||
}
|
||||
/*FileReader reader = new FileReader(script);
|
||||
BufferedReader buffer = new BufferedReader(reader);
|
||||
String[] lines = buffer.lines().toArray(String[]::new);
|
||||
buffer.close();
|
||||
// this is going to blow the fuck up once we hit the max packet size, but let's ignore that for now
|
||||
data = new NBTTagCompound();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for(int l = 0; l < lines.length; l++) {
|
||||
builder.append(lines[i]);
|
||||
if(l < lines.length - 1) builder.append("\n"); // yeah why the fuck not
|
||||
}
|
||||
data.setString("payload", builder.toString());*/
|
||||
byte[] bytes = Files.readAllBytes(Paths.get(script.toURI()));
|
||||
data = new NBTTagCompound();
|
||||
data.setString("payload", new String(bytes, StandardCharsets.UTF_8));
|
||||
|
||||
} catch(Throwable ex) { }
|
||||
}
|
||||
|
||||
// this thing can both upload and download files so let's be careful about this
|
||||
// the upload is simple, it's just text that is handled by the AUTOCAL, so doing anything malicious isn't more likely than with any other package
|
||||
// download is iffy, because we take text from the server, fully user-definable, and save it to disk. it's stored as a txt so accudentally running it
|
||||
// or getting it to run itself, should it be a malicious script, is unlikely. still, we want to minimized the chances as much as we can
|
||||
// option 1: set file attribute to disallow running (i.e. disable executable perm)
|
||||
// option 2: add fluff that would break scripts, however they might work. we can't change the actual lines because we want the script to be edited,
|
||||
// but we can add some extra crap that would either halt common scripting langs entirely or at least disrupt them into not functioning
|
||||
// option 3: enforce validation so only MS-ES1 script can be received by the client. this means that info such as comments or incorrectly written commands
|
||||
// are lost, however this is the safest way because it becomes impossible to send malicious code, but it also interferes with regular user operation more
|
||||
|
||||
if(data != null) {
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, autocal.xCoord, autocal.yCoord, autocal.zCoord));
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean checkClick(int x, int y, int left, int top, int sizeX, int sizeY) {
|
||||
return guiLeft + left <= x && guiLeft + left + sizeX > x && guiTop + top < y && guiTop + top + sizeY >= y;
|
||||
}
|
||||
|
||||
private void drawGuiContainerForegroundLayer(int x, int y) {
|
||||
|
||||
for(int i = 0; i < autocal.history.length; i++) {
|
||||
String line = autocal.history[i];
|
||||
if(line == null || line.isEmpty()) continue;
|
||||
this.fontRendererObj.drawString(line, guiLeft + 7, guiTop + 73 + i * 10, 0x00ff00);
|
||||
}
|
||||
|
||||
if(checkClick(x, y, 8, 36, 18, 18)) this.func_146283_a(Arrays.asList(new String[] {EnumChatFormatting.RED + "ON/OFF"}), x, y);
|
||||
if(checkClick(x, y, 28, 36, 18, 18)) this.func_146283_a(Arrays.asList(new String[] {EnumChatFormatting.RED + "Ignore Errors", "Skips instructions that error,", "leaving the computer turned on.", "May cause unintended behavior", "and inconsistencies."}), x, y);
|
||||
if(checkClick(x, y, 48, 36, 18, 18)) this.func_146283_a(Arrays.asList(new String[] {EnumChatFormatting.RED + "Automatic Reboot", "Restarts the computer automatically when", "the program stops due to an error", "or after finishing."}), x, y);
|
||||
|
||||
if(checkClick(x, y, 84, 36, 18, 18)) this.func_146283_a(Arrays.asList(new String[] {EnumChatFormatting.BLUE + "Upload Program"}), x, y);
|
||||
if(checkClick(x, y, 104, 36, 18, 18)) this.func_146283_a(Arrays.asList(new String[] {EnumChatFormatting.BLUE + "Open Program File"}), x, y);
|
||||
if(checkClick(x, y, 124, 36, 18, 18)) this.func_146283_a(Arrays.asList(new String[] {EnumChatFormatting.BLUE + "Download Program", EnumChatFormatting.RED + "Currently unsupported!"}), x, y);
|
||||
if(checkClick(x, y, 144, 36, 18, 18)) this.func_146283_a(Arrays.asList(new String[] {EnumChatFormatting.BLUE + "Open Documentation"}), x, y);
|
||||
}
|
||||
|
||||
private void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
if(autocal.isOn) drawTexturedModalRect(guiLeft + 8, guiTop + 36, xSize, 0, 18, 18);
|
||||
if(!autocal.ignoreError) drawTexturedModalRect(guiLeft + 28, guiTop + 36, xSize, 18, 18, 18);
|
||||
if(!autocal.autoReboot) drawTexturedModalRect(guiLeft + 48, guiTop + 36, xSize, 36, 18, 18);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char c, int b) {
|
||||
if(b == 1 || b == Minecraft.getMinecraft().gameSettings.keyBindInventory.getKeyCode()) {
|
||||
Minecraft.getMinecraft().thePlayer.closeScreen();
|
||||
}
|
||||
}
|
||||
|
||||
@Override public boolean doesGuiPauseGame() { return false; }
|
||||
|
||||
|
||||
public static final String[] DOCS = new String[] {
|
||||
"# AUTOCAL - The Automatic Calculator",
|
||||
"",
|
||||
"## About this document",
|
||||
"This documentation is designed to be understandable even by people with no programming background. This documentation extends to the AUTOCAL unit as well as the MS-ES1 script language it is programmed with.",
|
||||
"",
|
||||
"Read this document carefully as all the described concepts are vital for using the AUTOCAL unit.",
|
||||
"",
|
||||
"## About AUTOCAL",
|
||||
"The AUTOCAL automatic calculator is a basic machine that reads a script, line by line, and performs actions based on those lines. This means it can be programmed with behavior, doing math, and handling signals. It communicated with the outside world exclusively using Redstone-over-Radio (RoR) signals, allowing RoR to supply it with values to be processed, and returning RoR signals to be displayed or for controlling RoR receiving devices.",
|
||||
"",
|
||||
"The first button is the on/off switch. Turning the AUTOCAL unit on will start the script at the first line. If the script concludes, an error is encountered (without the \"ignore errors\" setting enabled), the `shutdown` command is used or no program is loaded to begin with, the unit will automatically power down.",
|
||||
"",
|
||||
"The second button is the \"ignore errors\" setting. The red X means the setting is disabled, if an error is encountered in the program (an unrecognized command, missing or incorrect parameters, anything the script isn't meant to handle) then the unit will shut off. Otherwise, the erroring instruction is simply skipped. This may cause undefined or unexpected behavior, however in certain circumstances this doesn't matter. It's advised to keep this turned off, as it makes it easier to find obvious errors in the script.",
|
||||
"",
|
||||
"The third button is the \"automatic reboot\" setting. If the unit is powered down, no matter the reason, it will automatically try to start again. This allows for a simple \"loop\" where the same script is repeated every time it ends by simply rebooting the AUTOCAL unit at the end. Do note that doing so will delete all saved variables, more on how variables work later.",
|
||||
"",
|
||||
"The fourth button is for uploading the script. The script is in the minecraft's install folder, under the `hbmComputerUpload` folder, named `script.txt`. Clicking this button will send the contents of this script file to the AUTOCAL unit.",
|
||||
"",
|
||||
"The fifth button is for opening the script file. If no script file exists yet, the folder and empty script will be created.",
|
||||
"",
|
||||
"The sixth button is for downloading a script file. The existing `script.txt` is deleted and replaced with the script that is loaded onto the AUTOCAL unit.",
|
||||
"",
|
||||
"The simple workflow of programming an AUTOCAL unit is therefore using button #5 to open the file, writing the program, using #4 to flash the program to the AUTOCAL unit, and then using the first button to turn it on.",
|
||||
"",
|
||||
"## About MS-ES1",
|
||||
"The script read by AUTOCAL units is written in *Machine Script - Equestrian Standard, Version 1*, or MS-ES1. MS-ES1 features named variables, value comparison, (conditional) jumping, evaluation of mathematical expressions and reading/writing of RoR signals. The speed at which lines are processed is defined by the *clock speed*, which can be defined in the script. The amount describes the number of lines processed per tick, i.e. the default clock speed of 1 means 20 lines are processed per second (there are 20 ticks in one second). The maximum clock speed is determined by the server config value `AUTOCAL_MAX_CLOCK` (default is 20, i.e. 400 per second).",
|
||||
"",
|
||||
"Example: `/ntmserver set AUTOCAL_MAX_CLOCK 10` -> Sets the max clock speed to 10.",
|
||||
"",
|
||||
"## About the Buffer",
|
||||
"The buffer is a single \"slot\" of information that can be used for many commands. Some commands produce an output which is saved to the buffer, some commands modify the contents of the buffer, and some commands use the buffer's contents. The buffer's contents can also be saved permanently as a named variable, and named variables can be written back into the buffer again if needed. The buffer persists as long as the AUTOCAL unit is running, should it restart or shut down, the buffer's contents are lost.",
|
||||
"",
|
||||
"## About Variables",
|
||||
"MS-ES1 allows named variables to be saved for later use. There is no limit to how many variables can be saved. All variables are text (\"Strings\"), however depending on the command and context, that text may be interpreted as a number (both full and decimal). Variables, much like the buffer, are also stored as long as the program is running, if the AUTOCAL unit shuts down, all stored variables are lost.",
|
||||
"",
|
||||
"## About Variable Substitution",
|
||||
"Many commands allow for *variable substitution*, i.e. a specific format can be used to insert the contents of a variable (or multiple!) into a parameter. This allows for the quick use of variables, or multiple variables in the same statement. Substitution is defined by `$variable name$`, where this text is replaced with the value of a variable called \"variable name\".",
|
||||
"",
|
||||
"Example: `eval $val1$ + $val2$` assuming `val1` is 4 and `val2` is 8 would resolve to `eval 4 + 8`.",
|
||||
"",
|
||||
"Special case: The contents of the buffer can also be accessed using substitution using `$buffer$`. Consequently, a variable also named \"buffer\" can **not** be accessed using variable substitution at all.",
|
||||
"",
|
||||
"## About Redstone-over-Radio",
|
||||
"RoR has a specific limitation: A signal cannot be sent on the same channel within the same game tick. Subsequent signals on the same channel in the same tick will overwrite the previous one, with the exception of numeric (whole number) signals which are added together (e.g. sending \"5\" and \"7\" in the same tick creates a signal \"12\"). Since the AUTOCAL unit's clock speed allows it to theoretically send multiple signals on the same channel on the same tick, it might be necessary to *end* the operation for this tick even though there's still clock cycles left to do. This can be done with the `endtick` command.",
|
||||
"",
|
||||
"## The Script (Commands)",
|
||||
"",
|
||||
"### Comments",
|
||||
"Lines that start with `# ` (hashtag + space) are comments, and therefore ignored. If the AUTOCAL encounters such a line, it is skipped, not using up the clock cycle.",
|
||||
"",
|
||||
"Example: `# This is a comment` -> A line that does nothing, but can still be useful to explain and annotate other commands.",
|
||||
"",
|
||||
"### nop",
|
||||
"`nop` (no operation) is an operation that consumes one clock cycle, but does not have any other effect. This is only useful in special cases where clock cycle timing is somehow important.",
|
||||
"",
|
||||
"### clockspeed",
|
||||
"`clockspeed <speed>` sets the AUTOCAL's clock speed (i.e. amount of lines processed per tick). This can be changed at any point in the script, but usually it is most useful to start the script by defining the clock speed.",
|
||||
"",
|
||||
"Example: `clockspeed 5` -> Sets the AUTOCAL's clock speed to five lines per tick (100 lines per second).",
|
||||
"",
|
||||
"### dest",
|
||||
"`dest <name>` creates a jump destination. Using the various jumping conditions, we can cause the AUTOCAL to return back (or forward) to this point. If a destination is reached not by jumping but simply by reading the next line, it will not use up a clock cycle, just like a comment. Destinations need unique names, if multiple destinations exist with the same name, then the latter ones will overwrite the former ones.",
|
||||
"",
|
||||
"Example: `dest start` -> Creates a destination point named \"start\", any jump instruction using \"start\" will cause the script to return to this point.",
|
||||
"",
|
||||
"### jmp",
|
||||
"`jmp <destination>` will cause the program to skip to the destination with the supplied name. The jump will always be performed when the script reaches this instruction. Supports variable substitution!",
|
||||
"",
|
||||
"Example: `jmp start` -> Jumps to the destination point named \"start\".",
|
||||
"Example: `jmp $dest$` -> Jumps to the destination point with the same name as the contents of the variable \"dest\".",
|
||||
"",
|
||||
"### jmpif",
|
||||
"`jmpif <destination>` will cause the program to skip to the destination with the supplied name, if the buffer's content is `true`. Otherwise, the program will just proceed to the next line, like any other instruction. Supports variable substitution!",
|
||||
"",
|
||||
"Example:",
|
||||
"`jmpif skip`",
|
||||
"`nop`",
|
||||
"`dest skip`",
|
||||
"`nop`",
|
||||
"",
|
||||
"-> If the buffer is `true`, then the program will jump to the destination point named \"skip\" and only run the second `nop`. Otherwise, both the first and second `nop` will run.",
|
||||
"",
|
||||
"### jmpnot",
|
||||
"`jmpnot <destination>` will cause the program to skip to the destination with the supplied name, if the buffer's content is **not** `true`. This is basically the inverse of `jmpif`. Only exists for some convenience for people who are used to more traditional languages' `if` statements. Supports variable substitution!",
|
||||
"",
|
||||
"Example:",
|
||||
"`jmpnot skip` <- if",
|
||||
"`nop` <- then",
|
||||
"`jmp end`",
|
||||
"`dest skip`",
|
||||
"`nop` <- else",
|
||||
"`dest end` <- end",
|
||||
"",
|
||||
"-> By using two jumps, one conditional and one fixed, we can emulate the structure of an `if/else` block. If the buffer's content is `true`, the first `nop` runs. Otherwise, the second `nop` is run. The second jump (`jmp end`) lets us skip over the \"else\" part of the script after running the \"then\" part.",
|
||||
"",
|
||||
"### endtick",
|
||||
"`endtick` stops the script until the next game tick. This is important when sending multiple RoR signals on the same channel in a row, since a channel in the same tick can only hold one signal.",
|
||||
"",
|
||||
"### shutdown",
|
||||
"`shutdown` will turn the AUTOCAL unit off. If the AUTOCAL is set up to automatically reboot, this effectively restarts the script from scratch, voiding all saved variables and the buffer. If not, then the AUTOCAL unit will stay off until manually restarted.",
|
||||
"",
|
||||
"### load",
|
||||
"`load <name>` will take the value of a variable with the supplied name and copy it to the buffer. Many commands work directly out of the buffer, so next to variable substitution, this is the only way of actually accessing the contents of a variable.",
|
||||
"",
|
||||
"Example: `load val` -> Assuming that the variable \"val\" contains the value `5`, then the buffer's value is now overwritten with that `5`.",
|
||||
"",
|
||||
"### save",
|
||||
"`save <name>` will take the value of the buffer and save it to a variable with the supplied name. This is the only way of actually changing variables, and saving values for later use besides the buffer.",
|
||||
"",
|
||||
"Example: `save val` -> Assuming that the buffer contains the value `12`, this will create a new variable named \"val\" with the value of `12`.",
|
||||
"",
|
||||
"### buffer",
|
||||
"`buffer <value>` will write the supplied value directly to the buffer. This means that commands that require buffer values can be supplied with values directly from the code.",
|
||||
"",
|
||||
"Example:",
|
||||
"`buffer Horseshoe`",
|
||||
"`save item`",
|
||||
"",
|
||||
"-> Will buffer the value `Horseshoe` and then save it to the variable called \"item\".",
|
||||
"",
|
||||
"### eval",
|
||||
"`eval [statement]` will evaluate the supplied statement as a mathematical expression. In short, anything NTM's calculator can make sense of (the one you open with N by default), this function can do the same. The statement is optional, if no statement is supplied, then it will try to use the buffer's contents as the statement. `eval` produces **decimal** values and not whole number **integers**, so for use in RoR signals, the output needs to be rounded! The result of the calculation is then saved to the buffer. Supports variable substitution!",
|
||||
"",
|
||||
"Example: `eval 4 + 5` -> Calculates \"4+5\" and saves `9` to the buffer.",
|
||||
"Example: `eval $val$ / 2` -> Takes the value of \"val\" and divides it by 2, saving the result to the buffer.",
|
||||
"",
|
||||
"Example:",
|
||||
"`load calc`",
|
||||
"`eval`",
|
||||
"",
|
||||
"-> Will write the value of \"calc\" to the buffer, and then treat it as a mathematical expression. If we assume \"calc\" to be `5+2` then `eval` will end up writing `7` to the buffer.",
|
||||
"",
|
||||
"### evalr",
|
||||
"`evalr [statement]` is identical to `eval`, however it will round the result to the nearest whole number. Whole numbers are important for RoR, since gauges, numeric displays and logic receivers can only handle whole numbers, and not decimals.",
|
||||
"",
|
||||
"### rounddown / floor",
|
||||
"`rounddown` or `floor` will try to interpret the buffer's content as a decimal, and round it **down** to the next lower integer, writing the result to the buffer again.",
|
||||
"",
|
||||
"Example: `rounddown` -> Assuming the buffer's value is `4.2`, the buffer's new value will be `4`.",
|
||||
"Example: `rounddown` -> Assuming the buffer's value is `4.6`, the buffer's new value will be `4`.",
|
||||
"",
|
||||
"### roundup / ceil",
|
||||
"`roundup` or `ceil` will try to interpret the buffer's content as a decimal, and round it **up** to the next higher integer, writing the result to the buffer again.",
|
||||
"",
|
||||
"Example: `roundup` -> Assuming the buffer's value is `4.2`, the buffer's new value will be `5`.",
|
||||
"Example: `roundup` -> Assuming the buffer's value is `4.6`, the buffer's new value will be `5`.",
|
||||
"",
|
||||
"### round / nearest",
|
||||
"`round` or `nearest` will try to interpret the buffer's content as a decimal, and round it to the **closest** integer, writing the result to the buffer again.",
|
||||
"",
|
||||
"Example: `round` -> Assuming the buffer's value is `4.2`, the buffer's new value will be `4`.",
|
||||
"Example: `round` -> Assuming the buffer's value is `4.6`, the buffer's new value will be `5`.",
|
||||
"",
|
||||
"### concat",
|
||||
"`concat <text>` works similarly to `buffer <text>`, however it accepts variable substitution. This means that the text of multiple variables can be combined.",
|
||||
"",
|
||||
"Example: `concat $first$ and $second$` -> Assuming the variable \"first\" to be `Cats` and \"second\" to be `dogs`, then the result saved to the buffer is `Cats and dogs`.",
|
||||
"",
|
||||
"### eq",
|
||||
"`eq <value>` - equals, will try to compare the buffer to the supplied value. The buffer will be set to `true` if the values are equal and `false` otherwise. Supports variable substitution!",
|
||||
"",
|
||||
"Example: `eq Brick` -> If the buffer is `Brick`, then it is set to `true`, otherwise it becomes `false`.",
|
||||
"Example: `eq $comp$` -> If the buffer's value is equal to the value of the variable \"comp\", then it is set to `true`, otherwise it becomes `false`.",
|
||||
"",
|
||||
"### gtb",
|
||||
"`gtb <value>` - greater than buffer, will try to compare the buffer to the supplied value. The buffer will be set to `true` if the supplied numerical value is greater and `false` otherwise. Supports variable substitution!",
|
||||
"",
|
||||
"Example: `gtb 4` -> If the buffer is `3` or lower, then it is set to `true`, otherwise it becomes `false`.",
|
||||
"Example: `gtb $comp$` -> If the buffer lower than the value of \"comp\", then it is set to `true`, otherwise it becomes `false`.",
|
||||
"",
|
||||
"### ltb",
|
||||
"`ltb <value>` - less than buffer, will try to compare the buffer to the supplied value. The buffer will be set to `true` if the supplied numerical value is lower and `false` otherwise. Supports variable substitution!",
|
||||
"",
|
||||
"Example: `ltb 4` -> If the buffer is `5` or higher, then it is set to `true`, otherwise it becomes `false`.",
|
||||
"Example: `ltb $comp$` -> If the buffer higher than the value of \"comp\", then it is set to `true`, otherwise it becomes `false`.",
|
||||
"",
|
||||
"### geb",
|
||||
"`geb <value>` - greater than or equal buffer.",
|
||||
"",
|
||||
"### leb",
|
||||
"`leb <value>` - less than or equal buffer.",
|
||||
"",
|
||||
"### send",
|
||||
"`send <channel>` will send a Redstone-over-Radio signal over the supplied channel, with the signal's value being the current buffer's value. Sending repeatedly over the same channel requires waiting for a full game tick, so using `endtick` after sending is advised. Supports variable substitution!",
|
||||
"",
|
||||
"Example:",
|
||||
"`buffer Hello!`",
|
||||
"`send transmission`",
|
||||
"",
|
||||
"-> Will send the RoR signal `Hello!` on the channel \"transmission\".",
|
||||
"",
|
||||
"Example:",
|
||||
"`buffer SOS`",
|
||||
"`send $target$`",
|
||||
"",
|
||||
"-> Will send the RoR signal \"SOS\" to the channel saved in the variable \"target\".",
|
||||
"",
|
||||
"### listen ",
|
||||
"`listen <channel>` will listen in on the supplied RoR channel and write the signal to the buffer. Will detect all signals, even expired ones, and one just ones sent in the previous tick, so picking up a signal doesn't mean it's new information. Supports variable substitution!",
|
||||
"",
|
||||
"Example:",
|
||||
"`listen input`",
|
||||
"`eval $buffer$ * 100`",
|
||||
"`send output`",
|
||||
"",
|
||||
"-> Will take the signal from the RoR channel \"input\", multiply it by 100, and send that value on the channel \"output\".",
|
||||
"",
|
||||
"## Advanced",
|
||||
"",
|
||||
"### Conditional Branches",
|
||||
"Basic if/else conditions are the bread and butter of most programming. If we want to change the behavior based on different values, we need to compare, and then conditional jump.",
|
||||
"",
|
||||
"This example creates a script that processed a number \"val\" based on how high it is. 4 and below are multiplied by 2, otherwise it is divided by 2:",
|
||||
"",
|
||||
"`buffer 4` <- buffer `4` for comparison",
|
||||
"`gtb $val$` <- is \"val\" greater than our buffer?",
|
||||
"`jmpnot else` <- if not, jump to \"else\"",
|
||||
"`eval $val$ / 2` <- if it is, divide by 2",
|
||||
"`save val` <- ...and save to \"val\"",
|
||||
"`jmp end` <- now jump to \"end\" to skip our \"else\" block",
|
||||
"`dest else` <- else...",
|
||||
"`eval $val$ * 2` <- multiply by 2",
|
||||
"`save val` <- ...and save to val",
|
||||
"`dest end` <- no matter which branch we took, we always end up here",
|
||||
"",
|
||||
"### Methods",
|
||||
"People who are used to high languages will already know this concept, reusable parts of code with a set of parameters and an optional return value. For this we will use a few variables and a set of jumps in order to be able to use this piece of code from anywhere:",
|
||||
"",
|
||||
"This example implements a basic lerp (linear interpolation) function.",
|
||||
"",
|
||||
"`dest lerp`",
|
||||
"`eval $a$ + ($b$ - $a$) * $i$`",
|
||||
"`save result`",
|
||||
"`jmp $return$`",
|
||||
"",
|
||||
"This function requires the variables \"a\", \"b\" and \"i\" as parameters and saves the result to the variable \"result\". We can now access this function like such:",
|
||||
"",
|
||||
"`buffer 4` <- first we set up our parameters to be used in the function",
|
||||
"`save a`",
|
||||
"`buffer 7`",
|
||||
"`save b`",
|
||||
"`buffer 0.6`",
|
||||
"`save i`",
|
||||
"`buffer returnhere` <- then we define the name of the return point",
|
||||
"`save return`",
|
||||
"`jmp lerp` <- call the function",
|
||||
"`dest returnhere` <- once the function concludes, we are back here",
|
||||
"",
|
||||
"At the end of it all, the variable \"result\" now has the desired value.",
|
||||
};
|
||||
}
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import java.awt.Desktop;
|
||||
import java.io.File;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.net.URI;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.lwjgl.Sys;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toserver.NBTControlPacket;
|
||||
import com.hbm.tileentity.network.TileEntityRadioAUTOCAL;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIScreenRadioAUTOCAL extends GuiScreen {
|
||||
|
||||
protected static final ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/machine/gui_rtty_autocal.png");
|
||||
protected TileEntityRadioAUTOCAL autocal;
|
||||
|
||||
protected int xSize = 170;
|
||||
protected int ySize = 138;
|
||||
protected int guiLeft;
|
||||
protected int guiTop;
|
||||
|
||||
public GUIScreenRadioAUTOCAL(TileEntityRadioAUTOCAL autocal) {
|
||||
this.autocal = autocal;
|
||||
}
|
||||
|
||||
private void browse(URI uri) throws IOException {
|
||||
// workaround for Java not supporting all platforms, mostly for Linux
|
||||
if (Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
|
||||
Desktop.getDesktop().browse(uri);
|
||||
} else {
|
||||
if (Sys.getVersion().charAt(0) == '3') {
|
||||
// probably a LWJGL3ify user, open the folder instead since that somehow seems to work
|
||||
File uploadFolder = new File(MainRegistry.configDir.getParentFile(), "hbmComputerUpload");
|
||||
if (uploadFolder.exists()) Sys.openURL(uploadFolder.toString());
|
||||
} else {
|
||||
Sys.openURL(uri.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
this.guiLeft = (this.width - this.xSize) / 2;
|
||||
this.guiTop = (this.height - this.ySize) / 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||
this.drawDefaultBackground();
|
||||
this.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
this.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int x, int y, int i) {
|
||||
super.mouseClicked(x, y, i);
|
||||
|
||||
NBTTagCompound data = null;
|
||||
|
||||
if(checkClick(x, y, 8, 36, 18, 18)) { data = new NBTTagCompound(); data.setBoolean("on", true); }
|
||||
if(checkClick(x, y, 28, 36, 18, 18)) { data = new NBTTagCompound(); data.setBoolean("ignore", true); }
|
||||
if(checkClick(x, y, 48, 36, 18, 18)) { data = new NBTTagCompound(); data.setBoolean("auto", true); }
|
||||
|
||||
// open folder and generate new script file
|
||||
if(checkClick(x, y, 104, 36, 18, 18)) {
|
||||
try {
|
||||
File uploadFolder = new File(MainRegistry.configDir.getParentFile(), "hbmComputerUpload");
|
||||
File script = new File(uploadFolder, "script.txt");
|
||||
if(!uploadFolder.exists()) uploadFolder.mkdir();
|
||||
if(!script.exists()) script.createNewFile();
|
||||
script.setExecutable(false);
|
||||
browse(script.toURI());
|
||||
} catch(Throwable ex) { MainRegistry.logger.error("Couldn't open link", ex); }
|
||||
}
|
||||
|
||||
// open folder and generate new doc file
|
||||
if(checkClick(x, y, 144, 36, 18, 18)) {
|
||||
try {
|
||||
File uploadFolder = new File(MainRegistry.configDir.getParentFile(), "hbmComputerUpload");
|
||||
File doc = new File(uploadFolder, "documentation.md");
|
||||
if(!uploadFolder.exists()) uploadFolder.mkdir();
|
||||
if(!doc.exists()) {
|
||||
doc.createNewFile();
|
||||
try {
|
||||
PrintWriter printer = new PrintWriter(doc, StandardCharsets.US_ASCII.name());
|
||||
for(String line : DOCS) printer.println(line);
|
||||
printer.close();
|
||||
} catch(Throwable e) { }
|
||||
}
|
||||
browse(doc.toURI());
|
||||
} catch(Throwable ex) { MainRegistry.logger.error("Couldn't open link", ex); }
|
||||
}
|
||||
|
||||
if(checkClick(x, y, 84, 36, 18, 18)) {
|
||||
try {
|
||||
File uploadFolder = new File(MainRegistry.configDir.getParentFile(), "hbmComputerUpload");
|
||||
File script = new File(uploadFolder, "script.txt");
|
||||
if(!uploadFolder.exists()) uploadFolder.mkdir();
|
||||
if(!script.exists()) {
|
||||
script.createNewFile();
|
||||
script.setExecutable(false);
|
||||
return;
|
||||
}
|
||||
/*FileReader reader = new FileReader(script);
|
||||
BufferedReader buffer = new BufferedReader(reader);
|
||||
String[] lines = buffer.lines().toArray(String[]::new);
|
||||
buffer.close();
|
||||
// this is going to blow the fuck up once we hit the max packet size, but let's ignore that for now
|
||||
data = new NBTTagCompound();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for(int l = 0; l < lines.length; l++) {
|
||||
builder.append(lines[i]);
|
||||
if(l < lines.length - 1) builder.append("\n"); // yeah why the fuck not
|
||||
}
|
||||
data.setString("payload", builder.toString());*/
|
||||
byte[] bytes = Files.readAllBytes(Paths.get(script.toURI()));
|
||||
data = new NBTTagCompound();
|
||||
data.setString("payload", new String(bytes, StandardCharsets.UTF_8));
|
||||
|
||||
} catch(Throwable ex) { }
|
||||
}
|
||||
|
||||
// this thing can both upload and download files so let's be careful about this
|
||||
// the upload is simple, it's just text that is handled by the AUTOCAL, so doing anything malicious isn't more likely than with any other package
|
||||
// download is iffy, because we take text from the server, fully user-definable, and save it to disk. it's stored as a txt so accudentally running it
|
||||
// or getting it to run itself, should it be a malicious script, is unlikely. still, we want to minimized the chances as much as we can
|
||||
// option 1: set file attribute to disallow running (i.e. disable executable perm)
|
||||
// option 2: add fluff that would break scripts, however they might work. we can't change the actual lines because we want the script to be edited,
|
||||
// but we can add some extra crap that would either halt common scripting langs entirely or at least disrupt them into not functioning
|
||||
// option 3: enforce validation so only MS-ES1 script can be received by the client. this means that info such as comments or incorrectly written commands
|
||||
// are lost, however this is the safest way because it becomes impossible to send malicious code, but it also interferes with regular user operation more
|
||||
|
||||
if(data != null) {
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, autocal.xCoord, autocal.yCoord, autocal.zCoord));
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean checkClick(int x, int y, int left, int top, int sizeX, int sizeY) {
|
||||
return guiLeft + left <= x && guiLeft + left + sizeX > x && guiTop + top < y && guiTop + top + sizeY >= y;
|
||||
}
|
||||
|
||||
private void drawGuiContainerForegroundLayer(int x, int y) {
|
||||
|
||||
for(int i = 0; i < autocal.history.length; i++) {
|
||||
String line = autocal.history[i];
|
||||
if(line == null || line.isEmpty()) continue;
|
||||
this.fontRendererObj.drawString(line, guiLeft + 7, guiTop + 73 + i * 10, 0x00ff00);
|
||||
}
|
||||
|
||||
if(checkClick(x, y, 8, 36, 18, 18)) this.func_146283_a(Arrays.asList(new String[] {EnumChatFormatting.RED + "ON/OFF"}), x, y);
|
||||
if(checkClick(x, y, 28, 36, 18, 18)) this.func_146283_a(Arrays.asList(new String[] {EnumChatFormatting.RED + "Ignore Errors", "Skips instructions that error,", "leaving the computer turned on.", "May cause unintended behavior", "and inconsistencies."}), x, y);
|
||||
if(checkClick(x, y, 48, 36, 18, 18)) this.func_146283_a(Arrays.asList(new String[] {EnumChatFormatting.RED + "Automatic Reboot", "Restarts the computer automatically when", "the program stops due to an error", "or after finishing."}), x, y);
|
||||
|
||||
if(checkClick(x, y, 84, 36, 18, 18)) this.func_146283_a(Arrays.asList(new String[] {EnumChatFormatting.BLUE + "Upload Program"}), x, y);
|
||||
if(checkClick(x, y, 104, 36, 18, 18)) this.func_146283_a(Arrays.asList(new String[] {EnumChatFormatting.BLUE + "Open Program File"}), x, y);
|
||||
if(checkClick(x, y, 124, 36, 18, 18)) this.func_146283_a(Arrays.asList(new String[] {EnumChatFormatting.BLUE + "Download Program", EnumChatFormatting.RED + "Currently unsupported!"}), x, y);
|
||||
if(checkClick(x, y, 144, 36, 18, 18)) this.func_146283_a(Arrays.asList(new String[] {EnumChatFormatting.BLUE + "Open Documentation"}), x, y);
|
||||
}
|
||||
|
||||
private void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
if(autocal.isOn) drawTexturedModalRect(guiLeft + 8, guiTop + 36, xSize, 0, 18, 18);
|
||||
if(!autocal.ignoreError) drawTexturedModalRect(guiLeft + 28, guiTop + 36, xSize, 18, 18, 18);
|
||||
if(!autocal.autoReboot) drawTexturedModalRect(guiLeft + 48, guiTop + 36, xSize, 36, 18, 18);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char c, int b) {
|
||||
if(b == 1 || b == Minecraft.getMinecraft().gameSettings.keyBindInventory.getKeyCode()) {
|
||||
Minecraft.getMinecraft().thePlayer.closeScreen();
|
||||
}
|
||||
}
|
||||
|
||||
@Override public boolean doesGuiPauseGame() { return false; }
|
||||
|
||||
|
||||
public static final String[] DOCS = new String[] {
|
||||
"# AUTOCAL - The Automatic Calculator",
|
||||
"",
|
||||
"## About this document",
|
||||
"This documentation is designed to be understandable even by people with no programming background. This documentation extends to the AUTOCAL unit as well as the MS-ES1 script language it is programmed with.",
|
||||
"",
|
||||
"Read this document carefully as all the described concepts are vital for using the AUTOCAL unit.",
|
||||
"",
|
||||
"## About AUTOCAL",
|
||||
"The AUTOCAL automatic calculator is a basic machine that reads a script, line by line, and performs actions based on those lines. This means it can be programmed with behavior, doing math, and handling signals. It communicated with the outside world exclusively using Redstone-over-Radio (RoR) signals, allowing RoR to supply it with values to be processed, and returning RoR signals to be displayed or for controlling RoR receiving devices.",
|
||||
"",
|
||||
"The first button is the on/off switch. Turning the AUTOCAL unit on will start the script at the first line. If the script concludes, an error is encountered (without the \"ignore errors\" setting enabled), the `shutdown` command is used or no program is loaded to begin with, the unit will automatically power down.",
|
||||
"",
|
||||
"The second button is the \"ignore errors\" setting. The red X means the setting is disabled, if an error is encountered in the program (an unrecognized command, missing or incorrect parameters, anything the script isn't meant to handle) then the unit will shut off. Otherwise, the erroring instruction is simply skipped. This may cause undefined or unexpected behavior, however in certain circumstances this doesn't matter. It's advised to keep this turned off, as it makes it easier to find obvious errors in the script.",
|
||||
"",
|
||||
"The third button is the \"automatic reboot\" setting. If the unit is powered down, no matter the reason, it will automatically try to start again. This allows for a simple \"loop\" where the same script is repeated every time it ends by simply rebooting the AUTOCAL unit at the end. Do note that doing so will delete all saved variables, more on how variables work later.",
|
||||
"",
|
||||
"The fourth button is for uploading the script. The script is in the minecraft's install folder, under the `hbmComputerUpload` folder, named `script.txt`. Clicking this button will send the contents of this script file to the AUTOCAL unit.",
|
||||
"",
|
||||
"The fifth button is for opening the script file. If no script file exists yet, the folder and empty script will be created.",
|
||||
"",
|
||||
"The sixth button is for downloading a script file. The existing `script.txt` is deleted and replaced with the script that is loaded onto the AUTOCAL unit.",
|
||||
"",
|
||||
"The simple workflow of programming an AUTOCAL unit is therefore using button #5 to open the file, writing the program, using #4 to flash the program to the AUTOCAL unit, and then using the first button to turn it on.",
|
||||
"",
|
||||
"## About MS-ES1",
|
||||
"The script read by AUTOCAL units is written in *Machine Script - Equestrian Standard, Version 1*, or MS-ES1. MS-ES1 features named variables, value comparison, (conditional) jumping, evaluation of mathematical expressions and reading/writing of RoR signals. The speed at which lines are processed is defined by the *clock speed*, which can be defined in the script. The amount describes the number of lines processed per tick, i.e. the default clock speed of 1 means 20 lines are processed per second (there are 20 ticks in one second). The maximum clock speed is determined by the server config value `AUTOCAL_MAX_CLOCK` (default is 20, i.e. 400 per second).",
|
||||
"",
|
||||
"Example: `/ntmserver set AUTOCAL_MAX_CLOCK 10` -> Sets the max clock speed to 10.",
|
||||
"",
|
||||
"## About the Buffer",
|
||||
"The buffer is a single \"slot\" of information that can be used for many commands. Some commands produce an output which is saved to the buffer, some commands modify the contents of the buffer, and some commands use the buffer's contents. The buffer's contents can also be saved permanently as a named variable, and named variables can be written back into the buffer again if needed. The buffer persists as long as the AUTOCAL unit is running, should it restart or shut down, the buffer's contents are lost.",
|
||||
"",
|
||||
"## About Variables",
|
||||
"MS-ES1 allows named variables to be saved for later use. There is no limit to how many variables can be saved. All variables are text (\"Strings\"), however depending on the command and context, that text may be interpreted as a number (both full and decimal). Variables, much like the buffer, are also stored as long as the program is running, if the AUTOCAL unit shuts down, all stored variables are lost.",
|
||||
"",
|
||||
"## About Variable Substitution",
|
||||
"Many commands allow for *variable substitution*, i.e. a specific format can be used to insert the contents of a variable (or multiple!) into a parameter. This allows for the quick use of variables, or multiple variables in the same statement. Substitution is defined by `$variable name$`, where this text is replaced with the value of a variable called \"variable name\".",
|
||||
"",
|
||||
"Example: `eval $val1$ + $val2$` assuming `val1` is 4 and `val2` is 8 would resolve to `eval 4 + 8`.",
|
||||
"",
|
||||
"Special case: The contents of the buffer can also be accessed using substitution using `$buffer$`. Consequently, a variable also named \"buffer\" can **not** be accessed using variable substitution at all.",
|
||||
"",
|
||||
"## About Redstone-over-Radio",
|
||||
"RoR has a specific limitation: A signal cannot be sent on the same channel within the same game tick. Subsequent signals on the same channel in the same tick will overwrite the previous one, with the exception of numeric (whole number) signals which are added together (e.g. sending \"5\" and \"7\" in the same tick creates a signal \"12\"). Since the AUTOCAL unit's clock speed allows it to theoretically send multiple signals on the same channel on the same tick, it might be necessary to *end* the operation for this tick even though there's still clock cycles left to do. This can be done with the `endtick` command.",
|
||||
"",
|
||||
"## The Script (Commands)",
|
||||
"",
|
||||
"### Comments",
|
||||
"Lines that start with `# ` (hashtag + space) are comments, and therefore ignored. If the AUTOCAL encounters such a line, it is skipped, not using up the clock cycle.",
|
||||
"",
|
||||
"Example: `# This is a comment` -> A line that does nothing, but can still be useful to explain and annotate other commands.",
|
||||
"",
|
||||
"### nop",
|
||||
"`nop` (no operation) is an operation that consumes one clock cycle, but does not have any other effect. This is only useful in special cases where clock cycle timing is somehow important.",
|
||||
"",
|
||||
"### clockspeed",
|
||||
"`clockspeed <speed>` sets the AUTOCAL's clock speed (i.e. amount of lines processed per tick). This can be changed at any point in the script, but usually it is most useful to start the script by defining the clock speed.",
|
||||
"",
|
||||
"Example: `clockspeed 5` -> Sets the AUTOCAL's clock speed to five lines per tick (100 lines per second).",
|
||||
"",
|
||||
"### dest",
|
||||
"`dest <name>` creates a jump destination. Using the various jumping conditions, we can cause the AUTOCAL to return back (or forward) to this point. If a destination is reached not by jumping but simply by reading the next line, it will not use up a clock cycle, just like a comment. Destinations need unique names, if multiple destinations exist with the same name, then the latter ones will overwrite the former ones.",
|
||||
"",
|
||||
"Example: `dest start` -> Creates a destination point named \"start\", any jump instruction using \"start\" will cause the script to return to this point.",
|
||||
"",
|
||||
"### jmp",
|
||||
"`jmp <destination>` will cause the program to skip to the destination with the supplied name. The jump will always be performed when the script reaches this instruction. Supports variable substitution!",
|
||||
"",
|
||||
"Example: `jmp start` -> Jumps to the destination point named \"start\".",
|
||||
"Example: `jmp $dest$` -> Jumps to the destination point with the same name as the contents of the variable \"dest\".",
|
||||
"",
|
||||
"### jmpif",
|
||||
"`jmpif <destination>` will cause the program to skip to the destination with the supplied name, if the buffer's content is `true`. Otherwise, the program will just proceed to the next line, like any other instruction. Supports variable substitution!",
|
||||
"",
|
||||
"Example:",
|
||||
"`jmpif skip`",
|
||||
"`nop`",
|
||||
"`dest skip`",
|
||||
"`nop`",
|
||||
"",
|
||||
"-> If the buffer is `true`, then the program will jump to the destination point named \"skip\" and only run the second `nop`. Otherwise, both the first and second `nop` will run.",
|
||||
"",
|
||||
"### jmpnot",
|
||||
"`jmpnot <destination>` will cause the program to skip to the destination with the supplied name, if the buffer's content is **not** `true`. This is basically the inverse of `jmpif`. Only exists for some convenience for people who are used to more traditional languages' `if` statements. Supports variable substitution!",
|
||||
"",
|
||||
"Example:",
|
||||
"`jmpnot skip` <- if",
|
||||
"`nop` <- then",
|
||||
"`jmp end`",
|
||||
"`dest skip`",
|
||||
"`nop` <- else",
|
||||
"`dest end` <- end",
|
||||
"",
|
||||
"-> By using two jumps, one conditional and one fixed, we can emulate the structure of an `if/else` block. If the buffer's content is `true`, the first `nop` runs. Otherwise, the second `nop` is run. The second jump (`jmp end`) lets us skip over the \"else\" part of the script after running the \"then\" part.",
|
||||
"",
|
||||
"### endtick",
|
||||
"`endtick` stops the script until the next game tick. This is important when sending multiple RoR signals on the same channel in a row, since a channel in the same tick can only hold one signal.",
|
||||
"",
|
||||
"### shutdown",
|
||||
"`shutdown` will turn the AUTOCAL unit off. If the AUTOCAL is set up to automatically reboot, this effectively restarts the script from scratch, voiding all saved variables and the buffer. If not, then the AUTOCAL unit will stay off until manually restarted.",
|
||||
"",
|
||||
"### load",
|
||||
"`load <name>` will take the value of a variable with the supplied name and copy it to the buffer. Many commands work directly out of the buffer, so next to variable substitution, this is the only way of actually accessing the contents of a variable.",
|
||||
"",
|
||||
"Example: `load val` -> Assuming that the variable \"val\" contains the value `5`, then the buffer's value is now overwritten with that `5`.",
|
||||
"",
|
||||
"### save",
|
||||
"`save <name>` will take the value of the buffer and save it to a variable with the supplied name. This is the only way of actually changing variables, and saving values for later use besides the buffer.",
|
||||
"",
|
||||
"Example: `save val` -> Assuming that the buffer contains the value `12`, this will create a new variable named \"val\" with the value of `12`.",
|
||||
"",
|
||||
"### buffer",
|
||||
"`buffer <value>` will write the supplied value directly to the buffer. This means that commands that require buffer values can be supplied with values directly from the code.",
|
||||
"",
|
||||
"Example:",
|
||||
"`buffer Horseshoe`",
|
||||
"`save item`",
|
||||
"",
|
||||
"-> Will buffer the value `Horseshoe` and then save it to the variable called \"item\".",
|
||||
"",
|
||||
"### eval",
|
||||
"`eval [statement]` will evaluate the supplied statement as a mathematical expression. In short, anything NTM's calculator can make sense of (the one you open with N by default), this function can do the same. The statement is optional, if no statement is supplied, then it will try to use the buffer's contents as the statement. `eval` produces **decimal** values and not whole number **integers**, so for use in RoR signals, the output needs to be rounded! The result of the calculation is then saved to the buffer. Supports variable substitution!",
|
||||
"",
|
||||
"Example: `eval 4 + 5` -> Calculates \"4+5\" and saves `9` to the buffer.",
|
||||
"Example: `eval $val$ / 2` -> Takes the value of \"val\" and divides it by 2, saving the result to the buffer.",
|
||||
"",
|
||||
"Example:",
|
||||
"`load calc`",
|
||||
"`eval`",
|
||||
"",
|
||||
"-> Will write the value of \"calc\" to the buffer, and then treat it as a mathematical expression. If we assume \"calc\" to be `5+2` then `eval` will end up writing `7` to the buffer.",
|
||||
"",
|
||||
"### evalr",
|
||||
"`evalr [statement]` is identical to `eval`, however it will round the result to the nearest whole number. Whole numbers are important for RoR, since gauges, numeric displays and logic receivers can only handle whole numbers, and not decimals.",
|
||||
"",
|
||||
"### rounddown / floor",
|
||||
"`rounddown` or `floor` will try to interpret the buffer's content as a decimal, and round it **down** to the next lower integer, writing the result to the buffer again.",
|
||||
"",
|
||||
"Example: `rounddown` -> Assuming the buffer's value is `4.2`, the buffer's new value will be `4`.",
|
||||
"Example: `rounddown` -> Assuming the buffer's value is `4.6`, the buffer's new value will be `4`.",
|
||||
"",
|
||||
"### roundup / ceil",
|
||||
"`roundup` or `ceil` will try to interpret the buffer's content as a decimal, and round it **up** to the next higher integer, writing the result to the buffer again.",
|
||||
"",
|
||||
"Example: `roundup` -> Assuming the buffer's value is `4.2`, the buffer's new value will be `5`.",
|
||||
"Example: `roundup` -> Assuming the buffer's value is `4.6`, the buffer's new value will be `5`.",
|
||||
"",
|
||||
"### round / nearest",
|
||||
"`round` or `nearest` will try to interpret the buffer's content as a decimal, and round it to the **closest** integer, writing the result to the buffer again.",
|
||||
"",
|
||||
"Example: `round` -> Assuming the buffer's value is `4.2`, the buffer's new value will be `4`.",
|
||||
"Example: `round` -> Assuming the buffer's value is `4.6`, the buffer's new value will be `5`.",
|
||||
"",
|
||||
"### concat",
|
||||
"`concat <text>` works similarly to `buffer <text>`, however it accepts variable substitution. This means that the text of multiple variables can be combined.",
|
||||
"",
|
||||
"Example: `concat $first$ and $second$` -> Assuming the variable \"first\" to be `Cats` and \"second\" to be `dogs`, then the result saved to the buffer is `Cats and dogs`.",
|
||||
"",
|
||||
"### eq",
|
||||
"`eq <value>` - equals, will try to compare the buffer to the supplied value. The buffer will be set to `true` if the values are equal and `false` otherwise. Supports variable substitution!",
|
||||
"",
|
||||
"Example: `eq Brick` -> If the buffer is `Brick`, then it is set to `true`, otherwise it becomes `false`.",
|
||||
"Example: `eq $comp$` -> If the buffer's value is equal to the value of the variable \"comp\", then it is set to `true`, otherwise it becomes `false`.",
|
||||
"",
|
||||
"### gtb",
|
||||
"`gtb <value>` - greater than buffer, will try to compare the buffer to the supplied value. The buffer will be set to `true` if the supplied numerical value is greater and `false` otherwise. Supports variable substitution!",
|
||||
"",
|
||||
"Example: `gtb 4` -> If the buffer is `3` or lower, then it is set to `true`, otherwise it becomes `false`.",
|
||||
"Example: `gtb $comp$` -> If the buffer lower than the value of \"comp\", then it is set to `true`, otherwise it becomes `false`.",
|
||||
"",
|
||||
"### ltb",
|
||||
"`ltb <value>` - less than buffer, will try to compare the buffer to the supplied value. The buffer will be set to `true` if the supplied numerical value is lower and `false` otherwise. Supports variable substitution!",
|
||||
"",
|
||||
"Example: `ltb 4` -> If the buffer is `5` or higher, then it is set to `true`, otherwise it becomes `false`.",
|
||||
"Example: `ltb $comp$` -> If the buffer higher than the value of \"comp\", then it is set to `true`, otherwise it becomes `false`.",
|
||||
"",
|
||||
"### geb",
|
||||
"`geb <value>` - greater than or equal buffer.",
|
||||
"",
|
||||
"### leb",
|
||||
"`leb <value>` - less than or equal buffer.",
|
||||
"",
|
||||
"### send",
|
||||
"`send <channel>` will send a Redstone-over-Radio signal over the supplied channel, with the signal's value being the current buffer's value. Sending repeatedly over the same channel requires waiting for a full game tick, so using `endtick` after sending is advised. Supports variable substitution!",
|
||||
"",
|
||||
"Example:",
|
||||
"`buffer Hello!`",
|
||||
"`send transmission`",
|
||||
"",
|
||||
"-> Will send the RoR signal `Hello!` on the channel \"transmission\".",
|
||||
"",
|
||||
"Example:",
|
||||
"`buffer SOS`",
|
||||
"`send $target$`",
|
||||
"",
|
||||
"-> Will send the RoR signal \"SOS\" to the channel saved in the variable \"target\".",
|
||||
"",
|
||||
"### listen ",
|
||||
"`listen <channel>` will listen in on the supplied RoR channel and write the signal to the buffer. Will detect all signals, even expired ones, and one just ones sent in the previous tick, so picking up a signal doesn't mean it's new information. Supports variable substitution!",
|
||||
"",
|
||||
"Example:",
|
||||
"`listen input`",
|
||||
"`eval $buffer$ * 100`",
|
||||
"`send output`",
|
||||
"",
|
||||
"-> Will take the signal from the RoR channel \"input\", multiply it by 100, and send that value on the channel \"output\".",
|
||||
"",
|
||||
"## Advanced",
|
||||
"",
|
||||
"### Conditional Branches",
|
||||
"Basic if/else conditions are the bread and butter of most programming. If we want to change the behavior based on different values, we need to compare, and then conditional jump.",
|
||||
"",
|
||||
"This example creates a script that processed a number \"val\" based on how high it is. 4 and below are multiplied by 2, otherwise it is divided by 2:",
|
||||
"",
|
||||
"`buffer 4` <- buffer `4` for comparison",
|
||||
"`gtb $val$` <- is \"val\" greater than our buffer?",
|
||||
"`jmpnot else` <- if not, jump to \"else\"",
|
||||
"`eval $val$ / 2` <- if it is, divide by 2",
|
||||
"`save val` <- ...and save to \"val\"",
|
||||
"`jmp end` <- now jump to \"end\" to skip our \"else\" block",
|
||||
"`dest else` <- else...",
|
||||
"`eval $val$ * 2` <- multiply by 2",
|
||||
"`save val` <- ...and save to val",
|
||||
"`dest end` <- no matter which branch we took, we always end up here",
|
||||
"",
|
||||
"### Methods",
|
||||
"People who are used to high languages will already know this concept, reusable parts of code with a set of parameters and an optional return value. For this we will use a few variables and a set of jumps in order to be able to use this piece of code from anywhere:",
|
||||
"",
|
||||
"This example implements a basic lerp (linear interpolation) function.",
|
||||
"",
|
||||
"`dest lerp`",
|
||||
"`eval $a$ + ($b$ - $a$) * $i$`",
|
||||
"`save result`",
|
||||
"`jmp $return$`",
|
||||
"",
|
||||
"This function requires the variables \"a\", \"b\" and \"i\" as parameters and saves the result to the variable \"result\". We can now access this function like such:",
|
||||
"",
|
||||
"`buffer 4` <- first we set up our parameters to be used in the function",
|
||||
"`save a`",
|
||||
"`buffer 7`",
|
||||
"`save b`",
|
||||
"`buffer 0.6`",
|
||||
"`save i`",
|
||||
"`buffer returnhere` <- then we define the name of the return point",
|
||||
"`save return`",
|
||||
"`jmp lerp` <- call the function",
|
||||
"`dest returnhere` <- once the function concludes, we are back here",
|
||||
"",
|
||||
"At the end of it all, the variable \"result\" now has the desired value.",
|
||||
};
|
||||
}
|
||||
|
||||
@ -20,6 +20,8 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIScreenRadioTorch extends GuiScreen {
|
||||
|
||||
public static final int MAX_CHAN_LENGTH = 15;
|
||||
|
||||
protected ResourceLocation texture;
|
||||
protected static final ResourceLocation textureSender = new ResourceLocation(RefStrings.MODID + ":textures/gui/machine/gui_rtty_sender.png");
|
||||
@ -61,7 +63,7 @@ public class GUIScreenRadioTorch extends GuiScreen {
|
||||
this.frequency.setTextColor(0x00ff00);
|
||||
this.frequency.setDisabledTextColour(0x00ff00);
|
||||
this.frequency.setEnableBackgroundDrawing(false);
|
||||
this.frequency.setMaxStringLength(10);
|
||||
this.frequency.setMaxStringLength(MAX_CHAN_LENGTH);
|
||||
this.frequency.setText(radio.channel == null ? "" : radio.channel);
|
||||
|
||||
this.remap = new GuiTextField[16];
|
||||
|
||||
@ -58,7 +58,7 @@ public class GUIScreenRadioTorchController extends GuiScreen {
|
||||
this.frequency.setTextColor(0x00ff00);
|
||||
this.frequency.setDisabledTextColour(0x00ff00);
|
||||
this.frequency.setEnableBackgroundDrawing(false);
|
||||
this.frequency.setMaxStringLength(10);
|
||||
this.frequency.setMaxStringLength(GUIScreenRadioTorch.MAX_CHAN_LENGTH);
|
||||
this.frequency.setText(rtty.channel == null ? "" : rtty.channel);
|
||||
}
|
||||
|
||||
|
||||
@ -52,7 +52,7 @@ public class GUIScreenRadioTorchLogic extends GuiScreen {
|
||||
this.frequency.setTextColor(0x00ff00);
|
||||
this.frequency.setDisabledTextColour(0x00ff00);
|
||||
this.frequency.setEnableBackgroundDrawing(false);
|
||||
this.frequency.setMaxStringLength(10);
|
||||
this.frequency.setMaxStringLength(GUIScreenRadioTorch.MAX_CHAN_LENGTH);
|
||||
this.frequency.setText(logic.channel == null ? "" : logic.channel);
|
||||
|
||||
this.map = new GuiTextField[16];
|
||||
|
||||
@ -59,7 +59,7 @@ public class GUIScreenRadioTorchReader extends GuiScreen {
|
||||
this.frequencies[i].setTextColor(0x00ff00);
|
||||
this.frequencies[i].setDisabledTextColour(0x00ff00);
|
||||
this.frequencies[i].setEnableBackgroundDrawing(false);
|
||||
this.frequencies[i].setMaxStringLength(15);
|
||||
this.frequencies[i].setMaxStringLength(GUIScreenRadioTorch.MAX_CHAN_LENGTH);
|
||||
this.frequencies[i].setText(rtty.channels[i] == null ? "" : rtty.channels[i]);
|
||||
|
||||
this.names[i] = new GuiTextField(this.fontRendererObj, guiLeft + 119 + oX, guiTop + 53 + i * 18 + oY, 126 - oX * 2, 14);
|
||||
|
||||
@ -328,6 +328,15 @@ public abstract class GuiInfoContainer extends GuiContainer implements INEIGuiHa
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
}
|
||||
|
||||
public void clickSendFlag(TileEntity tile, int x, int y, int left, int top, int sizeX, int sizeY, String name) {
|
||||
if(checkClick(x, y, left, top, sizeX, sizeY)) {
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setBoolean(name, true);
|
||||
PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, tile.xCoord, tile.yCoord, tile.zCoord));
|
||||
}
|
||||
}
|
||||
|
||||
///NEI drag and drop support
|
||||
@Override
|
||||
@Optional.Method(modid = "NotEnoughItems")
|
||||
|
||||
@ -239,10 +239,13 @@ public class AssemblyMachineRecipes extends GenericRecipes<GenericRecipe> {
|
||||
.inputItems(new OreDictStack(STEEL.plate(), 8), new OreDictStack(CU.plate(), 4), new ComparableStack(ModItems.motor, 2))
|
||||
.inputItemsEx(new ComparableStack(ModItems.item_expensive, 1, EnumExpensiveType.STEEL_PLATING), new OreDictStack(CU.plate(), 4), new ComparableStack(ModItems.motor, 2)));
|
||||
this.register(new GenericRecipe("ass.assembler").setup(200, 100).outputItems(new ItemStack(ModBlocks.machine_assembly_machine, 1))
|
||||
.inputItems(new OreDictStack(STEEL.ingot(), 4), new OreDictStack(CU.plate(), 4), new ComparableStack(ModItems.motor, 2), new ComparableStack(ModItems.circuit, 1, EnumCircuitType.ANALOG)));
|
||||
.inputItems(new OreDictStack(STEEL.ingot(), 4), new OreDictStack(CU.plate(), 4), new ComparableStack(ModItems.motor, 2), new ComparableStack(ModItems.circuit, 1, EnumCircuitType.BASIC)));
|
||||
this.register(new GenericRecipe("ass.chemplant").setup(200, 100).outputItems(new ItemStack(ModBlocks.machine_chemical_plant, 1))
|
||||
.inputItems(new OreDictStack(STEEL.ingot(), 8), new OreDictStack(CU.pipe(), 2), new ComparableStack(ModItems.plate_polymer, 16), new ComparableStack(ModItems.motor, 2), new ComparableStack(ModItems.coil_tungsten, 2), new ComparableStack(ModItems.circuit, 1, EnumCircuitType.ANALOG))
|
||||
.inputItemsEx(new ComparableStack(ModItems.item_expensive, 3, EnumExpensiveType.STEEL_PLATING), new OreDictStack(CU.pipe(), 2), new ComparableStack(ModItems.plate_polymer, 16), new ComparableStack(ModItems.motor, 2), new ComparableStack(ModItems.coil_tungsten, 2), new ComparableStack(ModItems.circuit, 3, EnumCircuitType.ANALOG)));
|
||||
this.register(new GenericRecipe("ass.chemplantAlt").setup(200, 100).outputItems(new ItemStack(ModBlocks.machine_chemical_plant, 1))
|
||||
.inputItems(new OreDictStack(DURA.plate(), 8), new OreDictStack(CU.pipe(), 4), new ComparableStack(ModItems.motor, 2), new ComparableStack(ModItems.circuit, 1, EnumCircuitType.BASIC))
|
||||
.inputItemsEx(new ComparableStack(ModItems.item_expensive, 5, EnumExpensiveType.STEEL_PLATING), new OreDictStack(CU.pipe(), 4), new ComparableStack(ModItems.motor, 2), new ComparableStack(ModItems.circuit, 2, EnumCircuitType.BASIC)));
|
||||
this.register(new GenericRecipe("ass.purex").setup(300, 100).outputItems(new ItemStack(ModBlocks.machine_purex, 1))
|
||||
.inputItems(new OreDictStack(STEEL.shell(), 4), new OreDictStack(RUBBER.pipe(), 8), new OreDictStack(PB.plateCast(), 4), new ComparableStack(ModItems.motor_desh, 1), new ComparableStack(ModItems.circuit, 4, EnumCircuitType.BASIC))
|
||||
.inputItemsEx(new ComparableStack(ModItems.item_expensive, 2, EnumExpensiveType.LEAD_PLATING), new OreDictStack(STEEL.shell(), 4), new OreDictStack(RUBBER.pipe(), 12), new ComparableStack(ModItems.motor_desh, 3), new ComparableStack(ModItems.item_expensive, 2, EnumExpensiveType.CIRCUIT)));
|
||||
@ -265,7 +268,7 @@ public class AssemblyMachineRecipes extends GenericRecipes<GenericRecipe> {
|
||||
this.register(new GenericRecipe("ass.electrolyzer").setup(200, 100).outputItems(new ItemStack(ModBlocks.machine_electrolyser, 1))
|
||||
.inputItems(new OreDictStack(STEEL.plateCast(), 8), new OreDictStack(CU.plate(), 16), new OreDictStack(TI.shell(), 3), new OreDictStack(RUBBER.ingot(), 8), new ComparableStack(ModItems.ingot_firebrick, 16), new ComparableStack(ModItems.coil_copper, 16), new ComparableStack(ModItems.circuit, 8, EnumCircuitType.BASIC))
|
||||
.inputItemsEx(new ComparableStack(ModItems.item_expensive, 4, EnumExpensiveType.HEAVY_FRAME), new OreDictStack(TI.shell(), 3), new OreDictStack(RUBBER.ingot(), 8), new ComparableStack(ModItems.ingot_firebrick, 16), new ComparableStack(ModItems.coil_copper, 16), new ComparableStack(ModItems.item_expensive, 4, EnumExpensiveType.CIRCUIT)));
|
||||
this.register(new GenericRecipe("ass.rtg").setup(200, 100).outputItems(new ItemStack(ModBlocks.machine_rtg_grey, 1))
|
||||
this.register(new GenericRecipe("ass.rtg").setup(200, 100).outputItems(new ItemStack(ModBlocks.machine_rtg, 1))
|
||||
.inputItems(new ComparableStack(ModItems.rtg_unit, 3), new OreDictStack(STEEL.plate(), 4), new OreDictStack(MINGRADE.wireFine(), 16), new OreDictStack(ANY_PLASTIC.ingot(), 4)));
|
||||
this.register(new GenericRecipe("ass.derrick").setup(200, 100).outputItems(new ItemStack(ModBlocks.machine_well, 1))
|
||||
.inputItems(new OreDictStack(STEEL.plate(), 8), new OreDictStack(CU.plateCast(), 2), new OreDictStack(STEEL.pipe(), 4), new ComparableStack(ModItems.motor, 1), new ComparableStack(ModItems.drill_titanium, 1))
|
||||
@ -399,7 +402,7 @@ public class AssemblyMachineRecipes extends GenericRecipes<GenericRecipe> {
|
||||
.inputItems(new OreDictStack(TI.shell(), 8), new OreDictStack(DURA.pipe(), 4), new OreDictStack(ANY_PLASTIC.ingot(), 12), new ComparableStack(ModItems.turbine_tungsten, 1), new OreDictStack(GOLD.wireDense(), 12), new ComparableStack(ModItems.circuit, 3, EnumCircuitType.BASIC.ordinal()))
|
||||
.inputItemsEx(new ComparableStack(ModItems.item_expensive, 3, EnumExpensiveType.HEAVY_FRAME), new OreDictStack(ANY_PLASTIC.ingot(), 16), new ComparableStack(ModItems.turbine_tungsten, 3), new OreDictStack(GOLD.wireDense(), 16), new ComparableStack(ModItems.item_expensive, 3, EnumExpensiveType.CIRCUIT)));
|
||||
this.register(new GenericRecipe("ass.gasturbine").setup(400, 100).outputItems(new ItemStack(ModBlocks.machine_turbinegas, 1))
|
||||
.inputItems(new OreDictStack(STEEL.shell(), 10), new OreDictStack(GOLD.wireDense(), 12), new OreDictStack(DURA.pipe(), 4),new OreDictStack(STEEL.pipe(), 4), new ComparableStack(ModItems.turbine_tungsten, 1), new ComparableStack(ModItems.ingot_rubber, 12), new ComparableStack(ModItems.circuit, 3, EnumCircuitType.BASIC.ordinal()))
|
||||
.inputItems(new OreDictStack(STEEL.shell(), 10), new OreDictStack(GOLD.wireDense(), 12), new OreDictStack(DURA.pipe(), 4),new OreDictStack(STEEL.pipe(), 4), new ComparableStack(ModItems.turbine_tungsten, 1), new OreDictStack(RUBBER.ingot(), 12), new ComparableStack(ModItems.circuit, 3, EnumCircuitType.BASIC.ordinal()))
|
||||
.inputItemsEx(new ComparableStack(ModItems.item_expensive, 4, EnumExpensiveType.HEAVY_FRAME), new OreDictStack(GOLD.wireDense(), 16), new OreDictStack(DURA.pipe(), 16), new ComparableStack(ModItems.turbine_tungsten, 2), new ComparableStack(ModItems.item_expensive, 3, EnumExpensiveType.CIRCUIT)));
|
||||
this.register(new GenericRecipe("ass.hephaestus").setup(200, 100).outputItems(new ItemStack(ModBlocks.machine_hephaestus, 1))
|
||||
.inputItems(new OreDictStack(STEEL.pipe(), 12), new OreDictStack(STEEL.ingot(), 24), new OreDictStack(CU.plate(), 24), new OreDictStack(NB.ingot(), 4), new OreDictStack(RUBBER.ingot(), 12), new ComparableStack(ModBlocks.glass_quartz, 16))
|
||||
|
||||
@ -43,9 +43,21 @@ public class PUREXRecipes extends GenericRecipes<PUREXRecipe> {
|
||||
this.register((PUREXRecipe) new PUREXRecipe("purex.uzh").setup(600, 1_000)
|
||||
.inputItems(new ComparableStack(ModItems.billet_uranium_fuel),
|
||||
new OreDictStack(ZR.billet(), 3))
|
||||
.inputFluids(new FluidStack(Fluids.NITRIC_ACID, 1000), new FluidStack(Fluids.HYDROGEN, 4000))
|
||||
.inputFluids(new FluidStack(Fluids.NITRIC_ACID, 1_000), new FluidStack(Fluids.HYDROGEN, 4000))
|
||||
.outputItems(new ItemStack(ModItems.billet_uzh, 4)));
|
||||
|
||||
this.register((PUREXRecipe) new PUREXRecipe("purex.flashgold").setup(600, 1_000)
|
||||
.inputItems(new OreDictStack(AU198.billet()),
|
||||
new ComparableStack(ModItems.pellet_charged))
|
||||
.inputFluids(new FluidStack(Fluids.AMAT, 1_000))
|
||||
.outputItems(new ItemStack(ModItems.billet_balefire_gold, 2)));
|
||||
|
||||
this.register((PUREXRecipe) new PUREXRecipe("purex.flashlead").setup(600, 1_000)
|
||||
.inputItems(new OreDictStack(PB209.billet()),
|
||||
new ComparableStack(ModItems.billet_balefire_gold))
|
||||
.inputFluids(new FluidStack(Fluids.AMAT, 1_000))
|
||||
.outputItems(new ItemStack(ModItems.billet_flashlead, 1)));
|
||||
|
||||
//CP-1
|
||||
String autoPile = "autoswitch.pile";
|
||||
this.register((PUREXRecipe) new PUREXRecipe("purex.pilepu").setup(40, pilePower).setNameWrapper("purex.recycle").setGroup(autoPile, this)
|
||||
|
||||
@ -173,7 +173,6 @@ public class ShredderRecipes extends SerializableRecipe {
|
||||
ShredderRecipes.setRecipe(Blocks.tnt, new ItemStack(Items.gunpowder, Compat.isModLoaded(Compat.MOD_GT6) ? 4 : 5));
|
||||
ShredderRecipes.setRecipe(DictFrame.fromOne(ModBlocks.stone_resource, EnumStoneType.LIMESTONE), new ItemStack(ModItems.powder_limestone, 4));
|
||||
ShredderRecipes.setRecipe(ModBlocks.stone_gneiss, new ItemStack(ModItems.powder_lithium_tiny, 1));
|
||||
ShredderRecipes.setRecipe(ModItems.powder_lapis, new ItemStack(ModItems.powder_cobalt_tiny, 1));
|
||||
ShredderRecipes.setRecipe(ModItems.fragment_neodymium, new ItemStack(ModItems.powder_neodymium_tiny, 1));
|
||||
ShredderRecipes.setRecipe(ModItems.fragment_cobalt, new ItemStack(ModItems.powder_cobalt_tiny, 1));
|
||||
ShredderRecipes.setRecipe(ModItems.fragment_niobium, new ItemStack(ModItems.powder_niobium_tiny, 1));
|
||||
@ -213,11 +212,13 @@ public class ShredderRecipes extends SerializableRecipe {
|
||||
List<ItemStack> logs = OreDictionary.getOres("logWood");
|
||||
List<ItemStack> planks = OreDictionary.getOres("plankWood");
|
||||
List<ItemStack> saplings = OreDictionary.getOres("treeSapling");
|
||||
List<ItemStack> lapis = OreDictionary.getOres("dustLapis");
|
||||
|
||||
for(ItemStack log : logs) ShredderRecipes.setRecipe(log, new ItemStack(ModItems.powder_sawdust, 4));
|
||||
for(ItemStack plank : planks) ShredderRecipes.setRecipe(plank, new ItemStack(ModItems.powder_sawdust, 1));
|
||||
for(ItemStack sapling : saplings) ShredderRecipes.setRecipe(sapling, new ItemStack(Items.stick, 1));
|
||||
|
||||
for(ItemStack dust : lapis) ShredderRecipes.setRecipe(dust, new ItemStack(ModItems.powder_cobalt_tiny, 1));
|
||||
|
||||
for(EnumBedrockOre ore : EnumBedrockOre.values()) {
|
||||
int i = ore.ordinal();
|
||||
ShredderRecipes.setRecipe(new ItemStack(ModItems.ore_bedrock, 1, i), new ItemStack(ModItems.ore_enriched, 1, i));
|
||||
|
||||
@ -967,19 +967,6 @@ public class AnvilRecipes extends SerializableRecipe {
|
||||
new AnvilOutput(new ItemStack(ModItems.circuit, 1, EnumCircuitType.BASIC.ordinal())),
|
||||
new AnvilOutput(new ItemStack(ModItems.circuit, 1, EnumCircuitType.BASIC.ordinal()), 0.5F),
|
||||
}).setTier(4));
|
||||
constructionRecipes.add(new AnvilConstructionRecipe(
|
||||
new ComparableStack(ModItems.pile_rod_plutonium), new AnvilOutput[] {
|
||||
new AnvilOutput(new ItemStack(ModItems.billet_pu_mix, 2)),
|
||||
new AnvilOutput(new ItemStack(ModItems.billet_uranium, 1)),
|
||||
new AnvilOutput(new ItemStack(ModItems.plate_iron, 2))
|
||||
}).setTier(2));
|
||||
constructionRecipes.add(new AnvilConstructionRecipe(
|
||||
new ComparableStack(ModItems.pile_rod_pu239), new AnvilOutput[] {
|
||||
new AnvilOutput(new ItemStack(ModItems.billet_pu239, 1)), //Might need to be cut to 3 nuggets, but a full billet is nice and round
|
||||
new AnvilOutput(new ItemStack(ModItems.billet_pu_mix, 1)),
|
||||
new AnvilOutput(new ItemStack(ModItems.billet_uranium, 1)),
|
||||
new AnvilOutput(new ItemStack(ModItems.plate_iron, 2))
|
||||
}).setTier(2));
|
||||
|
||||
} else {
|
||||
constructionRecipes.add(new AnvilConstructionRecipe(
|
||||
|
||||
@ -188,19 +188,19 @@ public class ModItems {
|
||||
public static Item ingot_mercury; //It's to prevent any ambiguity, as it was treated as a full ingot in the past anyway
|
||||
public static Item bottle_mercury;
|
||||
|
||||
public static Item ore_byproduct; //byproduct of variable purity and quantity, can be treated as a nugget, might require shredding or acidizing, depends on the type
|
||||
@Deprecated public static Item ore_byproduct;
|
||||
|
||||
public static Item ore_bedrock;
|
||||
public static Item ore_centrifuged;
|
||||
public static Item ore_cleaned;
|
||||
public static Item ore_separated;
|
||||
public static Item ore_purified;
|
||||
public static Item ore_nitrated;
|
||||
public static Item ore_nitrocrystalline;
|
||||
public static Item ore_deepcleaned;
|
||||
public static Item ore_seared;
|
||||
//public static Item ore_radcleaned;
|
||||
public static Item ore_enriched; //final stage
|
||||
@Deprecated public static Item ore_bedrock;
|
||||
@Deprecated public static Item ore_centrifuged;
|
||||
@Deprecated public static Item ore_cleaned;
|
||||
@Deprecated public static Item ore_separated;
|
||||
@Deprecated public static Item ore_purified;
|
||||
@Deprecated public static Item ore_nitrated;
|
||||
@Deprecated public static Item ore_nitrocrystalline;
|
||||
@Deprecated public static Item ore_deepcleaned;
|
||||
@Deprecated public static Item ore_seared;
|
||||
@Deprecated public static Item ore_enriched; //final stage
|
||||
|
||||
public static Item bedrock_ore_base;
|
||||
public static Item bedrock_ore;
|
||||
public static Item bedrock_ore_fragment;
|
||||
@ -2295,18 +2295,18 @@ public class ModItems {
|
||||
ingot_mud = new Item().setUnlocalizedName("ingot_mud").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":ingot_mud");
|
||||
ingot_cft = new Item().setUnlocalizedName("ingot_cft").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":ingot_cft");
|
||||
|
||||
ore_byproduct = new ItemByproduct().setUnlocalizedName("ore_byproduct").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":byproduct");
|
||||
ore_byproduct = new ItemByproduct().setUnlocalizedName("ore_byproduct").setCreativeTab(null).setTextureName(RefStrings.MODID + ":byproduct");
|
||||
|
||||
ore_bedrock = new ItemBedrockOre().setUnlocalizedName("ore_bedrock").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":ore_bedrock");
|
||||
ore_centrifuged = new ItemBedrockOre().setUnlocalizedName("ore_centrifuged").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":ore_centrifuged");
|
||||
ore_cleaned = new ItemBedrockOre().setUnlocalizedName("ore_cleaned").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":ore_cleaned");
|
||||
ore_separated = new ItemBedrockOre().setUnlocalizedName("ore_separated").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":ore_separated");
|
||||
ore_purified = new ItemBedrockOre().setUnlocalizedName("ore_purified").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":ore_purified");
|
||||
ore_nitrated = new ItemBedrockOre().setUnlocalizedName("ore_nitrated").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":ore_nitrated");
|
||||
ore_nitrocrystalline = new ItemBedrockOre().setUnlocalizedName("ore_nitrocrystalline").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":ore_nitrocrystalline");
|
||||
ore_deepcleaned = new ItemBedrockOre().setUnlocalizedName("ore_deepcleaned").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":ore_deepcleaned");
|
||||
ore_seared = new ItemBedrockOre().setUnlocalizedName("ore_seared").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":ore_seared");
|
||||
ore_enriched = new ItemBedrockOre().setUnlocalizedName("ore_enriched").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":ore_enriched");
|
||||
ore_bedrock = new ItemBedrockOre().setUnlocalizedName("ore_bedrock").setCreativeTab(null).setTextureName(RefStrings.MODID + ":ore_bedrock");
|
||||
ore_centrifuged = new ItemBedrockOre().setUnlocalizedName("ore_centrifuged").setCreativeTab(null).setTextureName(RefStrings.MODID + ":ore_centrifuged");
|
||||
ore_cleaned = new ItemBedrockOre().setUnlocalizedName("ore_cleaned").setCreativeTab(null).setTextureName(RefStrings.MODID + ":ore_cleaned");
|
||||
ore_separated = new ItemBedrockOre().setUnlocalizedName("ore_separated").setCreativeTab(null).setTextureName(RefStrings.MODID + ":ore_separated");
|
||||
ore_purified = new ItemBedrockOre().setUnlocalizedName("ore_purified").setCreativeTab(null).setTextureName(RefStrings.MODID + ":ore_purified");
|
||||
ore_nitrated = new ItemBedrockOre().setUnlocalizedName("ore_nitrated").setCreativeTab(null).setTextureName(RefStrings.MODID + ":ore_nitrated");
|
||||
ore_nitrocrystalline = new ItemBedrockOre().setUnlocalizedName("ore_nitrocrystalline").setCreativeTab(null).setTextureName(RefStrings.MODID + ":ore_nitrocrystalline");
|
||||
ore_deepcleaned = new ItemBedrockOre().setUnlocalizedName("ore_deepcleaned").setCreativeTab(null).setTextureName(RefStrings.MODID + ":ore_deepcleaned");
|
||||
ore_seared = new ItemBedrockOre().setUnlocalizedName("ore_seared").setCreativeTab(null).setTextureName(RefStrings.MODID + ":ore_seared");
|
||||
ore_enriched = new ItemBedrockOre().setUnlocalizedName("ore_enriched").setCreativeTab(null).setTextureName(RefStrings.MODID + ":ore_enriched");
|
||||
bedrock_ore_base = new ItemBedrockOreBase().setUnlocalizedName("bedrock_ore_base").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":bedrock_ore_new");
|
||||
bedrock_ore = new ItemBedrockOreNew().setUnlocalizedName("bedrock_ore").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":bedrock_ore_new");
|
||||
bedrock_ore_fragment = new ItemAutogen(MaterialShapes.FRAGMENT).aot(Mats.MAT_BISMUTH, "bedrock_ore_fragment_bismuth").setUnlocalizedName("bedrock_ore_fragment").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":bedrock_ore_fragment");
|
||||
|
||||
@ -6,6 +6,7 @@ import com.hbm.items.ItemEnumMulti;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.EnumUtil;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import api.hbm.energymk2.IBatteryItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@ -58,5 +59,9 @@ public class ItemBatterySC extends ItemEnumMulti implements IBatteryItem {
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) {
|
||||
EnumBatterySC pack = EnumUtil.grabEnumSafely(EnumBatterySC.class, stack.getItemDamage());
|
||||
if(pack.power > 0) list.add(EnumChatFormatting.YELLOW + "Discharge rate: " + BobMathUtil.getShortNumber(pack.power) + "HE/t");
|
||||
|
||||
for(String line : I18nUtil.resolveKeyArray(this.getUnlocalizedName() + ".desc")) {
|
||||
list.add(EnumChatFormatting.RED + line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -108,7 +108,7 @@ public class ItemStarterKit extends Item {
|
||||
player.inventory.addItemStackToInventory(new ItemStack(ModBlocks.reactor_research, 4));
|
||||
player.inventory.addItemStackToInventory(new ItemStack(ModBlocks.machine_turbine, 4));
|
||||
player.inventory.addItemStackToInventory(new ItemStack(ModBlocks.machine_radgen, 1));
|
||||
player.inventory.addItemStackToInventory(new ItemStack(ModBlocks.machine_rtg_grey, 1));
|
||||
player.inventory.addItemStackToInventory(new ItemStack(ModBlocks.machine_rtg, 1));
|
||||
player.inventory.addItemStackToInventory(new ItemStack(ModBlocks.machine_assembly_machine, 3));
|
||||
player.inventory.addItemStackToInventory(new ItemStack(ModBlocks.machine_chemical_plant, 2));
|
||||
player.inventory.addItemStackToInventory(new ItemStack(ModBlocks.machine_fluidtank, 1));
|
||||
|
||||
@ -140,26 +140,10 @@ public class HbmWorldGen implements IWorldGenerator {
|
||||
|
||||
DungeonToolbox.generateOre(world, rand, i, j, WorldConfig.limestoneSpawn, 16, 25, 30, ModBlocks.stone_resource, EnumStoneType.LIMESTONE.ordinal());
|
||||
|
||||
if(WorldConfig.newBedrockOres) {
|
||||
|
||||
if(rand.nextInt(10) == 0) {
|
||||
int randPosX = i + rand.nextInt(2) + 8;
|
||||
int randPosZ = j + rand.nextInt(2) + 8;
|
||||
|
||||
BedrockOre.generateAuto(world, randPosX, randPosZ);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if(rand.nextInt(3) == 0) {
|
||||
@SuppressWarnings("unchecked")
|
||||
WeightedRandomGeneric<BedrockOreDefinition> item = (WeightedRandomGeneric<BedrockOreDefinition>) WeightedRandom.getRandomItem(rand, BedrockOre.weightedOres);
|
||||
BedrockOreDefinition def = item.get();
|
||||
|
||||
int randPosX = i + rand.nextInt(2) + 8;
|
||||
int randPosZ = j + rand.nextInt(2) + 8;
|
||||
BedrockOre.generate(world, randPosX, randPosZ, def.stack, def.acid, def.color, def.tier);
|
||||
}
|
||||
if(rand.nextInt(10) == 0) {
|
||||
int randPosX = i + rand.nextInt(2) + 8;
|
||||
int randPosZ = j + rand.nextInt(2) + 8;
|
||||
BedrockOre.generateAuto(world, randPosX, randPosZ);
|
||||
}
|
||||
|
||||
if(GeneralConfig.enable528ColtanSpawn) {
|
||||
|
||||
@ -189,6 +189,9 @@ public class ClientProxy extends ServerProxy {
|
||||
GunFactoryClient.init();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean advancedTooltips() { return Minecraft.getMinecraft().gameSettings.advancedItemTooltips; }
|
||||
|
||||
@Override
|
||||
public void registerTileEntitySpecialRenderer() {
|
||||
//test crap
|
||||
@ -304,7 +307,6 @@ public class ClientProxy extends ServerProxy {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineCrystallizer.class, new RenderCrystallizer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMicrowave.class, new RenderMicrowave());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineRTG.class, new RenderRTG());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineMiniRTG.class, new RenderRTG());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityFF.class, new RenderForceField());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityForceField.class, new RenderMachineForceField());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineFENSU.class, new RenderFENSU());
|
||||
|
||||
@ -248,7 +248,6 @@ public class CraftingManager {
|
||||
addRecipeAuto(new ItemStack(ModBlocks.red_pylon_medium_steel, 2), new Object[] { "CCW", "IIW", " S", 'C', ModItems.coil_copper, 'W', STEEL.pipe(), 'I', ModItems.plate_polymer, 'S', KEY_COBBLESTONE });
|
||||
addShapelessAuto(new ItemStack(ModBlocks.red_pylon_medium_steel_transformer, 1), new Object[] { ModBlocks.red_pylon_medium_steel, ModItems.plate_polymer, ModItems.coil_copper });
|
||||
addRecipeAuto(new ItemStack(ModBlocks.machine_wood_burner, 1), new Object[] { "PPP", "CFC", "I I" , 'P', STEEL.plate(), 'C', ModItems.coil_copper, 'I', IRON.ingot(), 'F', Blocks.furnace});
|
||||
addRecipeAuto(new ItemStack(ModBlocks.machine_turbine, 1), new Object[] { "SMS", "PTP", "SMS", 'S', STEEL.ingot(), 'T', ModItems.turbine_titanium, 'M', ModItems.coil_copper, 'P', ANY_PLASTIC.ingot() });
|
||||
addRecipeAuto(new ItemStack(ModBlocks.machine_converter_he_rf, 1), new Object[] { "RRR", "WWW", "III", 'R', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.CAPACITOR), 'W', REDSTONE.dust(), 'I', STEEL.ingot() });
|
||||
addRecipeAuto(new ItemStack(ModBlocks.machine_converter_rf_he, 1), new Object[] { "RRR", "WWW", "III", 'R', REDSTONE.dust(), 'W', MINGRADE.wireFine(), 'I', STEEL.ingot() });
|
||||
addRecipeAuto(new ItemStack(ModBlocks.crate_iron, 1), new Object[] { "PPP", "I I", "III", 'P', IRON.plate(), 'I', IRON.ingot() });
|
||||
|
||||
@ -1629,6 +1629,8 @@ public class MainRegistry {
|
||||
ignoreMappings.add("hbm:item.coil_advanced_alloy");
|
||||
ignoreMappings.add("hbm:item.coil_advanced_torus");
|
||||
ignoreMappings.add("hbm:item.blades_advanced_alloy");
|
||||
ignoreMappings.add("hbm:tile.machine_minirtg");
|
||||
ignoreMappings.add("hbm:tile.machine_powerrtg");
|
||||
|
||||
/// REMAP ///
|
||||
remapItems.put("hbm:item.gadget_explosive8", ModItems.early_explosive_lenses);
|
||||
|
||||
@ -674,8 +674,6 @@ public class ResourceManager {
|
||||
|
||||
//RTG
|
||||
public static final ResourceLocation rtg_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/rtg.png");
|
||||
public static final ResourceLocation rtg_cell_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/rtg_cell.png");
|
||||
public static final ResourceLocation rtg_polonium_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/rtg_polonium.png");
|
||||
|
||||
//Waste Drum
|
||||
public static final ResourceLocation waste_drum_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/drum_gray.png");
|
||||
|
||||
@ -72,6 +72,8 @@ public class ServerProxy {
|
||||
public EntityPlayer me() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean advancedTooltips() { return false; }
|
||||
|
||||
public boolean isVanished(Entity e) {
|
||||
return false;
|
||||
|
||||
@ -69,8 +69,9 @@ public class PacketDispatcher {
|
||||
wrapper.registerMessage(HeldItemNBTPacket.Handler.class, HeldItemNBTPacket.class, i++, Side.CLIENT);
|
||||
//Syncs muzzle flashes of SEDNA guns for clients from other entities/players
|
||||
wrapper.registerMessage(MuzzleFlashPacket.Handler.class, MuzzleFlashPacket.class, i++, Side.CLIENT);
|
||||
//Sends custom container-bound payload from a server container to a client one
|
||||
wrapper.registerMessage(ContainerCustomPayloadPacket.Handler.class, ContainerCustomPayloadPacket.class, i++, Side.CLIENT);
|
||||
//Sends custom container-bound payload between client and server, dual-use capable
|
||||
wrapper.registerMessage(ContainerNBTCommsPacket.Handler.class, ContainerNBTCommsPacket.class, i++, Side.CLIENT);
|
||||
wrapper.registerMessage(ContainerNBTCommsPacket.Handler.class, ContainerNBTCommsPacket.class, i++, Side.SERVER);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -7,20 +7,18 @@ import com.hbm.util.BufferUtil;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class ContainerCustomPayloadPacket implements IMessage {
|
||||
public class ContainerNBTCommsPacket implements IMessage {
|
||||
|
||||
int windowId;
|
||||
NBTTagCompound data;
|
||||
|
||||
public ContainerCustomPayloadPacket() { }
|
||||
public ContainerNBTCommsPacket() { }
|
||||
|
||||
public ContainerCustomPayloadPacket(int windowId, NBTTagCompound data) {
|
||||
public ContainerNBTCommsPacket(int windowId, NBTTagCompound data) {
|
||||
this.windowId = windowId;
|
||||
this.data = data;
|
||||
}
|
||||
@ -37,14 +35,15 @@ public class ContainerCustomPayloadPacket implements IMessage {
|
||||
BufferUtil.writeNBT(buf, this.data);
|
||||
}
|
||||
|
||||
public static class Handler implements IMessageHandler<ContainerCustomPayloadPacket, IMessage> {
|
||||
public static class Handler implements IMessageHandler<ContainerNBTCommsPacket, IMessage> {
|
||||
|
||||
@SideOnly(Side.CLIENT) @Override
|
||||
public IMessage onMessage(ContainerCustomPayloadPacket m, MessageContext ctx) {
|
||||
EntityPlayer player = MainRegistry.proxy.me();
|
||||
@Override
|
||||
public IMessage onMessage(ContainerNBTCommsPacket m, MessageContext ctx) {
|
||||
|
||||
EntityPlayer player = ctx.side.isClient() ? MainRegistry.proxy.me() : ctx.getServerHandler().playerEntity;
|
||||
if(player.openContainer instanceof ICustomPayloadReceiver) {
|
||||
ICustomPayloadReceiver cus = (ICustomPayloadReceiver) player.openContainer;
|
||||
cus.acceptData(m.windowId, m.data);
|
||||
cus.acceptData(ctx.side, m.windowId, m.data);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -3,17 +3,12 @@ package com.hbm.render.entity.projectile;
|
||||
import java.util.Random;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import com.hbm.entity.projectile.EntityBulletBaseNT;
|
||||
import com.hbm.entity.projectile.IBulletBase;
|
||||
import com.hbm.handler.BulletConfiguration;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.render.model.ModelBullet;
|
||||
import com.hbm.render.util.RenderSparks;
|
||||
import com.hbm.util.Tuple.Pair;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
@ -22,20 +17,12 @@ import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
@Deprecated
|
||||
@Deprecated // the entire old bullet system should finally fucking die i hate it
|
||||
public class RenderBullet extends Render {
|
||||
|
||||
private ModelBullet bullet;
|
||||
|
||||
public RenderBullet() {
|
||||
bullet = new ModelBullet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRender(Entity bullet, double x, double y, double z, float f0, float f1) {
|
||||
|
||||
@ -54,21 +41,14 @@ public class RenderBullet extends Render {
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
|
||||
switch(style) {
|
||||
case BulletConfiguration.STYLE_NONE: break;
|
||||
case BulletConfiguration.STYLE_NORMAL: renderBullet(trail); break;
|
||||
case BulletConfiguration.STYLE_PISTOL: renderPistol(trail); break;
|
||||
case BulletConfiguration.STYLE_BOLT: renderDart(trail, bullet.getEntityId()); break;
|
||||
case BulletConfiguration.STYLE_FLECHETTE: renderFlechette(); break;
|
||||
case BulletConfiguration.STYLE_FOLLY: renderBullet(trail); break;
|
||||
case BulletConfiguration.STYLE_PELLET: renderBuckshot(); break;
|
||||
case BulletConfiguration.STYLE_ROCKET: renderRocket(trail); break;
|
||||
case BulletConfiguration.STYLE_GRENADE: renderGrenade(trail); break;
|
||||
case BulletConfiguration.STYLE_ORB: renderOrb(trail); break;
|
||||
case BulletConfiguration.STYLE_METEOR: renderMeteor(trail); break;
|
||||
case BulletConfiguration.STYLE_APDS: renderAPDS(); break;
|
||||
case BulletConfiguration.STYLE_BLADE: renderBlade(); break;
|
||||
case BulletConfiguration.STYLE_TAU: renderTau(bullet, trail, f1); break;
|
||||
case BulletConfiguration.STYLE_LEADBURSTER: renderLeadburster(bullet, f1); break;
|
||||
default: renderBullet(trail); break;
|
||||
}
|
||||
|
||||
@ -78,48 +58,13 @@ public class RenderBullet extends Render {
|
||||
|
||||
private void renderBullet(int type) {
|
||||
|
||||
if (type == 2) {
|
||||
bindTexture(new ResourceLocation(RefStrings.MODID + ":textures/models/emplacer.png"));
|
||||
bullet.renderAll(0.0625F);
|
||||
} else if (type == 1) {
|
||||
bindTexture(new ResourceLocation(RefStrings.MODID + ":textures/models/tau.png"));
|
||||
bullet.renderAll(0.0625F);
|
||||
} else if (type == 0) {
|
||||
|
||||
GL11.glScaled(0.5, 0.5, 0.5);
|
||||
GL11.glRotated(90, 0, 0, 1);
|
||||
GL11.glRotated(90, 0, 1, 0);
|
||||
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
bindTexture(ResourceManager.bullet_rifle_tex);
|
||||
ResourceManager.projectiles.renderPart("BulletRifle");
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void renderPistol(int type) {
|
||||
|
||||
GL11.glScaled(0.5, 0.5, 0.5);
|
||||
GL11.glRotated(90, 0, 0, 1);
|
||||
GL11.glRotated(90, 0, 1, 0);
|
||||
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
bindTexture(ResourceManager.bullet_pistol_tex);
|
||||
ResourceManager.projectiles.renderPart("BulletPistol");
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
|
||||
}
|
||||
|
||||
private void renderBuckshot() {
|
||||
|
||||
GL11.glScaled(0.5, 0.5, 0.5);
|
||||
GL11.glRotated(90, 0, 0, 1);
|
||||
GL11.glRotated(90, 0, 1, 0);
|
||||
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
bindTexture(ResourceManager.buckshot_tex);
|
||||
ResourceManager.projectiles.renderPart("Buckshot");
|
||||
bindTexture(ResourceManager.bullet_rifle_tex);
|
||||
ResourceManager.projectiles.renderPart("BulletRifle");
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
}
|
||||
|
||||
@ -216,18 +161,6 @@ public class RenderBullet extends Render {
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
}
|
||||
|
||||
private void renderAPDS() {
|
||||
|
||||
GL11.glScaled(2, 2, 2);
|
||||
GL11.glRotated(90, 0, 0, 1);
|
||||
GL11.glRotated(90, 0, 1, 0);
|
||||
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
bindTexture(ResourceManager.flechette_tex);
|
||||
ResourceManager.projectiles.renderPart("Flechette");
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
}
|
||||
|
||||
private void renderDart(int style, int eID) {
|
||||
|
||||
float red = 1F;
|
||||
@ -239,15 +172,6 @@ public class RenderBullet extends Render {
|
||||
case BulletConfiguration.BOLT_NIGHTMARE: red = 1F; green = 1F; blue = 0F; break;
|
||||
case BulletConfiguration.BOLT_LACUNAE: red = 0.25F; green = 0F; blue = 0.75F; break;
|
||||
case BulletConfiguration.BOLT_WORM: red = 0F; green = 1F; blue = 0F; break;
|
||||
case BulletConfiguration.BOLT_GLASS_CYAN: red = 0F; green = 1F; blue = 1F; break;
|
||||
case BulletConfiguration.BOLT_GLASS_BLUE: red = 0F; green = 0F; blue = 1F; break;
|
||||
|
||||
case BulletConfiguration.BOLT_ZOMG:
|
||||
Random rand = new Random(eID * eID);
|
||||
red = rand.nextInt(2) * 0.6F;
|
||||
green = rand.nextInt(2) * 0.6F;
|
||||
blue = rand.nextInt(2) * 0.6F;
|
||||
break;
|
||||
}
|
||||
|
||||
GL11.glPushMatrix();
|
||||
@ -397,134 +321,8 @@ public class RenderBullet extends Render {
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
private void renderTau(Entity bullet, int trail, float interp) {
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
float scale = 0.125F;
|
||||
|
||||
double pX = bullet.prevPosX + (bullet.posX - bullet.prevPosX) * interp;
|
||||
double pY = bullet.prevPosY + (bullet.posY - bullet.prevPosY) * interp;
|
||||
double pZ = bullet.prevPosZ + (bullet.posZ - bullet.prevPosZ) * interp;
|
||||
|
||||
IBulletBase iface = (IBulletBase) bullet;
|
||||
|
||||
if(iface.prevY() == 0) {
|
||||
iface.prevX(pX);
|
||||
iface.prevY(pY);
|
||||
iface.prevZ(pZ);
|
||||
}
|
||||
|
||||
double deltaX = iface.prevX() - pX;
|
||||
double deltaY = iface.prevY() - pY;
|
||||
double deltaZ = iface.prevZ() - pZ;
|
||||
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
double dX = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double)interp;
|
||||
double dY = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double)interp;
|
||||
double dZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)interp;
|
||||
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(pX - dX, pY - dY, pZ - dZ);
|
||||
|
||||
float r = 1F;
|
||||
float g = 0.5F;
|
||||
float b = 0F;
|
||||
|
||||
if(trail == 1) {
|
||||
r = 1;
|
||||
g = 1;
|
||||
b = 1;
|
||||
}
|
||||
|
||||
for(Pair<Vec3, Double> pair : iface.nodes()) {
|
||||
Vec3 pos = pair.getKey();
|
||||
|
||||
double mult = 1D;
|
||||
pos.xCoord += deltaX * mult;
|
||||
pos.yCoord += deltaY * mult;
|
||||
pos.zCoord += deltaZ * mult;
|
||||
}
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0F, 1F, 0F);
|
||||
|
||||
for(int i = 0; i < iface.nodes().size() - 1; i++) {
|
||||
final Pair<Vec3, Double> node = iface.nodes().get(i), past = iface.nodes().get(i + 1);
|
||||
final Vec3 nodeLoc = node.getKey(), pastLoc = past.getKey();
|
||||
float nodeAlpha = node.getValue().floatValue();
|
||||
float pastAlpha = past.getValue().floatValue();
|
||||
|
||||
double timeAlpha = Math.max(2D - bullet.ticksExisted * 0.2, 0D);
|
||||
nodeAlpha *= timeAlpha;
|
||||
pastAlpha *= timeAlpha;
|
||||
float outerAlpha = 0.25F;
|
||||
|
||||
if(nodeAlpha == 0 && pastAlpha == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
tessellator.setNormal(0F, 1F, 0F);
|
||||
tessellator.setColorRGBA_F(r, g, b, nodeAlpha);
|
||||
tessellator.addVertex(nodeLoc.xCoord, nodeLoc.yCoord, nodeLoc.zCoord);
|
||||
tessellator.setColorRGBA_F(r, g, b, nodeAlpha * outerAlpha);
|
||||
tessellator.addVertex(nodeLoc.xCoord, nodeLoc.yCoord + scale, nodeLoc.zCoord);
|
||||
tessellator.setColorRGBA_F(r, g, b, pastAlpha * outerAlpha);
|
||||
tessellator.addVertex(pastLoc.xCoord, pastLoc.yCoord + scale, pastLoc.zCoord);
|
||||
tessellator.setColorRGBA_F(r, g, b, pastAlpha);
|
||||
tessellator.addVertex(pastLoc.xCoord, pastLoc.yCoord, pastLoc.zCoord);
|
||||
|
||||
tessellator.setColorRGBA_F(r, g, b, nodeAlpha);
|
||||
tessellator.addVertex(nodeLoc.xCoord, nodeLoc.yCoord, nodeLoc.zCoord);
|
||||
tessellator.setColorRGBA_F(r, g, b, nodeAlpha * outerAlpha);
|
||||
tessellator.addVertex(nodeLoc.xCoord, nodeLoc.yCoord - scale, nodeLoc.zCoord);
|
||||
tessellator.setColorRGBA_F(r, g, b, pastAlpha * outerAlpha);
|
||||
tessellator.addVertex(pastLoc.xCoord, pastLoc.yCoord - scale, pastLoc.zCoord);
|
||||
tessellator.setColorRGBA_F(r, g, b, pastAlpha);
|
||||
tessellator.addVertex(pastLoc.xCoord, pastLoc.yCoord, pastLoc.zCoord);
|
||||
}
|
||||
|
||||
GL11.glColor3f(1F, 1F, 1F);
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0F);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
tessellator.draw();
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glAlphaFunc(GL11.GL_GEQUAL, 0.1F);
|
||||
|
||||
iface.prevX(pX);
|
||||
iface.prevY(pY);
|
||||
iface.prevZ(pZ);
|
||||
}
|
||||
|
||||
private void renderLeadburster(Entity bullet, float interp) {
|
||||
EntityBulletBaseNT bulletnt = (EntityBulletBaseNT) bullet;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glRotated(90, 0, 0, -1);
|
||||
double scale = 0.05;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
bindTexture(ResourceManager.leadburster_tex);
|
||||
ResourceManager.leadburster.renderPart("Based");
|
||||
if(bulletnt.getStuckIn() != -1) {
|
||||
GL11.glRotated((bullet.ticksExisted + interp) * -18, 0, 1, 0);
|
||||
}
|
||||
ResourceManager.leadburster.renderPart("Based.001");
|
||||
ResourceManager.leadburster.renderPart("Backlight");
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(Entity p_110775_1_) {
|
||||
return new ResourceLocation(RefStrings.MODID + ":textures/models/bullet.png");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -74,8 +74,8 @@ public class RenderRBMKGauge extends TileEntitySpecialRenderer {
|
||||
int height = font.FONT_HEIGHT;
|
||||
|
||||
double lineScale = 0.0025D;
|
||||
String lineLower = unit.min <= 10_000 ? unit.min + "" : BobMathUtil.getShortNumber(unit.min);
|
||||
String lineUpper = unit.max <= 10_000 ? unit.max + "" : BobMathUtil.getShortNumber(unit.max);
|
||||
String lineLower = Math.abs(unit.min) <= 10_000 ? unit.min + "" : BobMathUtil.getShortNumber(unit.min);
|
||||
String lineUpper = Math.abs(unit.max) <= 10_000 ? unit.max + "" : BobMathUtil.getShortNumber(unit.max);
|
||||
|
||||
for(int j = 0; j < 2; j++) {
|
||||
GL11.glPushMatrix();
|
||||
|
||||
@ -2,7 +2,6 @@ package com.hbm.render.tileentity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.main.ResourceManager;
|
||||
|
||||
@ -13,48 +12,43 @@ public class RenderRTG extends TileEntitySpecialRenderer {
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float inter) {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5D, y, z + 0.5D);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5D, y, z + 0.5D);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glRotatef(180, 0F, 1F, 0F);
|
||||
|
||||
if(te.getBlockType() == ModBlocks.machine_rtg_grey)
|
||||
bindTexture(ResourceManager.rtg_tex);
|
||||
else if(te.getBlockType() == ModBlocks.machine_powerrtg)
|
||||
bindTexture(ResourceManager.rtg_polonium_tex);
|
||||
else
|
||||
bindTexture(ResourceManager.rtg_cell_tex);
|
||||
|
||||
ResourceManager.rtg.renderPart("Gen");
|
||||
|
||||
int ix = te.xCoord;
|
||||
int iy = te.yCoord;
|
||||
int iz = te.zCoord;
|
||||
|
||||
if(Library.canConnect(te.getWorldObj(), ix + 1, iy, iz, Library.POS_X))
|
||||
ResourceManager.rtg.renderPart("Connector");
|
||||
|
||||
if(Library.canConnect(te.getWorldObj(), ix - 1, iy, iz, Library.NEG_X)) {
|
||||
GL11.glRotatef(180, 0F, 1F, 0F);
|
||||
ResourceManager.rtg.renderPart("Connector");
|
||||
GL11.glRotatef(-180, 0F, 1F, 0F);
|
||||
}
|
||||
|
||||
if(Library.canConnect(te.getWorldObj(), ix, iy, iz - 1, Library.NEG_Z)) {
|
||||
GL11.glRotatef(90, 0F, 1F, 0F);
|
||||
ResourceManager.rtg.renderPart("Connector");
|
||||
GL11.glRotatef(-90, 0F, 1F, 0F);
|
||||
}
|
||||
|
||||
if(Library.canConnect(te.getWorldObj(), ix, iy, iz + 1, Library.POS_Z)) {
|
||||
GL11.glRotatef(-90, 0F, 1F, 0F);
|
||||
ResourceManager.rtg.renderPart("Connector");
|
||||
GL11.glRotatef(90, 0F, 1F, 0F);
|
||||
}
|
||||
bindTexture(ResourceManager.rtg_tex);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
ResourceManager.rtg.renderPart("Gen");
|
||||
|
||||
int ix = te.xCoord;
|
||||
int iy = te.yCoord;
|
||||
int iz = te.zCoord;
|
||||
|
||||
if(Library.canConnect(te.getWorldObj(), ix + 1, iy, iz, Library.POS_X))
|
||||
ResourceManager.rtg.renderPart("Connector");
|
||||
|
||||
if(Library.canConnect(te.getWorldObj(), ix - 1, iy, iz, Library.NEG_X)) {
|
||||
GL11.glRotatef(180, 0F, 1F, 0F);
|
||||
ResourceManager.rtg.renderPart("Connector");
|
||||
GL11.glRotatef(-180, 0F, 1F, 0F);
|
||||
}
|
||||
|
||||
if(Library.canConnect(te.getWorldObj(), ix, iy, iz - 1, Library.NEG_Z)) {
|
||||
GL11.glRotatef(90, 0F, 1F, 0F);
|
||||
ResourceManager.rtg.renderPart("Connector");
|
||||
GL11.glRotatef(-90, 0F, 1F, 0F);
|
||||
}
|
||||
|
||||
if(Library.canConnect(te.getWorldObj(), ix, iy, iz + 1, Library.POS_Z)) {
|
||||
GL11.glRotatef(-90, 0F, 1F, 0F);
|
||||
ResourceManager.rtg.renderPart("Connector");
|
||||
GL11.glRotatef(90, 0F, 1F, 0F);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -47,6 +47,7 @@ public class TileEntityDoorGeneric extends TileEntityLockableBase {
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if(this.getBlockMetadata() < 12) return;
|
||||
|
||||
if(getDoorType().onDoorUpdate() != null) {
|
||||
getDoorType().onDoorUpdate().accept(this);
|
||||
|
||||
@ -59,6 +59,7 @@ import com.hbm.tileentity.machine.storage.*;
|
||||
import com.hbm.tileentity.network.*;
|
||||
import com.hbm.tileentity.network.pneumatic.TileEntityPneumoStorageAccess;
|
||||
import com.hbm.tileentity.network.pneumatic.TileEntityPneumoStorageClutter;
|
||||
import com.hbm.tileentity.network.pneumatic.TileEntityPneumoStorageMono;
|
||||
import com.hbm.tileentity.network.pneumatic.TileEntityPneumoTube;
|
||||
import com.hbm.tileentity.turret.*;
|
||||
import com.hbm.util.Compat;
|
||||
@ -179,7 +180,6 @@ public class TileMappings {
|
||||
put(TileEntityMachineMiningLaser.class, "tileentity_mining_laser");
|
||||
put(TileEntityNukeBalefire.class, "tileentity_nuke_fstbmb");
|
||||
put(TileEntityMicrowave.class, "tileentity_microwave");
|
||||
put(TileEntityMachineMiniRTG.class, "tileentity_mini_rtg");
|
||||
put(TileEntityBlockICF.class, "tileentity_block_icf");
|
||||
put(TileEntityICFPress.class, "tileentity_icf_press");
|
||||
put(TileEntityICFController.class, "tileentity_icf_controller");
|
||||
@ -475,6 +475,7 @@ public class TileMappings {
|
||||
put(TileEntityPneumoTubePaintable.class, "tileentity_pneumatic_tube_paintable");
|
||||
put(TileEntityPneumoStorageAccess.class, "tileentity_pneumatic_storage_access");
|
||||
put(TileEntityPneumoStorageClutter.class, "tileentity_pneumatic_storage_clutter");
|
||||
put(TileEntityPneumoStorageMono.class, "tileentity_pneumatic_storage_mono");
|
||||
|
||||
put(TileEntityRadioTorchSender.class, "tileentity_rtty_sender");
|
||||
put(TileEntityRadioTorchReceiver.class, "tileentity_rtty_rec");
|
||||
|
||||
@ -1,60 +0,0 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import com.hbm.util.CompatEnergyControl;
|
||||
|
||||
import api.hbm.energymk2.IEnergyProviderMK2;
|
||||
import api.hbm.tile.IInfoProviderEC;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineMiniRTG extends TileEntityLoadedBase implements IEnergyProviderMK2, IInfoProviderEC {
|
||||
|
||||
public long power;
|
||||
boolean tact = false;
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
power += this.getOutput();
|
||||
|
||||
if(power > getMaxPower())
|
||||
power = getMaxPower();
|
||||
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
this.tryProvide(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public long getOutput() {
|
||||
if(this.getBlockType() == ModBlocks.machine_powerrtg) return 2_500;
|
||||
return 700;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getMaxPower() {
|
||||
if(this.getBlockType() == ModBlocks.machine_powerrtg) return 50_000;
|
||||
return 1_400;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getPower() {
|
||||
return power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPower(long i) {
|
||||
power = i;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void provideExtraInfo(NBTTagCompound data) {
|
||||
data.setBoolean(CompatEnergyControl.B_ACTIVE, true);
|
||||
data.setDouble(CompatEnergyControl.D_OUTPUT_HE, this.getOutput());
|
||||
}
|
||||
}
|
||||
@ -270,7 +270,8 @@ public class TileEntityReactorZirnox extends TileEntityMachineBase implements IC
|
||||
// function of SHS produced per tick
|
||||
// (heat - 10256)/100000 * steamFill (max efficiency at 14b) * 25 * 5 (should get rid of any rounding errors)
|
||||
if(this.heat > 10256) {
|
||||
int cycle = (int)((((float)heat - 10256F) / (float)maxHeat) * Math.min(((float)carbonDioxide.getFill() / 14000F), 1F) * 25F * 5F);
|
||||
float mult = 7.5F; // was 5 originally
|
||||
int cycle = (int)((((float)heat - 10256F) / (float)maxHeat) * Math.min(((float)carbonDioxide.getFill() / 14000F), 1F) * 25F * mult);
|
||||
this.output = cycle;
|
||||
|
||||
water.setFill(water.getFill() - cycle);
|
||||
|
||||
@ -0,0 +1,183 @@
|
||||
package com.hbm.tileentity.network.pneumatic;
|
||||
|
||||
import com.hbm.interfaces.IControlReceiver;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.tileentity.network.pneumatic.TileEntityPneumoTube.PneumaticNode;
|
||||
import com.hbm.uninos.UniNodespace;
|
||||
import com.hbm.uninos.networkproviders.PneumaticNetwork;
|
||||
import com.hbm.uninos.networkproviders.PneumaticNetworkProvider;
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
|
||||
import api.hbm.fluidmk2.IFluidStandardReceiverMK2;
|
||||
import api.hbm.ntl.IPneumaticConnector;
|
||||
import api.hbm.ntl.ISlotMonitorProvider;
|
||||
import api.hbm.ntl.SlotMonitor;
|
||||
import api.hbm.ntl.StackCache;
|
||||
import api.hbm.ntl.StackCache.CacheSlot;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public abstract class TileEntityPneumaticStorageBase extends TileEntityMachineBase implements IPneumaticConnector, IFluidStandardReceiverMK2, ISlotMonitorProvider, IControlReceiver, IGUIProvider {
|
||||
|
||||
public FluidTank compair;
|
||||
public SlotMonitor[] monitors;
|
||||
|
||||
protected PneumaticNode node;
|
||||
protected boolean wasAvailable = false;
|
||||
|
||||
public TileEntityPneumaticStorageBase(int slots) {
|
||||
super(slots);
|
||||
this.compair = new FluidTank(Fluids.AIR, 4_000).withPressure(1);
|
||||
this.monitors = new SlotMonitor[slots];
|
||||
|
||||
for(int i = 0; i < monitors.length; i++) this.monitors[i] = new SlotMonitor(i, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(EntityPlayer player) {
|
||||
return this.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveControl(NBTTagCompound data) {
|
||||
|
||||
if(data.hasKey("pressure")) {
|
||||
int pressure = this.compair.getPressure() + 1;
|
||||
if(pressure > 5) pressure = 1;
|
||||
this.compair.setTankType(Fluids.AIR);
|
||||
this.compair.withPressure(pressure);
|
||||
for(SlotMonitor monitor : this.monitors) monitor.availabilityHasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
boolean isAvailable = this.isAvailable();
|
||||
|
||||
if(isAvailable != wasAvailable) {
|
||||
this.wasAvailable = isAvailable;
|
||||
for(SlotMonitor monitor : monitors) monitor.availabilityHasChanged();
|
||||
}
|
||||
|
||||
if(this.node == null || this.node.expired) {
|
||||
this.node = (PneumaticNode) UniNodespace.getNode(worldObj, xCoord, yCoord, zCoord, PneumaticNetworkProvider.THE_PROVIDER);
|
||||
|
||||
if(this.node == null || this.node.expired) {
|
||||
this.node = (PneumaticNode) new PneumaticNode(new BlockPos(xCoord, yCoord, zCoord)).setStandardConnections(xCoord, yCoord, zCoord);
|
||||
UniNodespace.createNode(worldObj, this.node);
|
||||
}
|
||||
}
|
||||
|
||||
if(node != null && !node.expired && node.hasValidNet()) {
|
||||
this.node.net.storages.add(this);
|
||||
}
|
||||
|
||||
if(worldObj.getTotalWorldTime() % 10 == 0) for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
this.trySubscribe(compair.getTankType(), worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir);
|
||||
}
|
||||
|
||||
if(this.compair.getFill() > 0) {
|
||||
int consumption = (int) Math.ceil(this.compair.getFill() * 17 / this.compair.getMaxFill()) + 3;
|
||||
this.compair.setFill(Math.max(this.compair.getFill() - consumption, 0));
|
||||
}
|
||||
|
||||
this.updateMonitors();
|
||||
this.networkPackNT(15);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isAvailable() {
|
||||
return this.isLoaded && !this.isInvalid() && this.compair.getFill() > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
super.invalidate();
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
for(SlotMonitor monitor : this.monitors) {
|
||||
for(CacheSlot cache : monitor.viewedBy) cache.removeMonitor(monitor);
|
||||
}
|
||||
|
||||
if(this.node != null) {
|
||||
|
||||
if(node.hasValidNet()) {
|
||||
this.node.net.storages.remove(this);
|
||||
}
|
||||
|
||||
UniNodespace.destroyNode(worldObj, xCoord, yCoord, zCoord, PneumaticNetworkProvider.THE_PROVIDER);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChunkUnload() {
|
||||
super.onChunkUnload();
|
||||
|
||||
for(SlotMonitor monitor : this.monitors) {
|
||||
for(CacheSlot cache : monitor.viewedBy) cache.removeMonitor(monitor);
|
||||
}
|
||||
|
||||
if(node != null && node.hasValidNet()) {
|
||||
this.node.net.storages.remove(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
compair.serialize(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
compair.deserialize(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
this.compair.readFromNBT(nbt, "tank");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
this.compair.writeToNBT(nbt, "tank");
|
||||
}
|
||||
|
||||
@Override public boolean isItemValidForSlot(int slot, ItemStack stack) { return true; }
|
||||
|
||||
@Override public FluidTank[] getAllTanks() { return new FluidTank[] {compair}; }
|
||||
@Override public FluidTank[] getReceivingTanks() { return new FluidTank[] {compair}; }
|
||||
|
||||
@Override public SlotMonitor[] getMonitors() { return monitors; }
|
||||
@Override public ItemStack getSlotAt(int index) { return this.getStackInSlot(index); }
|
||||
|
||||
@Override
|
||||
public PneumaticNetwork getRelevantNetwork() {
|
||||
if(this.node == null || this.node.expired || !this.node.hasValidNet()) return null;
|
||||
return this.node.net;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAvailableToCache(StackCache cache) {
|
||||
if(!isAvailable()) return false;
|
||||
int range = TileEntityPneumoTube.getRangeFromPressure(this.compair.getPressure());
|
||||
int dX = xCoord - cache.x;
|
||||
int dY = yCoord - cache.y;
|
||||
int dZ = zCoord - cache.z;
|
||||
return dX * dX + dY * dY + dZ * dZ <= range * range;
|
||||
}
|
||||
}
|
||||
@ -14,7 +14,6 @@ import api.hbm.ntl.StackCache;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityPneumoStorageAccess extends TileEntityLoadedBase implements IPneumaticConnector, IGUIProvider {
|
||||
|
||||
@ -69,12 +68,6 @@ public class TileEntityPneumoStorageAccess extends TileEntityLoadedBase implemen
|
||||
if(this.cache != null) this.cache.dissolveCache();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectPneumatic(ForgeDirection dir) {
|
||||
ForgeDirection selfdir = ForgeDirection.getOrientation(getBlockMetadata());
|
||||
return dir == selfdir.getOpposite();
|
||||
}
|
||||
|
||||
@Override public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { return new ContainerPneumoStorageAccess(player.inventory, this); }
|
||||
@Override public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { return new GUIPneumoStorageAccess(player.inventory, this); }
|
||||
}
|
||||
|
||||
@ -1,42 +1,22 @@
|
||||
package com.hbm.tileentity.network.pneumatic;
|
||||
|
||||
import com.hbm.interfaces.IControlReceiver;
|
||||
import com.hbm.inventory.container.ContainerPneumoStorageClutter;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.inventory.gui.GUIPneumoStorageClutter;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.tileentity.network.pneumatic.TileEntityPneumoTube.PneumaticNode;
|
||||
import com.hbm.uninos.UniNodespace;
|
||||
import com.hbm.uninos.networkproviders.PneumaticNetwork;
|
||||
import com.hbm.uninos.networkproviders.PneumaticNetworkProvider;
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
|
||||
import api.hbm.fluidmk2.IFluidStandardReceiverMK2;
|
||||
import api.hbm.ntl.IPneumaticConnector;
|
||||
import api.hbm.ntl.ISlotMonitorProvider;
|
||||
import api.hbm.ntl.SlotMonitor;
|
||||
import api.hbm.ntl.StackCache;
|
||||
import api.hbm.ntl.StackCache.CacheSlot;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TileEntityPneumoStorageClutter extends TileEntityMachineBase implements IPneumaticConnector, IFluidStandardReceiverMK2, ISlotMonitorProvider, IGUIProvider {
|
||||
|
||||
public FluidTank compair;
|
||||
public SlotMonitor[] monitors;
|
||||
|
||||
protected PneumaticNode node;
|
||||
protected boolean wasAvailable = false;
|
||||
public class TileEntityPneumoStorageClutter extends TileEntityPneumaticStorageBase implements IPneumaticConnector, IFluidStandardReceiverMK2, ISlotMonitorProvider, IControlReceiver, IGUIProvider {
|
||||
|
||||
public TileEntityPneumoStorageClutter() {
|
||||
super(6 * 9);
|
||||
this.compair = new FluidTank(Fluids.AIR, 4_000).withPressure(1);
|
||||
this.monitors = new SlotMonitor[6 * 9];
|
||||
|
||||
for(int i = 0; i < monitors.length; i++) this.monitors[i] = new SlotMonitor(i, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -44,79 +24,6 @@ public class TileEntityPneumoStorageClutter extends TileEntityMachineBase implem
|
||||
return "container.pneumoStorageClutter";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
boolean isAvailable = this.isAvailable();
|
||||
|
||||
if(isAvailable != wasAvailable) {
|
||||
this.wasAvailable = isAvailable;
|
||||
for(SlotMonitor monitor : monitors) monitor.availabilityHasChanged();
|
||||
}
|
||||
|
||||
if(this.node == null || this.node.expired) {
|
||||
this.node = (PneumaticNode) UniNodespace.getNode(worldObj, xCoord, yCoord, zCoord, PneumaticNetworkProvider.THE_PROVIDER);
|
||||
|
||||
if(this.node == null || this.node.expired) {
|
||||
this.node = (PneumaticNode) new PneumaticNode(new BlockPos(xCoord, yCoord, zCoord)).setStandardConnections(xCoord, yCoord, zCoord);
|
||||
UniNodespace.createNode(worldObj, this.node);
|
||||
}
|
||||
}
|
||||
|
||||
if(node != null && !node.expired && node.hasValidNet()) {
|
||||
this.node.net.storages.add(this);
|
||||
}
|
||||
|
||||
this.updateMonitors();
|
||||
this.networkPackNT(15);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isAvailable() {
|
||||
return this.isLoaded && !this.isInvalid();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
super.invalidate();
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
for(SlotMonitor monitor : this.monitors) {
|
||||
for(CacheSlot cache : monitor.viewedBy) cache.removeMonitor(monitor);
|
||||
}
|
||||
|
||||
if(this.node != null) {
|
||||
|
||||
if(node.hasValidNet()) {
|
||||
this.node.net.storages.remove(this);
|
||||
}
|
||||
|
||||
UniNodespace.destroyNode(worldObj, xCoord, yCoord, zCoord, PneumaticNetworkProvider.THE_PROVIDER);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChunkUnload() {
|
||||
super.onChunkUnload();
|
||||
|
||||
for(SlotMonitor monitor : this.monitors) {
|
||||
for(CacheSlot cache : monitor.viewedBy) cache.removeMonitor(monitor);
|
||||
}
|
||||
|
||||
if(node != null && node.hasValidNet()) {
|
||||
this.node.net.storages.remove(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override public boolean isItemValidForSlot(int slot, ItemStack stack) { return true; }
|
||||
|
||||
@Override public FluidTank[] getAllTanks() { return new FluidTank[] {compair}; }
|
||||
@Override public FluidTank[] getReceivingTanks() { return new FluidTank[] {compair}; }
|
||||
|
||||
@Override
|
||||
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new ContainerPneumoStorageClutter(player.inventory, this);
|
||||
@ -126,21 +33,9 @@ public class TileEntityPneumoStorageClutter extends TileEntityMachineBase implem
|
||||
public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new GUIPneumoStorageClutter(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override public SlotMonitor[] getMonitors() { return monitors; }
|
||||
@Override public ItemStack getSlotAt(int index) { return this.getStackInSlot(index); }
|
||||
|
||||
@Override public long getAmountAt(int index) { ItemStack stack = getSlotAt(index); return stack != null ? stack.stackSize : 0; }
|
||||
|
||||
@Override
|
||||
public PneumaticNetwork getRelevantNetwork() {
|
||||
if(this.node == null || this.node.expired || !this.node.hasValidNet()) return null;
|
||||
return this.node.net;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAvailableToCache(StackCache cache) {
|
||||
return this.isLoaded && !this.isInvalid();
|
||||
}
|
||||
@Override public boolean allowTypeSetting() { return true; }
|
||||
|
||||
@Override
|
||||
public long useUpItem(int index, long amount) {
|
||||
|
||||
@ -0,0 +1,112 @@
|
||||
package com.hbm.tileentity.network.pneumatic;
|
||||
|
||||
import com.hbm.inventory.container.ContainerPneumoStorageImporter;
|
||||
import com.hbm.inventory.gui.GUIPneumoStorageImporter;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.tileentity.network.pneumatic.TileEntityPneumoTube.PneumaticNode;
|
||||
import com.hbm.uninos.UniNodespace;
|
||||
import com.hbm.uninos.networkproviders.PneumaticNetworkProvider;
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
|
||||
import api.hbm.ntl.IPneumaticConnector;
|
||||
import api.hbm.ntl.StackCache;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TileEntityPneumoStorageImporter extends TileEntityMachineBase implements IPneumaticConnector, IGUIProvider {
|
||||
|
||||
protected PneumaticNode node;
|
||||
public StackCache cache;
|
||||
|
||||
public int[] delay = new int[9];
|
||||
public int[] SLOT_ACCESS = new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8};
|
||||
|
||||
public TileEntityPneumoStorageImporter() {
|
||||
super(9);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "container.pneumoStorageImporter";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack stack) {
|
||||
super.setInventorySlotContents(i, stack);
|
||||
|
||||
if(stack != null) this.delay[i] = Math.max(this.delay[i], 1);
|
||||
}
|
||||
|
||||
@Override public boolean isItemValidForSlot(int slot, ItemStack stack) { return true; }
|
||||
@Override public int[] getAccessibleSlotsFromSide(int side) { return SLOT_ACCESS; }
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
if(this.node == null || this.node.expired) {
|
||||
if(this.cache != null) this.cache.dissolveCache();
|
||||
|
||||
this.node = (PneumaticNode) UniNodespace.getNode(worldObj, xCoord, yCoord, zCoord, PneumaticNetworkProvider.THE_PROVIDER);
|
||||
|
||||
if(this.node == null || this.node.expired) {
|
||||
this.node = (PneumaticNode) new PneumaticNode(new BlockPos(xCoord, yCoord, zCoord)).setStandardConnections(xCoord, yCoord, zCoord);
|
||||
UniNodespace.createNode(worldObj, this.node);
|
||||
}
|
||||
}
|
||||
|
||||
if(this.cache == null || this.cache.hasExpired) {
|
||||
this.cache = new StackCache(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
if(this.node != null && this.node.hasValidNet()) {
|
||||
this.node.net.addStackCache(cache);
|
||||
}
|
||||
|
||||
if(this.cache != null && !this.cache.hasExpired) for(int i = 0; i < 9; i++) {
|
||||
if(this.delay[i] > 0) {
|
||||
this.delay[i]--;
|
||||
continue;
|
||||
}
|
||||
ItemStack stack = slots[i];
|
||||
if(stack == null) continue;
|
||||
|
||||
int leftover = (int) this.cache.addItemsAndReturnQuantity(stack, stack.stackSize);
|
||||
if(leftover == stack.stackSize) {
|
||||
this.delay[i] = 100;
|
||||
} else {
|
||||
this.decrStackSize(i, stack.stackSize - leftover);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
super.invalidate();
|
||||
|
||||
if(!worldObj.isRemote && this.node != null) {
|
||||
UniNodespace.destroyNode(worldObj, xCoord, yCoord, zCoord, PneumaticNetworkProvider.THE_PROVIDER);
|
||||
}
|
||||
|
||||
if(this.cache != null) this.cache.dissolveCache();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChunkUnload() {
|
||||
super.onChunkUnload();
|
||||
|
||||
if(!worldObj.isRemote && this.node != null) {
|
||||
UniNodespace.destroyNode(worldObj, xCoord, yCoord, zCoord, PneumaticNetworkProvider.THE_PROVIDER);
|
||||
}
|
||||
|
||||
if(this.cache != null) this.cache.dissolveCache();
|
||||
}
|
||||
|
||||
@Override public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { return new ContainerPneumoStorageImporter(player.inventory, this); }
|
||||
@Override public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { return new GUIPneumoStorageImporter(player.inventory, this); }
|
||||
}
|
||||
@ -0,0 +1,89 @@
|
||||
package com.hbm.tileentity.network.pneumatic;
|
||||
|
||||
import com.hbm.interfaces.IControlReceiver;
|
||||
import com.hbm.inventory.container.ContainerPneumoStorageMono;
|
||||
import com.hbm.inventory.gui.GUIPneumoStorageMono;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
|
||||
import api.hbm.fluidmk2.IFluidStandardReceiverMK2;
|
||||
import api.hbm.ntl.IPneumaticConnector;
|
||||
import api.hbm.ntl.ISlotMonitorProvider;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TileEntityPneumoStorageMono extends TileEntityPneumaticStorageBase implements IPneumaticConnector, IFluidStandardReceiverMK2, ISlotMonitorProvider, IControlReceiver, IGUIProvider {
|
||||
|
||||
public static final int CAPACITY = 100_000;
|
||||
public int[] amounts;
|
||||
|
||||
public TileEntityPneumoStorageMono() {
|
||||
super(3);
|
||||
|
||||
this.amounts = new int[this.monitors.length];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "container.pneumoStorageMono";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
for(int i = 0; i < amounts.length; i++) buf.writeInt(amounts[i]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
for(int i = 0; i < amounts.length; i++) amounts[i]= buf.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
this.amounts = nbt.getIntArray("amounts");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setIntArray("amounts", amounts);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new ContainerPneumoStorageMono(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new GUIPneumoStorageMono(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override public long getAmountAt(int index) { return amounts[index]; }
|
||||
@Override public boolean allowTypeSetting() { return false; }
|
||||
|
||||
@Override
|
||||
public long useUpItem(int index, long amount) {
|
||||
if(amounts[index] <= 0) return amount;
|
||||
int toRemove = (int) Math.min(amount, amounts[index]);
|
||||
amounts[index] -= toRemove;
|
||||
return amount - toRemove;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long addItem(int index, long amount) {
|
||||
int capacity = CAPACITY - amounts[index];
|
||||
if(capacity <= 0) return amount;
|
||||
int toAdd = (int) Math.min(amount, capacity);
|
||||
amounts[index] += toAdd;
|
||||
return amount - toAdd;
|
||||
}
|
||||
|
||||
@Override public long setupType(int index, ItemStack zeroStack, long amount) { return amount; }
|
||||
}
|
||||
@ -134,7 +134,7 @@ public class PneumaticNetwork extends NodeNet {
|
||||
TileEntity tile1 = source instanceof TileEntity ? (TileEntity) source : null;
|
||||
|
||||
int attempts = 0;
|
||||
int maxAttempts = receiverList.size();
|
||||
int maxAttempts = Math.min(receiverList.size(), 5);
|
||||
|
||||
// try all receivers for both modes, in an attempts based system.
|
||||
// instead of bailing out of trying after the first failure (which means you have to wait 0.25 seconds), we just try the next one.
|
||||
|
||||
@ -193,32 +193,34 @@ public class BobMathUtil {
|
||||
}
|
||||
|
||||
public static String getShortNumber(long l) {
|
||||
|
||||
double res;
|
||||
String magnitude_letter = "";
|
||||
String suffix = "";
|
||||
long abs = Math.abs(l);
|
||||
|
||||
if(Math.abs(l) >= Math.pow(10, 18)) {
|
||||
if(abs >= Math.pow(10, 18)) {
|
||||
res = l / Math.pow(10, 18);
|
||||
magnitude_letter = "E";
|
||||
suffix = "E";
|
||||
}
|
||||
else if(Math.abs(l) >= Math.pow(10, 15)) {
|
||||
else if(abs >= Math.pow(10, 15)) {
|
||||
res = l / Math.pow(10, 15);
|
||||
magnitude_letter = "P";
|
||||
suffix = "P";
|
||||
}
|
||||
else if(Math.abs(l) >= Math.pow(10, 12)) {
|
||||
else if(abs >= Math.pow(10, 12)) {
|
||||
res = l / Math.pow(10, 12);
|
||||
magnitude_letter = "T";
|
||||
suffix = "T";
|
||||
}
|
||||
else if(Math.abs(l) >= Math.pow(10, 9)) {
|
||||
else if(abs >= Math.pow(10, 9)) {
|
||||
res = l / Math.pow(10, 9);
|
||||
magnitude_letter = "G";
|
||||
suffix = "G";
|
||||
}
|
||||
else if(Math.abs(l) >= Math.pow(10, 6)) {
|
||||
else if(abs >= Math.pow(10, 6)) {
|
||||
res = l / Math.pow(10, 6);
|
||||
magnitude_letter = "M";
|
||||
suffix = "M";
|
||||
}
|
||||
else if(Math.abs(l) >= Math.pow(10, 3)) {
|
||||
else if(abs >= Math.pow(10, 3)) {
|
||||
res = l / Math.pow(10, 3);
|
||||
magnitude_letter = "k";
|
||||
suffix = "k";
|
||||
}
|
||||
else {
|
||||
return Long.toString(l);
|
||||
@ -231,7 +233,7 @@ public class BobMathUtil {
|
||||
res = Math.round(res * 100.0) / 100.0;
|
||||
}
|
||||
|
||||
return res + magnitude_letter;
|
||||
return res + suffix;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -3,14 +3,12 @@ package com.hbm.world.feature;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.BlockEnums.EnumStoneType;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.blocks.generic.BlockBedrockOreTE.TileEntityBedrockOre;
|
||||
import com.hbm.config.WorldConfig;
|
||||
import com.hbm.inventory.FluidStack;
|
||||
import com.hbm.inventory.OreDictManager.DictFrame;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.items.ItemEnums.EnumChunkType;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.special.ItemBedrockOreBase;
|
||||
import com.hbm.items.special.ItemBedrockOre.EnumBedrockOre;
|
||||
@ -25,30 +23,9 @@ import net.minecraft.world.World;
|
||||
|
||||
public class BedrockOre {
|
||||
|
||||
public static List<WeightedRandomGeneric<BedrockOreDefinition>> weightedOres = new ArrayList();
|
||||
public static List<WeightedRandomGeneric<BedrockOreDefinition>> weightedOresNether = new ArrayList();
|
||||
|
||||
public static void init() {
|
||||
registerBedrockOre(weightedOres, new BedrockOreDefinition(EnumBedrockOre.IRON, 1), WorldConfig.bedrockIronSpawn);
|
||||
registerBedrockOre(weightedOres, new BedrockOreDefinition(EnumBedrockOre.COPPER, 1), WorldConfig.bedrockCopperSpawn);
|
||||
registerBedrockOre(weightedOres, new BedrockOreDefinition(EnumBedrockOre.BORAX, 3, new FluidStack(Fluids.SULFURIC_ACID, 500)), WorldConfig.bedrockBoraxSpawn);
|
||||
registerBedrockOre(weightedOres, new BedrockOreDefinition(EnumBedrockOre.CHLOROCALCITE, 3, new FluidStack(Fluids.SULFURIC_ACID, 500)), WorldConfig.bedrockChlorocalciteSpawn);
|
||||
registerBedrockOre(weightedOres, new BedrockOreDefinition(EnumBedrockOre.ASBESTOS, 2), WorldConfig.bedrockAsbestosSpawn);
|
||||
registerBedrockOre(weightedOres, new BedrockOreDefinition(EnumBedrockOre.NIOBIUM, 2, new FluidStack(Fluids.PEROXIDE, 500)), WorldConfig.bedrockNiobiumSpawn);
|
||||
registerBedrockOre(weightedOres, new BedrockOreDefinition(EnumBedrockOre.NEODYMIUM, 3, new FluidStack(Fluids.PEROXIDE, 500)), WorldConfig.bedrockNeodymiumSpawn);
|
||||
registerBedrockOre(weightedOres, new BedrockOreDefinition(EnumBedrockOre.TITANIUM, 2, new FluidStack(Fluids.SULFURIC_ACID, 500)), WorldConfig.bedrockTitaniumSpawn);
|
||||
registerBedrockOre(weightedOres, new BedrockOreDefinition(EnumBedrockOre.TUNGSTEN, 2, new FluidStack(Fluids.PEROXIDE, 500)), WorldConfig.bedrockTungstenSpawn);
|
||||
registerBedrockOre(weightedOres, new BedrockOreDefinition(EnumBedrockOre.GOLD, 1), WorldConfig.bedrockGoldSpawn);
|
||||
registerBedrockOre(weightedOres, new BedrockOreDefinition(EnumBedrockOre.URANIUM, 4, new FluidStack(Fluids.SULFURIC_ACID, 500)), WorldConfig.bedrockUraniumSpawn);
|
||||
registerBedrockOre(weightedOres, new BedrockOreDefinition(EnumBedrockOre.THORIUM, 4, new FluidStack(Fluids.SULFURIC_ACID, 500)), WorldConfig.bedrockThoriumSpawn);
|
||||
registerBedrockOre(weightedOres, new BedrockOreDefinition(EnumBedrockOre.FLUORITE, 1), WorldConfig.bedrockFluoriteSpawn);
|
||||
registerBedrockOre(weightedOres, new BedrockOreDefinition(new ItemStack(Items.coal, 8), 1, 0x202020), WorldConfig.bedrockCoalSpawn);
|
||||
registerBedrockOre(weightedOres, new BedrockOreDefinition(new ItemStack(ModItems.niter, 4), 2, 0x808080, new FluidStack(Fluids.PEROXIDE, 500)), WorldConfig.bedrockNiterSpawn);
|
||||
registerBedrockOre(weightedOres, new BedrockOreDefinition(new ItemStack(Items.redstone, 4), 1, 0xd01010), WorldConfig.bedrockRedstoneSpawn);
|
||||
registerBedrockOre(weightedOres, new BedrockOreDefinition(new ItemStack(Items.emerald, 4), 1, 0x3FDD85), WorldConfig.bedrockEmeraldSpawn);
|
||||
registerBedrockOre(weightedOres, new BedrockOreDefinition(DictFrame.fromOne(ModItems.chunk_ore, EnumChunkType.RARE), 2, 0x8F9999, new FluidStack(Fluids.PEROXIDE, 500)), WorldConfig.bedrockRareEarthSpawn);
|
||||
registerBedrockOre(weightedOres, new BedrockOreDefinition(DictFrame.fromOne(ModBlocks.stone_resource, EnumStoneType.BAUXITE, 2),1, 0xEF7213), WorldConfig.bedrockBauxiteSpawn);
|
||||
|
||||
registerBedrockOre(weightedOresNether, new BedrockOreDefinition(new ItemStack(Items.glowstone_dust, 4), 1, 0xF9FF4D), WorldConfig.bedrockGlowstoneSpawn);
|
||||
registerBedrockOre(weightedOresNether, new BedrockOreDefinition(new ItemStack(ModItems.powder_fire, 4), 1, 0xD7341F), WorldConfig.bedrockPhosphorusSpawn);
|
||||
registerBedrockOre(weightedOresNether, new BedrockOreDefinition(new ItemStack(Items.quartz, 4), 1, 0xF0EFDD), WorldConfig.bedrockQuartzSpawn);
|
||||
|
||||
@ -357,6 +357,10 @@ container.paDipole=Dipol
|
||||
container.paQuadrupole=Quad.
|
||||
container.paSource=Teilchenquelle
|
||||
container.plasmaHeater=Plasmaerhitzer
|
||||
container.pneumoStorageAccess=PLS Zugangsterminal
|
||||
container.pneumoStorageClutter=PLS Gerümpelkiste
|
||||
container.pneumoStorageImporter=PSN Importer
|
||||
container.pneumoStorageMono=PLS Massenspeicher
|
||||
container.pneumoTube=Rohrpost
|
||||
container.press=Befeuerte Presse
|
||||
container.puf6_tank=PuF6 Tank
|
||||
@ -4571,7 +4575,7 @@ tile.machine_transformer.name=10k-20Hz-Transformator
|
||||
tile.machine_transformer_20.name=10k-1Hz-Transformator
|
||||
tile.machine_transformer_dnt.name=DNT-20Hz-Transformator
|
||||
tile.machine_transformer_dnt_20.name=DNT-1Hz-Transformator
|
||||
tile.machine_turbine.name=Dampfturbine
|
||||
tile.machine_turbine.name=Dampfturbine (LEGACY)
|
||||
tile.machine_turbine.desc=Effizienz: 85%%
|
||||
tile.machine_turbinegas.name=Kombizyklus-Gasturbine
|
||||
tile.machine_turbofan.name=Turbofan
|
||||
@ -4736,6 +4740,10 @@ tile.plant_tall.weed.name=Hanf
|
||||
tile.plasma.name=Plasma
|
||||
tile.plasma_heater.name=Plasmaerhitzer
|
||||
tile.plushie.name=%s Plüschfigur
|
||||
tile.pneumatic_storage_access.name=Pneumatisches Lagersystem - Zugangsterminal
|
||||
tile.pneumatic_storage_clutter.name=Pneumatisches Lagersystem - Gerümpelkiste
|
||||
tile.pneumatic_storage_importer.name=Pneumatisches Lagersystem - Importer
|
||||
tile.pneumatic_storage_mono.name=Pneumatisches Lagersystem - Massenspeicher
|
||||
tile.pneumatic_tube.name=Rohrpost
|
||||
tile.pneumatic_tube.desc=Sendted Items mit Druckluft.$Rechtsklick mit Schraubenzieher aktiviert den Eingang.$Shift-Rechtskick mit Schrabuenzieher aktiviert den Ausgang.$Eingänge können konfiguriert und mit Druckluft verbunden werden.$Sendet bis zu einem Stack, vier Mal pro Sekunde.
|
||||
tile.pneumatic_tube_paintable.name=Geschirmte Rohrpost (Färbbar)
|
||||
|
||||
@ -759,6 +759,10 @@ container.paDipole=Dipole
|
||||
container.paQuadrupole=Quad.
|
||||
container.paSource=Particle Source
|
||||
container.plasmaHeater=Plasma Heater
|
||||
container.pneumoStorageAccess=PSN Access Terminal
|
||||
container.pneumoStorageClutter=PSN Clutter Storage
|
||||
container.pneumoStorageImporter=PSN Importer
|
||||
container.pneumoStorageMono=PSN Bulk Storage
|
||||
container.pneumoTube=Pneumatic Tube
|
||||
container.press=Burner Press
|
||||
container.puf6_tank=PuF6 Tank
|
||||
@ -2016,13 +2020,7 @@ item.battery_sc.pu238.name=Plutonium-238 Self-Charging Battery
|
||||
item.battery_sc.ra226.name=Radium-226 Self-Charging Battery
|
||||
item.battery_sc.tc99.name=Technetium-99 Self-Charging Battery
|
||||
item.battery_sc.waste.name=Spent Fuel Self-Charging Battery
|
||||
item.battery_sc_americium.name=Self-Charging Americium-241 Battery (LEGACY)
|
||||
item.battery_sc_gold.name=Self-Charging Gold-198 Battery (LEGACY)
|
||||
item.battery_sc_lead.name=Self-Charging Lead-209 Battery (LEGACY)
|
||||
item.battery_sc_plutonium.name=Self-Charging Plutonium-238 Battery (LEGACY)
|
||||
item.battery_sc_polonium.name=Self-Charging Polonium-210 Battery (LEGACY)
|
||||
item.battery_sc_technetium.name=Self-Charging Technetium-99 Battery (LEGACY)
|
||||
item.battery_sc_uranium.name=Self-Charging Uranium-238 Battery (LEGACY)
|
||||
item.battery_sc.desc=Radiovoltaic devices are not suitable for$battery sockets! Power output may$be unreliable, and hazardous arcing$may occur!
|
||||
item.battery_schrabidium.name=Schrabidium Battery (LEGACY)
|
||||
item.battery_schrabidium_cell.name=Schrabidium Power Cell (LEGACY)
|
||||
item.battery_schrabidium_cell_2.name=Double Schrabidium Power Cell (LEGACY)
|
||||
@ -5828,7 +5826,7 @@ tile.machine_transformer.name=10k-20Hz Transformer
|
||||
tile.machine_transformer_20.name=10k-1Hz Transformer
|
||||
tile.machine_transformer_dnt.name=DNT-20Hz Transformer
|
||||
tile.machine_transformer_dnt_20.name=DNT-1Hz Transformer
|
||||
tile.machine_turbine.name=Steam Turbine
|
||||
tile.machine_turbine.name=Steam Turbine (LEGACY)
|
||||
tile.machine_turbine.desc=Efficiency: 85%%
|
||||
tile.machine_turbinegas.name=Combined Cycle Gas Turbine
|
||||
tile.machine_turbofan.name=Turbofan
|
||||
@ -6003,6 +6001,10 @@ tile.plant_tall.weed.name=Hemp
|
||||
tile.plasma.name=Plasma
|
||||
tile.plasma_heater.name=Plasma Heater
|
||||
tile.plushie.name=%s Plushie
|
||||
tile.pneumatic_storage_access.name=Pneumatic Storage Network - Access Terminal
|
||||
tile.pneumatic_storage_clutter.name=Pneumatic Storage Network - Clutter Storage
|
||||
tile.pneumatic_storage_importer.name=Pneumatic Storage Network - Importer
|
||||
tile.pneumatic_storage_mono.name=Pneumatic Storage Network - Bulk Storage
|
||||
tile.pneumatic_tube.name=Pneumatic Tube
|
||||
tile.pneumatic_tube.desc=Sends items using compressed air.$Right-click with screwdriver to toggle an input.$Shift right-click with screwdriver to toggle an output.$Inputs can be configured, and connected to compressed air.$Sends up to one stack, four times per second.
|
||||
tile.pneumatic_tube_paintable.name=Paintable Pneumatic Tube
|
||||
|
||||
3229
src/main/resources/assets/hbm/models/machines/supercomputer.obj
Normal file
|
After Width: | Height: | Size: 417 B |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 279 B After Width: | Height: | Size: 350 B |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 113 B |
|
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 39 KiB |