Compare commits

..

No commits in common. "master" and "1.0.27_X5278" have entirely different histories.

2335 changed files with 134712 additions and 276515 deletions

View File

@ -7,46 +7,29 @@
# Yes this is a mostly untouched Github actions template # Yes this is a mostly untouched Github actions template
name: Java CI with Gradle name: Java CI with Gradle
on: on:
schedule: push:
- cron: "0 0 * * *" branches: [ "master" ]
workflow_dispatch: pull_request:
branches: [ "master" ]
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
contents: read contents: read
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Set up JDK 8 - name: Set up JDK 8
uses: actions/setup-java@v4 uses: actions/setup-java@v4
with: with:
java-version: '8' java-version: '8'
distribution: 'temurin' # Temurin because it's default :P distribution: 'temurin' # Temurin because it's default :P
# Calculate days since 10/10/10
- name: Calculate days since 10/10/10
id: calculate_days
run: |
start_date="2010-10-10"
current_date=$(date +%Y-%m-%d)
days_since=$(( ($(date -d "$current_date" +%s) - $(date -d "$start_date" +%s)) / 86400 ))
echo "days=$days_since" >> $GITHUB_OUTPUT
# Update version files with proper sed syntax
- name: Update version files
run: |
days=${{ steps.calculate_days.outputs.days }}
# Use proper sed syntax for Linux runners
sed -i "s/public static final String VERSION = \".*\";/public static final String VERSION = \"1.0.27 BETA ($days)\";/" src/main/java/com/hbm/lib/RefStrings.java
sed -i "s/mod_build_number=.*/mod_build_number=$days/" gradle.properties
# Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies. # Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies.
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md # See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
- name: Setup Gradle - name: Setup Gradle
@ -60,3 +43,5 @@ jobs:
with: with:
# A file, directory or wildcard pattern that describes what to upload # A file, directory or wildcard pattern that describes what to upload
path: ./build/libs path: ./build/libs

View File

@ -13,8 +13,6 @@ Things you should also avoid include:
* duplicate util functions (just use what we have, man) * duplicate util functions (just use what we have, man)
* unused or half finished util functions (for obvious reasons) * unused or half finished util functions (for obvious reasons)
* half finished or obviously broken features (à la "bob will fix it, i'm sure of it", please don't do that) * half finished or obviously broken features (à la "bob will fix it, i'm sure of it", please don't do that)
* updating the changelog (you're guaranteed to cause a merge conflict with that)
* any use of `I18n`, use `I18nUtil` instead
## Test your code ## Test your code
@ -22,9 +20,6 @@ This should go without saying, but please don't PR code that was never actually
**Addendum:** Because apparently some people think that testing is somehow optional, it is now **mandatory** to test the code both on a client and on a server. If the PR contains compat code, the game has to work **with and without** the mod that the compat is for. **Addendum:** Because apparently some people think that testing is somehow optional, it is now **mandatory** to test the code both on a client and on a server. If the PR contains compat code, the game has to work **with and without** the mod that the compat is for.
## No refactor PRs
Your refactors suck ass and usually something ends up breaking.
## Communication ## Communication
If you're planning on adding some new thing or doing a grand change, it's best to ask whether that's a good idea before spending 50 hours on a project that won't end up getting merged, due to issues that could have been entirely avoidable with communication. If you're planning on adding some new thing or doing a grand change, it's best to ask whether that's a good idea before spending 50 hours on a project that won't end up getting merged, due to issues that could have been entirely avoidable with communication.

View File

@ -2,7 +2,7 @@
[NTM on Modrinth](https://modrinth.com/mod/ntm) [NTM on Modrinth](https://modrinth.com/mod/ntm)
[NTM on CurseForge](https://www.curseforge.com/minecraft/mc-mods/hbms-nuclear-tech-mod) [NTM on CurseForge](https://minecraft.curseforge.com/projects/hbms-nuclear-tech-mod?gameCategorySlug=mc-mods&projectID=235439)
[Official NTM Wiki](https://nucleartech.wiki/wiki/Main_Page) [Official NTM Wiki](https://nucleartech.wiki/wiki/Main_Page)
@ -10,9 +10,9 @@
**This is for 1.7.10!** For 1.12, check out these projects: **This is for 1.7.10!** For 1.12, check out these projects:
* NTM Community Edition (WarFactory): https://github.com/MisterNorwood/Hbm-s-Nuclear-Tech-CE
* NTM Extended Edition (Alcater): https://github.com/Alcatergit/Hbm-s-Nuclear-Tech-GIT/releases
* NTM Reloaded: https://github.com/TheOriginalGolem/Hbm-s-Nuclear-Tech-GIT/releases * NTM Reloaded: https://github.com/TheOriginalGolem/Hbm-s-Nuclear-Tech-GIT/releases
* NTM Extended Edition (Alcater): https://github.com/Alcatergit/Hbm-s-Nuclear-Tech-GIT/releases
* NTM WarFactory: https://github.com/MisterNorwood/Hbm-s-Nuclear-Tech-GIT/releases
For 1.18, try Martin's remake: https://codeberg.org/MartinTheDragon/Nuclear-Tech-Mod-Remake/releases For 1.18, try Martin's remake: https://codeberg.org/MartinTheDragon/Nuclear-Tech-Mod-Remake/releases
@ -25,7 +25,7 @@ Simply navigate to "Releases" on the right side of the page, download links for
Tired of waiting until the next version comes out? Here is a tutorial on how to compile the very newest version yourself: Tired of waiting until the next version comes out? Here is a tutorial on how to compile the very newest version yourself:
Please note that these installation instructions are assuming you're running Microsoft Windows operating system. Linux users should know what to do by looking at the same guide. Please note that these installation instructions are assuming you're running Microsoft Windows operating system. Linux users should know what to do by looking at the same guide.
1. Make sure you have JDK8 installed. If not, download it from [adoptium.net](https://adoptium.net/temurin/releases?version=8) 1. Make sure you have JDK8 installed. If not, download it from [adoptium.net](https://adoptium.net/?variant=openjdk8&jvmVariant=hotspot)
2. If you don't have git installed, download&install it from [here](https://git-scm.com/downloads). 2. If you don't have git installed, download&install it from [here](https://git-scm.com/downloads).
3. Open up "Git Bash": 3. Open up "Git Bash":
* Press Windows Button, type "Git Bash" and press ENTER * Press Windows Button, type "Git Bash" and press ENTER

View File

@ -6,7 +6,6 @@ import java.nio.file.StandardCopyOption
buildscript { buildscript {
repositories { repositories {
maven { url = 'https://maven.ntmr.dev/proxy/' }
maven { url = 'https://maven.minecraftforge.net/' } maven { url = 'https://maven.minecraftforge.net/' }
maven { url = 'https://plugins.gradle.org/m2' } maven { url = 'https://plugins.gradle.org/m2' }
mavenCentral() mavenCentral()
@ -68,10 +67,6 @@ eclipse.classpath.file.whenMerged { cp ->
} }
repositories { repositories {
maven {
name = 'Blerg'
url = 'https://maven.ntmr.dev/proxy/'
}
maven { maven {
name = 'ModMaven' name = 'ModMaven'
url = 'https://modmaven.dev' url = 'https://modmaven.dev'
@ -84,18 +79,6 @@ repositories {
// name = "CurseForge" // name = "CurseForge"
// url = "https://minecraft.curseforge.com/api/maven/" // url = "https://minecraft.curseforge.com/api/maven/"
//} //}
maven {
name = "Jitpack"
url = "https://jitpack.io"
}
maven {
name = "CurseMaven"
url = "https://cursemaven.com"
}
maven {
name = "OpenComputers"
url = "https://maven.cil.li/"
}
} }
dependencies { dependencies {
@ -111,8 +94,6 @@ dependencies {
compileOnly "inventorytweaks:InventoryTweaks:1.59-dev:deobf" compileOnly "inventorytweaks:InventoryTweaks:1.59-dev:deobf"
implementation "li.cil.oc:OpenComputers:MC1.7.10-1.5.+:api" implementation "li.cil.oc:OpenComputers:MC1.7.10-1.5.+:api"
compileOnly "com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta.56-GTNH:dev"
} }
processResources { processResources {

View File

@ -1,27 +1,64 @@
## Changed ## Added
* Updated russian localization * `/ntmserver`
* Rad absorbers now use metadata, existing blocks will be converted automatically * Functions like `/ntmclient` but for common settings
* Fissure bombs that go off in crater biomes now create fissures with metadata 1 which creates radioactive volcanic lava * Can toggle `DAMAGE_COMPATIBILITY_MODE`, off by default, enables a more compatible (but slightly jankier) version of the bullet damage code
* If a crater biome is created on top of an existing fissure, it will keep producing normal volcanic lava * `MINE_<xxx>_DAMAGE` can be used to adjust landmine damage
* Simplified the battery socket's client packets, reducing CPU load * `TAINT_TRAILS` now replaces the hardcore taint config option, making taint blocks more potent and the potion effect trail taint blocks
* Muzzle flashes on guns now work in third person mode, including on other players and on NPCs, making it more apparent when you're being fired at * New ammo types
* This includes non-standard special effects like the .44 gap flash and the .35-800 ejector plume * Explosive 7.62mm
* Removed the old unused satelite deco blocks, freeing up 6 block IDs * Explosive .50 BMG
* Crucibles that smelt metal with no template set will no place the metal in the recipe stack instead of the waste stack, this should make it easier to get a recipe to work in the many, many cases where people add the template after smelting the material * Explosive 10 gauge buckshot (unlike 12 gauge which has explosive slugs)
* Battery sockets and the FENSU now support the copy tool * Lincoln's repeater, a b-side to the lever action rifle
* Removed unused displaylist support from the model loader * Weapon modification table
* DLs have been long phased out in favor of VBOs anyway * All weapon tiers have generic upgrades for increasing damage and durability
* Rebranded canned horse slime * Many guns have specialized attachments. Some examples:
* Now with extra bone marrow * The assault rifle can use silencers, scopes, can have its stock removed and has two different polymer furnitures
* Updated the deuterium tower's model * .44 revolvers can use scopes
* Increased the energy requirement for welding osmiridium * All full-length shotguns can have their barrel sawed off
* Most shotguns can make use of a choke to decrease projectile spread (does not work with sawed-offs)
* The grease gun has a modernization package, replacing most parts and increasing most stats
* Some guns have special mod combos that will change the name
# Fixed ## Changed
* Potentially fixed yet another issue regarding crates * Fat mines now use the standardized mini nuke code
* Fixed battery socket `fillpercent` RoR function always assuming a max power of 1 * Fat mines now have a base damage of exactly 100, being identical to demolition mini nukes
* Fixed issue where multiblock ports would generate many OpenComputers component entries * Fat mines now gib affected entities
* Fixed RBMK automatic control rods having incorrect settings when using the copy tool * IV bags now use `setHealth` operations instead of dealing damage, preventing health duplication by just avoiding the damage
* Fixed battery sockets producing junk debug data in the logs * The settings tool can now copy and paste the "paint" from paintable cables and fluid ducts
* Fixed an issue where the charging station would crash when trying to charge certain items * Changed the way taint works
* Fixed the DFC's core component not dropping its contents when mined * Instead of neon purple vines, taint is bow a greyish sludge
* Fixed audio problems with guns * Taint now actively replaces blocks instead of growing along them
* Taint is still limited in spread, however taint spread is lower underground, taint decays three times faster in intensity if the block is not exposed to air, making taint spread more along the surface
* Taint has a 25% chance of splashing down when replacing a block with no supports, causing structures to collapse and taint to spread faster
* Similar to soil sand, entities will sink in taint and get slowed down
* The sludge consumeth
* `enableGuns` config option now applies to SEDNA system guns, simply canceling all gun-related keybinds
* Cinnabar dust, if registered by another mod, can now be acidized into cinnabar using hydrogen peroxide
* Copper wires, like AA and gold, can now be welded into dense wires
* Removed the crafting recipe for the small geothermal generator and ZPE generators
* Removed the gemothermal, ZPE and ambient radiation generators from the creative menu
* Disabled the horrid flicker on the quad rocket launcher's antenna, making steered mode look less terrible
* All non-legendary .357 revolvers now fire a quarter of a second faster
* Changed the detonator's recipe to be less archaic
* Crates can now be opened when held
* Crates will not longer show their contents when locked
* Crates found in structures will sometimes contain things that aren't items
* Beam weapons are no longer pinpoint accurate when firing unscoped
* Reduced the recoil animation's intensity on the G3 by 66%, unless if the stock is sawed off
* The comically long pistol no longer cancels the inspect animation when fired while inspecting
* Instead, it will fire where the gun is pointing, at the player's face
* There's no special animation for this, since in survival mode, that would be lethal anyway
## Fixed
* Fixed animation errors on the MAS-36
* Fixed drone docks, requester and provider crates not dropping their contents when broken
* Fixed all missing texture errors that appear in the startup log
* Potentially fixed a crash with mekanism during the recipe change phase
* Removed the coke to heavy oil recipe for allowing infinite oil loops
* Coke to syngas and coalgas recipes should be fine though, so they stay
* Potentially fixed another issue regarding NPCs firing belt-fed guns
* Chunk-loading drones may or may not be fixed
* Fixed disperser canisters not actually despawning on impact, endlessly spawning mist clouds
* Fixed issues where the new packet system didn't play nice with machines that are being sent packets by other machines, like watz segments and radar screens
* Fixed fat man's piston not being extended correctly in non-first person rendering when unloaded
* Fixed weapon equip animation not playing when switching between two weapons of the same type

View File

@ -1,15 +1,15 @@
mod_version=1.0.27 mod_version=1.0.27
# Empty build number makes a release type # Empty build number makes a release type
mod_build_number=5572 mod_build_number=5278
credits=HbMinecraft,\ credits=HbMinecraft,\
\ rodolphito (explosion algorithms),\ \ rodolphito (explosion algorithms),\
\ grangerave (explosion algorithms),\ \ grangerave (explosion algorithms),\
\ Hoboy (textures, models),\ \ Hoboy (textures, models),\
\ Drillgon200 (effects, models),\ \ Drillgon200 (effects, models, porting),\
\ MartinTheDragon (calculator, chunk-based fallout, bendable cranes, pipe improvements, PWR sounds),\ \ MartinTheDragon (calculator, chunk-based fallout, bendable cranes, pipe improvements, PWR sounds),\
\ Alcater (GUI textures),\ \ Alcater (GUI textures, porting),\
\ MellowArpeggiation (new animation system, turbine sounds, sound fixes, industrial lights, conveyor wand, NBT structures, MSU displays),\ \ MellowArpeggiation (new animation system, turbine sounds, sound fixes, industrial lights, better particle diodes),\
\ Pheo (textures, various machines, models, weapons),\ \ Pheo (textures, various machines, models, weapons),\
\ Vær (gas centrifuges, better worldgen, ZIRNOX, CP-1 parts, starter guide, new cyclotron, weapon animations),\ \ Vær (gas centrifuges, better worldgen, ZIRNOX, CP-1 parts, starter guide, new cyclotron, weapon animations),\
\ UFFR (RTG pellets, guns, casings, euphemium capacitor, nucleartech.wiki),\ \ UFFR (RTG pellets, guns, casings, euphemium capacitor, nucleartech.wiki),\
@ -17,12 +17,9 @@ credits=HbMinecraft,\
\ Adam29 (liquid petroleum, ethanol, electric furnace),\ \ Adam29 (liquid petroleum, ethanol, electric furnace),\
\ Pvndols (thorium fuel recipe, gas turbine),\ \ Pvndols (thorium fuel recipe, gas turbine),\
\ JamesH2 (blood mechanics, nitric acid, particle emitter),\ \ JamesH2 (blood mechanics, nitric acid, particle emitter),\
\ Lazzzycat (structures, mob gear),\
\ PastaBaguette (coal horse decal),\ \ PastaBaguette (coal horse decal),\
\ Doctor17 (russian localization)),\ \ Doctor17 (russian localization)),\
\ Pashtet (russian localization),\ \ Pashtet (russian localization),\
\ 7H40 (russian localization),\
\ RayzerHan (russian localization),\
\ Bismarck (chinese localization),\ \ Bismarck (chinese localization),\
\ Creeper-banner (chinese localization),\ \ Creeper-banner (chinese localization),\
\ 5467864 (chinese localization),\ \ 5467864 (chinese localization),\
@ -34,22 +31,16 @@ credits=HbMinecraft,\
\ UnnameTokiko (chinese localization),\ \ UnnameTokiko (chinese localization),\
\ Herobrine 457985 (chinese localization),\ \ Herobrine 457985 (chinese localization),\
\ xxwinhere (chinese localization),\ \ xxwinhere (chinese localization),\
\ Nycticoraxnightheron (chinese localization),\
\ NarekoMichigami810 (chinese localization),\
\ Maksymisio (polish localization)\ \ Maksymisio (polish localization)\
\ el3ctro4ndre (italian localization),\ \ el3ctro4ndre (italian localization),\
\ Goaty1208 (italian localization),\
\ Pu-238 (Tom impact effects),\ \ Pu-238 (Tom impact effects),\
\ Frooz (gun models),\ \ Frooz (gun models),\
\ VT-6/24 (models, textures),\ \ VT-6/24 (models, textures),\
\ Nos (models),\ \ Nos (models),\
\ WushiThe (models),\
\ Minecreep (models),\ \ Minecreep (models),\
\ ackbarcrowbars (models),\
\ haru315 (spiral point algorithm),\
\ mlbv (threaded MK5),\
\ 70k (textures, glyphid AI, strand caster, electrolyzer changes, cryolite),\ \ 70k (textures, glyphid AI, strand caster, electrolyzer changes, cryolite),\
\ instantnootles (concept artist),\ \ instantnootles (concept artist),\
\ haru315 (spiral point algorithm),\
\ Sten89 (models),\ \ Sten89 (models),\
\ Pixelguru26 (textures),\ \ Pixelguru26 (textures),\
\ TheBlueHat (textures),\ \ TheBlueHat (textures),\
@ -58,23 +49,15 @@ credits=HbMinecraft,\
\ Silly541 (config for safe ME drives),\ \ Silly541 (config for safe ME drives),\
\ Voxelstice (OpenComputers integration, turbine spinup),\ \ Voxelstice (OpenComputers integration, turbine spinup),\
\ BallOfEnergy1 (OpenComputers integration, RBMK and packet optimization, crate backpacks),\ \ BallOfEnergy1 (OpenComputers integration, RBMK and packet optimization, crate backpacks),\
\ PewPewCricket (OpenComputers integration),\
\ kelllllen (OpenComputers integration),\
\ sdddddf80 (recipe configs, chinese localization, custom machine holograms),\ \ sdddddf80 (recipe configs, chinese localization, custom machine holograms),\
\ Abel1502 (abilities GUI, optimization, crate upgrade recipes, strand caster improvements, varous tweaks),\ \ Abel1502 (optimization, crate upgrade recipes, strand caster improvements, varous tweaks),\
\ Darek505 (armor rendering compatibility fix),\
\ ranch21 (improved HUD gauges),\
\ SuperCraftAlex (tooltips)\ \ SuperCraftAlex (tooltips)\
\ Ice-Arrow (research reactor tweaks),\ \ Ice-Arrow (research reactor tweaks),\
\ 245tt (anvil GUI improvements),\ \ 245tt (anvil GUI improvements),\
\ KoblizekXD (doors),\ \ KoblizekXD (doors),\
\ FOlkvangrField (custom machine parts),\ \ FOlkvangrField (custom machine parts),\
\ RosaTryp (centrifuge config),\ \ RosaTryp (centrifuge config),\
\ Toshayo (satellite loot system, project settings, gradle curse task, OpenComputers integration, fluid counter valve),\ \ Toshayo (satellite loot system, project settings, gradle curse task),\
\ Dash (PA particle serialization fix),\
\ archiecarrot123 (armor rendering compatibility fix),\
\ mikkerlo (mining laser & builder's jetpack improvements),\
\ icomet (refactoring),\
\ martemen (project settings),\ \ martemen (project settings),\
\ OvermindDL1 (project settings),\ \ OvermindDL1 (project settings),\
\ impbk2002 (project settings)\ \ impbk2002 (project settings)\

View File

@ -3,7 +3,6 @@ package api.hbm.block;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.world.World; import net.minecraft.world.World;
@Deprecated
public interface IDrillInteraction { public interface IDrillInteraction {
/** /**

View File

@ -1,6 +1,5 @@
package api.hbm.block; package api.hbm.block;
@Deprecated
public interface IMiningDrill { public interface IMiningDrill {
/** /**

View File

@ -11,8 +11,8 @@ public interface IBatteryItem {
public void dischargeBattery(ItemStack stack, long i); public void dischargeBattery(ItemStack stack, long i);
public long getCharge(ItemStack stack); public long getCharge(ItemStack stack);
public long getMaxCharge(ItemStack stack); public long getMaxCharge(ItemStack stack);
public long getChargeRate(ItemStack stack); public long getChargeRate();
public long getDischargeRate(ItemStack stack); public long getDischargeRate();
/** Returns a string for the NBT tag name of the long storing power */ /** Returns a string for the NBT tag name of the long storing power */
public default String getChargeTagName() { public default String getChargeTagName() {

View File

@ -2,6 +2,7 @@ package api.hbm.energymk2;
import com.hbm.handler.threading.PacketThreading; import com.hbm.handler.threading.PacketThreading;
import com.hbm.packet.toclient.AuxParticlePacketNT; import com.hbm.packet.toclient.AuxParticlePacketNT;
import com.hbm.util.Compat;
import api.hbm.energymk2.Nodespace.PowerNode; import api.hbm.energymk2.Nodespace.PowerNode;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
@ -24,7 +25,7 @@ public interface IEnergyProviderMK2 extends IEnergyHandlerMK2 {
public default void tryProvide(World world, int x, int y, int z, ForgeDirection dir) { public default void tryProvide(World world, int x, int y, int z, ForgeDirection dir) {
TileEntity te = TileAccessCache.getTileOrCache(world, x, y, z); TileEntity te = Compat.getTileStandard(world, x, y, z);
boolean red = false; boolean red = false;
if(te instanceof IEnergyConductorMK2) { if(te instanceof IEnergyConductorMK2) {
@ -42,7 +43,7 @@ public interface IEnergyProviderMK2 extends IEnergyHandlerMK2 {
if(te instanceof IEnergyReceiverMK2 && te != this) { if(te instanceof IEnergyReceiverMK2 && te != this) {
IEnergyReceiverMK2 rec = (IEnergyReceiverMK2) te; IEnergyReceiverMK2 rec = (IEnergyReceiverMK2) te;
if(rec.canConnect(dir.getOpposite()) && rec.allowDirectProvision()) { if(rec.canConnect(dir.getOpposite())) {
long provides = Math.min(this.getPower(), this.getProviderSpeed()); long provides = Math.min(this.getPower(), this.getProviderSpeed());
long receives = Math.min(rec.getMaxPower() - rec.getPower(), rec.getReceiverSpeed()); long receives = Math.min(rec.getMaxPower() - rec.getPower(), rec.getReceiverSpeed());
long toTransfer = Math.min(provides, receives); long toTransfer = Math.min(provides, receives);

View File

@ -3,7 +3,7 @@ package api.hbm.energymk2;
import com.hbm.handler.threading.PacketThreading; import com.hbm.handler.threading.PacketThreading;
import com.hbm.interfaces.NotableComments; import com.hbm.interfaces.NotableComments;
import com.hbm.packet.toclient.AuxParticlePacketNT; import com.hbm.packet.toclient.AuxParticlePacketNT;
import com.hbm.util.fauxpointtwelve.DirPos; import com.hbm.util.Compat;
import api.hbm.energymk2.Nodespace.PowerNode; import api.hbm.energymk2.Nodespace.PowerNode;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
@ -31,14 +31,9 @@ public interface IEnergyReceiverMK2 extends IEnergyHandlerMK2 {
return this.getMaxPower(); return this.getMaxPower();
} }
/** Whether a provider can provide power by touching the block (i.e. via proxies), bypassing the need for a network entirely */
public default boolean allowDirectProvision() { return true; }
public default void trySubscribe(World world, DirPos pos) { trySubscribe(world, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); }
public default void trySubscribe(World world, int x, int y, int z, ForgeDirection dir) { public default void trySubscribe(World world, int x, int y, int z, ForgeDirection dir) {
TileEntity te = TileAccessCache.getTileOrCache(world, x, y, z); TileEntity te = Compat.getTileStandard(world, x, y, z);
boolean red = false; boolean red = false;
if(te instanceof IEnergyConductorMK2) { if(te instanceof IEnergyConductorMK2) {

View File

@ -16,7 +16,6 @@ import net.minecraft.world.World;
* *
* @author hbm * @author hbm
*/ */
@NotableComments
public class Nodespace { public class Nodespace {
public static final PowerNetProvider THE_POWER_PROVIDER = new PowerNetProvider(); public static final PowerNetProvider THE_POWER_PROVIDER = new PowerNetProvider();

View File

@ -78,7 +78,7 @@ public class PowerNetMK2 extends NodeNet<IEnergyReceiverMK2, IEnergyProviderMK2,
for(Pair<IEnergyReceiverMK2, Long> entry : list) { for(Pair<IEnergyReceiverMK2, Long> entry : list) {
double weight = (double) entry.getValue() / (double) (priorityDemand); double weight = (double) entry.getValue() / (double) (priorityDemand);
long toSend = (long) Math.min(Math.max(toTransfer * weight, 0D), entry.getValue()); long toSend = (long) Math.max(toTransfer * weight, 0D);
energyUsed += (toSend - entry.getKey().transferPower(toSend)); //leftovers are subtracted from the intended amount to use up energyUsed += (toSend - entry.getKey().transferPower(toSend)); //leftovers are subtracted from the intended amount to use up
} }

View File

@ -18,7 +18,7 @@ public interface IFluidStandardReceiver extends IFluidStandardReceiverMK2 {
public default void subscribeToAllAround(FluidType type, World world, int x, int y, int z) { public default void subscribeToAllAround(FluidType type, World world, int x, int y, int z) {
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
trySubscribe(type, world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, dir); trySubscribe(type, world, x, y, z, dir);
} }
} }

View File

@ -88,11 +88,9 @@ public class FluidNetMK2 extends NodeNet<IFluidReceiverMK2, IFluidProviderMK2, F
for(int p = 0; p <= IFluidUserMK2.HIGHEST_VALID_PRESSURE; p++) { // if the pressure range were ever to increase, we might have to rethink this for(int p = 0; p <= IFluidUserMK2.HIGHEST_VALID_PRESSURE; p++) { // if the pressure range were ever to increase, we might have to rethink this
long totalAvailable = fluidAvailable[p];
for(int i = ConnectionPriority.values().length - 1; i >= 0; i--) { for(int i = ConnectionPriority.values().length - 1; i >= 0; i--) {
long toTransfer = Math.min(fluidDemand[p][i], totalAvailable); long toTransfer = Math.min(fluidDemand[p][i], fluidAvailable[p]);
if(toTransfer <= 0) continue; if(toTransfer <= 0) continue;
long priorityDemand = fluidDemand[p][i]; long priorityDemand = fluidDemand[p][i];
@ -104,8 +102,6 @@ public class FluidNetMK2 extends NodeNet<IFluidReceiverMK2, IFluidProviderMK2, F
received[p] += toSend; received[p] += toSend;
fluidTracker += toSend; fluidTracker += toSend;
} }
totalAvailable -= received[p];
} }
notAccountedFor[p] = received[p]; notAccountedFor[p] = received[p];

View File

@ -5,6 +5,7 @@ import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.toclient.AuxParticlePacketNT; import com.hbm.packet.toclient.AuxParticlePacketNT;
import com.hbm.uninos.GenNode; import com.hbm.uninos.GenNode;
import com.hbm.uninos.UniNodespace; import com.hbm.uninos.UniNodespace;
import com.hbm.util.Compat;
import com.hbm.util.fauxpointtwelve.DirPos; import com.hbm.util.fauxpointtwelve.DirPos;
import api.hbm.energymk2.IEnergyReceiverMK2.ConnectionPriority; import api.hbm.energymk2.IEnergyReceiverMK2.ConnectionPriority;
@ -27,7 +28,7 @@ public interface IFluidReceiverMK2 extends IFluidUserMK2 {
public default void trySubscribe(FluidType type, World world, int x, int y, int z, ForgeDirection dir) { public default void trySubscribe(FluidType type, World world, int x, int y, int z, ForgeDirection dir) {
TileEntity te = TileAccessCache.getTileOrCache(world, x, y, z); TileEntity te = Compat.getTileStandard(world, x, y, z);
boolean red = false; boolean red = false;
if(te instanceof IFluidConnectorMK2) { if(te instanceof IFluidConnectorMK2) {

View File

@ -1,9 +0,0 @@
package api.hbm.fluidmk2;
public interface IFluidRegisterListener {
/**
* Called when the fluid registry initializes all fluids. Use CompatFluidRegistry to create new instances of FluidType, which are automatically registered.
*/
public void onFluidsLoad();
}

View File

@ -6,6 +6,7 @@ import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.toclient.AuxParticlePacketNT; import com.hbm.packet.toclient.AuxParticlePacketNT;
import com.hbm.uninos.GenNode; import com.hbm.uninos.GenNode;
import com.hbm.uninos.UniNodespace; import com.hbm.uninos.UniNodespace;
import com.hbm.util.Compat;
import com.hbm.util.fauxpointtwelve.DirPos; import com.hbm.util.fauxpointtwelve.DirPos;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
@ -29,7 +30,7 @@ public interface IFluidStandardSenderMK2 extends IFluidProviderMK2 {
public default void tryProvide(FluidType type, int pressure, World world, int x, int y, int z, ForgeDirection dir) { public default void tryProvide(FluidType type, int pressure, World world, int x, int y, int z, ForgeDirection dir) {
TileEntity te = TileAccessCache.getTileOrCache(world, x, y, z); TileEntity te = Compat.getTileStandard(world, x, y, z);
boolean red = false; boolean red = false;
if(te instanceof IFluidConnectorMK2) { if(te instanceof IFluidConnectorMK2) {
@ -45,7 +46,7 @@ public interface IFluidStandardSenderMK2 extends IFluidProviderMK2 {
} }
} }
if(te != this && te instanceof IFluidReceiverMK2) { if(te instanceof IFluidReceiverMK2 && te != this) {
IFluidReceiverMK2 rec = (IFluidReceiverMK2) te; IFluidReceiverMK2 rec = (IFluidReceiverMK2) te;
if(rec.canConnect(type, dir.getOpposite())) { if(rec.canConnect(type, dir.getOpposite())) {
long provides = Math.min(this.getFluidAvailable(type, pressure), this.getProviderSpeed(type, pressure)); long provides = Math.min(this.getFluidAvailable(type, pressure), this.getProviderSpeed(type, pressure));

View File

@ -1,3 +1,10 @@
/**
*
*/
/**
* @author hbm
*
*/
package api.hbm.fluidmk2; package api.hbm.fluidmk2;
/* /*
@ -7,18 +14,3 @@ Has a few extra bits and pieces for handling, but the concept is basically the s
Sounds good? Sounds good?
*/ */
/*
Quick explanation for implementing new fluids via addon:
Fluids are subject to /ntmreload so they get wiped and rebuilt using the init function in Fluids, which means that if fluids
are simply added externally during startup, they are removed permanently until the game restarts. Same concept as with recipes, really.
To fix this we need to make sure that externally registered fluids are re-registered during reload, for that purpose we have
IFluidRegisterListener, a simple interface with a small method that runs whenever the fluid list is reloaded. IFluidRegisterListeners
need to be registered with CompatExternal.registerFluidRegisterListener to be used, make sure to do this during PreInit.
Inside the IFluidRegisterListener, fluids can be added using CompatFluidRegistry.registerFluid, which will generate a Fluid instance
using the supplied arguments and automatically register it. Do note that like with custom fluids, fluids need numeric IDs assigned manually.
To prevent collisions with stock fluids when NTM updates, make sure to choose a high starting ID (e.g. 10,000).
The fluid created by registerFluid can have traits added to them, just like how NTM does it with its stock fluids.
*/

View File

@ -7,17 +7,15 @@ public interface IRORInteractive extends IRORInfo {
public static String EX_NULL = "Exception: Null Command"; public static String EX_NULL = "Exception: Null Command";
public static String EX_NAME = "Exception: Multiple Name Separators"; public static String EX_NAME = "Exception: Multiple Name Separators";
public static String EX_FORMAT = "Exception: Parameter in Invalid Format";
/** Runs a function on the ROR component, usually causing the component to change or do something. Returns are optional. */ /** Runs a function on the ROR component, usually causing the component to change or do something. Returns are optional. */
public String runRORFunction(String name, String[] params); public Object runRORFunction(String name, String[] params);
/** Extracts the command name from a full command string */ /** Extracts the command name from a full command string */
public static String getCommand(String input) { public static String getCommand(String input) {
if(input == null || input.isEmpty()) throw new RORFunctionException(EX_NULL); if(input == null || input.isEmpty()) throw new RORFunctionException(EX_NULL);
String[] parts = input.split(NAME_SEPARATOR); String[] parts = input.split(NAME_SEPARATOR);
if(parts.length <= 0 || parts.length > 2) throw new RORFunctionException(EX_NAME); if(parts.length <= 0 || parts.length > 2) throw new RORFunctionException(EX_NAME);
if(parts[0].isEmpty()) throw new RORFunctionException(EX_NULL);
return parts[0]; return parts[0];
} }
@ -31,11 +29,4 @@ public interface IRORInteractive extends IRORInfo {
String[] params = paramList.split(PARAM_SEPARATOR); String[] params = paramList.split(PARAM_SEPARATOR);
return params; return params;
} }
public static int parseInt(String val, int min, int max) {
int result = 0;
try { result = Integer.parseInt(val); } catch(Exception x) { throw new RORFunctionException(EX_FORMAT); };
if(result < min || result > max) throw new RORFunctionException(EX_FORMAT);
return result;
}
} }

View File

@ -3,5 +3,5 @@ package api.hbm.redstoneoverradio;
public interface IRORValueProvider extends IRORInfo { public interface IRORValueProvider extends IRORInfo {
/** Grabs the specified value from this ROR component, operations should not cause any changes with the component itself */ /** Grabs the specified value from this ROR component, operations should not cause any changes with the component itself */
public String provideRORValue(String name); public Object provideRORValue(String name);
} }

View File

@ -43,7 +43,4 @@ ROR programmers can indeed do everything that the readers and controllers can, b
which are more time-consuming to set up and limits the amount of command channels available, hence why readers and controllers exist which are more time-consuming to set up and limits the amount of command channels available, hence why readers and controllers exist
when only a simple solution is required when only a simple solution is required
Addendum: While the RTTY system can support any arbitrary object as a signal, INDEX will strictly use strings, since that simplifies
things regarding serialization and saving signals to NBT. Counters already use a parse to int32 function, so this still checks out.
*/ */

View File

@ -1,55 +1,7 @@
package api.hbm.tile; package api.hbm.tile;
import java.util.HashMap;
import java.util.Map;
import com.hbm.util.Compat;
import com.hbm.util.Tuple.Quartet;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
/** For anything that should be removed off networks when considered unloaded, only affects providers and receivers, not links. Must not necessarily be a tile. */ /** For anything that should be removed off networks when considered unloaded, only affects providers and receivers, not links. Must not necessarily be a tile. */
public interface ILoadedTile { public interface ILoadedTile {
public boolean isLoaded(); public boolean isLoaded();
// should we gunk this into the API? no, but i don't care
public static class TileAccessCache {
public static Map<Quartet, TileAccessCache> cache = new HashMap();
public static int NULL_CACHE = 20;
public static int NONNULL_CACHE = 60;
public TileEntity tile;
public long expiresOn;
public TileAccessCache(TileEntity tile, long expiresOn) {
this.tile = tile;
this.expiresOn = expiresOn;
}
public boolean hasExpired(long worldTime) {
if(tile != null && tile.isInvalid()) return true;
if(worldTime >= expiresOn) return true;
if(tile instanceof ILoadedTile && !((ILoadedTile) tile).isLoaded()) return true;
return false;
}
public static Quartet publicCumRag = new Quartet(0, 0, 0, 0);
public static TileEntity getTileOrCache(World world, int x, int y, int z) {
publicCumRag.mangle(x, y, z, world.provider.dimensionId);
TileAccessCache cache = TileAccessCache.cache.get(publicCumRag);
if(cache == null || cache.hasExpired(world.getTotalWorldTime())) {
TileEntity tile = Compat.getTileStandard(world, x, y, z);
cache = new TileAccessCache(tile, world.getTotalWorldTime() + (tile == null ? NULL_CACHE : NONNULL_CACHE));
TileAccessCache.cache.put(publicCumRag.clone(), cache);
return tile;
} else {
return cache.tile;
}
}
}
} }

View File

@ -5,7 +5,7 @@ import com.hbm.handler.ThreeInts;
import com.hbm.interfaces.ICopiable; import com.hbm.interfaces.ICopiable;
import com.hbm.main.MainRegistry; import com.hbm.main.MainRegistry;
import com.hbm.tileentity.IPersistentNBT; import com.hbm.tileentity.IPersistentNBT;
import com.hbm.world.gen.nbt.INBTBlockTransformable; import com.hbm.world.gen.INBTTransformable;
import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
@ -26,8 +26,6 @@ import net.minecraft.stats.StatList;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.client.event.DrawBlockHighlightEvent; import net.minecraftforge.client.event.DrawBlockHighlightEvent;
@ -37,7 +35,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
public abstract class BlockDummyable extends BlockContainer implements ICustomBlockHighlight, ICopiable, INBTBlockTransformable { public abstract class BlockDummyable extends BlockContainer implements ICustomBlockHighlight, ICopiable, INBTTransformable {
public BlockDummyable(Material mat) { public BlockDummyable(Material mat) {
super(mat); super(mat);
@ -77,20 +75,27 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl
super.onNeighborBlockChange(world, x, y, z, block); super.onNeighborBlockChange(world, x, y, z, block);
if(safeRem) if(world.isRemote || safeRem)
return; return;
destroyIfOrphan(world, x, y, z); int metadata = world.getBlockMetadata(x, y, z);
// if it's an extra, remove the extra-ness
if(metadata >= extra)
metadata -= extra;
ForgeDirection dir = ForgeDirection.getOrientation(metadata).getOpposite();
Block b = world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
if(b != this) {
world.setBlockToAir(x, y, z);
}
} }
public void updateTick(World world, int x, int y, int z, Random rand) { public void updateTick(World world, int x, int y, int z, Random rand) {
super.updateTick(world, x, y, z, rand); super.updateTick(world, x, y, z, rand);
destroyIfOrphan(world, x, y, z);
}
private void destroyIfOrphan(World world, int x, int y, int z) {
if(world.isRemote) if(world.isRemote)
return; return;
@ -103,32 +108,10 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl
ForgeDirection dir = ForgeDirection.getOrientation(metadata).getOpposite(); ForgeDirection dir = ForgeDirection.getOrientation(metadata).getOpposite();
Block b = world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ); Block b = world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
// An extra precaution against multiblocks on chunk borders being erroneously deleted. if(b != this) {
// Technically, this might be used to persist ghost dummy blocks by manipulating world.setBlockToAir(x, y, z);
// loaded chunks and block destruction, but this gives no benefit to the player,
// cannot be done accidentally, and is definitely preferable to multiblocks
// just vanishing when their chunks are unloaded in an unlucky way.
if(b != this && world.checkChunksExist(x - 1, y - 1, z - 1, x + 1, y + 1, z + 1)) {
if (isLegacyMonoblock(world, x, y, z)) {
fixLegacyMonoblock(world, x, y, z);
} else {
world.setBlockToAir(x, y, z);
}
} }
}
// Override this when turning a single block into a pseudo-multiblock.
// If this returns true, instead of being deleted as an orphan, the block
// will be promoted to a core of a dummyable, however without any dummies.
// This is only called if the block is presumed an orphan, so you don't
// need to check that here.
protected boolean isLegacyMonoblock(World world, int x, int y, int z) {
return false;
}
protected void fixLegacyMonoblock(World world, int x, int y, int z) {
// Promote to a lone core block with the same effective rotation as before the change
world.setBlockMetadataWithNotify(x, y, z, offset + world.getBlockMetadata(x, y, z), 3);
} }
public int[] findCore(World world, int x, int y, int z) { public int[] findCore(World world, int x, int y, int z) {
@ -458,10 +441,8 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl
y = pos[1]; y = pos[1];
z = pos[2]; z = pos[2];
ForgeDirection rot = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z) - offset).getRotation(ForgeDirection.UP); for(AxisAlignedBB aabb :this.bounding) {
AxisAlignedBB boxlet = getAABBRotationOffset(aabb, x + 0.5, y, z + 0.5, ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z) - offset).getRotation(ForgeDirection.UP));
for(AxisAlignedBB aabb : this.bounding) {
AxisAlignedBB boxlet = getAABBRotationOffset(aabb, x + 0.5, y, z + 0.5, rot);
if(entityBounding.intersectsWith(boxlet)) { if(entityBounding.intersectsWith(boxlet)) {
list.add(boxlet); list.add(boxlet);
@ -486,32 +467,6 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl
return AxisAlignedBB.getBoundingBox(aabb.minX, aabb.minY, aabb.minZ, aabb.maxX, aabb.maxY, aabb.maxZ).offset(x + 0.5, y + 0.5, z + 0.5); return AxisAlignedBB.getBoundingBox(aabb.minX, aabb.minY, aabb.minZ, aabb.maxX, aabb.maxY, aabb.maxZ).offset(x + 0.5, y + 0.5, z + 0.5);
} }
// Don't mutate the xyz parameters, or the interaction max distance will bite you
@Override
public MovingObjectPosition collisionRayTrace(World world, int x, int y, int z, Vec3 startVec, Vec3 endVec) {
if(!this.useDetailedHitbox()) {
return super.collisionRayTrace(world, x, y, z, startVec, endVec);
}
int[] pos = this.findCore(world, x, y, z);
if(pos == null)
return super.collisionRayTrace(world, x, y, z, startVec, endVec);
ForgeDirection rot = ForgeDirection.getOrientation(world.getBlockMetadata(pos[0], pos[1], pos[2]) - offset).getRotation(ForgeDirection.UP);
for(AxisAlignedBB aabb : this.bounding) {
AxisAlignedBB boxlet = getAABBRotationOffset(aabb, pos[0] + 0.5, pos[1], pos[2] + 0.5, rot);
MovingObjectPosition intercept = boxlet.calculateIntercept(startVec, endVec);
if(intercept != null) {
return new MovingObjectPosition(x, y, z, intercept.sideHit, intercept.hitVec);
}
}
return null;
}
@Override @Override
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) { public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
if(!this.useDetailedHitbox()) { if(!this.useDetailedHitbox()) {
@ -545,10 +500,10 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl
double dZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)interp; double dZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)interp;
float exp = 0.002F; float exp = 0.002F;
ForgeDirection rot = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z) - offset).getRotation(ForgeDirection.UP); int meta = world.getBlockMetadata(x, y, z);
ICustomBlockHighlight.setup(); ICustomBlockHighlight.setup();
for(AxisAlignedBB aabb : this.bounding) RenderGlobal.drawOutlinedBoundingBox(getAABBRotationOffset(aabb.expand(exp, exp, exp), 0, 0, 0, rot).getOffsetBoundingBox(x - dX + 0.5, y - dY, z - dZ + 0.5), -1); for(AxisAlignedBB aabb : this.bounding) RenderGlobal.drawOutlinedBoundingBox(getAABBRotationOffset(aabb.expand(exp, exp, exp), 0, 0, 0, ForgeDirection.getOrientation(meta - offset).getRotation(ForgeDirection.UP)).getOffsetBoundingBox(x - dX + 0.5, y - dY, z - dZ + 0.5), -1);
ICustomBlockHighlight.cleanup(); ICustomBlockHighlight.cleanup();
} }
@ -565,7 +520,6 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl
@Override @Override
public void pasteSettings(NBTTagCompound nbt, int index, World world, EntityPlayer player, int x, int y, int z) { public void pasteSettings(NBTTagCompound nbt, int index, World world, EntityPlayer player, int x, int y, int z) {
int[] pos = findCore(world, x, y, z); int[] pos = findCore(world, x, y, z);
if(pos == null) return;
TileEntity tile = world.getTileEntity(pos[0], pos[1], pos[2]); TileEntity tile = world.getTileEntity(pos[0], pos[1], pos[2]);
if (tile instanceof ICopiable) if (tile instanceof ICopiable)
((ICopiable) tile).pasteSettings(nbt, index, world, player, pos[0], pos[1], pos[2]); ((ICopiable) tile).pasteSettings(nbt, index, world, player, pos[0], pos[1], pos[2]);
@ -591,7 +545,7 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl
meta -= extra; meta -= extra;
} }
meta = INBTBlockTransformable.transformMetaDeco(meta, coordBaseMode); meta = INBTTransformable.transformMetaDeco(meta, coordBaseMode);
if(isOffset) { if(isOffset) {
meta += offset; meta += offset;

View File

@ -58,14 +58,6 @@ public class BlockEnums {
SMALL SMALL
} }
public static enum LightstoneType {
UNREFINED,
TILE,
BRICKS,
BRICKS_CHISELED,
CHISELED
}
public static enum DecoComputerEnum { public static enum DecoComputerEnum {
IBM_300PL IBM_300PL
} }
@ -80,5 +72,4 @@ public class BlockEnums {
FLUORESCENT, FLUORESCENT,
HALOGEN HALOGEN
} }
} }

View File

@ -1,5 +1,6 @@
package com.hbm.blocks; package com.hbm.blocks;
import com.hbm.util.I18nUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
@ -7,8 +8,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.EnumChatFormatting;
import org.lwjgl.input.Keyboard; import org.lwjgl.input.Keyboard;
import com.hbm.util.i18n.I18nUtil;
import java.util.List; import java.util.List;
public interface ITooltipProvider { public interface ITooltipProvider {

File diff suppressed because it is too large Load Diff

View File

@ -1,77 +1,91 @@
package com.hbm.blocks.bomb; package com.hbm.blocks.bomb;
import com.hbm.blocks.BlockEnumMulti; import java.util.Random;
import com.hbm.blocks.ModBlocks;
import com.hbm.config.BombConfig; import com.hbm.config.BombConfig;
import com.hbm.entity.logic.EntityBalefire; import com.hbm.entity.logic.EntityBalefire;
import com.hbm.entity.logic.EntityNukeExplosionMK5;
import com.hbm.explosion.vanillant.ExplosionVNT;
import com.hbm.explosion.vanillant.standard.BlockAllocatorStandard;
import com.hbm.explosion.vanillant.standard.BlockProcessorStandard;
import com.hbm.explosion.vanillant.standard.EntityProcessorCross;
import com.hbm.explosion.vanillant.standard.PlayerProcessorStandard;
import com.hbm.handler.threading.PacketThreading; import com.hbm.handler.threading.PacketThreading;
import com.hbm.interfaces.IBomb; import com.hbm.interfaces.IBomb;
import com.hbm.items.ModItems; import com.hbm.items.ModItems;
import com.hbm.main.MainRegistry;
import com.hbm.packet.toclient.AuxParticlePacketNT; import com.hbm.packet.toclient.AuxParticlePacketNT;
import com.hbm.particle.helper.ExplosionCreator;
import com.hbm.tileentity.bomb.TileEntityCrashedBomb; import com.hbm.tileentity.bomb.TileEntityCrashedBomb;
import com.hbm.util.EnumUtil;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockCrashedBomb extends BlockEnumMulti implements ITileEntityProvider, IBomb { public class BlockCrashedBomb extends BlockContainer implements IBomb {
public static enum EnumDudType { public BlockCrashedBomb(Material p_i45386_1_) {
BALEFIRE, CONVENTIONAL, NUKE, SALTED super(p_i45386_1_);
}
public BlockCrashedBomb(Material mat) {
super(mat, EnumDudType.class, false, false);
} }
@Override @Override
public TileEntity createNewTileEntity(World world, int meta) { public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
return new TileEntityCrashedBomb(); return new TileEntityCrashedBomb();
} }
@Override public int getRenderType() { return -1; } @Override
@Override public boolean isOpaqueCube() { return false; } public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {
@Override public boolean renderAsNormalBlock() { return false; } return Item.getItemFromBlock(ModBlocks.crashed_balefire);
}
@Override
public int getRenderType() {
return -1;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
if(i == 0) {
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
}
if(i == 1) {
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
}
if(i == 2) {
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
}
if(i == 3) {
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
}
}
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int i, float fx, float fy, float fz) { public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int i, float fx, float fy, float fz) {
if(world.isRemote) return true;
if(world.isRemote)
return true;
if(player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.defuser) { if(player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.defuser) {
EnumDudType type = EnumUtil.grabEnumSafely(EnumDudType.class, world.getBlockMetadata(x, y, z));
//TODO: make this less scummy
if(type == type.BALEFIRE) {
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModItems.egg_balefire_shard)));
}
if(type == type.CONVENTIONAL) {
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModItems.ball_tnt, 16)));
}
if(type == type.NUKE) {
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModItems.ball_tnt, 8)));
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModItems.billet_plutonium, 4)));
}
if(type == type.SALTED) {
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModItems.ball_tnt, 8)));
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModItems.billet_plutonium, 2)));
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModItems.ingot_cobalt, 12)));
}
world.func_147480_a(x, y, z, false); world.func_147480_a(x, y, z, false);
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModItems.egg_balefire_shard)));
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModItems.plate_steel, 10 + world.rand.nextInt(15))));
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModItems.plate_titanium, 2 + world.rand.nextInt(7))));
return true; return true;
} }
@ -83,46 +97,21 @@ public class BlockCrashedBomb extends BlockEnumMulti implements ITileEntityProvi
if(!world.isRemote) { if(!world.isRemote) {
EnumDudType type = EnumUtil.grabEnumSafely(EnumDudType.class, world.getBlockMetadata(x, y, z));
world.setBlockToAir(x, y, z); world.setBlockToAir(x, y, z);
EntityBalefire bf = new EntityBalefire(world);
bf.posX = x;
bf.posY = y;
bf.posZ = z;
bf.destructionRange = (int) (BombConfig.fatmanRadius * 1.25);
world.spawnEntityInWorld(bf);
if(type == type.BALEFIRE) { NBTTagCompound data = new NBTTagCompound();
EntityBalefire bf = new EntityBalefire(world); data.setString("type", "muke");
bf.setPosition(x, y, z); data.setBoolean("balefire", true);
bf.destructionRange = (int) (BombConfig.fatmanRadius * 1.25); PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, x + 0.5, y + 0.5, z + 0.5), new TargetPoint(world.provider.dimensionId, x + 0.5, y + 0.5, z + 0.5, 250));
world.spawnEntityInWorld(bf); world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, "hbm:weapon.mukeExplosion", 15.0F, 1.0F);
spawnMush(world, x, y, z, true);
}
if(type == type.CONVENTIONAL) {
ExplosionVNT xnt = new ExplosionVNT(world, x + 0.5, y + 0.5, z + 0.5, 35F);
xnt.setBlockAllocator(new BlockAllocatorStandard(24));
xnt.setBlockProcessor(new BlockProcessorStandard().setNoDrop());
xnt.setEntityProcessor(new EntityProcessorCross(5D).withRangeMod(1.5F));
xnt.setPlayerProcessor(new PlayerProcessorStandard());
xnt.explode();
ExplosionCreator.composeEffectLarge(world, x + 0.5, y + 0.5, z + 0.5);
}
if(type == type.NUKE) {
world.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(world, 35, x + 0.5, y + 0.5, z + 0.5));
spawnMush(world, x, y, z, MainRegistry.polaroidID == 11 || world.rand.nextInt(100) == 0);
}
if(type == type.SALTED) {
world.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(world, 25, x + 0.5, y + 0.5, z + 0.5).moreFallout(25));
spawnMush(world, x, y, z, MainRegistry.polaroidID == 11 || world.rand.nextInt(100) == 0);
}
} }
return BombReturnCode.DETONATED; return BombReturnCode.DETONATED;
} }
public static void spawnMush(World world, int x, int y, int z, boolean balefire) {
world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, "hbm:weapon.mukeExplosion", 15.0F, 1.0F);
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "muke");
data.setBoolean("balefire", balefire);
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, x + 0.5, y + 0.5, z + 0.5), new TargetPoint(world.provider.dimensionId, x + 0.5, y + 0.5, z + 0.5, 250));
}
} }

View File

@ -3,7 +3,6 @@ package com.hbm.blocks.bomb;
import com.hbm.blocks.ModBlocks; import com.hbm.blocks.ModBlocks;
import com.hbm.entity.item.EntityTNTPrimedBase; import com.hbm.entity.item.EntityTNTPrimedBase;
import com.hbm.explosion.ExplosionNukeSmall; import com.hbm.explosion.ExplosionNukeSmall;
import com.hbm.world.biome.BiomeGenCraterBase;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
@ -17,8 +16,6 @@ public class BlockFissureBomb extends BlockTNTBase {
int range = 5; int range = 5;
boolean crater = world.getBiomeGenForCoords((int) Math.floor(x), (int) Math.floor(z)) instanceof BiomeGenCraterBase;
for(int i = -range; i <= range; i++) { for(int i = -range; i <= range; i++) {
for(int j = -range; j <= range; j++) { for(int j = -range; j <= range; j++) {
for(int k = -range; k <= range; k++) { for(int k = -range; k <= range; k++) {
@ -30,7 +27,7 @@ public class BlockFissureBomb extends BlockTNTBase {
Block block = world.getBlock(a, b, c); Block block = world.getBlock(a, b, c);
if(block == ModBlocks.ore_bedrock) { if(block == ModBlocks.ore_bedrock) {
world.setBlock(a, b, c, ModBlocks.ore_volcano, crater ? 1 : 0, 3); world.setBlock(a, b, c, ModBlocks.ore_volcano);
} else if(block == ModBlocks.ore_bedrock_oil) { } else if(block == ModBlocks.ore_bedrock_oil) {
world.setBlock(a, b, c, Blocks.bedrock); world.setBlock(a, b, c, Blocks.bedrock);
} }

View File

@ -19,7 +19,6 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityFallingBlock; import net.minecraft.entity.item.EntityFallingBlock;
import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionEffect; import net.minecraft.potion.PotionEffect;
@ -47,7 +46,7 @@ public class BlockTaint extends Block implements ITooltipProvider {
if(Math.abs(i) + Math.abs(j) + Math.abs(k) > 4) continue; if(Math.abs(i) + Math.abs(j) + Math.abs(k) > 4) continue;
if(rand.nextFloat() > 0.25F) continue; if(rand.nextFloat() > 0.25F) continue;
Block b = world.getBlock(x + i, y + j, z + k); Block b = world.getBlock(x + i, y + j, z + k);
if(b.isAir(world, x + i, y + j, z + k) || b == Blocks.bedrock) continue; if(!b.isNormalCube() || b.isAir(world, x + i, y + j, z + k)) continue;
int targetMeta = meta + 1; int targetMeta = meta + 1;
boolean hasAir = false; boolean hasAir = false;
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {

View File

@ -151,7 +151,7 @@ public class BlockVolcano extends BlockContainer implements ITooltipProvider, IB
@Override @Override
public void writeToNBT(NBTTagCompound nbt) { public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt); super.writeToNBT(nbt);
nbt.setInteger("timer", this.volcanoTimer); nbt.setInteger("tier", this.volcanoTimer);
} }
private boolean shouldGrow() { private boolean shouldGrow() {

View File

@ -1,13 +1,7 @@
package com.hbm.blocks.bomb; package com.hbm.blocks.bomb;
import com.hbm.explosion.vanillant.ExplosionVNT; import com.hbm.explosion.ExplosionChaos;
import com.hbm.explosion.vanillant.standard.BlockAllocatorStandard;
import com.hbm.explosion.vanillant.standard.BlockProcessorStandard;
import com.hbm.explosion.vanillant.standard.EntityProcessorCrossSmooth;
import com.hbm.explosion.vanillant.standard.ExplosionEffectTiny;
import com.hbm.explosion.vanillant.standard.PlayerProcessorStandard;
import com.hbm.interfaces.IBomb; import com.hbm.interfaces.IBomb;
import com.hbm.particle.helper.ExplosionCreator;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
@ -23,7 +17,9 @@ public class BombFlameWar extends Block implements IBomb {
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) { public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
if(world.isBlockIndirectlyGettingPowered(x, y, z)) { if(world.isBlockIndirectlyGettingPowered(x, y, z)) {
explode(world, x, y, z); ExplosionChaos.explode(world, x, y, z, 15);
ExplosionChaos.spawnExplosion(world, x, y, z, 75);
ExplosionChaos.flameDeath(world, x, y, z, 100);
} }
} }
@ -31,24 +27,9 @@ public class BombFlameWar extends Block implements IBomb {
public BombReturnCode explode(World world, int x, int y, int z) { public BombReturnCode explode(World world, int x, int y, int z) {
if(!world.isRemote) { if(!world.isRemote) {
ExplosionChaos.explode(world, x, y, z, 15);
world.func_147480_a(x, y, z, false); ExplosionChaos.spawnExplosion(world, x, y, z, 75);
ExplosionChaos.flameDeath(world, x, y, z, 100);
for(int i = 0; i < 150; i++) {
ExplosionVNT vnt = new ExplosionVNT(world, x + world.rand.nextInt(51) - 25, y + world.rand.nextInt(11) - 5, z + world.rand.nextInt(51) - 25, 4, null);
vnt.setEntityProcessor(new EntityProcessorCrossSmooth(1, 25));
vnt.setPlayerProcessor(new PlayerProcessorStandard());
vnt.setSFX(new ExplosionEffectTiny());
vnt.explode();
}
ExplosionVNT xnt = new ExplosionVNT(world, x + 0.5, y + 0.5, z + 0.5, 15F);
xnt.setBlockAllocator(new BlockAllocatorStandard(32));
xnt.setBlockProcessor(new BlockProcessorStandard().setNoDrop());
xnt.setEntityProcessor(new EntityProcessorCrossSmooth(2, 200));
xnt.setPlayerProcessor(new PlayerProcessorStandard());
xnt.explode();
ExplosionCreator.composeEffectSmall(world, x + 0.5, y + 0.5, z + 0.5);
} }
return BombReturnCode.DETONATED; return BombReturnCode.DETONATED;

View File

@ -18,12 +18,10 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import com.hbm.blocks.ModBlocks; import com.hbm.blocks.ModBlocks;
import com.hbm.entity.effect.EntityMist;
import com.hbm.explosion.ExplosionChaos; import com.hbm.explosion.ExplosionChaos;
import com.hbm.explosion.ExplosionLarge; import com.hbm.explosion.ExplosionLarge;
import com.hbm.explosion.ExplosionNukeGeneric; import com.hbm.explosion.ExplosionNukeGeneric;
import com.hbm.interfaces.IBomb; import com.hbm.interfaces.IBomb;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.main.MainRegistry; import com.hbm.main.MainRegistry;
import com.hbm.tileentity.bomb.TileEntityBombMulti; import com.hbm.tileentity.bomb.TileEntityBombMulti;
@ -171,11 +169,7 @@ public class BombMulti extends BlockContainer implements IBomb {
} }
if(gasCloud > 0) { if(gasCloud > 0) {
EntityMist mist = new EntityMist(world); ExplosionChaos.spawnChlorine(world, x, y, z, gasCloud, gasCloud / 50, 0);
mist.setType(Fluids.CHLORINE);
mist.setPosition(x + 0.5, y + 0.5, z + 0.5);
mist.setArea(gasCloud * 15F / 50F, gasCloud * 7.5F / 50F);
world.spawnEntityInWorld(mist);
} }
return BombReturnCode.DETONATED; return BombReturnCode.DETONATED;

View File

@ -69,7 +69,7 @@ public class ExplosiveCharge extends BlockDetonatable implements IBomb, IDetConn
} }
if(this == ModBlocks.det_nuke) { if(this == ModBlocks.det_nuke) {
world.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(world, BombConfig.missileRadius, x + 0.5, y + 0.5, z + 0.5)); world.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(world, BombConfig.missileRadius, x + 0.5, y + 0.5, z + 0.5));
EntityNukeTorex.statFacStandard(world, x + 0.5, y + 0.5, z + 0.5, BombConfig.missileRadius); EntityNukeTorex.statFac(world, x + 0.5, y + 0.5, z + 0.5, BombConfig.missileRadius);
} }
} }

View File

@ -6,7 +6,11 @@ import com.hbm.blocks.ModBlocks;
import com.hbm.config.ServerConfig; import com.hbm.config.ServerConfig;
import com.hbm.explosion.ExplosionLarge; import com.hbm.explosion.ExplosionLarge;
import com.hbm.explosion.vanillant.ExplosionVNT; import com.hbm.explosion.vanillant.ExplosionVNT;
import com.hbm.explosion.vanillant.standard.*; import com.hbm.explosion.vanillant.standard.BlockAllocatorStandard;
import com.hbm.explosion.vanillant.standard.BlockProcessorStandard;
import com.hbm.explosion.vanillant.standard.EntityProcessorCrossSmooth;
import com.hbm.explosion.vanillant.standard.ExplosionEffectWeapon;
import com.hbm.explosion.vanillant.standard.PlayerProcessorStandard;
import com.hbm.interfaces.IBomb; import com.hbm.interfaces.IBomb;
import com.hbm.items.ModItems; import com.hbm.items.ModItems;
import com.hbm.items.weapon.sedna.factory.XFactoryCatapult; import com.hbm.items.weapon.sedna.factory.XFactoryCatapult;
@ -22,7 +26,6 @@ import net.minecraft.block.BlockFence;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
@ -64,7 +67,8 @@ public class Landmine extends BlockContainer implements IBomb {
if(this == ModBlocks.mine_ap) this.setBlockBounds(5 * f, 0.0F, 5 * f, 11 * f, 1 * f, 11 * f); if(this == ModBlocks.mine_ap) this.setBlockBounds(5 * f, 0.0F, 5 * f, 11 * f, 1 * f, 11 * f);
if(this == ModBlocks.mine_he) this.setBlockBounds(4 * f, 0.0F, 4 * f, 12 * f, 2 * f, 12 * f); if(this == ModBlocks.mine_he) this.setBlockBounds(4 * f, 0.0F, 4 * f, 12 * f, 2 * f, 12 * f);
if(this == ModBlocks.mine_shrap) this.setBlockBounds(5 * f, 0.0F, 5 * f, 11 * f, 1 * f, 11 * f); if(this == ModBlocks.mine_shrap) this.setBlockBounds(5 * f, 0.0F, 5 * f, 11 * f, 1 * f, 11 * f);
if(this == ModBlocks.mine_fat) this.setBlockBounds(5 * f, 0.0F, 4 * f, 11 * f, 6 * f, 12 * f);} if(this == ModBlocks.mine_fat) this.setBlockBounds(5 * f, 0.0F, 4 * f, 11 * f, 6 * f, 12 * f);
}
@Override @Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
@ -129,18 +133,6 @@ public class Landmine extends BlockContainer implements IBomb {
return false; return false;
} }
public boolean isWaterAbove(World world, int x, int y, int z) {
for(int xo = -1; xo <= 1; xo++) {
for(int zo = -1; zo <= 1; zo++) {
Block blockAbove = world.getBlock(x + xo, y + 1, z + zo);
if(blockAbove == Blocks.water || blockAbove == Blocks.flowing_water) {
return true;
}
}
}
return false;
}
@Override @Override
public BombReturnCode explode(World world, int x, int y, int z) { public BombReturnCode explode(World world, int x, int y, int z) {
@ -173,23 +165,6 @@ public class Landmine extends BlockContainer implements IBomb {
ExplosionLarge.spawnShrapnelShower(world, x + 0.5, y + 0.5, z + 0.5, 0, 1D, 0, 45, 0.2D); ExplosionLarge.spawnShrapnelShower(world, x + 0.5, y + 0.5, z + 0.5, 0, 1D, 0, 45, 0.2D);
ExplosionLarge.spawnShrapnels(world, x + 0.5, y + 0.5, z + 0.5, 5); ExplosionLarge.spawnShrapnels(world, x + 0.5, y + 0.5, z + 0.5, 5);
} else if(this == ModBlocks.mine_naval) {
ExplosionVNT vnt = new ExplosionVNT(world, x + 5, y + 5, z + 5, 25F);
vnt.setBlockAllocator(new BlockAllocatorWater(32));
vnt.setBlockProcessor(new BlockProcessorStandard());
vnt.setEntityProcessor(new EntityProcessorCrossSmooth(0.5, ServerConfig.MINE_NAVAL_DAMAGE.get()).setupPiercing(5F, 0.2F));
vnt.setPlayerProcessor(new PlayerProcessorStandard());
vnt.setSFX(new ExplosionEffectWeapon(10, 1F, 0.5F));
vnt.explode();
ExplosionLarge.spawnParticlesRadial(world, x + 0.5, y + 2, z + 0.5, 30);
ExplosionLarge.spawnRubble(world,x + 0.5, y + 0.5, z + 0.5, 5 );
// Only spawn water effects if there's water above the mine
if (isWaterAbove(world, x, y, z)) {
ExplosionLarge.spawnFoam(world, x + 0.5, y + 0.5, z + 0.5, 60);
}
} else if(this == ModBlocks.mine_fat) { } else if(this == ModBlocks.mine_fat) {
ExplosionVNT vnt = new ExplosionVNT(world, x + 0.5, y + 0.5, z + 0.5, 10); ExplosionVNT vnt = new ExplosionVNT(world, x + 0.5, y + 0.5, z + 0.5, 10);
@ -205,7 +180,6 @@ public class Landmine extends BlockContainer implements IBomb {
data.setBoolean("balefire", MainRegistry.polaroidID == 11 || world.rand.nextInt(100) == 0); data.setBoolean("balefire", MainRegistry.polaroidID == 11 || world.rand.nextInt(100) == 0);
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, x + 0.5, y + 0.5, z + 0.5), new TargetPoint(world.provider.dimensionId, x + 0.5, y + 0.5, z + 0.5, 250)); PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, x + 0.5, y + 0.5, z + 0.5), new TargetPoint(world.provider.dimensionId, x + 0.5, y + 0.5, z + 0.5, 250));
world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, "hbm:weapon.mukeExplosion", 25.0F, 0.9F); // this has to be the single worst solution ever
} }
} }

View File

@ -3,17 +3,16 @@ package com.hbm.blocks.bomb;
import java.util.Random; import java.util.Random;
import com.hbm.blocks.ModBlocks; import com.hbm.blocks.ModBlocks;
import com.hbm.config.BombConfig;
import com.hbm.entity.effect.EntityCloudFleija; import com.hbm.entity.effect.EntityCloudFleija;
import com.hbm.entity.effect.EntityCloudFleijaRainbow;
import com.hbm.entity.effect.EntityNukeTorex; import com.hbm.entity.effect.EntityNukeTorex;
import com.hbm.entity.grenade.EntityGrenadeZOMG;
import com.hbm.entity.logic.EntityBalefire; import com.hbm.entity.logic.EntityBalefire;
import com.hbm.entity.logic.EntityNukeExplosionMK3; import com.hbm.entity.logic.EntityNukeExplosionMK3;
import com.hbm.entity.logic.EntityNukeExplosionMK5; import com.hbm.entity.logic.EntityNukeExplosionMK5;
import com.hbm.entity.projectile.EntityFallingNuke; import com.hbm.entity.projectile.EntityFallingNuke;
import com.hbm.explosion.ExplosionChaos;
import com.hbm.explosion.ExplosionLarge; import com.hbm.explosion.ExplosionLarge;
import com.hbm.interfaces.IBomb; import com.hbm.interfaces.IBomb;
import com.hbm.interfaces.NotableComments;
import com.hbm.main.MainRegistry; import com.hbm.main.MainRegistry;
import com.hbm.tileentity.bomb.TileEntityNukeCustom; import com.hbm.tileentity.bomb.TileEntityNukeCustom;
@ -31,10 +30,10 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import net.minecraft.world.World; import net.minecraft.world.World;
// this entire class sucks ass
@NotableComments
public class NukeCustom extends BlockContainer implements IBomb { public class NukeCustom extends BlockContainer implements IBomb {
public TileEntityNukeCustom tetn = new TileEntityNukeCustom();
private static boolean keepInventory = false; private static boolean keepInventory = false;
private final static Random field_149933_a = new Random(); private final static Random field_149933_a = new Random();
@ -135,7 +134,6 @@ public class NukeCustom extends BlockContainer implements IBomb {
public static final int maxAmat = 350; public static final int maxAmat = 350;
public static final int maxSchrab = 250; public static final int maxSchrab = 250;
// genuinely some of the worst fucking code i've ever written
public static void explodeCustom(World worldObj, double xCoord, double yCoord, double zCoord, float tnt, float nuke, float hydro, float amat, float dirty, float schrab, float euph) { public static void explodeCustom(World worldObj, double xCoord, double yCoord, double zCoord, float tnt, float nuke, float hydro, float amat, float dirty, float schrab, float euph) {
dirty = Math.min(dirty, 100); dirty = Math.min(dirty, 100);
@ -143,23 +141,8 @@ public class NukeCustom extends BlockContainer implements IBomb {
/// EUPHEMIUM /// /// EUPHEMIUM ///
if(euph > 0) { if(euph > 0) {
EntityNukeExplosionMK3 ex = new EntityNukeExplosionMK3(worldObj); EntityGrenadeZOMG zomg = new EntityGrenadeZOMG(worldObj, xCoord, yCoord, zCoord);
ex.posX = xCoord; ExplosionChaos.zomgMeSinPi(worldObj, xCoord, yCoord, zCoord, 1000, null, zomg);
ex.posY = yCoord;
ex.posZ = zCoord;
ex.destructionRange = 150;
ex.speed = BombConfig.blastSpeed;
ex.coefficient = 1.0F;
ex.waste = false;
worldObj.spawnEntityInWorld(ex);
worldObj.playSoundEffect(xCoord, yCoord, zCoord, "random.explode", 100000.0F, 1.0F);
EntityCloudFleijaRainbow cloud = new EntityCloudFleijaRainbow(worldObj, 50);
cloud.posX = xCoord;
cloud.posY = yCoord;
cloud.posZ = zCoord;
worldObj.spawnEntityInWorld(cloud);
// SCHRABIDIUM /// // SCHRABIDIUM ///
} else if(schrab > 0) { } else if(schrab > 0) {
@ -196,7 +179,7 @@ public class NukeCustom extends BlockContainer implements IBomb {
dirty *= 0.25F; dirty *= 0.25F;
worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(worldObj, (int)hydro, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5).moreFallout((int)dirty)); worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(worldObj, (int)hydro, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5).moreFallout((int)dirty));
EntityNukeTorex.statFacStandard(worldObj, xCoord + 0.5, yCoord + 5, zCoord + 0.5, hydro); EntityNukeTorex.statFac(worldObj, xCoord + 0.5, yCoord + 5, zCoord + 0.5, hydro);
/// NUCLEAR /// /// NUCLEAR ///
} else if(nuke > 0) { } else if(nuke > 0) {
@ -205,7 +188,7 @@ public class NukeCustom extends BlockContainer implements IBomb {
nuke = Math.min(nuke, maxNuke); nuke = Math.min(nuke, maxNuke);
worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(worldObj, (int)nuke, xCoord + 0.5, yCoord + 5, zCoord + 0.5).moreFallout((int)dirty)); worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(worldObj, (int)nuke, xCoord + 0.5, yCoord + 5, zCoord + 0.5).moreFallout((int)dirty));
EntityNukeTorex.statFacStandard(worldObj, xCoord + 0.5, yCoord + 5, zCoord + 0.5, nuke); EntityNukeTorex.statFac(worldObj, xCoord + 0.5, yCoord + 5, zCoord + 0.5, nuke);
/// NON-NUCLEAR /// /// NON-NUCLEAR ///
} else if(tnt >= 75) { } else if(tnt >= 75) {
@ -213,7 +196,7 @@ public class NukeCustom extends BlockContainer implements IBomb {
tnt = Math.min(tnt, maxTnt); tnt = Math.min(tnt, maxTnt);
worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFacNoRad(worldObj, (int)tnt, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5)); worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFacNoRad(worldObj, (int)tnt, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5));
EntityNukeTorex.statFacStandard(worldObj, xCoord + 0.5, yCoord + 5, zCoord + 0.5, tnt); EntityNukeTorex.statFac(worldObj, xCoord + 0.5, yCoord + 5, zCoord + 0.5, tnt);
} else if(tnt > 0) { } else if(tnt > 0) {
ExplosionLarge.explode(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, tnt, true, true, true); ExplosionLarge.explode(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, tnt, true, true, true);

View File

@ -131,7 +131,7 @@ public class NukeGadget extends BlockContainer implements IBomb {
world.playSoundEffect(x, y, z, "random.explode", 1.0f, world.rand.nextFloat() * 0.1F + 0.9F); world.playSoundEffect(x, y, z, "random.explode", 1.0f, world.rand.nextFloat() * 0.1F + 0.9F);
world.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(world, BombConfig.gadgetRadius, x + 0.5, y + 0.5, z + 0.5)); world.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(world, BombConfig.gadgetRadius, x + 0.5, y + 0.5, z + 0.5));
EntityNukeTorex.statFacStandard(world, x + 0.5, y + 0.5, z + 0.5, BombConfig.gadgetRadius); EntityNukeTorex.statFac(world, x + 0.5, y + 0.5, z + 0.5, BombConfig.gadgetRadius);
} }
return false; return false;

View File

@ -124,7 +124,7 @@ public class NukeMan extends BlockContainer implements IBomb {
world.playSoundEffect(x, y, z, "random.explode", 1.0f, world.rand.nextFloat() * 0.1F + 0.9F); world.playSoundEffect(x, y, z, "random.explode", 1.0f, world.rand.nextFloat() * 0.1F + 0.9F);
world.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(world, BombConfig.manRadius, x + 0.5, y + 0.5, z + 0.5)); world.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(world, BombConfig.manRadius, x + 0.5, y + 0.5, z + 0.5));
EntityNukeTorex.statFacStandard(world, x + 0.5, y + 0.5, z + 0.5, BombConfig.manRadius); EntityNukeTorex.statFac(world, x + 0.5, y + 0.5, z + 0.5, BombConfig.manRadius);
} }
return false; return false;

View File

@ -131,7 +131,7 @@ public class NukeMike extends BlockContainer implements IBomb {
world.playSoundEffect(x, y, z, "random.explode", 1.0f, world.rand.nextFloat() * 0.1F + 0.9F); world.playSoundEffect(x, y, z, "random.explode", 1.0f, world.rand.nextFloat() * 0.1F + 0.9F);
world.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(world, BombConfig.mikeRadius, x + 0.5, y + 0.5, z + 0.5)); world.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(world, BombConfig.mikeRadius, x + 0.5, y + 0.5, z + 0.5));
EntityNukeTorex.statFacStandard(world, x + 0.5, y + 0.5, z + 0.5, BombConfig.mikeRadius); EntityNukeTorex.statFac(world, x + 0.5, y + 0.5, z + 0.5, BombConfig.mikeRadius);
} }
return false; return false;

View File

@ -120,7 +120,7 @@ public class NukeN2 extends BlockContainer implements IBomb {
world.playSoundEffect(x, y, z, "random.explode", 1.0f, world.rand.nextFloat() * 0.1F + 0.9F); world.playSoundEffect(x, y, z, "random.explode", 1.0f, world.rand.nextFloat() * 0.1F + 0.9F);
world.spawnEntityInWorld(EntityNukeExplosionMK5.statFacNoRad(world, r, x + 0.5, y + 0.5, z + 0.5)); world.spawnEntityInWorld(EntityNukeExplosionMK5.statFacNoRad(world, r, x + 0.5, y + 0.5, z + 0.5));
EntityNukeTorex.statFacStandard(world, x + 0.5, y + 0.5, z + 0.5, r); EntityNukeTorex.statFac(world, x + 0.5, y + 0.5, z + 0.5, r);
} }
return false; return false;

View File

@ -129,7 +129,7 @@ public class NukeTsar extends BlockContainer implements IBomb {
tetn.clearSlots(); tetn.clearSlots();
world.playSoundEffect(x, y, z, "random.explode", 1.0f, world.rand.nextFloat() * 0.1F + 0.9F); world.playSoundEffect(x, y, z, "random.explode", 1.0f, world.rand.nextFloat() * 0.1F + 0.9F);
world.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(world, r, x + 0.5, y + 0.5, z + 0.5)); world.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(world, r, x + 0.5, y + 0.5, z + 0.5));
EntityNukeTorex.statFacStandard(world, x + 0.5, y + 0.5, z + 0.5, r); EntityNukeTorex.statFac(world, x + 0.5, y + 0.5, z + 0.5, r);
} }
return false; return false;

View File

@ -60,14 +60,7 @@ public class CoriumFinite extends GenericFiniteFluid {
@Override @Override
public void updateTick(World world, int x, int y, int z, Random rand) { public void updateTick(World world, int x, int y, int z, Random rand) {
// COFH core apparently replaces the water block class with an incompatible type which breaks super.updateTick(world, x, y, z, rand);
// the finite fluid implementation. can't recreate the issue, but according to the provided log
// it seems like this shitty band aid might work
try {
super.updateTick(world, x, y, z, rand);
} catch(ClassCastException ex) {
if(!world.isRemote) world.setBlockToAir(x, y, z);
}
if(!world.isRemote && rand.nextInt(10) == 0 && world.getBlock(x, y - 1, z) != this) { if(!world.isRemote && rand.nextInt(10) == 0 && world.getBlock(x, y - 1, z) != this) {

View File

@ -2,79 +2,38 @@ package com.hbm.blocks.generic;
import java.util.Random; import java.util.Random;
import com.hbm.blocks.BlockEnumMulti;
import com.hbm.blocks.IBlockMulti;
import com.hbm.handler.radiation.ChunkRadiationManager; import com.hbm.handler.radiation.ChunkRadiationManager;
import com.hbm.lib.RefStrings;
import cpw.mods.fml.relauncher.Side; import net.minecraft.block.Block;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockAbsorber extends BlockEnumMulti implements IBlockMulti { public class BlockAbsorber extends Block {
// Enum for tiers they are in order of meta data, 0, 1, 2, 3 for Base, Red, Green, Pink float absorb = 0;
public static enum EnumAbsorberTier {
BASE(2.5F, "absorber"), RED(10F, "absorber_red"), GREEN(100F, "absorber_green"), PINK(10000F, "absorber_pink"); public BlockAbsorber(Material mat, float ab) {
super(mat);
public final float absorbAmount;
public final String textureName;
private EnumAbsorberTier(float absorb, String texture) {
this.absorbAmount = absorb;
this.textureName = texture;
}
}
public BlockAbsorber(Material mat) {
super(mat, EnumAbsorberTier.class, true, true);
this.setTickRandomly(true); this.setTickRandomly(true);
this.setBlockName("rad_absorber"); absorb = ab;
} }
public EnumAbsorberTier getTier(int meta) {
return EnumAbsorberTier.values()[rectify(meta)];
}
@Override
public String getUnlocalizedName(ItemStack stack) {
EnumAbsorberTier tier = getTier(stack.getItemDamage());
String tierName = net.minecraft.util.StatCollector.translateToLocal("tile.rad_absorber." + tier.name().toLowerCase());
return tierName;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(net.minecraft.client.renderer.texture.IIconRegister reg) {
icons = new IIcon[EnumAbsorberTier.values().length];
for(int i = 0; i < icons.length; i++) {
icons[i] = reg.registerIcon(RefStrings.MODID + ":" + EnumAbsorberTier.values()[i].textureName);
}
}
// All that rad math shit that was on there already, did not touch this
// -Wolf
@Override @Override
public int tickRate(World world) { public int tickRate(World world) {
return 10; return 10;
} }
@Override @Override
public void updateTick(World world, int x, int y, int z, Random rand) { public void updateTick(World world, int x, int y, int z, Random rand) {
EnumAbsorberTier tier = getTier(world.getBlockMetadata(x, y, z));
ChunkRadiationManager.proxy.decrementRad(world, x, y, z, tier.absorbAmount); ChunkRadiationManager.proxy.decrementRad(world, x, y, z, absorb);
world.scheduleBlockUpdate(x, y, z, this, tickRate(world)); world.scheduleBlockUpdate(x, y, z, this, this.tickRate(world));
} }
@Override
public void onBlockAdded(World world, int x, int y, int z) { public void onBlockAdded(World world, int x, int y, int z) {
super.onBlockAdded(world, x, y, z); super.onBlockAdded(world, x, y, z);
world.scheduleBlockUpdate(x, y, z, this, tickRate(world));
world.scheduleBlockUpdate(x, y, z, this, this.tickRate(world));
} }
} }

View File

@ -1,161 +0,0 @@
package com.hbm.blocks.generic;
import java.util.ArrayList;
import java.util.List;
import org.lwjgl.opengl.GL11;
import com.hbm.lib.Library;
import com.hbm.render.block.ISBRHUniversal;
import com.hbm.render.util.RenderBlocksNT;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockBarrier extends Block implements ISBRHUniversal {
public BlockBarrier(Material mat) {
super(mat);
}
@Override public int getRenderType() { return renderID; }
@Override public boolean isOpaqueCube() { return false; }
@Override public boolean renderAsNormalBlock() { return false; }
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
if(world.getBlockMetadata(x, y, z) != 0) return;
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
if(i == 0) world.setBlockMetadataWithNotify(x, y, z, 2, 2);
if(i == 1) world.setBlockMetadataWithNotify(x, y, z, 5, 2);
if(i == 2) world.setBlockMetadataWithNotify(x, y, z, 3, 2);
if(i == 3) world.setBlockMetadataWithNotify(x, y, z, 4, 2);
}
@Override
public int onBlockPlaced(World world, int x, int y, int z, int side, float fX, float fY, float fZ, int meta) {
return side >= 2 && side <= 5 ? side : meta;
}
@Override
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
int meta = world.getBlockMetadata(x, y, z);
setBlockBounds(0, 0, 0, 1, 1, 1);
if(meta == Library.POS_X.ordinal()) setBlockBounds(0, 0, 0, 0.125F, 1, 1);
if(meta == Library.POS_Z.ordinal()) setBlockBounds(0, 0, 0, 1, 1, 0.125F);
if(meta == Library.NEG_X.ordinal()) setBlockBounds(0.875F, 0, 0, 1, 1, 1);
if(meta == Library.NEG_Z.ordinal()) setBlockBounds(0, 0, 0.875F, 1, 1, 1);
}
@Override
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB aabb, List list, Entity collider) {
int meta = world.getBlockMetadata(x, y, z);
List<AxisAlignedBB> bbs = new ArrayList();
Block nx = world.getBlock(x - 1, y, z);
Block px = world.getBlock(x + 1, y, z);
Block nz = world.getBlock(x, y, z - 1);
Block pz = world.getBlock(x, y, z + 1);
if(nx.isOpaqueCube() || nx.isNormalCube() || meta == Library.POS_X.ordinal()) bbs.add(AxisAlignedBB.getBoundingBox(x, y, z, x + 0.125, y + 1, z + 1));
if(nz.isOpaqueCube() || nz.isNormalCube() || meta == Library.POS_Z.ordinal()) bbs.add(AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 0.125));
if(px.isOpaqueCube() || px.isNormalCube() || meta == Library.NEG_X.ordinal()) bbs.add(AxisAlignedBB.getBoundingBox(x + 0.875, y, z, x + 1, y + 1, z + 1));
if(pz.isOpaqueCube() || pz.isNormalCube() || meta == Library.NEG_Z.ordinal()) bbs.add(AxisAlignedBB.getBoundingBox(x, y, z + 0.875, x + 1, y + 1, z + 1));
for(AxisAlignedBB bb : bbs) {
if(aabb.intersectsWith(bb)) {
list.add(bb);
}
}
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
return true;
}
@Override
public void renderInventoryBlock(Block block, int meta, int modelId, Object renderBlocks) {
GL11.glPushMatrix();
RenderBlocks renderer = (RenderBlocks) renderBlocks;
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
renderer.setRenderBounds(0.4375, 0D, 0.4375D, 0.5625D, 1D, 0.5625D); RenderBlocksNT.renderStandardInventoryBlock(block, meta, renderer);
renderer.setRenderBounds(0.5D, 0.0625D, 0D, 0.5625D, 0.4725, 1D); RenderBlocksNT.renderStandardInventoryBlock(block, meta, renderer);
renderer.setRenderBounds(0.5D, 0.5625D, 0D, 0.5625D, 0.9375, 1D); RenderBlocksNT.renderStandardInventoryBlock(block, meta, renderer);
GL11.glPopMatrix();
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, Object renderBlocks) {
RenderBlocksNT renderer = RenderBlocksNT.INSTANCE.setWorld(world);
Tessellator tessellator = Tessellator.instance;
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
tessellator.setColorOpaque_F(1, 1, 1);
int meta = world.getBlockMetadata(x, y, z);
Block nx = world.getBlock(x - 1, y, z);
Block px = world.getBlock(x + 1, y, z);
Block nz = world.getBlock(x, y, z - 1);
Block pz = world.getBlock(x, y, z + 1);
Block py = world.getBlock(x, y + 1, z);
boolean negX = nx.isOpaqueCube() || nx.isNormalCube() || meta == Library.POS_X.ordinal();
boolean negZ = nz.isOpaqueCube() || nz.isNormalCube() || meta == Library.POS_Z.ordinal();
boolean posX = px.isOpaqueCube() || px.isNormalCube() || meta == Library.NEG_X.ordinal();
boolean posZ = pz.isOpaqueCube() || pz.isNormalCube() || meta == Library.NEG_Z.ordinal();
boolean posY = py.isOpaqueCube() || py.isNormalCube();
if(negX) {
renderer.setRenderBounds(0D, 0D, 0.4375D, 0.125D, 1D, 0.5625D); renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0D, 0.0625D, negZ ? 0.125D : 0D, 0.0625D, 0.4375D, posZ ? 0.875D : 1D); renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0D, 0.5625D, negZ ? 0.125D : 0D, 0.0625D, 0.9375D, posZ ? 0.875D : 1D); renderer.renderStandardBlock(block, x, y, z);
}
if(negZ) {
renderer.setRenderBounds(0.4375D, 0D, 0D, 0.5625D, 1D, 0.125D); renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(negX ? 0.125D : 0D, 0.0625D, 0D, posX ? 0.875D : 1D, 0.4375D, 0.0625D); renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(negX ? 0.125D : 0D, 0.5625D, 0D, posX ? 0.875D : 1D, 0.9375D, 0.0625D); renderer.renderStandardBlock(block, x, y, z);
}
if(posX) {
renderer.setRenderBounds(0.875D, 0D, 0.4375D, 1D, 1D, 0.5625D); renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.9375D, 0.0625D, negZ ? 0.125D : 0D, 1D, 0.4375D, posZ ? 0.875D : 1D); renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.9375D, 0.5625D, negZ ? 0.125D : 0D, 1D, 0.9375D, posZ ? 0.875D : 1D); renderer.renderStandardBlock(block, x, y, z);
}
if(posZ) {
renderer.setRenderBounds(0.4375D, 0D, 0.875D, 0.5625D, 1D, 1D); renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(negX ? 0.125D : 0D, 0.0625D, 0.9375D, posX ? 0.875D : 1D, 0.4375D, 1D); renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(negX ? 0.125D : 0D, 0.5625D, 0.9375D, posX ? 0.875D : 1D, 0.9375D, 1D); renderer.renderStandardBlock(block, x, y, z);
}
if(posY) {
renderer.setRenderBounds(0D, 0.875D, 0D, 0.125D, 0.9375D, 1D); renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.875D, 0.875D, 0D, 1D, 0.9375D, 1D); renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0D, 0.9375D, 0.0625D, 1D, 1D, 0.4375D); renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0D, 0.9375D, 0.5625D, 1D, 1D, 0.9375D); renderer.renderStandardBlock(block, x, y, z);
}
return true;
}
}

View File

@ -16,7 +16,7 @@ import com.hbm.lib.RefStrings;
import com.hbm.main.MainRegistry; import com.hbm.main.MainRegistry;
import com.hbm.render.block.RenderBlockMultipass; import com.hbm.render.block.RenderBlockMultipass;
import com.hbm.util.EnumUtil; import com.hbm.util.EnumUtil;
import com.hbm.util.i18n.I18nUtil; import com.hbm.util.I18nUtil;
import api.hbm.fluidmk2.IFillableItem; import api.hbm.fluidmk2.IFillableItem;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;

View File

@ -4,8 +4,8 @@ import com.hbm.inventory.gui.GUIScreenBobble;
import com.hbm.items.special.ItemPlasticScrap.ScrapType; import com.hbm.items.special.ItemPlasticScrap.ScrapType;
import com.hbm.main.MainRegistry; import com.hbm.main.MainRegistry;
import com.hbm.tileentity.IGUIProvider; import com.hbm.tileentity.IGUIProvider;
import com.hbm.world.gen.nbt.INBTTileEntityTransformable; import com.hbm.world.gen.INBTTileEntityTransformable;
import com.hbm.world.gen.nbt.INBTBlockTransformable; import com.hbm.world.gen.INBTTransformable;
import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
@ -34,7 +34,7 @@ import net.minecraft.world.World;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
public class BlockBobble extends BlockContainer implements IGUIProvider, INBTBlockTransformable { public class BlockBobble extends BlockContainer implements IGUIProvider, INBTTransformable {
public BlockBobble() { public BlockBobble() {
super(Material.iron); super(Material.iron);
@ -198,7 +198,7 @@ public class BlockBobble extends BlockContainer implements IGUIProvider, INBTBlo
INTELLIGENCE( "Intelligence", "Intelligence", null, "It takes the smartest individuals to realize$there's always more to learn.", false, ScrapType.BRIDGE_BUS), INTELLIGENCE( "Intelligence", "Intelligence", null, "It takes the smartest individuals to realize$there's always more to learn.", false, ScrapType.BRIDGE_BUS),
AGILITY( "Agility", "Agility", null, "Never be afraid to dodge the sensitive issues.", false, ScrapType.BRIDGE_CHIPSET), AGILITY( "Agility", "Agility", null, "Never be afraid to dodge the sensitive issues.", false, ScrapType.BRIDGE_CHIPSET),
LUCK( "Luck", "Luck", null, "There's only one way to give 110%.", false, ScrapType.BRIDGE_CMOS), LUCK( "Luck", "Luck", null, "There's only one way to give 110%.", false, ScrapType.BRIDGE_CMOS),
BOB( "Robert \"The Bobcat\" Katzinsky", "HbMinecraft", "Hbm's Nuclear Tech Mod", "I know where you live, " + System.getProperty("user.name"), false, ScrapType.CPU_SOCKET), BOB( "Robert \"The Bobcat\" Katzinsky", "HbMinecraft", "Hbm's Nuclear Tech Mod", "I know where you live, " + System.getProperty("user.name"), false, ScrapType.CPU_SOCKET),
FRIZZLE( "Frooz", "Frooz", "Weapon models", "BLOOD IS FUEL", true, ScrapType.CPU_CLOCK), FRIZZLE( "Frooz", "Frooz", "Weapon models", "BLOOD IS FUEL", true, ScrapType.CPU_CLOCK),
PU238( "Pu-238", "Pu-238", "Improved Tom impact mechanics", null, false, ScrapType.CPU_REGISTER), PU238( "Pu-238", "Pu-238", "Improved Tom impact mechanics", null, false, ScrapType.CPU_REGISTER),
VT( "VT-6/24", "VT-6/24", "Balefire warhead model and general texturework", "You cannot unfuck a horse.", true, ScrapType.CPU_EXT), VT( "VT-6/24", "VT-6/24", "Balefire warhead model and general texturework", "You cannot unfuck a horse.", true, ScrapType.CPU_EXT),
@ -211,10 +211,9 @@ public class BlockBobble extends BlockContainer implements IGUIProvider, INBTBlo
NOS( "Dr Nostalgia", "Dr Nostalgia", "SSG and Vortex models", "Take a picture, I'ma pose, paparazzi$I've been drinking, moving like a zombie", true, ScrapType.BOARD_TRANSISTOR), NOS( "Dr Nostalgia", "Dr Nostalgia", "SSG and Vortex models", "Take a picture, I'ma pose, paparazzi$I've been drinking, moving like a zombie", true, ScrapType.BOARD_TRANSISTOR),
DRILLGON( "Drillgon200", "Drillgon200", "1.12 Port", null, false, ScrapType.CPU_LOGIC), DRILLGON( "Drillgon200", "Drillgon200", "1.12 Port", null, false, ScrapType.CPU_LOGIC),
CIRNO( "Cirno", "Cirno", "the only multi layered skin i had", "No brain. Head empty.", true, ScrapType.BOARD_BLANK), CIRNO( "Cirno", "Cirno", "the only multi layered skin i had", "No brain. Head empty.", true, ScrapType.BOARD_BLANK),
MICROWAVE( "Microwave", "Microwave", "OC Compatibility and massive RBMK/packet optimizations", "they call me the food heater$john optimization", true, ScrapType.BOARD_CONVERTER), MICROWAVE( "Microwave", "Microwave", "OC Compatibility and massive RBMK/packet optimizations", "they call me the food heater$john optimization", true, ScrapType.BOARD_CONVERTER),
PEEP( "Peep", "LePeeperSauvage", "Coilgun, Leadburster and Congo Lake models, BDCL QC", "Fluffy ears can't hide in ash, nor snow.", true, ScrapType.CARD_BOARD), PEEP( "Peep", "LePeeperSauvage", "Coilgun, Leadburster and Congo Lake models, BDCL QC", "Fluffy ears can't hide in ash, nor snow.", true, ScrapType.CARD_BOARD),
MELLOW( "MELLOWARPEGGIATION", "Mellow", "NBT Structures, industrial lighting, animation tools", "Make something cool now, ask for permission later.", true, ScrapType.CARD_PROCESSOR), MELLOW( "MELLOWARPEGGIATION", "Mellow", "NBT Structures, industrial lighting, animation tools", "Make something cool now, ask for permission later.", true, ScrapType.CARD_PROCESSOR);
ABEL( "Abel1502", "Abel1502", "Abilities GUI, optimizations and many QoL improvements", "NANTO SUBARASHII", true, ScrapType.CPU_REGISTER);
public String name; //the title of the tooltip public String name; //the title of the tooltip
public String label; //the name engraved in the socket public String label; //the name engraved in the socket

View File

@ -7,7 +7,6 @@ import static net.minecraftforge.common.util.ForgeDirection.WEST;
import com.hbm.lib.RefStrings; import com.hbm.lib.RefStrings;
import com.hbm.world.gen.nbt.INBTBlockTransformable;
import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@ -21,7 +20,7 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
public class BlockChain extends Block implements INBTBlockTransformable { public class BlockChain extends Block {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconEnd; private IIcon iconEnd;
@ -202,12 +201,4 @@ public class BlockChain extends Block implements INBTBlockTransformable {
super.onNeighborBlockChange(world, x, y, z, block); super.onNeighborBlockChange(world, x, y, z, block);
} }
@Override
public int transformMeta(int meta, int coordBaseMode) {
if (coordBaseMode == 0) return meta;
if (meta == 0) return meta;
if (meta == 1) return meta;
return INBTBlockTransformable.transformMetaDeco(meta, coordBaseMode);
}
} }

View File

@ -1,15 +1,26 @@
package com.hbm.blocks.generic; package com.hbm.blocks.generic;
import java.util.List;
import java.util.Random; import java.util.Random;
import com.hbm.blocks.ITooltipProvider;
import com.hbm.blocks.ModBlocks; import com.hbm.blocks.ModBlocks;
import com.hbm.items.ModItems; import com.hbm.items.ModItems;
import com.hbm.util.I18nUtil;
import api.hbm.block.IDrillInteraction;
import api.hbm.block.IMiningDrill;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
import net.minecraftforge.common.util.FakePlayer;
public class BlockCluster extends Block { public class BlockCluster extends Block implements IDrillInteraction, ITooltipProvider {
public BlockCluster(Material mat) { public BlockCluster(Material mat) {
super(mat); super(mat);
@ -17,7 +28,32 @@ public class BlockCluster extends Block {
@Override @Override
public Item getItemDropped(int i, Random rand, int j) { public Item getItemDropped(int i, Random rand, int j) {
return getDrop(); return null;
}
@Override
public void harvestBlock(World world, EntityPlayer player, int x, int y, int z, int meta) {
if(player instanceof FakePlayer || player == null) {
return;
}
if(!world.isRemote && world.getGameRules().getGameRuleBooleanValue("doTileDrops") && !world.restoringBlockSnapshots) {
Item drop = getDrop();
if(drop == null)
return;
float f = 0.7F;
double mX = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
double mY = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
double mZ = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
EntityItem entityitem = new EntityItem(world, (double) x + mX, (double) y + mY, (double) z + mZ, new ItemStack(drop));
entityitem.delayBeforeCanPickup = 10;
world.spawnEntityInWorld(entityitem);
}
} }
private Item getDrop() { private Item getDrop() {
@ -29,4 +65,24 @@ public class BlockCluster extends Block {
return null; return null;
} }
@Override
public boolean canBreak(World world, int x, int y, int z, int meta, IMiningDrill drill) {
return drill.getDrillRating() > 70 || world.rand.nextFloat() < 0.05;
}
@Override
public ItemStack extractResource(World world, int x, int y, int z, int meta, IMiningDrill drill) {
return drill.getDrillRating() <= 70 ? new ItemStack(getDrop()) : null;
}
@Override
public float getRelativeHardness(World world, int x, int y, int z, int meta, IMiningDrill drill) {
return this.getBlockHardness(world, x, y, z);
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
list.add(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("trait.tile.cluster"));
}
} }

View File

@ -0,0 +1,78 @@
package com.hbm.blocks.generic;
import java.util.Random;
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.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class BlockCoalBurning extends BlockOutgas {
public BlockCoalBurning(Material mat) {
super(mat, false, 1, false);
this.setTickRandomly(true);
}
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
super.randomDisplayTick(world, x, y, z, rand);
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
if(dir == ForgeDirection.DOWN)
continue;
if(world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ).getMaterial() == Material.air) {
double ix = x + 0.5F + dir.offsetX + rand.nextDouble() - 0.5D;
double iy = y + 0.5F + dir.offsetY + rand.nextDouble() - 0.5D;
double iz = z + 0.5F + dir.offsetZ + rand.nextDouble() - 0.5D;
if(dir.offsetX != 0)
ix = x + 0.5F + dir.offsetX * 0.5 + rand.nextDouble() * 0.125 * dir.offsetX;
if(dir.offsetY != 0)
iy = y + 0.5F + dir.offsetY * 0.5 + rand.nextDouble() * 0.125 * dir.offsetY;
if(dir.offsetZ != 0)
iz = z + 0.5F + dir.offsetZ * 0.5 + rand.nextDouble() * 0.125 * dir.offsetZ;
world.spawnParticle("flame", ix, iy, iz, 0.0, 0.0, 0.0);
world.spawnParticle("smoke", ix, iy, iz, 0.0, 0.0, 0.0);
world.spawnParticle("smoke", ix, iy, iz, 0.0, 0.1, 0.0);
}
}
}
@Override
public Item getItemDropped(int i, Random rand, int j) {
return null;
}
public void breakBlock(World world, int x, int y, int z, Block block, int i) {
super.breakBlock(world, x, y, z, block, i);
world.setBlock(x, y, z, Blocks.fire);
for(int ix = -2; ix <= 2; ix++) {
for(int iy = -2; iy <= 2; iy++) {
for(int iz = -2; iz <= 2; iz++) {
if(Math.abs(ix + iy + iz) < 5 && world.getBlock(x + ix, y + iy, z + iz) == Blocks.air) {
world.setBlock(x + ix, y + iy, z + iz, this.getGas());
}
}
}
}
}
@Override
public void onEntityWalking(World world, int x, int y, int z, Entity entity) {
entity.setFire(3);
}
}

View File

@ -0,0 +1,33 @@
package com.hbm.blocks.generic;
import java.util.Random;
import com.hbm.blocks.ModBlocks;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.world.World;
public class BlockCoalOil extends Block {
public BlockCoalOil(Material mat) {
super(mat);
}
@Override
public void updateTick(World world, int x, int y, int z, Random rand) {
world.setBlock(x, y, z, ModBlocks.ore_coal_oil_burning);
}
@Override
public Item getItemDropped(int i, Random rand, int j) {
return Items.coal;
}
@Override
public int quantityDropped(Random rand) {
return 2 + rand.nextInt(2);
}
}

View File

@ -5,10 +5,8 @@ import java.util.List;
import java.util.Random; import java.util.Random;
import com.hbm.blocks.ModBlocks; import com.hbm.blocks.ModBlocks;
import com.hbm.interfaces.Spaghetti;
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmoSecret; import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmoSecret;
import com.hbm.items.ModItems; import com.hbm.items.ModItems;
import com.hbm.items.machine.ItemBatteryPack.EnumBatteryPack;
import net.minecraft.block.BlockFalling; import net.minecraft.block.BlockFalling;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
@ -18,7 +16,6 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.world.World; import net.minecraft.world.World;
@Spaghetti("this is implemented in the most braindead fucking way imaginable") // TODO: rework this unholy abomination using configurable loot pools
public class BlockCrate extends BlockFalling { public class BlockCrate extends BlockFalling {
List<ItemStack> crateList; List<ItemStack> crateList;
@ -72,16 +69,22 @@ public class BlockCrate extends BlockFalling {
// Lead Crate // Lead Crate
BlockCrate.addToListWithWeight(leadList, ModItems.ingot_uranium, 10); BlockCrate.addToListWithWeight(leadList, ModItems.ingot_uranium, 10);
// BlockCrate.addToListWithWeight(leadList, ModItems.ingot_u235, 5);
BlockCrate.addToListWithWeight(leadList, ModItems.ingot_u238, 8); BlockCrate.addToListWithWeight(leadList, ModItems.ingot_u238, 8);
BlockCrate.addToListWithWeight(leadList, ModItems.ingot_plutonium, 7); BlockCrate.addToListWithWeight(leadList, ModItems.ingot_plutonium, 7);
// BlockCrate.addToListWithWeight(leadList, ModItems.ingot_pu238, 5);
// BlockCrate.addToListWithWeight(leadList, ModItems.ingot_pu239, 4);
BlockCrate.addToListWithWeight(leadList, ModItems.ingot_pu240, 6); BlockCrate.addToListWithWeight(leadList, ModItems.ingot_pu240, 6);
BlockCrate.addToListWithWeight(leadList, ModItems.ingot_neptunium, 7); BlockCrate.addToListWithWeight(leadList, ModItems.ingot_neptunium, 7);
BlockCrate.addToListWithWeight(leadList, ModItems.ingot_uranium_fuel, 8); BlockCrate.addToListWithWeight(leadList, ModItems.ingot_uranium_fuel, 8);
BlockCrate.addToListWithWeight(leadList, ModItems.ingot_plutonium_fuel, 7); BlockCrate.addToListWithWeight(leadList, ModItems.ingot_plutonium_fuel, 7);
BlockCrate.addToListWithWeight(leadList, ModItems.ingot_mox_fuel, 6); BlockCrate.addToListWithWeight(leadList, ModItems.ingot_mox_fuel, 6);
BlockCrate.addToListWithWeight(leadList, ModItems.nugget_uranium, 10); BlockCrate.addToListWithWeight(leadList, ModItems.nugget_uranium, 10);
// BlockCrate.addToListWithWeight(leadList, ModItems.nugget_u235, 5);
BlockCrate.addToListWithWeight(leadList, ModItems.nugget_u238, 8); BlockCrate.addToListWithWeight(leadList, ModItems.nugget_u238, 8);
BlockCrate.addToListWithWeight(leadList, ModItems.nugget_plutonium, 7); BlockCrate.addToListWithWeight(leadList, ModItems.nugget_plutonium, 7);
// BlockCrate.addToListWithWeight(leadList, ModItems.nugget_pu238, 5);
// BlockCrate.addToListWithWeight(leadList, ModItems.nugget_pu239, 4);
BlockCrate.addToListWithWeight(leadList, ModItems.nugget_pu240, 6); BlockCrate.addToListWithWeight(leadList, ModItems.nugget_pu240, 6);
BlockCrate.addToListWithWeight(leadList, ModItems.nugget_neptunium, 7); BlockCrate.addToListWithWeight(leadList, ModItems.nugget_neptunium, 7);
BlockCrate.addToListWithWeight(leadList, ModItems.nugget_uranium_fuel, 8); BlockCrate.addToListWithWeight(leadList, ModItems.nugget_uranium_fuel, 8);
@ -93,25 +96,29 @@ public class BlockCrate extends BlockFalling {
BlockCrate.addToListWithWeight(leadList, ModItems.cell_puf6, 8); BlockCrate.addToListWithWeight(leadList, ModItems.cell_puf6, 8);
BlockCrate.addToListWithWeight(leadList, ModItems.pellet_rtg, 6); BlockCrate.addToListWithWeight(leadList, ModItems.pellet_rtg, 6);
BlockCrate.addToListWithWeight(leadList, ModItems.pellet_rtg_weak, 7); BlockCrate.addToListWithWeight(leadList, ModItems.pellet_rtg_weak, 7);
BlockCrate.addToListWithWeight(leadList, ModItems.tritium_deuterium_cake, 5);
BlockCrate.addToListWithWeight(leadList, ModItems.powder_yellowcake, 10); BlockCrate.addToListWithWeight(leadList, ModItems.powder_yellowcake, 10);
// Metal Crate // Metal Crate
BlockCrate.addToListWithWeight(metalList, Item.getItemFromBlock(ModBlocks.machine_press), 10); 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_difurnace_off), 9);
BlockCrate.addToListWithWeight(metalList, Item.getItemFromBlock(ModBlocks.machine_reactor_breeding), 6); BlockCrate.addToListWithWeight(metalList, Item.getItemFromBlock(ModBlocks.machine_reactor_breeding), 6);
BlockCrate.addToListWithWeight(metalList, Item.getItemFromBlock(ModBlocks.machine_nuke_furnace_off), 7);
BlockCrate.addToListWithWeight(metalList, Item.getItemFromBlock(ModBlocks.machine_wood_burner), 10); 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_diesel), 8);
BlockCrate.addToListWithWeight(metalList, Item.getItemFromBlock(ModBlocks.machine_rtg_grey), 4); BlockCrate.addToListWithWeight(metalList, Item.getItemFromBlock(ModBlocks.machine_rtg_grey), 4);
BlockCrate.addToListWithWeight(metalList, Item.getItemFromBlock(ModBlocks.red_pylon), 9); 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_battery), 8);
BlockCrate.addToListWithWeight(metalList, Item.getItemFromBlock(ModBlocks.machine_lithium_battery), 5);
BlockCrate.addToListWithWeight(metalList, Item.getItemFromBlock(ModBlocks.machine_electric_furnace_off), 8); BlockCrate.addToListWithWeight(metalList, Item.getItemFromBlock(ModBlocks.machine_electric_furnace_off), 8);
BlockCrate.addToListWithWeight(metalList, Item.getItemFromBlock(ModBlocks.machine_assembly_machine), 10); BlockCrate.addToListWithWeight(metalList, Item.getItemFromBlock(ModBlocks.machine_assembler), 10);
BlockCrate.addToListWithWeight(metalList, Item.getItemFromBlock(ModBlocks.machine_fluidtank), 7); BlockCrate.addToListWithWeight(metalList, Item.getItemFromBlock(ModBlocks.machine_fluidtank), 7);
BlockCrate.addToListWithWeight(metalList, ModItems.centrifuge_element, 6); BlockCrate.addToListWithWeight(metalList, ModItems.centrifuge_element, 6);
BlockCrate.addToListWithWeight(metalList, ModItems.motor, 8); BlockCrate.addToListWithWeight(metalList, ModItems.motor, 8);
BlockCrate.addToListWithWeight(metalList, ModItems.coil_tungsten, 7); BlockCrate.addToListWithWeight(metalList, ModItems.coil_tungsten, 7);
BlockCrate.addToListWithWeight(metalList, ModItems.photo_panel, 3); BlockCrate.addToListWithWeight(metalList, ModItems.photo_panel, 3);
BlockCrate.addToListWithWeight(metalList, ModItems.coil_copper, 10); BlockCrate.addToListWithWeight(metalList, ModItems.coil_copper, 10);
BlockCrate.addToListWithWeight(metalList, ModItems.tank_steel, 9);
BlockCrate.addToListWithWeight(metalList, ModItems.blade_titanium, 3); BlockCrate.addToListWithWeight(metalList, ModItems.blade_titanium, 3);
BlockCrate.addToListWithWeight(metalList, ModItems.piston_selenium, 6); BlockCrate.addToListWithWeight(metalList, ModItems.piston_selenium, 6);

View File

@ -2,7 +2,7 @@ package com.hbm.blocks.generic;
import com.hbm.blocks.BlockMulti; import com.hbm.blocks.BlockMulti;
import com.hbm.lib.RefStrings; import com.hbm.lib.RefStrings;
import com.hbm.world.gen.nbt.INBTBlockTransformable; import com.hbm.world.gen.INBTTransformable;
import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
@ -15,7 +15,7 @@ import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockDecoCRT extends BlockMulti implements INBTBlockTransformable { public class BlockDecoCRT extends BlockMulti implements INBTTransformable {
protected String[] variants = new String[] {"crt_clean", "crt_broken", "crt_blinking", "crt_bsod"}; protected String[] variants = new String[] {"crt_clean", "crt_broken", "crt_blinking", "crt_bsod"};
@SideOnly(Side.CLIENT) protected IIcon[] icons; @SideOnly(Side.CLIENT) protected IIcon[] icons;
@ -77,7 +77,7 @@ public class BlockDecoCRT extends BlockMulti implements INBTBlockTransformable {
@Override @Override
public int transformMeta(int meta, int coordBaseMode) { public int transformMeta(int meta, int coordBaseMode) {
return INBTBlockTransformable.transformMetaDecoModel(meta, coordBaseMode); return INBTTransformable.transformMetaDecoModel(meta, coordBaseMode);
} }
} }

View File

@ -1,19 +1,17 @@
package com.hbm.blocks.generic; package com.hbm.blocks.generic;
import com.hbm.blocks.ModBlocks;
import com.hbm.render.block.ct.CT; import com.hbm.render.block.ct.CT;
import com.hbm.render.block.ct.CTStitchReceiver; import com.hbm.render.block.ct.CTStitchReceiver;
import com.hbm.render.block.ct.IBlockCT; import com.hbm.render.block.ct.IBlockCT;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
public class BlockDecoCT extends BlockOre implements IBlockCT { public class BlockDecoCT extends BlockOre implements IBlockCT{
public BlockDecoCT(Material mat) { public BlockDecoCT(Material mat) {
super(mat); super(mat);
@ -37,12 +35,4 @@ public class BlockDecoCT extends BlockOre implements IBlockCT {
public IIcon[] getFragments(IBlockAccess world, int x, int y, int z) { public IIcon[] getFragments(IBlockAccess world, int x, int y, int z) {
return rec.fragCache; return rec.fragCache;
} }
@Override
public boolean canConnect(IBlockAccess world, int x, int y, int z, Block block) {
// i don't care
if(this == ModBlocks.deco_steel && block == ModBlocks.deco_rusty_steel) return true;
if(this == ModBlocks.deco_rusty_steel && block == ModBlocks.deco_steel) return true;
return this == block;
}
} }

View File

@ -1,7 +1,7 @@
package com.hbm.blocks.generic; package com.hbm.blocks.generic;
import com.hbm.blocks.BlockEnumMulti; import com.hbm.blocks.BlockEnumMulti;
import com.hbm.world.gen.nbt.INBTBlockTransformable; import com.hbm.world.gen.INBTTransformable;
import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.client.registry.RenderingRegistry;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
@ -12,7 +12,7 @@ import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockDecoModel extends BlockEnumMulti implements INBTBlockTransformable { public class BlockDecoModel extends BlockEnumMulti implements INBTTransformable {
public BlockDecoModel(Material mat, Class<? extends Enum> theEnum, boolean multiName, boolean multiTexture) { public BlockDecoModel(Material mat, Class<? extends Enum> theEnum, boolean multiName, boolean multiTexture) {
super(mat, theEnum, multiName, multiTexture); super(mat, theEnum, multiName, multiTexture);
@ -108,7 +108,6 @@ public class BlockDecoModel extends BlockEnumMulti implements INBTBlockTransform
@Override @Override
public int transformMeta(int meta, int coordBaseMode) { public int transformMeta(int meta, int coordBaseMode) {
if(coordBaseMode == 0) return meta;
//N: 0b00, S: 0b01, W: 0b10, E: 0b11 //N: 0b00, S: 0b01, W: 0b10, E: 0b11
int rot = meta >> 2; int rot = meta >> 2;
int type = meta & 3; int type = meta & 3;

View File

@ -2,7 +2,7 @@ package com.hbm.blocks.generic;
import com.hbm.blocks.BlockMulti; import com.hbm.blocks.BlockMulti;
import com.hbm.lib.RefStrings; import com.hbm.lib.RefStrings;
import com.hbm.world.gen.nbt.INBTBlockTransformable; import com.hbm.world.gen.INBTTransformable;
import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
@ -17,7 +17,7 @@ import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockDecoToaster extends BlockMulti implements INBTBlockTransformable { public class BlockDecoToaster extends BlockMulti implements INBTTransformable {
protected String[] variants = new String[] {"toaster_iron", "toaster_steel", "toaster_wood"}; protected String[] variants = new String[] {"toaster_iron", "toaster_steel", "toaster_wood"};
@SideOnly(Side.CLIENT) protected IIcon[] icons; @SideOnly(Side.CLIENT) protected IIcon[] icons;
@ -94,7 +94,7 @@ public class BlockDecoToaster extends BlockMulti implements INBTBlockTransformab
@Override @Override
public int transformMeta(int meta, int coordBaseMode) { public int transformMeta(int meta, int coordBaseMode) {
return INBTBlockTransformable.transformMetaDecoModel(meta, coordBaseMode); return INBTTransformable.transformMetaDecoModel(meta, coordBaseMode);
} }
} }

View File

@ -3,7 +3,7 @@ package com.hbm.blocks.generic;
import java.util.List; import java.util.List;
import com.hbm.blocks.ITooltipProvider; import com.hbm.blocks.ITooltipProvider;
import com.hbm.util.i18n.I18nUtil; import com.hbm.util.I18nUtil;
import api.hbm.item.IDepthRockTool; import api.hbm.item.IDepthRockTool;
import net.minecraft.block.Block; import net.minecraft.block.Block;

View File

@ -17,8 +17,6 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
@ -94,7 +92,7 @@ public class BlockDoorGeneric extends BlockDummyable implements IBomb {
@Override @Override
public void addCollisionBoxesToList(World worldIn, int x, int y, int z, AxisAlignedBB entityBox, List collidingBoxes, Entity entityIn) { public void addCollisionBoxesToList(World worldIn, int x, int y, int z, AxisAlignedBB entityBox, List collidingBoxes, Entity entityIn) {
AxisAlignedBB box = getBoundingBox(worldIn, x, y, z, true); AxisAlignedBB box = getBoundingBox(worldIn, x, y ,z);
box = AxisAlignedBB.getBoundingBox( box = AxisAlignedBB.getBoundingBox(
Math.min(box.minX, box.maxX), Math.min(box.minY, box.maxY), Math.min(box.minZ, box.maxZ), Math.min(box.minX, box.maxX), Math.min(box.minY, box.maxY), Math.min(box.minZ, box.maxZ),
Math.max(box.minX, box.maxX), Math.max(box.minY, box.maxY), Math.max(box.minZ, box.maxZ)); Math.max(box.minX, box.maxX), Math.max(box.minY, box.maxY), Math.max(box.minZ, box.maxZ));
@ -113,27 +111,11 @@ public class BlockDoorGeneric extends BlockDummyable implements IBomb {
@Override @Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
AxisAlignedBB aabb = this.getBoundingBox(world, x, y, z, true); AxisAlignedBB aabb = this.getBoundingBox(world, x, y, z);
if(aabb.minX == aabb.maxX && aabb.minY == aabb.maxY && aabb.minZ == aabb.maxZ) return null; if(aabb.minX == aabb.maxX && aabb.minY == aabb.maxY && aabb.minZ == aabb.maxZ) return null;
return aabb; return aabb;
} }
// Enables clicking through the open door
@Override
public MovingObjectPosition collisionRayTrace(World world, int x, int y, int z, Vec3 startVec, Vec3 endVec) {
AxisAlignedBB box = getBoundingBox(world, x, y, z, false);
box = AxisAlignedBB.getBoundingBox(
Math.min(box.minX, box.maxX), Math.min(box.minY, box.maxY), Math.min(box.minZ, box.maxZ),
Math.max(box.minX, box.maxX), Math.max(box.minY, box.maxY), Math.max(box.minZ, box.maxZ)
);
MovingObjectPosition intercept = box.calculateIntercept(startVec, endVec);
if(intercept != null) {
return new MovingObjectPosition(x, y, z, intercept.sideHit, intercept.hitVec);
}
return null;
}
@Override //should fix AI pathfinding @Override //should fix AI pathfinding
public boolean getBlocksMovement(IBlockAccess world, int x, int y, int z) { //btw the method name is the exact opposite of that it's doing, check net.minecraft.pathfinding.PathNavigate#512 public boolean getBlocksMovement(IBlockAccess world, int x, int y, int z) { //btw the method name is the exact opposite of that it's doing, check net.minecraft.pathfinding.PathNavigate#512
return hasExtra(world.getBlockMetadata(x, y, z)); //if it's open return hasExtra(world.getBlockMetadata(x, y, z)); //if it's open
@ -158,11 +140,11 @@ public class BlockDoorGeneric extends BlockDummyable implements IBomb {
@Override @Override
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) { public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) {
return getBoundingBox(world, x, y, z, false); return getBoundingBox(world, x, y, z);
//return AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1); //return AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1);
} }
public AxisAlignedBB getBoundingBox(World world, int x, int y, int z, boolean forCollision) { public AxisAlignedBB getBoundingBox(World world, int x, int y, int z) {
int meta = world.getBlockMetadata(x, y, z); int meta = world.getBlockMetadata(x, y, z);
TileEntity te = world.getTileEntity(x, y, z); TileEntity te = world.getTileEntity(x, y, z);
int[] core = this.findCore(world, x, y, z); int[] core = this.findCore(world, x, y, z);
@ -173,7 +155,7 @@ public class BlockDoorGeneric extends BlockDummyable implements IBomb {
TileEntity te2 = world.getTileEntity(core[0], core[1], core[2]); TileEntity te2 = world.getTileEntity(core[0], core[1], core[2]);
ForgeDirection dir = ForgeDirection.getOrientation(te2.getBlockMetadata() - BlockDummyable.offset); ForgeDirection dir = ForgeDirection.getOrientation(te2.getBlockMetadata() - BlockDummyable.offset);
BlockPos pos = new BlockPos(x - core[0], y - core[1], z - core[2]).rotate(Rotation.getBlockRotation(dir).add(Rotation.COUNTERCLOCKWISE_90)); BlockPos pos = new BlockPos(x - core[0], y - core[1], z - core[2]).rotate(Rotation.getBlockRotation(dir).add(Rotation.COUNTERCLOCKWISE_90));
AxisAlignedBB box = type.getBlockBound(pos.getX(), pos.getY(), pos.getZ(), open, forCollision); AxisAlignedBB box = type.getBlockBound(pos.getX(), pos.getY(), pos.getZ(), open);
switch(te2.getBlockMetadata() - offset){ switch(te2.getBlockMetadata() - offset){
case 2: return AxisAlignedBB.getBoundingBox(x + 1 - box.minX, y + box.minY, z + 1 - box.minZ, x + 1 - box.maxX, y + box.maxY, z + 1 - box.maxZ); case 2: return AxisAlignedBB.getBoundingBox(x + 1 - box.minX, y + box.minY, z + 1 - box.minZ, x + 1 - box.maxX, y + box.maxY, z + 1 - box.maxZ);

View File

@ -55,8 +55,7 @@ public class BlockFissure extends BlockContainer implements IBlockMultiPass {
@Override @Override
public void updateTick(World world, int x, int y, int z, Random rand) { public void updateTick(World world, int x, int y, int z, Random rand) {
boolean crater = world.getBlockMetadata(x, y, z) != 0; if(world.getBlock(x, y + 1, z).isReplaceable(world, x, y + 1, z)) world.setBlock(x, y + 1, z, ModBlocks.volcanic_lava_block);
if(world.getBlock(x, y + 1, z).isReplaceable(world, x, y + 1, z)) world.setBlock(x, y + 1, z, crater ? ModBlocks.rad_lava_block : ModBlocks.volcanic_lava_block);
} }
@Override @Override

View File

@ -5,7 +5,7 @@ import java.util.List;
import com.hbm.blocks.ITooltipProvider; import com.hbm.blocks.ITooltipProvider;
import com.hbm.blocks.ModBlocks; import com.hbm.blocks.ModBlocks;
import com.hbm.lib.RefStrings; import com.hbm.lib.RefStrings;
import com.hbm.util.i18n.I18nUtil; import com.hbm.util.I18nUtil;
import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;

View File

@ -53,7 +53,7 @@ public class BlockLanternBehemoth extends BlockDummyable implements IToolable, I
if(didRepair) { if(didRepair) {
HbmPlayerProps data = HbmPlayerProps.getData(player); HbmPlayerProps data = HbmPlayerProps.getData(player);
if(data.reputation < 25) data.reputation++; data.reputation++;
} }
return didRepair; return didRepair;

View File

@ -1,39 +0,0 @@
package com.hbm.blocks.generic;
import com.hbm.blocks.BlockEnumMulti;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
public class BlockLightstone extends BlockEnumMulti {
public BlockLightstone(Material mat, Class<? extends Enum> theEnum, boolean multiName, boolean multiTexture) {
super(mat, theEnum, multiName, multiTexture);
}
protected IIcon[] topIcons;
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister reg) {
Enum[] enums = theEnum.getEnumConstants();
this.icons = new IIcon[enums.length];
this.topIcons = new IIcon[enums.length];
for(int i = 0; i < icons.length; i++) {
Enum num = enums[i];
this.icons[i] = reg.registerIcon(this.getTextureMultiName(num));
if(i >= 3) this.topIcons[i] = reg.registerIcon(this.getTextureMultiName(num) + ".top");
}
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta) {
return (side == 0 || side == 1) && this.topIcons[meta % this.icons.length] != null ? this.topIcons[meta % this.icons.length] : this.icons[meta % this.icons.length];
}
}

View File

@ -4,7 +4,6 @@ import java.util.Random;
import com.hbm.blocks.ModBlocks; import com.hbm.blocks.ModBlocks;
import com.hbm.items.ModItems; import com.hbm.items.ModItems;
import com.hbm.world.gen.nbt.INBTBlockTransformable;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@ -21,7 +20,7 @@ import net.minecraft.util.Vec3;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockModDoor extends Block implements INBTBlockTransformable { public class BlockModDoor extends Block {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon[] field_150017_a; private IIcon[] field_150017_a;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@ -397,9 +396,4 @@ public class BlockModDoor extends Block implements INBTBlockTransformable {
p_149681_1_.setBlockToAir(p_149681_2_, p_149681_3_ - 1, p_149681_4_); p_149681_1_.setBlockToAir(p_149681_2_, p_149681_3_ - 1, p_149681_4_);
} }
} }
@Override
public int transformMeta(int meta, int coordBaseMode) {
return INBTBlockTransformable.transformMetaDoor(meta, coordBaseMode);
}
} }

View File

@ -35,17 +35,13 @@ public class BlockMultiSlab extends BlockSlab implements IStepTickReceiver {
if(single == null) { if(single == null) {
for(int i = 0; i < slabMaterials.length; i++) { for(int i = 0; i < slabMaterials.length; i++) {
recipeGen.add(new Object[] {slabMaterials[i], 0, this, i}); recipeGen.add(new Object[] {slabMaterials[i], this, i});
} }
} }
this.setBlockTextureName(RefStrings.MODID + ":concrete"); this.setBlockTextureName(RefStrings.MODID + ":concrete");
} }
public BlockMultiSlab(boolean b, Material mat) {
super(b, mat);
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta) { public IIcon getIcon(int side, int meta) {
@ -64,8 +60,7 @@ public class BlockMultiSlab extends BlockSlab implements IStepTickReceiver {
return new ItemStack(Item.getItemFromBlock(single != null ? single : this), 2, (meta & 7) % slabMaterials.length); return new ItemStack(Item.getItemFromBlock(single != null ? single : this), 2, (meta & 7) % slabMaterials.length);
} }
@Override @SideOnly(Side.CLIENT)
@SideOnly(Side.CLIENT)
public Item getItem(World world, int x, int y, int z) { public Item getItem(World world, int x, int y, int z) {
return Item.getItemFromBlock(single != null ? single : this); return Item.getItemFromBlock(single != null ? single : this);
} }
@ -82,7 +77,6 @@ public class BlockMultiSlab extends BlockSlab implements IStepTickReceiver {
return (super.getDamageValue(world, x, y, z) & 7) % slabMaterials.length; return (super.getDamageValue(world, x, y, z) & 7) % slabMaterials.length;
} }
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubBlocks(Item item, CreativeTabs tab, List list) { public void getSubBlocks(Item item, CreativeTabs tab, List list) {

View File

@ -1,48 +0,0 @@
package com.hbm.blocks.generic;
import com.hbm.lib.RefStrings;
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.util.IIcon;
public class BlockMultiSlabMeta extends BlockMultiSlab {
public int[] metas;
public BlockMultiSlabMeta(Block single, Material mat, Block[] slabMaterials, int...metas) {
super(single != null, mat);
this.single = single;
this.slabMaterials = slabMaterials;
this.metas = new int[slabMaterials.length]; //initialized to 0s
for(int i = 0; i < metas.length; i++) {
this.metas[i] = metas[i];
}
this.useNeighborBrightness = true;
if(single == null) {
for(int i = 0; i < slabMaterials.length; i++) {
recipeGen.add(new Object[] {slabMaterials[i], metas[i], this, i});
}
}
this.setBlockTextureName(RefStrings.MODID + ":concrete");
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta) {
meta = (meta & 7) % slabMaterials.length;
Block block = slabMaterials[meta];
return block.getIcon(side, metas[meta]);
}
@Override
public String func_150002_b(int meta) {
meta = (meta & 7) % slabMaterials.length;
return super.func_150002_b(meta) + "." + metas[meta];
}
}

View File

@ -9,8 +9,6 @@ import com.hbm.blocks.ModBlocks;
import com.hbm.blocks.generic.BlockDeadPlant.EnumDeadPlantType; import com.hbm.blocks.generic.BlockDeadPlant.EnumDeadPlantType;
import com.hbm.blocks.generic.BlockTallPlant.EnumTallFlower; import com.hbm.blocks.generic.BlockTallPlant.EnumTallFlower;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.IGrowable; import net.minecraft.block.IGrowable;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
@ -18,7 +16,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.ColorizerGrass;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.EnumPlantType; import net.minecraftforge.common.EnumPlantType;
@ -202,43 +199,6 @@ public class BlockNTMFlower extends BlockEnumMulti implements IPlantable, IGrowa
this.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0); this.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
} }
@SideOnly(Side.CLIENT)
public int getRenderColor(int meta)
{
if (meta == 1 || meta == 3) {
return ColorizerGrass.getGrassColor(0.5D, 1.0D);
} else return 0xFFFFFF;
}
// if you need to make another tinted plant just throw the metadata value
// into the if statements above and below i really do not want to make this more
// complicated than it needs to be
@SideOnly(Side.CLIENT)
public int colorMultiplier(IBlockAccess world, int x, int y, int z)
{
int l = 0;
int i1 = 0;
int j1 = 0;
for (int k1 = -1; k1 <= 1; ++k1)
{
for (int l1 = -1; l1 <= 1; ++l1)
{
int i2 = world.getBiomeGenForCoords(x + l1, z + k1).getBiomeFoliageColor(x + l1, y, z + k1);
l += (i2 & 16711680) >> 16;
i1 += (i2 & 65280) >> 8;
j1 += i2 & 255;
}
}
int meta = world.getBlockMetadata(x, y, z);
if (meta == 1 || meta == 3) {
return ((l / 9 & 255) << 16 | (i1 / 9 & 255) << 8 | j1 / 9 & 255);
} else return 0xFFFFFF;
}
@Override @Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) { } public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) { }
} }

View File

@ -1,79 +0,0 @@
package com.hbm.blocks.generic;
import java.util.Locale;
import java.util.Random;
import com.hbm.blocks.BlockEnumMulti;
import com.hbm.lib.RefStrings;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFalling;
import net.minecraft.block.material.Material;
import net.minecraft.entity.item.EntityFallingBlock;
import net.minecraft.world.World;
public class BlockNTMSand extends BlockEnumMulti {
public BlockNTMSand(Material mat) {
super(mat, EnumSandType.class, true, true);
}
@Override
public void onBlockAdded(World world, int x, int y, int z) {
world.scheduleBlockUpdate(x, y, z, this, this.tickRate(world));
}
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block b) {
world.scheduleBlockUpdate(x, y, z, this, this.tickRate(world));
}
@Override
public void updateTick(World world, int x, int y, int z, Random rand) {
if(!world.isRemote) {
this.fall(world, x, y, z);
}
}
private void fall(World world, int x, int y, int z) {
if(BlockFalling.func_149831_e(world, x, y - 1, z) && y >= 0) {
byte b0 = 32;
if(!BlockFalling.fallInstantly && world.checkChunksExist(x - b0, y - b0, z - b0, x + b0, y + b0, z + b0)) {
if(!world.isRemote) {
EntityFallingBlock entityfallingblock = new EntityFallingBlock(world, x + 0.5, y + 0.5, z + 0.5, this, world.getBlockMetadata(x, y, z));
world.spawnEntityInWorld(entityfallingblock);
}
} else {
world.setBlockToAir(x, y, z);
while(BlockFalling.func_149831_e(world, x, y - 1, z) && y > 0) {
--y;
}
if(y > 0) {
world.setBlock(x, y, z, this);
}
}
}
}
@Override
public int tickRate(World p_149738_1_) {
return 2;
}
@Override
public String getTextureMultiName(Enum num) {
return RefStrings.MODID + ":sand_" + num.name().toLowerCase(Locale.US);
}
@Override
public String getUnlocalizedMultiName(Enum num) {
return "tile.sand_" + num.name().toLowerCase(Locale.US);
}
public static enum EnumSandType {
BORON, LEAD, URANIUM, POLONIUM, QUARTZ
}
}

View File

@ -1,60 +0,0 @@
package com.hbm.blocks.generic;
import net.minecraft.block.Block;
import net.minecraft.block.BlockTrapDoor;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockNTMTrapdoor extends BlockTrapDoor {
public BlockNTMTrapdoor(Material material) {
super(material);
}
@Override
public boolean isLadder(IBlockAccess world, int x, int y, int z, EntityLivingBase entity) {
int meta = world.getBlockMetadata(x, y, z);
// isOpen
if (!func_150118_d(meta))
return false;
Block blockBelow = world.getBlock(x, y - 1, z);
return blockBelow != null && blockBelow.isLadder(world, x, y - 1, z, entity);
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
// Make the hitbox in-line with ladders, if relevant
if (isLadder(world, x, y, z, null)) {
int meta = world.getBlockMetadata(x, y, z);
float thickness = 0.125F;
if ((meta & 3) == 0)
return AxisAlignedBB.getBoundingBox(x, y, z + 1F - thickness, x + 1F, y + 1F, z + 1F);
if ((meta & 3) == 1)
return AxisAlignedBB.getBoundingBox(x, y, z, x + 1F, y + 1F, z + thickness);
if ((meta & 3) == 2)
return AxisAlignedBB.getBoundingBox(x + 1F - thickness, y, z, x + 1F, y + 1F, z + 1F);
if ((meta & 3) == 3)
return AxisAlignedBB.getBoundingBox(x, y, z, x + thickness, y + 1F, z + 1F);
}
return super.getCollisionBoundingBoxFromPool(world, x, y, z);
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
// The original code prevented manual operation of Material.iron trapdoors. This bypasses that behavior
int meta = world.getBlockMetadata(x, y, z);
world.setBlockMetadataWithNotify(x, y, z, meta ^ 4, 2);
world.playAuxSFXAtEntity(player, 1003, x, y, z, 0);
return true;
}
}

View File

@ -68,6 +68,9 @@ public class BlockOre extends Block {
if(this == ModBlocks.ore_nether_fire) { if(this == ModBlocks.ore_nether_fire) {
return rand.nextInt(10) == 0 ? ModItems.ingot_phosphorus : ModItems.powder_fire; return rand.nextInt(10) == 0 ? ModItems.ingot_phosphorus : ModItems.powder_fire;
} }
if(this == ModBlocks.block_meteor) {
return rand.nextInt(10) == 0 ? ModItems.plate_dalekanium : Item.getItemFromBlock(ModBlocks.block_meteor);
}
if(this == ModBlocks.block_meteor_cobble) { if(this == ModBlocks.block_meteor_cobble) {
return ModItems.fragment_meteorite; return ModItems.fragment_meteorite;
} }

View File

@ -50,7 +50,7 @@ public class BlockOutgas extends BlockOre {
if(this == ModBlocks.ancient_scrap) if(this == ModBlocks.ancient_scrap)
return ModBlocks.gas_radon_tomb; return ModBlocks.gas_radon_tomb;
if(this == ModBlocks.ore_nether_coal) { if(this == ModBlocks.ore_coal_oil_burning || this == ModBlocks.ore_nether_coal) {
return ModBlocks.gas_monoxide; return ModBlocks.gas_monoxide;
} }

View File

@ -2,7 +2,6 @@ package com.hbm.blocks.generic;
import java.util.List; import java.util.List;
import com.hbm.extprop.HbmPlayerProps;
import com.hbm.inventory.recipes.PedestalRecipes; import com.hbm.inventory.recipes.PedestalRecipes;
import com.hbm.inventory.recipes.PedestalRecipes.PedestalRecipe; import com.hbm.inventory.recipes.PedestalRecipes.PedestalRecipe;
import com.hbm.lib.RefStrings; import com.hbm.lib.RefStrings;
@ -59,26 +58,41 @@ public class BlockPedestal extends BlockContainer {
public static int renderID = RenderingRegistry.getNextAvailableRenderId(); public static int renderID = RenderingRegistry.getNextAvailableRenderId();
@Override public int getRenderType() { return renderID; } @Override
@Override public boolean isOpaqueCube() { return false; } public int getRenderType() {
@Override public boolean renderAsNormalBlock() { return false; } return renderID;
@Override @SideOnly(Side.CLIENT) public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) { return true; } }
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
return true;
}
@Override @Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { 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()) return false; if(player.isSneaking()) return false;
TileEntityPedestal pedestal = (TileEntityPedestal) world.getTileEntity(x, y, z); TileEntityPedestal pedestal = (TileEntityPedestal) world.getTileEntity(x, y, z);
if(pedestal.item == null && player.getHeldItem() != null) { if(pedestal.item == null && player.getHeldItem() != null) {
if(world.isRemote) return true;
pedestal.item = player.getHeldItem().copy(); pedestal.item = player.getHeldItem().copy();
player.inventory.mainInventory[player.inventory.currentItem] = null; player.inventory.mainInventory[player.inventory.currentItem] = null;
pedestal.markDirty(); pedestal.markDirty();
world.markBlockForUpdate(x, y, z); world.markBlockForUpdate(x, y, z);
return true; return true;
} else if(pedestal.item != null && player.getHeldItem() == null) { } else if(pedestal.item != null && player.getHeldItem() == null) {
if(world.isRemote) return true;
player.inventory.mainInventory[player.inventory.currentItem] = pedestal.item.copy(); player.inventory.mainInventory[player.inventory.currentItem] = pedestal.item.copy();
pedestal.item = null; pedestal.item = null;
pedestal.markDirty(); pedestal.markDirty();
@ -119,11 +133,9 @@ public class BlockPedestal extends BlockContainer {
TileEntityPedestal se = castOrNull(Compat.getTileStandard(world, x + ForgeDirection.SOUTH.offsetX * 2 + ForgeDirection.EAST.offsetX * 2, y, z + ForgeDirection.SOUTH.offsetZ * 2 + ForgeDirection.EAST.offsetZ * 2)); TileEntityPedestal se = castOrNull(Compat.getTileStandard(world, x + ForgeDirection.SOUTH.offsetX * 2 + ForgeDirection.EAST.offsetX * 2, y, z + ForgeDirection.SOUTH.offsetZ * 2 + ForgeDirection.EAST.offsetZ * 2));
TileEntityPedestal[] tileArray = new TileEntityPedestal[] {nw, n, ne, w, center, e, sw, s, se}; TileEntityPedestal[] tileArray = new TileEntityPedestal[] {nw, n, ne, w, center, e, sw, s, se};
List<EntityPlayer> nearbyPlayers = world.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1).expand(20, 20, 20));
outer: for(PedestalRecipe recipe : PedestalRecipes.recipes) { outer: for(PedestalRecipe recipe : PedestalRecipes.recipes) {
/// EXTRA CONDITIONS ///
if(recipe.extra == recipe.extra.FULL_MOON) { if(recipe.extra == recipe.extra.FULL_MOON) {
if(world.getCelestialAngle(0) < 0.35 || world.getCelestialAngle(0) > 0.65) continue; if(world.getCelestialAngle(0) < 0.35 || world.getCelestialAngle(0) > 0.65) continue;
if(world.provider.getMoonPhase(world.getWorldInfo().getWorldTime()) != 0) continue; if(world.provider.getMoonPhase(world.getWorldInfo().getWorldTime()) != 0) continue;
@ -138,19 +150,6 @@ public class BlockPedestal extends BlockContainer {
if(world.getCelestialAngle(0) > 0.15 && world.getCelestialAngle(0) < 0.85) continue; if(world.getCelestialAngle(0) > 0.15 && world.getCelestialAngle(0) < 0.85) continue;
} }
if(recipe.extra == recipe.extra.BAD_KARMA) {
boolean matches = false;
for(EntityPlayer player : nearbyPlayers) if(HbmPlayerProps.getData(player).reputation <= -10) { matches = true; break; }
if(!matches) continue;
}
if(recipe.extra == recipe.extra.GOOD_KARMA) {
boolean matches = false;
for(EntityPlayer player : nearbyPlayers) if(HbmPlayerProps.getData(player).reputation >= 10) { matches = true; break; }
if(!matches) continue;
}
/// CHECK ITEMS ///
for(int i = 0; i < 9; i++) { for(int i = 0; i < 9; i++) {
ItemStack pedestal = tileArray[i] != null ? tileArray[i].item : null; ItemStack pedestal = tileArray[i] != null ? tileArray[i].item : null;
if(pedestal == null && recipe.input[i] != null) continue outer; if(pedestal == null && recipe.input[i] != null) continue outer;
@ -160,7 +159,6 @@ public class BlockPedestal extends BlockContainer {
if(!recipe.input[i].matchesRecipe(pedestal, true) || recipe.input[i].stacksize != pedestal.stackSize) continue outer; if(!recipe.input[i].matchesRecipe(pedestal, true) || recipe.input[i].stacksize != pedestal.stackSize) continue outer;
} }
/// REMOVE ITEMS ///
for(int i = 0; i < 9; i++) { for(int i = 0; i < 9; i++) {
if(i == 4) continue; if(i == 4) continue;
ItemStack pedestal = tileArray[i] != null ? tileArray[i].item : null; ItemStack pedestal = tileArray[i] != null ? tileArray[i].item : null;
@ -170,7 +168,6 @@ public class BlockPedestal extends BlockContainer {
world.markBlockForUpdate(tileArray[i].xCoord, tileArray[i].yCoord, tileArray[i].zCoord); world.markBlockForUpdate(tileArray[i].xCoord, tileArray[i].yCoord, tileArray[i].zCoord);
} }
/// PRODUCE RESULT ///
center.item = recipe.output.copy(); center.item = recipe.output.copy();
center.markDirty(); center.markDirty();
world.markBlockForUpdate(x, y, z); world.markBlockForUpdate(x, y, z);
@ -194,7 +191,10 @@ public class BlockPedestal extends BlockContainer {
public ItemStack item; public ItemStack item;
@Override public boolean canUpdate() { return false; } @Override
public boolean canUpdate() {
return false;
}
@Override @Override
public Packet getDescriptionPacket() { public Packet getDescriptionPacket() {

View File

@ -4,7 +4,7 @@ import java.util.List;
import com.hbm.blocks.ITooltipProvider; import com.hbm.blocks.ITooltipProvider;
import com.hbm.lib.RefStrings; import com.hbm.lib.RefStrings;
import com.hbm.world.gen.nbt.INBTBlockTransformable; import com.hbm.world.gen.INBTTransformable;
import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
@ -17,7 +17,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockPipe extends Block implements ITooltipProvider, INBTBlockTransformable { public class BlockPipe extends Block implements ITooltipProvider, INBTTransformable {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon sideIcon; private IIcon sideIcon;
@ -96,7 +96,7 @@ public class BlockPipe extends Block implements ITooltipProvider, INBTBlockTrans
@Override @Override
public int transformMeta(int meta, int coordBaseMode) { public int transformMeta(int meta, int coordBaseMode) {
return INBTBlockTransformable.transformMetaPillar(meta, coordBaseMode); return INBTTransformable.transformMetaPillar(meta, coordBaseMode);
} }
} }

View File

@ -10,33 +10,49 @@ import net.minecraft.item.Item;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World; import net.minecraft.world.World;
@Deprecated
public class BlockPlasma extends Block { public class BlockPlasma extends Block {
public BlockPlasma(Material p_i45394_1_) { public BlockPlasma(Material p_i45394_1_) {
super(p_i45394_1_); super(p_i45394_1_);
this.setTickRandomly(true); this.setTickRandomly(true);
} }
@Override @Override
public void updateTick(World world, int x, int y, int z, Random rand) { public void updateTick(World world, int x, int y, int z, Random rand)
if(world.getGameRules().getGameRuleBooleanValue("doFireTick")) {
world.setBlock(x, y, z, Blocks.air); if (world.getGameRules().getGameRuleBooleanValue("doFireTick"))
} world.setBlock(x, y, z, Blocks.air);
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_)
{
return null;
}
@Override
public void onEntityCollidedWithBlock(World p_149670_1_, int p_149670_2_, int p_149670_3_, int p_149670_4_, Entity p_149670_5_)
{
p_149670_5_.setFire(10);
p_149670_5_.setInWeb();
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override @Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) { public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
{
return null; return null;
} }
@Override @Override
public void onEntityCollidedWithBlock(World p_149670_1_, int p_149670_2_, int p_149670_3_, int p_149670_4_, Entity p_149670_5_) { public boolean renderAsNormalBlock()
p_149670_5_.setFire(10); {
p_149670_5_.setInWeb(); return false;
} }
@Override public boolean isOpaqueCube() { return false; }
@Override public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { return null; }
@Override public boolean renderAsNormalBlock() { return false; }
} }

View File

@ -5,8 +5,6 @@ import java.util.Random;
import com.hbm.blocks.IBlockMulti; import com.hbm.blocks.IBlockMulti;
import com.hbm.blocks.ITooltipProvider; import com.hbm.blocks.ITooltipProvider;
import com.hbm.world.gen.nbt.INBTTileEntityTransformable;
import com.hbm.world.gen.nbt.INBTBlockTransformable;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@ -29,7 +27,7 @@ import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.StatCollector; import net.minecraft.util.StatCollector;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockPlushie extends BlockContainer implements IBlockMulti, ITooltipProvider, INBTBlockTransformable { public class BlockPlushie extends BlockContainer implements IBlockMulti, ITooltipProvider {
public BlockPlushie() { public BlockPlushie() {
super(Material.cloth); super(Material.cloth);
@ -96,26 +94,17 @@ public class BlockPlushie extends BlockContainer implements IBlockMulti, IToolti
@Override @Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
TileEntityPlushie plushie = (TileEntityPlushie) world.getTileEntity(x, y, z);
if(world.isRemote) { if(world.isRemote) {
TileEntityPlushie plushie = (TileEntityPlushie) world.getTileEntity(x, y, z);
plushie.squishTimer = 11; plushie.squishTimer = 11;
return true; return true;
} else { } else {
if(plushie.type == PlushieType.HUNDUN) { world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, "hbm:block.squeakyToy", 0.25F, 1F);
world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, "hbm:block.hunduns_magnificent_howl", 100F, 1F);
} else {
world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, "hbm:block.squeakyToy", 0.25F, 1F);
}
return true; return true;
} }
} }
@Override public static class TileEntityPlushie extends TileEntity {
public int transformMeta(int meta, int coordBaseMode) {
return (meta + coordBaseMode * 4) % 16;
}
public static class TileEntityPlushie extends TileEntity implements INBTTileEntityTransformable {
public PlushieType type = PlushieType.NONE; public PlushieType type = PlushieType.NONE;
public int squishTimer; public int squishTimer;
@ -148,19 +137,13 @@ public class BlockPlushie extends BlockContainer implements IBlockMulti, IToolti
super.writeToNBT(nbt); super.writeToNBT(nbt);
nbt.setByte("type", (byte) type.ordinal()); nbt.setByte("type", (byte) type.ordinal());
} }
@Override
public void transformTE(World world, int coordBaseMode) {
type = PlushieType.values()[world.rand.nextInt(PlushieType.values().length - 1) + 1];
}
} }
public static enum PlushieType { public static enum PlushieType {
NONE( "NONE", null), NONE( "NONE", null),
YOMI( "Yomi", "Hi! Can I be your rabbit friend?"), YOMI( "Yomi", "Hi! Can I be your rabbit friend?"),
NUMBERNINE( "Number Nine", "None of y'all deserve coal."), NUMBERNINE( "Number Nine", "None of y'all deserve coal."),
HUNDUN( "Hundun", "混沌"), POOH( "Winnie the Pooh", "Beloved children's character with no malicious intent.");
DERG( "Dragon", "Squeeze him.");
public String label; public String label;
public String inscription; public String inscription;

View File

@ -1,497 +0,0 @@
package com.hbm.blocks.generic;
import java.util.ArrayList;
import java.util.List;
import org.lwjgl.opengl.GL11;
import com.hbm.blocks.ModBlocks;
import com.hbm.config.ClientConfig;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.items.ModItems;
import com.hbm.items.tool.ItemRebarPlacer;
import com.hbm.lib.Library;
import com.hbm.lib.RefStrings;
import com.hbm.main.MainRegistry;
import com.hbm.main.ServerProxy;
import com.hbm.render.block.ISBRHUniversal;
import com.hbm.render.util.RenderBlocksNT;
import com.hbm.tileentity.IBufPacketReceiver;
import com.hbm.tileentity.TileEntityLoadedBase;
import com.hbm.tileentity.network.TileEntityPipeBaseNT;
import com.hbm.uninos.GenNode;
import com.hbm.uninos.INetworkProvider;
import com.hbm.uninos.UniNodespace;
import com.hbm.uninos.networkproviders.RebarNetwork;
import com.hbm.uninos.networkproviders.RebarNetworkProvider;
import com.hbm.util.BobMathUtil;
import com.hbm.util.Compat;
import com.hbm.util.InventoryUtil;
import com.hbm.util.fauxpointtwelve.BlockPos;
import com.hbm.util.fauxpointtwelve.DirPos;
import api.hbm.fluidmk2.IFluidReceiverMK2;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.MovingObjectPosition.MovingObjectType;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class BlockRebar extends BlockContainer implements ISBRHUniversal {
@SideOnly(Side.CLIENT) protected IIcon concrete;
public BlockRebar() {
super(Material.iron);
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister reg) {
super.registerBlockIcons(reg);
this.concrete = reg.registerIcon(RefStrings.MODID + ":concrete_liquid");
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return new TileEntityRebar();
}
@Override public int getRenderType() { return renderID; }
@Override public boolean isOpaqueCube() { return false; }
@Override public boolean renderAsNormalBlock() { return false; }
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
return true;
}
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
TileEntity tile = world.getTileEntity(x, y, z);
if(!(tile instanceof TileEntityRebar)) return;
TileEntityRebar rebar = (TileEntityRebar) tile;
rebar.hasConnection = false;
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
TileEntity neighbor = Compat.getTileStandard(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
if(neighbor instanceof TileEntityPipeBaseNT) {
rebar.hasConnection = true;
return;
}
}
}
public static class TileEntityRebar extends TileEntityLoadedBase implements IFluidReceiverMK2, IBufPacketReceiver {
public Block concrete;
public int concreteMeta;
public int progress;
public int prevProgress;
protected RebarNode node;
public boolean hasConnection = false;
public TileEntityRebar setup(Block b, int m) {
this.concrete = b;
this.concreteMeta = m;
return this;
}
@Override
public void updateEntity() {
long time = worldObj.getTotalWorldTime();
if(!worldObj.isRemote) {
if(prevProgress != progress) {
worldObj.markTileEntityChunkModified(xCoord, yCoord, zCoord, this);
prevProgress = progress;
}
if(this.progress >= 1_000) {
if(concrete != null && ItemRebarPlacer.isValidConk(Item.getItemFromBlock(concrete), concreteMeta)) {
worldObj.setBlock(xCoord, yCoord, zCoord, concrete, concreteMeta, 3);
} else {
worldObj.setBlock(xCoord, yCoord, zCoord, ModBlocks.concrete_rebar);
}
return;
}
if(time % 60 == 0) {
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
this.trySubscribe(Fluids.CONCRETE, worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir);
}
}
if(this.node == null || this.node.expired) {
this.node = (RebarNode) UniNodespace.getNode(worldObj, xCoord, yCoord, zCoord, RebarNetworkProvider.THE_PROVIDER);
if(this.node == null || this.node.expired) {
this.node = this.createNode();
UniNodespace.createNode(worldObj, this.node);
}
}
this.networkPackNT(100);
}
}
@Override
public void invalidate() {
super.invalidate();
if(!worldObj.isRemote) {
if(this.node != null) {
UniNodespace.destroyNode(worldObj, xCoord, yCoord, zCoord, RebarNetworkProvider.THE_PROVIDER);
}
}
}
@Override public void serialize(ByteBuf buf) { buf.writeInt(progress); }
@Override public void deserialize(ByteBuf buf) { this.progress = buf.readInt(); }
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
this.progress = nbt.getInteger("progress");
this.hasConnection = nbt.getBoolean("hasConnection");
if(nbt.hasKey("block")) {
this.concrete = Block.getBlockById(nbt.getInteger("block"));
this.concreteMeta = nbt.getInteger("meta");
}
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
nbt.setInteger("progress", this.progress);
nbt.setBoolean("hasConnection", this.hasConnection);
if(this.concrete != null) {
nbt.setInteger("block", Block.getIdFromBlock(this.concrete));
nbt.setInteger("meta", this.concreteMeta);
}
}
public RebarNode createNode() {
TileEntity tile = (TileEntity) this;
return new RebarNode(RebarNetworkProvider.THE_PROVIDER, new BlockPos(tile.xCoord, tile.yCoord, tile.zCoord)).setConnections(
new DirPos(tile.xCoord + 1, tile.yCoord, tile.zCoord, Library.POS_X),
new DirPos(tile.xCoord - 1, tile.yCoord, tile.zCoord, Library.NEG_X),
new DirPos(tile.xCoord, tile.yCoord + 1, tile.zCoord, Library.POS_Y),
new DirPos(tile.xCoord, tile.yCoord - 1, tile.zCoord, Library.NEG_Y),
new DirPos(tile.xCoord, tile.yCoord, tile.zCoord + 1, Library.POS_Z),
new DirPos(tile.xCoord, tile.yCoord, tile.zCoord - 1, Library.NEG_Z)
);
}
@Override
public FluidTank[] getAllTanks() {
FluidTank tank = new FluidTank(Fluids.CONCRETE, 1_000);
tank.setFill(progress);
return new FluidTank[] {tank};
}
@Override
public long transferFluid(FluidType type, int pressure, long amount) {
if(type != Fluids.CONCRETE) return amount;
if(this.node == null || this.node.expired || !this.node.hasValidNet()) return amount;
List<TileEntityRebar> lowestLinks = new ArrayList();
int lowestY = 256;
int progress = 0;
int capacity = 0;
for(Object o : this.node.net.links) {
RebarNode node = (RebarNode) o;
int y = node.positions[0].getY(); //rebar can only have one pos, there's no multiblock rebar
if(y < lowestY) {
lowestY = y;
progress = 0;
capacity = 0;
lowestLinks.clear();
}
if(y == lowestY) {
TileEntity tile = worldObj.getTileEntity(node.positions[0].getX(), y, node.positions[0].getZ());
if(!(tile instanceof TileEntityRebar)) continue;
TileEntityRebar rebar = (TileEntityRebar) tile;
progress += rebar.progress;
capacity += 1_000;
lowestLinks.add(rebar);
}
}
if(capacity > 0 && !lowestLinks.isEmpty()) {
int maxSpeed = 50;
int maxAccept = (int) BobMathUtil.min(capacity - progress, amount, maxSpeed * lowestLinks.size());
int target = Math.min((progress + maxAccept) / lowestLinks.size(), 1_000);
for(TileEntityRebar rebar : lowestLinks) {
if(rebar.progress >= target) continue;
int delta = target - rebar.progress;
if(delta > amount) continue;
rebar.progress += delta;
amount -= delta;
}
}
return amount;
}
@Override
public long getDemand(FluidType type, int pressure) {
return 10_000;
}
}
public static class RebarNode extends GenNode<RebarNetwork> {
public RebarNode(INetworkProvider<RebarNetwork> provider, BlockPos... positions) {
super(provider, positions);
}
@Override
public RebarNode setConnections(DirPos... connections) {
super.setConnections(connections);
return this;
}
}
@Override
public void renderInventoryBlock(Block block, int meta, int modelId, Object renderBlocks) {
GL11.glPushMatrix();
RenderBlocks renderer = (RenderBlocks) renderBlocks;
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
double o = 0.25D;
renderer.setRenderBounds(0.4375D - o, 0D, 0.4375D - o, 0.5625D - o, 1D, 0.5625D - o); RenderBlocksNT.renderStandardInventoryBlock(block, meta, renderer);
renderer.setRenderBounds(0.4375D - o, 0D, 0.4375D + o, 0.5625D - o, 1D, 0.5625D + o); RenderBlocksNT.renderStandardInventoryBlock(block, meta, renderer);
renderer.setRenderBounds(0.4375D + o, 0D, 0.4375D - o, 0.5625D + o, 1D, 0.5625D - o); RenderBlocksNT.renderStandardInventoryBlock(block, meta, renderer);
renderer.setRenderBounds(0.4375D + o, 0D, 0.4375D + o, 0.5625D + o, 1D, 0.5625D + o); RenderBlocksNT.renderStandardInventoryBlock(block, meta, renderer);
renderer.setRenderBounds(0D, 0.4375D - o, 0.4375D - o, 1D, 0.5625D - o, 0.5625D - o); RenderBlocksNT.renderStandardInventoryBlock(block, meta, renderer);
renderer.setRenderBounds(0D, 0.4375D - o, 0.4375D + o, 1D, 0.5625D - o, 0.5625D + o); RenderBlocksNT.renderStandardInventoryBlock(block, meta, renderer);
renderer.setRenderBounds(0D, 0.4375D + o, 0.4375D - o, 1D, 0.5625D + o, 0.5625D - o); RenderBlocksNT.renderStandardInventoryBlock(block, meta, renderer);
renderer.setRenderBounds(0D, 0.4375D + o, 0.4375D + o, 1D, 0.5625D + o, 0.5625D + o); RenderBlocksNT.renderStandardInventoryBlock(block, meta, renderer);
renderer.setRenderBounds(0.4375D - o, 0.4375D - o, 0D, 0.5625D - o, 0.5625D - o, 1D); RenderBlocksNT.renderStandardInventoryBlock(block, meta, renderer);
renderer.setRenderBounds(0.4375D - o, 0.4375D + o, 0D, 0.5625D - o, 0.5625D + o, 1D); RenderBlocksNT.renderStandardInventoryBlock(block, meta, renderer);
renderer.setRenderBounds(0.4375D + o, 0.4375D - o, 0D, 0.5625D + o, 0.5625D - o, 1D); RenderBlocksNT.renderStandardInventoryBlock(block, meta, renderer);
renderer.setRenderBounds(0.4375D + o, 0.4375D + o, 0D, 0.5625D + o, 0.5625D + o, 1D); RenderBlocksNT.renderStandardInventoryBlock(block, meta, renderer);
GL11.glPopMatrix();
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, Object renderBlocks) {
RenderBlocksNT renderer = RenderBlocksNT.INSTANCE.setWorld(world);
Tessellator tessellator = Tessellator.instance;
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
tessellator.setColorOpaque_F(1, 1, 1);
double o = 0.25D;
double min = -0.001;
double max = 1.001;
if(ClientConfig.RENDER_REBAR_SIMPLE.get()) {
renderer.setRenderBounds(0.4375D, min, 0.4375D, 0.5625D, max, 0.5625D); renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(min, 0.4375D, 0.4375D, max, 0.5625D, 0.5625D); renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.4375D, 0.4375D, min, 0.5625D, 0.5625D, max); renderer.renderStandardBlock(block, x, y, z);
} else {
renderer.setRenderBounds(0.4375D - o, min, 0.4375D - o, 0.5625D - o, max, 0.5625D - o); renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.4375D - o, min, 0.4375D + o, 0.5625D - o, max, 0.5625D + o); renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.4375D + o, min, 0.4375D - o, 0.5625D + o, max, 0.5625D - o); renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.4375D + o, min, 0.4375D + o, 0.5625D + o, max, 0.5625D + o); renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(min, 0.4375D - o, 0.4375D - o, max, 0.5625D - o, 0.5625D - o); renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(min, 0.4375D - o, 0.4375D + o, max, 0.5625D - o, 0.5625D + o); renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(min, 0.4375D + o, 0.4375D - o, max, 0.5625D + o, 0.5625D - o); renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(min, 0.4375D + o, 0.4375D + o, max, 0.5625D + o, 0.5625D + o); renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.4375D - o, 0.4375D - o, min, 0.5625D - o, 0.5625D - o, max); renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.4375D - o, 0.4375D + o, min, 0.5625D - o, 0.5625D + o, max); renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.4375D + o, 0.4375D - o, min, 0.5625D + o, 0.5625D - o, max); renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.4375D + o, 0.4375D + o, min, 0.5625D + o, 0.5625D + o, max); renderer.renderStandardBlock(block, x, y, z);
}
/*TileEntity tile = world.getTileEntity(x, y, z);
if(tile instanceof TileEntityRebar) {
TileEntityRebar rebar = (TileEntityRebar) tile;
if(rebar.progress > 0) {
double height = rebar.progress / 1000D;
renderer.setOverrideBlockTexture(concrete);
renderer.setRenderBounds(0, 0, 0, 1, height, 1); renderer.renderStandardBlock(block, x, y, z);
renderer.clearOverrideBlockTexture();
}
}*/
return true;
}
// from ModEventHandlerClient.onRenderWorldLastEvent
@SideOnly(Side.CLIENT)
public static void renderRebar(List tiles, float interp) {
List<TileEntityRebar> rebars = new ArrayList();
for(Object o : tiles) {
if(!(o instanceof TileEntityRebar)) continue;
TileEntityRebar rebar = (TileEntityRebar) o;
if(rebar.progress > 0) rebars.add(rebar);
if(rebars.size() >= ClientConfig.RENDER_REBAR_LIMIT.get()) break;
}
Minecraft mc = Minecraft.getMinecraft();
EntityPlayer player = mc.thePlayer;
World world = mc.theWorld;
double dx = player.prevPosX + (player.posX - player.prevPosX) * interp;
double dy = player.prevPosY + (player.posY - player.prevPosY) * interp;
double dz = player.prevPosZ + (player.posZ - player.prevPosZ) * interp;
if(!rebars.isEmpty()) {
GL11.glPushMatrix();
GL11.glShadeModel(GL11.GL_SMOOTH);
//RenderHelper.enableStandardItemLighting();
EntityRenderer entityRenderer = mc.entityRenderer;
entityRenderer.enableLightmap(interp);
RenderBlocksNT renderer = RenderBlocksNT.INSTANCE.setWorld(world);
renderer.setOverrideBlockTexture(((BlockRebar) ModBlocks.rebar).concrete);
mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
Tessellator tess = Tessellator.instance;
tess.startDrawingQuads();
for(TileEntityRebar rebar : rebars) {
tess.setTranslation(-dx, -dy, -dz);
tess.setColorRGBA_F(1F, 1F, 1F, 1F);
renderer.setRenderBounds(0, 0, 0, 1, rebar.progress / 1000D, 1);
renderer.renderStandardBlock(ModBlocks.rebar, rebar.xCoord, rebar.yCoord, rebar.zCoord);
}
tess.draw();
tess.setTranslation(0, 0, 0);
renderer.clearOverrideBlockTexture();
entityRenderer.disableLightmap(interp);
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glPopMatrix();
}
if(player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.rebar_placer && player.getHeldItem().hasTagCompound() &&
player.getHeldItem().stackTagCompound.hasKey("pos") && mc.objectMouseOver != null && mc.objectMouseOver.typeOfHit == MovingObjectType.BLOCK) {
int[] pos = player.getHeldItem().stackTagCompound.getIntArray("pos");
MovingObjectPosition mop = mc.objectMouseOver;
ForgeDirection dir = ForgeDirection.getOrientation(mop.sideHit);
int iX = mop.blockX + dir.offsetX;
int iY = mop.blockY + dir.offsetY;
int iZ = mop.blockZ + dir.offsetZ;
double minX = Math.min(pos[0], iX) + 0.125;
double maxX = Math.max(pos[0], iX) + 0.875;
double minY = Math.min(pos[1], iY) + 0.125;
double maxY = Math.max(pos[1], iY) + 0.875;
double minZ = Math.min(pos[2], iZ) + 0.125;
double maxZ = Math.max(pos[2], iZ) + 0.875;
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glColor3f(1F, 1F, 1F);
Tessellator tess = Tessellator.instance;
tess.setTranslation(-dx, -dy, -dz);
tess.startDrawing(GL11.GL_LINES);
tess.setBrightness(240);
tess.setColorRGBA_F(1F, 1F, 1F, 1F);
// top
tess.addVertex(minX, maxY, minZ);
tess.addVertex(minX, maxY, maxZ);
tess.addVertex(minX, maxY, maxZ);
tess.addVertex(maxX, maxY, maxZ);
tess.addVertex(maxX, maxY, maxZ);
tess.addVertex(maxX, maxY, minZ);
tess.addVertex(maxX, maxY, minZ);
tess.addVertex(minX, maxY, minZ);
// bottom
tess.addVertex(minX, minY, minZ);
tess.addVertex(minX, minY, maxZ);
tess.addVertex(minX, minY, maxZ);
tess.addVertex(maxX, minY, maxZ);
tess.addVertex(maxX, minY, maxZ);
tess.addVertex(maxX, minY, minZ);
tess.addVertex(maxX, minY, minZ);
tess.addVertex(minX, minY, minZ);
// sides
tess.addVertex(minX, minY, minZ);
tess.addVertex(minX, maxY, minZ);
tess.addVertex(maxX, minY, minZ);
tess.addVertex(maxX, maxY, minZ);
tess.addVertex(maxX, minY, maxZ);
tess.addVertex(maxX, maxY, maxZ);
tess.addVertex(minX, minY, maxZ);
tess.addVertex(minX, maxY, maxZ);
tess.draw();
tess.setTranslation(0, 0, 0);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
int rebarLeft = InventoryUtil.countAStackMatches(player, new ComparableStack(ModBlocks.rebar), true);
int rebarRequired = (Math.max(pos[0], iX) - Math.min(pos[0], iX) + 1) * (Math.max(pos[1], iY) - Math.min(pos[1], iY) + 1) * (Math.max(pos[2], iZ) - Math.min(pos[2], iZ) + 1);
MainRegistry.proxy.displayTooltip((rebarRequired > rebarLeft ? EnumChatFormatting.RED : EnumChatFormatting.GREEN) + (rebarLeft + " / " + rebarRequired), 1_000, ServerProxy.ID_CABLE);
}
}
}

View File

@ -11,7 +11,6 @@ import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
@ -67,7 +66,7 @@ public class BlockReeds extends Block {
@Override @Override
public Item getItemDropped(int meta, Random rand, int fortune) { public Item getItemDropped(int meta, Random rand, int fortune) {
return Items.stick; return null;
} }
@Override @Override

View File

@ -1,84 +0,0 @@
package com.hbm.blocks.generic;
import org.lwjgl.opengl.GL11;
import com.hbm.render.block.ISBRHUniversal;
import com.hbm.render.util.RenderBlocksNT;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockSandbags extends Block implements ISBRHUniversal {
public BlockSandbags(Material mat) {
super(mat);
}
@Override public int getRenderType() { return renderID; }
@Override public boolean isOpaqueCube() { return false; }
@Override public boolean renderAsNormalBlock() { return false; }
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
setBlockBoundsBasedOnState(world, x, y, z);
return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ);
}
@Override
@SideOnly(Side.CLIENT)
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) {
setBlockBoundsBasedOnState(world, x, y, z);
return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ);
}
@Override
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
float min = 0.25F;
float max = 0.75F;
Block nx = world.getBlock(x - 1, y, z);
Block px = world.getBlock(x + 1, y, z);
Block nz = world.getBlock(x, y, z - 1);
Block pz = world.getBlock(x, y, z + 1);
float minX = (nx.isOpaqueCube() || nx.isNormalCube() || nx == this) ? 0F : min;
float minZ = (nz.isOpaqueCube() || nz.isNormalCube() || nz == this) ? 0F : min;
float maxX = (px.isOpaqueCube() || px.isNormalCube() || px == this) ? 1F : max;
float maxZ = (pz.isOpaqueCube() || pz.isNormalCube() || pz == this) ? 1F : max;
this.setBlockBounds(minX, 0, minZ, maxX, 1, maxZ);
}
@Override
public void renderInventoryBlock(Block block, int meta, int modelId, Object renderBlocks) {
GL11.glPushMatrix();
RenderBlocks renderer = (RenderBlocks) renderBlocks;
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
renderer.setRenderBounds(0.125D, 0D, 0.125D, 0.875D, 1D, 0.875D);
RenderBlocksNT.renderStandardInventoryBlock(block, meta, renderer);
GL11.glPopMatrix();
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, Object renderBlocks) {
RenderBlocksNT renderer = RenderBlocksNT.INSTANCE.setWorld(world);
renderer.setRenderBoundsFromBlock(block);
Tessellator tessellator = Tessellator.instance;
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
tessellator.setColorOpaque_F(1, 1, 1);
renderer.renderStandardBlock(block, x, y, z);
return true;
}
}

View File

@ -1,115 +0,0 @@
package com.hbm.blocks.generic;
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.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class BlockSkeletonHolder extends BlockContainer {
public BlockSkeletonHolder() {
super(Material.rock);
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return new TileEntitySkeletonHolder();
}
@Override public int getRenderType() { return -1; }
@Override public boolean isOpaqueCube() { return false; }
@Override public boolean renderAsNormalBlock() { return false; }
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
if(i == 0) world.setBlockMetadataWithNotify(x, y, z, 5, 2);
if(i == 1) world.setBlockMetadataWithNotify(x, y, z, 3, 2);
if(i == 2) world.setBlockMetadataWithNotify(x, y, z, 4, 2);
if(i == 3) world.setBlockMetadataWithNotify(x, y, z, 2, 2);
} //I hope you change this shit to not be hardcoded because im not doing it
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
if(player.isSneaking()) return false;
TileEntitySkeletonHolder pedestal = (TileEntitySkeletonHolder) world.getTileEntity(x, y, z);
if(pedestal.item == null && player.getHeldItem() != null) {
if(world.isRemote) return true;
pedestal.item = player.getHeldItem().copy();
player.inventory.mainInventory[player.inventory.currentItem] = null;
pedestal.markDirty();
world.markBlockForUpdate(x, y, z);
return true;
} else if(pedestal.item != null && player.getHeldItem() == null) {
if(world.isRemote) return true;
player.inventory.mainInventory[player.inventory.currentItem] = pedestal.item.copy();
pedestal.item = null;
pedestal.markDirty();
world.markBlockForUpdate(x, y, z);
return true;
}
return false;
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
if(!world.isRemote) {
TileEntitySkeletonHolder entity = (TileEntitySkeletonHolder) world.getTileEntity(x, y, z);
if(entity != null && entity.item != null) {
EntityItem item = new EntityItem(world, x + 0.5, y, z + 0.5, entity.item.copy());
world.spawnEntityInWorld(item);
}
}
super.breakBlock(world, x, y, z, block, meta);
}
public static class TileEntitySkeletonHolder extends TileEntity {
public ItemStack item;
@Override public boolean canUpdate() { return false; }
@Override
public Packet getDescriptionPacket() {
NBTTagCompound nbt = new NBTTagCompound();
this.writeToNBT(nbt);
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbt);
}
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
this.readFromNBT(pkt.func_148857_g());
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
this.item = ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("item"));
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
if(this.item != null) {
NBTTagCompound stack = new NBTTagCompound();
this.item.writeToNBT(stack);
nbt.setTag("item", stack);
}
}
}
}

View File

@ -6,10 +6,8 @@ import java.util.List;
import java.util.Random; import java.util.Random;
import com.hbm.blocks.IBlockMulti; import com.hbm.blocks.IBlockMulti;
import com.hbm.blocks.ILookOverlay;
import com.hbm.blocks.ITooltipProvider; import com.hbm.blocks.ITooltipProvider;
import com.hbm.blocks.ModBlocks; import com.hbm.blocks.ModBlocks;
import com.hbm.config.ServerConfig;
import com.hbm.items.ModItems; import com.hbm.items.ModItems;
import com.hbm.items.tool.ItemLock; import com.hbm.items.tool.ItemLock;
import com.hbm.lib.RefStrings; import com.hbm.lib.RefStrings;
@ -40,9 +38,8 @@ import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
public class BlockStorageCrate extends BlockContainer implements IBlockMulti, ILookOverlay, ITooltipProvider { public class BlockStorageCrate extends BlockContainer implements IBlockMulti, ITooltipProvider {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconTop; private IIcon iconTop;
@ -109,21 +106,6 @@ public class BlockStorageCrate extends BlockContainer implements IBlockMulti, IL
@Override @Override
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) { public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
if(!world.isRemote && !ServerConfig.CRATE_KEEP_CONTENTS.get()) {
dropInv = true;
if(!player.capabilities.isCreativeMode) {
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(this)));
}
TileEntity inv = world.getTileEntity(x, y, z);
if(inv instanceof TileEntityLockableBase) {
TileEntityLockableBase lockable = (TileEntityLockableBase) inv;
if(lockable.isLocked()) dropInv = false;
}
boolean flag = world.setBlockToAir(x, y, z);
dropInv = true;
return flag;
}
if(!player.capabilities.isCreativeMode && !world.isRemote && willHarvest) { if(!player.capabilities.isCreativeMode && !world.isRemote && willHarvest) {
ItemStack drop = new ItemStack(this); ItemStack drop = new ItemStack(this);
@ -154,28 +136,14 @@ public class BlockStorageCrate extends BlockContainer implements IBlockMulti, IL
} }
} }
if(inv instanceof TileEntityCrateBase) { if(inv instanceof TileEntityCrateBase)
TileEntityCrateBase crate = (TileEntityCrateBase) inv; nbt.setBoolean("spiders", ((TileEntityCrateBase) inv).hasSpiders);
// Saves memory and ensures consistency between crafted crates and mined ones
if (crate.hasSpiders) {
nbt.setBoolean("spiders", true);
}
}
if(!nbt.hasNoTags()) { if(!nbt.hasNoTags()) {
drop.stackTagCompound = nbt; drop.stackTagCompound = nbt;
}
if(inv instanceof TileEntityCrateBase) {
TileEntityCrateBase crate = (TileEntityCrateBase) inv;
if (crate.hasCustomInventoryName()) {
drop.setStackDisplayName(crate.getInventoryName());
}
}
if (drop.hasTagCompound()) {
try { try {
byte[] abyte = CompressedStreamTools.compress(drop.stackTagCompound); byte[] abyte = CompressedStreamTools.compress(nbt);
if(abyte.length > 6000) { if(abyte.length > 6000) {
player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.RED + "Warning: Container NBT exceeds 6kB, contents will be ejected!")); player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.RED + "Warning: Container NBT exceeds 6kB, contents will be ejected!"));
@ -236,14 +204,8 @@ public class BlockStorageCrate extends BlockContainer implements IBlockMulti, IL
lockable.lock(); lockable.lock();
} }
} }
if(inv instanceof TileEntityCrateBase) { if(inv instanceof TileEntityCrateBase) {
TileEntityCrateBase crate = (TileEntityCrateBase) inv; ((TileEntityCrateBase) inv).hasSpiders = stack.stackTagCompound.getBoolean("spiders");
crate.hasSpiders = stack.stackTagCompound.getBoolean("spiders");
if (stack.hasDisplayName()) {
crate.setCustomName(stack.getDisplayName());
}
} }
} }
@ -252,10 +214,18 @@ public class BlockStorageCrate extends BlockContainer implements IBlockMulti, IL
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
if(i == 0) world.setBlockMetadataWithNotify(x, y, z, 2, 2); if(i == 0) {
if(i == 1) world.setBlockMetadataWithNotify(x, y, z, 5, 2); world.setBlockMetadataWithNotify(x, y, z, 2, 2);
if(i == 2) world.setBlockMetadataWithNotify(x, y, z, 3, 2); }
if(i == 3) world.setBlockMetadataWithNotify(x, y, z, 4, 2); if(i == 1) {
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
}
if(i == 2) {
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
}
if(i == 3) {
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
}
} }
@Override @Override
@ -376,20 +346,4 @@ public class BlockStorageCrate extends BlockContainer implements IBlockMulti, IL
} }
} }
} }
@Override
public void printHook(RenderGameOverlayEvent.Pre event, World world, int x, int y, int z) {
TileEntity te = world.getTileEntity(x, y, z);
if (!(te instanceof IInventory))
return;
IInventory inv = (IInventory) te;
if (!inv.hasCustomInventoryName())
return;
ILookOverlay.printGeneric(event, inv.getInventoryName(), 0xffff00, 0x404000, new ArrayList<String>(0));
}
} }

View File

@ -24,7 +24,6 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.ColorizerGrass;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.EnumPlantType; import net.minecraftforge.common.EnumPlantType;
@ -301,43 +300,6 @@ public class BlockTallPlant extends BlockEnumMulti implements IPlantable, IGrowa
return world.getBlockMetadata(x, y, z); return world.getBlockMetadata(x, y, z);
} }
@SideOnly(Side.CLIENT)
public int getRenderColor(int meta)
{
if (meta == 0 || meta == 8) {
return ColorizerGrass.getGrassColor(0.5D, 1.0D);
} else return 0xFFFFFF;
}
// if you need to make another tinted plant just throw the metadata value
// into the if statements above and below i really do not want to make this more
// complicated than it needs to be
// the second meta value is for the top of the plant
@SideOnly(Side.CLIENT)
public int colorMultiplier(IBlockAccess world, int x, int y, int z)
{
int l = 0;
int i1 = 0;
int j1 = 0;
for (int k1 = -1; k1 <= 1; ++k1)
{
for (int l1 = -1; l1 <= 1; ++l1)
{
int i2 = world.getBiomeGenForCoords(x + l1, z + k1).getBiomeFoliageColor(x + l1, y, z + k1);
l += (i2 & 16711680) >> 16;
i1 += (i2 & 65280) >> 8;
j1 += i2 & 255;
}
}
int meta = world.getBlockMetadata(x, y, z);
if (meta == 0 || meta == 8) {
return ((l / 9 & 255) << 16 | (i1 / 9 & 255) << 8 | j1 / 9 & 255);
} else return 0xFFFFFF;
}
@Override @Override
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) { public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {

View File

@ -13,9 +13,9 @@ import com.hbm.inventory.RecipesCommon.AStack;
import com.hbm.inventory.RecipesCommon.ComparableStack; import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.inventory.RecipesCommon.MetaBlock; import com.hbm.inventory.RecipesCommon.MetaBlock;
import com.hbm.inventory.RecipesCommon.OreDictStack; import com.hbm.inventory.RecipesCommon.OreDictStack;
import com.hbm.util.I18nUtil;
import com.hbm.util.InventoryUtil; import com.hbm.util.InventoryUtil;
import com.hbm.util.Tuple.Pair; import com.hbm.util.Tuple.Pair;
import com.hbm.util.i18n.I18nUtil;
import api.hbm.block.IToolable; import api.hbm.block.IToolable;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
@ -152,7 +152,7 @@ public class BlockToolConversion extends BlockMulti implements IToolable, ILookO
public static void registerRecipes() { public static void registerRecipes() {
conversions.put(new Pair(ToolType.BOLT, new MetaBlock(ModBlocks.watz_end, 0)), new Pair(new AStack[] {new OreDictStack(OreDictManager.DURA.bolt(), 4)}, new MetaBlock(ModBlocks.watz_end, 1))); conversions.put(new Pair(ToolType.BOLT, new MetaBlock(ModBlocks.watz_end, 0)), new Pair(new AStack[] {new OreDictStack(OreDictManager.DURA.bolt(), 4)}, new MetaBlock(ModBlocks.watz_end, 1)));
conversions.put(new Pair(ToolType.TORCH, new MetaBlock(ModBlocks.fusion_component, 0)), new Pair(new AStack[] {new OreDictStack(OreDictManager.STEEL.plateCast())}, new MetaBlock(ModBlocks.fusion_component, 1))); conversions.put(new Pair(ToolType.TORCH, new MetaBlock(ModBlocks.fusion_conductor, 0)), new Pair(new AStack[] {new OreDictStack(OreDictManager.STEEL.plateCast())}, new MetaBlock(ModBlocks.fusion_conductor, 1)));
conversions.put(new Pair(ToolType.TORCH, new MetaBlock(ModBlocks.icf_component, 1)), new Pair(new AStack[] {new OreDictStack(OreDictManager.ANY_BISMOIDBRONZE.plateCast())}, new MetaBlock(ModBlocks.icf_component, 2))); conversions.put(new Pair(ToolType.TORCH, new MetaBlock(ModBlocks.icf_component, 1)), new Pair(new AStack[] {new OreDictStack(OreDictManager.ANY_BISMOIDBRONZE.plateCast())}, new MetaBlock(ModBlocks.icf_component, 2)));
conversions.put(new Pair(ToolType.BOLT, new MetaBlock(ModBlocks.icf_component, 3)), new Pair(new AStack[] {new OreDictStack(OreDictManager.STEEL.plateCast()), new OreDictStack(OreDictManager.DURA.bolt(), 4)}, new MetaBlock(ModBlocks.icf_component, 4))); conversions.put(new Pair(ToolType.BOLT, new MetaBlock(ModBlocks.icf_component, 3)), new Pair(new AStack[] {new OreDictStack(OreDictManager.STEEL.plateCast()), new OreDictStack(OreDictManager.DURA.bolt(), 4)}, new MetaBlock(ModBlocks.icf_component, 4)));
} }

View File

@ -0,0 +1,32 @@
package com.hbm.blocks.generic;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
public class BlockTransission extends Block {
public BlockTransission(Material mat) {
super(mat);
}
@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;
} else if(!player.isSneaking()) {
if(side == 0) {
player.setPositionAndUpdate(x + 0.5, y + 1, z + 0.5);
}
if(side == 1) {
player.setPositionAndUpdate(x + 0.5, y - 2, z + 0.5);
}
return true;
} else {
return false;
}
}
}

View File

@ -9,7 +9,6 @@ import com.hbm.blocks.IBlockSideRotation;
import com.hbm.blocks.ILookOverlay; import com.hbm.blocks.ILookOverlay;
import com.hbm.blocks.ModBlocks; import com.hbm.blocks.ModBlocks;
import com.hbm.interfaces.IControlReceiver; import com.hbm.interfaces.IControlReceiver;
import com.hbm.items.ModItems;
import com.hbm.lib.RefStrings; import com.hbm.lib.RefStrings;
import com.hbm.main.MainRegistry; import com.hbm.main.MainRegistry;
import com.hbm.packet.PacketDispatcher; import com.hbm.packet.PacketDispatcher;
@ -17,8 +16,8 @@ import com.hbm.packet.toserver.NBTControlPacket;
import com.hbm.tileentity.IGUIProvider; import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.TileEntityLoadedBase; import com.hbm.tileentity.TileEntityLoadedBase;
import com.hbm.util.BufferUtil; import com.hbm.util.BufferUtil;
import com.hbm.util.i18n.I18nUtil; import com.hbm.util.I18nUtil;
import com.hbm.world.gen.nbt.INBTBlockTransformable; import com.hbm.world.gen.INBTTransformable;
import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry;
@ -37,6 +36,7 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.inventory.Container; import net.minecraft.inventory.Container;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
@ -46,7 +46,7 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre; import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
public class BlockWandJigsaw extends BlockContainer implements IBlockSideRotation, INBTBlockTransformable, IGUIProvider, ILookOverlay { public class BlockWandJigsaw extends BlockContainer implements IBlockSideRotation, INBTTransformable, IGUIProvider, ILookOverlay {
private IIcon iconTop; private IIcon iconTop;
private IIcon iconSide; private IIcon iconSide;
@ -122,7 +122,7 @@ public class BlockWandJigsaw extends BlockContainer implements IBlockSideRotatio
@Override @Override
public int transformMeta(int meta, int coordBaseMode) { public int transformMeta(int meta, int coordBaseMode) {
return INBTBlockTransformable.transformMetaDeco(meta, coordBaseMode); return INBTTransformable.transformMetaDeco(meta, coordBaseMode);
} }
@Override @Override
@ -134,18 +134,16 @@ public class BlockWandJigsaw extends BlockContainer implements IBlockSideRotatio
TileEntityWandJigsaw jigsaw = (TileEntityWandJigsaw) te; TileEntityWandJigsaw jigsaw = (TileEntityWandJigsaw) te;
if(!player.isSneaking()) { if(!player.isSneaking()) {
Block block = ModBlocks.getBlockFromStack(player.getHeldItem()); Block block = getBlock(world, player.getHeldItem());
if(block == ModBlocks.wand_air) block = Blocks.air; if(block == ModBlocks.wand_air) block = Blocks.air;
if(block != null && !ModBlocks.isStructureBlock(block, false)) { if(block != null && block != ModBlocks.wand_jigsaw && block != ModBlocks.wand_loot) {
jigsaw.replaceBlock = block; jigsaw.replaceBlock = block;
jigsaw.replaceMeta = player.getHeldItem().getItemDamage(); jigsaw.replaceMeta = player.getHeldItem().getItemDamage();
return true; return true;
} }
if(player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.wand_s) return false;
if(world.isRemote) FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z); if(world.isRemote) FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z);
return true; return true;
@ -154,6 +152,13 @@ public class BlockWandJigsaw extends BlockContainer implements IBlockSideRotatio
return false; return false;
} }
private Block getBlock(World world, ItemStack stack) {
if(stack == null) return null;
if(!(stack.getItem() instanceof ItemBlock)) return null;
return ((ItemBlock) stack.getItem()).field_150939_a;
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {

View File

@ -1,345 +0,0 @@
package com.hbm.blocks.generic;
import api.hbm.block.IToolable;
import com.hbm.blocks.IBlockSideRotation;
import com.hbm.blocks.ILookOverlay;
import com.hbm.blocks.ITooltipProvider;
import com.hbm.blocks.ModBlocks;
import com.hbm.config.StructureConfig;
import com.hbm.interfaces.IBomb;
import com.hbm.interfaces.ICopiable;
import com.hbm.lib.RefStrings;
import com.hbm.main.MainRegistry;
import com.hbm.tileentity.TileEntityLoadedBase;
import com.hbm.util.BufferUtil;
import com.hbm.util.i18n.I18nUtil;
import com.hbm.world.gen.nbt.INBTTileEntityTransformable;
import com.hbm.world.gen.util.LogicBlockActions;
import com.hbm.world.gen.util.LogicBlockConditions;
import com.hbm.world.gen.util.LogicBlockInteractions;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.common.util.ForgeDirection;
import java.util.ArrayList;
import java.util.List;
public class BlockWandLogic extends BlockContainer implements ILookOverlay, IToolable, ITooltipProvider, IBlockSideRotation, IBomb {
@SideOnly(Side.CLIENT) protected IIcon iconTop;
public BlockWandLogic() {
super(Material.iron);
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":wand_logic");
this.iconTop = iconRegister.registerIcon(RefStrings.MODID + ":wand_logic_top");
}
@Override
public IIcon getIcon(int side, int meta) {
return (side <= 1) ? iconTop : blockIcon;
}
@Override
public int getRotationFromSide(IBlockAccess world, int x, int y, int z, int side) {
if(side == 0) return IBlockSideRotation.topToBottom(world.getBlockMetadata(x, y, z));
if(side == 1) return world.getBlockMetadata(x, y, z);
return 0;
}
@Override
public int getRenderType() {
return IBlockSideRotation.getRenderType();
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
if (i == 0) world.setBlockMetadataWithNotify(x, y, z, 3, 2);
if (i == 1) world.setBlockMetadataWithNotify(x, y, z, 2, 2);
if (i == 2) world.setBlockMetadataWithNotify(x, y, z, 0, 2);
if (i == 3) world.setBlockMetadataWithNotify(x, y, z, 1, 2);
ForgeDirection dir = ForgeDirection.UNKNOWN;
switch(i){
case 0: dir = ForgeDirection.SOUTH;break;
case 1: dir = ForgeDirection.WEST; break;
case 2: dir = ForgeDirection.NORTH;break;
case 3: dir = ForgeDirection.EAST; break;
}
TileEntity te = world.getTileEntity(x, y, z);
if(te instanceof TileEntityWandLogic)
((TileEntityWandLogic)te).placedRotation = dir.ordinal();
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float fX, float fY, float fZ) {
ItemStack stack = player.getHeldItem();
if (stack != null && stack.getItem() instanceof ItemBlock && !player.isSneaking()) {
ItemBlock ib = (ItemBlock) stack.getItem();
Block block = ib.field_150939_a;
if (block.renderAsNormalBlock() && block != this) {
TileEntity tile = world.getTileEntity(x, y, z);
if(tile instanceof TileEntityWandLogic){
TileEntityWandLogic logic = (TileEntityWandLogic) tile;
logic.disguise = block;
logic.disguiseMeta = stack.getItemDamage() & 15;
return true;
}
}
}
return super.onBlockActivated(world, x, y, z, player, side, fX, fY, fZ);
}
@Override
public boolean onScrew(World world, EntityPlayer player, int x, int y, int z, int side, float fX, float fY, float fZ, ToolType tool) {
TileEntity te = world.getTileEntity(x, y, z);
if(!(te instanceof TileEntityWandLogic)) return false;
TileEntityWandLogic logic = (TileEntityWandLogic) te;
switch(tool) {
case SCREWDRIVER:
List<String> actionNames = LogicBlockActions.getActionNames();
int indexA = actionNames.indexOf(logic.actionID);
indexA += player.isSneaking() ? -1 : 1;
indexA = MathHelper.clamp_int(indexA, 0, actionNames.size() - 1);
logic.actionID = actionNames.get(indexA);
return true;
case DEFUSER:
List<String> conditionNames = LogicBlockConditions.getConditionNames();
int indexC = conditionNames.indexOf(logic.conditionID);
indexC += player.isSneaking() ? -1 : 1;
indexC = MathHelper.clamp_int(indexC, 0, conditionNames.size() - 1);
logic.conditionID = conditionNames.get(indexC);
return true;
case HAND_DRILL:
List<String> interactionNames = LogicBlockInteractions.getInteractionNames();
int indexI = interactionNames.indexOf(logic.interactionID);
indexI += player.isSneaking() ? -1 : 1;
indexI = MathHelper.clamp_int(indexI, 0, interactionNames.size() - 1);
logic.interactionID = interactionNames.get(indexI);
return true;
default: return false;
}
}
@Override
public void printHook(RenderGameOverlayEvent.Pre event, World world, int x, int y, int z) {
TileEntity te = world.getTileEntity(x, y, z);
if(!(te instanceof TileEntityWandLogic)) return;
TileEntityWandLogic logic = (TileEntityWandLogic) te;
List<String> text = new ArrayList<>();
text.add("Action: " + logic.actionID);
text.add("Condition: " + logic.conditionID);
text.add("Interaction: " + (logic.interactionID != null ? logic.interactionID : "None"));
String block;
if(logic.disguise != null && logic.disguise != Blocks.air)
block = I18nUtil.resolveKey(logic.disguise.getUnlocalizedName() + ".name");
else
block = "None";
text.add("Disguise Block: " + block);
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
list.add(EnumChatFormatting.GOLD + "Use screwdriver to cycle forwards through the action list, shift click to go back");
list.add(EnumChatFormatting.GOLD + "Use defuser to cycle forwards through the condition list, shift click to go back");
list.add(EnumChatFormatting.GOLD + "Use hand drill to cycle forwards through the interaction list, shift click to go back");
list.add(EnumChatFormatting.YELLOW + "Use a detonator to transform");
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta) {
return new TileEntityWandLogic();
}
@Override
public BombReturnCode explode(World world, int x, int y, int z) {
TileEntity te = world.getTileEntity(x, y, z);
if(!(te instanceof TileEntityWandLogic)) return null;
((TileEntityWandLogic) te).triggerReplace = true;
return BombReturnCode.TRIGGERED;
}
public static class TileEntityWandLogic extends TileEntityLoadedBase implements INBTTileEntityTransformable, ICopiable {
private boolean triggerReplace;
public int placedRotation;
Block disguise;
int disguiseMeta = -1;
public String actionID = "FODDER_WAVE";
public String conditionID = "PLAYER_CUBE_5";
public String interactionID;
@Override
public void updateEntity() {
if(!worldObj.isRemote) {
if(triggerReplace) {
// On the first tick of this TE, replace with intended block and fill with loot
replace();
} else {
networkPackNT(15);
}
}
}
private void replace() {
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);
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 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 = !StructureConfig.debugStructures;
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
nbt.setString("actionID", actionID);
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);
}
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
actionID = nbt.getString("actionID");
conditionID = nbt.getString("conditionID");
if(nbt.hasKey("interactionID"))
interactionID = nbt.getString("interactionID");
placedRotation = nbt.getInteger("rotation");
if(nbt.hasKey("disguise")){
disguise = Block.getBlockFromName(nbt.getString("disguise"));
disguiseMeta = nbt.getInteger("disguiseMeta");
}
}
@Override
public void serialize(ByteBuf buf) {
buf.writeInt(placedRotation);
BufferUtil.writeString(buf, actionID);
BufferUtil.writeString(buf, conditionID);
BufferUtil.writeString(buf, interactionID);
buf.writeInt(Block.getIdFromBlock(disguise));
buf.writeInt(disguiseMeta);
}
@Override
public void deserialize(ByteBuf buf) {
placedRotation = buf.readInt();
actionID = BufferUtil.readString(buf);
conditionID = BufferUtil.readString(buf);
interactionID = BufferUtil.readString(buf);
disguise = Block.getBlockById(buf.readInt());
disguiseMeta = buf.readInt();
}
@Override
public NBTTagCompound getSettings(World world, int x, int y, int z) {
NBTTagCompound nbt = new NBTTagCompound();
nbt.setString("actionID", actionID);
nbt.setString("conditionID", conditionID);
if(interactionID != null)
nbt.setString("interactionID", interactionID);
if(disguise != null){
nbt.setString("disguise", GameRegistry.findUniqueIdentifierFor(disguise).toString());
nbt.setInteger("disguiseMeta", disguiseMeta);
}
return nbt;
}
@Override
public void pasteSettings(NBTTagCompound nbt, int index, World world, EntityPlayer player, int x, int y, int z) {
actionID = nbt.getString("actionID");
conditionID = nbt.getString("conditionID");
interactionID = nbt.getString("interactionID");
if(nbt.hasKey("disguise")){
disguise = Block.getBlockFromName(nbt.getString("disguise"));
disguiseMeta = nbt.getInteger("disguiseMeta");
}
}
}
}

View File

@ -12,12 +12,11 @@ import com.hbm.blocks.ModBlocks;
import com.hbm.config.StructureConfig; import com.hbm.config.StructureConfig;
import com.hbm.itempool.ItemPool; import com.hbm.itempool.ItemPool;
import com.hbm.lib.RefStrings; import com.hbm.lib.RefStrings;
import com.hbm.main.MainRegistry;
import com.hbm.tileentity.TileEntityLoadedBase; import com.hbm.tileentity.TileEntityLoadedBase;
import com.hbm.util.BufferUtil; import com.hbm.util.BufferUtil;
import com.hbm.util.I18nUtil;
import com.hbm.util.LootGenerator; import com.hbm.util.LootGenerator;
import com.hbm.util.i18n.I18nUtil; import com.hbm.world.gen.INBTTileEntityTransformable;
import com.hbm.world.gen.nbt.INBTTileEntityTransformable;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import api.hbm.block.IToolable; import api.hbm.block.IToolable;
@ -33,6 +32,7 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
@ -81,7 +81,7 @@ public class BlockWandLoot extends BlockContainer implements ILookOverlay, ITool
@Override @Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) { 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; int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
if(i == 0) world.setBlockMetadataWithNotify(x, y, z, 3, 2); if(i == 0) world.setBlockMetadataWithNotify(x, y, z, 3, 2);
if(i == 1) world.setBlockMetadataWithNotify(x, y, z, 2, 2); if(i == 1) world.setBlockMetadataWithNotify(x, y, z, 2, 2);
@ -152,14 +152,17 @@ public class BlockWandLoot extends BlockContainer implements ILookOverlay, ITool
} }
private Block getLootableBlock(World world, ItemStack stack) { private Block getLootableBlock(World world, ItemStack stack) {
Block block = ModBlocks.getBlockFromStack(stack); if(stack == null) return null;
if(block == null) return null;
if(block == ModBlocks.deco_loot) return block; if(stack.getItem() instanceof ItemBlock) {
Block block = ((ItemBlock) stack.getItem()).field_150939_a;
if(block instanceof ITileEntityProvider) { if(block == ModBlocks.deco_loot) return block;
TileEntity te = ((ITileEntityProvider) block).createNewTileEntity(world, 12);
if(te instanceof IInventory) return block; if(block instanceof ITileEntityProvider) {
TileEntity te = ((ITileEntityProvider) block).createNewTileEntity(world, 12);
if(te instanceof IInventory) return block;
}
} }
return null; return null;
@ -245,27 +248,12 @@ public class BlockWandLoot extends BlockContainer implements ILookOverlay, ITool
} }
private void replace() { private void replace() {
if(!(worldObj.getBlock(xCoord, yCoord, zCoord) instanceof BlockWandLoot)) {
MainRegistry.logger.warn("Somehow the block at: " + xCoord + ", " + yCoord + ", " + zCoord + " isn't a loot block but we're doing a TE update as if it is, cancelling!");
return;
}
WeightedRandomChestContent[] pool = ItemPool.getPool(poolName); WeightedRandomChestContent[] pool = ItemPool.getPool(poolName);
worldObj.setBlock(xCoord, yCoord, zCoord, replaceBlock, replaceMeta, 2); worldObj.setBlock(xCoord, yCoord, zCoord, replaceBlock, replaceMeta, 2);
TileEntity te = worldObj.getTileEntity(xCoord, yCoord, zCoord); TileEntity te = worldObj.getTileEntity(xCoord, yCoord, zCoord);
if(te == null || te instanceof TileEntityWandLoot) {
// Some generator has broken the TE->block relationship, which, honestly, rude.
// so we're just gonna hop in and force update the TE
MainRegistry.logger.warn("TE set incorrectly at: " + xCoord + ", " + yCoord + ", " + zCoord + ". If you're using some sort of world generation mod, report it to the author!");
te = replaceBlock.createTileEntity(worldObj, replaceMeta);
worldObj.setTileEntity(xCoord, yCoord, zCoord, te);
}
if(te instanceof IInventory) { if(te instanceof IInventory) {
int count = minItems; int count = minItems;
if(maxItems - minItems > 0) count += worldObj.rand.nextInt(maxItems - minItems); if(maxItems - minItems > 0) count += worldObj.rand.nextInt(maxItems - minItems);
@ -277,20 +265,15 @@ public class BlockWandLoot extends BlockContainer implements ILookOverlay, ITool
// Shouldn't happen but let's guard anyway, if it fails we just don't rotate the chest block correctly // Shouldn't happen but let's guard anyway, if it fails we just don't rotate the chest block correctly
if(!(worldObj instanceof WorldServer)) return; if(!(worldObj instanceof WorldServer)) return;
try { if(fakePlayer == null || fakePlayer.worldObj != worldObj) {
if(fakePlayer == null || fakePlayer.worldObj != worldObj) { fakePlayer = FakePlayerFactory.get((WorldServer)worldObj, FAKE_PROFILE);
fakePlayer = FakePlayerFactory.get((WorldServer)worldObj, FAKE_PROFILE);
}
fakePlayer.rotationYaw = fakePlayer.rotationYawHead = placedRotation;
ItemStack fakeStack = new ItemStack(replaceBlock, 1, replaceMeta);
replaceBlock.onBlockPlacedBy(worldObj, xCoord, yCoord, zCoord, fakePlayer, fakeStack);
} catch(Exception ex) {
MainRegistry.logger.warn("Failed to correctly rotate loot block at: " + xCoord + ", " + yCoord + ", " + zCoord);
MainRegistry.logger.catching(ex);
} }
fakePlayer.rotationYaw = fakePlayer.rotationYawHead = placedRotation;
ItemStack fakeStack = new ItemStack(replaceBlock, 1, replaceMeta);
replaceBlock.onBlockPlacedBy(worldObj, xCoord, yCoord, zCoord, fakePlayer, fakeStack);
} }
private List<String> getPoolNames(boolean loot) { private List<String> getPoolNames(boolean loot) {
@ -317,8 +300,6 @@ public class BlockWandLoot extends BlockContainer implements ILookOverlay, ITool
nbt.setInteger("max", maxItems); nbt.setInteger("max", maxItems);
nbt.setString("pool", poolName); nbt.setString("pool", poolName);
nbt.setFloat("rot", placedRotation); nbt.setFloat("rot", placedRotation);
nbt.setBoolean("trigger", triggerReplace);
} }
@Override @Override
@ -332,8 +313,6 @@ public class BlockWandLoot extends BlockContainer implements ILookOverlay, ITool
placedRotation = nbt.getFloat("rot"); placedRotation = nbt.getFloat("rot");
if(replaceBlock == null) replaceBlock = ModBlocks.deco_loot; if(replaceBlock == null) replaceBlock = ModBlocks.deco_loot;
triggerReplace = nbt.getBoolean("trigger");
} }
@Override @Override

View File

@ -1,573 +0,0 @@
package com.hbm.blocks.generic;
import java.io.File;
import java.io.FileFilter;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
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;
import com.hbm.main.MainRegistry;
import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.toserver.NBTControlPacket;
import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.TileEntityLoadedBase;
import com.hbm.util.BufferUtil;
import com.hbm.util.Tuple.Pair;
import com.hbm.util.i18n.I18nUtil;
import com.hbm.world.gen.nbt.NBTStructure;
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.event.ClickEvent;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.Container;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
public class BlockWandStructure extends BlockContainer implements IBlockMulti, IGUIProvider, ILookOverlay {
private IIcon saveIcon;
private IIcon loadIcon;
public BlockWandStructure() {
super(Material.iron);
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta) {
return new TileEntityWandStructure();
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
saveIcon = iconRegister.registerIcon(RefStrings.MODID + ":wand_structure_save");
loadIcon = iconRegister.registerIcon(RefStrings.MODID + ":wand_structure_load");
}
@Override
public IIcon getIcon(int side, int meta) {
if(meta == 1) return loadIcon;
return saveIcon;
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
TileEntity te = world.getTileEntity(x, y, z);
if(!(te instanceof TileEntityWandStructure)) return false;
TileEntityWandStructure structure = (TileEntityWandStructure) te;
if(!player.isSneaking()) {
Block block = ModBlocks.getBlockFromStack(player.getHeldItem());
if(block != null && !ModBlocks.isStructureBlock(block, true)) {
Pair<Block, Integer> bm = new Pair<Block, Integer>(block, player.getHeldItem().getItemDamage());
if(structure.blacklist.contains(bm)) {
structure.blacklist.remove(bm);
} else {
structure.blacklist.add(bm);
}
return true;
}
if(world.isRemote) FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z);
return true;
}
return false;
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) {
list.add(new ItemStack(itemIn, 1, 0));
list.add(new ItemStack(itemIn, 1, 1));
}
@Override
public int getSubCount() {
return 2;
}
@Override
public String getUnlocalizedName(ItemStack stack) {
int meta = stack.getItemDamage();
if(meta == 1) return getUnlocalizedName() + ".load";
return getUnlocalizedName() + ".save";
}
@Override
public int damageDropped(int meta) {
return meta;
}
@Override
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
return null;
}
@Override
public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
int meta = world.getBlockMetadata(x, y, z);
TileEntityWandStructure structure = (TileEntityWandStructure) world.getTileEntity(x, y, z);
if(meta == 1) return new GuiStructureLoad(structure);
return new GuiStructureSave(structure);
}
@Override
public void printHook(Pre event, World world, int x, int y, int z) {
if(world.getBlockMetadata(x, y, z) != 0) return;
TileEntity te = world.getTileEntity(x, y, z);
if(!(te instanceof TileEntityWandStructure)) return;
TileEntityWandStructure structure = (TileEntityWandStructure) te;
List<String> text = new ArrayList<String>();
text.add(EnumChatFormatting.GRAY + "Name: " + EnumChatFormatting.RESET + structure.name);
text.add(EnumChatFormatting.GRAY + "Blacklist:");
for (Pair<Block, Integer> bm : structure.blacklist) {
text.add(EnumChatFormatting.RED + "- " + bm.getKey().getUnlocalizedName() + " : " + bm.getValue());
}
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".save.name"), 0xffff00, 0x404000, text);
}
public static class TileEntityWandStructure extends TileEntityLoadedBase implements IControlReceiver {
public String name = "";
public int sizeX = 1;
public int sizeY = 1;
public int sizeZ = 1;
public Set<Pair<Block, Integer>> blacklist = new HashSet<>();
@Override
public void updateEntity() {
if(!worldObj.isRemote) {
networkPackNT(256);
}
}
public void saveStructure(EntityPlayer player) {
if(name.isEmpty()) {
player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Could not save: invalid name"));
return;
}
if(sizeX <= 0 || sizeY <= 0 || sizeZ <= 0) {
player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Could not save: invalid dimensions"));
return;
}
Pair<Block, Integer> air = new Pair<Block, Integer>(Blocks.air, 0);
blacklist.add(air);
File file = NBTStructure.quickSaveArea(name + ".nbt", worldObj, xCoord, yCoord + 1, zCoord, xCoord + sizeX - 1, yCoord + sizeY, zCoord + sizeZ - 1, blacklist);
blacklist.remove(air);
if(file == null) {
player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Failed to save structure"));
return;
}
ChatComponentText fileText = new ChatComponentText(file.getName());
fileText.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_FILE, file.getParentFile().getAbsolutePath()));
fileText.getChatStyle().setUnderlined(true);
player.addChatMessage(new ChatComponentText("Saved structure as ").appendSibling(fileText));
}
public void loadStructure(EntityPlayer player) {
if(name.isEmpty()) {
player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Could not load: no filename specified"));
return;
}
File structureDirectory = new File(Minecraft.getMinecraft().mcDataDir, "structures");
structureDirectory.mkdir();
File structureFile = new File(structureDirectory, name + ".nbt");
boolean previousDebug = StructureConfig.debugStructures;
StructureConfig.debugStructures = true;
try {
NBTStructure structure = new NBTStructure(structureFile);
sizeX = structure.getSizeX();
sizeY = structure.getSizeY();
sizeZ = structure.getSizeZ();
structure.build(worldObj, xCoord, yCoord + 1, zCoord, 0, false, true);
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 0, 3);
player.addChatMessage(new ChatComponentText("Structure loaded"));
} catch (FileNotFoundException ex) {
player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Could not load: file not found"));
} finally {
StructureConfig.debugStructures = previousDebug;
}
}
@Override
public void serialize(ByteBuf buf) {
BufferUtil.writeString(buf, name);
buf.writeInt(sizeX);
buf.writeInt(sizeY);
buf.writeInt(sizeZ);
buf.writeInt(blacklist.size());
for(Pair<Block, Integer> bm : blacklist) {
buf.writeInt(Block.getIdFromBlock(bm.getKey()));
buf.writeInt(bm.getValue());
}
}
@Override
public void deserialize(ByteBuf buf) {
name = BufferUtil.readString(buf);
sizeX = buf.readInt();
sizeY = buf.readInt();
sizeZ = buf.readInt();
int count = buf.readInt();
blacklist = new HashSet<>();
for(int i = 0; i < count; i++) {
Block block = Block.getBlockById(buf.readInt());
int meta = buf.readInt();
blacklist.add(new Pair<Block, Integer>(block, meta));
}
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
name = nbt.getString("name");
sizeX = nbt.getInteger("sizeX");
sizeY = nbt.getInteger("sizeY");
sizeZ = nbt.getInteger("sizeZ");
int[] blocks = nbt.getIntArray("blocks");
int[] metas = nbt.getIntArray("metas");
blacklist = new HashSet<>();
for (int i = 0; i < blocks.length; i++) {
blacklist.add(new Pair<Block, Integer>(Block.getBlockById(blocks[i]), metas[i]));
}
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
nbt.setString("name", name);
nbt.setInteger("sizeX", sizeX);
nbt.setInteger("sizeY", sizeY);
nbt.setInteger("sizeZ", sizeZ);
nbt.setIntArray("blocks", blacklist.stream().mapToInt(b -> Block.getIdFromBlock(b.getKey())).toArray());
nbt.setIntArray("metas", blacklist.stream().mapToInt(b -> b.getValue()).toArray());
}
@Override
public boolean hasPermission(EntityPlayer player) {
return true;
}
public void receiveControl(NBTTagCompound data) {}
@Override
public void receiveControl(EntityPlayer player, NBTTagCompound nbt) {
readFromNBT(nbt);
markDirty();
if(nbt.getBoolean("save")) {
saveStructure(player);
}
if(nbt.getBoolean("load")) {
loadStructure(player);
}
}
@Override
@SideOnly(Side.CLIENT)
public AxisAlignedBB getRenderBoundingBox() {
return INFINITE_EXTENT_AABB;
}
@Override
@SideOnly(Side.CLIENT)
public double getMaxRenderDistanceSquared() {
return 65536.0D;
}
}
@SideOnly(Side.CLIENT)
public static class GuiStructureSave extends GuiScreen {
private final TileEntityWandStructure tile;
private GuiTextField textName;
private GuiTextField textSizeX;
private GuiTextField textSizeY;
private GuiTextField textSizeZ;
private GuiButton performAction;
private boolean saveOnClose = false;
public GuiStructureSave(TileEntityWandStructure tile) {
this.tile = tile;
}
@Override
public void initGui() {
Keyboard.enableRepeatEvents(true);
textName = new GuiTextField(fontRendererObj, width / 2 - 150, 50, 300, 20);
textName.setText(tile.name);
textSizeX = new GuiTextField(fontRendererObj, width / 2 - 150, 100, 50, 20);
textSizeX.setText("" + tile.sizeX);
textSizeY = new GuiTextField(fontRendererObj, width / 2 - 100, 100, 50, 20);
textSizeY.setText("" + tile.sizeY);
textSizeZ = new GuiTextField(fontRendererObj, width / 2 - 50, 100, 50, 20);
textSizeZ.setText("" + tile.sizeZ);
performAction = new GuiButton(0, width / 2 - 150, 150, 300, 20, "SAVE");
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
drawDefaultBackground();
textName.drawTextBox();
textSizeX.drawTextBox();
textSizeY.drawTextBox();
textSizeZ.drawTextBox();
performAction.drawButton(mc, mouseX, mouseY);
super.drawScreen(mouseX, mouseY, partialTicks);
}
@Override
public void onGuiClosed() {
Keyboard.enableRepeatEvents(false);
NBTTagCompound data = new NBTTagCompound();
tile.writeToNBT(data);
data.setString("name", textName.getText());
try { data.setInteger("sizeX", Integer.parseInt(textSizeX.getText())); } catch (Exception ex) {}
try { data.setInteger("sizeY", Integer.parseInt(textSizeY.getText())); } catch (Exception ex) {}
try { data.setInteger("sizeZ", Integer.parseInt(textSizeZ.getText())); } catch (Exception ex) {}
if(saveOnClose) data.setBoolean("save", true);
PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, tile.xCoord, tile.yCoord, tile.zCoord));
}
@Override
protected void keyTyped(char typedChar, int keyCode) {
super.keyTyped(typedChar, keyCode);
textName.textboxKeyTyped(typedChar, keyCode);
textSizeX.textboxKeyTyped(typedChar, keyCode);
textSizeY.textboxKeyTyped(typedChar, keyCode);
textSizeZ.textboxKeyTyped(typedChar, keyCode);
}
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) {
super.mouseClicked(mouseX, mouseY, mouseButton);
textName.mouseClicked(mouseX, mouseY, mouseButton);
textSizeX.mouseClicked(mouseX, mouseY, mouseButton);
textSizeY.mouseClicked(mouseX, mouseY, mouseButton);
textSizeZ.mouseClicked(mouseX, mouseY, mouseButton);
if(performAction.mousePressed(mc, mouseX, mouseY)) {
saveOnClose = true;
mc.displayGuiScreen(null);
mc.setIngameFocus();
}
}
@Override
public boolean doesGuiPauseGame() {
return false;
}
}
@SideOnly(Side.CLIENT)
public static class GuiStructureLoad extends GuiScreen {
private final TileEntityWandStructure tile;
private GuiTextField textName;
private GuiFileList fileList;
private GuiButton performAction;
private boolean loadOnClose = false;
private static File structureDirectory = new File(Minecraft.getMinecraft().mcDataDir, "structures");
private static String nameFilter = "";
private static final FileFilter structureFilter = new FileFilter() {
public boolean accept(File file) {
if(!file.isFile() || !file.getName().endsWith(".nbt")) return false;
return nameFilter.isEmpty() || file.getName().contains(nameFilter);
}
};
public GuiStructureLoad(TileEntityWandStructure tile) {
this.tile = tile;
}
@Override
public void initGui() {
Keyboard.enableRepeatEvents(true);
textName = new GuiTextField(fontRendererObj, width / 2 - 150, 50, 300, 20);
textName.setText(tile.name);
nameFilter = tile.name;
structureDirectory.mkdir();
fileList = new GuiFileList(mc, structureDirectory.listFiles(structureFilter), this::selectFile, nameFilter, width, height, 70, height - 90, 16);
performAction = new GuiButton(0, width / 2 - 150, height - 70, 300, 20, "LOAD");
}
public void selectFile(File file) {
String fileName = file.getName();
textName.setText(fileName.substring(0, fileName.length() - 4));
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
fileList.drawScreen(mouseX, mouseY, partialTicks);
textName.drawTextBox();
performAction.drawButton(mc, mouseX, mouseY);
super.drawScreen(mouseX, mouseY, partialTicks);
}
@Override
public void onGuiClosed() {
Keyboard.enableRepeatEvents(false);
NBTTagCompound data = new NBTTagCompound();
tile.writeToNBT(data);
data.setString("name", textName.getText());
if(loadOnClose) data.setBoolean("load", true);
PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, tile.xCoord, tile.yCoord, tile.zCoord));
}
@Override
protected void keyTyped(char typedChar, int keyCode) {
super.keyTyped(typedChar, keyCode);
textName.textboxKeyTyped(typedChar, keyCode);
if(!nameFilter.equals(textName.getText())) {
nameFilter = textName.getText();
fileList = new GuiFileList(mc, structureDirectory.listFiles(structureFilter), this::selectFile, nameFilter, width, height, 70, height - 90, 16);
}
}
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) {
super.mouseClicked(mouseX, mouseY, mouseButton);
textName.mouseClicked(mouseX, mouseY, mouseButton);
fileList.func_148179_a(mouseX, mouseY, mouseButton);
fileList.select(textName.getText());
if(performAction.mousePressed(mc, mouseX, mouseY)) {
loadOnClose = true;
mc.displayGuiScreen(null);
mc.setIngameFocus();
}
}
@Override
protected void mouseMovedOrUp(int mouseX, int mouseY, int state) {
super.mouseMovedOrUp(mouseX, mouseY, state);
fileList.func_148181_b(mouseX, mouseY, state);
}
@Override
public boolean doesGuiPauseGame() {
return false;
}
}
}

View File

@ -1,430 +0,0 @@
package com.hbm.blocks.generic;
import java.util.ArrayList;
import java.util.List;
import org.lwjgl.input.Keyboard;
import com.hbm.blocks.IBlockSideRotation;
import com.hbm.blocks.ILookOverlay;
import com.hbm.blocks.ModBlocks;
import com.hbm.interfaces.IControlReceiver;
import com.hbm.items.ModItems;
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.IGUIProvider;
import com.hbm.tileentity.TileEntityLoadedBase;
import com.hbm.util.BufferUtil;
import com.hbm.util.i18n.I18nUtil;
import com.hbm.util.fauxpointtwelve.BlockPos;
import com.hbm.world.gen.nbt.INBTBlockTransformable;
import com.hbm.world.gen.nbt.NBTStructure;
import com.hbm.world.gen.nbt.NBTStructure.JigsawConnection;
import com.hbm.world.gen.nbt.SpawnCondition;
import com.hbm.world.gen.nbt.JigsawPiece;
import com.hbm.world.gen.nbt.JigsawPool;
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.BlockPistonBase;
import net.minecraft.block.material.Material;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
import net.minecraftforge.common.util.ForgeDirection;
/**
* You're familiar with Billy Mitchell, World Video Game Champion? He could probably do it.
* So I gotta find a way to harness his power. And I think I've found a way.
*
* THAT'S RIGHT, WE'RE GONNA CHEAT.
*
* NBTStructures have the inherent flaws of the vanilla structure system: Structures are composed
* before terrain gen even kicks in, placement order of components are arbitrary and certain
* connected parts will fall apart due to unexpected variance in the terrain. Not good.
* The solution: Simply delay generation of parts using a tile entity that checks if the chunks
* in front of it are loaded, and then places a random part from the chosen pool. When this happens,
* the player is usually still far far away so they'll be none the wiser. Chunk load checks help
* prevent forced chunk loading and all the lag that comes with that.
*
* The system is named after tandem shaped charges: Make a hole with the first charge, then deliver
* the actual payload.
*
* @author hbm, Mellow
*/
public class BlockWandTandem extends BlockContainer implements IBlockSideRotation, INBTBlockTransformable, IGUIProvider, ILookOverlay {
private IIcon iconTop;
private IIcon iconSide;
private IIcon iconBack;
public BlockWandTandem() {
super(Material.iron);
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return new TileEntityWandTandem();
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {
int l = BlockPistonBase.determineOrientation(world, x, y, z, player);
world.setBlockMetadataWithNotify(x, y, z, l, 2);
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":wand_tandem");
this.iconTop = iconRegister.registerIcon(RefStrings.MODID + ":wand_tandem_top");
this.iconSide = iconRegister.registerIcon(RefStrings.MODID + ":wand_tandem_side");
this.iconBack = iconRegister.registerIcon(RefStrings.MODID + ":wand_tandem_back");
}
@Override
public IIcon getIcon(int side, int meta) {
if(side == meta) return blockIcon;
if(IBlockSideRotation.isOpposite(side, meta)) return iconBack;
if(side <= 1) return iconTop;
if(side > 3 && meta <= 1) return iconTop;
return iconSide;
}
@Override
public int getRotationFromSide(IBlockAccess world, int x, int y, int z, int side) {
if(side == 0) return IBlockSideRotation.topToBottom(getRotationFromSide(world, x, y, z, 1));
int meta = world.getBlockMetadata(x, y, z);
if(side == meta || IBlockSideRotation.isOpposite(side, meta)) return 0;
// downwards facing has no changes, upwards flips anything not handled already
if(meta == 0) return 0;
if(meta == 1) return 3;
// top (and bottom) is rotated fairly normally
if(side == 1) {
switch(meta) {
case 2: return 3;
case 3: return 0;
case 4: return 1;
case 5: return 2;
}
}
// you know what I aint explaining further, it's a fucking mess here
if(meta == 2) return side == 4 ? 2 : 1;
if(meta == 3) return side == 4 ? 1 : 2;
if(meta == 4) return side == 2 ? 1 : 2;
if(meta == 5) return side == 2 ? 2 : 1;
return 0;
}
@Override
public int getRenderType() {
return IBlockSideRotation.getRenderType();
}
@Override
public int transformMeta(int meta, int coordBaseMode) {
return INBTBlockTransformable.transformMetaDeco(meta, coordBaseMode);
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
TileEntity te = world.getTileEntity(x, y, z);
if(!(te instanceof TileEntityWandTandem)) return false;
TileEntityWandTandem jigsaw = (TileEntityWandTandem) te;
if(player.getHeldItem() != null && player.getHeldItem().getItem() == Items.paper) {
TileEntityWandTandem.copyMode = true;
if(!player.getHeldItem().hasTagCompound()) {
player.getHeldItem().stackTagCompound = new NBTTagCompound();
jigsaw.writeToNBT(player.getHeldItem().stackTagCompound);
} else {
jigsaw.readFromNBT(player.getHeldItem().stackTagCompound);
jigsaw.markDirty();
}
TileEntityWandTandem.copyMode = false;
return true;
}
if(!player.isSneaking()) {
Block block = ModBlocks.getBlockFromStack(player.getHeldItem());
if(block == ModBlocks.wand_air) block = Blocks.air;
if(block != null && !ModBlocks.isStructureBlock(block, false)) {
jigsaw.replaceBlock = block;
jigsaw.replaceMeta = player.getHeldItem().getItemDamage();
jigsaw.markDirty();
return true;
}
if(player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.wand_s) return false;
if(world.isRemote) FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z);
return true;
}
return false;
}
@Override
@SideOnly(Side.CLIENT)
public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new GuiWandTandem((TileEntityWandTandem) world.getTileEntity(x, y, z));
}
@Override
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
return null;
}
@Override
public void printHook(Pre event, World world, int x, int y, int z) {
TileEntity te = world.getTileEntity(x, y, z);
if(!(te instanceof TileEntityWandTandem)) return;
TileEntityWandTandem jigsaw = (TileEntityWandTandem) te;
List<String> text = new ArrayList<String>();
text.add(EnumChatFormatting.GRAY + "Target pool: " + EnumChatFormatting.RESET + jigsaw.pool);
text.add(EnumChatFormatting.GRAY + "Target name: " + EnumChatFormatting.RESET + jigsaw.target);
text.add(EnumChatFormatting.GRAY + "Turns into: " + EnumChatFormatting.RESET + GameRegistry.findUniqueIdentifierFor(jigsaw.replaceBlock).toString());
text.add(EnumChatFormatting.GRAY + " with meta: " + EnumChatFormatting.RESET + jigsaw.replaceMeta);
text.add(EnumChatFormatting.GRAY + "Joint type: " + EnumChatFormatting.RESET + (jigsaw.isRollable ? "Rollable" : "Aligned"));
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
}
public static class TileEntityWandTandem extends TileEntityLoadedBase implements IControlReceiver {
public static boolean copyMode = false;
private String pool = "default";
private String target = "default";
private Block replaceBlock = Blocks.air;
private int replaceMeta = 0;
private boolean isRollable = true; // sets joint type, rollable joints can be placed in any orientation for vertical jigsaw connections
private boolean isArmed = false;
private SpawnCondition structure;
@Override
public void updateEntity() {
if(!worldObj.isRemote) {
tryGenerate();
networkPackNT(15);
}
}
private void tryGenerate() {
if(!this.isArmed || target == null || target.isEmpty() || pool == null || pool.isEmpty()) return;
JigsawPool pool = structure.getPool(this.pool);
if(pool == null) return;
JigsawPiece nextPiece = pool.get(worldObj.rand);
if(nextPiece == null) return;
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata());
List<JigsawConnection> connectionPool = nextPiece.structure.getConnectionPool(dir, target);
if(connectionPool == null) return;
JigsawConnection toConnection = connectionPool.get(worldObj.rand.nextInt(connectionPool.size()));
int nextCoordBase = directionOffsetToCoordBase(dir.getOpposite(), toConnection.dir);
BlockPos pos = new BlockPos(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ);
// offset the starting point to the connecting point
int ox = nextPiece.structure.rotateX(toConnection.pos.x, toConnection.pos.z, nextCoordBase);
int oy = toConnection.pos.y;
int oz = nextPiece.structure.rotateZ(toConnection.pos.x, toConnection.pos.z, nextCoordBase);
nextPiece.structure.build(worldObj, nextPiece, pos.getX() - ox, pos.getY() - oy, pos.getZ() - oz, nextCoordBase, structure.name);
worldObj.setBlock(xCoord, yCoord, zCoord, replaceBlock, replaceMeta, 2);
}
private int directionOffsetToCoordBase(ForgeDirection from, ForgeDirection to) {
for(int i = 0; i < 4; i++) {
if(from == to) return i % 4;
from = from.getRotation(ForgeDirection.DOWN);
}
return 0;
}
@Override
public void serialize(ByteBuf buf) {
BufferUtil.writeString(buf, pool);
BufferUtil.writeString(buf, target);
buf.writeInt(Block.getIdFromBlock(replaceBlock));
buf.writeInt(replaceMeta);
buf.writeBoolean(isRollable);
}
@Override
public void deserialize(ByteBuf buf) {
pool = BufferUtil.readString(buf);
target = BufferUtil.readString(buf);
replaceBlock = Block.getBlockById(buf.readInt());
replaceMeta = buf.readInt();
isRollable = buf.readBoolean();
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
if(!copyMode) {
super.writeToNBT(nbt);
nbt.setInteger("direction", this.getBlockMetadata());
if(isArmed) {
nbt.setBoolean("isArmed", isArmed);
nbt.setString("structure", structure.name);
}
}
nbt.setString("pool", pool);
nbt.setString("target", target);
nbt.setString("block", GameRegistry.findUniqueIdentifierFor(replaceBlock).toString());
nbt.setInteger("meta", replaceMeta);
nbt.setBoolean("roll", isRollable);
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
if(!copyMode) {
super.readFromNBT(nbt);
isArmed = nbt.getBoolean("isArmed");
structure = NBTStructure.getStructure(nbt.getString("structure"));
}
pool = nbt.getString("pool");
target = nbt.getString("target");
replaceBlock = Block.getBlockFromName(nbt.getString("block"));
replaceMeta = nbt.getInteger("meta");
isRollable = nbt.getBoolean("roll");
}
@Override
public boolean hasPermission(EntityPlayer player) {
return true;
}
@Override
public void receiveControl(NBTTagCompound nbt) {
readFromNBT(nbt);
markDirty();
}
public void arm(SpawnCondition structure) {
isArmed = true;
this.structure = structure;
}
}
public static class GuiWandTandem extends GuiScreen {
private final TileEntityWandTandem jigsaw;
private GuiTextField textPool;
private GuiTextField textTarget;
private GuiButton jointToggle;
public GuiWandTandem(TileEntityWandTandem jigsaw) {
this.jigsaw = jigsaw;
}
@Override
public void initGui() {
Keyboard.enableRepeatEvents(true);
textPool = new GuiTextField(fontRendererObj, this.width / 2 - 150, 50, 300, 20);
textPool.setText(jigsaw.pool);
textTarget = new GuiTextField(fontRendererObj, this.width / 2 + 10, 100, 140, 20);
textTarget.setText(jigsaw.target);
jointToggle = new GuiButton(0, this.width / 2 + 60, 150, 90, 20, jigsaw.isRollable ? "Rollable" : "Aligned");
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
drawDefaultBackground();
drawString(fontRendererObj, "Target pool:", this.width / 2 - 150, 37, 0xA0A0A0);
textPool.drawTextBox();
drawString(fontRendererObj, "Target name:", this.width / 2 + 10, 87, 0xA0A0A0);
textTarget.drawTextBox();
drawString(fontRendererObj, "Joint type:", this.width / 2 + 60, 137, 0xA0A0A0);
jointToggle.drawButton(mc, mouseX, mouseY);
super.drawScreen(mouseX, mouseY, partialTicks);
}
@Override
public void onGuiClosed() {
Keyboard.enableRepeatEvents(false);
NBTTagCompound data = new NBTTagCompound();
jigsaw.writeToNBT(data);
data.setString("pool", textPool.getText());
data.setString("target", textTarget.getText());
data.setBoolean("roll", jointToggle.displayString == "Rollable");
PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, jigsaw.xCoord, jigsaw.yCoord, jigsaw.zCoord));
}
@Override
protected void keyTyped(char typedChar, int keyCode) {
super.keyTyped(typedChar, keyCode);
textPool.textboxKeyTyped(typedChar, keyCode);
textTarget.textboxKeyTyped(typedChar, keyCode);
}
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) {
super.mouseClicked(mouseX, mouseY, mouseButton);
textPool.mouseClicked(mouseX, mouseY, mouseButton);
textTarget.mouseClicked(mouseX, mouseY, mouseButton);
if(jointToggle.mousePressed(mc, mouseX, mouseY)) {
jointToggle.displayString = jointToggle.displayString == "Rollable" ? "Aligned" : "Rollable";
}
}
@Override public boolean doesGuiPauseGame() { return false; }
}
}

View File

@ -1,183 +0,0 @@
package com.hbm.blocks.generic;
import java.util.List;
import org.lwjgl.opengl.GL11;
import com.hbm.blocks.BlockEnumMulti;
import com.hbm.extprop.HbmPlayerProps;
import com.hbm.render.block.ISBRHUniversal;
import com.hbm.render.util.RenderBlocksNT;
import com.hbm.util.EnumUtil;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class BlockWoodStructure extends BlockEnumMulti implements ISBRHUniversal {
public BlockWoodStructure(Material mat) {
super(mat, EnumWoodStructure.class, true, false);
}
public enum EnumWoodStructure {
ROOF, SCAFFOLD, CEILING
}
@Override public int getRenderType() { return renderID; }
@Override public boolean isOpaqueCube() { return false; }
@Override public boolean renderAsNormalBlock() { return false; }
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
return true;
}
@Override
public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side) {
EnumWoodStructure type = EnumUtil.grabEnumSafely(EnumWoodStructure.class, world.getBlockMetadata(x, y, z));
if(type == type.SCAFFOLD && side == ForgeDirection.UP) return true;
return false;
}
@Override
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
EnumWoodStructure type = EnumUtil.grabEnumSafely(EnumWoodStructure.class, world.getBlockMetadata(x, y, z));
setBlockBounds(0, 0, 0, 1, 1, 1);
if(type == type.ROOF) setBlockBounds(0F, 0F, 0F, 1F, 0.1875F, 1F);
if(type == type.SCAFFOLD) setBlockBounds(0.0625F, 0F, 0.0625F, 1F - 0.0625F, 1F, 1F - 0.0625F);
if(type == type.CEILING) setBlockBounds(0F, 0.875F, 0F, 1F, 1F, 1F);
}
@Override
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB aabb, List list, Entity collider) {
setBlockBoundsBasedOnState(world, x, y, z);
super.addCollisionBoxesToList(world, x, y, z, aabb, list, collider);
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
setBlockBoundsBasedOnState(world, x, y, z);
return super.getCollisionBoundingBoxFromPool(world, x, y, z);
}
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int i, int j, int k) {
int meta = world.getBlockMetadata(i, j, k);
EnumWoodStructure type = EnumUtil.grabEnumSafely(EnumWoodStructure.class, meta);
if (type == type.SCAFFOLD) return AxisAlignedBB.getBoundingBox(i, j, k, i + 1, j + 1, k + 1);
return super.getSelectedBoundingBoxFromPool(world, i, j, k);
}
@Override
public void renderInventoryBlock(Block block, int meta, int modelId, Object renderBlocks) {
GL11.glPushMatrix();
RenderBlocks renderer = (RenderBlocks) renderBlocks;
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
EnumWoodStructure type = EnumUtil.grabEnumSafely(EnumWoodStructure.class, meta);
if(type == type.ROOF) {
GL11.glTranslatef(0F, 0.125F, 0F);
renderer.setRenderBounds(0D, 0D, 0D, 0.125D, 0.125D, 1D); RenderBlocksNT.renderStandardInventoryBlock(block, meta, renderer);
renderer.setRenderBounds(0.875D, 0D, 0D, 1D, 0.125D, 1D); RenderBlocksNT.renderStandardInventoryBlock(block, meta, renderer);
renderer.setRenderBounds(0D, 0.125D, 0.0625D, 1D, 0.1875D, 0.4375D); RenderBlocksNT.renderStandardInventoryBlock(block, meta, renderer);
renderer.setRenderBounds(0D, 0.125D, 0.5625D, 1D, 0.1875D, 0.9375D); RenderBlocksNT.renderStandardInventoryBlock(block, meta, renderer);
}
if(type == type.SCAFFOLD) {
renderer.setRenderBounds(0.0625D, 0D, 0.0625D, 0.1875D, 0.875D, 0.1875D); RenderBlocksNT.renderStandardInventoryBlock(block, meta, renderer);
renderer.setRenderBounds(0.8125D, 0D, 0.0625D, 0.9375D, 0.875D, 0.1875D); RenderBlocksNT.renderStandardInventoryBlock(block, meta, renderer);
renderer.setRenderBounds(0.0625D, 0D, 0.8125D, 0.1875D, 0.875D, 0.9375D); RenderBlocksNT.renderStandardInventoryBlock(block, meta, renderer);
renderer.setRenderBounds(0.8125D, 0D, 0.8125D, 0.9375D, 0.875D, 0.9375D); RenderBlocksNT.renderStandardInventoryBlock(block, meta, renderer);
renderer.setRenderBounds(0D, 0.125D, 0D, 0.0625D, 0.375D, 1D); RenderBlocksNT.renderStandardInventoryBlock(block, meta, renderer);
renderer.setRenderBounds(0.9375D, 0.125D, 0D, 1D, 0.375D, 1D); RenderBlocksNT.renderStandardInventoryBlock(block, meta, renderer);
renderer.setRenderBounds(0D, 0.5D, 0D, 1D, 0.75D, 0.0625D); RenderBlocksNT.renderStandardInventoryBlock(block, meta, renderer);
renderer.setRenderBounds(0D, 0.5D, 0.9375D, 1D, 0.75D, 1D); RenderBlocksNT.renderStandardInventoryBlock(block, meta, renderer);
renderer.setRenderBounds(0D, 0.875D, 0D, 1D, 1D, 1D); RenderBlocksNT.renderStandardInventoryBlock(block, meta, renderer);
}
if(type == type.CEILING) {
GL11.glTranslatef(0F, 0.625F, 0F);
renderer.setRenderBounds(0D, 0.0625D, 0D, 0.125D, 0.125D, 1D); RenderBlocksNT.renderStandardInventoryBlock(block, meta, renderer);
renderer.setRenderBounds(0.875D, 0.0625D, 0D, 1D, 0.125D, 1D); RenderBlocksNT.renderStandardInventoryBlock(block, meta, renderer);
renderer.setRenderBounds(0D, 0.125D, 0.0625D, 1D, 0.1875D, 0.4375D); RenderBlocksNT.renderStandardInventoryBlock(block, meta, renderer);
renderer.setRenderBounds(0D, 0.125D, 0.5625D, 1D, 0.1875D, 0.9375D); RenderBlocksNT.renderStandardInventoryBlock(block, meta, renderer);
}
GL11.glPopMatrix();
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, Object renderBlocks) {
RenderBlocksNT renderer = RenderBlocksNT.INSTANCE.setWorld(world);
Tessellator tessellator = Tessellator.instance;
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
tessellator.setColorOpaque_F(1, 1, 1);
int meta = world.getBlockMetadata(x, y, z);
EnumWoodStructure type = EnumUtil.grabEnumSafely(EnumWoodStructure.class,meta);
if(type == type.ROOF) {
boolean nx = world.getBlock(x - 1, y, z) == this && world.getBlockMetadata(x - 1, y, z) == meta;
boolean px = world.getBlock(x + 1, y, z) == this && world.getBlockMetadata(x + 1, y, z) == meta;
renderer.setRenderBounds(0D, 0D, 0D, 0.125D, 0.125D, 1D); renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.875D, 0D, 0D, 1D, 0.125D, 1D); renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(nx ? 0D : 0.0625D, 0.125D, 0.0625D, px ? 1D : 0.9375D, 0.1875D, 0.4375D); renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(nx ? 0D : 0.0625D, 0.125D, 0.5625D, px ? 1D : 0.9375D, 0.1875D, 0.9375D); renderer.renderStandardBlock(block, x, y, z);
}
if(type == type.SCAFFOLD) {
boolean py = world.getBlock(x, y + 1, z) == this && world.getBlockMetadata(x, y + 1, z) == meta;
boolean nx = world.getBlock(x - 1, y, z) == this && world.getBlockMetadata(x - 1, y, z) == meta;
boolean nz = world.getBlock(x, y, z - 1) == this && world.getBlockMetadata(x, y, z - 1) == meta;
boolean px = world.getBlock(x + 1, y, z) == this && world.getBlockMetadata(x + 1, y, z) == meta;
boolean pz = world.getBlock(x, y, z + 1) == this && world.getBlockMetadata(x, y, z + 1) == meta;
renderer.setRenderBounds(0.0625D, 0D, 0.0625D, 0.1875D, py ? 1D : 0.875D, 0.1875D); renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.8125D, 0D, 0.0625D, 0.9375D, py ? 1D : 0.875D, 0.1875D); renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.0625D, 0D, 0.8125D, 0.1875D, py ? 1D : 0.875D, 0.9375D); renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.8125D, 0D, 0.8125D, 0.9375D, py ? 1D : 0.875D, 0.9375D); renderer.renderStandardBlock(block, x, y, z);
if(!nx) renderer.setRenderBounds(0D, 0.125D, 0D, 0.0625D, 0.375D, 1D); renderer.renderStandardBlock(block, x, y, z);
if(!px) renderer.setRenderBounds(0.9375D, 0.125D, 0D, 1D, 0.375D, 1D); renderer.renderStandardBlock(block, x, y, z);
if(!nz) renderer.setRenderBounds(0D, 0.5D, 0D, 1D, 0.75D, 0.0625D); renderer.renderStandardBlock(block, x, y, z);
if(!pz) renderer.setRenderBounds(0D, 0.5D, 0.9375D, 1D, 0.75D, 1D); renderer.renderStandardBlock(block, x, y, z);
if(!py) renderer.setRenderBounds(0D, 0.875D, 0D, 1D, 1D, 1D); renderer.renderStandardBlock(block, x, y, z);
}
if(type == type.CEILING) {
renderer.setRenderBounds(0D, 0.875D, 0D, 0.125D, 0.9375D, 1D); renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.875D, 0.875D, 0D, 1D, 0.9375D, 1D); renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0D, 0.9375D, 0.0625D, 1D, 1D, 0.4375D); renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0D, 0.9375D, 0.5625D, 1D, 1D, 0.9375D); renderer.renderStandardBlock(block, x, y, z);
}
return true;
}
@Override
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
if (entity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) entity;
int meta = world.getBlockMetadata(x, y, z);
EnumWoodStructure type = EnumUtil.grabEnumSafely(EnumWoodStructure.class,meta);
if (type != type.SCAFFOLD) return;
HbmPlayerProps props = HbmPlayerProps.getData(player);
props.isOnLadder = true;
}
}
}

View File

@ -6,7 +6,7 @@ import java.util.Random;
import com.hbm.blocks.ModBlocks; import com.hbm.blocks.ModBlocks;
import com.hbm.tileentity.deco.TileEntityDecoBlock; import com.hbm.tileentity.deco.TileEntityDecoBlock;
import com.hbm.world.gen.nbt.INBTBlockTransformable; import com.hbm.world.gen.INBTTransformable;
import api.hbm.block.IToolable; import api.hbm.block.IToolable;
import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.client.registry.RenderingRegistry;
@ -25,7 +25,7 @@ import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
public class DecoBlock extends BlockContainer implements IToolable, INBTBlockTransformable { public class DecoBlock extends BlockContainer implements IToolable, INBTTransformable {
Random rand = new Random(); Random rand = new Random();
@ -185,6 +185,6 @@ public class DecoBlock extends BlockContainer implements IToolable, INBTBlockTra
@Override @Override
public int transformMeta(int meta, int coordBaseMode) { public int transformMeta(int meta, int coordBaseMode) {
return INBTBlockTransformable.transformMetaDeco(meta, coordBaseMode); return INBTTransformable.transformMetaDeco(meta, coordBaseMode);
} }
} }

View File

@ -1,7 +1,7 @@
package com.hbm.blocks.generic; package com.hbm.blocks.generic;
import com.hbm.tileentity.deco.TileEntityDecoPoleSatelliteReceiver; import com.hbm.tileentity.deco.TileEntityDecoPoleSatelliteReceiver;
import com.hbm.world.gen.nbt.INBTBlockTransformable; import com.hbm.world.gen.INBTTransformable;
import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
@ -11,7 +11,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import net.minecraft.world.World; import net.minecraft.world.World;
public class DecoPoleSatelliteReceiver extends BlockContainer implements INBTBlockTransformable { public class DecoPoleSatelliteReceiver extends BlockContainer implements INBTTransformable {
public DecoPoleSatelliteReceiver(Material p_i45386_1_) { public DecoPoleSatelliteReceiver(Material p_i45386_1_) {
super(p_i45386_1_); super(p_i45386_1_);
@ -61,7 +61,7 @@ public class DecoPoleSatelliteReceiver extends BlockContainer implements INBTBlo
@Override @Override
public int transformMeta(int meta, int coordBaseMode) { public int transformMeta(int meta, int coordBaseMode) {
return INBTBlockTransformable.transformMetaDeco(meta, coordBaseMode); return INBTTransformable.transformMetaDeco(meta, coordBaseMode);
} }
} }

View File

@ -1,6 +1,6 @@
package com.hbm.blocks.generic; package com.hbm.blocks.generic;
import com.hbm.world.gen.nbt.INBTBlockTransformable; import com.hbm.world.gen.INBTTransformable;
import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.client.registry.RenderingRegistry;
import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockContainer;
@ -11,7 +11,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import net.minecraft.world.World; import net.minecraft.world.World;
public class DecoTapeRecorder extends BlockContainer implements INBTBlockTransformable { public class DecoTapeRecorder extends BlockContainer implements INBTTransformable {
public DecoTapeRecorder(Material p_i45386_1_) { public DecoTapeRecorder(Material p_i45386_1_) {
super(p_i45386_1_); super(p_i45386_1_);
@ -63,7 +63,7 @@ public class DecoTapeRecorder extends BlockContainer implements INBTBlockTransfo
@Override @Override
public int transformMeta(int meta, int coordBaseMode) { public int transformMeta(int meta, int coordBaseMode) {
return INBTBlockTransformable.transformMetaDeco(meta, coordBaseMode); return INBTTransformable.transformMetaDeco(meta, coordBaseMode);
} }
} }

View File

@ -1,137 +0,0 @@
package com.hbm.blocks.generic;
import java.util.function.Consumer;
import java.util.function.Function;
import com.hbm.blocks.generic.BlockSkeletonHolder.TileEntitySkeletonHolder;
import com.hbm.entity.mob.EntityUndeadSoldier;
import com.hbm.items.ItemEnums.EnumSecretType;
import com.hbm.items.ModItems;
import com.hbm.util.EnumUtil;
import com.hbm.util.Vec3NT;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
public class DungeonSpawner extends BlockContainer {
public DungeonSpawner() {
super(Material.rock);
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return new TileEntityDungeonSpawner();
}
public static class TileEntityDungeonSpawner extends TileEntity {
public int phase = 0;
public int timer = 0;
public EnumSpawnerType type = EnumSpawnerType.ABERRATOR;
@Override
public void updateEntity() {
if(!worldObj.isRemote) {
type.phase.accept(this);
if(type.phaseCondition.apply(this)) {
phase++;
timer = 0;
} else {
timer++;
}
}
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
nbt.setInteger("phase", phase);
nbt.setByte("type", (byte) type.ordinal());
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
this.phase = nbt.getInteger("phase");
this.type = EnumUtil.grabEnumSafely(EnumSpawnerType.class, nbt.getByte("type"));
}
}
public static enum EnumSpawnerType {
ABERRATOR(CON_ABERRATOR, PHASE_ABERRATOR);
public Function<TileEntityDungeonSpawner, Boolean> phaseCondition;
public Consumer<TileEntityDungeonSpawner> phase;
private EnumSpawnerType(Function<TileEntityDungeonSpawner, Boolean> con, Consumer<TileEntityDungeonSpawner> ph) {
this.phaseCondition = con;
this.phase = ph;
}
}
public static Function<TileEntityDungeonSpawner, Boolean> CON_ABERRATOR = (tile) -> {
World world = tile.getWorldObj();
if(world.difficultySetting.ordinal() == 0) return false;
int x = tile.xCoord;
int y = tile.yCoord;
int z = tile.zCoord;
if(tile.phase == 0) {
if(world.getTotalWorldTime() % 20 != 0) return false;
return !world.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y - 2, z + 1).expand(20, 10, 20)).isEmpty();
}
if(tile.phase < 3) {
if(world.getTotalWorldTime() % 20 != 0 || tile.timer < 60) return false;
return world.getEntitiesWithinAABB(EntityUndeadSoldier.class, AxisAlignedBB.getBoundingBox(x, y, z, x - 2, y + 1, z + 1).expand(50, 20, 50)).isEmpty();
}
return false;
};
public static Consumer<TileEntityDungeonSpawner> PHASE_ABERRATOR = (tile) -> {
World world = tile.getWorldObj();
int x = tile.xCoord;
int y = tile.yCoord;
int z = tile.zCoord;
if(tile.phase == 1 || tile.phase == 2) {
if(tile.timer == 0) {
Vec3NT vec = new Vec3NT(10, 0, 0);
for(int i = 0; i < 10; i++) {
EntityUndeadSoldier mob = new EntityUndeadSoldier(world);
for(int j = 0; j < 7; j++) {
mob.setPositionAndRotation(x + 0.5 + vec.xCoord, y - 5, z + 0.5 + vec.zCoord, i * 36F, 0);
if(mob.getCanSpawnHere()) {
mob.onSpawnWithEgg(null);
world.spawnEntityInWorld(mob);
break;
}
}
vec.rotateAroundYDeg(36D);
}
}
}
if(tile.phase > 2) {
TileEntity te = world.getTileEntity(x, y + 18, z);
if(te instanceof TileEntitySkeletonHolder) {
TileEntitySkeletonHolder skeleton = (TileEntitySkeletonHolder) te;
if(world.rand.nextInt(5) == 0) {
skeleton.item = new ItemStack(ModItems.item_secret, 1, EnumSecretType.ABERRATOR.ordinal());
} else {
skeleton.item = new ItemStack(ModItems.clay_tablet, 1, 1);
}
skeleton.markDirty();
world.markBlockForUpdate(x, y + 18, z);
}
world.setBlock(x, y, z, Blocks.obsidian);
}
};
}

View File

@ -1,162 +0,0 @@
package com.hbm.blocks.generic;
import com.hbm.world.gen.util.LogicBlockActions;
import com.hbm.world.gen.util.LogicBlockConditions;
import com.hbm.world.gen.util.LogicBlockInteractions;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import java.util.function.Consumer;
import java.util.function.Function;
public class LogicBlock extends BlockContainer {
public LogicBlock() {
super(Material.rock);
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return new LogicBlock.TileEntityLogicBlock();
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
TileEntity tile = world.getTileEntity(x, y, z);
if(tile instanceof LogicBlock.TileEntityLogicBlock){
LogicBlock.TileEntityLogicBlock logicBlock = (LogicBlock.TileEntityLogicBlock) tile;
if(logicBlock.disguise != null){
return logicBlock.disguise.getIcon(side, logicBlock.disguiseMeta);
}
}
return super.getIcon(world, x, y, z, side);
}
@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);
if(te instanceof LogicBlock.TileEntityLogicBlock && ((LogicBlock.TileEntityLogicBlock) te).interaction != null) {
((LogicBlock.TileEntityLogicBlock) te).interaction.accept(new Object[]{worldIn, te, x, y, z, player, side, subX, subY, subZ});
return true;
}
return super.onBlockActivated(worldIn, x, y, z, player, side, subX, subY, subZ);
}
public static class TileEntityLogicBlock extends TileEntity {
//phase is incremented per condition check, timer counts since last condition check by default
public int phase = 0;
public int timer = 0;
public Block disguise;
public int disguiseMeta;
/**Actions always get called before conditions, use the phase and timer variables in order to control behavior via conditions*/
public String conditionID = "PLAYER_CUBE_5";
public String actionID = "FODDER_WAVE";
/**Interactions are called on right click, and passes on the parameters of the right click to consumer*/
public String interactionID;
public Function<LogicBlock.TileEntityLogicBlock, Boolean> condition;
public Consumer<LogicBlock.TileEntityLogicBlock> action;
/**Consists of world instance, TileEntity instance, three ints for coordinates, one int for block side, and player instance, in that order **/
public Consumer<Object[]> interaction;
public EntityPlayer player;
public ForgeDirection direction = ForgeDirection.UNKNOWN;
@Override
public void updateEntity() {
if(!worldObj.isRemote) {
if(action == null){
action = LogicBlockActions.actions.get(actionID);
}
if(condition == null){
condition = LogicBlockConditions.conditions.get(conditionID);
}
if(interaction == null && interactionID != null){
interaction = LogicBlockInteractions.interactions.get(interactionID);
}
if(action == null || condition == null){
worldObj.setBlock(xCoord,yCoord,zCoord, Blocks.air);
return;
}
action.accept(this);
if(condition.apply(this)) {
phase++;
timer = 0;
} else {
timer++;
}
}
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
nbt.setInteger("phase", phase);
nbt.setString("actionID", actionID);
nbt.setString("conditionID", conditionID);
if(interactionID != null)
nbt.setString("interactionID", interactionID);
nbt.setInteger("direction", direction.ordinal());
if(disguise != null){
nbt.setInteger("disguiseMeta", disguiseMeta);
nbt.setString("disguise", GameRegistry.findUniqueIdentifierFor(disguise).toString());
}
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
this.phase = nbt.getInteger("phase");
this.actionID = nbt.getString("actionID");
this.conditionID = nbt.getString("conditionID");
if(nbt.hasKey("interactionID")) this.interactionID = nbt.getString("interactionID");
this.direction = ForgeDirection.getOrientation(nbt.getInteger("direction"));
if(nbt.hasKey("disguise")){
disguiseMeta = nbt.getInteger("disguiseMeta");
disguise = Block.getBlockFromName(nbt.getString("disguise"));
}
}
@Override
public Packet getDescriptionPacket() {
NBTTagCompound nbt = new NBTTagCompound();
this.writeToNBT(nbt);
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbt);
}
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
this.readFromNBT(pkt.func_148857_g());
}
}
}

View File

@ -79,7 +79,7 @@ public class TritiumLamp extends Block implements ISpotlight {
private void updateBeam(World world, int x, int y, int z) { private void updateBeam(World world, int x, int y, int z) {
if(!isOn) return; if(!isOn) return;
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) Spotlight.propagateBeam(world, x, y, z, dir, getBeamLength(), getMeta()); for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) Spotlight.propagateBeam(world, x, y, z, dir, getBeamLength());
} }
@Override @Override
@ -98,12 +98,6 @@ public class TritiumLamp extends Block implements ISpotlight {
return new ItemStack(getOff()); return new ItemStack(getOff());
} }
protected int getMeta() {
if(this == ModBlocks.lamp_tritium_green_off || this == ModBlocks.lamp_tritium_green_on) return Spotlight.META_GREEN;
if(this == ModBlocks.lamp_tritium_blue_off || this == ModBlocks.lamp_tritium_blue_on) return Spotlight.META_BLUE;
return Spotlight.META_YELLOW;
}
protected Block getOff() { protected Block getOff() {
if(this == ModBlocks.lamp_tritium_green_on) return ModBlocks.lamp_tritium_green_off; if(this == ModBlocks.lamp_tritium_green_on) return ModBlocks.lamp_tritium_green_off;
if(this == ModBlocks.lamp_tritium_blue_on) return ModBlocks.lamp_tritium_blue_off; if(this == ModBlocks.lamp_tritium_blue_on) return ModBlocks.lamp_tritium_blue_off;

View File

@ -2,9 +2,8 @@ package com.hbm.blocks.machine;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
public class BlockCMFlux extends BlockPillar { public class BlockCMFlux extends BlockPillar{
public BlockCMFlux(Material mat, String top) {
public BlockCMFlux(Material mat, String top) { super(mat, top);
super(mat, top); }
}
} }

View File

@ -2,9 +2,8 @@ package com.hbm.blocks.machine;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
public class BlockCMHeat extends BlockPillar { public class BlockCMHeat extends BlockPillar{
public BlockCMHeat(Material mat, String top) {
public BlockCMHeat(Material mat, String top) { super(mat, top);
super(mat, top); }
}
} }

View File

@ -1,13 +0,0 @@
package com.hbm.blocks.machine;
import com.hbm.blocks.generic.BlockToolConversion;
import net.minecraft.block.material.Material;
public class BlockFusionComponent extends BlockToolConversion {
public BlockFusionComponent() {
super(Material.iron);
this.addVariant(".bscco_welded", ".blanket", ".motor");
}
}

View File

@ -1,16 +0,0 @@
package com.hbm.blocks.machine;
import com.hbm.tileentity.machine.TileEntityFusionTorusStruct;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class BlockFusionTorusStruct extends BlockContainer {
public BlockFusionTorusStruct(Material mat) { super(mat); }
@Override public TileEntity createNewTileEntity(World world, int meta) { return new TileEntityFusionTorusStruct(); }
@Override public boolean isOpaqueCube() { return false; }
}

View File

@ -7,7 +7,7 @@ import com.hbm.blocks.ITooltipProvider;
import com.hbm.render.block.ct.CT; import com.hbm.render.block.ct.CT;
import com.hbm.render.block.ct.CTStitchReceiver; import com.hbm.render.block.ct.CTStitchReceiver;
import com.hbm.render.block.ct.IBlockCT; import com.hbm.render.block.ct.IBlockCT;
import com.hbm.util.i18n.I18nUtil; import com.hbm.util.I18nUtil;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;

View File

@ -7,7 +7,7 @@ import org.lwjgl.input.Keyboard;
import com.hbm.blocks.BlockMulti; import com.hbm.blocks.BlockMulti;
import com.hbm.blocks.ITooltipProvider; import com.hbm.blocks.ITooltipProvider;
import com.hbm.lib.RefStrings; import com.hbm.lib.RefStrings;
import com.hbm.util.i18n.I18nUtil; import com.hbm.util.I18nUtil;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;

View File

@ -6,7 +6,7 @@ import java.util.List;
import com.hbm.blocks.ILookOverlay; import com.hbm.blocks.ILookOverlay;
import com.hbm.tileentity.machine.TileEntityHadronPower; import com.hbm.tileentity.machine.TileEntityHadronPower;
import com.hbm.util.BobMathUtil; import com.hbm.util.BobMathUtil;
import com.hbm.util.i18n.I18nUtil; import com.hbm.util.I18nUtil;
import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;

Some files were not shown because too many files have changed in this diff Show More