Skip to content

Commit

Permalink
merge/1.16 upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
Lothrazar committed Nov 10, 2024
2 parents e8a8bb1 + 573e140 commit 4f6c15d
Show file tree
Hide file tree
Showing 20 changed files with 178 additions and 118 deletions.
11 changes: 11 additions & 0 deletions scripts/release.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
#!/bin/bash

echo 'updating example configs...'

cp ./run/config/cyclic.toml ./examples/config/cyclic.toml
cp ./run/config/cyclic-client.toml ./examples/config/cyclic-client.toml

echo '... done'

echo 'deploying...'

./gradlew cleanJar build signJar

echo 'jar deployed to ./build/libs/'
10 changes: 6 additions & 4 deletions src/main/java/com/lothrazar/cyclic/block/PeatBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.RandomSource;
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.state.BlockState;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.material.Fluids;
import net.minecraftforge.common.ForgeConfigSpec.DoubleValue;

public class PeatBlock extends BlockCyclic {
Expand All @@ -32,8 +32,10 @@ public void randomTick(BlockState state, ServerLevel world, BlockPos pos, Random
List<BlockPos> waters = new ArrayList<>();
for (BlockPos p : around) {
//try to bake if SOURCE water is nearby
Block bSide = world.getBlockState(p).getBlock();
if (bSide == Blocks.WATER) {
//using FluidState instead of Block
//backport fix from this PR by PocketSizedWeeb https://github.com/Lothrazar/Cyclic/pull/2404/files#diff-75c5d8aa746dbf1c0a18dfd3f48a80408e4191eb536ea0566c243038eaf05269
FluidState fluid = world.getFluidState(p);
if (fluid.is(Fluids.WATER)) {
sidesWet++;
waters.add(p);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public ContainerClock(int windowId, Level world, BlockPos pos, Inventory playerI
tile = (TileRedstoneClock) world.getBlockEntity(pos);
this.playerEntity = player;
this.playerInventory = playerInventory;
layoutPlayerInventorySlots(8, 153);
layoutPlayerInventorySlots(8, 84);
this.trackAllIntFields(tile, TileRedstoneClock.Fields.values().length);
}

Expand Down
18 changes: 7 additions & 11 deletions src/main/java/com/lothrazar/cyclic/block/clock/ScreenClock.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,29 @@ public class ScreenClock extends ScreenBase<ContainerClock> {

public ScreenClock(ContainerClock screenContainer, Inventory inv, Component titleIn) {
super(screenContainer, inv, titleIn);
this.imageHeight = 256;
}

@Override
public void init() {
super.init();
int x, y;
x = leftPos + 8;
y = topPos + 8;
x = leftPos + 6;
y = topPos + 6;
btnRedstone = addRenderableWidget(new ButtonMachineField(x, y, TileRedstoneClock.Fields.REDSTONE.ordinal(), menu.tile.getBlockPos()));
int w = 160;
int h = 20;
int h = 18;
int f = TileRedstoneClock.Fields.DURATION.ordinal();
x = leftPos + 8;
y = topPos + 38;
y = topPos + 26;
GuiSliderInteger dur = this.addRenderableWidget(new GuiSliderInteger(x, y, w, h, f, menu.tile.getBlockPos(),
1, 200, menu.tile.getField(f)));
dur.setTooltip("cyclic.clock.duration");
y += 26;
y += h + 1;
f = TileRedstoneClock.Fields.DELAY.ordinal();
GuiSliderInteger delay = this.addRenderableWidget(new GuiSliderInteger(x, y, w, h, f, menu.tile.getBlockPos(),
1, 200, menu.tile.getField(f)));
delay.setTooltip("cyclic.clock.delay");
y += 26;
y += h + 1;
f = TileRedstoneClock.Fields.POWER.ordinal();
GuiSliderInteger power = this.addRenderableWidget(new GuiSliderInteger(x, y, w, h, f, menu.tile.getBlockPos(),
1, 15, menu.tile.getField(f)));
Expand All @@ -60,9 +59,6 @@ protected void renderLabels(PoseStack ms, int mouseX, int mouseY) {

@Override
protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) {
this.drawBackground(ms, TextureRegistry.INVENTORY_LARGE_PLAIN);
// this.txtDuration.render(ms, mouseX, mouseX, partialTicks);
// this.txtDelay.render(ms, mouseX, mouseX, partialTicks);
// this.txtPower.render(ms, mouseX, mouseX, partialTicks);
this.drawBackground(ms, TextureRegistry.INVENTORY);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void setChanged() {
}
}
addSlot(new SlotItemHandler(tile.filter, 0, 152, 9));
layoutPlayerInventorySlots(8, 153);
layoutPlayerInventorySlots(8, 132);
this.trackAllIntFields(tile, TileItemCollector.Fields.values().length);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ public class ScreenItemCollector extends ScreenBase<ContainerItemCollector> {

private ButtonMachineField btnRedstone;
private ButtonMachineField btnRender;
private GuiSliderInteger sizeSlider;
private ButtonMachineField btnDirection;
private GuiSliderInteger sizeSlider;
private GuiSliderInteger heightslider;

public ScreenItemCollector(ContainerItemCollector screenContainer, Inventory inv, Component titleIn) {
super(screenContainer, inv, titleIn);
this.imageHeight = 256;
this.imageHeight = 214;
}

@Override
Expand All @@ -29,33 +29,29 @@ public void init() {
int x = leftPos + 6;
int y = topPos + 6;
int f = TileItemCollector.Fields.REDSTONE.ordinal();
int h = 20;
btnRedstone = addRenderableWidget(new ButtonMachineField(x, y, f, menu.tile.getBlockPos()));
f = TileItemCollector.Fields.RENDER.ordinal();
y += 20;
y += h;
btnRender = addRenderableWidget(new ButtonMachineField(x, y, f,
menu.tile.getBlockPos(), TextureEnum.RENDER_HIDE, TextureEnum.RENDER_SHOW, "gui.cyclic.render"))
// .setSize(18)
;
menu.tile.getBlockPos(), TextureEnum.RENDER_HIDE, TextureEnum.RENDER_SHOW, "gui.cyclic.render"));
//then toggle
f = TileItemCollector.Fields.DIRECTION.ordinal();
y += 20;
y += h;
btnDirection = addRenderableWidget(new ButtonMachineField(x, y, f,
menu.tile.getBlockPos(), TextureEnum.DIR_DOWN, TextureEnum.DIR_UPWARDS, "gui.cyclic.direction"))
//.setSize(18)
;
int w = 110;
int h = 18;
menu.tile.getBlockPos(), TextureEnum.DIR_DOWN, TextureEnum.DIR_UPWARDS, "gui.cyclic.direction"));
int w = 140;
//now start sliders
//
y = topPos + 22;
x = leftPos + 34;
x = leftPos + 30;
y = topPos + 34;
f = TileItemCollector.Fields.HEIGHT.ordinal();
heightslider = this.addRenderableWidget(new GuiSliderInteger(x, y, w, h, TileItemCollector.Fields.HEIGHT.ordinal(), menu.tile.getBlockPos(),
0, TileItemCollector.MAX_HEIGHT, menu.tile.getField(f)));
heightslider.setTooltip("buildertype.height.tooltip");
//then size
f = TileItemCollector.Fields.SIZE.ordinal();
y += h + 1;
y += h + 4;
sizeSlider = this.addRenderableWidget(new GuiSliderInteger(x, y, w, h, TileItemCollector.Fields.SIZE.ordinal(),
menu.tile.getBlockPos(), 0, TileItemCollector.MAX_SIZE, menu.tile.getField(f)));
sizeSlider.setTooltip("buildertype.size.tooltip");
Expand All @@ -81,7 +77,7 @@ protected void renderLabels(PoseStack ms, int mouseX, int mouseY) {

@Override
protected void renderBg(PoseStack ms, float partialTicks, int mouseX, int mouseY) {
this.drawBackground(ms, TextureRegistry.INVENTORY_LARGE_PLAIN);
this.drawBackground(ms, TextureRegistry.INVENTORY_MEDIUM);
for (int i = 0; i < 9; i++) {
int y = 81;
this.drawSlot(ms, 7 + i * Const.SQ, y);
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/com/lothrazar/cyclic/block/dropper/BlockDropper.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.lothrazar.cyclic.util.BlockstatesUtil;
import net.minecraft.client.gui.screens.MenuScreens;
import net.minecraft.core.BlockPos;
import net.minecraft.world.Containers;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
Expand Down Expand Up @@ -50,4 +51,17 @@ public void setPlacedBy(Level world, BlockPos pos, BlockState state, LivingEntit
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(BlockStateProperties.FACING).add(LIT);
}

@Override
public void onRemove(BlockState state, Level worldIn, BlockPos pos, BlockState newState, boolean isMoving) {
if (state.getBlock() != newState.getBlock()) {
TileDropper tileentity = (TileDropper) worldIn.getBlockEntity(pos);
if (tileentity != null && tileentity.gpsSlots != null) {
for (int s = 0; s < tileentity.gpsSlots.getSlots(); s++) {
Containers.dropItemStack(worldIn, pos.getX(), pos.getY(), pos.getZ(), tileentity.gpsSlots.getStackInSlot(s));
}
}
}
super.onRemove(state, worldIn, pos, newState, isMoving);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void init() {
x = leftPos + 32;
y = topPos + 18;
w = 120;
h = 16;
h = 18;
int f = TileDropper.Fields.DROPCOUNT.ordinal();
GuiSliderInteger dropcount = this.addRenderableWidget(new GuiSliderInteger(x, y, w, h, f, menu.tile.getBlockPos(),
1, 64, menu.tile.getField(f)));
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/lothrazar/cyclic/block/fan/ScreenFan.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ public void init() {
x = leftPos + 6;
y = topPos + 6;
btnRedstone = addRenderableWidget(new ButtonMachineField(x, y, TileFan.Fields.REDSTONE.ordinal(), menu.tile.getBlockPos()));
y += 20;
x += 20;
btnRender = addRenderableWidget(new ButtonMachineField(x, y, TileFan.Fields.RENDER.ordinal(),
menu.tile.getBlockPos(), TextureEnum.RENDER_HIDE, TextureEnum.RENDER_SHOW, "gui.cyclic.render"));
//
int w = 160;
int w = 140;
int h = 20;
int f = TileFan.Fields.SPEED.ordinal();
x = leftPos + 8;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,27 @@ public ScreenForester(ContainerForester screenContainer, Inventory inv, Componen
@Override
public void init() {
super.init();
int x, y;
int x = leftPos + 6;
int y = topPos + 6;
energy.guiLeft = leftPos;
energy.guiTop = topPos;
energy.visible = TileForester.POWERCONF.get() > 0;
x = leftPos + 6;
y = topPos + 6;
btnRedstone = addRenderableWidget(new ButtonMachineField(x, y, TileForester.Fields.REDSTONE.ordinal(), menu.tile.getBlockPos()));
y += 20;
btnRender = addRenderableWidget(new ButtonMachineField(x, y, TileForester.Fields.RENDER.ordinal(),
final int w = 120;
final int h = 20;
int f = TileForester.Fields.REDSTONE.ordinal();
btnRedstone = addRenderableWidget(new ButtonMachineField(x, y, f, menu.tile.getBlockPos()));
y += h;
f = TileForester.Fields.RENDER.ordinal();
btnRender = addRenderableWidget(new ButtonMachineField(x, y, f,
menu.tile.getBlockPos(), TextureEnum.RENDER_HIDE, TextureEnum.RENDER_SHOW, "gui.cyclic.render"));
int w = 110;
int h = 18;
int f = TileForester.Fields.HEIGHT.ordinal();
x += 28;
y += 12;
x += 30;
y += 36;
f = TileForester.Fields.HEIGHT.ordinal();
heightslider = this.addRenderableWidget(new GuiSliderInteger(x, y, w, h, TileForester.Fields.HEIGHT.ordinal(), menu.tile.getBlockPos(),
0, TileForester.MAX_HEIGHT, menu.tile.getField(f)));
//
y += h + 4;
f = TileForester.Fields.SIZE.ordinal();
y += 20;
size = this.addRenderableWidget(new GuiSliderInteger(x, y, w, h, f, menu.tile.getBlockPos(), 0, 10, menu.tile.getField(f)));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,33 +27,33 @@ public ScreenHarvester(ContainerHarvester screenContainer, Inventory inv, Compon
@Override
public void init() {
super.init();
int x, y;
energy.guiLeft = leftPos;
energy.guiTop = topPos;
energy.visible = TileHarvester.POWERCONF.get() > 0;
x = leftPos + 6;
y = topPos + 6;
btnRedstone = addRenderableWidget(new ButtonMachineField(x, y, TileHarvester.Fields.REDSTONE.ordinal(), menu.tile.getBlockPos()));
int x = leftPos + 6;
int y = topPos + 6;
final int w = 120;
final int h = 20;
int f = TileHarvester.Fields.REDSTONE.ordinal();
btnRedstone = addRenderableWidget(new ButtonMachineField(x, y, f, menu.tile.getBlockPos()));
y += 20;
btnRender = addRenderableWidget(new ButtonMachineField(x, y, TileHarvester.Fields.RENDER.ordinal(),
f = TileHarvester.Fields.RENDER.ordinal();
btnRender = addRenderableWidget(new ButtonMachineField(x, y, f,
menu.tile.getBlockPos(), TextureEnum.RENDER_HIDE, TextureEnum.RENDER_SHOW, "gui.cyclic.render"));
//
int f = TileHarvester.Fields.DIRECTION.ordinal();
y += 20;
y += h;
f = TileHarvester.Fields.DIRECTION.ordinal();
btnDirection = addRenderableWidget(new ButtonMachineField(x, y, f,
menu.tile.getBlockPos(), TextureEnum.DIR_DOWN, TextureEnum.DIR_UPWARDS, "gui.cyclic.direction"));
int w = 110;
int h = 18;
//now start sliders
//
y = topPos + 22;
x = leftPos + 34;
y = topPos + 30;
x = leftPos + 36;
f = TileHarvester.Fields.HEIGHT.ordinal();
heightslider = this.addRenderableWidget(new GuiSliderInteger(x, y, w, h, TileHarvester.Fields.HEIGHT.ordinal(), menu.tile.getBlockPos(),
0, TileHarvester.MAX_HEIGHT, menu.tile.getField(f)));
heightslider = this.addRenderableWidget(new GuiSliderInteger(x, y, w, h, f, menu.tile.getBlockPos(), 0, TileHarvester.MAX_HEIGHT, menu.tile.getField(f)));
heightslider.setTooltip("buildertype.height.tooltip");
y += h + 4;
f = TileHarvester.Fields.SIZE.ordinal();
y += 26;
size = this.addRenderableWidget(new GuiSliderInteger(x, y, w, h, f, menu.tile.getBlockPos(), 0, TileHarvester.MAX_SIZE, menu.tile.getField(f)));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ public void tick() {
//then pull from hopper facey side
Direction exportToSide = this.getBlockState().getValue(BlockFluidHopper.FACING);
if (exportToSide != null && exportToSide != Direction.UP) {
//if the target is a tank
moveFluids(exportToSide, worldPosition.relative(exportToSide), FLOW, tank);
//if the target is a cauldron
FluidHelpers.insertSourceCauldron(level, worldPosition.relative(exportToSide), tank);
this.updateComparatorOutputLevel();
this.updateComparatorOutputLevelAt(worldPosition.relative(exportToSide));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ public void init() {
//
int w = 120;
int h = 20;
x = leftPos + 32;
y += h + 1;
x = leftPos + 30;
y += h + 4;
// height fi
f = TileMiner.Fields.HEIGHT.ordinal();
GuiSliderInteger heightslider = this.addRenderableWidget(new GuiSliderInteger(x, y, w, h, f, menu.tile.getBlockPos(),
0, TileMiner.MAX_HEIGHT, menu.tile.getField(f)));
heightslider.setTooltip("buildertype.height.tooltip");
y += h + 1;
y += h + 4;
//
f = TileMiner.Fields.SIZE.ordinal();
sizeSlider = this.addRenderableWidget(new GuiSliderInteger(x, y, w, h, f, menu.tile.getBlockPos(),
Expand Down
Loading

0 comments on commit 4f6c15d

Please sign in to comment.