Skip to content

Commit 50c2207

Browse files
committed
Various clean-ups
1 parent c2955fe commit 50c2207

File tree

12 files changed

+88
-100
lines changed

12 files changed

+88
-100
lines changed

README.md

+12-13
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
1-
<center>
2-
<h2 align="center">
3-
<a href="https://github.com/62832/MEGACells"><img src="https://raw.githubusercontent.com/62832/MEGACells/1.20/img/MEGACELLS.png" alt="MEGA Cells"></a>
4-
<p>ME Greater Accumulation: For when kilobytes just won't do.</p>
1+
<h2 align="center">
2+
3+
[![MEGA Cells][logo]][this]
4+
<br>
5+
ME Greater Accumulation: For when kilobytes just won't do.
56

67
[![CurseForge Total Downloads][badge_curseforge]][curseforge]
78
[![Modrinth Total Downloads][badge_modrinth]][modrinth]
89

9-
</h2>
10-
</center>
11-
12-
<center>
13-
<div align="center">
14-
<img src="https://raw.githubusercontent.com/62832/MEGACells/1.20/img/scr_cpus.png" alt="Crafting CPUs screenshot" width=360>
15-
<img src="https://raw.githubusercontent.com/62832/MEGACells/1.20/img/scr_cells.png" alt="Storage cells screenshot" width=360>
16-
</div>
17-
</center>
10+
</h2>
11+
<div align="center">
12+
<img src="https://raw.githubusercontent.com/62832/MEGACells/1.20/img/scr_cpus.png" alt="Crafting CPUs screenshot" width=360>
13+
<img src="https://raw.githubusercontent.com/62832/MEGACells/1.20/img/scr_cells.png" alt="Storage cells screenshot" width=360>
14+
</div>
1815
<br>
1916

2017
## ![About][header_about]
@@ -38,13 +35,15 @@ All code is licensed under [LGPLv3][lgpl-v3], in adherence to the same license u
3835
All assets are licensed under [CC BY-NC-SA 3.0][by-nc-sa-3.0], in adherence to the same license used by AE2 and with most deriving from AE2's own assets.
3936

4037
<!-- Images -->
38+
[logo]: https://raw.githubusercontent.com/62832/MEGACells/1.20/img/MEGACELLS.png
4139
[badge_curseforge]: https://img.shields.io/badge/dynamic/json?color=e04e14&label=CurseForge&style=for-the-badge&query=downloads.total&url=https%3A%2F%2Fapi.cfwidget.com%2F622112&logo=curseforge
4240
[badge_modrinth]: https://img.shields.io/modrinth/dt/jjuIRIVr?color=5da545&label=Modrinth&style=for-the-badge&logo=modrinth
4341
[header_about]: https://raw.githubusercontent.com/62832/MEGACells/1.20/img/header_about.png
4442
[header_features]: https://raw.githubusercontent.com/62832/MEGACells/1.20/img/header_features.png
4543
[header_license]: https://raw.githubusercontent.com/62832/MEGACells/1.20/img/header_license.png
4644

4745
<!-- Links -->
46+
[this]: https://github.com/62832/MEGACells
4847
[curseforge]: https://www.curseforge.com/minecraft/mc-mods/mega-cells
4948
[modrinth]: https://modrinth.com/mod/mega
5049
[ae2]: https://github.com/AppliedEnergistics/Applied-Energistics-2

common/src/data/java/gripe/_90/megacells/datagen/AppBotHousingRecipeProvider.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
import vazkii.botania.data.recipes.TerrestrialAgglomerationProvider;
2121

2222
public class AppBotHousingRecipeProvider extends TerrestrialAgglomerationProvider {
23-
public AppBotHousingRecipeProvider(PackOutput packOutput) {
24-
super(packOutput);
23+
public AppBotHousingRecipeProvider(PackOutput output) {
24+
super(output);
2525
}
2626

2727
@Override

common/src/main/java/gripe/_90/megacells/block/MEGAInterfaceBlock.java

+7-6
Original file line numberDiff line numberDiff line change
@@ -10,34 +10,35 @@
1010
import net.minecraft.world.level.Level;
1111
import net.minecraft.world.phys.BlockHitResult;
1212

13+
import appeng.block.AEBaseBlock;
1314
import appeng.block.AEBaseEntityBlock;
1415
import appeng.menu.locator.MenuLocators;
1516
import appeng.util.InteractionUtil;
1617

1718
import gripe._90.megacells.block.entity.MEGAInterfaceBlockEntity;
1819

1920
public class MEGAInterfaceBlock extends AEBaseEntityBlock<MEGAInterfaceBlockEntity> {
20-
public MEGAInterfaceBlock(Properties props) {
21-
super(props);
21+
public MEGAInterfaceBlock() {
22+
super(AEBaseBlock.metalProps());
2223
}
2324

2425
@Override
2526
public InteractionResult onActivated(
2627
Level level,
2728
BlockPos pos,
28-
Player p,
29+
Player player,
2930
InteractionHand hand,
3031
@Nullable ItemStack heldItem,
3132
BlockHitResult hit) {
32-
if (InteractionUtil.isInAlternateUseMode(p)) {
33+
if (InteractionUtil.isInAlternateUseMode(player)) {
3334
return InteractionResult.PASS;
3435
}
3536

36-
var be = getBlockEntity(level, pos);
37+
var be = this.getBlockEntity(level, pos);
3738

3839
if (be != null) {
3940
if (!level.isClientSide()) {
40-
be.openMenu(p, MenuLocators.forBlockEntity(be));
41+
be.openMenu(player, MenuLocators.forBlockEntity(be));
4142
}
4243

4344
return InteractionResult.sidedSuccess(level.isClientSide());

common/src/main/java/gripe/_90/megacells/block/MEGAPatternProviderBlock.java

+19-15
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@
1212
import net.minecraft.world.level.block.Block;
1313
import net.minecraft.world.level.block.state.BlockState;
1414
import net.minecraft.world.level.block.state.StateDefinition;
15+
import net.minecraft.world.level.block.state.properties.EnumProperty;
1516
import net.minecraft.world.phys.BlockHitResult;
1617

1718
import appeng.api.networking.IManagedGridNode;
19+
import appeng.block.AEBaseBlock;
1820
import appeng.block.AEBaseEntityBlock;
1921
import appeng.block.crafting.PatternProviderBlock;
2022
import appeng.block.crafting.PushDirection;
@@ -31,28 +33,30 @@
3133

3234
@SuppressWarnings("deprecation")
3335
public class MEGAPatternProviderBlock extends AEBaseEntityBlock<MEGAPatternProviderBlockEntity> {
34-
public MEGAPatternProviderBlock(Properties props) {
35-
super(props);
36-
registerDefaultState(defaultBlockState().setValue(PatternProviderBlock.PUSH_DIRECTION, PushDirection.ALL));
36+
private static final EnumProperty<PushDirection> PUSH_DIRECTION = PatternProviderBlock.PUSH_DIRECTION;
37+
38+
public MEGAPatternProviderBlock() {
39+
super(AEBaseBlock.metalProps());
40+
registerDefaultState(defaultBlockState().setValue(PUSH_DIRECTION, PushDirection.ALL));
3741
}
3842

3943
public static PatternProviderLogic createLogic(IManagedGridNode mainNode, PatternProviderLogicHost host) {
4044
var logic = new PatternProviderLogic(mainNode, host, 18);
41-
((AppEngInternalInventory) logic.getPatternInv())
42-
.setFilter(new AEItemDefinitionFilter(AEItems.PROCESSING_PATTERN));
45+
var filter = new AEItemDefinitionFilter(AEItems.PROCESSING_PATTERN);
46+
((AppEngInternalInventory) logic.getPatternInv()).setFilter(filter);
4347
return logic;
4448
}
4549

4650
@Override
4751
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
4852
super.createBlockStateDefinition(builder);
49-
builder.add(PatternProviderBlock.PUSH_DIRECTION);
53+
builder.add(PUSH_DIRECTION);
5054
}
5155

5256
@Override
5357
public void neighborChanged(
5458
BlockState state, Level level, BlockPos pos, Block block, BlockPos fromPos, boolean isMoving) {
55-
var be = this.getBlockEntity(level, pos);
59+
var be = getBlockEntity(level, pos);
5660

5761
if (be != null) {
5862
be.getLogic().updateRedstoneState();
@@ -63,11 +67,11 @@ public void neighborChanged(
6367
public InteractionResult onActivated(
6468
Level level,
6569
BlockPos pos,
66-
Player p,
70+
Player player,
6771
InteractionHand hand,
6872
@Nullable ItemStack heldItem,
6973
BlockHitResult hit) {
70-
if (InteractionUtil.isInAlternateUseMode(p)) {
74+
if (InteractionUtil.isInAlternateUseMode(player)) {
7175
return InteractionResult.PASS;
7276
}
7377

@@ -76,11 +80,11 @@ public InteractionResult onActivated(
7680
return InteractionResult.sidedSuccess(level.isClientSide());
7781
}
7882

79-
var be = this.getBlockEntity(level, pos);
83+
var be = getBlockEntity(level, pos);
8084

8185
if (be != null) {
8286
if (!level.isClientSide()) {
83-
be.openMenu(p, MenuLocators.forBlockEntity(be));
87+
be.openMenu(player, MenuLocators.forBlockEntity(be));
8488
}
8589

8690
return InteractionResult.sidedSuccess(level.isClientSide());
@@ -89,12 +93,12 @@ public InteractionResult onActivated(
8993
return InteractionResult.PASS;
9094
}
9195

92-
public void setSide(Level level, BlockPos pos, Direction facing) {
96+
private void setSide(Level level, BlockPos pos, Direction facing) {
9397
var currentState = level.getBlockState(pos);
94-
var pushSide =
95-
currentState.getValue(PatternProviderBlock.PUSH_DIRECTION).getDirection();
98+
var pushSide = currentState.getValue(PUSH_DIRECTION).getDirection();
9699

97100
PushDirection newPushDirection;
101+
98102
if (pushSide == facing.getOpposite()) {
99103
newPushDirection = PushDirection.fromDirection(facing);
100104
} else if (pushSide == facing) {
@@ -105,6 +109,6 @@ public void setSide(Level level, BlockPos pos, Direction facing) {
105109
newPushDirection = PushDirection.fromDirection(Platform.rotateAround(pushSide, facing));
106110
}
107111

108-
level.setBlockAndUpdate(pos, currentState.setValue(PatternProviderBlock.PUSH_DIRECTION, newPushDirection));
112+
level.setBlockAndUpdate(pos, currentState.setValue(PUSH_DIRECTION, newPushDirection));
109113
}
110114
}

common/src/main/java/gripe/_90/megacells/definition/MEGABlocks.java

+2-8
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,6 @@ public static List<BlockDefinition<?>> getBlocks() {
4343
return Collections.unmodifiableList(BLOCKS);
4444
}
4545

46-
private static final BlockBehaviour.Properties props = BlockBehaviour.Properties.of()
47-
.strength(2.2f, 11.0f)
48-
.mapColor(MapColor.METAL)
49-
.sound(SoundType.METAL)
50-
.forceSolidOn();
51-
5246
public static final BlockDefinition<AEDecorativeBlock> SKY_STEEL_BLOCK = block(
5347
"Sky Steel Block",
5448
"sky_steel_block",
@@ -107,11 +101,11 @@ public static List<BlockDefinition<?>> getBlocks() {
107101
() -> AEParts.STORAGE_MONITOR);
108102

109103
public static final BlockDefinition<MEGAInterfaceBlock> MEGA_INTERFACE =
110-
block("MEGA Interface", "mega_interface", () -> new MEGAInterfaceBlock(props), AEBaseBlockItem::new);
104+
block("MEGA Interface", "mega_interface", MEGAInterfaceBlock::new, AEBaseBlockItem::new);
111105
public static final BlockDefinition<MEGAPatternProviderBlock> MEGA_PATTERN_PROVIDER = block(
112106
"MEGA Pattern Provider",
113107
"mega_pattern_provider",
114-
() -> new MEGAPatternProviderBlock(props),
108+
MEGAPatternProviderBlock::new,
115109
MEGAPatternProviderBlockItem::new);
116110

117111
private static <T extends Block> BlockDefinition<T> craftingBlock(

common/src/main/java/gripe/_90/megacells/definition/MEGAConfig.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88

99
import gripe._90.megacells.MEGACells;
1010

11-
@SuppressWarnings({"FieldCanBeLocal", "FieldMayBeFinal"})
11+
@SuppressWarnings({"CanBeFinal", "FieldCanBeLocal", "FieldMayBeFinal"})
1212
@Config(name = MEGACells.MODID)
1313
public final class MEGAConfig implements ConfigData {
1414
@ConfigEntry.Gui.Excluded
1515
public static MEGAConfig INSTANCE;
1616

17+
private MEGAConfig() {}
18+
1719
@ConfigEntry.Gui.Tooltip
1820
@ConfigEntry.BoundedDiscrete(min = 2, max = 12)
1921
private int CompressionChainLimit = 3;

common/src/main/java/gripe/_90/megacells/definition/MEGACreativeTab.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ public final class MEGACreativeTab {
2222
.displayItems(MEGACreativeTab::populateTab)
2323
.build();
2424

25-
private static void populateTab(
26-
CreativeModeTab.ItemDisplayParameters itemDisplayParameters, CreativeModeTab.Output output) {
25+
private static void populateTab(CreativeModeTab.ItemDisplayParameters ignored, CreativeModeTab.Output output) {
2726
var itemDefs = new ArrayList<ItemDefinition<?>>();
2827
itemDefs.addAll(MEGAItems.getItems());
2928
itemDefs.addAll(MEGABlocks.getBlocks());

common/src/main/java/gripe/_90/megacells/definition/MEGAItems.java

+17-18
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
import net.minecraft.Util;
99
import net.minecraft.world.item.Item;
1010

11+
import appeng.api.parts.IPart;
12+
import appeng.api.parts.IPartItem;
1113
import appeng.api.parts.PartModels;
1214
import appeng.api.stacks.AEKeyType;
1315
import appeng.core.definitions.ItemDefinition;
@@ -108,30 +110,21 @@ public static List<ItemDefinition<?>> getItems() {
108110
public static final ItemDefinition<DecompressionPatternItem> DECOMPRESSION_PATTERN =
109111
item("Decompression Pattern", "decompression_pattern", DecompressionPatternItem::new);
110112

111-
public static final ItemDefinition<PartItem<MEGAInterfacePart>> MEGA_INTERFACE = Util.make(() -> {
112-
PartModels.registerModels(PartModelsHelper.createModels(MEGAInterfacePart.class));
113-
return item(
114-
"MEGA Interface",
115-
"cable_mega_interface",
116-
p -> new PartItem<>(p, MEGAInterfacePart.class, MEGAInterfacePart::new));
117-
});
113+
public static final ItemDefinition<PartItem<MEGAInterfacePart>> MEGA_INTERFACE =
114+
part("MEGA Interface", "cable_mega_interface", MEGAInterfacePart.class, MEGAInterfacePart::new);
118115
public static final ItemDefinition<MEGAPatternProviderPartItem> MEGA_PATTERN_PROVIDER = Util.make(() -> {
119116
PartModels.registerModels(PartModelsHelper.createModels(MEGAPatternProviderPart.class));
120117
return item("MEGA Pattern Provider", "cable_mega_pattern_provider", MEGAPatternProviderPartItem::new);
121118
});
122119

123-
public static final ItemDefinition<PartItem<DecompressionModulePart>> DECOMPRESSION_MODULE = Util.make(() -> {
124-
PartModels.registerModels(PartModelsHelper.createModels(DecompressionModulePart.class));
125-
return item(
126-
"MEGA Decompression Module",
127-
"decompression_module",
128-
p -> new PartItem<>(p, DecompressionModulePart.class, DecompressionModulePart::new));
129-
});
120+
public static final ItemDefinition<PartItem<DecompressionModulePart>> DECOMPRESSION_MODULE = part(
121+
"MEGA Decompression Module",
122+
"decompression_module",
123+
DecompressionModulePart.class,
124+
DecompressionModulePart::new);
130125

131-
public static final ItemDefinition<PartItem<CellDockPart>> CELL_DOCK = Util.make(() -> {
132-
PartModels.registerModels(PartModelsHelper.createModels(CellDockPart.class));
133-
return item("ME Cell Dock", "cell_dock", p -> new PartItem<>(p, CellDockPart.class, CellDockPart::new));
134-
});
126+
public static final ItemDefinition<PartItem<CellDockPart>> CELL_DOCK =
127+
part("ME Cell Dock", "cell_dock", CellDockPart.class, CellDockPart::new);
135128

136129
public static List<ItemDefinition<?>> getItemCells() {
137130
return List.of(ITEM_CELL_1M, ITEM_CELL_4M, ITEM_CELL_16M, ITEM_CELL_64M, ITEM_CELL_256M);
@@ -216,6 +209,12 @@ private static ItemDefinition<MEGAPortableCell> fluidPortable(StorageTier tier)
216209
p -> new MEGAPortableCell(p, tier, AEKeyType.fluids(), MEStorageMenu.PORTABLE_FLUID_CELL_TYPE, 0xF1C5));
217210
}
218211

212+
private static <T extends IPart> ItemDefinition<PartItem<T>> part(
213+
String englishName, String id, Class<T> partClass, Function<IPartItem<T>, T> factory) {
214+
PartModels.registerModels(PartModelsHelper.createModels(partClass));
215+
return item(englishName, id, p -> new PartItem<>(p, partClass, factory));
216+
}
217+
219218
public static <T extends Item> ItemDefinition<T> item(
220219
String englishName, String id, Function<Item.Properties, T> factory) {
221220
var definition = new ItemDefinition<>(englishName, MEGACells.makeId(id), factory.apply(new Item.Properties()));

common/src/main/java/gripe/_90/megacells/item/cell/BulkCellInventory.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import static gripe._90.megacells.definition.MEGAItems.COMPRESSION_CARD;
44

55
import java.math.BigInteger;
6+
import java.util.Collections;
67
import java.util.Set;
78

89
import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet;
@@ -124,7 +125,8 @@ private Set<IPatternDetails> generateDecompressionPatterns() {
124125
}
125126

126127
var patterns = new ObjectLinkedOpenHashSet<IPatternDetails>();
127-
var decompressionChain = compressionChain.limited().reversed();
128+
var decompressionChain = compressionChain.limited();
129+
Collections.reverse(decompressionChain);
128130

129131
for (var variant : decompressionChain) {
130132
if (variant == decompressionChain.get(decompressionChain.size() - 1)) {

0 commit comments

Comments
 (0)