mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
Made Baseblock abstract, removed rarity and blockItem handlers for now
This might come back but I don't know how we're going to handle block item handling yet
This commit is contained in:
parent
69df7e0e81
commit
9d8e711d35
17 changed files with 41 additions and 89 deletions
|
@ -3,7 +3,6 @@ package de.ellpeck.actuallyadditions.common.blocks;
|
|||
import de.ellpeck.actuallyadditions.api.lens.ILensItem;
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.base.BlockItemBase;
|
||||
import de.ellpeck.actuallyadditions.common.config.values.ConfigIntValues;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityAtomicReconstructor;
|
||||
import de.ellpeck.actuallyadditions.common.util.AssetUtil;
|
||||
|
@ -17,10 +16,7 @@ import net.minecraft.client.MainWindow;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.Rarity;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.state.StateContainer;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -151,7 +147,7 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
|
|||
return MathHelper.clamp(i / 20000, 0, 15);
|
||||
}
|
||||
|
||||
public class BlockItem extends BlockItemBase {
|
||||
public class BlockItem extends net.minecraft.item.BlockItem {
|
||||
private long lastSysTime;
|
||||
private int toPick1;
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ package de.ellpeck.actuallyadditions.common.blocks;
|
|||
import java.util.Random;
|
||||
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.base.BlockItemBase;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.metalists.TheColoredLampColors;
|
||||
import de.ellpeck.actuallyadditions.common.util.StackUtil;
|
||||
import de.ellpeck.actuallyadditions.common.util.StringUtil;
|
||||
|
@ -15,6 +14,7 @@ import net.minecraft.block.state.BlockStateContainer;
|
|||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -132,7 +132,7 @@ public class BlockColoredLamp extends Block {
|
|||
return new BlockStateContainer(this, TYPE);
|
||||
}
|
||||
|
||||
public static class TheItemBlock extends BlockItemBase {
|
||||
public static class TheItemBlock extends BlockItem {
|
||||
|
||||
public TheItemBlock(Block block) {
|
||||
super(block);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package de.ellpeck.actuallyadditions.common.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.base.BlockItemBase;
|
||||
import de.ellpeck.actuallyadditions.common.items.metalists.TheCrystals;
|
||||
import de.ellpeck.actuallyadditions.common.util.StringUtil;
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -11,6 +10,7 @@ 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.item.BlockItem;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
@ -75,7 +75,7 @@ public class BlockCrystal extends Block {
|
|||
return new BlockStateContainer(this, TYPE);
|
||||
}
|
||||
|
||||
public static class TheItemBlock extends BlockItemBase {
|
||||
public static class TheItemBlock extends BlockItem {
|
||||
|
||||
public TheItemBlock(Block block) {
|
||||
super(block);
|
||||
|
|
|
@ -2,7 +2,6 @@ package de.ellpeck.actuallyadditions.common.blocks;
|
|||
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.base.BlockItemBase;
|
||||
import de.ellpeck.actuallyadditions.common.inventory.GuiHandler;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityFurnaceDouble;
|
||||
import de.ellpeck.actuallyadditions.common.util.StringUtil;
|
||||
|
@ -16,6 +15,7 @@ import net.minecraft.block.state.IBlockState;
|
|||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -120,7 +120,7 @@ public class BlockFurnaceDouble extends BlockContainerBase {
|
|||
return new TheItemBlock(this);
|
||||
}
|
||||
|
||||
public static class TheItemBlock extends BlockItemBase {
|
||||
public static class TheItemBlock extends BlockItem {
|
||||
|
||||
public TheItemBlock(Block block) {
|
||||
super(block);
|
||||
|
|
|
@ -2,7 +2,6 @@ package de.ellpeck.actuallyadditions.common.blocks;
|
|||
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.base.BlockItemBase;
|
||||
import de.ellpeck.actuallyadditions.common.inventory.GuiHandler;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityInputter;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityInputterAdvanced;
|
||||
|
@ -13,6 +12,7 @@ import net.minecraft.block.SoundType;
|
|||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -67,7 +67,7 @@ public class BlockInputter extends BlockContainerBase {
|
|||
return EnumRarity.EPIC;
|
||||
}
|
||||
|
||||
public static class TheItemBlock extends BlockItemBase {
|
||||
public static class TheItemBlock extends BlockItem {
|
||||
|
||||
private final Random rand = new Random();
|
||||
private long lastSysTime;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package de.ellpeck.actuallyadditions.common.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.base.BlockItemBase;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.metalists.TheMiscBlocks;
|
||||
import de.ellpeck.actuallyadditions.common.util.StringUtil;
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -11,6 +10,7 @@ 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.item.BlockItem;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
@ -72,7 +72,7 @@ public class BlockMisc extends Block {
|
|||
return new BlockStateContainer(this, TYPE);
|
||||
}
|
||||
|
||||
public static class TheItemBlock extends BlockItemBase {
|
||||
public static class TheItemBlock extends BlockItem {
|
||||
|
||||
public TheItemBlock(Block block) {
|
||||
super(block);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package de.ellpeck.actuallyadditions.common.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.common.blocks.base.BlockItemBase;
|
||||
import de.ellpeck.actuallyadditions.common.util.StackUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockSlab;
|
||||
|
@ -10,6 +9,7 @@ import net.minecraft.block.state.BlockStateContainer;
|
|||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
|
@ -91,7 +91,7 @@ public class BlockSlabs extends Block {
|
|||
return new BlockStateContainer(this, BlockSlab.HALF);
|
||||
}
|
||||
|
||||
public static class TheItemBlock extends BlockItemBase {
|
||||
public static class TheItemBlock extends BlockItem {
|
||||
|
||||
public TheItemBlock(Block block) {
|
||||
super(block);
|
||||
|
|
|
@ -3,7 +3,6 @@ package de.ellpeck.actuallyadditions.common.blocks;
|
|||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.base.BlockBushBase;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.base.BlockPlant;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.base.BlockItemBase;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.metalists.TheWildPlants;
|
||||
import de.ellpeck.actuallyadditions.common.util.StringUtil;
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -14,6 +13,7 @@ import net.minecraft.block.state.BlockStateContainer;
|
|||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
@ -101,7 +101,7 @@ public class BlockWildPlant extends BlockBushBase {
|
|||
return stack.getItemDamage() >= ALL_WILD_PLANTS.length ? EnumRarity.COMMON : ALL_WILD_PLANTS[stack.getItemDamage()].getRarity();
|
||||
}
|
||||
|
||||
public static class TheItemBlock extends BlockItemBase {
|
||||
public static class TheItemBlock extends BlockItem {
|
||||
|
||||
public TheItemBlock(Block block) {
|
||||
super(block);
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
package de.ellpeck.actuallyadditions.common.blocks.base;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
|
||||
public abstract class ActuallyBlockBase extends Block {
|
||||
private static final Properties STONE_PROPS = Block.Properties.create(Material.ROCK)
|
||||
.harvestTool(ToolType.PICKAXE)
|
||||
.sound(SoundType.STONE);
|
||||
|
||||
private static final Properties STONE_PROPS_WITH_TICK = STONE_PROPS.tickRandomly();
|
||||
private static final Properties STONE_PROPS_WITH_HARDNESS = STONE_PROPS.hardnessAndResistance(1.5f, 10.0f);
|
||||
|
||||
public ActuallyBlockBase(Properties properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.common.blocks.base;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class BlockBase extends Block implements IBaseBlock{
|
||||
|
||||
public BlockBase(Properties properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockItemBase getItemBlock() {
|
||||
return new BlockItemBase(this, new Item.Properties());
|
||||
}
|
||||
|
||||
}
|
|
@ -2,17 +2,10 @@ package de.ellpeck.actuallyadditions.common.blocks.base;
|
|||
|
||||
import net.minecraft.block.BushBlock;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class BlockBushBase extends BushBlock implements IBaseBlock {
|
||||
public class BlockBushBase extends BushBlock {
|
||||
|
||||
public BlockBushBase(Properties properties) {
|
||||
super(properties.sound(SoundType.PLANT));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockItemBase getItemBlock(){
|
||||
return new BlockItemBase(this, new Item.Properties());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ import net.minecraftforge.fluids.capability.templates.FluidTank;
|
|||
import javax.annotation.Nullable;
|
||||
import java.util.Random;
|
||||
|
||||
public abstract class BlockContainerBase extends BlockBase {
|
||||
public abstract class BlockContainerBase extends ActuallyBlockBase {
|
||||
|
||||
public BlockContainerBase(Properties properties) {
|
||||
super(properties);
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.common.blocks.base;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class BlockItemBase extends BlockItem {
|
||||
|
||||
public <T extends Block & IBaseBlock> BlockItemBase(T block , Item.Properties properties) {
|
||||
super(block, properties.rarity(block.getRarity()));
|
||||
}
|
||||
|
||||
}
|
|
@ -30,7 +30,7 @@ import net.minecraftforge.items.ItemHandlerHelper;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockPlant extends CropsBlock implements IBaseBlock {
|
||||
public class BlockPlant extends CropsBlock {
|
||||
|
||||
private final int minDropAmount;
|
||||
private final int addDropAmount;
|
||||
|
@ -53,15 +53,6 @@ public class BlockPlant extends CropsBlock implements IBaseBlock {
|
|||
this.returnMeta = returnMeta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockItemBase getItemBlock(){
|
||||
return new BlockItemBase(this, new Item.Properties());
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlantType getPlantType(IBlockReader world, BlockPos pos) {
|
||||
return PlantType.Crop;
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.common.blocks.base;
|
||||
|
||||
import net.minecraft.item.Rarity;
|
||||
|
||||
public interface IBaseBlock {
|
||||
|
||||
BlockItemBase getItemBlock();
|
||||
|
||||
default boolean shouldAddCreative() {
|
||||
return true;
|
||||
}
|
||||
|
||||
default Rarity getRarity() {
|
||||
return Rarity.COMMON;
|
||||
}
|
||||
|
||||
}
|
|
@ -2,7 +2,6 @@ package de.ellpeck.actuallyadditions.common.items.base;
|
|||
|
||||
import de.ellpeck.actuallyadditions.api.misc.IDisableableItem;
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.base.BlockItemBase;
|
||||
import de.ellpeck.actuallyadditions.common.config.ConfigurationHandler;
|
||||
import de.ellpeck.actuallyadditions.common.util.ItemUtil;
|
||||
import de.ellpeck.actuallyadditions.common.util.StringUtil;
|
||||
|
|
|
@ -5,7 +5,6 @@ import java.util.List;
|
|||
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.common.RegistryHandler;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.base.BlockItemBase;
|
||||
import de.ellpeck.actuallyadditions.common.creative.CreativeTab;
|
||||
import de.ellpeck.actuallyadditions.common.util.compat.IMCHandler;
|
||||
import net.minecraft.block.Block;
|
||||
|
|
Loading…
Reference in a new issue