Skip to content

Commit

Permalink
Update to 24w09a
Browse files Browse the repository at this point in the history
Signed-off-by: shedaniel <[email protected]>
  • Loading branch information
shedaniel committed Feb 29, 2024
1 parent 0c3f7c6 commit 7b65d8d
Show file tree
Hide file tree
Showing 37 changed files with 249 additions and 207 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/1.20.3_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- '**.properties'
- '**/src/**'
branches:
- "1.20.4"
- "1.20.5"
workflow_dispatch:
inputs:
norelease:
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ buildscript {

plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.4-SNAPSHOT" apply false
id "dev.architectury.loom" version "1.5-SNAPSHOT" apply false
id "org.cadixdev.licenser" version "0.6.1"
id "me.shedaniel.unified-publishing" version "0.1.+" apply false
id "maven-publish"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import net.minecraft.core.dispenser.BlockSource;
import net.minecraft.core.dispenser.DefaultDispenseItemBehavior;
import net.minecraft.core.dispenser.DispenseItemBehavior;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.MobSpawnType;
Expand All @@ -48,7 +47,7 @@ protected static DispenseItemBehavior createDispenseItemBehavior() {
@Override
public ItemStack execute(BlockSource source, ItemStack stack) {
Direction direction = source.state().getValue(DispenserBlock.FACING);
EntityType<?> entityType = ((SpawnEggItem) stack.getItem()).getType(stack.getTag());
EntityType<?> entityType = ((SpawnEggItem) stack.getItem()).getType(stack);

try {
entityType.spawn(source.level(), stack, null, source.pos().relative(direction), MobSpawnType.DISPENSER, direction != Direction.UP, false);
Expand Down Expand Up @@ -86,8 +85,8 @@ public ArchitecturySpawnEggItem(RegistrySupplier<? extends EntityType<? extends
}

@Override
public EntityType<?> getType(@Nullable CompoundTag compoundTag) {
EntityType<?> type = super.getType(compoundTag);
public EntityType<?> getType(ItemStack itemStack) {
EntityType<?> type = super.getType(itemStack);
return type == null ? entityType.get() : type;
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ default boolean is(TagKey<T> tagKey) {
return holder != null && holder.is(tagKey);
}

@Override
default boolean is(Holder<T> holder) {
return holder.is(getKey());
}

@Override
default Stream<TagKey<T>> tags() {
Holder<T> holder = getHolder();
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import dev.architectury.injectables.annotations.ExpectPlatform;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.SpawnPlacementType;
import net.minecraft.world.entity.SpawnPlacements;
import net.minecraft.world.level.levelgen.Heightmap;

Expand All @@ -38,7 +39,7 @@ public final class SpawnPlacementsRegistry {
* @see net.minecraft.world.entity.SpawnPlacements
*/
@ExpectPlatform
public static <T extends Mob> void register(Supplier<? extends EntityType<T>> type, SpawnPlacements.Type spawnPlacement, Heightmap.Types heightmapType, SpawnPlacements.SpawnPredicate<T> spawnPredicate) {
public static <T extends Mob> void register(Supplier<? extends EntityType<T>> type, SpawnPlacementType spawnPlacement, Heightmap.Types heightmapType, SpawnPlacements.SpawnPredicate<T> spawnPredicate) {
throw new AssertionError();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.npc.VillagerTrades;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.trading.ItemCost;
import net.minecraft.world.item.trading.MerchantOffer;
import org.jetbrains.annotations.Nullable;

import java.util.Optional;

/**
* This class is the easiest implementation of a trade object.
* All trades added by vanilla do have custom classes like {@link VillagerTrades.EmeraldForItems}, but they aren't accessible.
Expand All @@ -36,15 +39,15 @@
* or
* {@link TradeRegistry#registerTradeForWanderingTrader(boolean, VillagerTrades.ItemListing...)}.
*/
public record SimpleTrade(ItemStack primaryPrice, ItemStack secondaryPrice,
public record SimpleTrade(ItemCost primaryPrice, Optional<ItemCost> secondaryPrice,
ItemStack sale, int maxTrades, int experiencePoints,
float priceMultiplier) implements VillagerTrades.ItemListing {
/**
* Constructor for creating the trade.
* You can take a look at all the values the vanilla game uses right here {@link VillagerTrades#TRADES}.
*
* @param primaryPrice The first price a player has to pay to get the 'sale' stack.
* @param secondaryPrice A optional, secondary price to pay as well as the primary one. If not needed just use {@link ItemStack#EMPTY}.
* @param secondaryPrice An optional, secondary price to pay as well as the primary one. If not needed just use {@link Optional#empty()}.
* @param sale The ItemStack which a player can purchase in exchange for the two prices.
* @param maxTrades The amount of trades one villager or wanderer can do. When the amount is surpassed, the trade can't be purchased anymore.
* @param experiencePoints How much experience points does the player get, when trading. Vanilla uses between 2 and 30 for this.
Expand Down
1 change: 0 additions & 1 deletion common/src/main/resources/architectury-common.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"inject.MixinEntityType",
"inject.MixinFluid",
"inject.MixinFoodPropertiesBuilder",
"inject.MixinGameEvent",
"inject.MixinItem",
"inject.MixinItemProperties",
"inject.MixinLiquidBlock",
Expand Down
6 changes: 2 additions & 4 deletions common/src/main/resources/architectury.accessWidener
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,7 @@ transitive-accessible class net/minecraft/world/item/CreativeModeTab$TabVisibili
##############################

# Constructors of non-abstract item classes
transitive-accessible method net/minecraft/world/item/AxeItem <init> (Lnet/minecraft/world/item/Tier;FFLnet/minecraft/world/item/Item$Properties;)V
transitive-accessible method net/minecraft/world/item/DiggerItem <init> (FFLnet/minecraft/world/item/Tier;Lnet/minecraft/tags/TagKey;Lnet/minecraft/world/item/Item$Properties;)V
transitive-accessible method net/minecraft/world/item/HoeItem <init> (Lnet/minecraft/world/item/Tier;IFLnet/minecraft/world/item/Item$Properties;)V
transitive-accessible method net/minecraft/world/item/PickaxeItem <init> (Lnet/minecraft/world/item/Tier;IFLnet/minecraft/world/item/Item$Properties;)V
transitive-accessible method net/minecraft/world/item/DiggerItem <init> (Lnet/minecraft/world/item/Tier;Lnet/minecraft/tags/TagKey;Lnet/minecraft/world/item/Item$Properties;)V
transitive-accessible method net/minecraft/world/item/RecordItem <init> (ILnet/minecraft/sounds/SoundEvent;Lnet/minecraft/world/item/Item$Properties;I)V

# Constructors of non-abstract block classes
Expand Down Expand Up @@ -304,6 +301,7 @@ transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDE
transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_TRIPWIRE_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard;
transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_END_PORTAL_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard;
transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_END_GATEWAY_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard;
transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_CLOUDS_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard;
transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_LINES_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard;
transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_GUI_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard;
transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_GUI_OVERLAY_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard;
Expand Down
3 changes: 0 additions & 3 deletions common/src/main/resources/architectury.common.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
"net/minecraft/class_1755": [
"dev/architectury/extensions/injected/InjectedBucketItemExtension"
],
"net/minecraft/class_5712": [
"dev/architectury/extensions/injected/InjectedGameEventExtension"
],
"net/minecraft/class_4174$class_4175": [
"dev/architectury/extensions/injected/InjectedFoodPropertiesBuilderExtension"
],
Expand Down
2 changes: 1 addition & 1 deletion fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ unifiedPublishing {
curseforge {
token = CURSE_API_KEY
id = rootProject.curseforge_id
gameVersions.addAll "Java 17", project.minecraft_version
gameVersions.addAll "Java 17", "1.20.5-Snapshot"//, project.minecraft_version
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,17 @@
import dev.architectury.utils.Env;
import dev.architectury.utils.EnvExecutor;
import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandlerRegistry;
import net.fabricmc.fabric.api.transfer.v1.client.fluid.FluidVariantRendering;
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariantAttributes;
import net.minecraft.world.level.material.FlowingFluid;

public class ArchitecturyFlowingFluidImpl {
public static void addFabricFluidAttributes(FlowingFluid fluid, ArchitecturyFluidAttributes attributes) {
FluidVariantAttributes.register(fluid, new ArchitecturyFluidAttributesFabric(attributes));
// TODO: FluidVariantAttributes.register(fluid, new ArchitecturyFluidAttributesFabric(attributes));
EnvExecutor.runInEnv(Env.CLIENT, () -> () -> Client.run(fluid, attributes));
}

private static class Client {
private static void run(FlowingFluid fluid, ArchitecturyFluidAttributes attributes) {
FluidVariantRendering.register(fluid, new ArchitecturyFluidRenderingFabric(attributes));
// TODO: FluidVariantRendering.register(fluid, new ArchitecturyFluidRenderingFabric(attributes));
FluidRenderHandlerRegistry.INSTANCE.register(fluid, new ArchitecturyFluidRenderingFabric(attributes));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
import dev.architectury.core.fluid.ArchitecturyFluidAttributes;
import dev.architectury.fluid.FluidStack;
import dev.architectury.hooks.fluid.fabric.FluidStackHooksFabric;
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant;
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariantAttributeHandler;
import net.minecraft.network.chat.Component;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.level.Level;
Expand All @@ -32,7 +30,7 @@
import java.util.Optional;

@SuppressWarnings("UnstableApiUsage")
class ArchitecturyFluidAttributesFabric implements FluidVariantAttributeHandler {
class ArchitecturyFluidAttributesFabric {} /*implements FluidVariantAttributeHandler {
private final ArchitecturyFluidAttributes attributes;
public ArchitecturyFluidAttributesFabric(ArchitecturyFluidAttributes attributes) {
Expand Down Expand Up @@ -73,4 +71,4 @@ public int getViscosity(FluidVariant variant, @Nullable Level world) {
public boolean isLighterThanAir(FluidVariant variant) {
return attributes.isLighterThanAir(FluidStackHooksFabric.fromFabric(variant, FluidStack.bucketAmount()));
}
}
}*/
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandler;
import net.fabricmc.fabric.api.transfer.v1.client.fluid.FluidVariantRenderHandler;
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.TextureAtlas;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
Expand All @@ -40,7 +38,7 @@

@SuppressWarnings("UnstableApiUsage")
@Environment(EnvType.CLIENT)
class ArchitecturyFluidRenderingFabric implements FluidVariantRenderHandler, FluidRenderHandler {
class ArchitecturyFluidRenderingFabric implements /*FluidVariantRenderHandler,*/ FluidRenderHandler {
private final ArchitecturyFluidAttributes attributes;
private final TextureAtlasSprite[] sprites = new TextureAtlasSprite[3];
private final TextureAtlasSprite[] spritesOther = new TextureAtlasSprite[3];
Expand All @@ -49,22 +47,22 @@ public ArchitecturyFluidRenderingFabric(ArchitecturyFluidAttributes attributes)
this.attributes = attributes;
}

@Override
@Nullable
public TextureAtlasSprite[] getSprites(FluidVariant variant) {
FluidStack stack = FluidStackHooksFabric.fromFabric(variant, FluidStack.bucketAmount());
Function<ResourceLocation, TextureAtlasSprite> atlas = Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS);
sprites[0] = atlas.apply(attributes.getSourceTexture(stack));
sprites[1] = atlas.apply(attributes.getFlowingTexture(stack));
ResourceLocation overlayTexture = attributes.getOverlayTexture(stack);
sprites[2] = overlayTexture == null ? null : atlas.apply(overlayTexture);
return sprites;
}
// @Override
// @Nullable
// public TextureAtlasSprite[] getSprites(FluidVariant variant) {
// FluidStack stack = FluidStackHooksFabric.fromFabric(variant, FluidStack.bucketAmount());
// Function<ResourceLocation, TextureAtlasSprite> atlas = Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS);
// sprites[0] = atlas.apply(attributes.getSourceTexture(stack));
// sprites[1] = atlas.apply(attributes.getFlowingTexture(stack));
// ResourceLocation overlayTexture = attributes.getOverlayTexture(stack);
// sprites[2] = overlayTexture == null ? null : atlas.apply(overlayTexture);
// return sprites;
// }

@Override
public int getColor(FluidVariant variant, @Nullable BlockAndTintGetter view, @Nullable BlockPos pos) {
return attributes.getColor(FluidStackHooksFabric.fromFabric(variant, FluidStack.bucketAmount()), view, pos);
}
// @Override
// public int getColor(FluidVariant variant, @Nullable BlockAndTintGetter view, @Nullable BlockPos pos) {
// return attributes.getColor(FluidStackHooksFabric.fromFabric(variant, FluidStack.bucketAmount()), view, pos);
// }

@Override
public TextureAtlasSprite[] getFluidSprites(@Nullable BlockAndTintGetter view, @Nullable BlockPos pos, FluidState state) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
package dev.architectury.fluid.fabric;

import dev.architectury.fluid.FluidStack;
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.level.material.FlowingFluid;
import net.minecraft.world.level.material.Fluid;
Expand Down Expand Up @@ -49,10 +48,11 @@ public static FluidStack.FluidStackAdapter<Object> adapt(Function<FluidStack, Ob
}

public static class Pair {
public FluidVariant variant;
//public FluidVariant variant;
public Fluid variant;
public long amount;

public Pair(FluidVariant variant, long amount) {
public Pair(Fluid/*Variant*/ variant, long amount) {
this.variant = variant;
this.amount = amount;
}
Expand All @@ -64,17 +64,17 @@ public FluidStackImpl.Pair create(Supplier<Fluid> fluid, long amount, CompoundTa
if (fluidType instanceof FlowingFluid flowingFluid) {
fluidType = flowingFluid.getSource();
}
return new Pair(FluidVariant.of(fluidType, tag == null ? null : tag.copy()), amount);
return new Pair(fluidType/*, tag == null ? null : tag.copy())*/, amount);
}

@Override
public Supplier<Fluid> getRawFluidSupplier(FluidStackImpl.Pair object) {
return object.variant::getFluid;
return () -> object.variant;
}

@Override
public Fluid getFluid(FluidStackImpl.Pair object) {
return object.variant.getFluid();
return object.variant;
}

@Override
Expand All @@ -89,28 +89,28 @@ public void setAmount(FluidStackImpl.Pair object, long amount) {

@Override
public CompoundTag getTag(FluidStackImpl.Pair value) {
return value.variant.getNbt();
return null; // value.variant.getNbt();
}

@Override
public void setTag(FluidStackImpl.Pair value, CompoundTag tag) {
value.variant = FluidVariant.of(value.variant.getFluid(), tag);
// value.variant = FluidVariant.of(value.variant.getFluid(), tag);
}

@Override
public FluidStackImpl.Pair copy(FluidStackImpl.Pair value) {
return new Pair(FluidVariant.of(value.variant.getFluid(), value.variant.copyNbt()), value.amount);
return new Pair(value.variant/*FluidVariant.of(value.variant.getFluid(), value.variant.copyNbt())*/, value.amount);
}

@Override
public int hashCode(FluidStackImpl.Pair value) {
var pair = (Pair) value;
var code = 1;
code = 31 * code + pair.variant.getFluid().hashCode();
code = 31 * code + pair.variant.hashCode();
code = 31 * code + Long.hashCode(pair.amount);
var tag = pair.variant.getNbt();
if (tag != null)
code = 31 * code + tag.hashCode();
// var tag = pair.variant.getNbt();
// if (tag != null)
// code = 31 * code + tag.hashCode();
return code;
}
}
Loading

0 comments on commit 7b65d8d

Please sign in to comment.