Skip to content

Commit

Permalink
Merge branch 'dev/1.20.1' into resizewidget
Browse files Browse the repository at this point in the history
  • Loading branch information
Rover656 authored Nov 11, 2023
2 parents ebe25df + c39cbc3 commit 5c5c885
Show file tree
Hide file tree
Showing 570 changed files with 5,071 additions and 1,776 deletions.
4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ charset = utf-8
end_of_line = crlf
indent_size = 4
indent_style = space
insert_final_newline = false
insert_final_newline = true
max_line_length = 160
tab_width = 4
ij_continuation_indent_size = 8
Expand Down Expand Up @@ -101,7 +101,7 @@ ij_java_case_statement_on_separate_line = true
ij_java_catch_on_new_line = false
ij_java_class_annotation_wrap = split_into_lines
ij_java_class_brace_style = end_of_line
ij_java_class_count_to_use_import_on_demand = 5
ij_java_class_count_to_use_import_on_demand = 9999
ij_java_class_names_in_javadoc = 1
ij_java_do_not_indent_top_level_class_members = false
ij_java_do_not_wrap_after_single_annotation = true
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/checkstyle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Code Style Scan
on: [pull_request]
jobs:
checkstyle:
name: runner / checkstyle
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dbelyaev/[email protected]
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
level: warning
checkstyle_config: config/checkstyle/checkstyle.xml
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,15 @@ Update your `build.gradle` to contain the following:

```groovy
repositories {
maven { url 'https://maven.tterrag.com' }
maven { url 'https://maven.rover656.dev/releases' }
}
dependencies {
// Include Ender IO API for compilation
compileOnly fg.deobf("com.enderio:EnderIO:<VERSION>:api")
// Use EnderIO at runtime
runtimeOnly fg.deobf("com.enderio.EnderIO:<VERSION>")
runtimeOnly fg.deobf("com.enderio:EnderIO:<VERSION>")
}
```
If you need any feature in the api, contact us.
Expand Down
10 changes: 8 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ repositories { RepositoryHandler handler ->
exclusiveRepo(handler, 'https://maven.tterrag.com/', 'com.tterrag.registrate', 'com.jozufozu.flywheel')
exclusiveRepo(handler, 'https://modmaven.dev/', 'mezz.jei', 'mcjty.theoneprobe', 'appeng')
exclusiveRepo(handler, 'https://cursemaven.com', 'curse.maven')
exclusiveRepo(handler, 'https://maven.blamejared.com', 'vazkii.patchouli', 'net.darkhax.bookshelf', 'net.darkhax.enchdesc')
exclusiveRepo(handler, 'https://maven.blamejared.com', 'vazkii.patchouli', 'net.darkhax.bookshelf', 'net.darkhax.enchdesc', 'com.almostreliable.mods')
exclusiveRepo(handler, 'https://dogforce-games.com/maven', 'dev.gigaherz.graph')
exclusiveRepo(handler, 'https://api.modrinth.com/maven', 'maven.modrinth')

Expand Down Expand Up @@ -260,9 +260,15 @@ dependencies {
// Jade
runtimeOnly fg.deobf("curse.maven:jade-324717:${jade_cf_id}")

//fluxnetworks
runtimeOnly fg.deobf("curse.maven:fluxnetworks-248020:4651164")

//Flywheel
compileOnly fg.deobf("com.jozufozu.flywheel:flywheel-forge-1.20.1:0.6.9-5") // REMOVE When crash is fixed

// Almost Unified
compileOnly fg.deobf("com.almostreliable.mods:almostunified-forge:${minecraft_version}-${almostunified_version}")

// Patchouli
// compileOnly fg.deobf("vazkii.patchouli:Patchouli:${patchouli_version}:api")
// runtimeOnly fg.deobf("vazkii.patchouli:Patchouli:${patchouli_version}")
Expand Down Expand Up @@ -501,4 +507,4 @@ def setupExtraSourceSets(SourceSet base) {
baseImplementation.extendsFrom(project.configurations.getByName("implementation"))
baseCompileOnly.extendsFrom(project.configurations.getByName("compileOnly"))
baseRuntimeOnly.extendsFrom(project.configurations.getByName("runtimeOnly"))
}
}
33 changes: 33 additions & 0 deletions config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name="Checker">
<module name="JavadocPackage"/>
<module name="TreeWalker">
<module name="AvoidStarImport"/>
<module name="ConstantName"/>

<!-- Modifier Checks -->
<!-- See https://checkstyle.org/checks/modifier/index.html -->
<module name="ModifierOrder"/>
<module name="RedundantModifier"/>

<!-- Checks for blocks. You know, those {}'s -->
<!-- See https://checkstyle.org/checks/blocks/index.html -->
<module name="AvoidNestedBlocks"/>
<module name="EmptyBlock"/>
<module name="LeftCurly"/>
<module name="NeedBraces"/>
<module name="RightCurly"/>

<!-- Checks for common coding problems -->
<!-- See https://checkstyle.org/checks/coding/index.html -->
<module name="EmptyStatement"/>
<module name="IllegalInstantiation"/>
<module name="InnerAssignment"/>
<module name="MissingSwitchDefault"/>
<module name="MultipleVariableDeclarations"/>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>
</module>
</module>
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ mekanism_cf_id=3922056
jade_cf_id=4614153
ench_desc_version=17.0.3
bookshelf_version=20.0.2
almostunified_version=0.6.0

# ===========================
# Combined Project Properties
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package com.enderio.api.capability;

import org.jetbrains.annotations.Nullable;

import java.util.function.Consumer;

public interface ICoordinateSelectionHolder {

@Nullable
CoordinateSelection getSelection();

void setSelection(CoordinateSelection selection);
Expand All @@ -13,7 +16,8 @@ default boolean hasSelection() {
}

default void ifSelectionPresent(Consumer<CoordinateSelection> cons) {
if (hasSelection())
if (hasSelection()) {
cons.accept(getSelection());
}
}
}
4 changes: 3 additions & 1 deletion src/api/java/com/enderio/api/conduit/ConduitItemFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ public static void setFactory(BiFunction<Supplier<? extends IConduitType<?>>, It
* @return
*/
public static Item build(Supplier<? extends IConduitType<?>> type, Item.Properties properties) {
if (factory != null)
if (factory != null) {
return factory.apply(type, properties);
}

return new Item(properties);
}
}
3 changes: 2 additions & 1 deletion src/api/java/com/enderio/api/conduit/IConduitType.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ default boolean canBeReplacedBy(IConduitType<?> other) {

T createExtendedConduitData(Level level, BlockPos pos);

default <K> Optional<LazyOptional<K>> proxyCapability(Capability<K> cap, T extendedConduitData, @Nullable Direction direction) {
default <K> Optional<LazyOptional<K>> proxyCapability(Capability<K> cap, T extendedConduitData, Level level, BlockPos pos, @Nullable Direction direction,
Optional<NodeIdentifier.IOState> state) {
return Optional.empty();
}

Expand Down
7 changes: 5 additions & 2 deletions src/api/java/com/enderio/api/conduit/TieredConduit.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ public ResourceLocation getItemTexture() {

@Override
public boolean canBeReplacedBy(IConduitType<?> other) {
if (!(other instanceof TieredConduit<?> tieredOther))
if (!(other instanceof TieredConduit<?> tieredOther)) {
return false;
}

if (type.equals(tieredOther.getType())) {
return tier < tieredOther.getTier();
Expand All @@ -49,8 +50,10 @@ public boolean canBeReplacedBy(IConduitType<?> other) {

@Override
public boolean canBeInSameBlock(IConduitType<?> other) {
if (!(other instanceof TieredConduit<?> tieredOther))
if (!(other instanceof TieredConduit<?> tieredOther)) {
return true;
}

// if they have the same type they can't be in the same block, their tier doesn't matter as canBeReplacedBy is checked first
return !type.equals(tieredOther.getType());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,36 @@ default void tickGraph(IConduitType<?> type, List<NodeIdentifier<?>> loadedNodes
for (ColorControl color: ColorControl.values()) {
List<Connection> extractList = extracts.get(color);
List<Connection> insertList = inserts.get(color);
if (extractList.isEmpty() || insertList.isEmpty())
if (extractList.isEmpty() || insertList.isEmpty()) {
continue;
}

tickColoredGraph(type, insertList, extractList, color, level, graph, isRedstoneActive);
}
}

void tickColoredGraph(IConduitType<?> type, List<Connection> inserts, List<Connection> extracts, ColorControl color, ServerLevel level, Graph<Mergeable.Dummy> graph, TriFunction<ServerLevel, BlockPos, ColorControl, Boolean> isRedstoneActive);
default boolean isRedstoneMode(IConduitType<?> type, ServerLevel level, BlockPos pos, NodeIdentifier.IOState state, TriFunction<ServerLevel, BlockPos, ColorControl, Boolean> isRedstoneActive) {
if (!type.getMenuData().showRedstoneExtract())
if (!type.getMenuData().showRedstoneExtract()) {
return true;
if (state.control() == RedstoneControl.ALWAYS_ACTIVE)
}

if (state.control() == RedstoneControl.ALWAYS_ACTIVE) {
return true;
if (state.control() == RedstoneControl.NEVER_ACTIVE)
}

if (state.control() == RedstoneControl.NEVER_ACTIVE) {
return false;
}

boolean hasRedstone = false;
for (Direction direction: Direction.values()) {
if (level.getSignal(pos.relative(direction), direction) > 0) {
hasRedstone = true;
break;
}
}

return state.control().isActive(hasRedstone || isRedstoneActive.apply(level, pos, state.redstoneChannel()));
}
record Connection(BlockPos pos, Direction dir, IExtendedConduitData<?> data) {
Expand Down
5 changes: 5 additions & 0 deletions src/api/java/com/enderio/api/conduit/ticker/package-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@javax.annotation.ParametersAreNonnullByDefault
@net.minecraft.MethodsReturnNonnullByDefault
@com.tterrag.registrate.util.nullness.FieldsAreNonnullByDefault

package com.enderio.api.conduit.ticker;
12 changes: 11 additions & 1 deletion src/api/java/com/enderio/api/integration/Integration.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.SmeltingRecipe;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.data.event.GatherDataEvent;
import net.minecraftforge.eventbus.api.IEventBus;
Expand Down Expand Up @@ -79,4 +80,13 @@ default Optional<BlockState> getFacadeOf(ItemStack stack) {
default boolean canBlockTeleport(Player player) {
return false;
}
}

/**
* Usage intended for kubejs io, tell us if you need it for something else
* @param recipe The smelting recipe that is tried to be used in the AlloySmelter.
* @return true if this recipe can be used
*/
default boolean acceptSmeltingRecipe(SmeltingRecipe recipe) {
return true;
}
}
12 changes: 9 additions & 3 deletions src/api/java/com/enderio/api/integration/IntegrationManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.function.*;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;

public class IntegrationManager {

Expand Down Expand Up @@ -43,16 +47,18 @@ public static <T> Optional<T> getFirst(Function<Integration, Optional<T>> mapper

public static void executeIf(Predicate<Integration> condition, Consumer<Integration> consumer) {
for (Integration integration : ALL_INTEGRATIONS) {
if (condition.test(integration))
if (condition.test(integration)) {
consumer.accept(integration);
}
}
}

public static <T> List<T> getIf(Predicate<Integration> condition, Function<Integration, T> mapper) {
List<T> list = new ArrayList<>();
for (Integration integration : ALL_INTEGRATIONS) {
if (condition.test(integration))
if (condition.test(integration)) {
list.add(mapper.apply(integration));
}
}
return list;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ public boolean isEmpty() {
* @throws NullPointerException if {@code consumer} is null and this {@link LazyOptional} is non-empty
*/
public void ifPresent(Consumer<? super T> consumer) {
if (isPresent())
if (isPresent()) {
consumer.accept(value);
}
}

/**
Expand Down
5 changes: 4 additions & 1 deletion src/api/java/com/enderio/api/io/IOMode.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ public enum IOMode {
*/
DISABLED(false, false, false, false);

private final boolean input, output, force, canConnect;
private final boolean input;
private final boolean output;
private final boolean force;
private final boolean canConnect;

IOMode(boolean input, boolean output, boolean force, boolean canConnect) {
this.input = input;
Expand Down
4 changes: 3 additions & 1 deletion src/api/java/com/enderio/api/io/energy/EnergyIOMode.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ public enum EnergyIOMode {
*/
Both(true, true, true);

private final boolean input, output, respectIOConfig;
private final boolean input;
private final boolean output;
private final boolean respectIOConfig;

EnergyIOMode(boolean input, boolean output, boolean respectIOConfig) {
this.input = input;
Expand Down
9 changes: 7 additions & 2 deletions src/api/java/com/enderio/api/misc/Vector2i.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,18 @@ public String toString() {

@Override
public boolean equals(Object o) {
if (this == o)
if (this == o) {
return true;
if (o == null)
}

if (o == null) {
return false;
}

if (o instanceof Vector2i other) {
return x == other.x && y == other.y;
}

return false;
}

Expand Down
5 changes: 5 additions & 0 deletions src/api/java/com/enderio/api/misc/package-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@javax.annotation.ParametersAreNonnullByDefault
@net.minecraft.MethodsReturnNonnullByDefault
@com.tterrag.registrate.util.nullness.FieldsAreNonnullByDefault

package com.enderio.api.misc;
5 changes: 5 additions & 0 deletions src/api/java/com/enderio/api/package-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@javax.annotation.ParametersAreNonnullByDefault
@net.minecraft.MethodsReturnNonnullByDefault
@com.tterrag.registrate.util.nullness.FieldsAreNonnullByDefault

package com.enderio.api;
Loading

0 comments on commit 5c5c885

Please sign in to comment.