This commit is contained in:
modmuss50 2023-11-16 17:01:20 +00:00
parent a2e8758a92
commit 6f7ba8f277
13 changed files with 53 additions and 52 deletions
fabric-data-generation-api-v1/src/main
fabric-game-rule-api-v1/src/client/java/net/fabricmc/fabric/mixin/gamerule/client
fabric-item-group-api-v1/src
client/java/net/fabricmc/fabric/impl/client/itemgroup
main/java/net/fabricmc/fabric
impl/itemgroup
mixin/itemgroup
fabric-networking-api-v1/src/testmodClient/java/net/fabricmc/fabric/test/networking/client/channeltest
fabric-screen-api-v1/src/testmodClient/java/net/fabricmc/fabric/test/screen
fabric-transitive-access-wideners-v1/src/main/resources
gradle.properties

View file

@ -87,7 +87,7 @@ public abstract class FabricAdvancementProvider implements DataProvider {
throw new IllegalStateException("Duplicate advancement " + advancement.id());
}
JsonObject advancementJson = Util.getResult(Advancement.field_47179.encodeStart(JsonOps.INSTANCE, advancement.value()), IllegalStateException::new).getAsJsonObject();
JsonObject advancementJson = Util.getResult(Advancement.CODEC.encodeStart(JsonOps.INSTANCE, advancement.value()), IllegalStateException::new).getAsJsonObject();
ConditionJsonProvider.write(advancementJson, FabricDataGenHelper.consumeConditions(advancement));
futures.add(DataProvider.writeToPath(writer, advancementJson, getOutputPath(advancement)));

View file

@ -96,14 +96,14 @@ public abstract class FabricRecipeProvider extends RecipeProvider {
throw new IllegalStateException("Duplicate recipe " + identifier);
}
JsonObject recipeJson = Util.getResult(Recipe.field_47319.encodeStart(JsonOps.INSTANCE, recipe), IllegalStateException::new).getAsJsonObject();
JsonObject recipeJson = Util.getResult(Recipe.CODEC.encodeStart(JsonOps.INSTANCE, recipe), IllegalStateException::new).getAsJsonObject();
ConditionJsonProvider[] conditions = FabricDataGenHelper.consumeConditions(recipe);
ConditionJsonProvider.write(recipeJson, conditions);
list.add(DataProvider.writeToPath(writer, recipeJson, recipesPathResolver.resolveJson(identifier)));
if (advancement != null) {
JsonObject advancementJson = Util.getResult(Advancement.field_47179.encodeStart(JsonOps.INSTANCE, advancement.value()), IllegalStateException::new).getAsJsonObject();
JsonObject advancementJson = Util.getResult(Advancement.CODEC.encodeStart(JsonOps.INSTANCE, advancement.value()), IllegalStateException::new).getAsJsonObject();
ConditionJsonProvider.write(advancementJson, conditions);
list.add(DataProvider.writeToPath(writer, advancementJson, advancementsPathResolver.resolveJson(getRecipeIdentifier(advancement.id()))));
}

View file

@ -124,10 +124,10 @@ transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider off
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerSmithingTemplateCopyingRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider generateCookingRecipes (Lnet/minecraft/data/server/recipe/RecipeExporter;Ljava/lang/String;Lnet/minecraft/recipe/RecipeSerializer;Lnet/minecraft/recipe/AbstractCookingRecipe$RecipeFactory;I)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerFoodCookingRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Ljava/lang/String;Lnet/minecraft/recipe/RecipeSerializer;Lnet/minecraft/recipe/AbstractCookingRecipe$RecipeFactory;ILnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;F)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerWaxingRecipes (Lnet/minecraft/data/server/recipe/RecipeExporter;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerWaxingRecipes (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/resource/featuretoggle/FeatureSet;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerGrateRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerBulbRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider generateFamily (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/data/family/BlockFamily;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider generateFamily (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/data/family/BlockFamily;Lnet/minecraft/resource/featuretoggle/FeatureSet;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider getVariantRecipeInput (Lnet/minecraft/data/family/BlockFamily;Lnet/minecraft/data/family/BlockFamily$Variant;)Lnet/minecraft/block/Block;
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider requireEnteringFluid (Lnet/minecraft/block/Block;)Lnet/minecraft/advancement/AdvancementCriterion;
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider conditionsFromItem (Lnet/minecraft/predicate/NumberRange$IntRange;Lnet/minecraft/item/ItemConvertible;)Lnet/minecraft/advancement/AdvancementCriterion;

View file

@ -39,8 +39,8 @@ public abstract class EditGameRulesScreenRuleListWidgetMixin extends net.minecra
@Unique
private final Map<CustomGameRuleCategory, List<EditGameRulesScreen.AbstractRuleWidget>> fabricCategories = new HashMap<>();
public EditGameRulesScreenRuleListWidgetMixin(MinecraftClient client, int width, int height, int top, int bottom, int itemHeight) {
super(client, width, height, top, bottom, itemHeight);
public EditGameRulesScreenRuleListWidgetMixin(MinecraftClient client, int width, int height, int top, int itemHeight) {
super(client, width, height, top, itemHeight);
}
// EditGameRulesScreen is effectively a synthetic parameter

View file

@ -30,8 +30,11 @@ import net.minecraft.registry.Registries;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import net.fabricmc.fabric.impl.itemgroup.FabricItemGroup;
public class FabricCreativeGuiComponents {
private static final Identifier BUTTON_TEX = new Identifier("fabric", "textures/gui/creative_buttons.png");
private static final double TABS_PER_PAGE = FabricItemGroup.TABS_PER_PAGE;
public static final Set<ItemGroup> COMMON_GROUPS = Set.of(ItemGroups.SEARCH, ItemGroups.INVENTORY, ItemGroups.HOTBAR).stream()
.map(Registries.ITEM_GROUP::getOrThrow)
.collect(Collectors.toSet());
@ -49,21 +52,16 @@ public class FabricCreativeGuiComponents {
}
@Override
public void render(DrawContext drawContext, int mouseX, int mouseY, float float_1) {
this.hovered = mouseX >= this.getX() && mouseY >= this.getY() && mouseX < this.getX() + this.width && mouseY < this.getY() + this.height;
this.visible = extensions.fabric_isButtonVisible(type);
this.active = extensions.fabric_isButtonEnabled(type);
protected void renderButton(DrawContext drawContext, int mouseX, int mouseY, float delta) {
int pageCount = (int) Math.ceil((ItemGroups.getGroupsToDisplay().size() - COMMON_GROUPS.size()) / TABS_PER_PAGE);
this.active = type.isActive(extensions.fabric_currentPage(), pageCount);
if (this.visible) {
int u = active && this.isHovered() ? 22 : 0;
int v = active ? 0 : 12;
int u = active && this.isHovered() ? 22 : 0;
int v = active ? 0 : 12;
drawContext.drawTexture(BUTTON_TEX, this.getX(), this.getY(), u + (type == Type.NEXT ? 11 : 0), v, 11, 12);
drawContext.drawTexture(BUTTON_TEX, this.getX(), this.getY(), u + (type == Type.NEXT ? 11 : 0), v, 11, 12);
if (this.hovered) {
int pageCount = (int) Math.ceil((ItemGroups.getGroupsToDisplay().size() - COMMON_GROUPS.size()) / 9D);
drawContext.drawTooltip(MinecraftClient.getInstance().textRenderer, Text.translatable("fabric.gui.creativeTabPage", extensions.fabric_currentPage() + 1, pageCount), mouseX, mouseY);
}
if (this.isHovered()) {
drawContext.drawTooltip(MinecraftClient.getInstance().textRenderer, Text.translatable("fabric.gui.creativeTabPage", extensions.fabric_currentPage() + 1, pageCount), mouseX, mouseY);
}
}
}
@ -79,5 +77,13 @@ public class FabricCreativeGuiComponents {
this.text = text;
this.clickConsumer = clickConsumer;
}
private boolean isActive(int currentPage, int pageCount) {
if (this == NEXT) {
return currentPage < pageCount -1;
}
return currentPage > 0;
}
}
}

View file

@ -17,6 +17,8 @@
package net.fabricmc.fabric.impl.itemgroup;
public interface FabricItemGroup {
int TABS_PER_PAGE = 10;
int getPage();
void setPage(int page);

View file

@ -51,7 +51,7 @@ import net.fabricmc.fabric.impl.itemgroup.FabricItemGroup;
@Mixin(ItemGroups.class)
public class ItemGroupsMixin {
@Unique
private static final int TABS_PER_PAGE = 10;
private static final int TABS_PER_PAGE = FabricItemGroup.TABS_PER_PAGE;
@Inject(method = "collect", at = @At("HEAD"), cancellable = true)
private static void collect(CallbackInfo ci) {

View file

@ -25,8 +25,8 @@ import net.minecraft.util.Formatting;
import net.minecraft.util.Identifier;
final class ChannelList extends EntryListWidget<ChannelList.Entry> {
ChannelList(MinecraftClient client, int width, int height, int top, int bottom, int itemHeight) {
super(client, width, height, top, bottom, itemHeight);
ChannelList(MinecraftClient client, int width, int height, int top, int itemHeight) {
super(client, width, height, top, itemHeight);
}
@Override
@ -39,7 +39,7 @@ final class ChannelList extends EntryListWidget<ChannelList.Entry> {
}
@Override
public void appendNarrations(NarrationMessageBuilder arg) {
public void appendClickableNarrations(NarrationMessageBuilder arg) {
// TODO seems to be possibly accessibility related
}

View file

@ -54,7 +54,7 @@ final class ChannelScreen extends Screen {
.position(this.width / 2 - 60, this.height - 25)
.size(120, 20)
.build());
this.channelList = this.addDrawable(new ChannelList(this.client, this.width, this.height - 60, 30, this.height - 30, this.textRenderer.fontHeight + 2));
this.channelList = this.addDrawable(new ChannelList(this.client, this.width, this.height - 60, 30, this.textRenderer.fontHeight + 2));
}
@Override

View file

@ -59,7 +59,7 @@ public final class ScreenTests implements ClientModInitializer {
// Add a new button
buttons.add(new SoundButton((screen.width / 2) + 2, ((screen.height / 4) + 96), 72, 20));
// And another button
buttons.add(new StopSoundButton(screen, (screen.width / 2) + 80, ((screen.height / 4) + 95), 20, 20));
buttons.add(new StopSoundButton((screen.width / 2) + 80, ((screen.height / 4) + 95), 20, 20));
// Testing:
// Some automatic validation that the screen list works, make sure the buttons we added are on the list of child elements

View file

@ -18,28 +18,21 @@ package net.fabricmc.fabric.test.screen;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder;
import net.minecraft.client.gui.widget.PressableWidget;
import net.minecraft.text.Text;
import net.fabricmc.fabric.api.client.screen.v1.Screens;
class StopSoundButton extends PressableWidget {
private final Screen screen;
StopSoundButton(Screen screen, int x, int y, int width, int height) {
StopSoundButton(int x, int y, int width, int height) {
super(x, y, width, height, Text.of(""));
this.screen = screen;
}
@Override
public void render(DrawContext drawContext, int mouseX, int mouseY, float tickDelta) {
// Render the armor icon to test
protected void renderButton(DrawContext drawContext, int mouseX, int mouseY, float delta) {
drawContext.drawGuiTexture(ScreenTests.ARMOR_FULL_TEXTURE, this.getX(), this.getY(), this.width, this.height);
if (this.isMouseOver(mouseX, mouseY)) {
drawContext.drawTooltip(Screens.getTextRenderer(this.screen), Text.literal("Click to stop all sounds"), this.getX(), this.getY());
if (this.isHovered()) {
drawContext.drawTooltip(MinecraftClient.getInstance().textRenderer, Text.literal("Click to stop all sounds"), this.getX(), this.getY());
}
}

View file

@ -310,7 +310,7 @@ transitive-accessible field net/minecraft/client/render/RenderPhase GUI_PROGRAM
transitive-accessible field net/minecraft/client/render/RenderPhase GUI_OVERLAY_PROGRAM Lnet/minecraft/client/render/RenderPhase$ShaderProgram;
transitive-accessible field net/minecraft/client/render/RenderPhase GUI_TEXT_HIGHLIGHT_PROGRAM Lnet/minecraft/client/render/RenderPhase$ShaderProgram;
transitive-accessible field net/minecraft/client/render/RenderPhase GUI_GHOST_RECIPE_OVERLAY_PROGRAM Lnet/minecraft/client/render/RenderPhase$ShaderProgram;
transitive-accessible field net/minecraft/client/render/RenderPhase field_47463 Lnet/minecraft/client/render/RenderPhase$ShaderProgram;
transitive-accessible field net/minecraft/client/render/RenderPhase BREEZE_WIND_PROGRAM Lnet/minecraft/client/render/RenderPhase$ShaderProgram;
transitive-accessible field net/minecraft/client/render/RenderPhase MIPMAP_BLOCK_ATLAS_TEXTURE Lnet/minecraft/client/render/RenderPhase$Texture;
transitive-accessible field net/minecraft/client/render/RenderPhase BLOCK_ATLAS_TEXTURE Lnet/minecraft/client/render/RenderPhase$Texture;
transitive-accessible field net/minecraft/client/render/RenderPhase NO_TEXTURE Lnet/minecraft/client/render/RenderPhase$TextureBase;

View file

@ -2,8 +2,8 @@ org.gradle.jvmargs=-Xmx2560M
org.gradle.parallel=true
fabric.loom.multiProjectOptimisation=true
version=0.90.8
minecraft_version=23w45a
version=0.90.9
minecraft_version=23w46a
yarn_version=+build.1
loader_version=0.14.23
installer_version=0.11.1
@ -21,18 +21,18 @@ fabric-blockrenderlayer-v1-version=1.1.44
fabric-command-api-v1-version=1.2.39
fabric-command-api-v2-version=2.2.18
fabric-commands-v0-version=0.2.56
fabric-containers-v0-version=0.1.76
fabric-containers-v0-version=0.1.77
fabric-content-registries-v0-version=5.0.8
fabric-crash-report-info-v1-version=0.2.21
fabric-data-generation-api-v1-version=13.1.10
fabric-dimensions-v1-version=2.1.58
fabric-data-generation-api-v1-version=13.1.11
fabric-dimensions-v1-version=2.1.59
fabric-entity-events-v1-version=1.5.26
fabric-events-interaction-v0-version=0.6.13
fabric-events-lifecycle-v0-version=0.2.70
fabric-game-rule-api-v1-version=1.0.43
fabric-game-rule-api-v1-version=1.0.44
fabric-gametest-api-v1-version=1.2.18
fabric-item-api-v1-version=2.1.33
fabric-item-group-api-v1-version=4.0.17
fabric-item-group-api-v1-version=4.0.18
fabric-key-binding-api-v1-version=1.0.39
fabric-keybindings-v0-version=0.2.37
fabric-lifecycle-events-v1-version=2.2.28
@ -41,11 +41,11 @@ fabric-message-api-v1-version=6.0.3
fabric-mining-level-api-v1-version=2.1.58
fabric-model-loading-api-v1-version=1.0.6
fabric-models-v0-version=0.4.5
fabric-networking-api-v1-version=3.0.12
fabric-object-builder-api-v1-version=13.0.5
fabric-networking-api-v1-version=3.0.13
fabric-object-builder-api-v1-version=13.0.6
fabric-particles-v1-version=1.1.5
fabric-recipe-api-v1-version=2.0.10
fabric-registry-sync-v0-version=4.0.8
fabric-recipe-api-v1-version=2.0.11
fabric-registry-sync-v0-version=4.0.9
fabric-renderer-api-v1-version=3.2.2
fabric-renderer-indigo-version=1.5.2
fabric-renderer-registries-v1-version=3.2.49
@ -55,10 +55,10 @@ fabric-rendering-v0-version=1.1.52
fabric-rendering-v1-version=3.0.11
fabric-resource-conditions-api-v1-version=2.3.11
fabric-resource-loader-v0-version=0.11.14
fabric-screen-api-v1-version=2.0.14
fabric-screen-handler-api-v1-version=1.3.45
fabric-screen-api-v1-version=2.0.15
fabric-screen-handler-api-v1-version=1.3.46
fabric-sound-api-v1-version=1.0.15
fabric-transfer-api-v1-version=4.0.3
fabric-transitive-access-wideners-v1-version=5.0.10
fabric-transitive-access-wideners-v1-version=5.0.11
fabric-convention-tags-v1-version=1.5.8
fabric-client-tags-api-v1-version=1.1.5