Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build_reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Setup JDK
uses: actions/setup-java@v4
with:
java-version: 21
java-version: 25
distribution: 'microsoft'

- name: Setup Gradle
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ dependencies {
implementation("fi.dy.masa.malilib:malilib-fabric-${project.property("malilib_version")}")
implementation("net.kr1v:malilib-api:${project.property("malilib_api_version")}")
}
annotationProcessor("net.kr1v:malilib-api-processor:1.0.0")
"clientAnnotationProcessor"("net.kr1v:malilib-api-processor:1.0.0")
}

configurations.all {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ archives_base_name = redstonetools
loader_version=0.18.4
mod_version = 3.4.0

loomx.loom_version = 1.16-SNAPSHOT
loomx.loom_version = 1.17-SNAPSHOT
loomx.loom_remap_plugin = net.fabricmc.fabric-loom-remap
loomx.loom_unobf_plugin = net.fabricmc.fabric-loom
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ stonecutter {
centralScript = "build.gradle.kts"

create(rootProject) {
versions("1.21.4", "1.21.5", "1.21.8", "1.21.10", "1.21.11", "26.1.2")
versions("1.21.4", "1.21.5", "1.21.8", "1.21.10", "1.21.11", "26.1.2", "26.2")
vcsVersion = "1.21.11"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ public void resetToDefault() {
@Override
protected boolean onMouseClickedImpl(/*? if >=1.21.10 {*/net.minecraft.client.input.MouseButtonEvent click, boolean doubleClick/*? } else {*//*int mouseX, int mouseY, int mouseButton*//*? }*/) {
super.onMouseClickedImpl(/*? if >=1.21.10 {*/click, doubleClick/*? } else {*//*mouseX, mouseY, mouseButton*//*? }*/);
GuiBase.openGui(new GuiMacroEditor(Component.nullToEmpty(configMacro.macroName), configMacro, Minecraft.getInstance().screen));
GuiBase.openGui(new GuiMacroEditor(Component.nullToEmpty(configMacro.macroName), configMacro,/*? if <26.2 {*/Minecraft.getInstance().screen/*?} else {*/ /*Minecraft.getInstance().gui.screen()*//*?}*/
));
return true;
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,91 @@ public static BlockHitResult findAirPlaceBlockHit(Player playerEntity) {
return new BlockHitResult(hit.getLocation(), hit.getDirection(), hit.getBlockPos(), false);
}

//? if <26.1 {
private static void renderBlockOutline(WorldRenderContext context, Minecraft client, BlockPos blockPos, BlockState blockState) {
//? } else
//private static void renderBlockOutline(LevelRenderContext context, Minecraft client, BlockPos blockPos, BlockState blockState) {
//? if <26.2 {
Camera camera = client.gameRenderer.getMainCamera();
//?} else
//Camera camera = client.gameRenderer.mainCamera();
Vec3 camPos = camera
//? if <=1.21.5 {
/*.getPosition();
*///? } else if <=1.21.10 {
/*.position();
*///?} else {
.position();
//?}

//? if >=26.2 {
/*var poseStack = context.poseStack();
poseStack.pushPose();
poseStack.translate(blockPos.getX() - camPos.x, blockPos.getY() - camPos.y, blockPos.getZ() - camPos.z);
context.submitNodeCollector().submitShapeOutline(
poseStack,
blockState.getShape(client.level, blockPos, net.minecraft.world.phys.shapes.CollisionContext.of(camera.entity())),
RenderTypes.lines(),
CommonColors.BLACK,
client.getWindow().getAppropriateLineWidth(),
false
);
poseStack.popPose();
*///?} else {

//? if <26.1 {
VertexConsumer consumer = context.consumers().getBuffer(
//? } else
//VertexConsumer consumer = context.bufferSource().getBuffer(
//? if <=1.21.10 {
/*RenderType.lines()
*///?} else {
RenderTypes.lines()
//?}
);

//? if <1.21.10 {
/*((WorldRendererInvoker) context.worldRenderer()).invokeRenderHitOutline(
context.matrixStack(),
consumer,
client.player,
camPos.x, camPos.y, camPos.z,
blockPos,
blockState,
CommonColors.BLACK
);
*///?} else {
//? if <26.1 {
((WorldRendererInvoker) context.worldRenderer()).invokeRenderHitOutline(
//? } else
//((WorldRendererInvoker) context.levelRenderer()).invokeRenderHitOutline(
//? if <26.1 {
context.matrices(),
//? } else
//context.poseStack(),
consumer,
camPos.x, camPos.y, camPos.z,
//? if <26.1 {
new BlockOutlineRenderState(
blockPos,
false,
false,
blockState.getShape(client.level, blockPos)
),
//? } else {
/*new BlockOutlineRenderState(
blockPos,
false,
false,
blockState.getShape(client.level, blockPos, net.minecraft.world.phys.shapes.CollisionContext.of(camera.entity()))
),
*///? }
CommonColors.BLACK/*? if >=1.21.11 {*/, client.getWindow().getAppropriateLineWidth()/*?}*/
);
//?}
//?}
}

{

//? if <26.1 {
Expand Down Expand Up @@ -133,67 +218,7 @@ public static BlockHitResult findAirPlaceBlockHit(Player playerEntity) {
if (blockState == null)
return;

/* render block outline */
Camera camera = client.gameRenderer.getMainCamera();
Vec3 camPos = camera
//? if <=1.21.5 {
/*.getPosition();
*///? } else if <=1.21.10 {
/*.position();
*///?} else {
.position();
//?}

//? if <26.1 {
VertexConsumer consumer = context.consumers().getBuffer(
//? } else
//VertexConsumer consumer = context.bufferSource().getBuffer(
//? if <=1.21.10 {
/*RenderType.lines()
*///?} else {
RenderTypes.lines()
//?}
);

//? if <1.21.10 {
/*((WorldRendererInvoker) context.worldRenderer()).invokeRenderHitOutline(
context.matrixStack(),
consumer,
client.player,
camPos.x, camPos.y, camPos.z,
blockPos,
blockState,
CommonColors.BLACK
);
*///?} else {
//? if <26.1 {
((WorldRendererInvoker) context.worldRenderer()).invokeRenderHitOutline(
//? } else
//((WorldRendererInvoker) context.levelRenderer()).invokeRenderHitOutline(
//? if <26.1 {
context.matrices(),
//? } else
//context.poseStack(),
consumer,
camPos.x, camPos.y, camPos.z,
//? if <26.1 {
new BlockOutlineRenderState(
blockPos,
false,
false,
blockState.getShape(client.level, blockPos)
),
//? } else {
/*new BlockOutlineRenderState(
blockPos,
false,
false,
blockState.getShape(client.level, blockPos, net.minecraft.world.phys.shapes.CollisionContext.of(camera.entity()))
),
*///? }
CommonColors.BLACK/*? if >=1.21.11 {*/, client.getWindow().getAppropriateLineWidth()/*?}*/
);
//?}
renderBlockOutline(context, client, blockPos, blockState);
};

//? if <1.21.10 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

@Mixin(LevelRenderer.class)
public interface WorldRendererInvoker {
//? if <26.2 {
@Invoker
//? if <=1.21.8 {
/*void invokeRenderHitOutline(PoseStack matrices, VertexConsumer vertexConsumer, Entity entity, double cameraX, double cameraY, double cameraZ, BlockPos pos, BlockState state, int color);
Expand All @@ -23,4 +24,5 @@ public interface WorldRendererInvoker {
*///?} else {
void invokeRenderHitOutline(PoseStack matrices, VertexConsumer vertexConsumer, double x, double y, double z, BlockOutlineRenderState state, int color, float lineWidth);
//?}
//?}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ public enum SignalBlock {
COMMAND_BLOCK(Blocks.COMMAND_BLOCK, SignalBlockSupplier.commandBlock()),
AUTO(null, null);

/**
* Signal strength at which {@code /ssb} switches from a container to a command block.
*
* <p>26.2 validates container contents strictly, so overstacked slots are dropped and a
* container can no longer exceed 15. Below 26.2 the overstacking trick still works, so the
* container is used up to the point where a comparator can no longer read it.
*/
//? if <26.2 {
private static final int COMMAND_BLOCK_THRESHOLD = 1780;
//?} else
//private static final int COMMAND_BLOCK_THRESHOLD = 16;

private final Block block;
private final SignalBlockSupplier supplier;

Expand All @@ -29,7 +41,7 @@ public enum SignalBlock {
}

public static SignalBlock getBestBlock(int signal) {
return signal < 1780
return signal < COMMAND_BLOCK_THRESHOLD
? BARREL
: COMMAND_BLOCK;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,18 @@
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.component.CustomData;
import net.minecraft.world.item.component.ItemContainerContents;
//? if >=1.21.10 {
import net.minecraft.world.item.component.TypedEntityData;
//?} else {
/*import net.minecraft.world.item.component.CustomData;
*///?}
import net.minecraft.world.level.block.Block;

//? if >=26.2 {
/*import net.minecraft.world.level.block.entity.BlockEntityTypes;
*///?} else if >=1.21.10 {
import net.minecraft.world.level.block.entity.BlockEntityType;
//?}
@FunctionalInterface
public interface SignalBlockSupplier {

Expand Down Expand Up @@ -73,9 +81,19 @@ static SignalBlockSupplier commandBlock() {
CompoundTag blockEntityNbt = new CompoundTag();
blockEntityNbt.putInt("SuccessCount", signalStrength);

CustomData blockEntityData = CustomData.of(blockEntityNbt);

commandBlockStack.set(DataComponents.CUSTOM_DATA, blockEntityData);
//? if <1.21.10 {
/*blockEntityNbt.putString("id", "minecraft:command_block");
commandBlockStack.set(DataComponents.BLOCK_ENTITY_DATA, CustomData.of(blockEntityNbt));
*///?} else {
commandBlockStack.set(
DataComponents.BLOCK_ENTITY_DATA,
//? if >=26.2 {
/*TypedEntityData.of(BlockEntityTypes.COMMAND_BLOCK, blockEntityNbt)
*///?} else {
TypedEntityData.of(BlockEntityType.COMMAND_BLOCK, blockEntityNbt)
//?}
);
//?}
return commandBlockStack;
};
}
Expand All @@ -91,7 +109,10 @@ private static int calculateComparatorOutput(int items, int slots, int item$getM

private static Item getBestItem(int signalStrength, int slots) {
if (signalStrength > 15)
//? if <26.2 {
return Items.WHITE_SHULKER_BOX;
//?} else
//return Items.DYED_SHULKER_BOX.white();
else if (slots >= 15)
return Items.WOODEN_SHOVEL;
else
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"depends": {
"fabricloader": ">=0.18.1",
"fabric-api": "*",
"minecraft": ">=1.21.4 <=26.1.2"
"minecraft": ">=1.21.4 <=26.2"
},
"recommends": {
"worldedit": "*",
Expand Down
7 changes: 7 additions & 0 deletions versions/26.2/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
minecraft_version=26.2
minecraft_version_out=26.2

fabric_version=0.156.0+26.2
malilib_version=26.2:0.29.3
malilib_api_version=0.8.3-26.2
worldedit_version=26.2:8.0.0-SNAPSHOT
Loading