Skip to content

Commit

Permalink
Merge pull request #280 from DaFuqs/1.19-deeper-down
Browse files Browse the repository at this point in the history
sync
  • Loading branch information
Azzyypaaras authored Nov 19, 2023
2 parents 9fd8aeb + c26bf40 commit d6bcc5f
Show file tree
Hide file tree
Showing 123 changed files with 1,397 additions and 764 deletions.
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ org.gradle.jvmargs=-Xmx2G
# Fabric Properties
minecraft_version=1.19.2
yarn_mappings=1.19.2+build.28
loader_version=0.14.21
loader_version=0.14.24

# Mod Properties
mod_version=1.7.0
maven_group=de.dafuqs.spectrum
archives_base_name=spectrum-1.7.0-deeper-down-alpha22
archives_base_name=spectrum-1.7.0-deeper-down

# Dependencies
# https://fabricmc.net/develop/
fabric_version=0.76.0+1.19.2
fabric_version=0.76.1+1.19.2
cloth_config_version=8.2.88
modmenu_version=4.0.6
rei_version=9.1.595
Expand Down
29 changes: 18 additions & 11 deletions src/main/java/de/dafuqs/spectrum/blocks/DeeperDownPortalBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,30 +31,30 @@ public class DeeperDownPortalBlock extends Block {
private final static String CREATE_PORTAL_ADVANCEMENT_CRITERION = "opened_deeper_down_portal";

public static final BooleanProperty FACING_UP = Properties.UP;

protected static final VoxelShape SHAPE = Block.createCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 4D, 16.0D);
protected static final VoxelShape SHAPE_UP = Block.createCuboidShape(0.0D, 4D, 0.0D, 16.0D, 16.0D, 16.0D);

public DeeperDownPortalBlock(Settings settings) {
super(settings);
this.setDefaultState((this.stateManager.getDefaultState()).with(FACING_UP, false));
}

@Override
public boolean hasSidedTransparency(BlockState state) {
return true;
}

@Override
@SuppressWarnings("deprecation")
public void onBlockAdded(BlockState state, World world, BlockPos pos, BlockState oldState, boolean notify) {
super.onBlockAdded(state, world, pos, oldState, notify);

if (!world.isClient) { // that should be a given, but in modded you never know
SpectrumS2CPacketSender.playParticleWithRandomOffsetAndVelocity((ServerWorld) world, Vec3d.ofCenter(pos), SpectrumParticleTypes.VOID_FOG, 30, new Vec3d(0.5, 0.0, 0.5), Vec3d.ZERO);
if (!hasNeighboringPortals(world, pos)) {
world.playSound(null, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, SpectrumSoundEvents.DEEPER_DOWN_PORTAL_OPEN, SoundCategory.BLOCKS, 0.75F, 0.75F);

for (PlayerEntity nearbyPlayer : world.getEntitiesByType(EntityType.PLAYER, Box.of(Vec3d.ofCenter(pos), 16D, 16D, 16D), LivingEntity::isAlive)) {
Support.grantAdvancementCriterion((ServerPlayerEntity) nearbyPlayer, CREATE_PORTAL_ADVANCEMENT_IDENTIFIER, CREATE_PORTAL_ADVANCEMENT_CRITERION);
}
Expand Down Expand Up @@ -114,12 +114,12 @@ public void onEntityCollision(BlockState state, World world, BlockPos pos, Entit
&& !entity.hasVehicle()
&& !entity.hasPassengers()
&& entity.canUsePortals()) {

RegistryKey<World> currentWorldKey = world.getRegistryKey();
if (currentWorldKey == World.OVERWORLD) {
if (!entity.hasPortalCooldown()) {
entity.resetPortalCooldown();

// => teleport to DD
ServerWorld targetWorld = ((ServerWorld) world).getServer().getWorld(SpectrumDimensions.DIMENSION_KEY);
if (targetWorld != null) {
Expand Down Expand Up @@ -170,13 +170,20 @@ public void makeRoomAround(World world, BlockPos blockPos, int radius) {
}

state = world.getBlockState(pos);
if (state.getBlock() instanceof DeeperDownPortalBlock) {

if (state.isOf(Blocks.BEDROCK)) {
if (pos.getX() == blockPos.getX() && pos.getZ() == blockPos.getZ()) {
world.breakBlock(pos, true, null);
}
continue;
}

float hardness = state.getHardness(world, pos);
if ((pos.getX() == blockPos.getX() && pos.getZ() == blockPos.getZ()) || (hardness >= 0 && hardness < 30)) {
if (!state.isIn(SpectrumBlockTags.BASE_STONE_DEEPER_DOWN)) {
continue;
}

float hardness = state.getHardness(world, pos);
if (hardness >= 0 && hardness < 30) {
world.breakBlock(pos, true, null);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class PrimordialFireBlock extends AbstractFireBlock {
private static final VoxelShape SOUTH_SHAPE = Block.createCuboidShape(0.0, 0.0, 15.0, 16.0, 16.0, 16.0);

private final Map<BlockState, VoxelShape> shapesByState;
private static final float DAMAGE = 4.0F;
private static final float DAMAGE = 0.2F;

public PrimordialFireBlock(Settings settings) {
super(settings, DAMAGE);
Expand Down Expand Up @@ -109,10 +109,10 @@ public BlockState getStateForPosition(BlockView world, BlockPos pos) {

@Override
public void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity) {
if (!entity.isFireImmune() && entity instanceof LivingEntity livingEntity) {
if (entity instanceof LivingEntity livingEntity) {
OnPrimordialFireComponent.addPrimordialFireTicks(livingEntity, 5);
}

entity.damage(SpectrumDamageSources.PRIMORDIAL_FIRE, DAMAGE);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,13 @@ public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random
if (j == 7) {
// consume 1 block close to the reed when growing.
// if the quitoxic reeds are growing in liquid crystal: 1/4 chance to consume
// search for block it could be planted on. 1 block => 1 quitoxic reed
Optional<BlockPos> plantablePos = searchPlantablePos(world, pos.down(i), SpectrumBlockTags.QUITOXIC_REEDS_PLANTABLE, random);
if (plantablePos.isEmpty() || world.getBlockState(plantablePos.get().up()).getBlock() instanceof QuitoxicReedsBlock) {
return;
}

if (!bottomLiquidCrystalLogged || random.nextInt(4) == 0) {
// search for block it could be planted on. 1 block => 1 quitoxic reed
Optional<BlockPos> plantablePos = searchPlantablePos(world, pos.down(i), SpectrumBlockTags.QUITOXIC_REEDS_PLANTABLE, random);
if (plantablePos.isEmpty() || world.getBlockState(plantablePos.get().up()).getBlock() instanceof QuitoxicReedsBlock) {
return;
}
world.setBlockState(plantablePos.get(), Blocks.DIRT.getDefaultState(), 3);
world.playSound(null, plantablePos.get(), SoundEvents.BLOCK_GRAVEL_BREAK, SoundCategory.BLOCKS, 1.0F, 1.0F);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ protected static void explode(World world, BlockPos pos, BlockState state) {
world.removeBlock(pos, false);
world.createExplosion(null, SpectrumDamageSources.INCANDESCENCE, new ExplosionBehavior(), pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 3.0F, true, Explosion.DestructionType.DESTROY);
if (!world.isClient) {
dropStack(world, pos, new ItemStack(SpectrumItems.DOOMBLOOM_SEED, world.random.nextBetween(2, 4)));
dropStack(world, pos, new ItemStack(SpectrumItems.DOOMBLOOM_SEED, world.random.nextBetween(3, 7)));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ public static boolean spreadBlackMateria(World world, BlockPos pos, Random rando
}
return replacedAny;
}

@Override
protected int getFallDelay() {
return 20;
}

@Override
public boolean hasRandomTicks(BlockState state) {
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/de/dafuqs/spectrum/blocks/decay/DecayBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public void neighborUpdate(BlockState state, World world, BlockPos pos, Block pr
Block updatedBlock = updatedState.getBlock();

if (!(updatedBlock instanceof DecayBlock) && !(updatedBlock instanceof DecayAwayBlock)) {
@Nullable BlockState spreadState = this.getSpreadState(state, updatedState);
@Nullable BlockState spreadState = this.getSpreadState(state, updatedState, world, fromPos);
if (spreadState != null) {
world.createAndScheduleBlockTick(pos, this, 40 + world.random.nextInt(200), TickPriority.EXTREMELY_LOW);
}
Expand Down Expand Up @@ -157,7 +157,7 @@ protected boolean trySpreadInDirection(@NotNull World world, BlockState state, @
BlockState targetBlockState = world.getBlockState(targetPos);

if (canSpreadTo(world, targetPos, targetBlockState)) {
@Nullable BlockState spreadState = this.getSpreadState(state, targetBlockState);
@Nullable BlockState spreadState = this.getSpreadState(state, targetBlockState, world, targetPos);
if (spreadState != null) {
world.setBlockState(targetPos, spreadState);
}
Expand All @@ -166,6 +166,6 @@ protected boolean trySpreadInDirection(@NotNull World world, BlockState state, @
return false;
}

protected abstract @Nullable BlockState getSpreadState(BlockState stateToSpreadFrom, BlockState stateToSpreadTo);
protected abstract @Nullable BlockState getSpreadState(BlockState stateToSpreadFrom, BlockState stateToSpreadTo, World world, BlockPos stateToSpreadToPos);

}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void onPlaced(World world, BlockPos pos, BlockState state, @Nullable Livi
}

@Override
protected @Nullable BlockState getSpreadState(BlockState stateToSpreadFrom, BlockState stateToSpreadTo) {
protected @Nullable BlockState getSpreadState(BlockState stateToSpreadFrom, BlockState stateToSpreadTo, World world, BlockPos stateToSpreadToPos) {
if (stateToSpreadTo.isIn(SpectrumBlockTags.FADING_SPECIAL_CONVERSIONS)) {
return stateToSpreadFrom.with(CONVERSION, Conversion.SPECIAL);
} else if (stateToSpreadTo.isIn(SpectrumBlockTags.FADING_CONVERSIONS)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ protected void appendProperties(StateManager.Builder<Block, BlockState> stateMan
}

@Override
protected @Nullable BlockState getSpreadState(BlockState stateToSpreadFrom, BlockState stateToSpreadTo) {
protected @Nullable BlockState getSpreadState(BlockState stateToSpreadFrom, BlockState stateToSpreadTo, World world, BlockPos stateToSpreadToPos) {
if (stateToSpreadFrom.get(AGE) >= Properties.AGE_15_MAX) {
return null;
}
if (stateToSpreadTo.isAir() || stateToSpreadTo.getBlock() instanceof FluidBlock || stateToSpreadTo.isIn(SpectrumBlockTags.FAILING_SAFE)) {
if (stateToSpreadTo.getCollisionShape(world, stateToSpreadToPos).isEmpty() || stateToSpreadTo.isIn(SpectrumBlockTags.FAILING_SAFE)) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ public PistonBehavior getPistonBehavior(BlockState state) {
}

@Override
protected @Nullable BlockState getSpreadState(BlockState stateToSpreadFrom, BlockState stateToSpreadTo) {
if (stateToSpreadTo.isIn(SpectrumBlockTags.FORFEITURE_SAFE) || stateToSpreadTo.getBlock() instanceof FluidBlock) {
protected @Nullable BlockState getSpreadState(BlockState stateToSpreadFrom, BlockState stateToSpreadTo, World world, BlockPos stateToSpreadToPos) {
if (stateToSpreadTo.isIn(SpectrumBlockTags.FORFEITURE_SAFE)) {
return null;
}

if (stateToSpreadTo.isIn(SpectrumBlockTags.FORFEITURE_SPECIAL_CONVERSIONS)) {
return this.getDefaultState().with(CONVERSION, Conversion.SPECIAL);
} else if (stateToSpreadTo.isIn(SpectrumBlockTags.FORFEITURE_CONVERSIONS)) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/de/dafuqs/spectrum/blocks/decay/RuinBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ public PistonBehavior getPistonBehavior(BlockState state) {
}

@Override
protected @Nullable BlockState getSpreadState(BlockState stateToSpreadFrom, BlockState stateToSpreadTo) {
if (stateToSpreadTo.isAir() || stateToSpreadTo.getBlock() instanceof FluidBlock || stateToSpreadTo.isIn(SpectrumBlockTags.RUIN_SAFE)) {
protected @Nullable BlockState getSpreadState(BlockState stateToSpreadFrom, BlockState stateToSpreadTo, World world, BlockPos stateToSpreadToPos) {
if (stateToSpreadTo.getCollisionShape(world, stateToSpreadToPos).isEmpty() || stateToSpreadTo.isIn(SpectrumBlockTags.RUIN_SAFE)) {
return null;
}

Expand Down
Loading

0 comments on commit d6bcc5f

Please sign in to comment.