Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update mod to Minecraft snapshot 24w39a #4121

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void onInitialize() {
// - assign a loot table to the nitwit villager type
// - right-clicking a 'test_event' block will emit a 'test_event' game event, which will have a sculk sensor frequency of 2
// - instant health potions can be brewed from awkward potions with any item in the 'minecraft:small_flowers' tag
// - if Bundle experiment is enabled, luck potions can be brewed from awkward potions with a bundle
// - if Redstone Experiments experiment is enabled, luck potions can be brewed from awkward potions with a bundle
// - dirty potions can be brewed by adding any item in the 'minecraft:dirt' tag to any standard potion

CompostingChanceRegistry.INSTANCE.add(Items.OBSIDIAN, 0.5F);
Expand Down Expand Up @@ -180,7 +180,7 @@ public void onInitialize() {
builder.registerItemRecipe(Items.POTION, Ingredient.fromTag(Registries.ITEM.getOrThrow(ItemTags.DIRT)), dirtyPotion);
builder.registerPotionRecipe(Potions.AWKWARD, Ingredient.fromTag(Registries.ITEM.getOrThrow(ItemTags.SMALL_FLOWERS)), Potions.HEALING);

if (builder.getEnabledFeatures().contains(FeatureFlags.BUNDLE)) {
if (builder.getEnabledFeatures().contains(FeatureFlags.REDSTONE_EXPERIMENTS)) {
builder.registerPotionRecipe(Potions.AWKWARD, Ingredient.ofItems(Items.BUNDLE), Potions.LUCK);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import net.minecraft.entity.EntityType;
import net.minecraft.registry.RegistryWrapper;
import net.minecraft.registry.tag.EntityTypeTags;

import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider;
Expand All @@ -44,8 +45,16 @@ protected void configure(RegistryWrapper.WrapperLookup registries) {
.add(EntityType.HOPPER_MINECART)
.add(EntityType.SPAWNER_MINECART);
getOrCreateTagBuilder(ConventionalEntityTypeTags.BOATS)
.add(EntityType.BOAT)
.add(EntityType.CHEST_BOAT);
.addOptionalTag(EntityTypeTags.BOAT)
.add(EntityType.OAK_CHEST_BOAT)
.add(EntityType.SPRUCE_CHEST_BOAT)
.add(EntityType.BIRCH_CHEST_BOAT)
.add(EntityType.JUNGLE_CHEST_BOAT)
.add(EntityType.ACACIA_CHEST_BOAT)
.add(EntityType.CHERRY_CHEST_BOAT)
.add(EntityType.DARK_OAK_CHEST_BOAT)
.add(EntityType.MANGROVE_CHEST_BOAT)
.add(EntityType.BAMBOO_CHEST_RAFT);
getOrCreateTagBuilder(ConventionalEntityTypeTags.CAPTURING_NOT_SUPPORTED);
getOrCreateTagBuilder(ConventionalEntityTypeTags.TELEPORTING_NOT_SUPPORTED);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
{
"values": [
"minecraft:boat",
"minecraft:chest_boat"
{
"id": "#minecraft:boat",
"required": false
},
"minecraft:oak_chest_boat",
"minecraft:spruce_chest_boat",
"minecraft:birch_chest_boat",
"minecraft:jungle_chest_boat",
"minecraft:acacia_chest_boat",
"minecraft:cherry_chest_boat",
"minecraft:dark_oak_chest_boat",
"minecraft:mangrove_chest_boat",
"minecraft:bamboo_chest_raft"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,19 @@ private void notifyDeath(DamageSource source, CallbackInfo ci) {
}

@Redirect(method = "damage", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;isDead()Z", ordinal = 1))
boolean beforeEntityKilled(LivingEntity livingEntity, DamageSource source, float amount) {
boolean beforeEntityKilled(LivingEntity livingEntity, ServerWorld world, DamageSource source, float amount) {
return isDead() && ServerLivingEntityEvents.ALLOW_DEATH.invoker().allowDeath(livingEntity, source, amount);
}

@Inject(method = "damage", at = @At(value = "INVOKE", target = "net/minecraft/entity/LivingEntity.isSleeping()Z"), cancellable = true)
private void beforeDamage(DamageSource source, float amount, CallbackInfoReturnable<Boolean> cir) {
private void beforeDamage(ServerWorld world, DamageSource source, float amount, CallbackInfoReturnable<Boolean> cir) {
if (!ServerLivingEntityEvents.ALLOW_DAMAGE.invoker().allowDamage((LivingEntity) (Object) this, source, amount)) {
cir.setReturnValue(false);
}
}

@Inject(method = "damage", at = @At("TAIL"), locals = LocalCapture.CAPTURE_FAILHARD)
private void afterDamage(DamageSource source, float amount, CallbackInfoReturnable<Boolean> cir, float dealt, boolean blocked) {
private void afterDamage(ServerWorld world, DamageSource source, float amount, CallbackInfoReturnable<Boolean> cir, float dealt, boolean blocked) {
if (!isDead()) {
ServerLivingEntityEvents.AFTER_DAMAGE.invoker().afterDamage((LivingEntity) (Object) this, source, dealt, amount, blocked);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public void increaseStat(Stat<?> stat, int amount) { }
public void resetStat(Stat<?> stat) { }

@Override
public boolean isInvulnerableTo(DamageSource damageSource) {
public boolean isInvulnerableTo(ServerWorld world, DamageSource damageSource) {
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,21 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.ingame.AbstractInventoryScreen;
import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen;
import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen.CreativeScreenHandler;
import net.minecraft.client.gui.screen.ingame.HandledScreen;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemGroups;
import net.minecraft.screen.ScreenHandler;
import net.minecraft.text.Text;

import net.fabricmc.fabric.api.client.itemgroup.v1.FabricCreativeInventoryScreen;
import net.fabricmc.fabric.impl.client.itemgroup.FabricCreativeGuiComponents;
import net.fabricmc.fabric.impl.itemgroup.FabricItemGroupImpl;

@Mixin(CreativeInventoryScreen.class)
public abstract class CreativeInventoryScreenMixin<T extends ScreenHandler> extends AbstractInventoryScreen<T> implements FabricCreativeInventoryScreen {
public CreativeInventoryScreenMixin(T screenHandler, PlayerInventory playerInventory, Text text) {
public abstract class CreativeInventoryScreenMixin extends HandledScreen<CreativeScreenHandler> implements FabricCreativeInventoryScreen {
public CreativeInventoryScreenMixin(CreativeScreenHandler screenHandler, PlayerInventory playerInventory, Text text) {
super(screenHandler, playerInventory, text);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
import net.minecraft.fluid.FluidState;
import net.minecraft.item.Item;
import net.minecraft.item.Items;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.sound.SoundEvent;
import net.minecraft.sound.SoundEvents;
import net.minecraft.state.StateManager;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;

Expand All @@ -57,7 +57,7 @@ public Item getBucketItem() {
}

@Override
protected boolean isInfinite(World world) {
protected boolean isInfinite(ServerWorld world) {
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
import net.minecraft.fluid.FluidState;
import net.minecraft.item.Item;
import net.minecraft.item.Items;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.sound.SoundEvent;
import net.minecraft.sound.SoundEvents;
import net.minecraft.state.StateManager;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;

Expand All @@ -57,7 +57,7 @@ public Item getBucketItem() {
}

@Override
protected boolean isInfinite(World world) {
protected boolean isInfinite(ServerWorld world) {
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
import net.minecraft.fluid.FluidState;
import net.minecraft.item.Item;
import net.minecraft.item.Items;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.sound.SoundEvent;
import net.minecraft.sound.SoundEvents;
import net.minecraft.state.StateManager;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;

Expand All @@ -57,7 +57,7 @@ public Item getBucketItem() {
}

@Override
protected boolean isInfinite(World world) {
protected boolean isInfinite(ServerWorld world) {
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
import net.minecraft.fluid.FluidState;
import net.minecraft.item.Item;
import net.minecraft.item.Items;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.sound.SoundEvent;
import net.minecraft.sound.SoundEvents;
import net.minecraft.state.StateManager;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;

Expand All @@ -57,7 +57,7 @@ public Item getBucketItem() {
}

@Override
protected boolean isInfinite(World world) {
protected boolean isInfinite(ServerWorld world) {
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,14 @@ public void anyModsLoaded(TestContext context) {
public void featuresEnabled(TestContext context) {
ResourceCondition vanilla = ResourceConditions.featuresEnabled(FeatureFlags.VANILLA);
// Reminder: GameTest enables all features by default
ResourceCondition vanillaAndBundle = ResourceConditions.featuresEnabled(FeatureFlags.VANILLA, FeatureFlags.BUNDLE);
ResourceCondition vanillaAndRedstoneExperiments = ResourceConditions.featuresEnabled(FeatureFlags.VANILLA, FeatureFlags.REDSTONE_EXPERIMENTS);
Identifier unknownId = Identifier.of(TESTMOD_ID, "unknown_feature_to_test_condition");
ResourceCondition unknown = ResourceConditions.featuresEnabled(unknownId);
// Passing an array to avoid type ambiguity
ResourceCondition empty = ResourceConditions.featuresEnabled(new FeatureFlag[]{});

expectCondition(context, "vanilla only", vanilla, true);
expectCondition(context, "vanilla and bundle", vanillaAndBundle, true);
expectCondition(context, "vanilla and redstone experiments", vanillaAndRedstoneExperiments, true);
expectCondition(context, "unknown feature ID", unknown, false);
expectCondition(context, "no feature", empty, true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"condition": "fabric:features_enabled",
"features": [
"minecraft:vanilla",
"minecraft:bundle"
"minecraft:redstone_experiments"
]
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ private CreateWorldScreenMixin() {
super(null);
}

@ModifyVariable(method = "show(Lnet/minecraft/client/MinecraftClient;Lnet/minecraft/client/gui/screen/Screen;Ljava/util/function/Function;Lnet/minecraft/client/world/GeneratorOptionsFactory;Lnet/minecraft/registry/RegistryKey;Lnet/minecraft/class_10241;)V",
@ModifyVariable(method = "show(Lnet/minecraft/client/MinecraftClient;Lnet/minecraft/client/gui/screen/Screen;Ljava/util/function/Function;Lnet/minecraft/client/world/GeneratorOptionsFactory;Lnet/minecraft/registry/RegistryKey;Lnet/minecraft/client/gui/screen/world/CreateWorldCallback;)V",
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/world/CreateWorldScreen;createServerConfig(Lnet/minecraft/resource/ResourcePackManager;Lnet/minecraft/resource/DataConfiguration;)Lnet/minecraft/server/SaveLoading$ServerConfig;"))
private static ResourcePackManager onCreateResManagerInit(ResourcePackManager manager) {
// Add mod data packs to the initial res pack manager so they are active even if the user doesn't use custom data packs
manager.providers.add(new ModResourcePackCreator(ResourceType.SERVER_DATA));
return manager;
}

@Redirect(method = "show(Lnet/minecraft/client/MinecraftClient;Lnet/minecraft/client/gui/screen/Screen;Ljava/util/function/Function;Lnet/minecraft/client/world/GeneratorOptionsFactory;Lnet/minecraft/registry/RegistryKey;Lnet/minecraft/class_10241;)V",
@Redirect(method = "show(Lnet/minecraft/client/MinecraftClient;Lnet/minecraft/client/gui/screen/Screen;Ljava/util/function/Function;Lnet/minecraft/client/world/GeneratorOptionsFactory;Lnet/minecraft/registry/RegistryKey;Lnet/minecraft/client/gui/screen/world/CreateWorldCallback;)V",
at = @At(value = "FIELD", target = "Lnet/minecraft/resource/DataConfiguration;SAFE_MODE:Lnet/minecraft/resource/DataConfiguration;", ordinal = 0))
private static DataConfiguration replaceDefaultSettings() {
return ModResourcePackUtil.createDefaultDataConfiguration();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ protected void onFinalCommit() {
location.setBlockState(newState);

if (newLevel == 7) {
location.world.method_64310(location.pos, state.getBlock(), 20);
location.world.scheduleBlockTick(location.pos, state.getBlock(), 20);
}
}

Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ org.gradle.parallel=true
fabric.loom.multiProjectOptimisation=true

version=0.105.0
minecraft_version=24w38a
yarn_version=+build.2
minecraft_version=24w39a
yarn_version=+build.4
loader_version=0.16.4
installer_version=1.0.1

Expand Down
Loading