mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-03-11 20:25:36 +00:00
Merge branch 'master' of https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT into abel-trapdoors
This commit is contained in:
commit
1da6140e2e
@ -12,7 +12,7 @@
|
||||
|
||||
* NTM Reloaded: https://github.com/TheOriginalGolem/Hbm-s-Nuclear-Tech-GIT/releases
|
||||
* NTM Extended Edition (Alcater): https://github.com/Alcatergit/Hbm-s-Nuclear-Tech-GIT/releases
|
||||
* NTM Community Edition (WarFactory): https://codeberg.org/MrNorwood/Hbm-s-Nuclear-Tech-CE
|
||||
* NTM Community Edition (WarFactory): https://github.com/MisterNorwood/Hbm-s-Nuclear-Tech-CE
|
||||
|
||||
For 1.18, try Martin's remake: https://codeberg.org/MartinTheDragon/Nuclear-Tech-Mod-Remake/releases
|
||||
|
||||
|
||||
14
build.gradle
14
build.gradle
@ -79,6 +79,18 @@ repositories {
|
||||
// name = "CurseForge"
|
||||
// url = "https://minecraft.curseforge.com/api/maven/"
|
||||
//}
|
||||
maven {
|
||||
name = "Jitpack"
|
||||
url = "https://jitpack.io"
|
||||
}
|
||||
maven {
|
||||
name = "CurseMaven"
|
||||
url = "https://cursemaven.com"
|
||||
}
|
||||
maven {
|
||||
name = "OpenComputers"
|
||||
url = "https://maven.cil.li/"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@ -94,6 +106,8 @@ dependencies {
|
||||
compileOnly "inventorytweaks:InventoryTweaks:1.59-dev:deobf"
|
||||
|
||||
implementation "li.cil.oc:OpenComputers:MC1.7.10-1.5.+:api"
|
||||
|
||||
compileOnly "com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta.56-GTNH:dev"
|
||||
}
|
||||
|
||||
processResources {
|
||||
|
||||
59
changelog
59
changelog
@ -1,7 +1,64 @@
|
||||
## 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
|
||||
* Paintable exhaust pipe
|
||||
* Full block exhaust pipe that behaves like paintable cables and ducts
|
||||
|
||||
## Changed
|
||||
* Updated chinese and ukrainian localizations
|
||||
* 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
|
||||
* The fuel port on the rotary furnace now has a tooltip showing that it can be used for automation
|
||||
* Shredders will now prioritize NTM items when automatically generating recipes
|
||||
* The priority for what mods' items should be chosen can be configured
|
||||
* Mass storage units' stockpiles can now be directly accessed by ME systems
|
||||
* Inserters can now be suspended by applying a redstone signal
|
||||
* The legendary variant of the auto shotgun is no longer a simple reskin, it now has a completely unique model and animations
|
||||
* Added alcoholism
|
||||
* Open doors can now be interacted through
|
||||
* Area abilities on tools now drop all mined blocks in the center
|
||||
* Tools with AoE now come with the new "flat AoE" ability, which is the same but the area is only 1 block tall
|
||||
|
||||
## 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 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
|
||||
* Replaced paintabble cables in the lighthouse with regular ones, fixing an issue where the paint would ID shift
|
||||
* Fixed light blocks being considered solid for NPC pathfinding
|
||||
* Fixed issue regarding locked slots when using crates
|
||||
|
||||
@ -0,0 +1,9 @@
|
||||
package api.hbm.fluidmk2;
|
||||
|
||||
public interface IFluidRegisterListener {
|
||||
|
||||
/**
|
||||
* Called when the fluid registry initializes all fluids. Use CompatFluidRegistry to create new instances of FluidType, which are automatically registered.
|
||||
*/
|
||||
public void onFluidsLoad();
|
||||
}
|
||||
@ -1,10 +1,3 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* @author hbm
|
||||
*
|
||||
*/
|
||||
package api.hbm.fluidmk2;
|
||||
|
||||
/*
|
||||
@ -13,4 +6,19 @@ It's rather shrimple: the shiny new energy system using universal nodespace, but
|
||||
Has a few extra bits and pieces for handling, but the concept is basically the same.
|
||||
Sounds good?
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
Quick explanation for implementing new fluids via addon:
|
||||
Fluids are subject to /ntmreload so they get wiped and rebuilt using the init function in Fluids, which means that if fluids
|
||||
are simply added externally during startup, they are removed permanently until the game restarts. Same concept as with recipes, really.
|
||||
To fix this we need to make sure that externally registered fluids are re-registered during reload, for that purpose we have
|
||||
IFluidRegisterListener, a simple interface with a small method that runs whenever the fluid list is reloaded. IFluidRegisterListeners
|
||||
need to be registered with CompatExternal.registerFluidRegisterListener to be used, make sure to do this during PreInit.
|
||||
Inside the IFluidRegisterListener, fluids can be added using CompatFluidRegistry.registerFluid, which will generate a Fluid instance
|
||||
using the supplied arguments and automatically register it. Do note that like with custom fluids, fluids need numeric IDs assigned manually.
|
||||
To prevent collisions with stock fluids when NTM updates, make sure to choose a high starting ID (e.g. 10,000).
|
||||
The fluid created by registerFluid can have traits added to them, just like how NTM does it with its stock fluids.
|
||||
|
||||
*/
|
||||
@ -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) {
|
||||
|
||||
@ -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;
|
||||
@ -1019,6 +1020,7 @@ public class ModBlocks {
|
||||
@Deprecated public static Block machine_chemplant;
|
||||
public static Block machine_chemical_plant;
|
||||
public static Block machine_chemfac;
|
||||
public static Block machine_chemical_factory;
|
||||
public static Block machine_mixer;
|
||||
|
||||
public static Block machine_fluidtank;
|
||||
@ -1930,6 +1932,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);
|
||||
@ -2249,6 +2252,7 @@ public class ModBlocks {
|
||||
machine_chemplant = new MachineChemplant(Material.iron).setBlockName("machine_chemplant").setHardness(5.0F).setResistance(30.0F).setCreativeTab(MainRegistry.machineTab).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_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_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");
|
||||
@ -3207,6 +3211,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);
|
||||
@ -3299,6 +3304,7 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(machine_chemplant, machine_chemplant.getUnlocalizedName());
|
||||
register(machine_chemical_plant);
|
||||
register(machine_chemfac);
|
||||
register(machine_chemical_factory);
|
||||
register(machine_arc_welder);
|
||||
register(machine_soldering_station);
|
||||
register(machine_arc_furnace);
|
||||
|
||||
@ -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;
|
||||
@ -116,6 +118,22 @@ public class BlockDoorGeneric extends BlockDummyable implements IBomb {
|
||||
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);
|
||||
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
|
||||
|
||||
@ -11,6 +11,7 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
@ -66,7 +67,7 @@ public class BlockReeds extends Block {
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int meta, Random rand, int fortune) {
|
||||
return null;
|
||||
return Items.stick;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -81,6 +81,7 @@ public class DungeonSpawner extends BlockContainer {
|
||||
|
||||
public static Function<TileEntityDungeonSpawner, Boolean> CON_ABERRATOR = (tile) -> {
|
||||
World world = tile.getWorldObj();
|
||||
if(world.difficultySetting.ordinal() == 0) return false;
|
||||
int x = tile.xCoord;
|
||||
int y = tile.yCoord;
|
||||
int z = tile.zCoord;
|
||||
@ -122,7 +123,11 @@ public class DungeonSpawner extends BlockContainer {
|
||||
TileEntity te = world.getTileEntity(x, y + 18, z);
|
||||
if(te instanceof TileEntitySkeletonHolder) {
|
||||
TileEntitySkeletonHolder skeleton = (TileEntitySkeletonHolder) te;
|
||||
skeleton.item = new ItemStack(ModItems.item_secret, 1, EnumSecretType.ABERRATOR.ordinal());
|
||||
if(world.rand.nextInt(5) == 0) {
|
||||
skeleton.item = new ItemStack(ModItems.item_secret, 1, EnumSecretType.ABERRATOR.ordinal());
|
||||
} else {
|
||||
skeleton.item = new ItemStack(ModItems.clay_tablet, 1, 1);
|
||||
}
|
||||
skeleton.markDirty();
|
||||
world.markBlockForUpdate(x, y + 18, z);
|
||||
}
|
||||
|
||||
@ -10,6 +10,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@Deprecated
|
||||
public class MachineChemfac extends BlockDummyable {
|
||||
|
||||
public MachineChemfac(Material mat) {
|
||||
|
||||
@ -0,0 +1,88 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.tileentity.TileEntityProxyDyn;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineChemicalFactory;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class MachineChemicalFactory extends BlockDummyable implements ITooltipProvider, ILookOverlay {
|
||||
|
||||
public MachineChemicalFactory(Material mat) {
|
||||
super(mat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
if(meta >= 12) return new TileEntityMachineChemicalFactory();
|
||||
if(meta >= 6) return new TileEntityProxyDyn().inventory().power().fluid();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
return this.standardOpenBehavior(world, x, y, z, player, 0);
|
||||
}
|
||||
|
||||
@Override public int[] getDimensions() { return new int[] {2, 0, 2, 2, 2, 2}; }
|
||||
@Override public int getOffset() { return 2; }
|
||||
|
||||
@Override
|
||||
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
super.fillSpace(world, x, y, z, dir, o);
|
||||
|
||||
x -= dir.offsetX * 2;
|
||||
z -= dir.offsetZ * 2;
|
||||
|
||||
for(int i = -2; i <= 2; i++) for(int j = -2; j <= 2; j++) {
|
||||
if(Math.abs(i) == 2 || Math.abs(j) == 2) this.makeExtra(world, x + i, y, z + j);
|
||||
}
|
||||
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
for(int i = -2; i <= 2; i++) {
|
||||
this.makeExtra(world, x + dir.offsetX * i + rot.offsetX * 2, y + 2, z + dir.offsetZ * i + rot.offsetZ * 2);
|
||||
this.makeExtra(world, x + dir.offsetX * i - rot.offsetX * 2, y + 2, z + dir.offsetZ * i - rot.offsetZ * 2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
|
||||
this.addStandardInfo(stack, player, list, ext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printHook(Pre event, World world, int x, int y, int z) {
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
if(pos == null) return;
|
||||
|
||||
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
if(!(te instanceof TileEntityMachineChemicalFactory)) return;
|
||||
TileEntityMachineChemicalFactory chemfac = (TileEntityMachineChemicalFactory) te;
|
||||
|
||||
DirPos[] cool = chemfac.getCoolPos();
|
||||
|
||||
for(DirPos dirPos : cool) if(dirPos.compare(x + dirPos.getDir().offsetX, y, z + dirPos.getDir().offsetZ)) {
|
||||
List<String> text = new ArrayList();
|
||||
|
||||
text.add(EnumChatFormatting.GREEN + "-> " + EnumChatFormatting.RESET + chemfac.water.getTankType().getLocalizedName());
|
||||
text.add(EnumChatFormatting.RED + "<- " + EnumChatFormatting.RESET + chemfac.lps.getTankType().getLocalizedName());
|
||||
|
||||
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -14,6 +14,7 @@ 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;
|
||||
@ -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;
|
||||
|
||||
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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,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;
|
||||
@ -70,6 +70,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 +118,8 @@ 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});
|
||||
enableExpensiveMode = config.get(CATEGORY_GENERAL, "1.99_enableExpensiveMode", false, "It does what the name implies.").getBoolean(false);
|
||||
|
||||
final String CATEGORY_528 = CommonConfig.CATEGORY_528;
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -3,8 +3,8 @@ package com.hbm.explosion;
|
||||
import com.hbm.config.BombConfig;
|
||||
import com.hbm.interfaces.IExplosionRay;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.util.ChunkKey;
|
||||
import com.hbm.util.ConcurrentBitSet;
|
||||
import com.hbm.util.SubChunkKey;
|
||||
import com.hbm.util.SubChunkSnapshot;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
@ -16,12 +16,15 @@ import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.concurrent.atomic.DoubleAdder;
|
||||
|
||||
/**
|
||||
* Threaded DDA raytracer for the nuke explosion.
|
||||
* Threaded DDA raytracer for mk5 explosion.
|
||||
*
|
||||
* @author mlbv
|
||||
*/
|
||||
@ -29,6 +32,10 @@ public class ExplosionNukeRayParallelized implements IExplosionRay {
|
||||
|
||||
private static final int WORLD_HEIGHT = 256;
|
||||
private static final int BITSET_SIZE = 16 * WORLD_HEIGHT * 16;
|
||||
private static final int SUBCHUNK_PER_CHUNK = WORLD_HEIGHT >> 4;
|
||||
private static final float NUKE_RESISTANCE_CUTOFF = 2_000_000F;
|
||||
private static final float INITIAL_ENERGY_FACTOR = 0.3F; // Scales crater, no impact on performance
|
||||
private static final double RESOLUTION_FACTOR = 1.0; // Scales ray density, no impact on crater radius
|
||||
|
||||
protected final World world;
|
||||
private final double explosionX, explosionY, explosionZ;
|
||||
@ -36,19 +43,19 @@ public class ExplosionNukeRayParallelized implements IExplosionRay {
|
||||
private final int strength;
|
||||
private final int radius;
|
||||
|
||||
private volatile List<Vec3> directions;
|
||||
private final CompletableFuture<List<Vec3>> directionsFuture;
|
||||
private final ConcurrentMap<ChunkCoordIntPair, ConcurrentBitSet> destructionMap;
|
||||
private final ConcurrentMap<ChunkCoordIntPair, ChunkDamageAccumulator> accumulatedDamageMap;
|
||||
|
||||
private final ConcurrentMap<ChunkKey, SubChunkSnapshot> snapshots;
|
||||
|
||||
private final ConcurrentMap<ChunkCoordIntPair, ConcurrentMap<Integer, DoubleAdder>> damageMap;
|
||||
private final ConcurrentMap<SubChunkKey, SubChunkSnapshot> snapshots;
|
||||
private final ConcurrentMap<SubChunkKey, ConcurrentLinkedQueue<RayTask>> waitingRoom;
|
||||
private final BlockingQueue<RayTask> rayQueue;
|
||||
private final BlockingQueue<ChunkKey> cacheQueue;
|
||||
private final ExecutorService pool;
|
||||
private final CountDownLatch latch;
|
||||
private final Thread latchWatcherThread;
|
||||
private final List<ChunkCoordIntPair> orderedChunks;
|
||||
private final BlockingQueue<SubChunkKey> highPriorityReactiveQueue; // cache queue for rays
|
||||
private final Iterator<SubChunkKey> lowPriorityProactiveIterator;
|
||||
private volatile List<Vec3> directions;
|
||||
private volatile boolean collectFinished = false;
|
||||
private volatile boolean consolidationFinished = false;
|
||||
private volatile boolean destroyFinished = false;
|
||||
@ -66,22 +73,30 @@ public class ExplosionNukeRayParallelized implements IExplosionRay {
|
||||
this.strength = strength;
|
||||
this.radius = radius;
|
||||
|
||||
int rayCount = Math.max(0, (int) (2.5 * Math.PI * strength * strength));
|
||||
|
||||
int rayCount = Math.max(0, (int) (2.5 * Math.PI * strength * strength * RESOLUTION_FACTOR));
|
||||
this.latch = new CountDownLatch(rayCount);
|
||||
this.destructionMap = new ConcurrentHashMap<>();
|
||||
this.accumulatedDamageMap = new ConcurrentHashMap<>();
|
||||
this.snapshots = new ConcurrentHashMap<>();
|
||||
List<SubChunkKey> sortedSubChunks = getAllSubChunks();
|
||||
this.lowPriorityProactiveIterator = sortedSubChunks.iterator();
|
||||
this.highPriorityReactiveQueue = new LinkedBlockingQueue<>();
|
||||
|
||||
int initialChunkCapacity = (int) sortedSubChunks.stream().map(SubChunkKey::getPos).distinct().count();
|
||||
|
||||
this.destructionMap = new ConcurrentHashMap<>(initialChunkCapacity);
|
||||
this.damageMap = new ConcurrentHashMap<>(initialChunkCapacity);
|
||||
|
||||
int subChunkCount = sortedSubChunks.size();
|
||||
this.snapshots = new ConcurrentHashMap<>(subChunkCount);
|
||||
this.waitingRoom = new ConcurrentHashMap<>(subChunkCount);
|
||||
this.orderedChunks = new ArrayList<>();
|
||||
|
||||
this.rayQueue = new LinkedBlockingQueue<>();
|
||||
this.cacheQueue = new LinkedBlockingQueue<>();
|
||||
List<RayTask> initialRayTasks = new ArrayList<>(rayCount);
|
||||
for (int i = 0; i < rayCount; i++) initialRayTasks.add(new RayTask(i));
|
||||
this.rayQueue = new LinkedBlockingQueue<>(initialRayTasks);
|
||||
|
||||
int workers = Math.max(1, Runtime.getRuntime().availableProcessors() - 1);
|
||||
this.pool = Executors.newWorkStealingPool(workers);
|
||||
this.directionsFuture = CompletableFuture.supplyAsync(() -> generateSphereRays(rayCount));
|
||||
|
||||
for (int i = 0; i < rayCount; i++) rayQueue.add(new RayTask(i));
|
||||
for (int i = 0; i < workers; i++) pool.submit(new Worker());
|
||||
|
||||
this.latchWatcherThread = new Thread(() -> {
|
||||
@ -91,11 +106,8 @@ public class ExplosionNukeRayParallelized implements IExplosionRay {
|
||||
Thread.currentThread().interrupt();
|
||||
} finally {
|
||||
collectFinished = true;
|
||||
if (BombConfig.explosionAlgorithm == 2) {
|
||||
pool.submit(this::runConsolidation);
|
||||
} else {
|
||||
consolidationFinished = true;
|
||||
}
|
||||
if (BombConfig.explosionAlgorithm == 2) pool.submit(this::runConsolidation);
|
||||
else consolidationFinished = true;
|
||||
}
|
||||
}, "ExplosionNuke-LatchWatcher-" + System.nanoTime());
|
||||
this.latchWatcherThread.setDaemon(true);
|
||||
@ -105,25 +117,70 @@ public class ExplosionNukeRayParallelized implements IExplosionRay {
|
||||
private static float getNukeResistance(Block b) {
|
||||
if (b.getMaterial().isLiquid()) return 0.1F;
|
||||
if (b == Blocks.sandstone) return Blocks.stone.getExplosionResistance(null);
|
||||
if (b == Blocks.obsidian) return Blocks.stone.getExplosionResistance(null) * 3;
|
||||
if (b == Blocks.obsidian) return Blocks.stone.getExplosionResistance(null) * 3.0F;
|
||||
return b.getExplosionResistance(null);
|
||||
}
|
||||
|
||||
private List<SubChunkKey> getAllSubChunks() {
|
||||
List<SubChunkKey> keys = new ArrayList<>();
|
||||
int cr = (radius + 15) >> 4;
|
||||
int minCX = (originX >> 4) - cr;
|
||||
int maxCX = (originX >> 4) + cr;
|
||||
int minCZ = (originZ >> 4) - cr;
|
||||
int maxCZ = (originZ >> 4) + cr;
|
||||
int minSubY = Math.max(0, (originY - radius) >> 4);
|
||||
int maxSubY = Math.min(SUBCHUNK_PER_CHUNK - 1, (originY + radius) >> 4);
|
||||
int originSubY = originY >> 4;
|
||||
|
||||
for (int cx = minCX; cx <= maxCX; cx++) {
|
||||
for (int cz = minCZ; cz <= maxCZ; cz++) {
|
||||
for (int subY = minSubY; subY <= maxSubY; subY++) {
|
||||
int chunkCenterX = (cx << 4) + 8;
|
||||
int chunkCenterY = (subY << 4) + 8;
|
||||
int chunkCenterZ = (cz << 4) + 8;
|
||||
double dx = chunkCenterX - explosionX;
|
||||
double dy = chunkCenterY - explosionY;
|
||||
double dz = chunkCenterZ - explosionZ;
|
||||
if (dx * dx + dy * dy + dz * dz <= (radius + 14) * (radius + 14)) { // +14 for margin of error
|
||||
keys.add(new SubChunkKey(cx, cz, subY));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
keys.sort(Comparator.comparingInt(key -> {
|
||||
int distCX = key.getPos().chunkXPos - (originX >> 4);
|
||||
int distCZ = key.getPos().chunkZPos - (originZ >> 4);
|
||||
int distSubY = key.getSubY() - originSubY;
|
||||
return distCX * distCX + distCZ * distCZ + distSubY * distSubY;
|
||||
}));
|
||||
return keys;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cacheChunksTick(int timeBudgetMs) {
|
||||
if (collectFinished || this.cacheQueue == null) return;
|
||||
|
||||
if (collectFinished) return;
|
||||
final long deadline = System.nanoTime() + (timeBudgetMs * 1_000_000L);
|
||||
while (System.nanoTime() < deadline) {
|
||||
ChunkKey ck = cacheQueue.poll();
|
||||
SubChunkKey ck = highPriorityReactiveQueue.poll();
|
||||
if (ck == null) break;
|
||||
snapshots.computeIfAbsent(ck, k -> SubChunkSnapshot.getSnapshot(world, k, BombConfig.chunkloading));
|
||||
processCacheKey(ck);
|
||||
}
|
||||
while (System.nanoTime() < deadline && lowPriorityProactiveIterator.hasNext()) {
|
||||
SubChunkKey ck = lowPriorityProactiveIterator.next();
|
||||
processCacheKey(ck);
|
||||
}
|
||||
}
|
||||
|
||||
private void processCacheKey(SubChunkKey ck) {
|
||||
if (snapshots.containsKey(ck)) return;
|
||||
snapshots.put(ck, SubChunkSnapshot.getSnapshot(world, ck, BombConfig.chunkloading));
|
||||
ConcurrentLinkedQueue<RayTask> waiters = waitingRoom.remove(ck);
|
||||
if (waiters != null) rayQueue.addAll(waiters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destructionTick(int timeBudgetMs) {
|
||||
if (!collectFinished || !consolidationFinished || destroyFinished) return; // Added consolidationFinished check
|
||||
if (!collectFinished || !consolidationFinished || destroyFinished) return;
|
||||
|
||||
final long deadline = System.nanoTime() + timeBudgetMs * 1_000_000L;
|
||||
|
||||
@ -187,9 +244,7 @@ public class ExplosionNukeRayParallelized implements IExplosionRay {
|
||||
}
|
||||
if (bs.isEmpty()) {
|
||||
destructionMap.remove(cp);
|
||||
for (int sy = 0; sy < (WORLD_HEIGHT >> 4); sy++) {
|
||||
snapshots.remove(new ChunkKey(cp, sy));
|
||||
}
|
||||
for (int subY = 0; subY < SUBCHUNK_PER_CHUNK; subY++) snapshots.remove(new SubChunkKey(cp, subY));
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
@ -212,32 +267,22 @@ public class ExplosionNukeRayParallelized implements IExplosionRay {
|
||||
this.destroyFinished = true;
|
||||
|
||||
if (this.rayQueue != null) this.rayQueue.clear();
|
||||
if (this.cacheQueue != null) this.cacheQueue.clear();
|
||||
if (this.waitingRoom != null) this.waitingRoom.clear();
|
||||
|
||||
if (this.latch != null) {
|
||||
while (this.latch.getCount() > 0) {
|
||||
this.latch.countDown();
|
||||
}
|
||||
}
|
||||
if (this.latchWatcherThread != null && this.latchWatcherThread.isAlive()) {
|
||||
this.latchWatcherThread.interrupt();
|
||||
}
|
||||
if (this.latch != null) while (this.latch.getCount() > 0) this.latch.countDown();
|
||||
if (this.latchWatcherThread != null && this.latchWatcherThread.isAlive()) this.latchWatcherThread.interrupt();
|
||||
|
||||
if (this.pool != null && !this.pool.isShutdown()) {
|
||||
this.pool.shutdownNow();
|
||||
try {
|
||||
if (!this.pool.awaitTermination(100, TimeUnit.MILLISECONDS)) {
|
||||
MainRegistry.logger.log(Level.ERROR, "ExplosionNukeRayParallelized thread pool did not terminate promptly on cancel.");
|
||||
}
|
||||
if (!this.pool.awaitTermination(100, TimeUnit.MILLISECONDS)) MainRegistry.logger.log(Level.ERROR, "ExplosionNukeRayParallelized thread pool did not terminate promptly on cancel.");
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
if (!this.pool.isShutdown()) {
|
||||
this.pool.shutdownNow();
|
||||
}
|
||||
if (!this.pool.isShutdown()) this.pool.shutdownNow();
|
||||
}
|
||||
}
|
||||
if (this.destructionMap != null) this.destructionMap.clear();
|
||||
if (this.accumulatedDamageMap != null) this.accumulatedDamageMap.clear();
|
||||
if (this.damageMap != null) this.damageMap.clear();
|
||||
if (this.snapshots != null) this.snapshots.clear();
|
||||
if (this.orderedChunks != null) this.orderedChunks.clear();
|
||||
}
|
||||
@ -246,7 +291,7 @@ public class ExplosionNukeRayParallelized implements IExplosionRay {
|
||||
List<Vec3> list = new ArrayList<>(count);
|
||||
if (count == 0) return list;
|
||||
if (count == 1) {
|
||||
list.add(Vec3.createVectorHelper(1, 0, 0).normalize());
|
||||
list.add(Vec3.createVectorHelper(1, 0, 0));
|
||||
return list;
|
||||
}
|
||||
double phi = Math.PI * (3.0 - Math.sqrt(5.0));
|
||||
@ -260,119 +305,66 @@ public class ExplosionNukeRayParallelized implements IExplosionRay {
|
||||
}
|
||||
|
||||
private void runConsolidation() {
|
||||
Iterator<Map.Entry<ChunkCoordIntPair, ChunkDamageAccumulator>> chunkEntryIterator = accumulatedDamageMap.entrySet().iterator();
|
||||
while (chunkEntryIterator.hasNext()) {
|
||||
Map.Entry<ChunkCoordIntPair, ChunkDamageAccumulator> entry = chunkEntryIterator.next();
|
||||
ChunkCoordIntPair cp = entry.getKey();
|
||||
ChunkDamageAccumulator accumulator = entry.getValue();
|
||||
|
||||
if (accumulator.isEmpty()) {
|
||||
chunkEntryIterator.remove();
|
||||
continue;
|
||||
damageMap.forEach((cp, innerDamageMap) -> {
|
||||
if (innerDamageMap.isEmpty()) {
|
||||
damageMap.remove(cp);
|
||||
return;
|
||||
}
|
||||
|
||||
ConcurrentBitSet chunkDestructionBitSet = destructionMap.computeIfAbsent(cp, k -> new ConcurrentBitSet(BITSET_SIZE));
|
||||
|
||||
Iterator<Map.Entry<Integer, DoubleAdder>> damageEntryIterator = accumulator.entrySet().iterator();
|
||||
while (damageEntryIterator.hasNext()) {
|
||||
Map.Entry<Integer, DoubleAdder> damageEntry = damageEntryIterator.next();
|
||||
int bitIndex = damageEntry.getKey();
|
||||
|
||||
float accumulatedDamage = (float) damageEntry.getValue().sum();
|
||||
|
||||
innerDamageMap.forEach((bitIndex, accumulatedDamageAdder) -> {
|
||||
float accumulatedDamage = (float) accumulatedDamageAdder.sum();
|
||||
if (accumulatedDamage <= 0.0f) {
|
||||
damageEntryIterator.remove();
|
||||
continue;
|
||||
innerDamageMap.remove(bitIndex);
|
||||
return;
|
||||
}
|
||||
|
||||
int yGlobal = WORLD_HEIGHT - 1 - (bitIndex >>> 8);
|
||||
int subY = yGlobal >> 4;
|
||||
|
||||
if (subY < 0) {
|
||||
damageEntryIterator.remove();
|
||||
continue;
|
||||
innerDamageMap.remove(bitIndex);
|
||||
return;
|
||||
}
|
||||
|
||||
ChunkKey snapshotKey = new ChunkKey(cp, subY);
|
||||
SubChunkKey snapshotKey = new SubChunkKey(cp, subY);
|
||||
SubChunkSnapshot snap = snapshots.get(snapshotKey);
|
||||
Block originalBlock;
|
||||
|
||||
if (snap == null || snap == SubChunkSnapshot.EMPTY) {
|
||||
damageEntryIterator.remove();
|
||||
continue;
|
||||
} else {
|
||||
int xLocal = (bitIndex >>> 4) & 0xF;
|
||||
int zLocal = bitIndex & 0xF;
|
||||
originalBlock = snap.getBlock(xLocal, yGlobal & 0xF, zLocal);
|
||||
if (originalBlock == Blocks.air) {
|
||||
damageEntryIterator.remove();
|
||||
continue;
|
||||
}
|
||||
innerDamageMap.remove(bitIndex);
|
||||
return;
|
||||
}
|
||||
int xLocal = (bitIndex >>> 4) & 0xF;
|
||||
int zLocal = bitIndex & 0xF;
|
||||
Block originalBlock = snap.getBlock(xLocal, yGlobal & 0xF, zLocal);
|
||||
if (originalBlock == Blocks.air) {
|
||||
innerDamageMap.remove(bitIndex);
|
||||
return;
|
||||
}
|
||||
|
||||
float resistance = getNukeResistance(originalBlock);
|
||||
if (accumulatedDamage >= resistance) {
|
||||
chunkDestructionBitSet.set(bitIndex);
|
||||
damageEntryIterator.remove();
|
||||
}
|
||||
}
|
||||
|
||||
if (accumulator.isEmpty()) {
|
||||
chunkEntryIterator.remove();
|
||||
}
|
||||
}
|
||||
accumulatedDamageMap.clear();
|
||||
if (accumulatedDamage >= resistance * RESOLUTION_FACTOR) chunkDestructionBitSet.set(bitIndex);
|
||||
innerDamageMap.remove(bitIndex);
|
||||
});
|
||||
if (innerDamageMap.isEmpty()) damageMap.remove(cp);
|
||||
});
|
||||
damageMap.clear();
|
||||
consolidationFinished = true;
|
||||
}
|
||||
|
||||
private static class ChunkDamageAccumulator {
|
||||
// key = bitIndex, value = total accumulated damage
|
||||
private final ConcurrentHashMap<Integer, DoubleAdder> damageMap = new ConcurrentHashMap<>();
|
||||
|
||||
public void addDamage(int bitIndex, float damageAmount) {
|
||||
if (damageAmount <= 0) return;
|
||||
DoubleAdder adder = damageMap.computeIfAbsent(bitIndex, k -> new DoubleAdder());
|
||||
adder.add(damageAmount);
|
||||
}
|
||||
|
||||
/*public float getDamage(int bitIndex) {
|
||||
DoubleAdder adder = damageMap.get(bitIndex);
|
||||
return adder == null ? 0f : (float) adder.sum();
|
||||
}*/
|
||||
|
||||
/*public void clearDamage(int bitIndex) {
|
||||
damageMap.remove(bitIndex);
|
||||
}*/
|
||||
|
||||
public Set<Map.Entry<Integer, DoubleAdder>> entrySet() {
|
||||
return damageMap.entrySet();
|
||||
}
|
||||
|
||||
|
||||
public boolean isEmpty() {
|
||||
return damageMap.isEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
private class Worker implements Runnable {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
while (true) {
|
||||
if (collectFinished && rayQueue.isEmpty()) break;
|
||||
while (!collectFinished && !Thread.currentThread().isInterrupted()) {
|
||||
RayTask task = rayQueue.poll(100, TimeUnit.MILLISECONDS);
|
||||
if (task == null) {
|
||||
if (collectFinished && rayQueue.isEmpty()) break;
|
||||
continue;
|
||||
}
|
||||
task.trace();
|
||||
if (task != null) task.trace();
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class RayTask {
|
||||
private static final double RAY_DIRECTION_EPSILON = 1e-6;
|
||||
private static final double PROCESSING_EPSILON = 1e-9;
|
||||
private static final float MIN_EFFECTIVE_DIST_FOR_ENERGY_CALC = 0.01f;
|
||||
|
||||
final int dirIndex;
|
||||
double px, py, pz;
|
||||
int x, y, z;
|
||||
@ -382,9 +374,8 @@ public class ExplosionNukeRayParallelized implements IExplosionRay {
|
||||
boolean initialised = false;
|
||||
double currentRayPosition;
|
||||
|
||||
private static final double RAY_DIRECTION_EPSILON = 1e-6;
|
||||
private static final double PROCESSING_EPSILON = 1e-9;
|
||||
private static final float MIN_EFFECTIVE_DIST_FOR_ENERGY_CALC = 0.01f;
|
||||
private int lastCX = Integer.MIN_VALUE, lastCZ = Integer.MIN_VALUE, lastSubY = Integer.MIN_VALUE;
|
||||
private SubChunkKey currentSubChunkKey = null;
|
||||
|
||||
RayTask(int dirIdx) {
|
||||
this.dirIndex = dirIdx;
|
||||
@ -393,9 +384,7 @@ public class ExplosionNukeRayParallelized implements IExplosionRay {
|
||||
void init() {
|
||||
if (directions == null) directions = directionsFuture.join();
|
||||
Vec3 dir = directions.get(this.dirIndex);
|
||||
// This scales the crater. Higher = bigger.
|
||||
// Currently the crater is a little bit bigger than the original implementation
|
||||
this.energy = strength * 0.3F;
|
||||
this.energy = strength * INITIAL_ENERGY_FACTOR;
|
||||
this.px = explosionX;
|
||||
this.py = explosionY;
|
||||
this.pz = explosionZ;
|
||||
@ -411,20 +400,17 @@ public class ExplosionNukeRayParallelized implements IExplosionRay {
|
||||
double absDirX = Math.abs(dirX);
|
||||
this.stepX = (absDirX < RAY_DIRECTION_EPSILON) ? 0 : (dirX > 0 ? 1 : -1);
|
||||
this.tDeltaX = (stepX == 0) ? Double.POSITIVE_INFINITY : 1.0 / absDirX;
|
||||
this.tMaxX = (stepX == 0) ? Double.POSITIVE_INFINITY :
|
||||
((stepX > 0 ? (this.x + 1 - this.px) : (this.px - this.x)) * this.tDeltaX);
|
||||
this.tMaxX = (stepX == 0) ? Double.POSITIVE_INFINITY : ((stepX > 0 ? (this.x + 1 - this.px) : (this.px - this.x)) * this.tDeltaX);
|
||||
|
||||
double absDirY = Math.abs(dirY);
|
||||
this.stepY = (absDirY < RAY_DIRECTION_EPSILON) ? 0 : (dirY > 0 ? 1 : -1);
|
||||
this.tDeltaY = (stepY == 0) ? Double.POSITIVE_INFINITY : 1.0 / absDirY;
|
||||
this.tMaxY = (stepY == 0) ? Double.POSITIVE_INFINITY :
|
||||
((stepY > 0 ? (this.y + 1 - this.py) : (this.py - this.y)) * this.tDeltaY);
|
||||
this.tMaxY = (stepY == 0) ? Double.POSITIVE_INFINITY : ((stepY > 0 ? (this.y + 1 - this.py) : (this.py - this.y)) * this.tDeltaY);
|
||||
|
||||
double absDirZ = Math.abs(dirZ);
|
||||
this.stepZ = (absDirZ < RAY_DIRECTION_EPSILON) ? 0 : (dirZ > 0 ? 1 : -1);
|
||||
this.tDeltaZ = (stepZ == 0) ? Double.POSITIVE_INFINITY : 1.0 / absDirZ;
|
||||
this.tMaxZ = (stepZ == 0) ? Double.POSITIVE_INFINITY :
|
||||
((stepZ > 0 ? (this.z + 1 - this.pz) : (this.pz - this.z)) * this.tDeltaZ);
|
||||
this.tMaxZ = (stepZ == 0) ? Double.POSITIVE_INFINITY : ((stepZ > 0 ? (this.z + 1 - this.pz) : (this.pz - this.z)) * this.tDeltaZ);
|
||||
|
||||
this.initialised = true;
|
||||
}
|
||||
@ -437,15 +423,28 @@ public class ExplosionNukeRayParallelized implements IExplosionRay {
|
||||
}
|
||||
|
||||
while (energy > 0) {
|
||||
if (y < 0 || y >= WORLD_HEIGHT) break;
|
||||
if (y < 0 || y >= WORLD_HEIGHT || Thread.currentThread().isInterrupted()) break;
|
||||
if (currentRayPosition >= radius - PROCESSING_EPSILON) break;
|
||||
|
||||
ChunkKey ck = new ChunkKey(x >> 4, z >> 4, y >> 4);
|
||||
SubChunkSnapshot snap = snapshots.get(ck);
|
||||
int cx = x >> 4;
|
||||
int cz = z >> 4;
|
||||
int subY = y >> 4;
|
||||
if (cx != lastCX || cz != lastCZ || subY != lastSubY) {
|
||||
currentSubChunkKey = new SubChunkKey(cx, cz, subY);
|
||||
lastCX = cx;
|
||||
lastCZ = cz;
|
||||
lastSubY = subY;
|
||||
}
|
||||
|
||||
SubChunkSnapshot snap = snapshots.get(currentSubChunkKey);
|
||||
if (snap == null) {
|
||||
cacheQueue.offer(ck);
|
||||
rayQueue.offer(this);
|
||||
final boolean[] amFirst = {false};
|
||||
ConcurrentLinkedQueue<RayTask> waiters = waitingRoom.computeIfAbsent(currentSubChunkKey, k -> {
|
||||
amFirst[0] = true;
|
||||
return new ConcurrentLinkedQueue<>();
|
||||
});
|
||||
if (amFirst[0]) highPriorityReactiveQueue.add(currentSubChunkKey);
|
||||
waiters.add(this);
|
||||
return;
|
||||
}
|
||||
double t_exit_voxel = Math.min(tMaxX, Math.min(tMaxY, tMaxZ));
|
||||
@ -456,15 +455,13 @@ public class ExplosionNukeRayParallelized implements IExplosionRay {
|
||||
if (this.currentRayPosition + segmentLenInVoxel > radius - PROCESSING_EPSILON) {
|
||||
segmentLenForProcessing = Math.max(0.0, radius - this.currentRayPosition);
|
||||
stopAfterThisSegment = true;
|
||||
} else {
|
||||
segmentLenForProcessing = segmentLenInVoxel;
|
||||
}
|
||||
} else segmentLenForProcessing = segmentLenInVoxel;
|
||||
|
||||
if (snap != SubChunkSnapshot.EMPTY && segmentLenForProcessing > PROCESSING_EPSILON) {
|
||||
Block block = snap.getBlock(x & 0xF, y & 0xF, z & 0xF);
|
||||
if (block != Blocks.air) {
|
||||
float resistance = getNukeResistance(block);
|
||||
if (resistance >= 2_000_000F) { // cutoff
|
||||
if (resistance >= NUKE_RESISTANCE_CUTOFF) {
|
||||
energy = 0;
|
||||
} else {
|
||||
double energyLossFactor = getEnergyLossFactor(resistance);
|
||||
@ -472,26 +469,16 @@ public class ExplosionNukeRayParallelized implements IExplosionRay {
|
||||
energy -= damageDealt;
|
||||
if (damageDealt > 0) {
|
||||
int bitIndex = ((WORLD_HEIGHT - 1 - y) << 8) | ((x & 0xF) << 4) | (z & 0xF);
|
||||
ChunkCoordIntPair chunkPos = currentSubChunkKey.getPos();
|
||||
if (BombConfig.explosionAlgorithm == 2) {
|
||||
ChunkCoordIntPair chunkPos = ck.pos;
|
||||
ChunkDamageAccumulator chunkAccumulator =
|
||||
accumulatedDamageMap.computeIfAbsent(chunkPos, k -> new ChunkDamageAccumulator());
|
||||
chunkAccumulator.addDamage(bitIndex, damageDealt);
|
||||
} else {
|
||||
if (energy > 0) {
|
||||
ConcurrentBitSet bs = destructionMap.computeIfAbsent(
|
||||
ck.pos,
|
||||
posKey -> new ConcurrentBitSet(BITSET_SIZE)
|
||||
);
|
||||
bs.set(bitIndex);
|
||||
}
|
||||
}
|
||||
damageMap.computeIfAbsent(chunkPos, cp -> new ConcurrentHashMap<>(256)).computeIfAbsent(bitIndex, k -> new DoubleAdder()).add(damageDealt);
|
||||
} else if (energy > 0) destructionMap.computeIfAbsent(chunkPos, posKey -> new ConcurrentBitSet(BITSET_SIZE)).set(bitIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.currentRayPosition = t_exit_voxel;
|
||||
if (energy <= 0 || stopAfterThisSegment || this.currentRayPosition >= radius - PROCESSING_EPSILON) break;
|
||||
if (energy <= 0 || stopAfterThisSegment) break;
|
||||
|
||||
if (tMaxX < tMaxY) {
|
||||
if (tMaxX < tMaxZ) {
|
||||
@ -515,15 +502,7 @@ public class ExplosionNukeRayParallelized implements IExplosionRay {
|
||||
}
|
||||
|
||||
private double getEnergyLossFactor(float resistance) {
|
||||
double dxBlockToCenter = (this.x + 0.5) - explosionX;
|
||||
double dyBlockToCenter = (this.y + 0.5) - explosionY;
|
||||
double dzBlockToCenter = (this.z + 0.5) - explosionZ;
|
||||
double distToBlockCenterSq = dxBlockToCenter * dxBlockToCenter +
|
||||
dyBlockToCenter * dyBlockToCenter +
|
||||
dzBlockToCenter * dzBlockToCenter;
|
||||
double distToBlockCenter = Math.sqrt(distToBlockCenterSq);
|
||||
|
||||
double effectiveDist = Math.max(distToBlockCenter, MIN_EFFECTIVE_DIST_FOR_ENERGY_CALC);
|
||||
double effectiveDist = Math.max(this.currentRayPosition, MIN_EFFECTIVE_DIST_FOR_ENERGY_CALC);
|
||||
return (Math.pow(resistance + 1.0, 3.0 * (effectiveDist / radius)) - 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,19 +2,27 @@ package com.hbm.handler;
|
||||
|
||||
import com.hbm.inventory.gui.GUICalculator;
|
||||
import com.hbm.items.IKeybindReceiver;
|
||||
import com.hbm.items.weapon.sedna.ItemGunBaseNT;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import com.hbm.config.GeneralConfig;
|
||||
import com.hbm.extprop.HbmPlayerProps;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toserver.KeybindPacket;
|
||||
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.common.eventhandler.EventPriority;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.InputEvent.KeyInputEvent;
|
||||
import cpw.mods.fml.common.gameevent.InputEvent.MouseInputEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@ -64,34 +72,121 @@ public class HbmKeybinds {
|
||||
ClientRegistry.registerKeyBinding(craneLeftKey);
|
||||
ClientRegistry.registerKeyBinding(craneRightKey);
|
||||
ClientRegistry.registerKeyBinding(craneLoadKey);
|
||||
ClientRegistry.registerKeyBinding(abilityCycle);
|
||||
ClientRegistry.registerKeyBinding(abilityAlt);
|
||||
ClientRegistry.registerKeyBinding(copyToolAlt);
|
||||
ClientRegistry.registerKeyBinding(copyToolCtrl);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SubscribeEvent(priority = EventPriority.LOW)
|
||||
public void mouseEvent(MouseInputEvent event) {
|
||||
HbmPlayerProps props = HbmPlayerProps.getData(MainRegistry.proxy.me());
|
||||
|
||||
/// OVERLAP HANDLING ///
|
||||
handleOverlap(Mouse.getEventButtonState(), Mouse.getEventButton() - 100);
|
||||
|
||||
for(EnumKeybind key : EnumKeybind.values()) {
|
||||
boolean last = props.getKeyPressed(key);
|
||||
boolean current = MainRegistry.proxy.getIsKeyPressed(key);
|
||||
/// KEYBIND PROPS ///
|
||||
handleProps(Mouse.getEventButtonState(), Mouse.getEventButton() - 100);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SubscribeEvent(priority = EventPriority.LOW)
|
||||
public void keyEvent(KeyInputEvent event) {
|
||||
|
||||
/// OVERLAP HANDLING ///
|
||||
handleOverlap(Keyboard.getEventKeyState(), Keyboard.getEventKey());
|
||||
|
||||
/// KEYBIND PROPS ///
|
||||
handleProps(Keyboard.getEventKeyState(), Keyboard.getEventKey());
|
||||
|
||||
/// CALCULATOR ///
|
||||
if(calculatorKey.getIsKeyPressed()) {
|
||||
MainRegistry.proxy.me().closeScreen();
|
||||
FMLCommonHandler.instance().showGuiScreen(new GUICalculator());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shitty hack: Keybinds fire before minecraft checks right click on block, which means the tool cycle keybind would fire too.
|
||||
* If cycle collides with right click and a block is being used, cancel the keybind.
|
||||
* @param event
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SubscribeEvent
|
||||
public void postClientTick(ClientTickEvent event) {
|
||||
if(event.phase != event.phase.END) return;
|
||||
EntityPlayer player = MainRegistry.proxy.me();
|
||||
if(player == null) return;
|
||||
if(player.worldObj == null) return;
|
||||
|
||||
HbmPlayerProps props = HbmPlayerProps.getData(player);
|
||||
|
||||
// in theory, this should do the same keybind crap as the main one, but at the end of the client tick, fixing the issue
|
||||
// of detecting when a block is being interacted with
|
||||
// in practice, this shit doesn't fucking work. detection fails when the click is sub one tick long
|
||||
if(Minecraft.getMinecraft().gameSettings.keyBindUseItem.getKeyCode() == abilityCycle.getKeyCode()) {
|
||||
boolean last = props.getKeyPressed(EnumKeybind.ABILITY_CYCLE);
|
||||
boolean current = abilityCycle.pressed;
|
||||
|
||||
if(last != current) {
|
||||
PacketDispatcher.wrapper.sendToServer(new KeybindPacket(key, current));
|
||||
props.setKeyPressed(key, current);
|
||||
PacketDispatcher.wrapper.sendToServer(new KeybindPacket(EnumKeybind.ABILITY_CYCLE, current));
|
||||
props.setKeyPressed(EnumKeybind.ABILITY_CYCLE, current);
|
||||
onPressedClient(player, EnumKeybind.ABILITY_CYCLE, current);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void keyEvent(KeyInputEvent event) {
|
||||
EntityPlayer player = MainRegistry.proxy.me();
|
||||
if (calculatorKey.getIsKeyPressed()) { // handle the calculator client-side only
|
||||
player.closeScreen();
|
||||
FMLCommonHandler.instance().showGuiScreen(new GUICalculator());
|
||||
/** Handles keybind overlap. Make sure this runs first before referencing the keybinds set by the extprops */
|
||||
public static void handleOverlap(boolean state, int keyCode) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
if(GeneralConfig.enableKeybindOverlap && (mc.currentScreen == null || mc.currentScreen.allowUserInput)) {
|
||||
|
||||
//if anything errors here, run ./gradlew clean setupDecompWorkSpace
|
||||
for(Object o : KeyBinding.keybindArray) {
|
||||
KeyBinding key = (KeyBinding) o;
|
||||
|
||||
if(keyCode != 0 && key.getKeyCode() == keyCode && KeyBinding.hash.lookup(key.getKeyCode()) != key) {
|
||||
|
||||
key.pressed = state;
|
||||
if(state && key.pressTime == 0) {
|
||||
key.pressTime = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// GUN HANDLING ///
|
||||
boolean gunKey = keyCode == HbmKeybinds.gunPrimaryKey.getKeyCode() || keyCode == HbmKeybinds.gunSecondaryKey.getKeyCode() ||
|
||||
keyCode == HbmKeybinds.gunTertiaryKey.getKeyCode() || keyCode == HbmKeybinds.reloadKey.getKeyCode();
|
||||
|
||||
EntityPlayer player = mc.thePlayer;
|
||||
|
||||
if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemGunBaseNT) {
|
||||
|
||||
/* Shoot in favor of attacking */
|
||||
if(gunKey && keyCode == mc.gameSettings.keyBindAttack.getKeyCode()) {
|
||||
mc.gameSettings.keyBindAttack.pressed = false;
|
||||
mc.gameSettings.keyBindAttack.pressTime = 0;
|
||||
}
|
||||
|
||||
/* Shoot in favor of interacting */
|
||||
/*if(gunKey && keyCode == mc.gameSettings.keyBindUseItem.getKeyCode()) {
|
||||
mc.gameSettings.keyBindUseItem.pressed = false;
|
||||
mc.gameSettings.keyBindUseItem.pressTime = 0;
|
||||
}*/
|
||||
|
||||
/* Scope in favor of picking */
|
||||
if(gunKey && keyCode == mc.gameSettings.keyBindPickBlock.getKeyCode()) {
|
||||
mc.gameSettings.keyBindPickBlock.pressed = false;
|
||||
mc.gameSettings.keyBindPickBlock.pressTime = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void handleProps(boolean state, int keyCode) {
|
||||
|
||||
/// KEYBIND PROPS ///
|
||||
EntityPlayer player = MainRegistry.proxy.me();
|
||||
HbmPlayerProps props = HbmPlayerProps.getData(player);
|
||||
|
||||
for(EnumKeybind key : EnumKeybind.values()) {
|
||||
@ -99,8 +194,12 @@ public class HbmKeybinds {
|
||||
boolean current = MainRegistry.proxy.getIsKeyPressed(key);
|
||||
|
||||
if(last != current) {
|
||||
PacketDispatcher.wrapper.sendToServer(new KeybindPacket(key, current));
|
||||
|
||||
/// ABILITY HANDLING ///
|
||||
if(key == EnumKeybind.ABILITY_CYCLE && Minecraft.getMinecraft().gameSettings.keyBindUseItem.getKeyCode() == abilityCycle.getKeyCode()) continue;
|
||||
|
||||
props.setKeyPressed(key, current);
|
||||
PacketDispatcher.wrapper.sendToServer(new KeybindPacket(key, current));
|
||||
onPressedClient(player, key, current);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -175,7 +175,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 +211,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 +248,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 +285,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 +324,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)));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
18
src/main/java/com/hbm/handler/ae2/AE2CompatHandler.java
Normal file
18
src/main/java/com/hbm/handler/ae2/AE2CompatHandler.java
Normal file
@ -0,0 +1,18 @@
|
||||
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());
|
||||
}
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@ -31,6 +31,12 @@ public class ContainerBase extends Container {
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return tile.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
/** Respects slot restrictions */
|
||||
@Override
|
||||
protected boolean mergeItemStack(ItemStack slotStack, int start, int end, boolean direction) {
|
||||
return super.mergeItemStack(slotStack, start, end, direction); // overriding this with InventoryUtil.mergeItemStack breaks it but invoking it directly doesn't? wtf?
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||
@ -89,7 +95,10 @@ public class ContainerBase extends Container {
|
||||
* @param from the slot index to start from
|
||||
*/
|
||||
public void addSlots(IInventory inv, int from, int x, int y, int rows, int cols) {
|
||||
int slotSize = 18;
|
||||
addSlots(inv, from, x, y, rows, cols, 18);
|
||||
}
|
||||
|
||||
public void addSlots(IInventory inv, int from, int x, int y, int rows, int cols, int slotSize) {
|
||||
for(int row = 0; row < rows; row++) {
|
||||
for(int col = 0; col < cols; col++) {
|
||||
this.addSlotToContainer(new SlotNonRetarded(inv, col + row * cols + from, x + col * slotSize, y + row * slotSize));
|
||||
@ -98,14 +107,20 @@ public class ContainerBase extends Container {
|
||||
}
|
||||
|
||||
public void addOutputSlots(EntityPlayer player, IInventory inv, int from, int x, int y, int rows, int cols) {
|
||||
int slotSize = 18;
|
||||
addOutputSlots(player, inv, from, x, y, rows, cols, 18);
|
||||
}
|
||||
|
||||
public void addOutputSlots(EntityPlayer player, IInventory inv, int from, int x, int y, int rows, int cols, int slotSize) {
|
||||
for(int row = 0; row < rows; row++) for(int col = 0; col < cols; col++) {
|
||||
this.addSlotToContainer(new SlotCraftingOutput(player, inv, col + row * cols + from, x + col * slotSize, y + row * slotSize));
|
||||
}
|
||||
}
|
||||
|
||||
public void addTakeOnlySlots(IInventory inv, int from, int x, int y, int rows, int cols) {
|
||||
int slotSize = 18;
|
||||
addTakeOnlySlots(inv, from, x, y, rows, cols, 18);
|
||||
}
|
||||
|
||||
public void addTakeOnlySlots(IInventory inv, int from, int x, int y, int rows, int cols, int slotSize) {
|
||||
for(int row = 0; row < rows; row++) for(int col = 0; col < cols; col++) {
|
||||
this.addSlotToContainer(new SlotTakeOnly(inv, col + row * cols + from, x + col * slotSize, y + row * slotSize));
|
||||
}
|
||||
|
||||
@ -24,7 +24,11 @@ public class ContainerCrateBase extends ContainerBase {
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
this.addSlotToContainer(new SlotNonRetarded(invPlayer, i, playerInvX + i * 18, playerHotbarY));
|
||||
this.addSlotToContainer(
|
||||
(invPlayer.currentItem == i && this.tile instanceof ItemBlockStorageCrate.InventoryCrate) ?
|
||||
new SlotPlayerCrateLocked(invPlayer, i, playerInvX + i * 18, playerHotbarY) :
|
||||
new SlotNonRetarded(invPlayer, i, playerInvX + i * 18, playerHotbarY)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,23 +53,22 @@ public class ContainerCrateBase extends ContainerBase {
|
||||
tile.closeInventory();
|
||||
}
|
||||
|
||||
public class SlotPlayerCrate extends SlotNonRetarded {
|
||||
/**
|
||||
* No touching anything here. No moving around, no taking, no inserting, fuck off.
|
||||
*/
|
||||
public class SlotPlayerCrateLocked extends SlotNonRetarded {
|
||||
|
||||
public SlotPlayerCrate(IInventory inventory, int id, int x, int y) {
|
||||
public SlotPlayerCrateLocked(IInventory inventory, int id, int x, int y) {
|
||||
super(inventory, id, x, y);
|
||||
}
|
||||
|
||||
/**
|
||||
* This prevents the player from moving containers that are being held *at all*, fixing a decently big dupe.
|
||||
* I hate that this has to be here but... It is what it is.
|
||||
*/
|
||||
@Override
|
||||
public boolean canTakeStack(EntityPlayer player) {
|
||||
if(player.inventory.currentItem == this.getSlotIndex() && // If this slot is the current held slot.
|
||||
this.getStack() != null && this.getStack().getItem() instanceof ItemBlockStorageCrate && // If the slot contains a storage crate.
|
||||
player.openContainer instanceof ContainerCrateBase && !(ContainerCrateBase.this.tile instanceof TileEntity)) // If the player is currently inside a crate container.
|
||||
return false;
|
||||
return super.canTakeStack(player);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack item) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,77 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.inventory.SlotCraftingOutput;
|
||||
import com.hbm.inventory.SlotNonRetarded;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemMachineUpgrade;
|
||||
import com.hbm.util.InventoryUtil;
|
||||
|
||||
import api.hbm.energymk2.IBatteryItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerMachineChemicalFactory extends ContainerBase {
|
||||
|
||||
public ContainerMachineChemicalFactory(InventoryPlayer invPlayer, IInventory chemicalPlant) {
|
||||
super(invPlayer, chemicalPlant);
|
||||
|
||||
// Battery
|
||||
this.addSlotToContainer(new SlotNonRetarded(chemicalPlant, 0, 224, 88));
|
||||
// Upgrades
|
||||
this.addSlots(chemicalPlant, 1, 206, 125, 3, 1);
|
||||
|
||||
for(int i = 0; i < 4; i++) {
|
||||
// Template
|
||||
this.addSlots(chemicalPlant, 4 + i * 7, 93, 20 + i * 22, 1, 1, 16);
|
||||
// Solid Input
|
||||
this.addSlots(chemicalPlant, 5 + i * 7, 10, 20 + i * 22, 1, 3, 16);
|
||||
// Solid Output
|
||||
this.addOutputSlots(invPlayer.player, chemicalPlant, 8 + i * 7, 139, 20 + i * 22, 1, 3, 16);
|
||||
}
|
||||
|
||||
this.playerInv(invPlayer, 26, 134);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||
ItemStack slotOriginal = null;
|
||||
Slot slot = (Slot) this.inventorySlots.get(index);
|
||||
|
||||
if(slot != null && slot.getHasStack()) {
|
||||
ItemStack slotStack = slot.getStack();
|
||||
slotOriginal = slotStack.copy();
|
||||
|
||||
if(index <= tile.getSizeInventory() - 1) {
|
||||
SlotCraftingOutput.checkAchievements(player, slotStack);
|
||||
if(!this.mergeItemStack(slotStack, tile.getSizeInventory(), this.inventorySlots.size(), true)) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
|
||||
if(slotOriginal.getItem() instanceof IBatteryItem || slotOriginal.getItem() == ModItems.battery_creative) {
|
||||
if(!this.mergeItemStack(slotStack, 0, 1, false)) return null;
|
||||
} else if(slotOriginal.getItem() instanceof ItemMachineUpgrade) {
|
||||
if(!this.mergeItemStack(slotStack, 1, 4, false)) return null;
|
||||
} else {
|
||||
if(!InventoryUtil.mergeItemStack(this.inventorySlots, slotStack, 5, 8, false) &&
|
||||
!InventoryUtil.mergeItemStack(this.inventorySlots, slotStack, 12, 15, false) &&
|
||||
!InventoryUtil.mergeItemStack(this.inventorySlots, slotStack, 19, 22, false) &&
|
||||
!InventoryUtil.mergeItemStack(this.inventorySlots, slotStack, 26, 29, false)) return null;
|
||||
}
|
||||
}
|
||||
|
||||
if(slotStack.stackSize == 0) {
|
||||
slot.putStack(null);
|
||||
} else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
|
||||
slot.onPickupFromSlot(player, slotStack);
|
||||
}
|
||||
|
||||
return slotOriginal;
|
||||
}
|
||||
}
|
||||
@ -5,6 +5,7 @@ import com.hbm.inventory.SlotNonRetarded;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemChemistryTemplate;
|
||||
import com.hbm.items.machine.ItemMachineUpgrade;
|
||||
import com.hbm.util.InventoryUtil;
|
||||
|
||||
import api.hbm.energymk2.IBatteryItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@ -61,7 +62,7 @@ public class ContainerMachineChemicalPlant extends ContainerBase {
|
||||
} else if(slotOriginal.getItem() instanceof ItemMachineUpgrade) {
|
||||
if(!this.mergeItemStack(slotStack, 2, 4, false)) return null;
|
||||
} else {
|
||||
if(!this.mergeItemStack(slotStack, 4, 7, false)) return null;
|
||||
if(!InventoryUtil.mergeItemStack(this.inventorySlots, slotStack, 4, 7, false)) return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ public class FluidType {
|
||||
public int flammability;
|
||||
public int reactivity;
|
||||
public EnumSymbol symbol;
|
||||
public boolean customFluid = false;
|
||||
public boolean renderWithTint = false;
|
||||
|
||||
public static final int ROOM_TEMPERATURE = 20;
|
||||
|
||||
@ -81,7 +81,7 @@ public class FluidType {
|
||||
this.texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/fluids/" + texName + ".png");
|
||||
this.guiTint = tint;
|
||||
this.localizedOverride = displayName;
|
||||
this.customFluid = true;
|
||||
this.renderWithTint = true;
|
||||
|
||||
this.id = id;
|
||||
Fluids.register(this, id);
|
||||
@ -95,6 +95,23 @@ public class FluidType {
|
||||
}
|
||||
}
|
||||
|
||||
/** For CompatFluidRegistry */
|
||||
public FluidType(String name, int id, int color, int p, int f, int r, EnumSymbol symbol, ResourceLocation texture) {
|
||||
this.stringId = name;
|
||||
this.color = color;
|
||||
this.unlocalized = "hbmfluid." + name.toLowerCase(Locale.US);
|
||||
this.poison = p;
|
||||
this.flammability = f;
|
||||
this.reactivity = r;
|
||||
this.symbol = symbol;
|
||||
this.texture = texture;
|
||||
this.renderWithTint = true;
|
||||
|
||||
this.id = id;
|
||||
Fluids.register(this, id);
|
||||
Fluids.foreignFluids.add(this);
|
||||
}
|
||||
|
||||
public FluidType setTemp(int temperature) {
|
||||
this.temperature = temperature;
|
||||
return this;
|
||||
|
||||
@ -28,12 +28,15 @@ import com.hbm.inventory.fluid.trait.FT_Toxin.*;
|
||||
import com.hbm.render.util.EnumSymbol;
|
||||
import com.hbm.util.ArmorRegistry.HazardClass;
|
||||
|
||||
import api.hbm.fluidmk2.IFluidRegisterListener;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
|
||||
public class Fluids {
|
||||
|
||||
public static final Gson gson = new Gson();
|
||||
|
||||
public static List<IFluidRegisterListener> additionalListeners = new ArrayList();
|
||||
|
||||
public static FluidType NONE;
|
||||
public static FluidType AIR;
|
||||
@ -194,11 +197,14 @@ public class Fluids {
|
||||
public static final HashBiMap<String, FluidType> renameMapping = HashBiMap.create();
|
||||
|
||||
public static List<FluidType> customFluids = new ArrayList();
|
||||
public static List<FluidType> foreignFluids = new ArrayList();
|
||||
|
||||
private static final HashMap<Integer, FluidType> idMapping = new HashMap();
|
||||
private static final HashMap<String, FluidType> nameMapping = new HashMap();
|
||||
/** Inconsequential, only actually used when listing all fluids with niceOrder disabled */
|
||||
protected static final List<FluidType> registerOrder = new ArrayList();
|
||||
protected static final List<FluidType> metaOrder = new ArrayList();
|
||||
/** What's used to list fluids with niceOrder enabled */
|
||||
public static final List<FluidType> metaOrder = new ArrayList();
|
||||
|
||||
public static final FT_Liquid LIQUID = new FT_Liquid();
|
||||
public static final FT_Viscous VISCOUS = new FT_Viscous();
|
||||
@ -870,10 +876,12 @@ public class Fluids {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void reloadFluids(){
|
||||
File folder = MainRegistry.configHbmDir;
|
||||
File customTypes = new File(folder.getAbsolutePath() + File.separatorChar + "hbmFluidTypes.json");
|
||||
if(!customTypes.exists()) initDefaultFluids(customTypes);
|
||||
|
||||
for(FluidType type : customFluids){
|
||||
idMapping.remove(type.getID());
|
||||
registerOrder.remove(type);
|
||||
@ -881,6 +889,15 @@ public class Fluids {
|
||||
metaOrder.remove(type);
|
||||
}
|
||||
customFluids.clear();
|
||||
|
||||
for(FluidType type : foreignFluids){
|
||||
idMapping.remove(type.getID());
|
||||
registerOrder.remove(type);
|
||||
nameMapping.remove(type.getName());
|
||||
metaOrder.remove(type);
|
||||
}
|
||||
foreignFluids.clear();
|
||||
|
||||
readCustomFluids(customTypes);
|
||||
for(FluidType custom : customFluids) metaOrder.add(custom);
|
||||
File config = new File(MainRegistry.configHbmDir.getAbsolutePath() + File.separatorChar + "hbmFluidTraits.json");
|
||||
@ -891,6 +908,8 @@ public class Fluids {
|
||||
} else {
|
||||
readTraits(config);
|
||||
}
|
||||
|
||||
for(IFluidRegisterListener listener : additionalListeners) listener.onFluidsLoad();
|
||||
}
|
||||
private static void registerCalculatedFuel(FluidType type, double base, double combustMult, FuelGrade grade) {
|
||||
|
||||
|
||||
@ -65,6 +65,12 @@ public class FluidTank implements Cloneable {
|
||||
this.setFill(0);
|
||||
}
|
||||
|
||||
public void resetTank() {
|
||||
this.type = Fluids.NONE;
|
||||
this.fluid = 0;
|
||||
this.pressure = 0;
|
||||
}
|
||||
|
||||
/** Changes type and pressure based on a fluid stack, useful for changing tank types based on recipes */
|
||||
public FluidTank conform(FluidStack stack) {
|
||||
this.setTankType(stack.type);
|
||||
|
||||
@ -0,0 +1,138 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerMachineChemicalFactory;
|
||||
import com.hbm.inventory.recipes.ChemicalPlantRecipes;
|
||||
import com.hbm.inventory.recipes.loader.GenericRecipe;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineChemicalFactory;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIMachineChemicalFactory extends GuiInfoContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_chemical_factory.png");
|
||||
private TileEntityMachineChemicalFactory chemplant;
|
||||
|
||||
public GUIMachineChemicalFactory(InventoryPlayer invPlayer, TileEntityMachineChemicalFactory tedf) {
|
||||
super(new ContainerMachineChemicalFactory(invPlayer, tedf));
|
||||
chemplant = tedf;
|
||||
|
||||
this.xSize = 248;
|
||||
this.ySize = 216;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||
super.drawScreen(mouseX, mouseY, f);
|
||||
|
||||
for(int i = 0; i < 3; i++) for(int j = 0; j < 4; j++) {
|
||||
chemplant.inputTanks[i + j * 3].renderTankInfo(this, mouseX, mouseY, guiLeft + 60 + i * 5, guiTop + 20 + j * 22, 3, 16);
|
||||
chemplant.outputTanks[i + j * 3].renderTankInfo(this, mouseX, mouseY, guiLeft + 189 + i * 5, guiTop + 20 + j * 22, 3, 16);
|
||||
}
|
||||
|
||||
chemplant.water.renderTankInfo(this, mouseX, mouseY, guiLeft + 224, guiTop + 125, 7, 52);
|
||||
chemplant.lps.renderTankInfo(this, mouseX, mouseY, guiLeft + 233, guiTop + 125, 7, 52);
|
||||
|
||||
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 224, guiTop + 18, 16, 68, chemplant.power, chemplant.maxPower);
|
||||
|
||||
for(int i = 0; i < 4; i++) if(guiLeft + 74 <= mouseX && guiLeft + 74 + 18 > mouseX && guiTop + 19 + i * 22 < mouseY && guiTop + 19 + i * 22 + 18 >= mouseY) {
|
||||
if(this.chemplant.chemplantModule[i].recipe != null && ChemicalPlantRecipes.INSTANCE.recipeNameMap.containsKey(this.chemplant.chemplantModule[i].recipe)) {
|
||||
GenericRecipe recipe = (GenericRecipe) ChemicalPlantRecipes.INSTANCE.recipeNameMap.get(this.chemplant.chemplantModule[i].recipe);
|
||||
this.func_146283_a(recipe.print(), mouseX, mouseY);
|
||||
} else {
|
||||
this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + "Click to set recipe", mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int x, int y, int button) {
|
||||
super.mouseClicked(x, y, button);
|
||||
|
||||
for(int i = 0; i < 4; i++) if(this.checkClick(x, y, 74, 19 + i * 22, 18, 18)) GUIScreenRecipeSelector.openSelector(ChemicalPlantRecipes.INSTANCE, chemplant, chemplant.chemplantModule[i].recipe, i, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = this.chemplant.hasCustomInventoryName() ? this.chemplant.getInventoryName() : I18n.format(this.chemplant.getInventoryName());
|
||||
|
||||
this.fontRendererObj.drawString(name, 106 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 26, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, 248, 116);
|
||||
drawTexturedModalRect(guiLeft + 18, guiTop + 116, 18, 116, 230, 100);
|
||||
|
||||
int p = (int) (chemplant.power * 68 / chemplant.maxPower);
|
||||
drawTexturedModalRect(guiLeft + 224, guiTop + 86 - p, 0, 184 - p, 16, p);
|
||||
|
||||
for(int i = 0; i < 4; i++) if(chemplant.chemplantModule[i].progress > 0) {
|
||||
int j = (int) Math.ceil(22 * chemplant.chemplantModule[i].progress);
|
||||
drawTexturedModalRect(guiLeft + 113, guiTop + 29 + i * 22, 0, 216, j, 6);
|
||||
}
|
||||
|
||||
for(int g = 0; g < 4; g++) {
|
||||
GenericRecipe recipe = ChemicalPlantRecipes.INSTANCE.recipeNameMap.get(chemplant.chemplantModule[g].recipe);
|
||||
|
||||
/// LEFT LED
|
||||
if(chemplant.didProcess[g]) {
|
||||
drawTexturedModalRect(guiLeft + 113, guiTop + 21 + g * 22, 4, 222, 4, 4);
|
||||
} else if(recipe != null) {
|
||||
drawTexturedModalRect(guiLeft + 113, guiTop + 21 + g * 22, 0, 222, 4, 4);
|
||||
}
|
||||
|
||||
/// RIGHT LED
|
||||
if(chemplant.didProcess[g]) {
|
||||
drawTexturedModalRect(guiLeft + 121, guiTop + 21 + g * 22, 4, 222, 4, 4);
|
||||
} else if(recipe != null && chemplant.power >= recipe.power && chemplant.canCool()) {
|
||||
drawTexturedModalRect(guiLeft + 121, guiTop + 21 + g * 22, 0, 222, 4, 4);
|
||||
}
|
||||
}
|
||||
|
||||
for(int g = 0; g < 4; g++) { // not a great way of doing it but at least we eliminate state leak bullshit
|
||||
GenericRecipe recipe = ChemicalPlantRecipes.INSTANCE.recipeNameMap.get(chemplant.chemplantModule[g].recipe);
|
||||
|
||||
this.renderItem(recipe != null ? recipe.getIcon() : TEMPLATE_FOLDER, 75, 20 + g * 22);
|
||||
|
||||
if(recipe != null && recipe.inputItem != null) {
|
||||
for(int i = 0; i < recipe.inputItem.length; i++) {
|
||||
Slot slot = (Slot) this.inventorySlots.inventorySlots.get(chemplant.chemplantModule[g].inputSlots[i]);
|
||||
if(!slot.getHasStack()) this.renderItem(recipe.inputItem[i].extractForCyclingDisplay(20), slot.xDisplayPosition, slot.yDisplayPosition, 10F);
|
||||
}
|
||||
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
GL11.glColor4f(1F, 1F, 1F, 0.5F);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
this.zLevel = 300F;
|
||||
for(int i = 0; i < recipe.inputItem.length; i++) {
|
||||
Slot slot = (Slot) this.inventorySlots.inventorySlots.get(chemplant.chemplantModule[g].inputSlots[i]);
|
||||
if(!slot.getHasStack()) drawTexturedModalRect(guiLeft + slot.xDisplayPosition, guiTop + slot.yDisplayPosition, slot.xDisplayPosition, slot.yDisplayPosition, 16, 16);
|
||||
}
|
||||
this.zLevel = 0F;
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 3; i++) for(int j = 0; j < 4; j++) {
|
||||
chemplant.inputTanks[i + j * 3].renderTank(guiLeft + 60 + i * 5, guiTop + 36 + j * 22, this.zLevel, 3, 16);
|
||||
chemplant.outputTanks[i + j * 3].renderTank(guiLeft + 189 + i * 5, guiTop + 36 + j * 22, this.zLevel, 3, 16);
|
||||
}
|
||||
|
||||
chemplant.water.renderTank(guiLeft + 224, guiTop + 177, this.zLevel, 7, 52);
|
||||
chemplant.lps.renderTank(guiLeft + 233, guiTop + 177, this.zLevel, 7, 52);
|
||||
}
|
||||
}
|
||||
@ -80,6 +80,21 @@ public class GUIMachineChemicalPlant extends GuiInfoContainer {
|
||||
}
|
||||
|
||||
GenericRecipe recipe = ChemicalPlantRecipes.INSTANCE.recipeNameMap.get(chemplant.chemplantModule.recipe);
|
||||
|
||||
/// LEFT LED
|
||||
if(chemplant.didProcess) {
|
||||
drawTexturedModalRect(guiLeft + 51, guiTop + 121, 195, 0, 3, 6);
|
||||
} else if(recipe != null) {
|
||||
drawTexturedModalRect(guiLeft + 51, guiTop + 121, 192, 0, 3, 6);
|
||||
}
|
||||
|
||||
/// RIGHT LED
|
||||
if(chemplant.didProcess) {
|
||||
drawTexturedModalRect(guiLeft + 56, guiTop + 121, 195, 0, 3, 6);
|
||||
} else if(recipe != null && chemplant.power >= recipe.power) {
|
||||
drawTexturedModalRect(guiLeft + 56, guiTop + 121, 192, 0, 3, 6);
|
||||
}
|
||||
|
||||
this.renderItem(recipe != null ? recipe.getIcon() : TEMPLATE_FOLDER, 8, 126);
|
||||
|
||||
if(recipe != null && recipe.inputItem != null) {
|
||||
|
||||
@ -276,11 +276,6 @@ public class GUIScreenRecipeSelector extends GuiScreen {
|
||||
else
|
||||
this.selection = NULL_SELECTION;
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setInteger("index", this.index);
|
||||
data.setString("selection", this.selection);
|
||||
TileEntity te = (TileEntity) tile;
|
||||
PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, te.xCoord, te.yCoord, te.zCoord));
|
||||
click();
|
||||
return;
|
||||
}
|
||||
@ -289,11 +284,6 @@ public class GUIScreenRecipeSelector extends GuiScreen {
|
||||
if(guiLeft + 151 <= x && guiLeft + 151 + 18 > x && guiTop + 71 < y && guiTop + 71 + 18 >= y) {
|
||||
if(!NULL_SELECTION.equals(this.selection)) {
|
||||
this.selection = this.NULL_SELECTION;
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setInteger("index", this.index);
|
||||
data.setString("selection", this.selection);
|
||||
TileEntity te = (TileEntity) tile;
|
||||
PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, te.xCoord, te.yCoord, te.zCoord));
|
||||
click();
|
||||
return;
|
||||
}
|
||||
@ -304,6 +294,17 @@ public class GUIScreenRecipeSelector extends GuiScreen {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGuiClosed() {
|
||||
Keyboard.enableRepeatEvents(false);
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setInteger("index", this.index);
|
||||
data.setString("selection", this.selection);
|
||||
TileEntity te = (TileEntity) tile;
|
||||
PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, te.xCoord, te.yCoord, te.zCoord));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char typedChar, int keyCode) {
|
||||
|
||||
@ -321,8 +322,6 @@ public class GUIScreenRecipeSelector extends GuiScreen {
|
||||
FMLCommonHandler.instance().showGuiScreen(previousScreen);
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void onGuiClosed() { Keyboard.enableRepeatEvents(false); }
|
||||
@Override public boolean doesGuiPauseGame() { return false; }
|
||||
|
||||
public void click() { mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); }
|
||||
|
||||
@ -52,7 +52,8 @@ public class GUIScreenToolAbility extends GuiScreen {
|
||||
abilitiesArea.add(new AbilityInfo(IToolAreaAbility.NONE, 0, 91));
|
||||
abilitiesArea.add(new AbilityInfo(IToolAreaAbility.RECURSION, 32, 91));
|
||||
abilitiesArea.add(new AbilityInfo(IToolAreaAbility.HAMMER, 64, 91));
|
||||
abilitiesArea.add(new AbilityInfo(IToolAreaAbility.EXPLOSION, 96, 91));
|
||||
abilitiesArea.add(new AbilityInfo(IToolAreaAbility.HAMMER_FLAT, 96, 91));
|
||||
abilitiesArea.add(new AbilityInfo(IToolAreaAbility.EXPLOSION, 128, 91));
|
||||
|
||||
abilitiesHarvest.add(new AbilityInfo(IToolHarvestAbility.NONE, 0, 107));
|
||||
abilitiesHarvest.add(new AbilityInfo(IToolHarvestAbility.SILK, 32, 107));
|
||||
|
||||
@ -139,7 +139,6 @@ public class AssemblerRecipes extends SerializableRecipe {
|
||||
makeRecipe(new ComparableStack(ModBlocks.machine_coker, 1), new AStack[] {!exp ? new OreDictStack(STEEL.plateWelded(), 3) : new OreDictStack(STEEL.heavyComp(), 2), new OreDictStack(IRON.ingot(), 16), new OreDictStack(CU.plate528(), 8), new OreDictStack(RUBBER.ingot(), 4), new ComparableStack(ModItems.tank_steel, 2), new ComparableStack(ModBlocks.steel_grate, 4) },200);
|
||||
makeRecipe(new ComparableStack(ModBlocks.machine_refinery, 1), new AStack[] {!exp ? new OreDictStack(STEEL.plateWelded(), 3) : new OreDictStack(STEEL.heavyComp(), 1), new OreDictStack(CU.plate528(), 16), new OreDictStack(STEEL.shell(), 6), new OreDictStack(STEEL.pipe(), 12), new ComparableStack(ModItems.plate_polymer, 8), new ComparableStack(ModItems.circuit, 3, EnumCircuitType.ANALOG) },350);
|
||||
makeRecipe(new ComparableStack(ModBlocks.machine_epress, 1), new AStack[] {new OreDictStack(STEEL.plate(), 8), new OreDictStack(ANY_RUBBER.ingot(), 4), new ComparableStack(ModItems.part_generic, 2, EnumPartType.PISTON_HYDRAULIC.ordinal()), new ComparableStack(ModItems.circuit, 1, EnumCircuitType.BASIC) }, 100);
|
||||
makeRecipe(new ComparableStack(ModBlocks.machine_chemplant, 1), new AStack[] {new OreDictStack(STEEL.ingot(), 12), new OreDictStack(CU.plate528(), 6), new ComparableStack(ModItems.tank_steel, 4), new ComparableStack(ModItems.coil_tungsten, 3), new ComparableStack(ModItems.circuit, 1, EnumCircuitType.ANALOG), new ComparableStack(ModItems.plate_polymer, 8), },200);
|
||||
makeRecipe(new ComparableStack(ModBlocks.machine_chemical_plant, 1), new AStack[] {new OreDictStack(STEEL.ingot(), 8), new OreDictStack(CU.pipe(), 2), new ComparableStack(ModItems.plate_polymer, 16), new ComparableStack(ModItems.motor, 2), new ComparableStack(ModItems.coil_tungsten, 2), new ComparableStack(ModItems.circuit, 1, EnumCircuitType.ANALOG) }, 200);
|
||||
makeRecipe(new ComparableStack(ModBlocks.machine_crystallizer, 1), new AStack[] {new OreDictStack(STEEL.plateWelded(), 2), new OreDictStack(TI.shell(), 3), new OreDictStack(DESH.ingot(), 4), new ComparableStack(ModItems.motor, 1), new ComparableStack(ModItems.circuit, 2, EnumCircuitType.BASIC), },200);
|
||||
makeRecipe(new ComparableStack(ModBlocks.machine_fluidtank, 1), new AStack[] {new OreDictStack(STEEL.ingot(), 2), new OreDictStack(STEEL.plate528(), 6), new OreDictStack(STEEL.shell(), 4), new OreDictStack(ANY_TAR.any(), 4), },150);
|
||||
@ -865,6 +864,17 @@ public class AssemblerRecipes extends SerializableRecipe {
|
||||
new ComparableStack(ModItems.circuit, 16, EnumCircuitType.BASIC)
|
||||
}, 400);
|
||||
|
||||
makeRecipe(new ComparableStack(ModBlocks.machine_chemical_factory, 1), new AStack[] {
|
||||
new OreDictStack(DURA.ingot(), 16),
|
||||
new OreDictStack(ANY_RESISTANTALLOY.ingot(), 8),
|
||||
new OreDictStack(RUBBER.ingot(), 16),
|
||||
new OreDictStack(STEEL.shell(), 12),
|
||||
new OreDictStack(CU.pipe(), 8),
|
||||
new ComparableStack(ModItems.motor_desh, 4),
|
||||
new ComparableStack(ModItems.coil_tungsten, 16),
|
||||
new ComparableStack(ModItems.circuit, 16, EnumCircuitType.BASIC)
|
||||
}, 400);
|
||||
|
||||
makeRecipe(new ComparableStack(ModItems.missile_shuttle, 1), new AStack[] {
|
||||
new ComparableStack(ModItems.missile_generic, 2),
|
||||
new ComparableStack(ModItems.missile_strong, 1),
|
||||
|
||||
@ -79,7 +79,7 @@ public class MixerRecipes extends SerializableRecipe {
|
||||
|
||||
register(Fluids.SYNGAS, new MixerRecipe(1_000, 50).setStack1(new FluidStack(Fluids.COALOIL, 500)).setStack2(new FluidStack(Fluids.STEAM, 500)));
|
||||
register(Fluids.OXYHYDROGEN,
|
||||
new MixerRecipe(1_000, 50).setStack1(new FluidStack(Fluids.HYDROGEN, 500)),
|
||||
new MixerRecipe(1_000, 50).setStack1(new FluidStack(Fluids.HYDROGEN, 500)).setStack2(new FluidStack(Fluids.AIR, 2_000)),
|
||||
new MixerRecipe(1_000, 50).setStack1(new FluidStack(Fluids.HYDROGEN, 500)).setStack2(new FluidStack(Fluids.OXYGEN, 500)));
|
||||
|
||||
register(Fluids.PETROIL_LEADED, new MixerRecipe(12_000, 40).setStack1(new FluidStack(Fluids.PETROIL, 10_000)).setSolid(new ComparableStack(ModItems.fuel_additive, 1, 0)));
|
||||
|
||||
@ -360,9 +360,9 @@ public class ShredderRecipes extends SerializableRecipe {
|
||||
|
||||
/* AR COMPAT */
|
||||
Block arMoonTurf = Compat.tryLoadBlock(Compat.MOD_AR, "turf");
|
||||
if(arMoonTurf != null && gcMoonBlock != Blocks.air) ShredderRecipes.setRecipe(arMoonTurf, new ItemStack(ModBlocks.moon_turf)); //i assume it's moon turf
|
||||
if(arMoonTurf != null && arMoonTurf != Blocks.air) ShredderRecipes.setRecipe(arMoonTurf, new ItemStack(ModBlocks.moon_turf)); //i assume it's moon turf
|
||||
Block arMoonTurfDark = Compat.tryLoadBlock(Compat.MOD_AR, "turfDark");
|
||||
if(arMoonTurfDark != null && gcMoonBlock != Blocks.air) ShredderRecipes.setRecipe(arMoonTurfDark, new ItemStack(ModBlocks.moon_turf)); //probably moon dirt? would have helped if i had ever played AR for more than 5 seconds
|
||||
if(arMoonTurfDark != null && arMoonTurfDark != Blocks.air) ShredderRecipes.setRecipe(arMoonTurfDark, new ItemStack(ModBlocks.moon_turf)); //probably moon dirt? would have helped if i had ever played AR for more than 5 seconds
|
||||
}
|
||||
|
||||
/**
|
||||
@ -374,8 +374,9 @@ public class ShredderRecipes extends SerializableRecipe {
|
||||
|
||||
List<ItemStack> matches = OreDictionary.getOres("dust" + name);
|
||||
|
||||
if(matches != null && !matches.isEmpty())
|
||||
return matches.get(0).copy();
|
||||
if(matches != null && !matches.isEmpty()) {
|
||||
return Compat.getPreferredOreOutput(matches);
|
||||
}
|
||||
|
||||
return new ItemStack(ModItems.scrap);
|
||||
}
|
||||
|
||||
@ -34,10 +34,10 @@ import net.minecraft.item.ItemStack;
|
||||
public abstract class SerializableRecipe {
|
||||
|
||||
public static final Gson gson = new Gson();
|
||||
public static List<SerializableRecipe> recipeHandlers = new ArrayList<>();
|
||||
public static List<IRecipeRegisterListener> additionalListeners = new ArrayList<>();
|
||||
public static List<SerializableRecipe> recipeHandlers = new ArrayList();
|
||||
public static List<IRecipeRegisterListener> additionalListeners = new ArrayList();
|
||||
|
||||
public static Map<String, InputStream> recipeSyncHandlers = new HashMap<>();
|
||||
public static Map<String, InputStream> recipeSyncHandlers = new HashMap();
|
||||
|
||||
public boolean modified = false;
|
||||
|
||||
|
||||
@ -4466,6 +4466,7 @@ public class ModItems {
|
||||
schrabidium_pickaxe = new ItemToolAbility(20, 0, MainRegistry.tMatSchrab, EnumToolType.PICKAXE)
|
||||
.addAbility(IWeaponAbility.RADIATION, 0)
|
||||
.addAbility(IToolAreaAbility.HAMMER, 1)
|
||||
.addAbility(IToolAreaAbility.HAMMER_FLAT, 1)
|
||||
.addAbility(IToolAreaAbility.RECURSION, 6)
|
||||
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||
.addAbility(IToolHarvestAbility.LUCK, 4)
|
||||
@ -4476,6 +4477,7 @@ public class ModItems {
|
||||
schrabidium_axe = new ItemToolAbility(25, 0, MainRegistry.tMatSchrab, EnumToolType.AXE)
|
||||
.addAbility(IWeaponAbility.RADIATION, 0)
|
||||
.addAbility(IToolAreaAbility.HAMMER, 1)
|
||||
.addAbility(IToolAreaAbility.HAMMER_FLAT, 1)
|
||||
.addAbility(IToolAreaAbility.RECURSION, 6)
|
||||
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||
.addAbility(IToolHarvestAbility.LUCK, 4)
|
||||
@ -4487,6 +4489,7 @@ public class ModItems {
|
||||
schrabidium_shovel = new ItemToolAbility(15, 0, MainRegistry.tMatSchrab, EnumToolType.SHOVEL)
|
||||
.addAbility(IWeaponAbility.RADIATION, 0)
|
||||
.addAbility(IToolAreaAbility.HAMMER, 1)
|
||||
.addAbility(IToolAreaAbility.HAMMER_FLAT, 1)
|
||||
.addAbility(IToolAreaAbility.RECURSION, 6)
|
||||
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||
.addAbility(IToolHarvestAbility.LUCK, 4)
|
||||
@ -4554,12 +4557,14 @@ public class ModItems {
|
||||
|
||||
elec_pickaxe = new ItemToolAbilityPower(6F, 0, MainRegistry.tMatElec, EnumToolType.PICKAXE, 500000, 1000, 100)
|
||||
.addAbility(IToolAreaAbility.HAMMER, 1)
|
||||
.addAbility(IToolAreaAbility.HAMMER_FLAT, 1)
|
||||
.addAbility(IToolAreaAbility.RECURSION, 2)
|
||||
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||
.addAbility(IToolHarvestAbility.LUCK, 1).setUnlocalizedName("elec_pickaxe").setTextureName(RefStrings.MODID + ":elec_drill_anim");
|
||||
|
||||
elec_axe = new ItemToolAbilityPower(10F, 0, MainRegistry.tMatElec, EnumToolType.AXE, 500000, 1000, 100)
|
||||
.addAbility(IToolAreaAbility.HAMMER, 1)
|
||||
.addAbility(IToolAreaAbility.HAMMER_FLAT, 1)
|
||||
.addAbility(IToolAreaAbility.RECURSION, 2)
|
||||
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||
.addAbility(IToolHarvestAbility.LUCK, 1)
|
||||
@ -4568,6 +4573,7 @@ public class ModItems {
|
||||
|
||||
elec_shovel = new ItemToolAbilityPower(5F, 0, MainRegistry.tMatElec, EnumToolType.SHOVEL, 500000, 1000, 100)
|
||||
.addAbility(IToolAreaAbility.HAMMER, 1)
|
||||
.addAbility(IToolAreaAbility.HAMMER_FLAT, 1)
|
||||
.addAbility(IToolAreaAbility.RECURSION, 2)
|
||||
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||
.addAbility(IToolHarvestAbility.LUCK, 1).setUnlocalizedName("elec_shovel").setTextureName(RefStrings.MODID + ":elec_shovel_anim");
|
||||
@ -4577,12 +4583,14 @@ public class ModItems {
|
||||
|
||||
desh_pickaxe = new ItemToolAbility(5F, -0.05, MainRegistry.tMatDesh, EnumToolType.PICKAXE)
|
||||
.addAbility(IToolAreaAbility.HAMMER, 0)
|
||||
.addAbility(IToolAreaAbility.HAMMER_FLAT, 0)
|
||||
.addAbility(IToolAreaAbility.RECURSION, 0)
|
||||
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||
.addAbility(IToolHarvestAbility.LUCK, 1).setUnlocalizedName("desh_pickaxe").setTextureName(RefStrings.MODID + ":desh_pickaxe");
|
||||
|
||||
desh_axe = new ItemToolAbility(7.5F, -0.05, MainRegistry.tMatDesh, EnumToolType.AXE)
|
||||
.addAbility(IToolAreaAbility.HAMMER, 0)
|
||||
.addAbility(IToolAreaAbility.HAMMER_FLAT, 0)
|
||||
.addAbility(IToolAreaAbility.RECURSION, 0)
|
||||
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||
.addAbility(IToolHarvestAbility.LUCK, 1)
|
||||
@ -4590,6 +4598,7 @@ public class ModItems {
|
||||
|
||||
desh_shovel = new ItemToolAbility(4F, -0.05, MainRegistry.tMatDesh, EnumToolType.SHOVEL)
|
||||
.addAbility(IToolAreaAbility.HAMMER, 0)
|
||||
.addAbility(IToolAreaAbility.HAMMER_FLAT, 0)
|
||||
.addAbility(IToolAreaAbility.RECURSION, 0)
|
||||
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||
.addAbility(IToolHarvestAbility.LUCK, 1).setUnlocalizedName("desh_shovel").setTextureName(RefStrings.MODID + ":desh_shovel");
|
||||
@ -4618,17 +4627,20 @@ public class ModItems {
|
||||
cobalt_decorated_pickaxe = new ItemToolAbility(6F, 0, matDecCobalt, EnumToolType.PICKAXE)
|
||||
.addAbility(IToolAreaAbility.RECURSION, 1)
|
||||
.addAbility(IToolAreaAbility.HAMMER, 0)
|
||||
.addAbility(IToolAreaAbility.HAMMER_FLAT, 0)
|
||||
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||
.addAbility(IToolHarvestAbility.LUCK, 2).setUnlocalizedName("cobalt_decorated_pickaxe").setTextureName(RefStrings.MODID + ":cobalt_decorated_pickaxe");
|
||||
cobalt_decorated_axe = new ItemToolAbility(8F, 0, matDecCobalt, EnumToolType.AXE)
|
||||
.addAbility(IToolAreaAbility.RECURSION, 1)
|
||||
.addAbility(IToolAreaAbility.HAMMER, 0)
|
||||
.addAbility(IToolAreaAbility.HAMMER_FLAT, 0)
|
||||
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||
.addAbility(IToolHarvestAbility.LUCK, 2)
|
||||
.addAbility(IWeaponAbility.BEHEADER, 0).setUnlocalizedName("cobalt_decorated_axe").setTextureName(RefStrings.MODID + ":cobalt_decorated_axe");
|
||||
cobalt_decorated_shovel = new ItemToolAbility(5F, 0, matDecCobalt, EnumToolType.SHOVEL)
|
||||
.addAbility(IToolAreaAbility.RECURSION, 1)
|
||||
.addAbility(IToolAreaAbility.HAMMER, 0)
|
||||
.addAbility(IToolAreaAbility.HAMMER_FLAT, 0)
|
||||
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||
.addAbility(IToolHarvestAbility.LUCK, 2).setUnlocalizedName("cobalt_decorated_shovel").setTextureName(RefStrings.MODID + ":cobalt_decorated_shovel");
|
||||
cobalt_decorated_hoe = new ModHoe(matDecCobalt).setUnlocalizedName("cobalt_decorated_hoe").setTextureName(RefStrings.MODID + ":cobalt_decorated_hoe");
|
||||
@ -4641,12 +4653,14 @@ public class ModItems {
|
||||
starmetal_pickaxe = new ItemToolAbility(8F, 0, matStarmetal, EnumToolType.PICKAXE)
|
||||
.addAbility(IToolAreaAbility.RECURSION, 3)
|
||||
.addAbility(IToolAreaAbility.HAMMER, 1)
|
||||
.addAbility(IToolAreaAbility.HAMMER_FLAT, 1)
|
||||
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||
.addAbility(IToolHarvestAbility.LUCK, 4)
|
||||
.addAbility(IWeaponAbility.STUN, 1).setUnlocalizedName("starmetal_pickaxe").setTextureName(RefStrings.MODID + ":starmetal_pickaxe");
|
||||
starmetal_axe = new ItemToolAbility(12F, 0, matStarmetal, EnumToolType.AXE)
|
||||
.addAbility(IToolAreaAbility.RECURSION, 3)
|
||||
.addAbility(IToolAreaAbility.HAMMER, 1)
|
||||
.addAbility(IToolAreaAbility.HAMMER_FLAT, 1)
|
||||
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||
.addAbility(IToolHarvestAbility.LUCK, 4)
|
||||
.addAbility(IWeaponAbility.BEHEADER, 0)
|
||||
@ -4654,6 +4668,7 @@ public class ModItems {
|
||||
starmetal_shovel = new ItemToolAbility(7F, 0, matStarmetal, EnumToolType.SHOVEL)
|
||||
.addAbility(IToolAreaAbility.RECURSION, 3)
|
||||
.addAbility(IToolAreaAbility.HAMMER, 1)
|
||||
.addAbility(IToolAreaAbility.HAMMER_FLAT, 1)
|
||||
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||
.addAbility(IToolHarvestAbility.LUCK, 4)
|
||||
.addAbility(IWeaponAbility.STUN, 1).setUnlocalizedName("starmetal_shovel").setTextureName(RefStrings.MODID + ":starmetal_shovel");
|
||||
@ -4668,6 +4683,7 @@ public class ModItems {
|
||||
.addAbility(IToolHarvestAbility.SHREDDER, 0)
|
||||
.addAbility(IToolHarvestAbility.LUCK, 1)
|
||||
.addAbility(IToolAreaAbility.HAMMER, 1)
|
||||
.addAbility(IToolAreaAbility.HAMMER_FLAT, 1)
|
||||
.addAbility(IToolAreaAbility.RECURSION, 2).setUnlocalizedName("drax").setTextureName(RefStrings.MODID + ":drax");
|
||||
drax_mk2 = new ItemToolAbilityPower(15F, -0.05, MainRegistry.tMatElec, EnumToolType.MINER, 1000000000, 250000, 7500)
|
||||
.addAbility(IToolHarvestAbility.SMELTER, 0)
|
||||
@ -4675,6 +4691,7 @@ public class ModItems {
|
||||
.addAbility(IToolHarvestAbility.CENTRIFUGE, 0)
|
||||
.addAbility(IToolHarvestAbility.LUCK, 2)
|
||||
.addAbility(IToolAreaAbility.HAMMER, 2)
|
||||
.addAbility(IToolAreaAbility.HAMMER_FLAT, 2)
|
||||
.addAbility(IToolAreaAbility.RECURSION, 4).setUnlocalizedName("drax_mk2").setTextureName(RefStrings.MODID + ":drax_mk2");
|
||||
drax_mk3 = new ItemToolAbilityPower(20F, -0.05, MainRegistry.tMatElec, EnumToolType.MINER, 2500000000L, 500000, 10000)
|
||||
.addAbility(IToolHarvestAbility.SMELTER, 0)
|
||||
@ -4684,11 +4701,13 @@ public class ModItems {
|
||||
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||
.addAbility(IToolHarvestAbility.LUCK, 3)
|
||||
.addAbility(IToolAreaAbility.HAMMER, 3)
|
||||
.addAbility(IToolAreaAbility.HAMMER_FLAT, 3)
|
||||
.addAbility(IToolAreaAbility.RECURSION, 5).setUnlocalizedName("drax_mk3").setTextureName(RefStrings.MODID + ":drax_mk3");
|
||||
|
||||
ToolMaterial matBismuth = EnumHelper.addToolMaterial("HBM_BISMUTH", 4, 0, 50F, 0.0F, 200).setRepairItem(new ItemStack(ModItems.ingot_bismuth));
|
||||
bismuth_pickaxe = new ItemToolAbility(15F, 0, matBismuth, EnumToolType.MINER)
|
||||
.addAbility(IToolAreaAbility.HAMMER, 1)
|
||||
.addAbility(IToolAreaAbility.HAMMER_FLAT, 1)
|
||||
.addAbility(IToolAreaAbility.RECURSION, 1)
|
||||
.addAbility(IToolHarvestAbility.SHREDDER, 0)
|
||||
.addAbility(IToolHarvestAbility.LUCK, 1)
|
||||
@ -4699,6 +4718,7 @@ public class ModItems {
|
||||
.setDepthRockBreaker().setUnlocalizedName("bismuth_pickaxe").setTextureName(RefStrings.MODID + ":bismuth_pickaxe");
|
||||
bismuth_axe = new ItemToolAbility(25F, 0, matBismuth, EnumToolType.AXE)
|
||||
.addAbility(IToolAreaAbility.HAMMER, 1)
|
||||
.addAbility(IToolAreaAbility.HAMMER_FLAT, 1)
|
||||
.addAbility(IToolAreaAbility.RECURSION, 1)
|
||||
.addAbility(IToolHarvestAbility.SHREDDER, 0)
|
||||
.addAbility(IToolHarvestAbility.LUCK, 1)
|
||||
@ -4711,6 +4731,7 @@ public class ModItems {
|
||||
ToolMaterial matVolcano = EnumHelper.addToolMaterial("HBM_VOLCANIC", 4, 0, 50F, 0.0F, 200).setRepairItem(new ItemStack(ModItems.ingot_bismuth));
|
||||
volcanic_pickaxe = new ItemToolAbility(15F, 0, matVolcano, EnumToolType.MINER)
|
||||
.addAbility(IToolAreaAbility.HAMMER, 1)
|
||||
.addAbility(IToolAreaAbility.HAMMER_FLAT, 1)
|
||||
.addAbility(IToolAreaAbility.RECURSION, 1)
|
||||
.addAbility(IToolHarvestAbility.SMELTER, 0)
|
||||
.addAbility(IToolHarvestAbility.LUCK, 2)
|
||||
@ -4721,6 +4742,7 @@ public class ModItems {
|
||||
.setDepthRockBreaker().setUnlocalizedName("volcanic_pickaxe").setTextureName(RefStrings.MODID + ":volcanic_pickaxe");
|
||||
volcanic_axe = new ItemToolAbility(25F, 0, matVolcano, EnumToolType.AXE)
|
||||
.addAbility(IToolAreaAbility.HAMMER, 1)
|
||||
.addAbility(IToolAreaAbility.HAMMER_FLAT, 1)
|
||||
.addAbility(IToolAreaAbility.RECURSION, 1)
|
||||
.addAbility(IToolHarvestAbility.SMELTER, 0)
|
||||
.addAbility(IToolHarvestAbility.LUCK, 2)
|
||||
@ -4732,6 +4754,7 @@ public class ModItems {
|
||||
ToolMaterial matChlorophyte = EnumHelper.addToolMaterial("HBM_CHLOROPHYTE", 4, 0, 75F, 0.0F, 200).setRepairItem(new ItemStack(ModItems.powder_chlorophyte));
|
||||
chlorophyte_pickaxe = new ItemToolAbility(20F, 0, matChlorophyte, EnumToolType.MINER)
|
||||
.addAbility(IToolAreaAbility.HAMMER, 1)
|
||||
.addAbility(IToolAreaAbility.HAMMER_FLAT, 1)
|
||||
.addAbility(IToolAreaAbility.RECURSION, 1)
|
||||
.addAbility(IToolHarvestAbility.LUCK, 3)
|
||||
.addAbility(IToolHarvestAbility.CENTRIFUGE, 0)
|
||||
@ -4742,6 +4765,7 @@ public class ModItems {
|
||||
.setDepthRockBreaker().setUnlocalizedName("chlorophyte_pickaxe").setTextureName(RefStrings.MODID + ":chlorophyte_pickaxe");
|
||||
chlorophyte_axe = new ItemToolAbility(50F, 0, matChlorophyte, EnumToolType.AXE)
|
||||
.addAbility(IToolAreaAbility.HAMMER, 1)
|
||||
.addAbility(IToolAreaAbility.HAMMER_FLAT, 1)
|
||||
.addAbility(IToolAreaAbility.RECURSION, 1)
|
||||
.addAbility(IToolHarvestAbility.LUCK, 3)
|
||||
.addAbility(IWeaponAbility.STUN, 4)
|
||||
@ -4751,6 +4775,7 @@ public class ModItems {
|
||||
ToolMaterial matMese = EnumHelper.addToolMaterial("HBM_MESE", 4, 0, 100F, 0.0F, 200).setRepairItem(new ItemStack(ModItems.plate_paa));
|
||||
mese_pickaxe = new ItemToolAbility(35F, 0, matMese, EnumToolType.MINER)
|
||||
.addAbility(IToolAreaAbility.HAMMER, 2)
|
||||
.addAbility(IToolAreaAbility.HAMMER_FLAT, 2)
|
||||
.addAbility(IToolAreaAbility.RECURSION, 2)
|
||||
.addAbility(IToolHarvestAbility.CRYSTALLIZER, 0)
|
||||
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||
@ -4762,6 +4787,7 @@ public class ModItems {
|
||||
.setDepthRockBreaker().setUnlocalizedName("mese_pickaxe").setTextureName(RefStrings.MODID + ":mese_pickaxe");
|
||||
mese_axe = new ItemToolAbility(75F, 0, matMese, EnumToolType.AXE)
|
||||
.addAbility(IToolAreaAbility.HAMMER, 2)
|
||||
.addAbility(IToolAreaAbility.HAMMER_FLAT, 2)
|
||||
.addAbility(IToolAreaAbility.RECURSION, 2)
|
||||
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||
.addAbility(IToolHarvestAbility.LUCK, 5)
|
||||
@ -4774,7 +4800,8 @@ public class ModItems {
|
||||
|
||||
ToolMaterial matDwarf = EnumHelper.addToolMaterial("HBM_DWARVEN", 2, 0, 4F, 0.0F, 10).setRepairItem(new ItemStack(ModItems.ingot_copper));
|
||||
dwarven_pickaxe = new ItemToolAbility(5F, -0.1, matDwarf, EnumToolType.MINER)
|
||||
.addAbility(IToolAreaAbility.HAMMER, 0).setUnlocalizedName("dwarven_pickaxe").setMaxDamage(250).setTextureName(RefStrings.MODID + ":dwarven_pickaxe");
|
||||
.addAbility(IToolAreaAbility.HAMMER, 0)
|
||||
.addAbility(IToolAreaAbility.HAMMER_FLAT, 0).setUnlocalizedName("dwarven_pickaxe").setMaxDamage(250).setTextureName(RefStrings.MODID + ":dwarven_pickaxe");
|
||||
|
||||
ToolMaterial matMeteorite = EnumHelper.addToolMaterial("HBM_METEORITE", 4, 0, 50F, 0.0F, 200).setRepairItem(new ItemStack(ModItems.plate_paa));
|
||||
meteorite_sword = new ItemSwordMeteorite(9F, 0, matMeteorite).setUnlocalizedName("meteorite_sword").setTextureName(RefStrings.MODID + ":meteorite_sword");
|
||||
|
||||
@ -134,7 +134,7 @@ public class ItemBlowtorch extends Item implements IFillableItem {
|
||||
if(b instanceof IToolable) {
|
||||
|
||||
if(this == ModItems.blowtorch) {
|
||||
if(this.getFill(stack, Fluids.GAS) < 1000) return false;
|
||||
if(this.getFill(stack, Fluids.GAS) < 250) return false;
|
||||
}
|
||||
|
||||
if(this == ModItems.acetylene_torch) {
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package com.hbm.items.tool;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
@ -27,6 +29,7 @@ import com.hbm.packet.toclient.PlayerInformPacket;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
|
||||
import api.hbm.item.IDepthRockTool;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
@ -151,21 +154,41 @@ public class ItemToolAbility extends ItemTool implements IDepthRockTool, IGUIPro
|
||||
return true;
|
||||
}
|
||||
|
||||
// Should be safe, considering the AoE ability does a similar trick already.
|
||||
// If not, wrap this in a ThreadLocal or something...
|
||||
public static int dropX, dropY, dropZ;
|
||||
|
||||
@Override
|
||||
public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player) {
|
||||
|
||||
World world = player.worldObj;
|
||||
Block block = world.getBlock(x, y, z);
|
||||
|
||||
/*
|
||||
* The original implementation of this always returned FALSE which uses the vanilla block break code.
|
||||
* This one now returns TRUE when an ability applies and instead relies on breakExtraBlock, which has the minor
|
||||
* issue of only running on the sever, while the client uses the vanilla implementation. breakExtraBlock was only
|
||||
* meant to be used for AoE or vein miner and not for the block that's being mined, hence break EXTRA block.
|
||||
* The consequence was that the server would fail to break keyholes since breakExtraBlock is supposed to exclude
|
||||
* them, while the client happily removes the block, causing a desync.
|
||||
*
|
||||
* Since keyholes aren't processable and exempt from silk touch anyway, we just default to the vanilla implementation in every case.
|
||||
*/
|
||||
if(block == ModBlocks.stone_keyhole || block == ModBlocks.stone_keyhole_meta) return false;
|
||||
|
||||
if(!world.isRemote && (canHarvestBlock(block, stack) || canShearBlock(block, stack, world, x, y, z)) && canOperate(stack)) {
|
||||
Configuration config = getConfiguration(stack);
|
||||
ToolPreset preset = config.getActivePreset();
|
||||
|
||||
dropX = x;
|
||||
dropY = y;
|
||||
dropZ = z;
|
||||
|
||||
preset.harvestAbility.preHarvestAll(preset.harvestAbilityLevel, world, player);
|
||||
|
||||
boolean skipRef = preset.areaAbility.onDig(preset.areaAbilityLevel, world, x, y, z, player, this);
|
||||
|
||||
if (!skipRef) {
|
||||
if(!skipRef) {
|
||||
breakExtraBlock(world, x, y, z, player, x, y, z);
|
||||
}
|
||||
|
||||
@ -262,7 +285,7 @@ public class ItemToolAbility extends ItemTool implements IDepthRockTool, IGUIPro
|
||||
EntityPlayerMP player = (EntityPlayerMP) playerEntity;
|
||||
ItemStack stack = player.getHeldItem();
|
||||
|
||||
if (stack == null) {
|
||||
if(stack == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -276,7 +299,7 @@ public class ItemToolAbility extends ItemTool implements IDepthRockTool, IGUIPro
|
||||
float refStrength = ForgeHooks.blockStrength(refBlock, player, world, refX, refY, refZ);
|
||||
float strength = ForgeHooks.blockStrength(block, player, world, x, y, z);
|
||||
|
||||
if(!ForgeHooks.canHarvestBlock(block, player, meta) || refStrength / strength > 10f || refBlock.getBlockHardness(world, refX, refY, refZ) < 0)
|
||||
if(!ForgeHooks.canHarvestBlock(block, player, meta) || refStrength / strength > 10f || refBlock.getPlayerRelativeBlockHardness(player, world, refX, refY, refZ) < 0)
|
||||
return;
|
||||
|
||||
BlockEvent.BreakEvent event = ForgeHooks.onBlockBreakEvent(world, player.theItemInWorldManager.getGameType(), player, x, y, z);
|
||||
@ -304,7 +327,7 @@ public class ItemToolAbility extends ItemTool implements IDepthRockTool, IGUIPro
|
||||
double d = (double) (rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
|
||||
double d1 = (double) (rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
|
||||
double d2 = (double) (rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
|
||||
EntityItem entityitem = new EntityItem(player.worldObj, (double) x + d, (double) y + d1, (double) z + d2, stack);
|
||||
EntityItem entityitem = new EntityItem(player.worldObj, (double) dropX + d, (double) dropY + d1, (double) dropZ + d2, stack);
|
||||
entityitem.delayBeforeCanPickup = 10;
|
||||
player.worldObj.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
@ -314,6 +337,9 @@ public class ItemToolAbility extends ItemTool implements IDepthRockTool, IGUIPro
|
||||
}
|
||||
}
|
||||
|
||||
// Since it's added by forge, access transformers don't affect it (even wildcards), so we do it the old-fashioned way
|
||||
private static Method blockCaptureDrops = ReflectionHelper.findMethod(Block.class, null, new String[] { "captureDrops" }, new Class[] { boolean.class });
|
||||
|
||||
public static void standardDigPost(World world, int x, int y, int z, EntityPlayerMP player) {
|
||||
|
||||
Block block = world.getBlock(x, y, z);
|
||||
@ -339,7 +365,20 @@ public class ItemToolAbility extends ItemTool implements IDepthRockTool, IGUIPro
|
||||
}
|
||||
|
||||
if(removedByPlayer && canHarvest) {
|
||||
block.harvestBlock(world, player, x, y, z, l);
|
||||
try {
|
||||
blockCaptureDrops.invoke(block, true);
|
||||
block.harvestBlock(world, player, x, y, z, l);
|
||||
List<ItemStack> drops = (List)blockCaptureDrops.invoke(block, false);
|
||||
for (ItemStack stack : drops) {
|
||||
block.dropBlockAsItem(world, dropX, dropY, dropZ, stack);
|
||||
}
|
||||
} catch (IllegalAccessException e) {
|
||||
// Shouldn't be possible with ReflectionHelper
|
||||
MainRegistry.logger.error("Failed to capture drops for block " + block, e);
|
||||
} catch (InvocationTargetException e) {
|
||||
// Might be possible? Not in practice, though
|
||||
MainRegistry.logger.error("Failed to capture drops for block " + block, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -4,11 +4,13 @@ import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.hbm.entity.effect.EntityNukeTorex;
|
||||
import com.hbm.entity.logic.EntityNukeExplosionMK5;
|
||||
import com.hbm.entity.projectile.EntityRubble;
|
||||
import com.hbm.explosion.vanillant.ExplosionVNT;
|
||||
import com.hbm.explosion.vanillant.standard.EntityProcessorCrossSmooth;
|
||||
import com.hbm.explosion.vanillant.standard.PlayerProcessorStandard;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.particle.helper.ExplosionCreator;
|
||||
import com.hbm.potion.HbmPotion;
|
||||
import com.hbm.util.ArmorUtil;
|
||||
|
||||
@ -23,21 +25,21 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemSword;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class WeaponSpecial extends ItemSword {
|
||||
|
||||
|
||||
Random rand = new Random();
|
||||
|
||||
public WeaponSpecial(ToolMaterial p_i45356_1_) {
|
||||
super(p_i45356_1_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack p_77613_1_)
|
||||
{
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack p_77613_1_) {
|
||||
if(this == ModItems.schrabidium_hammer) {
|
||||
return EnumRarity.rare;
|
||||
}
|
||||
@ -47,26 +49,23 @@ public class WeaponSpecial extends ItemSword {
|
||||
if(this == ModItems.shimmer_sledge || this == ModItems.shimmer_axe) {
|
||||
return EnumRarity.epic;
|
||||
}
|
||||
|
||||
|
||||
return EnumRarity.common;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hitEntity(ItemStack stack, EntityLivingBase entity, EntityLivingBase entityPlayer)
|
||||
{
|
||||
World world = entity.worldObj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hitEntity(ItemStack stack, EntityLivingBase entity, EntityLivingBase entityPlayer) {
|
||||
World world = entity.worldObj;
|
||||
|
||||
if(this == ModItems.schrabidium_hammer) {
|
||||
if (!world.isRemote)
|
||||
{
|
||||
entity.setHealth(0.0F);
|
||||
}
|
||||
world.playSoundAtEntity(entity, "hbm:weapon.bonk", 3.0F, 1.0F);
|
||||
if(!world.isRemote) {
|
||||
entity.setHealth(0.0F);
|
||||
}
|
||||
world.playSoundAtEntity(entity, "hbm:weapon.bonk", 3.0F, 1.0F);
|
||||
}
|
||||
|
||||
if(this == ModItems.bottle_opener) {
|
||||
if (!world.isRemote)
|
||||
{
|
||||
if(!world.isRemote) {
|
||||
int i = rand.nextInt(7);
|
||||
if(i == 0)
|
||||
entity.addPotionEffect(new PotionEffect(Potion.blindness.id, 5 * 60 * 20, 0));
|
||||
@ -76,19 +75,18 @@ public class WeaponSpecial extends ItemSword {
|
||||
entity.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 5 * 60 * 20, 2));
|
||||
if(i == 3)
|
||||
entity.addPotionEffect(new PotionEffect(Potion.confusion.id, 1 * 60 * 20, 0));
|
||||
}
|
||||
world.playSoundAtEntity(entity, "random.anvil_land", 3.0F, 1.F);
|
||||
}
|
||||
world.playSoundAtEntity(entity, "random.anvil_land", 3.0F, 1.F);
|
||||
}
|
||||
|
||||
|
||||
if(this == ModItems.ullapool_caber) {
|
||||
if (!world.isRemote)
|
||||
{
|
||||
if(!world.isRemote) {
|
||||
world.createExplosion(null, entity.posX, entity.posY, entity.posZ, 7.5F, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
stack.damageItem(505, entityPlayer);
|
||||
}
|
||||
|
||||
|
||||
if(this == ModItems.shimmer_sledge) {
|
||||
Vec3 vec = entityPlayer.getLookVec();
|
||||
double dX = vec.xCoord * 5;
|
||||
@ -98,37 +96,37 @@ public class WeaponSpecial extends ItemSword {
|
||||
entity.motionX += dX;
|
||||
entity.motionY += dY;
|
||||
entity.motionZ += dZ;
|
||||
world.playSoundAtEntity(entity, "hbm:weapon.bang", 3.0F, 1.F);
|
||||
world.playSoundAtEntity(entity, "hbm:weapon.bang", 3.0F, 1.F);
|
||||
}
|
||||
|
||||
|
||||
if(this == ModItems.shimmer_axe) {
|
||||
entity.setHealth(entity.getHealth() / 2);
|
||||
|
||||
world.playSoundAtEntity(entity, "hbm:weapon.slice", 3.0F, 1.F);
|
||||
|
||||
world.playSoundAtEntity(entity, "hbm:weapon.slice", 3.0F, 1.F);
|
||||
}
|
||||
|
||||
|
||||
if(this == ModItems.wood_gavel) {
|
||||
world.playSoundAtEntity(entity, "hbm:weapon.whack", 3.0F, 1.F);
|
||||
world.playSoundAtEntity(entity, "hbm:weapon.whack", 3.0F, 1.F);
|
||||
}
|
||||
|
||||
|
||||
if(this == ModItems.lead_gavel) {
|
||||
world.playSoundAtEntity(entity, "hbm:weapon.whack", 3.0F, 1.F);
|
||||
|
||||
world.playSoundAtEntity(entity, "hbm:weapon.whack", 3.0F, 1.F);
|
||||
|
||||
entity.addPotionEffect(new PotionEffect(HbmPotion.lead.id, 15 * 20, 4));
|
||||
}
|
||||
|
||||
|
||||
if(this == ModItems.diamond_gavel) {
|
||||
|
||||
|
||||
float ded = entity.getMaxHealth() / 3;
|
||||
entity.setHealth(entity.getHealth() - ded);
|
||||
|
||||
world.playSoundAtEntity(entity, "hbm:weapon.whack", 3.0F, 1.F);
|
||||
|
||||
world.playSoundAtEntity(entity, "hbm:weapon.whack", 3.0F, 1.F);
|
||||
}
|
||||
|
||||
|
||||
if(this == ModItems.wrench) {
|
||||
|
||||
Vec3 vec = entityPlayer.getLookVec();
|
||||
|
||||
|
||||
double dX = vec.xCoord * 0.5;
|
||||
double dY = vec.yCoord * 0.5;
|
||||
double dZ = vec.zCoord * 0.5;
|
||||
@ -136,47 +134,47 @@ public class WeaponSpecial extends ItemSword {
|
||||
entity.motionX += dX;
|
||||
entity.motionY += dY;
|
||||
entity.motionZ += dZ;
|
||||
world.playSoundAtEntity(entity, "random.anvil_land", 3.0F, 0.75F);
|
||||
world.playSoundAtEntity(entity, "random.anvil_land", 3.0F, 0.75F);
|
||||
}
|
||||
|
||||
if(this == ModItems.memespoon) {
|
||||
|
||||
if(this == ModItems.memespoon && !world.isRemote) {
|
||||
|
||||
if(!(entityPlayer instanceof EntityPlayer))
|
||||
return false;
|
||||
|
||||
if(entityPlayer.fallDistance >= 2) {
|
||||
world.playSoundAtEntity(entity, "hbm:weapon.bang", 3.0F, 0.75F);
|
||||
entity.setHealth(0);
|
||||
entity.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) entityPlayer), 50F);
|
||||
}
|
||||
|
||||
if(!(entityPlayer instanceof EntityPlayer))
|
||||
return false;
|
||||
|
||||
if(entityPlayer.fallDistance >= 20 && !((EntityPlayer)entityPlayer).capabilities.isCreativeMode) {
|
||||
if(!world.isRemote) {
|
||||
world.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(world, 100, entity.posX, entity.posY, entity.posZ));
|
||||
EntityNukeTorex.statFacStandard(world, entity.posX, entity.posY, entity.posZ, 100);
|
||||
}
|
||||
|
||||
if(entityPlayer.fallDistance >= 20 && !((EntityPlayer) entityPlayer).capabilities.isCreativeMode) {
|
||||
ExplosionVNT vnt = new ExplosionVNT(world, entity.posX, entity.posY + entity.height / 2D, entity.posZ, 15, entityPlayer);
|
||||
vnt.setEntityProcessor(new EntityProcessorCrossSmooth(1, 150).setupPiercing(25, 0.5F));
|
||||
vnt.setPlayerProcessor(new PlayerProcessorStandard());
|
||||
ExplosionCreator.composeEffectSmall(world, entity.posX, entity.posY + entity.height / 2D, entity.posZ);
|
||||
vnt.explode();
|
||||
}
|
||||
}
|
||||
|
||||
if(this == ModItems.stopsign || this == ModItems.sopsign)
|
||||
world.playSoundAtEntity(entity, "hbm:weapon.stop", 1.0F, 1.0F);
|
||||
|
||||
world.playSoundAtEntity(entity, "hbm:weapon.stop", 1.0F, 1.0F);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int i, float f1, float f2, float f3)
|
||||
{
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int i, float f1, float f2, float f3) {
|
||||
|
||||
if(this == ModItems.shimmer_sledge) {
|
||||
if(world.getBlock(x, y, z) != Blocks.air && world.getBlock(x, y, z).getExplosionResistance(null) < 6000) {
|
||||
|
||||
|
||||
EntityRubble rubble = new EntityRubble(world);
|
||||
rubble.posX = x + 0.5F;
|
||||
rubble.posY = y;
|
||||
rubble.posZ = z + 0.5F;
|
||||
|
||||
|
||||
rubble.setMetaBasedOnBlock(world.getBlock(x, y, z), world.getBlockMetadata(x, y, z));
|
||||
|
||||
|
||||
Vec3 vec = player.getLookVec();
|
||||
double dX = vec.xCoord * 5;
|
||||
double dY = vec.yCoord * 5;
|
||||
@ -185,22 +183,22 @@ public class WeaponSpecial extends ItemSword {
|
||||
rubble.motionX += dX;
|
||||
rubble.motionY += dY;
|
||||
rubble.motionZ += dZ;
|
||||
world.playSoundAtEntity(rubble, "hbm:weapon.bang", 3.0F, 1.0F);
|
||||
|
||||
if(!world.isRemote) {
|
||||
|
||||
world.spawnEntityInWorld(rubble);
|
||||
world.playSoundAtEntity(rubble, "hbm:weapon.bang", 3.0F, 1.0F);
|
||||
|
||||
if(!world.isRemote) {
|
||||
|
||||
world.spawnEntityInWorld(rubble);
|
||||
world.func_147480_a(x, y, z, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if(this == ModItems.shimmer_axe) {
|
||||
|
||||
world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, "hbm:weapon.kapeng", 3.0F, 1.0F);
|
||||
world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, "hbm:weapon.kapeng", 3.0F, 1.0F);
|
||||
|
||||
if(!world.isRemote) {
|
||||
if(!world.isRemote) {
|
||||
if(world.getBlock(x, y, z) != Blocks.air && world.getBlock(x, y, z).getExplosionResistance(null) < 6000) {
|
||||
world.func_147480_a(x, y, z, false);
|
||||
}
|
||||
@ -210,17 +208,16 @@ public class WeaponSpecial extends ItemSword {
|
||||
if(world.getBlock(x, y - 1, z) != Blocks.air && world.getBlock(x, y - 1, z).getExplosionResistance(null) < 6000) {
|
||||
world.func_147480_a(x, y - 1, z, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Multimap getItemAttributeModifiers()
|
||||
{
|
||||
Multimap multimap = super.getItemAttributeModifiers();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Multimap getItemAttributeModifiers() {
|
||||
Multimap multimap = super.getItemAttributeModifiers();
|
||||
if(this == ModItems.schrabidium_hammer) {
|
||||
multimap.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", -0.5, 1));
|
||||
}
|
||||
@ -230,24 +227,23 @@ public class WeaponSpecial extends ItemSword {
|
||||
if(this == ModItems.wrench || this == ModItems.wrench_flipped) {
|
||||
multimap.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", -0.1, 1));
|
||||
}
|
||||
return multimap;
|
||||
}
|
||||
|
||||
@Override
|
||||
return multimap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack stack, World world, Entity entity, int i, boolean b) {
|
||||
|
||||
if(entity instanceof EntityPlayer) {
|
||||
if(ArmorUtil.checkForFiend((EntityPlayer) entity)) {
|
||||
((EntityPlayer) entity).triggerAchievement(MainRegistry.achFiend);
|
||||
} else if(ArmorUtil.checkForFiend2((EntityPlayer) entity)) {
|
||||
((EntityPlayer) entity).triggerAchievement(MainRegistry.achFiend2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(entity instanceof EntityPlayer) {
|
||||
if(ArmorUtil.checkForFiend((EntityPlayer) entity)) {
|
||||
((EntityPlayer) entity).triggerAchievement(MainRegistry.achFiend);
|
||||
} else if(ArmorUtil.checkForFiend2((EntityPlayer) entity)) {
|
||||
((EntityPlayer) entity).triggerAchievement(MainRegistry.achFiend2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool)
|
||||
{
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool) {
|
||||
if(this == ModItems.schrabidium_hammer) {
|
||||
list.add("Even though it says \"+1000000000");
|
||||
list.add("damage\", it's actually \"onehit anything\"");
|
||||
|
||||
@ -76,7 +76,7 @@ public class GunFactoryClient {
|
||||
MinecraftForgeClient.registerItemRenderer(ModItems.gun_m2, new ItemRenderM2());
|
||||
MinecraftForgeClient.registerItemRenderer(ModItems.gun_autoshotgun, new ItemRenderShredder(ResourceManager.shredder_tex));
|
||||
MinecraftForgeClient.registerItemRenderer(ModItems.gun_autoshotgun_shredder, new ItemRenderShredder(ResourceManager.shredder_orig_tex));
|
||||
MinecraftForgeClient.registerItemRenderer(ModItems.gun_autoshotgun_sexy, new ItemRenderShredder(ResourceManager.sexy_tex));
|
||||
MinecraftForgeClient.registerItemRenderer(ModItems.gun_autoshotgun_sexy, new ItemRenderSexy());
|
||||
MinecraftForgeClient.registerItemRenderer(ModItems.gun_quadro, new ItemRenderQuadro());
|
||||
MinecraftForgeClient.registerItemRenderer(ModItems.gun_minigun, new ItemRenderMinigun(ResourceManager.minigun_tex));
|
||||
MinecraftForgeClient.registerItemRenderer(ModItems.gun_minigun_lacunae, new ItemRenderMinigun(ResourceManager.minigun_lacunae_tex));
|
||||
|
||||
@ -933,23 +933,42 @@ public class Orchestras {
|
||||
if(entity.worldObj.isRemote) return;
|
||||
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
|
||||
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
|
||||
boolean aiming = ItemGunBaseNT.getIsAiming(stack);
|
||||
|
||||
if(type == AnimType.CYCLE) {
|
||||
if(timer == 0 && ctx.config.getReceivers(stack)[0].getMagazine(stack).getType(stack, null) == XFactory12ga.g12_equestrian_bj) {
|
||||
ItemGunBaseNT.setTimer(stack, 0, 20);
|
||||
}
|
||||
|
||||
if(timer == 2) {
|
||||
SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack, ctx.inventory);
|
||||
if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.375, aiming ? -0.0625 : -0.125, aiming ? 0 : -0.25D, 0, 0.18, -0.12, 0.01, -10F + (float)entity.getRNG().nextGaussian() * 2.5F, (float)entity.getRNG().nextGaussian() * -20F + 15F, casing.getName(), false, 60, 0.5D, 20);
|
||||
}
|
||||
}
|
||||
|
||||
if(type == AnimType.CYCLE_DRY) {
|
||||
if(timer == 0) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.dryFireClick", 1F, 1F);
|
||||
}
|
||||
if(type == AnimType.RELOAD) {
|
||||
if(timer == 2) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magRemove", 1F, 1F);
|
||||
if(timer == 32) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magInsert", 1F, 1F);
|
||||
if(timer == 0) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverCock", 1F, 1F);
|
||||
if(timer == 4) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverClose", 1F, 0.75F);
|
||||
if(timer == 16) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magSmallRemove", 1F, 1F);
|
||||
if(timer == 30) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magRemove", 1F, 1F);
|
||||
if(timer == 55) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.impact", 0.5F, 1F);
|
||||
if(timer == 65) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magInsert", 1F, 1F);
|
||||
if(timer == 74) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magSmallInsert", 1F, 1F);
|
||||
if(timer == 88) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverClose", 1F, 0.75F);
|
||||
if(timer == 100) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverCock", 1F, 1F);
|
||||
|
||||
if(timer == 55) ctx.config.getReceivers(stack)[0].getMagazine(stack).reloadAction(stack, ctx.inventory);
|
||||
}
|
||||
|
||||
if(type == AnimType.INSPECT) {
|
||||
if(timer == 2) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magRemove", 1F, 1F);
|
||||
if(timer == 28) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magInsert", 1F, 1F);
|
||||
if(timer == 20) entity.worldObj.playSoundAtEntity(entity, "hbm:player.gulp", 1F, 1F);
|
||||
if(timer == 25) entity.worldObj.playSoundAtEntity(entity, "hbm:player.gulp", 1F, 1F);
|
||||
if(timer == 30) entity.worldObj.playSoundAtEntity(entity, "hbm:player.gulp", 1F, 1F);
|
||||
if(timer == 35) entity.worldObj.playSoundAtEntity(entity, "hbm:player.gulp", 1F, 1F);
|
||||
if(timer == 50) entity.worldObj.playSoundAtEntity(entity, "hbm:player.groan", 1F, 1F);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -323,7 +323,7 @@ public class XFactory12ga {
|
||||
ModItems.gun_maresleg_broken = new ItemGunBaseNT(WeaponQuality.LEGENDARY, new GunConfig()
|
||||
.dura(0).draw(5).inspect(39).reloadSequential(true).crosshair(Crosshair.L_CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE)
|
||||
.rec(new Receiver(0)
|
||||
.dmg(32F).spreadAmmo(1.15F).delay(20).reload(22, 10, 13, 0).jam(24).sound("hbm:weapon.fire.shotgun", 1.0F, 1.0F)
|
||||
.dmg(48F).spreadAmmo(1.15F).delay(20).reload(22, 10, 13, 0).jam(24).sound("hbm:weapon.fire.shotgun", 1.0F, 1.0F)
|
||||
.mag(new MagazineSingleReload(0, 6).addConfigs(g12_equestrian_tkr, g12_bp, g12_bp_magnum, g12_bp_slug, g12, g12_slug, g12_flechette, g12_magnum, g12_explosive, g12_phosphorus))
|
||||
.offset(0.75, -0.0625, -0.1875)
|
||||
.canFire(Lego.LAMBDA_STANDARD_CAN_FIRE).fire(Lego.LAMBDA_NOWEAR_FIRE).recoil(LAMBDA_RECOIL_MARESLEG))
|
||||
@ -373,10 +373,11 @@ public class XFactory12ga {
|
||||
.setupStandardConfiguration()
|
||||
.anim(LAMBDA_SHREDDER_ANIMS).orchestra(Orchestras.ORCHESTRA_SHREDDER)
|
||||
).setUnlocalizedName("gun_autoshotgun_shredder");
|
||||
|
||||
ModItems.gun_autoshotgun_sexy = new ItemGunBaseNT(WeaponQuality.LEGENDARY, new GunConfig()
|
||||
.dura(5_000).draw(10).inspect(33).reloadSequential(true).crosshair(Crosshair.L_CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE)
|
||||
.dura(5_000).draw(20).inspect(33).reloadSequential(true).crosshair(Crosshair.L_CIRCLE).hideCrosshair(false).smoke(Lego.LAMBDA_STANDARD_SMOKE)
|
||||
.rec(new Receiver(0)
|
||||
.dmg(64F).delay(1).auto(true).dryfireAfterAuto(true).reload(44).jam(19).sound("hbm:weapon.fire.shotgunAuto", 1.0F, 1.0F)
|
||||
.dmg(64F).delay(4).auto(true).dryfireAfterAuto(true).reload(110).jam(19).sound("hbm:weapon.fire.shotgunAuto", 1.0F, 1.0F)
|
||||
.mag(new MagazineFullReload(0, 100).addConfigs(g12_equestrian_bj, g12_bp, g12_bp_magnum, g12_bp_slug, g12, g12_slug, g12_flechette, g12_magnum, g12_explosive, g12_phosphorus))
|
||||
.offset(0.75, -0.125, -0.25)
|
||||
.setupStandardFire().recoil(LAMBDA_RECOIL_SEXY))
|
||||
@ -652,13 +653,30 @@ public class XFactory12ga {
|
||||
|
||||
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_SEXY_ANIMS = (stack, type) -> {
|
||||
switch(type) {
|
||||
case CYCLE: return new BusAnimation()
|
||||
.addBus("RECOIL", new BusAnimationSequence().addPos(0, 0, -1, 50, IType.SIN_DOWN).addPos(0, 0, 0, 150, IType.SIN_FULL))
|
||||
.addBus("CYCLE", new BusAnimationSequence().addPos(0, 0, 18, 50));
|
||||
case EQUIP: return new BusAnimation()
|
||||
.addBus("EQUIP", new BusAnimationSequence().addPos(45, 0, 0, 0).addPos(0, 0, 0, 1000, IType.SIN_DOWN));
|
||||
case CYCLE:
|
||||
int amount = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack, null);
|
||||
return new BusAnimation()
|
||||
.addBus("RECOIL", new BusAnimationSequence().hold(50).addPos(0, 0, -0.25, 50, IType.SIN_DOWN).addPos(0, 0, 0, 100, IType.SIN_FULL))
|
||||
.addBus("BARREL", new BusAnimationSequence().addPos(0, 0, -1, 50, IType.SIN_DOWN).addPos(0, 0, 0, 150))
|
||||
.addBus("CYCLE", new BusAnimationSequence().addPos(1, 0, 0, 150))
|
||||
.addBus("HOOD", new BusAnimationSequence().hold(50).addPos(3, 0, 0, 50, IType.SIN_DOWN).addPos(0, 0, 0, 50, IType.SIN_UP))
|
||||
.addBus("SHELLS", new BusAnimationSequence().setPos(amount - 1, 0, 0));
|
||||
case CYCLE_DRY: return new BusAnimation()
|
||||
.addBus("CYCLE", new BusAnimationSequence().addPos(0, 0, 18, 50));
|
||||
case RELOAD: return new BusAnimation()
|
||||
.addBus("LOWER", new BusAnimationSequence().addPos(15, 0, 0, 500, IType.SIN_FULL).hold(2750).addPos(12, 0, 0, 100, IType.SIN_DOWN).addPos(15, 0, 0, 100, IType.SIN_FULL).hold(1050).addPos(18, 0, 0, 100, IType.SIN_DOWN).addPos(15, 0, 0, 100, IType.SIN_FULL).hold(300).addPos(0, 0, 0, 500, IType.SIN_FULL))
|
||||
.addBus("LEVER", new BusAnimationSequence().addPos(0, 0, 1, 150).hold(4700).addPos(0, 0, 0, 150))
|
||||
.addBus("HOOD", new BusAnimationSequence().hold(250).addPos(60, 0, 0, 500, IType.SIN_FULL).hold(3250).addPos(0, 0, 0, 500, IType.SIN_UP))
|
||||
.addBus("BELT", new BusAnimationSequence().setPos(1, 0, 0).hold(750).addPos(0, 0, 0, 500, IType.SIN_UP).hold(2000).addPos(1, 0, 0, 500, IType.SIN_UP))
|
||||
.addBus("MAG", new BusAnimationSequence().hold(1500).addPos(0, -1, 0, 250, IType.SIN_UP).addPos(2, -1, 0, 500, IType.SIN_UP).addPos(7, 1, 0, 250, IType.SIN_UP).addPos(15, 2, 0, 250).setPos(0, -2, 0).addPos(0, 0, 0, 500, IType.SIN_UP))
|
||||
.addBus("MAGROT", new BusAnimationSequence().hold(2250).addPos(0, 0, -180, 500, IType.SIN_FULL).setPos(0, 0, 0));
|
||||
case INSPECT: return new BusAnimation()
|
||||
.addBus("BOTTLE", new BusAnimationSequence().setPos(8, -8, -2).addPos(6, -4, -2, 500, IType.SIN_DOWN).addPos(3, -3, -5, 500, IType.SIN_FULL).addPos(3, -2, -5, 1000).addPos(4, -6, -2, 750, IType.SIN_FULL).addPos(6, -8, -2, 500, IType.SIN_UP))
|
||||
.addBus("SIP", new BusAnimationSequence().setPos(25, 0, 0).hold(500).addPos(-90, 0, 0, 500, IType.SIN_FULL).addPos(-110, 0, 0, 1000).addPos(25, 0, 0, 750, IType.SIN_FULL));
|
||||
}
|
||||
|
||||
return LAMBDA_SHREDDER_ANIMS.apply(stack, type);
|
||||
return null;
|
||||
};
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class XFactoryEnergy {
|
||||
|
||||
public static final ResourceLocation scope_luna = new ResourceLocation(RefStrings.MODID, "textures/misc/scope_luna.png");
|
||||
public static final ResourceLocation scope_luna = new ResourceLocation(RefStrings.MODID, "textures/misc/scope_amat.png");
|
||||
|
||||
public static BulletConfig energy_tesla;
|
||||
public static BulletConfig energy_tesla_overcharge;
|
||||
@ -166,9 +166,9 @@ public class XFactoryEnergy {
|
||||
energy_las_overcharge = new BulletConfig().setItem(EnumAmmo.CAPACITOR_OVERCHARGE).setCasing(new ItemStack(ModItems.ingot_polymer, 2), 4).setupDamageClass(DamageClass.LASER).setBeam().setSpread(0.0F).setLife(5).setRenderRotations(false).setDoesPenetrate(true).setOnBeamImpact(BulletConfig.LAMBDA_STANDARD_BEAM_HIT);
|
||||
energy_las_ir = new BulletConfig().setItem(EnumAmmo.CAPACITOR_IR).setCasing(new ItemStack(ModItems.ingot_polymer, 2), 4).setupDamageClass(DamageClass.FIRE).setBeam().setSpread(0.0F).setLife(5).setRenderRotations(false).setOnBeamImpact(LAMBDA_IR_HIT);
|
||||
|
||||
energy_emerald = energy_las.clone().setArmorPiercing(0.5F).setThresholdNegation(5F);
|
||||
energy_emerald_overcharge = energy_las_overcharge.clone().setArmorPiercing(0.5F).setThresholdNegation(5F);
|
||||
energy_emerald_ir = energy_las_ir.clone().setArmorPiercing(0.5F).setThresholdNegation(5F);
|
||||
energy_emerald = energy_las.clone().setArmorPiercing(0.5F).setThresholdNegation(10F);
|
||||
energy_emerald_overcharge = energy_las_overcharge.clone().setArmorPiercing(0.5F).setThresholdNegation(15F);
|
||||
energy_emerald_ir = energy_las_ir.clone().setArmorPiercing(0.5F).setThresholdNegation(10F);
|
||||
|
||||
ModItems.gun_tesla_cannon = new ItemGunBaseNT(WeaponQuality.A_SIDE, new GunConfig()
|
||||
.dura(1_000).draw(10).inspect(33).crosshair(Crosshair.CIRCLE)
|
||||
@ -194,7 +194,7 @@ public class XFactoryEnergy {
|
||||
ModItems.gun_laser_pistol_pew_pew = new ItemGunBaseNT(WeaponQuality.B_SIDE, new GunConfig()
|
||||
.dura(500).draw(10).inspect(26).crosshair(Crosshair.CIRCLE)
|
||||
.rec(new Receiver(0)
|
||||
.dmg(20F).rounds(5).delay(10).spread(0.25F).spreadHipfire(1F).reload(45).jam(37).sound("hbm:weapon.fire.laserPistol", 1.0F, 0.8F)
|
||||
.dmg(30F).rounds(5).delay(10).spread(0.25F).spreadHipfire(1F).reload(45).jam(37).sound("hbm:weapon.fire.laserPistol", 1.0F, 0.8F)
|
||||
.mag(new MagazineFullReload(0, 10).addConfigs(energy_las, energy_las_overcharge, energy_las_ir))
|
||||
.offset(0.75, -0.0625 * 1.5, -0.1875)
|
||||
.setupStandardFire().recoil(LAMBDA_RECOIL_ENERGY))
|
||||
|
||||
@ -138,7 +138,7 @@ public class WeaponModManager {
|
||||
new WeaponModDefinition(EnumModSpecial.SPEEDUP)
|
||||
.addMod(new Item[] {ModItems.gun_minigun, ModItems.gun_minigun_dual}, new WeaponModMinigunSpeedup(ID_MINIGUN_SPEED))
|
||||
.addMod(new Item[] {ModItems.gun_autoshotgun, ModItems.gun_autoshotgun_shredder}, new WeaponModShredderSpeedup(209));
|
||||
new WeaponModDefinition(EnumModSpecial.CHOKE).addMod(new Item[] {ModItems.gun_pepperbox, ModItems.gun_maresleg, ModItems.gun_double_barrel, ModItems.gun_liberator, ModItems.gun_spas12}, new WeaponModChoke(210));
|
||||
new WeaponModDefinition(EnumModSpecial.CHOKE).addMod(new Item[] {ModItems.gun_pepperbox, ModItems.gun_maresleg, ModItems.gun_double_barrel, ModItems.gun_liberator, ModItems.gun_spas12, ModItems.gun_autoshotgun_sexy}, new WeaponModChoke(210));
|
||||
new WeaponModDefinition(EnumModSpecial.FURNITURE_GREEN).addMod(ModItems.gun_g3, new WeaponModPolymerFurniture(ID_FURNITURE_GREEN));
|
||||
new WeaponModDefinition(EnumModSpecial.FURNITURE_BLACK).addMod(ModItems.gun_g3, new WeaponModPolymerFurniture(ID_FURNITURE_BLACK));
|
||||
new WeaponModDefinition(EnumModSpecial.BAYONET)
|
||||
|
||||
@ -91,6 +91,7 @@ import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
import com.hbm.util.i18n.I18nClient;
|
||||
import com.hbm.util.i18n.ITranslate;
|
||||
import com.hbm.wiaj.cannery.Jars;
|
||||
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
@ -270,6 +271,7 @@ public class ClientProxy extends ServerProxy {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineChemplant.class, new RenderChemplant());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineChemicalPlant.class, new RenderChemicalPlant());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineChemfac.class, new RenderChemfac());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineChemicalFactory.class, new RenderChemicalFactory());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineFluidTank.class, new RenderFluidTank());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineBAT9000.class, new RenderBAT9000());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineOrbus.class, new RenderOrbus());
|
||||
|
||||
@ -604,6 +604,7 @@ public class CraftingManager {
|
||||
addRecipeAuto(new ItemStack(ModBlocks.fluid_duct_neo, 8, 1), new Object[] { "IAI", " ", "IAI", 'I', IRON.plate(), 'A', AL.plate() });
|
||||
addRecipeAuto(new ItemStack(ModBlocks.fluid_duct_neo, 8, 2), new Object[] { "ASA", " ", "ASA", 'S', STEEL.plate(), 'A', AL.plate() });
|
||||
addRecipeAuto(new ItemStack(ModBlocks.fluid_duct_paintable, 8), new Object[] { "SAS", "A A", "SAS", 'S', STEEL.ingot(), 'A', AL.plate() });
|
||||
addRecipeAuto(new ItemStack(ModBlocks.fluid_duct_paintable_block_exhaust, 8), new Object[] { "SAS", "A A", "SAS", 'S', IRON.ingot(), 'A', ModItems.plate_polymer});
|
||||
addShapelessAuto(new ItemStack(ModBlocks.fluid_duct_gauge), new Object[] { ModBlocks.fluid_duct_paintable, STEEL.ingot(), DictFrame.fromOne(ModItems.circuit, EnumCircuitType.BASIC) });
|
||||
addRecipeAuto(new ItemStack(ModBlocks.fluid_valve, 1), new Object[] { "S", "W", 'S', Blocks.lever, 'W', ModBlocks.fluid_duct_paintable });
|
||||
addRecipeAuto(new ItemStack(ModBlocks.fluid_switch, 1), new Object[] { "S", "W", 'S', REDSTONE.dust(), 'W', ModBlocks.fluid_duct_paintable });
|
||||
|
||||
@ -13,6 +13,7 @@ import com.hbm.entity.grenade.*;
|
||||
import com.hbm.entity.logic.IChunkLoader;
|
||||
import com.hbm.entity.mob.siege.SiegeTier;
|
||||
import com.hbm.handler.*;
|
||||
import com.hbm.handler.ae2.AE2CompatHandler;
|
||||
import com.hbm.handler.imc.IMCBlastFurnace;
|
||||
import com.hbm.handler.imc.IMCCentrifuge;
|
||||
import com.hbm.handler.imc.IMCCrystallizer;
|
||||
@ -881,6 +882,9 @@ public class MainRegistry {
|
||||
// Load compatibility for OC.
|
||||
CompatHandler.init();
|
||||
|
||||
// Load compatibility for AE2.
|
||||
AE2CompatHandler.init();
|
||||
|
||||
//expand for the largest entity we have (currently Quackos who is 17.5m in diameter, that's one fat duck)
|
||||
World.MAX_ENTITY_RADIUS = Math.max(World.MAX_ENTITY_RADIUS, 8.75);
|
||||
|
||||
@ -899,10 +903,14 @@ public class MainRegistry {
|
||||
Compat.handleRailcraftNonsense();
|
||||
SuicideThreadDump.register();
|
||||
CommandReloadClient.register();
|
||||
|
||||
// to make sure that foreign registered fluids are accounted for,
|
||||
// even when the reload listener is registered too late due to load order
|
||||
Fluids.reloadFluids();
|
||||
|
||||
//ExplosionTests.runTest();
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
if(logger == null)
|
||||
|
||||
@ -13,9 +13,7 @@ import com.hbm.extprop.HbmPlayerProps;
|
||||
import com.hbm.handler.ArmorModHandler;
|
||||
import com.hbm.handler.HTTPHandler;
|
||||
import com.hbm.handler.HazmatRegistry;
|
||||
import com.hbm.handler.HbmKeybinds;
|
||||
import com.hbm.handler.ImpactWorldHandler;
|
||||
import com.hbm.handler.HbmKeybinds.EnumKeybind;
|
||||
import com.hbm.hazard.HazardSystem;
|
||||
import com.hbm.interfaces.IHoldableWeapon;
|
||||
import com.hbm.interfaces.IItemHUD;
|
||||
@ -36,7 +34,6 @@ import com.hbm.lib.Library;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toserver.AuxButtonPacket;
|
||||
import com.hbm.packet.toserver.KeybindPacket;
|
||||
import com.hbm.render.anim.HbmAnimations;
|
||||
import com.hbm.render.anim.HbmAnimations.Animation;
|
||||
import com.hbm.render.block.ct.CTStitchReceiver;
|
||||
@ -67,7 +64,6 @@ import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.eventhandler.EventPriority;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.InputEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
|
||||
@ -88,7 +84,6 @@ import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderPlayer;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
@ -927,16 +922,18 @@ public class ModEventHandlerClient {
|
||||
ItemFluidDuct.class
|
||||
);
|
||||
|
||||
String prefix = "Gun ";
|
||||
int scale = 8;
|
||||
String prefix = "Slot ";
|
||||
//int gunScale = 8;
|
||||
int slotScale = 1;
|
||||
boolean ignoreNonNTM = true;
|
||||
boolean onlyGuns = true;
|
||||
|
||||
List<ItemStack> stacks = new ArrayList<ItemStack>();
|
||||
for (Object reg : Item.itemRegistry) {
|
||||
Item item = (Item) reg;
|
||||
if(ignoreNonNTM && !Item.itemRegistry.getNameForObject(item).startsWith("hbm:")) continue;
|
||||
if(ignoredItems.contains(item)) continue;
|
||||
if(!(item instanceof ItemGunBaseNT) && prefix.toLowerCase(Locale.US).startsWith("gun")) continue;
|
||||
if(onlyGuns && !(item instanceof ItemGunBaseNT)) continue;
|
||||
if(collapsedClasses.contains(item.getClass())) {
|
||||
stacks.add(new ItemStack(item));
|
||||
} else {
|
||||
@ -945,7 +942,7 @@ public class ModEventHandlerClient {
|
||||
}
|
||||
|
||||
Minecraft.getMinecraft().thePlayer.closeScreen();
|
||||
FMLCommonHandler.instance().showGuiScreen(new GUIScreenWikiRender(stacks.toArray(new ItemStack[0]), prefix, "wiki-block-renders-256", scale));
|
||||
FMLCommonHandler.instance().showGuiScreen(new GUIScreenWikiRender(stacks.toArray(new ItemStack[0]), prefix, "wiki-block-renders-256", slotScale));
|
||||
}
|
||||
} else {
|
||||
isRenderingItems = false;
|
||||
@ -1081,7 +1078,8 @@ public class ModEventHandlerClient {
|
||||
}
|
||||
}
|
||||
|
||||
if(event.phase == Phase.START) {
|
||||
// ???
|
||||
/*if(event.phase == Phase.START) {
|
||||
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
@ -1097,7 +1095,7 @@ public class ModEventHandlerClient {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@ -1122,73 +1120,6 @@ public class ModEventHandlerClient {
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SubscribeEvent(priority = EventPriority.LOW)
|
||||
public void onMouseClicked(InputEvent.MouseInputEvent event) {
|
||||
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
if(GeneralConfig.enableKeybindOverlap && (mc.currentScreen == null || mc.currentScreen.allowUserInput)) {
|
||||
boolean state = Mouse.getEventButtonState();
|
||||
int keyCode = Mouse.getEventButton() - 100;
|
||||
|
||||
//if anything errors here, run ./gradlew clean setupDecompWorkSpace
|
||||
for(Object o : KeyBinding.keybindArray) {
|
||||
KeyBinding key = (KeyBinding) o;
|
||||
|
||||
if(key.getKeyCode() == keyCode && KeyBinding.hash.lookup(key.getKeyCode()) != key) {
|
||||
|
||||
key.pressed = state;
|
||||
if(state && key.pressTime == 0) {
|
||||
key.pressTime = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boolean gunKey = keyCode == HbmKeybinds.gunPrimaryKey.getKeyCode() || keyCode == HbmKeybinds.gunSecondaryKey.getKeyCode() ||
|
||||
keyCode == HbmKeybinds.gunTertiaryKey.getKeyCode() || keyCode == HbmKeybinds.reloadKey.getKeyCode();
|
||||
|
||||
EntityPlayer player = mc.thePlayer;
|
||||
|
||||
if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemGunBaseNT) {
|
||||
|
||||
/* Shoot in favor of attacking */
|
||||
if(gunKey && keyCode == mc.gameSettings.keyBindAttack.getKeyCode()) {
|
||||
mc.gameSettings.keyBindAttack.pressed = false;
|
||||
mc.gameSettings.keyBindAttack.pressTime = 0;
|
||||
}
|
||||
|
||||
if(gunKey && keyCode == mc.gameSettings.keyBindPickBlock.getKeyCode()) {
|
||||
mc.gameSettings.keyBindPickBlock.pressed = false;
|
||||
mc.gameSettings.keyBindPickBlock.pressTime = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SubscribeEvent(priority = EventPriority.LOW)
|
||||
public void onKeyTyped(InputEvent.KeyInputEvent event) {
|
||||
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
if(GeneralConfig.enableKeybindOverlap && (mc.currentScreen == null || mc.currentScreen.allowUserInput)) {
|
||||
boolean state = Keyboard.getEventKeyState();
|
||||
int keyCode = Keyboard.getEventKey();
|
||||
|
||||
//if anything errors here, run ./gradlew clean setupDecompWorkSpace
|
||||
for(Object o : KeyBinding.keybindArray) {
|
||||
KeyBinding key = (KeyBinding) o;
|
||||
|
||||
if(keyCode != 0 && key.getKeyCode() == keyCode && KeyBinding.hash.lookup(key.getKeyCode()) != key) {
|
||||
|
||||
key.pressed = state;
|
||||
if(state && key.pressTime == 0) {
|
||||
key.pressTime = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SubscribeEvent
|
||||
public void onRenderWorldLastEvent(RenderWorldLastEvent event) {
|
||||
|
||||
@ -150,6 +150,7 @@ public class ResourceManager {
|
||||
public static final IModelCustom chemplant_fluidcap = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/chemplant_new_fluidcap.hmf"));
|
||||
public static final IModelCustom chemical_plant = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/chemical_plant.obj"));
|
||||
public static final IModelCustom chemfac = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/chemfac.obj"));
|
||||
public static final IModelCustom chemical_factory = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/chemical_factory.obj"));
|
||||
|
||||
//Mixer
|
||||
public static final IModelCustom mixer = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/mixer.obj"));
|
||||
@ -583,6 +584,7 @@ public class ResourceManager {
|
||||
public static final ResourceLocation chemical_plant_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/chemical_plant.png");
|
||||
public static final ResourceLocation chemical_plant_fluid_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/chemical_plant_fluid.png");
|
||||
public static final ResourceLocation chemfac_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/chemfac.png");
|
||||
public static final ResourceLocation chemical_factory_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/chemical_factory.png");
|
||||
|
||||
//Mixer
|
||||
public static final ResourceLocation mixer_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/mixer.png");
|
||||
@ -882,6 +884,8 @@ public class ResourceManager {
|
||||
public static final IModelCustom amat = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/amat.obj")).asVBO();
|
||||
public static final IModelCustom m2 = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/m2_browning.obj")).asVBO();
|
||||
public static final IModelCustom shredder = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/shredder.obj")).asVBO();
|
||||
public static final IModelCustom sexy = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/sexy.obj")).asVBO();
|
||||
public static final IModelCustom whiskey = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/whiskey.obj")).asVBO();
|
||||
public static final IModelCustom quadro = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/quadro.obj")).asVBO();
|
||||
public static final IModelCustom mike_hawk = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/mike_hawk.obj")).asVBO();
|
||||
public static final IModelCustom minigun = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/minigun.obj")).asVBO();
|
||||
@ -1005,7 +1009,8 @@ public class ResourceManager {
|
||||
public static final ResourceLocation amat_penance_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/amat_penance.png");
|
||||
public static final ResourceLocation shredder_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/shredder.png");
|
||||
public static final ResourceLocation shredder_orig_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/shredder_orig.png");
|
||||
public static final ResourceLocation sexy_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/sexy.png");
|
||||
public static final ResourceLocation sexy_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/sexy_real_no_fake.png");
|
||||
public static final ResourceLocation whiskey_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/whiskey.png");
|
||||
public static final ResourceLocation quadro_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/quadro.png");
|
||||
public static final ResourceLocation quadro_rocket_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/quadro_rocket.png");
|
||||
public static final ResourceLocation minigun_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/minigun.png");
|
||||
|
||||
@ -61,11 +61,13 @@ public class ServerProxy {
|
||||
public void displayTooltip(String msg, int id) {
|
||||
displayTooltip(msg, 1000, id);
|
||||
}
|
||||
|
||||
public void displayTooltip(String msg, int time, int id) { }
|
||||
|
||||
public boolean getIsKeyPressed(EnumKeybind key) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public EntityPlayer me() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@ public class ModuleMachineChemplant {
|
||||
public FluidTank[] outputTanks = new FluidTank[3];
|
||||
// running vars
|
||||
public String recipe = "null";
|
||||
public float progress;
|
||||
public double progress;
|
||||
// return signals
|
||||
public boolean didProcess = false;
|
||||
public boolean markDirty = false;
|
||||
@ -43,14 +43,15 @@ public class ModuleMachineChemplant {
|
||||
/** Chances tank type and pressure based on recipe */
|
||||
public void setupTanks(GenericRecipe recipe) {
|
||||
if(recipe == null) return;
|
||||
if(recipe.inputFluid != null) for(int i = 0; i < Math.min(inputTanks.length, recipe.inputFluid.length); i++) inputTanks[i].conform(recipe.inputFluid[i]);
|
||||
if(recipe.outputFluid != null) for(int i = 0; i < Math.min(outputTanks.length, recipe.outputFluid.length); i++) outputTanks[i].conform(recipe.outputFluid[i]);
|
||||
for(int i = 0; i < 3; i++) if(recipe.inputFluid != null && recipe.inputFluid.length > i) inputTanks[i].conform(recipe.inputFluid[i]); else inputTanks[i].resetTank();
|
||||
for(int i = 0; i < 3; i++) if(recipe.outputFluid != null && recipe.outputFluid.length > i) outputTanks[i].conform(recipe.outputFluid[i]); else outputTanks[i].resetTank();
|
||||
}
|
||||
|
||||
/** Expects the tanks to be set up correctly beforehand */
|
||||
public boolean canProcess(GenericRecipe recipe) {
|
||||
public boolean canProcess(GenericRecipe recipe, double speed, double power) {
|
||||
if(recipe == null) return false;
|
||||
if(battery.getPower() < recipe.power) return false;
|
||||
if(power != 1 && battery.getPower() < recipe.power * power) return false; // only check with floating point numbers if mult is not 1
|
||||
if(power == 1 && battery.getPower() < recipe.power) return false;
|
||||
|
||||
if(recipe.inputItem != null) {
|
||||
for(int i = 0; i < Math.min(recipe.inputItem.length, inputSlots.length); i++) {
|
||||
@ -87,14 +88,13 @@ public class ModuleMachineChemplant {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void process(GenericRecipe recipe) {
|
||||
public void process(GenericRecipe recipe, double speed, double power) {
|
||||
|
||||
this.battery.setPower(this.battery.getPower() - recipe.power);
|
||||
float step = Math.min(1F / recipe.duration, 1F); // can't do more than one recipe per tick, might look into that later
|
||||
this.battery.setPower(this.battery.getPower() - (power == 1 ? recipe.power : (long) (recipe.power * power)));
|
||||
double step = Math.min(speed / recipe.duration, 1D); // can't do more than one recipe per tick, might look into that later
|
||||
this.progress += step;
|
||||
|
||||
if(this.progress >= 1F) {
|
||||
this.progress -= 1F;
|
||||
if(this.progress >= 1D) {
|
||||
|
||||
if(recipe.inputItem != null) {
|
||||
for(int i = 0; i < Math.min(recipe.inputItem.length, inputSlots.length); i++) {
|
||||
@ -127,18 +127,23 @@ public class ModuleMachineChemplant {
|
||||
}
|
||||
|
||||
this.markDirty = true;
|
||||
|
||||
if(this.canProcess(recipe, speed, power))
|
||||
this.progress -= 1D;
|
||||
else
|
||||
this.progress = 0D;
|
||||
}
|
||||
}
|
||||
|
||||
public void update() {
|
||||
public void update(double speed, double power, boolean extraCondition) {
|
||||
GenericRecipe recipe = ChemicalPlantRecipes.INSTANCE.recipeNameMap.get(this.recipe);
|
||||
this.setupTanks(recipe);
|
||||
|
||||
this.didProcess = false;
|
||||
this.markDirty = false;
|
||||
|
||||
if(this.canProcess(recipe)) {
|
||||
this.process(recipe);
|
||||
if(extraCondition && this.canProcess(recipe, speed, power)) {
|
||||
this.process(recipe, speed, power);
|
||||
this.didProcess = true;
|
||||
} else {
|
||||
this.progress = 0F;
|
||||
@ -164,22 +169,22 @@ public class ModuleMachineChemplant {
|
||||
public ModuleMachineChemplant fluidOutput(FluidTank a, FluidTank b, FluidTank c) { outputTanks[0] = a; outputTanks[1] = b; outputTanks[2] = c; return this; }
|
||||
|
||||
public void serialize(ByteBuf buf) {
|
||||
buf.writeFloat(progress);
|
||||
buf.writeDouble(progress);
|
||||
ByteBufUtils.writeUTF8String(buf, recipe);
|
||||
}
|
||||
|
||||
public void deserialize(ByteBuf buf) {
|
||||
this.progress = buf.readFloat();
|
||||
this.progress = buf.readDouble();
|
||||
this.recipe = ByteBufUtils.readUTF8String(buf);
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
this.progress = nbt.getFloat("progress");
|
||||
this.recipe = nbt.getString("recipe");
|
||||
this.progress = nbt.getDouble("progress" + index);
|
||||
this.recipe = nbt.getString("recipe" + index);
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
nbt.setFloat("progress", progress);
|
||||
nbt.setString("recipe", recipe);
|
||||
nbt.setDouble("progress" + index, progress);
|
||||
nbt.setString("recipe" + index, recipe);
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,12 +12,15 @@ import net.minecraft.world.World;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ParticleFlamethrower extends EntityFXRotating {
|
||||
|
||||
public int type;
|
||||
|
||||
public ParticleFlamethrower(World world, double x, double y, double z, int type) {
|
||||
super(world, x, y, z);
|
||||
particleIcon = ModEventHandlerClient.particleBase;
|
||||
this.particleMaxAge = 20 + rand.nextInt(10);
|
||||
this.particleScale = 0.5F;
|
||||
this.type = type;
|
||||
|
||||
this.motionX = world.rand.nextGaussian() * 0.02;
|
||||
this.motionZ = world.rand.nextGaussian() * 0.02;
|
||||
@ -31,6 +34,9 @@ public class ParticleFlamethrower extends EntityFXRotating {
|
||||
this.particleRed = color.getRed() / 255F;
|
||||
this.particleGreen = color.getGreen() / 255F;
|
||||
this.particleBlue = color.getBlue() / 255F;
|
||||
|
||||
if(type == FlameCreator.META_OXY) this.particleRed = this.particleGreen = this.particleBlue = 1F;
|
||||
if(type == FlameCreator.META_BLACK) this.particleRed = this.particleGreen = this.particleBlue = 1F;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -60,11 +66,21 @@ public class ParticleFlamethrower extends EntityFXRotating {
|
||||
public void renderParticle(Tessellator tess, float interp, float sX, float sY, float sZ, float dX, float dZ) {
|
||||
|
||||
double ageScaled = (double) this.particleAge / (double) this.particleMaxAge;
|
||||
|
||||
this.particleAlpha = (float) Math.pow(1 - Math.min(ageScaled, 1), 0.5);
|
||||
float add = 0.75F - (float) ageScaled;
|
||||
|
||||
tess.setColorRGBA_F(this.particleRed + add, this.particleGreen + add, this.particleBlue + add, this.particleAlpha * 0.5F);
|
||||
|
||||
if(type == FlameCreator.META_OXY) {
|
||||
this.particleAlpha = (float) (1 - ageScaled);
|
||||
float add = (float) ageScaled * 1.25F - 0.25F;
|
||||
tess.setColorRGBA_F(this.particleRed - add, this.particleGreen - add * 0.75F, this.particleBlue, this.particleAlpha);
|
||||
} else if(type == FlameCreator.META_BLACK) {
|
||||
this.particleAlpha = (float) (1 - ageScaled);
|
||||
float add = (float) ageScaled * 4F - 1F;
|
||||
tess.setColorRGBA_F(this.particleRed - add * 0.75F, this.particleGreen - add, this.particleBlue - add * 0.5F, this.particleAlpha);
|
||||
} else {
|
||||
this.particleAlpha = (float) Math.pow(1 - Math.min(ageScaled, 1), 0.5);
|
||||
float add = 0.75F - (float) ageScaled;
|
||||
tess.setColorRGBA_F(this.particleRed + add, this.particleGreen + add, this.particleBlue + add, this.particleAlpha * 0.5F);
|
||||
}
|
||||
|
||||
tess.setNormal(0.0F, 1.0F, 0.0F);
|
||||
tess.setBrightness(240);
|
||||
|
||||
|
||||
@ -18,6 +18,8 @@ public class FlameCreator implements IParticleCreator {
|
||||
public static int META_FIRE = 0;
|
||||
public static int META_BALEFIRE = 1;
|
||||
public static int META_DIGAMMA = 2;
|
||||
public static int META_OXY = 3;
|
||||
public static int META_BLACK = 4;
|
||||
|
||||
public static void composeEffect(World world, double x, double y, double z, int meta) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
|
||||
@ -0,0 +1,245 @@
|
||||
package com.hbm.render.item.weapon.sedna;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.interfaces.NotableComments;
|
||||
import com.hbm.items.weapon.sedna.ItemGunBaseNT;
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.render.anim.HbmAnimations;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.Vec3NT;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@NotableComments
|
||||
public class ItemRenderSexy extends ItemRenderWeaponBase {
|
||||
|
||||
@Override
|
||||
protected float getTurnMagnitude(ItemStack stack) { return ItemGunBaseNT.getIsAiming(stack) ? 2.5F : -0.25F; }
|
||||
|
||||
@Override
|
||||
public float getViewFOV(ItemStack stack, float fov) {
|
||||
float aimingProgress = ItemGunBaseNT.prevAimingProgress + (ItemGunBaseNT.aimingProgress - ItemGunBaseNT.prevAimingProgress) * interp;
|
||||
return fov * (1 - aimingProgress * 0.33F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupFirstPerson(ItemStack stack) {
|
||||
GL11.glTranslated(0, 0, 0.875);
|
||||
|
||||
float offset = 0.8F;
|
||||
|
||||
standardAimingTransform(stack,
|
||||
-1F * offset, -0.75F * offset, 3F * offset,
|
||||
-0.5F, -0.5F, 2F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFirstPerson(ItemStack stack) {
|
||||
ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem();
|
||||
double scale = 0.375D;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
|
||||
// i'm not going overboard with the animation
|
||||
boolean doesCycle = HbmAnimations.getRelevantAnim(0) != null && HbmAnimations.getRelevantAnim(0).animation.getBus("CYCLE") != null;
|
||||
boolean reloading = HbmAnimations.getRelevantAnim(0) != null && HbmAnimations.getRelevantAnim(0).animation.getBus("BELT") != null;
|
||||
boolean useShellCount = HbmAnimations.getRelevantAnim(0) != null && HbmAnimations.getRelevantAnim(0).animation.getBus("SHELLS") != null;
|
||||
boolean girldinner = HbmAnimations.getRelevantAnim(0) != null && HbmAnimations.getRelevantAnim(0).animation.getBus("BOTTLE") != null;
|
||||
double[] equip = HbmAnimations.getRelevantTransformation("EQUIP");
|
||||
double[] lower = HbmAnimations.getRelevantTransformation("LOWER");
|
||||
double[] recoil = HbmAnimations.getRelevantTransformation("RECOIL");
|
||||
double[] cycle = HbmAnimations.getRelevantTransformation("CYCLE");
|
||||
double[] barrel = HbmAnimations.getRelevantTransformation("BARREL");
|
||||
double[] hood = HbmAnimations.getRelevantTransformation("HOOD");
|
||||
double[] lever = HbmAnimations.getRelevantTransformation("LEVER");
|
||||
double[] belt = HbmAnimations.getRelevantTransformation("BELT");
|
||||
double[] mag = HbmAnimations.getRelevantTransformation("MAG");
|
||||
double[] magRot = HbmAnimations.getRelevantTransformation("MAGROT");
|
||||
double[] shellCount = HbmAnimations.getRelevantTransformation("SHELLS");
|
||||
double[] bottle = HbmAnimations.getRelevantTransformation("BOTTLE");
|
||||
double[] sippy = HbmAnimations.getRelevantTransformation("SIP");
|
||||
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
|
||||
if(girldinner) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(bottle[0], bottle[1], bottle[2]);
|
||||
GL11.glTranslated(0, 2, 0);
|
||||
GL11.glRotated(sippy[0], 1, 0, 0);
|
||||
GL11.glRotated(90, 0, 1, 0);
|
||||
GL11.glRotated(-15, 1, 0, 0);
|
||||
GL11.glTranslated(0, -2, 0);
|
||||
GL11.glScaled(1.5, 1.5, 1.5);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.whiskey_tex);
|
||||
ResourceManager.whiskey.renderAll();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.sexy_tex);
|
||||
|
||||
GL11.glTranslated(0, -1, -8);
|
||||
GL11.glRotated(equip[0], 1, 0, 0);
|
||||
GL11.glTranslated(0, 1, 8);
|
||||
|
||||
GL11.glTranslated(0, 0, -6);
|
||||
GL11.glRotated(lower[0], 1, 0, 0);
|
||||
GL11.glTranslated(0, 0, 6);
|
||||
|
||||
GL11.glTranslated(0, 0, recoil[2]);
|
||||
|
||||
ResourceManager.sexy.renderPart("Gun");
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0, 0, barrel[2]);
|
||||
ResourceManager.sexy.renderPart("Barrel");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0, 0, -0.375);
|
||||
GL11.glScaled(1, 1, 1 + 0.457247371D * barrel[2]);
|
||||
GL11.glTranslated(0, 0, 0.375);
|
||||
ResourceManager.sexy.renderPart("RecoilSpring");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0, 0.4375, -2.875);
|
||||
GL11.glRotated(hood[0], 1, 0, 0);
|
||||
GL11.glTranslated(0, -0.4375, 2.875);
|
||||
ResourceManager.sexy.renderPart("Hood");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0, 0.46875, -6.875);
|
||||
GL11.glRotated(lever[2] * 60, 1, 0, 0);
|
||||
GL11.glTranslated(0, -0.46875, 6.875);
|
||||
ResourceManager.sexy.renderPart("Lever");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0, 0, -6.75);
|
||||
GL11.glScaled(1, 1, 1 - lever[2] * 0.25);
|
||||
GL11.glTranslated(0, 0, 6.75);
|
||||
ResourceManager.sexy.renderPart("LockSpring");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(mag[0], mag[1], mag[2]);
|
||||
GL11.glTranslated(0, -1, 0);
|
||||
GL11.glRotated(magRot[2], 0, 0, 1);
|
||||
GL11.glTranslated(0, 1, 0);
|
||||
ResourceManager.sexy.renderPart("Magazine");
|
||||
|
||||
double p = 0.0625D;
|
||||
double x = p * 17;
|
||||
double y = p * -26;
|
||||
double angle = 0;
|
||||
Vec3NT vec = new Vec3NT(0, 0.4375, 0); // reusable, just like how toilet paper was reusable during corona
|
||||
|
||||
// basically what all this does is take an array of angles and just strings together shells with the appropriate
|
||||
// position and angle calculated out of the next angle, taking all previous transformations into account.
|
||||
// has a second array which is the "open" position that the animation can smoothly interpolate through
|
||||
double[] anglesLoaded = new double[] {0, 0, 20, 20, 50, 60, 70};
|
||||
double[] anglesUnloaded = new double[] {0, -10, -50, -60, -60, 0, 0};
|
||||
double reloadProgress = !reloading ? 1D : belt[0];
|
||||
double cycleProgress = !doesCycle ? 1 : cycle[0];
|
||||
|
||||
double[][] shells = new double[anglesLoaded.length][3];
|
||||
|
||||
// generate belt, interp used for the reload animation
|
||||
for(int i = 0; i < anglesLoaded.length; i++) {
|
||||
shells[i][0] = x;
|
||||
shells[i][1] = y;
|
||||
shells[i][2] = angle - 90;
|
||||
double delta = BobMathUtil.interp(anglesUnloaded[i], anglesLoaded[i], reloadProgress);
|
||||
angle += delta;
|
||||
vec.rotateAroundZDeg(-delta);
|
||||
x += vec.xCoord;
|
||||
y += vec.yCoord;
|
||||
}
|
||||
|
||||
int shellAmount = useShellCount ? (int) shellCount[0] : gun.getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack, null);
|
||||
|
||||
// draw belt, interp used for cycling (shells will transform towards the position/rotation of the next shell)
|
||||
for(int i = 0; i < shells.length - 1; i++) {
|
||||
double[] prevShell = shells[i];
|
||||
double[] nextShell = shells[i + 1];
|
||||
renderShell(prevShell[0], nextShell[0], prevShell[1], nextShell[1], prevShell[2], nextShell[2], shells.length - i < shellAmount + 2, cycleProgress);
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0, 0, 8);
|
||||
GL11.glRotated(90, 0, 1, 0);
|
||||
GL11.glRotated(90 * gun.shotRand, 1, 0, 0);
|
||||
this.renderMuzzleFlash(gun.lastShot[0], 150, 7.5);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupThirdPerson(ItemStack stack) {
|
||||
super.setupThirdPerson(stack);
|
||||
double scale = 1.75D;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(1, 1, 6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupInv(ItemStack stack) {
|
||||
super.setupInv(stack);
|
||||
double scale = 1.375D;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glRotated(25, 1, 0, 0);
|
||||
GL11.glRotated(45, 0, 1, 0);
|
||||
GL11.glTranslated(0, 0.5, 0.25);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupModTable(ItemStack stack) {
|
||||
double scale = -9.5D;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glRotated(90, 0, 1, 0);
|
||||
GL11.glTranslated(0, 0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderOther(ItemStack stack, ItemRenderType type) {
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.sexy_tex);
|
||||
ResourceManager.sexy.renderPart("Gun");
|
||||
ResourceManager.sexy.renderPart("Barrel");
|
||||
ResourceManager.sexy.renderPart("RecoilSpring");
|
||||
ResourceManager.sexy.renderPart("Hood");
|
||||
ResourceManager.sexy.renderPart("Lever");
|
||||
ResourceManager.sexy.renderPart("LockSpring");
|
||||
ResourceManager.sexy.renderPart("Magazine");
|
||||
|
||||
double p = 0.0625D;
|
||||
renderShell(p * 0, p * -6, 90, true);
|
||||
renderShell(p * 5, p * 1, 30, true);
|
||||
renderShell(p * 12, p * -1, -30, true);
|
||||
renderShell(p * 17, p * -6, -60, true);
|
||||
renderShell(p * 17, p * -13, -90, true);
|
||||
renderShell(p * 17, p * -20, -90, true);
|
||||
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
}
|
||||
|
||||
public static void renderShell(double x0, double x1, double y0, double y1, double rot0, double rot1, boolean shell, double interp) {
|
||||
renderShell(BobMathUtil.interp(x0, x1, interp), BobMathUtil.interp(y0, y1, interp), BobMathUtil.interp(rot0, rot1, interp), shell);
|
||||
}
|
||||
|
||||
public static void renderShell(double x, double y, double rot, boolean shell) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x, 0.375 + y, 0);
|
||||
GL11.glRotated(rot, 0, 0, 1);
|
||||
GL11.glTranslated(0, -0.375, 0);
|
||||
ResourceManager.sexy.renderPart("Belt");
|
||||
if(shell) ResourceManager.sexy.renderPart("Shell");
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@ -344,6 +344,7 @@ public abstract class ItemRenderWeaponBase implements IItemRenderer {
|
||||
if(System.currentTimeMillis() - lastShot < flash) {
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
|
||||
GL11.glDepthMask(false);
|
||||
GL11.glPushMatrix();
|
||||
|
||||
double fire = (System.currentTimeMillis() - lastShot) / (double) flash;
|
||||
@ -379,6 +380,7 @@ public abstract class ItemRenderWeaponBase implements IItemRenderer {
|
||||
|
||||
tess.draw();
|
||||
GL11.glPopMatrix();
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,83 @@
|
||||
package com.hbm.render.tileentity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.render.item.ItemRenderBase;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineChemicalFactory;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
public class RenderChemicalFactory extends TileEntitySpecialRenderer implements IItemRendererProvider {
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float interp) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5, y, z + 0.5);
|
||||
GL11.glRotated(90, 0, 1, 0);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
|
||||
switch(tileEntity.getBlockMetadata() - BlockDummyable.offset) {
|
||||
case 2: GL11.glRotatef(0, 0F, 1F, 0F); break;
|
||||
case 4: GL11.glRotatef(90, 0F, 1F, 0F); break;
|
||||
case 3: GL11.glRotatef(180, 0F, 1F, 0F); break;
|
||||
case 5: GL11.glRotatef(270, 0F, 1F, 0F); break;
|
||||
}
|
||||
|
||||
TileEntityMachineChemicalFactory chemplant = (TileEntityMachineChemicalFactory) tileEntity;
|
||||
float anim = chemplant.prevAnim + (chemplant.anim - chemplant.prevAnim) * interp;
|
||||
|
||||
bindTexture(ResourceManager.chemical_factory_tex);
|
||||
ResourceManager.chemical_factory.renderPart("Base");
|
||||
if(chemplant.frame) ResourceManager.chemical_factory.renderPart("Frame");
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(1, 0, 0);
|
||||
GL11.glRotated(-anim * 45 % 360D, 0, 1, 0);
|
||||
GL11.glTranslated(-1, 0, 0);
|
||||
ResourceManager.chemical_factory.renderPart("Fan1");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(-1, 0, 0);
|
||||
GL11.glRotated(-anim * 45 % 360D, 0, 1, 0);
|
||||
GL11.glTranslated(1, 0, 0);
|
||||
ResourceManager.chemical_factory.renderPart("Fan2");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemForRenderer() {
|
||||
return Item.getItemFromBlock(ModBlocks.machine_chemical_factory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemRenderer getRenderer() {
|
||||
|
||||
return new ItemRenderBase() {
|
||||
|
||||
public void renderInventory() {
|
||||
GL11.glTranslated(0, -1.5, 0);
|
||||
GL11.glScaled(3, 3, 3);
|
||||
}
|
||||
public void renderCommonWithStack(ItemStack item) {
|
||||
GL11.glScaled(0.75, 0.75, 0.75);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
bindTexture(ResourceManager.chemical_factory_tex);
|
||||
ResourceManager.chemical_factory.renderPart("Base");
|
||||
ResourceManager.chemical_factory.renderPart("Frame");
|
||||
ResourceManager.chemical_factory.renderPart("Fan1");
|
||||
ResourceManager.chemical_factory.renderPart("Fan2");
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
}};
|
||||
}
|
||||
}
|
||||
@ -2,6 +2,7 @@ package com.hbm.render.tileentity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.render.util.RenderDecoItem;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineEPress;
|
||||
@ -28,7 +29,7 @@ public class RenderEPress extends TileEntitySpecialRenderer {
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glRotatef(180, 0F, 1F, 0F);
|
||||
|
||||
switch(tileentity.getBlockMetadata()) {
|
||||
switch(tileentity.getBlockMetadata() - BlockDummyable.offset) {
|
||||
case 2: GL11.glRotatef(270, 0F, 1F, 0F); break;
|
||||
case 4: GL11.glRotatef(0, 0F, 1F, 0F); break;
|
||||
case 3: GL11.glRotatef(90, 0F, 1F, 0F); break;
|
||||
@ -50,7 +51,7 @@ public class RenderEPress extends TileEntitySpecialRenderer {
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glRotatef(180, 0F, 1F, 0F);
|
||||
|
||||
switch(tileentity.getBlockMetadata()) {
|
||||
switch(tileentity.getBlockMetadata() - BlockDummyable.offset) {
|
||||
case 2: GL11.glRotatef(270, 0F, 1F, 0F); break;
|
||||
case 4: GL11.glRotatef(0, 0F, 1F, 0F); break;
|
||||
case 3: GL11.glRotatef(90, 0F, 1F, 0F); break;
|
||||
@ -78,7 +79,7 @@ public class RenderEPress extends TileEntitySpecialRenderer {
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glRotatef(180, 0F, 1F, 0F);
|
||||
|
||||
switch(tileentity.getBlockMetadata()) {
|
||||
switch(tileentity.getBlockMetadata() - BlockDummyable.offset) {
|
||||
case 2:
|
||||
GL11.glRotatef(270, 0F, 1F, 0F); break;
|
||||
case 4:
|
||||
|
||||
@ -83,7 +83,7 @@ public class RenderFluidTank extends TileEntitySpecialRenderer implements IItemR
|
||||
|
||||
public String getTextureFromType(FluidType type) {
|
||||
|
||||
if(type.customFluid) {
|
||||
if(type.renderWithTint) {
|
||||
int color = type.getTint();
|
||||
double r = ((color & 0xff0000) >> 16) / 255D;
|
||||
double g = ((color & 0x00ff00) >> 8) / 255D;
|
||||
|
||||
@ -35,11 +35,8 @@ public class RendererObjTester extends TileEntitySpecialRenderer {
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5, y + 1, z + 0.5);
|
||||
GL11.glRotated(15, 0, 0, 1);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
|
||||
GL11.glRotated(System.currentTimeMillis() / 5D % 360D, 0, -1, 0);
|
||||
|
||||
if(world == null) {
|
||||
world = new WorldInAJar(5, 3, 5);
|
||||
for(int i = 0; i < 25; i++) world.setBlock(i / 5, 1, i % 5, Blocks.brick_block, 0);
|
||||
@ -55,6 +52,8 @@ public class RendererObjTester extends TileEntitySpecialRenderer {
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotated(15, 0, 0, 1);
|
||||
GL11.glRotated(System.currentTimeMillis() / 5D % 360D, 0, -1, 0);
|
||||
GL11.glTranslated(-2.5, 0, -2.5);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
@ -73,6 +72,10 @@ public class RendererObjTester extends TileEntitySpecialRenderer {
|
||||
GL11.glPopMatrix();
|
||||
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
|
||||
GL11.glRotated(15, 0, 0, 1);
|
||||
GL11.glRotated(System.currentTimeMillis() / 5D % 360D, 0, -1, 0);
|
||||
|
||||
GL11.glTranslated(0, 2.1, 0.5);
|
||||
|
||||
this.bindTexture(extra);
|
||||
|
||||
@ -25,6 +25,7 @@ public interface IUpgradeInfoProvider {
|
||||
public static final String KEY_CONSUMPTION = "upgrade.consumption";
|
||||
public static final String KEY_COOLANT_CONSUMPTION = "upgrade.coolantConsumption";
|
||||
public static final String KEY_DELAY = "upgrade.delay";
|
||||
public static final String KEY_SPEED = "upgrade.speed";
|
||||
public static final String KEY_EFFICIENCY = "upgrade.efficiency";
|
||||
public static final String KEY_PRODUCTIVITY = "upgrade.productivity";
|
||||
public static final String KEY_FORTUNE = "upgrade.fortune";
|
||||
|
||||
@ -75,15 +75,18 @@ public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergy
|
||||
return this;
|
||||
}
|
||||
|
||||
//fewer messy recursive operations
|
||||
public TileEntity getTile() {
|
||||
|
||||
/** Returns the actual tile entity that represents the core. Only for internal use. */
|
||||
protected TileEntity getTile() {
|
||||
if(tile == null || tile.isInvalid()) {
|
||||
tile = this.getTE();
|
||||
}
|
||||
|
||||
return tile;
|
||||
}
|
||||
|
||||
/** Returns the core tile entity, or a delegate object. */
|
||||
protected Object getCoreObject() {
|
||||
return getTile();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPower(long i) {
|
||||
@ -91,8 +94,8 @@ public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergy
|
||||
if(!power)
|
||||
return;
|
||||
|
||||
if(getTile() instanceof IEnergyReceiverMK2) {
|
||||
((IEnergyReceiverMK2)getTile()).setPower(i);
|
||||
if(getCoreObject() instanceof IEnergyReceiverMK2) {
|
||||
((IEnergyReceiverMK2)getCoreObject()).setPower(i);
|
||||
}
|
||||
}
|
||||
|
||||
@ -102,8 +105,8 @@ public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergy
|
||||
if(!power)
|
||||
return 0;
|
||||
|
||||
if(getTile() instanceof IEnergyReceiverMK2) {
|
||||
return ((IEnergyReceiverMK2)getTile()).getPower();
|
||||
if(getCoreObject() instanceof IEnergyReceiverMK2) {
|
||||
return ((IEnergyReceiverMK2)getCoreObject()).getPower();
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -115,8 +118,8 @@ public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergy
|
||||
if(!power)
|
||||
return 0;
|
||||
|
||||
if(getTile() instanceof IEnergyReceiverMK2) {
|
||||
return ((IEnergyReceiverMK2)getTile()).getMaxPower();
|
||||
if(getCoreObject() instanceof IEnergyReceiverMK2) {
|
||||
return ((IEnergyReceiverMK2)getCoreObject()).getMaxPower();
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -128,8 +131,8 @@ public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergy
|
||||
if(!this.power)
|
||||
return power;
|
||||
|
||||
if(getTile() instanceof IEnergyReceiverMK2) {
|
||||
return ((IEnergyReceiverMK2)getTile()).transferPower(power);
|
||||
if(getCoreObject() instanceof IEnergyReceiverMK2) {
|
||||
return ((IEnergyReceiverMK2)getCoreObject()).transferPower(power);
|
||||
}
|
||||
|
||||
return power;
|
||||
@ -141,8 +144,8 @@ public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergy
|
||||
if(!power)
|
||||
return false;
|
||||
|
||||
if(getTile() instanceof IEnergyReceiverMK2) {
|
||||
return ((IEnergyReceiverMK2)getTile()).canConnect(dir);
|
||||
if(getCoreObject() instanceof IEnergyReceiverMK2) {
|
||||
return ((IEnergyReceiverMK2)getCoreObject()).canConnect(dir);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -154,8 +157,8 @@ public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergy
|
||||
public FluidTank[] getAllTanks() {
|
||||
if(!fluid) return EMPTY_TANKS;
|
||||
|
||||
if(getTile() instanceof IFluidReceiverMK2) {
|
||||
return ((IFluidReceiverMK2)getTile()).getAllTanks();
|
||||
if(getCoreObject() instanceof IFluidReceiverMK2) {
|
||||
return ((IFluidReceiverMK2)getCoreObject()).getAllTanks();
|
||||
}
|
||||
|
||||
return EMPTY_TANKS;
|
||||
@ -165,8 +168,8 @@ public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergy
|
||||
public long transferFluid(FluidType type, int pressure, long amount) {
|
||||
if(!fluid) return amount;
|
||||
|
||||
if(getTile() instanceof IFluidReceiverMK2) {
|
||||
return ((IFluidReceiverMK2)getTile()).transferFluid(type, pressure, amount);
|
||||
if(getCoreObject() instanceof IFluidReceiverMK2) {
|
||||
return ((IFluidReceiverMK2)getCoreObject()).transferFluid(type, pressure, amount);
|
||||
}
|
||||
|
||||
return amount;
|
||||
@ -176,8 +179,8 @@ public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergy
|
||||
public long getDemand(FluidType type, int pressure) {
|
||||
if(!fluid) return 0;
|
||||
|
||||
if(getTile() instanceof IFluidReceiverMK2) {
|
||||
return ((IFluidReceiverMK2)getTile()).getDemand(type, pressure);
|
||||
if(getCoreObject() instanceof IFluidReceiverMK2) {
|
||||
return ((IFluidReceiverMK2)getCoreObject()).getDemand(type, pressure);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -189,8 +192,8 @@ public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergy
|
||||
if(!this.fluid)
|
||||
return false;
|
||||
|
||||
if(getTile() instanceof IFluidConnectorMK2) {
|
||||
return ((IFluidConnectorMK2) getTile()).canConnect(type, dir);
|
||||
if(getCoreObject() instanceof IFluidConnectorMK2) {
|
||||
return ((IFluidConnectorMK2) getCoreObject()).canConnect(type, dir);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -201,8 +204,8 @@ public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergy
|
||||
if(!inventory)
|
||||
return 0;
|
||||
|
||||
if(getTile() instanceof ISidedInventory) {
|
||||
return ((ISidedInventory)getTile()).getSizeInventory();
|
||||
if(getCoreObject() instanceof ISidedInventory) {
|
||||
return ((ISidedInventory)getCoreObject()).getSizeInventory();
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -214,8 +217,8 @@ public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergy
|
||||
if(!inventory)
|
||||
return null;
|
||||
|
||||
if(getTile() instanceof ISidedInventory) {
|
||||
return ((ISidedInventory)getTile()).getStackInSlot(slot);
|
||||
if(getCoreObject() instanceof ISidedInventory) {
|
||||
return ((ISidedInventory)getCoreObject()).getStackInSlot(slot);
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -224,8 +227,8 @@ public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergy
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j) {
|
||||
|
||||
if(getTile() instanceof ISidedInventory) {
|
||||
return ((ISidedInventory)getTile()).decrStackSize(i, j);
|
||||
if(getCoreObject() instanceof ISidedInventory) {
|
||||
return ((ISidedInventory)getCoreObject()).decrStackSize(i, j);
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -237,8 +240,8 @@ public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergy
|
||||
if(!inventory)
|
||||
return null;
|
||||
|
||||
if(getTile() instanceof ISidedInventory) {
|
||||
return ((ISidedInventory)getTile()).getStackInSlotOnClosing(slot);
|
||||
if(getCoreObject() instanceof ISidedInventory) {
|
||||
return ((ISidedInventory)getCoreObject()).getStackInSlotOnClosing(slot);
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -250,8 +253,8 @@ public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergy
|
||||
if(!inventory)
|
||||
return;
|
||||
|
||||
if(getTile() instanceof ISidedInventory) {
|
||||
((ISidedInventory)getTile()).setInventorySlotContents(slot, stack);
|
||||
if(getCoreObject() instanceof ISidedInventory) {
|
||||
((ISidedInventory)getCoreObject()).setInventorySlotContents(slot, stack);
|
||||
}
|
||||
}
|
||||
|
||||
@ -261,8 +264,8 @@ public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergy
|
||||
if(!inventory)
|
||||
return null;
|
||||
|
||||
if(getTile() instanceof ISidedInventory) {
|
||||
return ((ISidedInventory)getTile()).getInventoryName();
|
||||
if(getCoreObject() instanceof ISidedInventory) {
|
||||
return ((ISidedInventory)getCoreObject()).getInventoryName();
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -274,8 +277,8 @@ public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergy
|
||||
if(!inventory)
|
||||
return false;
|
||||
|
||||
if(getTile() instanceof ISidedInventory) {
|
||||
return ((ISidedInventory)getTile()).hasCustomInventoryName();
|
||||
if(getCoreObject() instanceof ISidedInventory) {
|
||||
return ((ISidedInventory)getCoreObject()).hasCustomInventoryName();
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -287,8 +290,8 @@ public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergy
|
||||
if(!inventory)
|
||||
return 0;
|
||||
|
||||
if(getTile() instanceof ISidedInventory) {
|
||||
return ((ISidedInventory)getTile()).getInventoryStackLimit();
|
||||
if(getCoreObject() instanceof ISidedInventory) {
|
||||
return ((ISidedInventory)getCoreObject()).getInventoryStackLimit();
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -300,8 +303,8 @@ public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergy
|
||||
if(!inventory)
|
||||
return false;
|
||||
|
||||
if(getTile() instanceof ISidedInventory) {
|
||||
return ((ISidedInventory)getTile()).isUseableByPlayer(player);
|
||||
if(getCoreObject() instanceof ISidedInventory) {
|
||||
return ((ISidedInventory)getCoreObject()).isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -313,8 +316,8 @@ public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergy
|
||||
if(!inventory)
|
||||
return;
|
||||
|
||||
if(getTile() instanceof ISidedInventory) {
|
||||
((ISidedInventory)getTile()).openInventory();
|
||||
if(getCoreObject() instanceof ISidedInventory) {
|
||||
((ISidedInventory)getCoreObject()).openInventory();
|
||||
}
|
||||
}
|
||||
|
||||
@ -324,8 +327,8 @@ public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergy
|
||||
if(!inventory)
|
||||
return;
|
||||
|
||||
if(getTile() instanceof ISidedInventory) {
|
||||
((ISidedInventory)getTile()).closeInventory();
|
||||
if(getCoreObject() instanceof ISidedInventory) {
|
||||
((ISidedInventory)getCoreObject()).closeInventory();
|
||||
}
|
||||
}
|
||||
|
||||
@ -335,11 +338,11 @@ public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergy
|
||||
if(!inventory)
|
||||
return false;
|
||||
|
||||
if(getTile() instanceof ISidedInventory) {
|
||||
if(getCoreObject() instanceof ISidedInventory) {
|
||||
|
||||
if(getTile() instanceof IConditionalInvAccess) return ((IConditionalInvAccess) getTile()).isItemValidForSlot(xCoord, yCoord, zCoord, slot, stack);
|
||||
if(getCoreObject() instanceof IConditionalInvAccess) return ((IConditionalInvAccess) getCoreObject()).isItemValidForSlot(xCoord, yCoord, zCoord, slot, stack);
|
||||
|
||||
return ((ISidedInventory)getTile()).isItemValidForSlot(slot, stack);
|
||||
return ((ISidedInventory)getCoreObject()).isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -351,11 +354,11 @@ public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergy
|
||||
if(!inventory)
|
||||
return new int[0];
|
||||
|
||||
if(getTile() instanceof ISidedInventory) {
|
||||
if(getCoreObject() instanceof ISidedInventory) {
|
||||
|
||||
if(getTile() instanceof IConditionalInvAccess) return ((IConditionalInvAccess) getTile()).getAccessibleSlotsFromSide(xCoord, yCoord, zCoord, side);
|
||||
if(getCoreObject() instanceof IConditionalInvAccess) return ((IConditionalInvAccess) getCoreObject()).getAccessibleSlotsFromSide(xCoord, yCoord, zCoord, side);
|
||||
|
||||
return ((ISidedInventory)getTile()).getAccessibleSlotsFromSide(side);
|
||||
return ((ISidedInventory)getCoreObject()).getAccessibleSlotsFromSide(side);
|
||||
}
|
||||
|
||||
return new int[0];
|
||||
@ -367,11 +370,11 @@ public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergy
|
||||
if(!inventory)
|
||||
return false;
|
||||
|
||||
if(getTile() instanceof ISidedInventory) {
|
||||
if(getCoreObject() instanceof ISidedInventory) {
|
||||
|
||||
if(getTile() instanceof IConditionalInvAccess) return ((IConditionalInvAccess) getTile()).canInsertItem(xCoord, yCoord, zCoord, i, stack, j);
|
||||
if(getCoreObject() instanceof IConditionalInvAccess) return ((IConditionalInvAccess) getCoreObject()).canInsertItem(xCoord, yCoord, zCoord, i, stack, j);
|
||||
|
||||
return ((ISidedInventory)getTile()).canInsertItem(i, stack, j);
|
||||
return ((ISidedInventory)getCoreObject()).canInsertItem(i, stack, j);
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -383,11 +386,11 @@ public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergy
|
||||
if(!inventory)
|
||||
return false;
|
||||
|
||||
if(getTile() instanceof ISidedInventory) {
|
||||
if(getCoreObject() instanceof ISidedInventory) {
|
||||
|
||||
if(getTile() instanceof IConditionalInvAccess) return ((IConditionalInvAccess) getTile()).canExtractItem(xCoord, yCoord, zCoord, i, stack, j);
|
||||
if(getCoreObject() instanceof IConditionalInvAccess) return ((IConditionalInvAccess) getCoreObject()).canExtractItem(xCoord, yCoord, zCoord, i, stack, j);
|
||||
|
||||
return ((ISidedInventory)getTile()).canExtractItem(i, stack, j);
|
||||
return ((ISidedInventory)getCoreObject()).canExtractItem(i, stack, j);
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -426,8 +429,8 @@ public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergy
|
||||
if(!this.heat)
|
||||
return 0;
|
||||
|
||||
if(getTile() instanceof IHeatSource) {
|
||||
return ((IHeatSource)getTile()).getHeatStored();
|
||||
if(getCoreObject() instanceof IHeatSource) {
|
||||
return ((IHeatSource)getCoreObject()).getHeatStored();
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -439,39 +442,39 @@ public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergy
|
||||
if(!this.heat)
|
||||
return;
|
||||
|
||||
if(getTile() instanceof IHeatSource) {
|
||||
((IHeatSource)getTile()).useUpHeat(heat);
|
||||
if(getCoreObject() instanceof IHeatSource) {
|
||||
((IHeatSource)getCoreObject()).useUpHeat(heat);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptPartialPour(World world, int x, int y, int z, double dX, double dY, double dZ, ForgeDirection side, Mats.MaterialStack stack) {
|
||||
if(this.moltenMetal && getTile() instanceof ICrucibleAcceptor){
|
||||
return ((ICrucibleAcceptor)getTile()).canAcceptPartialPour(world, x, y, z, dX, dY, dZ, side, stack);
|
||||
if(this.moltenMetal && getCoreObject() instanceof ICrucibleAcceptor){
|
||||
return ((ICrucibleAcceptor)getCoreObject()).canAcceptPartialPour(world, x, y, z, dX, dY, dZ, side, stack);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mats.MaterialStack pour(World world, int x, int y, int z, double dX, double dY, double dZ, ForgeDirection side, Mats.MaterialStack stack) {
|
||||
if(this.moltenMetal && getTile() instanceof ICrucibleAcceptor){
|
||||
return ((ICrucibleAcceptor)getTile()).pour(world, x, y, z, dX, dY, dZ, side, stack);
|
||||
if(this.moltenMetal && getCoreObject() instanceof ICrucibleAcceptor){
|
||||
return ((ICrucibleAcceptor)getCoreObject()).pour(world, x, y, z, dX, dY, dZ, side, stack);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptPartialFlow(World world, int x, int y, int z, ForgeDirection side, Mats.MaterialStack stack) {
|
||||
if(this.moltenMetal && getTile() instanceof ICrucibleAcceptor){
|
||||
return ((ICrucibleAcceptor)getTile()).canAcceptPartialFlow(world, x, y, z, side, stack);
|
||||
if(this.moltenMetal && getCoreObject() instanceof ICrucibleAcceptor){
|
||||
return ((ICrucibleAcceptor)getCoreObject()).canAcceptPartialFlow(world, x, y, z, side, stack);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mats.MaterialStack flow(World world, int x, int y, int z, ForgeDirection side, Mats.MaterialStack stack) {
|
||||
if(this.moltenMetal && getTile() instanceof ICrucibleAcceptor){
|
||||
return ((ICrucibleAcceptor)getTile()).flow(world, x, y, z, side, stack);
|
||||
if(this.moltenMetal && getCoreObject() instanceof ICrucibleAcceptor){
|
||||
return ((ICrucibleAcceptor)getCoreObject()).flow(world, x, y, z, side, stack);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -481,9 +484,9 @@ public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergy
|
||||
public String getComponentName() {
|
||||
if(this.worldObj == null) // OC is going too fast, grab from NBT!
|
||||
return componentName;
|
||||
if(this.getTile() instanceof OCComponent) {
|
||||
if(this.getCoreObject() instanceof OCComponent) {
|
||||
if (componentName == null || componentName.equals(OCComponent.super.getComponentName())) {
|
||||
componentName = ((OCComponent) this.getTile()).getComponentName();
|
||||
componentName = ((OCComponent) this.getCoreObject()).getComponentName();
|
||||
}
|
||||
return componentName;
|
||||
}
|
||||
@ -493,44 +496,44 @@ public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergy
|
||||
@Override
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public boolean canConnectNode(ForgeDirection side) {
|
||||
if(this.getTile() instanceof OCComponent)
|
||||
if(this.getCoreObject() instanceof OCComponent)
|
||||
return (this.getBlockMetadata() >= 6 && this.getBlockMetadata() <= 11)
|
||||
&& (power || fluid) &&
|
||||
((OCComponent) this.getTile()).canConnectNode(side);
|
||||
((OCComponent) this.getCoreObject()).canConnectNode(side);
|
||||
return OCComponent.super.canConnectNode(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public String[] methods() {
|
||||
if(this.getTile() instanceof OCComponent)
|
||||
return ((OCComponent) this.getTile()).methods();
|
||||
if(this.getCoreObject() instanceof OCComponent)
|
||||
return ((OCComponent) this.getCoreObject()).methods();
|
||||
return OCComponent.super.methods();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] invoke(String method, Context context, Arguments args) throws Exception {
|
||||
if(this.getTile() instanceof OCComponent)
|
||||
return ((OCComponent) this.getTile()).invoke(method, context, args);
|
||||
if(this.getCoreObject() instanceof OCComponent)
|
||||
return ((OCComponent) this.getCoreObject()).invoke(method, context, args);
|
||||
return OCComponent.super.invoke(null, null, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getFunctionInfo() {
|
||||
if(getTile() instanceof IRORInfo) return ((IRORInfo) getTile()).getFunctionInfo();
|
||||
if(getCoreObject() instanceof IRORInfo) return ((IRORInfo) getCoreObject()).getFunctionInfo();
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String provideRORValue(String name) {
|
||||
if(getTile() instanceof IRORValueProvider) return ((IRORValueProvider) getTile()).provideRORValue(name);
|
||||
if(getCoreObject() instanceof IRORValueProvider) return ((IRORValueProvider) getCoreObject()).provideRORValue(name);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String runRORFunction(String name, String[] params) {
|
||||
if(getTile() instanceof IRORInteractive) return ((IRORInteractive) getTile()).runRORFunction(name, params);
|
||||
if(getCoreObject() instanceof IRORInteractive) return ((IRORInteractive) getCoreObject()).runRORFunction(name, params);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
24
src/main/java/com/hbm/tileentity/TileEntityProxyDyn.java
Normal file
24
src/main/java/com/hbm/tileentity/TileEntityProxyDyn.java
Normal file
@ -0,0 +1,24 @@
|
||||
package com.hbm.tileentity;
|
||||
|
||||
public class TileEntityProxyDyn extends TileEntityProxyCombo {
|
||||
|
||||
@Override
|
||||
public Object getCoreObject() {
|
||||
|
||||
Object o = super.getCoreObject();
|
||||
|
||||
if(o instanceof IProxyDelegateProvider) {
|
||||
Object delegate = ((IProxyDelegateProvider) o).getDelegateForPosition(xCoord, yCoord, zCoord);
|
||||
if(delegate != null) return delegate;
|
||||
}
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
/** Based on the position of the proxy, produces a delegate instead of returning the core tile entity. God this fucking sucks. */
|
||||
public static interface IProxyDelegateProvider {
|
||||
|
||||
/** Returns the delegate based on the proxy's position. Retunring NULL skips the delegate and reverts back to original core behavior */
|
||||
public Object getDelegateForPosition(int x, int y, int z);
|
||||
}
|
||||
}
|
||||
@ -35,6 +35,7 @@ import com.hbm.blocks.network.CableDiode.TileEntityDiode;
|
||||
import com.hbm.blocks.network.CranePartitioner.TileEntityCranePartitioner;
|
||||
import com.hbm.blocks.network.FluidDuctGauge.TileEntityPipeGauge;
|
||||
import com.hbm.blocks.network.FluidDuctPaintable.TileEntityPipePaintable;
|
||||
import com.hbm.blocks.network.FluidDuctPaintableBlockExhaust.TileEntityPipeExhaustPaintable;
|
||||
import com.hbm.blocks.network.FluidPump.TileEntityFluidPump;
|
||||
import com.hbm.blocks.rail.RailStandardSwitch.TileEntityRailSwitch;
|
||||
import com.hbm.tileentity.bomb.*;
|
||||
@ -222,6 +223,7 @@ public class TileMappings {
|
||||
put(TileEntityProxyInventory.class, "tileentity_proxy_inventory");
|
||||
put(TileEntityProxyEnergy.class, "tileentity_proxy_power");
|
||||
put(TileEntityProxyCombo.class, "tileentity_proxy_combo");
|
||||
put(TileEntityProxyDyn.class, "tileentity_proxy_dyn");
|
||||
put(TileEntityProxyConductor.class, "tileentity_proxy_conductor");
|
||||
|
||||
put(TileEntityBedrockOre.class, "tileentity_bedrock_ore");
|
||||
@ -342,6 +344,7 @@ public class TileMappings {
|
||||
put(TileEntityMachineChemplant.class, "tileentity_chemical_plant");
|
||||
put(TileEntityMachineChemicalPlant.class, "tileentity_chemicalplant");
|
||||
put(TileEntityMachineChemfac.class, "tileentity_chemfac");
|
||||
put(TileEntityMachineChemicalFactory.class, "tileentity_chemicalfactory");
|
||||
|
||||
put(TileEntityMachineOilWell.class, "tileentity_derrick");
|
||||
put(TileEntityMachinePumpjack.class, "tileentity_machine_pumpjack");
|
||||
@ -410,6 +413,7 @@ public class TileMappings {
|
||||
put(TileEntityPipePaintable.class, "tileentity_pipe_paintable");
|
||||
put(TileEntityPipeGauge.class, "tileentity_pipe_gauge");
|
||||
put(TileEntityPipeExhaust.class, "tileentity_pipe_exhaust");
|
||||
put(TileEntityPipeExhaustPaintable.class, "tileentity_pipe_exhaust_paintable");
|
||||
put(TileEntityFluidValve.class, "tileentity_pipe_valve");
|
||||
put(TileEntityFluidPump.class, "tileentity_pipe_pump");
|
||||
|
||||
|
||||
@ -556,7 +556,6 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyRe
|
||||
for(int c = z - dZ * 2; c <= z + dZ * 2;c++) {
|
||||
|
||||
Block block = worldObj.getBlock(a, b, c);
|
||||
int meta = worldObj.getBlockMetadata(a, b, c);
|
||||
|
||||
/** ignore the center for now */
|
||||
if(a == x && b == y && c == z) {
|
||||
|
||||
@ -33,6 +33,7 @@ import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@Deprecated
|
||||
public class TileEntityMachineChemfac extends TileEntityMachineChemplantBase implements IUpgradeInfoProvider, IFluidCopiable {
|
||||
|
||||
float rotSpeed;
|
||||
|
||||
@ -0,0 +1,433 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.interfaces.IControlReceiver;
|
||||
import com.hbm.inventory.UpgradeManagerNT;
|
||||
import com.hbm.inventory.container.ContainerMachineChemicalFactory;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.inventory.gui.GUIMachineChemicalFactory;
|
||||
import com.hbm.items.machine.ItemMachineUpgrade;
|
||||
import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.module.ModuleMachineChemplant;
|
||||
import com.hbm.sound.AudioWrapper;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.IUpgradeInfoProvider;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.tileentity.TileEntityProxyDyn.IProxyDelegateProvider;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||
import api.hbm.fluidmk2.IFluidStandardTransceiverMK2;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineChemicalFactory extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardTransceiverMK2, IUpgradeInfoProvider, IControlReceiver, IGUIProvider, IProxyDelegateProvider {
|
||||
|
||||
public FluidTank[] allTanks;
|
||||
public FluidTank[] inputTanks;
|
||||
public FluidTank[] outputTanks;
|
||||
|
||||
public FluidTank water;
|
||||
public FluidTank lps;
|
||||
|
||||
public long power;
|
||||
public long maxPower = 10_000_000;
|
||||
public boolean[] didProcess = new boolean[4];
|
||||
|
||||
public boolean frame = false;
|
||||
public int anim;
|
||||
public int prevAnim;
|
||||
private AudioWrapper audio;
|
||||
|
||||
public ModuleMachineChemplant[] chemplantModule;
|
||||
public UpgradeManagerNT upgradeManager = new UpgradeManagerNT(this);
|
||||
|
||||
protected DelegateChemicalFactoy delegate = new DelegateChemicalFactoy();
|
||||
|
||||
public TileEntityMachineChemicalFactory() {
|
||||
super(32);
|
||||
|
||||
this.inputTanks = new FluidTank[12];
|
||||
this.outputTanks = new FluidTank[12];
|
||||
for(int i = 0; i < 12; i++) {
|
||||
this.inputTanks[i] = new FluidTank(Fluids.NONE, 24_000);
|
||||
this.outputTanks[i] = new FluidTank(Fluids.NONE, 24_000);
|
||||
}
|
||||
|
||||
this.water = new FluidTank(Fluids.WATER, 4_000);
|
||||
this.lps = new FluidTank(Fluids.SPENTSTEAM, 4_000);
|
||||
|
||||
this.allTanks = new FluidTank[this.inputTanks.length + this.outputTanks.length + 2];
|
||||
for(int i = 0; i < inputTanks.length; i++) this.allTanks[i] = this.inputTanks[i];
|
||||
for(int i = 0; i < outputTanks.length; i++) this.allTanks[i + this.inputTanks.length] = this.outputTanks[i];
|
||||
|
||||
this.allTanks[this.allTanks.length - 2] = this.water;
|
||||
this.allTanks[this.allTanks.length - 1] = this.lps;
|
||||
|
||||
this.chemplantModule = new ModuleMachineChemplant[4];
|
||||
for(int i = 0; i < 4; i++) this.chemplantModule[i] = new ModuleMachineChemplant(i, this, slots)
|
||||
.itemInput(5 + i * 7, 6 + i * 7, 7 + i * 7)
|
||||
.itemOutput(8 + i * 7, 9 + i * 7, 10 + i * 7)
|
||||
.fluidInput(inputTanks[0 + i * 3], inputTanks[1 + i * 3], inputTanks[2 + i * 3])
|
||||
.fluidOutput(outputTanks[0 + i * 3], outputTanks[1 + i * 3], outputTanks[2 + i * 3]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int i, ItemStack itemStack, int j) {
|
||||
if(i >= 8 && i <= 10) return true;
|
||||
if(i >= 15 && i <= 17) return true;
|
||||
if(i >= 22 && i <= 24) return true;
|
||||
if(i >= 29 && i <= 31) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack stack) {
|
||||
if(slot == 0) return true; // battery
|
||||
if(slot >= 1 && slot <= 3 && stack.getItem() instanceof ItemMachineUpgrade) return true; // upgrades
|
||||
for(int i = 0; i < 4; i++) if(this.chemplantModule[i].isItemValid(slot, stack)) return true; // recipe input crap
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int side) {
|
||||
return new int[] {
|
||||
5, 6, 7, 8, 9, 10,
|
||||
12, 13, 14, 15, 16, 17,
|
||||
19, 20, 21, 22, 23, 24,
|
||||
26, 27, 28, 29, 30, 31
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "container.machineChemicalFactory";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(maxPower <= 0) this.maxPower = 10_000_000;
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
this.power = Library.chargeTEFromItems(slots, 0, power, maxPower);
|
||||
upgradeManager.checkSlots(slots, 1, 3);
|
||||
|
||||
inputTanks[0].loadTank(10, 13, slots);
|
||||
inputTanks[1].loadTank(11, 14, slots);
|
||||
inputTanks[2].loadTank(12, 15, slots);
|
||||
|
||||
outputTanks[0].unloadTank(16, 19, slots);
|
||||
outputTanks[1].unloadTank(17, 20, slots);
|
||||
outputTanks[2].unloadTank(18, 21, slots);
|
||||
|
||||
for(DirPos pos : getConPos()) {
|
||||
this.trySubscribe(worldObj, pos);
|
||||
for(FluidTank tank : inputTanks) if(tank.getTankType() != Fluids.NONE) this.trySubscribe(tank.getTankType(), worldObj, pos);
|
||||
for(FluidTank tank : outputTanks) if(tank.getFill() > 0) this.tryProvide(tank, worldObj, pos);
|
||||
}
|
||||
|
||||
for(DirPos pos : getCoolPos()) {
|
||||
delegate.trySubscribe(worldObj, pos);
|
||||
delegate.trySubscribe(water.getTankType(), worldObj, pos);
|
||||
delegate.tryProvide(lps, worldObj, pos);
|
||||
}
|
||||
|
||||
double speed = 1D;
|
||||
double pow = 1D;
|
||||
|
||||
speed += Math.min(upgradeManager.getLevel(UpgradeType.SPEED), 3) / 3D;
|
||||
speed += Math.min(upgradeManager.getLevel(UpgradeType.OVERDRIVE), 3);
|
||||
|
||||
pow -= Math.min(upgradeManager.getLevel(UpgradeType.POWER), 3) * 0.25D;
|
||||
pow += Math.min(upgradeManager.getLevel(UpgradeType.SPEED), 3) * 1D;
|
||||
pow += Math.min(upgradeManager.getLevel(UpgradeType.OVERDRIVE), 3) * 10D / 3D;
|
||||
boolean markDirty = false;
|
||||
|
||||
for(int i = 0; i < 4; i++) {
|
||||
this.chemplantModule[i].update(speed * 2D, pow * 2D, canCool());
|
||||
this.didProcess[i] = this.chemplantModule[i].didProcess;
|
||||
markDirty |= this.chemplantModule[i].markDirty;
|
||||
|
||||
if(this.chemplantModule[i].didProcess) {
|
||||
this.water.setFill(this.water.getFill() - 100);
|
||||
this.lps.setFill(this.lps.getFill() + 100);
|
||||
}
|
||||
}
|
||||
|
||||
for(FluidTank in : inputTanks) if(in.getTankType() != Fluids.NONE) for(FluidTank out : outputTanks) { // up to 144 iterations, but most of them are NOP anyway
|
||||
if(out.getTankType() == Fluids.NONE) continue;
|
||||
if(out.getTankType() != in.getTankType()) continue;
|
||||
int toMove = BobMathUtil.min(in.getMaxFill() - in.getFill(), out.getFill(), 50);
|
||||
if(toMove > 0) {
|
||||
in.setFill(in.getFill() + toMove);
|
||||
out.setFill(out.getFill() - toMove);
|
||||
}
|
||||
}
|
||||
|
||||
if(markDirty) this.markDirty();
|
||||
|
||||
this.networkPackNT(100);
|
||||
|
||||
} else {
|
||||
|
||||
this.prevAnim = this.anim;
|
||||
boolean didSomething = didProcess[0] || didProcess[1] || didProcess[2] || didProcess[3];
|
||||
if(didSomething) this.anim++;
|
||||
|
||||
if(worldObj.getTotalWorldTime() % 20 == 0) {
|
||||
frame = !worldObj.getBlock(xCoord, yCoord + 3, zCoord).isAir(worldObj, xCoord, yCoord + 3, zCoord);
|
||||
}
|
||||
|
||||
if(didSomething && MainRegistry.proxy.me().getDistance(xCoord , yCoord, zCoord) < 50) {
|
||||
if(audio == null) {
|
||||
audio = createAudioLoop();
|
||||
audio.startSound();
|
||||
} else if(!audio.isPlaying()) {
|
||||
audio = rebootAudio(audio);
|
||||
}
|
||||
audio.keepAlive();
|
||||
audio.updateVolume(this.getVolume(1F));
|
||||
|
||||
} else {
|
||||
if(audio != null) {
|
||||
audio.stopSound();
|
||||
audio = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override public AudioWrapper createAudioLoop() {
|
||||
return MainRegistry.proxy.getLoopedSound("hbm:block.chemicalPlant", xCoord, yCoord, zCoord, 1F, 15F, 1.0F, 20);
|
||||
}
|
||||
|
||||
@Override public void onChunkUnload() {
|
||||
if(audio != null) { audio.stopSound(); audio = null; }
|
||||
}
|
||||
|
||||
@Override public void invalidate() {
|
||||
super.invalidate();
|
||||
if(audio != null) { audio.stopSound(); audio = null; }
|
||||
}
|
||||
|
||||
public boolean canCool() {
|
||||
return water.getFill() >= 100 && lps.getFill() <= lps.getMaxFill() - 100;
|
||||
}
|
||||
|
||||
public DirPos[] getConPos() {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10);
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
return new DirPos[] {
|
||||
new DirPos(xCoord + 3, yCoord, zCoord - 2, Library.POS_X),
|
||||
new DirPos(xCoord + 3, yCoord, zCoord + 0, Library.POS_X),
|
||||
new DirPos(xCoord + 3, yCoord, zCoord + 2, Library.POS_X),
|
||||
new DirPos(xCoord - 3, yCoord, zCoord - 2, Library.NEG_X),
|
||||
new DirPos(xCoord - 3, yCoord, zCoord + 0, Library.NEG_X),
|
||||
new DirPos(xCoord - 3, yCoord, zCoord + 2, Library.NEG_X),
|
||||
new DirPos(xCoord - 2, yCoord, zCoord + 3, Library.POS_Z),
|
||||
new DirPos(xCoord + 0, yCoord, zCoord + 3, Library.POS_Z),
|
||||
new DirPos(xCoord + 2, yCoord, zCoord + 3, Library.POS_Z),
|
||||
new DirPos(xCoord - 2, yCoord, zCoord - 3, Library.NEG_Z),
|
||||
new DirPos(xCoord + 0, yCoord, zCoord - 3, Library.NEG_Z),
|
||||
new DirPos(xCoord + 2, yCoord, zCoord - 3, Library.NEG_Z),
|
||||
|
||||
new DirPos(xCoord + dir.offsetX * 2 + rot.offsetX * 2, yCoord + 3, zCoord + dir.offsetZ * 2 + rot.offsetZ * 2, Library.POS_Y),
|
||||
new DirPos(xCoord + dir.offsetX * 1 + rot.offsetX * 2, yCoord + 3, zCoord + dir.offsetZ * 1 + rot.offsetZ * 2, Library.POS_Y),
|
||||
new DirPos(xCoord + dir.offsetX * 0 + rot.offsetX * 2, yCoord + 3, zCoord + dir.offsetZ * 0 + rot.offsetZ * 2, Library.POS_Y),
|
||||
new DirPos(xCoord - dir.offsetX * 1 + rot.offsetX * 2, yCoord + 3, zCoord - dir.offsetZ * 1 + rot.offsetZ * 2, Library.POS_Y),
|
||||
new DirPos(xCoord - dir.offsetX * 2 + rot.offsetX * 2, yCoord + 3, zCoord - dir.offsetZ * 2 + rot.offsetZ * 2, Library.POS_Y),
|
||||
new DirPos(xCoord + dir.offsetX * 2 - rot.offsetX * 2, yCoord + 3, zCoord + dir.offsetZ * 2 - rot.offsetZ * 2, Library.POS_Y),
|
||||
new DirPos(xCoord + dir.offsetX * 1 - rot.offsetX * 2, yCoord + 3, zCoord + dir.offsetZ * 1 - rot.offsetZ * 2, Library.POS_Y),
|
||||
new DirPos(xCoord + dir.offsetX * 0 - rot.offsetX * 2, yCoord + 3, zCoord + dir.offsetZ * 0 - rot.offsetZ * 2, Library.POS_Y),
|
||||
new DirPos(xCoord - dir.offsetX * 1 - rot.offsetX * 2, yCoord + 3, zCoord - dir.offsetZ * 1 - rot.offsetZ * 2, Library.POS_Y),
|
||||
new DirPos(xCoord - dir.offsetX * 2 - rot.offsetX * 2, yCoord + 3, zCoord - dir.offsetZ * 2 - rot.offsetZ * 2, Library.POS_Y),
|
||||
|
||||
new DirPos(xCoord + dir.offsetX + rot.offsetX * 3, yCoord, zCoord + dir.offsetZ + rot.offsetZ * 3, rot),
|
||||
new DirPos(xCoord - dir.offsetX + rot.offsetX * 3, yCoord, zCoord - dir.offsetZ + rot.offsetZ * 3, rot),
|
||||
new DirPos(xCoord + dir.offsetX - rot.offsetX * 3, yCoord, zCoord + dir.offsetZ - rot.offsetZ * 3, rot.getOpposite()),
|
||||
new DirPos(xCoord - dir.offsetX - rot.offsetX * 3, yCoord, zCoord - dir.offsetZ - rot.offsetZ * 3, rot.getOpposite()),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public DirPos[] getCoolPos() {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10);
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
|
||||
return new DirPos[] {
|
||||
new DirPos(xCoord + rot.offsetX + dir.offsetX * 3, yCoord, zCoord + rot.offsetZ + dir.offsetZ * 3, dir),
|
||||
new DirPos(xCoord - rot.offsetX + dir.offsetX * 3, yCoord, zCoord - rot.offsetZ + dir.offsetZ * 3, dir),
|
||||
new DirPos(xCoord + rot.offsetX - dir.offsetX * 3, yCoord, zCoord + rot.offsetZ - dir.offsetZ * 3, dir.getOpposite()),
|
||||
new DirPos(xCoord - rot.offsetX - dir.offsetX * 3, yCoord, zCoord - rot.offsetZ - dir.offsetZ * 3, dir.getOpposite()),
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
for(FluidTank tank : inputTanks) tank.serialize(buf);
|
||||
for(FluidTank tank : outputTanks) tank.serialize(buf);
|
||||
water.serialize(buf);
|
||||
lps.serialize(buf);
|
||||
buf.writeLong(power);
|
||||
buf.writeLong(maxPower);
|
||||
for(boolean b : didProcess) buf.writeBoolean(b);
|
||||
for(int i = 0; i < 4; i++) this.chemplantModule[i].serialize(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
for(FluidTank tank : inputTanks) tank.deserialize(buf);
|
||||
for(FluidTank tank : outputTanks) tank.deserialize(buf);
|
||||
water.deserialize(buf);
|
||||
lps.deserialize(buf);
|
||||
this.power = buf.readLong();
|
||||
this.maxPower = buf.readLong();
|
||||
for(int i = 0; i < 4; i++) this.didProcess[i] = buf.readBoolean();
|
||||
for(int i = 0; i < 4; i++) this.chemplantModule[i].deserialize(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
for(int i = 0; i < inputTanks.length; i++) this.inputTanks[i].readFromNBT(nbt, "i" + i);
|
||||
for(int i = 0; i < outputTanks.length; i++) this.outputTanks[i].readFromNBT(nbt, "i" + i);
|
||||
|
||||
this.power = nbt.getLong("power");
|
||||
this.maxPower = nbt.getLong("maxPower");
|
||||
for(int i = 0; i < 4; i++) this.chemplantModule[i].readFromNBT(nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
|
||||
for(int i = 0; i < inputTanks.length; i++) this.inputTanks[i].writeToNBT(nbt, "i" + i);
|
||||
for(int i = 0; i < outputTanks.length; i++) this.outputTanks[i].writeToNBT(nbt, "i" + i);
|
||||
|
||||
nbt.setLong("power", power);
|
||||
nbt.setLong("maxPower", maxPower);
|
||||
for(int i = 0; i < 4; i++) this.chemplantModule[i].writeToNBT(nbt);
|
||||
}
|
||||
|
||||
@Override public long getPower() { return power; }
|
||||
@Override public void setPower(long power) { this.power = power; }
|
||||
@Override public long getMaxPower() { return maxPower; }
|
||||
|
||||
@Override public FluidTank[] getReceivingTanks() { return inputTanks; }
|
||||
@Override public FluidTank[] getSendingTanks() { return outputTanks; }
|
||||
@Override public FluidTank[] getAllTanks() { return allTanks; }
|
||||
|
||||
@Override public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { return new ContainerMachineChemicalFactory(player.inventory, this); }
|
||||
@Override @SideOnly(Side.CLIENT) public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { return new GUIMachineChemicalFactory(player.inventory, this); }
|
||||
|
||||
@Override public boolean hasPermission(EntityPlayer player) { return this.isUseableByPlayer(player); }
|
||||
|
||||
@Override
|
||||
public void receiveControl(NBTTagCompound data) {
|
||||
if(data.hasKey("index") && data.hasKey("selection")) {
|
||||
int index = data.getInteger("index");
|
||||
String selection = data.getString("selection");
|
||||
if(index >= 0 && index < 4) {
|
||||
this.chemplantModule[index].recipe = selection;
|
||||
this.markChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AxisAlignedBB bb = null;
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getRenderBoundingBox() {
|
||||
if(bb == null) bb = AxisAlignedBB.getBoundingBox(xCoord - 2, yCoord, zCoord - 2, xCoord + 3, yCoord + 3, zCoord + 3);
|
||||
return bb;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public double getMaxRenderDistanceSquared() {
|
||||
return 65536.0D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideInfo(UpgradeType type, int level, boolean extendedInfo) {
|
||||
return type == UpgradeType.SPEED || type == UpgradeType.POWER || type == UpgradeType.OVERDRIVE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void provideInfo(UpgradeType type, int level, List<String> info, boolean extendedInfo) {
|
||||
info.add(IUpgradeInfoProvider.getStandardLabel(ModBlocks.machine_chemical_plant));
|
||||
if(type == UpgradeType.SPEED) {
|
||||
info.add(EnumChatFormatting.GREEN + I18nUtil.resolveKey(KEY_SPEED, "+" + (level * 100 / 3) + "%"));
|
||||
info.add(EnumChatFormatting.RED + I18nUtil.resolveKey(KEY_CONSUMPTION, "+" + (level * 50) + "%"));
|
||||
}
|
||||
if(type == UpgradeType.POWER) {
|
||||
info.add(EnumChatFormatting.GREEN + I18nUtil.resolveKey(KEY_CONSUMPTION, "-" + (level * 25) + "%"));
|
||||
}
|
||||
if(type == UpgradeType.OVERDRIVE) {
|
||||
info.add((BobMathUtil.getBlink() ? EnumChatFormatting.RED : EnumChatFormatting.DARK_GRAY) + "YES");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<UpgradeType, Integer> getValidUpgrades() {
|
||||
HashMap<UpgradeType, Integer> upgrades = new HashMap<>();
|
||||
upgrades.put(UpgradeType.SPEED, 3);
|
||||
upgrades.put(UpgradeType.POWER, 3);
|
||||
upgrades.put(UpgradeType.OVERDRIVE, 3);
|
||||
return upgrades;
|
||||
}
|
||||
|
||||
public DirPos[] coolantLine; // we could make the same fucking array 50,000 times per tick, or we just make it once
|
||||
|
||||
@Override // all the delegating shit so the proxies on the coolant lines only access coolant (and power and inventory) but not the recipe fluids
|
||||
public Object getDelegateForPosition(int x, int y, int z) {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10);
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
|
||||
if(coolantLine == null) coolantLine = new DirPos[] {
|
||||
new DirPos(xCoord + rot.offsetX + dir.offsetX * 2, yCoord, zCoord + rot.offsetZ + dir.offsetZ * 2, dir),
|
||||
new DirPos(xCoord - rot.offsetX + dir.offsetX * 2, yCoord, zCoord - rot.offsetZ + dir.offsetZ * 2, dir),
|
||||
new DirPos(xCoord + rot.offsetX - dir.offsetX * 2, yCoord, zCoord + rot.offsetZ - dir.offsetZ * 2, dir.getOpposite()),
|
||||
new DirPos(xCoord - rot.offsetX - dir.offsetX * 2, yCoord, zCoord - rot.offsetZ - dir.offsetZ * 2, dir.getOpposite()),
|
||||
};
|
||||
|
||||
for(DirPos pos : coolantLine) if(pos.compare(x, y, z)) return this.delegate; // this actually fucking works
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public class DelegateChemicalFactoy implements IEnergyReceiverMK2, IFluidStandardTransceiverMK2 {
|
||||
|
||||
@Override public long getPower() { return TileEntityMachineChemicalFactory.this.getPower(); }
|
||||
@Override public void setPower(long power) { TileEntityMachineChemicalFactory.this.setPower(power); }
|
||||
@Override public long getMaxPower() { return TileEntityMachineChemicalFactory.this.getMaxPower(); }
|
||||
@Override public boolean isLoaded() { return TileEntityMachineChemicalFactory.this.isLoaded(); }
|
||||
|
||||
@Override public FluidTank[] getReceivingTanks() { return new FluidTank[] {TileEntityMachineChemicalFactory.this.water}; }
|
||||
@Override public FluidTank[] getSendingTanks() { return new FluidTank[] {TileEntityMachineChemicalFactory.this.lps}; }
|
||||
|
||||
@Override public FluidTank[] getAllTanks() { return TileEntityMachineChemicalFactory.this.getAllTanks(); }
|
||||
}
|
||||
}
|
||||
@ -13,7 +13,9 @@ import com.hbm.inventory.gui.GUIMachineChemicalPlant;
|
||||
import com.hbm.items.machine.ItemMachineUpgrade;
|
||||
import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.module.ModuleMachineChemplant;
|
||||
import com.hbm.sound.AudioWrapper;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.IUpgradeInfoProvider;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
@ -46,6 +48,7 @@ public class TileEntityMachineChemicalPlant extends TileEntityMachineBase implem
|
||||
public boolean frame = false;
|
||||
public int anim;
|
||||
public int prevAnim;
|
||||
private AudioWrapper audio;
|
||||
|
||||
public ModuleMachineChemplant chemplantModule;
|
||||
public UpgradeManagerNT upgradeManager = new UpgradeManagerNT(this);
|
||||
@ -75,6 +78,8 @@ public class TileEntityMachineChemicalPlant extends TileEntityMachineBase implem
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(maxPower <= 0) this.maxPower = 1_000_000;
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
this.power = Library.chargeTEFromItems(slots, 0, power, maxPower);
|
||||
@ -93,8 +98,18 @@ public class TileEntityMachineChemicalPlant extends TileEntityMachineBase implem
|
||||
for(FluidTank tank : inputTanks) if(tank.getTankType() != Fluids.NONE) this.trySubscribe(tank.getTankType(), worldObj, pos);
|
||||
for(FluidTank tank : outputTanks) if(tank.getFill() > 0) this.tryProvide(tank, worldObj, pos);
|
||||
}
|
||||
|
||||
double speed = 1D;
|
||||
double pow = 1D;
|
||||
|
||||
speed += Math.min(upgradeManager.getLevel(UpgradeType.SPEED), 3) / 3D;
|
||||
speed += Math.min(upgradeManager.getLevel(UpgradeType.OVERDRIVE), 3);
|
||||
|
||||
pow -= Math.min(upgradeManager.getLevel(UpgradeType.POWER), 3) * 0.25D;
|
||||
pow += Math.min(upgradeManager.getLevel(UpgradeType.SPEED), 3) * 1D;
|
||||
pow += Math.min(upgradeManager.getLevel(UpgradeType.OVERDRIVE), 3) * 10D / 3D;
|
||||
|
||||
this.chemplantModule.update();
|
||||
this.chemplantModule.update(speed, pow, true);
|
||||
this.didProcess = this.chemplantModule.didProcess;
|
||||
if(this.chemplantModule.markDirty) this.markDirty();
|
||||
|
||||
@ -108,8 +123,38 @@ public class TileEntityMachineChemicalPlant extends TileEntityMachineBase implem
|
||||
if(worldObj.getTotalWorldTime() % 20 == 0) {
|
||||
frame = !worldObj.getBlock(xCoord, yCoord + 3, zCoord).isAir(worldObj, xCoord, yCoord + 3, zCoord);
|
||||
}
|
||||
|
||||
if(this.didProcess && MainRegistry.proxy.me().getDistance(xCoord , yCoord, zCoord) < 50) {
|
||||
if(audio == null) {
|
||||
audio = createAudioLoop();
|
||||
audio.startSound();
|
||||
} else if(!audio.isPlaying()) {
|
||||
audio = rebootAudio(audio);
|
||||
}
|
||||
audio.keepAlive();
|
||||
audio.updateVolume(this.getVolume(1F));
|
||||
|
||||
} else {
|
||||
if(audio != null) {
|
||||
audio.stopSound();
|
||||
audio = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override public AudioWrapper createAudioLoop() {
|
||||
return MainRegistry.proxy.getLoopedSound("hbm:block.chemicalPlant", xCoord, yCoord, zCoord, 1F, 15F, 1.0F, 20);
|
||||
}
|
||||
|
||||
@Override public void onChunkUnload() {
|
||||
if(audio != null) { audio.stopSound(); audio = null; }
|
||||
}
|
||||
|
||||
@Override public void invalidate() {
|
||||
super.invalidate();
|
||||
if(audio != null) { audio.stopSound(); audio = null; }
|
||||
}
|
||||
|
||||
public DirPos[] getConPos() {
|
||||
return new DirPos[] {
|
||||
@ -216,8 +261,10 @@ public class TileEntityMachineChemicalPlant extends TileEntityMachineBase implem
|
||||
if(data.hasKey("index") && data.hasKey("selection")) {
|
||||
int index = data.getInteger("index");
|
||||
String selection = data.getString("selection");
|
||||
if(index == 0) this.chemplantModule.recipe = selection;
|
||||
this.markChanged();
|
||||
if(index == 0) {
|
||||
this.chemplantModule.recipe = selection;
|
||||
this.markChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -237,19 +284,18 @@ public class TileEntityMachineChemicalPlant extends TileEntityMachineBase implem
|
||||
|
||||
@Override
|
||||
public boolean canProvideInfo(UpgradeType type, int level, boolean extendedInfo) {
|
||||
return false; //return type == UpgradeType.SPEED || type == UpgradeType.POWER || type == UpgradeType.OVERDRIVE;
|
||||
return type == UpgradeType.SPEED || type == UpgradeType.POWER || type == UpgradeType.OVERDRIVE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void provideInfo(UpgradeType type, int level, List<String> info, boolean extendedInfo) {
|
||||
info.add(IUpgradeInfoProvider.getStandardLabel(ModBlocks.machine_chemical_plant));
|
||||
if(type == UpgradeType.SPEED) {
|
||||
info.add(EnumChatFormatting.GREEN + I18nUtil.resolveKey(KEY_DELAY, "-" + (level * 25) + "%"));
|
||||
info.add(EnumChatFormatting.RED + I18nUtil.resolveKey(KEY_CONSUMPTION, "+" + (level * 300) + "%"));
|
||||
info.add(EnumChatFormatting.GREEN + I18nUtil.resolveKey(KEY_SPEED, "+" + (level * 100 / 3) + "%"));
|
||||
info.add(EnumChatFormatting.RED + I18nUtil.resolveKey(KEY_CONSUMPTION, "+" + (level * 50) + "%"));
|
||||
}
|
||||
if(type == UpgradeType.POWER) {
|
||||
info.add(EnumChatFormatting.GREEN + I18nUtil.resolveKey(KEY_CONSUMPTION, "-" + (level * 30) + "%"));
|
||||
info.add(EnumChatFormatting.RED + I18nUtil.resolveKey(KEY_DELAY, "+" + (level * 5) + "%"));
|
||||
info.add(EnumChatFormatting.GREEN + I18nUtil.resolveKey(KEY_CONSUMPTION, "-" + (level * 25) + "%"));
|
||||
}
|
||||
if(type == UpgradeType.OVERDRIVE) {
|
||||
info.add((BobMathUtil.getBlink() ? EnumChatFormatting.RED : EnumChatFormatting.DARK_GRAY) + "YES");
|
||||
@ -261,7 +307,7 @@ public class TileEntityMachineChemicalPlant extends TileEntityMachineBase implem
|
||||
HashMap<UpgradeType, Integer> upgrades = new HashMap<>();
|
||||
upgrades.put(UpgradeType.SPEED, 3);
|
||||
upgrades.put(UpgradeType.POWER, 3);
|
||||
upgrades.put(UpgradeType.OVERDRIVE, 6);
|
||||
upgrades.put(UpgradeType.OVERDRIVE, 3);
|
||||
return upgrades;
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,6 +64,11 @@ public class TileEntityMachineEPress extends TileEntityMachineBase implements IE
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
// Triggers the legacy monoblock fix
|
||||
if (worldObj.getBlockMetadata(xCoord, yCoord, zCoord) < 12) {
|
||||
worldObj.scheduleBlockUpdate(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord), 1);
|
||||
}
|
||||
|
||||
this.updateConnections();
|
||||
power = Library.chargeTEFromItems(slots, 0, power, maxPower);
|
||||
|
||||
|
||||
@ -53,6 +53,11 @@ public class TileEntityMachinePress extends TileEntityMachineBase implements IGU
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
// Triggers the legacy monoblock fix
|
||||
if (worldObj.getBlockMetadata(xCoord, yCoord, zCoord) < 12) {
|
||||
worldObj.scheduleBlockUpdate(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord), 1);
|
||||
}
|
||||
|
||||
boolean preheated = false;
|
||||
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
|
||||
@ -74,7 +74,7 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement
|
||||
fuelMaxCons.put(Fluids.GAS, 50D); // natgas doesn't burn well so it burns faster to compensate
|
||||
fuelMaxCons.put(Fluids.SYNGAS, 10D); // syngas just fucks
|
||||
fuelMaxCons.put(Fluids.OXYHYDROGEN, 100D); // oxyhydrogen is terrible so it needs to burn a ton for the bare minimum
|
||||
fuelMaxCons.put(Fluids.REFORMGAS, 5D); // fuck it we ball
|
||||
fuelMaxCons.put(Fluids.REFORMGAS, 5D); // fuck it we ball
|
||||
// default to 5 if not in list
|
||||
}
|
||||
|
||||
@ -166,17 +166,18 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement
|
||||
|
||||
if(audio == null) { //if there is no sound playing, start it
|
||||
|
||||
audio = MainRegistry.proxy.getLoopedSound("hbm:block.turbinegasRunning", xCoord, yCoord, zCoord, getVolume(1.0F), 20F, 2.0F);
|
||||
audio = MainRegistry.proxy.getLoopedSound("hbm:block.turbinegasRunning", xCoord, yCoord, zCoord, getVolume(1.0F), 20F, 2.0F, 20);
|
||||
audio.startSound();
|
||||
|
||||
} else if(!audio.isPlaying()) {
|
||||
audio.stopSound();
|
||||
audio = MainRegistry.proxy.getLoopedSound("hbm:block.turbinegasRunning", xCoord, yCoord, zCoord, getVolume(1.0F), 20F, 2.0F);
|
||||
audio = MainRegistry.proxy.getLoopedSound("hbm:block.turbinegasRunning", xCoord, yCoord, zCoord, getVolume(1.0F), 20F, 2.0F, 20);
|
||||
audio.startSound();
|
||||
}
|
||||
|
||||
audio.updatePitch((float) (0.55 + 0.1 * rpm / 10)); //dynamic pitch update based on rpm
|
||||
audio.updateVolume(getVolume(2F)); //yeah i need this
|
||||
audio.keepAlive();
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@ import com.hbm.tileentity.IBufPacketReceiver;
|
||||
import com.hbm.tileentity.IControlReceiverFilter;
|
||||
|
||||
import com.hbm.util.BufferUtil;
|
||||
import com.hbm.util.ItemStackUtil;
|
||||
|
||||
import api.hbm.redstoneoverradio.IRORInteractive;
|
||||
import api.hbm.redstoneoverradio.IRORValueProvider;
|
||||
@ -133,6 +134,109 @@ public class TileEntityMassStorage extends TileEntityCrateBase implements IBufPa
|
||||
return result;
|
||||
}
|
||||
|
||||
// Note: the following three methods are used for AE2 integration, and aren't meant to be called in any other context by default
|
||||
|
||||
public int getTotalStockpile() {
|
||||
ItemStack type = getType();
|
||||
if (type == null)
|
||||
return 0;
|
||||
|
||||
int result = getStockpile();
|
||||
|
||||
ItemStack inStack = slots[0];
|
||||
if (inStack != null && ItemStackUtil.areStacksCompatible(type, inStack)) {
|
||||
result += inStack.stackSize;
|
||||
}
|
||||
|
||||
ItemStack outStack = slots[2];
|
||||
if (outStack != null && ItemStackUtil.areStacksCompatible(type, outStack)) {
|
||||
result += outStack.stackSize;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Returns the remainder that didn't fit.
|
||||
// If `actually` is false, only predicts the outcome, but doesn't change the state
|
||||
public int increaseTotalStockpile(int amount, boolean actually) {
|
||||
return changeTotalStockpile(amount, actually, +1);
|
||||
}
|
||||
|
||||
// Returns the remainder that couldn't be extracted.
|
||||
// If `actually` is false, only predicts the outcome, but doesn't change the state
|
||||
public int decreaseTotalStockpile(int amount, boolean actually) {
|
||||
return changeTotalStockpile(amount, actually, -1);
|
||||
}
|
||||
|
||||
private int changeTotalStockpile(int amount, boolean actually, int sign) {
|
||||
ItemStack type = getType();
|
||||
|
||||
if (type == null)
|
||||
return amount;
|
||||
|
||||
int stockpileAvail = sign > 0 ? getCapacity() - getStockpile() : getStockpile();
|
||||
|
||||
if (amount > 0 && stockpileAvail > 0) {
|
||||
int depositStockpile = Math.min(amount, stockpileAvail);
|
||||
if (actually) {
|
||||
this.stack += sign * depositStockpile;
|
||||
}
|
||||
amount -= depositStockpile;
|
||||
}
|
||||
|
||||
int inputAvail = 0;
|
||||
ItemStack inStack = slots[0];
|
||||
if (inStack != null && ItemStackUtil.areStacksCompatible(type, inStack)) {
|
||||
inputAvail = sign > 0 ? inStack.getMaxStackSize() - inStack.stackSize : inStack.stackSize;
|
||||
} else if (inStack == null) {
|
||||
inputAvail = sign > 0 ? type.getMaxStackSize() : 0;
|
||||
}
|
||||
|
||||
if (amount > 0 && inputAvail > 0) {
|
||||
int depositInput = Math.min(amount, inputAvail);
|
||||
if (actually) {
|
||||
if (slots[0] == null) { // Only possible with sign == +1
|
||||
slots[0] = slots[1].copy();
|
||||
slots[0].stackSize = 0;
|
||||
}
|
||||
slots[0].stackSize += sign * depositInput;
|
||||
if (slots[0].stackSize == 0) {
|
||||
slots[0] = null;
|
||||
}
|
||||
}
|
||||
amount -= depositInput;
|
||||
}
|
||||
|
||||
int outputAvail = 0;
|
||||
ItemStack outStack = slots[2];
|
||||
if (outStack != null && ItemStackUtil.areStacksCompatible(type, outStack)) {
|
||||
outputAvail = sign > 0 ? outStack.getMaxStackSize() - outStack.stackSize : outStack.stackSize;
|
||||
} else if (outStack == null) {
|
||||
outputAvail = sign > 0 ? type.getMaxStackSize() : 0;
|
||||
}
|
||||
|
||||
if (amount > 0 && outputAvail > 0) {
|
||||
int depositOutput = Math.min(amount, outputAvail);
|
||||
if (actually) {
|
||||
if (slots[2] == null) { // Only possible with sign == +1
|
||||
slots[2] = slots[1].copy();
|
||||
slots[2].stackSize = 0;
|
||||
}
|
||||
slots[2].stackSize += sign * depositOutput;
|
||||
if (slots[2].stackSize == 0) {
|
||||
slots[2] = null;
|
||||
}
|
||||
}
|
||||
amount -= depositOutput;
|
||||
}
|
||||
|
||||
if (actually) {
|
||||
this.markDirty();
|
||||
}
|
||||
|
||||
return amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
buf.writeInt(this.stack);
|
||||
|
||||
@ -10,6 +10,8 @@ import com.hbm.items.ModItems;
|
||||
import com.hbm.module.ModulePatternMatcher;
|
||||
import com.hbm.tileentity.IControlReceiverFilter;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.util.InventoryUtil;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
@ -94,54 +96,62 @@ public class TileEntityCraneExtractor extends TileEntityCraneBase implements IGU
|
||||
}
|
||||
|
||||
boolean hasSent = false;
|
||||
|
||||
IConveyorBelt belt = null;
|
||||
|
||||
if(b instanceof IConveyorBelt) {
|
||||
belt = (IConveyorBelt) b;
|
||||
}
|
||||
|
||||
IConveyorBelt belt = (IConveyorBelt) b;
|
||||
/* try to send items from a connected inv, if present */
|
||||
if(te instanceof IInventory) {
|
||||
|
||||
/* try to send items from a connected inv, if present */
|
||||
if(te instanceof IInventory) {
|
||||
IInventory inv = (IInventory) te;
|
||||
int size = access == null ? inv.getSizeInventory() : access.length;
|
||||
|
||||
for(int i = 0; i < size; i++) {
|
||||
int index = access == null ? i : access[i];
|
||||
ItemStack stack = inv.getStackInSlot(index);
|
||||
|
||||
IInventory inv = (IInventory) te;
|
||||
int size = access == null ? inv.getSizeInventory() : access.length;
|
||||
|
||||
for(int i = 0; i < size; i++) {
|
||||
int index = access == null ? i : access[i];
|
||||
ItemStack stack = inv.getStackInSlot(index);
|
||||
if(stack != null && (sided == null || sided.canExtractItem(index, stack, inputSide.getOpposite().ordinal()))){
|
||||
|
||||
if(stack != null && (sided == null || sided.canExtractItem(index, stack, inputSide.getOpposite().ordinal()))){
|
||||
boolean match = this.matchesFilter(stack);
|
||||
|
||||
if((isWhitelist && match) || (!isWhitelist && !match)) {
|
||||
stack = stack.copy();
|
||||
int toSend = Math.min(amount, stack.stackSize);
|
||||
|
||||
boolean match = this.matchesFilter(stack);
|
||||
|
||||
if((isWhitelist && match) || (!isWhitelist && !match)) {
|
||||
stack = stack.copy();
|
||||
int toSend = Math.min(amount, stack.stackSize);
|
||||
if (belt != null) {
|
||||
inv.decrStackSize(index, toSend);
|
||||
stack.stackSize = toSend;
|
||||
|
||||
sendItem(stack, belt, outputSide);
|
||||
hasSent = true;
|
||||
break;
|
||||
} else {
|
||||
stack.stackSize = toSend;
|
||||
ItemStack remaining = InventoryUtil.tryAddItemToInventory(this.slots, 9, 17, stack);
|
||||
inv.decrStackSize(index, toSend - (remaining == null ? 0 : remaining.stackSize));
|
||||
}
|
||||
hasSent = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* if no item has been sent, send buffered items while ignoring the filter */
|
||||
if(!hasSent && belt != null) {
|
||||
|
||||
/* if no item has been sent, send buffered items while ignoring the filter */
|
||||
if(!hasSent) {
|
||||
for(int i = 9; i < 18; i++) {
|
||||
ItemStack stack = slots[i];
|
||||
|
||||
for(int i = 9; i < 18; i++) {
|
||||
ItemStack stack = slots[i];
|
||||
|
||||
if(stack != null){
|
||||
stack = stack.copy();
|
||||
int toSend = Math.min(amount, stack.stackSize);
|
||||
decrStackSize(i, toSend);
|
||||
stack.stackSize = toSend;
|
||||
|
||||
sendItem(stack, belt, outputSide);
|
||||
break;
|
||||
}
|
||||
if(stack != null){
|
||||
stack = stack.copy();
|
||||
int toSend = Math.min(amount, stack.stackSize);
|
||||
|
||||
decrStackSize(i, toSend);
|
||||
stack.stackSize = toSend;
|
||||
sendItem(stack, belt, outputSide);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,48 +40,49 @@ public class TileEntityCraneInserter extends TileEntityCraneBase implements IGUI
|
||||
super.updateEntity();
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
ForgeDirection outputSide = getOutputSide();
|
||||
TileEntity te = worldObj.getTileEntity(xCoord + outputSide.offsetX, yCoord + outputSide.offsetY, zCoord + outputSide.offsetZ);
|
||||
|
||||
int[] access = null;
|
||||
|
||||
if(te instanceof ISidedInventory) {
|
||||
ISidedInventory sided = (ISidedInventory) te;
|
||||
//access = sided.getAccessibleSlotsFromSide(dir.ordinal());
|
||||
access = InventoryUtil.masquerade(sided, outputSide.getOpposite().ordinal());
|
||||
}
|
||||
|
||||
if(te instanceof IInventory) {
|
||||
for(int i = 0; i < slots.length; i++) {
|
||||
|
||||
ItemStack stack = slots[i];
|
||||
|
||||
if(stack != null) {
|
||||
ItemStack ret = CraneInserter.addToInventory((IInventory) te, access, stack.copy(), outputSide.getOpposite().ordinal());
|
||||
|
||||
if(ret == null || ret.stackSize != stack.stackSize) {
|
||||
slots[i] = ret;
|
||||
this.markDirty();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!this.worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)) {ForgeDirection outputSide = getOutputSide();
|
||||
TileEntity te = worldObj.getTileEntity(xCoord + outputSide.offsetX, yCoord + outputSide.offsetY, zCoord + outputSide.offsetZ);
|
||||
|
||||
int[] access = null;
|
||||
|
||||
if(te instanceof ISidedInventory) {
|
||||
ISidedInventory sided = (ISidedInventory) te;
|
||||
//access = sided.getAccessibleSlotsFromSide(dir.ordinal());
|
||||
access = InventoryUtil.masquerade(sided, outputSide.getOpposite().ordinal());
|
||||
}
|
||||
|
||||
//if the previous operation fails, repeat but use single items instead of the whole stack instead
|
||||
//this should fix cases where the inserter can't insert into something that has a stack size limitation
|
||||
for(int i = 0; i < slots.length; i++) {
|
||||
|
||||
ItemStack stack = slots[i];
|
||||
|
||||
if(stack != null) {
|
||||
stack = stack.copy();
|
||||
stack.stackSize = 1;
|
||||
ItemStack ret = CraneInserter.addToInventory((IInventory) te, access, stack.copy(), outputSide.getOpposite().ordinal());
|
||||
if(te instanceof IInventory) {
|
||||
for(int i = 0; i < slots.length; i++) {
|
||||
|
||||
if(ret == null || ret.stackSize != stack.stackSize) {
|
||||
this.decrStackSize(i, 1);
|
||||
this.markDirty();
|
||||
return;
|
||||
ItemStack stack = slots[i];
|
||||
|
||||
if(stack != null) {
|
||||
ItemStack ret = CraneInserter.addToInventory((IInventory) te, access, stack.copy(), outputSide.getOpposite().ordinal());
|
||||
|
||||
if(ret == null || ret.stackSize != stack.stackSize) {
|
||||
slots[i] = ret;
|
||||
this.markDirty();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//if the previous operation fails, repeat but use single items instead of the whole stack instead
|
||||
//this should fix cases where the inserter can't insert into something that has a stack size limitation
|
||||
for(int i = 0; i < slots.length; i++) {
|
||||
|
||||
ItemStack stack = slots[i];
|
||||
|
||||
if(stack != null) {
|
||||
stack = stack.copy();
|
||||
stack.stackSize = 1;
|
||||
ItemStack ret = CraneInserter.addToInventory((IInventory) te, access, stack.copy(), outputSide.getOpposite().ordinal());
|
||||
|
||||
if(ret == null || ret.stackSize != stack.stackSize) {
|
||||
this.decrStackSize(i, 1);
|
||||
this.markDirty();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -74,7 +74,7 @@ public class ArmorRegistry {
|
||||
|
||||
if(filter != null) {
|
||||
//add the HazardClasses from the filter, then remove the ones blacklisted by the mask
|
||||
List<HazardClass> filProt = hazardClasses.get(filter.getItem());
|
||||
List<HazardClass> filProt = (List<HazardClass>) hazardClasses.get(filter.getItem()).clone();
|
||||
|
||||
for(HazardClass c : mask.getBlacklist(stack, entity))
|
||||
filProt.remove(c);
|
||||
|
||||
@ -76,9 +76,8 @@ public class BobMathUtil {
|
||||
);
|
||||
}
|
||||
|
||||
public static double interp(double x, double y, float interp) {
|
||||
return x + (y - x) * interp;
|
||||
}
|
||||
public static double interp(double x, double y, float interp) { return x + (y - x) * interp; }
|
||||
public static double interp(double x, double y, double interp) { return x + (y - x) * interp; }
|
||||
|
||||
public static double getAngleFrom2DVecs(double x1, double z1, double x2, double z2) {
|
||||
|
||||
|
||||
@ -1,37 +0,0 @@
|
||||
package com.hbm.util;
|
||||
|
||||
import net.minecraft.world.ChunkCoordIntPair;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Unique identifier for sub-chunks.
|
||||
* @author mlbv
|
||||
*/
|
||||
public class ChunkKey {
|
||||
public final ChunkCoordIntPair pos;
|
||||
public final int subY;
|
||||
|
||||
public ChunkKey(int cx, int cz, int sy) {
|
||||
this.pos = new ChunkCoordIntPair(cx, cz);
|
||||
this.subY = sy;
|
||||
}
|
||||
|
||||
public ChunkKey(ChunkCoordIntPair pos, int sy) {
|
||||
this.pos = pos;
|
||||
this.subY = sy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof ChunkKey)) return false;
|
||||
ChunkKey k = (ChunkKey) o;
|
||||
return subY == k.subY && pos.equals(k.pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(pos.chunkXPos, pos.chunkZPos, subY);
|
||||
}
|
||||
}
|
||||
@ -49,7 +49,29 @@ public class Compat {
|
||||
private static String getReg(String domain, String name) {
|
||||
return domain + ":" + name;
|
||||
}
|
||||
|
||||
|
||||
public static ItemStack getPreferredOreOutput(List<ItemStack> oreList) {
|
||||
int lowestPref = -1;
|
||||
ItemStack preferredStack = null;
|
||||
|
||||
for(ItemStack item : oreList) {
|
||||
String modid = ItemStackUtil.getModIdFromItemStack(item);
|
||||
for(int i = 0; i < GeneralConfig.preferredOutputMod.length; i++) {
|
||||
if (modid.equals(GeneralConfig.preferredOutputMod[i])){
|
||||
if (lowestPref<0 || i <lowestPref) {
|
||||
preferredStack = item;
|
||||
lowestPref = i;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (preferredStack != null) {
|
||||
return preferredStack.copy();
|
||||
}
|
||||
return oreList.get(0).copy();
|
||||
}
|
||||
|
||||
public static boolean isModLoaded(String modid) {
|
||||
return Loader.isModLoaded(modid);
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ import java.util.function.Consumer;
|
||||
|
||||
import api.hbm.energymk2.IEnergyHandlerMK2;
|
||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||
import api.hbm.fluidmk2.IFluidRegisterListener;
|
||||
import api.hbm.fluidmk2.IFluidUserMK2;
|
||||
import api.hbm.recipe.IRecipeRegisterListener;
|
||||
|
||||
@ -16,6 +17,7 @@ import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.entity.missile.EntityMissileCustom;
|
||||
import com.hbm.explosion.ExplosionNukeSmall;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.inventory.recipes.loader.SerializableRecipe;
|
||||
import com.hbm.items.weapon.ItemCustomMissilePart.WarheadType;
|
||||
@ -198,6 +200,15 @@ public class CompatExternal {
|
||||
public static void registerRecipeRegisterListener(IRecipeRegisterListener listener) {
|
||||
SerializableRecipe.additionalListeners.add(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers an IFluidRegisterListener which is called every time the fluid list is loaded, either during startup or when the refresh command is used.
|
||||
* Ensures that fluids are registered when they should, instead of being purged permanently when the system reloads.
|
||||
* @param listener
|
||||
*/
|
||||
public static void registerFluidRegisterListener(IFluidRegisterListener listener) {
|
||||
Fluids.additionalListeners.add(listener);
|
||||
}
|
||||
|
||||
public static void compatExamples() {
|
||||
// Makes all cows be targeted by turrets if player mode is active in addition to the existing rules. Applies to all entities that inherit EntityCow.
|
||||
|
||||
17
src/main/java/com/hbm/util/CompatFluidRegistry.java
Normal file
17
src/main/java/com/hbm/util/CompatFluidRegistry.java
Normal file
@ -0,0 +1,17 @@
|
||||
package com.hbm.util;
|
||||
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.render.util.EnumSymbol;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class CompatFluidRegistry {
|
||||
|
||||
/** Registers a fluid with a custom ID. */
|
||||
public static FluidType registerFluid(String name, int id, int color, int p, int f, int r, EnumSymbol symbol, ResourceLocation texture) {
|
||||
FluidType type = new FluidType(name, id, color, p, f, r, symbol, texture);
|
||||
Fluids.metaOrder.add(type);
|
||||
return type;
|
||||
}
|
||||
}
|
||||
@ -29,6 +29,8 @@ import com.hbm.inventory.recipes.anvil.AnvilRecipes;
|
||||
import com.hbm.inventory.recipes.anvil.AnvilRecipes.AnvilConstructionRecipe;
|
||||
import com.hbm.inventory.recipes.anvil.AnvilRecipes.AnvilOutput;
|
||||
import com.hbm.inventory.recipes.anvil.AnvilRecipes.OverlayType;
|
||||
import com.hbm.inventory.recipes.loader.GenericRecipe;
|
||||
import com.hbm.inventory.recipes.loader.GenericRecipes.IOutput;
|
||||
import com.hbm.items.machine.ItemStamp.StampType;
|
||||
import com.hbm.util.Tuple.Pair;
|
||||
import com.hbm.util.Tuple.Triplet;
|
||||
@ -70,8 +72,7 @@ public class CompatRecipeRegistry {
|
||||
SolderingRecipes.recipes.add(new SolderingRecipe(output, time, power, fluid, copyFirst(toppings, 3), copyFirst(pcb, 2), copyFirst(solder, 1)));
|
||||
}
|
||||
|
||||
/** Chemplant recipes need unique IDs, game will crash when an ID collision is detected! */
|
||||
public static void registerChemplant(int id, String name, int duration, AStack[] inputItems, FluidStack[] inputFluids, ItemStack[] outputItems, FluidStack[] outputFluids) {
|
||||
@Deprecated public static void registerChemplant(int id, String name, int duration, AStack[] inputItems, FluidStack[] inputFluids, ItemStack[] outputItems, FluidStack[] outputFluids) {
|
||||
ChemRecipe recipe = new ChemRecipe(id, name, duration);
|
||||
if(inputItems != null) recipe.inputItems(copyFirst(inputItems, 4));
|
||||
if(inputFluids != null) recipe.inputFluids(copyFirst(inputFluids, 2));
|
||||
@ -79,6 +80,18 @@ public class CompatRecipeRegistry {
|
||||
if(outputFluids != null) recipe.outputFluids(copyFirst(outputFluids, 2));
|
||||
ChemplantRecipes.recipes.add(recipe);
|
||||
}
|
||||
|
||||
/** Chemical plant recipe needs a unique name for the registry. Zero length arrays should stay null*/
|
||||
public static void registerChemicalPlant(String name, boolean named, ItemStack icon, int duration, long power, AStack[] inputItems, FluidStack[] inputFluids, IOutput[] outputItems, FluidStack[] outputFluids) {
|
||||
GenericRecipe recipe = new GenericRecipe(name).setDuration(duration).setPower(power);
|
||||
if(named) recipe.setNamed();
|
||||
if(icon != null) recipe.setIcon(icon);
|
||||
if(inputItems != null && inputItems.length > 0) recipe.inputItems(inputItems);
|
||||
if(inputFluids != null && inputFluids.length > 0) recipe.inputFluids(inputFluids);
|
||||
if(outputItems != null && outputItems.length > 0) recipe.outputItems(outputItems);
|
||||
if(outputFluids != null && outputFluids.length > 0) recipe.outputFluids(outputFluids);
|
||||
ChemicalPlantRecipes.INSTANCE.register(recipe);
|
||||
}
|
||||
|
||||
/** Either solid or liquid output can be null */
|
||||
public static void registerCombination(AStack input, ItemStack output, FluidStack fluid) {
|
||||
@ -223,6 +236,7 @@ public class CompatRecipeRegistry {
|
||||
AmmoPressRecipes.recipes.add(new AmmoPressRecipe(output, input));
|
||||
}
|
||||
|
||||
/** Assembler recipes are identified by the output as a ComparableStack, so no two recipes can share output. */
|
||||
public static void registerAssembler(ItemStack output, AStack[] input, int time) {
|
||||
AssemblerRecipes.makeRecipe(new ComparableStack(output), copyFirst(input, 12), time);
|
||||
}
|
||||
|
||||
@ -15,6 +15,9 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry.UniqueIdentifier;
|
||||
|
||||
public class ItemStackUtil {
|
||||
|
||||
public static ItemStack carefulCopy(ItemStack stack) {
|
||||
@ -166,6 +169,19 @@ public class ItemStackUtil {
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a String of the mod id of an itemstack. If a unique identifier can't be found in the registry, returns null.
|
||||
* @param stack
|
||||
* @return
|
||||
*/
|
||||
public static String getModIdFromItemStack(ItemStack stack) {
|
||||
UniqueIdentifier id = GameRegistry.findUniqueIdentifierFor(stack.getItem());
|
||||
if(id!=null) {
|
||||
return id.modId;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void spillItems(World world, int x, int y, int z, Block block, Random rand) {
|
||||
IInventory tileentityfurnace = (IInventory) world.getTileEntity(x, y, z);
|
||||
|
||||
@ -28,6 +28,7 @@ public class LootGenerator {
|
||||
public static final String LOOT_BONES = "LOOT_BONES";
|
||||
public static final String LOOT_GLYPHID_HIVE = "LOOT_GLYPHID_HIVE";
|
||||
public static final String LOOT_METEOR = "LOOT_METEOR";
|
||||
public static final String LOOT_FLAREGUN = "LOOT_FLAREGUN";
|
||||
|
||||
public static void applyLoot(World world, int x, int y, int z, String name) {
|
||||
switch(name) {
|
||||
@ -40,6 +41,7 @@ public class LootGenerator {
|
||||
case LOOT_BONES: lootBones(world, x, y, z);
|
||||
case LOOT_GLYPHID_HIVE: lootGlyphidHive(world, x, y, z);
|
||||
case LOOT_METEOR: lootBookMeteor(world, x, y, z);
|
||||
case LOOT_FLAREGUN: lootFlareGun(world, x, y, z);
|
||||
default: lootBones(world, x, y, z); break;
|
||||
}
|
||||
}
|
||||
@ -55,6 +57,7 @@ public class LootGenerator {
|
||||
LOOT_BONES,
|
||||
LOOT_GLYPHID_HIVE,
|
||||
LOOT_METEOR,
|
||||
LOOT_FLAREGUN,
|
||||
};
|
||||
}
|
||||
|
||||
@ -211,4 +214,23 @@ public class LootGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public static void lootFlareGun(World world, int x, int y, int z) {
|
||||
TileEntityLoot loot = (TileEntityLoot) world.getTileEntity(x, y, z);
|
||||
if (loot != null && loot.items.isEmpty()) {
|
||||
addItemWithDeviation(loot, world.rand, new ItemStack(ModItems.gun_flaregun), 0, 0, -0.25);
|
||||
|
||||
int count = world.rand.nextInt(3) + 2;
|
||||
for (int k = 0; k < count; k++)
|
||||
addItemWithDeviation(loot, world.rand,
|
||||
new ItemStack(ModItems.ammo_standard, 1, EnumAmmo.G26_FLARE.ordinal()),
|
||||
-0.25, k * 0.03125, 0.25);
|
||||
|
||||
count = world.rand.nextInt(1) + 1;
|
||||
for (int k = 0; k < count; k++)
|
||||
addItemWithDeviation(loot, world.rand,
|
||||
new ItemStack(ModItems.ammo_standard, 1,
|
||||
world.rand.nextBoolean() ? EnumAmmo.G26_FLARE_SUPPLY.ordinal() : EnumAmmo.G26_FLARE_WEAPON.ordinal()),
|
||||
0.25, k * 0.03125, 0.125);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
63
src/main/java/com/hbm/util/SubChunkKey.java
Normal file
63
src/main/java/com/hbm/util/SubChunkKey.java
Normal file
@ -0,0 +1,63 @@
|
||||
package com.hbm.util;
|
||||
|
||||
import net.minecraft.world.ChunkCoordIntPair;
|
||||
|
||||
/**
|
||||
* Unique identifier for sub-chunks.
|
||||
* @author mlbv
|
||||
*/
|
||||
public class SubChunkKey {
|
||||
|
||||
private int chunkXPos;
|
||||
private int chunkZPos;
|
||||
private int subY;
|
||||
private int hash;
|
||||
|
||||
public SubChunkKey(int cx, int cz, int sy) {
|
||||
this.update(cx, cz, sy);
|
||||
}
|
||||
|
||||
public SubChunkKey(ChunkCoordIntPair pos, int sy) {
|
||||
this.update(pos.chunkXPos, pos.chunkZPos, sy);
|
||||
}
|
||||
|
||||
public SubChunkKey update(int cx, int cz, int sy) {
|
||||
this.chunkXPos = cx;
|
||||
this.chunkZPos = cz;
|
||||
this.subY = sy;
|
||||
int result = subY;
|
||||
result = 31 * result + cx;
|
||||
result = 31 * result + cz;
|
||||
this.hash = result;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int hashCode() {
|
||||
return this.hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof SubChunkKey)) return false;
|
||||
SubChunkKey k = (SubChunkKey) o;
|
||||
return this.subY == k.subY && this.chunkXPos == k.chunkXPos && this.chunkZPos == k.chunkZPos;
|
||||
}
|
||||
|
||||
public int getSubY() {
|
||||
return subY;
|
||||
}
|
||||
|
||||
public int getChunkXPos() {
|
||||
return chunkXPos;
|
||||
}
|
||||
|
||||
public int getChunkZPos() {
|
||||
return chunkZPos;
|
||||
}
|
||||
|
||||
public ChunkCoordIntPair getPos() {
|
||||
return new ChunkCoordIntPair(this.chunkXPos, this.chunkZPos);
|
||||
}
|
||||
}
|
||||
@ -34,19 +34,19 @@ public class SubChunkSnapshot {
|
||||
* @param world
|
||||
* The World instance from which to retrieve the chunk.
|
||||
* @param key
|
||||
* The ChunkKey identifying the sub-chunk.
|
||||
* The SubChunkKey identifying the sub-chunk.
|
||||
* @param allowGeneration
|
||||
* Whether to generate chunks. If false, attempting to retrieve a snapshot of a chunk that does not exist will return {@link SubChunkSnapshot#EMPTY}.
|
||||
* @return
|
||||
* A SubChunkSnapshot containing the palette and block data for the sub-chunk,
|
||||
* or {@link SubChunkSnapshot#EMPTY} if the region contains only air.
|
||||
*/
|
||||
public static SubChunkSnapshot getSnapshot(World world, ChunkKey key, boolean allowGeneration){
|
||||
if (!world.getChunkProvider().chunkExists(key.pos.chunkXPos, key.pos.chunkZPos) && !allowGeneration) {
|
||||
public static SubChunkSnapshot getSnapshot(World world, SubChunkKey key, boolean allowGeneration){
|
||||
if (!world.getChunkProvider().chunkExists(key.getChunkXPos(), key.getChunkZPos()) && !allowGeneration) {
|
||||
return SubChunkSnapshot.EMPTY;
|
||||
}
|
||||
Chunk chunk = world.getChunkProvider().provideChunk(key.pos.chunkXPos, key.pos.chunkZPos);
|
||||
ExtendedBlockStorage ebs = chunk.getBlockStorageArray()[key.subY];
|
||||
Chunk chunk = world.getChunkProvider().provideChunk(key.getChunkXPos(), key.getChunkZPos());
|
||||
ExtendedBlockStorage ebs = chunk.getBlockStorageArray()[key.getSubY()];
|
||||
if (ebs == null || ebs.isEmpty()) return SubChunkSnapshot.EMPTY;
|
||||
|
||||
short[] data = new short[16 * 16 * 16];
|
||||
|
||||
@ -50,4 +50,8 @@ public net.minecraft.client.resources.AbstractResourcePack field_110597_b # re
|
||||
public net.minecraft.inventory.Container * # fucking everything i hate this class
|
||||
|
||||
# GuiIngame
|
||||
public net.minecraft.client.gui.GuiIngame field_92016_l # highlightingItemStack
|
||||
public net.minecraft.client.gui.GuiIngame field_92016_l # highlightingItemStack
|
||||
|
||||
# Block
|
||||
public net.minecraft.block.Block func_149642_a(Lnet/minecraft/world/World;IIILnet/minecraft/item/ItemStack;)V # dropBlockAsItem
|
||||
|
||||
|
||||
@ -372,6 +372,7 @@ container.machineAmmoPress=Munitionspresse
|
||||
container.machineArcWelder=Lichtbogenschweißer
|
||||
container.machineArcFurnaceLarge=Lichtbogenofen
|
||||
container.machineBoiler=Ölwärmer
|
||||
container.machineChemicalFactory=Chemiefabrik
|
||||
container.machineChemicalPlant=Chemiewerk
|
||||
container.machineCMB=CMB-Stahl Hochofen
|
||||
container.machineCoal=Verbrennungsgenerator
|
||||
@ -4183,6 +4184,7 @@ tile.floodlight.name=Elektrischer Scheinwerfer
|
||||
tile.fluid_duct.name=Universelles Flüssigkeitsrohr (Veraltet)
|
||||
tile.fluid_duct_box.name=Universelles Flüssigkeitsrohr (Boxrohr)
|
||||
tile.fluid_duct_exhaust.name=Abgasrohr
|
||||
tile.fluid_duct_paintable_block_exhaust.name=Geschirmtes Abgasrohr (Färbbar)
|
||||
tile.fluid_duct_gauge.name=Flussmessrohr
|
||||
tile.fluid_duct_gauge.desc=Rohr welches anzeight, wie viel Flüssigkeit$sich pro Tick im Netzwerk bewegt.$Geteilte Netzwerke die über Fässer oder Tanks$verbunden sind, werden als ein einzelnes gezählt.
|
||||
tile.fluid_duct_neo.name=Universelles Flüssigkeitsrohr
|
||||
@ -4367,9 +4369,10 @@ tile.machine_boiler_off.name=Alter Boiler
|
||||
tile.machine_catalytic_cracker.name=Katalytischer Cracking-Turm
|
||||
tile.machine_catalytic_reformer.name=Katalytischer Reformer
|
||||
tile.machine_centrifuge.name=Zentrifuge
|
||||
tile.machine_chemfac.name=Chemiefabrik
|
||||
tile.machine_chemical_plant.name=Chemiewerk 2: Electric Boogaloo
|
||||
tile.machine_chemplant.name=Chemiewerk
|
||||
tile.machine_chemfac.name=Chemiefabrik (Legacy)
|
||||
tile.machine_chemical_factory.name=Chemiefabrik
|
||||
tile.machine_chemical_plant.name=Chemiewerk
|
||||
tile.machine_chemplant.name=Chemiewerk (Legacy)
|
||||
tile.machine_chungus.name=Leviathan-Dampfturbine
|
||||
tile.machine_chungus.desc=Effizienz: 85%%
|
||||
tile.machine_coal_off.name=Verbrennungsgenerator
|
||||
@ -4988,6 +4991,7 @@ tool.ability.cnetrifuge=Auto-Zentrifuge
|
||||
tool.ability.crystallizer=Auto-Kristallisierer
|
||||
tool.ability.explosion=Explosion
|
||||
tool.ability.hammer=AoE
|
||||
tool.ability.hammer_flat=Flacher AoE
|
||||
tool.ability.luck=Glück
|
||||
tool.ability.mercury=Quecksilber-Berührung
|
||||
tool.ability.midas=Midas' Hand
|
||||
|
||||
@ -774,6 +774,7 @@ container.machineAmmoPress=Ammo Press
|
||||
container.machineArcWelder=Arc Welder
|
||||
container.machineArcFurnaceLarge=Arc Furnace
|
||||
container.machineBoiler=Oil Heater
|
||||
container.machineChemicalFactory=Chemical Factory
|
||||
container.machineChemicalPlant=Chemical Plant
|
||||
container.machineCMB=CMB Steel Furnace
|
||||
container.machineCoal=Combustion Generator
|
||||
@ -5308,6 +5309,7 @@ tile.floodlight.name=Powered Floodlight
|
||||
tile.fluid_duct.name=Universal Fluid Duct (Deprecated)
|
||||
tile.fluid_duct_box.name=Universal Fluid Duct (Boxduct)
|
||||
tile.fluid_duct_exhaust.name=Exhaust Pipe
|
||||
tile.fluid_duct_paintable_block_exhaust.name=Paintable Coated Exhaust Pipe
|
||||
tile.fluid_duct_gauge.name=Flow Gauge Pipe
|
||||
tile.fluid_duct_gauge.desc=Pipe that displays how much fluid$moves within the network per tick.$Split networks connected by barrels$or tanks are considered as one shared network.
|
||||
tile.fluid_duct_neo.name=Universal Fluid Duct
|
||||
@ -5499,9 +5501,11 @@ tile.machine_boiler_off.name=Old Boiler
|
||||
tile.machine_catalytic_cracker.name=Catalytic Cracking Tower
|
||||
tile.machine_catalytic_reformer.name=Catalytic Reformer
|
||||
tile.machine_centrifuge.name=Centrifuge
|
||||
tile.machine_chemfac.name=Chemical Factory
|
||||
tile.machine_chemical_plant.name=Chemical Plant 2: Electric Boogaloo
|
||||
tile.machine_chemplant.name=Chemical Plant
|
||||
tile.machine_chemfac.name=Chemical Factory (Legacy)
|
||||
tile.machine_chemical_factory.name=Chemical Factory
|
||||
tile.machine_chemical_factory.desc=Quadruple chemical plant.$Recipes process twice as fast,$but need twice as much power.$Needs to be cooled with water,$produces low-pressure steam.
|
||||
tile.machine_chemical_plant.name=Chemical Plant
|
||||
tile.machine_chemplant.name=Chemical Plant (Legacy)
|
||||
tile.machine_chungus.name=Leviathan Steam Turbine
|
||||
tile.machine_chungus.desc=Efficiency: 85%%
|
||||
tile.machine_coal_off.name=Combustion Generator
|
||||
@ -6153,6 +6157,7 @@ tool.ability.centrifuge=Auto-Centrifuge
|
||||
tool.ability.crystallizer=Auto-Crystallizer
|
||||
tool.ability.explosion=Explosion
|
||||
tool.ability.hammer=AoE
|
||||
tool.ability.hammer_flat=Flat AoE
|
||||
tool.ability.luck=Fortune
|
||||
tool.ability.mercury=Mercury Touch
|
||||
tool.ability.midas=Midas Touch
|
||||
@ -6182,6 +6187,7 @@ upgrade.fortune=Fortune %s
|
||||
upgrade.overheatChance=Overheat chance %s
|
||||
upgrade.productivity=Productivity %s
|
||||
upgrade.range=Range %s
|
||||
upgrade.speed=Process speed %s
|
||||
|
||||
upgrade.gui.title=§lAcceptable Upgrades:§r
|
||||
upgrade.gui.afterburner= * §dAfterburner§r: Stacks to level %s
|
||||
|
||||
@ -6174,6 +6174,7 @@ tool.ability.centrifuge=Auto-Centrifuge
|
||||
tool.ability.crystallizer=Auto-Crystallizer
|
||||
tool.ability.explosion=Explosion
|
||||
tool.ability.hammer=AoE
|
||||
tool.ability.hammer_flat=AoE piatta
|
||||
tool.ability.luck=Fortune
|
||||
tool.ability.mercury=Mercury Touch
|
||||
tool.ability.midas=Midas Touch
|
||||
|
||||
@ -5409,6 +5409,7 @@ tool.ability.centrifuge=Auto-Centrifuge
|
||||
tool.ability.crystallizer=Auto-Crystallizer
|
||||
tool.ability.explosion=Explosion
|
||||
tool.ability.hammer=AoE
|
||||
tool.ability.hammer_flat=Flat AoE
|
||||
tool.ability.luck=Fortune
|
||||
tool.ability.mercury=Mercury Touch
|
||||
tool.ability.midas=Midas Touch
|
||||
|
||||
@ -5551,6 +5551,7 @@ tile.floodlight.name=Электрический прожектор
|
||||
tile.fluid_duct.name=Универсальная жидкостная труба (Устаревшее)
|
||||
tile.fluid_duct_box.name=Универсальная жидкостная труба (Boxduct)
|
||||
tile.fluid_duct_exhaust.name=Выхлопная труба
|
||||
tile.fluid_duct_paintable_block_exhaust.name=Окрашиваемая покрытая выхлопная труба
|
||||
tile.fluid_duct_gauge.name=Труба с измерителем потока
|
||||
tile.fluid_duct_gauge.desc=Труба которая показывает сколько жидкости$перемещается внутри сети за тик.$Разделенные сети, соединенные бочками$или резервуары рассматриваются как одна общая сеть.
|
||||
tile.fluid_duct_neo.name=Универсальная жидкостная труба
|
||||
@ -6387,6 +6388,7 @@ tool.ability.centrifuge=Авто-центрифуга
|
||||
tool.ability.crystallizer=Авто-кристаллизатор
|
||||
tool.ability.explosion=Взрыв
|
||||
tool.ability.hammer=Зона действия
|
||||
tool.ability.hammer_flat=Плоская зона действия
|
||||
tool.ability.luck=Удача
|
||||
tool.ability.mercury=Ртутное касание
|
||||
tool.ability.midas=Прикосновение Мидаса
|
||||
|
||||
@ -566,6 +566,21 @@ cannery.schottky.7=If any virtual particles encounter any malformed segments, al
|
||||
cannery.schottky.8=Note that virtual particles will never use the same Diode exit twice. Infinite loops will fail, but re-entering a Diode is otherwise fine
|
||||
cannery.schottky.9=Your Schottky Particle Diode should be properly enclosed, with free paths for each intersection exit
|
||||
|
||||
chem.hydrogen=Водень
|
||||
chem.hydrogencoke=Hydrogen from CokeAdd commentMore actions
|
||||
chem.oxygen=Кисень
|
||||
chem.xenon=Ксеноновий газ
|
||||
chem.xenonoxy=Ксеноновий газ (Охолоджений)
|
||||
chem.helium3=Гелій-3
|
||||
chem.ethanol=Етанол
|
||||
chem.biogas=Біогаз
|
||||
chem.biofuel=Трансестерифікація біопалива
|
||||
chem.reoil=Очищення оливи
|
||||
chem.gasoline=Газолін
|
||||
chem.tarsand=Бітум з бітумінозного піску
|
||||
chem.meatprocessing=Обробка м'яса гліфідів
|
||||
chem.birkeland=Азотна кислота з повітря
|
||||
|
||||
chem.ARSENIC=Екстракція миш'яку
|
||||
chem.ASPHALT=Виробництво асфальту
|
||||
chem.BAKELITE=Виробництво карболіту
|
||||
@ -759,6 +774,8 @@ container.machineAmmoPress=Прес для боєприпасів
|
||||
container.machineArcWelder=Дуговий зварювальник
|
||||
container.machineArcFurnaceLarge=Дугова піч
|
||||
container.machineBoiler=Нагрівач нафти
|
||||
container.machineChemicalFactory=Хімічна фабрика
|
||||
container.machineChemicalPlant=Хімічний завод
|
||||
container.machineCMB=CMB Steel Furnace
|
||||
container.machineCoal=Твердопаливний генератор
|
||||
container.machineCoker=Коксова установка
|
||||
@ -1398,22 +1415,25 @@ hazard.particleFine=Твердих часток
|
||||
hazard.sand=Подразників очей
|
||||
|
||||
hbm.key=NTM Hotkeys
|
||||
hbm.key.calculator=Calculator
|
||||
hbm.key.copyToolAlt=Copy Tool: Switch Paste
|
||||
hbm.key.copyToolCtrl=Copy Tool: Paste to Pipes
|
||||
hbm.key.craneLoad=Load/Unload Crane
|
||||
hbm.key.craneMoveDown=Move Crane Backward
|
||||
hbm.key.craneMoveLeft=Move Crane Left
|
||||
hbm.key.craneMoveRight=Move Crane Right
|
||||
hbm.key.craneMoveUp=Move Crane Forward
|
||||
hbm.key.dash=Dash
|
||||
hbm.key.gunPrimary=Primary Fire
|
||||
hbm.key.gunSecondary=Secondary Fire
|
||||
hbm.key.gunTertitary=Gun Sights
|
||||
hbm.key.toggleBack=Toggle Jetpack
|
||||
hbm.key.toggleHUD=Toggle HUD
|
||||
hbm.key.trainInv=Train Inventory
|
||||
hbm.key.reload=Reload
|
||||
hbm.key.ability=Перемикання здібностей інструмента
|
||||
hbm.key.abilityAlt=Конфігурація здібностей інструмента
|
||||
hbm.key.calculator=Калькулятор
|
||||
hbm.key.copyToolAlt=Інструмент копіювання: Перемикнути вставку
|
||||
hbm.key.copyToolCtrl=Інструмент копіювання: Застосувати до труб
|
||||
hbm.key.craneLoad=Завантажити/Розвантажити кран
|
||||
hbm.key.craneMoveDown=Рухати кран назад
|
||||
hbm.key.craneMoveLeft=Рухати кран вліво
|
||||
hbm.key.craneMoveRight=Рухати кран вправо
|
||||
hbm.key.craneMoveUp=Рухати кран вперед
|
||||
hbm.key.dash=Ривок
|
||||
hbm.key.gunPrimary=Основний вогонь
|
||||
hbm.key.gunSecondary=Альтернативний вогонь
|
||||
hbm.key.gunTertitary=Приціл
|
||||
hbm.key.toggleBack=Перемикання реактивного ранця
|
||||
hbm.key.toggleHUD=Перемикання HUD
|
||||
hbm.key.toggleMagnet=Перемикання магніта
|
||||
hbm.key.trainInv=Інвентар поїзда
|
||||
hbm.key.reload=Перезарядити
|
||||
|
||||
hbmfluid.air=Стиснене повітря
|
||||
hbmfluid.alumina=Оксид алюмінію
|
||||
@ -1449,8 +1469,8 @@ hbmfluid.death=Розчин осмистого іридію
|
||||
hbmfluid.deuterium=Дейтерій
|
||||
hbmfluid.diesel=Дизель
|
||||
hbmfluid.diesel_crack=Крекінговий дизель
|
||||
hbmfluid.diesel_crack_reform=Високооктановий крекінговий дизель
|
||||
hbmfluid.diesel_reform=Високооктановий дизель
|
||||
hbmfluid.diesel_crack_reform=Високоцетановий крекінговий дизель
|
||||
hbmfluid.diesel_reform=Високоцетановий дизель
|
||||
hbmfluid.egg=Розчинене яйце
|
||||
hbmfluid.estradiol=Розчин естрадіолу
|
||||
hbmfluid.ethanol=Етанол
|
||||
@ -3620,6 +3640,7 @@ item.part_barrel_light.name=Легкий ствол %s
|
||||
item.part_beryllium.name=Коробка з берилієвим пилом
|
||||
item.part_carbon.name=Коробка з вугільним пилом
|
||||
item.part_copper.name=Коробка з мідним пилом
|
||||
item.part_generic.glass_polarized.name=Поляризована лінза
|
||||
item.part_generic.hde.name=Елемент для важких умов експлуатації
|
||||
item.part_generic.lde.name=Елемент низької щільності
|
||||
item.part_generic.piston_electric.name=Електричний поршень
|
||||
@ -3685,7 +3706,7 @@ item.pellet_rtg_cobalt.name=РІТЕГ гранула кобальту-60
|
||||
item.pellet_rtg_cobalt.desc=Не найкращий як РІТЕГ, але чудовий для гамма-випромінювання!
|
||||
item.pellet_rtg_depleted.bismuth.name=Розкладена вісмутова РІТЕГ гранула
|
||||
item.pellet_rtg_depleted.lead.name=Розкладена свинцева РІТЕГ гранула
|
||||
item.pellet_rtg_depleted.neptunium.name=Розкладена немтунієва РІТЕГ гранула
|
||||
item.pellet_rtg_depleted.neptunium.name=Розкладена нептунієва РІТЕГ гранула
|
||||
item.pellet_rtg_depleted.mercury.name=Розкладена ртутна РІТЕГ гранула
|
||||
item.pellet_rtg_depleted.nickel.name=Розкладена нікелева РІТЕГ гранула
|
||||
item.pellet_rtg_depleted.zirconium.name=Розкладена цирконієва РІТЕГ гранула
|
||||
@ -5288,6 +5309,7 @@ tile.floodlight.name=Потужний прожектор
|
||||
tile.fluid_duct.name=Універсальний рідинний трубопровід (Застаріло)
|
||||
tile.fluid_duct_box.name=Універсальний рідинний трубопровід (Boxduct)
|
||||
tile.fluid_duct_exhaust.name=Вихлопна труба
|
||||
tile.fluid_duct_paintable_block_exhaust.name=Вихлопна труба з покриттям
|
||||
tile.fluid_duct_gauge.name=Вимірювальна труба
|
||||
tile.fluid_duct_gauge.desc=Труба, що показує, скільки рідини$переміщується в мережі за один тік.$Розділені мережі, з'єднані бочками$або цистернами, вважаються однією спільною мережею.
|
||||
tile.fluid_duct_neo.name=Універсальний рідинний трубопровід
|
||||
@ -5346,6 +5368,7 @@ tile.geiger.name=Лічильник Гейгера
|
||||
tile.glass_ash.name=Попелясте скло
|
||||
tile.glass_boron.name=Борне скло
|
||||
tile.glass_lead.name=Свинцеве скло
|
||||
tile.glass_polarized.name=Поляризоване скло
|
||||
tile.glass_polonium.name=Полонієве скло
|
||||
tile.glass_quartz.name=Кварцове скло
|
||||
tile.glass_trinitite.name=Тринітитове скло
|
||||
@ -5369,10 +5392,6 @@ tile.hadron_coil_neodymium.name=Щільна неодимова котушка
|
||||
tile.hadron_coil_schrabidate.name=Щільна шрабідатова котушка
|
||||
tile.hadron_coil_schrabidium.name=Щільна шрабідієва котушка
|
||||
tile.hadron_coil_starmetal.name=Щільна котушка з зіркового металу
|
||||
tile.hadron_cooler.name=Блок охолодження прискорювача частинок
|
||||
tile.hadron_cooler.desc=Cooling power: 10$Overcooling threshold: 10$Cooling bonus: +10%%$Overcooling penalty: -25%%
|
||||
tile.hadron_cooler_mk2.name=Particle Accelerator Cooling Unit - The Palindrome Special
|
||||
tile.hadron_cooler_mk2.desc=Cooling power: 5$Efficiency function: 2-(cooling-15)²/225$Maximum penalty: -90%%
|
||||
tile.hadron_core.name=Particle Accelerator Core Component
|
||||
tile.hadron_diode.name=Schottky Particle Diode
|
||||
tile.hadron_plating.name=Particle Accelerator Plating
|
||||
@ -5482,8 +5501,11 @@ tile.machine_boiler_off.name=Старий бойлер
|
||||
tile.machine_catalytic_cracker.name=Вежа каталітичного крекінгу
|
||||
tile.machine_catalytic_reformer.name=Каталітичний риформер
|
||||
tile.machine_centrifuge.name=Центрифуга
|
||||
tile.machine_chemfac.name=Хімічна фабрика
|
||||
tile.machine_chemplant.name=Хімічний завод
|
||||
tile.machine_chemfac.name=Хімічна фабрика (Застаріла)
|
||||
tile.machine_chemical_factory.name=Хімічна фабрика
|
||||
tile.machine_chemical_factory.desc=Четверний хімічний завод.$Рецепти обробляються вдвічі швидше,$але потребують вдвічі більше енергії.$Потрібно охолодження водою,$виробляє пару низького тиску.
|
||||
tile.machine_chemical_plant.name=Хімічний завод
|
||||
tile.machine_chemplant.name=Хімічний завод (Застарілий)
|
||||
tile.machine_chungus.name=Парова турбіна "Левіафан"
|
||||
tile.machine_chungus.desc=Ефективність: 85%%
|
||||
tile.machine_coal_off.name=Combustion Generator
|
||||
@ -5798,7 +5820,7 @@ tile.pump_electric.desc=Використовує електроенергію д
|
||||
tile.pump_steam.name=Паровий насос ґрунтових вод
|
||||
tile.pump_steam.desc=Використовує пару для відкачування ґрунтових вод$Генерує до 1,000mB/t$Повинен бути розміщений нижче Y:70
|
||||
tile.pwr_block.name=ВВЕР
|
||||
tile.pwr_casing.name=Корпус рекатора ВВЕР
|
||||
tile.pwr_casing.name=Корпус реактора ВВЕР
|
||||
tile.pwr_casing.desc=Потрібно покрити всі внутрішні частини реактора для формування$Розміщення: Корпус
|
||||
tile.pwr_channel.name=Канал теплоносія ВВЕР
|
||||
tile.pwr_channel.desc=Використовує тепло корпусу для нагрівання охолоджувальної рідини$Розміщення: Будь-яке
|
||||
@ -6135,6 +6157,7 @@ tool.ability.centrifuge=Автоцентрифуга
|
||||
tool.ability.crystallizer=Автокристалізатор
|
||||
tool.ability.explosion=Вибух
|
||||
tool.ability.hammer=Зона дії
|
||||
tool.ability.hammer_flat=Плоска зона дії
|
||||
tool.ability.luck=Вдача
|
||||
tool.ability.mercury=Ртутний дотик
|
||||
tool.ability.midas=Дотик Мідаса
|
||||
@ -6158,12 +6181,13 @@ upgrade.acid=Необхідна кислота %s
|
||||
upgrade.burn=Burn %smb/t for %sHE
|
||||
upgrade.consumption=Споживання %s
|
||||
upgrade.coolantConsumption=Витрата охолоджувальної рідини %s
|
||||
upgrade.delay=Швидкість роботи %s
|
||||
upgrade.delay=Час роботи %s
|
||||
upgrade.efficiency=Ефективність %s
|
||||
upgrade.fortune=Вдача %s
|
||||
upgrade.overheatChance=Ймовірність перегріву %s
|
||||
upgrade.productivity=Продуктивність %s
|
||||
upgrade.range=Радіус %s
|
||||
upgrade.speed=Швидкість роботи %s
|
||||
|
||||
upgrade.gui.title=§lДопустимі покращення:§r
|
||||
upgrade.gui.afterburner= * §dФорсаж§r: Складається до %s рівнів
|
||||
|
||||
@ -1340,8 +1340,8 @@ hbmfluid.death=锇酸溶液
|
||||
hbmfluid.deuterium=氘
|
||||
hbmfluid.diesel=柴油
|
||||
hbmfluid.diesel_crack=裂化柴油
|
||||
hbmfluid.diesel_crack_reform=高辛烷值裂化柴油
|
||||
hbmfluid.diesel_reform=高辛烷值柴油
|
||||
hbmfluid.diesel_crack_reform=高十六烷值裂化柴油
|
||||
hbmfluid.diesel_reform=高十六烷值柴油
|
||||
hbmfluid.egg=蛋溶解液
|
||||
hbmfluid.estradiol=雌二醇溶液
|
||||
hbmfluid.ethanol=乙醇
|
||||
@ -5021,6 +5021,7 @@ tile.floodlight.name=电力泛光灯
|
||||
tile.fluid_duct.name=通用流体管道
|
||||
tile.fluid_duct_box.name=通用流体管道(方形)
|
||||
tile.fluid_duct_exhaust.name=排气管
|
||||
tile.fluid_duct_paintable_block_exhaust.name=具有涂装性的排气管
|
||||
tile.fluid_duct_gauge.name=流量计管
|
||||
tile.fluid_duct_gauge.desc=显示每个游戏刻在管网有多少流体移动的管道$由桶或罐连接的分离网络被视为一个共享网络。
|
||||
tile.fluid_duct_neo.name=通用流体管道
|
||||
@ -5101,10 +5102,6 @@ tile.hadron_coil_neodymium.name=致密钕线圈
|
||||
tile.hadron_coil_schrabidate.name=致密Sa酸铁线圈
|
||||
tile.hadron_coil_schrabidium.name=致密Sa326线圈
|
||||
tile.hadron_coil_starmetal.name=致密星辉线圈
|
||||
tile.hadron_cooler.name=粒子加速器冷却装置
|
||||
tile.hadron_cooler.desc=冷却功率:10$过冷阈值:10$冷却加成:+10%%$过冷惩罚:-25%%
|
||||
tile.hadron_cooler_mk2.name=粒子加速器冷却装置-回文特制
|
||||
tile.hadron_cooler_mk2.desc=冷却功率:5$效率功能:2-(冷却-15)²/225$最高惩罚:-90%%
|
||||
tile.hadron_core.name=粒子加速器核心组件
|
||||
tile.hadron_diode.name=肖基特二极管
|
||||
tile.hadron_plating.name=粒子加速器镀层
|
||||
@ -5824,6 +5821,7 @@ tool.ability.centrifuge=自动离心
|
||||
tool.ability.crystallizer=自动结晶
|
||||
tool.ability.explosion=爆破
|
||||
tool.ability.hammer=范围挖掘
|
||||
tool.ability.flat_hammer=平坦區域採礦
|
||||
tool.ability.luck=时运
|
||||
tool.ability.mercury=水银提取
|
||||
tool.ability.midas=点石成金
|
||||
@ -6101,3 +6099,7 @@ tile.fan.falloffOff=稳定的风扇功率
|
||||
tile.glass_polarized.name=偏光玻璃
|
||||
tile.machine_autosaw.suspended=暂停
|
||||
tile.machine_chemical_plant.name=化工厂二代 : 电子布加洛
|
||||
hbm.key.ability=循环工具能力
|
||||
hbm.key.abilityAlt=配置工具能力
|
||||
hbm.key.toggleMagnet=开关磁铁
|
||||
upgrade.speed=工作速度 %s
|
||||
|
||||
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