1.17 changes

This commit is contained in:
Jörg Henke 2021-04-05 21:01:44 +02:00
parent 44d1e86f13
commit 808894c285
16 changed files with 49 additions and 52 deletions

View File

@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '0.5.25'
id 'fabric-loom' version '0.6-SNAPSHOT'
id 'maven-publish'
}

View File

@ -2,16 +2,16 @@
org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.16.5
yarn_mappings=1.16.5+build.1
loader_version=0.11.1
# check these on https://modmuss50.me/fabric.html
minecraft_version=21w13a
yarn_mappings=21w13a+build.51
loader_version=0.11.3
# Mod Properties
mod_version = 1.16.5.1
mod_version = 1.17.0
maven_group = de.jottyfan.minecraft
archives_base_name = quickiefabric
# Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
fabric_version=0.29.3+1.16
fabric_version=0.32.6+1.17

View File

@ -12,7 +12,7 @@ import net.minecraft.block.Material;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.loot.context.LootContext.Builder;
import net.minecraft.world.BlockView;
import net.minecraft.util.math.BlockPos;
/**
*
@ -25,8 +25,7 @@ public class BlockDrillDown extends FallingBlock implements BlockEntityProvider
super(FabricBlockSettings.of(Material.STONE).hardness(2.5f));
}
@Override
public BlockEntity createBlockEntity(BlockView world) {
public BlockEntity createBlockEntity(BlockPos pos, BlockState blockState) {
return new DrillBlockDownEntity();
}

View File

@ -12,7 +12,7 @@ import net.minecraft.block.Material;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.loot.context.LootContext.Builder;
import net.minecraft.world.BlockView;
import net.minecraft.util.math.BlockPos;
/**
*
@ -26,7 +26,7 @@ public class BlockDrillEast extends FallingBlock implements BlockEntityProvider
}
@Override
public BlockEntity createBlockEntity(BlockView world) {
public BlockEntity createBlockEntity(BlockPos pos, BlockState blockState) {
return new DrillBlockEastEntity();
}

View File

@ -12,7 +12,7 @@ import net.minecraft.block.Material;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.loot.context.LootContext.Builder;
import net.minecraft.world.BlockView;
import net.minecraft.util.math.BlockPos;
/**
*
@ -26,7 +26,7 @@ public class BlockDrillNorth extends FallingBlock implements BlockEntityProvider
}
@Override
public BlockEntity createBlockEntity(BlockView world) {
public BlockEntity createBlockEntity(BlockPos pos, BlockState blockState) {
return new DrillBlockNorthEntity();
}

View File

@ -12,7 +12,7 @@ import net.minecraft.block.Material;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.loot.context.LootContext.Builder;
import net.minecraft.world.BlockView;
import net.minecraft.util.math.BlockPos;
/**
*
@ -26,7 +26,7 @@ public class BlockDrillSouth extends FallingBlock implements BlockEntityProvider
}
@Override
public BlockEntity createBlockEntity(BlockView world) {
public BlockEntity createBlockEntity(BlockPos pos, BlockState blockState) {
return new DrillBlockSouthEntity();
}

View File

@ -12,7 +12,7 @@ import net.minecraft.block.Material;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.loot.context.LootContext.Builder;
import net.minecraft.world.BlockView;
import net.minecraft.util.math.BlockPos;
/**
*
@ -26,7 +26,7 @@ public class BlockDrillWest extends FallingBlock implements BlockEntityProvider
}
@Override
public BlockEntity createBlockEntity(BlockView world) {
public BlockEntity createBlockEntity(BlockPos pos, BlockState blockState) {
return new DrillBlockWestEntity();
}

View File

@ -22,7 +22,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.loot.context.LootContext.Builder;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
/**
@ -37,7 +36,7 @@ public class BlockEmptyLavahoarder extends Block implements BlockEntityProvider
}
@Override
public BlockEntity createBlockEntity(BlockView blockView) {
public BlockEntity createBlockEntity(BlockPos pos, BlockState blockState) {
return new EmptyLavaHoarderBlockEntity();
}

View File

@ -24,7 +24,6 @@ import net.minecraft.util.Hand;
import net.minecraft.util.ItemScatterer;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
/**
@ -39,7 +38,7 @@ public class BlockItemhoarder extends Block implements BlockEntityProvider {
}
@Override
public BlockEntity createBlockEntity(BlockView blockView) {
public BlockEntity createBlockEntity(BlockPos pos, BlockState blockState) {
return new ItemHoarderBlockEntity();
}

View File

@ -20,7 +20,6 @@ import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
/**
@ -35,7 +34,7 @@ public class BlockLavahoarder extends Block implements BlockEntityProvider {
}
@Override
public BlockEntity createBlockEntity(BlockView world) {
public BlockEntity createBlockEntity(BlockPos pos, BlockState blockState) {
return new EmptyLavaHoarderBlockEntity();
}

View File

@ -16,7 +16,6 @@ import net.minecraft.loot.context.LootContext.Builder;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
/**
@ -27,11 +26,11 @@ import net.minecraft.world.World;
public class BlockMonsterhoarder extends Block implements BlockEntityProvider {
public BlockMonsterhoarder() {
super(FabricBlockSettings.of(Material.WOOD).hardness(2.5f).lightLevel(20));
super(FabricBlockSettings.of(Material.WOOD).hardness(2.5f).luminance(20));
}
@Override
public BlockEntity createBlockEntity(BlockView blockView) {
public BlockEntity createBlockEntity(BlockPos pos, BlockState blockState) {
return new MonsterHoarderBlockEntity();
}

View File

@ -6,6 +6,7 @@ import net.minecraft.inventory.SimpleInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
import net.minecraft.util.Hand;
@ -18,7 +19,7 @@ import net.minecraft.util.Hand;
public class BackpackInventory extends SimpleInventory {
private Hand hand;
private BackpackInventory(CompoundTag tag, BackpackScreenHandler handler) {
private BackpackInventory(NbtCompound tag, BackpackScreenHandler handler) {
super(ItemBackpack.SLOTSIZE);
readItemsFromTag(super.size(), tag);
}
@ -35,10 +36,10 @@ public class BackpackInventory extends SimpleInventory {
private final static ItemStack init(ItemStack stack) {
if (stack != null) {
if (!stack.hasTag()) {
stack.setTag(new CompoundTag());
stack.setTag(new NbtCompound());
}
if (!stack.getTag().contains("backpack")) {
stack.getTag().put("backpack", new CompoundTag());
stack.getTag().put("backpack", new NbtCompound());
}
}
return stack;
@ -56,7 +57,7 @@ public class BackpackInventory extends SimpleInventory {
ItemStack stack = player.getStackInHand(hand);
if (stack != null) {
if (!stack.hasTag()) {
stack.setTag(new CompoundTag());
stack.setTag(new NbtCompound());
}
stack.getTag().put("backpack", writeItemsToTag());
}
@ -64,10 +65,10 @@ public class BackpackInventory extends SimpleInventory {
player.playSound(SoundEvents.BLOCK_WOOL_PLACE, SoundCategory.PLAYERS, 1f, 1f);
}
private void readItemsFromTag(Integer size, CompoundTag tag) {
private void readItemsFromTag(Integer size, NbtCompound tag) {
ListTag listTag = tag.getList("items", 10);
for (int i = 0; i < listTag.size(); ++i) {
CompoundTag compoundTag = listTag.getCompound(i);
NbtCompound compoundTag = listTag.getCompound(i);
int slot = compoundTag.getInt("slot");
if (slot >= 0 && slot < size) {
@ -76,18 +77,18 @@ public class BackpackInventory extends SimpleInventory {
}
}
private CompoundTag writeItemsToTag() {
private NbtCompound writeItemsToTag() {
ListTag listTag = new ListTag();
for (int i = 0; i < super.size(); ++i) {
ItemStack itemStack = (ItemStack) super.getStack(i);
if (!(itemStack == null) && !itemStack.isEmpty()) {
CompoundTag compoundTag = new CompoundTag();
NbtCompound compoundTag = new NbtCompound();
compoundTag.putInt("slot", i);
compoundTag = itemStack.toTag(compoundTag);
itemStack.setTag(compoundTag);
listTag.add(compoundTag);
}
}
CompoundTag tag = new CompoundTag();
NbtCompound tag = new NbtCompound();
tag.put("items", listTag);
return tag;
}

View File

@ -69,22 +69,21 @@ public class BackpackScreenHandler extends ScreenHandler {
}
@Override
public ItemStack onSlotClick(int slotId, int quickCraftData, SlotActionType actionType, PlayerEntity playerEntity) {
public void onSlotClick(int slotId, int quickCraftData, SlotActionType actionType, PlayerEntity playerEntity) {
Slot slot = slotId >= 0 && slotId < this.slots.size() ? this.slots.get(slotId) : null;
ItemStack stack = slot == null ? ItemStack.EMPTY : slot.getStack();
if (actionType.equals(SlotActionType.PICKUP) || actionType.equals(SlotActionType.PICKUP_ALL)
|| actionType.equals(SlotActionType.SWAP)) {
if (stack.getName().equals(thisStack.getName())) {
return stack; // omit to put the backpack into itself; as a side effect, omits adding same
return; // omit to put the backpack into itself; as a side effect, omits adding same
// colored backpacks into this one
}
return super.onSlotClick(slotId, quickCraftData, actionType, playerEntity);
super.onSlotClick(slotId, quickCraftData, actionType, playerEntity);
} else {
if (playerEntity.world.isClient) {
LOGGER.debug("ignoring action type {} on slotId {} for {} x {}", actionType.toString(), slotId, stack.getCount(),
stack.getItem().toString());
}
return stack;
}
}

View File

@ -46,6 +46,8 @@ import net.minecraft.util.ActionResult;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.BuiltinRegistries;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.gen.HeightContext;
import net.minecraft.world.gen.YOffset;
import net.minecraft.world.gen.decorator.Decorator;
import net.minecraft.world.gen.decorator.RangeDecoratorConfig;
import net.minecraft.world.gen.feature.ConfiguredFeature;
@ -69,32 +71,32 @@ public class RegistryManager {
public static final ConfiguredFeature<?, ?> FEATURE_ORENETHERSULPHOR = Feature.ORE
.configure(new OreFeatureConfig(OreFeatureConfig.Rules.BASE_STONE_NETHER,
QuickieBlocks.ORE_NETHER_SULPHOR.getDefaultState(), 24))
.decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(0, 0, 128)).spreadHorizontally().repeat(10));
.decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(YOffset.aboveBottom(0), YOffset.belowTop(128))).spreadHorizontally().repeat(10));
public static final ConfiguredFeature<?, ?> FEATURE_ORESALPETER = Feature.ORE
.configure(new OreFeatureConfig(OreFeatureConfig.Rules.BASE_STONE_OVERWORLD,
QuickieBlocks.ORE_SALPETER.getDefaultState(), 12))
.decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(0, 0, 128))).spreadHorizontally().repeat(10);
.decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(YOffset.aboveBottom(0), YOffset.belowTop(128)))).spreadHorizontally().repeat(10);
public static final ConfiguredFeature<?, ?> FEATURE_ORESULPHOR = Feature.ORE
.configure(new OreFeatureConfig(OreFeatureConfig.Rules.BASE_STONE_OVERWORLD,
QuickieBlocks.ORE_SULPHOR.getDefaultState(), 16))
.decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(4, 32, 255))).spreadHorizontally().repeat(4);
.decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(YOffset.aboveBottom(32), YOffset.belowTop(255)))).spreadHorizontally().repeat(4);
public static final ConfiguredFeature<?, ?> FEATURE_DIRTSALPETER = Feature.ORE
.configure(
new OreFeatureConfig(new BlockMatchRuleTest(Blocks.DIRT), QuickieBlocks.DIRT_SALPETER.getDefaultState(), 3))
.decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(4, 0, 255))).spreadHorizontally().repeatRandomly(4);
.decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(YOffset.aboveBottom(0), YOffset.belowTop(255)))).spreadHorizontally().repeatRandomly(4);
public static final ConfiguredFeature<?, ?> FEATURE_SANDSALPETER = Feature.ORE
.configure(
new OreFeatureConfig(new BlockMatchRuleTest(Blocks.SAND), QuickieBlocks.SAND_SALPETER.getDefaultState(), 3))
.decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(4, 0, 255))).spreadHorizontally().repeatRandomly(4);
.decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(YOffset.aboveBottom(0), YOffset.belowTop(255)))).spreadHorizontally().repeatRandomly(4);
public static final ConfiguredFeature<?, ?> FEATURE_ORESANDSALPETER = Feature.ORE
.configure(new OreFeatureConfig(new BlockMatchRuleTest(Blocks.SANDSTONE),
QuickieBlocks.ORE_SAND_SALPETER.getDefaultState(), 3))
.decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(4, 0, 255))).spreadHorizontally().repeatRandomly(4);
.decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(YOffset.aboveBottom(0), YOffset.belowTop(255)))).spreadHorizontally().repeatRandomly(4);
public static final List<ConfiguredFeature<?, ?>> FEATURE_UNDERGROUND_ORES = Arrays.asList(FEATURE_ORESALPETER,
FEATURE_ORESULPHOR, FEATURE_DIRTSALPETER, FEATURE_SANDSALPETER, FEATURE_ORESANDSALPETER);

View File

@ -25,7 +25,7 @@ import net.minecraft.util.Identifier;
public interface ToolRangeable {
public static final Set<Block> SHOVEL_EFFECTIVE_ON = Sets
.newHashSet(new Block[] { Blocks.GRAVEL, Blocks.SAND, Blocks.GRASS_BLOCK, Blocks.DIRT, Blocks.CLAY,
Blocks.FARMLAND, Blocks.GRASS_PATH, Blocks.RED_SAND, Blocks.SOUL_SAND });
Blocks.FARMLAND, Blocks.DIRT_PATH, Blocks.RED_SAND, Blocks.SOUL_SAND });
public static final Set<Identifier> SHOVEL_EXTERNAL_EFFECTIVE_ON = mergeSets(
Byg.createFromStrings("black_sand", "white_sand", "peat", "meadow_dirt", "mud_block", "blue_sand", "purple_sand"),

View File

@ -11,7 +11,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.PickaxeItem;
import net.minecraft.item.ToolMaterials;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtCompound;
/**
*
@ -29,7 +29,7 @@ public class ToolSpeedpowderPickaxe extends PickaxeItem implements ToolRangeable
@Override
public HarvestRange getRange(ItemStack stack) {
CompoundTag tag = stack.getTag();
NbtCompound tag = stack.getTag();
int[] range = tag.getIntArray("range");
if (range.length < 3) {
range = DEFAULT_HARVEST_RANGE;
@ -40,7 +40,7 @@ public class ToolSpeedpowderPickaxe extends PickaxeItem implements ToolRangeable
@Override
public boolean canBreakNeighbors(BlockState blockIn) {
return super.isEffectiveOn(blockIn) || PICKAXE_EFFECTIVE_ON.contains(blockIn.getBlock());
return super.isSuitableFor(blockIn) || PICKAXE_EFFECTIVE_ON.contains(blockIn.getBlock());
}
@Override
@ -49,7 +49,7 @@ public class ToolSpeedpowderPickaxe extends PickaxeItem implements ToolRangeable
}
public void setPlusRange(ItemStack stack, Integer plusRange) {
CompoundTag tag = stack.getTag();
NbtCompound tag = stack.getTag();
int[] range = tag.getIntArray("range");
if (range.length < 3) {
range = DEFAULT_HARVEST_RANGE;