Skip to content

Commit

Permalink
Particulate Madness
Browse files Browse the repository at this point in the history
new cartoonish particles
  • Loading branch information
techno-sam committed Nov 11, 2023
1 parent 374c47c commit a9b4d1c
Show file tree
Hide file tree
Showing 44 changed files with 1,598 additions and 5,340 deletions.
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Changes
- Held conductor whistles will attempt to rebind after a conductor has moved to a new train (such as after coupling/decoupling)
- Reduce comparator output checking frequency for Track Coupler
- Couplers validate placement less frequently, improving performance
- Remote Conductor-controlled trains adjust speed based on signal strength
- Smoke rework 2.0: more minecraft-style smoke, with config for old smoke

Fixes
- Mixin conflict with VS2
Expand Down
5,253 changes: 307 additions & 4,946 deletions common/src/generated/resources/.cache/7568cfb1ba927d76bbe88ce5981c1ed7cd0b00e8

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// 1.19.2 2023-04-25T20:02:00.079877845 Steam 'n Rails's lang merger
35e6ba72d79b51d2919958faa4ca27ef261eeef4 assets/railways/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.railwayteam.railways.config;

import com.railwayteam.railways.content.smokestack.SmokeParticle.SmokeQuality;
import com.railwayteam.railways.content.smokestack.SmokeType;
import com.railwayteam.railways.content.smokestack.particles.legacy.SmokeParticle.SmokeQuality;
import com.simibubi.create.foundation.config.ConfigBase;

@SuppressWarnings("unused")
Expand All @@ -18,11 +19,12 @@ public class CClient extends ConfigBase {

// smoke
public final ConfigGroup smoke = group(1, "smoke", Comments.smoke);
public final ConfigEnum<SmokeType> smokeType = e(SmokeType.OLD, "smokeType", Comments.smokeType);
public final ConfigGroup oldSmoke = group(2, "old", Comments.oldSmoke);
public final ConfigInt smokeLifetime = i(500, 20, 1000, "smokeLifetime", Comments.inTicks, Comments.smokeLifetime);
public final ConfigFloat smokePercentage = f(0.75f, 0.0f, 10.0f, "smokePercentage", Comments.smokePercentage);
public final ConfigEnum<SmokeQuality> smokeQuality = e(SmokeQuality.HIGH, "smokeQuality", Comments.smokeQuality);
public final ConfigBool thickerSmoke = b(true, "thickerSmoke", Comments.thickerSmoke);
public final ConfigBool oldSmoke = b(false, "oldSmoke", Comments.oldSmoke);

// journeymap
public final ConfigGroup journeymap = group(1, "journeymap", Comments.journeymap);
Expand All @@ -49,11 +51,12 @@ private static class Comments {
static String useDevCape2 = "This setting may require a relog to take effect";

static String smoke = "Smoke Settings";
static String oldSmoke = "Old-style Smoke Settings";
static String smokeLifetime = "Lifetime of smoke particles emitted by contraptions";
static String smokePercentage = "Smoke emission rate on contraptions";
static String smokeQuality = "Smoke texture quality";
static String thickerSmoke = "Thicker smoke (renders 2 extra layers per particle)";
static String oldSmoke = "Revert smokestacks to using vanilla smoke particles";
static String smokeType = "Smoke particle style";

static String journeymap = "Journeymap Settings";
static String journeymapUpdateTicks = "Journeymap train overlay update time";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,11 @@ protected void updateFrequencyListeners() {
sneakListener = new FrequencyListener("sneak");
}

public int getForwardSignalStrength() {
if (forwardListener == null) return 0;
return forwardListener.receivedStrength;
}

private List<ItemStack> getHeldSchedules() {
if (heldSchedules == null) {
heldSchedules = new ArrayList<>();
Expand Down Expand Up @@ -1014,7 +1019,7 @@ public void tick() {
ventCooldown--;
if (level instanceof ServerLevel serverLevel) {
if (fakePlayer == null) {
fakePlayer = EntityUtils.createConductorFakePlayer(serverLevel);
fakePlayer = EntityUtils.createConductorFakePlayer(serverLevel, this);
}
if ((Object) currentlyViewing.get() instanceof ServerPlayer player) {
SectionPos chunkPos = SectionPos.of(blockPosition());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.railwayteam.railways.content.conductor;

import org.jetbrains.annotations.Nullable;

public interface IConductorHoldingFakePlayer {
@Nullable ConductorEntity getConductor();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
package com.railwayteam.railways.content.smokestack;

import com.railwayteam.railways.util.ShapeWrapper;
import com.simibubi.create.AllTags;
import com.simibubi.create.content.equipment.wrench.IWrenchable;
import com.simibubi.create.foundation.block.IBE;
import com.simibubi.create.foundation.block.ProperWaterloggedBlock;
import com.simibubi.create.foundation.blockEntity.SmartBlockEntity;
import net.minecraft.MethodsReturnNonnullByDefault;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import javax.annotation.ParametersAreNonnullByDefault;

@MethodsReturnNonnullByDefault
@ParametersAreNonnullByDefault
public abstract class AbstractSmokeStackBlock<T extends SmartBlockEntity> extends Block implements ProperWaterloggedBlock, IWrenchable, IBE<T> {

public static final BooleanProperty ENABLED = BlockStateProperties.ENABLED;
public static final BooleanProperty POWERED = BlockStateProperties.POWERED;
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;

protected final ShapeWrapper shape;

public AbstractSmokeStackBlock(Properties properties, ShapeWrapper shape) {
super(properties);
this.registerDefaultState(this.makeDefaultState());
this.shape = shape;
}

@Override
@SuppressWarnings("deprecation")
public VoxelShape getShape(BlockState pState, BlockGetter pLevel, BlockPos pPos, CollisionContext pContext) {
return shape.get();
}

protected BlockState makeDefaultState() {
return this.defaultBlockState()
.setValue(ENABLED, true)
.setValue(POWERED, false)
.setValue(WATERLOGGED, false);
}

@Override
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
super.createBlockStateDefinition(builder);
builder.add(ENABLED).add(POWERED).add(WATERLOGGED);
}

@Override
@SuppressWarnings("deprecation")
public @NotNull FluidState getFluidState(BlockState state) {
return fluidState(state);
}

@Nullable
@Override
public BlockState getStateForPlacement(BlockPlaceContext context) {
BlockState blockstate = this.defaultBlockState();
FluidState fluidstate = context.getLevel().getFluidState(context.getClickedPos());

if (context.getLevel().hasNeighborSignal(context.getClickedPos())) {
blockstate = blockstate.setValue(ENABLED, false).setValue(POWERED, true);
}

return blockstate.setValue(WATERLOGGED, fluidstate.getType() == Fluids.WATER);
}

@Override
@SuppressWarnings("deprecation")
public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos currentPos, BlockPos neighborPos) {
updateWater(level, state, currentPos);
return state;
}

@Override
public InteractionResult use(BlockState pState, Level pLevel, BlockPos pPos, Player pPlayer, InteractionHand pHand,
BlockHitResult pHit) {
if (AllTags.AllItemTags.WRENCH.matches(pPlayer.getItemInHand(pHand))) {
return super.use(pState, pLevel, pPos, pPlayer, pHand, pHit);
}
pState = pState.cycle(ENABLED);
pLevel.setBlock(pPos, pState, 2);
if (pState.getValue(WATERLOGGED))
pLevel.scheduleTick(pPos, Fluids.WATER, Fluids.WATER.getTickDelay(pLevel));
return InteractionResult.sidedSuccess(pLevel.isClientSide);
}

@Override
@SuppressWarnings("deprecation")
public void neighborChanged(BlockState state, Level level, BlockPos pos, Block block, BlockPos fromPos, boolean isMoving) {
super.neighborChanged(state, level, pos, block, fromPos, isMoving);
if (!level.isClientSide) {
boolean powered = level.hasNeighborSignal(pos);
boolean shouldBeEnabled = !powered;
if (powered != state.getValue(POWERED)) {
if (state.getValue(ENABLED) != shouldBeEnabled) {
state = state.setValue(ENABLED, shouldBeEnabled);
}

level.setBlock(pos, state.setValue(POWERED, powered), 2);
if (state.getValue(WATERLOGGED)) {
level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level));
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

import com.railwayteam.railways.registry.CRBlockEntities;
import com.railwayteam.railways.util.ShapeWrapper;
import com.simibubi.create.foundation.block.IBE;
import net.minecraft.world.level.block.entity.BlockEntityType;

public class DieselSmokeStackBlock extends SmokeStackBlock implements IBE<DieselSmokeStackBlockEntity> {
public DieselSmokeStackBlock(Properties properties, SmokeStackType type, ShapeWrapper shape, boolean createsStationarySmoke) {
super(properties, type, shape, createsStationarySmoke);
public class DieselSmokeStackBlock extends AbstractSmokeStackBlock<DieselSmokeStackBlockEntity> {
public DieselSmokeStackBlock(Properties properties, ShapeWrapper shape) {
super(properties, shape);
}

@Override
Expand Down
Loading

0 comments on commit a9b4d1c

Please sign in to comment.