chore: moved over most tile and block register to deferred variant

This commit is contained in:
Michael Hillcox 2021-02-27 12:24:45 +00:00
parent b7d4d600fc
commit ecb7832738
146 changed files with 1049 additions and 1081 deletions

View file

@ -11,7 +11,7 @@
package de.ellpeck.actuallyadditions.api.internal;
import de.ellpeck.actuallyadditions.api.lens.Lens;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
/**
* This is a helper interface for Lens' invoke() method.
@ -23,5 +23,5 @@ public interface IAtomicReconstructor extends IEnergyTile {
Lens getLens();
EnumFacing getOrientation();
Direction getOrientation();
}

View file

@ -13,7 +13,7 @@ package de.ellpeck.actuallyadditions.api.internal;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
/**
* This is a helper interface for IFarmerBehavior.
@ -23,7 +23,7 @@ import net.minecraft.util.EnumFacing;
*/
public interface IFarmer extends IEnergyTile {
EnumFacing getOrientation();
Direction getOrientation();
boolean canAddToSeeds(List<ItemStack> stacks);

View file

@ -12,7 +12,7 @@ package de.ellpeck.actuallyadditions.api.lens;
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
import net.minecraft.block.state.BlockState;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
/**
@ -42,7 +42,7 @@ public abstract class Lens {
/**
* @return If the lens can be invoked at the current time
*/
public boolean canInvoke(IAtomicReconstructor tile, EnumFacing sideToShootTo, int energyUsePerShot) {
public boolean canInvoke(IAtomicReconstructor tile, Direction sideToShootTo, int energyUsePerShot) {
return true;
}
}

View file

@ -35,7 +35,7 @@ import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
@ -54,8 +54,8 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
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);
public BlockAtomicReconstructor() {
super(Material.ROCK, this.name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(10F);
this.setResistance(80F);
@ -68,7 +68,7 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, Direction par6, float par7, float par8, float par9) {
ItemStack heldItem = player.getHeldItem(hand);
if (this.tryToggleRedstone(world, pos, player)) {
return true;
@ -136,7 +136,7 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
@Override
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) {
int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal();
int rotation = Direction.getDirectionFromEntityLiving(pos, player).ordinal();
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
super.onBlockPlacedBy(world, pos, state, player, stack);
@ -144,7 +144,7 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
@Override
public BlockState getStateFromMeta(int meta) {
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
return this.getDefaultState().withProperty(BlockDirectional.FACING, Direction.byIndex(meta));
}
@Override

View file

@ -21,7 +21,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
@ -30,8 +30,8 @@ import net.minecraft.world.World;
public class BlockBatteryBox extends BlockContainerBase {
public BlockBatteryBox(String name) {
super(Material.ROCK, name);
public BlockBatteryBox() {
super(Material.ROCK, this.name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
@ -49,7 +49,7 @@ public class BlockBatteryBox extends BlockContainerBase {
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, Direction facing, float hitX, float hitY, float hitZ) {
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileEntityBatteryBox) {
TileEntityBatteryBox box = (TileEntityBatteryBox) tile;

View file

@ -21,15 +21,15 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class BlockBioReactor extends BlockContainerBase {
public BlockBioReactor(String name) {
super(Material.ROCK, name);
public BlockBioReactor() {
super(Material.ROCK, this.name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(2.0F);
@ -43,7 +43,7 @@ public class BlockBioReactor extends BlockContainerBase {
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, Direction par6, float par7, float par8, float par9) {
if (!world.isRemote) {
if (world.getTileEntity(pos) instanceof TileEntityBioReactor) {
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.BIO_REACTOR.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());

View file

@ -14,8 +14,8 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBushBase;
public class BlockBlackLotus extends BlockBushBase {
public BlockBlackLotus(String name) {
super(name);
public BlockBlackLotus() {
super(this.name);
}
}

View file

@ -18,14 +18,14 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityPlacer;
import net.minecraft.block.BlockDirectional;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
@ -36,8 +36,8 @@ public class BlockBreaker extends BlockContainerBase {
private final boolean isPlacer;
public BlockBreaker(boolean isPlacer, String name) {
super(Material.ROCK, name);
public BlockBreaker(boolean isPlacer) {
super(Material.ROCK, this.name);
this.isPlacer = isPlacer;
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
@ -53,7 +53,7 @@ public class BlockBreaker extends BlockContainerBase {
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, Direction par6, float par7, float par8, float par9) {
if (this.tryToggleRedstone(world, pos, player)) {
return true;
}
@ -74,7 +74,7 @@ public class BlockBreaker extends BlockContainerBase {
@Override
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) {
int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal();
int rotation = Direction.getDirectionFromEntityLiving(pos, player).ordinal();
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
super.onBlockPlacedBy(world, pos, state, player, stack);
@ -82,7 +82,7 @@ public class BlockBreaker extends BlockContainerBase {
@Override
public BlockState getStateFromMeta(int meta) {
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
return this.getDefaultState().withProperty(BlockDirectional.FACING, Direction.byIndex(meta));
}
@Override

View file

@ -21,15 +21,15 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class BlockCanolaPress extends BlockContainerBase {
public BlockCanolaPress(String name) {
super(Material.ROCK, name);
public BlockCanolaPress() {
super(Material.ROCK, this.name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
@ -52,7 +52,7 @@ public class BlockCanolaPress extends BlockContainerBase {
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing side, float par7, float par8, float par9) {
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, Direction side, float par7, float par8, float par9) {
if (!world.isRemote) {
TileEntityCanolaPress press = (TileEntityCanolaPress) world.getTileEntity(pos);
if (press != null) {

View file

@ -17,25 +17,28 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoalGenerator;
import net.minecraft.block.BlockHorizontal;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.relauncher.OnlyIn;
import java.util.Random;
public class BlockCoalGenerator extends BlockContainerBase {
public BlockCoalGenerator(String name) {
super(Material.ROCK, name);
public BlockCoalGenerator() {
super(Material.ROCK, this.name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
@ -72,7 +75,7 @@ public class BlockCoalGenerator extends BlockContainerBase {
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, Direction par6, float par7, float par8, float par9) {
if (!world.isRemote) {
TileEntityCoalGenerator press = (TileEntityCoalGenerator) world.getTileEntity(pos);
if (press != null) {
@ -97,7 +100,7 @@ public class BlockCoalGenerator extends BlockContainerBase {
@Override
public BlockState getStateFromMeta(int meta) {
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
return this.getDefaultState().withProperty(BlockHorizontal.FACING, Direction.byHorizontalIndex(meta));
}
@Override

View file

@ -17,14 +17,14 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoffeeMachine;
import net.minecraft.block.BlockHorizontal;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
@ -38,8 +38,8 @@ public class BlockCoffeeMachine extends BlockContainerBase {
private static final AxisAlignedBB AABB = new AxisAlignedBB(0.0625, 0, 0.0625, 1 - 0.0625, 1 - 0.0625 * 2, 1 - 0.0625);
public BlockCoffeeMachine(String name) {
super(Material.ROCK, name);
public BlockCoffeeMachine() {
super(Material.ROCK, this.name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
@ -62,7 +62,7 @@ public class BlockCoffeeMachine extends BlockContainerBase {
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing f6, float f7, float f8, float f9) {
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, Direction f6, float f7, float f8, float f9) {
if (!world.isRemote) {
TileEntityCoffeeMachine machine = (TileEntityCoffeeMachine) world.getTileEntity(pos);
if (machine != null) {
@ -107,7 +107,7 @@ public class BlockCoffeeMachine extends BlockContainerBase {
@Override
public BlockState getStateFromMeta(int meta) {
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
return this.getDefaultState().withProperty(BlockHorizontal.FACING, Direction.byHorizontalIndex(meta));
}
@Override

View file

@ -20,20 +20,20 @@ import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.relauncher.OnlyIn;
import net.minecraftforge.oredict.OreDictionary;
@ -45,7 +45,7 @@ public class BlockColoredLamp extends BlockBase {
public static final PropertyEnum<TheColoredLampColors> TYPE = PropertyEnum.create("type", TheColoredLampColors.class);
public final boolean isOn;
public BlockColoredLamp(boolean isOn, String name) {
public BlockColoredLamp(boolean isOn) {
super(Material.REDSTONE_LIGHT, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(0.5F);
@ -64,7 +64,7 @@ public class BlockColoredLamp extends BlockBase {
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, Direction side, float hitX, float hitY, float hitZ) {
ItemStack stack = player.getHeldItem(hand);
//Turning On
if (hand == Hand.MAIN_HAND && stack.isEmpty()) {

View file

@ -20,8 +20,8 @@ import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.entity.Entity;
@ -30,7 +30,7 @@ import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
@ -38,10 +38,10 @@ import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.OnlyIn;
import org.apache.commons.lang3.tuple.Pair;
@ -56,8 +56,8 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay {
protected static final AxisAlignedBB AABB_WALL_WEST = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.125D, 1.0D, 1.0D);
private static final AxisAlignedBB AABB = new AxisAlignedBB(0.0625, 0, 0.0625, 1 - 0.0625, 11 * 0.0625, 1 - 0.0625);
public BlockCompost(String name) {
super(Material.WOOD, name);
public BlockCompost() {
super(Material.WOOD);
this.setHarvestLevel("axe", 0);
this.setHardness(0.5F);
this.setResistance(5.0F);
@ -90,7 +90,7 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay {
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing f6, float f7, float f8, float f9) {
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, Direction f6, float f7, float f8, float f9) {
ItemStack stackPlayer = player.getHeldItem(hand);
if (!world.isRemote) {
TileEntity tile = world.getTileEntity(pos);

View file

@ -18,14 +18,14 @@ import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.common.IRarity;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.OnlyIn;
public class BlockCrystal extends BlockBase {
@ -35,7 +35,7 @@ public class BlockCrystal extends BlockBase {
private final boolean isEmpowered;
public BlockCrystal(String name, boolean isEmpowered) {
public BlockCrystal(boolean isEmpowered) {
super(Material.ROCK, name);
this.isEmpowered = isEmpowered;
this.setHardness(1.5F);
@ -85,7 +85,9 @@ public class BlockCrystal extends BlockBase {
@Override
public IRarity getRarity(ItemStack stack) {
return stack.getItemDamage() >= ALL_CRYSTALS.length ? EnumRarity.COMMON : ALL_CRYSTALS[stack.getItemDamage()].rarity;
return stack.getItemDamage() >= ALL_CRYSTALS.length
? EnumRarity.COMMON
: ALL_CRYSTALS[stack.getItemDamage()].rarity;
}
public static class TheItemBlock extends ItemBlockBase {
@ -98,7 +100,9 @@ public class BlockCrystal extends BlockBase {
@Override
public String getTranslationKey(ItemStack stack) {
return stack.getItemDamage() >= ALL_CRYSTALS.length ? StringUtil.BUGGED_ITEM_NAME : this.getTranslationKey() + "_" + ALL_CRYSTALS[stack.getItemDamage()].name;
return stack.getItemDamage() >= ALL_CRYSTALS.length
? StringUtil.BUGGED_ITEM_NAME
: this.getTranslationKey() + "_" + ALL_CRYSTALS[stack.getItemDamage()].name;
}
@Override

View file

@ -10,10 +10,6 @@
package de.ellpeck.actuallyadditions.mod.blocks;
import java.util.Random;
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;
@ -23,8 +19,8 @@ import de.ellpeck.actuallyadditions.mod.util.IColorProvidingItem;
import net.minecraft.block.BlockDirectional;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.entity.EntityLivingBase;
@ -33,20 +29,23 @@ import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.relauncher.OnlyIn;
import org.apache.commons.lang3.ArrayUtils;
import java.util.Random;
public class BlockCrystalCluster extends BlockBase implements IColorProvidingBlock, IColorProvidingItem {
private final TheCrystals crystal;
public BlockCrystalCluster(String name, TheCrystals crystal) {
public BlockCrystalCluster(TheCrystals crystal) {
super(Material.GLASS, name);
this.crystal = crystal;
@ -68,7 +67,7 @@ public class BlockCrystalCluster extends BlockBase implements IColorProvidingBlo
}
@Override
public BlockState 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, EntityLivingBase base) {
return this.getStateFromMeta(side.ordinal());
}
@ -79,7 +78,7 @@ public class BlockCrystalCluster extends BlockBase implements IColorProvidingBlo
@Override
public BlockState getStateFromMeta(int meta) {
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
return this.getDefaultState().withProperty(BlockDirectional.FACING, Direction.byIndex(meta));
}
@Override

View file

@ -17,14 +17,14 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityDirectionalBreaker;
import net.minecraft.block.BlockDirectional;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
@ -33,8 +33,8 @@ import net.minecraft.world.World;
public class BlockDirectionalBreaker extends BlockContainerBase {
public BlockDirectionalBreaker(String name) {
super(Material.ROCK, name);
public BlockDirectionalBreaker() {
super(Material.ROCK, this.name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
@ -47,7 +47,7 @@ public class BlockDirectionalBreaker extends BlockContainerBase {
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, Direction par6, float par7, float par8, float par9) {
if (this.tryToggleRedstone(world, pos, player)) {
return true;
}
@ -68,7 +68,7 @@ public class BlockDirectionalBreaker extends BlockContainerBase {
@Override
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) {
int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal();
int rotation = Direction.getDirectionFromEntityLiving(pos, player).ordinal();
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
super.onBlockPlacedBy(world, pos, state, player, stack);
@ -76,7 +76,7 @@ public class BlockDirectionalBreaker extends BlockContainerBase {
@Override
public BlockState getStateFromMeta(int meta) {
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
return this.getDefaultState().withProperty(BlockDirectional.FACING, Direction.byIndex(meta));
}
@Override

View file

@ -22,7 +22,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
@ -31,8 +31,8 @@ import net.minecraft.world.World;
public class BlockDisplayStand extends BlockContainerBase {
public BlockDisplayStand(String name) {
super(Material.ROCK, name);
public BlockDisplayStand() {
super(Material.ROCK, this.name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
@ -51,7 +51,7 @@ public class BlockDisplayStand extends BlockContainerBase {
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, Direction par6, float par7, float par8, float par9) {
ItemStack heldItem = player.getHeldItem(hand);
if (!world.isRemote) {
TileEntityDisplayStand stand = (TileEntityDisplayStand) world.getTileEntity(pos);
@ -101,8 +101,8 @@ public class BlockDisplayStand extends BlockContainerBase {
}
@Override
public BlockFaceShape getBlockFaceShape(IBlockAccess world, BlockState state, BlockPos pos, EnumFacing face) {
if (face == EnumFacing.DOWN) {
public BlockFaceShape getBlockFaceShape(IBlockAccess world, BlockState state, BlockPos pos, Direction face) {
if (face == Direction.DOWN) {
return BlockFaceShape.SOLID;
}
return BlockFaceShape.UNDEFINED;

View file

@ -17,14 +17,14 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityDropper;
import net.minecraft.block.BlockDirectional;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
@ -33,8 +33,8 @@ import net.minecraft.world.World;
public class BlockDropper extends BlockContainerBase {
public BlockDropper(String name) {
super(Material.ROCK, name);
public BlockDropper() {
super(Material.ROCK, this.name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
@ -47,7 +47,7 @@ public class BlockDropper extends BlockContainerBase {
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, Direction par6, float par7, float par8, float par9) {
if (this.tryToggleRedstone(world, pos, player)) {
return true;
}
@ -68,7 +68,7 @@ public class BlockDropper extends BlockContainerBase {
@Override
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) {
int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal();
int rotation = Direction.getDirectionFromEntityLiving(pos, player).ordinal();
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
super.onBlockPlacedBy(world, pos, state, player, stack);
@ -76,7 +76,7 @@ public class BlockDropper extends BlockContainerBase {
@Override
public BlockState getStateFromMeta(int meta) {
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
return this.getDefaultState().withProperty(BlockDirectional.FACING, Direction.byIndex(meta));
}
@Override

View file

@ -21,7 +21,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
@ -30,8 +30,8 @@ import net.minecraft.world.World;
public class BlockEmpowerer extends BlockContainerBase {
public BlockEmpowerer(String name) {
super(Material.ROCK, name);
public BlockEmpowerer() {
super(Material.ROCK, this.name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
@ -50,7 +50,7 @@ public class BlockEmpowerer extends BlockContainerBase {
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, Direction par6, float par7, float par8, float par9) {
ItemStack heldItem = player.getHeldItem(hand);
if (!world.isRemote) {
TileEntityEmpowerer empowerer = (TileEntityEmpowerer) world.getTileEntity(pos);

View file

@ -22,7 +22,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@ -31,8 +31,8 @@ public class BlockEnergizer extends BlockContainerBase {
private final boolean isEnergizer;
public BlockEnergizer(boolean isEnergizer, String name) {
super(Material.ROCK, name);
public BlockEnergizer(boolean isEnergizer) {
super(Material.ROCK, this.name);
this.isEnergizer = isEnergizer;
this.setHarvestLevel("pickaxe", 0);
this.setHardness(2.0F);
@ -48,7 +48,7 @@ public class BlockEnergizer extends BlockContainerBase {
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, Direction par6, float par7, float par8, float par9) {
if (!world.isRemote) {
if (this.isEnergizer) {
TileEntityEnergizer energizer = (TileEntityEnergizer) world.getTileEntity(pos);

View file

@ -17,14 +17,14 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityFarmer;
import net.minecraft.block.BlockHorizontal;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
@ -33,8 +33,8 @@ import net.minecraft.world.World;
public class BlockFarmer extends BlockContainerBase {
public BlockFarmer(String name) {
super(Material.ROCK, name);
public BlockFarmer() {
super(Material.ROCK, this.name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
@ -47,7 +47,7 @@ public class BlockFarmer extends BlockContainerBase {
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, Direction par6, float par7, float par8, float par9) {
if (!world.isRemote) {
TileEntityFarmer farmer = (TileEntityFarmer) world.getTileEntity(pos);
if (farmer != null) {
@ -72,7 +72,7 @@ public class BlockFarmer extends BlockContainerBase {
@Override
public BlockState getStateFromMeta(int meta) {
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
return this.getDefaultState().withProperty(BlockHorizontal.FACING, Direction.byHorizontalIndex(meta));
}
@Override

View file

@ -21,15 +21,15 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class BlockFeeder extends BlockContainerBase {
public BlockFeeder(String name) {
super(Material.ROCK, name);
public BlockFeeder() {
super(Material.ROCK, this.name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(0.5F);
this.setResistance(6.0F);
@ -42,7 +42,7 @@ public class BlockFeeder extends BlockContainerBase {
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, Direction par6, float par7, float par8, float par9) {
if (!world.isRemote) {
TileEntityFeeder feeder = (TileEntityFeeder) world.getTileEntity(pos);
if (feeder != null) {

View file

@ -21,15 +21,15 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class BlockFermentingBarrel extends BlockContainerBase {
public BlockFermentingBarrel(String name) {
super(Material.WOOD, name);
public BlockFermentingBarrel() {
super(Material.WOOD, this.name);
this.setHarvestLevel("axe", 0);
this.setHardness(0.5F);
this.setResistance(5.0F);
@ -52,7 +52,7 @@ public class BlockFermentingBarrel extends BlockContainerBase {
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, Direction par6, float par7, float par8, float par9) {
if (!world.isRemote) {
TileEntityFermentingBarrel press = (TileEntityFermentingBarrel) world.getTileEntity(pos);
if (press != null) {

View file

@ -21,15 +21,15 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class BlockFireworkBox extends BlockContainerBase {
public BlockFireworkBox(String name) {
super(Material.ROCK, name);
public BlockFireworkBox() {
super(Material.ROCK, this.name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
@ -37,7 +37,7 @@ public class BlockFireworkBox extends BlockContainerBase {
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, Direction par6, float par7, float par8, float par9) {
if (this.tryToggleRedstone(world, pos, player)) {
return true;
} else if (!world.isRemote) {

View file

@ -27,8 +27,8 @@ public class BlockFishingNet extends BlockContainerBase {
private static final AxisAlignedBB AABB = new AxisAlignedBB(0, 0, 0, 1, 0.0625, 1);
public BlockFishingNet(String name) {
super(Material.WOOD, name);
public BlockFishingNet() {
super(Material.WOOD, this.name);
this.setHarvestLevel("axe", 0);
this.setHardness(0.5F);
this.setResistance(3.0F);

View file

@ -18,14 +18,14 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityFluidPlacer;
import net.minecraft.block.BlockDirectional;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
@ -36,8 +36,8 @@ public class BlockFluidCollector extends BlockContainerBase {
private final boolean isPlacer;
public BlockFluidCollector(boolean isPlacer, String name) {
super(Material.ROCK, name);
public BlockFluidCollector(boolean isPlacer) {
super(Material.ROCK, this.name);
this.isPlacer = isPlacer;
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
@ -53,7 +53,7 @@ public class BlockFluidCollector extends BlockContainerBase {
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, Direction par6, float par7, float par8, float par9) {
if (this.tryToggleRedstone(world, pos, player)) {
return true;
}
@ -76,7 +76,7 @@ public class BlockFluidCollector extends BlockContainerBase {
@Override
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) {
int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal();
int rotation = Direction.getDirectionFromEntityLiving(pos, player).ordinal();
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
super.onBlockPlacedBy(world, pos, state, player, stack);
@ -84,7 +84,7 @@ public class BlockFluidCollector extends BlockContainerBase {
@Override
public BlockState getStateFromMeta(int meta) {
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
return this.getDefaultState().withProperty(BlockDirectional.FACING, Direction.byIndex(meta));
}
@Override

View file

@ -21,20 +21,23 @@ import net.minecraft.block.BlockHorizontal;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.relauncher.OnlyIn;
import java.util.List;
@ -44,8 +47,8 @@ public class BlockFurnaceDouble extends BlockContainerBase {
public static final PropertyBool IS_ON = PropertyBool.create("on");
public BlockFurnaceDouble(String name) {
super(Material.ROCK, name);
public BlockFurnaceDouble() {
super(Material.ROCK, this.name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
@ -69,7 +72,7 @@ public class BlockFurnaceDouble extends BlockContainerBase {
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, Direction par6, float par7, float par8, float par9) {
if (!world.isRemote) {
TileEntityFurnaceDouble furnace = (TileEntityFurnaceDouble) world.getTileEntity(pos);
if (furnace != null) {
@ -102,7 +105,7 @@ public class BlockFurnaceDouble extends BlockContainerBase {
@Override
public BlockState getStateFromMeta(int meta) {
boolean isOn = meta >= 4;
EnumFacing facing = EnumFacing.byHorizontalIndex(isOn
Direction facing = Direction.byHorizontalIndex(isOn
? meta - 4
: meta);
return this.getDefaultState().withProperty(BlockHorizontal.FACING, facing).withProperty(IS_ON, isOn);

View file

@ -27,8 +27,8 @@ public class BlockFurnaceSolar extends BlockContainerBase {
private static final AxisAlignedBB AABB = new AxisAlignedBB(0, 0, 0, 1, 6 * 0.0625, 1);
public BlockFurnaceSolar(String name) {
super(Material.ROCK, name);
public BlockFurnaceSolar() {
super(Material.ROCK, this.name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);

View file

@ -18,8 +18,8 @@ import net.minecraft.item.ItemStack;
public class BlockGeneric extends BlockBase {
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, "pickaxe", 0);
}
public BlockGeneric(String name, Material material, SoundType sound, float hardness, float resistance, String harvestTool, int harvestLevel) {

View file

@ -34,7 +34,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.ListNBT;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
@ -83,7 +83,7 @@ public class BlockGiantChest extends BlockContainerBase {
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, Direction par6, float par7, float par8, float par9) {
if (!world.isRemote) {
TileEntityGiantChest chest = (TileEntityGiantChest) world.getTileEntity(pos);
if (chest != null) {

View file

@ -10,10 +10,6 @@
package de.ellpeck.actuallyadditions.mod.blocks;
import java.util.Random;
import org.apache.commons.lang3.tuple.Triple;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
import net.minecraft.block.Block;
import net.minecraft.block.IGrowable;
@ -23,16 +19,19 @@ import net.minecraft.block.state.BlockState;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.relauncher.OnlyIn;
import org.apache.commons.lang3.tuple.Triple;
import java.util.Random;
public class BlockGreenhouseGlass extends BlockBase {
public BlockGreenhouseGlass(String name) {
public BlockGreenhouseGlass() {
super(Material.GLASS, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(0.5F);
@ -59,7 +58,7 @@ public class BlockGreenhouseGlass extends BlockBase {
@Override
@Deprecated
@OnlyIn(Dist.CLIENT)
public boolean shouldSideBeRendered(BlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) {
public boolean shouldSideBeRendered(BlockState state, IBlockAccess world, BlockPos pos, Direction side) {
BlockState otherState = world.getBlockState(pos.offset(side));
Block block = otherState.getBlock();
@ -79,18 +78,28 @@ public class BlockGreenhouseGlass extends BlockBase {
@Override
public void updateTick(World world, BlockPos pos, BlockState state, Random rand) {
if (world.isRemote) return;
if (world.isRemote) {
return;
}
if (world.canBlockSeeSky(pos) && world.isDaytime()) {
Triple<BlockPos, BlockState, IGrowable> trip = firstBlock(world, pos);
Triple<BlockPos, BlockState, IGrowable> trip = this.firstBlock(world, pos);
boolean once = false;
if (trip != null) for (int i = 0; i < 3; i++) {
BlockState growState = i == 0 ? trip.getMiddle() : world.getBlockState(trip.getLeft());
if (trip != null) {
for (int i = 0; i < 3; i++) {
BlockState growState = i == 0
? trip.getMiddle()
: world.getBlockState(trip.getLeft());
if (growState.getBlock() == trip.getRight() && trip.getRight().canGrow(world, trip.getLeft(), growState, false)) {
trip.getRight().grow(world, rand, trip.getLeft(), growState);
once = true;
}
}
if (once) world.playEvent(2005, trip.getMiddle().isOpaqueCube() ? trip.getLeft().up() : trip.getLeft(), 0);
}
if (once) {
world.playEvent(2005, trip.getMiddle().isOpaqueCube()
? trip.getLeft().up()
: trip.getLeft(), 0);
}
}
}
@ -98,11 +107,16 @@ public class BlockGreenhouseGlass extends BlockBase {
BlockPos.MutableBlockPos mut = new BlockPos.MutableBlockPos(glassPos);
while (true) {
mut.setPos(mut.getX(), mut.getY() - 1, mut.getZ());
if (mut.getY() < 0) return null;
if (mut.getY() < 0) {
return null;
}
BlockState state = world.getBlockState(mut);
if (state.isOpaqueCube() || state.getBlock() instanceof IGrowable || state.getBlock() == this) {
if (state.getBlock() instanceof IGrowable) return Triple.of(mut.toImmutable(), state, (IGrowable) state.getBlock());
else return null;
if (state.getBlock() instanceof IGrowable) {
return Triple.of(mut.toImmutable(), state, (IGrowable) state.getBlock());
} else {
return null;
}
}
}
}

View file

@ -17,19 +17,19 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityGrinder;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGrinderDouble;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.relauncher.OnlyIn;
import java.util.Random;
@ -38,8 +38,8 @@ public class BlockGrinder extends BlockContainerBase {
private final boolean isDouble;
public BlockGrinder(boolean isDouble, String name) {
super(Material.ROCK, name);
public BlockGrinder(boolean isDouble) {
super(Material.ROCK, this.name);
this.isDouble = isDouble;
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
@ -69,7 +69,7 @@ public class BlockGrinder extends BlockContainerBase {
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, Direction par6, float par7, float par8, float par9) {
if (!world.isRemote) {
TileEntityGrinder grinder = (TileEntityGrinder) world.getTileEntity(pos);
if (grinder != null) {

View file

@ -21,8 +21,8 @@ import net.minecraft.world.World;
public class BlockHeatCollector extends BlockContainerBase {
public BlockHeatCollector(String name) {
super(Material.ROCK, name);
public BlockHeatCollector() {
super(Material.ROCK, this.name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(2.5F);
this.setResistance(10.0F);

View file

@ -26,7 +26,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@ -39,8 +39,8 @@ public class BlockInputter extends BlockContainerBase {
public final boolean isAdvanced;
public BlockInputter(boolean isAdvanced, String name) {
super(Material.ROCK, name);
public BlockInputter(boolean isAdvanced) {
super(Material.ROCK, this.name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
@ -57,7 +57,7 @@ public class BlockInputter extends BlockContainerBase {
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, Direction par6, float par7, float par8, float par9) {
if (!world.isRemote) {
TileEntityInputter inputter = (TileEntityInputter) world.getTileEntity(pos);
if (inputter != null) {

View file

@ -21,7 +21,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
@ -29,8 +29,8 @@ import net.minecraft.world.World;
public class BlockItemRepairer extends BlockContainerBase {
public BlockItemRepairer(String name) {
super(Material.ROCK, name);
public BlockItemRepairer() {
super(Material.ROCK, this.name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(20.0F);
this.setResistance(15.0F);
@ -44,7 +44,7 @@ public class BlockItemRepairer extends BlockContainerBase {
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, Direction par6, float par7, float par8, float par9) {
if (!world.isRemote) {
TileEntityItemRepairer repairer = (TileEntityItemRepairer) world.getTileEntity(pos);
if (repairer != null) {

View file

@ -21,8 +21,8 @@ import net.minecraft.world.World;
public class BlockItemViewer extends BlockContainerBase {
public BlockItemViewer(String name) {
super(Material.ROCK, name);
public BlockItemViewer() {
super(Material.ROCK, this.name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);

View file

@ -10,30 +10,30 @@
package de.ellpeck.actuallyadditions.mod.blocks;
import java.util.List;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemViewerHopping;
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
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.fml.relauncher.Side;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.relauncher.OnlyIn;
import java.util.List;
//Most of this is just copied from BlockHopper, no credit taken. Or clue what it is.
public class BlockItemViewerHopping extends BlockItemViewer {
public static final PropertyDirection FACING = PropertyDirection.create("facing", facing -> facing != EnumFacing.UP);
public static final PropertyDirection FACING = PropertyDirection.create("facing", facing -> facing != Direction.UP);
private static final AxisAlignedBB BASE_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.625D, 1.0D);
private static final AxisAlignedBB SOUTH_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.125D);
@ -41,8 +41,8 @@ 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) {
super(name);
public BlockItemViewerHopping() {
super(this.name);
}
@Override
@ -53,11 +53,11 @@ public class BlockItemViewerHopping extends BlockItemViewer {
@Override
@Deprecated
public void addCollisionBoxToList(BlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, Entity entityIn, boolean someBool) {
addCollisionBoxToList(pos, entityBox, collidingBoxes, BASE_AABB);
addCollisionBoxToList(pos, entityBox, collidingBoxes, EAST_AABB);
addCollisionBoxToList(pos, entityBox, collidingBoxes, WEST_AABB);
addCollisionBoxToList(pos, entityBox, collidingBoxes, SOUTH_AABB);
addCollisionBoxToList(pos, entityBox, collidingBoxes, NORTH_AABB);
this.addCollisionBoxToList(pos, entityBox, collidingBoxes, BASE_AABB);
this.addCollisionBoxToList(pos, entityBox, collidingBoxes, EAST_AABB);
this.addCollisionBoxToList(pos, entityBox, collidingBoxes, WEST_AABB);
this.addCollisionBoxToList(pos, entityBox, collidingBoxes, SOUTH_AABB);
this.addCollisionBoxToList(pos, entityBox, collidingBoxes, NORTH_AABB);
}
@Override
@ -66,9 +66,11 @@ public class BlockItemViewerHopping extends BlockItemViewer {
}
@Override
public BlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) {
EnumFacing opp = facing.getOpposite();
return this.getDefaultState().withProperty(FACING, opp == EnumFacing.UP ? EnumFacing.DOWN : opp);
public BlockState getStateForPlacement(World worldIn, BlockPos pos, Direction facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) {
Direction opp = facing.getOpposite();
return this.getDefaultState().withProperty(FACING, opp == Direction.UP
? Direction.DOWN
: opp);
}
@Override //was isFullyOpaque, not sure if correct change.
@ -88,7 +90,7 @@ public class BlockItemViewerHopping extends BlockItemViewer {
@Override
@OnlyIn(Dist.CLIENT)
public boolean shouldSideBeRendered(BlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
public boolean shouldSideBeRendered(BlockState blockState, IBlockAccess blockAccess, BlockPos pos, Direction side) {
return true;
}
@ -99,7 +101,7 @@ public class BlockItemViewerHopping extends BlockItemViewer {
@Override
public BlockState getStateFromMeta(int meta) {
return this.getDefaultState().withProperty(FACING, EnumFacing.byIndex(meta));
return this.getDefaultState().withProperty(FACING, Direction.byIndex(meta));
}
@Override

View file

@ -10,29 +10,29 @@
package de.ellpeck.actuallyadditions.mod.blocks;
import java.util.ArrayList;
import java.util.List;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
import net.minecraft.block.Block;
import net.minecraft.block.BlockDirectional;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import java.util.ArrayList;
import java.util.List;
public class BlockLampPowerer extends BlockBase {
public BlockLampPowerer(String name) {
public BlockLampPowerer() {
super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
@ -52,7 +52,7 @@ public class BlockLampPowerer extends BlockBase {
@Override
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) {
int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal();
int rotation = Direction.getDirectionFromEntityLiving(pos, player).ordinal();
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
super.onBlockPlacedBy(world, pos, state, player, stack);
@ -86,7 +86,7 @@ public class BlockLampPowerer extends BlockBase {
}
private void updateSurrounding(World world, BlockPos pos, boolean powered, List<BlockPos> updatedAlready) {
for (EnumFacing side : EnumFacing.values()) {
for (Direction side : Direction.values()) {
BlockPos offset = pos.offset(side);
if (!updatedAlready.contains(offset)) {
updatedAlready.add(pos);
@ -102,7 +102,7 @@ public class BlockLampPowerer extends BlockBase {
@Override
public BlockState getStateFromMeta(int meta) {
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
return this.getDefaultState().withProperty(BlockDirectional.FACING, Direction.byIndex(meta));
}
@Override

View file

@ -26,8 +26,8 @@ import net.minecraft.block.BlockDirectional;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockFaceShape;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.entity.EntityLivingBase;
@ -35,7 +35,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
@ -45,11 +45,11 @@ import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.OnlyIn;
public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay {
@ -65,8 +65,8 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay {
private final Type type;
public BlockLaserRelay(String name, Type type) {
super(Material.ROCK, name);
public BlockLaserRelay(Type type) {
super(Material.ROCK, this.name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
@ -125,7 +125,7 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay {
}
@Override
public BlockState 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, EntityLivingBase base) {
return this.getStateFromMeta(side.ordinal());
}
@ -136,7 +136,7 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay {
@Override
public BlockState getStateFromMeta(int meta) {
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
return this.getDefaultState().withProperty(BlockDirectional.FACING, Direction.byIndex(meta));
}
@Override
@ -160,7 +160,7 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay {
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, Direction par6, float par7, float par8, float par9) {
ItemStack stack = player.getHeldItem(hand);
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileEntityLaserRelay) {
@ -280,7 +280,7 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay {
}
@Override
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, BlockState state, BlockPos pos, EnumFacing face) {
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, BlockState state, BlockPos pos, Direction face) {
return BlockFaceShape.UNDEFINED;
}

View file

@ -24,13 +24,13 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.relauncher.OnlyIn;
public class BlockLavaFactoryController extends BlockContainerBase implements IHudDisplay {
public BlockLavaFactoryController(String name) {
super(Material.ROCK, name);
public BlockLavaFactoryController() {
super(Material.ROCK, this.name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(4.5F);
this.setResistance(20.0F);

View file

@ -21,8 +21,8 @@ import net.minecraft.world.World;
public class BlockLeafGenerator extends BlockContainerBase {
public BlockLeafGenerator(String name) {
super(Material.IRON, name);
public BlockLeafGenerator() {
super(Material.IRON, this.name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(5.0F);
this.setResistance(10.0F);

View file

@ -24,18 +24,18 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.relauncher.OnlyIn;
public class BlockMiner extends BlockContainerBase implements IHudDisplay {
public BlockMiner(String name) {
super(Material.ROCK, name);
public BlockMiner() {
super(Material.ROCK, this.name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(8F);
this.setResistance(30F);
@ -48,7 +48,7 @@ public class BlockMiner extends BlockContainerBase implements IHudDisplay {
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, Direction par6, float par7, float par8, float par9) {
if (!world.isRemote) {
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileEntityMiner) {

View file

@ -18,8 +18,8 @@ import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
@ -30,8 +30,8 @@ public class BlockMisc extends BlockBase {
public static final TheMiscBlocks[] ALL_MISC_BLOCKS = TheMiscBlocks.values();
public static final PropertyEnum<TheMiscBlocks> TYPE = PropertyEnum.create("type", TheMiscBlocks.class);
public BlockMisc(String name) {
super(Material.ROCK, name);
public BlockMisc() {
super(Material.ROCK);
this.setHardness(1.5F);
this.setResistance(10.0F);
this.setHarvestLevel("pickaxe", 1);
@ -63,7 +63,9 @@ public class BlockMisc extends BlockBase {
@Override
public EnumRarity getRarity(ItemStack stack) {
return stack.getItemDamage() >= ALL_MISC_BLOCKS.length ? EnumRarity.COMMON : ALL_MISC_BLOCKS[stack.getItemDamage()].rarity;
return stack.getItemDamage() >= ALL_MISC_BLOCKS.length
? EnumRarity.COMMON
: ALL_MISC_BLOCKS[stack.getItemDamage()].rarity;
}
@Override
@ -91,12 +93,16 @@ public class BlockMisc extends BlockBase {
@Override
public String getTranslationKey(ItemStack stack) {
return stack.getItemDamage() >= ALL_MISC_BLOCKS.length ? StringUtil.BUGGED_ITEM_NAME : this.getTranslationKey() + "_" + ALL_MISC_BLOCKS[stack.getItemDamage()].name;
return stack.getItemDamage() >= ALL_MISC_BLOCKS.length
? StringUtil.BUGGED_ITEM_NAME
: this.getTranslationKey() + "_" + ALL_MISC_BLOCKS[stack.getItemDamage()].name;
}
@Override
public int getItemBurnTime(ItemStack stack) {
if (stack.getMetadata() == TheMiscBlocks.CHARCOAL_BLOCK.ordinal()) return 16000;
if (stack.getMetadata() == TheMiscBlocks.CHARCOAL_BLOCK.ordinal()) {
return 16000;
}
return super.getItemBurnTime(stack);
}
}

View file

@ -17,25 +17,28 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityOilGenerator;
import net.minecraft.block.BlockHorizontal;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.relauncher.OnlyIn;
import java.util.Random;
public class BlockOilGenerator extends BlockContainerBase {
public BlockOilGenerator(String name) {
super(Material.ROCK, name);
public BlockOilGenerator() {
super(Material.ROCK, this.name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
@ -72,7 +75,7 @@ public class BlockOilGenerator extends BlockContainerBase {
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, Direction par6, float par7, float par8, float par9) {
if (!world.isRemote) {
TileEntityOilGenerator generator = (TileEntityOilGenerator) world.getTileEntity(pos);
if (generator != null) {
@ -99,7 +102,7 @@ public class BlockOilGenerator extends BlockContainerBase {
@Override
public BlockState getStateFromMeta(int meta) {
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
return this.getDefaultState().withProperty(BlockHorizontal.FACING, Direction.byHorizontalIndex(meta));
}
@Override

View file

@ -26,7 +26,7 @@ import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
@ -35,15 +35,15 @@ import net.minecraft.util.math.Vec3d;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.relauncher.OnlyIn;
public class BlockPhantom extends BlockContainerBase implements IHudDisplay {
public final Type type;
public BlockPhantom(Type type, String name) {
super(Material.ROCK, name);
public BlockPhantom(Type type) {
super(Material.ROCK, this.name);
this.type = type;
this.setHarvestLevel("pickaxe", 0);
this.setHardness(4.5F);
@ -57,7 +57,7 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay {
}
@Override
public int getWeakPower(BlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) {
public int getWeakPower(BlockState state, IBlockAccess world, BlockPos pos, Direction side) {
if (this.type == Type.REDSTONEFACE) {
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileEntityPhantomRedstoneface) {
@ -68,7 +68,7 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay {
}
@Override
public int getStrongPower(BlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) {
public int getStrongPower(BlockState state, IBlockAccess world, BlockPos pos, Direction side) {
if (this.type == Type.REDSTONEFACE) {
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileEntityPhantomRedstoneface) {
@ -102,7 +102,7 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay {
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, Direction side, float hitX, float hitY, float hitZ) {
if (this.tryToggleRedstone(world, pos, player)) {
return true;
}

View file

@ -27,8 +27,8 @@ public class BlockPhantomBooster extends BlockContainerBase {
private static final AxisAlignedBB AABB = new AxisAlignedBB(2 * 0.0625, 0, 2 * 0.0625, 1 - 2 * 0.0625, 1, 1 - 2 * 0.0625);
public BlockPhantomBooster(String name) {
super(Material.ROCK, name);
public BlockPhantomBooster() {
super(Material.ROCK, this.name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);

View file

@ -27,13 +27,13 @@ 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.fml.relauncher.Side;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.relauncher.OnlyIn;
public class BlockPlayerInterface extends BlockContainerBase implements IHudDisplay {
public BlockPlayerInterface(String name) {
super(Material.ROCK, name);
public BlockPlayerInterface() {
super(Material.ROCK, this.name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(4.5F);
this.setResistance(10.0F);
@ -73,7 +73,9 @@ public class BlockPlayerInterface extends BlockContainerBase implements IHudDisp
if (tile != null) {
if (tile instanceof TileEntityPlayerInterface) {
TileEntityPlayerInterface face = (TileEntityPlayerInterface) tile;
String name = face.playerName == null ? "Unknown" : face.playerName;
String name = face.playerName == null
? "Unknown"
: face.playerName;
minecraft.fontRenderer.drawStringWithShadow("Bound to: " + TextFormatting.RED + name, resolution.getScaledWidth() / 2 + 5, resolution.getScaledHeight() / 2 + 5, StringUtil.DECIMAL_COLOR_WHITE);
minecraft.fontRenderer.drawStringWithShadow("UUID: " + TextFormatting.DARK_GREEN + face.connectedPlayer, resolution.getScaledWidth() / 2 + 5, resolution.getScaledHeight() / 2 + 15, StringUtil.DECIMAL_COLOR_WHITE);
}

View file

@ -21,15 +21,15 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class BlockRangedCollector extends BlockContainerBase {
public BlockRangedCollector(String name) {
super(Material.ROCK, name);
public BlockRangedCollector() {
super(Material.ROCK, this.name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
@ -42,7 +42,7 @@ public class BlockRangedCollector extends BlockContainerBase {
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, Direction par6, float par7, float par8, float par9) {
if (this.tryToggleRedstone(world, pos, player)) {
return true;
}

View file

@ -10,10 +10,6 @@
package de.ellpeck.actuallyadditions.mod.blocks;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityShockSuppressor;
import net.minecraft.block.SoundType;
@ -28,10 +24,14 @@ import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.world.ExplosionEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class BlockShockSuppressor extends BlockContainerBase {
public BlockShockSuppressor(String name) {
super(Material.ROCK, name);
public BlockShockSuppressor() {
super(Material.ROCK, this.name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(20.0F);
this.setResistance(2000.0F);

View file

@ -23,7 +23,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.AxisAlignedBB;
@ -62,7 +62,7 @@ public class BlockSlabs extends BlockBase {
}
@Override
public BlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) {
public BlockState getStateForPlacement(World world, BlockPos pos, Direction facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) {
if (facing.ordinal() == 1) {
return this.getStateFromMeta(meta);
}
@ -117,14 +117,14 @@ public class BlockSlabs extends BlockBase {
}
@Override
public EnumActionResult onItemUse(PlayerEntity player, World world, BlockPos pos, Hand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
public EnumActionResult onItemUse(PlayerEntity player, World world, BlockPos pos, Hand hand, Direction facing, float hitX, float hitY, float hitZ) {
ItemStack stack = player.getHeldItem(hand);
if (StackUtil.isValid(stack) && player.canPlayerEdit(pos.offset(facing), facing, stack)) {
BlockState state = world.getBlockState(pos);
if (state.getBlock() == this.block) {
BlockSlabs theBlock = (BlockSlabs) this.block;
if (facing == EnumFacing.UP && state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.BOTTOM || facing == EnumFacing.DOWN && state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP) {
if (facing == Direction.UP && state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.BOTTOM || facing == Direction.DOWN && state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP) {
BlockState newState = theBlock.fullBlockState;
AxisAlignedBB bound = newState.getCollisionBoundingBox(world, pos);
@ -148,11 +148,11 @@ public class BlockSlabs extends BlockBase {
@Override
@OnlyIn(Dist.CLIENT)
public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side, PlayerEntity player, ItemStack stack) {
public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, Direction side, PlayerEntity player, ItemStack stack) {
BlockState state = worldIn.getBlockState(pos);
if (state.getBlock() == this.block) {
if (side == EnumFacing.UP && state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.BOTTOM || side == EnumFacing.DOWN && state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP) {
if (side == Direction.UP && state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.BOTTOM || side == Direction.DOWN && state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP) {
return true;
}
}

View file

@ -17,25 +17,28 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntitySmileyCloud;
import net.minecraft.block.BlockHorizontal;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.relauncher.OnlyIn;
import java.util.Random;
public class BlockSmileyCloud extends BlockContainerBase {
public BlockSmileyCloud(String name) {
super(Material.CLOTH, name);
public BlockSmileyCloud() {
super(Material.CLOTH, this.name);
this.setHardness(0.5F);
this.setResistance(5.0F);
this.setSoundType(SoundType.CLOTH);
@ -66,7 +69,7 @@ public class BlockSmileyCloud extends BlockContainerBase {
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing f6, float f7, float f8, float f9) {
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, Direction f6, float f7, float f8, float f9) {
if (!world.isRemote) {
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileEntitySmileyCloud) {
@ -97,7 +100,7 @@ public class BlockSmileyCloud extends BlockContainerBase {
@Override
public BlockState getStateFromMeta(int meta) {
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
return this.getDefaultState().withProperty(BlockHorizontal.FACING, Direction.byHorizontalIndex(meta));
}
@Override

View file

@ -10,31 +10,28 @@
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.material.Material;
import net.minecraft.block.state.BlockFaceShape;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.Direction;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
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.fml.relauncher.Side;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.relauncher.OnlyIn;
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 {
@ -47,9 +44,9 @@ 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) {
public BlockTinyTorch() {
super(Material.CIRCUITS, name);
this.setDefaultState(this.blockState.getBaseState().withProperty(BlockTorch.FACING, EnumFacing.UP));
this.setDefaultState(this.blockState.getBaseState().withProperty(BlockTorch.FACING, Direction.UP));
this.setTickRandomly(true);
this.setHardness(0.0F);
@ -95,37 +92,41 @@ public class BlockTinyTorch extends BlockBase {
}
@Override
public BlockFaceShape getBlockFaceShape(IBlockAccess world, BlockState state, BlockPos pos, EnumFacing facing) {
public BlockFaceShape getBlockFaceShape(IBlockAccess world, BlockState state, BlockPos pos, Direction facing) {
return BlockFaceShape.UNDEFINED;
}
private boolean canPlaceOn(World worldIn, BlockPos pos) {
BlockState state = worldIn.getBlockState(pos);
return state.isSideSolid(worldIn, pos, EnumFacing.UP) || state.getBlock().canPlaceTorchOnTop(state, worldIn, pos);
return state.isSideSolid(worldIn, pos, Direction.UP) || state.getBlock().canPlaceTorchOnTop(state, worldIn, pos);
}
@Override
public boolean canPlaceBlockAt(World worldIn, BlockPos pos) {
for (EnumFacing enumfacing : BlockTorch.FACING.getAllowedValues()) {
if (this.canPlaceAt(worldIn, pos, enumfacing)) { return true; }
for (Direction enumfacing : BlockTorch.FACING.getAllowedValues()) {
if (this.canPlaceAt(worldIn, pos, enumfacing)) {
return true;
}
}
return false;
}
private boolean canPlaceAt(World worldIn, BlockPos pos, EnumFacing facing) {
private boolean canPlaceAt(World worldIn, BlockPos pos, Direction facing) {
BlockPos blockpos = pos.offset(facing.getOpposite());
boolean flag = facing.getAxis().isHorizontal();
return flag && worldIn.isSideSolid(blockpos, facing, true) || facing.equals(EnumFacing.UP) && this.canPlaceOn(worldIn, blockpos);
return flag && worldIn.isSideSolid(blockpos, facing, true) || facing.equals(Direction.UP) && this.canPlaceOn(worldIn, blockpos);
}
@Override
public BlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) {
public BlockState getStateForPlacement(World worldIn, BlockPos pos, Direction facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) {
if (this.canPlaceAt(worldIn, pos, facing)) {
return this.getDefaultState().withProperty(BlockTorch.FACING, facing);
} else {
for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) {
if (worldIn.isSideSolid(pos.offset(enumfacing.getOpposite()), enumfacing, true)) { return this.getDefaultState().withProperty(BlockTorch.FACING, enumfacing); }
for (Direction enumfacing : Direction.Plane.HORIZONTAL) {
if (worldIn.isSideSolid(pos.offset(enumfacing.getOpposite()), enumfacing, true)) {
return this.getDefaultState().withProperty(BlockTorch.FACING, enumfacing);
}
}
return this.getDefaultState();
@ -146,9 +147,9 @@ public class BlockTinyTorch extends BlockBase {
if (!this.checkForDrop(worldIn, pos, state)) {
return true;
} else {
EnumFacing enumfacing = state.getValue(BlockTorch.FACING);
EnumFacing.Axis axis = enumfacing.getAxis();
EnumFacing enumfacing1 = enumfacing.getOpposite();
Direction enumfacing = state.getValue(BlockTorch.FACING);
Direction.Axis axis = enumfacing.getAxis();
Direction enumfacing1 = enumfacing.getOpposite();
boolean flag = false;
if (axis.isHorizontal() && !worldIn.isSideSolid(pos.offset(enumfacing1), enumfacing, true)) {
@ -184,13 +185,13 @@ public class BlockTinyTorch extends BlockBase {
@OnlyIn(Dist.CLIENT)
public void randomDisplayTick(BlockState stateIn, World worldIn, BlockPos pos, Random rand) {
if (rand.nextBoolean()) {
EnumFacing enumfacing = stateIn.getValue(BlockTorch.FACING);
Direction enumfacing = stateIn.getValue(BlockTorch.FACING);
double d0 = pos.getX() + 0.5D;
double d1 = pos.getY() + 0.4D;
double d2 = pos.getZ() + 0.5D;
if (enumfacing.getAxis().isHorizontal()) {
EnumFacing enumfacing1 = enumfacing.getOpposite();
Direction enumfacing1 = enumfacing.getOpposite();
worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 + 0.35D * enumfacing1.getXOffset(), d1 + 0.22D, d2 + 0.35D * enumfacing1.getZOffset(), 0.0D, 0.0D, 0.0D);
worldIn.spawnParticle(EnumParticleTypes.FLAME, d0 + 0.35D * enumfacing1.getXOffset(), d1 + 0.22D, d2 + 0.35D * enumfacing1.getZOffset(), 0.0D, 0.0D, 0.0D);
} else {
@ -206,20 +207,20 @@ public class BlockTinyTorch extends BlockBase {
switch (meta) {
case 1:
iblockstate = iblockstate.withProperty(BlockTorch.FACING, EnumFacing.EAST);
iblockstate = iblockstate.withProperty(BlockTorch.FACING, Direction.EAST);
break;
case 2:
iblockstate = iblockstate.withProperty(BlockTorch.FACING, EnumFacing.WEST);
iblockstate = iblockstate.withProperty(BlockTorch.FACING, Direction.WEST);
break;
case 3:
iblockstate = iblockstate.withProperty(BlockTorch.FACING, EnumFacing.SOUTH);
iblockstate = iblockstate.withProperty(BlockTorch.FACING, Direction.SOUTH);
break;
case 4:
iblockstate = iblockstate.withProperty(BlockTorch.FACING, EnumFacing.NORTH);
iblockstate = iblockstate.withProperty(BlockTorch.FACING, Direction.NORTH);
break;
case 5:
default:
iblockstate = iblockstate.withProperty(BlockTorch.FACING, EnumFacing.UP);
iblockstate = iblockstate.withProperty(BlockTorch.FACING, Direction.UP);
}
return iblockstate;

View file

@ -16,13 +16,12 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
import net.minecraft.block.BlockHorizontal;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.init.Items;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@ -30,14 +29,14 @@ import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.relauncher.OnlyIn;
import java.util.Random;
public class BlockTreasureChest extends BlockBase {
public BlockTreasureChest(String name) {
public BlockTreasureChest() {
super(Material.WOOD, name);
this.setHarvestLevel("axe", 0);
this.setHardness(300.0F);
@ -64,7 +63,7 @@ public class BlockTreasureChest extends BlockBase {
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, Direction par6, float par7, float par8, float par9) {
if (!world.isRemote) {
world.playSound(null, pos, SoundEvents.BLOCK_CHEST_OPEN, SoundCategory.BLOCKS, 0.2F, world.rand.nextFloat() * 0.1F + 0.9F);
this.dropItems(world, pos);
@ -112,7 +111,7 @@ public class BlockTreasureChest extends BlockBase {
@Override
public BlockState getStateFromMeta(int meta) {
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
return this.getDefaultState().withProperty(BlockHorizontal.FACING, Direction.byHorizontalIndex(meta));
}
@Override

View file

@ -15,17 +15,17 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockFenceGate;
import net.minecraft.block.BlockWall;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.relauncher.OnlyIn;
public class BlockWallAA extends BlockBase {
@ -34,7 +34,7 @@ public class BlockWallAA extends BlockBase {
protected static final AxisAlignedBB[] CLIP_AABB_BY_INDEX = new AxisAlignedBB[]{AABB_BY_INDEX[0].setMaxY(1.5D), AABB_BY_INDEX[1].setMaxY(1.5D), AABB_BY_INDEX[2].setMaxY(1.5D), AABB_BY_INDEX[3].setMaxY(1.5D), AABB_BY_INDEX[4].setMaxY(1.5D), AABB_BY_INDEX[5].setMaxY(1.5D), AABB_BY_INDEX[6].setMaxY(1.5D), AABB_BY_INDEX[7].setMaxY(1.5D), AABB_BY_INDEX[8].setMaxY(1.5D), AABB_BY_INDEX[9].setMaxY(1.5D), AABB_BY_INDEX[10].setMaxY(1.5D), AABB_BY_INDEX[11].setMaxY(1.5D), AABB_BY_INDEX[12].setMaxY(1.5D), AABB_BY_INDEX[13].setMaxY(1.5D), AABB_BY_INDEX[14].setMaxY(1.5D), AABB_BY_INDEX[15].setMaxY(1.5D)};
@SuppressWarnings("deprecation")
public BlockWallAA(String name, Block blocc) {
public BlockWallAA(Block blocc) {
super(blocc.getDefaultState().getMaterial(), name);
this.setHardness(1.5F);
this.setResistance(10F);
@ -46,19 +46,19 @@ public class BlockWallAA extends BlockBase {
int i = 0;
if (state.getValue(BlockWall.NORTH)) {
i |= 1 << EnumFacing.NORTH.getHorizontalIndex();
i |= 1 << Direction.NORTH.getHorizontalIndex();
}
if (state.getValue(BlockWall.EAST)) {
i |= 1 << EnumFacing.EAST.getHorizontalIndex();
i |= 1 << Direction.EAST.getHorizontalIndex();
}
if (state.getValue(BlockWall.SOUTH)) {
i |= 1 << EnumFacing.SOUTH.getHorizontalIndex();
i |= 1 << Direction.SOUTH.getHorizontalIndex();
}
if (state.getValue(BlockWall.WEST)) {
i |= 1 << EnumFacing.WEST.getHorizontalIndex();
i |= 1 << Direction.WEST.getHorizontalIndex();
}
return i;
@ -87,8 +87,8 @@ public class BlockWallAA extends BlockBase {
@Override
@OnlyIn(Dist.CLIENT)
@Deprecated
public boolean shouldSideBeRendered(BlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
return side != EnumFacing.DOWN || super.shouldSideBeRendered(blockState, blockAccess, pos, side);
public boolean shouldSideBeRendered(BlockState blockState, IBlockAccess blockAccess, BlockPos pos, Direction side) {
return side != Direction.DOWN || super.shouldSideBeRendered(blockState, blockAccess, pos, side);
}
@Override

View file

@ -21,13 +21,13 @@ import net.minecraft.block.BlockCrops;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
@ -39,8 +39,8 @@ public class BlockWildPlant extends BlockBushBase {
public static final TheWildPlants[] ALL_WILD_PLANTS = TheWildPlants.values();
public static final PropertyEnum<TheWildPlants> TYPE = PropertyEnum.create("type", TheWildPlants.class);
public BlockWildPlant(String name) {
super(name);
public BlockWildPlant() {
super(this.name);
this.setSoundType(SoundType.PLANT);
}
@ -49,7 +49,9 @@ public class BlockWildPlant extends BlockBushBase {
BlockPos offset = pos.down();
BlockState offsetState = world.getBlockState(offset);
Block offsetBlock = offsetState.getBlock();
return state.getValue(TYPE) == TheWildPlants.RICE ? offsetState.getMaterial() == Material.WATER : offsetBlock.canSustainPlant(offsetState, world, offset, EnumFacing.UP, this);
return state.getValue(TYPE) == TheWildPlants.RICE
? offsetState.getMaterial() == Material.WATER
: offsetBlock.canSustainPlant(offsetState, world, offset, Direction.UP, this);
}
@Override
@ -110,7 +112,9 @@ public class BlockWildPlant extends BlockBushBase {
@Override
public EnumRarity getRarity(ItemStack stack) {
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 {
@ -123,7 +127,9 @@ public class BlockWildPlant extends BlockBushBase {
@Override
public String getTranslationKey(ItemStack stack) {
return stack.getItemDamage() >= ALL_WILD_PLANTS.length ? StringUtil.BUGGED_ITEM_NAME : this.getTranslationKey() + "_" + ALL_WILD_PLANTS[stack.getItemDamage()].getName();
return stack.getItemDamage() >= ALL_WILD_PLANTS.length
? StringUtil.BUGGED_ITEM_NAME
: this.getTranslationKey() + "_" + ALL_WILD_PLANTS[stack.getItemDamage()].getName();
}
}
}

View file

@ -17,14 +17,14 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityXPSolidifier;
import net.minecraft.block.BlockHorizontal;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
@ -33,8 +33,8 @@ import net.minecraft.world.World;
public class BlockXPSolidifier extends BlockContainerBase {
public BlockXPSolidifier(String name) {
super(Material.ROCK, name);
public BlockXPSolidifier() {
super(Material.ROCK, this.name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(2.5F);
this.setResistance(10.0F);
@ -47,7 +47,7 @@ public class BlockXPSolidifier extends BlockContainerBase {
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) {
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, Direction par6, float par7, float par8, float par9) {
if (!world.isRemote) {
TileEntityXPSolidifier solidifier = (TileEntityXPSolidifier) world.getTileEntity(pos);
if (solidifier != null) {
@ -72,7 +72,7 @@ public class BlockXPSolidifier extends BlockContainerBase {
@Override
public BlockState getStateFromMeta(int meta) {
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
return this.getDefaultState().withProperty(BlockHorizontal.FACING, Direction.byHorizontalIndex(meta));
}
@Override

View file

@ -11,208 +11,115 @@
package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.BlockLaserRelay.Type;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockPlant;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockStair;
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheCrystals;
import net.minecraft.block.Block;
import net.minecraft.block.*;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
public final class InitBlocks {
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, ActuallyAdditions.MODID);
public static Block blockCompost;
public static Block blockMisc;
public static Block blockWildPlant;
public static Block blockFeeder;
public static Block blockGiantChest;
public static Block blockGiantChestMedium;
public static Block blockGiantChestLarge;
public static Block blockGrinder;
public static Block blockGrinderDouble;
public static Block blockFurnaceDouble;
public static Block blockInputter;
public static Block blockInputterAdvanced;
public static Block blockFishingNet;
public static Block blockFurnaceSolar;
public static Block blockHeatCollector;
public static Block blockItemRepairer;
public static Block blockGreenhouseGlass;
public static Block blockBreaker;
public static Block blockPlacer;
public static Block blockDropper;
public static Block blockRice;
public static Block blockCanola;
public static Block blockFlax;
public static Block blockCoffee;
public static Block blockCanolaPress;
public static Block blockFermentingBarrel;
public static Block blockCoalGenerator;
public static Block blockOilGenerator;
public static Block blockPhantomface;
public static Block blockPhantomPlacer;
public static Block blockPhantomBreaker;
public static Block blockPhantomLiquiface;
public static Block blockPhantomEnergyface;
public static Block blockPhantomRedstoneface;
public static Block blockPlayerInterface;
public static Block blockFluidPlacer;
public static Block blockFluidCollector;
public static Block blockLavaFactoryController;
public static Block blockCoffeeMachine;
public static Block blockPhantomBooster;
public static Block blockEnergizer;
public static Block blockEnervator;
public static Block blockTestifiBucksGreenWall;
public static Block blockTestifiBucksWhiteWall;
public static Block blockTestifiBucksGreenStairs;
public static Block blockTestifiBucksWhiteStairs;
public static Block blockTestifiBucksGreenSlab;
public static Block blockTestifiBucksWhiteSlab;
public static Block blockTestifiBucksGreenFence;
public static Block blockTestifiBucksWhiteFence;
public static Block blockColoredLamp;
public static Block blockColoredLampOn;
public static Block blockLampPowerer;
public static Block blockTreasureChest;
public static Block blockXPSolidifier;
public static Block blockSmileyCloud;
public static Block blockLeafGenerator;
public static Block blockDirectionalBreaker;
public static Block blockRangedCollector;
public static Block blockLaserRelay;
public static Block blockLaserRelayAdvanced;
public static Block blockLaserRelayExtreme;
public static Block blockLaserRelayFluids;
public static Block blockLaserRelayItem;
public static Block blockLaserRelayItemWhitelist;
public static Block blockItemViewer;
public static Block blockItemViewerHopping;
public static Block blockBlackLotus;
public static Block blockCrystal;
public static Block blockCrystalEmpowered;
public static Block blockAtomicReconstructor;
public static Block blockMiner;
public static Block blockFireworkBox;
public static Block blockQuartzWall;
public static Block blockQuartzStair;
public static Block blockQuartzSlab;
public static Block blockChiseledQuartzWall;
public static Block blockChiseledQuartzStair;
public static Block blockChiseledQuartzSlab;
public static Block blockPillarQuartzWall;
public static Block blockPillarQuartzStair;
public static Block blockPillarQuartzSlab;
public static Block blockDisplayStand;
public static Block blockShockSuppressor;
public static Block blockEmpowerer;
public static Block blockBioReactor;
public static Block blockTinyTorch;
public static Block blockFarmer;
public static Block blockBatteryBox;
public static Block blockCrystalClusterRedstone;
public static Block blockCrystalClusterLapis;
public static Block blockCrystalClusterDiamond;
public static Block blockCrystalClusterCoal;
public static Block blockCrystalClusterEmerald;
public static Block blockCrystalClusterIron;
public static final RegistryObject<Block> blockCompost = BLOCKS.register("block_compost", BlockCompost::new);
public static final RegistryObject<Block> blockMisc = BLOCKS.register("block_misc", BlockMisc::new);
public static final RegistryObject<Block> blockWildPlant = BLOCKS.register("block_wild", BlockWildPlant::new);
public static final RegistryObject<Block> blockFeeder = BLOCKS.register("block_feeder", BlockFeeder::new);
// public static final RegistryObject<Block> blockGiantChest = BLOCKS.register("", );
// public static final RegistryObject<Block> blockGiantChestMedium = BLOCKS.register("", );
// public static final RegistryObject<Block> blockGiantChestLarge = BLOCKS.register("", );
public static final RegistryObject<Block> blockGrinder = BLOCKS.register("block_grinder", () -> new BlockGrinder(false));
public static final RegistryObject<Block> blockGrinderDouble = BLOCKS.register("block_grinder_double", () -> new BlockGrinder(true));
public static final RegistryObject<Block> blockCrystalClusterRedstone = 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));
public static final RegistryObject<Block> blockCrystalClusterDiamond = 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));
public static final RegistryObject<Block> blockCrystalClusterEmerald = 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));
public static final RegistryObject<Block> blockBatteryBox = BLOCKS.register("block_battery_box", BlockBatteryBox::new);
public static final RegistryObject<Block> blockItemViewerHopping = BLOCKS.register("block_item_viewer_hopping", BlockItemViewerHopping::new);
public static final RegistryObject<Block> blockFarmer = BLOCKS.register("block_farmer", BlockFarmer::new);
public static final RegistryObject<Block> blockBioReactor = BLOCKS.register("block_bio_reactor", BlockBioReactor::new);
public static final RegistryObject<Block> blockEmpowerer = BLOCKS.register("block_empowerer", BlockEmpowerer::new);
public static final RegistryObject<Block> blockTinyTorch = BLOCKS.register("block_tiny_torch", BlockTinyTorch::new);
public static final RegistryObject<Block> blockShockSuppressor = BLOCKS.register("block_shock_suppressor", BlockShockSuppressor::new);
public static final RegistryObject<Block> blockDisplayStand = BLOCKS.register("block_display_stand", BlockDisplayStand::new);
public static final RegistryObject<Block> blockPlayerInterface = BLOCKS.register("block_player_interface", BlockPlayerInterface::new);
public static final RegistryObject<Block> blockItemViewer = BLOCKS.register("block_item_viewer", BlockItemViewer::new);
public static final RegistryObject<Block> blockFireworkBox = BLOCKS.register("block_firework_box", BlockFireworkBox::new);
public static final RegistryObject<Block> blockMiner = BLOCKS.register("block_miner", BlockMiner::new);
public static final RegistryObject<Block> blockAtomicReconstructor = BLOCKS.register("block_atomic_reconstructor", BlockAtomicReconstructor::new);
public static final RegistryObject<Block> blockCrystal = BLOCKS.register("block_crystal", () -> new BlockCrystal(false));
public static final RegistryObject<Block> blockCrystalEmpowered = BLOCKS.register("block_crystal_empowered", () -> new BlockCrystal(true));
public static final RegistryObject<Block> blockBlackLotus = BLOCKS.register("block_black_lotus", BlockBlackLotus::new);
public static final RegistryObject<Block> blockLaserRelay = 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(BlockLaserRelay.Type.ENERGY_ADVANCED));
public static final RegistryObject<Block> blockLaserRelayExtreme = 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(BlockLaserRelay.Type.FLUIDS));
public static final RegistryObject<Block> blockLaserRelayItem = 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(BlockLaserRelay.Type.ITEM_WHITELIST));
public static final RegistryObject<Block> blockRangedCollector = BLOCKS.register("block_ranged_collector", BlockRangedCollector::new);
public static final RegistryObject<Block> blockDirectionalBreaker = BLOCKS.register("block_directional_breaker", BlockDirectionalBreaker::new);
public static final RegistryObject<Block> blockLeafGenerator = BLOCKS.register("block_leaf_generator", BlockLeafGenerator::new);
public static final RegistryObject<Block> blockSmileyCloud = BLOCKS.register("block_smiley_cloud", BlockSmileyCloud::new);
public static final RegistryObject<Block> blockXPSolidifier = BLOCKS.register("block_xp_solidifier", BlockXPSolidifier::new);
public static final RegistryObject<Block> blockTestifiBucksGreenWall = BLOCKS.register("block_testifi_bucks_green_wall", BlockGeneric::new);
public static final RegistryObject<Block> blockTestifiBucksWhiteWall = BLOCKS.register("block_testifi_bucks_white_wall", BlockGeneric::new);
public static final RegistryObject<Block> blockTestifiBucksGreenStairs = BLOCKS.register("block_testifi_bucks_green_stairs", () -> new StairsBlock(() -> blockTestifiBucksGreenWall.get().getDefaultState(), AbstractBlock.Properties.from(blockTestifiBucksGreenWall.get())));
public static final RegistryObject<Block> blockTestifiBucksWhiteStairs = BLOCKS.register("block_testifi_bucks_white_stairs", () -> new StairsBlock(() -> blockTestifiBucksWhiteWall.get().getDefaultState(), AbstractBlock.Properties.from(blockTestifiBucksWhiteWall.get())));
public static final RegistryObject<Block> blockTestifiBucksGreenSlab = BLOCKS.register("block_testifi_bucks_green_slab", () -> new SlabBlock(AbstractBlock.Properties.from(blockTestifiBucksGreenWall.get())));
public static final RegistryObject<Block> blockTestifiBucksWhiteSlab = BLOCKS.register("block_testifi_bucks_white_slab", () -> new SlabBlock(AbstractBlock.Properties.from(blockTestifiBucksWhiteWall.get())));
public static final RegistryObject<Block> blockTestifiBucksGreenFence = BLOCKS.register("block_testifi_bucks_green_fence", () -> new WallBlock(AbstractBlock.Properties.from(blockTestifiBucksGreenWall.get())));
public static final RegistryObject<Block> blockTestifiBucksWhiteFence = BLOCKS.register("block_testifi_bucks_white_fence", () -> new WallBlock(AbstractBlock.Properties.from(blockTestifiBucksWhiteWall.get())));
public static final RegistryObject<Block> blockColoredLamp = BLOCKS.register("block_colored_lamp", () -> new BlockColoredLamp(false));
public static final RegistryObject<Block> blockColoredLampOn = BLOCKS.register("block_colored_lamp_on", () -> new BlockColoredLamp(true));
public static final RegistryObject<Block> blockLampPowerer = BLOCKS.register("block_lamp_powerer", BlockLampPowerer::new);
// public static final RegistryObject<Block> blockTreasureChest = BLOCKS.register("block_treasure_chest", BlockTreasureChest::new);
public static final RegistryObject<Block> blockEnergizer = BLOCKS.register("block_energizer", () -> new BlockEnergizer(true));
public static final RegistryObject<Block> blockEnervator = BLOCKS.register("block_enervator", () -> new BlockEnergizer(false));
public static final RegistryObject<Block> blockLavaFactoryController = BLOCKS.register("block_lava_factory_controller", BlockLavaFactoryController::new);
public static final RegistryObject<Block> blockCanolaPress = BLOCKS.register("block_canola_press", BlockCanolaPress::new);
public static final RegistryObject<Block> blockPhantomface = BLOCKS.register("block_phantomface", () -> new BlockPhantom(BlockPhantom.Type.FACE));
public static final RegistryObject<Block> blockPhantomPlacer = BLOCKS.register("block_phantom_placer", () -> new BlockPhantom(BlockPhantom.Type.PLACER));
public static final RegistryObject<Block> blockPhantomLiquiface = BLOCKS.register("block_phantom_liquiface", () -> new BlockPhantom(BlockPhantom.Type.LIQUIFACE));
public static final RegistryObject<Block> blockPhantomEnergyface = BLOCKS.register("block_phantom_energyface", () -> new BlockPhantom(BlockPhantom.Type.ENERGYFACE));
public static final RegistryObject<Block> blockPhantomRedstoneface = BLOCKS.register("block_phantom_redstoneface", () -> new BlockPhantom(BlockPhantom.Type.REDSTONEFACE));
public static final RegistryObject<Block> blockPhantomBreaker = BLOCKS.register("block_phantom_breaker", () -> new BlockPhantom(BlockPhantom.Type.BREAKER));
public static final RegistryObject<Block> blockCoalGenerator = BLOCKS.register("block_coal_generator", BlockCoalGenerator::new);
public static final RegistryObject<Block> blockOilGenerator = BLOCKS.register("block_oil_generator", BlockOilGenerator::new);
public static final RegistryObject<Block> blockFermentingBarrel = BLOCKS.register("block_fermenting_barrel", BlockFermentingBarrel::new);
public static final RegistryObject<Block> blockRice = BLOCKS.register("block_rice", () -> new BlockPlant(1, 2));
public static final RegistryObject<Block> blockCanola = BLOCKS.register("block_canola", () -> new BlockPlant(2, 3));
public static final RegistryObject<Block> blockFlax = BLOCKS.register("block_flax", () -> new BlockPlant(2, 4));
public static final RegistryObject<Block> blockCoffee = BLOCKS.register("block_coffee", () -> new BlockPlant(2, 2));
public static final RegistryObject<Block> blockFurnaceDouble = BLOCKS.register("block_furnace_double", BlockFurnaceDouble::new);
public static final RegistryObject<Block> blockInputter = BLOCKS.register("block_inputter", () -> new BlockInputter(false));
public static final RegistryObject<Block> blockInputterAdvanced = BLOCKS.register("block_inputter_advanced", () -> new BlockInputter(true));
public static final RegistryObject<Block> blockFishingNet = BLOCKS.register("block_fishing_net", BlockFishingNet::new);
public static final RegistryObject<Block> blockFurnaceSolar = BLOCKS.register("block_furnace_solar", BlockFurnaceSolar::new);
public static final RegistryObject<Block> blockHeatCollector = BLOCKS.register("block_heat_collector", BlockHeatCollector::new);
public static final RegistryObject<Block> blockItemRepairer = BLOCKS.register("block_item_repairer", BlockItemRepairer::new);
public static final RegistryObject<Block> blockGreenhouseGlass = BLOCKS.register("block_greenhouse_glass", BlockGreenhouseGlass::new);
public static final RegistryObject<Block> blockBreaker = BLOCKS.register("block_breaker", () -> new BlockBreaker(false));
public static final RegistryObject<Block> blockPlacer = BLOCKS.register("block_placer", () -> new BlockBreaker(true));
public static final RegistryObject<Block> blockDropper = BLOCKS.register("block_dropper", BlockDropper::new);
public static final RegistryObject<Block> blockFluidPlacer = BLOCKS.register("block_fluid_placer", () -> new BlockFluidCollector(true));
public static final RegistryObject<Block> blockFluidCollector = BLOCKS.register("block_fluid_collector", () -> new BlockFluidCollector(false));
public static final RegistryObject<Block> blockCoffeeMachine = BLOCKS.register("block_coffee_machine", BlockCoffeeMachine::new);
public static final RegistryObject<Block> blockPhantomBooster = BLOCKS.register("block_phantom_booster", BlockPhantomBooster::new);
public static final RegistryObject<Block> blockQuartzWall = BLOCKS.register("block_quartz_wall", () -> new WallBlock(AbstractBlock.Properties.from(blockMisc.get())));
public static final RegistryObject<Block> blockChiseledQuartzWall = BLOCKS.register("block_chiseled_quartz_wall", () -> new WallBlock(AbstractBlock.Properties.from(blockMisc.get())));
public static final RegistryObject<Block> blockPillarQuartzWall = BLOCKS.register("block_pillar_quartz_wall", () -> new WallBlock(AbstractBlock.Properties.from(blockMisc.get())));
public static final RegistryObject<Block> blockQuartzStair = BLOCKS.register("block_quartz_stair", () -> new StairsBlock(() -> blockMisc.get().getDefaultState(), AbstractBlock.Properties.from(blockMisc.get())));
public static final RegistryObject<Block> blockChiseledQuartzStair = BLOCKS.register("block_chiseled_quartz_stair", () -> new StairsBlock(() -> blockMisc.get().getDefaultState(), AbstractBlock.Properties.from(blockMisc.get())));
public static final RegistryObject<Block> blockPillarQuartzStair = BLOCKS.register("block_pillar_quartz_stair", () -> new StairsBlock(() -> blockMisc.get().getDefaultState(), AbstractBlock.Properties.from(blockMisc.get())));
public static final RegistryObject<Block> blockQuartzSlab = BLOCKS.register("block_quartz_slab", () -> new SlabBlock(AbstractBlock.Properties.from(blockMisc.get())));
public static final RegistryObject<Block> blockChiseledQuartzSlab = BLOCKS.register("block_chiseled_quartz_slab", () -> new SlabBlock(AbstractBlock.Properties.from(blockMisc.get())));
public static final RegistryObject<Block> blockPillarQuartzSlab = BLOCKS.register("block_pillar_quartz_slab", () -> new SlabBlock(AbstractBlock.Properties.from(blockMisc.get())));
public static void init() {
ActuallyAdditions.LOGGER.info("Initializing Blocks...");
blockCrystalClusterRedstone = new BlockCrystalCluster("block_crystal_cluster_redstone", TheCrystals.REDSTONE);
blockCrystalClusterLapis = new BlockCrystalCluster("block_crystal_cluster_lapis", TheCrystals.LAPIS);
blockCrystalClusterDiamond = new BlockCrystalCluster("block_crystal_cluster_diamond", TheCrystals.DIAMOND);
blockCrystalClusterCoal = new BlockCrystalCluster("block_crystal_cluster_coal", TheCrystals.COAL);
blockCrystalClusterEmerald = new BlockCrystalCluster("block_crystal_cluster_emerald", TheCrystals.EMERALD);
blockCrystalClusterIron = new BlockCrystalCluster("block_crystal_cluster_iron", TheCrystals.IRON);
blockBatteryBox = new BlockBatteryBox("block_battery_box");
blockItemViewerHopping = new BlockItemViewerHopping("block_item_viewer_hopping");
blockFarmer = new BlockFarmer("block_farmer");
blockBioReactor = new BlockBioReactor("block_bio_reactor");
blockEmpowerer = new BlockEmpowerer("block_empowerer");
blockTinyTorch = new BlockTinyTorch("block_tiny_torch");
blockShockSuppressor = new BlockShockSuppressor("block_shock_suppressor");
blockDisplayStand = new BlockDisplayStand("block_display_stand");
blockPlayerInterface = new BlockPlayerInterface("block_player_interface");
blockItemViewer = new BlockItemViewer("block_item_viewer");
blockFireworkBox = new BlockFireworkBox("block_firework_box");
blockMiner = new BlockMiner("block_miner");
blockAtomicReconstructor = new BlockAtomicReconstructor("block_atomic_reconstructor");
blockCrystal = new BlockCrystal("block_crystal", false);
blockCrystalEmpowered = new BlockCrystal("block_crystal_empowered", true);
blockBlackLotus = new BlockBlackLotus("block_black_lotus");
blockLaserRelay = new BlockLaserRelay("block_laser_relay", Type.ENERGY_BASIC);
blockLaserRelayAdvanced = new BlockLaserRelay("block_laser_relay_advanced", Type.ENERGY_ADVANCED);
blockLaserRelayExtreme = new BlockLaserRelay("block_laser_relay_extreme", Type.ENERGY_EXTREME);
blockLaserRelayFluids = new BlockLaserRelay("block_laser_relay_fluids", Type.FLUIDS);
blockLaserRelayItem = new BlockLaserRelay("block_laser_relay_item", Type.ITEM);
blockLaserRelayItemWhitelist = new BlockLaserRelay("block_laser_relay_item_whitelist", Type.ITEM_WHITELIST);
blockRangedCollector = new BlockRangedCollector("block_ranged_collector");
blockDirectionalBreaker = new BlockDirectionalBreaker("block_directional_breaker");
blockLeafGenerator = new BlockLeafGenerator("block_leaf_generator");
blockSmileyCloud = new BlockSmileyCloud("block_smiley_cloud");
blockXPSolidifier = new BlockXPSolidifier("block_xp_solidifier");
blockTestifiBucksGreenWall = new BlockGeneric("block_testifi_bucks_green_wall");
blockTestifiBucksWhiteWall = new BlockGeneric("block_testifi_bucks_white_wall");
blockTestifiBucksGreenStairs = new BlockStair(blockTestifiBucksGreenWall, "block_testifi_bucks_green_stairs");
blockTestifiBucksWhiteStairs = new BlockStair(blockTestifiBucksWhiteWall, "block_testifi_bucks_white_stairs");
blockTestifiBucksGreenSlab = new BlockSlabs("block_testifi_bucks_green_slab", blockTestifiBucksGreenWall);
blockTestifiBucksWhiteSlab = new BlockSlabs("block_testifi_bucks_white_slab", blockTestifiBucksWhiteWall);
blockTestifiBucksGreenFence = new BlockWallAA("block_testifi_bucks_green_fence", blockTestifiBucksGreenWall);
blockTestifiBucksWhiteFence = new BlockWallAA("block_testifi_bucks_white_fence", blockTestifiBucksWhiteWall);
blockColoredLamp = new BlockColoredLamp(false, "block_colored_lamp");
blockColoredLampOn = new BlockColoredLamp(true, "block_colored_lamp_on");
blockLampPowerer = new BlockLampPowerer("block_lamp_powerer");
blockTreasureChest = new BlockTreasureChest("block_treasure_chest");
blockEnergizer = new BlockEnergizer(true, "block_energizer");
blockEnervator = new BlockEnergizer(false, "block_enervator");
blockLavaFactoryController = new BlockLavaFactoryController("block_lava_factory_controller");
blockCanolaPress = new BlockCanolaPress("block_canola_press");
blockPhantomface = new BlockPhantom(BlockPhantom.Type.FACE, "block_phantomface");
blockPhantomPlacer = new BlockPhantom(BlockPhantom.Type.PLACER, "block_phantom_placer");
blockPhantomLiquiface = new BlockPhantom(BlockPhantom.Type.LIQUIFACE, "block_phantom_liquiface");
blockPhantomEnergyface = new BlockPhantom(BlockPhantom.Type.ENERGYFACE, "block_phantom_energyface");
blockPhantomRedstoneface = new BlockPhantom(BlockPhantom.Type.REDSTONEFACE, "block_phantom_redstoneface");
blockPhantomBreaker = new BlockPhantom(BlockPhantom.Type.BREAKER, "block_phantom_breaker");
blockCoalGenerator = new BlockCoalGenerator("block_coal_generator");
blockOilGenerator = new BlockOilGenerator("block_oil_generator");
blockFermentingBarrel = new BlockFermentingBarrel("block_fermenting_barrel");
blockRice = new BlockPlant("block_rice", 1, 2);
blockCanola = new BlockPlant("block_canola", 2, 3);
blockFlax = new BlockPlant("block_flax", 2, 4);
blockCoffee = new BlockPlant("block_coffee", 2, 2);
blockCompost = new BlockCompost("block_compost");
blockMisc = new BlockMisc("block_misc");
blockFeeder = new BlockFeeder("block_feeder");
blockGiantChest = new BlockGiantChest("block_giant_chest", 0);
blockGiantChestMedium = new BlockGiantChest("block_giant_chest_medium", 1);
blockGiantChestLarge = new BlockGiantChest("block_giant_chest_large", 2);
blockGrinder = new BlockGrinder(false, "block_grinder");
blockGrinderDouble = new BlockGrinder(true, "block_grinder_double");
blockFurnaceDouble = new BlockFurnaceDouble("block_furnace_double");
blockInputter = new BlockInputter(false, "block_inputter");
blockInputterAdvanced = new BlockInputter(true, "block_inputter_advanced");
blockFishingNet = new BlockFishingNet("block_fishing_net");
blockFurnaceSolar = new BlockFurnaceSolar("block_furnace_solar");
blockHeatCollector = new BlockHeatCollector("block_heat_collector");
blockItemRepairer = new BlockItemRepairer("block_item_repairer");
blockGreenhouseGlass = new BlockGreenhouseGlass("block_greenhouse_glass");
blockBreaker = new BlockBreaker(false, "block_breaker");
blockPlacer = new BlockBreaker(true, "block_placer");
blockDropper = new BlockDropper("block_dropper");
blockFluidPlacer = new BlockFluidCollector(true, "block_fluid_placer");
blockFluidCollector = new BlockFluidCollector(false, "block_fluid_collector");
blockCoffeeMachine = new BlockCoffeeMachine("block_coffee_machine");
blockPhantomBooster = new BlockPhantomBooster("block_phantom_booster");
blockWildPlant = new BlockWildPlant("block_wild");
blockQuartzWall = new BlockWallAA("block_quartz_wall", blockMisc);
blockChiseledQuartzWall = new BlockWallAA("block_chiseled_quartz_wall", blockMisc);
blockPillarQuartzWall = new BlockWallAA("block_pillar_quartz_wall", blockMisc);
blockQuartzStair = new BlockStair(blockMisc.getDefaultState().withProperty(BlockMisc.TYPE, TheMiscBlocks.QUARTZ), "block_quartz_stair");
blockChiseledQuartzStair = new BlockStair(blockMisc.getDefaultState().withProperty(BlockMisc.TYPE, TheMiscBlocks.QUARTZ_CHISELED), "block_chiseled_quartz_stair");
blockPillarQuartzStair = new BlockStair(blockMisc.getDefaultState().withProperty(BlockMisc.TYPE, TheMiscBlocks.QUARTZ_PILLAR), "block_pillar_quartz_stair");
blockQuartzSlab = new BlockSlabs("block_quartz_slab", blockMisc.getDefaultState().withProperty(BlockMisc.TYPE, TheMiscBlocks.QUARTZ));
blockChiseledQuartzSlab = new BlockSlabs("block_chiseled_quartz_slab", blockMisc.getDefaultState().withProperty(BlockMisc.TYPE, TheMiscBlocks.QUARTZ_CHISELED));
blockPillarQuartzSlab = new BlockSlabs("block_pillar_quartz_slab", blockMisc.getDefaultState().withProperty(BlockMisc.TYPE, TheMiscBlocks.QUARTZ_PILLAR));
}
}

View file

@ -15,16 +15,8 @@ import net.minecraft.block.Block;
import net.minecraft.item.Item;
public class BlockBase extends Block {
private final String name;
public BlockBase(Properties properties, String name) {
public BlockBase(Properties properties) {
super(properties);
this.name = name;
}
protected String getBaseName() {
return this.name;
}
protected ItemBlockBase getItemBlock() {

View file

@ -13,13 +13,13 @@ package de.ellpeck.actuallyadditions.mod.blocks.base;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.block.BlockCrops;
import net.minecraft.block.CropsBlock;
import net.minecraft.block.state.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
@ -30,7 +30,7 @@ import net.minecraftforge.items.ItemHandlerHelper;
import java.util.Random;
public class BlockPlant extends BlockCrops implements ItemBlockBase.ICustomRarity, IHasModel {
public class BlockPlant extends CropsBlock implements ItemBlockBase.ICustomRarity, IHasModel {
private final String name;
private final int minDropAmount;
@ -39,8 +39,8 @@ public class BlockPlant extends BlockCrops implements ItemBlockBase.ICustomRarit
private Item returnItem;
private int returnMeta;
public BlockPlant(String name, int minDropAmount, int addDropAmount) {
this.name = name;
public BlockPlant(int minDropAmount, int addDropAmount) {
this.name = this.name;
this.minDropAmount = minDropAmount;
this.addDropAmount = addDropAmount;
this.register();
@ -91,7 +91,7 @@ public class BlockPlant extends BlockCrops implements ItemBlockBase.ICustomRarit
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, Direction facing, float hitX, float hitY, float hitZ) {
if (this.getMetaFromState(state) >= 7) {
if (!world.isRemote) {

View file

@ -22,8 +22,8 @@ public class BlockStair extends BlockStairs implements ItemBlockBase.ICustomRari
private final String name;
public BlockStair(Block block, String name) {
this(block.getDefaultState(), name);
public BlockStair(Block block) {
this(block.getDefaultState(), this.name);
}
public BlockStair(BlockState state, String name) {

View file

@ -14,7 +14,7 @@
//import net.minecraft.client.renderer.block.model.IBakedModel;
//import net.minecraft.client.renderer.block.model.ItemOverrideList;
//import net.minecraft.client.renderer.texture.TextureAtlasSprite;
//import net.minecraft.util.EnumFacing;
//import net.minecraft.util.Direction;
//import net.minecraftforge.common.property.IExtendedBlockState;
//
//public class ActualCompostModel implements IBakedModel {
@ -23,7 +23,7 @@
//
// @SuppressWarnings("unchecked")
// @Override
// public List<BakedQuad> getQuads(BlockState state, EnumFacing side, long rand) {
// public List<BakedQuad> getQuads(BlockState state, Direction side, long rand) {
// if (state instanceof IExtendedBlockState) {
// Pair<BlockState, Float> data = ((IExtendedBlockState) state).getValue(BlockCompost.COMPOST_PROP);
// if (data == null || data.getRight() <= 0) return CompostModel.compostBase.getQuads(state, side, rand);

View file

@ -18,14 +18,14 @@
//import net.minecraft.client.renderer.block.model.IBakedModel;
//import net.minecraft.client.renderer.block.model.ItemOverrideList;
//import net.minecraft.client.renderer.texture.TextureAtlasSprite;
//import net.minecraft.util.EnumFacing;
//import net.minecraft.util.Direction;
//import net.minecraftforge.common.model.TRSRTransformation;
//
//public class CompostModel implements IBakedModel {
// public static IBakedModel compostBase;
// private final IBakedModel display;
// private final ImmutableList<BakedQuad> general;
// private final ImmutableMap<EnumFacing, ImmutableList<BakedQuad>> faces;
// private final ImmutableMap<Direction, ImmutableList<BakedQuad>> faces;
//
// public CompostModel(BlockState flowerState, float height) {
// this.display = Minecraft.getInstance().getBlockRendererDispatcher().getModelForState(flowerState);
@ -33,9 +33,9 @@
// TRSRTransformation transform = TRSRTransformation.blockCenterToCorner(new TRSRTransformation(new Vector3f(0, -.218F, 0), null, new Vector3f(0.75F, height / 1.81F, 0.75F), null));
//
// ImmutableList.Builder<BakedQuad> builder;
// EnumMap<EnumFacing, ImmutableList<BakedQuad>> faces = new EnumMap<>(EnumFacing.class);
// EnumMap<Direction, ImmutableList<BakedQuad>> faces = new EnumMap<>(Direction.class);
//
// for (EnumFacing face : EnumFacing.values()) {
// for (Direction face : Direction.values()) {
// builder = ImmutableList.builder();
// if (!this.display.isBuiltInRenderer()) {
// for (BakedQuad quad : this.display.getQuads(flowerState, face, 0)) {
@ -63,7 +63,7 @@
// }
//
// @Override
// public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable EnumFacing side, long rand) {
// public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, long rand) {
// if (side == null) return this.general;
// return this.faces.get(side);
// }

View file

@ -21,7 +21,7 @@ import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.relauncher.OnlyIn;
@ -61,8 +61,8 @@ public class RenderEmpowerer extends TileEntitySpecialRenderer<TileEntityEmpower
if (index >= 0 && ActuallyAdditionsAPI.EMPOWERER_RECIPES.size() > index) {
EmpowererRecipe recipe = ActuallyAdditionsAPI.EMPOWERER_RECIPES.get(index);
if (recipe != null) {
for (int i = 0; i < EnumFacing.HORIZONTALS.length; i++) {
EnumFacing facing = EnumFacing.HORIZONTALS[i];
for (int i = 0; i < Direction.HORIZONTALS.length; i++) {
Direction facing = Direction.HORIZONTALS[i];
BlockPos offset = tile.getPos().offset(facing, 3);
AssetUtil.renderLaser(tile.getPos().getX() + 0.5, tile.getPos().getY() + 0.5, tile.getPos().getZ() + 0.5, offset.getX() + 0.5, offset.getY() + 0.95, offset.getZ() + 0.5, 80, 1F, 0.1F, recipe.getParticleColors());

View file

@ -31,7 +31,7 @@ import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.pattern.BlockMatcher;
import net.minecraft.init.Blocks;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
@ -127,7 +127,7 @@ public class AAWorldGen implements IWorldGenerator {
if (randomPos.getY() >= 25 && randomPos.getY() <= 45) {
if (event.getWorld().getBlockState(randomPos).getMaterial() == Material.WATER) {
if (event.getWorld().getBlockState(randomPos.down()).getMaterial().isSolid()) {
event.getWorld().setBlockState(randomPos, InitBlocks.blockTreasureChest.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(event.getRand().nextInt(4))), 2);
event.getWorld().setBlockState(randomPos, InitBlocks.blockTreasureChest.getDefaultState().withProperty(BlockHorizontal.FACING, Direction.byHorizontalIndex(event.getRand().nextInt(4))), 2);
}
}
}

View file

@ -24,7 +24,7 @@ import net.minecraft.block.BlockDirectional;
import net.minecraft.block.state.BlockState;
import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
@ -73,8 +73,8 @@ public class WorldGenLushCaves {
}
} else {
if (ConfigBoolValues.DO_CRYSTAL_CLUSTERS.isEnabled() && rand.nextInt(20) == 0) {
EnumFacing[] values = EnumFacing.values();
EnumFacing side = values[rand.nextInt(values.length)];
Direction[] values = Direction.values();
Direction side = values[rand.nextInt(values.length)];
BlockPos posSide = pos.offset(side);
if (!this.checkIndestructable(world, posSide)) {

View file

@ -18,7 +18,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockCrops;
import net.minecraft.block.state.BlockState;
import net.minecraft.init.Blocks;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraft.world.gen.structure.StructureBoundingBox;
@ -37,12 +37,12 @@ public class VillageComponentCustomCropField extends StructureVillagePieces.Hous
}
public VillageComponentCustomCropField(StructureBoundingBox boundingBox, EnumFacing par5) {
public VillageComponentCustomCropField(StructureBoundingBox boundingBox, Direction par5) {
this.setCoordBaseMode(par5);
this.boundingBox = boundingBox;
}
public static VillageComponentCustomCropField buildComponent(List<StructureComponent> pieces, int p1, int p2, int p3, EnumFacing p4) {
public static VillageComponentCustomCropField buildComponent(List<StructureComponent> pieces, int p1, int p2, int p3, Direction p4) {
StructureBoundingBox boundingBox = StructureBoundingBox.getComponentToAddBoundingBox(p1, p2, p3, 0, 0, 0, X_SIZE, Y_SIZE, Z_SIZE, p4);
return canVillageGoDeeper(boundingBox) && StructureComponent.findIntersecting(pieces, boundingBox) == null ? new VillageComponentCustomCropField(boundingBox, p4) : null;
}

View file

@ -40,7 +40,7 @@ import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Mirror;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Rotation;
@ -70,12 +70,12 @@ public class VillageComponentEngineerHouse extends StructureVillagePieces.House1
}
public VillageComponentEngineerHouse(StructureBoundingBox boundingBox, EnumFacing par5) {
public VillageComponentEngineerHouse(StructureBoundingBox boundingBox, Direction par5) {
this.setCoordBaseMode(par5);
this.boundingBox = boundingBox;
}
public static VillageComponentEngineerHouse buildComponent(List<StructureComponent> pieces, int p1, int p2, int p3, EnumFacing p4) {
public static VillageComponentEngineerHouse buildComponent(List<StructureComponent> pieces, int p1, int p2, int p3, Direction p4) {
StructureBoundingBox boundingBox = StructureBoundingBox.getComponentToAddBoundingBox(p1, p2, p3, 0, 0, 0, X_SIZE, Y_SIZE, Z_SIZE, p4);
return canVillageGoDeeper(boundingBox) && StructureComponent.findIntersecting(pieces, boundingBox) == null ? new VillageComponentEngineerHouse(boundingBox, p4) : null;
}
@ -185,17 +185,17 @@ public class VillageComponentEngineerHouse extends StructureVillagePieces.House1
MinecraftServer server = world.getMinecraftServer();
if (manager != null && server != null) {
EnumFacing facing = this.getCoordBaseMode();
Direction facing = this.getCoordBaseMode();
Mirror mirror;
Rotation rotation;
if (facing == EnumFacing.SOUTH) {
if (facing == Direction.SOUTH) {
mirror = Mirror.NONE;
rotation = Rotation.NONE;
} else if (facing == EnumFacing.WEST) {
} else if (facing == Direction.WEST) {
mirror = Mirror.NONE;
rotation = Rotation.CLOCKWISE_90;
} else if (facing == EnumFacing.EAST) {
} else if (facing == Direction.EAST) {
mirror = Mirror.LEFT_RIGHT;
rotation = Rotation.CLOCKWISE_90;
} else {

View file

@ -26,7 +26,7 @@ import net.minecraft.block.BlockTorch;
import net.minecraft.block.state.BlockState;
import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@ -47,12 +47,12 @@ public class VillageComponentJamHouse extends StructureVillagePieces.House1 {
}
public VillageComponentJamHouse(StructureBoundingBox boundingBox, EnumFacing par5) {
public VillageComponentJamHouse(StructureBoundingBox boundingBox, Direction par5) {
this.setCoordBaseMode(par5);
this.boundingBox = boundingBox;
}
public static VillageComponentJamHouse buildComponent(List<StructureComponent> pieces, int p1, int p2, int p3, EnumFacing p4) {
public static VillageComponentJamHouse buildComponent(List<StructureComponent> pieces, int p1, int p2, int p3, Direction p4) {
StructureBoundingBox boundingBox = StructureBoundingBox.getComponentToAddBoundingBox(p1, p2, p3, 0, 0, 0, X_SIZE, Y_SIZE, Z_SIZE, p4);
return canVillageGoDeeper(boundingBox) && StructureComponent.findIntersecting(pieces, boundingBox) == null ? new VillageComponentJamHouse(boundingBox, p4) : null;
}
@ -155,8 +155,8 @@ public class VillageComponentJamHouse extends StructureVillagePieces.House1 {
this.fillWithBlocks(world, sbb, 6, 1, 7, 8, 1, 7, Blocks.COBBLESTONE);
this.fillWithBlocks(world, sbb, 6, 2, 7, 7, 2, 7, Blocks.GLASS_PANE);
this.setBlockState(world, Blocks.PLANKS.getStateFromMeta(0), 8, 2, 7, sbb);
this.setBlockState(world, Blocks.SPRUCE_DOOR.getDefaultState().withProperty(BlockDoor.FACING, EnumFacing.SOUTH), 4, 1, 7, sbb);
this.setBlockState(world, Blocks.SPRUCE_DOOR.getDefaultState().withProperty(BlockDoor.FACING, EnumFacing.SOUTH).withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.UPPER), 4, 2, 7, sbb);
this.setBlockState(world, Blocks.SPRUCE_DOOR.getDefaultState().withProperty(BlockDoor.FACING, Direction.SOUTH), 4, 1, 7, sbb);
this.setBlockState(world, Blocks.SPRUCE_DOOR.getDefaultState().withProperty(BlockDoor.FACING, Direction.SOUTH).withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.UPPER), 4, 2, 7, sbb);
//FENCE Supports
this.fillWithBlocks(world, sbb, 0, 1, 8, 0, 3, 8, Blocks.OAK_FENCE);
@ -166,8 +166,8 @@ public class VillageComponentJamHouse extends StructureVillagePieces.House1 {
//Roof
this.fillWithBlocks(world, sbb, 1, 6, 3, 9, 6, 5, Blocks.PLANKS);
BlockState stairSouth = Blocks.OAK_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, EnumFacing.SOUTH);
BlockState stairNorth = Blocks.OAK_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, EnumFacing.NORTH);
BlockState stairSouth = Blocks.OAK_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, Direction.SOUTH);
BlockState stairNorth = Blocks.OAK_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, Direction.NORTH);
this.fillWithBlocks(world, sbb, 0, 4, 0, 10, 4, 0, stairNorth, stairNorth, false);
this.fillWithBlocks(world, sbb, 0, 5, 1, 10, 5, 1, stairNorth, stairNorth, false);
this.fillWithBlocks(world, sbb, 0, 6, 2, 10, 6, 2, stairNorth, stairNorth, false);
@ -204,7 +204,7 @@ public class VillageComponentJamHouse extends StructureVillagePieces.House1 {
this.setBlockState(world, Blocks.LEAVES.getDefaultState().withProperty(BlockLeaves.DECAYABLE, false), 8, 2, 2, sbb);
this.setBlockState(world, Blocks.OAK_FENCE.getDefaultState(), 2, 1, 6, sbb);
this.setBlockState(world, Blocks.LEAVES.getDefaultState().withProperty(BlockLeaves.DECAYABLE, false), 2, 2, 6, sbb);
BlockState stairWest = Blocks.OAK_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, EnumFacing.WEST);
BlockState stairWest = Blocks.OAK_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, Direction.WEST);
this.fillWithBlocks(world, sbb, 2, 1, 3, 2, 1, 5, stairWest, stairWest, false);
this.fillWithBlocks(world, sbb, 3, 1, 2, 5, 1, 3, Blocks.CARPET.getStateFromMeta(10), Blocks.CARPET.getStateFromMeta(10), false);
this.fillWithBlocks(world, sbb, 3, 1, 4, 4, 1, 6, Blocks.CARPET.getStateFromMeta(10), Blocks.CARPET.getStateFromMeta(10), false);
@ -215,14 +215,14 @@ public class VillageComponentJamHouse extends StructureVillagePieces.House1 {
}
//Torches
this.setBlockState(world, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.SOUTH), 6, 2, 0, sbb);
this.setBlockState(world, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.SOUTH), 4, 2, 0, sbb);
this.setBlockState(world, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.NORTH), 5, 2, 8, sbb);
this.setBlockState(world, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.NORTH), 3, 2, 8, sbb);
this.setBlockState(world, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.EAST), 2, 3, 2, sbb);
this.setBlockState(world, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.EAST), 2, 3, 6, sbb);
this.setBlockState(world, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.WEST), 8, 3, 2, sbb);
this.setBlockState(world, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.WEST), 8, 3, 6, sbb);
this.setBlockState(world, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, Direction.SOUTH), 6, 2, 0, sbb);
this.setBlockState(world, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, Direction.SOUTH), 4, 2, 0, sbb);
this.setBlockState(world, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, Direction.NORTH), 5, 2, 8, sbb);
this.setBlockState(world, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, Direction.NORTH), 3, 2, 8, sbb);
this.setBlockState(world, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, Direction.EAST), 2, 3, 2, sbb);
this.setBlockState(world, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, Direction.EAST), 2, 3, 6, sbb);
this.setBlockState(world, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, Direction.WEST), 8, 3, 2, sbb);
this.setBlockState(world, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, Direction.WEST), 8, 3, 6, sbb);
}
@Override

View file

@ -14,7 +14,7 @@ import java.util.List;
import java.util.Random;
import de.ellpeck.actuallyadditions.mod.gen.village.component.VillageComponentCustomCropField;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.world.gen.structure.StructureComponent;
import net.minecraft.world.gen.structure.StructureVillagePieces;
import net.minecraftforge.fml.common.registry.VillagerRegistry;
@ -32,7 +32,7 @@ public class VillageCustomCropFieldHandler implements VillagerRegistry.IVillageC
}
@Override
public StructureVillagePieces.Village buildComponent(StructureVillagePieces.PieceWeight villagePiece, StructureVillagePieces.Start startPiece, List<StructureComponent> pieces, Random random, int p1, int p2, int p3, EnumFacing facing, int p5) {
public StructureVillagePieces.Village buildComponent(StructureVillagePieces.PieceWeight villagePiece, StructureVillagePieces.Start startPiece, List<StructureComponent> pieces, Random random, int p1, int p2, int p3, Direction facing, int p5) {
return VillageComponentCustomCropField.buildComponent(pieces, p1, p2, p3, facing);
}
}

View file

@ -14,7 +14,7 @@ import java.util.List;
import java.util.Random;
import de.ellpeck.actuallyadditions.mod.gen.village.component.VillageComponentEngineerHouse;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.world.gen.structure.StructureComponent;
import net.minecraft.world.gen.structure.StructureVillagePieces;
import net.minecraftforge.fml.common.registry.VillagerRegistry;
@ -32,7 +32,7 @@ public class VillageEngineerHouseHandler implements VillagerRegistry.IVillageCre
}
@Override
public StructureVillagePieces.Village buildComponent(StructureVillagePieces.PieceWeight villagePiece, StructureVillagePieces.Start startPiece, List<StructureComponent> pieces, Random random, int p1, int p2, int p3, EnumFacing facing, int p5) {
public StructureVillagePieces.Village buildComponent(StructureVillagePieces.PieceWeight villagePiece, StructureVillagePieces.Start startPiece, List<StructureComponent> pieces, Random random, int p1, int p2, int p3, Direction facing, int p5) {
return VillageComponentEngineerHouse.buildComponent(pieces, p1, p2, p3, facing);
}
}

View file

@ -14,7 +14,7 @@ import java.util.List;
import java.util.Random;
import de.ellpeck.actuallyadditions.mod.gen.village.component.VillageComponentJamHouse;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.world.gen.structure.StructureComponent;
import net.minecraft.world.gen.structure.StructureVillagePieces;
import net.minecraftforge.fml.common.registry.VillagerRegistry;
@ -32,7 +32,7 @@ public class VillageJamHouseHandler implements VillagerRegistry.IVillageCreation
}
@Override
public StructureVillagePieces.Village buildComponent(StructureVillagePieces.PieceWeight villagePiece, StructureVillagePieces.Start startPiece, List<StructureComponent> pieces, Random random, int p1, int p2, int p3, EnumFacing facing, int p5) {
public StructureVillagePieces.Village buildComponent(StructureVillagePieces.PieceWeight villagePiece, StructureVillagePieces.Start startPiece, List<StructureComponent> pieces, Random random, int p1, int p2, int p3, Direction facing, int p5) {
return VillageComponentJamHouse.buildComponent(pieces, p1, p2, p3, facing);
}
}

View file

@ -25,7 +25,7 @@ import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
@ -69,7 +69,7 @@ public class ItemAllToolAA extends ItemToolAA implements IColorProvidingItem {
}
@Override
public EnumActionResult onItemUse(PlayerEntity playerIn, World worldIn, BlockPos pos, Hand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
public EnumActionResult onItemUse(PlayerEntity playerIn, World worldIn, BlockPos pos, Hand hand, Direction side, float hitX, float hitY, float hitZ) {
if (!playerIn.isSneaking()) {
return Items.IRON_HOE.onItemUse(playerIn, worldIn, pos, hand, side, hitX, hitY, hitZ);
}

View file

@ -23,7 +23,7 @@ import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@ -41,7 +41,7 @@ public class ItemBag extends ItemBase {
}
@Override
public EnumActionResult onItemUse(PlayerEntity playerIn, World worldIn, BlockPos pos, Hand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
public EnumActionResult onItemUse(PlayerEntity playerIn, World worldIn, BlockPos pos, Hand hand, Direction facing, float hitX, float hitY, float hitZ) {
ItemStack stack = playerIn.getHeldItem(hand);
if (!this.isVoid) {
TileEntity tile = worldIn.getTileEntity(pos);

View file

@ -29,7 +29,7 @@ import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
@ -53,7 +53,7 @@ public class ItemBooklet extends ItemBase implements IHudDisplay {
}
@Override
public EnumActionResult onItemUse(PlayerEntity player, World world, BlockPos pos, Hand hand, EnumFacing face, float hitX, float hitY, float hitZ) {
public EnumActionResult onItemUse(PlayerEntity player, World world, BlockPos pos, Hand hand, Direction face, float hitX, float hitY, float hitZ) {
if (player.isSneaking()) {
BlockState state = world.getBlockState(pos);
Block block = state.getBlock();

View file

@ -21,7 +21,7 @@ import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@ -40,7 +40,7 @@ public class ItemChestToCrateUpgrade extends ItemBase {
}
@Override
public EnumActionResult onItemUseFirst(PlayerEntity player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, Hand hand) {
public EnumActionResult onItemUseFirst(PlayerEntity player, World world, BlockPos pos, Direction side, float hitX, float hitY, float hitZ, Hand hand) {
ItemStack heldStack = player.getHeldItem(hand);
if (player.isSneaking()) {
TileEntity tileHit = world.getTileEntity(pos);

View file

@ -18,7 +18,7 @@ import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemDye;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@ -32,7 +32,7 @@ public class ItemFertilizer extends ItemBase {
}
@Override
public EnumActionResult onItemUse(PlayerEntity player, World world, BlockPos pos, Hand hand, EnumFacing side, float par8, float par9, float par10) {
public EnumActionResult onItemUse(PlayerEntity player, World world, BlockPos pos, Hand hand, Direction side, float par8, float par9, float par10) {
ItemStack stack = player.getHeldItem(hand);
if (ItemDye.applyBonemeal(stack, world, pos, player, hand)) {
if (!world.isRemote) {

View file

@ -26,7 +26,7 @@ import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
@ -81,7 +81,7 @@ public class ItemFillingWand extends ItemEnergy {
}
@Override
public EnumActionResult onItemUse(PlayerEntity player, World world, BlockPos pos, Hand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
public EnumActionResult onItemUse(PlayerEntity player, World world, BlockPos pos, Hand hand, Direction facing, float hitX, float hitY, float hitZ) {
ItemStack stack = player.getHeldItem(hand);
if (!world.isRemote && player.getItemInUseCount() <= 0) {
if (player.isSneaking()) {

View file

@ -21,7 +21,7 @@ import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentTranslation;
@ -38,7 +38,7 @@ public class ItemLaserWrench extends ItemBase {
}
@Override
public EnumActionResult onItemUse(PlayerEntity player, World world, BlockPos pos, Hand hand, EnumFacing par7, float par8, float par9, float par10) {
public EnumActionResult onItemUse(PlayerEntity player, World world, BlockPos pos, Hand hand, Direction par7, float par8, float par9, float par10) {
ItemStack stack = player.getHeldItem(hand);
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileEntityLaserRelay) {

View file

@ -22,7 +22,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentTranslation;
@ -85,7 +85,7 @@ public class ItemPhantomConnector extends ItemBase {
}
@Override
public EnumActionResult onItemUse(PlayerEntity player, World world, BlockPos pos, Hand hand, EnumFacing par7, float par8, float par9, float par10) {
public EnumActionResult onItemUse(PlayerEntity player, World world, BlockPos pos, Hand hand, Direction par7, float par8, float par9, float par10) {
ItemStack stack = player.getHeldItem(hand);
if (!world.isRemote) {
//Passing Data to Phantoms

View file

@ -23,7 +23,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentTranslation;
@ -65,7 +65,7 @@ public class ItemPlayerProbe extends ItemBase {
}
@Override
public EnumActionResult onItemUse(PlayerEntity player, World world, BlockPos pos, Hand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
public EnumActionResult onItemUse(PlayerEntity player, World world, BlockPos pos, Hand hand, Direction facing, float hitX, float hitY, float hitZ) {
ItemStack stack = player.getHeldItem(hand);
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileEntityPlayerInterface) {

View file

@ -20,7 +20,7 @@ import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@ -50,7 +50,7 @@ public class ItemShovelAA extends ItemToolAA {
}
@Override
public EnumActionResult onItemUse(PlayerEntity playerIn, World worldIn, BlockPos pos, Hand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
public EnumActionResult onItemUse(PlayerEntity playerIn, World worldIn, BlockPos pos, Hand hand, Direction facing, float hitX, float hitY, float hitZ) {
return Items.IRON_SHOVEL.onItemUse(playerIn, worldIn, pos, hand, facing, hitX, hitY, hitZ);
}

View file

@ -26,7 +26,7 @@ import net.minecraft.tileentity.MobSpawnerBaseLogic;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityMobSpawner;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
@ -43,7 +43,7 @@ public class ItemSpawnerChanger extends ItemBase {
}
@Override
public EnumActionResult onItemUse(PlayerEntity player, World world, BlockPos pos, Hand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
public EnumActionResult onItemUse(PlayerEntity player, World world, BlockPos pos, Hand hand, Direction facing, float hitX, float hitY, float hitZ) {
if (!world.isRemote) {
ItemStack stack = player.getHeldItemMainhand();
if (player.canPlayerEdit(pos.offset(facing), facing, stack)) {

View file

@ -102,7 +102,7 @@ public class ItemWaterBowl extends ItemBase {
if (!world.isBlockModifiable(player, pos)) {
return new ActionResult<>(EnumActionResult.FAIL, stack);
} else {
BlockPos pos1 = world.getBlockState(pos).getBlock().isReplaceable(world, pos) && trace.sideHit == EnumFacing.UP
BlockPos pos1 = world.getBlockState(pos).getBlock().isReplaceable(world, pos) && trace.sideHit == Direction.UP
? pos
: pos.offset(trace.sideHit);

View file

@ -25,7 +25,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraftforge.common.MinecraftForge;
@ -167,7 +167,7 @@ public class ItemWingsOfTheBats extends ItemBase {
} else {
BlockPos pos = new BlockPos(player.posX, player.posY + player.height, player.posZ);
BlockState state = player.world.getBlockState(pos);
if (state != null && state.isSideSolid(player.world, pos, EnumFacing.DOWN)) {
if (state != null && state.isSideSolid(player.world, pos, Direction.DOWN)) {
deductTime = 10;
}
}

View file

@ -23,7 +23,7 @@ import net.minecraft.item.EnumRarity;
import net.minecraft.item.IItemPropertyGetter;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
@ -58,7 +58,7 @@ public class ItemWorm extends ItemBase {
}
@Override
public EnumActionResult onItemUse(PlayerEntity player, World world, BlockPos pos, Hand hand, EnumFacing side, float par8, float par9, float par10) {
public EnumActionResult onItemUse(PlayerEntity player, World world, BlockPos pos, Hand hand, Direction side, float par8, float par9, float par10) {
ItemStack stack = player.getHeldItem(hand);
BlockState state = world.getBlockState(pos);
if (EntityWorm.canWormify(world, pos, state)) {

View file

@ -19,7 +19,7 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
@ -216,13 +216,13 @@ public abstract class ItemEnergy extends ItemBase {
}
@Override
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
public boolean hasCapability(Capability<?> capability, Direction facing) {
return this.getCapability(capability, facing) != null;
}
@Nullable
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
public <T> T getCapability(Capability<T> capability, Direction facing) {
if (capability == CapabilityEnergy.ENERGY) {
return CapabilityEnergy.ENERGY.cast(this.storage);
}

View file

@ -25,7 +25,7 @@ import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
@ -61,7 +61,7 @@ public class LensColor extends Lens {
ItemStack returnStack = this.tryConvert(new ItemStack(block, 1, meta), hitState, hitBlock, tile);
if (returnStack != null && returnStack.getItem() instanceof ItemBlock) {
Block toPlace = Block.getBlockFromItem(returnStack.getItem());
BlockState state2Place = toPlace.getStateForPlacement(tile.getWorldObject(), hitBlock, EnumFacing.UP, 0, 0, 0, returnStack.getMetadata(), FakePlayerFactory.getMinecraft((WorldServer) tile.getWorldObject()), Hand.MAIN_HAND);
BlockState state2Place = toPlace.getStateForPlacement(tile.getWorldObject(), hitBlock, Direction.UP, 0, 0, 0, returnStack.getMetadata(), FakePlayerFactory.getMinecraft((WorldServer) tile.getWorldObject()), Hand.MAIN_HAND);
tile.getWorldObject().setBlockState(hitBlock, state2Place, 2);
tile.extractEnergy(ENERGY_USE);
}
@ -107,7 +107,7 @@ public class LensColor extends Lens {
}
@Override
public boolean canInvoke(IAtomicReconstructor tile, EnumFacing sideToShootTo, int energyUsePerShot) {
public boolean canInvoke(IAtomicReconstructor tile, Direction sideToShootTo, int energyUsePerShot) {
return tile.getEnergy() - energyUsePerShot >= ENERGY_USE;
}
}

View file

@ -13,7 +13,7 @@ package de.ellpeck.actuallyadditions.mod.items.lens;
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
import de.ellpeck.actuallyadditions.api.lens.Lens;
import net.minecraft.block.state.BlockState;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
public class LensDetonation extends Lens {
@ -43,7 +43,7 @@ public class LensDetonation extends Lens {
}
@Override
public boolean canInvoke(IAtomicReconstructor tile, EnumFacing sideToShootTo, int energyUsePerShot) {
public boolean canInvoke(IAtomicReconstructor tile, Direction sideToShootTo, int energyUsePerShot) {
return tile.getEnergy() - energyUsePerShot >= ENERGY_USE;
}
}

View file

@ -26,7 +26,7 @@ import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemEnchantedBook;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
@ -114,7 +114,7 @@ public class LensDisenchanting extends Lens {
}
@Override
public boolean canInvoke(IAtomicReconstructor tile, EnumFacing sideToShootTo, int energyUsePerShot) {
public boolean canInvoke(IAtomicReconstructor tile, Direction sideToShootTo, int energyUsePerShot) {
return tile.getEnergy() - energyUsePerShot >= ENERGY_USE;
}
}

View file

@ -21,7 +21,7 @@ import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
@ -82,7 +82,7 @@ public class LensDisruption extends Lens {
}
@Override
public boolean canInvoke(IAtomicReconstructor tile, EnumFacing sideToShootTo, int energyUsePerShot) {
public boolean canInvoke(IAtomicReconstructor tile, Direction sideToShootTo, int energyUsePerShot) {
return tile.getEnergy() - energyUsePerShot >= ENERGY_USE;
}
}

View file

@ -27,7 +27,7 @@ import net.minecraft.block.state.BlockState;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.WeightedRandom;
import net.minecraft.util.math.BlockPos;
@ -164,7 +164,7 @@ public class LensMining extends Lens {
if (tile.getEnergy() >= adaptedUse) {
Block block = Block.getBlockFromItem(stack.getItem());
if (block != Blocks.AIR) {
BlockState state = block.getStateForPlacement(tile.getWorldObject(), hitPos, EnumFacing.UP, 0, 0, 0, stack.getMetadata(), FakePlayerFactory.getMinecraft((WorldServer) tile.getWorldObject()), Hand.MAIN_HAND);
BlockState state = block.getStateForPlacement(tile.getWorldObject(), hitPos, Direction.UP, 0, 0, 0, stack.getMetadata(), FakePlayerFactory.getMinecraft((WorldServer) tile.getWorldObject()), Hand.MAIN_HAND);
tile.getWorldObject().setBlockState(hitPos, state, 2);
tile.getWorldObject().playEvent(2001, hitPos, Block.getStateId(state));

View file

@ -15,14 +15,14 @@ import net.minecraft.dispenser.BehaviorDefaultDispenseItem;
import net.minecraft.dispenser.IBlockSource;
import net.minecraft.item.ItemDye;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
public class DispenserHandlerFertilize extends BehaviorDefaultDispenseItem {
@Override
public ItemStack dispenseStack(IBlockSource source, ItemStack stack) {
EnumFacing facing = source.getBlockState().getValue(BlockDispenser.FACING);
Direction facing = source.getBlockState().getValue(BlockDispenser.FACING);
BlockPos pos = source.getBlockPos().offset(facing);
if (ItemDye.applyBonemeal(stack, source.getWorld(), pos)) {

View file

@ -40,7 +40,7 @@ import net.minecraft.item.crafting.IRecipe;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
@ -154,11 +154,11 @@ public class MethodHandler implements IMethodHandler {
int rangeY = 0;
int rangeZ = 0;
EnumFacing facing = tile.getOrientation();
if (facing != EnumFacing.UP && facing != EnumFacing.DOWN) {
Direction facing = tile.getOrientation();
if (facing != Direction.UP && facing != Direction.DOWN) {
rangeY = range;
if (facing == EnumFacing.NORTH || facing == EnumFacing.SOUTH) {
if (facing == Direction.NORTH || facing == Direction.SOUTH) {
rangeX = range;
} else {
rangeZ = range;
@ -248,7 +248,7 @@ public class MethodHandler implements IMethodHandler {
@Override
public boolean invokeReconstructor(IAtomicReconstructor tile) {
if (tile.getEnergy() >= TileEntityAtomicReconstructor.ENERGY_USE) {
EnumFacing sideToManipulate = tile.getOrientation();
Direction sideToManipulate = tile.getOrientation();
Lens currentLens = tile.getLens();
if (currentLens.canInvoke(tile, sideToManipulate, TileEntityAtomicReconstructor.ENERGY_USE)) {
tile.extractEnergy(TileEntityAtomicReconstructor.ENERGY_USE);

View file

@ -32,7 +32,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.NonNullList;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
@ -170,7 +170,7 @@ public class DefaultFarmerBehavior implements IFarmerBehavior {
ItemStack itemstack = getHoeStack();
if (!player.canPlayerEdit(pos.offset(EnumFacing.UP), EnumFacing.UP, itemstack)) {
if (!player.canPlayerEdit(pos.offset(Direction.UP), Direction.UP, itemstack)) {
return EnumActionResult.FAIL;
} else {
int hook = net.minecraftforge.event.ForgeEventFactory.onHoeUse(itemstack, player, world, pos);

View file

@ -19,7 +19,7 @@ import net.minecraft.block.state.BlockState;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@ -32,7 +32,7 @@ public class NetherWartFarmerBehavior implements IFarmerBehavior {
int use = 500;
if (farmer.getEnergy() >= use) {
if (seed.getItem() == Items.NETHER_WART) {
if (world.getBlockState(pos.down()).getBlock().canSustainPlant(world.getBlockState(pos.down()), world, pos.down(), EnumFacing.UP, (IPlantable) Items.NETHER_WART)) {
if (world.getBlockState(pos.down()).getBlock().canSustainPlant(world.getBlockState(pos.down()), world, pos.down(), Direction.UP, (IPlantable) Items.NETHER_WART)) {
world.setBlockState(pos, Blocks.NETHER_WART.getDefaultState(), 2);
farmer.extractEnergy(use);
return FarmerResult.SUCCESS;

View file

@ -0,0 +1,70 @@
package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
import net.minecraft.tileentity.TileEntityType;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
public class ActuallyTiles {
public static final DeferredRegister<TileEntityType<?>> TILES = DeferredRegister.create(ForgeRegistries.TILE_ENTITIES, ActuallyAdditions.MODID);
public static final RegistryObject<TileEntityType<?>> COMPOST_TILE = TILES.register("compost", () -> TileEntityType.Builder.create(TileEntityCompost::new, InitBlocks.blockCompost.get()).build(null));
public static final RegistryObject<TileEntityType<?>> FEEDER_TILE = TILES.register("feeder", () -> TileEntityType.Builder.create(TileEntityFeeder::new, InitBlocks.blockFeeder.get()).build(null));
// public static final RegistryObject<TileEntityType<?>> GIANTCHEST_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityGiantChest::new, ).build(null));
// public static final RegistryObject<TileEntityType<?>> GIANTCHESTMEDIUM_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityGiantChestMedium::new, ).build(null));
// public static final RegistryObject<TileEntityType<?>> GIANTCHESTLARGE_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityGiantChestLarge::new, ).build(null));
public static final RegistryObject<TileEntityType<?>> GRINDER_TILE = TILES.register("grinder", () -> TileEntityType.Builder.create(TileEntityGrinder::new, InitBlocks.blockGrinder.get()).build(null));
public static final RegistryObject<TileEntityType<?>> FURNACE_DOUBLE_TILE = TILES.register("furnaceDouble", () -> TileEntityType.Builder.create(TileEntityFurnaceDouble::new, InitBlocks.blockFurnaceDouble.get()).build(null));
public static final RegistryObject<TileEntityType<?>> INPUTTER_TILE = TILES.register("inputter", () -> TileEntityType.Builder.create(TileEntityInputter::new, InitBlocks.blockInputter.get()).build(null));
public static final RegistryObject<TileEntityType<?>> FISHINGNET_TILE = TILES.register("fishingNet", () -> TileEntityType.Builder.create(TileEntityFishingNet::new, InitBlocks.blockFishingNet.get()).build(null));
public static final RegistryObject<TileEntityType<?>> FURNACESOLAR_TILE = TILES.register("solarPanel", () -> TileEntityType.Builder.create(TileEntityFurnaceSolar::new, InitBlocks.blockFurnaceSolar.get()).build(null));
public static final RegistryObject<TileEntityType<?>> HEATCOLLECTOR_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityHeatCollector::new, InitBlocks.blockHeatCollector.get()).build(null));
public static final RegistryObject<TileEntityType<?>> ITEMREPAIRER_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityItemRepairer::new, InitBlocks.blockItemRepairer.get()).build(null));
public static final RegistryObject<TileEntityType<?>> BREAKER_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityBreaker::new, InitBlocks.blockBreaker.get()).build(null));
public static final RegistryObject<TileEntityType<?>> DROPPER_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityDropper::new, InitBlocks.blockDropper.get()).build(null));
public static final RegistryObject<TileEntityType<?>> INPUTTERADVANCED_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityInputterAdvanced::new, InitBlocks.blockInputterAdvanced.get()).build(null));
public static final RegistryObject<TileEntityType<?>> PLACER_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityPlacer::new, InitBlocks.blockPlacer.get()).build(null));
public static final RegistryObject<TileEntityType<?>> GRINDER_DOUBLE_TILE = TILES.register("grinderDouble", () -> TileEntityType.Builder.create(TileEntityGrinderDouble::new, InitBlocks.blockGrinderDouble.get()).build(null));
public static final RegistryObject<TileEntityType<?>> CANOLAPRESS_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityCanolaPress::new, InitBlocks.blockCanolaPress.get()).build(null));
public static final RegistryObject<TileEntityType<?>> FERMENTINGBARREL_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityFermentingBarrel::new, InitBlocks.blockFermentingBarrel.get()).build(null));
public static final RegistryObject<TileEntityType<?>> OILGENERATOR_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityOilGenerator::new, InitBlocks.blockOilGenerator.get()).build(null));
public static final RegistryObject<TileEntityType<?>> COALGENERATOR_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityCoalGenerator::new, InitBlocks.blockCoalGenerator.get()).build(null));
public static final RegistryObject<TileEntityType<?>> PHANTOMITEMFACE_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityPhantomItemface::new, InitBlocks.blockPhantomface.get()).build(null));
public static final RegistryObject<TileEntityType<?>> PHANTOMLIQUIFACE_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityPhantomLiquiface::new, InitBlocks.blockPhantomLiquiface.get()).build(null));
public static final RegistryObject<TileEntityType<?>> PHANTOMENERGYFACE_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityPhantomEnergyface::new, InitBlocks.blockPhantomEnergyface.get()).build(null));
public static final RegistryObject<TileEntityType<?>> PLAYERINTERFACE_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityPlayerInterface::new, InitBlocks.blockPlayerInterface.get()).build(null));
public static final RegistryObject<TileEntityType<?>> PHANTOMPLACER_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityPhantomPlacer::new, InitBlocks.blockPhantomPlacer.get()).build(null));
public static final RegistryObject<TileEntityType<?>> PHANTOMBREAKER_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityPhantomBreaker::new, InitBlocks.blockPhantomBreaker.get()).build(null));
public static final RegistryObject<TileEntityType<?>> FLUIDCOLLECTOR_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityFluidCollector::new, InitBlocks.blockFluidCollector.get()).build(null));
public static final RegistryObject<TileEntityType<?>> FLUIDPLACER_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityFluidPlacer::new, InitBlocks.blockFluidPlacer.get()).build(null));
public static final RegistryObject<TileEntityType<?>> LAVAFACTORYCONTROLLER_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityLavaFactoryController::new, InitBlocks.blockLavaFactoryController.get()).build(null));
public static final RegistryObject<TileEntityType<?>> COFFEEMACHINE_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityCoffeeMachine::new, InitBlocks.blockCoffeeMachine.get()).build(null));
public static final RegistryObject<TileEntityType<?>> PHANTOMBOOSTER_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityPhantomBooster::new, InitBlocks.blockPhantomBooster.get()).build(null));
public static final RegistryObject<TileEntityType<?>> ENERGIZER_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityEnergizer::new, InitBlocks.blockEnergizer.get()).build(null));
public static final RegistryObject<TileEntityType<?>> ENERVATOR_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityEnervator::new, InitBlocks.blockEnervator.get()).build(null));
public static final RegistryObject<TileEntityType<?>> XPSOLIDIFIER_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityXPSolidifier::new, InitBlocks.blockXPSolidifier.get()).build(null));
public static final RegistryObject<TileEntityType<?>> SMILEYCLOUD_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntitySmileyCloud::new, InitBlocks.blockSmileyCloud.get()).build(null));
public static final RegistryObject<TileEntityType<?>> LEAFGENERATOR_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityLeafGenerator::new, InitBlocks.blockLeafGenerator.get()).build(null));
public static final RegistryObject<TileEntityType<?>> DIRECTIONALBREAKER_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityDirectionalBreaker::new, InitBlocks.blockDirectionalBreaker.get()).build(null));
public static final RegistryObject<TileEntityType<?>> RANGEDCOLLECTOR_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityRangedCollector::new, InitBlocks.blockRangedCollector.get()).build(null));
public static final RegistryObject<TileEntityType<?>> ATOMICRECONSTRUCTOR_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityAtomicReconstructor::new, InitBlocks.blockAtomicReconstructor.get()).build(null));
public static final RegistryObject<TileEntityType<?>> MINER_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityMiner::new, InitBlocks.blockMiner.get()).build(null));
public static final RegistryObject<TileEntityType<?>> FIREWORKBOX_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityFireworkBox::new, InitBlocks.blockFireworkBox.get()).build(null));
public static final RegistryObject<TileEntityType<?>> PHANTOMREDSTONEFACE_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityPhantomRedstoneface::new, InitBlocks.blockPhantomRedstoneface.get()).build(null));
public static final RegistryObject<TileEntityType<?>> LASERRELAYITEM_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityLaserRelayItem::new, InitBlocks.blockLaserRelayItem.get()).build(null));
public static final RegistryObject<TileEntityType<?>> LASERRELAYENERGY_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityLaserRelayEnergy::new, InitBlocks.blockLaserRelay.get()).build(null));
public static final RegistryObject<TileEntityType<?>> LASERRELAYENERGYADVANCED_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityLaserRelayEnergyAdvanced::new, InitBlocks.blockLaserRelayAdvanced.get()).build(null));
public static final RegistryObject<TileEntityType<?>> LASERRELAYENERGYEXTREME_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityLaserRelayEnergyExtreme::new, InitBlocks.blockLaserRelayExtreme.get()).build(null));
public static final RegistryObject<TileEntityType<?>> LASERRELAYITEMWHITELIST_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityLaserRelayItemWhitelist::new, InitBlocks.blockLaserRelayItemWhitelist.get()).build(null));
public static final RegistryObject<TileEntityType<?>> ITEMVIEWER_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityItemViewer::new, InitBlocks.blockItemViewer.get()).build(null));
public static final RegistryObject<TileEntityType<?>> DISPLAYSTAND_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityDisplayStand::new, InitBlocks.blockDisplayStand.get()).build(null));
public static final RegistryObject<TileEntityType<?>> SHOCKSUPPRESSOR_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityShockSuppressor::new, InitBlocks.blockShockSuppressor.get()).build(null));
public static final RegistryObject<TileEntityType<?>> EMPOWERER_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityEmpowerer::new, InitBlocks.blockEmpowerer.get()).build(null));
public static final RegistryObject<TileEntityType<?>> LASERRELAYFLUIDS_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityLaserRelayFluids::new, InitBlocks.blockLaserRelayFluids.get()).build(null));
public static final RegistryObject<TileEntityType<?>> BIOREACTOR_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityBioReactor::new, InitBlocks.blockBioReactor.get()).build(null));
public static final RegistryObject<TileEntityType<?>> FARMER_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityFarmer::new, InitBlocks.blockFarmer.get()).build(null));
public static final RegistryObject<TileEntityType<?>> ITEMVIEWERHOPPING_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityItemViewerHopping::new, InitBlocks.blockItemViewer.get()).build(null));
public static final RegistryObject<TileEntityType<?>> BATTERYBOX_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityBatteryBox::new, InitBlocks.blockBatteryBox.get()).build(null));
}

View file

@ -11,7 +11,7 @@
package de.ellpeck.actuallyadditions.mod.tile;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
public interface ISharingEnergyProvider {
@ -19,7 +19,7 @@ public interface ISharingEnergyProvider {
boolean doesShareEnergy();
EnumFacing[] getEnergyShareSides();
Direction[] getEnergyShareSides();
boolean canShareTo(TileEntity tile);
}

View file

@ -10,7 +10,7 @@
package de.ellpeck.actuallyadditions.mod.tile;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
public interface ISharingFluidHandler {
@ -18,6 +18,6 @@ public interface ISharingFluidHandler {
boolean doesShareFluid();
EnumFacing[] getFluidShareSides();
Direction[] getFluidShareSides();
}

View file

@ -21,10 +21,10 @@ import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.BlockState;
import net.minecraft.item.Item;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
@ -111,7 +111,7 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
}
@Override
public EnumFacing getOrientation() {
public Direction getOrientation() {
BlockState state = this.world.getBlockState(this.pos);
return WorldUtil.getDirectionByPistonRotation(state);
}
@ -177,7 +177,7 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
}
@Override
public IEnergyStorage getEnergyStorage(EnumFacing facing) {
public IEnergyStorage getEnergyStorage(Direction facing) {
return this.storage;
}
}

View file

@ -14,31 +14,30 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
import de.ellpeck.actuallyadditions.mod.util.VanillaPacketDispatcher;
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.texture.ITickable;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
import net.minecraft.network.play.server.SUpdateTileEntityPacket;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ITickable;
import net.minecraft.util.ResourceLocation;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.world.World;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.energy.CapabilityEnergy;
import net.minecraftforge.energy.IEnergyStorage;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.fluids.capability.IFluidHandler;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public abstract class TileEntityBase extends TileEntity implements ITickable {
public final String name;
public boolean isRedstonePowered;
public boolean isPulseMode;
public boolean stopFromDropping;
@ -46,102 +45,59 @@ public abstract class TileEntityBase extends TileEntity implements ITickable {
protected TileEntity[] tilesAround = new TileEntity[6];
protected boolean hasSavedDataOnChangeOrWorldStart;
public TileEntityBase(String name) {
this.name = name;
public TileEntityBase(TileEntityType<?> type) {
super(type);
}
public static void init() {
ActuallyAdditions.LOGGER.info("Registering TileEntities...");
register(TileEntityCompost.class);
register(TileEntityFeeder.class);
register(TileEntityGiantChest.class);
register(TileEntityGiantChestMedium.class);
register(TileEntityGiantChestLarge.class);
register(TileEntityGrinder.class);
register(TileEntityFurnaceDouble.class);
register(TileEntityInputter.class);
register(TileEntityFishingNet.class);
register(TileEntityFurnaceSolar.class);
register(TileEntityHeatCollector.class);
register(TileEntityItemRepairer.class);
register(TileEntityBreaker.class);
register(TileEntityDropper.class);
register(TileEntityInputterAdvanced.class);
register(TileEntityPlacer.class);
register(TileEntityGrinderDouble.class);
register(TileEntityCanolaPress.class);
register(TileEntityFermentingBarrel.class);
register(TileEntityOilGenerator.class);
register(TileEntityCoalGenerator.class);
register(TileEntityPhantomItemface.class);
register(TileEntityPhantomLiquiface.class);
register(TileEntityPhantomEnergyface.class);
register(TileEntityPlayerInterface.class);
register(TileEntityPhantomPlacer.class);
register(TileEntityPhantomBreaker.class);
register(TileEntityFluidCollector.class);
register(TileEntityFluidPlacer.class);
register(TileEntityLavaFactoryController.class);
register(TileEntityCoffeeMachine.class);
register(TileEntityPhantomBooster.class);
register(TileEntityEnergizer.class);
register(TileEntityEnervator.class);
register(TileEntityXPSolidifier.class);
register(TileEntitySmileyCloud.class);
register(TileEntityLeafGenerator.class);
register(TileEntityDirectionalBreaker.class);
register(TileEntityRangedCollector.class);
register(TileEntityAtomicReconstructor.class);
register(TileEntityMiner.class);
register(TileEntityFireworkBox.class);
register(TileEntityPhantomRedstoneface.class);
register(TileEntityLaserRelayItem.class);
register(TileEntityLaserRelayEnergy.class);
register(TileEntityLaserRelayEnergyAdvanced.class);
register(TileEntityLaserRelayEnergyExtreme.class);
register(TileEntityLaserRelayItemWhitelist.class);
register(TileEntityItemViewer.class);
register(TileEntityDisplayStand.class);
register(TileEntityShockSuppressor.class);
register(TileEntityEmpowerer.class);
register(TileEntityLaserRelayFluids.class);
register(TileEntityBioReactor.class);
register(TileEntityFarmer.class);
register(TileEntityItemViewerHopping.class);
register(TileEntityBatteryBox.class);
}
private static void register(Class<? extends TileEntityBase> tileClass) {
try {
//This is hacky and dirty but it works so whatever
ResourceLocation name = new ResourceLocation(ActuallyAdditions.MODID, tileClass.newInstance().name);
GameRegistry.registerTileEntity(tileClass, name);
} catch (Exception e) {
ActuallyAdditions.LOGGER.fatal("Registering a TileEntity failed!", e);
}
// TODO: [port] migrate to register system.
// try {
// //This is hacky and dirty but it works so whatever
// ResourceLocation name = new ResourceLocation(ActuallyAdditions.MODID, tileClass.newInstance().name);
// GameRegistry.registerTileEntity(tileClass, name);
// } catch (Exception e) {
// ActuallyAdditions.LOGGER.fatal("Registering a TileEntity failed!", e);
// }
}
@Override
public final CompoundNBT writeToNBT(CompoundNBT compound) {
public CompoundNBT write(CompoundNBT compound) {
this.writeSyncableNBT(compound, NBTType.SAVE_TILE);
return compound;
}
// TODO: [port] remove if the above is correct
// @Override
// public final CompoundNBT writeToNBT(CompoundNBT compound) {
// this.writeSyncableNBT(compound, NBTType.SAVE_TILE);
// return compound;
// }
@Override
public final void readFromNBT(CompoundNBT compound) {
public void read(BlockState state, CompoundNBT compound) {
this.readSyncableNBT(compound, NBTType.SAVE_TILE);
}
// TODO: [port] remove if the above is correct
// @Override
// public final void readFromNBT(CompoundNBT compound) {
// this.readSyncableNBT(compound, NBTType.SAVE_TILE);
// }
@Nullable
@Override
public final SPacketUpdateTileEntity getUpdatePacket() {
public SUpdateTileEntityPacket getUpdatePacket() {
CompoundNBT compound = new CompoundNBT();
this.writeSyncableNBT(compound, NBTType.SYNC);
return new SPacketUpdateTileEntity(this.pos, -1, compound);
return new SUpdateTileEntityPacket(this.pos, -1, compound);
}
@Override
public final void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt) {
public void onDataPacket(NetworkManager net, SUpdateTileEntityPacket pkt) {
this.readSyncableNBT(pkt.getNbtCompound(), NBTType.SYNC);
}
@ -153,8 +109,8 @@ public abstract class TileEntityBase extends TileEntity implements ITickable {
}
@Override
public final void handleUpdateTag(CompoundNBT compound) {
this.readSyncableNBT(compound, NBTType.SYNC);
public void handleUpdateTag(BlockState state, CompoundNBT tag) {
this.readSyncableNBT(tag, NBTType.SYNC);
}
public final void sendUpdate() {
@ -177,30 +133,30 @@ public abstract class TileEntityBase extends TileEntity implements ITickable {
public void writeSyncableNBT(CompoundNBT compound, NBTType type) {
if (type != NBTType.SAVE_BLOCK) {
super.writeToNBT(compound);
super.write(compound);
}
if (type == NBTType.SAVE_TILE) {
compound.setBoolean("Redstone", this.isRedstonePowered);
compound.setInteger("TicksElapsed", this.ticksElapsed);
compound.setBoolean("StopDrop", this.stopFromDropping);
compound.putBoolean("Redstone", this.isRedstonePowered);
compound.putInt("TicksElapsed", this.ticksElapsed);
compound.putBoolean("StopDrop", this.stopFromDropping);
} else if (type == NBTType.SYNC && this.stopFromDropping) {
compound.setBoolean("StopDrop", this.stopFromDropping);
compound.putBoolean("StopDrop", this.stopFromDropping);
}
if (this.isRedstoneToggle() && (type != NBTType.SAVE_BLOCK || this.isPulseMode)) {
compound.setBoolean("IsPulseMode", this.isPulseMode);
compound.putBoolean("IsPulseMode", this.isPulseMode);
}
}
public void readSyncableNBT(CompoundNBT compound, NBTType type) {
if (type != NBTType.SAVE_BLOCK) {
super.readFromNBT(compound);
super.read(null, compound); // FIXME: [port] flag as possible crash source
}
if (type == NBTType.SAVE_TILE) {
this.isRedstonePowered = compound.getBoolean("Redstone");
this.ticksElapsed = compound.getInteger("TicksElapsed");
this.ticksElapsed = compound.getInt("TicksElapsed");
this.stopFromDropping = compound.getBoolean("StopDrop");
} else if (type == NBTType.SYNC) {
this.stopFromDropping = compound.getBoolean("StopDrop");
@ -211,22 +167,24 @@ public abstract class TileEntityBase extends TileEntity implements ITickable {
}
}
@Override
public boolean shouldRefresh(World world, BlockPos pos, BlockState oldState, BlockState newState) {
return !oldState.getBlock().isAssociatedBlock(newState.getBlock());
}
// TODO: [port] eval if still required in some way
// @Override
// public boolean shouldRefresh(World world, BlockPos pos, BlockState oldState, BlockState newState) {
// return !oldState.getBlock().isAssociatedBlock(newState.getBlock());
// }
public String getNameForTranslation() {
return "container." + ActuallyAdditions.MODID + "." + this.name + ".name";
return "removeme";// "container." + ActuallyAdditions.MODID + "." + this.name + ".name";
}
@Override
public ITextComponent getDisplayName() {
return new TextComponentTranslation(this.getNameForTranslation());
}
// @Override
// public ITextComponent getDisplayName() {
// return new TextComponentTranslation(this.getNameForTranslation());
// }
@Override
public final void update() {
public void tick() {
this.updateEntity();
}
@ -246,14 +204,14 @@ public abstract class TileEntityBase extends TileEntity implements ITickable {
if (provider.doesShareEnergy()) {
int total = provider.getEnergyToSplitShare();
if (total > 0) {
EnumFacing[] sides = provider.getEnergyShareSides();
Direction[] sides = provider.getEnergyShareSides();
int amount = total / sides.length;
if (amount <= 0) {
amount = total;
}
for (EnumFacing side : sides) {
for (Direction side : sides) {
TileEntity tile = this.tilesAround[side.ordinal()];
if (tile != null && provider.canShareTo(tile)) {
WorldUtil.doEnergyInteraction(this, tile, side, amount);
@ -268,14 +226,14 @@ public abstract class TileEntityBase extends TileEntity implements ITickable {
if (handler.doesShareFluid()) {
int total = handler.getMaxFluidAmountToSplitShare();
if (total > 0) {
EnumFacing[] sides = handler.getFluidShareSides();
Direction[] sides = handler.getFluidShareSides();
int amount = total / sides.length;
if (amount <= 0) {
amount = total;
}
for (EnumFacing side : sides) {
for (Direction side : sides) {
TileEntity tile = this.tilesAround[side.ordinal()];
if (tile != null) {
WorldUtil.doFluidInteraction(this, tile, side, amount);
@ -296,7 +254,7 @@ public abstract class TileEntityBase extends TileEntity implements ITickable {
}
public void saveDataOnChangeOrWorldStart() {
for (EnumFacing side : EnumFacing.values()) {
for (Direction side : Direction.values()) {
BlockPos pos = this.pos.offset(side);
if (this.world.isBlockLoaded(pos)) {
this.tilesAround[side.ordinal()] = this.world.getTileEntity(pos);
@ -314,7 +272,7 @@ public abstract class TileEntityBase extends TileEntity implements ITickable {
}
public boolean canPlayerUse(PlayerEntity player) {
return player.getDistanceSq(this.getPos().getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D) <= 64 && !this.isInvalid() && this.world.getTileEntity(this.pos) == this;
return player.getDistanceSq(this.getPos().getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D) <= 64 && !this.isRemoved() && this.world.getTileEntity(this.pos) == this;
}
protected boolean sendUpdateWithInterval() {
@ -326,43 +284,29 @@ public abstract class TileEntityBase extends TileEntity implements ITickable {
}
}
@Nonnull
@Override
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
return this.getCapability(capability, facing) != null;
}
@SuppressWarnings("unchecked")
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> capability, @Nullable Direction side) {
if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
IItemHandler handler = this.getItemHandler(facing);
if (handler != null) {
return (T) handler;
}
return this.getItemHandler(side).cast();
} else if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
IFluidHandler tank = this.getFluidHandler(facing);
if (tank != null) {
return (T) tank;
}
return this.getFluidHandler(side).cast();
} else if (capability == CapabilityEnergy.ENERGY) {
IEnergyStorage storage = this.getEnergyStorage(facing);
if (storage != null) {
return (T) storage;
return this.getEnergyStorage(side).cast();
}
}
return super.getCapability(capability, facing);
return LazyOptional.empty();
}
public IFluidHandler getFluidHandler(EnumFacing facing) {
return null;
public LazyOptional<IFluidHandler> getFluidHandler(Direction facing) {
return LazyOptional.empty();
}
public IEnergyStorage getEnergyStorage(EnumFacing facing) {
return null;
public LazyOptional<IEnergyStorage> getEnergyStorage(Direction facing) {
return LazyOptional.empty();
}
public IItemHandler getItemHandler(EnumFacing facing) {
return null;
public LazyOptional<IItemHandler> getItemHandler(Direction facing) {
return LazyOptional.empty();
}
public boolean isRedstoneToggle() {

Some files were not shown because too many files have changed in this diff Show more