Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Creative Energy Anchor (Neutronium energy cell attached on cable) #624

Merged
merged 15 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/main/java/appeng/api/definitions/IParts.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ public interface IParts {

IItemDefinition quartzFiber();

IItemDefinition partCreativeEnergy();

IItemDefinition toggleBus();

IItemDefinition invertedToggleBus();
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/appeng/api/definitions/Parts.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ public class Parts {

public AEItemDefinition partQuartzFiber;

public AEItemDefinition partCreativeEnergy;

public AEItemDefinition partToggleBus;

public AEItemDefinition partInvertedToggleBus;
Expand Down
1 change: 1 addition & 0 deletions src/main/java/appeng/core/Registration.java
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ private void assignParts(final Parts target, final IParts source) {
// target.partLumenCableGlass = source.lumenCableGlass();
// target.partLumenCableDense = source.lumenCableDense();
target.partQuartzFiber = this.converter.of(source.quartzFiber());
target.partCreativeEnergy = this.converter.of(source.partCreativeEnergy());
target.partToggleBus = this.converter.of(source.toggleBus());
target.partInvertedToggleBus = this.converter.of(source.invertedToggleBus());
target.partStorageBus = this.converter.of(source.storageBus());
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/appeng/core/api/definitions/ApiParts.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public final class ApiParts implements IParts {
// private final AEColoredItemDefinition lumenCableGlass;
// private final AEColoredItemDefinition lumenCableDense;
private final IItemDefinition quartzFiber;
private final IItemDefinition partCreativeEnergy;
private final IItemDefinition toggleBus;
private final IItemDefinition invertedToggleBus;
private final IItemDefinition storageBus;
Expand Down Expand Up @@ -88,6 +89,7 @@ public ApiParts(final DefinitionConstructor constructor, final IPartHelper partH
// this.lumenCableGlass = Optional.absent(); // has yet to be implemented, no PartType defined for it yet
// this.lumenCableDense = Optional.absent(); // has yet to be implemented, no PartType defined for it yet
this.quartzFiber = new DamagedItemDefinition(itemMultiPart.createPart(PartType.QuartzFiber));
this.partCreativeEnergy = new DamagedItemDefinition(itemMultiPart.createPart(PartType.PartCreativeEnergy));
this.toggleBus = new DamagedItemDefinition(itemMultiPart.createPart(PartType.ToggleBus));
this.invertedToggleBus = new DamagedItemDefinition(itemMultiPart.createPart(PartType.InvertedToggleBus));
this.storageBus = new DamagedItemDefinition(itemMultiPart.createPart(PartType.StorageBus));
Expand Down Expand Up @@ -189,6 +191,11 @@ public IItemDefinition quartzFiber() {
return this.quartzFiber;
}

@Override
public IItemDefinition partCreativeEnergy() {
return this.partCreativeEnergy;
}

@Override
public IItemDefinition toggleBus() {
return this.toggleBus;
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/appeng/items/parts/PartType.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import appeng.parts.networking.PartCableCovered;
import appeng.parts.networking.PartCableGlass;
import appeng.parts.networking.PartCableSmart;
import appeng.parts.networking.PartCreativeEnergy;
import appeng.parts.networking.PartDenseCable;
import appeng.parts.networking.PartDenseCableCovered;
import appeng.parts.networking.PartQuartzFiber;
Expand Down Expand Up @@ -212,7 +213,10 @@ public boolean isCable() {
PartInterfaceTerminal.class),

PatternTerminalEx(500, EnumSet.of(AEFeature.Patterns), EnumSet.noneOf(IntegrationType.class),
PartPatternTerminalEx.class);
PartPatternTerminalEx.class),

PartCreativeEnergy(690, EnumSet.of(AEFeature.Core), EnumSet.noneOf(IntegrationType.class),
PartCreativeEnergy.class);

public final int baseDamage;
private final Set<AEFeature> features;
Expand Down
107 changes: 107 additions & 0 deletions src/main/java/appeng/parts/networking/PartCreativeEnergy.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
package appeng.parts.networking;

import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.item.ItemStack;

import org.lwjgl.opengl.GL11;

import appeng.api.config.AccessRestriction;
import appeng.api.config.Actionable;
import appeng.api.config.PowerMultiplier;
import appeng.api.networking.energy.IAEPowerStorage;
import appeng.api.parts.IPartCollisionHelper;
import appeng.api.parts.IPartRenderHelper;
import appeng.client.texture.CableBusTextures;
import appeng.parts.AEBasePart;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class PartCreativeEnergy extends AEBasePart implements IAEPowerStorage {

public PartCreativeEnergy(final ItemStack is) {
super(is);
this.getProxy().setIdlePowerUsage(0);
}

@Override
public void getBoxes(final IPartCollisionHelper bch) {
bch.addBox(6, 6, 11, 10, 10, 12);
bch.addBox(4, 4, 12, 12, 12, 13);
}

@Override
@SideOnly(Side.CLIENT)
public void renderInventory(final IPartRenderHelper rh, final RenderBlocks renderer) {
GL11.glTranslated(-0.2, -0.3, 0.0);

rh.setTexture(
CableBusTextures.PartTunnelSides.getIcon(),
CableBusTextures.PartTunnelSides.getIcon(),
CableBusTextures.BlockP2PTunnel2.getIcon(),
this.getItemStack().getIconIndex(),
CableBusTextures.PartTunnelSides.getIcon(),
CableBusTextures.PartTunnelSides.getIcon());
rh.setBounds(4.0f, 4.0f, 8.0f, 12.0f, 12.0f, 9.0f);
rh.renderInventoryBox(renderer);
}

@Override
@SideOnly(Side.CLIENT)
public void renderStatic(final int x, final int y, final int z, final IPartRenderHelper rh,
final RenderBlocks renderer) {
rh.setTexture(
CableBusTextures.PartTunnelSides.getIcon(),
CableBusTextures.PartTunnelSides.getIcon(),
CableBusTextures.BlockP2PTunnel2.getIcon(),
this.getItemStack().getIconIndex(),
CableBusTextures.PartTunnelSides.getIcon(),
CableBusTextures.PartTunnelSides.getIcon());
rh.setBounds(4, 4, 12, 12, 12, 13);
rh.renderBlock(x, y, z, renderer);

rh.setTexture(CableBusTextures.BlockP2PTunnel2.getIcon());

rh.setBounds(6, 6, 11, 10, 10, 12);
rh.renderBlock(x, y, z, renderer);
}

@Override
public int cableConnectionRenderTo() {
return 16;
}

@Override
public double injectAEPower(final double amt, final Actionable mode) {
return 0;
}

@Override
public double getAEMaxPower() {
return Long.MAX_VALUE / 10000;
}

@Override
public double getAECurrentPower() {
return Long.MAX_VALUE / 10000;
}

@Override
public boolean isAEPublicPowerStorage() {
return true;
}

@Override
public AccessRestriction getPowerFlow() {
return AccessRestriction.READ_WRITE;
}

@Override
public boolean isInfinite() {
return true;
}

@Override
public double extractAEPower(final double amt, final Actionable mode, final PowerMultiplier pm) {
return amt;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,7 @@ item.appliedenergistics2.ItemPart.P2PTunnel.name=P2P Tunnel
item.appliedenergistics2.ItemPart.PatternTerminal.name=ME Pattern Terminal
item.appliedenergistics2.ItemPart.PatternTerminalEx.name=ME Processing Pattern Terminal
item.appliedenergistics2.ItemPart.QuartzFiber.name=Quartz Fiber
item.appliedenergistics2.ItemPart.PartCreativeEnergy.name=Creative Energy Anchor
item.appliedenergistics2.ItemPart.StorageBus.name=ME Storage Bus
item.appliedenergistics2.ItemPart.Terminal.name=ME Terminal
item.appliedenergistics2.ItemPart.CraftingTerminal.name=ME Crafting Terminal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ import=network/parts/quartz-fiber.recipe
import=network/parts/terminals.recipe
import=network/parts/toggle-buses.recipe
import=network/parts/tunnels.recipe
import=network/parts/part-creative-energy-cell.recipe
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
shapeless=
ae2:ItemPart.CableAnchor ae2:BlockCreativeEnergyCell
-> 1 ae2:ItemPart.PartCreativeEnergy
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading