Skip to content

Commit 24bb04f

Browse files
committed
Update version to 1.0.1
Sync the upstream safemanamixin fix some bugs
1 parent 0b9b557 commit 24bb04f

29 files changed

Lines changed: 509 additions & 393 deletions

codeformat/codeformat.xml

Lines changed: 199 additions & 199 deletions
Large diffs are not rendered by default.

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ enable_shadow = false
1616
enable_lwjglx = true
1717

1818
# Mod Information
19-
mod_version = 1.0.0
19+
mod_version = 1.0.1
2020
root_package = appbot
2121
mod_id = appbot
2222
mod_name = Applied Botanics
@@ -56,4 +56,4 @@ use_asset_mover = false
5656
asset_mover_version = 2.5
5757

5858
# ae2
59-
ae_mod_version = 1.0.2
59+
ae_mod_version = 1.0.6

gradle/scripts/dependencies.gradle

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ repositories {
1616
url = 'https://api.modrinth.com/maven'
1717
}
1818
mavenCentral()
19+
maven {
20+
name = 'jitpack'
21+
url = 'https://www.jitpack.io'
22+
}
1923
mavenLocal() // Must be last for caching to work
2024
}
2125

@@ -25,10 +29,8 @@ dependencies {
2529
compileOnly "com.cleanroommc:lwjglx:1.0.0"
2630
}
2731

28-
compileOnly "io.github.formlessdragon:AppliedEnergistics2-Supergiant:${ae_mod_version}:dev"
29-
modRuntimeOnly("io.github.formlessdragon:AppliedEnergistics2-Supergiant:${ae_mod_version}:dev") {
30-
transitive = false
31-
}
32+
compileOnly "com.github.FormlessDragon:Applied-Energistics-2-Supergiant:v${ae_mod_version}:dev"
33+
modRuntimeOnly "com.github.FormlessDragon:Applied-Energistics-2-Supergiant:v${ae_mod_version}:dev"
3234

3335
// 1.12.2 runtime dependencies used by the Supergiant development environment.
3436
modImplementation "curse.maven:had-enough-items-557549:7938914"

src/main/java/appbot/Appbot.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
import appbot.ae2.ManaContainerItemStrategy;
1111
import appbot.ae2.ManaExternalStorageStrategy;
12-
import appbot.ae2.ManaKey;
13-
import appbot.ae2.ManaKeyType;
12+
import appbot.ae2.AEManaKey;
13+
import appbot.ae2.AEManaKeyType;
1414
import appbot.ae2.ManaStorageExportStrategy;
1515
import appbot.ae2.ManaStorageImportStrategy;
1616

@@ -33,14 +33,14 @@ public void preInit(FMLPreInitializationEvent event) {
3333

3434
@Mod.EventHandler
3535
public void init(FMLInitializationEvent event) {
36-
AEKeyTypes.register(ManaKeyType.TYPE);
36+
AEKeyTypes.register(AEManaKeyType.TYPE);
3737

38-
StackWorldBehaviors.registerImportStrategy(ManaKeyType.TYPE, ManaStorageImportStrategy::new);
39-
StackWorldBehaviors.registerExportStrategy(ManaKeyType.TYPE, ManaStorageExportStrategy::new);
40-
StackWorldBehaviors.registerExternalStorageStrategy(ManaKeyType.TYPE, ManaExternalStorageStrategy::new);
38+
StackWorldBehaviors.registerImportStrategy(AEManaKeyType.TYPE, ManaStorageImportStrategy::new);
39+
StackWorldBehaviors.registerExportStrategy(AEManaKeyType.TYPE, ManaStorageExportStrategy::new);
40+
StackWorldBehaviors.registerExternalStorageStrategy(AEManaKeyType.TYPE, ManaExternalStorageStrategy::new);
4141

42-
ContainerItemStrategy.register(ManaKeyType.TYPE, ManaKey.class, new ManaContainerItemStrategy());
43-
GenericSlotCapacities.register(ManaKeyType.TYPE, 500000L);
42+
ContainerItemStrategy.register(AEManaKeyType.TYPE, AEManaKey.class, new ManaContainerItemStrategy());
43+
GenericSlotCapacities.register(AEManaKeyType.TYPE, 500000L);
4444

4545
ABItems.init();
4646
proxy.init(event);
Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@
1616
import ae2.api.stacks.AEKeyType;
1717
import ae2.api.stacks.AmountFormat;
1818

19-
public class ManaKey extends AEKey {
19+
public class AEManaKey extends AEKey {
2020

21-
public static final AEKey KEY = new ManaKey();
21+
public static final AEKey KEY = new AEManaKey();
2222

2323
private static final ResourceLocation ID = new ResourceLocation("botania", "mana");
2424

25-
private ManaKey() {
25+
private AEManaKey() {
2626
}
2727

2828
@Override
2929
public AEKeyType getType() {
30-
return ManaKeyType.TYPE;
30+
return AEManaKeyType.TYPE;
3131
}
3232

3333
@Override
@@ -60,7 +60,7 @@ public void addDrops(long amount, List<ItemStack> drops, World level, BlockPos p
6060

6161
@Override
6262
protected ITextComponent computeDisplayName() {
63-
return ManaKeyType.MANA;
63+
return AEManaKeyType.MANA;
6464
}
6565

6666
@Override
@@ -78,18 +78,9 @@ public Object getReadOnlyStack() {
7878
return null;
7979
}
8080

81-
@Override
82-
public boolean isTagged(String tag) {
83-
return false;
84-
}
85-
8681
@Override
8782
public NBTBase get(String componentId) {
8883
return null;
8984
}
9085

91-
@Override
92-
public boolean hasComponents() {
93-
return false;
94-
}
9586
}

src/main/java/appbot/ae2/ManaKeyType.java renamed to src/main/java/appbot/ae2/AEManaKeyType.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,26 @@
1313
import ae2.api.stacks.AEKey;
1414
import ae2.api.stacks.AEKeyType;
1515

16-
public class ManaKeyType extends AEKeyType {
16+
public class AEManaKeyType extends AEKeyType {
1717

1818
public static final ITextComponent MANA = new TextComponentTranslation("gui." + AppliedBotanics.MOD_ID + ".mana");
1919

20-
public static final AEKeyType TYPE = new ManaKeyType();
20+
public static final AEKeyType TYPE = new AEManaKeyType();
2121

22-
private ManaKeyType() {
23-
super(AppliedBotanics.id("mana"), ManaKey.class, MANA);
22+
private AEManaKeyType() {
23+
super(AppliedBotanics.id("mana"), AEManaKey.class, MANA);
2424
}
2525

2626
@Nullable
2727
@Override
2828
public AEKey readFromPacket(PacketBuffer input) {
29-
return ManaKey.KEY;
29+
return AEManaKey.KEY;
3030
}
3131

3232
@Nullable
3333
@Override
3434
public AEKey loadKeyFromTag(NBTTagCompound tag) {
35-
return ManaKey.KEY;
35+
return AEManaKey.KEY;
3636
}
3737

3838
@Override

src/main/java/appbot/ae2/MEStorageManaItem.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,24 +55,24 @@ public static IManaItem forItem(ItemStack stack) {
5555

5656
@Override
5757
public int getMana(ItemStack stack) {
58-
return (int) StorageHelper.poweredExtraction(energy, storage, ManaKey.KEY, Integer.MAX_VALUE, source,
58+
return (int) StorageHelper.poweredExtraction(energy, storage, AEManaKey.KEY, Integer.MAX_VALUE, source,
5959
Actionable.SIMULATE);
6060
}
6161

6262
@Override
6363
public int getMaxMana(ItemStack stack) {
64-
return Ints.saturatedCast(StorageHelper.poweredExtraction(energy, storage, ManaKey.KEY, Integer.MAX_VALUE,
64+
return Ints.saturatedCast(StorageHelper.poweredExtraction(energy, storage, AEManaKey.KEY, Integer.MAX_VALUE,
6565
source, Actionable.SIMULATE)
66-
+ StorageHelper.poweredInsert(energy, storage, ManaKey.KEY, Integer.MAX_VALUE, source,
66+
+ StorageHelper.poweredInsert(energy, storage, AEManaKey.KEY, Integer.MAX_VALUE, source,
6767
Actionable.SIMULATE));
6868
}
6969

7070
@Override
7171
public void addMana(ItemStack stack, int mana) {
7272
if (mana > 0) {
73-
StorageHelper.poweredInsert(energy, storage, ManaKey.KEY, mana, source);
73+
StorageHelper.poweredInsert(energy, storage, AEManaKey.KEY, mana, source);
7474
} else {
75-
StorageHelper.poweredExtraction(energy, storage, ManaKey.KEY, -mana, source);
75+
StorageHelper.poweredExtraction(energy, storage, AEManaKey.KEY, -mana, source);
7676
}
7777
}
7878

src/main/java/appbot/ae2/ManaContainerItemStrategy.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616

1717
@SuppressWarnings("UnstableApiUsage")
1818
public class ManaContainerItemStrategy
19-
implements ContainerItemStrategy<ManaKey, ManaContainerItemStrategy.ManaItemContext> {
19+
implements ContainerItemStrategy<AEManaKey, ManaContainerItemStrategy.ManaItemContext> {
2020

2121
@Override
2222
public @Nullable GenericStack getContainedStack(ItemStack stack) {
2323
var context = findManaItem(stack);
2424

2525
if (context != null) {
26-
return new GenericStack(ManaKey.KEY, context.getMana());
26+
return new GenericStack(AEManaKey.KEY, context.getMana());
2727
} else {
2828
return null;
2929
}
@@ -40,7 +40,7 @@ public class ManaContainerItemStrategy
4040
}
4141

4242
@Override
43-
public long extract(ManaItemContext item, ManaKey what, long amount, Actionable mode) {
43+
public long extract(ManaItemContext item, AEManaKey what, long amount, Actionable mode) {
4444
if (!item.canExport()) {
4545
return 0;
4646
}
@@ -55,7 +55,7 @@ public long extract(ManaItemContext item, ManaKey what, long amount, Actionable
5555
}
5656

5757
@Override
58-
public long insert(ManaItemContext item, ManaKey what, long amount, Actionable mode) {
58+
public long insert(ManaItemContext item, AEManaKey what, long amount, Actionable mode) {
5959
if (!item.canReceive()) {
6060
return 0;
6161
}
@@ -70,13 +70,13 @@ public long insert(ManaItemContext item, ManaKey what, long amount, Actionable m
7070
}
7171

7272
@Override
73-
public void playFillSound(EntityPlayer player, ManaKey what) {
73+
public void playFillSound(EntityPlayer player, AEManaKey what) {
7474
player.world.playSound(null, player.posX, player.posY, player.posZ, ModSounds.manaPoolCraft,
7575
SoundCategory.PLAYERS, 0.5F, 1.0F);
7676
}
7777

7878
@Override
79-
public void playEmptySound(EntityPlayer player, ManaKey what) {
79+
public void playEmptySound(EntityPlayer player, AEManaKey what) {
8080
player.world.playSound(null, player.posX, player.posY, player.posZ, ModSounds.blackLotus,
8181
SoundCategory.PLAYERS, 0.5F, 1.0F);
8282
}
@@ -87,7 +87,7 @@ public void playEmptySound(EntityPlayer player, ManaKey what) {
8787
return null;
8888
}
8989

90-
return new GenericStack(ManaKey.KEY, item.getMana());
90+
return new GenericStack(AEManaKey.KEY, item.getMana());
9191
}
9292

9393
private static @Nullable ManaItemContext findManaItem(ItemStack stack) {

src/main/java/appbot/ae2/ManaExternalStorageStrategy.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ private record ManaStorageAdapter(IManaReceiver receiver, Runnable changeListene
5050
MEStorage {
5151
@Override
5252
public long insert(AEKey what, long amount, Actionable mode, IActionSource source) {
53-
if (!(what instanceof ManaKey)) {
53+
if (!(what instanceof AEManaKey)) {
5454
return 0;
5555
}
5656

57-
var inserted = SafeMana.conv(receiver).insert(Ints.saturatedCast(amount), mode);
57+
var inserted = SafeMana.conv(receiver).appbot$insert(Ints.saturatedCast(amount), mode);
5858

5959
if (inserted > 0 && mode == Actionable.MODULATE) {
6060
changeListener.run();
@@ -65,11 +65,11 @@ public long insert(AEKey what, long amount, Actionable mode, IActionSource sourc
6565

6666
@Override
6767
public long extract(AEKey what, long amount, Actionable mode, IActionSource source) {
68-
if (!(what instanceof ManaKey)) {
68+
if (!(what instanceof AEManaKey)) {
6969
return 0;
7070
}
7171

72-
var extracted = SafeMana.conv(receiver).extract(Ints.saturatedCast(amount), mode);
72+
var extracted = SafeMana.conv(receiver).appbot$extract(Ints.saturatedCast(amount), mode);
7373

7474
if (extracted > 0 && mode == Actionable.MODULATE) {
7575
changeListener.run();
@@ -82,14 +82,14 @@ public long extract(AEKey what, long amount, Actionable mode, IActionSource sour
8282
public void getAvailableStacks(KeyCounter out) {
8383
var currentMana = receiver.getCurrentMana();
8484

85-
if (currentMana != 0 && (!extractableOnly || SafeMana.conv(receiver).extract(1, Actionable.SIMULATE) > 0)) {
86-
out.add(ManaKey.KEY, currentMana);
85+
if (currentMana != 0 && (!extractableOnly || SafeMana.conv(receiver).appbot$extract(1, Actionable.SIMULATE) > 0)) {
86+
out.add(AEManaKey.KEY, currentMana);
8787
}
8888
}
8989

9090
@Override
9191
public ITextComponent getDescription() {
92-
return GuiText.ExternalStorage.text(ManaKeyType.TYPE.getDescription());
92+
return GuiText.ExternalStorage.text(AEManaKeyType.TYPE.getDescription());
9393
}
9494
}
9595
}

src/main/java/appbot/ae2/ManaGenericStackInvStorage.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,20 @@ public ManaGenericStackInvStorage(GenericInternalInventory inv, World level, Blo
3333

3434
@Override
3535
public int getCurrentMana() {
36-
return extract(Integer.MAX_VALUE, Actionable.SIMULATE);
36+
return appbot$extract(Integer.MAX_VALUE, Actionable.SIMULATE);
3737
}
3838

3939
@Override
4040
public boolean isFull() {
41-
return insert(1, Actionable.SIMULATE) == 0;
41+
return appbot$insert(1, Actionable.SIMULATE) == 0;
4242
}
4343

4444
@Override
4545
public void recieveMana(int mana) {
4646
if (mana > 0) {
47-
insert(mana, Actionable.MODULATE);
47+
appbot$insert(mana, Actionable.MODULATE);
4848
} else if (mana < 0) {
49-
extract(-mana, Actionable.MODULATE);
49+
appbot$extract(-mana, Actionable.MODULATE);
5050
}
5151
}
5252

@@ -67,12 +67,12 @@ public int getMaxMana() {
6767
for (var i = 0; i < inv.size(); i++) {
6868
var key = inv.getKey(i);
6969

70-
if (key == null || key == ManaKey.KEY) {
70+
if (key == null || key == AEManaKey.KEY) {
7171
slots += 1;
7272
}
7373
}
7474

75-
return Ints.saturatedCast(slots * inv.getMaxAmount(ManaKey.KEY));
75+
return Ints.saturatedCast(slots * inv.getMaxAmount(AEManaKey.KEY));
7676
}
7777

7878
@Override
@@ -95,7 +95,7 @@ public void attachSpark(ISparkEntity entity) {
9595

9696
@Override
9797
public int getAvailableSpaceForMana() {
98-
return insert(Integer.MAX_VALUE, Actionable.SIMULATE);
98+
return appbot$insert(Integer.MAX_VALUE, Actionable.SIMULATE);
9999
}
100100

101101
@Override
@@ -117,22 +117,22 @@ public boolean areIncomingTranfersDone() {
117117
}
118118

119119
@Override
120-
public int insert(int amount, Actionable actionable) {
120+
public int appbot$insert(int amount, Actionable actionable) {
121121
var inserted = 0L;
122122

123123
for (var i = 0; i < inv.size() && inserted < amount; i++) {
124-
inserted += inv.insert(i, ManaKey.KEY, amount - inserted, actionable);
124+
inserted += inv.insert(i, AEManaKey.KEY, amount - inserted, actionable);
125125
}
126126

127127
return (int) inserted;
128128
}
129129

130130
@Override
131-
public int extract(int amount, Actionable actionable) {
131+
public int appbot$extract(int amount, Actionable actionable) {
132132
var extracted = 0L;
133133

134134
for (var i = 0; i < inv.size() && extracted < amount; i++) {
135-
extracted += inv.extract(i, ManaKey.KEY, amount - extracted, actionable);
135+
extracted += inv.extract(i, AEManaKey.KEY, amount - extracted, actionable);
136136
}
137137

138138
return (int) extracted;

0 commit comments

Comments
 (0)