mostly converted to 1.19
This commit is contained in:
parent
bf2dbf396a
commit
29a17f6e3d
@ -4,14 +4,14 @@
|
||||
|
||||
# Fabric Properties
|
||||
# check these on https://fabricmc.net/versions.html
|
||||
minecraft_version=1.18.2
|
||||
yarn_mappings=1.18.2+build.2
|
||||
loader_version=0.13.3
|
||||
minecraft_version=1.19
|
||||
yarn_mappings=1.19+build.4
|
||||
loader_version=0.14.8
|
||||
|
||||
# Mod Properties
|
||||
mod_version = 1.18.2.1
|
||||
mod_version = 1.19.0
|
||||
maven_group = de.jottyfan.minecraft
|
||||
archives_base_name = quickiefabric
|
||||
|
||||
# Dependencies
|
||||
fabric_version=0.47.10+1.18.2
|
||||
fabric_version=0.58.0+1.19
|
||||
|
@ -16,18 +16,14 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.screen.ScreenHandler;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.Style;
|
||||
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.math.BlockPos;
|
||||
import net.minecraft.util.math.Box;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author jotty
|
||||
*
|
||||
*/
|
||||
@ -125,12 +121,12 @@ public class ItemHoarderBlockEntity extends LootableContainerBlockEntity {
|
||||
|
||||
@Override
|
||||
protected Text getContainerName() {
|
||||
return new TranslatableText("container.itemhoarder");
|
||||
return Text.translatable("container.itemhoarder");
|
||||
}
|
||||
|
||||
/**
|
||||
* get a summary of content for the chat box
|
||||
*
|
||||
*
|
||||
* @return the summary
|
||||
*/
|
||||
public List<Text> getSummary() {
|
||||
@ -139,8 +135,9 @@ public class ItemHoarderBlockEntity extends LootableContainerBlockEntity {
|
||||
Item item = stack.getItem();
|
||||
if (item != Items.AIR) {
|
||||
Integer amount = stack.getCount();
|
||||
Text text = new LiteralText(String.format("%dx ", amount))
|
||||
.append(new TranslatableText(stack.getTranslationKey())).setStyle(Style.EMPTY.withColor(Formatting.GOLD));
|
||||
StringBuilder buf = new StringBuilder(String.format("%dx ", amount));
|
||||
buf.append(Text.translatable(stack.getTranslationKey()));
|
||||
Text text = Text.of(buf.toString());
|
||||
list.add(text);
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.loot.context.LootContext.Builder;
|
||||
import net.minecraft.text.Style;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Formatting;
|
||||
import net.minecraft.util.Hand;
|
||||
@ -30,7 +29,7 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author jotty
|
||||
*
|
||||
*/
|
||||
@ -81,7 +80,7 @@ public class BlockItemhoarder extends Block implements BlockEntityProvider {
|
||||
BlockEntity blockEntity = world.getBlockEntity(pos);
|
||||
if (blockEntity instanceof ItemHoarderBlockEntity) {
|
||||
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);
|
||||
for (Text text : ihbe.getSummary()) {
|
||||
player.sendMessage(text, false);
|
||||
|
@ -11,11 +11,10 @@ import net.minecraft.client.gui.screen.ingame.ScreenHandlerProvider;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author jotty
|
||||
*
|
||||
*/
|
||||
@ -28,7 +27,7 @@ public class BackpackScreen extends HandledScreen<BackpackScreenHandler>
|
||||
private final Integer containerWidth = 176;
|
||||
|
||||
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
|
||||
|
@ -1,13 +1,14 @@
|
||||
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.loot.LootPool;
|
||||
import net.minecraft.loot.condition.RandomChanceLootCondition;
|
||||
import net.minecraft.loot.entry.ItemEntry;
|
||||
import net.minecraft.loot.provider.number.ConstantLootNumberProvider;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author jotty
|
||||
*
|
||||
*/
|
||||
@ -15,12 +16,12 @@ public class LootHelper {
|
||||
|
||||
/**
|
||||
* create a loot pool builder of the given object
|
||||
*
|
||||
*
|
||||
* @return the loot pool builder
|
||||
*/
|
||||
public static final FabricLootPoolBuilder build(Integer number, Item item, float chance) {
|
||||
return FabricLootPoolBuilder.builder().rolls(ConstantLootNumberProvider.create(number))
|
||||
.withCondition(RandomChanceLootCondition.builder(chance).build())
|
||||
.withEntry(ItemEntry.builder(item).build());
|
||||
public static final LootPool.Builder build(Integer number, Item item, float chance) {
|
||||
return LootPool.builder().rolls(ConstantLootNumberProvider.create(number))
|
||||
.with(RandomChanceLootCondition.builder(chance))
|
||||
.with(ItemEntry.builder(item));
|
||||
}
|
||||
}
|
||||
|
@ -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.BiomeSelectors;
|
||||
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.registry.FuelRegistry;
|
||||
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,
|
||||
new EmeraldOreFeatureConfig(Blocks.SANDSTONE.getDefaultState(),
|
||||
QuickieBlocks.ORE_SAND_SALPETER.getDefaultState()));
|
||||
|
||||
|
||||
public static final PlacedFeature PF_ORESULPHOR = new PlacedFeature(RegistryEntry.of(CF_ORESULPHOR),
|
||||
Arrays.asList(CountPlacementModifier.of(7), SquarePlacementModifier.of(),
|
||||
HeightRangePlacementModifier.uniform(YOffset.aboveBottom(0), YOffset.belowTop(0))));
|
||||
@ -318,10 +318,10 @@ public class RegistryManager {
|
||||
}
|
||||
|
||||
public static final void registerLootings() {
|
||||
LootTableLoadingCallback.EVENT.register((resourceManager, lootManager, id, supplier, setter) -> {
|
||||
LootTableEvents.MODIFY.register((resourceManager, lootManager, id, supplier, setter) -> {
|
||||
if (isGrass(id)) {
|
||||
supplier.withPool(LootHelper.build(1, QuickieItems.COTTONSEED, 0.125f).build());
|
||||
supplier.withPool(LootHelper.build(2, QuickieItems.SALPETER, 0.012f).build());
|
||||
supplier.pool(LootHelper.build(1, QuickieItems.COTTONSEED, 0.125f));
|
||||
supplier.pool(LootHelper.build(2, QuickieItems.SALPETER, 0.012f));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -20,9 +20,7 @@ import net.minecraft.item.ItemUsageContext;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.screen.ScreenHandler;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.TypedActionResult;
|
||||
@ -57,7 +55,7 @@ public class ItemBackpack extends Item {
|
||||
|
||||
@Override
|
||||
public Text getDisplayName() {
|
||||
return new LiteralText(RegistryManager.BACKPACK_IDENTIFIER.toString());
|
||||
return Text.of(RegistryManager.BACKPACK_IDENTIFIER.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -116,7 +114,7 @@ public class ItemBackpack extends Item {
|
||||
}
|
||||
bi.onClose(player);
|
||||
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
|
||||
for (int slot = 0; slot < ItemBackpack.SLOTSIZE; slot++) {
|
||||
@ -138,7 +136,7 @@ public class ItemBackpack extends Item {
|
||||
}
|
||||
bi.onClose(player);
|
||||
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
|
||||
*
|
||||
*
|
||||
* @param blockEntity the block entity
|
||||
* @param stack the item stack
|
||||
* @return a list of found stack positions; an empty list at least
|
||||
|
Loading…
x
Reference in New Issue
Block a user