Compare commits

...

2 commits

Author SHA1 Message Date
Flanks255
6686f1f417 Simplifying alot of block voxelshapes. 2024-06-04 22:25:30 -05:00
Flanks255
c812512abe Fixed up the teleport staff. 2024-06-04 16:38:19 -05:00
24 changed files with 69 additions and 45 deletions

View file

@ -94,7 +94,7 @@ public class BlockAtomicReconstructor extends FullyDirectionalBlock.Container im
return InteractionResult.CONSUME;
}
@Override
/* @Override
public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) {
switch (state.getValue(FACING)) {
case UP:
@ -110,7 +110,7 @@ public class BlockAtomicReconstructor extends FullyDirectionalBlock.Container im
default:
return VoxelShapes.AtomicReconstructorShapes.SHAPE_N;
}
}
}*/
@Nullable
@Override

View file

@ -53,7 +53,7 @@ public class BlockBioReactor extends DirectionalBlock.Container {
return this.openGui(world, player, pos, TileEntityBioReactor.class);
}
@Override
/* @Override
public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) {
switch (state.getValue(HORIZONTAL_FACING)) {
case EAST:
@ -65,5 +65,5 @@ public class BlockBioReactor extends DirectionalBlock.Container {
default:
return VoxelShapes.BioReactorShapes.SHAPE_N;
}
}
}*/
}

View file

@ -63,7 +63,7 @@ public class BlockBreaker extends FullyDirectionalBlock.Container {
return this.openGui(world, player, pos, TileEntityBreaker.class);
}
@Override
/* @Override
public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) {
switch (state.getValue(FACING)) {
case UP:
@ -79,5 +79,5 @@ public class BlockBreaker extends FullyDirectionalBlock.Container {
default:
return VoxelShapes.BlockBreakerShapes.SHAPE_N;
}
}
}*/
}

View file

@ -65,7 +65,7 @@ public class BlockCoalGenerator extends DirectionalBlock.Container {
return this.openGui(world, player, pos, TileEntityCoalGenerator.class);
}
@Override
/* @Override
public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) {
switch (state.getValue(FACING)) {
case EAST:
@ -77,5 +77,10 @@ public class BlockCoalGenerator extends DirectionalBlock.Container {
default:
return VoxelShapes.CoalGeneratorShapes.NORTH;
}
}*/
@Override
public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) {
return VoxelShapes.SIMPLE_GENERATOR_SHAPE;
}
}

View file

@ -103,7 +103,7 @@ public class BlockCrusher extends BlockContainerBase {
: 0;
}
@Override
/* @Override
public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) {
switch (state.getValue(HORIZONTAL_FACING)) {
case EAST:
@ -115,5 +115,5 @@ public class BlockCrusher extends BlockContainerBase {
default:
return VoxelShapes.GrinderShapes.SHAPE_N;
}
}
}*/
}

View file

@ -55,7 +55,7 @@ public class BlockDropper extends FullyDirectionalBlock.Container {
return this.openGui(world, player, pos, TileEntityDropper.class);
}
@Override
/* @Override
public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) {
switch (state.getValue(FACING)) {
case UP:
@ -71,5 +71,5 @@ public class BlockDropper extends FullyDirectionalBlock.Container {
default:
return VoxelShapes.BlockBreakerShapes.SHAPE_N;
}
}
}*/
}

View file

@ -62,11 +62,11 @@ public class BlockEnergizer extends BlockContainerBase {
}
}
@Override
/* @Override
public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) {
if (this.isEnergizer) {
return VoxelShapes.ENERGIZER_SHAPE;
}
return VoxelShapes.ENERVATOR_SHAPE;
}
}*/
}

View file

@ -51,7 +51,7 @@ public class BlockFarmer extends DirectionalBlock.Container {
return this.openGui(worldIn, player, pos, TileEntityFarmer.class);
}
@Override
/* @Override
public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) {
switch (state.getValue(FACING)) {
case EAST:
@ -63,5 +63,5 @@ public class BlockFarmer extends DirectionalBlock.Container {
default:
return VoxelShapes.FarmerShapes.SHAPE_N;
}
}
}*/
}

View file

@ -51,8 +51,8 @@ public class BlockFeeder extends BlockContainerBase {
return this.openGui(worldIn, player, pos, TileEntityFeeder.class);
}
@Override
/* @Override
public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) {
return VoxelShapes.FEEDER_SHAPE;
}
}*/
}

View file

@ -72,7 +72,7 @@ public class BlockFluidCollector extends FullyDirectionalBlock.Container {
return this.openGui(world, player, pos, TileEntityFluidCollector.class);
}
@Nonnull
/* @Nonnull
@Override
public VoxelShape getShape(BlockState state, @Nonnull BlockGetter worldIn, @Nonnull BlockPos pos, @Nonnull CollisionContext context) {
switch (state.getValue(FACING)) {
@ -89,5 +89,5 @@ public class BlockFluidCollector extends FullyDirectionalBlock.Container {
default:
return VoxelShapes.FluidCollectorShapes.SHAPE_N;
}
}
}*/
}

View file

@ -41,8 +41,8 @@ public class BlockItemInterface extends BlockContainerBase {
return level.isClientSide? TileEntityItemInterface::clientTick : TileEntityItemInterface::serverTick;
}
@Override
/* @Override
public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) {
return VoxelShapes.ITEM_VIEWER_SHAPE;
}
}*/
}

View file

@ -75,7 +75,7 @@ public class BlockLampController extends FullyDirectionalBlock {
}
}
@Override
/* @Override
public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) {
switch (state.getValue(FACING)) {
case EAST:
@ -87,5 +87,5 @@ public class BlockLampController extends FullyDirectionalBlock {
default:
return VoxelShapes.LampPowererShapes.SHAPE_N;
}
}
}*/
}

View file

@ -72,7 +72,7 @@ public class BlockLavaFactoryController extends DirectionalBlock.Container imple
}
}
@Override
/* @Override
public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) {
switch (state.getValue(FACING)) {
case EAST:
@ -84,5 +84,5 @@ public class BlockLavaFactoryController extends DirectionalBlock.Container imple
default:
return VoxelShapes.LavaFactoryShapes.SHAPE_N;
}
}
}*/
}

View file

@ -44,7 +44,7 @@ public class BlockLeafGenerator extends DirectionalBlock.Container {
return level.isClientSide? TileEntityLeafGenerator::clientTick : TileEntityLeafGenerator::serverTick;
}
@Override
/* @Override
public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) {
switch (state.getValue(FACING)) {
case EAST:
@ -56,5 +56,5 @@ public class BlockLeafGenerator extends DirectionalBlock.Container {
default:
return VoxelShapes.LeafGeneratorShapes.SHAPE_N;
}
}
}*/
}

View file

@ -55,7 +55,7 @@ public class BlockLongRangeBreaker extends FullyDirectionalBlock.Container {
return this.openGui(world, player, pos, TileEntityLongRangeBreaker.class);
}
@Override
/* @Override
public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) {
switch (state.getValue(FACING)) {
case UP:
@ -71,5 +71,5 @@ public class BlockLongRangeBreaker extends FullyDirectionalBlock.Container {
default:
return VoxelShapes.BlockBreakerShapes.SHAPE_N;
}
}
}*/
}

View file

@ -76,7 +76,7 @@ public class BlockOilGenerator extends DirectionalBlock.Container {
return InteractionResult.SUCCESS;
}
@Override
/* @Override
public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) {
switch (state.getValue(FACING)) {
case EAST:
@ -88,5 +88,10 @@ public class BlockOilGenerator extends DirectionalBlock.Container {
default:
return VoxelShapes.OilGeneratorShapes.SHAPE_N;
}
}*/
@Override
public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) {
return VoxelShapes.SIMPLE_GENERATOR_SHAPE;
}
}

View file

@ -87,8 +87,8 @@ public class BlockPlayerInterface extends BlockContainerBase implements IHudDisp
}
}
@Override
/* @Override
public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) {
return VoxelShapes.PLAYER_INTERFACE_SHAPE;
}
}*/
}

View file

@ -96,7 +96,7 @@ public class BlockPoweredFurnace extends DirectionalBlock.Container {
tooltip.add(Component.translatable("tooltip.actuallyadditions.previouslyDoubleFurnace").withStyle(ChatFormatting.ITALIC));
}
@Override
/* @Override
public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) {
switch (state.getValue(HORIZONTAL_FACING)) {
case EAST:
@ -108,5 +108,5 @@ public class BlockPoweredFurnace extends DirectionalBlock.Container {
default:
return VoxelShapes.FurnaceDoubleShapes.SHAPE_N;
}
}
}*/
}

View file

@ -55,8 +55,8 @@ public class BlockRangedCollector extends BlockContainerBase {
return this.openGui(world, player, pos, TileEntityRangedCollector.class);
}
@Override
/* @Override
public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) {
return VoxelShapes.COLLECTOR_SHAPE;
}
}*/
}

View file

@ -76,7 +76,7 @@ public class BlockVerticalDigger extends DirectionalBlock.Container implements I
}
}
@Override
/* @Override
public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) {
switch (state.getValue(FACING)) {
case NORTH:
@ -90,5 +90,5 @@ public class BlockVerticalDigger extends DirectionalBlock.Container implements I
default:
return VoxelShapes.MinerShapes.SHAPE_N;
}
}
}*/
}

View file

@ -50,8 +50,8 @@ public class BlockXPSolidifier extends DirectionalBlock.Container {
return this.openGui(worldIn, player, pos, TileEntityXPSolidifier.class);
}
@Override
/* @Override
public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) {
return VoxelShapes.SOLIDIFIER_SHAPE;
}
}*/
}

View file

@ -257,11 +257,12 @@ public class VoxelShapes {
).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get();
static final VoxelShape ITEM_VIEWER_SHAPE = Stream.of(Block.box(15, 0, 1, 16, 1, 15), Block.box(1, 1, 1, 15, 15, 15), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 0, 1, 1, 1, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get();
static final VoxelShape HOPPING_ITEM_VIEWER_SHAPE = Stream.of(Block.box(0, 10, 0, 16, 11, 16), Block.box(1, 11, 1, 2, 15, 15), Block.box(14, 11, 1, 15, 15, 15), Block.box(2, 11, 1, 14, 15, 2), Block.box(2, 11, 14, 14, 15, 15), Block.box(4, 4, 4, 12, 10, 12), Block.box(6, 0, 6, 10, 4, 10), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(15, 15, 1, 16, 16, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 11, 0, 1, 15, 1), Block.box(0, 11, 15, 1, 15, 16), Block.box(15, 11, 15, 16, 15, 16), Block.box(15, 11, 0, 16, 15, 1)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get();
static final VoxelShape BOOSTER_SHAPE = Stream.of(
/* static final VoxelShape BOOSTER_SHAPE = Stream.of(
Block.box(6, 3, 6, 10, 16, 10),
Block.box(5, 14, 5, 11, 15, 11),
Block.box(5, 0, 5, 11, 3, 11)
).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get();
).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get();*/
static final VoxelShape BOOSTER_SHAPE = Block.box(5, 0 , 5, 11, 16, 11); //Simplified
static final VoxelShape PLAYER_INTERFACE_SHAPE = Stream.of(Block.box(15, 0, 1, 16, 1, 15), Block.box(1, 1, 1, 15, 15, 15), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 0, 1, 1, 1, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get();
static final VoxelShape COLLECTOR_SHAPE = Stream.of(Block.box(0, 0, 0, 1, 1, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(15, 0, 0, 16, 1, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(0, 15, 0, 1, 16, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(1, 1, 4, 2, 4, 12), Block.box(14, 1, 4, 15, 4, 12), Block.box(4, 1, 1, 12, 4, 2), Block.box(4, 1, 14, 12, 4, 15), Block.box(4, 14, 12, 12, 15, 14), Block.box(1, 12, 4, 2, 15, 12), Block.box(14, 12, 4, 15, 15, 12), Block.box(4, 12, 1, 12, 15, 2), Block.box(4, 12, 14, 12, 15, 15), Block.box(4, 14, 2, 12, 15, 4), Block.box(1, 1, 12, 2, 15, 14), Block.box(14, 1, 2, 15, 15, 4), Block.box(1, 1, 1, 4, 15, 2), Block.box(12, 1, 14, 15, 15, 15), Block.box(12, 14, 2, 14, 15, 14), Block.box(1, 1, 2, 2, 15, 4), Block.box(14, 1, 12, 15, 15, 14), Block.box(12, 1, 1, 15, 15, 2), Block.box(1, 1, 14, 4, 15, 15), Block.box(2, 14, 2, 4, 15, 14), Block.box(2, 2, 2, 14, 14, 14), Block.box(1, 0, 1, 15, 1, 15)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get();
static final VoxelShape SUPPRESSOR_SHAPE = Stream.of(
@ -298,6 +299,14 @@ public class VoxelShapes {
static final VoxelShape WEST = Stream.of(Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(2, 0, 2, 14, 1, 14), Block.box(6, 14, 5, 7, 15, 11), Block.box(8, 14, 5, 9, 15, 11), Block.box(10, 14, 5, 14, 15, 11), Block.box(2, 14, 5, 5, 15, 11), Block.box(2, 14, 2, 14, 15, 5), Block.box(2, 14, 11, 14, 15, 14), Block.box(2, 0, 14, 14, 15, 15), Block.box(2, 0, 1, 14, 15, 2), Block.box(14, 0, 1, 15, 15, 15), Block.box(0, 11, 3, 1, 12, 13), Block.box(1, 3, 10, 2, 8, 11), Block.box(1, 3, 5, 2, 8, 6), Block.box(1, 8, 3, 2, 15, 13), Block.box(1, 0, 3, 2, 3, 13), Block.box(1, 0, 13, 2, 15, 15), Block.box(1, 0, 1, 2, 15, 3), Block.box(5, 13, 5, 10, 14, 11), Block.box(2, 3, 2, 3, 8, 14), Block.box(15, 0, 15, 16, 1, 16), Block.box(15, 0, 0, 16, 1, 1), Block.box(0, 0, 0, 1, 1, 1), Block.box(0, 0, 15, 1, 1, 16)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get();
}
static final VoxelShape SIMPLE_GENERATOR_SHAPE = Stream.of(
Block.box(0, 1, 0, 16, 16, 16),
Block.box(0, 0, 0, 1, 1, 1),
Block.box(0, 0, 15, 1, 1, 16),
Block.box(15, 0, 0, 16, 1, 1),
Block.box(15, 0, 15, 16, 1, 16)
).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get();
static class CoffeeMachineShapes {
static final VoxelShape NORTH = Stream.of(
Block.box(13, 2, 4, 14, 3, 5),

View file

@ -61,7 +61,7 @@ public class AllInOneTool extends DiggerItem {
return Items.IRON_SHOVEL.useOn(context);
}
InteractionResult tmp = Items.IRON_AXE.useOn(context);
if (tmp != InteractionResult.SUCCESS)
if (tmp == InteractionResult.SUCCESS)
return tmp;
return Items.IRON_HOE.useOn(context);
}

View file

@ -10,6 +10,7 @@
package de.ellpeck.actuallyadditions.mod.items;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.items.base.ItemEnergy;
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerPlayer;
@ -34,11 +35,15 @@ public class ItemTeleportStaff extends ItemEnergy {
ItemStack stack = player.getItemInHand(hand);
if (!world.isClientSide) {
HitResult rayTraceResult = player.pick(100,1F,false);
if (rayTraceResult.getType() == HitResult.Type.BLOCK || player.getXRot() >= -5) {
if (rayTraceResult.getType() == HitResult.Type.BLOCK || rayTraceResult.getType() == HitResult.Type.MISS) {
Vec3 location = rayTraceResult.getLocation();
Vec3 pos = Vec3.atBottomCenterOf(BlockPos.containing(location.x, location.y, location.z));
int baseUse = 200;
int use = baseUse + (int) (baseUse * player.blockPosition().distSqr(BlockPos.containing(pos.x, pos.y, pos.z)));
int use = baseUse + (int) (baseUse * Math.sqrt(player.blockPosition().distManhattan(BlockPos.containing(pos.x, pos.y, pos.z))));
ActuallyAdditions.LOGGER.info("Use: " + use + " Energy: " + this.getEnergyStored(stack));
ActuallyAdditions.LOGGER.info("Distance: " + Math.sqrt(player.blockPosition().distSqr(BlockPos.containing(pos.x, pos.y, pos.z))));
ActuallyAdditions.LOGGER.info("Player: " + player.blockPosition());
ActuallyAdditions.LOGGER.info("Pos: " + pos);
if (this.getEnergyStored(stack) >= use) {
((ServerPlayer) player).connection.teleport(pos.x, pos.y + 1F, pos.z, player.getYRot(), player.getXRot());
player.removeVehicle();