Add JavaDoc
EnergonRelics/pipeline/head This commit looks good
Details
EnergonRelics/pipeline/head This commit looks good
Details
parent
7e0a550811
commit
b347a67a10
@ -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
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -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.energy.core.util.Action;
|
||||
import com.thebrokenrail.energonrelics.api.block.entity.core.EnergyProviderBlockEntity;
|
||||
import com.thebrokenrail.energonrelics.api.energy.Action;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
|
||||
/**
|
||||
* Simple Implementation Of A Energy Generator
|
||||
*/
|
||||
public abstract class EnergyGeneratorBlockEntity extends EnergyProviderBlockEntity implements EnergyGenerator {
|
||||
public EnergyGeneratorBlockEntity(BlockEntityType<?> type) {
|
||||
super(type);
|
@ -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,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;
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|