1.15 port

This commit is contained in:
yueh
2020-05-18 14:02:45 +02:00
parent 0ea86c939c
commit 16d6d55d7f
630 changed files with 4211 additions and 12664 deletions
@@ -0,0 +1,50 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.decorative;
import com.google.common.base.Preconditions;
import net.minecraft.block.Block;
import net.minecraft.block.StairsBlock;
public abstract class AEBaseStairBlock extends StairsBlock
{
protected AEBaseStairBlock( final Block block, final String type )
{
super( block.getDefaultState() );
Preconditions.checkNotNull( block );
Preconditions.checkNotNull( block.getTranslationKey() );
Preconditions.checkArgument( block.getTranslationKey().length() > 0 );
this.setUnlocalizedName( "stair." + type );
this.setLightOpacity( 0 );
}
@Override
public String toString()
{
String regName = this.getRegistryName() != null ? this.getRegistryName().getResourcePath() : "unregistered";
return this.getClass().getSimpleName() + "[" + regName + "]";
}
}
@@ -0,0 +1,33 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.decorative;
import net.minecraft.block.material.Material;
import appeng.block.AEBaseBlock;
public abstract class AEDecorativeBlock extends AEBaseBlock
{
public AEDecorativeBlock( final Material mat )
{
super( mat );
}
}
@@ -8,37 +8,35 @@ import javax.annotation.Nullable;
import net.minecraft.block.Block;
import net.minecraft.block.BlockSlab;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.SlabBlock;
import net.minecraft.block.BlockStateContainer;
import net.minecraft.block.BlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.state.IProperty;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public abstract class BlockSlabCommon extends BlockSlab
public abstract class CommonSlabBlock extends SlabBlock
{
static final PropertyEnum<BlockSlabCommon.Variant> VARIANT = PropertyEnum.create( "variant", Variant.class );
private BlockSlabCommon( Block block )
private CommonSlabBlock( Block block )
{
super( block.getMaterial( block.getDefaultState() ) );
this.setHardness( block.getBlockHardness( block.getDefaultState(), null, null ) );
this.setResistance( block.getExplosionResistance( null ) * 5.0F / 3.0F );
IBlockState iblockstate = this.blockState.getBaseState();
BlockState BlockState = this.blockState.getBaseState();
if( !this.isDouble() )
{
iblockstate = iblockstate.withProperty( HALF, BlockSlab.EnumBlockHalf.BOTTOM );
BlockState = BlockState.withProperty( HALF, BlockSlab.EnumBlockHalf.BOTTOM );
}
this.setDefaultState( iblockstate.withProperty( VARIANT, Variant.DEFAULT ) );
this.setDefaultState( BlockState.withProperty( VARIANT, Variant.DEFAULT ) );
this.setCreativeTab( CreativeTabs.BUILDING_BLOCKS );
this.useNeighborBrightness = true;
}
@@ -47,23 +45,23 @@ public abstract class BlockSlabCommon extends BlockSlab
* Convert the given metadata into a BlockState for this Block
*/
@Override
public IBlockState getStateFromMeta( int meta )
public BlockState getStateFromMeta( int meta )
{
IBlockState iblockstate = this.getDefaultState().withProperty( VARIANT, Variant.DEFAULT );
BlockState BlockState = this.getDefaultState().withProperty( VARIANT, Variant.DEFAULT );
if( !this.isDouble() )
{
iblockstate = iblockstate.withProperty( HALF, ( meta & 8 ) == 0 ? BlockSlab.EnumBlockHalf.BOTTOM : BlockSlab.EnumBlockHalf.TOP );
BlockState = BlockState.withProperty( HALF, ( meta & 8 ) == 0 ? BlockSlab.EnumBlockHalf.BOTTOM : BlockSlab.EnumBlockHalf.TOP );
}
return iblockstate;
return BlockState;
}
/**
* Convert the BlockState into the correct metadata value
*/
@Override
public int getMetaFromState( IBlockState state )
public int getMetaFromState( BlockState state )
{
int i = 0;
@@ -83,21 +81,21 @@ public abstract class BlockSlabCommon extends BlockSlab
@Override
@Nullable
public Item getItemDropped( IBlockState state, Random rand, int fortune )
public Item getItemDropped( BlockState state, Random rand, int fortune )
{
return Item.getItemFromBlock( this );
}
@Override
public ItemStack getItem( World worldIn, BlockPos pos, IBlockState state )
public ItemStack getItem( World worldIn, BlockPos pos, BlockState state )
{
return new ItemStack( this, 1, 0 );
}
@Override
public String getUnlocalizedName( int meta )
public String getTranslationKey( int meta )
{
return this.getUnlocalizedName();
return this.getTranslationKey();
}
@Override
@@ -112,7 +110,7 @@ public abstract class BlockSlabCommon extends BlockSlab
return Variant.DEFAULT;
}
public static class Double extends BlockSlabCommon
public static class Double extends CommonSlabBlock
{
private final Block halfSlabBlock;
@@ -131,20 +129,20 @@ public abstract class BlockSlabCommon extends BlockSlab
@Override
@Nullable
public Item getItemDropped( IBlockState state, Random rand, int fortune )
public Item getItemDropped( BlockState state, Random rand, int fortune )
{
return Item.getItemFromBlock( this.halfSlabBlock );
}
@Override
public ItemStack getItem( World worldIn, BlockPos pos, IBlockState state )
public ItemStack getItem( World worldIn, BlockPos pos, BlockState state )
{
return new ItemStack( this.halfSlabBlock, 1, 0 );
}
}
public static class Half extends BlockSlabCommon
public static class Half extends CommonSlabBlock
{
public Half( Block block )
@@ -21,16 +21,16 @@ package appeng.decorative.solid;
import java.util.Random;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.BlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import appeng.api.AEApi;
import appeng.api.exceptions.MissingDefinitionException;
@@ -42,7 +42,7 @@ import appeng.core.AppEng;
public class BlockChargedQuartzOre extends BlockQuartzOre
{
@Override
public Item getItemDropped( final IBlockState state, final Random rand, final int fortune )
public Item getItemDropped( final BlockState state, final Random rand, final int fortune )
{
return AEApi.instance()
.definitions()
@@ -53,7 +53,7 @@ public class BlockChargedQuartzOre extends BlockQuartzOre
}
@Override
public int damageDropped( final IBlockState state )
public int damageDropped( final BlockState state )
{
return AEApi.instance()
.definitions()
@@ -65,7 +65,7 @@ public class BlockChargedQuartzOre extends BlockQuartzOre
}
@Override
public ItemStack getPickBlock( IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player )
public ItemStack getPickBlock( BlockState state, RayTraceResult target, World world, BlockPos pos, PlayerEntity player )
{
return AEApi.instance()
.definitions()
@@ -76,8 +76,8 @@ public class BlockChargedQuartzOre extends BlockQuartzOre
}
@Override
@SideOnly( Side.CLIENT )
public void randomDisplayTick( final IBlockState state, final World w, final BlockPos pos, final Random r )
@OnlyIn( Dist.CLIENT )
public void randomDisplayTick( final BlockState state, final World w, final BlockPos pos, final Random r )
{
if( !AEConfig.instance().isEnableEffects() )
{
@@ -116,7 +116,7 @@ public class BlockChargedQuartzOre extends BlockQuartzOre
if( AppEng.proxy.shouldAddParticles( r ) )
{
final ChargedOreFX fx = new ChargedOreFX( w, pos.getX() + xOff, pos.getY() + yOff, pos.getZ() + zOff, 0.0f, 0.0f, 0.0f );
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
Minecraft.getInstance().effectRenderer.addEffect( fx );
}
}
}
@@ -21,7 +21,7 @@ package appeng.decorative.solid;
import net.minecraft.block.material.Material;
import appeng.block.AEDecorativeBlock;
import appeng.decorative.AEDecorativeBlock;
public final class BlockChiseledQuartz extends AEDecorativeBlock
@@ -21,7 +21,7 @@ package appeng.decorative.solid;
import net.minecraft.block.material.Material;
import appeng.block.AEDecorativeBlock;
import appeng.decorative.AEDecorativeBlock;
public final class BlockFluix extends AEDecorativeBlock
@@ -21,7 +21,7 @@ package appeng.decorative.solid;
import net.minecraft.block.material.Material;
import appeng.block.AEDecorativeBlock;
import appeng.decorative.AEDecorativeBlock;
public final class BlockQuartz extends AEDecorativeBlock
@@ -23,12 +23,11 @@ import java.util.EnumSet;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.block.BlockStateContainer;
import net.minecraft.block.BlockState;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.IBlockReader;
import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty;
@@ -59,12 +58,12 @@ public class BlockQuartzGlass extends AEBaseBlock
}
@Override
public IBlockState getExtendedState( IBlockState state, IBlockAccess world, BlockPos pos )
public BlockState getExtendedState( BlockState state, IBlockReader world, BlockPos pos )
{
EnumSet<EnumFacing> flushWith = EnumSet.noneOf( EnumFacing.class );
EnumSet<Direction> flushWith = EnumSet.noneOf( Direction.class );
// Test every direction for another glass block
for( EnumFacing facing : EnumFacing.values() )
for( Direction facing : Direction.values() )
{
if( isGlassBlock( world, pos, facing ) )
{
@@ -79,7 +78,7 @@ public class BlockQuartzGlass extends AEBaseBlock
return extState.withProperty( GLASS_STATE, glassState );
}
private static boolean isGlassBlock( IBlockAccess world, BlockPos pos, EnumFacing facing )
private static boolean isGlassBlock( IBlockReader world, BlockPos pos, Direction facing )
{
return world.getBlockState( pos.offset( facing ) ).getBlock() instanceof BlockQuartzGlass;
}
@@ -91,7 +90,7 @@ public class BlockQuartzGlass extends AEBaseBlock
}
@Override
public boolean shouldSideBeRendered( final IBlockState state, final IBlockAccess w, final BlockPos pos, final EnumFacing side )
public boolean shouldSideBeRendered( final BlockState state, final IBlockReader w, final BlockPos pos, final Direction side )
{
BlockPos adjacentPos = pos.offset( side );
@@ -109,7 +108,7 @@ public class BlockQuartzGlass extends AEBaseBlock
}
@Override
public boolean isFullCube( IBlockState state )
public boolean isFullCube( BlockState state )
{
return false;
}
@@ -21,12 +21,12 @@ package appeng.decorative.solid;
import java.util.Random;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.BlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import appeng.client.render.effects.VibrantFX;
import appeng.core.AEConfig;
@@ -42,8 +42,8 @@ public class BlockQuartzLamp extends BlockQuartzGlass
}
@Override
@SideOnly( Side.CLIENT )
public void randomDisplayTick( final IBlockState state, final World w, final BlockPos pos, final Random r )
@OnlyIn( Dist.CLIENT )
public void randomDisplayTick( final BlockState state, final World w, final BlockPos pos, final Random r )
{
if( !AEConfig.instance().isEnableEffects() )
{
@@ -58,7 +58,7 @@ public class BlockQuartzLamp extends BlockQuartzGlass
final VibrantFX fx = new VibrantFX( w, 0.5 + pos.getX() + d0, 0.5 + pos.getY() + d1, 0.5 + pos.getZ() + d2, 0.0D, 0.0D, 0.0D );
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
Minecraft.getInstance().effectRenderer.addEffect( fx );
}
}
}
@@ -22,12 +22,12 @@ package appeng.decorative.solid;
import java.util.Random;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.BlockState;
import net.minecraft.item.Item;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import appeng.api.AEApi;
@@ -51,7 +51,7 @@ public class BlockQuartzOre extends AEBaseBlock
}
@Override
public int quantityDropped( IBlockState state, int fortune, Random rand )
public int quantityDropped( BlockState state, int fortune, Random rand )
{
if( fortune > 0 && Item.getItemFromBlock( this ) != this.getItemDropped( null, rand, fortune ) )
{
@@ -77,7 +77,7 @@ public class BlockQuartzOre extends AEBaseBlock
}
@Override
public int getExpDrop( IBlockState state, IBlockAccess world, BlockPos pos, int fortune )
public int getExpDrop( BlockState state, IBlockReader world, BlockPos pos, int fortune )
{
Random rand = world instanceof World ? ( (World) world ).rand : new Random();
@@ -89,7 +89,7 @@ public class BlockQuartzOre extends AEBaseBlock
}
@Override
public Item getItemDropped( final IBlockState state, final Random rand, final int fortune )
public Item getItemDropped( final BlockState state, final Random rand, final int fortune )
{
return AEApi.instance()
.definitions()
@@ -100,7 +100,7 @@ public class BlockQuartzOre extends AEBaseBlock
}
@Override
public int damageDropped( final IBlockState state )
public int damageDropped( final BlockState state )
{
return AEApi.instance()
.definitions()
@@ -20,12 +20,12 @@ package appeng.decorative.solid;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.EnumFacing;
import net.minecraft.state.EnumProperty;
import net.minecraft.state.IProperty;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.IBlockReader;
import appeng.api.util.IOrientable;
import appeng.api.util.IOrientableBlock;
@@ -35,33 +35,20 @@ import appeng.helpers.MetaRotation;
public class BlockQuartzPillar extends AEBaseBlock implements IOrientableBlock
{
public static final PropertyEnum<EnumFacing.Axis> AXIS_ORIENTATION = PropertyEnum.create( "axis", EnumFacing.Axis.class );
public static final EnumProperty<Direction.Axis> AXIS = BlockStateProperties.AXIS;
public BlockQuartzPillar()
{
super( Material.ROCK );
// The upwards facing pillar is the default (i.e. for the item model)
this.setDefaultState( this.getDefaultState().withProperty( AXIS_ORIENTATION, EnumFacing.Axis.Y ) );
}
@Override
public int getMetaFromState( final IBlockState state )
{
return state.getValue( AXIS_ORIENTATION ).ordinal();
}
@Override
public IBlockState getStateFromMeta( final int meta )
{
// Simply use the ordinal here
EnumFacing.Axis axis = EnumFacing.Axis.values()[meta];
return this.getDefaultState().withProperty( AXIS_ORIENTATION, axis );
this.setDefaultState( this.getDefaultState().with( AXIS, Direction.Axis.Y ) );
}
@Override
protected IProperty[] getAEStates()
{
return new IProperty[] { AXIS_ORIENTATION };
return new IProperty[] { AXIS };
}
@Override
@@ -71,7 +58,7 @@ public class BlockQuartzPillar extends AEBaseBlock implements IOrientableBlock
}
@Override
public IOrientable getOrientable( final IBlockAccess w, final BlockPos pos )
public IOrientable getOrientable( final IBlockReader w, final BlockPos pos )
{
return new MetaRotation( w, pos, null );
}
@@ -20,7 +20,7 @@ package appeng.decorative.solid;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.BlockState;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
@@ -59,14 +59,14 @@ public class BlockSkyStone extends AEBaseBlock
@SubscribeEvent
public void breakFaster( final PlayerEvent.BreakSpeed event )
{
if( event.getState().getBlock() == this && event.getEntityPlayer() != null )
if( event.getState().getBlock() == this && event.getPlayerEntity() != null )
{
final ItemStack is = event.getEntityPlayer().getItemStackFromSlot( EntityEquipmentSlot.MAINHAND );
final ItemStack is = event.getPlayerEntity().getItemStackFromSlot( EntityEquipmentSlot.MAINHAND );
int level = -1;
if( !is.isEmpty() )
{
level = is.getItem().getHarvestLevel( is, "pickaxe", event.getEntityPlayer(), event.getState() );
level = is.getItem().getHarvestLevel( is, "pickaxe", event.getPlayerEntity(), event.getState() );
}
if( this.type != SkystoneType.STONE || level >= 3 || event.getOriginalSpeed() > BREAK_SPEAK_THRESHOLD )
@@ -77,7 +77,7 @@ public class BlockSkyStone extends AEBaseBlock
}
@Override
public void onBlockAdded( final World w, final BlockPos pos, final IBlockState state )
public void onBlockAdded( final World w, final BlockPos pos, final BlockState state )
{
super.onBlockAdded( w, pos, state );
if( Platform.isServer() )
@@ -87,7 +87,7 @@ public class BlockSkyStone extends AEBaseBlock
}
@Override
public void breakBlock( final World w, final BlockPos pos, final IBlockState state )
public void breakBlock( final World w, final BlockPos pos, final BlockState state )
{
super.breakBlock( w, pos, state );
@@ -21,7 +21,7 @@ package appeng.decorative.solid;
import java.util.EnumSet;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
/**
@@ -35,9 +35,9 @@ public final class GlassState
private final int y;
private final int z;
private final EnumSet<EnumFacing> flushWith = EnumSet.noneOf( EnumFacing.class );
private final EnumSet<Direction> flushWith = EnumSet.noneOf( Direction.class );
public GlassState( int x, int y, int z, EnumSet<EnumFacing> flushWith )
public GlassState( int x, int y, int z, EnumSet<Direction> flushWith )
{
this.x = x;
this.y = y;
@@ -60,7 +60,7 @@ public final class GlassState
return this.z;
}
public boolean isFlushWith( EnumFacing side )
public boolean isFlushWith( Direction side )
{
return this.flushWith.contains( side );
}
@@ -21,7 +21,7 @@ package appeng.decorative.stair;
import net.minecraft.block.Block;
import appeng.block.AEBaseStairBlock;
import appeng.decorative.AEBaseStairBlock;
public class BlockStairCommon extends AEBaseStairBlock