mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Merge branch 'master' into forestpost
This commit is contained in:
commit
6215b32f4d
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:
|
||||
|
||||
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 {
|
||||
|
||||
57
changelog
57
changelog
@ -1,48 +1,15 @@
|
||||
## Added
|
||||
* New chemical factory
|
||||
* New form factor, uses a smaller 5x5 footprint
|
||||
* Only does four recipes instead of eight
|
||||
* Double base speed, but also double power draw
|
||||
* Three upgrade slots, upgrades follow the same rules as on the new chemplant
|
||||
* Upgrades stack with the double base speed
|
||||
* Stackable!
|
||||
* Water consumption rate is fixed at 100mB/t for each active recipe
|
||||
* Has a dedicated coolant line, so that the coolant water doesn't get used up by recipes
|
||||
* Coolant line has a tooltip which should make it clear that the machine uses water and produces LPS
|
||||
* Also has sound, unlike the old chemical factory
|
||||
* Output fluids are now automatically sent to input tanks, at a rate of up to 50mB/t for somewhat fair fluid sharing
|
||||
* This means that a chemical factory can make hydrogen peroxide, sulfuric acid and nitric acid, and the only fluid input needed is water
|
||||
|
||||
## Changed
|
||||
* The DNT suit now has a damage threshold of 1,000
|
||||
* Compressed biomass now has a nice cube shape
|
||||
* The new chemical plant's indicator lights are now functional
|
||||
* The new chemical plant can now use upgrades
|
||||
* Reeds now drop sticks when broken
|
||||
* Switching the recipe in the new chemplant now annihilates residual fluid that is not overwritten by the new recipe
|
||||
* I don't know why people wanted this, but here you go
|
||||
* The alternate recipe for oxyhydrogen now uses compressed air instead of nothing
|
||||
* Improved threaded Mk5, should be a smidge faster now
|
||||
* Spires no longer progress phases on peaceful difficulty
|
||||
* Spires now have a 20% chance of coming with instructions
|
||||
* New chemical plant now has sound
|
||||
* Old chemical plant and factory have been renamed and their recipes removed
|
||||
* The new recipe selector no longer changes recipe instantly on click, rather as soon as the selector GUI is closed. This should prevent issues when misclicking, which would destroy buffered fluids
|
||||
* The memespoon is now safe(tm)
|
||||
* Instead of using a bugged instakill implementation, a fall distance of >2 now deals 50 extra melee damage
|
||||
* Instead of blowing up like a nuke with a fall distance of >20, it now explodes similarly to a non-HE artillery grenade. This deals 150 damage in an AoE, has armor piercing properties and is, like the original functionality, still lethal to the user
|
||||
* Updated ukrainian, chinese and russian localization, including QMAW
|
||||
* Some previously hardcoded lang strings are now affected by translations
|
||||
* 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
|
||||
* Chemical plant ports. For real this time.
|
||||
* Fixed cable and pipe gauges returning the incomplete delta second value for OC and ROR readers
|
||||
* Fixed new chemical plant not saving power values to disk
|
||||
* Fixed laser rifle scope texture being missing
|
||||
* Potentially fixed shift clicking issue with the new chemical plant
|
||||
* Fixed blowtorch having a minimum gas requirement of 1,000mB despite only using 250mB
|
||||
* The gas turbine now uses audio with a 20 tick timeout, fixing a rare issue where the loop gets stuck and never ends
|
||||
* Potentially fixed a dupe caused by using InventoryBogoSorter in combination with crates
|
||||
* Rapidly spinning dyx should no longer have a state leak that would rotate lighting of unrelated TESRs with it
|
||||
* Fixed issue where mining strange stone with silk touch ability would cause a desync. It also now drops cobblestone, as if silk touch wasn't active at all
|
||||
* Fixed issue where applying a filter to a mask that doesn't support certain protection types would permanently remove those types from the filter until the game is restarted
|
||||
* Fixed InventoryBogoSorter being able to move held crates
|
||||
* Fixed tier 2 pickaxes mining depth rock causing a desync with the depth rock not actually being broken
|
||||
* 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,6 +1,6 @@
|
||||
mod_version=1.0.27
|
||||
# Empty build number makes a release type
|
||||
mod_build_number=5357
|
||||
mod_build_number=5426
|
||||
|
||||
credits=HbMinecraft,\
|
||||
\ rodolphito (explosion algorithms),\
|
||||
|
||||
@ -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;
|
||||
@ -37,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);
|
||||
@ -77,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;
|
||||
|
||||
@ -110,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) {
|
||||
@ -550,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]);
|
||||
@ -575,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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -314,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;
|
||||
@ -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,6 +791,7 @@ 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;
|
||||
@ -802,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;
|
||||
@ -827,6 +829,7 @@ public class ModBlocks {
|
||||
public static Block drone_crate_requester;
|
||||
|
||||
public static Block pneumatic_tube;
|
||||
public static Block pneumatic_tube_paintable;
|
||||
|
||||
public static Block fan;
|
||||
|
||||
@ -845,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;
|
||||
@ -999,16 +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;
|
||||
|
||||
@Deprecated public static Block machine_chemplant;
|
||||
public static Block machine_chemical_plant;
|
||||
public static Block machine_chemfac;
|
||||
@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;
|
||||
@ -1115,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;
|
||||
@ -1239,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();
|
||||
|
||||
@ -1514,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");
|
||||
@ -1811,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");
|
||||
|
||||
@ -1863,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");
|
||||
|
||||
@ -1920,6 +1931,7 @@ 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);
|
||||
@ -1959,6 +1971,7 @@ public class ModBlocks {
|
||||
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");
|
||||
|
||||
@ -1973,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");
|
||||
@ -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");
|
||||
@ -2221,14 +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_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(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");
|
||||
@ -2329,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");
|
||||
|
||||
@ -2388,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() {
|
||||
@ -2678,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());
|
||||
@ -2685,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());
|
||||
@ -3159,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);
|
||||
@ -3187,6 +3217,7 @@ 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);
|
||||
@ -3222,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);
|
||||
|
||||
@ -3236,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);
|
||||
@ -3261,15 +3294,15 @@ public class ModBlocks {
|
||||
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());
|
||||
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);
|
||||
@ -3514,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());
|
||||
@ -3531,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) {
|
||||
|
||||
@ -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() {
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@ -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);
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -18,7 +18,7 @@ import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import com.hbm.util.BufferUtil;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
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.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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -17,7 +17,7 @@ import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import com.hbm.util.BufferUtil;
|
||||
import com.hbm.util.LootGenerator;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
import com.hbm.world.gen.INBTTileEntityTransformable;
|
||||
import com.hbm.world.gen.nbt.INBTTileEntityTransformable;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import 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; }
|
||||
}
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
@ -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);
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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;
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -4,6 +4,7 @@ import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.blocks.machine.BlockPWR.TileEntityBlockPWR;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
@ -55,7 +56,7 @@ public class MachinePWRController extends BlockContainer implements ITooltipProv
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
return metadata == 0 && side == 3 ? this.iconFront : (side == metadata ? this.iconFront : this.blockIcon);
|
||||
return metadata == 0 && side != 0 && side != 1 ? this.iconFront : (side == metadata ? this.iconFront : this.blockIcon);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -80,6 +81,7 @@ public class MachinePWRController extends BlockContainer implements ITooltipProv
|
||||
if(!controller.assembled) {
|
||||
assemble(world, x, y, z, player);
|
||||
} else {
|
||||
if(player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.pwr_printer) return false;
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z);
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -282,8 +282,6 @@ public class PistonInserter extends BlockContainerBase implements ITooltipProvid
|
||||
if(this.slot != null) {
|
||||
BufferUtil.writeNBT(buf, slot.stackTagCompound);
|
||||
}
|
||||
|
||||
this.turnProgress = 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -7,13 +7,14 @@ import java.util.Random;
|
||||
import com.hbm.blocks.BlockEnums.LightType;
|
||||
import com.hbm.blocks.ISpotlight;
|
||||
import com.hbm.main.ResourceManager;
|
||||
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;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockSlab;
|
||||
import net.minecraft.block.material.MapColor;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
@ -25,7 +26,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.obj.WavefrontObject;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class Spotlight extends Block implements ISpotlight, INBTTransformable {
|
||||
public class Spotlight extends Block implements ISpotlight, INBTBlockTransformable {
|
||||
|
||||
public static boolean disableOnGeneration = true;
|
||||
|
||||
@ -44,7 +45,7 @@ public class Spotlight extends Block implements ISpotlight, INBTTransformable {
|
||||
this.type = type;
|
||||
this.isOn = isOn;
|
||||
|
||||
this.setHardness(1F);
|
||||
this.setHardness(0.5F);
|
||||
|
||||
if(isOn) setLightLevel(1.0F);
|
||||
}
|
||||
@ -81,6 +82,17 @@ public class Spotlight extends Block implements ISpotlight, INBTTransformable {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
// Ah yes, I love methods named the literal opposite of what they do
|
||||
public boolean getBlocksMovement(IBlockAccess world, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapColor getMapColor(int meta) {
|
||||
return MapColor.airColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) {
|
||||
return null;
|
||||
@ -355,7 +367,7 @@ public class Spotlight extends Block implements ISpotlight, INBTTransformable {
|
||||
public int transformMeta(int meta, int coordBaseMode) {
|
||||
// +1 to set as broken, won't turn on until broken and replaced
|
||||
int disabled = disableOnGeneration ? 1 : 0;
|
||||
return (INBTTransformable.transformMetaDeco(meta >> 1, coordBaseMode) << 1) + disabled;
|
||||
return (INBTBlockTransformable.transformMetaDeco(meta >> 1, coordBaseMode) << 1) + disabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -0,0 +1,42 @@
|
||||
package com.hbm.blocks.machine.rbmk;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKAutoloader;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class RBMKAutoloader extends BlockDummyable {
|
||||
|
||||
public RBMKAutoloader() {
|
||||
super(Material.iron);
|
||||
|
||||
this.bounding.add(AxisAlignedBB.getBoundingBox(-0.125, 0, -0.125, 0.125, 4, 0.125));
|
||||
this.bounding.add(AxisAlignedBB.getBoundingBox(-0.5, 4, -0.5, 0.5, 9, 0.5));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
if(meta >= 12) return new TileEntityRBMKAutoloader();
|
||||
return new TileEntityProxyCombo().inventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getDimensions() {
|
||||
return new int[] {8, 0, 0, 0, 0, 0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOffset() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
return this.standardOpenBehavior(world, x, y, z, player, 0);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,344 @@
|
||||
package com.hbm.blocks.network;
|
||||
|
||||
import api.hbm.block.IToolable;
|
||||
import com.hbm.blocks.IBlockMultiPass;
|
||||
import com.hbm.interfaces.ICopiable;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.render.block.RenderBlockMultipass;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import li.cil.oc.api.network.Environment;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import li.cil.oc.api.network.Message;
|
||||
import li.cil.oc.api.network.Node;
|
||||
import li.cil.oc.api.Network;
|
||||
import li.cil.oc.api.network.Visibility;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import li.cil.oc.api.network.SidedEnvironment;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import li.cil.oc.api.internal.Colored;
|
||||
import com.hbm.handler.CompatHandler.OCColors;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class BlockOpenComputersCablePaintable extends BlockContainer implements IToolable, IBlockMultiPass {
|
||||
|
||||
@SideOnly(Side.CLIENT) protected IIcon overlay;
|
||||
@SideOnly(Side.CLIENT) protected IIcon overlayColor;
|
||||
|
||||
public BlockOpenComputersCablePaintable() {
|
||||
super(Material.iron);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityOpenComputersCablePaintable();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister reg) {
|
||||
this.blockIcon = reg.registerIcon(RefStrings.MODID + ":oc_cable_base");
|
||||
this.overlay = reg.registerIcon(RefStrings.MODID + ":oc_cable_overlay");
|
||||
this.overlayColor = reg.registerIcon(RefStrings.MODID + ":oc_cable_color");
|
||||
}
|
||||
|
||||
@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 TileEntityOpenComputersCablePaintable) {
|
||||
TileEntityOpenComputersCablePaintable pipe = (TileEntityOpenComputersCablePaintable) tile;
|
||||
|
||||
if(pipe.block != null) {
|
||||
if(RenderBlockMultipass.currentPass == 1) {
|
||||
return this.overlay;
|
||||
} else if(RenderBlockMultipass.currentPass == 2) {
|
||||
return this.overlayColor;
|
||||
} else {
|
||||
return pipe.block.getIcon(side, pipe.meta);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return RenderBlockMultipass.currentPass == 1 ? this.overlay : RenderBlockMultipass.currentPass == 2 ? this.overlayColor : this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
|
||||
if (RenderBlockMultipass.currentPass == 2) {
|
||||
TileEntityOpenComputersCablePaintable tile = (TileEntityOpenComputersCablePaintable) world.getTileEntity(x, y, z);
|
||||
if (tile == null)
|
||||
return 0xffffff;
|
||||
|
||||
return tile.getColor();
|
||||
}
|
||||
|
||||
return 0xffffff;
|
||||
}
|
||||
|
||||
@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)
|
||||
return super.onBlockActivated(world, x, y, z, player, side, fX, fY, fZ);
|
||||
|
||||
if (stack.getItem() instanceof ItemBlock) {
|
||||
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 TileEntityOpenComputersCablePaintable) {
|
||||
TileEntityOpenComputersCablePaintable pipe = (TileEntityOpenComputersCablePaintable) tile;
|
||||
|
||||
if(pipe.block == null) {
|
||||
pipe.block = block;
|
||||
pipe.meta = stack.getItemDamage() & 15;
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
pipe.markDirty();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
boolean isDye = false;
|
||||
int[] dicts = OreDictionary.getOreIDs(stack);
|
||||
for (int dict : dicts) {
|
||||
String dictName = OreDictionary.getOreName(dict);
|
||||
if (dictName.equals("dye"))
|
||||
isDye = true;
|
||||
}
|
||||
|
||||
if (isDye) {
|
||||
TileEntityOpenComputersCablePaintable tile = (TileEntityOpenComputersCablePaintable) world.getTileEntity(x, y, z);
|
||||
tile.setColor(OCColors.fromDye(stack).getColor());
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
tile.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
|
||||
if(tool != ToolType.SCREWDRIVER) return false;
|
||||
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if(tile instanceof TileEntityOpenComputersCablePaintable) {
|
||||
TileEntityOpenComputersCablePaintable pipe = (TileEntityOpenComputersCablePaintable) tile;
|
||||
|
||||
if(pipe.block != null) {
|
||||
pipe.block = null;
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
pipe.markDirty();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPasses() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType(){
|
||||
return IBlockMultiPass.getRenderType();
|
||||
}
|
||||
|
||||
@Optional.InterfaceList({
|
||||
@Optional.Interface(iface = "li.cil.oc.api.network.Environment", modid = "OpenComputers"),
|
||||
@Optional.Interface(iface = "li.cil.oc.api.network.SidedEnvironment", modid = "OpenComputers"),
|
||||
@Optional.Interface(iface = "li.cil.oc.api.network.Colored", modid = "OpenComputers")
|
||||
})
|
||||
public static class TileEntityOpenComputersCablePaintable extends TileEntityLoadedBase implements Environment, SidedEnvironment, Colored, ICopiable {
|
||||
|
||||
protected Node node;
|
||||
protected boolean addedToNetwork = false;
|
||||
|
||||
private Block block;
|
||||
private int meta;
|
||||
private Block lastBlock;
|
||||
private int lastMeta;
|
||||
private OCColors color = OCColors.LIGHTGRAY;
|
||||
|
||||
public TileEntityOpenComputersCablePaintable() {
|
||||
node = Network.newNode(this, Visibility.None).create();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
|
||||
if(worldObj.isRemote && (lastBlock != block || lastMeta != meta)) {
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
lastBlock = block;
|
||||
lastMeta = meta;
|
||||
}
|
||||
|
||||
if(!this.getWorldObj().isRemote && !addedToNetwork) {
|
||||
addedToNetwork = true;
|
||||
Network.joinOrCreateNetwork(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
this.writeToNBT(nbt);
|
||||
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbt);
|
||||
}
|
||||
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||
this.readFromNBT(pkt.func_148857_g());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
int id = nbt.getInteger("block");
|
||||
this.block = id == 0 ? null : Block.getBlockById(id);
|
||||
this.meta = nbt.getInteger("meta");
|
||||
|
||||
this.color = OCColors.fromInt(nbt.getInteger("dyeColor"));
|
||||
|
||||
if (node != null && node.host() == this) {
|
||||
node.load(nbt.getCompoundTag("oc:node"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
if(block != null) nbt.setInteger("block", Block.getIdFromBlock(block));
|
||||
nbt.setInteger("meta", meta);
|
||||
|
||||
nbt.setInteger("dyeColor", color.getColor());
|
||||
|
||||
if (node != null && node.host() == this) {
|
||||
final NBTTagCompound nodeNbt = new NBTTagCompound();
|
||||
node.save(nodeNbt);
|
||||
nbt.setTag("oc:node", nodeNbt);
|
||||
}
|
||||
}
|
||||
|
||||
public NBTTagCompound getSettings(World world, int x, int y, int z) {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
if(block != null) {
|
||||
nbt.setInteger("paintblock", Block.getIdFromBlock(block));
|
||||
nbt.setInteger("paintmeta", meta);
|
||||
}
|
||||
return nbt;
|
||||
}
|
||||
|
||||
public void pasteSettings(NBTTagCompound nbt, int index, World world, EntityPlayer player, int x, int y, int z) {
|
||||
if(nbt.hasKey("paintblock")) {
|
||||
this.block = Block.getBlockById(nbt.getInteger("paintblock"));
|
||||
this.meta = nbt.getInteger("paintmeta");
|
||||
this.color = OCColors.fromInt(nbt.getInteger("dyeColor"));
|
||||
}
|
||||
}
|
||||
|
||||
// OC Cable Things
|
||||
@Override
|
||||
public Node node() {
|
||||
return node;
|
||||
}
|
||||
|
||||
public Node sidedNode(ForgeDirection side) {
|
||||
if (side == ForgeDirection.UNKNOWN)
|
||||
return null;
|
||||
|
||||
int neighborX = super.xCoord + side.offsetX;
|
||||
int neighborY = super.yCoord + side.offsetY;
|
||||
int neighborZ = super.zCoord + side.offsetZ;
|
||||
TileEntity neighbor = worldObj.getTileEntity(neighborX, neighborY, neighborZ);
|
||||
|
||||
// If a cable does not support colors but is a valid cable block, allow it to connect regardless of color.
|
||||
if (!(neighbor instanceof Colored)) {
|
||||
if (neighbor instanceof Environment)
|
||||
return node;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
Colored cable = (Colored) neighbor;
|
||||
if (cable.getColor() == color.getColor())
|
||||
return node;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnect(Node node) {}
|
||||
|
||||
@Override
|
||||
public void onDisconnect(Node node) {}
|
||||
|
||||
@Override
|
||||
public void onMessage(Message message) {}
|
||||
|
||||
@Override
|
||||
public void onChunkUnload() {
|
||||
super.onChunkUnload();
|
||||
if (node != null) node.remove();
|
||||
}
|
||||
|
||||
public void invalidate() {
|
||||
super.invalidate();
|
||||
if (node != null) node.remove();
|
||||
}
|
||||
|
||||
public boolean canConnect(net.minecraftforge.common.util.ForgeDirection side) {
|
||||
if (side == ForgeDirection.UNKNOWN)
|
||||
return false;
|
||||
|
||||
int neighborX = super.xCoord + side.offsetX;
|
||||
int neighborY = super.yCoord + side.offsetY;
|
||||
int neighborZ = super.zCoord + side.offsetZ;
|
||||
TileEntity neighbor = worldObj.getTileEntity(neighborX, neighborY, neighborZ);
|
||||
|
||||
// If a cable does not support colors but is a valid cable block, allow it to connect regardless of color.
|
||||
if (!(neighbor instanceof Colored)) {
|
||||
return neighbor instanceof Environment;
|
||||
}
|
||||
|
||||
Colored cable = (Colored) neighbor;
|
||||
return cable.getColor() == color.getColor();
|
||||
}
|
||||
|
||||
public void setColor(int newColor) {
|
||||
color = OCColors.fromInt(newColor);
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return color.getColor();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -68,17 +68,19 @@ public class CraneInserter extends BlockCraneBase implements IEnterableBlock {
|
||||
|
||||
ItemStack toAdd = entity.getItemStack().copy();
|
||||
|
||||
int[] access = null;
|
||||
if (!world.isBlockIndirectlyGettingPowered(x, y, z)) {
|
||||
int[] access = null;
|
||||
|
||||
if(te instanceof ISidedInventory) {
|
||||
ISidedInventory sided = (ISidedInventory) te;
|
||||
access = InventoryUtil.masquerade(sided, outputDirection.getOpposite().ordinal());
|
||||
}
|
||||
if(te instanceof ISidedInventory) {
|
||||
ISidedInventory sided = (ISidedInventory) te;
|
||||
access = InventoryUtil.masquerade(sided, outputDirection.getOpposite().ordinal());
|
||||
}
|
||||
|
||||
if(te instanceof IInventory) {
|
||||
IInventory inv = (IInventory) te;
|
||||
if(te instanceof IInventory) {
|
||||
IInventory inv = (IInventory) te;
|
||||
|
||||
addToInventory(inv, access, toAdd, outputDirection.getOpposite().ordinal());
|
||||
addToInventory(inv, access, toAdd, outputDirection.getOpposite().ordinal());
|
||||
}
|
||||
}
|
||||
|
||||
TileEntityCraneInserter inserter = null;
|
||||
|
||||
@ -0,0 +1,208 @@
|
||||
package com.hbm.blocks.network;
|
||||
|
||||
import api.hbm.block.IToolable;
|
||||
|
||||
import com.hbm.blocks.IBlockMultiPass;
|
||||
import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.interfaces.ICopiable;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.render.block.RenderBlockMultipass;
|
||||
import com.hbm.tileentity.network.TileEntityPipeExhaust;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class FluidDuctPaintableBlockExhaust extends FluidDuctBase implements IToolable, IBlockMultiPass, ILookOverlay {
|
||||
|
||||
@SideOnly(Side.CLIENT) protected IIcon overlay;
|
||||
|
||||
public FluidDuctPaintableBlockExhaust() {
|
||||
super(Material.iron);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityPipeExhaustPaintable();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister reg) {
|
||||
this.blockIcon = reg.registerIcon(RefStrings.MODID + ":fluid_duct_paintable_block_exhaust");
|
||||
this.overlay = reg.registerIcon(RefStrings.MODID + ":fluid_duct_paintable_overlay");
|
||||
}
|
||||
|
||||
@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 TileEntityPipeExhaustPaintable) {
|
||||
TileEntityPipeExhaustPaintable pipe = (TileEntityPipeExhaustPaintable) tile;
|
||||
|
||||
if(pipe.block != null) {
|
||||
if(RenderBlockMultipass.currentPass == 1) {
|
||||
return this.overlay;
|
||||
} else {
|
||||
return pipe.block.getIcon(side, pipe.meta);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@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 tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if(tile instanceof TileEntityPipeExhaustPaintable) {
|
||||
TileEntityPipeExhaustPaintable pipe = (TileEntityPipeExhaustPaintable) tile;
|
||||
|
||||
if(pipe.block != null) {
|
||||
pipe.block = null;
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
pipe.markDirty();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@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) {
|
||||
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 TileEntityPipeExhaustPaintable) {
|
||||
TileEntityPipeExhaustPaintable pipe = (TileEntityPipeExhaustPaintable) tile;
|
||||
|
||||
if(pipe.block == null) {
|
||||
pipe.block = block;
|
||||
pipe.meta = stack.getItemDamage() & 15;
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
pipe.markDirty();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return super.onBlockActivated(world, x, y, z, player, side, fX, fY, fZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPasses() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType(){
|
||||
return IBlockMultiPass.getRenderType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printHook(Pre event, World world, int x, int y, int z) {
|
||||
List<String> text = new ArrayList();
|
||||
text.add(Fluids.SMOKE.getLocalizedName());
|
||||
text.add(Fluids.SMOKE_LEADED.getLocalizedName());
|
||||
text.add(Fluids.SMOKE_POISON.getLocalizedName());
|
||||
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
||||
}
|
||||
|
||||
public static class TileEntityPipeExhaustPaintable extends TileEntityPipeExhaust implements ICopiable {
|
||||
|
||||
private Block block;
|
||||
private int meta;
|
||||
private Block lastBlock;
|
||||
private int lastMeta;
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
|
||||
if(worldObj.isRemote && (lastBlock != block || lastMeta != meta)) {
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
lastBlock = block;
|
||||
lastMeta = meta;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
this.writeToNBT(nbt);
|
||||
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||
this.readFromNBT(pkt.func_148857_g());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
int id = nbt.getInteger("block");
|
||||
this.block = id == 0 ? null : Block.getBlockById(id);
|
||||
this.meta = nbt.getInteger("meta");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
if(block != null) nbt.setInteger("block", Block.getIdFromBlock(block));
|
||||
nbt.setInteger("meta", meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getSettings(World world, int x, int y, int z) {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
if(block != null) {
|
||||
nbt.setInteger("paintblock", Block.getIdFromBlock(block));
|
||||
nbt.setInteger("paintmeta", meta);
|
||||
}
|
||||
return nbt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pasteSettings(NBTTagCompound nbt, int index, World world, EntityPlayer player, int x, int y, int z) {
|
||||
if(nbt.hasKey("paintblock")) {
|
||||
this.block = Block.getBlockById(nbt.getInteger("paintblock"));
|
||||
this.meta = nbt.getInteger("paintmeta");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3,6 +3,12 @@ package com.hbm.blocks.network;
|
||||
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;
|
||||
@ -19,7 +25,7 @@ import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.EnumUtil;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
import com.hbm.world.gen.INBTTransformable;
|
||||
import com.hbm.world.gen.nbt.INBTBlockTransformable;
|
||||
|
||||
import api.hbm.energymk2.IEnergyReceiverMK2.ConnectionPriority;
|
||||
import api.hbm.fluidmk2.IFluidStandardTransceiverMK2;
|
||||
@ -49,7 +55,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class FluidPump extends BlockContainer implements INBTTransformable, ILookOverlay, IGUIProvider {
|
||||
public class FluidPump extends BlockContainer implements INBTBlockTransformable, ILookOverlay, IGUIProvider {
|
||||
|
||||
public FluidPump(Material mat) {
|
||||
super(mat);
|
||||
@ -93,7 +99,7 @@ public class FluidPump extends BlockContainer implements INBTTransformable, ILoo
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(world.isRemote) FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
@ -121,42 +127,43 @@ public class FluidPump extends BlockContainer implements INBTTransformable, ILoo
|
||||
|
||||
@Override
|
||||
public int transformMeta(int meta, int coordBaseMode) {
|
||||
return INBTTransformable.transformMetaDeco(meta, coordBaseMode);
|
||||
return INBTBlockTransformable.transformMetaDeco(meta, coordBaseMode);
|
||||
}
|
||||
|
||||
public static class TileEntityFluidPump extends TileEntityLoadedBase implements IFluidStandardTransceiverMK2, IControlReceiver {
|
||||
|
||||
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||
public static class TileEntityFluidPump extends TileEntityLoadedBase implements IFluidStandardTransceiverMK2, IControlReceiver, SimpleComponent, CompatHandler.OCComponent {
|
||||
|
||||
public int bufferSize = 100;
|
||||
public FluidTank[] tank;
|
||||
public ConnectionPriority priority = ConnectionPriority.NORMAL;
|
||||
public boolean redstone = false;
|
||||
|
||||
|
||||
public TileEntityFluidPump() {
|
||||
this.tank = new FluidTank[1];
|
||||
this.tank[0] = new FluidTank(Fluids.NONE, bufferSize);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
|
||||
// if the capacity were changed directly, any excess buffered fluid would be destroyed
|
||||
// when running a closed loop or handling hard to get fluids, that's quite bad
|
||||
if(this.bufferSize != this.tank[0].getMaxFill()) {
|
||||
int nextBuffer = Math.max(this.tank[0].getFill(), this.bufferSize);
|
||||
this.tank[0].changeTankSize(nextBuffer);
|
||||
}
|
||||
|
||||
|
||||
this.redstone = worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord);
|
||||
|
||||
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata());
|
||||
ForgeDirection in = dir.getRotation(ForgeDirection.UP);
|
||||
ForgeDirection out = in.getOpposite();
|
||||
|
||||
|
||||
this.trySubscribe(tank[0].getTankType(), worldObj, xCoord + in.offsetX, yCoord, zCoord + in.offsetZ, in);
|
||||
if(!redstone) this.tryProvide(tank[0], worldObj, xCoord + out.offsetX, yCoord, zCoord + out.offsetZ, out);
|
||||
|
||||
|
||||
this.networkPackNT(15);
|
||||
}
|
||||
}
|
||||
@ -192,7 +199,7 @@ public class FluidPump extends BlockContainer implements INBTTransformable, ILoo
|
||||
priority = EnumUtil.grabEnumSafely(ConnectionPriority.class, buf.readByte());
|
||||
bufferSize = buf.readInt();
|
||||
}
|
||||
|
||||
|
||||
@Override public ConnectionPriority getFluidPriority() { return priority; }
|
||||
@Override public FluidTank[] getSendingTanks() { return redstone ? new FluidTank[0] : tank; }
|
||||
@Override public FluidTank[] getReceivingTanks() { return this.bufferSize < this.tank[0].getFill() ? new FluidTank[0] : tank; }
|
||||
@ -214,9 +221,130 @@ public class FluidPump extends BlockContainer implements INBTTransformable, ILoo
|
||||
if(data.hasKey("priority")) {
|
||||
priority = EnumUtil.grabEnumSafely(ConnectionPriority.class, data.getByte("priority"));
|
||||
}
|
||||
|
||||
|
||||
this.markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public String getComponentName() {
|
||||
return "ntm_fluid_pump";
|
||||
}
|
||||
|
||||
@Callback(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getFluid(Context context, Arguments args) {
|
||||
return new Object[] {
|
||||
tank[0].getTankType().getUnlocalizedName()
|
||||
};
|
||||
}
|
||||
|
||||
@Callback(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getPressure(Context context, Arguments args) {
|
||||
return new Object[] {
|
||||
tank[0].getPressure()
|
||||
};
|
||||
}
|
||||
|
||||
@Callback(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getFlow(Context context, Arguments args) {
|
||||
return new Object[] {
|
||||
bufferSize
|
||||
};
|
||||
}
|
||||
|
||||
@Callback(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getPriority(Context context, Arguments args) {
|
||||
return new Object[] {
|
||||
getFluidPriority()
|
||||
};
|
||||
}
|
||||
|
||||
@Callback(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getInfo(Context context, Arguments args) {
|
||||
return new Object[] {
|
||||
tank[0].getTankType().getUnlocalizedName(),
|
||||
tank[0].getPressure(),
|
||||
bufferSize,
|
||||
getFluidPriority()
|
||||
};
|
||||
}
|
||||
|
||||
@Callback(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] setPriority(Context context, Arguments args) {
|
||||
int num = args.checkInteger(0);
|
||||
switch (num) {
|
||||
case 0:
|
||||
priority = ConnectionPriority.LOWEST;
|
||||
break;
|
||||
case 1:
|
||||
priority = ConnectionPriority.LOW;
|
||||
break;
|
||||
case 2:
|
||||
priority = ConnectionPriority.NORMAL;
|
||||
break;
|
||||
case 3:
|
||||
priority = ConnectionPriority.HIGH;
|
||||
break;
|
||||
case 4:
|
||||
priority = ConnectionPriority.HIGHEST;
|
||||
break;
|
||||
default:
|
||||
return new Object[] {null, "Not a valid Priority."};
|
||||
}
|
||||
return new Object[] {true};
|
||||
}
|
||||
|
||||
@Callback(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] setFlow(Context context, Arguments args) {
|
||||
int input = args.checkInteger(0);
|
||||
if (input > 10000 || input < 0)
|
||||
return new Object[] {null, "Number outside of bounds."};
|
||||
bufferSize = input;
|
||||
return new Object[] {true};
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public String[] methods() {
|
||||
return new String[] {
|
||||
"getPriority",
|
||||
"getPressure",
|
||||
"getFluid",
|
||||
"getFlow",
|
||||
"getInfo",
|
||||
"setPriority",
|
||||
"setFlow"
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] invoke(String method, Context context, Arguments args) throws Exception {
|
||||
switch (method) {
|
||||
case ("getPriority"):
|
||||
return getPriority(context, args);
|
||||
case ("getPressure"):
|
||||
return getPressure(context, args);
|
||||
case ("getFluid"):
|
||||
return getFluid(context, args);
|
||||
case ("getFlow"):
|
||||
return getFlow(context, args);
|
||||
case ("getInfo"):
|
||||
return getInfo(context, args);
|
||||
case ("setPriority"):
|
||||
return setPriority(context, args);
|
||||
case ("setFlow"):
|
||||
return setFlow(context, args);
|
||||
}
|
||||
throw new NoSuchMethodException();
|
||||
}
|
||||
}
|
||||
|
||||
public static class GUIPump extends GuiScreen {
|
||||
@ -261,7 +389,7 @@ public class FluidPump extends BlockContainer implements INBTTransformable, ILoo
|
||||
|
||||
drawString(fontRendererObj, "Priority:", this.width / 2 + 50, 80, 0xA0A0A0);
|
||||
buttonPriority.drawButton(mc, mouseX, mouseY);
|
||||
|
||||
|
||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,234 @@
|
||||
package com.hbm.blocks.network;
|
||||
|
||||
import api.hbm.block.IToolable;
|
||||
import com.hbm.blocks.IBlockMultiPass;
|
||||
import com.hbm.interfaces.ICopiable;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.render.block.RenderBlockMultipass;
|
||||
import com.hbm.tileentity.network.TileEntityPneumoTube;
|
||||
import com.hbm.util.Compat;
|
||||
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.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class PneumoTubePaintableBlock extends BlockContainer implements IToolable, IBlockMultiPass {
|
||||
|
||||
@SideOnly(Side.CLIENT) public IIcon overlay;
|
||||
@SideOnly(Side.CLIENT) public IIcon overlayIn;
|
||||
@SideOnly(Side.CLIENT) public IIcon overlayOut;
|
||||
|
||||
public PneumoTubePaintableBlock() {super(Material.iron);}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {return new TileEntityPneumoTubePaintable();}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister reg) {
|
||||
this.blockIcon = reg.registerIcon(RefStrings.MODID + ":pneumatic_tube_paintable");
|
||||
this.overlay = reg.registerIcon(RefStrings.MODID + ":pneumatic_tube_paintable_overlay");
|
||||
this.overlayIn = reg.registerIcon(RefStrings.MODID + ":pneumatic_tube_paintable_overlay_in");
|
||||
this.overlayOut = reg.registerIcon(RefStrings.MODID + ":pneumatic_tube_paintable_overlay_out");
|
||||
}
|
||||
|
||||
@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 TileEntityPneumoTubePaintable) {
|
||||
TileEntityPneumoTubePaintable tube = (TileEntityPneumoTubePaintable) tile;
|
||||
|
||||
if (RenderBlockMultipass.currentPass == 0) {
|
||||
if (tube.block != null) {
|
||||
return tube.block.getIcon(side, tube.meta);
|
||||
} else {
|
||||
return this.blockIcon;
|
||||
}
|
||||
} else if (tube.ejectionDir.ordinal() == side) {
|
||||
return this.overlayIn;
|
||||
} else if (tube.insertionDir.ordinal() == side) {
|
||||
return this.overlayOut;
|
||||
} else {
|
||||
return this.overlay;
|
||||
}
|
||||
}
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPasses() {return 2;};
|
||||
|
||||
@Override
|
||||
public int getRenderType() {return IBlockMultiPass.getRenderType();}
|
||||
|
||||
@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) {
|
||||
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile instanceof TileEntityPneumoTubePaintable) {
|
||||
TileEntityPneumoTubePaintable tube = (TileEntityPneumoTubePaintable) tile;
|
||||
|
||||
if (tube.block != null) {
|
||||
tube.block = null;
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
tube.markDirty();
|
||||
}
|
||||
}
|
||||
} else if (tool == ToolType.SCREWDRIVER) {
|
||||
|
||||
if (world.isRemote) return true;
|
||||
TileEntityPneumoTube tube = (TileEntityPneumoTube) world.getTileEntity(x, y, z);
|
||||
|
||||
ForgeDirection rot = player.isSneaking() ? tube.ejectionDir : tube.insertionDir;
|
||||
ForgeDirection oth = player.isSneaking() ? tube.insertionDir : tube.ejectionDir;
|
||||
|
||||
for (int i = 0; i < 7; i++) {
|
||||
rot = ForgeDirection.getOrientation((rot.ordinal() + 1) % 7);
|
||||
if (rot == ForgeDirection.UNKNOWN) break; //unknown is always valid, simply disables this part
|
||||
if (rot == oth) continue; //skip if both positions collide
|
||||
TileEntity tile = Compat.getTileStandard(world, x + rot.offsetX, y + rot.offsetY, z + rot.offsetZ);
|
||||
if (tile instanceof TileEntityPneumoTube) continue;
|
||||
if (tile instanceof IInventory) break; //valid if connected to an IInventory
|
||||
}
|
||||
|
||||
if(player.isSneaking()) tube.ejectionDir = rot; else tube.insertionDir = rot;
|
||||
|
||||
tube.markDirty();
|
||||
if(world instanceof WorldServer) ((WorldServer) world).getPlayerManager().markBlockForUpdate(x, y, z);
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@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) {
|
||||
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 TileEntityPneumoTubePaintable) {
|
||||
TileEntityPneumoTubePaintable tube = (TileEntityPneumoTubePaintable) tile;
|
||||
|
||||
if (tube.block == null) {
|
||||
tube.block = block;
|
||||
tube.meta = stack.getItemDamage() & 15;
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
tube.markDirty();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (ToolType.getType(stack) == ToolType.SCREWDRIVER || ToolType.getType(stack) == ToolType.HAND_DRILL) return false;
|
||||
if (!player.isSneaking()) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile instanceof TileEntityPneumoTube) {
|
||||
TileEntityPneumoTube tube = (TileEntityPneumoTube) tile;
|
||||
if (tube.isCompressor()) {
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static class TileEntityPneumoTubePaintable extends TileEntityPneumoTube implements ICopiable {
|
||||
|
||||
private Block block;
|
||||
private int meta;
|
||||
private Block lastBlock;
|
||||
private int lastMeta;
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
|
||||
if (worldObj.isRemote && (lastMeta != meta || lastBlock != block )) {
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
lastBlock = block;
|
||||
lastMeta = meta;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
int id = nbt.getInteger("block");
|
||||
this.block = id == 0 ? null : Block.getBlockById(id);
|
||||
this.meta = nbt.getInteger("meta");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
if(block != null) nbt.setInteger("block", Block.getIdFromBlock(block));
|
||||
nbt.setInteger("meta", meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||
NBTTagCompound nbt = pkt.func_148857_g();
|
||||
|
||||
int id = nbt.getInteger("block");
|
||||
this.block = id == 0 ? null : Block.getBlockById(id);
|
||||
this.meta = nbt.getInteger("meta");
|
||||
super.onDataPacket(net, pkt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
|
||||
if(block != null) nbt.setInteger("block", Block.getIdFromBlock(block));
|
||||
nbt.setInteger("meta", meta);
|
||||
nbt.setByte("insertionDir", (byte) insertionDir.ordinal());
|
||||
nbt.setByte("ejectionDir", (byte) ejectionDir.ordinal());
|
||||
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getSettings(World world, int x, int y, int z) {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
if(block != null) {
|
||||
nbt.setInteger("paintblock", Block.getIdFromBlock(block));
|
||||
nbt.setInteger("paintmeta", meta);
|
||||
}
|
||||
return nbt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pasteSettings(NBTTagCompound nbt, int index, World world, EntityPlayer player, int x, int y, int z) {
|
||||
if(nbt.hasKey("paintblock")) {
|
||||
this.block = Block.getBlockById(nbt.getInteger("paintblock"));
|
||||
this.meta = nbt.getInteger("paintmeta");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -7,6 +7,7 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
@Deprecated
|
||||
public interface IRenderBlock {
|
||||
|
||||
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
@ -1,14 +0,0 @@
|
||||
package com.hbm.calc;
|
||||
|
||||
public class EasyLocation {
|
||||
|
||||
public double posX;
|
||||
public double posY;
|
||||
public double posZ;
|
||||
|
||||
public EasyLocation(double x, double y, double z) {
|
||||
posX = x;
|
||||
posY = y;
|
||||
posZ = z;
|
||||
}
|
||||
}
|
||||
@ -1,33 +0,0 @@
|
||||
package com.hbm.calc;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class Location {
|
||||
|
||||
public int x;
|
||||
public int y;
|
||||
public int z;
|
||||
public World world;
|
||||
|
||||
public Location(World world, int x, int y, int z) {
|
||||
this.world = world;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public Location add(int xa, int ya, int za) {
|
||||
return new Location(world, x + xa, y + ya, z + za);
|
||||
}
|
||||
|
||||
public Location add(ForgeDirection dir) {
|
||||
return add(dir.offsetX, dir.offsetY, dir.offsetZ);
|
||||
}
|
||||
|
||||
public TileEntity getTileEntity() {
|
||||
return world.getTileEntity(x, y, z);
|
||||
}
|
||||
|
||||
}
|
||||
51
src/main/java/com/hbm/commands/CommandCustomize.java
Normal file
51
src/main/java/com/hbm/commands/CommandCustomize.java
Normal file
@ -0,0 +1,51 @@
|
||||
package com.hbm.commands;
|
||||
|
||||
import com.hbm.items.ICustomizable;
|
||||
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.ChatStyle;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
public class CommandCustomize extends CommandBase {
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return "ntmcustomize";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandUsage(ICommandSender sender) {
|
||||
return "/ntmcustomize";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRequiredPermissionLevel() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCommandSenderUseCommand(ICommandSender sender) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processCommand(ICommandSender sender, String[] args) {
|
||||
if(!(sender instanceof EntityPlayer)) {
|
||||
sender.addChatMessage(new ChatComponentText("Customization is only available to players!").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED)));
|
||||
return;
|
||||
}
|
||||
|
||||
EntityPlayer player = (EntityPlayer) sender;
|
||||
|
||||
if(player.getHeldItem() == null || !(player.getHeldItem().getItem() instanceof ICustomizable)) {
|
||||
sender.addChatMessage(new ChatComponentText("You have to hold a customizable item to use this command!").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED)));
|
||||
return;
|
||||
}
|
||||
|
||||
ICustomizable item = (ICustomizable) player.getHeldItem().getItem();
|
||||
item.customize(player, player.getHeldItem(), args);
|
||||
}
|
||||
}
|
||||
118
src/main/java/com/hbm/commands/CommandLocate.java
Normal file
118
src/main/java/com/hbm/commands/CommandLocate.java
Normal file
@ -0,0 +1,118 @@
|
||||
package com.hbm.commands;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import com.hbm.lib.HbmWorld;
|
||||
import com.hbm.world.gen.nbt.NBTStructure;
|
||||
import com.hbm.world.gen.nbt.SpawnCondition;
|
||||
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.command.PlayerNotFoundException;
|
||||
import net.minecraft.command.WrongUsageException;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.ChunkCoordIntPair;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class CommandLocate extends CommandBase {
|
||||
|
||||
private static final int MAX_DISTANCE = 256;
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return "ntmlocate";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandUsage(ICommandSender sender) {
|
||||
return String.format(Locale.US,
|
||||
"%s/%s structure <name> %s- Locates the nearest structure with a given name.",
|
||||
EnumChatFormatting.GREEN, getCommandName(), EnumChatFormatting.LIGHT_PURPLE
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processCommand(ICommandSender sender, String[] args) {
|
||||
if(!(sender instanceof EntityPlayer))
|
||||
throw new PlayerNotFoundException();
|
||||
|
||||
if(args.length == 0)
|
||||
throw new WrongUsageException(getCommandUsage(sender), new Object[0]);
|
||||
|
||||
if(args[0].equals("structure")) {
|
||||
EntityPlayer player = (EntityPlayer) sender;
|
||||
|
||||
SpawnCondition structure = NBTStructure.getStructure(args[1]);
|
||||
|
||||
if(structure == null) {
|
||||
ChatComponentTranslation message = new ChatComponentTranslation("commands.locate.no_match");
|
||||
message.getChatStyle().setColor(EnumChatFormatting.RED);
|
||||
sender.addChatMessage(message);
|
||||
return;
|
||||
}
|
||||
|
||||
int chunkX = MathHelper.floor_double(player.posX) / 16;
|
||||
int chunkZ = MathHelper.floor_double(player.posZ) / 16;
|
||||
|
||||
ChunkCoordIntPair pos = getNearestLocationTo(structure, player.worldObj, chunkX, chunkZ);
|
||||
|
||||
if(pos == null) {
|
||||
ChatComponentTranslation message = new ChatComponentTranslation("commands.locate.none_found");
|
||||
message.getChatStyle().setColor(EnumChatFormatting.RED);
|
||||
sender.addChatMessage(message);
|
||||
return;
|
||||
}
|
||||
|
||||
ChatComponentTranslation message = new ChatComponentTranslation("commands.locate.success.coordinates", structure.name, pos.chunkXPos * 16, pos.chunkZPos * 16);
|
||||
message.getChatStyle().setColor(EnumChatFormatting.GREEN);
|
||||
sender.addChatMessage(message);
|
||||
} else {
|
||||
throw new WrongUsageException(getCommandUsage(sender), new Object[0]);
|
||||
}
|
||||
}
|
||||
|
||||
private ChunkCoordIntPair getNearestLocationTo(SpawnCondition spawn, World world, int chunkX, int chunkZ) {
|
||||
if(HbmWorld.worldGenerator.getStructureAt(world, chunkX, chunkZ) == spawn)
|
||||
return new ChunkCoordIntPair(chunkX, chunkZ);
|
||||
|
||||
for(int radius = 1; radius < MAX_DISTANCE; radius++) {
|
||||
for(int x = chunkX - radius; x <= chunkX + radius; x++) {
|
||||
if(HbmWorld.worldGenerator.getStructureAt(world, x, chunkZ - radius) == spawn)
|
||||
return new ChunkCoordIntPair(x, chunkZ - radius);
|
||||
if(HbmWorld.worldGenerator.getStructureAt(world, x, chunkZ + radius) == spawn)
|
||||
return new ChunkCoordIntPair(x, chunkZ + radius);
|
||||
}
|
||||
for(int z = chunkZ - radius; z <= chunkZ + radius; z++) {
|
||||
if(HbmWorld.worldGenerator.getStructureAt(world, chunkX - radius, z) == spawn)
|
||||
return new ChunkCoordIntPair(chunkX - radius, z);
|
||||
if(HbmWorld.worldGenerator.getStructureAt(world, chunkX + radius, z) == spawn)
|
||||
return new ChunkCoordIntPair(chunkX + radius, z);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public List<String> addTabCompletionOptions(ICommandSender sender, String[] args) {
|
||||
if(args.length < 1)
|
||||
return Collections.emptyList();
|
||||
|
||||
if(args.length == 1)
|
||||
return getListOfStringsMatchingLastWord(args, "structure");
|
||||
|
||||
if(args.length == 2) {
|
||||
List<String> structures = NBTStructure.listStructures();
|
||||
return getListOfStringsMatchingLastWord(args, structures.toArray(new String[structures.size()]));
|
||||
}
|
||||
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
package com.hbm.commands;
|
||||
|
||||
import com.hbm.config.ItemPoolConfigJSON;
|
||||
import com.hbm.inventory.FluidContainerRegistry;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.recipes.loader.SerializableRecipe;
|
||||
import com.hbm.particle.helper.SkeletonCreator;
|
||||
@ -27,7 +28,9 @@ public class CommandReloadRecipes extends CommandBase {
|
||||
@Override
|
||||
public void processCommand(ICommandSender sender, String[] args) {
|
||||
try {
|
||||
FluidContainerRegistry.clearRegistry(); // we do this first so IFluidRegisterListener can go wild with the registry
|
||||
Fluids.reloadFluids();
|
||||
FluidContainerRegistry.register();
|
||||
SerializableRecipe.initialize();
|
||||
ItemPoolConfigJSON.initialize();
|
||||
DamageResistanceHandler.init();
|
||||
|
||||
@ -32,6 +32,7 @@ public class ClientConfig extends RunningConfig {
|
||||
public static ConfigWrapper<Boolean> RENDER_REEDS = new ConfigWrapper(!Compat.isModLoaded(Compat.MOD_ANG));
|
||||
public static ConfigWrapper<Boolean> NEI_HIDE_SECRETS = new ConfigWrapper(true);
|
||||
public static ConfigWrapper<Boolean> COOLING_TOWER_PARTICLES = new ConfigWrapper(true);
|
||||
public static ConfigWrapper<Boolean> RENDER_REBAR_SIMPLE = new ConfigWrapper(false);
|
||||
|
||||
private static void initDefaults() {
|
||||
configMap.put("GEIGER_OFFSET_HORIZONTAL", GEIGER_OFFSET_HORIZONTAL);
|
||||
@ -53,6 +54,7 @@ public class ClientConfig extends RunningConfig {
|
||||
configMap.put("RENDER_REEDS", RENDER_REEDS);
|
||||
configMap.put("NEI_HIDE_SECRETS", NEI_HIDE_SECRETS);
|
||||
configMap.put("COOLING_TOWER_PARTICLES", COOLING_TOWER_PARTICLES);
|
||||
configMap.put("RENDER_REBAR_SIMPLE", RENDER_REBAR_SIMPLE);
|
||||
}
|
||||
|
||||
/** Initializes defaults, then reads the config file if it exists, then writes the config file. */
|
||||
|
||||
@ -81,8 +81,8 @@ public class CommonConfig {
|
||||
prop.comment = comment;
|
||||
return prop.getIntList();
|
||||
}
|
||||
public static String[] createConfigStringList(Configuration config, String category, String name, String comment) {
|
||||
Property prop = config.get(category, name, new String[] { "PLACEHOLDER" });
|
||||
public static String[] createConfigStringList(Configuration config, String category, String name, String comment, String[] def) {
|
||||
Property prop = config.get(category, name, def);
|
||||
prop.comment = comment;
|
||||
return prop.getStringList();
|
||||
}
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
package com.hbm.config;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@ -148,7 +147,7 @@ public class CustomMachineConfigJSON {
|
||||
public static void readConfig(File config) {
|
||||
|
||||
try {
|
||||
JsonObject json = gson.fromJson(new FileReader(config), JsonObject.class);
|
||||
JsonObject json = gson.fromJson(new InputStreamReader(Files.newInputStream(config.toPath()), StandardCharsets.UTF_8), JsonObject.class);
|
||||
JsonArray machines = json.get("machines").getAsJsonArray();
|
||||
|
||||
for(int i = 0; i < machines.size(); i++) {
|
||||
@ -182,32 +181,32 @@ public class CustomMachineConfigJSON {
|
||||
try {
|
||||
JsonArray recipeShape = machineObject.get("recipeShape").getAsJsonArray();
|
||||
JsonArray recipeParts = machineObject.get("recipeParts").getAsJsonArray();
|
||||
|
||||
|
||||
Object[] parts = new Object[recipeShape.size() + recipeParts.size()];
|
||||
|
||||
|
||||
for(int j = 0; j < recipeShape.size(); j++) {
|
||||
parts[j] = recipeShape.get(j).getAsString();
|
||||
}
|
||||
|
||||
|
||||
for(int j = 0; j < recipeParts.size(); j++) {
|
||||
Object o = null;
|
||||
|
||||
|
||||
if(j % 2 == 0) {
|
||||
o = recipeParts.get(j).getAsString().charAt(0); //god is dead and we killed him
|
||||
} else {
|
||||
AStack a = SerializableRecipe.readAStack(recipeParts.get(j).getAsJsonArray());
|
||||
|
||||
|
||||
if(a instanceof ComparableStack) o = ((ComparableStack) a).toStack();
|
||||
if(a instanceof OreDictStack) o = ((OreDictStack) a).name;
|
||||
}
|
||||
|
||||
|
||||
parts[j + recipeShape.size()] = o;
|
||||
}
|
||||
|
||||
|
||||
ItemStack stack = new ItemStack(ModBlocks.custom_machine, 1, i + 100);
|
||||
stack.stackTagCompound = new NBTTagCompound();
|
||||
stack.stackTagCompound.setString("machineType", configuration.unlocalizedName);
|
||||
|
||||
|
||||
CraftingManager.addRecipeAuto(stack, parts);
|
||||
} catch(Exception ex) {
|
||||
MainRegistry.logger.error("Caught exception trying to parse core recipe for custom machine " + configuration.unlocalizedName);
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package com.hbm.config;
|
||||
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
import com.hbm.lib.RefStrings;
|
||||
public class GeneralConfig {
|
||||
|
||||
public static boolean enableThermosPreventer = true;
|
||||
@ -39,6 +39,7 @@ public class GeneralConfig {
|
||||
public static boolean enableSoundExtension = true;
|
||||
public static boolean enableMekanismChanges = true;
|
||||
public static boolean enableServerRecipeSync = false;
|
||||
public static boolean enableLoadScreenReplacement = true;
|
||||
public static int normalSoundChannels = 200;
|
||||
|
||||
public static boolean enableExpensiveMode = false;
|
||||
@ -70,6 +71,7 @@ public class GeneralConfig {
|
||||
public static boolean enableLBSMSafeMEDrives = true;
|
||||
public static boolean enableLBSMIGen = true;
|
||||
public static int schrabRate = 20;
|
||||
public static String[] preferredOutputMod = new String[] {RefStrings.MODID};
|
||||
|
||||
public static void loadFromConfig(Configuration config) {
|
||||
|
||||
@ -117,7 +119,9 @@ public class GeneralConfig {
|
||||
normalSoundChannels = CommonConfig.createConfigInt(config, CATEGORY_GENERAL, "1.41_normalSoundChannels",
|
||||
"The amount of channels to create while 1.39_enableSoundExtension is enabled.\n" +
|
||||
"Note that a value below 28 or above 200 can cause buggy sounds and issues with other mods running out of sound memory.", 100);
|
||||
|
||||
preferredOutputMod = CommonConfig.createConfigStringList(config,CATEGORY_GENERAL,"1.42_preferredOutputMod",
|
||||
"The mod which is preferred as output when certain machines autogenerate recipes. Currently used for the shredder", new String[] {RefStrings.MODID});
|
||||
enableLoadScreenReplacement = config.get(CATEGORY_GENERAL, "1.43_enableLoadScreenReplacement", true, "Tries to replace the vanilla load screen with the 'tip of the day' one, may clash with other mods trying to do the same.").getBoolean(true);
|
||||
enableExpensiveMode = config.get(CATEGORY_GENERAL, "1.99_enableExpensiveMode", false, "It does what the name implies.").getBoolean(false);
|
||||
|
||||
final String CATEGORY_528 = CommonConfig.CATEGORY_528;
|
||||
|
||||
@ -10,8 +10,8 @@ public class StructureConfig {
|
||||
|
||||
public static int enableStructures = 2;
|
||||
|
||||
public static int structureMinChunks = 8;
|
||||
public static int structureMaxChunks = 24;
|
||||
public static int structureMinChunks = 4;
|
||||
public static int structureMaxChunks = 12;
|
||||
|
||||
public static double lootAmountFactor = 1D;
|
||||
|
||||
@ -25,15 +25,15 @@ public class StructureConfig {
|
||||
|
||||
enableStructures = CommonConfig.parseStructureFlag(unparsedStructureFlag);
|
||||
|
||||
structureMinChunks = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.01_structureMinChunks", "Minimum non-zero distance between structures in chunks (Settings lower than 8 may be problematic).", 8);
|
||||
structureMaxChunks = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.02_structureMaxChunks", "Maximum non-zero distance between structures in chunks.", 24);
|
||||
structureMinChunks = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.01_structureMinChunks", "Minimum non-zero distance between structures in chunks (Settings lower than 8 may be problematic).", 4);
|
||||
structureMaxChunks = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.02_structureMaxChunks", "Maximum non-zero distance between structures in chunks.", 16);
|
||||
|
||||
lootAmountFactor = CommonConfig.createConfigDouble(config, CATEGORY_STRUCTURES, "5.03_lootAmountFactor", "General factor for loot spawns. Applies to spawned IInventories, not loot blocks.", 1D);
|
||||
|
||||
debugStructures = CommonConfig.createConfigBool(config, CATEGORY_STRUCTURES, "5.04_debugStructures", "If enabled, special structure blocks like jigsaw blocks will not be transformed after generating", false);
|
||||
|
||||
structureMinChunks = CommonConfig.setDef(structureMinChunks, 8);
|
||||
structureMaxChunks = CommonConfig.setDef(structureMaxChunks, 24);
|
||||
structureMinChunks = CommonConfig.setDef(structureMinChunks, 4);
|
||||
structureMaxChunks = CommonConfig.setDef(structureMaxChunks, 12);
|
||||
|
||||
if(structureMinChunks > structureMaxChunks) {
|
||||
MainRegistry.logger.error("Fatal error config: Minimum value has been set higher than the maximum value!");
|
||||
|
||||
@ -81,7 +81,7 @@ public class WorldConfig {
|
||||
public static boolean enableSulfurCave = true;
|
||||
public static boolean enableAsbestosCave = true;
|
||||
|
||||
public static int radioStructure = 500;
|
||||
// public static int radioStructure = 500;
|
||||
public static int antennaStructure = 250;
|
||||
public static int atomStructure = 500;
|
||||
public static int dungeonStructure = 64;
|
||||
@ -204,7 +204,7 @@ public class WorldConfig {
|
||||
enableAsbestosCave = CommonConfig.createConfigBool(config, CATEGORY_OREGEN, "2.C01_enableAsbestosCave", "Toggles asbestos caves", true);
|
||||
|
||||
final String CATEGORY_DUNGEON = CommonConfig.CATEGORY_DUNGEONS;
|
||||
radioStructure = CommonConfig.createConfigInt(config, CATEGORY_DUNGEON, "4.00_radioSpawn", "Spawn radio station on every nTH chunk", 500);
|
||||
// radioStructure = CommonConfig.createConfigInt(config, CATEGORY_DUNGEON, "4.00_radioSpawn", "Spawn radio station on every nTH chunk", 500);
|
||||
antennaStructure = CommonConfig.createConfigInt(config, CATEGORY_DUNGEON, "4.01_antennaSpawn", "Spawn antenna on every nTH chunk", 250);
|
||||
atomStructure = CommonConfig.createConfigInt(config, CATEGORY_DUNGEON, "4.02_atomSpawn", "Spawn power plant on every nTH chunk", 500);
|
||||
dungeonStructure = CommonConfig.createConfigInt(config, CATEGORY_DUNGEON, "4.04_dungeonSpawn", "Spawn library dungeon on every nTH chunk", 64);
|
||||
@ -245,7 +245,7 @@ public class WorldConfig {
|
||||
craterBiomeOuterRad = (float) CommonConfig.createConfigDouble(config, CATEGORY_BIOMES, "17.R02_craterBiomeOuterRad", "RAD/s for the outer crater biome", 0.5D);
|
||||
craterBiomeWaterMult = (float) CommonConfig.createConfigDouble(config, CATEGORY_BIOMES, "17.R03_craterBiomeWaterMult", "Multiplier for RAD/s in crater biomes when in water", 5D);
|
||||
|
||||
radioStructure = CommonConfig.setDefZero(radioStructure, 1000);
|
||||
// radioStructure = CommonConfig.setDefZero(radioStructure, 1000);
|
||||
antennaStructure = CommonConfig.setDefZero(antennaStructure, 1000);
|
||||
atomStructure = CommonConfig.setDefZero(atomStructure, 1000);
|
||||
dungeonStructure = CommonConfig.setDefZero(dungeonStructure, 1000);
|
||||
|
||||
@ -27,11 +27,11 @@ public class ConsumableRecipes {
|
||||
public static void register() {
|
||||
|
||||
//Airstikes
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.bomb_caller, 1, 0), new Object[] { "TTT", "TRT", "TTT", 'T', Blocks.tnt, 'R', ModItems.detonator_laser });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.bomb_caller, 1, 1), new Object[] { "TTT", "TRT", "TTT", 'T', ModItems.grenade_gascan, 'R', ModItems.detonator_laser });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.bomb_caller, 1, 2), new Object[] { "TTT", "TRT", "TTT", 'T', ModItems.pellet_gas, 'R', ModItems.detonator_laser });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.bomb_caller, 1, 3), new Object[] { "TRT", 'T', ModItems.grenade_cloud, 'R', ModItems.detonator_laser });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.bomb_caller, 1, 4), new Object[] { "TR", 'T', DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.NUKE_HIGH), 'R', ModItems.detonator_laser });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.bomb_caller, 1, 0), new Object[] { "TTT", "TRT", "TTT", 'T', Blocks.tnt, 'R', ModItems.rangefinder });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.bomb_caller, 1, 1), new Object[] { "TTT", "TRT", "TTT", 'T', ModItems.grenade_gascan, 'R', ModItems.rangefinder });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.bomb_caller, 1, 2), new Object[] { "TTT", "TRT", "TTT", 'T', ModItems.pellet_gas, 'R', ModItems.rangefinder });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.bomb_caller, 1, 3), new Object[] { "TRT", 'T', ModItems.grenade_cloud, 'R', ModItems.rangefinder });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.bomb_caller, 1, 4), new Object[] { "TRC", 'T', DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.NUKE_HIGH), 'R', ModItems.rangefinder, 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.CONTROLLER) });
|
||||
|
||||
//Food
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.bomb_waffle, 1), new Object[] { "WEW", "MPM", "WEW", 'W', Items.wheat, 'E', Items.egg, 'M', Items.milk_bucket, 'P', ModItems.man_core });
|
||||
@ -89,8 +89,6 @@ public class ConsumableRecipes {
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.bottle2_empty, 6), new Object[] { " G ", "G G", "G G", 'G', KEY_ANYPANE });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.bottle2_korl, 1), new Object[] { ModItems.bottle2_empty, Items.potionitem, Items.sugar, CU.dust() });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.bottle2_fritz, 1), new Object[] { ModItems.bottle2_empty, Items.potionitem, Items.sugar, W.dust() });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.bottle2_korl_special, 1), new Object[] { ModItems.bottle2_empty, Items.potionitem, Items.sugar, CU.dust(), ST.dust() });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.bottle2_fritz_special, 1), new Object[] { ModItems.bottle2_empty, Items.potionitem, Items.sugar, W.dust(), TH232.dust() });
|
||||
|
||||
//Syringes
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.syringe_empty, 6), new Object[] { "P", "C", "B", 'B', Item.getItemFromBlock(Blocks.iron_bars), 'C', ModItems.cell_empty, 'P', IRON.plate() });
|
||||
|
||||
@ -112,10 +112,11 @@ public class ToolRecipes {
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.ullapool_caber, 1), new Object[] { "ITI", " S ", " S ", 'I', IRON.plate(), 'T', Blocks.tnt, 'S', KEY_STICK });
|
||||
|
||||
//Utility
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.designator, 1), new Object[] { " A", "#B#", "#B#", '#', IRON.plate(), 'A', STEEL.plate(), 'B', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.BASIC) });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.designator_range, 1), new Object[] { "RRD", "PIC", " P", 'P', STEEL.plate(), 'R', Items.redstone, 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED), 'D', ModItems.designator, 'I', STEEL.ingot() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.rangefinder, 1), new Object[] { "GRC", " S", 'G', KEY_ANYPANE, 'R', REDSTONE.dust(), 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.BASIC), 'S' ,STEEL.plate() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.designator, 1), new Object[] { " A", "#B#", "#B#", '#', ANY_PLASTIC.ingot(), 'A', STEEL.plate(), 'B', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.BASIC) });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.designator_range, 1), new Object[] { ModItems.rangefinder, ModItems.designator, ANY_PLASTIC.ingot() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.designator_manual, 1), new Object[] { " A", "#C#", "#B#", '#', ANY_PLASTIC.ingot(), 'A', PB.plate(), 'B', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED), 'C', ModItems.designator });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.designator_arty_range, 1), new Object[] { "M", "C", "P", 'M', ModItems.magnetron, 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED), 'P', ANY_PLASTIC.ingot() });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.designator_arty_range, 1), new Object[] { ModItems.rangefinder, DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED), ANY_PLASTIC.ingot() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.linker, 1), new Object[] { "I I", "ICI", "GGG", 'I', IRON.plate(), 'G', GOLD.plate(), 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED) });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.oil_detector, 1), new Object[] { "W I", "WCI", "PPP", 'W', GOLD.wireFine(), 'I', CU.ingot(), 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ANALOG), 'P', STEEL.plate528() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.turret_chip, 1), new Object[] { "WWW", "CPC", "WWW", 'W', GOLD.wireFine(), 'P', ANY_PLASTIC.ingot(), 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED), });
|
||||
@ -155,10 +156,15 @@ public class ToolRecipes {
|
||||
CraftingManager.addRecipeAuto(ItemBlowtorch.getEmptyTool(ModItems.blowtorch), new Object[] { "CC ", " I ", "CCC", 'C', CU.plate528(), 'I', IRON.ingot() });
|
||||
CraftingManager.addRecipeAuto(ItemBlowtorch.getEmptyTool(ModItems.acetylene_torch), new Object[] { "SS ", " PS", " T ", 'S', STEEL.plate528(), 'P', ANY_PLASTIC.ingot(), 'T', ModItems.tank_steel });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.boltgun), new Object[] { "DPS", " RD", " D ", 'D', DURA.ingot(), 'P', DictFrame.fromOne(ModItems.part_generic, EnumPartType.PISTON_PNEUMATIC), 'R', RUBBER.ingot(), 'S', STEEL.shell() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.rebar_placer), new Object[] { "RDR", "DWD", "RDR", 'R', ModBlocks.rebar, 'D', ModItems.ducttape, 'W', ModItems.wrench });
|
||||
|
||||
//Bobmazon
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.bobmazon), new Object[] { Items.book, Items.gold_nugget, Items.string, KEY_BLUE });
|
||||
|
||||
|
||||
//Blueprints
|
||||
//CraftingManager.addShapelessAuto(new ItemStack(ModItems.blueprint_folder, 1, 0), new Object[] { ModItems.blueprints, ModItems.blueprints, ModItems.blueprints });
|
||||
//CraftingManager.addShapelessAuto(new ItemStack(ModItems.blueprint_folder, 1, 1), new Object[] { ModItems.blueprints, ModItems.blueprints, ModItems.blueprints, ModItems.blueprints, ModItems.blueprints, ModItems.fragment_meteorite });
|
||||
|
||||
//Carts
|
||||
CraftingManager.addRecipeAuto(ItemModMinecart.createCartItem(EnumCartBase.WOOD, EnumMinecart.EMPTY), new Object[] { "P P", "WPW", 'P',KEY_SLAB, 'W', KEY_PLANKS });
|
||||
CraftingManager.addRecipeAuto(ItemModMinecart.createCartItem(EnumCartBase.STEEL, EnumMinecart.EMPTY), new Object[] { "P P", "IPI", 'P', STEEL.plate(), 'I', STEEL.ingot() });
|
||||
|
||||
@ -207,7 +207,7 @@ public class WeaponRecipes {
|
||||
|
||||
|
||||
//Ammo assemblies
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_nuke, 1), new Object[] { " WP", "SEP", " WP", 'W', GOLD.wireFine(), 'P', STEEL.plate(), 'S', STEEL.shell(), 'E', ModItems.ball_tatb });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_nuke, 1), new Object[] { " WP", "SEP", " WP", 'W', GOLD.wireFine(), 'P', WEAPONSTEEL.plate(), 'S', WEAPONSTEEL.shell(), 'E', ModItems.ball_tatb });
|
||||
|
||||
//240mm Shells
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_shell, 4), new Object[] { " T ", "GHG", "CCC", 'T', ModBlocks.tnt, 'G', Items.gunpowder, 'H', STEEL.shell(), 'C', CU.ingot() });
|
||||
|
||||
@ -31,6 +31,7 @@ import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EnumCreatureType;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraft.world.biome.BiomeGenBase.SpawnListEntry;
|
||||
import net.minecraft.world.biome.BiomeGenMushroomIsland;
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
import net.minecraftforge.common.BiomeDictionary.Type;
|
||||
|
||||
@ -204,6 +205,7 @@ public class EntityMappings {
|
||||
addEntity(EntityFallingBlockNT.class, "entity_falling_block_nt", 1000);
|
||||
addEntity(EntityBoatRubber.class, "entity_rubber_boat", 250, false);
|
||||
addEntity(EntityMissileStealth.class, "entity_missile_stealth", 1000);
|
||||
addEntity(EntityCoin.class, "entity_coin", 1000);
|
||||
|
||||
addEntity(EntityItemWaste.class, "entity_item_waste", 100);
|
||||
addEntity(EntityItemBuoyant.class, "entity_item_buoyant", 100);
|
||||
@ -279,6 +281,7 @@ public class EntityMappings {
|
||||
for(BiomeGenBase biome : biomes) {
|
||||
|
||||
if(biome == null) continue;
|
||||
if(biome instanceof BiomeGenMushroomIsland) continue;
|
||||
|
||||
List<SpawnListEntry> spawns = biome.getSpawnableList(typeOfCreature);
|
||||
|
||||
|
||||
@ -20,6 +20,8 @@ public class EntityFireLingering extends Entity {
|
||||
public static int TYPE_DIESEL = 0;
|
||||
public static int TYPE_BALEFIRE = 1;
|
||||
public static int TYPE_PHOSPHORUS = 2;
|
||||
public static int TYPE_OXY = 3;
|
||||
public static int TYPE_BLACK = 4;
|
||||
public int maxAge = 150;
|
||||
|
||||
public EntityFireLingering(World world) {
|
||||
@ -75,6 +77,7 @@ public class EntityFireLingering extends Entity {
|
||||
if(this.getType() == this.TYPE_DIESEL) if(props.fire < 60) props.fire = 60;
|
||||
if(this.getType() == this.TYPE_PHOSPHORUS) if(props.fire < 300) props.fire = 300;
|
||||
if(this.getType() == this.TYPE_BALEFIRE) if(props.balefire < 100) props.balefire = 100;
|
||||
if(this.getType() == this.TYPE_BLACK) if(props.blackFire < 200) props.blackFire = 200; else props.blackFire += 5;
|
||||
} else {
|
||||
e.setFire(4);
|
||||
}
|
||||
@ -92,6 +95,7 @@ public class EntityFireLingering extends Entity {
|
||||
if(this.getType() == this.TYPE_DIESEL) FlameCreator.composeEffectClient(worldObj, x, down.yCoord, z, FlameCreator.META_FIRE);
|
||||
if(this.getType() == this.TYPE_PHOSPHORUS) FlameCreator.composeEffectClient(worldObj, x, down.yCoord, z, FlameCreator.META_FIRE);
|
||||
if(this.getType() == this.TYPE_BALEFIRE) FlameCreator.composeEffectClient(worldObj, x, down.yCoord, z, FlameCreator.META_BALEFIRE);
|
||||
if(this.getType() == this.TYPE_BLACK) FlameCreator.composeEffectClient(worldObj, x, down.yCoord, z, FlameCreator.META_BLACK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -200,7 +200,7 @@ public class EntityDeliveryDrone extends EntityDroneBase implements IInventory,
|
||||
}
|
||||
|
||||
// This is the lowest padding that worked with my drone waypoint path. if they stop getting loaded crank up paddingSize
|
||||
for (ChunkCoordIntPair chunk : ChunkShapeHelper.getChunksAlongLineSegment((int) this.posX, (int) this.posZ, (int) (this.posX + this.motionX), (int) (this.posZ + this.motionZ), 4)){
|
||||
for (ChunkCoordIntPair chunk : ChunkShapeHelper.getChunksAlongLineSegment((int) Math.floor(this.posX), (int) Math.floor(this.posZ), (int) Math.floor(this.posX + this.motionX), (int) Math.floor(this.posZ + this.motionZ), 8)){
|
||||
ForgeChunkManager.forceChunk(loaderTicket, chunk);
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,8 +10,8 @@ import com.hbm.main.MainRegistry;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityBalefire extends EntityExplosionChunkloading {
|
||||
|
||||
public class EntityBalefire extends EntityExplosionChunkloading {
|
||||
|
||||
public int age = 0;
|
||||
public int destructionRange = 0;
|
||||
public ExplosionBalefire exp;
|
||||
@ -24,13 +24,11 @@ public class EntityBalefire extends EntityExplosionChunkloading {
|
||||
destructionRange = nbt.getInteger("destructionRange");
|
||||
speed = nbt.getInteger("speed");
|
||||
did = nbt.getBoolean("did");
|
||||
|
||||
|
||||
exp = new ExplosionBalefire((int)this.posX, (int)this.posY, (int)this.posZ, this.worldObj, this.destructionRange);
|
||||
|
||||
exp = new ExplosionBalefire((int) this.posX, (int) this.posY, (int) this.posZ, this.worldObj, this.destructionRange);
|
||||
exp.readFromNbt(nbt, "exp_");
|
||||
|
||||
this.did = true;
|
||||
|
||||
|
||||
this.did = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -39,10 +37,10 @@ public class EntityBalefire extends EntityExplosionChunkloading {
|
||||
nbt.setInteger("destructionRange", destructionRange);
|
||||
nbt.setInteger("speed", speed);
|
||||
nbt.setBoolean("did", did);
|
||||
|
||||
|
||||
if(exp != null)
|
||||
exp.saveToNbt(nbt, "exp_");
|
||||
|
||||
|
||||
}
|
||||
|
||||
public EntityBalefire(World p_i1582_1_) {
|
||||
@ -53,7 +51,8 @@ public class EntityBalefire extends EntityExplosionChunkloading {
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
|
||||
if(!worldObj.isRemote) loadChunk((int) Math.floor(posX / 16D), (int) Math.floor(posZ / 16D));
|
||||
if(!worldObj.isRemote)
|
||||
loadChunk((int) Math.floor(posX / 16D), (int) Math.floor(posZ / 16D));
|
||||
|
||||
if(!this.did) {
|
||||
if(GeneralConfig.enableExtendedLogging && !worldObj.isRemote)
|
||||
|
||||
@ -44,7 +44,7 @@ public abstract class EntityExplosionChunkloading extends Entity implements IChu
|
||||
}
|
||||
|
||||
public void clearChunkLoader() {
|
||||
if(!worldObj.isRemote && loaderTicket != null && loadedChunk != null) {
|
||||
if(!worldObj.isRemote && loaderTicket != null) {
|
||||
ForgeChunkManager.releaseTicket(loaderTicket);
|
||||
this.loaderTicket = null;
|
||||
}
|
||||
|
||||
@ -259,6 +259,10 @@ public class EntityNukeExplosionMK3 extends EntityExplosionChunkloading {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!entity.isDead) {
|
||||
entity.loadChunk((int) Math.floor(x / 16D), (int) Math.floor(z / 16D));
|
||||
}
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
@ -10,7 +10,6 @@ import com.hbm.config.GeneralConfig;
|
||||
import com.hbm.entity.effect.EntityFalloutRain;
|
||||
import com.hbm.explosion.ExplosionNukeGeneric;
|
||||
import com.hbm.explosion.ExplosionNukeRayBatched;
|
||||
import com.hbm.explosion.ExplosionNukeRayParallelized;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.util.ContaminationUtil;
|
||||
import com.hbm.util.ContaminationUtil.ContaminationType;
|
||||
@ -70,13 +69,11 @@ public class EntityNukeExplosionMK5 extends EntityExplosionChunkloading {
|
||||
|
||||
if(explosion == null) {
|
||||
explosionStart = System.currentTimeMillis();
|
||||
if (BombConfig.explosionAlgorithm == 1 || BombConfig.explosionAlgorithm == 2) {
|
||||
explosion = new ExplosionNukeRayParallelized(worldObj, posX, posY, posZ,
|
||||
strength, speed, length);
|
||||
} else {
|
||||
explosion = new ExplosionNukeRayBatched(worldObj, (int) posX, (int) posY, (int) posZ,
|
||||
strength, speed, length);
|
||||
}
|
||||
//if(BombConfig.explosionAlgorithm == 1 || BombConfig.explosionAlgorithm == 2) {
|
||||
// explosion = new ExplosionNukeRayParallelized(worldObj, posX, posY, posZ, strength, speed, length);
|
||||
//} else {
|
||||
explosion = new ExplosionNukeRayBatched(worldObj, (int) posX, (int) posY, (int) posZ, strength, speed, length);
|
||||
//}
|
||||
}
|
||||
|
||||
if(!explosion.isComplete()) {
|
||||
@ -162,6 +159,7 @@ public class EntityNukeExplosionMK5 extends EntityExplosionChunkloading {
|
||||
mk5.speed = (int)Math.ceil(100000 / mk5.strength);
|
||||
mk5.setPosition(x, y, z);
|
||||
mk5.length = mk5.strength / 2;
|
||||
mk5.loadChunk((int) Math.floor(x / 16D), (int) Math.floor(z / 16D));
|
||||
return mk5;
|
||||
}
|
||||
|
||||
|
||||
@ -281,12 +281,12 @@ public abstract class EntityMissileBaseNT extends EntityThrowableInterp implemen
|
||||
@Override
|
||||
protected void onImpact(MovingObjectPosition mop) {
|
||||
if(mop != null && mop.typeOfHit == mop.typeOfHit.BLOCK) {
|
||||
this.onImpact();
|
||||
this.onMissileImpact(mop);
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void onImpact();
|
||||
public abstract void onMissileImpact(MovingObjectPosition mop);
|
||||
public abstract List<ItemStack> getDebris();
|
||||
public abstract ItemStack getDebrisRareDrop();
|
||||
public void cluster() { }
|
||||
|
||||
@ -25,6 +25,7 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@ -161,7 +162,7 @@ public class EntityMissileCustom extends EntityMissileBaseNT implements IChunkLo
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onImpact() { //TODO: demolish this steaming pile of shit
|
||||
public void onMissileImpact(MovingObjectPosition mop) { //TODO: demolish this steaming pile of shit
|
||||
|
||||
ItemCustomMissilePart part = (ItemCustomMissilePart) Item.getItemById(this.dataWatcher.getWatchableObjectInt(9));
|
||||
|
||||
|
||||
@ -15,6 +15,7 @@ import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityMissileShuttle extends EntityMissileBaseNT {
|
||||
@ -28,7 +29,7 @@ public class EntityMissileShuttle extends EntityMissileBaseNT {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onImpact() {
|
||||
public void onMissileImpact(MovingObjectPosition mop) {
|
||||
ExplosionNT explosion = new ExplosionNT(worldObj, null, this.posX + 0.5F, this.posY + 0.5F, this.posZ + 0.5F, 20.0F).overrideResolution(64);
|
||||
explosion.atttributes.add(ExAttrib.NOSOUND);
|
||||
explosion.atttributes.add(ExAttrib.NOPARTICLE);
|
||||
|
||||
@ -10,6 +10,7 @@ import com.hbm.particle.helper.ExplosionCreator;
|
||||
import com.hbm.items.ModItems;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityMissileStealth extends EntityMissileBaseNT {
|
||||
@ -27,7 +28,7 @@ public class EntityMissileStealth extends EntityMissileBaseNT {
|
||||
@Override public ItemStack getMissileItemForInfo() { return new ItemStack(ModItems.missile_stealth); }
|
||||
@Override public boolean canBeSeenBy(Object radar) { return false; }
|
||||
|
||||
@Override public void onImpact() { this.explodeStandard(20F, 24, false); ExplosionCreator.composeEffectStandard(worldObj, posX, posY, posZ); }
|
||||
@Override public void onMissileImpact(MovingObjectPosition mop) { this.explodeStandard(20F, 24, false); ExplosionCreator.composeEffectStandard(worldObj, posX, posY, posZ); }
|
||||
@Override public ItemStack getDebrisRareDrop() { return DictFrame.fromOne(ModItems.powder_ash, EnumAshType.MISC); }
|
||||
|
||||
}
|
||||
|
||||
@ -16,11 +16,13 @@ import com.hbm.inventory.material.Mats;
|
||||
import com.hbm.items.ModItems;
|
||||
|
||||
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo;
|
||||
import com.hbm.world.WorldUtil;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class EntityMissileTier0 extends EntityMissileBaseNT {
|
||||
@ -49,7 +51,7 @@ public abstract class EntityMissileTier0 extends EntityMissileBaseNT {
|
||||
@Override public ItemStack getDebrisRareDrop() { return null; }
|
||||
@Override public ItemStack getMissileItemForInfo() { return new ItemStack(ModItems.missile_test); }
|
||||
|
||||
@Override public void onImpact() {
|
||||
@Override public void onMissileImpact(MovingObjectPosition mop) {
|
||||
int x = (int) Math.floor(posX);
|
||||
int y = (int) Math.floor(posY);
|
||||
int z = (int) Math.floor(posZ);
|
||||
@ -80,7 +82,7 @@ public abstract class EntityMissileTier0 extends EntityMissileBaseNT {
|
||||
public static class EntityMissileMicro extends EntityMissileTier0 {
|
||||
public EntityMissileMicro(World world) { super(world); }
|
||||
public EntityMissileMicro(World world, float x, float y, float z, int a, int b) { super(world, x, y, z, a, b); }
|
||||
@Override public void onImpact() { ExplosionNukeSmall.explode(worldObj, posX, posY + 0.5, posZ, ExplosionNukeSmall.PARAMS_HIGH); }
|
||||
@Override public void onMissileImpact(MovingObjectPosition mop) { ExplosionNukeSmall.explode(worldObj, posX, posY + 0.5, posZ, ExplosionNukeSmall.PARAMS_HIGH); }
|
||||
@Override public ItemStack getDebrisRareDrop() { return DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.NUKE_HIGH); }
|
||||
@Override public ItemStack getMissileItemForInfo() { return new ItemStack(ModItems.missile_micro); }
|
||||
}
|
||||
@ -88,10 +90,10 @@ public abstract class EntityMissileTier0 extends EntityMissileBaseNT {
|
||||
public static class EntityMissileSchrabidium extends EntityMissileTier0 {
|
||||
public EntityMissileSchrabidium(World world) { super(world); }
|
||||
public EntityMissileSchrabidium(World world, float x, float y, float z, int a, int b) { super(world, x, y, z, a, b); }
|
||||
@Override public void onImpact() {
|
||||
@Override public void onMissileImpact(MovingObjectPosition mop) {
|
||||
EntityNukeExplosionMK3 ex = EntityNukeExplosionMK3.statFacFleija(worldObj, posX, posY, posZ, BombConfig.aSchrabRadius);
|
||||
if(!ex.isDead) {
|
||||
worldObj.spawnEntityInWorld(ex);
|
||||
WorldUtil.loadAndSpawnEntityInWorld(ex);
|
||||
EntityCloudFleija cloud = new EntityCloudFleija(this.worldObj, BombConfig.aSchrabRadius);
|
||||
cloud.posX = this.posX;
|
||||
cloud.posY = this.posY;
|
||||
@ -106,7 +108,7 @@ public abstract class EntityMissileTier0 extends EntityMissileBaseNT {
|
||||
public static class EntityMissileBHole extends EntityMissileTier0 {
|
||||
public EntityMissileBHole(World world) { super(world); }
|
||||
public EntityMissileBHole(World world, float x, float y, float z, int a, int b) { super(world, x, y, z, a, b); }
|
||||
@Override public void onImpact() {
|
||||
@Override public void onMissileImpact(MovingObjectPosition mop) {
|
||||
this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 1.5F, true);
|
||||
EntityBlackHole bl = new EntityBlackHole(this.worldObj, 1.5F);
|
||||
bl.posX = this.posX;
|
||||
@ -121,15 +123,15 @@ public abstract class EntityMissileTier0 extends EntityMissileBaseNT {
|
||||
public static class EntityMissileTaint extends EntityMissileTier0 {
|
||||
public EntityMissileTaint(World world) { super(world); }
|
||||
public EntityMissileTaint(World world, float x, float y, float z, int a, int b) { super(world, x, y, z, a, b); }
|
||||
@Override public void onImpact() {
|
||||
this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 10.0F, true);
|
||||
@Override public void onMissileImpact(MovingObjectPosition mop) {
|
||||
this.worldObj.createExplosion(this, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, 5.0F, true);
|
||||
for(int i = 0; i < 100; i++) {
|
||||
int a = rand.nextInt(11) + (int) this.posX - 5;
|
||||
int b = rand.nextInt(11) + (int) this.posY - 5;
|
||||
int c = rand.nextInt(11) + (int) this.posZ - 5;
|
||||
int a = rand.nextInt(11) + (int) mop.blockX - 5;
|
||||
int b = rand.nextInt(11) + (int) mop.blockY - 5;
|
||||
int c = rand.nextInt(11) + (int) mop.blockZ - 5;
|
||||
Block block = worldObj.getBlock(a, b, c);
|
||||
if(block.isNormalCube() && !block.isAir(worldObj, a, b, c)) {
|
||||
worldObj.setBlock(a, b, c, ModBlocks.taint, rand.nextInt(3) + 4, 2);
|
||||
worldObj.setBlock(a, b, c, ModBlocks.taint, 0, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -140,7 +142,7 @@ public abstract class EntityMissileTier0 extends EntityMissileBaseNT {
|
||||
public static class EntityMissileEMP extends EntityMissileTier0 {
|
||||
public EntityMissileEMP(World world) { super(world); }
|
||||
public EntityMissileEMP(World world, float x, float y, float z, int a, int b) { super(world, x, y, z, a, b); }
|
||||
@Override public void onImpact() {
|
||||
@Override public void onMissileImpact(MovingObjectPosition mop) {
|
||||
ExplosionNukeGeneric.empBlast(worldObj, (int)posX, (int)posY, (int)posZ, 50);
|
||||
EntityEMPBlast wave = new EntityEMPBlast(worldObj, 50);
|
||||
wave.posX = posX;
|
||||
|
||||
@ -10,6 +10,7 @@ import com.hbm.particle.helper.ExplosionCreator;
|
||||
|
||||
import api.hbm.entity.IRadarDetectableNT;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class EntityMissileTier1 extends EntityMissileBaseNT {
|
||||
@ -33,7 +34,7 @@ public abstract class EntityMissileTier1 extends EntityMissileBaseNT {
|
||||
public static class EntityMissileGeneric extends EntityMissileTier1 {
|
||||
public EntityMissileGeneric(World world) { super(world); }
|
||||
public EntityMissileGeneric(World world, float x, float y, float z, int a, int b) { super(world, x, y, z, a, b); }
|
||||
@Override public void onImpact() { this.explodeStandard(15F, 24, false); ExplosionCreator.composeEffectSmall(worldObj, posX, posY, posZ); }
|
||||
@Override public void onMissileImpact(MovingObjectPosition mop) { this.explodeStandard(15F, 24, false); ExplosionCreator.composeEffectSmall(worldObj, posX, posY, posZ); }
|
||||
@Override public ItemStack getDebrisRareDrop() { return new ItemStack(ModItems.warhead_generic_small); }
|
||||
@Override public ItemStack getMissileItemForInfo() { return new ItemStack(ModItems.missile_generic); }
|
||||
}
|
||||
@ -41,7 +42,7 @@ public abstract class EntityMissileTier1 extends EntityMissileBaseNT {
|
||||
public static class EntityMissileDecoy extends EntityMissileTier1 {
|
||||
public EntityMissileDecoy(World world) { super(world); }
|
||||
public EntityMissileDecoy(World world, float x, float y, float z, int a, int b) { super(world, x, y, z, a, b); }
|
||||
@Override public void onImpact() { worldObj.newExplosion(this, posX, posY, posZ, 4F, false, false); }
|
||||
@Override public void onMissileImpact(MovingObjectPosition mop) { worldObj.newExplosion(this, posX, posY, posZ, 4F, false, false); }
|
||||
@Override public ItemStack getDebrisRareDrop() { return new ItemStack(ModItems.ingot_steel); }
|
||||
@Override public String getUnlocalizedName() { return "radar.target.tier4"; }
|
||||
@Override public int getBlipLevel() { return IRadarDetectableNT.TIER4; }
|
||||
@ -51,7 +52,7 @@ public abstract class EntityMissileTier1 extends EntityMissileBaseNT {
|
||||
public static class EntityMissileIncendiary extends EntityMissileTier1 {
|
||||
public EntityMissileIncendiary(World world) { super(world); }
|
||||
public EntityMissileIncendiary(World world, float x, float y, float z, int a, int b) { super(world, x, y, z, a, b); }
|
||||
@Override public void onImpact() { this.explodeStandard(15F, 24, true); ExplosionCreator.composeEffectSmall(worldObj, posX, posY, posZ); }
|
||||
@Override public void onMissileImpact(MovingObjectPosition mop) { this.explodeStandard(15F, 24, true); ExplosionCreator.composeEffectSmall(worldObj, posX, posY, posZ); }
|
||||
@Override public ItemStack getDebrisRareDrop() { return new ItemStack(ModItems.warhead_incendiary_small); }
|
||||
@Override public ItemStack getMissileItemForInfo() { return new ItemStack(ModItems.missile_incendiary); }
|
||||
}
|
||||
@ -59,11 +60,11 @@ public abstract class EntityMissileTier1 extends EntityMissileBaseNT {
|
||||
public static class EntityMissileCluster extends EntityMissileTier1 {
|
||||
public EntityMissileCluster(World world) { super(world); }
|
||||
public EntityMissileCluster(World world, float x, float y, float z, int a, int b) { super(world, x, y, z, a, b); this.isCluster = true; }
|
||||
@Override public void onImpact() {
|
||||
@Override public void onMissileImpact(MovingObjectPosition mop) {
|
||||
this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 5F, true);
|
||||
ExplosionChaos.cluster(this.worldObj, (int)this.posX, (int)this.posY, (int)this.posZ, 25, 100);
|
||||
}
|
||||
@Override public void cluster() { this.onImpact(); }
|
||||
@Override public void cluster() { this.onMissileImpact(null); }
|
||||
@Override public ItemStack getDebrisRareDrop() { return new ItemStack(ModItems.warhead_cluster_small); }
|
||||
@Override public ItemStack getMissileItemForInfo() { return new ItemStack(ModItems.missile_cluster); }
|
||||
}
|
||||
@ -71,7 +72,7 @@ public abstract class EntityMissileTier1 extends EntityMissileBaseNT {
|
||||
public static class EntityMissileBunkerBuster extends EntityMissileTier1 {
|
||||
public EntityMissileBunkerBuster(World world) { super(world); }
|
||||
public EntityMissileBunkerBuster(World world, float x, float y, float z, int a, int b) { super(world, x, y, z, a, b); }
|
||||
@Override public void onImpact() {
|
||||
@Override public void onMissileImpact(MovingObjectPosition mop) {
|
||||
for(int i = 0; i < 15; i++) this.worldObj.createExplosion(this, this.posX, this.posY - i, this.posZ, 5F, true);
|
||||
ExplosionLarge.spawnParticles(worldObj, this.posX, this.posY, this.posZ, 5);
|
||||
ExplosionLarge.spawnShrapnels(worldObj, this.posX, this.posY, this.posZ, 5);
|
||||
|
||||
@ -11,6 +11,7 @@ import com.hbm.particle.helper.ExplosionCreator;
|
||||
|
||||
import api.hbm.entity.IRadarDetectableNT;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class EntityMissileTier2 extends EntityMissileBaseNT {
|
||||
@ -42,7 +43,7 @@ public abstract class EntityMissileTier2 extends EntityMissileBaseNT {
|
||||
public static class EntityMissileStrong extends EntityMissileTier2 {
|
||||
public EntityMissileStrong(World world) { super(world); }
|
||||
public EntityMissileStrong(World world, float x, float y, float z, int a, int b) { super(world, x, y, z, a, b); }
|
||||
@Override public void onImpact() { this.explodeStandard(30F, 32, false); ExplosionCreator.composeEffectStandard(worldObj, posX, posY, posZ); }
|
||||
@Override public void onMissileImpact(MovingObjectPosition mop) { this.explodeStandard(30F, 32, false); ExplosionCreator.composeEffectStandard(worldObj, posX, posY, posZ); }
|
||||
@Override public ItemStack getDebrisRareDrop() { return new ItemStack(ModItems.warhead_generic_medium); }
|
||||
@Override public ItemStack getMissileItemForInfo() { return new ItemStack(ModItems.missile_strong); }
|
||||
}
|
||||
@ -50,7 +51,7 @@ public abstract class EntityMissileTier2 extends EntityMissileBaseNT {
|
||||
public static class EntityMissileIncendiaryStrong extends EntityMissileTier2 {
|
||||
public EntityMissileIncendiaryStrong(World world) { super(world); }
|
||||
public EntityMissileIncendiaryStrong(World world, float x, float y, float z, int a, int b) { super(world, x, y, z, a, b); }
|
||||
@Override public void onImpact() {
|
||||
@Override public void onMissileImpact(MovingObjectPosition mop) {
|
||||
this.explodeStandard(30F, 32, true);
|
||||
ExplosionCreator.composeEffectStandard(worldObj, posX, posY, posZ);
|
||||
ExplosionChaos.flameDeath(this.worldObj, (int)((float)this.posX + 0.5F), (int)((float)this.posY + 0.5F), (int)((float)this.posZ + 0.5F), 25);
|
||||
@ -62,11 +63,11 @@ public abstract class EntityMissileTier2 extends EntityMissileBaseNT {
|
||||
public static class EntityMissileClusterStrong extends EntityMissileTier2 {
|
||||
public EntityMissileClusterStrong(World world) { super(world); }
|
||||
public EntityMissileClusterStrong(World world, float x, float y, float z, int a, int b) { super(world, x, y, z, a, b); this.isCluster = true; }
|
||||
@Override public void onImpact() {
|
||||
@Override public void onMissileImpact(MovingObjectPosition mop) {
|
||||
this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 15F, true);
|
||||
ExplosionChaos.cluster(this.worldObj, (int)this.posX, (int)this.posY, (int)this.posZ, 50, 100);
|
||||
}
|
||||
@Override public void cluster() { this.onImpact(); }
|
||||
@Override public void cluster() { this.onMissileImpact(null); }
|
||||
@Override public ItemStack getDebrisRareDrop() { return new ItemStack(ModItems.warhead_cluster_medium); }
|
||||
@Override public ItemStack getMissileItemForInfo() { return new ItemStack(ModItems.missile_cluster_strong); }
|
||||
}
|
||||
@ -74,7 +75,7 @@ public abstract class EntityMissileTier2 extends EntityMissileBaseNT {
|
||||
public static class EntityMissileBusterStrong extends EntityMissileTier2 {
|
||||
public EntityMissileBusterStrong(World world) { super(world); }
|
||||
public EntityMissileBusterStrong(World world, float x, float y, float z, int a, int b) { super(world, x, y, z, a, b); }
|
||||
@Override public void onImpact() {
|
||||
@Override public void onMissileImpact(MovingObjectPosition mop) {
|
||||
for(int i = 0; i < 20; i++) this.worldObj.createExplosion(this, this.posX, this.posY - i, this.posZ, 7.5F, true);
|
||||
ExplosionLarge.spawnParticles(worldObj, this.posX, this.posY, this.posZ, 8);
|
||||
ExplosionLarge.spawnShrapnels(worldObj, this.posX, this.posY, this.posZ, 8);
|
||||
@ -87,7 +88,7 @@ public abstract class EntityMissileTier2 extends EntityMissileBaseNT {
|
||||
public static class EntityMissileEMPStrong extends EntityMissileTier2 {
|
||||
public EntityMissileEMPStrong(World world) { super(world); }
|
||||
public EntityMissileEMPStrong(World world, float x, float y, float z, int a, int b) { super(world, x, y, z, a, b); }
|
||||
@Override public void onImpact() {
|
||||
@Override public void onMissileImpact(MovingObjectPosition mop) {
|
||||
EntityEMP emp = new EntityEMP(worldObj);
|
||||
emp.posX = posX;
|
||||
emp.posY = posY;
|
||||
|
||||
@ -12,6 +12,7 @@ import com.hbm.particle.helper.ExplosionCreator;
|
||||
|
||||
import api.hbm.entity.IRadarDetectableNT;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@ -58,7 +59,7 @@ public abstract class EntityMissileTier3 extends EntityMissileBaseNT {
|
||||
public static class EntityMissileBurst extends EntityMissileTier3 {
|
||||
public EntityMissileBurst(World world) { super(world); }
|
||||
public EntityMissileBurst(World world, float x, float y, float z, int a, int b) { super(world, x, y, z, a, b); }
|
||||
@Override public void onImpact() {
|
||||
@Override public void onMissileImpact(MovingObjectPosition mop) {
|
||||
this.explodeStandard(50F, 48, false);
|
||||
ExplosionCreator.composeEffectLarge(worldObj, posX, posY, posZ);
|
||||
}
|
||||
@ -69,7 +70,7 @@ public abstract class EntityMissileTier3 extends EntityMissileBaseNT {
|
||||
public static class EntityMissileInferno extends EntityMissileTier3 {
|
||||
public EntityMissileInferno(World world) { super(world); }
|
||||
public EntityMissileInferno(World world, float x, float y, float z, int a, int b) { super(world, x, y, z, a, b); }
|
||||
@Override public void onImpact() {
|
||||
@Override public void onMissileImpact(MovingObjectPosition mop) {
|
||||
this.explodeStandard(50F, 48, true);
|
||||
ExplosionCreator.composeEffectLarge(worldObj, posX, posY, posZ);
|
||||
ExplosionChaos.burn(this.worldObj, (int)this.posX, (int)this.posY, (int)this.posZ, 10);
|
||||
@ -82,11 +83,11 @@ public abstract class EntityMissileTier3 extends EntityMissileBaseNT {
|
||||
public static class EntityMissileRain extends EntityMissileTier3 {
|
||||
public EntityMissileRain(World world) { super(world); }
|
||||
public EntityMissileRain(World world, float x, float y, float z, int a, int b) { super(world, x, y, z, a, b); this.isCluster = true; }
|
||||
@Override public void onImpact() {
|
||||
@Override public void onMissileImpact(MovingObjectPosition mop) {
|
||||
this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 25F, true);
|
||||
ExplosionChaos.cluster(this.worldObj, (int)this.posX, (int)this.posY, (int)this.posZ, 100, 100);
|
||||
}
|
||||
@Override public void cluster() { this.onImpact(); }
|
||||
@Override public void cluster() { this.onMissileImpact(null); }
|
||||
@Override public ItemStack getDebrisRareDrop() { return new ItemStack(ModItems.warhead_cluster_large); }
|
||||
@Override public ItemStack getMissileItemForInfo() { return new ItemStack(ModItems.missile_rain); }
|
||||
}
|
||||
@ -94,7 +95,7 @@ public abstract class EntityMissileTier3 extends EntityMissileBaseNT {
|
||||
public static class EntityMissileDrill extends EntityMissileTier3 {
|
||||
public EntityMissileDrill(World world) { super(world); }
|
||||
public EntityMissileDrill(World world, float x, float y, float z, int a, int b) { super(world, x, y, z, a, b); }
|
||||
@Override public void onImpact() {
|
||||
@Override public void onMissileImpact(MovingObjectPosition mop) {
|
||||
for(int i = 0; i < 30; i++) {
|
||||
ExplosionNT explosion = new ExplosionNT(worldObj, this, this.posX, this.posY - i, this.posZ, 10F);
|
||||
explosion.addAllAttrib(ExAttrib.ERRODE);
|
||||
|
||||
@ -9,9 +9,11 @@ import com.hbm.entity.effect.EntityNukeTorex;
|
||||
import com.hbm.entity.logic.EntityNukeExplosionMK5;
|
||||
import com.hbm.explosion.ExplosionLarge;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.world.WorldUtil;
|
||||
|
||||
import api.hbm.entity.IRadarDetectableNT;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@ -63,8 +65,8 @@ public abstract class EntityMissileTier4 extends EntityMissileBaseNT {
|
||||
public static class EntityMissileNuclear extends EntityMissileTier4 {
|
||||
public EntityMissileNuclear(World world) { super(world); }
|
||||
public EntityMissileNuclear(World world, float x, float y, float z, int a, int b) { super(world, x, y, z, a, b); }
|
||||
@Override public void onImpact() {
|
||||
this.worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(worldObj, BombConfig.missileRadius, posX, posY, posZ));
|
||||
@Override public void onMissileImpact(MovingObjectPosition mop) {
|
||||
WorldUtil.loadAndSpawnEntityInWorld(EntityNukeExplosionMK5.statFac(worldObj, BombConfig.missileRadius, posX, posY, posZ));
|
||||
EntityNukeTorex.statFacStandard(worldObj, posX, posY, posZ, BombConfig.missileRadius);
|
||||
}
|
||||
@Override public ItemStack getDebrisRareDrop() { return new ItemStack(ModItems.warhead_nuclear); }
|
||||
@ -74,8 +76,8 @@ public abstract class EntityMissileTier4 extends EntityMissileBaseNT {
|
||||
public static class EntityMissileMirv extends EntityMissileTier4 {
|
||||
public EntityMissileMirv(World world) { super(world); }
|
||||
public EntityMissileMirv(World world, float x, float y, float z, int a, int b) { super(world, x, y, z, a, b); }
|
||||
@Override public void onImpact() {
|
||||
worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(worldObj, BombConfig.missileRadius * 2, posX, posY, posZ));
|
||||
@Override public void onMissileImpact(MovingObjectPosition mop) {
|
||||
WorldUtil.loadAndSpawnEntityInWorld(EntityNukeExplosionMK5.statFac(worldObj, BombConfig.missileRadius * 2, posX, posY, posZ));
|
||||
EntityNukeTorex.statFacStandard(worldObj, posX, posY, posZ, BombConfig.missileRadius * 2);
|
||||
}
|
||||
@Override public List<ItemStack> getDebris() {
|
||||
@ -93,7 +95,7 @@ public abstract class EntityMissileTier4 extends EntityMissileBaseNT {
|
||||
public static class EntityMissileVolcano extends EntityMissileTier4 {
|
||||
public EntityMissileVolcano(World world) { super(world); }
|
||||
public EntityMissileVolcano(World world, float x, float y, float z, int a, int b) { super(world, x, y, z, a, b); }
|
||||
@Override public void onImpact() {
|
||||
@Override public void onMissileImpact(MovingObjectPosition mop) {
|
||||
ExplosionLarge.explode(worldObj, posX, posY, posZ, 10.0F, true, true, true);
|
||||
for(int x = -1; x <= 1; x++) for(int y = -1; y <= 1; y++) for(int z = -1; z <= 1; z++) worldObj.setBlock((int)Math.floor(posX + x), (int)Math.floor(posY + y), (int)Math.floor(posZ + z), ModBlocks.volcanic_lava_block);
|
||||
worldObj.setBlock((int)Math.floor(posX), (int)Math.floor(posY), (int)Math.floor(posZ), ModBlocks.volcano_core);
|
||||
@ -105,8 +107,8 @@ public abstract class EntityMissileTier4 extends EntityMissileBaseNT {
|
||||
public static class EntityMissileDoomsday extends EntityMissileTier4 {
|
||||
public EntityMissileDoomsday(World world) { super(world); }
|
||||
public EntityMissileDoomsday(World world, float x, float y, float z, int a, int b) { super(world, x, y, z, a, b); }
|
||||
@Override public void onImpact() {
|
||||
this.worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(worldObj, BombConfig.missileRadius * 2, posX, posY, posZ).moreFallout(100));
|
||||
@Override public void onMissileImpact(MovingObjectPosition mop) {
|
||||
WorldUtil.loadAndSpawnEntityInWorld(EntityNukeExplosionMK5.statFac(worldObj, BombConfig.missileRadius * 2, posX, posY, posZ).moreFallout(100));
|
||||
EntityNukeTorex.statFacStandard(worldObj, posX, posY, posZ, BombConfig.missileRadius * 2);
|
||||
}
|
||||
@Override public List<ItemStack> getDebris() { return null; }
|
||||
@ -118,8 +120,8 @@ public abstract class EntityMissileTier4 extends EntityMissileBaseNT {
|
||||
public static class EntityMissileDoomsdayRusted extends EntityMissileDoomsday {
|
||||
public EntityMissileDoomsdayRusted(World world) { super(world); }
|
||||
public EntityMissileDoomsdayRusted(World world, float x, float y, float z, int a, int b) { super(world, x, y, z, a, b); }
|
||||
@Override public void onImpact() {
|
||||
this.worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(worldObj, BombConfig.missileRadius, posX, posY, posZ).moreFallout(100));
|
||||
@Override public void onMissileImpact(MovingObjectPosition mop) {
|
||||
WorldUtil.loadAndSpawnEntityInWorld(EntityNukeExplosionMK5.statFac(worldObj, BombConfig.missileRadius, posX, posY, posZ).moreFallout(100));
|
||||
EntityNukeTorex.statFacStandard(worldObj, posX, posY, posZ, BombConfig.missileRadius);
|
||||
}
|
||||
@Override public ItemStack getMissileItemForInfo() { return new ItemStack(ModItems.missile_doomsday_rusted); }
|
||||
|
||||
@ -3,6 +3,7 @@ package com.hbm.entity.mob;
|
||||
import com.hbm.entity.projectile.EntityBullet;
|
||||
import com.hbm.entity.projectile.EntityChopperMine;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.interfaces.Spaghetti;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
@ -26,6 +27,7 @@ import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.EnumDifficulty;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@Spaghetti("this sucks complete donkey shit")
|
||||
public class EntityHunterChopper extends EntityFlying implements IMob, IBossDisplayData, IRadiationImmune {
|
||||
|
||||
public int courseChangeCooldown;
|
||||
@ -335,20 +337,6 @@ public class EntityHunterChopper extends EntityFlying implements IMob, IBossDisp
|
||||
* kill this mob.
|
||||
*/
|
||||
protected void dropItems() {
|
||||
|
||||
if(rand.nextInt(2) == 0)
|
||||
this.dropItem(ModItems.chopper_head, 1);
|
||||
if(rand.nextInt(2) == 0)
|
||||
this.dropItem(ModItems.chopper_torso, 1);
|
||||
if(rand.nextInt(2) == 0)
|
||||
this.dropItem(ModItems.chopper_wing, 1);
|
||||
if(rand.nextInt(3) == 0)
|
||||
this.dropItem(ModItems.chopper_tail, 1);
|
||||
if(rand.nextInt(3) == 0)
|
||||
this.dropItem(ModItems.chopper_gun, 1);
|
||||
if(rand.nextInt(3) == 0)
|
||||
this.dropItem(ModItems.chopper_blades, 1);
|
||||
|
||||
this.dropItem(ModItems.combine_scrap, rand.nextInt(8) + 1);
|
||||
this.dropItem(ModItems.plate_combine_steel, rand.nextInt(5) + 1);
|
||||
}
|
||||
|
||||
@ -16,10 +16,11 @@ import net.minecraft.entity.monster.EntityMob;
|
||||
import net.minecraft.entity.passive.EntityVillager;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.EnumDifficulty;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityUndeadSoldier extends EntityMob {
|
||||
|
||||
|
||||
public static final int DW_TYPE = 12;
|
||||
public static final byte TYPE_ZOMBIE = 0;
|
||||
public static final byte TYPE_SKELETON = 1;
|
||||
@ -66,7 +67,7 @@ public class EntityUndeadSoldier extends EntityMob {
|
||||
this.setCurrentItemOrArmor(3, new ItemStack(ModItems.taurun_plate));
|
||||
this.setCurrentItemOrArmor(2, new ItemStack(ModItems.taurun_legs));
|
||||
this.setCurrentItemOrArmor(1, new ItemStack(ModItems.taurun_boots));
|
||||
|
||||
|
||||
int gun = rand.nextInt(5);
|
||||
if(gun == 0) this.setCurrentItemOrArmor(0, new ItemStack(ModItems.gun_heavy_revolver));
|
||||
if(gun == 1) this.setCurrentItemOrArmor(0, new ItemStack(ModItems.gun_light_revolver));
|
||||
@ -74,7 +75,7 @@ public class EntityUndeadSoldier extends EntityMob {
|
||||
if(gun == 3) this.setCurrentItemOrArmor(0, new ItemStack(ModItems.gun_maresleg));
|
||||
if(gun == 4) this.setCurrentItemOrArmor(0, new ItemStack(ModItems.gun_greasegun));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String getLivingSound() {
|
||||
byte type = this.dataWatcher.getWatchableObjectByte(DW_TYPE);
|
||||
@ -110,7 +111,12 @@ public class EntityUndeadSoldier extends EntityMob {
|
||||
public EnumCreatureAttribute getCreatureAttribute() {
|
||||
return EnumCreatureAttribute.UNDEAD;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean getCanSpawnHere() {
|
||||
return this.worldObj.difficultySetting != EnumDifficulty.PEACEFUL && this.worldObj.checkNoEntityCollision(this.boundingBox) && this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox).isEmpty() && !this.worldObj.isAnyLiquid(this.boundingBox);
|
||||
}
|
||||
|
||||
@Override protected void dropFewItems(boolean player, int loot) { }
|
||||
@Override protected void dropEquipment(boolean player, int loot) { }
|
||||
}
|
||||
|
||||
@ -31,7 +31,6 @@ public class EntityModFX extends Entity
|
||||
public static double interpPosX;
|
||||
public static double interpPosY;
|
||||
public static double interpPosZ;
|
||||
public static final String __OBFID = "CL_00000914";
|
||||
float smokeParticleScale;
|
||||
public int particleAge;
|
||||
public int maxAge;
|
||||
@ -39,7 +38,7 @@ public class EntityModFX extends Entity
|
||||
public EntityModFX(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
|
||||
protected EntityModFX(World p_i1218_1_, double p_i1218_2_, double p_i1218_4_, double p_i1218_6_)
|
||||
{
|
||||
super(p_i1218_1_);
|
||||
@ -257,7 +256,7 @@ public class EntityModFX extends Entity
|
||||
{
|
||||
return this.getClass().getSimpleName() + ", Pos (" + this.posX + "," + this.posY + "," + this.posZ + "), RGBA (" + this.particleRed + "," + this.particleGreen + "," + this.particleBlue + "," + this.particleAlpha + "), Age " + this.particleAge;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean isInRangeToRenderDist(double distance)
|
||||
|
||||
@ -2,14 +2,19 @@ package com.hbm.entity.projectile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.items.weapon.sedna.BulletConfig;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.monster.EntityMob;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
@ -144,9 +149,30 @@ public class EntityBulletBeamBase extends Entity implements IEntityAdditionalSpa
|
||||
if(!this.worldObj.isRemote && this.doesImpactEntities()) {
|
||||
|
||||
Entity hitEntity = null;
|
||||
List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.headingX, this.headingY, this.headingZ).expand(1.0D, 1.0D, 1.0D));
|
||||
List<Entity> list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.headingX, this.headingY, this.headingZ).expand(1.0D, 1.0D, 1.0D));
|
||||
double nearest = 0.0D;
|
||||
MovingObjectPosition nonPenImpact = null;
|
||||
MovingObjectPosition coinHit = null;
|
||||
|
||||
double closestCoin = 0;
|
||||
EntityCoin hitCoin = null;
|
||||
|
||||
for(Entity entity : list) {
|
||||
if(entity.isDead) continue;
|
||||
if(entity instanceof EntityCoin) {
|
||||
double hitbox = 0.3F;
|
||||
AxisAlignedBB aabb = entity.boundingBox.expand(hitbox, hitbox, hitbox);
|
||||
MovingObjectPosition hitMop = aabb.calculateIntercept(pos, nextPos);
|
||||
if(hitMop != null) {
|
||||
double dist = pos.distanceTo(hitMop.hitVec);
|
||||
if(closestCoin == 0 || dist < closestCoin) {
|
||||
closestCoin = dist;
|
||||
hitCoin = (EntityCoin) entity;
|
||||
coinHit = hitMop;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(int j = 0; j < list.size(); ++j) {
|
||||
Entity entity = (Entity) list.get(j);
|
||||
@ -158,13 +184,14 @@ public class EntityBulletBeamBase extends Entity implements IEntityAdditionalSpa
|
||||
|
||||
if(hitMop != null) {
|
||||
|
||||
double dist = pos.distanceTo(hitMop.hitVec);
|
||||
|
||||
// if penetration is enabled, run impact for all intersecting entities
|
||||
if(this.doesPenetrate()) {
|
||||
this.onImpact(new MovingObjectPosition(entity, hitMop.hitVec));
|
||||
if(hitCoin == null || dist < closestCoin) {
|
||||
this.onImpact(new MovingObjectPosition(entity, hitMop.hitVec));
|
||||
}
|
||||
} else {
|
||||
|
||||
double dist = pos.distanceTo(hitMop.hitVec);
|
||||
|
||||
if(dist < nearest || nearest == 0.0D) {
|
||||
hitEntity = entity;
|
||||
nearest = dist;
|
||||
@ -179,6 +206,86 @@ public class EntityBulletBeamBase extends Entity implements IEntityAdditionalSpa
|
||||
if(!this.doesPenetrate() && hitEntity != null) {
|
||||
mop = new MovingObjectPosition(hitEntity, nonPenImpact.hitVec);
|
||||
}
|
||||
|
||||
if(hitCoin != null) {
|
||||
Vec3 vec = Vec3.createVectorHelper(coinHit.hitVec.xCoord - posX, coinHit.hitVec.yCoord - posY, coinHit.hitVec.zCoord - posZ);
|
||||
this.beamLength = vec.lengthVector();
|
||||
|
||||
double range = 50;
|
||||
List<Entity> targets = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(coinHit.hitVec.xCoord, coinHit.hitVec.yCoord, coinHit.hitVec.zCoord, coinHit.hitVec.xCoord, coinHit.hitVec.yCoord, coinHit.hitVec.zCoord).expand(range, range, range));
|
||||
Entity nearestCoin = null;
|
||||
Entity nearestPlayer = null;
|
||||
Entity nearestMob = null;
|
||||
Entity nearestOther = null;
|
||||
double coinDist = 0;
|
||||
double playerDist = 0;
|
||||
double mobDist = 0;
|
||||
double otherDist = 0;
|
||||
|
||||
hitCoin.setDead();
|
||||
|
||||
// well i mean we could just uuse a single var for all variants and then overwrite stuff
|
||||
// when we run into things with higher priority. however i can't be assed fuck off
|
||||
for(Entity entity : targets) {
|
||||
if(entity == this.getThrower()) continue;
|
||||
if(entity.isDead) continue;
|
||||
double dist = entity.getDistanceToEntity(hitCoin);
|
||||
if(dist > range) continue;
|
||||
|
||||
if(entity instanceof EntityCoin) {
|
||||
if(coinDist == 0 || dist < coinDist) {
|
||||
coinDist = dist;
|
||||
nearestCoin = entity;
|
||||
}
|
||||
} else if(entity instanceof EntityPlayer) {
|
||||
if(playerDist == 0 || dist < playerDist) {
|
||||
playerDist = dist;
|
||||
nearestPlayer = entity;
|
||||
}
|
||||
} else if(entity instanceof EntityMob) {
|
||||
if(mobDist == 0 || dist < mobDist) {
|
||||
mobDist = dist;
|
||||
nearestMob = entity;
|
||||
}
|
||||
} else if(entity instanceof EntityLivingBase) {
|
||||
if(otherDist == 0 || dist < otherDist) {
|
||||
otherDist = dist;
|
||||
nearestOther = entity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ternary of shame
|
||||
Entity target = nearestCoin != null ? nearestCoin :
|
||||
nearestPlayer != null ? nearestPlayer :
|
||||
nearestMob != null ? nearestMob :
|
||||
nearestOther != null ? nearestOther : null;
|
||||
|
||||
if(target != null) {
|
||||
EntityBulletBeamBase newBeam = new EntityBulletBeamBase(hitCoin.getThrower() != null ? hitCoin.getThrower() : this.thrower, this.config, this.damage * 1.25F);
|
||||
newBeam.setPosition(coinHit.hitVec.xCoord, coinHit.hitVec.yCoord, coinHit.hitVec.zCoord);
|
||||
Vec3 delta = Vec3.createVectorHelper(target.posX - newBeam.posX, (target.posY + target.height / 2D) - newBeam.posY, target.posZ - newBeam.posZ);
|
||||
newBeam.setRotationsFromVector(delta);
|
||||
newBeam.performHitscanExternal(delta.lengthVector());
|
||||
worldObj.spawnEntityInWorld(newBeam);
|
||||
} else {
|
||||
EntityBulletBeamBase newBeam = new EntityBulletBeamBase(hitCoin.getThrower() != null ? hitCoin.getThrower() : this.thrower, this.config, this.damage * 1.25F);
|
||||
newBeam.setPosition(coinHit.hitVec.xCoord, coinHit.hitVec.yCoord, coinHit.hitVec.zCoord);
|
||||
newBeam.setRotationsFromVector(Vec3.createVectorHelper(rand.nextGaussian() * 0.5, -1, rand.nextGaussian() * 0.5));
|
||||
newBeam.performHitscanExternal(100);
|
||||
worldObj.spawnEntityInWorld(newBeam);
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "vanillaExt");
|
||||
data.setString("mode", "largeexplode");
|
||||
data.setFloat("size", 1.5F);
|
||||
data.setByte("count", (byte)1);
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, coinHit.hitVec.xCoord, coinHit.hitVec.yCoord, coinHit.hitVec.zCoord), new TargetPoint(worldObj.provider.dimensionId, coinHit.hitVec.xCoord, coinHit.hitVec.yCoord, coinHit.hitVec.zCoord, 100));
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(mop != null) {
|
||||
|
||||
51
src/main/java/com/hbm/entity/projectile/EntityCoin.java
Normal file
51
src/main/java/com/hbm/entity/projectile/EntityCoin.java
Normal file
@ -0,0 +1,51 @@
|
||||
package com.hbm.entity.projectile;
|
||||
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityCoin extends EntityThrowableInterp {
|
||||
|
||||
public EntityCoin(World world) {
|
||||
super(world);
|
||||
this.setSize(1F, 1F);
|
||||
this.yOffset = 0.5F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
}
|
||||
|
||||
public void setPosition(double x, double y, double z) {
|
||||
this.posX = x;
|
||||
this.posY = y;
|
||||
this.posZ = z;
|
||||
float f = this.width / 2.0F;
|
||||
this.boundingBox.setBounds(x - f, y - this.yOffset + this.ySize, z - f, x + f, y - this.yOffset + this.ySize + this.height, z + f);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onImpact(MovingObjectPosition mop) {
|
||||
if(mop.typeOfHit == mop.typeOfHit.BLOCK) this.setDead();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getAirDrag() {
|
||||
return 1F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getGravityVelocity() {
|
||||
return 0.02D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeCollidedWith() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAttackWithItem() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -6,8 +6,8 @@ import net.minecraft.init.Blocks;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ExplosionFleija
|
||||
{
|
||||
public class ExplosionFleija {
|
||||
|
||||
public int posX;
|
||||
public int posY;
|
||||
public int posZ;
|
||||
@ -23,7 +23,7 @@ public class ExplosionFleija
|
||||
private int element;
|
||||
public float explosionCoefficient = 1.0F;
|
||||
public float explosionCoefficient2 = 1.0F;
|
||||
|
||||
|
||||
public void saveToNbt(NBTTagCompound nbt, String name) {
|
||||
nbt.setInteger(name + "posX", posX);
|
||||
nbt.setInteger(name + "posY", posY);
|
||||
@ -40,7 +40,7 @@ public class ExplosionFleija
|
||||
nbt.setFloat(name + "explosionCoefficient", explosionCoefficient);
|
||||
nbt.setFloat(name + "explosionCoefficient2", explosionCoefficient2);
|
||||
}
|
||||
|
||||
|
||||
public void readFromNbt(NBTTagCompound nbt, String name) {
|
||||
posX = nbt.getInteger(name + "posX");
|
||||
posY = nbt.getInteger(name + "posY");
|
||||
@ -57,29 +57,28 @@ public class ExplosionFleija
|
||||
explosionCoefficient = nbt.getFloat(name + "explosionCoefficient");
|
||||
explosionCoefficient2 = nbt.getFloat(name + "explosionCoefficient2");
|
||||
}
|
||||
|
||||
public ExplosionFleija(int x, int y, int z, World world, int rad, float coefficient, float coefficient2)
|
||||
{
|
||||
|
||||
public ExplosionFleija(int x, int y, int z, World world, int rad, float coefficient, float coefficient2) {
|
||||
this.posX = x;
|
||||
this.posY = y;
|
||||
this.posZ = z;
|
||||
|
||||
|
||||
this.worldObj = world;
|
||||
|
||||
|
||||
this.radius = rad;
|
||||
this.radius2 = this.radius * this.radius;
|
||||
|
||||
this.explosionCoefficient = coefficient;
|
||||
this.explosionCoefficient2 = coefficient2;
|
||||
|
||||
|
||||
this.nlimit = this.radius2 * 4;
|
||||
}
|
||||
|
||||
public boolean update()
|
||||
{
|
||||
|
||||
public boolean update() {
|
||||
breakColumn(this.lastposX, this.lastposZ);
|
||||
this.shell = (int) Math.floor((Math.sqrt(n) + 1) / 2);
|
||||
int shell2 = this.shell * 2;
|
||||
if(shell2 == 0) return true; // end explosion if the shell size is 0 to prevent division by zero crash
|
||||
this.leg = (int) Math.floor((this.n - (shell2 - 1) * (shell2 - 1)) / shell2);
|
||||
this.element = (this.n - (shell2 - 1) * (shell2 - 1)) - shell2 * this.leg - this.shell + 1;
|
||||
this.lastposX = this.leg == 0 ? this.shell : this.leg == 1 ? -this.element : this.leg == 2 ? -this.shell : this.element;
|
||||
@ -88,15 +87,13 @@ public class ExplosionFleija
|
||||
return this.n > this.nlimit;
|
||||
}
|
||||
|
||||
private void breakColumn(int x, int z)
|
||||
{
|
||||
private void breakColumn(int x, int z) {
|
||||
int dist = this.radius2 - (x * x + z * z);
|
||||
if (dist > 0)
|
||||
{
|
||||
if(dist > 0) {
|
||||
dist = (int) Math.sqrt(dist);
|
||||
for (int y = (int)(dist / this.explosionCoefficient2); y > -dist / this.explosionCoefficient; y--)
|
||||
{
|
||||
if(this.posY + y > 0 && !(this.worldObj.getBlock(this.posX+x, this.posY+y, this.posZ+z) instanceof DecoBlockAlt))this.worldObj.setBlock(this.posX+x, this.posY+y, this.posZ+z, Blocks.air);
|
||||
for(int y = (int) (dist / this.explosionCoefficient2); y > -dist / this.explosionCoefficient; y--) {
|
||||
if(this.posY + y > 0 && !(this.worldObj.getBlock(this.posX + x, this.posY + y, this.posZ + z) instanceof DecoBlockAlt))
|
||||
this.worldObj.setBlock(this.posX + x, this.posY + y, this.posZ + z, Blocks.air);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@ import com.hbm.handler.radiation.ChunkRadiationManager;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.world.WorldUtil;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@ -33,7 +34,7 @@ import net.minecraft.world.World;
|
||||
if(params.shrapnelCount > 0) ExplosionLarge.spawnShrapnels(world, posX, posY, posZ, params.shrapnelCount);
|
||||
if(params.miniNuke && !params.safe) new ExplosionNT(world, null, posX, posY, posZ, params.blastRadius).addAllAttrib(params.explosionAttribs).overrideResolution(params.resolution).explode();
|
||||
if(params.killRadius > 0) ExplosionNukeGeneric.dealDamage(world, posX, posY, posZ, params.killRadius);
|
||||
if(!params.miniNuke) world.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(world, (int) params.blastRadius, posX, posY, posZ));
|
||||
if(!params.miniNuke) WorldUtil.loadAndSpawnEntityInWorld(EntityNukeExplosionMK5.statFac(world, (int) params.blastRadius, posX, posY, posZ));
|
||||
|
||||
if(params.miniNuke) {
|
||||
float radMod = params.radiationLevel / 3F;
|
||||
|
||||
@ -51,6 +51,7 @@ public class HbmLivingProps implements IExtendedEntityProperties {
|
||||
public int fire;
|
||||
public int phosphorus;
|
||||
public int balefire;
|
||||
public int blackFire;
|
||||
private List<ContaminationEffect> contamination = new ArrayList();
|
||||
|
||||
public HbmLivingProps(EntityLivingBase entity) {
|
||||
@ -320,6 +321,7 @@ public class HbmLivingProps implements IExtendedEntityProperties {
|
||||
props.setInteger("hfr_fire", fire);
|
||||
props.setInteger("hfr_phosphorus", phosphorus);
|
||||
props.setInteger("hfr_balefire", balefire);
|
||||
props.setInteger("hfr_blackfire", blackFire);
|
||||
|
||||
props.setInteger("hfr_cont_count", this.contamination.size());
|
||||
|
||||
@ -347,6 +349,7 @@ public class HbmLivingProps implements IExtendedEntityProperties {
|
||||
fire = props.getInteger("hfr_fire");
|
||||
phosphorus = props.getInteger("hfr_phosphorus");
|
||||
balefire = props.getInteger("hfr_balefire");
|
||||
blackFire = props.getInteger("hfr_blackfire");
|
||||
|
||||
int cont = props.getInteger("hfr_cont_count");
|
||||
|
||||
|
||||
@ -39,6 +39,9 @@ public class BobmazonOfferFactory {
|
||||
standard.add(new Offer(new ItemStack(ModItems.gun_kit_1, 1), Requirement.ASSEMBLY, 16));
|
||||
standard.add(new Offer(new ItemStack(ModItems.geiger_counter, 1), Requirement.NONE, 16));
|
||||
standard.add(new Offer(new ItemStack(ModItems.matchstick, 16), Requirement.STEEL, 2));
|
||||
//blueprints
|
||||
standard.add(new Offer(new ItemStack(ModItems.blueprint_folder, 1, 0), Requirement.ASSEMBLY, 64));
|
||||
standard.add(new Offer(new ItemStack(ModItems.blueprint_folder, 1, 1), Requirement.OIL, 256));
|
||||
//plants
|
||||
standard.add(new Offer(new ItemStack(Blocks.sapling, 1, 3), Requirement.STEEL, 12, 9));
|
||||
standard.add(new Offer(new ItemStack(ModBlocks.plant_flower, 1, EnumFlowerType.FOXGLOVE.ordinal()), Requirement.STEEL, 16, 5));
|
||||
|
||||
@ -5,6 +5,7 @@ import java.util.Map.Entry;
|
||||
|
||||
import com.hbm.handler.guncfg.*;
|
||||
|
||||
@Deprecated
|
||||
public class BulletConfigSyncingUtil {
|
||||
|
||||
private static HashMap<Integer, BulletConfiguration> configSet = new HashMap<Integer, BulletConfiguration>();
|
||||
|
||||
@ -6,6 +6,7 @@ import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.util.ItemStackUtil;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import li.cil.oc.api.Items;
|
||||
@ -108,27 +109,66 @@ public class CompatHandler {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple enum for mapping OC color ordinals to a nicer format for adding new disks.
|
||||
*/
|
||||
public enum OCColors {
|
||||
BLACK, //0x444444
|
||||
RED, //0xB3312C
|
||||
GREEN, //0x339911
|
||||
BROWN, //0x51301A
|
||||
BLUE, //0x6666FF
|
||||
PURPLE, //0x7B2FBE
|
||||
CYAN, //0x66FFFF
|
||||
LIGHTGRAY, //0xABABAB
|
||||
GRAY, //0x666666
|
||||
PINK, //0xD88198
|
||||
LIME, //0x66FF66
|
||||
YELLOW, //0xFFFF66
|
||||
LIGHTBLUE, //0xAAAAFF
|
||||
MAGENTA, //0xC354CD
|
||||
ORANGE, //0xEB8844
|
||||
WHITE //0xF0F0F0
|
||||
}
|
||||
/**
|
||||
* Simple enum for mapping OC color ordinals to a nicer format for adding new disks.
|
||||
*/
|
||||
public enum OCColors {
|
||||
BLACK(0x444444, "dyeBlack"),
|
||||
RED(0xB3312C, "dyeRed"),
|
||||
GREEN(0x339911, "dyeGreen"),
|
||||
BROWN(0x51301A, "dyeBrown"),
|
||||
BLUE(0x6666FF, "dyeBlue"),
|
||||
PURPLE(0x7B2FBE, "dyePurple"),
|
||||
CYAN(0x66FFFF, "dyeCyan"),
|
||||
LIGHTGRAY(0xABABAB, "dyeLightGray"),
|
||||
GRAY(0x666666, "dyeGray"),
|
||||
PINK(0xD88198, "dyePink"),
|
||||
LIME(0x66FF66, "dyeLime"),
|
||||
YELLOW(0xFFFF66, "dyeYellow"),
|
||||
LIGHTBLUE(0xAAAAFF, "dyeLightBlue"),
|
||||
MAGENTA(0xC354CD, "dyeMagenta"),
|
||||
ORANGE(0xEB8844, "dyeOrange"),
|
||||
WHITE(0xF0F0F0, "dyeWhite"),
|
||||
NONE(0x0, "");
|
||||
|
||||
private final int color;
|
||||
private final String dictName;
|
||||
|
||||
OCColors(int color, String dictName) {
|
||||
this.color = color;
|
||||
this.dictName = dictName;
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
public static OCColors fromInt(int intColor) {
|
||||
for (OCColors iColor : OCColors.values()) {
|
||||
if (intColor == iColor.getColor())
|
||||
return iColor;
|
||||
}
|
||||
return OCColors.NONE;
|
||||
}
|
||||
|
||||
public static OCColors fromDye(ItemStack stack) {
|
||||
List<String> oreNames = ItemStackUtil.getOreDictNames(stack);
|
||||
|
||||
for(String dict : oreNames) {
|
||||
if(!(dict.length() > 3) || !dict.startsWith("dye"))
|
||||
continue;
|
||||
|
||||
for (OCColors color : OCColors.values()) {
|
||||
if(!color.dictName.equals(dict))
|
||||
continue;
|
||||
|
||||
return color;
|
||||
}
|
||||
}
|
||||
|
||||
return OCColors.NONE;
|
||||
}
|
||||
}
|
||||
|
||||
// Where all disks are stored with their name and `FloppyDisk` class.
|
||||
public static HashMap<String, FloppyDisk> disks = new HashMap<>();
|
||||
|
||||
313
src/main/java/com/hbm/handler/DispenserBehaviorHandler.java
Normal file
313
src/main/java/com/hbm/handler/DispenserBehaviorHandler.java
Normal file
@ -0,0 +1,313 @@
|
||||
package com.hbm.handler;
|
||||
|
||||
import com.hbm.entity.grenade.EntityGrenadeASchrab;
|
||||
import com.hbm.entity.grenade.EntityGrenadeBlackHole;
|
||||
import com.hbm.entity.grenade.EntityGrenadeBreach;
|
||||
import com.hbm.entity.grenade.EntityGrenadeBurst;
|
||||
import com.hbm.entity.grenade.EntityGrenadeCloud;
|
||||
import com.hbm.entity.grenade.EntityGrenadeCluster;
|
||||
import com.hbm.entity.grenade.EntityGrenadeDynamite;
|
||||
import com.hbm.entity.grenade.EntityGrenadeElectric;
|
||||
import com.hbm.entity.grenade.EntityGrenadeFire;
|
||||
import com.hbm.entity.grenade.EntityGrenadeFlare;
|
||||
import com.hbm.entity.grenade.EntityGrenadeFrag;
|
||||
import com.hbm.entity.grenade.EntityGrenadeGas;
|
||||
import com.hbm.entity.grenade.EntityGrenadeGascan;
|
||||
import com.hbm.entity.grenade.EntityGrenadeGeneric;
|
||||
import com.hbm.entity.grenade.EntityGrenadeIFBouncy;
|
||||
import com.hbm.entity.grenade.EntityGrenadeIFBrimstone;
|
||||
import com.hbm.entity.grenade.EntityGrenadeIFConcussion;
|
||||
import com.hbm.entity.grenade.EntityGrenadeIFGeneric;
|
||||
import com.hbm.entity.grenade.EntityGrenadeIFHE;
|
||||
import com.hbm.entity.grenade.EntityGrenadeIFHopwire;
|
||||
import com.hbm.entity.grenade.EntityGrenadeIFImpact;
|
||||
import com.hbm.entity.grenade.EntityGrenadeIFIncendiary;
|
||||
import com.hbm.entity.grenade.EntityGrenadeIFMystery;
|
||||
import com.hbm.entity.grenade.EntityGrenadeIFNull;
|
||||
import com.hbm.entity.grenade.EntityGrenadeIFSpark;
|
||||
import com.hbm.entity.grenade.EntityGrenadeIFSticky;
|
||||
import com.hbm.entity.grenade.EntityGrenadeIFToxic;
|
||||
import com.hbm.entity.grenade.EntityGrenadeImpactGeneric;
|
||||
import com.hbm.entity.grenade.EntityGrenadeLemon;
|
||||
import com.hbm.entity.grenade.EntityGrenadeMIRV;
|
||||
import com.hbm.entity.grenade.EntityGrenadeMk2;
|
||||
import com.hbm.entity.grenade.EntityGrenadeNuclear;
|
||||
import com.hbm.entity.grenade.EntityGrenadeNuke;
|
||||
import com.hbm.entity.grenade.EntityGrenadePC;
|
||||
import com.hbm.entity.grenade.EntityGrenadePlasma;
|
||||
import com.hbm.entity.grenade.EntityGrenadePoison;
|
||||
import com.hbm.entity.grenade.EntityGrenadePulse;
|
||||
import com.hbm.entity.grenade.EntityGrenadeSchrabidium;
|
||||
import com.hbm.entity.grenade.EntityGrenadeShrapnel;
|
||||
import com.hbm.entity.grenade.EntityGrenadeSmart;
|
||||
import com.hbm.entity.grenade.EntityGrenadeStrong;
|
||||
import com.hbm.entity.grenade.EntityGrenadeTau;
|
||||
import com.hbm.entity.grenade.EntityGrenadeZOMG;
|
||||
import com.hbm.entity.grenade.EntityWastePearl;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.tool.ItemFertilizer;
|
||||
import com.hbm.items.weapon.ItemGenericGrenade;
|
||||
|
||||
import net.minecraft.block.BlockDispenser;
|
||||
import net.minecraft.dispenser.BehaviorDefaultDispenseItem;
|
||||
import net.minecraft.dispenser.BehaviorProjectileDispense;
|
||||
import net.minecraft.dispenser.IBlockSource;
|
||||
import net.minecraft.dispenser.IPosition;
|
||||
import net.minecraft.entity.IProjectile;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class DispenserBehaviorHandler {
|
||||
|
||||
public static void init() {
|
||||
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_generic, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadeGeneric(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_strong, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadeStrong(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_frag, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadeFrag(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_fire, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadeFire(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_cluster, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadeCluster(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_flare, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadeFlare(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_electric, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadeElectric(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_poison, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadePoison(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_gas, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadeGas(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_schrabidium, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadeSchrabidium(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_nuke, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadeNuke(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_nuclear, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadeNuclear(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_pulse, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadePulse(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_plasma, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadePlasma(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_tau, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadeTau(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_lemon, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadeLemon(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_mk2, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadeMk2(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_aschrab, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadeASchrab(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_zomg, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadeZOMG(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_shrapnel, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadeShrapnel(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_black_hole, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadeBlackHole(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_gascan, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadeGascan(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_cloud, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadeCloud(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_pink_cloud, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadePC(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_smart, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadeSmart(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_mirv, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadeMIRV(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_breach, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadeBreach(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_burst, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadeBurst(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_if_generic, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadeIFGeneric(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_if_he, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadeIFHE(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_if_bouncy, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadeIFBouncy(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_if_sticky, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadeIFSticky(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_if_impact, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadeIFImpact(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_if_incendiary, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadeIFIncendiary(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_if_toxic, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadeIFToxic(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_if_concussion, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadeIFConcussion(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_if_brimstone, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadeIFBrimstone(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_if_mystery, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadeIFMystery(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_if_spark, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadeIFSpark(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_if_hopwire, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadeIFHopwire(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_if_null, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadeIFNull(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.nuclear_waste_pearl, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityWastePearl(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.stick_dynamite, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadeDynamite(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_kyiv, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadeImpactGeneric(world, position.getX(), position.getY(), position.getZ()).setType((ItemGenericGrenade) ModItems.grenade_kyiv);
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.stick_dynamite_fishing, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadeImpactGeneric(world, position.getX(), position.getY(), position.getZ()).setType((ItemGenericGrenade) ModItems.stick_dynamite_fishing);
|
||||
}
|
||||
});
|
||||
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.powder_fertilizer, new BehaviorDefaultDispenseItem() {
|
||||
|
||||
private boolean dispenseSound = true;
|
||||
@Override protected ItemStack dispenseStack(IBlockSource source, ItemStack stack) {
|
||||
|
||||
EnumFacing facing = BlockDispenser.func_149937_b(source.getBlockMetadata());
|
||||
World world = source.getWorld();
|
||||
int x = source.getXInt() + facing.getFrontOffsetX();
|
||||
int y = source.getYInt() + facing.getFrontOffsetY();
|
||||
int z = source.getZInt() + facing.getFrontOffsetZ();
|
||||
this.dispenseSound = ItemFertilizer.useFertillizer(stack, world, x, y, z);
|
||||
return stack;
|
||||
}
|
||||
@Override protected void playDispenseSound(IBlockSource source) {
|
||||
if(this.dispenseSound) {
|
||||
source.getWorld().playAuxSFX(1000, source.getXInt(), source.getYInt(), source.getZInt(), 0);
|
||||
} else {
|
||||
source.getWorld().playAuxSFX(1001, source.getXInt(), source.getYInt(), source.getZInt(), 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -668,6 +668,14 @@ public class EntityEffectHandler {
|
||||
FlameCreator.composeEffect(entity.worldObj, x - living.width / 2 + living.width * rand.nextDouble(), y + rand.nextDouble() * living.height, z - living.width / 2 + living.width * rand.nextDouble(), FlameCreator.META_BALEFIRE);
|
||||
}
|
||||
|
||||
if(props.blackFire > 0) {
|
||||
props.blackFire--;
|
||||
if((living.ticksExisted + living.getEntityId()) % 10 == 0) living.worldObj.playSoundEffect(living.posX, living.posY + living.height / 2, living.posZ, "random.fizz", 1F, 1.5F + rand.nextFloat() * 0.5F);
|
||||
ContaminationUtil.contaminate(living, HazardType.RADIATION, ContaminationType.CREATIVE, 5F);
|
||||
if((living.ticksExisted + living.getEntityId()) % 10 == 0) living.attackEntityFrom(DamageSource.onFire, 10F);
|
||||
FlameCreator.composeEffect(entity.worldObj, x - living.width / 2 + living.width * rand.nextDouble(), y + rand.nextDouble() * living.height, z - living.width / 2 + living.width * rand.nextDouble(), FlameCreator.META_BLACK);
|
||||
}
|
||||
|
||||
if(props.fire > 0 || props.phosphorus > 0 || props.balefire > 0) if(!entity.isEntityAlive()) ConfettiUtil.decideConfetti(living, DamageSource.onFire);
|
||||
}
|
||||
|
||||
|
||||
@ -13,6 +13,7 @@ import com.hbm.main.MainRegistry;
|
||||
public class HTTPHandler {
|
||||
|
||||
public static List<String> capsule = new ArrayList();
|
||||
public static List<String> tipOfTheDay = new ArrayList();
|
||||
public static boolean newVersion = false;
|
||||
public static String versionNumber = "";
|
||||
|
||||
@ -25,6 +26,7 @@ public class HTTPHandler {
|
||||
try {
|
||||
loadVersion();
|
||||
loadSoyuz();
|
||||
loadTips();
|
||||
} catch(IOException e) {
|
||||
MainRegistry.logger.warn("Version checker failed!");
|
||||
}
|
||||
@ -69,12 +71,17 @@ public class HTTPHandler {
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(github.openStream()));
|
||||
|
||||
String line;
|
||||
|
||||
while((line = in.readLine()) != null) {
|
||||
capsule.add(line);
|
||||
}
|
||||
|
||||
while((line = in.readLine()) != null) capsule.add(line);
|
||||
in.close();
|
||||
}
|
||||
|
||||
private static void loadTips() throws IOException {
|
||||
|
||||
URL github = new URL("https://gist.githubusercontent.com/HbmMods/a03c66ba160184e12f43de826b30c096/raw/tip_of_the_day");
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(github.openStream()));
|
||||
|
||||
String line;
|
||||
while((line = in.readLine()) != null) tipOfTheDay.add(line);
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,6 +37,8 @@ public class HbmKeybinds {
|
||||
public static KeyBinding hudKey = new KeyBinding(category + ".toggleHUD", Keyboard.KEY_V, category);
|
||||
public static KeyBinding dashKey = new KeyBinding(category + ".dash", Keyboard.KEY_LSHIFT, category);
|
||||
public static KeyBinding trainKey = new KeyBinding(category + ".trainInv", Keyboard.KEY_R, category);
|
||||
|
||||
public static KeyBinding qmaw = new KeyBinding(category + ".qmaw", Keyboard.KEY_F1, category);
|
||||
|
||||
public static KeyBinding abilityCycle = new KeyBinding(category + ".ability", -99, category);
|
||||
public static KeyBinding abilityAlt = new KeyBinding(category + ".abilityAlt", Keyboard.KEY_LMENU, category);
|
||||
@ -61,6 +63,8 @@ public class HbmKeybinds {
|
||||
ClientRegistry.registerKeyBinding(hudKey);
|
||||
ClientRegistry.registerKeyBinding(dashKey);
|
||||
ClientRegistry.registerKeyBinding(trainKey);
|
||||
|
||||
ClientRegistry.registerKeyBinding(qmaw);
|
||||
|
||||
ClientRegistry.registerKeyBinding(reloadKey);
|
||||
ClientRegistry.registerKeyBinding(gunPrimaryKey);
|
||||
|
||||
@ -14,7 +14,10 @@ import com.hbm.items.tool.ItemToolAbility;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@ -219,6 +222,104 @@ public interface IToolAreaAbility extends IBaseAbility {
|
||||
}
|
||||
};
|
||||
|
||||
public static final IToolAreaAbility HAMMER_FLAT = new IToolAreaAbility() {
|
||||
@Override
|
||||
public String getName() {
|
||||
return "tool.ability.hammer_flat";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAllowed() {
|
||||
return ToolConfig.abilityHammer;
|
||||
}
|
||||
|
||||
public final int[] rangeAtLevel = { 1, 2, 3, 4 };
|
||||
|
||||
@Override
|
||||
public int levels() {
|
||||
return rangeAtLevel.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getExtension(int level) {
|
||||
return " (" + rangeAtLevel[level] + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int sortOrder() {
|
||||
return SORT_ORDER_BASE + 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onDig(int level, World world, int x, int y, int z, EntityPlayer player, ItemToolAbility tool) {
|
||||
int range = rangeAtLevel[level];
|
||||
|
||||
MovingObjectPosition hit = raytraceFromEntity(world, player, false, 4.5d);
|
||||
if(hit == null) return true;
|
||||
int sideHit = hit.sideHit;
|
||||
|
||||
// we successfully destroyed a block. time to do AOE!
|
||||
int xRange = range;
|
||||
int yRange = range;
|
||||
int zRange = 0;
|
||||
switch (sideHit) {
|
||||
case 0:
|
||||
case 1:
|
||||
yRange = 0;
|
||||
zRange = range;
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
xRange = range;
|
||||
zRange = 0;
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
xRange = 0;
|
||||
zRange = range;
|
||||
break;
|
||||
}
|
||||
|
||||
for(int a = x - xRange; a <= x + xRange; a++) {
|
||||
for(int b = y - yRange; b <= y + yRange; b++) {
|
||||
for(int c = z - zRange; c <= z + zRange; c++) {
|
||||
if(a == x && b == y && c == z)
|
||||
continue;
|
||||
|
||||
tool.breakExtraBlock(world, a, b, c, player, x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Taken from TConstruct, licensed under CC0 (public domain)
|
||||
// https://github.com/SlimeKnights/TinkersConstruct/blob/9ea7a0e60fe180aff591701b12c89da21da99289/src/main/java/tconstruct/library/tools/AbilityHelper.java#L707-L731
|
||||
private MovingObjectPosition raytraceFromEntity(World world, EntityPlayer player, boolean par3, double range) {
|
||||
float f = 1.0F;
|
||||
float f1 = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * f;
|
||||
float f2 = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * f;
|
||||
double d0 = player.prevPosX + (player.posX - player.prevPosX) * (double) f;
|
||||
double d1 = player.prevPosY + (player.posY - player.prevPosY) * (double) f + 1.62D;
|
||||
double d2 = player.prevPosZ + (player.posZ - player.prevPosZ) * (double) f;
|
||||
Vec3 vec3 = Vec3.createVectorHelper(d0, d1, d2);
|
||||
float f3 = MathHelper.cos(-f2 * 0.017453292F - (float) Math.PI);
|
||||
float f4 = MathHelper.sin(-f2 * 0.017453292F - (float) Math.PI);
|
||||
float f5 = -MathHelper.cos(-f1 * 0.017453292F);
|
||||
float f6 = MathHelper.sin(-f1 * 0.017453292F);
|
||||
float f7 = f4 * f5;
|
||||
float f8 = f3 * f5;
|
||||
double d3 = range;
|
||||
if (player instanceof EntityPlayerMP)
|
||||
{
|
||||
d3 = ((EntityPlayerMP) player).theItemInWorldManager.getBlockReachDistance();
|
||||
}
|
||||
Vec3 vec31 = vec3.addVector((double) f7 * d3, (double) f6 * d3, (double) f8 * d3);
|
||||
return world.func_147447_a(vec3, vec31, par3, !par3, par3);
|
||||
}
|
||||
};
|
||||
|
||||
public static final IToolAreaAbility EXPLOSION = new IToolAreaAbility() {
|
||||
@Override
|
||||
public String getName() {
|
||||
@ -249,7 +350,7 @@ public interface IToolAreaAbility extends IBaseAbility {
|
||||
|
||||
@Override
|
||||
public int sortOrder() {
|
||||
return SORT_ORDER_BASE + 3;
|
||||
return SORT_ORDER_BASE + 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -270,7 +371,7 @@ public interface IToolAreaAbility extends IBaseAbility {
|
||||
};
|
||||
// endregion handlers
|
||||
|
||||
static final IToolAreaAbility[] abilities = { NONE, RECURSION, HAMMER, EXPLOSION };
|
||||
static final IToolAreaAbility[] abilities = { NONE, RECURSION, HAMMER, HAMMER_FLAT, EXPLOSION };
|
||||
|
||||
static IToolAreaAbility getByName(String name) {
|
||||
for(IToolAreaAbility ability : abilities) {
|
||||
|
||||
@ -37,7 +37,8 @@ public interface IToolHarvestAbility extends IBaseAbility {
|
||||
if(skipDefaultDrops) {
|
||||
// Emulate the block breaking without drops
|
||||
world.setBlockToAir(x, y, z);
|
||||
player.getHeldItem().damageItem(1, player);
|
||||
ItemStack stack = player.getHeldItem();
|
||||
if(stack != null) stack.damageItem(1, player);
|
||||
} else if(player instanceof EntityPlayerMP) {
|
||||
// Break the block conventionally
|
||||
ItemToolAbility.standardDigPost(world, x, y, z, (EntityPlayerMP) player);
|
||||
@ -78,7 +79,7 @@ public interface IToolHarvestAbility extends IBaseAbility {
|
||||
@Override
|
||||
public void preHarvestAll(int level, World world, EntityPlayer player) {
|
||||
ItemStack stack = player.getHeldItem();
|
||||
EnchantmentUtil.addEnchantment(stack, Enchantment.silkTouch, 1);
|
||||
if(stack != null) EnchantmentUtil.addEnchantment(stack, Enchantment.silkTouch, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -88,7 +89,7 @@ public interface IToolHarvestAbility extends IBaseAbility {
|
||||
// Even if can be forced somehow, the player doesn't gain any
|
||||
// benefit from it.
|
||||
ItemStack stack = player.getHeldItem();
|
||||
EnchantmentUtil.removeEnchantment(stack, Enchantment.silkTouch);
|
||||
if(stack != null) EnchantmentUtil.removeEnchantment(stack, Enchantment.silkTouch);
|
||||
}
|
||||
};
|
||||
|
||||
@ -123,7 +124,7 @@ public interface IToolHarvestAbility extends IBaseAbility {
|
||||
@Override
|
||||
public void preHarvestAll(int level, World world, EntityPlayer player) {
|
||||
ItemStack stack = player.getHeldItem();
|
||||
EnchantmentUtil.addEnchantment(stack, Enchantment.fortune, powerAtLevel[level]);
|
||||
if(stack != null) EnchantmentUtil.addEnchantment(stack, Enchantment.fortune, powerAtLevel[level]);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -133,7 +134,7 @@ public interface IToolHarvestAbility extends IBaseAbility {
|
||||
// Even if can be forced somehow, the player doesn't gain any
|
||||
// benefit from it.
|
||||
ItemStack stack = player.getHeldItem();
|
||||
EnchantmentUtil.removeEnchantment(stack, Enchantment.fortune);
|
||||
if(stack != null) EnchantmentUtil.removeEnchantment(stack, Enchantment.fortune);
|
||||
}
|
||||
};
|
||||
|
||||
@ -175,7 +176,7 @@ public interface IToolHarvestAbility extends IBaseAbility {
|
||||
|
||||
if(doesSmelt) {
|
||||
for(ItemStack stack : drops) {
|
||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, stack.copy()));
|
||||
world.spawnEntityInWorld(new EntityItem(world, ItemToolAbility.dropX + 0.5, ItemToolAbility.dropY + 0.5, ItemToolAbility.dropZ + 0.5, stack.copy()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -211,7 +212,7 @@ public interface IToolHarvestAbility extends IBaseAbility {
|
||||
harvestBlock(doesShred, world, x, y, z, player);
|
||||
|
||||
if(doesShred) {
|
||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, result.copy()));
|
||||
world.spawnEntityInWorld(new EntityItem(world, ItemToolAbility.dropX + 0.5, ItemToolAbility.dropY + 0.5, ItemToolAbility.dropZ + 0.5, result.copy()));
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -248,7 +249,7 @@ public interface IToolHarvestAbility extends IBaseAbility {
|
||||
if(doesCentrifuge) {
|
||||
for(ItemStack st : result) {
|
||||
if(st != null) {
|
||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, st.copy()));
|
||||
world.spawnEntityInWorld(new EntityItem(world, ItemToolAbility.dropX + 0.5, ItemToolAbility.dropY + 0.5, ItemToolAbility.dropZ + 0.5, st.copy()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -285,7 +286,7 @@ public interface IToolHarvestAbility extends IBaseAbility {
|
||||
harvestBlock(doesCrystallize, world, x, y, z, player);
|
||||
|
||||
if(doesCrystallize) {
|
||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, result.output.copy()));
|
||||
world.spawnEntityInWorld(new EntityItem(world, ItemToolAbility.dropX + 0.5, ItemToolAbility.dropY + 0.5, ItemToolAbility.dropZ + 0.5, result.output.copy()));
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -324,7 +325,7 @@ public interface IToolHarvestAbility extends IBaseAbility {
|
||||
harvestBlock(doesConvert, world, x, y, z, player);
|
||||
|
||||
if(doesConvert) {
|
||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModItems.ingot_mercury, mercury)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, ItemToolAbility.dropX + 0.5, ItemToolAbility.dropY + 0.5, ItemToolAbility.dropZ + 0.5, new ItemStack(ModItems.ingot_mercury, mercury)));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -27,32 +27,32 @@ public class ToolPreset {
|
||||
this.harvestAbilityLevel = harvestAbilityLevel;
|
||||
}
|
||||
|
||||
public ChatComponentText getMessage() {
|
||||
if (isNone()) {
|
||||
return ChatBuilder.start("[Tool ability deactivated]").color(EnumChatFormatting.GOLD).flush();
|
||||
}
|
||||
public ChatComponentText getMessage() {
|
||||
if(isNone()) {
|
||||
return ChatBuilder.start("[Tool ability deactivated]").color(EnumChatFormatting.GOLD).flush();
|
||||
}
|
||||
|
||||
boolean hasArea = areaAbility != IToolAreaAbility.NONE;
|
||||
boolean hasHarvest = harvestAbility != IToolHarvestAbility.NONE;
|
||||
|
||||
ChatBuilder builder = ChatBuilder.start("[Enabled ");
|
||||
boolean hasArea = areaAbility != IToolAreaAbility.NONE;
|
||||
boolean hasHarvest = harvestAbility != IToolHarvestAbility.NONE;
|
||||
|
||||
if (hasArea) {
|
||||
builder.nextTranslation(areaAbility.getName());
|
||||
builder.next(areaAbility.getExtension(areaAbilityLevel));
|
||||
}
|
||||
ChatBuilder builder = ChatBuilder.start("[Enabled ");
|
||||
|
||||
if (hasArea && hasHarvest) {
|
||||
builder.next(" + ");
|
||||
}
|
||||
if(hasArea) {
|
||||
builder.nextTranslation(areaAbility.getName());
|
||||
builder.next(areaAbility.getExtension(areaAbilityLevel));
|
||||
}
|
||||
|
||||
if (hasHarvest) {
|
||||
builder.nextTranslation(harvestAbility.getName());
|
||||
builder.next(harvestAbility.getExtension(harvestAbilityLevel));
|
||||
}
|
||||
|
||||
return builder.colorAll(EnumChatFormatting.YELLOW).flush();
|
||||
}
|
||||
if(hasArea && hasHarvest) {
|
||||
builder.next(" + ");
|
||||
}
|
||||
|
||||
if(hasHarvest) {
|
||||
builder.nextTranslation(harvestAbility.getName());
|
||||
builder.next(harvestAbility.getExtension(harvestAbilityLevel));
|
||||
}
|
||||
|
||||
return builder.colorAll(EnumChatFormatting.YELLOW).flush();
|
||||
}
|
||||
|
||||
public boolean isNone() {
|
||||
return areaAbility == IToolAreaAbility.NONE && harvestAbility == IToolHarvestAbility.NONE;
|
||||
|
||||
19
src/main/java/com/hbm/handler/ae2/AE2CompatHandler.java
Normal file
19
src/main/java/com/hbm/handler/ae2/AE2CompatHandler.java
Normal file
@ -0,0 +1,19 @@
|
||||
package com.hbm.handler.ae2;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
|
||||
public class AE2CompatHandler {
|
||||
public static void init() {
|
||||
if (Loader.isModLoaded("appliedenergistics2")) {
|
||||
registerHandler();
|
||||
}
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "appliedenergistics2")
|
||||
private static void registerHandler() {
|
||||
AEApi.instance().registries().externalStorage().addExternalStorageInterface(new MSUExternalStorageHandler());
|
||||
AEApi.instance().registries().externalStorage().addExternalStorageInterface(new AFLExternalStorageHandler());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
package com.hbm.handler.ae2;
|
||||
|
||||
import com.hbm.tileentity.machine.TileEntityMachineArcFurnaceLarge;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.storage.IExternalStorageHandler;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.me.storage.MEMonitorIInventory;
|
||||
import appeng.util.inv.IMEAdaptor;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "appeng.api.storage.IExternalStorageHandler", modid = "appliedenergistics2")})
|
||||
public class AFLExternalStorageHandler implements IExternalStorageHandler {
|
||||
|
||||
public AFLExternalStorageHandler() {}
|
||||
|
||||
@Override
|
||||
public boolean canHandle(TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource mySrc) {
|
||||
boolean coreProxy = te instanceof TileEntityProxyCombo && ((TileEntityProxyCombo) te).getTile() instanceof TileEntityMachineArcFurnaceLarge;
|
||||
return channel == StorageChannel.ITEMS && (te instanceof TileEntityMachineArcFurnaceLarge || coreProxy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEInventory getInventory(TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource src) {
|
||||
if (!canHandle(te, d, channel, src)) return null;
|
||||
if (te instanceof TileEntityProxyCombo) return new MEMonitorIInventory(new IMEAdaptor(new ArcFurnaceLargeMEInventory((TileEntityMachineArcFurnaceLarge) ((TileEntityProxyCombo)te).getTile()), src)) {};
|
||||
return new MEMonitorIInventory(new IMEAdaptor(new ArcFurnaceLargeMEInventory((TileEntityMachineArcFurnaceLarge) te), src)) {};
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,59 @@
|
||||
package com.hbm.handler.ae2;
|
||||
|
||||
import com.hbm.tileentity.machine.TileEntityMachineArcFurnaceLarge;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@Optional.InterfaceList({ @Optional.Interface(iface = "appeng.api.storage.IMEInventory", modid = "appliedenergistics2") })
|
||||
public class ArcFurnaceLargeMEInventory implements IMEInventory<IAEItemStack> {
|
||||
|
||||
private TileEntityMachineArcFurnaceLarge afl;
|
||||
|
||||
public ArcFurnaceLargeMEInventory(TileEntityMachineArcFurnaceLarge afl) {
|
||||
this.afl = afl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack injectItems(IAEItemStack input, Actionable type, BaseActionSource src) {
|
||||
ItemStack is = input.getItemStack();
|
||||
is = afl.distributeInput(is, type == Actionable.MODULATE);
|
||||
|
||||
if(is == null) return null;
|
||||
return AEApi.instance().storage().createItemStack(is);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack extractItems(IAEItemStack request, Actionable mode, BaseActionSource src) {
|
||||
ItemStack is = request.getItemStack();
|
||||
is = afl.collectRequested(is, mode == Actionable.MODULATE);
|
||||
|
||||
if(is == null) return null;
|
||||
return AEApi.instance().storage().createItemStack(is);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemList<IAEItemStack> getAvailableItems(IItemList<IAEItemStack> out) {
|
||||
ItemStack is;
|
||||
for(int i = 0; i < 25; i++) {
|
||||
is = afl.getAvailableItemFromSlot(i);
|
||||
if(is != null)
|
||||
out.add(AEApi.instance().storage().createItemStack(is));
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageChannel getChannel() {
|
||||
return StorageChannel.ITEMS;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
package com.hbm.handler.ae2;
|
||||
|
||||
import com.hbm.tileentity.machine.storage.TileEntityMassStorage;
|
||||
import com.hbm.util.ItemStackUtil;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.storage.IExternalStorageHandler;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.me.storage.MEMonitorIInventory;
|
||||
import appeng.util.inv.IMEAdaptor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "appeng.api.storage.IExternalStorageHandler", modid = "appliedenergistics2")})
|
||||
public class MSUExternalStorageHandler implements IExternalStorageHandler {
|
||||
|
||||
public MSUExternalStorageHandler() {}
|
||||
|
||||
@Override
|
||||
public boolean canHandle(TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource mySrc) {
|
||||
return channel == StorageChannel.ITEMS && te instanceof TileEntityMassStorage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEInventory getInventory(TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource src) {
|
||||
if (!canHandle(te, d, channel, src))
|
||||
return null;
|
||||
|
||||
// Note: apparently I need this, though I'm not sure why. Storage drawers does it.
|
||||
// Here's a relevant discussion, if anyone wants to dive into that rabbit hole:
|
||||
// https://github.com/AppliedEnergistics/Applied-Energistics-2/issues/418
|
||||
return new MEMonitorIInventory(new IMEAdaptor(new MassStorageMEInventory((TileEntityMassStorage)te), src)) {
|
||||
@Override
|
||||
public boolean isPrioritized(IAEItemStack stack) {
|
||||
ItemStack type = ((TileEntityMassStorage)te).getType();
|
||||
|
||||
return type != null && ItemStackUtil.areStacksCompatible(stack.getItemStack(), type);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,85 @@
|
||||
package com.hbm.handler.ae2;
|
||||
|
||||
import com.hbm.tileentity.machine.storage.TileEntityMassStorage;
|
||||
import com.hbm.util.ItemStackUtil;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "appeng.api.storage.IMEInventory", modid = "appliedenergistics2")})
|
||||
public class MassStorageMEInventory implements IMEInventory<IAEItemStack> {
|
||||
|
||||
private TileEntityMassStorage tile;
|
||||
|
||||
public MassStorageMEInventory(TileEntityMassStorage tile) {
|
||||
this.tile = tile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack injectItems(IAEItemStack input, Actionable type, BaseActionSource src) {
|
||||
ItemStack typeStack = tile.getType();
|
||||
|
||||
if (typeStack == null || !ItemStackUtil.areStacksCompatible(input.getItemStack(), typeStack))
|
||||
return input;
|
||||
|
||||
// If you're working with amounts greater than MAX_INT, you shouldn't use MSUs in the first place
|
||||
int remaining = tile.increaseTotalStockpile((int)input.getStackSize(), type == Actionable.MODULATE);
|
||||
|
||||
if (remaining == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return AEApi.instance().storage()
|
||||
.createItemStack(typeStack)
|
||||
.setStackSize(remaining);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack extractItems(IAEItemStack request, Actionable mode, BaseActionSource src) {
|
||||
ItemStack typeStack = tile.getType();
|
||||
|
||||
if (typeStack == null || !ItemStackUtil.areStacksCompatible(request.getItemStack(), typeStack))
|
||||
return null;
|
||||
|
||||
// If you're working with amounts greater than MAX_INT, you shouldn't use MSUs in the first place
|
||||
int missing = tile.decreaseTotalStockpile((int)request.getStackSize(), mode == Actionable.MODULATE);
|
||||
long fulfilled = request.getStackSize() - missing;
|
||||
|
||||
if (fulfilled == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return AEApi.instance().storage()
|
||||
.createItemStack(typeStack)
|
||||
.setStackSize(fulfilled);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemList<IAEItemStack> getAvailableItems(IItemList<IAEItemStack> out) {
|
||||
ItemStack typeStack = tile.getType();
|
||||
|
||||
if (typeStack != null) {
|
||||
out.add(
|
||||
AEApi.instance().storage()
|
||||
.createItemStack(typeStack)
|
||||
.setStackSize(tile.getTotalStockpile())
|
||||
);
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageChannel getChannel() {
|
||||
return StorageChannel.ITEMS;
|
||||
}
|
||||
|
||||
}
|
||||
@ -4,6 +4,7 @@ import com.hbm.handler.BulletConfiguration;
|
||||
import com.hbm.inventory.RecipesCommon.ComparableStack;
|
||||
import com.hbm.items.ModItems;
|
||||
|
||||
@Deprecated
|
||||
public class GunEnergyFactory {
|
||||
|
||||
public static BulletConfiguration getTurbineConfig() {
|
||||
|
||||
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