Support latest energy version
This commit is contained in:
parent
333389c0d9
commit
9344eeb0ca
4 changed files with 14 additions and 15 deletions
|
@ -89,6 +89,8 @@ dependencies {
|
||||||
modRuntime ("com.jamieswhiteshirt:developer-mode:1.0.15") {
|
modRuntime ("com.jamieswhiteshirt:developer-mode:1.0.15") {
|
||||||
transitive = false
|
transitive = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
modApi 'teamreborn:energy:0.1.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
def optionalDependency(String dep) {
|
def optionalDependency(String dep) {
|
||||||
|
|
|
@ -32,7 +32,6 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import reborncore.api.power.ItemPowerHolder;
|
|
||||||
import reborncore.common.blockentity.RedstoneConfiguration;
|
import reborncore.common.blockentity.RedstoneConfiguration;
|
||||||
import reborncore.common.config.Configuration;
|
import reborncore.common.config.Configuration;
|
||||||
import reborncore.common.recipes.RecipeCrafter;
|
import reborncore.common.recipes.RecipeCrafter;
|
||||||
|
@ -70,8 +69,6 @@ public class TechReborn implements ModInitializer {
|
||||||
INSTANCE = this;
|
INSTANCE = this;
|
||||||
new Configuration(TechRebornConfig.class, "techreborn");
|
new Configuration(TechRebornConfig.class, "techreborn");
|
||||||
|
|
||||||
ItemPowerHolder.setup();
|
|
||||||
|
|
||||||
// Done to force the class to load
|
// Done to force the class to load
|
||||||
ModRecipes.GRINDER.getName();
|
ModRecipes.GRINDER.getName();
|
||||||
|
|
||||||
|
|
|
@ -24,10 +24,6 @@
|
||||||
|
|
||||||
package techreborn.blockentity.cable;
|
package techreborn.blockentity.cable;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.entity.BlockEntity;
|
import net.minecraft.block.entity.BlockEntity;
|
||||||
|
@ -57,6 +53,10 @@ import techreborn.blocks.cable.CableBlock;
|
||||||
import techreborn.init.TRBlockEntities;
|
import techreborn.init.TRBlockEntities;
|
||||||
import techreborn.init.TRContent;
|
import techreborn.init.TRContent;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by modmuss50 on 19/05/2017.
|
* Created by modmuss50 on 19/05/2017.
|
||||||
*/
|
*/
|
||||||
|
@ -66,7 +66,7 @@ public class CableBlockEntity extends BlockEntity
|
||||||
|
|
||||||
private double energy = 0;
|
private double energy = 0;
|
||||||
private TRContent.Cables cableType = null;
|
private TRContent.Cables cableType = null;
|
||||||
private ArrayList<EnergySide> sendingFace = new ArrayList<>();
|
private ArrayList<Direction> sendingFace = new ArrayList<>();
|
||||||
private BlockState cover = null;
|
private BlockState cover = null;
|
||||||
|
|
||||||
public CableBlockEntity() {
|
public CableBlockEntity() {
|
||||||
|
@ -143,17 +143,16 @@ public class CableBlockEntity extends BlockEntity
|
||||||
|
|
||||||
ArrayList<Pair<BlockEntity, Direction>> acceptors = new ArrayList<>();
|
ArrayList<Pair<BlockEntity, Direction>> acceptors = new ArrayList<>();
|
||||||
for (Direction face : Direction.values()) {
|
for (Direction face : Direction.values()) {
|
||||||
EnergySide side = EnergySide.fromMinecraft(face);
|
|
||||||
BlockEntity blockEntity = world.getBlockEntity(pos.offset(face));
|
BlockEntity blockEntity = world.getBlockEntity(pos.offset(face));
|
||||||
|
|
||||||
if (blockEntity != null && Energy.valid(blockEntity)) {
|
if (blockEntity != null && Energy.valid(blockEntity)) {
|
||||||
if (blockEntity instanceof CableBlockEntity && energy <= Energy.of(blockEntity).side(EnergySide.fromMinecraft(face)).getEnergy()) {
|
if (blockEntity instanceof CableBlockEntity && energy <= Energy.of(blockEntity).side(face).getEnergy()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(Energy.of(blockEntity).side(EnergySide.fromMinecraft(face.getOpposite())).getMaxInput() > 0){
|
if(Energy.of(blockEntity).side(face.getOpposite()).getMaxInput() > 0){
|
||||||
acceptors.add(Pair.of(blockEntity, face));
|
acceptors.add(Pair.of(blockEntity, face));
|
||||||
if (!sendingFace.contains(side)) {
|
if (!sendingFace.contains(face)) {
|
||||||
sendingFace.add(side);
|
sendingFace.add(face);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -166,7 +165,7 @@ public class CableBlockEntity extends BlockEntity
|
||||||
|
|
||||||
acceptors.forEach(pair -> {
|
acceptors.forEach(pair -> {
|
||||||
Energy.of(this)
|
Energy.of(this)
|
||||||
.into(Energy.of(pair.getLeft()).side(EnergySide.fromMinecraft(pair.getRight().getOpposite())))
|
.into(Energy.of(pair.getLeft()).side(pair.getRight().getOpposite()))
|
||||||
.move();
|
.move();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,8 @@
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.6.3",
|
"fabricloader": ">=0.6.3",
|
||||||
"fabric": "*",
|
"fabric": "*",
|
||||||
"reborncore": "*"
|
"reborncore": "*",
|
||||||
|
"team_reborn_energy": ">=0.1.0"
|
||||||
},
|
},
|
||||||
"authors": [
|
"authors": [
|
||||||
"Team Reborn",
|
"Team Reborn",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue