Removed unused tunnel types and files.

Added more tags, moved ender pearl dust to convention tag.
Added compatibility with TechReborn's chargers.
This commit is contained in:
Sebastian Hartte
2020-08-17 19:00:32 +02:00
parent cf656e1540
commit 739277ab64
18 changed files with 117 additions and 533 deletions
+18 -17
View File
@@ -18,6 +18,22 @@
package appeng.core;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.EnumMap;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.DoubleSupplier;
import java.util.stream.Collectors;
import net.minecraft.world.dimension.DimensionType;
import appeng.api.config.CondenserOutput;
import appeng.api.config.PowerMultiplier;
import appeng.api.config.PowerUnits;
@@ -36,21 +52,6 @@ import appeng.core.config.IntegerOption;
import appeng.core.config.StringListOption;
import appeng.core.settings.TickRates;
import appeng.util.EnumCycler;
import net.minecraft.world.dimension.DimensionType;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.EnumMap;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.DoubleSupplier;
import java.util.stream.Collectors;
public final class AEConfig {
@@ -584,8 +585,8 @@ public final class AEConfig {
powerUsageMultiplier = PowerRatios.addDouble("UsageMultiplier", 1.0, 0.01, Double.MAX_VALUE);
ConfigSection integration = root.subsection("Integration");
powerTransactionLimitTechReborn = integration.addDouble("MaxTechRebornEnergyPerTransaction", 10000.0, 0.1, 1000000.0,
"The maximum amount of TechReborn energy units that can be transfered per operation.");
powerTransactionLimitTechReborn = integration.addDouble("MaxTechRebornEnergyPerTransaction", 10000.0, 0.1,
1000000.0, "The maximum amount of TechReborn energy units that can be transfered per operation.");
ConfigSection Condenser = root.subsection("Condenser");
condenserMatterBallsPower = Condenser.addInt("MatterBalls", 256);
@@ -35,6 +35,10 @@ import net.minecraft.util.registry.Registry;
import net.minecraft.world.World;
import net.minecraft.world.dimension.DimensionType;
import team.reborn.energy.Energy;
import team.reborn.energy.EnergyHandler;
import team.reborn.energy.EnergyHolder;
import appeng.api.config.Upgrades;
import appeng.api.definitions.IBlocks;
import appeng.api.definitions.IItems;
@@ -42,6 +46,7 @@ import appeng.api.definitions.IParts;
import appeng.api.features.IRegistryContainer;
import appeng.api.features.IWirelessTermHandler;
import appeng.api.features.IWorldGen;
import appeng.api.implementations.items.IAEItemPowerStorage;
import appeng.api.movable.IMovableRegistry;
import appeng.api.networking.IGridCacheRegistry;
import appeng.api.networking.crafting.ICraftingGrid;
@@ -52,6 +57,7 @@ import appeng.api.networking.spatial.ISpatialCache;
import appeng.api.networking.storage.IStorageGrid;
import appeng.api.networking.ticking.ITickManager;
import appeng.api.parts.CableRenderMode;
import appeng.block.AEBaseBlockItemChargeable;
import appeng.bootstrap.IBootstrapComponent;
import appeng.bootstrap.components.ITileEntityRegistrationComponent;
import appeng.client.render.effects.ParticleTypes;
@@ -108,6 +114,7 @@ import appeng.fluids.container.FluidStorageBusContainer;
import appeng.fluids.container.FluidTerminalContainer;
import appeng.fluids.registries.BasicFluidCellGuiHandler;
import appeng.hooks.ToolItemHook;
import appeng.integration.modules.trenergy.ItemPowerStorageAdapter;
import appeng.items.parts.FacadeItem;
import appeng.items.tools.NetworkToolItem;
import appeng.me.cache.CraftingGridCache;
@@ -164,6 +171,7 @@ public abstract class AppEngBase implements AppEng {
setupInternalRegistries();
ItemPowerStorageAdapter.register();
}
public static void setupInternalRegistries() {
@@ -105,8 +105,6 @@ public final class ApiParts implements IParts {
private final IItemDefinition p2PTunnelRedstone;
private final IItemDefinition p2PTunnelItems;
private final IItemDefinition p2PTunnelFluids;
private final IItemDefinition p2PTunnelEU;
private final IItemDefinition p2PTunnelFE;
private final IItemDefinition p2PTunnelLight;
private final IItemDefinition cableAnchor;
private final IItemDefinition monitor;
@@ -176,17 +174,11 @@ public final class ApiParts implements IParts {
RedstoneP2PTunnelPart::new);
this.p2PTunnelItems = createPart("item_p2p_tunnel", ItemP2PTunnelPart.class, ItemP2PTunnelPart::new);
this.p2PTunnelFluids = createPart("fluid_p2p_tunnel", FluidP2PTunnelPart.class, FluidP2PTunnelPart::new);
// FIXME FABRIC this.p2PTunnelEU = null; // FIXME createPart( "ic2_p2p_tunnel", PartType.P2P_TUNNEL_IC2,
// FIXME FABRIC // PartP2PIC2Power.class, PartP2PIC2Power::new);
// FIXME FABRIC this.p2PTunnelFE = createPart("fe_p2p_tunnel", FEP2PTunnelPart.class, FEP2PTunnelPart::new);
this.p2PTunnelLight = createPart("light_p2p_tunnel", LightP2PTunnelPart.class, LightP2PTunnelPart::new);
this.interfaceTerminal = createPart("interface_terminal", InterfaceTerminalPart.class,
InterfaceTerminalPart::new);
this.fluidTerminal = createPart("fluid_terminal", FluidTerminalPart.class, FluidTerminalPart::new);
this.p2PTunnelEU = null;
this.p2PTunnelFE = null;
this.registry = null;
this.partModels = null;
}
@@ -324,16 +316,6 @@ public final class ApiParts implements IParts {
return this.p2PTunnelFluids;
}
@Override
public IItemDefinition p2PTunnelEU() {
return this.p2PTunnelEU;
}
@Override
public IItemDefinition p2PTunnelFE() {
return this.p2PTunnelFE;
}
@Override
public IItemDefinition p2PTunnelLight() {
return this.p2PTunnelLight;
@@ -63,32 +63,6 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry {
this.addNewAttunement(new ItemStack(Blocks.TORCH), TunnelType.LIGHT);
this.addNewAttunement(new ItemStack(Blocks.GLOWSTONE), TunnelType.LIGHT);
/*
* Forge energy tunnel items
*/
this.addNewAttunement(blocks.energyCellDense(), TunnelType.FE_POWER);
this.addNewAttunement(blocks.energyAcceptor(), TunnelType.FE_POWER);
this.addNewAttunement(blocks.energyCell(), TunnelType.FE_POWER);
this.addNewAttunement(blocks.energyCellCreative(), TunnelType.FE_POWER);
// FIXME this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 0 ), TunnelType.FE_POWER );
// FIXME this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 1 ), TunnelType.FE_POWER );
// FIXME this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 2 ), TunnelType.FE_POWER );
// FIXME this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 3 ), TunnelType.FE_POWER );
// FIXME this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 4 ), TunnelType.FE_POWER );
// FIXME this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 5 ), TunnelType.FE_POWER );
/**
* EU tunnel items
*/
// FIXME this.addNewAttunement( this.getModItem( "ic2", "cable", 0 ), TunnelType.IC2_POWER ); // Copper cable
// FIXME this.addNewAttunement( this.getModItem( "ic2", "cable", 1 ), TunnelType.IC2_POWER ); // Glass fibre cable
// FIXME this.addNewAttunement( this.getModItem( "ic2", "cable", 2 ), TunnelType.IC2_POWER ); // Gold cable
// FIXME this.addNewAttunement( this.getModItem( "ic2", "cable", 3 ), TunnelType.IC2_POWER ); // HV cable
// FIXME this.addNewAttunement( this.getModItem( "ic2", "cable", 4 ), TunnelType.IC2_POWER ); // Tin cable
/**
* attune based on most redstone base items.
*/
@@ -114,16 +88,6 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry {
this.addNewAttunement(new ItemStack(Blocks.HOPPER), TunnelType.ITEM);
this.addNewAttunement(new ItemStack(Blocks.CHEST), TunnelType.ITEM);
this.addNewAttunement(new ItemStack(Blocks.TRAPPED_CHEST), TunnelType.ITEM);
// FIXME this.addNewAttunement( this.getModItem( "extrautilities", "extractor_base", 0 ), TunnelType.ITEM );
// FIXME this.addNewAttunement( this.getModItem( "mekanism", "parttransmitter", 9 ), TunnelType.ITEM );
// FIXME this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_32", 0 ), TunnelType.ITEM ); // itemduct
// FIXME this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_32", 1 ), TunnelType.ITEM ); // itemduct
// FIXME // (opaque)
// FIXME this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_32", 2 ), TunnelType.ITEM ); // impulse
// FIXME // itemduct
// FIXME this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_32", 3 ), TunnelType.ITEM ); // impulse
// FIXME // itemduct
// (opaque)
/**
* attune based on lots of random item related stuff
@@ -132,18 +96,7 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry {
this.addNewAttunement(new ItemStack(Items.LAVA_BUCKET), TunnelType.FLUID);
this.addNewAttunement(new ItemStack(Items.MILK_BUCKET), TunnelType.FLUID);
this.addNewAttunement(new ItemStack(Items.WATER_BUCKET), TunnelType.FLUID);
// FIXME this.addNewAttunement( this.getModItem( "mekanism", "machineblock2", 11 ), TunnelType.FLUID );
// FIXME this.addNewAttunement( this.getModItem( "mekanism", "parttransmitter", 4 ), TunnelType.FLUID );
// FIXME this.addNewAttunement( this.getModItem( "extrautilities", "extractor_base", 6 ), TunnelType.FLUID );
// FIXME this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_16", 0 ), TunnelType.FLUID ); // fluiduct
// FIXME this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_16", 1 ), TunnelType.FLUID ); // fluiduct
// FIXME // (opaque)
// FIXME this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_16", 2 ), TunnelType.FLUID ); // fluiduct
// FIXME // hardened
// FIXME this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_16", 3 ), TunnelType.FLUID ); // fluiduct
// FIXME // hardened
// FIXME // (opaque)
// FIXME
for (final AEColor c : AEColor.values()) {
this.addNewAttunement(parts.cableGlass().stack(c, 1), TunnelType.ME);
this.addNewAttunement(parts.cableCovered().stack(c, 1), TunnelType.ME);
@@ -154,30 +107,11 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry {
/**
* attune based caps
*/
// FIXME FABRIC this.addNewAttunement(Capabilities.FORGE_ENERGY,
// TunnelType.FE_POWER);
this.addNewAttunement(FluidAttributes.EXTRACTABLE, TunnelType.FLUID);
this.addNewAttunement(FluidAttributes.INSERTABLE, TunnelType.FLUID);
this.addNewAttunement(FluidAttributes.FIXED_INV, TunnelType.FLUID);
this.addNewAttunement(FluidAttributes.GROUPED_INV, TunnelType.FLUID);
/**
* attune based on the ItemStack's modId
*/
this.addNewAttunement("thermaldynamics", TunnelType.FE_POWER);
this.addNewAttunement("thermalexpansion", TunnelType.FE_POWER);
this.addNewAttunement("thermalfoundation", TunnelType.FE_POWER);
// TODO: Remove when confirmed that the official 1.12 version of EnderIO will
// support FE.
this.addNewAttunement("enderio", TunnelType.FE_POWER);
// TODO: Remove when confirmed that the official 1.12 version of Mekanism will
// support FE.
this.addNewAttunement("mekanism", TunnelType.FE_POWER);
// TODO: Remove when support for RFTools' Powercells support is added
this.addNewAttunement("rftools", TunnelType.FE_POWER);
this.addNewAttunement("ic2", TunnelType.IC2_POWER);
}
@Override
@@ -128,6 +128,10 @@ public class FluidImportBusPart extends SharedFluidBusPart {
aeFluidStack.decStackSize(notInserted.getStackSize());
}
if (aeFluidStack.getStackSize() == 0) {
return TickRateModulation.SLOWER;
}
// Now we need to actually drain the fluid, and use the actual amount we just
// inserted
extractable.extract(filter, aeFluidStack.getAmount()); // FIXME: If there's a mismatch here, log?
@@ -0,0 +1,66 @@
package appeng.integration.modules.trenergy;
import net.minecraft.item.ItemStack;
import team.reborn.energy.Energy;
import team.reborn.energy.EnergySide;
import team.reborn.energy.EnergyStorage;
import team.reborn.energy.EnergyTier;
import appeng.api.config.Actionable;
import appeng.api.config.PowerUnits;
import appeng.api.implementations.items.IAEItemPowerStorage;
/**
* Adapts an itemstack that implements
* {@link appeng.api.implementations.items.IAEItemPowerStorage} to the interface
* used by TechReborn's energy API.
*/
public final class ItemPowerStorageAdapter implements EnergyStorage {
private final IAEItemPowerStorage item;
private final ItemStack stack;
public ItemPowerStorageAdapter(IAEItemPowerStorage item, ItemStack stack) {
this.item = item;
this.stack = stack;
}
@Override
public double getStored(EnergySide energySide) {
return PowerUnits.AE.convertTo(PowerUnits.TR, this.item.getAECurrentPower(this.stack));
}
@Override
public void setStored(double v) {
double newPower = PowerUnits.TR.convertTo(PowerUnits.AE, v);
double currentPower = this.item.getAECurrentPower(this.stack);
double toInject = newPower - currentPower;
if (toInject > 0.0000001) {
this.item.injectAEPower(stack, toInject, Actionable.MODULATE);
}
}
@Override
public double getMaxStoredPower() {
return PowerUnits.AE.convertTo(PowerUnits.TR, this.item.getAEMaxPower(this.stack));
}
@Override
public EnergyTier getTier() {
return EnergyTier.INFINITE;
}
public static void register() {
// Register our charged items as TechReborn Energy compatible
Energy.registerHolder(
(Object obj) -> obj instanceof ItemStack && ((ItemStack) obj).getItem() instanceof IAEItemPowerStorage,
(Object obj) -> {
ItemStack stack = (ItemStack) obj;
IAEItemPowerStorage item = (IAEItemPowerStorage) stack.getItem();
return new ItemPowerStorageAdapter(item, stack);
});
}
}
@@ -218,18 +218,10 @@ public abstract class P2PTunnelPart<T extends P2PTunnelPart> extends BasicStateP
newType = parts.p2PTunnelLight().maybeStack(1).orElse(ItemStack.EMPTY);
break;
case FE_POWER:
newType = parts.p2PTunnelFE().maybeStack(1).orElse(ItemStack.EMPTY);
break;
case FLUID:
newType = parts.p2PTunnelFluids().maybeStack(1).orElse(ItemStack.EMPTY);
break;
case IC2_POWER:
newType = parts.p2PTunnelEU().maybeStack(1).orElse(ItemStack.EMPTY);
break;
case ITEM:
newType = parts.p2PTunnelItems().maybeStack(1).orElse(ItemStack.EMPTY);
break;
@@ -242,12 +234,6 @@ public abstract class P2PTunnelPart<T extends P2PTunnelPart> extends BasicStateP
newType = parts.p2PTunnelRedstone().maybeStack(1).orElse(ItemStack.EMPTY);
break;
/*
* case COMPUTER_MESSAGE: for( ItemStack stack :
* parts.p2PTunnelOpenComputers().maybeStack( 1 ).asSet() ) { newType = stack; }
* break;
*/
default:
newType = ItemStack.EMPTY;
break;
@@ -18,6 +18,21 @@
package appeng.tile.powersink;
import java.util.EnumSet;
import java.util.Set;
import com.google.common.collect.ImmutableSet;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.MathHelper;
import team.reborn.energy.EnergySide;
import team.reborn.energy.EnergyStorage;
import team.reborn.energy.EnergyTier;
import appeng.api.config.AccessRestriction;
import appeng.api.config.Actionable;
import appeng.api.config.PowerMultiplier;
@@ -26,18 +41,6 @@ import appeng.api.networking.energy.IAEPowerStorage;
import appeng.api.networking.events.MENetworkPowerStorage.PowerEventType;
import appeng.core.AEConfig;
import appeng.tile.AEBaseInvBlockEntity;
import com.google.common.collect.ImmutableSet;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.MathHelper;
import team.reborn.energy.EnergySide;
import team.reborn.energy.EnergyStorage;
import team.reborn.energy.EnergyTier;
import java.util.EnumSet;
import java.util.Set;
public abstract class AEBasePoweredBlockEntity extends AEBaseInvBlockEntity
implements IAEPowerStorage, IExternalPowerSink, EnergyStorage {