Controllable Catalysts

- Add tags to allow controlling which blocks and fluids act as catalysts
for certain fan processing types
- Fix unexpected and incorrect fan processing air current behaviors
- Fix unlit campfires providing boiler heat
- Rename consumeLang to provideLang in all places
- Remove unused advancement-related classes
This commit is contained in:
PepperCode1 2023-08-31 19:09:20 -07:00
parent 0ee8e18587
commit 4cda09e0e7
29 changed files with 274 additions and 333 deletions

View file

@ -5322,6 +5322,10 @@ d99d5c67bdffff60789a19bd51a5c5267c75e0a4 data/create/tags/blocks/casing.json
74700d556ca80c7a1db5fd4efb09c3ddb26cad66 data/create/tags/blocks/contraption_inventory_deny.json
bc203f09dd7f48965d146d0bd035fb904cb75e7d data/create/tags/blocks/copycat_allow.json
d4a3b66f4b763b9a2dcdea74b7273f0ae85cb335 data/create/tags/blocks/copycat_deny.json
5dc11813fcc096750528ed3ea681947b4939758b data/create/tags/blocks/fan_processing_catalysts/blasting.json
53735494c1e4af154adb4d1d39359a42747dde22 data/create/tags/blocks/fan_processing_catalysts/haunting.json
95c28b97149d4f689a52ccf99bc3178e2bfa5d1c data/create/tags/blocks/fan_processing_catalysts/smoking.json
74700d556ca80c7a1db5fd4efb09c3ddb26cad66 data/create/tags/blocks/fan_processing_catalysts/splashing.json
73c2c85233075d2854d209b71ff2160308a7919c data/create/tags/blocks/fan_transparent.json
ad8fa04f7bbbafd70d0ce158af78a35e899301e2 data/create/tags/blocks/girdable_tracks.json
5445d23a146003f0aa8de86643c4315d4afd4ef6 data/create/tags/blocks/movable_empty_collider.json
@ -5339,6 +5343,10 @@ eac71740fb12bdb38b5dfaa2268613d7ba82b809 data/create/tags/blocks/windmill_sails.
74700d556ca80c7a1db5fd4efb09c3ddb26cad66 data/create/tags/entity_types/ignore_seat.json
a8bdc387cfa6296ebcc4af14323e2ddb632234dc data/create/tags/fluids/bottomless/allow.json
74700d556ca80c7a1db5fd4efb09c3ddb26cad66 data/create/tags/fluids/bottomless/deny.json
6d86d02a3f9975defeaf27b7d67dcb5a5d06348f data/create/tags/fluids/fan_processing_catalysts/blasting.json
74700d556ca80c7a1db5fd4efb09c3ddb26cad66 data/create/tags/fluids/fan_processing_catalysts/haunting.json
74700d556ca80c7a1db5fd4efb09c3ddb26cad66 data/create/tags/fluids/fan_processing_catalysts/smoking.json
5e80abba332ce1f1d5c6f46f0cd536ba6afdf7f3 data/create/tags/fluids/fan_processing_catalysts/splashing.json
74700d556ca80c7a1db5fd4efb09c3ddb26cad66 data/create/tags/items/blaze_burner_fuel/regular.json
97061ef67cac1fafd869493d06115b968bcb99bf data/create/tags/items/blaze_burner_fuel/special.json
d99d5c67bdffff60789a19bd51a5c5267c75e0a4 data/create/tags/items/casing.json

View file

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"create:blaze_burner"
]
}

View file

@ -0,0 +1,8 @@
{
"replace": false,
"values": [
"create:lit_blaze_burner",
"minecraft:soul_fire",
"minecraft:soul_campfire"
]
}

View file

@ -0,0 +1,9 @@
{
"replace": false,
"values": [
"create:blaze_burner",
"create:lit_blaze_burner",
"minecraft:fire",
"minecraft:campfire"
]
}

View file

@ -0,0 +1,4 @@
{
"replace": false,
"values": []
}

View file

@ -0,0 +1,7 @@
{
"replace": false,
"values": [
"minecraft:lava",
"minecraft:flowing_lava"
]
}

View file

@ -0,0 +1,4 @@
{
"replace": false,
"values": []
}

View file

@ -0,0 +1,4 @@
{
"replace": false,
"values": []
}

View file

@ -0,0 +1,7 @@
{
"replace": false,
"values": [
"minecraft:water",
"minecraft:flowing_water"
]
}

View file

@ -717,7 +717,7 @@ public class AllBlocks {
.properties(p -> p.lightLevel(BlazeBurnerBlock::getLight))
.transform(pickaxeOnly())
.addLayer(() -> RenderType::cutoutMipped)
.tag(AllBlockTags.FAN_TRANSPARENT.tag, AllBlockTags.PASSIVE_BOILER_HEATERS.tag)
.tag(AllBlockTags.FAN_PROCESSING_CATALYSTS_BLASTING.tag, AllBlockTags.FAN_PROCESSING_CATALYSTS_SMOKING.tag, AllBlockTags.FAN_TRANSPARENT.tag, AllBlockTags.PASSIVE_BOILER_HEATERS.tag)
.loot((lt, block) -> lt.add(block, BlazeBurnerBlock.buildLootTable()))
.blockstate((c, p) -> p.simpleBlock(c.getEntry(), AssetLookup.partialBaseModel(c, p)))
.onRegister(movementBehaviour(new BlazeBurnerMovementBehaviour()))
@ -734,7 +734,7 @@ public class AllBlocks {
.properties(p -> p.lightLevel(LitBlazeBurnerBlock::getLight))
.transform(pickaxeOnly())
.addLayer(() -> RenderType::cutoutMipped)
.tag(AllBlockTags.FAN_TRANSPARENT.tag, AllBlockTags.PASSIVE_BOILER_HEATERS.tag)
.tag(AllBlockTags.FAN_PROCESSING_CATALYSTS_HAUNTING.tag, AllBlockTags.FAN_PROCESSING_CATALYSTS_SMOKING.tag, AllBlockTags.FAN_TRANSPARENT.tag, AllBlockTags.PASSIVE_BOILER_HEATERS.tag)
.loot((lt, block) -> lt.dropOther(block, AllItems.EMPTY_BLAZE_BURNER.get()))
.blockstate((c, p) -> p.getVariantBuilder(c.get())
.forAllStates(state -> ConfiguredModel.builder()

View file

@ -319,7 +319,7 @@ public class AllSoundEvents {
entry.register(registry);
}
public static void consumeLang(BiConsumer<String, String> consumer) {
public static void provideLang(BiConsumer<String, String> consumer) {
for (SoundEntry entry : ALL.values())
if (entry.hasSubtitle())
consumer.accept(entry.getSubtitleKey(), entry.getSubtitle());

View file

@ -80,23 +80,27 @@ public class AllTags {
BRITTLE,
CASING,
CONTRAPTION_INVENTORY_DENY,
COPYCAT_ALLOW,
COPYCAT_DENY,
FAN_PROCESSING_CATALYSTS_BLASTING(MOD, "fan_processing_catalysts/blasting"),
FAN_PROCESSING_CATALYSTS_HAUNTING(MOD, "fan_processing_catalysts/haunting"),
FAN_PROCESSING_CATALYSTS_SMOKING(MOD, "fan_processing_catalysts/smoking"),
FAN_PROCESSING_CATALYSTS_SPLASHING(MOD, "fan_processing_catalysts/splashing"),
FAN_TRANSPARENT,
NON_MOVABLE,
GIRDABLE_TRACKS,
MOVABLE_EMPTY_COLLIDER,
NON_MOVABLE,
ORE_OVERRIDE_STONE,
PASSIVE_BOILER_HEATERS,
SAFE_NBT,
SEATS,
TOOLBOXES,
TRACKS,
GIRDABLE_TRACKS,
TREE_ATTACHMENTS,
VALVE_HANDLES,
WINDMILL_SAILS,
WRENCH_PICKUP,
COPYCAT_ALLOW,
COPYCAT_DENY,
CONTRAPTION_INVENTORY_DENY,
RELOCATION_NOT_SUPPORTED(FORGE),
WG_STONE(FORGE),
@ -158,8 +162,10 @@ public class AllTags {
BLAZE_BURNER_FUEL_REGULAR(MOD, "blaze_burner_fuel/regular"),
BLAZE_BURNER_FUEL_SPECIAL(MOD, "blaze_burner_fuel/special"),
CASING,
CONTRAPTION_CONTROLLED,
CREATE_INGOTS,
CRUSHED_RAW_MATERIALS,
DEPLOYABLE_DRINK,
MODDED_STRIPPED_LOGS,
MODDED_STRIPPED_WOOD,
PRESSURIZED_AIR_SOURCES,
@ -171,8 +177,6 @@ public class AllTags {
VALVE_HANDLES,
VANILLA_STRIPPED_LOGS,
VANILLA_STRIPPED_WOOD,
DEPLOYABLE_DRINK,
CONTRAPTION_CONTROLLED,
STRIPPED_LOGS(FORGE),
STRIPPED_WOOD(FORGE),
@ -228,6 +232,10 @@ public class AllTags {
BOTTOMLESS_ALLOW(MOD, "bottomless/allow"),
BOTTOMLESS_DENY(MOD, "bottomless/deny"),
FAN_PROCESSING_CATALYSTS_BLASTING(MOD, "fan_processing_catalysts/blasting"),
FAN_PROCESSING_CATALYSTS_HAUNTING(MOD, "fan_processing_catalysts/haunting"),
FAN_PROCESSING_CATALYSTS_SMOKING(MOD, "fan_processing_catalysts/smoking"),
FAN_PROCESSING_CATALYSTS_SPLASHING(MOD, "fan_processing_catalysts/splashing"),
HONEY(FORGE)

View file

@ -10,6 +10,7 @@ import com.simibubi.create.AllTags.AllBlockTags;
import com.simibubi.create.content.processing.burner.BlazeBurnerBlock;
import com.simibubi.create.content.processing.burner.BlazeBurnerBlock.HeatLevel;
import com.simibubi.create.foundation.utility.AttachedRegistry;
import com.simibubi.create.foundation.utility.BlockHelper;
import net.minecraft.core.BlockPos;
import net.minecraft.resources.ResourceLocation;
@ -71,7 +72,7 @@ public class BoilerHeaters {
});
registerHeaterProvider((level, pos, state) -> {
if (AllBlockTags.PASSIVE_BOILER_HEATERS.matches(state)) {
if (AllBlockTags.PASSIVE_BOILER_HEATERS.matches(state) && BlockHelper.isNotUnheated(state)) {
return (level1, pos1, state1) -> 0;
}
return null;

View file

@ -54,8 +54,6 @@ public class AirCurrent {
new ArrayList<>();
protected List<Entity> caughtEntities = new ArrayList<>();
static boolean isClientPlayerInAirCurrent;
public AirCurrent(IAirCurrentSource source) {
this.source = source;
}
@ -111,7 +109,7 @@ public class AirCurrent {
((ServerPlayer) entity).connection.aboveGroundTickCount = 0;
entityDistance -= .5f;
FanProcessingType processingType = getSegmentAt((float) entityDistance);
FanProcessingType processingType = getTypeAt((float) entityDistance);
if (processingType == AllFanProcessingTypes.NONE)
continue;
@ -131,7 +129,33 @@ public class AirCurrent {
if (world != null)
processingType.affectEntity(entity, world);
}
}
public static boolean isPlayerCreativeFlying(Entity entity) {
if (entity instanceof Player) {
Player player = (Player) entity;
return player.isCreative() && player.getAbilities().flying;
}
return false;
}
public void tickAffectedHandlers() {
for (Pair<TransportedItemStackHandlerBehaviour, FanProcessingType> pair : affectedItemHandlers) {
TransportedItemStackHandlerBehaviour handler = pair.getKey();
Level world = handler.getWorld();
FanProcessingType processingType = pair.getRight();
handler.handleProcessingOnAllItems(transported -> {
if (world.isClientSide) {
processingType.spawnProcessingParticles(world, handler.getWorldPositionOf(transported));
return TransportedResult.doNothing();
}
TransportedResult applyProcessing = FanProcessing.applyProcessing(transported, world, processingType);
if (!applyProcessing.doesNothing() && source instanceof EncasedFanBlockEntity fan)
fan.award(AllAdvancements.FAN_PROCESSING);
return applyProcessing;
});
}
}
public void rebuild() {
@ -154,31 +178,35 @@ public class AirCurrent {
maxDistance = getFlowLimit(world, start, max, facing);
// Determine segments with transported fluids/gases
AirCurrentSegment currentSegment = new AirCurrentSegment();
segments.clear();
currentSegment.startOffset = 0;
AirCurrentSegment currentSegment = null;
FanProcessingType type = AllFanProcessingTypes.NONE;
int limit = (int) (maxDistance + .5f);
int searchStart = pushing ? 0 : limit;
int searchEnd = pushing ? limit : 0;
int limit = getLimit();
int searchStart = pushing ? 1 : limit;
int searchEnd = pushing ? limit : 1;
int searchStep = pushing ? 1 : -1;
int toOffset = pushing ? -1 : 0;
for (int i = searchStart; i * searchStep <= searchEnd * searchStep; i += searchStep) {
BlockPos currentPos = start.relative(direction, i);
FanProcessingType newType = FanProcessingType.getAt(world, currentPos);
if (newType != AllFanProcessingTypes.NONE)
if (newType != AllFanProcessingTypes.NONE) {
type = newType;
if (currentSegment.type != type || currentSegment.startOffset == 0) {
currentSegment.endOffset = i;
if (currentSegment.startOffset != 0)
segments.add(currentSegment);
}
if (currentSegment == null) {
currentSegment = new AirCurrentSegment();
currentSegment.startOffset = i;
currentSegment.startOffset = i + toOffset;
currentSegment.type = type;
} else if (currentSegment.type != type) {
currentSegment.endOffset = i + toOffset;
segments.add(currentSegment);
currentSegment = new AirCurrentSegment();
currentSegment.startOffset = i + toOffset;
currentSegment.type = type;
}
}
currentSegment.endOffset = searchEnd + searchStep;
currentSegment.endOffset = searchEnd + searchStep + toOffset;
segments.add(currentSegment);
// Build Bounding Box
@ -194,6 +222,7 @@ public class AirCurrent {
.move(scale);
}
}
findAffectedHandlers();
}
@ -249,18 +278,25 @@ public class AirCurrent {
return max;
}
public void findEntities() {
caughtEntities.clear();
caughtEntities = source.getAirCurrentWorld()
.getEntities(null, bounds);
private static boolean shouldAlwaysPass(BlockState state) {
return AllTags.AllBlockTags.FAN_TRANSPARENT.matches(state);
}
private int getLimit() {
if ((float) (int) maxDistance == maxDistance) {
return (int) maxDistance;
} else {
return (int) maxDistance + 1;
}
}
public void findAffectedHandlers() {
Level world = source.getAirCurrentWorld();
BlockPos start = source.getAirCurrentPos();
affectedItemHandlers.clear();
for (int i = 0; i < maxDistance + 1; i++) {
FanProcessingType segmentType = getSegmentAt(i);
int limit = getLimit();
for (int i = 1; i <= limit; i++) {
FanProcessingType segmentType = getTypeAt(i - 0.5f);
for (int offset : Iterate.zeroAndOne) {
BlockPos pos = start.relative(direction, i)
.below(offset);
@ -279,48 +315,41 @@ public class AirCurrent {
}
}
public void tickAffectedHandlers() {
for (Pair<TransportedItemStackHandlerBehaviour, FanProcessingType> pair : affectedItemHandlers) {
TransportedItemStackHandlerBehaviour handler = pair.getKey();
Level world = handler.getWorld();
FanProcessingType processingType = pair.getRight();
public void findEntities() {
caughtEntities.clear();
caughtEntities = source.getAirCurrentWorld()
.getEntities(null, bounds);
}
handler.handleProcessingOnAllItems(transported -> {
if (world.isClientSide) {
processingType.spawnProcessingParticles(world, handler.getWorldPositionOf(transported));
return TransportedResult.doNothing();
public FanProcessingType getTypeAt(float offset) {
if (offset >= 0 && offset <= maxDistance) {
if (pushing) {
for (AirCurrentSegment airCurrentSegment : segments) {
if (offset <= airCurrentSegment.endOffset) {
return airCurrentSegment.type;
}
}
TransportedResult applyProcessing = FanProcessing.applyProcessing(transported, world, processingType);
if (!applyProcessing.doesNothing() && source instanceof EncasedFanBlockEntity fan)
fan.award(AllAdvancements.FAN_PROCESSING);
return applyProcessing;
});
}
}
private static boolean shouldAlwaysPass(BlockState state) {
return AllTags.AllBlockTags.FAN_TRANSPARENT.matches(state);
}
public FanProcessingType getSegmentAt(float offset) {
for (AirCurrentSegment airCurrentSegment : segments) {
if (offset > airCurrentSegment.endOffset && pushing)
continue;
if (offset < airCurrentSegment.endOffset && !pushing)
continue;
return airCurrentSegment.type;
} else {
for (AirCurrentSegment airCurrentSegment : segments) {
if (offset >= airCurrentSegment.endOffset) {
return airCurrentSegment.type;
}
}
}
}
return AllFanProcessingTypes.NONE;
}
public static class AirCurrentSegment {
FanProcessingType type;
int startOffset;
int endOffset;
private static class AirCurrentSegment {
private FanProcessingType type;
private int startOffset;
private int endOffset;
}
private static boolean isClientPlayerInAirCurrent;
@OnlyIn(Dist.CLIENT)
static AirCurrentSound flyingSound;
private static AirCurrentSound flyingSound;
@OnlyIn(Dist.CLIENT)
private static void enableClientPlayerSound(Entity e, float maxVolume) {
@ -345,7 +374,7 @@ public class AirCurrent {
@OnlyIn(Dist.CLIENT)
public static void tickClientPlayerSounds() {
if (!AirCurrent.isClientPlayerInAirCurrent && flyingSound != null)
if (!isClientPlayerInAirCurrent && flyingSound != null)
if (flyingSound.isFaded())
flyingSound.stopSound();
else
@ -353,12 +382,4 @@ public class AirCurrent {
isClientPlayerInAirCurrent = false;
}
public static boolean isPlayerCreativeFlying(Entity entity) {
if (entity instanceof Player) {
Player player = (Player) entity;
return player.isCreative() && player.getAbilities().flying;
}
return false;
}
}

View file

@ -34,9 +34,9 @@ public class AirFlowParticle extends SimpleAnimatedParticle {
selectSprite(7);
Vec3 offset = VecHelper.offsetRandomly(Vec3.ZERO, random, .25f);
this.setPos(x + offset.x, y + offset.y, z + offset.z);
this.xo = x;
this.yo = y;
this.zo = z;
this.xo = this.x;
this.yo = this.y;
this.zo = this.z;
setColor(0xEEEEEE);
setAlpha(.25f);
}
@ -97,15 +97,13 @@ public class AirFlowParticle extends SimpleAnimatedParticle {
this.zd *= 0.7;
}
this.move(this.xd, this.yd, this.zd);
}
}
private FanProcessingType getType(double distance) {
if (source.getAirCurrent() == null)
return AllFanProcessingTypes.NONE;
return source.getAirCurrent().getSegmentAt((float) distance);
return source.getAirCurrent().getTypeAt((float) distance);
}
public int getLightColor(float partialTick) {

View file

@ -1,7 +1,5 @@
package com.simibubi.create.content.kinetics.fan.processing;
import static com.simibubi.create.content.processing.burner.BlazeBurnerBlock.getHeatLevelOf;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@ -11,8 +9,9 @@ import java.util.Random;
import org.jetbrains.annotations.Nullable;
import com.mojang.math.Vector3f;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllRecipeTypes;
import com.simibubi.create.AllTags.AllBlockTags;
import com.simibubi.create.AllTags.AllFluidTags;
import com.simibubi.create.Create;
import com.simibubi.create.content.kinetics.fan.processing.HauntingRecipe.HauntingWrapper;
import com.simibubi.create.content.kinetics.fan.processing.SplashingRecipe.SplashingWrapper;
@ -47,13 +46,10 @@ import net.minecraft.world.item.crafting.RecipeType;
import net.minecraft.world.item.crafting.SmeltingRecipe;
import net.minecraft.world.item.crafting.SmokingRecipe;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.CampfireBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.items.ItemStackHandler;
import net.minecraftforge.items.wrapper.RecipeWrapper;
@ -141,9 +137,18 @@ public class AllFanProcessingTypes {
@Override
public boolean isValidAt(Level level, BlockPos pos) {
FluidState fluidState = level.getFluidState(pos);
if (AllFluidTags.FAN_PROCESSING_CATALYSTS_BLASTING.matches(fluidState)) {
return true;
}
BlockState blockState = level.getBlockState(pos);
Block block = blockState.getBlock();
return block == Blocks.LAVA || getHeatLevelOf(blockState).isAtLeast(BlazeBurnerBlock.HeatLevel.FADING);
if (AllBlockTags.FAN_PROCESSING_CATALYSTS_BLASTING.matches(blockState)) {
if (blockState.hasProperty(BlazeBurnerBlock.HEAT_LEVEL) && !blockState.getValue(BlazeBurnerBlock.HEAT_LEVEL).isAtLeast(BlazeBurnerBlock.HeatLevel.FADING)) {
return false;
}
return true;
}
return false;
}
@Override
@ -233,15 +238,21 @@ public class AllFanProcessingTypes {
@Override
public boolean isValidAt(Level level, BlockPos pos) {
FluidState fluidState = level.getFluidState(pos);
if (AllFluidTags.FAN_PROCESSING_CATALYSTS_HAUNTING.matches(fluidState)) {
return true;
}
BlockState blockState = level.getBlockState(pos);
Block block = blockState.getBlock();
return block == Blocks.SOUL_FIRE
|| block == Blocks.SOUL_CAMPFIRE && blockState.getOptionalValue(CampfireBlock.LIT)
.orElse(false)
|| AllBlocks.LIT_BLAZE_BURNER.has(blockState)
&& blockState.getOptionalValue(LitBlazeBurnerBlock.FLAME_TYPE)
.map(flame -> flame == LitBlazeBurnerBlock.FlameType.SOUL)
.orElse(false);
if (AllBlockTags.FAN_PROCESSING_CATALYSTS_HAUNTING.matches(blockState)) {
if (blockState.is(BlockTags.CAMPFIRES) && blockState.hasProperty(CampfireBlock.LIT) && !blockState.getValue(CampfireBlock.LIT)) {
return false;
}
if (blockState.hasProperty(LitBlazeBurnerBlock.FLAME_TYPE) && blockState.getValue(LitBlazeBurnerBlock.FLAME_TYPE) != LitBlazeBurnerBlock.FlameType.SOUL) {
return false;
}
return true;
}
return false;
}
@Override
@ -349,16 +360,24 @@ public class AllFanProcessingTypes {
@Override
public boolean isValidAt(Level level, BlockPos pos) {
FluidState fluidState = level.getFluidState(pos);
if (AllFluidTags.FAN_PROCESSING_CATALYSTS_SMOKING.matches(fluidState)) {
return true;
}
BlockState blockState = level.getBlockState(pos);
Block block = blockState.getBlock();
return block == Blocks.FIRE
|| blockState.is(BlockTags.CAMPFIRES) && blockState.getOptionalValue(CampfireBlock.LIT)
.orElse(false)
|| AllBlocks.LIT_BLAZE_BURNER.has(blockState)
&& blockState.getOptionalValue(LitBlazeBurnerBlock.FLAME_TYPE)
.map(flame -> flame == LitBlazeBurnerBlock.FlameType.REGULAR)
.orElse(false)
|| getHeatLevelOf(blockState) == BlazeBurnerBlock.HeatLevel.SMOULDERING;
if (AllBlockTags.FAN_PROCESSING_CATALYSTS_SMOKING.matches(blockState)) {
if (blockState.is(BlockTags.CAMPFIRES) && blockState.hasProperty(CampfireBlock.LIT) && !blockState.getValue(CampfireBlock.LIT)) {
return false;
}
if (blockState.hasProperty(LitBlazeBurnerBlock.FLAME_TYPE) && blockState.getValue(LitBlazeBurnerBlock.FLAME_TYPE) != LitBlazeBurnerBlock.FlameType.REGULAR) {
return false;
}
if (blockState.hasProperty(BlazeBurnerBlock.HEAT_LEVEL) && blockState.getValue(BlazeBurnerBlock.HEAT_LEVEL) != BlazeBurnerBlock.HeatLevel.SMOULDERING) {
return false;
}
return true;
}
return false;
}
@Override
@ -422,8 +441,14 @@ public class AllFanProcessingTypes {
@Override
public boolean isValidAt(Level level, BlockPos pos) {
FluidState fluidState = level.getFluidState(pos);
Fluid fluid = fluidState.getType();
return fluid == Fluids.WATER || fluid == Fluids.FLOWING_WATER;
if (AllFluidTags.FAN_PROCESSING_CATALYSTS_SPLASHING.matches(fluidState)) {
return true;
}
BlockState blockState = level.getBlockState(pos);
if (AllBlockTags.FAN_PROCESSING_CATALYSTS_SPLASHING.matches(blockState)) {
return true;
}
return false;
}
@Override

View file

@ -30,6 +30,7 @@ import com.simibubi.create.foundation.fluid.CombinedTankWrapper;
import com.simibubi.create.foundation.item.ItemHelper;
import com.simibubi.create.foundation.item.SmartInventory;
import com.simibubi.create.foundation.utility.AnimationTickHolder;
import com.simibubi.create.foundation.utility.BlockHelper;
import com.simibubi.create.foundation.utility.Components;
import com.simibubi.create.foundation.utility.Couple;
import com.simibubi.create.foundation.utility.IntAttached;
@ -603,7 +604,7 @@ public class BasinBlockEntity extends SmartBlockEntity implements IHaveGoggleInf
public static HeatLevel getHeatLevelOf(BlockState state) {
if (state.hasProperty(BlazeBurnerBlock.HEAT_LEVEL))
return state.getValue(BlazeBurnerBlock.HEAT_LEVEL);
return AllTags.AllBlockTags.PASSIVE_BOILER_HEATERS.matches(state) ? HeatLevel.SMOULDERING : HeatLevel.NONE;
return AllTags.AllBlockTags.PASSIVE_BOILER_HEATERS.matches(state) && BlockHelper.isNotUnheated(state) ? HeatLevel.SMOULDERING : HeatLevel.NONE;
}
public Couple<SmartFluidTankBehaviour> getTanks() {

View file

@ -656,9 +656,9 @@ public class AllAdvancements implements DataProvider {
return "Create's Advancements";
}
public static void consumeLang(BiConsumer<String, String> consumer) {
public static void provideLang(BiConsumer<String, String> consumer) {
for (CreateAdvancement advancement : ENTRIES)
advancement.consumeLang(consumer);
advancement.provideLang(consumer);
}
public static void register() {}

View file

@ -101,7 +101,7 @@ public class CreateAdvancement {
.toString());
}
void consumeLang(BiConsumer<String, String> consumer) {
void provideLang(BiConsumer<String, String> consumer) {
consumer.accept(titleKey(), title);
consumer.accept(descriptionKey(), description);
}

View file

@ -1,35 +0,0 @@
package com.simibubi.create.foundation.advancement;
import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;
import net.minecraft.MethodsReturnNonnullByDefault;
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
public class EnumTrigger<T extends Enum<T>> extends StringSerializableTrigger<T> {
private final Class<T> reference;
public EnumTrigger(String id, Class<T> reference) {
super(id);
this.reference = reference;
}
@Nullable
@Override
protected T getValue(String key) {
try {
return Enum.valueOf(reference, key);
} catch (IllegalArgumentException | NullPointerException e) {
return null;
}
}
@Nullable
@Override
protected String getKey(@Nullable T value) {
if (value == null)
return null;
return value.name();
}
}

View file

@ -1,9 +0,0 @@
package com.simibubi.create.foundation.advancement;
import net.minecraft.server.level.ServerPlayer;
public interface ITriggerable {
public void trigger(ServerPlayer player);
}

View file

@ -1,33 +0,0 @@
package com.simibubi.create.foundation.advancement;
import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;
import net.minecraft.MethodsReturnNonnullByDefault;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.registries.IForgeRegistry;
import net.minecraftforge.registries.IForgeRegistryEntry;
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
public class RegistryTrigger<T extends IForgeRegistryEntry<T>> extends StringSerializableTrigger<T> {
private final IForgeRegistry<T> registry;
public RegistryTrigger(String id, IForgeRegistry<T> registry) {
super(id);
this.registry = registry;
}
@Nullable
@Override
protected T getValue(String key) {
return registry.getValue(new ResourceLocation(key));
}
@Nullable
@Override
protected String getKey(T value) {
ResourceLocation key = registry.getKey(value);
return key == null ? null : key.toString();
}
}

View file

@ -16,7 +16,7 @@ import net.minecraft.server.level.ServerPlayer;
@MethodsReturnNonnullByDefault
@ParametersAreNonnullByDefault
public class SimpleCreateTrigger extends CriterionTriggerBase<SimpleCreateTrigger.Instance> implements ITriggerable {
public class SimpleCreateTrigger extends CriterionTriggerBase<SimpleCreateTrigger.Instance> {
public SimpleCreateTrigger(String id) {
super(id);

View file

@ -1,121 +0,0 @@
package com.simibubi.create.foundation.advancement;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonSyntaxException;
import net.minecraft.MethodsReturnNonnullByDefault;
import net.minecraft.advancements.critereon.DeserializationContext;
import net.minecraft.advancements.critereon.EntityPredicate;
import net.minecraft.advancements.critereon.SerializationContext;
import net.minecraft.server.level.ServerPlayer;
@MethodsReturnNonnullByDefault
@ParametersAreNonnullByDefault
public abstract class StringSerializableTrigger<T> extends CriterionTriggerBase<StringSerializableTrigger.Instance<T>> {
protected String getJsonKey() {
return "accepted_entries";
}
protected StringSerializableTrigger(String id) {
super(id);
}
@SafeVarargs
public final Instance<T> forEntries(@Nullable T... entries) {
return new Instance<>(this, entries == null ? null : createLinkedHashSet(entries));
}
public void trigger(ServerPlayer player, @Nullable T registryEntry) {
trigger(player, Collections.singletonList(() -> registryEntry));
}
public ITriggerable constructTriggerFor(@Nullable T entry) {
return player -> trigger(player, entry);
}
@Override
public Instance<T> createInstance(JsonObject json, DeserializationContext context) {
if (json.has(getJsonKey())) {
JsonArray elements = json.getAsJsonArray(getJsonKey());
return new Instance<>(this, StreamSupport.stream(elements.spliterator(), false)
.map(JsonElement::getAsString)
.map(key -> {
T entry = getValue(key);
if (entry == null)
throw new JsonSyntaxException("Unknown entry '" + key + "'");
return entry;
})
.collect(Collectors.toSet()));
}
return new Instance<>(this, null);
}
@Nullable
protected abstract T getValue(String key);
@Nullable
protected abstract String getKey(T value);
private static <T> LinkedHashSet<T> createLinkedHashSet(T[] elements) {
LinkedHashSet<T> set = new LinkedHashSet<>(elements.length);
Collections.addAll(set, elements);
return set;
}
public static class Instance<T> extends CriterionTriggerBase.Instance {
@Nullable
private final Set<T> entries;
private final StringSerializableTrigger<T> trigger;
public Instance(StringSerializableTrigger<T> trigger, @Nullable Set<T> entries) {
super(trigger.getId(), EntityPredicate.Composite.ANY);
this.trigger = trigger;
this.entries = entries;
}
@Override
protected boolean test(@Nullable List<Supplier<Object>> suppliers) {
if (entries == null || suppliers == null || suppliers.isEmpty())
return false;
return entries.contains(suppliers.get(0)
.get());
}
@Override
public JsonObject serializeToJson(SerializationContext p_230240_1_) {
JsonObject jsonobject = super.serializeToJson(p_230240_1_);
JsonArray elements = new JsonArray();
if (entries == null) {
jsonobject.add(trigger.getJsonKey(), elements);
return jsonobject;
}
for (T entry : entries) {
if (entry == null)
continue;
String key = trigger.getKey(entry);
if (key != null)
elements.add(key);
}
jsonobject.add(trigger.getJsonKey(), elements);
return jsonobject;
}
}
}

View file

@ -112,7 +112,7 @@ public class PonderLocalization {
});
}
public static void consumeLang(String namespace, BiConsumer<String, String> consumer) {
public static void provideLang(String namespace, BiConsumer<String, String> consumer) {
SHARED.forEach((k, v) -> {
if (k.getNamespace().equals(namespace)) {
consumer.accept(langKeyForShared(k), v);
@ -148,11 +148,11 @@ public class PonderLocalization {
@Deprecated(forRemoval = true)
public static void record(String namespace, JsonObject object) {
consumeLang(namespace, object::addProperty);
provideLang(namespace, object::addProperty);
}
public static void provideRegistrateLang(AbstractRegistrate<?> registrate) {
generateSceneLang();
consumeLang(registrate.getModid(), registrate::addRawLang);
provideLang(registrate.getModid(), registrate::addRawLang);
}
}

View file

@ -7,6 +7,8 @@ import javax.annotation.Nullable;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllTags.AllBlockTags;
import com.simibubi.create.content.kinetics.base.KineticBlockEntity;
import com.simibubi.create.content.processing.burner.BlazeBurnerBlock;
import com.simibubi.create.content.processing.burner.BlazeBurnerBlock.HeatLevel;
import com.simibubi.create.foundation.blockEntity.IMergeableBE;
import net.minecraft.core.BlockPos;
@ -34,6 +36,7 @@ import net.minecraft.world.level.block.BaseRailBlock;
import net.minecraft.world.level.block.BedBlock;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.CampfireBlock;
import net.minecraft.world.level.block.IceBlock;
import net.minecraft.world.level.block.SlimeBlock;
import net.minecraft.world.level.block.entity.BlockEntity;
@ -361,4 +364,14 @@ public class BlockHelper {
return toState;
}
public static boolean isNotUnheated(BlockState state) {
if (state.is(BlockTags.CAMPFIRES) && state.hasProperty(CampfireBlock.LIT)) {
return state.getValue(CampfireBlock.LIT);
}
if (state.hasProperty(BlazeBurnerBlock.HEAT_LEVEL)) {
return state.getValue(BlazeBurnerBlock.HEAT_LEVEL) != HeatLevel.NONE;
}
return true;
}
}

View file

@ -64,17 +64,17 @@ public class CreateDatagen {
}
};
AllAdvancements.consumeLang(langConsumer);
consumeDefaultLang("interface", langConsumer);
AllSoundEvents.consumeLang(langConsumer);
consumeDefaultLang("tooltips", langConsumer);
consumePonderLang(langConsumer);
AllAdvancements.provideLang(langConsumer);
provideDefaultLang("interface", langConsumer);
AllSoundEvents.provideLang(langConsumer);
provideDefaultLang("tooltips", langConsumer);
providePonderLang(langConsumer);
return newEntries;
});
}
private static void consumeDefaultLang(String fileName, BiConsumer<String, String> consumer) {
private static void provideDefaultLang(String fileName, BiConsumer<String, String> consumer) {
String path = "assets/create/lang/default/" + fileName + ".json";
JsonElement jsonElement = FilesHelper.loadJsonResource(path);
if (jsonElement == null) {
@ -88,7 +88,7 @@ public class CreateDatagen {
}
}
private static void consumePonderLang(BiConsumer<String, String> consumer) {
private static void providePonderLang(BiConsumer<String, String> consumer) {
// Register these since FMLClientSetupEvent does not run during datagen
AllPonderTags.register();
PonderIndex.register();
@ -96,7 +96,7 @@ public class CreateDatagen {
SharedText.gatherText();
PonderLocalization.generateSceneLang();
GeneralText.consumeLang(consumer);
PonderLocalization.consumeLang(Create.ID, consumer);
GeneralText.provideLang(consumer);
PonderLocalization.provideLang(Create.ID, consumer);
}
}

View file

@ -36,9 +36,21 @@ public class CreateRegistrateTags {
.addTag(BlockTags.BEDS)
.addTag(BlockTags.DOORS);
prov.tag(AllBlockTags.MOVABLE_EMPTY_COLLIDER.tag)
.add(Blocks.COBWEB, Blocks.POWDER_SNOW, Blocks.TRIPWIRE, Blocks.TRIPWIRE_HOOK)
.addTag(BlockTags.FENCE_GATES);
prov.tag(AllBlockTags.COPYCAT_ALLOW.tag)
.add(Blocks.BARREL);
prov.tag(AllBlockTags.COPYCAT_DENY.tag)
.addTag(BlockTags.CAULDRONS)
.addTag(BlockTags.SAPLINGS)
.addTag(BlockTags.CLIMBABLE);
prov.tag(AllBlockTags.FAN_PROCESSING_CATALYSTS_HAUNTING.tag)
.add(Blocks.SOUL_FIRE)
.add(Blocks.SOUL_CAMPFIRE);
prov.tag(AllBlockTags.FAN_PROCESSING_CATALYSTS_SMOKING.tag)
.add(Blocks.FIRE)
.add(Blocks.CAMPFIRE);
prov.tag(AllBlockTags.FAN_TRANSPARENT.tag)
.add(Blocks.IRON_BARS)
@ -46,6 +58,10 @@ public class CreateRegistrateTags {
.addTag(BlockTags.FENCES)
.addTag(BlockTags.LEAVES);
prov.tag(AllBlockTags.MOVABLE_EMPTY_COLLIDER.tag)
.add(Blocks.COBWEB, Blocks.POWDER_SNOW, Blocks.TRIPWIRE, Blocks.TRIPWIRE_HOOK)
.addTag(BlockTags.FENCE_GATES);
prov.tag(AllBlockTags.ORE_OVERRIDE_STONE.tag)
.addTag(BlockTags.STONE_ORE_REPLACEABLES);
@ -72,13 +88,6 @@ public class CreateRegistrateTags {
.addTag(BlockTags.PRESSURE_PLATES)
.addTag(BlockTags.RAILS);
prov.tag(AllBlockTags.COPYCAT_ALLOW.tag)
.add(Blocks.BARREL);
prov.tag(AllBlockTags.COPYCAT_DENY.tag)
.addTag(BlockTags.CAULDRONS)
.addTag(BlockTags.SAPLINGS)
.addTag(BlockTags.CLIMBABLE);
// COMPAT
TagGen.addOptional(prov.tag(AllBlockTags.NON_MOVABLE.tag), Mods.IE,
@ -179,6 +188,12 @@ public class CreateRegistrateTags {
prov.tag(AllFluidTags.BOTTOMLESS_ALLOW.tag)
.add(Fluids.WATER, Fluids.LAVA);
prov.tag(AllFluidTags.FAN_PROCESSING_CATALYSTS_BLASTING.tag)
.add(Fluids.LAVA, Fluids.FLOWING_LAVA);
prov.tag(AllFluidTags.FAN_PROCESSING_CATALYSTS_SPLASHING.tag)
.add(Fluids.WATER, Fluids.FLOWING_WATER);
// VALIDATE
for (AllFluidTags tag : AllFluidTags.values()) {

View file

@ -9,7 +9,7 @@ import com.simibubi.create.foundation.ponder.ui.PonderTagScreen;
import com.simibubi.create.foundation.ponder.ui.PonderUI;
public class GeneralText {
public static void consumeLang(BiConsumer<String, String> consumer) {
public static void provideLang(BiConsumer<String, String> consumer) {
consume(consumer, PonderTooltipHandler.HOLD_TO_PONDER, "Hold [%1$s] to Ponder");
consume(consumer, PonderTooltipHandler.SUBJECT, "Subject of this scene");
consume(consumer, PonderUI.PONDERING, "Pondering about...");