Fixed issue with sodium
This commit is contained in:
parent
c949652e99
commit
2e8564a26c
2 changed files with 46 additions and 25 deletions
|
@ -2,17 +2,24 @@ package ru.betterend.blocks;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.MaterialColor;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.state.StateManager;
|
||||
import net.minecraft.state.property.BooleanProperty;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldAccess;
|
||||
import ru.betterend.blocks.basis.BlockBase;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
|
@ -29,6 +36,32 @@ public class BrimstoneBlock extends BlockBase {
|
|||
protected void appendProperties(StateManager.Builder<Block, BlockState> stateManager) {
|
||||
stateManager.add(ACTIVATED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlaced(World world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack itemStack) {
|
||||
if (world.isClient()) {
|
||||
updateChunks((ClientWorld) world, pos);
|
||||
}
|
||||
}
|
||||
|
||||
public void onBroken(WorldAccess world, BlockPos pos, BlockState state) {
|
||||
if (world.isClient()) {
|
||||
updateChunks((ClientWorld) world, pos);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateChunks(ClientWorld world, BlockPos pos) {
|
||||
int y = pos.getY() >> 4;
|
||||
int x1 = (pos.getX() - 2) >> 4;
|
||||
int z1 = (pos.getZ() - 2) >> 4;
|
||||
int x2 = (pos.getX() + 2) >> 4;
|
||||
int z2 = (pos.getZ() + 2) >> 4;
|
||||
for (int x = x1; x <= x2; x++) {
|
||||
for (int z = z1; z <= z2; z++) {
|
||||
world.scheduleBlockRenders(x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue