mostly converted to 1.19

This commit is contained in:
Jörg Henke 2022-07-24 15:13:51 +02:00
parent bf2dbf396a
commit 29a17f6e3d
7 changed files with 32 additions and 38 deletions

View File

@ -4,14 +4,14 @@
# Fabric Properties # Fabric Properties
# check these on https://fabricmc.net/versions.html # check these on https://fabricmc.net/versions.html
minecraft_version=1.18.2 minecraft_version=1.19
yarn_mappings=1.18.2+build.2 yarn_mappings=1.19+build.4
loader_version=0.13.3 loader_version=0.14.8
# Mod Properties # Mod Properties
mod_version = 1.18.2.1 mod_version = 1.19.0
maven_group = de.jottyfan.minecraft maven_group = de.jottyfan.minecraft
archives_base_name = quickiefabric archives_base_name = quickiefabric
# Dependencies # Dependencies
fabric_version=0.47.10+1.18.2 fabric_version=0.58.0+1.19

View File

@ -16,18 +16,14 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtCompound;
import net.minecraft.screen.ScreenHandler; import net.minecraft.screen.ScreenHandler;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Style;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.Formatting;
import net.minecraft.util.collection.DefaultedList; import net.minecraft.util.collection.DefaultedList;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box; import net.minecraft.util.math.Box;
import net.minecraft.world.World; import net.minecraft.world.World;
/** /**
* *
* @author jotty * @author jotty
* *
*/ */
@ -125,12 +121,12 @@ public class ItemHoarderBlockEntity extends LootableContainerBlockEntity {
@Override @Override
protected Text getContainerName() { protected Text getContainerName() {
return new TranslatableText("container.itemhoarder"); return Text.translatable("container.itemhoarder");
} }
/** /**
* get a summary of content for the chat box * get a summary of content for the chat box
* *
* @return the summary * @return the summary
*/ */
public List<Text> getSummary() { public List<Text> getSummary() {
@ -139,8 +135,9 @@ public class ItemHoarderBlockEntity extends LootableContainerBlockEntity {
Item item = stack.getItem(); Item item = stack.getItem();
if (item != Items.AIR) { if (item != Items.AIR) {
Integer amount = stack.getCount(); Integer amount = stack.getCount();
Text text = new LiteralText(String.format("%dx ", amount)) StringBuilder buf = new StringBuilder(String.format("%dx ", amount));
.append(new TranslatableText(stack.getTranslationKey())).setStyle(Style.EMPTY.withColor(Formatting.GOLD)); buf.append(Text.translatable(stack.getTranslationKey()));
Text text = Text.of(buf.toString());
list.add(text); list.add(text);
} }
} }

View File

@ -20,7 +20,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.loot.context.LootContext.Builder; import net.minecraft.loot.context.LootContext.Builder;
import net.minecraft.text.Style; import net.minecraft.text.Style;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import net.minecraft.util.Formatting; import net.minecraft.util.Formatting;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
@ -30,7 +29,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
/** /**
* *
* @author jotty * @author jotty
* *
*/ */
@ -81,7 +80,7 @@ public class BlockItemhoarder extends Block implements BlockEntityProvider {
BlockEntity blockEntity = world.getBlockEntity(pos); BlockEntity blockEntity = world.getBlockEntity(pos);
if (blockEntity instanceof ItemHoarderBlockEntity) { if (blockEntity instanceof ItemHoarderBlockEntity) {
ItemHoarderBlockEntity ihbe = (ItemHoarderBlockEntity) blockEntity; ItemHoarderBlockEntity ihbe = (ItemHoarderBlockEntity) blockEntity;
player.sendMessage(new TranslatableText("msg.itemhoarder.summary", player.sendMessage(Text.translatable("msg.itemhoarder.summary",
new SimpleDateFormat("dd.MM.yyyy HH:mm:ss").format(new Date())).setStyle(Style.EMPTY.withColor(Formatting.BOLD)), false); new SimpleDateFormat("dd.MM.yyyy HH:mm:ss").format(new Date())).setStyle(Style.EMPTY.withColor(Formatting.BOLD)), false);
for (Text text : ihbe.getSummary()) { for (Text text : ihbe.getSummary()) {
player.sendMessage(text, false); player.sendMessage(text, false);

View File

@ -11,11 +11,10 @@ import net.minecraft.client.gui.screen.ingame.ScreenHandlerProvider;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
/** /**
* *
* @author jotty * @author jotty
* *
*/ */
@ -28,7 +27,7 @@ public class BackpackScreen extends HandledScreen<BackpackScreenHandler>
private final Integer containerWidth = 176; private final Integer containerWidth = 176;
public BackpackScreen(BackpackScreenHandler handler, PlayerInventory inventory, Text text) { public BackpackScreen(BackpackScreenHandler handler, PlayerInventory inventory, Text text) {
super(handler, inventory, new TranslatableText("container.quickiefabric.backpack")); super(handler, inventory, Text.translatable("container.quickiefabric.backpack"));
} }
@Override @Override

View File

@ -1,13 +1,14 @@
package de.jottyfan.minecraft.quickiefabric.init; package de.jottyfan.minecraft.quickiefabric.init;
import net.fabricmc.fabric.api.loot.v1.FabricLootPoolBuilder; import net.fabricmc.fabric.api.loot.v2.FabricLootPoolBuilder;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.loot.LootPool;
import net.minecraft.loot.condition.RandomChanceLootCondition; import net.minecraft.loot.condition.RandomChanceLootCondition;
import net.minecraft.loot.entry.ItemEntry; import net.minecraft.loot.entry.ItemEntry;
import net.minecraft.loot.provider.number.ConstantLootNumberProvider; import net.minecraft.loot.provider.number.ConstantLootNumberProvider;
/** /**
* *
* @author jotty * @author jotty
* *
*/ */
@ -15,12 +16,12 @@ public class LootHelper {
/** /**
* create a loot pool builder of the given object * create a loot pool builder of the given object
* *
* @return the loot pool builder * @return the loot pool builder
*/ */
public static final FabricLootPoolBuilder build(Integer number, Item item, float chance) { public static final LootPool.Builder build(Integer number, Item item, float chance) {
return FabricLootPoolBuilder.builder().rolls(ConstantLootNumberProvider.create(number)) return LootPool.builder().rolls(ConstantLootNumberProvider.create(number))
.withCondition(RandomChanceLootCondition.builder(chance).build()) .with(RandomChanceLootCondition.builder(chance))
.withEntry(ItemEntry.builder(item).build()); .with(ItemEntry.builder(item));
} }
} }

View File

@ -25,7 +25,7 @@ import net.fabricmc.fabric.api.biome.v1.BiomeModifications;
import net.fabricmc.fabric.api.biome.v1.BiomeSelectionContext; import net.fabricmc.fabric.api.biome.v1.BiomeSelectionContext;
import net.fabricmc.fabric.api.biome.v1.BiomeSelectors; import net.fabricmc.fabric.api.biome.v1.BiomeSelectors;
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder; import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
import net.fabricmc.fabric.api.loot.v1.event.LootTableLoadingCallback; import net.fabricmc.fabric.api.loot.v2.LootTableEvents;
import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder; import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder;
import net.fabricmc.fabric.api.registry.FuelRegistry; import net.fabricmc.fabric.api.registry.FuelRegistry;
import net.fabricmc.fabric.api.screenhandler.v1.ScreenHandlerRegistry; import net.fabricmc.fabric.api.screenhandler.v1.ScreenHandlerRegistry;
@ -90,7 +90,7 @@ public class RegistryManager {
public static final ConfiguredFeature<?, ?> CF_ORESANDSALPETER = new ConfiguredFeature(Feature.REPLACE_SINGLE_BLOCK, public static final ConfiguredFeature<?, ?> CF_ORESANDSALPETER = new ConfiguredFeature(Feature.REPLACE_SINGLE_BLOCK,
new EmeraldOreFeatureConfig(Blocks.SANDSTONE.getDefaultState(), new EmeraldOreFeatureConfig(Blocks.SANDSTONE.getDefaultState(),
QuickieBlocks.ORE_SAND_SALPETER.getDefaultState())); QuickieBlocks.ORE_SAND_SALPETER.getDefaultState()));
public static final PlacedFeature PF_ORESULPHOR = new PlacedFeature(RegistryEntry.of(CF_ORESULPHOR), public static final PlacedFeature PF_ORESULPHOR = new PlacedFeature(RegistryEntry.of(CF_ORESULPHOR),
Arrays.asList(CountPlacementModifier.of(7), SquarePlacementModifier.of(), Arrays.asList(CountPlacementModifier.of(7), SquarePlacementModifier.of(),
HeightRangePlacementModifier.uniform(YOffset.aboveBottom(0), YOffset.belowTop(0)))); HeightRangePlacementModifier.uniform(YOffset.aboveBottom(0), YOffset.belowTop(0))));
@ -318,10 +318,10 @@ public class RegistryManager {
} }
public static final void registerLootings() { public static final void registerLootings() {
LootTableLoadingCallback.EVENT.register((resourceManager, lootManager, id, supplier, setter) -> { LootTableEvents.MODIFY.register((resourceManager, lootManager, id, supplier, setter) -> {
if (isGrass(id)) { if (isGrass(id)) {
supplier.withPool(LootHelper.build(1, QuickieItems.COTTONSEED, 0.125f).build()); supplier.pool(LootHelper.build(1, QuickieItems.COTTONSEED, 0.125f));
supplier.withPool(LootHelper.build(2, QuickieItems.SALPETER, 0.012f).build()); supplier.pool(LootHelper.build(2, QuickieItems.SALPETER, 0.012f));
} }
}); });
} }

View File

@ -20,9 +20,7 @@ import net.minecraft.item.ItemUsageContext;
import net.minecraft.network.PacketByteBuf; import net.minecraft.network.PacketByteBuf;
import net.minecraft.screen.ScreenHandler; import net.minecraft.screen.ScreenHandler;
import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.TypedActionResult; import net.minecraft.util.TypedActionResult;
@ -57,7 +55,7 @@ public class ItemBackpack extends Item {
@Override @Override
public Text getDisplayName() { public Text getDisplayName() {
return new LiteralText(RegistryManager.BACKPACK_IDENTIFIER.toString()); return Text.of(RegistryManager.BACKPACK_IDENTIFIER.toString());
} }
@Override @Override
@ -116,7 +114,7 @@ public class ItemBackpack extends Item {
} }
bi.onClose(player); bi.onClose(player);
if (!world.isClient) { if (!world.isClient) {
player.sendMessage(new TranslatableText("msg.backpack.transfer.filled"), false); player.sendMessage(Text.translatable("msg.backpack.transfer.filled"), false);
} }
} else { // empty backpack as long as possible } else { // empty backpack as long as possible
for (int slot = 0; slot < ItemBackpack.SLOTSIZE; slot++) { for (int slot = 0; slot < ItemBackpack.SLOTSIZE; slot++) {
@ -138,7 +136,7 @@ public class ItemBackpack extends Item {
} }
bi.onClose(player); bi.onClose(player);
if (!world.isClient) { if (!world.isClient) {
player.sendMessage(new TranslatableText("msg.backpack.transfer.cleared"), false); player.sendMessage(Text.translatable("msg.backpack.transfer.cleared"), false);
} }
} }
} }
@ -147,7 +145,7 @@ public class ItemBackpack extends Item {
/** /**
* find the numbers of the slots that contain items of stack or have Air * find the numbers of the slots that contain items of stack or have Air
* *
* @param blockEntity the block entity * @param blockEntity the block entity
* @param stack the item stack * @param stack the item stack
* @return a list of found stack positions; an empty list at least * @return a list of found stack positions; an empty list at least