add slabs

This commit is contained in:
PetaByteBoy 2015-05-23 15:02:29 +02:00
parent 858f73c439
commit c00962b044
8 changed files with 341 additions and 0 deletions

View file

@ -77,6 +77,22 @@ public interface IBlocks
IBlockDefinition quartzPillarStair(); IBlockDefinition quartzPillarStair();
IBlockDefinition skyStoneSlab();
IBlockDefinition skyStoneBlockSlab();
IBlockDefinition skyStoneBrickSlab();
IBlockDefinition skyStoneSmallBrickSlab();
IBlockDefinition fluixSlab();
IBlockDefinition quartzSlab();
IBlockDefinition chiseledQuartzSlab();
IBlockDefinition quartzPillarSlab();
/* /*
* misc * misc
*/ */

View file

@ -0,0 +1,12 @@
package appeng.block;
import net.minecraft.block.Block;
import net.minecraft.item.ItemSlab;
public class AEBaseItemBlockSlab extends ItemSlab {
public AEBaseItemBlockSlab(Block block, AEBaseSlabBlock singleSlab, AEBaseSlabBlock doubleSlab, Boolean isDoubleSlab)
{
super( block, singleSlab, doubleSlab, isDoubleSlab );
}
}

View file

@ -0,0 +1,129 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.block;
import java.util.EnumSet;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockSlab;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import appeng.core.features.AEFeature;
import appeng.core.features.IAEFeature;
import appeng.core.features.IFeatureHandler;
import appeng.core.features.SlabBlockFeatureHandler;
public class AEBaseSlabBlock extends BlockSlab implements IAEFeature
{
private final IFeatureHandler features;
private final AEBaseBlock block;
private final int meta;
private AEBaseSlabBlock slabs;
private AEBaseSlabBlock doubleSlabs;
private final String name;
public AEBaseSlabBlock( AEBaseBlock block, int meta, EnumSet<AEFeature> features, boolean isDoubleSlab, String name )
{
super( isDoubleSlab, block.getMaterial() );
this.block = block;
this.meta = meta;
this.name = name;
this.setBlockName( "appliedenergistics2." + name );
this.setHardness( block.getBlockHardness( null, 0, 0, 0 ) );
this.setResistance( block.getExplosionResistance( null ) * 5.0F / 3.0F );
this.setStepSound( block.stepSound );
this.useNeighborBrightness = true;
if (!field_150004_a) this.doubleSlabs = new AEBaseSlabBlock( block, meta, features, true, name + ".double" ).setSlabs(this);
this.features = !field_150004_a ? new SlabBlockFeatureHandler( features, this ) : null;
}
public AEBaseSlabBlock setSlabs(AEBaseSlabBlock slabs)
{
this.slabs = slabs;
return this;
}
public AEBaseSlabBlock slabs()
{
return slabs;
}
public AEBaseSlabBlock doubleSlabs()
{
return doubleSlabs;
}
@Override
public IFeatureHandler handler()
{
return this.features;
}
@Override
public void postInit()
{
// Override to do stuff
}
@Override
public IIcon getIcon(int dir, int meta)
{
return block.getIcon( dir, this.meta );
}
@Override
public String func_150002_b(int p_150002_1_)
{
return this.getUnlocalizedName();
}
@Override
public void registerBlockIcons(IIconRegister reg) { }
@Override
public Item getItemDropped(int meta, Random rand, int fortune)
{
return this.field_150004_a ? Item.getItemFromBlock(this.slabs) : Item.getItemFromBlock(this);
}
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
{
AEBaseSlabBlock block = (AEBaseSlabBlock) world.getBlock(x, y, z);
if (block == null) return null;
if (block.field_150004_a) block = this.slabs;
int meta = world.getBlockMetadata(x, y, z) & 7;
return new ItemStack(block, 1, meta);
}
public String name()
{
return name;
}
}

View file

@ -19,6 +19,7 @@
package appeng.core.api.definitions; package appeng.core.api.definitions;
import java.util.EnumSet;
import java.util.Set; import java.util.Set;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
@ -27,6 +28,7 @@ import appeng.api.definitions.IBlockDefinition;
import appeng.api.definitions.IBlocks; import appeng.api.definitions.IBlocks;
import appeng.api.definitions.ITileDefinition; import appeng.api.definitions.ITileDefinition;
import appeng.api.util.IOrientableBlock; import appeng.api.util.IOrientableBlock;
import appeng.block.AEBaseSlabBlock;
import appeng.block.crafting.BlockCraftingMonitor; import appeng.block.crafting.BlockCraftingMonitor;
import appeng.block.crafting.BlockCraftingStorage; import appeng.block.crafting.BlockCraftingStorage;
import appeng.block.crafting.BlockCraftingUnit; import appeng.block.crafting.BlockCraftingUnit;
@ -79,6 +81,7 @@ import appeng.block.storage.BlockChest;
import appeng.block.storage.BlockDrive; import appeng.block.storage.BlockDrive;
import appeng.block.storage.BlockIOPort; import appeng.block.storage.BlockIOPort;
import appeng.block.storage.BlockSkyChest; import appeng.block.storage.BlockSkyChest;
import appeng.core.features.AEFeature;
import appeng.core.features.WrappedDamageItemDefinition; import appeng.core.features.WrappedDamageItemDefinition;
import appeng.debug.BlockChunkloader; import appeng.debug.BlockChunkloader;
import appeng.debug.BlockCubeGenerator; import appeng.debug.BlockCubeGenerator;
@ -147,6 +150,14 @@ public final class ApiBlocks implements IBlocks
private final IBlockDefinition quartzStair; private final IBlockDefinition quartzStair;
private final IBlockDefinition chiseledQuartzStair; private final IBlockDefinition chiseledQuartzStair;
private final IBlockDefinition quartzPillarStair; private final IBlockDefinition quartzPillarStair;
private final IBlockDefinition skyStoneSlab;
private final IBlockDefinition skyStoneBlockSlab;
private final IBlockDefinition skyStoneBrickSlab;
private final IBlockDefinition skyStoneSmallBrickSlab;
private final IBlockDefinition fluixSlab;
private final IBlockDefinition quartzSlab;
private final IBlockDefinition chiseledQuartzSlab;
private final IBlockDefinition quartzPillarSlab;
private final IBlockDefinition itemGen; private final IBlockDefinition itemGen;
private final IBlockDefinition chunkLoader; private final IBlockDefinition chunkLoader;
@ -230,6 +241,15 @@ public final class ApiBlocks implements IBlocks
this.quartzPillarStair = constructor.registerBlockDefinition( new QuartzPillarStairBlock( quartzPillar ) ); this.quartzPillarStair = constructor.registerBlockDefinition( new QuartzPillarStairBlock( quartzPillar ) );
this.skyStoneSlab = constructor.registerBlockDefinition( new AEBaseSlabBlock( skyStone, 0, EnumSet.of(AEFeature.DecorativeQuartzBlocks), false, "SkyStoneSlabBlock" ) );
this.skyStoneBlockSlab = constructor.registerBlockDefinition( new AEBaseSlabBlock( skyStone, 1, EnumSet.of(AEFeature.DecorativeQuartzBlocks), false, "SkyStoneBlockSlabBlock" ) );
this.skyStoneBrickSlab = constructor.registerBlockDefinition( new AEBaseSlabBlock( skyStone, 2, EnumSet.of(AEFeature.DecorativeQuartzBlocks), false, "SkyStoneBrickSlabBlock" ) );
this.skyStoneSmallBrickSlab = constructor.registerBlockDefinition( new AEBaseSlabBlock( skyStone, 3, EnumSet.of(AEFeature.DecorativeQuartzBlocks), false, "SkyStoneSmallBrickSlabBlock" ) );
this.fluixSlab = constructor.registerBlockDefinition( new AEBaseSlabBlock( fluixBlock, 0, EnumSet.of(AEFeature.DecorativeQuartzBlocks), false, "FluixSlabBlock" ) );
this.quartzSlab = constructor.registerBlockDefinition( new AEBaseSlabBlock( quartzBlock, 0, EnumSet.of(AEFeature.DecorativeQuartzBlocks), false, "QuartzSlabBlock" ) );
this.chiseledQuartzSlab = constructor.registerBlockDefinition( new AEBaseSlabBlock( chiseledQuartz, 0, EnumSet.of(AEFeature.DecorativeQuartzBlocks), false, "ChiseledQuartzSlabBlock" ) );;
this.quartzPillarSlab = constructor.registerBlockDefinition( new AEBaseSlabBlock( quartzPillar, 0, EnumSet.of(AEFeature.DecorativeQuartzBlocks), false, "QuartzPillarSlabBlock" ) );
this.itemGen = constructor.registerBlockDefinition( new BlockItemGen() ); this.itemGen = constructor.registerBlockDefinition( new BlockItemGen() );
this.chunkLoader = constructor.registerBlockDefinition( new BlockChunkloader() ); this.chunkLoader = constructor.registerBlockDefinition( new BlockChunkloader() );
this.phantomNode = constructor.registerBlockDefinition( new BlockPhantomNode() ); this.phantomNode = constructor.registerBlockDefinition( new BlockPhantomNode() );
@ -362,6 +382,54 @@ public final class ApiBlocks implements IBlocks
return this.quartzPillarStair; return this.quartzPillarStair;
} }
@Override
public IBlockDefinition skyStoneSlab()
{
return this.skyStoneSlab;
}
@Override
public IBlockDefinition skyStoneBlockSlab()
{
return this.skyStoneBlockSlab;
}
@Override
public IBlockDefinition skyStoneBrickSlab()
{
return this.skyStoneBrickSlab;
}
@Override
public IBlockDefinition skyStoneSmallBrickSlab()
{
return this.skyStoneSmallBrickSlab;
}
@Override
public IBlockDefinition fluixSlab()
{
return this.fluixSlab;
}
@Override
public IBlockDefinition quartzSlab()
{
return this.quartzSlab;
}
@Override
public IBlockDefinition chiseledQuartzSlab()
{
return this.chiseledQuartzSlab;
}
@Override
public IBlockDefinition quartzPillarSlab()
{
return this.quartzPillarSlab;
}
@Override @Override
public ITileDefinition grindStone() public ITileDefinition grindStone()
{ {

View file

@ -0,0 +1,74 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.core.features;
import java.util.EnumSet;
import net.minecraft.block.Block;
import net.minecraft.block.BlockSlab;
import appeng.api.definitions.IBlockDefinition;
import appeng.block.AEBaseItemBlockSlab;
import appeng.block.AEBaseSlabBlock;
import appeng.core.CreativeTab;
import com.google.common.base.Optional;
import cpw.mods.fml.common.registry.GameRegistry;
public class SlabBlockFeatureHandler implements IFeatureHandler
{
private final AEBaseSlabBlock slabs;
private final FeatureNameExtractor extractor;
private final boolean enabled;
private final BlockDefinition definition;
public SlabBlockFeatureHandler( EnumSet<AEFeature> features, AEBaseSlabBlock slabs )
{
final ActivityState state = new FeaturedActiveChecker( features ).getActivityState();
this.slabs = slabs;
this.extractor = new FeatureNameExtractor( slabs.getClass(), Optional.<String>absent());
this.enabled = state == ActivityState.Enabled;
this.definition = new BlockDefinition( slabs, state );
}
@Override
public final boolean isFeatureAvailable()
{
return this.enabled;
}
@Override
public final IBlockDefinition getDefinition()
{
return this.definition;
}
@Override
public final void register()
{
if( this.enabled )
{
this.slabs.setCreativeTab( CreativeTab.instance );
GameRegistry.registerBlock( slabs, AEBaseItemBlockSlab.class, "tile." + slabs.name(), slabs, slabs.doubleSlabs(), false);
GameRegistry.registerBlock( slabs.doubleSlabs(), AEBaseItemBlockSlab.class, "tile." + slabs.name() + ".double", slabs, slabs.doubleSlabs(), true);
}
}
}

View file

@ -61,6 +61,16 @@ tile.appliedenergistics2.SkyStoneBrickStairBlock.name=Sky Stone Brick Stairs
tile.appliedenergistics2.SkyStoneSmallBrickStairBlock.name=Sky Stone Small Brick Stairs tile.appliedenergistics2.SkyStoneSmallBrickStairBlock.name=Sky Stone Small Brick Stairs
tile.appliedenergistics2.SkyStoneStairBlock.name=Sky Stone Stairs tile.appliedenergistics2.SkyStoneStairBlock.name=Sky Stone Stairs
// Slabs
tile.appliedenergistics2.ChiseledQuartzSlabBlock.name=Chiseled Certus Quartz Slabs
tile.appliedenergistics2.FluixSlabBlock.name=Fluix Slabs
tile.appliedenergistics2.QuartzPillarSlabBlock.name=Certus Quartz Pillar Slabs
tile.appliedenergistics2.QuartzSlabBlock.name=Certus Quartz Slabs
tile.appliedenergistics2.SkyStoneBlockSlabBlock.name=Sky Stone Block Slabs
tile.appliedenergistics2.SkyStoneBrickSlabBlock.name=Sky Stone Brick Slabs
tile.appliedenergistics2.SkyStoneSmallBrickSlabBlock.name=Sky Stone Small Brick Slabs
tile.appliedenergistics2.SkyStoneSlabBlock.name=Sky Stone Slabs
// Chat Messages // Chat Messages
chat.appliedenergistics2.ChestCannotReadStorageCell=ME Chest cannot read storage cell. chat.appliedenergistics2.ChestCannotReadStorageCell=ME Chest cannot read storage cell.
chat.appliedenergistics2.SettingCleared=Setting Cleared. chat.appliedenergistics2.SettingCleared=Setting Cleared.

View file

@ -67,3 +67,4 @@ import=paint_balls.recipe
import=crafting.recipe import=crafting.recipe
import=vanilla_enhance.recipe import=vanilla_enhance.recipe
import=stairs.recipe import=stairs.recipe
import=slabs.recipe

View file

@ -0,0 +1,31 @@
shaped=
ae2:BlockQuartzChiseled ae2:BlockQuartzChiseled ae2:BlockQuartzChiseled
-> 6 ae2:ChiseledQuartzSlabBlock
shaped=
ae2:BlockFluix ae2:BlockFluix ae2:BlockFluix
-> 6 ae2:FluixSlabBlock
shaped=
ae2:BlockQuartzPillar ae2:BlockQuartzPillar ae2:BlockQuartzPillar
-> 6 ae2:QuartzPillarSlabBlock
shaped=
ae2:BlockQuartz ae2:BlockQuartz ae2:BlockQuartz
-> 6 ae2:QuartzSlabBlock
shaped=
ae2:BlockSkyStone ae2:BlockSkyStone ae2:BlockSkyStone
-> 6 ae2:SkyStoneSlabBlock
shaped=
ae2:BlockSkyStone:1 ae2:BlockSkyStone:1 ae2:BlockSkyStone:1
-> 6 ae2:SkyStoneBlockSlabBlock
shaped=
ae2:BlockSkyStone:2 ae2:BlockSkyStone:2 ae2:BlockSkyStone:2
-> 6 ae2:SkyStoneBrickSlabBlock
shaped=
ae2:BlockSkyStone:3 ae2:BlockSkyStone:3 ae2:BlockSkyStone:3
-> 6 ae2:SkyStoneSmallBrickSlabBlock