Port to 24w03b ()

* Deprecate FabricBlockSettings

* Deprecate FabricItemSettings

* Start on 24w03a

* Main menu :)

* Update mappings

* PayloadTypeRegistry

* Networking part 2 of many

* Networking part 3 of many

* Networking part 4 of many

* Recipe api

* Port Item API to 1.20.5

* Is this even right?

* Port FabricParticleTypes to 1.20.5

* Remove redundant fuel caching logic

* Remove fabric-containers-v0, deprecated since 2020

* Regsync work

* Adapt screen handler to new networking

* Update yarn + more work

* More mapping updates

* Compile fixes

* Checkstyle + small fixes

* Single and multiplayer fixes

* Handle play packets on main thread.

* Update mappings

* Even more networking

* Networking tests

* Fix todo's

* Update javadocs

* Networking API improvements

* Some small regsync refactors

* Fix handling of null NBT in NbtIngredient

* Update fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/api/object/builder/v1/block/FabricBlockSettings.java

Co-authored-by: ErrorCraft <51973682+ErrorCraft@users.noreply.github.com>

* Update fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/api/object/builder/v1/block/FabricBlockSettings.java

Co-authored-by: ErrorCraft <51973682+ErrorCraft@users.noreply.github.com>

* Add context objects

* ChannelInfoHolder.getPendingChannelsNames -> fabric_getPendingChannelsNames

* Fix crash

* send `c:register` packet for play phase instead of config ()

* Bump version

---------

Co-authored-by: ErrorCraft <51973682+ErrorCraft@users.noreply.github.com>
Co-authored-by: apple502j <33279053+apple502j@users.noreply.github.com>
Co-authored-by: Drex <nicknamedrex@gmail.com>
Co-authored-by: deirn <deirn@bai.lol>
This commit is contained in:
modmuss 2024-01-22 18:24:37 +00:00 committed by GitHub
parent e89ad72381
commit 7b70ea8a7a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
143 changed files with 2272 additions and 3480 deletions
fabric-object-builder-api-v1/src
main/java/net/fabricmc/fabric/api/object/builder/v1/block
testmod/java/net/fabricmc/fabric/test/object/builder

View file

@ -35,15 +35,9 @@ import net.fabricmc.fabric.mixin.object.builder.AbstractBlockAccessor;
import net.fabricmc.fabric.mixin.object.builder.AbstractBlockSettingsAccessor;
/**
* Fabric's version of Block.Settings. Adds additional methods and hooks
* not found in the original class.
*
* <p>Make note that this behaves slightly different from the
* vanilla counterpart, copying some settings that vanilla does not.
*
* <p>To use it, simply replace Block.Settings.of() with
* FabricBlockSettings.of().
* @deprecated replace with {@link AbstractBlock.Settings}
*/
@Deprecated
public class FabricBlockSettings extends AbstractBlock.Settings {
protected FabricBlockSettings() {
super();
@ -97,56 +91,74 @@ public class FabricBlockSettings extends AbstractBlock.Settings {
this.postProcess(otherAccessor.getPostProcessPredicate());
}
/**
* @deprecated replace with {@link AbstractBlock.Settings#create()}
*/
@Deprecated
public static FabricBlockSettings create() {
return new FabricBlockSettings();
}
/**
* @deprecated Use {@link FabricBlockSettings#create()} instead.
* @deprecated replace with {@link AbstractBlock.Settings#create()}
*/
@Deprecated
public static FabricBlockSettings of() {
return create();
}
/**
* @deprecated replace with {@link AbstractBlock.Settings#copy(AbstractBlock)}
*/
@Deprecated
public static FabricBlockSettings copyOf(AbstractBlock block) {
return new FabricBlockSettings(((AbstractBlockAccessor) block).getSettings());
}
/**
* @deprecated replace with {@link AbstractBlock.Settings#copy(AbstractBlock)}
*/
@Deprecated
public static FabricBlockSettings copyOf(AbstractBlock.Settings settings) {
return new FabricBlockSettings(settings);
}
@Deprecated
@Override
public FabricBlockSettings noCollision() {
super.noCollision();
return this;
}
@Deprecated
@Override
public FabricBlockSettings nonOpaque() {
super.nonOpaque();
return this;
}
@Deprecated
@Override
public FabricBlockSettings slipperiness(float value) {
super.slipperiness(value);
return this;
}
@Deprecated
@Override
public FabricBlockSettings velocityMultiplier(float velocityMultiplier) {
super.velocityMultiplier(velocityMultiplier);
return this;
}
@Deprecated
@Override
public FabricBlockSettings jumpVelocityMultiplier(float jumpVelocityMultiplier) {
super.jumpVelocityMultiplier(jumpVelocityMultiplier);
return this;
}
@Deprecated
@Override
public FabricBlockSettings sounds(BlockSoundGroup group) {
super.sounds(group);
@ -161,89 +173,105 @@ public class FabricBlockSettings extends AbstractBlock.Settings {
return this.luminance(levelFunction);
}
@Deprecated
@Override
public FabricBlockSettings luminance(ToIntFunction<BlockState> luminanceFunction) {
super.luminance(luminanceFunction);
return this;
}
@Deprecated
@Override
public FabricBlockSettings strength(float hardness, float resistance) {
super.strength(hardness, resistance);
return this;
}
@Deprecated
@Override
public FabricBlockSettings breakInstantly() {
super.breakInstantly();
return this;
}
@Deprecated
@Override
public FabricBlockSettings strength(float strength) {
super.strength(strength);
return this;
}
@Deprecated
@Override
public FabricBlockSettings ticksRandomly() {
super.ticksRandomly();
return this;
}
@Deprecated
@Override
public FabricBlockSettings dynamicBounds() {
super.dynamicBounds();
return this;
}
@Deprecated
@Override
public FabricBlockSettings dropsNothing() {
super.dropsNothing();
return this;
}
@Deprecated
@Override
public FabricBlockSettings dropsLike(Block block) {
super.dropsLike(block);
return this;
}
@Deprecated
@Override
public FabricBlockSettings air() {
super.air();
return this;
}
@Deprecated
@Override
public FabricBlockSettings allowsSpawning(AbstractBlock.TypedContextPredicate<EntityType<?>> predicate) {
super.allowsSpawning(predicate);
return this;
}
@Deprecated
@Override
public FabricBlockSettings solidBlock(AbstractBlock.ContextPredicate predicate) {
super.solidBlock(predicate);
return this;
}
@Deprecated
@Override
public FabricBlockSettings suffocates(AbstractBlock.ContextPredicate predicate) {
super.suffocates(predicate);
return this;
}
@Deprecated
@Override
public FabricBlockSettings blockVision(AbstractBlock.ContextPredicate predicate) {
super.blockVision(predicate);
return this;
}
@Deprecated
@Override
public FabricBlockSettings postProcess(AbstractBlock.ContextPredicate predicate) {
super.postProcess(predicate);
return this;
}
@Deprecated
@Override
public FabricBlockSettings emissiveLighting(AbstractBlock.ContextPredicate predicate) {
super.emissiveLighting(predicate);
@ -253,90 +281,105 @@ public class FabricBlockSettings extends AbstractBlock.Settings {
/**
* Make the block require tool to drop and slows down mining speed if the incorrect tool is used.
*/
@Deprecated
@Override
public FabricBlockSettings requiresTool() {
super.requiresTool();
return this;
}
@Deprecated
@Override
public FabricBlockSettings mapColor(MapColor color) {
super.mapColor(color);
return this;
}
@Deprecated
@Override
public FabricBlockSettings hardness(float hardness) {
super.hardness(hardness);
return this;
}
@Deprecated
@Override
public FabricBlockSettings resistance(float resistance) {
super.resistance(resistance);
return this;
}
@Deprecated
@Override
public FabricBlockSettings offset(AbstractBlock.OffsetType offsetType) {
super.offset(offsetType);
return this;
}
@Deprecated
@Override
public FabricBlockSettings noBlockBreakParticles() {
super.noBlockBreakParticles();
return this;
}
@Deprecated
@Override
public FabricBlockSettings requires(FeatureFlag... features) {
super.requires(features);
return this;
}
@Deprecated
@Override
public FabricBlockSettings mapColor(Function<BlockState, MapColor> mapColorProvider) {
super.mapColor(mapColorProvider);
return this;
}
@Deprecated
@Override
public FabricBlockSettings burnable() {
super.burnable();
return this;
}
@Deprecated
@Override
public FabricBlockSettings liquid() {
super.liquid();
return this;
}
@Deprecated
@Override
public FabricBlockSettings solid() {
super.solid();
return this;
}
@Deprecated
@Override
public FabricBlockSettings notSolid() {
super.notSolid();
return this;
}
@Deprecated
@Override
public FabricBlockSettings pistonBehavior(PistonBehavior pistonBehavior) {
super.pistonBehavior(pistonBehavior);
return this;
}
@Deprecated
@Override
public FabricBlockSettings instrument(Instrument instrument) {
super.instrument(instrument);
return this;
}
@Deprecated
@Override
public FabricBlockSettings replaceable() {
super.replaceable();
@ -354,11 +397,16 @@ public class FabricBlockSettings extends AbstractBlock.Settings {
return this;
}
/**
* @deprecated replace with {@link AbstractBlock.Settings#luminance(ToIntFunction)}
*/
@Deprecated
public FabricBlockSettings luminance(int luminance) {
this.luminance(ignored -> luminance);
return this;
}
@Deprecated
public FabricBlockSettings drops(Identifier dropTableId) {
((AbstractBlockSettingsAccessor) this).setLootTableId(dropTableId);
return this;
@ -367,7 +415,7 @@ public class FabricBlockSettings extends AbstractBlock.Settings {
/* FABRIC DELEGATE WRAPPERS */
/**
* @deprecated Please migrate to {@link FabricBlockSettings#mapColor(MapColor)}
* @deprecated Please migrate to {@link AbstractBlock.Settings#mapColor(MapColor)}
*/
@Deprecated
public FabricBlockSettings materialColor(MapColor color) {
@ -375,17 +423,22 @@ public class FabricBlockSettings extends AbstractBlock.Settings {
}
/**
* @deprecated Please migrate to {@link FabricBlockSettings#mapColor(DyeColor)}
* @deprecated Please migrate to {@link AbstractBlock.Settings#mapColor(DyeColor)}
*/
@Deprecated
public FabricBlockSettings materialColor(DyeColor color) {
return this.mapColor(color);
}
/**
* @deprecated Please migrate to {@link AbstractBlock.Settings#mapColor(DyeColor)}
*/
@Deprecated
public FabricBlockSettings mapColor(DyeColor color) {
return this.mapColor(color.getMapColor());
}
@Deprecated
public FabricBlockSettings collidable(boolean collidable) {
((AbstractBlockSettingsAccessor) this).setCollidable(collidable);
return this;

View file

@ -81,7 +81,7 @@ public class BlockEntityTypeBuilderTest implements ModInitializer {
}
@Override
public ActionResult method_55766(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) {
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) {
if (!world.isClient()) {
BlockEntity blockEntity = world.getBlockEntity(pos);

View file

@ -16,6 +16,7 @@
package net.fabricmc.fabric.test.object.builder;
import net.minecraft.block.AbstractBlock;
import net.minecraft.block.BlockSetType;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
@ -36,7 +37,6 @@ import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder;
import net.fabricmc.fabric.api.object.builder.v1.block.type.BlockSetTypeBuilder;
import net.fabricmc.fabric.api.object.builder.v1.block.type.WoodTypeBuilder;
@ -45,25 +45,25 @@ public class TealSignTest implements ModInitializer {
public static final Identifier TEAL_TYPE_ID = ObjectBuilderTestConstants.id("teal");
public static final BlockSetType TEAL_BLOCK_SET_TYPE = BlockSetTypeBuilder.copyOf(BlockSetType.OAK).build(TEAL_TYPE_ID);
public static final WoodType TEAL_WOOD_TYPE = WoodTypeBuilder.copyOf(WoodType.OAK).build(TEAL_TYPE_ID, TEAL_BLOCK_SET_TYPE);
public static final SignBlock TEAL_SIGN = new SignBlock(TEAL_WOOD_TYPE, FabricBlockSettings.copy(Blocks.OAK_SIGN)) {
public static final SignBlock TEAL_SIGN = new SignBlock(TEAL_WOOD_TYPE, AbstractBlock.Settings.copy(Blocks.OAK_SIGN)) {
@Override
public TealSign createBlockEntity(BlockPos pos, BlockState state) {
return new TealSign(pos, state);
}
};
public static final WallSignBlock TEAL_WALL_SIGN = new WallSignBlock(TEAL_WOOD_TYPE, FabricBlockSettings.copy(Blocks.OAK_SIGN)) {
public static final WallSignBlock TEAL_WALL_SIGN = new WallSignBlock(TEAL_WOOD_TYPE, AbstractBlock.Settings.copy(Blocks.OAK_SIGN)) {
@Override
public TealSign createBlockEntity(BlockPos pos, BlockState state) {
return new TealSign(pos, state);
}
};
public static final HangingSignBlock TEAL_HANGING_SIGN = new HangingSignBlock(TEAL_WOOD_TYPE, FabricBlockSettings.copy(Blocks.OAK_HANGING_SIGN)) {
public static final HangingSignBlock TEAL_HANGING_SIGN = new HangingSignBlock(TEAL_WOOD_TYPE, AbstractBlock.Settings.copy(Blocks.OAK_HANGING_SIGN)) {
@Override
public TealHangingSign createBlockEntity(BlockPos pos, BlockState state) {
return new TealHangingSign(pos, state);
}
};
public static final WallHangingSignBlock TEAL_WALL_HANGING_SIGN = new WallHangingSignBlock(TEAL_WOOD_TYPE, FabricBlockSettings.copy(Blocks.OAK_HANGING_SIGN)) {
public static final WallHangingSignBlock TEAL_WALL_HANGING_SIGN = new WallHangingSignBlock(TEAL_WOOD_TYPE, AbstractBlock.Settings.copy(Blocks.OAK_HANGING_SIGN)) {
@Override
public TealHangingSign createBlockEntity(BlockPos pos, BlockState state) {
return new TealHangingSign(pos, state);