mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-03-16 06:35:35 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
689393f00b
24
.gitignore
vendored
24
.gitignore
vendored
@ -20,3 +20,27 @@ build
|
||||
|
||||
# other
|
||||
run
|
||||
|
||||
# CurseForge configuration
|
||||
/curseforge.properties
|
||||
|
||||
# Changelog backup
|
||||
/changelog.bak
|
||||
|
||||
screenshots/
|
||||
|
||||
saves/
|
||||
|
||||
usernamecache.json
|
||||
|
||||
options.txt
|
||||
|
||||
logs/
|
||||
|
||||
doc/
|
||||
|
||||
crash-reports/
|
||||
|
||||
config/
|
||||
|
||||
asm/
|
||||
|
||||
51
build.gradle
51
build.gradle
@ -1,3 +1,9 @@
|
||||
import org.gradle.plugins.ide.eclipse.model.internal.FileReferenceFactory
|
||||
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Paths
|
||||
import java.nio.file.StandardCopyOption
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
maven { url = 'https://maven.minecraftforge.net/' }
|
||||
@ -10,6 +16,14 @@ buildscript {
|
||||
}
|
||||
|
||||
apply plugin: 'forge'
|
||||
apply plugin: 'curseforge'
|
||||
|
||||
|
||||
if(Files.exists(Paths.get("curseforge.properties"))) {
|
||||
// Load CurseForge configuration
|
||||
ext.cfprops = parseConfig(file("curseforge.properties"))
|
||||
}
|
||||
|
||||
def version_name = version = mod_version
|
||||
if(!mod_build_number.isEmpty()) {
|
||||
version_name = mod_version + "_X" + mod_build_number
|
||||
@ -42,7 +56,7 @@ eclipse.classpath.file.whenMerged { cp ->
|
||||
}
|
||||
|
||||
// Create file reference factory
|
||||
def fileref = new org.gradle.plugins.ide.eclipse.model.internal.FileReferenceFactory()
|
||||
def fileref = new FileReferenceFactory()
|
||||
|
||||
// Find all codechicken development jars
|
||||
cp.entries.findAll { entry -> entry.path.contains("codechicken") && entry.path.endsWith("-dev.jar") }.forEach { entry ->
|
||||
@ -114,3 +128,38 @@ task version {
|
||||
println project.version
|
||||
}
|
||||
}
|
||||
|
||||
if(Files.exists(Paths.get("curseforge.properties"))) {
|
||||
curse {
|
||||
apiKey = cfprops.api_key
|
||||
projectId = cfprops.project_id
|
||||
releaseType = "release"
|
||||
|
||||
displayName = "Hbm's Nuclear Tech Mod " + version_name.replace("_", "") + " for Minecraft 1.7.10"
|
||||
|
||||
gameVersions.addAll([
|
||||
"Forge",
|
||||
"Java 8",
|
||||
"Client", "Server"
|
||||
])
|
||||
|
||||
if (Files.exists(Paths.get("changelog"))) {
|
||||
changelog = String.join("\r\n", Files.readAllLines(Paths.get("changelog")))
|
||||
|
||||
// Perform a backup of the changelog and create a new file for next changes
|
||||
doLast {
|
||||
Files.move(Paths.get("changelog"), Paths.get("changelog.bak"), StandardCopyOption.REPLACE_EXISTING)
|
||||
Files.createFile(Paths.get("changelog"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Properties file parsing helper
|
||||
static def parseConfig(File config) {
|
||||
config.withReader {
|
||||
def prop = new Properties()
|
||||
prop.load(it)
|
||||
return (new ConfigSlurper().parse(prop))
|
||||
}
|
||||
}
|
||||
|
||||
55
changelog
Normal file
55
changelog
Normal file
@ -0,0 +1,55 @@
|
||||
## Added
|
||||
* Glpyhids
|
||||
* Hives will spawn randomly in the world
|
||||
* Hives will constantly spawn new glyphids
|
||||
* If exposed to soot, hives will create glyphid scouts, which when far enough from another hive will explode and generate a new hive
|
||||
* Higher soot levels create stronger glyphids
|
||||
* Glyphids possess armor which has a chance of breaking off and fully absorbing damage
|
||||
* Each glyphid has five armor plates
|
||||
* Glyphid types include multiple tiers of melee glyphids as well as a few ranged ones, the scout, and a nuclear variant
|
||||
* Compressor
|
||||
* Can compress fluids, turning them into higher pressure variants
|
||||
* Higher pressure fluid can use the same ducts as regular fluids, connections work the same so long as the input tank can accept the higher pressure type
|
||||
* Can also turn steam into higher pressure types
|
||||
* Vacuum refining now requires oil at 2 PU
|
||||
* Some chemical plant recipes also require compressed fluid, TATB requires sour gas at 1 PU and osmiridic solution requires hydrogen peroxide at 5 PU
|
||||
* A new rocket artillery ammo type that creates volcanic lava on impact
|
||||
* BDCL
|
||||
* A type of lubricant that is easy to make and can be used in hydraulic piston and electric press recipes instead of regular lubricant
|
||||
* FBI drones
|
||||
* A configurable amount of drones can now spawn during FBI raids
|
||||
* They will hover over players, dropping bombs
|
||||
|
||||
## Changed
|
||||
* Updated russian localization
|
||||
* Fluid traits can now be configured, any fluid can now have any fluid with variable stats assigned to them
|
||||
* Large explosions now load the central chunk they are in, this can be disabled in the config
|
||||
* Burning leaded fuels now releases poisonous heavy metals into the atmosphere
|
||||
* The pollution detector now displays rounded values
|
||||
* More machines and especially destroyed ones now release soot
|
||||
* The iGen has been rebalanced again, delete your machine config file for the changes to take effect
|
||||
* The lubricant power multiplier has been increased from 1.1 to 1.5
|
||||
* The fluid divisor has been lowered from 5,000 to 1,000, meaning the iGen now burns flammable liquids at full efficiency
|
||||
* Removed the config for having an additional keybind for dashing, the keybind is now always active since it no longer conflicts with crouching
|
||||
* Crucible recipes no longer use foundry scraps to visualize the recipes, instead they use a lava-like texture
|
||||
* Fusion reactors are now made from welded magnets which are created by welding a cast steel plate onto a magnet
|
||||
* Due to the cost of the cast plates, fusion reactor magnets are now cheaper to compensate
|
||||
* Consequently, particle accelerators are now also cheaper due to being made from mostly fusion reactor magnets
|
||||
* The blowtorch now consumes only 250mB per operation, allowing for up to 16 things to be welded with a single fill
|
||||
* The page and notebook items have been replaced with more dynamic book items that get their data from NBT
|
||||
* C4 can now be made by irradiating PVC
|
||||
* Play stupid games, win stupid prizes
|
||||
* Gas grenades now use the new gas system which should be a lot more pleasant to look at and less heavy on the TPS
|
||||
* Leaded fuels now release heavy metal into the air, heavy metal can cause lead poisoning
|
||||
* Lower heavy metal concentrations can also cause heavy metal poisoning when breaking blocks
|
||||
* Gas artillery shell now create heavy metal and poisonous pollution
|
||||
* FBI agents will now target the player from a much larger distance
|
||||
|
||||
## Fixed
|
||||
* Fixed potential crash or logspam regarding the pollution handler
|
||||
* Fixed missiles leaving behind a 3x3 grid of loaded chunks after being destroyed
|
||||
* Fixed coal ore yielding coal in the crucible instead of making carbon
|
||||
* Fixed a potential issue where BuildCraft generators can't supply the RF to HE converter
|
||||
* Fixed combustion engine sound sometimes continue playing even when turned off
|
||||
* Fixed large mining drill not properly performing a block check and potentially deleting blocks when placed
|
||||
* Fixed calcium solution not having a fluid texture
|
||||
5
curseforge.properties.example
Normal file
5
curseforge.properties.example
Normal file
@ -0,0 +1,5 @@
|
||||
# CurseForge API token (obtainable from https://legacy.curseforge.com/account/api-tokens)
|
||||
api_key=
|
||||
|
||||
# CurseForge project ID
|
||||
project_id=
|
||||
@ -1,14 +1,17 @@
|
||||
mod_version=1.0.27
|
||||
# Empty build number makes a release type
|
||||
mod_build_number=4592
|
||||
mod_build_number=4641
|
||||
|
||||
credits=HbMinecraft, rodolphito (explosion algorithms), grangerave (explosion algorithms),\
|
||||
\ Hoboy (textures, models), Doctor17 (russian localization), Drillgon200 (effects, models, porting),\
|
||||
\ UFFR (RTGs, guns, casings), Pu-238 (Tom impact effects), Bismarck (chinese localization),\
|
||||
\ Frooz (models), Minecreep (models), VT-6/24 (models, textures), Pheo (textures, various machines, models, weapons), Vær (gas centrifuges,\
|
||||
\ better worldgen, ZIRNOX, CP-1 parts, starter guide), Adam29 (liquid petroleum, ethanol, electric furnace),\
|
||||
\ Pashtet (russian localization), MartinTheDragon (calculator, chunk-based fallout), haru315 (spiral point algorithm),\
|
||||
\ Sten89 (models), Pixelguru26 (textures), TheBlueHat (textures), Alcater (GUI textures, porting), impbk2002 (project settings),\
|
||||
\ OvermindDL1 (project settings), TehTemmie (reacher radiation function), Toshayo (satellite loot system, project settings), Silly541 (config for safe ME drives),\
|
||||
\ Voxelstice (OpenComputers integration, turbine spinup), BallOfEnergy1 (OpenComputers integration), martemen (project settings),\
|
||||
\ Pvndols (thorium fuel recipe, gas turbine), JamesH2 (blood mechanics, nitric acid), sdddddf80 (recipe configs), SuperCraftAlex (tooltips)
|
||||
\ Hoboy (textures, models), Doctor17 (russian localization), Drillgon200 (effects, models,\
|
||||
\ porting), UFFR (RTGs, guns, casings, euphemium capacitor), Pu-238 (Tom impact effects), Bismarck\
|
||||
\ (chinese localization), Frooz (models), Minecreep (models), VT-6/24 (models, textures), Pheo (textures,\
|
||||
\ various machines, models, weapons), Vær (gas centrifuges, better worldgen, ZIRNOX, CP-1 parts, starter guide),\
|
||||
\ Adam29 (liquid petroleum, ethanol, electric furnace), Pashtet (russian localization), MartinTheDragon\
|
||||
\ (calculator, chunk-based fallout), haru315 (spiral point algorithm), Sten89 (models), Pixelguru26\
|
||||
\ (textures), TheBlueHat (textures), Alcater (GUI textures, porting), impbk2002 (project settings),\
|
||||
\ Burningwater202 (laminate glass), OvermindDL1 (project settings), TehTemmie (reacher radiation function),\
|
||||
\ Toshayo (satellite loot system, project settings, gradle curse task), Silly541 (config for safe ME drives),\
|
||||
\ Voxelstice (OpenComputers integration, turbine spinup), BallOfEnergy1 (OpenComputers integration), martemen\
|
||||
\ (project settings), Pvndols (thorium fuel recipe, gas turbine), JamesH2 (blood mechanics, nitric acid,\
|
||||
\ particle emitter), sdddddf80 (recipe configs, chinese localization), SuperCraftAlex (tooltips)
|
||||
|
||||
@ -26,7 +26,7 @@ public interface IFluidStandardTransceiver extends IFluidUser {
|
||||
public default long getTotalFluidForSend(FluidType type, int pressure) {
|
||||
|
||||
for(FluidTank tank : getSendingTanks()) {
|
||||
if(tank.getTankType() == type) {
|
||||
if(tank.getTankType() == type && tank.getPressure() == pressure) {
|
||||
return tank.getFill();
|
||||
}
|
||||
}
|
||||
@ -38,7 +38,7 @@ public interface IFluidStandardTransceiver extends IFluidUser {
|
||||
public default void removeFluidForTransfer(FluidType type, int pressure, long amount) {
|
||||
|
||||
for(FluidTank tank : getSendingTanks()) {
|
||||
if(tank.getTankType() == type) {
|
||||
if(tank.getTankType() == type && tank.getPressure() == pressure) {
|
||||
tank.setFill(tank.getFill() - (int) amount);
|
||||
return;
|
||||
}
|
||||
@ -49,7 +49,7 @@ public interface IFluidStandardTransceiver extends IFluidUser {
|
||||
public default long getDemand(FluidType type, int pressure) {
|
||||
|
||||
for(FluidTank tank : getReceivingTanks()) {
|
||||
if(tank.getTankType() == type) {
|
||||
if(tank.getTankType() == type && tank.getPressure() == pressure) {
|
||||
return tank.getMaxFill() - tank.getFill();
|
||||
}
|
||||
}
|
||||
@ -61,7 +61,7 @@ public interface IFluidStandardTransceiver extends IFluidUser {
|
||||
public default long transferFluid(FluidType type, int pressure, long amount) {
|
||||
|
||||
for(FluidTank tank : getReceivingTanks()) {
|
||||
if(tank.getTankType() == type) {
|
||||
if(tank.getTankType() == type && tank.getPressure() == pressure) {
|
||||
tank.setFill(tank.getFill() + (int) amount);
|
||||
|
||||
if(tank.getFill() > tank.getMaxFill()) {
|
||||
|
||||
@ -490,12 +490,10 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl
|
||||
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
if(pos == null) return;
|
||||
TileEntity tile = world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
if(tile == null) return;
|
||||
|
||||
x = tile.xCoord;
|
||||
y = tile.yCoord;
|
||||
z = tile.zCoord;
|
||||
x = pos[0];
|
||||
y = pos[1];
|
||||
z = pos[2];
|
||||
|
||||
EntityPlayer player = event.player;
|
||||
float interp = event.partialTicks;
|
||||
@ -503,9 +501,11 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl
|
||||
double dY = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) interp;
|
||||
double dZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)interp;
|
||||
float exp = 0.002F;
|
||||
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
ICustomBlockHighlight.setup();
|
||||
for(AxisAlignedBB aabb : this.bounding) event.context.drawOutlinedBoundingBox(getAABBRotationOffset(aabb.expand(exp, exp, exp), 0, 0, 0, ForgeDirection.getOrientation(tile.getBlockMetadata() - offset).getRotation(ForgeDirection.UP)).getOffsetBoundingBox(x - dX + 0.5, y - dY, z - dZ + 0.5), -1);
|
||||
for(AxisAlignedBB aabb : this.bounding) event.context.drawOutlinedBoundingBox(getAABBRotationOffset(aabb.expand(exp, exp, exp), 0, 0, 0, ForgeDirection.getOrientation(meta - offset).getRotation(ForgeDirection.UP)).getOffsetBoundingBox(x - dX + 0.5, y - dY, z - dZ + 0.5), -1);
|
||||
ICustomBlockHighlight.cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,7 +7,8 @@ public class BlockEnums {
|
||||
ASBESTOS,
|
||||
HEMATITE,
|
||||
MALACHITE,
|
||||
LIMESTONE
|
||||
LIMESTONE,
|
||||
BAUXITE
|
||||
}
|
||||
|
||||
public static enum EnumBiomeType {
|
||||
|
||||
41
src/main/java/com/hbm/blocks/BlockRemap.java
Normal file
41
src/main/java/com/hbm/blocks/BlockRemap.java
Normal file
@ -0,0 +1,41 @@
|
||||
package com.hbm.blocks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.lib.RefStrings;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||
|
||||
public class BlockRemap extends Block implements ILookOverlay {
|
||||
|
||||
public Block remapBlock;
|
||||
public int remapMeta;
|
||||
|
||||
protected BlockRemap(Block block, int meta) {
|
||||
super(Material.tnt);
|
||||
this.remapBlock = block;
|
||||
this.remapMeta = meta;
|
||||
this.setTickRandomly(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block setBlockName(String name) {
|
||||
super.setBlockName(name);
|
||||
this.setBlockTextureName(RefStrings.MODID + ":" + name);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random rand) {
|
||||
world.setBlock(x, y, z, this.remapBlock, this.remapMeta, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printHook(Pre event, World world, int x, int y, int z) {
|
||||
ILookOverlay.printGeneric(event, "Compatibility block, will convert on update tick.", 0xffff00, 0x404000, new ArrayList());
|
||||
}
|
||||
}
|
||||
@ -11,7 +11,11 @@ import com.hbm.blocks.machine.*;
|
||||
import com.hbm.blocks.machine.pile.*;
|
||||
import com.hbm.blocks.machine.rbmk.*;
|
||||
import com.hbm.blocks.network.*;
|
||||
import com.hbm.blocks.rail.RailNarrowCurve;
|
||||
import com.hbm.blocks.rail.RailNarrowStraight;
|
||||
import com.hbm.blocks.rail.RailStandardBuffer;
|
||||
import com.hbm.blocks.rail.RailStandardCurve;
|
||||
import com.hbm.blocks.rail.RailStandardRamp;
|
||||
import com.hbm.blocks.rail.RailStandardStraight;
|
||||
import com.hbm.blocks.siege.*;
|
||||
import com.hbm.blocks.test.*;
|
||||
@ -30,6 +34,7 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockFalling;
|
||||
import net.minecraft.block.material.*;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
|
||||
@ -204,8 +209,11 @@ public class ModBlocks {
|
||||
public static Block block_aluminium;
|
||||
public static Block block_fluorite;
|
||||
public static Block block_steel;
|
||||
public static Block block_tcalloy;
|
||||
public static Block block_cdalloy;
|
||||
public static Block block_lead;
|
||||
public static Block block_bismuth;
|
||||
public static Block block_cadmium;
|
||||
public static Block block_coltan;
|
||||
public static Block block_tantalium;
|
||||
public static Block block_niobium;
|
||||
@ -311,10 +319,13 @@ public class ModBlocks {
|
||||
public static Block reinforced_brick;
|
||||
public static Block reinforced_ducrete;
|
||||
public static Block reinforced_glass;
|
||||
public static Block reinforced_glass_pane;
|
||||
public static Block reinforced_light;
|
||||
public static Block reinforced_sand;
|
||||
public static Block reinforced_lamp_off;
|
||||
public static Block reinforced_lamp_on;
|
||||
public static Block reinforced_laminate;
|
||||
public static Block reinforced_laminate_pane;
|
||||
|
||||
public static Block lamp_tritium_green_off;
|
||||
public static Block lamp_tritium_green_on;
|
||||
@ -328,6 +339,7 @@ public class ModBlocks {
|
||||
public static Block reinforced_stone;
|
||||
public static Block concrete_smooth;
|
||||
public static Block concrete_colored;
|
||||
public static Block concrete_colored_ext;
|
||||
public static Block concrete;
|
||||
public static Block concrete_asbestos;
|
||||
public static Block concrete_super;
|
||||
@ -483,11 +495,13 @@ public class ModBlocks {
|
||||
public static Block glass_ash;
|
||||
public static Block glass_quartz;
|
||||
|
||||
|
||||
public static Block mush;
|
||||
public static Block mush_block;
|
||||
public static Block mush_block_stem;
|
||||
|
||||
public static Block glyphid_base;
|
||||
public static Block glyphid_spawner;
|
||||
|
||||
public static Block plant_flower;
|
||||
public static Block plant_tall;
|
||||
public static Block plant_dead;
|
||||
@ -670,6 +684,8 @@ public class ModBlocks {
|
||||
public static Block foundry_channel;
|
||||
public static Block foundry_tank;
|
||||
public static Block foundry_outlet;
|
||||
public static Block foundry_slagtap;
|
||||
public static Block slag;
|
||||
|
||||
public static Block machine_difurnace_off;
|
||||
public static Block machine_difurnace_on;
|
||||
@ -748,6 +764,12 @@ public class ModBlocks {
|
||||
public static Block machine_dineutronium_battery;
|
||||
public static Block machine_fensu;
|
||||
public static final int guiID_machine_fensu = 99;
|
||||
|
||||
public static Block capacitor_bus;
|
||||
public static Block capacitor_copper;
|
||||
public static Block capacitor_gold;
|
||||
public static Block capacitor_niobium;
|
||||
public static Block capacitor_tantalium;
|
||||
|
||||
public static Block machine_coal_off;
|
||||
public static Block machine_coal_on;
|
||||
@ -1096,8 +1118,12 @@ public class ModBlocks {
|
||||
public static Block rail_highspeed;
|
||||
public static Block rail_booster;
|
||||
|
||||
public static Block rail_narrow_straight;
|
||||
public static Block rail_narrow_curve;
|
||||
public static Block rail_large_straight;
|
||||
public static Block rail_large_curve;
|
||||
public static Block rail_large_ramp;
|
||||
public static Block rail_large_buffer;
|
||||
|
||||
public static Block statue_elb;
|
||||
public static Block statue_elb_g;
|
||||
@ -1391,8 +1417,11 @@ public class ModBlocks {
|
||||
block_aluminium = new BlockBeaconable(Material.iron).setBlockName("block_aluminium").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_aluminium");
|
||||
block_fluorite = new BlockBeaconable(Material.iron).setBlockName("block_fluorite").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_fluorite");
|
||||
block_steel = new BlockBeaconable(Material.iron).setBlockName("block_steel").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
block_tcalloy = new BlockBeaconable(Material.iron).setBlockName("block_tcalloy").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_tcalloy");
|
||||
block_cdalloy = new BlockBeaconable(Material.iron).setBlockName("block_cdalloy").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_cdalloy");
|
||||
block_lead = new BlockBeaconable(Material.iron).setBlockName("block_lead").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(30.0F).setBlockTextureName(RefStrings.MODID + ":block_lead");
|
||||
block_bismuth = new BlockBeaconable(Material.iron).setBlockName("block_bismuth").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(30.0F).setBlockTextureName(RefStrings.MODID + ":block_bismuth");
|
||||
block_cadmium = new BlockBeaconable(Material.iron).setBlockName("block_cadmium").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(30.0F).setBlockTextureName(RefStrings.MODID + ":block_cadmium");
|
||||
block_coltan = new BlockBeaconable(Material.iron).setBlockName("block_coltan").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(30.0F).setBlockTextureName(RefStrings.MODID + ":block_coltan");
|
||||
block_tantalium = new BlockBeaconable(Material.iron).setBlockName("block_tantalium").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(30.0F).setBlockTextureName(RefStrings.MODID + ":block_tantalium");
|
||||
block_niobium = new BlockBeaconable(Material.iron).setBlockName("block_niobium").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(30.0F);
|
||||
@ -1496,11 +1525,14 @@ public class ModBlocks {
|
||||
|
||||
reinforced_brick = new BlockGeneric(Material.rock).setBlockName("reinforced_brick").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(8000.0F).setBlockTextureName(RefStrings.MODID + ":reinforced_brick");
|
||||
reinforced_glass = new BlockNTMGlassCT(0, RefStrings.MODID + ":reinforced_glass", Material.rock).setBlockName("reinforced_glass").setCreativeTab(MainRegistry.blockTab).setLightOpacity(0).setHardness(15.0F).setResistance(200.0F);
|
||||
reinforced_glass_pane = new BlockNTMGlassPane(0, RefStrings.MODID + ":reinforced_glass_pane", RefStrings.MODID + ":reinforced_glass_pane_edge", Material.rock, false).setBlockName("reinforced_glass_pane").setCreativeTab(MainRegistry.blockTab).setLightOpacity(1).setHardness(15.0F).setResistance(200.0F);
|
||||
reinforced_light = new BlockGeneric(Material.rock).setBlockName("reinforced_light").setCreativeTab(MainRegistry.blockTab).setLightLevel(1.0F).setHardness(15.0F).setResistance(300.0F).setBlockTextureName(RefStrings.MODID + ":reinforced_light");
|
||||
reinforced_sand = new BlockGeneric(Material.rock).setBlockName("reinforced_sand").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(400.0F).setBlockTextureName(RefStrings.MODID + ":reinforced_sand");
|
||||
reinforced_lamp_off = new ReinforcedLamp(Material.rock, false).setBlockName("reinforced_lamp_off").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(300.0F).setBlockTextureName(RefStrings.MODID + ":reinforced_lamp_off");
|
||||
reinforced_lamp_on = new ReinforcedLamp(Material.rock, true).setBlockName("reinforced_lamp_on").setHardness(15.0F).setResistance(300.0F).setBlockTextureName(RefStrings.MODID + ":reinforced_lamp_on");
|
||||
|
||||
reinforced_laminate = new BlockNTMGlassCT(1, RefStrings.MODID + ":reinforced_laminate", Material.rock, true).setBlockName("reinforced_laminate").setCreativeTab(MainRegistry.blockTab).setLightOpacity(0).setHardness(15.0F).setResistance(1000.0F);
|
||||
reinforced_laminate_pane = new BlockNTMGlassPane(1, RefStrings.MODID + ":reinforced_laminate_pane", RefStrings.MODID + ":reinforced_laminate_pane_edge", Material.rock, true).setBlockName("reinforced_laminate_pane").setCreativeTab(MainRegistry.blockTab).setLightOpacity(1).setHardness(15.0F).setResistance(1000.0F);
|
||||
|
||||
lamp_tritium_green_off = new ReinforcedLamp(Material.redstoneLight, false).setBlockName("lamp_tritium_green_off").setStepSound(Block.soundTypeGlass).setCreativeTab(MainRegistry.blockTab).setHardness(3.0F).setBlockTextureName(RefStrings.MODID + ":lamp_tritium_green_off");
|
||||
lamp_tritium_green_on = new ReinforcedLamp(Material.redstoneLight, true).setBlockName("lamp_tritium_green_on").setStepSound(Block.soundTypeGlass).setHardness(3.0F).setBlockTextureName(RefStrings.MODID + ":lamp_tritium_green_on");
|
||||
lamp_tritium_blue_off = new ReinforcedLamp(Material.redstoneLight, false).setBlockName("lamp_tritium_blue_off").setStepSound(Block.soundTypeGlass).setCreativeTab(MainRegistry.blockTab).setHardness(3.0F).setBlockTextureName(RefStrings.MODID + ":lamp_tritium_blue_off");
|
||||
@ -1513,6 +1545,7 @@ public class ModBlocks {
|
||||
reinforced_stone = new BlockGeneric(Material.rock).setBlockName("reinforced_stone").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(3000.0F).setBlockTextureName(RefStrings.MODID + ":reinforced_stone");
|
||||
concrete_smooth = new BlockRadResistant(Material.rock).setBlockName("concrete_smooth").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(4000.0F).setBlockTextureName(RefStrings.MODID + ":concrete");
|
||||
concrete_colored = new BlockConcreteColored(Material.rock).setBlockName("concrete_colored").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(4000.0F).setBlockTextureName(RefStrings.MODID + ":concrete");
|
||||
concrete_colored_ext = new BlockConcreteColoredExt(Material.rock).setBlockName("concrete_colored_ext").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(4000.0F).setBlockTextureName(RefStrings.MODID + ":concrete_colored_ext");
|
||||
concrete = new BlockGeneric(Material.rock).setBlockName("concrete").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(4000.0F).setBlockTextureName(RefStrings.MODID + ":concrete_tile");
|
||||
concrete_asbestos = new BlockGeneric(Material.rock).setBlockName("concrete_asbestos").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(4000.0F).setBlockTextureName(RefStrings.MODID + ":concrete_asbestos");
|
||||
concrete_super = new BlockUberConcrete().setBlockName("concrete_super").setCreativeTab(MainRegistry.blockTab).setHardness(150.0F).setResistance(10000.0F);
|
||||
@ -1670,6 +1703,8 @@ public class ModBlocks {
|
||||
mush = new BlockMush(Material.plants).setBlockName("mush").setCreativeTab(MainRegistry.blockTab).setLightLevel(0.5F).setStepSound(Block.soundTypeGrass).setBlockTextureName(RefStrings.MODID + ":mush");
|
||||
mush_block = new BlockMushHuge(Material.plants).setBlockName("mush_block").setLightLevel(1.0F).setStepSound(Block.soundTypeGrass).setHardness(0.2F).setBlockTextureName(RefStrings.MODID + ":mush_block_skin");
|
||||
mush_block_stem = new BlockMushHuge(Material.plants).setBlockName("mush_block_stem").setLightLevel(1.0F).setStepSound(Block.soundTypeGrass).setHardness(0.2F).setBlockTextureName(RefStrings.MODID + ":mush_block_stem");
|
||||
glyphid_base = new BlockBase(Material.coral).setBlockName("glyphid_base").setStepSound(Block.soundTypeCloth).setHardness(0.5F);
|
||||
glyphid_spawner = new BlockGlyphidSpawner(Material.coral).setBlockName("glyphid_spawner").setStepSound(Block.soundTypeCloth).setHardness(0.5F).setBlockTextureName(RefStrings.MODID + ":glyphid_base");
|
||||
|
||||
plant_flower = new BlockNTMFlower().setBlockName("plant_flower").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeGrass).setHardness(0.0F);
|
||||
plant_tall = new BlockTallPlant().setBlockName("plant_tall").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeGrass).setHardness(0.0F);
|
||||
@ -1787,6 +1822,8 @@ public class ModBlocks {
|
||||
foundry_channel = new FoundryChannel().setBlockName("foundry_channel").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":brick_fire");
|
||||
foundry_tank = new FoundryTank().setBlockName("foundry_tank").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":brick_fire");
|
||||
foundry_outlet = new FoundryOutlet().setBlockName("foundry_outlet").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":brick_fire");
|
||||
foundry_slagtap = new FoundrySlagtap().setBlockName("foundry_slagtap").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":brick_fire");
|
||||
slag = new BlockDynamicSlag().setBlockName("slag").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":slag");
|
||||
|
||||
machine_difurnace_off = new MachineDiFurnace(false).setBlockName("machine_difurnace_off").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
machine_difurnace_on = new MachineDiFurnace(true).setBlockName("machine_difurnace_on").setHardness(5.0F).setLightLevel(1.0F).setResistance(10.0F);
|
||||
@ -1852,13 +1889,19 @@ public class ModBlocks {
|
||||
|
||||
//machine_deuterium = new MachineDeuterium(Material.iron).setBlockName("machine_deuterium").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
|
||||
machine_battery_potato = new MachineBattery(Material.iron, 10000).setBlockName("machine_battery_potato").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
machine_battery = new MachineBattery(Material.iron, 1000000).setBlockName("machine_battery").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
machine_lithium_battery = new MachineBattery(Material.iron, 50000000).setBlockName("machine_lithium_battery").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
machine_schrabidium_battery = new MachineBattery(Material.iron, 25000000000L).setBlockName("machine_schrabidium_battery").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
machine_dineutronium_battery = new MachineBattery(Material.iron, 1000000000000L).setBlockName("machine_dineutronium_battery").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
machine_battery_potato = new MachineBattery(Material.iron, 10_000).setBlockName("machine_battery_potato").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
machine_battery = new MachineBattery(Material.iron, 1_000_000).setBlockName("machine_battery").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
machine_lithium_battery = new MachineBattery(Material.iron, 50_000_000).setBlockName("machine_lithium_battery").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
machine_schrabidium_battery = new MachineBattery(Material.iron, 25_000_000_000L).setBlockName("machine_schrabidium_battery").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
machine_dineutronium_battery = new MachineBattery(Material.iron, 1_000_000_000_000L).setBlockName("machine_dineutronium_battery").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
machine_fensu = new MachineFENSU(Material.iron).setBlockName("machine_fensu").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_fensu");
|
||||
|
||||
capacitor_bus = new MachineCapacitorBus(Material.iron).setBlockName("capacitor_bus").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
capacitor_copper = new MachineCapacitor(Material.iron, 1_000_000L, "copper").setBlockName("capacitor_copper").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_copper");
|
||||
capacitor_gold = new MachineCapacitor(Material.iron, 5_000_000L, "gold").setBlockName("capacitor_gold").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName("gold_block");
|
||||
capacitor_niobium = new MachineCapacitor(Material.iron, 25_000_000L, "niobium").setBlockName("capacitor_niobium").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_niobium");
|
||||
capacitor_tantalium = new MachineCapacitor(Material.iron, 100_000_000L, "tantalium").setBlockName("capacitor_tantalium").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_tantalium");
|
||||
|
||||
machine_coal_off = new MachineCoal(false).setBlockName("machine_coal_off").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
machine_coal_on = new MachineCoal(true).setBlockName("machine_coal_on").setHardness(5.0F).setLightLevel(1.0F).setResistance(10.0F);
|
||||
|
||||
@ -1980,7 +2023,7 @@ public class ModBlocks {
|
||||
reactor_conductor = new BlockPillar(Material.iron, RefStrings.MODID + ":reactor_conductor_top").setBlockName("reactor_conductor").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":reactor_conductor_side");
|
||||
reactor_computer = new ReactorCore(Material.iron).setBlockName("reactor_computer").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":reactor_computer");
|
||||
|
||||
fusion_conductor = new BlockPillar(Material.iron, RefStrings.MODID + ":fusion_conductor_top_alt").setBlockName("fusion_conductor").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":fusion_conductor_side_alt");
|
||||
fusion_conductor = new BlockToolConversionPillar(Material.iron).addVariant("_welded").setBlockName("fusion_conductor").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":fusion_conductor");
|
||||
fusion_center = new BlockPillar(Material.iron, RefStrings.MODID + ":fusion_center_top_alt").setBlockName("fusion_center").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":fusion_center_side_alt");
|
||||
fusion_motor = new BlockPillar(Material.iron, RefStrings.MODID + ":fusion_motor_top_alt").setBlockName("fusion_motor").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":fusion_motor_side_alt");
|
||||
fusion_heater = new BlockPillar(Material.iron, RefStrings.MODID + ":fusion_heater_top").setBlockName("fusion_heater").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":fusion_heater_side");
|
||||
@ -2120,8 +2163,12 @@ public class ModBlocks {
|
||||
rail_narrow = new RailGeneric().setBlockName("rail_narrow").setHardness(5.0F).setResistance(10.0F).setCreativeTab(CreativeTabs.tabTransport).setBlockTextureName(RefStrings.MODID + ":rail_narrow");
|
||||
rail_highspeed = new RailGeneric().setMaxSpeed(1F).setFlexible(false).setBlockName("rail_highspeed").setHardness(5.0F).setResistance(10.0F).setCreativeTab(CreativeTabs.tabTransport).setBlockTextureName(RefStrings.MODID + ":rail_highspeed");
|
||||
rail_booster = new RailBooster().setBlockName("rail_booster").setHardness(5.0F).setResistance(10.0F).setCreativeTab(CreativeTabs.tabTransport).setBlockTextureName(RefStrings.MODID + ":rail_booster");
|
||||
rail_large_straight = new RailStandardStraight().setBlockName("rail_large_straight").setHardness(5.0F).setResistance(10.0F).setCreativeTab(CreativeTabs.tabTransport).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
rail_large_curve = new RailStandardCurve().setBlockName("rail_large_curve").setHardness(5.0F).setResistance(10.0F).setCreativeTab(CreativeTabs.tabTransport).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
rail_narrow_straight = new RailNarrowStraight().setBlockName("rail_narrow_straight").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":rail_narrow_neo");
|
||||
rail_narrow_curve = new RailNarrowCurve().setBlockName("rail_narrow_curve").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":rail_narrow_neo");
|
||||
rail_large_straight = new RailStandardStraight().setBlockName("rail_large_straight").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":rail_standard_straight");
|
||||
rail_large_curve = new RailStandardCurve().setBlockName("rail_large_curve").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":rail_standard_straight");
|
||||
rail_large_ramp = new RailStandardRamp().setBlockName("rail_large_ramp").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":rail_standard_straight");
|
||||
rail_large_buffer = new RailStandardBuffer().setBlockName("rail_large_buffer").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":rail_standard_buffer");
|
||||
|
||||
crate = new BlockCrate(Material.wood).setBlockName("crate").setStepSound(Block.soundTypeWood).setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.consumableTab).setBlockTextureName(RefStrings.MODID + ":crate");
|
||||
crate_weapon = new BlockCrate(Material.wood).setBlockName("crate_weapon").setStepSound(Block.soundTypeWood).setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.consumableTab).setBlockTextureName(RefStrings.MODID + ":crate_weapon");
|
||||
@ -2523,8 +2570,11 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(block_beryllium, block_beryllium.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(block_cobalt, block_cobalt.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(block_steel, block_steel.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(block_tcalloy, block_tcalloy.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(block_cdalloy, block_cdalloy.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(block_lead, block_lead.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(block_bismuth, block_bismuth.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(block_cadmium, block_cadmium.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(block_coltan, block_coltan.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(block_tantalium, block_tantalium.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(block_niobium, block_niobium.getUnlocalizedName());
|
||||
@ -2636,16 +2686,20 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(asphalt_light, ItemBlockBlastInfo.class, asphalt_light.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(reinforced_brick, ItemBlockBlastInfo.class, reinforced_brick.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(reinforced_glass, ItemBlockBlastInfo.class, reinforced_glass.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(reinforced_glass_pane, ItemBlockBlastInfo.class, reinforced_glass_pane.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(reinforced_light, ItemBlockBlastInfo.class, reinforced_light.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(reinforced_sand, ItemBlockBlastInfo.class, reinforced_sand.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(reinforced_lamp_off, ItemBlockBlastInfo.class, reinforced_lamp_off.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(reinforced_lamp_on, ItemBlockBlastInfo.class, reinforced_lamp_on.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(reinforced_laminate, ItemBlockBlastInfo.class, reinforced_laminate.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(reinforced_laminate_pane,ItemBlockBlastInfo.class, reinforced_laminate_pane.getUnlocalizedName());
|
||||
|
||||
//Bricks
|
||||
GameRegistry.registerBlock(reinforced_stone, ItemBlockBlastInfo.class, reinforced_stone.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(reinforced_ducrete, ItemBlockBlastInfo.class, reinforced_ducrete.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(concrete_smooth, ItemBlockBlastInfo.class, concrete_smooth.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(concrete_colored, ItemBlockColoredConcrete.class, concrete_colored.getUnlocalizedName());
|
||||
register(concrete_colored_ext);
|
||||
GameRegistry.registerBlock(concrete, ItemBlockBlastInfo.class, concrete.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(concrete_asbestos, ItemBlockBlastInfo.class, concrete_asbestos.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(concrete_super, ItemBlockBlastInfo.class, concrete_super.getUnlocalizedName());
|
||||
@ -2794,6 +2848,8 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(mush, mush.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(mush_block, mush_block.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(mush_block_stem, mush_block_stem.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(glyphid_base, glyphid_base.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(glyphid_spawner, glyphid_spawner.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(moon_turf, moon_turf.getUnlocalizedName());
|
||||
|
||||
//Waste
|
||||
@ -3001,6 +3057,8 @@ public class ModBlocks {
|
||||
register(foundry_channel);
|
||||
register(foundry_tank);
|
||||
register(foundry_outlet);
|
||||
register(foundry_slagtap);
|
||||
register(slag);
|
||||
register(machine_difurnace_off);
|
||||
register(machine_difurnace_on);
|
||||
register(machine_difurnace_extension);
|
||||
@ -3160,6 +3218,11 @@ public class ModBlocks {
|
||||
register(machine_schrabidium_battery);
|
||||
register(machine_dineutronium_battery);
|
||||
register(machine_fensu);
|
||||
register(capacitor_bus);
|
||||
register(capacitor_copper);
|
||||
register(capacitor_gold);
|
||||
register(capacitor_niobium);
|
||||
register(capacitor_tantalium);
|
||||
GameRegistry.registerBlock(machine_transformer, machine_transformer.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_transformer_20, machine_transformer_20.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_transformer_dnt, machine_transformer_dnt.getUnlocalizedName());
|
||||
@ -3272,7 +3335,7 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(reactor_conductor, reactor_conductor.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(reactor_computer, reactor_computer.getUnlocalizedName());
|
||||
|
||||
GameRegistry.registerBlock(fusion_conductor, fusion_conductor.getUnlocalizedName());
|
||||
register(fusion_conductor);
|
||||
GameRegistry.registerBlock(fusion_center, fusion_center.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(fusion_motor, fusion_motor.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(fusion_heater, fusion_heater.getUnlocalizedName());
|
||||
@ -3345,8 +3408,12 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(rail_narrow, ItemBlockBase.class, rail_narrow.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(rail_highspeed, ItemBlockBase.class, rail_highspeed.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(rail_booster, ItemBlockBase.class, rail_booster.getUnlocalizedName());
|
||||
register(rail_narrow_straight);
|
||||
register(rail_narrow_curve);
|
||||
register(rail_large_straight);
|
||||
register(rail_large_curve);
|
||||
register(rail_large_ramp);
|
||||
register(rail_large_buffer);
|
||||
|
||||
//Crate
|
||||
GameRegistry.registerBlock(crate, crate.getUnlocalizedName());
|
||||
@ -3435,7 +3502,12 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(b, ItemBlockBase.class, b.getUnlocalizedName());
|
||||
}
|
||||
|
||||
/*private static void register(Block b, Class<? extends ItemBlock> clazz) {
|
||||
private static void register(Block b, Class<? extends ItemBlock> clazz) {
|
||||
GameRegistry.registerBlock(b, clazz, b.getUnlocalizedName());
|
||||
}*/
|
||||
}
|
||||
|
||||
public static void addRemap(String unloc, Block block, int meta) {
|
||||
Block remap = new BlockRemap(block, meta).setBlockName(unloc);
|
||||
register(remap, ItemBlockRemap.class);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,35 @@
|
||||
package com.hbm.blocks.generic;
|
||||
|
||||
import com.hbm.blocks.BlockEnumMulti;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class BlockConcreteColoredExt extends BlockEnumMulti {
|
||||
|
||||
public BlockConcreteColoredExt(Material mat) {
|
||||
super(mat, EnumConcreteType.class, true, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
|
||||
if(meta == EnumConcreteType.MACHINE_STRIPE.ordinal() && (side == 0 || side == 1)) {
|
||||
return super.getIcon(side, EnumConcreteType.MACHINE.ordinal());
|
||||
}
|
||||
|
||||
return super.getIcon(side, meta);
|
||||
}
|
||||
|
||||
public enum EnumConcreteType {
|
||||
MACHINE,
|
||||
MACHINE_STRIPE,
|
||||
INDIGO,
|
||||
PURPLE,
|
||||
PINK,
|
||||
HAZARD
|
||||
}
|
||||
}
|
||||
278
src/main/java/com/hbm/blocks/generic/BlockDynamicSlag.java
Normal file
278
src/main/java/com/hbm/blocks/generic/BlockDynamicSlag.java
Normal file
@ -0,0 +1,278 @@
|
||||
package com.hbm.blocks.generic;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.inventory.material.MaterialShapes;
|
||||
import com.hbm.inventory.material.Mats;
|
||||
import com.hbm.inventory.material.Mats.MaterialStack;
|
||||
import com.hbm.inventory.material.NTMMaterial;
|
||||
import com.hbm.items.machine.ItemScraps;
|
||||
import com.hbm.render.icon.RGBMutatorInterpolatedComponentRemap;
|
||||
import com.hbm.render.icon.TextureAtlasSpriteMutatable;
|
||||
import com.hbm.util.Compat;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.stats.StatList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class BlockDynamicSlag extends BlockContainer {
|
||||
|
||||
private HashMap<NTMMaterial, IIcon> iconMap = new HashMap();
|
||||
|
||||
public BlockDynamicSlag() {
|
||||
super(Material.iron);
|
||||
this.useNeighborBrightness = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntitySlag();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister reg) {
|
||||
super.registerBlockIcons(reg);
|
||||
|
||||
if(reg instanceof TextureMap) {
|
||||
TextureMap map = (TextureMap) reg;
|
||||
|
||||
for(NTMMaterial mat : Mats.orderedList) {
|
||||
if(mat.solidColorLight != mat.solidColorDark) {
|
||||
String placeholderName = this.getTextureName() + "-" + mat.names[0];
|
||||
TextureAtlasSpriteMutatable mutableIcon = new TextureAtlasSpriteMutatable(placeholderName, new RGBMutatorInterpolatedComponentRemap(0xFFFFFF, 0x505050, mat.solidColorLight, mat.solidColorDark)).setBlockAtlas();
|
||||
map.setTextureEntry(placeholderName, mutableIcon);
|
||||
iconMap.put(mat, mutableIcon);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
|
||||
TileEntitySlag tile = (TileEntitySlag) world.getTileEntity(x, y, z);
|
||||
|
||||
if(tile != null && tile.mat != null) {
|
||||
IIcon override = iconMap.get(tile.mat);
|
||||
if(override != null) {
|
||||
return override;
|
||||
}
|
||||
}
|
||||
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
|
||||
|
||||
TileEntitySlag tile = (TileEntitySlag) world.getTileEntity(x, y, z);
|
||||
|
||||
if(tile != null && tile.mat != null) {
|
||||
if(!iconMap.containsKey(tile.mat)) {
|
||||
return tile.mat.moltenColor;
|
||||
}
|
||||
}
|
||||
|
||||
return 0xffffff;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
||||
TileEntitySlag tile = (TileEntitySlag) world.getTileEntity(x, y, z);
|
||||
if(tile != null) {
|
||||
this.setBlockBounds(0F, 0F, 0F, 1F, (float) tile.amount / (float) TileEntitySlag.maxAmount, 1F);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
TileEntitySlag tile = (TileEntitySlag) world.getTileEntity(x, y, z);
|
||||
if(tile != null) {
|
||||
this.setBlockBounds(0F, 0F, 0F, 1F, (float) tile.amount / (float) TileEntitySlag.maxAmount, 1F);
|
||||
}
|
||||
return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random rand) {
|
||||
|
||||
TileEntity s = Compat.getTileStandard(world, x, y, z);
|
||||
TileEntity b = Compat.getTileStandard(world, x, y - 1, z);
|
||||
|
||||
/* Error here, delete the block */
|
||||
if(s == null || !(s instanceof TileEntitySlag)) {
|
||||
world.setBlockToAir(x, y, z);
|
||||
return;
|
||||
}
|
||||
|
||||
TileEntitySlag self = (TileEntitySlag) s;
|
||||
|
||||
/* Flow down */
|
||||
if(world.getBlock(x, y - 1, z).isReplaceable(world, x, y - 1, z)) {
|
||||
world.setBlock(x, y - 1, z, ModBlocks.slag);
|
||||
TileEntitySlag tile = (TileEntitySlag) Compat.getTileStandard(world, x, y - 1, z);
|
||||
tile.mat = self.mat;
|
||||
tile.amount = self.amount;
|
||||
world.markBlockForUpdate(x, y - 1, z);
|
||||
world.setBlockToAir(x, y, z);
|
||||
return;
|
||||
} else if(b instanceof TileEntitySlag) {
|
||||
|
||||
TileEntitySlag below = (TileEntitySlag) b;
|
||||
|
||||
if(below.mat == self.mat && below.amount < TileEntitySlag.maxAmount) {
|
||||
int transfer = Math.min(TileEntitySlag.maxAmount - below.amount, self.amount);
|
||||
below.amount += transfer;
|
||||
self.amount -= transfer;
|
||||
|
||||
if(self.amount <= 0){
|
||||
world.setBlockToAir(x, y, z);
|
||||
} else {
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
}
|
||||
|
||||
world.markBlockForUpdate(x, y - 1, z);
|
||||
world.scheduleBlockUpdate(x, y - 1, z, ModBlocks.slag, 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* Flow sideways, no neighbors */
|
||||
ForgeDirection[] sides = new ForgeDirection[] { ForgeDirection.NORTH, ForgeDirection.SOUTH, ForgeDirection.EAST, ForgeDirection.WEST };
|
||||
int count = 0;
|
||||
for(ForgeDirection dir : sides) {
|
||||
int iX = x + dir.offsetX;
|
||||
int iZ = z + dir.offsetZ;
|
||||
|
||||
if(world.getBlock(iX, y, iZ).isReplaceable(world, iX, y, iZ)) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
if(self.amount >= self.maxAmount / 5 && count > 0) {
|
||||
int toSpread = Math.max(self.amount / (count * 2), 1);
|
||||
|
||||
for(ForgeDirection dir : sides) {
|
||||
int iX = x + dir.offsetX;
|
||||
int iZ = z + dir.offsetZ;
|
||||
|
||||
if(world.getBlock(iX, y, iZ).isReplaceable(world, iX, y, iZ)) {
|
||||
world.setBlock(iX, y, iZ, ModBlocks.slag);
|
||||
TileEntitySlag tile = (TileEntitySlag) Compat.getTileStandard(world, iX, y, iZ);
|
||||
world.markBlockForUpdate(iX, y, iZ);
|
||||
world.scheduleBlockUpdate(iX, y, iZ, ModBlocks.slag, 1);
|
||||
tile.mat = self.mat;
|
||||
tile.amount = toSpread;
|
||||
self.amount -= toSpread;
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer player) {
|
||||
|
||||
if(!player.capabilities.isCreativeMode) {
|
||||
harvesters.set(player);
|
||||
this.dropBlockAsItem(world, x, y, z, meta, 0);
|
||||
harvesters.set(null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void harvestBlock(World world, EntityPlayer player, int x, int y, int z, int meta) {
|
||||
player.addStat(StatList.mineBlockStatArray[getIdFromBlock(this)], 1);
|
||||
player.addExhaustion(0.025F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
|
||||
|
||||
TileEntitySlag tile = (TileEntitySlag) world.getTileEntity(x, y, z);
|
||||
|
||||
if(tile != null && tile.mat != null && tile.amount > 0) {
|
||||
ret.add(ItemScraps.create(new MaterialStack(tile.mat, tile.amount)));
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
|
||||
|
||||
TileEntitySlag tile = (TileEntitySlag) world.getTileEntity(x, y, z);
|
||||
|
||||
if(tile != null) {
|
||||
return ItemScraps.create(new MaterialStack(tile.mat, tile.amount));
|
||||
}
|
||||
|
||||
return super.getPickBlock(target, world, x, y, z, player);
|
||||
}
|
||||
|
||||
public static class TileEntitySlag extends TileEntity {
|
||||
|
||||
public NTMMaterial mat;
|
||||
public int amount;
|
||||
public static int maxAmount = MaterialShapes.BLOCK.q(16);
|
||||
|
||||
@Override
|
||||
public boolean canUpdate() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
this.writeToNBT(nbt);
|
||||
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||
this.readFromNBT(pkt.func_148857_g());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
this.mat = Mats.matById.get(nbt.getInteger("mat"));
|
||||
this.amount = nbt.getInteger("amount");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
if(this.mat != null) nbt.setInteger("mat", this.mat.id);
|
||||
nbt.setInteger("amount", this.amount);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,72 @@
|
||||
package com.hbm.blocks.generic;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.config.MobConfig;
|
||||
import com.hbm.entity.mob.EntityGlyphid;
|
||||
import com.hbm.entity.mob.EntityGlyphidBehemoth;
|
||||
import com.hbm.entity.mob.EntityGlyphidBlaster;
|
||||
import com.hbm.entity.mob.EntityGlyphidBombardier;
|
||||
import com.hbm.entity.mob.EntityGlyphidBrawler;
|
||||
import com.hbm.entity.mob.EntityGlyphidBrenda;
|
||||
import com.hbm.entity.mob.EntityGlyphidNuclear;
|
||||
import com.hbm.entity.mob.EntityGlyphidScout;
|
||||
import com.hbm.handler.pollution.PollutionHandler;
|
||||
import com.hbm.handler.pollution.PollutionHandler.PollutionType;
|
||||
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.EnumDifficulty;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockGlyphidSpawner extends BlockContainer {
|
||||
|
||||
public BlockGlyphidSpawner(Material p_i45386_1_) {
|
||||
super(p_i45386_1_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityGlpyhidSpawner();
|
||||
}
|
||||
|
||||
public static class TileEntityGlpyhidSpawner extends TileEntity {
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote && worldObj.getTotalWorldTime() % 60 == 0 && this.worldObj.difficultySetting != EnumDifficulty.PEACEFUL) {
|
||||
|
||||
|
||||
float soot = PollutionHandler.getPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.SOOT);
|
||||
List<EntityGlyphid> list = worldObj.getEntitiesWithinAABB(EntityGlyphid.class, AxisAlignedBB.getBoundingBox(xCoord - 6, yCoord + 1, zCoord - 6, xCoord + 7, yCoord + 9, zCoord + 7));
|
||||
|
||||
if(list.size() < 3) {
|
||||
EntityGlyphid glyphid = createGlyphid(soot);
|
||||
glyphid.setLocationAndAngles(xCoord + 0.5, yCoord + 1, zCoord + 0.5, worldObj.rand.nextFloat() * 360.0F, 0.0F);
|
||||
this.worldObj.spawnEntityInWorld(glyphid);
|
||||
}
|
||||
|
||||
if(worldObj.rand.nextInt(20) == 0 && soot >= MobConfig.scoutThreshold) {
|
||||
EntityGlyphidScout scout = new EntityGlyphidScout(worldObj);
|
||||
scout.setLocationAndAngles(xCoord + 0.5, yCoord + 1, zCoord + 0.5, worldObj.rand.nextFloat() * 360.0F, 0.0F);
|
||||
this.worldObj.spawnEntityInWorld(scout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public EntityGlyphid createGlyphid(float soot) {
|
||||
Random rand = new Random();
|
||||
|
||||
if(soot < MobConfig.tier2Threshold) return rand.nextInt(5) == 0 ? new EntityGlyphidBombardier(worldObj) : new EntityGlyphid(worldObj);
|
||||
if(soot < MobConfig.tier3Threshold) return rand.nextInt(5) == 0 ? new EntityGlyphidBombardier(worldObj) : new EntityGlyphidBrawler(worldObj);
|
||||
if(soot < MobConfig.tier4Threshold) return rand.nextInt(5) == 0 ? new EntityGlyphidBlaster(worldObj) : new EntityGlyphidBehemoth(worldObj);
|
||||
if(soot < MobConfig.tier5Threshold) return rand.nextInt(5) == 0 ? new EntityGlyphidBlaster(worldObj) : new EntityGlyphidBrenda(worldObj);
|
||||
|
||||
return rand.nextInt(3) == 0 ? new EntityGlyphidBlaster(worldObj) : new EntityGlyphidNuclear(worldObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -22,19 +22,23 @@ public class BlockNTMGlass extends BlockBreakable {
|
||||
this.doesDrop = doesDrop;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random rand) {
|
||||
return doesDrop ? 1 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderBlockPass() {
|
||||
return renderLayer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canSilkHarvest() {
|
||||
return true;
|
||||
}
|
||||
|
||||
52
src/main/java/com/hbm/blocks/generic/BlockNTMGlassPane.java
Normal file
52
src/main/java/com/hbm/blocks/generic/BlockNTMGlassPane.java
Normal file
@ -0,0 +1,52 @@
|
||||
package com.hbm.blocks.generic;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockPane;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class BlockNTMGlassPane extends BlockPane
|
||||
{
|
||||
int renderLayer;
|
||||
boolean doesDrop = false;
|
||||
|
||||
//NOTE when you have eclipse make the constructor for you it *WILL BE 'protected'* so make sure to make this public like below.
|
||||
/*public BlockNTMGlassPane(String flatFaceTextureName, String rimTextureName,
|
||||
Material mat, boolean bool) {
|
||||
super(flatFaceTextureName, rimTextureName, mat, bool);
|
||||
// TODO Auto-generated constructor stub
|
||||
this.setLightOpacity(1);
|
||||
this.opaque = true;
|
||||
}*/
|
||||
|
||||
public BlockNTMGlassPane(int layer, String name, String rimTextureName, Material material, boolean doesDrop) {
|
||||
super(name, rimTextureName, material, false);
|
||||
this.renderLayer = layer;
|
||||
this.doesDrop = doesDrop;
|
||||
this.opaque = true;
|
||||
this.setLightOpacity(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPaneConnectTo(IBlockAccess world, int x, int y, int z, ForgeDirection dir) {
|
||||
Block b = world.getBlock(x, y, z);
|
||||
return super.canPaneConnectTo(world, x, y, z, dir) || b instanceof BlockNTMGlass;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderBlockPass() {
|
||||
return renderLayer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random rand) {
|
||||
return doesDrop ? 1 : 0;
|
||||
}
|
||||
|
||||
}
|
||||
@ -305,7 +305,7 @@ public class BlockTallPlant extends BlockEnumMulti implements IPlantable, IGrowa
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
ArrayList<ItemStack> ret = super.getDrops(world, x, y, z, metadata, fortune);
|
||||
|
||||
if(rectify(world.getBlockMetadata(x, y, z)) == EnumTallFlower.CD4.ordinal()) {
|
||||
if(metadata == EnumTallFlower.CD4.ordinal() + 8) {
|
||||
ret.add(DictFrame.fromOne(ModItems.plant_item, com.hbm.items.ItemEnums.EnumPlantType.MUSTARDWILLOW, 3 + world.rand.nextInt(4)));
|
||||
}
|
||||
|
||||
|
||||
@ -8,9 +8,11 @@ import java.util.Map.Entry;
|
||||
import com.hbm.blocks.BlockMulti;
|
||||
import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.inventory.OreDictManager;
|
||||
import com.hbm.inventory.RecipesCommon.AStack;
|
||||
import com.hbm.inventory.RecipesCommon.ComparableStack;
|
||||
import com.hbm.inventory.RecipesCommon.MetaBlock;
|
||||
import com.hbm.inventory.RecipesCommon.OreDictStack;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.util.I18nUtil;
|
||||
import com.hbm.util.InventoryUtil;
|
||||
@ -150,6 +152,7 @@ public class BlockToolConversion extends BlockMulti implements IToolable, ILookO
|
||||
|
||||
public static void registerRecipes() {
|
||||
conversions.put(new Pair(ToolType.BOLT, new MetaBlock(ModBlocks.watz_end, 0)), new Pair(new AStack[] {new ComparableStack(ModItems.bolt_dura_steel, 4)}, new MetaBlock(ModBlocks.watz_end, 1)));
|
||||
conversions.put(new Pair(ToolType.TORCH, new MetaBlock(ModBlocks.fusion_conductor, 0)), new Pair(new AStack[] {new OreDictStack(OreDictManager.STEEL.plateCast())}, new MetaBlock(ModBlocks.fusion_conductor, 1)));
|
||||
}
|
||||
|
||||
public static HashMap<Object[], Object> bufferedRecipes = new HashMap();
|
||||
|
||||
@ -0,0 +1,48 @@
|
||||
package com.hbm.blocks.generic;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class BlockToolConversionPillar extends BlockToolConversion {
|
||||
|
||||
public IIcon[] topIcons;
|
||||
public IIcon topIcon;
|
||||
|
||||
public BlockToolConversionPillar(Material mat) {
|
||||
super(mat);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
|
||||
this.blockIcon = iconRegister.registerIcon(this.getTextureName() + "_side");
|
||||
this.topIcon = iconRegister.registerIcon(this.getTextureName() + "_top");
|
||||
|
||||
if(names != null) {
|
||||
icons = new IIcon[names.length];
|
||||
topIcons = new IIcon[names.length];
|
||||
|
||||
for(int i = 0; i < names.length; i++) {
|
||||
icons[i] = iconRegister.registerIcon(getTextureName() + "_side" + names[i]);
|
||||
topIcons[i] = iconRegister.registerIcon(getTextureName() + "_top" + names[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
|
||||
metadata -= 1;
|
||||
|
||||
if(metadata == -1 || icons == null || metadata >= icons.length) {
|
||||
return side == 0 || side == 1 ? topIcon : blockIcon;
|
||||
}
|
||||
|
||||
return side == 0 || side == 1 ? topIcons[metadata] : icons[metadata];
|
||||
}
|
||||
}
|
||||
@ -47,8 +47,8 @@ public class BlockMassStorage extends BlockContainer implements IBlockMulti, ILo
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.iconTop = new IIcon[3];
|
||||
this.iconSide = new IIcon[3];
|
||||
this.iconTop = new IIcon[4];
|
||||
this.iconSide = new IIcon[4];
|
||||
|
||||
this.iconTop[0] = iconRegister.registerIcon(RefStrings.MODID + ":mass_storage_top_iron");
|
||||
this.iconSide[0] = iconRegister.registerIcon(RefStrings.MODID + ":mass_storage_side_iron");
|
||||
@ -56,14 +56,17 @@ public class BlockMassStorage extends BlockContainer implements IBlockMulti, ILo
|
||||
this.iconSide[1] = iconRegister.registerIcon(RefStrings.MODID + ":mass_storage_side_desh");
|
||||
this.iconTop[2] = iconRegister.registerIcon(RefStrings.MODID + ":mass_storage_top");
|
||||
this.iconSide[2] = iconRegister.registerIcon(RefStrings.MODID + ":mass_storage_side");
|
||||
this.iconTop[3] = iconRegister.registerIcon(RefStrings.MODID + ":mass_storage_top_wood");
|
||||
this.iconSide[3] = iconRegister.registerIcon(RefStrings.MODID + ":mass_storage_side_wood");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||
for(int i = 0; i < getSubCount(); ++i) {
|
||||
list.add(new ItemStack(item, 1, i));
|
||||
}
|
||||
list.add(new ItemStack(item, 1, 3));
|
||||
list.add(new ItemStack(item, 1, 0));
|
||||
list.add(new ItemStack(item, 1, 1));
|
||||
list.add(new ItemStack(item, 1, 2));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -84,7 +87,7 @@ public class BlockMassStorage extends BlockContainer implements IBlockMulti, ILo
|
||||
}
|
||||
|
||||
public int getCapacity(int meta) {
|
||||
return meta == 0 ? 10_000 : meta == 1 ? 100_000 : meta == 2 ? 1_000_000 : 0;
|
||||
return meta == 3 ? 100 : meta == 0 ? 10_000 : meta == 1 ? 100_000 : meta == 2 ? 1_000_000 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -242,7 +245,7 @@ public class BlockMassStorage extends BlockContainer implements IBlockMulti, ILo
|
||||
|
||||
@Override
|
||||
public int getSubCount() {
|
||||
return 3;
|
||||
return 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -286,4 +289,14 @@ public class BlockMassStorage extends BlockContainer implements IBlockMulti, ILo
|
||||
list.add(String.format("%,d", stack.stackTagCompound.getInteger("stack")) + " / " + String.format("%,d", getCapacity(stack.getItemDamage())));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasComparatorInputOverride() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(World world, int x, int y, int z, int side) {
|
||||
return ((TileEntityMassStorage) world.getTileEntity(x, y, z)).redstone;
|
||||
}
|
||||
}
|
||||
|
||||
@ -131,7 +131,7 @@ public class FoundryChannel extends BlockContainer implements ICrucibleAcceptor
|
||||
if(b == ModBlocks.foundry_outlet && meta == dir.ordinal())
|
||||
return true;
|
||||
|
||||
return b == ModBlocks.foundry_channel || b == ModBlocks.foundry_mold;
|
||||
return b == ModBlocks.foundry_channel || b == ModBlocks.foundry_mold || b == ModBlocks.foundry_slagtap;
|
||||
}
|
||||
|
||||
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
@ -167,12 +167,12 @@ public class FoundryOutlet extends BlockContainer implements ICrucibleAcceptor,
|
||||
|
||||
@Override
|
||||
public boolean canAcceptPartialFlow(World world, int x, int y, int z, ForgeDirection side, MaterialStack stack) {
|
||||
return ((TileEntityFoundryOutlet) world.getTileEntity(x, y, z)).canAcceptPartialFlow(world, x, y, z, side, stack);
|
||||
return ((ICrucibleAcceptor) world.getTileEntity(x, y, z)).canAcceptPartialFlow(world, x, y, z, side, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MaterialStack flow(World world, int x, int y, int z, ForgeDirection side, MaterialStack stack) {
|
||||
return ((TileEntityFoundryOutlet) world.getTileEntity(x, y, z)).flow(world, x, y, z, side, stack);
|
||||
return ((ICrucibleAcceptor) world.getTileEntity(x, y, z)).flow(world, x, y, z, side, stack);
|
||||
}
|
||||
|
||||
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
35
src/main/java/com/hbm/blocks/machine/FoundrySlagtap.java
Normal file
35
src/main/java/com/hbm/blocks/machine/FoundrySlagtap.java
Normal file
@ -0,0 +1,35 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.machine.TileEntityFoundrySlagtap;
|
||||
|
||||
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.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||
|
||||
public class FoundrySlagtap extends FoundryOutlet {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
super.registerBlockIcons(iconRegister);
|
||||
this.iconTop = iconRegister.registerIcon(RefStrings.MODID + ":foundry_slagtap_top");
|
||||
this.iconSide = iconRegister.registerIcon(RefStrings.MODID + ":foundry_slagtap_side");
|
||||
this.iconBottom = iconRegister.registerIcon(RefStrings.MODID + ":foundry_slagtap_bottom");
|
||||
this.iconInner = iconRegister.registerIcon(RefStrings.MODID + ":foundry_slagtap_inner");
|
||||
this.iconFront = iconRegister.registerIcon(RefStrings.MODID + ":foundry_slagtap_front");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityFoundrySlagtap();
|
||||
}
|
||||
|
||||
@Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { return false; }
|
||||
@Override public boolean onScrew(World world, EntityPlayer player, int x, int y, int z, int side, float fX, float fY, float fZ, ToolType tool) { return false; }
|
||||
@Override public void printHook(Pre event, World world, int x, int y, int z) { }
|
||||
}
|
||||
272
src/main/java/com/hbm/blocks/machine/MachineCapacitor.java
Normal file
272
src/main/java/com/hbm/blocks/machine/MachineCapacitor.java
Normal file
@ -0,0 +1,272 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.blocks.IPersistentInfoProvider;
|
||||
import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
import com.hbm.tileentity.IPersistentNBT;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.I18nUtil;
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.stats.StatList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class MachineCapacitor extends BlockContainer implements ILookOverlay, IPersistentInfoProvider, ITooltipProvider {
|
||||
|
||||
@SideOnly(Side.CLIENT) public IIcon iconTop;
|
||||
@SideOnly(Side.CLIENT) public IIcon iconSide;
|
||||
@SideOnly(Side.CLIENT) public IIcon iconBottom;
|
||||
@SideOnly(Side.CLIENT) public IIcon iconInnerTop;
|
||||
@SideOnly(Side.CLIENT) public IIcon iconInnerSide;
|
||||
|
||||
protected long power;
|
||||
String name;
|
||||
|
||||
public MachineCapacitor(Material mat, long power, String name) {
|
||||
super(mat);
|
||||
this.power = power;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
super.registerBlockIcons(iconRegister);
|
||||
this.iconTop = iconRegister.registerIcon(RefStrings.MODID + ":capacitor_" + name + "_top");
|
||||
this.iconSide = iconRegister.registerIcon(RefStrings.MODID + ":capacitor_" + name + "_side");
|
||||
this.iconBottom = iconRegister.registerIcon(RefStrings.MODID + ":capacitor_" + name + "_bottom");
|
||||
this.iconInnerTop = iconRegister.registerIcon(RefStrings.MODID + ":capacitor_" + name + "_inner_top");
|
||||
this.iconInnerSide = iconRegister.registerIcon(RefStrings.MODID + ":capacitor_" + name + "_inner_side");
|
||||
}
|
||||
|
||||
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
@Override public int getRenderType() { return renderID; }
|
||||
@Override public boolean isOpaqueCube() { return false; }
|
||||
@Override public boolean renderAsNormalBlock() { return false; }
|
||||
|
||||
@Override
|
||||
public int onBlockPlaced(World world, int x, int y, int z, int side, float fX, float fY, float fZ, int meta) {
|
||||
return side;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityCapacitor(this.power);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printHook(Pre event, World world, int x, int y, int z) {
|
||||
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
|
||||
if(!(te instanceof TileEntityCapacitor))
|
||||
return;
|
||||
|
||||
TileEntityCapacitor battery = (TileEntityCapacitor) te;
|
||||
List<String> text = new ArrayList();
|
||||
text.add(BobMathUtil.getShortNumber(battery.getPower()) + " / " + BobMathUtil.getShortNumber(battery.getMaxPower()) + "HE");
|
||||
|
||||
double percent = (double) battery.getPower() / (double) battery.getMaxPower();
|
||||
int charge = (int) Math.floor(percent * 10_000D);
|
||||
int color = ((int) (0xFF - 0xFF * percent)) << 16 | ((int)(0xFF * percent) << 8);
|
||||
text.add("&[" + color + "&]" + (charge / 100D) + "%");
|
||||
text.add(EnumChatFormatting.GREEN + "-> " + EnumChatFormatting.RESET + "+" + BobMathUtil.getShortNumber(battery.powerReceived) + "HE/t");
|
||||
text.add(EnumChatFormatting.RED + "<- " + EnumChatFormatting.RESET + "-" + BobMathUtil.getShortNumber(battery.powerSent) + "HE/t");
|
||||
|
||||
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, NBTTagCompound persistentTag, EntityPlayer player, List list, boolean ext) {
|
||||
list.add(EnumChatFormatting.YELLOW + "" + BobMathUtil.getShortNumber(persistentTag.getLong("power")) + "/" + BobMathUtil.getShortNumber(persistentTag.getLong("maxPower")) + "HE");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
|
||||
|
||||
if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
|
||||
for(String s : I18nUtil.resolveKeyArray("tile.capacitor.desc")) list.add(EnumChatFormatting.YELLOW + s);
|
||||
} else {
|
||||
list.add(EnumChatFormatting.DARK_GRAY + "" + EnumChatFormatting.ITALIC +"Hold <" +
|
||||
EnumChatFormatting.YELLOW + "" + EnumChatFormatting.ITALIC + "LSHIFT" +
|
||||
EnumChatFormatting.DARK_GRAY + "" + EnumChatFormatting.ITALIC + "> to display more info");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
return IPersistentNBT.getDrops(world, x, y, z, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
|
||||
IPersistentNBT.restoreData(world, x, y, z, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer player) {
|
||||
|
||||
if(!player.capabilities.isCreativeMode) {
|
||||
harvesters.set(player);
|
||||
this.dropBlockAsItem(world, x, y, z, meta, 0);
|
||||
harvesters.set(null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void harvestBlock(World world, EntityPlayer player, int x, int y, int z, int meta) {
|
||||
player.addStat(StatList.mineBlockStatArray[getIdFromBlock(this)], 1);
|
||||
player.addExhaustion(0.025F);
|
||||
}
|
||||
|
||||
public static class TileEntityCapacitor extends TileEntityLoadedBase implements IEnergyUser, INBTPacketReceiver, IPersistentNBT {
|
||||
|
||||
public long power;
|
||||
protected long maxPower;
|
||||
public long prevPower;
|
||||
public long powerReceived;
|
||||
public long powerSent;
|
||||
|
||||
public TileEntityCapacitor() { }
|
||||
|
||||
public TileEntityCapacitor(long maxPower) {
|
||||
this.maxPower = maxPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
long gain = power - prevPower;
|
||||
|
||||
ForgeDirection opp = ForgeDirection.getOrientation(this.getBlockMetadata());
|
||||
ForgeDirection dir = opp.getOpposite();
|
||||
|
||||
BlockPos pos = new BlockPos(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ);
|
||||
|
||||
boolean didStep = false;
|
||||
ForgeDirection last = null;
|
||||
|
||||
while(worldObj.getBlock(pos.getX(), pos.getY(), pos.getZ()) == ModBlocks.capacitor_bus) {
|
||||
ForgeDirection current = ForgeDirection.getOrientation(worldObj.getBlockMetadata(pos.getX(), pos.getY(), pos.getZ()));
|
||||
if(!didStep) last = current;
|
||||
didStep = true;
|
||||
|
||||
if(last != current) {
|
||||
pos = null;
|
||||
break;
|
||||
}
|
||||
|
||||
pos = pos.offset(current);
|
||||
}
|
||||
|
||||
long preSend = power;
|
||||
if(pos != null && last != null) {
|
||||
this.tryUnsubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ());
|
||||
this.sendPower(worldObj, pos.getX(), pos.getY(), pos.getZ(), last);
|
||||
}
|
||||
long sent = preSend - power;
|
||||
|
||||
this.trySubscribe(worldObj, xCoord + opp.offsetX, yCoord+ opp.offsetY, zCoord + opp.offsetZ, opp);
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setLong("power", power);
|
||||
data.setLong("maxPower", maxPower);
|
||||
data.setLong("rec", gain);
|
||||
data.setLong("sent", sent);
|
||||
INBTPacketReceiver.networkPack(this, data, 15);
|
||||
|
||||
this.prevPower = power;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
this.power = nbt.getLong("power");
|
||||
this.maxPower = nbt.getLong("maxPower");
|
||||
this.powerReceived = nbt.getLong("rec");
|
||||
this.powerSent = nbt.getLong("sent");
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getPower() {
|
||||
return power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getMaxPower() {
|
||||
return maxPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConnectionPriority getPriority() {
|
||||
return ConnectionPriority.LOW;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPower(long power) {
|
||||
this.power = power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnect(ForgeDirection dir) {
|
||||
return dir == ForgeDirection.getOrientation(this.getBlockMetadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeNBT(NBTTagCompound nbt) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setLong("power", power);
|
||||
data.setLong("maxPower", maxPower);
|
||||
nbt.setTag(NBT_PERSISTENT_KEY, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readNBT(NBTTagCompound nbt) {
|
||||
NBTTagCompound data = nbt.getCompoundTag(NBT_PERSISTENT_KEY);
|
||||
this.power = data.getLong("power");
|
||||
this.maxPower = data.getLong("maxPower");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
this.power = nbt.getLong("power");
|
||||
this.maxPower = nbt.getLong("maxPower");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setLong("power", power);
|
||||
nbt.setLong("maxPower", maxPower);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,59 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.lib.RefStrings;
|
||||
|
||||
import api.hbm.energy.IEnergyConnectorBlock;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockPistonBase;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class MachineCapacitorBus extends Block implements IEnergyConnectorBlock, ITooltipProvider {
|
||||
|
||||
@SideOnly(Side.CLIENT) private IIcon topIcon;
|
||||
|
||||
public MachineCapacitorBus(Material mat) {
|
||||
super(mat);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister p_149651_1_) {
|
||||
this.blockIcon = p_149651_1_.registerIcon(RefStrings.MODID + ":capacitor_bus_side");
|
||||
this.topIcon = p_149651_1_.registerIcon(RefStrings.MODID + ":capacitor_bus_out");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return side == meta ? topIcon : blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {
|
||||
int l = BlockPistonBase.determineOrientation(world, x, y, z, player);
|
||||
world.setBlockMetadataWithNotify(x, y, z, l, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnect(IBlockAccess world, int x, int y, int z, ForgeDirection dir) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
ForgeDirection busDir = ForgeDirection.getOrientation(meta);
|
||||
return dir == busDir;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
|
||||
this.addStandardInfo(stack, player, list, ext);
|
||||
}
|
||||
}
|
||||
@ -1,11 +1,15 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.handler.MultiblockHandlerXR;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineCompressor;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class MachineCompressor extends BlockDummyable {
|
||||
|
||||
@ -16,6 +20,7 @@ public class MachineCompressor extends BlockDummyable {
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
if(meta >= 12) return new TileEntityMachineCompressor();
|
||||
if(meta >= extra) return new TileEntityProxyCombo().fluid().power();
|
||||
|
||||
return null;
|
||||
}
|
||||
@ -29,4 +34,33 @@ public class MachineCompressor extends BlockDummyable {
|
||||
public int getOffset() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
return this.standardOpenBehavior(world, x, y, z, player, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
return super.checkRequirement(world, x, y, z, dir, o) &&
|
||||
MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o, y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {3, -3, 1, 1, 1, 1}, x, y, z, dir) &&
|
||||
MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o, y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {8, -4, 0, 0, 1, 1}, x, y, z, dir);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
super.fillSpace(world, x, y, z, dir, o);
|
||||
|
||||
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o, y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {3, -3, 1, 1, 1, 1}, this, dir);
|
||||
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o, y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {8, -4, 0, 0, 1, 1}, this, dir);
|
||||
|
||||
x += dir.offsetX * o;
|
||||
z += dir.offsetZ * o;
|
||||
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
|
||||
this.makeExtra(world, x - dir.offsetX, y, z - dir.offsetZ);
|
||||
this.makeExtra(world, x + rot.offsetX, y, z + rot.offsetZ);
|
||||
this.makeExtra(world, x - rot.offsetX, y, z - rot.offsetZ);
|
||||
}
|
||||
}
|
||||
|
||||
@ -51,7 +51,10 @@ public class MachineExcavator extends BlockDummyable {
|
||||
y += dir.offsetY * o;
|
||||
z += dir.offsetZ * o;
|
||||
|
||||
return MultiblockHandlerXR.checkSpace(world, x, y, z, getDimensions(), x, y, z, dir);
|
||||
return MultiblockHandlerXR.checkSpace(world, x, y, z, getDimensions(), x, y, z, dir) &&
|
||||
MultiblockHandlerXR.checkSpace(world, x, y, z, new int[] {-1, 3, 3, -2, 3, -2}, x, y, z, dir) &&
|
||||
MultiblockHandlerXR.checkSpace(world, x, y, z, new int[] {-1, 3, 3, -2, -2, 3}, x, y, z, dir) &&
|
||||
MultiblockHandlerXR.checkSpace(world, x, y, z, new int[] {-1, 3, -2, 3, 3, 3}, x, y, z, dir);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -4,6 +4,8 @@ import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.inventory.material.Mats;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityITER;
|
||||
@ -241,20 +243,23 @@ public class MachineITER extends BlockDummyable {
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int i) {
|
||||
|
||||
if(i >= 12 && drop) {
|
||||
|
||||
for(int l = 0; l < 4; l++)
|
||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModBlocks.fusion_conductor, 64)));
|
||||
|
||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModBlocks.fusion_conductor, 36)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModBlocks.fusion_center, 64)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModBlocks.fusion_motor, 4)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModBlocks.reinforced_glass, 8)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModBlocks.struct_iter_core, 1)));
|
||||
}
|
||||
|
||||
if(i >= 12 && drop) {
|
||||
|
||||
for(int l = 0; l < 4; l++) {
|
||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModBlocks.fusion_conductor, 64)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModItems.plate_cast, 64, Mats.MAT_STEEL.id)));
|
||||
}
|
||||
|
||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModBlocks.fusion_conductor, 36)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModItems.plate_cast, 36, Mats.MAT_STEEL.id)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModBlocks.fusion_center, 64)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModBlocks.fusion_motor, 4)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModBlocks.reinforced_glass, 8)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModBlocks.struct_iter_core, 1)));
|
||||
}
|
||||
|
||||
super.breakBlock(world, x, y, z, block, i);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@ public class BlockGraphite extends BlockFlammable implements IToolable {
|
||||
PacketDispatcher.wrapper.sendToAllAround(new ParticleBurstPacket(x, y, z, Block.getIdFromBlock(this), 0), new TargetPoint(world.provider.dimensionId, x, y, z, 50));
|
||||
world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, this.stepSound.func_150496_b(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
|
||||
|
||||
BlockGraphiteRod.ejectItem(world, x, y, z, ForgeDirection.getOrientation(side), new ItemStack(ModItems.powder_coal));
|
||||
BlockGraphiteRod.ejectItem(world, x, y, z, ForgeDirection.getOrientation(side), new ItemStack(ModItems.ingot_graphite));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@ -19,13 +19,14 @@ public interface IRailNTM {
|
||||
* Motion ends up being *-1 if the train is going in reverse, still pointing forwards despite the speed being negative.
|
||||
* Also features a double[] wrapper with size 1 which holds the speed value that overshoots the rail.
|
||||
* */
|
||||
public Vec3 getTravelLocation(World world, int x, int y, int z, double trainX, double trainY, double trainZ, double motionX, double motionY, double motionZ, double speed, RailContext info);
|
||||
public Vec3 getTravelLocation(World world, int x, int y, int z, double trainX, double trainY, double trainZ, double motionX, double motionY, double motionZ, double speed, RailContext info, MoveContext context);
|
||||
|
||||
/** Returns that rail's gauge. Trains will derail if the gauge does not match. */
|
||||
public TrackGauge getGauge(World world, int x, int y, int z);
|
||||
|
||||
public static enum TrackGauge {
|
||||
STANDARD //roughly 1.5m
|
||||
STANDARD, //roughly 1.5m
|
||||
NARROW //roughly 0.75m
|
||||
}
|
||||
|
||||
/** A wrapper for all relevant info required when leaving a rail */
|
||||
@ -40,4 +41,24 @@ public interface IRailNTM {
|
||||
public RailContext dist(double d) { this.overshoot = d; return this; }
|
||||
public RailContext pos(BlockPos d) { this.pos = d; return this; }
|
||||
}
|
||||
|
||||
/** A wrapper for additional information like stopping on rails and what type of check we're doing */
|
||||
public static class MoveContext {
|
||||
public RailCheckType type;
|
||||
public double collisionBogieDistance;
|
||||
public boolean collision = false; //if a buffer stop or similar applies
|
||||
public double overshoot; //how much of the travel distance was cut short
|
||||
|
||||
public MoveContext(RailCheckType type, double collisionBogieDistance) {
|
||||
this.type = type;
|
||||
this.collisionBogieDistance = collisionBogieDistance;
|
||||
}
|
||||
}
|
||||
|
||||
public static enum RailCheckType {
|
||||
CORE,
|
||||
FRONT,
|
||||
BACK,
|
||||
OTHER
|
||||
}
|
||||
}
|
||||
|
||||
144
src/main/java/com/hbm/blocks/rail/RailNarrowCurve.java
Normal file
144
src/main/java/com/hbm/blocks/rail/RailNarrowCurve.java
Normal file
@ -0,0 +1,144 @@
|
||||
package com.hbm.blocks.rail;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class RailNarrowCurve extends BlockDummyable implements IRailNTM {
|
||||
|
||||
public RailNarrowCurve() {
|
||||
super(Material.iron);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return renderID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3 getSnappingPos(World world, int x, int y, int z, double trainX, double trainY, double trainZ) {
|
||||
return snapAndMove(world, x, y, z, trainX, trainY, trainZ, 0, 0, 0, 0, new RailContext());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3 getTravelLocation(World world, int x, int y, int z, double trainX, double trainY, double trainZ, double motionX, double motionY, double motionZ, double speed, RailContext info, MoveContext context) {
|
||||
return snapAndMove(world, x, y, z, trainX, trainY, trainZ, motionX, motionY, motionZ, speed, info);
|
||||
}
|
||||
|
||||
/* Very simple function determining the snapping position and adding the motion value to it, if desired. */
|
||||
public Vec3 snapAndMove(World world, int x, int y, int z, double trainX, double trainY, double trainZ, double motionX, double motionY, double motionZ, double speed, RailContext info) {
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
if(pos == null) return Vec3.createVectorHelper(trainX, trainY, trainZ);
|
||||
int cX = pos[0];
|
||||
int cY = pos[1];
|
||||
int cZ = pos[2];
|
||||
int meta = world.getBlockMetadata(cX, cY, cZ) - this.offset;
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(meta);
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
|
||||
double turnRadius = 4.5D;
|
||||
|
||||
Vec3 vec = Vec3.createVectorHelper(trainX, trainY, trainZ);
|
||||
double axisX = cX + 0.5 + dir.offsetX * 0.5 + rot.offsetX * turnRadius;
|
||||
double axisZ = cZ + 0.5 + dir.offsetZ * 0.5 + rot.offsetZ * turnRadius;
|
||||
|
||||
Vec3 dist = Vec3.createVectorHelper(vec.xCoord - axisX, 0, vec.zCoord - axisZ);
|
||||
dist = dist.normalize();
|
||||
dist.xCoord *= turnRadius;
|
||||
dist.zCoord *= turnRadius;
|
||||
|
||||
double moveAngle = Math.atan2(motionX, motionZ) * 180D / Math.PI + 90;
|
||||
|
||||
if(speed == 0) {
|
||||
info.dist(0).pos(new BlockPos(x, y, z)).yaw((float) moveAngle);
|
||||
return Vec3.createVectorHelper(axisX + dist.xCoord, y, axisZ + dist.zCoord);
|
||||
}
|
||||
|
||||
double angleDeg = Math.atan2(dist.xCoord, dist.zCoord) * 180D / Math.PI + 90;
|
||||
if(dir == Library.NEG_X) angleDeg -= 90;
|
||||
if(dir == Library.POS_X) angleDeg += 90;
|
||||
if(dir == Library.POS_Z) angleDeg += 180;
|
||||
angleDeg = MathHelper.wrapAngleTo180_double(angleDeg);
|
||||
double length90Deg = turnRadius * Math.PI / 2D;
|
||||
double angularChange = speed / length90Deg * 90D;
|
||||
|
||||
ForgeDirection moveDir = ForgeDirection.UNKNOWN;
|
||||
|
||||
if(Math.abs(motionX) > Math.abs(motionZ)) {
|
||||
moveDir = motionX > 0 ? Library.POS_X : Library.NEG_X;
|
||||
} else {
|
||||
moveDir = motionZ > 0 ? Library.POS_Z : Library.NEG_Z;
|
||||
}
|
||||
|
||||
if(moveDir == dir || moveDir == rot.getOpposite()) {
|
||||
angularChange *= -1;
|
||||
}
|
||||
|
||||
double effAngle = angleDeg + angularChange;
|
||||
moveAngle += angularChange;
|
||||
|
||||
if(effAngle > 90) {
|
||||
double angleOvershoot = effAngle - 90D;
|
||||
moveAngle -= angleOvershoot;
|
||||
double lengthOvershoot = angleOvershoot * length90Deg / 90D;
|
||||
info.dist(lengthOvershoot * Math.signum(speed * angularChange)).pos(new BlockPos(cX - dir.offsetX * 4 + rot.offsetX * 5, y, cZ - dir.offsetZ * 4 + rot.offsetZ * 5)).yaw((float) moveAngle);
|
||||
return Vec3.createVectorHelper(axisX - dir.offsetX * turnRadius, y, axisZ - dir.offsetZ * turnRadius);
|
||||
}
|
||||
|
||||
if(effAngle < 0) {
|
||||
double angleOvershoot = -effAngle;
|
||||
moveAngle -= angleOvershoot;
|
||||
double lengthOvershoot = angleOvershoot * length90Deg / 90D;
|
||||
info.dist(-lengthOvershoot * Math.signum(speed * angularChange)).pos(new BlockPos(cX + dir.offsetX , y, cZ + dir.offsetZ)).yaw((float) moveAngle);
|
||||
return Vec3.createVectorHelper(axisX - rot.offsetX * turnRadius, y, axisZ -rot.offsetZ * turnRadius);
|
||||
}
|
||||
|
||||
double radianChange = angularChange * Math.PI / 180D;
|
||||
dist.rotateAroundY((float) radianChange);
|
||||
|
||||
return Vec3.createVectorHelper(axisX + dist.xCoord, y, axisZ + dist.zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TrackGauge getGauge(World world, int x, int y, int z) {
|
||||
return TrackGauge.NARROW;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getDimensions() {
|
||||
return new int[] {0, 0, 4, 0, 4, 0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOffset() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
||||
this.setBlockBounds(0F, 0F, 0F, 1F, 0.125F, 1F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
this.setBlockBounds(0F, 0F, 0F, 1F, 0.125F, 1F);
|
||||
return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ);
|
||||
}
|
||||
}
|
||||
115
src/main/java/com/hbm/blocks/rail/RailNarrowStraight.java
Normal file
115
src/main/java/com/hbm/blocks/rail/RailNarrowStraight.java
Normal file
@ -0,0 +1,115 @@
|
||||
package com.hbm.blocks.rail;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class RailNarrowStraight extends BlockDummyable implements IRailNTM {
|
||||
|
||||
public RailNarrowStraight() {
|
||||
super(Material.iron);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return renderID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getDimensions() {
|
||||
return new int[] {0, 0, 2, 2, 0, 0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOffset() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
||||
this.setBlockBounds(0F, 0F, 0F, 1F, 0.125F, 1F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
this.setBlockBounds(0F, 0F, 0F, 1F, 0.125F, 1F);
|
||||
return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3 getSnappingPos(World world, int x, int y, int z, double trainX, double trainY, double trainZ) {
|
||||
return snapAndMove(world, x, y, z, trainX, trainY, trainZ, 0, 0, 0, 0, new RailContext());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3 getTravelLocation(World world, int x, int y, int z, double trainX, double trainY, double trainZ, double motionX, double motionY, double motionZ, double speed, RailContext info, MoveContext context) {
|
||||
return snapAndMove(world, x, y, z, trainX, trainY, trainZ, motionX, motionY, motionZ, speed, info);
|
||||
}
|
||||
|
||||
/* Very simple function determining the snapping position and adding the motion value to it, if desired. */
|
||||
public Vec3 snapAndMove(World world, int x, int y, int z, double trainX, double trainY, double trainZ, double motionX, double motionY, double motionZ, double speed, RailContext info) {
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
if(pos == null) return Vec3.createVectorHelper(trainX, trainY, trainZ);
|
||||
int cX = pos[0];
|
||||
int cY = pos[1];
|
||||
int cZ = pos[2];
|
||||
int meta = world.getBlockMetadata(cX, cY, cZ) - this.offset;
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(meta);
|
||||
|
||||
Vec3 vec = Vec3.createVectorHelper(trainX, trainY, trainZ);
|
||||
|
||||
if(dir == Library.POS_X || dir == Library.NEG_X) {
|
||||
double targetX = trainX;
|
||||
if(motionX > 0) {
|
||||
targetX += speed;
|
||||
info.yaw(-90F);
|
||||
} else {
|
||||
targetX -= speed;
|
||||
info.yaw(90F);
|
||||
}
|
||||
vec.xCoord = MathHelper.clamp_double(targetX, cX - 2, cX + 3);
|
||||
vec.yCoord = y;
|
||||
vec.zCoord = cZ + 0.5;
|
||||
info.dist(Math.abs(targetX - vec.xCoord) * Math.signum(speed));
|
||||
info.pos(new BlockPos(cX + (motionX * speed > 0 ? 3 : -3), y, cZ));
|
||||
} else {
|
||||
double targetZ = trainZ;
|
||||
if(motionZ > 0) {
|
||||
targetZ += speed;
|
||||
info.yaw(0F);
|
||||
} else {
|
||||
targetZ -= speed;
|
||||
info.yaw(180F);
|
||||
}
|
||||
vec.xCoord = cX + 0.5;
|
||||
vec.yCoord = y;
|
||||
vec.zCoord = MathHelper.clamp_double(targetZ, cZ - 2,cZ + 3);
|
||||
info.dist(Math.abs(targetZ - vec.zCoord) * Math.signum(speed));
|
||||
info.pos(new BlockPos(cX, y, cZ + (motionZ * speed > 0 ? 3 : -3)));
|
||||
}
|
||||
|
||||
return vec;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TrackGauge getGauge(World world, int x, int y, int z) {
|
||||
return TrackGauge.NARROW;
|
||||
}
|
||||
}
|
||||
137
src/main/java/com/hbm/blocks/rail/RailStandardBuffer.java
Normal file
137
src/main/java/com/hbm/blocks/rail/RailStandardBuffer.java
Normal file
@ -0,0 +1,137 @@
|
||||
package com.hbm.blocks.rail;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class RailStandardBuffer extends BlockDummyable implements IRailNTM {
|
||||
|
||||
public RailStandardBuffer() {
|
||||
super(Material.iron);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return renderID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getDimensions() {
|
||||
return new int[] {0, 0, 2, 2, 1, 0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOffset() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
||||
this.setBlockBounds(0F, 0F, 0F, 1F, 0.125F, 1F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3 getSnappingPos(World world, int x, int y, int z, double trainX, double trainY, double trainZ) {
|
||||
return snapAndMove(world, x, y, z, trainX, trainY, trainZ, 0, 0, 0, 0, new RailContext(), new MoveContext(RailCheckType.OTHER, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3 getTravelLocation(World world, int x, int y, int z, double trainX, double trainY, double trainZ, double motionX, double motionY, double motionZ, double speed, RailContext info, MoveContext context) {
|
||||
return snapAndMove(world, x, y, z, trainX, trainY, trainZ, motionX, motionY, motionZ, speed, info, context);
|
||||
}
|
||||
|
||||
/* Very simple function determining the snapping position and adding the motion value to it, if desired. */
|
||||
public Vec3 snapAndMove(World world, int x, int y, int z, double trainX, double trainY, double trainZ, double motionX, double motionY, double motionZ, double speed, RailContext info, MoveContext context) {
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
if(pos == null) return Vec3.createVectorHelper(trainX, trainY, trainZ);
|
||||
int cX = pos[0];
|
||||
int cY = pos[1];
|
||||
int cZ = pos[2];
|
||||
int meta = world.getBlockMetadata(cX, cY, cZ) - this.offset;
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(meta);
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
|
||||
Vec3 vec = Vec3.createVectorHelper(trainX, trainY, trainZ);
|
||||
|
||||
if(speed == 0) {
|
||||
//return vec;
|
||||
}
|
||||
|
||||
if(dir == Library.POS_X || dir == Library.NEG_X) {
|
||||
double targetX = trainX;
|
||||
if(motionX > 0) {
|
||||
targetX += speed;
|
||||
info.yaw(-90F);
|
||||
} else {
|
||||
targetX -= speed;
|
||||
info.yaw(90F);
|
||||
}
|
||||
vec.xCoord = MathHelper.clamp_double(targetX, cX - 2, cX + 3);
|
||||
vec.yCoord = y + 0.1875;
|
||||
vec.zCoord = cZ + 0.5 + rot.offsetZ * 0.5;
|
||||
|
||||
double nX = (dir == Library.POS_X ? -1 - context.collisionBogieDistance : 2);
|
||||
double pX = (dir == Library.NEG_X ? 0 - context.collisionBogieDistance : 3);
|
||||
double buffer = MathHelper.clamp_double(targetX, cX - nX, cX + pX);
|
||||
|
||||
if(buffer != vec.xCoord) {
|
||||
context.collision = true;
|
||||
context.overshoot = Math.abs(buffer - vec.xCoord);
|
||||
vec.xCoord = buffer;
|
||||
return vec;
|
||||
}
|
||||
|
||||
info.dist(Math.abs(targetX - vec.xCoord) * Math.signum(speed));
|
||||
info.pos(new BlockPos(cX + (motionX * speed > 0 ? 3 : -3), y, cZ));
|
||||
} else {
|
||||
double targetZ = trainZ;
|
||||
if(motionZ > 0) {
|
||||
targetZ += speed;
|
||||
info.yaw(0F);
|
||||
} else {
|
||||
targetZ -= speed;
|
||||
info.yaw(180F);
|
||||
}
|
||||
vec.xCoord = cX + 0.5 + rot.offsetX * 0.5;
|
||||
vec.yCoord = y + 0.1875;
|
||||
vec.zCoord = MathHelper.clamp_double(targetZ, cZ - 2,cZ + 3);
|
||||
|
||||
double nZ = (dir == Library.POS_Z ? -1 - context.collisionBogieDistance : 2);
|
||||
double pZ = (dir == Library.NEG_Z ? 0 - context.collisionBogieDistance : 3);
|
||||
double buffer = MathHelper.clamp_double(targetZ, cZ - nZ, cZ + pZ);
|
||||
|
||||
if(buffer != vec.xCoord) {
|
||||
context.collision = true;
|
||||
context.overshoot = Math.abs(buffer - vec.zCoord);
|
||||
vec.zCoord = buffer;
|
||||
return vec;
|
||||
}
|
||||
|
||||
info.dist(Math.abs(targetZ - vec.zCoord) * Math.signum(speed));
|
||||
info.pos(new BlockPos(cX, y, cZ + (motionZ * speed > 0 ? 3 : -3)));
|
||||
}
|
||||
|
||||
return vec;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TrackGauge getGauge(World world, int x, int y, int z) {
|
||||
return TrackGauge.STANDARD;
|
||||
}
|
||||
}
|
||||
@ -4,6 +4,7 @@ import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
@ -24,9 +25,11 @@ public class RailStandardCurve extends BlockDummyable implements IRailNTM {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return 0;
|
||||
return renderID;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -35,7 +38,7 @@ public class RailStandardCurve extends BlockDummyable implements IRailNTM {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3 getTravelLocation(World world, int x, int y, int z, double trainX, double trainY, double trainZ, double motionX, double motionY, double motionZ, double speed, RailContext info) {
|
||||
public Vec3 getTravelLocation(World world, int x, int y, int z, double trainX, double trainY, double trainZ, double motionX, double motionY, double motionZ, double speed, RailContext info, MoveContext context) {
|
||||
return snapAndMove(world, x, y, z, trainX, trainY, trainZ, motionX, motionY, motionZ, speed, info);
|
||||
}
|
||||
|
||||
@ -49,12 +52,13 @@ public class RailStandardCurve extends BlockDummyable implements IRailNTM {
|
||||
int meta = world.getBlockMetadata(cX, cY, cZ) - this.offset;
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(meta);
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
|
||||
double turnRadius = 4.5D;
|
||||
|
||||
double turnRadius = 4D;
|
||||
double axisDist = 4.5D;
|
||||
|
||||
Vec3 vec = Vec3.createVectorHelper(trainX, trainY, trainZ);
|
||||
double axisX = cX + 0.5 + dir.offsetX * 0.5 + rot.offsetX * turnRadius;
|
||||
double axisZ = cZ + 0.5 + dir.offsetZ * 0.5 + rot.offsetZ * turnRadius;
|
||||
double axisX = cX + 0.5 + dir.offsetX * 0.5 + rot.offsetX * axisDist;
|
||||
double axisZ = cZ + 0.5 + dir.offsetZ * 0.5 + rot.offsetZ * axisDist;
|
||||
|
||||
Vec3 dist = Vec3.createVectorHelper(vec.xCoord - axisX, 0, vec.zCoord - axisZ);
|
||||
dist = dist.normalize();
|
||||
@ -96,7 +100,7 @@ public class RailStandardCurve extends BlockDummyable implements IRailNTM {
|
||||
moveAngle -= angleOvershoot;
|
||||
double lengthOvershoot = angleOvershoot * length90Deg / 90D;
|
||||
info.dist(lengthOvershoot * Math.signum(speed * angularChange)).pos(new BlockPos(cX - dir.offsetX * 4 + rot.offsetX * 5, y, cZ - dir.offsetZ * 4 + rot.offsetZ * 5)).yaw((float) moveAngle);
|
||||
return Vec3.createVectorHelper(axisX - dir.offsetX * turnRadius, y, axisZ - dir.offsetZ * turnRadius);
|
||||
return Vec3.createVectorHelper(axisX - dir.offsetX * turnRadius, y + 0.1875, axisZ - dir.offsetZ * turnRadius);
|
||||
}
|
||||
|
||||
if(effAngle < 0) {
|
||||
@ -104,13 +108,13 @@ public class RailStandardCurve extends BlockDummyable implements IRailNTM {
|
||||
moveAngle -= angleOvershoot;
|
||||
double lengthOvershoot = angleOvershoot * length90Deg / 90D;
|
||||
info.dist(-lengthOvershoot * Math.signum(speed * angularChange)).pos(new BlockPos(cX + dir.offsetX , y, cZ + dir.offsetZ)).yaw((float) moveAngle);
|
||||
return Vec3.createVectorHelper(axisX - rot.offsetX * turnRadius, y, axisZ -rot.offsetZ * turnRadius);
|
||||
return Vec3.createVectorHelper(axisX - rot.offsetX * turnRadius, y + 0.1875, axisZ -rot.offsetZ * turnRadius);
|
||||
}
|
||||
|
||||
double radianChange = angularChange * Math.PI / 180D;
|
||||
dist.rotateAroundY((float) radianChange);
|
||||
|
||||
return Vec3.createVectorHelper(axisX + dist.xCoord, y, axisZ + dist.zCoord);
|
||||
return Vec3.createVectorHelper(axisX + dist.xCoord, y + 0.1875, axisZ + dist.zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -138,4 +142,60 @@ public class RailStandardCurve extends BlockDummyable implements IRailNTM {
|
||||
this.setBlockBounds(0F, 0F, 0F, 1F, 0.125F, 1F);
|
||||
return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
dir = dir.getOpposite();
|
||||
|
||||
int dX = dir.offsetX;
|
||||
int dZ = dir.offsetZ;
|
||||
int rX = rot.offsetX;
|
||||
int rZ = rot.offsetZ;
|
||||
|
||||
return world.getBlock(x + dX, y, z + dZ).isReplaceable(world, x + dX, y, z + dZ) &&
|
||||
world.getBlock(x + rX, y, z + rZ).isReplaceable(world, x + rX, y, z + rZ) &&
|
||||
world.getBlock(x + dX + rX, y, z + dZ + rZ).isReplaceable(world, x + dX + rX, y, z + dZ + rZ) &&
|
||||
world.getBlock(x + dX + rX * 2, y, z + dZ + rZ * 2).isReplaceable(world, x + dX + rX * 2, y, z + dZ + rZ * 2) &&
|
||||
world.getBlock(x + dX * 2 + rX, y, z + dZ * 2 + rZ).isReplaceable(world, x + dX * 2 + rX, y, z + dZ * 2 + rZ) &&
|
||||
world.getBlock(x + dX * 2 + rX * 2, y, z + dZ * 2 + rZ * 2).isReplaceable(world, x + dX * 2 + rX * 2, y, z + dZ * 2 + rZ * 2) &&
|
||||
world.getBlock(x + dX * 3 + rX, y, z + dZ * 3 + rZ).isReplaceable(world, x + dX * 3 + rX, y, z + dZ * 3 + rZ) &&
|
||||
world.getBlock(x + dX * 3 + rX * 2, y, z + dZ * 3 + rZ * 2).isReplaceable(world, x + dX * 3 + rX * 2, y, z + dZ * 3 + rZ * 2) &&
|
||||
world.getBlock(x + dX * 2 + rX * 3, y, z + dZ * 2 + rZ * 3).isReplaceable(world, x + dX * 2 + rX * 3, y, z + dZ * 2 + rZ * 3) &&
|
||||
world.getBlock(x + dX * 3 + rX * 3, y, z + dZ * 3 + rZ * 3).isReplaceable(world, x + dX * 3 + rX * 3, y, z + dZ * 3 + rZ * 3) &&
|
||||
world.getBlock(x + dX * 4 + rX * 3, y, z + dZ * 4 + rZ * 3).isReplaceable(world, x + dX * 4 + rX * 3, y, z + dZ * 4 + rZ * 3) &&
|
||||
world.getBlock(x + dX * 3 + rX * 4, y, z + dZ * 3 + rZ * 4).isReplaceable(world, x + dX * 3 + rX * 4, y, z + dZ * 3 + rZ * 4) &&
|
||||
world.getBlock(x + dX * 4 + rX * 4, y, z + dZ * 4 + rZ * 4).isReplaceable(world, x + dX * 4 + rX * 4, y, z + dZ * 4 + rZ * 4);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
|
||||
BlockDummyable.safeRem = true;
|
||||
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
dir = dir.getOpposite();
|
||||
|
||||
int dX = dir.offsetX;
|
||||
int dZ = dir.offsetZ;
|
||||
int rX = rot.offsetX;
|
||||
int rZ = rot.offsetZ;
|
||||
|
||||
world.setBlock(x + dX, y, z + dZ, this, dir.ordinal(), 3);
|
||||
world.setBlock(x + rX, y, z + rZ, this, rot.ordinal(), 3);
|
||||
world.setBlock(x + dX + rX, y, z + dZ + rZ, this, rot.ordinal(), 3);
|
||||
world.setBlock(x + dX + rX * 2, y, z + dZ + rZ * 2, this, rot.ordinal(), 3);
|
||||
world.setBlock(x + dX * 2 + rX, y, z + dZ * 2 + rZ, this, dir.ordinal(), 3);
|
||||
world.setBlock(x + dX * 2 + rX * 2, y, z + dZ * 2 + rZ * 2, this, dir.ordinal(), 3);
|
||||
world.setBlock(x + dX * 3 + rX, y, z + dZ * 3 + rZ, this, dir.ordinal(), 3);
|
||||
world.setBlock(x + dX * 3 + rX * 2, y, z + dZ * 3 + rZ * 2, this, dir.ordinal(), 3);
|
||||
world.setBlock(x + dX * 2 + rX * 3, y, z + dZ * 2 + rZ * 3, this, rot.ordinal(), 3);
|
||||
world.setBlock(x + dX * 3 + rX * 3, y, z + dZ * 3 + rZ * 3, this, rot.ordinal(), 3);
|
||||
world.setBlock(x + dX * 4 + rX * 3, y, z + dZ * 4 + rZ * 3, this, dir.ordinal(), 3);
|
||||
world.setBlock(x + dX * 3 + rX * 4, y, z + dZ * 3 + rZ * 4, this, rot.ordinal(), 3);
|
||||
world.setBlock(x + dX * 4 + rX * 4, y, z + dZ * 4 + rZ * 4, this, rot.ordinal(), 3);
|
||||
|
||||
BlockDummyable.safeRem = false;
|
||||
}
|
||||
}
|
||||
|
||||
138
src/main/java/com/hbm/blocks/rail/RailStandardRamp.java
Normal file
138
src/main/java/com/hbm/blocks/rail/RailStandardRamp.java
Normal file
@ -0,0 +1,138 @@
|
||||
package com.hbm.blocks.rail;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.handler.MultiblockHandlerXR;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class RailStandardRamp extends BlockDummyable implements IRailNTM {
|
||||
|
||||
public RailStandardRamp() {
|
||||
super(Material.iron);
|
||||
this.bounding.add(AxisAlignedBB.getBoundingBox(-2.5, 0.0, -1.5, -1.5, 0.1, 0.5));
|
||||
this.bounding.add(AxisAlignedBB.getBoundingBox(-1.5, 0.0, -1.5, -0.5, 0.3, 0.5));
|
||||
this.bounding.add(AxisAlignedBB.getBoundingBox(-0.5, 0.0, -1.5, 0.5, 0.5, 0.5));
|
||||
this.bounding.add(AxisAlignedBB.getBoundingBox(0.5, 0.0, -1.5, 1.5, 0.7, 0.5));
|
||||
this.bounding.add(AxisAlignedBB.getBoundingBox(1.5, 0.0, -1.5, 2.5, 0.9, 0.5));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return renderID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getDimensions() {
|
||||
return new int[] {0, 0, 2, 2, 1, 0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOffset() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
||||
this.setBlockBounds(0F, 0F, 0F, 1F, 0.125F, 1F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
this.setBlockBounds(0F, 0F, 0F, 1F, 0.125F, 1F);
|
||||
return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3 getSnappingPos(World world, int x, int y, int z, double trainX, double trainY, double trainZ) {
|
||||
return snapAndMove(world, x, y, z, trainX, trainY, trainZ, 0, 0, 0, 0, new RailContext());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3 getTravelLocation(World world, int x, int y, int z, double trainX, double trainY, double trainZ, double motionX, double motionY, double motionZ, double speed, RailContext info, MoveContext context) {
|
||||
return snapAndMove(world, x, y, z, trainX, trainY, trainZ, motionX, motionY, motionZ, speed, info);
|
||||
}
|
||||
|
||||
/* Very simple function determining the snapping position and adding the motion value to it, if desired. */
|
||||
public Vec3 snapAndMove(World world, int x, int y, int z, double trainX, double trainY, double trainZ, double motionX, double motionY, double motionZ, double speed, RailContext info) {
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
if(pos == null) return Vec3.createVectorHelper(trainX, trainY, trainZ);
|
||||
int cX = pos[0];
|
||||
int cY = pos[1];
|
||||
int cZ = pos[2];
|
||||
int meta = world.getBlockMetadata(cX, cY, cZ) - this.offset;
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(meta);
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
|
||||
Vec3 vec = Vec3.createVectorHelper(trainX, trainY, trainZ);
|
||||
|
||||
if(speed == 0) {
|
||||
//return vec;
|
||||
}
|
||||
|
||||
if(dir == Library.POS_X || dir == Library.NEG_X) {
|
||||
double targetX = trainX;
|
||||
if(motionX > 0) {
|
||||
targetX += speed;
|
||||
info.yaw(-90F);
|
||||
} else {
|
||||
targetX -= speed;
|
||||
info.yaw(90F);
|
||||
}
|
||||
double dist = (cX + 0.5 - targetX + 2.5) / 5;
|
||||
vec.xCoord = MathHelper.clamp_double(targetX, cX - 2, cX + 3);
|
||||
vec.yCoord = MathHelper.clamp_double(dir == Library.POS_X ? cY + dist : cY + 1 - dist, cY, cY + 1) + 0.1875;
|
||||
vec.zCoord = cZ + 0.5 + rot.offsetZ * 0.5;
|
||||
info.dist(Math.abs(targetX - vec.xCoord) * Math.signum(speed));
|
||||
info.pos(new BlockPos(cX + (motionX * speed > 0 ? 3 : -3), cY + (motionX * speed > 0 ^ dir == Library.POS_X ? 1 : 0), cZ));
|
||||
} else {
|
||||
double targetZ = trainZ;
|
||||
if(motionZ > 0) {
|
||||
targetZ += speed;
|
||||
info.yaw(0F);
|
||||
} else {
|
||||
targetZ -= speed;
|
||||
info.yaw(180F);
|
||||
}
|
||||
double dist = (cZ + 0.5 - targetZ + 2.5) / 5;
|
||||
vec.xCoord = cX + 0.5 + rot.offsetX * 0.5;
|
||||
vec.yCoord = MathHelper.clamp_double(dir == Library.POS_Z ? cY + dist : cY + 1 - dist, cY, cY + 1) + 0.1875;
|
||||
vec.zCoord = MathHelper.clamp_double(targetZ, cZ - 2,cZ + 3);
|
||||
info.dist(Math.abs(targetZ - vec.zCoord) * Math.signum(speed));
|
||||
info.pos(new BlockPos(cX, cY + (motionZ * speed > 0 ^ dir == Library.POS_Z ? 1 : 0), cZ + (motionZ * speed > 0 ? 3 : -3)));
|
||||
}
|
||||
|
||||
return vec;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TrackGauge getGauge(World world, int x, int y, int z) {
|
||||
return TrackGauge.STANDARD;
|
||||
}
|
||||
|
||||
protected boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
return MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o, y + dir.offsetY * o, z + dir.offsetZ * o, getDimensions(), x, y, z, dir) &&
|
||||
MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o, y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {1, -1, 2, 2, 1, 0}, x, y, z, dir);
|
||||
}
|
||||
|
||||
protected void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o, y + dir.offsetY * o, z + dir.offsetZ * o, getDimensions(), this, dir);
|
||||
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o, y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {1, -1, 2, 2, 1, 0}, this, dir);
|
||||
}
|
||||
}
|
||||
@ -4,6 +4,7 @@ import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
@ -24,14 +25,16 @@ public class RailStandardStraight extends BlockDummyable implements IRailNTM {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return 0;
|
||||
return renderID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getDimensions() {
|
||||
return new int[] {0, 0, 2, 2, 0, 0};
|
||||
return new int[] {0, 0, 2, 2, 1, 0};
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -56,7 +59,7 @@ public class RailStandardStraight extends BlockDummyable implements IRailNTM {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3 getTravelLocation(World world, int x, int y, int z, double trainX, double trainY, double trainZ, double motionX, double motionY, double motionZ, double speed, RailContext info) {
|
||||
public Vec3 getTravelLocation(World world, int x, int y, int z, double trainX, double trainY, double trainZ, double motionX, double motionY, double motionZ, double speed, RailContext info, MoveContext context) {
|
||||
return snapAndMove(world, x, y, z, trainX, trainY, trainZ, motionX, motionY, motionZ, speed, info);
|
||||
}
|
||||
|
||||
@ -69,6 +72,7 @@ public class RailStandardStraight extends BlockDummyable implements IRailNTM {
|
||||
int cZ = pos[2];
|
||||
int meta = world.getBlockMetadata(cX, cY, cZ) - this.offset;
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(meta);
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
|
||||
Vec3 vec = Vec3.createVectorHelper(trainX, trainY, trainZ);
|
||||
|
||||
@ -86,8 +90,8 @@ public class RailStandardStraight extends BlockDummyable implements IRailNTM {
|
||||
info.yaw(90F);
|
||||
}
|
||||
vec.xCoord = MathHelper.clamp_double(targetX, cX - 2, cX + 3);
|
||||
vec.yCoord = y;
|
||||
vec.zCoord = cZ + 0.5;
|
||||
vec.yCoord = y + 0.1875;
|
||||
vec.zCoord = cZ + 0.5 + rot.offsetZ * 0.5;
|
||||
info.dist(Math.abs(targetX - vec.xCoord) * Math.signum(speed));
|
||||
info.pos(new BlockPos(cX + (motionX * speed > 0 ? 3 : -3), y, cZ));
|
||||
} else {
|
||||
@ -99,8 +103,8 @@ public class RailStandardStraight extends BlockDummyable implements IRailNTM {
|
||||
targetZ -= speed;
|
||||
info.yaw(180F);
|
||||
}
|
||||
vec.xCoord = cX + 0.5;
|
||||
vec.yCoord = y;
|
||||
vec.xCoord = cX + 0.5 + rot.offsetX * 0.5;
|
||||
vec.yCoord = y + 0.1875;
|
||||
vec.zCoord = MathHelper.clamp_double(targetZ, cZ - 2,cZ + 3);
|
||||
info.dist(Math.abs(targetZ - vec.zCoord) * Math.signum(speed));
|
||||
info.pos(new BlockPos(cX, y, cZ + (motionZ * speed > 0 ? 3 : -3)));
|
||||
|
||||
@ -27,6 +27,7 @@ public class BombConfig {
|
||||
public static int limitExplosionLifespan = 0;
|
||||
public static int rain = 0;
|
||||
public static int cont = 0;
|
||||
public static boolean chunkloading = true;
|
||||
|
||||
public static void loadFromConfig(Configuration config) {
|
||||
|
||||
@ -100,5 +101,7 @@ public class BombConfig {
|
||||
Property rainCont = config.get(CATEGORY_NUKE, "6.06_falloutRainRadiation", 0);
|
||||
rainCont.comment = "Radiation in 100th RADs created by fallout rain";
|
||||
cont = rainCont.getInt();
|
||||
|
||||
chunkloading = CommonConfig.createConfigBool(config, CATEGORY_NUKE, "6.XX_enableChunkLoading", "Allows all types of procedural explosions to keep the central chunk loaded.", true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,7 +24,6 @@ public class GeneralConfig {
|
||||
public static boolean enableCrosshairs = true;
|
||||
public static boolean enableReflectorCompat = false;
|
||||
public static boolean enableRenderDistCheck = true;
|
||||
public static boolean enableCustomDashKeybind = false;
|
||||
public static boolean enableReEval = true;
|
||||
public static boolean enableSilentCompStackErrors = true;
|
||||
public static boolean enableChunkyNEIHandler = true;
|
||||
@ -82,7 +81,6 @@ public class GeneralConfig {
|
||||
enableCrosshairs = config.get(CATEGORY_GENERAL, "1.22_enableCrosshairs", true, "Shows custom crosshairs when an NTM gun is being held").getBoolean(true);
|
||||
enableReflectorCompat = config.get(CATEGORY_GENERAL, "1.24_enableReflectorCompat", false, "Enable old reflector oredict name (\"plateDenseLead\") instead of new \"plateTungCar\"").getBoolean(false);
|
||||
enableRenderDistCheck = config.get(CATEGORY_GENERAL, "1.25_enableRenderDistCheck", true, "Check invalid render distances (over 16, without OptiFine) and fix it").getBoolean(true);
|
||||
enableCustomDashKeybind = config.get(CATEGORY_GENERAL, "1.26_enableCustomDashKeybind", false, "Enable custom dash keybind instead of shift").getBoolean(false);
|
||||
enableReEval = config.get(CATEGORY_GENERAL, "1.27_enableReEval", true, "Allows re-evaluating power networks on link remove instead of destroying and recreating").getBoolean(true);
|
||||
enableSilentCompStackErrors = config.get(CATEGORY_GENERAL, "1.28_enableSilentCompStackErrors", false, "Enabling this will disable log spam created by unregistered items in ComparableStack instances.").getBoolean(false);
|
||||
hintPos = CommonConfig.createConfigInt(config, CATEGORY_GENERAL, "1.29_hudOverlayPosition", "0: Top left\n1: Top right\n2: Center right\n3: Center Left", 0);
|
||||
|
||||
@ -14,6 +14,7 @@ public class MobConfig {
|
||||
public static int raidDelay = 30 * 60 * 60;
|
||||
public static int raidChance = 3;
|
||||
public static int raidAmount = 15;
|
||||
public static int raidDrones = 5;
|
||||
public static int raidAttackDelay = 40;
|
||||
public static int raidAttackReach = 2;
|
||||
public static int raidAttackDistance = 32;
|
||||
@ -27,6 +28,15 @@ public class MobConfig {
|
||||
public static boolean enableDucks = true;
|
||||
public static boolean enableMobGear = true;
|
||||
|
||||
public static boolean enableHives = true;
|
||||
public static int hiveSpawn = 128;
|
||||
public static double scoutThreshold = 0.1;
|
||||
public static double tier2Threshold = 1;
|
||||
public static double tier3Threshold = 10;
|
||||
public static double tier4Threshold = 50;
|
||||
public static double tier5Threshold = 100;
|
||||
|
||||
|
||||
public static void loadFromConfig(Configuration config) {
|
||||
|
||||
final String CATEGORY = CommonConfig.CATEGORY_MOBS;
|
||||
@ -44,6 +54,7 @@ public class MobConfig {
|
||||
raidAttackDelay = CommonConfig.createConfigInt(config, CATEGORY, "12.F04_raidAttackDelay", "Time between individual attempts to break machines", 40);
|
||||
raidAttackReach = CommonConfig.createConfigInt(config, CATEGORY, "12.F05_raidAttackReach", "How far away machines can be broken", 2);
|
||||
raidAttackDistance = CommonConfig.createConfigInt(config, CATEGORY, "12.F06_raidAttackDistance", "How far away agents will spawn from the targeted player", 32);
|
||||
raidDrones = CommonConfig.createConfigInt(config, CATEGORY, "12.F07_raidDrones", "How many quadcopter drones are spawned each raid", 5);
|
||||
|
||||
enableElementals = CommonConfig.createConfigBool(config, CATEGORY, "12.E00_enableMeltdownElementals", "Whether there should be radiation elementals", true);
|
||||
elementalDelay = CommonConfig.createConfigInt(config, CATEGORY, "12.E01_elementalDelay", "How many world ticks need to pass for a check to be performed", 30 * 60 * 60);
|
||||
@ -53,5 +64,13 @@ public class MobConfig {
|
||||
|
||||
enableDucks = CommonConfig.createConfigBool(config, CATEGORY, "12.D00_enableDucks", "Whether pressing O should allow the player to duck", true);
|
||||
enableMobGear = CommonConfig.createConfigBool(config, CATEGORY, "12.D01_enableMobGear", "Whether zombies and skeletons should have additional gear when spawning", true);
|
||||
|
||||
enableHives = CommonConfig.createConfigBool(config, CATEGORY, "12.G00_enableHives", "Whether glyphid hives should spawn", true);
|
||||
hiveSpawn = CommonConfig.createConfigInt(config, CATEGORY, "12.G01_hiveSpawn", "The average amount of chunks per hive", 128);
|
||||
scoutThreshold = CommonConfig.createConfigDouble(config, CATEGORY, "12.G02_scoutThreshold", "Minimum amount of soot for scouts to spawn", 0.1);
|
||||
tier2Threshold = CommonConfig.createConfigDouble(config, CATEGORY, "12.G03_tier2Threshold", "Minimum amount of soot for tier 2 glyphids to spawn", 1);
|
||||
tier3Threshold = CommonConfig.createConfigDouble(config, CATEGORY, "12.G04_tier3Threshold", "Minimum amount of soot for tier 3 glyphids to spawn", 10);
|
||||
tier4Threshold = CommonConfig.createConfigDouble(config, CATEGORY, "12.G05_tier4Threshold", "Minimum amount of soot for tier 4 glyphids to spawn", 50);
|
||||
tier5Threshold = CommonConfig.createConfigDouble(config, CATEGORY, "12.G06_tier5Threshold", "Minimum amount of soot for tier 5 glyphids to spawn", 100);
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,14 +33,21 @@ public class WorldConfig {
|
||||
public static int bedrockOilSpawn = 200;
|
||||
public static int meteoriteSpawn = 500;
|
||||
|
||||
public static int bedrockIronSpawn = 200;
|
||||
public static int bedrockIronSpawn = 100;
|
||||
public static int bedrockCopperSpawn = 200;
|
||||
public static int bedrockBoraxSpawn = 300;
|
||||
public static int bedrockAsbestosSpawn = 300;
|
||||
public static int bedrockNiobiumSpawn = 300;
|
||||
public static int bedrockTitaniumSpawn = 400;
|
||||
public static int bedrockTungstenSpawn = 300;
|
||||
public static int bedrockGoldSpawn = 500;
|
||||
public static int bedrockBoraxSpawn = 50;
|
||||
public static int bedrockChlorocalciteSpawn = 35;
|
||||
public static int bedrockAsbestosSpawn = 50;
|
||||
public static int bedrockNiobiumSpawn = 50;
|
||||
public static int bedrockTitaniumSpawn = 100;
|
||||
public static int bedrockTungstenSpawn = 100;
|
||||
public static int bedrockGoldSpawn = 50;
|
||||
public static int bedrockUraniumSpawn = 35;
|
||||
public static int bedrockThoriumSpawn = 50;
|
||||
public static int bedrockCoalSpawn = 200;
|
||||
public static int bedrockNiterSpawn = 50;
|
||||
public static int bedrockFluoriteSpawn = 50;
|
||||
public static int bedrockRedstoneSpawn = 50;
|
||||
|
||||
public static int ironClusterSpawn = 4;
|
||||
public static int titaniumClusterSpawn = 2;
|
||||
@ -71,7 +78,6 @@ public class WorldConfig {
|
||||
public static int dungeonStructure = 64;
|
||||
public static int relayStructure = 500;
|
||||
public static int satelliteStructure = 500;
|
||||
public static int bunkerStructure = 1000;
|
||||
public static int siloStructure = 1000;
|
||||
public static int factoryStructure = 1000;
|
||||
public static int dudStructure = 500;
|
||||
@ -133,14 +139,21 @@ public class WorldConfig {
|
||||
bedrockOilSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.22_bedrockOilSpawnRate", "Spawns a bedrock oil node every nTH chunk", 200);
|
||||
meteoriteSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.23_meteoriteSpawnRate", "Spawns a fallen meteorite every nTH chunk", 200);
|
||||
|
||||
bedrockIronSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.B00_bedrockIronSpawn", "Spawns a bedrock iron deposit every nTH chunk", 200);
|
||||
bedrockCopperSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.B01_bedrockCopperSpawn", "Spawns a bedrock copper deposit every nTH chunk", 200);
|
||||
bedrockBoraxSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.B02_bedrockBoraxSpawn", "Spawns a bedrock borax deposit every nTH chunk", 300);
|
||||
bedrockAsbestosSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.B03_bedrockAsbestosSpawn", "Spawns a bedrock asbestos deposit every nTH chunk", 300);
|
||||
bedrockNiobiumSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.B04_bedrockNiobiumSpawn", "Spawns a bedrock niobium deposit every nTH chunk", 300);
|
||||
bedrockTitaniumSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.B05_bedrockTitaniumSpawn", "Spawns a bedrock titanium deposit every nTH chunk", 500);
|
||||
bedrockTungstenSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.B06_bedrockTungstenSpawn", "Spawns a bedrock tungsten deposit every nTH chunk", 300);
|
||||
bedrockGoldSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.B07_bedrockGoldSpawn", "Spawns a bedrock gold deposit every nTH chunk", 500);
|
||||
bedrockIronSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.B00_bedrockIronWeight", "Spawn weight for iron bedrock ore", 100);
|
||||
bedrockCopperSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.B01_bedrockCopperWeight", "Spawn weight for copper bedrock ore", 200);
|
||||
bedrockBoraxSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.B02_bedrockBoraxWeight", "Spawn weight for borax bedrock ore", 50);
|
||||
bedrockAsbestosSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.B03_bedrockAsbestosWeight", "Spawn weight for asbestos bedrock ore", 50);
|
||||
bedrockNiobiumSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.B04_bedrockNiobiumWeight", "Spawn weight for niobium bedrock ore", 50);
|
||||
bedrockTitaniumSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.B05_bedrockTitaniumWeight", "Spawn weight for titanium bedrock ore", 100);
|
||||
bedrockTungstenSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.B06_bedrockTungstenWeight", "Spawn weight for tungsten bedrock ore", 100);
|
||||
bedrockGoldSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.B07_bedrockGoldWeight", "Spawn weight for gold bedrock ore", 50);
|
||||
bedrockUraniumSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.B08_bedrockUraniumWeight", "Spawn weight for uranium bedrock ore", 35);
|
||||
bedrockThoriumSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.B09_bedrockThoriumWeight", "Spawn weight for thorium bedrock ore", 50);
|
||||
bedrockCoalSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.B10_bedrockCoalWeight", "Spawn weight for coal bedrock ore", 200);
|
||||
bedrockNiterSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.B11_bedrockNiterWeight", "Spawn weight for niter bedrock ore", 50);
|
||||
bedrockFluoriteSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.B12_bedrockFluoriteWeight", "Spawn weight for fluorite bedrock ore", 50);
|
||||
bedrockRedstoneSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.B13_bedrockRedstoneWeight", "Spawn weight for redstone bedrock ore", 50);
|
||||
bedrockChlorocalciteSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.B14_bedrockbChlorocalciteWeight", "Spawn weight for chlorocalcite bedrock ore", 35);
|
||||
|
||||
ironClusterSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.C00_ironClusterSpawn", "Amount of iron cluster veins per chunk", 4);
|
||||
titaniumClusterSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.C01_titaniumClusterSpawn", "Amount of titanium cluster veins per chunk", 2);
|
||||
@ -171,7 +184,6 @@ public class WorldConfig {
|
||||
dungeonStructure = CommonConfig.createConfigInt(config, CATEGORY_DUNGEON, "4.04_dungeonSpawn", "Spawn library dungeon on every nTH chunk", 64);
|
||||
relayStructure = CommonConfig.createConfigInt(config, CATEGORY_DUNGEON, "4.05_relaySpawn", "Spawn relay on every nTH chunk", 500);
|
||||
satelliteStructure = CommonConfig.createConfigInt(config, CATEGORY_DUNGEON, "4.06_satelliteSpawn", "Spawn satellite dish on every nTH chunk", 500);
|
||||
bunkerStructure = CommonConfig.createConfigInt(config, CATEGORY_DUNGEON, "4.07_bunkerSpawn", "Spawn bunker on every nTH chunk", 1000);
|
||||
siloStructure = CommonConfig.createConfigInt(config, CATEGORY_DUNGEON, "4.08_siloSpawn", "Spawn missile silo on every nTH chunk", 1000);
|
||||
factoryStructure = CommonConfig.createConfigInt(config, CATEGORY_DUNGEON, "4.09_factorySpawn", "Spawn factory on every nTH chunk", 1000);
|
||||
dudStructure = CommonConfig.createConfigInt(config, CATEGORY_DUNGEON, "4.10_dudSpawn", "Spawn dud on every nTH chunk", 500);
|
||||
@ -206,7 +218,6 @@ public class WorldConfig {
|
||||
dungeonStructure = CommonConfig.setDefZero(dungeonStructure, 1000);
|
||||
relayStructure = CommonConfig.setDefZero(relayStructure, 1000);
|
||||
satelliteStructure = CommonConfig.setDefZero(satelliteStructure, 1000);
|
||||
bunkerStructure = CommonConfig.setDefZero(bunkerStructure, 1000);
|
||||
siloStructure = CommonConfig.setDefZero(siloStructure, 1000);
|
||||
factoryStructure = CommonConfig.setDefZero(factoryStructure, 1000);
|
||||
dudStructure = CommonConfig.setDefZero(dudStructure, 1000);
|
||||
|
||||
@ -54,8 +54,8 @@ public class ArmorRecipes {
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.robes_boots, 1), new Object[] { "R R", "P P", 'R', ModItems.rag, 'P', ModItems.plate_polymer });
|
||||
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.security_helmet, 1), new Object[] { "SSS", "IGI", 'S', STEEL.plate(), 'I', ModItems.plate_polymer, 'G', KEY_ANYPANE });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.security_plate, 1), new Object[] { "KWK", "IKI", "WKW", 'K', ModItems.plate_kevlar, 'I', POLYMER.ingot(), 'W', new ItemStack(Blocks.wool, 1, OreDictionary.WILDCARD_VALUE) });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.security_legs, 1), new Object[] { "IWI", "K K", "W W", 'K', ModItems.plate_kevlar, 'I', POLYMER.ingot(), 'W', new ItemStack(Blocks.wool, 1, OreDictionary.WILDCARD_VALUE) });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.security_plate, 1), new Object[] { "KWK", "IKI", "WKW", 'K', ModItems.plate_kevlar, 'I', ANY_PLASTIC.ingot(), 'W', new ItemStack(Blocks.wool, 1, OreDictionary.WILDCARD_VALUE) });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.security_legs, 1), new Object[] { "IWI", "K K", "W W", 'K', ModItems.plate_kevlar, 'I', ANY_PLASTIC.ingot(), 'W', new ItemStack(Blocks.wool, 1, OreDictionary.WILDCARD_VALUE) });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.security_boots, 1), new Object[] { "P P", "I I", 'P', STEEL.plate(), 'I', ModItems.plate_polymer });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.dnt_helmet, 1), new Object[] { "EEE", "EE ", 'E', DNT.ingot() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.dnt_plate, 1), new Object[] { "EE ", "EEE", "EEE", 'E', DNT.ingot() });
|
||||
@ -68,7 +68,7 @@ public class ArmorRecipes {
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.t45_plate, 1), new Object[] { "MPM", "TBT", "PPP", 'M', ModItems.motor, 'P', ModItems.plate_armor_titanium, 'T', ModItems.gas_empty, 'B', ModItems.titanium_plate });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.t45_legs, 1), new Object[] { "MPM", "PBP", "P P", 'M', ModItems.motor, 'P', ModItems.plate_armor_titanium, 'B', ModItems.titanium_legs });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.t45_boots, 1), new Object[] { "P P", "PBP", 'P', ModItems.plate_armor_titanium, 'B', ModItems.titanium_boots });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.ajr_helmet, 1), new Object[] { "PPC", "PBP", "IXI", 'P', ModItems.plate_armor_ajr, 'C', ModItems.circuit_targeting_tier4, 'I', POLYMER.ingot(), 'X', ModItems.gas_mask_m65, 'B', ModItems.alloy_helmet });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.ajr_helmet, 1), new Object[] { "PPC", "PBP", "IXI", 'P', ModItems.plate_armor_ajr, 'C', ModItems.circuit_targeting_tier4, 'I', ANY_PLASTIC.ingot(), 'X', ModItems.gas_mask_m65, 'B', ModItems.alloy_helmet });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.ajr_plate, 1), new Object[] { "MPM", "TBT", "PPP", 'M', ModItems.motor_desh, 'P', ModItems.plate_armor_ajr, 'T', ModItems.gas_empty, 'B', ModItems.alloy_plate });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.ajr_legs, 1), new Object[] { "MPM", "PBP", "P P", 'M', ModItems.motor_desh, 'P', ModItems.plate_armor_ajr, 'B', ModItems.alloy_legs });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.ajr_boots, 1), new Object[] { "P P", "PBP", 'P', ModItems.plate_armor_ajr, 'B', ModItems.alloy_boots });
|
||||
@ -81,9 +81,9 @@ public class ArmorRecipes {
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.bj_plate_jetpack, 1), new Object[] { "NFN", "TPT", "ICI", 'N', ModItems.plate_armor_lunar, 'F', ModItems.fins_quad_titanium, 'T', new ItemStack(ModItems.fluid_tank_full, 1, Fluids.XENON.getID()), 'P', ModItems.bj_plate, 'I', ModItems.mp_thruster_10_xenon, 'C', ModItems.crystal_phosphorus });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.bj_legs, 1), new Object[] { "MBM", "NSN", "N N", 'N', ModItems.plate_armor_lunar, 'M', ModItems.motor_desh, 'S', ModItems.starmetal_legs, 'B', ModBlocks.block_starmetal });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.bj_boots, 1), new Object[] { "N N", "BSB", 'N', ModItems.plate_armor_lunar, 'S', ModItems.starmetal_boots, 'B', ModBlocks.block_starmetal });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.hev_helmet, 1), new Object[] { "PPC", "PBP", "IFI", 'P', ModItems.plate_armor_hev, 'C', ModItems.circuit_targeting_tier4, 'B', ModItems.titanium_helmet, 'I', ModItems.plate_polymer, 'F', ModItems.gas_mask_filter });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.hev_plate, 1), new Object[] { "MPM", "IBI", "PPP", 'P', ModItems.plate_armor_hev, 'B', ModItems.titanium_plate, 'I', POLYMER.ingot(), 'M', ModItems.motor_desh });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.hev_legs, 1), new Object[] { "MPM", "IBI", "P P", 'P', ModItems.plate_armor_hev, 'B', ModItems.titanium_legs, 'I', POLYMER.ingot(), 'M', ModItems.motor_desh });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.hev_helmet, 1), new Object[] { "PPC", "PBP", "IFI", 'P', ModItems.plate_armor_hev, 'C', ModItems.circuit_targeting_tier4, 'B', ModItems.titanium_helmet, 'I', ANY_PLASTIC.ingot(), 'F', ModItems.gas_mask_filter });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.hev_plate, 1), new Object[] { "MPM", "IBI", "PPP", 'P', ModItems.plate_armor_hev, 'B', ModItems.titanium_plate, 'I', ANY_PLASTIC.ingot(), 'M', ModItems.motor_desh });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.hev_legs, 1), new Object[] { "MPM", "IBI", "P P", 'P', ModItems.plate_armor_hev, 'B', ModItems.titanium_legs, 'I', ANY_PLASTIC.ingot(), 'M', ModItems.motor_desh });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.hev_boots, 1), new Object[] { "P P", "PBP", 'P', ModItems.plate_armor_hev, 'B', ModItems.titanium_boots });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.fau_helmet, 1), new Object[] { "PWP", "PBP", "FSF", 'P', ModItems.plate_armor_fau, 'W', new ItemStack(Blocks.wool, 1, 14), 'B', ModItems.starmetal_helmet, 'F', ModItems.gas_mask_filter, 'S', ModItems.pipes_steel });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.fau_plate, 1), new Object[] { "MCM", "PBP", "PSP", 'M', ModItems.motor_desh, 'C', ModItems.demon_core_closed, 'P', ModItems.plate_armor_fau, 'B', ModItems.starmetal_plate, 'S', ModBlocks.ancient_scrap });
|
||||
@ -162,7 +162,7 @@ public class ArmorRecipes {
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gas_mask_olde, 1), new Object[] { "PPP", "GPG", " F ", 'G', KEY_ANYPANE, 'P', Items.leather, 'F', IRON.ingot() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gas_mask_mono, 1), new Object[] { " P ", "PPP", " F ", 'P', ModItems.plate_polymer, 'F', IRON.plate() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.mask_of_infamy, 1), new Object[] { "III", "III", " I ", 'I', IRON.plate() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.ashglasses, 1), new Object[] { "I I", "GPG", 'I', ModItems.plate_polymer, 'G', ModBlocks.glass_ash, 'P', POLYMER.ingot() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.ashglasses, 1), new Object[] { "I I", "GPG", 'I', ModItems.plate_polymer, 'G', ModBlocks.glass_ash, 'P', ANY_PLASTIC.ingot() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.mask_rag, 1), new Object[] { "RRR", 'R', ModItems.rag_damp });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.mask_piss, 1), new Object[] { "RRR", 'R', ModItems.rag_piss });
|
||||
|
||||
|
||||
@ -51,6 +51,9 @@ public class MineralRecipes {
|
||||
add1To9Pair(ModBlocks.block_polymer, ModItems.ingot_polymer);
|
||||
add1To9Pair(ModBlocks.block_bakelite, ModItems.ingot_bakelite);
|
||||
add1To9Pair(ModBlocks.block_rubber, ModItems.ingot_rubber);
|
||||
add1To9Pair(ModBlocks.block_cadmium, ModItems.ingot_cadmium);
|
||||
add1To9Pair(ModBlocks.block_tcalloy, ModItems.ingot_tcalloy);
|
||||
add1To9Pair(ModBlocks.block_cdalloy, ModItems.ingot_cdalloy);
|
||||
|
||||
for(int i = 0; i < EnumCokeType.values().length; i++) {
|
||||
add1To9PairSameMeta(Item.getItemFromBlock(ModBlocks.block_coke), ModItems.coke, i);
|
||||
@ -454,6 +457,10 @@ public class MineralRecipes {
|
||||
add9To1(DictFrame.fromOne(ModItems.ore_byproduct, EnumByproduct.B_SULFUR), new ItemStack(ModItems.sulfur));
|
||||
add9To1(DictFrame.fromOne(ModItems.ore_byproduct, EnumByproduct.B_CALCIUM), new ItemStack(ModItems.powder_calcium));
|
||||
add9To1(DictFrame.fromOne(ModItems.ore_byproduct, EnumByproduct.B_BISMUTH), new ItemStack(ModItems.powder_bismuth));
|
||||
add9To1(DictFrame.fromOne(ModItems.ore_byproduct, EnumByproduct.B_RADIUM), new ItemStack(ModItems.powder_ra226));
|
||||
add9To1(DictFrame.fromOne(ModItems.ore_byproduct, EnumByproduct.B_TECHNETIUM), new ItemStack(ModItems.billet_technetium));
|
||||
add9To1(DictFrame.fromOne(ModItems.ore_byproduct, EnumByproduct.B_POLONIUM), new ItemStack(ModItems.billet_polonium));
|
||||
add9To1(DictFrame.fromOne(ModItems.ore_byproduct, EnumByproduct.B_URANIUM), new ItemStack(ModItems.powder_uranium));
|
||||
}
|
||||
|
||||
//Bundled 1/9 recipes
|
||||
|
||||
@ -41,11 +41,11 @@ public class PowderRecipes {
|
||||
CraftingManager.addShapelessAuto(new ItemStack(Items.gunpowder, 3), new Object[] { S.dust(), KNO.dust(), new ItemStack(Items.coal, 1, 1) });
|
||||
|
||||
//Blends
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.powder_power, 5), new Object[] { REDSTONE.dust(), "dustGlowstone", DIAMOND.dust(), NP237.dust(), MAGTUNG.dust() });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.powder_power, 3), new Object[] { "dustGlowstone", DIAMOND.dust(), MAGTUNG.dust() });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.powder_nitan_mix, 6), new Object[] { NP237.dust(), I.dust(), TH232.dust(), AT.dust(), ND.dust(), CS.dust() });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.powder_nitan_mix, 6), new Object[] { ST.dust(), CO.dust(), BR.dust(), TS.dust(), NB.dust(), CE.dust() });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.powder_spark_mix, 5), new Object[] { DESH.dust(), EUPH.dust(), ModItems.powder_meteorite, ModItems.powder_power, ModItems.powder_nitan_mix });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.powder_meteorite, 5), new Object[] { IRON.dust(), CU.dust(), LI.dust(), W.dust(), U.dust() });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.powder_spark_mix, 3), new Object[] { DESH.dust(), EUPH.dust(), ModItems.powder_power });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.powder_meteorite, 4), new Object[] { IRON.dust(), CU.dust(), LI.dust(), NETHERQUARTZ.dust() });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.powder_thermite, 4), new Object[] { IRON.dust(), IRON.dust(), IRON.dust(), AL.dust() });
|
||||
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.powder_desh_mix, 1), new Object[] { B.dustTiny(), B.dustTiny(), LA.dustTiny(), LA.dustTiny(), CE.dustTiny(), CO.dustTiny(), LI.dustTiny(), ND.dustTiny(), NB.dustTiny() });
|
||||
|
||||
@ -119,6 +119,7 @@ public class ToolRecipes {
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.dosimeter, 1), new Object[] { "WGW", "WCW", "WBW", 'W', KEY_PLANKS, 'G', KEY_ANYPANE, 'C', ModItems.circuit_aluminium, 'B', BE.ingot() });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModBlocks.geiger), new Object[] { ModItems.geiger_counter });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.digamma_diagnostic), new Object[] { ModItems.geiger_counter, PO210.billet(), ASBESTOS.ingot() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.pollution_detector, 1), new Object[] { "SFS", "SCS", " S ", 'S', STEEL.plate(), 'F', ModItems.filter_coal, 'C', ModItems.circuit_copper });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.defuser, 1), new Object[] { " PS", "P P", " P ", 'P', POLYMER.ingot(), 'S', STEEL.plate() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.coltan_tool, 1), new Object[] { "ACA", "CXC", "ACA", 'A', ALLOY.ingot(), 'C', CINNABAR.crystal(), 'X', Items.compass });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.reacher, 1), new Object[] { "BIB", "P P", "B B", 'B', ModItems.bolt_tungsten, 'I', W.ingot(), 'P', ModItems.plate_polymer });
|
||||
|
||||
@ -188,11 +188,11 @@ public class WeaponRecipes {
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_12gauge, 12), new Object[] { " I ", "GCL", " P ", 'I', ModItems.pellet_buckshot, 'G', ModItems.ballistite, 'C', ModItems.casing_buckshot, 'P', ModItems.primer_buckshot, 'L', ModItems.plate_polymer });
|
||||
CraftingManager.addRecipeAuto(ModItems.ammo_12gauge.stackFromEnum(12, Ammo12Gauge.PERCUSSION), new Object[] { "G", "C", "P", 'G', ModItems.ballistite, 'C', ModItems.casing_buckshot, 'P', ModItems.primer_buckshot });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_4gauge, 12), new Object[] { " I ", "GCL", " P ", 'I', ModItems.pellet_buckshot, 'G', ModItems.cordite, 'C', ModItems.casing_50, 'P', ModItems.primer_50, 'L', ModItems.plate_polymer });
|
||||
CraftingManager.addRecipeAuto(ModItems.ammo_4gauge.stackFromEnum(12, Ammo4Gauge.SLUG), new Object[] { " I ", "GCL", " P ", 'I', PB.ingot(), 'G', ANY_SMOKELESS.dust(), 'C', ModItems.casing_50, 'P', ModItems.primer_50, 'L', ModItems.plate_polymer });
|
||||
CraftingManager.addRecipeAuto(ModItems.ammo_4gauge.stackFromEnum(12, Ammo4Gauge.FLECHETTE), new Object[] { " I ", "GCL", " P ", 'I', ModItems.pellet_flechette, 'G', ANY_SMOKELESS.dust(), 'C', ModItems.casing_50, 'P', ModItems.primer_50, 'L', ModItems.plate_polymer });
|
||||
CraftingManager.addRecipeAuto(ModItems.ammo_4gauge.stackFromEnum(4, Ammo4Gauge.EXPLOSIVE), new Object[] { " I ", "GCL", " P ", 'I', ModBlocks.tnt, 'G', ANY_SMOKELESS.dust(), 'C', ModItems.casing_50, 'P', ModItems.primer_50, 'L', ModItems.plate_polymer });
|
||||
CraftingManager.addRecipeAuto(ModItems.ammo_4gauge.stackFromEnum(6, Ammo4Gauge.EXPLOSIVE), new Object[] { " I ", "GCL", " P ", 'I', ANY_PLASTICEXPLOSIVE.ingot(), 'G', ANY_SMOKELESS.dust(), 'C', ModItems.casing_50, 'P', ModItems.primer_50, 'L', ModItems.plate_polymer });
|
||||
CraftingManager.addRecipeAuto(ModItems.ammo_4gauge.stackFromEnum(4, Ammo4Gauge.MINING), new Object[] { " I ", "GCL", " P ", 'I', ModBlocks.det_miner, 'G', ANY_SMOKELESS.dust(), 'C', ModItems.casing_50, 'P', ModItems.primer_50, 'L', ModItems.plate_polymer });
|
||||
CraftingManager.addRecipeAuto(ModItems.ammo_4gauge.stackFromEnum(12, Ammo4Gauge.SLUG), new Object[] { " I ", "GCL", " P ", 'I', PB.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_50, 'P', ModItems.primer_50, 'L', ModItems.plate_polymer });
|
||||
CraftingManager.addRecipeAuto(ModItems.ammo_4gauge.stackFromEnum(12, Ammo4Gauge.FLECHETTE), new Object[] { " I ", "GCL", " P ", 'I', ModItems.pellet_flechette, 'G', ModItems.cordite, 'C', ModItems.casing_50, 'P', ModItems.primer_50, 'L', ModItems.plate_polymer });
|
||||
CraftingManager.addRecipeAuto(ModItems.ammo_4gauge.stackFromEnum(4, Ammo4Gauge.EXPLOSIVE), new Object[] { " I ", "GCL", " P ", 'I', ModBlocks.tnt, 'G', ModItems.cordite, 'C', ModItems.casing_50, 'P', ModItems.primer_50, 'L', ModItems.plate_polymer });
|
||||
CraftingManager.addRecipeAuto(ModItems.ammo_4gauge.stackFromEnum(6, Ammo4Gauge.EXPLOSIVE), new Object[] { " I ", "GCL", " P ", 'I', ANY_PLASTICEXPLOSIVE.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_50, 'P', ModItems.primer_50, 'L', ModItems.plate_polymer });
|
||||
CraftingManager.addRecipeAuto(ModItems.ammo_4gauge.stackFromEnum(4, Ammo4Gauge.MINING), new Object[] { " I ", "GCL", " P ", 'I', ModBlocks.det_miner, 'G', ModItems.cordite, 'C', ModItems.casing_50, 'P', ModItems.primer_50, 'L', ModItems.plate_polymer });
|
||||
CraftingManager.addShapelessAuto(ModItems.ammo_4gauge.stackFromEnum(Ammo4Gauge.QUACK), new Object[] { ModItems.ammo_4gauge, ModItems.nugget_bismuth, ModItems.nugget_tantalium, ModItems.ball_dynamite });
|
||||
CraftingManager.addRecipeAuto(ModItems.ammo_20gauge.stackFromEnum(12, Ammo20Gauge.STOCK), new Object[] { " I ", "GCL", " P ", 'I', ModItems.pellet_buckshot, 'G', ANY_SMOKELESS.dust(), 'C', ModItems.casing_buckshot, 'P', ModItems.primer_buckshot, 'L', CU.plate() });
|
||||
CraftingManager.addRecipeAuto(ModItems.ammo_20gauge.stackFromEnum(12, Ammo20Gauge.SLUG), new Object[] { " I ", "GCL", " P ", 'I', PB.ingot(), 'G', ANY_SMOKELESS.dust(), 'C', ModItems.casing_buckshot, 'P', ModItems.primer_buckshot, 'L', CU.plate() });
|
||||
@ -348,6 +348,7 @@ public class WeaponRecipes {
|
||||
|
||||
//Sticks of explosives
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.stick_dynamite, 4), new Object[] { " S ", "PDP", "PDP", 'S', ModItems.safety_fuse, 'P', Items.paper, 'D', ModItems.ball_dynamite });
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.stick_dynamite_fishing, 1), new Object[] { ModItems.stick_dynamite, ModItems.stick_dynamite, ModItems.stick_dynamite, Items.paper, ANY_TAR.any() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.stick_tnt, 4), new Object[] { " S ", "PDP", "PDP", 'S', ModBlocks.det_cord, 'P', Items.paper, 'D', ModItems.ball_tnt });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.stick_semtex, 4), new Object[] { " S ", "PDP", "PDP", 'S', ModBlocks.det_cord, 'P', Items.paper, 'D', ModItems.ingot_semtex });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.stick_c4, 4), new Object[] { " S ", "PDP", "PDP", 'S', ModBlocks.det_cord, 'P', Items.paper, 'D', ModItems.ingot_c4 });
|
||||
|
||||
@ -16,7 +16,7 @@ import com.hbm.entity.particle.*;
|
||||
import com.hbm.entity.projectile.*;
|
||||
import com.hbm.entity.train.EntityRailCarBase.BoundingBoxDummyEntity;
|
||||
import com.hbm.entity.train.EntityRailCarRidable.SeatDummyEntity;
|
||||
import com.hbm.entity.train.TrainCargoTram;
|
||||
import com.hbm.entity.train.*;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.util.Tuple.Quartet;
|
||||
|
||||
@ -210,11 +210,16 @@ public class EntityMappings {
|
||||
addEntity(EntityCog.class, "entity_stray_cog", 1000);
|
||||
addEntity(EntitySawblade.class, "entity_stray_saw", 1000);
|
||||
addEntity(EntityChemical.class, "entity_chemthrower_splash", 1000);
|
||||
addEntity(EntityMist.class, "entity_mist", 1000);
|
||||
addEntity(EntityMist.class, "entity_mist", 250, false);
|
||||
addEntity(EntityAcidBomb.class, "entity_acid_bomb", 1000);
|
||||
|
||||
addEntity(EntityItemWaste.class, "entity_item_waste", 100);
|
||||
addEntity(EntityItemBuoyant.class, "entity_item_buoyant", 100);
|
||||
|
||||
addEntity(SeatDummyEntity.class, "entity_ntm_seat_dummy", 250, false);
|
||||
addEntity(BoundingBoxDummyEntity.class, "entity_ntm_bounding_dummy", 250, false);
|
||||
addEntity(TrainCargoTram.class, "entity_ntm_cargo_tram", 250, false);
|
||||
addEntity(TrainCargoTramTrailer.class, "entity_ntm_cargo_tram_trailer", 250, false);
|
||||
|
||||
addMob(EntityCreeperNuclear.class, "entity_mob_nuclear_creeper", 0x204131, 0x75CE00);
|
||||
addMob(EntityCreeperTainted.class, "entity_mob_tainted_creeper", 0x813b9b, 0xd71fdd);
|
||||
@ -229,11 +234,20 @@ public class EntityMappings {
|
||||
addMob(EntityDuck.class, "entity_fucc_a_ducc", 0xd0d0d0, 0xFFBF00);
|
||||
addMob(EntityQuackos.class, "entity_elder_one", 0xd0d0d0, 0xFFBF00);
|
||||
addMob(EntityFBI.class, "entity_ntm_fbi", 0x008000, 0x404040);
|
||||
addMob(EntityFBIDrone.class, "entity_ntm_fbi_drone", 0x008000, 0x404040);
|
||||
addMob(EntityRADBeast.class, "entity_ntm_radiation_blaze", 0x303030, 0x008000);
|
||||
addMob(EntitySiegeZombie.class, "entity_meme_zombie", 0x303030, 0x008000);
|
||||
addMob(EntitySiegeSkeleton.class, "entity_meme_skeleton", 0x303030, 0x000080);
|
||||
addMob(EntitySiegeUFO.class, "entity_meme_ufo", 0x303030, 0x800000);
|
||||
addMob(EntitySiegeCraft.class, "entity_meme_craft", 0x303030, 0x808000);
|
||||
addMob(EntityGlyphid.class, "entity_glyphid", 0x724A21, 0xD2BB72);
|
||||
addMob(EntityGlyphidBrawler.class, "entity_glyphid_brawler", 0x273038, 0xD2BB72);
|
||||
addMob(EntityGlyphidBehemoth.class, "entity_glyphid_behemoth", 0x267F00, 0xD2BB72);
|
||||
addMob(EntityGlyphidBrenda.class, "entity_glyphid_brenda", 0x4FC0C0, 0xA0A0A0);
|
||||
addMob(EntityGlyphidBombardier.class, "entity_glyphid_bombardier", 0xDDD919, 0xDBB79D);
|
||||
addMob(EntityGlyphidBlaster.class, "entity_glyphid_blaster", 0xD83737, 0xDBB79D);
|
||||
addMob(EntityGlyphidScout.class, "entity_glyphid_scout", 0x273038, 0xB9E36B);
|
||||
addMob(EntityGlyphidNuclear.class, "entity_glyphid_nuclear", 0x267F00, 0xA0A0A0);
|
||||
|
||||
addSpawn(EntityCreeperPhosgene.class, 5, 1, 1, EnumCreatureType.monster, BiomeGenBase.getBiomeGenArray());
|
||||
addSpawn(EntityCreeperVolatile.class, 10, 1, 1, EnumCreatureType.monster, BiomeGenBase.getBiomeGenArray());
|
||||
|
||||
@ -16,6 +16,7 @@ import com.hbm.inventory.fluid.trait.FluidTraitSimple.FT_Gaseous_ART;
|
||||
import com.hbm.inventory.fluid.trait.FluidTraitSimple.FT_Liquid;
|
||||
import com.hbm.inventory.fluid.trait.FluidTraitSimple.FT_Viscous;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.util.ArmorUtil;
|
||||
import com.hbm.util.ContaminationUtil;
|
||||
import com.hbm.util.EntityDamageUtil;
|
||||
@ -101,10 +102,21 @@ public class EntityMist extends Entity {
|
||||
} else {
|
||||
|
||||
for(int i = 0; i < 2; i++) {
|
||||
double x = this.boundingBox.minX + rand.nextDouble() * (this.boundingBox.maxX - this.boundingBox.minX);
|
||||
double x = this.boundingBox.minX + (rand.nextDouble() - 0.5) * (this.boundingBox.maxX - this.boundingBox.minX);
|
||||
double y = this.boundingBox.minY + rand.nextDouble() * (this.boundingBox.maxY - this.boundingBox.minY);
|
||||
double z = this.boundingBox.minZ + rand.nextDouble() * (this.boundingBox.maxZ - this.boundingBox.minZ);
|
||||
worldObj.spawnParticle("cloud", x, y, z, 0, 0, 0);
|
||||
double z = this.boundingBox.minZ + (rand.nextDouble() - 0.5) * (this.boundingBox.maxZ - this.boundingBox.minZ);
|
||||
|
||||
NBTTagCompound fx = new NBTTagCompound();
|
||||
fx.setString("type", "tower");
|
||||
fx.setFloat("lift", 0.5F);
|
||||
fx.setFloat("base", 0.75F);
|
||||
fx.setFloat("max", 2F);
|
||||
fx.setInteger("life", 50 + worldObj.rand.nextInt(10));
|
||||
fx.setInteger("color",this.getType().getColor());
|
||||
fx.setDouble("posX", x);
|
||||
fx.setDouble("posY", y);
|
||||
fx.setDouble("posZ", z);
|
||||
MainRegistry.proxy.effectNT(fx);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -192,11 +204,14 @@ public class EntityMist extends Entity {
|
||||
@Override
|
||||
protected void readEntityFromNBT(NBTTagCompound nbt) {
|
||||
this.setType(Fluids.fromID(nbt.getInteger("type")));
|
||||
this.setArea(nbt.getFloat("width"), nbt.getFloat("height"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeEntityToNBT(NBTTagCompound nbt) {
|
||||
nbt.setInteger("type", this.getType().getID());
|
||||
nbt.setFloat("width", this.dataWatcher.getWatchableObjectFloat(11));
|
||||
nbt.setFloat("height", this.dataWatcher.getWatchableObjectFloat(12));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -204,6 +219,12 @@ public class EntityMist extends Entity {
|
||||
public boolean canRenderOnFire() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override public void moveEntity(double x, double y, double z) { }
|
||||
@Override public void addVelocity(double x, double y, double z) { }
|
||||
@Override public void setPosition(double x, double y, double z) {
|
||||
if(this.ticksExisted == 0) super.setPosition(x, y, z); //honest to fucking god mojang suck my fucking nuts
|
||||
}
|
||||
|
||||
public static SprayStyle getStyleFromType(FluidType type) {
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@ public class EntityGrenadeBouncyGeneric extends EntityGrenadeBouncyBase implemen
|
||||
|
||||
@Override
|
||||
public void explode() {
|
||||
getGrenade().explode(worldObj, posX, posY, posZ);
|
||||
getGrenade().explode(this, this.getThrower(), worldObj, posX, posY, posZ);
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
|
||||
@ -5,7 +5,9 @@ import net.minecraft.world.World;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.entity.effect.EntityMist;
|
||||
import com.hbm.explosion.ExplosionChaos;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.weapon.ItemGrenade;
|
||||
|
||||
@ -30,21 +32,12 @@ public class EntityGrenadeGas extends EntityGrenadeBouncyBase {
|
||||
if (!this.worldObj.isRemote) {
|
||||
this.setDead();
|
||||
this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 0.0F, true);
|
||||
// ExplosionChaos.poison(this.worldObj, (int)this.posX,
|
||||
// (int)this.posY, (int)this.posZ, 5);
|
||||
// for(int i = 0; 0 < 15; i++) {
|
||||
|
||||
/*
|
||||
* ExplosionLarge.spawnParticlesRadial(worldObj, posX, posY, posZ,
|
||||
* 50); ExplosionLarge.spawnParticlesRadial(worldObj, posX, posY,
|
||||
* posZ, 50); ExplosionLarge.spawnParticlesRadial(worldObj, posX,
|
||||
* posY, posZ, 50); ExplosionLarge.spawnParticlesRadial(worldObj,
|
||||
* posX, posY, posZ, 50);
|
||||
*/
|
||||
|
||||
ExplosionChaos.spawnChlorine(worldObj, posX, posY, posZ, 50, 1.25, 0);
|
||||
|
||||
// }
|
||||
|
||||
EntityMist mist = new EntityMist(worldObj);
|
||||
mist.setType(Fluids.CHLORINE);
|
||||
mist.setPosition(posX, posY - 5, posZ);
|
||||
mist.setArea(15, 10);
|
||||
worldObj.spawnEntityInWorld(mist);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ public class EntityGrenadeImpactGeneric extends EntityGrenadeBase implements IGe
|
||||
public void explode() {
|
||||
|
||||
if(!this.worldObj.isRemote && getGrenade() != null) {
|
||||
getGrenade().explode(worldObj, posX, posY, posZ);
|
||||
getGrenade().explode(this, this.getThrower(), worldObj, posX, posY, posZ);
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
27
src/main/java/com/hbm/entity/item/EntityItemBuoyant.java
Normal file
27
src/main/java/com/hbm/entity/item/EntityItemBuoyant.java
Normal file
@ -0,0 +1,27 @@
|
||||
package com.hbm.entity.item;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityItemBuoyant extends EntityItem {
|
||||
|
||||
public EntityItemBuoyant(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
public EntityItemBuoyant(World world, double x, double y, double z, ItemStack stack) {
|
||||
super(world, x, y, z, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
|
||||
if(worldObj.getBlock((int) Math.floor(posX), (int) Math.floor(posY - 0.0625), (int) Math.floor(posZ)).getMaterial() == Material.water) {
|
||||
this.motionY += 0.045D;
|
||||
}
|
||||
|
||||
super.onUpdate();
|
||||
}
|
||||
}
|
||||
@ -7,11 +7,10 @@ import com.hbm.explosion.ExplosionBalefire;
|
||||
import com.hbm.explosion.ExplosionNukeGeneric;
|
||||
import com.hbm.main.MainRegistry;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityBalefire extends Entity {
|
||||
public class EntityBalefire extends EntityExplosionChunkloading {
|
||||
|
||||
public int age = 0;
|
||||
public int destructionRange = 0;
|
||||
@ -53,48 +52,46 @@ public class EntityBalefire extends Entity {
|
||||
super(p_i1582_1_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
|
||||
if(!this.did)
|
||||
{
|
||||
if(GeneralConfig.enableExtendedLogging && !worldObj.isRemote)
|
||||
MainRegistry.logger.log(Level.INFO, "[NUKE] Initialized BF explosion at " + posX + " / " + posY + " / " + posZ + " with strength " + destructionRange + "!");
|
||||
|
||||
exp = new ExplosionBalefire((int)this.posX, (int)this.posY, (int)this.posZ, this.worldObj, this.destructionRange);
|
||||
|
||||
this.did = true;
|
||||
}
|
||||
|
||||
speed += 1; //increase speed to keep up with expansion
|
||||
|
||||
boolean flag = false;
|
||||
for(int i = 0; i < this.speed; i++)
|
||||
{
|
||||
flag = exp.update();
|
||||
|
||||
if(flag) {
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
if(!mute && rand.nextInt(5) == 0)
|
||||
this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "random.explode", 10000.0F, 0.8F + this.rand.nextFloat() * 0.2F);
|
||||
|
||||
if(!flag) {
|
||||
|
||||
if(!mute)
|
||||
this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "ambient.weather.thunder", 10000.0F, 0.8F + this.rand.nextFloat() * 0.2F);
|
||||
|
||||
ExplosionNukeGeneric.dealDamage(this.worldObj, this.posX, this.posY, this.posZ, this.destructionRange * 2);
|
||||
}
|
||||
|
||||
age++;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() { }
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
|
||||
if(!worldObj.isRemote) loadChunk((int) Math.floor(posX / 16D), (int) Math.floor(posZ / 16D));
|
||||
|
||||
if(!this.did) {
|
||||
if(GeneralConfig.enableExtendedLogging && !worldObj.isRemote)
|
||||
MainRegistry.logger.log(Level.INFO, "[NUKE] Initialized BF explosion at " + posX + " / " + posY + " / " + posZ + " with strength " + destructionRange + "!");
|
||||
|
||||
exp = new ExplosionBalefire((int) this.posX, (int) this.posY, (int) this.posZ, this.worldObj, this.destructionRange);
|
||||
|
||||
this.did = true;
|
||||
}
|
||||
|
||||
speed += 1; // increase speed to keep up with expansion
|
||||
|
||||
boolean flag = false;
|
||||
for(int i = 0; i < this.speed; i++) {
|
||||
flag = exp.update();
|
||||
|
||||
if(flag) {
|
||||
clearChunkLoader();
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
if(!mute && rand.nextInt(5) == 0)
|
||||
this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "random.explode", 10000.0F, 0.8F + this.rand.nextFloat() * 0.2F);
|
||||
|
||||
if(!flag) {
|
||||
|
||||
if(!mute)
|
||||
this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "ambient.weather.thunder", 10000.0F, 0.8F + this.rand.nextFloat() * 0.2F);
|
||||
|
||||
ExplosionNukeGeneric.dealDamage(this.worldObj, this.posX, this.posY, this.posZ, this.destructionRange * 2);
|
||||
}
|
||||
|
||||
age++;
|
||||
}
|
||||
|
||||
public EntityBalefire mute() {
|
||||
this.mute = true;
|
||||
|
||||
@ -1,49 +0,0 @@
|
||||
package com.hbm.entity.logic;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class EntityEnvirEffect extends Entity {
|
||||
|
||||
public int maxAge = 100;
|
||||
public int blockRadius = 7;
|
||||
public int entityRadius = 7;
|
||||
public int chance = 10;
|
||||
public boolean hasBlockEffect = true;
|
||||
public boolean hasEntityEffect = true;
|
||||
|
||||
public EntityEnvirEffect(World p_i1582_1_) {
|
||||
super(p_i1582_1_);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void readEntityFromNBT(NBTTagCompound nbt) {
|
||||
this.ticksExisted = nbt.getInteger("lifetime");
|
||||
this.maxAge = nbt.getInteger("lifecap");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeEntityToNBT(NBTTagCompound nbt) {
|
||||
nbt.setInteger("lifetime", this.ticksExisted);
|
||||
nbt.setInteger("lifecap", this.maxAge);
|
||||
}
|
||||
|
||||
public void onUpdate() {
|
||||
|
||||
if(hasBlockEffect && rand.nextInt(chance) == 0)
|
||||
applyBlockEffect();
|
||||
|
||||
if(hasEntityEffect && rand.nextInt(chance) == 0)
|
||||
applyEntityEffect();
|
||||
}
|
||||
|
||||
private void applyBlockEffect() { };
|
||||
private void applyEntityEffect() { };
|
||||
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
package com.hbm.entity.logic;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityEnvirEffectRad extends EntityEnvirEffect {
|
||||
|
||||
public EntityEnvirEffectRad(World p_i1582_1_) {
|
||||
super(p_i1582_1_);
|
||||
}
|
||||
|
||||
public void randomizeAge(int min, int max) {
|
||||
this.maxAge = min + rand.nextInt(max - min);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
package com.hbm.entity.logic;
|
||||
|
||||
import com.hbm.main.MainRegistry;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.world.ChunkCoordIntPair;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeChunkManager;
|
||||
import net.minecraftforge.common.ForgeChunkManager.Ticket;
|
||||
import net.minecraftforge.common.ForgeChunkManager.Type;
|
||||
|
||||
public abstract class EntityExplosionChunkloading extends Entity implements IChunkLoader {
|
||||
|
||||
private Ticket loaderTicket;
|
||||
private ChunkCoordIntPair loadedChunk;
|
||||
|
||||
public EntityExplosionChunkloading(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
init(ForgeChunkManager.requestTicket(MainRegistry.instance, worldObj, Type.ENTITY));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Ticket ticket) {
|
||||
if(!worldObj.isRemote && ticket != null) {
|
||||
if(loaderTicket == null) {
|
||||
loaderTicket = ticket;
|
||||
loaderTicket.bindEntity(this);
|
||||
loaderTicket.getModData();
|
||||
}
|
||||
ForgeChunkManager.forceChunk(loaderTicket, new ChunkCoordIntPair(chunkCoordX, chunkCoordZ));
|
||||
}
|
||||
}
|
||||
|
||||
public void loadChunk(int x, int z) {
|
||||
|
||||
if(this.loadedChunk == null) {
|
||||
this.loadedChunk = new ChunkCoordIntPair(x, z);
|
||||
ForgeChunkManager.forceChunk(loaderTicket, loadedChunk);
|
||||
}
|
||||
}
|
||||
|
||||
public void clearChunkLoader() {
|
||||
if(!worldObj.isRemote && loaderTicket != null && loadedChunk != null) {
|
||||
ForgeChunkManager.unforceChunk(loaderTicket, loadedChunk);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -20,14 +20,13 @@ import com.hbm.packet.AuxParticlePacketNT;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@Spaghetti("why???")
|
||||
public class EntityNukeExplosionMK3 extends Entity {
|
||||
public class EntityNukeExplosionMK3 extends EntityExplosionChunkloading {
|
||||
|
||||
public int age = 0;
|
||||
public int destructionRange = 0;
|
||||
@ -59,31 +58,32 @@ public class EntityNukeExplosionMK3 extends Entity {
|
||||
|
||||
long time = nbt.getLong("milliTime");
|
||||
|
||||
if(BombConfig.limitExplosionLifespan > 0 && System.currentTimeMillis() - time > BombConfig.limitExplosionLifespan * 1000)
|
||||
if(BombConfig.limitExplosionLifespan > 0 && System.currentTimeMillis() - time > BombConfig.limitExplosionLifespan * 1000) {
|
||||
this.clearChunkLoader();
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
if(this.waste)
|
||||
{
|
||||
exp = new ExplosionNukeAdvanced((int)this.posX, (int)this.posY, (int)this.posZ, this.worldObj, this.destructionRange, this.coefficient, 0);
|
||||
if(this.waste) {
|
||||
exp = new ExplosionNukeAdvanced((int) this.posX, (int) this.posY, (int) this.posZ, this.worldObj, this.destructionRange, this.coefficient, 0);
|
||||
exp.readFromNbt(nbt, "exp_");
|
||||
wst = new ExplosionNukeAdvanced((int)this.posX, (int)this.posY, (int)this.posZ, this.worldObj, (int)(this.destructionRange * 1.8), this.coefficient, 2);
|
||||
wst = new ExplosionNukeAdvanced((int) this.posX, (int) this.posY, (int) this.posZ, this.worldObj, (int) (this.destructionRange * 1.8), this.coefficient, 2);
|
||||
wst.readFromNbt(nbt, "wst_");
|
||||
vap = new ExplosionNukeAdvanced((int)this.posX, (int)this.posY, (int)this.posZ, this.worldObj, (int)(this.destructionRange * 2.5), this.coefficient, 1);
|
||||
vap = new ExplosionNukeAdvanced((int) this.posX, (int) this.posY, (int) this.posZ, this.worldObj, (int) (this.destructionRange * 2.5), this.coefficient, 1);
|
||||
vap.readFromNbt(nbt, "vap_");
|
||||
} else {
|
||||
} else {
|
||||
|
||||
if(extType == 0) {
|
||||
expl = new ExplosionFleija((int)this.posX, (int)this.posY, (int)this.posZ, this.worldObj, this.destructionRange, this.coefficient, this.coefficient2);
|
||||
if(extType == 0) {
|
||||
expl = new ExplosionFleija((int) this.posX, (int) this.posY, (int) this.posZ, this.worldObj, this.destructionRange, this.coefficient, this.coefficient2);
|
||||
expl.readFromNbt(nbt, "expl_");
|
||||
}
|
||||
if(extType == 1) {
|
||||
sol = new ExplosionSolinium((int)this.posX, (int)this.posY, (int)this.posZ, this.worldObj, this.destructionRange, this.coefficient, this.coefficient2);
|
||||
sol.readFromNbt(nbt, "sol_");
|
||||
}
|
||||
}
|
||||
|
||||
this.did = true;
|
||||
|
||||
}
|
||||
if(extType == 1) {
|
||||
sol = new ExplosionSolinium((int) this.posX, (int) this.posY, (int) this.posZ, this.worldObj, this.destructionRange, this.coefficient, this.coefficient2);
|
||||
sol.readFromNbt(nbt, "sol_");
|
||||
}
|
||||
}
|
||||
|
||||
this.did = true;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -120,6 +120,8 @@ public class EntityNukeExplosionMK3 extends Entity {
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
|
||||
if(!worldObj.isRemote) loadChunk((int) Math.floor(posX / 16D), (int) Math.floor(posZ / 16D));
|
||||
|
||||
if(!this.did)
|
||||
{
|
||||
@ -149,25 +151,31 @@ public class EntityNukeExplosionMK3 extends Entity {
|
||||
boolean flag = false;
|
||||
boolean flag3 = false;
|
||||
|
||||
for(int i = 0; i < this.speed; i++)
|
||||
{
|
||||
if(waste) {
|
||||
flag = exp.update();
|
||||
wst.update();
|
||||
flag3 = vap.update();
|
||||
|
||||
if(flag3) {
|
||||
this.setDead();
|
||||
}
|
||||
} else {
|
||||
if(extType == 0)
|
||||
if(expl.update())
|
||||
this.setDead();
|
||||
if(extType == 1)
|
||||
if(sol.update())
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
for(int i = 0; i < this.speed; i++) {
|
||||
if(waste) {
|
||||
flag = exp.update();
|
||||
wst.update();
|
||||
flag3 = vap.update();
|
||||
|
||||
if(flag3) {
|
||||
this.clearChunkLoader();
|
||||
this.setDead();
|
||||
}
|
||||
} else {
|
||||
if(extType == 0) {
|
||||
if(expl.update()) {
|
||||
this.clearChunkLoader();
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
if(extType == 1) {
|
||||
if(sol.update()) {
|
||||
this.clearChunkLoader();
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!flag)
|
||||
{
|
||||
@ -196,9 +204,6 @@ public class EntityNukeExplosionMK3 extends Entity {
|
||||
|
||||
age++;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() { }
|
||||
|
||||
public static HashMap<ATEntry, Long> at = new HashMap();
|
||||
|
||||
|
||||
@ -14,7 +14,6 @@ import com.hbm.util.ContaminationUtil;
|
||||
import com.hbm.util.ContaminationUtil.ContaminationType;
|
||||
import com.hbm.util.ContaminationUtil.HazardType;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@ -22,7 +21,7 @@ import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityNukeExplosionMK5 extends Entity {
|
||||
public class EntityNukeExplosionMK5 extends EntityExplosionChunkloading {
|
||||
|
||||
//Strength of the blast
|
||||
public int strength;
|
||||
@ -52,9 +51,12 @@ public class EntityNukeExplosionMK5 extends Entity {
|
||||
public void onUpdate() {
|
||||
|
||||
if(strength == 0) {
|
||||
this.clearChunkLoader();
|
||||
this.setDead();
|
||||
return;
|
||||
}
|
||||
|
||||
if(!worldObj.isRemote) loadChunk((int) Math.floor(posX / 16D), (int) Math.floor(posZ / 16D));
|
||||
|
||||
for(Object player : this.worldObj.playerEntities) {
|
||||
((EntityPlayer)player).triggerAchievement(MainRegistry.achManhattan);
|
||||
@ -92,9 +94,11 @@ public class EntityNukeExplosionMK5 extends Entity {
|
||||
fallout.setScale((int)(this.length * 2.5 + falloutAdd) * BombConfig.falloutRange / 100);
|
||||
|
||||
this.worldObj.spawnEntityInWorld(fallout);
|
||||
|
||||
|
||||
this.clearChunkLoader();
|
||||
this.setDead();
|
||||
} else {
|
||||
this.clearChunkLoader();
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,11 +8,10 @@ import com.hbm.explosion.ExplosionTom;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.saveddata.TomSaveData;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityTomBlast extends Entity {
|
||||
public class EntityTomBlast extends EntityExplosionChunkloading {
|
||||
|
||||
public int age = 0;
|
||||
public int destructionRange = 0;
|
||||
@ -54,6 +53,8 @@ public class EntityTomBlast extends Entity {
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
|
||||
if(!worldObj.isRemote) loadChunk((int) Math.floor(posX / 16D), (int) Math.floor(posZ / 16D));
|
||||
|
||||
if(!this.did) {
|
||||
|
||||
if(GeneralConfig.enableExtendedLogging && !worldObj.isRemote)
|
||||
@ -89,8 +90,4 @@ public class EntityTomBlast extends Entity {
|
||||
|
||||
age++;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,46 +48,36 @@ public abstract class EntityMissileBaseAdvanced extends Entity implements IChunk
|
||||
targetZ = (int) posZ;
|
||||
}
|
||||
|
||||
public boolean canBeCollidedWith()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_)
|
||||
{
|
||||
if (this.isEntityInvulnerable())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!this.isDead && !this.worldObj.isRemote)
|
||||
{
|
||||
health -= p_70097_2_;
|
||||
|
||||
if (this.health <= 0)
|
||||
{
|
||||
this.setDead();
|
||||
this.killMissile();
|
||||
}
|
||||
}
|
||||
public boolean canBeCollidedWith() {
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private void killMissile() {
|
||||
ExplosionLarge.explode(worldObj, posX, posY, posZ, 5, true, false, true);
|
||||
ExplosionLarge.spawnShrapnelShower(worldObj, posX, posY, posZ, motionX, motionY, motionZ, 15, 0.075);
|
||||
ExplosionLarge.spawnMissileDebris(worldObj, posX, posY, posZ, motionX, motionY, motionZ, 0.25, getDebris(), getDebrisRareDrop());
|
||||
}
|
||||
public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_) {
|
||||
if(this.isEntityInvulnerable()) {
|
||||
return false;
|
||||
} else {
|
||||
if(!this.isDead && !this.worldObj.isRemote) {
|
||||
health -= p_70097_2_;
|
||||
|
||||
if(this.health <= 0) {
|
||||
this.setDead();
|
||||
this.killMissile();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private void killMissile() {
|
||||
ExplosionLarge.explode(worldObj, posX, posY, posZ, 5, true, false, true);
|
||||
ExplosionLarge.spawnShrapnelShower(worldObj, posX, posY, posZ, motionX, motionY, motionZ, 15, 0.075);
|
||||
ExplosionLarge.spawnMissileDebris(worldObj, posX, posY, posZ, motionX, motionY, motionZ, 0.25, getDebris(), getDebrisRareDrop());
|
||||
}
|
||||
|
||||
public EntityMissileBaseAdvanced(World world, float x, float y, float z, int a, int b) {
|
||||
super(world);
|
||||
this.ignoreFrustumCheck = true;
|
||||
/*this.posX = x;
|
||||
this.posY = y;
|
||||
this.posZ = z;*/
|
||||
this.setLocationAndAngles(x, y, z, 0, 0);
|
||||
startX = (int) x;
|
||||
startZ = (int) z;
|
||||
@ -95,19 +85,19 @@ public abstract class EntityMissileBaseAdvanced extends Entity implements IChunk
|
||||
targetZ = b;
|
||||
this.motionY = 2;
|
||||
|
||||
Vec3 vector = Vec3.createVectorHelper(targetX - startX, 0, targetZ - startZ);
|
||||
accelXZ = decelY = 1/vector.lengthVector();
|
||||
Vec3 vector = Vec3.createVectorHelper(targetX - startX, 0, targetZ - startZ);
|
||||
accelXZ = decelY = 1 / vector.lengthVector();
|
||||
decelY *= 2;
|
||||
|
||||
|
||||
velocity = 1;
|
||||
|
||||
this.setSize(1.5F, 1.5F);
|
||||
this.setSize(1.5F, 1.5F);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
init(ForgeChunkManager.requestTicket(MainRegistry.instance, worldObj, Type.ENTITY));
|
||||
this.dataWatcher.addObject(8, Integer.valueOf(this.health));
|
||||
this.dataWatcher.addObject(8, Integer.valueOf(this.health));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -212,7 +202,6 @@ public abstract class EntityMissileBaseAdvanced extends Entity implements IChunk
|
||||
}
|
||||
|
||||
if(!this.worldObj.isRemote)
|
||||
//this.worldObj.spawnEntityInWorld(new EntitySmokeFX(this.worldObj, this.posX, this.posY, this.posZ, 0.0, 0.0, 0.0));
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacket(posX, posY, posZ, 2),
|
||||
new TargetPoint(worldObj.provider.dimensionId, posX, posY, posZ, 300));
|
||||
|
||||
@ -220,30 +209,28 @@ public abstract class EntityMissileBaseAdvanced extends Entity implements IChunk
|
||||
this.worldObj.getBlock((int)this.posX, (int)this.posY, (int)this.posZ) != Blocks.water &&
|
||||
this.worldObj.getBlock((int)this.posX, (int)this.posY, (int)this.posZ) != Blocks.flowing_water) {
|
||||
|
||||
if(!this.worldObj.isRemote)
|
||||
{
|
||||
onImpact();
|
||||
}
|
||||
this.setDead();
|
||||
return;
|
||||
}
|
||||
|
||||
loadNeighboringChunks((int)(posX / 16), (int)(posZ / 16));
|
||||
|
||||
if(motionY < -1 && this.isCluster && !worldObj.isRemote) {
|
||||
cluster();
|
||||
this.setDead();
|
||||
return;
|
||||
}
|
||||
if(!this.worldObj.isRemote) {
|
||||
onImpact();
|
||||
}
|
||||
this.killAndClear();
|
||||
return;
|
||||
}
|
||||
|
||||
loadNeighboringChunks((int) (posX / 16), (int) (posZ / 16));
|
||||
|
||||
if(motionY < -1 && this.isCluster && !worldObj.isRemote) {
|
||||
cluster();
|
||||
this.setDead();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean isInRangeToRenderDist(double distance)
|
||||
{
|
||||
return distance < 500000;
|
||||
}
|
||||
public boolean isInRangeToRenderDist(double distance) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public abstract void onImpact();
|
||||
|
||||
@ -272,30 +259,31 @@ public abstract class EntityMissileBaseAdvanced extends Entity implements IChunk
|
||||
|
||||
List<ChunkCoordIntPair> loadedChunks = new ArrayList<ChunkCoordIntPair>();
|
||||
|
||||
public void loadNeighboringChunks(int newChunkX, int newChunkZ)
|
||||
{
|
||||
if(!worldObj.isRemote && loaderTicket != null)
|
||||
{
|
||||
for(ChunkCoordIntPair chunk : loadedChunks)
|
||||
{
|
||||
ForgeChunkManager.unforceChunk(loaderTicket, chunk);
|
||||
}
|
||||
public void loadNeighboringChunks(int newChunkX, int newChunkZ) {
|
||||
if(!worldObj.isRemote && loaderTicket != null) {
|
||||
|
||||
clearChunkLoader();
|
||||
|
||||
loadedChunks.clear();
|
||||
loadedChunks.add(new ChunkCoordIntPair(newChunkX, newChunkZ));
|
||||
loadedChunks.add(new ChunkCoordIntPair(newChunkX + 1, newChunkZ + 1));
|
||||
loadedChunks.add(new ChunkCoordIntPair(newChunkX - 1, newChunkZ - 1));
|
||||
loadedChunks.add(new ChunkCoordIntPair(newChunkX + 1, newChunkZ - 1));
|
||||
loadedChunks.add(new ChunkCoordIntPair(newChunkX - 1, newChunkZ + 1));
|
||||
loadedChunks.add(new ChunkCoordIntPair(newChunkX + 1, newChunkZ));
|
||||
loadedChunks.add(new ChunkCoordIntPair(newChunkX, newChunkZ + 1));
|
||||
loadedChunks.add(new ChunkCoordIntPair(newChunkX - 1, newChunkZ));
|
||||
loadedChunks.add(new ChunkCoordIntPair(newChunkX, newChunkZ - 1));
|
||||
loadedChunks.clear();
|
||||
loadedChunks.add(new ChunkCoordIntPair(newChunkX, newChunkZ));
|
||||
loadedChunks.add(new ChunkCoordIntPair(newChunkX + (int) Math.ceil((this.posX + this.motionX) / 16D), newChunkZ + (int) Math.ceil((this.posZ + this.motionZ) / 16D)));
|
||||
|
||||
for(ChunkCoordIntPair chunk : loadedChunks)
|
||||
{
|
||||
ForgeChunkManager.forceChunk(loaderTicket, chunk);
|
||||
}
|
||||
}
|
||||
}
|
||||
for(ChunkCoordIntPair chunk : loadedChunks) {
|
||||
ForgeChunkManager.forceChunk(loaderTicket, chunk);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void killAndClear() {
|
||||
this.setDead();
|
||||
this.clearChunkLoader();
|
||||
}
|
||||
|
||||
public void clearChunkLoader() {
|
||||
if(!worldObj.isRemote && loaderTicket != null) {
|
||||
for(ChunkCoordIntPair chunk : loadedChunks) {
|
||||
ForgeChunkManager.unforceChunk(loaderTicket, chunk);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@ import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.config.MobConfig;
|
||||
import com.hbm.entity.mob.ai.EntityAIBreaking;
|
||||
import com.hbm.entity.mob.ai.EntityAI_MLPF;
|
||||
import com.hbm.entity.pathfinder.PathFinderUtils;
|
||||
import com.hbm.entity.projectile.EntityBullet;
|
||||
import com.hbm.items.ModItems;
|
||||
|
||||
@ -50,7 +51,7 @@ public class EntityFBI extends EntityMob implements IRangedAttackMob {
|
||||
this.tasks.addTask(2, new EntityAIArrowAttack(this, 1D, 20, 25, 15.0F));
|
||||
this.tasks.addTask(3, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, true));
|
||||
this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 1.0D));
|
||||
this.tasks.addTask(6, new EntityAI_MLPF(this, EntityPlayer.class, 100, 1D, 16));
|
||||
//this.tasks.addTask(6, new EntityAI_MLPF(this, EntityPlayer.class, 100, 1D, 16));
|
||||
this.tasks.addTask(7, new EntityAIWander(this, 1.0D));
|
||||
this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
|
||||
this.tasks.addTask(8, new EntityAILookIdle(this));
|
||||
@ -119,6 +120,20 @@ public class EntityFBI extends EntityMob implements IRangedAttackMob {
|
||||
protected boolean isAIEnabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateAITasks() {
|
||||
super.updateAITasks();
|
||||
|
||||
if(this.getAttackTarget() == null) {
|
||||
this.setAttackTarget(this.worldObj.getClosestVulnerablePlayerToEntity(this, 128.0D));
|
||||
}
|
||||
|
||||
// hell yeah!!
|
||||
if(this.getAttackTarget() != null) {
|
||||
this.getNavigator().setPath(PathFinderUtils.getPathEntityToEntityPartial(worldObj, this, this.getAttackTarget(), 16F, true, false, false, true), 1);
|
||||
}
|
||||
}
|
||||
|
||||
//combat vest = full diamond set
|
||||
public int getTotalArmorValue() {
|
||||
|
||||
64
src/main/java/com/hbm/entity/mob/EntityFBIDrone.java
Normal file
64
src/main/java/com/hbm/entity/mob/EntityFBIDrone.java
Normal file
@ -0,0 +1,64 @@
|
||||
package com.hbm.entity.mob;
|
||||
|
||||
import com.hbm.entity.grenade.EntityGrenadeStrong;
|
||||
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityFBIDrone extends EntityUFOBase {
|
||||
|
||||
private int attackCooldown;
|
||||
|
||||
public EntityFBIDrone(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateEntityActionState() {
|
||||
super.updateEntityActionState();
|
||||
if(this.courseChangeCooldown > 0) this.courseChangeCooldown--;
|
||||
if(this.scanCooldown > 0) this.scanCooldown--;
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
if(attackCooldown > 0) attackCooldown--;
|
||||
|
||||
if(this.target != null && attackCooldown <= 0) {
|
||||
|
||||
Vec3 vec = Vec3.createVectorHelper(posX - target.posX, posY - target.posY, posZ - target.posZ);
|
||||
if(Math.abs(vec.xCoord) < 5 && Math.abs(vec.zCoord) < 5 && vec.yCoord > 3) {
|
||||
attackCooldown = 60;
|
||||
EntityGrenadeStrong grenade = new EntityGrenadeStrong(worldObj);
|
||||
grenade.setPosition(posX, posY, posZ);
|
||||
worldObj.spawnEntityInWorld(grenade);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(this.courseChangeCooldown > 0) {
|
||||
approachPosition(this.target == null ? 0.25D : 0.5D);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyEntityAttributes() {
|
||||
super.applyEntityAttributes();
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(35.0D);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getScanRange() {
|
||||
return 100;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int targetHeightOffset() {
|
||||
return 7 + rand.nextInt(4);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int wanderHeightOffset() {
|
||||
return 7 + rand.nextInt(4);
|
||||
}
|
||||
}
|
||||
228
src/main/java/com/hbm/entity/mob/EntityGlyphid.java
Normal file
228
src/main/java/com/hbm/entity/mob/EntityGlyphid.java
Normal file
@ -0,0 +1,228 @@
|
||||
package com.hbm.entity.mob;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.entity.pathfinder.PathFinderUtils;
|
||||
import com.hbm.main.ResourceManager;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EnumCreatureAttribute;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.monster.EntityMob;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityGlyphid extends EntityMob {
|
||||
|
||||
public EntityGlyphid(World world) {
|
||||
super(world);
|
||||
/*this.tasks.addTask(0, new EntityAISwimming(this));
|
||||
this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, false));
|
||||
this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 1.0D));
|
||||
this.tasks.addTask(7, new EntityAIWander(this, 1.0D));
|
||||
this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
|
||||
this.tasks.addTask(8, new EntityAILookIdle(this));
|
||||
this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true));
|
||||
this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true));*/
|
||||
this.setSize(1.75F, 1F);
|
||||
}
|
||||
|
||||
public ResourceLocation getSkin() {
|
||||
return ResourceManager.glyphid_tex;
|
||||
}
|
||||
|
||||
public double getScale() {
|
||||
return 1.0D;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
super.entityInit();
|
||||
this.dataWatcher.addObject(16, new Byte((byte) 0)); //wall climbing
|
||||
this.dataWatcher.addObject(17, new Byte((byte) 0b11111)); //armor
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyEntityAttributes() {
|
||||
super.applyEntityAttributes();
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(30D);
|
||||
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1D);
|
||||
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(5D);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Entity findPlayerToAttack() {
|
||||
EntityPlayer entityplayer = this.worldObj.getClosestVulnerablePlayerToEntity(this, 128.0D);
|
||||
return entityplayer != null && this.canEntityBeSeen(entityplayer) ? entityplayer : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateEntityActionState() {
|
||||
super.updateEntityActionState();
|
||||
|
||||
// hell yeah!!
|
||||
if(this.entityToAttack != null && !this.hasPath()) {
|
||||
this.setPathToEntity(PathFinderUtils.getPathEntityToEntityPartial(worldObj, this, this.entityToAttack, 16F, true, false, false, true));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canDespawn() {
|
||||
return entityToAttack == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attackEntityFrom(DamageSource source, float amount) {
|
||||
|
||||
if(!source.isDamageAbsolute() && !source.isUnblockable() && !worldObj.isRemote) {
|
||||
byte armor = this.dataWatcher.getWatchableObjectByte(17);
|
||||
|
||||
if(armor != 0) { //if at least one bit of armor is present
|
||||
|
||||
if(amount < getDamageThreshold()) return false;
|
||||
|
||||
int chance = getArmorBreakChance(amount); //chances of armor being broken off
|
||||
if(this.rand.nextInt(chance) == 0 && amount > 1) {
|
||||
breakOffArmor();
|
||||
amount = 0;
|
||||
}
|
||||
|
||||
amount -= getDamageThreshold();
|
||||
if(amount < 0) return true;
|
||||
}
|
||||
|
||||
amount = this.calculateDamage(amount);
|
||||
}
|
||||
|
||||
return super.attackEntityFrom(source, amount);
|
||||
}
|
||||
|
||||
public int getArmorBreakChance(float amount) {
|
||||
return amount < 10 ? 5 : amount < 20 ? 3 : 2;
|
||||
}
|
||||
|
||||
public float calculateDamage(float amount) {
|
||||
|
||||
byte armor = this.dataWatcher.getWatchableObjectByte(17);
|
||||
int divisor = 1;
|
||||
|
||||
for(int i = 0; i < 5; i++) {
|
||||
if((armor & (1 << i)) > 0) {
|
||||
divisor++;
|
||||
}
|
||||
}
|
||||
|
||||
amount /= divisor;
|
||||
|
||||
return amount;
|
||||
}
|
||||
|
||||
public float getDamageThreshold() {
|
||||
return 0.5F;
|
||||
}
|
||||
|
||||
public void breakOffArmor() {
|
||||
byte armor = this.dataWatcher.getWatchableObjectByte(17);
|
||||
List<Integer> indices = Arrays.asList(0, 1, 2, 3, 4);
|
||||
Collections.shuffle(indices);
|
||||
|
||||
for(Integer i : indices) {
|
||||
byte bit = (byte) (1 << i);
|
||||
if((armor & bit) > 0) {
|
||||
armor &= ~bit;
|
||||
armor = (byte) (armor & 0b11111);
|
||||
this.dataWatcher.updateObject(17, armor);
|
||||
worldObj.playSoundAtEntity(this, "mob.zombie.woodbreak", 1.0F, 1.25F);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attackEntityAsMob(Entity victum) {
|
||||
if(this.isSwingInProgress) return false;
|
||||
this.swingItem();
|
||||
return super.attackEntityAsMob(victum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
|
||||
if(!this.worldObj.isRemote) {
|
||||
this.setBesideClimbableBlock(this.isCollidedHorizontally);
|
||||
|
||||
if(worldObj.getTotalWorldTime() % 200 == 0) {
|
||||
this.swingItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateArmSwingProgress() {
|
||||
int i = this.swingDuration();
|
||||
|
||||
if(this.isSwingInProgress) {
|
||||
++this.swingProgressInt;
|
||||
|
||||
if(this.swingProgressInt >= i) {
|
||||
this.swingProgressInt = 0;
|
||||
this.isSwingInProgress = false;
|
||||
}
|
||||
} else {
|
||||
this.swingProgressInt = 0;
|
||||
}
|
||||
|
||||
this.swingProgress = (float) this.swingProgressInt / (float) i;
|
||||
}
|
||||
|
||||
public int swingDuration() {
|
||||
return 15;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInWeb() { }
|
||||
|
||||
@Override
|
||||
public boolean isOnLadder() {
|
||||
return this.isBesideClimbableBlock();
|
||||
}
|
||||
|
||||
public boolean isBesideClimbableBlock() {
|
||||
return (this.dataWatcher.getWatchableObjectByte(16) & 1) != 0;
|
||||
}
|
||||
|
||||
public void setBesideClimbableBlock(boolean climbable) {
|
||||
byte watchable = this.dataWatcher.getWatchableObjectByte(16);
|
||||
|
||||
if(climbable) {
|
||||
watchable = (byte) (watchable | 1);
|
||||
} else {
|
||||
watchable &= -2;
|
||||
}
|
||||
|
||||
this.dataWatcher.updateObject(16, Byte.valueOf(watchable));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumCreatureAttribute getCreatureAttribute() {
|
||||
return EnumCreatureAttribute.ARTHROPOD;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeEntityToNBT(NBTTagCompound nbt) {
|
||||
super.writeEntityToNBT(nbt);
|
||||
nbt.setByte("armor", this.dataWatcher.getWatchableObjectByte(17));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readEntityFromNBT(NBTTagCompound nbt) {
|
||||
super.readEntityFromNBT(nbt);
|
||||
this.dataWatcher.updateObject(17, nbt.getByte("armor"));
|
||||
}
|
||||
}
|
||||
60
src/main/java/com/hbm/entity/mob/EntityGlyphidBehemoth.java
Normal file
60
src/main/java/com/hbm/entity/mob/EntityGlyphidBehemoth.java
Normal file
@ -0,0 +1,60 @@
|
||||
package com.hbm.entity.mob;
|
||||
|
||||
import com.hbm.main.ResourceManager;
|
||||
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityGlyphidBehemoth extends EntityGlyphid {
|
||||
|
||||
public EntityGlyphidBehemoth(World world) {
|
||||
super(world);
|
||||
this.setSize(2.25F, 1.25F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getSkin() {
|
||||
return ResourceManager.glyphid_behemoth_tex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getScale() {
|
||||
return 1.5D;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyEntityAttributes() {
|
||||
super.applyEntityAttributes();
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(100D);
|
||||
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.8D);
|
||||
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(25D);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getArmorBreakChance(float amount) {
|
||||
return amount < 20 ? 10 : amount < 100 ? 5 : amount > 200 ? 1 : 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float calculateDamage(float amount) {
|
||||
|
||||
byte armor = this.dataWatcher.getWatchableObjectByte(17);
|
||||
int divisor = 1;
|
||||
|
||||
for(int i = 0; i < 5; i++) {
|
||||
if((armor & (1 << i)) > 0) {
|
||||
divisor += 3;
|
||||
}
|
||||
}
|
||||
|
||||
amount /= divisor;
|
||||
|
||||
return amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDamageThreshold() {
|
||||
return 2.5F;
|
||||
}
|
||||
}
|
||||
80
src/main/java/com/hbm/entity/mob/EntityGlyphidBlaster.java
Normal file
80
src/main/java/com/hbm/entity/mob/EntityGlyphidBlaster.java
Normal file
@ -0,0 +1,80 @@
|
||||
package com.hbm.entity.mob;
|
||||
|
||||
import com.hbm.main.ResourceManager;
|
||||
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityGlyphidBlaster extends EntityGlyphidBombardier {
|
||||
|
||||
public EntityGlyphidBlaster(World world) {
|
||||
super(world);
|
||||
this.setSize(2F, 1.125F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getSkin() {
|
||||
return ResourceManager.glyphid_blaster_tex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getScale() {
|
||||
return 1.25D;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyEntityAttributes() {
|
||||
super.applyEntityAttributes();
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(50D);
|
||||
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1D);
|
||||
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(10D);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getArmorBreakChance(float amount) {
|
||||
return amount < 10 ? 10 : amount < 25 ? 5 : amount > 100 ? 1 : 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float calculateDamage(float amount) {
|
||||
|
||||
byte armor = this.dataWatcher.getWatchableObjectByte(17);
|
||||
int divisor = 1;
|
||||
|
||||
for(int i = 0; i < 5; i++) {
|
||||
if((armor & (1 << i)) > 0) {
|
||||
divisor += 2;
|
||||
}
|
||||
}
|
||||
|
||||
amount /= divisor;
|
||||
|
||||
return amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDamageThreshold() {
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getBombDamage() {
|
||||
return 10F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBombCount() {
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getSpreadMult() {
|
||||
return 0.75F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getV0() {
|
||||
return 1.25D;
|
||||
}
|
||||
}
|
||||
101
src/main/java/com/hbm/entity/mob/EntityGlyphidBombardier.java
Normal file
101
src/main/java/com/hbm/entity/mob/EntityGlyphidBombardier.java
Normal file
@ -0,0 +1,101 @@
|
||||
package com.hbm.entity.mob;
|
||||
|
||||
import com.hbm.entity.projectile.EntityAcidBomb;
|
||||
import com.hbm.main.ResourceManager;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityGlyphidBombardier extends EntityGlyphid {
|
||||
|
||||
public EntityGlyphidBombardier(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
public ResourceLocation getSkin() {
|
||||
return ResourceManager.glyphid_bombardier_tex;
|
||||
}
|
||||
|
||||
protected Entity lastTarget;
|
||||
protected double lastX;
|
||||
protected double lastY;
|
||||
protected double lastZ;
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
|
||||
if(!this.worldObj.isRemote) {
|
||||
|
||||
Entity e = this.getEntityToAttack();
|
||||
|
||||
if(this.ticksExisted % 20 == 0 && e != null) {
|
||||
this.lastTarget = e;
|
||||
this.lastX = e.posX;
|
||||
this.lastY = e.posY;
|
||||
this.lastZ = e.posZ;
|
||||
}
|
||||
|
||||
if(this.ticksExisted % 20 == 1 && e != null) {
|
||||
|
||||
boolean topAttack = rand.nextBoolean();
|
||||
|
||||
double velX = e.posX - lastX;
|
||||
double velY = e.posY - lastY;
|
||||
double velZ = e.posZ - lastZ;
|
||||
|
||||
if(this.lastTarget != e || Vec3.createVectorHelper(velX, velY, velZ).lengthVector() > 30) {
|
||||
velX = velY = velZ = 0;
|
||||
}
|
||||
|
||||
int prediction = topAttack ? 60 : 20;
|
||||
Vec3 delta = Vec3.createVectorHelper(e.posX - posX + velX * prediction, (e.posY + e.height / 2) - (posY + 1) + velY * prediction, e.posZ - posZ + velZ * prediction);
|
||||
double len = delta.lengthVector();
|
||||
if(len < 3) return;
|
||||
double targetYaw = -Math.atan2(delta.xCoord, delta.zCoord);
|
||||
|
||||
double x = Math.sqrt(delta.xCoord * delta.xCoord + delta.zCoord * delta.zCoord);
|
||||
double y = delta.yCoord;
|
||||
double v0 = getV0();
|
||||
double v02 = v0 * v0;
|
||||
double g = 0.04D;
|
||||
double upperLower = topAttack ? 1 : -1;
|
||||
double targetPitch = Math.atan((v02 + Math.sqrt(v02*v02 - g*(g*x*x + 2*y*v02)) * upperLower) / (g*x));
|
||||
|
||||
if(!Double.isNaN(targetPitch)) {
|
||||
|
||||
Vec3 fireVec = Vec3.createVectorHelper(v0, 0, 0);
|
||||
fireVec.rotateAroundZ((float) -targetPitch);
|
||||
fireVec.rotateAroundY((float) -(targetYaw + Math.PI * 0.5));
|
||||
|
||||
for(int i = 0; i < getBombCount(); i++) {
|
||||
EntityAcidBomb bomb = new EntityAcidBomb(worldObj, posX, posY + 1, posZ);
|
||||
bomb.setThrowableHeading(fireVec.xCoord, fireVec.yCoord, fireVec.zCoord, (float) v0, i * getSpreadMult());
|
||||
bomb.damage = getBombDamage();
|
||||
worldObj.spawnEntityInWorld(bomb);
|
||||
}
|
||||
|
||||
this.swingItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public float getBombDamage() {
|
||||
return 1.5F;
|
||||
}
|
||||
|
||||
public int getBombCount() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
public float getSpreadMult() {
|
||||
return 1F;
|
||||
}
|
||||
|
||||
public double getV0() {
|
||||
return 1D;
|
||||
}
|
||||
}
|
||||
60
src/main/java/com/hbm/entity/mob/EntityGlyphidBrawler.java
Normal file
60
src/main/java/com/hbm/entity/mob/EntityGlyphidBrawler.java
Normal file
@ -0,0 +1,60 @@
|
||||
package com.hbm.entity.mob;
|
||||
|
||||
import com.hbm.main.ResourceManager;
|
||||
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityGlyphidBrawler extends EntityGlyphid {
|
||||
|
||||
public EntityGlyphidBrawler(World world) {
|
||||
super(world);
|
||||
this.setSize(2F, 1.125F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getSkin() {
|
||||
return ResourceManager.glyphid_brawler_tex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getScale() {
|
||||
return 1.25D;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyEntityAttributes() {
|
||||
super.applyEntityAttributes();
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(50D);
|
||||
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1D);
|
||||
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(10D);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getArmorBreakChance(float amount) {
|
||||
return amount < 10 ? 10 : amount < 25 ? 5 : amount > 100 ? 1 : 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float calculateDamage(float amount) {
|
||||
|
||||
byte armor = this.dataWatcher.getWatchableObjectByte(17);
|
||||
int divisor = 1;
|
||||
|
||||
for(int i = 0; i < 5; i++) {
|
||||
if((armor & (1 << i)) > 0) {
|
||||
divisor += 2;
|
||||
}
|
||||
}
|
||||
|
||||
amount /= divisor;
|
||||
|
||||
return amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDamageThreshold() {
|
||||
return 1.0F;
|
||||
}
|
||||
}
|
||||
81
src/main/java/com/hbm/entity/mob/EntityGlyphidBrenda.java
Normal file
81
src/main/java/com/hbm/entity/mob/EntityGlyphidBrenda.java
Normal file
@ -0,0 +1,81 @@
|
||||
package com.hbm.entity.mob;
|
||||
|
||||
import com.hbm.main.ResourceManager;
|
||||
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityGlyphidBrenda extends EntityGlyphid {
|
||||
|
||||
public EntityGlyphidBrenda(World world) {
|
||||
super(world);
|
||||
this.setSize(2.5F, 1.75F);
|
||||
this.isImmuneToFire = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getSkin() {
|
||||
return ResourceManager.glyphid_brenda_tex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getScale() {
|
||||
return 2D;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyEntityAttributes() {
|
||||
super.applyEntityAttributes();
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(250D);
|
||||
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.8D);
|
||||
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(50D);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getArmorBreakChance(float amount) {
|
||||
return amount < 25 ? 100 : amount > 1000 ? 1 : 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float calculateDamage(float amount) {
|
||||
|
||||
byte armor = this.dataWatcher.getWatchableObjectByte(17);
|
||||
int divisor = 1;
|
||||
|
||||
for(int i = 0; i < 5; i++) {
|
||||
if((armor & (1 << i)) > 0) {
|
||||
divisor += 5;
|
||||
}
|
||||
}
|
||||
|
||||
amount /= divisor;
|
||||
|
||||
return amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDamageThreshold() {
|
||||
return 10F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDead() {
|
||||
if(!this.worldObj.isRemote && this.getHealth() <= 0.0F) {
|
||||
for(int i = 0; i < 12; ++i) {
|
||||
EntityGlyphid glyphid = new EntityGlyphid(worldObj);
|
||||
glyphid.setLocationAndAngles(this.posX, this.posY + 0.5D, this.posZ, rand.nextFloat() * 360.0F, 0.0F);
|
||||
glyphid.addPotionEffect(new PotionEffect(Potion.resistance.id, 5 * 60 * 20, 2));
|
||||
glyphid.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 5 * 60 * 20, 0));
|
||||
glyphid.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 5 * 60 * 20, 4));
|
||||
glyphid.addPotionEffect(new PotionEffect(Potion.field_76444_x.id, 5 * 60 * 20, 19));
|
||||
this.worldObj.spawnEntityInWorld(glyphid);
|
||||
glyphid.moveEntity(rand.nextGaussian(), 0, rand.nextGaussian());
|
||||
}
|
||||
}
|
||||
|
||||
super.setDead();
|
||||
}
|
||||
}
|
||||
108
src/main/java/com/hbm/entity/mob/EntityGlyphidNuclear.java
Normal file
108
src/main/java/com/hbm/entity/mob/EntityGlyphidNuclear.java
Normal file
@ -0,0 +1,108 @@
|
||||
package com.hbm.entity.mob;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.explosion.vanillant.ExplosionVNT;
|
||||
import com.hbm.explosion.vanillant.standard.BlockAllocatorStandard;
|
||||
import com.hbm.explosion.vanillant.standard.BlockMutatorDebris;
|
||||
import com.hbm.explosion.vanillant.standard.BlockProcessorStandard;
|
||||
import com.hbm.explosion.vanillant.standard.EntityProcessorStandard;
|
||||
import com.hbm.explosion.vanillant.standard.PlayerProcessorStandard;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.packet.AuxParticlePacketNT;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityGlyphidNuclear extends EntityGlyphid {
|
||||
|
||||
public int deathTicks;
|
||||
|
||||
public EntityGlyphidNuclear(World world) {
|
||||
super(world);
|
||||
this.setSize(2.5F, 1.75F);
|
||||
this.isImmuneToFire = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getSkin() {
|
||||
return ResourceManager.glyphid_nuclear_tex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getScale() {
|
||||
return 2D;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyEntityAttributes() {
|
||||
super.applyEntityAttributes();
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20D);
|
||||
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.8D);
|
||||
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(50D);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getArmorBreakChance(float amount) {
|
||||
return amount < 25 ? 100 : amount > 1000 ? 1 : 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float calculateDamage(float amount) {
|
||||
|
||||
byte armor = this.dataWatcher.getWatchableObjectByte(17);
|
||||
int divisor = 1;
|
||||
|
||||
for(int i = 0; i < 5; i++) {
|
||||
if((armor & (1 << i)) > 0) {
|
||||
divisor += 5;
|
||||
}
|
||||
}
|
||||
|
||||
amount /= divisor;
|
||||
|
||||
return amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDamageThreshold() {
|
||||
return 10F;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDeathUpdate() {
|
||||
++this.deathTicks;
|
||||
|
||||
if(this.deathTicks == 100) {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
ExplosionVNT vnt = new ExplosionVNT(worldObj, posX, posY, posZ, 25, this);
|
||||
vnt.setBlockAllocator(new BlockAllocatorStandard(24));
|
||||
vnt.setBlockProcessor(new BlockProcessorStandard().withBlockEffect(new BlockMutatorDebris(ModBlocks.volcanic_lava_block, 0)).setNoDrop());
|
||||
vnt.setEntityProcessor(new EntityProcessorStandard().withRangeMod(1.5F));
|
||||
vnt.setPlayerProcessor(new PlayerProcessorStandard());
|
||||
vnt.explode();
|
||||
|
||||
worldObj.playSoundEffect(posX, posY, posZ, "hbm:weapon.mukeExplosion", 15.0F, 1.0F);
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "muke");
|
||||
// if the FX type is "muke", apply random BF effect
|
||||
if(MainRegistry.polaroidID == 11 || rand.nextInt(100) == 0) {
|
||||
data.setBoolean("balefire", true);
|
||||
}
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, posX, posY + 0.5, posZ), new TargetPoint(dimension, posX, posY, posZ, 250));
|
||||
}
|
||||
|
||||
this.setDead();
|
||||
} else {
|
||||
if(!worldObj.isRemote && this.deathTicks % 10 == 0) {
|
||||
worldObj.playSoundEffect(posX, posY, posZ, "hbm:weapon.fstbmbPing", 5.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
157
src/main/java/com/hbm/entity/mob/EntityGlyphidScout.java
Normal file
157
src/main/java/com/hbm/entity/mob/EntityGlyphidScout.java
Normal file
@ -0,0 +1,157 @@
|
||||
package com.hbm.entity.mob;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.world.feature.GlyphidHive;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityGlyphidScout extends EntityGlyphid {
|
||||
|
||||
public boolean hasHome = false;
|
||||
public double homeX;
|
||||
public double homeY;
|
||||
public double homeZ;
|
||||
|
||||
public EntityGlyphidScout(World world) {
|
||||
super(world);
|
||||
this.setSize(1.25F, 0.75F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDamageThreshold() {
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getSkin() {
|
||||
return ResourceManager.glyphid_scout_tex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getScale() {
|
||||
return 0.75D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getArmorBreakChance(float amount) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyEntityAttributes() {
|
||||
super.applyEntityAttributes();
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(16D);
|
||||
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.5D);
|
||||
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(2D);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canDespawn() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
if(!this.hasHome) {
|
||||
this.homeX = posX;
|
||||
this.homeY = posY;
|
||||
this.homeZ = posZ;
|
||||
this.hasHome = true;
|
||||
}
|
||||
|
||||
if(rand.nextInt(20) == 0) fleeingTick = 2;
|
||||
|
||||
if(this.ticksExisted > 0 && this.ticksExisted % 1200 == 0 && Vec3.createVectorHelper(posX - homeX, posY - homeY, posZ - homeZ).lengthVector() > 8) {
|
||||
|
||||
Block b = worldObj.getBlock((int) Math.floor(posX), (int) Math.floor(posY - 1), (int) Math.floor(posZ));
|
||||
|
||||
int accuracy = 16;
|
||||
for(int i = 0; i < accuracy; i++) {
|
||||
float angle = (float) Math.toRadians(360D / accuracy * i);
|
||||
Vec3 rot = Vec3.createVectorHelper(0, 0, 16);
|
||||
rot.rotateAroundY(angle);
|
||||
Vec3 pos = Vec3.createVectorHelper(this.posX, this.posY + 1, this.posZ);
|
||||
Vec3 nextPos = Vec3.createVectorHelper(this.posX + rot.xCoord, this.posY + 1, this.posZ + rot.zCoord);
|
||||
MovingObjectPosition mop = this.worldObj.rayTraceBlocks(pos, nextPos);
|
||||
|
||||
if(mop != null && mop.typeOfHit == mop.typeOfHit.BLOCK) {
|
||||
|
||||
Block block = worldObj.getBlock(mop.blockX, mop.blockY, mop.blockZ);
|
||||
|
||||
if(block == ModBlocks.glyphid_base) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(b.getMaterial() != Material.air && b.isNormalCube() && b != ModBlocks.glyphid_base) {
|
||||
this.setDead();
|
||||
worldObj.newExplosion(this, posX, posY, posZ, 5F, false, false);
|
||||
GlyphidHive.generate(worldObj, (int) Math.floor(posX), (int) Math.floor(posY), (int) Math.floor(posZ), rand);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateWanderPath() {
|
||||
this.worldObj.theProfiler.startSection("stroll");
|
||||
boolean flag = false;
|
||||
int pathX = -1;
|
||||
int pathY = -1;
|
||||
int pathZ = -1;
|
||||
float maxWeight = -99999.0F;
|
||||
|
||||
for(int l = 0; l < 5; ++l) {
|
||||
int x = MathHelper.floor_double(this.posX + (double) this.rand.nextInt(25) - 12.0D);
|
||||
int y = MathHelper.floor_double(this.posY + (double) this.rand.nextInt(11) - 5.0D);
|
||||
int z = MathHelper.floor_double(this.posZ + (double) this.rand.nextInt(25) - 12.0D);
|
||||
float weight = this.getBlockPathWeight(x, y, z);
|
||||
|
||||
if(weight > maxWeight) {
|
||||
maxWeight = weight;
|
||||
pathX = x;
|
||||
pathY = y;
|
||||
pathZ = z;
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(flag) {
|
||||
this.setPathToEntity(this.worldObj.getEntityPathToXYZ(this, pathX, pathY, pathZ, 10.0F, true, false, false, true));
|
||||
}
|
||||
|
||||
this.worldObj.theProfiler.endSection();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeEntityToNBT(NBTTagCompound nbt) {
|
||||
super.writeEntityToNBT(nbt);
|
||||
nbt.setBoolean("hasHome", hasHome);
|
||||
nbt.setDouble("homeX", homeX);
|
||||
nbt.setDouble("homeY", homeY);
|
||||
nbt.setDouble("homeZ", homeZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readEntityFromNBT(NBTTagCompound nbt) {
|
||||
super.readEntityFromNBT(nbt);
|
||||
this.hasHome = nbt.getBoolean("hasHome");
|
||||
this.homeX = nbt.getDouble("homeX");
|
||||
this.homeY = nbt.getDouble("homeY");
|
||||
this.homeZ = nbt.getDouble("homeZ");
|
||||
}
|
||||
}
|
||||
@ -18,8 +18,8 @@ public abstract class EntityUFOBase extends EntityFlying implements IMob {
|
||||
protected int courseChangeCooldown;
|
||||
protected Entity target;
|
||||
|
||||
public EntityUFOBase(World p_i1587_1_) {
|
||||
super(p_i1587_1_);
|
||||
public EntityUFOBase(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
62
src/main/java/com/hbm/entity/pathfinder/PathFinderUtils.java
Normal file
62
src/main/java/com/hbm/entity/pathfinder/PathFinderUtils.java
Normal file
@ -0,0 +1,62 @@
|
||||
package com.hbm.entity.pathfinder;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.pathfinding.PathEntity;
|
||||
import net.minecraft.pathfinding.PathFinder;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.ChunkCache;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class PathFinderUtils {
|
||||
|
||||
public static PathEntity getPathEntityToEntityPartial(World world, Entity fromEntity, Entity toEntity, float maxDist, boolean allowDoors, boolean allowBlocked, boolean allowWater, boolean canDrown) {
|
||||
world.theProfiler.startSection("pathfind");
|
||||
int startX = MathHelper.floor_double(fromEntity.posX);
|
||||
int startY = MathHelper.floor_double(fromEntity.posY + 1.0D);
|
||||
int startZ = MathHelper.floor_double(fromEntity.posZ);
|
||||
int maxDistEff = (int) (maxDist + 16.0F);
|
||||
int minX = startX - maxDistEff;
|
||||
int minY = startY - maxDistEff;
|
||||
int minZ = startZ - maxDistEff;
|
||||
int maxX = startX + maxDistEff;
|
||||
int maxY = startY + maxDistEff;
|
||||
int maxZ = startZ + maxDistEff;
|
||||
ChunkCache chunkcache = new ChunkCache(world, minX, minY, minZ, maxX, maxY, maxZ, 0);
|
||||
|
||||
Vec3 vec = Vec3.createVectorHelper(toEntity.posX - fromEntity.posX, toEntity.posY - fromEntity.posY, toEntity.posZ - fromEntity.posZ);
|
||||
vec = vec.normalize();
|
||||
vec.xCoord *= maxDist;
|
||||
vec.yCoord *= maxDist;
|
||||
vec.zCoord *= maxDist;
|
||||
|
||||
int x = (int) Math.floor(fromEntity.posX + vec.xCoord);
|
||||
int y = (int) Math.floor(fromEntity.posY + vec.yCoord);
|
||||
int z = (int) Math.floor(fromEntity.posZ + vec.zCoord);
|
||||
|
||||
//this part will adjust the end of the path so it's actually on the ground, it being unreachable causes mobs to slow down
|
||||
boolean solid = false;
|
||||
|
||||
for(int i = y; i > y - 10; i--) {
|
||||
if(!world.getBlock(x, i, z).getMaterial().blocksMovement() && world.getBlock(x, i - 1, z).isNormalCube()) {
|
||||
solid = true;
|
||||
y = i;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(!solid) for(int i = y + 10; i > y; i--) {
|
||||
if(!world.getBlock(x, i, z).getMaterial().blocksMovement() && world.getBlock(x, i - 1, z).isNormalCube()) {
|
||||
solid = true;
|
||||
y = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//PathEntity pathentity = (new PathFinder(chunkcache, allowDoors, allowBlocked, allowWater, canDrown)).createEntityPathTo(fromEntity, toEntity, maxDist);
|
||||
PathEntity pathentity = (new PathFinder(chunkcache, allowDoors, allowBlocked, allowWater, canDrown)).createEntityPathTo(fromEntity, x, y, z, maxDist);
|
||||
world.theProfiler.endSection();
|
||||
return pathentity;
|
||||
}
|
||||
}
|
||||
60
src/main/java/com/hbm/entity/projectile/EntityAcidBomb.java
Normal file
60
src/main/java/com/hbm/entity/projectile/EntityAcidBomb.java
Normal file
@ -0,0 +1,60 @@
|
||||
package com.hbm.entity.projectile;
|
||||
|
||||
import com.hbm.entity.mob.EntityGlyphid;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityAcidBomb extends EntityThrowableInterp {
|
||||
|
||||
public float damage = 1.5F;
|
||||
|
||||
public EntityAcidBomb(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
public EntityAcidBomb(World world, double x, double y, double z) {
|
||||
super(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onImpact(MovingObjectPosition mop) {
|
||||
|
||||
if(worldObj.isRemote) return;
|
||||
|
||||
if(mop.typeOfHit == mop.typeOfHit.ENTITY) {
|
||||
|
||||
if(!(mop.entityHit instanceof EntityGlyphid)) {
|
||||
mop.entityHit.attackEntityFrom(ModDamageSource.acid, damage);
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
if(mop.typeOfHit == mop.typeOfHit.BLOCK)
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getGravityVelocity() {
|
||||
return 0.04D;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getAirDrag() {
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeEntityToNBT(NBTTagCompound nbt) {
|
||||
super.writeEntityToNBT(nbt);
|
||||
nbt.setFloat("damage", damage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readEntityFromNBT(NBTTagCompound nbt) {
|
||||
super.readEntityFromNBT(nbt);
|
||||
this.damage = nbt.getFloat("damage");
|
||||
}
|
||||
}
|
||||
@ -68,30 +68,6 @@ public class EntityRBMKDebris extends EntityDebrisBase {
|
||||
hasSizeSet = true;
|
||||
}
|
||||
|
||||
this.prevPosX = this.posX;
|
||||
this.prevPosY = this.posY;
|
||||
this.prevPosZ = this.posZ;
|
||||
|
||||
this.motionY -= 0.04D;
|
||||
this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
||||
|
||||
this.lastRot = this.rot;
|
||||
|
||||
if(this.onGround) {
|
||||
this.motionX *= 0.85D;
|
||||
this.motionZ *= 0.85D;
|
||||
this.motionY *= -0.5D;
|
||||
|
||||
} else {
|
||||
|
||||
this.rot += 10F;
|
||||
|
||||
if(rot >= 360F) {
|
||||
this.rot -= 360F;
|
||||
this.lastRot -= 360F;
|
||||
}
|
||||
}
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
if(this.getType() == DebrisType.LID && motionY > 0) {
|
||||
|
||||
@ -133,6 +109,30 @@ public class EntityRBMKDebris extends EntityDebrisBase {
|
||||
if(!RBMKDials.getPermaScrap(worldObj) && this.ticksExisted > getLifetime() + this.getEntityId() % 50)
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
this.prevPosX = this.posX;
|
||||
this.prevPosY = this.posY;
|
||||
this.prevPosZ = this.posZ;
|
||||
|
||||
this.motionY -= 0.04D;
|
||||
this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
||||
|
||||
this.lastRot = this.rot;
|
||||
|
||||
if(this.onGround) {
|
||||
this.motionX *= 0.85D;
|
||||
this.motionZ *= 0.85D;
|
||||
this.motionY *= -0.5D;
|
||||
|
||||
} else {
|
||||
|
||||
this.rot += 10F;
|
||||
|
||||
if(rot >= 360F) {
|
||||
this.rot -= 360F;
|
||||
this.lastRot -= 360F;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -7,6 +7,7 @@ import com.hbm.lib.ModDamageSource;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.projectile.EntityThrowable;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@ -106,4 +107,15 @@ public class EntityShrapnel extends EntityThrowable {
|
||||
public void setWatz(boolean b) {
|
||||
this.dataWatcher.updateObject(16, (byte) (b ? 3 : 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean writeToNBTOptional(NBTTagCompound nbt) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readEntityFromNBT(NBTTagCompound nbt) {
|
||||
super.readEntityFromNBT(nbt);
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,24 +9,21 @@ import net.minecraft.world.World;
|
||||
|
||||
public class EntityWaterSplash extends EntityThrowable {
|
||||
|
||||
public EntityWaterSplash(World p_i1773_1_)
|
||||
{
|
||||
super(p_i1773_1_);
|
||||
}
|
||||
public EntityWaterSplash(World p_i1773_1_) {
|
||||
super(p_i1773_1_);
|
||||
}
|
||||
|
||||
public EntityWaterSplash(World p_i1774_1_, EntityLivingBase p_i1774_2_)
|
||||
{
|
||||
super(p_i1774_1_, p_i1774_2_);
|
||||
}
|
||||
public EntityWaterSplash(World p_i1774_1_, EntityLivingBase p_i1774_2_) {
|
||||
super(p_i1774_1_, p_i1774_2_);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public void entityInit() {
|
||||
}
|
||||
}
|
||||
|
||||
public EntityWaterSplash(World p_i1775_1_, double p_i1775_2_, double p_i1775_4_, double p_i1775_6_)
|
||||
{
|
||||
super(p_i1775_1_, p_i1775_2_, p_i1775_4_, p_i1775_6_);
|
||||
}
|
||||
public EntityWaterSplash(World p_i1775_1_, double p_i1775_2_, double p_i1775_4_, double p_i1775_6_) {
|
||||
super(p_i1775_1_, p_i1775_2_, p_i1775_4_, p_i1775_6_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
@ -51,9 +48,12 @@ public class EntityWaterSplash extends EntityThrowable {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean writeToNBTOptional(NBTTagCompound nbt) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readEntityFromNBT(NBTTagCompound nbt) {
|
||||
super.readEntityFromNBT(nbt);
|
||||
this.setDead();
|
||||
|
||||
@ -1,34 +1,64 @@
|
||||
package com.hbm.entity.train;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.blocks.rail.IRailNTM;
|
||||
import com.hbm.blocks.rail.IRailNTM.MoveContext;
|
||||
import com.hbm.blocks.rail.IRailNTM.RailCheckType;
|
||||
import com.hbm.blocks.rail.IRailNTM.RailContext;
|
||||
import com.hbm.blocks.rail.IRailNTM.TrackGauge;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.packet.AuxParticlePacketNT;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.util.Tuple.Pair;
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||
|
||||
public abstract class EntityRailCarBase extends Entity {
|
||||
public abstract class EntityRailCarBase extends Entity implements ILookOverlay {
|
||||
|
||||
public LogicalTrainUnit ltu;
|
||||
public int ltuIndex = 0;
|
||||
public boolean isOnRail = true;
|
||||
private int turnProgress;
|
||||
/* Clientside position that should be approached with smooth interpolation */
|
||||
private double trainX;
|
||||
private double trainY;
|
||||
private double trainZ;
|
||||
private double trainYaw;
|
||||
private double trainPitch;
|
||||
private float movementYaw;
|
||||
private float movementPitch;
|
||||
@SideOnly(Side.CLIENT) private double velocityX;
|
||||
@SideOnly(Side.CLIENT) private double velocityY;
|
||||
@SideOnly(Side.CLIENT) private double velocityZ;
|
||||
/* "Actual" position with offset directly between the front and back pos, won't match the standard position on curves */
|
||||
public double lastRenderX;
|
||||
public double lastRenderY;
|
||||
public double lastRenderZ;
|
||||
public double renderX;
|
||||
public double renderY;
|
||||
public double renderZ;
|
||||
|
||||
public EntityRailCarBase coupledFront;
|
||||
public EntityRailCarBase coupledBack;
|
||||
|
||||
public boolean initDummies = false;
|
||||
public BoundingBoxDummyEntity[] dummies = new BoundingBoxDummyEntity[0];
|
||||
@ -41,20 +71,81 @@ public abstract class EntityRailCarBase extends Entity {
|
||||
@Override protected void readEntityFromNBT(NBTTagCompound nbt) { }
|
||||
@Override protected void writeEntityToNBT(NBTTagCompound nbt) { }
|
||||
|
||||
/*@Override
|
||||
public boolean canBePushed() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeCollidedWith() {
|
||||
return !this.isDead;
|
||||
}*/
|
||||
public boolean interactFirst(EntityPlayer player) {
|
||||
|
||||
if(player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.coupling_tool) {
|
||||
|
||||
List<EntityRailCarBase> intersecting = worldObj.getEntitiesWithinAABB(EntityRailCarBase.class, this.boundingBox.expand(2D, 0D, 2D));
|
||||
|
||||
for(EntityRailCarBase neighbor : intersecting) {
|
||||
if(neighbor == this) continue;
|
||||
if(neighbor.getGauge() != this.getGauge()) continue;
|
||||
|
||||
TrainCoupling closestOwnCoupling = null;
|
||||
TrainCoupling closestNeighborCoupling = null;
|
||||
double closestDist = Double.POSITIVE_INFINITY;
|
||||
|
||||
for(TrainCoupling ownCoupling : TrainCoupling.values()) {
|
||||
for(TrainCoupling neighborCoupling : TrainCoupling.values()) {
|
||||
Vec3 ownPos = this.getCouplingPos(ownCoupling);
|
||||
Vec3 neighborPos = neighbor.getCouplingPos(neighborCoupling);
|
||||
if(ownPos != null && neighborPos != null) {
|
||||
Vec3 delta = Vec3.createVectorHelper(ownPos.xCoord - neighborPos.xCoord, ownPos.yCoord - neighborPos.yCoord, ownPos.zCoord - neighborPos.zCoord);
|
||||
double length = delta.lengthVector();
|
||||
|
||||
if(length < 1 && length < closestDist) {
|
||||
closestDist = length;
|
||||
closestOwnCoupling = ownCoupling;
|
||||
closestNeighborCoupling = neighborCoupling;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(closestOwnCoupling != null && closestNeighborCoupling != null) {
|
||||
if(this.getCoupledTo(closestOwnCoupling) != null) continue;
|
||||
if(neighbor.getCoupledTo(closestNeighborCoupling) != null) continue;
|
||||
this.couple(closestOwnCoupling, neighbor);
|
||||
neighbor.couple(closestNeighborCoupling, this);
|
||||
if(this.ltu != null) this.ltu.dissolveTrain();
|
||||
if(neighbor.ltu != null) neighbor.ltu.dissolveTrain();
|
||||
player.swingItem();
|
||||
|
||||
player.addChatComponentMessage(new ChatComponentText("Coupled " + this.hashCode() + " (" + closestOwnCoupling.name() + ") to " + neighbor.hashCode() + " (" + closestNeighborCoupling.name() + ")"));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//DEBUG
|
||||
if(this.ltu != null) {
|
||||
|
||||
String id = Integer.toHexString(ltu.hashCode());
|
||||
|
||||
for(EntityRailCarBase train : ltu.trains) {
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "debug");
|
||||
data.setInteger("color", 0x0000ff);
|
||||
data.setFloat("scale", 1.5F);
|
||||
data.setString("text", id + " (#" + train.ltuIndex + ")");
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, train.posX, train.posY + 1, train.posZ), new TargetPoint(this.dimension, train.posX, train.posY + 1, train.posZ, 50));
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
|
||||
if(this.worldObj.isRemote) {
|
||||
|
||||
this.prevPosX = this.posX;
|
||||
this.prevPosY = this.posY;
|
||||
this.prevPosZ = this.posZ;
|
||||
|
||||
if(this.turnProgress > 0) {
|
||||
this.prevRotationYaw = this.rotationYaw;
|
||||
@ -71,7 +162,35 @@ public abstract class EntityRailCarBase extends Entity {
|
||||
this.setPosition(this.posX, this.posY, this.posZ);
|
||||
this.setRotation(this.rotationYaw, this.rotationPitch);
|
||||
}
|
||||
|
||||
BlockPos anchor = this.getCurrentAnchorPos();
|
||||
Vec3 frontPos = getRelPosAlongRail(anchor, this.getLengthSpan(), new MoveContext(RailCheckType.FRONT, this.getCollisionSpan() - this.getLengthSpan()));
|
||||
Vec3 backPos = getRelPosAlongRail(anchor, -this.getLengthSpan(), new MoveContext(RailCheckType.BACK, this.getCollisionSpan() - this.getLengthSpan()));
|
||||
|
||||
this.lastRenderX = this.renderX;
|
||||
this.lastRenderY = this.renderY;
|
||||
this.lastRenderZ = this.renderZ;
|
||||
|
||||
if(frontPos != null && backPos != null) {
|
||||
this.renderX = (frontPos.xCoord + backPos.xCoord) / 2D;
|
||||
this.renderY = (frontPos.yCoord + backPos.yCoord) / 2D;
|
||||
this.renderZ = (frontPos.zCoord + backPos.zCoord) / 2D;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if(this.coupledFront != null && this.coupledFront.isDead) {
|
||||
this.coupledFront = null;
|
||||
if(this.ltu != null) this.ltu.dissolveTrain();
|
||||
}
|
||||
if(this.coupledBack != null && this.coupledBack.isDead) {
|
||||
this.coupledBack = null;
|
||||
if(this.ltu != null) this.ltu.dissolveTrain();
|
||||
}
|
||||
|
||||
if(this.ltu == null && (this.coupledFront == null || this.coupledBack == null)) {
|
||||
LogicalTrainUnit.generateTrain(this);
|
||||
}
|
||||
|
||||
DummyConfig[] definitions = this.getDummies();
|
||||
|
||||
@ -87,6 +206,8 @@ public abstract class EntityRailCarBase extends Entity {
|
||||
double y = posY + rot.yCoord;
|
||||
double z = posZ + rot.zCoord;
|
||||
dummy.setPosition(x, y, z);
|
||||
dummy.setSize(def.width, def.height);
|
||||
dummy.velocityChanged = true;
|
||||
worldObj.spawnEntityInWorld(dummy);
|
||||
this.dummies[i] = dummy;
|
||||
}
|
||||
@ -94,52 +215,31 @@ public abstract class EntityRailCarBase extends Entity {
|
||||
this.initDummies = true;
|
||||
}
|
||||
|
||||
BlockPos anchor = this.getCurentAnchorPos();
|
||||
Vec3 corePos = getRelPosAlongRail(anchor, this.getCurrentSpeed());
|
||||
|
||||
if(corePos == null) {
|
||||
this.derail();
|
||||
} else {
|
||||
this.setPosition(corePos.xCoord, corePos.yCoord, corePos.zCoord);
|
||||
anchor = this.getCurentAnchorPos(); //reset origin to new position
|
||||
Vec3 frontPos = getRelPosAlongRail(anchor, this.getLengthSpan());
|
||||
Vec3 backPos = getRelPosAlongRail(anchor, -this.getLengthSpan());
|
||||
|
||||
if(frontPos == null || backPos == null) {
|
||||
this.derail();
|
||||
return;
|
||||
} else {
|
||||
this.prevRotationYaw = this.rotationYaw;
|
||||
this.rotationYaw = this.movementYaw = generateYaw(frontPos, backPos);
|
||||
this.motionX = this.rotationYaw / 360D; // hijacking this crap for easy syncing
|
||||
this.velocityChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < definitions.length; i++) {
|
||||
DummyConfig def = definitions[i];
|
||||
BoundingBoxDummyEntity dummy = dummies[i];
|
||||
Vec3 rot = Vec3.createVectorHelper(def.offset.xCoord, def.offset.yCoord, def.offset.zCoord);
|
||||
rot.rotateAroundX((float) (this.rotationPitch * Math.PI / 180D));
|
||||
rot.rotateAroundY((float) (-this.rotationYaw * Math.PI / 180));
|
||||
double x = posX + rot.xCoord;
|
||||
double y = posY + rot.yCoord;
|
||||
double z = posZ + rot.zCoord;
|
||||
dummy.setSize(def.width, def.height); // TEMP
|
||||
double x = renderX + rot.xCoord;
|
||||
double y = renderY + rot.yCoord;
|
||||
double z = renderZ + rot.zCoord;
|
||||
dummy.setPosition(x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Vec3 getRelPosAlongRail(BlockPos anchor, double distanceToCover) {
|
||||
|
||||
float yaw = this.rotationYaw;
|
||||
public Vec3 getRelPosAlongRail(BlockPos anchor, double distanceToCover, MoveContext context) {
|
||||
return getRelPosAlongRail(anchor, distanceToCover, this.getGauge(), this.worldObj, Vec3.createVectorHelper(posX, posY, posZ), this.rotationYaw, context);
|
||||
}
|
||||
|
||||
public static Vec3 getRelPosAlongRail(BlockPos anchor, double distanceToCover, TrackGauge gauge, World worldObj, Vec3 next, float yaw, MoveContext context) {
|
||||
|
||||
if(distanceToCover < 0) {
|
||||
distanceToCover *= -1;
|
||||
yaw += 180;
|
||||
}
|
||||
|
||||
Vec3 next = Vec3.createVectorHelper(posX, posY, posZ);
|
||||
int it = 0;
|
||||
|
||||
do {
|
||||
@ -147,8 +247,6 @@ public abstract class EntityRailCarBase extends Entity {
|
||||
it++;
|
||||
|
||||
if(it > 30) {
|
||||
worldObj.createExplosion(this, posX, posY, posZ, 5F, false);
|
||||
this.derail();
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -164,15 +262,15 @@ public abstract class EntityRailCarBase extends Entity {
|
||||
IRailNTM rail = (IRailNTM) block;
|
||||
|
||||
if(it == 1) {
|
||||
next = rail.getTravelLocation(worldObj, x, y, z, next.xCoord, next.yCoord, next.zCoord, rot.xCoord, rot.yCoord, rot.zCoord, 0, new RailContext());
|
||||
next = rail.getTravelLocation(worldObj, x, y, z, next.xCoord, next.yCoord, next.zCoord, rot.xCoord, rot.yCoord, rot.zCoord, 0, new RailContext(), context);
|
||||
}
|
||||
|
||||
boolean flip = distanceToCover < 0;
|
||||
|
||||
if(rail.getGauge(worldObj, x, y, z) == this.getGauge()) {
|
||||
if(rail.getGauge(worldObj, x, y, z) == gauge) {
|
||||
RailContext info = new RailContext();
|
||||
Vec3 prev = next;
|
||||
next = rail.getTravelLocation(worldObj, x, y, z, prev.xCoord, prev.yCoord, prev.zCoord, rot.xCoord, rot.yCoord, rot.zCoord, distanceToCover, info);
|
||||
next = rail.getTravelLocation(worldObj, x, y, z, prev.xCoord, prev.yCoord, prev.zCoord, rot.xCoord, rot.yCoord, rot.zCoord, distanceToCover, info, context);
|
||||
distanceToCover = info.overshoot;
|
||||
anchor = info.pos;
|
||||
|
||||
@ -190,23 +288,102 @@ public abstract class EntityRailCarBase extends Entity {
|
||||
return next;
|
||||
}
|
||||
|
||||
public float generateYaw(Vec3 front, Vec3 back) {
|
||||
public static float generateYaw(Vec3 front, Vec3 back) {
|
||||
double deltaX = front.xCoord - back.xCoord;
|
||||
double deltaZ = front.zCoord - back.zCoord;
|
||||
double radians = -Math.atan2(deltaX, deltaZ);
|
||||
return (float) MathHelper.wrapAngleTo180_double(radians * 180D / Math.PI);
|
||||
}
|
||||
|
||||
public static void updateMotion(World world) {
|
||||
Set<LogicalTrainUnit> ltus = new HashSet();
|
||||
|
||||
/* gather all LTUs */
|
||||
for(Object o : world.loadedEntityList) {
|
||||
if(o instanceof EntityRailCarBase) {
|
||||
EntityRailCarBase train = (EntityRailCarBase) o;
|
||||
if(train.ltu != null) ltus.add(train.ltu);
|
||||
}
|
||||
}
|
||||
|
||||
/* Move carts together with links */
|
||||
//for(LogicalTrainUnit ltu : ltus) ltu.combineWagons();
|
||||
|
||||
/* Move carts with unified speed */
|
||||
//for(LogicalTrainUnit ltu : ltus) ltu.moveTrain();
|
||||
|
||||
for(LogicalTrainUnit ltu : ltus) {
|
||||
|
||||
double speed = ltu.getTotalSpeed() + ltu.pushForce;
|
||||
|
||||
if(Math.abs(speed) < 0.001) speed = 0;
|
||||
|
||||
if(ltu.trains.length == 1) {
|
||||
|
||||
EntityRailCarBase train = ltu.trains[0];
|
||||
|
||||
BlockPos anchor = new BlockPos(train.posX, train.posY, train.posZ);
|
||||
Vec3 newPos = train.getRelPosAlongRail(anchor, speed, new MoveContext(RailCheckType.CORE, 0));
|
||||
if(newPos == null) {
|
||||
train.derail();
|
||||
ltu.dissolveTrain();
|
||||
continue;
|
||||
}
|
||||
train.setPosition(newPos.xCoord, newPos.yCoord, newPos.zCoord);
|
||||
anchor = train.getCurrentAnchorPos();
|
||||
Vec3 frontPos = train.getRelPosAlongRail(anchor, train.getLengthSpan(), new MoveContext(RailCheckType.FRONT, train.getCollisionSpan() - train.getLengthSpan()));
|
||||
Vec3 backPos = train.getRelPosAlongRail(anchor, -train.getLengthSpan(), new MoveContext(RailCheckType.BACK, train.getCollisionSpan() - train.getLengthSpan()));
|
||||
|
||||
if(frontPos == null || backPos == null) {
|
||||
train.derail();
|
||||
ltu.dissolveTrain();
|
||||
continue;
|
||||
} else {
|
||||
ltu.setRenderPos(train, frontPos, backPos);
|
||||
}
|
||||
|
||||
//ltu.pushForce *= 0.95;
|
||||
ltu.pushForce = 0;
|
||||
ltu.collideTrain(speed);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if(speed == 0) {
|
||||
ltu.combineWagons();
|
||||
} else {
|
||||
ltu.moveTrainByApproach(speed);
|
||||
}
|
||||
|
||||
if(ltu.trains.length != 1) {
|
||||
//ltu.pushForce *= 0.95;
|
||||
ltu.pushForce = 0;
|
||||
ltu.collideTrain(speed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns the amount of blocks that the train should move per tick */
|
||||
public abstract double getCurrentSpeed();
|
||||
public abstract double getMaxRailSpeed();
|
||||
/** Returns the gauge of this train */
|
||||
public abstract TrackGauge getGauge();
|
||||
/** Returns the length between the core and one of the bogies */
|
||||
public abstract double getLengthSpan();
|
||||
/** Returns the length between the core and the collision points */
|
||||
public abstract double getCollisionSpan();
|
||||
/** Returns a collision box, usually smaller than the entity's AABB for rendering, which is used for colliding trains */
|
||||
/*public AxisAlignedBB getCollisionBox() {
|
||||
return this.boundingBox;
|
||||
}*/
|
||||
/** Returns a collision box used for block collisions when derailed */
|
||||
/*@Override public AxisAlignedBB getBoundingBox() {
|
||||
return this.boundingBox;
|
||||
}*/
|
||||
|
||||
/** Returns the "true" position of the train, i.e. the block it wants to snap to */
|
||||
public BlockPos getCurentAnchorPos() {
|
||||
return new BlockPos(posX, posY, posZ);
|
||||
public BlockPos getCurrentAnchorPos() {
|
||||
return new BlockPos(posX, posY + 0.25, posZ);
|
||||
}
|
||||
|
||||
public void derail() {
|
||||
@ -226,18 +403,20 @@ public abstract class EntityRailCarBase extends Entity {
|
||||
this.motionY = this.velocityY;
|
||||
this.motionZ = this.velocityZ;
|
||||
this.trainYaw = this.movementYaw;
|
||||
this.trainPitch = this.movementPitch;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void setVelocity(double mX, double mY, double mZ) {
|
||||
this.movementYaw = (float) this.motionX * 360F;
|
||||
this.movementPitch = (float) this.motionY * 360F;
|
||||
this.velocityX = this.motionX = mX;
|
||||
this.velocityY = this.motionY = mY;
|
||||
this.velocityZ = this.motionZ = mZ;
|
||||
}
|
||||
|
||||
/** Invisible entities that make up the dynamic bounding structure of the train, moving as the train rotates. */
|
||||
public static class BoundingBoxDummyEntity extends Entity {
|
||||
public static class BoundingBoxDummyEntity extends Entity implements ILookOverlay {
|
||||
|
||||
private int turnProgress;
|
||||
private double trainX;
|
||||
@ -302,6 +481,13 @@ public abstract class EntityRailCarBase extends Entity {
|
||||
this.trainZ = posZ;
|
||||
this.turnProgress = turnProg + 2;
|
||||
}
|
||||
@Override
|
||||
public void printHook(Pre event, World world, int x, int y, int z) {
|
||||
Entity e = worldObj.getEntityByID(this.dataWatcher.getWatchableObjectInt(3));
|
||||
if(e instanceof EntityRailCarBase) {
|
||||
((EntityRailCarBase) e).printHook(event, world, x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public DummyConfig[] getDummies() {
|
||||
@ -319,4 +505,387 @@ public abstract class EntityRailCarBase extends Entity {
|
||||
this.offset = offset;
|
||||
}
|
||||
}
|
||||
|
||||
public static enum TrainCoupling {
|
||||
FRONT,
|
||||
BACK
|
||||
}
|
||||
|
||||
public double getCouplingDist(TrainCoupling coupling) {
|
||||
return 0D;
|
||||
}
|
||||
|
||||
public Vec3 getCouplingPos(TrainCoupling coupling) {
|
||||
double dist = this.getCouplingDist(coupling);
|
||||
|
||||
if(dist <= 0) return null;
|
||||
|
||||
if(coupling == TrainCoupling.BACK) dist *= -1;
|
||||
|
||||
Vec3 rot = Vec3.createVectorHelper(0, 0, dist);
|
||||
rot.rotateAroundY((float) (-this.rotationYaw * Math.PI / 180D));
|
||||
rot.xCoord += this.renderX;
|
||||
rot.yCoord += this.renderY;
|
||||
rot.zCoord += this.renderZ;
|
||||
return rot;
|
||||
}
|
||||
|
||||
public EntityRailCarBase getCoupledTo(TrainCoupling coupling) {
|
||||
return coupling == TrainCoupling.FRONT ? this.coupledFront : coupling == TrainCoupling.BACK ? this.coupledBack : null;
|
||||
}
|
||||
|
||||
public TrainCoupling getCouplingFrom(EntityRailCarBase coupledTo) {
|
||||
return coupledTo == this.coupledFront ? TrainCoupling.FRONT : coupledTo == this.coupledBack ? TrainCoupling.BACK : null;
|
||||
}
|
||||
|
||||
public void couple(TrainCoupling coupling, EntityRailCarBase to) {
|
||||
if(coupling == TrainCoupling.FRONT) this.coupledFront = to;
|
||||
if(coupling == TrainCoupling.BACK) this.coupledBack = to;
|
||||
}
|
||||
|
||||
public static class LogicalTrainUnit {
|
||||
|
||||
protected double pushForce;
|
||||
protected EntityRailCarBase trains[];
|
||||
|
||||
/** Assumes that the train is an endpoint, i.e. that only one coupling is in use */
|
||||
public static LogicalTrainUnit generateTrain(EntityRailCarBase train) {
|
||||
List<EntityRailCarBase> links = new ArrayList();
|
||||
Set<EntityRailCarBase> brake = new HashSet();
|
||||
LogicalTrainUnit ltu = new LogicalTrainUnit();
|
||||
|
||||
if(train.coupledFront == null && train.coupledBack == null) {
|
||||
ltu.trains = new EntityRailCarBase[] {train};
|
||||
train.ltu = ltu;
|
||||
train.ltuIndex = 0;
|
||||
return ltu;
|
||||
}
|
||||
|
||||
EntityRailCarBase current = train;
|
||||
EntityRailCarBase next = null;
|
||||
|
||||
do {
|
||||
next = null;
|
||||
|
||||
if(current.coupledFront != null && !brake.contains(current.coupledFront)) next = current.coupledFront;
|
||||
if(current.coupledBack != null && !brake.contains(current.coupledBack)) next = current.coupledBack;
|
||||
|
||||
links.add(current);
|
||||
brake.add(current);
|
||||
|
||||
current = next;
|
||||
|
||||
} while(next != null);
|
||||
|
||||
ltu.trains = new EntityRailCarBase[links.size()];
|
||||
for(int i = 0; i < ltu.trains.length; i++) {
|
||||
ltu.trains[i] = links.get(i);
|
||||
ltu.trains[i].ltu = ltu;
|
||||
ltu.trains[i].ltuIndex = i;
|
||||
}
|
||||
|
||||
return ltu;
|
||||
}
|
||||
|
||||
/** Removes the LTU from all wagons */
|
||||
public void dissolveTrain() {
|
||||
for(EntityRailCarBase train : trains) {
|
||||
train.ltu = null;
|
||||
train.ltuIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/** Find the center fo the train, then moves all wagons towards that center until the coupling points roughly touch */
|
||||
public void combineWagons() {
|
||||
|
||||
if(trains.length <= 1) return;
|
||||
|
||||
boolean odd = trains.length % 2 == 1;
|
||||
int centerIndex = odd ? trains.length / 2 : trains.length / 2 - 1;
|
||||
EntityRailCarBase center = trains[centerIndex];
|
||||
EntityRailCarBase prev = center;
|
||||
|
||||
for(int i = centerIndex - 1; i >= 0; i--) {
|
||||
EntityRailCarBase next = trains[i];
|
||||
moveWagonTo(prev, next);
|
||||
prev = next;
|
||||
}
|
||||
|
||||
prev = center;
|
||||
for(int i = centerIndex + 1; i < trains.length; i++) {
|
||||
EntityRailCarBase next = trains[i];
|
||||
moveWagonTo(prev, next);
|
||||
prev = next;
|
||||
}
|
||||
}
|
||||
|
||||
/** Moves one wagon to ne next until the coupling points roughly touch */
|
||||
public void moveWagonTo(EntityRailCarBase moveTo, EntityRailCarBase moving) {
|
||||
TrainCoupling prevCouple = moveTo.getCouplingFrom(moving);
|
||||
TrainCoupling nextCouple = moving.getCouplingFrom(moveTo);
|
||||
Vec3 prevLoc = moveTo.getCouplingPos(prevCouple);
|
||||
Vec3 nextLoc = moving.getCouplingPos(nextCouple);
|
||||
Vec3 delta = Vec3.createVectorHelper(prevLoc.xCoord - nextLoc.xCoord, 0, prevLoc.zCoord - nextLoc.zCoord);
|
||||
double len = delta.lengthVector();
|
||||
//len *= 0.25; //suspension, causes movements to be less rigid
|
||||
len = (len / (0.5D / (len * len) + 1D)); //smart suspension
|
||||
BlockPos anchor = new BlockPos(moving.posX, moving.posY, moving.posZ);
|
||||
Vec3 trainPos = Vec3.createVectorHelper(moving.posX, moving.posY, moving.posZ);
|
||||
float yaw = EntityRailCarBase.generateYaw(prevLoc, nextLoc);
|
||||
Vec3 newPos = EntityRailCarBase.getRelPosAlongRail(anchor, len, moving.getGauge(), moving.worldObj, trainPos, yaw, new MoveContext(RailCheckType.CORE, 0));
|
||||
moving.setPosition(newPos.xCoord, newPos.yCoord, newPos.zCoord);
|
||||
anchor = moving.getCurrentAnchorPos(); //reset origin to new position
|
||||
Vec3 frontPos = moving.getRelPosAlongRail(anchor, moving.getLengthSpan(), new MoveContext(RailCheckType.FRONT, moving.getCollisionSpan() - moving.getLengthSpan()));
|
||||
Vec3 backPos = moving.getRelPosAlongRail(anchor, -moving.getLengthSpan(), new MoveContext(RailCheckType.BACK, moving.getCollisionSpan() - moving.getLengthSpan()));
|
||||
|
||||
if(frontPos == null || backPos == null) {
|
||||
moving.derail();
|
||||
this.dissolveTrain();
|
||||
return;
|
||||
} else {
|
||||
setRenderPos(moving, frontPos, backPos);
|
||||
}
|
||||
}
|
||||
|
||||
/** Generates the speed of the train, then moves the rain along the rail */
|
||||
@Deprecated public void moveTrain() {
|
||||
|
||||
EntityRailCarBase prev = trains[0];
|
||||
TrainCoupling dir = prev.getCouplingFrom(null);
|
||||
double totalSpeed = 0;
|
||||
double maxSpeed = Double.POSITIVE_INFINITY;
|
||||
|
||||
for(EntityRailCarBase train : this.trains) {
|
||||
boolean con = train.getCouplingFrom(prev) == dir;
|
||||
double speed = train.getCurrentSpeed();
|
||||
if(!con) speed *= -1;
|
||||
totalSpeed += speed;
|
||||
maxSpeed = Math.min(maxSpeed, train.getMaxRailSpeed());
|
||||
prev = train;
|
||||
}
|
||||
|
||||
if(Math.abs(totalSpeed) > maxSpeed) {
|
||||
totalSpeed = maxSpeed * Math.signum(totalSpeed);
|
||||
}
|
||||
|
||||
this.moveTrainBy(totalSpeed);
|
||||
}
|
||||
|
||||
/** Moves the entire train along the rail by a certain speed */
|
||||
@Deprecated public void moveTrainBy(double totalSpeed) {
|
||||
|
||||
for(EntityRailCarBase train : this.trains) {
|
||||
|
||||
BlockPos anchor = train.getCurrentAnchorPos();
|
||||
Vec3 corePos = train.getRelPosAlongRail(anchor, totalSpeed, new MoveContext(RailCheckType.CORE, 0));
|
||||
|
||||
if(corePos == null) {
|
||||
train.derail();
|
||||
this.dissolveTrain();
|
||||
return;
|
||||
} else {
|
||||
train.setPosition(corePos.xCoord, corePos.yCoord, corePos.zCoord);
|
||||
anchor = train.getCurrentAnchorPos(); //reset origin to new position
|
||||
Vec3 frontPos = train.getRelPosAlongRail(anchor, train.getLengthSpan(), new MoveContext(RailCheckType.FRONT, 0));
|
||||
Vec3 backPos = train.getRelPosAlongRail(anchor, -train.getLengthSpan(), new MoveContext(RailCheckType.BACK, 0));
|
||||
|
||||
if(frontPos == null || backPos == null) {
|
||||
train.derail();
|
||||
this.dissolveTrain();
|
||||
return;
|
||||
} else {
|
||||
train.renderX = (frontPos.xCoord + backPos.xCoord) / 2D;
|
||||
train.renderY = (frontPos.yCoord + backPos.yCoord) / 2D;
|
||||
train.renderZ = (frontPos.zCoord + backPos.zCoord) / 2D;
|
||||
train.prevRotationYaw = train.rotationYaw;
|
||||
train.rotationYaw = train.movementYaw = generateYaw(frontPos, backPos);
|
||||
train.motionX = train.rotationYaw / 360D; // hijacking this crap for easy syncing
|
||||
train.velocityChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns the total speed of the LTU, negative if it is backwards compared to the arbitrary "front" wagon */
|
||||
public double getTotalSpeed() {
|
||||
|
||||
EntityRailCarBase prev = trains[0];
|
||||
double totalSpeed = 0;
|
||||
double maxSpeed = Double.POSITIVE_INFINITY;
|
||||
//if the first car is in reverse, flip all subsequent cars as well
|
||||
boolean reverseTheReverse = prev.getCouplingFrom(null) == TrainCoupling.BACK;
|
||||
|
||||
if(trains.length == 1) {
|
||||
return prev.getCurrentSpeed();
|
||||
}
|
||||
|
||||
for(EntityRailCarBase train : this.trains) {
|
||||
//if the car's linked indices are the wrong way, it is in reverse and speed applies negatively
|
||||
boolean reverse = false;
|
||||
|
||||
EntityRailCarBase conFront = train.getCoupledTo(TrainCoupling.FRONT);
|
||||
EntityRailCarBase conBack = train.getCoupledTo(TrainCoupling.BACK);
|
||||
|
||||
if(conFront != null && conFront.ltuIndex > train.ltuIndex) reverse = true;
|
||||
if(conBack != null && conBack.ltuIndex < train.ltuIndex) reverse = true;
|
||||
|
||||
reverse ^= reverseTheReverse;
|
||||
|
||||
double speed = train.getCurrentSpeed();
|
||||
if(reverse) speed *= -1;
|
||||
totalSpeed += speed;
|
||||
maxSpeed = Math.min(maxSpeed, train.getMaxRailSpeed());
|
||||
prev = train;
|
||||
}
|
||||
|
||||
if(Math.abs(totalSpeed) > maxSpeed) {
|
||||
totalSpeed = maxSpeed * Math.signum(totalSpeed);
|
||||
}
|
||||
|
||||
return totalSpeed;
|
||||
}
|
||||
|
||||
/** Determines the "front" wagon based on the movement and moves it, then moves all other wagons towards that */
|
||||
public void moveTrainByApproach(double speed) {
|
||||
boolean forward = speed < 0;
|
||||
speed = Math.abs(speed);
|
||||
EntityRailCarBase previous = null;
|
||||
|
||||
EntityRailCarBase first = this.trains[0];
|
||||
|
||||
for(int i = !forward ? 0 : this.trains.length - 1; !forward ? i < this.trains.length : i >= 0; i += !forward ? 1 : -1) {
|
||||
EntityRailCarBase current = this.trains[i];
|
||||
|
||||
if(previous == null) {
|
||||
|
||||
boolean inReverse = first.getCouplingFrom(null) == current.getCouplingFrom(null);
|
||||
int sigNum = inReverse ? 1 : -1;
|
||||
BlockPos anchor = current.getCurrentAnchorPos();
|
||||
|
||||
/*Vec3 frontPos = current.getRelPosAlongRail(anchor, current.getLengthSpan(), new MoveContext(RailCheckType.FRONT));
|
||||
|
||||
if(frontPos == null) {
|
||||
current.derail();
|
||||
this.dissolveTrain();
|
||||
return;
|
||||
} else {
|
||||
anchor = current.getCurrentAnchorPos(); //reset origin to new position
|
||||
Vec3 corePos = current.getRelPosAlongRail(anchor, speed * sigNum, new MoveContext(RailCheckType.CORE));
|
||||
current.setPosition(corePos.xCoord, corePos.yCoord, corePos.zCoord);
|
||||
Vec3 backPos = current.getRelPosAlongRail(anchor, -current.getLengthSpan(), new MoveContext(RailCheckType.BACK));
|
||||
|
||||
if(frontPos == null || backPos == null) {
|
||||
current.derail();
|
||||
this.dissolveTrain();
|
||||
return;
|
||||
} else {
|
||||
setRenderPos(current, frontPos, backPos);
|
||||
}
|
||||
}*/
|
||||
|
||||
Pair<Double, RailCheckType>[] checks;
|
||||
double dist = speed * sigNum;
|
||||
|
||||
if(forward) {
|
||||
checks = new Pair[] {
|
||||
new Pair(dist + current.getLengthSpan(), RailCheckType.FRONT),
|
||||
new Pair(dist, RailCheckType.CORE),
|
||||
new Pair(dist - current.getLengthSpan(), RailCheckType.BACK)
|
||||
};
|
||||
} else {
|
||||
checks = new Pair[] {
|
||||
new Pair(dist - current.getLengthSpan(), RailCheckType.BACK),
|
||||
new Pair(dist, RailCheckType.CORE),
|
||||
new Pair(dist + current.getLengthSpan(), RailCheckType.FRONT)
|
||||
};
|
||||
}
|
||||
|
||||
double brake = 0;
|
||||
|
||||
for(Pair<Double, RailCheckType> check : checks) {
|
||||
MoveContext ctx = new MoveContext(check.getValue(), current.getCollisionSpan() - current.getLengthSpan());
|
||||
current.getRelPosAlongRail(anchor, check.getKey() - (brake * Math.signum(check.getKey())), ctx);
|
||||
if(ctx.collision) {
|
||||
brake += ctx.overshoot;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
this.moveWagonTo(previous, current);
|
||||
}
|
||||
|
||||
previous = current;
|
||||
}
|
||||
}
|
||||
|
||||
/** Uses the front and back bogey positions to set the render pos and angles of a wagon */
|
||||
public void setRenderPos(EntityRailCarBase current, Vec3 frontPos, Vec3 backPos) {
|
||||
current.renderX = (frontPos.xCoord + backPos.xCoord) / 2D;
|
||||
current.renderY = (frontPos.yCoord + backPos.yCoord) / 2D;
|
||||
current.renderZ = (frontPos.zCoord + backPos.zCoord) / 2D;
|
||||
current.prevRotationYaw = current.rotationYaw;
|
||||
current.rotationYaw = current.movementYaw = generateYaw(frontPos, backPos);
|
||||
Vec3 delta = Vec3.createVectorHelper(frontPos.xCoord - backPos.xCoord, frontPos.yCoord - backPos.yCoord, frontPos.zCoord - backPos.zCoord);
|
||||
current.rotationPitch = current.movementPitch = (float) (Math.asin(delta.yCoord / delta.lengthVector()) * 180D / Math.PI);
|
||||
current.motionX = current.rotationYaw / 360D; // hijacking this crap for easy syncing
|
||||
current.motionY = current.rotationPitch / 360D;
|
||||
current.velocityChanged = true;
|
||||
}
|
||||
|
||||
public void collideTrain(double speed) {
|
||||
EntityRailCarBase collidingTrain = speed > 0 ? trains[0] : trains[trains.length - 1];
|
||||
List<EntityRailCarBase> intersect = collidingTrain.worldObj.getEntitiesWithinAABB(EntityRailCarBase.class, collidingTrain.boundingBox.expand(1, 1, 1));
|
||||
EntityRailCarBase collidesWith = null;
|
||||
|
||||
for(EntityRailCarBase train : intersect) {
|
||||
if(train.ltu != null && train.ltu != this) {
|
||||
collidesWith = train;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(collidesWith == null) return;
|
||||
|
||||
Vec3 delta = Vec3.createVectorHelper(collidingTrain.posX - collidesWith.posX, 0, collidingTrain.posZ - collidesWith.posZ);
|
||||
double totalSpan = collidingTrain.getCollisionSpan() + collidesWith.getCollisionSpan();
|
||||
double diff = delta.lengthVector();
|
||||
if(diff > totalSpan) return;
|
||||
double push = (totalSpan - diff);
|
||||
|
||||
//PacketDispatcher.wrapper.sendToAllAround(new PlayerInformPacket(ChatBuilder.start("" + collidesWith.ltuIndex + " " + collidingTrain.ltuIndex).color(EnumChatFormatting.RED).flush(), 1),
|
||||
// new TargetPoint(collidingTrain.dimension, collidingTrain.posX, collidingTrain.posY + 1, collidingTrain.posZ, 50));
|
||||
|
||||
EntityRailCarBase[][] whatever = new EntityRailCarBase[][] {{collidingTrain, collidesWith}, {collidesWith, collidingTrain}};
|
||||
for(EntityRailCarBase[] array : whatever) {
|
||||
LogicalTrainUnit ltu = array[0].ltu;
|
||||
if(ltu.trains.length == 1) {
|
||||
Vec3 rot = Vec3.createVectorHelper(0, 0, array[0].getCollisionSpan());
|
||||
rot.rotateAroundX((float) (array[0].rotationPitch * Math.PI / 180D));
|
||||
rot.rotateAroundY((float) (-array[0].rotationYaw * Math.PI / 180));
|
||||
Vec3 forward = Vec3.createVectorHelper(array[1].posX - (array[0].posX + rot.xCoord), 0, array[1].posZ - (array[0].posZ + rot.zCoord));
|
||||
Vec3 backward = Vec3.createVectorHelper(array[1].posX - (array[0].posX - rot.xCoord), 0, array[1].posZ - (array[0].posZ - rot.zCoord));
|
||||
|
||||
if(forward.lengthVector() > backward.lengthVector()) {
|
||||
ltu.pushForce += push;
|
||||
} else {
|
||||
ltu.pushForce -= push;
|
||||
}
|
||||
} else {
|
||||
|
||||
if(array[0].ltuIndex < ltu.trains.length / 2) {
|
||||
ltu.pushForce -= push;
|
||||
} else {
|
||||
ltu.pushForce += push;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void printHook(RenderGameOverlayEvent.Pre event, World world, int x, int y, int z) {
|
||||
List<String> text = new ArrayList();
|
||||
ILookOverlay.printGeneric(event, this.getClass().getSimpleName() + " " + this.hashCode(), 0xffff00, 0x404000, text); //none of this shit is going to work anyway
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,6 +15,22 @@ public abstract class EntityRailCarCargo extends EntityRailCarBase implements II
|
||||
public EntityRailCarCargo(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
super.entityInit();
|
||||
this.dataWatcher.addObject(10, new Integer(0));
|
||||
}
|
||||
|
||||
public int countVacantSlots() {
|
||||
int slots = 0;
|
||||
|
||||
for(int i = 0; i < this.getSizeInventory(); i++) {
|
||||
if(this.getStackInSlot(i) != null) slots++;
|
||||
}
|
||||
|
||||
return slots;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slot) {
|
||||
@ -37,9 +53,11 @@ public abstract class EntityRailCarCargo extends EntityRailCarBase implements II
|
||||
this.slots[slot] = null;
|
||||
}
|
||||
|
||||
if(!this.worldObj.isRemote) this.dataWatcher.updateObject(10, this.countVacantSlots());
|
||||
return itemstack;
|
||||
}
|
||||
} else {
|
||||
if(!this.worldObj.isRemote) this.dataWatcher.updateObject(10, this.countVacantSlots());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -49,8 +67,10 @@ public abstract class EntityRailCarCargo extends EntityRailCarBase implements II
|
||||
if(this.slots[slot] != null) {
|
||||
ItemStack itemstack = this.slots[slot];
|
||||
this.slots[slot] = null;
|
||||
if(!this.worldObj.isRemote) this.dataWatcher.updateObject(10, this.countVacantSlots());
|
||||
return itemstack;
|
||||
} else {
|
||||
if(!this.worldObj.isRemote) this.dataWatcher.updateObject(10, this.countVacantSlots());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -62,6 +82,8 @@ public abstract class EntityRailCarCargo extends EntityRailCarBase implements II
|
||||
if(stack != null && stack.stackSize > this.getInventoryStackLimit()) {
|
||||
stack.stackSize = this.getInventoryStackLimit();
|
||||
}
|
||||
|
||||
if(!this.worldObj.isRemote) this.dataWatcher.updateObject(10, this.countVacantSlots());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -119,6 +141,8 @@ public abstract class EntityRailCarCargo extends EntityRailCarBase implements II
|
||||
this.slots[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
|
||||
this.dataWatcher.updateObject(10, this.countVacantSlots());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -19,15 +19,17 @@ public abstract class EntityRailCarElectric extends EntityRailCarRidable {
|
||||
public int getChargeSlot() { return 0; }
|
||||
|
||||
@Override protected void entityInit() {
|
||||
super.entityInit();
|
||||
this.dataWatcher.addObject(3, new Integer(0));
|
||||
}
|
||||
|
||||
@Override public boolean canAccelerate() {
|
||||
return this.getPower() >= this.getPowerConsumption();
|
||||
return true;
|
||||
//return this.getPower() >= this.getPowerConsumption();
|
||||
}
|
||||
|
||||
@Override public void consumeFuel() {
|
||||
this.setPower(this.getPower() - this.getPowerConsumption());
|
||||
//this.setPower(this.getPower() - this.getPowerConsumption());
|
||||
}
|
||||
|
||||
public void setPower(int power) {
|
||||
|
||||
@ -1,6 +1,10 @@
|
||||
package com.hbm.entity.train;
|
||||
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.main.MainRegistry;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -10,6 +14,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
|
||||
public abstract class EntityRailCarRidable extends EntityRailCarCargo {
|
||||
|
||||
@ -77,12 +82,40 @@ public abstract class EntityRailCarRidable extends EntityRailCarCargo {
|
||||
@Override
|
||||
public boolean interactFirst(EntityPlayer player) {
|
||||
|
||||
if(super.interactFirst(player)) return true;
|
||||
if(worldObj.isRemote) return true;
|
||||
|
||||
int nearestSeat = this.getNearestSeat(player);
|
||||
|
||||
if(nearestSeat == -1) {
|
||||
player.mountEntity(this);
|
||||
} else if(nearestSeat >= 0) {
|
||||
SeatDummyEntity dummySeat = new SeatDummyEntity(worldObj, this, nearestSeat);
|
||||
Vec3 passengerSeat = this.getPassengerSeats()[nearestSeat];
|
||||
passengerSeat.rotateAroundY((float) (-this.rotationYaw * Math.PI / 180));
|
||||
double x = renderX + passengerSeat.xCoord;
|
||||
double y = renderY + passengerSeat.yCoord;
|
||||
double z = renderZ + passengerSeat.zCoord;
|
||||
dummySeat.setPosition(x, y - 1, z);
|
||||
passengerSeats[nearestSeat] = dummySeat;
|
||||
worldObj.spawnEntityInWorld(dummySeat);
|
||||
player.mountEntity(dummySeat);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public int getNearestSeat(EntityPlayer player) {
|
||||
|
||||
double nearestDist = Double.POSITIVE_INFINITY;
|
||||
int nearestSeat = -1;
|
||||
int nearestSeat = -3;
|
||||
|
||||
Vec3[] seats = getPassengerSeats();
|
||||
Vec3 look = player.getLook(2);
|
||||
look.xCoord += player.posX;
|
||||
look.yCoord += player.posY + player.eyeHeight - player.yOffset;
|
||||
look.zCoord += player.posZ;
|
||||
|
||||
for(int i = 0; i < seats.length; i++) {
|
||||
|
||||
Vec3 seat = seats[i];
|
||||
@ -90,14 +123,12 @@ public abstract class EntityRailCarRidable extends EntityRailCarCargo {
|
||||
if(passengerSeats[i] != null) continue;
|
||||
|
||||
seat.rotateAroundY((float) (-this.rotationYaw * Math.PI / 180));
|
||||
double x = posX + seat.xCoord;
|
||||
double z = posZ + seat.zCoord;
|
||||
double x = renderX + seat.xCoord;
|
||||
double y = renderY + seat.yCoord;
|
||||
double z = renderZ + seat.zCoord;
|
||||
|
||||
double deltaX = player.posX - x;
|
||||
double deltaZ = player.posZ - z;
|
||||
double radians = -Math.atan2(deltaX, deltaZ);
|
||||
double degrees = MathHelper.wrapAngleTo180_double(radians * 180D / Math.PI - 90);
|
||||
double dist = Math.abs(BobMathUtil.angularDifference(degrees, player.rotationYaw));
|
||||
Vec3 delta = Vec3.createVectorHelper(look.xCoord - x, look.yCoord - y, look.zCoord - z);
|
||||
double dist = delta.lengthVector();
|
||||
|
||||
if(dist < nearestDist) {
|
||||
nearestDist = dist;
|
||||
@ -108,14 +139,12 @@ public abstract class EntityRailCarRidable extends EntityRailCarCargo {
|
||||
if(this.riddenByEntity == null) {
|
||||
Vec3 seat = getRiderSeatPosition();
|
||||
seat.rotateAroundY((float) (-this.rotationYaw * Math.PI / 180));
|
||||
double x = posX + seat.xCoord;
|
||||
double z = posZ + seat.zCoord;
|
||||
double x = renderX + seat.xCoord;
|
||||
double y = renderY + seat.yCoord;
|
||||
double z = renderZ + seat.zCoord;
|
||||
|
||||
double deltaX = player.posX - x;
|
||||
double deltaZ = player.posZ - z;
|
||||
double radians = -Math.atan2(deltaX, deltaZ);
|
||||
double degrees = MathHelper.wrapAngleTo180_double(radians * 180D / Math.PI - 90);
|
||||
double dist = Math.abs(BobMathUtil.angularDifference(degrees, player.rotationYaw));
|
||||
Vec3 delta = Vec3.createVectorHelper(look.xCoord - x, look.yCoord - y, look.zCoord - z);
|
||||
double dist = delta.lengthVector();
|
||||
|
||||
if(dist < nearestDist) {
|
||||
nearestDist = dist;
|
||||
@ -123,24 +152,9 @@ public abstract class EntityRailCarRidable extends EntityRailCarCargo {
|
||||
}
|
||||
}
|
||||
|
||||
if(nearestDist > 180) return true;
|
||||
if(nearestDist > 180) return -2;
|
||||
|
||||
if(nearestSeat == -1) {
|
||||
player.mountEntity(this);
|
||||
} else {
|
||||
SeatDummyEntity dummySeat = new SeatDummyEntity(worldObj, this);
|
||||
Vec3 passengerSeat = this.getPassengerSeats()[nearestSeat];
|
||||
passengerSeat.rotateAroundY((float) (-this.rotationYaw * Math.PI / 180));
|
||||
double x = posX + passengerSeat.xCoord;
|
||||
double y = posY + passengerSeat.yCoord;
|
||||
double z = posZ + passengerSeat.zCoord;
|
||||
dummySeat.setPosition(x, y - 1, z);
|
||||
passengerSeats[nearestSeat] = dummySeat;
|
||||
worldObj.spawnEntityInWorld(dummySeat);
|
||||
player.mountEntity(dummySeat);
|
||||
}
|
||||
|
||||
return true;
|
||||
return nearestSeat;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -159,10 +173,11 @@ public abstract class EntityRailCarRidable extends EntityRailCarCargo {
|
||||
seat.setDead();
|
||||
} else {
|
||||
Vec3 rot = seats[i];
|
||||
rot.rotateAroundX((float) (this.rotationPitch * Math.PI / 180));
|
||||
rot.rotateAroundY((float) (-this.rotationYaw * Math.PI / 180));
|
||||
double x = posX + rot.xCoord;
|
||||
double y = posY + rot.yCoord;
|
||||
double z = posZ + rot.zCoord;
|
||||
double x = renderX + rot.xCoord;
|
||||
double y = renderY + rot.yCoord;
|
||||
double z = renderZ + rot.zCoord;
|
||||
seat.setPosition(x, y - 1, z);
|
||||
}
|
||||
}
|
||||
@ -174,10 +189,11 @@ public abstract class EntityRailCarRidable extends EntityRailCarCargo {
|
||||
public void updateRiderPosition() {
|
||||
|
||||
Vec3 offset = getRiderSeatPosition();
|
||||
offset.rotateAroundX((float) (this.rotationPitch * Math.PI / 180));
|
||||
offset.rotateAroundY((float) (-this.rotationYaw * Math.PI / 180));
|
||||
|
||||
if(this.riddenByEntity != null) {
|
||||
this.riddenByEntity.setPosition(this.posX + offset.xCoord, this.posY + offset.yCoord, this.posZ + offset.zCoord);
|
||||
this.riddenByEntity.setPosition(this.renderX + offset.xCoord, this.renderY + offset.yCoord, this.renderZ + offset.zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
@ -193,16 +209,17 @@ public abstract class EntityRailCarRidable extends EntityRailCarCargo {
|
||||
private double trainX;
|
||||
private double trainY;
|
||||
private double trainZ;
|
||||
public EntityRailCarBase train;
|
||||
public EntityRailCarRidable train;
|
||||
|
||||
public SeatDummyEntity(World world) { super(world); this.setSize(0.5F, 0.1F);}
|
||||
public SeatDummyEntity(World world, EntityRailCarBase train) {
|
||||
public SeatDummyEntity(World world, EntityRailCarRidable train, int index) {
|
||||
this(world);
|
||||
this.train = train;
|
||||
if(train != null) this.dataWatcher.updateObject(3, train.getEntityId());
|
||||
this.dataWatcher.updateObject(4, index);
|
||||
}
|
||||
|
||||
@Override protected void entityInit() { this.dataWatcher.addObject(3, new Integer(0)); }
|
||||
@Override protected void entityInit() { this.dataWatcher.addObject(3, new Integer(0)); this.dataWatcher.addObject(4, new Integer(0)); }
|
||||
@Override protected void writeEntityToNBT(NBTTagCompound nbt) { }
|
||||
@Override public boolean writeToNBTOptional(NBTTagCompound nbt) { return false; }
|
||||
@Override public void readEntityFromNBT(NBTTagCompound nbt) { this.setDead(); }
|
||||
@ -237,8 +254,43 @@ public abstract class EntityRailCarRidable extends EntityRailCarCargo {
|
||||
@Override
|
||||
public void updateRiderPosition() {
|
||||
if(this.riddenByEntity != null) {
|
||||
this.riddenByEntity.setPosition(this.posX, this.posY + 1, this.posZ);
|
||||
|
||||
if(train == null) {
|
||||
int eid = this.dataWatcher.getWatchableObjectInt(3);
|
||||
Entity entity = worldObj.getEntityByID(eid);
|
||||
if(entity instanceof EntityRailCarRidable) {
|
||||
train = (EntityRailCarRidable) entity;
|
||||
}
|
||||
}
|
||||
|
||||
//fallback for when train is null
|
||||
if(train == null) {
|
||||
this.riddenByEntity.setPosition(posX, posY + 1, posZ);
|
||||
return;
|
||||
}
|
||||
|
||||
//doing it like this instead of with the position directly removes any discrepancies caused by entity tick order
|
||||
//mmhmhmhm silky smooth
|
||||
int index = this.dataWatcher.getWatchableObjectInt(4);
|
||||
Vec3 rot = this.train.getPassengerSeats()[index];
|
||||
rot.rotateAroundX((float) (train.rotationPitch * Math.PI / 180));
|
||||
rot.rotateAroundY((float) (-train.rotationYaw * Math.PI / 180));
|
||||
double x = train.renderX + rot.xCoord;
|
||||
double y = train.renderY + rot.yCoord;
|
||||
double z = train.renderZ + rot.zCoord;
|
||||
this.riddenByEntity.setPosition(x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void printHook(RenderGameOverlayEvent.Pre event, World world, int x, int y, int z) {
|
||||
List<String> text = new ArrayList();
|
||||
/*text.add("LTU: " + this.ltu);
|
||||
text.add("Front: " + this.coupledFront);
|
||||
text.add("Back: " + this.coupledBack);*/
|
||||
text.add("Nearest seat: " + this.getNearestSeat(MainRegistry.proxy.me()));
|
||||
ILookOverlay.printGeneric(event, this.getClass().getSimpleName() + " " + this.hashCode(), 0xffff00, 0x404000, text);
|
||||
}
|
||||
}
|
||||
|
||||
@ -47,13 +47,17 @@ public class TrainCargoTram extends EntityRailCarElectric implements IGUIProvide
|
||||
@Override public double getPassivBrake() { return 0.95; }
|
||||
@Override public boolean shouldUseEngineBrake(EntityPlayer player) { return Math.abs(this.engineSpeed) < 0.1; }
|
||||
@Override public double getMaxPoweredSpeed() { return 0.5; }
|
||||
@Override public double getMaxRailSpeed() { return 1; }
|
||||
|
||||
@Override public TrackGauge getGauge() { return TrackGauge.STANDARD; }
|
||||
@Override public double getLengthSpan() { return 1.5; }
|
||||
@Override public Vec3 getRiderSeatPosition() { return Vec3.createVectorHelper(0.375, 2.25, 0.5); }
|
||||
@Override public double getCollisionSpan() { return 2.5; }
|
||||
@Override public Vec3 getRiderSeatPosition() { return Vec3.createVectorHelper(0.375, 2.375, 0.5); }
|
||||
@Override public boolean shouldRiderSit() { return false; }
|
||||
@Override public int getSizeInventory() { return 29; }
|
||||
@Override public String getInventoryName() { return this.hasCustomInventoryName() ? this.getEntityName() : "container.trainTram"; }
|
||||
//@Override public AxisAlignedBB getCollisionBox() { return AxisAlignedBB.getBoundingBox(renderX, renderY, renderZ, renderX, renderY + 1, renderZ).expand(4, 0, 4); }
|
||||
@Override public double getCouplingDist(TrainCoupling coupling) { return coupling != null ? 2.75 : 0; }
|
||||
|
||||
@Override public int getMaxPower() { return this.getPowerConsumption() * 100; }
|
||||
@Override public int getPowerConsumption() { return 10; }
|
||||
|
||||
183
src/main/java/com/hbm/entity/train/TrainCargoTramTrailer.java
Normal file
183
src/main/java/com/hbm/entity/train/TrainCargoTramTrailer.java
Normal file
@ -0,0 +1,183 @@
|
||||
package com.hbm.entity.train;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.blocks.rail.IRailNTM.TrackGauge;
|
||||
import com.hbm.inventory.gui.GuiInfoContainer;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
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 net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TrainCargoTramTrailer extends EntityRailCarCargo implements IGUIProvider {
|
||||
|
||||
/*
|
||||
*
|
||||
* <--
|
||||
*
|
||||
* _O\____________________________________________/O_
|
||||
* |____| |____|
|
||||
* \__________________________________________/
|
||||
* '( + )' '( + )'
|
||||
*
|
||||
*/
|
||||
|
||||
public TrainCargoTramTrailer(World world) {
|
||||
super(world);
|
||||
this.setSize(5F, 2F);
|
||||
}
|
||||
|
||||
@Override public double getMaxRailSpeed() { return 1; }
|
||||
@Override public TrackGauge getGauge() { return TrackGauge.STANDARD; }
|
||||
@Override public double getLengthSpan() { return 1.5; }
|
||||
@Override public double getCollisionSpan() { return 2.5; }
|
||||
@Override public int getSizeInventory() { return 45; }
|
||||
@Override public String getInventoryName() { return this.hasCustomInventoryName() ? this.getEntityName() : "container.trainTramTrailer"; }
|
||||
//@Override public AxisAlignedBB getCollisionBox() { return AxisAlignedBB.getBoundingBox(renderX, renderY, renderZ, renderX, renderY + 1, renderZ).expand(4, 0, 4); }
|
||||
@Override public double getCouplingDist(TrainCoupling coupling) { return coupling != null ? 2.75 : 0; }
|
||||
@Override public double getCurrentSpeed() { return 0; }
|
||||
|
||||
@Override
|
||||
public DummyConfig[] getDummies() {
|
||||
return new DummyConfig[] {
|
||||
new DummyConfig(2F, 1F, Vec3.createVectorHelper(0, 0, 1.5)),
|
||||
new DummyConfig(2F, 1F, Vec3.createVectorHelper(0, 0, 0)),
|
||||
new DummyConfig(2F, 1F, Vec3.createVectorHelper(0, 0, -1.5))
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attackEntityFrom(DamageSource source, float amount) {
|
||||
if(!this.worldObj.isRemote && !this.isDead) {
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean interactFirst(EntityPlayer player) {
|
||||
if(super.interactFirst(player)) return false;
|
||||
|
||||
if(!this.worldObj.isRemote) {
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, worldObj, this.getEntityId(), 0, 0);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new ContainerTrainCargoTramTrailer(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new GUITrainCargoTramTrailer(player.inventory, this);
|
||||
}
|
||||
|
||||
/*
|
||||
* ##### ##### # # ##### ##### ### # # ##### ####
|
||||
* # # # ## # # # # # ## # # # #
|
||||
* # # # # # # # ##### # # # # ### ####
|
||||
* # # # # ## # # # # # ## # # #
|
||||
* ##### ##### # # # # # ### # # ##### # #
|
||||
*/
|
||||
public static class ContainerTrainCargoTramTrailer extends Container {
|
||||
private TrainCargoTramTrailer train;
|
||||
public ContainerTrainCargoTramTrailer(InventoryPlayer invPlayer, TrainCargoTramTrailer train) {
|
||||
this.train = train;
|
||||
for(int i = 0; i < 5; i++) {
|
||||
for(int j = 0; j < 9; j++) {
|
||||
this.addSlotToContainer(new Slot(train, i * 9 + j, 8 + j * 18, 18 + 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, 140 + i * 18));
|
||||
}
|
||||
}
|
||||
for(int i = 0; i < 9; i++) {
|
||||
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 198));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slotIndex) {
|
||||
ItemStack stackCopy = null;
|
||||
Slot slot = (Slot) this.inventorySlots.get(slotIndex);
|
||||
if(slot != null && slot.getHasStack()) {
|
||||
ItemStack stack = slot.getStack();
|
||||
stackCopy = stack.copy();
|
||||
if(slotIndex < train.getSizeInventory()) {
|
||||
if(!this.mergeItemStack(stack, train.getSizeInventory(), this.inventorySlots.size(), true)) {
|
||||
return null;
|
||||
}
|
||||
} else
|
||||
if(!this.mergeItemStack(stack, 0, 45, false)) {
|
||||
return null;
|
||||
}
|
||||
if(stack.stackSize == 0) {
|
||||
slot.putStack((ItemStack) null);
|
||||
} else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
}
|
||||
return stackCopy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return train.isUseableByPlayer(player);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* ##### # # ###
|
||||
* # # # #
|
||||
* # ## # # #
|
||||
* # # # # #
|
||||
* ##### ##### ###
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static class GUITrainCargoTramTrailer extends GuiInfoContainer {
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/vehicles/gui_cargo_tram_trailer.png");
|
||||
private TrainCargoTramTrailer train;
|
||||
public GUITrainCargoTramTrailer(InventoryPlayer invPlayer, TrainCargoTramTrailer train) {
|
||||
super(new ContainerTrainCargoTramTrailer(invPlayer, train));
|
||||
this.train = train;
|
||||
this.xSize = 176;
|
||||
this.ySize = 222;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = this.train.hasCustomInventoryName() ? this.train.getInventoryName() : I18n.format(this.train.getInventoryName());
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 0xffffff);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float intero, int x, int y) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
package com.hbm.explosion.nt;
|
||||
|
||||
@Deprecated
|
||||
public interface IExplosionLogic {
|
||||
|
||||
public void updateLogic();
|
||||
|
||||
@ -10,6 +10,7 @@ import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@Deprecated
|
||||
public class Mark5 implements IExplosionLogic {
|
||||
|
||||
//holds rays after being calculated up to where the blocks get removed
|
||||
|
||||
@ -0,0 +1,36 @@
|
||||
package com.hbm.explosion.vanillant.standard;
|
||||
|
||||
import com.hbm.explosion.vanillant.ExplosionVNT;
|
||||
import com.hbm.explosion.vanillant.interfaces.IBlockMutator;
|
||||
import com.hbm.inventory.RecipesCommon.MetaBlock;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class BlockMutatorDebris implements IBlockMutator {
|
||||
|
||||
protected MetaBlock metaBlock;
|
||||
|
||||
public BlockMutatorDebris(Block block) {
|
||||
this(block, 0);
|
||||
}
|
||||
|
||||
public BlockMutatorDebris(Block block, int meta) {
|
||||
this.metaBlock = new MetaBlock(block, meta);
|
||||
}
|
||||
|
||||
@Override public void mutatePre(ExplosionVNT explosion, Block block, int meta, int x, int y, int z) { }
|
||||
|
||||
@Override public void mutatePost(ExplosionVNT explosion, int x, int y, int z) {
|
||||
|
||||
World world = explosion.world;
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
Block b = world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
|
||||
if(b.isNormalCube() && (b != metaBlock.block || world.getBlockMetadata(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ) != metaBlock.meta)) {
|
||||
world.setBlock(x, y, z, metaBlock.block, metaBlock.meta, 3);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -64,6 +64,8 @@ public class BlockProcessorStandard implements IBlockProcessor {
|
||||
|
||||
block.onBlockExploded(world, blockX, blockY, blockZ, explosion.compat);
|
||||
if(this.convert != null) this.convert.mutatePre(explosion, block, world.getBlockMetadata(blockX, blockY, blockZ), blockX, blockY, blockZ);
|
||||
} else {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@ import com.hbm.config.GeneralConfig;
|
||||
import com.hbm.config.MobConfig;
|
||||
import com.hbm.config.WorldConfig;
|
||||
import com.hbm.entity.mob.EntityFBI;
|
||||
import com.hbm.entity.mob.EntityFBIDrone;
|
||||
import com.hbm.entity.mob.EntityGhost;
|
||||
import com.hbm.entity.mob.EntityMaskMan;
|
||||
import com.hbm.entity.mob.EntityRADBeast;
|
||||
@ -97,6 +98,15 @@ public class BossSpawnHandler {
|
||||
|
||||
trySpawn(world, (float)spawnX, (float)spawnY, (float)spawnZ, new EntityFBI(world));
|
||||
}
|
||||
|
||||
for(int i = 0; i < MobConfig.raidDrones; i++) {
|
||||
|
||||
double spawnX = player.posX + vec.xCoord + world.rand.nextGaussian() * 5;
|
||||
double spawnZ = player.posZ + vec.zCoord + world.rand.nextGaussian() * 5;
|
||||
double spawnY = world.getHeightValue((int)spawnX, (int)spawnZ);
|
||||
|
||||
trySpawn(world, (float)spawnX, (float)spawnY + 10, (float)spawnZ, new EntityFBIDrone(world));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,6 +12,8 @@ import com.hbm.extprop.HbmLivingProps;
|
||||
import com.hbm.extprop.HbmPlayerProps;
|
||||
import com.hbm.extprop.HbmLivingProps.ContaminationEffect;
|
||||
import com.hbm.handler.HbmKeybinds.EnumKeybind;
|
||||
import com.hbm.handler.pollution.PollutionHandler;
|
||||
import com.hbm.handler.pollution.PollutionHandler.PollutionType;
|
||||
import com.hbm.handler.radiation.ChunkRadiationManager;
|
||||
import com.hbm.interfaces.IArmorModDash;
|
||||
import com.hbm.items.armor.ArmorFSB;
|
||||
@ -19,6 +21,7 @@ import com.hbm.lib.ModDamageSource;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.AuxParticlePacketNT;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.potion.HbmPotion;
|
||||
import com.hbm.packet.ExtPropPacket;
|
||||
import com.hbm.saveddata.AuxSavedData;
|
||||
import com.hbm.util.ArmorRegistry;
|
||||
@ -48,42 +51,40 @@ import net.minecraft.world.World;
|
||||
public class EntityEffectHandler {
|
||||
|
||||
public static void onUpdate(EntityLivingBase entity) {
|
||||
|
||||
|
||||
if(entity.ticksExisted % 20 == 0) {
|
||||
HbmLivingProps.setRadBuf(entity, HbmLivingProps.getRadEnv(entity));
|
||||
HbmLivingProps.setRadEnv(entity, 0);
|
||||
}
|
||||
|
||||
if(entity instanceof EntityPlayerMP) {
|
||||
HbmLivingProps props = HbmLivingProps.getData(entity);
|
||||
HbmPlayerProps pprps = HbmPlayerProps.getData((EntityPlayerMP) entity);
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
|
||||
if(pprps.shield < pprps.maxShield && entity.ticksExisted > pprps.lastDamage + 60) {
|
||||
int tsd = entity.ticksExisted - (pprps.lastDamage + 60);
|
||||
pprps.shield += Math.min(pprps.maxShield - pprps.shield, 0.005F * tsd);
|
||||
}
|
||||
|
||||
if(pprps.shield > pprps.maxShield)
|
||||
pprps.shield = pprps.maxShield;
|
||||
|
||||
props.saveNBTData(data);
|
||||
pprps.saveNBTData(data);
|
||||
PacketDispatcher.wrapper.sendTo(new ExtPropPacket(data), (EntityPlayerMP) entity);
|
||||
}
|
||||
|
||||
if(!entity.worldObj.isRemote) {
|
||||
|
||||
if(entity.ticksExisted % 20 == 0) {
|
||||
HbmLivingProps.setRadBuf(entity, HbmLivingProps.getRadEnv(entity));
|
||||
HbmLivingProps.setRadEnv(entity, 0);
|
||||
}
|
||||
|
||||
|
||||
if(entity instanceof EntityPlayerMP) {
|
||||
HbmLivingProps props = HbmLivingProps.getData(entity);
|
||||
HbmPlayerProps pprps = HbmPlayerProps.getData((EntityPlayerMP) entity);
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
|
||||
if(pprps.shield < pprps.maxShield && entity.ticksExisted > pprps.lastDamage + 60) {
|
||||
int tsd = entity.ticksExisted - (pprps.lastDamage + 60);
|
||||
pprps.shield += Math.min(pprps.maxShield - pprps.shield, 0.005F * tsd);
|
||||
}
|
||||
|
||||
if(pprps.shield > pprps.maxShield)
|
||||
pprps.shield = pprps.maxShield;
|
||||
|
||||
props.saveNBTData(data);
|
||||
pprps.saveNBTData(data);
|
||||
PacketDispatcher.wrapper.sendTo(new ExtPropPacket(data), (EntityPlayerMP) entity);
|
||||
}
|
||||
|
||||
int timer = HbmLivingProps.getTimer(entity);
|
||||
if(timer > 0) {
|
||||
HbmLivingProps.setTimer(entity, timer - 1);
|
||||
|
||||
|
||||
if(timer == 1) {
|
||||
ExplosionNukeSmall.explode(entity.worldObj, entity.posX, entity.posY, entity.posZ, ExplosionNukeSmall.PARAMS_MEDIUM);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(GeneralConfig.enable528 && entity instanceof EntityLivingBase && !entity.isImmuneToFire() && entity.worldObj.provider.isHellWorld) {
|
||||
entity.setFire(5);
|
||||
}
|
||||
@ -95,6 +96,7 @@ public class EntityEffectHandler {
|
||||
handleDigamma(entity);
|
||||
handleLungDisease(entity);
|
||||
handleOil(entity);
|
||||
handlePollution(entity);
|
||||
|
||||
handleDashing(entity);
|
||||
handlePlinking(entity);
|
||||
@ -122,13 +124,13 @@ public class EntityEffectHandler {
|
||||
|
||||
private static void handleRadiation(EntityLivingBase entity) {
|
||||
|
||||
if(ContaminationUtil.isRadImmune(entity))
|
||||
return;
|
||||
|
||||
World world = entity.worldObj;
|
||||
|
||||
if(!world.isRemote) {
|
||||
|
||||
if(ContaminationUtil.isRadImmune(entity))
|
||||
return;
|
||||
|
||||
int ix = (int)MathHelper.floor_double(entity.posX);
|
||||
int iy = (int)MathHelper.floor_double(entity.posY);
|
||||
int iz = (int)MathHelper.floor_double(entity.posZ);
|
||||
@ -365,8 +367,11 @@ public class EntityEffectHandler {
|
||||
|
||||
double blacklung = Math.min(HbmLivingProps.getBlackLung(entity), HbmLivingProps.maxBlacklung);
|
||||
double asbestos = Math.min(HbmLivingProps.getAsbestos(entity), HbmLivingProps.maxAsbestos);
|
||||
double soot = PollutionHandler.getPollution(entity.worldObj, (int) Math.floor(entity.posX), (int) Math.floor(entity.posY + entity.getEyeHeight()), (int) Math.floor(entity.posZ), PollutionType.SOOT);
|
||||
|
||||
boolean coughs = blacklung / HbmLivingProps.maxBlacklung > 0.25D || asbestos / HbmLivingProps.maxAsbestos > 0.25D;
|
||||
if(ArmorRegistry.hasProtection(entity, 3, HazardClass.PARTICLE_COARSE)) soot = 0;
|
||||
|
||||
boolean coughs = blacklung / HbmLivingProps.maxBlacklung > 0.25D || asbestos / HbmLivingProps.maxAsbestos > 0.25D || soot > 30;
|
||||
|
||||
if(!coughs)
|
||||
return;
|
||||
@ -377,11 +382,10 @@ public class EntityEffectHandler {
|
||||
|
||||
double blacklungDelta = 1D - (blacklung / (double)HbmLivingProps.maxBlacklung);
|
||||
double asbestosDelta = 1D - (asbestos / (double)HbmLivingProps.maxAsbestos);
|
||||
double sootDelta = 1D - Math.min(soot / 100, 1D);
|
||||
|
||||
double total = 1 - (blacklungDelta * asbestosDelta);
|
||||
|
||||
int freq = Math.max((int) (1000 - 950 * total), 20);
|
||||
|
||||
World world = entity.worldObj;
|
||||
|
||||
if(total > 0.75D) {
|
||||
@ -392,6 +396,9 @@ public class EntityEffectHandler {
|
||||
entity.addPotionEffect(new PotionEffect(Potion.confusion.id, 100, 0));
|
||||
}
|
||||
|
||||
total = 1 - (blacklungDelta * asbestosDelta * sootDelta);
|
||||
int freq = Math.max((int) (1000 - 950 * total), 20);
|
||||
|
||||
if(world.getTotalWorldTime() % freq == entity.getEntityId() % freq) {
|
||||
world.playSoundEffect(entity.posX, entity.posY, entity.posZ, "hbm:player.cough", 1.0F, 1.0F);
|
||||
|
||||
@ -416,6 +423,10 @@ public class EntityEffectHandler {
|
||||
}
|
||||
|
||||
private static void handleOil(EntityLivingBase entity) {
|
||||
|
||||
if(entity.worldObj.isRemote)
|
||||
return;
|
||||
|
||||
int oil = HbmLivingProps.getOil(entity);
|
||||
|
||||
if(oil > 0) {
|
||||
@ -438,6 +449,41 @@ public class EntityEffectHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private static void handlePollution(EntityLivingBase entity) {
|
||||
|
||||
if(!ArmorRegistry.hasProtection(entity, 3, HazardClass.GAS_CORROSIVE) && entity.ticksExisted % 60 == 0) {
|
||||
|
||||
float poison = PollutionHandler.getPollution(entity.worldObj, (int) Math.floor(entity.posX), (int) Math.floor(entity.posY + entity.getEyeHeight()), (int) Math.floor(entity.posZ), PollutionType.POISON);
|
||||
|
||||
if(poison > 10) {
|
||||
|
||||
if(poison < 25) {
|
||||
entity.addPotionEffect(new PotionEffect(Potion.poison.id, 100, 0));
|
||||
} else if(poison < 50) {
|
||||
entity.addPotionEffect(new PotionEffect(Potion.poison.id, 100, 2));
|
||||
} else {
|
||||
entity.addPotionEffect(new PotionEffect(Potion.wither.id, 100, 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!ArmorRegistry.hasProtection(entity, 3, HazardClass.PARTICLE_FINE) && entity.ticksExisted % 60 == 0) {
|
||||
|
||||
float poison = PollutionHandler.getPollution(entity.worldObj, (int) Math.floor(entity.posX), (int) Math.floor(entity.posY + entity.getEyeHeight()), (int) Math.floor(entity.posZ), PollutionType.HEAVYMETAL);
|
||||
|
||||
if(poison > 25) {
|
||||
|
||||
if(poison < 50) {
|
||||
entity.addPotionEffect(new PotionEffect(HbmPotion.lead.id, 100, 0));
|
||||
} else if(poison < 75) {
|
||||
entity.addPotionEffect(new PotionEffect(HbmPotion.lead.id, 100, 2));
|
||||
} else {
|
||||
entity.addPotionEffect(new PotionEffect(HbmPotion.lead.id, 100, 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void handleDashing(Entity entity) {
|
||||
|
||||
//AAAAAAAAAAAAAAAAAAAAEEEEEEEEEEEEEEEEEEEE
|
||||
@ -480,16 +526,7 @@ public class EntityEffectHandler {
|
||||
|
||||
int dashCount = armorDashCount + armorModDashCount;
|
||||
|
||||
boolean dashActivated = false;
|
||||
|
||||
|
||||
if(!GeneralConfig.enableCustomDashKeybind) {
|
||||
dashActivated = !player.capabilities.isFlying && player.isSneaking();
|
||||
} else {
|
||||
dashActivated = props.getKeyPressed(EnumKeybind.DASH);
|
||||
}
|
||||
|
||||
//System.out.println(dashCount);
|
||||
boolean dashActivated = props.getKeyPressed(EnumKeybind.DASH);
|
||||
|
||||
if(dashCount * 30 < props.getStamina())
|
||||
props.setStamina(dashCount * 30);
|
||||
|
||||
@ -22,7 +22,7 @@ public class HbmKeybinds {
|
||||
public static KeyBinding jetpackKey = new KeyBinding(category + ".toggleBack", Keyboard.KEY_C, category);
|
||||
public static KeyBinding hudKey = new KeyBinding(category + ".toggleHUD", Keyboard.KEY_V, category);
|
||||
public static KeyBinding reloadKey = new KeyBinding(category + ".reload", Keyboard.KEY_R, category);
|
||||
public static KeyBinding dashKey = new KeyBinding(category + ".dash", Keyboard.KEY_F, category);
|
||||
public static KeyBinding dashKey = new KeyBinding(category + ".dash", Keyboard.KEY_LSHIFT, category);
|
||||
public static KeyBinding trainKey = new KeyBinding(category + ".trainInv", Keyboard.KEY_R, category);
|
||||
|
||||
public static KeyBinding craneUpKey = new KeyBinding(category + ".craneMoveUp", Keyboard.KEY_UP, category);
|
||||
|
||||
@ -78,6 +78,8 @@ public class Gun20GaugeFactory {
|
||||
config.reloadSound = GunConfiguration.RSOUND_SHOTGUN;
|
||||
config.firingSound = "hbm:weapon.revolverShootAlt";
|
||||
config.firingPitch = 0.75F;
|
||||
config.hasSights = true;
|
||||
config.zoomFOV = 0.75F;
|
||||
|
||||
config.name = "win1887";
|
||||
config.manufacturer = EnumGunManufacturer.WINCHESTER;
|
||||
@ -95,6 +97,8 @@ public class Gun20GaugeFactory {
|
||||
config.reloadSound = GunConfiguration.RSOUND_SHOTGUN;
|
||||
config.firingSound = "hbm:weapon.revolverShootAlt";
|
||||
config.firingPitch = 0.75F;
|
||||
config.hasSights = true;
|
||||
config.zoomFOV = 0.75F;
|
||||
|
||||
config.name = "win1887Inox";
|
||||
config.manufacturer = EnumGunManufacturer.WINCHESTER;
|
||||
|
||||
@ -45,7 +45,7 @@ public class ChemplantRecipeHandler extends TemplateRecipeHandler {
|
||||
for(int i = 0; i < recipe.inputFluids.length; i++) {
|
||||
FluidStack in = recipe.inputFluids[i];
|
||||
if(in == null) continue;
|
||||
ItemStack drop = ItemFluidIcon.make(in.type, in.fill);
|
||||
ItemStack drop = ItemFluidIcon.make(in);
|
||||
this.fluidIn[i] = new PositionedStack(drop, 30 + (i % 2) * 18, 6);
|
||||
}
|
||||
|
||||
@ -58,7 +58,7 @@ public class ChemplantRecipeHandler extends TemplateRecipeHandler {
|
||||
for(int i = 0; i < recipe.outputFluids.length; i++) {
|
||||
FluidStack out = recipe.outputFluids[i];
|
||||
if(out == null) continue;
|
||||
ItemStack drop = ItemFluidIcon.make(out.type, out.fill);
|
||||
ItemStack drop = ItemFluidIcon.make(out);
|
||||
this.fluidOut[i] = new PositionedStack(drop, 120 + (i % 2) * 18, 6);
|
||||
}
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ package com.hbm.handler.nei;
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.inventory.material.Mats;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.util.ItemStackUtil;
|
||||
|
||||
@ -45,13 +46,13 @@ public class ConstructionHandler extends NEIUniversalHandler {
|
||||
/* ITER */
|
||||
ItemStack[] iter = new ItemStack[] {
|
||||
new ItemStack(ModBlocks.fusion_conductor, 36),
|
||||
new ItemStack(ModBlocks.fusion_conductor, 64),
|
||||
new ItemStack(ModBlocks.fusion_conductor, 64),
|
||||
new ItemStack(ModBlocks.fusion_conductor, 64),
|
||||
new ItemStack(ModBlocks.fusion_conductor, 64),
|
||||
ItemStackUtil.addTooltipToStack(new ItemStack(ModBlocks.fusion_conductor, 320), EnumChatFormatting.RED + "5x64"),
|
||||
new ItemStack(ModItems.plate_cast, 36, Mats.MAT_STEEL.id),
|
||||
ItemStackUtil.addTooltipToStack(new ItemStack(ModItems.plate_cast, 320, Mats.MAT_STEEL.id), EnumChatFormatting.RED + "5x64"),
|
||||
new ItemStack(ModBlocks.fusion_center, 64),
|
||||
new ItemStack(ModBlocks.fusion_motor, 4),
|
||||
new ItemStack(ModBlocks.reinforced_glass, 8)};
|
||||
new ItemStack(ModBlocks.reinforced_glass, 8),
|
||||
new ItemStack(ModItems.blowtorch)};
|
||||
|
||||
bufferedRecipes.put(iter, new ItemStack(ModBlocks.iter));
|
||||
bufferedTools.put(iter, new ItemStack(ModBlocks.struct_iter_core));
|
||||
|
||||
@ -35,8 +35,8 @@ public class CrucibleAlloyingHandler extends TemplateRecipeHandler {
|
||||
public RecipeSet(CrucibleRecipe recipe) {
|
||||
List<ItemStack> inputs = new ArrayList();
|
||||
List<ItemStack> outputs = new ArrayList();
|
||||
for(MaterialStack stack : recipe.input) inputs.add(ItemScraps.create(stack));
|
||||
for(MaterialStack stack : recipe.output) outputs.add(ItemScraps.create(stack));
|
||||
for(MaterialStack stack : recipe.input) inputs.add(ItemScraps.create(stack, true));
|
||||
for(MaterialStack stack : recipe.output) outputs.add(ItemScraps.create(stack, true));
|
||||
|
||||
this.template = new PositionedStack(new ItemStack(ModItems.crucible_template, 1, recipe.getId()), 75, 6);
|
||||
this.crucible = new PositionedStack(new ItemStack(ModBlocks.machine_crucible), 75, 42);
|
||||
|
||||
312
src/main/java/com/hbm/handler/pollution/PollutionHandler.java
Normal file
312
src/main/java/com/hbm/handler/pollution/PollutionHandler.java
Normal file
@ -0,0 +1,312 @@
|
||||
package com.hbm.handler.pollution;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.entity.monster.IMob;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.ChunkCoordIntPair;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.event.entity.living.LivingSpawnEvent;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
|
||||
public class PollutionHandler {
|
||||
|
||||
public static final String fileName = "hbmpollution.dat";
|
||||
public static HashMap<World, PollutionPerWorld> perWorld = new HashMap();
|
||||
|
||||
/** Baserate of soot generation for a furnace-equivalent machine per second */
|
||||
public static final float SOOT_PER_SECOND = 1F / 25F;
|
||||
/** Baserate of heavy metal generation, balanced around the soot values of combustion engines */
|
||||
public static final float HEAVY_METAL_PER_SECOND = 1F / 50F;
|
||||
|
||||
///////////////////////
|
||||
/// UTILITY METHODS ///
|
||||
///////////////////////
|
||||
public static void incrementPollution(World world, int x, int y, int z, PollutionType type, float amount) {
|
||||
PollutionPerWorld ppw = perWorld.get(world);
|
||||
if(ppw == null) return;
|
||||
ChunkCoordIntPair pos = new ChunkCoordIntPair(x >> 6, z >> 6);
|
||||
PollutionData data = ppw.pollution.get(pos);
|
||||
if(data == null) {
|
||||
data = new PollutionData();
|
||||
ppw.pollution.put(pos, data);
|
||||
}
|
||||
data.pollution[type.ordinal()] = MathHelper.clamp_float(data.pollution[type.ordinal()] + amount, 0F, 10_000F);
|
||||
}
|
||||
|
||||
public static void decrementPollution(World world, int x, int y, int z, PollutionType type, float amount) {
|
||||
incrementPollution(world, x, y, z, type, -amount);
|
||||
}
|
||||
|
||||
public static void setPollution(World world, int x, int y, int z, PollutionType type, float amount) {
|
||||
PollutionPerWorld ppw = perWorld.get(world);
|
||||
if(ppw == null) return;
|
||||
ChunkCoordIntPair pos = new ChunkCoordIntPair(x >> 6, z >> 6);
|
||||
PollutionData data = ppw.pollution.get(pos);
|
||||
if(data == null) {
|
||||
data = new PollutionData();
|
||||
ppw.pollution.put(pos, data);
|
||||
}
|
||||
data.pollution[type.ordinal()] = amount;
|
||||
}
|
||||
|
||||
public static float getPollution(World world, int x, int y, int z, PollutionType type) {
|
||||
PollutionPerWorld ppw = perWorld.get(world);
|
||||
if(ppw == null) return 0F;
|
||||
ChunkCoordIntPair pos = new ChunkCoordIntPair(x >> 6, z >> 6);
|
||||
PollutionData data = ppw.pollution.get(pos);
|
||||
if(data == null) return 0F;
|
||||
return data.pollution[type.ordinal()];
|
||||
}
|
||||
|
||||
public static PollutionData getPollutionData(World world, int x, int y, int z) {
|
||||
PollutionPerWorld ppw = perWorld.get(world);
|
||||
if(ppw == null) return null;
|
||||
ChunkCoordIntPair pos = new ChunkCoordIntPair(x >> 6, z >> 6);
|
||||
PollutionData data = ppw.pollution.get(pos);
|
||||
return data;
|
||||
}
|
||||
|
||||
//////////////////////
|
||||
/// EVENT HANDLING ///
|
||||
//////////////////////
|
||||
@SubscribeEvent
|
||||
public void onWorldLoad(WorldEvent.Load event) {
|
||||
if(!event.world.isRemote) {
|
||||
WorldServer world = (WorldServer) event.world;
|
||||
String dirPath = getDataDir(world);
|
||||
|
||||
try {
|
||||
File pollutionFile = new File(dirPath, fileName);
|
||||
|
||||
if(pollutionFile != null) {
|
||||
|
||||
if(pollutionFile.exists()) {
|
||||
FileInputStream io = new FileInputStream(pollutionFile);
|
||||
NBTTagCompound data = CompressedStreamTools.readCompressed(io);
|
||||
io.close();
|
||||
perWorld.put(event.world, new PollutionPerWorld(data));
|
||||
} else {
|
||||
perWorld.put(event.world, new PollutionPerWorld());
|
||||
}
|
||||
}
|
||||
} catch(Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onWorldUnload(WorldEvent.Unload event) {
|
||||
if(!event.world.isRemote) perWorld.remove(event.world);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onWorldSave(WorldEvent.Save event) {
|
||||
if(!event.world.isRemote) {
|
||||
WorldServer world = (WorldServer) event.world;
|
||||
String dirPath = getDataDir(world);
|
||||
File pollutionFile = new File(dirPath, fileName);
|
||||
|
||||
try {
|
||||
if(!pollutionFile.getParentFile().exists()) pollutionFile.getParentFile().mkdirs();
|
||||
if(!pollutionFile.exists()) pollutionFile.createNewFile();
|
||||
NBTTagCompound data = perWorld.get(world).writeToNBT();
|
||||
CompressedStreamTools.writeCompressed(data, new FileOutputStream(pollutionFile));
|
||||
} catch(Exception ex) {
|
||||
System.out.println("Failed to write " + pollutionFile.getAbsolutePath());
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getDataDir(WorldServer world) {
|
||||
String dir = world.getSaveHandler().getWorldDirectory().getAbsolutePath();
|
||||
if(world.provider.dimensionId != 0) {
|
||||
dir += File.separator + "DIM" + world.provider.dimensionId;
|
||||
}
|
||||
dir += File.separator + "data";
|
||||
return dir;
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
/// SYSTEM UPDATE LOOP ///
|
||||
//////////////////////////
|
||||
int eggTimer = 0;
|
||||
@SubscribeEvent
|
||||
public void updateSystem(TickEvent.ServerTickEvent event) {
|
||||
|
||||
if(event.side == Side.SERVER && event.phase == Phase.END) {
|
||||
|
||||
eggTimer++;
|
||||
if(eggTimer < 60) return;
|
||||
eggTimer = 0;
|
||||
|
||||
for(Entry<World, PollutionPerWorld> entry : perWorld.entrySet()) {
|
||||
HashMap<ChunkCoordIntPair, PollutionData> newPollution = new HashMap();
|
||||
|
||||
for(Entry<ChunkCoordIntPair, PollutionData> chunk : entry.getValue().pollution.entrySet()) {
|
||||
int x = chunk.getKey().chunkXPos;
|
||||
int z = chunk.getKey().chunkZPos;
|
||||
PollutionData data = chunk.getValue();
|
||||
|
||||
float[] pollutionForNeightbors = new float[PollutionType.values().length];
|
||||
int S = PollutionType.SOOT.ordinal();
|
||||
int H = PollutionType.HEAVYMETAL.ordinal();
|
||||
int P = PollutionType.POISON.ordinal();
|
||||
|
||||
/* CALCULATION */
|
||||
if(data.pollution[S] > 15) {
|
||||
pollutionForNeightbors[S] = data.pollution[S] * 0.05F;
|
||||
data.pollution[S] *= 0.8F;
|
||||
} else {
|
||||
data.pollution[S] *= 0.99F;
|
||||
}
|
||||
|
||||
data.pollution[H] *= 0.9995F;
|
||||
|
||||
if(data.pollution[P] > 10) {
|
||||
pollutionForNeightbors[P] = data.pollution[P] * 0.025F;
|
||||
data.pollution[P] *= 0.9F;
|
||||
} else {
|
||||
data.pollution[P] *= 0.995F;
|
||||
}
|
||||
|
||||
/* SPREADING */
|
||||
//apply new data to self
|
||||
PollutionData newData = newPollution.get(chunk.getKey());
|
||||
if(newData == null) newData = new PollutionData();
|
||||
|
||||
boolean shouldPut = false;
|
||||
for(int i = 0; i < newData.pollution.length; i++) {
|
||||
newData.pollution[i] += data.pollution[i];
|
||||
if(newData.pollution[i] > 0) shouldPut = true;
|
||||
}
|
||||
if(shouldPut) newPollution.put(chunk.getKey(), newData);
|
||||
|
||||
//apply neighbor data to neighboring chunks
|
||||
int[][] offsets = new int[][] {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
|
||||
for(int[] offset : offsets) {
|
||||
ChunkCoordIntPair offPos = new ChunkCoordIntPair(x + offset[0], z + offset[1]);
|
||||
PollutionData offsetData = newPollution.get(offPos);
|
||||
if(offsetData == null) offsetData = new PollutionData();
|
||||
|
||||
shouldPut = false;
|
||||
for(int i = 0; i < offsetData.pollution.length; i++) {
|
||||
offsetData.pollution[i] += pollutionForNeightbors[i];
|
||||
if(offsetData.pollution[i] > 0) shouldPut = true;
|
||||
}
|
||||
if(shouldPut) newPollution.put(offPos, offsetData);
|
||||
}
|
||||
}
|
||||
|
||||
entry.getValue().pollution.clear();
|
||||
entry.getValue().pollution.putAll(newPollution);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////
|
||||
/// DATA STRUCTURE ///
|
||||
//////////////////////
|
||||
public static class PollutionPerWorld {
|
||||
public HashMap<ChunkCoordIntPair, PollutionData> pollution = new HashMap();
|
||||
|
||||
public PollutionPerWorld() { }
|
||||
|
||||
public PollutionPerWorld(NBTTagCompound data) {
|
||||
|
||||
NBTTagList list = data.getTagList("entries", 10);
|
||||
|
||||
for(int i = 0; i < list.tagCount(); i++) {
|
||||
NBTTagCompound nbt = list.getCompoundTagAt(i);
|
||||
int chunkX = nbt.getInteger("chunkX");
|
||||
int chunkZ = nbt.getInteger("chunkZ");
|
||||
pollution.put(new ChunkCoordIntPair(chunkX, chunkZ), PollutionData.fromNBT(nbt));
|
||||
}
|
||||
}
|
||||
|
||||
public NBTTagCompound writeToNBT() {
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
|
||||
NBTTagList list = new NBTTagList();
|
||||
|
||||
for(Entry<ChunkCoordIntPair, PollutionData> entry : pollution.entrySet()) {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
nbt.setInteger("chunkX", entry.getKey().chunkXPos);
|
||||
nbt.setInteger("chunkZ", entry.getKey().chunkZPos);
|
||||
entry.getValue().toNBT(nbt);
|
||||
list.appendTag(nbt);
|
||||
}
|
||||
|
||||
data.setTag("entries", list);
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
public static class PollutionData {
|
||||
public float[] pollution = new float[PollutionType.values().length];
|
||||
|
||||
public static PollutionData fromNBT(NBTTagCompound nbt) {
|
||||
PollutionData data = new PollutionData();
|
||||
|
||||
for(int i = 0; i < PollutionType.values().length; i++) {
|
||||
data.pollution[i] = nbt.getFloat(PollutionType.values()[i].name().toLowerCase(Locale.US));
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public void toNBT(NBTTagCompound nbt) {
|
||||
for(int i = 0; i < PollutionType.values().length; i++) {
|
||||
nbt.setFloat(PollutionType.values()[i].name().toLowerCase(Locale.US), pollution[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static enum PollutionType {
|
||||
SOOT, POISON, HEAVYMETAL, FALLOUT;
|
||||
}
|
||||
|
||||
///////////////////
|
||||
/// MOB EFFECTS ///
|
||||
///////////////////
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void decorateMob(LivingSpawnEvent event) {
|
||||
|
||||
World world = event.world;
|
||||
if(world.isRemote) return;
|
||||
EntityLivingBase living = event.entityLiving;
|
||||
|
||||
PollutionData data = getPollutionData(world, (int) Math.floor(event.x), (int) Math.floor(event.y), (int) Math.floor(event.z));
|
||||
if(data == null) return;
|
||||
|
||||
if(living instanceof IMob) {
|
||||
|
||||
if(data.pollution[PollutionType.SOOT.ordinal()] > 15) {
|
||||
if(living.getEntityAttribute(SharedMonsterAttributes.maxHealth) != null) living.getEntityAttribute(SharedMonsterAttributes.maxHealth).applyModifier(new AttributeModifier("Soot Anger Health Increase", 2D, 1));
|
||||
if(living.getEntityAttribute(SharedMonsterAttributes.attackDamage) != null) living.getEntityAttribute(SharedMonsterAttributes.attackDamage).applyModifier(new AttributeModifier("Soot Anger Damage Increase", 1.5D, 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6,7 +6,6 @@ import com.hbm.config.RadiationConfig;
|
||||
import com.hbm.hazard.modifier.HazardModifier;
|
||||
import com.hbm.util.I18nUtil;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@ -33,7 +32,7 @@ public class HazardTypeHydroactive extends HazardTypeBase {
|
||||
if(RadiationConfig.disableHydro)
|
||||
return;
|
||||
|
||||
if(item.worldObj.getBlock((int)Math.floor(item.posX), (int)Math.floor(item.posY), (int)Math.floor(item.posZ)).getMaterial() == Material.water) {
|
||||
if(item.isWet()) {
|
||||
item.setDead();
|
||||
item.worldObj.newExplosion(null, item.posX, item.posY + item.height * 0.5, item.posZ, level, false, true);
|
||||
}
|
||||
|
||||
@ -22,6 +22,7 @@ public class FluidContainerRegistry {
|
||||
|
||||
public static void register() {
|
||||
FluidContainerRegistry.registerContainer(new FluidContainer(new ItemStack(Items.water_bucket), new ItemStack(Items.bucket), Fluids.WATER, 1000));
|
||||
FluidContainerRegistry.registerContainer(new FluidContainer(new ItemStack(Items.potionitem), new ItemStack(Items.glass_bottle), Fluids.WATER, 250));
|
||||
FluidContainerRegistry.registerContainer(new FluidContainer(new ItemStack(Items.lava_bucket), new ItemStack(Items.bucket), Fluids.LAVA, 1000));
|
||||
FluidContainerRegistry.registerContainer(new FluidContainer(new ItemStack(ModItems.bucket_mud), new ItemStack(Items.bucket), Fluids.WATZ, 1000));
|
||||
FluidContainerRegistry.registerContainer(new FluidContainer(new ItemStack(ModItems.bucket_schrabidic_acid), new ItemStack(Items.bucket), Fluids.SCHRABIDIC, 1000));
|
||||
|
||||
@ -3,9 +3,10 @@ package com.hbm.inventory;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
|
||||
public class FluidStack {
|
||||
|
||||
public int fill;
|
||||
|
||||
public FluidType type;
|
||||
public int fill;
|
||||
public int pressure;
|
||||
|
||||
public FluidStack(int fill, FluidType type) {
|
||||
this.fill = fill;
|
||||
@ -13,7 +14,12 @@ public class FluidStack {
|
||||
}
|
||||
|
||||
public FluidStack(FluidType type, int fill) {
|
||||
this(type, fill, 0);
|
||||
}
|
||||
|
||||
public FluidStack(FluidType type, int fill, int pressure) {
|
||||
this.fill = fill;
|
||||
this.type = type;
|
||||
this.pressure = pressure;
|
||||
}
|
||||
}
|
||||
|
||||
@ -92,6 +92,7 @@ public class OreDictManager {
|
||||
public static final String KEY_TOOL_SCREWDRIVER = "ntmscrewdriver";
|
||||
public static final String KEY_TOOL_HANDDRILL = "ntmhanddrill";
|
||||
public static final String KEY_TOOL_CHEMISTRYSET = "ntmchemistryset";
|
||||
public static final String KEY_TOOL_TORCH = "ntmtorch";
|
||||
|
||||
public static final String KEY_CIRCUIT_BISMUTH = "circuitVersatile";
|
||||
|
||||
@ -209,6 +210,7 @@ public class OreDictManager {
|
||||
public static final DictFrame LIGCOKE = new DictFrame("LigniteCoke");
|
||||
public static final DictFrame CINNABAR = new DictFrame("Cinnabar");
|
||||
public static final DictFrame BORAX = new DictFrame("Borax");
|
||||
public static final DictFrame CHLOROCALCITE = new DictFrame("Chlorocalcite");
|
||||
public static final DictFrame VOLCANIC = new DictFrame("Volcanic");
|
||||
public static final DictFrame HEMATITE = new DictFrame("Hematite");
|
||||
public static final DictFrame MALACHITE = new DictFrame("Malachite");
|
||||
@ -345,13 +347,13 @@ public class OreDictManager {
|
||||
W .ingot(ingot_tungsten) .dust(powder_tungsten) .block(block_tungsten) .ore(ore_tungsten, ore_nether_tungsten, ore_meteor_tungsten) .oreNether(ore_nether_tungsten);
|
||||
AL .ingot(ingot_aluminium) .dust(powder_aluminium) .plate(plate_aluminium) .block(block_aluminium) .ore(ore_aluminium, ore_meteor_aluminium);
|
||||
STEEL .ingot(ingot_steel) .dustSmall(powder_steel_tiny) .dust(powder_steel) .plate(plate_steel) .block(block_steel);
|
||||
TCALLOY .ingot(ingot_tcalloy) .dust(powder_tcalloy);
|
||||
CDALLOY .ingot(ingot_cdalloy);
|
||||
TCALLOY .ingot(ingot_tcalloy) .dust(powder_tcalloy) .block(block_tcalloy);
|
||||
CDALLOY .ingot(ingot_cdalloy) .block(block_cdalloy);
|
||||
PB .nugget(nugget_lead) .ingot(ingot_lead) .dust(powder_lead) .plate(plate_lead) .block(block_lead) .ore(ore_lead, ore_meteor_lead);
|
||||
BI .nugget(nugget_bismuth) .ingot(ingot_bismuth) .dust(powder_bismuth);
|
||||
AS .nugget(nugget_arsenic) .ingot(ingot_arsenic);
|
||||
CA .ingot(ingot_calcium) .dust(powder_calcium);
|
||||
CD .ingot(ingot_cadmium) .dust(powder_cadmium);
|
||||
CD .ingot(ingot_cadmium) .dust(powder_cadmium) .block(block_cadmium);
|
||||
TA .nugget(nugget_tantalium) .gem(gem_tantalium) .ingot(ingot_tantalium) .dust(powder_tantalium) .block(block_tantalium);
|
||||
COLTAN .ingot(fragment_coltan) .dust(powder_coltan_ore) .block(block_coltan) .ore(ore_coltan);
|
||||
NB .nugget(fragment_niobium) .ingot(ingot_niobium) .dustSmall(powder_niobium_tiny) .dust(powder_niobium) .block(block_niobium);
|
||||
@ -390,6 +392,7 @@ public class OreDictManager {
|
||||
LIGCOKE .gem(fromOne(coke, EnumCokeType.LIGNITE)) .block(fromOne(block_coke, EnumCokeType.LIGNITE));
|
||||
CINNABAR .crystal(cinnebar) .gem(cinnebar) .ore(ore_cinnebar, ore_depth_cinnebar);
|
||||
BORAX .dust(powder_borax) .ore(ore_depth_borax);
|
||||
CHLOROCALCITE .dust(powder_chlorocalcite);
|
||||
VOLCANIC .gem(gem_volcanic) .ore(basalt_gem);
|
||||
HEMATITE .ore(fromOne(stone_resource, EnumStoneType.HEMATITE));
|
||||
MALACHITE .ore(fromOne(stone_resource, EnumStoneType.MALACHITE));
|
||||
@ -452,6 +455,7 @@ public class OreDictManager {
|
||||
ANY_HIGHEXPLOSIVE .ingot(ball_tnt).ingot(ball_tatb);
|
||||
ANY_CONCRETE .any(concrete, concrete_smooth, concrete_asbestos, ducrete, ducrete_smooth);
|
||||
for(int i = 0; i < 16; i++) { ANY_CONCRETE.any(new ItemStack(ModBlocks.concrete_colored, 1, i)); }
|
||||
for(int i = 0; i < 16; i++) { ANY_CONCRETE.any(new ItemStack(ModBlocks.concrete_colored_ext, 1, i)); }
|
||||
ANY_COKE .gem(fromAll(coke, EnumCokeType.class)).block(fromAll(block_coke, EnumCokeType.class));
|
||||
ANY_BISMOID .ingot(ingot_bismuth, ingot_arsenic).nugget(nugget_bismuth, nugget_arsenic).block(block_bismuth);
|
||||
|
||||
@ -479,6 +483,8 @@ public class OreDictManager {
|
||||
OreDictionary.registerOre(KEY_TOOL_HANDDRILL, new ItemStack(hand_drill_desh, 1, OreDictionary.WILDCARD_VALUE));
|
||||
OreDictionary.registerOre(KEY_TOOL_CHEMISTRYSET, new ItemStack(chemistry_set, 1, OreDictionary.WILDCARD_VALUE));
|
||||
OreDictionary.registerOre(KEY_TOOL_CHEMISTRYSET, new ItemStack(chemistry_set_boron, 1, OreDictionary.WILDCARD_VALUE));
|
||||
OreDictionary.registerOre(KEY_TOOL_TORCH, new ItemStack(blowtorch, 1, OreDictionary.WILDCARD_VALUE));
|
||||
OreDictionary.registerOre(KEY_TOOL_TORCH, new ItemStack(acetylene_torch, 1, OreDictionary.WILDCARD_VALUE));
|
||||
|
||||
/*
|
||||
* CIRCUITS
|
||||
@ -568,6 +574,8 @@ public class OreDictManager {
|
||||
OreDictionary.registerOre("blockGlassLime", glass_trinitite);
|
||||
OreDictionary.registerOre("blockGlassRed", glass_polonium);
|
||||
OreDictionary.registerOre("blockGlassBlack", glass_ash);
|
||||
|
||||
OreDictionary.registerOre("container1000lubricant", bdcl);
|
||||
|
||||
MaterialShapes.registerCompatShapes();
|
||||
}
|
||||
|
||||
@ -169,7 +169,6 @@ public class RecipesCommon {
|
||||
String[] entries = new String[ids.length];
|
||||
|
||||
for(int i = 0; i < ids.length; i++) {
|
||||
|
||||
entries[i] = OreDictionary.getOreName(ids[i]);
|
||||
}
|
||||
|
||||
|
||||
@ -1,13 +1,10 @@
|
||||
package com.hbm.inventory;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.util.AchievementHandler;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class SlotCraftingOutput extends Slot {
|
||||
@ -27,40 +24,7 @@ public class SlotCraftingOutput extends Slot {
|
||||
|
||||
//ugly but nothing to be done
|
||||
public static void checkAchievements(EntityPlayer player, ItemStack stack) {
|
||||
Item item = stack.getItem();
|
||||
|
||||
if(item == Item.getItemFromBlock(ModBlocks.machine_chemplant))
|
||||
player.triggerAchievement(MainRegistry.achChemplant);
|
||||
if(item == Item.getItemFromBlock(ModBlocks.concrete_smooth) || item == Item.getItemFromBlock(ModBlocks.concrete_asbestos))
|
||||
player.triggerAchievement(MainRegistry.achConcrete);
|
||||
if(item == ModItems.ingot_polymer)
|
||||
player.triggerAchievement(MainRegistry.achPolymer);
|
||||
if(item == ModItems.ingot_desh)
|
||||
player.triggerAchievement(MainRegistry.achDesh);
|
||||
if(item == ModItems.gem_tantalium)
|
||||
player.triggerAchievement(MainRegistry.achTantalum);
|
||||
if(item == Item.getItemFromBlock(ModBlocks.machine_gascent))
|
||||
player.triggerAchievement(MainRegistry.achGasCent);
|
||||
if(item == Item.getItemFromBlock(ModBlocks.machine_centrifuge))
|
||||
player.triggerAchievement(MainRegistry.achCentrifuge);
|
||||
if(item == ModItems.ingot_schrabidium || item == ModItems.nugget_schrabidium)
|
||||
player.triggerAchievement(MainRegistry.achSchrab);
|
||||
if(item == Item.getItemFromBlock(ModBlocks.machine_crystallizer))
|
||||
player.triggerAchievement(MainRegistry.achAcidizer);
|
||||
if(item == Item.getItemFromBlock(ModBlocks.machine_silex))
|
||||
player.triggerAchievement(MainRegistry.achSILEX);
|
||||
if(item == ModItems.nugget_technetium)
|
||||
player.triggerAchievement(MainRegistry.achTechnetium);
|
||||
if(item == Item.getItemFromBlock(ModBlocks.watz_core))
|
||||
player.triggerAchievement(MainRegistry.achWatz);
|
||||
if(item == ModItems.nugget_bismuth)
|
||||
player.triggerAchievement(MainRegistry.achBismuth);
|
||||
if(item == ModItems.nugget_am241 || item == ModItems.nugget_am242)
|
||||
player.triggerAchievement(MainRegistry.achBreeding);
|
||||
if(item == ModItems.missile_nuclear || item == ModItems.missile_nuclear_cluster || item == ModItems.missile_doomsday || item == ModItems.mp_warhead_10_nuclear || item == ModItems.mp_warhead_10_nuclear_large || item == ModItems.mp_warhead_15_nuclear || item == ModItems.mp_warhead_15_nuclear_shark || item == ModItems.mp_warhead_15_boxcar)
|
||||
player.triggerAchievement(MainRegistry.achRedBalloons);
|
||||
if(item == Item.getItemFromBlock(ModBlocks.struct_iter_core))
|
||||
player.triggerAchievement(MainRegistry.achFusion);
|
||||
AchievementHandler.fire(player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -0,0 +1,83 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.items.machine.IItemFluidIdentifier;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineCompressor;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
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;
|
||||
|
||||
public class ContainerCompressor extends Container {
|
||||
|
||||
private TileEntityMachineCompressor compressor;
|
||||
|
||||
public ContainerCompressor(InventoryPlayer playerInv, TileEntityMachineCompressor tile) {
|
||||
compressor = tile;
|
||||
|
||||
//Fluid ID
|
||||
this.addSlotToContainer(new Slot(tile, 0, 17, 72));
|
||||
//Battery
|
||||
this.addSlotToContainer(new Slot(tile, 1, 152, 72));
|
||||
//Upgrades
|
||||
this.addSlotToContainer(new Slot(tile, 2, 52, 72));
|
||||
this.addSlotToContainer(new Slot(tile, 3, 70, 72));
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
for(int j = 0; j < 9; j++) {
|
||||
this.addSlotToContainer(new Slot(playerInv, j + i * 9 + 9, 8 + j * 18, 122 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
this.addSlotToContainer(new Slot(playerInv, i, 8 + i * 18, 180));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return compressor.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||
ItemStack var3 = null;
|
||||
Slot var4 = (Slot) this.inventorySlots.get(index);
|
||||
|
||||
if(var4 != null && var4.getHasStack()) {
|
||||
ItemStack var5 = var4.getStack();
|
||||
var3 = var5.copy();
|
||||
|
||||
if(index < 4) {
|
||||
if(!this.mergeItemStack(var5, 4, this.inventorySlots.size(), true)) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
|
||||
if(var3.getItem() instanceof IBatteryItem) {
|
||||
if(!this.mergeItemStack(var5, 1, 2, false)) {
|
||||
return null;
|
||||
}
|
||||
} else if(var3.getItem() instanceof IItemFluidIdentifier) {
|
||||
if(!this.mergeItemStack(var5, 0, 1, false)) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
if(!this.mergeItemStack(var5, 2, 4, false)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(var5.stackSize == 0) {
|
||||
var4.putStack((ItemStack) null);
|
||||
} else {
|
||||
var4.onSlotChanged();
|
||||
}
|
||||
}
|
||||
|
||||
return var3;
|
||||
}
|
||||
}
|
||||
@ -48,7 +48,7 @@ public class FluidType {
|
||||
public double compression = DEFAULT_COMPRESSION;
|
||||
|
||||
public HashMap<Class, Object> containers = new HashMap();
|
||||
private HashMap<Class<? extends FluidTrait>, FluidTrait> traits = new HashMap();
|
||||
public HashMap<Class<? extends FluidTrait>, FluidTrait> traits = new HashMap();
|
||||
//public List<EnumFluidTrait> enumTraits = new ArrayList();
|
||||
|
||||
private ResourceLocation texture;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user