Fixing Registry contructors on blocks and slowly migrating block contructors

This commit is contained in:
Michael 2020-09-07 23:46:45 +01:00
parent 0b964b4c89
commit 6e0fb39544
No known key found for this signature in database
GPG Key ID: 971C5B254742488F
26 changed files with 230 additions and 256 deletions

View File

@ -1,7 +1,5 @@
package de.ellpeck.actuallyadditions.mod.blocks;
import java.util.List;
import de.ellpeck.actuallyadditions.api.lens.ILensItem;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
@ -36,20 +34,22 @@ import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.List;
public class BlockAtomicReconstructor extends BlockContainerBase implements IHudDisplay {
public static final int NAME_FLAVOR_AMOUNTS_1 = 12;
public static final int NAME_FLAVOR_AMOUNTS_2 = 14;
public BlockAtomicReconstructor(String name) {
super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(10F);
this.setResistance(80F);
this.setSoundType(SoundType.STONE);
public BlockAtomicReconstructor() {
super(Properties.create(Material.ROCK)
.hardnessAndResistance(10f, 80f)
.harvestTool(ToolType.PICKAXE)
.sound(SoundType.STONE));
}
@Override

View File

@ -16,16 +16,25 @@ import net.minecraft.util.EnumHand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
import javax.annotation.Nullable;
public class BlockBatteryBox extends BlockContainerBase {
public BlockBatteryBox(String name) {
super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
this.setSoundType(SoundType.STONE);
public BlockBatteryBox() {
super(Properties.create(Material.ROCK)
.hardnessAndResistance(1.5f, 10.0f)
.harvestLevel(0)
.harvestTool(ToolType.PICKAXE)
.sound(SoundType.STONE));
// this.setHarvestLevel("pickaxe", 0);
// this.setHardness(1.5F);
// this.setResistance(10.0F);
// this.setSoundType(SoundType.STONE);
}
@Override
@ -33,11 +42,6 @@ public class BlockBatteryBox extends BlockContainerBase {
return BlockSlabs.AABB_BOTTOM_HALF;
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return new TileEntityBatteryBox();
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
TileEntity tile = world.getTileEntity(pos);
@ -72,4 +76,10 @@ public class BlockBatteryBox extends BlockContainerBase {
public EnumRarity getRarity(ItemStack stack) {
return EnumRarity.RARE;
}
@Nullable
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
return new TileEntityBatteryBox();
}
}

View File

@ -15,16 +15,15 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
public class BlockBioReactor extends BlockContainerBase {
public BlockBioReactor(String name) {
super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(2.0F);
this.setResistance(10.0F);
this.setSoundType(SoundType.STONE);
public BlockBioReactor() {
super(Properties.create(Material.ROCK)
.hardnessAndResistance(2f, 10.0f)
.harvestTool(ToolType.PICKAXE)
.sound(SoundType.STONE));
}
@Override

View File

@ -1,11 +1,17 @@
package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBushBase;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraftforge.common.ToolType;
public class BlockBlackLotus extends BlockBushBase {
public BlockBlackLotus(String name) {
super(name);
public BlockBlackLotus() {
super(Properties.create(Material.ROCK)
.hardnessAndResistance(1.5f, 10.0f)
.harvestTool(ToolType.PICKAXE)
.sound(SoundType.STONE));
}
}

View File

@ -6,6 +6,7 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheCrystals;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer;
@ -15,22 +16,24 @@ import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraftforge.common.IRarity;
import net.minecraftforge.common.ToolType;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class BlockCrystal extends BlockBase {
public class BlockCrystal extends Block {
public static final TheCrystals[] ALL_CRYSTALS = TheCrystals.values();
private static final PropertyEnum<TheCrystals> TYPE = PropertyEnum.create("type", TheCrystals.class);
private final boolean isEmpowered;
public BlockCrystal(String name, boolean isEmpowered) {
super(Material.ROCK, name);
public BlockCrystal(boolean isEmpowered) {
super(Properties.create(Material.ROCK)
.hardnessAndResistance(1.5f, 10.0f)
.harvestTool(ToolType.PICKAXE)
.sound(SoundType.STONE));
this.isEmpowered = isEmpowered;
this.setHardness(1.5F);
this.setResistance(10.0F);
this.setHarvestLevel("pickaxe", 1);
}
@Override
@ -73,11 +76,6 @@ public class BlockCrystal extends BlockBase {
return new BlockStateContainer(this, TYPE);
}
@Override
public IRarity getRarity(ItemStack stack) {
return stack.getItemDamage() >= ALL_CRYSTALS.length ? EnumRarity.COMMON : ALL_CRYSTALS[stack.getItemDamage()].rarity;
}
public static class TheItemBlock extends ItemBlockBase {
public TheItemBlock(Block block) {

View File

@ -2,6 +2,10 @@ 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;
@ -32,41 +36,40 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class BlockCrystalCluster extends BlockBase implements IColorProvidingBlock, IColorProvidingItem {
public class BlockCrystalCluster extends Block implements IColorProvidingBlock, IColorProvidingItem {
private final TheCrystals crystal;
public BlockCrystalCluster(String name, TheCrystals crystal) {
super(Material.GLASS, name);
public BlockCrystalCluster(TheCrystals crystal) {
super(Properties.create(Material.GLASS)
.hardnessAndResistance(0.25f, 1.0f)
.sound(SoundType.GLASS)
.lightValue(7));
this.crystal = crystal;
this.setHardness(0.25F);
this.setResistance(1.0F);
this.setSoundType(SoundType.GLASS);
this.setLightOpacity(1);
this.setLightLevel(0.7F);
// this.setHardness(0.25F);
// this.setResistance(1.0F);
// this.setSoundType(SoundType.GLASS);
// this.setLightOpacity(1);
// this.setLightLevel(0.7F);
}
@Override
public boolean isFullCube(IBlockState state) {
return false;
}
// @Override
// public boolean isFullCube(BlockState state) {
// return false;
// }
//
// @Override
// public boolean isOpaqueCube(BlockState state) {
// return false;
// }
@Override
public boolean isOpaqueCube(IBlockState state) {
return false;
}
@Override
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, int meta, EntityLivingBase base) {
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
public EnumRarity getRarity(ItemStack stack) {
return EnumRarity.EPIC;
}
@Override
public IBlockState getStateFromMeta(int meta) {
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));

View File

@ -20,15 +20,15 @@ import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
public class BlockDirectionalBreaker extends BlockContainerBase {
public BlockDirectionalBreaker(String name) {
super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
this.setSoundType(SoundType.STONE);
public BlockDirectionalBreaker() {
super(Properties.create(Material.ROCK)
.hardnessAndResistance(1.5f, 10.0f)
.harvestTool(ToolType.PICKAXE)
.sound(SoundType.STONE));
}
@Override

View File

@ -18,16 +18,15 @@ import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
public class BlockDisplayStand extends BlockContainerBase {
public BlockDisplayStand(String name) {
super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
this.setSoundType(SoundType.STONE);
public BlockDisplayStand() {
super(Properties.create(Material.ROCK)
.hardnessAndResistance(1.5f, 10.0f)
.harvestTool(ToolType.PICKAXE)
.sound(SoundType.STONE));
}
@Override

View File

@ -17,16 +17,15 @@ import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
public class BlockEmpowerer extends BlockContainerBase {
public BlockEmpowerer(String name) {
super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
this.setSoundType(SoundType.STONE);
public BlockEmpowerer() {
super(Properties.create(Material.ROCK)
.hardnessAndResistance(1.5f, 10.0f)
.harvestTool(ToolType.PICKAXE)
.sound(SoundType.STONE));
}
@Override

View File

@ -20,15 +20,15 @@ import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
public class BlockFarmer extends BlockContainerBase {
public BlockFarmer(String name) {
super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
this.setSoundType(SoundType.STONE);
public BlockFarmer() {
super(Properties.create(Material.ROCK)
.hardnessAndResistance(1.5f, 10.0f)
.harvestTool(ToolType.PICKAXE)
.sound(SoundType.STONE));
}
@Override

View File

@ -15,15 +15,15 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
public class BlockFireworkBox extends BlockContainerBase {
public BlockFireworkBox(String name) {
super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
this.setSoundType(SoundType.STONE);
public BlockFireworkBox() {
super(Properties.create(Material.ROCK)
.hardnessAndResistance(1.5f, 10.0f)
.harvestTool(ToolType.PICKAXE)
.sound(SoundType.STONE));
}
@Override
@ -43,9 +43,4 @@ public class BlockFireworkBox extends BlockContainerBase {
public TileEntity createNewTileEntity(World world, int par2) {
return new TileEntityFireworkBox();
}
@Override
public EnumRarity getRarity(ItemStack stack) {
return EnumRarity.RARE;
}
}

View File

@ -1,27 +1,21 @@
package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.ToolType;
public class BlockGeneric extends BlockBase {
public class BlockGeneric extends Block {
public BlockGeneric(String name) {
this(name, Material.ROCK, SoundType.STONE, 1.5F, 10.0F, "pickaxe", 0);
public BlockGeneric() {
this(Material.ROCK, SoundType.STONE, 1.5F, 10.0F, ToolType.PICKAXE, 0);
}
public BlockGeneric(String name, Material material, SoundType sound, float hardness, float resistance, String harvestTool, int harvestLevel) {
super(material, name);
this.setHarvestLevel(harvestTool, harvestLevel);
this.setHardness(hardness);
this.setResistance(resistance);
this.setSoundType(sound);
}
@Override
public EnumRarity getRarity(ItemStack stack) {
return EnumRarity.COMMON;
public BlockGeneric(Material material, SoundType sound, float hardness, float resistance, ToolType harvestTool, int harvestLevel) {
super(Properties.create(material)
.hardnessAndResistance(hardness, resistance)
.harvestTool(harvestTool)
.harvestLevel(harvestLevel)
.sound(sound));
}
}

View File

@ -2,30 +2,27 @@ package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemViewer;
import net.minecraft.block.BlockState;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraft.world.IBlockReader;
import net.minecraftforge.common.ToolType;
import javax.annotation.Nullable;
public class BlockItemViewer extends BlockContainerBase {
public BlockItemViewer(String name) {
super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
this.setSoundType(SoundType.STONE);
public BlockItemViewer() {
super(Properties.create(Material.ROCK)
.harvestTool(ToolType.PICKAXE)
.hardnessAndResistance(1.5f, 10.0f)
.sound(SoundType.STONE));
}
@Nullable
@Override
public TileEntity createNewTileEntity(World worldIn, int meta) {
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
return new TileEntityItemViewer();
}
@Override
public EnumRarity getRarity(ItemStack stack) {
return EnumRarity.RARE;
}
}

View File

@ -31,7 +31,7 @@ public class BlockItemViewerHopping extends BlockItemViewer {
private static final AxisAlignedBB WEST_AABB = new AxisAlignedBB(0.875D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
private static final AxisAlignedBB EAST_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.125D, 1.0D, 1.0D);
public BlockItemViewerHopping(String name) {
public BlockItemViewerHopping() {
super(name);
}

View File

@ -9,13 +9,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.items.ItemEngineerGoggles;
import de.ellpeck.actuallyadditions.mod.items.ItemLaserRelayUpgrade;
import de.ellpeck.actuallyadditions.mod.items.ItemLaserWrench;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelay;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayEnergy;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayEnergyAdvanced;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayEnergyExtreme;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayFluids;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItem;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItemWhitelist;
import de.ellpeck.actuallyadditions.mod.tile.*;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.block.BlockDirectional;
@ -42,6 +36,7 @@ import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.ToolType;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
@ -61,15 +56,15 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay {
private final Type type;
public BlockLaserRelay(String name, Type type) {
super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
this.setSoundType(SoundType.STONE);
public BlockLaserRelay(Type type) {
super(Properties.create(Material.ROCK)
.hardnessAndResistance(1.5f, 10.0f)
.harvestTool(ToolType.PICKAXE)
.sound(SoundType.STONE));
this.type = type;
// todo: migrate to better way of handling this...
if (this.type.ordinal() == 0) {
MinecraftForge.EVENT_BUS.register(this);
}

View File

@ -8,24 +8,19 @@ import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
public class BlockLeafGenerator extends BlockContainerBase {
public BlockLeafGenerator(String name) {
super(Material.IRON, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(5.0F);
this.setResistance(10.0F);
this.setSoundType(SoundType.METAL);
public BlockLeafGenerator() {
super(Properties.create(Material.IRON)
.hardnessAndResistance(1.5f, 10.0f)
.harvestTool(ToolType.PICKAXE)
.sound(SoundType.METAL));
}
@Override
public TileEntity createNewTileEntity(World world, int par2) {
return new TileEntityLeafGenerator();
}
@Override
public EnumRarity getRarity(ItemStack stack) {
return EnumRarity.EPIC;
}
}

View File

@ -19,17 +19,17 @@ import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class BlockMiner extends BlockContainerBase implements IHudDisplay {
public BlockMiner(String name) {
super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(8F);
this.setResistance(30F);
this.setSoundType(SoundType.STONE);
public BlockMiner() {
super(Properties.create(Material.ROCK)
.hardnessAndResistance(8f, 30f)
.harvestTool(ToolType.PICKAXE)
.sound(SoundType.STONE));
}
@Override
@ -48,11 +48,6 @@ public class BlockMiner extends BlockContainerBase implements IHudDisplay {
return true;
}
@Override
public EnumRarity getRarity(ItemStack stack) {
return EnumRarity.RARE;
}
@Override
public TileEntity createNewTileEntity(World world, int i) {
return new TileEntityMiner();

View File

@ -17,17 +17,17 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class BlockPlayerInterface extends BlockContainerBase implements IHudDisplay {
public BlockPlayerInterface(String name) {
super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(4.5F);
this.setResistance(10.0F);
this.setSoundType(SoundType.STONE);
public BlockPlayerInterface() {
super(Properties.create(Material.ROCK)
.hardnessAndResistance(4.5f, 10.0f)
.harvestTool(ToolType.PICKAXE)
.sound(SoundType.STONE));
}
@Override
@ -35,11 +35,6 @@ public class BlockPlayerInterface extends BlockContainerBase implements IHudDisp
return new TileEntityPlayerInterface();
}
@Override
public EnumRarity getRarity(ItemStack stack) {
return EnumRarity.EPIC;
}
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
TileEntity tile = world.getTileEntity(pos);

View File

@ -15,15 +15,15 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
public class BlockRangedCollector extends BlockContainerBase {
public BlockRangedCollector(String name) {
super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
this.setSoundType(SoundType.STONE);
public BlockRangedCollector() {
super(Properties.create(Material.ROCK)
.hardnessAndResistance(1.5f, 10.0f)
.harvestTool(ToolType.PICKAXE)
.sound(SoundType.STONE));
}
@Override

View File

@ -1,9 +1,6 @@
package de.ellpeck.actuallyadditions.mod.blocks;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityShockSuppressor;
import net.minecraft.block.SoundType;
@ -15,19 +12,23 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.ToolType;
import net.minecraftforge.event.world.ExplosionEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@Mod.EventBusSubscriber(modid = ActuallyAdditions.MODID)
public class BlockShockSuppressor extends BlockContainerBase {
public BlockShockSuppressor(String name) {
super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(20.0F);
this.setResistance(2000.0F);
this.setSoundType(SoundType.STONE);
MinecraftForge.EVENT_BUS.register(this);
public BlockShockSuppressor() {
super(Properties.create(Material.ROCK)
.hardnessAndResistance(20.0f, 2000.0f)
.harvestTool(ToolType.PICKAXE)
.sound(SoundType.STONE));
}
@SubscribeEvent
@ -82,11 +83,6 @@ public class BlockShockSuppressor extends BlockContainerBase {
}
}
@Override
public EnumRarity getRarity(ItemStack stack) {
return EnumRarity.EPIC;
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta) {
return new TileEntityShockSuppressor();

View File

@ -5,6 +5,7 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.block.Block;
import net.minecraft.block.BlockSlab;
import net.minecraft.block.BlockState;
import net.minecraft.block.SoundType;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
@ -23,7 +24,7 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class BlockSlabs extends BlockBase {
public class BlockSlabs extends Block {
public static final AxisAlignedBB AABB_BOTTOM_HALF = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.5D, 1.0D);
private static final AxisAlignedBB AABB_TOP_HALF = new AxisAlignedBB(0.0D, 0.5D, 0.0D, 1.0D, 1.0D, 1.0D);
@ -34,7 +35,7 @@ public class BlockSlabs extends BlockBase {
this(name, fullBlock.getDefaultState());
}
public BlockSlabs(String name, IBlockState fullBlockState) {
public BlockSlabs(String name, BlockState fullBlockState) {
super(fullBlockState.getMaterial(), name);
this.setHardness(1.5F);
this.setResistance(10.0F);

View File

@ -1,7 +1,5 @@
package de.ellpeck.actuallyadditions.mod.blocks;
import java.util.Random;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
@ -16,24 +14,23 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.Random;
public class BlockSmileyCloud extends BlockContainerBase {
public BlockSmileyCloud(String name) {
super(Material.CLOTH, name);
this.setHardness(0.5F);
this.setResistance(5.0F);
this.setSoundType(SoundType.CLOTH);
this.setTickRandomly(true);
public BlockSmileyCloud(S) {
super(Properties.create(Material.WOOL)
.hardnessAndResistance(0.5f, 5.0f)
.harvestTool(ToolType.PICKAXE)
.sound(SoundType.CLOTH)
.tickRandomly());
}
@Override

View File

@ -1,33 +1,32 @@
package de.ellpeck.actuallyadditions.mod.blocks;
import java.util.Random;
import javax.annotation.Nullable;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
import net.minecraft.block.Block;
import net.minecraft.block.BlockTorch;
import net.minecraft.block.SoundType;
import net.minecraft.block.TorchBlock;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockFaceShape;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.state.DirectionProperty;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.*;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nullable;
import java.util.Random;
//Copied from BlockTorch.
//I have no idea what all of this means.
public class BlockTinyTorch extends BlockBase {
public class BlockTinyTorch extends Block {
//Thanks to xdjackiexd for these.
//Man, I hate numbers.
@ -37,14 +36,15 @@ public class BlockTinyTorch extends BlockBase {
private static final AxisAlignedBB TORCH_WEST_AABB = new AxisAlignedBB(0.8125D, 0.25D, 0.4375D, 1.0D, 0.5625D, 0.5625D);
private static final AxisAlignedBB TORCH_EAST_AABB = new AxisAlignedBB(0.0D, 0.25D, 0.4375D, 0.1875D, 0.5625D, 0.5625D);
public BlockTinyTorch(String name) {
super(Material.CIRCUITS, name);
this.setDefaultState(this.blockState.getBaseState().withProperty(BlockTorch.FACING, EnumFacing.UP));
this.setTickRandomly(true);
public BlockTinyTorch() {
super(Properties.create(Material.MISCELLANEOUS)
.hardnessAndResistance(0.0f)
.harvestTool(ToolType.PICKAXE)
.lightValue(8)
.sound(SoundType.WOOD)
.tickRandomly());
this.setHardness(0.0F);
this.setLightLevel(0.8F);
this.setSoundType(SoundType.WOOD);
this.setDefaultState(this.getDefaultState().with(BlockStateProperties.FACING, Direction.UP));
}
@Override

View File

@ -20,15 +20,15 @@ import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
public class BlockXPSolidifier extends BlockContainerBase {
public BlockXPSolidifier(String name) {
super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(2.5F);
this.setResistance(10.0F);
this.setSoundType(SoundType.STONE);
public BlockXPSolidifier() {
super(Properties.create(Material.ROCK)
.hardnessAndResistance(2.5f, 10.0f)
.harvestTool(ToolType.PICKAXE)
.sound(SoundType.STONE));
}
@Override

View File

@ -16,22 +16,22 @@ public final class InitBlocks {
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, ActuallyAdditions.MODID);
public static final RegistryObject<Block> blockCrystalClusterRedstone
= BLOCKS.register("block_crystal_cluster_redstone", () -> new BlockCrystalCluster(TheCrystals.REDSTONE);
= BLOCKS.register("block_crystal_cluster_redstone", () -> new BlockCrystalCluster(TheCrystals.REDSTONE));
public static final RegistryObject<Block> blockCrystalClusterLapis
= BLOCKS.register("block_crystal_cluster_lapis", () -> new BlockCrystalCluster(TheCrystals.LAPIS);
= BLOCKS.register("block_crystal_cluster_lapis", () -> new BlockCrystalCluster(TheCrystals.LAPIS));
public static final RegistryObject<Block> blockCrystalClusterDiamond
= BLOCKS.register("block_crystal_cluster_diamond", () -> new BlockCrystalCluster(TheCrystals.DIAMOND);
= BLOCKS.register("block_crystal_cluster_diamond", () -> new BlockCrystalCluster(TheCrystals.DIAMOND));
public static final RegistryObject<Block> blockCrystalClusterCoal
= BLOCKS.register("block_crystal_cluster_coal", () -> new BlockCrystalCluster(TheCrystals.COAL);
= BLOCKS.register("block_crystal_cluster_coal", () -> new BlockCrystalCluster(TheCrystals.COAL));
public static final RegistryObject<Block> blockCrystalClusterEmerald
= BLOCKS.register("block_crystal_cluster_emerald", () -> new BlockCrystalCluster(TheCrystals.EMERALD);
= BLOCKS.register("block_crystal_cluster_emerald", () -> new BlockCrystalCluster(TheCrystals.EMERALD));
public static final RegistryObject<Block> blockCrystalClusterIron
= BLOCKS.register("block_crystal_cluster_iron", () -> new BlockCrystalCluster(TheCrystals.IRON);
= BLOCKS.register("block_crystal_cluster_iron", () -> new BlockCrystalCluster(TheCrystals.IRON));
public static final RegistryObject<Block> blockBatteryBox
= BLOCKS.register("block_battery_box", BlockBatteryBox::new);
@ -82,22 +82,22 @@ public final class InitBlocks {
= BLOCKS.register("block_black_lotus", BlockBlackLotus::new);
public static final RegistryObject<Block> blockLaserRelay
= BLOCKS.register("block_laser_relay", () -> new BlockLaserRelay(Type.ENERGY_BASIC));
= BLOCKS.register("block_laser_relay", () -> new BlockLaserRelay(BlockLaserRelay.Type.ENERGY_BASIC));
public static final RegistryObject<Block> blockLaserRelayAdvanced
= BLOCKS.register("block_laser_relay_advanced", () -> new BlockLaserRelay(Type.ENERGY_ADVANCED));
= BLOCKS.register("block_laser_relay_advanced", () -> new BlockLaserRelay(BlockLaserRelay.Type.ENERGY_ADVANCED));
public static final RegistryObject<Block> blockLaserRelayExtreme
= BLOCKS.register("block_laser_relay_extreme", () -> new BlockLaserRelay(Type.ENERGY_EXTREME));
= BLOCKS.register("block_laser_relay_extreme", () -> new BlockLaserRelay(BlockLaserRelay.Type.ENERGY_EXTREME));
public static final RegistryObject<Block> blockLaserRelayFluids
= BLOCKS.register("block_laser_relay_fluids", () -> new BlockLaserRelay(Type.FLUIDS));
= BLOCKS.register("block_laser_relay_fluids", () -> new BlockLaserRelay(BlockLaserRelay.Type.FLUIDS));
public static final RegistryObject<Block> blockLaserRelayItem
= BLOCKS.register("block_laser_relay_item", () -> new BlockLaserRelay(Type.ITEM));
= BLOCKS.register("block_laser_relay_item", () -> new BlockLaserRelay(BlockLaserRelay.Type.ITEM));
public static final RegistryObject<Block> blockLaserRelayItemWhitelist
= BLOCKS.register("block_laser_relay_item_whitelist", () -> new BlockLaserRelay(Type.ITEM_WHITELIST));
= BLOCKS.register("block_laser_relay_item_whitelist", () -> new BlockLaserRelay(BlockLaserRelay.Type.ITEM_WHITELIST));
public static final RegistryObject<Block> blockRangedCollector
= BLOCKS.register("block_ranged_collector", BlockRangedCollector::new);
@ -127,16 +127,16 @@ public final class InitBlocks {
= BLOCKS.register("block_testifi_bucks_white_stairs", () -> new StairsBlock(() -> blockTestifiBucksWhiteWall.get().getDefaultState(), Block.Properties.create(Material.ROCK)));
public static final RegistryObject<Block> blockTestifiBucksGreenSlab
= BLOCKS.register("block_testifi_bucks_green_slab", () -> new BlockSlabs("block_testifi_bucks_green_slab", blockTestifiBucksGreenWall);
= BLOCKS.register("block_testifi_bucks_green_slab", () -> new BlockSlabs(blockTestifiBucksGreenWall);
public static final RegistryObject<Block> blockTestifiBucksWhiteSlab
= BLOCKS.register("block_testifi_bucks_white_slab", () -> new BlockSlabs("block_testifi_bucks_white_slab", blockTestifiBucksWhiteWall);
= BLOCKS.register("block_testifi_bucks_white_slab", () -> new BlockSlabs(blockTestifiBucksWhiteWall);
public static final RegistryObject<Block> blockTestifiBucksGreenFence
= BLOCKS.register("block_testifi_bucks_green_fence", () -> new BlockWallAA("block_testifi_bucks_green_fence", blockTestifiBucksGreenWall);
= BLOCKS.register("block_testifi_bucks_green_fence", () -> new BlockWallAA(blockTestifiBucksGreenWall);
public static final RegistryObject<Block> blockTestifiBucksWhiteFence
= BLOCKS.register("block_testifi_bucks_white_fence", () -> new BlockWallAA("block_testifi_bucks_white_fence", blockTestifiBucksWhiteWall);
= BLOCKS.register("block_testifi_bucks_white_fence", () -> new BlockWallAA(blockTestifiBucksWhiteWall);
public static final RegistryObject<Block> blockColoredLamp
= BLOCKS.register("block_colored_lamp", () -> new BlockColoredLamp(false));

View File

@ -29,7 +29,7 @@ import net.minecraftforge.fluids.capability.templates.FluidTank;
import javax.annotation.Nullable;
import java.util.Random;
public abstract class BlockContainerBase extends ContainerBlock {
public abstract class BlockContainerBase extends Block {
public BlockContainerBase(Properties properties) {
super(properties);