Merge branch 'HbmMods:master' into AAAAAAAAAAAAAAA
64
changelog
@ -1,58 +1,12 @@
|
||||
## Added
|
||||
* `/ntmserver`
|
||||
* Functions like `/ntmclient` but for common settings
|
||||
* Can toggle `DAMAGE_COMPATIBILITY_MODE`, off by default, enables a more compatible (but slightly jankier) version of the bullet damage code
|
||||
* `MINE_<xxx>_DAMAGE` can be used to adjust landmine damage
|
||||
* `TAINT_TRAILS` now replaces the hardcore taint config option, making taint blocks more potent and the potion effect trail taint blocks
|
||||
* New ammo types
|
||||
* Explosive 7.62mm
|
||||
* Explosive .50 BMG
|
||||
* Explosive 10 gauge buckshot (unlike 12 gauge which has explosive slugs)
|
||||
* Lincoln's repeater, a b-side to the lever action rifle
|
||||
* Weapon modification table
|
||||
* All weapon tiers have generic upgrades for increasing damage and durability
|
||||
* Many guns have specialized attachments. Some examples:
|
||||
* The assault rifle can use silencers, scopes, can have its stock removed and has two different polymer furnitures
|
||||
* .44 revolvers can use scopes
|
||||
* All full-length shotguns can have their barrel sawed off
|
||||
* Most shotguns can make use of a choke to decrease projectile spread (does not work with sawed-offs)
|
||||
* The grease gun has a modernization package, replacing most parts and increasing most stats
|
||||
* Some guns have special mod combos that will change the name
|
||||
|
||||
## Changed
|
||||
* Fat mines now use the standardized mini nuke code
|
||||
* Fat mines now have a base damage of exactly 100, being identical to demolition mini nukes
|
||||
* Fat mines now gib affected entities
|
||||
* IV bags now use `setHealth` operations instead of dealing damage, preventing health duplication by just avoiding the damage
|
||||
* The settings tool can now copy and paste the "paint" from paintable cables and fluid ducts
|
||||
* Changed the way taint works
|
||||
* Instead of neon purple vines, taint is bow a greyish sludge
|
||||
* Taint now actively replaces blocks instead of growing along them
|
||||
* Taint is still limited in spread, however taint spread is lower underground, taint decays three times faster in intensity if the block is not exposed to air, making taint spread more along the surface
|
||||
* Taint has a 25% chance of splashing down when replacing a block with no supports, causing structures to collapse and taint to spread faster
|
||||
* Similar to soil sand, entities will sink in taint and get slowed down
|
||||
* The sludge consumeth
|
||||
* `enableGuns` config option now applies to SEDNA system guns, simply canceling all gun-related keybinds
|
||||
* Cinnabar dust, if registered by another mod, can now be acidized into cinnabar using hydrogen peroxide
|
||||
* Copper wires, like AA and gold, can now be welded into dense wires
|
||||
* Removed the crafting recipe for the small geothermal generator and ZPE generators
|
||||
* Removed the gemothermal, ZPE and ambient radiation generators from the creative menu
|
||||
* Disabled the horrid flicker on the quad rocket launcher's antenna, making steered mode look less terrible
|
||||
* All non-legendary .357 revolvers now fire a quarter of a second faster
|
||||
* Changed the detonator's recipe to be less archaic
|
||||
* Crates can now be opened when held
|
||||
* Crates will not longer show their contents when locked
|
||||
* Crates found in structures will sometimes contain things that aren't items
|
||||
* The toolbox' functionality has been completely changed (thanks gamma)
|
||||
* Instead of a crappy backpack substitute that doesn't work half the time, the toolbox can quickly swap out the hotbar when used
|
||||
* Updated StG 77 recipe to use two grips and a proper scope
|
||||
* Buffed the RPA set
|
||||
* Tiered damage and durability weapon mods are now craftable
|
||||
* Duct tape is now cheaper and less ugly
|
||||
|
||||
## Fixed
|
||||
* Fixed animation errors on the MAS-36
|
||||
* Fixed drone docks, requester and provider crates not dropping their contents when broken
|
||||
* Fixed all missing texture errors that appear in the startup log
|
||||
* Potentially fixed a crash with mekanism during the recipe change phase
|
||||
* Removed the coke to heavy oil recipe for allowing infinite oil loops
|
||||
* Coke to syngas and coalgas recipes should be fine though, so they stay
|
||||
* Potentially fixed another issue regarding NPCs firing belt-fed guns
|
||||
* Chunk-loading drones may or may not be fixed
|
||||
* Fixed disperser canisters not actually despawning on impact, endlessly spawning mist clouds
|
||||
* Fixed issues where the new packet system didn't play nice with machines that are being sent packets by other machines, like watz segments and radar screens
|
||||
* Fixed fat man's piston not being extended correctly in non-first person rendering when unloaded
|
||||
* Fixed a bunch of singleblocks not accepting fluids (thanks mellow)
|
||||
* Fixed fluid valves not properly disconnecting
|
||||
* Fixed a dupe regarding the weapon mod table
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
mod_version=1.0.27
|
||||
# Empty build number makes a release type
|
||||
mod_build_number=5257
|
||||
mod_build_number=5279
|
||||
|
||||
credits=HbMinecraft,\
|
||||
\ rodolphito (explosion algorithms),\
|
||||
|
||||
@ -11,22 +11,22 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@Deprecated
|
||||
public interface IFluidStandardReceiver extends IFluidStandardReceiverMK2 {
|
||||
|
||||
|
||||
public default void subscribeToAllAround(FluidType type, TileEntity tile) {
|
||||
subscribeToAllAround(type, tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord);
|
||||
}
|
||||
|
||||
|
||||
public default void subscribeToAllAround(FluidType type, World world, int x, int y, int z) {
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
trySubscribe(type, world, x, y, z, dir);
|
||||
trySubscribe(type, world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, dir);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public default void tryUnsubscribe(FluidType type, World world, int x, int y, int z) {
|
||||
GenNode node = UniNodespace.getNode(world, x, y, z, type.getNetworkProvider());
|
||||
if(node != null && node.net != null) node.net.removeReceiver(this);
|
||||
}
|
||||
|
||||
|
||||
public default void unsubscribeToAllAround(FluidType type, TileEntity tile) {
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
tryUnsubscribe(type, tile.getWorldObj(), tile.xCoord + dir.offsetX, tile.yCoord + dir.offsetY, tile.zCoord + dir.offsetZ);
|
||||
|
||||
@ -88,9 +88,11 @@ public class FluidNetMK2 extends NodeNet<IFluidReceiverMK2, IFluidProviderMK2, F
|
||||
|
||||
for(int p = 0; p <= IFluidUserMK2.HIGHEST_VALID_PRESSURE; p++) { // if the pressure range were ever to increase, we might have to rethink this
|
||||
|
||||
long totalAvailable = fluidAvailable[p];
|
||||
|
||||
for(int i = ConnectionPriority.values().length - 1; i >= 0; i--) {
|
||||
|
||||
long toTransfer = Math.min(fluidDemand[p][i], fluidAvailable[p]);
|
||||
long toTransfer = Math.min(fluidDemand[p][i], totalAvailable);
|
||||
if(toTransfer <= 0) continue;
|
||||
|
||||
long priorityDemand = fluidDemand[p][i];
|
||||
@ -102,6 +104,8 @@ public class FluidNetMK2 extends NodeNet<IFluidReceiverMK2, IFluidProviderMK2, F
|
||||
received[p] += toSend;
|
||||
fluidTracker += toSend;
|
||||
}
|
||||
|
||||
totalAvailable -= received[p];
|
||||
}
|
||||
|
||||
notAccountedFor[p] = received[p];
|
||||
|
||||
@ -24,29 +24,29 @@ public interface IFluidStandardSenderMK2 extends IFluidProviderMK2 {
|
||||
public default void tryProvide(FluidTank tank, World world, DirPos pos) { tryProvide(tank.getTankType(), tank.getPressure(), world, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); }
|
||||
public default void tryProvide(FluidType type, World world, DirPos pos) { tryProvide(type, 0, world, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); }
|
||||
public default void tryProvide(FluidType type, int pressure, World world, DirPos pos) { tryProvide(type, pressure, world, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); }
|
||||
|
||||
|
||||
public default void tryProvide(FluidTank tank, World world, int x, int y, int z, ForgeDirection dir) { tryProvide(tank.getTankType(), tank.getPressure(), world, x, y, z, dir); }
|
||||
public default void tryProvide(FluidType type, World world, int x, int y, int z, ForgeDirection dir) { tryProvide(type, 0, world, x, y, z, dir); }
|
||||
|
||||
|
||||
public default void tryProvide(FluidType type, int pressure, World world, int x, int y, int z, ForgeDirection dir) {
|
||||
|
||||
TileEntity te = Compat.getTileStandard(world, x, y, z);
|
||||
boolean red = false;
|
||||
|
||||
|
||||
if(te instanceof IFluidConnectorMK2) {
|
||||
IFluidConnectorMK2 con = (IFluidConnectorMK2) te;
|
||||
if(con.canConnect(type, dir.getOpposite())) {
|
||||
|
||||
|
||||
GenNode<FluidNetMK2> node = UniNodespace.getNode(world, x, y, z, type.getNetworkProvider());
|
||||
|
||||
|
||||
if(node != null && node.net != null) {
|
||||
node.net.addProvider(this);
|
||||
red = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(te instanceof IFluidReceiverMK2 && te != this) {
|
||||
|
||||
if(te != this && te instanceof IFluidReceiverMK2) {
|
||||
IFluidReceiverMK2 rec = (IFluidReceiverMK2) te;
|
||||
if(rec.canConnect(type, dir.getOpposite())) {
|
||||
long provides = Math.min(this.getFluidAvailable(type, pressure), this.getProviderSpeed(type, pressure));
|
||||
@ -56,7 +56,7 @@ public interface IFluidStandardSenderMK2 extends IFluidProviderMK2 {
|
||||
this.useUpFluid(type, pressure, toTransfer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(particleDebug) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "network");
|
||||
@ -71,9 +71,9 @@ public interface IFluidStandardSenderMK2 extends IFluidProviderMK2 {
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, posX, posY, posZ), new TargetPoint(world.provider.dimensionId, posX, posY, posZ, 25));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public FluidTank[] getSendingTanks();
|
||||
|
||||
|
||||
@Override
|
||||
public default long getFluidAvailable(FluidType type, int pressure) {
|
||||
long amount = 0;
|
||||
@ -112,14 +112,14 @@ public interface IFluidStandardSenderMK2 extends IFluidProviderMK2 {
|
||||
public default int[] getProvidingPressureRange(FluidType type) {
|
||||
int lowest = HIGHEST_VALID_PRESSURE;
|
||||
int highest = 0;
|
||||
|
||||
|
||||
for(FluidTank tank : getSendingTanks()) {
|
||||
if(tank.getTankType() == type) {
|
||||
if(tank.getPressure() < lowest) lowest = tank.getPressure();
|
||||
if(tank.getPressure() > highest) highest = tank.getPressure();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return lowest <= highest ? new int[] {lowest, highest} : DEFAULT_PRESSURE_RANGE;
|
||||
}
|
||||
|
||||
|
||||
@ -28,9 +28,9 @@ import net.minecraft.item.ItemStack;
|
||||
* @author hbm
|
||||
*/
|
||||
public class ToolRecipes {
|
||||
|
||||
|
||||
public static void register() {
|
||||
|
||||
|
||||
//Regular tools
|
||||
addSword( STEEL.ingot(), ModItems.steel_sword);
|
||||
addPickaxe( STEEL.ingot(), ModItems.steel_pickaxe);
|
||||
@ -62,7 +62,7 @@ public class ToolRecipes {
|
||||
addAxe( DESH.ingot(), ModItems.desh_axe);
|
||||
addShovel( DESH.ingot(), ModItems.desh_shovel);
|
||||
addHoe( DESH.ingot(), ModItems.desh_hoe);
|
||||
|
||||
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.elec_sword, 1), new Object[] { "RPR", "RPR", " B ", 'P', ANY_PLASTIC.ingot(), 'D', DURA.ingot(), 'R', DURA.bolt(), 'M', ModItems.motor, 'B', ModItems.battery_lithium });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.elec_pickaxe, 1), new Object[] { "RDM", " PB", " P ", 'P', ANY_PLASTIC.ingot(), 'D', DURA.ingot(), 'R', DURA.bolt(), 'M', ModItems.motor, 'B', ModItems.battery_lithium });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.elec_axe, 1), new Object[] { " DP", "RRM", " PB", 'P', ANY_PLASTIC.ingot(), 'D', DURA.ingot(), 'R', DURA.bolt(), 'M', ModItems.motor, 'B', ModItems.battery_lithium });
|
||||
@ -90,7 +90,7 @@ public class ToolRecipes {
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.chlorophyte_axe, 1), new Object[] { " SD", "APS", "FA ", 'S', ModItems.blades_steel, 'D', ModItems.powder_chlorophyte, 'A', FIBER.ingot(), 'P', ModItems.bismuth_axe, 'F', DURA.bolt() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.chlorophyte_axe, 1), new Object[] { " SD", "APS", "FA ", 'S', ModItems.blades_steel, 'D', ModItems.powder_chlorophyte, 'A', FIBER.ingot(), 'P', ModItems.volcanic_axe, 'F', DURA.bolt() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.mese_axe, 1), new Object[] { " SD", "APS", "FA ", 'S', ModItems.blades_desh, 'D', ModItems.powder_dineutronium, 'A', ModItems.plate_paa, 'P', ModItems.chlorophyte_axe, 'F', ModItems.shimmer_handle });
|
||||
|
||||
|
||||
//Chainsaws
|
||||
CraftingManager.addRecipeAuto(ItemToolAbilityFueled.getEmptyTool(ModItems.chainsaw), new Object[] { "CCH", "BBP", "CCE", 'H', STEEL.shell(), 'B', ModItems.blades_steel, 'P', ModItems.piston_selenium, 'C', ModBlocks.chain, 'E', ModItems.canister_empty });
|
||||
|
||||
@ -150,7 +150,7 @@ public class ToolRecipes {
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.power_net_tool), new Object[] { "WRW", " I ", " B ", 'W', MINGRADE.wireFine(), 'R', REDSTONE.dust(), 'I', IRON.ingot(), 'B', ModItems.battery_generic });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.analysis_tool), new Object[] { " G", " S ", "S ", 'G', KEY_ANYPANE, 'S', STEEL.ingot() });
|
||||
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.kit_toolbox_empty), new Object[] { "CCC", "CIC", 'C', CU.plate(), 'I', IRON.ingot() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.toolbox), new Object[] { "CCC", "CIC", 'C', CU.plate(), 'I', IRON.ingot() });
|
||||
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.screwdriver, 1), new Object[] { " I", " I ", "S ", 'S', STEEL.ingot(), 'I', IRON.ingot() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.screwdriver_desh, 1), new Object[] { " I", " I ", "S ", 'S', ANY_PLASTIC.ingot(), 'I', DESH.ingot() });
|
||||
@ -161,24 +161,24 @@ public class ToolRecipes {
|
||||
CraftingManager.addRecipeAuto(ItemBlowtorch.getEmptyTool(ModItems.blowtorch), new Object[] { "CC ", " I ", "CCC", 'C', CU.plate528(), 'I', IRON.ingot() });
|
||||
CraftingManager.addRecipeAuto(ItemBlowtorch.getEmptyTool(ModItems.acetylene_torch), new Object[] { "SS ", " PS", " T ", 'S', STEEL.plate528(), 'P', ANY_PLASTIC.ingot(), 'T', ModItems.tank_steel });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.boltgun), new Object[] { "DPS", " RD", " D ", 'D', DURA.ingot(), 'P', DictFrame.fromOne(ModItems.part_generic, EnumPartType.PISTON_PNEUMATIC), 'R', RUBBER.ingot(), 'S', STEEL.shell() });
|
||||
|
||||
|
||||
//Bobmazon
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.bobmazon), new Object[] { Items.book, Items.gold_nugget, Items.string, KEY_BLUE });
|
||||
|
||||
|
||||
//Carts
|
||||
CraftingManager.addRecipeAuto(ItemModMinecart.createCartItem(EnumCartBase.WOOD, EnumMinecart.EMPTY), new Object[] { "P P", "WPW", 'P',KEY_SLAB, 'W', KEY_PLANKS });
|
||||
CraftingManager.addRecipeAuto(ItemModMinecart.createCartItem(EnumCartBase.STEEL, EnumMinecart.EMPTY), new Object[] { "P P", "IPI", 'P', STEEL.plate(), 'I', STEEL.ingot() });
|
||||
CraftingManager.addShapelessAuto(ItemModMinecart.createCartItem(EnumCartBase.PAINTED, EnumMinecart.EMPTY), new Object[] { ItemModMinecart.createCartItem(EnumCartBase.STEEL, EnumMinecart.EMPTY), KEY_RED });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.boat_rubber), new Object[] { "L L", "LLL", 'L', ANY_RUBBER.ingot() });
|
||||
|
||||
|
||||
for(EnumCartBase base : EnumCartBase.values()) {
|
||||
|
||||
|
||||
if(EnumMinecart.DESTROYER.supportsBase(base)) CraftingManager.addRecipeAuto(ItemModMinecart.createCartItem(base, EnumMinecart.DESTROYER), new Object[] { "S S", "BLB", "SCS", 'S', STEEL.ingot(), 'B', ModItems.blades_steel, 'L', Fluids.LAVA.getDict(1000), 'C', ItemModMinecart.createCartItem(base, EnumMinecart.EMPTY) });
|
||||
if(EnumMinecart.POWDER.supportsBase(base)) CraftingManager.addRecipeAuto(ItemModMinecart.createCartItem(base, EnumMinecart.POWDER), new Object[] { "PPP", "PCP", "PPP", 'P', Items.gunpowder, 'C', ItemModMinecart.createCartItem(base, EnumMinecart.EMPTY) });
|
||||
if(EnumMinecart.SEMTEX.supportsBase(base)) CraftingManager.addRecipeAuto(ItemModMinecart.createCartItem(base, EnumMinecart.SEMTEX), new Object[] { "S", "C", 'S', ModBlocks.semtex, 'C', ItemModMinecart.createCartItem(base, EnumMinecart.EMPTY) });
|
||||
}
|
||||
net.minecraft.item.crafting.CraftingManager.getInstance().addRecipe(DictFrame.fromOne(ModItems.cart, EnumMinecart.CRATE), new Object[] { "C", "S", 'C', ModBlocks.crate_steel, 'S', Items.minecart }).func_92100_c();
|
||||
|
||||
|
||||
//Configged
|
||||
if(GeneralConfig.enableLBSM && GeneralConfig.enableLBSMSimpleToolRecipes) {
|
||||
addSword( CO.block(), ModItems.cobalt_decorated_sword);
|
||||
@ -234,11 +234,11 @@ public class ToolRecipes {
|
||||
public static void addHoe(Object ingot, Item hoe) {
|
||||
addTool(ingot, hoe, patternHoe);
|
||||
}
|
||||
|
||||
|
||||
public static void addTool(Object ingot, Item tool, String[] pattern) {
|
||||
CraftingManager.addRecipeAuto(new ItemStack(tool), new Object[] { pattern, 'X', ingot, '#', KEY_STICK });
|
||||
}
|
||||
|
||||
|
||||
public static final String[] patternSword = new String[] {"X", "X", "#"};
|
||||
public static final String[] patternPick = new String[] {"XXX", " # ", " # "};
|
||||
public static final String[] patternAxe = new String[] {"XX", "X#", " #"};
|
||||
|
||||
@ -16,6 +16,8 @@ import com.hbm.items.ModItems;
|
||||
import com.hbm.items.weapon.GunB92Cell;
|
||||
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo;
|
||||
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmoSecret;
|
||||
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumModGeneric;
|
||||
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumModSpecial;
|
||||
import com.hbm.main.CraftingManager;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
@ -84,7 +86,7 @@ public class WeaponRecipes {
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_minigun, 1), new Object[] { "BMG", "BRE", "BGM", 'B', ANY_RESISTANTALLOY.lightBarrel(), 'M', WEAPONSTEEL.mechanism(), 'G', ANY_PLASTIC.grip(), 'R', ANY_RESISTANTALLOY.heavyReceiver(), 'E', ModItems.motor_desh });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_missile_launcher, 1), new Object[] { " CM", "BBB", "G ", 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED), 'M', WEAPONSTEEL.mechanism(), 'B', ANY_RESISTANTALLOY.heavyBarrel(), 'G', ANY_PLASTIC.grip() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_tesla_cannon, 1), new Object[] { "CCC", "BRB", "MGE", 'C', ModItems.coil_advanced_alloy, 'B', ANY_RESISTANTALLOY.heavyBarrel(), 'R', ANY_RESISTANTALLOY.heavyReceiver(), 'M', WEAPONSTEEL.mechanism(), 'G', ANY_PLASTIC.grip(), 'E', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED) });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_stg77, 1), new Object[] { " D ", "BRS", "GM ", 'D', DIAMOND.gem(), 'B', BIGMT.lightBarrel(), 'R', BIGMT.lightReceiver(), 'S', ANY_HARDPLASTIC.stock(), 'G', ANY_HARDPLASTIC.grip(), 'M', BIGMT.mechanism() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_stg77, 1), new Object[] { " D ", "BRS", "GGM", 'D', DictFrame.fromOne(ModItems.weapon_mod_special, EnumModSpecial.SCOPE), 'B', BIGMT.lightBarrel(), 'R', BIGMT.lightReceiver(), 'S', ANY_HARDPLASTIC.stock(), 'G', ANY_HARDPLASTIC.grip(), 'M', BIGMT.mechanism() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_fatman, 1), new Object[] { "PPP", "BSR", "G M", 'P', BIGMT.plate(), 'B', BIGMT.heavyBarrel(), 'S', BIGMT.shell(), 'R', BIGMT.heavyReceiver(), 'G', ANY_HARDPLASTIC.grip(), 'M', BIGMT.mechanism() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_tau, 1), new Object[] { " RD", "CTT", "GMS", 'D', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.BISMOID), 'C', CU.pipe(), 'T', ModItems.coil_advanced_torus, 'G', ANY_HARDPLASTIC.grip(), 'R', BIGMT.lightReceiver(), 'M', BIGMT.mechanism(), 'S', ANY_HARDPLASTIC.stock() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_lasrifle, 1), new Object[] { "LC ", "BRS", "MG ", 'L', ModItems.crystal_redstone, 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.BISMOID), 'B', ANY_BISMOIDBRONZE.lightBarrel(), 'R', ANY_BISMOIDBRONZE.lightReceiver(), 'S', ANY_HARDPLASTIC.stock(), 'M', BIGMT.mechanism(), 'G', ANY_HARDPLASTIC.grip() });
|
||||
@ -96,6 +98,39 @@ public class WeaponRecipes {
|
||||
CraftingManager.addRecipeAuto(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.STONE_SHOT, 6), new Object[] { "C", "P", "G", 'C', Blocks.gravel, 'P', Items.paper, 'G', Items.gunpowder });
|
||||
CraftingManager.addRecipeAuto(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.STONE_IRON, 6), new Object[] { "C", "P", "G", 'C', IRON.ingot(), 'P', Items.paper, 'G', Items.gunpowder });
|
||||
|
||||
//SEDNA Mods
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.weapon_mod_generic, 1, EnumModGeneric.IRON_DAMAGE.ordinal()), new Object[] { GUNMETAL.ingot(), IRON.ingot(), IRON.ingot(), IRON.ingot(), ModItems.ducttape });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.weapon_mod_generic, 1, EnumModGeneric.IRON_DURA.ordinal()), new Object[] { GUNMETAL.ingot(), IRON.ingot(), ModItems.ducttape });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.weapon_mod_generic, 1, EnumModGeneric.STEEL_DAMAGE.ordinal()), new Object[] { GUNMETAL.mechanism(), STEEL.plateCast(), STEEL.plateCast(), STEEL.plateCast(), ModItems.ducttape });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.weapon_mod_generic, 1, EnumModGeneric.STEEL_DURA.ordinal()), new Object[] { GUNMETAL.plate(), STEEL.plateCast(), ModItems.ducttape });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.weapon_mod_generic, 1, EnumModGeneric.DURA_DAMAGE.ordinal()), new Object[] { GUNMETAL.mechanism(), DURA.plateCast(), DURA.plateCast(), DURA.plateCast(), ModItems.ducttape });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.weapon_mod_generic, 1, EnumModGeneric.DURA_DURA.ordinal()), new Object[] { GUNMETAL.plate(), DURA.plateCast(), ModItems.ducttape });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.weapon_mod_generic, 1, EnumModGeneric.DESH_DAMAGE.ordinal()), new Object[] { GUNMETAL.mechanism(), DESH.plateCast(), DESH.plateCast(), DESH.plateCast(), ModItems.ducttape });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.weapon_mod_generic, 1, EnumModGeneric.DESH_DURA.ordinal()), new Object[] { GUNMETAL.plate(), DESH.plateCast(), ModItems.ducttape });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.weapon_mod_generic, 1, EnumModGeneric.WSTEEL_DAMAGE.ordinal()), new Object[] { WEAPONSTEEL.mechanism(), WEAPONSTEEL.plateCast(), WEAPONSTEEL.plateCast(), WEAPONSTEEL.plateCast(), ModItems.ducttape });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.weapon_mod_generic, 1, EnumModGeneric.WSTEEL_DURA.ordinal()), new Object[] { WEAPONSTEEL.plate(), WEAPONSTEEL.plateCast(), ModItems.ducttape });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.weapon_mod_generic, 1, EnumModGeneric.FERRO_DAMAGE.ordinal()), new Object[] { WEAPONSTEEL.mechanism(), FERRO.plateCast(), FERRO.plateCast(), FERRO.plateCast(), ModItems.ducttape });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.weapon_mod_generic, 1, EnumModGeneric.FERRO_DURA.ordinal()), new Object[] { WEAPONSTEEL.plate(), FERRO.plateCast(), ModItems.ducttape });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.weapon_mod_generic, 1, EnumModGeneric.TCALLOY_DAMAGE.ordinal()), new Object[] { WEAPONSTEEL.mechanism(), ANY_RESISTANTALLOY.plateCast(), ANY_RESISTANTALLOY.plateCast(), ANY_RESISTANTALLOY.plateCast(), ModItems.ducttape });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.weapon_mod_generic, 1, EnumModGeneric.TCALLOY_DURA.ordinal()), new Object[] { WEAPONSTEEL.plate(), ANY_RESISTANTALLOY.plateCast(), ModItems.ducttape });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.weapon_mod_generic, 1, EnumModGeneric.BIGMT_DAMAGE.ordinal()), new Object[] { BIGMT.mechanism(), BIGMT.plateCast(), BIGMT.plateCast(), BIGMT.plateCast(), ModItems.ducttape });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.weapon_mod_generic, 1, EnumModGeneric.BIGMT_DURA.ordinal()), new Object[] { BIGMT.plate(), BIGMT.plateCast(), ModItems.ducttape });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.weapon_mod_generic, 1, EnumModGeneric.BRONZE_DAMAGE.ordinal()), new Object[] { BIGMT.mechanism(), ANY_BISMOIDBRONZE.plateCast(), ANY_BISMOIDBRONZE.plateCast(), ANY_BISMOIDBRONZE.plateCast(), ModItems.ducttape });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.weapon_mod_generic, 1, EnumModGeneric.BRONZE_DURA.ordinal()), new Object[] { BIGMT.plate(), ANY_BISMOIDBRONZE.plateCast(), ModItems.ducttape });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.weapon_mod_special, 1, EnumModSpecial.SILENCER.ordinal()), new Object[] { "P", "B", "P", 'P', ANY_PLASTIC.ingot(), 'B', STEEL.lightBarrel() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.weapon_mod_special, 1, EnumModSpecial.SCOPE.ordinal()), new Object[] { "SPS", "G G", "SPS", 'P', ANY_PLASTIC.ingot(), 'S', STEEL.plate(), 'G', KEY_ANYPANE });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.weapon_mod_special, 1, EnumModSpecial.SAW.ordinal()), new Object[] { "BBS", "BHB", 'B', STEEL.bolt(), 'S', KEY_STICK, 'H', DURA.plate() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.weapon_mod_special, 1, EnumModSpecial.SPEEDLOADER.ordinal()), new Object[] { " B ", "BSB", " B ", 'B', STEEL.bolt(), 'S', WEAPONSTEEL.plate() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.weapon_mod_special, 1, EnumModSpecial.SLOWDOWN.ordinal()), new Object[] { " I ", " M ", "I I", 'I', WEAPONSTEEL.ingot(), 'M', WEAPONSTEEL.mechanism() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.weapon_mod_special, 1, EnumModSpecial.SPEEDUP.ordinal()), new Object[] { "PIP", "WWW", "PIP", 'P', WEAPONSTEEL.plate(), 'I', GUNMETAL.ingot(), 'W', GOLD.wireDense() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.weapon_mod_special, 1, EnumModSpecial.GREASEGUN.ordinal()), new Object[] { "BRM", "P G", 'B', WEAPONSTEEL.lightBarrel(), 'R', WEAPONSTEEL.lightReceiver(), 'M', WEAPONSTEEL.mechanism(), 'P', DURA.plate(), 'G', ANY_PLASTIC.grip() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.weapon_mod_special, 1, EnumModSpecial.CHOKE.ordinal()), new Object[] { "P", "B", "P", 'P', WEAPONSTEEL.plate(), 'B', DURA.lightBarrel() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.weapon_mod_special, 1, EnumModSpecial.FURNITURE_GREEN.ordinal()), new Object[] { "PDS", " G", 'P', ANY_PLASTIC.ingot(), 'D', KEY_GREEN, 'S', ANY_PLASTIC.stock(), 'G', ANY_PLASTIC.grip() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.weapon_mod_special, 1, EnumModSpecial.FURNITURE_BLACK.ordinal()), new Object[] { "PDS", " G", 'P', ANY_PLASTIC.ingot(), 'D', KEY_BLACK, 'S', ANY_PLASTIC.stock(), 'G', ANY_PLASTIC.grip() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.weapon_mod_special, 1, EnumModSpecial.SKIN_SATURNITE.ordinal()), new Object[] { "BRM", " P ", 'B', BIGMT.lightBarrel(), 'R', BIGMT.lightReceiver(), 'M', BIGMT.mechanism(), 'P', BIGMT.plate() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.weapon_mod_special, 1, EnumModSpecial.STACK_MAG.ordinal()), new Object[] { "P P", "P P", "PMP", 'P', WEAPONSTEEL.plate(), 'M', BIGMT.mechanism() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.weapon_mod_special, 1, EnumModSpecial.BAYONET.ordinal()), new Object[] { " P", "BBB", 'P', WEAPONSTEEL.plate(), 'B', STEEL.bolt() });
|
||||
|
||||
//Nitra!
|
||||
CraftingManager.addShapelessAuto(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.M357_SP, 6), new Object[] { DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.M357_SP), ModItems.nitra });
|
||||
CraftingManager.addShapelessAuto(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.M44_SP, 6), new Object[] { DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.M44_SP), ModItems.nitra });
|
||||
|
||||
@ -1,68 +0,0 @@
|
||||
package com.hbm.crafting.handlers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.special.ItemKitNBT;
|
||||
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ToolboxCraftingHandler implements IRecipe {
|
||||
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting inventory, World world) {
|
||||
|
||||
int itemCount = 0;
|
||||
int kitCount = 0;
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
ItemStack stack = inventory.getStackInRowAndColumn(i % 3, i / 3);
|
||||
|
||||
if(stack != null) {
|
||||
|
||||
if(stack.getItem().hasContainerItem(stack) || !stack.getItem().doesContainerItemLeaveCraftingGrid(stack))
|
||||
return false;
|
||||
|
||||
itemCount++;
|
||||
|
||||
if(stack.getItem() == ModItems.kit_toolbox_empty) {
|
||||
kitCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return itemCount > 1 && kitCount == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult(InventoryCrafting inventory) {
|
||||
|
||||
List<ItemStack> stacks = new ArrayList();
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
ItemStack stack = inventory.getStackInRowAndColumn(i % 3, i / 3);
|
||||
|
||||
if(stack != null && stack.getItem() != ModItems.kit_toolbox_empty) {
|
||||
ItemStack copy = stack.copy();
|
||||
copy.stackSize = 1;
|
||||
stacks.add(copy);
|
||||
}
|
||||
}
|
||||
|
||||
return ItemKitNBT.create(stacks.toArray(new ItemStack[0]));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRecipeSize() {
|
||||
return 9;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRecipeOutput() {
|
||||
return new ItemStack(ModItems.kit_toolbox);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,85 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.inventory.SlotNonRetarded;
|
||||
import com.hbm.util.InventoryUtil;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import static com.hbm.items.tool.ItemToolBox.*;
|
||||
|
||||
public class ContainerToolBox extends Container {
|
||||
|
||||
private final InventoryToolBox box;
|
||||
|
||||
public ContainerToolBox(InventoryPlayer invPlayer, InventoryToolBox box) {
|
||||
this.box = box;
|
||||
this.box.openInventory();
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
for(int j = 0; j < 8; j++) {
|
||||
this.addSlotToContainer(new SlotNonRetarded(box, j + i * 8, 17 + j * 18, 49 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
for(int j = 0; j < 9; j++) {
|
||||
this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 129 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 187));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2) {
|
||||
ItemStack var3 = null;
|
||||
Slot var4 = (Slot) this.inventorySlots.get(par2);
|
||||
|
||||
if(var4 != null && var4.getHasStack()) {
|
||||
ItemStack var5 = var4.getStack();
|
||||
var3 = var5.copy();
|
||||
|
||||
if(par2 <= box.getSizeInventory() - 1) {
|
||||
if(!InventoryUtil.mergeItemStack(this.inventorySlots, var5, box.getSizeInventory(), this.inventorySlots.size(), true)) {
|
||||
return null;
|
||||
}
|
||||
} else if(!InventoryUtil.mergeItemStack(this.inventorySlots, var5, 0, box.getSizeInventory(), false)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if(var5.stackSize == 0) {
|
||||
var4.putStack(null);
|
||||
} else {
|
||||
var4.onSlotChanged();
|
||||
}
|
||||
|
||||
var4.onPickupFromSlot(p_82846_1_, var5);
|
||||
}
|
||||
|
||||
return var3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack slotClick(int index, int button, int mode, EntityPlayer player) {
|
||||
// prevents the player from moving around the currently open box
|
||||
if(mode == 2 && button == player.inventory.currentItem) return null;
|
||||
if(index == player.inventory.currentItem + 51) return null;
|
||||
return super.slotClick(index, button, mode, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return box.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onContainerClosed(EntityPlayer player) {
|
||||
super.onContainerClosed(player);
|
||||
this.box.closeInventory();
|
||||
}
|
||||
}
|
||||
@ -2,6 +2,7 @@ package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.items.weapon.sedna.ItemGunBaseNT;
|
||||
import com.hbm.items.weapon.sedna.mods.WeaponModManager;
|
||||
import com.hbm.util.InventoryUtil;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
@ -26,7 +27,7 @@ public class ContainerWeaponTable extends Container {
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack stack) {
|
||||
return stack.getItem() instanceof ItemGunBaseNT;
|
||||
return gun.getStackInSlot(0) == null && stack.getItem() instanceof ItemGunBaseNT;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -152,8 +153,33 @@ public class ContainerWeaponTable extends Container {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2) {
|
||||
return null;
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||
ItemStack copy = null;
|
||||
Slot slot = (Slot) this.inventorySlots.get(index);
|
||||
|
||||
if(slot != null && slot.getHasStack()) {
|
||||
ItemStack stack = slot.getStack();
|
||||
copy = stack.copy();
|
||||
|
||||
if(index < 8) {
|
||||
if(!InventoryUtil.mergeItemStack(this.inventorySlots, stack, 8, this.inventorySlots.size(), true)) return null;
|
||||
slot.onPickupFromSlot(player, stack);
|
||||
} else {
|
||||
if(stack.getItem() instanceof ItemGunBaseNT) {
|
||||
if(!InventoryUtil.mergeItemStack(this.inventorySlots, stack, 7, 8, false)) return null;
|
||||
} else {
|
||||
if(!InventoryUtil.mergeItemStack(this.inventorySlots, stack, 0, 7, false)) return null;
|
||||
}
|
||||
}
|
||||
|
||||
if(stack.stackSize == 0) {
|
||||
slot.putStack((ItemStack) null);
|
||||
} else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
}
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
public class ModSlot extends Slot {
|
||||
@ -171,12 +197,14 @@ public class ContainerWeaponTable extends Container {
|
||||
public void putStack(ItemStack stack) {
|
||||
super.putStack(stack);
|
||||
refreshInstalledMods();
|
||||
WeaponModManager.onInstallStack(gun.getStackInSlot(0), stack, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPickupFromSlot(EntityPlayer player, ItemStack stack) {
|
||||
super.onPickupFromSlot(player, stack);
|
||||
refreshInstalledMods();
|
||||
WeaponModManager.onUninstallStack(gun.getStackInSlot(0), stack, index);
|
||||
}
|
||||
|
||||
public void refreshInstalledMods() {
|
||||
|
||||
@ -13,43 +13,43 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUILeadBox extends GuiContainer {
|
||||
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_containment.png");
|
||||
private final InventoryLeadBox inventory;
|
||||
private ItemStack firstHeld;
|
||||
|
||||
|
||||
public GUILeadBox(InventoryPlayer invPlayer, InventoryLeadBox box) {
|
||||
super(new ContainerLeadBox(invPlayer, box));
|
||||
this.inventory = box;
|
||||
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 186;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int x, int y, float interp) {
|
||||
|
||||
|
||||
if(firstHeld == null) {
|
||||
// *very* unlikely to be incorrect on the first frame after opening, so doing this is good enough
|
||||
firstHeld = this.mc.thePlayer.getHeldItem();
|
||||
|
||||
|
||||
// if the open box has changed or disappeared, close the inventory
|
||||
} else if(this.mc.thePlayer.getHeldItem() != firstHeld) {
|
||||
//this.mc.thePlayer.closeScreen();
|
||||
//return;
|
||||
}
|
||||
|
||||
|
||||
super.drawScreen(x, y, interp);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = I18n.format(this.inventory.getInventoryName());
|
||||
|
||||
|
||||
if(inventory.hasCustomInventoryName()) {
|
||||
name = inventory.box.getDisplayName();
|
||||
name = inventory.target.getDisplayName();
|
||||
}
|
||||
|
||||
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
63
src/main/java/com/hbm/inventory/gui/GUIToolBox.java
Normal file
@ -0,0 +1,63 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import com.hbm.inventory.container.ContainerToolBox;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import static com.hbm.items.tool.ItemToolBox.*;
|
||||
|
||||
public class GUIToolBox extends GuiContainer {
|
||||
|
||||
private final static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_toolbox.png");
|
||||
private final InventoryToolBox inventory;
|
||||
private ItemStack firstHeld;
|
||||
|
||||
public GUIToolBox(InventoryPlayer invPlayer, InventoryToolBox box) {
|
||||
super(new ContainerToolBox(invPlayer, box));
|
||||
this.inventory = box;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 211;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int x, int y, float interp) {
|
||||
|
||||
if(firstHeld == null) {
|
||||
// *very* unlikely to be incorrect on the first frame after opening, so doing this is good enough
|
||||
firstHeld = this.mc.thePlayer.getHeldItem();
|
||||
|
||||
// if the open box has changed or disappeared, close the inventory
|
||||
} else if(this.mc.thePlayer.getHeldItem() != firstHeld) {
|
||||
//this.mc.thePlayer.closeScreen();
|
||||
//return;
|
||||
}
|
||||
|
||||
super.drawScreen(x, y, interp);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = I18n.format(this.inventory.getInventoryName());
|
||||
|
||||
if(inventory.hasCustomInventoryName()) {
|
||||
name = inventory.target.getDisplayName();
|
||||
}
|
||||
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 37, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
}
|
||||
}
|
||||
@ -138,7 +138,7 @@ public class Mats {
|
||||
public static final NTMMaterial MAT_STEEL = makeSmeltable(_AS + 0, STEEL, 0xAFAFAF, 0x0F0F0F, 0x4A4A4A).setAutogen(DUSTTINY, BOLT, WIRE, DUST, PLATE, CASTPLATE, WELDEDPLATE, SHELL, PIPE, BLOCK, HEAVY_COMPONENT, LIGHTBARREL, HEAVYBARREL, LIGHTRECEIVER, GRIP).m();
|
||||
public static final NTMMaterial MAT_MINGRADE = makeSmeltable(_AS + 1, MINGRADE, 0xFFBA7D, 0xAF1700, 0xE44C0F).setAutogen(WIRE, DUST, BLOCK).m();
|
||||
public static final NTMMaterial MAT_ALLOY = makeSmeltable(_AS + 2, ALLOY, 0xFF8330, 0x700000, 0xFF7318).setAutogen(WIRE, DUST, DENSEWIRE, PLATE, CASTPLATE, BLOCK, HEAVY_COMPONENT).m();
|
||||
public static final NTMMaterial MAT_DURA = makeSmeltable(_AS + 3, DURA, 0x183039, 0x030B0B, 0x376373).setAutogen(BOLT, DUST, PIPE, BLOCK, LIGHTBARREL, HEAVYBARREL, LIGHTRECEIVER, HEAVYRECEIVER, GRIP).m();
|
||||
public static final NTMMaterial MAT_DURA = makeSmeltable(_AS + 3, DURA, 0x183039, 0x030B0B, 0x376373).setAutogen(BOLT, DUST, PLATE, CASTPLATE, PIPE, BLOCK, LIGHTBARREL, HEAVYBARREL, LIGHTRECEIVER, HEAVYRECEIVER, GRIP).m();
|
||||
public static final NTMMaterial MAT_DESH = makeSmeltable(_AS + 12, DESH, 0xFF6D6D, 0x720000, 0xF22929).setAutogen(DUST, CASTPLATE, BLOCK, HEAVY_COMPONENT, LIGHTBARREL, HEAVYBARREL, LIGHTRECEIVER, STOCK, GRIP).m();
|
||||
public static final NTMMaterial MAT_STAR = makeSmeltable(_AS + 5, STAR, 0xCCCCEA, 0x11111A, 0xA5A5D3).setAutogen(DUST, DENSEWIRE, BLOCK).m();
|
||||
public static final NTMMaterial MAT_FERRO = makeSmeltable(_AS + 7, FERRO, 0xB7B7C9, 0x101022, 0x6B6B8B).setAutogen(HEAVYBARREL, HEAVYRECEIVER).m();
|
||||
@ -154,7 +154,7 @@ public class Mats {
|
||||
public static final NTMMaterial MAT_SLAG = makeSmeltable(_AS + 11, SLAG, 0x554940, 0x34281F, 0x6C6562).setAutogen(BLOCK).n();
|
||||
public static final NTMMaterial MAT_MUD = makeSmeltable(_AS + 14, MUD, 0xBCB5A9, 0x481213, 0x96783B).n();
|
||||
public static final NTMMaterial MAT_GUNMETAL = makeSmeltable(_AS + 19, GUNMETAL, 0xFFEF3F, 0xAD3600, 0xF9C62C).setAutogen(LIGHTBARREL, HEAVYBARREL, LIGHTRECEIVER, HEAVYRECEIVER, MECHANISM, STOCK, GRIP).n();
|
||||
public static final NTMMaterial MAT_WEAPONSTEEL = makeSmeltable(_AS + 20, WEAPONSTEEL, 0xA0A0A0, 0x000000, 0x808080).setAutogen(SHELL, LIGHTBARREL, HEAVYBARREL, LIGHTRECEIVER, HEAVYRECEIVER, MECHANISM, STOCK, GRIP).n();
|
||||
public static final NTMMaterial MAT_WEAPONSTEEL = makeSmeltable(_AS + 20, WEAPONSTEEL, 0xA0A0A0, 0x000000, 0x808080).setAutogen(CASTPLATE, SHELL, LIGHTBARREL, HEAVYBARREL, LIGHTRECEIVER, HEAVYRECEIVER, MECHANISM, STOCK, GRIP).n();
|
||||
public static final NTMMaterial MAT_SATURN = makeSmeltable(_AS + 4, BIGMT, 0x3AC4DA, 0x09282C, 0x30A4B7).setAutogen(PLATE, CASTPLATE, SHELL, BLOCK, LIGHTBARREL, HEAVYBARREL, LIGHTRECEIVER, HEAVYRECEIVER, MECHANISM, STOCK, GRIP).m();
|
||||
|
||||
//Extension
|
||||
|
||||
@ -39,6 +39,7 @@ public class AmmoPressRecipes extends SerializableRecipe {
|
||||
OreDictStack copper = new OreDictStack(CU.ingot());
|
||||
OreDictStack plastic = new OreDictStack(ANY_PLASTIC.ingot());
|
||||
OreDictStack uranium = new OreDictStack(U238.ingot());
|
||||
OreDictStack ferro = new OreDictStack(FERRO.ingot());
|
||||
ComparableStack smokeful = new ComparableStack(Items.gunpowder);
|
||||
OreDictStack smokeless = new OreDictStack(ANY_SMOKELESS.dust());
|
||||
ComparableStack rocket = new ComparableStack(ModItems.rocket_fuel);
|
||||
@ -137,6 +138,27 @@ public class AmmoPressRecipes extends SerializableRecipe {
|
||||
null, smokeless.copy(2), null,
|
||||
null, sSmall, null));
|
||||
|
||||
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.P45_SP, 8),
|
||||
null, lead, null,
|
||||
null, smokeless, null,
|
||||
null, cSmall, null));
|
||||
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.P45_FMJ, 8),
|
||||
null, steel, null,
|
||||
null, smokeless, null,
|
||||
null, cSmall, null));
|
||||
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.P45_JHP, 8),
|
||||
plastic, copper, null,
|
||||
null, smokeless, null,
|
||||
null, cSmall, null));
|
||||
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.P45_AP, 8),
|
||||
null, wSteel, null,
|
||||
null, smokeless.copy(2), null,
|
||||
null, sSmall, null));
|
||||
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.P45_DU, 8),
|
||||
null, uranium, null,
|
||||
null, smokeless.copy(2), null,
|
||||
null, sSmall, null));
|
||||
|
||||
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.R556_SP, 16),
|
||||
null, lead.copy(2), null,
|
||||
null, smokeless.copy(2), null,
|
||||
@ -174,6 +196,10 @@ public class AmmoPressRecipes extends SerializableRecipe {
|
||||
null, uranium.copy(2), null,
|
||||
null, smokeless.copy(4), null,
|
||||
null, sSmall.copy(2), null));
|
||||
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.R762_HE, 12),
|
||||
he, ferro, null,
|
||||
null, smokeless.copy(4), null,
|
||||
null, sSmall.copy(2), null));
|
||||
|
||||
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.BMG50_SP, 12),
|
||||
null, lead.copy(2), null,
|
||||
@ -195,6 +221,10 @@ public class AmmoPressRecipes extends SerializableRecipe {
|
||||
null, uranium.copy(2), null,
|
||||
null, smokeless.copy(6), null,
|
||||
null, sBig, null));
|
||||
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.BMG50_HE, 12),
|
||||
he, ferro, null,
|
||||
null, smokeless.copy(6), null,
|
||||
null, sBig, null));
|
||||
|
||||
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.G12_BP, 6),
|
||||
null, nugget.copy(6), null,
|
||||
@ -238,21 +268,22 @@ public class AmmoPressRecipes extends SerializableRecipe {
|
||||
null, nugget.copy(8), null,
|
||||
null, smokeless.copy(2), null,
|
||||
null, sShell, null));
|
||||
|
||||
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.G10_SHRAPNEL, 4),
|
||||
plastic, nugget.copy(8), null,
|
||||
null, smokeless.copy(2), null,
|
||||
null, sShell, null));
|
||||
|
||||
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.G10_DU, 4),
|
||||
null, uranium, null,
|
||||
null, smokeless.copy(2), null,
|
||||
null, sShell, null));
|
||||
|
||||
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.G10_SLUG, 4),
|
||||
null, lead, null,
|
||||
null, smokeless.copy(2), null,
|
||||
null, sShell, null));
|
||||
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.G10_EXPLOSIVE, 4),
|
||||
he, ferro, null,
|
||||
null, smokeless.copy(2), null,
|
||||
null, sShell, null));
|
||||
|
||||
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.G26_FLARE, 4),
|
||||
null, rp, null,
|
||||
@ -366,7 +397,6 @@ public class AmmoPressRecipes extends SerializableRecipe {
|
||||
null, lPlate , null));
|
||||
|
||||
OreDictStack tungsten = new OreDictStack(W.ingot());
|
||||
OreDictStack ferro = new OreDictStack(FERRO.ingot());
|
||||
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.COIL_TUNGSTEN, 4),
|
||||
null, null, null,
|
||||
null, tungsten, null,
|
||||
|
||||
154
src/main/java/com/hbm/items/IItemInventory.java
Normal file
@ -0,0 +1,154 @@
|
||||
package com.hbm.items;
|
||||
|
||||
import com.hbm.util.ItemStackUtil;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Base class for items containing an inventory. This can be seen in crates, containment boxes, and the toolbox.
|
||||
* @author BallOfEnergy/Gammawave
|
||||
*/
|
||||
public abstract class IItemInventory implements IInventory {
|
||||
|
||||
public EntityPlayer player;
|
||||
public ItemStack[] slots;
|
||||
public ItemStack target;
|
||||
|
||||
public boolean toMarkDirty = false;
|
||||
|
||||
@Override
|
||||
public void markDirty() {
|
||||
|
||||
if(!toMarkDirty || player.getEntityWorld().isRemote)
|
||||
return;
|
||||
|
||||
for(int i = 0; i < getSizeInventory(); ++i) {
|
||||
if(getStackInSlot(i) != null && getStackInSlot(i).stackSize == 0) {
|
||||
slots[i] = null;
|
||||
}
|
||||
}
|
||||
|
||||
ItemStackUtil.addStacksToNBT(target, slots); // Maintain compatibility with the containment boxes.
|
||||
|
||||
target.setTagCompound(checkNBT(target.getTagCompound()));
|
||||
|
||||
}
|
||||
|
||||
public NBTTagCompound checkNBT(NBTTagCompound nbt) {
|
||||
if(!nbt.hasNoTags()) {
|
||||
Random random = new Random();
|
||||
|
||||
try {
|
||||
byte[] abyte = CompressedStreamTools.compress(nbt);
|
||||
|
||||
if (abyte.length > 6000) {
|
||||
player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.RED + "Warning: Container NBT exceeds 6kB, contents will be ejected!"));
|
||||
for (int i1 = 0; i1 < this.getSizeInventory(); ++i1) {
|
||||
ItemStack itemstack = this.getStackInSlot(i1);
|
||||
|
||||
if (itemstack != null) {
|
||||
float f = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = random.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
while (itemstack.stackSize > 0) {
|
||||
int j1 = random.nextInt(21) + 10;
|
||||
|
||||
if (j1 > itemstack.stackSize) {
|
||||
j1 = itemstack.stackSize;
|
||||
}
|
||||
|
||||
itemstack.stackSize -= j1;
|
||||
EntityItem entityitem = new EntityItem(player.worldObj, player.posX + f, player.posY + f1, player.posZ + 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) random.nextGaussian() * f3 + player.motionX;
|
||||
entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F + player.motionY;
|
||||
entityitem.motionZ = (float) random.nextGaussian() * f3 + player.motionZ;
|
||||
player.worldObj.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new NBTTagCompound(); // Reset.
|
||||
}
|
||||
} catch (IOException ignored) {}
|
||||
}
|
||||
return nbt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int slot, int amount) {
|
||||
ItemStack stack = getStackInSlot(slot);
|
||||
if (stack != null) {
|
||||
if (stack.stackSize > amount) {
|
||||
stack = stack.splitStack(amount);
|
||||
} else {
|
||||
setInventorySlotContents(slot, null);
|
||||
}
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slot, ItemStack stack) {
|
||||
if(stack != null) {
|
||||
stack.stackSize = Math.min(stack.stackSize, this.getInventoryStackLimit());
|
||||
}
|
||||
|
||||
slots[slot] = stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot) {
|
||||
ItemStack stack = getStackInSlot(slot);
|
||||
setInventorySlotContents(slot, null);
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slot) {
|
||||
return slots[slot];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
player.worldObj.playSoundEffect(player.posX, player.posY, player.posZ, "hbm:block.crateOpen", 1.0F, 0.8F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
toMarkDirty = true;
|
||||
markDirty();
|
||||
toMarkDirty = false;
|
||||
player.worldObj.playSoundEffect(player.posX, player.posY, player.posZ, "hbm:block.crateClose", 1.0F, 0.8F);
|
||||
}
|
||||
}
|
||||
@ -2136,8 +2136,9 @@ public class ModItems {
|
||||
public static Item hazmat_red_kit;
|
||||
public static Item hazmat_grey_kit;
|
||||
public static Item kit_custom;
|
||||
public static Item kit_toolbox_empty;
|
||||
public static Item kit_toolbox;
|
||||
|
||||
public static Item legacy_toolbox;
|
||||
public static Item toolbox;
|
||||
|
||||
public static Item loot_10;
|
||||
public static Item loot_15;
|
||||
@ -4128,8 +4129,8 @@ public class ModItems {
|
||||
hazmat_red_kit = new ItemStarterKit().setUnlocalizedName("hazmat_red_kit").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":hazmat_red_kit");
|
||||
hazmat_grey_kit = new ItemStarterKit().setUnlocalizedName("hazmat_grey_kit").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":hazmat_grey_kit");
|
||||
kit_custom = new ItemKitCustom().setUnlocalizedName("kit_custom").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":kit");
|
||||
kit_toolbox_empty = new Item().setUnlocalizedName("kit_toolbox_empty").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":kit_toolbox_empty");
|
||||
kit_toolbox = new ItemKitNBT().setUnlocalizedName("kit_toolbox").setCreativeTab(MainRegistry.consumableTab).setContainerItem(kit_toolbox_empty).setTextureName(RefStrings.MODID + ":kit_toolbox");
|
||||
toolbox = new ItemToolBox().setUnlocalizedName("toolbox").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":kit_toolbox");
|
||||
legacy_toolbox = new ItemKitNBT().setUnlocalizedName("toolbox_legacy").setContainerItem(toolbox).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":kit_toolbox");
|
||||
|
||||
loot_10 = new ItemLootCrate().setUnlocalizedName("loot_10").setMaxStackSize(1).setCreativeTab(MainRegistry.missileTab).setTextureName(RefStrings.MODID + ":loot_10");
|
||||
loot_15 = new ItemLootCrate().setUnlocalizedName("loot_15").setMaxStackSize(1).setCreativeTab(MainRegistry.missileTab).setTextureName(RefStrings.MODID + ":loot_15");
|
||||
@ -6490,7 +6491,7 @@ public class ModItems {
|
||||
|
||||
GameRegistry.registerItem(ammo_standard, ammo_standard.getUnlocalizedName());
|
||||
GameRegistry.registerItem(ammo_secret, ammo_secret.getUnlocalizedName());
|
||||
|
||||
|
||||
GameRegistry.registerItem(weapon_mod_test, weapon_mod_test.getUnlocalizedName());
|
||||
GameRegistry.registerItem(weapon_mod_generic, weapon_mod_generic.getUnlocalizedName());
|
||||
GameRegistry.registerItem(weapon_mod_special, weapon_mod_special.getUnlocalizedName());
|
||||
@ -7167,8 +7168,8 @@ public class ModItems {
|
||||
GameRegistry.registerItem(hazmat_grey_kit, hazmat_grey_kit.getUnlocalizedName());
|
||||
GameRegistry.registerItem(kit_custom, kit_custom.getUnlocalizedName());
|
||||
GameRegistry.registerItem(euphemium_kit, euphemium_kit.getUnlocalizedName());
|
||||
GameRegistry.registerItem(kit_toolbox_empty, kit_toolbox_empty.getUnlocalizedName());
|
||||
GameRegistry.registerItem(kit_toolbox, kit_toolbox.getUnlocalizedName());
|
||||
GameRegistry.registerItem(legacy_toolbox, legacy_toolbox.getUnlocalizedName());
|
||||
GameRegistry.registerItem(toolbox, toolbox.getUnlocalizedName());
|
||||
GameRegistry.registerItem(letter, letter.getUnlocalizedName());
|
||||
|
||||
//Misile Loot Boxes
|
||||
|
||||
@ -3,6 +3,7 @@ package com.hbm.items.block;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.inventory.container.*;
|
||||
import com.hbm.inventory.gui.*;
|
||||
import com.hbm.items.IItemInventory;
|
||||
import com.hbm.items.tool.ItemKey;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
@ -10,21 +11,14 @@ import com.hbm.tileentity.machine.storage.*;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.io.IOException;
|
||||
import java.util.Random;
|
||||
|
||||
public class ItemBlockStorageCrate extends ItemBlockBase implements IGUIProvider {
|
||||
|
||||
@ -86,18 +80,12 @@ public class ItemBlockStorageCrate extends ItemBlockBase implements IGUIProvider
|
||||
throw new NullPointerException();
|
||||
}
|
||||
|
||||
public static class InventoryCrate implements IInventory {
|
||||
|
||||
public final EntityPlayer player;
|
||||
public final ItemStack crate;
|
||||
public ItemStack[] slots;
|
||||
|
||||
private boolean toMarkDirty = false;
|
||||
public static class InventoryCrate extends IItemInventory {
|
||||
|
||||
public InventoryCrate(EntityPlayer player, ItemStack crate) {
|
||||
|
||||
this.player = player;
|
||||
this.crate = crate;
|
||||
this.target = crate;
|
||||
|
||||
slots = new ItemStack[this.getSizeInventory()];
|
||||
if(crate.stackTagCompound == null)
|
||||
@ -125,66 +113,23 @@ public class ItemBlockStorageCrate extends ItemBlockBase implements IGUIProvider
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return findCrateType(crate.getItem()).getSizeInventory();
|
||||
return findCrateType(target.getItem()).getSizeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return findCrateType(crate.getItem()).getInventoryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slot) {
|
||||
return slots[slot];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int slot, int amount) {
|
||||
ItemStack stack = getStackInSlot(slot);
|
||||
if (stack != null) {
|
||||
if (stack.stackSize > amount) {
|
||||
stack = stack.splitStack(amount);
|
||||
} else {
|
||||
setInventorySlotContents(slot, null);
|
||||
}
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot) {
|
||||
ItemStack stack = getStackInSlot(slot);
|
||||
setInventorySlotContents(slot, null);
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slot, ItemStack stack) {
|
||||
if(stack != null) {
|
||||
stack.stackSize = Math.min(stack.stackSize, this.getInventoryStackLimit());
|
||||
}
|
||||
|
||||
slots[slot] = stack;
|
||||
return findCrateType(target.getItem()).getInventoryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return crate.hasDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 64;
|
||||
return target.hasDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty() { // I HATE THIS SO MUCH
|
||||
|
||||
if(player.worldObj.isRemote) { // go the fuck away
|
||||
return;
|
||||
}
|
||||
|
||||
if(!toMarkDirty) { // ok fuck you too
|
||||
if(player.getEntityWorld().isRemote || !toMarkDirty) { // go the fuck away
|
||||
return;
|
||||
}
|
||||
|
||||
@ -203,88 +148,18 @@ public class ItemBlockStorageCrate extends ItemBlockBase implements IGUIProvider
|
||||
nbt.setTag("slot" + i, slot);
|
||||
}
|
||||
|
||||
if(crate.stackTagCompound != null) { // yes it's a bit jank, but it wants to clear otherwise so...
|
||||
if(crate.stackTagCompound.hasKey("lock"))
|
||||
nbt.setInteger("lock", crate.stackTagCompound.getInteger("lock"));
|
||||
if(crate.stackTagCompound.hasKey("lockMod"))
|
||||
nbt.setDouble("lockMod", crate.stackTagCompound.getDouble("lockMod"));
|
||||
if(crate.stackTagCompound.hasKey("spiders"))
|
||||
nbt.setBoolean("spiders", crate.stackTagCompound.getBoolean("spiders")); // fuck you!!
|
||||
if(target.stackTagCompound != null) { // yes it's a bit jank, but it wants to clear otherwise so...
|
||||
if(target.stackTagCompound.hasKey("lock"))
|
||||
nbt.setInteger("lock", target.stackTagCompound.getInteger("lock"));
|
||||
if(target.stackTagCompound.hasKey("lockMod"))
|
||||
nbt.setDouble("lockMod", target.stackTagCompound.getDouble("lockMod"));
|
||||
if(target.stackTagCompound.hasKey("spiders"))
|
||||
nbt.setBoolean("spiders", target.stackTagCompound.getBoolean("spiders")); // fuck you!!
|
||||
}
|
||||
|
||||
if(!nbt.hasNoTags()) {
|
||||
target.setTagCompound(checkNBT(nbt));
|
||||
|
||||
Random random = new Random();
|
||||
|
||||
try {
|
||||
byte[] abyte = CompressedStreamTools.compress(nbt);
|
||||
|
||||
if(abyte.length > 6000) {
|
||||
player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.RED + "Warning: Container NBT exceeds 6kB, contents will be ejected!"));
|
||||
for(int i1 = 0; i1 < invSize; ++i1) {
|
||||
ItemStack itemstack = this.getStackInSlot(i1);
|
||||
|
||||
if(itemstack != null) {
|
||||
float f = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = random.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
while(itemstack.stackSize > 0) {
|
||||
int j1 = random.nextInt(21) + 10;
|
||||
|
||||
if(j1 > itemstack.stackSize) {
|
||||
j1 = itemstack.stackSize;
|
||||
}
|
||||
|
||||
itemstack.stackSize -= j1;
|
||||
EntityItem entityitem = new EntityItem(player.worldObj, player.posX + f, player.posY + f1, player.posZ + 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) random.nextGaussian() * f3 + player.motionX;
|
||||
entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F + player.motionY;
|
||||
entityitem.motionZ = (float) random.nextGaussian() * f3 + player.motionZ;
|
||||
player.worldObj.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
crate.setTagCompound(null); // Wipe tag compound to clear crate.
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, crate);
|
||||
return;
|
||||
}
|
||||
} catch(IOException ignored) { }
|
||||
}
|
||||
|
||||
crate.setTagCompound(nbt);
|
||||
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, crate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
player.worldObj.playSoundEffect(player.posX, player.posY, player.posZ, "hbm:block.crateOpen", 1.0F, 0.8F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
toMarkDirty = true;
|
||||
markDirty();
|
||||
toMarkDirty = false;
|
||||
player.worldObj.playSoundEffect(player.posX, player.posY, player.posZ, "hbm:block.crateClose", 1.0F, 0.8F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack stack) {
|
||||
return true;
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,64 +14,64 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemKitNBT extends Item {
|
||||
|
||||
|
||||
public ItemKitNBT() {
|
||||
this.setMaxStackSize(1);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
|
||||
|
||||
ItemStack[] stacks = ItemStackUtil.readStacksFromNBT(stack);
|
||||
|
||||
|
||||
if(stacks != null) {
|
||||
|
||||
|
||||
for(ItemStack item : stacks) {
|
||||
if(item != null) {
|
||||
player.inventory.addItemStackToInventory(item.copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ItemStack container = stack.getItem().getContainerItem(stack);
|
||||
|
||||
|
||||
stack.stackSize--;
|
||||
|
||||
|
||||
if(container != null) {
|
||||
|
||||
|
||||
if(stack.stackSize > 0) {
|
||||
player.inventory.addItemStackToInventory(container.copy());
|
||||
} else {
|
||||
stack = container.copy();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
world.playSoundAtEntity(player, "hbm:item.unpack", 1.0F, 1.0F);
|
||||
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
|
||||
|
||||
|
||||
ItemStack[] stacks = ItemStackUtil.readStacksFromNBT(stack);
|
||||
|
||||
|
||||
if(stacks != null) {
|
||||
|
||||
|
||||
list.add("Contains:");
|
||||
|
||||
|
||||
for(ItemStack item : stacks) {
|
||||
list.add("-" + item.getDisplayName() + (item.stackSize > 1 ? (" x" + item.stackSize) : ""));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static ItemStack create(ItemStack... contents) {
|
||||
ItemStack stack = new ItemStack(ModItems.kit_toolbox);
|
||||
ItemStack stack = new ItemStack(ModItems.legacy_toolbox);
|
||||
stack.stackTagCompound = new NBTTagCompound();
|
||||
ItemStackUtil.addStacksToNBT(stack, contents);
|
||||
|
||||
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package com.hbm.items.tool;
|
||||
|
||||
import com.hbm.inventory.container.ContainerLeadBox;
|
||||
import com.hbm.inventory.gui.GUILeadBox;
|
||||
import com.hbm.items.IItemInventory;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.util.ItemStackUtil;
|
||||
@ -10,7 +11,6 @@ import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@ -21,7 +21,7 @@ public class ItemLeadBox extends Item implements IGUIProvider {
|
||||
public ItemLeadBox() {
|
||||
this.setMaxStackSize(1);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getMaxItemUseDuration(ItemStack stack) {
|
||||
return 1;
|
||||
@ -29,7 +29,7 @@ public class ItemLeadBox extends Item implements IGUIProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
|
||||
|
||||
if(!world.isRemote) player.openGui(MainRegistry.instance, 0, world, 0, 0, 0);
|
||||
return stack;
|
||||
}
|
||||
@ -44,28 +44,27 @@ public class ItemLeadBox extends Item implements IGUIProvider {
|
||||
public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new GUILeadBox(player.inventory, new InventoryLeadBox(player, player.getHeldItem()));
|
||||
}
|
||||
|
||||
public static class InventoryLeadBox implements IInventory {
|
||||
|
||||
public final EntityPlayer player;
|
||||
public final ItemStack box;
|
||||
public ItemStack[] slots;
|
||||
|
||||
|
||||
public static class InventoryLeadBox extends IItemInventory {
|
||||
|
||||
public InventoryLeadBox(EntityPlayer player, ItemStack box) {
|
||||
this.player = player;
|
||||
this.box = box;
|
||||
this.target = box;
|
||||
slots = new ItemStack[this.getSizeInventory()];
|
||||
|
||||
|
||||
if(!box.hasTagCompound())
|
||||
box.setTagCompound(new NBTTagCompound());
|
||||
|
||||
|
||||
ItemStack[] fromNBT = ItemStackUtil.readStacksFromNBT(box, slots.length);
|
||||
|
||||
|
||||
if(fromNBT != null) {
|
||||
for(int i = 0; i < slots.length; i++) {
|
||||
slots[i] = fromNBT[i];
|
||||
}
|
||||
}
|
||||
toMarkDirty = true;
|
||||
this.markDirty();
|
||||
toMarkDirty = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -73,43 +72,6 @@ public class ItemLeadBox extends Item implements IGUIProvider {
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slot) {
|
||||
return slots[slot];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int slot, int amount) {
|
||||
ItemStack stack = getStackInSlot(slot);
|
||||
if (stack != null) {
|
||||
if (stack.stackSize > amount) {
|
||||
stack = stack.splitStack(amount);
|
||||
markDirty();
|
||||
} else {
|
||||
setInventorySlotContents(slot, null);
|
||||
}
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot) {
|
||||
ItemStack stack = getStackInSlot(slot);
|
||||
setInventorySlotContents(slot, null);
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slot, ItemStack stack) {
|
||||
|
||||
if(stack != null) {
|
||||
stack.stackSize = Math.min(stack.stackSize, this.getInventoryStackLimit());
|
||||
}
|
||||
|
||||
slots[slot] = stack;
|
||||
markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "container.leadBox";
|
||||
@ -117,44 +79,12 @@ public class ItemLeadBox extends Item implements IGUIProvider {
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return box.hasDisplayName();
|
||||
return target.hasDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty() {
|
||||
|
||||
for(int i = 0; i < getSizeInventory(); ++i) {
|
||||
if(getStackInSlot(i) != null && getStackInSlot(i).stackSize == 0) {
|
||||
slots[i] = null;
|
||||
}
|
||||
}
|
||||
|
||||
ItemStackUtil.addStacksToNBT(box, slots);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
player.worldObj.playSoundEffect(player.posX, player.posY, player.posZ, "hbm:block.crateOpen", 1.0F, 0.8F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
player.worldObj.playSoundEffect(player.posX, player.posY, player.posZ, "hbm:block.crateClose", 1.0F, 0.8F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
240
src/main/java/com/hbm/items/tool/ItemToolBox.java
Normal file
@ -0,0 +1,240 @@
|
||||
package com.hbm.items.tool;
|
||||
|
||||
import com.hbm.inventory.container.ContainerToolBox;
|
||||
import com.hbm.inventory.gui.GUIToolBox;
|
||||
import com.hbm.items.IItemInventory;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.util.ItemStackUtil;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemToolBox extends Item implements IGUIProvider {
|
||||
|
||||
@SideOnly(Side.CLIENT) protected IIcon iconOpen;
|
||||
@SideOnly(Side.CLIENT) protected IIcon iconClosed;
|
||||
|
||||
public ItemToolBox() {
|
||||
this.setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
super.registerIcons(iconRegister);
|
||||
this.iconOpen = iconRegister.registerIcon(RefStrings.MODID + ":kit_toolbox_empty");
|
||||
this.iconClosed = iconRegister.registerIcon(RefStrings.MODID + ":kit_toolbox");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean requiresMultipleRenderPasses() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(ItemStack stack, int renderPass) {
|
||||
|
||||
if(stack.getTagCompound() != null && stack.getTagCompound().getBoolean("isOpen") && renderPass == 1) return this.iconOpen;
|
||||
return renderPass == 1 ? this.iconClosed : getIconFromDamageForRenderPass(stack.getItemDamage(), renderPass);
|
||||
}
|
||||
|
||||
// Finds active rows in the toolbox (rows with items inside them).
|
||||
public List<Integer> getActiveRows(ItemStack box) {
|
||||
ItemStack[] stacks = ItemStackUtil.readStacksFromNBT(box, 24);
|
||||
if(stacks == null)
|
||||
return new ArrayList<>();
|
||||
List<Integer> activeRows = new ArrayList<>();
|
||||
for (int row = 0; row < 3; row++) {
|
||||
for (int slot = 0; slot < 8; slot++) {
|
||||
if(stacks[row * 8 + slot] != null) {
|
||||
activeRows.add(row);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return activeRows;
|
||||
}
|
||||
|
||||
// This function genuinely hurts my soul, but it works...
|
||||
public void moveRows(ItemStack box, EntityPlayer player) {
|
||||
|
||||
// Move from hotbar into array in preparation for boxing.
|
||||
ItemStack[] endingHotBar = new ItemStack[9];
|
||||
ItemStack[] stacksToTransferToBox = new ItemStack[8];
|
||||
|
||||
boolean hasToolbox = false;
|
||||
int extraToolboxes = 0;
|
||||
for (int i = 0; i < 9; i++) { // Maximum allowed HotBar size is 9.
|
||||
|
||||
ItemStack slot = player.inventory.getStackInSlot(i);
|
||||
|
||||
if(slot != null && slot.getItem() == ModItems.toolbox && i != player.inventory.currentItem) {
|
||||
|
||||
extraToolboxes++;
|
||||
player.dropPlayerItemWithRandomChoice(slot, true);
|
||||
player.inventory.setInventorySlotContents(i, null);
|
||||
|
||||
} else if(i == player.inventory.currentItem) {
|
||||
hasToolbox = true;
|
||||
endingHotBar[i] = slot;
|
||||
} else {
|
||||
stacksToTransferToBox[i - (hasToolbox ? 1 : 0)] = slot;
|
||||
}
|
||||
}
|
||||
|
||||
if(extraToolboxes > 0) {
|
||||
if(extraToolboxes == 1)
|
||||
player.addChatComponentMessage(new ChatComponentText("You can't toolbox a toolbox... ").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED))); // TODO: tell someone else to do i18n stuff; i don't want to
|
||||
else
|
||||
player.addChatComponentMessage(new ChatComponentText("You can't toolbox a toolbox... (x" + extraToolboxes + ")").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED))); // TODO: this too :ayo:
|
||||
}
|
||||
|
||||
// Move stacks around inside the box, mostly shifts rows to other rows and shifts the top row to the hotbar.
|
||||
ItemStack[] stacks = ItemStackUtil.readStacksFromNBT(box, 24);
|
||||
ItemStack[] endingStacks = new ItemStack[24];
|
||||
|
||||
int lowestActiveIndex = Integer.MAX_VALUE; // Lowest active index to find which row to move *to* the hotbar.
|
||||
int lowestInactiveIndex = Integer.MAX_VALUE; // Lowest *inactive* index to find which row to move the hotbar to.
|
||||
|
||||
if(stacks != null) {
|
||||
List<Integer> activeRows = getActiveRows(box);
|
||||
|
||||
{ // despair
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if(activeRows.contains(i))
|
||||
lowestActiveIndex = Math.min(i, lowestActiveIndex);
|
||||
else
|
||||
lowestInactiveIndex = Math.min(i, lowestInactiveIndex);
|
||||
}
|
||||
|
||||
if(lowestInactiveIndex > 2) // No inactive rows...
|
||||
lowestInactiveIndex = 2; // Set to the last possible row; the items will be moved out of the way in time.
|
||||
else
|
||||
lowestInactiveIndex = Math.max(0, lowestInactiveIndex - 1); // A little shittery to make items pop into the row that's *going* to be empty.
|
||||
}
|
||||
|
||||
// This entire section sucks, but honestly it's not actually that bad; it works so....
|
||||
for (Integer activeRowIndex : activeRows) {
|
||||
|
||||
int activeIndex = 8 * activeRowIndex;
|
||||
|
||||
if (activeRowIndex == lowestActiveIndex) { // Items to "flow" to the hotbar.
|
||||
hasToolbox = false;
|
||||
for (int i = 0; i < 9; i++) {
|
||||
if(i == player.inventory.currentItem) {
|
||||
hasToolbox = true;
|
||||
continue;
|
||||
}
|
||||
endingHotBar[i] = stacks[activeIndex + i - (hasToolbox ? 1 : 0)];
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
int targetIndex = 8 * (activeRowIndex - 1);
|
||||
|
||||
System.arraycopy(stacks, activeIndex, endingStacks, targetIndex, 8);
|
||||
}
|
||||
}
|
||||
|
||||
// Finally, move all temporary arrays into their respective locations.
|
||||
System.arraycopy(stacksToTransferToBox, 0, endingStacks, lowestInactiveIndex * 8, 8);
|
||||
|
||||
for (int i = 0; i < endingHotBar.length; i++) {
|
||||
player.inventory.setInventorySlotContents(i, endingHotBar[i]);
|
||||
}
|
||||
|
||||
box.setTagCompound(new NBTTagCompound());
|
||||
ItemStackUtil.addStacksToNBT(box, endingStacks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
|
||||
if(!world.isRemote) {
|
||||
if (player.isSneaking()) {
|
||||
moveRows(stack, player);
|
||||
player.inventoryContainer.detectAndSendChanges();
|
||||
} else {
|
||||
if(stack.getTagCompound() == null)
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
stack.getTagCompound().setBoolean("isOpen", true);
|
||||
player.openGui(MainRegistry.instance, 0, world, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new ContainerToolBox(player.inventory, new InventoryToolBox(player, player.getHeldItem()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new GUIToolBox(player.inventory, new InventoryToolBox(player, player.getHeldItem()));
|
||||
}
|
||||
|
||||
public static class InventoryToolBox extends IItemInventory {
|
||||
|
||||
public InventoryToolBox(EntityPlayer player, ItemStack box) {
|
||||
this.player = player;
|
||||
this.target = box;
|
||||
slots = new ItemStack[this.getSizeInventory()];
|
||||
|
||||
if(!box.hasTagCompound())
|
||||
box.setTagCompound(new NBTTagCompound());
|
||||
|
||||
ItemStack[] fromNBT = ItemStackUtil.readStacksFromNBT(box, slots.length);
|
||||
|
||||
if(fromNBT != null) {
|
||||
System.arraycopy(fromNBT, 0, slots, 0, slots.length);
|
||||
}
|
||||
toMarkDirty = true;
|
||||
this.markDirty();
|
||||
toMarkDirty = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return 24;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "container.toolBox";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return target.hasDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
this.target.getTagCompound().removeTag("isOpen");
|
||||
this.player.inventory.setInventorySlotContents(this.player.inventory.currentItem, this.target);
|
||||
super.closeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack stack) {
|
||||
return stack.getItem() != ModItems.toolbox;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -14,7 +14,6 @@ import com.hbm.handler.HbmKeybinds.EnumKeybind;
|
||||
import com.hbm.interfaces.IItemHUD;
|
||||
import com.hbm.inventory.RecipesCommon.ComparableStack;
|
||||
import com.hbm.inventory.gui.GUIWeaponTable;
|
||||
import com.hbm.items.IEquipReceiver;
|
||||
import com.hbm.items.IKeybindReceiver;
|
||||
import com.hbm.items.weapon.sedna.hud.IHUDComponent;
|
||||
import com.hbm.items.weapon.sedna.mags.IMagazine;
|
||||
@ -48,7 +47,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||
|
||||
public class ItemGunBaseNT extends Item implements IKeybindReceiver, IEquipReceiver, IItemHUD {
|
||||
public class ItemGunBaseNT extends Item implements IKeybindReceiver, IItemHUD {
|
||||
|
||||
/** Timestamp for rendering smoke nodes and muzzle flashes */
|
||||
public long[] lastShot;
|
||||
@ -96,6 +95,7 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IEquipRecei
|
||||
public static final String KEY_LOCKONTARGET = "lockontarget";
|
||||
public static final String KEY_LOCKEDON = "lockedon";
|
||||
public static final String KEY_CANCELRELOAD = "cancel";
|
||||
public static final String KEY_EQUIPPED = "eqipped";
|
||||
|
||||
public static ConcurrentHashMap<EntityLivingBase, AudioWrapper> loopedSounds = new ConcurrentHashMap();
|
||||
|
||||
@ -228,7 +228,6 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IEquipRecei
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEquip(EntityPlayer player, ItemStack stack) {
|
||||
for(int i = 0; i < this.configs_DNA.length; i++) {
|
||||
playAnimation(player, stack, AnimType.EQUIP, i);
|
||||
@ -291,6 +290,17 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IEquipRecei
|
||||
return;
|
||||
}
|
||||
|
||||
/// ON EQUIP ///
|
||||
if(player != null) {
|
||||
boolean wasHeld = this.getIsEquipped(stack);
|
||||
|
||||
if(!wasHeld && isHeld && player != null) {
|
||||
this.onEquip(player, stack);
|
||||
}
|
||||
}
|
||||
|
||||
this.setIsEquipped(stack, isHeld);
|
||||
|
||||
/// RESET WHEN NOT EQUIPPED ///
|
||||
if(!isHeld) {
|
||||
for(int i = 0; i < confNo; i++) {
|
||||
@ -359,6 +369,9 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IEquipRecei
|
||||
// RELOAD CANCEL //
|
||||
public static boolean getReloadCancel(ItemStack stack) { return getValueBool(stack, KEY_CANCELRELOAD); }
|
||||
public static void setReloadCancel(ItemStack stack, boolean value) { setValueBool(stack, KEY_CANCELRELOAD, value); }
|
||||
// EQUIPPED //
|
||||
public static boolean getIsEquipped(ItemStack stack) { return getValueBool(stack, KEY_EQUIPPED); }
|
||||
public static void setIsEquipped(ItemStack stack, boolean value) { setValueBool(stack, KEY_EQUIPPED, value); }
|
||||
|
||||
|
||||
/// UTIL ///
|
||||
|
||||
@ -139,7 +139,8 @@ public class GunFactory {
|
||||
}
|
||||
|
||||
public static enum EnumModTest {
|
||||
FIRERATE, DAMAGE, MULTI;
|
||||
FIRERATE, DAMAGE, MULTI,
|
||||
OVERRIDE_2_5, OVERRIDE_5, OVERRIDE_7_5, OVERRIDE_10, OVERRIDE_12_5, OVERRIDE_15, OVERRIDE_20;
|
||||
}
|
||||
|
||||
public static enum EnumModGeneric {
|
||||
@ -158,7 +159,7 @@ public class GunFactory {
|
||||
SILENCER, SCOPE, SAW, GREASEGUN, SLOWDOWN,
|
||||
SPEEDUP, CHOKE, SPEEDLOADER,
|
||||
FURNITURE_GREEN, FURNITURE_BLACK, BAYONET,
|
||||
STACK_MAG,
|
||||
STACK_MAG, SKIN_SATURNITE,
|
||||
}
|
||||
|
||||
public static enum EnumModCaliber {
|
||||
|
||||
@ -920,7 +920,7 @@ public class Orchestras {
|
||||
|
||||
if(type == AnimType.CYCLE) {
|
||||
if(timer == 0) {
|
||||
int rounds = WeaponModManager.hasUpgrade(stack, ctx.configIndex, 208) ? 2 : 1;
|
||||
int rounds = WeaponModManager.hasUpgrade(stack, ctx.configIndex, WeaponModManager.ID_MINIGUN_SPEED) ? 3 : 1;
|
||||
for(int i = 0; i < rounds; i++) {
|
||||
SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack, ctx.inventory);
|
||||
if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, aiming ? 0.125 : 0.5, aiming ? -0.125 : -0.25, aiming ? -0.25 : -0.5D, 0, 0.18, -0.12, 0.01, (float)entity.getRNG().nextGaussian() * 15F, (float)entity.getRNG().nextGaussian() * 15F, casing.getName());
|
||||
|
||||
@ -111,7 +111,7 @@ public class XFactory556mm {
|
||||
.addBus("EQUIP", new BusAnimationSequence().addPos(45, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_FULL));
|
||||
case CYCLE: return new BusAnimation()
|
||||
.addBus("BOLT", new BusAnimationSequence().addPos(0, 0, 0, 20).addPos(0, 0, -4.5, 40).addPos(0, 0, 0, 40))
|
||||
.addBus("RECOIL", new BusAnimationSequence().addPos(0, 0, ItemGunBaseNT.getIsAiming(stack) ? -0.5 : -0.75, 25, IType.SIN_DOWN).addPos(0, 0, 0, 75, IType.SIN_FULL));
|
||||
.addBus("RECOIL", new BusAnimationSequence().addPos(0, 0, (ItemGunBaseNT.getIsAiming(stack) || !WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_NO_STOCK)) ? -0.25 : -0.75, 25, IType.SIN_DOWN).addPos(0, 0, 0, 75, IType.SIN_FULL));
|
||||
case CYCLE_DRY: return new BusAnimation()
|
||||
.addBus("BOLT", new BusAnimationSequence().addPos(0, 0, 0, 250).addPos(0, 0, -0.3125, 100).hold(25).addPos(0, 0, -2.75, 130).hold(50).addPos(0, 0, -2.4375, 50).addPos(0, 0, 0, 85))
|
||||
.addBus("PLUG", new BusAnimationSequence().addPos(0, 0, 0, 250).hold(125).addPos(0, 0, -2.4375, 130).hold(100).addPos(0, 0, 0, 85))
|
||||
|
||||
@ -15,6 +15,7 @@ import com.hbm.items.weapon.sedna.ItemGunBaseNT.GunState;
|
||||
import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext;
|
||||
import com.hbm.items.weapon.sedna.ItemGunBaseNT.WeaponQuality;
|
||||
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo;
|
||||
import com.hbm.items.weapon.sedna.mags.IMagazine;
|
||||
import com.hbm.items.weapon.sedna.mags.MagazineFullReload;
|
||||
import com.hbm.items.weapon.sedna.mods.WeaponModManager;
|
||||
import com.hbm.main.MainRegistry;
|
||||
@ -25,7 +26,10 @@ import com.hbm.render.anim.BusAnimation;
|
||||
import com.hbm.render.anim.BusAnimationSequence;
|
||||
import com.hbm.render.anim.BusAnimationKeyframe.IType;
|
||||
import com.hbm.render.anim.HbmAnimations.AnimType;
|
||||
import com.hbm.util.EntityDamageUtil;
|
||||
import com.hbm.util.DamageResistanceHandler.DamageClass;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class XFactory9mm {
|
||||
@ -64,7 +68,7 @@ public class XFactory9mm {
|
||||
.dmg(25F).delay(4).dry(10).spread(0.005F).reload(53).jam(44).sound("hbm:weapon.fire.pistol", 1.0F, 1.0F)
|
||||
.mag(new MagazineFullReload(0, 17).addConfigs(p9_sp, p9_fmj, p9_jhp, p9_ap))
|
||||
.offset(1, -0.0625 * 2.5, -0.25D)
|
||||
.setupStandardFire().recoil(LAMBDA_RECOIL_LAG))
|
||||
.setupStandardFire().fire(LAMBDA_FIRE_LAG).recoil(LAMBDA_RECOIL_LAG))
|
||||
.setupStandardConfiguration()
|
||||
.anim(LAMBDA_LAG_ANIMS).orchestra(Orchestras.ORCHESTRA_LAG)
|
||||
).setUnlocalizedName("gun_lag");
|
||||
@ -133,6 +137,27 @@ public class XFactory9mm {
|
||||
GunStateDecider.deciderAutoRefire(stack, ctx, lastState, 0, index, () -> { return ItemGunBaseNT.getSecondary(stack, index) && ItemGunBaseNT.getMode(stack, ctx.configIndex) == 0; });
|
||||
};
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_FIRE_LAG = (stack, ctx) -> {
|
||||
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
|
||||
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
|
||||
EntityPlayer player = ctx.getPlayer();
|
||||
if(player != null && type == AnimType.INSPECT && timer > 20 && timer < 60) {
|
||||
int index = ctx.configIndex;
|
||||
Receiver primary = ctx.config.getReceivers(stack)[0];
|
||||
IMagazine mag = primary.getMagazine(stack);
|
||||
BulletConfig config = (BulletConfig) mag.getType(stack, ctx.inventory);
|
||||
player.addStat(MainRegistry.statBullets, 1);
|
||||
mag.useUpAmmo(stack, ctx.inventory, 1);
|
||||
ItemGunBaseNT.setWear(stack, index, Math.min(ItemGunBaseNT.getWear(stack, index) + config.wear, ctx.config.getDurability(stack)));
|
||||
player.worldObj.playSoundEffect(player.posX, player.posY, player.posZ, primary.getFireSound(stack), primary.getFireVolume(stack), primary.getFirePitch(stack));
|
||||
ItemGunBaseNT.setState(stack, index, GunState.COOLDOWN);
|
||||
ItemGunBaseNT.setTimer(stack, index, primary.getDelayAfterFire(stack));
|
||||
EntityDamageUtil.attackEntityFromNT(player, BulletConfig.getDamage(player, player, DamageClass.PHYSICAL), 1_000F, true, false, 1D, 5F, 0F);
|
||||
} else {
|
||||
Lego.doStandardFire(stack, ctx, AnimType.CYCLE, true);
|
||||
}
|
||||
};
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_SMOKE = (stack, ctx) -> {
|
||||
Lego.handleStandardSmoke(ctx.entity, stack, 2000, 0.05D, 1.1D, ctx.configIndex);
|
||||
};
|
||||
|
||||
@ -132,9 +132,9 @@ public class XFactoryEnergy {
|
||||
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);
|
||||
|
||||
ModItems.gun_tesla_cannon = new ItemGunBaseNT(WeaponQuality.A_SIDE, new GunConfig()
|
||||
.dura(2_000).draw(10).inspect(33).reloadSequential(true).crosshair(Crosshair.CIRCLE)
|
||||
.dura(2_000).draw(10).inspect(33).crosshair(Crosshair.CIRCLE)
|
||||
.rec(new Receiver(0)
|
||||
.dmg(35F).delay(20).reload(44).jam(19).sound("hbm:weapon.fire.tesla", 1.0F, 1.0F)
|
||||
.dmg(35F).delay(20).spreadHipfire(1.5F).reload(44).jam(19).sound("hbm:weapon.fire.tesla", 1.0F, 1.0F)
|
||||
.mag(new MagazineBelt().addConfigs(energy_tesla, energy_tesla_overcharge))
|
||||
.offset(0.75, 0, -0.375).offsetScoped(0.75, 0, -0.25)
|
||||
.setupStandardFire().recoil(LAMBDA_RECOIL_ENERGY))
|
||||
@ -143,9 +143,9 @@ public class XFactoryEnergy {
|
||||
).setUnlocalizedName("gun_tesla_cannon");
|
||||
|
||||
ModItems.gun_lasrifle = new ItemGunBaseNT(WeaponQuality.A_SIDE, new GunConfig()
|
||||
.dura(2_000).draw(10).inspect(26).reloadSequential(true).crosshair(Crosshair.CIRCLE).scopeTexture(scope_luna)
|
||||
.dura(2_000).draw(10).inspect(26).crosshair(Crosshair.CIRCLE).scopeTexture(scope_luna)
|
||||
.rec(new Receiver(0)
|
||||
.dmg(50F).delay(8).reload(44).jam(36).sound("hbm:weapon.fire.laser", 1.0F, 1.0F)
|
||||
.dmg(50F).delay(8).spreadHipfire(1F).reload(44).jam(36).sound("hbm:weapon.fire.laser", 1.0F, 1.0F)
|
||||
.mag(new MagazineFullReload(0, 24).addConfigs(energy_las, energy_las_overcharge, energy_las_ir))
|
||||
.offset(0.75, -0.0625 * 1.5, -0.1875)
|
||||
.setupStandardFire().recoil(LAMBDA_RECOIL_ENERGY))
|
||||
|
||||
@ -10,4 +10,7 @@ public interface IWeaponMod {
|
||||
/** The meat and bones of the upgrade eval. Requires the base value, the held gun, the value's
|
||||
* identifier and the yet unmodified parent (i.e. if the value is part of the receiver, that receiver) */
|
||||
public <T> T eval(T base, ItemStack gun, String key, Object parent);
|
||||
|
||||
public default void onInstall(ItemStack gun, ItemStack mod, int index) { }
|
||||
public default void onUninstall(ItemStack gun, ItemStack mod, int index) { }
|
||||
}
|
||||
|
||||
@ -4,10 +4,13 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.items.weapon.sedna.BulletConfig;
|
||||
import com.hbm.items.weapon.sedna.ItemGunBaseNT;
|
||||
import com.hbm.items.weapon.sedna.Receiver;
|
||||
import com.hbm.items.weapon.sedna.mags.IMagazine;
|
||||
import com.hbm.items.weapon.sedna.mags.MagazineBelt;
|
||||
import com.hbm.items.weapon.sedna.mags.MagazineFullReload;
|
||||
import com.hbm.items.weapon.sedna.mags.MagazineSingleReload;
|
||||
import com.hbm.items.weapon.sedna.mags.MagazineSingleTypeBase;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@ -46,7 +49,6 @@ public class WeaponModCaliber extends WeaponModBase {
|
||||
return (T) DUMMY_FULL;
|
||||
}
|
||||
if(base instanceof MagazineBelt) {
|
||||
MagazineBelt original = (MagazineBelt) base;
|
||||
DUMMY_BELT.acceptedBullets = cfg;
|
||||
return (T) DUMMY_BELT;
|
||||
}
|
||||
@ -56,4 +58,17 @@ public class WeaponModCaliber extends WeaponModBase {
|
||||
}
|
||||
return base;
|
||||
}
|
||||
|
||||
/* adding or removing a caliber mod annihilates the loaded rounds */
|
||||
public void onInstall(ItemStack gun, ItemStack mod, int index) { clearMag(gun, index); }
|
||||
public void onUninstall(ItemStack gun, ItemStack mod, int index) { clearMag(gun, index); }
|
||||
|
||||
public void clearMag(ItemStack stack, int index) {
|
||||
ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem();
|
||||
IMagazine mag = gun.getConfig(stack, index).getReceivers(stack)[0].getMagazine(stack);
|
||||
if(mag instanceof MagazineSingleTypeBase) {
|
||||
MagazineSingleTypeBase mstb = (MagazineSingleTypeBase) mag;
|
||||
mstb.setAmount(stack, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,6 +58,14 @@ public class WeaponModManager {
|
||||
new WeaponModDefinition(new ItemStack(ModItems.weapon_mod_test, 1, EnumModTest.DAMAGE.ordinal())).addDefault(TEST_DAMAGE);
|
||||
new WeaponModDefinition(new ItemStack(ModItems.weapon_mod_test, 1, EnumModTest.MULTI.ordinal())).addDefault(TEST_MULTI);
|
||||
|
||||
new WeaponModDefinition(new ItemStack(ModItems.weapon_mod_test, 1, EnumModTest.OVERRIDE_2_5.ordinal())).addDefault(new WeaponModOverride(3, 2.5F, "OVERRIDE"));
|
||||
new WeaponModDefinition(new ItemStack(ModItems.weapon_mod_test, 1, EnumModTest.OVERRIDE_5.ordinal())).addDefault(new WeaponModOverride(4, 5F, "OVERRIDE"));
|
||||
new WeaponModDefinition(new ItemStack(ModItems.weapon_mod_test, 1, EnumModTest.OVERRIDE_7_5.ordinal())).addDefault(new WeaponModOverride(5, 7.5F, "OVERRIDE"));
|
||||
new WeaponModDefinition(new ItemStack(ModItems.weapon_mod_test, 1, EnumModTest.OVERRIDE_10.ordinal())).addDefault(new WeaponModOverride(6, 10F, "OVERRIDE"));
|
||||
new WeaponModDefinition(new ItemStack(ModItems.weapon_mod_test, 1, EnumModTest.OVERRIDE_12_5.ordinal())).addDefault(new WeaponModOverride(7, 12_5F, "OVERRIDE"));
|
||||
new WeaponModDefinition(new ItemStack(ModItems.weapon_mod_test, 1, EnumModTest.OVERRIDE_15.ordinal())).addDefault(new WeaponModOverride(8, 15F, "OVERRIDE"));
|
||||
new WeaponModDefinition(new ItemStack(ModItems.weapon_mod_test, 1, EnumModTest.OVERRIDE_20.ordinal())).addDefault(new WeaponModOverride(9, 20F, "OVERRIDE"));
|
||||
|
||||
new WeaponModDefinition(new ItemStack(ModItems.weapon_mod_generic, 1, EnumModGeneric.IRON_DAMAGE.ordinal())).addMod(ModItems.gun_pepperbox, new WeaponModGenericDamage(100));
|
||||
new WeaponModDefinition(new ItemStack(ModItems.weapon_mod_generic, 1, EnumModGeneric.IRON_DURA.ordinal())).addMod(ModItems.gun_pepperbox, new WeaponModGenericDurability(101));
|
||||
|
||||
@ -127,13 +135,14 @@ public class WeaponModManager {
|
||||
new WeaponModDefinition(EnumModSpecial.GREASEGUN).addMod(ModItems.gun_greasegun, new WeaponModGreasegun(ID_GREASEGUN_CLEAN));
|
||||
new WeaponModDefinition(EnumModSpecial.SLOWDOWN).addMod(ModItems.gun_minigun, new WeaponModSlowdown(207));
|
||||
new WeaponModDefinition(EnumModSpecial.SPEEDUP)
|
||||
.addMod(ModItems.gun_minigun, new WeaponModMinigunSpeedup(208))
|
||||
.addMod(ModItems.gun_minigun, 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.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).addMod(ModItems.gun_mas36, new WeaponModMASBayonet(ID_MAS_BAYONET));
|
||||
new WeaponModDefinition(EnumModSpecial.STACK_MAG).addMod(new Item[] {ModItems.gun_greasegun, ModItems.gun_uzi, ModItems.gun_uzi_akimbo, ModItems.gun_aberrator, ModItems.gun_aberrator_eott}, new WeaponModStackMag(214));
|
||||
new WeaponModDefinition(EnumModSpecial.SKIN_SATURNITE).addMod(new Item[] {ModItems.gun_uzi, ModItems.gun_uzi_akimbo}, new WeaponModUziSaturnite(ID_UZI_SATURN));
|
||||
|
||||
BulletConfig[] p9 = new BulletConfig[] {XFactory9mm.p9_sp, XFactory9mm.p9_fmj, XFactory9mm.p9_jhp, XFactory9mm.p9_ap};
|
||||
BulletConfig[] p45 = new BulletConfig[] {XFactory45.p45_sp, XFactory45.p45_fmj, XFactory45.p45_jhp, XFactory45.p45_ap, XFactory45.p45_du};
|
||||
@ -150,7 +159,7 @@ public class WeaponModManager {
|
||||
.addMod(ModItems.gun_greasegun, new WeaponModCaliber(311, 24, 3F, p45))
|
||||
.addMod(ModItems.gun_uzi, new WeaponModCaliber(312, 24, 3F, p45))
|
||||
.addMod(ModItems.gun_uzi_akimbo, new WeaponModCaliber(313, 24, 3F, p45))
|
||||
.addMod(ModItems.gun_lag, new WeaponModCaliber(314, 24, 25F, p45));
|
||||
.addMod(ModItems.gun_lag, new WeaponModCaliber(314, 15, 25F, p45));
|
||||
new WeaponModDefinition(EnumModCaliber.P22)
|
||||
.addMod(ModItems.gun_henry, new WeaponModCaliber(320, 28, 10F, p22))
|
||||
.addMod(ModItems.gun_uzi, new WeaponModCaliber(321, 40, 3F, p22))
|
||||
@ -178,9 +187,11 @@ public class WeaponModManager {
|
||||
public static final int ID_NO_SHIELD = 204;
|
||||
public static final int ID_NO_STOCK = 205;
|
||||
public static final int ID_GREASEGUN_CLEAN = 206;
|
||||
public static final int ID_MINIGUN_SPEED = 208;
|
||||
public static final int ID_FURNITURE_GREEN = 211;
|
||||
public static final int ID_FURNITURE_BLACK = 212;
|
||||
public static final int ID_MAS_BAYONET = 213;
|
||||
public static final int ID_UZI_SATURN = 215;
|
||||
|
||||
public static ItemStack[] getUpgradeItems(ItemStack stack, int cfg) {
|
||||
if(!stack.hasTagCompound()) return new ItemStack[0];
|
||||
@ -240,12 +251,29 @@ public class WeaponModManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isApplicable(ItemStack gun, ItemStack mod, int cfg, boolean checkMutex) {
|
||||
if(gun == null || mod == null) return false; //if either stacks are null
|
||||
public static void onInstallStack(ItemStack gun, ItemStack mod, int cfg) {
|
||||
IWeaponMod newMod = modFromStack(gun, mod, cfg);
|
||||
if(newMod == null) return;
|
||||
newMod.onInstall(gun, mod, cfg);
|
||||
}
|
||||
|
||||
public static void onUninstallStack(ItemStack gun, ItemStack mod, int cfg) {
|
||||
IWeaponMod newMod = modFromStack(gun, mod, cfg);
|
||||
if(newMod == null) return;
|
||||
newMod.onUninstall(gun, mod, cfg);
|
||||
}
|
||||
|
||||
public static IWeaponMod modFromStack(ItemStack gun, ItemStack mod, int cfg) {
|
||||
if(gun == null || mod == null) return null;
|
||||
WeaponModDefinition def = stackToMod.get(new ComparableStack(mod));
|
||||
if(def == null) return false; //if the mod stack doesn't have a mod definition
|
||||
IWeaponMod newMod = def.modByGun.get(new ComparableStack(gun));
|
||||
if(newMod == null) newMod = def.modByGun.get(null); //if there's no per-gun mod, default to null key
|
||||
if(def == null) return null;
|
||||
IWeaponMod newMod = def.modByGun.get(new ComparableStack(gun).makeSingular()); //shift clicking causes the gun to have stack size 0!
|
||||
if(newMod == null) newMod = def.modByGun.get(null);
|
||||
return newMod;
|
||||
}
|
||||
|
||||
public static boolean isApplicable(ItemStack gun, ItemStack mod, int cfg, boolean checkMutex) {
|
||||
IWeaponMod newMod = modFromStack(gun, mod, cfg);
|
||||
if(newMod == null) return false; //if there's just no mod applicable
|
||||
|
||||
if(checkMutex) for(int i : gun.stackTagCompound.getIntArray(KEY_MOD_LIST + cfg)) {
|
||||
|
||||
@ -0,0 +1,22 @@
|
||||
package com.hbm.items.weapon.sedna.mods;
|
||||
|
||||
import com.hbm.items.weapon.sedna.Receiver;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class WeaponModOverride extends WeaponModBase {
|
||||
|
||||
protected final float baseDamage;
|
||||
|
||||
public WeaponModOverride(int id, float baseDamage, String... slots) {
|
||||
super(id, slots);
|
||||
this.baseDamage = baseDamage;
|
||||
this.setPriority(PRIORITY_SET);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T eval(T base, ItemStack gun, String key, Object parent) {
|
||||
if(key == Receiver.F_BASEDAMAGE) return cast(baseDamage, base);
|
||||
return base;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
package com.hbm.items.weapon.sedna.mods;
|
||||
|
||||
import com.hbm.items.weapon.sedna.GunConfig;
|
||||
import com.hbm.items.weapon.sedna.Receiver;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class WeaponModUziSaturnite extends WeaponModBase {
|
||||
|
||||
public WeaponModUziSaturnite(int id) {
|
||||
super(id, "FURNITURE");
|
||||
this.setPriority(PRIORITY_ADDITIVE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T eval(T base, ItemStack gun, String key, Object parent) {
|
||||
if(key == GunConfig.F_DURABILITY) return cast((Float) base * 5F, base);
|
||||
if(key == Receiver.F_BASEDAMAGE) return cast((Float) base + 3F, base);
|
||||
return base;
|
||||
}
|
||||
|
||||
}
|
||||
@ -3,7 +3,7 @@ package com.hbm.lib;
|
||||
public class RefStrings {
|
||||
public static final String MODID = "hbm";
|
||||
public static final String NAME = "Hbm's Nuclear Tech Mod";
|
||||
public static final String VERSION = "1.0.27 BETA (5257)";
|
||||
public static final String VERSION = "1.0.27 BETA (5279)";
|
||||
//HBM's Beta Naming Convention:
|
||||
//V T (X)
|
||||
//V -> next release version
|
||||
|
||||
@ -1760,7 +1760,7 @@ public class ClientProxy extends ServerProxy {
|
||||
.addPos(90, 0, 1, 800)
|
||||
.addPos(0, 0, 1, 50));
|
||||
|
||||
HbmAnimations.hotbar[player.inventory.currentItem][0] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation);
|
||||
HbmAnimations.hotbar[player.inventory.currentItem][0] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation, null);
|
||||
}
|
||||
|
||||
/* crucible swing */
|
||||
@ -1782,7 +1782,7 @@ public class ClientProxy extends ServerProxy {
|
||||
|
||||
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("hbm:weapon.cSwing"), 0.8F + player.getRNG().nextFloat() * 0.2F));
|
||||
|
||||
HbmAnimations.hotbar[player.inventory.currentItem][0] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation);
|
||||
HbmAnimations.hotbar[player.inventory.currentItem][0] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation, null);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1806,7 +1806,7 @@ public class ClientProxy extends ServerProxy {
|
||||
.addPos(0, 0, 0, retire));
|
||||
|
||||
|
||||
HbmAnimations.hotbar[player.inventory.currentItem][0] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation);
|
||||
HbmAnimations.hotbar[player.inventory.currentItem][0] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation, null);
|
||||
|
||||
} else {
|
||||
|
||||
@ -1827,7 +1827,7 @@ public class ClientProxy extends ServerProxy {
|
||||
.addPos(2, 0, 2, sideways)
|
||||
.addPos(0, 0, 0, retire));
|
||||
|
||||
HbmAnimations.hotbar[player.inventory.currentItem][0] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation);
|
||||
HbmAnimations.hotbar[player.inventory.currentItem][0] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation, null);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1839,7 +1839,7 @@ public class ClientProxy extends ServerProxy {
|
||||
BusAnimation anim = item.getAnimation(data, stack);
|
||||
|
||||
if(anim != null) {
|
||||
HbmAnimations.hotbar[player.inventory.currentItem][0] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), anim);
|
||||
HbmAnimations.hotbar[player.inventory.currentItem][0] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), anim, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -66,12 +66,10 @@ public class CraftingManager {
|
||||
|
||||
GameRegistry.addRecipe(new RBMKFuelCraftingHandler());
|
||||
GameRegistry.addRecipe(new MKUCraftingHandler());
|
||||
GameRegistry.addRecipe(new ToolboxCraftingHandler());
|
||||
GameRegistry.addRecipe(new CargoShellCraftingHandler());
|
||||
GameRegistry.addRecipe(new ScrapsCraftingHandler());
|
||||
|
||||
RecipeSorter.register("hbm:rbmk", RBMKFuelCraftingHandler.class, RecipeSorter.Category.SHAPELESS, "after:minecraft:shapeless");
|
||||
RecipeSorter.register("hbm:toolbox", ToolboxCraftingHandler.class, RecipeSorter.Category.SHAPELESS, "after:minecraft:shapeless");
|
||||
RecipeSorter.register("hbm:cargo", CargoShellCraftingHandler.class, RecipeSorter.Category.SHAPELESS, "after:minecraft:shapeless");
|
||||
RecipeSorter.register("hbm:scraps", ScrapsCraftingHandler.class, RecipeSorter.Category.SHAPELESS, "after:minecraft:shapeless");
|
||||
RecipeSorter.register("hbm:mku", MKUCraftingHandler.class, RecipeSorter.Category.SHAPED, "after:minecraft:shaped before:minecraft:shapeless");
|
||||
@ -214,7 +212,7 @@ public class CraftingManager {
|
||||
addShapelessAuto(new ItemStack(ModItems.cbt_device, 1), new Object[] { STEEL.bolt(), ModItems.wrench });
|
||||
|
||||
addShapelessAuto(new ItemStack(ModItems.toothpicks, 3), new Object[] { KEY_STICK, KEY_STICK, KEY_STICK });
|
||||
addRecipeAuto(new ItemStack(ModItems.ducttape, 6), new Object[] { "FSF", "SPS", "FSF", 'F', Items.string, 'S', KEY_SLIME, 'P', Items.paper });
|
||||
addRecipeAuto(new ItemStack(ModItems.ducttape, 4), new Object[] { "F", "P", "S", 'F', Items.string, 'S', KEY_SLIME, 'P', Items.paper });
|
||||
|
||||
addRecipeAuto(new ItemStack(ModBlocks.radio_torch_sender, 4), new Object[] { "G", "R", "I", 'G', "dustGlowstone", 'R', Blocks.redstone_torch, 'I', NETHERQUARTZ.gem() });
|
||||
addRecipeAuto(new ItemStack(ModBlocks.radio_torch_receiver, 4), new Object[] { "G", "R", "I", 'G', "dustGlowstone", 'R', Blocks.redstone_torch, 'I', IRON.ingot() });
|
||||
@ -791,7 +789,7 @@ public class CraftingManager {
|
||||
addShapelessAuto(new ItemStack(ModItems.plate_cast, 1, Mats.MAT_STEEL.id), new Object[] { ModBlocks.hadron_plating_voltz });
|
||||
addShapelessAuto(DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED), new Object[] { ModBlocks.hadron_analysis });
|
||||
addShapelessAuto(DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED), new Object[] { ModBlocks.hadron_analysis_glass });
|
||||
|
||||
|
||||
addRecipeAuto(new ItemStack(ModBlocks.hadron_coil_alloy, 1), new Object[] { "WW", "WW", 'W', ALLOY.wireDense() });
|
||||
//addRecipeAuto(new ItemStack(ModBlocks.hadron_coil_gold, 1), new Object[] { "WG", "GW", 'W', ALLOY.wireDense(), 'G', GOLD.wireDense() });
|
||||
//addRecipeAuto(new ItemStack(ModBlocks.hadron_coil_neodymium, 1), new Object[] { "WG", "GW", 'W', ND.wireDense(), 'G', GOLD.wireDense() });
|
||||
@ -1171,29 +1169,29 @@ public class CraftingManager {
|
||||
List<IRecipe> toDestroy = new ArrayList();
|
||||
|
||||
List recipeList = net.minecraft.item.crafting.CraftingManager.getInstance().getRecipeList();
|
||||
|
||||
|
||||
synchronized(recipeList) { //this is how threading works. i think.
|
||||
for(Object o : recipeList) {
|
||||
|
||||
|
||||
if(o instanceof IRecipe) {
|
||||
IRecipe rec = (IRecipe)o;
|
||||
ItemStack stack = rec.getRecipeOutput();
|
||||
|
||||
|
||||
for(ItemStack target : targets) {
|
||||
if(stack != null && stack.getItem() == target.getItem() && stack.getItemDamage() == target.getItemDamage()) toDestroy.add(rec);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(toDestroy.size() > 0) {
|
||||
recipeList.removeAll(toDestroy);
|
||||
}
|
||||
|
||||
|
||||
if(Loader.isModLoaded("Mekanism")) {
|
||||
Item disassembler = (Item) Item.itemRegistry.getObject("Mekanism:AtomicDisassembler");
|
||||
if(disassembler != null) addRecipeAuto(new ItemStack(disassembler, 1), "GAG", "EIE", " I ", 'G', GOLD.plateCast(), 'A', "alloyUltimate", 'E', "battery", 'I', "ingotRefinedObsidian");
|
||||
}
|
||||
|
||||
|
||||
if(Loader.isModLoaded("MekanismGenerators")) {
|
||||
Block generator = (Block) Block.blockRegistry.getObject("MekanismGenerators:Generator");
|
||||
if(generator != null) addRecipeAuto(new ItemStack(generator, 1, 6), " T ", "TAT", "BCB", 'T', TI.plateCast(), 'A', "alloyAdvanced", 'B', "battery", 'C', ANY_PLASTIC.ingot());
|
||||
|
||||
@ -172,7 +172,7 @@ public class MainRegistry {
|
||||
public static StatBase statLegendary;
|
||||
public static StatBase statMines;
|
||||
public static StatBase statBullets;
|
||||
|
||||
|
||||
// Achievements
|
||||
public static Achievement achSacrifice;
|
||||
public static Achievement achImpossible;
|
||||
@ -863,7 +863,7 @@ public class MainRegistry {
|
||||
|
||||
FalloutConfigJSON.initialize();
|
||||
ItemPoolConfigJSON.initialize();
|
||||
|
||||
|
||||
ClientConfig.initConfig();
|
||||
ServerConfig.initConfig();
|
||||
|
||||
@ -1672,6 +1672,9 @@ public class MainRegistry {
|
||||
remapItems.put("hbm:item.briquette_lignite", ModItems.briquette);
|
||||
remapItems.put("hbm:item.antiknock", ModItems.fuel_additive);
|
||||
|
||||
remapItems.put("hbm:item.kit_toolbox_empty", ModItems.toolbox);
|
||||
remapItems.put("hbm:item.kit_toolbox", ModItems.legacy_toolbox);
|
||||
|
||||
for(MissingMapping mapping : event.get()) {
|
||||
|
||||
// ignore all ammo prefixes because those are from the time we threw out all the ammo items
|
||||
|
||||
@ -958,6 +958,7 @@ public class ResourceManager {
|
||||
public static final ResourceLocation flamethrower_daybreaker_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/flamethrower_daybreaker.png");
|
||||
public static final ResourceLocation mike_hawk_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/lag.png");
|
||||
public static final ResourceLocation uzi_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/uzi.png");
|
||||
public static final ResourceLocation uzi_saturnite_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/uzi_saturnite.png");
|
||||
public static final ResourceLocation panzerschreck_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/panzerschreck.png");
|
||||
public static final ResourceLocation g3_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/g3.png");
|
||||
public static final ResourceLocation g3_green_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/g3_polymer_green.png");
|
||||
|
||||
@ -105,7 +105,7 @@ public class GunAnimationPacket implements IMessage {
|
||||
|
||||
if(animation != null) {
|
||||
boolean isReloadAnimation = type == AnimType.RELOAD || type == AnimType.RELOAD_CYCLE || type == AnimType.RELOAD_EMPTY;
|
||||
HbmAnimations.hotbar[slot][0] = new Animation(stack.getItem().getUnlocalizedName(), System.currentTimeMillis(), animation, isReloadAnimation && base.mainConfig.reloadAnimationsSequential);
|
||||
HbmAnimations.hotbar[slot][0] = new Animation(stack.getItem().getUnlocalizedName(), System.currentTimeMillis(), animation, type, isReloadAnimation && base.mainConfig.reloadAnimationsSequential);
|
||||
}
|
||||
|
||||
} catch(Exception x) { }
|
||||
@ -143,7 +143,7 @@ public class GunAnimationPacket implements IMessage {
|
||||
Minecraft.getMinecraft().entityRenderer.itemRenderer.resetEquippedProgress();
|
||||
Minecraft.getMinecraft().entityRenderer.itemRenderer.itemToRender = stack;
|
||||
boolean isReloadAnimation = type == AnimType.RELOAD || type == AnimType.RELOAD_CYCLE || type == AnimType.RELOAD_EMPTY;
|
||||
HbmAnimations.hotbar[slot][gunIndex] = new Animation(stack.getItem().getUnlocalizedName(), System.currentTimeMillis(), animation, isReloadAnimation && config.getReloadAnimSequential(stack));
|
||||
HbmAnimations.hotbar[slot][gunIndex] = new Animation(stack.getItem().getUnlocalizedName(), System.currentTimeMillis(), animation, type, isReloadAnimation && config.getReloadAnimSequential(stack));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -47,18 +47,22 @@ public class HbmAnimations {
|
||||
public BusAnimation animation;
|
||||
// If set, don't cancel this animation when the timer ends, instead wait for the next to start
|
||||
public boolean holdLastFrame = false;
|
||||
// so we know what type of animation we're playing, only used rarely
|
||||
public AnimType type;
|
||||
|
||||
public Animation(String key, long startMillis, BusAnimation animation) {
|
||||
public Animation(String key, long startMillis, BusAnimation animation, AnimType type) {
|
||||
this.key = key;
|
||||
this.startMillis = startMillis;
|
||||
this.animation = animation;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Animation(String key, long startMillis, BusAnimation animation, boolean holdLastFrame) {
|
||||
public Animation(String key, long startMillis, BusAnimation animation, AnimType type, boolean holdLastFrame) {
|
||||
this.key = key;
|
||||
this.startMillis = startMillis;
|
||||
this.animation = animation;
|
||||
this.holdLastFrame = holdLastFrame;
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ public class ItemRenderUzi extends ItemRenderWeaponBase {
|
||||
public void renderFirstPerson(ItemStack stack) {
|
||||
|
||||
ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem();
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.uzi_tex);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(isSaturnite(stack) ? ResourceManager.uzi_saturnite_tex : ResourceManager.uzi_tex);
|
||||
double scale = 0.25D;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
|
||||
@ -143,7 +143,7 @@ public class ItemRenderUzi extends ItemRenderWeaponBase {
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.uzi_tex);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(isSaturnite(stack) ? ResourceManager.uzi_saturnite_tex : ResourceManager.uzi_tex);
|
||||
ResourceManager.uzi.renderPart("Gun");
|
||||
ResourceManager.uzi.renderPart("StockBack");
|
||||
ResourceManager.uzi.renderPart("StockFront");
|
||||
@ -159,14 +159,14 @@ public class ItemRenderUzi extends ItemRenderWeaponBase {
|
||||
|
||||
boolean silenced = hasSilencer(stack, 0);
|
||||
|
||||
if(silenced) {
|
||||
if(silenced && type == ItemRenderType.INVENTORY) {
|
||||
double scale = 0.625D;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(0, 0, -4);
|
||||
}
|
||||
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.uzi_tex);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(isSaturnite(stack) ? ResourceManager.uzi_saturnite_tex : ResourceManager.uzi_tex);
|
||||
ResourceManager.uzi.renderPart("Gun");
|
||||
ResourceManager.uzi.renderPart("StockBack");
|
||||
ResourceManager.uzi.renderPart("StockFront");
|
||||
@ -179,4 +179,8 @@ public class ItemRenderUzi extends ItemRenderWeaponBase {
|
||||
public boolean hasSilencer(ItemStack stack, int cfg) {
|
||||
return WeaponModManager.hasUpgrade(stack, cfg, WeaponModManager.ID_SILENCER);
|
||||
}
|
||||
|
||||
public boolean isSaturnite(ItemStack stack) {
|
||||
return WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_UZI_SATURN);
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,10 +36,10 @@ public class ItemRenderUziAkimbo extends ItemRenderWeaponBase {
|
||||
float offset = 0.8F;
|
||||
|
||||
for(int i = -1; i <= 1; i += 2) {
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.uzi_tex);
|
||||
int index = i == -1 ? 0 : 1;
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(isSaturnite(stack, index) ? ResourceManager.uzi_saturnite_tex : ResourceManager.uzi_tex);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
int index = i == -1 ? 0 : 1;
|
||||
standardAimingTransform(stack, -2.25F * offset * i, -1.5F * offset, 2.5F * offset, 0, -4.375 / 8D, 1);
|
||||
|
||||
double scale = 0.25D;
|
||||
@ -156,7 +156,7 @@ public class ItemRenderUziAkimbo extends ItemRenderWeaponBase {
|
||||
public void renderEquipped(ItemStack stack) {
|
||||
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.uzi_tex);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(isSaturnite(stack, 1) ? ResourceManager.uzi_saturnite_tex : ResourceManager.uzi_tex);
|
||||
ResourceManager.uzi.renderPart("Gun");
|
||||
ResourceManager.uzi.renderPart("StockBack");
|
||||
ResourceManager.uzi.renderPart("StockFront");
|
||||
@ -170,7 +170,7 @@ public class ItemRenderUziAkimbo extends ItemRenderWeaponBase {
|
||||
public void renderEquippedAkimbo(ItemStack stack) {
|
||||
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.uzi_tex);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(isSaturnite(stack, 0) ? ResourceManager.uzi_saturnite_tex : ResourceManager.uzi_tex);
|
||||
ResourceManager.uzi.renderPart("GunMirror");
|
||||
ResourceManager.uzi.renderPart("StockBack");
|
||||
ResourceManager.uzi.renderPart("StockFront");
|
||||
@ -185,7 +185,7 @@ public class ItemRenderUziAkimbo extends ItemRenderWeaponBase {
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.uzi_tex);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(isSaturnite(stack, index) ? ResourceManager.uzi_saturnite_tex : ResourceManager.uzi_tex);
|
||||
ResourceManager.uzi.renderPart(index == 0 ? "GunMirror" : "Gun");
|
||||
ResourceManager.uzi.renderPart("StockBack");
|
||||
ResourceManager.uzi.renderPart("StockFront");
|
||||
@ -199,7 +199,6 @@ public class ItemRenderUziAkimbo extends ItemRenderWeaponBase {
|
||||
public void renderOther(ItemStack stack, ItemRenderType type) {
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.uzi_tex);
|
||||
|
||||
boolean silencer0 = hasSilencer(stack, 1);
|
||||
boolean silencer1 = hasSilencer(stack, 0);
|
||||
@ -216,6 +215,7 @@ public class ItemRenderUziAkimbo extends ItemRenderWeaponBase {
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(0, 0, -4);
|
||||
}
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(isSaturnite(stack, 1) ? ResourceManager.uzi_saturnite_tex : ResourceManager.uzi_tex);
|
||||
ResourceManager.uzi.renderPart("Gun");
|
||||
ResourceManager.uzi.renderPart("StockBack");
|
||||
ResourceManager.uzi.renderPart("StockFront");
|
||||
@ -238,6 +238,7 @@ public class ItemRenderUziAkimbo extends ItemRenderWeaponBase {
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(0, 0, -4);
|
||||
}
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(isSaturnite(stack, 0) ? ResourceManager.uzi_saturnite_tex : ResourceManager.uzi_tex);
|
||||
ResourceManager.uzi.renderPart("GunMirror");
|
||||
ResourceManager.uzi.renderPart("StockBack");
|
||||
ResourceManager.uzi.renderPart("StockFront");
|
||||
@ -252,4 +253,8 @@ public class ItemRenderUziAkimbo extends ItemRenderWeaponBase {
|
||||
public boolean hasSilencer(ItemStack stack, int cfg) {
|
||||
return WeaponModManager.hasUpgrade(stack, cfg, WeaponModManager.ID_SILENCER);
|
||||
}
|
||||
|
||||
public boolean isSaturnite(ItemStack stack, int cfg) {
|
||||
return WeaponModManager.hasUpgrade(stack, cfg, WeaponModManager.ID_UZI_SATURN);
|
||||
}
|
||||
}
|
||||
|
||||
@ -84,6 +84,16 @@ public abstract class ItemRenderWeaponBase implements IItemRenderer {
|
||||
GL11.glPushMatrix();
|
||||
|
||||
if(mc.gameSettings.thirdPersonView == 0 && !mc.renderViewEntity.isPlayerSleeping() && !mc.gameSettings.hideGUI && !mc.playerController.enableEverythingIsScrewedUpMode()) {
|
||||
/*ItemRenderer ir = mc.entityRenderer.itemRenderer;
|
||||
float equip = ir.prevEquippedProgress + (ir.equippedProgress- ir.prevEquippedProgress) * interp;
|
||||
Animation current = HbmAnimations.getRelevantAnim();
|
||||
// flicker prevention, if equip is in progress, only render if an animation is playing
|
||||
if(!(equip < 0.25 && ir.prevEquippedProgress < ir.equippedProgress && (current == null || current.type != AnimType.EQUIP))) {
|
||||
entityRenderer.enableLightmap(interp);
|
||||
this.setupTransformsAndRender(stack);
|
||||
entityRenderer.disableLightmap(interp);
|
||||
}*/
|
||||
|
||||
entityRenderer.enableLightmap(interp);
|
||||
this.setupTransformsAndRender(stack);
|
||||
entityRenderer.disableLightmap(interp);
|
||||
|
||||
@ -1,7 +1,11 @@
|
||||
package com.hbm.tileentity.machine.storage;
|
||||
|
||||
import api.hbm.energymk2.IEnergyReceiverMK2.ConnectionPriority;
|
||||
import api.hbm.fluidmk2.FluidNode;
|
||||
import api.hbm.fluidmk2.IFluidStandardTransceiverMK2;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.handler.CompatHandler;
|
||||
import com.hbm.inventory.FluidContainerRegistry;
|
||||
@ -19,6 +23,8 @@ import com.hbm.tileentity.IFluidCopiable;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.IPersistentNBT;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.uninos.UniNodespace;
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@ -36,10 +42,14 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.EnumSkyBlock;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "opencomputers")})
|
||||
public class TileEntityBarrel extends TileEntityMachineBase implements SimpleComponent, IFluidStandardTransceiverMK2, IPersistentNBT, IGUIProvider, CompatHandler.OCComponent, IFluidCopiable {
|
||||
|
||||
protected FluidNode node;
|
||||
protected FluidType lastType;
|
||||
|
||||
public FluidTank tank;
|
||||
public short mode = 0;
|
||||
public static final short modes = 4;
|
||||
@ -89,10 +99,46 @@ public class TileEntityBarrel extends TileEntityMachineBase implements SimpleCom
|
||||
tank.setType(0, 1, slots);
|
||||
tank.loadTank(2, 3, slots);
|
||||
tank.unloadTank(4, 5, slots);
|
||||
|
||||
for(DirPos pos : getConPos()) {
|
||||
if(mode == 0 || mode == 2) this.trySubscribe(tank.getTankType(), worldObj, pos);
|
||||
if(mode == 1 || mode == 2) this.tryProvide(tank, worldObj, pos);
|
||||
|
||||
// In buffer mode, acts like a pipe block, providing fluid to its own node
|
||||
// otherwise, it is a regular providing/receiving machine, blocking further propagation
|
||||
if(mode == 1) {
|
||||
if(this.node == null || this.node.expired || tank.getTankType() != lastType) {
|
||||
|
||||
this.node = (FluidNode) UniNodespace.getNode(worldObj, xCoord, yCoord, zCoord, tank.getTankType().getNetworkProvider());
|
||||
|
||||
if(this.node == null || this.node.expired || tank.getTankType() != lastType) {
|
||||
this.node = this.createNode(tank.getTankType());
|
||||
UniNodespace.createNode(worldObj, this.node);
|
||||
lastType = tank.getTankType();
|
||||
}
|
||||
}
|
||||
|
||||
if(node != null && node.hasValidNet()) {
|
||||
node.net.addProvider(this);
|
||||
node.net.addReceiver(this);
|
||||
}
|
||||
} else {
|
||||
if(this.node != null) {
|
||||
UniNodespace.destroyNode(worldObj, xCoord, yCoord, zCoord, tank.getTankType().getNetworkProvider());
|
||||
this.node = null;
|
||||
}
|
||||
|
||||
for(DirPos pos : getConPos()) {
|
||||
FluidNode dirNode = (FluidNode) UniNodespace.getNode(worldObj, pos.getX(), pos.getY(), pos.getZ(), tank.getTankType().getNetworkProvider());
|
||||
|
||||
if(mode == 2) {
|
||||
tryProvide(tank, worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
} else {
|
||||
if(dirNode != null && dirNode.hasValidNet()) dirNode.net.removeProvider(this);
|
||||
}
|
||||
|
||||
if(mode == 0) {
|
||||
if(dirNode != null && dirNode.hasValidNet()) dirNode.net.addReceiver(this);
|
||||
} else {
|
||||
if(dirNode != null && dirNode.hasValidNet()) dirNode.net.removeReceiver(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(tank.getFill() > 0) {
|
||||
@ -103,6 +149,30 @@ public class TileEntityBarrel extends TileEntityMachineBase implements SimpleCom
|
||||
}
|
||||
}
|
||||
|
||||
protected FluidNode createNode(FluidType type) {
|
||||
DirPos[] conPos = getConPos();
|
||||
|
||||
HashSet<BlockPos> posSet = new HashSet<>();
|
||||
posSet.add(new BlockPos(this));
|
||||
for(DirPos pos : conPos) {
|
||||
ForgeDirection dir = pos.getDir();
|
||||
posSet.add(new BlockPos(pos.getX() - dir.offsetX, pos.getY() - dir.offsetY, pos.getZ() - dir.offsetZ));
|
||||
}
|
||||
|
||||
return new FluidNode(type.getNetworkProvider(), posSet.toArray(new BlockPos[posSet.size()])).setConnections(conPos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
super.invalidate();
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
if(this.node != null) {
|
||||
UniNodespace.destroyNode(worldObj, xCoord, yCoord, zCoord, tank.getTankType().getNetworkProvider());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
@ -219,6 +289,8 @@ public class TileEntityBarrel extends TileEntityMachineBase implements SimpleCom
|
||||
tank.writeToNBT(nbt, "tank");
|
||||
}
|
||||
|
||||
@Override public boolean canConnect(FluidType fluid, ForgeDirection dir) { return true; }
|
||||
|
||||
@Override
|
||||
public FluidTank[] getSendingTanks() {
|
||||
return (mode == 1 || mode == 2) ? new FluidTank[] {tank} : new FluidTank[0];
|
||||
@ -234,6 +306,11 @@ public class TileEntityBarrel extends TileEntityMachineBase implements SimpleCom
|
||||
return new FluidTank[] { tank };
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConnectionPriority getFluidPriority() {
|
||||
return mode == 1 ? ConnectionPriority.LOW : ConnectionPriority.NORMAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getFluidIDToCopy() {
|
||||
return new int[] {tank.getTankType().getID()};
|
||||
|
||||
@ -191,7 +191,7 @@ public abstract class TileEntityCrateBase extends TileEntityLockableBase impleme
|
||||
|
||||
/// For when opening from a player's inventory.
|
||||
public static void spawnSpiders(EntityPlayer player, World worldObj, ItemStack crate) {
|
||||
if(crate.getTagCompound().getBoolean("spiders")) {
|
||||
if(crate.hasTagCompound() && crate.getTagCompound().getBoolean("spiders")) {
|
||||
Random random = new Random();
|
||||
|
||||
for (int i = 0; i < numSpiders; i++) {
|
||||
|
||||
@ -16,6 +16,7 @@ import com.hbm.lib.Library;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.IPersistentNBT;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.uninos.UniNodespace;
|
||||
import com.hbm.util.CompatEnergyControl;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
@ -36,14 +37,14 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "opencomputers")})
|
||||
public class TileEntityMachineBattery extends TileEntityMachineBase implements IEnergyConductorMK2, IEnergyProviderMK2, IEnergyReceiverMK2, IPersistentNBT, SimpleComponent, IGUIProvider, IInfoProviderEC, CompatHandler.OCComponent {
|
||||
|
||||
|
||||
public long[] log = new long[20];
|
||||
public long delta = 0;
|
||||
public long power = 0;
|
||||
public long prevPowerState = 0;
|
||||
|
||||
|
||||
protected PowerNode node;
|
||||
|
||||
|
||||
//0: input only
|
||||
//1: buffer
|
||||
//2: output only
|
||||
@ -55,16 +56,16 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I
|
||||
public short redLow = 0;
|
||||
public short redHigh = 2;
|
||||
public ConnectionPriority priority = ConnectionPriority.LOW;
|
||||
|
||||
|
||||
//public boolean conducts = false;
|
||||
public byte lastRedstone = 0;
|
||||
|
||||
|
||||
private static final int[] slots_top = new int[] {0};
|
||||
private static final int[] slots_bottom = new int[] {0, 1};
|
||||
private static final int[] slots_side = new int[] {1};
|
||||
|
||||
|
||||
private String customName;
|
||||
|
||||
|
||||
public TileEntityMachineBattery() {
|
||||
super(2);
|
||||
slots = new ItemStack[2];
|
||||
@ -84,24 +85,24 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I
|
||||
public boolean hasCustomInventoryName() {
|
||||
return this.customName != null && this.customName.length() > 0;
|
||||
}
|
||||
|
||||
|
||||
public void setCustomName(String name) {
|
||||
this.customName = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack) {
|
||||
|
||||
|
||||
switch(i) {
|
||||
case 0:
|
||||
case 1:
|
||||
if(stack.getItem() instanceof IBatteryItem) return true;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
@ -112,18 +113,18 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I
|
||||
this.lastRedstone = nbt.getByte("lastRedstone");
|
||||
this.priority = ConnectionPriority.values()[nbt.getByte("priority")];
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
|
||||
|
||||
nbt.setLong("power", power);
|
||||
nbt.setShort("redLow", redLow);
|
||||
nbt.setShort("redHigh", redHigh);
|
||||
nbt.setByte("lastRedstone", lastRedstone);
|
||||
nbt.setByte("priority", (byte)this.priority.ordinal());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int p_94128_1_) {
|
||||
return p_94128_1_ == 0 ? slots_bottom : (p_94128_1_ == 1 ? slots_top : slots_side);
|
||||
@ -136,7 +137,7 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int i, ItemStack itemStack, int j) {
|
||||
|
||||
|
||||
if(itemStack.getItem() instanceof IBatteryItem) {
|
||||
if(i == 0 && ((IBatteryItem)itemStack.getItem()).getCharge(itemStack) == 0) {
|
||||
return true;
|
||||
@ -145,79 +146,95 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public long getPowerRemainingScaled(long i) {
|
||||
return (power * i) / this.getMaxPower();
|
||||
}
|
||||
|
||||
|
||||
public byte getComparatorPower() {
|
||||
if(power == 0) return 0;
|
||||
double frac = (double) this.power / (double) this.getMaxPower() * 15D;
|
||||
return (byte) (MathHelper.clamp_int((int) frac + 1, 0, 15)); //to combat eventual rounding errors with the FEnSU's stupid maxPower
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
|
||||
if(!worldObj.isRemote && worldObj.getBlock(xCoord, yCoord, zCoord) instanceof MachineBattery) {
|
||||
|
||||
|
||||
if(priority == null || priority.ordinal() == 0 || priority.ordinal() == 4) {
|
||||
priority = ConnectionPriority.LOW;
|
||||
}
|
||||
|
||||
|
||||
int mode = this.getRelevantMode(false);
|
||||
|
||||
if(this.node == null || this.node.expired) {
|
||||
|
||||
this.node = Nodespace.getNode(worldObj, xCoord, yCoord, zCoord);
|
||||
|
||||
|
||||
long prevPower = this.power;
|
||||
|
||||
power = Library.chargeItemsFromTE(slots, 1, power, getMaxPower());
|
||||
|
||||
// In buffer mode, becomes a cable block and provides power to itself
|
||||
// otherwise, acts like a regular power providing/accepting machine
|
||||
if(mode == mode_buffer) {
|
||||
if(this.node == null || this.node.expired) {
|
||||
this.node = this.createNode();
|
||||
Nodespace.createNode(worldObj, this.node);
|
||||
|
||||
this.node = (PowerNode) UniNodespace.getNode(worldObj, xCoord, yCoord, zCoord, Nodespace.THE_POWER_PROVIDER);
|
||||
|
||||
if(this.node == null || this.node.expired) {
|
||||
this.node = this.createNode();
|
||||
UniNodespace.createNode(worldObj, this.node);
|
||||
}
|
||||
}
|
||||
|
||||
this.tryProvide(worldObj, xCoord, yCoord, zCoord, ForgeDirection.UNKNOWN);
|
||||
if(node != null && node.hasValidNet()) node.net.addReceiver(this);
|
||||
} else {
|
||||
if(this.node != null) {
|
||||
UniNodespace.destroyNode(worldObj, xCoord, yCoord, zCoord, Nodespace.THE_POWER_PROVIDER);
|
||||
this.node = null;
|
||||
}
|
||||
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
PowerNode dirNode = (PowerNode) UniNodespace.getNode(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, Nodespace.THE_POWER_PROVIDER);
|
||||
|
||||
if(mode == mode_output) {
|
||||
tryProvide(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir);
|
||||
} else {
|
||||
if(dirNode != null && dirNode.hasValidNet()) dirNode.net.removeProvider(this);
|
||||
}
|
||||
|
||||
if(mode == mode_input) {
|
||||
if(dirNode != null && dirNode.hasValidNet()) dirNode.net.addReceiver(this);
|
||||
} else {
|
||||
if(dirNode != null && dirNode.hasValidNet()) dirNode.net.removeReceiver(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
long prevPower = this.power;
|
||||
|
||||
power = Library.chargeItemsFromTE(slots, 1, power, getMaxPower());
|
||||
|
||||
if(mode == mode_output || mode == mode_buffer) {
|
||||
this.tryProvide(worldObj, xCoord, yCoord, zCoord, ForgeDirection.UNKNOWN);
|
||||
} else {
|
||||
if(node != null && node.hasValidNet()) node.net.removeProvider(this);
|
||||
}
|
||||
|
||||
|
||||
byte comp = this.getComparatorPower();
|
||||
if(comp != this.lastRedstone)
|
||||
this.markDirty();
|
||||
this.lastRedstone = comp;
|
||||
|
||||
if(mode == mode_input || mode == mode_buffer) {
|
||||
if(node != null && node.hasValidNet()) node.net.addReceiver(this);
|
||||
} else {
|
||||
if(node != null && node.hasValidNet()) node.net.removeReceiver(this);
|
||||
}
|
||||
|
||||
|
||||
power = Library.chargeTEFromItems(slots, 0, power, getMaxPower());
|
||||
|
||||
long avg = (power + prevPower) / 2;
|
||||
this.delta = avg - this.log[0];
|
||||
|
||||
|
||||
for(int i = 1; i < this.log.length; i++) {
|
||||
this.log[i - 1] = this.log[i];
|
||||
}
|
||||
|
||||
|
||||
this.log[19] = avg;
|
||||
|
||||
|
||||
prevPowerState = power;
|
||||
|
||||
|
||||
this.networkPackNT(20);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void onNodeDestroyedCallback() {
|
||||
this.node = null;
|
||||
}
|
||||
@ -225,10 +242,10 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I
|
||||
@Override
|
||||
public void invalidate() {
|
||||
super.invalidate();
|
||||
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
if(this.node != null) {
|
||||
Nodespace.destroyNode(worldObj, xCoord, yCoord, zCoord);
|
||||
UniNodespace.destroyNode(worldObj, xCoord, yCoord, zCoord, Nodespace.THE_POWER_PROVIDER);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -237,7 +254,7 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I
|
||||
int mode = this.getRelevantMode(true);
|
||||
return mode == mode_output || mode == mode_buffer ? this.getMaxPower() / 600 : 0;
|
||||
}
|
||||
|
||||
|
||||
@Override public long getReceiverSpeed() {
|
||||
int mode = this.getRelevantMode(true);
|
||||
return mode == mode_input || mode == mode_buffer ? this.getMaxPower() / 200 : 0;
|
||||
@ -269,30 +286,30 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I
|
||||
public long getPower() {
|
||||
return power;
|
||||
}
|
||||
|
||||
|
||||
private short modeCache = 0;
|
||||
public short getRelevantMode(boolean useCache) {
|
||||
if(useCache) return this.modeCache;
|
||||
this.modeCache = worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord) ? this.redHigh : this.redLow;
|
||||
return this.modeCache;
|
||||
}
|
||||
|
||||
|
||||
private long bufferedMax;
|
||||
|
||||
@Override
|
||||
public long getMaxPower() {
|
||||
|
||||
|
||||
if(bufferedMax == 0) {
|
||||
bufferedMax = ((MachineBattery)worldObj.getBlock(xCoord, yCoord, zCoord)).maxPower;
|
||||
}
|
||||
|
||||
|
||||
return bufferedMax;
|
||||
}
|
||||
|
||||
@Override public boolean canConnect(ForgeDirection dir) { return true; }
|
||||
@Override public void setPower(long power) { this.power = power; }
|
||||
@Override public ConnectionPriority getPriority() { return this.priority; }
|
||||
|
||||
|
||||
// do some opencomputer stuff
|
||||
@Override
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
package com.hbm.tileentity.machine.storage;
|
||||
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import api.hbm.energymk2.IEnergyReceiverMK2.ConnectionPriority;
|
||||
import api.hbm.fluidmk2.FluidNode;
|
||||
import api.hbm.fluidmk2.IFluidStandardTransceiverMK2;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.explosion.vanillant.ExplosionVNT;
|
||||
@ -21,8 +24,10 @@ import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.tileentity.*;
|
||||
import com.hbm.uninos.UniNodespace;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.util.ParticleUtil;
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
@ -44,23 +49,26 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "opencomputers")})
|
||||
public class TileEntityMachineFluidTank extends TileEntityMachineBase implements SimpleComponent, OCComponent, IFluidStandardTransceiver, IPersistentNBT, IOverpressurable, IGUIProvider, IRepairable, IFluidCopiable{
|
||||
|
||||
public class TileEntityMachineFluidTank extends TileEntityMachineBase implements SimpleComponent, OCComponent, IFluidStandardTransceiverMK2, IPersistentNBT, IOverpressurable, IGUIProvider, IRepairable, IFluidCopiable {
|
||||
|
||||
protected FluidNode node;
|
||||
protected FluidType lastType;
|
||||
|
||||
public FluidTank tank;
|
||||
public short mode = 0;
|
||||
public static final short modes = 4;
|
||||
public boolean hasExploded = false;
|
||||
protected boolean sendingBrake = false;
|
||||
public boolean onFire = false;
|
||||
public byte lastRedstone = 0;
|
||||
public Explosion lastExplosion = null;
|
||||
|
||||
|
||||
public int age = 0;
|
||||
|
||||
|
||||
public TileEntityMachineFluidTank() {
|
||||
super(6);
|
||||
tank = new FluidTank(Fluids.NONE, 256000);
|
||||
@ -81,7 +89,7 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
|
||||
//meta below 12 means that it's an old multiblock configuration
|
||||
if(this.getBlockMetadata() < 12) {
|
||||
//get old direction
|
||||
@ -97,24 +105,61 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements
|
||||
worldObj.getTileEntity(xCoord, yCoord, zCoord).readFromNBT(data);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(!hasExploded) {
|
||||
age++;
|
||||
|
||||
|
||||
if(age >= 20) {
|
||||
age = 0;
|
||||
this.markChanged();
|
||||
}
|
||||
|
||||
for(DirPos pos : getConPos()) {
|
||||
if(mode == 0 || mode == 2) this.trySubscribe(tank.getTankType(), worldObj, pos);
|
||||
if(mode == 1 || mode == 2) this.tryProvide(tank, worldObj, pos);
|
||||
|
||||
// In buffer mode, acts like a pipe block, providing fluid to its own node
|
||||
// otherwise, it is a regular providing/receiving machine, blocking further propagation
|
||||
if(mode == 1) {
|
||||
if(this.node == null || this.node.expired || tank.getTankType() != lastType) {
|
||||
|
||||
this.node = (FluidNode) UniNodespace.getNode(worldObj, xCoord, yCoord, zCoord, tank.getTankType().getNetworkProvider());
|
||||
|
||||
if(this.node == null || this.node.expired || tank.getTankType() != lastType) {
|
||||
this.node = this.createNode(tank.getTankType());
|
||||
UniNodespace.createNode(worldObj, this.node);
|
||||
lastType = tank.getTankType();
|
||||
}
|
||||
}
|
||||
|
||||
if(node != null && node.hasValidNet()) {
|
||||
node.net.addProvider(this);
|
||||
node.net.addReceiver(this);
|
||||
}
|
||||
} else {
|
||||
if(this.node != null) {
|
||||
UniNodespace.destroyNode(worldObj, xCoord, yCoord, zCoord, tank.getTankType().getNetworkProvider());
|
||||
this.node = null;
|
||||
}
|
||||
|
||||
for(DirPos pos : getConPos()) {
|
||||
FluidNode dirNode = (FluidNode) UniNodespace.getNode(worldObj, pos.getX(), pos.getY(), pos.getZ(), tank.getTankType().getNetworkProvider());
|
||||
|
||||
if(mode == 2) {
|
||||
tryProvide(tank, worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
} else {
|
||||
if(dirNode != null && dirNode.hasValidNet()) dirNode.net.removeProvider(this);
|
||||
}
|
||||
|
||||
if(mode == 0) {
|
||||
if(dirNode != null && dirNode.hasValidNet()) dirNode.net.addReceiver(this);
|
||||
} else {
|
||||
if(dirNode != null && dirNode.hasValidNet()) dirNode.net.removeReceiver(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
tank.loadTank(2, 3, slots);
|
||||
tank.setType(0, 1, slots);
|
||||
} else {
|
||||
for(DirPos pos : getConPos()) this.tryUnsubscribe(tank.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ());
|
||||
} else if(this.node != null) {
|
||||
UniNodespace.destroyNode(worldObj, xCoord, yCoord, zCoord, tank.getTankType().getNetworkProvider());
|
||||
this.node = null;
|
||||
}
|
||||
|
||||
byte comp = this.getComparatorPower(); //comparator shit
|
||||
@ -130,11 +175,11 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements
|
||||
this.explode();
|
||||
this.tank.setFill(0);
|
||||
}
|
||||
|
||||
|
||||
if(tank.getTankType().hasTrait(FT_Corrosive.class) && tank.getTankType().getTrait(FT_Corrosive.class).isHighlyCorrosive()) {
|
||||
this.explode();
|
||||
}
|
||||
|
||||
|
||||
if(this.hasExploded) {
|
||||
|
||||
int leaking = 0;
|
||||
@ -145,26 +190,50 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements
|
||||
} else {
|
||||
leaking = Math.min(tank.getFill(), tank.getMaxFill() / 10000);
|
||||
}
|
||||
|
||||
|
||||
updateLeak(leaking);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
tank.unloadTank(4, 5, slots);
|
||||
|
||||
|
||||
this.networkPackNT(150);
|
||||
}
|
||||
|
||||
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10);
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
List<EntityPlayer> players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 2.875, zCoord + 1).offset(dir.offsetX * 0.5 - rot.offsetX * 2.25, 0, dir.offsetZ * 0.5 - rot.offsetZ * 2.25));
|
||||
|
||||
|
||||
for(EntityPlayer player : players) {
|
||||
HbmPlayerProps props = HbmPlayerProps.getData(player);
|
||||
props.isOnLadder = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected FluidNode createNode(FluidType type) {
|
||||
DirPos[] conPos = getConPos();
|
||||
|
||||
HashSet<BlockPos> posSet = new HashSet<>();
|
||||
posSet.add(new BlockPos(this));
|
||||
for(DirPos pos : conPos) {
|
||||
ForgeDirection dir = pos.getDir();
|
||||
posSet.add(new BlockPos(pos.getX() - dir.offsetX, pos.getY() - dir.offsetY, pos.getZ() - dir.offsetZ));
|
||||
}
|
||||
|
||||
return new FluidNode(type.getNetworkProvider(), posSet.toArray(new BlockPos[posSet.size()])).setConnections(conPos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
super.invalidate();
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
if(this.node != null) {
|
||||
UniNodespace.destroyNode(worldObj, xCoord, yCoord, zCoord, tank.getTankType().getNetworkProvider());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
@ -172,7 +241,7 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements
|
||||
buf.writeBoolean(hasExploded);
|
||||
tank.serialize(buf);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
@ -180,39 +249,39 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements
|
||||
hasExploded = buf.readBoolean();
|
||||
tank.deserialize(buf);
|
||||
}
|
||||
|
||||
|
||||
/** called when the tank breaks due to hazardous materials or external force, can be used to quickly void part of the tank or spawn a mushroom cloud */
|
||||
public void explode() {
|
||||
this.hasExploded = true;
|
||||
this.onFire = tank.getTankType().hasTrait(FT_Flammable.class);
|
||||
this.markChanged();
|
||||
}
|
||||
|
||||
|
||||
/** called every tick post explosion, used for leaking fluid and spawning particles */
|
||||
public void updateLeak(int amount) {
|
||||
if(!hasExploded) return;
|
||||
if(amount <= 0) return;
|
||||
|
||||
|
||||
this.tank.getTankType().onFluidRelease(this, tank, amount);
|
||||
this.tank.setFill(Math.max(0, this.tank.getFill() - amount));
|
||||
|
||||
|
||||
FluidType type = tank.getTankType();
|
||||
|
||||
|
||||
if(type.hasTrait(FT_Amat.class)) {
|
||||
new ExplosionVNT(worldObj, xCoord + 0.5, yCoord + 1.5, zCoord + 0.5, 5F).makeAmat().setBlockAllocator(null).setBlockProcessor(null).explode();
|
||||
|
||||
|
||||
} else if(type.hasTrait(FT_Flammable.class) && onFire) {
|
||||
List<Entity> affected = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(xCoord - 1.5, yCoord, zCoord - 1.5, xCoord + 2.5, yCoord + 5, zCoord + 2.5));
|
||||
for(Entity e : affected) e.setFire(5);
|
||||
Random rand = worldObj.rand;
|
||||
ParticleUtil.spawnGasFlame(worldObj, xCoord + rand.nextDouble(), yCoord + 0.5 + rand.nextDouble(), zCoord + rand.nextDouble(), rand.nextGaussian() * 0.2, 0.1, rand.nextGaussian() * 0.2);
|
||||
|
||||
|
||||
if(worldObj.getTotalWorldTime() % 5 == 0) {
|
||||
FT_Polluting.pollute(worldObj, xCoord, yCoord, zCoord, tank.getTankType(), FluidReleaseType.BURN, amount * 5);
|
||||
}
|
||||
|
||||
|
||||
} else if(type.hasTrait(FT_Gaseous.class) || type.hasTrait(FT_Gaseous_ART.class)) {
|
||||
|
||||
|
||||
if(worldObj.getTotalWorldTime() % 5 == 0) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "tower");
|
||||
@ -232,7 +301,7 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements
|
||||
|
||||
@Override
|
||||
public void explode(World world, int x, int y, int z) {
|
||||
|
||||
|
||||
if(this.hasExploded) return;
|
||||
this.onFire = tank.getTankType().hasTrait(FT_Flammable.class);
|
||||
this.hasExploded = true;
|
||||
@ -242,7 +311,7 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements
|
||||
@Override
|
||||
public void tryExtinguish(World world, int x, int y, int z, EnumExtinguishType type) {
|
||||
if(!this.hasExploded || !this.onFire) return;
|
||||
|
||||
|
||||
if(type == EnumExtinguishType.WATER) {
|
||||
if(tank.getTankType().hasTrait(FT_Liquid.class)) { // extinguishing oil with water is a terrible idea!
|
||||
worldObj.newExplosion(null, xCoord + 0.5, yCoord + 1.5, zCoord + 0.5, 5F, true, true);
|
||||
@ -252,13 +321,13 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(type == EnumExtinguishType.FOAM || type == EnumExtinguishType.CO2) {
|
||||
this.onFire = false;
|
||||
this.markChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected DirPos[] getConPos() {
|
||||
return new DirPos[] {
|
||||
new DirPos(xCoord + 2, yCoord, zCoord - 1, Library.POS_X),
|
||||
@ -271,17 +340,17 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements
|
||||
new DirPos(xCoord + 1, yCoord, zCoord - 2, Library.NEG_Z)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public void handleButtonPacket(int value, int meta) {
|
||||
mode = (short) ((mode + 1) % modes);
|
||||
this.markChanged();
|
||||
}
|
||||
|
||||
|
||||
AxisAlignedBB bb = null;
|
||||
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getRenderBoundingBox() {
|
||||
|
||||
|
||||
if(bb == null) {
|
||||
bb = AxisAlignedBB.getBoundingBox(
|
||||
xCoord - 2,
|
||||
@ -292,30 +361,30 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements
|
||||
zCoord + 3
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
return bb;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public double getMaxRenderDistanceSquared() {
|
||||
return 65536.0D;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
|
||||
mode = nbt.getShort("mode");
|
||||
tank.readFromNBT(nbt, "tank");
|
||||
hasExploded = nbt.getBoolean("exploded");
|
||||
onFire = nbt.getBoolean("onFire");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
|
||||
|
||||
nbt.setShort("mode", mode);
|
||||
tank.writeToNBT(nbt, "tank");
|
||||
nbt.setBoolean("exploded", hasExploded);
|
||||
@ -331,12 +400,8 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements
|
||||
|
||||
@Override
|
||||
public long getDemand(FluidType type, int pressure) {
|
||||
|
||||
if(this.mode == 2 || this.mode == 3 || this.sendingBrake)
|
||||
return 0;
|
||||
|
||||
if(this.mode == 2 || this.mode == 3) return 0;
|
||||
if(tank.getPressure() != pressure) return 0;
|
||||
|
||||
return type == tank.getTankType() ? tank.getMaxFill() - tank.getFill() : 0;
|
||||
}
|
||||
|
||||
@ -365,6 +430,8 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements
|
||||
this.onFire = data.getBoolean("onFire");
|
||||
}
|
||||
|
||||
@Override public boolean canConnect(FluidType fluid, ForgeDirection dir) { return true; }
|
||||
|
||||
@Override
|
||||
public FluidTank[] getSendingTanks() {
|
||||
if(this.hasExploded) return new FluidTank[0];
|
||||
@ -373,10 +440,15 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements
|
||||
|
||||
@Override
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
if(this.hasExploded || this.sendingBrake) return new FluidTank[0];
|
||||
if(this.hasExploded) return new FluidTank[0];
|
||||
return (mode == 0 || mode == 1) ? new FluidTank[] {tank} : new FluidTank[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConnectionPriority getFluidPriority() {
|
||||
return mode == 1 ? ConnectionPriority.LOW : ConnectionPriority.NORMAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getFluidIDToCopy() {
|
||||
return new int[] {tank.getTankType().getID()};
|
||||
@ -402,14 +474,14 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements
|
||||
public boolean isDamaged() {
|
||||
return this.hasExploded;
|
||||
}
|
||||
|
||||
|
||||
List<AStack> repair = new ArrayList<>();
|
||||
@Override
|
||||
public List<AStack> getRepairMaterials() {
|
||||
|
||||
|
||||
if(!repair.isEmpty())
|
||||
return repair;
|
||||
|
||||
|
||||
repair.add(new OreDictStack(OreDictManager.STEEL.plate(), 6));
|
||||
return repair;
|
||||
}
|
||||
|
||||
@ -1,26 +1,27 @@
|
||||
package com.hbm.tileentity.network;
|
||||
|
||||
import api.hbm.energymk2.Nodespace;
|
||||
import com.hbm.uninos.UniNodespace;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TileEntityFluidValve extends TileEntityPipeBaseNT {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean shouldCreateNode() {
|
||||
return this.getBlockMetadata() == 1;
|
||||
}
|
||||
|
||||
public void updateState() {
|
||||
|
||||
|
||||
this.blockMetadata = -1; // delete cache
|
||||
|
||||
|
||||
if(this.getBlockMetadata() == 0 && this.node != null) {
|
||||
Nodespace.destroyNode(worldObj, xCoord, yCoord, zCoord);
|
||||
UniNodespace.destroyNode(worldObj, xCoord, yCoord, zCoord, this.getType().getNetworkProvider());
|
||||
this.node = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean shouldRefresh(Block oldBlock, Block newBlock, int oldMeta, int newMeta, World world, int x, int y, int z) {
|
||||
return oldBlock != newBlock;
|
||||
|
||||
@ -26,6 +26,16 @@ public class BobMathUtil {
|
||||
for(int num : nums) if(num > largest) largest = num;
|
||||
return largest;
|
||||
}
|
||||
public static long min(long... nums) {
|
||||
long smallest = Long.MAX_VALUE;
|
||||
for(long num : nums) if(num < smallest) smallest = num;
|
||||
return smallest;
|
||||
}
|
||||
public static long max(long... nums) {
|
||||
long largest = Long.MIN_VALUE;
|
||||
for(long num : nums) if(num > largest) largest = num;
|
||||
return largest;
|
||||
}
|
||||
public static float min(float... nums) {
|
||||
float smallest = Float.MAX_VALUE;
|
||||
for(float num : nums) if(num < smallest) smallest = num;
|
||||
|
||||
@ -111,12 +111,12 @@ public class DamageResistanceHandler {
|
||||
.addExact(DamageSource.fall.damageType, 0F, 1F)
|
||||
.setOther(0F, 0.15F));
|
||||
registerSet(ModItems.rpa_helmet, ModItems.rpa_plate, ModItems.rpa_legs, ModItems.rpa_boots, new ResistanceStats()
|
||||
.addCategory(CATEGORY_PROJECTILE, 20F, 0.65F)
|
||||
.addCategory(CATEGORY_FIRE, 10F, 0.75F)
|
||||
.addCategory(CATEGORY_PROJECTILE, 25F, 0.65F)
|
||||
.addCategory(CATEGORY_FIRE, 10F, 0.9F)
|
||||
.addCategory(CATEGORY_EXPLOSION, 15F, 0.25F)
|
||||
.addExact(DamageClass.LASER.name(), 10F, 0.75F)
|
||||
.addExact(DamageClass.LASER.name(), 25F, 0.75F)
|
||||
.addExact(DamageSource.fall.damageType, 0F, 1F)
|
||||
.setOther(10F, 0.15F));
|
||||
.setOther(15F, 0.3F));
|
||||
ResistanceStats bj = new ResistanceStats()
|
||||
.addCategory(CATEGORY_PROJECTILE, 5F, 0.5F)
|
||||
.addCategory(CATEGORY_FIRE, 2.5F, 0.5F)
|
||||
|
||||
@ -40,6 +40,8 @@ public net.minecraft.nbt.NBTTagList * # Mo
|
||||
|
||||
# ItemRenderer
|
||||
public net.minecraft.client.renderer.ItemRenderer field_78453_b # itemToRender
|
||||
public net.minecraft.client.renderer.ItemRenderer field_78454_c # equippedProgress
|
||||
public net.minecraft.client.renderer.ItemRenderer field_78451_d # prevEquippedProgress
|
||||
|
||||
# AbstractResourcePack
|
||||
public net.minecraft.client.resources.AbstractResourcePack field_110597_b # resourcePackFile
|
||||
|
||||
@ -3697,6 +3697,14 @@ item.wd40.name=VT-40
|
||||
item.weapon_bat.name=Richards Standard
|
||||
item.weapon_bat_nail.name=Das Klischee
|
||||
item.weapon_golf_club.name=Schläger des russischen Mafiosos
|
||||
item.weapon_mod_caliber.bmg50.name=.50 BMG Konversionskit
|
||||
item.weapon_mod_caliber.m357.name=.357 Magnum Konversionskit
|
||||
item.weapon_mod_caliber.m44.name=.44 Magnum Konversionskit
|
||||
item.weapon_mod_caliber.p22.name=.22 lfB Konversionskit
|
||||
item.weapon_mod_caliber.p45.name=.45 Konversionskit
|
||||
item.weapon_mod_caliber.p9.name=9mm Konversionskit
|
||||
item.weapon_mod_caliber.r556.name=5.56mm Konversionskit
|
||||
item.weapon_mod_caliber.r762.name=7.62mm Konversionskit
|
||||
item.weapon_mod_generic.bigmt_damage.name=Optimierter Saturnit-Verschluss
|
||||
item.weapon_mod_generic.bigmt_dura.name=Langlebige Saturnit-Teile
|
||||
item.weapon_mod_generic.bronze_damage.name=Optimierter Bronzeverschluss
|
||||
@ -3723,10 +3731,21 @@ item.weapon_mod_special.greasegun.name=Grease Gun Modernisierungskit
|
||||
item.weapon_mod_special.saw.name=Bügelsäge
|
||||
item.weapon_mod_special.scope.name=Ziehlvorrichtung
|
||||
item.weapon_mod_special.silencer.name=Schalldämpfer
|
||||
item.weapon_mod_special.skin_saturnite.name=Saturnit-Skin
|
||||
item.weapon_mod_special.slowdown.name=Rädergetriebe
|
||||
item.weapon_mod_special.speedloader.name=Schnelllader
|
||||
item.weapon_mod_special.speedup.name=Elektrischer Servomotor
|
||||
item.weapon_mod_special.stack_mag.name=Zweistapel-Magazin
|
||||
item.weapon_mod_test.damage.name=DAMAGE UPGRADE
|
||||
item.weapon_mod_test.firerate.name=FIRE RATE UPGRADE
|
||||
item.weapon_mod_test.multi.name=MULTI SHOT UPGRADE
|
||||
item.weapon_mod_test.override_2_5.name=DAMAGE OVERRIDE (2.5)
|
||||
item.weapon_mod_test.override_5.name=DAMAGE OVERRIDE (5)
|
||||
item.weapon_mod_test.override_7_5.name=DAMAGE OVERRIDE (7.5)
|
||||
item.weapon_mod_test.override_10.name=DAMAGE OVERRIDE (10)
|
||||
item.weapon_mod_test.override_12_5.name=DAMAGE OVERRIDE (12.5)
|
||||
item.weapon_mod_test.override_15.name=DAMAGE OVERRIDE (15)
|
||||
item.weapon_mod_test.override_20.name=DAMAGE OVERRIDE (20)
|
||||
item.weapon_pipe_lead.name=Die Handüberbrückung
|
||||
item.weapon_pipe_rusty.name=Der Einstellungskorrigierer
|
||||
item.weapon_saw.name=Ärztlich autorisierter Mord
|
||||
|
||||
@ -849,6 +849,7 @@ container.soyuzLauncher=Soyuz Launch Platform
|
||||
container.storageDrum=Nuclear Waste Disposal Drum
|
||||
container.teleLinker=TelLink Device
|
||||
container.teleporter=Teleporter
|
||||
container.toolBox=Toolbox
|
||||
container.trainTram=Electric Flat Bed Tram
|
||||
container.turbinegas=Combined Cycle Gas Turbine
|
||||
container.turretArty=Greg
|
||||
@ -3295,8 +3296,8 @@ item.key_red.desc.P11=§4e§r
|
||||
item.key_red_cracked.name=Cracked Key
|
||||
item.key_red_cracked.desc=???
|
||||
item.key_red.key_red_cracked.P11=§4???§r
|
||||
item.kit_toolbox.name=Toolbox
|
||||
item.kit_toolbox_empty.name=Empty Toolbox
|
||||
item.toolbox.name=Toolbox
|
||||
item.toolbox_legacy.name=Toolbox (LEGACY)
|
||||
item.laser_crystal_bismuth.desc=Bismuth-Samarium-Uranium-Thorium crystal matrix
|
||||
item.laser_crystal_bismuth.name=BiSmUTh Laser Crystal
|
||||
item.laser_crystal_cmb.desc=Antischrabidium Suspended in a CMB-Schrabidate Alloy Lattice
|
||||
@ -4723,6 +4724,14 @@ item.wd40.name=VT-40
|
||||
item.weapon_bat.name=Richard's Default
|
||||
item.weapon_bat_nail.name=The Cliché
|
||||
item.weapon_golf_club.name=Russian Mobster's Club
|
||||
item.weapon_mod_caliber.bmg50.name=.50 BMG Conversion Kit
|
||||
item.weapon_mod_caliber.m357.name=.357 Magnum Conversion Kit
|
||||
item.weapon_mod_caliber.m44.name=.44 Magnum Conversion Kit
|
||||
item.weapon_mod_caliber.p22.name=.22 LR Conversion Kit
|
||||
item.weapon_mod_caliber.p45.name=.45 Conversion Kit
|
||||
item.weapon_mod_caliber.p9.name=9mm Conversion Kit
|
||||
item.weapon_mod_caliber.r556.name=5.56mm Conversion Kit
|
||||
item.weapon_mod_caliber.r762.name=7.62mm Conversion Kit
|
||||
item.weapon_mod_generic.bigmt_damage.name=Optimized Saturnite Receiver
|
||||
item.weapon_mod_generic.bigmt_dura.name=High-Durability Saturnite Parts
|
||||
item.weapon_mod_generic.bronze_damage.name=Optimized Bronze Receiver
|
||||
@ -4749,10 +4758,21 @@ item.weapon_mod_special.greasegun.name=Grease Gun Modernization Kit
|
||||
item.weapon_mod_special.saw.name=Hacksaw
|
||||
item.weapon_mod_special.scope.name=Scope
|
||||
item.weapon_mod_special.silencer.name=Silencer
|
||||
item.weapon_mod_special.skin_saturnite.name=Saturnite Skin
|
||||
item.weapon_mod_special.slowdown.name=Gear Train
|
||||
item.weapon_mod_special.speedloader.name=Speedloader
|
||||
item.weapon_mod_special.speedup.name=Auxiliary Electric Engine
|
||||
item.weapon_mod_special.stack_mag.name=Double-Stacked Magazine
|
||||
item.weapon_mod_test.damage.name=DAMAGE UPGRADE
|
||||
item.weapon_mod_test.firerate.name=FIRE RATE UPGRADE
|
||||
item.weapon_mod_test.multi.name=MULTI SHOT UPGRADE
|
||||
item.weapon_mod_test.override_2_5.name=DAMAGE OVERRIDE (2.5)
|
||||
item.weapon_mod_test.override_5.name=DAMAGE OVERRIDE (5)
|
||||
item.weapon_mod_test.override_7_5.name=DAMAGE OVERRIDE (7.5)
|
||||
item.weapon_mod_test.override_10.name=DAMAGE OVERRIDE (10)
|
||||
item.weapon_mod_test.override_12_5.name=DAMAGE OVERRIDE (12.5)
|
||||
item.weapon_mod_test.override_15.name=DAMAGE OVERRIDE (15)
|
||||
item.weapon_mod_test.override_20.name=DAMAGE OVERRIDE (20)
|
||||
item.weapon_pipe_lead.name=The Manual Override
|
||||
item.weapon_pipe_rusty.name=The Attitude Adjuster
|
||||
item.weapon_saw.name=Doctor Assisted Homicide
|
||||
|
||||
BIN
src/main/resources/assets/hbm/textures/gui/gui_toolbox.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 383 B After Width: | Height: | Size: 344 B |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 229 B |
|
After Width: | Height: | Size: 267 B |
|
After Width: | Height: | Size: 267 B |
|
After Width: | Height: | Size: 267 B |
|
After Width: | Height: | Size: 267 B |
|
After Width: | Height: | Size: 267 B |
|
After Width: | Height: | Size: 267 B |
|
After Width: | Height: | Size: 267 B |
|
After Width: | Height: | Size: 5.3 KiB |