mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
commit
79b08d8cdc
@ -4,7 +4,10 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import com.hbm.main.MainRegistry;
|
import com.hbm.main.MainRegistry;
|
||||||
|
import com.hbm.world.gen.component.Component;
|
||||||
|
import com.hbm.world.gen.component.SiloComponent;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
@ -17,6 +20,7 @@ import net.minecraft.util.AxisAlignedBB;
|
|||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.util.Vec3;
|
import net.minecraft.util.Vec3;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.gen.structure.StructureBoundingBox;
|
||||||
|
|
||||||
public class TestEventTester extends Block {
|
public class TestEventTester extends Block {
|
||||||
|
|
||||||
@ -35,6 +39,9 @@ public class TestEventTester extends Block {
|
|||||||
this.worldObj = p_149695_1_;
|
this.worldObj = p_149695_1_;
|
||||||
if (p_149695_1_.isBlockIndirectlyGettingPowered(x1, y1, z1))
|
if (p_149695_1_.isBlockIndirectlyGettingPowered(x1, y1, z1))
|
||||||
{
|
{
|
||||||
|
/*Component comp = new SiloComponent(this.worldObj.rand, x1, y1, z1);
|
||||||
|
comp.addComponentParts(p_149695_1_, this.worldObj.rand, comp.getBoundingBox());*/
|
||||||
|
|
||||||
//The laser thread is too dangerous to use right now
|
//The laser thread is too dangerous to use right now
|
||||||
//ThreadLaser laser = new ThreadLaser(p_149695_1_, x, y, z, "north");
|
//ThreadLaser laser = new ThreadLaser(p_149695_1_, x, y, z, "north");
|
||||||
//laser.start();
|
//laser.start();
|
||||||
|
|||||||
@ -46,7 +46,9 @@ public class ItemStructurePattern extends ItemStructureTool {
|
|||||||
for(int iy = minY; iy <= maxY; iy++) {
|
for(int iy = minY; iy <= maxY; iy++) {
|
||||||
for(int iz = minZ; iz <= maxZ; iz++) {
|
for(int iz = minZ; iz <= maxZ; iz++) {
|
||||||
|
|
||||||
Block b = world.getBlock(ix + pos.getX(), iy + pos.getY(), iz + pos.getZ());
|
Block b = world.getBlock(ix + pos.getX(), iy + pos.getY(), iz + pos.getZ());
|
||||||
|
if(b.isAir(world, ix + pos.getX(), iy + pos.getY(), iz + pos.getZ())) continue;
|
||||||
|
|
||||||
int meta = world.getBlockMetadata(ix + pos.getX(), iy + pos.getY(), iz + pos.getZ());
|
int meta = world.getBlockMetadata(ix + pos.getX(), iy + pos.getY(), iz + pos.getZ());
|
||||||
|
|
||||||
message += "placeBlockAtCurrentPosition(world, " + b.getUnlocalizedName() + ", " + meta + ", " + ix + ", " + iy + ", " + iz + ", box);\n";
|
message += "placeBlockAtCurrentPosition(world, " + b.getUnlocalizedName() + ", " + meta + ", " + ix + ", " + iy + ", " + iz + ", box);\n";
|
||||||
|
|||||||
@ -390,8 +390,6 @@ public class HbmChestContents {
|
|||||||
public static WeightedRandomChestContent[] lockersVault = new WeightedRandomChestContent[] {
|
public static WeightedRandomChestContent[] lockersVault = new WeightedRandomChestContent[] {
|
||||||
new WeightedRandomChestContent(ModItems.robes_helmet, 0, 1, 1, 1),
|
new WeightedRandomChestContent(ModItems.robes_helmet, 0, 1, 1, 1),
|
||||||
new WeightedRandomChestContent(ModItems.robes_plate, 0, 1, 1, 1),
|
new WeightedRandomChestContent(ModItems.robes_plate, 0, 1, 1, 1),
|
||||||
new WeightedRandomChestContent(ModItems.ammo_45, 0, 48, 64, 2),
|
|
||||||
new WeightedRandomChestContent(ModItems.gun_uac_pistol, 0, 1, 1, 1),
|
|
||||||
new WeightedRandomChestContent(ModItems.robes_legs, 0, 1, 1, 1),
|
new WeightedRandomChestContent(ModItems.robes_legs, 0, 1, 1, 1),
|
||||||
new WeightedRandomChestContent(ModItems.robes_boots, 0, 1, 1, 1),
|
new WeightedRandomChestContent(ModItems.robes_boots, 0, 1, 1, 1),
|
||||||
new WeightedRandomChestContent(ModItems.jackt, 0, 1, 1, 1),
|
new WeightedRandomChestContent(ModItems.jackt, 0, 1, 1, 1),
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import com.hbm.world.gen.component.BunkerComponents.BunkerStart;
|
|||||||
import com.hbm.world.gen.component.CivilianFeatures;
|
import com.hbm.world.gen.component.CivilianFeatures;
|
||||||
import com.hbm.world.gen.component.OfficeFeatures;
|
import com.hbm.world.gen.component.OfficeFeatures;
|
||||||
import com.hbm.world.gen.component.RuinFeatures;
|
import com.hbm.world.gen.component.RuinFeatures;
|
||||||
|
import com.hbm.world.gen.component.SiloComponent;
|
||||||
|
|
||||||
import cpw.mods.fml.common.IWorldGenerator;
|
import cpw.mods.fml.common.IWorldGenerator;
|
||||||
import cpw.mods.fml.common.registry.GameRegistry;
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
@ -47,5 +48,6 @@ public class HbmWorld {
|
|||||||
OfficeFeatures.registerComponents();
|
OfficeFeatures.registerComponents();
|
||||||
RuinFeatures.registerComponents();
|
RuinFeatures.registerComponents();
|
||||||
BunkerComponents.registerComponents();
|
BunkerComponents.registerComponents();
|
||||||
|
MapGenStructureIO.func_143031_a(SiloComponent.class, "NTMSiloComponent");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,6 +20,7 @@ import com.hbm.world.gen.component.RuinFeatures.NTMRuin1;
|
|||||||
import com.hbm.world.gen.component.RuinFeatures.NTMRuin2;
|
import com.hbm.world.gen.component.RuinFeatures.NTMRuin2;
|
||||||
import com.hbm.world.gen.component.RuinFeatures.NTMRuin3;
|
import com.hbm.world.gen.component.RuinFeatures.NTMRuin3;
|
||||||
import com.hbm.world.gen.component.RuinFeatures.NTMRuin4;
|
import com.hbm.world.gen.component.RuinFeatures.NTMRuin4;
|
||||||
|
import com.hbm.world.gen.component.SiloComponent;
|
||||||
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.biome.BiomeGenBase;
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
@ -143,6 +144,9 @@ public class MapGenNTMFeatures extends MapGenStructure {
|
|||||||
this.components.add(ruin4);
|
this.components.add(ruin4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else if(biome.heightVariation <= 0.25F && rand.nextInt(15) == 0) { //for now our only restriction is kinda-flat biomes. that and chance might change idk
|
||||||
|
SiloComponent silo = new SiloComponent(rand, i, j);
|
||||||
|
this.components.add(silo);
|
||||||
} else if(biome.temperature >= 1.0 && biome.rainfall == 0 && !(biome instanceof BiomeGenMesa)) { //Desert & Savannah
|
} else if(biome.temperature >= 1.0 && biome.rainfall == 0 && !(biome instanceof BiomeGenMesa)) { //Desert & Savannah
|
||||||
if(rand.nextBoolean()) {
|
if(rand.nextBoolean()) {
|
||||||
NTMHouse1 house1 = new NTMHouse1(rand, i, j);
|
NTMHouse1 house1 = new NTMHouse1(rand, i, j);
|
||||||
|
|||||||
@ -132,7 +132,7 @@ abstract public class Component extends StructureComponent {
|
|||||||
/**
|
/**
|
||||||
* Gets metadata for rotatable DecoBlock
|
* Gets metadata for rotatable DecoBlock
|
||||||
* honestly i don't remember how i did this and i'm scared to optimize it because i fail to see any reasonable patterns like the pillar
|
* honestly i don't remember how i did this and i'm scared to optimize it because i fail to see any reasonable patterns like the pillar
|
||||||
* seriously, 3 fucking bits for 4 orientations when you can do it easily with 2?
|
* should work for hoppers, just flip dir for N/S and W/E
|
||||||
* @param metadata (2 for facing South, 3 for facing North, 4 for facing East, 5 for facing West
|
* @param metadata (2 for facing South, 3 for facing North, 4 for facing East, 5 for facing West
|
||||||
*/
|
*/
|
||||||
protected int getDecoMeta(int metadata) {
|
protected int getDecoMeta(int metadata) {
|
||||||
@ -199,6 +199,11 @@ abstract public class Component extends StructureComponent {
|
|||||||
return metadata << 2; //To accommodate for BlockDecoModel's shift in the rotation bits; otherwise, simply bit-shift right and or any non-rotation meta after
|
return metadata << 2; //To accommodate for BlockDecoModel's shift in the rotation bits; otherwise, simply bit-shift right and or any non-rotation meta after
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//works for crts, toasters, and anything that follows mc's cardinal dirs. S: 0, W: 1, N: 2, E: 3
|
||||||
|
protected int getCRTMeta(int meta) {
|
||||||
|
return (meta + this.coordBaseMode) % 4;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets orientation-adjusted meta for stairs.
|
* Gets orientation-adjusted meta for stairs.
|
||||||
* 0 = West, 1 = East, 2 = North, 3 = South
|
* 0 = West, 1 = East, 2 = North, 3 = South
|
||||||
@ -547,7 +552,7 @@ abstract public class Component extends StructureComponent {
|
|||||||
if(getYWithOffset(minY) < box.minY || getYWithOffset(maxY) > box.maxY)
|
if(getYWithOffset(minY) < box.minY || getYWithOffset(maxY) > box.maxY)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for(int x = minX; x <= maxX; x++) {
|
for(int x = minX; x <= maxX; x++) { //TODO these could technically be optimized a bit more. probably won't do anything but worth
|
||||||
|
|
||||||
for(int z = minZ; z <= maxZ; z++) {
|
for(int z = minZ; z <= maxZ; z++) {
|
||||||
int posX = getXWithOffset(x, z);
|
int posX = getXWithOffset(x, z);
|
||||||
@ -788,6 +793,29 @@ abstract public class Component extends StructureComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void randomlyFillWithBlocks(World world, StructureBoundingBox box, Random rand, float randLimit, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, Block block, int meta) {
|
||||||
|
|
||||||
|
if(getYWithOffset(minY) < box.minY || getYWithOffset(maxY) > box.maxY)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for(int x = minX; x <= maxX; x++) {
|
||||||
|
|
||||||
|
for(int z = minZ; z <= maxZ; z++) {
|
||||||
|
int posX = getXWithOffset(x, z);
|
||||||
|
int posZ = getZWithOffset(x, z);
|
||||||
|
|
||||||
|
if(posX >= box.minX && posX <= box.maxX && posZ >= box.minZ && posZ <= box.maxZ) {
|
||||||
|
for(int y = minY; y <= maxY; y++) {
|
||||||
|
int posY = getYWithOffset(y);
|
||||||
|
|
||||||
|
if(rand.nextFloat() <= randLimit)
|
||||||
|
world.setBlock(posX, posY, posZ, block, meta, 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected ForgeDirection getDirection(ForgeDirection dir) {
|
protected ForgeDirection getDirection(ForgeDirection dir) {
|
||||||
switch(coordBaseMode) {
|
switch(coordBaseMode) {
|
||||||
default: //South
|
default: //South
|
||||||
@ -801,17 +829,35 @@ abstract public class Component extends StructureComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Sets the core block for a BlockDummyable multiblock. WARNING: Does not take {@link com.hbm.blocks.BlockDummyable#getDirModified(ForgeDirection)} or {@link com.hbm.blocks.BlockDummyable#getMetaForCore(World, int, int, int, EntityPlayer, int)}
|
||||||
|
* into account yet! This will be changed as it comes up!<br>
|
||||||
|
* For BlockDummyables, 'dir' <b>always</b> faces the player, being the opposite of the player's direction. This is already taken into account. */
|
||||||
|
protected void placeCore(World world, StructureBoundingBox box, Block block, ForgeDirection dir, int x, int y, int z) {
|
||||||
|
int posX = getXWithOffset(x, z);
|
||||||
|
int posZ = getZWithOffset(x, z);
|
||||||
|
int posY = getYWithOffset(y);
|
||||||
|
|
||||||
|
if(!box.isVecInside(posX, posY, posZ)) return;
|
||||||
|
|
||||||
|
if(dir == null)
|
||||||
|
dir = ForgeDirection.NORTH;
|
||||||
|
|
||||||
|
dir = getDirection(dir.getOpposite());
|
||||||
|
world.setBlock(posX, posY, posZ, block, dir.ordinal() + BlockDummyable.offset, 2);
|
||||||
|
}
|
||||||
|
|
||||||
//always set the core block first
|
//always set the core block first
|
||||||
/** StructureComponent-friendly method for {@link com.hbm.handler.MultiblockHandlerXR#fillSpace(World, int, int, int, int[], Block, ForgeDirection)}. Prevents runoff outside of the provided bounding box. */
|
/** StructureComponent-friendly method for {@link com.hbm.handler.MultiblockHandlerXR#fillSpace(World, int, int, int, int[], Block, ForgeDirection)}. Prevents runoff outside of the provided bounding box.<br>
|
||||||
|
* For BlockDummyables, 'dir' <b>always</b> faces the player, being the opposite of the player's direction. This is already taken into account. */
|
||||||
protected void fillSpace(World world, StructureBoundingBox box, int x, int y, int z, int[] dim, Block block, ForgeDirection dir) {
|
protected void fillSpace(World world, StructureBoundingBox box, int x, int y, int z, int[] dim, Block block, ForgeDirection dir) {
|
||||||
|
|
||||||
if(getYWithOffset(y - dim[1]) < box.minY || getYWithOffset(y + dim[0]) > box.maxY) //the BlockDummyable will be fucked regardless if it goes beyond either limit
|
if(getYWithOffset(y - dim[1]) < box.minY || getYWithOffset(y + dim[0]) > box.maxY) //the BlockDummyable will be fucked regardless if it goes beyond either limit
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(dir == null)
|
if(dir == null)
|
||||||
dir = ForgeDirection.SOUTH;
|
dir = ForgeDirection.NORTH;
|
||||||
|
|
||||||
dir = getDirection(dir);
|
dir = getDirection(dir.getOpposite());
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
|
|||||||
1348
src/main/java/com/hbm/world/gen/component/SiloComponent.java
Normal file
1348
src/main/java/com/hbm/world/gen/component/SiloComponent.java
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user