Merge pull request #795 from Vaern/structures-pr
New Structure, ProceduralComponents Base class, Filing cabinets, ItemBookLore
@ -41,7 +41,7 @@ public class BlockEnumMulti extends BlockMulti {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return this.icons[meta % this.icons.length];
|
||||
return multiTexture ? this.icons[meta % this.icons.length] : this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -13,4 +13,21 @@ public class BlockEnums {
|
||||
SULFUR,
|
||||
ASBESTOS
|
||||
}
|
||||
|
||||
/** DECO / STRUCTURE ENUMS */
|
||||
//i apologize in advance
|
||||
|
||||
public static enum TileType {
|
||||
LARGE,
|
||||
SMALL
|
||||
}
|
||||
|
||||
public static enum DecoComputerEnum {
|
||||
IBM_300PL
|
||||
}
|
||||
|
||||
public static enum DecoCabinetEnum {
|
||||
GREEN,
|
||||
STEEL
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package com.hbm.blocks;
|
||||
import com.hbm.blocks.generic.*;
|
||||
import com.hbm.blocks.generic.BlockHazard.ExtDisplayEffect;
|
||||
import com.hbm.blocks.generic.BlockMotherOfAllOres.ItemRandomOreBlock;
|
||||
import com.hbm.blocks.BlockEnums.*;
|
||||
import com.hbm.blocks.bomb.*;
|
||||
import com.hbm.blocks.fluid.*;
|
||||
import com.hbm.blocks.gas.*;
|
||||
@ -20,6 +21,7 @@ import com.hbm.lib.ModDamageSource;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.DoorDecl;
|
||||
import com.hbm.tileentity.machine.storage.TileEntityFileCabinet;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.block.Block;
|
||||
@ -365,7 +367,9 @@ public class ModBlocks {
|
||||
|
||||
public static Block cmb_brick;
|
||||
public static Block cmb_brick_reinforced;
|
||||
|
||||
|
||||
public static Block vinyl_tile;
|
||||
|
||||
public static Block tile_lab;
|
||||
public static Block tile_lab_cracked;
|
||||
public static Block tile_lab_broken;
|
||||
@ -410,7 +414,9 @@ public class ModBlocks {
|
||||
public static Block brick_forgotten;
|
||||
|
||||
public static Block deco_computer;
|
||||
|
||||
|
||||
public static Block filing_cabinet;
|
||||
|
||||
public static Block tape_recorder;
|
||||
public static Block steel_poles;
|
||||
public static Block pole_top;
|
||||
@ -1578,7 +1584,7 @@ public class ModBlocks {
|
||||
lamp_uv_off = new UVLamp(false).setBlockName("lamp_uv_off").setCreativeTab(MainRegistry.blockTab);
|
||||
lamp_uv_on = new UVLamp(true).setBlockName("lamp_uv_on").setCreativeTab(null);
|
||||
lamp_demon = new DemonLamp().setBlockName("lamp_demon").setStepSound(Block.soundTypeMetal).setCreativeTab(MainRegistry.blockTab).setLightLevel(1F).setHardness(3.0F).setBlockTextureName(RefStrings.MODID + ":lamp_demon");
|
||||
|
||||
|
||||
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");
|
||||
@ -1629,7 +1635,8 @@ public class ModBlocks {
|
||||
brick_compound_stairs = new BlockGenericStairs(brick_compound, 0).setBlockName("brick_compound_stairs").setCreativeTab(MainRegistry.blockTab);
|
||||
brick_asbestos_stairs = new BlockGenericStairs(brick_asbestos, 0).setBlockName("brick_asbestos_stairs").setCreativeTab(MainRegistry.blockTab);
|
||||
brick_fire_stairs = new BlockGenericStairs(brick_fire, 0).setBlockName("brick_fire_stairs").setCreativeTab(MainRegistry.blockTab);
|
||||
|
||||
|
||||
vinyl_tile = new BlockEnumMulti(Material.rock, TileType.class, true, true).setBlockName("vinyl_tile").setStepSound(Block.soundTypeGlass).setCreativeTab(MainRegistry.blockTab).setHardness(10.0F).setResistance(120.0F).setBlockTextureName(RefStrings.MODID + ":vinyl_tile");
|
||||
|
||||
tile_lab = new BlockOutgas(Material.rock, false, 5, true).setBlockName("tile_lab").setStepSound(Block.soundTypeGlass).setCreativeTab(MainRegistry.blockTab).setHardness(1.0F).setResistance(20.0F).setBlockTextureName(RefStrings.MODID + ":tile_lab");
|
||||
tile_lab_cracked = new BlockOutgas(Material.rock, false, 5, true).setBlockName("tile_lab_cracked").setStepSound(Block.soundTypeGlass).setCreativeTab(MainRegistry.blockTab).setHardness(1.0F).setResistance(20.0F).setBlockTextureName(RefStrings.MODID + ":tile_lab_cracked");
|
||||
@ -1673,7 +1680,9 @@ public class ModBlocks {
|
||||
|
||||
brick_forgotten = new BlockGeneric(Material.rock).setBlockName("brick_forgotten").setCreativeTab(MainRegistry.blockTab).setBlockUnbreakable().setResistance(1000000).setBlockTextureName(RefStrings.MODID + ":brick_forgotten");
|
||||
|
||||
deco_computer = new BlockDecoModel(Material.iron, 1).setBlockName("deco_computer").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":deco_computer");
|
||||
deco_computer = new BlockDecoModel(Material.iron, DecoComputerEnum.class, true, false).setBlockBoundsTo(.160749F, 0F, 0F, .839251F, .867849F, .622184F).setBlockName("deco_computer").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":deco_computer");
|
||||
|
||||
filing_cabinet = new BlockDecoContainer(Material.iron, DecoCabinetEnum.class, true, false, TileEntityFileCabinet.class).setBlockBoundsTo(.1875F, 0F, 0F, .8125F, 1F, .75F).setBlockName("filing_cabinet").setCreativeTab(MainRegistry.blockTab).setHardness(10.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
|
||||
tape_recorder = new DecoTapeRecorder(Material.iron).setBlockName("tape_recorder").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":deco_tape_recorder");
|
||||
steel_poles = new DecoSteelPoles(Material.iron).setBlockName("steel_poles").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":steel_beam");
|
||||
@ -2737,6 +2746,8 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(cmb_brick_reinforced, ItemBlockBlastInfo.class, cmb_brick_reinforced.getUnlocalizedName());
|
||||
|
||||
//Tiles
|
||||
GameRegistry.registerBlock(vinyl_tile, ItemBlockBlastInfo.class, vinyl_tile.getUnlocalizedName()); //i would rather die than dip into fucking blocks with subtypes again
|
||||
|
||||
GameRegistry.registerBlock(tile_lab, tile_lab.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(tile_lab_cracked, tile_lab_cracked.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(tile_lab_broken, tile_lab_broken.getUnlocalizedName());
|
||||
@ -2789,7 +2800,8 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(brick_dungeon_tile, brick_dungeon_tile.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(brick_dungeon_circle, brick_dungeon_circle.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(brick_forgotten, brick_forgotten.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(deco_computer, ItemBlockMeta.class, deco_computer.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(deco_computer, ItemBlockBase.class, deco_computer.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(filing_cabinet, ItemBlockBase.class, filing_cabinet.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(tape_recorder, tape_recorder.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(steel_poles, steel_poles.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(pole_top, pole_top.getUnlocalizedName());
|
||||
|
||||
120
src/main/java/com/hbm/blocks/generic/BlockDecoContainer.java
Normal file
@ -0,0 +1,120 @@
|
||||
package com.hbm.blocks.generic;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.tool.ItemLock;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.machine.TileEntityLockableBase;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
||||
|
||||
public class BlockDecoContainer extends BlockDecoModel implements ITileEntityProvider {
|
||||
|
||||
Class<? extends TileEntity> tile;
|
||||
|
||||
public BlockDecoContainer(Material mat, Class<? extends Enum> theEnum, boolean multiName, boolean multiTexture, Class<? extends TileEntity> tile) {
|
||||
super(mat, theEnum, multiName, multiTexture);
|
||||
this.tile = tile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int metadata) {
|
||||
try {
|
||||
return tile.newInstance();
|
||||
} catch (Exception e) {
|
||||
MainRegistry.logger.error("BlockDecoContainer attempted to create a TE, but couldn't. How does that even happen?");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockEventReceived(World world, int x, int y, int z, int eventNo, int eventArg) {
|
||||
super.onBlockEventReceived(world, x, y, z, eventNo, eventArg);
|
||||
TileEntity tileentity = world.getTileEntity(x, y, z);
|
||||
return tileentity != null ? tileentity.receiveClientEvent(eventNo, eventArg) : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
|
||||
if(world.isRemote) {
|
||||
return true;
|
||||
} else {
|
||||
TileEntity entity = world.getTileEntity(x, y, z);
|
||||
if(entity instanceof TileEntityLockableBase) { //annoying accommodations for the filing cabinet, but whatever, could potentially be useful
|
||||
if(player.getHeldItem() != null && (player.getHeldItem().getItem() instanceof ItemLock || player.getHeldItem().getItem() == ModItems.key_kit))
|
||||
return false;
|
||||
else if(!player.isSneaking() && ((TileEntityLockableBase) entity).canAccess(player)) {
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
} else if(!player.isSneaking()) {
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||
IInventory inventory = (IInventory) world.getTileEntity(x, y, z);
|
||||
Random rand = world.rand;
|
||||
|
||||
if(inventory != null) {
|
||||
for(int i1 = 0; i1 < inventory.getSizeInventory(); ++i1) {
|
||||
ItemStack itemstack = inventory.getStackInSlot(i1);
|
||||
|
||||
if (itemstack != null) {
|
||||
float f = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = rand.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
while(itemstack.stackSize > 0) {
|
||||
int j1 = rand.nextInt(21) + 10;
|
||||
|
||||
if (j1 > itemstack.stackSize) {
|
||||
j1 = itemstack.stackSize;
|
||||
}
|
||||
|
||||
itemstack.stackSize -= j1;
|
||||
EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));
|
||||
|
||||
if(itemstack.hasTagCompound()) {
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float) rand.nextGaussian() * f3;
|
||||
entityitem.motionY = (float) rand.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float) rand.nextGaussian() * f3;
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
world.func_147453_f(x, y, z, block);
|
||||
}
|
||||
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,6 +2,7 @@ package com.hbm.blocks.generic;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.BlockEnumMulti;
|
||||
import com.hbm.lib.RefStrings;
|
||||
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
@ -14,54 +15,20 @@ import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockDecoModel extends Block {
|
||||
public class BlockDecoModel extends BlockEnumMulti {
|
||||
|
||||
//Allows between 1-4 differently colored/textured sub-blocks altogether.
|
||||
int subTypes;
|
||||
|
||||
public BlockDecoModel(Material mat, int types) {
|
||||
super(mat);
|
||||
subTypes = types;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected IIcon[] icons;
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta) {
|
||||
return meta & 12;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs tabs, List list) {
|
||||
for(byte i = 0; i < subTypes; i++) {
|
||||
list.add(new ItemStack(item, 1, i));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
super.registerBlockIcons(iconRegister);
|
||||
icons = new IIcon[subTypes];
|
||||
|
||||
for(byte i = 0; i < subTypes; i++)
|
||||
icons[i] = iconRegister.registerIcon(this.textureName + "_" + i);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return this.icons[(meta >> 2) % this.icons.length];
|
||||
public BlockDecoModel(Material mat, Class<? extends Enum> theEnum, boolean multiName, boolean multiTexture) {
|
||||
super(mat, theEnum, multiName, multiTexture);
|
||||
}
|
||||
|
||||
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return renderID;
|
||||
@ -83,7 +50,7 @@ public class BlockDecoModel extends Block {
|
||||
|
||||
//Assumes meta is using the third and fourth bits.
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {
|
||||
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||
|
||||
int meta;
|
||||
@ -97,6 +64,54 @@ public class BlockDecoModel extends Block {
|
||||
meta = 3; //For East(b01>b11), just set to 3
|
||||
}
|
||||
|
||||
world.setBlockMetadataWithNotify(x, y, z, meta, 2);
|
||||
world.setBlockMetadataWithNotify(x, y, z, (meta << 2) | stack.getItemDamage(), 2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta) {
|
||||
return meta & 3;
|
||||
}
|
||||
|
||||
//These are separate because they have to be constant
|
||||
private float mnX = 0.0F; //min
|
||||
private float mnY = 0.0F;
|
||||
private float mnZ = 0.0F;
|
||||
private float mxX = 1.0F; //max
|
||||
private float mxY = 1.0F;
|
||||
private float mxZ = 1.0F;
|
||||
|
||||
public BlockDecoModel setBlockBoundsTo(float minX, float minY, float minZ, float maxX, float maxY, float maxZ) {
|
||||
mnX = minX;
|
||||
mnY = minY;
|
||||
mnZ = minZ;
|
||||
mxX = maxX;
|
||||
mxY = maxY;
|
||||
mxZ = maxZ;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
||||
switch(world.getBlockMetadata(x, y, z) >> 2) {
|
||||
case 0://North
|
||||
this.setBlockBounds(1 - mxX, mnY, 1 - mxZ, 1 - mnX, mxY, 1 - mnZ);
|
||||
break;
|
||||
case 1://South
|
||||
this.setBlockBounds(mnX, mnY, mnZ, mxX, mxY, mxZ);
|
||||
break;
|
||||
case 2://West
|
||||
this.setBlockBounds(1 - mxZ, mnY, mnX, 1 - mnZ, mxY, mxX);
|
||||
break;
|
||||
case 3://East
|
||||
this.setBlockBounds(mnZ, mnY, 1 - mxX, mxZ, mxY, 1 - mnX);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
this.setBlockBoundsBasedOnState(world, x, y, z);
|
||||
return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ);
|
||||
}
|
||||
}
|
||||
@ -20,6 +20,8 @@ import com.hbm.tileentity.turret.*;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
@ -41,6 +43,12 @@ public class GUIHandler implements IGuiHandler {
|
||||
return ((IGUIProvider) block).provideContainer(ID, player, world, x, y, z);
|
||||
}
|
||||
|
||||
ItemStack item = player.getHeldItem();
|
||||
|
||||
if(item != null && item.getItem() instanceof IGUIProvider) {
|
||||
return ((IGUIProvider) item.getItem()).provideContainer(ID, player, world, x, y, z);
|
||||
}
|
||||
|
||||
//notice: stop doing this, unless you absolutely have to \/
|
||||
|
||||
if(entity instanceof TileEntityCrateIron) { return new ContainerCrateIron(player.inventory, (TileEntityCrateIron) entity); }
|
||||
@ -839,6 +847,12 @@ public class GUIHandler implements IGuiHandler {
|
||||
return ((IGUIProvider) block).provideGUI(ID, player, world, x, y, z);
|
||||
}
|
||||
|
||||
ItemStack item = player.getHeldItem();
|
||||
|
||||
if(item != null && item.getItem() instanceof IGUIProvider) {
|
||||
return ((IGUIProvider) item.getItem()).provideGUI(ID, player, world, x, y, z);
|
||||
}
|
||||
|
||||
//stop doing this unless you absolutely have to \/
|
||||
|
||||
if(entity instanceof TileEntityCrateIron) { return new GUICrateIron(player.inventory, (TileEntityCrateIron) entity); }
|
||||
|
||||
@ -0,0 +1,76 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.tileentity.machine.storage.TileEntityFileCabinet;
|
||||
|
||||
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 ContainerFileCabinet extends Container {
|
||||
|
||||
protected TileEntityFileCabinet cabinet;
|
||||
|
||||
public ContainerFileCabinet(InventoryPlayer invPlayer, TileEntityFileCabinet tile) {
|
||||
this.cabinet = tile;
|
||||
this.cabinet.openInventory();
|
||||
|
||||
for(int i = 0; i < 2; i++) {
|
||||
for(int j = 0; j < 4; j++) {
|
||||
this.addSlotToContainer(new Slot(tile, j + i * 4, 53 + j * 18, 18 + i * 36));
|
||||
}
|
||||
}
|
||||
|
||||
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, 88 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 146));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||
ItemStack returnStack = null;
|
||||
Slot slot = (Slot) this.inventorySlots.get(index);
|
||||
|
||||
if(slot != null && slot.getHasStack()) {
|
||||
ItemStack originalStack = slot.getStack();
|
||||
returnStack = originalStack.copy();
|
||||
|
||||
if(index <= 7) {
|
||||
if(!this.mergeItemStack(originalStack, 8, this.inventorySlots.size(), true)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
slot.onSlotChange(originalStack, returnStack);
|
||||
|
||||
} else if(!this.mergeItemStack(originalStack, 0, 8, false)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if(originalStack.stackSize == 0) {
|
||||
slot.putStack((ItemStack) null);
|
||||
} else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
}
|
||||
|
||||
return returnStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return cabinet.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onContainerClosed(EntityPlayer player) {
|
||||
super.onContainerClosed(player);
|
||||
this.cabinet.closeInventory();
|
||||
}
|
||||
}
|
||||
353
src/main/java/com/hbm/inventory/gui/GUIBookLore.java
Normal file
@ -0,0 +1,353 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.items.special.ItemBookLore.*;
|
||||
import com.hbm.items.tool.ItemGuideBook.BookType;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.util.I18nUtil;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
// and you may ask yourself: vaer, why do this? this is basically just a copy of GUIScreenGuide.
|
||||
// and I would answer, shut the fuck up nerd, the guide book system is too involved for my small
|
||||
// brain to use for god knows how many tidbits of lore. i'll settle for a text box and cool textures, thanks
|
||||
public class GUIBookLore extends GuiScreen {
|
||||
protected int xSize;
|
||||
protected int ySize;
|
||||
protected int guiLeft;
|
||||
protected int guiTop;
|
||||
|
||||
private NBTTagCompound tag; //Used for save-dependent information, like the MKU recipe
|
||||
private BookLoreType type;
|
||||
|
||||
public int itemTexture;
|
||||
|
||||
protected GUIPage mainPage;
|
||||
protected GUIPage auxPage;
|
||||
protected GUIPageButton button;
|
||||
|
||||
int page = 0;
|
||||
int maxPage;
|
||||
|
||||
public GUIBookLore(EntityPlayer player) {
|
||||
|
||||
type = BookLoreType.getTypeFromStack(player.getHeldItem());
|
||||
tag = player.getHeldItem().getTagCompound(); //compound is created or gotten in method above
|
||||
GUIAppearance setup = type.appearance;
|
||||
|
||||
mainPage = setup.mainPage;
|
||||
auxPage = setup.auxPage;
|
||||
button = setup.button;
|
||||
itemTexture = setup.itemTexture;
|
||||
|
||||
if(type.pages <= 1) {
|
||||
xSize = auxPage.sizeX;
|
||||
ySize = auxPage.sizeY;
|
||||
} else {
|
||||
xSize = mainPage.sizeX;
|
||||
ySize = mainPage.sizeY;
|
||||
}
|
||||
|
||||
maxPage = mainPage.isTwoPages ? (int)Math.ceil(type.pages / 2D) - 1 : type.pages - 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
this.guiLeft = (this.width - this.xSize) / 2;
|
||||
this.guiTop = (this.height - this.ySize) / 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||
this.drawDefaultBackground();
|
||||
this.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
this.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
}
|
||||
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
if(page == maxPage && (page + 1) * 2 > type.pages) { //odd numbered pages
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(auxPage.texture);
|
||||
func_146110_a(guiLeft, guiTop, auxPage.u, auxPage.v, auxPage.sizeX, auxPage.sizeY, 512, 512);
|
||||
} else {
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(mainPage.texture);
|
||||
func_146110_a(guiLeft, guiTop, mainPage.u, mainPage.v, mainPage.sizeX, mainPage.sizeY, 512, 512);
|
||||
}
|
||||
|
||||
int width = page == maxPage && (page + 1) * 2 > type.pages ? auxPage.sizeX : mainPage.sizeX;
|
||||
|
||||
if(page > 0)
|
||||
button.renderButton(this, width, guiLeft, guiTop, false, i, j);
|
||||
|
||||
if(page < maxPage)
|
||||
button.renderButton(this, width, guiLeft, guiTop, true, i, j);
|
||||
}
|
||||
|
||||
protected void drawGuiContainerForegroundLayer(int x, int y) {
|
||||
String key = "book_lore." + type.keyI18n + ".page.";
|
||||
|
||||
if(mainPage.isTwoPages) {
|
||||
int defacto = page * 2 + 1;
|
||||
String text = type.resolveKey(key + defacto, tag);
|
||||
|
||||
if((page + 1) * 2 <= type.pages) { //Checks if text should be rendered as an aux or a main page
|
||||
mainPage.renderText(text, fontRendererObj, guiLeft, guiTop, false);
|
||||
|
||||
text = type.resolveKey(key + (defacto + 1), tag); //kinda awkward, but no way around it
|
||||
mainPage.renderText(text, fontRendererObj, guiLeft, guiTop, true);
|
||||
} else
|
||||
auxPage.renderText(text, fontRendererObj, guiLeft, guiTop, false);
|
||||
|
||||
} else {
|
||||
String text = type.resolveKey(key + (page + 1), tag);
|
||||
|
||||
if(page < maxPage)
|
||||
mainPage.renderText(text, fontRendererObj, guiLeft, guiTop, false);
|
||||
else
|
||||
auxPage.renderText(text, fontRendererObj, guiLeft, guiTop, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int i, int j, int k) {
|
||||
int q = 0; //if both buttons are somehow simultaneously clicked then obviously something's wrong already
|
||||
|
||||
if(page > 0)
|
||||
q = button.handleInput(xSize, guiLeft, guiTop, false, i, j);
|
||||
|
||||
if(page < maxPage && q == 0)
|
||||
q = button.handleInput(xSize, guiLeft, guiTop, true, i, j);
|
||||
|
||||
if(q != 0) {
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
this.page += q;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char c, int key) {
|
||||
if(key == 1 || key == this.mc.gameSettings.keyBindInventory.getKeyCode()) {
|
||||
this.mc.thePlayer.closeScreen();
|
||||
}
|
||||
}
|
||||
|
||||
// turn page buttons, one-page, both page textures, sizes, positions, etc.
|
||||
public enum GUIAppearance {
|
||||
GUIDEBOOK(new GUIPage(272, 182, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/book.png")).setScale(2F).setMargins(20, 20, 20),
|
||||
new GUIPageButton(18, 10, 17, 148, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png")).setUV(263, 0, 512, 512),
|
||||
0), //Guide Book
|
||||
LOOSEPAPER(new GUIPage(130, 165, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png"), false).setMargins(12, 10, 16).setUV(133, 0),
|
||||
new GUIPageButton(18, 10, 17, 148, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png")).setUV(263, 0, 512, 512),
|
||||
1), //Singular loose page
|
||||
LOOSEPAPERS(new GUIPage(133, 165, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png"), false).setMargins(12, 10, 16),
|
||||
new GUIPageButton(18, 10, 17, 148, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png")).setUV(263, 0, 512, 512),
|
||||
2), //Collection of loose pages
|
||||
NOTEBOOK(new GUIPage(133, 165, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png"), false).setMargins(10, 10, 16).setUV(0, 165),
|
||||
new GUIPage(133, 165, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png"), false).setMargins(10, 10, 16).setUV(133, 165),
|
||||
new GUIPageButton(18, 10, 17, 148, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png")).setUV(263, 0, 512, 512),
|
||||
3);
|
||||
|
||||
public int itemTexture;
|
||||
|
||||
protected GUIPage mainPage; //"Main" page, usually two pages. GUI accounts for one-paged main pages.
|
||||
protected GUIPage auxPage; //"Aux" page, AKA the final page if the max pages is oddly numbered.
|
||||
//If two-sided, text will be positioned on the left page.
|
||||
protected GUIPageButton button;
|
||||
|
||||
private GUIAppearance(GUIPage main, GUIPage aux, GUIPageButton button, int texture) {
|
||||
this.mainPage = main;
|
||||
this.auxPage = aux;
|
||||
this.button = button;
|
||||
this.itemTexture = texture;
|
||||
}
|
||||
|
||||
private GUIAppearance(GUIPage main, GUIPageButton button, int texture) {
|
||||
this.mainPage = main;
|
||||
this.auxPage = main;
|
||||
this.button = button;
|
||||
this.itemTexture = texture;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class GUIPage {
|
||||
protected ResourceLocation texture;
|
||||
|
||||
//UV positioning
|
||||
protected int u = 0; //X/U pos in texture
|
||||
protected int v = 0; //Y/V pos in texture
|
||||
|
||||
protected int sizeX; //X size of the page
|
||||
protected int sizeY; //Y size of the page
|
||||
|
||||
//Text positioning
|
||||
protected int marginInner = 10; //Margin from inner edge of page
|
||||
protected int marginOuter = 10; //Margin from outer edge of page
|
||||
protected int marginY = 20; //Margin from upper edge of page
|
||||
protected boolean isTwoPages = true; //Has two pages to display text
|
||||
protected float scale = 1.0F; //Scale of the text; larger values are smaller
|
||||
protected int spacing = 9; //12 is a more comfortable spacing
|
||||
|
||||
protected GUIPage(int x, int y, ResourceLocation texture, boolean twoPages) {
|
||||
this.sizeX = x;
|
||||
this.sizeY = y;
|
||||
this.texture = texture;
|
||||
this.isTwoPages = twoPages;
|
||||
}
|
||||
|
||||
protected GUIPage(int x, int y, ResourceLocation texture) {
|
||||
this.sizeX = x;
|
||||
this.sizeY = y;
|
||||
this.texture = texture;
|
||||
}
|
||||
|
||||
protected GUIPage setUV(int u, int v) {
|
||||
this.u = u;
|
||||
this.v = v;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected GUIPage setScale(float scale) {
|
||||
this.scale = scale;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected GUIPage setMargins(int inner, int outer, int upper) {
|
||||
this.marginInner = inner;
|
||||
this.marginOuter = outer;
|
||||
this.marginY = upper;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected GUIPage setSpacing(int spacing) {
|
||||
this.spacing = spacing;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected void renderText(String text, FontRenderer renderer, int left, int top, boolean secondPage) {
|
||||
int width = (isTwoPages ? sizeX / 2 : sizeX) - marginInner - marginOuter;
|
||||
int widthScaled = (int) (width * scale);
|
||||
|
||||
List<String> lines = new ArrayList();
|
||||
String[] words = text.split(" ");
|
||||
|
||||
lines.add(words[0]);
|
||||
int indent = renderer.getStringWidth(words[0]);
|
||||
|
||||
for(int w = 1; w < words.length; w++) {
|
||||
|
||||
if(words[w].equals("$")) {
|
||||
if(w + 1 < words.length && !words[w + 1].equals("$")) {
|
||||
lines.add(words[++w]);
|
||||
indent = renderer.getStringWidth(words[w]);
|
||||
} else
|
||||
lines.add("");
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
indent += renderer.getStringWidth(" " + words[w]);
|
||||
|
||||
if(indent <= widthScaled) {
|
||||
String last = lines.get(lines.size() - 1);
|
||||
lines.set(lines.size() - 1, last += (" " + words[w]));
|
||||
} else {
|
||||
lines.add(words[w]);
|
||||
indent = renderer.getStringWidth(words[w]);
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScalef(1F/scale, 1F/scale, 1F);
|
||||
|
||||
int sideOffset = secondPage ? sizeX / 2 + marginInner : marginOuter;
|
||||
|
||||
for(int l = 0; l < lines.size(); l++) {
|
||||
renderer.drawString(lines.get(l), (int)((left + sideOffset) * scale), (int)((top + marginY) * scale + (spacing * l)), 4210752);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
private static class GUIPageButton {
|
||||
protected ResourceLocation texture;
|
||||
|
||||
protected int sizeX; //size of a single button; full texture is 2*sizeX : 2*sizeZ
|
||||
protected int sizeY;
|
||||
protected int x; //x position on page, relative to edge of the page it is on.
|
||||
protected int y; //y position on page, relative to the top edge of the page.
|
||||
|
||||
/* Left, Unsel | Right, Unsel
|
||||
* Left, Sel | Right, Sel
|
||||
*/
|
||||
protected int u = 0; //upper lefthand corner where the button textures lie.
|
||||
protected int v = 0; //assumes uniform size for each.
|
||||
protected int sizeU = sizeX * 2; //Size of UV texture
|
||||
protected int sizeV = sizeY * 2;
|
||||
|
||||
protected GUIPageButton(int sizeX, int sizeY, int x, int y, ResourceLocation tex) {
|
||||
this.sizeX = sizeX;
|
||||
this.sizeY = sizeY;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.texture = tex;
|
||||
}
|
||||
|
||||
protected GUIPageButton setUV(int u, int v, int sizeU, int sizeV) {
|
||||
this.u = u;
|
||||
this.v = v;
|
||||
this.sizeU = sizeU;
|
||||
this.sizeV = sizeV;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected void renderButton(GuiScreen screen, int width, int left, int top, boolean rightPage, int i, int j) {
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
boolean overY = j >= top + y && j < top + y + sizeY;
|
||||
|
||||
if(!rightPage) {
|
||||
if(i >= left + x && i < left + x + sizeX && overY) {
|
||||
func_146110_a(left + x, top + y, u, v + sizeY, sizeX, sizeY, sizeU, sizeV);
|
||||
} else {
|
||||
func_146110_a(left + x, top + y, u, v, sizeX, sizeY, sizeU, sizeV);
|
||||
}
|
||||
} else {
|
||||
if(i >= left + width - x - sizeX && i < left + width - x && overY) {
|
||||
func_146110_a(left + width - x - sizeX, top + y, u + sizeX, v + sizeY, sizeX, sizeY, sizeU, sizeV);
|
||||
} else {
|
||||
func_146110_a(left + width - x - sizeX, top + y, u + sizeX, v, sizeX, sizeY, sizeU, sizeV);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected int handleInput(int width, int left, int top, boolean rightPage, int i, int j) {
|
||||
boolean overY = j >= top + y && j < top + y + sizeY;
|
||||
if(!rightPage) {
|
||||
if(i >= left + x && i < left + x + sizeX && overY)
|
||||
return -1;
|
||||
} else {
|
||||
if(i >= left + width - x - sizeX && i < left + width - x && overY)
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
42
src/main/java/com/hbm/inventory/gui/GUIFileCabinet.java
Normal file
@ -0,0 +1,42 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerFileCabinet;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.machine.storage.TileEntityFileCabinet;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIFileCabinet extends GuiContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/storage/gui_file_cabinet.png");
|
||||
private TileEntityFileCabinet cabinet;
|
||||
|
||||
public GUIFileCabinet(InventoryPlayer invPlayer, TileEntityFileCabinet tile) {
|
||||
super(new ContainerFileCabinet(invPlayer, tile));
|
||||
cabinet = tile;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 170;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = this.cabinet.hasCustomInventoryName() ? this.cabinet.getInventoryName() : I18n.format(this.cabinet.getInventoryName());
|
||||
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
}
|
||||
}
|
||||
@ -598,6 +598,16 @@ public class AnvilRecipes {
|
||||
|
||||
}
|
||||
).setTier(2));
|
||||
constructionRecipes.add(new AnvilConstructionRecipe(
|
||||
new ComparableStack(ModBlocks.filing_cabinet),
|
||||
new AnvilOutput[] {
|
||||
new AnvilOutput(new ItemStack(ModItems.plate_steel, 2)),
|
||||
new AnvilOutput(new ItemStack(ModItems.plate_steel, 2), 0.5F),
|
||||
new AnvilOutput(new ItemStack(ModItems.plate_polymer, 2), 0.25F),
|
||||
new AnvilOutput(new ItemStack(ModItems.scrap, 1))
|
||||
|
||||
}
|
||||
).setTier(1));
|
||||
|
||||
constructionRecipes.add(new AnvilConstructionRecipe(
|
||||
new ComparableStack(ModItems.circuit_raw),
|
||||
|
||||
@ -2322,6 +2322,8 @@ public class ModItems {
|
||||
public static Item structure_single;
|
||||
public static Item structure_solid;
|
||||
public static Item structure_pattern;
|
||||
public static Item structure_randomized;
|
||||
public static Item structure_randomly;
|
||||
|
||||
public static Item rod_of_discord;
|
||||
|
||||
@ -2449,6 +2451,7 @@ public class ModItems {
|
||||
public static Item record_glass;
|
||||
|
||||
public static Item book_guide;
|
||||
public static Item book_lore;
|
||||
public static Item holotape_image;
|
||||
public static Item holotape_damaged;
|
||||
|
||||
@ -4751,6 +4754,8 @@ public class ModItems {
|
||||
structure_single = new ItemStructureSingle().setUnlocalizedName("structure_single").setMaxStackSize(1).setCreativeTab(null).setFull3D().setTextureName(RefStrings.MODID + ":structure_single");
|
||||
structure_solid = new ItemStructureSolid().setUnlocalizedName("structure_solid").setMaxStackSize(1).setCreativeTab(null).setFull3D().setTextureName(RefStrings.MODID + ":structure_solid");
|
||||
structure_pattern = new ItemStructurePattern().setUnlocalizedName("structure_pattern").setMaxStackSize(1).setCreativeTab(null).setFull3D().setTextureName(RefStrings.MODID + ":structure_pattern");
|
||||
structure_randomized = new ItemStructureRandomized().setUnlocalizedName("structure_randomized").setMaxStackSize(1).setCreativeTab(null).setFull3D().setTextureName(RefStrings.MODID + ":structure_randomized");
|
||||
structure_randomly = new ItemStructureRandomly().setUnlocalizedName("structure_randomly").setMaxStackSize(1).setCreativeTab(null).setFull3D().setTextureName(RefStrings.MODID + ":structure_randomly");
|
||||
|
||||
rod_of_discord = new ItemDiscord().setUnlocalizedName("rod_of_discord").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setFull3D().setTextureName(RefStrings.MODID + ":rod_of_discord");
|
||||
|
||||
@ -5609,6 +5614,7 @@ public class ModItems {
|
||||
record_glass = new ItemModRecord("glass").setUnlocalizedName("record_glass").setCreativeTab(null).setTextureName(RefStrings.MODID + ":record_glass");
|
||||
|
||||
book_guide = new ItemGuideBook().setUnlocalizedName("book_guide").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":book_guide");
|
||||
book_lore = new ItemBookLore().setUnlocalizedName("book_lore").setCreativeTab(null).setTextureName(RefStrings.MODID + ":holotape");
|
||||
holotape_image = new ItemHolotapeImage().setUnlocalizedName("holotape_image").setCreativeTab(null).setTextureName(RefStrings.MODID + ":holotape");
|
||||
holotape_damaged = new Item().setUnlocalizedName("holotape_damaged").setCreativeTab(null).setTextureName(RefStrings.MODID + ":holotape_damaged");
|
||||
|
||||
@ -8114,6 +8120,8 @@ public class ModItems {
|
||||
GameRegistry.registerItem(structure_single, structure_single.getUnlocalizedName());
|
||||
GameRegistry.registerItem(structure_solid, structure_solid.getUnlocalizedName());
|
||||
GameRegistry.registerItem(structure_pattern, structure_pattern.getUnlocalizedName());
|
||||
GameRegistry.registerItem(structure_randomized, structure_randomized.getUnlocalizedName());
|
||||
GameRegistry.registerItem(structure_randomly, structure_randomly.getUnlocalizedName());
|
||||
GameRegistry.registerItem(rod_of_discord, rod_of_discord.getUnlocalizedName());
|
||||
//GameRegistry.registerItem(analyzer, analyzer.getUnlocalizedName());
|
||||
//GameRegistry.registerItem(remote, remote.getUnlocalizedName());
|
||||
@ -8176,6 +8184,7 @@ public class ModItems {
|
||||
|
||||
//wow we're far down the item registry, is this the cellar?
|
||||
GameRegistry.registerItem(book_guide, book_guide.getUnlocalizedName());
|
||||
GameRegistry.registerItem(book_lore, book_lore.getUnlocalizedName());
|
||||
GameRegistry.registerItem(holotape_image, holotape_image.getUnlocalizedName());
|
||||
GameRegistry.registerItem(holotape_damaged, holotape_damaged.getUnlocalizedName());
|
||||
|
||||
|
||||
187
src/main/java/com/hbm/items/special/ItemBookLore.java
Normal file
@ -0,0 +1,187 @@
|
||||
package com.hbm.items.special;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.inventory.gui.GUIBookLore;
|
||||
import com.hbm.inventory.gui.GUIBookLore.GUIAppearance;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.tool.ItemGuideBook.BookType;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.util.I18nUtil;
|
||||
import com.hbm.world.generator.room.TestDungeonRoom8;
|
||||
|
||||
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.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/*players can have a lil lore, as a treat.
|
||||
* nothing super complex like the guidebooks, just some NBT IDs, a bit of I18n and a centered textbox.
|
||||
* oh, and also different textures for both the book, the gui, and maybe the 'turn page' button based on what type of 'book' it is.
|
||||
* no metadata, i want it to be fairly flexible. probably like the assembly templates
|
||||
*/
|
||||
public class ItemBookLore extends Item implements IGUIProvider {
|
||||
|
||||
public ItemBookLore() {
|
||||
this.setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
|
||||
if(world.isRemote)
|
||||
player.openGui(MainRegistry.instance, 0, world, 0, 0, 0);
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) {
|
||||
BookLoreType type = BookLoreType.getTypeFromStack(stack);
|
||||
|
||||
if(type.hasAuthor) {
|
||||
String unloc = I18nUtil.resolveKey("book_lore.author", I18nUtil.resolveKey("book_lore." + type.keyI18n + ".author"));
|
||||
|
||||
list.add(unloc);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
BookLoreType type = BookLoreType.getTypeFromStack(stack);
|
||||
|
||||
return "book_lore." + type.keyI18n;
|
||||
}
|
||||
|
||||
protected IIcon[] icons;
|
||||
|
||||
public final static String[] itemTextures = new String[] { ":book_guide", ":paper_loose", ":papers_loose", ":notebook" };
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister reg) {
|
||||
String[] iconStrings = itemTextures;
|
||||
this.icons = new IIcon[itemTextures.length];
|
||||
|
||||
for(int i = 0; i < icons.length; i++) {
|
||||
this.icons[i] = reg.registerIcon(RefStrings.MODID + itemTextures[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIconIndex(ItemStack stack) {
|
||||
return this.getIcon(stack, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int pass) {
|
||||
BookLoreType type = BookLoreType.getTypeFromStack(stack);
|
||||
|
||||
return this.icons[type.appearance.itemTexture];
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new GUIBookLore(player);
|
||||
}
|
||||
|
||||
public enum BookLoreType {
|
||||
TEST(true, "test", 5, GUIAppearance.NOTEBOOK),
|
||||
BOOK_IODINE(true, "book_iodine", 3, GUIAppearance.LOOSEPAPERS) {
|
||||
public String resolveKey(String key, NBTTagCompound tag) {
|
||||
return I18nUtil.resolveKey(key, tag.getInteger("mku_slot"));
|
||||
}},
|
||||
BOOK_PHOSPHOROUS(true, "book_phosphorous", 2, GUIAppearance.LOOSEPAPERS) {
|
||||
public String resolveKey(String key, NBTTagCompound tag) {
|
||||
return I18nUtil.resolveKey(key, tag.getInteger("mku_slot"));
|
||||
}},
|
||||
BOOK_DUST(true, "book_dust", 3, GUIAppearance.LOOSEPAPERS) {
|
||||
public String resolveKey(String key, NBTTagCompound tag) {
|
||||
return I18nUtil.resolveKey(key, tag.getInteger("mku_slot"));
|
||||
}},
|
||||
BOOK_MERCURY(true, "book_mercury", 2, GUIAppearance.LOOSEPAPERS) {
|
||||
public String resolveKey(String key, NBTTagCompound tag) {
|
||||
return I18nUtil.resolveKey(key, tag.getInteger("mku_slot"));
|
||||
}},
|
||||
BOOK_FLOWER(true, "book_flower", 2, GUIAppearance.LOOSEPAPERS) {
|
||||
public String resolveKey(String key, NBTTagCompound tag) {
|
||||
return I18nUtil.resolveKey(key, tag.getInteger("mku_slot"));
|
||||
}},
|
||||
BOOK_SYRINGE(true, "book_syringe", 2, GUIAppearance.LOOSEPAPERS) {
|
||||
public String resolveKey(String key, NBTTagCompound tag) {
|
||||
return I18nUtil.resolveKey(key, tag.getInteger("mku_slot"));
|
||||
}},
|
||||
RESIGNATION_NOTE(true, "resignation_note", 3, GUIAppearance.NOTEBOOK),
|
||||
MEMO_STOCKS(false, "memo_stocks", 1, GUIAppearance.LOOSEPAPER),
|
||||
MEMO_SCHRAB_GSA(false, "memo_schrab_gsa", 2, GUIAppearance.LOOSEPAPERS),
|
||||
MEMO_SCHRAB_RD(false, "memo_schrab_rd", 4, GUIAppearance.LOOSEPAPERS),
|
||||
MEMO_SCHRAB_NUKE(true, "memo_schrab_nuke", 3, GUIAppearance.LOOSEPAPERS),
|
||||
;
|
||||
|
||||
//Why? it's quite simple; i am too burnt out and also doing it the other way
|
||||
//is too inflexible for my taste
|
||||
public final GUIAppearance appearance; //gui and item texture appearance
|
||||
|
||||
public boolean hasAuthor = false;
|
||||
public final String keyI18n;
|
||||
public final int pages;
|
||||
|
||||
private BookLoreType(Boolean author, String key, int max, GUIAppearance appearance) {
|
||||
this.hasAuthor = author;
|
||||
this.keyI18n = key;
|
||||
this.pages = max;
|
||||
this.appearance = appearance;
|
||||
}
|
||||
|
||||
private BookLoreType(String key, int max, GUIAppearance appearance) {
|
||||
this.keyI18n = key;
|
||||
this.pages = max;
|
||||
this.appearance = appearance;
|
||||
}
|
||||
|
||||
/** Function to resolve I18n keys using potential save-dependent information, a la format specifiers. */
|
||||
public String resolveKey(String key, NBTTagCompound tag) {
|
||||
return I18nUtil.resolveKey(key, tag);
|
||||
}
|
||||
|
||||
public static BookLoreType getTypeFromStack(ItemStack stack) {
|
||||
if(!stack.hasTagCompound()) {
|
||||
stack.stackTagCompound = new NBTTagCompound();
|
||||
}
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
int ordinal = tag.getInteger("Book_Lore_Type");
|
||||
|
||||
return BookLoreType.values()[Math.abs(ordinal) % BookLoreType.values().length];
|
||||
}
|
||||
|
||||
public static ItemStack setTypeForStack(ItemStack stack, BookLoreType num) {
|
||||
|
||||
if(stack.getItem() instanceof ItemBookLore) {
|
||||
if(!stack.hasTagCompound()) {
|
||||
stack.stackTagCompound = new NBTTagCompound();
|
||||
}
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
tag.setInteger("Book_Lore_Type", num.ordinal());
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6,6 +6,7 @@ import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
@ -29,7 +30,8 @@ public class ItemStructurePattern extends ItemStructureTool {
|
||||
|
||||
BlockPos pos = this.getAnchor(stack);
|
||||
if(pos == null) return;
|
||||
|
||||
|
||||
String message = "";
|
||||
int savedX = stack.stackTagCompound.getInteger("x");
|
||||
int savedY = stack.stackTagCompound.getInteger("y");
|
||||
int savedZ = stack.stackTagCompound.getInteger("z");
|
||||
@ -42,15 +44,18 @@ public class ItemStructurePattern extends ItemStructureTool {
|
||||
int maxZ = Math.max(savedZ, z) - pos.getZ();
|
||||
|
||||
for(int ix = minX; ix <= maxX; ix++) {
|
||||
for(int iy = minX; iy <= maxY; iy++) {
|
||||
for(int iz = minX; iz <= maxZ; iz++) {
|
||||
for(int iy = minY; iy <= maxY; iy++) {
|
||||
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());
|
||||
int meta = world.getBlockMetadata(ix + pos.getX(), iy + pos.getY(), iz + pos.getZ());
|
||||
|
||||
System.out.println("this.placeBlockAtCurrentPosition(world, " + b.getUnlocalizedName() + ", " + meta + ", " + ix + ", " + iy + ", " + iz + ", box)");
|
||||
|
||||
message.concat("placeBlockAtCurrentPosition(world, " + b.getUnlocalizedName() + ", " + meta + ", " + ix + ", " + iy + ", " + iz + ", box);\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
System.out.print(message);
|
||||
writeToFile(message);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,47 @@
|
||||
package com.hbm.items.tool;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemStructureRandomized extends ItemStructureTool {
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
|
||||
super.addInformation(stack, player, list, ext);
|
||||
list.add(EnumChatFormatting.YELLOW + "Click to print a <fillWithRandomizedBlocks>");
|
||||
list.add(EnumChatFormatting.YELLOW + "line with block selector.");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean dualUse() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doTheThing(ItemStack stack, World world, int x, int y, int z) {
|
||||
|
||||
BlockPos pos = this.getAnchor(stack);
|
||||
if(pos == null) return;
|
||||
|
||||
int savedX = stack.stackTagCompound.getInteger("x");
|
||||
int savedY = stack.stackTagCompound.getInteger("y");
|
||||
int savedZ = stack.stackTagCompound.getInteger("z");
|
||||
|
||||
int minX = Math.min(savedX, x) - pos.getX();
|
||||
int minY = Math.min(savedY, y) - pos.getY();
|
||||
int minZ = Math.min(savedZ, z) - pos.getZ();
|
||||
int maxX = Math.max(savedX, x) - pos.getX();
|
||||
int maxY = Math.max(savedY, y) - pos.getY();
|
||||
int maxZ = Math.max(savedZ, z) - pos.getZ();
|
||||
|
||||
String message = "fillWithRandomizedBlocks(world, box, " + minX + ", " + minY + ", " + minZ + ", " + maxX + ", " + maxY + ", " + maxZ + ", rand, <block-selector>);\n";
|
||||
System.out.print(message);
|
||||
writeToFile(message);
|
||||
}
|
||||
}
|
||||
51
src/main/java/com/hbm/items/tool/ItemStructureRandomly.java
Normal file
@ -0,0 +1,51 @@
|
||||
package com.hbm.items.tool;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemStructureRandomly extends ItemStructureTool {
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
|
||||
super.addInformation(stack, player, list, ext);
|
||||
list.add(EnumChatFormatting.YELLOW + "Click to print a <randomlyFillWithBlocks>");
|
||||
list.add(EnumChatFormatting.YELLOW + "line with the targeted block.");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean dualUse() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doTheThing(ItemStack stack, World world, int x, int y, int z) {
|
||||
|
||||
BlockPos pos = this.getAnchor(stack);
|
||||
if(pos == null) return;
|
||||
|
||||
int savedX = stack.stackTagCompound.getInteger("x");
|
||||
int savedY = stack.stackTagCompound.getInteger("y");
|
||||
int savedZ = stack.stackTagCompound.getInteger("z");
|
||||
|
||||
int minX = Math.min(savedX, x) - pos.getX();
|
||||
int minY = Math.min(savedY, y) - pos.getY();
|
||||
int minZ = Math.min(savedZ, z) - pos.getZ();
|
||||
int maxX = Math.max(savedX, x) - pos.getX();
|
||||
int maxY = Math.max(savedY, y) - pos.getY();
|
||||
int maxZ = Math.max(savedZ, z) - pos.getZ();
|
||||
//Assumes the last selected block is the one that all of them are.
|
||||
Block b = world.getBlock(x, y, z);
|
||||
|
||||
String line = "randomlyFillWithBlocks(world, box, rand, <limit>, " + minX + ", " + minY + ", " + minZ + ", " + maxX + ", " + maxY + ", " + maxZ + ", " + b.getUnlocalizedName() + ");\n";
|
||||
System.out.print(line);
|
||||
writeToFile(line);
|
||||
}
|
||||
|
||||
}
|
||||
@ -26,12 +26,14 @@ public class ItemStructureSingle extends ItemStructureTool {
|
||||
if(pos == null) return;
|
||||
|
||||
int ix = x - pos.getX();
|
||||
int iy = y - pos.getX();
|
||||
int iz = z - pos.getX();
|
||||
int iy = y - pos.getY();
|
||||
int iz = z - pos.getZ();
|
||||
|
||||
Block b = world.getBlock(x, y, z);
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
System.out.println("this.placeBlockAtCurrentPosition(world, " + b.getUnlocalizedName() + ", " + meta + ", " + x + ", " + y + ", " + z + ", box)");
|
||||
|
||||
String message = "placeBlockAtCurrentPosition(world, " + b.getUnlocalizedName() + ", " + meta + ", " + ix + ", " + iy + ", " + iz + ", box);\n";
|
||||
System.out.print(message);
|
||||
writeToFile(message);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import java.util.List;
|
||||
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
@ -14,7 +15,7 @@ public class ItemStructureSolid extends ItemStructureTool {
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
|
||||
super.addInformation(stack, player, list, ext);
|
||||
list.add(EnumChatFormatting.YELLOW + "Click to print a <fillWithMetadataBlocks>");
|
||||
list.add(EnumChatFormatting.YELLOW + "Click to print a <fillWithMetadataBlocks> or <fillWithBlocks>");
|
||||
list.add(EnumChatFormatting.YELLOW + "line with wildcard block and metadata.");
|
||||
}
|
||||
|
||||
@ -39,7 +40,17 @@ public class ItemStructureSolid extends ItemStructureTool {
|
||||
int maxX = Math.max(savedX, x) - pos.getX();
|
||||
int maxY = Math.max(savedY, y) - pos.getY();
|
||||
int maxZ = Math.max(savedZ, z) - pos.getZ();
|
||||
//Assumes the last selected block is the one that all of them are.
|
||||
Block b = world.getBlock(x, y, z);
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
System.out.println("this.fillWithMetadataBlocks(world, box, " + minX + ", " + minY + ", " + minZ + ", " + maxX + ", " + maxY + ", " + maxZ + ", <block>, <meta>, Blocks.air, 0, false)");
|
||||
String line;
|
||||
if(meta > 0)
|
||||
line = "fillWithMetadataBlocks(world, box, " + minX + ", " + minY + ", " + minZ + ", " + maxX + ", " + maxY + ", " + maxZ + ", " + b.getUnlocalizedName() +", " + meta +");\n";
|
||||
else
|
||||
line = "fillWithBlocks(world, box, " + minX + ", " + minY + ", " + minZ + ", " + maxX + ", " + maxY + ", " + maxZ + ", " + b.getUnlocalizedName() +");\n";
|
||||
|
||||
System.out.print(line);
|
||||
writeToFile(line);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,10 +1,15 @@
|
||||
package com.hbm.items.tool;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.config.GeneralConfig;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@ -19,13 +24,33 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||
|
||||
public abstract class ItemStructureTool extends Item implements ILookOverlay {
|
||||
|
||||
File file = new File(MainRegistry.configHbmDir, "structureOutput.txt");
|
||||
FileWriter writer;
|
||||
|
||||
public void writeToFile(String message) {
|
||||
if(!GeneralConfig.enableDebugMode)
|
||||
return;
|
||||
|
||||
try {
|
||||
if(!file.exists()) file.createNewFile();
|
||||
if(writer == null) writer = new FileWriter(file, true);
|
||||
|
||||
writer.write(message);
|
||||
writer.flush();
|
||||
} catch(IOException e) {
|
||||
System.out.print("ItemStructureWand encountered an IOException!");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
|
||||
BlockPos anchor = this.getAnchor(stack);
|
||||
|
||||
if(anchor == null) {
|
||||
if(anchor == null)
|
||||
list.add(EnumChatFormatting.RED + "No anchor set! Right click an anchor to get started.");
|
||||
}
|
||||
|
||||
if(GeneralConfig.enableDebugMode)
|
||||
list.add(EnumChatFormatting.GREEN + "Will write to \"structureOutput.txt\" in hbmConfig.");
|
||||
}
|
||||
|
||||
public static BlockPos getAnchor(ItemStack stack) {
|
||||
@ -62,7 +87,7 @@ public abstract class ItemStructureTool extends Item implements ILookOverlay {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!this.dualUse()) {
|
||||
if(!this.dualUse() && world.isRemote) {
|
||||
this.doTheThing(stack, world, x, y, z);
|
||||
} else {
|
||||
|
||||
@ -71,7 +96,8 @@ public abstract class ItemStructureTool extends Item implements ILookOverlay {
|
||||
stack.stackTagCompound.setInteger("y", y);
|
||||
stack.stackTagCompound.setInteger("z", z);
|
||||
} else {
|
||||
this.doTheThing(stack, world, x, y, z);
|
||||
if(world.isRemote)
|
||||
this.doTheThing(stack, world, x, y, z);
|
||||
stack.stackTagCompound.removeTag("x");
|
||||
stack.stackTagCompound.removeTag("y");
|
||||
stack.stackTagCompound.removeTag("z");
|
||||
|
||||
@ -6,6 +6,8 @@ import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.entity.effect.EntityNukeTorex;
|
||||
import com.hbm.entity.mob.siege.EntitySiegeTunneler;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.special.ItemBookLore;
|
||||
import com.hbm.items.special.ItemBookLore.BookLoreType;
|
||||
import com.hbm.items.special.ItemKitCustom;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.world.feature.OilSpot;
|
||||
@ -19,6 +21,8 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.structure.MapGenStronghold;
|
||||
import net.minecraft.world.gen.structure.StructureBoundingBox;
|
||||
|
||||
public class ItemWandD extends Item {
|
||||
|
||||
@ -32,7 +36,22 @@ public class ItemWandD extends Item {
|
||||
|
||||
if(pos != null) {
|
||||
|
||||
OilSpot.generateOilSpot(world, pos.blockX, pos.blockZ, 20, 500);
|
||||
/*ItemStack itemStack = new ItemStack(ModItems.book_lore);
|
||||
BookLoreType.setTypeForStack(itemStack, BookLoreType.BOOK_IODINE);
|
||||
|
||||
player.inventory.addItemStackToInventory(itemStack);
|
||||
player.inventoryContainer.detectAndSendChanges();*/
|
||||
|
||||
//use sparingly
|
||||
/*int k = ((pos.blockX >> 4) << 4) + 8;
|
||||
int l = ((pos.blockZ >> 4) << 4) + 8;
|
||||
|
||||
MapGenBunker.Start start = new MapGenBunker.Start(world, world.rand, pos.blockX >> 4, pos.blockZ >> 4);
|
||||
start.generateStructure(world, world.rand, new StructureBoundingBox(k - 124, l - 124, k + 15 + 124, l + 15 + 124));*/
|
||||
//MapGenStronghold.Start startS = new MapGenStronghold.Start(world, world.rand, pos.blockX >> 4, pos.blockZ >> 4);
|
||||
//startS.generateStructure(world, world.rand, new StructureBoundingBox(k - 124, l - 124, k + 15 + 124, l + 15 + 124));
|
||||
|
||||
/*OilSpot.generateOilSpot(world, pos.blockX, pos.blockZ, 20, 500);*/
|
||||
|
||||
/*EntityNukeTorex torex = new EntityNukeTorex(world);
|
||||
torex.setPositionAndRotation(pos.blockX, pos.blockY + 1, pos.blockZ, 0, 0);
|
||||
|
||||
@ -6,6 +6,7 @@ import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemBreedingRod.*;
|
||||
import com.hbm.items.special.ItemBookLore.BookLoreType;
|
||||
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
@ -352,52 +353,31 @@ public class HbmChestContents {
|
||||
new WeightedRandomChestContent(ModItems.can_creature, 0, 1, 2, 2),
|
||||
new WeightedRandomChestContent(ModItems.can_smart, 0, 1, 3, 2),
|
||||
new WeightedRandomChestContent(ModItems.can_mrsugar, 0, 1, 2, 2),
|
||||
new WeightedRandomChestContent(ModItems.cap_nuka, 0, 1, 16, 2),
|
||||
new WeightedRandomChestContent(ModItems.book_guide, 3, 1, 1, 1),
|
||||
new WeightedRandomChestContent(Item.getItemFromBlock(ModBlocks.deco_computer), 0, 1, 1, 1)};
|
||||
|
||||
/** Nowhere else to put this and this seems like the most fitting place **/
|
||||
public static ItemStack genetateBook(String key) {
|
||||
|
||||
String author = resolve("book.lore." + key + ".author");
|
||||
String title = resolve("book.lore." + key + ".title");
|
||||
|
||||
ItemStack book = new ItemStack(Items.written_book);
|
||||
book.stackTagCompound = new NBTTagCompound();
|
||||
book.stackTagCompound.setString("author", author);
|
||||
book.stackTagCompound.setString("title", title);
|
||||
NBTTagList nbt = new NBTTagList();
|
||||
|
||||
for(byte i = 1; i <= 50; i++) {
|
||||
String unloc = "book.lore." + key + ".page" + i;
|
||||
String page = resolve(unloc);
|
||||
|
||||
if(page.equals(unloc))
|
||||
break;
|
||||
else
|
||||
nbt.appendTag(new NBTTagString(page));
|
||||
}
|
||||
|
||||
book.stackTagCompound.setTag("pages", nbt);
|
||||
|
||||
return book;
|
||||
}
|
||||
public static WeightedRandomChestContent[] filingCabinet = new WeightedRandomChestContent[] {
|
||||
new WeightedRandomChestContent(Items.paper, 0, 1, 12, 240),
|
||||
new WeightedRandomChestContent(Items.book, 0, 1, 3, 90),
|
||||
new WeightedRandomChestContent(Items.map, 0, 1, 1, 50),
|
||||
new WeightedRandomChestContent(Items.writable_book, 0, 1, 1, 30),
|
||||
new WeightedRandomChestContent(ModItems.cigarette, 0, 1, 16, 20),
|
||||
new WeightedRandomChestContent(ModItems.toothpicks, 0, 1, 16, 10),
|
||||
new WeightedRandomChestContent(ModItems.dust, 0, 1, 1, 40),
|
||||
new WeightedRandomChestContent(ModItems.dust_tiny, 0, 1, 3, 75),
|
||||
new WeightedRandomChestContent(ModItems.ink, 0, 1, 1, 1), //make that mf rare; 1:555 weight
|
||||
};
|
||||
|
||||
private static String resolve(String key) {
|
||||
String result = books.get(key);
|
||||
return result != null ? result : key;
|
||||
}
|
||||
/** ITEMBOOKLORE ARRAYS */
|
||||
//might make a wrapper class for this, if game-state knowledge using the nbt system becomes that relevant
|
||||
public final static BookLoreType[] books_office_sch = new BookLoreType[] {
|
||||
BookLoreType.RESIGNATION_NOTE,
|
||||
BookLoreType.MEMO_STOCKS,
|
||||
BookLoreType.MEMO_SCHRAB_GSA,
|
||||
BookLoreType.MEMO_SCHRAB_RD,
|
||||
BookLoreType.MEMO_SCHRAB_NUKE,
|
||||
};
|
||||
|
||||
private static HashMap<String, String> books = new HashMap();
|
||||
|
||||
static {
|
||||
books.put("book.lore.office0.title", "Letter of Resignation");
|
||||
books.put("book.lore.office0.author", "Kosma");
|
||||
books.put("book.lore.office0.page1", "Management downsized our department again yesterday. Those idiots only have themselves to blame, I don't know what they were expecting after the Panay fiasco. Who the hell leaks that sort of information? We're losing millions and");
|
||||
books.put("book.lore.office0.page2", "it's ME who's the one out of a job now. I'M the one being asked to resign. I hope you asshats finally learn from your overabundance of mistakes and take that stick out of your ass.");
|
||||
books.put("book.lore.office0.page3", "I'm not coming back on Friday. Just send the paycheck.");
|
||||
books.put("book.lore.office1.title", "Note");
|
||||
books.put("book.lore.office1.author", "Jonas");
|
||||
books.put("book.lore.office1.page1", null);
|
||||
books.put("book.lore.office2.page2", null);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,10 +2,9 @@ package com.hbm.lib;
|
||||
|
||||
import com.hbm.world.worldgen.MapGenNTMFeatures;
|
||||
import com.hbm.world.worldgen.NTMWorldGenerator;
|
||||
import com.hbm.world.worldgen.components.CivilianFeatures.*;
|
||||
import com.hbm.world.worldgen.components.MilitaryBaseFeatures.*;
|
||||
import com.hbm.world.worldgen.components.OfficeFeatures.*;
|
||||
import com.hbm.world.worldgen.components.RuinFeatures.*;
|
||||
import com.hbm.world.worldgen.components.CivilianFeatures;
|
||||
import com.hbm.world.worldgen.components.OfficeFeatures;
|
||||
import com.hbm.world.worldgen.components.RuinFeatures;
|
||||
|
||||
import cpw.mods.fml.common.IWorldGenerator;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
@ -35,18 +34,8 @@ public class HbmWorld {
|
||||
|
||||
/** Register structures in MapGenStructureIO */
|
||||
public static void registerNTMFeatures() {
|
||||
MapGenStructureIO.func_143031_a(NTMHouse1.class, "NTMHouse1");
|
||||
MapGenStructureIO.func_143031_a(NTMHouse2.class, "NTMHouse2");
|
||||
MapGenStructureIO.func_143031_a(NTMLab1.class, "NTMLab1");
|
||||
MapGenStructureIO.func_143031_a(NTMLab2.class, "NTMLab2");
|
||||
MapGenStructureIO.func_143031_a(NTMWorkshop1.class, "NTMWorkshop1");
|
||||
MapGenStructureIO.func_143031_a(NTMRuin1.class, "NTMRuin1");
|
||||
MapGenStructureIO.func_143031_a(NTMRuin2.class, "NTMRuin2");
|
||||
MapGenStructureIO.func_143031_a(NTMRuin3.class, "NTMRuin3");
|
||||
MapGenStructureIO.func_143031_a(NTMRuin4.class, "NTMRuin4");
|
||||
//aggggggggggg
|
||||
MapGenStructureIO.func_143031_a(BasicHelipad.class, "NTMBasicHelipad");
|
||||
MapGenStructureIO.func_143031_a(RadioShack.class, "NTMRadioShack");
|
||||
MapGenStructureIO.func_143031_a(LargeOffice.class, "NTMLargeOffice");
|
||||
CivilianFeatures.registerComponents();
|
||||
OfficeFeatures.registerComponents();
|
||||
RuinFeatures.registerComponents();
|
||||
}
|
||||
}
|
||||
|
||||
@ -291,6 +291,8 @@ public class ClientProxy extends ServerProxy {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySubstation.class, new RenderSubstation());
|
||||
//chargers
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCharger.class, new RenderCharger());
|
||||
//DecoContainer
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityFileCabinet.class, new RenderFileCabinet());
|
||||
//multiblocks
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityStructureMarker.class, new RenderStructureMaker());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMultiblock.class, new RenderMultiblock());
|
||||
|
||||
@ -3,6 +3,7 @@ package com.hbm.main;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.BlockEnums.DecoCabinetEnum;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.blocks.generic.BlockGenericStairs;
|
||||
import com.hbm.blocks.generic.BlockMultiSlab;
|
||||
@ -975,6 +976,12 @@ public class CraftingManager {
|
||||
addRecipeAuto(new ItemStack(ModBlocks.brick_fire), new Object[] { "BB", "BB", 'B', ModItems.ingot_firebrick });
|
||||
addShapelessAuto(new ItemStack(ModItems.ingot_firebrick, 4), new Object[] { ModBlocks.brick_fire });
|
||||
|
||||
addRecipeAuto(new ItemStack(ModBlocks.filing_cabinet, 1, DecoCabinetEnum.STEEL.ordinal()), new Object[] { " P ", "PIP", " P ", 'P', STEEL.plate(), 'I', ModItems.plate_polymer });
|
||||
|
||||
addRecipeAuto(new ItemStack(ModBlocks.vinyl_tile, 4), new Object[] { " I ", "IBI", " I ", 'I', ModItems.plate_polymer, 'B', ModBlocks.brick_light });
|
||||
addRecipeAuto(new ItemStack(ModBlocks.vinyl_tile, 4, 1), new Object[] { "BB", "BB", 'B', new ItemStack(ModBlocks.vinyl_tile, 1, 0) });
|
||||
addShapelessAuto(new ItemStack(ModBlocks.vinyl_tile), new Object[] { new ItemStack(ModBlocks.vinyl_tile, 1, 1) });
|
||||
|
||||
addShapelessAuto(new ItemStack(ModItems.upgrade_5g), new Object[] { ModItems.upgrade_template, ModItems.gem_alexandrite });
|
||||
|
||||
if(GeneralConfig.enableLBSM && GeneralConfig.enableLBSMSimpleCrafting) {
|
||||
|
||||
@ -321,6 +321,9 @@ public class ResourceManager {
|
||||
//Belt
|
||||
public static final IModelCustom charger = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/blocks/charger.obj"));
|
||||
|
||||
//DecoContainer (File Cabinet for now)
|
||||
public static final IModelCustom file_cabinet = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/file_cabinet.obj"));
|
||||
|
||||
////Textures TEs
|
||||
|
||||
public static final ResourceLocation universal = new ResourceLocation(RefStrings.MODID, "textures/models/TheGadget3_.png");
|
||||
@ -659,6 +662,10 @@ public class ResourceManager {
|
||||
//Charger
|
||||
public static final ResourceLocation charger_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/charger.png");
|
||||
|
||||
//DecoContainer
|
||||
public static final ResourceLocation file_cabinet_tex = new ResourceLocation(RefStrings.MODID, "textures/models/file_cabinet.png");
|
||||
public static final ResourceLocation file_cabinet_steel_tex = new ResourceLocation(RefStrings.MODID, "textures/models/file_cabinet_steel.png");
|
||||
|
||||
////Obj Items
|
||||
|
||||
//Shimmer Sledge
|
||||
|
||||
@ -35,7 +35,8 @@ public class RenderBlockDecoModel implements ISimpleBlockRenderingHandler {
|
||||
iicon = renderer.overrideBlockTexture;
|
||||
}
|
||||
|
||||
GL11.glRotated(-15, 0, 1, 0);
|
||||
GL11.glTranslated(0, 0.1D, 0);
|
||||
GL11.glScaled(1.2D, 1.2D, 1.2D);
|
||||
tessellator.startDrawingQuads();
|
||||
ObjUtil.renderWithIcon((WavefrontObject) model, iicon, tessellator, modelId, false);
|
||||
|
||||
@ -49,7 +50,7 @@ public class RenderBlockDecoModel implements ISimpleBlockRenderingHandler {
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
IIcon iicon = block.getIcon(0, meta & 12);
|
||||
IIcon iicon = block.getIcon(0, meta & 3);
|
||||
tessellator.setColorOpaque_F(1, 1, 1);
|
||||
|
||||
if(renderer.hasOverrideBlockTexture()) {
|
||||
@ -61,7 +62,7 @@ public class RenderBlockDecoModel implements ISimpleBlockRenderingHandler {
|
||||
|
||||
float rotation = 0;
|
||||
|
||||
switch(meta & 3) {
|
||||
switch(meta >> 2) {
|
||||
default: //North
|
||||
rotation = (float) Math.PI; break;
|
||||
case 1: //South
|
||||
|
||||
@ -0,0 +1,94 @@
|
||||
package com.hbm.render.tileentity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.render.item.ItemRenderBase;
|
||||
import com.hbm.tileentity.machine.storage.TileEntityFileCabinet;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
public class RenderFileCabinet extends TileEntitySpecialRenderer implements IItemRendererProvider {
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float interp) {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5, y, z + 0.5);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
|
||||
switch(tile.getBlockMetadata() >> 2) { //rotation
|
||||
case 0:
|
||||
GL11.glRotatef(180, 0F, 1F, 0F);
|
||||
break;
|
||||
case 1:
|
||||
GL11.glRotatef(0, 0F, 1F, 0F);
|
||||
break;
|
||||
case 2:
|
||||
GL11.glRotatef(270, 0F, 1F, 0F);
|
||||
break;
|
||||
case 3:
|
||||
GL11.glRotatef(90, 0F, 1F, 0F);
|
||||
break;
|
||||
}
|
||||
|
||||
switch(tile.getBlockMetadata() & 3) {
|
||||
default:
|
||||
bindTexture(ResourceManager.file_cabinet_tex); break;
|
||||
case 1:
|
||||
bindTexture(ResourceManager.file_cabinet_steel_tex); //sadge
|
||||
}
|
||||
|
||||
TileEntityFileCabinet cabinet = (TileEntityFileCabinet) tile;
|
||||
|
||||
ResourceManager.file_cabinet.renderPart("Cabinet");
|
||||
|
||||
GL11.glPushMatrix();
|
||||
float lower = cabinet.prevLowerExtent + (cabinet.lowerExtent - cabinet.prevLowerExtent) * interp;
|
||||
GL11.glTranslated(0F, 0F, 0.6875F * lower);
|
||||
ResourceManager.file_cabinet.renderPart("LowerDrawer");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
float upper = cabinet.prevUpperExtent + (cabinet.upperExtent - cabinet.prevUpperExtent) * interp;
|
||||
GL11.glTranslated(0F, 0F, 0.6875F * upper);
|
||||
ResourceManager.file_cabinet.renderPart("UpperDrawer");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemForRenderer() {
|
||||
return Item.getItemFromBlock(ModBlocks.filing_cabinet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemRenderer getRenderer() {
|
||||
return new ItemRenderBase() {
|
||||
public void renderInventory() {
|
||||
GL11.glTranslated(-1D, 0.5D, -1D);
|
||||
GL11.glRotatef(180F, 0, 1F, 0);
|
||||
GL11.glScalef(4F, 4F, 4F);
|
||||
}
|
||||
public void renderCommonWithStack(ItemStack stack) {
|
||||
GL11.glTranslated(0, -1.25D, 0);
|
||||
GL11.glScaled(2.75D, 2.75D, 2.75D);
|
||||
|
||||
switch(stack.getItemDamage()) {
|
||||
default:
|
||||
bindTexture(ResourceManager.file_cabinet_tex); break;
|
||||
case 1:
|
||||
bindTexture(ResourceManager.file_cabinet_steel_tex);
|
||||
}
|
||||
|
||||
ResourceManager.file_cabinet.renderAll();
|
||||
}};
|
||||
}
|
||||
}
|
||||
@ -184,6 +184,8 @@ public class TileMappings {
|
||||
|
||||
put(TileEntityCharger.class, "tileentity_ntm_charger");
|
||||
|
||||
put(TileEntityFileCabinet.class, "tileentity_file_cabinet");
|
||||
|
||||
put(TileEntityProxyInventory.class, "tileentity_proxy_inventory");
|
||||
put(TileEntityProxyEnergy.class, "tileentity_proxy_power");
|
||||
put(TileEntityProxyCombo.class, "tileentity_proxy_combo");
|
||||
|
||||
@ -0,0 +1,162 @@
|
||||
package com.hbm.tileentity.machine.storage;
|
||||
|
||||
import com.hbm.inventory.container.ContainerFileCabinet;
|
||||
import com.hbm.inventory.gui.GUIFileCabinet;
|
||||
import com.hbm.packet.NBTPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TileEntityFileCabinet extends TileEntityCrateBase implements IGUIProvider, INBTPacketReceiver {
|
||||
|
||||
private int timer = 0;
|
||||
private int playersUsing = 0;
|
||||
//meh, it's literally just two extra variables
|
||||
public float lowerExtent = 0; //i don't know a term for how 'open' something is
|
||||
public float prevLowerExtent = 0;
|
||||
public float upperExtent = 0;
|
||||
public float prevUpperExtent = 0;
|
||||
|
||||
public TileEntityFileCabinet() {
|
||||
super(8);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "container.fileCabinet";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
if(!worldObj.isRemote) this.playersUsing++;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
if(!worldObj.isRemote) this.playersUsing--;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
if(this.playersUsing > 0) {
|
||||
if(timer < 10) {
|
||||
timer++;
|
||||
}
|
||||
} else
|
||||
timer = 0;
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setInteger("timer", timer);
|
||||
data.setInteger("playersUsing", this.playersUsing);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new NBTPacket(data, xCoord, yCoord, zCoord), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 25));
|
||||
} else {
|
||||
this.prevLowerExtent = lowerExtent;
|
||||
this.prevUpperExtent = upperExtent;
|
||||
}
|
||||
|
||||
float openSpeed = playersUsing > 0 ? 1F / 16F : 1F / 25F;
|
||||
float maxExtent = 0.8F;
|
||||
|
||||
if(this.playersUsing > 0) {
|
||||
if(lowerExtent == 0F && upperExtent == 0F)
|
||||
this.worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "hbm:block.crateOpen", 0.8F, 1.0F);
|
||||
else {
|
||||
if(upperExtent + openSpeed >= maxExtent && lowerExtent < maxExtent)
|
||||
this.worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "hbm:block.crateOpen", 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.7F);
|
||||
|
||||
if(lowerExtent + openSpeed >= maxExtent && lowerExtent < maxExtent)
|
||||
this.worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "hbm:block.crateOpen", 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.7F);
|
||||
}
|
||||
|
||||
this.lowerExtent += openSpeed;
|
||||
|
||||
if(timer >= 10)
|
||||
this.upperExtent += openSpeed;
|
||||
|
||||
} else if(lowerExtent > 0) {
|
||||
if(upperExtent - openSpeed < maxExtent / 2 && upperExtent >= maxExtent / 2 && upperExtent != lowerExtent)
|
||||
this.worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "hbm:block.crateClose", 0.8F, 1.0F);
|
||||
|
||||
if(lowerExtent - openSpeed < maxExtent / 2 && lowerExtent >= maxExtent / 2)
|
||||
this.worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "hbm:block.crateClose", 0.8F, 1.0F);
|
||||
|
||||
this.upperExtent -= openSpeed;
|
||||
this.lowerExtent -= openSpeed;
|
||||
}
|
||||
|
||||
this.lowerExtent = MathHelper.clamp_float(lowerExtent, 0F, maxExtent);
|
||||
this.upperExtent = MathHelper.clamp_float(upperExtent, 0F, maxExtent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
this.timer = nbt.getInteger("timer");
|
||||
this.playersUsing = nbt.getInteger("playersUsing");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new ContainerFileCabinet(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new GUIFileCabinet(player.inventory, this);
|
||||
}
|
||||
|
||||
//No automation, it's a filing cabinet.
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int i, ItemStack itemStack, int j) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int i, ItemStack itemStack, int j) {
|
||||
return false;
|
||||
}
|
||||
|
||||
AxisAlignedBB bb = null;
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getRenderBoundingBox() {
|
||||
|
||||
if(bb == null) {
|
||||
bb = AxisAlignedBB.getBoundingBox(
|
||||
xCoord - 1,
|
||||
yCoord,
|
||||
zCoord - 1,
|
||||
xCoord + 1,
|
||||
yCoord + 1,
|
||||
zCoord + 1
|
||||
);
|
||||
}
|
||||
|
||||
return bb;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public double getMaxRenderDistanceSquared() {
|
||||
return 65536.0D;
|
||||
}
|
||||
}
|
||||
@ -83,6 +83,32 @@ public class LootGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
public static void lootMakeshiftGun(World world, int x, int y, int z) {
|
||||
|
||||
TileEntityLoot loot = (TileEntityLoot) world.getTileEntity(x, y, z);
|
||||
|
||||
if(loot != null && loot.items.isEmpty()) {
|
||||
|
||||
if(world.rand.nextInt(2) == 0)
|
||||
addItemWithDeviation(loot, world.rand, new ItemStack(ModItems.gun_lever_action), 0, 0, 0.125);
|
||||
|
||||
int count = world.rand.nextInt(2) + 1;
|
||||
for(int i = 0; i < count; i++) {
|
||||
int type = world.rand.nextInt(2);
|
||||
Item parts = type < 1 ? ModItems.plate_steel : ModItems.mechanism_rifle_1;
|
||||
addItemWithDeviation(loot, world.rand, new ItemStack(parts), -0.3125, i * 0.03125, 0.3125);
|
||||
}
|
||||
|
||||
count = world.rand.nextInt(2) + 2;
|
||||
for(int i = 0; i < count; i++)
|
||||
addItemWithDeviation(loot, world.rand, new ItemStack(ModItems.wire_aluminium), 0.3125, i * 0.03125, -0.125);
|
||||
|
||||
int type = world.rand.nextInt(4);
|
||||
Item tool = type > 2 ? ModItems.wrench : ModItems.screwdriver;
|
||||
addItemWithDeviation(loot, world.rand, new ItemStack(tool), 0.005, 0, -0.3125);
|
||||
}
|
||||
}
|
||||
|
||||
public static void lootNukeStorage(World world, int x, int y, int z) {
|
||||
|
||||
TileEntityLoot loot = (TileEntityLoot) world.getTileEntity(x, y, z);
|
||||
|
||||
@ -3,6 +3,7 @@ package com.hbm.world.generator.room;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.crafting.handlers.MKUCraftingHandler;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.special.ItemBookLore.BookLoreType;
|
||||
import com.hbm.tileentity.machine.storage.TileEntitySafe;
|
||||
import com.hbm.world.generator.CellularDungeon;
|
||||
import com.hbm.world.generator.CellularDungeonRoom;
|
||||
@ -55,7 +56,7 @@ public class TestDungeonRoom8 extends CellularDungeonRoom {
|
||||
if(r == 0)
|
||||
((TileEntitySafe)world.getTileEntity(x + parent.width / 2, y + 2, z + parent.width / 2)).setInventorySlotContents(7, new ItemStack(ModItems.book_of_));
|
||||
else if(r < 4)
|
||||
((TileEntitySafe)world.getTileEntity(x + parent.width / 2, y + 2, z + parent.width / 2)).setInventorySlotContents(7, genetateMKU(world));
|
||||
((TileEntitySafe)world.getTileEntity(x + parent.width / 2, y + 2, z + parent.width / 2)).setInventorySlotContents(7, generateMKU(world));
|
||||
else
|
||||
((TileEntitySafe)world.getTileEntity(x + parent.width / 2, y + 2, z + parent.width / 2)).setInventorySlotContents(7, new ItemStack(Items.book));
|
||||
}
|
||||
@ -63,7 +64,58 @@ public class TestDungeonRoom8 extends CellularDungeonRoom {
|
||||
}
|
||||
}
|
||||
|
||||
public static ItemStack genetateMKU(World world) {
|
||||
public static ItemStack generateMKU(World world) {
|
||||
ItemStack book = new ItemStack(ModItems.book_lore);
|
||||
int i = world.rand.nextInt(books.length);
|
||||
|
||||
BookLoreType.setTypeForStack(book, books[i]);
|
||||
book.stackTagCompound.setInteger("mku_slot", getSlot(world, books[i]));
|
||||
|
||||
return book;
|
||||
}
|
||||
|
||||
public static int getSlot(World world, BookLoreType type) {
|
||||
|
||||
MKUCraftingHandler.generateRecipe(world);
|
||||
ItemStack[] recipe = MKUCraftingHandler.MKURecipe;
|
||||
|
||||
Item item;
|
||||
//fucking kill me
|
||||
switch(type) {
|
||||
case BOOK_DUST:
|
||||
item = ModItems.dust; break;
|
||||
case BOOK_FLOWER:
|
||||
item = ModItems.morning_glory; break;
|
||||
case BOOK_IODINE:
|
||||
item = ModItems.powder_iodine; break;
|
||||
case BOOK_MERCURY:
|
||||
item = ModItems.ingot_mercury; break;
|
||||
case BOOK_PHOSPHOROUS:
|
||||
item = ModItems.powder_fire; break;
|
||||
case BOOK_SYRINGE:
|
||||
item = ModItems.syringe_metal_empty; break;
|
||||
default:
|
||||
item = ModItems.nothing; break;
|
||||
}
|
||||
|
||||
if(recipe == null) //take no chances
|
||||
return -2;
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
|
||||
if(recipe[i] != null && recipe[i].getItem() == item) {
|
||||
return i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
private final static BookLoreType[] books = new BookLoreType[] {
|
||||
BookLoreType.BOOK_IODINE, BookLoreType.BOOK_PHOSPHOROUS, BookLoreType.BOOK_DUST, BookLoreType.BOOK_MERCURY, BookLoreType.BOOK_FLOWER, BookLoreType.BOOK_SYRINGE
|
||||
};
|
||||
|
||||
/*public static ItemStack genetateMKU(World world) {
|
||||
|
||||
ItemStack book = new ItemStack(Items.written_book);
|
||||
book.stackTagCompound = new NBTTagCompound();
|
||||
@ -155,7 +207,7 @@ public class TestDungeonRoom8 extends CellularDungeonRoom {
|
||||
return copy;
|
||||
}
|
||||
|
||||
public static int getSlot(World world, Item item) {
|
||||
public static int getSlot(World world, Item item) {
|
||||
|
||||
MKUCraftingHandler.generateRecipe(world);
|
||||
ItemStack[] recipe = MKUCraftingHandler.MKURecipe;
|
||||
@ -171,5 +223,5 @@ public class TestDungeonRoom8 extends CellularDungeonRoom {
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@ -9,8 +9,6 @@ import java.util.Random;
|
||||
import com.hbm.config.GeneralConfig;
|
||||
import com.hbm.config.StructureConfig;
|
||||
import com.hbm.world.worldgen.components.CivilianFeatures.*;
|
||||
import com.hbm.world.worldgen.components.MilitaryBaseFeatures;
|
||||
import com.hbm.world.worldgen.components.MilitaryBaseFeatures.*;
|
||||
import com.hbm.world.worldgen.components.OfficeFeatures.*;
|
||||
import com.hbm.world.worldgen.components.RuinFeatures.*;
|
||||
|
||||
@ -109,7 +107,7 @@ public class MapGenNTMFeatures extends MapGenStructure {
|
||||
* Rainfall & Temperature Check
|
||||
*/
|
||||
//TODO: Do something about this so it's nice-looking and easily readable. Plus, test compatibility against mods like BoP
|
||||
if(rand.nextBoolean()) { //Empty Ruin Structures
|
||||
if(rand.nextInt(3) == 0) { //Empty Ruin Structures
|
||||
switch(rand.nextInt(4)) {
|
||||
case 0:
|
||||
NTMRuin1 ruin1 = new NTMRuin1(rand, chunkX * 16 + 8, posY, chunkZ * 16 + 8);
|
||||
@ -140,12 +138,8 @@ public class MapGenNTMFeatures extends MapGenStructure {
|
||||
} else if(biome.temperature >= 0.25 && biome.temperature <= 0.3 && biome.rainfall >= 0.6 && biome.rainfall <= 0.9 && rand.nextBoolean()) { //Taiga & Mega Taiga
|
||||
NTMWorkshop1 workshop1 = new NTMWorkshop1(rand, chunkX * 16 + 8, posY, chunkZ * 16 + 8);
|
||||
this.components.add(workshop1);
|
||||
|
||||
} else if(biome.heightVariation <= 0.2 && biome.rainfall <= 0.5 && !(biome instanceof BiomeGenBeach) && rand.nextInt(3) == 0) { //Everything except jungles, extra-hilly areas, and beaches
|
||||
MilitaryBaseFeatures.smallHelipad(components, chunkX, posY, chunkZ, rand); //agggggggg
|
||||
|
||||
} else { //Everything else
|
||||
switch(rand.nextInt(3)) {
|
||||
switch(rand.nextInt(4)) {
|
||||
case 0:
|
||||
NTMLab2 lab2 = new NTMLab2(rand, chunkX * 16 + 8, posY, chunkZ * 16 + 8);
|
||||
this.components.add(lab2); break;
|
||||
@ -155,6 +149,9 @@ public class MapGenNTMFeatures extends MapGenStructure {
|
||||
case 2:
|
||||
LargeOffice office = new LargeOffice(rand, chunkX * 16 + 8, posY, chunkZ * 16 + 8);
|
||||
this.components.add(office); break;
|
||||
case 3:
|
||||
LargeOfficeCorner officeCorner = new LargeOfficeCorner(rand, chunkX * 16 + 8, posY, chunkZ * 16 + 8);
|
||||
this.components.add(officeCorner); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -14,6 +14,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntityChest;
|
||||
import net.minecraft.util.WeightedRandomChestContent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.structure.MapGenStructureIO;
|
||||
import net.minecraft.world.gen.structure.StructureBoundingBox;
|
||||
|
||||
/* Described as "Civilian", as that's the overarching connection between all of these structures. Unlike the ruins, there's not enough to
|
||||
@ -21,8 +22,16 @@ import net.minecraft.world.gen.structure.StructureBoundingBox;
|
||||
*/
|
||||
public class CivilianFeatures {
|
||||
|
||||
public static void registerComponents() {
|
||||
MapGenStructureIO.func_143031_a(NTMHouse1.class, "NTMHouse1");
|
||||
MapGenStructureIO.func_143031_a(NTMHouse2.class, "NTMHouse2");
|
||||
MapGenStructureIO.func_143031_a(NTMLab1.class, "NTMLab1");
|
||||
MapGenStructureIO.func_143031_a(NTMLab2.class, "NTMLab2");
|
||||
MapGenStructureIO.func_143031_a(NTMWorkshop1.class, "NTMWorkshop1");
|
||||
}
|
||||
|
||||
/** Sandstone Ruin 1 */
|
||||
public static class NTMHouse1 extends Feature {
|
||||
public static class NTMHouse1 extends Component {
|
||||
|
||||
private boolean hasPlacedChest;
|
||||
|
||||
@ -120,7 +129,7 @@ public class CivilianFeatures {
|
||||
|
||||
}
|
||||
|
||||
public static class NTMHouse2 extends Feature {
|
||||
public static class NTMHouse2 extends Component {
|
||||
|
||||
private static Sandstone RandomSandstone = new Sandstone();
|
||||
|
||||
@ -264,7 +273,7 @@ public class CivilianFeatures {
|
||||
}
|
||||
}
|
||||
|
||||
public static class NTMLab1 extends Feature {
|
||||
public static class NTMLab1 extends Component {
|
||||
|
||||
private static ConcreteBricks RandomConcreteBricks = new ConcreteBricks();
|
||||
private static LabTiles RandomLabTiles = new LabTiles();
|
||||
@ -391,7 +400,7 @@ public class CivilianFeatures {
|
||||
}
|
||||
}
|
||||
|
||||
public static class NTMLab2 extends Feature {
|
||||
public static class NTMLab2 extends Component {
|
||||
|
||||
private static SuperConcrete RandomSuperConcrete = new SuperConcrete();
|
||||
private static ConcreteBricks RandomConcreteBricks = new ConcreteBricks();
|
||||
@ -559,13 +568,14 @@ public class CivilianFeatures {
|
||||
this.fillWithBlocks(world, box, sizeX - 4, 3, sizeZ - 2, sizeX - 2, 3, sizeZ - 2, ModBlocks.steel_roof, Blocks.air, false);
|
||||
if(!hasPlacedLoot[1]) {
|
||||
this.hasPlacedLoot[1] = this.generateInvContents(world, box, rand, ModBlocks.crate_iron, sizeX - 2, 1, 3, HbmChestContents.nukeTrash, 9);
|
||||
generateLoreBook(world, box, rand, sizeX - 2, 1, 3, 1, HbmChestContents.books_office_sch);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static class NTMWorkshop1 extends Feature {
|
||||
public static class NTMWorkshop1 extends Component {
|
||||
|
||||
private static SuperConcrete RandomSuperConcrete = new SuperConcrete();
|
||||
|
||||
|
||||
999
src/main/java/com/hbm/world/worldgen/components/Component.java
Normal file
@ -0,0 +1,999 @@
|
||||
package com.hbm.world.worldgen.components;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.blocks.generic.BlockBobble.BobbleType;
|
||||
import com.hbm.blocks.generic.BlockBobble.TileEntityBobble;
|
||||
import com.hbm.config.StructureConfig;
|
||||
import com.hbm.handler.MultiblockHandlerXR;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.special.ItemBookLore.BookLoreType;
|
||||
import com.hbm.lib.HbmChestContents;
|
||||
import com.hbm.tileentity.machine.TileEntityLockableBase;
|
||||
import com.hbm.tileentity.machine.storage.TileEntityCrateIron;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockWeb;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemDoor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.WeightedRandomChestContent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.structure.StructureBoundingBox;
|
||||
import net.minecraft.world.gen.structure.StructureComponent;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
abstract public class Component extends StructureComponent {
|
||||
/** The size of the bounding box for this feature in the X axis */
|
||||
protected int sizeX;
|
||||
/** The size of the bounding box for this feature in the Y axis */
|
||||
protected int sizeY;
|
||||
/** The size of the bounding box for this feature in the Z axis */
|
||||
protected int sizeZ;
|
||||
/** Average height (Presumably stands for height position) */
|
||||
protected int hpos = -1;
|
||||
|
||||
protected Component() {
|
||||
super(0);
|
||||
}
|
||||
|
||||
protected Component(int componentType) {
|
||||
super(componentType);
|
||||
}
|
||||
|
||||
protected Component(Random rand, int minX, int minY, int minZ, int maxX, int maxY, int maxZ ) {
|
||||
super(0);
|
||||
this.sizeX = maxX;
|
||||
this.sizeY = maxY;
|
||||
this.sizeZ = maxZ;
|
||||
this.coordBaseMode = rand.nextInt(4);
|
||||
|
||||
switch(this.coordBaseMode) {
|
||||
case 0:
|
||||
this.boundingBox = new StructureBoundingBox(minX, minY, minZ, minX + maxX, minY + maxY, minZ + maxZ);
|
||||
break;
|
||||
case 1:
|
||||
this.boundingBox = new StructureBoundingBox(minX, minY, minZ, minX + maxZ, minY + maxY, minZ + maxX);
|
||||
break;
|
||||
case 2:
|
||||
this.boundingBox = new StructureBoundingBox(minX, minY, minZ, minX + maxX, minY + maxY, minZ + maxZ);
|
||||
break;
|
||||
case 3:
|
||||
this.boundingBox = new StructureBoundingBox(minX, minY, minZ, minX + maxZ, minY + maxY, minZ + maxX);
|
||||
break;
|
||||
default:
|
||||
this.boundingBox = new StructureBoundingBox(minX, minY, minZ, minX + maxX, minY + maxY, minZ + maxZ);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/** Set to NBT */
|
||||
protected void func_143012_a(NBTTagCompound nbt) {
|
||||
nbt.setInteger("Width", this.sizeX);
|
||||
nbt.setInteger("Height", this.sizeY);
|
||||
nbt.setInteger("Depth", this.sizeZ);
|
||||
nbt.setInteger("HPos", this.hpos);
|
||||
}
|
||||
|
||||
/** Get from NBT */
|
||||
protected void func_143011_b(NBTTagCompound nbt) {
|
||||
this.sizeX = nbt.getInteger("Width");
|
||||
this.sizeY = nbt.getInteger("Height");
|
||||
this.sizeZ = nbt.getInteger("Depth");
|
||||
this.hpos = nbt.getInteger("HPos");
|
||||
}
|
||||
|
||||
protected boolean setAverageHeight(World world, StructureBoundingBox box, int y) {
|
||||
|
||||
int total = 0;
|
||||
int iterations = 0;
|
||||
|
||||
for(int z = this.boundingBox.minZ; z <= this.boundingBox.maxZ; z++) {
|
||||
for(int x = this.boundingBox.minX; x <= this.boundingBox.maxX; x++) {
|
||||
if(box.isVecInside(x, y, z)) {
|
||||
total += Math.max(world.getTopSolidOrLiquidBlock(x, z), world.provider.getAverageGroundLevel());
|
||||
iterations++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(iterations == 0)
|
||||
return false;
|
||||
|
||||
this.hpos = total / iterations; //finds mean of every block in bounding box
|
||||
this.boundingBox.offset(0, this.hpos - this.boundingBox.minY, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
public int getCoordMode() {
|
||||
return this.coordBaseMode;
|
||||
}
|
||||
|
||||
/** Metadata for Decoration Methods **/
|
||||
|
||||
/**
|
||||
* Gets metadata for rotatable pillars.
|
||||
* @param metadata (First two digits are equal to block metadata, other two are equal to orientation
|
||||
* @return metadata adjusted for random orientation
|
||||
*/
|
||||
protected int getPillarMeta(int metadata) {
|
||||
if(this.coordBaseMode % 2 != 0 && this.coordBaseMode != -1)
|
||||
metadata = metadata ^ 12;
|
||||
|
||||
return metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* seriously, 3 fucking bits for 4 orientations when you can do it easily with 2?
|
||||
* @param metadata (2 for facing South, 3 for facing North, 4 for facing East, 5 for facing West
|
||||
*/
|
||||
protected int getDecoMeta(int metadata) {
|
||||
switch(this.coordBaseMode) {
|
||||
case 0: //South
|
||||
switch(metadata) {
|
||||
case 2: return 2;
|
||||
case 3: return 3;
|
||||
case 4: return 4;
|
||||
case 5: return 5;
|
||||
}
|
||||
case 1: //West
|
||||
switch(metadata) {
|
||||
case 2: return 5;
|
||||
case 3: return 4;
|
||||
case 4: return 2;
|
||||
case 5: return 3;
|
||||
}
|
||||
case 2: //North
|
||||
switch(metadata) {
|
||||
case 2: return 3;
|
||||
case 3: return 2;
|
||||
case 4: return 5;
|
||||
case 5: return 4;
|
||||
}
|
||||
case 3: //East
|
||||
switch(metadata) {
|
||||
case 2: return 4;
|
||||
case 3: return 5;
|
||||
case 4: return 3;
|
||||
case 5: return 2;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get orientation-offset metadata for BlockDecoModel; also suitable for trapdoors
|
||||
* @param metadata (0 for facing North, 1 for facing South, 2 for facing West, 3 for facing East)
|
||||
*/
|
||||
protected int getDecoModelMeta(int metadata) {
|
||||
//N: 0b00, S: 0b01, W: 0b10, E: 0b11
|
||||
|
||||
switch(this.coordBaseMode) {
|
||||
default: //South
|
||||
break;
|
||||
case 1: //West
|
||||
if((metadata & 3) < 2) //N & S can just have bits toggled
|
||||
metadata = metadata ^ 3;
|
||||
else //W & E can just have first bit set to 0
|
||||
metadata = metadata ^ 2;
|
||||
break;
|
||||
case 2: //North
|
||||
metadata = metadata ^ 1; //N, W, E & S can just have first bit toggled
|
||||
break;
|
||||
case 3: //East
|
||||
if((metadata & 3) < 2)//N & S can just have second bit set to 1
|
||||
metadata = metadata ^ 2;
|
||||
else //W & E can just have bits toggled
|
||||
metadata = metadata ^ 3;
|
||||
break;
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets orientation-adjusted meta for stairs.
|
||||
* 0 = West, 1 = East, 2 = North, 3 = South
|
||||
*/
|
||||
protected int getStairMeta(int metadata) {
|
||||
switch(this.coordBaseMode) {
|
||||
default: //South
|
||||
break;
|
||||
case 1: //West
|
||||
if((metadata & 3) < 2) //Flip second bit for E/W
|
||||
metadata = metadata ^ 2;
|
||||
else
|
||||
metadata = metadata ^ 3; //Flip both bits for N/S
|
||||
break;
|
||||
case 2: //North
|
||||
metadata = metadata ^ 1; //Flip first bit
|
||||
break;
|
||||
case 3: //East
|
||||
if((metadata & 3) < 2) //Flip both bits for E/W
|
||||
metadata = metadata ^ 3;
|
||||
else //Flip second bit for N/S
|
||||
metadata = metadata ^ 2;
|
||||
break;
|
||||
}
|
||||
|
||||
return metadata;
|
||||
}
|
||||
|
||||
/* For Later:
|
||||
* 0/S: S->S; W->W; N->N; E->E
|
||||
* 1/W: S->W; W->N; N->E; E->S
|
||||
* 2/N: S->N; W->E; N->S; E->W
|
||||
* 3/E: S->E; W->S; N->W; E->N
|
||||
* 0/b00/W, 1/b01/N, 2/b10/E, 3/b11/S
|
||||
*/
|
||||
/**
|
||||
* Places door at specified location with orientation-adjusted meta
|
||||
* 0 = West, 1 = North, 2 = East, 3 = South
|
||||
*/
|
||||
protected void placeDoor(World world, StructureBoundingBox box, Block door, int meta, int featureX, int featureY, int featureZ) {
|
||||
switch(this.coordBaseMode) {
|
||||
default:
|
||||
break;
|
||||
case 1:
|
||||
meta = (meta + 1) % 4; break;
|
||||
case 2:
|
||||
meta = meta ^ 2; break; //Flip second bit
|
||||
case 3:
|
||||
meta = (meta - 1) % 4; break;
|
||||
}
|
||||
|
||||
int posX = this.getXWithOffset(featureX, featureZ);
|
||||
int posY = this.getYWithOffset(featureY);
|
||||
int posZ = this.getZWithOffset(featureX, featureZ);
|
||||
|
||||
this.placeBlockAtCurrentPosition(world, door, meta, featureX, featureY, featureZ, box);
|
||||
ItemDoor.placeDoorBlock(world, posX, posY, posZ, meta, door);
|
||||
}
|
||||
|
||||
/**N:0 W:1 S:2 E:3 */
|
||||
protected void placeBed(World world, StructureBoundingBox box, int meta, int featureX, int featureY, int featureZ) {
|
||||
int xOffset = 0;
|
||||
int zOffset = 0;
|
||||
|
||||
switch(meta & 3) {
|
||||
default:
|
||||
zOffset = 1; break;
|
||||
case 1:
|
||||
xOffset = -1; break;
|
||||
case 2:
|
||||
zOffset = -1; break;
|
||||
case 3:
|
||||
xOffset = 1; break;
|
||||
}
|
||||
|
||||
switch(this.coordBaseMode) {
|
||||
default: //S
|
||||
break;
|
||||
case 1: //W
|
||||
meta = (meta + 1) % 4; break;
|
||||
case 2: //N
|
||||
meta ^= 2; break;
|
||||
case 3: //E
|
||||
meta = (meta - 1) % 4; break;
|
||||
}
|
||||
|
||||
placeBlockAtCurrentPosition(world, Blocks.bed, meta, featureX, featureY, featureZ, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.bed, meta + 8, featureX + xOffset, featureY, featureZ + zOffset, box);
|
||||
}
|
||||
|
||||
/**Tripwire Hook: S:0 W:1 N:2 E:3 */
|
||||
protected int getTripwireMeta(int metadata) {
|
||||
switch(this.coordBaseMode) {
|
||||
default:
|
||||
return metadata;
|
||||
case 1:
|
||||
return (metadata + 1) % 4;
|
||||
case 2:
|
||||
return metadata ^ 2;
|
||||
case 3:
|
||||
return (metadata - 1) % 4;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Loot Methods **/
|
||||
|
||||
/**
|
||||
* it feels disgusting to make a method with this many parameters but fuck it, it's easier
|
||||
* @return TE implementing IInventory with randomized contents
|
||||
*/
|
||||
protected boolean generateInvContents(World world, StructureBoundingBox box, Random rand, Block block, int featureX, int featureY, int featureZ, WeightedRandomChestContent[] content, int amount) {
|
||||
return generateInvContents(world, box, rand, block, 0, featureX, featureY, featureZ, content, amount);
|
||||
}
|
||||
|
||||
protected boolean generateInvContents(World world, StructureBoundingBox box, Random rand, Block block, int meta, int featureX, int featureY, int featureZ, WeightedRandomChestContent[] content, int amount) {
|
||||
int posX = this.getXWithOffset(featureX, featureZ);
|
||||
int posY = this.getYWithOffset(featureY);
|
||||
int posZ = this.getZWithOffset(featureX, featureZ);
|
||||
|
||||
if(world.getBlock(posX, posY, posZ) == block) //replacement for hasPlacedLoot checks
|
||||
return true;
|
||||
|
||||
this.placeBlockAtCurrentPosition(world, block, meta, featureX, featureY, featureZ, box);
|
||||
IInventory inventory = (IInventory)world.getTileEntity(posX, posY, posZ);
|
||||
|
||||
if(inventory != null) {
|
||||
amount = (int)Math.floor(amount * StructureConfig.lootAmountFactor);
|
||||
WeightedRandomChestContent.generateChestContents(rand, content, inventory, amount < 1 ? 1 : amount);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Block TE MUST extend TileEntityLockableBase, otherwise this will not work and crash!
|
||||
* @return TE implementing IInventory and extending TileEntityLockableBase with randomized contents + lock
|
||||
*/
|
||||
protected boolean generateLockableContents(World world, StructureBoundingBox box, Random rand, Block block, int featureX, int featureY, int featureZ,
|
||||
WeightedRandomChestContent[] content, int amount, double mod) {
|
||||
return generateLockableContents(world, box, rand, block, 0, featureX, featureY, featureZ, content, amount, mod);
|
||||
}
|
||||
|
||||
protected boolean generateLockableContents(World world, StructureBoundingBox box, Random rand, Block block, int meta, int featureX, int featureY, int featureZ,
|
||||
WeightedRandomChestContent[] content, int amount, double mod) {
|
||||
int posX = this.getXWithOffset(featureX, featureZ);
|
||||
int posY = this.getYWithOffset(featureY);
|
||||
int posZ = this.getZWithOffset(featureX, featureZ);
|
||||
|
||||
if(world.getBlock(posX, posY, posZ) == block) //replacement for hasPlacedLoot checks
|
||||
return false;
|
||||
|
||||
this.placeBlockAtCurrentPosition(world, block, meta, featureX, featureY, featureZ, box);
|
||||
TileEntity tile = world.getTileEntity(posX, posY, posZ);
|
||||
TileEntityLockableBase lock = (TileEntityLockableBase) tile;
|
||||
IInventory inventory = (IInventory) tile;
|
||||
|
||||
if(inventory != null && lock != null) {
|
||||
amount = (int)Math.floor(amount * StructureConfig.lootAmountFactor);
|
||||
WeightedRandomChestContent.generateChestContents(rand, content, inventory, amount < 1 ? 1 : amount);
|
||||
|
||||
lock.setPins(rand.nextInt(999) + 1);
|
||||
lock.setMod(mod);
|
||||
lock.lock();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void generateLoreBook(World world, StructureBoundingBox box, Random rand, int featureX, int featureY, int featureZ, int slot, BookLoreType[] books) {
|
||||
int posX = this.getXWithOffset(featureX, featureZ);
|
||||
int posY = this.getYWithOffset(featureY);
|
||||
int posZ = this.getZWithOffset(featureX, featureZ);
|
||||
|
||||
IInventory inventory = (IInventory) world.getTileEntity(posX, posY, posZ);
|
||||
|
||||
if(inventory != null) {
|
||||
ItemStack book = new ItemStack(ModItems.book_lore);
|
||||
int i = rand.nextInt(books.length);
|
||||
|
||||
BookLoreType.setTypeForStack(book, books[i]);
|
||||
inventory.setInventorySlotContents(slot, book);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Places random bobblehead with a randomized orientation at specified location
|
||||
*/
|
||||
protected void placeRandomBobble(World world, StructureBoundingBox box, Random rand, int featureX, int featureY, int featureZ) {
|
||||
int posX = this.getXWithOffset(featureX, featureZ);
|
||||
int posY = this.getYWithOffset(featureY);
|
||||
int posZ = this.getZWithOffset(featureX, featureZ);
|
||||
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.bobblehead, rand.nextInt(16), featureX, featureY, featureZ, box);
|
||||
TileEntityBobble bobble = (TileEntityBobble) world.getTileEntity(posX, posY, posZ);
|
||||
|
||||
if(bobble != null) {
|
||||
bobble.type = BobbleType.values()[rand.nextInt(BobbleType.values().length - 1) + 1];
|
||||
bobble.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
/** Block Placement Utility Methods **/
|
||||
|
||||
/**
|
||||
* Places blocks underneath location until reaching a solid block; good for foundations
|
||||
*/
|
||||
protected void placeFoundationUnderneath(World world, Block placeBlock, int meta, int minX, int minZ, int maxX, int maxZ, int featureY, StructureBoundingBox box) {
|
||||
|
||||
for(int featureX = minX; featureX <= maxX; featureX++) {
|
||||
for(int featureZ = minZ; featureZ <= maxZ; featureZ++) {
|
||||
int posX = this.getXWithOffset(featureX, featureZ);
|
||||
int posY = this.getYWithOffset(featureY);
|
||||
int posZ = this.getZWithOffset(featureX, featureZ);
|
||||
|
||||
if(box.isVecInside(posX, posY, posZ)) {
|
||||
Block block = world.getBlock(posX, posY, posZ);
|
||||
int brake = 0;
|
||||
|
||||
while ((world.isAirBlock(posX, posY, posZ) ||
|
||||
!block.getMaterial().isSolid() ||
|
||||
(block.isFoliage(world, posX, posY, posZ) || block.getMaterial() == Material.leaves)) &&
|
||||
posY > 1 && brake <= 15) {
|
||||
world.setBlock(posX, posY, posZ, placeBlock, meta, 2);
|
||||
block = world.getBlock(posX, --posY, posZ);
|
||||
|
||||
brake++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Places specified blocks on top of pre-existing blocks in a given area, up to a certain height. Does NOT place blocks on top of liquids.
|
||||
* Useful for stuff like fences and walls most likely.
|
||||
*/
|
||||
protected void placeBlocksOnTop(World world, StructureBoundingBox box, Block block, int minX, int minZ, int maxX, int maxZ, int height) {
|
||||
|
||||
for(int x = minX; x <= maxX; x++) {
|
||||
for(int z = minZ; z <= maxZ; z++) {
|
||||
int posX = this.getXWithOffset(x, z);
|
||||
int posZ = this.getZWithOffset(x, z);
|
||||
int topHeight = world.getTopSolidOrLiquidBlock(posX, posZ);
|
||||
|
||||
if(!world.getBlock(posX, topHeight, posZ).getMaterial().isLiquid()) {
|
||||
|
||||
for(int i = 0; i < height; i++) {
|
||||
int posY = topHeight + i;
|
||||
|
||||
world.setBlock(posX, posY, posZ, block, 0, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Fills an area with cobwebs. Cobwebs will concentrate on corners and surfaces without floating cobwebs. */
|
||||
protected void fillWithCobwebs(World world, StructureBoundingBox box, Random rand, int minX, int minY, int minZ, int maxX, int maxY, int maxZ) {
|
||||
|
||||
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);
|
||||
Block genTarget = world.getBlock(posX, posY, posZ);
|
||||
|
||||
if(!genTarget.isAir(world, posX, posY, posZ))
|
||||
continue;
|
||||
|
||||
int validNeighbors = 0;
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
Block neighbor = world.getBlock(posX + dir.offsetX, posY + dir.offsetY, posZ + dir.offsetZ);
|
||||
|
||||
if(neighbor.getMaterial().blocksMovement() || neighbor instanceof BlockWeb)
|
||||
validNeighbors++;
|
||||
}
|
||||
|
||||
if(validNeighbors > 5 || (validNeighbors > 1 && rand.nextInt(6 - validNeighbors) == 0))
|
||||
world.setBlock(posX, posY, posZ, Blocks.web);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** getXWithOffset & getZWithOffset Methods that are actually fixed **/
|
||||
//Turns out, this entire time every single minecraft structure is mirrored instead of rotated when facing East and North
|
||||
//Also turns out, it's a scarily easy fix that they somehow didn't see *entirely*
|
||||
@Override
|
||||
protected int getXWithOffset(int x, int z) {
|
||||
switch(this.coordBaseMode) {
|
||||
case 0:
|
||||
return this.boundingBox.minX + x;
|
||||
case 1:
|
||||
return this.boundingBox.maxX - z;
|
||||
case 2:
|
||||
return this.boundingBox.maxX - x;
|
||||
case 3:
|
||||
return this.boundingBox.minX + z;
|
||||
default:
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getZWithOffset(int x, int z) {
|
||||
switch(this.coordBaseMode) {
|
||||
case 0:
|
||||
return this.boundingBox.minZ + z;
|
||||
case 1:
|
||||
return this.boundingBox.minZ + x;
|
||||
case 2:
|
||||
return this.boundingBox.maxZ - z;
|
||||
case 3:
|
||||
return this.boundingBox.maxZ - x;
|
||||
default:
|
||||
return z;
|
||||
}
|
||||
}
|
||||
|
||||
/** Methods that are actually optimized, including ones that cut out replaceBlock and onlyReplace functionality when it's redundant. */
|
||||
protected void fillWithAir(World world, StructureBoundingBox box, int minX, int minY, int minZ, int maxX, int maxY, int maxZ) {
|
||||
|
||||
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);
|
||||
|
||||
world.setBlock(posX, posY, posZ, Blocks.air, 0, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fillWithBlocks(World world, StructureBoundingBox box, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, Block block, Block replaceBlock, boolean onlyReplace) {
|
||||
|
||||
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(!onlyReplace || world.getBlock(posX, posY, posZ).getMaterial() != Material.air) {
|
||||
if(x != minX && x != maxX && y != minY && y != maxY && z != minZ && z != maxZ)
|
||||
world.setBlock(posX, posY, posZ, replaceBlock, 0, 2);
|
||||
else
|
||||
world.setBlock(posX, posY, posZ, block, 0, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void fillWithBlocks(World world, StructureBoundingBox box, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, Block block) {
|
||||
|
||||
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);
|
||||
|
||||
world.setBlock(posX, posY, posZ, block, 0, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fillWithMetadataBlocks(World world, StructureBoundingBox box, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, Block block, int meta, Block replaceBlock, int replaceMeta, boolean onlyReplace) {
|
||||
|
||||
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(!onlyReplace || world.getBlock(posX, posY, posZ).getMaterial() != Material.air) {
|
||||
if(x != minX && x != maxX && y != minY && y != maxY && z != minZ && z != maxZ)
|
||||
world.setBlock(posX, posY, posZ, replaceBlock, replaceMeta, 2);
|
||||
else
|
||||
world.setBlock(posX, posY, posZ, block, meta, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void fillWithMetadataBlocks(World world, StructureBoundingBox box, 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);
|
||||
|
||||
world.setBlock(posX, posY, posZ, block, meta, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fillWithRandomizedBlocks(World world, StructureBoundingBox box, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, boolean onlyReplace, Random rand, BlockSelector selector) {
|
||||
|
||||
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(!onlyReplace || world.getBlock(posX, posY, posZ).getMaterial() != Material.air) {
|
||||
selector.selectBlocks(rand, posX, posY, posZ, x == minX || x == maxX || y == minY || y == maxY || z == minZ || z == maxZ);
|
||||
world.setBlock(posX, posY, posZ, selector.func_151561_a(), selector.getSelectedBlockMetaData(), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void fillWithRandomizedBlocks(World world, StructureBoundingBox box, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, Random rand, BlockSelector selector) { //so i don't have to replace shit
|
||||
|
||||
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);
|
||||
//keep this functionality in mind!
|
||||
selector.selectBlocks(rand, posX, posY, posZ, false); //for most structures it's redundant since nothing is just hollow cubes, but vanilla structures rely on this. use the method above in that case.
|
||||
world.setBlock(posX, posY, posZ, selector.func_151561_a(), selector.getSelectedBlockMetaData(), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//stairs and shit
|
||||
protected void fillWithRandomizedBlocksMeta(World world, StructureBoundingBox box, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, Random rand, BlockSelector selector, 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);
|
||||
//keep this functionality in mind!
|
||||
selector.selectBlocks(rand, posX, posY, posZ, false); //for most structures it's redundant since nothing is just hollow cubes, but vanilla structures rely on this. use the method above in that case.
|
||||
world.setBlock(posX, posY, posZ, selector.func_151561_a(), meta | selector.getSelectedBlockMetaData(), 2); //Make sure the metadata is initialized in the ctor!
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Block replaceBlock, boolean onlyReplace) {
|
||||
|
||||
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 && (!onlyReplace || world.getBlock(posX, posY, posZ).getMaterial() != Material.air)) {
|
||||
if(x != minX && x != maxX && y != minY && y != maxY && z != minZ && z != maxZ)
|
||||
world.setBlock(posX, posY, posZ, replaceBlock, 0, 2);
|
||||
else
|
||||
world.setBlock(posX, posY, posZ, block, 0, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
|
||||
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, 0, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected ForgeDirection getDirection(ForgeDirection dir) {
|
||||
switch(coordBaseMode) {
|
||||
default: //South
|
||||
return dir;
|
||||
case 1: //West
|
||||
return dir.getRotation(ForgeDirection.UP);
|
||||
case 2: //North
|
||||
return dir.getOpposite();
|
||||
case 3: //East
|
||||
return dir.getRotation(ForgeDirection.DOWN);
|
||||
}
|
||||
}
|
||||
|
||||
//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. */
|
||||
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
|
||||
return;
|
||||
|
||||
if(dir == null)
|
||||
dir = ForgeDirection.SOUTH;
|
||||
|
||||
dir = getDirection(dir);
|
||||
|
||||
int count = 0;
|
||||
|
||||
int[] rot = MultiblockHandlerXR.rotate(dim, dir);
|
||||
|
||||
int posX = getXWithOffset(x, z);
|
||||
int posZ = getZWithOffset(x, z); //MY SILLY ASS OPERATING WITH ALREADY FUCKING MODIFIED VARIABLES CLOWNKOEN
|
||||
int posY = getYWithOffset(y);
|
||||
|
||||
BlockDummyable.safeRem = true;
|
||||
|
||||
for(int a = posX - rot[4]; a <= posX + rot[5]; a++) {
|
||||
for(int c = posZ - rot[2]; c <= posZ + rot[3]; c++) {
|
||||
|
||||
if(a >= box.minX && a <= box.maxX && c >= box.minZ && c <= box.maxZ) {
|
||||
for(int b = posY - rot[1]; b <= posY + rot[0]; b++) {
|
||||
|
||||
int meta = 0;
|
||||
|
||||
if(b < posY) {
|
||||
meta = ForgeDirection.DOWN.ordinal();
|
||||
} else if(b > posY) {
|
||||
meta = ForgeDirection.UP.ordinal();
|
||||
} else if(a < posX) {
|
||||
meta = ForgeDirection.WEST.ordinal();
|
||||
} else if(a > posX) {
|
||||
meta = ForgeDirection.EAST.ordinal();
|
||||
} else if(c < posZ) {
|
||||
meta = ForgeDirection.NORTH.ordinal();
|
||||
} else if(c > posZ) {
|
||||
meta = ForgeDirection.SOUTH.ordinal();
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
world.setBlock(a, b, c, block, meta, 2);
|
||||
|
||||
count++;
|
||||
|
||||
if(count > 2000) {
|
||||
System.out.println("component's fillspace: ded " + a + " " + b + " " + c + " " + x + " " + y + " " + z);
|
||||
|
||||
BlockDummyable.safeRem = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BlockDummyable.safeRem = false;
|
||||
}
|
||||
|
||||
/** StructureComponent-friendly method for {@link com.hbm.blocks.BlockDummyable#makeExtra(World, int, int, int)}. Prevents runoff outside of the provided bounding box. */
|
||||
public void makeExtra(World world, StructureBoundingBox box, Block block, 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(world.getBlock(posX, posY, posZ) != block)
|
||||
return;
|
||||
|
||||
int meta = world.getBlockMetadata(posX, posY, posZ);
|
||||
|
||||
if(meta > 5)
|
||||
return;
|
||||
|
||||
BlockDummyable.safeRem = true;
|
||||
world.setBlock(posX, posY, posZ, block, meta + BlockDummyable.extra, 3);
|
||||
BlockDummyable.safeRem = false;
|
||||
}
|
||||
|
||||
/** Block Selectors **/
|
||||
|
||||
static class Sandstone extends StructureComponent.BlockSelector {
|
||||
|
||||
Sandstone() { }
|
||||
|
||||
/** Selects blocks */
|
||||
@Override
|
||||
public void selectBlocks(Random rand, int posX, int posY, int posZ, boolean notInterior) {
|
||||
float chance = rand.nextFloat();
|
||||
|
||||
if(chance > 0.6F) {
|
||||
this.field_151562_a = Blocks.sandstone;
|
||||
} else if (chance < 0.5F ) {
|
||||
this.field_151562_a = ModBlocks.reinforced_sand;
|
||||
} else {
|
||||
this.field_151562_a = Blocks.sand;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class ConcreteBricks extends StructureComponent.BlockSelector {
|
||||
|
||||
ConcreteBricks() { }
|
||||
|
||||
/** Selects blocks */
|
||||
@Override
|
||||
public void selectBlocks(Random rand, int posX, int posY, int posZ, boolean notInterior) {
|
||||
float chance = rand.nextFloat();
|
||||
|
||||
if(chance < 0.4F) {
|
||||
this.field_151562_a = ModBlocks.brick_concrete;
|
||||
} else if (chance < 0.7F) {
|
||||
this.field_151562_a = ModBlocks.brick_concrete_mossy;
|
||||
} else if (chance < 0.9F) {
|
||||
this.field_151562_a = ModBlocks.brick_concrete_cracked;
|
||||
} else {
|
||||
this.field_151562_a = ModBlocks.brick_concrete_broken;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class ConcreteBricksStairs extends StructureComponent.BlockSelector {
|
||||
|
||||
ConcreteBricksStairs() {
|
||||
this.selectedBlockMetaData = 0;
|
||||
}
|
||||
|
||||
/** Selects blocks */
|
||||
@Override
|
||||
public void selectBlocks(Random rand, int posX, int posY, int posZ, boolean notInterior) {
|
||||
float chance = rand.nextFloat();
|
||||
|
||||
if(chance < 0.4F) {
|
||||
this.field_151562_a = ModBlocks.brick_concrete_stairs;
|
||||
} else if (chance < 0.7F) {
|
||||
this.field_151562_a = ModBlocks.brick_concrete_mossy_stairs;
|
||||
} else if (chance < 0.9F) {
|
||||
this.field_151562_a = ModBlocks.brick_concrete_cracked_stairs;
|
||||
} else {
|
||||
this.field_151562_a = ModBlocks.brick_concrete_broken_stairs;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class ConcreteBricksSlabs extends StructureComponent.BlockSelector {
|
||||
|
||||
ConcreteBricksSlabs() {
|
||||
this.field_151562_a = ModBlocks.concrete_brick_slab;
|
||||
this.selectedBlockMetaData = 0;
|
||||
}
|
||||
|
||||
/** Selects blocks */
|
||||
@Override
|
||||
public void selectBlocks(Random rand, int posX, int posY, int posZ, boolean notInterior) {
|
||||
float chance = rand.nextFloat();
|
||||
|
||||
if (chance >= 0.4F && chance < 0.7F) {
|
||||
this.selectedBlockMetaData |= 1;
|
||||
} else if (chance < 0.9F) {
|
||||
this.selectedBlockMetaData |= 2;
|
||||
} else {
|
||||
this.selectedBlockMetaData |= 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//ag
|
||||
static class LabTiles extends StructureComponent.BlockSelector {
|
||||
|
||||
LabTiles() { }
|
||||
|
||||
/** Selects blocks */
|
||||
@Override
|
||||
public void selectBlocks(Random rand, int posX, int posY, int posZ, boolean notInterior) {
|
||||
float chance = rand.nextFloat();
|
||||
|
||||
if(chance < 0.5F) {
|
||||
this.field_151562_a = ModBlocks.tile_lab;
|
||||
} else if (chance < 0.9F) {
|
||||
this.field_151562_a = ModBlocks.tile_lab_cracked;
|
||||
} else {
|
||||
this.field_151562_a = ModBlocks.tile_lab_broken;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class SuperConcrete extends StructureComponent.BlockSelector {
|
||||
|
||||
SuperConcrete() {
|
||||
this.field_151562_a = ModBlocks.concrete_super;
|
||||
}
|
||||
|
||||
/** Selects blocks */
|
||||
@Override
|
||||
public void selectBlocks(Random rand, int posX, int posY, int posZ, boolean notInterior) {
|
||||
this.selectedBlockMetaData = rand.nextInt(6) + 10;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,513 +0,0 @@
|
||||
package com.hbm.world.worldgen.components;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.blocks.generic.BlockBobble.BobbleType;
|
||||
import com.hbm.blocks.generic.BlockBobble.TileEntityBobble;
|
||||
import com.hbm.config.StructureConfig;
|
||||
import com.hbm.lib.HbmChestContents;
|
||||
import com.hbm.tileentity.machine.TileEntityLockableBase;
|
||||
import com.hbm.tileentity.machine.storage.TileEntityCrateIron;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemDoor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.WeightedRandomChestContent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.structure.StructureBoundingBox;
|
||||
import net.minecraft.world.gen.structure.StructureComponent;
|
||||
|
||||
abstract public class Feature extends StructureComponent {
|
||||
/** The size of the bounding box for this feature in the X axis */
|
||||
protected int sizeX;
|
||||
/** The size of the bounding box for this feature in the Y axis */
|
||||
protected int sizeY;
|
||||
/** The size of the bounding box for this feature in the Z axis */
|
||||
protected int sizeZ;
|
||||
/** Average height (Presumably stands for height position) */
|
||||
protected int hpos = -1;
|
||||
|
||||
protected Feature() {
|
||||
super(0);
|
||||
}
|
||||
|
||||
protected Feature(Random rand, int minX, int minY, int minZ, int maxX, int maxY, int maxZ ) {
|
||||
super(0);
|
||||
this.sizeX = maxX;
|
||||
this.sizeY = maxY;
|
||||
this.sizeZ = maxZ;
|
||||
this.coordBaseMode = rand.nextInt(4);
|
||||
|
||||
switch(this.coordBaseMode) {
|
||||
case 0:
|
||||
this.boundingBox = new StructureBoundingBox(minX, minY, minZ, minX + maxX, minY + maxY, minZ + maxZ);
|
||||
break;
|
||||
case 1:
|
||||
this.boundingBox = new StructureBoundingBox(minX, minY, minZ, minX + maxZ, minY + maxY, minZ + maxX);
|
||||
break;
|
||||
case 2:
|
||||
this.boundingBox = new StructureBoundingBox(minX, minY, minZ, minX + maxX, minY + maxY, minZ + maxZ);
|
||||
break;
|
||||
case 3:
|
||||
this.boundingBox = new StructureBoundingBox(minX, minY, minZ, minX + maxZ, minY + maxY, minZ + maxX);
|
||||
break;
|
||||
default:
|
||||
this.boundingBox = new StructureBoundingBox(minX, minY, minZ, minX + maxX, minY + maxY, minZ + maxZ);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/** Set to NBT */
|
||||
protected void func_143012_a(NBTTagCompound nbt) {
|
||||
nbt.setInteger("Width", this.sizeX);
|
||||
nbt.setInteger("Height", this.sizeY);
|
||||
nbt.setInteger("Depth", this.sizeZ);
|
||||
nbt.setInteger("HPos", this.hpos);
|
||||
}
|
||||
|
||||
/** Get from NBT */
|
||||
protected void func_143011_b(NBTTagCompound nbt) {
|
||||
this.sizeX = nbt.getInteger("Width");
|
||||
this.sizeY = nbt.getInteger("Height");
|
||||
this.sizeZ = nbt.getInteger("Depth");
|
||||
this.hpos = nbt.getInteger("HPos");
|
||||
}
|
||||
|
||||
protected boolean setAverageHeight(World world, StructureBoundingBox box, int y) {
|
||||
|
||||
int total = 0;
|
||||
int iterations = 0;
|
||||
|
||||
for(int z = this.boundingBox.minZ; z <= this.boundingBox.maxZ; z++) {
|
||||
for(int x = this.boundingBox.minX; x <= this.boundingBox.maxX; x++) {
|
||||
if(box.isVecInside(x, y, z)) {
|
||||
total += Math.max(world.getTopSolidOrLiquidBlock(x, z), world.provider.getAverageGroundLevel());
|
||||
iterations++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(iterations == 0)
|
||||
return false;
|
||||
|
||||
this.hpos = total / iterations; //finds mean of every block in bounding box
|
||||
this.boundingBox.offset(0, this.hpos - this.boundingBox.minY, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Metadata for Decoration Methods **/
|
||||
|
||||
/**
|
||||
* Gets metadata for rotatable pillars.
|
||||
* @param metadata (First two digits are equal to block metadata, other two are equal to orientation
|
||||
* @return metadata adjusted for random orientation
|
||||
*/
|
||||
protected int getPillarMeta(int metadata) {
|
||||
if(this.coordBaseMode % 2 != 0 && this.coordBaseMode != -1)
|
||||
metadata = metadata ^ 12;
|
||||
|
||||
return metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* seriously, 3 fucking bits for 4 orientations when you can do it easily with 2?
|
||||
* @param metadata (2 for facing South, 3 for facing North, 4 for facing East, 5 for facing West
|
||||
*/
|
||||
protected int getDecoMeta(int metadata) {
|
||||
switch(this.coordBaseMode) {
|
||||
case 0: //South
|
||||
switch(metadata) {
|
||||
case 2: return 2;
|
||||
case 3: return 3;
|
||||
case 4: return 4;
|
||||
case 5: return 5;
|
||||
}
|
||||
case 1: //West
|
||||
switch(metadata) {
|
||||
case 2: return 5;
|
||||
case 3: return 4;
|
||||
case 4: return 2;
|
||||
case 5: return 3;
|
||||
}
|
||||
case 2: //North
|
||||
switch(metadata) {
|
||||
case 2: return 3;
|
||||
case 3: return 2;
|
||||
case 4: return 5;
|
||||
case 5: return 4;
|
||||
}
|
||||
case 3: //East
|
||||
switch(metadata) {
|
||||
case 2: return 4;
|
||||
case 3: return 5;
|
||||
case 4: return 3;
|
||||
case 5: return 2;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get orientation-offset metadata for BlockDecoModel
|
||||
* @param metadata (0 for facing North, 1 for facing South, 2 for facing West, 3 for facing East)
|
||||
*/
|
||||
protected int getDecoModelMeta(int metadata) {
|
||||
//N: 0b00, S: 0b01, W: 0b10, E: 0b11
|
||||
|
||||
switch(this.coordBaseMode) {
|
||||
default: //South
|
||||
break;
|
||||
case 1: //West
|
||||
if((metadata & 3) < 2) //N & S can just have bits toggled
|
||||
metadata = metadata ^ 3;
|
||||
else //W & E can just have first bit set to 0
|
||||
metadata = metadata ^ 2;
|
||||
break;
|
||||
case 2: //North
|
||||
metadata = metadata ^ 1; //N, W, E & S can just have first bit toggled
|
||||
break;
|
||||
case 3: //East
|
||||
if((metadata & 3) < 2)//N & S can just have second bit set to 1
|
||||
metadata = metadata ^ 2;
|
||||
else //W & E can just have bits toggled
|
||||
metadata = metadata ^ 3;
|
||||
break;
|
||||
}
|
||||
|
||||
return metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets orientation-adjusted meta for stairs.
|
||||
* 0 = West, 1 = East, 2 = North, 3 = South
|
||||
*/
|
||||
protected int getStairMeta(int metadata) {
|
||||
switch(this.coordBaseMode) {
|
||||
default: //South
|
||||
break;
|
||||
case 1: //West
|
||||
if((metadata & 3) < 2) //Flip second bit for E/W
|
||||
metadata = metadata ^ 2;
|
||||
else
|
||||
metadata = metadata ^ 3; //Flip both bits for N/S
|
||||
break;
|
||||
case 2: //North
|
||||
metadata = metadata ^ 1; //Flip first bit
|
||||
break;
|
||||
case 3: //East
|
||||
if((metadata & 3) < 2) //Flip both bits for E/W
|
||||
metadata = metadata ^ 3;
|
||||
else //Flip second bit for N/S
|
||||
metadata = metadata ^ 2;
|
||||
break;
|
||||
}
|
||||
|
||||
return metadata;
|
||||
}
|
||||
|
||||
/* For Later:
|
||||
* 0/S: S->S; W->W; N->N; E->E
|
||||
* 1/W: S->W; W->N; N->E; E->S
|
||||
* 2/N: S->N; W->E; N->S; E->W
|
||||
* 3/E: S->E; W->S; N->W; E->N
|
||||
* 0/b00/W, 1/b01/N, 2/b10/E, 3/b11/S
|
||||
*/
|
||||
/**
|
||||
* Places door at specified location with orientation-adjusted meta
|
||||
* 0 = West, 1 = North, 2 = East, 3 = South
|
||||
*/
|
||||
protected void placeDoor(World world, StructureBoundingBox box, Block door, int meta, int featureX, int featureY, int featureZ) {
|
||||
switch(this.coordBaseMode) {
|
||||
default:
|
||||
break;
|
||||
case 1:
|
||||
meta = (meta + 1) % 4; break;
|
||||
case 2:
|
||||
meta = meta ^ 2; break; //Flip second bit
|
||||
case 3:
|
||||
meta = (meta - 1) % 4; break;
|
||||
}
|
||||
|
||||
int posX = this.getXWithOffset(featureX, featureZ);
|
||||
int posY = this.getYWithOffset(featureY);
|
||||
int posZ = this.getZWithOffset(featureX, featureZ);
|
||||
|
||||
this.placeBlockAtCurrentPosition(world, door, meta, featureX, featureY, featureZ, box);
|
||||
ItemDoor.placeDoorBlock(world, posX, posY, posZ, meta, door);
|
||||
}
|
||||
|
||||
/** Loot Methods **/
|
||||
|
||||
/**
|
||||
* it feels disgusting to make a method with this many parameters but fuck it, it's easier
|
||||
* @return TE implementing IInventory with randomized contents
|
||||
*/
|
||||
protected boolean generateInvContents(World world, StructureBoundingBox box, Random rand, Block block, int featureX, int featureY, int featureZ, WeightedRandomChestContent[] content, int amount) {
|
||||
int posX = this.getXWithOffset(featureX, featureZ);
|
||||
int posY = this.getYWithOffset(featureY);
|
||||
int posZ = this.getZWithOffset(featureX, featureZ);
|
||||
|
||||
this.placeBlockAtCurrentPosition(world, block, 0, featureX, featureY, featureZ, box);
|
||||
IInventory inventory = (IInventory)world.getTileEntity(posX, posY, posZ);
|
||||
|
||||
if(inventory != null) {
|
||||
amount = (int)Math.floor(amount * StructureConfig.lootAmountFactor);
|
||||
WeightedRandomChestContent.generateChestContents(rand, content, inventory, amount < 1 ? 1 : amount);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Block TE MUST extend TileEntityLockableBase, otherwise this will not work and crash!
|
||||
* @return TE implementing IInventory and extending TileEntityLockableBase with randomized contents + lock
|
||||
*/
|
||||
protected boolean generateLockableContents(World world, StructureBoundingBox box, Random rand, Block block, int featureX, int featureY, int featureZ,
|
||||
WeightedRandomChestContent[] content, int amount, double mod) {
|
||||
int posX = this.getXWithOffset(featureX, featureZ);
|
||||
int posY = this.getYWithOffset(featureY);
|
||||
int posZ = this.getZWithOffset(featureX, featureZ);
|
||||
|
||||
this.placeBlockAtCurrentPosition(world, block, 0, featureX, featureY, featureZ, box);
|
||||
TileEntity tile = world.getTileEntity(posX, posY, posZ);
|
||||
TileEntityLockableBase lock = (TileEntityLockableBase) tile;
|
||||
IInventory inventory = (IInventory) tile;
|
||||
|
||||
if(inventory != null && lock != null) {
|
||||
lock.setPins(rand.nextInt(999) + 1);
|
||||
lock.setMod(mod);
|
||||
lock.lock();
|
||||
|
||||
amount = (int)Math.floor(amount * StructureConfig.lootAmountFactor);
|
||||
WeightedRandomChestContent.generateChestContents(rand, content, inventory, amount < 1 ? 1 : amount);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void generateLoreBook(World world, StructureBoundingBox box, int featureX, int featureY, int featureZ, int slot, String key) {
|
||||
int posX = this.getXWithOffset(featureX, featureZ);
|
||||
int posY = this.getYWithOffset(featureY);
|
||||
int posZ = this.getZWithOffset(featureX, featureZ);
|
||||
|
||||
IInventory inventory = (IInventory) world.getTileEntity(posX, posY, posZ);
|
||||
|
||||
if(inventory != null) {
|
||||
ItemStack book = HbmChestContents.genetateBook(key);
|
||||
|
||||
inventory.setInventorySlotContents(slot, book);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Places random bobblehead with a randomized orientation at specified location
|
||||
*/
|
||||
protected void placeRandomBobble(World world, StructureBoundingBox box, Random rand, int featureX, int featureY, int featureZ) {
|
||||
int posX = this.getXWithOffset(featureX, featureZ);
|
||||
int posY = this.getYWithOffset(featureY);
|
||||
int posZ = this.getZWithOffset(featureX, featureZ);
|
||||
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.bobblehead, rand.nextInt(16), featureX, featureY, featureZ, box);
|
||||
TileEntityBobble bobble = (TileEntityBobble) world.getTileEntity(posX, posY, posZ);
|
||||
|
||||
if(bobble != null) {
|
||||
bobble.type = BobbleType.values()[rand.nextInt(BobbleType.values().length - 1) + 1];
|
||||
bobble.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
/** Block Placement Utility Methods **/
|
||||
|
||||
/**
|
||||
* Places blocks underneath location until reaching a solid block; good for foundations
|
||||
*/
|
||||
protected void placeFoundationUnderneath(World world, Block placeBlock, int meta, int minX, int minZ, int maxX, int maxZ, int featureY, StructureBoundingBox box) {
|
||||
|
||||
for(int featureX = minX; featureX <= maxX; featureX++) {
|
||||
for(int featureZ = minZ; featureZ <= maxZ; featureZ++) {
|
||||
int posX = this.getXWithOffset(featureX, featureZ);
|
||||
int posY = this.getYWithOffset(featureY);
|
||||
int posZ = this.getZWithOffset(featureX, featureZ);
|
||||
|
||||
if(box.isVecInside(posX, posY, posZ)) {
|
||||
Block block = world.getBlock(posX, posY, posZ);
|
||||
int brake = 0;
|
||||
|
||||
while ((world.isAirBlock(posX, posY, posZ) ||
|
||||
!block.getMaterial().isSolid() ||
|
||||
(block.isFoliage(world, posX, posY, posZ) || block.getMaterial() == Material.leaves)) &&
|
||||
posY > 1 && brake <= 15) {
|
||||
world.setBlock(posX, posY, posZ, placeBlock, meta, 2);
|
||||
block = world.getBlock(posX, --posY, posZ);
|
||||
|
||||
brake++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Places specified blocks on top of pre-existing blocks in a given area, up to a certain height. Does NOT place blocks on top of liquids.
|
||||
* Useful for stuff like fences and walls most likely.
|
||||
*/
|
||||
protected void placeBlocksOnTop(World world, StructureBoundingBox box, Block block, int minX, int minZ, int maxX, int maxZ, int height) {
|
||||
|
||||
for(int x = minX; x <= maxX; x++) {
|
||||
for(int z = minZ; z <= maxZ; z++) {
|
||||
int posX = this.getXWithOffset(x, z);
|
||||
int posZ = this.getZWithOffset(x, z);
|
||||
int topHeight = world.getTopSolidOrLiquidBlock(posX, posZ);
|
||||
|
||||
if(!world.getBlock(posX, topHeight, posZ).getMaterial().isLiquid()) {
|
||||
|
||||
for(int i = 0; i < height; i++) {
|
||||
int posY = topHeight + i;
|
||||
|
||||
world.setBlock(posX, posY, posZ, block, 0, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** getXWithOffset & getZWithOffset Methods that are actually fixed **/
|
||||
//Turns out, this entire time every single minecraft structure is mirrored instead of rotated when facing East and North
|
||||
//Also turns out, it's a scarily easy fix that they somehow didn't see *entirely*
|
||||
@Override
|
||||
protected int getXWithOffset(int x, int z) {
|
||||
switch(this.coordBaseMode) {
|
||||
case 0:
|
||||
return this.boundingBox.minX + x;
|
||||
case 1:
|
||||
return this.boundingBox.maxX - z;
|
||||
case 2:
|
||||
return this.boundingBox.maxX - x;
|
||||
case 3:
|
||||
return this.boundingBox.minX + z;
|
||||
default:
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getZWithOffset(int x, int z) {
|
||||
switch(this.coordBaseMode) {
|
||||
case 0:
|
||||
return this.boundingBox.minZ + z;
|
||||
case 1:
|
||||
return this.boundingBox.minZ + x;
|
||||
case 2:
|
||||
return this.boundingBox.maxZ - z;
|
||||
case 3:
|
||||
return this.boundingBox.maxZ - x;
|
||||
default:
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
/** Methods that remove the replaceBlock and alwaysReplace, and other parameters: as they are useless and only serve as a time sink normally. */
|
||||
|
||||
protected void fillWithBlocks(World world, StructureBoundingBox box, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, Block block) {
|
||||
this.fillWithBlocks(world, box, minX, minY, minZ, maxX, maxY, maxZ, block, block, false);
|
||||
}
|
||||
|
||||
protected void fillWithMetadataBlocks(World world, StructureBoundingBox box, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, Block block, int meta) {
|
||||
this.fillWithMetadataBlocks(world, box, minX, minY, minZ, maxX, maxY, maxZ, block, meta, block, meta, false);
|
||||
}
|
||||
|
||||
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) {
|
||||
this.randomlyFillWithBlocks(world, box, rand, randLimit, minX, minY, minZ, maxX, maxY, maxZ, block, block, false);
|
||||
}
|
||||
|
||||
protected void fillWithRandomizedBlocks(World world, StructureBoundingBox box, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, Random rand, BlockSelector selector) {
|
||||
this.fillWithRandomizedBlocks(world, box, minX, minY, minZ, maxX, maxY, maxZ, false, rand, selector);
|
||||
}
|
||||
|
||||
/** Block Selectors **/
|
||||
|
||||
static class Sandstone extends StructureComponent.BlockSelector {
|
||||
|
||||
Sandstone() { }
|
||||
|
||||
/** Selects blocks */
|
||||
@Override
|
||||
public void selectBlocks(Random rand, int posX, int posY, int posZ, boolean p_75062_5_) {
|
||||
float chance = rand.nextFloat();
|
||||
|
||||
if(chance > 0.6F) {
|
||||
this.field_151562_a = Blocks.sandstone;
|
||||
} else if (chance < 0.5F ) {
|
||||
this.field_151562_a = ModBlocks.reinforced_sand;
|
||||
} else {
|
||||
this.field_151562_a = Blocks.sand;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class ConcreteBricks extends StructureComponent.BlockSelector {
|
||||
|
||||
ConcreteBricks() { }
|
||||
|
||||
/** Selects blocks */
|
||||
@Override
|
||||
public void selectBlocks(Random rand, int posX, int posY, int posZ, boolean p_75062_5_) {
|
||||
float chance = rand.nextFloat();
|
||||
|
||||
if(chance < 0.2F) {
|
||||
this.field_151562_a = ModBlocks.brick_concrete;
|
||||
} else if (chance < 0.55F) {
|
||||
this.field_151562_a = ModBlocks.brick_concrete_mossy;
|
||||
} else if (chance < 0.75F) {
|
||||
this.field_151562_a = ModBlocks.brick_concrete_cracked;
|
||||
} else {
|
||||
this.field_151562_a = ModBlocks.brick_concrete_broken;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//ag
|
||||
static class LabTiles extends StructureComponent.BlockSelector {
|
||||
|
||||
LabTiles() { }
|
||||
|
||||
/** Selects blocks */
|
||||
@Override
|
||||
public void selectBlocks(Random rand, int posX, int posY, int posZ, boolean p_75062_5_) {
|
||||
float chance = rand.nextFloat();
|
||||
|
||||
if(chance < 0.5F) {
|
||||
this.field_151562_a = ModBlocks.tile_lab;
|
||||
} else if (chance < 0.9F) {
|
||||
this.field_151562_a = ModBlocks.tile_lab_cracked;
|
||||
} else {
|
||||
this.field_151562_a = ModBlocks.tile_lab_broken;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class SuperConcrete extends StructureComponent.BlockSelector {
|
||||
|
||||
SuperConcrete() {
|
||||
this.field_151562_a = ModBlocks.concrete_super;
|
||||
}
|
||||
|
||||
/** Selects blocks */
|
||||
@Override
|
||||
public void selectBlocks(Random rand, int posX, int posY, int posZ, boolean p_75062_5_) {
|
||||
this.selectedBlockMetaData = rand.nextInt(6) + 10;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,181 +0,0 @@
|
||||
package com.hbm.world.worldgen.components;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.structure.StructureBoundingBox;
|
||||
|
||||
//These structures are... kind of? low quality, but they test out new methods so whatev.
|
||||
public class MilitaryBaseFeatures {
|
||||
|
||||
//stop-gap methods until this entire mess can be organized into proper classes/structure groups
|
||||
public static void smallHelipad(LinkedList components, int chunkX, int posY, int chunkZ, Random rand) {
|
||||
BasicHelipad helipad = new BasicHelipad(rand, chunkX * 16 + 8, posY, chunkZ * 16 + 8);
|
||||
int[] chunkPos = getAdjacentChunk(chunkX, chunkZ, rand);
|
||||
|
||||
RadioShack radio = new RadioShack(rand, chunkPos[0] * 16 + 8, posY, chunkPos[1] * 16 + 8);
|
||||
components.add(helipad);
|
||||
components.add(radio);
|
||||
}
|
||||
|
||||
//ugh
|
||||
public static int[] getAdjacentChunk(int chunkX, int chunkZ, Random rand) {
|
||||
int[] chunkPos = new int[2];
|
||||
|
||||
switch(rand.nextInt(4)) {
|
||||
case 0:
|
||||
chunkPos[0] = chunkX;
|
||||
chunkPos[1] = chunkZ + 1;
|
||||
break;
|
||||
case 1:
|
||||
chunkPos[0] = chunkX - 1;
|
||||
chunkPos[1] = chunkZ;
|
||||
break;
|
||||
case 2:
|
||||
chunkPos[0] = chunkX;
|
||||
chunkPos[1] = chunkZ - 1;
|
||||
break;
|
||||
case 3:
|
||||
chunkPos[0] = chunkX + 1;
|
||||
chunkPos[1] = chunkZ;
|
||||
break;
|
||||
}
|
||||
|
||||
return chunkPos;
|
||||
}
|
||||
|
||||
public static class BasicHelipad extends Feature {
|
||||
|
||||
public BasicHelipad() { super(); }
|
||||
|
||||
protected BasicHelipad(Random rand, int minX, int minY, int minZ) {
|
||||
super(rand, minX, minY, minZ, 12, 0, 12);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) {
|
||||
|
||||
if(!this.setAverageHeight(world, box, this.boundingBox.minY)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
this.boundingBox.offset(0, -1, 0);
|
||||
|
||||
for(int i = 1; i < sizeX; i++) {
|
||||
for(int j = 1; j < sizeZ; j++) {
|
||||
clearCurrentPositionBlocksUpwards(world, i, 1, j, box);
|
||||
}
|
||||
}
|
||||
|
||||
placeFoundationUnderneath(world, Blocks.stonebrick, 0, 1, 1, sizeX - 1, sizeZ - 1, -1, box);
|
||||
|
||||
placeFoundationUnderneath(world, Blocks.stonebrick, 0, 0, 0, sizeX, 0, -1, box);
|
||||
placeFoundationUnderneath(world, Blocks.stonebrick, 0, 0, 1, 0, sizeZ, -1, box);
|
||||
placeFoundationUnderneath(world, Blocks.stonebrick, 0, sizeX, 1, sizeX, sizeZ, -1, box);
|
||||
placeFoundationUnderneath(world, Blocks.stonebrick, 0, 1, sizeZ, sizeX - 1, sizeZ, -1, box);
|
||||
|
||||
//Helipad
|
||||
fillWithBlocks(world, box, 1, 0, 1, 11, 0, 1, ModBlocks.concrete, Blocks.air, false); //this entire time, the second block was actually for anything not at min/max x's, y's, and z's. useful!
|
||||
fillWithBlocks(world, box, 11, 0, 2, 11, 0, 11, ModBlocks.concrete, Blocks.air, false);
|
||||
fillWithBlocks(world, box, 1, 0, 11, 10, 0, 11, ModBlocks.concrete, Blocks.air, false);
|
||||
fillWithBlocks(world, box, 1, 0, 2, 1, 0, 10, ModBlocks.concrete, Blocks.air, false);
|
||||
|
||||
fillWithBlocks(world, box, 2, 0, 2, 10, 0, 10, ModBlocks.concrete_smooth, Blocks.air, false); //i'm not carefully carving out the white H lmao fuck that
|
||||
fillWithBlocks(world, box, 4, 0, 4, 4, 0, 8, ModBlocks.concrete_colored, Blocks.air, false); //white is 0
|
||||
fillWithBlocks(world, box, 8, 0, 4, 8, 0, 8, ModBlocks.concrete_colored, Blocks.air, false);
|
||||
fillWithBlocks(world, box, 5, 0, 6, 7, 0, 6, ModBlocks.concrete_colored, Blocks.air, false);
|
||||
|
||||
//Surrounding Fences
|
||||
placeBlocksOnTop(world, box, ModBlocks.fence_metal, 0, 0, sizeX, 0, 1);
|
||||
placeBlocksOnTop(world, box, ModBlocks.fence_metal, sizeX, 1, sizeX, sizeZ, 1);
|
||||
placeBlocksOnTop(world, box, ModBlocks.fence_metal, 0, sizeZ, sizeX - 1, sizeZ, 1);
|
||||
placeBlocksOnTop(world, box, ModBlocks.fence_metal, 0, 1, 0, sizeZ - 1, 1);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class RadioShack extends Feature {
|
||||
|
||||
private static LabTiles RandomLabTiles = new LabTiles();
|
||||
private static ConcreteBricks ConcreteBricks = new ConcreteBricks();
|
||||
|
||||
public RadioShack() { super(); }
|
||||
|
||||
protected RadioShack(Random rand, int minX, int minY, int minZ) {
|
||||
super(rand, minX, minY, minZ, 6, 4, 5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) {
|
||||
|
||||
if(!this.setAverageHeight(world, box, this.boundingBox.minY)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
this.boundingBox.offset(0, -1, 0);
|
||||
|
||||
placeFoundationUnderneath(world, Blocks.stonebrick, 0, 1, 1, sizeX, sizeZ, -1, box);
|
||||
placeFoundationUnderneath(world, Blocks.stonebrick, 0, 0, 2, 0, 2, 0, box);
|
||||
|
||||
//Floor & Foundation
|
||||
fillWithRandomizedBlocks(world, box, 2, 0, 1, 5, 0, 4, false, rand, RandomLabTiles);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.concrete_pillar, 0, 1, 0, 1, box);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.concrete_pillar, 0, sizeX, 0, 1, box);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.concrete_pillar, 0, 1, 0, sizeZ, box);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.concrete_pillar, 0, sizeX, 0, sizeZ, box);
|
||||
fillWithBlocks(world, box, 2, 0, 1, sizeX - 1, 0, 1, ModBlocks.concrete_smooth, Blocks.air, false);
|
||||
fillWithBlocks(world, box, 2, 0, 0, sizeX - 1, 0, 0, ModBlocks.concrete_smooth, Blocks.air, false);
|
||||
fillWithBlocks(world, box, sizeX, 0, 2, sizeX, 0, sizeZ - 1, ModBlocks.concrete_smooth, Blocks.air, false);
|
||||
fillWithBlocks(world, box, 2, 0, sizeZ, sizeX - 1, 0, sizeZ, ModBlocks.concrete_smooth, Blocks.air, false);
|
||||
fillWithBlocks(world, box, 1, 0, 2, 1, 0, sizeZ - 1, ModBlocks.concrete_smooth, Blocks.air, false);
|
||||
|
||||
//Back Wall
|
||||
fillWithRandomizedBlocks(world, box, 1, 1, 1, 2, sizeY - 1, 1, false, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 2, 1, 0, 5, sizeY - 1, 0, false, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 5, 1, 1, sizeX, sizeY - 1, 1, false, rand, ConcreteBricks);
|
||||
//Front Wall
|
||||
fillWithRandomizedBlocks(world, box, 1, 1, sizeZ, 2, sizeY - 1, sizeZ, false, rand, ConcreteBricks);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.brick_concrete, 0, 3, sizeY - 1, sizeZ, box);
|
||||
fillWithRandomizedBlocks(world, box, 4, 1, sizeZ, sizeX, sizeY - 1, sizeZ, false, rand, ConcreteBricks);
|
||||
placeDoor(world, box, ModBlocks.door_metal, 3, 3, 1, sizeZ);
|
||||
//Left & Right Wall
|
||||
fillWithRandomizedBlocks(world, box, 1, 1, 2, 1, sizeY - 1, sizeZ - 1, false, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, sizeX, 1, 2, sizeX, sizeY - 1, sizeZ - 1, false, rand, ConcreteBricks);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.reinforced_glass, 0, 1, 2, 3, box);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.reinforced_glass, 0, sizeX, 2, 2, box);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.reinforced_glass, 0, sizeX, 2, 4, box);
|
||||
//Ceiling
|
||||
fillWithBlocks(world, box, 3, sizeY - 1, 1, 4, sizeY - 1, 1, ModBlocks.concrete_smooth, Blocks.air, false);
|
||||
fillWithBlocks(world, box, 2, sizeY - 1, 2, sizeX - 1, sizeY - 1, sizeZ - 1, ModBlocks.concrete_smooth, Blocks.air, false);
|
||||
|
||||
fillWithAir(world, box, 2, 1, 2, sizeX - 1, 2, sizeZ - 1);
|
||||
|
||||
//Decoration
|
||||
int southMeta = getDecoMeta(2);
|
||||
int northMeta = getDecoMeta(3); //all of these deco blocks are so inconsistent about what their directions actually are
|
||||
int eastMeta = getDecoMeta(4);
|
||||
fillWithMetadataBlocks(world, box, 2, 1, 2, 5, 1, 2, ModBlocks.steel_grate, 7, null, 0, false); //null should be okay here
|
||||
fillWithBlocks(world, box, 3, 1, 1, 4, 1, 1, ModBlocks.deco_tungsten, null, false);
|
||||
fillWithMetadataBlocks(world, box, 3, 2, 1, 4, 2, 1, ModBlocks.tape_recorder, northMeta, null, 0, false);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.radiorec, southMeta, 2, 2, 2, box);
|
||||
placeRandomBobble(world, box, rand, sizeX - 1, 2, 2);
|
||||
fillWithMetadataBlocks(world, box, sizeX - 1, 1, 3, sizeX - 1, 2, 3, ModBlocks.tape_recorder, eastMeta, null, 0, false);
|
||||
//OutsideDeco
|
||||
fillWithMetadataBlocks(world, box, 0, 1, 2, 0, 2, 2, ModBlocks.steel_poles, eastMeta, null, 0, false);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.pole_satellite_receiver, eastMeta, 0, sizeY - 1, 2, box);
|
||||
fillWithBlocks(world, box, 0, sizeY, 2, sizeX - 1, sizeY, 2, ModBlocks.steel_roof, null, false);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.steel_roof, 0, sizeX - 1, sizeY, 3, box);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -4,17 +4,24 @@ import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.lib.HbmChestContents;
|
||||
import com.hbm.world.worldgen.components.Feature.ConcreteBricks;
|
||||
import com.hbm.util.LootGenerator;
|
||||
import com.hbm.world.worldgen.components.Component.ConcreteBricks;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.structure.MapGenStructureIO;
|
||||
import net.minecraft.world.gen.structure.StructureBoundingBox;
|
||||
|
||||
//Oh my fucking god TM
|
||||
public class OfficeFeatures {
|
||||
|
||||
public static class LargeOffice extends Feature {
|
||||
public static void registerComponents() {
|
||||
MapGenStructureIO.func_143031_a(LargeOffice.class, "NTMLargeOffice");
|
||||
MapGenStructureIO.func_143031_a(LargeOfficeCorner.class, "NTMLargeOfficeCorner");
|
||||
}
|
||||
|
||||
public static class LargeOffice extends Component {
|
||||
|
||||
private static ConcreteBricks ConcreteBricks = new ConcreteBricks();
|
||||
|
||||
@ -45,14 +52,11 @@ public class OfficeFeatures {
|
||||
}
|
||||
|
||||
//Holy shit I despise this method so goddamn much
|
||||
//TODO BOB: please i beg you make some sort of utility tool to simplify this
|
||||
//ideally we'd invent something like the structure blocks or even a more advanced
|
||||
//schematic to java tool
|
||||
@Override
|
||||
public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) {
|
||||
|
||||
if(!this.setAverageHeight(world, box, this.boundingBox.minY)) {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
this.boundingBox.offset(0, -1, 0);
|
||||
@ -204,17 +208,349 @@ public class OfficeFeatures {
|
||||
|
||||
//Woot
|
||||
if(!this.hasPlacedLoot[0])
|
||||
this.hasPlacedLoot[0] = generateInvContents(world, box, rand, Blocks.chest, sizeX - 4, 1, sizeZ - 1, HbmChestContents.officeTrash, 10);
|
||||
this.hasPlacedLoot[0] = generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(0), sizeX - 4, 1, sizeZ - 1, HbmChestContents.officeTrash, 8);
|
||||
if(!this.hasPlacedLoot[1]) {
|
||||
this.hasPlacedLoot[1] = generateLockableContents(world, box, rand, ModBlocks.safe, 6, 1, 1, HbmChestContents.machineParts, 10, 0.5D);
|
||||
generateLoreBook(world, box, 6, 1, 1, 7, "office" + rand.nextInt(1));
|
||||
this.hasPlacedLoot[1] = generateLockableContents(world, box, rand, ModBlocks.safe, getDecoMeta(3), 6, 1, 1, HbmChestContents.machineParts, 10, 0.5D);
|
||||
generateLoreBook(world, box, rand, 6, 1, 1, 7, HbmChestContents.books_office_sch);
|
||||
}
|
||||
|
||||
//TODO: add book with funny lore to safe, add cobwebs too
|
||||
//0b00/0 West, 0b01/1 East, 0b10/2 North, 0b11/3 South, 0b100/4 West UD, 0b101 East UD, 0b110 North UD, 0b111 South UD
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//bob i could kiss you
|
||||
public static class LargeOfficeCorner extends Component {
|
||||
|
||||
private static ConcreteBricks ConcreteBricks = new ConcreteBricks();
|
||||
|
||||
//no placed loot? it's because i would've had to do fucking 12 of them and i don't have an easy standardized system for that
|
||||
|
||||
public LargeOfficeCorner() {
|
||||
super();
|
||||
}
|
||||
|
||||
public LargeOfficeCorner(Random rand, int minX, int minY, int minZ) {
|
||||
super(rand, minX, minY, minZ, 11, 15, 14);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) {
|
||||
|
||||
if(!this.setAverageHeight(world, box, this.boundingBox.minY)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.boundingBox.offset(0, -1, 0);
|
||||
|
||||
int pillarMetaWE = getPillarMeta(4);
|
||||
int pillarMetaNS = getPillarMeta(8);
|
||||
|
||||
placeFoundationUnderneath(world, Blocks.stonebrick, 0, 4, 0, 11, 2, -1, box);
|
||||
placeFoundationUnderneath(world, Blocks.stonebrick, 0, 1, 3, 11, 13, -1, box);
|
||||
placeFoundationUnderneath(world, Blocks.stonebrick, 0, 0, 14, 4, 14, -1, box);
|
||||
placeFoundationUnderneath(world, Blocks.stonebrick, 0, 0, 10, 0, 13, -1, box);
|
||||
|
||||
fillWithAir(world, box, 1, 1, 11, 3, 12, 13);
|
||||
fillWithAir(world, box, 4, 1, 4, 10, 12, 12);
|
||||
fillWithAir(world, box, 2, 1, 4, 3, 12, 10);
|
||||
fillWithAir(world, box, 5, 1, 1, 10, 12, 2);
|
||||
fillWithAir(world, box, 5, 13, 1, 8, 14, 2);
|
||||
|
||||
//Back Wall
|
||||
fillWithBlocks(world, box, 1, 0, 3, 5, 0, 3, ModBlocks.concrete_pillar);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.concrete_pillar, pillarMetaWE, 6, 0, 3, box);
|
||||
fillWithBlocks(world, box, 7, 0, 3, 10, 0, 3, ModBlocks.concrete_pillar);
|
||||
fillWithBlocks(world, box, 4, 0, 0, 4, 0, 2, ModBlocks.concrete_pillar);
|
||||
fillWithBlocks(world, box, 5, 0, 0, 11, 0, 0, ModBlocks.concrete_pillar);
|
||||
fillWithBlocks(world, box, 11, 1, 0, 11, 12, 0, ModBlocks.concrete_pillar);
|
||||
fillWithBlocks(world, box, 1, 1, 3, 1, 12, 3, ModBlocks.concrete_pillar);
|
||||
fillWithRandomizedBlocks(world, box, 4, 1, 0, 10, 12, 0, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 4, 13, 0, 9, 13, 0, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 4, 14, 0, 8, 14, 0, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 4, 15, 0, 7, 15, 0, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 2, 1, 3, 5, 2, 3, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 7, 1, 3, 10, 2, 3, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 2, 3, 3, 10, 7, 3, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 2, 8, 3, 9, 10, 3, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 2, 11, 3, 10, 12, 3, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 4, 13, 3, 4, 14, 3, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 6, 13, 3, 9, 13, 3, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 6, 14, 3, 8, 14, 3, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 4, 15, 3, 7, 15, 3, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 4, 1, 1, 4, 15, 2, rand, ConcreteBricks);
|
||||
//Right Wall
|
||||
fillWithBlocks(world, box, 11, 0, 1, 11, 0, 12, ModBlocks.concrete_pillar);
|
||||
fillWithBlocks(world, box, 11, 0, 13, 11, 12, 13, ModBlocks.concrete_pillar);
|
||||
fillWithBlocks(world, box, 11, 1, 3, 11, 7, 3, ModBlocks.concrete_pillar);
|
||||
fillWithMetadataBlocks(world, box, 11, 4, 1, 11, 4, 2, ModBlocks.concrete_pillar, pillarMetaNS);
|
||||
fillWithMetadataBlocks(world, box, 11, 8, 1, 11, 8, 12, ModBlocks.concrete_pillar, pillarMetaNS);
|
||||
fillWithBlocks(world, box, 11, 9, 3, 11, 11, 3, ModBlocks.concrete_pillar);
|
||||
fillWithMetadataBlocks(world, box, 11, 12, 1, 11, 12, 12, ModBlocks.concrete_pillar, pillarMetaNS);
|
||||
fillWithRandomizedBlocks(world, box, 11, 9, 1, 11, 11, 2, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 11, 5, 1, 11, 7, 2, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 11, 1, 1, 11, 3, 2, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 11, 1, 4, 11, 7, 12, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 11, 9, 4, 11, 9, 12, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 11, 10, 4, 11, 10, 4, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 11, 10, 8, 11, 10, 8, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 11, 10, 12, 11, 10, 12, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 11, 11, 4, 11, 11, 12, rand, ConcreteBricks);
|
||||
//Front Wall
|
||||
fillWithBlocks(world, box, 4, 0, 13, 10, 0, 13, ModBlocks.concrete_pillar);
|
||||
fillWithBlocks(world, box, 4, 0, 14, 4, 12, 14, ModBlocks.concrete_pillar);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.concrete_pillar, 0, 3, 0, 14, box);
|
||||
fillWithMetadataBlocks(world, box, 1, 0, 14, 2, 0, 14, ModBlocks.concrete_pillar, pillarMetaWE);
|
||||
fillWithBlocks(world, box, 0, 0, 14, 0, 12, 14, ModBlocks.concrete_pillar);
|
||||
fillWithRandomizedBlocks(world, box, 4, 1, 13, 10, 1, 13, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 10, 2, 13, 10, 3, 13, rand, ConcreteBricks);
|
||||
fillWithBlocks(world, box, 9, 2, 13, 9, 3, 13, ModBlocks.concrete_pillar);
|
||||
fillWithBlocks(world, box, 6, 2, 13, 6, 3, 13, ModBlocks.concrete_pillar);
|
||||
fillWithRandomizedBlocks(world, box, 4, 2, 13, 5, 3, 13, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 4, 4, 13, 10, 5, 13, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 10, 6, 13, 10, 7, 13, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 4, 6, 13, 5, 7, 13, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 4, 8, 13, 10, 9, 13, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 10, 10, 13, 10, 11, 13, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 4, 10, 13, 5, 11, 13, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 4, 12, 13, 10, 12, 13, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 3, 1, 14, 3, 2, 14, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 1, 3, 14, 3, 5, 14, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 1, 8, 14, 3, 9, 14, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 1, 12, 14, 3, 12, 14, rand, ConcreteBricks);
|
||||
//Left Wall
|
||||
fillWithMetadataBlocks(world, box, 0, 0, 12, 0, 0, 13, ModBlocks.concrete_pillar, pillarMetaNS);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.concrete_pillar, 0, 0, 0, 11, box);
|
||||
fillWithBlocks(world, box, 0, 0, 10, 0, 12, 10, ModBlocks.concrete_pillar);
|
||||
fillWithBlocks(world, box, 1, 0, 4, 1, 0, 10, ModBlocks.concrete_pillar);
|
||||
fillWithBlocks(world, box, 1, 0, 3, 1, 12, 3, ModBlocks.concrete_pillar);
|
||||
fillWithRandomizedBlocks(world, box, 0, 1, 11, 0, 2, 11, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 0, 3, 11, 0, 5, 13, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 0, 8, 11, 0, 9, 13, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 0, 12, 11, 0, 12, 13, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 1, 1, 4, 1, 1, 10, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 1, 2, 9, 1, 3, 10, rand, ConcreteBricks);
|
||||
fillWithBlocks(world, box, 1, 2, 8, 1, 3, 8, ModBlocks.concrete_pillar);
|
||||
fillWithBlocks(world, box, 1, 2, 5, 1, 3, 5, ModBlocks.concrete_pillar);
|
||||
fillWithRandomizedBlocks(world, box, 1, 2, 4, 1, 3, 4, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 1, 4, 4, 1, 5, 10, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 1, 6, 9, 1, 7, 10, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 1, 6, 4, 1, 7, 4, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 1, 8, 4, 1, 9, 10, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 1, 10, 9, 1, 11, 10, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 1, 10, 4, 1, 11, 4, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 1, 12, 4, 1, 12, 10, rand, ConcreteBricks);
|
||||
|
||||
//Floor 1
|
||||
fillWithMetadataBlocks(world, box, 5, 0, 1, 10, 0, 2, ModBlocks.concrete_pillar, pillarMetaWE);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.concrete_pillar, pillarMetaWE, 6, 0, 3, box);
|
||||
fillWithMetadataBlocks(world, box, 2, 0, 4, 10, 0, 10, Blocks.planks, 1);
|
||||
fillWithMetadataBlocks(world, box, 3, 0, 11, 10, 0, 11, Blocks.planks, 1);
|
||||
fillWithMetadataBlocks(world, box, 4, 0, 12, 10, 0, 12, Blocks.planks, 1);
|
||||
fillWithMetadataBlocks(world, box, 1, 0, 11, 2, 0, 13, Blocks.wool, 7); //Grey
|
||||
fillWithMetadataBlocks(world, box, 3, 0, 12, 3, 0, 13, Blocks.wool, 7);
|
||||
//Floor 2
|
||||
fillWithMetadataBlocks(world, box, 5, 4, 1, 5, 4, 3, ModBlocks.concrete_pillar, pillarMetaNS);
|
||||
fillWithMetadataBlocks(world, box, 2, 4, 4, 10, 4, 12, Blocks.planks, 1);
|
||||
fillWithMetadataBlocks(world, box, 1, 4, 11, 1, 4, 13, Blocks.planks, 1);
|
||||
fillWithMetadataBlocks(world, box, 2, 4, 13, 3, 4, 13, Blocks.planks, 1);
|
||||
//Floor 3
|
||||
fillWithMetadataBlocks(world, box, 10, 8, 1, 10, 8, 3, ModBlocks.concrete_pillar, pillarMetaNS);
|
||||
fillWithMetadataBlocks(world, box, 2, 8, 4, 10, 8, 12, Blocks.planks, 1);
|
||||
fillWithMetadataBlocks(world, box, 1, 8, 11, 1, 8, 13, Blocks.planks, 1);
|
||||
fillWithMetadataBlocks(world, box, 2, 8, 13, 3, 8, 13, Blocks.planks, 1);
|
||||
//Ceiling
|
||||
fillWithMetadataBlocks(world, box, 5, 12, 1, 5, 12, 2, ModBlocks.concrete_pillar, pillarMetaNS);
|
||||
fillWithBlocks(world, box, 10, 12, 1, 10, 12, 2, ModBlocks.asphalt);
|
||||
fillWithBlocks(world, box, 9, 13, 1, 9, 13, 2, ModBlocks.asphalt);
|
||||
fillWithBlocks(world, box, 8, 14, 1, 8, 14, 2, ModBlocks.asphalt);
|
||||
fillWithBlocks(world, box, 5, 15, 1, 7, 15, 2, ModBlocks.asphalt);
|
||||
fillWithBlocks(world, box, 2, 12, 4, 10, 12, 12, ModBlocks.brick_light);
|
||||
fillWithBlocks(world, box, 1, 12, 11, 1, 12, 13, ModBlocks.brick_light);
|
||||
fillWithBlocks(world, box, 2, 12, 13, 3, 12, 13, ModBlocks.brick_light);
|
||||
//Staircase
|
||||
int EastStairMeta = getStairMeta(1);
|
||||
int WestStairMeta = getStairMeta(0);
|
||||
int EastStairMetaUD = EastStairMeta | 4;
|
||||
int WestStairMetaUD = WestStairMeta | 4;
|
||||
placeBlockAtCurrentPosition(world, Blocks.oak_stairs, EastStairMeta, 9, 1, 1, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.oak_stairs, WestStairMetaUD, 8, 1, 1, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.oak_stairs, EastStairMeta, 8, 2, 1, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.oak_stairs, WestStairMetaUD, 7, 2, 1, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.oak_stairs, EastStairMeta, 7, 3, 1, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.oak_stairs, WestStairMetaUD, 6, 3, 1, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.oak_stairs, EastStairMeta, 6, 4, 1, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.oak_stairs, EastStairMetaUD, 6, 4, 2, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.oak_stairs, WestStairMeta, 6, 5, 2, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.oak_stairs, EastStairMetaUD, 7, 5, 2, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.oak_stairs, WestStairMeta, 7, 6, 2, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.oak_stairs, EastStairMetaUD, 8, 6, 2, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.oak_stairs, WestStairMeta, 8, 7, 2, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.oak_stairs, EastStairMetaUD, 9, 7, 2, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.oak_stairs, WestStairMeta, 9, 8, 2, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.oak_stairs, WestStairMetaUD, 9, 8, 1, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.oak_stairs, EastStairMeta, 9, 9, 1, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.oak_stairs, WestStairMetaUD, 8, 9, 1, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.oak_stairs, EastStairMeta, 8, 10, 1, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.oak_stairs, WestStairMetaUD, 7, 10, 1, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.oak_stairs, EastStairMeta, 7, 11, 1, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.oak_stairs, WestStairMetaUD, 6, 11, 1, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.oak_stairs, EastStairMeta, 6, 12, 1, box);
|
||||
|
||||
//Decoration already? holy fuck it's been like 20 minutes
|
||||
//Windows
|
||||
randomlyFillWithBlocks(world, box, rand, 0.75F, 11, 10, 5, 11, 10, 7, Blocks.glass_pane);
|
||||
randomlyFillWithBlocks(world, box, rand, 0.75F, 11, 10, 9, 11, 10, 11, Blocks.glass_pane);
|
||||
randomlyFillWithBlocks(world, box, rand, 0.75F, 7, 2, 13, 8, 3, 13, Blocks.glass_pane);
|
||||
randomlyFillWithBlocks(world, box, rand, 0.75F, 6, 6, 13, 9, 7, 13, Blocks.glass_pane);
|
||||
randomlyFillWithBlocks(world, box, rand, 0.75F, 6, 10, 13, 9, 11, 13, Blocks.glass_pane);
|
||||
randomlyFillWithBlocks(world, box, rand, 0.75F, 1, 6, 14, 3, 7, 14, Blocks.glass_pane);
|
||||
randomlyFillWithBlocks(world, box, rand, 0.75F, 1, 10, 14, 3, 11, 14, Blocks.glass_pane);
|
||||
randomlyFillWithBlocks(world, box, rand, 0.75F, 0, 6, 11, 0, 7, 13, Blocks.glass_pane);
|
||||
randomlyFillWithBlocks(world, box, rand, 0.75F, 0, 10, 11, 0, 11, 13, Blocks.glass_pane);
|
||||
randomlyFillWithBlocks(world, box, rand, 0.75F, 1, 2, 6, 1, 3, 7, Blocks.glass_pane);
|
||||
randomlyFillWithBlocks(world, box, rand, 0.75F, 1, 6, 5, 1, 7, 8, Blocks.glass_pane);
|
||||
randomlyFillWithBlocks(world, box, rand, 0.75F, 1, 10, 5, 1, 11, 8, Blocks.glass_pane);
|
||||
//Trim
|
||||
randomlyFillWithBlocks(world, box, rand, 0.85F, 10, 13, 0, 10, 13, 0, Blocks.stone_slab);
|
||||
randomlyFillWithBlocks(world, box, rand, 0.85F, 11, 13, 0, 11, 13, 13, Blocks.stone_slab);
|
||||
randomlyFillWithBlocks(world, box, rand, 0.85F, 4, 13, 13, 10, 13, 13, Blocks.stone_slab);
|
||||
randomlyFillWithBlocks(world, box, rand, 0.85F, 0, 13, 14, 4, 13, 14, Blocks.stone_slab);
|
||||
randomlyFillWithBlocks(world, box, rand, 0.85F, 0, 13, 10, 0, 13, 13, Blocks.stone_slab);
|
||||
randomlyFillWithBlocks(world, box, rand, 0.85F, 1, 13, 3, 1, 13, 10, Blocks.stone_slab);
|
||||
randomlyFillWithBlocks(world, box, rand, 0.85F, 2, 13, 3, 3, 13, 3, Blocks.stone_slab);
|
||||
//Interior Walls
|
||||
fillWithRandomizedBlocks(world, box, 4, 5, 12, 4, 6, 12, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 4, 5, 10, 4, 6, 10, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 4, 7, 10, 4, 7, 12, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 2, 5, 10, 3, 7, 10, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 4, 9, 10, 4, 11, 12, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 2, 11, 10, 3, 11, 10, rand, ConcreteBricks);
|
||||
fillWithRandomizedBlocks(world, box, 2, 9, 10, 2, 10, 10, rand, ConcreteBricks);
|
||||
//Doors
|
||||
placeDoor(world, box, Blocks.wooden_door, 3, 1, 1, 14);
|
||||
placeDoor(world, box, Blocks.wooden_door, 3, 2, 1, 14);
|
||||
placeDoor(world, box, Blocks.wooden_door, 0, 0, 1, 12);
|
||||
placeDoor(world, box, Blocks.wooden_door, 0, 0, 1, 13);
|
||||
placeDoor(world, box, ModBlocks.door_office, 0, 6, 1, 3);
|
||||
placeDoor(world, box, ModBlocks.door_office, 0, 5, 5, 3);
|
||||
placeDoor(world, box, ModBlocks.door_office, 2, 4, 5, 11);
|
||||
placeDoor(world, box, ModBlocks.door_office, 0, 10, 9, 3);
|
||||
placeDoor(world, box, ModBlocks.door_office, 1, 3, 9, 10);
|
||||
placeDoor(world, box, ModBlocks.door_metal, 0, 5, 13, 3);
|
||||
//Furniture
|
||||
//Floor 1
|
||||
int NorthStairMeta = getStairMeta(2);
|
||||
int SouthStairMeta = getStairMeta(3);
|
||||
int NorthStairMetaUD = NorthStairMeta | 4;
|
||||
int SouthStairMetaUD = SouthStairMeta | 4;
|
||||
placeBlockAtCurrentPosition(world, Blocks.oak_stairs, EastStairMeta, 2, 1, 5, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.oak_stairs, SouthStairMeta, 2, 1, 7, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.oak_stairs, EastStairMeta, 2, 1, 8, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.oak_stairs, NorthStairMeta, 2, 1, 9, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, SouthStairMetaUD, 8, 1, 4, box);
|
||||
fillWithMetadataBlocks(world, box, 8, 1, 5, 8, 1, 7, Blocks.wooden_slab, 13);
|
||||
placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, NorthStairMetaUD, 8, 1, 8, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, WestStairMetaUD, 9, 1, 8, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.oak_stairs, WestStairMeta, 9, 1, 5, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.flower_pot, 0, 9, 1, 4, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.flower_pot, 10, 8, 2, 7, box);
|
||||
|
||||
placeBlockAtCurrentPosition(world, Blocks.oak_stairs, EastStairMeta, 6, 1, 12, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.oak_stairs, NorthStairMeta, 7, 1, 12, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.oak_stairs, WestStairMeta, 8, 1, 12, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, SouthStairMetaUD, 10, 1, 11, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, NorthStairMetaUD, 10, 1, 12, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.flower_pot, 0, 10, 2, 11, box);
|
||||
//Floor 2
|
||||
placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, WestStairMetaUD, 4, 5, 4, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.wooden_slab, 13, 3, 5, 4, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, EastStairMetaUD, 2, 5, 4, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.oak_stairs, NorthStairMeta, 3, 5, 5, box);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.deco_computer, getDecoModelMeta(1), 3, 6, 4, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, EastStairMetaUD, 3, 5, 7, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, SouthStairMetaUD, 4, 5, 7, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.wooden_slab, 13, 4, 5, 8, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, NorthStairMetaUD, 4, 5, 9, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.oak_stairs, EastStairMeta, 2, 5, 9, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, SouthStairMetaUD, 10, 5, 4, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.wooden_slab, 13, 10, 5, 5, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, NorthStairMetaUD, 10, 5, 6, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.oak_stairs, NorthStairMeta, 8, 5, 6, box);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.deco_computer, getDecoModelMeta(2), 10, 6, 6, box);
|
||||
|
||||
placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, NorthStairMetaUD, 8, 5, 11, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.wooden_slab, 13, 8, 5, 10, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, EastStairMetaUD, 8, 5, 9, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, SouthStairMetaUD, 9, 5, 9, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, WestStairMetaUD, 10, 5, 9, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.oak_stairs, WestStairMeta, 10, 5, 10, box);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.deco_computer, getDecoModelMeta(1), 9, 6, 9, box);
|
||||
|
||||
placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, NorthStairMetaUD, 1, 5, 13, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.wooden_slab, 13, 1, 5, 12, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, SouthStairMetaUD, 1, 5, 11, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.oak_stairs, NorthStairMeta, 3, 5, 13, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.flower_pot, 0, 1, 6, 12, box);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.machine_microwave, getDecoMeta(5), 1, 6, 11, box);
|
||||
//Floor 3
|
||||
placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, WestStairMetaUD, 8, 9, 4, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, EastStairMetaUD, 7, 9, 4, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.flower_pot, 0, 9, 9, 4, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, SouthStairMetaUD, 5, 9, 5, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, WestStairMetaUD, 5, 9, 6, box);
|
||||
fillWithMetadataBlocks(world, box, 3, 9, 6, 4, 9, 6, Blocks.wooden_slab, 13);
|
||||
placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, EastStairMetaUD, 2, 9, 6, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.oak_stairs, SouthStairMeta, 3, 9, 5, box);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.deco_computer, getDecoModelMeta(0), 3, 10, 6, box);
|
||||
|
||||
placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, WestStairMetaUD, 9, 9, 10, box);
|
||||
fillWithMetadataBlocks(world, box, 7, 9, 10, 8, 9, 10, Blocks.wooden_slab, 13);
|
||||
placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, SouthStairMetaUD, 6, 9, 10, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, EastStairMetaUD, 5, 9, 10, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, EastStairMetaUD, 5, 9, 11, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, NorthStairMetaUD, 5, 9, 12, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.oak_stairs, NorthStairMeta, 8, 9, 11, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.oak_stairs, EastStairMeta, 7, 9, 8, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.oak_stairs, SouthStairMeta, 9, 9, 8, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.flower_pot, 0, 6, 10, 10, box);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.deco_computer, getDecoModelMeta(1), 7, 10, 10, box);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.tape_recorder, getDecoMeta(5), 6, 9, 11, box);
|
||||
placeRandomBobble(world, box, rand, 5, 10, 11);
|
||||
placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, WestStairMetaUD, 2, 9, 11, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, EastStairMetaUD, 1, 9, 11, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.flower_pot, 0, 2, 10, 11, box);
|
||||
|
||||
//Roof
|
||||
placeBlockAtCurrentPosition(world, Blocks.flower_pot, 0, 5, 13, 9, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.flower_pot, 0, 7, 13, 11, box);
|
||||
|
||||
generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(3), 9, 1, 7, HbmChestContents.filingCabinet, 4);
|
||||
generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(1), 7, 5, 4, HbmChestContents.filingCabinet, 4);
|
||||
generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(1), 7, 6, 4, HbmChestContents.filingCabinet, 4);
|
||||
generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(2), 10, 5, 7, HbmChestContents.filingCabinet, 4);
|
||||
generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(0), 10, 5, 12, HbmChestContents.filingCabinet, 4);
|
||||
generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(0), 10, 6, 12, HbmChestContents.filingCabinet, 4);
|
||||
generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(0), 2, 9, 5, HbmChestContents.filingCabinet, 4);
|
||||
|
||||
generateLockableContents(world, box, rand, ModBlocks.safe, getDecoMeta(2), 1, 9, 13, HbmChestContents.officeTrash, 10, 1.0D);
|
||||
generateLoreBook(world, box, rand, 1, 9, 13, 7, HbmChestContents.books_office_sch);
|
||||
|
||||
generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(0), 2, 9, 13, HbmChestContents.filingCabinet, 4);
|
||||
generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(0), 3, 9, 13, HbmChestContents.filingCabinet, 4);
|
||||
generateLockableContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(0), 3, 10, 13, HbmChestContents.expensive, 8, 0.1D);
|
||||
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.deco_loot, 0, 6, 13, 11, box);
|
||||
LootGenerator.lootCapStash(world, this.getXWithOffset(6, 11), this.getYWithOffset(13), this.getZWithOffset(6, 11));
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.deco_loot, 0, 1, 10, 11, box);
|
||||
LootGenerator.lootMedicine(world, this.getXWithOffset(1, 11), this.getYWithOffset(10), this.getZWithOffset(1, 11));
|
||||
|
||||
//this hurt my soul
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,243 @@
|
||||
package com.hbm.world.worldgen.components;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.world.worldgen.components.ProceduralComponents.ControlComponent;
|
||||
|
||||
import net.minecraft.world.gen.structure.StructureBoundingBox;
|
||||
import net.minecraft.world.gen.structure.StructureComponent;
|
||||
|
||||
public abstract class ProceduralComponents {
|
||||
|
||||
protected List componentWeightList;
|
||||
|
||||
protected static Weight[] weightArray = new Weight[] { };
|
||||
|
||||
public void prepareComponents() {
|
||||
componentWeightList = new ArrayList();
|
||||
|
||||
for(int i = 0; i < weightArray.length; i++) {
|
||||
weightArray[i].instancesSpawned = 0;
|
||||
componentWeightList.add(weightArray[i]);
|
||||
}
|
||||
}
|
||||
|
||||
protected int getTotalWeight() {
|
||||
boolean flag = false;
|
||||
int totalWeight = 0;
|
||||
Weight weight;
|
||||
|
||||
for(Iterator iterator = componentWeightList.iterator(); iterator.hasNext(); totalWeight += weight.weight) { //Iterates over the entire list to find the total weight
|
||||
weight = (Weight) iterator.next();
|
||||
|
||||
if(weight.instanceLimit >= 0 && weight.instancesSpawned < weight.instanceLimit) //can more structure pieces be added, in general?
|
||||
flag = true;
|
||||
}
|
||||
|
||||
return flag ? totalWeight : -1;
|
||||
}
|
||||
|
||||
protected ProceduralComponent getWeightedComponent(ControlComponent original, List components, Random rand, int minX, int minY, int minZ, int coordMode, int componentType) {
|
||||
int totalWeight = getTotalWeight();
|
||||
|
||||
if(totalWeight < 0)
|
||||
return null;
|
||||
|
||||
for(int i = 0; i < 5; i++) {
|
||||
int value = rand.nextInt(totalWeight); //Pick a random value, based on how many parts there are already
|
||||
Iterator iterator = componentWeightList.iterator();
|
||||
|
||||
while(iterator.hasNext()) {
|
||||
Weight weight = (Weight)iterator.next();
|
||||
value -= weight.weight; //Iterate over the list until the value is less than 0
|
||||
|
||||
if(value < 0) {
|
||||
if(!weight.canSpawnStructure(componentType, coordMode, original.lastComponent)) //Additional checks based on game state info preventing spawn? start from beginning
|
||||
break;
|
||||
|
||||
ProceduralComponent component = (ProceduralComponent) weight.lambda.findValidPlacement(components, rand, minX, minY, minZ, coordMode, componentType); //Construct the chosen component
|
||||
|
||||
if(component != null) { //If it has been constructed, add it
|
||||
weight.instancesSpawned++;
|
||||
|
||||
if(!weight.canSpawnMoreStructures()) //Structure can no longer be spawned regardless of game state? remove as an option
|
||||
componentWeightList.remove(weight);
|
||||
|
||||
return component;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected int sizeLimit = 50;
|
||||
protected int distanceLimit = 64;
|
||||
|
||||
protected ProceduralComponent getNextValidComponent(ControlComponent original, List components, Random rand, int minX, int minY, int minZ, int coordMode, int componentType) {
|
||||
|
||||
if(components.size() > sizeLimit) //Hard limit on amount of components
|
||||
return null;
|
||||
|
||||
if(Math.abs(minX - original.getBoundingBox().minX) <= distanceLimit && Math.abs(minZ - original.getBoundingBox().minZ) <= distanceLimit) { //Hard limit on spread of structure
|
||||
|
||||
ProceduralComponent structure = getWeightedComponent(original, components, rand, minX, minY, minZ, coordMode, componentType + 1); //Returns null if all checks fail
|
||||
|
||||
if(structure != null) {
|
||||
components.add(structure); //Adds component to structure start list
|
||||
original.queuedComponents.add(structure); //Add it to the list of queued components waiting to be built
|
||||
}
|
||||
|
||||
return structure;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static StructureBoundingBox getComponentToAddBoundingBox(int posX, int posY, int posZ, int offsetX, int offsetY, int offsetZ, int maxX, int maxY, int maxZ, int coordMode) {
|
||||
switch(coordMode) {
|
||||
case 0: //South
|
||||
return new StructureBoundingBox(posX + offsetX, posY + offsetY, posZ + offsetZ, posX + maxX - 1 + offsetX, posY + maxY - 1 + offsetY, posZ + maxZ - 1 + offsetZ);
|
||||
case 1: //West
|
||||
return new StructureBoundingBox(posX - maxZ + 1 - offsetZ, posY + offsetY, posZ + offsetX, posX - offsetZ, posY + maxY - 1 + offsetY, posZ + maxX - 1 + offsetX);
|
||||
case 2: //North
|
||||
return new StructureBoundingBox(posX - maxX + 1 - offsetX, posY + offsetY, posZ - maxZ + 1 - offsetZ, posX - offsetX, posY + maxY - 1 + offsetY, posZ + offsetZ);
|
||||
case 3: //East
|
||||
return new StructureBoundingBox(posX + offsetZ, posY + offsetY, posZ - maxX + 1 - offsetX, posX + maxZ - 1 + offsetZ, posY + maxY - 1 + offsetY, posZ - offsetX);
|
||||
default:
|
||||
return new StructureBoundingBox(posX + offsetX, posY + offsetY, posZ + offsetZ, posX + maxX - 1 + offsetX, posY + maxY - 1 + offsetY, posZ + maxZ - 1 + offsetZ);
|
||||
}
|
||||
}
|
||||
|
||||
/** StructureComponent that supports procedural generation */
|
||||
public abstract static class ProceduralComponent extends Component {
|
||||
|
||||
public ProceduralComponent() { }
|
||||
|
||||
public ProceduralComponent(int componentType) {
|
||||
super(componentType); //Important to carry over.
|
||||
}
|
||||
|
||||
public void buildComponent(ProceduralComponents instance, ControlComponent original, List components, Random rand) { }
|
||||
|
||||
/** Gets next component in the direction this component is facing.<br>'original' refers to the initial starting component (hard distance limits), 'components' refers to the StructureStart list. */
|
||||
protected ProceduralComponent getNextComponentNormal(ProceduralComponents instance, ControlComponent original, List components, Random rand, int offset, int offsetY) {
|
||||
switch(this.coordBaseMode) {
|
||||
case 0: //South
|
||||
return instance.getNextValidComponent(original, components, rand, this.boundingBox.minX + offset, this.boundingBox.minY + offsetY, this.boundingBox.maxZ + 1, this.coordBaseMode, this.getComponentType());
|
||||
case 1: //West
|
||||
return instance.getNextValidComponent(original, components, rand, this.boundingBox.minX - 1, this.boundingBox.minY + offsetY, this.boundingBox.minZ + offset, this.coordBaseMode, this.getComponentType());
|
||||
case 2: //North
|
||||
return instance.getNextValidComponent(original, components, rand, this.boundingBox.maxX - offset, this.boundingBox.minY + offsetY, this.boundingBox.minZ - 1, this.coordBaseMode, this.getComponentType());
|
||||
case 3: //East
|
||||
return instance.getNextValidComponent(original, components, rand, this.boundingBox.maxX + 1, this.boundingBox.minY + offsetY, this.boundingBox.maxZ - offset, this.coordBaseMode, this.getComponentType());
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/** Gets next component in the opposite direction this component is facing. */
|
||||
protected ProceduralComponent getNextComponentAntiNormal(ProceduralComponents instance, ControlComponent original, List components, Random rand, int offset, int offsetY) {
|
||||
switch(this.coordBaseMode) {
|
||||
case 0: //South
|
||||
return instance.getNextValidComponent(original, components, rand, this.boundingBox.maxX - offset, this.boundingBox.minY + offsetY, this.boundingBox.minZ - 1, 2, this.getComponentType());
|
||||
case 1: //West
|
||||
return instance.getNextValidComponent(original, components, rand, this.boundingBox.maxX + 1, this.boundingBox.minY + offsetY, this.boundingBox.maxZ - offset, 3, this.getComponentType());
|
||||
case 2: //North
|
||||
return instance.getNextValidComponent(original, components, rand, this.boundingBox.minX + offset, this.boundingBox.minY + offsetY, this.boundingBox.maxZ + 1, 0, this.getComponentType());
|
||||
case 3: //East
|
||||
return instance.getNextValidComponent(original, components, rand, this.boundingBox.minX - 1, this.boundingBox.minY + offsetY, this.boundingBox.minZ + offset, 1, this.getComponentType());
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
//Keep in mind for these methods: a given room would have its *actual entrance* opposite the side it is facing.
|
||||
/** Gets next component, to the West (-X) <i>relative to this component. */
|
||||
protected ProceduralComponent getNextComponentNX(ProceduralComponents instance, ControlComponent original, List components, Random rand, int offset, int offsetY) {
|
||||
switch(this.coordBaseMode) {
|
||||
case 0: //South
|
||||
return instance.getNextValidComponent(original, components, rand, this.boundingBox.minX - 1, this.boundingBox.minY + offsetY, this.boundingBox.minZ + offset, 1, this.getComponentType());
|
||||
case 1: //West
|
||||
return instance.getNextValidComponent(original, components, rand, this.boundingBox.maxX - offset, this.boundingBox.minY + offsetY, this.boundingBox.minZ - 1, 2, this.getComponentType());
|
||||
case 2: //North
|
||||
return instance.getNextValidComponent(original, components, rand, this.boundingBox.maxX + 1, this.boundingBox.minY + offsetY, this.boundingBox.maxZ - offset, 3, this.getComponentType());
|
||||
case 3: //East
|
||||
return instance.getNextValidComponent(original, components, rand, this.boundingBox.minX + offset, this.boundingBox.minY + offsetY, this.boundingBox.maxZ + 1, 0, this.getComponentType());
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/** Gets next component, to the East (+X) <i>relative to this component. */
|
||||
protected ProceduralComponent getNextComponentPX(ProceduralComponents instance, ControlComponent original, List components, Random rand, int offset, int offsetY) {
|
||||
switch(this.coordBaseMode) {
|
||||
case 0: //South
|
||||
return instance.getNextValidComponent(original, components, rand, this.boundingBox.maxX + 1, this.boundingBox.minY + offsetY, this.boundingBox.maxZ - offset, 3, this.getComponentType() + 1);
|
||||
case 1: //West
|
||||
return instance.getNextValidComponent(original, components, rand, this.boundingBox.minX + offset, this.boundingBox.minY + offsetY, this.boundingBox.maxZ + 1, 0, this.getComponentType() + 1);
|
||||
case 2: //North
|
||||
return instance.getNextValidComponent(original, components, rand, this.boundingBox.minX - 1, this.boundingBox.minY + offsetY, this.boundingBox.minZ + offset, 1, this.getComponentType() + 1);
|
||||
case 3: //East
|
||||
return instance.getNextValidComponent(original, components, rand, this.boundingBox.maxX - offset, this.boundingBox.minY + offsetY, this.boundingBox.minZ - 1, 2, this.getComponentType() + 1);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/** Finds valid placement, using input information. Should be passed as a method reference to its respective Weight. */
|
||||
//Static so no override (cringe!)
|
||||
//public static ProceduralComponent findValidPlacement(List components, Random rand, int minX, int minY, int minZ, int coordMode, int componentType) { return null; }
|
||||
}
|
||||
|
||||
/** ProceduralComponent that can serve as a master "control component" for procedural generation and building of components. */
|
||||
public abstract static class ControlComponent extends ProceduralComponent {
|
||||
|
||||
public List queuedComponents = new ArrayList(); //List of all queued ProceduralComponents waiting to be built. Randomly iterated over until limits like component amt or dist are reached.
|
||||
public ProceduralComponent lastComponent = this; //Last component to be built. Used as input for the random selection's checks for specific components.
|
||||
|
||||
public ControlComponent() { }
|
||||
|
||||
public ControlComponent(int componentType) {
|
||||
super(componentType);
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns a new instance of this structureComponent, or null if not able to be placed.<br>Based on bounding box checks. */
|
||||
@FunctionalInterface
|
||||
interface instantiateStructure {
|
||||
ProceduralComponent findValidPlacement(List components, Random rand, int minX, int minY, int minZ, int coordMode, int componentType);
|
||||
}
|
||||
|
||||
protected static class Weight {
|
||||
|
||||
public final instantiateStructure lambda; //Read above
|
||||
|
||||
public final int weight; //Weight of this component
|
||||
public int instancesSpawned; //How many components spawned?
|
||||
public int instanceLimit; //Limit on amount of components: -1 for no limit
|
||||
|
||||
public Weight(int weight, int limit, instantiateStructure lambda) {
|
||||
this.weight = weight;
|
||||
this.instanceLimit = limit;
|
||||
this.lambda = lambda;
|
||||
}
|
||||
|
||||
//Checks if another structure can be spawned based on input data
|
||||
public boolean canSpawnStructure(int componentAmount, int coordMode, ProceduralComponent component) {
|
||||
return this.instanceLimit < 0 || this.instancesSpawned < this.instanceLimit;
|
||||
}
|
||||
|
||||
//Checks if another structure can be spawned at all (used to flag for removal from the list)
|
||||
public boolean canSpawnMoreStructures() {
|
||||
return this.instanceLimit < 0 || this.instancesSpawned < this.instanceLimit;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -6,11 +6,19 @@ import com.hbm.blocks.ModBlocks;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.structure.MapGenStructureIO;
|
||||
import net.minecraft.world.gen.structure.StructureBoundingBox;
|
||||
|
||||
public class RuinFeatures {
|
||||
|
||||
public static class NTMRuin1 extends Feature {
|
||||
public static void registerComponents() {
|
||||
MapGenStructureIO.func_143031_a(NTMRuin1.class, "NTMRuin1");
|
||||
MapGenStructureIO.func_143031_a(NTMRuin2.class, "NTMRuin2");
|
||||
MapGenStructureIO.func_143031_a(NTMRuin3.class, "NTMRuin3");
|
||||
MapGenStructureIO.func_143031_a(NTMRuin4.class, "NTMRuin4");
|
||||
}
|
||||
|
||||
public static class NTMRuin1 extends Component {
|
||||
|
||||
private static ConcreteBricks RandomConcreteBricks = new ConcreteBricks();
|
||||
|
||||
@ -82,7 +90,7 @@ public class RuinFeatures {
|
||||
}
|
||||
}
|
||||
|
||||
public static class NTMRuin2 extends Feature {
|
||||
public static class NTMRuin2 extends Component {
|
||||
|
||||
private static ConcreteBricks RandomConcreteBricks = new ConcreteBricks();
|
||||
|
||||
@ -145,7 +153,7 @@ public class RuinFeatures {
|
||||
}
|
||||
}
|
||||
|
||||
public static class NTMRuin3 extends Feature {
|
||||
public static class NTMRuin3 extends Component {
|
||||
|
||||
private static ConcreteBricks RandomConcreteBricks = new ConcreteBricks();
|
||||
|
||||
@ -202,7 +210,7 @@ public class RuinFeatures {
|
||||
}
|
||||
}
|
||||
|
||||
public static class NTMRuin4 extends Feature {
|
||||
public static class NTMRuin4 extends Component {
|
||||
|
||||
private static ConcreteBricks RandomConcreteBricks = new ConcreteBricks();
|
||||
|
||||
|
||||
@ -314,6 +314,72 @@ book.starter.page18=vær is just a guy who has been trapped in the grey void fea
|
||||
#book.rbmk.title16=Meltdown
|
||||
#book.rbmk.page16=§4§lAvoid.
|
||||
|
||||
book_lore.author=By %s
|
||||
book_lore.test.name=Test
|
||||
book_lore.test.author=the dude
|
||||
book_lore.test.page.1=>hello anons before i begin let me clarify that i'm not gay. >Be me >This night >18 > At hanging out with my best friend with my parents gone for a few days >We've been best friends for a year now >Been drinking a bit and playing lots of video games and ordered a pizza >We were having a blast >At a certain point in the night like around 9:00 he makes a really funny joke that I don't remember but I know that it made us both laugh really hard > With out thinking I brush my right hand through his semi-curly black hair and call him a funny boy >He blushes >I realize I'm feeling flustered >We're kinda close >All of the sudden he kisses me and for some reason I kiss him back >We make love >Cuddle together and fall asleep >Wake up in the middle of the night with his head snuggled up on my chest and neck area >It feels nice but I'm not a homosexual
|
||||
book_lore.test.page.2=I'm typing this as he's asleep in my arms. How do I let my best friend down nicely? I don't want to be a [redacted] /b/
|
||||
book_lore.test.page.3=3
|
||||
book_lore.test.page.4=4
|
||||
book_lore.test.page.5=5
|
||||
|
||||
book_lore.book_iodine.name=Note
|
||||
book_lore.book_iodine.author=Dave
|
||||
book_lore.book_iodine.page.1=alright you will not believe this, but old man weathervane finally managed to show up again since he left two weeks ago and what's more surprising is the fact that he actually decided to spill the beans on what they were doing in the canyon:
|
||||
book_lore.book_iodine.page.2=apparently the morons from R&D discovered a compound that is mostly inorganic, pretty much like a toxin in nature, but get this: the dying cells will reproduce said toxin and excrete it through the skin, creating an aerosol that is highly contagious.
|
||||
book_lore.book_iodine.page.3=it's just like a virus, but not a virus. the composition is weird, you can mix it in any household bottle but you do have to get the order right. the doc told me that the first ingredient which is just powdered iodine crystals goes into slot %d
|
||||
|
||||
book_lore.book_phosphorous.name=Note
|
||||
book_lore.book_phosphorous.author=Dave
|
||||
book_lore.book_phosphorous.page.1=heyo, it's me again. i assume you got my last memo, the doc wasn't too happy about it. i'll have to do this quick, the dunderheads from R&D are currently moaning again, probably over money. again. anyway, doc weathervane found that the second
|
||||
book_lore.book_phosphorous.page.2=ingredient is red phosphorous, whihc has to be mixed into slot %d
|
||||
|
||||
book_lore.book_dust.name=Note
|
||||
book_lore.book_dust.author=Dave
|
||||
book_lore.book_dust.page.1=the doc was furious when he found out that the R&D dorks kept the one remaining sample, ranting about gross negligence this and a doomsday scenario that. i told him to chill for a minute, getting all worked up isn't good for his blood pressure, not
|
||||
book_lore.book_dust.page.2=that he has much blood left to begin with. one of the R&D morons slipped some more info into last week's circular, they call their little concoction \"MKU\" whatever that means, and that it contains actual household lint. can you believe that? one of the most
|
||||
book_lore.book_dust.page.3=dangerous inventions of theirs and it contains dust. strangely they also mentioned that it goes into slot %d
|
||||
|
||||
book_lore.book_mercury.name=Note
|
||||
book_lore.book_mercury.author=Dave
|
||||
book_lore.book_mercury.page.1=well that settles that. not counting the vomitting blood part, the toxicological report mostly resembles that of mercury poisoning. why? because our little mix also contains mercury! i just wonder where all that stuff comes from when being
|
||||
book_lore.book_mercury.page.2=replicated by the body? whatever, the mercury goes into slot %d
|
||||
|
||||
book_lore.book_flower.name=Note
|
||||
book_lore.book_flower.author=Dave
|
||||
book_lore.book_flower.page.1=remember when i mentioned in my first memo that the compound is mostly anorganic? well guess what, the old man shared the fourth ingredient: ipomoea nil, a genus of flower. morning glory! it might be due to its low sulfur content, whatever might be the case,
|
||||
book_lore.book_flower.page.2=it does not work with other flowers. the morning glory goes into slot %d
|
||||
|
||||
book_lore.book_syringe.name=Note
|
||||
book_lore.book_syringe.author=Dave
|
||||
book_lore.book_syringe.page.1=a little addendum to my fifth message, obviously you have to store this MKU stuff in a container. the R&D nuts used regular metal syringes that they got from medical. surplus ware i presume, they got thousands of needles just lying around. the metal
|
||||
book_lore.book_syringe.page.2=syringe goes into slot %d
|
||||
|
||||
book_lore.resignation_note.name=Letter of Resignation
|
||||
book_lore.resignation_note.author=Kosma
|
||||
book_lore.resignation_note.page.1=Management downsized our department again yesterday. Those idiots only have themselves to blame, I don't know what they were expecting after that fiasco. Who the hell leaks that sort of information? We're losing millions and
|
||||
book_lore.resignation_note.page.2=it's ME who's the one out of a job now. I'M the one being asked to resign. I hope you asshats finally learn from your overabundance of mistakes and take that stick out of your ass.
|
||||
book_lore.resignation_note.page.3=I'm not coming back on Friday. Just send the paycheck.
|
||||
|
||||
book_lore.memo_stocks.name=Intracorporate Memorandum
|
||||
book_lore.memo_stocks.page.1=Investor Relations - $ $ There's been some glaring discrepancies in the figures provided for the latest quarterly report. It would be prudent for the financial department to make some adjustments, so there won't be any concern.
|
||||
|
||||
book_lore.memo_schrab_gsa.name=Internal Memorandum
|
||||
book_lore.memo_schrab_gsa.page.1=Contract Management - $ $ Legal has made a breakthrough with the DLA. They've awarded us with a 45 BILLION GSA Schedule for further procurement and research of saralloy. At current estimates, that would be at minimum
|
||||
book_lore.memo_schrab_gsa.page.2=a 40%% profit on related operations, let alone the possibility of future contracts. Due to the confidential nature, all fiscal evidence is to remain private.
|
||||
|
||||
book_lore.memo_schrab_rd.name=Internal Memorandum
|
||||
book_lore.memo_schrab_rd.page.1=Research & Development - $ $ Our main production method of saralloy has been through the new particle accelerator. However, the energy costs are exorbitantly high compared to the amount of output.
|
||||
book_lore.memo_schrab_rd.page.2=Doctor Schrabauer, however, has discovered a new interaction - called "Strange Lepton Oscillation" - that could significantly reduce costs. Through a not entirely understood process, supplied electrons are transmuted into extremely
|
||||
book_lore.memo_schrab_rd.page.3=high-energy photons, through a strange charm. This is an extreme exception to many established particle conversion laws, but preliminary experiments have proved that these protons transmute into up and down quarks, eventually creating saralloy.
|
||||
book_lore.memo_schrab_rd.page.4=Strangely, the prototype requires Tungsten alloyed with small amounts of saralloy. In addition, a special capacitor is required to negate the leftover positive charge.
|
||||
|
||||
book_lore.memo_schrab_nuke.name=Research Report
|
||||
book_lore.memo_schrab_nuke.author=Doctor Schrabauer
|
||||
book_lore.memo_schrab_nuke.page.1=Our most recent investigation led us to the effects of nuclear explosions on materials. Thanks to our grant money, we *accidentally* tested our theory on direct saralloy synthesis from uranium.
|
||||
book_lore.memo_schrab_nuke.page.2=Only our cyclotron has actually created saralloy previously. However, at our underground shot at Everwerpen, miniscule traces of saralloy were found in uranium ore at the site. All pure, metallic uranium nearby had fissioned.
|
||||
book_lore.memo_schrab_nuke.page.3=As such, given enough uranium ore concentrated around an explosive, or perhaps even a dirty bomb rich in waste containing fissionable material, one could hypothetically create enough saralloy to collect manually.
|
||||
|
||||
cannery.f1=[ Press F1 for help ]
|
||||
|
||||
cannery.centrifuge=Gas Centrifuge
|
||||
@ -506,6 +572,7 @@ container.epress=Electric Press
|
||||
container.factoryAdvanced=Advanced Factory
|
||||
container.factoryTitanium=Basic Factory
|
||||
container.fluidtank=Tank
|
||||
container.fileCabinet=Filing Cabinet
|
||||
container.forceField=Forcefield Emitter
|
||||
container.frackingTower=Hydraulic Fracking Tower
|
||||
container.furnaceIron=Iron Furnace
|
||||
@ -3866,7 +3933,7 @@ tile.crystal_virus.name=Dark Crystal
|
||||
tile.deco_aluminium.name=Aluminium Deco Block
|
||||
tile.deco_asbestos.name=Asbestos Roof
|
||||
tile.deco_beryllium.name=Beryllium Deco Block
|
||||
tile.deco_computer.name=IBM Personal Computer 300PL
|
||||
tile.deco_computer.ibm_300pl.name=IBM Personal Computer 300PL
|
||||
tile.deco_emitter.name=Deco Light Emitter
|
||||
tile.deco_lead.name=Lead Deco Block
|
||||
tile.deco_rbmk.name=RBMK Deco Block
|
||||
@ -3937,6 +4004,8 @@ tile.factory_titanium_hull.name=Factory Block
|
||||
tile.fallout.name=Fallout
|
||||
tile.fence_metal.name=Chainlink Fence
|
||||
tile.field_disturber.name=High Energy Field Jammer
|
||||
tile.filing_cabinet.green.name=Dusty Filing Cabinet
|
||||
tile.filing_cabinet.steel.name=Steel Filing Cabinet
|
||||
tile.fire_digamma.name=Lingering Digamma
|
||||
tile.fire_door.name=Fire Door
|
||||
tile.fireworks.name=Firework Battery
|
||||
@ -4460,6 +4529,8 @@ tile.vent_chlorine.name=Chlorine Vent
|
||||
tile.vent_chlorine_seal.name=Chlorine Seal
|
||||
tile.vent_cloud.name=Cloud Vent
|
||||
tile.vent_pink_cloud.name=Pink Cloud Vent
|
||||
tile.vinyl_tile.large.name=Large Vinyl Tile
|
||||
tile.vinyl_tile.small.name=Small Vinyl Tiles
|
||||
tile.vitrified_barrel.name=Vitrified Nuclear Waste Drum
|
||||
tile.volcanic_lava_block.name=Volcanic Lava
|
||||
tile.volcano_core.name=Volcano Core
|
||||
|
||||
530
src/main/resources/assets/hbm/models/file_cabinet.obj
Normal file
@ -0,0 +1,530 @@
|
||||
# Blender 3.2.0
|
||||
# www.blender.org
|
||||
o Cabinet
|
||||
v -0.312500 0.000000 0.250000
|
||||
v -0.312500 1.000000 0.250000
|
||||
v -0.312500 0.000000 -0.500000
|
||||
v -0.312500 1.000000 -0.500000
|
||||
v 0.312500 0.000000 0.250000
|
||||
v 0.312500 1.000000 0.250000
|
||||
v 0.312500 0.000000 -0.500000
|
||||
v 0.312500 1.000000 -0.500000
|
||||
v -0.312500 0.000000 0.250000
|
||||
v -0.312500 1.000000 0.250000
|
||||
v 0.312500 1.000000 0.250000
|
||||
v 0.312500 0.000000 0.250000
|
||||
v -0.250000 0.062500 -0.437500
|
||||
v 0.250000 0.062500 -0.437500
|
||||
v 0.250000 0.937500 -0.437500
|
||||
v -0.250000 0.937500 -0.437500
|
||||
v -0.250000 0.531250 -0.437500
|
||||
v 0.250000 0.531250 -0.437500
|
||||
v 0.312500 0.500000 0.250000
|
||||
v 0.250000 0.468750 -0.437500
|
||||
v -0.250000 0.468750 -0.437500
|
||||
v -0.312500 0.500000 0.250000
|
||||
v 0.250000 0.937500 0.250000
|
||||
v -0.250000 0.937500 0.250000
|
||||
v -0.250000 0.531250 0.250000
|
||||
v 0.250000 0.531250 0.250000
|
||||
v -0.250000 0.062500 0.250000
|
||||
v 0.250000 0.062500 0.250000
|
||||
v 0.250000 0.468750 0.250000
|
||||
v -0.250000 0.468750 0.250000
|
||||
vn -1.0000 -0.0000 -0.0000
|
||||
vn -0.0000 -0.0000 -1.0000
|
||||
vn 1.0000 -0.0000 -0.0000
|
||||
vn -0.0000 -0.0000 1.0000
|
||||
vn -0.0000 -1.0000 -0.0000
|
||||
vn -0.0000 1.0000 -0.0000
|
||||
vt 0.750000 0.640625
|
||||
vt 1.000000 0.640625
|
||||
vt 0.234375 0.828125
|
||||
vt 0.484375 0.828125
|
||||
vt 0.750000 0.484375
|
||||
vt 1.000000 0.484375
|
||||
vt 0.890625 0.828125
|
||||
vt 0.234375 0.984375
|
||||
vt 0.078125 0.828125
|
||||
vt 0.484375 0.984375
|
||||
vt 0.640625 0.828125
|
||||
vt 0.234375 0.640625
|
||||
vt 0.484375 0.640625
|
||||
vt 0.640625 0.640625
|
||||
vt 0.890625 0.640625
|
||||
vt 0.078125 0.640625
|
||||
vt 0.890625 0.828125
|
||||
vt 0.890625 0.703125
|
||||
vt 0.765625 0.828125
|
||||
vt 1.000000 0.703125
|
||||
vt 0.656250 0.828125
|
||||
vt 0.531250 0.828125
|
||||
vt 1.000000 0.828125
|
||||
vt 0.890625 0.828125
|
||||
vt 0.890625 0.703125
|
||||
vt 0.765625 0.828125
|
||||
vt 0.875000 0.484375
|
||||
vt 1.000000 0.703125
|
||||
vt 0.656250 0.828125
|
||||
vt 0.531250 0.828125
|
||||
vt 1.000000 0.828125
|
||||
vt 0.875000 0.640625
|
||||
vt 0.984375 0.500000
|
||||
vt 0.656250 1.000000
|
||||
vt 0.984375 0.625000
|
||||
vt 0.531250 1.000000
|
||||
vt 1.000000 1.000000
|
||||
vt 0.882812 0.625000
|
||||
vt 0.875000 0.500000
|
||||
vt 0.890625 1.000000
|
||||
vt 0.882812 0.500000
|
||||
vt 0.875000 0.625000
|
||||
vt 0.765625 1.000000
|
||||
vt 0.765625 0.625000
|
||||
vt 0.890625 1.000000
|
||||
vt 0.765625 0.500000
|
||||
vt 0.765625 1.000000
|
||||
vt 0.890625 0.625000
|
||||
vt 0.867188 0.500000
|
||||
vt 0.656250 1.000000
|
||||
vt 0.890625 0.500000
|
||||
vt 0.867188 0.625000
|
||||
vt 1.000000 1.000000
|
||||
vt 0.531250 1.000000
|
||||
s 0
|
||||
f 10/13/1 3/3/1 9/12/1
|
||||
f 4/4/2 7/8/2 3/3/2
|
||||
f 8/11/3 12/15/3 7/7/3
|
||||
f 15/20/4 17/24/4 18/25/4
|
||||
f 7/9/5 9/12/5 3/3/5
|
||||
f 4/4/6 11/14/6 8/11/6
|
||||
f 27/44/4 5/5/4 28/46/4
|
||||
f 23/33/4 2/2/4 24/35/4
|
||||
f 24/35/4 22/32/4 25/38/4
|
||||
f 28/46/4 19/27/4 29/49/4
|
||||
f 23/33/4 19/27/4 6/6/4
|
||||
f 30/52/4 25/38/4 22/32/4
|
||||
f 26/42/4 30/51/4 29/48/4
|
||||
f 20/28/4 13/17/4 14/18/4
|
||||
f 27/44/4 22/32/4 1/1/4
|
||||
f 26/41/4 29/49/4 19/27/4
|
||||
f 15/21/5 24/36/5 16/22/5
|
||||
f 16/23/3 25/40/3 17/24/3
|
||||
f 18/26/1 23/34/1 15/21/1
|
||||
f 17/24/6 26/43/6 18/26/6
|
||||
f 13/17/6 28/47/6 14/19/6
|
||||
f 14/19/1 29/50/1 20/29/1
|
||||
f 21/31/3 27/45/3 13/17/3
|
||||
f 20/29/5 30/54/5 21/30/5
|
||||
f 10/13/1 4/4/1 3/3/1
|
||||
f 4/4/2 8/10/2 7/8/2
|
||||
f 8/11/3 11/14/3 12/15/3
|
||||
f 15/20/4 16/23/4 17/24/4
|
||||
f 7/9/5 12/16/5 9/12/5
|
||||
f 4/4/6 10/13/6 11/14/6
|
||||
f 27/44/4 1/1/4 5/5/4
|
||||
f 23/33/4 6/6/4 2/2/4
|
||||
f 24/35/4 2/2/4 22/32/4
|
||||
f 28/46/4 5/5/4 19/27/4
|
||||
f 23/33/4 26/41/4 19/27/4
|
||||
f 26/42/4 25/39/4 30/51/4
|
||||
f 20/28/4 21/31/4 13/17/4
|
||||
f 27/44/4 30/52/4 22/32/4
|
||||
f 15/21/5 23/34/5 24/36/5
|
||||
f 16/23/3 24/37/3 25/40/3
|
||||
f 18/26/1 26/43/1 23/34/1
|
||||
f 17/24/6 25/40/6 26/43/6
|
||||
f 13/17/6 27/45/6 28/47/6
|
||||
f 14/19/1 28/47/1 29/50/1
|
||||
f 21/31/3 30/53/3 27/45/3
|
||||
f 20/29/5 29/50/5 30/54/5
|
||||
o LowerDrawer
|
||||
v -0.078125 0.171875 0.250000
|
||||
v -0.250000 0.468750 0.250000
|
||||
v -0.250000 0.062500 -0.437500
|
||||
v 0.250000 0.062500 0.250000
|
||||
v -0.046875 0.203125 0.250000
|
||||
v 0.250000 0.062500 -0.437500
|
||||
v -0.250000 0.062500 0.187500
|
||||
v -0.250000 0.468750 0.187500
|
||||
v 0.250000 0.062500 0.187500
|
||||
v 0.250000 0.468750 0.187500
|
||||
v -0.218750 0.265625 -0.406250
|
||||
v 0.250000 0.265625 -0.437500
|
||||
v -0.250000 0.265625 0.187500
|
||||
v 0.250000 0.265625 0.187500
|
||||
v -0.218750 0.265625 0.187500
|
||||
v -0.250000 0.265625 -0.437500
|
||||
v 0.218750 0.265625 -0.406250
|
||||
v 0.218750 0.265625 0.187500
|
||||
v -0.218750 0.093750 -0.406250
|
||||
v -0.218750 0.093750 0.187500
|
||||
v 0.218750 0.093750 -0.406250
|
||||
v 0.218750 0.093750 0.187500
|
||||
v -0.250000 0.062500 0.250000
|
||||
v -0.078125 0.203125 0.250000
|
||||
v 0.250000 0.468750 0.250000
|
||||
v -0.046875 0.171875 0.250000
|
||||
v 0.046875 0.171875 0.250000
|
||||
v 0.078125 0.203125 0.250000
|
||||
v 0.046875 0.203125 0.250000
|
||||
v 0.078125 0.171875 0.250000
|
||||
v 0.046875 0.171875 0.281250
|
||||
v 0.046875 0.203125 0.281250
|
||||
v 0.078125 0.203125 0.281250
|
||||
v 0.078125 0.171875 0.281250
|
||||
v -0.078125 0.171875 0.281250
|
||||
v -0.078125 0.203125 0.281250
|
||||
v -0.046875 0.203125 0.281250
|
||||
v -0.046875 0.171875 0.281250
|
||||
v -0.046875 0.203125 0.265625
|
||||
v -0.046875 0.171875 0.265625
|
||||
v 0.046875 0.203125 0.265625
|
||||
v 0.046875 0.171875 0.265625
|
||||
vn -0.0000 -1.0000 -0.0000
|
||||
vn -0.0000 1.0000 -0.0000
|
||||
vn 1.0000 -0.0000 -0.0000
|
||||
vn -1.0000 -0.0000 -0.0000
|
||||
vn -0.0000 -0.0000 -1.0000
|
||||
vn -0.0000 -0.0000 1.0000
|
||||
vt 0.046875 0.984375
|
||||
vt 0.625000 0.500000
|
||||
vt 0.281250 0.390625
|
||||
vt 0.078125 0.640625
|
||||
vt 0.734375 0.625000
|
||||
vt 0.484375 0.640625
|
||||
vt 0.046875 1.000000
|
||||
vt 0.058594 0.972656
|
||||
vt 0.078125 0.515625
|
||||
vt 0.750000 0.500000
|
||||
vt 0.734375 0.484375
|
||||
vt 0.234375 0.640625
|
||||
vt 0.078125 0.796875
|
||||
vt 0.625000 0.484375
|
||||
vt 0.609375 0.500000
|
||||
vt 0.734375 0.640625
|
||||
vt 0.078125 0.359375
|
||||
vt 0.750000 0.625000
|
||||
vt 0.234375 0.515625
|
||||
vt 0.625000 0.640625
|
||||
vt 0.609375 0.625000
|
||||
vt 0.019531 0.632812
|
||||
vt 0.019531 0.648438
|
||||
vt 0.277344 0.484375
|
||||
vt 0.027344 0.515625
|
||||
vt 0.679688 0.484375
|
||||
vt 0.562500 0.500000
|
||||
vt 0.027344 0.796875
|
||||
vt 0.679688 0.640625
|
||||
vt 0.027344 0.359375
|
||||
vt 0.562500 0.625000
|
||||
vt 0.019531 0.796875
|
||||
vt 0.277344 0.109375
|
||||
vt 0.277344 0.640625
|
||||
vt 0.027344 0.640625
|
||||
vt 0.019531 0.507812
|
||||
vt 0.019531 0.523438
|
||||
vt 0.277344 0.375000
|
||||
vt 0.019531 0.359375
|
||||
vt 0.277344 0.218750
|
||||
vt 0.234375 0.484375
|
||||
vt 0.085938 0.484375
|
||||
vt 0.234375 0.640625
|
||||
vt 0.234375 0.109375
|
||||
vt 0.234375 0.375000
|
||||
vt 0.085938 0.375000
|
||||
vt 0.234375 0.218750
|
||||
vt 0.484375 0.390625
|
||||
vt 0.734375 0.500000
|
||||
vt 0.046875 0.992188
|
||||
vt 0.625000 0.625000
|
||||
vt 0.281250 0.640625
|
||||
vt 0.046875 0.976562
|
||||
vt 0.058594 0.980469
|
||||
vt 0.109375 0.976562
|
||||
vt 0.097656 0.980469
|
||||
vt 0.109375 0.992188
|
||||
vt 0.097656 0.972656
|
||||
vt 0.109375 1.000000
|
||||
vt 0.109375 0.984375
|
||||
vt 0.101562 0.976562
|
||||
vt 0.093750 0.984375
|
||||
vt 0.101562 1.000000
|
||||
vt 0.093750 0.992188
|
||||
vt 0.093750 0.968750
|
||||
vt 0.101562 0.992188
|
||||
vt 0.101562 0.984375
|
||||
vt 0.054688 0.984375
|
||||
vt 0.054688 0.992188
|
||||
vt 0.054688 1.000000
|
||||
vt 0.062500 0.992188
|
||||
vt 0.062500 0.968750
|
||||
vt 0.054688 0.976562
|
||||
vt 0.062500 0.984375
|
||||
vt 0.062500 0.972656
|
||||
vt 0.062500 0.980469
|
||||
vt 0.093750 0.972656
|
||||
vt 0.093750 0.980469
|
||||
s 0
|
||||
f 39/72/7 53/103/7 37/64/7
|
||||
f 38/69/8 55/105/8 40/75/8
|
||||
f 36/63/7 37/66/7 33/58/7
|
||||
f 44/84/8 47/90/8 48/93/8
|
||||
f 40/74/9 55/105/9 44/83/9
|
||||
f 34/59/9 44/83/9 55/105/9
|
||||
f 39/70/9 44/83/9 34/59/9
|
||||
f 53/103/10 43/80/10 37/65/10
|
||||
f 32/56/10 43/80/10 53/103/10
|
||||
f 38/68/10 43/80/10 32/56/10
|
||||
f 36/63/9 44/84/9 39/71/9
|
||||
f 42/79/11 33/58/11 46/89/11
|
||||
f 33/58/10 43/82/10 46/89/10
|
||||
f 46/89/8 47/91/8 42/79/8
|
||||
f 40/75/11 43/81/11 38/69/11
|
||||
f 41/77/8 43/82/8 45/86/8
|
||||
f 47/92/10 52/101/10 48/94/10
|
||||
f 52/100/8 49/95/8 50/96/8
|
||||
f 45/88/9 49/95/9 41/78/9
|
||||
f 48/94/11 50/98/11 45/87/11
|
||||
f 41/78/12 51/99/12 47/92/12
|
||||
f 63/120/12 61/116/12 64/121/12
|
||||
f 60/114/7 61/115/7 57/109/7
|
||||
f 58/111/9 64/121/9 60/114/9
|
||||
f 59/113/8 63/120/8 58/111/8
|
||||
f 71/131/9 57/110/9 59/112/9
|
||||
f 67/125/12 65/122/12 68/128/12
|
||||
f 31/55/10 66/123/10 54/104/10
|
||||
f 68/127/7 31/55/7 56/107/7
|
||||
f 66/123/8 35/61/8 54/104/8
|
||||
f 70/130/10 35/62/10 56/108/10
|
||||
f 70/130/12 71/131/12 69/129/12
|
||||
f 68/128/8 72/132/8 70/130/8
|
||||
f 62/118/12 68/128/12 61/116/12
|
||||
f 69/129/8 62/119/8 71/131/8
|
||||
f 34/60/12 32/57/12 53/102/12
|
||||
f 39/72/7 34/59/7 53/103/7
|
||||
f 38/69/8 32/56/8 55/105/8
|
||||
f 36/63/7 39/73/7 37/66/7
|
||||
f 44/84/8 42/79/8 47/90/8
|
||||
f 36/63/9 42/79/9 44/84/9
|
||||
f 42/79/11 36/63/11 33/58/11
|
||||
f 33/58/10 37/67/10 43/82/10
|
||||
f 46/89/8 41/76/8 47/91/8
|
||||
f 40/75/11 44/85/11 43/81/11
|
||||
f 41/77/8 46/89/8 43/82/8
|
||||
f 47/92/10 51/99/10 52/101/10
|
||||
f 52/100/8 51/99/8 49/95/8
|
||||
f 45/88/9 50/97/9 49/95/9
|
||||
f 48/94/11 52/101/11 50/98/11
|
||||
f 41/78/12 49/95/12 51/99/12
|
||||
f 63/120/12 62/118/12 61/116/12
|
||||
f 60/114/7 64/121/7 61/115/7
|
||||
f 58/111/9 63/120/9 64/121/9
|
||||
f 59/113/8 62/117/8 63/120/8
|
||||
f 71/131/9 72/132/9 57/110/9
|
||||
f 67/125/12 66/123/12 65/122/12
|
||||
f 31/55/10 65/122/10 66/123/10
|
||||
f 68/127/7 65/122/7 31/55/7
|
||||
f 66/123/8 67/124/8 35/61/8
|
||||
f 70/130/10 69/129/10 35/62/10
|
||||
f 70/130/12 72/132/12 71/131/12
|
||||
f 68/128/8 61/116/8 72/132/8
|
||||
f 62/118/12 67/125/12 68/128/12
|
||||
f 69/129/8 67/126/8 62/119/8
|
||||
f 34/60/12 55/106/12 32/57/12
|
||||
l 38 37
|
||||
l 40 39
|
||||
o UpperDrawer
|
||||
v -0.078125 0.640625 0.250000
|
||||
v -0.250000 0.937500 0.250000
|
||||
v -0.250000 0.531250 -0.437500
|
||||
v 0.250000 0.531250 0.250000
|
||||
v -0.046875 0.671875 0.250000
|
||||
v 0.250000 0.531250 -0.437500
|
||||
v -0.250000 0.531250 0.187500
|
||||
v -0.250000 0.937500 0.187500
|
||||
v 0.250000 0.531250 0.187500
|
||||
v 0.250000 0.937500 0.187500
|
||||
v -0.218750 0.734375 -0.406250
|
||||
v 0.250000 0.734375 -0.437500
|
||||
v -0.250000 0.734375 0.187500
|
||||
v 0.250000 0.734375 0.187500
|
||||
v -0.218750 0.734375 0.187500
|
||||
v -0.250000 0.734375 -0.437500
|
||||
v 0.218750 0.734375 -0.406250
|
||||
v 0.218750 0.734375 0.187500
|
||||
v -0.218750 0.562500 -0.406250
|
||||
v -0.218750 0.562500 0.187500
|
||||
v 0.218750 0.562500 -0.406250
|
||||
v 0.218750 0.562500 0.187500
|
||||
v -0.250000 0.531250 0.250000
|
||||
v -0.078125 0.671875 0.250000
|
||||
v 0.250000 0.937500 0.250000
|
||||
v -0.046875 0.640625 0.250000
|
||||
v 0.046875 0.640625 0.250000
|
||||
v 0.078125 0.671875 0.250000
|
||||
v 0.046875 0.671875 0.250000
|
||||
v 0.078125 0.640625 0.250000
|
||||
v 0.046875 0.640625 0.281250
|
||||
v 0.046875 0.671875 0.281250
|
||||
v 0.078125 0.671875 0.281250
|
||||
v 0.078125 0.640625 0.281250
|
||||
v -0.078125 0.640625 0.281250
|
||||
v -0.078125 0.671875 0.281250
|
||||
v -0.046875 0.671875 0.281250
|
||||
v -0.046875 0.640625 0.281250
|
||||
v -0.046875 0.671875 0.265625
|
||||
v -0.046875 0.640625 0.265625
|
||||
v 0.046875 0.671875 0.265625
|
||||
v 0.046875 0.640625 0.265625
|
||||
vn -0.0000 -1.0000 -0.0000
|
||||
vn -0.0000 1.0000 -0.0000
|
||||
vn 1.0000 -0.0000 -0.0000
|
||||
vn -1.0000 -0.0000 -0.0000
|
||||
vn -0.0000 -0.0000 -1.0000
|
||||
vn -0.0000 -0.0000 1.0000
|
||||
vt 0.046875 0.984375
|
||||
vt 0.625000 0.500000
|
||||
vt 0.281250 0.140625
|
||||
vt 0.078125 0.640625
|
||||
vt 0.734375 0.625000
|
||||
vt 0.484375 0.390625
|
||||
vt 0.046875 1.000000
|
||||
vt 0.058594 0.972656
|
||||
vt 0.078125 0.515625
|
||||
vt 0.750000 0.500000
|
||||
vt 0.734375 0.484375
|
||||
vt 0.234375 0.640625
|
||||
vt 0.078125 0.796875
|
||||
vt 0.625000 0.484375
|
||||
vt 0.609375 0.500000
|
||||
vt 0.734375 0.640625
|
||||
vt 0.078125 0.359375
|
||||
vt 0.750000 0.625000
|
||||
vt 0.234375 0.515625
|
||||
vt 0.625000 0.640625
|
||||
vt 0.609375 0.625000
|
||||
vt 0.019531 0.632812
|
||||
vt 0.019531 0.648438
|
||||
vt 0.277344 0.484375
|
||||
vt 0.027344 0.515625
|
||||
vt 0.679688 0.484375
|
||||
vt 0.562500 0.500000
|
||||
vt 0.027344 0.796875
|
||||
vt 0.679688 0.640625
|
||||
vt 0.027344 0.359375
|
||||
vt 0.562500 0.625000
|
||||
vt 0.019531 0.796875
|
||||
vt 0.277344 0.109375
|
||||
vt 0.277344 0.640625
|
||||
vt 0.027344 0.640625
|
||||
vt 0.019531 0.507812
|
||||
vt 0.019531 0.523438
|
||||
vt 0.277344 0.375000
|
||||
vt 0.019531 0.359375
|
||||
vt 0.277344 0.218750
|
||||
vt 0.234375 0.484375
|
||||
vt 0.085938 0.484375
|
||||
vt 0.234375 0.640625
|
||||
vt 0.234375 0.109375
|
||||
vt 0.234375 0.375000
|
||||
vt 0.085938 0.375000
|
||||
vt 0.234375 0.218750
|
||||
vt 0.484375 0.140625
|
||||
vt 0.734375 0.500000
|
||||
vt 0.046875 0.992188
|
||||
vt 0.625000 0.625000
|
||||
vt 0.281250 0.390625
|
||||
vt 0.046875 0.976562
|
||||
vt 0.058594 0.980469
|
||||
vt 0.109375 0.976562
|
||||
vt 0.097656 0.980469
|
||||
vt 0.109375 0.992188
|
||||
vt 0.097656 0.972656
|
||||
vt 0.109375 1.000000
|
||||
vt 0.109375 0.984375
|
||||
vt 0.101562 0.976562
|
||||
vt 0.093750 0.984375
|
||||
vt 0.101562 1.000000
|
||||
vt 0.093750 0.992188
|
||||
vt 0.093750 0.968750
|
||||
vt 0.101562 0.992188
|
||||
vt 0.101562 0.984375
|
||||
vt 0.054688 0.984375
|
||||
vt 0.054688 0.992188
|
||||
vt 0.054688 1.000000
|
||||
vt 0.062500 0.992188
|
||||
vt 0.062500 0.968750
|
||||
vt 0.054688 0.976562
|
||||
vt 0.062500 0.984375
|
||||
vt 0.062500 0.972656
|
||||
vt 0.062500 0.980469
|
||||
vt 0.093750 0.972656
|
||||
vt 0.093750 0.980469
|
||||
s 0
|
||||
f 81/150/13 95/181/13 79/142/13
|
||||
f 80/147/14 97/183/14 82/153/14
|
||||
f 78/141/13 79/144/13 75/136/13
|
||||
f 86/162/14 89/168/14 90/171/14
|
||||
f 82/152/15 97/183/15 86/161/15
|
||||
f 76/137/15 86/161/15 97/183/15
|
||||
f 81/148/15 86/161/15 76/137/15
|
||||
f 95/181/16 85/158/16 79/143/16
|
||||
f 74/134/16 85/158/16 95/181/16
|
||||
f 80/146/16 85/158/16 74/134/16
|
||||
f 78/141/15 86/162/15 81/149/15
|
||||
f 84/157/17 75/136/17 88/167/17
|
||||
f 75/136/16 85/160/16 88/167/16
|
||||
f 88/167/14 89/169/14 84/157/14
|
||||
f 82/153/17 85/159/17 80/147/17
|
||||
f 83/155/14 85/160/14 87/164/14
|
||||
f 89/170/16 94/179/16 90/172/16
|
||||
f 94/178/14 91/173/14 92/174/14
|
||||
f 87/166/15 91/173/15 83/156/15
|
||||
f 90/172/17 92/176/17 87/165/17
|
||||
f 83/156/18 93/177/18 89/170/18
|
||||
f 105/198/18 103/194/18 106/199/18
|
||||
f 102/192/13 103/193/13 99/187/13
|
||||
f 100/189/15 106/199/15 102/192/15
|
||||
f 101/191/14 105/198/14 100/189/14
|
||||
f 113/209/15 99/188/15 101/190/15
|
||||
f 109/203/18 107/200/18 110/206/18
|
||||
f 73/133/16 108/201/16 96/182/16
|
||||
f 110/205/13 73/133/13 98/185/13
|
||||
f 108/201/14 77/139/14 96/182/14
|
||||
f 112/208/16 77/140/16 98/186/16
|
||||
f 112/208/18 113/209/18 111/207/18
|
||||
f 110/206/14 114/210/14 112/208/14
|
||||
f 104/196/18 110/206/18 103/194/18
|
||||
f 111/207/14 104/197/14 113/209/14
|
||||
f 76/138/18 74/135/18 95/180/18
|
||||
f 81/150/13 76/137/13 95/181/13
|
||||
f 80/147/14 74/134/14 97/183/14
|
||||
f 78/141/13 81/151/13 79/144/13
|
||||
f 86/162/14 84/157/14 89/168/14
|
||||
f 78/141/15 84/157/15 86/162/15
|
||||
f 84/157/17 78/141/17 75/136/17
|
||||
f 75/136/16 79/145/16 85/160/16
|
||||
f 88/167/14 83/154/14 89/169/14
|
||||
f 82/153/17 86/163/17 85/159/17
|
||||
f 83/155/14 88/167/14 85/160/14
|
||||
f 89/170/16 93/177/16 94/179/16
|
||||
f 94/178/14 93/177/14 91/173/14
|
||||
f 87/166/15 92/175/15 91/173/15
|
||||
f 90/172/17 94/179/17 92/176/17
|
||||
f 83/156/18 91/173/18 93/177/18
|
||||
f 105/198/18 104/196/18 103/194/18
|
||||
f 102/192/13 106/199/13 103/193/13
|
||||
f 100/189/15 105/198/15 106/199/15
|
||||
f 101/191/14 104/195/14 105/198/14
|
||||
f 113/209/15 114/210/15 99/188/15
|
||||
f 109/203/18 108/201/18 107/200/18
|
||||
f 73/133/16 107/200/16 108/201/16
|
||||
f 110/205/13 107/200/13 73/133/13
|
||||
f 108/201/14 109/202/14 77/139/14
|
||||
f 112/208/16 111/207/16 77/140/16
|
||||
f 112/208/18 114/210/18 113/209/18
|
||||
f 110/206/14 103/194/14 114/210/14
|
||||
f 104/196/18 109/203/18 110/206/18
|
||||
f 111/207/14 109/204/14 104/197/14
|
||||
f 76/138/18 97/184/18 74/135/18
|
||||
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 850 B |
|
Before Width: | Height: | Size: 2.2 KiB |
BIN
src/main/resources/assets/hbm/textures/items/notebook.png
Normal file
|
After Width: | Height: | Size: 265 B |
BIN
src/main/resources/assets/hbm/textures/items/paper_loose.png
Normal file
|
After Width: | Height: | Size: 239 B |
BIN
src/main/resources/assets/hbm/textures/items/papers_loose.png
Normal file
|
After Width: | Height: | Size: 263 B |
|
After Width: | Height: | Size: 224 B |
|
After Width: | Height: | Size: 225 B |
BIN
src/main/resources/assets/hbm/textures/models/file_cabinet.png
Normal file
|
After Width: | Height: | Size: 5.2 KiB |
|
After Width: | Height: | Size: 3.6 KiB |