Skip to content

Commit

Permalink
Add comparator output
Browse files Browse the repository at this point in the history
  • Loading branch information
hlysine committed Nov 11, 2023
1 parent 1f951c4 commit 5119625
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 5 deletions.
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
11 changes: 6 additions & 5 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ done
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum

Expand Down Expand Up @@ -144,15 +141,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -197,6 +194,10 @@ if "$cygwin" || "$msys" ; then
done
fi


# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.Direction.Axis;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import org.jetbrains.annotations.NotNull;

public class AndesiteChunkLoaderBlock extends DirectionalKineticBlock implements IBE<AndesiteChunkLoaderBlockEntity> {

Expand All @@ -31,6 +34,22 @@ public SpeedLevel getMinimumRequiredSpeedLevel() {
return SpeedLevel.MEDIUM;
}

@SuppressWarnings("deprecation")
@Override
public boolean hasAnalogOutputSignal(@NotNull BlockState pState) {
return true;
}

@SuppressWarnings("deprecation")
@Override
public int getAnalogOutputSignal(@NotNull BlockState pState, @NotNull Level pLevel, @NotNull BlockPos pPos) {
BlockEntity be = pLevel.getBlockEntity(pPos);
if (be instanceof AndesiteChunkLoaderBlockEntity chunkLoader) {
return chunkLoader.isSpeedRequirementFulfilled() ? 15 : 0;
}
return 0;
}

@Override
public Class<AndesiteChunkLoaderBlockEntity> getBlockEntityClass() {
return AndesiteChunkLoaderBlockEntity.class;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public void tick() {
if (server && chunkUpdateCooldown-- <= 0) {
chunkUpdateCooldown = 10;
if (needsUpdate()) {
setChanged();
lastBlockPos = getBlockPos().immutable();
lastSpeedRequirement = isSpeedRequirementFulfilled();
updateForcedChunks();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
package com.hlysine.create_power_loader.content.brasschunkloader;

import com.hlysine.create_power_loader.CPLBlockEntityTypes;
import com.hlysine.create_power_loader.content.andesitechunkloader.AndesiteChunkLoaderBlockEntity;
import com.simibubi.create.content.kinetics.base.DirectionalKineticBlock;
import com.simibubi.create.foundation.block.IBE;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.Direction.Axis;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import org.jetbrains.annotations.NotNull;

public class BrassChunkLoaderBlock extends DirectionalKineticBlock implements IBE<BrassChunkLoaderBlockEntity> {

Expand All @@ -31,6 +35,22 @@ public SpeedLevel getMinimumRequiredSpeedLevel() {
return SpeedLevel.MEDIUM;
}

@SuppressWarnings("deprecation")
@Override
public boolean hasAnalogOutputSignal(@NotNull BlockState pState) {
return true;
}

@SuppressWarnings("deprecation")
@Override
public int getAnalogOutputSignal(@NotNull BlockState pState, @NotNull Level pLevel, @NotNull BlockPos pPos) {
BlockEntity be = pLevel.getBlockEntity(pPos);
if (be instanceof BrassChunkLoaderBlockEntity chunkLoader) {
return chunkLoader.isSpeedRequirementFulfilled() ? 15 : 0;
}
return 0;
}

@Override
public Class<BrassChunkLoaderBlockEntity> getBlockEntityClass() {
return BrassChunkLoaderBlockEntity.class;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public void tick() {
if (server && chunkUpdateCooldown-- <= 0) {
chunkUpdateCooldown = 10;
if (needsUpdate()) {
setChanged();
lastBlockPos = getBlockPos().immutable();
lastSpeedRequirement = isSpeedRequirementFulfilled();
lastRange = getLoadingRange();
Expand Down

0 comments on commit 5119625

Please sign in to comment.