pick 97420a31d The big reformat of 2020
This commit is contained in:
@@ -18,13 +18,10 @@
|
||||
|
||||
package appeng.decorative;
|
||||
|
||||
|
||||
import appeng.block.AEBaseBlock;
|
||||
|
||||
|
||||
public class AEDecorativeBlock extends AEBaseBlock
|
||||
{
|
||||
public AEDecorativeBlock(Properties props) {
|
||||
super(props);
|
||||
}
|
||||
public class AEDecorativeBlock extends AEBaseBlock {
|
||||
public AEDecorativeBlock(Properties props) {
|
||||
super(props);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,10 +18,8 @@
|
||||
|
||||
package appeng.decorative.solid;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import appeng.client.render.effects.ChargedOreFX;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AppEng;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -29,16 +27,16 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import java.util.Random;
|
||||
import appeng.client.render.effects.ChargedOreFX;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AppEng;
|
||||
|
||||
public class BlockChargedQuartzOre extends BlockQuartzOre {
|
||||
public BlockChargedQuartzOre(Properties props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
public class BlockChargedQuartzOre extends BlockQuartzOre
|
||||
{
|
||||
public BlockChargedQuartzOre(Properties props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
// FIXME: Loot tables
|
||||
// FIXME: Loot tables
|
||||
// @Override
|
||||
// public Item getItemDropped( final BlockState state, final Random rand, final int fortune )
|
||||
// {
|
||||
@@ -73,47 +71,44 @@ public class BlockChargedQuartzOre extends BlockQuartzOre
|
||||
// .orElseThrow( () -> new MissingDefinitionException( "Tried to access charged certus quartz ore, even though they are disabled" ) );
|
||||
// }
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void animateTick( final BlockState state, final World w, final BlockPos pos, final Random r )
|
||||
{
|
||||
if( !AEConfig.instance().isEnableEffects() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void animateTick(final BlockState state, final World w, final BlockPos pos, final Random r) {
|
||||
if (!AEConfig.instance().isEnableEffects()) {
|
||||
return;
|
||||
}
|
||||
|
||||
double xOff = ( r.nextFloat() );
|
||||
double yOff = ( r.nextFloat() );
|
||||
double zOff = ( r.nextFloat() );
|
||||
double xOff = (r.nextFloat());
|
||||
double yOff = (r.nextFloat());
|
||||
double zOff = (r.nextFloat());
|
||||
|
||||
switch( r.nextInt( 6 ) )
|
||||
{
|
||||
case 0:
|
||||
xOff = -0.01;
|
||||
break;
|
||||
case 1:
|
||||
yOff = -0.01;
|
||||
break;
|
||||
case 2:
|
||||
xOff = -0.01;
|
||||
break;
|
||||
case 3:
|
||||
zOff = -0.01;
|
||||
break;
|
||||
case 4:
|
||||
xOff = 1.01;
|
||||
break;
|
||||
case 5:
|
||||
yOff = 1.01;
|
||||
break;
|
||||
case 6:
|
||||
zOff = 1.01;
|
||||
break;
|
||||
}
|
||||
switch (r.nextInt(6)) {
|
||||
case 0:
|
||||
xOff = -0.01;
|
||||
break;
|
||||
case 1:
|
||||
yOff = -0.01;
|
||||
break;
|
||||
case 2:
|
||||
xOff = -0.01;
|
||||
break;
|
||||
case 3:
|
||||
zOff = -0.01;
|
||||
break;
|
||||
case 4:
|
||||
xOff = 1.01;
|
||||
break;
|
||||
case 5:
|
||||
yOff = 1.01;
|
||||
break;
|
||||
case 6:
|
||||
zOff = 1.01;
|
||||
break;
|
||||
}
|
||||
|
||||
if( AppEng.proxy.shouldAddParticles( r ) )
|
||||
{
|
||||
Minecraft.getInstance().particles.addParticle(ChargedOreFX.TYPE, pos.getX() + xOff, pos.getY() + yOff, pos.getZ() + zOff, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
if (AppEng.proxy.shouldAddParticles(r)) {
|
||||
Minecraft.getInstance().particles.addParticle(ChargedOreFX.TYPE, pos.getX() + xOff, pos.getY() + yOff,
|
||||
pos.getZ() + zOff, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,8 +18,6 @@
|
||||
|
||||
package appeng.decorative.solid;
|
||||
|
||||
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import net.minecraft.block.AbstractGlassBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
@@ -27,22 +25,24 @@ import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.util.Direction;
|
||||
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
|
||||
public class BlockQuartzGlass extends AbstractGlassBlock {
|
||||
|
||||
public BlockQuartzGlass(Properties props) {
|
||||
super(props);
|
||||
}
|
||||
public BlockQuartzGlass(Properties props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSideInvisible(BlockState state, BlockState adjacentBlockState, Direction side) {
|
||||
final Material mat = adjacentBlockState.getMaterial();
|
||||
if (mat == Material.GLASS || mat == AEGlassMaterial.INSTANCE) {
|
||||
if (adjacentBlockState.getRenderType() == state.getRenderType()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean isSideInvisible(BlockState state, BlockState adjacentBlockState, Direction side) {
|
||||
final Material mat = adjacentBlockState.getMaterial();
|
||||
if (mat == Material.GLASS || mat == AEGlassMaterial.INSTANCE) {
|
||||
if (adjacentBlockState.getRenderType() == state.getRenderType()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return super.isSideInvisible(state, adjacentBlockState, side);
|
||||
}
|
||||
return super.isSideInvisible(state, adjacentBlockState, side);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
package appeng.decorative.solid;
|
||||
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
@@ -31,30 +30,25 @@ import appeng.client.render.effects.VibrantFX;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AppEng;
|
||||
|
||||
public class BlockQuartzLamp extends BlockQuartzGlass {
|
||||
|
||||
public class BlockQuartzLamp extends BlockQuartzGlass
|
||||
{
|
||||
public BlockQuartzLamp(Properties props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
public BlockQuartzLamp(Properties props) {
|
||||
super(props);
|
||||
}
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void animateTick(final BlockState state, final World w, final BlockPos pos, final Random r) {
|
||||
if (!AEConfig.instance().isEnableEffects()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void animateTick( final BlockState state, final World w, final BlockPos pos, final Random r )
|
||||
{
|
||||
if( !AEConfig.instance().isEnableEffects() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (AppEng.proxy.shouldAddParticles(r)) {
|
||||
final double d0 = (r.nextFloat() - 0.5F) * 0.96D;
|
||||
final double d1 = (r.nextFloat() - 0.5F) * 0.96D;
|
||||
final double d2 = (r.nextFloat() - 0.5F) * 0.96D;
|
||||
|
||||
if( AppEng.proxy.shouldAddParticles( r ) )
|
||||
{
|
||||
final double d0 = ( r.nextFloat() - 0.5F ) * 0.96D;
|
||||
final double d1 = ( r.nextFloat() - 0.5F ) * 0.96D;
|
||||
final double d2 = ( r.nextFloat() - 0.5F ) * 0.96D;
|
||||
|
||||
w.addParticle(VibrantFX.TYPE, 0.5 + pos.getX() + d0, 0.5 + pos.getY() + d1, 0.5 + pos.getZ() + d2, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
w.addParticle(VibrantFX.TYPE, 0.5 + pos.getX() + d0, 0.5 + pos.getY() + d1, 0.5 + pos.getZ() + d2, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,20 +18,18 @@
|
||||
|
||||
package appeng.decorative.solid;
|
||||
|
||||
|
||||
import appeng.block.AEBaseBlock;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import appeng.block.AEBaseBlock;
|
||||
|
||||
public class BlockQuartzOre extends AEBaseBlock
|
||||
{
|
||||
public BlockQuartzOre(Properties props) {
|
||||
super(props);
|
||||
}
|
||||
public class BlockQuartzOre extends AEBaseBlock {
|
||||
public BlockQuartzOre(Properties props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
// FIXME: Loot Tables
|
||||
// FIXME: Loot Tables
|
||||
// @Override
|
||||
// public int quantityDropped( BlockState state, int fortune, Random rand )
|
||||
// {
|
||||
@@ -59,12 +57,13 @@ public class BlockQuartzOre extends AEBaseBlock
|
||||
// }
|
||||
//
|
||||
|
||||
@Override
|
||||
public int getExpDrop(BlockState state, net.minecraft.world.IWorldReader reader, BlockPos pos, int fortune, int silktouch) {
|
||||
return silktouch == 0 ? MathHelper.nextInt(RANDOM, 2, 5) : 0;
|
||||
}
|
||||
@Override
|
||||
public int getExpDrop(BlockState state, net.minecraft.world.IWorldReader reader, BlockPos pos, int fortune,
|
||||
int silktouch) {
|
||||
return silktouch == 0 ? MathHelper.nextInt(RANDOM, 2, 5) : 0;
|
||||
}
|
||||
|
||||
// FIXME: loot tables
|
||||
// FIXME: loot tables
|
||||
// @Override
|
||||
// public Item getItemDropped( final BlockState state, final Random rand, final int fortune )
|
||||
// {
|
||||
@@ -76,7 +75,7 @@ public class BlockQuartzOre extends AEBaseBlock
|
||||
// .orElseThrow( () -> new MissingDefinitionException( "Tried to access certus quartz crystal, even though they are disabled" ) );
|
||||
// }
|
||||
|
||||
// FIXME: loot tables
|
||||
// FIXME: loot tables
|
||||
// @Override
|
||||
// public int damageDropped( final BlockState state )
|
||||
// {
|
||||
|
||||
@@ -18,8 +18,6 @@
|
||||
|
||||
package appeng.decorative.solid;
|
||||
|
||||
|
||||
import appeng.decorative.AEDecorativeBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.state.EnumProperty;
|
||||
@@ -31,30 +29,28 @@ import net.minecraft.world.IBlockReader;
|
||||
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
import appeng.decorative.AEDecorativeBlock;
|
||||
import appeng.helpers.MetaRotation;
|
||||
|
||||
public class BlockQuartzPillar extends AEDecorativeBlock implements IOrientableBlock {
|
||||
public static final EnumProperty<Direction.Axis> AXIS = BlockStateProperties.AXIS;
|
||||
|
||||
public class BlockQuartzPillar extends AEDecorativeBlock implements IOrientableBlock
|
||||
{
|
||||
public static final EnumProperty<Direction.Axis> AXIS = BlockStateProperties.AXIS;
|
||||
public BlockQuartzPillar(Properties props) {
|
||||
super(props);
|
||||
|
||||
public BlockQuartzPillar(Properties props) {
|
||||
super(props);
|
||||
// The upwards facing pillar is the default (i.e. for the item model)
|
||||
this.setDefaultState(this.getDefaultState().with(AXIS, Direction.Axis.Y));
|
||||
}
|
||||
|
||||
// The upwards facing pillar is the default (i.e. for the item model)
|
||||
this.setDefaultState( this.getDefaultState().with( AXIS, Direction.Axis.Y ) );
|
||||
}
|
||||
@Override
|
||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
|
||||
super.fillStateContainer(builder);
|
||||
builder.add(AXIS);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
|
||||
super.fillStateContainer(builder);
|
||||
builder.add(AXIS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IOrientable getOrientable( final IBlockReader w, final BlockPos pos )
|
||||
{
|
||||
return new MetaRotation( w, pos, null );
|
||||
}
|
||||
@Override
|
||||
public IOrientable getOrientable(final IBlockReader w, final BlockPos pos) {
|
||||
return new MetaRotation(w, pos, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,8 +18,6 @@
|
||||
|
||||
package appeng.decorative.solid;
|
||||
|
||||
|
||||
import appeng.core.worlddata.WorldData;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.inventory.EquipmentSlotType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -34,68 +32,63 @@ import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.core.worlddata.WorldData;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class BlockSkyStone extends AEBaseBlock {
|
||||
private static final float BREAK_SPEAK_SCALAR = 0.1f;
|
||||
private static final double BREAK_SPEAK_THRESHOLD = 7.0;
|
||||
private final SkystoneType type;
|
||||
|
||||
public class BlockSkyStone extends AEBaseBlock
|
||||
{
|
||||
private static final float BREAK_SPEAK_SCALAR = 0.1f;
|
||||
private static final double BREAK_SPEAK_THRESHOLD = 7.0;
|
||||
private final SkystoneType type;
|
||||
public BlockSkyStone(SkystoneType type, Properties props) {
|
||||
super(props);
|
||||
this.type = type;
|
||||
|
||||
public BlockSkyStone(SkystoneType type, Properties props) {
|
||||
super(props);
|
||||
this.type = type;
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
MinecraftForge.EVENT_BUS.register( this );
|
||||
}
|
||||
@SubscribeEvent
|
||||
public void breakFaster(final PlayerEvent.BreakSpeed event) {
|
||||
if (event.getState().getBlock() == this && event.getPlayer() != null) {
|
||||
final ItemStack is = event.getPlayer().getItemStackFromSlot(EquipmentSlotType.MAINHAND);
|
||||
int level = -1;
|
||||
|
||||
@SubscribeEvent
|
||||
public void breakFaster( final PlayerEvent.BreakSpeed event )
|
||||
{
|
||||
if( event.getState().getBlock() == this && event.getPlayer() != null )
|
||||
{
|
||||
final ItemStack is = event.getPlayer().getItemStackFromSlot( EquipmentSlotType.MAINHAND );
|
||||
int level = -1;
|
||||
if (!is.isEmpty()) {
|
||||
level = is.getItem().getHarvestLevel(is, ToolType.PICKAXE, event.getPlayer(), event.getState());
|
||||
}
|
||||
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
level = is.getItem().getHarvestLevel( is, ToolType.PICKAXE, event.getPlayer(), event.getState() );
|
||||
}
|
||||
if (this.type != SkystoneType.STONE || level >= 3 || event.getOriginalSpeed() > BREAK_SPEAK_THRESHOLD) {
|
||||
event.setNewSpeed(event.getNewSpeed() / BREAK_SPEAK_SCALAR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( this.type != SkystoneType.STONE || level >= 3 || event.getOriginalSpeed() > BREAK_SPEAK_THRESHOLD )
|
||||
{
|
||||
event.setNewSpeed( event.getNewSpeed() / BREAK_SPEAK_SCALAR );
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public BlockState updatePostPlacement(BlockState stateIn, Direction facing, BlockState facingState, IWorld worldIn,
|
||||
BlockPos currentPos, BlockPos facingPos) {
|
||||
if (worldIn instanceof ServerWorld) {
|
||||
WorldData.instance().compassData().service().updateArea((ServerWorld) worldIn, currentPos.getX(),
|
||||
currentPos.getY(), currentPos.getZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState updatePostPlacement(BlockState stateIn, Direction facing, BlockState facingState, IWorld worldIn, BlockPos currentPos, BlockPos facingPos) {
|
||||
if( worldIn instanceof ServerWorld)
|
||||
{
|
||||
WorldData.instance().compassData().service().updateArea((ServerWorld) worldIn, currentPos.getX(), currentPos.getY(), currentPos.getZ() );
|
||||
}
|
||||
return super.updatePostPlacement(stateIn, facing, facingState, worldIn, currentPos, facingPos);
|
||||
}
|
||||
|
||||
return super.updatePostPlacement(stateIn, facing, facingState, worldIn, currentPos, facingPos);
|
||||
}
|
||||
@Override
|
||||
public void onReplaced(BlockState state, World w, BlockPos pos, BlockState newState, boolean isMoving) {
|
||||
if (newState.getBlock() == state.getBlock()) {
|
||||
return; // Just a block state change
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReplaced(BlockState state, World w, BlockPos pos, BlockState newState, boolean isMoving) {
|
||||
if (newState.getBlock() == state.getBlock()) {
|
||||
return; // Just a block state change
|
||||
}
|
||||
super.onReplaced(state, w, pos, newState, isMoving);
|
||||
|
||||
super.onReplaced(state, w, pos, newState, isMoving);
|
||||
if (w instanceof ServerWorld) {
|
||||
WorldData.instance().compassData().service().updateArea((ServerWorld) w, pos.getX(), pos.getY(),
|
||||
pos.getZ());
|
||||
}
|
||||
}
|
||||
|
||||
if( w instanceof ServerWorld )
|
||||
{
|
||||
WorldData.instance().compassData().service().updateArea((ServerWorld) w, pos.getX(), pos.getY(), pos.getZ() );
|
||||
}
|
||||
}
|
||||
|
||||
public enum SkystoneType
|
||||
{
|
||||
STONE, BLOCK, BRICK, SMALL_BRICK
|
||||
}
|
||||
public enum SkystoneType {
|
||||
STONE, BLOCK, BRICK, SMALL_BRICK
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,51 +18,43 @@
|
||||
|
||||
package appeng.decorative.solid;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.util.Direction;
|
||||
|
||||
|
||||
/**
|
||||
* Immutable (and thus thread-safe) class that encapsulates the rendering state required for a connected texture
|
||||
* glass block.
|
||||
* Immutable (and thus thread-safe) class that encapsulates the rendering state
|
||||
* required for a connected texture glass block.
|
||||
*/
|
||||
public final class GlassState
|
||||
{
|
||||
public final class GlassState {
|
||||
|
||||
private final int x;
|
||||
private final int y;
|
||||
private final int z;
|
||||
private final int x;
|
||||
private final int y;
|
||||
private final int z;
|
||||
|
||||
private final EnumSet<Direction> flushWith = EnumSet.noneOf( Direction.class );
|
||||
private final EnumSet<Direction> flushWith = EnumSet.noneOf(Direction.class);
|
||||
|
||||
public GlassState( int x, int y, int z, EnumSet<Direction> flushWith )
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.flushWith.addAll( flushWith );
|
||||
}
|
||||
public GlassState(int x, int y, int z, EnumSet<Direction> flushWith) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.flushWith.addAll(flushWith);
|
||||
}
|
||||
|
||||
public int getX()
|
||||
{
|
||||
return this.x;
|
||||
}
|
||||
public int getX() {
|
||||
return this.x;
|
||||
}
|
||||
|
||||
public int getY()
|
||||
{
|
||||
return this.y;
|
||||
}
|
||||
public int getY() {
|
||||
return this.y;
|
||||
}
|
||||
|
||||
public int getZ()
|
||||
{
|
||||
return this.z;
|
||||
}
|
||||
public int getZ() {
|
||||
return this.z;
|
||||
}
|
||||
|
||||
public boolean isFlushWith( Direction side )
|
||||
{
|
||||
return this.flushWith.contains( side );
|
||||
}
|
||||
public boolean isFlushWith(Direction side) {
|
||||
return this.flushWith.contains(side);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user