Moving to source sets

This commit is contained in:
Sebastian Hartte
2020-07-01 23:36:51 +02:00
parent f2e3d81fd7
commit 2642ced86b
2924 changed files with 794 additions and 796 deletions
@@ -0,0 +1,27 @@
/*
* 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 appeng.block.AEBaseBlock;
public class AEDecorativeBlock extends AEBaseBlock {
public AEDecorativeBlock(Settings props) {
super(props);
}
}
@@ -0,0 +1,12 @@
package appeng.decorative.solid;
import net.minecraft.block.BlockState;
import net.minecraft.block.StairsBlock;
public class AEStairsBlock extends StairsBlock {
public AEStairsBlock(BlockState baseBlockState, Settings settings) {
super(baseBlockState, settings);
}
}
@@ -0,0 +1,79 @@
/*
* 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.solid;
import java.util.Random;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.BlockState;
import net.minecraft.client.MinecraftClient;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import appeng.client.render.effects.ParticleTypes;
import appeng.core.AEConfig;
import appeng.core.AppEng;
public class ChargedQuartzOreBlock extends QuartzOreBlock {
public ChargedQuartzOreBlock(Settings props) {
super(props);
}
@Override
@Environment(EnvType.CLIENT)
public void randomDisplayTick(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());
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.instance().shouldAddParticles(r)) {
MinecraftClient.getInstance().particleManager.addParticle(ParticleTypes.CHARGED_ORE, pos.getX() + xOff,
pos.getY() + yOff, pos.getZ() + zOff, 0.0f, 0.0f, 0.0f);
}
}
}
@@ -0,0 +1,60 @@
/*
* 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.solid;
import java.util.EnumSet;
import net.minecraft.util.math.Direction;
/**
* Immutable (and thus thread-safe) class that encapsulates the rendering state
* required for a connected texture glass block.
*/
public final class GlassState {
private final int x;
private final int y;
private final int z;
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 int getX() {
return this.x;
}
public int getY() {
return this.y;
}
public int getZ() {
return this.z;
}
public boolean isFlushWith(Direction side) {
return this.flushWith.contains(side);
}
}
@@ -0,0 +1,46 @@
/*
* 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.solid;
import net.minecraft.block.AbstractGlassBlock;
import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.util.math.Direction;
import appeng.helpers.AEGlassMaterial;
public class QuartzGlassBlock extends AbstractGlassBlock {
public QuartzGlassBlock(Settings 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;
}
}
return super.isSideInvisible(state, adjacentBlockState, side);
}
}
@@ -0,0 +1,55 @@
/*
* 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.solid;
import java.util.Random;
import net.fabricmc.api.EnvType;
import net.minecraft.block.BlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.fabricmc.api.Environment;
import appeng.client.render.effects.ParticleTypes;
import appeng.core.AEConfig;
import appeng.core.AppEng;
public class QuartzLampBlock extends QuartzGlassBlock {
public QuartzLampBlock(Settings props) {
super(props);
}
@Override
@Environment(EnvType.CLIENT)
public void randomDisplayTick(final BlockState state, final World w, final BlockPos pos, final Random r) {
if (!AEConfig.instance().isEnableEffects()) {
return;
}
if (AppEng.instance().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(ParticleTypes.VIBRANT, 0.5 + pos.getX() + d0, 0.5 + pos.getY() + d1, 0.5 + pos.getZ() + d2, 0,
0, 0);
}
}
}
@@ -0,0 +1,46 @@
/*
* 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.solid;
import appeng.block.AEBaseBlock;
import net.minecraft.block.BlockState;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
public class QuartzOreBlock extends AEBaseBlock {
public QuartzOreBlock(Settings props) {
super(props);
}
@Override
public void onStacksDropped(BlockState state, World world, BlockPos pos, ItemStack stack) {
super.onStacksDropped(state, world, pos, stack);
if (EnchantmentHelper.getLevel(Enchantments.SILK_TOUCH, stack) == 0) {
int i = MathHelper.nextInt(world.random, 2, 5);
if (i > 0) {
this.dropExperience(world, pos, i);
}
}
}
}
@@ -0,0 +1,56 @@
/*
* 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.solid;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.state.property.EnumProperty;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.Properties;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.BlockView;
import appeng.api.util.IOrientable;
import appeng.api.util.IOrientableBlock;
import appeng.decorative.AEDecorativeBlock;
import appeng.helpers.MetaRotation;
public class QuartzPillarBlock extends AEDecorativeBlock implements IOrientableBlock {
public static final EnumProperty<Direction.Axis> AXIS = Properties.AXIS;
public QuartzPillarBlock(Settings 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));
}
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
super.appendProperties(builder);
builder.add(AXIS);
}
@Override
public IOrientable getOrientable(final BlockView w, final BlockPos pos) {
return new MetaRotation(w, pos, null);
}
}
@@ -0,0 +1,89 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, 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.solid;
import appeng.block.AEBaseBlock;
import appeng.core.worlddata.WorldData;
import net.minecraft.block.BlockState;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
public class SkyStoneBlock 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 SkyStoneBlock(SkystoneType type, Settings props) {
super(props);
this.type = type;
}
// FIXME FABRIC
// @SubscribeEvent
// public void breakFaster(final PlayerEvent.BreakSpeed event) {
// if (event.getState().getBlock() == this && event.getPlayer() != null) {
// final ItemStack is = event.getPlayer().getItemStackFromSlot(EquipmentSlot.MAINHAND);
// int level = -1;
//
// if (!is.isEmpty()) {
// level = is.getItem().getHarvestLevel(is, FabricToolTags.PICKAXES, event.getPlayer(), event.getState());
// }
//
// if (this.type != SkystoneType.STONE || level >= 3 || event.getOriginalSpeed() > BREAK_SPEAK_THRESHOLD) {
// event.setNewSpeed(event.getNewSpeed() / BREAK_SPEAK_SCALAR);
// }
// }
// }
@Override
public BlockState getStateForNeighborUpdate(BlockState stateIn, Direction facing, BlockState facingState, WorldAccess worldIn,
BlockPos currentPos, BlockPos facingPos) {
if (worldIn instanceof ServerWorld) {
ServerWorld serverWorld = (ServerWorld) worldIn;
WorldData.instance().compassData().service().updateArea(serverWorld, new ChunkPos(currentPos),
currentPos.getY());
}
return super.getStateForNeighborUpdate(stateIn, facing, facingState, worldIn, currentPos, facingPos);
}
@Override
public void onStateReplaced(BlockState state, World w, BlockPos pos, BlockState newState, boolean isMoving) {
if (newState.getBlock() == state.getBlock()) {
return; // Just a block state change
}
super.onStateReplaced(state, w, pos, newState, isMoving);
if (w instanceof ServerWorld) {
ServerWorld serverWorld = (ServerWorld) w;
WorldData.instance().compassData().service().updateArea(serverWorld, new ChunkPos(pos), pos.getY());
}
}
public enum SkystoneType {
STONE, BLOCK, BRICK, SMALL_BRICK
}
}