Misc deprecation fixes.
This commit is contained in:
parent
d0bdf744cf
commit
23375b5cd3
13 changed files with 28 additions and 27 deletions
|
@ -31,7 +31,7 @@ import net.fabricmc.fabric.api.client.item.v1.ItemTooltipCallback;
|
||||||
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback;
|
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback;
|
||||||
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents;
|
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents;
|
||||||
import net.fabricmc.fabric.api.event.client.ClientSpriteRegistryCallback;
|
import net.fabricmc.fabric.api.event.client.ClientSpriteRegistryCallback;
|
||||||
import net.minecraft.client.texture.SpriteAtlasTexture;
|
import net.minecraft.screen.PlayerScreenHandler;
|
||||||
import reborncore.api.blockentity.UnloadHandler;
|
import reborncore.api.blockentity.UnloadHandler;
|
||||||
import reborncore.client.*;
|
import reborncore.client.*;
|
||||||
import reborncore.common.screen.ScreenIcons;
|
import reborncore.common.screen.ScreenIcons;
|
||||||
|
@ -44,7 +44,7 @@ public class RebornCoreClient implements ClientModInitializer {
|
||||||
public void onInitializeClient() {
|
public void onInitializeClient() {
|
||||||
RebornFluidRenderManager.setupClient();
|
RebornFluidRenderManager.setupClient();
|
||||||
HolidayRenderManager.setupClient();
|
HolidayRenderManager.setupClient();
|
||||||
ClientSpriteRegistryCallback.event(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE).register((atlasTexture, registry) -> {
|
ClientSpriteRegistryCallback.event(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE).register((atlasTexture, registry) -> {
|
||||||
registry.register(ScreenIcons.HEAD);
|
registry.register(ScreenIcons.HEAD);
|
||||||
registry.register(ScreenIcons.CHEST);
|
registry.register(ScreenIcons.CHEST);
|
||||||
registry.register(ScreenIcons.LEGS);
|
registry.register(ScreenIcons.LEGS);
|
||||||
|
|
|
@ -34,6 +34,7 @@ import net.minecraft.client.texture.SpriteAtlasTexture;
|
||||||
import net.minecraft.fluid.Fluid;
|
import net.minecraft.fluid.Fluid;
|
||||||
import net.minecraft.resource.ResourceManager;
|
import net.minecraft.resource.ResourceManager;
|
||||||
import net.minecraft.resource.ResourceType;
|
import net.minecraft.resource.ResourceType;
|
||||||
|
import net.minecraft.screen.PlayerScreenHandler;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import reborncore.common.fluid.FluidSettings;
|
import reborncore.common.fluid.FluidSettings;
|
||||||
import reborncore.common.fluid.RebornFluid;
|
import reborncore.common.fluid.RebornFluid;
|
||||||
|
@ -52,7 +53,7 @@ public class RebornFluidRenderManager implements ClientSpriteRegistryCallback, S
|
||||||
|
|
||||||
public static void setupClient() {
|
public static void setupClient() {
|
||||||
RebornFluidRenderManager rebornFluidRenderManager = new RebornFluidRenderManager();
|
RebornFluidRenderManager rebornFluidRenderManager = new RebornFluidRenderManager();
|
||||||
ClientSpriteRegistryCallback.event(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE).register(rebornFluidRenderManager);
|
ClientSpriteRegistryCallback.event(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE).register(rebornFluidRenderManager);
|
||||||
ResourceManagerHelper.get(ResourceType.CLIENT_RESOURCES).registerReloadListener(rebornFluidRenderManager);
|
ResourceManagerHelper.get(ResourceType.CLIENT_RESOURCES).registerReloadListener(rebornFluidRenderManager);
|
||||||
RebornFluidManager.getFluidStream().forEach(RebornFluidRenderManager::setupFluidRenderer);
|
RebornFluidManager.getFluidStream().forEach(RebornFluidRenderManager::setupFluidRenderer);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ import net.minecraft.client.texture.SpriteAtlasTexture;
|
||||||
import net.minecraft.client.texture.TextureManager;
|
import net.minecraft.client.texture.TextureManager;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.fluid.Fluid;
|
import net.minecraft.fluid.Fluid;
|
||||||
|
import net.minecraft.screen.PlayerScreenHandler;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import reborncore.common.fluid.FluidValue;
|
import reborncore.common.fluid.FluidValue;
|
||||||
|
@ -44,14 +45,12 @@ import reborncore.common.util.Tank;
|
||||||
* Created by Gigabit101 on 08/08/2016.
|
* Created by Gigabit101 on 08/08/2016.
|
||||||
*/
|
*/
|
||||||
public class RenderUtil {
|
public class RenderUtil {
|
||||||
public static final Identifier BLOCK_TEX = SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE;
|
|
||||||
|
|
||||||
public static TextureManager engine() {
|
public static TextureManager engine() {
|
||||||
return MinecraftClient.getInstance().getTextureManager();
|
return MinecraftClient.getInstance().getTextureManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void bindBlockTexture() {
|
public static void bindBlockTexture() {
|
||||||
RenderSystem.setShaderTexture(0, BLOCK_TEX);
|
RenderSystem.setShaderTexture(0, PlayerScreenHandler.BLOCK_ATLAS_TEXTURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Sprite getStillTexture(FluidInstance fluid) {
|
public static Sprite getStillTexture(FluidInstance fluid) {
|
||||||
|
@ -62,7 +61,7 @@ public class RenderUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Sprite getSprite(Identifier identifier) {
|
public static Sprite getSprite(Identifier identifier) {
|
||||||
return MinecraftClient.getInstance().getSpriteAtlas(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE).apply(identifier);
|
return MinecraftClient.getInstance().getSpriteAtlas(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE).apply(identifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Sprite getStillTexture(Fluid fluid) {
|
public static Sprite getStillTexture(Fluid fluid) {
|
||||||
|
|
|
@ -33,8 +33,8 @@ import net.minecraft.client.render.Tessellator;
|
||||||
import net.minecraft.client.render.VertexConsumerProvider;
|
import net.minecraft.client.render.VertexConsumerProvider;
|
||||||
import net.minecraft.client.render.block.BlockRenderManager;
|
import net.minecraft.client.render.block.BlockRenderManager;
|
||||||
import net.minecraft.client.render.model.BakedModel;
|
import net.minecraft.client.render.model.BakedModel;
|
||||||
import net.minecraft.client.texture.SpriteAtlasTexture;
|
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
|
import net.minecraft.screen.PlayerScreenHandler;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Direction;
|
import net.minecraft.util.math.Direction;
|
||||||
import net.minecraft.util.math.Quaternion;
|
import net.minecraft.util.math.Quaternion;
|
||||||
|
@ -74,7 +74,7 @@ public class FluidConfigPopupElement extends ElementBase {
|
||||||
BlockState actualState = state.getBlock().getDefaultState();
|
BlockState actualState = state.getBlock().getDefaultState();
|
||||||
BlockRenderManager dispatcher = MinecraftClient.getInstance().getBlockRenderManager();
|
BlockRenderManager dispatcher = MinecraftClient.getInstance().getBlockRenderManager();
|
||||||
BakedModel model = dispatcher.getModels().getModel(state.getBlock().getDefaultState());
|
BakedModel model = dispatcher.getModels().getModel(state.getBlock().getDefaultState());
|
||||||
MinecraftClient.getInstance().getTextureManager().bindTexture(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE);
|
MinecraftClient.getInstance().getTextureManager().bindTexture(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE);
|
||||||
drawState(gui, world, model, actualState, pos, dispatcher, 4, 23, Vec3f.POSITIVE_Y.getDegreesQuaternion(90F)); //left
|
drawState(gui, world, model, actualState, pos, dispatcher, 4, 23, Vec3f.POSITIVE_Y.getDegreesQuaternion(90F)); //left
|
||||||
drawState(gui, world, model, actualState, pos, dispatcher, 23, 4, Vec3f.NEGATIVE_X.getDegreesQuaternion(90F)); //top
|
drawState(gui, world, model, actualState, pos, dispatcher, 23, 4, Vec3f.NEGATIVE_X.getDegreesQuaternion(90F)); //top
|
||||||
drawState(gui, world, model, actualState, pos, dispatcher, 23, 23, null); //centre
|
drawState(gui, world, model, actualState, pos, dispatcher, 23, 23, null); //centre
|
||||||
|
|
|
@ -33,8 +33,8 @@ import net.minecraft.client.render.Tessellator;
|
||||||
import net.minecraft.client.render.VertexConsumerProvider;
|
import net.minecraft.client.render.VertexConsumerProvider;
|
||||||
import net.minecraft.client.render.block.BlockRenderManager;
|
import net.minecraft.client.render.block.BlockRenderManager;
|
||||||
import net.minecraft.client.render.model.BakedModel;
|
import net.minecraft.client.render.model.BakedModel;
|
||||||
import net.minecraft.client.texture.SpriteAtlasTexture;
|
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
|
import net.minecraft.screen.PlayerScreenHandler;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Direction;
|
import net.minecraft.util.math.Direction;
|
||||||
import net.minecraft.util.math.Quaternion;
|
import net.minecraft.util.math.Quaternion;
|
||||||
|
@ -78,7 +78,7 @@ public class SlotConfigPopupElement extends ElementBase {
|
||||||
BlockState actualState = state.getBlock().getDefaultState();
|
BlockState actualState = state.getBlock().getDefaultState();
|
||||||
BlockRenderManager dispatcher = MinecraftClient.getInstance().getBlockRenderManager();
|
BlockRenderManager dispatcher = MinecraftClient.getInstance().getBlockRenderManager();
|
||||||
BakedModel model = dispatcher.getModels().getModel(state.getBlock().getDefaultState());
|
BakedModel model = dispatcher.getModels().getModel(state.getBlock().getDefaultState());
|
||||||
MinecraftClient.getInstance().getTextureManager().bindTexture(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE);
|
MinecraftClient.getInstance().getTextureManager().bindTexture(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE);
|
||||||
drawState(gui, world, model, actualState, pos, dispatcher, 4, 23, Vec3f.POSITIVE_Y.getDegreesQuaternion(90F)); //left
|
drawState(gui, world, model, actualState, pos, dispatcher, 4, 23, Vec3f.POSITIVE_Y.getDegreesQuaternion(90F)); //left
|
||||||
drawState(gui, world, model, actualState, pos, dispatcher, 23, 4, Vec3f.NEGATIVE_X.getDegreesQuaternion(90F)); //top
|
drawState(gui, world, model, actualState, pos, dispatcher, 23, 4, Vec3f.NEGATIVE_X.getDegreesQuaternion(90F)); //top
|
||||||
drawState(gui, world, model, actualState, pos, dispatcher, 23, 23, null); //centre
|
drawState(gui, world, model, actualState, pos, dispatcher, 23, 23, null); //centre
|
||||||
|
|
|
@ -38,10 +38,10 @@ import net.minecraft.client.render.Tessellator;
|
||||||
import net.minecraft.client.render.VertexFormat;
|
import net.minecraft.client.render.VertexFormat;
|
||||||
import net.minecraft.client.render.VertexFormats;
|
import net.minecraft.client.render.VertexFormats;
|
||||||
import net.minecraft.client.texture.Sprite;
|
import net.minecraft.client.texture.Sprite;
|
||||||
import net.minecraft.client.texture.SpriteAtlasTexture;
|
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.fluid.Fluids;
|
import net.minecraft.fluid.Fluids;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.screen.PlayerScreenHandler;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.Formatting;
|
import net.minecraft.util.Formatting;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
@ -715,7 +715,7 @@ public class GuiBuilder {
|
||||||
if (fluid.getFluid() == Fluids.EMPTY) {
|
if (fluid.getFluid() == Fluids.EMPTY) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
RenderSystem.setShaderTexture(0, SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE);
|
RenderSystem.setShaderTexture(0, PlayerScreenHandler.BLOCK_ATLAS_TEXTURE);
|
||||||
y += height;
|
y += height;
|
||||||
final Sprite sprite = FluidVariantRendering.getSprite(fluid.getVariant());
|
final Sprite sprite = FluidVariantRendering.getSprite(fluid.getVariant());
|
||||||
int color = FluidVariantRendering.getColor(fluid.getVariant());
|
int color = FluidVariantRendering.getColor(fluid.getVariant());
|
||||||
|
|
|
@ -48,8 +48,7 @@ public class BlockWrenchEventHandler {
|
||||||
if (ToolManager.INSTANCE.canHandleTool(playerEntity.getStackInHand(Hand.MAIN_HAND))) {
|
if (ToolManager.INSTANCE.canHandleTool(playerEntity.getStackInHand(Hand.MAIN_HAND))) {
|
||||||
BlockState state = world.getBlockState(blockHitResult.getBlockPos());
|
BlockState state = world.getBlockState(blockHitResult.getBlockPos());
|
||||||
if (wrenchableBlocks.contains(state.getBlock())) {
|
if (wrenchableBlocks.contains(state.getBlock())) {
|
||||||
Block block = state.getBlock();
|
state.onUse(world, playerEntity, hand, blockHitResult);
|
||||||
block.onUse(state, world, blockHitResult.getBlockPos(), playerEntity, hand, blockHitResult);
|
|
||||||
return ActionResult.SUCCESS;
|
return ActionResult.SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class TechRebornClient implements ClientModInitializer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInitializeClient() {
|
public void onInitializeClient() {
|
||||||
ModelLoadingRegistry.INSTANCE.registerAppender((manager, out) -> {
|
ModelLoadingRegistry.INSTANCE.registerModelProvider((manager, out) -> {
|
||||||
out.accept(new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "cell_base"), "inventory"));
|
out.accept(new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "cell_base"), "inventory"));
|
||||||
out.accept(new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "cell_fluid"), "inventory"));
|
out.accept(new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "cell_fluid"), "inventory"));
|
||||||
out.accept(new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "cell_background"), "inventory"));
|
out.accept(new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "cell_background"), "inventory"));
|
||||||
|
|
|
@ -52,11 +52,11 @@ import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandler;
|
||||||
import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandlerRegistry;
|
import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandlerRegistry;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.texture.Sprite;
|
import net.minecraft.client.texture.Sprite;
|
||||||
import net.minecraft.client.texture.SpriteAtlasTexture;
|
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.fluid.Fluid;
|
import net.minecraft.fluid.Fluid;
|
||||||
import net.minecraft.item.ItemConvertible;
|
import net.minecraft.item.ItemConvertible;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.screen.PlayerScreenHandler;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
@ -366,7 +366,7 @@ public class ReiPlugin implements REIClientPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawFluid(MatrixStack matrixStack, Fluid fluid, int drawHeight, int x, int y, int width, int height) {
|
public void drawFluid(MatrixStack matrixStack, Fluid fluid, int drawHeight, int x, int y, int width, int height) {
|
||||||
RenderSystem.setShaderTexture(0, SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE);
|
RenderSystem.setShaderTexture(0, PlayerScreenHandler.BLOCK_ATLAS_TEXTURE);
|
||||||
y += height;
|
y += height;
|
||||||
|
|
||||||
FluidRenderHandler handler = FluidRenderHandlerRegistry.INSTANCE.get(fluid);
|
FluidRenderHandler handler = FluidRenderHandlerRegistry.INSTANCE.get(fluid);
|
||||||
|
|
|
@ -26,8 +26,8 @@ package techreborn.client.render;
|
||||||
|
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.texture.Sprite;
|
import net.minecraft.client.texture.Sprite;
|
||||||
import net.minecraft.client.texture.SpriteAtlasTexture;
|
|
||||||
import net.minecraft.client.util.ModelIdentifier;
|
import net.minecraft.client.util.ModelIdentifier;
|
||||||
|
import net.minecraft.screen.PlayerScreenHandler;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import techreborn.TechReborn;
|
import techreborn.TechReborn;
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ public class DynamicBucketBakedModel extends BaseDynamicFluidBakedModel {
|
||||||
@Override
|
@Override
|
||||||
public Sprite getParticleSprite() {
|
public Sprite getParticleSprite() {
|
||||||
return MinecraftClient.getInstance()
|
return MinecraftClient.getInstance()
|
||||||
.getSpriteAtlas(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE)
|
.getSpriteAtlas(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE)
|
||||||
.apply(new Identifier("minecraft:item/bucket"));
|
.apply(new Identifier("minecraft:item/bucket"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,9 +28,9 @@ import net.fabricmc.fabric.api.renderer.v1.render.RenderContext;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.render.model.BakedModelManager;
|
import net.minecraft.client.render.model.BakedModelManager;
|
||||||
import net.minecraft.client.texture.Sprite;
|
import net.minecraft.client.texture.Sprite;
|
||||||
import net.minecraft.client.texture.SpriteAtlasTexture;
|
|
||||||
import net.minecraft.client.util.ModelIdentifier;
|
import net.minecraft.client.util.ModelIdentifier;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.screen.PlayerScreenHandler;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.math.random.Random;
|
import net.minecraft.util.math.random.Random;
|
||||||
import techreborn.TechReborn;
|
import techreborn.TechReborn;
|
||||||
|
@ -55,7 +55,7 @@ public class DynamicCellBakedModel extends BaseDynamicFluidBakedModel {
|
||||||
@Override
|
@Override
|
||||||
public Sprite getParticleSprite() {
|
public Sprite getParticleSprite() {
|
||||||
return MinecraftClient.getInstance()
|
return MinecraftClient.getInstance()
|
||||||
.getSpriteAtlas(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE)
|
.getSpriteAtlas(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE)
|
||||||
.apply(new Identifier("techreborn:item/cell_base"));
|
.apply(new Identifier("techreborn:item/cell_base"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,8 +29,8 @@ import net.minecraft.client.render.block.BlockRenderManager;
|
||||||
import net.minecraft.client.render.entity.EntityRenderer;
|
import net.minecraft.client.render.entity.EntityRenderer;
|
||||||
import net.minecraft.client.render.entity.EntityRendererFactory;
|
import net.minecraft.client.render.entity.EntityRendererFactory;
|
||||||
import net.minecraft.client.render.entity.TntMinecartEntityRenderer;
|
import net.minecraft.client.render.entity.TntMinecartEntityRenderer;
|
||||||
import net.minecraft.client.texture.SpriteAtlasTexture;
|
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
|
import net.minecraft.screen.PlayerScreenHandler;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.util.math.Vec3f;
|
import net.minecraft.util.math.Vec3f;
|
||||||
|
@ -53,7 +53,7 @@ public class NukeRenderer extends EntityRenderer<EntityNukePrimed> {
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public Identifier getTexture(EntityNukePrimed entityNukePrimed) {
|
public Identifier getTexture(EntityNukePrimed entityNukePrimed) {
|
||||||
return SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE;
|
return PlayerScreenHandler.BLOCK_ATLAS_TEXTURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
package techreborn.blockentity;
|
package techreborn.blockentity;
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.screenhandler.v1.ExtendedScreenHandlerFactory;
|
import net.fabricmc.fabric.api.screenhandler.v1.ExtendedScreenHandlerFactory;
|
||||||
import net.fabricmc.fabric.api.screenhandler.v1.ScreenHandlerRegistry;
|
import net.fabricmc.fabric.api.screenhandler.v1.ExtendedScreenHandlerType;
|
||||||
import net.minecraft.block.entity.BlockEntity;
|
import net.minecraft.block.entity.BlockEntity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.entity.player.PlayerInventory;
|
import net.minecraft.entity.player.PlayerInventory;
|
||||||
|
@ -36,6 +36,7 @@ import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.registry.Registry;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import reborncore.api.blockentity.IMachineGuiHandler;
|
import reborncore.api.blockentity.IMachineGuiHandler;
|
||||||
|
@ -138,13 +139,14 @@ public final class GuiType<T extends BlockEntity> implements IMachineGuiHandler
|
||||||
|
|
||||||
private GuiType(Identifier identifier) {
|
private GuiType(Identifier identifier) {
|
||||||
this.identifier = identifier;
|
this.identifier = identifier;
|
||||||
this.screenHandlerType = ScreenHandlerRegistry.registerExtended(identifier, getScreenHandlerFactory());
|
this.screenHandlerType = Registry.register(Registry.SCREEN_HANDLER, identifier, new ExtendedScreenHandlerType<>(getScreenHandlerFactory()));
|
||||||
|
|
||||||
TYPES.put(identifier, this);
|
TYPES.put(identifier, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ScreenHandlerRegistry.ExtendedClientHandlerFactory<BuiltScreenHandler> getScreenHandlerFactory() {
|
private ExtendedScreenHandlerType.ExtendedFactory<BuiltScreenHandler> getScreenHandlerFactory() {
|
||||||
return (syncId, playerInventory, packetByteBuf) -> {
|
return (syncId, playerInventory, packetByteBuf) -> {
|
||||||
|
|
||||||
final BlockEntity blockEntity = playerInventory.player.world.getBlockEntity(packetByteBuf.readBlockPos());
|
final BlockEntity blockEntity = playerInventory.player.world.getBlockEntity(packetByteBuf.readBlockPos());
|
||||||
BuiltScreenHandler screenHandler = ((BuiltScreenHandlerProvider) blockEntity).createScreenHandler(syncId, playerInventory.player);
|
BuiltScreenHandler screenHandler = ((BuiltScreenHandlerProvider) blockEntity).createScreenHandler(syncId, playerInventory.player);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue