This commit is contained in:
parent
7e0a550811
commit
b347a67a10
11
Jenkinsfile
vendored
11
Jenkinsfile
vendored
@ -7,11 +7,20 @@ pipeline {
|
|||||||
stages {
|
stages {
|
||||||
stage('Build') {
|
stage('Build') {
|
||||||
steps {
|
steps {
|
||||||
sh './gradlew build publish'
|
sh './gradlew build javadoc publish'
|
||||||
}
|
}
|
||||||
post {
|
post {
|
||||||
success {
|
success {
|
||||||
archiveArtifacts artifacts: 'build/libs/*', fingerprint: true
|
archiveArtifacts artifacts: 'build/libs/*', fingerprint: true
|
||||||
|
|
||||||
|
publishHTML target: [
|
||||||
|
allowMissing: false,
|
||||||
|
alwaysLinkToLastBuild: false,
|
||||||
|
keepAll: false,
|
||||||
|
reportDir: 'build/docs/javadoc',
|
||||||
|
reportFiles: 'index.html',
|
||||||
|
reportName: 'JavaDoc'
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ compileJava {
|
|||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
}
|
}
|
||||||
|
|
||||||
version = project.mod_version
|
version = "${project.mod_version}+${project.minecraft_version}"
|
||||||
group = project.maven_group
|
group = project.maven_group
|
||||||
|
|
||||||
loom {
|
loom {
|
||||||
@ -90,3 +90,7 @@ task sourcesJar(type: Jar, dependsOn: classes) {
|
|||||||
jar {
|
jar {
|
||||||
from "LICENSE"
|
from "LICENSE"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
javadoc {
|
||||||
|
title "EnergonRelics v${version}"
|
||||||
|
}
|
||||||
|
5
gradle/wrapper/gradle-wrapper.properties
vendored
5
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,6 @@
|
|||||||
|
#Tue Aug 04 12:47:39 EDT 2020
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-all.zip
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-bin.zip
|
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
@ -31,7 +31,7 @@ import com.thebrokenrail.energonrelics.block.battery.BatteryCoreBlock;
|
|||||||
import com.thebrokenrail.energonrelics.block.EnergonLightBlock;
|
import com.thebrokenrail.energonrelics.block.EnergonLightBlock;
|
||||||
import com.thebrokenrail.energonrelics.block.SolarPanelBlock;
|
import com.thebrokenrail.energonrelics.block.SolarPanelBlock;
|
||||||
import com.thebrokenrail.energonrelics.block.SwitchBlock;
|
import com.thebrokenrail.energonrelics.block.SwitchBlock;
|
||||||
import com.thebrokenrail.energonrelics.block.util.SimpleBlock;
|
import com.thebrokenrail.energonrelics.api.block.SimpleBlock;
|
||||||
import com.thebrokenrail.energonrelics.item.MultimeterItem;
|
import com.thebrokenrail.energonrelics.item.MultimeterItem;
|
||||||
import com.thebrokenrail.energonrelics.item.NetworkChipItem;
|
import com.thebrokenrail.energonrelics.item.NetworkChipItem;
|
||||||
import com.thebrokenrail.energonrelics.potion.CustomPotions;
|
import com.thebrokenrail.energonrelics.potion.CustomPotions;
|
||||||
|
@ -0,0 +1,87 @@
|
|||||||
|
package com.thebrokenrail.energonrelics.api.block;
|
||||||
|
|
||||||
|
import com.thebrokenrail.energonrelics.EnergonRelics;
|
||||||
|
import net.fabricmc.loader.api.FabricLoader;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.item.BlockItem;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemGroup;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
import net.minecraft.util.Rarity;
|
||||||
|
import net.minecraft.util.registry.Registry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple Block
|
||||||
|
*/
|
||||||
|
public class SimpleBlock extends Block {
|
||||||
|
public SimpleBlock(Settings settings) {
|
||||||
|
super(settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register Block And Block Item
|
||||||
|
* @param id ID
|
||||||
|
*/
|
||||||
|
public void register(Identifier id) {
|
||||||
|
Registry.register(Registry.BLOCK, id, this);
|
||||||
|
if (registerItem()) {
|
||||||
|
Item.Settings settings = new Item.Settings();
|
||||||
|
if (addToItemGroup() || FabricLoader.getInstance().isDevelopmentEnvironment()) {
|
||||||
|
settings.group(getItemGroup());
|
||||||
|
}
|
||||||
|
if (isEpic()) {
|
||||||
|
settings.rarity(Rarity.EPIC);
|
||||||
|
}
|
||||||
|
settings.maxCount(getMaxCount());
|
||||||
|
Registry.register(Registry.ITEM, id, new BlockItem(this, settings));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register Block And Block Item
|
||||||
|
* @param name ID
|
||||||
|
*/
|
||||||
|
public final void register(String name) {
|
||||||
|
register(new Identifier(EnergonRelics.NAMESPACE, name));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Item Group To Add Block Item To
|
||||||
|
* @return Item Group
|
||||||
|
*/
|
||||||
|
protected ItemGroup getItemGroup() {
|
||||||
|
return EnergonRelics.ITEM_GROUP;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should The Block item be Added To An Item Group In A Non-Development Environment
|
||||||
|
* @return Should it Be Added
|
||||||
|
*/
|
||||||
|
protected boolean addToItemGroup() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should A Block Item Be Registered
|
||||||
|
* @return Should It Be Registered
|
||||||
|
*/
|
||||||
|
protected boolean registerItem() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Max Stack Count
|
||||||
|
* @return Max Stack Count
|
||||||
|
*/
|
||||||
|
protected int getMaxCount() {
|
||||||
|
return 64;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should The Item Rarity be Epic
|
||||||
|
* @return Should It Be Epic
|
||||||
|
*/
|
||||||
|
protected boolean isEpic() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,5 @@
|
|||||||
package com.thebrokenrail.energonrelics.block.util;
|
package com.thebrokenrail.energonrelics.api.block;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.EnergonRelics;
|
|
||||||
import net.minecraft.block.BlockEntityProvider;
|
import net.minecraft.block.BlockEntityProvider;
|
||||||
import net.minecraft.block.entity.BlockEntity;
|
import net.minecraft.block.entity.BlockEntity;
|
||||||
import net.minecraft.block.entity.BlockEntityType;
|
import net.minecraft.block.entity.BlockEntityType;
|
||||||
@ -10,6 +9,9 @@ import net.minecraft.world.BlockView;
|
|||||||
|
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple Block With Entity
|
||||||
|
*/
|
||||||
public abstract class SimpleBlockWithEntity extends SimpleBlock implements BlockEntityProvider {
|
public abstract class SimpleBlockWithEntity extends SimpleBlock implements BlockEntityProvider {
|
||||||
protected BlockEntityType<BlockEntity> type;
|
protected BlockEntityType<BlockEntity> type;
|
||||||
|
|
||||||
@ -18,11 +20,15 @@ public abstract class SimpleBlockWithEntity extends SimpleBlock implements Block
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void register(String name) {
|
public void register(Identifier id) {
|
||||||
super.register(name);
|
super.register(id);
|
||||||
type = Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier(EnergonRelics.NAMESPACE, name), BlockEntityType.Builder.create(() -> getFactory().apply(type), this).build(null));
|
type = Registry.register(Registry.BLOCK_ENTITY_TYPE, id, BlockEntityType.Builder.create(() -> getFactory().apply(type), this).build(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Factory To Create Block Entity
|
||||||
|
* @return Block Entity Factory
|
||||||
|
*/
|
||||||
protected abstract Function<BlockEntityType<BlockEntity>, BlockEntity> getFactory();
|
protected abstract Function<BlockEntityType<BlockEntity>, BlockEntity> getFactory();
|
||||||
|
|
||||||
@Override
|
@Override
|
@ -1,9 +1,9 @@
|
|||||||
package com.thebrokenrail.energonrelics.block.util.energy;
|
package com.thebrokenrail.energonrelics.api.block.energy;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.EnergonRelics;
|
import com.thebrokenrail.energonrelics.EnergonRelics;
|
||||||
import com.thebrokenrail.energonrelics.block.util.SimpleBlockWithEntity;
|
import com.thebrokenrail.energonrelics.api.block.SimpleBlockWithEntity;
|
||||||
|
import com.thebrokenrail.energonrelics.api.block.entity.core.EnergyProviderBlockEntity;
|
||||||
import com.thebrokenrail.energonrelics.client.block.entity.render.HighlightBlockEntityRenderer;
|
import com.thebrokenrail.energonrelics.client.block.entity.render.HighlightBlockEntityRenderer;
|
||||||
import com.thebrokenrail.energonrelics.energy.core.EnergyProviderBlockEntity;
|
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
import net.fabricmc.fabric.api.client.rendereregistry.v1.BlockEntityRendererRegistry;
|
import net.fabricmc.fabric.api.client.rendereregistry.v1.BlockEntityRendererRegistry;
|
||||||
@ -17,6 +17,7 @@ import net.minecraft.loot.context.LootContext;
|
|||||||
import net.minecraft.loot.context.LootContextParameters;
|
import net.minecraft.loot.context.LootContextParameters;
|
||||||
import net.minecraft.util.ActionResult;
|
import net.minecraft.util.ActionResult;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.hit.BlockHitResult;
|
import net.minecraft.util.hit.BlockHitResult;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
@ -25,6 +26,9 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Block That Interacts With Energy
|
||||||
|
*/
|
||||||
public abstract class EnergyBlock extends SimpleBlockWithEntity {
|
public abstract class EnergyBlock extends SimpleBlockWithEntity {
|
||||||
private static final List<EnergyBlock> blocks = new ArrayList<>();
|
private static final List<EnergyBlock> blocks = new ArrayList<>();
|
||||||
|
|
||||||
@ -33,8 +37,8 @@ public abstract class EnergyBlock extends SimpleBlockWithEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void register(String name) {
|
public void register(Identifier id) {
|
||||||
super.register(name);
|
super.register(id);
|
||||||
blocks.add(this);
|
blocks.add(this);
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.thebrokenrail.energonrelics.block.util.energy;
|
package com.thebrokenrail.energonrelics.api.block.energy;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
@ -10,6 +10,9 @@ import net.minecraft.util.BlockMirror;
|
|||||||
import net.minecraft.util.BlockRotation;
|
import net.minecraft.util.BlockRotation;
|
||||||
import net.minecraft.util.math.Direction;
|
import net.minecraft.util.math.Direction;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Block That Interacts With Energy That Faces A Direction
|
||||||
|
*/
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public abstract class FacingEnergyBlock extends EnergyBlock {
|
public abstract class FacingEnergyBlock extends EnergyBlock {
|
||||||
public static final DirectionProperty FACING = Properties.FACING;
|
public static final DirectionProperty FACING = Properties.FACING;
|
@ -1,11 +1,11 @@
|
|||||||
package com.thebrokenrail.energonrelics.energy.core;
|
package com.thebrokenrail.energonrelics.api.block.entity.core;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.config.HardcodedConfig;
|
|
||||||
import com.thebrokenrail.energonrelics.EnergonRelics;
|
import com.thebrokenrail.energonrelics.EnergonRelics;
|
||||||
|
import com.thebrokenrail.energonrelics.api.energy.Action;
|
||||||
import com.thebrokenrail.energonrelics.component.NetworkComponent;
|
import com.thebrokenrail.energonrelics.component.NetworkComponent;
|
||||||
import com.thebrokenrail.energonrelics.energy.core.util.Action;
|
import com.thebrokenrail.energonrelics.config.HardcodedConfig;
|
||||||
import com.thebrokenrail.energonrelics.energy.core.util.EnergyTickable;
|
import com.thebrokenrail.energonrelics.api.energy.tick.EnergyTickable;
|
||||||
import com.thebrokenrail.energonrelics.energy.core.util.EnergyTicker;
|
import com.thebrokenrail.energonrelics.api.energy.tick.EnergyTicker;
|
||||||
import com.thebrokenrail.energonrelics.util.BlockPosWithDimension;
|
import com.thebrokenrail.energonrelics.util.BlockPosWithDimension;
|
||||||
import net.fabricmc.fabric.api.block.entity.BlockEntityClientSerializable;
|
import net.fabricmc.fabric.api.block.entity.BlockEntityClientSerializable;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
@ -25,11 +25,18 @@ import java.util.Collections;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Block Entity That Provides Energy
|
||||||
|
*/
|
||||||
public class EnergyProviderBlockEntity extends BlockEntity implements BlockEntityClientSerializable, Tickable, EnergyTickable {
|
public class EnergyProviderBlockEntity extends BlockEntity implements BlockEntityClientSerializable, Tickable, EnergyTickable {
|
||||||
public EnergyProviderBlockEntity(BlockEntityType<?> type) {
|
public EnergyProviderBlockEntity(BlockEntityType<?> type) {
|
||||||
super(type);
|
super(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Give Propagated Action To This Block
|
||||||
|
* @param action Action
|
||||||
|
*/
|
||||||
public final void addPropagatedAction(Action.PropagatedAction action) {
|
public final void addPropagatedAction(Action.PropagatedAction action) {
|
||||||
if (isEnergyProvider()) {
|
if (isEnergyProvider()) {
|
||||||
handlePropagatedAction(action);
|
handlePropagatedAction(action);
|
||||||
@ -38,14 +45,28 @@ public class EnergyProviderBlockEntity extends BlockEntity implements BlockEntit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is In Energy Network
|
||||||
|
* @param network Network ID
|
||||||
|
* @return If Is In Network
|
||||||
|
*/
|
||||||
public final boolean isNetwork(int network) {
|
public final boolean isNetwork(int network) {
|
||||||
return isEnergyProvider() && EnergonRelics.NETWORK_CHIP_ITEM.getID(stack) == network;
|
return isEnergyProvider() && EnergonRelics.NETWORK_CHIP_ITEM.getID(stack) == network;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is Within Valid Distance Of Position
|
||||||
|
* @param pos Position
|
||||||
|
* @return Is Within Distance
|
||||||
|
*/
|
||||||
public final boolean isWithinDistance(Vec3d pos) {
|
public final boolean isWithinDistance(Vec3d pos) {
|
||||||
return getPos().isWithinDistance(pos, HardcodedConfig.POWER_RANGE);
|
return getPos().isWithinDistance(pos, HardcodedConfig.POWER_RANGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Current Dimension
|
||||||
|
* @return Current Dimension
|
||||||
|
*/
|
||||||
public RegistryKey<World> getRegistryKey() {
|
public RegistryKey<World> getRegistryKey() {
|
||||||
return Objects.requireNonNull(getWorld()).getRegistryKey();
|
return Objects.requireNonNull(getWorld()).getRegistryKey();
|
||||||
}
|
}
|
||||||
@ -71,10 +92,18 @@ public class EnergyProviderBlockEntity extends BlockEntity implements BlockEntit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should Behave As Energy Provider
|
||||||
|
* @return Is Energy Provider
|
||||||
|
*/
|
||||||
public boolean isEnergyProvider() {
|
public boolean isEnergyProvider() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Override To Handle Propagated Action
|
||||||
|
* @param action Propagated Action
|
||||||
|
*/
|
||||||
protected void handlePropagatedAction(Action.PropagatedAction action) {
|
protected void handlePropagatedAction(Action.PropagatedAction action) {
|
||||||
if (!isEnergyProvider()) {
|
if (!isEnergyProvider()) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
@ -115,6 +144,11 @@ public class EnergyProviderBlockEntity extends BlockEntity implements BlockEntit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Take Network Chip Item Stack
|
||||||
|
* @param world World
|
||||||
|
* @return Item Stack
|
||||||
|
*/
|
||||||
public ItemStack takeStack(World world) {
|
public ItemStack takeStack(World world) {
|
||||||
ItemStack newStack = stack.copy();
|
ItemStack newStack = stack.copy();
|
||||||
setEnergyProviderSource(world, getPos(), newStack, true);
|
setEnergyProviderSource(world, getPos(), newStack, true);
|
||||||
@ -123,12 +157,21 @@ public class EnergyProviderBlockEntity extends BlockEntity implements BlockEntit
|
|||||||
return newStack;
|
return newStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Place Network Chip Item Stack
|
||||||
|
* @param newStack Item Stack
|
||||||
|
* @param world World
|
||||||
|
*/
|
||||||
public void placeStack(ItemStack newStack, World world) {
|
public void placeStack(ItemStack newStack, World world) {
|
||||||
setEnergyProviderSource(world, getPos(), newStack, false);
|
setEnergyProviderSource(world, getPos(), newStack, false);
|
||||||
stack = newStack.copy();
|
stack = newStack.copy();
|
||||||
markDirty();
|
markDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Has Item Stack
|
||||||
|
* @return Has Item Stack
|
||||||
|
*/
|
||||||
public boolean hasStack() {
|
public boolean hasStack() {
|
||||||
return !stack.isEmpty();
|
return !stack.isEmpty();
|
||||||
}
|
}
|
@ -1,8 +1,8 @@
|
|||||||
package com.thebrokenrail.energonrelics.energy.core;
|
package com.thebrokenrail.energonrelics.api.block.entity.core;
|
||||||
|
|
||||||
|
import com.thebrokenrail.energonrelics.api.energy.Action;
|
||||||
import com.thebrokenrail.energonrelics.component.NetworkComponent;
|
import com.thebrokenrail.energonrelics.component.NetworkComponent;
|
||||||
import com.thebrokenrail.energonrelics.energy.core.util.Action;
|
import com.thebrokenrail.energonrelics.api.energy.tick.EnergyTickable;
|
||||||
import com.thebrokenrail.energonrelics.energy.core.util.EnergyTickable;
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.entity.BlockEntityType;
|
import net.minecraft.block.entity.BlockEntityType;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
@ -14,6 +14,9 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Block Entity That Receives Energy
|
||||||
|
*/
|
||||||
public abstract class EnergyReceiverBlockEntity extends EnergyProviderBlockEntity {
|
public abstract class EnergyReceiverBlockEntity extends EnergyProviderBlockEntity {
|
||||||
public EnergyReceiverBlockEntity(BlockEntityType<?> type) {
|
public EnergyReceiverBlockEntity(BlockEntityType<?> type) {
|
||||||
super(type);
|
super(type);
|
||||||
@ -27,10 +30,19 @@ public abstract class EnergyReceiverBlockEntity extends EnergyProviderBlockEntit
|
|||||||
|
|
||||||
private final List<Action.PropagatedAction> sent = new ArrayList<>();
|
private final List<Action.PropagatedAction> sent = new ArrayList<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If The Specified Action Has Been Sent By This Block this Tick
|
||||||
|
* @param action Action
|
||||||
|
* @return If It Was Sent
|
||||||
|
*/
|
||||||
protected boolean hasSent(Action.PropagatedAction action) {
|
protected boolean hasSent(Action.PropagatedAction action) {
|
||||||
return sent.contains(action);
|
return sent.contains(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Propagate Action To The Network's Energy Providers
|
||||||
|
* @param action Propagated Action
|
||||||
|
*/
|
||||||
protected void propagateAction(Action.PropagatedAction action) {
|
protected void propagateAction(Action.PropagatedAction action) {
|
||||||
sent.add(action);
|
sent.add(action);
|
||||||
|
|
||||||
@ -45,6 +57,10 @@ public abstract class EnergyReceiverBlockEntity extends EnergyProviderBlockEntit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert Action To A Propagated Action And Then Propagate It
|
||||||
|
* @param action Action
|
||||||
|
*/
|
||||||
protected void addAction(Action action) {
|
protected void addAction(Action action) {
|
||||||
propagateAction(new Action.PropagatedActionImpl(action, getWorld(), getPos(), getCachedState()));
|
propagateAction(new Action.PropagatedActionImpl(action, getWorld(), getPos(), getCachedState()));
|
||||||
}
|
}
|
||||||
@ -89,6 +105,10 @@ public abstract class EnergyReceiverBlockEntity extends EnergyProviderBlockEntit
|
|||||||
getWorld().getProfiler().pop();
|
getWorld().getProfiler().pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Total Cost In Energon
|
||||||
|
* @return Cost
|
||||||
|
*/
|
||||||
public long getTotalCost() {
|
public long getTotalCost() {
|
||||||
return previousTotalCost;
|
return previousTotalCost;
|
||||||
}
|
}
|
||||||
@ -110,8 +130,15 @@ public abstract class EnergyReceiverBlockEntity extends EnergyProviderBlockEntit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create And Propagate Actions
|
||||||
|
*/
|
||||||
protected abstract void energyTick();
|
protected abstract void energyTick();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggle If This Is In The Specified Network
|
||||||
|
* @param network Network ID
|
||||||
|
*/
|
||||||
public void toggle(int network) {
|
public void toggle(int network) {
|
||||||
if (contains(network)) {
|
if (contains(network)) {
|
||||||
networks.removeAll(Collections.singletonList(network));
|
networks.removeAll(Collections.singletonList(network));
|
||||||
@ -121,6 +148,11 @@ public abstract class EnergyReceiverBlockEntity extends EnergyProviderBlockEntit
|
|||||||
markDirty();
|
markDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check If The Specified Network Contains This Block
|
||||||
|
* @param network Network ID
|
||||||
|
* @return If It Contains This Block
|
||||||
|
*/
|
||||||
public boolean contains(int network) {
|
public boolean contains(int network) {
|
||||||
return networks.contains(network);
|
return networks.contains(network);
|
||||||
}
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
package com.thebrokenrail.energonrelics.api.block.entity.helper;
|
||||||
|
|
||||||
|
import com.thebrokenrail.energonrelics.api.energy.Action;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface Of A Block That Generates Energy
|
||||||
|
*/
|
||||||
|
public interface EnergyGenerator {
|
||||||
|
/**
|
||||||
|
* Handle Propagated Action
|
||||||
|
* @param action Action
|
||||||
|
*/
|
||||||
|
default void handlePropagatedActionWithGenerator(Action.PropagatedAction action) {
|
||||||
|
long amount = Math.min(getEnergy(), action.amountOwed());
|
||||||
|
setEnergy(getEnergy() - amount);
|
||||||
|
action.pay(amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Current Energy level
|
||||||
|
* @return Energy Level
|
||||||
|
*/
|
||||||
|
long getEnergy();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set New Energy Level
|
||||||
|
* @param value New Energy Level
|
||||||
|
*/
|
||||||
|
void setEnergy(long value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Energy To Be Displayed On Multimeter
|
||||||
|
* @return Energy Level
|
||||||
|
*/
|
||||||
|
long getDisplayEnergy();
|
||||||
|
}
|
@ -1,9 +1,12 @@
|
|||||||
package com.thebrokenrail.energonrelics.energy.helper;
|
package com.thebrokenrail.energonrelics.api.block.entity.helper;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.energy.core.EnergyProviderBlockEntity;
|
import com.thebrokenrail.energonrelics.api.block.entity.core.EnergyProviderBlockEntity;
|
||||||
import com.thebrokenrail.energonrelics.energy.core.util.Action;
|
import com.thebrokenrail.energonrelics.api.energy.Action;
|
||||||
import net.minecraft.block.entity.BlockEntityType;
|
import net.minecraft.block.entity.BlockEntityType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple Implementation Of A Energy Generator
|
||||||
|
*/
|
||||||
public abstract class EnergyGeneratorBlockEntity extends EnergyProviderBlockEntity implements EnergyGenerator {
|
public abstract class EnergyGeneratorBlockEntity extends EnergyProviderBlockEntity implements EnergyGenerator {
|
||||||
public EnergyGeneratorBlockEntity(BlockEntityType<?> type) {
|
public EnergyGeneratorBlockEntity(BlockEntityType<?> type) {
|
||||||
super(type);
|
super(type);
|
@ -1,10 +1,13 @@
|
|||||||
package com.thebrokenrail.energonrelics.energy.core.util;
|
package com.thebrokenrail.energonrelics.api.energy;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.state.property.Property;
|
import net.minecraft.state.property.Property;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action That Can Be Performed With Energy
|
||||||
|
*/
|
||||||
public class Action {
|
public class Action {
|
||||||
public interface ActionFunction {
|
public interface ActionFunction {
|
||||||
void run(World world, BlockPos pos, BlockState state);
|
void run(World world, BlockPos pos, BlockState state);
|
||||||
@ -14,12 +17,27 @@ public class Action {
|
|||||||
private final ActionFunction success;
|
private final ActionFunction success;
|
||||||
private final ActionFunction fail;
|
private final ActionFunction fail;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create Action
|
||||||
|
* @param cost Cost In Energon
|
||||||
|
* @param success Success Function
|
||||||
|
* @param fail Failure Function
|
||||||
|
*/
|
||||||
public Action(long cost, ActionFunction success, ActionFunction fail) {
|
public Action(long cost, ActionFunction success, ActionFunction fail) {
|
||||||
this.cost = cost;
|
this.cost = cost;
|
||||||
this.success = success;
|
this.success = success;
|
||||||
this.fail = fail;
|
this.fail = fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create Action That Changes Block State Property
|
||||||
|
* @param cost Cost In Energon
|
||||||
|
* @param property Block State Property
|
||||||
|
* @param successValue Value To Set On Success
|
||||||
|
* @param failureValue Value To Set On Failure
|
||||||
|
* @param <T> Block State Property Type
|
||||||
|
* @return New Action
|
||||||
|
*/
|
||||||
public static <T extends Comparable<T>> Action createBlockStatePropertyAction(long cost, Property<T> property, T successValue, T failureValue) {
|
public static <T extends Comparable<T>> Action createBlockStatePropertyAction(long cost, Property<T> property, T successValue, T failureValue) {
|
||||||
return new Action(cost, (world, pos, state) -> {
|
return new Action(cost, (world, pos, state) -> {
|
||||||
if (state.contains(property) && !state.get(property).equals(successValue)) {
|
if (state.contains(property) && !state.get(property).equals(successValue)) {
|
||||||
@ -32,6 +50,9 @@ public class Action {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action That Has Been Propagated
|
||||||
|
*/
|
||||||
public interface PropagatedAction {
|
public interface PropagatedAction {
|
||||||
void expandPayments(int amount);
|
void expandPayments(int amount);
|
||||||
long amountOwed();
|
long amountOwed();
|
@ -0,0 +1,23 @@
|
|||||||
|
package com.thebrokenrail.energonrelics.api.energy.tick;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Energy Tickable
|
||||||
|
*/
|
||||||
|
public interface EnergyTickable {
|
||||||
|
/**
|
||||||
|
* Start Tick
|
||||||
|
* @return Other Objects To Tick
|
||||||
|
*/
|
||||||
|
List<EnergyTickable> startTick();
|
||||||
|
/**
|
||||||
|
* Logic Tick
|
||||||
|
*/
|
||||||
|
void logicTick();
|
||||||
|
/**
|
||||||
|
* Get ID
|
||||||
|
* @return ID
|
||||||
|
*/
|
||||||
|
String getID();
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package com.thebrokenrail.energonrelics.energy.core.util;
|
package com.thebrokenrail.energonrelics.api.energy.tick;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.EnergonRelics;
|
import com.thebrokenrail.energonrelics.EnergonRelics;
|
||||||
import com.thebrokenrail.energonrelics.component.NetworkComponent;
|
import com.thebrokenrail.energonrelics.component.NetworkComponent;
|
||||||
@ -10,13 +10,24 @@ import java.util.Collections;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Energy Ticker
|
||||||
|
*/
|
||||||
public class EnergyTicker {
|
public class EnergyTicker {
|
||||||
private static final List<EnergyTickable> scheduled = new ArrayList<>();
|
private static final List<EnergyTickable> scheduled = new ArrayList<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Schedule For Next Energy Tick
|
||||||
|
* @param tickable Object To Tick
|
||||||
|
*/
|
||||||
public static void schedule(EnergyTickable tickable) {
|
public static void schedule(EnergyTickable tickable) {
|
||||||
scheduled.add(tickable);
|
scheduled.add(tickable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tick Energy
|
||||||
|
* @param world World
|
||||||
|
*/
|
||||||
public static void tick(World world) {
|
public static void tick(World world) {
|
||||||
if (Objects.requireNonNull(world.getServer()).getThread() == Thread.currentThread()) {
|
if (Objects.requireNonNull(world.getServer()).getThread() == Thread.currentThread()) {
|
||||||
world.getProfiler().push(EnergonRelics.NAMESPACE);
|
world.getProfiler().push(EnergonRelics.NAMESPACE);
|
@ -1,7 +1,7 @@
|
|||||||
package com.thebrokenrail.energonrelics.block;
|
package com.thebrokenrail.energonrelics.block;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.block.entity.BlockBreakerBlockEntity;
|
import com.thebrokenrail.energonrelics.block.entity.BlockBreakerBlockEntity;
|
||||||
import com.thebrokenrail.energonrelics.block.util.energy.FacingEnergyBlock;
|
import com.thebrokenrail.energonrelics.api.block.energy.FacingEnergyBlock;
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.thebrokenrail.energonrelics.block;
|
package com.thebrokenrail.energonrelics.block;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.block.entity.CreativeEnergySourceBlockEntity;
|
import com.thebrokenrail.energonrelics.block.entity.CreativeEnergySourceBlockEntity;
|
||||||
import com.thebrokenrail.energonrelics.block.util.energy.EnergyBlock;
|
import com.thebrokenrail.energonrelics.api.block.energy.EnergyBlock;
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
import net.minecraft.block.Blocks;
|
import net.minecraft.block.Blocks;
|
||||||
import net.minecraft.block.entity.BlockEntity;
|
import net.minecraft.block.entity.BlockEntity;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.thebrokenrail.energonrelics.block;
|
package com.thebrokenrail.energonrelics.block;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.block.entity.DefensiveLaserBlockEntity;
|
import com.thebrokenrail.energonrelics.block.entity.DefensiveLaserBlockEntity;
|
||||||
import com.thebrokenrail.energonrelics.block.util.energy.EnergyBlock;
|
import com.thebrokenrail.energonrelics.api.block.energy.EnergyBlock;
|
||||||
import com.thebrokenrail.energonrelics.client.block.entity.render.DefensiveLaserBlockEntityRenderer;
|
import com.thebrokenrail.energonrelics.client.block.entity.render.DefensiveLaserBlockEntityRenderer;
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.thebrokenrail.energonrelics.block;
|
package com.thebrokenrail.energonrelics.block;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.block.entity.EnergonLightBlockEntity;
|
import com.thebrokenrail.energonrelics.block.entity.EnergonLightBlockEntity;
|
||||||
import com.thebrokenrail.energonrelics.block.util.energy.EnergyBlock;
|
import com.thebrokenrail.energonrelics.api.block.energy.EnergyBlock;
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.thebrokenrail.energonrelics.block;
|
package com.thebrokenrail.energonrelics.block;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.block.entity.HolographicSkyBlockEntity;
|
import com.thebrokenrail.energonrelics.block.entity.HolographicSkyBlockEntity;
|
||||||
import com.thebrokenrail.energonrelics.block.util.energy.EnergyBlock;
|
import com.thebrokenrail.energonrelics.api.block.energy.EnergyBlock;
|
||||||
import com.thebrokenrail.energonrelics.client.block.entity.render.HolographicSkyBlockEntityRenderer;
|
import com.thebrokenrail.energonrelics.client.block.entity.render.HolographicSkyBlockEntityRenderer;
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.thebrokenrail.energonrelics.block;
|
package com.thebrokenrail.energonrelics.block;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.block.entity.infuser.InfuserBlockEntity;
|
import com.thebrokenrail.energonrelics.block.entity.infuser.InfuserBlockEntity;
|
||||||
import com.thebrokenrail.energonrelics.block.util.energy.EnergyBlock;
|
import com.thebrokenrail.energonrelics.api.block.energy.EnergyBlock;
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.thebrokenrail.energonrelics.block;
|
package com.thebrokenrail.energonrelics.block;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.block.entity.SolarPanelBlockEntity;
|
import com.thebrokenrail.energonrelics.block.entity.SolarPanelBlockEntity;
|
||||||
import com.thebrokenrail.energonrelics.block.util.energy.EnergyBlock;
|
import com.thebrokenrail.energonrelics.api.block.energy.EnergyBlock;
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
import net.minecraft.block.Material;
|
import net.minecraft.block.Material;
|
||||||
import net.minecraft.block.MaterialColor;
|
import net.minecraft.block.MaterialColor;
|
||||||
|
@ -1,16 +1,13 @@
|
|||||||
package com.thebrokenrail.energonrelics.block;
|
package com.thebrokenrail.energonrelics.block;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.block.entity.SwitchBlockEntity;
|
import com.thebrokenrail.energonrelics.block.entity.SwitchBlockEntity;
|
||||||
import com.thebrokenrail.energonrelics.block.util.energy.EnergyBlock;
|
import com.thebrokenrail.energonrelics.api.block.energy.EnergyBlock;
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.Material;
|
import net.minecraft.block.Material;
|
||||||
import net.minecraft.block.entity.BlockEntity;
|
import net.minecraft.block.entity.BlockEntity;
|
||||||
import net.minecraft.block.entity.BlockEntityType;
|
import net.minecraft.block.entity.BlockEntityType;
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
import net.minecraft.entity.ItemEntity;
|
|
||||||
import net.minecraft.fluid.WaterFluid;
|
|
||||||
import net.minecraft.item.ItemPlacementContext;
|
import net.minecraft.item.ItemPlacementContext;
|
||||||
import net.minecraft.server.world.ServerWorld;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
import net.minecraft.state.StateManager;
|
import net.minecraft.state.StateManager;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.thebrokenrail.energonrelics.block.battery;
|
package com.thebrokenrail.energonrelics.block.battery;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.block.entity.battery.ActiveBatteryControllerBlockEntity;
|
import com.thebrokenrail.energonrelics.block.entity.battery.ActiveBatteryControllerBlockEntity;
|
||||||
import com.thebrokenrail.energonrelics.block.util.energy.FacingEnergyBlock;
|
import com.thebrokenrail.energonrelics.api.block.energy.FacingEnergyBlock;
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
import net.minecraft.block.Material;
|
import net.minecraft.block.Material;
|
||||||
import net.minecraft.block.MaterialColor;
|
import net.minecraft.block.MaterialColor;
|
||||||
|
@ -2,7 +2,7 @@ package com.thebrokenrail.energonrelics.block.battery;
|
|||||||
|
|
||||||
import com.thebrokenrail.energonrelics.EnergonRelics;
|
import com.thebrokenrail.energonrelics.EnergonRelics;
|
||||||
import com.thebrokenrail.energonrelics.block.entity.battery.BatteryCoreBlockEntity;
|
import com.thebrokenrail.energonrelics.block.entity.battery.BatteryCoreBlockEntity;
|
||||||
import com.thebrokenrail.energonrelics.block.util.SimpleBlockWithEntity;
|
import com.thebrokenrail.energonrelics.api.block.SimpleBlockWithEntity;
|
||||||
import com.thebrokenrail.energonrelics.item.MultimeterItem;
|
import com.thebrokenrail.energonrelics.item.MultimeterItem;
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.thebrokenrail.energonrelics.block.battery;
|
package com.thebrokenrail.energonrelics.block.battery;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.block.entity.battery.PassiveBatteryControllerBlockEntity;
|
import com.thebrokenrail.energonrelics.block.entity.battery.PassiveBatteryControllerBlockEntity;
|
||||||
import com.thebrokenrail.energonrelics.block.util.energy.FacingEnergyBlock;
|
import com.thebrokenrail.energonrelics.api.block.energy.FacingEnergyBlock;
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
import net.minecraft.block.Material;
|
import net.minecraft.block.Material;
|
||||||
import net.minecraft.block.MaterialColor;
|
import net.minecraft.block.MaterialColor;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package com.thebrokenrail.energonrelics.block.entity;
|
package com.thebrokenrail.energonrelics.block.entity;
|
||||||
|
|
||||||
|
import com.thebrokenrail.energonrelics.api.block.entity.core.EnergyReceiverBlockEntity;
|
||||||
|
import com.thebrokenrail.energonrelics.api.energy.Action;
|
||||||
import com.thebrokenrail.energonrelics.block.BlockBreakerBlock;
|
import com.thebrokenrail.energonrelics.block.BlockBreakerBlock;
|
||||||
import com.thebrokenrail.energonrelics.config.HardcodedConfig;
|
import com.thebrokenrail.energonrelics.config.HardcodedConfig;
|
||||||
import com.thebrokenrail.energonrelics.energy.core.EnergyReceiverBlockEntity;
|
|
||||||
import com.thebrokenrail.energonrelics.energy.core.util.Action;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.entity.BlockEntityType;
|
import net.minecraft.block.entity.BlockEntityType;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.thebrokenrail.energonrelics.block.entity;
|
package com.thebrokenrail.energonrelics.block.entity;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.energy.core.util.EnergyTickable;
|
import com.thebrokenrail.energonrelics.api.block.entity.helper.EnergyGeneratorBlockEntity;
|
||||||
import com.thebrokenrail.energonrelics.energy.helper.EnergyGeneratorBlockEntity;
|
import com.thebrokenrail.energonrelics.api.energy.tick.EnergyTickable;
|
||||||
import net.minecraft.block.entity.BlockEntityType;
|
import net.minecraft.block.entity.BlockEntityType;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package com.thebrokenrail.energonrelics.block.entity;
|
package com.thebrokenrail.energonrelics.block.entity;
|
||||||
|
|
||||||
|
import com.thebrokenrail.energonrelics.api.block.entity.core.EnergyReceiverBlockEntity;
|
||||||
|
import com.thebrokenrail.energonrelics.api.energy.Action;
|
||||||
import com.thebrokenrail.energonrelics.config.HardcodedConfig;
|
import com.thebrokenrail.energonrelics.config.HardcodedConfig;
|
||||||
import com.thebrokenrail.energonrelics.EnergonRelics;
|
import com.thebrokenrail.energonrelics.EnergonRelics;
|
||||||
import com.thebrokenrail.energonrelics.block.DefensiveLaserBlock;
|
import com.thebrokenrail.energonrelics.block.DefensiveLaserBlock;
|
||||||
import com.thebrokenrail.energonrelics.energy.core.EnergyReceiverBlockEntity;
|
|
||||||
import com.thebrokenrail.energonrelics.energy.core.util.Action;
|
|
||||||
import com.thebrokenrail.energonrelics.mixin.DamageSourceAccessor;
|
import com.thebrokenrail.energonrelics.mixin.DamageSourceAccessor;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.entity.BlockEntityType;
|
import net.minecraft.block.entity.BlockEntityType;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package com.thebrokenrail.energonrelics.block.entity;
|
package com.thebrokenrail.energonrelics.block.entity;
|
||||||
|
|
||||||
|
import com.thebrokenrail.energonrelics.api.block.entity.core.EnergyReceiverBlockEntity;
|
||||||
|
import com.thebrokenrail.energonrelics.api.energy.Action;
|
||||||
import com.thebrokenrail.energonrelics.config.HardcodedConfig;
|
import com.thebrokenrail.energonrelics.config.HardcodedConfig;
|
||||||
import com.thebrokenrail.energonrelics.block.EnergonLightBlock;
|
import com.thebrokenrail.energonrelics.block.EnergonLightBlock;
|
||||||
import com.thebrokenrail.energonrelics.energy.core.EnergyReceiverBlockEntity;
|
|
||||||
import com.thebrokenrail.energonrelics.energy.core.util.Action;
|
|
||||||
import net.minecraft.block.entity.BlockEntityType;
|
import net.minecraft.block.entity.BlockEntityType;
|
||||||
|
|
||||||
public class EnergonLightBlockEntity extends EnergyReceiverBlockEntity {
|
public class EnergonLightBlockEntity extends EnergyReceiverBlockEntity {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package com.thebrokenrail.energonrelics.block.entity;
|
package com.thebrokenrail.energonrelics.block.entity;
|
||||||
|
|
||||||
|
import com.thebrokenrail.energonrelics.api.block.entity.core.EnergyReceiverBlockEntity;
|
||||||
|
import com.thebrokenrail.energonrelics.api.energy.Action;
|
||||||
import com.thebrokenrail.energonrelics.block.HolographicSkyBlock;
|
import com.thebrokenrail.energonrelics.block.HolographicSkyBlock;
|
||||||
import com.thebrokenrail.energonrelics.config.HardcodedConfig;
|
import com.thebrokenrail.energonrelics.config.HardcodedConfig;
|
||||||
import com.thebrokenrail.energonrelics.energy.core.EnergyReceiverBlockEntity;
|
|
||||||
import com.thebrokenrail.energonrelics.energy.core.util.Action;
|
|
||||||
import net.minecraft.block.entity.BlockEntityType;
|
import net.minecraft.block.entity.BlockEntityType;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.LightType;
|
import net.minecraft.world.LightType;
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package com.thebrokenrail.energonrelics.block.entity;
|
package com.thebrokenrail.energonrelics.block.entity;
|
||||||
|
|
||||||
|
import com.thebrokenrail.energonrelics.api.block.entity.core.EnergyProviderBlockEntity;
|
||||||
|
import com.thebrokenrail.energonrelics.api.block.entity.helper.EnergyGenerator;
|
||||||
|
import com.thebrokenrail.energonrelics.api.energy.Action;
|
||||||
import com.thebrokenrail.energonrelics.config.HardcodedConfig;
|
import com.thebrokenrail.energonrelics.config.HardcodedConfig;
|
||||||
import com.thebrokenrail.energonrelics.energy.core.EnergyProviderBlockEntity;
|
import com.thebrokenrail.energonrelics.api.energy.tick.EnergyTickable;
|
||||||
import com.thebrokenrail.energonrelics.energy.core.util.Action;
|
|
||||||
import com.thebrokenrail.energonrelics.energy.core.util.EnergyTickable;
|
|
||||||
import com.thebrokenrail.energonrelics.energy.helper.EnergyGenerator;
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.entity.BlockEntityType;
|
import net.minecraft.block.entity.BlockEntityType;
|
||||||
import net.minecraft.entity.EntityType;
|
import net.minecraft.entity.EntityType;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.thebrokenrail.energonrelics.block.entity;
|
package com.thebrokenrail.energonrelics.block.entity;
|
||||||
|
|
||||||
|
import com.thebrokenrail.energonrelics.api.block.entity.helper.EnergyGeneratorBlockEntity;
|
||||||
import com.thebrokenrail.energonrelics.config.HardcodedConfig;
|
import com.thebrokenrail.energonrelics.config.HardcodedConfig;
|
||||||
import com.thebrokenrail.energonrelics.energy.core.util.EnergyTickable;
|
import com.thebrokenrail.energonrelics.api.energy.tick.EnergyTickable;
|
||||||
import com.thebrokenrail.energonrelics.energy.helper.EnergyGeneratorBlockEntity;
|
|
||||||
import net.minecraft.block.entity.BlockEntityType;
|
import net.minecraft.block.entity.BlockEntityType;
|
||||||
import net.minecraft.util.math.Direction;
|
import net.minecraft.util.math.Direction;
|
||||||
import net.minecraft.world.LightType;
|
import net.minecraft.world.LightType;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.thebrokenrail.energonrelics.block.entity;
|
package com.thebrokenrail.energonrelics.block.entity;
|
||||||
|
|
||||||
|
import com.thebrokenrail.energonrelics.api.block.entity.core.EnergyReceiverBlockEntity;
|
||||||
|
import com.thebrokenrail.energonrelics.api.energy.Action;
|
||||||
import com.thebrokenrail.energonrelics.block.SwitchBlock;
|
import com.thebrokenrail.energonrelics.block.SwitchBlock;
|
||||||
import com.thebrokenrail.energonrelics.energy.core.EnergyReceiverBlockEntity;
|
|
||||||
import com.thebrokenrail.energonrelics.energy.core.util.Action;
|
|
||||||
import net.minecraft.block.entity.BlockEntityType;
|
import net.minecraft.block.entity.BlockEntityType;
|
||||||
|
|
||||||
public class SwitchBlockEntity extends EnergyReceiverBlockEntity {
|
public class SwitchBlockEntity extends EnergyReceiverBlockEntity {
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package com.thebrokenrail.energonrelics.block.entity.battery;
|
package com.thebrokenrail.energonrelics.block.entity.battery;
|
||||||
|
|
||||||
|
import com.thebrokenrail.energonrelics.api.block.entity.core.EnergyReceiverBlockEntity;
|
||||||
|
import com.thebrokenrail.energonrelics.api.block.entity.helper.EnergyGenerator;
|
||||||
|
import com.thebrokenrail.energonrelics.api.energy.Action;
|
||||||
import com.thebrokenrail.energonrelics.config.HardcodedConfig;
|
import com.thebrokenrail.energonrelics.config.HardcodedConfig;
|
||||||
import com.thebrokenrail.energonrelics.EnergonRelics;
|
import com.thebrokenrail.energonrelics.EnergonRelics;
|
||||||
import com.thebrokenrail.energonrelics.block.battery.PassiveBatteryControllerBlock;
|
import com.thebrokenrail.energonrelics.block.battery.PassiveBatteryControllerBlock;
|
||||||
import com.thebrokenrail.energonrelics.energy.core.EnergyReceiverBlockEntity;
|
|
||||||
import com.thebrokenrail.energonrelics.energy.core.util.Action;
|
|
||||||
import com.thebrokenrail.energonrelics.energy.helper.EnergyGenerator;
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.entity.BlockEntity;
|
import net.minecraft.block.entity.BlockEntity;
|
||||||
import net.minecraft.block.entity.BlockEntityType;
|
import net.minecraft.block.entity.BlockEntityType;
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package com.thebrokenrail.energonrelics.block.entity.forcefield;
|
package com.thebrokenrail.energonrelics.block.entity.forcefield;
|
||||||
|
|
||||||
|
import com.thebrokenrail.energonrelics.api.block.entity.core.EnergyReceiverBlockEntity;
|
||||||
|
import com.thebrokenrail.energonrelics.api.energy.Action;
|
||||||
import com.thebrokenrail.energonrelics.block.forcefield.util.AbstractFieldBlock;
|
import com.thebrokenrail.energonrelics.block.forcefield.util.AbstractFieldBlock;
|
||||||
import com.thebrokenrail.energonrelics.block.forcefield.util.FieldProjectorBlock;
|
import com.thebrokenrail.energonrelics.block.forcefield.util.FieldProjectorBlock;
|
||||||
import com.thebrokenrail.energonrelics.config.HardcodedConfig;
|
import com.thebrokenrail.energonrelics.config.HardcodedConfig;
|
||||||
import com.thebrokenrail.energonrelics.energy.core.EnergyReceiverBlockEntity;
|
|
||||||
import com.thebrokenrail.energonrelics.energy.core.util.Action;
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.entity.BlockEntityType;
|
import net.minecraft.block.entity.BlockEntityType;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
package com.thebrokenrail.energonrelics.block.entity.infuser;
|
package com.thebrokenrail.energonrelics.block.entity.infuser;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.EnergonRelics;
|
import com.thebrokenrail.energonrelics.EnergonRelics;
|
||||||
|
import com.thebrokenrail.energonrelics.api.block.entity.core.EnergyReceiverBlockEntity;
|
||||||
|
import com.thebrokenrail.energonrelics.api.energy.Action;
|
||||||
import com.thebrokenrail.energonrelics.block.InfuserBlock;
|
import com.thebrokenrail.energonrelics.block.InfuserBlock;
|
||||||
import com.thebrokenrail.energonrelics.config.HardcodedConfig;
|
import com.thebrokenrail.energonrelics.config.HardcodedConfig;
|
||||||
import com.thebrokenrail.energonrelics.energy.core.EnergyReceiverBlockEntity;
|
|
||||||
import com.thebrokenrail.energonrelics.energy.core.util.Action;
|
|
||||||
import com.thebrokenrail.energonrelics.item.MultimeterItem;
|
import com.thebrokenrail.energonrelics.item.MultimeterItem;
|
||||||
|
import com.thebrokenrail.energonrelics.registry.infuser.data.InfuserAction;
|
||||||
|
import com.thebrokenrail.energonrelics.registry.infuser.data.InfuserEntry;
|
||||||
|
import com.thebrokenrail.energonrelics.registry.infuser.InfuserRegistry;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.entity.BlockEntityType;
|
import net.minecraft.block.entity.BlockEntityType;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
package com.thebrokenrail.energonrelics.block.entity.reactor;
|
package com.thebrokenrail.energonrelics.block.entity.reactor;
|
||||||
|
|
||||||
|
import com.thebrokenrail.energonrelics.api.block.entity.helper.EnergyGeneratorBlockEntity;
|
||||||
import com.thebrokenrail.energonrelics.block.battery.PassiveBatteryControllerBlock;
|
import com.thebrokenrail.energonrelics.block.battery.PassiveBatteryControllerBlock;
|
||||||
import com.thebrokenrail.energonrelics.block.entity.battery.PassiveBatteryControllerBlockEntity;
|
import com.thebrokenrail.energonrelics.block.entity.battery.PassiveBatteryControllerBlockEntity;
|
||||||
import com.thebrokenrail.energonrelics.block.reactor.ReactorControllerBlock;
|
import com.thebrokenrail.energonrelics.block.reactor.ReactorControllerBlock;
|
||||||
import com.thebrokenrail.energonrelics.config.HardcodedConfig;
|
import com.thebrokenrail.energonrelics.config.HardcodedConfig;
|
||||||
import com.thebrokenrail.energonrelics.energy.core.util.EnergyTickable;
|
import com.thebrokenrail.energonrelics.api.energy.tick.EnergyTickable;
|
||||||
import com.thebrokenrail.energonrelics.energy.helper.EnergyGeneratorBlockEntity;
|
import com.thebrokenrail.energonrelics.registry.reactor.ReactorFuelRegistry;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.entity.BlockEntity;
|
import net.minecraft.block.entity.BlockEntity;
|
||||||
import net.minecraft.block.entity.BlockEntityType;
|
import net.minecraft.block.entity.BlockEntityType;
|
||||||
|
@ -2,7 +2,7 @@ package com.thebrokenrail.energonrelics.block.forcefield.util;
|
|||||||
|
|
||||||
import com.thebrokenrail.energonrelics.EnergonRelics;
|
import com.thebrokenrail.energonrelics.EnergonRelics;
|
||||||
import com.thebrokenrail.energonrelics.block.entity.forcefield.FieldProjectorBlockEntity;
|
import com.thebrokenrail.energonrelics.block.entity.forcefield.FieldProjectorBlockEntity;
|
||||||
import com.thebrokenrail.energonrelics.block.util.SimpleBlock;
|
import com.thebrokenrail.energonrelics.api.block.SimpleBlock;
|
||||||
import com.thebrokenrail.energonrelics.config.HardcodedConfig;
|
import com.thebrokenrail.energonrelics.config.HardcodedConfig;
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.thebrokenrail.energonrelics.block.forcefield.util;
|
package com.thebrokenrail.energonrelics.block.forcefield.util;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.block.entity.forcefield.FieldProjectorBlockEntity;
|
import com.thebrokenrail.energonrelics.block.entity.forcefield.FieldProjectorBlockEntity;
|
||||||
import com.thebrokenrail.energonrelics.block.util.energy.FacingEnergyBlock;
|
import com.thebrokenrail.energonrelics.api.block.energy.FacingEnergyBlock;
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
|
@ -2,13 +2,12 @@ package com.thebrokenrail.energonrelics.block.lightning;
|
|||||||
|
|
||||||
import com.thebrokenrail.energonrelics.EnergonRelics;
|
import com.thebrokenrail.energonrelics.EnergonRelics;
|
||||||
import com.thebrokenrail.energonrelics.block.entity.LightningRodBaseBlockEntity;
|
import com.thebrokenrail.energonrelics.block.entity.LightningRodBaseBlockEntity;
|
||||||
import com.thebrokenrail.energonrelics.block.util.energy.EnergyBlock;
|
import com.thebrokenrail.energonrelics.api.block.energy.EnergyBlock;
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.Blocks;
|
import net.minecraft.block.Blocks;
|
||||||
import net.minecraft.block.DoorBlock;
|
|
||||||
import net.minecraft.block.Material;
|
import net.minecraft.block.Material;
|
||||||
import net.minecraft.block.MaterialColor;
|
import net.minecraft.block.MaterialColor;
|
||||||
import net.minecraft.block.ShapeContext;
|
import net.minecraft.block.ShapeContext;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.thebrokenrail.energonrelics.block.lightning;
|
package com.thebrokenrail.energonrelics.block.lightning;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.EnergonRelics;
|
import com.thebrokenrail.energonrelics.EnergonRelics;
|
||||||
import com.thebrokenrail.energonrelics.block.util.SimpleBlock;
|
import com.thebrokenrail.energonrelics.api.block.SimpleBlock;
|
||||||
import com.thebrokenrail.energonrelics.util.MissingCaseException;
|
import com.thebrokenrail.energonrelics.util.MissingCaseException;
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.thebrokenrail.energonrelics.block.misc;
|
package com.thebrokenrail.energonrelics.block.misc;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.block.util.SimpleBlock;
|
import com.thebrokenrail.energonrelics.api.block.SimpleBlock;
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
import net.minecraft.block.Material;
|
import net.minecraft.block.Material;
|
||||||
import net.minecraft.block.MaterialColor;
|
import net.minecraft.block.MaterialColor;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.thebrokenrail.energonrelics.block.misc;
|
package com.thebrokenrail.energonrelics.block.misc;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.block.util.SimpleBlock;
|
import com.thebrokenrail.energonrelics.api.block.SimpleBlock;
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.thebrokenrail.energonrelics.block.misc;
|
package com.thebrokenrail.energonrelics.block.misc;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.block.util.SimpleBlock;
|
import com.thebrokenrail.energonrelics.api.block.SimpleBlock;
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
import net.minecraft.block.Material;
|
import net.minecraft.block.Material;
|
||||||
import net.minecraft.block.MaterialColor;
|
import net.minecraft.block.MaterialColor;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.thebrokenrail.energonrelics.block.portal;
|
package com.thebrokenrail.energonrelics.block.portal;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.EnergonRelics;
|
import com.thebrokenrail.energonrelics.EnergonRelics;
|
||||||
import com.thebrokenrail.energonrelics.block.util.SimpleBlock;
|
import com.thebrokenrail.energonrelics.api.block.SimpleBlock;
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.Blocks;
|
import net.minecraft.block.Blocks;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.thebrokenrail.energonrelics.block.portal;
|
package com.thebrokenrail.energonrelics.block.portal;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.EnergonRelics;
|
import com.thebrokenrail.energonrelics.EnergonRelics;
|
||||||
import com.thebrokenrail.energonrelics.block.util.SimpleBlock;
|
import com.thebrokenrail.energonrelics.api.block.SimpleBlock;
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.thebrokenrail.energonrelics.block.reactor;
|
package com.thebrokenrail.energonrelics.block.reactor;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.block.entity.reactor.ReactorControllerBlockEntity;
|
import com.thebrokenrail.energonrelics.block.entity.reactor.ReactorControllerBlockEntity;
|
||||||
import com.thebrokenrail.energonrelics.block.util.energy.FacingEnergyBlock;
|
import com.thebrokenrail.energonrelics.api.block.energy.FacingEnergyBlock;
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.thebrokenrail.energonrelics.block.reactor;
|
package com.thebrokenrail.energonrelics.block.reactor;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.block.entity.reactor.ReactorCoreBlockEntity;
|
import com.thebrokenrail.energonrelics.block.entity.reactor.ReactorCoreBlockEntity;
|
||||||
import com.thebrokenrail.energonrelics.block.util.SimpleBlockWithEntity;
|
import com.thebrokenrail.energonrelics.api.block.SimpleBlockWithEntity;
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
import net.minecraft.block.Material;
|
import net.minecraft.block.Material;
|
||||||
import net.minecraft.block.MaterialColor;
|
import net.minecraft.block.MaterialColor;
|
||||||
|
@ -2,7 +2,7 @@ package com.thebrokenrail.energonrelics.block.reactor;
|
|||||||
|
|
||||||
import com.thebrokenrail.energonrelics.EnergonRelics;
|
import com.thebrokenrail.energonrelics.EnergonRelics;
|
||||||
import com.thebrokenrail.energonrelics.block.entity.reactor.ReactorInputBlockEntity;
|
import com.thebrokenrail.energonrelics.block.entity.reactor.ReactorInputBlockEntity;
|
||||||
import com.thebrokenrail.energonrelics.block.util.SimpleBlockWithEntity;
|
import com.thebrokenrail.energonrelics.api.block.SimpleBlockWithEntity;
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.Material;
|
import net.minecraft.block.Material;
|
||||||
|
@ -2,7 +2,7 @@ package com.thebrokenrail.energonrelics.block.structure;
|
|||||||
|
|
||||||
import com.thebrokenrail.energonrelics.EnergonRelics;
|
import com.thebrokenrail.energonrelics.EnergonRelics;
|
||||||
import com.thebrokenrail.energonrelics.block.entity.structure.StructureGeneratorBlockEntity;
|
import com.thebrokenrail.energonrelics.block.entity.structure.StructureGeneratorBlockEntity;
|
||||||
import com.thebrokenrail.energonrelics.block.util.SimpleBlockWithEntity;
|
import com.thebrokenrail.energonrelics.api.block.SimpleBlockWithEntity;
|
||||||
import com.thebrokenrail.energonrelics.structure.researchcomplex.ResearchComplexStartPart;
|
import com.thebrokenrail.energonrelics.structure.researchcomplex.ResearchComplexStartPart;
|
||||||
import com.thebrokenrail.energonrelics.structure.researchcomplex.ResearchComplexState;
|
import com.thebrokenrail.energonrelics.structure.researchcomplex.ResearchComplexState;
|
||||||
import net.earthcomputer.libstructure.LibStructure;
|
import net.earthcomputer.libstructure.LibStructure;
|
||||||
@ -106,8 +106,8 @@ public class StructureGeneratorBlock extends SimpleBlockWithEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void register(String name) {
|
public void register(Identifier id) {
|
||||||
super.register(name + "_generator");
|
super.register(new Identifier(id.getNamespace(), id.getPath() + "_generator"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("SameParameterValue")
|
@SuppressWarnings("SameParameterValue")
|
||||||
|
@ -1,47 +0,0 @@
|
|||||||
package com.thebrokenrail.energonrelics.block.util;
|
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.EnergonRelics;
|
|
||||||
import net.fabricmc.loader.api.FabricLoader;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.item.BlockItem;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.util.Identifier;
|
|
||||||
import net.minecraft.util.Rarity;
|
|
||||||
import net.minecraft.util.registry.Registry;
|
|
||||||
|
|
||||||
public class SimpleBlock extends Block {
|
|
||||||
public SimpleBlock(Settings settings) {
|
|
||||||
super(settings);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void register(String name) {
|
|
||||||
Registry.register(Registry.BLOCK, new Identifier(EnergonRelics.NAMESPACE, name), this);
|
|
||||||
if (registerItem()) {
|
|
||||||
Item.Settings settings = new Item.Settings();
|
|
||||||
if (addToItemGroup() || FabricLoader.getInstance().isDevelopmentEnvironment()) {
|
|
||||||
settings.group(EnergonRelics.ITEM_GROUP);
|
|
||||||
}
|
|
||||||
if (isEpic()) {
|
|
||||||
settings.rarity(Rarity.EPIC);
|
|
||||||
}
|
|
||||||
settings.maxCount(getMaxCount());
|
|
||||||
Registry.register(Registry.ITEM, new Identifier(EnergonRelics.NAMESPACE, name), new BlockItem(this, settings));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean addToItemGroup() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean registerItem() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected int getMaxCount() {
|
|
||||||
return 64;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean isEpic() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
@ -2,7 +2,7 @@ package com.thebrokenrail.energonrelics.client;
|
|||||||
|
|
||||||
import com.thebrokenrail.energonrelics.EnergonRelics;
|
import com.thebrokenrail.energonrelics.EnergonRelics;
|
||||||
import com.thebrokenrail.energonrelics.block.forcefield.util.AbstractFieldBlock;
|
import com.thebrokenrail.energonrelics.block.forcefield.util.AbstractFieldBlock;
|
||||||
import com.thebrokenrail.energonrelics.block.util.energy.EnergyBlock;
|
import com.thebrokenrail.energonrelics.api.block.energy.EnergyBlock;
|
||||||
import com.thebrokenrail.energonrelics.client.config.UserConfig;
|
import com.thebrokenrail.energonrelics.client.config.UserConfig;
|
||||||
import me.sargunvohra.mcmods.autoconfig1u.AutoConfig;
|
import me.sargunvohra.mcmods.autoconfig1u.AutoConfig;
|
||||||
import me.sargunvohra.mcmods.autoconfig1u.ConfigData;
|
import me.sargunvohra.mcmods.autoconfig1u.ConfigData;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.thebrokenrail.energonrelics.client.block.entity.render;
|
package com.thebrokenrail.energonrelics.client.block.entity.render;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.EnergonRelics;
|
import com.thebrokenrail.energonrelics.EnergonRelics;
|
||||||
import com.thebrokenrail.energonrelics.energy.core.EnergyReceiverBlockEntity;
|
import com.thebrokenrail.energonrelics.api.block.entity.core.EnergyReceiverBlockEntity;
|
||||||
import com.thebrokenrail.energonrelics.mixin.RenderPhaseAccessor;
|
import com.thebrokenrail.energonrelics.mixin.RenderPhaseAccessor;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package com.thebrokenrail.energonrelics.client.rei.infuser;
|
package com.thebrokenrail.energonrelics.client.rei.infuser;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.EnergonRelics;
|
import com.thebrokenrail.energonrelics.EnergonRelics;
|
||||||
import com.thebrokenrail.energonrelics.block.entity.infuser.InfuserEntry;
|
import com.thebrokenrail.energonrelics.registry.infuser.data.InfuserEntry;
|
||||||
import com.thebrokenrail.energonrelics.block.entity.infuser.InfuserOutputItem;
|
import com.thebrokenrail.energonrelics.registry.infuser.data.InfuserOutputItem;
|
||||||
import com.thebrokenrail.energonrelics.block.entity.infuser.InfuserRegistry;
|
import com.thebrokenrail.energonrelics.registry.infuser.InfuserRegistry;
|
||||||
import com.thebrokenrail.energonrelics.client.rei.EnergonRelicsPlugin;
|
import com.thebrokenrail.energonrelics.client.rei.EnergonRelicsPlugin;
|
||||||
import com.thebrokenrail.energonrelics.config.HardcodedConfig;
|
import com.thebrokenrail.energonrelics.config.HardcodedConfig;
|
||||||
import com.thebrokenrail.energonrelics.util.BooleanIterator;
|
import com.thebrokenrail.energonrelics.util.BooleanIterator;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.thebrokenrail.energonrelics.client.rei.infuser;
|
package com.thebrokenrail.energonrelics.client.rei.infuser;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.block.entity.infuser.InfuserOutputItem;
|
import com.thebrokenrail.energonrelics.registry.infuser.data.InfuserOutputItem;
|
||||||
import com.thebrokenrail.energonrelics.client.rei.EnergonRelicsPlugin;
|
import com.thebrokenrail.energonrelics.client.rei.EnergonRelicsPlugin;
|
||||||
import me.shedaniel.rei.api.EntryStack;
|
import me.shedaniel.rei.api.EntryStack;
|
||||||
import me.shedaniel.rei.api.RecipeDisplay;
|
import me.shedaniel.rei.api.RecipeDisplay;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.thebrokenrail.energonrelics.client.rei.reactor;
|
package com.thebrokenrail.energonrelics.client.rei.reactor;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.EnergonRelics;
|
import com.thebrokenrail.energonrelics.EnergonRelics;
|
||||||
import com.thebrokenrail.energonrelics.block.entity.reactor.ReactorFuelRegistry;
|
import com.thebrokenrail.energonrelics.registry.reactor.ReactorFuelRegistry;
|
||||||
import com.thebrokenrail.energonrelics.client.rei.EnergonRelicsPlugin;
|
import com.thebrokenrail.energonrelics.client.rei.EnergonRelicsPlugin;
|
||||||
import me.shedaniel.math.Point;
|
import me.shedaniel.math.Point;
|
||||||
import me.shedaniel.math.Rectangle;
|
import me.shedaniel.math.Rectangle;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.thebrokenrail.energonrelics.component;
|
package com.thebrokenrail.energonrelics.component;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.EnergonRelics;
|
import com.thebrokenrail.energonrelics.EnergonRelics;
|
||||||
import com.thebrokenrail.energonrelics.energy.core.EnergyProviderBlockEntity;
|
import com.thebrokenrail.energonrelics.api.block.entity.core.EnergyProviderBlockEntity;
|
||||||
import com.thebrokenrail.energonrelics.util.BlockPosWithDimension;
|
import com.thebrokenrail.energonrelics.util.BlockPosWithDimension;
|
||||||
import net.minecraft.block.entity.BlockEntity;
|
import net.minecraft.block.entity.BlockEntity;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
package com.thebrokenrail.energonrelics.energy.core.util;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface EnergyTickable {
|
|
||||||
List<EnergyTickable> startTick();
|
|
||||||
void logicTick();
|
|
||||||
String getID();
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
package com.thebrokenrail.energonrelics.energy.helper;
|
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.energy.core.util.Action;
|
|
||||||
|
|
||||||
public interface EnergyGenerator {
|
|
||||||
default void handlePropagatedActionWithGenerator(Action.PropagatedAction action) {
|
|
||||||
long amount = Math.min(getEnergy(), action.amountOwed());
|
|
||||||
setEnergy(getEnergy() - amount);
|
|
||||||
action.pay(amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
long getEnergy();
|
|
||||||
void setEnergy(long value);
|
|
||||||
|
|
||||||
long getDisplayEnergy();
|
|
||||||
}
|
|
@ -1,8 +1,8 @@
|
|||||||
package com.thebrokenrail.energonrelics.item;
|
package com.thebrokenrail.energonrelics.item;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.EnergonRelics;
|
import com.thebrokenrail.energonrelics.EnergonRelics;
|
||||||
import com.thebrokenrail.energonrelics.energy.core.EnergyReceiverBlockEntity;
|
import com.thebrokenrail.energonrelics.api.block.entity.core.EnergyReceiverBlockEntity;
|
||||||
import com.thebrokenrail.energonrelics.energy.helper.EnergyGenerator;
|
import com.thebrokenrail.energonrelics.api.block.entity.helper.EnergyGenerator;
|
||||||
import net.minecraft.block.entity.BlockEntity;
|
import net.minecraft.block.entity.BlockEntity;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemUsageContext;
|
import net.minecraft.item.ItemUsageContext;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.thebrokenrail.energonrelics.item;
|
package com.thebrokenrail.energonrelics.item;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.EnergonRelics;
|
import com.thebrokenrail.energonrelics.EnergonRelics;
|
||||||
|
import com.thebrokenrail.energonrelics.api.block.entity.core.EnergyReceiverBlockEntity;
|
||||||
import com.thebrokenrail.energonrelics.component.NetworkComponent;
|
import com.thebrokenrail.energonrelics.component.NetworkComponent;
|
||||||
import com.thebrokenrail.energonrelics.energy.core.EnergyReceiverBlockEntity;
|
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
import net.minecraft.block.entity.BlockEntity;
|
import net.minecraft.block.entity.BlockEntity;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.thebrokenrail.energonrelics.mixin;
|
package com.thebrokenrail.energonrelics.mixin;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.block.forcefield.util.AbstractFieldBlock;
|
import com.thebrokenrail.energonrelics.block.forcefield.util.AbstractFieldBlock;
|
||||||
import com.thebrokenrail.energonrelics.energy.core.util.EnergyTicker;
|
import com.thebrokenrail.energonrelics.api.energy.tick.EnergyTicker;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.thebrokenrail.energonrelics.block.entity.infuser;
|
package com.thebrokenrail.energonrelics.registry.infuser;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.EnergonRelics;
|
import com.thebrokenrail.energonrelics.EnergonRelics;
|
||||||
|
import com.thebrokenrail.energonrelics.registry.infuser.data.InfuserAction;
|
||||||
|
import com.thebrokenrail.energonrelics.registry.infuser.data.InfuserEntry;
|
||||||
import net.minecraft.item.DyeItem;
|
import net.minecraft.item.DyeItem;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@ -15,14 +17,27 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Infuser Registry
|
||||||
|
*/
|
||||||
public class InfuserRegistry {
|
public class InfuserRegistry {
|
||||||
private static final Map<Item, InfuserEntry> map = new HashMap<>();
|
private static final Map<Item, InfuserEntry> map = new HashMap<>();
|
||||||
|
|
||||||
static InfuserEntry get(Item item) {
|
/**
|
||||||
|
* Get From Registry
|
||||||
|
* @param item Input Item
|
||||||
|
* @return Infuser Registry Entry
|
||||||
|
*/
|
||||||
|
public static InfuserEntry get(Item item) {
|
||||||
return map.get(item);
|
return map.get(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void add(Item item, InfuserEntry entry) {
|
/**
|
||||||
|
* Add To Registry
|
||||||
|
* @param item Input Item
|
||||||
|
* @param entry Infuser Registry Entry
|
||||||
|
*/
|
||||||
|
public static void add(Item item, InfuserEntry entry) {
|
||||||
map.put(item, entry);
|
map.put(item, entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,7 +45,12 @@ public class InfuserRegistry {
|
|||||||
return map.entrySet();
|
return map.entrySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
static String toString(InfuserEntry entry) {
|
/**
|
||||||
|
* Convert Infuser Registry Entry To String
|
||||||
|
* @param entry Infuser Registry Entry
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
|
public static String toString(InfuserEntry entry) {
|
||||||
Item item = null;
|
Item item = null;
|
||||||
for (Map.Entry<Item, InfuserEntry> mapEntry : entrySet()) {
|
for (Map.Entry<Item, InfuserEntry> mapEntry : entrySet()) {
|
||||||
if (mapEntry.getValue() == entry) {
|
if (mapEntry.getValue() == entry) {
|
||||||
@ -46,7 +66,12 @@ public class InfuserRegistry {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static InfuserEntry fromString(String str) {
|
/**
|
||||||
|
* Get Infuser Registry Entry From String
|
||||||
|
* @param str String
|
||||||
|
* @return Infuser Registry Entry
|
||||||
|
*/
|
||||||
|
public static InfuserEntry fromString(String str) {
|
||||||
Item item = Registry.ITEM.get(new Identifier(str));
|
Item item = Registry.ITEM.get(new Identifier(str));
|
||||||
return map.getOrDefault(item, null);
|
return map.getOrDefault(item, null);
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package com.thebrokenrail.energonrelics.block.entity.infuser;
|
package com.thebrokenrail.energonrelics.registry.infuser.data;
|
||||||
|
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
@ -13,20 +13,31 @@ import net.minecraft.util.math.BlockPos;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.explosion.Explosion;
|
import net.minecraft.world.explosion.Explosion;
|
||||||
|
|
||||||
interface InfuserAction {
|
/**
|
||||||
|
* Infuser Action
|
||||||
|
*/
|
||||||
|
public interface InfuserAction {
|
||||||
|
/**
|
||||||
|
* Run Infuser Action
|
||||||
|
* @param world World
|
||||||
|
* @param pos Infuser Position
|
||||||
|
*/
|
||||||
void run(World world, BlockPos pos);
|
void run(World world, BlockPos pos);
|
||||||
|
|
||||||
@Environment(EnvType.CLIENT)
|
@Environment(EnvType.CLIENT)
|
||||||
InfuserOutputItem display();
|
InfuserOutputItem display();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Infuser Action That Creates An Item
|
||||||
|
*/
|
||||||
class ItemAction implements InfuserAction {
|
class ItemAction implements InfuserAction {
|
||||||
final ItemStack stack;
|
final ItemStack stack;
|
||||||
|
|
||||||
ItemAction(ItemStack stack) {
|
public ItemAction(ItemStack stack) {
|
||||||
this.stack = stack;
|
this.stack = stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemAction(Item item) {
|
public ItemAction(Item item) {
|
||||||
this(new ItemStack(item));
|
this(new ItemStack(item));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,6 +53,9 @@ interface InfuserAction {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Infuser Action That Creates An Explosion
|
||||||
|
*/
|
||||||
class ExplosionAction implements InfuserAction {
|
class ExplosionAction implements InfuserAction {
|
||||||
@Override
|
@Override
|
||||||
public void run(World world, BlockPos pos) {
|
public void run(World world, BlockPos pos) {
|
||||||
@ -56,6 +70,9 @@ interface InfuserAction {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Infuser Action That Creates Some Particles
|
||||||
|
*/
|
||||||
class ParticleAction implements InfuserAction {
|
class ParticleAction implements InfuserAction {
|
||||||
@Override
|
@Override
|
||||||
public void run(World world, BlockPos pos) {
|
public void run(World world, BlockPos pos) {
|
@ -1,4 +1,4 @@
|
|||||||
package com.thebrokenrail.energonrelics.block.entity.infuser;
|
package com.thebrokenrail.energonrelics.registry.infuser.data;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.util.WeightedList;
|
import com.thebrokenrail.energonrelics.util.WeightedList;
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
@ -9,20 +9,41 @@ import net.minecraft.world.World;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Infuser Registry Entry
|
||||||
|
*/
|
||||||
public class InfuserEntry {
|
public class InfuserEntry {
|
||||||
|
/**
|
||||||
|
* Energy Cost
|
||||||
|
*/
|
||||||
public final long cost;
|
public final long cost;
|
||||||
|
/**
|
||||||
|
* Success Chance
|
||||||
|
*/
|
||||||
public final double successChance;
|
public final double successChance;
|
||||||
private final InfuserAction[] success;
|
private final InfuserAction[] success;
|
||||||
private final InfuserAction[] fail;
|
private final InfuserAction[] fail;
|
||||||
|
|
||||||
InfuserEntry(long cost, double successChance, InfuserAction[] success, InfuserAction[] fail) {
|
/**
|
||||||
|
* Create Infuser Registry Entry
|
||||||
|
* @param cost Energy Cost
|
||||||
|
* @param successChance Success Chance
|
||||||
|
* @param success Success Actions
|
||||||
|
* @param fail Failure Actions
|
||||||
|
*/
|
||||||
|
public InfuserEntry(long cost, double successChance, InfuserAction[] success, InfuserAction[] fail) {
|
||||||
this.cost = cost;
|
this.cost = cost;
|
||||||
this.successChance = successChance;
|
this.successChance = successChance;
|
||||||
this.success = success;
|
this.success = success;
|
||||||
this.fail = fail;
|
this.fail = fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
void run(World world, BlockPos pos) {
|
/**
|
||||||
|
* Pick Action And Run It
|
||||||
|
* @param world World
|
||||||
|
* @param pos Infuser Position
|
||||||
|
*/
|
||||||
|
public void run(World world, BlockPos pos) {
|
||||||
boolean isSuccess = world.random.nextDouble() <= successChance;
|
boolean isSuccess = world.random.nextDouble() <= successChance;
|
||||||
|
|
||||||
InfuserAction[] list;
|
InfuserAction[] list;
|
@ -1,4 +1,4 @@
|
|||||||
package com.thebrokenrail.energonrelics.block.entity.infuser;
|
package com.thebrokenrail.energonrelics.registry.infuser.data;
|
||||||
|
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
@ -1,4 +1,4 @@
|
|||||||
package com.thebrokenrail.energonrelics.block.entity.reactor;
|
package com.thebrokenrail.energonrelics.registry.reactor;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.EnergonRelics;
|
import com.thebrokenrail.energonrelics.EnergonRelics;
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
@ -9,13 +9,26 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class ReactorFuelRegistry {
|
/**
|
||||||
|
* Reactor Fuel Registry
|
||||||
|
*/
|
||||||
|
public final class ReactorFuelRegistry {
|
||||||
private static final Map<Item, Float> map = new HashMap<>();
|
private static final Map<Item, Float> map = new HashMap<>();
|
||||||
|
|
||||||
private static void add(Item item, float multiplier) {
|
/**
|
||||||
|
* Add To Registry
|
||||||
|
* @param item Fuel Item
|
||||||
|
* @param multiplier Fuel Multiplier
|
||||||
|
*/
|
||||||
|
public static void add(Item item, float multiplier) {
|
||||||
map.put(item, multiplier);
|
map.put(item, multiplier);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get From Registry
|
||||||
|
* @param item Fuel Item
|
||||||
|
* @return Fuel Multiplier
|
||||||
|
*/
|
||||||
public static float get(Item item) {
|
public static float get(Item item) {
|
||||||
return map.getOrDefault(item, 0f);
|
return map.getOrDefault(item, 0f);
|
||||||
}
|
}
|
Reference in New Issue
Block a user