mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
zirnox texture, some loot stuff, world gen tests
This commit is contained in:
parent
aa320d25cb
commit
26b379e249
@ -271,6 +271,8 @@ public class ModBlocks {
|
||||
public static Block deco_rbmk;
|
||||
public static Block deco_rbmk_smooth;
|
||||
|
||||
public static Block deco_loot;
|
||||
|
||||
public static Block hazmat;
|
||||
|
||||
public static Block gravel_obsidian;
|
||||
@ -356,6 +358,8 @@ public class ModBlocks {
|
||||
public static Block brick_dungeon_tile;
|
||||
public static Block brick_dungeon_circle;
|
||||
|
||||
public static Block brick_forgotten;
|
||||
|
||||
public static Block tape_recorder;
|
||||
public static Block steel_poles;
|
||||
public static Block pole_top;
|
||||
@ -1084,6 +1088,7 @@ public class ModBlocks {
|
||||
public static Block absorber_green;
|
||||
public static Block absorber_pink;
|
||||
public static Block decon;
|
||||
public static Block transission_hatch;
|
||||
|
||||
public static Block mud_block;
|
||||
public static Fluid mud_fluid;
|
||||
@ -1430,6 +1435,7 @@ public class ModBlocks {
|
||||
deco_rbmk = new BlockGeneric(Material.iron).setBlockName("deco_rbmk").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_side");
|
||||
deco_rbmk_smooth = new BlockGeneric(Material.iron).setBlockName("deco_rbmk_smooth").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_top");
|
||||
|
||||
deco_loot = new BlockLoot().setBlockName("deco_loot").setCreativeTab(null).setHardness(0.0F).setResistance(0.0F).setBlockTextureName(RefStrings.MODID + ":deco_loot");
|
||||
hazmat = new BlockGeneric(Material.cloth).setBlockName("hazmat").setStepSound(Block.soundTypeCloth).setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(100.0F).setBlockTextureName(RefStrings.MODID + ":hazmat");
|
||||
|
||||
gravel_obsidian = new BlockFalling(Material.iron).setBlockName("gravel_obsidian").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeGravel).setHardness(5.0F).setResistance(600.0F).setBlockTextureName(RefStrings.MODID + ":gravel_obsidian");
|
||||
@ -1515,6 +1521,8 @@ public class ModBlocks {
|
||||
brick_dungeon_flat = new BlockGeneric(Material.rock).setBlockName("brick_dungeon_flat").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(900.0F).setBlockTextureName(RefStrings.MODID + ":brick_dungeon_flat");
|
||||
brick_dungeon_tile = new BlockGeneric(Material.rock).setBlockName("brick_dungeon_tile").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(900.0F).setBlockTextureName(RefStrings.MODID + ":brick_dungeon_tile");
|
||||
brick_dungeon_circle = new BlockGeneric(Material.rock).setBlockName("brick_dungeon_circle").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(900.0F).setBlockTextureName(RefStrings.MODID + ":brick_dungeon_circle");
|
||||
|
||||
brick_forgotten = new BlockGeneric(Material.rock).setBlockName("brick_forgotten").setCreativeTab(MainRegistry.blockTab).setBlockUnbreakable().setResistance(1000000).setBlockTextureName(RefStrings.MODID + ":brick_forgotten");
|
||||
|
||||
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");
|
||||
@ -2063,13 +2071,14 @@ public class ModBlocks {
|
||||
gas_coal = new BlockGasCoal().setBlockName("gas_coal").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":gas_coal");
|
||||
gas_flammable = new BlockGasFlammable().setBlockName("gas_flammable").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":gas_flammable");
|
||||
gas_explosive = new BlockGasExplosive().setBlockName("gas_explosive").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":gas_explosive");
|
||||
vacuum = new BlockVacuum().setBlockName("vacuum").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":vacuum");
|
||||
vacuum = new BlockVacuum().setBlockName("vacuum").setResistance(1000000F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":vacuum");
|
||||
|
||||
absorber = new BlockAbsorber(Material.iron, 2.5F).setBlockName("absorber").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":absorber");
|
||||
absorber_red = new BlockAbsorber(Material.iron, 10F).setBlockName("absorber_red").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":absorber_red");
|
||||
absorber_green = new BlockAbsorber(Material.iron, 100F).setBlockName("absorber_green").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":absorber_green");
|
||||
absorber_pink = new BlockAbsorber(Material.iron, 10000F).setBlockName("absorber_pink").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":absorber_pink");
|
||||
decon = new BlockDecon(Material.iron).setBlockName("decon").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":decon_side");
|
||||
transission_hatch = new BlockTransission(Material.iron).setBlockName("transission_hatch").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":transission_hatch");
|
||||
|
||||
volcano_core = new BlockVolcano().setBlockName("volcano_core").setBlockUnbreakable().setResistance(10000.0F).setCreativeTab(MainRegistry.nukeTab).setBlockTextureName(RefStrings.MODID + ":volcano_core");
|
||||
|
||||
@ -2407,6 +2416,7 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(deco_lead, deco_lead.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(deco_beryllium, deco_beryllium.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(deco_asbestos, deco_asbestos.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(deco_loot, deco_loot.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(hazmat, hazmat.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(deco_rbmk, deco_rbmk.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(deco_rbmk_smooth, deco_rbmk_smooth.getUnlocalizedName());
|
||||
@ -2508,6 +2518,7 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(brick_dungeon_flat, brick_dungeon_flat.getUnlocalizedName());
|
||||
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(tape_recorder, tape_recorder.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(steel_poles, steel_poles.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(pole_top, pole_top.getUnlocalizedName());
|
||||
@ -2922,6 +2933,7 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(absorber_green, absorber_green.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(absorber_pink, absorber_pink.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(decon, decon.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(transission_hatch, transission_hatch.getUnlocalizedName());
|
||||
|
||||
//Solar Tower Blocks
|
||||
GameRegistry.registerBlock(machine_solar_boiler, machine_solar_boiler.getUnlocalizedName());
|
||||
|
||||
@ -63,7 +63,7 @@ public class BlockVacuum extends Block {
|
||||
|
||||
@Override
|
||||
public boolean isReplaceable(IBlockAccess world, int x, int y, int z) {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -86,14 +86,45 @@ public class BlockVacuum extends Block {
|
||||
if(b == this)
|
||||
continue;
|
||||
|
||||
if(b.getMaterial() == Material.air ||
|
||||
b.getBlockBoundsMinX() > 0 || b.getBlockBoundsMinY() > 0 || b.getBlockBoundsMinZ() > 0 ||
|
||||
b.getBlockBoundsMaxX() < 1 || b.getBlockBoundsMaxY() < 1 || b.getBlockBoundsMaxZ() < 1) {
|
||||
if(isAirBlock(b)) {
|
||||
|
||||
if(b.isReplaceable(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ)) {
|
||||
if(getAirCount(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ) == 0) {
|
||||
world.setBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, ModBlocks.vacuum);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
world.setBlockToAir(x, y, z);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isAirBlock(Block b) {
|
||||
|
||||
if(b == this)
|
||||
return false;
|
||||
|
||||
return b.getMaterial() == Material.air ||
|
||||
b.getBlockBoundsMinX() > 0 || b.getBlockBoundsMinY() > 0 || b.getBlockBoundsMinZ() > 0 ||
|
||||
b.getBlockBoundsMaxX() < 1 || b.getBlockBoundsMaxY() < 1 || b.getBlockBoundsMaxZ() < 1;
|
||||
}
|
||||
|
||||
private int getAirCount(World world, int x, int y, int z) {
|
||||
|
||||
int air = 0;
|
||||
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
|
||||
Block b = world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
|
||||
|
||||
if(isAirBlock(b))
|
||||
air++;
|
||||
}
|
||||
|
||||
return air;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
|
||||
|
||||
162
src/main/java/com/hbm/blocks/generic/BlockLoot.java
Normal file
162
src/main/java/com/hbm/blocks/generic/BlockLoot.java
Normal file
@ -0,0 +1,162 @@
|
||||
package com.hbm.blocks.generic;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.bomb.TileEntityBombMulti;
|
||||
import com.hbm.util.Tuple.Quartet;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockLoot extends BlockContainer {
|
||||
|
||||
public BlockLoot() {
|
||||
super(Material.iron);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, int x, int y, int z) {
|
||||
super.onBlockAdded(world, x, y, z);
|
||||
|
||||
TileEntityLoot loot = (TileEntityLoot) world.getTileEntity(x, y, z);
|
||||
|
||||
if(loot != null && loot.items.isEmpty()) {
|
||||
|
||||
for(int i = 0; i < 64; i++) {
|
||||
loot.addItem(new ItemStack(ModItems.cigarette), -0.375 + world.rand.nextDouble() * 0.75, world.rand.nextDouble() * 0.0625, -0.375 + world.rand.nextDouble() * 0.75);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.0625F, 1.0F);
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
|
||||
if(world.isRemote) {
|
||||
return true;
|
||||
|
||||
} else if(!player.isSneaking()) {
|
||||
|
||||
TileEntityLoot entity = (TileEntityLoot) world.getTileEntity(x, y, z);
|
||||
if(entity != null) {
|
||||
|
||||
for(Quartet<ItemStack, Double, Double, Double> quartet : entity.items) {
|
||||
player.inventory.addItemStackToInventory(quartet.getW());
|
||||
}
|
||||
|
||||
world.setBlockToAir(x, y, z);
|
||||
player.inventoryContainer.detectAndSendChanges();
|
||||
}
|
||||
return true;
|
||||
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityLoot();
|
||||
}
|
||||
|
||||
public static class TileEntityLoot extends TileEntity {
|
||||
|
||||
public List<Quartet<ItemStack, Double, Double, Double>> items = new ArrayList();
|
||||
|
||||
@Override
|
||||
public boolean canUpdate() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public TileEntityLoot addItem(ItemStack stack, double x, double y, double z) {
|
||||
items.add(new Quartet(stack, x, y, z));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
this.writeToNBT(nbt);
|
||||
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||
this.readFromNBT(pkt.func_148857_g());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
int count = nbt.getInteger("count");
|
||||
|
||||
System.out.println("count");
|
||||
|
||||
for(int i = 0; i < count; i++) {
|
||||
ItemStack stack = ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("item" + i));
|
||||
double x = nbt.getDouble("x" + i);
|
||||
double y = nbt.getDouble("y" + i);
|
||||
double z = nbt.getDouble("z" + i);
|
||||
items.add(new Quartet(stack, x, y, z));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
|
||||
nbt.setInteger("count", items.size());
|
||||
|
||||
for(int i = 0; i < items.size(); i++) {
|
||||
Quartet<ItemStack, Double, Double, Double> item = items.get(i);
|
||||
NBTTagCompound stack = new NBTTagCompound();
|
||||
item.getW().writeToNBT(stack);
|
||||
nbt.setTag("item" + i, stack);
|
||||
nbt.setDouble("x" + i, item.getX());
|
||||
nbt.setDouble("y" + i, item.getY());
|
||||
nbt.setDouble("z" + i, item.getZ());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
32
src/main/java/com/hbm/blocks/generic/BlockTransission.java
Normal file
32
src/main/java/com/hbm/blocks/generic/BlockTransission.java
Normal file
@ -0,0 +1,32 @@
|
||||
package com.hbm.blocks.generic;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockTransission extends Block {
|
||||
|
||||
public BlockTransission(Material mat) {
|
||||
super(mat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
if(world.isRemote) {
|
||||
return true;
|
||||
|
||||
} else if(!player.isSneaking()) {
|
||||
|
||||
if(side == 0) {
|
||||
player.setPositionAndUpdate(x + 0.5, y + 1, z + 0.5);
|
||||
}
|
||||
if(side == 1) {
|
||||
player.setPositionAndUpdate(x + 0.5, y - 2, z + 0.5);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,6 +2,7 @@ package com.hbm.items.tool;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.entity.mob.EntityBlockSpider;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.world.generator.CellularDungeonFactory;
|
||||
@ -31,11 +32,14 @@ public class ItemWandD extends Item {
|
||||
|
||||
//CellularDungeonFactory.meteor.generate(world, x, y, z, world.rand);
|
||||
|
||||
for(int i = x - 10; i <= x + 10; i++) {
|
||||
for(int j = y - 10; j <= y + 10; j++) {
|
||||
for(int k = z - 10; k <= z + 10; k++) {
|
||||
int r = 5;
|
||||
|
||||
for(int i = x - r; i <= x + r; i++) {
|
||||
for(int j = y - r; j <= y + r; j++) {
|
||||
for(int k = z - r; k <= z + r; k++) {
|
||||
|
||||
world.getBlock(i, j, k).updateTick(world, i, j, k, world.rand);
|
||||
world.setBlock(i, j, k, ModBlocks.vacuum);
|
||||
//world.getBlock(i, j, k).updateTick(world, i, j, k, world.rand);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,21 +1,29 @@
|
||||
package com.hbm.lib;
|
||||
|
||||
import com.hbm.world.test.StructureComponentTest;
|
||||
import com.hbm.world.test.StructureStartTest;
|
||||
import com.hbm.world.test.WorldGenTest;
|
||||
|
||||
import cpw.mods.fml.common.IWorldGenerator;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.world.gen.structure.MapGenStructureIO;
|
||||
|
||||
public class HbmWorld {
|
||||
public static void mainRegistry()
|
||||
{
|
||||
|
||||
public static void mainRegistry() {
|
||||
initWorldGen();
|
||||
}
|
||||
|
||||
public static void initWorldGen()
|
||||
{
|
||||
public static void initWorldGen() {
|
||||
|
||||
MapGenStructureIO.registerStructure(StructureStartTest.class, "HFR_STRUCTURE");
|
||||
MapGenStructureIO.func_143031_a(StructureComponentTest.class, "HFR_COMPONENT");
|
||||
|
||||
registerWorldGen(new HbmWorldGen(), 1);
|
||||
//registerWorldGen(new WorldGenTest(), 1);
|
||||
}
|
||||
|
||||
public static void registerWorldGen(HbmWorldGen nukerWorldGen, int weightedProbability)
|
||||
{
|
||||
public static void registerWorldGen(IWorldGenerator nukerWorldGen, int weightedProbability) {
|
||||
GameRegistry.registerWorldGenerator(nukerWorldGen, weightedProbability);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -35,6 +35,7 @@ import java.util.Map.Entry;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.blocks.generic.BlockLoot.TileEntityLoot;
|
||||
import com.hbm.entity.effect.*;
|
||||
import com.hbm.entity.grenade.*;
|
||||
import com.hbm.entity.item.EntityFireworks;
|
||||
@ -111,6 +112,7 @@ public class ClientProxy extends ServerProxy {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityDecoBlockAltW.class, new RenderDecoBlockAlt());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityDecoBlockAltF.class, new RenderDecoBlockAlt());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityDemonLamp.class, new RenderDemonLamp());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityLoot.class, new RenderLoot());
|
||||
//bombs
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityNukeGadget.class, new RenderNukeGadget());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityNukeBoy.class, new RenderNukeBoy());
|
||||
|
||||
69
src/main/java/com/hbm/render/tileentity/RenderLoot.java
Normal file
69
src/main/java/com/hbm/render/tileentity/RenderLoot.java
Normal file
@ -0,0 +1,69 @@
|
||||
package com.hbm.render.tileentity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.blocks.generic.BlockLoot.TileEntityLoot;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.render.util.RenderItemStack;
|
||||
import com.hbm.util.Tuple.Quartet;
|
||||
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class RenderLoot extends TileEntitySpecialRenderer {
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float interp) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x, y, z);
|
||||
|
||||
TileEntityLoot loot = (TileEntityLoot) te;
|
||||
|
||||
for(Quartet<ItemStack, Double, Double, Double> item : loot.items) {
|
||||
|
||||
ItemStack stack = item.getW();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(item.getX(), item.getY(), item.getZ());
|
||||
|
||||
if(stack.getItem() == ModItems.ammo_nuke || stack.getItem() == ModItems.ammo_nuke_low || stack.getItem() == ModItems.ammo_nuke_high || stack.getItem() == ModItems.ammo_nuke_safe) {
|
||||
renderNuke();
|
||||
} else {
|
||||
renderStandardItem(item.getW());
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
private void renderNuke() {
|
||||
GL11.glScaled(0.5, 0.5, 0.5);
|
||||
GL11.glTranslated(1, 0.5, 1);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
bindTexture(ResourceManager.mini_nuke_tex);
|
||||
ResourceManager.projectiles.renderPart("MiniNuke");
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
}
|
||||
|
||||
private void renderStandardItem(ItemStack stack) {
|
||||
GL11.glTranslated(0.25, 0, 0.25);
|
||||
GL11.glScaled(0.5, 0.5, 0.5);
|
||||
GL11.glRotated(90, 1, 0, 0);
|
||||
|
||||
bindTexture(TextureMap.locationItemsTexture);
|
||||
IIcon icon = stack.getIconIndex();
|
||||
float f14 = icon.getMinU();
|
||||
float f15 = icon.getMaxU();
|
||||
float f4 = icon.getMinV();
|
||||
float f5 = icon.getMaxV();
|
||||
ItemRenderer.renderItemIn2D(Tessellator.instance, f15, f4, f14, f5, icon.getIconWidth(), icon.getIconHeight(), 0.0625F);
|
||||
}
|
||||
}
|
||||
@ -2,6 +2,7 @@ package com.hbm.tileentity;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.hbm.blocks.generic.BlockLoot.TileEntityLoot;
|
||||
import com.hbm.tileentity.bomb.*;
|
||||
import com.hbm.tileentity.conductor.*;
|
||||
import com.hbm.tileentity.deco.*;
|
||||
@ -191,6 +192,8 @@ public class TileMappings {
|
||||
map.put(TileEntityMachineOrbus.class, "tileentity_orbus");
|
||||
map.put(TileEntityMachineFractionTower.class, "tileentity_fraction_tower");
|
||||
map.put(TileEntitySpacer.class, "tileentity_fraction_spacer");
|
||||
|
||||
map.put(TileEntityLoot.class, "tileentity_ntm_loot");
|
||||
|
||||
putBombs();
|
||||
putTurrets();
|
||||
|
||||
23
src/main/java/com/hbm/world/test/MapGenTest.java
Normal file
23
src/main/java/com/hbm/world/test/MapGenTest.java
Normal file
@ -0,0 +1,23 @@
|
||||
package com.hbm.world.test;
|
||||
|
||||
import net.minecraft.world.gen.structure.MapGenStructure;
|
||||
import net.minecraft.world.gen.structure.StructureStart;
|
||||
|
||||
public class MapGenTest extends MapGenStructure {
|
||||
|
||||
@Override
|
||||
public String func_143025_a() {
|
||||
return "HFR_TEST";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canSpawnStructureAtCoords(int x, int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected StructureStart getStructureStart(int x, int z) {
|
||||
return new StructureStartTest(worldObj, rand, x, z);
|
||||
}
|
||||
|
||||
}
|
||||
37
src/main/java/com/hbm/world/test/StructureComponentTest.java
Normal file
37
src/main/java/com/hbm/world/test/StructureComponentTest.java
Normal file
@ -0,0 +1,37 @@
|
||||
package com.hbm.world.test;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.structure.StructureBoundingBox;
|
||||
import net.minecraft.world.gen.structure.StructureComponent;
|
||||
|
||||
public class StructureComponentTest extends StructureComponent {
|
||||
|
||||
public StructureComponentTest(int x, int z) {
|
||||
this.boundingBox = new StructureBoundingBox(x, 64, z, x + 4, 64 + 9, z + 4);
|
||||
}
|
||||
|
||||
|
||||
//write
|
||||
@Override
|
||||
protected void func_143012_a(NBTTagCompound nbt) {
|
||||
|
||||
}
|
||||
|
||||
//read
|
||||
@Override
|
||||
protected void func_143011_b(NBTTagCompound nbt) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addComponentParts(World world, Random rand, StructureBoundingBox boundingbox) {
|
||||
System.out.println("aaaaaaa");
|
||||
this.fillWithBlocks(world, boundingbox, 0, 0, 0, 4, 9, 4, Blocks.sandstone, Blocks.air, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
15
src/main/java/com/hbm/world/test/StructureStartTest.java
Normal file
15
src/main/java/com/hbm/world/test/StructureStartTest.java
Normal file
@ -0,0 +1,15 @@
|
||||
package com.hbm.world.test;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.structure.StructureStart;
|
||||
|
||||
public class StructureStartTest extends StructureStart {
|
||||
|
||||
public StructureStartTest(World world, Random rand, int x, int z) {
|
||||
System.out.println("StructureStartTest");
|
||||
this.components.add(new StructureComponentTest(x, z));
|
||||
this.updateBoundingBox();
|
||||
}
|
||||
}
|
||||
20
src/main/java/com/hbm/world/test/WorldGenTest.java
Normal file
20
src/main/java/com/hbm/world/test/WorldGenTest.java
Normal file
@ -0,0 +1,20 @@
|
||||
package com.hbm.world.test;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import cpw.mods.fml.common.IWorldGenerator;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
|
||||
public class WorldGenTest implements IWorldGenerator {
|
||||
|
||||
static MapGenTest gen = new MapGenTest();
|
||||
|
||||
@Override
|
||||
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
|
||||
gen.func_151539_a(chunkGenerator, world, chunkX, chunkZ, new Block[0]);
|
||||
gen.generateStructuresInChunk(world, random, chunkX, chunkZ);
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 214 B |
Binary file not shown.
|
After Width: | Height: | Size: 235 B |
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
Loading…
x
Reference in New Issue
Block a user