diff --git a/common/src/generated/resources/assets/farmingforblockheads/items/chicken_nest.json b/common/src/generated/resources/assets/farmingforblockheads/items/chicken_nest.json new file mode 100644 index 00000000..23da5473 --- /dev/null +++ b/common/src/generated/resources/assets/farmingforblockheads/items/chicken_nest.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "farmingforblockheads:block/chicken_nest" + } +} \ No newline at end of file diff --git a/common/src/generated/resources/assets/farmingforblockheads/items/feeding_trough.json b/common/src/generated/resources/assets/farmingforblockheads/items/feeding_trough.json new file mode 100644 index 00000000..67772813 --- /dev/null +++ b/common/src/generated/resources/assets/farmingforblockheads/items/feeding_trough.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "farmingforblockheads:block/feeding_trough" + } +} \ No newline at end of file diff --git a/common/src/generated/resources/assets/farmingforblockheads/items/fertilized_farmland_healthy.json b/common/src/generated/resources/assets/farmingforblockheads/items/fertilized_farmland_healthy.json new file mode 100644 index 00000000..741ac65e --- /dev/null +++ b/common/src/generated/resources/assets/farmingforblockheads/items/fertilized_farmland_healthy.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "farmingforblockheads:block/fertilized_farmland_healthy" + } +} \ No newline at end of file diff --git a/common/src/generated/resources/assets/farmingforblockheads/items/fertilized_farmland_healthy_stable.json b/common/src/generated/resources/assets/farmingforblockheads/items/fertilized_farmland_healthy_stable.json new file mode 100644 index 00000000..22b37164 --- /dev/null +++ b/common/src/generated/resources/assets/farmingforblockheads/items/fertilized_farmland_healthy_stable.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "farmingforblockheads:block/fertilized_farmland_healthy_stable" + } +} \ No newline at end of file diff --git a/common/src/generated/resources/assets/farmingforblockheads/items/fertilized_farmland_rich.json b/common/src/generated/resources/assets/farmingforblockheads/items/fertilized_farmland_rich.json new file mode 100644 index 00000000..e023919b --- /dev/null +++ b/common/src/generated/resources/assets/farmingforblockheads/items/fertilized_farmland_rich.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "farmingforblockheads:block/fertilized_farmland_rich" + } +} \ No newline at end of file diff --git a/common/src/generated/resources/assets/farmingforblockheads/items/fertilized_farmland_rich_stable.json b/common/src/generated/resources/assets/farmingforblockheads/items/fertilized_farmland_rich_stable.json new file mode 100644 index 00000000..3e6246f8 --- /dev/null +++ b/common/src/generated/resources/assets/farmingforblockheads/items/fertilized_farmland_rich_stable.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "farmingforblockheads:block/fertilized_farmland_rich_stable" + } +} \ No newline at end of file diff --git a/common/src/generated/resources/assets/farmingforblockheads/items/fertilized_farmland_stable.json b/common/src/generated/resources/assets/farmingforblockheads/items/fertilized_farmland_stable.json new file mode 100644 index 00000000..ea0bbf30 --- /dev/null +++ b/common/src/generated/resources/assets/farmingforblockheads/items/fertilized_farmland_stable.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "farmingforblockheads:block/fertilized_farmland_stable" + } +} \ No newline at end of file diff --git a/common/src/generated/resources/assets/farmingforblockheads/items/green_fertilizer.json b/common/src/generated/resources/assets/farmingforblockheads/items/green_fertilizer.json new file mode 100644 index 00000000..6fcf68db --- /dev/null +++ b/common/src/generated/resources/assets/farmingforblockheads/items/green_fertilizer.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "farmingforblockheads:item/green_fertilizer" + } +} \ No newline at end of file diff --git a/common/src/generated/resources/assets/farmingforblockheads/items/market.json b/common/src/generated/resources/assets/farmingforblockheads/items/market.json new file mode 100644 index 00000000..d40bf9c3 --- /dev/null +++ b/common/src/generated/resources/assets/farmingforblockheads/items/market.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "farmingforblockheads:item/market" + } +} \ No newline at end of file diff --git a/common/src/generated/resources/assets/farmingforblockheads/items/red_fertilizer.json b/common/src/generated/resources/assets/farmingforblockheads/items/red_fertilizer.json new file mode 100644 index 00000000..913792b9 --- /dev/null +++ b/common/src/generated/resources/assets/farmingforblockheads/items/red_fertilizer.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "farmingforblockheads:item/red_fertilizer" + } +} \ No newline at end of file diff --git a/common/src/generated/resources/assets/farmingforblockheads/items/yellow_fertilizer.json b/common/src/generated/resources/assets/farmingforblockheads/items/yellow_fertilizer.json new file mode 100644 index 00000000..2543bf0c --- /dev/null +++ b/common/src/generated/resources/assets/farmingforblockheads/items/yellow_fertilizer.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "farmingforblockheads:item/yellow_fertilizer" + } +} \ No newline at end of file diff --git a/common/src/generated/resources/assets/farmingforblockheads/models/item/chicken_nest.json b/common/src/generated/resources/assets/farmingforblockheads/models/item/chicken_nest.json deleted file mode 100644 index 750e10fa..00000000 --- a/common/src/generated/resources/assets/farmingforblockheads/models/item/chicken_nest.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "parent": "farmingforblockheads:block/chicken_nest" -} \ No newline at end of file diff --git a/common/src/generated/resources/assets/farmingforblockheads/models/item/feeding_trough.json b/common/src/generated/resources/assets/farmingforblockheads/models/item/feeding_trough.json deleted file mode 100644 index c1abdf63..00000000 --- a/common/src/generated/resources/assets/farmingforblockheads/models/item/feeding_trough.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "parent": "farmingforblockheads:block/feeding_trough" -} \ No newline at end of file diff --git a/common/src/generated/resources/assets/farmingforblockheads/models/item/fertilized_farmland_healthy.json b/common/src/generated/resources/assets/farmingforblockheads/models/item/fertilized_farmland_healthy.json deleted file mode 100644 index 926f42f4..00000000 --- a/common/src/generated/resources/assets/farmingforblockheads/models/item/fertilized_farmland_healthy.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "parent": "farmingforblockheads:block/fertilized_farmland_healthy" -} \ No newline at end of file diff --git a/common/src/generated/resources/assets/farmingforblockheads/models/item/fertilized_farmland_healthy_stable.json b/common/src/generated/resources/assets/farmingforblockheads/models/item/fertilized_farmland_healthy_stable.json deleted file mode 100644 index 6120f9c4..00000000 --- a/common/src/generated/resources/assets/farmingforblockheads/models/item/fertilized_farmland_healthy_stable.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "parent": "farmingforblockheads:block/fertilized_farmland_healthy_stable" -} \ No newline at end of file diff --git a/common/src/generated/resources/assets/farmingforblockheads/models/item/fertilized_farmland_rich.json b/common/src/generated/resources/assets/farmingforblockheads/models/item/fertilized_farmland_rich.json deleted file mode 100644 index 3f25b53e..00000000 --- a/common/src/generated/resources/assets/farmingforblockheads/models/item/fertilized_farmland_rich.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "parent": "farmingforblockheads:block/fertilized_farmland_rich" -} \ No newline at end of file diff --git a/common/src/generated/resources/assets/farmingforblockheads/models/item/fertilized_farmland_rich_stable.json b/common/src/generated/resources/assets/farmingforblockheads/models/item/fertilized_farmland_rich_stable.json deleted file mode 100644 index 5488cd05..00000000 --- a/common/src/generated/resources/assets/farmingforblockheads/models/item/fertilized_farmland_rich_stable.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "parent": "farmingforblockheads:block/fertilized_farmland_rich_stable" -} \ No newline at end of file diff --git a/common/src/generated/resources/assets/farmingforblockheads/models/item/fertilized_farmland_stable.json b/common/src/generated/resources/assets/farmingforblockheads/models/item/fertilized_farmland_stable.json deleted file mode 100644 index e103be55..00000000 --- a/common/src/generated/resources/assets/farmingforblockheads/models/item/fertilized_farmland_stable.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "parent": "farmingforblockheads:block/fertilized_farmland_stable" -} \ No newline at end of file diff --git a/common/src/main/java/net/blay09/mods/farmingforblockheads/FarmingForBlockheads.java b/common/src/main/java/net/blay09/mods/farmingforblockheads/FarmingForBlockheads.java index c2f66a4d..c09b4ce9 100644 --- a/common/src/main/java/net/blay09/mods/farmingforblockheads/FarmingForBlockheads.java +++ b/common/src/main/java/net/blay09/mods/farmingforblockheads/FarmingForBlockheads.java @@ -42,16 +42,4 @@ public static void initialize() { Balm.getEvents().onEvent(CropGrowEvent.Post.class, FarmlandHandler::onGrowEvent); } - - public static Component getDefaultPaymentComponent(Payment payment) { - final var ingredient = payment.ingredient(); - if (ingredient.items().isEmpty()) { - return Component.literal(""); - } - - final var candidates = ingredient.items(); - final var index = (int) (System.currentTimeMillis() / 1500L % candidates.size()); - final var itemHolder = candidates.get(index); - return Component.translatable("tooltip.farmingforblockheads.payment_item", payment.count(), itemHolder.value().getName()); - } } diff --git a/common/src/main/java/net/blay09/mods/farmingforblockheads/client/render/MerchantRenderer.java b/common/src/main/java/net/blay09/mods/farmingforblockheads/client/render/MerchantRenderer.java index 227f0cdc..6c15703f 100644 --- a/common/src/main/java/net/blay09/mods/farmingforblockheads/client/render/MerchantRenderer.java +++ b/common/src/main/java/net/blay09/mods/farmingforblockheads/client/render/MerchantRenderer.java @@ -23,7 +23,7 @@ public class MerchantRenderer extends MobRenderer(this, context.getModelSet(), context.getItemRenderer())); + this.addLayer(new CustomHeadLayer<>(this, context.getModelSet())); } @Override diff --git a/common/src/main/java/net/blay09/mods/farmingforblockheads/compat/jei/JeiMarketRecipeCategory.java b/common/src/main/java/net/blay09/mods/farmingforblockheads/compat/jei/JeiMarketRecipeCategory.java index ffed8b3d..b673c5b6 100644 --- a/common/src/main/java/net/blay09/mods/farmingforblockheads/compat/jei/JeiMarketRecipeCategory.java +++ b/common/src/main/java/net/blay09/mods/farmingforblockheads/compat/jei/JeiMarketRecipeCategory.java @@ -69,14 +69,9 @@ public void setRecipe(IRecipeLayoutBuilder builder, RecipeHolder r @Override public void draw(RecipeHolder recipeHolder, IRecipeSlotsView recipeSlotsView, GuiGraphics guiGraphics, double mouseX, double mouseY) { - Component costText = getFormattedCostString(recipeHolder.value()); - Font font = Minecraft.getInstance().font; - int stringWidth = font.width(costText); - guiGraphics.drawString(font, costText.getVisualOrderText(), 42 - stringWidth / 2, 35, 0xFFFFFF, true); - } - - private Component getFormattedCostString(MarketRecipe recipe) { - final var payment = MarketDefaultsRegistry.resolvePayment(recipe); - return payment.tooltip().orElseGet(() -> FarmingForBlockheads.getDefaultPaymentComponent(payment)); + // TODO Component costText = getFormattedCostString(recipeHolder.value()); + // TODO Font font = Minecraft.getInstance().font; + // TODO int stringWidth = font.width(costText); + // TODO guiGraphics.drawString(font, costText.getVisualOrderText(), 42 - stringWidth / 2, 35, 0xFFFFFF, true); } } diff --git a/common/src/main/java/net/blay09/mods/farmingforblockheads/recipe/MarketRecipe.java b/common/src/main/java/net/blay09/mods/farmingforblockheads/recipe/MarketRecipe.java index 9dd04f86..fb7bccd0 100644 --- a/common/src/main/java/net/blay09/mods/farmingforblockheads/recipe/MarketRecipe.java +++ b/common/src/main/java/net/blay09/mods/farmingforblockheads/recipe/MarketRecipe.java @@ -69,7 +69,7 @@ public boolean enabled() { private SlotDisplay paymentSlotDisplay(Payment payment) { final var ingredient = payment.ingredient(); final List slotDisplays = new ArrayList<>(); - ingredient.items().stream() + ingredient.items() .map(it -> new ItemStack(it.value(), payment.count())) .map(SlotDisplay.ItemStackSlotDisplay::new) .forEach(slotDisplays::add); diff --git a/fabric/src/main/java/net/blay09/mods/farmingforblockheads/fabric/datagen/ModModelProvider.java b/fabric/src/main/java/net/blay09/mods/farmingforblockheads/fabric/datagen/ModModelProvider.java index 05b72e06..ad49a1d9 100644 --- a/fabric/src/main/java/net/blay09/mods/farmingforblockheads/fabric/datagen/ModModelProvider.java +++ b/fabric/src/main/java/net/blay09/mods/farmingforblockheads/fabric/datagen/ModModelProvider.java @@ -4,24 +4,24 @@ import net.blay09.mods.farmingforblockheads.block.ModBlocks; import net.blay09.mods.farmingforblockheads.item.ModItems; import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; -import net.fabricmc.fabric.api.datagen.v1.provider.FabricModelProvider; -import net.minecraft.data.models.BlockModelGenerators; -import net.minecraft.data.models.ItemModelGenerators; -import net.minecraft.data.models.blockstates.MultiVariantGenerator; -import net.minecraft.data.models.blockstates.PropertyDispatch; -import net.minecraft.data.models.blockstates.Variant; -import net.minecraft.data.models.blockstates.VariantProperties; -import net.minecraft.data.models.model.ModelLocationUtils; -import net.minecraft.data.models.model.ModelTemplates; -import net.minecraft.data.models.model.TextureMapping; -import net.minecraft.data.models.model.TextureSlot; +import net.fabricmc.fabric.api.client.datagen.v1.provider.FabricModelProvider; +import net.minecraft.client.data.models.BlockModelGenerators; +import net.minecraft.client.data.models.ItemModelGenerators; +import net.minecraft.client.data.models.blockstates.MultiVariantGenerator; +import net.minecraft.client.data.models.blockstates.PropertyDispatch; +import net.minecraft.client.data.models.blockstates.Variant; +import net.minecraft.client.data.models.blockstates.VariantProperties; +import net.minecraft.client.data.models.model.*; +import net.minecraft.client.renderer.special.BedSpecialRenderer; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.DoubleBlockHalf; -import static net.minecraft.data.models.BlockModelGenerators.createEmptyOrFullDispatch; -import static net.minecraft.data.models.BlockModelGenerators.createHorizontalFacingDispatch; +import static net.minecraft.client.data.models.BlockModelGenerators.createEmptyOrFullDispatch; +import static net.minecraft.client.data.models.BlockModelGenerators.createHorizontalFacingDispatch; public class ModModelProvider extends FabricModelProvider { public ModModelProvider(FabricDataOutput output) { @@ -71,6 +71,7 @@ private void createDoubleBlockMarket(BlockModelGenerators blockStateModelGenerat .select(DoubleBlockHalf.LOWER, Variant.variant().with(VariantProperties.MODEL, bottomModelLocation)) .select(DoubleBlockHalf.UPPER, Variant.variant().with(VariantProperties.MODEL, topModelLocation))); blockStateModelGenerator.blockStateOutput.accept(generator); - blockStateModelGenerator.skipAutoItemBlock(block); + Item item = block.asItem(); + blockStateModelGenerator.registerSimpleItemModel(block.asItem(), ModelLocationUtils.getModelLocation(item)); } }