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 5f07bc0 + a5cfbb9 commit c0d5ddd
Show file tree
Hide file tree
Showing 21 changed files with 198 additions and 121 deletions.
5 changes: 2 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,8 @@ dependencies {
compileOnly fg.deobf("vazkii.botania:Botania:${mc_version}-${botania_version}-FORGE:api")
runtimeOnly fg.deobf("vazkii.botania:Botania:${mc_version}-${botania_version}-FORGE")



implementation fg.deobf("curse.maven:jade-324717:5493390")
// implementation fg.deobf("curse.maven:jade-324717:5493390")

// Example mod dependency using a mod jar from ./libs with a flat dir repository
// This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar
// The group id is ignored when searching -- in this case, it is "blank"
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/lothrazar/cyclic/block/PeatBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void randomTick(BlockState state, ServerLevel world, BlockPos pos, Random
//try to bake if SOURCE water is nearby
//using FluidState instead of Block
FluidState fluid = world.getFluidState(p);
if (fluid.getType() == Fluids.WATER.getSource()) {
if (fluid != null && 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(GuiGraphics ms, int mouseX, int mouseY) {

@Override
protected void renderBg(GuiGraphics 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,29 +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"));
//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"));
int w = 110;
int h = 18;
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 @@ -77,7 +77,7 @@ protected void renderLabels(GuiGraphics ms, int mouseX, int mouseY) {

@Override
protected void renderBg(GuiGraphics 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.library.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
public void init() {
super.init();
this.energy = new EnergyBar(this.font, TileForester.MAX);
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
public void init() {
super.init();
this.energy = new EnergyBar(this.font, TileHarvester.MAX_ENERGY);
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
18 changes: 10 additions & 8 deletions src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java
Original file line number Diff line number Diff line change
Expand Up @@ -437,21 +437,18 @@ private static void initConfig() {
CABLE_FACADES = CFG.comment("\r\n Allow cables to have blocks placed in them as facades (sneak-left-click to set; use empty hand to remove). Set to false to disable facades")
.define("cables.enabled", true);
//a few default
List<String> list = Arrays.asList("minecraft:ladder", "minecraft:double_plant", "minecraft:waterlily",
List<String> list = Arrays.asList("minecraft:double_plant", "minecraft:waterlily",
"minecraft:torch", "minecraft:*_torch", "minecraft:redstone", "minecraft:iron_bars",
"minecraft:chest", "minecraft:ender_chest", "minecraft:sculk_vein", "minecraft:string", "minecraft:vine",
"minecraft:rail",
"minecraft:*_rail",
"minecraft:brewing_stand",
"minecraft:*_dripleaf",
"minecraft:*_pane",
"minecraft:*_sapling", "minecraft:*_sign",
"minecraft:*_door",
"minecraft:*_banner", "minecraft:*_shulker_box",
"cyclic:*_pipe", "cyclic:*_bars",
"storagenetwork:*");
FACADE_IGNORELIST = CFG.comment("\r\n These blocks are not allowed to be used as Facades for blocks because they look weird (used by cables and Glowstone Facade and Soundproofing Facade and others)")
.define("itemsNotAllowed", list);
FACADE_IGNORELIST = CFG.comment("\r\n These blocks are not allowed to be used as Facades for blocks because they look weird (used by cables and Glowstone Facade and Soundproofing Facade and others). If you want to ignore one entire mod use an entry like this : storagenetwork:* ")
.defineList("itemsNotAllowed", list, it -> it instanceof String);
CFG.pop();
//
TRANSFER_NODES_DIMENSIONAL = CFG.comment(" Allows the dimensional Transfer Nodes to cross dimensions "
Expand Down Expand Up @@ -655,6 +652,11 @@ public static List<String> getGloomIgnoreList() {
return (List<String>) GLOOM_IGNORE_LIST.get();
}

@SuppressWarnings("unchecked")
public static List<String> getFacadeIgnoreList() {
return (List<String>) FACADE_IGNORELIST.get();
}

public static Map<String, String> getMappedBeheading() {
Map<String, String> mappedBeheading = new HashMap<String, String>();
for (String s : BEHEADING_SKINS.get()) {
Expand All @@ -672,11 +674,11 @@ public static Map<String, String> getMappedBeheading() {
}

public static BooleanValue CABLE_FACADES;
private static ConfigValue<List<String>> FACADE_IGNORELIST;
private static ConfigValue<List<? extends String>> FACADE_IGNORELIST;

public static boolean isFacadeAllowed(ItemStack item) {
ResourceLocation itemId = ForgeRegistries.ITEMS.getKey(item.getItem());
if (StringParseUtil.isInList(FACADE_IGNORELIST.get(), itemId)) {
if (StringParseUtil.isInList(getFacadeIgnoreList(), itemId)) {
return false;
}
return true;
Expand Down
Loading

0 comments on commit c0d5ddd

Please sign in to comment.