mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 15:17:59 +01:00
Added chitin blocks
This commit is contained in:
parent
318e91ed8d
commit
c627614d22
17 changed files with 416 additions and 246 deletions
|
@ -0,0 +1,69 @@
|
|||
package com.minelittlepony.unicopia.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.minelittlepony.unicopia.Race;
|
||||
import com.minelittlepony.unicopia.init.UItems;
|
||||
import com.minelittlepony.unicopia.init.UMaterials;
|
||||
import com.minelittlepony.unicopia.player.IPlayer;
|
||||
import com.minelittlepony.unicopia.player.PlayerSpeciesList;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.MapColor;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockChitin extends Block {
|
||||
|
||||
public BlockChitin(String domain, String name) {
|
||||
super(UMaterials.hive);
|
||||
|
||||
setTranslationKey(name);
|
||||
setRegistryName(domain, name);
|
||||
setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
|
||||
setHardness(50);
|
||||
setResistance(2000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapColor getMapColor(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
|
||||
return MapColor.BLACK;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random random) {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
|
||||
return UItems.chitin_shell;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public float getPlayerRelativeBlockHardness(IBlockState state, EntityPlayer player, World worldIn, BlockPos pos) {
|
||||
setHardness(50);
|
||||
|
||||
float hardness = super.getPlayerRelativeBlockHardness(state, player, worldIn, pos);
|
||||
|
||||
IPlayer iplayer = PlayerSpeciesList.instance().getPlayer(player);
|
||||
Race race = iplayer.getPlayerSpecies();
|
||||
|
||||
if (race == Race.CHANGELING) {
|
||||
hardness *= 80;
|
||||
} else if (race.canInteractWithClouds()) {
|
||||
hardness /= 4;
|
||||
} else if (race.canUseEarth()) {
|
||||
hardness *= 10;
|
||||
}
|
||||
|
||||
return hardness;
|
||||
}
|
||||
|
||||
}
|
|
@ -9,22 +9,12 @@ import com.minelittlepony.unicopia.CloudType;
|
|||
import com.minelittlepony.unicopia.forgebullshit.FUF;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockSlab;
|
||||
import net.minecraft.block.BlockStairs;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
|
@ -32,67 +22,10 @@ import net.minecraft.util.math.Vec3d;
|
|||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class BlockCloudSlab<T extends Block & ICloudBlock> extends BlockSlab implements ICloudBlock {
|
||||
|
||||
public static final PropertyEnum<Variant> VARIANT = PropertyEnum.<Variant>create("variant", Variant.class);
|
||||
|
||||
protected final T modelBlock;
|
||||
public abstract class BlockCloudSlab<T extends Block & ICloudBlock> extends USlab<T> implements ICloudBlock {
|
||||
|
||||
public BlockCloudSlab(T modelBlock, BlockCloudSlab<? extends T> single, Material material, String domain, String name) {
|
||||
super(material);
|
||||
|
||||
setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
|
||||
setHardness(0.5F);
|
||||
setResistance(1);
|
||||
setSoundType(SoundType.CLOTH);
|
||||
setLightOpacity(20);
|
||||
setTranslationKey(name);
|
||||
setTickRandomly(modelBlock.getTickRandomly());
|
||||
setRegistryName(domain, name);
|
||||
|
||||
useNeighborBrightness = true;
|
||||
|
||||
this.modelBlock = modelBlock;
|
||||
this.fullBlock = isDouble();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public boolean isTranslucent(IBlockState state) {
|
||||
return modelBlock.isTranslucent(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAir(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return modelBlock.isAir(state, world, pos);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return isDouble() && modelBlock != null && modelBlock.isOpaqueCube(state);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
return isDouble() && modelBlock.isFullCube(state);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public boolean isNormalCube(IBlockState state) {
|
||||
return isDouble() && modelBlock.isNormalCube(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
|
||||
modelBlock.updateTick(world, pos, state, rand);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return modelBlock.getRenderLayer();
|
||||
super(modelBlock, single, material, domain, name);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
|
@ -107,26 +40,6 @@ public abstract class BlockCloudSlab<T extends Block & ICloudBlock> extends Bloc
|
|||
return getCloudMaterialType(base_state) == CloudType.ENCHANTED && super.isSideSolid(base_state, world, pos, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPassable(IBlockAccess worldIn, BlockPos pos) {
|
||||
return super.isPassable(worldIn, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFallenUpon(World w, BlockPos pos, Entity entity, float fallDistance) {
|
||||
modelBlock.onFallenUpon(w, pos, entity, fallDistance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLanded(World w, Entity entity) {
|
||||
modelBlock.onLanded(w, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollision(World w, BlockPos pos, IBlockState state, Entity entity) {
|
||||
modelBlock.onEntityCollision(w, pos, state, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entity, boolean p_185477_7_) {
|
||||
|
@ -144,37 +57,11 @@ public abstract class BlockCloudSlab<T extends Block & ICloudBlock> extends Bloc
|
|||
return super.collisionRayTrace(blockState, worldIn, pos, start, end);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public float getPlayerRelativeBlockHardness(IBlockState state, EntityPlayer player, World worldIn, BlockPos pos) {
|
||||
return modelBlock.getPlayerRelativeBlockHardness(state, player, worldIn, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEntityDestroy(IBlockState state, IBlockAccess world, BlockPos pos, Entity entity) {
|
||||
return modelBlock.canEntityDestroy(state, world, pos, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTranslationKey(int meta) {
|
||||
return super.getTranslationKey();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IProperty<Variant> getVariantProperty() {
|
||||
return VARIANT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CloudType getCloudMaterialType(IBlockState blockState) {
|
||||
return modelBlock.getCloudMaterialType(blockState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Comparable<Variant> getTypeForItem(ItemStack stack) {
|
||||
return Variant.DEFAULT;
|
||||
}
|
||||
|
||||
public static class Single<T extends Block & ICloudBlock> extends BlockCloudSlab<T> {
|
||||
|
||||
public final Double<T> doubleSlab;
|
||||
|
@ -190,7 +77,6 @@ public abstract class BlockCloudSlab<T extends Block & ICloudBlock> extends Bloc
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face) {
|
||||
|
||||
|
@ -224,29 +110,6 @@ public abstract class BlockCloudSlab<T extends Block & ICloudBlock> extends Bloc
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return getDefaultState()
|
||||
.withProperty(VARIANT, Variant.DEFAULT)
|
||||
.withProperty(HALF, (meta & 8) == 0 ? BlockSlab.EnumBlockHalf.BOTTOM : BlockSlab.EnumBlockHalf.TOP);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
int i = 0;
|
||||
|
||||
if (state.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP) {
|
||||
i |= 8;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, HALF, VARIANT);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Double<T extends Block & ICloudBlock> extends BlockCloudSlab<T> {
|
||||
|
@ -284,33 +147,5 @@ public abstract class BlockCloudSlab<T extends Block & ICloudBlock> extends Bloc
|
|||
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
|
||||
return Item.getItemFromBlock(singleSlab);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItem(World world, BlockPos pos, IBlockState state) {
|
||||
return new ItemStack(getItemDropped(state, world.rand, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return getDefaultState().withProperty(VARIANT, Variant.DEFAULT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, VARIANT);
|
||||
}
|
||||
}
|
||||
|
||||
private static enum Variant implements IStringSerializable {
|
||||
DEFAULT;
|
||||
|
||||
public String getName() {
|
||||
return "normal";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,14 +7,11 @@ import javax.annotation.Nullable;
|
|||
import com.minelittlepony.unicopia.CloudType;
|
||||
import com.minelittlepony.unicopia.forgebullshit.FUF;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockSlab;
|
||||
import net.minecraft.block.BlockSlab.EnumBlockHalf;
|
||||
import net.minecraft.block.BlockStairs;
|
||||
import net.minecraft.block.state.BlockFaceShape;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -23,51 +20,10 @@ import net.minecraft.util.math.Vec3d;
|
|||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockCloudStairs extends BlockStairs implements ICloudBlock {
|
||||
|
||||
protected Block theBlock;
|
||||
protected IBlockState theState;
|
||||
public class BlockCloudStairs extends UStairs implements ICloudBlock {
|
||||
|
||||
public BlockCloudStairs(IBlockState inherited, String domain, String name) {
|
||||
super(inherited);
|
||||
setTranslationKey(name);
|
||||
setRegistryName(domain, name);
|
||||
theBlock = inherited.getBlock();
|
||||
theState = inherited;
|
||||
|
||||
setTickRandomly(theBlock.getTickRandomly());
|
||||
|
||||
useNeighborBrightness = true;
|
||||
|
||||
fullBlock = isOpaqueCube(inherited);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean isTranslucent(IBlockState state) {
|
||||
return theBlock.isTranslucent(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean isNormalCube(IBlockState state) {
|
||||
return theBlock.isNormalCube(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPassable(IBlockAccess worldIn, BlockPos pos) {
|
||||
return theBlock.isPassable(worldIn, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFallenUpon(World w, BlockPos pos, Entity entity, float fallDistance) {
|
||||
theBlock.onFallenUpon(w, pos, entity, fallDistance);
|
||||
super(inherited, domain, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -75,21 +31,6 @@ public class BlockCloudStairs extends BlockStairs implements ICloudBlock {
|
|||
return allowsFallingBlockToPass(state, world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLanded(World w, Entity entity) {
|
||||
theBlock.onLanded(w, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollision(World w, BlockPos pos, IBlockState state, Entity entity) {
|
||||
theBlock.onEntityCollision(w, pos, theState, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityWalk(World w, BlockPos pos, Entity entity) {
|
||||
theBlock.onEntityWalk(w, pos, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entity, boolean p_185477_7_) {
|
||||
if (getCanInteract(theState, entity)) {
|
||||
|
@ -97,17 +38,6 @@ public class BlockCloudStairs extends BlockStairs implements ICloudBlock {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEntityDestroy(IBlockState state, IBlockAccess world, BlockPos pos, Entity entity) {
|
||||
return theBlock.canEntityDestroy(state, world, pos, entity);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public float getPlayerRelativeBlockHardness(IBlockState state, EntityPlayer player, World worldIn, BlockPos pos) {
|
||||
return theBlock.getPlayerRelativeBlockHardness(state, player, worldIn, pos);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public RayTraceResult collisionRayTrace(IBlockState blockState, World worldIn, BlockPos pos, Vec3d start, Vec3d end) {
|
||||
|
|
|
@ -24,7 +24,6 @@ public class BlockSugar extends BlockFalling {
|
|||
|
||||
@Override
|
||||
public int quantityDropped(Random random) {
|
||||
setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
|
||||
return 9;
|
||||
}
|
||||
|
||||
|
|
212
src/main/java/com/minelittlepony/unicopia/block/USlab.java
Normal file
212
src/main/java/com/minelittlepony/unicopia/block/USlab.java
Normal file
|
@ -0,0 +1,212 @@
|
|||
package com.minelittlepony.unicopia.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockSlab;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class USlab<T extends Block> extends BlockSlab {
|
||||
|
||||
public static final PropertyEnum<Variant> VARIANT = PropertyEnum.<Variant>create("variant", Variant.class);
|
||||
|
||||
protected final T modelBlock;
|
||||
|
||||
public USlab(T modelBlock, USlab<? extends T> single, Material material, String domain, String name) {
|
||||
super(material);
|
||||
|
||||
setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
|
||||
setHardness(0.5F);
|
||||
setResistance(1);
|
||||
setSoundType(SoundType.CLOTH);
|
||||
setLightOpacity(20);
|
||||
setTranslationKey(name);
|
||||
setTickRandomly(modelBlock.getTickRandomly());
|
||||
setRegistryName(domain, name);
|
||||
|
||||
useNeighborBrightness = true;
|
||||
|
||||
this.modelBlock = modelBlock;
|
||||
this.fullBlock = isDouble();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public boolean isTranslucent(IBlockState state) {
|
||||
return modelBlock.isTranslucent(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAir(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return modelBlock.isAir(state, world, pos);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return isDouble() && modelBlock != null && modelBlock.isOpaqueCube(state);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
return isDouble() && modelBlock.isFullCube(state);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public boolean isNormalCube(IBlockState state) {
|
||||
return isDouble() && modelBlock.isNormalCube(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
|
||||
modelBlock.updateTick(world, pos, state, rand);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return modelBlock.getRenderLayer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFallenUpon(World w, BlockPos pos, Entity entity, float fallDistance) {
|
||||
modelBlock.onFallenUpon(w, pos, entity, fallDistance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLanded(World w, Entity entity) {
|
||||
modelBlock.onLanded(w, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollision(World w, BlockPos pos, IBlockState state, Entity entity) {
|
||||
modelBlock.onEntityCollision(w, pos, state, entity);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public float getPlayerRelativeBlockHardness(IBlockState state, EntityPlayer player, World worldIn, BlockPos pos) {
|
||||
return modelBlock.getPlayerRelativeBlockHardness(state, player, worldIn, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEntityDestroy(IBlockState state, IBlockAccess world, BlockPos pos, Entity entity) {
|
||||
return modelBlock.canEntityDestroy(state, world, pos, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTranslationKey(int meta) {
|
||||
return super.getTranslationKey();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IProperty<Variant> getVariantProperty() {
|
||||
return VARIANT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Comparable<Variant> getTypeForItem(ItemStack stack) {
|
||||
return Variant.DEFAULT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItem(World world, BlockPos pos, IBlockState state) {
|
||||
return new ItemStack(getItemDropped(state, world.rand, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
if (isDouble()) {
|
||||
return getDefaultState().withProperty(VARIANT, Variant.DEFAULT);
|
||||
}
|
||||
|
||||
return getDefaultState()
|
||||
.withProperty(VARIANT, Variant.DEFAULT)
|
||||
.withProperty(HALF, (meta & 8) == 0 ? BlockSlab.EnumBlockHalf.BOTTOM : BlockSlab.EnumBlockHalf.TOP);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
if (isDouble()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
|
||||
if (state.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP) {
|
||||
i |= 8;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
if (isDouble()) {
|
||||
return new BlockStateContainer(this, VARIANT);
|
||||
}
|
||||
|
||||
return new BlockStateContainer(this, HALF, VARIANT);
|
||||
}
|
||||
|
||||
public static class Single<T extends Block> extends USlab<T> {
|
||||
|
||||
public final Double<T> doubleSlab;
|
||||
|
||||
public Single(T modelBlock, Material material, String domain, String name) {
|
||||
super(modelBlock, null, material, domain, name);
|
||||
|
||||
doubleSlab = new Double<>(this, domain, "double_" + name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDouble() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Double<T extends Block> extends USlab<T> {
|
||||
|
||||
public final Single<T> singleSlab;
|
||||
|
||||
public Double(Single<T> single, String domain, String name) {
|
||||
super(single.modelBlock, single, single.material, domain, name);
|
||||
|
||||
this.singleSlab = single;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDouble() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
|
||||
return Item.getItemFromBlock(singleSlab);
|
||||
}
|
||||
}
|
||||
|
||||
private static enum Variant implements IStringSerializable {
|
||||
DEFAULT;
|
||||
|
||||
public String getName() {
|
||||
return "normal";
|
||||
}
|
||||
}
|
||||
}
|
77
src/main/java/com/minelittlepony/unicopia/block/UStairs.java
Normal file
77
src/main/java/com/minelittlepony/unicopia/block/UStairs.java
Normal file
|
@ -0,0 +1,77 @@
|
|||
package com.minelittlepony.unicopia.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockStairs;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class UStairs extends BlockStairs {
|
||||
|
||||
protected Block theBlock;
|
||||
protected IBlockState theState;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public UStairs(IBlockState inherited, String domain, String name) {
|
||||
super(inherited);
|
||||
setTranslationKey(name);
|
||||
setRegistryName(domain, name);
|
||||
theBlock = inherited.getBlock();
|
||||
theState = inherited;
|
||||
|
||||
setTickRandomly(theBlock.getTickRandomly());
|
||||
|
||||
useNeighborBrightness = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean isTranslucent(IBlockState state) {
|
||||
return theBlock.isTranslucent(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean isNormalCube(IBlockState state) {
|
||||
return theBlock.isNormalCube(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPassable(IBlockAccess worldIn, BlockPos pos) {
|
||||
return theBlock.isPassable(worldIn, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFallenUpon(World w, BlockPos pos, Entity entity, float fallDistance) {
|
||||
theBlock.onFallenUpon(w, pos, entity, fallDistance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLanded(World w, Entity entity) {
|
||||
theBlock.onLanded(w, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollision(World w, BlockPos pos, IBlockState state, Entity entity) {
|
||||
theBlock.onEntityCollision(w, pos, theState, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityWalk(World w, BlockPos pos, Entity entity) {
|
||||
theBlock.onEntityWalk(w, pos, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEntityDestroy(IBlockState state, IBlockAccess world, BlockPos pos, Entity entity) {
|
||||
return theBlock.canEntityDestroy(state, world, pos, entity);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public float getPlayerRelativeBlockHardness(IBlockState state, EntityPlayer player, World worldIn, BlockPos pos) {
|
||||
return theBlock.getPlayerRelativeBlockHardness(state, player, worldIn, pos);
|
||||
}
|
||||
}
|
|
@ -3,6 +3,7 @@ package com.minelittlepony.unicopia.init;
|
|||
import com.minelittlepony.unicopia.CloudType;
|
||||
import com.minelittlepony.unicopia.Unicopia;
|
||||
import com.minelittlepony.unicopia.block.BlockAlfalfa;
|
||||
import com.minelittlepony.unicopia.block.BlockChitin;
|
||||
import com.minelittlepony.unicopia.block.BlockFruitLeaves;
|
||||
import com.minelittlepony.unicopia.block.BlockGlowingGem;
|
||||
import com.minelittlepony.unicopia.block.BlockGrowingCuccoon;
|
||||
|
@ -72,6 +73,7 @@ public class UBlocks {
|
|||
public static final BlockCloudFarm cloud_farmland = new BlockCloudFarm(Unicopia.MODID, "cloud_farmland");
|
||||
|
||||
public static final BlockHiveWall hive = new BlockHiveWall(Unicopia.MODID, "hive");
|
||||
public static final BlockChitin chitin = new BlockChitin(Unicopia.MODID, "chitin_block");
|
||||
public static final BlockGrowingCuccoon cuccoon = new BlockGrowingCuccoon(Unicopia.MODID, "cuccoon");
|
||||
|
||||
public static final Block sugar_block = new BlockSugar(Unicopia.MODID, "sugar_block");
|
||||
|
@ -93,7 +95,7 @@ public class UBlocks {
|
|||
packed_cloud_slab, packed_cloud_slab.doubleSlab,
|
||||
cloud_fence, cloud_banister,
|
||||
mist_door, library_door, bakery_door,
|
||||
hive, cuccoon,
|
||||
hive, chitin, cuccoon,
|
||||
anvil, cloud_farmland,
|
||||
sugar_block, flower_pot,
|
||||
alfalfa,
|
||||
|
|
|
@ -96,7 +96,14 @@ public class UItems {
|
|||
public static final Item anvil = new UItemBlock(UBlocks.anvil, INTERACT_WITH_CLOUDS).setTranslationKey("cloud_anvil");
|
||||
|
||||
public static final Item hive = new ItemBlock(UBlocks.hive).setRegistryName(Unicopia.MODID, "hive");
|
||||
public static final Item cuccoon = new ItemBlock(UBlocks.cuccoon).setRegistryName(Unicopia.MODID, "cuccoon");
|
||||
public static final Item chitin_shell = new Item()
|
||||
.setCreativeTab(CreativeTabs.MATERIALS)
|
||||
.setTranslationKey("chitin_shell")
|
||||
.setRegistryName(Unicopia.MODID, "chitin_shell");
|
||||
public static final Item chitin = new ItemBlock(UBlocks.chitin)
|
||||
.setRegistryName(Unicopia.MODID, "chitin_block");
|
||||
public static final Item cuccoon = new ItemBlock(UBlocks.cuccoon)
|
||||
.setRegistryName(Unicopia.MODID, "cuccoon");
|
||||
|
||||
public static final Item mist_door = new ItemDoor(UBlocks.mist_door)
|
||||
.setTranslationKey("mist_door")
|
||||
|
@ -233,7 +240,7 @@ public class UItems {
|
|||
|
||||
cloudsdale_tomato, tomato_seeds, tomato, moss,
|
||||
|
||||
hive, cuccoon,
|
||||
hive, chitin_shell, chitin, cuccoon,
|
||||
|
||||
apple_seeds, apple_leaves,
|
||||
|
||||
|
@ -264,7 +271,7 @@ public class UItems {
|
|||
cereal, sugar_cereal, sugar_block,
|
||||
tomato_seeds,
|
||||
|
||||
hive, cuccoon,
|
||||
hive, chitin_shell, chitin, cuccoon,
|
||||
|
||||
apple_seeds, apple_leaves,
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"variants": {
|
||||
"normal": { "model": "unicopia:chitin_block" }
|
||||
}
|
||||
}
|
|
@ -4,6 +4,8 @@
|
|||
{ "item": "minecraft:brick" },
|
||||
{ "item": "minecraft:red_nether_brick" },
|
||||
{ "item": "minecraft:coal_block" },
|
||||
{ "item": "minecraft:coal", "data": 0 }
|
||||
{ "item": "minecraft:coal", "data": 0 },
|
||||
{ "item": "unicopia:chitin_shell" },
|
||||
{ "item": "unicopia:cuccoon" }
|
||||
]
|
||||
}
|
|
@ -15,7 +15,9 @@ tile.cloud_banister.name=Banister
|
|||
tile.cloud_farmland.name=Tilled Clouds
|
||||
|
||||
tile.hive.name=Hive Wall
|
||||
tile.cuccoon.name=Changeling Cuccoon
|
||||
tile.chitin_block.name=Chitin Block
|
||||
tile.chitin_shell.name=Chitin Shell
|
||||
tile.cuccoon.name=Cocoon
|
||||
|
||||
tile.apple_leaves.name=Apple Leaves
|
||||
tile.apple_sapling.name=Apple Seeds
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "block/cube_all",
|
||||
"textures": {
|
||||
"all": "unicopia:blocks/chitin_block"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"parent": "unicopia:block/chitin_block"
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "unicopia:items/chitin_shell"
|
||||
}
|
||||
}
|
15
src/main/resources/assets/unicopia/recipes/chitin_block.json
Normal file
15
src/main/resources/assets/unicopia/recipes/chitin_block.json
Normal file
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
|
||||
"pattern": [
|
||||
"###",
|
||||
"###",
|
||||
"###"
|
||||
],
|
||||
"key": {
|
||||
"#": [
|
||||
{ "item": "unicopia:chitin_shell" }
|
||||
]
|
||||
},
|
||||
"result": { "item": "unicopia:chitin_block", "count": 1 }
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 3.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
Loading…
Reference in a new issue