- Added config control for ambient sounds
- Spilled milk off a pipe end now clears effects on entities
- Non-placeable fluids now exit an open pipe at a fixed rate of 1mb/t
- Air currents can now pass through Campfires vertically
- Fixed perpendicular movement actors not activating consistently
This commit is contained in:
simibubi 2021-07-04 16:30:46 +02:00
parent d458b50c29
commit 5179aad4fe
9 changed files with 64 additions and 25 deletions

View file

@ -1660,7 +1660,7 @@ d080b1b25e5bc8baf5aee68691b08c7f12ece3b0 assets/create/models/item/windmill_bear
a80fb25a0b655e76be986b5b49fcb0f03461a1ab assets/create/models/item/zinc_nugget.json
b1689617190c05ef34bd18456b0c7ae09bb3210f assets/create/models/item/zinc_ore.json
f3231c27d43ff511b7d8532603111706ebcc155e assets/create/sounds.json
0f1b4b980afba9bf2caf583b88e261bba8b10313 data/create/advancements/aesthetics.json
5d0cc4c0255dc241e61c173b31ddca70c88d08e4 data/create/advancements/aesthetics.json
187921fa131b06721bfaf63f2623a28c141aae9a data/create/advancements/andesite_alloy.json
0ea2db7173b5be28b289ea7c9a6a0cf5805c60c7 data/create/advancements/andesite_casing.json
83c046bd200623933545c9e4326f782fb02c87fa data/create/advancements/arm_blaze_burner.json
@ -3687,7 +3687,7 @@ d3fdb8ece6cb072a93ddb64a0baad5ac952117a4 data/create/recipes/weathered_limestone
11667414f73bc2d00bda7c5c1a7d2934bf6e9165 data/create/recipes/weathered_limestone_pillar_from_weathered_limestone_stonecutting.json
558c1052ca384f1c014f9b404d21268764a493ee data/create/tags/blocks/brittle.json
330bfb3850ba3964b10b1bccbc3cbb9b012cae54 data/create/tags/blocks/fan_heaters.json
3bc64e3a1e7980237435b1770a9ba2102d57fcd4 data/create/tags/blocks/fan_transparent.json
57b942386a15c874d1ca9cd6a8032c11a5599fc2 data/create/tags/blocks/fan_transparent.json
c81ea194e808985847159b201140d4aa4cbcca65 data/create/tags/blocks/safe_nbt.json
c9ac7e3e5ec18554e7184168d65e9b8e44ef5610 data/create/tags/blocks/sails.json
6cdeeac1689f7b5bfd9bc40b462143d8eaf3ad0b data/create/tags/blocks/seats.json

View file

@ -28,8 +28,8 @@
"trigger": "create:bracket_apply",
"conditions": {
"accepted_entries": [
"create:cogwheel",
"create:large_cogwheel"
"create:large_cogwheel",
"create:cogwheel"
]
}
},

View file

@ -5,6 +5,8 @@
"create:lit_blaze_burner",
"create:sail_frame",
"#minecraft:fences",
"minecraft:iron_bars"
"minecraft:iron_bars",
"minecraft:campfire",
"minecraft:soul_campfire"
]
}

View file

@ -215,7 +215,7 @@ public class AllTags {
AllBlockTags.BRITTLE.add(Blocks.FLOWER_POT, Blocks.BELL, Blocks.COCOA);
AllBlockTags.FAN_TRANSPARENT.includeAll(BlockTags.FENCES);
AllBlockTags.FAN_TRANSPARENT.add(Blocks.IRON_BARS);
AllBlockTags.FAN_TRANSPARENT.add(Blocks.IRON_BARS, Blocks.CAMPFIRE, Blocks.SOUL_CAMPFIRE);
AllBlockTags.FAN_HEATERS.add(Blocks.MAGMA_BLOCK, Blocks.CAMPFIRE, Blocks.LAVA, Blocks.FIRE, Blocks.SOUL_FIRE,
Blocks.SOUL_CAMPFIRE);

View file

@ -16,6 +16,7 @@ import com.simibubi.create.foundation.utility.BlockFace;
import net.minecraft.block.BlockState;
import net.minecraft.block.FlowingFluidBlock;
import net.minecraft.entity.LivingEntity;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.FluidState;
import net.minecraft.fluid.Fluids;
import net.minecraft.item.ItemStack;
@ -31,6 +32,7 @@ import net.minecraft.util.SoundEvents;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.Tags;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.IFluidHandler;
@ -74,7 +76,7 @@ public class OpenEndedPipe extends FlowSource {
BlockState state = world.getBlockState(outputPos);
FluidState fluidState = state.getFluidState();
boolean waterlog = state.contains(WATERLOGGED);
if (state.contains(HONEY_LEVEL) && state.get(HONEY_LEVEL) >= 5) {
if (!simulate)
world.setBlockState(outputPos, state.with(HONEY_LEVEL, 0), 3);
@ -139,8 +141,10 @@ public class OpenEndedPipe extends FlowSource {
if (simulate)
return true;
if (world.getDimension().isUltrawarm() && fluid.getFluid()
.isIn(FluidTags.WATER)) {
if (world.getDimension()
.isUltrawarm()
&& fluid.getFluid()
.isIn(FluidTags.WATER)) {
int i = outputPos.getX();
int j = outputPos.getY();
int k = outputPos.getZ();
@ -163,13 +167,33 @@ public class OpenEndedPipe extends FlowSource {
return true;
}
private void applyEffects(World world, FluidStack fluid) {
if (!fluid.getFluid()
.isEquivalentTo(AllFluids.POTION.get())) {
// other fx
return;
}
private boolean canApplyEffects(World world, FluidStack fluid) {
Fluid fluidType = fluid.getFluid();
if (fluidType.isEquivalentTo(AllFluids.POTION.get()))
return true;
if (Tags.Fluids.MILK.contains(fluidType))
return true;
return false;
}
private void applyEffects(World world, FluidStack fluid) {
Fluid fluidType = fluid.getFluid();
if (fluidType.isEquivalentTo(AllFluids.POTION.get()))
applyPotionEffects(world, fluid);
if (Tags.Fluids.MILK.contains(fluidType)) {
if (world.getGameTime() % 5 != 0)
return;
List<LivingEntity> list =
world.getEntitiesWithinAABB(LivingEntity.class, aoe, LivingEntity::canBeHitWithPotion);
ItemStack curativeItem = new ItemStack(Items.MILK_BUCKET);
for (LivingEntity livingentity : list)
livingentity.curePotionEffects(curativeItem);
}
}
private void applyPotionEffects(World world, FluidStack fluid) {
if (cachedFluid == null || cachedEffects == null || !fluid.isFluidEqual(cachedFluid)) {
FluidStack copy = fluid.copy();
copy.setAmount(250);
@ -181,7 +205,7 @@ public class OpenEndedPipe extends FlowSource {
return;
List<LivingEntity> list =
this.world.getEntitiesWithinAABB(LivingEntity.class, aoe, LivingEntity::canBeHitWithPotion);
world.getEntitiesWithinAABB(LivingEntity.class, aoe, LivingEntity::canBeHitWithPotion);
for (LivingEntity livingentity : list) {
for (EffectInstance effectinstance : cachedEffects) {
Effect effect = effectinstance.getPotion();
@ -192,7 +216,6 @@ public class OpenEndedPipe extends FlowSource {
livingentity.addPotionEffect(new EffectInstance(effectinstance));
}
}
}
@Override
@ -234,15 +257,20 @@ public class OpenEndedPipe extends FlowSource {
if (!provideFluidToSpace(resource, true))
return 0;
if (!getFluid().isEmpty() && !getFluid().isFluidEqual(resource))
FluidStack containedFluidStack = getFluid();
if (!containedFluidStack.isEmpty() && !containedFluidStack.isFluidEqual(resource))
setFluid(FluidStack.EMPTY);
if (wasPulling)
wasPulling = false;
if (canApplyEffects(world, resource))
resource = FluidHelper.copyStackWithAmount(resource, 1);
int fill = super.fill(resource, action);
if (action.execute() && (getFluidAmount() == 1000 || !FluidHelper.hasBlockState(getFluid().getFluid()))
&& provideFluidToSpace(getFluid(), false))
setFluid(FluidStack.EMPTY);
if (action.simulate())
return fill;
if (getFluidAmount() == 1000 || !FluidHelper.hasBlockState(containedFluidStack.getFluid()))
if (provideFluidToSpace(containedFluidStack, false))
setFluid(FluidStack.EMPTY);
return fill;
}

View file

@ -47,6 +47,10 @@ public class CClient extends ConfigBase {
public ConfigGroup ponder = group(1, "ponder", "Ponder settings");
public ConfigBool comfyReading =
b(false, "comfyReading", "Slow down a ponder scene whenever there is text on screen.");
public ConfigGroup sound = group(1, "sound", "Sound settings");
public ConfigBool enableAmbientSounds = b(true, "enableAmbientSounds", "Make cogs rumble and machines clatter.");
public ConfigFloat ambientVolumeCap = f(.1f, 0, 1, "ambientVolumeCap", "Maximum volume modifier of Ambient noise");
@Override
public String getName() {

View file

@ -3,6 +3,7 @@ package com.simibubi.create.foundation.sound;
import java.util.ArrayList;
import java.util.List;
import com.simibubi.create.foundation.config.AllConfigs;
import com.simibubi.create.foundation.sound.SoundScapes.AmbienceGroup;
import com.simibubi.create.foundation.sound.SoundScapes.PitchGroup;
import com.simibubi.create.foundation.utility.AnimationTickHolder;
@ -89,8 +90,9 @@ class SoundScape {
distanceMultiplier = (float) MathHelper.lerp(distanceTo / SoundScapes.MAX_AMBIENT_SOURCE_DISTANCE, 2, 0);
}
int soundCount = SoundScapes.getSoundCount(group, pitchGroup);
float max = AllConfigs.CLIENT.ambientVolumeCap.getF();
float argMax = (float) SoundScapes.SOUND_VOLUME_ARG_MAX;
return MathHelper.clamp(soundCount / (argMax * 10f), 0.025f, .15f) * distanceMultiplier;
return MathHelper.clamp(soundCount / (argMax * 10f), 0.025f, max) * distanceMultiplier;
}
}

View file

@ -11,6 +11,7 @@ import java.util.Set;
import java.util.function.BiFunction;
import com.simibubi.create.AllSoundEvents;
import com.simibubi.create.foundation.config.AllConfigs;
import com.simibubi.create.foundation.utility.AnimationTickHolder;
import com.simibubi.create.foundation.utility.Pair;
@ -60,6 +61,8 @@ public class SoundScapes {
private static Map<Pair<AmbienceGroup, PitchGroup>, SoundScape> activeSounds = new HashMap<>();
public static void play(AmbienceGroup group, BlockPos pos, float pitch) {
if (!AllConfigs.CLIENT.enableAmbientSounds.get())
return;
if (!outOfRange(pos))
addSound(group, pos, pitch);
}
@ -71,6 +74,7 @@ public class SoundScapes {
if (AnimationTickHolder.getTicks() % UPDATE_INTERVAL != 0)
return;
boolean disable = !AllConfigs.CLIENT.enableAmbientSounds.get();
for (Iterator<Entry<Pair<AmbienceGroup, PitchGroup>, SoundScape>> iterator = activeSounds.entrySet()
.iterator(); iterator.hasNext();) {
@ -78,7 +82,7 @@ public class SoundScapes {
Pair<AmbienceGroup, PitchGroup> key = entry.getKey();
SoundScape value = entry.getValue();
if (getSoundCount(key.getFirst(), key.getSecond()) == 0) {
if (disable || getSoundCount(key.getFirst(), key.getSecond()) == 0) {
value.remove();
iterator.remove();
}

View file

@ -62,8 +62,7 @@ public class VecHelper {
public static boolean isVecPointingTowards(Vector3d vec, Direction direction) {
return Vector3d.of(direction.getDirectionVec())
.dotProduct(vec.normalize()) > 0;
// return new Vector3d(direction.getDirectionVec()).distanceTo(vec.normalize()) < .75;
.dotProduct(vec.normalize()) > 0.125; // slight tolerance to activate perpendicular movement actors
}
public static Vector3d getCenterOf(Vector3i pos) {