Merge remote-tracking branch 'remotes/origin/1.14' into 1.15
# Conflicts: # build.gradle # src/main/java/techreborn/client/render/DynamicBucketBakedModel.java # src/main/java/techreborn/client/render/DynamicCellBakedModel.java
This commit is contained in:
commit
2d8961589d
219 changed files with 2205 additions and 1634 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -27,4 +27,6 @@ java_pid2412.hprof
|
|||
/classes/
|
||||
/gradle.properties
|
||||
/buildSrc/.gradle/
|
||||
/buildSrc/build/
|
||||
/buildSrc/build/
|
||||
/src/main/resources/package-lock.json
|
||||
/src/main/resources/node_modules/
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
[![](http://cf.way2muchnoise.eu/full_233564_downloads.svg)](https://minecraft.curseforge.com/projects/techreborn) [![](http://cf.way2muchnoise.eu/packs/233564.svg)](https://minecraft.curseforge.com/projects/techreborn) [![](http://cf.way2muchnoise.eu/versions/233564.svg)](https://minecraft.curseforge.com/projects/techreborn) [![](https://img.shields.io/badge/Discord-TeamReborn-738bd7.svg)](https://discord.gg/teamreborn) [![Crowdin](https://d322cqt584bo4o.cloudfront.net/techreborn/localized.svg)](https://translate.techreborn.ovh/project/techreborn)
|
||||
|
||||
# Tech Reborn for 1.13.1 (BUILD JOBS WILL NEED UPDATING) [![Build Status](https://jenkins.modmuss50.me/job/Team%20Reborn/job/TechReborn/job/1.12/badge/icon)](https://jenkins.modmuss50.me/job/Team%20Reborn/job/TechReborn/job/1.12/)
|
||||
# Tech Reborn for 1.14.4 [![Build Status](https://jenkins.modmuss50.me/job/Team%20Reborn/job/TechReborn/job/1.12/badge/icon)](https://jenkins.modmuss50.me/job/Team%20Reborn/job/TechReborn/job/1.12/)
|
||||
|
||||
*Tech Reborn is a completely standalone tech mod including tools and machines to gather resources, process materials, and progress through the mod.*
|
||||
|
||||
|
@ -21,12 +21,18 @@ Versions we determine are stable enough can always be found on our CurseForge pa
|
|||
|
||||
If you're looking for the latest bleeding edge build, these are found on our Jenkins page. Use these with caution, and please do not put these in modpacks:
|
||||
|
||||
1.15 * - [![Build Status](https://jenkins.modmuss50.me/job/Team%20Reborn/job/TechReborn/job/1.15/badge/icon)](https://jenkins.modmuss50.me/job/Team%20Reborn/job/TechReborn/job/1.15/)
|
||||
|
||||
1.14.4 - [![Build Status](https://jenkins.modmuss50.me/job/Team%20Reborn/job/TechReborn/job/1.14/badge/icon)](https://jenkins.modmuss50.me/job/Team%20Reborn/job/TechReborn/job/1.14/)
|
||||
|
||||
1.12.2 - [![Build Status](https://jenkins.modmuss50.me/job/Team%20Reborn/job/TechReborn/job/1.12/badge/icon)](https://jenkins.modmuss50.me/job/Team%20Reborn/job/TechReborn/job/1.12/)
|
||||
|
||||
1.11.2 - [![Build Status](https://jenkins.modmuss50.me/job/TeamReborn/job/TechReborn/job/TechReborn-1.11.2/badge/icon)](https://jenkins.modmuss50.me/job/TeamReborn/job/TechReborn/job/TechReborn-1.11.2/)
|
||||
|
||||
1.10.2 - [![Build Status](https://jenkins.modmuss50.me/job/TeamReborn/job/TechReborn/job/TechReborn-1.10.2/badge/icon)](https://jenkins.modmuss50.me/job/TeamReborn/job/TechReborn/job/TechReborn-1.10.2/)
|
||||
|
||||
* 1.15 versions are for snapshots, and may not always be upto date with the latest 1.15 snapshots.
|
||||
|
||||
# Issues and Suggestions
|
||||
|
||||
To report an issue or make a suggestion, please head up to the `Issues` tab up above, and open a new issue. You will need a GitHub account for this (it's free!). **It is very important that you include the version of Tech Reborn you are using in your issue report.**
|
||||
|
|
13
build.gradle
13
build.gradle
|
@ -48,7 +48,7 @@ repositories {
|
|||
}
|
||||
}
|
||||
|
||||
version = "3.0.13"
|
||||
version = "3.0.14"
|
||||
|
||||
configurations {
|
||||
shade
|
||||
|
@ -56,9 +56,8 @@ configurations {
|
|||
}
|
||||
|
||||
def ENV = System.getenv()
|
||||
if (ENV.BUILD_NUMBER) {
|
||||
version = version + "." + "${System.getenv().BUILD_NUMBER}"
|
||||
}
|
||||
def build_number = ENV.BUILD_NUMBER ?: "local"
|
||||
version = "${version}+build.$build_number"
|
||||
|
||||
license {
|
||||
header file('HEADER')
|
||||
|
@ -89,13 +88,17 @@ dependencies {
|
|||
transitive = false
|
||||
}
|
||||
|
||||
compile 'org.checkerframework:checker-qual:2.10.0'
|
||||
compile 'org.spongepowered:configurate-hocon:3.6'
|
||||
|
||||
compile 'org.checkerframework:checker-qual:2.10.0'
|
||||
compileOnly "com.google.code.findbugs:jsr305:+"
|
||||
|
||||
modCompileOnly ('com.github.Virtuoel:Towelette:519538e54b') {
|
||||
transitive = false
|
||||
}
|
||||
|
||||
compile 'teamreborn:energy:0.0.7'
|
||||
}
|
||||
|
||||
processResources {
|
||||
|
@ -115,7 +118,7 @@ jar {
|
|||
exclude "**/*.psd"
|
||||
classifier = 'universal'
|
||||
|
||||
from { crowdin.getDidWork() ? fileTree('build/translations').matching{exclude "**/en_US.lang"} : null}
|
||||
from { crowdin.getDidWork() ? fileTree('build/translations').matching{exclude "**/en_US.json"} : null}
|
||||
dependsOn 'renameCrowdin'
|
||||
}
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.util.Identifier;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import reborncore.api.power.ItemPowerHolder;
|
||||
import reborncore.common.config.Configuration;
|
||||
import reborncore.common.recipes.RecipeCrafter;
|
||||
import reborncore.common.util.Torus;
|
||||
|
@ -61,6 +62,7 @@ public class TechReborn implements ModInitializer {
|
|||
INSTANCE = this;
|
||||
new Configuration(TechRebornConfig.class, "techreborn");
|
||||
|
||||
ItemPowerHolder.setup();
|
||||
|
||||
// Done to force the class to load
|
||||
ModRecipes.GRINDER.getName();
|
||||
|
|
|
@ -102,7 +102,7 @@ public class TechRebornClient implements ClientModInitializer {
|
|||
|
||||
@Override
|
||||
public BakedModel bake(ModelLoader modelLoader, Function<Identifier, Sprite> function, ModelBakeSettings modelBakeSettings) {
|
||||
return new DynamicBucketBakedModel(fluid);
|
||||
return new DynamicBucketBakedModel();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -37,10 +37,13 @@ import net.minecraft.util.Tickable;
|
|||
import net.minecraft.util.math.Direction;
|
||||
import reborncore.api.IListInfoProvider;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.power.EnergyBlockEntity;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.common.powerSystem.PowerAcceptorBlockEntity;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.StringUtils;
|
||||
import team.reborn.energy.Energy;
|
||||
import team.reborn.energy.EnergySide;
|
||||
import team.reborn.energy.EnergyStorage;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.blocks.cable.BlockCable;
|
||||
import techreborn.init.TRBlockEntities;
|
||||
import techreborn.init.TRContent;
|
||||
|
@ -54,7 +57,7 @@ import java.util.List;
|
|||
*/
|
||||
|
||||
public class CableBlockEntity extends BlockEntity
|
||||
implements Tickable, IListInfoProvider, IToolDrop, EnergyBlockEntity {
|
||||
implements Tickable, IListInfoProvider, IToolDrop, EnergyStorage {
|
||||
|
||||
private double energy = 0;
|
||||
private int transferRate = 0;
|
||||
|
@ -124,21 +127,17 @@ public class CableBlockEntity extends BlockEntity
|
|||
ticksSinceLastChange = 0;
|
||||
}
|
||||
|
||||
ArrayList<EnergyBlockEntity> acceptors = new ArrayList<EnergyBlockEntity>();
|
||||
ArrayList<BlockEntity> acceptors = new ArrayList<BlockEntity>();
|
||||
for (Direction face : Direction.values()) {
|
||||
BlockEntity blockEntity = world.getBlockEntity(pos.offset(face));
|
||||
|
||||
if (blockEntity == null) {
|
||||
continue;
|
||||
} else if (blockEntity instanceof EnergyBlockEntity) {
|
||||
EnergyBlockEntity acceptor = (EnergyBlockEntity) blockEntity;
|
||||
if (blockEntity instanceof CableBlockEntity && energy <= acceptor.getEnergy()) {
|
||||
} else if (Energy.valid(blockEntity)) {
|
||||
if (blockEntity instanceof CableBlockEntity && energy <= Energy.of(blockEntity).side(EnergySide.fromMinecraft(face)).getEnergy()) {
|
||||
continue;
|
||||
}
|
||||
if (!acceptor.canAcceptEnergy(face.getOpposite())) {
|
||||
continue;
|
||||
}
|
||||
acceptors.add(acceptor);
|
||||
acceptors.add(blockEntity);
|
||||
if (!sendingFace.contains(face)) {
|
||||
sendingFace.add(face);
|
||||
}
|
||||
|
@ -149,13 +148,9 @@ public class CableBlockEntity extends BlockEntity
|
|||
return;
|
||||
}
|
||||
Collections.shuffle(acceptors);
|
||||
acceptors.forEach(blockEntity -> {
|
||||
double drain = Math.min(energy, transferRate);
|
||||
if (drain > 0 && blockEntity.addEnergy(drain, true) > 0) {
|
||||
double move = blockEntity.addEnergy(drain, false);
|
||||
useEnergy(move, false);
|
||||
}
|
||||
});
|
||||
acceptors.forEach(blockEntity -> Energy.of(this)
|
||||
.into(Energy.of(blockEntity))
|
||||
.move());
|
||||
}
|
||||
|
||||
// IListInfoProvider
|
||||
|
@ -176,52 +171,15 @@ public class CableBlockEntity extends BlockEntity
|
|||
return new ItemStack(getCableType().block);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public double getEnergy() {
|
||||
return energy;
|
||||
return getStored(EnergySide.UNKNOWN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnergy(double energy) {
|
||||
this.energy = energy;
|
||||
setStored(energy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower() {
|
||||
return transferRate * 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAddEnergy(double energyIn) {
|
||||
return getEnergy() + energyIn <= getMaxPower();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double addEnergy(double energy) {
|
||||
return addEnergy(energy, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double addEnergy(double energyIn, boolean simulate) {
|
||||
double energyReceived = Math.min(getMaxPower(), Math.min(getMaxPower() - getEnergy(), energyIn));
|
||||
|
||||
if (!simulate) {
|
||||
setEnergy(getEnergy() + energyReceived);
|
||||
}
|
||||
return energyReceived;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUseEnergy(double energy) {
|
||||
return this.energy >= energy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double useEnergy(double energy) {
|
||||
return useEnergy(energy, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double useEnergy(double energyOut, boolean simulate) {
|
||||
if (energyOut > energy) {
|
||||
energyOut = energy;
|
||||
|
@ -232,31 +190,40 @@ public class CableBlockEntity extends BlockEntity
|
|||
return energyOut;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(Direction direction) {
|
||||
if (sendingFace.contains(direction)) {
|
||||
return false;
|
||||
}
|
||||
return getMaxPower() != getEnergy();
|
||||
return getMaxStoredPower() != getEnergy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(Direction direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxOutput() {
|
||||
public double getMaxInput(EnergySide side) {
|
||||
return transferRate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxInput() {
|
||||
public double getMaxOutput(EnergySide side) {
|
||||
return transferRate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumPowerTier getTier() {
|
||||
return EnumPowerTier.getTier(cableType.transferRate);
|
||||
public double getMaxStoredPower() {
|
||||
return transferRate * 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnergyTier getTier() {
|
||||
return PowerAcceptorBlockEntity.getTier(cableType.transferRate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getStored(EnergySide face) {
|
||||
return energy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStored(double amount) {
|
||||
this.energy = amount;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,11 +32,11 @@ import org.apache.commons.lang3.Validate;
|
|||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.blockentity.InventoryProvider;
|
||||
import reborncore.common.blocks.BlockMachineBase;
|
||||
import reborncore.common.fluid.container.FluidInstance;
|
||||
import reborncore.common.fluid.container.ItemFluidInfo;
|
||||
import reborncore.common.powerSystem.PowerAcceptorBlockEntity;
|
||||
import reborncore.common.util.RebornInventory;
|
||||
import reborncore.common.util.Tank;
|
||||
import io.github.prospector.silk.fluid.FluidInstance;
|
||||
import techreborn.api.generator.EFluidGenerator;
|
||||
import techreborn.api.generator.FluidGeneratorRecipe;
|
||||
import techreborn.api.generator.FluidGeneratorRecipeList;
|
||||
|
|
|
@ -24,24 +24,24 @@
|
|||
|
||||
package techreborn.blockentity.generator;
|
||||
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.util.Formatting;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.blocks.BlockMachineBase;
|
||||
import reborncore.common.powerSystem.PowerAcceptorBlockEntity;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.StringUtils;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.blocks.generator.BlockSolarPanel;
|
||||
import techreborn.init.TRBlockEntities;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.init.TRContent.SolarPanels;
|
||||
import techreborn.init.TRBlockEntities;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -49,7 +49,7 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I
|
|||
|
||||
boolean canSeeSky = false;
|
||||
boolean lastState = false;
|
||||
SolarPanels panel;
|
||||
private SolarPanels panel;
|
||||
|
||||
public SolarPanelBlockEntity() {
|
||||
super(TRBlockEntities.SOLAR_PANEL);
|
||||
|
@ -77,7 +77,7 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I
|
|||
if (world.isClient) {
|
||||
return;
|
||||
}
|
||||
if (panel == TRContent.SolarPanels.CREATIVE) {
|
||||
if (getPanel() == TRContent.SolarPanels.CREATIVE) {
|
||||
checkOverfill = false;
|
||||
setEnergy(Integer.MAX_VALUE);
|
||||
return;
|
||||
|
@ -91,9 +91,9 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I
|
|||
}
|
||||
int powerToAdd;
|
||||
if (isSunOut()) {
|
||||
powerToAdd = panel.generationRateD;
|
||||
powerToAdd = getPanel().generationRateD;
|
||||
} else if (canSeeSky) {
|
||||
powerToAdd = panel.generationRateN;
|
||||
powerToAdd = getPanel().generationRateN;
|
||||
} else {
|
||||
powerToAdd = 0;
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I
|
|||
|
||||
@Override
|
||||
public double getBaseMaxPower() {
|
||||
return panel.internalCapacity;
|
||||
return getPanel().internalCapacity;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -118,7 +118,7 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I
|
|||
|
||||
@Override
|
||||
public double getBaseMaxOutput() {
|
||||
return panel.generationRateD;
|
||||
return getPanel().generationRateD;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -127,8 +127,8 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I
|
|||
}
|
||||
|
||||
@Override
|
||||
public EnumPowerTier getTier() {
|
||||
return panel.powerTier;
|
||||
public EnergyTier getTier() {
|
||||
return getPanel().powerTier;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -136,6 +136,13 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I
|
|||
// Nope
|
||||
}
|
||||
|
||||
public SolarPanels getPanel() {
|
||||
if(panel == null){
|
||||
updatePanel();
|
||||
}
|
||||
return panel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInfo(List<Text> info, boolean isReal, boolean hasData) {
|
||||
info.add(new LiteralText(Formatting.GRAY + StringUtils.t("reborncore.tooltip.energy.maxEnergy") + ": "
|
||||
|
|
|
@ -77,6 +77,7 @@ public class SolidFuelGeneratorBlockEntity extends PowerAcceptorBlockEntity impl
|
|||
if (world.isClient) {
|
||||
return;
|
||||
}
|
||||
discharge(1);
|
||||
if (getEnergy() < getMaxPower()) {
|
||||
if (burnTime > 0) {
|
||||
burnTime--;
|
||||
|
@ -85,6 +86,7 @@ public class SolidFuelGeneratorBlockEntity extends PowerAcceptorBlockEntity impl
|
|||
}
|
||||
} else {
|
||||
isBurning = false;
|
||||
updateState();
|
||||
}
|
||||
|
||||
if (burnTime == 0) {
|
||||
|
@ -113,8 +115,9 @@ public class SolidFuelGeneratorBlockEntity extends PowerAcceptorBlockEntity impl
|
|||
final BlockState BlockStateContainer = world.getBlockState(pos);
|
||||
if (BlockStateContainer.getBlock() instanceof BlockMachineBase) {
|
||||
final BlockMachineBase blockMachineBase = (BlockMachineBase) BlockStateContainer.getBlock();
|
||||
if (BlockStateContainer.get(BlockMachineBase.ACTIVE) != burnTime > 0) {
|
||||
blockMachineBase.setActive(burnTime > 0, world, pos);
|
||||
boolean active = burnTime > 0 && getEnergy() < getMaxPower();
|
||||
if (BlockStateContainer.get(BlockMachineBase.ACTIVE) != active) {
|
||||
blockMachineBase.setActive(active, world, pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,6 +71,10 @@ public class LampBlockEntity extends PowerAcceptorBlockEntity
|
|||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(final Direction direction) {
|
||||
if (world == null) {
|
||||
// Blame tooltip for this
|
||||
return true;
|
||||
}
|
||||
Direction me = BlockLamp.getFacing(world.getBlockState(pos)).getOpposite();
|
||||
return direction == me;
|
||||
}
|
||||
|
|
|
@ -132,7 +132,7 @@ public class RollingMachineBlockEntity extends PowerAcceptorBlockEntity
|
|||
if (!currentRecipeOutput.isEmpty()) {
|
||||
boolean hasCrafted = false;
|
||||
if (inventory.getInvStack(outputSlot).isEmpty()) {
|
||||
inventory.setInvStack(outputSlot, currentRecipeOutput);
|
||||
inventory.setInvStack(outputSlot, currentRecipeOutput.copy());
|
||||
tickTime = 0;
|
||||
hasCrafted = true;
|
||||
} else {
|
||||
|
|
|
@ -27,15 +27,16 @@ package techreborn.blockentity.storage;
|
|||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.api.blockentity.IUpgrade;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.containerBuilder.builder.ContainerBuilder;
|
||||
import reborncore.common.util.RebornInventory;
|
||||
import team.reborn.energy.EnergySide;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.init.TRBlockEntities;
|
||||
import techreborn.init.TRContent;
|
||||
|
||||
public class AdjustableSUBlockEntity extends EnergyStorageBlockEntity implements IContainerProvider {
|
||||
|
||||
|
@ -44,7 +45,7 @@ public class AdjustableSUBlockEntity extends EnergyStorageBlockEntity implements
|
|||
public int superconductors = 0;
|
||||
|
||||
public AdjustableSUBlockEntity() {
|
||||
super(TRBlockEntities.ADJUSTABLE_SU, "ADJUSTABLE_SU", 4, TRContent.Machine.ADJUSTABLE_SU.block, EnumPowerTier.INSANE, TechRebornConfig.aesuMaxInput, TechRebornConfig.aesuMaxOutput, TechRebornConfig.aesuMaxEnergy);
|
||||
super(TRBlockEntities.ADJUSTABLE_SU, "ADJUSTABLE_SU", 4, TRContent.Machine.ADJUSTABLE_SU.block, EnergyTier.INSANE, TechRebornConfig.aesuMaxInput, TechRebornConfig.aesuMaxOutput, TechRebornConfig.aesuMaxEnergy);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -120,7 +121,7 @@ public class AdjustableSUBlockEntity extends EnergyStorageBlockEntity implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getMaxOutput() {
|
||||
public double getMaxOutput(EnergySide side) {
|
||||
return OUTPUT;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,11 +30,11 @@ import net.minecraft.entity.player.PlayerEntity;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.api.blockentity.InventoryProvider;
|
||||
import reborncore.common.powerSystem.ExternalPowerSystems;
|
||||
import reborncore.common.powerSystem.PowerAcceptorBlockEntity;
|
||||
import reborncore.common.util.RebornInventory;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.blocks.storage.BlockEnergyStorage;
|
||||
|
||||
/**
|
||||
|
@ -46,12 +46,12 @@ public class EnergyStorageBlockEntity extends PowerAcceptorBlockEntity
|
|||
public RebornInventory<EnergyStorageBlockEntity> inventory;
|
||||
public String name;
|
||||
public Block wrenchDrop;
|
||||
public EnumPowerTier tier;
|
||||
public EnergyTier tier;
|
||||
public int maxInput;
|
||||
public int maxOutput;
|
||||
public int maxStorage;
|
||||
|
||||
public EnergyStorageBlockEntity(BlockEntityType<?> blockEntityType, String name, int invSize, Block wrenchDrop, EnumPowerTier tier, int maxInput, int maxOuput, int maxStorage) {
|
||||
public EnergyStorageBlockEntity(BlockEntityType<?> blockEntityType, String name, int invSize, Block wrenchDrop, EnergyTier tier, int maxInput, int maxOuput, int maxStorage) {
|
||||
super(blockEntityType);
|
||||
inventory = new RebornInventory<>(invSize, name + "BlockEntity", 64, this);
|
||||
this.wrenchDrop = wrenchDrop;
|
||||
|
@ -90,7 +90,7 @@ public class EnergyStorageBlockEntity extends PowerAcceptorBlockEntity
|
|||
public boolean canAcceptEnergy(Direction direction) {
|
||||
return getFacing() != direction;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(Direction direction) {
|
||||
return getFacing() == direction;
|
||||
|
@ -114,6 +114,9 @@ public class EnergyStorageBlockEntity extends PowerAcceptorBlockEntity
|
|||
|
||||
@Override
|
||||
public Direction getFacingEnum() {
|
||||
if(world == null){
|
||||
return null;
|
||||
}
|
||||
Block block = world.getBlockState(pos).getBlock();
|
||||
if (block instanceof BlockEnergyStorage) {
|
||||
return ((BlockEnergyStorage) block).getFacing(world.getBlockState(pos));
|
||||
|
|
|
@ -25,12 +25,12 @@
|
|||
package techreborn.blockentity.storage;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.containerBuilder.builder.ContainerBuilder;
|
||||
import techreborn.init.TRContent;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.init.TRBlockEntities;
|
||||
import techreborn.init.TRContent;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 14/03/2016.
|
||||
|
@ -42,7 +42,7 @@ public class HighVoltageSUBlockEntity extends EnergyStorageBlockEntity implement
|
|||
* MFSU should store 40M FE with 2048 FE/t I/O
|
||||
*/
|
||||
public HighVoltageSUBlockEntity() {
|
||||
super(TRBlockEntities.HIGH_VOLTAGE_SU, "HIGH_VOLTAGE_SU", 2, TRContent.Machine.HIGH_VOLTAGE_SU.block, EnumPowerTier.HIGH, 512, 512, 10_000_000);
|
||||
super(TRBlockEntities.HIGH_VOLTAGE_SU, "HIGH_VOLTAGE_SU", 2, TRContent.Machine.HIGH_VOLTAGE_SU.block, EnergyTier.HIGH, 512, 512, 10_000_000);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -25,12 +25,12 @@
|
|||
package techreborn.blockentity.storage;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.containerBuilder.builder.ContainerBuilder;
|
||||
import techreborn.init.TRContent;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.init.TRBlockEntities;
|
||||
import techreborn.init.TRContent;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 14/03/2016.
|
||||
|
@ -38,7 +38,7 @@ import techreborn.init.TRBlockEntities;
|
|||
public class LowVoltageSUBlockEntity extends EnergyStorageBlockEntity implements IContainerProvider {
|
||||
|
||||
public LowVoltageSUBlockEntity() {
|
||||
super(TRBlockEntities.LOW_VOLTAGE_SU, "BatBox", 2, TRContent.Machine.LOW_VOLTAGE_SU.block, EnumPowerTier.LOW, 32, 32, 40000);
|
||||
super(TRBlockEntities.LOW_VOLTAGE_SU, "BatBox", 2, TRContent.Machine.LOW_VOLTAGE_SU.block, EnergyTier.LOW, 32, 32, 40000);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -25,12 +25,12 @@
|
|||
package techreborn.blockentity.storage;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.containerBuilder.builder.ContainerBuilder;
|
||||
import techreborn.init.TRContent;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.init.TRBlockEntities;
|
||||
import techreborn.init.TRContent;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 14/03/2016.
|
||||
|
@ -42,7 +42,7 @@ public class MediumVoltageSUBlockEntity extends EnergyStorageBlockEntity impleme
|
|||
* MFE should store 1.2M FE with 512 FE/t I/O
|
||||
*/
|
||||
public MediumVoltageSUBlockEntity() {
|
||||
super(TRBlockEntities.MEDIUM_VOLTAGE_SU, "MEDIUM_VOLTAGE_SU", 2, TRContent.Machine.MEDIUM_VOLTAGE_SU.block, EnumPowerTier.MEDIUM, 128, 128, 300000);
|
||||
super(TRBlockEntities.MEDIUM_VOLTAGE_SU, "MEDIUM_VOLTAGE_SU", 2, TRContent.Machine.MEDIUM_VOLTAGE_SU.block, EnergyTier.MEDIUM, 128, 128, 300000);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -27,14 +27,14 @@ package techreborn.blockentity.storage.idsu;
|
|||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.containerBuilder.builder.ContainerBuilder;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.init.TRBlockEntities;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.blockentity.storage.EnergyStorageBlockEntity;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.TRBlockEntities;
|
||||
import techreborn.init.TRContent;
|
||||
|
||||
public class InterdimensionalSUBlockEntity extends EnergyStorageBlockEntity implements IContainerProvider {
|
||||
|
||||
|
@ -44,7 +44,7 @@ public class InterdimensionalSUBlockEntity extends EnergyStorageBlockEntity impl
|
|||
private double clientEnergy;
|
||||
|
||||
public InterdimensionalSUBlockEntity() {
|
||||
super(TRBlockEntities.INTERDIMENSIONAL_SU, "IDSU", 2, TRContent.Machine.INTERDIMENSIONAL_SU.block, EnumPowerTier.EXTREME, TechRebornConfig.idsuMaxInput, TechRebornConfig.idsuMaxOutput, TechRebornConfig.idsuMaxEnergy);
|
||||
super(TRBlockEntities.INTERDIMENSIONAL_SU, "IDSU", 2, TRContent.Machine.INTERDIMENSIONAL_SU.block, EnergyTier.EXTREME, TechRebornConfig.idsuMaxInput, TechRebornConfig.idsuMaxOutput, TechRebornConfig.idsuMaxEnergy);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -29,10 +29,10 @@ import net.minecraft.block.entity.BlockEntity;
|
|||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.containerBuilder.builder.ContainerBuilder;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.blockentity.storage.EnergyStorageBlockEntity;
|
||||
import techreborn.blocks.storage.BlockLapotronicSU;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
|
@ -47,7 +47,7 @@ public class LapotronicSUBlockEntity extends EnergyStorageBlockEntity implements
|
|||
private ArrayList<LesuNetwork> countedNetworks = new ArrayList<>();
|
||||
|
||||
public LapotronicSUBlockEntity() {
|
||||
super(TRBlockEntities.LAPOTRONIC_SU, "LESU", 2, TRContent.Machine.LAPOTRONIC_SU.block, EnumPowerTier.INSANE, 8192, TechRebornConfig.lesuBaseOutput, 1_000_000);
|
||||
super(TRBlockEntities.LAPOTRONIC_SU, "LESU", 2, TRContent.Machine.LAPOTRONIC_SU.block, EnergyTier.INSANE, 8192, TechRebornConfig.lesuBaseOutput, 1_000_000);
|
||||
checkOverfill = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
package techreborn.blockentity.transformers;
|
||||
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.init.TRBlockEntities;
|
||||
import techreborn.init.TRContent;
|
||||
|
||||
|
@ -34,7 +34,7 @@ import techreborn.init.TRContent;
|
|||
public class EVTransformerBlockEntity extends TransformerBlockEntity {
|
||||
|
||||
public EVTransformerBlockEntity() {
|
||||
super(TRBlockEntities.EV_TRANSFORMER, "EVTransformer", TRContent.Machine.EV_TRANSFORMER.block, EnumPowerTier.INSANE);
|
||||
super(TRBlockEntities.EV_TRANSFORMER, "EVTransformer", TRContent.Machine.EV_TRANSFORMER.block, EnergyTier.INSANE);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,9 +24,9 @@
|
|||
|
||||
package techreborn.blockentity.transformers;
|
||||
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import techreborn.init.TRContent;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.init.TRBlockEntities;
|
||||
import techreborn.init.TRContent;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 16/03/2016.
|
||||
|
@ -34,7 +34,7 @@ import techreborn.init.TRBlockEntities;
|
|||
public class HVTransformerBlockEntity extends TransformerBlockEntity {
|
||||
|
||||
public HVTransformerBlockEntity() {
|
||||
super(TRBlockEntities.HV_TRANSFORMER, "HVTransformer", TRContent.Machine.HV_TRANSFORMER.block, EnumPowerTier.EXTREME);
|
||||
super(TRBlockEntities.HV_TRANSFORMER, "HVTransformer", TRContent.Machine.HV_TRANSFORMER.block, EnergyTier.EXTREME);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,9 +24,9 @@
|
|||
|
||||
package techreborn.blockentity.transformers;
|
||||
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import techreborn.init.TRContent;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.init.TRBlockEntities;
|
||||
import techreborn.init.TRContent;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 16/03/2016.
|
||||
|
@ -34,7 +34,7 @@ import techreborn.init.TRBlockEntities;
|
|||
public class LVTransformerBlockEntity extends TransformerBlockEntity {
|
||||
|
||||
public LVTransformerBlockEntity() {
|
||||
super(TRBlockEntities.LV_TRANSFORMER, "LVTransformer", TRContent.Machine.LV_TRANSFORMER.block, EnumPowerTier.MEDIUM);
|
||||
super(TRBlockEntities.LV_TRANSFORMER, "LVTransformer", TRContent.Machine.LV_TRANSFORMER.block, EnergyTier.MEDIUM);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,9 +24,9 @@
|
|||
|
||||
package techreborn.blockentity.transformers;
|
||||
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import techreborn.init.TRContent;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.init.TRBlockEntities;
|
||||
import techreborn.init.TRContent;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 16/03/2016.
|
||||
|
@ -34,6 +34,6 @@ import techreborn.init.TRBlockEntities;
|
|||
public class MVTransformerBlockEntity extends TransformerBlockEntity {
|
||||
|
||||
public MVTransformerBlockEntity() {
|
||||
super(TRBlockEntities.MV_TRANSFORMER, "MVTransformer", TRContent.Machine.MV_TRANSFORMER.block, EnumPowerTier.HIGH);
|
||||
super(TRBlockEntities.MV_TRANSFORMER, "MVTransformer", TRContent.Machine.MV_TRANSFORMER.block, EnergyTier.HIGH);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,20 +24,21 @@
|
|||
|
||||
package techreborn.blockentity.transformers;
|
||||
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import reborncore.api.IListInfoProvider;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.powerSystem.PowerAcceptorBlockEntity;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.StringUtils;
|
||||
import team.reborn.energy.EnergySide;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.blocks.transformers.BlockTransformer;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
|
||||
|
@ -52,20 +53,20 @@ public class TransformerBlockEntity extends PowerAcceptorBlockEntity
|
|||
|
||||
public String name;
|
||||
public Block wrenchDrop;
|
||||
public EnumPowerTier inputTier;
|
||||
public EnumPowerTier ouputTier;
|
||||
public EnergyTier inputTier;
|
||||
public EnergyTier ouputTier;
|
||||
public int maxInput;
|
||||
public int maxOutput;
|
||||
public int maxStorage;
|
||||
|
||||
public TransformerBlockEntity(BlockEntityType<?> blockEntityType, String name, Block wrenchDrop, EnumPowerTier tier) {
|
||||
public TransformerBlockEntity(BlockEntityType<?> blockEntityType, String name, Block wrenchDrop, EnergyTier tier) {
|
||||
super(blockEntityType);
|
||||
this.wrenchDrop = wrenchDrop;
|
||||
this.inputTier = tier;
|
||||
if (tier != EnumPowerTier.MICRO) {
|
||||
ouputTier = EnumPowerTier.values()[tier.ordinal() - 1];
|
||||
if (tier != EnergyTier.MICRO) {
|
||||
ouputTier = EnergyTier.values()[tier.ordinal() - 1];
|
||||
} else {
|
||||
ouputTier = EnumPowerTier.MICRO;
|
||||
ouputTier = EnergyTier.MICRO;
|
||||
}
|
||||
this.name = name;
|
||||
this.maxInput = tier.getMaxInput();
|
||||
|
@ -109,7 +110,7 @@ public class TransformerBlockEntity extends PowerAcceptorBlockEntity
|
|||
}
|
||||
|
||||
@Override
|
||||
public EnumPowerTier getPushingTier() {
|
||||
public EnergyTier getPushingTier() {
|
||||
return ouputTier;
|
||||
}
|
||||
|
||||
|
@ -137,9 +138,9 @@ public class TransformerBlockEntity extends PowerAcceptorBlockEntity
|
|||
// IListInfoProvider
|
||||
@Override
|
||||
public void addInfo(List<Text> info, boolean isReal, boolean hasData) {
|
||||
info.add(new LiteralText(Formatting.GRAY + "Input Rate: " + Formatting.GOLD + PowerSystem.getLocaliszedPowerFormatted((int) getMaxInput())));
|
||||
info.add(new LiteralText(Formatting.GRAY + "Input Rate: " + Formatting.GOLD + PowerSystem.getLocaliszedPowerFormatted((int) getMaxInput(EnergySide.UNKNOWN))));
|
||||
info.add(new LiteralText(Formatting.GRAY + "Input Tier: " + Formatting.GOLD + StringUtils.toFirstCapitalAllLowercase(inputTier.toString())));
|
||||
info.add(new LiteralText(Formatting.GRAY + "Output Rate: " + Formatting.GOLD + PowerSystem.getLocaliszedPowerFormatted((int) getMaxOutput())));
|
||||
info.add(new LiteralText(Formatting.GRAY + "Output Rate: " + Formatting.GOLD + PowerSystem.getLocaliszedPowerFormatted((int) getMaxOutput(EnergySide.UNKNOWN))));
|
||||
info.add(new LiteralText(Formatting.GRAY + "Output Tier: " + Formatting.GOLD + StringUtils.toFirstCapitalAllLowercase(ouputTier.toString())));
|
||||
}
|
||||
|
||||
|
|
|
@ -46,13 +46,13 @@ import net.minecraft.world.BlockView;
|
|||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.api.ToolManager;
|
||||
import reborncore.api.power.EnergyBlockEntity;
|
||||
import reborncore.common.blocks.BlockWrenchEventHandler;
|
||||
import reborncore.common.util.WrenchUtils;
|
||||
import team.reborn.energy.Energy;
|
||||
import techreborn.blockentity.cable.CableBlockEntity;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.ModSounds;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.blockentity.cable.CableBlockEntity;
|
||||
import techreborn.utils.damageSources.ElectrialShockSource;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
@ -112,7 +112,7 @@ public class BlockCable extends BlockWithEntity {
|
|||
|
||||
private Boolean canConnectTo(IWorld world, BlockPos pos, Direction facing) {
|
||||
BlockEntity blockEntity = world.getBlockEntity(pos);
|
||||
if (blockEntity != null && (blockEntity instanceof EnergyBlockEntity || blockEntity instanceof CableBlockEntity)) {
|
||||
if (blockEntity != null && (Energy.valid(blockEntity) || blockEntity instanceof CableBlockEntity)) {
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
return Boolean.FALSE;
|
||||
|
|
|
@ -24,11 +24,8 @@
|
|||
|
||||
package techreborn.blocks.lighting;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockRenderLayer;
|
||||
import net.minecraft.block.BlockRenderType;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Material;
|
||||
import net.fabricmc.fabric.api.block.FabricBlockSettings;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemPlacementContext;
|
||||
|
@ -59,14 +56,13 @@ public class BlockLamp extends BaseBlockEntityProvider {
|
|||
protected final VoxelShape[] shape;
|
||||
|
||||
private int cost;
|
||||
private int brightness;
|
||||
private static int brightness = 15;
|
||||
|
||||
public BlockLamp(int brightness, int cost, double depth, double width) {
|
||||
super(Block.Settings.of(Material.REDSTONE_LAMP).strength(2f, 2f));
|
||||
this.setDefaultState(this.stateFactory.getDefaultState().with(FACING, Direction.NORTH).with(ACTIVE, false));
|
||||
public BlockLamp(int cost, double depth, double width) {
|
||||
super(FabricBlockSettings.of(Material.REDSTONE_LAMP).strength(2f, 2f).lightLevel(brightness).build());
|
||||
this.shape = GenCuboidShapes(depth, width);
|
||||
this.cost = cost;
|
||||
this.brightness = brightness;
|
||||
this.setDefaultState(this.stateFactory.getDefaultState().with(FACING, Direction.NORTH).with(ACTIVE, false));
|
||||
BlockWrenchEventHandler.wrenableBlocks.add(this);
|
||||
}
|
||||
|
||||
|
@ -135,6 +131,7 @@ public class BlockLamp extends BaseBlockEntityProvider {
|
|||
return state.get(ACTIVE) ? brightness : 0;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
|
|
|
@ -43,15 +43,13 @@ import net.minecraft.util.hit.BlockHitResult;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.api.power.ItemPowerManager;
|
||||
import reborncore.common.powerSystem.ExternalPowerSystems;
|
||||
import reborncore.common.util.WorldUtils;
|
||||
import team.reborn.energy.Energy;
|
||||
import techreborn.events.TRRecipeHandler;
|
||||
import techreborn.init.ModSounds;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.items.tool.ItemTreeTap;
|
||||
import techreborn.items.tool.basic.ItemElectricTreetap;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
|
@ -121,22 +119,16 @@ public class BlockRubberLog extends LogBlock {
|
|||
if (stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//TODO: Should it be here??
|
||||
ItemPowerManager capEnergy = null;
|
||||
if (stack.getItem() instanceof ItemElectricTreetap) {
|
||||
capEnergy = new ItemPowerManager(stack);
|
||||
}
|
||||
if ((capEnergy != null && capEnergy.getEnergyStored() > 20) || stack.getItem() instanceof ItemTreeTap) {
|
||||
|
||||
if ((Energy.valid(stack) && Energy.of(stack).getEnergy() > 20) || stack.getItem() instanceof ItemTreeTap) {
|
||||
if (state.get(HAS_SAP) && state.get(SAP_SIDE) == hitResult.getSide()) {
|
||||
worldIn.setBlockState(pos, state.with(HAS_SAP, false).with(SAP_SIDE, Direction.fromHorizontal(0)));
|
||||
worldIn.playSound(null, pos.getX(), pos.getY(), pos.getZ(), ModSounds.SAP_EXTRACT, SoundCategory.BLOCKS,
|
||||
0.6F, 1F);
|
||||
if (!worldIn.isClient) {
|
||||
if (capEnergy != null) {
|
||||
capEnergy.useEnergy(20, false);
|
||||
|
||||
ExternalPowerSystems.requestEnergyFromArmor(capEnergy, playerIn);
|
||||
if (Energy.valid(stack)) {
|
||||
Energy.of(stack).use(20);
|
||||
ExternalPowerSystems.requestEnergyFromArmor(stack, playerIn);
|
||||
} else {
|
||||
playerIn.getStackInHand(Hand.MAIN_HAND).damage(1, playerIn, playerEntity -> {});
|
||||
}
|
||||
|
@ -152,14 +144,4 @@ public class BlockRubberLog extends LogBlock {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void getDrops(BlockState state, DefaultedList<ItemStack> drops, World world, BlockPos pos, int fortune) {
|
||||
// drops.add(new ItemStack(this));
|
||||
// if (state.get(HAS_SAP)) {
|
||||
// if (new Random().nextInt(4) == 0) {
|
||||
// drops.add(TRContent.Parts.SAP.getStack());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -24,11 +24,11 @@
|
|||
|
||||
package techreborn.client.gui;
|
||||
|
||||
import io.github.prospector.silk.fluid.FluidInstance;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.gui.builder.GuiBase;
|
||||
import reborncore.common.fluid.FluidUtil;
|
||||
import reborncore.common.fluid.container.FluidInstance;
|
||||
import techreborn.blockentity.machine.tier3.QuantumTankBlockEntity;
|
||||
|
||||
public class GuiQuantumTank extends GuiBase<BuiltContainer> {
|
||||
|
|
|
@ -0,0 +1,113 @@
|
|||
package techreborn.client.render;
|
||||
|
||||
import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandler;
|
||||
import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandlerRegistry;
|
||||
import net.fabricmc.fabric.api.renderer.v1.mesh.MutableQuadView;
|
||||
import net.fabricmc.fabric.api.renderer.v1.mesh.QuadEmitter;
|
||||
import net.fabricmc.fabric.api.renderer.v1.model.FabricBakedModel;
|
||||
import net.fabricmc.fabric.api.renderer.v1.render.RenderContext;
|
||||
import net.fabricmc.indigo.renderer.helper.GeometryHelper;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.render.model.BakedModel;
|
||||
import net.minecraft.client.render.model.BakedModelManager;
|
||||
import net.minecraft.client.render.model.BakedQuad;
|
||||
import net.minecraft.client.render.model.json.ModelItemPropertyOverrideList;
|
||||
import net.minecraft.client.render.model.json.ModelTransformation;
|
||||
import net.minecraft.client.texture.Sprite;
|
||||
import net.minecraft.client.util.ModelIdentifier;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.BlockRenderView;
|
||||
import reborncore.common.fluid.container.ItemFluidInfo;
|
||||
import reborncore.common.util.Color;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public abstract class BaseDynamicFluidBakedModel implements BakedModel, FabricBakedModel {
|
||||
|
||||
public abstract ModelIdentifier getBaseModel();
|
||||
public abstract ModelIdentifier getBackgroundModel();
|
||||
public abstract ModelIdentifier getFluidModel();
|
||||
|
||||
@Override
|
||||
public void emitItemQuads(ItemStack stack, Supplier<Random> randomSupplier, RenderContext context) {
|
||||
Fluid fluid = Fluids.EMPTY;
|
||||
if (stack.getItem() instanceof ItemFluidInfo) {
|
||||
ItemFluidInfo fluidInfo = (ItemFluidInfo) stack.getItem();
|
||||
fluid = fluidInfo.getFluid(stack);
|
||||
|
||||
}
|
||||
BakedModelManager bakedModelManager = MinecraftClient.getInstance().getBakedModelManager();
|
||||
context.fallbackConsumer().accept(bakedModelManager.getModel(getBaseModel()));
|
||||
context.fallbackConsumer().accept(bakedModelManager.getModel(getBackgroundModel()));
|
||||
|
||||
if (fluid != Fluids.EMPTY) {
|
||||
FluidRenderHandler fluidRenderHandler = FluidRenderHandlerRegistry.INSTANCE.get(fluid);
|
||||
BakedModel fluidModel = bakedModelManager.getModel(getFluidModel());
|
||||
int fluidColor = fluidRenderHandler.getFluidColor(MinecraftClient.getInstance().world, MinecraftClient.getInstance().player.getBlockPos(), fluid.getDefaultState());
|
||||
Sprite fluidSprite = fluidRenderHandler.getFluidSprites(MinecraftClient.getInstance().world, BlockPos.ORIGIN, fluid.getDefaultState())[0];
|
||||
int color = new Color((float) (fluidColor >> 16 & 255) / 255.0F, (float) (fluidColor >> 8 & 255) / 255.0F, (float) (fluidColor & 255) / 255.0F).getColor();
|
||||
context.pushTransform(quad -> {
|
||||
quad.nominalFace(GeometryHelper.lightFace(quad));
|
||||
quad.spriteColor(0, color, color, color, color);
|
||||
quad.spriteBake(0, fluidSprite, MutableQuadView.BAKE_LOCK_UV);
|
||||
return true;
|
||||
});
|
||||
final QuadEmitter emitter = context.getEmitter();
|
||||
fluidModel.getQuads(null, null, randomSupplier.get()).forEach(q -> {
|
||||
emitter.fromVanilla(q.getVertexData(), 0, false);
|
||||
emitter.emit();
|
||||
});
|
||||
context.popTransform();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void emitBlockQuads(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier<Random> randomSupplier, RenderContext context) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(@Nullable BlockState blockState, @Nullable Direction direction, Random random) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVanillaAdapter() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean useAmbientOcclusion() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasDepthInGui() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBuiltin() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelTransformation getTransformation() {
|
||||
return ModelHelper.DEFAULT_ITEM_TRANSFORMS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelItemPropertyOverrideList getItemPropertyOverrides() {
|
||||
return ModelItemPropertyOverrideList.EMPTY;
|
||||
}
|
||||
|
||||
}
|
|
@ -24,126 +24,35 @@
|
|||
|
||||
package techreborn.client.render;
|
||||
|
||||
import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandler;
|
||||
import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandlerRegistry;
|
||||
import net.fabricmc.fabric.api.renderer.v1.mesh.MutableQuadView;
|
||||
import net.fabricmc.fabric.api.renderer.v1.mesh.QuadEmitter;
|
||||
import net.fabricmc.fabric.api.renderer.v1.model.FabricBakedModel;
|
||||
import net.fabricmc.fabric.api.renderer.v1.render.RenderContext;
|
||||
import net.fabricmc.indigo.renderer.helper.GeometryHelper;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.render.model.BakedModel;
|
||||
import net.minecraft.client.render.model.BakedModelManager;
|
||||
import net.minecraft.client.render.model.BakedQuad;
|
||||
import net.minecraft.client.render.model.json.ModelItemPropertyOverrideList;
|
||||
import net.minecraft.client.render.model.json.ModelTransformation;
|
||||
import net.minecraft.client.texture.Sprite;
|
||||
import net.minecraft.client.util.ModelIdentifier;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.BlockRenderView;
|
||||
import reborncore.common.fluid.container.ItemFluidInfo;
|
||||
import reborncore.common.util.Color;
|
||||
import techreborn.TechReborn;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class DynamicBucketBakedModel implements BakedModel, FabricBakedModel {
|
||||
|
||||
private final Fluid fluid;
|
||||
public class DynamicBucketBakedModel extends BaseDynamicFluidBakedModel {
|
||||
|
||||
private static final ModelIdentifier BUCKET_BASE = new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "bucket_base"), "inventory");
|
||||
private static final ModelIdentifier BUCKET_BACKGROUND = new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "bucket_background"), "inventory");
|
||||
private static final ModelIdentifier BUCKET_FLUID = new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "bucket_fluid"), "inventory");
|
||||
|
||||
public DynamicBucketBakedModel(Fluid fluid) {
|
||||
this.fluid = fluid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void emitBlockQuads(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier<Random> randomSupplier, RenderContext context) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void emitItemQuads(ItemStack stack, Supplier<Random> randomSupplier, RenderContext context) {
|
||||
Fluid fluid = Fluids.EMPTY;
|
||||
if (stack.getItem() instanceof ItemFluidInfo) {
|
||||
ItemFluidInfo fluidInfo = (ItemFluidInfo) stack.getItem();
|
||||
fluid = fluidInfo.getFluid(stack);
|
||||
|
||||
}
|
||||
BakedModelManager bakedModelManager = MinecraftClient.getInstance().getBakedModelManager();
|
||||
context.fallbackConsumer().accept(bakedModelManager.getModel(BUCKET_BASE));
|
||||
context.fallbackConsumer().accept(bakedModelManager.getModel(BUCKET_BACKGROUND));
|
||||
|
||||
if (fluid != Fluids.EMPTY) {
|
||||
FluidRenderHandler fluidRenderHandler = FluidRenderHandlerRegistry.INSTANCE.get(fluid);
|
||||
BakedModel fluidModel = bakedModelManager.getModel(BUCKET_FLUID);
|
||||
int fluidColor = fluidRenderHandler.getFluidColor(MinecraftClient.getInstance().world, MinecraftClient.getInstance().player.getBlockPos(), fluid.getDefaultState());
|
||||
Sprite fluidSprite = fluidRenderHandler.getFluidSprites(MinecraftClient.getInstance().world, BlockPos.ORIGIN, fluid.getDefaultState())[0];
|
||||
int color = new Color((float) (fluidColor >> 16 & 255) / 255.0F, (float) (fluidColor >> 8 & 255) / 255.0F, (float) (fluidColor & 255) / 255.0F).getColor();
|
||||
context.pushTransform(quad -> {
|
||||
quad.nominalFace(GeometryHelper.lightFace(quad));
|
||||
quad.spriteColor(0, color, color, color, color);
|
||||
quad.spriteBake(0, fluidSprite, MutableQuadView.BAKE_LOCK_UV);
|
||||
return true;
|
||||
});
|
||||
final QuadEmitter emitter = context.getEmitter();
|
||||
fluidModel.getQuads(null, null, randomSupplier.get()).forEach(q -> {
|
||||
emitter.fromVanilla(q.getVertexData(), 0, false);
|
||||
emitter.emit();
|
||||
});
|
||||
context.popTransform();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(@Nullable BlockState blockState, @Nullable Direction direction, Random random) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVanillaAdapter() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean useAmbientOcclusion() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasDepthInGui() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBuiltin() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Sprite getSprite() {
|
||||
return MinecraftClient.getInstance().getSpriteAtlas().getSprite(new Identifier("minecraft:item/bucket"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelTransformation getTransformation() {
|
||||
return ModelHelper.DEFAULT_ITEM_TRANSFORMS;
|
||||
public ModelIdentifier getBaseModel() {
|
||||
return BUCKET_BASE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelItemPropertyOverrideList getItemPropertyOverrides() {
|
||||
return ModelItemPropertyOverrideList.EMPTY;
|
||||
public ModelIdentifier getBackgroundModel() {
|
||||
return BUCKET_BACKGROUND;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelIdentifier getFluidModel() {
|
||||
return BUCKET_FLUID;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,123 +24,50 @@
|
|||
|
||||
package techreborn.client.render;
|
||||
|
||||
import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandler;
|
||||
import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandlerRegistry;
|
||||
import net.fabricmc.fabric.api.renderer.v1.mesh.MutableQuadView;
|
||||
import net.fabricmc.fabric.api.renderer.v1.mesh.QuadEmitter;
|
||||
import net.fabricmc.fabric.api.renderer.v1.model.FabricBakedModel;
|
||||
import net.fabricmc.fabric.api.renderer.v1.render.RenderContext;
|
||||
import net.fabricmc.indigo.renderer.helper.GeometryHelper;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.render.model.BakedModel;
|
||||
import net.minecraft.client.render.model.BakedModelManager;
|
||||
import net.minecraft.client.render.model.BakedQuad;
|
||||
import net.minecraft.client.render.model.json.ModelItemPropertyOverrideList;
|
||||
import net.minecraft.client.render.model.json.ModelTransformation;
|
||||
import net.minecraft.client.texture.Sprite;
|
||||
import net.minecraft.client.util.ModelIdentifier;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.BlockRenderView;
|
||||
import reborncore.common.fluid.container.ItemFluidInfo;
|
||||
import reborncore.common.util.Color;
|
||||
import techreborn.TechReborn;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class DynamicCellBakedModel implements BakedModel, FabricBakedModel {
|
||||
public class DynamicCellBakedModel extends BaseDynamicFluidBakedModel {
|
||||
|
||||
private static final ModelIdentifier CELL_BASE = new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "cell_base"), "inventory");
|
||||
private static final ModelIdentifier CELL_BACKGROUND = new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "cell_background"), "inventory");
|
||||
private static final ModelIdentifier CELL_FLUID = new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "cell_fluid"), "inventory");
|
||||
private static final ModelIdentifier CELL_GLASS = new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "cell_glass"), "inventory");
|
||||
|
||||
@Override
|
||||
public void emitBlockQuads(BlockRenderView blockRenderView, BlockState blockState, BlockPos blockPos, Supplier<Random> supplier, RenderContext renderContext) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void emitItemQuads(ItemStack stack, Supplier<Random> randomSupplier, RenderContext context) {
|
||||
Fluid fluid = Fluids.EMPTY;
|
||||
if (stack.getItem() instanceof ItemFluidInfo) {
|
||||
ItemFluidInfo fluidInfo = (ItemFluidInfo) stack.getItem();
|
||||
fluid = fluidInfo.getFluid(stack);
|
||||
super.emitItemQuads(stack, randomSupplier, context);
|
||||
|
||||
}
|
||||
BakedModelManager bakedModelManager = MinecraftClient.getInstance().getBakedModelManager();
|
||||
context.fallbackConsumer().accept(bakedModelManager.getModel(CELL_BASE));
|
||||
context.fallbackConsumer().accept(bakedModelManager.getModel(CELL_BACKGROUND));
|
||||
|
||||
if (fluid != Fluids.EMPTY) {
|
||||
FluidRenderHandler fluidRenderHandler = FluidRenderHandlerRegistry.INSTANCE.get(fluid);
|
||||
BakedModel fluidModel = bakedModelManager.getModel(CELL_FLUID);
|
||||
int fluidColor = fluidRenderHandler.getFluidColor(MinecraftClient.getInstance().world, MinecraftClient.getInstance().player.getBlockPos(), fluid.getDefaultState());
|
||||
Sprite fluidSprite = fluidRenderHandler.getFluidSprites(MinecraftClient.getInstance().world, BlockPos.ORIGIN, fluid.getDefaultState())[0];
|
||||
int color = new Color((float) (fluidColor >> 16 & 255) / 255.0F, (float) (fluidColor >> 8 & 255) / 255.0F, (float) (fluidColor & 255) / 255.0F).getColor();
|
||||
context.pushTransform(quad -> {
|
||||
quad.nominalFace(GeometryHelper.lightFace(quad));
|
||||
quad.spriteColor(0, color, color, color, color);
|
||||
quad.spriteBake(0, fluidSprite, MutableQuadView.BAKE_LOCK_UV);
|
||||
return true;
|
||||
});
|
||||
final QuadEmitter emitter = context.getEmitter();
|
||||
fluidModel.getQuads(null, null, randomSupplier.get()).forEach(q -> {
|
||||
emitter.fromVanilla(q.getVertexData(), 0, false);
|
||||
emitter.emit();
|
||||
});
|
||||
context.popTransform();
|
||||
}
|
||||
|
||||
context.fallbackConsumer().accept(bakedModelManager.getModel(CELL_GLASS));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(@Nullable BlockState blockState, @Nullable Direction direction, Random random) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVanillaAdapter() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean useAmbientOcclusion() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasDepthInGui() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBuiltin() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Sprite getSprite() {
|
||||
return MinecraftClient.getInstance().getSpriteAtlas().getSprite(new Identifier("techreborn:item/cell_base"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelTransformation getTransformation() {
|
||||
return ModelHelper.DEFAULT_ITEM_TRANSFORMS;
|
||||
public ModelIdentifier getBaseModel() {
|
||||
return CELL_BASE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelItemPropertyOverrideList getItemPropertyOverrides() {
|
||||
return ModelItemPropertyOverrideList.EMPTY;
|
||||
public ModelIdentifier getBackgroundModel() {
|
||||
return CELL_BACKGROUND;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelIdentifier getFluidModel() {
|
||||
return CELL_FLUID;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ import net.minecraft.text.TranslatableText;
|
|||
import net.minecraft.util.Identifier;
|
||||
import reborncore.common.crafting.RebornRecipe;
|
||||
import reborncore.common.crafting.RebornRecipeType;
|
||||
import reborncore.common.fluid.container.FluidInstance;
|
||||
import reborncore.common.util.StringUtils;
|
||||
|
||||
import java.util.Collections;
|
||||
|
@ -45,8 +46,6 @@ import java.util.LinkedList;
|
|||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import io.github.prospector.silk.fluid.FluidInstance;
|
||||
|
||||
public class MachineRecipeCategory<R extends RebornRecipe> implements RecipeCategory<MachineRecipeDisplay<R>> {
|
||||
|
||||
private final RebornRecipeType<R> rebornRecipeType;
|
||||
|
|
|
@ -28,6 +28,7 @@ import me.shedaniel.rei.api.RecipeDisplay;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Identifier;
|
||||
import reborncore.common.crafting.ingredient.RebornIngredient;
|
||||
import reborncore.common.fluid.container.FluidInstance;
|
||||
import techreborn.api.recipe.recipes.BlastFurnaceRecipe;
|
||||
import reborncore.common.crafting.RebornFluidRecipe;
|
||||
import reborncore.common.crafting.RebornRecipe;
|
||||
|
@ -36,8 +37,6 @@ import java.util.List;
|
|||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import io.github.prospector.silk.fluid.FluidInstance;
|
||||
|
||||
public class MachineRecipeDisplay<R extends RebornRecipe> implements RecipeDisplay {
|
||||
|
||||
private final R recipe;
|
||||
|
|
|
@ -4,7 +4,6 @@ import java.util.LinkedList;
|
|||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import io.github.prospector.silk.fluid.FluidInstance;
|
||||
import me.shedaniel.math.api.Point;
|
||||
import me.shedaniel.math.api.Rectangle;
|
||||
import me.shedaniel.rei.api.RecipeCategory;
|
||||
|
@ -21,6 +20,7 @@ import net.minecraft.text.Text;
|
|||
import net.minecraft.text.TranslatableText;
|
||||
import net.minecraft.util.Identifier;
|
||||
import reborncore.common.crafting.RebornRecipeType;
|
||||
import reborncore.common.fluid.container.FluidInstance;
|
||||
import reborncore.common.util.StringUtils;
|
||||
import techreborn.api.recipe.recipes.FluidReplicatorRecipe;
|
||||
import techreborn.compat.rei.ReiPlugin;
|
||||
|
|
|
@ -28,7 +28,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import io.github.prospector.silk.fluid.FluidInstance;
|
||||
import reborncore.common.fluid.container.FluidInstance;
|
||||
import me.shedaniel.rei.api.RecipeDisplay;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
|
|
@ -40,10 +40,11 @@ import net.minecraft.text.Text;
|
|||
import net.minecraft.util.Formatting;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import reborncore.api.IListInfoProvider;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.api.power.ItemPowerManager;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.StringUtils;
|
||||
import team.reborn.energy.Energy;
|
||||
import team.reborn.energy.EnergyHolder;
|
||||
import team.reborn.energy.EnergySide;
|
||||
import techreborn.TechReborn;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -59,11 +60,10 @@ public class StackToolTipHandler implements ItemTooltipCallback {
|
|||
Item item = stack.getItem();
|
||||
if (item instanceof IListInfoProvider) {
|
||||
((IListInfoProvider) item).addInfo(components, false, false);
|
||||
} else if (stack.getItem() instanceof IEnergyItemInfo) {
|
||||
ItemPowerManager itemPowerManager = new ItemPowerManager(stack);
|
||||
LiteralText line1 = new LiteralText(PowerSystem.getLocaliszedPowerFormattedNoSuffix(itemPowerManager.getEnergyStored()));
|
||||
} else if (stack.getItem() instanceof EnergyHolder) {
|
||||
LiteralText line1 = new LiteralText(PowerSystem.getLocaliszedPowerFormattedNoSuffix(Energy.of(stack).getEnergy()));
|
||||
line1.append("/");
|
||||
line1.append(PowerSystem.getLocaliszedPowerFormattedNoSuffix(itemPowerManager.getMaxEnergyStored()));
|
||||
line1.append(PowerSystem.getLocaliszedPowerFormattedNoSuffix(Energy.of(stack).getMaxStored()));
|
||||
line1.append(" ");
|
||||
line1.append(PowerSystem.getDisplayPower().abbreviation);
|
||||
line1.formatted(Formatting.GOLD);
|
||||
|
@ -71,11 +71,11 @@ public class StackToolTipHandler implements ItemTooltipCallback {
|
|||
components.add(1, line1);
|
||||
|
||||
if (Screen.hasShiftDown()) {
|
||||
int percentage = percentage(itemPowerManager.getMaxEnergyStored(), itemPowerManager.getEnergyStored());
|
||||
int percentage = percentage(Energy.of(stack).getMaxStored(), Energy.of(stack).getEnergy());
|
||||
Formatting color = StringUtils.getPercentageColour(percentage);
|
||||
components.add(2, new LiteralText(color + "" + percentage + "%" + Formatting.GRAY + " Charged"));
|
||||
// TODO: show both input and output rates
|
||||
components.add(3, new LiteralText(Formatting.GRAY + "I/O Rate: " + Formatting.GOLD + PowerSystem.getLocaliszedPowerFormatted(((IEnergyItemInfo) item).getMaxInput())));
|
||||
components.add(3, new LiteralText(Formatting.GRAY + "I/O Rate: " + Formatting.GOLD + PowerSystem.getLocaliszedPowerFormatted(((EnergyHolder) item).getMaxInput(EnergySide.UNKNOWN))));
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
|
@ -105,4 +105,10 @@ public class StackToolTipHandler implements ItemTooltipCallback {
|
|||
return (int) ((CurrentValue * 100.0f) / MaxValue);
|
||||
}
|
||||
|
||||
public int percentage(double MaxValue, double CurrentValue) {
|
||||
if (CurrentValue == 0)
|
||||
return 0;
|
||||
return (int) ((CurrentValue * 100.0f) / MaxValue);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -32,8 +32,9 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemConvertible;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import reborncore.api.blockentity.IUpgrade;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.common.powerSystem.PowerAcceptorBlockEntity;
|
||||
import team.reborn.energy.EnergySide;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.blockentity.ChargeOMatBlockEntity;
|
||||
import techreborn.blockentity.DigitalChestBlockEntity;
|
||||
|
@ -208,12 +209,12 @@ public class TRContent {
|
|||
public static Item PERIDOT_BOOTS;
|
||||
|
||||
public enum SolarPanels implements ItemConvertible {
|
||||
BASIC(EnumPowerTier.MICRO, TechRebornConfig.basicGenerationRateD, TechRebornConfig.basicGenerationRateN),
|
||||
ADVANCED(EnumPowerTier.LOW, TechRebornConfig.advancedGenerationRateD, TechRebornConfig.advancedGenerationRateN),
|
||||
INDUSTRIAL(EnumPowerTier.MEDIUM, TechRebornConfig.industrialGenerationRateD, TechRebornConfig.industrialGenerationRateN),
|
||||
ULTIMATE(EnumPowerTier.HIGH, TechRebornConfig.ultimateGenerationRateD, TechRebornConfig.ultimateGenerationRateN),
|
||||
QUANTUM(EnumPowerTier.EXTREME, TechRebornConfig.quantumGenerationRateD, TechRebornConfig.quantumGenerationRateN),
|
||||
CREATIVE(EnumPowerTier.INFINITE, Integer.MAX_VALUE / 100, Integer.MAX_VALUE / 100);
|
||||
BASIC(EnergyTier.MICRO, TechRebornConfig.basicGenerationRateD, TechRebornConfig.basicGenerationRateN),
|
||||
ADVANCED(EnergyTier.LOW, TechRebornConfig.advancedGenerationRateD, TechRebornConfig.advancedGenerationRateN),
|
||||
INDUSTRIAL(EnergyTier.MEDIUM, TechRebornConfig.industrialGenerationRateD, TechRebornConfig.industrialGenerationRateN),
|
||||
ULTIMATE(EnergyTier.HIGH, TechRebornConfig.ultimateGenerationRateD, TechRebornConfig.ultimateGenerationRateN),
|
||||
QUANTUM(EnergyTier.EXTREME, TechRebornConfig.quantumGenerationRateD, TechRebornConfig.quantumGenerationRateN),
|
||||
CREATIVE(EnergyTier.INFINITE, Integer.MAX_VALUE / 100, Integer.MAX_VALUE / 100);
|
||||
|
||||
public final String name;
|
||||
public final Block block;
|
||||
|
@ -224,9 +225,9 @@ public class TRContent {
|
|||
public int generationRateN;
|
||||
// Internal EU storage of solar panel
|
||||
public int internalCapacity;
|
||||
public final EnumPowerTier powerTier;
|
||||
public final EnergyTier powerTier;
|
||||
|
||||
SolarPanels(EnumPowerTier tier, int generationRateD, int generationRateN) {
|
||||
SolarPanels(EnergyTier tier, int generationRateD, int generationRateN) {
|
||||
name = this.toString().toLowerCase(Locale.ROOT);
|
||||
powerTier = tier;
|
||||
block = new BlockSolarPanel(this);
|
||||
|
@ -245,15 +246,15 @@ public class TRContent {
|
|||
}
|
||||
|
||||
public enum Cables implements ItemConvertible {
|
||||
COPPER(128, 12.0, true, EnumPowerTier.MEDIUM),
|
||||
TIN(32, 12.0, true, EnumPowerTier.LOW),
|
||||
GOLD(512, 12.0, true, EnumPowerTier.HIGH),
|
||||
HV(2048, 12.0, true, EnumPowerTier.EXTREME),
|
||||
GLASSFIBER(8192, 12.0, false, EnumPowerTier.INSANE),
|
||||
INSULATED_COPPER(128, 10.0, false, EnumPowerTier.MEDIUM),
|
||||
INSULATED_GOLD(512, 10.0, false, EnumPowerTier.HIGH),
|
||||
INSULATED_HV(2048, 10.0, false, EnumPowerTier.EXTREME),
|
||||
SUPERCONDUCTOR(Integer.MAX_VALUE / 4, 10.0, false, EnumPowerTier.INFINITE);
|
||||
COPPER(128, 12.0, true, EnergyTier.MEDIUM),
|
||||
TIN(32, 12.0, true, EnergyTier.LOW),
|
||||
GOLD(512, 12.0, true, EnergyTier.HIGH),
|
||||
HV(2048, 12.0, true, EnergyTier.EXTREME),
|
||||
GLASSFIBER(8192, 12.0, false, EnergyTier.INSANE),
|
||||
INSULATED_COPPER(128, 10.0, false, EnergyTier.MEDIUM),
|
||||
INSULATED_GOLD(512, 10.0, false, EnergyTier.HIGH),
|
||||
INSULATED_HV(2048, 10.0, false, EnergyTier.EXTREME),
|
||||
SUPERCONDUCTOR(Integer.MAX_VALUE / 4, 10.0, false, EnergyTier.INFINITE);
|
||||
|
||||
|
||||
public final String name;
|
||||
|
@ -264,10 +265,10 @@ public class TRContent {
|
|||
public double cableThickness;
|
||||
public boolean canKill;
|
||||
public boolean defaultCanKill;
|
||||
public EnumPowerTier tier;
|
||||
public EnergyTier tier;
|
||||
|
||||
|
||||
Cables(int transferRate, double cableThickness, boolean canKill, EnumPowerTier tier) {
|
||||
Cables(int transferRate, double cableThickness, boolean canKill, EnergyTier tier) {
|
||||
name = this.toString().toLowerCase(Locale.ROOT);
|
||||
this.transferRate = transferRate;
|
||||
this.defaultTransferRate = transferRate;
|
||||
|
@ -444,8 +445,8 @@ public class TRContent {
|
|||
|
||||
ALARM(new BlockAlarm()),
|
||||
CHUNK_LOADER(new GenericMachineBlock(EGui.CHUNK_LOADER, ChunkLoaderBlockEntity::new)),
|
||||
LAMP_INCANDESCENT(new BlockLamp(14, 4, 10, 8)),
|
||||
LAMP_LED(new BlockLamp(15, 1, 1, 12)),
|
||||
LAMP_INCANDESCENT(new BlockLamp(4, 10, 8)),
|
||||
LAMP_LED(new BlockLamp(1, 1, 12)),
|
||||
PLAYER_DETECTOR(new BlockPlayerDetector());
|
||||
|
||||
public final String name;
|
||||
|
@ -718,7 +719,7 @@ public class TRContent {
|
|||
handler.addSpeedMulti(TechRebornConfig.overclockerSpeed);
|
||||
handler.addPowerMulti(TechRebornConfig.overclockerPower);
|
||||
if (powerAcceptor != null) {
|
||||
powerAcceptor.extraPowerInput += powerAcceptor.getMaxInput();
|
||||
powerAcceptor.extraPowerInput += powerAcceptor.getMaxInput(EnergySide.UNKNOWN);
|
||||
powerAcceptor.extraPowerStorage += powerAcceptor.getBaseMaxPower();
|
||||
}
|
||||
}),
|
||||
|
|
|
@ -34,16 +34,18 @@ import net.minecraft.item.ItemGroup;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DefaultedList;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.api.power.ItemPowerManager;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import team.reborn.energy.Energy;
|
||||
import team.reborn.energy.EnergyHolder;
|
||||
import team.reborn.energy.EnergySide;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.TRArmorMaterial;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
public class ItemCloakingDevice extends ItemTRArmour implements IEnergyItemInfo {
|
||||
public class ItemCloakingDevice extends ItemTRArmour implements EnergyHolder {
|
||||
|
||||
public static int maxCharge = TechRebornConfig.cloakingDeviceCharge;
|
||||
public static int usage = TechRebornConfig.cloackingDeviceUsage;
|
||||
|
@ -59,21 +61,18 @@ public class ItemCloakingDevice extends ItemTRArmour implements IEnergyItemInfo
|
|||
public void inventoryTick(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
|
||||
if (entityIn instanceof PlayerEntity) {
|
||||
PlayerEntity player = (PlayerEntity) entityIn;
|
||||
ItemPowerManager capEnergy = new ItemPowerManager(stack);
|
||||
if (capEnergy != null && capEnergy.getEnergyStored() >= usage) {
|
||||
capEnergy.useEnergy(usage, false);
|
||||
player.setInvisible(true);
|
||||
} else {
|
||||
if (!player.hasStatusEffect(StatusEffects.INVISIBILITY)) {
|
||||
player.setInvisible(false);
|
||||
|
||||
if (Energy.valid(stack)) {
|
||||
if(Energy.of(stack).use(usage)){
|
||||
player.setInvisible(true);
|
||||
} else {
|
||||
if (!player.hasStatusEffect(StatusEffects.INVISIBILITY)) {
|
||||
player.setInvisible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onArmorTick(World world, PlayerEntity player, ItemStack stack) {
|
||||
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
@Override
|
||||
|
@ -83,7 +82,7 @@ public class ItemCloakingDevice extends ItemTRArmour implements IEnergyItemInfo
|
|||
}
|
||||
InitUtils.initPoweredItems(TRContent.CLOAKING_DEVICE, itemList);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public double getDurability(ItemStack stack) {
|
||||
return 1 - ItemUtils.getPowerForDurabilityBar(stack);
|
||||
|
@ -99,20 +98,24 @@ public class ItemCloakingDevice extends ItemTRArmour implements IEnergyItemInfo
|
|||
return PowerSystem.getDisplayPower().colour;
|
||||
}
|
||||
|
||||
|
||||
// IEnergyItemInfo
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
public double getMaxStoredPower() {
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxInput() {
|
||||
public EnergyTier getTier() {
|
||||
return EnergyTier.HIGH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxInput(EnergySide side) {
|
||||
return transferLimit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxOutput() {
|
||||
public double getMaxOutput(EnergySide side) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,20 +27,24 @@ package techreborn.items.armor;
|
|||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EquipmentSlot;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.item.ArmorItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DefaultedList;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.ItemDurabilityExtensions;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import team.reborn.energy.EnergyHolder;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.TRArmorMaterial;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
public class ItemLapotronicOrbpack extends ArmorItem implements IEnergyItemInfo, ItemDurabilityExtensions {
|
||||
public class ItemLapotronicOrbpack extends ArmorItem implements EnergyHolder, ItemDurabilityExtensions {
|
||||
|
||||
// 400M FE maxCharge and 100k FE\t charge rate. Fully charged in 3 mins.
|
||||
public static final int maxCharge = TechRebornConfig.lapotronPackCharge;
|
||||
|
@ -62,8 +66,7 @@ public class ItemLapotronicOrbpack extends ArmorItem implements IEnergyItemInfo,
|
|||
@Override
|
||||
public void inventoryTick(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
|
||||
if (entityIn instanceof PlayerEntity) {
|
||||
ItemLithiumIonBatpack.distributePowerToInventory(worldIn, (PlayerEntity) entityIn, stack,
|
||||
(int) transferLimit);
|
||||
ItemLithiumIonBatpack.distributePowerToInventory(worldIn, (PlayerEntity) entityIn, stack, transferLimit);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -84,17 +87,12 @@ public class ItemLapotronicOrbpack extends ArmorItem implements IEnergyItemInfo,
|
|||
|
||||
// IEnergyItemInfo
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
public double getMaxStoredPower() {
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxInput() {
|
||||
return transferLimit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxOutput() {
|
||||
return transferLimit;
|
||||
public EnergyTier getTier() {
|
||||
return EnergyTier.EXTREME;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,22 +29,25 @@ import net.fabricmc.api.Environment;
|
|||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EquipmentSlot;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.item.ArmorItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DefaultedList;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.api.power.ItemPowerManager;
|
||||
import reborncore.common.powerSystem.ExternalPowerSystems;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.ItemDurabilityExtensions;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import team.reborn.energy.EnergyHolder;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.TRArmorMaterial;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
public class ItemLithiumIonBatpack extends ArmorItem implements IEnergyItemInfo, ItemDurabilityExtensions {
|
||||
public class ItemLithiumIonBatpack extends ArmorItem implements EnergyHolder, ItemDurabilityExtensions {
|
||||
|
||||
// 8M FE maxCharge and 2k FE\t charge rate. Fully charged in 3 mins.
|
||||
public static final int maxCharge = TechRebornConfig.lithiumBatpackCharge;
|
||||
|
@ -59,11 +62,9 @@ public class ItemLithiumIonBatpack extends ArmorItem implements IEnergyItemInfo,
|
|||
return;
|
||||
}
|
||||
|
||||
ItemPowerManager capEnergy = new ItemPowerManager(itemStack);
|
||||
|
||||
for (int i = 0; i < player.inventory.getInvSize(); i++) {
|
||||
if (!player.inventory.getInvStack(i).isEmpty()) {
|
||||
ExternalPowerSystems.chargeItem(capEnergy, player.inventory.getInvStack(i));
|
||||
ExternalPowerSystems.chargeItem(itemStack, player.inventory.getInvStack(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -102,17 +103,13 @@ public class ItemLithiumIonBatpack extends ArmorItem implements IEnergyItemInfo,
|
|||
|
||||
// IEnergyItemInfo
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
public double getMaxStoredPower() {
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxInput() {
|
||||
return transferLimit;
|
||||
public EnergyTier getTier() {
|
||||
return EnergyTier.HIGH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxOutput() {
|
||||
return transferLimit;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,29 +32,30 @@ import net.minecraft.item.ItemPropertyGetter;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.api.power.ItemPowerManager;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.ItemDurabilityExtensions;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import team.reborn.energy.Energy;
|
||||
import team.reborn.energy.EnergyHolder;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.TechReborn;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class ItemBattery extends Item implements IEnergyItemInfo, ItemDurabilityExtensions {
|
||||
public class ItemBattery extends Item implements EnergyHolder, ItemDurabilityExtensions {
|
||||
|
||||
int maxEnergy = 0;
|
||||
int maxTransfer = 0;
|
||||
private final int maxEnergy;
|
||||
private final EnergyTier tier;
|
||||
|
||||
public ItemBattery(int maxEnergy, int maxTransfer) {
|
||||
public ItemBattery(int maxEnergy, EnergyTier tier) {
|
||||
super(new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamageIfAbsent(1));
|
||||
this.maxEnergy = maxEnergy;
|
||||
this.maxTransfer = maxTransfer;
|
||||
this.tier = tier;
|
||||
this.addPropertyGetter(new Identifier("techreborn:empty"), new ItemPropertyGetter() {
|
||||
@Override
|
||||
@Environment(EnvType.CLIENT)
|
||||
public float call(ItemStack stack, @Nullable World worldIn, @Nullable LivingEntity entityIn) {
|
||||
if (!stack.isEmpty() && new ItemPowerManager(stack).getEnergyStored() == 0) {
|
||||
if (!stack.isEmpty() && Energy.of(stack).getEnergy() == 0) {
|
||||
return 1.0F;
|
||||
}
|
||||
return 0.0F;
|
||||
|
@ -80,17 +81,12 @@ public class ItemBattery extends Item implements IEnergyItemInfo, ItemDurability
|
|||
|
||||
// IEnergyItemInfo
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
public double getMaxStoredPower() {
|
||||
return maxEnergy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxInput() {
|
||||
return maxTransfer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxOutput() {
|
||||
return maxTransfer;
|
||||
public EnergyTier getTier() {
|
||||
return tier;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ import net.fabricmc.api.Environment;
|
|||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DefaultedList;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
@ -37,7 +38,7 @@ public class ItemEnergyCrystal extends ItemBattery {
|
|||
|
||||
// 4M FE storage with 1k charge rate
|
||||
public ItemEnergyCrystal() {
|
||||
super(TechRebornConfig.energyCrystalMaxCharge, 1_000);
|
||||
super(TechRebornConfig.energyCrystalMaxCharge, EnergyTier.HIGH);
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
|
|
|
@ -29,6 +29,7 @@ import net.fabricmc.api.Environment;
|
|||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DefaultedList;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
@ -37,7 +38,7 @@ public class ItemLapotronCrystal extends ItemBattery {
|
|||
|
||||
// 40M FE capacity with 10k FE\t charge rate
|
||||
public ItemLapotronCrystal() {
|
||||
super(TechRebornConfig.lapotronCrystalMaxCharge, 10_000);
|
||||
super(TechRebornConfig.lapotronCrystalMaxCharge, EnergyTier.EXTREME);
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
|
|
|
@ -29,6 +29,7 @@ import net.fabricmc.api.Environment;
|
|||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DefaultedList;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
@ -37,7 +38,7 @@ public class ItemLapotronicOrb extends ItemBattery {
|
|||
|
||||
// 400M capacity with 100k FE\t charge rate
|
||||
public ItemLapotronicOrb() {
|
||||
super(TechRebornConfig.lapotronicOrbMaxCharge, 100_000);
|
||||
super(TechRebornConfig.lapotronicOrbMaxCharge, EnergyTier.EXTREME);
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
|
|
|
@ -29,6 +29,7 @@ import net.fabricmc.api.Environment;
|
|||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DefaultedList;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
|
@ -36,7 +37,7 @@ public class ItemLithiumIonBattery extends ItemBattery {
|
|||
|
||||
// 400k FE with 1k FE\t charge rate
|
||||
public ItemLithiumIonBattery() {
|
||||
super(400_000, 1_000);
|
||||
super(400_000, EnergyTier.HIGH);
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
|
|
|
@ -29,6 +29,7 @@ import net.fabricmc.api.Environment;
|
|||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DefaultedList;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
|
@ -36,7 +37,7 @@ public class ItemRedCellBattery extends ItemBattery {
|
|||
|
||||
// 40k FE capacity with 100 FE\t charge rate
|
||||
public ItemRedCellBattery() {
|
||||
super(40_000, 100);
|
||||
super(40_000, EnergyTier.LOW);
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
|
|
|
@ -35,18 +35,20 @@ import net.minecraft.item.*;
|
|||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.api.power.ItemPowerManager;
|
||||
import reborncore.common.powerSystem.ExternalPowerSystems;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.ItemDurabilityExtensions;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import team.reborn.energy.Energy;
|
||||
import team.reborn.energy.EnergyHolder;
|
||||
import team.reborn.energy.EnergySide;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.TechReborn;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Random;
|
||||
|
||||
public class ItemChainsaw extends AxeItem implements IEnergyItemInfo, ItemDurabilityExtensions {
|
||||
public class ItemChainsaw extends AxeItem implements EnergyHolder, ItemDurabilityExtensions {
|
||||
|
||||
public int maxCharge = 1;
|
||||
public int cost = 250;
|
||||
|
@ -63,7 +65,7 @@ public class ItemChainsaw extends AxeItem implements IEnergyItemInfo, ItemDurabi
|
|||
@Override
|
||||
@Environment(EnvType.CLIENT)
|
||||
public float call(ItemStack stack, @Nullable World worldIn, @Nullable LivingEntity entityIn) {
|
||||
if (!stack.isEmpty() && new ItemPowerManager(stack).getEnergyStored() >= cost
|
||||
if (!stack.isEmpty() && Energy.of(stack).getEnergy() >= cost
|
||||
&& entityIn != null && entityIn.getMainHandStack().equals(stack)) {
|
||||
return 1.0F;
|
||||
}
|
||||
|
@ -75,7 +77,7 @@ public class ItemChainsaw extends AxeItem implements IEnergyItemInfo, ItemDurabi
|
|||
// ItemAxe
|
||||
@Override
|
||||
public float getMiningSpeed(ItemStack stack, BlockState state) {
|
||||
if (new ItemPowerManager(stack).getEnergyStored() >= cost
|
||||
if (Energy.of(stack).getEnergy() >= cost
|
||||
&& (state.getMaterial() == Material.WOOD)) {
|
||||
return this.poweredSpeed;
|
||||
} else {
|
||||
|
@ -88,10 +90,8 @@ public class ItemChainsaw extends AxeItem implements IEnergyItemInfo, ItemDurabi
|
|||
public boolean postMine(ItemStack stack, World worldIn, BlockState blockIn, BlockPos pos, LivingEntity entityLiving) {
|
||||
Random rand = new Random();
|
||||
if (rand.nextInt(EnchantmentHelper.getLevel(Enchantments.UNBREAKING, stack) + 1) == 0) {
|
||||
ItemPowerManager capEnergy = new ItemPowerManager(stack);
|
||||
|
||||
capEnergy.useEnergy(cost, false);
|
||||
ExternalPowerSystems.requestEnergyFromArmor(capEnergy, entityLiving);
|
||||
Energy.of(stack).use(cost);
|
||||
ExternalPowerSystems.requestEnergyFromArmor(stack, entityLiving);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -123,17 +123,22 @@ public class ItemChainsaw extends AxeItem implements IEnergyItemInfo, ItemDurabi
|
|||
|
||||
// IEnergyItemInfo
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
public double getMaxStoredPower() {
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxInput() {
|
||||
public EnergyTier getTier() {
|
||||
return EnergyTier.MEDIUM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxInput(EnergySide side) {
|
||||
return transferLimit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxOutput() {
|
||||
public double getMaxOutput(EnergySide side) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,8 +36,8 @@ import net.minecraft.util.ActionResult;
|
|||
import net.minecraft.util.Formatting;
|
||||
import net.minecraft.util.SystemUtil;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import reborncore.api.power.EnergyBlockEntity;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import team.reborn.energy.Energy;
|
||||
import techreborn.TechReborn;
|
||||
|
||||
import java.util.Map.Entry;
|
||||
|
@ -65,8 +65,8 @@ public class ItemDebugTool extends Item {
|
|||
BlockEntity blockEntity = context.getWorld().getBlockEntity(context.getBlockPos());
|
||||
if (blockEntity != null) {
|
||||
sendMessage(context, new LiteralText(getBlockEntityType(blockEntity)));
|
||||
if (blockEntity instanceof EnergyBlockEntity) {
|
||||
sendMessage(context, new LiteralText(getRCPower((EnergyBlockEntity) blockEntity)));
|
||||
if (Energy.valid(blockEntity)) {
|
||||
sendMessage(context, new LiteralText(getRCPower(blockEntity)));
|
||||
}
|
||||
}
|
||||
return ActionResult.SUCCESS;
|
||||
|
@ -109,13 +109,13 @@ public class ItemDebugTool extends Item {
|
|||
return s;
|
||||
}
|
||||
|
||||
private String getRCPower(EnergyBlockEntity blockEntity) {
|
||||
private String getRCPower(BlockEntity blockEntity) {
|
||||
String s = "" + Formatting.GREEN;
|
||||
s += "Power: ";
|
||||
s += Formatting.BLUE;
|
||||
s += PowerSystem.getLocaliszedPower(blockEntity.getEnergy());
|
||||
s += PowerSystem.getLocaliszedPower(Energy.of(blockEntity).getEnergy());
|
||||
s += "/";
|
||||
s += PowerSystem.getLocaliszedPower(blockEntity.getMaxPower());
|
||||
s += PowerSystem.getLocaliszedPower(Energy.of(blockEntity).getMaxStored());
|
||||
|
||||
return s;
|
||||
}
|
||||
|
|
|
@ -31,17 +31,19 @@ import net.minecraft.entity.LivingEntity;
|
|||
import net.minecraft.item.*;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.api.power.ItemPowerManager;
|
||||
import reborncore.common.powerSystem.ExternalPowerSystems;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.ItemDurabilityExtensions;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import team.reborn.energy.Energy;
|
||||
import team.reborn.energy.EnergyHolder;
|
||||
import team.reborn.energy.EnergySide;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.TechReborn;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class ItemDrill extends PickaxeItem implements IEnergyItemInfo, ItemDurabilityExtensions {
|
||||
public class ItemDrill extends PickaxeItem implements EnergyHolder, ItemDurabilityExtensions {
|
||||
|
||||
public int maxCharge = 1;
|
||||
public int cost = 250;
|
||||
|
@ -57,7 +59,7 @@ public class ItemDrill extends PickaxeItem implements IEnergyItemInfo, ItemDurab
|
|||
// ItemPickaxe
|
||||
@Override
|
||||
public float getMiningSpeed(ItemStack stack, BlockState state) {
|
||||
if (new ItemPowerManager(stack).getEnergyStored() < cost) {
|
||||
if (Energy.of(stack).getEnergy() < cost) {
|
||||
return unpoweredSpeed;
|
||||
}
|
||||
if (Items.WOODEN_PICKAXE.getMiningSpeed(stack, state) > 1.0F
|
||||
|
@ -73,10 +75,8 @@ public class ItemDrill extends PickaxeItem implements IEnergyItemInfo, ItemDurab
|
|||
public boolean postMine(ItemStack stack, World worldIn, BlockState blockIn, BlockPos pos, LivingEntity entityLiving) {
|
||||
Random rand = new Random();
|
||||
if (rand.nextInt(EnchantmentHelper.getLevel(Enchantments.UNBREAKING, stack) + 1) == 0) {
|
||||
ItemPowerManager capEnergy = new ItemPowerManager(stack);
|
||||
|
||||
capEnergy.useEnergy(cost, false);
|
||||
ExternalPowerSystems.requestEnergyFromArmor(capEnergy, entityLiving);
|
||||
Energy.of(stack).use(cost);
|
||||
ExternalPowerSystems.requestEnergyFromArmor(stack, entityLiving);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -109,17 +109,22 @@ public class ItemDrill extends PickaxeItem implements IEnergyItemInfo, ItemDurab
|
|||
|
||||
// IEnergyItemInfo
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
public double getMaxStoredPower() {
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxInput() {
|
||||
public EnergyTier getTier() {
|
||||
return EnergyTier.HIGH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxInput(EnergySide side) {
|
||||
return transferLimit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxOutput() {
|
||||
public double getMaxOutput(EnergySide side) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,16 +35,19 @@ import net.minecraft.item.PickaxeItem;
|
|||
import net.minecraft.item.ToolMaterials;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.api.power.ItemPowerManager;
|
||||
import reborncore.common.powerSystem.ExternalPowerSystems;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.ItemDurabilityExtensions;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import team.reborn.energy.Energy;
|
||||
import team.reborn.energy.EnergyHolder;
|
||||
import team.reborn.energy.EnergySide;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.TechReborn;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class ItemJackhammer extends PickaxeItem implements IEnergyItemInfo, ItemDurabilityExtensions {
|
||||
public class ItemJackhammer extends PickaxeItem implements EnergyHolder, ItemDurabilityExtensions {
|
||||
|
||||
public int maxCharge = 1;
|
||||
public int cost = 250;
|
||||
|
@ -58,7 +61,7 @@ public class ItemJackhammer extends PickaxeItem implements IEnergyItemInfo, Item
|
|||
// ItemPickaxe
|
||||
@Override
|
||||
public float getMiningSpeed(ItemStack stack, BlockState state) {
|
||||
if (Block.isNaturalStone(state.getBlock()) && new ItemPowerManager(stack).getEnergyStored() >= cost) {
|
||||
if (Block.isNaturalStone(state.getBlock()) && Energy.of(stack).getEnergy() >= cost) {
|
||||
return miningSpeed;
|
||||
} else {
|
||||
return 0.5F;
|
||||
|
@ -70,10 +73,8 @@ public class ItemJackhammer extends PickaxeItem implements IEnergyItemInfo, Item
|
|||
public boolean postMine(ItemStack stack, World worldIn, BlockState blockIn, BlockPos pos, LivingEntity entityLiving) {
|
||||
Random rand = new Random();
|
||||
if (rand.nextInt(EnchantmentHelper.getLevel(Enchantments.UNBREAKING, stack) + 1) == 0) {
|
||||
ItemPowerManager capEnergy = new ItemPowerManager(stack);
|
||||
|
||||
capEnergy.useEnergy(cost, false);
|
||||
ExternalPowerSystems.requestEnergyFromArmor(capEnergy, entityLiving);
|
||||
Energy.of(stack).use(cost);
|
||||
ExternalPowerSystems.requestEnergyFromArmor(stack, entityLiving);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -107,17 +108,22 @@ public class ItemJackhammer extends PickaxeItem implements IEnergyItemInfo, Item
|
|||
|
||||
// IEnergyItemInfo
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
public double getMaxStoredPower() {
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxInput() {
|
||||
public EnergyTier getTier() {
|
||||
return EnergyTier.MEDIUM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxInput(EnergySide side) {
|
||||
return transferLimit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxOutput() {
|
||||
public double getMaxOutput(EnergySide side) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,19 +35,21 @@ import net.minecraft.item.*;
|
|||
import net.minecraft.util.DefaultedList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.api.power.ItemPowerManager;
|
||||
import reborncore.common.powerSystem.ExternalPowerSystems;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.ItemDurabilityExtensions;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import team.reborn.energy.Energy;
|
||||
import team.reborn.energy.EnergyHolder;
|
||||
import team.reborn.energy.EnergySide;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.TRContent;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class ItemRockCutter extends PickaxeItem implements IEnergyItemInfo, ItemDurabilityExtensions {
|
||||
public class ItemRockCutter extends PickaxeItem implements EnergyHolder, ItemDurabilityExtensions {
|
||||
|
||||
public static final int maxCharge = TechRebornConfig.rockCutterCharge;
|
||||
public int transferLimit = 1_000;
|
||||
|
@ -69,7 +71,7 @@ public class ItemRockCutter extends PickaxeItem implements IEnergyItemInfo, Item
|
|||
|
||||
@Override
|
||||
public float getMiningSpeed(ItemStack stack, BlockState state) {
|
||||
if (new ItemPowerManager(stack).getEnergyStored() < cost) {
|
||||
if (Energy.of(stack).getEnergy() < cost) {
|
||||
return 2F;
|
||||
} else {
|
||||
return Items.DIAMOND_PICKAXE.getMiningSpeed(stack, state);
|
||||
|
@ -81,10 +83,8 @@ public class ItemRockCutter extends PickaxeItem implements IEnergyItemInfo, Item
|
|||
public boolean postMine(ItemStack stack, World worldIn, BlockState blockIn, BlockPos pos, LivingEntity entityLiving) {
|
||||
Random rand = new Random();
|
||||
if (rand.nextInt(EnchantmentHelper.getLevel(Enchantments.UNBREAKING, stack) + 1) == 0) {
|
||||
ItemPowerManager capEnergy = new ItemPowerManager(stack);
|
||||
|
||||
capEnergy.useEnergy(cost, false);
|
||||
ExternalPowerSystems.requestEnergyFromArmor(capEnergy, entityLiving);
|
||||
Energy.of(stack).use(cost);
|
||||
ExternalPowerSystems.requestEnergyFromArmor(stack, entityLiving);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -135,8 +135,7 @@ public class ItemRockCutter extends PickaxeItem implements IEnergyItemInfo, Item
|
|||
uncharged.addEnchantment(Enchantments.SILK_TOUCH, 1);
|
||||
ItemStack charged = new ItemStack(TRContent.ROCK_CUTTER);
|
||||
charged.addEnchantment(Enchantments.SILK_TOUCH, 1);
|
||||
ItemPowerManager capEnergy = new ItemPowerManager(charged);
|
||||
capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
|
||||
Energy.of(charged).set(Energy.of(charged).getMaxStored());
|
||||
|
||||
itemList.add(uncharged);
|
||||
itemList.add(charged);
|
||||
|
@ -144,17 +143,22 @@ public class ItemRockCutter extends PickaxeItem implements IEnergyItemInfo, Item
|
|||
|
||||
// IEnergyItemInfo
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
public double getMaxStoredPower() {
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxInput() {
|
||||
public EnergyTier getTier() {
|
||||
return EnergyTier.HIGH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxInput(EnergySide side) {
|
||||
return transferLimit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxOutput() {
|
||||
public double getMaxOutput(EnergySide side) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,19 +30,19 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DefaultedList;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.ItemDurabilityExtensions;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import team.reborn.energy.EnergyHolder;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.TechReborn;
|
||||
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 05/11/2016.
|
||||
*/
|
||||
public class ItemElectricTreetap extends Item implements IEnergyItemInfo, ItemDurabilityExtensions {
|
||||
public class ItemElectricTreetap extends Item implements EnergyHolder, ItemDurabilityExtensions {
|
||||
|
||||
public static final int maxCharge = 10_000;
|
||||
public int cost = 20;
|
||||
|
@ -77,17 +77,12 @@ public class ItemElectricTreetap extends Item implements IEnergyItemInfo, ItemDu
|
|||
|
||||
// IEnergyItemInfo
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
public double getMaxStoredPower() {
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxInput() {
|
||||
return 200;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxOutput() {
|
||||
return 0;
|
||||
public EnergyTier getTier() {
|
||||
return EnergyTier.MEDIUM;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,10 +44,10 @@ import net.minecraft.util.*;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.api.power.ItemPowerManager;
|
||||
import reborncore.common.powerSystem.ExternalPowerSystems;
|
||||
import reborncore.common.util.ChatUtils;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import team.reborn.energy.Energy;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.items.tool.ItemChainsaw;
|
||||
|
@ -117,7 +117,7 @@ public class ItemIndustrialChainsaw extends ItemChainsaw {
|
|||
public TypedActionResult<ItemStack> use(final World world, final PlayerEntity player, final Hand hand) {
|
||||
final ItemStack stack = player.getStackInHand(hand);
|
||||
if (player.isSneaking()) {
|
||||
if (new ItemPowerManager(stack).getEnergyStored() < cost) {
|
||||
if (Energy.of(stack).getEnergy() < cost) {
|
||||
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText(
|
||||
Formatting.GRAY + StringUtils.t("techreborn.message.nanosaberEnergyErrorTo") + " "
|
||||
+ Formatting.GOLD + StringUtils.t("techreborn.message.nanosaberActivate")));
|
||||
|
@ -148,7 +148,7 @@ public class ItemIndustrialChainsaw extends ItemChainsaw {
|
|||
|
||||
@Override
|
||||
public void usageTick(World world, LivingEntity entity, ItemStack stack, int i) {
|
||||
if (ItemUtils.isActive(stack) && new ItemPowerManager(stack).getEnergyStored() < cost) {
|
||||
if (ItemUtils.isActive(stack) && Energy.of(stack).getEnergy() < cost) {
|
||||
if(entity.world.isClient){
|
||||
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText(
|
||||
Formatting.GRAY + StringUtils.t("techreborn.message.nanosaberEnergyError") + " "
|
||||
|
@ -178,24 +178,21 @@ public class ItemIndustrialChainsaw extends ItemChainsaw {
|
|||
return;
|
||||
}
|
||||
|
||||
ItemPowerManager capEnergy = new ItemPowerManager(stack);
|
||||
if (capEnergy.getEnergyStored() < cost) {
|
||||
return;
|
||||
if(Energy.of(stack).use(cost)){
|
||||
BlockState blockState = world.getBlockState(pos);
|
||||
if (blockState.getHardness(world, pos) == -1.0F) {
|
||||
return;
|
||||
}
|
||||
if(!(entityLiving instanceof PlayerEntity)){
|
||||
return;
|
||||
}
|
||||
|
||||
ExternalPowerSystems.requestEnergyFromArmor(stack, entityLiving);
|
||||
|
||||
blockState.getBlock().afterBreak(world, (PlayerEntity) entityLiving, pos, blockState, world.getBlockEntity(pos), stack);
|
||||
world.setBlockState(pos, Blocks.AIR.getDefaultState());
|
||||
world.removeBlockEntity(pos);
|
||||
}
|
||||
|
||||
BlockState blockState = world.getBlockState(pos);
|
||||
if (blockState.getHardness(world, pos) == -1.0F) {
|
||||
return;
|
||||
}
|
||||
if(!(entityLiving instanceof PlayerEntity)){
|
||||
return;
|
||||
}
|
||||
|
||||
capEnergy.useEnergy(cost, false);
|
||||
ExternalPowerSystems.requestEnergyFromArmor(capEnergy, entityLiving);
|
||||
|
||||
blockState.getBlock().afterBreak(world, (PlayerEntity) entityLiving, pos, blockState, world.getBlockEntity(pos), stack);
|
||||
world.setBlockState(pos, Blocks.AIR.getDefaultState());
|
||||
world.removeBlockEntity(pos);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,10 +47,10 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.RayTraceContext;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.api.power.ItemPowerManager;
|
||||
import reborncore.common.powerSystem.ExternalPowerSystems;
|
||||
import reborncore.common.util.ChatUtils;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import team.reborn.energy.Energy;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.items.tool.ItemDrill;
|
||||
|
@ -121,11 +121,8 @@ public class ItemIndustrialDrill extends ItemDrill {
|
|||
private void breakBlock(BlockPos pos, World world, PlayerEntity playerIn, ItemStack drill) {
|
||||
BlockState blockState = world.getBlockState(pos);
|
||||
|
||||
ItemPowerManager capEnergy = new ItemPowerManager(drill);
|
||||
|
||||
if(capEnergy.getEnergyStored() > cost){
|
||||
capEnergy.useEnergy(cost, false);
|
||||
ExternalPowerSystems.requestEnergyFromArmor(capEnergy, playerIn);
|
||||
if(Energy.of(drill).use(cost)){
|
||||
ExternalPowerSystems.requestEnergyFromArmor(drill, playerIn);
|
||||
|
||||
blockState.getBlock().onBlockRemoved(blockState, world, pos, blockState, true);
|
||||
blockState.getBlock().afterBreak(world, playerIn, pos, blockState, world.getBlockEntity(pos), drill);
|
||||
|
@ -176,7 +173,7 @@ public class ItemIndustrialDrill extends ItemDrill {
|
|||
public TypedActionResult<ItemStack> use(final World world, final PlayerEntity player, final Hand hand) {
|
||||
final ItemStack stack = player.getStackInHand(hand);
|
||||
if (player.isSneaking()) {
|
||||
if (new ItemPowerManager(stack).getEnergyStored() < cost) {
|
||||
if (Energy.of(stack).getEnergy() < cost) {
|
||||
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText(
|
||||
Formatting.GRAY + StringUtils.t("techreborn.message.nanosaberEnergyErrorTo") + " "
|
||||
+ Formatting.GOLD + StringUtils.t("techreborn.message.nanosaberActivate")));
|
||||
|
@ -207,7 +204,7 @@ public class ItemIndustrialDrill extends ItemDrill {
|
|||
|
||||
@Override
|
||||
public void usageTick(World world, LivingEntity entity, ItemStack stack, int i) {
|
||||
if (ItemUtils.isActive(stack) && new ItemPowerManager(stack).getEnergyStored() < cost) {
|
||||
if (ItemUtils.isActive(stack) && Energy.of(stack).getEnergy() < cost) {
|
||||
if(entity.world.isClient){
|
||||
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText(
|
||||
Formatting.GRAY + StringUtils.t("techreborn.message.nanosaberEnergyError") + " "
|
||||
|
|
|
@ -28,13 +28,11 @@ import com.google.common.collect.Multimap;
|
|||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.item.TooltipContext;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EquipmentSlot;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.attribute.EntityAttributeModifier;
|
||||
import net.minecraft.entity.attribute.EntityAttributes;
|
||||
import reborncore.api.items.ItemStackModifiers;
|
||||
import reborncore.common.util.StringUtils;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
|
@ -43,13 +41,17 @@ import net.minecraft.text.Text;
|
|||
import net.minecraft.text.TranslatableText;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.api.power.ItemPowerManager;
|
||||
import reborncore.api.items.ItemStackModifiers;
|
||||
import reborncore.common.powerSystem.ExternalPowerSystems;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.ChatUtils;
|
||||
import reborncore.common.util.ItemDurabilityExtensions;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import reborncore.common.util.StringUtils;
|
||||
import team.reborn.energy.Energy;
|
||||
import team.reborn.energy.EnergyHolder;
|
||||
import team.reborn.energy.EnergySide;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.TRContent;
|
||||
|
@ -58,7 +60,7 @@ import techreborn.utils.MessageIDs;
|
|||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemNanosaber extends SwordItem implements IEnergyItemInfo, ItemDurabilityExtensions, ItemStackModifiers {
|
||||
public class ItemNanosaber extends SwordItem implements EnergyHolder, ItemDurabilityExtensions, ItemStackModifiers {
|
||||
public static final int maxCharge = TechRebornConfig.nanoSaberCharge;
|
||||
public int transferLimit = 1_000;
|
||||
public int cost = 250;
|
||||
|
@ -75,8 +77,7 @@ public class ItemNanosaber extends SwordItem implements IEnergyItemInfo, ItemDur
|
|||
@Nullable
|
||||
LivingEntity entityIn) {
|
||||
if (ItemUtils.isActive(stack)) {
|
||||
ItemPowerManager capEnergy = new ItemPowerManager(stack);
|
||||
if (capEnergy.getMaxEnergyStored() - capEnergy.getEnergyStored() >= 0.9 * capEnergy.getMaxEnergyStored()) {
|
||||
if (Energy.of(stack).getMaxStored() - Energy.of(stack).getEnergy() >= 0.9 * Energy.of(stack).getMaxStored()) {
|
||||
return 0.5F;
|
||||
}
|
||||
return 1.0F;
|
||||
|
@ -89,14 +90,9 @@ public class ItemNanosaber extends SwordItem implements IEnergyItemInfo, ItemDur
|
|||
// ItemSword
|
||||
@Override
|
||||
public boolean postHit(ItemStack stack, LivingEntity entityHit, LivingEntity entityHitter) {
|
||||
ItemPowerManager capEnergy = new ItemPowerManager(stack);
|
||||
if (capEnergy.getEnergyStored() >= cost) {
|
||||
capEnergy.useEnergy(cost, false);
|
||||
ExternalPowerSystems.requestEnergyFromArmor(capEnergy, entityHitter);
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
boolean used = Energy.of(stack).use(cost);
|
||||
ExternalPowerSystems.requestEnergyFromArmor(stack, entityHitter);
|
||||
return used;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -114,7 +110,7 @@ public class ItemNanosaber extends SwordItem implements IEnergyItemInfo, ItemDur
|
|||
public TypedActionResult<ItemStack> use(final World world, final PlayerEntity player, final Hand hand) {
|
||||
final ItemStack stack = player.getStackInHand(hand);
|
||||
if (player.isSneaking()) {
|
||||
if (new ItemPowerManager(stack).getEnergyStored() < cost) {
|
||||
if (Energy.of(stack).getEnergy() < cost) {
|
||||
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText(
|
||||
Formatting.GRAY + StringUtils.t("techreborn.message.nanosaberEnergyErrorTo") + " "
|
||||
+ Formatting.GOLD + StringUtils.t("techreborn.message.nanosaberActivate")));
|
||||
|
@ -145,7 +141,7 @@ public class ItemNanosaber extends SwordItem implements IEnergyItemInfo, ItemDur
|
|||
|
||||
@Override
|
||||
public void inventoryTick(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
|
||||
if (ItemUtils.isActive(stack) && new ItemPowerManager(stack).getEnergyStored() < cost) {
|
||||
if (ItemUtils.isActive(stack) && Energy.of(stack).getEnergy() < cost) {
|
||||
if(worldIn.isClient){
|
||||
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText(
|
||||
Formatting.GRAY + StringUtils.t("techreborn.message.nanosaberEnergyError") + " "
|
||||
|
@ -189,14 +185,12 @@ public class ItemNanosaber extends SwordItem implements IEnergyItemInfo, ItemDur
|
|||
ItemStack inactiveCharged = new ItemStack(TRContent.NANOSABER);
|
||||
inactiveCharged.setTag(new CompoundTag());
|
||||
inactiveCharged.getTag().putBoolean("isActive", false);
|
||||
ItemPowerManager capEnergy = new ItemPowerManager(inactiveCharged);
|
||||
capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
|
||||
Energy.of(inactiveCharged).set(Energy.of(inactiveCharged).getMaxStored());
|
||||
|
||||
ItemStack activeCharged = new ItemStack(TRContent.NANOSABER);
|
||||
activeCharged.setTag(new CompoundTag());
|
||||
activeCharged.getTag().putBoolean("isActive", true);
|
||||
ItemPowerManager capEnergy2 = new ItemPowerManager(activeCharged);
|
||||
capEnergy2.setEnergyStored(capEnergy2.getMaxEnergyStored());
|
||||
Energy.of(activeCharged).set(Energy.of(activeCharged).getMaxStored());
|
||||
|
||||
itemList.add(inactiveUncharged);
|
||||
itemList.add(inactiveCharged);
|
||||
|
@ -215,17 +209,22 @@ public class ItemNanosaber extends SwordItem implements IEnergyItemInfo, ItemDur
|
|||
|
||||
// IEnergyItemInfo
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
public double getMaxStoredPower() {
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxInput() {
|
||||
public EnergyTier getTier() {
|
||||
return EnergyTier.HIGH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxInput(EnergySide side) {
|
||||
return transferLimit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxOutput() {
|
||||
public double getMaxOutput(EnergySide side) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,26 +26,28 @@ package techreborn.items.tool.industrial;
|
|||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.item.TooltipContext;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.damage.DamageSource;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.DefaultedList;
|
||||
import net.minecraft.util.Formatting;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.api.power.ItemPowerManager;
|
||||
import reborncore.common.powerSystem.ExternalPowerSystems;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.ItemDurabilityExtensions;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import reborncore.common.util.TorchHelper;
|
||||
import team.reborn.energy.Energy;
|
||||
import team.reborn.energy.EnergyHolder;
|
||||
import team.reborn.energy.EnergySide;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.TRContent;
|
||||
|
@ -54,7 +56,7 @@ import techreborn.utils.InitUtils;
|
|||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemOmniTool extends PickaxeItem implements IEnergyItemInfo, ItemDurabilityExtensions {
|
||||
public class ItemOmniTool extends PickaxeItem implements EnergyHolder, ItemDurabilityExtensions {
|
||||
|
||||
public static final int maxCharge = TechRebornConfig.omniToolCharge;
|
||||
public int transferLimit = 1_000;
|
||||
|
@ -77,11 +79,8 @@ public class ItemOmniTool extends PickaxeItem implements IEnergyItemInfo, ItemDu
|
|||
// ItemTool
|
||||
@Override
|
||||
public boolean postMine(ItemStack stack, World worldIn, BlockState blockIn, BlockPos pos, LivingEntity entityLiving) {
|
||||
ItemPowerManager capEnergy = new ItemPowerManager(stack);
|
||||
|
||||
capEnergy.useEnergy(cost, false);
|
||||
ExternalPowerSystems.requestEnergyFromArmor(capEnergy, entityLiving);
|
||||
|
||||
Energy.of(stack).use(cost);
|
||||
ExternalPowerSystems.requestEnergyFromArmor(stack, entityLiving);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -108,13 +107,10 @@ public class ItemOmniTool extends PickaxeItem implements IEnergyItemInfo, ItemDu
|
|||
|
||||
@Override
|
||||
public boolean postHit(ItemStack stack, LivingEntity entityliving, LivingEntity attacker) {
|
||||
ItemPowerManager capEnergy = new ItemPowerManager(stack);
|
||||
if (capEnergy.getEnergyStored() >= hitCost) {
|
||||
capEnergy.useEnergy(hitCost, false);
|
||||
ExternalPowerSystems.requestEnergyFromArmor(capEnergy, entityliving);
|
||||
|
||||
if(Energy.of(stack).use(hitCost)) {
|
||||
entityliving.damage(DamageSource.player((PlayerEntity) attacker), 8F);
|
||||
}
|
||||
ExternalPowerSystems.requestEnergyFromArmor(stack, entityliving);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -163,17 +159,22 @@ public class ItemOmniTool extends PickaxeItem implements IEnergyItemInfo, ItemDu
|
|||
|
||||
// IEnergyItemInfo
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
public double getMaxStoredPower() {
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxInput() {
|
||||
public double getMaxInput(EnergySide side) {
|
||||
return transferLimit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxOutput() {
|
||||
public double getMaxOutput(EnergySide side) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnergyTier getTier() {
|
||||
return EnergyTier.HIGH;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
package techreborn.utils;
|
||||
|
||||
import io.github.prospector.silk.fluid.FluidInstance;
|
||||
import reborncore.common.fluid.container.FluidInstance;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
|
@ -66,7 +66,7 @@ public class FluidUtils {
|
|||
FluidInstance targetFluidInstance = target.getFluidInstance(null);
|
||||
Fluid currentFluid = targetFluidInstance.getFluid();
|
||||
|
||||
if(currentFluid == Fluids.EMPTY || currentFluid == itemFluidInfo.getFluid(inputStack)) {
|
||||
if(targetFluidInstance.isEmpty() || currentFluid == itemFluidInfo.getFluid(inputStack)) {
|
||||
int freeSpace = target.getCapacity(null) - targetFluidInstance.getAmount();
|
||||
|
||||
if(!outputStack.isEmpty()){
|
||||
|
|
|
@ -37,7 +37,7 @@ import net.minecraft.util.DefaultedList;
|
|||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import reborncore.RebornRegistry;
|
||||
import reborncore.api.power.ItemPowerManager;
|
||||
import team.reborn.energy.Energy;
|
||||
import techreborn.TechReborn;
|
||||
|
||||
public class InitUtils {
|
||||
|
@ -59,8 +59,8 @@ public class InitUtils {
|
|||
public static void initPoweredItems(Item item, DefaultedList<ItemStack> itemList) {
|
||||
ItemStack uncharged = new ItemStack(item);
|
||||
ItemStack charged = new ItemStack(item);
|
||||
ItemPowerManager capEnergy = new ItemPowerManager(charged);
|
||||
capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
|
||||
|
||||
Energy.of(charged).set(Energy.of(charged).getMaxStored());
|
||||
|
||||
itemList.add(uncharged);
|
||||
itemList.add(charged);
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
"parent": "minecraft:block/cube_all",
|
||||
"textures": {
|
||||
"all": "techreborn:block/storage/osmium_storage_block"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"techreborn:aluminum_storage_block"
|
||||
]
|
||||
}
|
6
src/main/resources/data/c/tags/blocks/bauxite_ore.json
Normal file
6
src/main/resources/data/c/tags/blocks/bauxite_ore.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"techreborn:bauxite_ore"
|
||||
]
|
||||
}
|
6
src/main/resources/data/c/tags/blocks/brass_block.json
Normal file
6
src/main/resources/data/c/tags/blocks/brass_block.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"techreborn:brass_storage_block"
|
||||
]
|
||||
}
|
6
src/main/resources/data/c/tags/blocks/bronze_block.json
Normal file
6
src/main/resources/data/c/tags/blocks/bronze_block.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"techreborn:bronze_storage_block"
|
||||
]
|
||||
}
|
6
src/main/resources/data/c/tags/blocks/chrome_block.json
Normal file
6
src/main/resources/data/c/tags/blocks/chrome_block.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"techreborn:chrome_storage_block"
|
||||
]
|
||||
}
|
6
src/main/resources/data/c/tags/blocks/cinnabar_ore.json
Normal file
6
src/main/resources/data/c/tags/blocks/cinnabar_ore.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"techreborn:cinnabar_ore"
|
||||
]
|
||||
}
|
6
src/main/resources/data/c/tags/blocks/copper_block.json
Normal file
6
src/main/resources/data/c/tags/blocks/copper_block.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"techreborn:copper_storage_block"
|
||||
]
|
||||
}
|
6
src/main/resources/data/c/tags/blocks/copper_ore.json
Normal file
6
src/main/resources/data/c/tags/blocks/copper_ore.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"techreborn:copper_ore"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"techreborn:electrum_storage_block"
|
||||
]
|
||||
}
|
6
src/main/resources/data/c/tags/blocks/galena_ore.json
Normal file
6
src/main/resources/data/c/tags/blocks/galena_ore.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"techreborn:galena_ore"
|
||||
]
|
||||
}
|
6
src/main/resources/data/c/tags/blocks/invar_block.json
Normal file
6
src/main/resources/data/c/tags/blocks/invar_block.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"techreborn:invar_storage_block"
|
||||
]
|
||||
}
|
6
src/main/resources/data/c/tags/blocks/iridium_block.json
Normal file
6
src/main/resources/data/c/tags/blocks/iridium_block.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"techreborn:iridium_storage_block"
|
||||
]
|
||||
}
|
6
src/main/resources/data/c/tags/blocks/iridium_ore.json
Normal file
6
src/main/resources/data/c/tags/blocks/iridium_ore.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"techreborn:iridium_ore"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"techreborn:iridium_reinforced_stone_storage_block"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"techreborn:iridium_reinforced_tungstensteel_storage_block"
|
||||
]
|
||||
}
|
6
src/main/resources/data/c/tags/blocks/lead_block.json
Normal file
6
src/main/resources/data/c/tags/blocks/lead_block.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"techreborn:lead_storage_block"
|
||||
]
|
||||
}
|
6
src/main/resources/data/c/tags/blocks/lead_ore.json
Normal file
6
src/main/resources/data/c/tags/blocks/lead_ore.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"techreborn:lead_ore"
|
||||
]
|
||||
}
|
6
src/main/resources/data/c/tags/blocks/nickel_block.json
Normal file
6
src/main/resources/data/c/tags/blocks/nickel_block.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"techreborn:nickel_storage_block"
|
||||
]
|
||||
}
|
6
src/main/resources/data/c/tags/blocks/peridot_block.json
Normal file
6
src/main/resources/data/c/tags/blocks/peridot_block.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"techreborn:peridot_storage_block"
|
||||
]
|
||||
}
|
6
src/main/resources/data/c/tags/blocks/peridot_ore.json
Normal file
6
src/main/resources/data/c/tags/blocks/peridot_ore.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"techreborn:peridot_ore"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"techreborn:platinum_storage_block"
|
||||
]
|
||||
}
|
6
src/main/resources/data/c/tags/blocks/pyrite_ore.json
Normal file
6
src/main/resources/data/c/tags/blocks/pyrite_ore.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"techreborn:pyrite_ore"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"techreborn:red_garnet_storage_block"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"techreborn:refined_iron_storage_block"
|
||||
]
|
||||
}
|
6
src/main/resources/data/c/tags/blocks/ruby_block.json
Normal file
6
src/main/resources/data/c/tags/blocks/ruby_block.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"techreborn:ruby_storage_block"
|
||||
]
|
||||
}
|
6
src/main/resources/data/c/tags/blocks/ruby_ore.json
Normal file
6
src/main/resources/data/c/tags/blocks/ruby_ore.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"techreborn:ruby_ore"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"techreborn:sapphire_storage_block"
|
||||
]
|
||||
}
|
6
src/main/resources/data/c/tags/blocks/sapphire_ore.json
Normal file
6
src/main/resources/data/c/tags/blocks/sapphire_ore.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"techreborn:sapphire_ore"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"techreborn:sheldonite_ore"
|
||||
]
|
||||
}
|
6
src/main/resources/data/c/tags/blocks/silver_block.json
Normal file
6
src/main/resources/data/c/tags/blocks/silver_block.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"techreborn:silver_storage_block"
|
||||
]
|
||||
}
|
6
src/main/resources/data/c/tags/blocks/silver_ore.json
Normal file
6
src/main/resources/data/c/tags/blocks/silver_ore.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"techreborn:silver_ore"
|
||||
]
|
||||
}
|
6
src/main/resources/data/c/tags/blocks/sodalite_ore.json
Normal file
6
src/main/resources/data/c/tags/blocks/sodalite_ore.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"techreborn:sodalite_ore"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"techreborn:sphalerite_ore"
|
||||
]
|
||||
}
|
6
src/main/resources/data/c/tags/blocks/steel_block.json
Normal file
6
src/main/resources/data/c/tags/blocks/steel_block.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"techreborn:steel_storage_block"
|
||||
]
|
||||
}
|
6
src/main/resources/data/c/tags/blocks/tin_block.json
Normal file
6
src/main/resources/data/c/tags/blocks/tin_block.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"techreborn:tin_storage_block"
|
||||
]
|
||||
}
|
6
src/main/resources/data/c/tags/blocks/tin_ore.json
Normal file
6
src/main/resources/data/c/tags/blocks/tin_ore.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"techreborn:tin_ore"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"techreborn:titanium_storage_block"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"techreborn:tungsten_storage_block"
|
||||
]
|
||||
}
|
6
src/main/resources/data/c/tags/blocks/tungsten_ore.json
Normal file
6
src/main/resources/data/c/tags/blocks/tungsten_ore.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"techreborn:tungsten_ore"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"techreborn:tungstensteel_storage_block"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"techreborn:yellow_garnet_storage_block"
|
||||
]
|
||||
}
|
6
src/main/resources/data/c/tags/blocks/zinc_block.json
Normal file
6
src/main/resources/data/c/tags/blocks/zinc_block.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"techreborn:zinc_storage_block"
|
||||
]
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue