mirror of
https://github.com/GTNewHorizons/ThaumicTinkerer.git
synced 2026-11-28 16:06:07 +00:00
Removed bedrock block, kept dimension
This commit is contained in:
1 parent
8ff6b33b41
commit
f94a1b251c
10 files changed
+78
-103
No files matched your search
@@ -17,6 +17,7 @@ package vazkii.tinkerer.common.block;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.block.Block;
|
||||
import vazkii.tinkerer.common.block.kami.BlockBedrockPortal;
|
||||
import vazkii.tinkerer.common.block.kami.BlockWarpGate;
|
||||
import vazkii.tinkerer.common.block.mobilizer.BlockMobilizer;
|
||||
import vazkii.tinkerer.common.block.mobilizer.BlockMobilizerRelay;
|
||||
@@ -36,7 +37,6 @@ import vazkii.tinkerer.common.item.kami.ItemBlockWarpGate;
|
||||
import vazkii.tinkerer.common.item.quartz.ItemDarkQuartzBlock;
|
||||
import vazkii.tinkerer.common.item.quartz.ItemDarkQuartzSlab;
|
||||
import vazkii.tinkerer.common.lib.LibBlockNames;
|
||||
import vazkii.tinkerer.common.lib.LibItemNames;
|
||||
|
||||
public final class ModBlocks {
|
||||
|
||||
@@ -63,7 +63,7 @@ public final class ModBlocks {
|
||||
|
||||
public static Block mobilizer;
|
||||
|
||||
public static Block bedrock;
|
||||
//public static Block bedrock;
|
||||
|
||||
|
||||
public static Block portal;
|
||||
@@ -115,7 +115,7 @@ public final class ModBlocks {
|
||||
e.printStackTrace();
|
||||
}
|
||||
*/
|
||||
//portal = new BlockBedrockPortal().setBlockName(LibBlockNames.PORTAL);
|
||||
portal = new BlockBedrockPortal().setBlockName(LibBlockNames.PORTAL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ public final class ModBlocks {
|
||||
//if(ConfigHandler.bedrockDimensionID != 0) {
|
||||
// GameRegistry.registerBlock(bedrock, LanguageRegistry.instance().getStringLocalization("bedrock"));
|
||||
|
||||
// GameRegistry.registerBlock(portal, LibBlockNames.PORTAL);
|
||||
GameRegistry.registerBlock(portal, LibBlockNames.PORTAL);
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
package vazkii.tinkerer.common.block.kami;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.tinkerer.common.block.ModBlocks;
|
||||
import vazkii.tinkerer.common.dim.WorldProviderBedrock;
|
||||
import vazkii.tinkerer.common.item.kami.tool.ItemIchorPickAdv;
|
||||
import vazkii.tinkerer.common.lib.LibBlockIDs;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockBedrockKAMI extends Block {
|
||||
|
||||
public BlockBedrockKAMI() {
|
||||
super(Material.rock);
|
||||
//Block.blocksList[7]=this;
|
||||
setStepSound(Block.soundTypeStone);
|
||||
setResistance(6000000.0F);
|
||||
disableStats();
|
||||
setCreativeTab(CreativeTabs.tabBlock);
|
||||
setBlockUnbreakable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void harvestBlock(World world, EntityPlayer entityPlayer, int par3, int par4, int par5, int par6) {
|
||||
if((world.provider.isSurfaceWorld() && par4<5) || (world.provider instanceof WorldProviderBedrock && par4>253)){
|
||||
if(entityPlayer.inventory.getCurrentItem() != null && entityPlayer.inventory.getCurrentItem().getItem() instanceof ItemIchorPickAdv){
|
||||
world.setBlock(par3, par4, par5, ModBlocks.portal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the quantity of items to drop on block destruction.
|
||||
*/
|
||||
public int quantityDropped(Random par1Random)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int idDropped(Random par1Random)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public float getBlockHardness(World par1World, int par2, int par3, int par4) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity entity) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getPlayerRelativeBlockHardness(EntityPlayer entityPlayer, World world, int par3, int par4, int par5) {
|
||||
if((world.provider.isSurfaceWorld() && par4<5) || (world.provider instanceof WorldProviderBedrock && par4>1)){
|
||||
if(entityPlayer.inventory.getCurrentItem() != null && entityPlayer.inventory.getCurrentItem().getItem() instanceof ItemIchorPickAdv){
|
||||
return 5F;
|
||||
}
|
||||
}
|
||||
return super.getPlayerRelativeBlockHardness(entityPlayer, world, par3, par4, par5);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
return new ArrayList<ItemStack>();
|
||||
}
|
||||
}
|
||||
@@ -21,20 +21,18 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import vazkii.tinkerer.client.core.helper.IconHelper;
|
||||
import vazkii.tinkerer.common.ThaumicTinkerer;
|
||||
import vazkii.tinkerer.common.block.ModBlocks;
|
||||
import vazkii.tinkerer.common.block.tile.kami.TileBedrockPortal;
|
||||
import vazkii.tinkerer.common.core.handler.ConfigHandler;
|
||||
import vazkii.tinkerer.common.core.handler.ModCreativeTab;
|
||||
import vazkii.tinkerer.common.dim.TeleporterBedrock;
|
||||
import vazkii.tinkerer.common.dim.WorldProviderBedrock;
|
||||
import vazkii.tinkerer.common.lib.LibBlockIDs;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockBedrockPortal extends Block {
|
||||
|
||||
public BlockBedrockPortal(int id) {
|
||||
public BlockBedrockPortal() {
|
||||
super(Material.portal);
|
||||
setStepSound(Block.soundTypeStone);
|
||||
setResistance(6000000.0F);
|
||||
|
||||
@@ -77,6 +77,7 @@ public class ModCreativeTab extends CreativeTabs {
|
||||
addBlock(ModBlocks.platform);
|
||||
addBlock(ModBlocks.repairer);
|
||||
addBlock(ModBlocks.magnet);
|
||||
addBlock(ModBlocks.portal);
|
||||
addItem(ModItems.soulMould);
|
||||
addBlock(ModBlocks.animationTablet);
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package vazkii.tinkerer.common.core.handler.kami;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import vazkii.tinkerer.common.item.kami.tool.ItemIchorPickAdv;
|
||||
|
||||
/**
|
||||
* Created by Katrina on 31/03/14.
|
||||
*/
|
||||
public class KamiDimensionHandler {
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void onInteract(PlayerInteractEvent event)
|
||||
{
|
||||
if(event.action== PlayerInteractEvent.Action.LEFT_CLICK_BLOCK) {
|
||||
ItemStack stack = event.entityPlayer.getCurrentEquippedItem();
|
||||
if(event.entityPlayer.worldObj.getBlock(event.x,event.y,event.z)== Blocks.bedrock)
|
||||
{
|
||||
if(stack.getItem() instanceof ItemIchorPickAdv)
|
||||
{
|
||||
((ItemIchorPickAdv)stack.getItem()).onBlockStartBreak(stack,event.x,event.y,event.z,event.entityPlayer);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,12 +24,14 @@ import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import li.cil.oc.api.Driver;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import vazkii.tinkerer.common.ThaumicTinkerer;
|
||||
import vazkii.tinkerer.common.block.ModBlocks;
|
||||
import vazkii.tinkerer.common.block.tile.peripheral.OpenComputers.DriverIAspectContainer;
|
||||
import vazkii.tinkerer.common.core.handler.ConfigHandler;
|
||||
import vazkii.tinkerer.common.core.handler.kami.DimensionalShardDropHandler;
|
||||
import vazkii.tinkerer.common.core.handler.kami.KamiArmorHandler;
|
||||
import vazkii.tinkerer.common.core.handler.kami.KamiDimensionHandler;
|
||||
import vazkii.tinkerer.common.core.handler.kami.SoulHeartHandler;
|
||||
import vazkii.tinkerer.common.core.helper.NumericAspectHelper;
|
||||
import vazkii.tinkerer.common.enchantment.ModEnchantments;
|
||||
@@ -71,8 +73,9 @@ public class TTCommonProxy {
|
||||
|
||||
|
||||
if(ConfigHandler.enableKami) {
|
||||
FMLCommonHandler.instance().bus().register(new DimensionalShardDropHandler());
|
||||
FMLCommonHandler.instance().bus().register(new SoulHeartHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new DimensionalShardDropHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new KamiDimensionHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new SoulHeartHandler());
|
||||
}
|
||||
if(Loader.isModLoaded("OpenComputers"))
|
||||
{
|
||||
|
||||
@@ -14,7 +14,6 @@ import net.minecraft.world.gen.FlatLayerInfo;
|
||||
import net.minecraft.world.gen.feature.WorldGenLakes;
|
||||
import net.minecraft.world.gen.structure.MapGenStronghold;
|
||||
import net.minecraft.world.gen.structure.MapGenStructure;
|
||||
import vazkii.tinkerer.common.block.ModBlocks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
@@ -39,7 +38,7 @@ public class ChunkProviderBedrock implements IChunkProvider {
|
||||
this.random = new Random(par2);
|
||||
generator = new OreClusterGenerator();
|
||||
|
||||
FlatLayerInfo flatlayerinfo = new FlatLayerInfo(256, ModBlocks.bedrock);
|
||||
FlatLayerInfo flatlayerinfo = new FlatLayerInfo(256, Blocks.bedrock);
|
||||
|
||||
for (int j = flatlayerinfo.getMinY(); j < flatlayerinfo.getMinY() + flatlayerinfo.getLayerCount(); ++j) {
|
||||
this.cachedBlockIDs[j] = (byte) (Block.getIdFromBlock(flatlayerinfo.func_151536_b()) & 255);
|
||||
|
||||
@@ -2,13 +2,13 @@ package vazkii.tinkerer.common.dim;
|
||||
|
||||
import cpw.mods.fml.common.IWorldGenerator;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
import net.minecraft.world.gen.feature.WorldGenMinable;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import vazkii.tinkerer.common.block.ModBlocks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -32,7 +32,7 @@ public class OreClusterGenerator implements IWorldGenerator{
|
||||
ItemStack itemStack = oreIds.get(random.nextInt(oreIds.size()));
|
||||
for(int l=0; l<200; l++){
|
||||
int firstBlockYCoord = random.nextInt(245)+6;
|
||||
WorldGenMinable mineable = new WorldGenMinable(Block.getBlockFromItem(itemStack.getItem()),itemStack.getItemDamage(), random.nextInt(20), ModBlocks.bedrock);
|
||||
WorldGenMinable mineable = new WorldGenMinable(Block.getBlockFromItem(itemStack.getItem()),itemStack.getItemDamage(), random.nextInt(20), Blocks.bedrock);
|
||||
mineable.generate(world, random, firstBlockXCoord, firstBlockYCoord, firstBlockZCoord);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,9 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import vazkii.tinkerer.client.core.handler.kami.ToolModeHUDHandler;
|
||||
import vazkii.tinkerer.client.core.helper.IconHelper;
|
||||
import vazkii.tinkerer.common.block.ModBlocks;
|
||||
import vazkii.tinkerer.common.core.handler.ConfigHandler;
|
||||
import vazkii.tinkerer.common.dim.WorldProviderBedrock;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -61,7 +64,22 @@ public class ItemIchorPickAdv extends ItemIchorPick implements IAdvancedTool {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public float func_150893_a(ItemStack p_150893_1_, Block p_150893_2_) {
|
||||
return (p_150893_2_==Blocks.bedrock)?Float.MAX_VALUE: super.func_150893_a(p_150893_1_, p_150893_2_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDigSpeed(ItemStack stack, Block block, int meta) {
|
||||
return (block==Blocks.bedrock)?Float.MAX_VALUE:super.getDigSpeed(stack, block, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean func_150897_b(Block p_150897_1_) {
|
||||
return ( p_150897_1_==Blocks.bedrock)?true: super.func_150897_b(p_150897_1_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player) {
|
||||
World world = player.worldObj;
|
||||
Material mat = world.getBlock(x, y, z).getMaterial();
|
||||
@@ -77,7 +95,14 @@ public class ItemIchorPickAdv extends ItemIchorPick implements IAdvancedTool {
|
||||
ForgeDirection direction = ForgeDirection.getOrientation(block.sideHit);
|
||||
int fortune = EnchantmentHelper.getFortuneModifier(player);
|
||||
boolean silk = EnchantmentHelper.getSilkTouchModifier(player);
|
||||
|
||||
if(ConfigHandler.bedrockDimensionID != 0 && blk== Blocks.bedrock && ((world.provider.isSurfaceWorld() && y<5) || (y>253 && world.provider instanceof WorldProviderBedrock)))
|
||||
{
|
||||
world.setBlock(x,y,z, ModBlocks.portal);
|
||||
}
|
||||
if(ConfigHandler.bedrockDimensionID!=0 && blk==Blocks.bedrock && (y<=253 && world.provider instanceof WorldProviderBedrock))
|
||||
{
|
||||
world.setBlock(x,y,z,Blocks.air);
|
||||
}
|
||||
switch(ToolHandler.getMode(stack)) {
|
||||
case 0 : break;
|
||||
case 1 : {
|
||||
@@ -86,9 +111,7 @@ public class ItemIchorPickAdv extends ItemIchorPick implements IAdvancedTool {
|
||||
boolean doZ = direction.offsetZ == 0;
|
||||
|
||||
ToolHandler.removeBlocksInIteration(player, world, x, y, z, doX ? -2 : 0, doY ? -1 : 0, doZ ? -2 : 0, doX ? 3 : 1, doY ? 4 : 1, doZ ? 3 : 1, null, ToolHandler.materialsPick, silk, fortune);
|
||||
if(blk== Blocks.bedrock){
|
||||
world.setBlock(x, y, z, Blocks.bedrock);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 2 : {
|
||||
@@ -97,9 +120,6 @@ public class ItemIchorPickAdv extends ItemIchorPick implements IAdvancedTool {
|
||||
int zo = -direction.offsetZ;
|
||||
|
||||
ToolHandler.removeBlocksInIteration(player, world, x, y, z, xo >= 0 ? 0 : -10, yo >= 0 ? 0 : -10, zo >= 0 ? 0 : -10, xo > 0 ? 10 : 1, yo > 0 ? 10 : 1, zo > 0 ? 10 : 1, null, ToolHandler.materialsPick, silk, fortune);
|
||||
if(blk== Blocks.bedrock){
|
||||
world.setBlock(x, y, z, Blocks.bedrock);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ public final class ToolHandler {
|
||||
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
Material mat = world.getBlock(x, y, z).getMaterial();
|
||||
if(blk != null && !blk.isAir(world, x, y, z) && (blk.getPlayerRelativeBlockHardness(player, world, x, y, z) != 0)) {
|
||||
if(blk != null && !blk.isAir(world, x, y, z) && ((blk.getPlayerRelativeBlockHardness(player, world, x, y, z) != 0 || (blk==Blocks.bedrock && (y<=253 && world.provider instanceof WorldProviderBedrock)) ))) {
|
||||
List<ItemStack> items = new ArrayList();
|
||||
|
||||
if(!blk.canHarvestBlock(player, meta) || !isRightMaterial(mat, materialsListing))
|
||||
@@ -93,7 +93,11 @@ public final class ToolHandler {
|
||||
if(ConfigHandler.bedrockDimensionID != 0 && block== Blocks.bedrock && ((world.provider.isSurfaceWorld() && y<5) || (y>253 && world.provider instanceof WorldProviderBedrock))){
|
||||
world.setBlock(x, y, z, ModBlocks.portal);
|
||||
}
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
if(ConfigHandler.bedrockDimensionID != 0 && world.provider.dimensionId==ConfigHandler.bedrockDimensionID&& blk==Blocks.bedrock && y<=253)
|
||||
{
|
||||
world.setBlock(x,y,z,Blocks.air);
|
||||
}
|
||||
if (!player.capabilities.isCreativeMode && blk!=Blocks.bedrock) {
|
||||
int localMeta = world.getBlockMetadata(x, y, z);
|
||||
if (blk.removedByPlayer(world, player, x, y, z)) {
|
||||
blk.onBlockDestroyedByPlayer(world, x, y, z, localMeta);
|
||||
|
||||
Reference in new issue
Block a user