Skip to content

Commit

Permalink
feat: Update to Minecraft 1.21.4
Browse files Browse the repository at this point in the history
  • Loading branch information
BlayTheNinth committed Nov 26, 2024
1 parent 6423f24 commit 1d72ee4
Show file tree
Hide file tree
Showing 23 changed files with 87 additions and 58 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "farmingforblockheads:block/chicken_nest"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "farmingforblockheads:block/feeding_trough"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "farmingforblockheads:block/fertilized_farmland_healthy"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "farmingforblockheads:block/fertilized_farmland_healthy_stable"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "farmingforblockheads:block/fertilized_farmland_rich"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "farmingforblockheads:block/fertilized_farmland_rich_stable"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "farmingforblockheads:block/fertilized_farmland_stable"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "farmingforblockheads:item/green_fertilizer"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "farmingforblockheads:item/market"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "farmingforblockheads:item/red_fertilizer"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "farmingforblockheads:item/yellow_fertilizer"
}
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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("<invalid>");
}

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());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class MerchantRenderer extends MobRenderer<MerchantEntity, VillagerRender

public MerchantRenderer(EntityRendererProvider.Context context) {
super(context, new VillagerModel(context.bakeLayer(ModelLayers.VILLAGER)), 0.5f);
this.addLayer(new CustomHeadLayer<>(this, context.getModelSet(), context.getItemRenderer()));
this.addLayer(new CustomHeadLayer<>(this, context.getModelSet()));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,9 @@ public void setRecipe(IRecipeLayoutBuilder builder, RecipeHolder<MarketRecipe> r

@Override
public void draw(RecipeHolder<MarketRecipe> 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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public boolean enabled() {
private SlotDisplay paymentSlotDisplay(Payment payment) {
final var ingredient = payment.ingredient();
final List<SlotDisplay> slotDisplays = new ArrayList<>();
ingredient.items().stream()
ingredient.items()
.map(it -> new ItemStack(it.value(), payment.count()))
.map(SlotDisplay.ItemStackSlotDisplay::new)
.forEach(slotDisplays::add);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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));
}
}

0 comments on commit 1d72ee4

Please sign in to comment.