mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-08-10 17:55:44 +00:00
Compare commits
No commits in common. "7fdd48f29f7161b37d57819d2cb7f9b989e174a4" and "3037c8663b7c4ed05de9268e93527622c23fa001" have entirely different histories.
7fdd48f29f
...
3037c8663b
3
.gitignore
vendored
3
.gitignore
vendored
@ -27,8 +27,5 @@
|
||||
# CurseForge configuration
|
||||
/curseforge.properties
|
||||
|
||||
# Maven configuration
|
||||
/maven.properties
|
||||
|
||||
# Changelog backup
|
||||
/changelog.bak
|
||||
|
||||
20
README.md
20
README.md
@ -24,26 +24,6 @@ For further ports, try:
|
||||
|
||||
Simply navigate to "Releases" on the right side of the page, download links for the compiled JAR as well as the corresponding source code are under the "Assets" category below the changelog. Make sure to review all changelogs when updating!
|
||||
|
||||
## Using in your project
|
||||
|
||||
To include the mod as a dependency in a project of your own, you can adjust your Gradle buildscript according to the following example:
|
||||
|
||||
```groovy
|
||||
repositories {
|
||||
maven {
|
||||
name "NTM Releases"
|
||||
url "https://maven.ntmr.dev/releases"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
def ntmBuildNumber = "5687" // Change this value according to the release you wish to use
|
||||
|
||||
implementation "com.hbm:HBM-NTM:1.0.27_X${ntmBuildNumber}:dev"
|
||||
compileOnly "com.hbm:HBM-NTM:1.0.27_X${ntmBuildNumber}:src"
|
||||
}
|
||||
```
|
||||
|
||||
## Building from source
|
||||
|
||||
Tired of waiting until the next version comes out? Here is a tutorial on how to compile the very newest version yourself:
|
||||
|
||||
96
build.gradle
96
build.gradle
@ -18,7 +18,6 @@ buildscript {
|
||||
|
||||
apply plugin: 'forge'
|
||||
apply plugin: 'curseforge'
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
|
||||
if(Files.exists(Paths.get("curseforge.properties"))) {
|
||||
@ -26,10 +25,6 @@ if(Files.exists(Paths.get("curseforge.properties"))) {
|
||||
ext.cfprops = parseConfig(file("curseforge.properties"))
|
||||
}
|
||||
|
||||
if(Files.exists(Paths.get("maven.properties"))) {
|
||||
ext.mavenprops = parseConfig(file("maven.properties"))
|
||||
}
|
||||
|
||||
def version_name = version = mod_version
|
||||
if(!mod_build_number.isEmpty()) {
|
||||
version_name = mod_version + "_X" + mod_build_number
|
||||
@ -50,7 +45,7 @@ minecraft {
|
||||
eclipse.classpath.file.whenMerged { cp ->
|
||||
// Find all codechicken source jars
|
||||
def srcent = cp.entries.findAll { entry -> entry.path.contains("codechicken") && entry.path.endsWith("-src.jar") }
|
||||
|
||||
|
||||
// Remove them from classpath
|
||||
cp.entries.removeAll srcent
|
||||
|
||||
@ -60,10 +55,10 @@ eclipse.classpath.file.whenMerged { cp ->
|
||||
def file = new File(entry.path)
|
||||
srcmap.put(file.getName().replace("-src.jar", "-dev.jar"), file)
|
||||
}
|
||||
|
||||
|
||||
// Create file reference factory
|
||||
def fileref = new FileReferenceFactory()
|
||||
|
||||
|
||||
// Find all codechicken development jars
|
||||
cp.entries.findAll { entry -> entry.path.contains("codechicken") && entry.path.endsWith("-dev.jar") }.forEach { entry ->
|
||||
File srcmapping = new File(entry.path) // Initialize the srcmapping from the dev jar path
|
||||
@ -104,20 +99,20 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation('codechicken:CodeChickenCore:1.7.10-1.0.4.29:dev') { transitive = false }
|
||||
compileOnly('codechicken:CodeChickenCore:1.7.10-1.0.4.29:src') { transitive = false }
|
||||
implementation 'codechicken:CodeChickenCore:1.7.10-1.0.4.29:dev'
|
||||
compileOnly 'codechicken:CodeChickenCore:1.7.10-1.0.4.29:src'
|
||||
|
||||
implementation 'codechicken:CodeChickenLib:1.7.10-1.1.3.140:dev'
|
||||
compileOnly 'codechicken:CodeChickenLib:1.7.10-1.1.3.140:src'
|
||||
|
||||
implementation 'codechicken:NotEnoughItems:1.7.10-1.0.3.74:dev'
|
||||
compileOnly 'codechicken:NotEnoughItems:1.7.10-1.0.3.74:src'
|
||||
|
||||
implementation('codechicken:CodeChickenLib:1.7.10-1.1.3.140:dev') { transitive = false }
|
||||
compileOnly('codechicken:CodeChickenLib:1.7.10-1.1.3.140:src') { transitive = false }
|
||||
compileOnly "inventorytweaks:InventoryTweaks:1.59-dev:deobf"
|
||||
|
||||
implementation('codechicken:NotEnoughItems:1.7.10-1.0.3.74:dev') { transitive = false }
|
||||
compileOnly('codechicken:NotEnoughItems:1.7.10-1.0.3.74:src') { transitive = false }
|
||||
implementation "li.cil.oc:OpenComputers:MC1.7.10-1.5.+:api"
|
||||
|
||||
compileOnly("inventorytweaks:InventoryTweaks:1.59-dev:deobf") { transitive = false }
|
||||
|
||||
compileOnly("li.cil.oc:OpenComputers:MC1.7.10-1.5.+:api") { transitive = false }
|
||||
|
||||
compileOnly("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta.56-GTNH:dev") { transitive = false }
|
||||
compileOnly "com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta.56-GTNH:dev"
|
||||
}
|
||||
|
||||
processResources {
|
||||
@ -128,7 +123,7 @@ processResources {
|
||||
// replace stuff in mcmod.info, nothing else
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
include 'mcmod.info'
|
||||
|
||||
|
||||
// replace version and mcversion
|
||||
filesMatching('mcmod.info') {
|
||||
// replace version, mcversion and credits
|
||||
@ -138,7 +133,7 @@ processResources {
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// copy everything else, thats not the mcmod.info
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
exclude 'mcmod.info'
|
||||
@ -152,30 +147,6 @@ jar {
|
||||
}
|
||||
}
|
||||
|
||||
task sourceJar(type: Jar) {
|
||||
from sourceSets.main.allJava
|
||||
|
||||
classifier "src"
|
||||
|
||||
manifest {
|
||||
attributes 'FMLAT': 'HBM_at.cfg'
|
||||
}
|
||||
}
|
||||
|
||||
task devJar(type: Jar) {
|
||||
// hack: artificially depend on the reobf task here to get the normal jar to be overwritten before publishing
|
||||
dependsOn reobf
|
||||
|
||||
from(sourceSets.main.output) {
|
||||
include "**"
|
||||
}
|
||||
classifier "dev"
|
||||
|
||||
manifest {
|
||||
attributes 'FMLAT': 'HBM_at.cfg'
|
||||
}
|
||||
}
|
||||
|
||||
task version {
|
||||
doFirst {
|
||||
println project.version
|
||||
@ -208,41 +179,6 @@ if(Files.exists(Paths.get("curseforge.properties"))) {
|
||||
}
|
||||
}
|
||||
|
||||
if(Files.exists(Paths.get("maven.properties"))) {
|
||||
publishing {
|
||||
publications {
|
||||
release(MavenPublication) {
|
||||
artifactId archivesBaseName
|
||||
version version_name
|
||||
|
||||
artifact sourceJar {
|
||||
classifier "src"
|
||||
}
|
||||
|
||||
artifact devJar {
|
||||
classifier "dev"
|
||||
}
|
||||
|
||||
artifact jar
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
maven {
|
||||
name "Nuggies"
|
||||
url "https://maven.ntmr.dev/releases"
|
||||
|
||||
credentials {
|
||||
username mavenprops.username
|
||||
password mavenprops.password
|
||||
}
|
||||
authentication {
|
||||
basic(BasicAuthentication)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Properties file parsing helper
|
||||
static def parseConfig(File config) {
|
||||
config.withReader {
|
||||
|
||||
85
changelog
85
changelog
@ -1,32 +1,59 @@
|
||||
## Added
|
||||
* Redstone-over-Radio Terminal
|
||||
* Allows commands to be sent manually, command line style
|
||||
* Supports single commands and repeated ones (polling)
|
||||
* Grenade machinegun
|
||||
* 30rnd automatic 40mm grenade weapon firing at 120 RPS
|
||||
* Can be upgraded with an auxiliary electric engine to double the firerate
|
||||
* Automatic thresher
|
||||
* A specialized machine for automatically harvesting crops in a 7x7 area
|
||||
* Replaces the buzzsaw's temporary functionality to do just that (the buzzsaw now loses that ability)
|
||||
* Drops harvested items using a chute instead of leaving them on the farmland
|
||||
* When cutting down hemp, willows, and other NTM double plants, only the top part will be cut off, no matter where the thresher touches it
|
||||
* Can also harvest items from sunflowers and tall grass without breaking the blocks
|
||||
* Can also handle tall plants like cacti and sugar cane
|
||||
* New big-ass tank
|
||||
* Successor to the BAT9k
|
||||
* Larger footprint, way more storage space
|
||||
* Needs to be placed on a proper foundation or else it'll sink into the ground
|
||||
* Legacy BAT9ks can be recycled in a tier 3 anvil
|
||||
* AUTOCAL Automatic Calculator
|
||||
* Highly advanced programmable RoR device
|
||||
* Can send and receive signals and do calculations with the same system as NTM's calculator
|
||||
|
||||
## Changed
|
||||
* Updated chinese localization
|
||||
* 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
|
||||
* RoR graphs can now have their min and max bounds set to a fixed number
|
||||
* This should make it easier to accurately tell the difference/scale of values when they exist in an expected range (for example, RBMK temperatures)
|
||||
* RoR controllers now use polling by default, since state change is unable to actually perform a function unless the state changes, preventing repeated commands
|
||||
* HE/RF converters now have a tooltip showing their buffered energy
|
||||
* Updated the models of the cage lamp, fluorescent light and halogen lamp
|
||||
* 528 mode now has a new config for enabling gravity on machines
|
||||
* Machines not on solid ground will tilt, causing them to break
|
||||
* Still a work in progress, not all machines make use of it yet
|
||||
* The ZIRNOX for example will continue to operate when tilted, however the pipes will disconnect, resulting in a fatal loss of cooling
|
||||
* Slightly adjusted the automatic buzzsaw's texture
|
||||
* Mobs can no longer spawn on most versions of concrete
|
||||
* Notable exceptions are mossy and cracked concrete bricks
|
||||
* Increased the yield of lye from wood ash
|
||||
* All fluid tanks larger than barrels now have dynamic IO speed instead of providing their entire contents instantly
|
||||
* Tank fill will slow down the fuller the tank becomes, tank drain also slow downs as it gets emptier
|
||||
* This means that multiple tanks in IO mode in the same network will still ping pong, but only a small portion of fluid will be "lost" (i.e. invisible due to subtick transfer operations)
|
||||
* The stinger is now classified as a special weapon
|
||||
* The carbine can now take a scope
|
||||
* The battery socket now renders supports when a block is placed on top of it, allowing somewhat aesthetic stacking of sockets
|
||||
* The bayonet weapon attachment now uses regular steel plates instead of weapon steel, making them available as early as the blast furnace
|
||||
* Adjusted some 528 mode recipes
|
||||
* Removed the template crates entirely for being literally useless
|
||||
* Oil bubbles can no longer go down to Y:0, they now have a minimum center height of Y:15
|
||||
* The automatic buzzsaw and thresher now have sound loops when active
|
||||
* The shredder auto shotgun now uses the plasma damage type instead of laser
|
||||
* Added "nitra to ammunition" recipe in the assembly machine, turning large piles of nitra into random casings/propellants
|
||||
|
||||
## 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 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
|
||||
* Fixed RoR graph showing the wrong name in the GUI
|
||||
* Fixed polling option in RoR controllers reading dead signals
|
||||
* Fixed state change in RoR controllers not allowing repeat commands
|
||||
* Fixed blast furnace NEI handler not cycling through all valid material shapes
|
||||
* Fixed RoR transmitter sending empty signals when unused mappings apply
|
||||
* Fixed hopper IO for battery sockets being entirely broken
|
||||
* Fixed cargo elevators not dropping the correct amount of segments
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
mod_version=1.0.27
|
||||
# Empty build number makes a release type
|
||||
mod_build_number=5719
|
||||
mod_build_number=5687
|
||||
|
||||
credits=HbMinecraft,\
|
||||
\ rodolphito (explosion algorithms),\
|
||||
|
||||
@ -15,24 +15,12 @@ public interface ISlotMonitorProvider {
|
||||
/** Returns an array of available slot monitors, which should ideally mirror the available slots of that container */
|
||||
public SlotMonitor[] getMonitors();
|
||||
|
||||
/** Returns the ORIGIANL ItemStack of that index, so that the monitors can detect changes */
|
||||
/** Returns the slot contents of that index, so that the monitors can detect changes */
|
||||
public ItemStack getSlotAt(int index);
|
||||
|
||||
/** Returns the amount of that slot at that index. Some storages may use int64 datatypes so we have to account for those too somehow, since ItemStacks cannot handle that. */
|
||||
public long getAmountAt(int index);
|
||||
|
||||
/** Removes the given number of items from that slot, returns the amount left to remove if the stack was smaller than the supplied amount */
|
||||
public long useUpItem(int index, long amount);
|
||||
|
||||
/** Adds the given number of items to that slot, returns the amount that couldn't be added due to stack limits */
|
||||
public long addItem(int index, long amount);
|
||||
|
||||
/** Sets the slot contents, returns the number of items that couldn't be added */
|
||||
public long setupType(int index, ItemStack zeroStack, long amount);
|
||||
|
||||
/** Whether this container allows types to be set via the access terminal */
|
||||
public boolean allowTypeSetting();
|
||||
|
||||
/** Whether this storage unit is reachable by the access point */
|
||||
public boolean isAvailableToCache(StackCache cache);
|
||||
|
||||
|
||||
@ -35,13 +35,11 @@ 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;
|
||||
}
|
||||
@ -103,7 +101,9 @@ public class SlotMonitor {
|
||||
else if(nbt != null && stack.hasTagCompound() && !nbt.equals(stack.stackTagCompound)) hasTypeChanged = true;
|
||||
}
|
||||
|
||||
if(hasTypeChanged || forceTypeUpdate) {
|
||||
if(hasTypeChanged) {
|
||||
|
||||
System.out.println("Type changed!");
|
||||
|
||||
// remove from all existing monitors
|
||||
Iterator<CacheSlot> iterator = viewedBy.iterator();
|
||||
@ -111,6 +111,7 @@ public class SlotMonitor {
|
||||
CacheSlot slot = iterator.next();
|
||||
slot.removeMonitor(this);
|
||||
iterator.remove();
|
||||
System.out.println("Removing");
|
||||
}
|
||||
|
||||
// set updated traits
|
||||
@ -129,14 +130,17 @@ public class SlotMonitor {
|
||||
// find new monitors
|
||||
if(pneumoNet != null) {
|
||||
|
||||
System.out.println("Adding to new network...");
|
||||
|
||||
for(StackCache cache : pneumoNet.accessors) {
|
||||
System.out.println("Adding to cache...");
|
||||
if(!cache.hasExpired && parent.isAvailableToCache(cache)) {
|
||||
cache.addToCache(this);
|
||||
System.out.println("Added!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
forceTypeUpdate = false;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -46,61 +46,6 @@ public class StackCache {
|
||||
cache.addMonitor(monitor);
|
||||
}
|
||||
|
||||
public CacheSlot getSlotFromStack(ItemStack stack) {
|
||||
return getSlotFromStack(stack.getItem(), stack.getItemDamage(), stack.stackTagCompound);
|
||||
}
|
||||
|
||||
public CacheSlot getSlotFromStack(Item item, int meta, NBTTagCompound nbt) {
|
||||
long monitorIdentity = getStackIdentity(item, meta, nbt);
|
||||
return cacheSlots.get(monitorIdentity);
|
||||
}
|
||||
|
||||
/** Uses up items and returns how many of the requested items could be removed, with no desyncs that number should always be equal to the supplied amount */
|
||||
public long consumeItemsAndReturnQuantity(ItemStack stack, long amount) {
|
||||
long stackIdentity = getStackIdentity(stack.getItem(), stack.getItemDamage(), stack.stackTagCompound);
|
||||
CacheSlot cache = this.cacheSlots.get(stackIdentity);
|
||||
if(cache == null) return 0;
|
||||
long originalAmount = amount;
|
||||
|
||||
for(SlotMonitor monitor : cache.monitors) {
|
||||
ItemStack original = monitor.parent.getSlotAt(monitor.index);
|
||||
long checkIdentity = getStackIdentity(original);
|
||||
if(checkIdentity != stackIdentity) continue;
|
||||
amount = monitor.parent.useUpItem(monitor.index, amount);
|
||||
if(amount <= 0) break;
|
||||
}
|
||||
|
||||
return originalAmount - amount;
|
||||
}
|
||||
|
||||
/** Adds a stack to the system and returns the amount that did not fit */
|
||||
public long addItemsAndReturnQuantity(ItemStack stack, long amount) {
|
||||
long stackIdentity = getStackIdentity(stack.getItem(), stack.getItemDamage(), stack.stackTagCompound);
|
||||
CacheSlot cache = this.cacheSlots.get(stackIdentity);
|
||||
|
||||
if(cache != null) for(SlotMonitor monitor : cache.monitors) {
|
||||
ItemStack original = monitor.parent.getSlotAt(monitor.index);
|
||||
long checkIdentity = getStackIdentity(original);
|
||||
if(checkIdentity != stackIdentity) continue;
|
||||
amount = monitor.parent.addItem(monitor.index, amount);
|
||||
if(amount <= 0) break;
|
||||
}
|
||||
|
||||
if(amount > 0) {
|
||||
CacheSlot nullCache = this.cacheSlots.get(getNullIdentity());
|
||||
if(nullCache != null) { // quite ironic, isn't it?
|
||||
for(SlotMonitor monitor : nullCache.monitors) {
|
||||
if(!monitor.parent.allowTypeSetting()) continue;
|
||||
if(monitor.parent.getSlotAt(monitor.index) != null) continue;
|
||||
amount = monitor.parent.setupType(monitor.index, stack, amount);
|
||||
if(amount <= 0) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return amount;
|
||||
}
|
||||
|
||||
public void dissolveCache() {
|
||||
for(Entry<Long, CacheSlot> cacheEntry : cacheSlots.entrySet()) {
|
||||
cacheEntry.getValue().destroy();
|
||||
@ -156,8 +101,10 @@ public class StackCache {
|
||||
}
|
||||
|
||||
public void removeMonitor(SlotMonitor monitor) {
|
||||
System.out.println("Trying to remove...");
|
||||
if(this.monitors.remove(monitor)) {
|
||||
this.changeAmounts(-monitor.stacksize);
|
||||
System.out.println("Removed!");
|
||||
}
|
||||
}
|
||||
|
||||
@ -186,20 +133,9 @@ public class StackCache {
|
||||
}
|
||||
}
|
||||
|
||||
public static long getNullIdentity() {
|
||||
return 0; //getStackIdentity(null, 0, null);
|
||||
}
|
||||
|
||||
public static long getStackIdentity(ItemStack stack) {
|
||||
if(stack == null) return getNullIdentity();
|
||||
return getStackIdentity(stack.getItem(), stack.getItemDamage(), stack.stackTagCompound);
|
||||
}
|
||||
|
||||
public static long getStackIdentity(Item item, int meta, NBTTagCompound nbt) {
|
||||
if(item == null) return getNullIdentity();
|
||||
long identity = Item.getIdFromItem(item) * 27644437;
|
||||
identity += meta;
|
||||
identity *= 27644437;
|
||||
identity += meta * 27644437;
|
||||
if(nbt != null) identity += nbt.toString().hashCode();
|
||||
return identity;
|
||||
}
|
||||
|
||||
@ -310,14 +310,24 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block b, int i) {
|
||||
if(i >= 12) { } else if(!safeRem) {
|
||||
if(i >= 12) {
|
||||
// ForgeDirection d = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z) - offset);
|
||||
// MultiblockHandler.emptySpace(world, x, y, z, getDimensions(), this, d);
|
||||
} else if(!safeRem) {
|
||||
|
||||
if(i >= extra) i -= extra;
|
||||
if(i >= extra)
|
||||
i -= extra;
|
||||
|
||||
// ForgeDirection dir = ForgeDirection.getOrientation(i).getOpposite();
|
||||
// int[] pos = findCore(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
|
||||
|
||||
// if(pos != null) {
|
||||
|
||||
ForgeDirection d = ForgeDirection.getOrientation(i);
|
||||
|
||||
if(world.getBlock(x - d.offsetX, y - d.offsetY, z - d.offsetZ) == this)
|
||||
world.setBlockToAir(x - d.offsetX, y - d.offsetY, z - d.offsetZ);
|
||||
// }
|
||||
}
|
||||
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
@ -380,9 +390,6 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns an int array with six fields, describing the amount of dummy blocks in each direction around the core. order is UP, DOWN, FORWARD, BACKWARD, LEFT, RIGHT
|
||||
*/
|
||||
public abstract int[] getDimensions();
|
||||
|
||||
public abstract int getOffset();
|
||||
|
||||
@ -208,6 +208,7 @@ public class ModBlocks {
|
||||
public static Block block_schrabidium_cluster;
|
||||
public static Block block_euphemium_cluster;
|
||||
public static Block block_dineutronium;
|
||||
public static Block block_advanced_alloy;
|
||||
public static Block block_magnetized_tungsten;
|
||||
public static Block block_combine_steel;
|
||||
public static Block block_desh;
|
||||
@ -272,7 +273,6 @@ public class ModBlocks {
|
||||
public static Block snowglobe;
|
||||
public static Block plushie;
|
||||
public static Block dungeon_spawner;
|
||||
public static Block vending_machine;
|
||||
|
||||
public static Block gravel_obsidian;
|
||||
public static Block gravel_diamond;
|
||||
@ -524,7 +524,9 @@ public class ModBlocks {
|
||||
public static Block ore_sellafield_schrabidium;
|
||||
public static Block ore_sellafield_radgem;
|
||||
|
||||
public static Block geysir_water;
|
||||
public static Block geysir_chlorine;
|
||||
public static Block geysir_vapor;
|
||||
public static Block geysir_nether;
|
||||
|
||||
public static Block flame_war;
|
||||
@ -668,12 +670,11 @@ public class ModBlocks {
|
||||
public static Block foundry_slagtap;
|
||||
public static Block slag;
|
||||
|
||||
@Deprecated public static Block machine_difurnace_off;
|
||||
@Deprecated public static Block machine_difurnace_on;
|
||||
@Deprecated public static Block machine_difurnace_extension;
|
||||
@Deprecated public static Block machine_difurnace_rtg_off;
|
||||
@Deprecated public static Block machine_difurnace_rtg_on;
|
||||
public static Block machine_blast_furnace;
|
||||
public static Block machine_difurnace_off;
|
||||
public static Block machine_difurnace_on;
|
||||
public static Block machine_difurnace_extension;
|
||||
public static Block machine_difurnace_rtg_off;
|
||||
public static Block machine_difurnace_rtg_on;
|
||||
//public static final int guiID_test_difurnace = 1; historical
|
||||
|
||||
public static Block machine_centrifuge;
|
||||
@ -692,8 +693,8 @@ public class ModBlocks {
|
||||
|
||||
public static Block machine_furnace_brick_off;
|
||||
public static Block machine_furnace_brick_on;
|
||||
@Deprecated public static Block machine_rtg_furnace_off;
|
||||
@Deprecated public static Block machine_rtg_furnace_on;
|
||||
public static Block machine_rtg_furnace_off;
|
||||
public static Block machine_rtg_furnace_on;
|
||||
|
||||
public static Block machine_industrial_generator;
|
||||
|
||||
@ -722,7 +723,7 @@ public class ModBlocks {
|
||||
|
||||
public static Block machine_battery_socket;
|
||||
public static Block machine_battery_redd;
|
||||
|
||||
|
||||
@Deprecated public static Block machine_battery_potato;
|
||||
@Deprecated public static Block machine_battery;
|
||||
@Deprecated public static Block machine_lithium_battery;
|
||||
@ -814,15 +815,21 @@ public class ModBlocks {
|
||||
public static Block chain;
|
||||
|
||||
public static Block ladder_sturdy;
|
||||
public static Block ladder_iron;
|
||||
public static Block ladder_gold;
|
||||
public static Block ladder_aluminium;
|
||||
public static Block ladder_copper;
|
||||
public static Block ladder_titanium;
|
||||
public static Block ladder_lead;
|
||||
public static Block ladder_cobalt;
|
||||
public static Block ladder_steel;
|
||||
public static Block ladder_tungsten;
|
||||
|
||||
public static Block trapdoor_steel;
|
||||
|
||||
public static Block barrel_plastic;
|
||||
public static Block barrel_corroded;
|
||||
@Deprecated public static Block barrel_corroded;
|
||||
@Deprecated public static Block barrel_iron;
|
||||
public static Block barrel_steel;
|
||||
public static Block barrel_tcalloy;
|
||||
public static Block barrel_antimatter;
|
||||
@ -841,6 +848,9 @@ public class ModBlocks {
|
||||
public static Block struct_watz_core;
|
||||
public static Block struct_icf_core;
|
||||
|
||||
@Deprecated public static Block factory_titanium_hull;
|
||||
@Deprecated public static Block factory_advanced_hull;
|
||||
|
||||
public static Block cm_block;
|
||||
public static Block cm_sheet;
|
||||
public static Block cm_engine;
|
||||
@ -914,7 +924,9 @@ public class ModBlocks {
|
||||
public static Block teleanchor;
|
||||
public static Block field_disturber;
|
||||
|
||||
public static Block machine_rtg;
|
||||
public static Block machine_rtg_grey;
|
||||
@Deprecated public static Block machine_minirtg;
|
||||
@Deprecated public static Block machine_powerrtg;
|
||||
public static Block machine_radiolysis;
|
||||
public static Block machine_hephaestus;
|
||||
|
||||
@ -983,7 +995,7 @@ public class ModBlocks {
|
||||
public static Block machine_mixer;
|
||||
|
||||
public static Block machine_fluidtank;
|
||||
@Deprecated public static Block machine_bat9000;
|
||||
public static Block machine_bat9000;
|
||||
public static Block machine_bigasstank;
|
||||
public static Block machine_orbus;
|
||||
|
||||
@ -1145,6 +1157,7 @@ public class ModBlocks {
|
||||
public static Block gas_coal;
|
||||
public static Block gas_flammable;
|
||||
public static Block gas_explosive;
|
||||
public static Block vacuum;
|
||||
|
||||
public static Block rad_absorber;
|
||||
public static Block decon;
|
||||
@ -1209,7 +1222,6 @@ public class ModBlocks {
|
||||
public static Block wand_structure;
|
||||
|
||||
public static Block logic_block;
|
||||
public static Block logic_block_invis;
|
||||
|
||||
public static Material materialGas = new MaterialGas();
|
||||
|
||||
@ -1373,6 +1385,7 @@ public class ModBlocks {
|
||||
block_dineutronium = new BlockBeaconable(Material.iron).setBlockName("block_dineutronium").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(60000.0F).setBlockTextureName(RefStrings.MODID + ":block_dineutronium");
|
||||
block_schrabidium_cluster = new BlockRotatablePillar(Material.rock, RefStrings.MODID + ":block_schrabidium_cluster_top").setBlockName("block_schrabidium_cluster").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(60000.0F).setBlockTextureName(RefStrings.MODID + ":block_schrabidium_cluster_side");
|
||||
block_euphemium_cluster = new BlockRotatablePillar(Material.rock, RefStrings.MODID + ":block_euphemium_cluster_top").setBlockName("block_euphemium_cluster").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(60000.0F).setBlockTextureName(RefStrings.MODID + ":block_euphemium_cluster_side");
|
||||
block_advanced_alloy = new BlockBeaconable(Material.iron).setBlockName("block_advanced_alloy").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(60.0F).setBlockTextureName(RefStrings.MODID + ":block_advanced_alloy");
|
||||
block_magnetized_tungsten = new BlockBeaconable(Material.iron).setBlockName("block_magnetized_tungsten").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(75.0F).setBlockTextureName(RefStrings.MODID + ":block_magnetized_tungsten");
|
||||
block_combine_steel = new BlockBeaconable(Material.iron).setBlockName("block_combine_steel").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(600.0F).setBlockTextureName(RefStrings.MODID + ":block_combine_steel");
|
||||
block_desh = new BlockBeaconable(Material.iron).setBlockName("block_desh").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(300.0F).setBlockTextureName(RefStrings.MODID + ":block_desh");
|
||||
@ -1437,7 +1450,6 @@ public class ModBlocks {
|
||||
snowglobe = new BlockSnowglobe().setBlockName("snowglobe").setCreativeTab(MainRegistry.blockTab).setHardness(0.0F).setResistance(0.0F).setBlockTextureName(RefStrings.MODID + ":glass_boron");
|
||||
plushie = new BlockPlushie().setBlockName("plushie").setStepSound(Block.soundTypeCloth).setResistance(50_0000.0F).setCreativeTab(MainRegistry.blockTab).setHardness(0.0F).setResistance(0.0F).setBlockTextureName(RefStrings.MODID + ":block_fiberglass_side");
|
||||
dungeon_spawner = new DungeonSpawner().setBlockName("dungeon_spawner").setResistance(50_0000.0F).setBlockUnbreakable().setBlockTextureName(RefStrings.MODID + ":dungeon_spawner");
|
||||
vending_machine = new BlockVendingMachine().setBlockName("vending_machine").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
|
||||
gravel_obsidian = new BlockFalling(Material.iron).setBlockName("gravel_obsidian").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeGravel).setHardness(5.0F).setResistance(240.0F).setBlockTextureName(RefStrings.MODID + ":gravel_obsidian");
|
||||
gravel_diamond = new BlockFalling(Material.sand).setBlockName("gravel_diamond").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeGravel).setHardness(0.6F).setBlockTextureName(RefStrings.MODID + ":gravel_diamond");
|
||||
@ -1681,7 +1693,9 @@ public class ModBlocks {
|
||||
ore_sellafield_schrabidium = new BlockSellafieldOre(Material.rock).setBlockName("ore_sellafield_schrabidium").setStepSound(Block.soundTypeStone).setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setBlockTextureName(RefStrings.MODID + ":ore_overlay_schrabidium");
|
||||
ore_sellafield_radgem = new BlockSellafieldOre(Material.rock).setBlockName("ore_sellafield_radgem").setStepSound(Block.soundTypeStone).setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setBlockTextureName(RefStrings.MODID + ":ore_overlay_radgem");
|
||||
|
||||
geysir_water = new BlockGeysir(Material.rock).setBlockName("geysir_water").setStepSound(Block.soundTypeStone).setHardness(5.0F);
|
||||
geysir_chlorine = new BlockGeysir(Material.rock).setBlockName("geysir_chlorine").setStepSound(Block.soundTypeStone).setHardness(5.0F);
|
||||
geysir_vapor = new BlockGeysir(Material.rock).setBlockName("geysir_vapor").setStepSound(Block.soundTypeStone).setHardness(5.0F);
|
||||
geysir_nether = new BlockGeysir(Material.rock).setBlockName("geysir_nether").setLightLevel(1.0F).setStepSound(Block.soundTypeStone).setHardness(2.0F);
|
||||
|
||||
nuke_gadget = new NukeGadget(Material.iron).setBlockName("nuke_gadget").setCreativeTab(MainRegistry.nukeTab).setHardness(5.0F).setResistance(200.0F).setBlockTextureName(RefStrings.MODID + ":theGadget");
|
||||
@ -1765,7 +1779,6 @@ public class ModBlocks {
|
||||
machine_difurnace_extension = new MachineDiFurnaceExtension().setBlockName("machine_difurnace_extension").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
machine_difurnace_rtg_off = new MachineDiFurnaceRTG(false).setBlockName("machine_difurnace_rtg_off").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
machine_difurnace_rtg_on = new MachineDiFurnaceRTG(true).setBlockName("machine_difurnace_rtg_on").setHardness(5.0F).setResistance(10.0F).setLightLevel(1.0F).setCreativeTab(null);
|
||||
machine_blast_furnace = new MachineBlastFurnace().setBlockName("machine_blast_furnace").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":brick_fire");
|
||||
|
||||
machine_centrifuge = new MachineCentrifuge(Material.iron).setBlockName("machine_centrifuge").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
machine_gascent = new MachineGasCent(Material.iron).setBlockName("machine_gascent").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
@ -1813,7 +1826,7 @@ public class ModBlocks {
|
||||
|
||||
machine_battery_socket = new MachineBatterySocket().setBlockName("machine_battery_socket").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
machine_battery_redd = new MachineBatteryREDD().setBlockName("machine_battery_redd").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
|
||||
|
||||
machine_battery_potato = new MachineBattery(Material.iron, 10_000).setBlockName("machine_battery_potato").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null);
|
||||
machine_battery = new MachineBattery(Material.iron, 1_000_000).setBlockName("machine_battery").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null);
|
||||
machine_lithium_battery = new MachineBattery(Material.iron, 50_000_000).setBlockName("machine_lithium_battery").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null);
|
||||
@ -1838,7 +1851,9 @@ 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 = new MachineRTG(Material.iron).setBlockName("machine_rtg_grey").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":rtg");
|
||||
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_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");
|
||||
|
||||
@ -1906,24 +1921,30 @@ 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(2F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pneumatic_tube");
|
||||
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_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(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_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");
|
||||
|
||||
chain = new BlockChain(Material.iron).setBlockName("dungeon_chain").setHardness(0.25F).setResistance(2.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":chain");
|
||||
|
||||
ladder_sturdy = new BlockNTMLadder().setBlockName("ladder_sturdy").setHardness(0.25F).setResistance(2.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":ladder_sturdy");
|
||||
ladder_iron = new BlockNTMLadder().setBlockName("ladder_iron").setHardness(0.25F).setResistance(2.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":ladder_iron");
|
||||
ladder_gold = new BlockNTMLadder().setBlockName("ladder_gold").setHardness(0.25F).setResistance(2.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":ladder_gold");
|
||||
ladder_aluminium = new BlockNTMLadder().setBlockName("ladder_aluminium").setHardness(0.25F).setResistance(2.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":ladder_aluminium");
|
||||
ladder_copper = new BlockNTMLadder().setBlockName("ladder_copper").setHardness(0.25F).setResistance(2.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":ladder_copper");
|
||||
ladder_titanium = new BlockNTMLadder().setBlockName("ladder_titanium").setHardness(0.25F).setResistance(2.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":ladder_titanium");
|
||||
ladder_lead = new BlockNTMLadder().setBlockName("ladder_lead").setHardness(0.25F).setResistance(2.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":ladder_lead");
|
||||
ladder_cobalt = new BlockNTMLadder().setBlockName("ladder_cobalt").setHardness(0.25F).setResistance(2.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":ladder_cobalt");
|
||||
ladder_steel = new BlockNTMLadder().setBlockName("ladder_steel").setHardness(0.25F).setResistance(2.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":ladder_steel");
|
||||
ladder_tungsten = new BlockNTMLadder().setBlockName("ladder_tungsten").setHardness(0.25F).setResistance(2.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":ladder_tungsten");
|
||||
|
||||
trapdoor_steel = new BlockNTMTrapdoor(Material.iron).setBlockName("trapdoor_steel").setHardness(3F).setResistance(8.0F).setStepSound(Block.soundTypeMetal).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":trapdoor_steel");
|
||||
|
||||
barrel_plastic = new BlockFluidBarrel(Material.iron, 12000).setBlockName("barrel_plastic").setStepSound(Block.soundTypeStone).setHardness(2.0F).setResistance(5.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":barrel_plastic");
|
||||
barrel_corroded = new BlockFluidBarrel(Material.iron, 6000).setBlockName("barrel_corroded").setStepSound(Block.soundTypeMetal).setHardness(2.0F).setResistance(5.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":barrel_corroded");
|
||||
barrel_iron = new BlockFluidBarrel(Material.iron, 8000).setBlockName("barrel_iron").setStepSound(Block.soundTypeMetal).setHardness(2.0F).setResistance(5.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":barrel_iron");
|
||||
barrel_steel = new BlockFluidBarrel(Material.iron, 16000).setBlockName("barrel_steel").setStepSound(Block.soundTypeMetal).setHardness(2.0F).setResistance(5.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":barrel_steel");
|
||||
barrel_tcalloy = new BlockFluidBarrel(Material.iron, 24000).setBlockName("barrel_tcalloy").setStepSound(Block.soundTypeMetal).setHardness(2.0F).setResistance(5.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":barrel_tcalloy");
|
||||
barrel_antimatter = new BlockFluidBarrel(Material.iron, 16000).setBlockName("barrel_antimatter").setStepSound(Block.soundTypeMetal).setHardness(2.0F).setResistance(5.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":barrel_antimatter");
|
||||
@ -1947,6 +1968,9 @@ public class ModBlocks {
|
||||
struct_watz_core = new BlockWatzStruct(Material.iron).setBlockName("struct_watz_core").setLightLevel(1F).setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":struct_watz_core");
|
||||
struct_icf_core = new BlockICFStruct(Material.iron).setBlockName("struct_icf_core").setLightLevel(1F).setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":struct_icf_core");
|
||||
|
||||
factory_titanium_hull = new BlockGeneric(Material.iron).setBlockName("factory_titanium_hull").setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":factory_titanium_hull");
|
||||
factory_advanced_hull = new BlockGeneric(Material.iron).setBlockName("factory_advanced_hull").setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":factory_advanced_hull");
|
||||
|
||||
cm_block = new BlockCM(Material.iron, EnumCMMaterials.class, true, true).setBlockName("cm_block").setCreativeTab(MainRegistry.machineTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":cm_block");
|
||||
cm_sheet = new BlockCM(Material.iron, EnumCMMaterials.class, true, true).setBlockName("cm_sheet").setCreativeTab(MainRegistry.machineTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":cm_sheet");
|
||||
cm_engine = new BlockCM(Material.iron, EnumCMEngines.class, true, true).setBlockName("cm_engine").setCreativeTab(MainRegistry.machineTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":cm_engine");
|
||||
@ -2272,6 +2296,7 @@ public class ModBlocks {
|
||||
gas_coal = new BlockGasCoal().setBlockName("gas_coal").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":gas_coal");
|
||||
gas_flammable = new BlockGasFlammable().setBlockName("gas_flammable").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":gas_flammable");
|
||||
gas_explosive = new BlockGasExplosive().setBlockName("gas_explosive").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":gas_explosive");
|
||||
vacuum = new BlockVacuum().setBlockName("vacuum").setResistance(1000000F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":vacuum");
|
||||
|
||||
rad_absorber = new BlockAbsorber(Material.iron).setBlockName("rad_absorber").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
decon = new BlockDecon(Material.iron).setBlockName("decon").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":decon_side");
|
||||
@ -2343,7 +2368,7 @@ public class ModBlocks {
|
||||
wand_structure = new BlockWandStructure().setBlockName("wand_structure");
|
||||
|
||||
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() {
|
||||
@ -2489,6 +2514,7 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(block_niter, block_niter.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(block_copper, block_copper.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(block_red_copper, block_red_copper.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(block_advanced_alloy, block_advanced_alloy.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(block_tungsten, block_tungsten.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(block_aluminium, block_aluminium.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(block_fluorite, block_fluorite.getUnlocalizedName());
|
||||
@ -2580,7 +2606,6 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(bobblehead, ItemBlockMeta.class, bobblehead.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(snowglobe, ItemBlockMeta.class, snowglobe.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(plushie, ItemBlockBase.class, plushie.getUnlocalizedName());
|
||||
register(vending_machine);
|
||||
GameRegistry.registerBlock(deco_rbmk, deco_rbmk.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(deco_rbmk_smooth, deco_rbmk_smooth.getUnlocalizedName());
|
||||
|
||||
@ -2832,7 +2857,9 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(sellafield, ItemBlockNamedMeta.class, sellafield.getUnlocalizedName());
|
||||
|
||||
//Geysirs
|
||||
GameRegistry.registerBlock(geysir_water, geysir_water.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(geysir_chlorine, geysir_chlorine.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(geysir_vapor, geysir_vapor.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(geysir_nether, geysir_nether.getUnlocalizedName());
|
||||
|
||||
//Nukes
|
||||
@ -3026,7 +3053,6 @@ public class ModBlocks {
|
||||
register(machine_difurnace_off);
|
||||
register(machine_difurnace_on);
|
||||
register(machine_difurnace_extension);
|
||||
register(machine_blast_furnace);
|
||||
GameRegistry.registerBlock(machine_difurnace_rtg_off, machine_difurnace_rtg_off.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_difurnace_rtg_on, machine_difurnace_rtg_on.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_centrifuge, machine_centrifuge.getUnlocalizedName());
|
||||
@ -3051,7 +3077,9 @@ 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, machine_rtg.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_radiolysis, machine_radiolysis.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_hephaestus, machine_hephaestus.getUnlocalizedName());
|
||||
|
||||
@ -3181,14 +3209,20 @@ public class ModBlocks {
|
||||
|
||||
GameRegistry.registerBlock(chain, chain.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(ladder_sturdy, ladder_sturdy.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(ladder_iron, ladder_iron.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(ladder_gold, ladder_gold.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(ladder_titanium, ladder_titanium.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(ladder_copper, ladder_copper.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(ladder_tungsten, ladder_tungsten.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(ladder_aluminium, ladder_aluminium.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(ladder_steel, ladder_steel.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(ladder_lead, ladder_lead.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(ladder_cobalt, ladder_cobalt.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(trapdoor_steel, trapdoor_steel.getUnlocalizedName());
|
||||
|
||||
register(barrel_plastic);
|
||||
register(barrel_corroded);
|
||||
register(barrel_iron);
|
||||
register(barrel_steel);
|
||||
register(barrel_tcalloy);
|
||||
register(barrel_antimatter);
|
||||
@ -3301,6 +3335,10 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(machine_solar_boiler, machine_solar_boiler.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(solar_mirror, solar_mirror.getUnlocalizedName());
|
||||
|
||||
//Literal fucking garbage
|
||||
GameRegistry.registerBlock(factory_titanium_hull, factory_titanium_hull.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(factory_advanced_hull, factory_advanced_hull.getUnlocalizedName());
|
||||
|
||||
//CM stuff
|
||||
register(custom_machine, ItemCustomMachine.class);
|
||||
register(cm_block);
|
||||
@ -3451,6 +3489,7 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(gas_coal, gas_coal.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(gas_flammable, gas_flammable.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(gas_explosive, gas_explosive.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(vacuum, vacuum.getUnlocalizedName());
|
||||
|
||||
// OC Compat Items
|
||||
if(Loader.isModLoaded(Compat.MOD_OC)) {
|
||||
@ -3477,7 +3516,6 @@ public class ModBlocks {
|
||||
register(wand_structure);
|
||||
|
||||
register(logic_block);
|
||||
register(logic_block_invis);
|
||||
}
|
||||
|
||||
private static void register(Block b) {
|
||||
|
||||
137
src/main/java/com/hbm/blocks/gas/BlockVacuum.java
Normal file
137
src/main/java/com/hbm/blocks/gas/BlockVacuum.java
Normal file
@ -0,0 +1,137 @@
|
||||
package com.hbm.blocks.gas;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class BlockVacuum extends Block {
|
||||
|
||||
public BlockVacuum() {
|
||||
super(ModBlocks.materialGas);
|
||||
this.setHardness(0.0F);
|
||||
this.setResistance(0.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCollideCheck(int p_149678_1_, boolean p_149678_2_) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReplaceable(IBlockAccess world, int x, int y, int z) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, int x, int y, int z) {
|
||||
if(!world.isRemote) world.scheduleBlockUpdate(x, y, z, this, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
||||
if(!world.isRemote) world.scheduleBlockUpdate(x, y, z, this, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random rand) {
|
||||
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
|
||||
Block b = world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
|
||||
|
||||
if(b == this)
|
||||
continue;
|
||||
|
||||
if(isAirBlock(b)) {
|
||||
|
||||
if(b.isReplaceable(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ)) {
|
||||
if(getAirCount(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ) == 0) {
|
||||
world.setBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, ModBlocks.vacuum);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
world.setBlockToAir(x, y, z);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isAirBlock(Block b) {
|
||||
|
||||
if(b == this)
|
||||
return false;
|
||||
|
||||
return b.getMaterial() == Material.air ||
|
||||
b.getBlockBoundsMinX() > 0 || b.getBlockBoundsMinY() > 0 || b.getBlockBoundsMinZ() > 0 ||
|
||||
b.getBlockBoundsMaxX() < 1 || b.getBlockBoundsMaxY() < 1 || b.getBlockBoundsMaxZ() < 1;
|
||||
}
|
||||
|
||||
private int getAirCount(World world, int x, int y, int z) {
|
||||
|
||||
int air = 0;
|
||||
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
|
||||
Block b = world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
|
||||
|
||||
if(isAirBlock(b))
|
||||
air++;
|
||||
}
|
||||
|
||||
return air;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
|
||||
|
||||
if(!(entity instanceof EntityLivingBase))
|
||||
return;
|
||||
|
||||
entity.attackEntityFrom(ModDamageSource.vacuum, 1F);
|
||||
}
|
||||
}
|
||||
@ -101,10 +101,11 @@ public class BlockCrate extends BlockFalling {
|
||||
|
||||
// Metal Crate
|
||||
BlockCrate.addToListWithWeight(metalList, Item.getItemFromBlock(ModBlocks.machine_press), 10);
|
||||
BlockCrate.addToListWithWeight(metalList, Item.getItemFromBlock(ModBlocks.machine_difurnace_off), 9);
|
||||
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), 4);
|
||||
BlockCrate.addToListWithWeight(metalList, Item.getItemFromBlock(ModBlocks.machine_rtg_grey), 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);
|
||||
|
||||
@ -60,6 +60,16 @@ public class BlockGeysir extends BlockContainer {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World p_149734_1_, int x, int y, int z, Random rand) {
|
||||
|
||||
int l = p_149734_1_.getBlockMetadata(x, y, z);
|
||||
|
||||
if(this == ModBlocks.geysir_vapor && l == 1) {
|
||||
float f = x + 0.5F;
|
||||
float f1 = y + 1.0F;
|
||||
float f2 = z + 0.5F;
|
||||
|
||||
p_149734_1_.spawnParticle("cloud", f, f1, f2, 0.0D, 0.1D, 0.0D);
|
||||
}
|
||||
|
||||
if(this == ModBlocks.geysir_nether) {
|
||||
p_149734_1_.spawnParticle("flame", x + 0.5F, y + 1.0625F, z + 0.5F, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@ import com.hbm.blocks.IBlockSideRotation;
|
||||
import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.config.ServerConfig;
|
||||
import com.hbm.config.StructureConfig;
|
||||
import com.hbm.interfaces.IBomb;
|
||||
import com.hbm.interfaces.ICopiable;
|
||||
import com.hbm.lib.RefStrings;
|
||||
@ -116,7 +116,6 @@ public class BlockWandLogic extends BlockContainer implements ILookOverlay, IToo
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return super.onBlockActivated(world, x, y, z, player, side, fX, fY, fZ);
|
||||
}
|
||||
@ -219,7 +218,7 @@ public class BlockWandLogic extends BlockContainer implements ILookOverlay, IToo
|
||||
public int placedRotation;
|
||||
|
||||
Block disguise;
|
||||
int disguiseMeta = 0;
|
||||
int disguiseMeta = -1;
|
||||
|
||||
public String actionID = "FODDER_WAVE";
|
||||
public String conditionID = "PLAYER_CUBE_5";
|
||||
@ -238,38 +237,35 @@ public class BlockWandLogic extends BlockContainer implements ILookOverlay, IToo
|
||||
}
|
||||
|
||||
private void replace() {
|
||||
if(!worldObj.isRemote) {
|
||||
if (!(worldObj.getBlock(xCoord, yCoord, zCoord) instanceof BlockWandLogic)) {
|
||||
MainRegistry.logger.warn("Somehow the block at: " + xCoord + ", " + yCoord + ", " + zCoord + " isn't a logic block but we're doing a TE update as if it is, cancelling!");
|
||||
return;
|
||||
}
|
||||
if (!(worldObj.getBlock(xCoord, yCoord, zCoord) instanceof BlockWandLogic)) {
|
||||
MainRegistry.logger.warn("Somehow the block at: " + xCoord + ", " + yCoord + ", " + zCoord + " isn't a logic block but we're doing a TE update as if it is, cancelling!");
|
||||
return;
|
||||
}
|
||||
worldObj.setBlock(xCoord,yCoord,zCoord, ModBlocks.logic_block);
|
||||
|
||||
worldObj.setBlock(xCoord, yCoord, zCoord, disguise == null ? ModBlocks.logic_block_invis : ModBlocks.logic_block, 0, 3);
|
||||
TileEntity te = worldObj.getTileEntity(xCoord, yCoord, zCoord);
|
||||
|
||||
TileEntity te = worldObj.getTileEntity(xCoord, yCoord, zCoord);
|
||||
if(te == null || te instanceof BlockWandLoot.TileEntityWandLoot) {
|
||||
MainRegistry.logger.warn("TE for logic block set incorrectly at: " + xCoord + ", " + yCoord + ", " + zCoord + ". If you're using some sort of world generation mod, report it to the author!");
|
||||
te = ModBlocks.wand_logic.createTileEntity(worldObj, 0);
|
||||
worldObj.setTileEntity(xCoord, yCoord, zCoord, te);
|
||||
}
|
||||
|
||||
if (te == null || te instanceof BlockWandLoot.TileEntityWandLoot) {
|
||||
MainRegistry.logger.warn("TE for logic block set incorrectly at: " + xCoord + ", " + yCoord + ", " + zCoord + ". If you're using some sort of world generation mod, report it to the author!");
|
||||
te = ModBlocks.wand_logic.createTileEntity(worldObj, 0);
|
||||
worldObj.setTileEntity(xCoord, yCoord, zCoord, te);
|
||||
}
|
||||
|
||||
if (te instanceof LogicBlock.TileEntityLogicBlock) {
|
||||
LogicBlock.TileEntityLogicBlock logic = (LogicBlock.TileEntityLogicBlock) te;
|
||||
logic.actionID = actionID;
|
||||
logic.conditionID = conditionID;
|
||||
logic.interactionID = interactionID;
|
||||
logic.direction = ForgeDirection.getOrientation(placedRotation);
|
||||
logic.disguise = disguise;
|
||||
logic.disguiseMeta = disguiseMeta;
|
||||
}
|
||||
if(te instanceof LogicBlock.TileEntityLogicBlock){
|
||||
LogicBlock.TileEntityLogicBlock logic = (LogicBlock.TileEntityLogicBlock) te;
|
||||
logic.actionID = actionID;
|
||||
logic.conditionID = conditionID;
|
||||
logic.interactionID = interactionID;
|
||||
logic.direction = ForgeDirection.getOrientation(placedRotation);
|
||||
logic.disguise = disguise;
|
||||
logic.disguiseMeta = disguiseMeta;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transformTE(World world, int coordBaseMode) {
|
||||
triggerReplace = !ServerConfig.STRUCTURE_DEBUG.get();
|
||||
triggerReplace = !StructureConfig.debugStructures;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -327,7 +323,6 @@ public class BlockWandLogic extends BlockContainer implements ILookOverlay, IToo
|
||||
nbt.setString("conditionID", conditionID);
|
||||
if(interactionID != null)
|
||||
nbt.setString("interactionID", interactionID);
|
||||
nbt.setInteger("rotation", placedRotation);
|
||||
if(disguise != null){
|
||||
nbt.setString("disguise", GameRegistry.findUniqueIdentifierFor(disguise).toString());
|
||||
nbt.setInteger("disguiseMeta", disguiseMeta);
|
||||
@ -341,7 +336,6 @@ public class BlockWandLogic extends BlockContainer implements ILookOverlay, IToo
|
||||
actionID = nbt.getString("actionID");
|
||||
conditionID = nbt.getString("conditionID");
|
||||
interactionID = nbt.getString("interactionID");
|
||||
placedRotation = nbt.getInteger("disguiseMeta");
|
||||
if(nbt.hasKey("disguise")){
|
||||
disguise = Block.getBlockFromName(nbt.getString("disguise"));
|
||||
disguiseMeta = nbt.getInteger("disguiseMeta");
|
||||
|
||||
@ -9,15 +9,11 @@ import com.hbm.blocks.IBlockSideRotation;
|
||||
import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.config.ServerConfig;
|
||||
import com.hbm.interfaces.IBomb;
|
||||
import com.hbm.interfaces.ICopiable;
|
||||
import com.hbm.config.StructureConfig;
|
||||
import com.hbm.itempool.ItemPool;
|
||||
import com.hbm.items.tool.ItemLock;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import com.hbm.tileentity.machine.TileEntityLockableBase;
|
||||
import com.hbm.util.BufferUtil;
|
||||
import com.hbm.util.LootGenerator;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
@ -51,7 +47,7 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
import net.minecraftforge.common.util.FakePlayerFactory;
|
||||
|
||||
public class BlockWandLoot extends BlockContainer implements ILookOverlay, IToolable, ITooltipProvider, IBlockSideRotation, IBomb {
|
||||
public class BlockWandLoot extends BlockContainer implements ILookOverlay, IToolable, ITooltipProvider, IBlockSideRotation {
|
||||
|
||||
@SideOnly(Side.CLIENT) protected IIcon iconTop;
|
||||
|
||||
@ -114,11 +110,6 @@ public class BlockWandLoot extends BlockContainer implements ILookOverlay, ITool
|
||||
text.add("Maximum items: " + loot.maxItems);
|
||||
}
|
||||
|
||||
if(loot.lockCode != 0){
|
||||
text.add("Container will be locked");
|
||||
text.add("Lockpicking chance:" + loot.lockMod);
|
||||
}
|
||||
|
||||
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
||||
}
|
||||
|
||||
@ -157,12 +148,6 @@ public class BlockWandLoot extends BlockContainer implements ILookOverlay, ITool
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack held = player.getHeldItem();
|
||||
if(held != null && held.getItem() instanceof ItemLock){
|
||||
loot.lockMod = (float) ((ItemLock)held.getItem()).lockMod;
|
||||
loot.lockCode = ItemLock.getPins(held);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -226,23 +211,12 @@ public class BlockWandLoot extends BlockContainer implements ILookOverlay, ITool
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BombReturnCode explode(World world, int x, int y, int z) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
|
||||
if(!(te instanceof BlockWandLoot.TileEntityWandLoot)) return null;
|
||||
|
||||
((BlockWandLoot.TileEntityWandLoot) te).triggerReplace = true;
|
||||
|
||||
return BombReturnCode.TRIGGERED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityWandLoot();
|
||||
}
|
||||
|
||||
public static class TileEntityWandLoot extends TileEntityLoadedBase implements INBTTileEntityTransformable, ICopiable {
|
||||
public static class TileEntityWandLoot extends TileEntityLoadedBase implements INBTTileEntityTransformable {
|
||||
|
||||
private boolean triggerReplace;
|
||||
|
||||
@ -255,10 +229,6 @@ public class BlockWandLoot extends BlockContainer implements ILookOverlay, ITool
|
||||
|
||||
private float placedRotation;
|
||||
|
||||
private float lockMod = 0;
|
||||
private int lockCode = 0;
|
||||
private boolean cheesable = true;
|
||||
|
||||
private static final GameProfile FAKE_PROFILE = new GameProfile(UUID.fromString("839eb18c-50bc-400c-8291-9383f09763e7"), "[NTM]");
|
||||
private static FakePlayer fakePlayer;
|
||||
|
||||
@ -296,12 +266,6 @@ public class BlockWandLoot extends BlockContainer implements ILookOverlay, ITool
|
||||
worldObj.setTileEntity(xCoord, yCoord, zCoord, te);
|
||||
}
|
||||
|
||||
if(te instanceof TileEntityLockableBase && lockCode != 0){
|
||||
((TileEntityLockableBase) te).setPins(lockCode);
|
||||
((TileEntityLockableBase) te).setMod(lockMod);
|
||||
((TileEntityLockableBase) te).cheesable = lockMod != 0;
|
||||
((TileEntityLockableBase) te).lock();
|
||||
}
|
||||
if(te instanceof IInventory) {
|
||||
int count = minItems;
|
||||
if(maxItems - minItems > 0) count += worldObj.rand.nextInt(maxItems - minItems);
|
||||
@ -339,7 +303,7 @@ public class BlockWandLoot extends BlockContainer implements ILookOverlay, ITool
|
||||
|
||||
@Override
|
||||
public void transformTE(World world, int coordBaseMode) {
|
||||
triggerReplace = !ServerConfig.STRUCTURE_DEBUG.get();
|
||||
triggerReplace = !StructureConfig.debugStructures;
|
||||
placedRotation = MathHelper.wrapAngleTo180_float(placedRotation + coordBaseMode * 90);
|
||||
}
|
||||
|
||||
@ -354,10 +318,6 @@ public class BlockWandLoot extends BlockContainer implements ILookOverlay, ITool
|
||||
nbt.setString("pool", poolName);
|
||||
nbt.setFloat("rot", placedRotation);
|
||||
|
||||
nbt.setInteger("lockCode", lockCode);
|
||||
nbt.setFloat("lockMod", lockMod);
|
||||
nbt.setBoolean("cheesable", cheesable);
|
||||
|
||||
nbt.setBoolean("trigger", triggerReplace);
|
||||
}
|
||||
|
||||
@ -373,10 +333,6 @@ public class BlockWandLoot extends BlockContainer implements ILookOverlay, ITool
|
||||
|
||||
if(replaceBlock == null) replaceBlock = ModBlocks.deco_loot;
|
||||
|
||||
lockCode = nbt.getInteger("lockCode");
|
||||
lockMod = nbt.getFloat("lockMod");
|
||||
cheesable = nbt.getBoolean("cheesable");
|
||||
|
||||
triggerReplace = nbt.getBoolean("trigger");
|
||||
}
|
||||
|
||||
@ -387,11 +343,6 @@ public class BlockWandLoot extends BlockContainer implements ILookOverlay, ITool
|
||||
buf.writeInt(minItems);
|
||||
buf.writeInt(maxItems);
|
||||
BufferUtil.writeString(buf, poolName);
|
||||
|
||||
buf.writeInt(lockCode);
|
||||
buf.writeFloat(lockMod);
|
||||
buf.writeBoolean(cheesable);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -401,43 +352,8 @@ public class BlockWandLoot extends BlockContainer implements ILookOverlay, ITool
|
||||
minItems = buf.readInt();
|
||||
maxItems = buf.readInt();
|
||||
poolName = BufferUtil.readString(buf);
|
||||
|
||||
lockCode = buf.readInt();
|
||||
lockMod = buf.readFloat();
|
||||
cheesable = buf.readBoolean();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getSettings(World world, int x, int y, int z) {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
Block block = replaceBlock != null ? replaceBlock : ModBlocks.deco_loot;
|
||||
|
||||
nbt.setInteger("replaceBlock", Block.getIdFromBlock(block));
|
||||
nbt.setInteger("replaceMeta", replaceMeta);
|
||||
nbt.setInteger("minItems", minItems);
|
||||
nbt.setInteger("maxItems", maxItems);
|
||||
nbt.setString("poolName", poolName);
|
||||
|
||||
nbt.setInteger("lockCode", lockCode);
|
||||
nbt.setFloat("lockMod", lockMod);
|
||||
nbt.setBoolean("cheesable", cheesable);
|
||||
|
||||
return nbt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pasteSettings(NBTTagCompound nbt, int index, World world, EntityPlayer player, int x, int y, int z) {
|
||||
replaceBlock = Block.getBlockById(nbt.getInteger("replaceBlock"));
|
||||
replaceMeta = nbt.getInteger("replaceMeta");
|
||||
minItems = nbt.getInteger("minItems");
|
||||
maxItems = nbt.getInteger("maxItems");
|
||||
poolName = nbt.getString("poolName");
|
||||
|
||||
lockCode = nbt.getInteger("lockCode");
|
||||
lockMod = nbt.getFloat("lockMod");
|
||||
cheesable = nbt.getBoolean("cheesable");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -8,12 +8,12 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.hbm.config.ServerConfig;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import com.hbm.blocks.IBlockMulti;
|
||||
import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.config.StructureConfig;
|
||||
import com.hbm.interfaces.IControlReceiver;
|
||||
import com.hbm.inventory.gui.element.GuiFileList;
|
||||
import com.hbm.lib.RefStrings;
|
||||
@ -228,9 +228,8 @@ public class BlockWandStructure extends BlockContainer implements IBlockMulti, I
|
||||
|
||||
File structureFile = new File(structureDirectory, name + ".nbt");
|
||||
|
||||
boolean debug = !worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord);
|
||||
boolean previousDebug = ServerConfig.STRUCTURE_DEBUG.get();
|
||||
ServerConfig.STRUCTURE_DEBUG.set(debug);
|
||||
boolean previousDebug = StructureConfig.debugStructures;
|
||||
StructureConfig.debugStructures = true;
|
||||
|
||||
try {
|
||||
NBTStructure structure = new NBTStructure(structureFile);
|
||||
@ -248,7 +247,7 @@ public class BlockWandStructure extends BlockContainer implements IBlockMulti, I
|
||||
} catch (FileNotFoundException ex) {
|
||||
player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Could not load: file not found"));
|
||||
} finally {
|
||||
ServerConfig.STRUCTURE_DEBUG.set(previousDebug);
|
||||
StructureConfig.debugStructures = previousDebug;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -50,15 +50,6 @@ public class LogicBlock extends BlockContainer {
|
||||
return super.getIcon(world, x, y, z, side);
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return this != ModBlocks.logic_block_invis;
|
||||
this == ModBlocks.logic_block_invis ? -1 :
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World worldIn, int x, int y, int z, EntityPlayer player, int side, float subX, float subY, float subZ) {
|
||||
TileEntity te = worldIn.getTileEntity(x, y, z);
|
||||
@ -93,9 +84,6 @@ public class LogicBlock extends BlockContainer {
|
||||
public EntityPlayer player;
|
||||
|
||||
public ForgeDirection direction = ForgeDirection.UNKNOWN;
|
||||
|
||||
boolean disguised = false;
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
@ -122,14 +110,8 @@ public class LogicBlock extends BlockContainer {
|
||||
timer++;
|
||||
}
|
||||
}
|
||||
if(!disguised){
|
||||
markDirty();
|
||||
worldObj.markBlockForUpdate(xCoord,yCoord,zCoord);
|
||||
disguised = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
@ -174,7 +156,6 @@ public class LogicBlock extends BlockContainer {
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||
this.readFromNBT(pkt.func_148857_g());
|
||||
worldObj.markBlockForUpdate(xCoord,yCoord,zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,18 +0,0 @@
|
||||
package com.hbm.blocks.generic;
|
||||
|
||||
public class LogicBlockInvis extends LogicBlock{
|
||||
|
||||
public LogicBlockInvis() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -59,7 +59,7 @@ public class RedBarrel extends BlockDetonatable {
|
||||
} else if(this == ModBlocks.lox_barrel) {
|
||||
world.newExplosion(entity, x, y, z, 1F, false, false);
|
||||
|
||||
ExplosionThermo.freezer(world, ix, iy, iz, 7);
|
||||
ExplosionThermo.freeze(world, ix, iy, iz, 7);
|
||||
} else if(this == ModBlocks.taint_barrel) {
|
||||
world.newExplosion(entity, x, y, z, 1F, false, false);
|
||||
|
||||
|
||||
@ -47,18 +47,28 @@ public class BlockFluidBarrel extends BlockContainer implements ITooltipProvider
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
if(this == ModBlocks.barrel_corroded) return null;
|
||||
return new TileEntityBarrel(capacity);
|
||||
}
|
||||
|
||||
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
@Override public int getRenderType(){ return renderID; }
|
||||
@Override public boolean isOpaqueCube() { return false; }
|
||||
@Override public boolean renderAsNormalBlock() { return false; }
|
||||
|
||||
@Override
|
||||
public int getRenderType(){
|
||||
return renderID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
if(this == ModBlocks.barrel_corroded) return false;
|
||||
if(world.isRemote) {
|
||||
return true;
|
||||
|
||||
@ -101,8 +111,6 @@ public class BlockFluidBarrel extends BlockContainer implements ITooltipProvider
|
||||
|
||||
@Override
|
||||
public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) {
|
||||
if(this == ModBlocks.barrel_corroded) return;
|
||||
|
||||
if(!keepInventory) {
|
||||
ISidedInventory tileentityfurnace = (ISidedInventory) p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_);
|
||||
|
||||
@ -179,8 +187,12 @@ public class BlockFluidBarrel extends BlockContainer implements ITooltipProvider
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(World world, int x, int y, int z, int side) {
|
||||
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if(!(te instanceof TileEntityBarrel)) return 0;
|
||||
|
||||
if(!(te instanceof TileEntityBarrel))
|
||||
return 0;
|
||||
|
||||
TileEntityBarrel barrel = (TileEntityBarrel) te;
|
||||
return barrel.getComparatorPower();
|
||||
}
|
||||
@ -210,6 +222,13 @@ public class BlockFluidBarrel extends BlockContainer implements ITooltipProvider
|
||||
list.add(EnumChatFormatting.RED + "Leaky");
|
||||
}
|
||||
|
||||
if(this == ModBlocks.barrel_iron) {
|
||||
list.add(EnumChatFormatting.AQUA + "Capacity: 8,000mB");
|
||||
list.add(EnumChatFormatting.GREEN + "Can store hot fluids");
|
||||
list.add(EnumChatFormatting.YELLOW + "Cannot store corrosive fluids properly");
|
||||
list.add(EnumChatFormatting.YELLOW + "Cannot store antimatter");
|
||||
}
|
||||
|
||||
if(this == ModBlocks.barrel_steel) {
|
||||
list.add(EnumChatFormatting.AQUA + "Capacity: 16,000mB");
|
||||
list.add(EnumChatFormatting.GREEN + "Can store hot fluids");
|
||||
|
||||
@ -1,122 +0,0 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.IBlockMulti;
|
||||
import com.hbm.itempool.ItemPool;
|
||||
import com.hbm.itempool.ItemPoolsVendingMachine;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.main.NTMSounds;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class BlockVendingMachine extends BlockDummyable implements IBlockMulti {
|
||||
|
||||
public BlockVendingMachine() {
|
||||
super(Material.iron);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
if(meta >= 12) return new TileEntityVendingMachine();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override public int getSubCount() { return 2; }
|
||||
|
||||
@Override public int[] getDimensions() { return new int[] {1, 0, 0, 0, 0, 0}; }
|
||||
@Override public int getOffset() { return 0; }
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
|
||||
if(player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.coin_token) {
|
||||
player.getHeldItem().stackSize--;
|
||||
|
||||
if(world.isRemote) return true;
|
||||
|
||||
int dmg = 0;
|
||||
int meta = 0;
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
if(pos != null) {
|
||||
meta = world.getBlockMetadata(pos[0], pos[1], pos[2]);
|
||||
if(world.getBlockMetadata(pos[0], pos[1] + 1, pos[2]) >= 6) dmg = 1;
|
||||
|
||||
ItemStack toDrop = null;
|
||||
|
||||
if(dmg == 0) toDrop = ItemPool.getStack(ItemPoolsVendingMachine.POOL_SODA, world.rand);
|
||||
if(dmg == 1) toDrop = ItemPool.getStack(ItemPoolsVendingMachine.POOL_SNACKS, world.rand);
|
||||
|
||||
if(toDrop != null) {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(meta - 10);
|
||||
EntityItem item = new EntityItem(world, x + 0.5 + dir.offsetX * 0.75, pos[1] + 0.25, z + 0.5 + dir.offsetZ * 0.75, toDrop);
|
||||
world.spawnEntityInWorld(item);
|
||||
}
|
||||
|
||||
world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, NTMSounds.GUN_BOLT_OPEN, 1F, 0.75F);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {
|
||||
super.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
|
||||
if(stack.getItemDamage() % 2 == 1 && world.getBlock(x, y + 1, z) == this) {
|
||||
this.makeExtra(world, x, y + 1, z);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
int dmg = 0;
|
||||
if(pos != null) {
|
||||
if(world.getBlockMetadata(pos[0], pos[1] + 1, pos[2]) >= 6) dmg = 1;
|
||||
}
|
||||
ret.add(new ItemStack(this, 1, dmg));
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||
for(int i = 0; i < getSubCount(); ++i) list.add(new ItemStack(item, 1, i));
|
||||
}
|
||||
|
||||
public static class TileEntityVendingMachine extends TileEntity {
|
||||
|
||||
AxisAlignedBB bb = null;
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getRenderBoundingBox() {
|
||||
if(bb == null) bb = AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 2, zCoord + 1);
|
||||
return bb;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public double getMaxRenderDistanceSquared() {
|
||||
return 65536.0D;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -202,7 +202,7 @@ public abstract class FoundryCastingBase extends BlockContainer implements ICruc
|
||||
}
|
||||
|
||||
if(cast.type != null && cast.amount > 0) {
|
||||
text.add(EnumChatFormatting.YELLOW + cast.type.getLocalizedName() + ": " + cast.amount + " / " + cast.getCapacity());
|
||||
text.add(EnumChatFormatting.YELLOW + cast.type.names[0] + ": " + cast.amount + " / " + cast.getCapacity());
|
||||
}
|
||||
|
||||
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(this.getUnlocalizedName() + ".name"), 0xFF4000, 0x401000, text);
|
||||
|
||||
@ -204,7 +204,7 @@ public class FoundryOutlet extends BlockContainer implements ICrucibleAcceptor,
|
||||
List<String> text = new ArrayList();
|
||||
|
||||
if(outlet.filter != null) {
|
||||
text.add(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("foundry.filter", outlet.filter.getLocalizedName()));
|
||||
text.add(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("foundry.filter", outlet.filter.names[0]));
|
||||
}
|
||||
if(outlet.invertFilter) {
|
||||
text.add(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("foundry.invertFilter"));
|
||||
|
||||
@ -1,51 +0,0 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineBlastFurnace;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class MachineBlastFurnace extends BlockDummyable {
|
||||
|
||||
public MachineBlastFurnace() {
|
||||
super(Material.rock);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
if(meta >= 12) return new TileEntityMachineBlastFurnace();
|
||||
if(meta >= 6) return new TileEntityProxyCombo().inventory().fluid();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
return this.standardOpenBehavior(world, x, y, z, player, 0);
|
||||
}
|
||||
|
||||
@Override public int[] getDimensions() { return new int[] {6, 0, 1, 1, 1, 1}; }
|
||||
@Override public int getOffset() { return 1; }
|
||||
|
||||
@Override
|
||||
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
super.fillSpace(world, x, y, z, dir, o);
|
||||
|
||||
x -= dir.offsetX;
|
||||
z -= dir.offsetZ;
|
||||
|
||||
this.makeExtra(world, x + 1, y, z);
|
||||
this.makeExtra(world, x - 1, y, z);
|
||||
this.makeExtra(world, x, y, z + 1);
|
||||
this.makeExtra(world, x, y, z - 1);
|
||||
|
||||
this.makeExtra(world, x + dir.offsetX, y + 3, z + dir.offsetZ);
|
||||
this.makeExtra(world, x + dir.offsetX, y + 5, z + dir.offsetZ);
|
||||
|
||||
this.makeExtra(world, x, y + 6, z);
|
||||
}
|
||||
}
|
||||
@ -26,7 +26,6 @@ import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@Deprecated
|
||||
public class MachineDiFurnace extends BlockContainer {
|
||||
|
||||
private final Random rand = new Random();
|
||||
|
||||
@ -18,7 +18,6 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@Deprecated
|
||||
public class MachineDiFurnaceExtension extends BlockContainer implements IProxyController {
|
||||
|
||||
@SideOnly(Side.CLIENT) private IIcon iconTop;
|
||||
|
||||
@ -24,7 +24,6 @@ import net.minecraft.world.World;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
@Deprecated
|
||||
public class MachineDiFurnaceRTG extends BlockContainer {
|
||||
|
||||
private final Random rand = new Random();
|
||||
|
||||
@ -47,22 +47,22 @@ public class MachineFan extends BlockContainer implements IToolable, ITooltipPro
|
||||
int l = BlockPistonBase.determineOrientation(world, x, y, z, player);
|
||||
world.setBlockMetadataWithNotify(x, y, z, l, 2);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getRenderType(){
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
@ -70,49 +70,48 @@ public class MachineFan extends BlockContainer implements IToolable, ITooltipPro
|
||||
if(side == ForgeDirection.UP || side == ForgeDirection.DOWN) return meta != 0 && meta != 1;
|
||||
if(side == ForgeDirection.NORTH || side == ForgeDirection.SOUTH) return meta != 2 && meta != 3;
|
||||
if(side == ForgeDirection.EAST || side == ForgeDirection.WEST) return meta != 4 && meta != 5;
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static class TileEntityFan extends TileEntityLoadedBase {
|
||||
|
||||
public float spin;
|
||||
public float prevSpin;
|
||||
public boolean falloff = true;
|
||||
public boolean suck = false;
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
|
||||
this.prevSpin = this.spin;
|
||||
|
||||
|
||||
if(worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)) {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata());
|
||||
|
||||
|
||||
int range = 10;
|
||||
int effRange = 0;
|
||||
double push = 0.1;
|
||||
|
||||
|
||||
for(int i = 1; i <= range; i++) {
|
||||
Block block = worldObj.getBlock(xCoord + dir.offsetX * i, yCoord + dir.offsetY * i, zCoord + dir.offsetZ * i);
|
||||
boolean blowable = block instanceof IBlowable;
|
||||
|
||||
|
||||
if(block.isNormalCube() || blowable) {
|
||||
if(!worldObj.isRemote && blowable)
|
||||
((IBlowable) block).applyFan(worldObj, xCoord + dir.offsetX * i, yCoord + dir.offsetY * i, zCoord + dir.offsetZ * i, dir, i);
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
effRange = i;
|
||||
}
|
||||
|
||||
int x = dir.offsetX * effRange;
|
||||
int y = dir.offsetY * effRange;
|
||||
int z = dir.offsetZ * effRange;
|
||||
|
||||
|
||||
List<Entity> affected = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(xCoord + 0.5 + Math.min(x, 0), yCoord + 0.5 + Math.min(y, 0), zCoord + 0.5 + Math.min(z, 0), xCoord + 0.5 + Math.max(x, 0), yCoord + 0.5 + Math.max(y, 0), zCoord + 0.5 + Math.max(z, 0)).expand(0.5, 0.5, 0.5));
|
||||
|
||||
|
||||
for(Entity e : affected) {
|
||||
|
||||
double coeff = push;
|
||||
@ -121,21 +120,20 @@ public class MachineFan extends BlockContainer implements IToolable, ITooltipPro
|
||||
double dist = e.getDistance(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5);
|
||||
coeff *= 1.5 * (1 - dist / range / 2);
|
||||
}
|
||||
if(suck) coeff *= -1;
|
||||
|
||||
|
||||
e.motionX += dir.offsetX * coeff;
|
||||
e.motionY += dir.offsetY * coeff;
|
||||
e.motionZ += dir.offsetZ * coeff;
|
||||
}
|
||||
|
||||
|
||||
if(worldObj.isRemote && worldObj.rand.nextInt(30) == 0) {
|
||||
double speed = suck ? -0.2 : 0.2;
|
||||
double speed = 0.2;
|
||||
worldObj.spawnParticle("cloud", xCoord + 0.5 + dir.offsetX * 0.5, yCoord + 0.5 + dir.offsetY * 0.5, zCoord + 0.5 + dir.offsetZ * 0.5, dir.offsetX * speed, dir.offsetY * speed, dir.offsetZ * speed);
|
||||
}
|
||||
|
||||
|
||||
this.spin += 30;
|
||||
}
|
||||
|
||||
|
||||
if(this.spin >= 360) {
|
||||
this.prevSpin -= 360;
|
||||
this.spin -= 360;
|
||||
@ -145,7 +143,7 @@ public class MachineFan extends BlockContainer implements IToolable, ITooltipPro
|
||||
networkPackNT(150);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public double getMaxRenderDistanceSquared() {
|
||||
@ -156,26 +154,22 @@ public class MachineFan extends BlockContainer implements IToolable, ITooltipPro
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
this.falloff = nbt.getBoolean("falloff");
|
||||
this.suck = nbt.getBoolean("suck");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setBoolean("falloff", falloff);
|
||||
nbt.setBoolean("suck", suck);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
buf.writeBoolean(falloff);
|
||||
buf.writeBoolean(suck);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
falloff = buf.readBoolean();
|
||||
suck = buf.readBoolean();
|
||||
}
|
||||
}
|
||||
|
||||
@ -190,7 +184,7 @@ public class MachineFan extends BlockContainer implements IToolable, ITooltipPro
|
||||
if(meta == 3) world.setBlockMetadataWithNotify(x, y, z, 2, 3);
|
||||
if(meta == 4) world.setBlockMetadataWithNotify(x, y, z, 5, 3);
|
||||
if(meta == 5) world.setBlockMetadataWithNotify(x, y, z, 4, 3);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -208,24 +202,6 @@ public class MachineFan extends BlockContainer implements IToolable, ITooltipPro
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
if(tool == ToolType.DEFUSER) {
|
||||
TileEntityFan tile = (TileEntityFan) world.getTileEntity(x, y, z);
|
||||
|
||||
if(tile != null) {
|
||||
tile.suck = !tile.suck;
|
||||
tile.markDirty();
|
||||
|
||||
if(!world.isRemote) {
|
||||
PacketDispatcher.wrapper.sendTo(new PlayerInformPacket(ChatBuilder.start("").nextTranslation(this.getUnlocalizedName() + (tile.suck ? ".suckOn" : ".suckOff")).color(EnumChatFormatting.GOLD).flush(), MainRegistry.proxy.ID_FAN_MODE), (EntityPlayerMP) player);
|
||||
|
||||
world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, "random.click", 0.5F, 0.5F);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
36
src/main/java/com/hbm/blocks/machine/MachineMiniRTG.java
Normal file
36
src/main/java/com/hbm/blocks/machine/MachineMiniRTG.java
Normal file
@ -0,0 +1,36 @@
|
||||
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)
|
||||
if(this == ModBlocks.machine_rtg_grey)
|
||||
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) {
|
||||
if(this == ModBlocks.machine_rtg_grey) {
|
||||
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) {
|
||||
if (this == ModBlocks.machine_rtg_grey) {
|
||||
TileEntityMachineRTG tileentityfurnace = (TileEntityMachineRTG) p_149749_1_.getTileEntity(p_149749_2_,
|
||||
p_149749_3_, p_149749_4_);
|
||||
|
||||
|
||||
@ -27,13 +27,12 @@ import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@Deprecated
|
||||
public class MachineRtgFurnace extends BlockContainer {
|
||||
|
||||
private final Random field_149933_a = new Random();
|
||||
private final Random field_149933_a = new Random();
|
||||
private final boolean isActive;
|
||||
private static boolean keepInventory;
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
@SideOnly(Side.CLIENT)
|
||||
@ -43,7 +42,7 @@ public class MachineRtgFurnace extends BlockContainer {
|
||||
super(Material.iron);
|
||||
isActive = blockState;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
@ -51,47 +50,93 @@ public class MachineRtgFurnace extends BlockContainer {
|
||||
this.iconFront = iconRegister.registerIcon(RefStrings.MODID + (this.isActive ? ":machine_rtg_furnace_on_alt" : ":machine_rtg_furnace_off_alt"));
|
||||
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":machine_rtg_furnace_side_alt");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
return metadata == 0 && side == 3 ? this.iconFront : (side == metadata ? this.iconFront : (side == 1 ? this.iconTop : (side == 0 ? this.iconTop : this.blockIcon)));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {
|
||||
return null;
|
||||
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
|
||||
{
|
||||
return Item.getItemFromBlock(ModBlocks.machine_rtg_furnace_off);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, int x, int y, int z) {
|
||||
super.onBlockAdded(world, x, y, z);
|
||||
this.setDefaultDirection(world, x, y, z);
|
||||
}
|
||||
|
||||
|
||||
private void setDefaultDirection(World world, int x, int y, int z) {
|
||||
if(!world.isRemote)
|
||||
{
|
||||
Block block1 = world.getBlock(x, y, z - 1);
|
||||
Block block2 = world.getBlock(x, y, z + 1);
|
||||
Block block3 = world.getBlock(x - 1, y, z);
|
||||
Block block4 = world.getBlock(x + 1, y, z);
|
||||
|
||||
byte b0 = 3;
|
||||
|
||||
if(block1.func_149730_j() && !block2.func_149730_j())
|
||||
{
|
||||
b0 = 3;
|
||||
}
|
||||
if(block2.func_149730_j() && !block1.func_149730_j())
|
||||
{
|
||||
b0 = 2;
|
||||
}
|
||||
if(block3.func_149730_j() && !block4.func_149730_j())
|
||||
{
|
||||
b0 = 5;
|
||||
}
|
||||
if(block4.func_149730_j() && !block3.func_149730_j())
|
||||
{
|
||||
b0 = 4;
|
||||
}
|
||||
|
||||
world.setBlockMetadataWithNotify(x, y, z, b0, 2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
|
||||
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||
|
||||
if(i == 0) {
|
||||
|
||||
if(i == 0)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
||||
}
|
||||
if(i == 1) {
|
||||
if(i == 1)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
|
||||
}
|
||||
if(i == 2) {
|
||||
if(i == 2)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
||||
}
|
||||
if(i == 3) {
|
||||
if(i == 3)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
||||
}
|
||||
|
||||
if(itemStack.hasDisplayName()) {
|
||||
((TileEntityRtgFurnace) world.getTileEntity(x, y, z)).setCustomName(itemStack.getDisplayName());
|
||||
|
||||
if(itemStack.hasDisplayName())
|
||||
{
|
||||
((TileEntityRtgFurnace)world.getTileEntity(x, y, z)).setCustomName(itemStack.getDisplayName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@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) {
|
||||
if(world.isRemote)
|
||||
{
|
||||
return true;
|
||||
} else if(!player.isSneaking()) {
|
||||
} else if(!player.isSneaking())
|
||||
{
|
||||
TileEntityRtgFurnace entity = (TileEntityRtgFurnace) world.getTileEntity(x, y, z);
|
||||
if(entity != null) {
|
||||
if(entity != null)
|
||||
{
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z);
|
||||
}
|
||||
return true;
|
||||
@ -109,98 +154,117 @@ public class MachineRtgFurnace extends BlockContainer {
|
||||
int i = world.getBlockMetadata(x, y, z);
|
||||
TileEntity entity = world.getTileEntity(x, y, z);
|
||||
keepInventory = true;
|
||||
|
||||
if(isProcessing) {
|
||||
|
||||
if(isProcessing)
|
||||
{
|
||||
world.setBlock(x, y, z, ModBlocks.machine_rtg_furnace_on);
|
||||
} else {
|
||||
}else{
|
||||
world.setBlock(x, y, z, ModBlocks.machine_rtg_furnace_off);
|
||||
}
|
||||
|
||||
|
||||
keepInventory = false;
|
||||
world.setBlockMetadataWithNotify(x, y, z, i, 2);
|
||||
|
||||
|
||||
if(entity != null) {
|
||||
entity.validate();
|
||||
world.setTileEntity(x, y, z, entity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) {
|
||||
if(!keepInventory) {
|
||||
ISidedInventory tileentityfurnace = (ISidedInventory) p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_);
|
||||
public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_)
|
||||
{
|
||||
if (!keepInventory)
|
||||
{
|
||||
ISidedInventory tileentityfurnace = (ISidedInventory)p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_);
|
||||
|
||||
if(tileentityfurnace != null) {
|
||||
for(int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1) {
|
||||
ItemStack itemstack = tileentityfurnace.getStackInSlot(i1);
|
||||
if (tileentityfurnace != null)
|
||||
{
|
||||
for (int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1)
|
||||
{
|
||||
ItemStack itemstack = tileentityfurnace.getStackInSlot(i1);
|
||||
|
||||
if(itemstack != null) {
|
||||
float f = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
if (itemstack != null)
|
||||
{
|
||||
float f = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
while(itemstack.stackSize > 0) {
|
||||
int j1 = this.field_149933_a.nextInt(21) + 10;
|
||||
while (itemstack.stackSize > 0)
|
||||
{
|
||||
int j1 = this.field_149933_a.nextInt(21) + 10;
|
||||
|
||||
if(j1 > itemstack.stackSize) {
|
||||
j1 = itemstack.stackSize;
|
||||
}
|
||||
if (j1 > itemstack.stackSize)
|
||||
{
|
||||
j1 = itemstack.stackSize;
|
||||
}
|
||||
|
||||
itemstack.stackSize -= j1;
|
||||
EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1, p_149749_4_ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));
|
||||
itemstack.stackSize -= j1;
|
||||
EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1, p_149749_4_ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));
|
||||
|
||||
if(itemstack.hasTagCompound()) {
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
if (itemstack.hasTagCompound())
|
||||
{
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float) this.field_149933_a.nextGaussian() * f3;
|
||||
entityitem.motionY = (float) this.field_149933_a.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float) this.field_149933_a.nextGaussian() * f3;
|
||||
p_149749_1_.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float)this.field_149933_a.nextGaussian() * f3;
|
||||
entityitem.motionY = (float)this.field_149933_a.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float)this.field_149933_a.nextGaussian() * f3;
|
||||
p_149749_1_.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
p_149749_1_.func_147453_f(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_);
|
||||
}
|
||||
}
|
||||
|
||||
super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_);
|
||||
}
|
||||
p_149749_1_.func_147453_f(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_);
|
||||
}
|
||||
}
|
||||
|
||||
super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World p_149734_1_, int x, int y, int z, Random rand) {
|
||||
if(isActive) {
|
||||
int l = p_149734_1_.getBlockMetadata(x, y, z);
|
||||
float f = x + 0.5F;
|
||||
float f1 = y + 0.25F + rand.nextFloat() * 6.0F / 16.0F;
|
||||
float f2 = z + 0.5F;
|
||||
float f3 = 0.52F;
|
||||
float f4 = rand.nextFloat() * 0.6F - 0.3F;
|
||||
rand.nextFloat();
|
||||
rand.nextFloat();
|
||||
public void randomDisplayTick(World p_149734_1_, int x, int y, int z, Random rand)
|
||||
{
|
||||
if (isActive)
|
||||
{
|
||||
int l = p_149734_1_.getBlockMetadata(x, y, z);
|
||||
float f = x + 0.5F;
|
||||
float f1 = y + 0.25F + rand.nextFloat() * 6.0F / 16.0F;
|
||||
float f2 = z + 0.5F;
|
||||
float f3 = 0.52F;
|
||||
float f4 = rand.nextFloat() * 0.6F - 0.3F;
|
||||
rand.nextFloat();
|
||||
rand.nextFloat();
|
||||
|
||||
if(l == 4) {
|
||||
p_149734_1_.spawnParticle("smoke", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
|
||||
p_149734_1_.spawnParticle("flame", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
|
||||
} else if(l == 5) {
|
||||
p_149734_1_.spawnParticle("smoke", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
|
||||
p_149734_1_.spawnParticle("flame", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
|
||||
} else if(l == 2) {
|
||||
p_149734_1_.spawnParticle("smoke", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D);
|
||||
p_149734_1_.spawnParticle("flame", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D);
|
||||
} else if(l == 3) {
|
||||
p_149734_1_.spawnParticle("smoke", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D);
|
||||
p_149734_1_.spawnParticle("flame", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (l == 4)
|
||||
{
|
||||
p_149734_1_.spawnParticle("smoke", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
|
||||
p_149734_1_.spawnParticle("flame", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
else if (l == 5)
|
||||
{
|
||||
p_149734_1_.spawnParticle("smoke", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
|
||||
p_149734_1_.spawnParticle("flame", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
else if (l == 2)
|
||||
{
|
||||
p_149734_1_.spawnParticle("smoke", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D);
|
||||
p_149734_1_.spawnParticle("flame", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
else if (l == 3)
|
||||
{
|
||||
p_149734_1_.spawnParticle("smoke", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D);
|
||||
p_149734_1_.spawnParticle("flame", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) {
|
||||
return Item.getItemFromBlock(ModBlocks.machine_rtg_furnace_off);
|
||||
}
|
||||
public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_)
|
||||
{
|
||||
return Item.getItemFromBlock(ModBlocks.machine_rtg_furnace_off);
|
||||
}
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ public class RBMKRod extends RBMKBase {
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||
if(!world.isRemote && meta >= this.offset && !RBMKDials.getMeltdownsDisabled(world)) {
|
||||
if(meta >= this.offset && !RBMKDials.getMeltdownsDisabled(world)) {
|
||||
TileEntityRBMKRod tile = (TileEntityRBMKRod) world.getTileEntity(x, y, z);
|
||||
if(tile != null && tile.explodeOnBroken) {
|
||||
if(tile.slots[0] != null && tile.slots[0].getItem() instanceof ItemRBMKRod && ItemRBMKRod.getHullHeat(tile.slots[0]) >= 1500) {
|
||||
|
||||
@ -1,26 +1,13 @@
|
||||
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.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 {
|
||||
@ -43,124 +30,4 @@ public class PneumoStorageClutter extends BlockContainer {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,12 +1,7 @@
|
||||
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;
|
||||
|
||||
@ -18,16 +13,7 @@ public class PneumoStorageMono extends BlockContainer {
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityPneumoStorageMono();
|
||||
return null;
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
@ -7,9 +7,6 @@ import com.hbm.inventory.recipes.loader.SerializableRecipe;
|
||||
import com.hbm.util.ChatBuilder;
|
||||
import com.hbm.util.DamageResistanceHandler;
|
||||
|
||||
import com.hbm.world.gen.util.LogicBlockActions;
|
||||
import com.hbm.world.gen.util.LogicBlockConditions;
|
||||
import com.hbm.world.gen.util.LogicBlockInteractions;
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
@ -37,11 +34,6 @@ public class CommandReloadRecipes extends CommandBase {
|
||||
ItemPoolConfigJSON.initialize();
|
||||
DamageResistanceHandler.init();
|
||||
|
||||
LogicBlockActions.initialize();
|
||||
LogicBlockConditions.initialize();
|
||||
LogicBlockInteractions.initialize();
|
||||
|
||||
|
||||
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "Reload complete :)"));
|
||||
} catch(Exception ex) {
|
||||
sender.addChatMessage(ChatBuilder.start("----------------------------------").color(EnumChatFormatting.GRAY).flush());
|
||||
|
||||
@ -21,7 +21,6 @@ public class ServerConfig extends RunningConfig {
|
||||
public static ConfigWrapper<Boolean> CRATE_KEEP_CONTENTS = new ConfigWrapper(true);
|
||||
public static ConfigWrapper<Integer> ITEM_HAZARD_DROP_TICKRATE = new ConfigWrapper(2);
|
||||
public static ConfigWrapper<Boolean> ENABLE_MKU = new ConfigWrapper(true);
|
||||
public static ConfigWrapper<Boolean> STRUCTURE_DEBUG = new ConfigWrapper(false);
|
||||
public static ConfigWrapper<Integer> AUTOCAL_MAX_CLOCK = new ConfigWrapper(20);
|
||||
|
||||
private static void initDefaults() {
|
||||
@ -36,7 +35,6 @@ public class ServerConfig extends RunningConfig {
|
||||
configMap.put("CRATE_KEEP_CONTENTS", CRATE_KEEP_CONTENTS);
|
||||
configMap.put("ITEM_HAZARD_DROP_TICKRATE", ITEM_HAZARD_DROP_TICKRATE);
|
||||
configMap.put("ENABLE_MKU", ENABLE_MKU);
|
||||
configMap.put("STRUCTURE_DEBUG", STRUCTURE_DEBUG);
|
||||
configMap.put("AUTOCAL_MAX_CLOCK", AUTOCAL_MAX_CLOCK);
|
||||
}
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ public class VersatileConfig {
|
||||
|
||||
public static int getSchrabOreChance() {
|
||||
if(GeneralConfig.enableLBSM) return GeneralConfig.schrabRate;
|
||||
return 250;
|
||||
return 100;
|
||||
}
|
||||
|
||||
public static void applyPotionSickness(EntityLivingBase entity, int duration) {
|
||||
|
||||
@ -32,6 +32,7 @@ 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;
|
||||
@ -87,6 +88,7 @@ public class WorldConfig {
|
||||
public static int dudStructure = 500;
|
||||
public static int spaceshipStructure = 1000;
|
||||
public static int barrelStructure = 5000;
|
||||
public static int geyserWater = 3000;
|
||||
public static int geyserChlorine = 3000;
|
||||
public static int geyserVapor = 250;
|
||||
public static int capsuleStructure = 100;
|
||||
@ -149,6 +151,7 @@ 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);
|
||||
@ -209,6 +212,7 @@ public class WorldConfig {
|
||||
minefreq = CommonConfig.createConfigInt(config, CATEGORY_DUNGEON, "4.14_landmineSpawn", "Spawn AP landmine on every nTH chunk", 64);
|
||||
radfreq = CommonConfig.createConfigInt(config, CATEGORY_DUNGEON, "4.15_radHotspotSpawn", "Spawn radiation hotspot on every nTH chunk", 5000);
|
||||
vaultfreq = CommonConfig.createConfigInt(config, CATEGORY_DUNGEON, "4.16_vaultSpawn", "Spawn locked safe on every nTH chunk", 2500);
|
||||
geyserWater = CommonConfig.createConfigInt(config, CATEGORY_DUNGEON, "4.17_geyserWaterSpawn", "Spawn water geyser on every nTH chunk", 3000);
|
||||
geyserChlorine = CommonConfig.createConfigInt(config, CATEGORY_DUNGEON, "4.18_geyserChlorineSpawn", "Spawn poison geyser on every nTH chunk", 3000);
|
||||
geyserVapor = CommonConfig.createConfigInt(config, CATEGORY_DUNGEON, "4.19_geyserVaporSpawn", "Spawn vapor geyser on every nTH chunk", 250);
|
||||
capsuleStructure = CommonConfig.createConfigInt(config, CATEGORY_DUNGEON, "4.21_capsuleSpawn", "Spawn landing capsule on every nTH chunk", 100);
|
||||
@ -242,6 +246,7 @@ public class WorldConfig {
|
||||
dudStructure = CommonConfig.setDefZero(dudStructure, 1000);
|
||||
spaceshipStructure = CommonConfig.setDefZero(spaceshipStructure, 1000);
|
||||
barrelStructure = CommonConfig.setDefZero(barrelStructure, 1000);
|
||||
geyserWater = CommonConfig.setDefZero(geyserWater, 1000);
|
||||
geyserChlorine = CommonConfig.setDefZero(geyserChlorine, 1000);
|
||||
geyserVapor = CommonConfig.setDefZero(geyserVapor, 1000);
|
||||
broadcaster = CommonConfig.setDefZero(broadcaster, 1000);
|
||||
|
||||
@ -36,6 +36,10 @@ public class ArmorRecipes {
|
||||
addChest( TI.ingot(), ModItems.titanium_plate);
|
||||
addLegs( TI.ingot(), ModItems.titanium_legs);
|
||||
addBoots( TI.ingot(), ModItems.titanium_boots);
|
||||
addHelmet( ALLOY.ingot(), ModItems.alloy_helmet);
|
||||
addChest( ALLOY.ingot(), ModItems.alloy_plate);
|
||||
addLegs( ALLOY.ingot(), ModItems.alloy_legs);
|
||||
addBoots( ALLOY.ingot(), ModItems.alloy_boots);
|
||||
addHelmet( CMB.ingot(), ModItems.cmb_helmet);
|
||||
addChest( CMB.ingot(), ModItems.cmb_plate);
|
||||
addLegs( CMB.ingot(), ModItems.cmb_legs);
|
||||
@ -63,10 +67,10 @@ public class ArmorRecipes {
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.t51_plate, 1), new Object[] { "MPM", "TBT", "PPP", 'M', ModItems.motor, 'P', ModItems.plate_armor_titanium, 'T', ModItems.gas_empty, 'B', ModItems.titanium_plate });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.t51_legs, 1), new Object[] { "MPM", "PBP", "P P", 'M', ModItems.motor, 'P', ModItems.plate_armor_titanium, 'B', ModItems.titanium_legs });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.t51_boots, 1), new Object[] { "P P", "PBP", 'P', ModItems.plate_armor_titanium, 'B', ModItems.titanium_boots });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.ajr_helmet, 1), new Object[] { "PPC", "PBP", "IXI", 'P', ModItems.plate_armor_ajr, 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.BASIC), 'I', ANY_PLASTIC.ingot(), 'X', ModItems.gas_mask_m65, 'B', ModItems.titanium_helmet });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.ajr_plate, 1), new Object[] { "MPM", "TBT", "PPP", 'M', ModItems.motor_desh, 'P', ModItems.plate_armor_ajr, 'T', ModItems.gas_empty, 'B', ModItems.titanium_plate });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.ajr_legs, 1), new Object[] { "MPM", "PBP", "P P", 'M', ModItems.motor_desh, 'P', ModItems.plate_armor_ajr, 'B', ModItems.titanium_legs });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.ajr_boots, 1), new Object[] { "P P", "PBP", 'P', ModItems.plate_armor_ajr, 'B', ModItems.titanium_boots });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.ajr_helmet, 1), new Object[] { "PPC", "PBP", "IXI", 'P', ModItems.plate_armor_ajr, 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.BASIC), 'I', ANY_PLASTIC.ingot(), 'X', ModItems.gas_mask_m65, 'B', ModItems.alloy_helmet });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.ajr_plate, 1), new Object[] { "MPM", "TBT", "PPP", 'M', ModItems.motor_desh, 'P', ModItems.plate_armor_ajr, 'T', ModItems.gas_empty, 'B', ModItems.alloy_plate });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.ajr_legs, 1), new Object[] { "MPM", "PBP", "P P", 'M', ModItems.motor_desh, 'P', ModItems.plate_armor_ajr, 'B', ModItems.alloy_legs });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.ajr_boots, 1), new Object[] { "P P", "PBP", 'P', ModItems.plate_armor_ajr, 'B', ModItems.alloy_boots });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.ajro_helmet, 1), new Object[] { ModItems.ajr_helmet, KEY_RED, KEY_BLACK });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.ajro_plate, 1), new Object[] { ModItems.ajr_plate, KEY_RED, KEY_BLACK });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.ajro_legs, 1), new Object[] { ModItems.ajr_legs, KEY_RED, KEY_BLACK });
|
||||
|
||||
@ -172,7 +172,7 @@ public class ConsumableRecipes {
|
||||
|
||||
//Servos
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.servo_set, 1), new Object[] { "MBM", "PBP", "MBM", 'M', ModItems.motor, 'B', STEEL.bolt(), 'P', IRON.plate() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.servo_set_desh, 1), new Object[] { "MBM", "PSP", "MBM", 'M', ModItems.motor_desh, 'B', DURA.bolt(), 'P', ModItems.plate_desh, 'S', ModItems.servo_set });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.servo_set_desh, 1), new Object[] { "MBM", "PSP", "MBM", 'M', ModItems.motor_desh, 'B', DURA.bolt(), 'P', ALLOY.plate(), 'S', ModItems.servo_set });
|
||||
|
||||
//Helmet Mods
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.attachment_mask, 1), new Object[] { "DID", "IGI", " F ", 'D', ModItems.ducttape, 'I', ANY_RUBBER.ingot(), 'G', KEY_ANYPANE, 'F', IRON.plate() });
|
||||
@ -190,7 +190,7 @@ public class ConsumableRecipes {
|
||||
|
||||
//Special Mods
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.horseshoe_magnet, 1), new Object[] { "L L", "I I", "ILI", 'L', ModItems.lodestone, 'I', IRON.ingot() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.industrial_magnet, 1), new Object[] { "SMS", " B ", "SMS", 'S', STEEL.ingot(), 'M', ModItems.horseshoe_magnet, 'B', MINGRADE.wireDense() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.industrial_magnet, 1), new Object[] { "SMS", " B ", "SMS", 'S', STEEL.ingot(), 'M', ModItems.horseshoe_magnet, 'B', ModBlocks.hadron_coil_alloy });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.heart_container, 1), new Object[] { "HAH", "ACA", "HAH", 'H', ModItems.heart_piece, 'A', AL.ingot(), 'C', ModItems.coin_creeper });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.heart_booster, 1), new Object[] { "GHG", "MCM", "GHG", 'G', GOLD.ingot(), 'H', ModItems.heart_container, 'M', ModItems.morning_glory, 'C', ModItems.coin_maskman });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.heart_fab, 1), new Object[] { "GHG", "MCM", "GHG", 'G', PO210.billet(), 'H', ModItems.heart_booster, 'M', ANY_COKE.gem(), 'C', ModItems.coin_worm });
|
||||
|
||||
@ -274,6 +274,7 @@ public class MineralRecipes {
|
||||
GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.block_schrabidium), 1), new Object[] { "###", "###", "###", '#', ModItems.ingot_schrabidium });
|
||||
GameRegistry.addRecipe(new ItemStack(ModBlocks.block_schrabidium_cluster, 1), new Object[] { "#S#", "SXS", "#S#", '#', ModItems.ingot_schrabidium, 'S', ModItems.ingot_starmetal, 'X', ModItems.ingot_schrabidate });
|
||||
GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.block_euphemium), 1), new Object[] { "###", "###", "###", '#', ModItems.ingot_euphemium });
|
||||
GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.block_advanced_alloy), 1), new Object[] { "###", "###", "###", '#', ModItems.ingot_advanced_alloy });
|
||||
GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.block_magnetized_tungsten), 1), new Object[] { "###", "###", "###", '#', ModItems.ingot_magnetized_tungsten });
|
||||
GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.block_combine_steel), 1), new Object[] { "###", "###", "###", '#', ModItems.ingot_combine_steel });
|
||||
GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.block_australium), 1), new Object[] { "###", "###", "###", '#', ModItems.ingot_australium });
|
||||
@ -323,6 +324,7 @@ public class MineralRecipes {
|
||||
GameRegistry.addRecipe(new ItemStack(ModItems.ingot_beryllium, 9), new Object[] { "#", '#', Item.getItemFromBlock(ModBlocks.block_beryllium) });
|
||||
GameRegistry.addRecipe(new ItemStack(ModItems.ingot_schrabidium, 9), new Object[] { "#", '#', Item.getItemFromBlock(ModBlocks.block_schrabidium) });
|
||||
GameRegistry.addRecipe(new ItemStack(ModItems.ingot_euphemium, 9), new Object[] { "#", '#', Item.getItemFromBlock(ModBlocks.block_euphemium) });
|
||||
GameRegistry.addRecipe(new ItemStack(ModItems.ingot_advanced_alloy, 9), new Object[] { "#", '#', Item.getItemFromBlock(ModBlocks.block_advanced_alloy) });
|
||||
GameRegistry.addRecipe(new ItemStack(ModItems.ingot_magnetized_tungsten, 9), new Object[] { "#", '#', Item.getItemFromBlock(ModBlocks.block_magnetized_tungsten) });
|
||||
GameRegistry.addRecipe(new ItemStack(ModItems.ingot_combine_steel, 9), new Object[] { "#", '#', Item.getItemFromBlock(ModBlocks.block_combine_steel) });
|
||||
GameRegistry.addRecipe(new ItemStack(ModItems.ingot_australium, 9), new Object[] { "#", '#', Item.getItemFromBlock(ModBlocks.block_australium) });
|
||||
|
||||
@ -76,6 +76,10 @@ public class PowderRecipes {
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.powder_fertilizer, 4), new Object[] { ANY_ASH.any(), P_RED.dust(), KNO.dust(), S.dust() });
|
||||
|
||||
if(GeneralConfig.enableLBSM && GeneralConfig.enableLBSMSimpleCrafting) {
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.powder_advanced_alloy, 4), new Object[] { REDSTONE.dust(), IRON.dust(), COAL.dust(), CU.dust() });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.powder_advanced_alloy, 4), new Object[] { IRON.dust(), COAL.dust(), MINGRADE.dust(), MINGRADE.dust() });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.powder_advanced_alloy, 4), new Object[] { REDSTONE.dust(), CU.dust(), STEEL.dust(), STEEL.dust() });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.powder_advanced_alloy, 2), new Object[] { MINGRADE.dust(), STEEL.dust() });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.powder_red_copper, 2), new Object[] { REDSTONE.dust(), CU.dust() });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.powder_dura_steel, 2), new Object[] { STEEL.dust(), W.dust() });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.powder_dura_steel, 2), new Object[] { STEEL.dust(), CO.dust() });
|
||||
|
||||
@ -83,6 +83,7 @@ public class SmeltingRecipes {
|
||||
GameRegistry.addSmelting(ModItems.powder_uranium, new ItemStack(ModItems.ingot_uranium), 1.0F);
|
||||
GameRegistry.addSmelting(ModItems.powder_thorium, new ItemStack(ModItems.ingot_th232), 1.0F);
|
||||
GameRegistry.addSmelting(ModItems.powder_plutonium, new ItemStack(ModItems.ingot_plutonium), 1.0F);
|
||||
GameRegistry.addSmelting(ModItems.powder_advanced_alloy, new ItemStack(ModItems.ingot_advanced_alloy), 1.0F);
|
||||
GameRegistry.addSmelting(ModItems.powder_combine_steel, new ItemStack(ModItems.ingot_combine_steel), 1.0F);
|
||||
GameRegistry.addSmelting(ModItems.powder_magnetized_tungsten, new ItemStack(ModItems.ingot_magnetized_tungsten), 1.0F);
|
||||
GameRegistry.addSmelting(ModItems.powder_red_copper, new ItemStack(ModItems.ingot_red_copper), 1.0F);
|
||||
|
||||
@ -47,6 +47,11 @@ public class ToolRecipes {
|
||||
addAxe( CO.ingot(), ModItems.cobalt_axe);
|
||||
addShovel( CO.ingot(), ModItems.cobalt_shovel);
|
||||
addHoe( CO.ingot(), ModItems.cobalt_hoe);
|
||||
addSword( ALLOY.ingot(), ModItems.alloy_sword);
|
||||
addPickaxe( ALLOY.ingot(), ModItems.alloy_pickaxe);
|
||||
addAxe( ALLOY.ingot(), ModItems.alloy_axe);
|
||||
addShovel( ALLOY.ingot(), ModItems.alloy_shovel);
|
||||
addHoe( ALLOY.ingot(), ModItems.alloy_hoe);
|
||||
addSword( CMB.ingot(), ModItems.cmb_sword);
|
||||
addPickaxe( CMB.ingot(), ModItems.cmb_pickaxe);
|
||||
addAxe( CMB.ingot(), ModItems.cmb_axe);
|
||||
@ -68,14 +73,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', BI.ingot(), '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', ModItems.ingot_bismuth, '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', BI.ingot(), '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', ModItems.ingot_bismuth, '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,14 +116,14 @@ 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', BE.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.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() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.pollution_detector, 1), new Object[] { "SFS", "SCS", " S ", 'S', STEEL.plate(), 'F', ModItems.filter_coal, 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.VACUUM_TUBE) });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.ore_density_scanner, 1), new Object[] { "VVV", "CSC", "GGG", 'V', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.VACUUM_TUBE), 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.CAPACITOR), 'S', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.CONTROLLER_CHASSIS), 'G', GOLD.plate() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.defuser, 1), new Object[] { " PS", "P P", " P ", 'P', ANY_PLASTIC.ingot(), 'S', STEEL.plate() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.coltan_tool, 1), new Object[] { "ACA", "CXC", "ACA", 'A', CU.ingot(), 'C', CINNABAR.crystal(), 'X', Items.compass });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.coltan_tool, 1), new Object[] { "ACA", "CXC", "ACA", 'A', ALLOY.ingot(), 'C', CINNABAR.crystal(), 'X', Items.compass });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.reacher, 1), new Object[] { "BIB", "P P", "B B", 'B', W.bolt(), 'I', W.ingot(), 'P', ANY_RUBBER.ingot() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.sat_designator, 1), new Object[] { "RRD", "PIC", " P", 'P', GOLD.plate(), 'R', Items.redstone, 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED), 'D', ModItems.sat_chip, 'I', GOLD.ingot() });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.sat_relay), new Object[] { ModItems.sat_chip, ModItems.ducttape, ModItems.radar_linker });
|
||||
|
||||
@ -94,12 +94,12 @@ public class WeaponRecipes {
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_lag, 1), new Object[] { "BRM", " G", 'B', ANY_RESISTANTALLOY.lightBarrel(), 'R', ANY_RESISTANTALLOY.lightReceiver(), 'M', WEAPONSTEEL.mechanism(), 'G', ANY_PLASTIC.grip() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_minigun, 1), new Object[] { "BMG", "BRE", "BGM", 'B', ANY_RESISTANTALLOY.lightBarrel(), 'M', WEAPONSTEEL.mechanism(), 'G', ANY_PLASTIC.grip(), 'R', ANY_RESISTANTALLOY.heavyReceiver(), 'E', ModItems.motor_desh });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_missile_launcher, 1), new Object[] { " CM", "BBB", "G ", 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED), 'M', WEAPONSTEEL.mechanism(), 'B', ANY_RESISTANTALLOY.heavyBarrel(), 'G', ANY_PLASTIC.grip() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_tesla_cannon, 1), new Object[] { "CCC", "BRB", "MGE", 'C', ModItems.coil_copper, 'B', ANY_RESISTANTALLOY.heavyBarrel(), 'R', ANY_RESISTANTALLOY.heavyReceiver(), 'M', WEAPONSTEEL.mechanism(), 'G', ANY_PLASTIC.grip(), 'E', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED) });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_tesla_cannon, 1), new Object[] { "CCC", "BRB", "MGE", 'C', ModItems.coil_advanced_alloy, 'B', ANY_RESISTANTALLOY.heavyBarrel(), 'R', ANY_RESISTANTALLOY.heavyReceiver(), 'M', WEAPONSTEEL.mechanism(), 'G', ANY_PLASTIC.grip(), 'E', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED) });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_laser_pistol, 1), new Object[] { "CRM", "GG ", 'C', ModItems.crystal_redstone, 'R', BIGMT.lightReceiver(), 'M', BIGMT.mechanism(), 'G', ANY_HARDPLASTIC.grip() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_laser_pistol_pew_pew, 1), new Object[] { " M ", "MPM", " M ", 'M', BIGMT.mechanism(), 'P', ModItems.gun_laser_pistol });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_stg77, 1), new Object[] { " D ", "BRS", "GGM", 'D', DictFrame.fromOne(ModItems.weapon_mod_special, EnumModSpecial.SCOPE), 'B', BIGMT.lightBarrel(), 'R', BIGMT.lightReceiver(), 'S', ANY_HARDPLASTIC.stock(), 'G', ANY_HARDPLASTIC.grip(), 'M', BIGMT.mechanism() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_fatman, 1), new Object[] { "PPP", "BSR", "G M", 'P', BIGMT.plate(), 'B', BIGMT.heavyBarrel(), 'S', BIGMT.shell(), 'R', BIGMT.heavyReceiver(), 'G', ANY_HARDPLASTIC.grip(), 'M', BIGMT.mechanism() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_tau, 1), new Object[] { " RD", "CTT", "GMS", 'D', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.BISMOID), 'C', CU.pipe(), 'T', ModItems.coil_copper_torus, 'G', ANY_HARDPLASTIC.grip(), 'R', BIGMT.lightReceiver(), 'M', BIGMT.mechanism(), 'S', ANY_HARDPLASTIC.stock() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_tau, 1), new Object[] { " RD", "CTT", "GMS", 'D', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.BISMOID), 'C', CU.pipe(), 'T', ModItems.coil_advanced_torus, 'G', ANY_HARDPLASTIC.grip(), 'R', BIGMT.lightReceiver(), 'M', BIGMT.mechanism(), 'S', ANY_HARDPLASTIC.stock() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_lasrifle, 1), new Object[] { "DLC", "BRS", "MG ", 'D', ModItems.crystal_redstone, 'L', DictFrame.fromOne(ModItems.weapon_mod_special, EnumModSpecial.SCOPE), 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.BISMOID), 'B', ANY_BISMOIDBRONZE.lightBarrel(), 'R', ANY_BISMOIDBRONZE.lightReceiver(), 'S', ANY_HARDPLASTIC.stock(), 'M', BIGMT.mechanism(), 'G', ANY_HARDPLASTIC.grip() });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.gun_double_barrel_sacred_dragon, 1), new Object[] { ModItems.gun_double_barrel, DictFrame.fromOne(ModItems.item_secret, EnumSecretType.SELENIUM_STEEL) });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_charge_thrower, 1), new Object[] { "MMM", "BBL", "GG ", 'M', GUNMETAL.mechanism(), 'B', STEEL.heavyBarrel(), 'G', STEEL.grip(), 'L', Items.leather });
|
||||
@ -277,8 +277,8 @@ public class WeaponRecipes {
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.grenade_filling, 4, EnumGrenadeFilling.PLASMA.ordinal()), new Object[] { " C ", "KWK", 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.CAPACITOR_BOARD), 'K', ModItems.cell_tritium, 'W', WEAPONSTEEL.plate() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.grenade_filling, 4, EnumGrenadeFilling.LASER.ordinal()), new Object[] { " C ", "KWK", 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ATOMIC_CLOCK), 'K', ModItems.crystal_redstone, 'W', WEAPONSTEEL.plate() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.grenade_filling, 1, EnumGrenadeFilling.NUCLEAR.ordinal()), new Object[] { " T ", "CPC", " T ", 'T', ModItems.ball_tatb, 'C', WEAPONSTEEL.plate(), 'P', PU239.nugget() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.grenade_filling, 1, EnumGrenadeFilling.NUCLEAR_DEMO.ordinal()), new Object[] { "TPT", "CPC", "TPT", 'T', ModItems.ball_tatb, 'C', ModItems.neutron_reflector, 'P', PU239.nugget() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.grenade_filling, 1, EnumGrenadeFilling.SCHRAB.ordinal()), new Object[] { "BCB", "TST", "BCB", 'B', CMB.plateCast(), 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.CONTROLLER), 'T', ModItems.ball_tatb, 'S', ModItems.cell_sas3 });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.grenade_filling, 1, EnumGrenadeFilling.NUCLEAR_DEMO.ordinal()), new Object[] { "TPT", "CPC", "TPT", 'T', ModItems.ball_tatb, 'C', WEAPONSTEEL.plate(), 'P', PU239.nugget() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.grenade_filling, 1, EnumGrenadeFilling.SCHRAB.ordinal()), new Object[] { "BCB", "TST", "BCB", 'B', ANY_BISMOIDBRONZE.plateCast(), 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.CONTROLLER), 'T', ModItems.ball_tatb, 'S', ModItems.cell_sas3 });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.grenade_extra, 1, EnumGrenadeExtra.GLUE.ordinal()), new Object[] { " P ", "PSP", " P ", 'P', Items.paper, 'S', Items.slime_ball });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.grenade_extra, 1, EnumGrenadeExtra.PROXY_FUZE.ordinal()), new Object[] { "C", "F", 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.CHIP), 'F', ModItems.safety_fuse });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.grenade_extra, 1, EnumGrenadeExtra.FRAG_SLEEVE.ordinal()), new Object[] { "BBB", " T ", "BBB", 'B', STEEL.bolt(), 'T', ModItems.ducttape });
|
||||
|
||||
@ -104,6 +104,7 @@ public class EntityMappings {
|
||||
addEntity(EntityDuchessGambit.class, "entity_duchessgambit", 1000);
|
||||
addEntity(EntityMissileEMPStrong.class, "entity_missile_emp_strong", 1000);
|
||||
addEntity(EntityEMP.class, "entity_emp_logic", 1000);
|
||||
addEntity(EntityWaterSplash.class, "entity_water_splash", 1000);
|
||||
addEntity(EntityBobmazon.class, "entity_bobmazon_delivery", 1000);
|
||||
addEntity(EntityMissileCustom.class, "entity_custom_missile", 1000);
|
||||
addEntity(EntityBalefire.class, "entity_balefire", 1000);
|
||||
|
||||
@ -1,9 +1,5 @@
|
||||
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;
|
||||
|
||||
@ -80,21 +76,6 @@ 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,7 +122,6 @@ 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,7 +160,9 @@ 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);
|
||||
canDestroy.add(ModBlocks.machine_rtg_grey);
|
||||
canDestroy.add(ModBlocks.machine_minirtg);
|
||||
canDestroy.add(ModBlocks.machine_powerrtg);
|
||||
canDestroy.add(ModBlocks.machine_cyclotron);
|
||||
canDestroy.add(Blocks.chest);
|
||||
canDestroy.add(Blocks.trapped_chest);
|
||||
|
||||
@ -58,7 +58,7 @@ public class EntityTaintCrab extends EntityCyberCrab {
|
||||
|
||||
@Override
|
||||
protected Item getDropItem() {
|
||||
return ModItems.coil_copper;
|
||||
return ModItems.coil_advanced_alloy;
|
||||
}
|
||||
|
||||
protected void dropRareDrop(int p_70600_1_) {
|
||||
|
||||
@ -15,13 +15,13 @@ public class EntityAIFireGun extends EntityAIBase {
|
||||
|
||||
private final EntityLiving host;
|
||||
|
||||
public double attackMoveSpeed = 1.0D; // how fast we move while in this state
|
||||
public double maxRange = 20; // how far our target can be before we stop shooting
|
||||
public int burstTime = 10; // maximum number of ticks in a burst (for automatic weapons)
|
||||
public int minWait = 10; // minimum number of ticks to wait between bursts/shots
|
||||
public int maxWait = 40; // maximum number of ticks to wait between bursts/shots
|
||||
public float inaccuracy = 30; // how many degrees of inaccuracy does the AI have
|
||||
public boolean randomBurst = true; //whether the burst time should be fixed or random
|
||||
private double attackMoveSpeed = 1.0D; // how fast we move while in this state
|
||||
private double maxRange = 20; // how far our target can be before we stop shooting
|
||||
private int burstTime = 10; // maximum number of ticks in a burst (for automatic weapons)
|
||||
private int minWait = 10; // minimum number of ticks to wait between bursts/shots
|
||||
private int maxWait = 40; // maximum number of ticks to wait between bursts/shots
|
||||
private float inaccuracy = 30; // how many degrees of inaccuracy does the AI have
|
||||
|
||||
// state timers
|
||||
private int attackTimer = 0;
|
||||
private FireState state = FireState.IDLE;
|
||||
@ -33,7 +33,7 @@ public class EntityAIFireGun extends EntityAIBase {
|
||||
FIRING,
|
||||
RELOADING,
|
||||
}
|
||||
|
||||
|
||||
public EntityAIFireGun(EntityLiving host) {
|
||||
this.host = host;
|
||||
}
|
||||
@ -89,8 +89,7 @@ public class EntityAIFireGun extends EntityAIBase {
|
||||
if(rec.getMagazine(stack).getAmount(stack, null) <= 0) {
|
||||
updateState(FireState.RELOADING, 20, gun, stack);
|
||||
} else if(ItemGunBaseNT.getState(stack, 0) == GunState.IDLE) {
|
||||
int time = randomBurst ? host.worldObj.rand.nextInt(burstTime) : burstTime;
|
||||
updateState(FireState.FIRING, time, gun, stack);
|
||||
updateState(FireState.FIRING, host.worldObj.rand.nextInt(burstTime), gun, stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -115,9 +114,8 @@ public class EntityAIFireGun extends EntityAIBase {
|
||||
// Turn body to face firing direction, since the gun is attached to that, not the head
|
||||
// Also apply accuracy debuff just before firing
|
||||
if(bind != null && bind != EnumKeybind.RELOAD) {
|
||||
float inacc = inaccuracy * (getYerGun().getConfig(stack, 0).getReceivers(stack)[0].getHipfireSpread(stack) * 20);
|
||||
host.rotationYawHead += (host.worldObj.rand.nextFloat() - 0.5F) * inacc;
|
||||
host.rotationPitch += (host.worldObj.rand.nextFloat() - 0.5F) * inacc;
|
||||
host.rotationYawHead += (host.worldObj.rand.nextFloat() - 0.5F) * inaccuracy;
|
||||
host.rotationPitch += (host.worldObj.rand.nextFloat() - 0.5F) * inaccuracy;
|
||||
host.rotationYaw = host.rotationYawHead;
|
||||
}
|
||||
|
||||
@ -134,5 +132,5 @@ public class EntityAIFireGun extends EntityAIBase {
|
||||
|
||||
return (ItemGunBaseNT) stack.getItem();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -5,6 +5,12 @@ 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;
|
||||
@ -19,6 +25,7 @@ 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;
|
||||
|
||||
@ -27,6 +34,7 @@ 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;
|
||||
@ -174,6 +182,29 @@ 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) {
|
||||
@ -220,7 +251,7 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
boolean hRic = rand.nextInt(100) < config.HBRC;
|
||||
boolean doesRic = config.doesRicochet && hRic;
|
||||
|
||||
if(!doesRic) {
|
||||
if(!config.isSpectral && !doesRic) {
|
||||
this.setPosition(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord);
|
||||
this.onBlockImpact(mop.blockX, mop.blockY, mop.blockZ, mop.sideHit);
|
||||
}
|
||||
@ -262,6 +293,7 @@ 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);
|
||||
|
||||
@ -272,6 +304,10 @@ 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;
|
||||
@ -344,7 +380,7 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
config.bntImpact.behaveBlockHit(this, bX, bY, bZ, sideHit);
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
if(bY > -1 && !this.inGround) this.setDead();
|
||||
if(!config.liveAfterImpact && !config.isSpectral && bY > -1 && !this.inGround) this.setDead();
|
||||
if(!config.doesPenetrate && bY == -1) this.setDead();
|
||||
}
|
||||
|
||||
@ -358,6 +394,24 @@ 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);
|
||||
@ -370,6 +424,32 @@ 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);
|
||||
@ -383,15 +463,30 @@ 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);
|
||||
}
|
||||
@ -406,6 +501,19 @@ 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
|
||||
@ -413,6 +521,11 @@ 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;
|
||||
|
||||
@ -0,0 +1,65 @@
|
||||
package com.hbm.entity.projectile;
|
||||
|
||||
import com.hbm.main.MainRegistry;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.projectile.EntityThrowable;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityWaterSplash extends EntityThrowable {
|
||||
|
||||
public EntityWaterSplash(World p_i1773_1_) {
|
||||
super(p_i1773_1_);
|
||||
}
|
||||
|
||||
public EntityWaterSplash(World p_i1774_1_, EntityLivingBase p_i1774_2_) {
|
||||
super(p_i1774_1_, p_i1774_2_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void entityInit() {
|
||||
}
|
||||
|
||||
public EntityWaterSplash(World p_i1775_1_, double p_i1775_2_, double p_i1775_4_, double p_i1775_6_) {
|
||||
super(p_i1775_1_, p_i1775_2_, p_i1775_4_, p_i1775_6_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
if(this.ticksExisted > 200) {
|
||||
this.setDead();
|
||||
}
|
||||
} else {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "waterSplash");
|
||||
data.setDouble("posX", posX);
|
||||
data.setDouble("posY", posY);
|
||||
data.setDouble("posZ", posZ);
|
||||
MainRegistry.proxy.effectNT(data);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onImpact(MovingObjectPosition p_70184_1_) {
|
||||
if(this.ticksExisted > 5) {
|
||||
worldObj.spawnParticle("splash", posX, posY, posZ, 0.0D, 0.0D, 0.0D);
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean writeToNBTOptional(NBTTagCompound nbt) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readEntityFromNBT(NBTTagCompound nbt) {
|
||||
super.readEntityFromNBT(nbt);
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
@ -42,9 +42,6 @@ public class BobmazonOfferFactory {
|
||||
//blueprints
|
||||
standard.add(new Offer(new ItemStack(ModItems.blueprint_folder, 1, 0), Requirement.ASSEMBLY, 64));
|
||||
standard.add(new Offer(new ItemStack(ModItems.blueprint_folder, 1, 1), Requirement.OIL, 256));
|
||||
//vending machines
|
||||
standard.add(new Offer(new ItemStack(ModBlocks.vending_machine, 1, 0), Requirement.CHEMICS, 64));
|
||||
standard.add(new Offer(new ItemStack(ModBlocks.vending_machine, 1, 1), Requirement.CHEMICS, 64));
|
||||
//plants
|
||||
standard.add(new Offer(new ItemStack(Blocks.sapling, 1, 3), Requirement.STEEL, 12, 9));
|
||||
standard.add(new Offer(new ItemStack(ModBlocks.plant_flower, 1, EnumFlowerType.FOXGLOVE.ordinal()), Requirement.STEEL, 16, 5));
|
||||
|
||||
@ -4,24 +4,32 @@ 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
|
||||
@ -52,16 +60,39 @@ 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;
|
||||
|
||||
@ -73,6 +104,17 @@ 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;
|
||||
@ -80,14 +122,23 @@ 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;
|
||||
@ -98,7 +149,10 @@ 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) {
|
||||
|
||||
@ -118,6 +172,37 @@ 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;
|
||||
|
||||
@ -14,31 +14,67 @@ public class GUIHandler implements IGuiHandler {
|
||||
|
||||
@Override
|
||||
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
IGUIProvider provider = this.getGUIProvider(player, world, x, y, z);
|
||||
if(provider != null) return provider.provideContainer(ID, player, world, x, y, z);
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if(tileEntity instanceof IGUIProvider) {
|
||||
return ((IGUIProvider) tileEntity).provideContainer(ID, player, world, x, y, z);
|
||||
}
|
||||
|
||||
Block block = world.getBlock(x, y, z);
|
||||
|
||||
if(block instanceof IGUIProvider) {
|
||||
return ((IGUIProvider) block).provideContainer(ID, player, world, x, y, z);
|
||||
}
|
||||
|
||||
ItemStack item = player.getHeldItem();
|
||||
|
||||
if(item != null && item.getItem() instanceof IGUIProvider) {
|
||||
return ((IGUIProvider) item.getItem()).provideContainer(ID, player, world, x, y, z);
|
||||
}
|
||||
|
||||
Entity entity = player.worldObj.getEntityByID(x);
|
||||
|
||||
if(entity != null && entity instanceof IGUIProvider) {
|
||||
return ((IGUIProvider) entity).provideContainer(ID, player, world, x, y, z);
|
||||
}
|
||||
|
||||
//notice: stop doing this, unless you absolutely have to :3
|
||||
|
||||
//notice: stop doing this completely, period :P
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
IGUIProvider provider = this.getGUIProvider(player, world, x, y, z);
|
||||
if(provider != null) return provider.provideGUI(ID, player, world, x, y, z);
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if(tileEntity instanceof IGUIProvider) {
|
||||
return ((IGUIProvider) tileEntity).provideGUI(ID, player, world, x, y, z);
|
||||
}
|
||||
|
||||
Block block = world.getBlock(x, y, z);
|
||||
|
||||
if(block instanceof IGUIProvider) {
|
||||
return ((IGUIProvider) block).provideGUI(ID, player, world, x, y, z);
|
||||
}
|
||||
|
||||
ItemStack item = player.getHeldItem();
|
||||
|
||||
if(item != null && item.getItem() instanceof IGUIProvider) {
|
||||
return ((IGUIProvider) item.getItem()).provideGUI(ID, player, world, x, y, z);
|
||||
}
|
||||
|
||||
Entity entity = player.worldObj.getEntityByID(x);
|
||||
|
||||
if(entity != null && entity instanceof IGUIProvider) {
|
||||
return ((IGUIProvider) entity).provideGUI(ID, player, world, x, y, z);
|
||||
}
|
||||
|
||||
//stop doing this unless you absolutely have to ;3
|
||||
|
||||
//stop doing this, period >:3
|
||||
return null;
|
||||
}
|
||||
|
||||
public IGUIProvider getGUIProvider(EntityPlayer player, World world, int x, int y, int z) {
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if(tileEntity instanceof IGUIProvider) return ((IGUIProvider) tileEntity);
|
||||
|
||||
Block block = world.getBlock(x, y, z);
|
||||
if(block instanceof IGUIProvider) return ((IGUIProvider) block);
|
||||
|
||||
ItemStack item = player.getHeldItem();
|
||||
if(item != null && item.getItem() instanceof IGUIProvider) return ((IGUIProvider) item.getItem());
|
||||
|
||||
Entity entity = player.worldObj.getEntityByID(x);
|
||||
if(entity != null && entity instanceof IGUIProvider) return ((IGUIProvider) entity);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,6 +23,7 @@ public class BulletConfigFactory {
|
||||
|
||||
bullet.velocity = 5.0F;
|
||||
bullet.spread = defaultSpread;
|
||||
bullet.wear = 10;
|
||||
bullet.bulletsMin = 1;
|
||||
bullet.bulletsMax = 1;
|
||||
bullet.gravity = 0D;
|
||||
@ -48,6 +49,7 @@ public class BulletConfigFactory {
|
||||
|
||||
bullet.velocity = 2.0F;
|
||||
bullet.spread = defaultSpread;
|
||||
bullet.wear = 10;
|
||||
bullet.bulletsMin = 1;
|
||||
bullet.bulletsMax = 1;
|
||||
bullet.gravity = 0.005D;
|
||||
@ -73,6 +75,7 @@ public class BulletConfigFactory {
|
||||
|
||||
bullet.velocity = 2.0F;
|
||||
bullet.spread = defaultSpread;
|
||||
bullet.wear = 10;
|
||||
bullet.bulletsMin = 1;
|
||||
bullet.bulletsMax = 1;
|
||||
bullet.gravity = 0.035D;
|
||||
|
||||
@ -33,6 +33,7 @@ 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;
|
||||
@ -84,6 +85,7 @@ 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);
|
||||
@ -101,6 +103,7 @@ 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";
|
||||
@ -116,6 +119,7 @@ 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";
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
package com.hbm.handler.nei;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.Locale;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.inventory.gui.GUIMachineArcWelder;
|
||||
import com.hbm.inventory.recipes.ArcWelderRecipes;
|
||||
import com.hbm.inventory.recipes.ArcWelderRecipes.ArcWelderRecipe;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
@ -48,11 +48,11 @@ public class ArcWelderHandler extends NEIUniversalHandler {
|
||||
}
|
||||
|
||||
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
|
||||
String duration = BobMathUtil.getShortNumber(arc.duration) + " ticks";
|
||||
String consumption = BobMathUtil.getShortNumber(arc.consumption) + "HE/t";
|
||||
int side = 164;
|
||||
fontRenderer.drawString(duration, side - fontRenderer.getStringWidth(duration), 45, 0x404040);
|
||||
fontRenderer.drawString(consumption, side - fontRenderer.getStringWidth(consumption), 57, 0x404040);
|
||||
String duration = String.format(Locale.US, "%,d", arc.duration) + " ticks";
|
||||
String consumption = String.format(Locale.US, "%,d", arc.consumption) + " HE/t";
|
||||
int side = 160;
|
||||
fontRenderer.drawString(duration, side - fontRenderer.getStringWidth(duration), 43, 0x404040);
|
||||
fontRenderer.drawString(consumption, side - fontRenderer.getStringWidth(consumption), 55, 0x404040);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,13 +0,0 @@
|
||||
package com.hbm.handler.nei;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.inventory.recipes.BlastFurnaceRecipesNT;
|
||||
|
||||
public class BlastFurnaceHandler extends NEIGenericRecipeHandler {
|
||||
|
||||
public BlastFurnaceHandler() {
|
||||
super(ModBlocks.machine_blast_furnace.getLocalizedName(), BlastFurnaceRecipesNT.INSTANCE, ModBlocks.machine_blast_furnace);
|
||||
}
|
||||
|
||||
@Override public String getRecipeID() { return "ntmBlastFurnace"; }
|
||||
}
|
||||
@ -320,10 +320,4 @@ public abstract class NEIGenericRecipeHandler extends TemplateRecipeHandler impl
|
||||
drawTexturedModalRect(74 + this.getMachineXOffset(rec.recipe), 7, 77, 87, 18, 50);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(int recipe) {
|
||||
RecipeSet rec = (RecipeSet) this.arecipes.get(recipe);
|
||||
rec.recipe.printNEIExtras();
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ public class RTGRecipeHandler extends NEIUniversalHandler {
|
||||
|
||||
public RTGRecipeHandler() {
|
||||
super("RTG", new ItemStack[] {
|
||||
new ItemStack(ModBlocks.machine_rtg),
|
||||
new ItemStack(ModBlocks.machine_rtg_grey),
|
||||
new ItemStack(ModBlocks.machine_difurnace_rtg_off)
|
||||
}, ItemRTGPellet.getRecipeMap());
|
||||
}
|
||||
|
||||
@ -183,6 +183,7 @@ public class ShredderRecipeHandler extends TemplateRecipeHandler implements ICom
|
||||
|
||||
public static ArrayList<ItemStack> getBlades() {
|
||||
ArrayList<ItemStack> fuels = new ArrayList<ItemStack>();
|
||||
fuels.add(new ItemStack(ModItems.blades_advanced_alloy));
|
||||
fuels.add(new ItemStack(ModItems.blades_steel));
|
||||
fuels.add(new ItemStack(ModItems.blades_titanium));
|
||||
fuels.add(new ItemStack(ModItems.blades_desh));
|
||||
|
||||
@ -159,6 +159,7 @@ public class OreDictManager {
|
||||
/** COPPER */
|
||||
public static final DictFrame CU = new DictFrame("Copper");
|
||||
public static final DictFrame MINGRADE = new DictFrame("Mingrade");
|
||||
public static final DictFrame ALLOY = new DictFrame("AdvancedAlloy");
|
||||
/** TUNGSTEN */
|
||||
public static final DictFrame W = new DictFrame("Tungsten");
|
||||
public static final DictFrame WC = new DictFrame("TungstenCarbide");
|
||||
@ -320,7 +321,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 DictGroup ANY_BISMOID = new DictGroup("AnyBismoid", BI, AS);
|
||||
public static final DictFrame ANY_BISMOID = new DictFrame("AnyBismoid");
|
||||
public static final DictFrame ANY_ASH = new DictFrame("Ash");
|
||||
|
||||
|
||||
@ -376,6 +377,7 @@ public class OreDictManager {
|
||||
TI .ingot(ingot_titanium) .dust(powder_titanium) .plate(plate_titanium) .block(block_titanium) .ore(ore_titanium);
|
||||
CU .ingot(ingot_copper) .dust(powder_copper) .plate(plate_copper) .block(block_copper) .ore(ore_copper, ore_gneiss_copper);
|
||||
MINGRADE .ingot(ingot_red_copper) .dust(powder_red_copper) .block(block_red_copper);
|
||||
ALLOY .ingot(ingot_advanced_alloy) .dust(powder_advanced_alloy) .plate(plate_advanced_alloy) .block(block_advanced_alloy);
|
||||
W .ingot(ingot_tungsten) .dust(powder_tungsten) .block(block_tungsten) .ore(ore_tungsten, ore_nether_tungsten) .oreNether(ore_nether_tungsten);
|
||||
WC .ingot(ingot_tungsten_carbide);
|
||||
AL .ingot(ingot_aluminium) .dust(powder_aluminium) .plate(plate_aluminium) .block(block_aluminium) .ore(ore_aluminium);
|
||||
@ -501,6 +503,7 @@ 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));
|
||||
|
||||
/*
|
||||
@ -665,7 +668,6 @@ 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;
|
||||
|
||||
@ -1,34 +0,0 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.inventory.SlotCraftingOutput;
|
||||
import com.hbm.inventory.SlotNonRetarded;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineBlastFurnace;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
public class ContainerBlastFurnace extends ContainerBase {
|
||||
|
||||
protected TileEntityMachineBlastFurnace tile;
|
||||
|
||||
public ContainerBlastFurnace(InventoryPlayer invPlayer, TileEntityMachineBlastFurnace tedf) {
|
||||
super(invPlayer, tedf);
|
||||
this.tile = tedf;
|
||||
|
||||
// Fuel
|
||||
this.addSlotToContainer(new SlotNonRetarded(tedf, 0, 80, 81));
|
||||
// Input
|
||||
this.addSlotToContainer(new SlotNonRetarded(tedf, 1, 80, 27));
|
||||
this.addSlotToContainer(new SlotNonRetarded(tedf, 2, 80, 45));
|
||||
// Output
|
||||
this.addSlotToContainer(new SlotCraftingOutput(invPlayer.player, tedf, 3, 134, 72));
|
||||
this.addSlotToContainer(new SlotCraftingOutput(invPlayer.player, tedf, 4, 134, 90));
|
||||
|
||||
this.playerInv(invPlayer, 140);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return tile.isUseableByPlayer(player);
|
||||
}
|
||||
}
|
||||
@ -3,507 +3,59 @@ package com.hbm.inventory.container;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.hbm.inventory.SlotNonRetarded;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.ContainerNBTCommsPacket;
|
||||
import com.hbm.tileentity.network.pneumatic.TileEntityPneumoStorageAccess;
|
||||
import com.hbm.util.EnumUtil;
|
||||
import com.hbm.util.InventoryUtil;
|
||||
import com.hbm.util.ItemStackUtil;
|
||||
|
||||
import api.hbm.ntl.StackCache;
|
||||
import api.hbm.ntl.StackCache.CacheSlot;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
public class ContainerPneumoStorageAccess extends Container implements ICustomPayloadReceiver {
|
||||
public class ContainerPneumoStorageAccess extends Container {
|
||||
|
||||
protected TileEntityPneumoStorageAccess access;
|
||||
protected InventoryPneumoStorageAccess inventory;
|
||||
protected EntityPlayer player;
|
||||
protected String searchString = "";
|
||||
|
||||
public static boolean detailedSearch = false;
|
||||
|
||||
/** On the server, this is used to find changes in the system and then send them to the client. On the client, this is just to keep track of all items. */
|
||||
protected LinkedHashMap<Long, CacheSlotDummy> cachedEntries = new LinkedHashMap();
|
||||
/** Server to client queue, contains NBT tags that represents deltas yet to be sent to the client */
|
||||
public LinkedList<NBTTagCompound> s2cQueue = new LinkedList();
|
||||
|
||||
public void setSorter(Comparator<CacheSlotDummy> sorter) {
|
||||
this.listingStart = 0;
|
||||
this.sorter = sorter;
|
||||
this.rebuildClientIndex();
|
||||
}
|
||||
|
||||
public void setSearchString(String search) {
|
||||
this.listingStart = 0;
|
||||
this.searchString = search.toLowerCase(Locale.US);
|
||||
this.rebuildClientIndex();
|
||||
}
|
||||
|
||||
/** Used to temporarily store the previous CacheSlot contents to calculate deltas with (i.e. detect changes) */
|
||||
public static class CacheSlotDummy {
|
||||
|
||||
public final ItemStack displayStack;
|
||||
public long stacksize;
|
||||
public final int itemId;
|
||||
public final int meta;
|
||||
public final NBTTagCompound nbt;
|
||||
|
||||
public CacheSlotDummy(ItemStack displayStack, long stacksize) {
|
||||
this.displayStack = displayStack;
|
||||
this.stacksize = stacksize;
|
||||
this.itemId = Item.getIdFromItem(displayStack.getItem());
|
||||
this.meta = displayStack.getItemDamage();
|
||||
if(displayStack.hasTagCompound()) this.nbt = (NBTTagCompound) displayStack.stackTagCompound.copy();
|
||||
else this.nbt = null;
|
||||
}
|
||||
|
||||
public CacheSlotDummy(CacheSlot original) {
|
||||
this(original.displayStack.copy(), original.stacksize);
|
||||
}
|
||||
}
|
||||
|
||||
public static final int GRID_SIZE = 6 * 8;
|
||||
public static final int DELTAS_PER_MSG = 6 * 8;
|
||||
public static final int SLOT_CLICK_ID_REFRESH = -666;
|
||||
|
||||
public int listingStart = 0;
|
||||
public int listingSize = 0;
|
||||
|
||||
public int getStackCount() {
|
||||
return listingSize;
|
||||
}
|
||||
|
||||
/** Serverside, creates a new delta for a new item stack */
|
||||
public void pushNewItem(ItemStack zeroStack, long amount) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setByte("type", (byte) DeltaType.NEW_TYPE.ordinal());
|
||||
zeroStack.writeToNBT(data);
|
||||
data.setLong("amount", amount);
|
||||
s2cQueue.add(data);
|
||||
}
|
||||
|
||||
/** Serverside, creates a new delta for an amount update */
|
||||
public void updateCount(long hash, long amount) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setByte("type", (byte) DeltaType.COUNT_CHANGE.ordinal());
|
||||
data.setLong("hash", hash);
|
||||
data.setLong("amount", amount);
|
||||
s2cQueue.add(data);
|
||||
}
|
||||
|
||||
/** Serverside, bunches up deltas into NBTTagLists and sends them, 48 (DELTAS_PER_MSG) at a time */
|
||||
public void processDeltasAndSync(EntityPlayerMP playerMP) {
|
||||
if(s2cQueue.isEmpty()) return;
|
||||
|
||||
NBTTagList list = null;
|
||||
|
||||
while(!s2cQueue.isEmpty()) {
|
||||
if(list == null) list = new NBTTagList();
|
||||
list.appendTag(s2cQueue.removeFirst());
|
||||
if(list.tagCount() >= DELTAS_PER_MSG) { bonVoyage(list, playerMP); list = null; }
|
||||
}
|
||||
|
||||
if(list != null) bonVoyage(list, playerMP);
|
||||
}
|
||||
|
||||
/** Wraps the NBTTagList into a master compound tag and sends it to the client */
|
||||
public void bonVoyage(NBTTagList list, EntityPlayerMP playerMP) {
|
||||
NBTTagCompound masterTag = new NBTTagCompound();
|
||||
masterTag.setTag("list", list);
|
||||
PacketDispatcher.wrapper.sendTo(new ContainerNBTCommsPacket(playerMP.currentWindowId, masterTag), playerMP);
|
||||
}
|
||||
|
||||
/** Compares the original access stack cache with the one we have buffered to detect changes and pushes them to the s2c sending queue */
|
||||
public void checkAndSyncCache() {
|
||||
if(this.access.cache == null || this.access.cache.hasExpired) return;
|
||||
|
||||
for(Entry<Long, CacheSlot> entry : this.access.cache.cacheSlots.entrySet()) {
|
||||
|
||||
Long hash = entry.getKey();
|
||||
if(hash == StackCache.getNullIdentity()) continue;
|
||||
|
||||
CacheSlotDummy existingCache = this.cachedEntries.get(hash);
|
||||
CacheSlot properCache = entry.getValue();
|
||||
|
||||
// if the previous entries already contain this type, check for amount change
|
||||
if(existingCache != null) {
|
||||
if(existingCache.stacksize != properCache.stacksize) {
|
||||
this.updateCount(hash, properCache.stacksize);
|
||||
existingCache.stacksize = properCache.stacksize;
|
||||
}
|
||||
// if not, add that type to our index
|
||||
} else {
|
||||
existingCache = new CacheSlotDummy(properCache);
|
||||
existingCache.stacksize = properCache.stacksize;
|
||||
this.cachedEntries.put(hash, existingCache);
|
||||
this.pushNewItem(existingCache.displayStack, existingCache.stacksize);
|
||||
}
|
||||
}
|
||||
|
||||
if(player instanceof EntityPlayerMP) processDeltasAndSync((EntityPlayerMP) this.player);
|
||||
}
|
||||
|
||||
public ContainerPneumoStorageAccess(InventoryPlayer invPlayer, TileEntityPneumoStorageAccess access) {
|
||||
this.access = access;
|
||||
this.inventory = new InventoryPneumoStorageAccess(access);
|
||||
this.player = invPlayer.player;
|
||||
|
||||
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 < 6; i++) {
|
||||
for(int j = 0; j < 8; j++) {
|
||||
this.addSlotToContainer(new SlotNonRetarded(inventory, j + i * 8, 8 + j * 18, 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 + hOffset, 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, 169 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
this.addSlotToContainer(new SlotNonRetarded(invPlayer, i, 8 + i * 18 + hOffset, 227));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack slotClick(int index, int button, int mode, EntityPlayer player) {
|
||||
if(mode == 6) return null;
|
||||
|
||||
if(index == SLOT_CLICK_ID_REFRESH) {
|
||||
this.listingStart = mode;
|
||||
this.detectAndSendChanges();
|
||||
return null;
|
||||
}
|
||||
|
||||
boolean client = player.worldObj.isRemote;
|
||||
boolean leftClick = button == 0 && mode == 0;
|
||||
boolean rightClick = button == 1 && mode == 0;
|
||||
boolean shiftClick = button == 0 && mode == 1;
|
||||
|
||||
if(index >= 0 && index < GRID_SIZE) {
|
||||
if(!client) return null;
|
||||
SlotPneumo slot = (SlotPneumo) this.getSlot(index);
|
||||
long hash = StackCache.getStackIdentity(slot.getStack());
|
||||
ItemStack held = player.inventory.getItemStack();
|
||||
long heldHash = StackCache.getStackIdentity(held);
|
||||
if(leftClick) {
|
||||
if(held != null && hash != heldHash) held = null;
|
||||
else if(held != null && hash == heldHash) {
|
||||
held.stackSize += slot.amount;
|
||||
held.stackSize = Math.min(held.stackSize, held.getMaxStackSize());
|
||||
} else if(held == null && slot.getHasStack()) {
|
||||
held = slot.getStack().copy();
|
||||
held.stackSize = (int) Math.min(slot.amount, held.getMaxStackSize());
|
||||
}
|
||||
this.player.inventory.setItemStack(held);
|
||||
sendClickToServer(ClickType.LEFT_CLICK, hash);
|
||||
return null;
|
||||
}
|
||||
if(rightClick) {
|
||||
if(held != null && hash != heldHash) held.stackSize--;
|
||||
else if(held != null && hash == heldHash) {
|
||||
held.stackSize += 1;
|
||||
held.stackSize = Math.min(held.stackSize, held.getMaxStackSize());
|
||||
} else if(held == null && slot.getHasStack()) {
|
||||
held = slot.getStack().copy();
|
||||
held.stackSize = 1;
|
||||
}
|
||||
if(held.stackSize <= 0) held = null;
|
||||
this.player.inventory.setItemStack(held);
|
||||
sendClickToServer(ClickType.RIGHT_CLICK, hash);
|
||||
return null;
|
||||
}
|
||||
if(shiftClick) { sendClickToServer(ClickType.SHIFT_CLICK, hash); return null; }
|
||||
|
||||
// shift clicking an item from the player inv to the storage
|
||||
} else if(index >= GRID_SIZE && index < this.inventorySlots.size()) {
|
||||
|
||||
Slot slot = this.getSlot(index);
|
||||
|
||||
if(shiftClick && slot.getHasStack()) {
|
||||
ItemStack stack = slot.getStack().copy();
|
||||
if(this.access.cache == null || this.access.cache.hasExpired) return null;
|
||||
StackCache cache = this.access.cache;
|
||||
int remainder = (int) cache.addItemsAndReturnQuantity(stack, stack.stackSize);
|
||||
slot.decrStackSize(stack.stackSize - remainder);
|
||||
if(remainder <= 0) slot.putStack(null);
|
||||
slot.onSlotChanged();
|
||||
detectAndSendChanges();
|
||||
return null; // technically not needed but we don't have to run 500,000 lines of code that ends up doing nothing
|
||||
}
|
||||
this.addSlotToContainer(new SlotNonRetarded(invPlayer, i, 8 + i * 18, 227));
|
||||
}
|
||||
|
||||
return super.slotClick(index, button, mode, player);
|
||||
}
|
||||
|
||||
public void sendClickToServer(ClickType type, long hash) {
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setByte("type", (byte) type.ordinal());
|
||||
data.setLong("hash", hash);
|
||||
PacketDispatcher.wrapper.sendToServer(new ContainerNBTCommsPacket(this.windowId, data));
|
||||
}
|
||||
|
||||
public long[] previousStackSizes = new long[GRID_SIZE];
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
|
||||
// skip the first 6*8 slots, i.e. all the ones visible in the access grid
|
||||
for(int i = GRID_SIZE; i < this.inventorySlots.size(); i++) {
|
||||
ItemStack stack0 = ((Slot) this.inventorySlots.get(i)).getStack();
|
||||
ItemStack stack1 = (ItemStack) this.inventoryItemStacks.get(i);
|
||||
|
||||
if(!ItemStack.areItemStacksEqual(stack1, stack0)) {
|
||||
stack1 = stack0 == null ? null : stack0.copy();
|
||||
this.inventoryItemStacks.set(i, stack1);
|
||||
|
||||
for(int j = 0; j < this.crafters.size(); ++j) {
|
||||
((ICrafting) this.crafters.get(j)).sendSlotContents(this, i, stack1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boolean isServer = !this.access.getWorldObj().isRemote;
|
||||
|
||||
if(isServer) {
|
||||
checkAndSyncCache();
|
||||
} else {
|
||||
rebuildClientIndex();
|
||||
}
|
||||
inventory.updateListing();
|
||||
this.detectAndSendChanges();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return access.getDistanceFrom(player.posX, player.posY, player.posZ) <= 15 * 15;
|
||||
}
|
||||
|
||||
/** For S2C to send deltas updating the available items */
|
||||
public static enum DeltaType {
|
||||
NEW_TYPE,
|
||||
COUNT_CHANGE;
|
||||
}
|
||||
|
||||
public static enum ClickType {
|
||||
LEFT_CLICK,
|
||||
RIGHT_CLICK,
|
||||
SHIFT_CLICK
|
||||
}
|
||||
|
||||
@Override
|
||||
public void acceptData(Side side, int windowId, NBTTagCompound data) {
|
||||
if(windowId != this.windowId) return;
|
||||
|
||||
if(side == Side.CLIENT) {
|
||||
NBTTagList list = data.getTagList("list", 10);
|
||||
|
||||
for(int i = 0; i < list.tagCount(); i++) {
|
||||
NBTTagCompound line = list.getCompoundTagAt(i);
|
||||
DeltaType type = EnumUtil.grabEnumSafely(DeltaType.class, line.getByte("type"));
|
||||
|
||||
if(type == DeltaType.NEW_TYPE) {
|
||||
ItemStack stack = ItemStack.loadItemStackFromNBT(line);
|
||||
long amount = line.getLong("amount");
|
||||
long hash = StackCache.getStackIdentity(stack);
|
||||
CacheSlotDummy dummy = new CacheSlotDummy(stack, amount);
|
||||
this.cachedEntries.put(hash, dummy);
|
||||
|
||||
} else if(type == DeltaType.COUNT_CHANGE) {
|
||||
long hash = line.getLong("hash");
|
||||
CacheSlotDummy dummy = this.cachedEntries.get(hash);
|
||||
if(dummy != null) dummy.stacksize = line.getLong("amount");
|
||||
}
|
||||
}
|
||||
|
||||
rebuildClientIndex();
|
||||
|
||||
} else {
|
||||
if(this.access.cache == null || this.access.cache.hasExpired) return;
|
||||
ClickType type = EnumUtil.grabEnumSafely(ClickType.class, data.getByte("type"));
|
||||
long hash = data.getLong("hash");
|
||||
CacheSlotDummy cache = this.cachedEntries.get(hash);
|
||||
ItemStack held = this.player.inventory.getItemStack();
|
||||
long heldHash = StackCache.getStackIdentity(held);
|
||||
|
||||
// left click
|
||||
if(type == ClickType.LEFT_CLICK || type == ClickType.RIGHT_CLICK) {
|
||||
|
||||
// if we drop an item onto a different stack, or no stack at all, deposit
|
||||
if(hash != heldHash && held != null) {
|
||||
int toDeposit = type == ClickType.LEFT_CLICK ? held.stackSize : 1;
|
||||
held.stackSize -= toDeposit;
|
||||
int leftover = (int) this.access.cache.addItemsAndReturnQuantity(held, toDeposit);
|
||||
held.stackSize += leftover;
|
||||
this.player.inventory.setItemStack(null);
|
||||
if(held.stackSize > 0) InventoryUtil.tryAddItemToInventory(player.inventory.mainInventory, held);
|
||||
detectAndSendChanges();
|
||||
return;
|
||||
}
|
||||
|
||||
// if our hand is empty or we have the same type, withdraw
|
||||
if(cache != null && (held == null || hash == heldHash)) {
|
||||
ItemStack stack = cache.displayStack.copy();
|
||||
int alreadyHeld = held == null ? 0 : held.stackSize;
|
||||
int capacity = stack.getMaxStackSize() - alreadyHeld;
|
||||
if(type == ClickType.RIGHT_CLICK && capacity > 1) capacity = 1;
|
||||
int toGrab = (int) Math.min(capacity, cache.stacksize);
|
||||
int grabbed = (int) this.access.cache.consumeItemsAndReturnQuantity(stack, toGrab);
|
||||
stack.stackSize = alreadyHeld + grabbed;
|
||||
this.player.inventory.setItemStack(stack);
|
||||
detectAndSendChanges();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(type == ClickType.SHIFT_CLICK && cache != null) {
|
||||
ItemStack stack = cache.displayStack.copy();
|
||||
int originalStacksize = (int) Math.min(stack.getMaxStackSize(), cache.stacksize);
|
||||
stack.stackSize = originalStacksize;
|
||||
ItemStack ret = InventoryUtil.tryAddItemToInventory(player.inventory.mainInventory, stack);
|
||||
int remainder = ret == null ? 0 : ret.stackSize;
|
||||
int itemsUsed = originalStacksize - remainder;
|
||||
this.access.cache.consumeItemsAndReturnQuantity(stack, itemsUsed);
|
||||
detectAndSendChanges();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void rebuildClientIndex() {
|
||||
|
||||
List<CacheSlotDummy> cacheSlots = new ArrayList(this.cachedEntries.size());
|
||||
cacheSlots.addAll(this.cachedEntries.values());
|
||||
cacheSlots.removeIf(x -> { return x.stacksize <= 0; });
|
||||
|
||||
if(this.searchString != null && !this.searchString.isEmpty()) {
|
||||
if(!detailedSearch) {
|
||||
cacheSlots.removeIf(x -> {
|
||||
return !x.displayStack.getDisplayName().toLowerCase(Locale.US).contains(searchString);
|
||||
});
|
||||
} else {
|
||||
cacheSlots.removeIf(x -> {
|
||||
boolean contains = x.displayStack.getDisplayName().toLowerCase(Locale.US).contains(searchString);
|
||||
List<String> toolTip = new ArrayList();
|
||||
if(!contains) {
|
||||
x.displayStack.getItem().addInformation(x.displayStack, MainRegistry.proxy.me(), toolTip, MainRegistry.proxy.advancedTooltips());
|
||||
for(String string : toolTip) {
|
||||
if(string.toLowerCase(Locale.US).contains(searchString)) {
|
||||
contains = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return !contains;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
listingSize = cacheSlots.size();
|
||||
Collections.sort(cacheSlots, this.sorter);
|
||||
int size = cacheSlots.size();
|
||||
|
||||
int offset = listingStart * 8;
|
||||
|
||||
for(int i = 0; i < inventory.slots.length; i++) {
|
||||
int grabIndex = offset + i;
|
||||
if(grabIndex < size) {
|
||||
CacheSlotDummy cacheSlot = cacheSlots.get(grabIndex);
|
||||
SlotPneumo slot = (SlotPneumo) this.inventorySlots.get(i);
|
||||
if(cacheSlot.displayStack != null) {
|
||||
slot.putStack(cacheSlot.displayStack.copy());
|
||||
slot.amount = cacheSlot.stacksize;
|
||||
} else {
|
||||
slot.putStack(null);
|
||||
slot.amount = 0;
|
||||
}
|
||||
} else {
|
||||
inventory.slots[i] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static final Comparator<CacheSlotDummy> SORT_BY_STACK_SIZE = new Comparator<CacheSlotDummy>() {
|
||||
@Override
|
||||
public int compare(CacheSlotDummy o1, CacheSlotDummy o2) {
|
||||
if(o1.stacksize > o2.stacksize) return -1; if(o1.stacksize < o2.stacksize) return 1;
|
||||
if(o1.itemId < o2.itemId) return -1; if(o1.itemId > o2.itemId) return 1;
|
||||
if(o1.meta < o2.meta) return -1; if(o1.meta > o2.meta) return 1;
|
||||
if(o1.nbt == null && o2.nbt != null) return -1; if(o1.nbt != null && o2.nbt == null) return 1;
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
public static final Comparator<CacheSlotDummy> SORT_BY_ID = new Comparator<CacheSlotDummy>() {
|
||||
@Override
|
||||
public int compare(CacheSlotDummy o1, CacheSlotDummy o2) {
|
||||
if(o1.itemId < o2.itemId) return -1; if(o1.itemId > o2.itemId) return 1;
|
||||
if(o1.meta < o2.meta) return -1; if(o1.meta > o2.meta) return 1;
|
||||
if(o1.stacksize > o2.stacksize) return -1; if(o1.stacksize < o2.stacksize) return 1;
|
||||
if(o1.nbt == null && o2.nbt != null) return -1; if(o1.nbt != null && o2.nbt == null) return 1;
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
public static final Comparator<CacheSlotDummy> SORT_BY_INTERNAL = new Comparator<CacheSlotDummy>() {
|
||||
@Override
|
||||
public int compare(CacheSlotDummy o1, CacheSlotDummy o2) {
|
||||
String name1 = o1.displayStack.getItem().getUnlocalizedName(o1.displayStack);
|
||||
String name2 = o2.displayStack.getItem().getUnlocalizedName(o2.displayStack);
|
||||
int compare = name1.compareToIgnoreCase(name2);
|
||||
if(compare != 0) return compare;
|
||||
return SORT_BY_ID.compare(o1, o2);
|
||||
}
|
||||
};
|
||||
|
||||
public static final Comparator<CacheSlotDummy> SORT_BY_LOCALIZED = new Comparator<CacheSlotDummy>() {
|
||||
@Override
|
||||
public int compare(CacheSlotDummy o1, CacheSlotDummy o2) {
|
||||
String name1 = o1.displayStack.getItem().getItemStackDisplayName(o1.displayStack);
|
||||
String name2 = o2.displayStack.getItem().getItemStackDisplayName(o2.displayStack);
|
||||
int compare = name1.compareToIgnoreCase(name2);
|
||||
if(compare != 0) return compare;
|
||||
return SORT_BY_ID.compare(o1, o2);
|
||||
}
|
||||
};
|
||||
|
||||
protected static Comparator<CacheSlotDummy> sorter = SORT_BY_STACK_SIZE;
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class SlotPneumo extends SlotNonRetarded {
|
||||
|
||||
public long amount;
|
||||
|
||||
public SlotPneumo(IInventory inventory, int id, int x, int y) {
|
||||
super(inventory, id, x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTakeStack(EntityPlayer player) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/** This inventory instance only exists to prepare the contents of a StackCache in such a way that we can use it in a container. */
|
||||
public static class InventoryPneumoStorageAccess implements IInventory {
|
||||
|
||||
@ -514,12 +66,42 @@ public class ContainerPneumoStorageAccess extends Container implements ICustomPa
|
||||
this.slots = new ItemStack[getSizeInventory()];
|
||||
this.cache = access.cache;
|
||||
}
|
||||
|
||||
public void updateListing() { // DEMO
|
||||
if(this.cache == null) return;
|
||||
List<CacheSlot> cacheSlots = new ArrayList(cache.cacheSlots.size());
|
||||
cacheSlots.addAll(cache.cacheSlots.values());
|
||||
cacheSlots.removeIf(x -> { return x.stacksize <= 0; });
|
||||
Collections.sort(cacheSlots, SORT_BY_STACK_SIZE);
|
||||
int size = cacheSlots.size();
|
||||
|
||||
for(int i = 0; i < slots.length; i++) {
|
||||
if(i < size) {
|
||||
CacheSlot cache = cacheSlots.get(i);
|
||||
if(cache.displayStack != null) {
|
||||
slots[i] = cache.displayStack.copy();
|
||||
ItemStackUtil.addTooltipToStack(slots[i], "x" + cache.stacksize, "in " + cache.monitors.size() + " stacks");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static final Comparator<CacheSlot> SORT_BY_STACK_SIZE = new Comparator<CacheSlot>() {
|
||||
@Override
|
||||
public int compare(CacheSlot o1, CacheSlot o2) {
|
||||
if(o1.stacksize > o2.stacksize) return 1; if(o1.stacksize < o2.stacksize) return -1;
|
||||
if(o1.itemId < o2.itemId) return 1; if(o1.itemId > o2.itemId) return -1;
|
||||
if(o1.meta < o2.meta) return 1; if(o1.meta > o2.meta) return -1;
|
||||
if(o1.nbt == null && o2.nbt != null) return 1; if(o1.nbt != null && o2.nbt == null) return -1;
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
@Override public int getSizeInventory() { return GRID_SIZE; }
|
||||
@Override public int getSizeInventory() { return 6 * 9; }
|
||||
@Override public ItemStack getStackInSlot(int slot) { return slots[slot]; }
|
||||
@Override public int getInventoryStackLimit() { return 1; }
|
||||
@Override public int getInventoryStackLimit() { return 64; }
|
||||
|
||||
@Override public ItemStack decrStackSize(int slot, int amount) { return null; }
|
||||
@Override public void setInventorySlotContents(int slot, ItemStack stack) { this.slots[slot] = stack; }
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot) {
|
||||
@ -531,11 +113,22 @@ public class ContainerPneumoStorageAccess extends Container implements ICustomPa
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slot, ItemStack stack) {
|
||||
this.slots[slot] = stack;
|
||||
}
|
||||
|
||||
@Override public String getInventoryName() { return "null"; }
|
||||
@Override public boolean hasCustomInventoryName() { return false; }
|
||||
@Override public boolean isItemValidForSlot(int slot, ItemStack stack) { return false; }
|
||||
@Override public void markDirty() { }
|
||||
|
||||
@Override
|
||||
public void markDirty() {
|
||||
|
||||
}
|
||||
|
||||
@Override public boolean isUseableByPlayer(EntityPlayer player) { return true; }
|
||||
|
||||
@Override public void openInventory() { }
|
||||
@Override public void closeInventory() { }
|
||||
}
|
||||
|
||||
@ -1,52 +0,0 @@
|
||||
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);
|
||||
}
|
||||
|
||||
TileEntityPneumoStorageMono mono = (TileEntityPneumoStorageMono) this.tile;
|
||||
if(mono.amounts[index] > 0) return null;
|
||||
|
||||
Slot slot = this.getSlot(index);
|
||||
|
||||
ItemStack ret = null;
|
||||
ItemStack held = player.inventory.getItemStack();
|
||||
|
||||
if(slot.getHasStack()) ret = slot.getStack().copy();
|
||||
slot.putStack(held);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@ -1,9 +0,0 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public interface ICustomPayloadReceiver {
|
||||
|
||||
public void acceptData(Side side, int windowsId, NBTTagCompound data);
|
||||
}
|
||||
@ -39,7 +39,6 @@ public class Fluids {
|
||||
|
||||
public static FluidType NONE;
|
||||
public static FluidType AIR;
|
||||
public static FluidType AIRBLAST;
|
||||
public static FluidType WATER;
|
||||
public static FluidType STEAM;
|
||||
public static FluidType HOTSTEAM;
|
||||
@ -157,7 +156,6 @@ public class Fluids {
|
||||
public static FluidType OIL_COKER; //heavy fractions from coking, mostly bitumen
|
||||
public static FluidType NAPHTHA_COKER; //medium fractions from coking, aromatics and fuel oil
|
||||
public static FluidType GAS_COKER; //light fractions from coking, natgas and co2
|
||||
public static FluidType FLUE;
|
||||
public static FluidType EGG;
|
||||
public static FluidType CHOLESTEROL;
|
||||
public static FluidType ESTRADIOL;
|
||||
@ -239,7 +237,7 @@ public class Fluids {
|
||||
public static final FT_Polluting P_OIL = new FT_Polluting().burn(PollutionType.SOOT, SOOT_UNREFINED_OIL).release(PollutionType.POISON, POISON_OIL);
|
||||
public static final FT_Polluting P_FUEL = new FT_Polluting().burn(PollutionType.SOOT, SOOT_REFINED_OIL).release(PollutionType.POISON, POISON_OIL);
|
||||
public static final FT_Polluting P_FUEL_LEADED = new FT_Polluting().burn(PollutionType.SOOT, SOOT_REFINED_OIL).burn(PollutionType.HEAVYMETAL, LEAD_FUEL).release(PollutionType.POISON, POISON_OIL).release(PollutionType.HEAVYMETAL, LEAD_FUEL * 0.1F);
|
||||
public static final FT_Polluting P_GAS = new FT_Polluting().burn(PollutionType.SOOT, SOOT_GAS).release(PollutionType.POISON, POISON_OIL);
|
||||
public static final FT_Polluting P_GAS = new FT_Polluting().burn(PollutionType.SOOT, SOOT_GAS);
|
||||
public static final FT_Polluting P_LIQUID_GAS = new FT_Polluting().burn(PollutionType.SOOT, SOOT_GAS * 2F);
|
||||
|
||||
public static void init() {
|
||||
@ -350,7 +348,7 @@ public class Fluids {
|
||||
HEAVYOIL_VACUUM = new FluidType("HEAVYOIL_VACUUM", 0x131214, 2, 1, 0, EnumSymbol.NONE).addTraits(LIQUID, VISCOUS, P_OIL).addContainers(new CD_Canister(0x513F39));
|
||||
REFORMATE = new FluidType("REFORMATE", 0x835472, 2, 2, 0, EnumSymbol.NONE).addTraits(LIQUID, VISCOUS, P_FUEL).addContainers(new CD_Canister(0xD180D6));
|
||||
LIGHTOIL_VACUUM = new FluidType("LIGHTOIL_VACUUM", 0x8C8851, 1, 2, 0, EnumSymbol.NONE).addTraits(LIQUID, P_FUEL).addContainers(new CD_Canister(0xB46B52));
|
||||
SOURGAS = new FluidType("SOURGAS", 0xC9BE0D, 4, 4, 0, EnumSymbol.ACID).addContainers(new CD_Gastank(0xC9BE0D, 0x303030)).addTraits(GASEOUS, new FT_Corrosive(10), new FT_Poison(false, 1), new FT_Polluting().burn(PollutionType.SOOT, SOOT_GAS).release(PollutionType.POISON, POISON_EXTREME));
|
||||
SOURGAS = new FluidType("SOURGAS", 0xC9BE0D, 4, 4, 0, EnumSymbol.ACID).addContainers(new CD_Gastank(0xC9BE0D, 0x303030)).addTraits(GASEOUS, new FT_Corrosive(10), new FT_Poison(false, 1), P_GAS);
|
||||
XYLENE = new FluidType("XYLENE", 0x5C4E76, 2, 3, 0, EnumSymbol.NONE).addTraits(LIQUID, VISCOUS, P_FUEL).addContainers(new CD_Canister(0xA380D6));
|
||||
HEATINGOIL_VACUUM = new FluidType("HEATINGOIL_VACUUM", 0x211D06, 2, 2, 0, EnumSymbol.NONE).addTraits(LIQUID, VISCOUS, P_OIL).addContainers(new CD_Canister(0x694235));
|
||||
DIESEL_REFORM = new FluidType("DIESEL_REFORM", 0xCDC3C6, 1, 2, 0, EnumSymbol.NONE).addTraits(LIQUID, P_FUEL).addContainers(new CD_Canister(0xFFC500));
|
||||
@ -410,9 +408,7 @@ public class Fluids {
|
||||
ALUMINA = new FluidType("ALUMINA", 0xDDFFFF, 0, 0, 0, EnumSymbol.NONE).addTraits(LIQUID);
|
||||
AIR = new FluidType("AIR", 0xE7EAEB, 0, 0, 0, EnumSymbol.NONE).addTraits(GASEOUS);
|
||||
CONCRETE = new FluidType("CONCRETE", 0xA2A2A2, 0, 0, 0, EnumSymbol.NONE).addTraits(LIQUID);
|
||||
DHC = new FluidType("DHC", 0xD2AFFF, 0, 0, 0, EnumSymbol.NONE).addTraits(GASEOUS);
|
||||
AIRBLAST = new FluidType("AIRBLAST", 0xFFDADA, 0, 3, 0, EnumSymbol.NONE).setTemp(1_200).addTraits(GASEOUS);
|
||||
FLUE = new FluidType(155, "FLUE", 0x131313, 1, 4, 1, EnumSymbol.NONE).addContainers(new CD_Gastank(0xFF4545, 0xFFE97F)).addTraits(new FT_Flammable(10_000), GASEOUS, new FT_Polluting().burn(PollutionType.SOOT, SOOT_GAS).release(PollutionType.SOOT, SOOT_GAS * 25));
|
||||
DHC = new FluidType(153, "DHC", 0xD2AFFF, 0, 0, 0, EnumSymbol.NONE).addTraits(GASEOUS);
|
||||
|
||||
// ^ ^ ^ ^ ^ ^ ^ ^
|
||||
//ADD NEW FLUIDS HERE
|
||||
@ -431,7 +427,6 @@ public class Fluids {
|
||||
metaOrder.add(NONE);
|
||||
//vanilla
|
||||
metaOrder.add(AIR);
|
||||
metaOrder.add(AIRBLAST);
|
||||
metaOrder.add(WATER);
|
||||
metaOrder.add(HEAVYWATER);
|
||||
metaOrder.add(HEAVYWATER_HOT);
|
||||
@ -499,7 +494,6 @@ public class Fluids {
|
||||
metaOrder.add(HEATINGOIL_VACUUM);
|
||||
metaOrder.add(RECLAIMED);
|
||||
metaOrder.add(LUBRICANT);
|
||||
metaOrder.add(FLUE);
|
||||
metaOrder.add(GAS);
|
||||
metaOrder.add(GAS_COKER);
|
||||
metaOrder.add(PETROLEUM);
|
||||
@ -617,8 +611,6 @@ public class Fluids {
|
||||
.addEntry(new ToxinEffects(HazardClass.GAS_BLISTERING, true).add(new PotionEffect(Potion.wither.id, 100, 1), new PotionEffect(Potion.confusion.id, 100, 0))));
|
||||
ESTRADIOL.addTraits(new FT_Toxin().addEntry(new ToxinEffects(HazardClass.PARTICLE_FINE, false).add(new PotionEffect(HbmPotion.death.id, 60 * 60 * 20, 0))));
|
||||
REDMUD.addTraits(new FT_Toxin().addEntry(new ToxinEffects(HazardClass.GAS_BLISTERING, false).add(new PotionEffect(Potion.wither.id, 30 * 20, 2))));
|
||||
|
||||
AIR.addTraits(new FT_Heatable().setEff(HeatingType.BOILER, 1.0D).addStep(5, 1, AIRBLAST, 1));
|
||||
|
||||
double eff_steam_boil = 1.0D;
|
||||
double eff_steam_heatex = 0.25D;
|
||||
|
||||
@ -11,7 +11,6 @@ import com.hbm.inventory.FluidStack;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.gui.GuiInfoContainer;
|
||||
import com.hbm.inventory.gui.element.GUIElements;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.IItemFluidIdentifier;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
@ -248,7 +247,7 @@ public class FluidTank implements Cloneable {
|
||||
}
|
||||
|
||||
type.addInfo(list);
|
||||
GUIElements.drawHoveringTextFluid(list, mouseX, mouseY, gui.getFontRenderer(), gui.getItemRenderer(), gui.width, gui.height, this.type);
|
||||
gui.drawInfo(list.toArray(new String[0]), mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,78 +0,0 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerBlastFurnace;
|
||||
import com.hbm.inventory.gui.element.GUIElements;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineBlastFurnace;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIBlastFurnace extends GuiInfoContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_blast_furnace.png");
|
||||
private TileEntityMachineBlastFurnace furnace;
|
||||
|
||||
public GUIBlastFurnace(InventoryPlayer invPlayer, TileEntityMachineBlastFurnace tedf) {
|
||||
super(new ContainerBlastFurnace(invPlayer, tedf));
|
||||
furnace = tedf;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 222;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int x, int y, float interp) {
|
||||
super.drawScreen(x, y, interp);
|
||||
|
||||
if(this.mc.thePlayer.inventory.getItemStack() == null) {
|
||||
Slot slot = (Slot) this.inventorySlots.inventorySlots.get(0);
|
||||
if(this.isMouseOverSlot(slot, x, y) && !slot.getHasStack()) {
|
||||
List<String> bonuses = this.furnace.burnModule.getHeatDesc();
|
||||
if(!bonuses.isEmpty()) this.func_146283_a(bonuses, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
String label = "Speed: " + (int) (furnace.speed * 100) + "%";
|
||||
drawCustomInfoStat(x, y, guiLeft + 79, guiTop + 62, 18, 18, x, y, label);
|
||||
|
||||
furnace.tanks[0].renderTankInfo(this, x, y, guiLeft + 25, guiTop + 71, 18, 18);
|
||||
furnace.tanks[1].renderTankInfo(this, x, y, guiLeft + 25, guiTop + 17, 18, 18);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = this.furnace.hasCustomInventoryName() ? this.furnace.getInventoryName() : I18n.format(this.furnace.getInventoryName());
|
||||
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(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);
|
||||
|
||||
int fuel = (int) Math.round((double) furnace.fuel * 26D / (double) furnace.MAX_FUEL);
|
||||
int prog = (int) Math.round(furnace.progress * (88D - fuel));
|
||||
|
||||
drawTexturedModalRect(guiLeft + 62, guiTop + 106 - prog - fuel, 176, 102 - prog - fuel, 56, prog);
|
||||
|
||||
drawTexturedModalRect(guiLeft + 62, guiTop + 106 - fuel, 176, 128 - fuel, 56, fuel);
|
||||
|
||||
if(furnace.isProgressing) {
|
||||
drawTexturedModalRect(guiLeft + 81, guiTop + 64, 176, 0, 14, 14);
|
||||
}
|
||||
|
||||
GUIElements.drawSmoothGauge(guiLeft + 34, guiTop + 80, this.zLevel, (double) furnace.tanks[0].getFill() / (double) furnace.tanks[0].getMaxFill(), 5, 2, 1, 0x800000);
|
||||
GUIElements.drawSmoothGauge(guiLeft + 34, guiTop + 26, this.zLevel, (double) furnace.tanks[1].getFill() / (double) furnace.tanks[1].getMaxFill(), 5, 2, 1, 0x800000);
|
||||
}
|
||||
}
|
||||
@ -74,7 +74,7 @@ public class GUICraneExtractor extends GuiInfoContainer {
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = this.ejector.hasCustomInventoryName() ? this.ejector.getInventoryName() : I18n.format(this.ejector.getInventoryName());
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 26, this.ySize - 96 + 2, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -9,7 +9,6 @@ import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerCrucible;
|
||||
import com.hbm.inventory.gui.element.GUIElements;
|
||||
import com.hbm.inventory.material.Mats;
|
||||
import com.hbm.inventory.material.Mats.MaterialStack;
|
||||
import com.hbm.inventory.material.NTMMaterial.SmeltingBehavior;
|
||||
@ -53,7 +52,7 @@ public class GUICrucible extends GuiInfoContainer {
|
||||
if(guiLeft + 106 <= x && guiLeft + 106 + 18 > x && guiTop + 80 < y && guiTop + 80 + 18 >= y) {
|
||||
if(this.crucible.recipe != null && CrucibleRecipes.INSTANCE.recipeNameMap.containsKey(this.crucible.recipe)) {
|
||||
CrucibleRecipe recipe = (CrucibleRecipe) CrucibleRecipes.INSTANCE.recipeNameMap.get(this.crucible.recipe);
|
||||
GUIElements.drawHoveringTextRecipe(recipe.print(), x, y, this.fontRendererObj, itemRender, this.width, this.height);
|
||||
this.func_146283_a(recipe.print(), x, y);
|
||||
} else {
|
||||
this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("gui.recipe.setRecipe"), x, y);
|
||||
}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import com.hbm.inventory.container.ContainerFusionBreeder;
|
||||
import com.hbm.inventory.gui.element.GUIElements;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.render.util.GaugeUtil;
|
||||
import com.hbm.tileentity.machine.fusion.TileEntityFusionBreeder;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
|
||||
@ -54,7 +54,7 @@ public class GUIFusionBreeder extends GuiInfoContainer {
|
||||
double gauge = 1D - Math.pow(Math.E, -breeder.neutronEnergy * 10 / breeder.capacity);
|
||||
|
||||
// input flux
|
||||
GUIElements.drawSmoothGauge(guiLeft + 88, guiTop + 32, this.zLevel, gauge, 5, 2, 1, 0xA00000);
|
||||
GaugeUtil.drawSmoothGauge(guiLeft + 88, guiTop + 32, this.zLevel, gauge, 5, 2, 1, 0xA00000);
|
||||
|
||||
breeder.tanks[0].renderTank(guiLeft + 26, guiTop + 70, this.zLevel, 16, 52);
|
||||
breeder.tanks[1].renderTank(guiLeft + 134, guiTop + 70, this.zLevel, 16, 52);
|
||||
|
||||
@ -4,10 +4,10 @@ import org.apache.commons.lang3.math.NumberUtils;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import com.hbm.inventory.container.ContainerFusionKlystron;
|
||||
import com.hbm.inventory.gui.element.GUIElements;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toserver.NBTControlPacket;
|
||||
import com.hbm.render.util.GaugeUtil;
|
||||
import com.hbm.tileentity.machine.fusion.TileEntityFusionKlystron;
|
||||
import com.hbm.tileentity.machine.fusion.TileEntityFusionTorus;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
@ -99,11 +99,11 @@ public class GUIFusionKlystron extends GuiInfoContainer {
|
||||
else if(klystron.output > 0) drawTexturedModalRect(guiLeft + 180, guiTop + 71, 210, 0, 8, 8);
|
||||
|
||||
// output energy
|
||||
GUIElements.drawSmoothGauge(guiLeft + 52, guiTop + 80, this.zLevel, outputGauge, 5, 2, 1, 0xA00000);
|
||||
GaugeUtil.drawSmoothGauge(guiLeft + 52, guiTop + 80, this.zLevel, outputGauge, 5, 2, 1, 0xA00000);
|
||||
// air cooling
|
||||
GUIElements.drawSmoothGauge(guiLeft + 88, guiTop + 80, this.zLevel, airGauge, 5, 2, 1, 0xA00000);
|
||||
GaugeUtil.drawSmoothGauge(guiLeft + 88, guiTop + 80, this.zLevel, airGauge, 5, 2, 1, 0xA00000);
|
||||
// power consumption
|
||||
GUIElements.drawSmoothGauge(guiLeft + 124, guiTop + 80, this.zLevel, powerGauge, 5, 2, 1, 0xA00000);
|
||||
GaugeUtil.drawSmoothGauge(guiLeft + 124, guiTop + 80, this.zLevel, powerGauge, 5, 2, 1, 0xA00000);
|
||||
|
||||
this.field.drawTextBox();
|
||||
}
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import com.hbm.inventory.container.ContainerFusionTorus;
|
||||
import com.hbm.inventory.gui.element.GUIElements;
|
||||
import com.hbm.inventory.recipes.FusionRecipe;
|
||||
import com.hbm.inventory.recipes.FusionRecipes;
|
||||
import com.hbm.items.machine.ItemBlueprints;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.render.util.GaugeUtil;
|
||||
import com.hbm.tileentity.machine.fusion.TileEntityFusionTorus;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
@ -59,7 +59,7 @@ public class GUIFusionTorus extends GuiInfoContainer {
|
||||
|
||||
if(guiLeft + 43 <= mouseX && guiLeft + 43 + 18 > mouseX && guiTop + 80 < mouseY && guiTop + 80 + 18 >= mouseY) {
|
||||
if(recipe != null) {
|
||||
GUIElements.drawHoveringTextRecipe(recipe.print(), mouseX, mouseY, this.fontRendererObj, itemRender, this.width, this.height);
|
||||
this.func_146283_a(recipe.print(), mouseX, mouseY);
|
||||
} else {
|
||||
this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("gui.recipe.setRecipe"), mouseX, mouseY);
|
||||
}
|
||||
@ -131,11 +131,11 @@ public class GUIFusionTorus extends GuiInfoContainer {
|
||||
double outputGauge = recipe == null ? 0 : Math.min(((double) torus.plasmaEnergy / (double) recipe.outputTemp), 1);
|
||||
|
||||
// input energy
|
||||
GUIElements.drawSmoothGauge(guiLeft + 52, guiTop + 124, this.zLevel, inputGauge, 5, 2, 1, 0xA00000);
|
||||
GaugeUtil.drawSmoothGauge(guiLeft + 52, guiTop + 124, this.zLevel, inputGauge, 5, 2, 1, 0xA00000);
|
||||
// output genergy
|
||||
GUIElements.drawSmoothGauge(guiLeft + 88, guiTop + 124, this.zLevel, outputGauge, 5, 2, 1, 0xA00000);
|
||||
GaugeUtil.drawSmoothGauge(guiLeft + 88, guiTop + 124, this.zLevel, outputGauge, 5, 2, 1, 0xA00000);
|
||||
// fuel consumption
|
||||
GUIElements.drawSmoothGauge(guiLeft + 124, guiTop + 124, this.zLevel, torus.fuelConsumption, 5, 2, 1, 0xA00000);
|
||||
GaugeUtil.drawSmoothGauge(guiLeft + 124, guiTop + 124, this.zLevel, torus.fuelConsumption, 5, 2, 1, 0xA00000);
|
||||
|
||||
// recipe selector
|
||||
this.renderItem(recipe != null ? recipe.getIcon() : TEMPLATE_FOLDER, 44, 81);
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import com.hbm.inventory.container.ContainerICF;
|
||||
import com.hbm.inventory.gui.element.GUIElements;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.render.util.GaugeUtil;
|
||||
import com.hbm.tileentity.machine.TileEntityICF;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
|
||||
@ -54,7 +54,7 @@ public class GUIICF extends GuiInfoContainer {
|
||||
drawTexturedModalRect(guiLeft + 8, guiTop + 88 - p, 212, 192 - p, 16, p);
|
||||
}
|
||||
|
||||
GUIElements.drawSmoothGauge(guiLeft + 196, guiTop + 98, this.zLevel, (double) icf.heat / (double) icf.maxHeat, 5, 2, 1, 0xFF00AF);
|
||||
GaugeUtil.drawSmoothGauge(guiLeft + 196, guiTop + 98, this.zLevel, (double) icf.heat / (double) icf.maxHeat, 5, 2, 1, 0xFF00AF);
|
||||
|
||||
icf.tanks[0].renderTank(guiLeft + 44, guiTop + 88, this.zLevel, 16, 70);
|
||||
icf.tanks[1].renderTank(guiLeft + 188, guiTop + 88, this.zLevel, 16, 70);
|
||||
|
||||
@ -3,7 +3,6 @@ package com.hbm.inventory.gui;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerMachineAssemblyFactory;
|
||||
import com.hbm.inventory.gui.element.GUIElements;
|
||||
import com.hbm.inventory.recipes.AssemblyMachineRecipes;
|
||||
import com.hbm.inventory.recipes.loader.GenericRecipe;
|
||||
import com.hbm.items.machine.ItemBlueprints;
|
||||
@ -49,7 +48,7 @@ public class GUIMachineAssemblyFactory extends GuiInfoContainer {
|
||||
for(int i = 0; i < 4; i++) if(guiLeft + 6 + (i % 2) * 109 <= mouseX && guiLeft + 6 + (i % 2) * 109 + 18 > mouseX && guiTop + 53 + (i / 2) * 56 < mouseY && guiTop + 53 + (i / 2) * 56 + 18 >= mouseY) {
|
||||
if(this.assembler.assemblerModule[i].recipe != null && AssemblyMachineRecipes.INSTANCE.recipeNameMap.containsKey(this.assembler.assemblerModule[i].recipe)) {
|
||||
GenericRecipe recipe = (GenericRecipe) AssemblyMachineRecipes.INSTANCE.recipeNameMap.get(this.assembler.assemblerModule[i].recipe);
|
||||
GUIElements.drawHoveringTextRecipe(recipe.print(), mouseX, mouseY, this.fontRendererObj, itemRender, this.width, this.height);
|
||||
this.func_146283_a(recipe.print(), mouseX, mouseY);
|
||||
} else {
|
||||
this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("gui.recipe.setRecipe"), mouseX, mouseY);
|
||||
}
|
||||
|
||||
@ -3,7 +3,6 @@ package com.hbm.inventory.gui;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerMachineAssemblyMachine;
|
||||
import com.hbm.inventory.gui.element.GUIElements;
|
||||
import com.hbm.inventory.recipes.AssemblyMachineRecipes;
|
||||
import com.hbm.inventory.recipes.loader.GenericRecipe;
|
||||
import com.hbm.items.machine.ItemBlueprints;
|
||||
@ -44,7 +43,7 @@ public class GUIMachineAssemblyMachine extends GuiInfoContainer {
|
||||
if(guiLeft + 7 <= mouseX && guiLeft + 7 + 18 > mouseX && guiTop + 125 < mouseY && guiTop + 125 + 18 >= mouseY) {
|
||||
if(this.assembler.assemblerModule.recipe != null && AssemblyMachineRecipes.INSTANCE.recipeNameMap.containsKey(this.assembler.assemblerModule.recipe)) {
|
||||
GenericRecipe recipe = (GenericRecipe) AssemblyMachineRecipes.INSTANCE.recipeNameMap.get(this.assembler.assemblerModule.recipe);
|
||||
GUIElements.drawHoveringTextRecipe(recipe.print(), mouseX, mouseY, this.fontRendererObj, itemRender, this.width, this.height);
|
||||
this.func_146283_a(recipe.print(), mouseX, mouseY);
|
||||
} else {
|
||||
this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("gui.recipe.setRecipe"), mouseX, mouseY);
|
||||
}
|
||||
|
||||
@ -3,7 +3,6 @@ package com.hbm.inventory.gui;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerMachineChemicalFactory;
|
||||
import com.hbm.inventory.gui.element.GUIElements;
|
||||
import com.hbm.inventory.recipes.ChemicalPlantRecipes;
|
||||
import com.hbm.inventory.recipes.loader.GenericRecipe;
|
||||
import com.hbm.items.machine.ItemBlueprints;
|
||||
@ -49,7 +48,7 @@ public class GUIMachineChemicalFactory extends GuiInfoContainer {
|
||||
for(int i = 0; i < 4; i++) if(guiLeft + 74 <= mouseX && guiLeft + 74 + 18 > mouseX && guiTop + 19 + i * 22 < mouseY && guiTop + 19 + i * 22 + 18 >= mouseY) {
|
||||
if(this.chemplant.chemplantModule[i].recipe != null && ChemicalPlantRecipes.INSTANCE.recipeNameMap.containsKey(this.chemplant.chemplantModule[i].recipe)) {
|
||||
GenericRecipe recipe = (GenericRecipe) ChemicalPlantRecipes.INSTANCE.recipeNameMap.get(this.chemplant.chemplantModule[i].recipe);
|
||||
GUIElements.drawHoveringTextRecipe(recipe.print(), mouseX, mouseY, this.fontRendererObj, itemRender, this.width, this.height);
|
||||
this.func_146283_a(recipe.print(), mouseX, mouseY);
|
||||
} else {
|
||||
this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("gui.recipe.setRecipe"), mouseX, mouseY);
|
||||
}
|
||||
|
||||
@ -3,7 +3,6 @@ package com.hbm.inventory.gui;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerMachineChemicalPlant;
|
||||
import com.hbm.inventory.gui.element.GUIElements;
|
||||
import com.hbm.inventory.recipes.ChemicalPlantRecipes;
|
||||
import com.hbm.inventory.recipes.loader.GenericRecipe;
|
||||
import com.hbm.items.machine.ItemBlueprints;
|
||||
@ -45,7 +44,7 @@ public class GUIMachineChemicalPlant extends GuiInfoContainer {
|
||||
if(guiLeft + 7 <= mouseX && guiLeft + 7 + 18 > mouseX && guiTop + 125 < mouseY && guiTop + 125 + 18 >= mouseY) {
|
||||
if(this.chemplant.chemplantModule.recipe != null && ChemicalPlantRecipes.INSTANCE.recipeNameMap.containsKey(this.chemplant.chemplantModule.recipe)) {
|
||||
GenericRecipe recipe = (GenericRecipe) ChemicalPlantRecipes.INSTANCE.recipeNameMap.get(this.chemplant.chemplantModule.recipe);
|
||||
GUIElements.drawHoveringTextRecipe(recipe.print(), mouseX, mouseY, this.fontRendererObj, itemRender, this.width, this.height);
|
||||
this.func_146283_a(recipe.print(), mouseX, mouseY);
|
||||
} else {
|
||||
this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("gui.recipe.setRecipe"), mouseX, mouseY);
|
||||
}
|
||||
|
||||
@ -3,11 +3,11 @@ package com.hbm.inventory.gui;
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
|
||||
import com.hbm.render.util.GaugeUtil;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.SlotPattern;
|
||||
import com.hbm.inventory.container.ContainerMachineCustom;
|
||||
import com.hbm.inventory.gui.element.GUIElements;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.module.ModulePatternMatcher;
|
||||
@ -79,7 +79,7 @@ public class GUIMachineCustom extends GuiInfoContainer {
|
||||
}
|
||||
if(custom.maxHeat > 0) {
|
||||
drawTexturedModalRect(guiLeft + 61, guiTop + 53, 236, 0, 18, 18);
|
||||
GUIElements.drawSmoothGauge(guiLeft + 70, guiTop + 62, this.zLevel, (double) custom.heat / (double) custom.config.maxHeat, 5, 2, 1, 0x7F0000);
|
||||
GaugeUtil.drawSmoothGauge(guiLeft + 70, guiTop + 62, this.zLevel, (double) custom.heat / (double) custom.config.maxHeat, 5, 2, 1, 0x7F0000);
|
||||
}
|
||||
int p = custom.progress * 90 / custom.maxProgress;
|
||||
drawTexturedModalRect(guiLeft + 78, guiTop + 119, 192, 0, Math.min(p, 44), 16);
|
||||
|
||||
@ -3,7 +3,6 @@ package com.hbm.inventory.gui;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerMachinePUREX;
|
||||
import com.hbm.inventory.gui.element.GUIElements;
|
||||
import com.hbm.inventory.recipes.PUREXRecipes;
|
||||
import com.hbm.inventory.recipes.loader.GenericRecipe;
|
||||
import com.hbm.items.machine.ItemBlueprints;
|
||||
@ -46,7 +45,7 @@ public class GUIMachinePUREX extends GuiInfoContainer {
|
||||
if(guiLeft + 7 <= mouseX && guiLeft + 7 + 18 > mouseX && guiTop + 125 < mouseY && guiTop + 125 + 18 >= mouseY) {
|
||||
if(this.purex.purexModule.recipe != null && PUREXRecipes.INSTANCE.recipeNameMap.containsKey(this.purex.purexModule.recipe)) {
|
||||
GenericRecipe recipe = (GenericRecipe) PUREXRecipes.INSTANCE.recipeNameMap.get(this.purex.purexModule.recipe);
|
||||
GUIElements.drawHoveringTextRecipe(recipe.print(), mouseX, mouseY, this.fontRendererObj, itemRender, this.width, this.height);
|
||||
this.func_146283_a(recipe.print(), mouseX, mouseY);
|
||||
} else {
|
||||
this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("gui.recipe.setRecipe"), mouseX, mouseY);
|
||||
}
|
||||
|
||||
@ -6,12 +6,12 @@ import java.util.List;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerMachinePlasmaForge;
|
||||
import com.hbm.inventory.gui.element.GUIElements;
|
||||
import com.hbm.inventory.recipes.PlasmaForgeRecipe;
|
||||
import com.hbm.inventory.recipes.PlasmaForgeRecipes;
|
||||
import com.hbm.inventory.recipes.loader.GenericRecipe;
|
||||
import com.hbm.items.machine.ItemBlueprints;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.render.util.GaugeUtil;
|
||||
import com.hbm.tileentity.machine.fusion.TileEntityFusionPlasmaForge;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
@ -49,7 +49,7 @@ public class GUIMachinePlasmaForge extends GuiInfoContainer {
|
||||
if(guiLeft + 7 <= mouseX && guiLeft + 7 + 18 > mouseX && guiTop + 80 < mouseY && guiTop + 80 + 18 >= mouseY) {
|
||||
if(this.forge.plasmaModule.recipe != null && PlasmaForgeRecipes.INSTANCE.recipeNameMap.containsKey(this.forge.plasmaModule.recipe)) {
|
||||
GenericRecipe recipe = (GenericRecipe) PlasmaForgeRecipes.INSTANCE.recipeNameMap.get(this.forge.plasmaModule.recipe);
|
||||
GUIElements.drawHoveringTextRecipe(recipe.print(), mouseX, mouseY, this.fontRendererObj, itemRender, this.width, this.height);
|
||||
this.func_146283_a(recipe.print(), mouseX, mouseY);
|
||||
} else {
|
||||
this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("gui.recipe.setRecipe"), mouseX, mouseY);
|
||||
}
|
||||
@ -147,9 +147,9 @@ public class GUIMachinePlasmaForge extends GuiInfoContainer {
|
||||
double boosterGauge = forge.maxBooster <= 0 ? 0 : (double) forge.booster / (double) forge.maxBooster;
|
||||
|
||||
// input energy
|
||||
GUIElements.drawSmoothGauge(guiLeft + 34, guiTop + 124, this.zLevel, inputGauge, 5, 2, 1, 0xA00000);
|
||||
GaugeUtil.drawSmoothGauge(guiLeft + 34, guiTop + 124, this.zLevel, inputGauge, 5, 2, 1, 0xA00000);
|
||||
// output genergy
|
||||
GUIElements.drawSmoothGauge(guiLeft + 70, guiTop + 124, this.zLevel, boosterGauge, 5, 2, 1, 0xA00000);
|
||||
GaugeUtil.drawSmoothGauge(guiLeft + 70, guiTop + 124, this.zLevel, boosterGauge, 5, 2, 1, 0xA00000);
|
||||
|
||||
this.renderItem(recipe != null ? recipe.getIcon() : TEMPLATE_FOLDER, 8, 81);
|
||||
|
||||
|
||||
@ -3,7 +3,6 @@ package com.hbm.inventory.gui;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerMachinePrecAss;
|
||||
import com.hbm.inventory.gui.element.GUIElements;
|
||||
import com.hbm.inventory.recipes.PrecAssRecipes;
|
||||
import com.hbm.inventory.recipes.loader.GenericRecipe;
|
||||
import com.hbm.items.machine.ItemBlueprints;
|
||||
@ -44,7 +43,7 @@ public class GUIMachinePrecAss extends GuiInfoContainer {
|
||||
if(guiLeft + 7 <= mouseX && guiLeft + 7 + 18 > mouseX && guiTop + 125 < mouseY && guiTop + 125 + 18 >= mouseY) {
|
||||
if(this.assembler.assemblerModule.recipe != null && PrecAssRecipes.INSTANCE.recipeNameMap.containsKey(this.assembler.assemblerModule.recipe)) {
|
||||
GenericRecipe recipe = (GenericRecipe) PrecAssRecipes.INSTANCE.recipeNameMap.get(this.assembler.assemblerModule.recipe);
|
||||
GUIElements.drawHoveringTextRecipe(recipe.print(), mouseX, mouseY, this.fontRendererObj, itemRender, this.width, this.height);
|
||||
this.func_146283_a(recipe.print(), mouseX, mouseY);
|
||||
} else {
|
||||
this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("gui.recipe.setRecipe"), mouseX, mouseY);
|
||||
}
|
||||
|
||||
@ -3,8 +3,8 @@ package com.hbm.inventory.gui;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerMachinePress;
|
||||
import com.hbm.inventory.gui.element.GUIElements;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.render.util.GaugeUtil;
|
||||
import com.hbm.tileentity.machine.TileEntityMachinePress;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
@ -55,6 +55,6 @@ public class GUIMachinePress extends GuiInfoContainer {
|
||||
this.drawTexturedModalRect(guiLeft + 79, guiTop + 35, 14, 202, 18, k);
|
||||
|
||||
double i = (double) press.speed / (double) press.maxSpeed;
|
||||
GUIElements.drawSmoothGauge(guiLeft + 34, guiTop + 25, this.zLevel, i, 5, 2, 1, 0x7f0000);
|
||||
GaugeUtil.drawSmoothGauge(guiLeft + 34, guiTop + 25, this.zLevel, i, 5, 2, 1, 0x7f0000);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,9 +3,9 @@ package com.hbm.inventory.gui;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerMachineTurbofan;
|
||||
import com.hbm.inventory.gui.element.GUIElements;
|
||||
import com.hbm.inventory.gui.element.GUIElements.Gauge;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.render.util.GaugeUtil;
|
||||
import com.hbm.render.util.GaugeUtil.Gauge;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineTurbofan;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
@ -57,7 +57,7 @@ public class GUIMachineTurbofan extends GuiInfoContainer {
|
||||
drawTexturedModalRect(guiLeft + 98, guiTop + 44, 176, (a - 1) * 16, 16, 16);
|
||||
}
|
||||
|
||||
if(turbofan.showBlood) GUIElements.renderGauge(Gauge.ROUND_SMALL, guiLeft + 97, guiTop + 16, this.zLevel, (double) turbofan.blood.getFill() / (double) turbofan.blood.getMaxFill());
|
||||
if(turbofan.showBlood) GaugeUtil.renderGauge(Gauge.ROUND_SMALL, guiLeft + 97, guiTop + 16, this.zLevel, (double) turbofan.blood.getFill() / (double) turbofan.blood.getMaxFill());
|
||||
turbofan.tank.renderTank(guiLeft + 35, guiTop + 69, this.zLevel, 34, 52);
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,11 +7,11 @@ import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerPWR;
|
||||
import com.hbm.inventory.gui.element.GUIElements;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toserver.NBTControlPacket;
|
||||
import com.hbm.render.util.GaugeUtil;
|
||||
import com.hbm.tileentity.machine.TileEntityPWRController;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
@ -122,8 +122,8 @@ public class GUIPWR extends GuiInfoContainer {
|
||||
//GaugeUtil.renderGauge(Gauge.ROUND_SMALL, guiLeft + 115, guiTop + 31, this.zLevel, (double) controller.coreHeat / (double) controller.coreHeatCapacity);
|
||||
//GaugeUtil.renderGauge(Gauge.ROUND_SMALL, guiLeft + 151, guiTop + 31, this.zLevel, (double) controller.hullHeat / (double) controller.hullHeatCapacity);
|
||||
|
||||
GUIElements.drawSmoothGauge(guiLeft + 124, guiTop + 40, this.zLevel, (double) controller.coreHeat / (double) controller.coreHeatCapacity, 5, 2, 1, 0x7F0000);
|
||||
GUIElements.drawSmoothGauge(guiLeft + 160, guiTop + 40, this.zLevel, (double) controller.hullHeat / (double) controller.hullHeatCapacityBase, 5, 2, 1, 0x7F0000);
|
||||
GaugeUtil.drawSmoothGauge(guiLeft + 124, guiTop + 40, this.zLevel, (double) controller.coreHeat / (double) controller.coreHeatCapacity, 5, 2, 1, 0x7F0000);
|
||||
GaugeUtil.drawSmoothGauge(guiLeft + 160, guiTop + 40, this.zLevel, (double) controller.hullHeat / (double) controller.hullHeatCapacityBase, 5, 2, 1, 0x7F0000);
|
||||
|
||||
if(controller.typeLoaded != -1 && controller.amountLoaded > 0) {
|
||||
ItemStack display = new ItemStack(ModItems.pwr_fuel, 1, controller.typeLoaded);
|
||||
|
||||
@ -1,251 +1,51 @@
|
||||
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 static com.hbm.inventory.gui.element.GUIElements.*;
|
||||
import com.hbm.inventory.container.ContainerPneumoStorageAccess;
|
||||
import com.hbm.inventory.container.ContainerPneumoStorageAccess.SlotPneumo;
|
||||
import com.hbm.inventory.gui.element.GUIElements;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.network.pneumatic.TileEntityPneumoStorageAccess;
|
||||
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.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 + 34;
|
||||
this.xSize = 176;
|
||||
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 = I18n.format("container.pneumoStorageAccess");
|
||||
String name = "container.pneumpStorageAccess";
|
||||
|
||||
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();
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
double scale = 0.5D;
|
||||
GL11.glScaled(scale, scale, 1);
|
||||
|
||||
for(Object o : this.inventorySlots.inventorySlots) {
|
||||
if(!(o instanceof SlotPneumo)) continue;
|
||||
SlotPneumo pneumoSlot = (SlotPneumo) o;
|
||||
if(pneumoSlot.getHasStack()) {
|
||||
String label = BobMathUtil.getShortNumber(pneumoSlot.amount);
|
||||
int ix = (int) ((pneumoSlot.xDisplayPosition + 16) / scale) - this.fontRendererObj.getStringWidth(label);
|
||||
int iy = (int) ((pneumoSlot.yDisplayPosition + 16) / scale) - this.fontRendererObj.FONT_HEIGHT;
|
||||
this.fontRendererObj.drawStringWithShadow(label, ix, iy, -1);
|
||||
}
|
||||
}
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
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 + 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
|
||||
protected void renderToolTip(ItemStack stack, int x, int y) {
|
||||
List list = stack.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips);
|
||||
|
||||
for(int line = 0; line < list.size(); ++line) {
|
||||
if(line == 0) {
|
||||
list.set(line, stack.getRarity().rarityColor + (String) list.get(line));
|
||||
} else {
|
||||
list.set(line, EnumChatFormatting.GRAY + (String) list.get(line));
|
||||
}
|
||||
}
|
||||
|
||||
FontRenderer font = stack.getItem().getFontRenderer(stack);
|
||||
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);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,10 +3,8 @@ 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;
|
||||
@ -29,15 +27,11 @@ 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
|
||||
@ -53,8 +47,5 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,77 +0,0 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -5,16 +5,20 @@ import java.util.Arrays;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
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.render.util.GaugeUtil;
|
||||
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;
|
||||
|
||||
@ -64,13 +68,22 @@ public class GUIPneumoTube extends GuiInfoContainer {
|
||||
super.mouseClicked(x, y, i);
|
||||
|
||||
if(!endpointOnly) {
|
||||
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, 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, 128, 30, 14, 26, "whitelist");
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -99,7 +112,7 @@ public class GUIPneumoTube extends GuiInfoContainer {
|
||||
drawTexturedModalRect(guiLeft + 151, guiTop + 52, 215, 18 * tube.sendOrder, 18, 18);
|
||||
|
||||
drawTexturedModalRect(guiLeft + 6 + 4 * (tube.compair.getPressure() - 1), guiTop + 36, 179, 18, 4, 8);
|
||||
GUIElements.drawSmoothGauge(guiLeft + 16, guiTop + 25, this.zLevel, (double) tube.compair.getFill() / (double) tube.compair.getMaxFill(), 5, 2, 1, 0xCA6C43, 0xAB4223);
|
||||
GaugeUtil.drawSmoothGauge(guiLeft + 16, guiTop + 25, this.zLevel, (double) tube.compair.getFill() / (double) tube.compair.getMaxFill(), 5, 2, 1, 0xCA6C43, 0xAB4223);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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], GUIScreenRadioTorch.MAX_CHAN_LENGTH, display.displays[i].rtty);
|
||||
GUIScreenRBMKKeyPad.setupTextFieldStandard(rtty[i], 10, 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], GUIScreenRadioTorch.MAX_CHAN_LENGTH, gauge.gauges[i].rtty);
|
||||
GUIScreenRBMKKeyPad.setupTextFieldStandard(rtty[i], 10, 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], GUIScreenRadioTorch.MAX_CHAN_LENGTH, graph.graphs[i].rtty);
|
||||
GUIScreenRBMKKeyPad.setupTextFieldStandard(rtty[i], 10, 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], GUIScreenRadioTorch.MAX_CHAN_LENGTH, indicator.indicators[i].rtty);
|
||||
GUIScreenRBMKKeyPad.setupTextFieldStandard(rtty[i], 10, 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], GUIScreenRadioTorch.MAX_CHAN_LENGTH, keypad.keys[i].rtty);
|
||||
setupTextFieldStandard(rtty[i], 10, 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], GUIScreenRadioTorch.MAX_CHAN_LENGTH, lever.levers[i].rtty);
|
||||
GUIScreenRBMKKeyPad.setupTextFieldStandard(rtty[i], 10, 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,452 +1,429 @@
|
||||
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.",
|
||||
};
|
||||
}
|
||||
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 java.util.Random;
|
||||
|
||||
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 = 90;
|
||||
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) {
|
||||
|
||||
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,8 +20,6 @@ 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");
|
||||
@ -63,7 +61,7 @@ public class GUIScreenRadioTorch extends GuiScreen {
|
||||
this.frequency.setTextColor(0x00ff00);
|
||||
this.frequency.setDisabledTextColour(0x00ff00);
|
||||
this.frequency.setEnableBackgroundDrawing(false);
|
||||
this.frequency.setMaxStringLength(MAX_CHAN_LENGTH);
|
||||
this.frequency.setMaxStringLength(10);
|
||||
this.frequency.setText(radio.channel == null ? "" : radio.channel);
|
||||
|
||||
this.remap = new GuiTextField[16];
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user