1147 - Initial auto mappings pass

This commit is contained in:
modmuss50 2019-05-26 12:37:59 +01:00
parent 48198dbcb3
commit 4e03ac893c
291 changed files with 3335 additions and 3504 deletions

View file

@ -24,27 +24,27 @@
package techreborn.blocks;
import net.minecraft.ChatFormat;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.block.BlockRenderType;
import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.client.item.TooltipContext;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.item.ItemStack;
import net.minecraft.state.BooleanProperty;
import net.minecraft.state.DirectionProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.state.StateFactory;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.property.DirectionProperty;
import net.minecraft.state.property.Properties;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.IBlockReader;
import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import reborncore.api.ToolManager;
import reborncore.client.models.ModelCompound;
@ -59,13 +59,13 @@ import javax.annotation.Nullable;
import java.util.List;
public class BlockAlarm extends BaseTileBlock {
public static DirectionProperty FACING = BlockStateProperties.FACING;
public static DirectionProperty FACING = Properties.FACING;
public static BooleanProperty ACTIVE;
protected final VoxelShape[] shape;
public BlockAlarm() {
super(Block.Properties.create(Material.ROCK));
this.setDefaultState(this.stateContainer.getBaseState().with(FACING, EnumFacing.NORTH).with(ACTIVE, false));
super(Block.Settings.of(Material.STONE));
this.setDefaultState(this.stateFactory.getDefaultState().with(FACING, Direction.NORTH).with(ACTIVE, false));
this.shape = GenCuboidShapes(3, 10);
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this, "machines/lighting"));
BlockWrenchEventHandler.wrenableBlocks.add(this);
@ -74,54 +74,54 @@ public class BlockAlarm extends BaseTileBlock {
private VoxelShape[] GenCuboidShapes(double depth, double width) {
double culling = (16.0D - width) / 2 ;
VoxelShape[] shapes = {
Block.makeCuboidShape(culling, 16.0 - depth, culling, 16.0 - culling, 16.0D, 16.0 - culling),
Block.makeCuboidShape(culling, 0.0D, culling, 16.0D - culling, depth, 16.0 - culling),
Block.makeCuboidShape(culling, culling, 16.0 - depth, 16.0 - culling, 16.0 - culling, 16.0D),
Block.makeCuboidShape(culling, culling, 0.0D, 16.0 - culling, 16.0 - culling, depth),
Block.makeCuboidShape(16.0 - depth, culling, culling, 16.0D, 16.0 - culling, 16.0 - culling),
Block.makeCuboidShape(0.0D, culling, culling, depth, 16.0 - culling, 16.0 - culling)
Block.createCuboidShape(culling, 16.0 - depth, culling, 16.0 - culling, 16.0D, 16.0 - culling),
Block.createCuboidShape(culling, 0.0D, culling, 16.0D - culling, depth, 16.0 - culling),
Block.createCuboidShape(culling, culling, 16.0 - depth, 16.0 - culling, 16.0 - culling, 16.0D),
Block.createCuboidShape(culling, culling, 0.0D, 16.0 - culling, 16.0 - culling, depth),
Block.createCuboidShape(16.0 - depth, culling, culling, 16.0D, 16.0 - culling, 16.0 - culling),
Block.createCuboidShape(0.0D, culling, culling, depth, 16.0 - culling, 16.0 - culling)
};
return shapes;
}
public static boolean isActive(IBlockState state) {
public static boolean isActive(BlockState state) {
return state.get(ACTIVE);
}
public static EnumFacing getFacing(IBlockState state) {
return (EnumFacing) state.get(FACING);
public static Direction getFacing(BlockState state) {
return (Direction) state.get(FACING);
}
public static void setFacing(EnumFacing facing, World world, BlockPos pos) {
public static void setFacing(Direction facing, World world, BlockPos pos) {
world.setBlockState(pos, world.getBlockState(pos).with(FACING, facing));
}
public static void setActive(boolean active, World world, BlockPos pos) {
EnumFacing facing = world.getBlockState(pos).get(FACING);
IBlockState state = world.getBlockState(pos).with(ACTIVE, active).with(FACING, facing);
Direction facing = world.getBlockState(pos).get(FACING);
BlockState state = world.getBlockState(pos).with(ACTIVE, active).with(FACING, facing);
world.setBlockState(pos, state, 3);
}
// BaseTileBlock
@Nullable
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileAlarm();
}
// Block
@Override
protected void fillStateContainer(StateContainer.Builder<Block, IBlockState> builder) {
protected void appendProperties(StateFactory.Builder<Block, BlockState> builder) {
ACTIVE = BooleanProperty.create("active");
builder.add(FACING, ACTIVE);
}
@Nullable
@Override
public IBlockState getStateForPlacement(BlockItemUseContext context) {
for (EnumFacing enumfacing : context.getNearestLookingDirections()) {
IBlockState iblockstate = this.getDefaultState().with(FACING, enumfacing.getOpposite());
if (iblockstate.isValidPosition(context.getWorld(), context.getPos())) {
public BlockState getPlacementState(ItemPlacementContext context) {
for (Direction enumfacing : context.getPlacementFacings()) {
BlockState iblockstate = this.getDefaultState().with(FACING, enumfacing.getOpposite());
if (iblockstate.canPlaceAt(context.getWorld(), context.getBlockPos())) {
return iblockstate;
}
}
@ -130,9 +130,9 @@ public class BlockAlarm extends BaseTileBlock {
@SuppressWarnings("deprecation")
@Override
public boolean onBlockActivated(IBlockState state, World worldIn, BlockPos pos, EntityPlayer playerIn, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
ItemStack stack = playerIn.getHeldItem(EnumHand.MAIN_HAND);
TileEntity tileEntity = worldIn.getTileEntity(pos);
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, Direction side, float hitX, float hitY, float hitZ) {
ItemStack stack = playerIn.getStackInHand(Hand.MAIN_HAND);
BlockEntity tileEntity = worldIn.getBlockEntity(pos);
// We extended BaseTileBlock. Thus we should always have tile entity. I hope.
if (tileEntity == null) {
@ -145,7 +145,7 @@ public class BlockAlarm extends BaseTileBlock {
}
}
if (!worldIn.isRemote && playerIn.isSneaking()) {
if (!worldIn.isClient && playerIn.isSneaking()) {
((TileAlarm) tileEntity).rightClick();
return true;
@ -155,22 +155,22 @@ public class BlockAlarm extends BaseTileBlock {
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state) {
return EnumBlockRenderType.MODEL;
public BlockRenderType getRenderType(BlockState state) {
return BlockRenderType.MODEL;
}
@Override
public boolean isFullCube(IBlockState state) {
public boolean isFullCube(BlockState state) {
return false;
}
@Override
public void addInformation(ItemStack stack, @Nullable IBlockReader worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
tooltip.add(new TextComponentTranslation("techreborn.tooltip.alarm").applyTextStyle(TextFormatting.GRAY));
public void buildTooltip(ItemStack stack, @Nullable BlockView worldIn, List<Component> tooltip, TooltipContext flagIn) {
tooltip.add(new TranslatableComponent("techreborn.tooltip.alarm").applyFormat(ChatFormat.GRAY));
}
@Override
public VoxelShape getShape(IBlockState state, IBlockReader worldIn, BlockPos pos) {
return shape[getFacing(state).getIndex()];
public VoxelShape getShape(BlockState state, BlockView worldIn, BlockPos pos) {
return shape[getFacing(state).getId()];
}
}

View file

@ -24,15 +24,15 @@
package techreborn.blocks;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.Rotation;
import net.minecraft.util.SoundCategory;
import net.minecraft.sound.SoundCategory;
import net.minecraft.util.BlockRotation;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.World;
import reborncore.api.ToolManager;
import reborncore.api.tile.IMachineGuiHandler;
@ -56,23 +56,23 @@ public class BlockComputerCube extends BlockMachineBase {
}
@Override
public boolean onBlockActivated(IBlockState state, World worldIn, BlockPos pos, EntityPlayer playerIn, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, Direction side, float hitX, float hitY, float hitZ) {
ItemStack tool = playerIn.getHeldItem(EnumHand.MAIN_HAND);
ItemStack tool = playerIn.getStackInHand(Hand.MAIN_HAND);
if (!tool.isEmpty() && ToolManager.INSTANCE.canHandleTool(tool)) {
if (ToolManager.INSTANCE.handleTool(tool, pos, worldIn, playerIn, side, false)) {
if (playerIn.isSneaking()) {
ItemStack drop = new ItemStack(TRContent.COMPUTER_CUBE, 1);
spawnAsEntity(worldIn, pos, drop);
worldIn.playSound(null, playerIn.posX, playerIn.posY, playerIn.posZ, ModSounds.BLOCK_DISMANTLE,
dropStack(worldIn, pos, drop);
worldIn.playSound(null, playerIn.x, playerIn.y, playerIn.z, ModSounds.BLOCK_DISMANTLE,
SoundCategory.BLOCKS, 0.6F, 1F);
if (!worldIn.isRemote) {
if (!worldIn.isClient) {
worldIn.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
}
return true;
}
else {
rotate(worldIn.getBlockState(pos), worldIn, pos, Rotation.CLOCKWISE_90);
rotate(worldIn.getBlockState(pos), worldIn, pos, BlockRotation.CLOCKWISE_90);
return true;
}
}

View file

@ -25,11 +25,11 @@
package techreborn.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.world.BlockView;
import reborncore.common.multiblock.BlockMultiblockBase;
import techreborn.tiles.TileMachineCasing;
@ -38,11 +38,11 @@ public class BlockMachineCasing extends BlockMultiblockBase {
public final int heatCapacity;
public BlockMachineCasing(int heatCapacity) {
super(Block.Properties.create(Material.IRON).hardnessAndResistance(2f).sound(SoundType.METAL));
super(Block.Settings.of(Material.METAL).strength(2f).sounds(BlockSoundGroup.METAL));
this.heatCapacity = heatCapacity;
}
public static int getHeatFromState(IBlockState state) {
public static int getHeatFromState(BlockState state) {
Block block = state.getBlock();
if (!(block instanceof BlockMachineCasing)) {
return 0;
@ -52,7 +52,7 @@ public class BlockMachineCasing extends BlockMultiblockBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileMachineCasing();
}

View file

@ -25,13 +25,13 @@
package techreborn.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.Material;
import net.minecraft.sound.BlockSoundGroup;
import reborncore.common.BaseBlock;
public class BlockMachineFrame extends BaseBlock {
public BlockMachineFrame() {
super(Block.Properties.create(Material.IRON).hardnessAndResistance(1f).sound(SoundType.METAL));
super(Block.Settings.of(Material.METAL).strength(1f).sounds(BlockSoundGroup.METAL));
}
}

View file

@ -25,19 +25,19 @@
package techreborn.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.init.SoundEvents;
import net.minecraft.state.BooleanProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.util.SoundCategory;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.projectile.ProjectileEntity;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
import net.minecraft.state.StateFactory;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.Explosion;
import net.minecraft.world.World;
import net.minecraft.world.explosion.Explosion;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
import reborncore.common.BaseBlock;
@ -51,40 +51,40 @@ public class BlockNuke extends BaseBlock {
public static BooleanProperty OVERLAY = BooleanProperty.create("overlay");
public BlockNuke() {
super(Block.Properties.create(Material.TNT));
this.setDefaultState(this.stateContainer.getBaseState().with(OVERLAY, false));
super(Block.Settings.of(Material.TNT));
this.setDefaultState(this.stateFactory.getDefaultState().with(OVERLAY, false));
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this));
}
public void ignite(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase igniter) {
if (!worldIn.isRemote) {
public void ignite(World worldIn, BlockPos pos, BlockState state, LivingEntity igniter) {
if (!worldIn.isClient) {
EntityNukePrimed entitynukeprimed = new EntityNukePrimed(worldIn, (double) ((float) pos.getX() + 0.5F),
(double) pos.getY(), (double) ((float) pos.getZ() + 0.5F), igniter);
worldIn.spawnEntity(entitynukeprimed);
worldIn.playSound((EntityPlayer) null, entitynukeprimed.posX, entitynukeprimed.posY, entitynukeprimed.posZ,
worldIn.playSound((PlayerEntity) null, entitynukeprimed.x, entitynukeprimed.y, entitynukeprimed.z,
SoundEvents.ENTITY_TNT_PRIMED, SoundCategory.BLOCKS, 1.0F, 1.0F);
}
}
@Override
public void onExplosionDestroy(World worldIn, BlockPos pos, Explosion explosionIn) {
if (!worldIn.isRemote) {
public void onDestroyedByExplosion(World worldIn, BlockPos pos, Explosion explosionIn) {
if (!worldIn.isClient) {
EntityNukePrimed entitynukeprimed = new EntityNukePrimed(worldIn, (double) ((float) pos.getX() + 0.5F),
(double) pos.getY(), (double) ((float) pos.getZ() + 0.5F), explosionIn.getExplosivePlacedBy());
entitynukeprimed.setFuse(worldIn.rand.nextInt(EntityNukePrimed.fuseTime / 4) + EntityNukePrimed.fuseTime / 8);
(double) pos.getY(), (double) ((float) pos.getZ() + 0.5F), explosionIn.getCausingEntity());
entitynukeprimed.setFuse(worldIn.random.nextInt(EntityNukePrimed.fuseTime / 4) + EntityNukePrimed.fuseTime / 8);
worldIn.spawnEntity(entitynukeprimed);
}
}
@Override
public void onEntityCollision(IBlockState state, World worldIn, BlockPos pos, Entity entityIn) {
if (!worldIn.isRemote && entityIn instanceof EntityArrow) {
EntityArrow entityarrow = (EntityArrow) entityIn;
EntityLivingBase shooter = null;
if (entityarrow.getShooter() instanceof EntityLivingBase) {
shooter = (EntityLivingBase) entityarrow.getShooter();
public void onEntityCollision(BlockState state, World worldIn, BlockPos pos, Entity entityIn) {
if (!worldIn.isClient && entityIn instanceof ProjectileEntity) {
ProjectileEntity entityarrow = (ProjectileEntity) entityIn;
LivingEntity shooter = null;
if (entityarrow.getOwner() instanceof LivingEntity) {
shooter = (LivingEntity) entityarrow.getOwner();
}
if (entityarrow.isBurning()) {
if (entityarrow.isOnFire()) {
ignite(worldIn, pos, state, shooter);
worldIn.removeBlock(pos);
}
@ -93,24 +93,24 @@ public class BlockNuke extends BaseBlock {
@SuppressWarnings("deprecation")
@Override
public void onBlockAdded(IBlockState state, World worldIn, BlockPos pos, IBlockState oldState) {
public void onBlockAdded(BlockState state, World worldIn, BlockPos pos, BlockState oldState) {
super.onBlockAdded(state, worldIn, pos, oldState);
if (worldIn.isBlockPowered(pos)) {
if (worldIn.isReceivingRedstonePower(pos)) {
ignite(worldIn, pos, state, null);
worldIn.removeBlock(pos);
}
}
@Override
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos p_189540_5_) {
if (worldIn.isBlockPowered(pos)) {
public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos p_189540_5_) {
if (worldIn.isReceivingRedstonePower(pos)) {
ignite(worldIn, pos, state, null);
worldIn.removeBlock(pos);
}
}
@Override
protected void fillStateContainer(StateContainer.Builder<Block, IBlockState> builder) {
protected void appendProperties(StateFactory.Builder<Block, BlockState> builder) {
builder.add(OVERLAY);
}
}

View file

@ -25,10 +25,10 @@
package techreborn.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraft.util.DefaultedList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import reborncore.common.registration.RebornRegister;
@ -68,11 +68,11 @@ public class BlockOre extends Block {
public static int sphaleriteMaxQuantity = 2;
public BlockOre() {
super(Block.Properties.create(Material.ROCK).hardnessAndResistance(2f));
super(Block.Settings.of(Material.STONE).strength(2f));
}
@Override
public void getDrops(IBlockState state, NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
public void getDrops(BlockState state, DefaultedList<ItemStack> drops, World world, BlockPos pos, int fortune) {
Block ore = state.getBlock();
Random random = new Random();

View file

@ -25,14 +25,14 @@
package techreborn.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFence;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.material.MaterialColor;
import net.minecraft.block.FenceBlock;
import net.minecraft.block.Material;
import net.minecraft.block.MaterialColor;
import net.minecraft.sound.BlockSoundGroup;
public class BlockRefinedIronFence extends BlockFence {
public class BlockRefinedIronFence extends FenceBlock {
public BlockRefinedIronFence() {
super(Block.Properties.create(Material.IRON, MaterialColor.WOOD).hardnessAndResistance(2.0F, 3.0F).sound(SoundType.METAL));
super(Block.Settings.of(Material.METAL, MaterialColor.WOOD).strength(2.0F, 3.0F).sounds(BlockSoundGroup.METAL));
}
}

View file

@ -25,25 +25,25 @@
package techreborn.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.BlockGlass;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.BlockState;
import net.minecraft.block.GlassBlock;
import net.minecraft.block.Material;
import net.minecraft.sound.BlockSoundGroup;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
import techreborn.TechReborn;
import java.util.Random;
public class BlockReinforcedGlass extends BlockGlass {
public class BlockReinforcedGlass extends GlassBlock {
public BlockReinforcedGlass() {
super(Block.Properties.create(Material.GLASS).hardnessAndResistance(4f, 60f).sound(SoundType.STONE));
super(Block.Settings.of(Material.GLASS).strength(4f, 60f).sounds(BlockSoundGroup.STONE));
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this));
}
@Override
public int quantityDropped(IBlockState state, Random random) {
public int quantityDropped(BlockState state, Random random) {
return 1;
}
}

View file

@ -25,13 +25,13 @@
package techreborn.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFire;
import net.minecraft.block.BlockLeaves;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.util.IItemProvider;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.FireBlock;
import net.minecraft.block.LeavesBlock;
import net.minecraft.block.Material;
import net.minecraft.item.ItemConvertible;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import reborncore.client.models.ModelCompound;
@ -39,16 +39,16 @@ import reborncore.client.models.RebornModelRegistry;
import techreborn.TechReborn;
import techreborn.init.TRContent;
public class BlockRubberLeaves extends BlockLeaves {
public class BlockRubberLeaves extends LeavesBlock {
public BlockRubberLeaves() {
super(Block.Properties.create(Material.LEAVES).hardnessAndResistance(0.2F).tickRandomly().sound(SoundType.PLANT));
((BlockFire) Blocks.FIRE).setFireInfo(this, 30, 60);
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this, DISTANCE, PERSISTENT));
super(Block.Settings.of(Material.LEAVES).strength(0.2F).ticksRandomly().sounds(BlockSoundGroup.GRASS));
((FireBlock) Blocks.FIRE).registerFlammableBlock(this, 30, 60);
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this, EnvTypeANCE, PERSISTENT));
}
@Override
public IItemProvider getItemDropped(IBlockState state, World worldIn, BlockPos pos, int fortune) {
public ItemConvertible getItemDropped(BlockState state, World worldIn, BlockPos pos, int fortune) {
return TRContent.RUBBER_SAPLING;
}
}

View file

@ -25,27 +25,27 @@
package techreborn.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFire;
import net.minecraft.block.BlockLog;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.material.MaterialColor;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.FireBlock;
import net.minecraft.block.LogBlock;
import net.minecraft.block.Material;
import net.minecraft.block.MaterialColor;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.state.BooleanProperty;
import net.minecraft.state.DirectionProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.Tag;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.NonNullList;
import net.minecraft.util.SoundCategory;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.sound.SoundCategory;
import net.minecraft.state.StateFactory;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.property.DirectionProperty;
import net.minecraft.state.property.Properties;
import net.minecraft.tag.BlockTags;
import net.minecraft.tag.Tag;
import net.minecraft.util.DefaultedList;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.World;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -64,39 +64,39 @@ import java.util.Random;
/**
* Created by modmuss50 on 19/02/2016.
*/
public class BlockRubberLog extends BlockLog {
public class BlockRubberLog extends LogBlock {
public static DirectionProperty SAP_SIDE = BlockStateProperties.HORIZONTAL_FACING;
public static DirectionProperty SAP_SIDE = Properties.FACING_HORIZONTAL;
public static BooleanProperty HAS_SAP = BooleanProperty.create("hassap");
public BlockRubberLog() {
super(MaterialColor.OBSIDIAN, Block.Properties.create(Material.WOOD, MaterialColor.BROWN).hardnessAndResistance(2.0F).sound(SoundType.WOOD).tickRandomly());
this.setDefaultState(this.getDefaultState().with(SAP_SIDE, EnumFacing.NORTH).with(HAS_SAP, false).with(AXIS, EnumFacing.Axis.Y));
((BlockFire) Blocks.FIRE).setFireInfo(this, 5, 5);
super(MaterialColor.SPRUCE, Block.Settings.of(Material.WOOD, MaterialColor.BROWN).strength(2.0F).sounds(BlockSoundGroup.WOOD).ticksRandomly());
this.setDefaultState(this.getDefaultState().with(SAP_SIDE, Direction.NORTH).with(HAS_SAP, false).with(AXIS, Direction.Axis.Y));
((FireBlock) Blocks.FIRE).registerFlammableBlock(this, 5, 5);
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this));
}
@Override
protected void fillStateContainer(StateContainer.Builder<Block, IBlockState> builder) {
super.fillStateContainer(builder);
protected void appendProperties(StateFactory.Builder<Block, BlockState> builder) {
super.appendProperties(builder);
builder.add(SAP_SIDE, HAS_SAP);
}
@Override
public boolean isIn(Tag<Block> tagIn) {
public boolean matches(Tag<Block> tagIn) {
return tagIn == BlockTags.LOGS;
}
@Override
public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player) {
public void onBreak(World worldIn, BlockPos pos, BlockState state, PlayerEntity player) {
int i = 4;
int j = i + 1;
if (worldIn.isAreaLoaded(pos.add(-j, -j, -j), pos.add(j, j, j))) {
for (BlockPos blockpos : BlockPos.getAllInBox(pos.add(-i, -i, -i), pos.add(i, i, i))) {
IBlockState state1 = worldIn.getBlockState(blockpos);
if (state1.isIn(BlockTags.LEAVES)) {
state1.tick(worldIn, blockpos, worldIn.getRandom());
state1.randomTick(worldIn, blockpos, worldIn.getRandom());
BlockState state1 = worldIn.getBlockState(blockpos);
if (state1.matches(BlockTags.LEAVES)) {
state1.scheduledTick(worldIn, blockpos, worldIn.getRandom());
state1.onRandomTick(worldIn, blockpos, worldIn.getRandom());
}
}
}
@ -104,16 +104,16 @@ public class BlockRubberLog extends BlockLog {
@SuppressWarnings("deprecation")
@Override
public void tick(IBlockState state, World worldIn, BlockPos pos, Random random) {
super.tick(state, worldIn, pos, random);
if (state.get(AXIS) != EnumFacing.Axis.Y) {
public void onScheduledTick(BlockState state, World worldIn, BlockPos pos, Random random) {
super.onScheduledTick(state, worldIn, pos, random);
if (state.get(AXIS) != Direction.Axis.Y) {
return;
}
if (state.get(HAS_SAP)) {
return;
}
if (random.nextInt(50) == 0) {
EnumFacing facing = EnumFacing.byHorizontalIndex(random.nextInt(4));
Direction facing = Direction.fromHorizontal(random.nextInt(4));
if (worldIn.getBlockState(pos.down()).getBlock() == this
&& worldIn.getBlockState(pos.up()).getBlock() == this) {
worldIn.setBlockState(pos, state.with(HAS_SAP, true).with(SAP_SIDE, facing));
@ -123,10 +123,10 @@ public class BlockRubberLog extends BlockLog {
@SuppressWarnings("deprecation")
@Override
public boolean onBlockActivated(IBlockState state, World worldIn, BlockPos pos, EntityPlayer playerIn,
EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn,
Hand hand, Direction side, float hitX, float hitY, float hitZ) {
super.onBlockActivated(state, worldIn, pos, playerIn, hand, side, hitX, hitY, hitZ);
ItemStack stack = playerIn.getHeldItem(EnumHand.MAIN_HAND);
ItemStack stack = playerIn.getStackInHand(Hand.MAIN_HAND);
if (stack.isEmpty()) {
return false;
}
@ -136,22 +136,22 @@ public class BlockRubberLog extends BlockLog {
}
if ((capEnergy != null && capEnergy.getEnergyStored() > 20) || stack.getItem() instanceof ItemTreeTap) {
if (state.get(HAS_SAP) && state.get(SAP_SIDE) == side) {
worldIn.setBlockState(pos, state.with(HAS_SAP, false).with(SAP_SIDE, EnumFacing.byHorizontalIndex(0)));
worldIn.setBlockState(pos, state.with(HAS_SAP, false).with(SAP_SIDE, Direction.fromHorizontal(0)));
worldIn.playSound(null, pos.getX(), pos.getY(), pos.getZ(), ModSounds.SAP_EXTRACT, SoundCategory.BLOCKS,
0.6F, 1F);
if (!worldIn.isRemote) {
if (!worldIn.isClient) {
if (capEnergy != null) {
capEnergy.extractEnergy(20, false);
ExternalPowerSystems.requestEnergyFromArmor(capEnergy, playerIn);
} else {
playerIn.getHeldItem(EnumHand.MAIN_HAND).damageItem(1, playerIn);
playerIn.getStackInHand(Hand.MAIN_HAND).damageItem(1, playerIn);
}
if (!playerIn.inventory.addItemStackToInventory(TRContent.Parts.SAP.getStack())) {
if (!playerIn.inventory.insertStack(TRContent.Parts.SAP.getStack())) {
WorldUtils.dropItem(TRContent.Parts.SAP.getStack(), worldIn, pos.offset(side));
}
if (playerIn instanceof EntityPlayerMP) {
TRRecipeHandler.unlockTRRecipes((EntityPlayerMP) playerIn);
if (playerIn instanceof ServerPlayerEntity) {
TRRecipeHandler.unlockTRRecipes((ServerPlayerEntity) playerIn);
}
}
return true;
@ -161,7 +161,7 @@ public class BlockRubberLog extends BlockLog {
}
@Override
public void getDrops(IBlockState state, NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
public void getDrops(BlockState state, DefaultedList<ItemStack> drops, World world, BlockPos pos, int fortune) {
drops.add(new ItemStack(this));
if (state.get(HAS_SAP)) {
if (new Random().nextInt(4) == 0) {

View file

@ -25,10 +25,10 @@
package techreborn.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFire;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.block.Blocks;
import net.minecraft.block.FireBlock;
import net.minecraft.block.Material;
import net.minecraft.sound.BlockSoundGroup;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
import techreborn.TechReborn;
@ -39,8 +39,8 @@ import techreborn.TechReborn;
public class BlockRubberPlank extends Block {
public BlockRubberPlank() {
super(Block.Properties.create(Material.WOOD).hardnessAndResistance(2f).sound(SoundType.WOOD));
((BlockFire) Blocks.FIRE).setFireInfo(this, 5, 20);
super(Block.Settings.of(Material.WOOD).strength(2f).sounds(BlockSoundGroup.WOOD));
((FireBlock) Blocks.FIRE).registerFlammableBlock(this, 5, 20);
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this));
}
}

View file

@ -25,18 +25,18 @@
package techreborn.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.BlockSlab;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.material.MaterialColor;
import net.minecraft.block.Material;
import net.minecraft.block.MaterialColor;
import net.minecraft.block.SlabBlock;
import net.minecraft.sound.BlockSoundGroup;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
import techreborn.TechReborn;
public class BlockRubberPlankSlab extends BlockSlab {
public class BlockRubberPlankSlab extends SlabBlock {
public BlockRubberPlankSlab() {
super(Block.Properties.create(Material.WOOD, MaterialColor.OBSIDIAN).hardnessAndResistance(2.0F, 15.0F).sound(SoundType.WOOD));
super(Block.Settings.of(Material.WOOD, MaterialColor.SPRUCE).strength(2.0F, 15.0F).sounds(BlockSoundGroup.WOOD));
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this));
}
}

View file

@ -25,16 +25,16 @@
package techreborn.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.BlockStairs;
import net.minecraft.block.StairsBlock;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
import techreborn.TechReborn;
import techreborn.init.TRContent;
public class BlockRubberPlankStair extends BlockStairs {
public class BlockRubberPlankStair extends StairsBlock {
public BlockRubberPlankStair() {
super(TRContent.RUBBER_PLANKS.getDefaultState(), Block.Properties.from(TRContent.RUBBER_PLANKS));
super(TRContent.RUBBER_PLANKS.getDefaultState(), Block.Settings.copy(TRContent.RUBBER_PLANKS));
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this));
}
}

View file

@ -25,16 +25,16 @@
package techreborn.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.BlockSapling;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.Material;
import net.minecraft.block.SaplingBlock;
import net.minecraft.sound.BlockSoundGroup;
/**
* Created by modmuss50 on 20/02/2016.
*/
public class BlockRubberSapling extends BlockSapling {
public class BlockRubberSapling extends SaplingBlock {
public BlockRubberSapling() {
super(new RubberTree(), Block.Properties.create(Material.PLANTS).sound(SoundType.PLANT));
super(new RubberTree(), Block.Settings.of(Material.PLANT).sounds(BlockSoundGroup.GRASS));
}
}

View file

@ -25,14 +25,14 @@
package techreborn.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.Material;
import net.minecraft.sound.BlockSoundGroup;
import reborncore.common.BaseBlock;
public class BlockStorage extends BaseBlock {
public BlockStorage() {
super(Block.Properties.create(Material.IRON).hardnessAndResistance(2f).sound(SoundType.METAL));
super(Block.Settings.of(Material.METAL).strength(2f).sounds(BlockSoundGroup.METAL));
}
// public static ItemStack getStorageBlockByName(String name, int count) {

View file

@ -24,13 +24,13 @@
package techreborn.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.ChatFormat;
import net.minecraft.block.Material;
import net.minecraft.client.item.TooltipContext;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.IBlockReader;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.common.blocks.BlockMachineBase;
@ -43,8 +43,8 @@ public class BlockSupercondensator extends BlockMachineBase {
}
@Override
public void addInformation(ItemStack stack, @Nullable IBlockReader worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
tooltip.add(new TextComponentString("WIP Coming Soon").applyTextStyle(TextFormatting.RED));
public void buildTooltip(ItemStack stack, @Nullable BlockView worldIn, List<Component> tooltip, TooltipContext flagIn) {
tooltip.add(new TextComponent("WIP Coming Soon").applyFormat(ChatFormat.RED));
// TODO
// Remember to remove WIP override and imports once complete
}

View file

@ -25,20 +25,19 @@
package techreborn.blocks;
import java.util.Random;
import net.minecraft.block.trees.AbstractTree;
import net.minecraft.block.sapling.SaplingGenerator;
import net.minecraft.world.gen.feature.AbstractTreeFeature;
import net.minecraft.world.gen.feature.NoFeatureConfig;
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
import techreborn.world.feature.RubberTreeFeature;
/**
* @author drcrazy
*
*/
public class RubberTree extends AbstractTree {
public class RubberTree extends SaplingGenerator {
@Override
protected AbstractTreeFeature<NoFeatureConfig> getTreeFeature(Random random) {
protected AbstractTreeFeature<DefaultFeatureConfig> createTreeFeature(Random random) {
return new RubberTreeFeature();
}
}

View file

@ -25,20 +25,20 @@
package techreborn.blocks.cable;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.block.BlockRenderType;
import net.minecraft.block.BlockState;
import net.minecraft.block.BlockWithEntity;
import net.minecraft.block.Material;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.state.AbstractProperty;
import net.minecraft.state.BooleanProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.state.StateFactory;
import net.minecraft.state.property.AbstractProperty;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.util.math.Direction;
import net.minecraft.world.BlockView;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
import reborncore.api.ToolManager;
@ -56,7 +56,7 @@ import javax.annotation.Nullable;
* Created by modmuss50 on 19/05/2017.
*/
@RebornRegister(TechReborn.MOD_ID)
public class BlockCable extends BlockContainer {
public class BlockCable extends BlockWithEntity {
public static final BooleanProperty EAST = BooleanProperty.create("east");
public static final BooleanProperty WEST = BooleanProperty.create("west");
@ -77,22 +77,22 @@ public class BlockCable extends BlockContainer {
public final TRContent.Cables type;
public BlockCable(TRContent.Cables type) {
super(Block.Properties.create(Material.ROCK).hardnessAndResistance(1f, 8f));
super(Block.Settings.of(Material.STONE).strength(1f, 8f));
this.type = type;
setDefaultState(this.stateContainer.getBaseState().with(EAST, false).with(WEST, false).with(NORTH, false).with(SOUTH, false).with(UP, false).with(DOWN, false));
setDefaultState(this.stateFactory.getDefaultState().with(EAST, false).with(WEST, false).with(NORTH, false).with(SOUTH, false).with(UP, false).with(DOWN, false));
BlockWrenchEventHandler.wrenableBlocks.add(this);
}
//see for more info https://www.reddit.com/r/feedthebeast/comments/5mxwq9/psa_mod_devs_do_you_call_worldgettileentity_from/
public TileEntity getTileEntitySafely(IWorld blockAccess, BlockPos pos) {
public BlockEntity getTileEntitySafely(IWorld blockAccess, BlockPos pos) {
// if (blockAccess instanceof ChunkCache) {
// return ((ChunkCache) blockAccess).getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK);
// } else {
return blockAccess.getTileEntity(pos);
return blockAccess.getBlockEntity(pos);
// }
}
public AbstractProperty<Boolean> getProperty(EnumFacing facing) {
public AbstractProperty<Boolean> getProperty(Direction facing) {
switch (facing) {
case EAST:
return EAST;
@ -113,22 +113,22 @@ public class BlockCable extends BlockContainer {
// BlockContainer
@Override
public EnumBlockRenderType getRenderType(IBlockState state) {
return EnumBlockRenderType.MODEL;
public BlockRenderType getRenderType(BlockState state) {
return BlockRenderType.MODEL;
}
@Nullable
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileCable();
}
// Block
@SuppressWarnings("deprecation")
@Override
public boolean onBlockActivated(IBlockState state, World worldIn, BlockPos pos, EntityPlayer playerIn, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
ItemStack stack = playerIn.getHeldItem(EnumHand.MAIN_HAND);
TileEntity tileEntity = worldIn.getTileEntity(pos);
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, Direction side, float hitX, float hitY, float hitZ) {
ItemStack stack = playerIn.getStackInHand(Hand.MAIN_HAND);
BlockEntity tileEntity = worldIn.getBlockEntity(pos);
// We should always have tile entity. I hope.
if (tileEntity == null) {
@ -144,7 +144,7 @@ public class BlockCable extends BlockContainer {
}
@Override
protected void fillStateContainer(StateContainer.Builder<Block, IBlockState> builder) {
protected void appendProperties(StateFactory.Builder<Block, BlockState> builder) {
builder.add(EAST, WEST, NORTH, SOUTH, UP, DOWN);
}

View file

@ -24,12 +24,12 @@
package techreborn.blocks.fluid;
import net.minecraft.block.BlockFlowingFluid;
import net.minecraft.fluid.FlowingFluid;
import net.minecraft.block.FluidBlock;
import net.minecraft.fluid.BaseFluid;
public class BlockFluidBase extends BlockFlowingFluid {
public class BlockFluidBase extends FluidBlock {
public BlockFluidBase(FlowingFluid fluid, Properties properties) {
public BlockFluidBase(BaseFluid fluid, Settings properties) {
super(fluid, properties);
}

View file

@ -24,13 +24,13 @@
package techreborn.blocks.fluid;
import net.minecraft.fluid.FlowingFluid;
import net.minecraft.fluid.BaseFluid;
public class BlockFluidTechReborn extends BlockFluidBase {
String name;
public BlockFluidTechReborn(FlowingFluid fluid, Properties properties, String name) {
public BlockFluidTechReborn(BaseFluid fluid, Settings properties, String name) {
super(fluid, properties);
//setTranslationKey(name);
this.name = name;

View file

@ -24,14 +24,14 @@
package techreborn.blocks.fluid;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.Fluid;
import net.minecraft.util.Identifier;
public class TechRebornFluid extends Fluid {
public TechRebornFluid(String fluidName) {
super(fluidName,
new ResourceLocation("techreborn:blocks/fluids/" + fluidName.replaceFirst("fluid", "") + "_flowing"),
new ResourceLocation("techreborn:blocks/fluids/" + fluidName.replaceFirst("fluid", "") + "_flowing"));
new Identifier("techreborn:blocks/fluids/" + fluidName.replaceFirst("fluid", "") + "_flowing"),
new Identifier("techreborn:blocks/fluids/" + fluidName.replaceFirst("fluid", "") + "_flowing"));
//FluidRegistry.addBucketForFluid(this);
}
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.generator;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -45,7 +45,7 @@ public class BlockDieselGenerator extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileDieselGenerator();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.generator;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -41,7 +41,7 @@ public class BlockDragonEggSyphon extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileDragonEggSyphon();
}

View file

@ -25,23 +25,23 @@
package techreborn.blocks.generator;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.Material;
import net.minecraft.client.item.TooltipContext;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.SoundCategory;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.sound.SoundCategory;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.IBlockReader;
import net.minecraft.util.math.Direction;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import reborncore.api.ToolManager;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -54,23 +54,23 @@ import java.util.List;
public class BlockFusionCoil extends Block {
public BlockFusionCoil() {
super(Block.Properties.create(Material.IRON).hardnessAndResistance(2f).sound(SoundType.METAL));
super(Block.Settings.of(Material.METAL).strength(2f).sounds(BlockSoundGroup.METAL));
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this, "machines/generators"));
}
@Override
public boolean onBlockActivated(IBlockState state, World worldIn, BlockPos pos, EntityPlayer playerIn,
EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn,
Hand hand, Direction side, float hitX, float hitY, float hitZ) {
ItemStack tool = playerIn.getHeldItem(EnumHand.MAIN_HAND);
ItemStack tool = playerIn.getStackInHand(Hand.MAIN_HAND);
if (!tool.isEmpty() && ToolManager.INSTANCE.canHandleTool(tool)) {
if (ToolManager.INSTANCE.handleTool(tool, pos, worldIn, playerIn, side, false)) {
if (playerIn.isSneaking()) {
ItemStack drop = new ItemStack(this);
spawnAsEntity(worldIn, pos, drop);
worldIn.playSound(null, playerIn.posX, playerIn.posY, playerIn.posZ, ModSounds.BLOCK_DISMANTLE,
dropStack(worldIn, pos, drop);
worldIn.playSound(null, playerIn.x, playerIn.y, playerIn.z, ModSounds.BLOCK_DISMANTLE,
SoundCategory.BLOCKS, 0.6F, 1F);
if (!worldIn.isRemote) {
if (!worldIn.isClient) {
worldIn.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
}
return true;
@ -80,12 +80,12 @@ public class BlockFusionCoil extends Block {
return false;
}
@OnlyIn(Dist.CLIENT)
@Environment(EnvType.CLIENT)
@Override
public void addInformation(ItemStack stack, @Nullable IBlockReader worldIn, List<ITextComponent> tooltip,
ITooltipFlag flagIn) {
super.addInformation(stack, worldIn, tooltip, flagIn);
public void buildTooltip(ItemStack stack, @Nullable BlockView worldIn, List<Component> tooltip,
TooltipContext flagIn) {
super.buildTooltip(stack, worldIn, tooltip, flagIn);
// TODO: Translate
tooltip.add(new TextComponentString("Right click Fusion Control computer to auto place"));
tooltip.add(new TextComponent("Right click Fusion Control computer to auto place"));
}
}

View file

@ -24,14 +24,14 @@
package techreborn.blocks.generator;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.util.math.Direction;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
@ -54,20 +54,20 @@ public class BlockFusionControlComputer extends BlockMachineBase {
}
@Override
public boolean onBlockActivated(IBlockState state, World worldIn, BlockPos pos, EntityPlayer playerIn,
EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
final TileFusionControlComputer tileFusionControlComputer = (TileFusionControlComputer) worldIn.getTileEntity(pos);
if(!playerIn.getHeldItem(hand).isEmpty() && (playerIn.getHeldItem(hand).getItem() == TRContent.Machine.FUSION_COIL.asItem())){
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn,
Hand hand, Direction side, float hitX, float hitY, float hitZ) {
final TileFusionControlComputer tileFusionControlComputer = (TileFusionControlComputer) worldIn.getBlockEntity(pos);
if(!playerIn.getStackInHand(hand).isEmpty() && (playerIn.getStackInHand(hand).getItem() == TRContent.Machine.FUSION_COIL.asItem())){
List<BlockPos> coils = Torus.generate(tileFusionControlComputer.getPos(), tileFusionControlComputer.size);
boolean placed = false;
for(BlockPos coil : coils){
if(playerIn.getHeldItem(hand).isEmpty()){
if(playerIn.getStackInHand(hand).isEmpty()){
return true;
}
if(worldIn.isAirBlock(coil) && !tileFusionControlComputer.isCoil(coil)){
if(worldIn.isAir(coil) && !tileFusionControlComputer.isCoil(coil)){
worldIn.setBlockState(coil, TRContent.Machine.FUSION_COIL.block.getDefaultState());
if(!playerIn.isCreative()){
playerIn.getHeldItem(hand).shrink(1);
playerIn.getStackInHand(hand).subtractAmount(1);
}
placed = true;
}
@ -87,18 +87,18 @@ public class BlockFusionControlComputer extends BlockMachineBase {
}
@Override
public void onEntityWalk(final World worldIn, final BlockPos pos, final Entity entityIn) {
super.onEntityWalk(worldIn, pos, entityIn);
if (worldIn.getTileEntity(pos) instanceof TileFusionControlComputer) {
if (((TileFusionControlComputer) worldIn.getTileEntity(pos)).crafingTickTime != 0
&& ((TileFusionControlComputer) worldIn.getTileEntity(pos)).checkCoils()) {
entityIn.attackEntityFrom(new FusionDamageSource(), 200F);
public void onSteppedOn(final World worldIn, final BlockPos pos, final Entity entityIn) {
super.onSteppedOn(worldIn, pos, entityIn);
if (worldIn.getBlockEntity(pos) instanceof TileFusionControlComputer) {
if (((TileFusionControlComputer) worldIn.getBlockEntity(pos)).crafingTickTime != 0
&& ((TileFusionControlComputer) worldIn.getBlockEntity(pos)).checkCoils()) {
entityIn.damage(new FusionDamageSource(), 200F);
}
}
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileFusionControlComputer();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.generator;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockGasTurbine extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileGasTurbine();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.generator;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -41,7 +41,7 @@ public class BlockLightningRod extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileLightningRod();
}

View file

@ -24,12 +24,12 @@
package techreborn.blocks.generator;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.ChatFormat;
import net.minecraft.client.item.TooltipContext;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.IBlockReader;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -47,8 +47,8 @@ public class BlockMagicEnergyAbsorber extends BlockMachineBase {
}
@Override
public void addInformation(ItemStack stack, @Nullable IBlockReader worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
tooltip.add(new TextComponentString("WIP Coming Soon").applyTextStyle(TextFormatting.RED));
public void buildTooltip(ItemStack stack, @Nullable BlockView worldIn, List<Component> tooltip, TooltipContext flagIn) {
tooltip.add(new TextComponent("WIP Coming Soon").applyFormat(ChatFormat.RED));
// TODO
// Remember to remove WIP override and imports once complete
}

View file

@ -24,12 +24,12 @@
package techreborn.blocks.generator;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.ChatFormat;
import net.minecraft.client.item.TooltipContext;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.IBlockReader;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -47,8 +47,8 @@ public class BlockMagicEnergyConverter extends BlockMachineBase {
}
@Override
public void addInformation(ItemStack stack, @Nullable IBlockReader worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
tooltip.add(new TextComponentString("WIP Coming Soon").applyTextStyle(TextFormatting.RED));
public void buildTooltip(ItemStack stack, @Nullable BlockView worldIn, List<Component> tooltip, TooltipContext flagIn) {
tooltip.add(new TextComponent("WIP Coming Soon").applyFormat(ChatFormat.RED));
// TODO
// Remember to remove WIP override and imports once complete
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.generator;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -45,7 +45,7 @@ public class BlockPlasmaGenerator extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TilePlasmaGenerator();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.generator;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockSemiFluidGenerator extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileSemiFluidGenerator();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.generator;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -48,7 +48,7 @@ public class BlockSolarPanel extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileSolarPanel();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.generator;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockSolidFuelGenerator extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileSolidFuelGenerator();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.generator;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockThermalGenerator extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileThermalGenerator();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.generator;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -44,7 +44,7 @@ public class BlockWaterMill extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileWaterMill();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.generator;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -44,7 +44,7 @@ public class BlockWindMill extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileWindMill();
}

View file

@ -27,23 +27,23 @@ package techreborn.blocks.lighting;
import javax.annotation.Nullable;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.BlockRenderLayer;
import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.state.BlockFaceShape;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.item.ItemStack;
import net.minecraft.state.BooleanProperty;
import net.minecraft.state.DirectionProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.state.StateFactory;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.property.DirectionProperty;
import net.minecraft.state.property.Properties;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader;
import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import reborncore.api.ToolManager;
import reborncore.client.models.ModelCompound;
@ -56,7 +56,7 @@ import techreborn.tiles.lighting.TileLamp;
public class BlockLamp extends BaseTileBlock {
public static DirectionProperty FACING = BlockStateProperties.FACING;
public static DirectionProperty FACING = Properties.FACING;
public static BooleanProperty ACTIVE;
protected final VoxelShape[] shape;
@ -64,8 +64,8 @@ public class BlockLamp extends BaseTileBlock {
private int brightness;
public BlockLamp(int brightness, int cost, double depth, double width) {
super(Block.Properties.create(Material.REDSTONE_LIGHT));
this.setDefaultState(this.stateContainer.getBaseState().with(FACING, EnumFacing.NORTH).with(ACTIVE, false));
super(Block.Settings.of(Material.REDSTONE_LAMP));
this.setDefaultState(this.stateFactory.getDefaultState().with(FACING, Direction.NORTH).with(ACTIVE, false));
this.shape = GenCuboidShapes(depth, width);
this.cost = cost;
this.brightness = brightness;
@ -76,31 +76,31 @@ public class BlockLamp extends BaseTileBlock {
private VoxelShape[] GenCuboidShapes(double depth, double width) {
double culling = (16.0D - width) / 2 ;
VoxelShape[] shapes = {
Block.makeCuboidShape(culling, 16.0 - depth, culling, 16.0 - culling, 16.0D, 16.0 - culling),
Block.makeCuboidShape(culling, 0.0D, culling, 16.0D - culling, depth, 16.0 - culling),
Block.makeCuboidShape(culling, culling, 16.0 - depth, 16.0 - culling, 16.0 - culling, 16.0D),
Block.makeCuboidShape(culling, culling, 0.0D, 16.0 - culling, 16.0 - culling, depth),
Block.makeCuboidShape(16.0 - depth, culling, culling, 16.0D, 16.0 - culling, 16.0 - culling),
Block.makeCuboidShape(0.0D, culling, culling, depth, 16.0 - culling, 16.0 - culling)
Block.createCuboidShape(culling, 16.0 - depth, culling, 16.0 - culling, 16.0D, 16.0 - culling),
Block.createCuboidShape(culling, 0.0D, culling, 16.0D - culling, depth, 16.0 - culling),
Block.createCuboidShape(culling, culling, 16.0 - depth, 16.0 - culling, 16.0 - culling, 16.0D),
Block.createCuboidShape(culling, culling, 0.0D, 16.0 - culling, 16.0 - culling, depth),
Block.createCuboidShape(16.0 - depth, culling, culling, 16.0D, 16.0 - culling, 16.0 - culling),
Block.createCuboidShape(0.0D, culling, culling, depth, 16.0 - culling, 16.0 - culling)
};
return shapes;
}
public static boolean isActive(IBlockState state) {
public static boolean isActive(BlockState state) {
return state.get(ACTIVE);
}
public static EnumFacing getFacing(IBlockState state) {
public static Direction getFacing(BlockState state) {
return state.get(FACING);
}
public static void setFacing(EnumFacing facing, World world, BlockPos pos) {
public static void setFacing(Direction facing, World world, BlockPos pos) {
world.setBlockState(pos, world.getBlockState(pos).with(FACING, facing));
}
public static void setActive(Boolean active, World world, BlockPos pos) {
EnumFacing facing = (EnumFacing)world.getBlockState(pos).get(FACING);
IBlockState state = world.getBlockState(pos).with(ACTIVE, active).with(FACING, facing);
Direction facing = (Direction)world.getBlockState(pos).get(FACING);
BlockState state = world.getBlockState(pos).with(ACTIVE, active).with(FACING, facing);
world.setBlockState(pos, state, 3);
}
@ -110,23 +110,23 @@ public class BlockLamp extends BaseTileBlock {
// BaseTileBlock
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileLamp();
}
// Block
@Override
protected void fillStateContainer(StateContainer.Builder<Block, IBlockState> builder) {
protected void appendProperties(StateFactory.Builder<Block, BlockState> builder) {
ACTIVE = BooleanProperty.create("active");
builder.add(FACING, ACTIVE);
}
@Nullable
@Override
public IBlockState getStateForPlacement(BlockItemUseContext context) {
for (EnumFacing enumfacing : context.getNearestLookingDirections()) {
IBlockState iblockstate = this.getDefaultState().with(FACING, enumfacing.getOpposite());
if (iblockstate.isValidPosition(context.getWorld(), context.getPos())) {
public BlockState getPlacementState(ItemPlacementContext context) {
for (Direction enumfacing : context.getPlacementFacings()) {
BlockState iblockstate = this.getDefaultState().with(FACING, enumfacing.getOpposite());
if (iblockstate.canPlaceAt(context.getWorld(), context.getBlockPos())) {
return iblockstate;
}
}
@ -134,7 +134,7 @@ public class BlockLamp extends BaseTileBlock {
}
@Override
public int getLightValue(IBlockState state) {
public int getLuminance(BlockState state) {
return state.get(ACTIVE) ? brightness : 0;
}
@ -144,12 +144,12 @@ public class BlockLamp extends BaseTileBlock {
}
@Override
public boolean isFullCube(IBlockState state) {
public boolean isFullCube(BlockState state) {
return false;
}
@Override
public BlockFaceShape getBlockFaceShape(IBlockReader worldIn, IBlockState state, BlockPos pos, EnumFacing facing) {
public BlockFaceShape getBlockFaceShape(BlockView worldIn, BlockState state, BlockPos pos, Direction facing) {
// This makes only the back face of lamps connect to fences.
if (getFacing(state).getOpposite() == facing)
return BlockFaceShape.SOLID;
@ -158,15 +158,15 @@ public class BlockLamp extends BaseTileBlock {
}
@Override
public VoxelShape getShape(IBlockState state, IBlockReader worldIn, BlockPos pos) {
return shape[getFacing(state).getIndex()];
public VoxelShape getShape(BlockState state, BlockView worldIn, BlockPos pos) {
return shape[getFacing(state).getId()];
}
@SuppressWarnings("deprecation")
@Override
public boolean onBlockActivated(IBlockState state, World worldIn, BlockPos pos, EntityPlayer playerIn, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
ItemStack stack = playerIn.getHeldItem(EnumHand.MAIN_HAND);
TileEntity tileEntity = worldIn.getTileEntity(pos);
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, Direction side, float hitX, float hitY, float hitZ) {
ItemStack stack = playerIn.getStackInHand(Hand.MAIN_HAND);
BlockEntity tileEntity = worldIn.getBlockEntity(pos);
// We extended BaseTileBlock. Thus we should always have tile entity. I hope.
if (tileEntity == null) {

View file

@ -24,12 +24,12 @@
package techreborn.blocks.storage;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.NonNullList;
import net.minecraft.util.DefaultedList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import reborncore.common.RebornCoreConfig;
import techreborn.client.EGui;
@ -43,12 +43,12 @@ public class BlockAdjustableSU extends BlockEnergyStorage {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileAdjustableSU();
}
@Override
public void getDrops(IBlockState state, NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
public void getDrops(BlockState state, DefaultedList<ItemStack> drops, World world, BlockPos pos, int fortune) {
if (RebornCoreConfig.wrenchRequired) {
drops.add(new ItemStack(TRContent.MachineBlocks.INDUSTRIAL.getFrame()));
} else {

View file

@ -25,18 +25,18 @@
package techreborn.blocks.storage;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.state.DirectionProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.state.StateFactory;
import net.minecraft.state.property.DirectionProperty;
import net.minecraft.state.property.Properties;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.World;
import reborncore.api.ToolManager;
import reborncore.api.tile.IMachineGuiHandler;
@ -51,24 +51,24 @@ import techreborn.TechReborn;
* Created by Rushmead
*/
public abstract class BlockEnergyStorage extends BaseTileBlock {
public static DirectionProperty FACING = BlockStateProperties.FACING;
public static DirectionProperty FACING = Properties.FACING;
public String name;
public IMachineGuiHandler gui;
public BlockEnergyStorage(String name, IMachineGuiHandler gui) {
super(Block.Properties.create(Material.IRON).hardnessAndResistance(2f));
this.setDefaultState(this.stateContainer.getBaseState().with(FACING, EnumFacing.NORTH));
super(Block.Settings.of(Material.METAL).strength(2f));
this.setDefaultState(this.stateFactory.getDefaultState().with(FACING, Direction.NORTH));
this.name = name;
this.gui = gui;
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this, "machines/energy"));
BlockWrenchEventHandler.wrenableBlocks.add(this);
}
public void setFacing(EnumFacing facing, World world, BlockPos pos) {
public void setFacing(Direction facing, World world, BlockPos pos) {
world.setBlockState(pos, world.getBlockState(pos).with(FACING, facing));
}
public EnumFacing getFacing(IBlockState state) {
public Direction getFacing(BlockState state) {
return state.get(FACING);
}
@ -96,15 +96,15 @@ public abstract class BlockEnergyStorage extends BaseTileBlock {
// Block
@Override
protected void fillStateContainer(StateContainer.Builder<Block, IBlockState> builder) {
protected void appendProperties(StateFactory.Builder<Block, BlockState> builder) {
builder.add(FACING);
}
@SuppressWarnings("deprecation")
@Override
public boolean onBlockActivated(IBlockState state, World worldIn, BlockPos pos, EntityPlayer playerIn, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
ItemStack stack = playerIn.getHeldItem(EnumHand.MAIN_HAND);
TileEntity tileEntity = worldIn.getTileEntity(pos);
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, Direction side, float hitX, float hitY, float hitZ) {
ItemStack stack = playerIn.getStackInHand(Hand.MAIN_HAND);
BlockEntity tileEntity = worldIn.getBlockEntity(pos);
// We extended BlockTileBase. Thus we should always have tile entity. I hope.
if (tileEntity == null) {
@ -126,14 +126,14 @@ public abstract class BlockEnergyStorage extends BaseTileBlock {
}
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer,
public void onPlaced(World worldIn, BlockPos pos, BlockState state, LivingEntity placer,
ItemStack stack) {
super.onBlockPlacedBy(worldIn, pos, state, placer, stack);
EnumFacing facing = placer.getHorizontalFacing().getOpposite();
if (placer.rotationPitch < -50) {
facing = EnumFacing.DOWN;
} else if (placer.rotationPitch > 50) {
facing = EnumFacing.UP;
super.onPlaced(worldIn, pos, state, placer, stack);
Direction facing = placer.getHorizontalFacing().getOpposite();
if (placer.pitch < -50) {
facing = Direction.DOWN;
} else if (placer.pitch > 50) {
facing = Direction.UP;
}
setFacing(facing, worldIn, pos);
}

View file

@ -24,12 +24,12 @@
package techreborn.blocks.storage;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.NonNullList;
import net.minecraft.util.DefaultedList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import reborncore.common.RebornCoreConfig;
import techreborn.client.EGui;
@ -46,12 +46,12 @@ public class BlockHighVoltageSU extends BlockEnergyStorage {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileHighVoltageSU();
}
@Override
public void getDrops(IBlockState state, NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
public void getDrops(BlockState state, DefaultedList<ItemStack> drops, World world, BlockPos pos, int fortune) {
if (RebornCoreConfig.wrenchRequired) {
drops.add(new ItemStack(TRContent.MachineBlocks.ADVANCED.getFrame()));
} else {

View file

@ -24,14 +24,14 @@
package techreborn.blocks.storage;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.NonNullList;
import net.minecraft.util.DefaultedList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import reborncore.common.RebornCoreConfig;
import techreborn.client.EGui;
@ -45,30 +45,30 @@ public class BlockInterdimensionalSU extends BlockEnergyStorage {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileInterdimensionalSU();
}
@Override
public IBlockState getStateForPlacement(BlockItemUseContext context) {
final TileEntity tile = context.getWorld().getTileEntity(context.getPos());
public BlockState getPlacementState(ItemPlacementContext context) {
final BlockEntity tile = context.getWorld().getBlockEntity(context.getBlockPos());
if (tile instanceof TileInterdimensionalSU) {
((TileInterdimensionalSU) tile).ownerUdid = context.getPlayer().getUniqueID().toString();
((TileInterdimensionalSU) tile).ownerUdid = context.getPlayer().getUuid().toString();
}
return this.getDefaultState();
}
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
super.onBlockPlacedBy(world, pos, state, placer, stack);
TileEntity tile = world.getTileEntity(pos);
public void onPlaced(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack) {
super.onPlaced(world, pos, state, placer, stack);
BlockEntity tile = world.getBlockEntity(pos);
if (tile instanceof TileInterdimensionalSU) {
((TileInterdimensionalSU) tile).ownerUdid = placer.getUniqueID().toString();
((TileInterdimensionalSU) tile).ownerUdid = placer.getUuid().toString();
}
}
@Override
public void getDrops(IBlockState state, NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
public void getDrops(BlockState state, DefaultedList<ItemStack> drops, World world, BlockPos pos, int fortune) {
if (RebornCoreConfig.wrenchRequired) {
drops.add(new ItemStack(TRContent.MachineBlocks.ADVANCED.getFrame()));
} else {

View file

@ -25,17 +25,17 @@
package techreborn.blocks.storage;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.NonNullList;
import net.minecraft.util.DefaultedList;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.util.math.Direction;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import reborncore.api.ToolManager;
import reborncore.client.models.ModelCompound;
@ -54,36 +54,36 @@ import techreborn.tiles.storage.lesu.TileLSUStorage;
public class BlockLSUStorage extends BaseTileBlock {
public BlockLSUStorage() {
super(Block.Properties.create(Material.IRON).hardnessAndResistance(2f));
super(Block.Settings.of(Material.METAL).strength(2f));
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this, "machines/energy"));
BlockWrenchEventHandler.wrenableBlocks.add(this);
}
// BaseTileBlock
@Override
public void onReplaced(IBlockState state, World worldIn, BlockPos pos, IBlockState newState, boolean isMoving) {
public void onBlockRemoved(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving) {
if (state.getBlock() == newState.getBlock()) {
return;
}
if (worldIn.getTileEntity(pos) instanceof TileLSUStorage) {
TileLSUStorage tile = (TileLSUStorage) worldIn.getTileEntity(pos);
if (worldIn.getBlockEntity(pos) instanceof TileLSUStorage) {
TileLSUStorage tile = (TileLSUStorage) worldIn.getBlockEntity(pos);
if (tile != null) {
tile.removeFromNetwork();
}
}
super.onReplaced(state, worldIn, pos, newState, isMoving);
super.onBlockRemoved(state, worldIn, pos, newState, isMoving);
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileLSUStorage();
}
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack itemstack) {
super.onBlockPlacedBy(world, pos, state, player, itemstack);
if (world.getTileEntity(pos) instanceof TileLSUStorage) {
TileLSUStorage tile = (TileLSUStorage) world.getTileEntity(pos);
public void onPlaced(World world, BlockPos pos, BlockState state, LivingEntity player, ItemStack itemstack) {
super.onPlaced(world, pos, state, player, itemstack);
if (world.getBlockEntity(pos) instanceof TileLSUStorage) {
TileLSUStorage tile = (TileLSUStorage) world.getBlockEntity(pos);
if (tile != null) {
tile.rebuildNetwork();
}
@ -93,9 +93,9 @@ public class BlockLSUStorage extends BaseTileBlock {
// Block
@SuppressWarnings("deprecation")
@Override
public boolean onBlockActivated(IBlockState state, World worldIn, BlockPos pos, EntityPlayer playerIn, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
ItemStack stack = playerIn.getHeldItem(EnumHand.MAIN_HAND);
TileEntity tileEntity = worldIn.getTileEntity(pos);
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, Direction side, float hitX, float hitY, float hitZ) {
ItemStack stack = playerIn.getStackInHand(Hand.MAIN_HAND);
BlockEntity tileEntity = worldIn.getBlockEntity(pos);
// We extended BaseTileBlock. Thus we should always have tile entity. I hope.
if (tileEntity == null) {
@ -112,7 +112,7 @@ public class BlockLSUStorage extends BaseTileBlock {
}
@Override
public void getDrops(IBlockState state, NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
public void getDrops(BlockState state, DefaultedList<ItemStack> drops, World world, BlockPos pos, int fortune) {
if (RebornCoreConfig.wrenchRequired) {
drops.add(new ItemStack(TRContent.MachineBlocks.BASIC.getFrame()));
} else {

View file

@ -24,12 +24,12 @@
package techreborn.blocks.storage;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.NonNullList;
import net.minecraft.util.DefaultedList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import reborncore.common.RebornCoreConfig;
import techreborn.client.EGui;
@ -43,12 +43,12 @@ public class BlockLapotronicSU extends BlockEnergyStorage {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileLapotronicSU();
}
@Override
public void getDrops(IBlockState state, NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
public void getDrops(BlockState state, DefaultedList<ItemStack> drops, World world, BlockPos pos, int fortune) {
if (RebornCoreConfig.wrenchRequired) {
drops.add(new ItemStack(TRContent.MachineBlocks.ADVANCED.getFrame()));
} else {

View file

@ -24,8 +24,8 @@
package techreborn.blocks.storage;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import techreborn.client.EGui;
import techreborn.tiles.storage.TileLowVoltageSU;
@ -39,7 +39,7 @@ public class BlockLowVoltageSU extends BlockEnergyStorage {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileLowVoltageSU();
}
}

View file

@ -24,12 +24,12 @@
package techreborn.blocks.storage;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.NonNullList;
import net.minecraft.util.DefaultedList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import reborncore.common.RebornCoreConfig;
import techreborn.client.EGui;
@ -46,12 +46,12 @@ public class BlockMediumVoltageSU extends BlockEnergyStorage {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileMediumVoltageSU();
}
@Override
public void getDrops(IBlockState state, NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
public void getDrops(BlockState state, DefaultedList<ItemStack> drops, World world, BlockPos pos, int fortune) {
if (RebornCoreConfig.wrenchRequired) {
drops.add(new ItemStack(TRContent.MachineBlocks.BASIC.getFrame()));
} else {

View file

@ -24,12 +24,12 @@
package techreborn.blocks.tier0;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.NonNullList;
import net.minecraft.util.DefaultedList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
@ -47,7 +47,7 @@ public class BlockIronAlloyFurnace extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileIronAlloyFurnace();
}
@ -57,7 +57,7 @@ public class BlockIronAlloyFurnace extends BlockMachineBase {
}
@Override
public void getDrops(IBlockState state, NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
public void getDrops(BlockState state, DefaultedList<ItemStack> drops, World world, BlockPos pos, int fortune) {
drops.add(new ItemStack(this));
}
}

View file

@ -24,19 +24,19 @@
package techreborn.blocks.tier0;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Particles;
import net.minecraft.init.SoundEvents;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.NonNullList;
import net.minecraft.util.SoundCategory;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
import net.minecraft.util.DefaultedList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.util.math.Direction;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -55,8 +55,8 @@ public class BlockIronFurnace extends BlockMachineBase {
}
@SuppressWarnings("incomplete-switch")
@OnlyIn(Dist.CLIENT)
public void animateTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) {
@Environment(EnvType.CLIENT)
public void randomDisplayTick(BlockState stateIn, World worldIn, BlockPos pos, Random rand) {
if (this.isActive(stateIn)) {
final double d0 = pos.getX() + 0.5D;
@ -67,33 +67,33 @@ public class BlockIronFurnace extends BlockMachineBase {
false);
}
final EnumFacing enumfacing = stateIn.get(BlockMachineBase.FACING);
final Direction enumfacing = stateIn.get(BlockMachineBase.FACING);
final double d3 = 0.52D;
final double d4 = rand.nextDouble() * 0.6D - 0.3D;
switch (enumfacing) {
case WEST:
worldIn.addParticle(Particles.SMOKE, d0 - d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D);
worldIn.addParticle(Particles.FLAME, d0 - d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D);
worldIn.addParticle(ParticleTypes.SMOKE, d0 - d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D);
worldIn.addParticle(ParticleTypes.FLAME, d0 - d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D);
break;
case EAST:
worldIn.addParticle(Particles.SMOKE, d0 + d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D);
worldIn.addParticle(Particles.FLAME, d0 + d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D);
worldIn.addParticle(ParticleTypes.SMOKE, d0 + d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D);
worldIn.addParticle(ParticleTypes.FLAME, d0 + d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D);
break;
case NORTH:
worldIn.addParticle(Particles.SMOKE, d0 + d4, d1, d2 - d3, 0.0D, 0.0D, 0.0D);
worldIn.addParticle(Particles.FLAME, d0 + d4, d1, d2 - d3, 0.0D, 0.0D, 0.0D);
worldIn.addParticle(ParticleTypes.SMOKE, d0 + d4, d1, d2 - d3, 0.0D, 0.0D, 0.0D);
worldIn.addParticle(ParticleTypes.FLAME, d0 + d4, d1, d2 - d3, 0.0D, 0.0D, 0.0D);
break;
case SOUTH:
worldIn.addParticle(Particles.SMOKE, d0 + d4, d1, d2 + d3, 0.0D, 0.0D, 0.0D);
worldIn.addParticle(Particles.FLAME, d0 + d4, d1, d2 + d3, 0.0D, 0.0D, 0.0D);
worldIn.addParticle(ParticleTypes.SMOKE, d0 + d4, d1, d2 + d3, 0.0D, 0.0D, 0.0D);
worldIn.addParticle(ParticleTypes.FLAME, d0 + d4, d1, d2 + d3, 0.0D, 0.0D, 0.0D);
}
}
}
// BlockMachineBase
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileIronFurnace();
}
@ -103,7 +103,7 @@ public class BlockIronFurnace extends BlockMachineBase {
}
@Override
public void getDrops(IBlockState state, NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
public void getDrops(BlockState state, DefaultedList<ItemStack> drops, World world, BlockPos pos, int fortune) {
drops.add(new ItemStack(this));
}
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier1;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockAlloySmelter extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileAlloySmelter();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier1;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockAssemblingMachine extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileAssemblingMachine();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier1;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockAutoCraftingTable extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileAutoCraftingTable();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier1;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockCompressor extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileCompressor();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier1;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockElectricFurnace extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileElectricFurnace();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier1;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockExtractor extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileExtractor();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier1;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockGrinder extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileGrinder();
}

View file

@ -25,22 +25,22 @@
package techreborn.blocks.tier1;
import com.google.common.collect.Lists;
import net.minecraft.ChatFormat;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.Material;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.state.StateContainer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.state.StateFactory;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.IBlockReader;
import net.minecraft.util.math.Direction;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import reborncore.api.IToolDrop;
import reborncore.api.ToolManager;
@ -66,8 +66,8 @@ public class BlockPlayerDetector extends BlockMachineBase {
public static PropertyString TYPE;
public BlockPlayerDetector() {
super(Block.Properties.create(Material.IRON), true);
this.setDefaultState(this.stateContainer.getBaseState().with(TYPE, types[0]));
super(Block.Settings.of(Material.METAL), true);
this.setDefaultState(this.stateFactory.getDefaultState().with(TYPE, types[0]));
for (int i = 0; i < types.length; i++) {
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this, i, "machines/tier1_machines").setInvVariant("type=" + types[i]));
}
@ -75,24 +75,24 @@ public class BlockPlayerDetector extends BlockMachineBase {
// BlockMachineBase
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TilePlayerDectector();
}
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer,
public void onPlaced(World worldIn, BlockPos pos, BlockState state, LivingEntity placer,
ItemStack stack) {
super.onBlockPlacedBy(worldIn, pos, state, placer, stack);
TileEntity tile = worldIn.getTileEntity(pos);
super.onPlaced(worldIn, pos, state, placer, stack);
BlockEntity tile = worldIn.getBlockEntity(pos);
if (tile instanceof TilePlayerDectector) {
((TilePlayerDectector) tile).owenerUdid = placer.getUniqueID().toString();
((TilePlayerDectector) tile).owenerUdid = placer.getUuid().toString();
}
}
@Override
public boolean onBlockActivated(IBlockState state, World worldIn, BlockPos pos, EntityPlayer playerIn, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
ItemStack stack = playerIn.getHeldItem(EnumHand.MAIN_HAND);
TileEntity tileEntity = worldIn.getTileEntity(pos);
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, Direction side, float hitX, float hitY, float hitZ) {
ItemStack stack = playerIn.getStackInHand(Hand.MAIN_HAND);
BlockEntity tileEntity = worldIn.getBlockEntity(pos);
if (tileEntity == null) {
return super.onBlockActivated(state, worldIn, pos, playerIn, hand, side, hitX, hitY, hitZ);
@ -100,7 +100,7 @@ public class BlockPlayerDetector extends BlockMachineBase {
String type = state.get(TYPE);
String newType = type;
TextFormatting color = TextFormatting.GREEN;
ChatFormat color = ChatFormat.GREEN;
if (!stack.isEmpty() && ToolManager.INSTANCE.canHandleTool(stack)) {
if (ToolManager.INSTANCE.handleTool(stack, pos, worldIn, playerIn, side, false)) {
@ -111,9 +111,9 @@ public class BlockPlayerDetector extends BlockMachineBase {
return false;
}
if (!drop.isEmpty()) {
spawnAsEntity(worldIn, pos, drop);
dropStack(worldIn, pos, drop);
}
if (!worldIn.isRemote) {
if (!worldIn.isClient) {
worldIn.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
}
return true;
@ -121,10 +121,10 @@ public class BlockPlayerDetector extends BlockMachineBase {
} else {
if (type.equals("all")) {
newType = "others";
color = TextFormatting.RED;
color = ChatFormat.RED;
} else if (type.equals("others")) {
newType = "you";
color = TextFormatting.BLUE;
color = ChatFormat.BLUE;
} else if (type.equals("you")) {
newType = "all";
}
@ -133,9 +133,9 @@ public class BlockPlayerDetector extends BlockMachineBase {
}
}
if (worldIn.isRemote) {
ChatUtils.sendNoSpamMessages(MessageIDs.playerDetectorID, new TextComponentString(
TextFormatting.GRAY + I18n.format("techreborn.message.detects") + " " + color
if (worldIn.isClient) {
ChatUtils.sendNoSpamMessages(MessageIDs.playerDetectorID, new TextComponent(
ChatFormat.GRAY + I18n.translate("techreborn.message.detects") + " " + color
+ StringUtils.toFirstCapital(newType)));
}
return true;
@ -148,24 +148,24 @@ public class BlockPlayerDetector extends BlockMachineBase {
// Block
@Override
protected void fillStateContainer(StateContainer.Builder<Block, IBlockState> builder) {
protected void appendProperties(StateFactory.Builder<Block, BlockState> builder) {
TYPE = new PropertyString("type", types);
builder.add(TYPE);
}
@Override
public boolean canConnectRedstone(IBlockState state, IBlockReader world, BlockPos pos, @Nullable EnumFacing side) {
public boolean canConnectRedstone(BlockState state, BlockView world, BlockPos pos, @Nullable Direction side) {
return true;
}
@Override
public boolean canProvidePower(IBlockState state) {
public boolean emitsRedstonePower(BlockState state) {
return true;
}
@Override
public int getWeakPower(IBlockState blockState, IBlockReader blockAccess, BlockPos pos, EnumFacing side) {
TileEntity entity = blockAccess.getTileEntity(pos);
public int getWeakRedstonePower(BlockState blockState, BlockView blockAccess, BlockPos pos, Direction side) {
BlockEntity entity = blockAccess.getBlockEntity(pos);
if (entity instanceof TilePlayerDectector) {
return ((TilePlayerDectector) entity).isProvidingPower() ? 15 : 0;
}
@ -173,8 +173,8 @@ public class BlockPlayerDetector extends BlockMachineBase {
}
@Override
public int getStrongPower(IBlockState blockState, IBlockReader blockAccess, BlockPos pos, EnumFacing side) {
TileEntity entity = blockAccess.getTileEntity(pos);
public int getStrongRedstonePower(BlockState blockState, BlockView blockAccess, BlockPos pos, Direction side) {
BlockEntity entity = blockAccess.getBlockEntity(pos);
if (entity instanceof TilePlayerDectector) {
return ((TilePlayerDectector) entity).isProvidingPower() ? 15 : 0;
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier1;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockRecycler extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileRecycler();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier1;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockRollingMachine extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileRollingMachine();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier1;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockScrapboxinator extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileScrapboxinator();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier2;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockChargeOMat extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileChargeOMat();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier2;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockChemicalReactor extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileChemicalReactor();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier2;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockDigitalChest extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileDigitalChest();
}

View file

@ -24,31 +24,31 @@
package techreborn.blocks.tier2;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
import reborncore.common.blocks.BlockMachineBase;
import techreborn.TechReborn;
import techreborn.client.EGui;
import techreborn.tiles.machine.multiblock.TileDistillationTower;
import techreborn.tiles.machine.multiblock.TileEnvTypeillationTower;
public class BlockDistillationTower extends BlockMachineBase {
public class BlockEnvTypeillationTower extends BlockMachineBase {
public BlockDistillationTower() {
public BlockEnvTypeillationTower() {
super();
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this, "machines/tier2_machines"));
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
return new TileDistillationTower();
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileEnvTypeillationTower();
}
@Override
public IMachineGuiHandler getGui() {
return EGui.DISTILLATION_TOWER;
return EGui.EnvTypeILLATION_TOWER;
}
@Override

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier2;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockImplosionCompressor extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileImplosionCompressor();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier2;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockIndustrialBlastFurnace extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileIndustrialBlastFurnace();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier2;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockIndustrialCentrifuge extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileIndustrialCentrifuge();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier2;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockIndustrialElectrolyzer extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileIndustrialElectrolyzer();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier2;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockIndustrialGrinder extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileIndustrialGrinder();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier2;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockIndustrialSawmill extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileIndustrialSawmill();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier2;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockVacuumFreezer extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileVacuumFreezer();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier3;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockChunkLoader extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileChunkLoader();
}

View file

@ -24,10 +24,10 @@
package techreborn.blocks.tier3;
import net.minecraft.block.state.IBlockState;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
@ -45,7 +45,7 @@ public class BlockCreativeQuantumChest extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileCreativeQuantumChest();
}
@ -60,10 +60,10 @@ public class BlockCreativeQuantumChest extends BlockMachineBase {
}
@Override
public void onReplaced(IBlockState state, World worldIn, BlockPos pos, IBlockState newState, boolean isMoving) {
public void onBlockRemoved(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving) {
if (state.getBlock() != newState.getBlock()) {
//lets not drop max int items into the world, that sounds like a bad idea
worldIn.removeTileEntity(pos);
worldIn.removeBlockEntity(pos);
}
}
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier3;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockCreativeQuantumTank extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileCreativeQuantumTank();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier3;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockFluidReplicator extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileFluidReplicator();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier3;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockMatterFabricator extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileMatterFabricator();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier3;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockQuantumChest extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileQuantumChest();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier3;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockQuantumTank extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileQuantumTank();
}

View file

@ -24,12 +24,12 @@
package techreborn.blocks.transformers;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.NonNullList;
import net.minecraft.util.DefaultedList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import reborncore.common.RebornCoreConfig;
import techreborn.init.TRContent;
@ -45,12 +45,12 @@ public class BlockHVTransformer extends BlockTransformer {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileHVTransformer();
}
@Override
public void getDrops(IBlockState state, NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
public void getDrops(BlockState state, DefaultedList<ItemStack> drops, World world, BlockPos pos, int fortune) {
if (RebornCoreConfig.wrenchRequired){
drops.add(new ItemStack(TRContent.MachineBlocks.ADVANCED.getFrame()));
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.transformers;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import techreborn.tiles.transformers.TileLVTransformer;
/**
@ -38,7 +38,7 @@ public class BlockLVTransformer extends BlockTransformer {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileLVTransformer();
}
}

View file

@ -24,12 +24,12 @@
package techreborn.blocks.transformers;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.NonNullList;
import net.minecraft.util.DefaultedList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import reborncore.common.RebornCoreConfig;
import techreborn.init.TRContent;
@ -45,12 +45,12 @@ public class BlockMVTransformer extends BlockTransformer {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileMVTransformer();
}
@Override
public void getDrops(IBlockState state, NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
public void getDrops(BlockState state, DefaultedList<ItemStack> drops, World world, BlockPos pos, int fortune) {
if (RebornCoreConfig.wrenchRequired){
drops.add(new ItemStack(TRContent.MachineBlocks.BASIC.getFrame()));
}

View file

@ -25,18 +25,18 @@
package techreborn.blocks.transformers;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.state.DirectionProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.state.StateFactory;
import net.minecraft.state.property.DirectionProperty;
import net.minecraft.state.property.Properties;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.World;
import reborncore.api.ToolManager;
import reborncore.client.models.ModelCompound;
@ -51,50 +51,50 @@ import techreborn.TechReborn;
*/
public abstract class BlockTransformer extends BaseTileBlock {
public static DirectionProperty FACING = BlockStateProperties.FACING;
public static DirectionProperty FACING = Properties.FACING;
public String name;
public BlockTransformer(String name) {
super(Block.Properties.create(Material.IRON).hardnessAndResistance(2f));
this.setDefaultState(this.stateContainer.getBaseState().with(FACING, EnumFacing.NORTH));
super(Block.Settings.of(Material.METAL).strength(2f));
this.setDefaultState(this.stateFactory.getDefaultState().with(FACING, Direction.NORTH));
this.name = name;
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this, "machines/energy"));
BlockWrenchEventHandler.wrenableBlocks.add(this);
}
public void setFacing(EnumFacing facing, World world, BlockPos pos) {
public void setFacing(Direction facing, World world, BlockPos pos) {
world.setBlockState(pos, world.getBlockState(pos).with(FACING, facing));
}
public EnumFacing getFacing(IBlockState state) {
public Direction getFacing(BlockState state) {
return state.get(FACING);
}
// BaseTileBlock
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer,
public void onPlaced(World worldIn, BlockPos pos, BlockState state, LivingEntity placer,
ItemStack stack) {
super.onBlockPlacedBy(worldIn, pos, state, placer, stack);
EnumFacing facing = placer.getHorizontalFacing().getOpposite();
if (placer.rotationPitch < -50) {
facing = EnumFacing.DOWN;
} else if (placer.rotationPitch > 50) {
facing = EnumFacing.UP;
super.onPlaced(worldIn, pos, state, placer, stack);
Direction facing = placer.getHorizontalFacing().getOpposite();
if (placer.pitch < -50) {
facing = Direction.DOWN;
} else if (placer.pitch > 50) {
facing = Direction.UP;
}
setFacing(facing, worldIn, pos);
}
// Block
@Override
protected void fillStateContainer(StateContainer.Builder<Block, IBlockState> builder) {
protected void appendProperties(StateFactory.Builder<Block, BlockState> builder) {
builder.add(FACING);
}
@SuppressWarnings("deprecation")
@Override
public boolean onBlockActivated(IBlockState state, World worldIn, BlockPos pos, EntityPlayer playerIn, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
ItemStack stack = playerIn.getHeldItem(EnumHand.MAIN_HAND);
TileEntity tileEntity = worldIn.getTileEntity(pos);
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, Direction side, float hitX, float hitY, float hitZ) {
ItemStack stack = playerIn.getStackInHand(Hand.MAIN_HAND);
BlockEntity tileEntity = worldIn.getBlockEntity(pos);
// We extended BlockTileBase. Thus we should always have tile entity. I hope.
if (tileEntity == null) {