Skip to content

Commit

Permalink
misc easy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MBatt1 committed Jun 5, 2024
1 parent 8d9f22f commit 6d79be7
Show file tree
Hide file tree
Showing 35 changed files with 53 additions and 478 deletions.
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
package net.id.paradiselost.blocks;

import net.fabricmc.fabric.mixin.lookup.BlockEntityTypeAccessor;
import net.id.incubus_core.util.RegistryQueue;
import net.id.paradiselost.blocks.natural.ParadiseLostSaplingBlock;
import net.id.paradiselost.blocks.natural.tree.FruitingLeavesBlock;
import net.id.paradiselost.blocks.natural.tree.ParadiseLostLeavesBlock;
import net.id.paradiselost.items.ParadiseLostItems;
import net.id.paradiselost.mixin.util.SignTypeAccessor;
import net.id.paradiselost.registry.ParadiseLostRegistryQueues;
import net.id.paradiselost.util.ParadiseLostSignType;
import net.id.paradiselost.world.feature.tree.generator.MotherAurelSaplingGenerator;
import net.id.paradiselost.world.feature.tree.generator.OrangeSaplingGenerator;
import net.minecraft.block.*;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.block.sapling.SaplingGenerator;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.util.SignType;
import org.jetbrains.annotations.NotNull;

import java.util.Arrays;
Expand Down
10 changes: 4 additions & 6 deletions src/main/java/net/id/paradiselost/blocks/FloatingBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import net.id.paradiselost.api.FloatingBlockHelper;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.OreBlock;
import net.minecraft.block.RedstoneOreBlock;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
Expand All @@ -14,11 +12,11 @@
import net.minecraft.world.WorldAccess;

@SuppressWarnings("deprecation")
public class FloatingBlock extends RedstoneOreBlock {
public class FloatingBlock extends Block {
private final boolean powered;

public FloatingBlock(boolean powered, Settings properties, UniformIntProvider experienceDropped) {
super(properties, experienceDropped);
super(properties);
this.powered = powered;
}

Expand All @@ -28,12 +26,12 @@ public FloatingBlock(boolean powered, Settings properties) {

@Override
public void onBlockAdded(BlockState state, World worldIn, BlockPos posIn, BlockState oldState, boolean notify) {
worldIn.createAndScheduleBlockTick(posIn, this, this.getFallDelay());
worldIn.scheduleBlockTick(posIn, this, this.getFallDelay());
}

@Override
public BlockState getStateForNeighborUpdate(BlockState stateIn, Direction facingIn, BlockState facingState, WorldAccess worldIn, BlockPos posIn, BlockPos facingPosIn) {
worldIn.createAndScheduleBlockTick(posIn, this, this.getFallDelay());
worldIn.scheduleBlockTick(posIn, this, this.getFallDelay());
return super.getStateForNeighborUpdate(stateIn, facingIn, facingState, worldIn, posIn, facingPosIn);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
import net.minecraft.block.Block;
import net.minecraft.item.HoeItem;

import static net.id.incubus_core.util.RegistryQueue.Action;
import static net.id.incubus_core.util.RegistryQueue.onClient;

class ParadiseLostBlockActions {
protected static final AbstractBlock.ContextPredicate never = (state, view, pos) -> false;
protected static final AbstractBlock.ContextPredicate always = (state, view, pos) -> true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import net.id.paradiselost.blocks.natural.plant.*;
import net.id.paradiselost.blocks.natural.tree.*;
import net.id.paradiselost.fluids.ParadiseLostFluids;
import net.id.paradiselost.registry.ParadiseLostRegistryQueues;
import net.id.paradiselost.tag.ParadiseLostBlockTags;
import net.id.paradiselost.world.feature.tree.generator.*;
import net.minecraft.block.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

import net.id.paradiselost.blocks.ParadiseLostBlocks;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.util.registry.Registry;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;

import static net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder.create;
import static net.id.paradiselost.ParadiseLost.locate;
Expand All @@ -24,6 +25,6 @@ public static void init() {
}

private static void register(String name, BlockEntityType<?> type) {
Registry.register(Registry.BLOCK_ENTITY_TYPE, locate(name), type);
Registry.register(Registries.BLOCK_ENTITY_TYPE, locate(name), type);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
import net.minecraft.inventory.SidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.network.Packet;
import net.minecraft.network.listener.ClientPlayPacketListener;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket;
import net.minecraft.screen.ScreenHandler;
import net.minecraft.server.world.ServerWorld;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.HayBlock;
import net.minecraft.entity.Entity;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.sound.SoundCategory;
Expand All @@ -16,7 +17,7 @@ public FlaxweaveCushionBlock(Settings settings) {

@Override
public void onLandedUpon(World world, BlockState state, BlockPos pos, Entity entity, float fallDistance) {
entity.handleFallDamage(fallDistance, 0.1F, DamageSource.FALL); // cancel most fall damage
entity.handleFallDamage(fallDistance, 0.1F, world.getDamageSources().fall()); // cancel most fall damage
if (fallDistance > 3F && !world.isClient) {
this.spawnBreakParticles(world, null, pos, state); // spawn particles
world.playSound(null, pos, soundGroup.getHitSound(), SoundCategory.BLOCKS, 0.7F, 1.0F); // and play cushion sound
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEnt

@Override
public @Nullable BlockState getPlacementState(ItemPlacementContext ctx) {
return getDefaultState().with(AXIS, ctx.getPlayerFacing().getAxis());
return getDefaultState().with(AXIS, ctx.getPlayerLookDirection().getAxis());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ public NitraBlock(Settings settings) {
public void onBlockAdded(BlockState state, World world, BlockPos pos, BlockState oldState, boolean notify) {
if (!oldState.isOf(state.getBlock())) {
if (world.isReceivingRedstonePower(pos)) {
world.createAndScheduleBlockTick(pos, this, 1);
world.scheduleBlockTick(pos, this, 1);
}

}
}

public void neighborUpdate(BlockState state, World world, BlockPos pos, Block sourceBlock, BlockPos sourcePos, boolean notify) {
if (world.isReceivingRedstonePower(pos)) {
world.createAndScheduleBlockTick(pos, this, 1);
world.scheduleBlockTick(pos, this, 1);
}

}
Expand All @@ -69,7 +69,7 @@ public static void ignite(World world, BlockPos pos, float power) {
}

private static void ignite(World world, BlockPos pos, float power, @Nullable LivingEntity igniter) {
Explosion explosion = new Explosion(world, igniter, null, null, pos.getX(), pos.getY() + 0.5D, pos.getZ(), power, false, Explosion.DestructionType.BREAK);
Explosion explosion = new Explosion(world, igniter, null, null, pos.getX(), pos.getY() + 0.5D, pos.getZ(), power, false, Explosion.DestructionType.DESTROY);
System.out.println(world.isClient);
if (!world.isClient) {
explosion.collectBlocksAndDamageEntities();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
import net.id.paradiselost.world.feature.placed_features.ParadiseLostVegetationPlacedFeatures;
import net.minecraft.block.BlockState;
import net.minecraft.block.Fertilizable;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.random.Random;
import net.minecraft.util.registry.RegistryEntry;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraft.world.WorldView;
import net.minecraft.world.gen.feature.ConfiguredFeature;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public float getAmbientOcclusionLightLevel(BlockState state, BlockView worldIn,
}

@Override
public boolean isTranslucent(BlockState state, BlockView reader, BlockPos pos) {
public boolean isTransparent(BlockState state, BlockView reader, BlockPos pos) {
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public BlackcurrantBushBlock(Settings settings) {
}

@Override
public boolean isTranslucent(BlockState state, BlockView world, BlockPos pos) {
public boolean isTransparent(BlockState state, BlockView world, BlockPos pos) {
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class SwedrootCropBlock extends CropBlock {
};

public SwedrootCropBlock(Settings settings) {
super(settings.offsetType(OffsetType.XZ));
super(settings.offset(OffsetType.XZ));
}

@Override
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@ public void onEntityCollision(BlockState state, World world, BlockPos pos, Entit
}
}

@Override
public void onLandedUpon(World world, BlockState state, BlockPos pos, Entity entity, float fallDistance) {
entity.handleFallDamage(fallDistance, 0.5F, DamageSource.FALL);
}

@Override
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
return SHAPE;
Expand Down
Loading

0 comments on commit 6d79be7

Please sign in to comment.