Migrate off of deprecated APIs
This commit is contained in:
parent
fb457d1b37
commit
735e79ea78
@ -39,5 +39,4 @@ public class Templates implements ModInitializer {
|
||||
Registry.register(Registry.ITEM, new Identifier(MODID, name), item);
|
||||
return item;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package io.github.cottonmc.templates.block;
|
||||
|
||||
import io.github.cottonmc.templates.block.entity.SlopeEntity;
|
||||
import net.fabricmc.fabric.api.block.FabricBlockSettings;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.entity.EntityContext;
|
||||
@ -27,7 +27,7 @@ public class SlopeBlock extends TemplateBlock {
|
||||
public static final VoxelShape WEST = VoxelShapes.cuboid(0f, 0.5f, 0f, 0.5f, 1f, 1f);
|
||||
|
||||
public SlopeBlock() {
|
||||
super(FabricBlockSettings.of(Material.WOOD).build());
|
||||
super(FabricBlockSettings.of(Material.WOOD));
|
||||
this.setDefaultState(this.getStateManager().getDefaultState().with(FACING, Direction.NORTH).with(LIGHT, 0).with(REDSTONE, false));
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
package io.github.cottonmc.templates.block.entity;
|
||||
|
||||
import net.fabricmc.fabric.api.block.entity.BlockEntityClientSerializable;
|
||||
import net.fabricmc.fabric.api.networking.v1.PlayerLookup;
|
||||
import net.fabricmc.fabric.api.rendering.data.v1.RenderAttachmentBlockEntity;
|
||||
import net.fabricmc.fabric.api.server.PlayerStream;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
@ -18,7 +18,7 @@ public abstract class TemplateEntity extends BlockEntity implements BlockEntityC
|
||||
protected BlockState renderedState = Blocks.AIR.getDefaultState();
|
||||
protected boolean glowstone = false;
|
||||
protected boolean redstone = false;
|
||||
private Block baseBlock;
|
||||
private final Block baseBlock;
|
||||
|
||||
public TemplateEntity(BlockEntityType<?> type, Block baseBlock) {
|
||||
super(type);
|
||||
@ -71,8 +71,7 @@ public abstract class TemplateEntity extends BlockEntity implements BlockEntityC
|
||||
public void markDirty() {
|
||||
super.markDirty();
|
||||
if (world != null && !world.isClient) {
|
||||
for (Object obj : PlayerStream.watching(this).toArray()) {
|
||||
ServerPlayerEntity player = (ServerPlayerEntity) obj;
|
||||
for(ServerPlayerEntity player : PlayerLookup.tracking(this)) {
|
||||
player.networkHandler.sendPacket(this.toUpdatePacket());
|
||||
}
|
||||
world.updateNeighborsAlways(pos.offset(Direction.UP), baseBlock);
|
||||
|
@ -4,7 +4,6 @@ import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.client.texture.MissingSprite;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
||||
import net.fabricmc.fabric.api.renderer.v1.model.ModelHelper;
|
||||
|
Loading…
Reference in New Issue
Block a user