Fix building

This commit is contained in:
modmuss50 2016-03-14 07:51:34 +00:00
parent d66315ae2c
commit 4cf4be51c8
4 changed files with 198 additions and 259 deletions

View file

@ -0,0 +1,65 @@
package techreborn.blocks.storage;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.blocks.IRotationTexture;
import techreborn.Core;
import techreborn.client.GuiHandler;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.TileAesu;
public class BlockAESU extends BlockMachineBase implements IRotationTexture {
public BlockAESU(Material material) {
super();
setUnlocalizedName("techreborn.aesu");
setCreativeTab(TechRebornCreativeTab.instance);
}
@Override
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
return new TileAesu();
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z,
EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.aesuID, world, x, y,
z);
return true;
}
private final String prefix = "techreborn:blocks/machine/storage/";
@Override
public String getFrontOff() {
return prefix + "aesu_front";
}
@Override
public String getFrontOn() {
return prefix + "aesu_front";
}
@Override
public String getSide() {
return prefix + "aesu_side";
}
@Override
public String getTop() {
return prefix + "aesu_side";
}
@Override
public String getBottom() {
return prefix + "aesu_side";
}
}

View file

@ -0,0 +1,61 @@
package techreborn.blocks.storage;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.blocks.IAdvancedRotationTexture;
import techreborn.Core;
import techreborn.client.GuiHandler;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.lesu.TileLesu;
public class BlockLESU extends BlockMachineBase implements IAdvancedRotationTexture {
public BlockLESU(Material material) {
super();
setUnlocalizedName("techreborn.lesu");
setCreativeTab(TechRebornCreativeTab.instance);
}
@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
return new TileLesu();
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z,
EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.lesuID, world, x, y,
z);
return true;
}
private final String prefix = "techreborn:blocks/machine/storage/";
@Override
public String getFront(boolean isActive) {
return prefix + "lesu_front";
}
@Override
public String getSide(boolean isActive) {
return prefix + "lesu_side" ;
}
@Override
public String getTop(boolean isActive) {
return prefix + "lesu_side";
}
@Override
public String getBottom(boolean isActive) {
return prefix + "lesu_side";
}
}

View file

@ -0,0 +1,72 @@
package techreborn.blocks.storage;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.blocks.IAdvancedRotationTexture;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.lesu.TileLesuStorage;
public class BlockLESUStorage extends BlockMachineBase implements IAdvancedRotationTexture {
public BlockLESUStorage(Material material) {
super();
setUnlocalizedName("techreborn.lesustorage");
setCreativeTab(TechRebornCreativeTab.instance);
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemstack) {
super.onBlockPlacedBy(world, x, y, z, player, itemstack);
if (world.getTileEntity(new BlockPos(x, y, z)) instanceof TileLesuStorage) {
((TileLesuStorage) world.getTileEntity(new BlockPos(x, y, z))).rebuildNetwork();
}
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
if (world.getTileEntity(new BlockPos(x, y, z)) instanceof TileLesuStorage) {
((TileLesuStorage) world.getTileEntity(new BlockPos(x, y, z))).removeFromNetwork();
}
super.breakBlock(world, x, y, z, block, meta);
}
@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
return new TileLesuStorage();
}
public boolean shouldConnectToBlock(IBlockAccess blockAccess, int x, int y, int z, Block block, int meta) {
return block == (Block) this;
}
private final String prefix = "techreborn:blocks/machine/storage/";
@Override
public String getFront(boolean isActive) {
return prefix + "lesu_block";
}
@Override
public String getSide(boolean isActive) {
return prefix + "lesu_block" ;
}
@Override
public String getTop(boolean isActive) {
return prefix + "lesu_block";
}
@Override
public String getBottom(boolean isActive) {
return prefix + "lesu_block";
}
}

View file

@ -1,259 +0,0 @@
package techreborn.world;
import java.util.Random;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import net.minecraftforge.fml.common.IWorldGenerator;
import techreborn.Core;
import techreborn.config.ConfigTechReborn;
import techreborn.init.ModBlocks;
public class TROreGen implements IWorldGenerator {
public static ConfigTechReborn config;
WorldGenMinable oreGalena;
WorldGenMinable oreIridium;
WorldGenMinable oreRuby;
WorldGenMinable oreSapphire;
WorldGenMinable oreBauxite;
WorldGenMinable orePyrite;
WorldGenMinable oreCinnabar;
WorldGenMinable oreSphalerite;
WorldGenMinable oreTungston;
WorldGenMinable oreSheldonite;
WorldGenMinable orePeridot;
WorldGenMinable oreSodalite;
WorldGenMinable oreTetrahedrite;
WorldGenMinable oreCassiterite;
WorldGenMinable oreLead;
WorldGenMinable oreSilver;
WorldGenMinable oreCopper;
WorldGenMinable oreTin;
public TROreGen() {
// World
oreGalena = new WorldGenMinable(ModBlocks.ore.getBlockStateFromName("Galena"), ConfigTechReborn.GalenaOreRare);
oreIridium = new WorldGenMinable(ModBlocks.ore.getBlockStateFromName("Iridium"), ConfigTechReborn.IridiumOreRare);
oreRuby = new WorldGenMinable(ModBlocks.ore.getBlockStateFromName("Ruby"), ConfigTechReborn.RubyOreRare);
oreSapphire = new WorldGenMinable(ModBlocks.ore.getBlockStateFromName("Sapphire"), ConfigTechReborn.SapphireOreRare);
oreBauxite = new WorldGenMinable(ModBlocks.ore.getBlockStateFromName("Bauxite"), ConfigTechReborn.BauxiteOreRare);
oreTetrahedrite = new WorldGenMinable(ModBlocks.ore.getBlockStateFromName("Tetrahedrite"), ConfigTechReborn.TetrahedriteOreRare);
oreCassiterite = new WorldGenMinable(ModBlocks.ore.getBlockStateFromName("Cassiterite"), ConfigTechReborn.CassiteriteOreRare);
oreLead = new WorldGenMinable(ModBlocks.ore.getBlockStateFromName("Lead"), ConfigTechReborn.LeadOreRare);
oreSilver = new WorldGenMinable(ModBlocks.ore.getBlockStateFromName("Silver"), ConfigTechReborn.SilverOreRare);
oreCopper = new WorldGenMinable(ModBlocks.ore2.getBlockStateFromName("copper"), ConfigTechReborn.CopperOreRare);
oreTin = new WorldGenMinable(ModBlocks.ore2.getBlockStateFromName("tin"), ConfigTechReborn.TinOreRare);
// Nether
orePyrite = new WorldGenMinable(ModBlocks.ore.getBlockStateFromName("Pyrite"), ConfigTechReborn.PyriteOreRare);
oreCinnabar = new WorldGenMinable(ModBlocks.ore.getBlockStateFromName("Cinnabar"), ConfigTechReborn.CinnabarOreRare);
oreSphalerite = new WorldGenMinable(ModBlocks.ore.getBlockStateFromName("Sphalerite"), ConfigTechReborn.SphaleriteOreRare);
// End
oreTungston = new WorldGenMinable(ModBlocks.ore.getBlockStateFromName("Tungston"), ConfigTechReborn.TungstenOreRare);
oreSheldonite = new WorldGenMinable(ModBlocks.ore.getBlockStateFromName("Sheldonite"), ConfigTechReborn.SheldoniteOreRare);
orePeridot = new WorldGenMinable(ModBlocks.ore.getBlockStateFromName("Peridot"), ConfigTechReborn.PeridotOreRare);
oreSodalite = new WorldGenMinable(ModBlocks.ore.getBlockStateFromName("Sodalite"), ConfigTechReborn.SodaliteOreRare);
Core.logHelper.info("WorldGen Loaded");
}
public void retroGen(Random random, int chunkX, int chunkZ, World world) {
//TODO
generateUndergroundOres(random, chunkX, chunkZ, world);
generateHellOres(random, chunkX, chunkZ, world);
generateEndOres(random, chunkX, chunkZ, world);
world.getChunkFromChunkCoords(chunkX, chunkZ).setChunkModified();
}
@Override
public void generate(Random random, int xChunk, int zChunk, World world,
IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
if (world.provider.isSurfaceWorld()) {
generateUndergroundOres(random, xChunk * 16, zChunk * 16, world);
} else if (world.provider.getDimensionId() == 0) {
generateHellOres(random, xChunk * 16, zChunk * 16, world);
} else if (world.provider.getDimensionId() == 1) {
generateEndOres(random, xChunk * 16, zChunk * 16, world);
}
}
void generateUndergroundOres(Random random, int xChunk, int zChunk, World world) {
int xPos, yPos, zPos;
if (config.GalenaOreTrue) {
for (int i = 0; i <= 16; i++) {
xPos = xChunk + random.nextInt(16);
yPos = 10 + random.nextInt(60 - 10);
zPos = zChunk + random.nextInt(16);
BlockPos pos = new BlockPos(xPos, yPos, zPos);
oreGalena.generate(world, random, pos);
}
}
if (config.IridiumOreTrue) {
for (int i = 0; i <= 1; i++) {
xPos = xChunk + random.nextInt(16);
yPos = 10 + random.nextInt(60 - 10);
zPos = zChunk + random.nextInt(1);
BlockPos pos = new BlockPos(xPos, yPos, zPos);
oreIridium.generate(world, random, pos);
}
}
if (config.RubyOreTrue) {
for (int i = 0; i <= 3; i++) {
xPos = xChunk + random.nextInt(16);
yPos = 10 + random.nextInt(60 - 10);
zPos = zChunk + random.nextInt(16);
BlockPos pos = new BlockPos(xPos, yPos, zPos);
oreRuby.generate(world, random, pos);
}
}
if (config.SapphireOreTrue) {
for (int i = 0; i <= 3; i++) {
xPos = xChunk + random.nextInt(16);
yPos = 10 + random.nextInt(60 - 10);
zPos = zChunk + random.nextInt(16);
BlockPos pos = new BlockPos(xPos, yPos, zPos);
oreSapphire.generate(world, random, pos);
}
}
if (config.BauxiteOreTrue) {
for (int i = 0; i <= 10; i++) {
xPos = xChunk + random.nextInt(16);
yPos = 10 + random.nextInt(60 - 10);
zPos = zChunk + random.nextInt(16);
BlockPos pos = new BlockPos(xPos, yPos, zPos);
oreBauxite.generate(world, random, pos);
}
}
if (config.TetrahedriteOreTrue) {
for (int i = 0; i <= 16; i++) {
xPos = xChunk + random.nextInt(16);
yPos = 10 + random.nextInt(60 - 10);
zPos = zChunk + random.nextInt(16);
BlockPos pos = new BlockPos(xPos, yPos, zPos);
oreTetrahedrite.generate(world, random, pos);
}
}
if (config.CassiteriteOreTrue) {
for (int i = 0; i <= 16; i++) {
xPos = xChunk + random.nextInt(16);
yPos = 10 + random.nextInt(60 - 20);
zPos = zChunk + random.nextInt(16);
BlockPos pos = new BlockPos(xPos, yPos, zPos);
oreCassiterite.generate(world, random, pos);
}
}
if (config.LeadOreTrue) {
for (int i = 0; i <= 16; i++) {
xPos = xChunk + random.nextInt(16);
yPos = 10 + random.nextInt(60 - 20);
zPos = zChunk + random.nextInt(16);
BlockPos pos = new BlockPos(xPos, yPos, zPos);
oreLead.generate(world, random, pos);
}
}
if (config.SilverOreTrue) {
for (int i = 0; i <= 16; i++) {
xPos = xChunk + random.nextInt(16);
yPos = 10 + random.nextInt(60 - 20);
zPos = zChunk + random.nextInt(16);
BlockPos pos = new BlockPos(xPos, yPos, zPos);
oreSilver.generate(world, random, pos);
}
}
if (config.CopperOreTrue) {
for (int i = 0; i <= 16; i++) {
xPos = xChunk + random.nextInt(16);
yPos = 10 + random.nextInt(60 - 20);
zPos = zChunk + random.nextInt(16);
BlockPos pos = new BlockPos(xPos, yPos, zPos);
oreCopper.generate(world, random, pos);
}
}
if (config.TinOreTrue) {
for (int i = 0; i <= 16; i++) {
xPos = xChunk + random.nextInt(16);
yPos = 10 + random.nextInt(60 - 20);
zPos = zChunk + random.nextInt(16);
BlockPos pos = new BlockPos(xPos, yPos, zPos);
oreTin.generate(world, random, pos);
}
}
}
void generateHellOres(Random random, int xChunk, int zChunk, World world) {
int xPos, yPos, zPos;
if (config.PyriteOreTrue) {
for (int i = 0; i <= 16; i++) {
xPos = xChunk + random.nextInt(16);
yPos = 10 + random.nextInt(60 - 10);
zPos = zChunk + random.nextInt(16);
BlockPos pos = new BlockPos(xPos, yPos, zPos);
orePyrite.generate(world, random, pos);
}
}
if (config.CinnabarOreTrue) {
for (int i = 0; i <= 16; i++) {
xPos = xChunk + random.nextInt(16);
yPos = 10 + random.nextInt(60 - 10);
zPos = zChunk + random.nextInt(16);
BlockPos pos = new BlockPos(xPos, yPos, zPos);
oreCinnabar.generate(world, random, pos);
}
}
if (config.SphaleriteOreTrue) {
for (int i = 0; i <= 16; i++) {
xPos = xChunk + random.nextInt(16);
yPos = 10 + random.nextInt(60 - 10);
zPos = zChunk + random.nextInt(16);
BlockPos pos = new BlockPos(xPos, yPos, zPos);
oreSphalerite.generate(world, random, pos);
}
}
}
void generateEndOres(Random random, int xChunk, int zChunk, World world) {
int xPos, yPos, zPos;
if (config.TungstenOreTrue) {
for (int i = 0; i <= 2; i++) {
xPos = xChunk + random.nextInt(16);
yPos = 10 + random.nextInt(60 - 10);
zPos = zChunk + random.nextInt(16);
BlockPos pos = new BlockPos(xPos, yPos, zPos);
oreTungston.generate(world, random, pos);
}
}
if (config.SheldoniteOreTrue) {
for (int i = 0; i <= 3; i++) {
xPos = xChunk + random.nextInt(16);
yPos = 10 + random.nextInt(60 - 10);
zPos = zChunk + random.nextInt(16);
BlockPos pos = new BlockPos(xPos, yPos, zPos);
oreSheldonite.generate(world, random, pos);
}
}
if (config.PeridotOreTrue) {
for (int i = 0; i <= 3; i++) {
xPos = xChunk + random.nextInt(16);
yPos = 10 + random.nextInt(60 - 10);
zPos = zChunk + random.nextInt(16);
BlockPos pos = new BlockPos(xPos, yPos, zPos);
orePeridot.generate(world, random, pos);
}
}
if (config.SodaliteOreTrue) {
for (int i = 0; i <= 3; i++) {
xPos = xChunk + random.nextInt(16);
yPos = 10 + random.nextInt(60 - 10);
zPos = zChunk + random.nextInt(16);
BlockPos pos = new BlockPos(xPos, yPos, zPos);
oreSodalite.generate(world, random, pos);
}
}
}
}