Remove Utamacraft Item #52

Merged
BlakeRain merged 2 commits from BlakeRain/utamacraft:43-remove-utamacraft-item into main 2023-12-29 23:56:09 +00:00
26 changed files with 102 additions and 109 deletions

View File

@ -1,6 +1,5 @@
package net.banutama.utamacraft;
import com.mojang.logging.LogUtils;
import dan200.computercraft.api.ForgeComputerCraftAPI;
import dan200.computercraft.api.turtle.TurtleUpgradeSerialiser;
import net.banutama.utamacraft.block.entity.InsolatorBlockEntity;
@ -11,18 +10,18 @@ import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.RegistryObject;
import org.slf4j.Logger;
/**
* CC:Tweaked registration
*/
public class CCRegistration {
public static final DeferredRegister<TurtleUpgradeSerialiser<?>> TURTLE_SERIALIZERS =
DeferredRegister.create(TurtleUpgradeSerialiser.REGISTRY_ID, Utamacraft.MOD_ID);
public static final DeferredRegister<TurtleUpgradeSerialiser<?>> TURTLE_SERIALIZERS = DeferredRegister
.create(TurtleUpgradeSerialiser.REGISTRY_ID, Utamacraft.MOD_ID);
public static final RegistryObject<TurtleUpgradeSerialiser<TurtlePlayerUpgrade>> PLAYER_TURTLE =
TURTLE_SERIALIZERS.register(ID.PLAYER_TURTLE.getPath(), () -> TurtleUpgradeSerialiser.simpleWithCustomItem(TurtlePlayerUpgrade::new));
public static final RegistryObject<TurtleUpgradeSerialiser<TurtlePlayerUpgrade>> PLAYER_TURTLE = TURTLE_SERIALIZERS
.register(ID.PLAYER_TURTLE.getPath(),
() -> TurtleUpgradeSerialiser.simpleWithCustomItem(TurtlePlayerUpgrade::new));
public static PeripheralProvider peripheralProvider = new PeripheralProvider();

View File

@ -1,14 +1,11 @@
package net.banutama.utamacraft;
import com.google.common.eventbus.Subscribe;
import com.mojang.logging.LogUtils;
import net.banutama.utamacraft.block.custom.ModBlocks;
import net.banutama.utamacraft.block.entity.ModBlockEntities;
import net.banutama.utamacraft.client.model.AmuletModel;
import net.banutama.utamacraft.integrations.curios.CuriosRenderers;
import net.banutama.utamacraft.integrations.curios.CuriousLayerDefinitions;
import net.banutama.utamacraft.item.FireWardItem;
import net.banutama.utamacraft.item.ModItems;
import net.banutama.utamacraft.networking.ModMessages;
@ -36,7 +33,6 @@ import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import org.slf4j.Logger;
import top.theillusivec4.curios.api.SlotTypeMessage;
import top.theillusivec4.curios.api.SlotTypePreset;
import top.theillusivec4.curios.api.client.CuriosRendererRegistry;
// The value here should match an entry in the META-INF/mods.toml file
@Mod(Utamacraft.MOD_ID)

View File

@ -44,12 +44,13 @@ public class InsolatorBlock extends BaseEntityBlock {
}
private static Block.Properties getProperties() {
return Block.Properties.of(Material.METAL).strength(6.0f).requiresCorrectToolForDrops().noOcclusion().lightLevel(state -> state.getValue(ACTIVE) ? 15 : 0);
return Block.Properties.of(Material.METAL).strength(6.0f).requiresCorrectToolForDrops().noOcclusion()
.lightLevel(state -> state.getValue(ACTIVE) ? 15 : 0);
}
@SuppressWarnings("deprecation")
@Override
public @NotNull VoxelShape getShape(@NotNull BlockState state, @NotNull BlockGetter getter, @NotNull BlockPos pos, @NotNull CollisionContext context) {
public @NotNull VoxelShape getShape(@NotNull BlockState state, @NotNull BlockGetter getter, @NotNull BlockPos pos,
@NotNull CollisionContext context) {
return SHAPE;
}
@ -59,7 +60,6 @@ public class InsolatorBlock extends BaseEntityBlock {
return this.defaultBlockState().setValue(FACING, context.getHorizontalDirection().getOpposite());
}
@SuppressWarnings("deprecation")
@Override
public @NotNull BlockState rotate(BlockState state, Rotation rotation) {
return state.setValue(FACING, rotation.rotate(state.getValue(FACING)));
@ -76,7 +76,6 @@ public class InsolatorBlock extends BaseEntityBlock {
builder.add(FACING, ACTIVE);
}
@SuppressWarnings("deprecation")
@Override
public @NotNull RenderShape getRenderShape(@NotNull BlockState pState) {
return RenderShape.MODEL;
@ -84,7 +83,8 @@ public class InsolatorBlock extends BaseEntityBlock {
@SuppressWarnings("deprecation")
@Override
public void onRemove(BlockState pState, @NotNull Level pLevel, @NotNull BlockPos pPos, BlockState pNewState, boolean pIsMoving) {
public void onRemove(BlockState pState, @NotNull Level pLevel, @NotNull BlockPos pPos, BlockState pNewState,
boolean pIsMoving) {
if (!pState.is(pNewState.getBlock())) {
BlockEntity blockEntity = pLevel.getBlockEntity(pPos);
if (blockEntity instanceof InsolatorBlockEntity insolator) {
@ -103,9 +103,9 @@ public class InsolatorBlock extends BaseEntityBlock {
super.onRemove(pState, pLevel, pPos, pNewState, pIsMoving);
}
@SuppressWarnings("deprecation")
@Override
public @NotNull InteractionResult use(@NotNull BlockState pState, @NotNull Level pLevel, @NotNull BlockPos pPos, @NotNull Player pPlayer, @NotNull InteractionHand pHand, @NotNull BlockHitResult pHit) {
public @NotNull InteractionResult use(@NotNull BlockState pState, @NotNull Level pLevel, @NotNull BlockPos pPos,
@NotNull Player pPlayer, @NotNull InteractionHand pHand, @NotNull BlockHitResult pHit) {
BlockEntity blockEntity = pLevel.getBlockEntity(pPos);
if (!(blockEntity instanceof InsolatorBlockEntity insolatorEntity)) {
return InteractionResult.PASS;
@ -130,7 +130,8 @@ public class InsolatorBlock extends BaseEntityBlock {
@Nullable
@Override
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(@NotNull Level pLevel, @NotNull BlockState pState, @NotNull BlockEntityType<T> pBlockEntityType) {
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(@NotNull Level pLevel, @NotNull BlockState pState,
@NotNull BlockEntityType<T> pBlockEntityType) {
if (pLevel.isClientSide()) {
return null;
}
@ -139,10 +140,12 @@ public class InsolatorBlock extends BaseEntityBlock {
}
@Override
public void animateTick(@NotNull BlockState pState, @NotNull Level pLevel, @NotNull BlockPos pPos, @NotNull RandomSource pRandom) {
public void animateTick(@NotNull BlockState pState, @NotNull Level pLevel, @NotNull BlockPos pPos,
@NotNull RandomSource pRandom) {
if (pState.getValue(ACTIVE)) {
if (pRandom.nextDouble() < 1.0d) {
pLevel.playLocalSound(pPos.getX() + 0.5, pPos.getY() + 0.5, pPos.getZ() + 0.5, ModSounds.INSOLATOR.get(), SoundSource.BLOCKS, 0.1f, 1.0f, false);
pLevel.playLocalSound(pPos.getX() + 0.5, pPos.getY() + 0.5, pPos.getZ() + 0.5,
ModSounds.INSOLATOR.get(), SoundSource.BLOCKS, 0.1f, 1.0f, false);
}
}
}

View File

@ -1,6 +1,5 @@
package net.banutama.utamacraft.block.entity;
import com.mojang.logging.LogUtils;
import net.banutama.utamacraft.block.custom.InsolatorBlock;
import net.banutama.utamacraft.recipe.InsolatorRecipe;
import net.banutama.utamacraft.recipe.ModRecipes;
@ -98,7 +97,8 @@ public class InsolatorBlockEntity extends BlockEntity implements MenuProvider {
@Nullable
@Override
public AbstractContainerMenu createMenu(int pContainerId, @NotNull Inventory pPlayerInventory, @NotNull Player pPlayer) {
public AbstractContainerMenu createMenu(int pContainerId, @NotNull Inventory pPlayerInventory,
@NotNull Player pPlayer) {
return new InsolatorMenu(pContainerId, pPlayerInventory, this);
}
@ -215,9 +215,10 @@ public class InsolatorBlockEntity extends BlockEntity implements MenuProvider {
if (entity.fluid.isFluidValid(stack)) {
// Remove the amount of fluid from the IFluidHandlerItem
stack = handler.drain(amount, IFluidHandler.FluidAction.EXECUTE);
// Fill our fluid tank with the fluid stack we drained from the IFluidHandlerItem
// Fill our fluid tank with the fluid stack we drained from the
// IFluidHandlerItem
entity.fluid.fill(stack, IFluidHandler.FluidAction.EXECUTE);
// Extract the current item from the fluid slot? TODO: Should this be when empty?
// Extract the current item from the fluid slot?
entity.inventory.extractItem(0, 1, false);
entity.inventory.insertItem(0, handler.getContainer(), false);
}
@ -265,7 +266,8 @@ public class InsolatorBlockEntity extends BlockEntity implements MenuProvider {
ItemStack output = inventory.getStackInSlot(2);
// If the output isn't empty, and the item in the output is different to the output of the recipe, we cannot process.
// If the output isn't empty, and the item in the output is different to the
// output of the recipe, we cannot process.
if (!output.isEmpty() && output.getItem() != recipe.getResultItem().getItem()) {
return false;
}

View File

@ -9,12 +9,12 @@ import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
public class ModBlockEntities {
public static final DeferredRegister<BlockEntityType<?>> BLOCK_ENTITIES =
DeferredRegister.create(ForgeRegistries.BLOCK_ENTITY_TYPES, Utamacraft.MOD_ID);
public static final DeferredRegister<BlockEntityType<?>> BLOCK_ENTITIES = DeferredRegister
.create(ForgeRegistries.BLOCK_ENTITY_TYPES, Utamacraft.MOD_ID);
public static final RegistryObject<BlockEntityType<InsolatorBlockEntity>> INSOLATOR =
BLOCK_ENTITIES.register("insolator", () ->
BlockEntityType.Builder.of(InsolatorBlockEntity::new, ModBlocks.INSOLATOR.get()).build(null));
public static final RegistryObject<BlockEntityType<InsolatorBlockEntity>> INSOLATOR = BLOCK_ENTITIES.register(
"insolator",
() -> BlockEntityType.Builder.of(InsolatorBlockEntity::new, ModBlocks.INSOLATOR.get()).build(null));
public static void register(IEventBus bus) {
BLOCK_ENTITIES.register(bus);

View File

@ -13,6 +13,7 @@ import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
public class ClientRegistry {
@SubscribeEvent
public static void onClientSetup(FMLClientSetupEvent event) {
ComputerCraftAPIClient.registerTurtleUpgradeModeller(CCRegistration.PLAYER_TURTLE.get(), TurtleUpgradeModeller.flatItem());
ComputerCraftAPIClient.registerTurtleUpgradeModeller(CCRegistration.PLAYER_TURTLE.get(),
TurtleUpgradeModeller.flatItem());
}
}

View File

@ -33,7 +33,8 @@ public class AmuletModel extends HumanoidModel<LivingEntity> {
}
@Override
public void renderToBuffer(PoseStack pPoseStack, @NotNull VertexConsumer pBuffer, int pPackedLight, int pPackedOverlay, float pRed, float pGreen, float pBlue, float pAlpha) {
public void renderToBuffer(PoseStack pPoseStack, @NotNull VertexConsumer pBuffer, int pPackedLight,
int pPackedOverlay, float pRed, float pGreen, float pBlue, float pAlpha) {
pPoseStack.pushPose();
pPoseStack.scale(0.25f, 0.25f, 0.25f);
super.renderToBuffer(pPoseStack, pBuffer, pPackedLight, pPackedOverlay, pRed, pGreen, pBlue, pAlpha);
@ -51,4 +52,4 @@ public class AmuletModel extends HumanoidModel<LivingEntity> {
return mesh;
}
}
}

View File

@ -25,7 +25,8 @@ public class BoundMethod {
}
@NotNull
public MethodResult apply(@NotNull IComputerAccess computer, @NotNull ILuaContext context, @NotNull IArguments arguments) throws LuaException {
public MethodResult apply(@NotNull IComputerAccess computer, @NotNull ILuaContext context,
@NotNull IArguments arguments) throws LuaException {
return method.apply(target, context, computer, arguments);
}

View File

@ -18,13 +18,15 @@ import java.util.function.Predicate;
public class PeripheralProvider implements IPeripheralProvider {
private final List<BlockEntityPeripheral> blockEntityPeripherals = new ArrayList<>();
public void registerBlockPeripheral(Function<BlockEntity, ? extends IPeripheral> build, Predicate<BlockEntity> predicate) {
public void registerBlockPeripheral(Function<BlockEntity, ? extends IPeripheral> build,
Predicate<BlockEntity> predicate) {
blockEntityPeripherals.add(new BlockEntityPeripheral(build, predicate));
}
@NotNull
@Override
public LazyOptional<IPeripheral> getPeripheral(@NotNull Level world, @NotNull BlockPos pos, @NotNull Direction side) {
public LazyOptional<IPeripheral> getPeripheral(@NotNull Level world, @NotNull BlockPos pos,
@NotNull Direction side) {
for (BlockEntityPeripheral peripheral : blockEntityPeripherals) {
if (peripheral.hasPeripheral(world, pos, side)) {
return LazyOptional.of(() -> peripheral.buildPeripheral(world, pos, side));

View File

@ -19,7 +19,7 @@ import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
public abstract class BasePeripheral implements IPeripheral, IDynamicPeripheral {
public abstract class BasePeripheral implements IDynamicPeripheral {
protected final String type;
protected final BasePeripheralOwner owner;
protected final List<BoundMethod> methods;
@ -28,7 +28,8 @@ public abstract class BasePeripheral implements IPeripheral, IDynamicPeripheral
protected BasePeripheral(String type, BasePeripheralOwner owner) {
this.type = type;
this.owner = owner;
this.methods = PeripheralMethod.GENERATOR.getMethods(this.getClass()).stream().map(named -> new BoundMethod(this, named)).collect(Collectors.toList());
this.methods = PeripheralMethod.GENERATOR.getMethods(this.getClass()).stream()
.map(named -> new BoundMethod(this, named)).collect(Collectors.toList());
}
@NotNull
@ -39,7 +40,8 @@ public abstract class BasePeripheral implements IPeripheral, IDynamicPeripheral
@NotNull
@Override
public MethodResult callMethod(@NotNull IComputerAccess computer, @NotNull ILuaContext context, int method, @NotNull IArguments arguments) throws LuaException {
public MethodResult callMethod(@NotNull IComputerAccess computer, @NotNull ILuaContext context, int method,
@NotNull IArguments arguments) throws LuaException {
return methods.get(method).apply(computer, context, arguments);
}

View File

@ -28,7 +28,8 @@ public class BlockEntityPeripheral {
return predicate.test(entity);
}
public @NotNull IPeripheral buildPeripheral(@NotNull Level level, @NotNull BlockPos pos, @NotNull Direction direction) {
public @NotNull IPeripheral buildPeripheral(@NotNull Level level, @NotNull BlockPos pos,
@NotNull Direction direction) {
BlockEntity entity = level.getBlockEntity(pos);
if (entity == null) {
throw new IllegalArgumentException("No BlockEntity at this location");
@ -36,4 +37,4 @@ public class BlockEntityPeripheral {
return build.apply(entity);
}
}
}

View File

@ -1,6 +1,5 @@
package net.banutama.utamacraft.integrations.computercraft.peripheral;
import com.mojang.logging.LogUtils;
import dan200.computercraft.api.lua.LuaFunction;
import dan200.computercraft.api.lua.MethodResult;
import net.banutama.utamacraft.block.entity.InsolatorBlockEntity;
@ -8,15 +7,12 @@ import net.banutama.utamacraft.integrations.computercraft.utils.WrapResult;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraftforge.fluids.FluidStack;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import java.util.HashMap;
import java.util.Map;
public class InsolatorPeripheral extends BasePeripheral {
public static final String PERIPHERAL_TYPE = "insolator";
private static final Logger LOGGER = LogUtils.getLogger();
protected InsolatorPeripheral(BasePeripheralOwner owner) {
super(PERIPHERAL_TYPE, owner);
@ -34,7 +30,8 @@ public class InsolatorPeripheral extends BasePeripheral {
BlockEntity blockEntity = blockOwner.getBlockEntity();
if (!(blockEntity instanceof InsolatorBlockEntity insolator)) {
return MethodResult.of(null, "Owner of this InsolatorPeripheral has a BlockEntityProviderOwner with a BlockEntity that is not an InsolatorBlockEntity");
return MethodResult.of(null,
"Owner of this InsolatorPeripheral has a BlockEntityProviderOwner with a BlockEntity that is not an InsolatorBlockEntity");
}
Map<String, Object> result = new HashMap<>();

View File

@ -15,4 +15,8 @@ public class TurtlePeripheralOwner extends BasePeripheralOwner {
public ITurtleAccess getTurtle() {
return turtle;
}
public TurtleSide getTurtleSide() {
return side;
}
}

View File

@ -18,7 +18,7 @@ public class TurtlePlayerCache {
private static SimpleFakePlayer getPlayerFor(ITurtleAccess turtle, GameProfile profile) {
SimpleFakePlayer player = PLAYERS.get(turtle);
if (player == null) {
player = new SimpleFakePlayer((ServerLevel)turtle.getLevel(), profile);
player = new SimpleFakePlayer((ServerLevel) turtle.getLevel(), profile);
PLAYERS.put(turtle, player);
}
@ -36,15 +36,18 @@ public class TurtlePlayerCache {
Direction direction = turtle.getDirection();
float pitch = direction == Direction.UP ? -90.0f : direction == Direction.DOWN ? 90.0f : 0.0f;
float yaw = direction == Direction.SOUTH ? 0.0f : direction == Direction.WEST ? 90.0f : direction == Direction.NORTH ? 180.0f : -90.0f;
float yaw = direction == Direction.SOUTH ? 0.0f
: direction == Direction.WEST ? 90.0f : direction == Direction.NORTH ? 180.0f : -90.0f;
Vec3i normal = direction.getNormal();
Direction.Axis axis = direction.getAxis();
Direction.AxisDirection axis_dir = direction.getAxisDirection();
double x = (axis == Direction.Axis.X && axis_dir == Direction.AxisDirection.NEGATIVE) ? -0.5 : (0.5 + normal.getX() / 1.9);
double x = (axis == Direction.Axis.X && axis_dir == Direction.AxisDirection.NEGATIVE) ? -0.5
: (0.5 + normal.getX() / 1.9);
double y = 0.5 + normal.getY() / 1.9;
double z = (axis == Direction.Axis.Z && axis_dir == Direction.AxisDirection.NEGATIVE) ? -0.5 : (0.5 + normal.getZ() / 1.9);
double z = (axis == Direction.Axis.Z && axis_dir == Direction.AxisDirection.NEGATIVE) ? -0.5
: (0.5 + normal.getZ() / 1.9);
player.moveTo(position.getX() + x, position.getY() + y, position.getZ() + z, yaw, pitch);
return callback.apply(player);

View File

@ -1,24 +1,19 @@
package net.banutama.utamacraft.integrations.computercraft.turtles;
import com.mojang.logging.LogUtils;
import dan200.computercraft.api.turtle.ITurtleAccess;
import dan200.computercraft.api.turtle.TurtleSide;
import net.banutama.utamacraft.integrations.computercraft.peripheral.PlayerPeripheral;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
public class TurtlePlayerUpgrade extends PeripheralTurtleUpgrade<PlayerPeripheral> {
private static final Logger LOGGER = LogUtils.getLogger();
public TurtlePlayerUpgrade(ResourceLocation id, ItemStack item) {
super(id, item);
}
@Override
protected PlayerPeripheral buildPeripheral(@NotNull ITurtleAccess turtle, @NotNull TurtleSide side) {
LOGGER.info("Building PlayerPeripheral for TurtlePlayerUpgrade");
return new PlayerPeripheral(turtle, side);
}
}

View File

@ -1,7 +1,5 @@
package net.banutama.utamacraft.integrations.computercraft.utils;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;

View File

@ -21,7 +21,8 @@ public class CuriosRenderer implements ICurioRenderer {
private final HumanoidModel<LivingEntity> model;
public CuriosRenderer(String texturePath, HumanoidModel<LivingEntity> model) {
this(new ResourceLocation(Utamacraft.MOD_ID, String.format("textures/entity/curio/%s_curio.png", texturePath)), model);
this(new ResourceLocation(Utamacraft.MOD_ID, String.format("textures/entity/curio/%s_curio.png", texturePath)),
model);
}
public CuriosRenderer(ResourceLocation texture, HumanoidModel<LivingEntity> model) {
@ -31,23 +32,24 @@ public class CuriosRenderer implements ICurioRenderer {
@Override
public <T extends LivingEntity, M extends EntityModel<T>> void render(ItemStack stack,
SlotContext slotContext,
PoseStack matrixStack,
RenderLayerParent<T, M> renderLayerParent,
MultiBufferSource renderTypeBuffer,
int light,
float limbSwing,
float limbSwingAmount,
float partialTicks,
float ageInTicks,
float netHeadYaw,
float headPitch) {
SlotContext slotContext,
PoseStack matrixStack,
RenderLayerParent<T, M> renderLayerParent,
MultiBufferSource renderTypeBuffer,
int light,
float limbSwing,
float limbSwingAmount,
float partialTicks,
float ageInTicks,
float netHeadYaw,
float headPitch) {
model.setupAnim(slotContext.entity(), limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch);
model.prepareMobModel(slotContext.entity(), limbSwing, limbSwingAmount, partialTicks);
ICurioRenderer.followBodyRotations(slotContext.entity(), model);
RenderType renderType = model.renderType(texture);
VertexConsumer vertexConsumer = ItemRenderer.getFoilBuffer(renderTypeBuffer, renderType, false, stack.hasFoil());
VertexConsumer vertexConsumer = ItemRenderer.getFoilBuffer(renderTypeBuffer, renderType, false,
stack.hasFoil());
model.renderToBuffer(matrixStack, vertexConsumer, light, OverlayTexture.NO_OVERLAY, 1.0f, 1.0f, 1.0f, 1.0f);
}
}

View File

@ -8,8 +8,8 @@ import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.client.event.EntityRenderersEvent;
public class CuriousLayerDefinitions {
public static final ModelLayerLocation FIRE_WARD =
new ModelLayerLocation(new ResourceLocation(Utamacraft.MOD_ID, "fire_ward"), "fire_ward");
public static final ModelLayerLocation FIRE_WARD = new ModelLayerLocation(
new ResourceLocation(Utamacraft.MOD_ID, "fire_ward"), "fire_ward");
public static void register(EntityRenderersEvent.RegisterLayerDefinitions event) {
event.registerLayerDefinition(FIRE_WARD, () -> {

View File

@ -15,24 +15,24 @@ import net.banutama.utamacraft.recipe.InsolatorRecipe;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack;
import org.checkerframework.checker.units.qual.A;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public class InsolatorRecipeCategory implements IRecipeCategory<InsolatorRecipe> {
public final static ResourceLocation UID = new ResourceLocation(Utamacraft.MOD_ID, "insolator");
public final static ResourceLocation TEXTURE =
new ResourceLocation(Utamacraft.MOD_ID, "textures/gui/insolator_gui.png");
public static final RecipeType<InsolatorRecipe> INSOLATOR_TYPE =
new RecipeType<>(InsolatorRecipeCategory.UID, InsolatorRecipe.class);
public final static ResourceLocation TEXTURE = new ResourceLocation(Utamacraft.MOD_ID,
"textures/gui/insolator_gui.png");
public static final RecipeType<InsolatorRecipe> INSOLATOR_TYPE = new RecipeType<>(InsolatorRecipeCategory.UID,
InsolatorRecipe.class);
private final IDrawable background;
private final IDrawable icon;
public InsolatorRecipeCategory(IGuiHelper guiHelper) {
this.background = guiHelper.createDrawable(TEXTURE, 0, 0, 176, 85);
this.icon = guiHelper.createDrawableIngredient(VanillaTypes.ITEM_STACK, new ItemStack(ModBlocks.INSOLATOR.get()));
this.icon = guiHelper.createDrawableIngredient(VanillaTypes.ITEM_STACK,
new ItemStack(ModBlocks.INSOLATOR.get()));
}
@Override
@ -56,7 +56,8 @@ public class InsolatorRecipeCategory implements IRecipeCategory<InsolatorRecipe>
}
@Override
public void setRecipe(@NotNull IRecipeLayoutBuilder builder, @NotNull InsolatorRecipe recipe, @NotNull IFocusGroup focuses) {
public void setRecipe(@NotNull IRecipeLayoutBuilder builder, @NotNull InsolatorRecipe recipe,
@NotNull IFocusGroup focuses) {
builder.addSlot(RecipeIngredientRole.INPUT, 86, 15)
.addIngredients(recipe.getIngredients().get(0));
builder.addSlot(RecipeIngredientRole.INPUT, 33, 16)

View File

@ -29,6 +29,7 @@ public class ModJeiPlugin implements IModPlugin {
@Override
public void registerRecipes(IRecipeRegistration registration) {
@SuppressWarnings("resource")
RecipeManager manager = Objects.requireNonNull(Minecraft.getInstance().level).getRecipeManager();
List<InsolatorRecipe> recipes = manager.getAllRecipesFor(ModRecipes.INSOLATOR_RECIPE_TYPE.get());
registration.addRecipes(InsolatorRecipeCategory.INSOLATOR_TYPE, recipes);

View File

@ -11,7 +11,7 @@ public class ModCreativeModeTab {
public static final CreativeModeTab TAB = new CreativeModeTab("utamacraft_tab") {
@Override
public @NotNull ItemStack makeIcon() {
return new ItemStack(ModItems.LOGO.get());
return new ItemStack(ModItems.BULB.get());
}
};
}

View File

@ -8,25 +8,17 @@ import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
public class ModItems {
public static final DeferredRegister<Item> ITEMS =
DeferredRegister.create(ForgeRegistries.ITEMS, Utamacraft.MOD_ID);
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS,
Utamacraft.MOD_ID);
public static final RegistryObject<Item> LOGO =
ITEMS.register("utamacraft_logo", ModItems::simpleItem);
public static final RegistryObject<Item> PLAYER_PERIPHERAL =
ITEMS.register("player_peripheral", PlayerPeripheralItem::new);
public static final RegistryObject<Item> TUNGSTEN_INGOT =
ITEMS.register("tungsten_ingot", ModItems::simpleItem);
public static final RegistryObject<Item> TUNGSTEN_RAW =
ITEMS.register("tungsten_raw", ModItems::simpleItem);
public static final RegistryObject<Item> FIBER_GLASS =
ITEMS.register("fiber_glass", ModItems::simpleItem);
public static final RegistryObject<Item> PCB =
ITEMS.register("pcb", ModItems::simpleItem);
public static final RegistryObject<Item> BULB =
ITEMS.register("bulb", ModItems::simpleItem);
public static final RegistryObject<FireWardItem> FIRE_WARD =
ITEMS.register("fire_ward", FireWardItem::new);
public static final RegistryObject<Item> PLAYER_PERIPHERAL = ITEMS.register("player_peripheral",
PlayerPeripheralItem::new);
public static final RegistryObject<Item> TUNGSTEN_INGOT = ITEMS.register("tungsten_ingot", ModItems::simpleItem);
public static final RegistryObject<Item> TUNGSTEN_RAW = ITEMS.register("tungsten_raw", ModItems::simpleItem);
public static final RegistryObject<Item> FIBER_GLASS = ITEMS.register("fiber_glass", ModItems::simpleItem);
public static final RegistryObject<Item> PCB = ITEMS.register("pcb", ModItems::simpleItem);
public static final RegistryObject<Item> BULB = ITEMS.register("bulb", ModItems::simpleItem);
public static final RegistryObject<FireWardItem> FIRE_WARD = ITEMS.register("fire_ward", FireWardItem::new);
public static void register(IEventBus eventBus) {
ITEMS.register(eventBus);

View File

@ -1,6 +1,5 @@
package net.banutama.utamacraft.mixin;
import com.mojang.logging.LogUtils;
import net.banutama.utamacraft.item.ModItems;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity;

View File

@ -13,9 +13,8 @@
"item.utamacraft.pcb": "Printed Circuit Board",
"item.utamacraft.player_peripheral": "Player peripheral",
"item.utamacraft.tungsten_raw": "Raw Tungsten",
"item.utamacraft.tungsten_block": "Tungsten Block",
"item.utamacraft.tungsten_block": "Tungsten Block",
"item.utamacraft.tungsten_ingot": "Tungsten Ingot",
"item.utamacraft.utamacraft_logo": "Utamacraft",
"itemGroup.utamacraft_tab": "Utamacraft",
"tooltip.utamacraft.energy": "Energy",
"tooltip.utamacraft.energy.amount": "%s FE",
@ -25,7 +24,7 @@
"tooltip.utamacraft.fire_ward": "Protects the player from fire damage",
"tooltip.utamacraft.fluid.empty": "Empty",
"tooltip.utamacraft.fluid.amount": "%s mB",
"tooltip.utamacraft.fluid.amount.with_capacity": "%s / %s mB",
"tooltip.utamacraft.fluid.amount.with_capacity": "%s / %s mB",
"turtle.utamacraft.player_turtle": "Player",
"gui.utamacraft.insolator.dump": "Dump",
"gui.utamacraft.insolator.dump.tooltip": "Dump the fluid contents of the Insolator",

View File

@ -1,6 +0,0 @@
{
"parent": "item/generated",
"textures": {
"layer0": "utamacraft:item/utamacraft_logo"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB