mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Merge branch 'ttttt' into forestchem
# Conflicts: # src/main/java/com/hbm/world/gen/NTMWorldGenerator.java
This commit is contained in:
commit
c20a90e45c
1
.github/workflows/build.yml
vendored
1
.github/workflows/build.yml
vendored
@ -12,6 +12,7 @@ name: Java CI with Gradle
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
@ -13,6 +13,8 @@ Things you should also avoid include:
|
||||
* duplicate util functions (just use what we have, man)
|
||||
* 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)
|
||||
* updating the changelog (you're guaranteed to cause a merge conflict with that)
|
||||
* any use of `I18n`, use `I18nUtil` instead
|
||||
|
||||
## Test your code
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
|
||||
* 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 Community Edition (WarFactory): https://codeberg.org/MrNorwood/Hbm-s-Nuclear-Tech-CE
|
||||
* NTM Community Edition (WarFactory): https://github.com/MisterNorwood/Hbm-s-Nuclear-Tech-CE
|
||||
|
||||
For 1.18, try Martin's remake: https://codeberg.org/MartinTheDragon/Nuclear-Tech-Mod-Remake/releases
|
||||
|
||||
|
||||
14
build.gradle
14
build.gradle
@ -79,6 +79,18 @@ repositories {
|
||||
// name = "CurseForge"
|
||||
// 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 {
|
||||
@ -94,6 +106,8 @@ dependencies {
|
||||
compileOnly "inventorytweaks:InventoryTweaks:1.59-dev:deobf"
|
||||
|
||||
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 {
|
||||
|
||||
25
changelog
25
changelog
@ -1,17 +1,14 @@
|
||||
## Added
|
||||
* Sandbags
|
||||
* Connect to other sandbags or solid blocks
|
||||
* Pretts
|
||||
* Wooden barrier
|
||||
* Pretty
|
||||
* Automatically walls off connected solid blocks in addition to the direction it was placed in
|
||||
|
||||
## Changed
|
||||
* Increased bayonet damage from 5 to 7.5 hearts
|
||||
* Two numeric redstone over radio signals sent over the same channel will now be added together instead of one signal replacing the other
|
||||
* This means that reading the fill state of multiple batteries over the same channel should result the combined fill state of all batteries
|
||||
* Halved base spread of the .22 SMG
|
||||
* Certain secret guns now have a proper way of being obtained
|
||||
* Updated ukrainian and chinese localization, including QMAW
|
||||
* Due to severe issues with ticking order as well as a crash caused by certain tiles that uses threaded packets, Torcherino accelerator torches no longer affect NTM machines
|
||||
* RBMK control rod colors and auto control rod settings are now copiable
|
||||
* Murky wings no longer have slowfall, and using shift+space cancels the momentum
|
||||
* Murky wings are now slow by default and speed up when sprinting
|
||||
* The arc furnace can now be used with AE2 buses, which was previously not possible due to the unique stacksize limitations
|
||||
|
||||
## Fixed
|
||||
* Fixed RoR controller having the wrong recipe
|
||||
* Fixed conveyor grabber dropping items off at an offset when placing them on a conveyor belt due to a client desync
|
||||
* Fixed occasional crash caused by using the settings tool on the autoloader
|
||||
* Fixed QMAW not correctly working with other languages
|
||||
* Fixed QMAW loading breaking entirely due to file encoding
|
||||
* Fixed PWR fuel rod textures being 18x18 instead of 16x16
|
||||
@ -1,67 +1,73 @@
|
||||
mod_version=1.0.27
|
||||
# Empty build number makes a release type
|
||||
mod_build_number=5320
|
||||
|
||||
credits=HbMinecraft,\
|
||||
\ rodolphito (explosion algorithms),\
|
||||
\ grangerave (explosion algorithms),\
|
||||
\ Hoboy (textures, models),\
|
||||
\ Drillgon200 (effects, models, porting),\
|
||||
\ MartinTheDragon (calculator, chunk-based fallout, bendable cranes, pipe improvements, PWR sounds),\
|
||||
\ Alcater (GUI textures, porting),\
|
||||
\ MellowArpeggiation (new animation system, turbine sounds, sound fixes, industrial lights, better particle diodes),\
|
||||
\ Pheo (textures, various machines, models, weapons),\
|
||||
\ 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),\
|
||||
\ LePeep (coilgun model, BDCL QC),\
|
||||
\ Adam29 (liquid petroleum, ethanol, electric furnace),\
|
||||
\ Pvndols (thorium fuel recipe, gas turbine),\
|
||||
\ JamesH2 (blood mechanics, nitric acid, particle emitter),\
|
||||
\ Lazzzycat (structures),\
|
||||
\ PastaBaguette (coal horse decal),\
|
||||
\ Doctor17 (russian localization)),\
|
||||
\ Pashtet (russian localization),\
|
||||
\ Bismarck (chinese localization),\
|
||||
\ Creeper-banner (chinese localization),\
|
||||
\ 5467864 (chinese localization),\
|
||||
\ eeeeee0a (chinese localization),\
|
||||
\ hz0909adc (chinese localization),\
|
||||
\ LSKLW (chinese localization),\
|
||||
\ R-Kaenbyou (chinese localization),\
|
||||
\ scp-000000000 (chinese localization),\
|
||||
\ UnnameTokiko (chinese localization),\
|
||||
\ Herobrine 457985 (chinese localization),\
|
||||
\ xxwinhere (chinese localization),\
|
||||
\ Maksymisio (polish localization)\
|
||||
\ el3ctro4ndre (italian localization),\
|
||||
\ Pu-238 (Tom impact effects),\
|
||||
\ Frooz (gun models),\
|
||||
\ VT-6/24 (models, textures),\
|
||||
\ Nos (models),\
|
||||
\ WushiThe (models),\
|
||||
\ Minecreep (models),\
|
||||
\ 70k (textures, glyphid AI, strand caster, electrolyzer changes, cryolite),\
|
||||
\ instantnootles (concept artist),\
|
||||
\ haru315 (spiral point algorithm),\
|
||||
\ Sten89 (models),\
|
||||
\ Pixelguru26 (textures),\
|
||||
\ TheBlueHat (textures),\
|
||||
\ Burningwater202 (laminate glass),\
|
||||
\ TehTemmie (reacher radiation function),\
|
||||
\ Silly541 (config for safe ME drives),\
|
||||
\ Voxelstice (OpenComputers integration, turbine spinup),\
|
||||
\ BallOfEnergy1 (OpenComputers integration, RBMK and packet optimization, crate backpacks),\
|
||||
\ sdddddf80 (recipe configs, chinese localization, custom machine holograms),\
|
||||
\ Abel1502 (optimization, crate upgrade recipes, strand caster improvements, varous tweaks),\
|
||||
\ Darek505 (armor rendering compatibility fix),\
|
||||
\ SuperCraftAlex (tooltips)\
|
||||
\ Ice-Arrow (research reactor tweaks),\
|
||||
\ 245tt (anvil GUI improvements),\
|
||||
\ KoblizekXD (doors),\
|
||||
\ FOlkvangrField (custom machine parts),\
|
||||
\ RosaTryp (centrifuge config),\
|
||||
\ Toshayo (satellite loot system, project settings, gradle curse task),\
|
||||
\ icomet (refactoring),\
|
||||
\ martemen (project settings),\
|
||||
\ OvermindDL1 (project settings),\
|
||||
\ impbk2002 (project settings)\
|
||||
mod_version=1.0.27
|
||||
# Empty build number makes a release type
|
||||
mod_build_number=5426
|
||||
|
||||
credits=HbMinecraft,\
|
||||
\ rodolphito (explosion algorithms),\
|
||||
\ grangerave (explosion algorithms),\
|
||||
\ Hoboy (textures, models),\
|
||||
\ Drillgon200 (effects, models, porting),\
|
||||
\ MartinTheDragon (calculator, chunk-based fallout, bendable cranes, pipe improvements, PWR sounds),\
|
||||
\ Alcater (GUI textures, porting),\
|
||||
\ MellowArpeggiation (new animation system, turbine sounds, sound fixes, industrial lights, conveyor wand, NBT structures),\
|
||||
\ Pheo (textures, various machines, models, weapons),\
|
||||
\ 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),\
|
||||
\ LePeep (coilgun model, BDCL QC),\
|
||||
\ Adam29 (liquid petroleum, ethanol, electric furnace),\
|
||||
\ Pvndols (thorium fuel recipe, gas turbine),\
|
||||
\ JamesH2 (blood mechanics, nitric acid, particle emitter),\
|
||||
\ Lazzzycat (structures, mob gear),\
|
||||
\ PastaBaguette (coal horse decal),\
|
||||
\ Doctor17 (russian localization)),\
|
||||
\ Pashtet (russian localization),\
|
||||
\ 7H40 (russian localization),\
|
||||
\ Bismarck (chinese localization),\
|
||||
\ Creeper-banner (chinese localization),\
|
||||
\ 5467864 (chinese localization),\
|
||||
\ eeeeee0a (chinese localization),\
|
||||
\ hz0909adc (chinese localization),\
|
||||
\ LSKLW (chinese localization),\
|
||||
\ R-Kaenbyou (chinese localization),\
|
||||
\ scp-000000000 (chinese localization),\
|
||||
\ UnnameTokiko (chinese localization),\
|
||||
\ Herobrine 457985 (chinese localization),\
|
||||
\ xxwinhere (chinese localization),\
|
||||
\ Nycticoraxnightheron (chinese localization),\
|
||||
\ Maksymisio (polish localization)\
|
||||
\ el3ctro4ndre (italian localization),\
|
||||
\ Pu-238 (Tom impact effects),\
|
||||
\ Frooz (gun models),\
|
||||
\ VT-6/24 (models, textures),\
|
||||
\ Nos (models),\
|
||||
\ WushiThe (models),\
|
||||
\ Minecreep (models),\
|
||||
\ ackbarcrowbars (models),\
|
||||
\ haru315 (spiral point algorithm),\
|
||||
\ mlbv (threaded MK5),\
|
||||
\ 70k (textures, glyphid AI, strand caster, electrolyzer changes, cryolite),\
|
||||
\ instantnootles (concept artist),\
|
||||
\ Sten89 (models),\
|
||||
\ Pixelguru26 (textures),\
|
||||
\ TheBlueHat (textures),\
|
||||
\ Burningwater202 (laminate glass),\
|
||||
\ TehTemmie (reacher radiation function),\
|
||||
\ Silly541 (config for safe ME drives),\
|
||||
\ Voxelstice (OpenComputers integration, turbine spinup),\
|
||||
\ BallOfEnergy1 (OpenComputers integration, RBMK and packet optimization, crate backpacks),\
|
||||
\ sdddddf80 (recipe configs, chinese localization, custom machine holograms),\
|
||||
\ Abel1502 (abilities GUI, optimization, crate upgrade recipes, strand caster improvements, varous tweaks),\
|
||||
\ Darek505 (armor rendering compatibility fix),\
|
||||
\ SuperCraftAlex (tooltips)\
|
||||
\ Ice-Arrow (research reactor tweaks),\
|
||||
\ 245tt (anvil GUI improvements),\
|
||||
\ KoblizekXD (doors),\
|
||||
\ FOlkvangrField (custom machine parts),\
|
||||
\ RosaTryp (centrifuge config),\
|
||||
\ Toshayo (satellite loot system, project settings, gradle curse task, OpenComputers integration),\
|
||||
\ Dash (PA particle serialization fix),\
|
||||
\ archiecarrot123 (armor rendering compatibility fix),\
|
||||
\ icomet (refactoring),\
|
||||
\ martemen (project settings),\
|
||||
\ OvermindDL1 (project settings),\
|
||||
\ impbk2002 (project settings)\
|
||||
|
||||
@ -0,0 +1,9 @@
|
||||
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();
|
||||
}
|
||||
@ -1,10 +1,3 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* @author hbm
|
||||
*
|
||||
*/
|
||||
package api.hbm.fluidmk2;
|
||||
|
||||
/*
|
||||
@ -13,4 +6,19 @@ It's rather shrimple: the shiny new energy system using universal nodespace, but
|
||||
Has a few extra bits and pieces for handling, but the concept is basically the same.
|
||||
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.
|
||||
|
||||
*/
|
||||
@ -5,7 +5,7 @@ import com.hbm.handler.ThreeInts;
|
||||
import com.hbm.interfaces.ICopiable;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.IPersistentNBT;
|
||||
import com.hbm.world.gen.INBTTransformable;
|
||||
import com.hbm.world.gen.nbt.INBTBlockTransformable;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@ -26,6 +26,8 @@ import net.minecraft.stats.StatList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.DrawBlockHighlightEvent;
|
||||
@ -35,7 +37,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public abstract class BlockDummyable extends BlockContainer implements ICustomBlockHighlight, ICopiable, INBTTransformable {
|
||||
public abstract class BlockDummyable extends BlockContainer implements ICustomBlockHighlight, ICopiable, INBTBlockTransformable {
|
||||
|
||||
public BlockDummyable(Material mat) {
|
||||
super(mat);
|
||||
@ -75,27 +77,20 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl
|
||||
|
||||
super.onNeighborBlockChange(world, x, y, z, block);
|
||||
|
||||
if(world.isRemote || safeRem)
|
||||
if(safeRem)
|
||||
return;
|
||||
|
||||
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);
|
||||
}
|
||||
destroyIfOrphan(world, x, y, z);
|
||||
}
|
||||
|
||||
public void updateTick(World world, int x, int y, int z, Random 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)
|
||||
return;
|
||||
|
||||
@ -108,10 +103,32 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl
|
||||
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);
|
||||
// An extra precaution against multiblocks on chunk borders being erroneously deleted.
|
||||
// Technically, this might be used to persist ghost dummy blocks by manipulating
|
||||
// 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) {
|
||||
@ -441,8 +458,10 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl
|
||||
y = pos[1];
|
||||
z = pos[2];
|
||||
|
||||
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));
|
||||
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, rot);
|
||||
|
||||
if(entityBounding.intersectsWith(boxlet)) {
|
||||
list.add(boxlet);
|
||||
@ -467,6 +486,32 @@ 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);
|
||||
}
|
||||
|
||||
// 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
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
||||
if(!this.useDetailedHitbox()) {
|
||||
@ -500,10 +545,10 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl
|
||||
double dZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)interp;
|
||||
float exp = 0.002F;
|
||||
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
ForgeDirection rot = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z) - offset).getRotation(ForgeDirection.UP);
|
||||
|
||||
ICustomBlockHighlight.setup();
|
||||
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);
|
||||
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);
|
||||
ICustomBlockHighlight.cleanup();
|
||||
}
|
||||
|
||||
@ -520,6 +565,7 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl
|
||||
@Override
|
||||
public void pasteSettings(NBTTagCompound nbt, int index, World world, EntityPlayer player, int x, int y, int z) {
|
||||
int[] pos = findCore(world, x, y, z);
|
||||
if(pos == null) return;
|
||||
TileEntity tile = world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
if (tile instanceof ICopiable)
|
||||
((ICopiable) tile).pasteSettings(nbt, index, world, player, pos[0], pos[1], pos[2]);
|
||||
@ -545,7 +591,7 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl
|
||||
meta -= extra;
|
||||
}
|
||||
|
||||
meta = INBTTransformable.transformMetaDeco(meta, coordBaseMode);
|
||||
meta = INBTBlockTransformable.transformMetaDeco(meta, coordBaseMode);
|
||||
|
||||
if(isOffset) {
|
||||
meta += offset;
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package com.hbm.blocks;
|
||||
|
||||
import com.hbm.util.I18nUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
@ -8,6 +7,8 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ITooltipProvider {
|
||||
|
||||
@ -34,6 +34,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@ -281,6 +282,7 @@ public class ModBlocks {
|
||||
|
||||
public static Block sandbags;
|
||||
public static Block wood_barrier;
|
||||
public static Block wood_structure;
|
||||
|
||||
public static Block reinforced_brick;
|
||||
public static Block reinforced_ducrete;
|
||||
@ -313,12 +315,14 @@ public class ModBlocks {
|
||||
public static Block floodlight;
|
||||
public static Block floodlight_beam;
|
||||
|
||||
public static Block rebar;
|
||||
public static Block reinforced_stone;
|
||||
public static Block concrete_smooth;
|
||||
public static Block concrete_colored;
|
||||
public static Block concrete_colored_ext;
|
||||
public static Block concrete;
|
||||
public static Block concrete_asbestos;
|
||||
public static Block concrete_rebar;
|
||||
public static Block concrete_super;
|
||||
public static Block concrete_super_broken;
|
||||
public static Block ducrete_smooth;
|
||||
@ -335,7 +339,7 @@ public class ModBlocks {
|
||||
public static Block brick_compound;
|
||||
public static Block brick_asbestos;
|
||||
public static Block brick_fire;
|
||||
|
||||
|
||||
public static Block lightstone;
|
||||
|
||||
public static Block concrete_slab;
|
||||
@ -733,7 +737,6 @@ public class ModBlocks {
|
||||
public static Block hadron_analysis_glass;
|
||||
public static Block hadron_access;
|
||||
public static Block hadron_core;
|
||||
public static Block hadron_cooler;
|
||||
|
||||
public static Block pa_source;
|
||||
public static Block pa_beamline;
|
||||
@ -747,9 +750,6 @@ public class ModBlocks {
|
||||
|
||||
public static Block machine_microwave;
|
||||
|
||||
public static Block machine_arc_furnace_off;
|
||||
public static Block machine_arc_furnace_on;
|
||||
|
||||
//public static Block machine_deuterium;
|
||||
|
||||
public static Block machine_battery_potato;
|
||||
@ -791,8 +791,10 @@ public class ModBlocks {
|
||||
public static Block fluid_duct_paintable;
|
||||
public static Block fluid_duct_gauge;
|
||||
public static Block fluid_duct_exhaust;
|
||||
public static Block fluid_duct_paintable_block_exhaust;
|
||||
public static Block fluid_valve;
|
||||
public static Block fluid_switch;
|
||||
public static Block fluid_pump;
|
||||
public static Block machine_drain;
|
||||
public static Block radio_torch_sender;
|
||||
public static Block radio_torch_receiver;
|
||||
@ -801,6 +803,7 @@ public class ModBlocks {
|
||||
public static Block radio_torch_reader;
|
||||
public static Block radio_torch_controller;
|
||||
public static Block radio_telex;
|
||||
public static Block oc_cable_paintable;
|
||||
|
||||
public static Block conveyor;
|
||||
public static Block conveyor_express;
|
||||
@ -824,8 +827,9 @@ public class ModBlocks {
|
||||
public static Block drone_dock;
|
||||
public static Block drone_crate_provider;
|
||||
public static Block drone_crate_requester;
|
||||
|
||||
|
||||
public static Block pneumatic_tube;
|
||||
public static Block pneumatic_tube_paintable;
|
||||
|
||||
public static Block fan;
|
||||
|
||||
@ -844,6 +848,8 @@ public class ModBlocks {
|
||||
public static Block ladder_steel;
|
||||
public static Block ladder_tungsten;
|
||||
|
||||
public static Block trapdoor_steel;
|
||||
|
||||
public static Block barrel_plastic;
|
||||
public static Block barrel_corroded;
|
||||
public static Block barrel_iron;
|
||||
@ -852,9 +858,7 @@ public class ModBlocks {
|
||||
public static Block barrel_antimatter;
|
||||
|
||||
public static Block machine_transformer;
|
||||
public static Block machine_transformer_20;
|
||||
public static Block machine_transformer_dnt;
|
||||
public static Block machine_transformer_dnt_20;
|
||||
|
||||
public static Block machine_solar_boiler;
|
||||
public static Block solar_mirror;
|
||||
@ -1000,14 +1004,18 @@ public class ModBlocks {
|
||||
public static Block machine_mining_laser;
|
||||
public static Block barricade; // a sand bag that drops nothing, for automated walling purposes
|
||||
|
||||
public static Block machine_assembler;
|
||||
public static Block machine_assemfac;
|
||||
@Deprecated public static Block machine_assembler;
|
||||
public static Block machine_assembly_machine;
|
||||
@Deprecated public static Block machine_assemfac;
|
||||
public static Block machine_arc_welder;
|
||||
public static Block machine_soldering_station;
|
||||
public static Block machine_arc_furnace;
|
||||
|
||||
public static Block machine_chemplant;
|
||||
public static Block machine_chemfac;
|
||||
@Deprecated public static Block machine_chemplant;
|
||||
public static Block machine_chemical_plant;
|
||||
@Deprecated public static Block machine_chemfac;
|
||||
public static Block machine_chemical_factory;
|
||||
public static Block machine_purex;
|
||||
public static Block machine_mixer;
|
||||
|
||||
public static Block machine_fluidtank;
|
||||
@ -1114,6 +1122,7 @@ public class ModBlocks {
|
||||
public static Block rbmk_heater;
|
||||
public static Block rbmk_console;
|
||||
public static Block rbmk_crane_console;
|
||||
public static Block rbmk_autoloader;
|
||||
public static Block rbmk_loader;
|
||||
public static Block rbmk_steam_inlet;
|
||||
public static Block rbmk_steam_outlet;
|
||||
@ -1238,6 +1247,10 @@ public class ModBlocks {
|
||||
public static Block wand_air;
|
||||
public static Block wand_loot;
|
||||
public static Block wand_jigsaw;
|
||||
public static Block wand_logic;
|
||||
public static Block wand_tandem;
|
||||
|
||||
public static Block logic_block;
|
||||
|
||||
public static Material materialGas = new MaterialGas();
|
||||
|
||||
@ -1479,9 +1492,10 @@ public class ModBlocks {
|
||||
gravel_diamond = new BlockFalling(Material.sand).setBlockName("gravel_diamond").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeGravel).setHardness(0.6F).setBlockTextureName(RefStrings.MODID + ":gravel_diamond");
|
||||
asphalt = new BlockSpeedy(Material.rock, 1.5).setBlockName("asphalt").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(120.0F).setBlockTextureName(RefStrings.MODID + ":asphalt");
|
||||
asphalt_light = new BlockSpeedy(Material.rock, 1.5).setBlockName("asphalt_light").setCreativeTab(MainRegistry.blockTab).setLightLevel(1F).setHardness(15.0F).setResistance(120.0F).setBlockTextureName(RefStrings.MODID + ":asphalt_light");
|
||||
|
||||
|
||||
sandbags = new BlockSandbags(Material.ground).setBlockName("sandbags").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(30.0F).setBlockTextureName(RefStrings.MODID + ":sandbags");
|
||||
wood_barrier = new BlockBarrier(Material.wood).setStepSound(Block.soundTypeWood).setBlockName("wood_barrier").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(30.0F).setBlockTextureName(RefStrings.MODID + ":wood_barrier");
|
||||
wood_barrier = new BlockBarrier(Material.wood).setStepSound(Block.soundTypeWood).setBlockName("wood_barrier").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":wood_barrier");
|
||||
wood_structure = new BlockWoodStructure(Material.wood).setStepSound(Block.soundTypeWood).setBlockName("wood_structure").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":wood_barrier");
|
||||
|
||||
reinforced_brick = new BlockGeneric(Material.rock).setBlockName("reinforced_brick").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(300.0F).setBlockTextureName(RefStrings.MODID + ":reinforced_brick");
|
||||
reinforced_glass = new BlockNTMGlassCT(0, RefStrings.MODID + ":reinforced_glass", Material.rock).setBlockName("reinforced_glass").setCreativeTab(MainRegistry.blockTab).setLightOpacity(0).setHardness(2.0F).setResistance(25.0F);
|
||||
@ -1512,12 +1526,14 @@ public class ModBlocks {
|
||||
floodlight = new Floodlight(Material.iron).setBlockName("floodlight").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
floodlight_beam = new FloodlightBeam().setBlockName("floodlight_beam");
|
||||
|
||||
rebar = new BlockRebar().setBlockName("rebar").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(20.0F).setBlockTextureName(RefStrings.MODID + ":rebar");
|
||||
reinforced_stone = new BlockGeneric(Material.rock).setBlockName("reinforced_stone").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(100.0F).setBlockTextureName(RefStrings.MODID + ":reinforced_stone");
|
||||
concrete_smooth = new BlockRadResistant(Material.rock).setBlockName("concrete_smooth").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(140.0F).setBlockTextureName(RefStrings.MODID + ":concrete");
|
||||
concrete_colored = new BlockConcreteColored(Material.rock).setBlockName("concrete_colored").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(140.0F).setBlockTextureName(RefStrings.MODID + ":concrete");
|
||||
concrete_colored_ext = new BlockConcreteColoredExt(Material.rock).setBlockName("concrete_colored_ext").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(140.0F).setBlockTextureName(RefStrings.MODID + ":concrete_colored_ext");
|
||||
concrete = new BlockGeneric(Material.rock).setBlockName("concrete").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(140.0F).setBlockTextureName(RefStrings.MODID + ":concrete_tile");
|
||||
concrete_asbestos = new BlockGeneric(Material.rock).setBlockName("concrete_asbestos").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(150.0F).setBlockTextureName(RefStrings.MODID + ":concrete_asbestos");
|
||||
concrete_rebar = new BlockGeneric(Material.rock).setBlockName("concrete_rebar").setCreativeTab(MainRegistry.blockTab).setHardness(50.0F).setResistance(240.0F).setBlockTextureName(RefStrings.MODID + ":concrete_rebar");
|
||||
concrete_super = new BlockUberConcrete().setBlockName("concrete_super").setCreativeTab(MainRegistry.blockTab).setHardness(150.0F).setResistance(1000.0F);
|
||||
concrete_super_broken = new BlockFalling(Material.rock).setBlockName("concrete_super_broken").setCreativeTab(MainRegistry.blockTab).setHardness(10.0F).setResistance(20.0F).setBlockTextureName(RefStrings.MODID + ":concrete_super_broken");
|
||||
concrete_pillar = new BlockRotatablePillar(Material.rock, RefStrings.MODID + ":concrete_pillar_top").setBlockName("concrete_pillar").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(180.0F).setBlockTextureName(RefStrings.MODID + ":concrete_pillar_side");
|
||||
@ -1549,7 +1565,7 @@ public class ModBlocks {
|
||||
brick_double_slab = new BlockMultiSlab(brick_slab, Material.rock, reinforced_stone, reinforced_brick, brick_obsidian, brick_light, brick_compound, brick_asbestos, brick_fire).setBlockName("brick_double_slab").setCreativeTab(MainRegistry.blockTab);
|
||||
stones_slab = new BlockMultiSlabMeta(null, Material.rock, new Block[] { lightstone, lightstone }, LightstoneType.TILE.ordinal(), LightstoneType.BRICKS.ordinal()).setBlockName("stones_slab").setCreativeTab(MainRegistry.blockTab);
|
||||
stones_double_slab = new BlockMultiSlabMeta(stones_slab, Material.rock, new Block[] { lightstone, lightstone }, LightstoneType.TILE.ordinal(), LightstoneType.BRICKS.ordinal()).setBlockName("stones_double_slab").setCreativeTab(MainRegistry.blockTab);
|
||||
|
||||
|
||||
concrete_smooth_stairs = new BlockGenericStairs(concrete_smooth, 0).setBlockName("concrete_smooth_stairs").setCreativeTab(MainRegistry.blockTab);
|
||||
concrete_stairs = new BlockGenericStairs(concrete, 0).setBlockName("concrete_stairs").setCreativeTab(MainRegistry.blockTab);
|
||||
concrete_asbestos_stairs = new BlockGenericStairs(concrete_asbestos, 0).setBlockName("concrete_asbestos_stairs").setCreativeTab(MainRegistry.blockTab);
|
||||
@ -1604,7 +1620,7 @@ public class ModBlocks {
|
||||
|
||||
brick_red = new BlockRedBrick(Material.rock).setBlockName("brick_red").setResistance(10_000);
|
||||
|
||||
deco_computer = new BlockDecoModel(Material.iron, DecoComputerEnum.class, true, false).setBlockBoundsTo(.160749F, 0F, 0F, .839251F, .867849F, .622184F).setBlockName("deco_computer").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":deco_computer");
|
||||
deco_computer = new BlockDecoModel(Material.iron, DecoComputerEnum.class, true, false).setBlockBoundsTo(.125F, 0F, 0F, .875F, .875F, .625F).setBlockName("deco_computer").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":deco_computer");
|
||||
deco_crt = new BlockDecoCRT(Material.iron).setBlockName("deco_crt").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
deco_toaster = new BlockDecoToaster(Material.iron).setBlockName("deco_toaster").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
filing_cabinet = new BlockDecoContainer(Material.iron, DecoCabinetEnum.class, true, false, TileEntityFileCabinet.class).setBlockBoundsTo(.1875F, 0F, 0F, .8125F, 1F, .75F).setBlockName("filing_cabinet").setCreativeTab(MainRegistry.blockTab).setHardness(10.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
@ -1749,7 +1765,7 @@ public class ModBlocks {
|
||||
vitrified_barrel = new YellowBarrel(Material.iron).setBlockName("vitrified_barrel").setCreativeTab(MainRegistry.nukeTab).setHardness(0.5F).setResistance(2.5F).setBlockTextureName(RefStrings.MODID + ":barrel_vitrified");
|
||||
lox_barrel = new RedBarrel(Material.iron, false).setBlockName("lox_barrel").setCreativeTab(MainRegistry.nukeTab).setHardness(0.5F).setResistance(2.5F).setBlockTextureName(RefStrings.MODID + ":barrel_lox");
|
||||
taint_barrel = new RedBarrel(Material.iron, false).setBlockName("taint_barrel").setCreativeTab(MainRegistry.nukeTab).setHardness(0.5F).setResistance(2.5F).setBlockTextureName(RefStrings.MODID + ":barrel_taint");
|
||||
crashed_balefire = new BlockCrashedBomb(Material.iron).setBlockName("crashed_bomb").setCreativeTab(MainRegistry.nukeTab).setBlockUnbreakable().setResistance(6000.0F).setBlockTextureName(RefStrings.MODID + ":crashed_balefire");
|
||||
crashed_balefire = new BlockCrashedBomb(Material.iron).setBlockName("crashed_bomb").setCreativeTab(MainRegistry.nukeTab).setBlockUnbreakable().setResistance(6000.0F).setBlockTextureName(RefStrings.MODID + ":block_rust");
|
||||
fireworks = new BlockFireworks(Material.iron).setBlockName("fireworks").setCreativeTab(MainRegistry.nukeTab).setResistance(5.0F);
|
||||
charge_dynamite = new BlockChargeDynamite().setBlockName("charge_dynamite").setCreativeTab(MainRegistry.nukeTab).setResistance(1.0F);
|
||||
charge_miner = new BlockChargeMiner().setBlockName("charge_miner").setCreativeTab(MainRegistry.nukeTab).setResistance(1.0F);
|
||||
@ -1809,9 +1825,8 @@ public class ModBlocks {
|
||||
machine_rotary_furnace = new MachineRotaryFurnace(Material.iron).setBlockName("machine_rotary_furnace").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":brick_fire");
|
||||
machine_crystallizer = new MachineCrystallizer(Material.iron).setBlockName("machine_crystallizer").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_crystallizer");
|
||||
|
||||
machine_uf6_tank = new MachineUF6Tank(Material.iron).setBlockName("machine_uf6_tank").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
|
||||
machine_puf6_tank = new MachinePuF6Tank(Material.iron).setBlockName("machine_puf6_tank").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
machine_uf6_tank = new MachineUF6Tank(Material.iron).setBlockName("machine_uf6_tank").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null);
|
||||
machine_puf6_tank = new MachinePuF6Tank(Material.iron).setBlockName("machine_puf6_tank").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null);
|
||||
|
||||
machine_reactor_breeding = new MachineReactorBreeding(Material.iron).setBlockName("machine_reactor").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_reactor");
|
||||
|
||||
@ -1851,7 +1866,6 @@ public class ModBlocks {
|
||||
hadron_analysis_glass = new BlockNTMGlass(0, RefStrings.MODID + ":hadron_analysis_glass", Material.iron, true).setStepSound(Block.soundTypeMetal).setBlockName("hadron_analysis_glass").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_analysis_glass");
|
||||
hadron_access = new BlockHadronAccess(Material.iron).setStepSound(Block.soundTypeMetal).setBlockName("hadron_access").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_access");
|
||||
hadron_core = new BlockHadronCore(Material.iron).setStepSound(Block.soundTypeMetal).setBlockName("hadron_core").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_core");
|
||||
hadron_cooler = new BlockHadronCooler(Material.iron).setBlockName("hadron_cooler").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F);
|
||||
|
||||
pa_source = new BlockPASource().setStepSound(Block.soundTypeMetal).setBlockName("pa_source").setHardness(5.0F).setResistance(10.0F);
|
||||
pa_beamline = new BlockPABeamline().setStepSound(Block.soundTypeMetal).setBlockName("pa_beamline").setHardness(5.0F).setResistance(10.0F);
|
||||
@ -1862,8 +1876,6 @@ public class ModBlocks {
|
||||
|
||||
machine_electric_furnace_off = new MachineElectricFurnace(false).setBlockName("machine_electric_furnace_off").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
machine_electric_furnace_on = new MachineElectricFurnace(true).setBlockName("machine_electric_furnace_on").setHardness(5.0F).setLightLevel(1.0F).setResistance(10.0F);
|
||||
machine_arc_furnace_off = new MachineArcFurnace(false).setBlockName("machine_arc_furnace_off").setHardness(5.0F).setResistance(10.0F);
|
||||
machine_arc_furnace_on = new MachineArcFurnace(true).setBlockName("machine_arc_furnace_on").setHardness(5.0F).setLightLevel(1.0F).setResistance(10.0F);
|
||||
machine_arc_furnace = new MachineArcFurnaceLarge().setBlockName("machine_arc_furnace").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
machine_microwave = new MachineMicrowave(Material.iron).setBlockName("machine_microwave").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_microwave");
|
||||
|
||||
@ -1919,10 +1931,12 @@ public class ModBlocks {
|
||||
fluid_duct_neo = new FluidDuctStandard(Material.iron).setBlockName("fluid_duct_neo").setStepSound(ModSoundTypes.pipe).setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pipe_neo");
|
||||
fluid_duct_box = new FluidDuctBox(Material.iron).setBlockName("fluid_duct_box").setStepSound(ModSoundTypes.pipe).setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":fluid_duct_box");
|
||||
fluid_duct_exhaust = new FluidDuctBoxExhaust(Material.iron).setBlockName("fluid_duct_exhaust").setStepSound(ModSoundTypes.pipe).setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":fluid_duct_box");
|
||||
fluid_duct_paintable_block_exhaust = new FluidDuctPaintableBlockExhaust().setBlockName("fluid_duct_paintable_block_exhaust").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
fluid_duct_paintable = new FluidDuctPaintable().setBlockName("fluid_duct_paintable").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
fluid_duct_gauge = new FluidDuctGauge().setBlockName("fluid_duct_gauge").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
fluid_valve = new FluidValve(Material.iron).setBlockName("fluid_valve").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
fluid_switch = new FluidSwitch(Material.iron).setBlockName("fluid_switch").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
fluid_pump = new FluidPump(Material.iron).setBlockName("fluid_pump").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
machine_drain = new MachineDrain(Material.iron).setBlockName("machine_drain").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":concrete");
|
||||
radio_torch_sender = new RadioTorchSender().setBlockName("radio_torch_sender").setHardness(0.1F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
radio_torch_receiver = new RadioTorchReceiver().setBlockName("radio_torch_receiver").setHardness(0.1F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
@ -1955,8 +1969,9 @@ public class ModBlocks {
|
||||
drone_dock = new DroneDock().setBlockName("drone_dock").setHardness(0.1F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":drone_dock");
|
||||
drone_crate_provider = new DroneDock().setBlockName("drone_crate_provider").setHardness(0.1F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":drone_crate_provider");
|
||||
drone_crate_requester = new DroneDock().setBlockName("drone_crate_requester").setHardness(0.1F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":drone_crate_requester");
|
||||
|
||||
|
||||
pneumatic_tube = new PneumoTube().setBlockName("pneumatic_tube").setStepSound(ModSoundTypes.pipe).setHardness(0.1F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pneumatic_tube");
|
||||
pneumatic_tube_paintable = new PneumoTubePaintableBlock().setBlockName("pneumatic_tube_paintable").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
|
||||
chain = new BlockChain(Material.iron).setBlockName("dungeon_chain").setHardness(0.25F).setResistance(2.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":chain");
|
||||
|
||||
@ -1971,6 +1986,8 @@ public class ModBlocks {
|
||||
ladder_steel = new BlockNTMLadder().setBlockName("ladder_steel").setHardness(0.25F).setResistance(2.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":ladder_steel");
|
||||
ladder_tungsten = new BlockNTMLadder().setBlockName("ladder_tungsten").setHardness(0.25F).setResistance(2.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":ladder_tungsten");
|
||||
|
||||
trapdoor_steel = new BlockNTMTrapdoor(Material.iron).setBlockName("trapdoor_steel").setHardness(3F).setResistance(8.0F).setStepSound(Block.soundTypeMetal).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":trapdoor_steel");
|
||||
|
||||
barrel_plastic = new BlockFluidBarrel(Material.iron, 12000).setBlockName("barrel_plastic").setStepSound(Block.soundTypeStone).setHardness(2.0F).setResistance(5.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":barrel_plastic");
|
||||
barrel_corroded = new BlockFluidBarrel(Material.iron, 6000).setBlockName("barrel_corroded").setStepSound(Block.soundTypeMetal).setHardness(2.0F).setResistance(5.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":barrel_corroded");
|
||||
barrel_iron = new BlockFluidBarrel(Material.iron, 8000).setBlockName("barrel_iron").setStepSound(Block.soundTypeMetal).setHardness(2.0F).setResistance(5.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":barrel_iron");
|
||||
@ -1980,8 +1997,6 @@ public class ModBlocks {
|
||||
|
||||
machine_transformer = new MachineTransformer(Material.iron, 10000L, 1).setBlockName("machine_transformer").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_transformer_iron");
|
||||
machine_transformer_dnt = new MachineTransformer(Material.iron, 1000000000000000L, 1).setBlockName("machine_transformer_dnt").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_transformer");
|
||||
machine_transformer_20 = new MachineTransformer(Material.iron, 10000L, 20).setBlockName("machine_transformer_20").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_transformer_iron");
|
||||
machine_transformer_dnt_20 = new MachineTransformer(Material.iron, 1000000000000000L, 20).setBlockName("machine_transformer_dnt_20").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_transformer");
|
||||
|
||||
machine_satlinker = new MachineSatLinker(Material.iron).setBlockName("machine_satlinker").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.missileTab).setBlockTextureName(RefStrings.MODID + ":machine_satlinker_side");
|
||||
machine_keyforge = new MachineKeyForge(Material.iron).setBlockName("machine_keyforge").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.consumableTab).setBlockTextureName(RefStrings.MODID + ":machine_keyforge_side");
|
||||
@ -2155,6 +2170,7 @@ public class ModBlocks {
|
||||
rbmk_heater = new RBMKHeater().setBlockName("rbmk_heater").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_heater");
|
||||
rbmk_console = new RBMKConsole().setBlockName("rbmk_console").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_console");
|
||||
rbmk_crane_console = new RBMKCraneConsole().setBlockName("rbmk_crane_console").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_crane_console");
|
||||
rbmk_autoloader = new RBMKAutoloader().setBlockName("rbmk_autoloader").setCreativeTab(MainRegistry.machineTab).setHardness(50.0F).setResistance(60.0F).setBlockTextureName(RefStrings.MODID + ":rbmk_autoloader");
|
||||
rbmk_loader = new RBMKLoader(Material.iron).setBlockName("rbmk_loader").setCreativeTab(MainRegistry.machineTab).setHardness(50.0F).setResistance(60.0F).setBlockTextureName(RefStrings.MODID + ":rbmk_loader");
|
||||
rbmk_steam_inlet = new RBMKInlet(Material.iron).setBlockName("rbmk_steam_inlet").setCreativeTab(MainRegistry.machineTab).setHardness(50.0F).setResistance(60.0F).setBlockTextureName(RefStrings.MODID + ":rbmk_steam_inlet");
|
||||
rbmk_steam_outlet = new RBMKOutlet(Material.iron).setBlockName("rbmk_steam_outlet").setCreativeTab(MainRegistry.machineTab).setHardness(50.0F).setResistance(60.0F).setBlockTextureName(RefStrings.MODID + ":rbmk_steam_outlet");
|
||||
@ -2171,15 +2187,15 @@ public class ModBlocks {
|
||||
rail_booster = new RailBooster().setBlockName("rail_booster").setHardness(5.0F).setResistance(10.0F).setCreativeTab(CreativeTabs.tabTransport).setBlockTextureName(RefStrings.MODID + ":rail_booster");
|
||||
rail_narrow_straight = new RailNarrowStraight().setBlockName("rail_narrow_straight").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":rail_narrow_neo");
|
||||
rail_narrow_curve = new RailNarrowCurve().setBlockName("rail_narrow_curve").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":rail_narrow_neo");
|
||||
rail_large_straight = new RailStandardStraight().setBlockName("rail_large_straight").setHardness(5.0F).setResistance(10.0F).setCreativeTab(CreativeTabs.tabTransport).setBlockTextureName(RefStrings.MODID + ":rail_standard_straight");
|
||||
rail_large_straight_short = new RailStandardStraightShort().setBlockName("rail_large_straight_short").setHardness(5.0F).setResistance(10.0F).setCreativeTab(CreativeTabs.tabTransport).setBlockTextureName(RefStrings.MODID + ":rail_standard_straight");
|
||||
rail_large_curve = new RailStandardCurveBase().setBlockName("rail_large_curve").setHardness(5.0F).setResistance(10.0F).setCreativeTab(CreativeTabs.tabTransport).setBlockTextureName(RefStrings.MODID + ":rail_standard_straight");
|
||||
rail_large_curve_7 = new RailStandardCurveWide7().setBlockName("rail_large_curve_7").setHardness(5.0F).setResistance(10.0F).setCreativeTab(CreativeTabs.tabTransport).setBlockTextureName(RefStrings.MODID + ":rail_standard_straight");
|
||||
rail_large_curve_9 = new RailStandardCurveWide9().setBlockName("rail_large_curve_9").setHardness(5.0F).setResistance(10.0F).setCreativeTab(CreativeTabs.tabTransport).setBlockTextureName(RefStrings.MODID + ":rail_standard_straight");
|
||||
rail_large_ramp = new RailStandardRamp().setBlockName("rail_large_ramp").setHardness(5.0F).setResistance(10.0F).setCreativeTab(CreativeTabs.tabTransport).setBlockTextureName(RefStrings.MODID + ":rail_standard_straight");
|
||||
rail_large_buffer = new RailStandardBuffer().setBlockName("rail_large_buffer").setHardness(5.0F).setResistance(10.0F).setCreativeTab(CreativeTabs.tabTransport).setBlockTextureName(RefStrings.MODID + ":rail_standard_buffer");
|
||||
rail_large_switch = new RailStandardSwitch().setBlockName("rail_large_switch").setHardness(5.0F).setResistance(10.0F).setCreativeTab(CreativeTabs.tabTransport).setBlockTextureName(RefStrings.MODID + ":rail_standard_straight");
|
||||
rail_large_switch_flipped = new RailStandardSwitchFlipped().setBlockName("rail_large_switch_flipped").setHardness(5.0F).setResistance(10.0F).setCreativeTab(CreativeTabs.tabTransport).setBlockTextureName(RefStrings.MODID + ":rail_standard_straight");
|
||||
rail_large_straight = new RailStandardStraight().setBlockName("rail_large_straight").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":rail_standard_straight");
|
||||
rail_large_straight_short = new RailStandardStraightShort().setBlockName("rail_large_straight_short").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":rail_standard_straight");
|
||||
rail_large_curve = new RailStandardCurveBase().setBlockName("rail_large_curve").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":rail_standard_straight");
|
||||
rail_large_curve_7 = new RailStandardCurveWide7().setBlockName("rail_large_curve_7").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":rail_standard_straight");
|
||||
rail_large_curve_9 = new RailStandardCurveWide9().setBlockName("rail_large_curve_9").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":rail_standard_straight");
|
||||
rail_large_ramp = new RailStandardRamp().setBlockName("rail_large_ramp").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":rail_standard_straight");
|
||||
rail_large_buffer = new RailStandardBuffer().setBlockName("rail_large_buffer").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":rail_standard_buffer");
|
||||
rail_large_switch = new RailStandardSwitch().setBlockName("rail_large_switch").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":rail_standard_straight");
|
||||
rail_large_switch_flipped = new RailStandardSwitchFlipped().setBlockName("rail_large_switch_flipped").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":rail_standard_straight");
|
||||
|
||||
crate = new BlockCrate(Material.wood).setBlockName("crate").setStepSound(Block.soundTypeWood).setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.consumableTab).setBlockTextureName(RefStrings.MODID + ":crate");
|
||||
crate_weapon = new BlockCrate(Material.wood).setBlockName("crate_weapon").setStepSound(Block.soundTypeWood).setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.consumableTab).setBlockTextureName(RefStrings.MODID + ":crate_weapon");
|
||||
@ -2221,12 +2237,16 @@ public class ModBlocks {
|
||||
machine_ore_slopper = new MachineOreSlopper().setBlockName("machine_ore_slopper").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
machine_mining_laser = new MachineMiningLaser(Material.iron).setBlockName("machine_mining_laser").setHardness(5.0F).setResistance(100.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_mining_laser");
|
||||
barricade = new BlockNoDrop(Material.sand).setBlockName("barricade").setHardness(1.0F).setResistance(2.5F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":barricade");
|
||||
machine_assembler = new MachineAssembler(Material.iron).setBlockName("machine_assembler").setHardness(5.0F).setResistance(30.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_assembler");
|
||||
machine_assemfac = new MachineAssemfac(Material.iron).setBlockName("machine_assemfac").setHardness(5.0F).setResistance(30.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
machine_assembler = new MachineAssembler(Material.iron).setBlockName("machine_assembler").setHardness(5.0F).setResistance(30.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":machine_assembler");
|
||||
machine_assembly_machine = new MachineAssemblyMachine(Material.iron).setBlockName("machine_assembly_machine").setHardness(5.0F).setResistance(30.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
machine_assemfac = new MachineAssemfac(Material.iron).setBlockName("machine_assemfac").setHardness(5.0F).setResistance(30.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
machine_arc_welder = new MachineArcWelder(Material.iron).setBlockName("machine_arc_welder").setHardness(5.0F).setResistance(30.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
machine_soldering_station = new MachineSolderingStation(Material.iron).setBlockName("machine_soldering_station").setHardness(5.0F).setResistance(30.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
machine_chemplant = new MachineChemplant(Material.iron).setBlockName("machine_chemplant").setHardness(5.0F).setResistance(30.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
machine_chemfac = new MachineChemfac(Material.iron).setBlockName("machine_chemfac").setHardness(5.0F).setResistance(30.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
machine_chemplant = new MachineChemplant(Material.iron).setBlockName("machine_chemplant").setHardness(5.0F).setResistance(30.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
machine_chemical_plant = new MachineChemicalPlant(Material.iron).setBlockName("machine_chemical_plant").setHardness(5.0F).setResistance(30.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
machine_chemfac = new MachineChemfac(Material.iron).setBlockName("machine_chemfac").setHardness(5.0F).setResistance(30.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
machine_chemical_factory = new MachineChemicalFactory(Material.iron).setBlockName("machine_chemical_factory").setHardness(5.0F).setResistance(30.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
machine_purex = new MachinePUREX(Material.iron).setBlockName("machine_purex").setHardness(5.0F).setResistance(30.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
machine_mixer = new MachineMixer(Material.iron).setBlockName("machine_mixer").setHardness(5.0F).setResistance(30.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
machine_fluidtank = new MachineFluidTank(Material.iron).setBlockName("machine_fluidtank").setHardness(5.0F).setResistance(20.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_fluidtank");
|
||||
machine_bat9000 = new MachineBigAssTank9000(Material.iron).setBlockName("machine_bat9000").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
@ -2327,6 +2347,10 @@ public class ModBlocks {
|
||||
absorber_pink = new BlockAbsorber(Material.iron, 10000F).setBlockName("absorber_pink").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":absorber_pink");
|
||||
decon = new BlockDecon(Material.iron).setBlockName("decon").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":decon_side");
|
||||
|
||||
if (Loader.isModLoaded("OpenComputers")) {
|
||||
oc_cable_paintable = new BlockOpenComputersCablePaintable().setBlockName("oc_cable_paintable").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
}
|
||||
|
||||
volcano_core = new BlockVolcano().setBlockName("volcano_core").setBlockUnbreakable().setResistance(10000.0F).setCreativeTab(MainRegistry.nukeTab).setBlockTextureName(RefStrings.MODID + ":volcano_core");
|
||||
volcano_rad_core = new BlockVolcano().setBlockName("volcano_rad_core").setBlockUnbreakable().setResistance(10000.0F).setCreativeTab(MainRegistry.nukeTab).setBlockTextureName(RefStrings.MODID + ":volcano_rad_core");
|
||||
|
||||
@ -2386,6 +2410,11 @@ public class ModBlocks {
|
||||
wand_air = new BlockWand(Blocks.air).setBlockName("wand_air").setBlockTextureName(RefStrings.MODID + ":wand_air");
|
||||
wand_loot = new BlockWandLoot().setBlockName("wand_loot").setBlockTextureName(RefStrings.MODID + ":wand_loot");
|
||||
wand_jigsaw = new BlockWandJigsaw().setBlockName("wand_jigsaw").setBlockTextureName(RefStrings.MODID + ":wand_jigsaw");
|
||||
wand_logic = new BlockWandLogic().setBlockName("wand_logic").setBlockTextureName(RefStrings.MODID + ":wand_logic");
|
||||
wand_tandem = new BlockWandTandem().setBlockName("wand_tandem").setBlockTextureName(RefStrings.MODID + ":wand_tandem");
|
||||
|
||||
logic_block = new LogicBlock().setBlockName("logic_block").setBlockTextureName(RefStrings.MODID + ":logic_block");
|
||||
|
||||
}
|
||||
|
||||
private static void registerBlock() {
|
||||
@ -2662,6 +2691,7 @@ public class ModBlocks {
|
||||
//Reinforced Blocks
|
||||
register(sandbags);
|
||||
register(wood_barrier);
|
||||
register(wood_structure);
|
||||
GameRegistry.registerBlock(asphalt, ItemBlockBlastInfo.class, asphalt.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(asphalt_light, ItemBlockBlastInfo.class, asphalt_light.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(reinforced_brick, ItemBlockBlastInfo.class, reinforced_brick.getUnlocalizedName());
|
||||
@ -2675,6 +2705,7 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(reinforced_laminate_pane,ItemBlockBlastInfo.class, reinforced_laminate_pane.getUnlocalizedName());
|
||||
|
||||
//Bricks
|
||||
register(rebar);
|
||||
GameRegistry.registerBlock(reinforced_stone, ItemBlockBlastInfo.class, reinforced_stone.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(reinforced_ducrete, ItemBlockBlastInfo.class, reinforced_ducrete.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(concrete_smooth, ItemBlockBlastInfo.class, concrete_smooth.getUnlocalizedName());
|
||||
@ -2682,6 +2713,7 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(concrete_colored_ext, ItemBlockBlastInfo.class, concrete_colored_ext.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(concrete, ItemBlockBlastInfo.class, concrete.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(concrete_asbestos, ItemBlockBlastInfo.class, concrete_asbestos.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(concrete_rebar, ItemBlockBlastInfo.class, concrete_rebar.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(concrete_super, ItemBlockBlastInfo.class, concrete_super.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(concrete_super_broken, ItemBlockBlastInfo.class, concrete_super_broken.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(ducrete_smooth, ItemBlockBlastInfo.class, ducrete_smooth.getUnlocalizedName());
|
||||
@ -2698,14 +2730,14 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(brick_light, ItemBlockBlastInfo.class, brick_light.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(brick_asbestos, brick_asbestos.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(brick_fire, ItemBlockBlastInfo.class, brick_fire.getUnlocalizedName());
|
||||
|
||||
|
||||
//Lightstone and its stair/slab variants
|
||||
register(lightstone);
|
||||
register(lightstone_tile_stairs);
|
||||
register(lightstone_bricks_stairs);
|
||||
register(stones_slab, ItemModSlab.class);
|
||||
register(stones_double_slab, ItemModSlab.class);
|
||||
|
||||
|
||||
GameRegistry.registerBlock(concrete_slab, ItemModSlab.class, concrete_slab.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(concrete_double_slab, ItemModSlab.class, concrete_double_slab.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(concrete_brick_slab, ItemModSlab.class, concrete_brick_slab.getUnlocalizedName());
|
||||
@ -2892,7 +2924,7 @@ public class ModBlocks {
|
||||
|
||||
//Generic Bombs
|
||||
GameRegistry.registerBlock(bomb_multi, bomb_multi.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(crashed_balefire, crashed_balefire.getUnlocalizedName());
|
||||
register(crashed_balefire);
|
||||
GameRegistry.registerBlock(fireworks, fireworks.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(dynamite, dynamite.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(tnt, tnt.getUnlocalizedName());
|
||||
@ -3130,7 +3162,6 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(hadron_analysis_glass, hadron_analysis_glass.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(hadron_access, hadron_access.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(hadron_core, hadron_core.getUnlocalizedName());
|
||||
register(hadron_cooler);
|
||||
|
||||
register(pa_source);
|
||||
register(pa_beamline);
|
||||
@ -3157,6 +3188,7 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(rbmk_heater, rbmk_heater.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(rbmk_console, rbmk_console.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(rbmk_crane_console, rbmk_crane_console.getUnlocalizedName());
|
||||
register(rbmk_autoloader);
|
||||
register(rbmk_loader);
|
||||
register(rbmk_steam_inlet);
|
||||
register(rbmk_steam_outlet);
|
||||
@ -3185,10 +3217,12 @@ public class ModBlocks {
|
||||
register(fluid_duct_neo);
|
||||
register(fluid_duct_box);
|
||||
register(fluid_duct_exhaust);
|
||||
register(fluid_duct_paintable_block_exhaust);
|
||||
register(fluid_duct_paintable);
|
||||
register(fluid_duct_gauge);
|
||||
register(fluid_valve);
|
||||
register(fluid_switch);
|
||||
register(fluid_pump);
|
||||
register(machine_drain);
|
||||
register(radio_torch_sender);
|
||||
register(radio_torch_receiver);
|
||||
@ -3219,6 +3253,7 @@ public class ModBlocks {
|
||||
register(drone_crate_provider);
|
||||
register(drone_crate_requester);
|
||||
register(pneumatic_tube);
|
||||
register(pneumatic_tube_paintable);
|
||||
register(fan);
|
||||
register(piston_inserter);
|
||||
|
||||
@ -3233,6 +3268,7 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(ladder_steel, ladder_steel.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(ladder_lead, ladder_lead.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(ladder_cobalt, ladder_cobalt.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(trapdoor_steel, trapdoor_steel.getUnlocalizedName());
|
||||
|
||||
register(barrel_plastic);
|
||||
register(barrel_corroded);
|
||||
@ -3253,20 +3289,20 @@ public class ModBlocks {
|
||||
register(capacitor_tantalium);
|
||||
register(capacitor_schrabidate);
|
||||
GameRegistry.registerBlock(machine_transformer, machine_transformer.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_transformer_20, machine_transformer_20.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_transformer_dnt, machine_transformer_dnt.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_transformer_dnt_20, machine_transformer_dnt_20.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_converter_he_rf, machine_converter_he_rf.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_converter_rf_he, machine_converter_rf_he.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_electric_furnace_off, machine_electric_furnace_off.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_electric_furnace_on, machine_electric_furnace_on.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_arc_furnace_off, machine_arc_furnace_off.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_arc_furnace_on, machine_arc_furnace_on.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_microwave, machine_microwave.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_assembler, machine_assembler.getUnlocalizedName());
|
||||
register(machine_assembly_machine);
|
||||
GameRegistry.registerBlock(machine_assemfac, machine_assemfac.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_chemplant, machine_chemplant.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_chemfac, machine_chemfac.getUnlocalizedName());
|
||||
register(machine_chemical_plant);
|
||||
register(machine_chemfac);
|
||||
register(machine_chemical_factory);
|
||||
register(machine_purex);
|
||||
register(machine_arc_welder);
|
||||
register(machine_soldering_station);
|
||||
register(machine_arc_furnace);
|
||||
@ -3511,6 +3547,11 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(gas_explosive, gas_explosive.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(vacuum, vacuum.getUnlocalizedName());
|
||||
|
||||
// OC Compat Items
|
||||
if (Loader.isModLoaded("OpenComputers")) {
|
||||
register(oc_cable_paintable);
|
||||
}
|
||||
|
||||
//???
|
||||
GameRegistry.registerBlock(crystal_virus, crystal_virus.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(crystal_hardened, crystal_hardened.getUnlocalizedName());
|
||||
@ -3528,6 +3569,10 @@ public class ModBlocks {
|
||||
register(wand_air);
|
||||
register(wand_loot);
|
||||
register(wand_jigsaw);
|
||||
register(wand_logic);
|
||||
register(wand_tandem);
|
||||
|
||||
register(logic_block);
|
||||
}
|
||||
|
||||
private static void register(Block b) {
|
||||
|
||||
@ -1,15 +1,25 @@
|
||||
package com.hbm.blocks.bomb;
|
||||
|
||||
import com.hbm.blocks.BlockEnumMulti;
|
||||
import com.hbm.config.BombConfig;
|
||||
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.interfaces.IBomb;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.particle.helper.ExplosionCreator;
|
||||
import com.hbm.tileentity.bomb.TileEntityCrashedBomb;
|
||||
import com.hbm.util.EnumUtil;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@ -18,10 +28,14 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockCrashedBomb extends BlockContainer implements IBomb {
|
||||
public class BlockCrashedBomb extends BlockEnumMulti implements ITileEntityProvider, IBomb {
|
||||
|
||||
public static enum EnumDudType {
|
||||
BALEFIRE, CONVENTIONAL, NUKE, SALTED
|
||||
}
|
||||
|
||||
public BlockCrashedBomb(Material mat) {
|
||||
super(mat);
|
||||
super(mat, EnumDudType.class, false, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -37,11 +51,27 @@ public class BlockCrashedBomb extends BlockContainer implements IBomb {
|
||||
if(world.isRemote) return true;
|
||||
|
||||
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.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;
|
||||
}
|
||||
|
||||
@ -53,21 +83,46 @@ public class BlockCrashedBomb extends BlockContainer implements IBomb {
|
||||
|
||||
if(!world.isRemote) {
|
||||
|
||||
EnumDudType type = EnumUtil.grabEnumSafely(EnumDudType.class, world.getBlockMetadata(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);
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "muke");
|
||||
data.setBoolean("balefire", true);
|
||||
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.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, "hbm:weapon.mukeExplosion", 15.0F, 1.0F);
|
||||
if(type == type.BALEFIRE) {
|
||||
EntityBalefire bf = new EntityBalefire(world);
|
||||
bf.setPosition(x, y, z);
|
||||
bf.destructionRange = (int) (BombConfig.fatmanRadius * 1.25);
|
||||
world.spawnEntityInWorld(bf);
|
||||
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;
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
@ -151,7 +151,7 @@ public class BlockVolcano extends BlockContainer implements ITooltipProvider, IB
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setInteger("tier", this.volcanoTimer);
|
||||
nbt.setInteger("timer", this.volcanoTimer);
|
||||
}
|
||||
|
||||
private boolean shouldGrow() {
|
||||
|
||||
@ -1,7 +1,13 @@
|
||||
package com.hbm.blocks.bomb;
|
||||
|
||||
import com.hbm.explosion.ExplosionChaos;
|
||||
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.EntityProcessorCrossSmooth;
|
||||
import com.hbm.explosion.vanillant.standard.ExplosionEffectTiny;
|
||||
import com.hbm.explosion.vanillant.standard.PlayerProcessorStandard;
|
||||
import com.hbm.interfaces.IBomb;
|
||||
import com.hbm.particle.helper.ExplosionCreator;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
@ -17,9 +23,7 @@ public class BombFlameWar extends Block implements IBomb {
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
||||
|
||||
if(world.isBlockIndirectlyGettingPowered(x, y, z)) {
|
||||
ExplosionChaos.explode(world, x, y, z, 15);
|
||||
ExplosionChaos.spawnExplosion(world, x, y, z, 75);
|
||||
ExplosionChaos.flameDeath(world, x, y, z, 100);
|
||||
explode(world, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,9 +31,24 @@ public class BombFlameWar extends Block implements IBomb {
|
||||
public BombReturnCode explode(World world, int x, int y, int z) {
|
||||
|
||||
if(!world.isRemote) {
|
||||
ExplosionChaos.explode(world, x, y, z, 15);
|
||||
ExplosionChaos.spawnExplosion(world, x, y, z, 75);
|
||||
ExplosionChaos.flameDeath(world, x, y, z, 100);
|
||||
|
||||
world.func_147480_a(x, y, z, false);
|
||||
|
||||
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;
|
||||
|
||||
@ -18,10 +18,12 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.entity.effect.EntityMist;
|
||||
import com.hbm.explosion.ExplosionChaos;
|
||||
import com.hbm.explosion.ExplosionLarge;
|
||||
import com.hbm.explosion.ExplosionNukeGeneric;
|
||||
import com.hbm.interfaces.IBomb;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.bomb.TileEntityBombMulti;
|
||||
|
||||
@ -169,7 +171,11 @@ public class BombMulti extends BlockContainer implements IBomb {
|
||||
}
|
||||
|
||||
if(gasCloud > 0) {
|
||||
ExplosionChaos.spawnChlorine(world, x, y, z, gasCloud, gasCloud / 50, 0);
|
||||
EntityMist mist = new EntityMist(world);
|
||||
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;
|
||||
|
||||
@ -69,7 +69,7 @@ public class ExplosiveCharge extends BlockDetonatable implements IBomb, IDetConn
|
||||
}
|
||||
if(this == ModBlocks.det_nuke) {
|
||||
world.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(world, BombConfig.missileRadius, x + 0.5, y + 0.5, z + 0.5));
|
||||
EntityNukeTorex.statFac(world, x + 0.5, y + 0.5, z + 0.5, BombConfig.missileRadius);
|
||||
EntityNukeTorex.statFacStandard(world, x + 0.5, y + 0.5, z + 0.5, BombConfig.missileRadius);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -179,7 +179,7 @@ public class NukeCustom extends BlockContainer implements IBomb {
|
||||
dirty *= 0.25F;
|
||||
|
||||
worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(worldObj, (int)hydro, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5).moreFallout((int)dirty));
|
||||
EntityNukeTorex.statFac(worldObj, xCoord + 0.5, yCoord + 5, zCoord + 0.5, hydro);
|
||||
EntityNukeTorex.statFacStandard(worldObj, xCoord + 0.5, yCoord + 5, zCoord + 0.5, hydro);
|
||||
|
||||
/// NUCLEAR ///
|
||||
} else if(nuke > 0) {
|
||||
@ -188,7 +188,7 @@ public class NukeCustom extends BlockContainer implements IBomb {
|
||||
nuke = Math.min(nuke, maxNuke);
|
||||
|
||||
worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(worldObj, (int)nuke, xCoord + 0.5, yCoord + 5, zCoord + 0.5).moreFallout((int)dirty));
|
||||
EntityNukeTorex.statFac(worldObj, xCoord + 0.5, yCoord + 5, zCoord + 0.5, nuke);
|
||||
EntityNukeTorex.statFacStandard(worldObj, xCoord + 0.5, yCoord + 5, zCoord + 0.5, nuke);
|
||||
|
||||
/// NON-NUCLEAR ///
|
||||
} else if(tnt >= 75) {
|
||||
@ -196,7 +196,7 @@ public class NukeCustom extends BlockContainer implements IBomb {
|
||||
tnt = Math.min(tnt, maxTnt);
|
||||
|
||||
worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFacNoRad(worldObj, (int)tnt, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5));
|
||||
EntityNukeTorex.statFac(worldObj, xCoord + 0.5, yCoord + 5, zCoord + 0.5, tnt);
|
||||
EntityNukeTorex.statFacStandard(worldObj, xCoord + 0.5, yCoord + 5, zCoord + 0.5, tnt);
|
||||
} else if(tnt > 0) {
|
||||
|
||||
ExplosionLarge.explode(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, tnt, true, true, true);
|
||||
|
||||
@ -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.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(world, BombConfig.gadgetRadius, x + 0.5, y + 0.5, z + 0.5));
|
||||
EntityNukeTorex.statFac(world, x + 0.5, y + 0.5, z + 0.5, BombConfig.gadgetRadius);
|
||||
EntityNukeTorex.statFacStandard(world, x + 0.5, y + 0.5, z + 0.5, BombConfig.gadgetRadius);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@ -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.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(world, BombConfig.manRadius, x + 0.5, y + 0.5, z + 0.5));
|
||||
EntityNukeTorex.statFac(world, x + 0.5, y + 0.5, z + 0.5, BombConfig.manRadius);
|
||||
EntityNukeTorex.statFacStandard(world, x + 0.5, y + 0.5, z + 0.5, BombConfig.manRadius);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@ -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.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(world, BombConfig.mikeRadius, x + 0.5, y + 0.5, z + 0.5));
|
||||
EntityNukeTorex.statFac(world, x + 0.5, y + 0.5, z + 0.5, BombConfig.mikeRadius);
|
||||
EntityNukeTorex.statFacStandard(world, x + 0.5, y + 0.5, z + 0.5, BombConfig.mikeRadius);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@ -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.spawnEntityInWorld(EntityNukeExplosionMK5.statFacNoRad(world, r, x + 0.5, y + 0.5, z + 0.5));
|
||||
EntityNukeTorex.statFac(world, x + 0.5, y + 0.5, z + 0.5, r);
|
||||
EntityNukeTorex.statFacStandard(world, x + 0.5, y + 0.5, z + 0.5, r);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@ -129,7 +129,7 @@ public class NukeTsar extends BlockContainer implements IBomb {
|
||||
tetn.clearSlots();
|
||||
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));
|
||||
EntityNukeTorex.statFac(world, x + 0.5, y + 0.5, z + 0.5, r);
|
||||
EntityNukeTorex.statFacStandard(world, x + 0.5, y + 0.5, z + 0.5, r);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@ -121,11 +121,13 @@ public class BlockBarrier extends Block implements ISBRHUniversal {
|
||||
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);
|
||||
@ -147,6 +149,12 @@ public class BlockBarrier extends Block implements ISBRHUniversal {
|
||||
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;
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@ import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.render.block.RenderBlockMultipass;
|
||||
import com.hbm.util.EnumUtil;
|
||||
import com.hbm.util.I18nUtil;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import api.hbm.fluidmk2.IFillableItem;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
@ -4,8 +4,8 @@ import com.hbm.inventory.gui.GUIScreenBobble;
|
||||
import com.hbm.items.special.ItemPlasticScrap.ScrapType;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.world.gen.INBTTileEntityTransformable;
|
||||
import com.hbm.world.gen.INBTTransformable;
|
||||
import com.hbm.world.gen.nbt.INBTTileEntityTransformable;
|
||||
import com.hbm.world.gen.nbt.INBTBlockTransformable;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@ -34,7 +34,7 @@ import net.minecraft.world.World;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockBobble extends BlockContainer implements IGUIProvider, INBTTransformable {
|
||||
public class BlockBobble extends BlockContainer implements IGUIProvider, INBTBlockTransformable {
|
||||
|
||||
public BlockBobble() {
|
||||
super(Material.iron);
|
||||
@ -198,7 +198,7 @@ public class BlockBobble extends BlockContainer implements IGUIProvider, INBTTra
|
||||
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),
|
||||
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),
|
||||
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),
|
||||
@ -211,9 +211,10 @@ public class BlockBobble extends BlockContainer implements IGUIProvider, INBTTra
|
||||
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),
|
||||
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),
|
||||
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 label; //the name engraved in the socket
|
||||
|
||||
@ -6,7 +6,7 @@ import java.util.Random;
|
||||
import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.util.I18nUtil;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import api.hbm.block.IDrillInteraction;
|
||||
import api.hbm.block.IMiningDrill;
|
||||
|
||||
@ -5,6 +5,7 @@ import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.interfaces.Spaghetti;
|
||||
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmoSecret;
|
||||
import com.hbm.items.ModItems;
|
||||
|
||||
@ -16,6 +17,7 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
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 {
|
||||
|
||||
List<ItemStack> crateList;
|
||||
@ -69,22 +71,16 @@ public class BlockCrate extends BlockFalling {
|
||||
|
||||
// Lead Crate
|
||||
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_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_neptunium, 7);
|
||||
BlockCrate.addToListWithWeight(leadList, ModItems.ingot_uranium_fuel, 8);
|
||||
BlockCrate.addToListWithWeight(leadList, ModItems.ingot_plutonium_fuel, 7);
|
||||
BlockCrate.addToListWithWeight(leadList, ModItems.ingot_mox_fuel, 6);
|
||||
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_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_neptunium, 7);
|
||||
BlockCrate.addToListWithWeight(leadList, ModItems.nugget_uranium_fuel, 8);
|
||||
@ -96,7 +92,6 @@ public class BlockCrate extends BlockFalling {
|
||||
BlockCrate.addToListWithWeight(leadList, ModItems.cell_puf6, 8);
|
||||
BlockCrate.addToListWithWeight(leadList, ModItems.pellet_rtg, 6);
|
||||
BlockCrate.addToListWithWeight(leadList, ModItems.pellet_rtg_weak, 7);
|
||||
BlockCrate.addToListWithWeight(leadList, ModItems.tritium_deuterium_cake, 5);
|
||||
BlockCrate.addToListWithWeight(leadList, ModItems.powder_yellowcake, 10);
|
||||
|
||||
// Metal Crate
|
||||
@ -110,14 +105,13 @@ public class BlockCrate extends BlockFalling {
|
||||
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_assembler), 10);
|
||||
BlockCrate.addToListWithWeight(metalList, Item.getItemFromBlock(ModBlocks.machine_assembly_machine), 10);
|
||||
BlockCrate.addToListWithWeight(metalList, Item.getItemFromBlock(ModBlocks.machine_fluidtank), 7);
|
||||
BlockCrate.addToListWithWeight(metalList, ModItems.centrifuge_element, 6);
|
||||
BlockCrate.addToListWithWeight(metalList, ModItems.motor, 8);
|
||||
BlockCrate.addToListWithWeight(metalList, ModItems.coil_tungsten, 7);
|
||||
BlockCrate.addToListWithWeight(metalList, ModItems.photo_panel, 3);
|
||||
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.piston_selenium, 6);
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@ package com.hbm.blocks.generic;
|
||||
|
||||
import com.hbm.blocks.BlockMulti;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.world.gen.INBTTransformable;
|
||||
import com.hbm.world.gen.nbt.INBTBlockTransformable;
|
||||
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@ -15,7 +15,7 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockDecoCRT extends BlockMulti implements INBTTransformable {
|
||||
public class BlockDecoCRT extends BlockMulti implements INBTBlockTransformable {
|
||||
|
||||
protected String[] variants = new String[] {"crt_clean", "crt_broken", "crt_blinking", "crt_bsod"};
|
||||
@SideOnly(Side.CLIENT) protected IIcon[] icons;
|
||||
@ -77,7 +77,7 @@ public class BlockDecoCRT extends BlockMulti implements INBTTransformable {
|
||||
|
||||
@Override
|
||||
public int transformMeta(int meta, int coordBaseMode) {
|
||||
return INBTTransformable.transformMetaDecoModel(meta, coordBaseMode);
|
||||
return INBTBlockTransformable.transformMetaDecoModel(meta, coordBaseMode);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
package com.hbm.blocks.generic;
|
||||
|
||||
import com.hbm.blocks.BlockEnumMulti;
|
||||
import com.hbm.world.gen.INBTTransformable;
|
||||
import com.hbm.world.gen.nbt.INBTBlockTransformable;
|
||||
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import net.minecraft.block.material.Material;
|
||||
@ -12,7 +12,7 @@ import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockDecoModel extends BlockEnumMulti implements INBTTransformable {
|
||||
public class BlockDecoModel extends BlockEnumMulti implements INBTBlockTransformable {
|
||||
|
||||
public BlockDecoModel(Material mat, Class<? extends Enum> theEnum, boolean multiName, boolean multiTexture) {
|
||||
super(mat, theEnum, multiName, multiTexture);
|
||||
|
||||
@ -2,7 +2,7 @@ package com.hbm.blocks.generic;
|
||||
|
||||
import com.hbm.blocks.BlockMulti;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.world.gen.INBTTransformable;
|
||||
import com.hbm.world.gen.nbt.INBTBlockTransformable;
|
||||
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@ -17,7 +17,7 @@ import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockDecoToaster extends BlockMulti implements INBTTransformable {
|
||||
public class BlockDecoToaster extends BlockMulti implements INBTBlockTransformable {
|
||||
|
||||
protected String[] variants = new String[] {"toaster_iron", "toaster_steel", "toaster_wood"};
|
||||
@SideOnly(Side.CLIENT) protected IIcon[] icons;
|
||||
@ -94,7 +94,7 @@ public class BlockDecoToaster extends BlockMulti implements INBTTransformable {
|
||||
|
||||
@Override
|
||||
public int transformMeta(int meta, int coordBaseMode) {
|
||||
return INBTTransformable.transformMetaDecoModel(meta, coordBaseMode);
|
||||
return INBTBlockTransformable.transformMetaDecoModel(meta, coordBaseMode);
|
||||
}
|
||||
|
||||
}
|
||||
@ -3,7 +3,7 @@ package com.hbm.blocks.generic;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.util.I18nUtil;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import api.hbm.item.IDepthRockTool;
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
@ -17,6 +17,8 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
@ -92,7 +94,7 @@ public class BlockDoorGeneric extends BlockDummyable implements IBomb {
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World worldIn, int x, int y, int z, AxisAlignedBB entityBox, List collidingBoxes, Entity entityIn) {
|
||||
AxisAlignedBB box = getBoundingBox(worldIn, x, y ,z);
|
||||
AxisAlignedBB box = getBoundingBox(worldIn, x, y, z, true);
|
||||
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));
|
||||
@ -111,11 +113,27 @@ public class BlockDoorGeneric extends BlockDummyable implements IBomb {
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
AxisAlignedBB aabb = this.getBoundingBox(world, x, y, z);
|
||||
AxisAlignedBB aabb = this.getBoundingBox(world, x, y, z, true);
|
||||
if(aabb.minX == aabb.maxX && aabb.minY == aabb.maxY && aabb.minZ == aabb.maxZ) return null;
|
||||
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
|
||||
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
|
||||
@ -140,11 +158,11 @@ public class BlockDoorGeneric extends BlockDummyable implements IBomb {
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
return getBoundingBox(world, x, y, z);
|
||||
return getBoundingBox(world, x, y, z, false);
|
||||
//return AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1);
|
||||
}
|
||||
|
||||
public AxisAlignedBB getBoundingBox(World world, int x, int y, int z) {
|
||||
public AxisAlignedBB getBoundingBox(World world, int x, int y, int z, boolean forCollision) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
int[] core = this.findCore(world, x, y, z);
|
||||
@ -155,7 +173,7 @@ public class BlockDoorGeneric extends BlockDummyable implements IBomb {
|
||||
TileEntity te2 = world.getTileEntity(core[0], core[1], core[2]);
|
||||
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));
|
||||
AxisAlignedBB box = type.getBlockBound(pos.getX(), pos.getY(), pos.getZ(), open);
|
||||
AxisAlignedBB box = type.getBlockBound(pos.getX(), pos.getY(), pos.getZ(), open, forCollision);
|
||||
|
||||
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);
|
||||
|
||||
@ -5,7 +5,7 @@ import java.util.List;
|
||||
import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.util.I18nUtil;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
@ -4,7 +4,7 @@ import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.world.gen.INBTTransformable;
|
||||
import com.hbm.world.gen.nbt.INBTBlockTransformable;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -21,7 +21,7 @@ import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockModDoor extends Block implements INBTTransformable {
|
||||
public class BlockModDoor extends Block implements INBTBlockTransformable {
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon[] field_150017_a;
|
||||
@SideOnly(Side.CLIENT)
|
||||
@ -400,6 +400,6 @@ public class BlockModDoor extends Block implements INBTTransformable {
|
||||
|
||||
@Override
|
||||
public int transformMeta(int meta, int coordBaseMode) {
|
||||
return INBTTransformable.transformMetaDoor(meta, coordBaseMode);
|
||||
return INBTBlockTransformable.transformMetaDoor(meta, coordBaseMode);
|
||||
}
|
||||
}
|
||||
60
src/main/java/com/hbm/blocks/generic/BlockNTMTrapdoor.java
Normal file
60
src/main/java/com/hbm/blocks/generic/BlockNTMTrapdoor.java
Normal file
@ -0,0 +1,60 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -68,9 +68,6 @@ public class BlockOre extends Block {
|
||||
if(this == ModBlocks.ore_nether_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) {
|
||||
return ModItems.fragment_meteorite;
|
||||
}
|
||||
|
||||
@ -66,18 +66,19 @@ public class BlockPedestal extends BlockContainer {
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
if(world.isRemote) return true;
|
||||
if(player.isSneaking()) return false;
|
||||
|
||||
TileEntityPedestal pedestal = (TileEntityPedestal) 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();
|
||||
|
||||
@ -4,7 +4,7 @@ import java.util.List;
|
||||
|
||||
import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.world.gen.INBTTransformable;
|
||||
import com.hbm.world.gen.nbt.INBTBlockTransformable;
|
||||
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@ -17,7 +17,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockPipe extends Block implements ITooltipProvider, INBTTransformable {
|
||||
public class BlockPipe extends Block implements ITooltipProvider, INBTBlockTransformable {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon sideIcon;
|
||||
@ -96,7 +96,7 @@ public class BlockPipe extends Block implements ITooltipProvider, INBTTransforma
|
||||
|
||||
@Override
|
||||
public int transformMeta(int meta, int coordBaseMode) {
|
||||
return INBTTransformable.transformMetaPillar(meta, coordBaseMode);
|
||||
return INBTBlockTransformable.transformMetaPillar(meta, coordBaseMode);
|
||||
}
|
||||
|
||||
}
|
||||
@ -5,8 +5,8 @@ import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.IBlockMulti;
|
||||
import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.world.gen.INBTTileEntityTransformable;
|
||||
import com.hbm.world.gen.INBTTransformable;
|
||||
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.SideOnly;
|
||||
@ -29,7 +29,7 @@ import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockPlushie extends BlockContainer implements IBlockMulti, ITooltipProvider, INBTTransformable {
|
||||
public class BlockPlushie extends BlockContainer implements IBlockMulti, ITooltipProvider, INBTBlockTransformable {
|
||||
|
||||
public BlockPlushie() {
|
||||
super(Material.cloth);
|
||||
@ -96,12 +96,16 @@ public class BlockPlushie extends BlockContainer implements IBlockMulti, IToolti
|
||||
@Override
|
||||
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) {
|
||||
TileEntityPlushie plushie = (TileEntityPlushie) world.getTileEntity(x, y, z);
|
||||
plushie.squishTimer = 11;
|
||||
return true;
|
||||
} else {
|
||||
world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, "hbm:block.squeakyToy", 0.25F, 1F);
|
||||
if(plushie.type == PlushieType.HUNDUN) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -155,7 +159,7 @@ public class BlockPlushie extends BlockContainer implements IBlockMulti, IToolti
|
||||
NONE( "NONE", null),
|
||||
YOMI( "Yomi", "Hi! Can I be your rabbit friend?"),
|
||||
NUMBERNINE( "Number Nine", "None of y'all deserve coal."),
|
||||
POOH( "Winnie the Pooh", "Beloved children's character with no malicious intent.");
|
||||
HUNDUN( "Hundun", "混沌");
|
||||
|
||||
public String label;
|
||||
public String inscription;
|
||||
|
||||
496
src/main/java/com/hbm/blocks/generic/BlockRebar.java
Normal file
496
src/main/java/com/hbm/blocks/generic/BlockRebar.java
Normal file
@ -0,0 +1,496 @@
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -11,6 +11,7 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
@ -66,7 +67,7 @@ public class BlockReeds extends Block {
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int meta, Random rand, int fortune) {
|
||||
return null;
|
||||
return Items.stick;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -41,18 +41,19 @@ public class BlockSkeletonHolder extends BlockContainer {
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
if(world.isRemote) return true;
|
||||
if(player.isSneaking()) 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();
|
||||
|
||||
@ -6,8 +6,10 @@ import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.IBlockMulti;
|
||||
import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.config.ServerConfig;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.tool.ItemLock;
|
||||
import com.hbm.lib.RefStrings;
|
||||
@ -38,8 +40,9 @@ import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
|
||||
public class BlockStorageCrate extends BlockContainer implements IBlockMulti, ITooltipProvider {
|
||||
public class BlockStorageCrate extends BlockContainer implements IBlockMulti, ILookOverlay, ITooltipProvider {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
@ -105,6 +108,21 @@ public class BlockStorageCrate extends BlockContainer implements IBlockMulti, IT
|
||||
|
||||
@Override
|
||||
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) {
|
||||
|
||||
@ -136,14 +154,28 @@ public class BlockStorageCrate extends BlockContainer implements IBlockMulti, IT
|
||||
}
|
||||
}
|
||||
|
||||
if(inv instanceof TileEntityCrateBase)
|
||||
nbt.setBoolean("spiders", ((TileEntityCrateBase) inv).hasSpiders);
|
||||
if(inv instanceof TileEntityCrateBase) {
|
||||
TileEntityCrateBase crate = (TileEntityCrateBase) inv;
|
||||
// Saves memory and ensures consistency between crafted crates and mined ones
|
||||
if (crate.hasSpiders) {
|
||||
nbt.setBoolean("spiders", true);
|
||||
}
|
||||
}
|
||||
|
||||
if(!nbt.hasNoTags()) {
|
||||
drop.stackTagCompound = nbt;
|
||||
}
|
||||
|
||||
if(inv instanceof TileEntityCrateBase) {
|
||||
TileEntityCrateBase crate = (TileEntityCrateBase) inv;
|
||||
if (crate.hasCustomInventoryName()) {
|
||||
drop.setStackDisplayName(crate.getInventoryName());
|
||||
}
|
||||
}
|
||||
|
||||
if (drop.hasTagCompound()) {
|
||||
try {
|
||||
byte[] abyte = CompressedStreamTools.compress(nbt);
|
||||
byte[] abyte = CompressedStreamTools.compress(drop.stackTagCompound);
|
||||
|
||||
if(abyte.length > 6000) {
|
||||
player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.RED + "Warning: Container NBT exceeds 6kB, contents will be ejected!"));
|
||||
@ -204,8 +236,14 @@ public class BlockStorageCrate extends BlockContainer implements IBlockMulti, IT
|
||||
lockable.lock();
|
||||
}
|
||||
}
|
||||
|
||||
if(inv instanceof TileEntityCrateBase) {
|
||||
((TileEntityCrateBase) inv).hasSpiders = stack.stackTagCompound.getBoolean("spiders");
|
||||
TileEntityCrateBase crate = (TileEntityCrateBase) inv;
|
||||
crate.hasSpiders = stack.stackTagCompound.getBoolean("spiders");
|
||||
|
||||
if (stack.hasDisplayName()) {
|
||||
crate.setCustomName(stack.getDisplayName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -338,4 +376,20 @@ public class BlockStorageCrate extends BlockContainer implements IBlockMulti, IT
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@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));
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,9 +13,9 @@ import com.hbm.inventory.RecipesCommon.AStack;
|
||||
import com.hbm.inventory.RecipesCommon.ComparableStack;
|
||||
import com.hbm.inventory.RecipesCommon.MetaBlock;
|
||||
import com.hbm.inventory.RecipesCommon.OreDictStack;
|
||||
import com.hbm.util.I18nUtil;
|
||||
import com.hbm.util.InventoryUtil;
|
||||
import com.hbm.util.Tuple.Pair;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import api.hbm.block.IToolable;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
@ -17,8 +17,8 @@ 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.I18nUtil;
|
||||
import com.hbm.world.gen.INBTTransformable;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
import com.hbm.world.gen.nbt.INBTBlockTransformable;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
@ -47,7 +47,7 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||
|
||||
public class BlockWandJigsaw extends BlockContainer implements IBlockSideRotation, INBTTransformable, IGUIProvider, ILookOverlay {
|
||||
public class BlockWandJigsaw extends BlockContainer implements IBlockSideRotation, INBTBlockTransformable, IGUIProvider, ILookOverlay {
|
||||
|
||||
private IIcon iconTop;
|
||||
private IIcon iconSide;
|
||||
@ -123,7 +123,7 @@ public class BlockWandJigsaw extends BlockContainer implements IBlockSideRotatio
|
||||
|
||||
@Override
|
||||
public int transformMeta(int meta, int coordBaseMode) {
|
||||
return INBTTransformable.transformMetaDeco(meta, coordBaseMode);
|
||||
return INBTBlockTransformable.transformMetaDeco(meta, coordBaseMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
345
src/main/java/com/hbm/blocks/generic/BlockWandLogic.java
Normal file
345
src/main/java/com/hbm/blocks/generic/BlockWandLogic.java
Normal file
@ -0,0 +1,345 @@
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -15,9 +15,9 @@ import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import com.hbm.util.BufferUtil;
|
||||
import com.hbm.util.I18nUtil;
|
||||
import com.hbm.util.LootGenerator;
|
||||
import com.hbm.world.gen.INBTTileEntityTransformable;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
import com.hbm.world.gen.nbt.INBTTileEntityTransformable;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import api.hbm.block.IToolable;
|
||||
|
||||
438
src/main/java/com/hbm/blocks/generic/BlockWandTandem.java
Normal file
438
src/main/java/com/hbm/blocks/generic/BlockWandTandem.java
Normal file
@ -0,0 +1,438 @@
|
||||
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.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.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 = getBlock(world, player.getHeldItem());
|
||||
if(block == ModBlocks.wand_air) block = Blocks.air;
|
||||
|
||||
if(block != null && block != ModBlocks.wand_jigsaw && block != ModBlocks.wand_loot) {
|
||||
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;
|
||||
}
|
||||
|
||||
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
|
||||
@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; }
|
||||
}
|
||||
}
|
||||
183
src/main/java/com/hbm/blocks/generic/BlockWoodStructure.java
Normal file
183
src/main/java/com/hbm/blocks/generic/BlockWoodStructure.java
Normal file
@ -0,0 +1,183 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6,7 +6,7 @@ import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.tileentity.deco.TileEntityDecoBlock;
|
||||
import com.hbm.world.gen.INBTTransformable;
|
||||
import com.hbm.world.gen.nbt.INBTBlockTransformable;
|
||||
|
||||
import api.hbm.block.IToolable;
|
||||
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.World;
|
||||
|
||||
public class DecoBlock extends BlockContainer implements IToolable, INBTTransformable {
|
||||
public class DecoBlock extends BlockContainer implements IToolable, INBTBlockTransformable {
|
||||
|
||||
Random rand = new Random();
|
||||
|
||||
@ -185,6 +185,6 @@ public class DecoBlock extends BlockContainer implements IToolable, INBTTransfor
|
||||
|
||||
@Override
|
||||
public int transformMeta(int meta, int coordBaseMode) {
|
||||
return INBTTransformable.transformMetaDeco(meta, coordBaseMode);
|
||||
return INBTBlockTransformable.transformMetaDeco(meta, coordBaseMode);
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
package com.hbm.blocks.generic;
|
||||
|
||||
import com.hbm.tileentity.deco.TileEntityDecoPoleSatelliteReceiver;
|
||||
import com.hbm.world.gen.INBTTransformable;
|
||||
import com.hbm.world.gen.nbt.INBTBlockTransformable;
|
||||
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
@ -11,7 +11,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class DecoPoleSatelliteReceiver extends BlockContainer implements INBTTransformable {
|
||||
public class DecoPoleSatelliteReceiver extends BlockContainer implements INBTBlockTransformable {
|
||||
|
||||
public DecoPoleSatelliteReceiver(Material p_i45386_1_) {
|
||||
super(p_i45386_1_);
|
||||
@ -61,7 +61,7 @@ public class DecoPoleSatelliteReceiver extends BlockContainer implements INBTTra
|
||||
|
||||
@Override
|
||||
public int transformMeta(int meta, int coordBaseMode) {
|
||||
return INBTTransformable.transformMetaDeco(meta, coordBaseMode);
|
||||
return INBTBlockTransformable.transformMetaDeco(meta, coordBaseMode);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
package com.hbm.blocks.generic;
|
||||
|
||||
import com.hbm.world.gen.INBTTransformable;
|
||||
import com.hbm.world.gen.nbt.INBTBlockTransformable;
|
||||
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
@ -11,7 +11,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class DecoTapeRecorder extends BlockContainer implements INBTTransformable {
|
||||
public class DecoTapeRecorder extends BlockContainer implements INBTBlockTransformable {
|
||||
|
||||
public DecoTapeRecorder(Material p_i45386_1_) {
|
||||
super(p_i45386_1_);
|
||||
@ -63,7 +63,7 @@ public class DecoTapeRecorder extends BlockContainer implements INBTTransformabl
|
||||
|
||||
@Override
|
||||
public int transformMeta(int meta, int coordBaseMode) {
|
||||
return INBTTransformable.transformMetaDeco(meta, coordBaseMode);
|
||||
return INBTBlockTransformable.transformMetaDeco(meta, coordBaseMode);
|
||||
}
|
||||
|
||||
}
|
||||
@ -81,6 +81,7 @@ public class DungeonSpawner extends BlockContainer {
|
||||
|
||||
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;
|
||||
@ -122,7 +123,11 @@ public class DungeonSpawner extends BlockContainer {
|
||||
TileEntity te = world.getTileEntity(x, y + 18, z);
|
||||
if(te instanceof TileEntitySkeletonHolder) {
|
||||
TileEntitySkeletonHolder skeleton = (TileEntitySkeletonHolder) te;
|
||||
skeleton.item = new ItemStack(ModItems.item_secret, 1, EnumSecretType.ABERRATOR.ordinal());
|
||||
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);
|
||||
}
|
||||
|
||||
162
src/main/java/com/hbm/blocks/generic/LogicBlock.java
Normal file
162
src/main/java/com/hbm/blocks/generic/LogicBlock.java
Normal file
@ -0,0 +1,162 @@
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -2,8 +2,9 @@ package com.hbm.blocks.machine;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class BlockCMFlux extends BlockPillar{
|
||||
public BlockCMFlux(Material mat, String top) {
|
||||
super(mat, top);
|
||||
}
|
||||
public class BlockCMFlux extends BlockPillar {
|
||||
|
||||
public BlockCMFlux(Material mat, String top) {
|
||||
super(mat, top);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,8 +2,9 @@ package com.hbm.blocks.machine;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class BlockCMHeat extends BlockPillar{
|
||||
public BlockCMHeat(Material mat, String top) {
|
||||
super(mat, top);
|
||||
}
|
||||
public class BlockCMHeat extends BlockPillar {
|
||||
|
||||
public BlockCMHeat(Material mat, String top) {
|
||||
super(mat, top);
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@ import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.render.block.ct.CT;
|
||||
import com.hbm.render.block.ct.CTStitchReceiver;
|
||||
import com.hbm.render.block.ct.IBlockCT;
|
||||
import com.hbm.util.I18nUtil;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@ -7,7 +7,7 @@ import org.lwjgl.input.Keyboard;
|
||||
import com.hbm.blocks.BlockMulti;
|
||||
import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.util.I18nUtil;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@ -6,7 +6,7 @@ import java.util.List;
|
||||
import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.tileentity.machine.TileEntityHadronPower;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.I18nUtil;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.world.gen.INBTTransformable;
|
||||
import com.hbm.world.gen.nbt.INBTBlockTransformable;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import net.minecraft.block.Block;
|
||||
@ -17,7 +17,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class BlockMachineBase extends BlockContainer implements INBTTransformable {
|
||||
public abstract class BlockMachineBase extends BlockContainer implements INBTBlockTransformable {
|
||||
|
||||
int guiID = -1;
|
||||
protected boolean rotatable = false;
|
||||
@ -115,6 +115,6 @@ public abstract class BlockMachineBase extends BlockContainer implements INBTTra
|
||||
@Override
|
||||
public int transformMeta(int meta, int coordBaseMode) {
|
||||
if(!rotatable) return meta;
|
||||
return INBTTransformable.transformMetaDeco(meta, coordBaseMode);
|
||||
return INBTBlockTransformable.transformMetaDeco(meta, coordBaseMode);
|
||||
}
|
||||
}
|
||||
@ -12,6 +12,8 @@ import com.hbm.render.block.ct.IBlockCT;
|
||||
import com.hbm.tileentity.machine.TileEntityPWRController;
|
||||
|
||||
import api.hbm.fluidmk2.IFluidReceiverMK2;
|
||||
import api.hbm.redstoneoverradio.IRORInteractive;
|
||||
import api.hbm.redstoneoverradio.IRORValueProvider;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
@ -98,7 +100,7 @@ public class BlockPWR extends BlockContainer implements IBlockCT {
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
}
|
||||
|
||||
public static class TileEntityBlockPWR extends TileEntity implements IFluidReceiverMK2, ISidedInventory {
|
||||
public static class TileEntityBlockPWR extends TileEntity implements IFluidReceiverMK2, ISidedInventory, IRORValueProvider, IRORInteractive {
|
||||
|
||||
public Block block;
|
||||
public int coreX;
|
||||
@ -337,5 +339,29 @@ public class BlockPWR extends BlockContainer implements IBlockCT {
|
||||
super.onChunkUnload();
|
||||
this.isLoaded = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getFunctionInfo() {
|
||||
if(this.getBlockMetadata() != 1) return new String[0];
|
||||
TileEntityPWRController controller = this.getCore();
|
||||
if(controller != null) return controller.getFunctionInfo();
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String provideRORValue(String name) {
|
||||
if(this.getBlockMetadata() != 1) return "";
|
||||
TileEntityPWRController controller = this.getCore();
|
||||
if(controller != null) return controller.provideRORValue(name);
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String runRORFunction(String name, String[] params) {
|
||||
if(this.getBlockMetadata() != 1) return "";
|
||||
TileEntityPWRController controller = this.getCore();
|
||||
if(controller != null) return controller.runRORFunction(name, params);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@ import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityDeuteriumTower;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.I18nUtil;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
@ -4,10 +4,10 @@ import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.blocks.machine.FloodlightBeam.TileEntityFloodlightBeam;
|
||||
import com.hbm.util.Compat;
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
import com.hbm.world.gen.nbt.INBTBlockTransformable;
|
||||
|
||||
import api.hbm.block.IToolable;
|
||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||
import com.hbm.world.gen.INBTTransformable;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
@ -28,7 +28,7 @@ import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class Floodlight extends BlockContainer implements IToolable, INBTTransformable {
|
||||
public class Floodlight extends BlockContainer implements IToolable, INBTBlockTransformable {
|
||||
|
||||
public Floodlight(Material mat) {
|
||||
super(mat);
|
||||
|
||||
@ -9,7 +9,8 @@ import com.hbm.items.machine.ItemMold;
|
||||
import com.hbm.items.machine.ItemMold.Mold;
|
||||
import com.hbm.items.machine.ItemScraps;
|
||||
import com.hbm.tileentity.machine.TileEntityFoundryCastingBase;
|
||||
import com.hbm.util.I18nUtil;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
@ -9,7 +9,7 @@ import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemScraps;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.machine.TileEntityFoundryOutlet;
|
||||
import com.hbm.util.I18nUtil;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import api.hbm.block.ICrucibleAcceptor;
|
||||
import api.hbm.block.IToolable;
|
||||
|
||||
@ -131,4 +131,22 @@ public class GeigerCounter extends BlockContainer {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasComparatorInputOverride() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(World world, int x, int y, int z, int side) {
|
||||
TileEntityGeiger te = (TileEntityGeiger)world.getTileEntity(x, y, z);
|
||||
if (te == null) return 0;
|
||||
|
||||
float rad = te.check();
|
||||
|
||||
// 0 at exactly 0 rads/sec
|
||||
// +1 per 5 rads/sec
|
||||
// 15 at 75+ rads/sec
|
||||
return Math.min((int)Math.ceil(rad / 5f), 15);
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@ import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityHeaterElectric;
|
||||
import com.hbm.util.I18nUtil;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
@ -12,7 +12,7 @@ import com.hbm.items.machine.IItemFluidIdentifier;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityHeaterHeatex;
|
||||
import com.hbm.util.I18nUtil;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
@ -11,7 +11,7 @@ import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.trait.FT_Flammable;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityHeaterOilburner;
|
||||
import com.hbm.util.I18nUtil;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import api.hbm.block.IToolable;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
@ -1,288 +0,0 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineArcFurnace;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class MachineArcFurnace extends BlockContainer {
|
||||
|
||||
private final Random field_149933_a = new Random();
|
||||
private final boolean isActive;
|
||||
private static boolean keepInventory;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconFront;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconBottom;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconRods;
|
||||
|
||||
public MachineArcFurnace(boolean blockState) {
|
||||
super(Material.iron);
|
||||
isActive = blockState;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.iconFront = iconRegister.registerIcon(RefStrings.MODID + (this.isActive ? ":machine_arc_furnace_front_on" : ":machine_arc_furnace_front_off"));
|
||||
this.iconTop = iconRegister.registerIcon(RefStrings.MODID + (this.isActive ? ":machine_arc_furnace_top_on" : ":machine_arc_furnace_top"));
|
||||
this.iconBottom = iconRegister.registerIcon(RefStrings.MODID + ":machine_arc_furnace_bottom");
|
||||
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":machine_arc_furnace_side");
|
||||
this.iconRods = iconRegister.registerIcon(RefStrings.MODID + ":machine_arc_furnace_top_rods");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
|
||||
if(this == ModBlocks.machine_arc_furnace_off) {
|
||||
|
||||
if(side == 1 && metadata > 5) {
|
||||
return iconRods;
|
||||
}
|
||||
}
|
||||
|
||||
if(metadata > 5)
|
||||
metadata -= 4;
|
||||
|
||||
if(side == 0)
|
||||
return this.iconBottom;
|
||||
if(side == 1)
|
||||
return this.iconTop;
|
||||
|
||||
return metadata == 0 && side == 3 ? this.iconFront : (side == metadata ? this.iconFront : this.blockIcon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
|
||||
{
|
||||
return Item.getItemFromBlock(ModBlocks.machine_arc_furnace_off);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, int x, int y, int z) {
|
||||
super.onBlockAdded(world, x, y, z);
|
||||
this.setDefaultDirection(world, x, y, z);
|
||||
}
|
||||
|
||||
private void setDefaultDirection(World world, int x, int y, int z) {
|
||||
if(!world.isRemote)
|
||||
{
|
||||
Block block1 = world.getBlock(x, y, z - 1);
|
||||
Block block2 = world.getBlock(x, y, z + 1);
|
||||
Block block3 = world.getBlock(x - 1, y, z);
|
||||
Block block4 = world.getBlock(x + 1, y, z);
|
||||
|
||||
byte b0 = 3;
|
||||
|
||||
if(block1.func_149730_j() && !block2.func_149730_j())
|
||||
{
|
||||
b0 = 3;
|
||||
}
|
||||
if(block2.func_149730_j() && !block1.func_149730_j())
|
||||
{
|
||||
b0 = 2;
|
||||
}
|
||||
if(block3.func_149730_j() && !block4.func_149730_j())
|
||||
{
|
||||
b0 = 5;
|
||||
}
|
||||
if(block4.func_149730_j() && !block3.func_149730_j())
|
||||
{
|
||||
b0 = 4;
|
||||
}
|
||||
|
||||
world.setBlockMetadataWithNotify(x, y, z, b0, 2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
|
||||
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||
|
||||
if(i == 0)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
if(itemStack.hasDisplayName())
|
||||
{
|
||||
((TileEntityMachineArcFurnace)world.getTileEntity(x, y, z)).setCustomName(itemStack.getDisplayName());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
if(world.isRemote)
|
||||
{
|
||||
return true;
|
||||
} else if(!player.isSneaking())
|
||||
{
|
||||
TileEntityMachineArcFurnace entity = (TileEntityMachineArcFurnace) world.getTileEntity(x, y, z);
|
||||
if(entity != null)
|
||||
{
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileEntityMachineArcFurnace();
|
||||
}
|
||||
|
||||
public static void updateBlockState(boolean isProcessing, World world, int x, int y, int z) {
|
||||
int i = world.getBlockMetadata(x, y, z);
|
||||
TileEntity entity = world.getTileEntity(x, y, z);
|
||||
keepInventory = true;
|
||||
|
||||
if(isProcessing)
|
||||
{
|
||||
world.setBlock(x, y, z, ModBlocks.machine_arc_furnace_on);
|
||||
}else{
|
||||
world.setBlock(x, y, z, ModBlocks.machine_arc_furnace_off);
|
||||
}
|
||||
|
||||
keepInventory = false;
|
||||
world.setBlockMetadataWithNotify(x, y, z, i, 2);
|
||||
|
||||
if(entity != null) {
|
||||
entity.validate();
|
||||
world.setTileEntity(x, y, z, entity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_)
|
||||
{
|
||||
if (!keepInventory)
|
||||
{
|
||||
TileEntityMachineArcFurnace tileentityfurnace = (TileEntityMachineArcFurnace)p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_);
|
||||
|
||||
if (tileentityfurnace != null)
|
||||
{
|
||||
for (int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1)
|
||||
{
|
||||
ItemStack itemstack = tileentityfurnace.getStackInSlot(i1);
|
||||
|
||||
if (itemstack != null)
|
||||
{
|
||||
float f = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
while (itemstack.stackSize > 0)
|
||||
{
|
||||
int j1 = this.field_149933_a.nextInt(21) + 10;
|
||||
|
||||
if (j1 > itemstack.stackSize)
|
||||
{
|
||||
j1 = itemstack.stackSize;
|
||||
}
|
||||
|
||||
itemstack.stackSize -= j1;
|
||||
EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1, p_149749_4_ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));
|
||||
|
||||
if (itemstack.hasTagCompound())
|
||||
{
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float)this.field_149933_a.nextGaussian() * f3;
|
||||
entityitem.motionY = (float)this.field_149933_a.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float)this.field_149933_a.nextGaussian() * f3;
|
||||
p_149749_1_.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
p_149749_1_.func_147453_f(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_);
|
||||
}
|
||||
}
|
||||
|
||||
super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World p_149734_1_, int x, int y, int z, Random rand)
|
||||
{
|
||||
if (isActive)
|
||||
{
|
||||
int l = p_149734_1_.getBlockMetadata(x, y, z);
|
||||
float f = x + 0.5F;
|
||||
float f1 = y + 0.0F + rand.nextFloat() * 6.0F / 16.0F;
|
||||
float f2 = z + 0.5F;
|
||||
float f3 = 0.52F;
|
||||
float f4 = rand.nextFloat() * 0.6F - 0.3F;
|
||||
|
||||
if (l == 4)
|
||||
{
|
||||
p_149734_1_.spawnParticle("smoke", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
|
||||
p_149734_1_.spawnParticle("flame", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
else if (l == 5)
|
||||
{
|
||||
p_149734_1_.spawnParticle("smoke", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
|
||||
p_149734_1_.spawnParticle("flame", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
else if (l == 2)
|
||||
{
|
||||
p_149734_1_.spawnParticle("smoke", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D);
|
||||
p_149734_1_.spawnParticle("flame", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
else if (l == 3)
|
||||
{
|
||||
p_149734_1_.spawnParticle("smoke", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D);
|
||||
p_149734_1_.spawnParticle("flame", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_)
|
||||
{
|
||||
return Item.getItemFromBlock(ModBlocks.machine_arc_furnace_off);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,45 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineAssemblyMachine;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class MachineAssemblyMachine extends BlockDummyable {
|
||||
|
||||
public MachineAssemblyMachine(Material mat) {
|
||||
super(mat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
if(meta >= 12) return new TileEntityMachineAssemblyMachine();
|
||||
if(meta >= 6) return new TileEntityProxyCombo().inventory().power().fluid();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
return this.standardOpenBehavior(world, x, y, z, player, 0);
|
||||
}
|
||||
|
||||
@Override public int[] getDimensions() { return new int[] {2, 0, 1, 1, 1, 1}; }
|
||||
@Override public int getOffset() { return 1; }
|
||||
|
||||
@Override
|
||||
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
super.fillSpace(world, x, y, z, dir, o);
|
||||
|
||||
x -= dir.offsetX;
|
||||
z -= dir.offsetZ;
|
||||
|
||||
for(int i = -1; i <= 1; i++) for(int j = -1; j <= 1; j++) {
|
||||
if(i != 0 || j != 0) this.makeExtra(world, x + i, y, z + j);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -8,8 +8,9 @@ import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.items.machine.IItemFluidIdentifier;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineAutosaw;
|
||||
import com.hbm.util.I18nUtil;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import api.hbm.block.IToolable;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@ -22,7 +23,7 @@ import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||
|
||||
public class MachineAutosaw extends BlockContainer implements ILookOverlay, ITooltipProvider {
|
||||
public class MachineAutosaw extends BlockContainer implements ILookOverlay, ITooltipProvider, IToolable {
|
||||
|
||||
public MachineAutosaw() {
|
||||
super(Material.iron);
|
||||
@ -72,6 +73,24 @@ public class MachineAutosaw extends BlockContainer implements ILookOverlay, IToo
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onScrew(World world, EntityPlayer player, int x, int y, int z, int side, float fX, float fY, float fZ, ToolType tool) {
|
||||
if(tool != ToolType.SCREWDRIVER)
|
||||
return false;
|
||||
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
|
||||
if(!(te instanceof TileEntityMachineAutosaw))
|
||||
return false;
|
||||
|
||||
TileEntityMachineAutosaw saw = (TileEntityMachineAutosaw) te;
|
||||
|
||||
saw.isSuspended = !saw.isSuspended;
|
||||
saw.markDirty();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printHook(Pre event, World world, int x, int y, int z) {
|
||||
|
||||
@ -84,6 +103,10 @@ public class MachineAutosaw extends BlockContainer implements ILookOverlay, IToo
|
||||
|
||||
List<String> text = new ArrayList();
|
||||
text.add(saw.tank.getTankType().getLocalizedName() + ": " + saw.tank.getFill() + "/" + saw.tank.getMaxFill() + "mB");
|
||||
|
||||
if (saw.isSuspended) {
|
||||
text.add(EnumChatFormatting.RED + "! " + I18nUtil.resolveKey(getUnlocalizedName() + ".suspended") + " !");
|
||||
}
|
||||
|
||||
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.IPersistentNBT;
|
||||
import com.hbm.tileentity.machine.storage.TileEntityMachineBattery;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.I18nUtil;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
@ -3,6 +3,12 @@ package com.hbm.blocks.machine;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.handler.CompatHandler;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
import li.cil.oc.api.network.SimpleComponent;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import com.hbm.blocks.ILookOverlay;
|
||||
@ -13,8 +19,8 @@ import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.IPersistentNBT;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.I18nUtil;
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import api.hbm.energymk2.IEnergyProviderMK2;
|
||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||
@ -149,13 +155,15 @@ public class MachineCapacitor extends BlockContainer implements ILookOverlay, IP
|
||||
player.addStat(StatList.mineBlockStatArray[getIdFromBlock(this)], 1);
|
||||
player.addExhaustion(0.025F);
|
||||
}
|
||||
|
||||
public static class TileEntityCapacitor extends TileEntityLoadedBase implements IEnergyProviderMK2, IEnergyReceiverMK2, IPersistentNBT, IRORValueProvider {
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||
public static class TileEntityCapacitor extends TileEntityLoadedBase implements IEnergyProviderMK2, IEnergyReceiverMK2, IPersistentNBT, IRORValueProvider, SimpleComponent, CompatHandler.OCComponent {
|
||||
|
||||
public long power;
|
||||
protected long maxPower;
|
||||
public long powerReceived;
|
||||
public long powerSent;
|
||||
public long lastPowerReceived;
|
||||
public long lastPowerSent;
|
||||
|
||||
public TileEntityCapacitor() { }
|
||||
|
||||
@ -198,6 +206,8 @@ public class MachineCapacitor extends BlockContainer implements ILookOverlay, IP
|
||||
|
||||
networkPackNT(15);
|
||||
|
||||
this.lastPowerSent = powerSent;
|
||||
this.lastPowerReceived = powerReceived;
|
||||
this.powerSent = 0;
|
||||
this.powerReceived = 0;
|
||||
}
|
||||
@ -315,5 +325,69 @@ public class MachineCapacitor extends BlockContainer implements ILookOverlay, IP
|
||||
if((PREFIX_VALUE + "fillpercent").equals(name)) return "" + this.power * 100 / this.maxPower;
|
||||
return null;
|
||||
}
|
||||
|
||||
// opencomputer
|
||||
@Override
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public String getComponentName() {
|
||||
return "capacitor";
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getEnergy(Context context, Arguments args) {
|
||||
return new Object[] {power};
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getMaxEnergy(Context context, Arguments args) {
|
||||
return new Object[] {maxPower};
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getEnergySent(Context context, Arguments args) {
|
||||
return new Object[] {lastPowerReceived};
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getEnergyReceived(Context context, Arguments args) { return new Object[] {lastPowerSent}; }
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getInfo(Context context, Arguments args) {
|
||||
return new Object[] {power, maxPower, lastPowerReceived, lastPowerSent};
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public String[] methods() {
|
||||
return new String[] {
|
||||
"getEnergy",
|
||||
"getMaxEnergy",
|
||||
"getEnergySent",
|
||||
"getEnergyReceived",
|
||||
"getInfo"
|
||||
};
|
||||
}
|
||||
@Override
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] invoke(String method, Context context, Arguments args) throws Exception {
|
||||
switch(method) {
|
||||
case ("getEnergy"):
|
||||
return getEnergy(context, args);
|
||||
case ("getMaxEnergy"):
|
||||
return getMaxEnergy(context, args);
|
||||
case ("getEnergySent"):
|
||||
return getEnergySent(context, args);
|
||||
case ("getEnergyReceived"):
|
||||
return getEnergyReceived(context, args);
|
||||
case ("getInfo"):
|
||||
return getEnergyReceived(context, args);
|
||||
}
|
||||
throw new NoSuchMethodException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,7 +7,8 @@ import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.items.machine.IItemFluidIdentifier;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.oil.TileEntityMachineCatalyticCracker;
|
||||
import com.hbm.util.I18nUtil;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
@ -10,6 +10,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@Deprecated
|
||||
public class MachineChemfac extends BlockDummyable {
|
||||
|
||||
public MachineChemfac(Material mat) {
|
||||
|
||||
@ -0,0 +1,88 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.tileentity.TileEntityProxyDyn;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineChemicalFactory;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class MachineChemicalFactory extends BlockDummyable implements ITooltipProvider, ILookOverlay {
|
||||
|
||||
public MachineChemicalFactory(Material mat) {
|
||||
super(mat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
if(meta >= 12) return new TileEntityMachineChemicalFactory();
|
||||
if(meta >= 6) return new TileEntityProxyDyn().inventory().power().fluid();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
return this.standardOpenBehavior(world, x, y, z, player, 0);
|
||||
}
|
||||
|
||||
@Override public int[] getDimensions() { return new int[] {2, 0, 2, 2, 2, 2}; }
|
||||
@Override public int getOffset() { return 2; }
|
||||
|
||||
@Override
|
||||
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
super.fillSpace(world, x, y, z, dir, o);
|
||||
|
||||
x -= dir.offsetX * 2;
|
||||
z -= dir.offsetZ * 2;
|
||||
|
||||
for(int i = -2; i <= 2; i++) for(int j = -2; j <= 2; j++) {
|
||||
if(Math.abs(i) == 2 || Math.abs(j) == 2) this.makeExtra(world, x + i, y, z + j);
|
||||
}
|
||||
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
for(int i = -2; i <= 2; i++) {
|
||||
this.makeExtra(world, x + dir.offsetX * i + rot.offsetX * 2, y + 2, z + dir.offsetZ * i + rot.offsetZ * 2);
|
||||
this.makeExtra(world, x + dir.offsetX * i - rot.offsetX * 2, y + 2, z + dir.offsetZ * i - rot.offsetZ * 2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
|
||||
this.addStandardInfo(stack, player, list, ext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printHook(Pre event, World world, int x, int y, int z) {
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
if(pos == null) return;
|
||||
|
||||
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
if(!(te instanceof TileEntityMachineChemicalFactory)) return;
|
||||
TileEntityMachineChemicalFactory chemfac = (TileEntityMachineChemicalFactory) te;
|
||||
|
||||
DirPos[] cool = chemfac.getCoolPos();
|
||||
|
||||
for(DirPos dirPos : cool) if(dirPos.compare(x + dirPos.getDir().offsetX, y, z + dirPos.getDir().offsetZ)) {
|
||||
List<String> text = new ArrayList();
|
||||
|
||||
text.add(EnumChatFormatting.GREEN + "-> " + EnumChatFormatting.RESET + chemfac.water.getTankType().getLocalizedName());
|
||||
text.add(EnumChatFormatting.RED + "<- " + EnumChatFormatting.RESET + chemfac.lps.getTankType().getLocalizedName());
|
||||
|
||||
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,45 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineChemicalPlant;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class MachineChemicalPlant extends BlockDummyable {
|
||||
|
||||
public MachineChemicalPlant(Material mat) {
|
||||
super(mat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
if(meta >= 12) return new TileEntityMachineChemicalPlant();
|
||||
if(meta >= 6) return new TileEntityProxyCombo().inventory().power().fluid();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
return this.standardOpenBehavior(world, x, y, z, player, 0);
|
||||
}
|
||||
|
||||
@Override public int[] getDimensions() { return new int[] {2, 0, 1, 1, 1, 1}; }
|
||||
@Override public int getOffset() { return 1; }
|
||||
|
||||
@Override
|
||||
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
super.fillSpace(world, x, y, z, dir, o);
|
||||
|
||||
x -= dir.offsetX;
|
||||
z -= dir.offsetZ;
|
||||
|
||||
for(int i = -1; i <= 1; i++) for(int j = -1; j <= 1; j++) {
|
||||
if(i != 0 || j != 0) this.makeExtra(world, x + i, y, z + j);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -11,6 +11,7 @@ import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@Deprecated
|
||||
public class MachineChemplant extends BlockDummyable {
|
||||
|
||||
public MachineChemplant(Material p_i45386_1_) {
|
||||
|
||||
@ -15,7 +15,7 @@ import com.hbm.inventory.fluid.trait.FT_Coolable;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityChungus;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.I18nUtil;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
@ -5,7 +5,7 @@ import java.util.List;
|
||||
|
||||
import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.tileentity.machine.TileEntityCondenser;
|
||||
import com.hbm.util.I18nUtil;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
@ -5,7 +5,8 @@ import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityCondenserPowered;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.I18nUtil;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
@ -8,7 +8,8 @@ import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.items.machine.ItemStamp;
|
||||
import com.hbm.tileentity.machine.TileEntityConveyorPress;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.I18nUtil;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
@ -4,7 +4,8 @@ import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.machine.TileEntityDeuteriumExtractor;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.I18nUtil;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
|
||||
@ -8,7 +8,7 @@ import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.items.machine.IItemFluidIdentifier;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineDrain;
|
||||
import com.hbm.util.I18nUtil;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
@ -1,129 +1,80 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineEPress;
|
||||
import com.hbm.world.gen.INBTTransformable;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import api.hbm.block.IToolable;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class MachineEPress extends BlockContainer implements INBTTransformable {
|
||||
public class MachineEPress extends BlockDummyable implements IToolable {
|
||||
|
||||
private final Random field_149933_a = new Random();
|
||||
private static boolean keepInventory;
|
||||
|
||||
public MachineEPress(Material p_i45386_1_) {
|
||||
super(p_i45386_1_);
|
||||
public MachineEPress(Material mat) {
|
||||
super(mat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileEntityMachineEPress();
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
if(meta >= 12) return new TileEntityMachineEPress();
|
||||
if(meta >= 6) return new TileEntityProxyCombo(true, false, false);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return -1;
|
||||
public int[] getDimensions() {
|
||||
return new int[] {2, 0, 0, 0, 0, 0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
public int getOffset() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) {
|
||||
if(!keepInventory) {
|
||||
ISidedInventory tileentityfurnace = (ISidedInventory) p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_);
|
||||
|
||||
if(tileentityfurnace != null) {
|
||||
for(int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1) {
|
||||
ItemStack itemstack = tileentityfurnace.getStackInSlot(i1);
|
||||
|
||||
if(itemstack != null) {
|
||||
float f = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
while(itemstack.stackSize > 0) {
|
||||
int j1 = this.field_149933_a.nextInt(21) + 10;
|
||||
|
||||
if(j1 > itemstack.stackSize) {
|
||||
j1 = itemstack.stackSize;
|
||||
}
|
||||
|
||||
itemstack.stackSize -= j1;
|
||||
EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1, p_149749_4_ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));
|
||||
|
||||
if(itemstack.hasTagCompound()) {
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float) this.field_149933_a.nextGaussian() * f3;
|
||||
entityitem.motionY = (float) this.field_149933_a.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float) this.field_149933_a.nextGaussian() * f3;
|
||||
p_149749_1_.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
p_149749_1_.func_147453_f(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_);
|
||||
}
|
||||
}
|
||||
|
||||
super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_);
|
||||
protected boolean isLegacyMonoblock(World world, int x, int y, int z) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
return te != null && te instanceof TileEntityMachineEPress;
|
||||
}
|
||||
|
||||
@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, 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);
|
||||
super.onBlockPlacedBy(world, x, y, z, player, itemStack);
|
||||
|
||||
if(itemStack.hasDisplayName()) {
|
||||
((TileEntityMachineEPress) world.getTileEntity(x, y, z)).setCustomName(itemStack.getDisplayName());
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
if(pos != null) {
|
||||
TileEntityMachineEPress entity = (TileEntityMachineEPress) world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
if(entity != null) {
|
||||
entity.setCustomName(itemStack.getDisplayName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
if(world.isRemote) {
|
||||
return true;
|
||||
} else if(!player.isSneaking()) {
|
||||
TileEntityMachineEPress entity = (TileEntityMachineEPress) world.getTileEntity(x, y, z);
|
||||
if(entity != null) {
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return this.standardOpenBehavior(world, x, y, z, player, 0);
|
||||
}
|
||||
|
||||
// Un-multiblickable with a hand drill for schenanigans
|
||||
@Override
|
||||
public int transformMeta(int meta, int coordBaseMode) {
|
||||
return INBTTransformable.transformMetaDeco(meta, coordBaseMode);
|
||||
public boolean onScrew(World world, EntityPlayer player, int x, int y, int z, int side, float fX, float fY, float fZ, ToolType tool) {
|
||||
|
||||
if (tool != ToolType.HAND_DRILL)
|
||||
return false;
|
||||
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta >= 12)
|
||||
return false;
|
||||
|
||||
safeRem = true;
|
||||
world.setBlockToAir(x, y, z);
|
||||
safeRem = false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -35,7 +35,7 @@ public class MachineElectrolyser extends BlockDummyable {
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
return this.standardOpenBehavior(world, x, y, z, player, 0);
|
||||
return this.standardOpenBehavior(world, x, y, z, player, -1);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -10,7 +10,7 @@ import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.machine.storage.TileEntityMachineBattery;
|
||||
import com.hbm.tileentity.machine.storage.TileEntityMachineFENSU;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.I18nUtil;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
@ -3,11 +3,17 @@ package com.hbm.blocks.machine;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.PlayerInformPacket;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import com.hbm.util.ChatBuilder;
|
||||
|
||||
import api.hbm.block.IBlowable;
|
||||
import api.hbm.block.IToolable;
|
||||
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;
|
||||
@ -15,9 +21,12 @@ import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
@ -65,10 +74,11 @@ public class MachineFan extends BlockContainer implements IToolable, ITooltipPro
|
||||
return false;
|
||||
}
|
||||
|
||||
public static class TileEntityFan extends TileEntity {
|
||||
public static class TileEntityFan extends TileEntityLoadedBase {
|
||||
|
||||
public float spin;
|
||||
public float prevSpin;
|
||||
public boolean falloff = true;
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
@ -103,10 +113,17 @@ public class MachineFan extends BlockContainer implements IToolable, ITooltipPro
|
||||
List<Entity> affected = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(xCoord + 0.5 + Math.min(x, 0), yCoord + 0.5 + Math.min(y, 0), zCoord + 0.5 + Math.min(z, 0), xCoord + 0.5 + Math.max(x, 0), yCoord + 0.5 + Math.max(y, 0), zCoord + 0.5 + Math.max(z, 0)).expand(0.5, 0.5, 0.5));
|
||||
|
||||
for(Entity e : affected) {
|
||||
|
||||
double coeff = push;
|
||||
|
||||
if(falloff) {
|
||||
double dist = e.getDistance(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5);
|
||||
coeff *= 1.5 * (1 - dist / range / 2);
|
||||
}
|
||||
|
||||
e.motionX += dir.offsetX * push;
|
||||
e.motionY += dir.offsetY * push;
|
||||
e.motionZ += dir.offsetZ * push;
|
||||
e.motionX += dir.offsetX * coeff;
|
||||
e.motionY += dir.offsetY * coeff;
|
||||
e.motionZ += dir.offsetZ * coeff;
|
||||
}
|
||||
|
||||
if(worldObj.isRemote && worldObj.rand.nextInt(30) == 0) {
|
||||
@ -121,6 +138,10 @@ public class MachineFan extends BlockContainer implements IToolable, ITooltipPro
|
||||
this.prevSpin -= 360;
|
||||
this.spin -= 360;
|
||||
}
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
networkPackNT(150);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -128,21 +149,63 @@ public class MachineFan extends BlockContainer implements IToolable, ITooltipPro
|
||||
public double getMaxRenderDistanceSquared() {
|
||||
return 65536.0D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
this.falloff = nbt.getBoolean("falloff");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setBoolean("falloff", falloff);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
buf.writeBoolean(falloff);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
falloff = buf.readBoolean();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onScrew(World world, EntityPlayer player, int x, int y, int z, int side, float fX, float fY, float fZ, ToolType tool) {
|
||||
if(tool != ToolType.SCREWDRIVER) return false;
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if(tool == ToolType.SCREWDRIVER) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
if(meta == 0) world.setBlockMetadataWithNotify(x, y, z, 1, 3);
|
||||
if(meta == 1) world.setBlockMetadataWithNotify(x, y, z, 0, 3);
|
||||
if(meta == 2) world.setBlockMetadataWithNotify(x, y, z, 3, 3);
|
||||
if(meta == 3) world.setBlockMetadataWithNotify(x, y, z, 2, 3);
|
||||
if(meta == 4) world.setBlockMetadataWithNotify(x, y, z, 5, 3);
|
||||
if(meta == 5) world.setBlockMetadataWithNotify(x, y, z, 4, 3);
|
||||
|
||||
return true;
|
||||
if(meta == 0) world.setBlockMetadataWithNotify(x, y, z, 1, 3);
|
||||
if(meta == 1) world.setBlockMetadataWithNotify(x, y, z, 0, 3);
|
||||
if(meta == 2) world.setBlockMetadataWithNotify(x, y, z, 3, 3);
|
||||
if(meta == 3) world.setBlockMetadataWithNotify(x, y, z, 2, 3);
|
||||
if(meta == 4) world.setBlockMetadataWithNotify(x, y, z, 5, 3);
|
||||
if(meta == 5) world.setBlockMetadataWithNotify(x, y, z, 4, 3);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if(tool == ToolType.HAND_DRILL) {
|
||||
TileEntityFan tile = (TileEntityFan) world.getTileEntity(x, y, z);
|
||||
|
||||
if(tile != null) {
|
||||
tile.falloff = !tile.falloff;
|
||||
tile.markDirty();
|
||||
|
||||
if(!world.isRemote) {
|
||||
PacketDispatcher.wrapper.sendTo(new PlayerInformPacket(ChatBuilder.start("").nextTranslation(this.getUnlocalizedName() + (tile.falloff ? ".falloffOn" : ".falloffOff")).color(EnumChatFormatting.GOLD).flush(), MainRegistry.proxy.ID_FAN_MODE), (EntityPlayerMP) player);
|
||||
|
||||
world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, "random.click", 0.5F, 0.5F);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -6,7 +6,8 @@ import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.items.machine.IItemFluidIdentifier;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.oil.TileEntityMachineFractionTower;
|
||||
import com.hbm.util.I18nUtil;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
@ -15,7 +15,7 @@ import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.IItemFluidIdentifier;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityHeatBoiler;
|
||||
import com.hbm.util.I18nUtil;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
||||
@ -9,7 +9,8 @@ import com.hbm.inventory.fluid.trait.FT_Heatable.HeatingType;
|
||||
import com.hbm.items.machine.IItemFluidIdentifier;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityHeatBoilerIndustrial;
|
||||
import com.hbm.util.I18nUtil;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@ -11,7 +11,7 @@ import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.items.machine.IItemFluidIdentifier;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineHephaestus;
|
||||
import com.hbm.util.I18nUtil;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
@ -9,8 +9,9 @@ import com.hbm.lib.RefStrings;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.tileentity.machine.TileEntityICFController;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.I18nUtil;
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
@ -6,7 +6,7 @@ import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.machine.TileEntityICFPress;
|
||||
import com.hbm.util.I18nUtil;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
@ -8,7 +8,7 @@ import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineIntake;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.I18nUtil;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
54
src/main/java/com/hbm/blocks/machine/MachinePUREX.java
Normal file
54
src/main/java/com/hbm/blocks/machine/MachinePUREX.java
Normal file
@ -0,0 +1,54 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityMachinePUREX;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class MachinePUREX extends BlockDummyable implements ITooltipProvider {
|
||||
|
||||
public MachinePUREX(Material mat) {
|
||||
super(mat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
if(meta >= 12) return new TileEntityMachinePUREX();
|
||||
if(meta >= 6) return new TileEntityProxyCombo().inventory().power().fluid();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
return this.standardOpenBehavior(world, x, y, z, player, 0);
|
||||
}
|
||||
|
||||
@Override public int[] getDimensions() { return new int[] {4, 0, 2, 2, 2, 2}; }
|
||||
@Override public int getOffset() { return 2; }
|
||||
|
||||
@Override
|
||||
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
super.fillSpace(world, x, y, z, dir, o);
|
||||
|
||||
x += dir.offsetX * o;
|
||||
z += dir.offsetZ * o;
|
||||
|
||||
for(int i = -2; i <= 2; i++) for(int j = -2; j <= 2; j++) {
|
||||
if(Math.abs(i) == 2 || Math.abs(j) == 2) this.makeExtra(world, x + i, y, z + j);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
|
||||
this.addStandardInfo(stack, player, list, ext);
|
||||
}
|
||||
}
|
||||
@ -1,105 +1,64 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityMachinePress;
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
|
||||
import api.hbm.block.IToolable;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class MachinePress extends BlockContainer {
|
||||
|
||||
private final Random field_149933_a = new Random();
|
||||
private static boolean keepInventory;
|
||||
public class MachinePress extends BlockDummyable implements IToolable {
|
||||
|
||||
public MachinePress(Material p_i45386_1_) {
|
||||
super(p_i45386_1_);
|
||||
public MachinePress(Material mat) {
|
||||
super(mat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileEntityMachinePress();
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
if(meta >= 12) return new TileEntityMachinePress();
|
||||
if(meta >= 6) return new TileEntityProxyCombo(true, false, false);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return -1;
|
||||
public int[] getDimensions() {
|
||||
return new int[] {2, 0, 0, 0, 0, 0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
public int getOffset() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) {
|
||||
if(!keepInventory) {
|
||||
TileEntityMachinePress tileentityfurnace = (TileEntityMachinePress) p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_);
|
||||
|
||||
if(tileentityfurnace != null) {
|
||||
for(int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1) {
|
||||
ItemStack itemstack = tileentityfurnace.getStackInSlot(i1);
|
||||
|
||||
if(itemstack != null) {
|
||||
float f = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
while(itemstack.stackSize > 0) {
|
||||
int j1 = this.field_149933_a.nextInt(21) + 10;
|
||||
|
||||
if(j1 > itemstack.stackSize) {
|
||||
j1 = itemstack.stackSize;
|
||||
}
|
||||
|
||||
itemstack.stackSize -= j1;
|
||||
EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1, p_149749_4_ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));
|
||||
|
||||
if(itemstack.hasTagCompound()) {
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float) this.field_149933_a.nextGaussian() * f3;
|
||||
entityitem.motionY = (float) this.field_149933_a.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float) this.field_149933_a.nextGaussian() * f3;
|
||||
p_149749_1_.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
p_149749_1_.func_147453_f(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_);
|
||||
}
|
||||
}
|
||||
|
||||
super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_);
|
||||
protected boolean isLegacyMonoblock(World world, int x, int y, int z) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
return te != null && te instanceof TileEntityMachinePress;
|
||||
}
|
||||
|
||||
@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()) {
|
||||
TileEntityMachinePress entity = (TileEntityMachinePress) world.getTileEntity(x, y, z);
|
||||
if(entity != null) {
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return this.standardOpenBehavior(world, x, y, z, player, 0);
|
||||
}
|
||||
|
||||
// Un-multiblickable with a hand drill for schenanigans
|
||||
@Override
|
||||
public boolean onScrew(World world, EntityPlayer player, int x, int y, int z, int side, float fX, float fY, float fZ, ToolType tool) {
|
||||
|
||||
if (tool != ToolType.HAND_DRILL)
|
||||
return false;
|
||||
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta >= 12)
|
||||
return false;
|
||||
|
||||
safeRem = true;
|
||||
world.setBlockToAir(x, y, z);
|
||||
safeRem = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -13,7 +13,7 @@ import com.hbm.tileentity.machine.TileEntityMachinePumpBase;
|
||||
import com.hbm.tileentity.machine.TileEntityMachinePumpElectric;
|
||||
import com.hbm.tileentity.machine.TileEntityMachinePumpSteam;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.I18nUtil;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
@ -1,15 +1,22 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineRotaryFurnace;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class MachineRotaryFurnace extends BlockDummyable {
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MachineRotaryFurnace extends BlockDummyable implements ILookOverlay {
|
||||
|
||||
public MachineRotaryFurnace(Material mat) {
|
||||
super(mat);
|
||||
@ -56,4 +63,54 @@ public class MachineRotaryFurnace extends BlockDummyable {
|
||||
//solid fuel
|
||||
this.makeExtra(world, x + dir.offsetX + rot.offsetX, y, z + dir.offsetZ + rot.offsetZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printHook(RenderGameOverlayEvent.Pre event, World world, int x, int y, int z) {
|
||||
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
|
||||
if(pos == null) return;
|
||||
|
||||
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
|
||||
if(!(te instanceof TileEntityMachineRotaryFurnace)) return;
|
||||
|
||||
TileEntityMachineRotaryFurnace furnace = (TileEntityMachineRotaryFurnace) te;
|
||||
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(furnace.getBlockMetadata() - offset);
|
||||
|
||||
List<String> text = new ArrayList<>();
|
||||
|
||||
//steam
|
||||
if(hitCheck(dir, pos[0], pos[1], pos[2], -1, -1, 0, x, y, z) || hitCheck(dir, pos[0], pos[1], pos[2], -1, -2, 0, x, y, z)) {
|
||||
text.add(EnumChatFormatting.GREEN + "-> " + EnumChatFormatting.RESET + furnace.tanks[1].getTankType().getLocalizedName());
|
||||
text.add(EnumChatFormatting.RED + "<- " + EnumChatFormatting.RESET + furnace.tanks[2].getTankType().getLocalizedName());
|
||||
}
|
||||
|
||||
//fluids
|
||||
if(hitCheck(dir, pos[0], pos[1], pos[2], 1, 2, 0, x, y, z) || hitCheck(dir, pos[0], pos[1], pos[2], -1, 2, 0, x, y, z)) {
|
||||
text.add(EnumChatFormatting.GREEN + "-> " + EnumChatFormatting.RESET + furnace.tanks[0].getTankType().getLocalizedName());
|
||||
}
|
||||
|
||||
if(hitCheck(dir, pos[0], pos[1], pos[2], 1, 1, 0, x, y, z)) {
|
||||
text.add(EnumChatFormatting.YELLOW + "-> " + EnumChatFormatting.RESET + "Fuel");
|
||||
}
|
||||
|
||||
|
||||
if(!text.isEmpty()) {
|
||||
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean hitCheck(ForgeDirection dir, int coreX, int coreY, int coreZ, int exDir, int exRot, int exY, int hitX, int hitY, int hitZ) {
|
||||
|
||||
ForgeDirection turn = dir.getRotation(ForgeDirection.DOWN);
|
||||
|
||||
int iX = coreX + dir.offsetX * exDir + turn.offsetX * exRot;
|
||||
int iY = coreY + exY;
|
||||
int iZ = coreZ + dir.offsetZ * exDir + turn.offsetZ * exRot;
|
||||
|
||||
return iX == hitX && iZ == hitZ && iY == hitY;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user