Skip to content

Commit

Permalink
new fluid tag "bucketlib:no_flipping" to list all fluids that should …
Browse files Browse the repository at this point in the history
…be displayed in a normal bucket instead of a 180° flipped bucket. #50
  • Loading branch information
cech12 committed Sep 30, 2024
1 parent de926dc commit 1ab0261
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Forge Recommended Versioning](https://mcforge.readthedocs.io/en/latest/conventions/versioning/).

## [1.20.4-3.2.2.0] - 2024-09-30
### Added
- new fluid tag "bucketlib:no_flipping" to list all fluids that should be displayed in a normal bucket instead of a 180° flipped bucket. (thanks to Konhaiii for the idea) #50

## [1.20.4-3.2.1.6] - 2024-09-29
### Fixed
- lava bucket did not serve as fuel in furnace (Fabric & Forge) (thanks to memoharos and AvaAsUsual for the report) #49 https://github.com/cech12/CeramicBucket/issues/83
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ private static TagKey<EntityType<?>> tag(@Nonnull String name) {
public static class Fluids {

public static final TagKey<Fluid> INFINITY_ENCHANTABLE = tag("infinity_enchantable");
public static final TagKey<Fluid> NO_FLIPPING = tag("no_flipping");

private static void init() {
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"replace": false,
"_comment" : "This tag lists all fluids that should be displayed in a normal bucket instead of a 180° flipped bucket.",
"values": [
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.google.common.collect.Maps;
import de.cech12.bucketlib.api.BucketLib;
import de.cech12.bucketlib.api.BucketLibTags;
import de.cech12.bucketlib.api.item.UniversalBucketItem;
import de.cech12.bucketlib.client.BucketLibClientMod;
import de.cech12.bucketlib.mixin.BlockModelAccessor;
Expand Down Expand Up @@ -187,7 +188,7 @@ public BakedModel bake(@Nonnull ModelBaker modelBaker, @Nonnull Function<Materia
ItemOverrides itemOverrides = new ContainedFluidOverrideHandler(modelBaker, this);

// if the fluid is lighter than air, will manipulate the initial state to be rotated 180deg to turn it upside down
if (fluid != Fluids.EMPTY && FluidVariantAttributes.isLighterThanAir(FluidVariant.of(fluid))) {
if (fluid != Fluids.EMPTY && !fluid.defaultFluidState().is(BucketLibTags.Fluids.NO_FLIPPING) && FluidVariantAttributes.isLighterThanAir(FluidVariant.of(fluid))) {
modelState = BlockModelRotation.X180_Y0;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.google.gson.JsonObject;
import com.mojang.math.Transformation;
import de.cech12.bucketlib.api.BucketLib;
import de.cech12.bucketlib.api.BucketLibTags;
import de.cech12.bucketlib.api.item.UniversalBucketItem;
import de.cech12.bucketlib.util.BucketLibUtil;
import net.minecraft.client.multiplayer.ClientLevel;
Expand Down Expand Up @@ -144,7 +145,7 @@ public BakedModel bake(IGeometryBakingContext owner, ModelBaker baker, Function<
if (particleSprite == null) particleSprite = fluidSprite;

// if the fluid is lighter than air, will manipulate the initial state to be rotated 180deg to turn it upside down
if (fluid != Fluids.EMPTY && fluid.getFluidType().isLighterThanAir()) {
if (fluid != Fluids.EMPTY && !fluid.defaultFluidState().is(BucketLibTags.Fluids.NO_FLIPPING) && fluid.getFluidType().isLighterThanAir()) {
modelState = new SimpleModelState(
modelState.getRotation().compose(
new Transformation(null, new Quaternionf(0, 0, 1, 0), null, null)));
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# Project
group=de.cech12.bucketlib
mod_version=3.2.1.6
mod_version=3.2.2.0
mod_id=bucketlib
mod_name=BucketLib
mod_author=Cech12
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.google.gson.JsonObject;
import com.mojang.math.Transformation;
import de.cech12.bucketlib.api.BucketLib;
import de.cech12.bucketlib.api.BucketLibTags;
import de.cech12.bucketlib.api.item.UniversalBucketItem;
import de.cech12.bucketlib.util.BucketLibUtil;
import net.minecraft.client.multiplayer.ClientLevel;
Expand Down Expand Up @@ -144,7 +145,7 @@ public BakedModel bake(IGeometryBakingContext owner, ModelBaker baker, Function<
if (particleSprite == null) particleSprite = fluidSprite;

// if the fluid is lighter than air, will manipulate the initial state to be rotated 180deg to turn it upside down
if (fluid != Fluids.EMPTY && fluid.getFluidType().isLighterThanAir()) {
if (fluid != Fluids.EMPTY && !fluid.defaultFluidState().is(BucketLibTags.Fluids.NO_FLIPPING) && fluid.getFluidType().isLighterThanAir()) {
modelState = new SimpleModelState(
modelState.getRotation().compose(
new Transformation(null, new Quaternionf(0, 0, 1, 0), null, null)));
Expand Down

0 comments on commit 1ab0261

Please sign in to comment.