mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-23 15:48:34 +01:00
Added configuration for Shock Absorber
This commit is contained in:
parent
075862361d
commit
aefcc32d91
4 changed files with 13 additions and 9 deletions
|
@ -11,6 +11,7 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityShockSuppressor;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityShockSuppressor;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
@ -48,7 +49,7 @@ public class BlockShockSuppressor extends BlockContainerBase{
|
||||||
List<Entity> affectedEntities = event.getAffectedEntities();
|
List<Entity> affectedEntities = event.getAffectedEntities();
|
||||||
|
|
||||||
int rangeSq = TileEntityShockSuppressor.RANGE*TileEntityShockSuppressor.RANGE;
|
int rangeSq = TileEntityShockSuppressor.RANGE*TileEntityShockSuppressor.RANGE;
|
||||||
int use = TileEntityShockSuppressor.USE_PER;
|
int energyUse = ConfigIntValues.SHOCK_ABSORBER_ENERGY_USE.getValue();
|
||||||
|
|
||||||
for(TileEntityShockSuppressor suppressor : TileEntityShockSuppressor.SUPPRESSORS){
|
for(TileEntityShockSuppressor suppressor : TileEntityShockSuppressor.SUPPRESSORS){
|
||||||
if(!suppressor.isRedstonePowered){
|
if(!suppressor.isRedstonePowered){
|
||||||
|
@ -72,8 +73,8 @@ public class BlockShockSuppressor extends BlockContainerBase{
|
||||||
Collections.shuffle(posesToRemove);
|
Collections.shuffle(posesToRemove);
|
||||||
|
|
||||||
for(BlockPos pos : posesToRemove){
|
for(BlockPos pos : posesToRemove){
|
||||||
if(suppressor.storage.getEnergyStored() >= use){
|
if(suppressor.storage.getEnergyStored() >= energyUse){
|
||||||
suppressor.storage.extractEnergyInternal(use, false);
|
suppressor.storage.extractEnergyInternal(energyUse, false);
|
||||||
affectedBlocks.remove(pos);
|
affectedBlocks.remove(pos);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
@ -81,8 +82,8 @@ public class BlockShockSuppressor extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(Entity entity : entitiesToRemove){
|
for(Entity entity : entitiesToRemove){
|
||||||
if(suppressor.storage.getEnergyStored() >= use){
|
if(suppressor.storage.getEnergyStored() >= energyUse){
|
||||||
suppressor.storage.extractEnergyInternal(use, false);
|
suppressor.storage.extractEnergyInternal(energyUse, false);
|
||||||
affectedEntities.remove(entity);
|
affectedEntities.remove(entity);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
|
@ -233,7 +233,7 @@ public final class InitBooklet{
|
||||||
new BookletChapter("longRangeBreaker", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockDirectionalBreaker), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityDirectionalBreaker.ENERGY_USE).addTextReplacement("<range>", TileEntityDirectionalBreaker.RANGE), new PageCrafting(2, BlockCrafting.recipeDirectionalBreaker).setWildcard());
|
new BookletChapter("longRangeBreaker", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockDirectionalBreaker), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityDirectionalBreaker.ENERGY_USE).addTextReplacement("<range>", TileEntityDirectionalBreaker.RANGE), new PageCrafting(2, BlockCrafting.recipeDirectionalBreaker).setWildcard());
|
||||||
new BookletChapter("playerInterface", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockPlayerInterface), new PageTextOnly(1).addTextReplacement("<range>", TileEntityPlayerInterface.DEFAULT_RANGE), new PageCrafting(2, BlockCrafting.recipePlayerInterface).setNoText()).setSpecial();
|
new BookletChapter("playerInterface", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockPlayerInterface), new PageTextOnly(1).addTextReplacement("<range>", TileEntityPlayerInterface.DEFAULT_RANGE), new PageCrafting(2, BlockCrafting.recipePlayerInterface).setNoText()).setSpecial();
|
||||||
new BookletChapter("displayStand", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockDisplayStand), new PageTextOnly(1), new PageTextOnly(2), new PageCrafting(3, BlockCrafting.recipeDisplayStand).setNoText()).setSpecial();
|
new BookletChapter("displayStand", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockDisplayStand), new PageTextOnly(1), new PageTextOnly(2), new PageCrafting(3, BlockCrafting.recipeDisplayStand).setNoText()).setSpecial();
|
||||||
new BookletChapter("shockSuppressor", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockShockSuppressor), new PageTextOnly(1).addTextReplacement("<range>", TileEntityShockSuppressor.RANGE).addTextReplacement("<rf>", TileEntityShockSuppressor.USE_PER), new PageCrafting(2, BlockCrafting.recipeShockSuppressor));
|
new BookletChapter("shockSuppressor", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockShockSuppressor), new PageTextOnly(1).addTextReplacement("<range>", TileEntityShockSuppressor.RANGE).addTextReplacement("<rf>", ConfigIntValues.SHOCK_ABSORBER_ENERGY_USE.getValue()), new PageCrafting(2, BlockCrafting.recipeShockSuppressor));
|
||||||
|
|
||||||
//RF Generating Blocks
|
//RF Generating Blocks
|
||||||
new BookletChapter("solarPanel", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(InitBlocks.blockFurnaceSolar), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityFurnaceSolar.PRODUCE), new PageCrafting(2, BlockCrafting.recipeSolar).setNoText());
|
new BookletChapter("solarPanel", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(InitBlocks.blockFurnaceSolar), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityFurnaceSolar.PRODUCE), new PageCrafting(2, BlockCrafting.recipeSolar).setNoText());
|
||||||
|
|
|
@ -91,7 +91,10 @@ public enum ConfigIntValues{
|
||||||
POWERED_FURNACE_ENERGY_USE("Powered Furnace: Energy Use", ConfigCategories.MACHINE_RECIPE_COSTS, 25, 1, 1000000000, "Amount of energy Powered Furnace uses per tick."),
|
POWERED_FURNACE_ENERGY_USE("Powered Furnace: Energy Use", ConfigCategories.MACHINE_RECIPE_COSTS, 25, 1, 1000000000, "Amount of energy Powered Furnace uses per tick."),
|
||||||
POWERED_FURNACE_PROCESSING_DURATION("Powered Furnace: Processing Time", ConfigCategories.MACHINE_RECIPE_COSTS, 80, 1, 72000, "Time in ticks required to smelt one item in Powered Furnace."),
|
POWERED_FURNACE_PROCESSING_DURATION("Powered Furnace: Processing Time", ConfigCategories.MACHINE_RECIPE_COSTS, 80, 1, 72000, "Time in ticks required to smelt one item in Powered Furnace."),
|
||||||
CRUSHER_ENERGY_CAPACITY("Crusher: Energy Capacity", ConfigCategories.MACHINE_ENERGY_VALUES, 60000, 1000, 1000000000, "Amount of energy Crusher and Double Crusher can store."),
|
CRUSHER_ENERGY_CAPACITY("Crusher: Energy Capacity", ConfigCategories.MACHINE_ENERGY_VALUES, 60000, 1000, 1000000000, "Amount of energy Crusher and Double Crusher can store."),
|
||||||
CRUSHER_ENERGY_RECEIVE("Crusher: Energy Receive Rate", ConfigCategories.MACHINE_ENERGY_VALUES, 100, 1, 1000000000, "Amount of energy Crusher and Double Crusher can receive per tick.");
|
CRUSHER_ENERGY_RECEIVE("Crusher: Energy Receive Rate", ConfigCategories.MACHINE_ENERGY_VALUES, 100, 1, 1000000000, "Amount of energy Crusher and Double Crusher can receive per tick."),
|
||||||
|
SHOCK_ABSORBER_ENERGY_CAPACITY("Shock Absorber: Energy Capacity", ConfigCategories.MACHINE_ENERGY_VALUES, 300000, 1000, 1000000000, "Amount of energy Shock Absorber can store."),
|
||||||
|
SHOCK_ABSORBER_ENERGY_RECEIVE("Shock Absorber: Energy Receive Rate", ConfigCategories.MACHINE_ENERGY_VALUES, 400, 1, 1000000000, "Amount of energy Shock Absorber can receive per tick."),
|
||||||
|
SHOCK_ABSORBER_ENERGY_USE("Shock Absorber: Energy Use", ConfigCategories.MACHINE_ENERGY_VALUES, 300, 1, 1000000000, "Amount of energy Shock Absorber uses to protect block or entity.");
|
||||||
|
|
||||||
public final String name;
|
public final String name;
|
||||||
public final String category;
|
public final String category;
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.tile;
|
package de.ellpeck.actuallyadditions.mod.tile;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraftforge.energy.IEnergyStorage;
|
import net.minecraftforge.energy.IEnergyStorage;
|
||||||
|
@ -21,10 +22,9 @@ public class TileEntityShockSuppressor extends TileEntityBase implements IEnergy
|
||||||
|
|
||||||
public static final List<TileEntityShockSuppressor> SUPPRESSORS = new ArrayList<TileEntityShockSuppressor>();
|
public static final List<TileEntityShockSuppressor> SUPPRESSORS = new ArrayList<TileEntityShockSuppressor>();
|
||||||
|
|
||||||
public static final int USE_PER = 300;
|
|
||||||
public static final int RANGE = 5;
|
public static final int RANGE = 5;
|
||||||
|
|
||||||
public CustomEnergyStorage storage = new CustomEnergyStorage(300000, 400, 0);
|
public final CustomEnergyStorage storage = new CustomEnergyStorage(ConfigIntValues.SHOCK_ABSORBER_ENERGY_CAPACITY.getValue(), ConfigIntValues.SHOCK_ABSORBER_ENERGY_RECEIVE.getValue(), 0);
|
||||||
private int oldEnergy;
|
private int oldEnergy;
|
||||||
|
|
||||||
public TileEntityShockSuppressor(){
|
public TileEntityShockSuppressor(){
|
||||||
|
|
Loading…
Reference in a new issue