mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
Undeprecated BlockBase and BlockItemBase; reimplemented crystal cluster blocks (loot tables missing)
This commit is contained in:
parent
6139ca68fa
commit
a5c031c135
19 changed files with 157 additions and 252 deletions
|
@ -3,7 +3,7 @@ package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
import de.ellpeck.actuallyadditions.api.lens.ILensItem;
|
import de.ellpeck.actuallyadditions.api.lens.ILensItem;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockItemBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
|
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityAtomicReconstructor;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityAtomicReconstructor;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
|
@ -113,7 +113,7 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ItemBlockBase getItemBlock() {
|
protected BlockItemBase getItemBlock() {
|
||||||
return new TheItemBlock(this);
|
return new TheItemBlock(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
|
||||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
|
return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TheItemBlock extends ItemBlockBase {
|
public static class TheItemBlock extends BlockItemBase {
|
||||||
|
|
||||||
private long lastSysTime;
|
private long lastSysTime;
|
||||||
private int toPick1;
|
private int toPick1;
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
import java.util.Properties;
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockItemBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheColoredLampColors;
|
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheColoredLampColors;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
|
@ -103,7 +101,7 @@ public class BlockColoredLamp extends Block {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ItemBlockBase getItemBlock() {
|
protected BlockItemBase getItemBlock() {
|
||||||
return new TheItemBlock(this);
|
return new TheItemBlock(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,7 +132,7 @@ public class BlockColoredLamp extends Block {
|
||||||
return new BlockStateContainer(this, TYPE);
|
return new BlockStateContainer(this, TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TheItemBlock extends ItemBlockBase {
|
public static class TheItemBlock extends BlockItemBase {
|
||||||
|
|
||||||
public TheItemBlock(Block block) {
|
public TheItemBlock(Block block) {
|
||||||
super(block);
|
super(block);
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockItemBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.items.metalists.TheCrystals;
|
import de.ellpeck.actuallyadditions.mod.items.metalists.TheCrystals;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
@ -50,7 +49,7 @@ public class BlockCrystal extends Block {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ItemBlockBase getItemBlock() {
|
protected BlockItemBase getItemBlock() {
|
||||||
return new TheItemBlock(this);
|
return new TheItemBlock(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +75,7 @@ public class BlockCrystal extends Block {
|
||||||
return new BlockStateContainer(this, TYPE);
|
return new BlockStateContainer(this, TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TheItemBlock extends ItemBlockBase {
|
public static class TheItemBlock extends BlockItemBase {
|
||||||
|
|
||||||
public TheItemBlock(Block block) {
|
public TheItemBlock(Block block) {
|
||||||
super(block);
|
super(block);
|
||||||
|
|
|
@ -1,40 +1,23 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.BlockState;
|
|
||||||
import net.minecraft.entity.LivingEntity;
|
|
||||||
import net.minecraft.util.Direction;
|
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.gen.WorldGenLushCaves;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.items.metalists.TheCrystals;
|
import de.ellpeck.actuallyadditions.mod.items.metalists.TheCrystals;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.IColorProvidingBlock;
|
import de.ellpeck.actuallyadditions.mod.util.IColorProvidingBlock;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.IColorProvidingItem;
|
import de.ellpeck.actuallyadditions.mod.util.IColorProvidingItem;
|
||||||
import net.minecraft.block.BlockDirectional;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.client.renderer.color.IBlockColor;
|
import net.minecraft.client.renderer.color.IBlockColor;
|
||||||
import net.minecraft.client.renderer.color.IItemColor;
|
import net.minecraft.client.renderer.color.IItemColor;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.item.BlockItemUseContext;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.state.StateContainer;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.state.properties.BlockStateProperties;
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.BlockRenderLayer;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.Mirror;
|
import net.minecraft.util.Mirror;
|
||||||
import net.minecraft.util.Rotation;
|
import net.minecraft.util.Rotation;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
import net.minecraft.world.IBlockReader;
|
||||||
import net.minecraft.world.World;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
public class BlockCrystalCluster extends Block implements IColorProvidingBlock, IColorProvidingItem {
|
public class BlockCrystalCluster extends Block implements IColorProvidingBlock, IColorProvidingItem {
|
||||||
|
|
||||||
|
@ -47,93 +30,68 @@ public class BlockCrystalCluster extends Block implements IColorProvidingBlock,
|
||||||
.lightValue(7));
|
.lightValue(7));
|
||||||
|
|
||||||
this.crystal = crystal;
|
this.crystal = crystal;
|
||||||
|
|
||||||
// this.setHardness(0.25F);
|
|
||||||
// this.setResistance(1.0F);
|
|
||||||
// this.setSoundType(SoundType.GLASS);
|
|
||||||
// this.setLightOpacity(1);
|
|
||||||
// this.setLightLevel(0.7F);
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Override
|
|
||||||
// public boolean isFullCube(BlockState state) {
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public boolean isOpaqueCube(BlockState state) {
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BlockState getStateForPlacement(World world, BlockPos pos, Direction side, float hitX, float hitY, float hitZ, int meta, LivingEntity base) {
|
|
||||||
return this.getStateFromMeta(side.ordinal());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
public int getOpacity(BlockState state, IBlockReader worldIn, BlockPos pos){
|
||||||
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state) {
|
public BlockState getStateForPlacement(BlockItemUseContext context){
|
||||||
return state.getValue(BlockDirectional.FACING).getIndex();
|
return super.getStateForPlacement(context).with(BlockStateProperties.FACING, context.getPlacementHorizontalFacing().getOpposite());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState() {
|
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder){
|
||||||
return new BlockStateContainer(this, BlockDirectional.FACING);
|
builder.add(BlockStateProperties.FACING);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
public BlockState rotate(BlockState state, Rotation rot){
|
||||||
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
return state.with(BlockStateProperties.FACING, rot.rotate(state.get(BlockStateProperties.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
public BlockState mirror(BlockState state, Mirror mirror){
|
||||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
|
return this.rotate(state, mirror.toRotation(state.get(BlockStateProperties.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public IBlockColor getBlockColor() {
|
public IBlockColor getBlockColor() {
|
||||||
return (state, world, pos, tintIndex) -> BlockCrystalCluster.this.crystal.clusterColor;
|
return (state, world, pos, tintIndex) -> BlockCrystalCluster.this.crystal.clusterColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockRenderLayer getRenderLayer() {
|
@OnlyIn(Dist.CLIENT)
|
||||||
return BlockRenderLayer.TRANSLUCENT;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public IItemColor getItemColor() {
|
public IItemColor getItemColor() {
|
||||||
return (stack, tintIndex) -> BlockCrystalCluster.this.crystal.clusterColor;
|
return (stack, tintIndex) -> BlockCrystalCluster.this.crystal.clusterColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* todo canitzp: realise block drops with loot tables
|
||||||
@Override
|
@Override
|
||||||
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
|
public Item getItemDropped(BlockState state, Random rand, int fortune) {
|
||||||
return InitItems.itemCrystalShard;
|
return InitItems.itemCrystalShard;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int damageDropped(IBlockState state) {
|
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder){
|
||||||
|
return Collections.singletonList(new ItemStack(InitItems.itemCrystalShard, new Random().nextInt(5) + 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int damageDropped(BlockState state) {
|
||||||
return ArrayUtils.indexOf(WorldGenLushCaves.CRYSTAL_CLUSTERS, this);
|
return ArrayUtils.indexOf(WorldGenLushCaves.CRYSTAL_CLUSTERS, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
public void onBlockHarvested(World worldIn, BlockPos pos, BlockState state, PlayerEntity player){
|
||||||
return new ItemStack(this);
|
super.onBlockHarvested(worldIn, pos, state, player);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int quantityDropped(Random random) {
|
|
||||||
return random.nextInt(5) + 2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player) {
|
public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}*/
|
||||||
}
|
}
|
|
@ -2,7 +2,7 @@ package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockItemBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFurnaceDouble;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFurnaceDouble;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
|
@ -116,11 +116,11 @@ public class BlockFurnaceDouble extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ItemBlockBase getItemBlock() {
|
protected BlockItemBase getItemBlock() {
|
||||||
return new TheItemBlock(this);
|
return new TheItemBlock(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TheItemBlock extends ItemBlockBase {
|
public static class TheItemBlock extends BlockItemBase {
|
||||||
|
|
||||||
public TheItemBlock(Block block) {
|
public TheItemBlock(Block block) {
|
||||||
super(block);
|
super(block);
|
||||||
|
|
|
@ -2,7 +2,7 @@ package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockItemBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityInputter;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityInputter;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityInputterAdvanced;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityInputterAdvanced;
|
||||||
|
@ -58,7 +58,7 @@ public class BlockInputter extends BlockContainerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ItemBlockBase getItemBlock() {
|
protected BlockItemBase getItemBlock() {
|
||||||
return new TheItemBlock(this);
|
return new TheItemBlock(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ public class BlockInputter extends BlockContainerBase {
|
||||||
return EnumRarity.EPIC;
|
return EnumRarity.EPIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TheItemBlock extends ItemBlockBase {
|
public static class TheItemBlock extends BlockItemBase {
|
||||||
|
|
||||||
private final Random rand = new Random();
|
private final Random rand = new Random();
|
||||||
private long lastSysTime;
|
private long lastSysTime;
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockItemBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
@ -42,7 +41,7 @@ public class BlockMisc extends Block {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ItemBlockBase getItemBlock() {
|
protected BlockItemBase getItemBlock() {
|
||||||
return new TheItemBlock(this);
|
return new TheItemBlock(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +72,7 @@ public class BlockMisc extends Block {
|
||||||
return new BlockStateContainer(this, TYPE);
|
return new BlockStateContainer(this, TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TheItemBlock extends ItemBlockBase {
|
public static class TheItemBlock extends BlockItemBase {
|
||||||
|
|
||||||
public TheItemBlock(Block block) {
|
public TheItemBlock(Block block) {
|
||||||
super(block);
|
super(block);
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockItemBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockSlab;
|
import net.minecraft.block.BlockSlab;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
import net.minecraft.block.state.BlockStateContainer;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
@ -21,7 +20,6 @@ import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.ToolType;
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
@ -68,7 +66,7 @@ public class BlockSlabs extends Block {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ItemBlockBase getItemBlock() {
|
protected BlockItemBase getItemBlock() {
|
||||||
return new TheItemBlock(this);
|
return new TheItemBlock(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +90,7 @@ public class BlockSlabs extends Block {
|
||||||
return new BlockStateContainer(this, BlockSlab.HALF);
|
return new BlockStateContainer(this, BlockSlab.HALF);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TheItemBlock extends ItemBlockBase {
|
public static class TheItemBlock extends BlockItemBase {
|
||||||
|
|
||||||
public TheItemBlock(Block block) {
|
public TheItemBlock(Block block) {
|
||||||
super(block);
|
super(block);
|
||||||
|
|
|
@ -3,12 +3,11 @@ package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBushBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBushBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockPlant;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockPlant;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockItemBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheWildPlants;
|
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheWildPlants;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockCrops;
|
import net.minecraft.block.BlockCrops;
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.properties.PropertyEnum;
|
import net.minecraft.block.properties.PropertyEnum;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
import net.minecraft.block.state.BlockStateContainer;
|
||||||
|
@ -66,7 +65,7 @@ public class BlockWildPlant extends BlockBushBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ItemBlockBase getItemBlock() {
|
protected BlockItemBase getItemBlock() {
|
||||||
return new TheItemBlock(this);
|
return new TheItemBlock(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +101,7 @@ public class BlockWildPlant extends BlockBushBase {
|
||||||
return stack.getItemDamage() >= ALL_WILD_PLANTS.length ? EnumRarity.COMMON : ALL_WILD_PLANTS[stack.getItemDamage()].getRarity();
|
return stack.getItemDamage() >= ALL_WILD_PLANTS.length ? EnumRarity.COMMON : ALL_WILD_PLANTS[stack.getItemDamage()].getRarity();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TheItemBlock extends ItemBlockBase {
|
public static class TheItemBlock extends BlockItemBase {
|
||||||
|
|
||||||
public TheItemBlock(Block block) {
|
public TheItemBlock(Block block) {
|
||||||
super(block);
|
super(block);
|
||||||
|
|
|
@ -1,51 +1,42 @@
|
||||||
//package de.ellpeck.actuallyadditions.mod.blocks.base;
|
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
||||||
//
|
|
||||||
//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import net.minecraft.block.Block;
|
||||||
//import de.ellpeck.actuallyadditions.mod.blocks.render.IHasModel;
|
|
||||||
//import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
public class BlockBase extends Block {
|
||||||
//import net.minecraft.block.Block;
|
|
||||||
//import net.minecraft.block.material.Material;
|
private final String name;
|
||||||
//import net.minecraft.item.EnumRarity;
|
|
||||||
//import net.minecraft.item.ItemStack;
|
public BlockBase(Properties properties, String name) {
|
||||||
//import net.minecraft.item.Rarity;
|
super(properties);
|
||||||
//import net.minecraftforge.common.IRarity;
|
this.name = name;
|
||||||
//
|
|
||||||
//public class BlockBase extends Block implements ItemBlockBase.ICustomRarity, IHasModel {
|
this.register();
|
||||||
//
|
}
|
||||||
// private final String name;
|
|
||||||
//
|
@Deprecated
|
||||||
// public BlockBase(Material material, String name) {
|
private void register() {
|
||||||
// super(material);
|
|
||||||
// this.name = name;
|
|
||||||
//
|
|
||||||
// this.register();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private void register() {
|
|
||||||
//ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
|
//ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// protected String getBaseName() {
|
protected String getBaseName() {
|
||||||
// return this.name;
|
return this.name;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// protected ItemBlockBase getItemBlock() {
|
protected BlockItemBase getItemBlock() {
|
||||||
// return new ItemBlockBase(this);
|
return new BlockItemBase(this);
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// public boolean shouldAddCreative() {
|
public boolean shouldAddCreative() {
|
||||||
// return true;
|
return true;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
/*@Override
|
||||||
// public void registerRendering() {
|
public void registerRendering() {
|
||||||
// ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory");
|
ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory");
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
//
|
@Override
|
||||||
//
|
public Rarity getRarity(ItemStack stack) {
|
||||||
// @Override
|
return EnumRarity.COMMON;
|
||||||
// public Rarity getRarity(ItemStack stack) {
|
}*/
|
||||||
// return EnumRarity.COMMON;
|
}
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.item.BlockItem;
|
||||||
|
|
||||||
|
public class BlockItemBase extends BlockItem {
|
||||||
|
|
||||||
|
public BlockItemBase(Block block) {
|
||||||
|
super(block, new Properties());
|
||||||
|
this.setRegistryName(block.getRegistryName());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,25 +0,0 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.item.BlockItem;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public class ItemBlockBase extends BlockItem {
|
|
||||||
|
|
||||||
public ItemBlockBase(Block block, Item.Properties properties) {
|
|
||||||
super(block, properties);
|
|
||||||
// this.setHasSubtypes(false);
|
|
||||||
// this.setMaxDamage(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Override
|
|
||||||
// public String getTranslationKey(ItemStack stack) {
|
|
||||||
// return this.getTranslationKey();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public int getMetadata(int damage) {
|
|
||||||
// return damage;
|
|
||||||
// }
|
|
||||||
}
|
|
|
@ -2,7 +2,7 @@ package de.ellpeck.actuallyadditions.mod.items.base;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.misc.IDisableableItem;
|
import de.ellpeck.actuallyadditions.api.misc.IDisableableItem;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockItemBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.config.ConfigurationHandler;
|
import de.ellpeck.actuallyadditions.mod.config.ConfigurationHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
|
@ -46,8 +46,8 @@ public class ItemSwordAA extends ItemSword implements IDisableableItem {
|
||||||
ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory");
|
ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Class<? extends ItemBlockBase> getItemBlock() {
|
protected Class<? extends BlockItemBase> getItemBlock() {
|
||||||
return ItemBlockBase.class;
|
return BlockItemBase.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.items.metalists;
|
package de.ellpeck.actuallyadditions.mod.items.metalists;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||||
|
import net.minecraft.item.Rarity;
|
||||||
import net.minecraft.util.IStringSerializable;
|
import net.minecraft.util.IStringSerializable;
|
||||||
import net.minecraftforge.common.IRarity;
|
|
||||||
|
|
||||||
public enum TheCrystals implements IStringSerializable {
|
public enum TheCrystals implements IStringSerializable {
|
||||||
|
|
||||||
|
@ -14,11 +14,11 @@ public enum TheCrystals implements IStringSerializable {
|
||||||
IRON("white", Util.CRYSTAL_WHITE_RARITY, 0xCEDDD4, 0.8F, 0.8F, 0.8F);
|
IRON("white", Util.CRYSTAL_WHITE_RARITY, 0xCEDDD4, 0.8F, 0.8F, 0.8F);
|
||||||
|
|
||||||
public final String name;
|
public final String name;
|
||||||
public final IRarity rarity;
|
public final Rarity rarity;
|
||||||
public final float[] conversionColorParticles;
|
public final float[] conversionColorParticles;
|
||||||
public final int clusterColor;
|
public final int clusterColor;
|
||||||
|
|
||||||
TheCrystals(String name, IRarity rarity, int clusterColor, float... conversionColorParticles) {
|
TheCrystals(String name, Rarity rarity, int clusterColor, float... conversionColorParticles) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.rarity = rarity;
|
this.rarity = rarity;
|
||||||
this.conversionColorParticles = conversionColorParticles;
|
this.conversionColorParticles = conversionColorParticles;
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.util;
|
package de.ellpeck.actuallyadditions.mod.util;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.color.IBlockColor;
|
import net.minecraft.client.renderer.color.IBlockColor;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
public interface IColorProvidingBlock {
|
public interface IColorProvidingBlock {
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
IBlockColor getBlockColor();
|
IBlockColor getBlockColor();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.util;
|
package de.ellpeck.actuallyadditions.mod.util;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.color.IItemColor;
|
import net.minecraft.client.renderer.color.IItemColor;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
public interface IColorProvidingItem {
|
public interface IColorProvidingItem {
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
IItemColor getItemColor();
|
IItemColor getItemColor();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import java.util.List;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.RegistryHandler;
|
import de.ellpeck.actuallyadditions.mod.RegistryHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockItemBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.creative.CreativeTab;
|
import de.ellpeck.actuallyadditions.mod.creative.CreativeTab;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.compat.IMCHandler;
|
import de.ellpeck.actuallyadditions.mod.util.compat.IMCHandler;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
@ -25,7 +25,8 @@ public final class ItemUtil {
|
||||||
return ForgeRegistries.ITEMS.getValue(new ResourceLocation(name));
|
return ForgeRegistries.ITEMS.getValue(new ResourceLocation(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerBlock(Block block, ItemBlockBase itemBlock, String name, boolean addTab) {
|
@Deprecated // canitzp: should be removed
|
||||||
|
public static void registerBlock(Block block, BlockItemBase itemBlock, String name, boolean addTab) {
|
||||||
block.setTranslationKey(ActuallyAdditions.MODID + "." + name);
|
block.setTranslationKey(ActuallyAdditions.MODID + "." + name);
|
||||||
|
|
||||||
block.setRegistryName(ActuallyAdditions.MODID, name);
|
block.setRegistryName(ActuallyAdditions.MODID, name);
|
||||||
|
@ -43,6 +44,7 @@ public final class ItemUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated // canitzp: should be removed
|
||||||
public static void registerItem(Item item, String name, boolean addTab) {
|
public static void registerItem(Item item, String name, boolean addTab) {
|
||||||
item.setTranslationKey(ActuallyAdditions.MODID + "." + name);
|
item.setTranslationKey(ActuallyAdditions.MODID + "." + name);
|
||||||
|
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.util;
|
|
||||||
|
|
||||||
import net.minecraft.util.text.TextFormatting;
|
|
||||||
import net.minecraftforge.common.IRarity;
|
|
||||||
|
|
||||||
public class Rarity implements IRarity {
|
|
||||||
|
|
||||||
TextFormatting color;
|
|
||||||
String name;
|
|
||||||
|
|
||||||
public Rarity(TextFormatting color, String name) {
|
|
||||||
this.color = color;
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TextFormatting getColor() {
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,36 +1,35 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.util;
|
package de.ellpeck.actuallyadditions.mod.util;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
|
import net.minecraft.item.Rarity;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraftforge.common.IRarity;
|
|
||||||
import net.minecraftforge.fluids.Fluid;
|
|
||||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
|
||||||
|
|
||||||
public final class Util {
|
public final class Util {
|
||||||
|
|
||||||
public static final int WILDCARD = OreDictionary.WILDCARD_VALUE;
|
@Deprecated // canitzp: Wildcards and Oredict not supported anymore -> Tags
|
||||||
public static final int BUCKET = Fluid.BUCKET_VOLUME;
|
public static final int WILDCARD = -1;//OreDictionary.WILDCARD_VALUE;
|
||||||
|
public static final int BUCKET = 1000;
|
||||||
|
|
||||||
public static final IRarity CRYSTAL_RED_RARITY = addRarity("crystalRed", TextFormatting.DARK_RED, ActuallyAdditions.NAME + " Red Crystal");
|
public static final Rarity CRYSTAL_RED_RARITY = addRarity("crystalRed", TextFormatting.DARK_RED, ActuallyAdditions.NAME + " Red Crystal");
|
||||||
public static final IRarity CRYSTAL_BLUE_RARITY = addRarity("crystalBlue", TextFormatting.DARK_BLUE, ActuallyAdditions.NAME + " Blue Crystal");
|
public static final Rarity CRYSTAL_BLUE_RARITY = addRarity("crystalBlue", TextFormatting.DARK_BLUE, ActuallyAdditions.NAME + " Blue Crystal");
|
||||||
public static final IRarity CRYSTAL_LIGHT_BLUE_RARITY = addRarity("crystalLightBlue", TextFormatting.BLUE, ActuallyAdditions.NAME + " Light Blue Crystal");
|
public static final Rarity CRYSTAL_LIGHT_BLUE_RARITY = addRarity("crystalLightBlue", TextFormatting.BLUE, ActuallyAdditions.NAME + " Light Blue Crystal");
|
||||||
public static final IRarity CRYSTAL_BLACK_RARITY = addRarity("crystalBlack", TextFormatting.DARK_GRAY, ActuallyAdditions.NAME + " Black Crystal");
|
public static final Rarity CRYSTAL_BLACK_RARITY = addRarity("crystalBlack", TextFormatting.DARK_GRAY, ActuallyAdditions.NAME + " Black Crystal");
|
||||||
public static final IRarity CRYSTAL_GREEN_RARITY = addRarity("crystalGreen", TextFormatting.DARK_GREEN, ActuallyAdditions.NAME + " Green Crystal");
|
public static final Rarity CRYSTAL_GREEN_RARITY = addRarity("crystalGreen", TextFormatting.DARK_GREEN, ActuallyAdditions.NAME + " Green Crystal");
|
||||||
public static final IRarity CRYSTAL_WHITE_RARITY = addRarity("crystalWhite", TextFormatting.GRAY, ActuallyAdditions.NAME + " White Crystal");
|
public static final Rarity CRYSTAL_WHITE_RARITY = addRarity("crystalWhite", TextFormatting.GRAY, ActuallyAdditions.NAME + " White Crystal");
|
||||||
|
|
||||||
public static final IRarity FALLBACK_RARITY = addRarity("fallback", TextFormatting.STRIKETHROUGH, ActuallyAdditions.NAME + " Fallback");
|
public static final Rarity FALLBACK_RARITY = addRarity("fallback", TextFormatting.STRIKETHROUGH, ActuallyAdditions.NAME + " Fallback");
|
||||||
|
|
||||||
private static IRarity addRarity(String name, TextFormatting color, String displayName) {
|
private static Rarity addRarity(String name, TextFormatting color, String displayName) {
|
||||||
return new Rarity(color, displayName);
|
return Rarity.create(displayName, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isDevVersion() {
|
public static boolean isDevVersion() {
|
||||||
return ActuallyAdditions.VERSION.equals("@VERSION@");
|
return ActuallyAdditions.VERSION.equals("@VERSION@");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated // canitzp: should not be used and removed asap
|
||||||
public static boolean isClient() {
|
public static boolean isClient() {
|
||||||
return FMLCommonHandler.instance().getEffectiveSide().isClient();
|
return false;//FMLCommonHandler.instance().getEffectiveSide().isClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String[] splitVersion() {
|
private static String[] splitVersion() {
|
||||||
|
|
Loading…
Reference in a new issue