-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
473 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
forge/src/main/java/gripe/_90/megacells/integration/appliede/AppliedEIntegration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package gripe._90.megacells.integration.appliede; | ||
|
||
import net.minecraft.world.inventory.MenuType; | ||
import net.minecraft.world.item.BlockItem; | ||
|
||
import appeng.core.definitions.BlockDefinition; | ||
import appeng.core.definitions.ItemDefinition; | ||
import appeng.items.parts.PartItem; | ||
|
||
import gripe._90.appliede.me.misc.EMCInterfaceLogicHost; | ||
import gripe._90.megacells.MEGACells; | ||
import gripe._90.megacells.definition.MEGABlockEntities; | ||
import gripe._90.megacells.definition.MEGABlocks; | ||
import gripe._90.megacells.definition.MEGAItems; | ||
import gripe._90.megacells.definition.MEGAMenus; | ||
|
||
public final class AppliedEIntegration { | ||
public static final BlockDefinition<MEGAEMCInterfaceBlock> EMC_INTERFACE = MEGABlocks.block( | ||
"MEGA Transmutation Interface", "mega_emc_interface", MEGAEMCInterfaceBlock::new, BlockItem::new); | ||
public static final ItemDefinition<PartItem<MEGAEMCInterfacePart>> CABLE_EMC_INTERFACE = MEGAItems.part( | ||
"MEGA Transmutation Interface", | ||
"cable_mega_emc_interface", | ||
MEGAEMCInterfacePart.class, | ||
MEGAEMCInterfacePart::new); | ||
public static final MenuType<MEGAEMCInterfaceMenu> EMC_INTERFACE_MENU = | ||
MEGAMenus.create("mega_emc_interface", MEGAEMCInterfaceMenu::new, EMCInterfaceLogicHost.class); | ||
|
||
static { | ||
MEGABlockEntities.create( | ||
"mega_emc_interface", | ||
MEGAEMCInterfaceBlockEntity.class, | ||
MEGAEMCInterfaceBlockEntity::new, | ||
EMC_INTERFACE); | ||
} | ||
|
||
public static void init() { | ||
MEGACells.LOGGER.info("Initialised AppliedE integration."); | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
forge/src/main/java/gripe/_90/megacells/integration/appliede/MEGAEMCInterfaceBlock.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package gripe._90.megacells.integration.appliede; | ||
|
||
import org.jetbrains.annotations.Nullable; | ||
|
||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.world.InteractionHand; | ||
import net.minecraft.world.InteractionResult; | ||
import net.minecraft.world.entity.player.Player; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.level.Level; | ||
import net.minecraft.world.phys.BlockHitResult; | ||
|
||
import appeng.block.AEBaseEntityBlock; | ||
import appeng.menu.locator.MenuLocators; | ||
import appeng.util.InteractionUtil; | ||
|
||
public class MEGAEMCInterfaceBlock extends AEBaseEntityBlock<MEGAEMCInterfaceBlockEntity> { | ||
public MEGAEMCInterfaceBlock() { | ||
super(metalProps()); | ||
} | ||
|
||
@Override | ||
public InteractionResult onActivated( | ||
Level level, | ||
BlockPos pos, | ||
Player player, | ||
InteractionHand hand, | ||
@Nullable ItemStack heldItem, | ||
BlockHitResult hit) { | ||
if (!InteractionUtil.isInAlternateUseMode(player)) { | ||
var be = getBlockEntity(level, pos); | ||
|
||
if (be != null) { | ||
if (!level.isClientSide()) { | ||
be.openMenu(player, MenuLocators.forBlockEntity(be)); | ||
} | ||
|
||
return InteractionResult.sidedSuccess(level.isClientSide()); | ||
} | ||
} | ||
|
||
return InteractionResult.PASS; | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
...e/src/main/java/gripe/_90/megacells/integration/appliede/MEGAEMCInterfaceBlockEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package gripe._90.megacells.integration.appliede; | ||
|
||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.world.entity.player.Player; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.level.block.entity.BlockEntityType; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
|
||
import appeng.menu.ISubMenu; | ||
import appeng.menu.MenuOpener; | ||
import appeng.menu.locator.MenuLocator; | ||
|
||
import gripe._90.appliede.block.EMCInterfaceBlockEntity; | ||
import gripe._90.appliede.me.misc.EMCInterfaceLogic; | ||
|
||
public class MEGAEMCInterfaceBlockEntity extends EMCInterfaceBlockEntity { | ||
public MEGAEMCInterfaceBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) { | ||
super(type, pos, state); | ||
} | ||
|
||
@Override | ||
protected EMCInterfaceLogic createLogic() { | ||
return new EMCInterfaceLogic(getMainNode(), this, 18); | ||
} | ||
|
||
@Override | ||
public void openMenu(Player player, MenuLocator locator) { | ||
MenuOpener.open(AppliedEIntegration.EMC_INTERFACE_MENU, player, locator); | ||
} | ||
|
||
@Override | ||
public void returnToMainMenu(Player player, ISubMenu subMenu) { | ||
MenuOpener.returnTo(AppliedEIntegration.EMC_INTERFACE_MENU, player, subMenu.getLocator()); | ||
} | ||
|
||
@Override | ||
public ItemStack getMainMenuIcon() { | ||
return AppliedEIntegration.EMC_INTERFACE.stack(); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
forge/src/main/java/gripe/_90/megacells/integration/appliede/MEGAEMCInterfaceMenu.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package gripe._90.megacells.integration.appliede; | ||
|
||
import net.minecraft.world.entity.player.Inventory; | ||
|
||
import gripe._90.appliede.me.misc.EMCInterfaceLogicHost; | ||
import gripe._90.appliede.menu.EMCInterfaceMenu; | ||
|
||
public class MEGAEMCInterfaceMenu extends EMCInterfaceMenu { | ||
public MEGAEMCInterfaceMenu(int id, Inventory playerInventory, EMCInterfaceLogicHost host) { | ||
super(AppliedEIntegration.EMC_INTERFACE_MENU, id, playerInventory, host); | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
forge/src/main/java/gripe/_90/megacells/integration/appliede/MEGAEMCInterfacePart.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package gripe._90.megacells.integration.appliede; | ||
|
||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.entity.player.Player; | ||
import net.minecraft.world.item.ItemStack; | ||
|
||
import appeng.api.parts.IPartItem; | ||
import appeng.api.parts.IPartModel; | ||
import appeng.core.AppEng; | ||
import appeng.items.parts.PartModels; | ||
import appeng.menu.ISubMenu; | ||
import appeng.menu.MenuOpener; | ||
import appeng.menu.locator.MenuLocator; | ||
import appeng.parts.PartModel; | ||
|
||
import gripe._90.appliede.me.misc.EMCInterfaceLogic; | ||
import gripe._90.appliede.part.EMCInterfacePart; | ||
import gripe._90.megacells.MEGACells; | ||
|
||
public class MEGAEMCInterfacePart extends EMCInterfacePart { | ||
private static final ResourceLocation MODEL_BASE = MEGACells.makeId("part/mega_emc_interface"); | ||
|
||
@PartModels | ||
public static final PartModel MODELS_OFF = new PartModel(MODEL_BASE, AppEng.makeId("part/interface_off")); | ||
|
||
@PartModels | ||
public static final PartModel MODELS_ON = new PartModel(MODEL_BASE, AppEng.makeId("part/interface_on")); | ||
|
||
@PartModels | ||
public static final PartModel MODELS_HAS_CHANNEL = | ||
new PartModel(MODEL_BASE, AppEng.makeId("part/interface_has_channel")); | ||
|
||
public MEGAEMCInterfacePart(IPartItem<?> partItem) { | ||
super(partItem); | ||
} | ||
|
||
@Override | ||
protected EMCInterfaceLogic createLogic() { | ||
return new EMCInterfaceLogic(getMainNode(), this, 18); | ||
} | ||
|
||
@Override | ||
public void openMenu(Player player, MenuLocator locator) { | ||
MenuOpener.open(AppliedEIntegration.EMC_INTERFACE_MENU, player, locator); | ||
} | ||
|
||
@Override | ||
public void returnToMainMenu(Player player, ISubMenu subMenu) { | ||
MenuOpener.returnTo(AppliedEIntegration.EMC_INTERFACE_MENU, player, subMenu.getLocator()); | ||
} | ||
|
||
@Override | ||
public IPartModel getStaticModels() { | ||
if (isActive() && isPowered()) { | ||
return MODELS_HAS_CHANNEL; | ||
} else if (isPowered()) { | ||
return MODELS_ON; | ||
} else { | ||
return MODELS_OFF; | ||
} | ||
} | ||
|
||
@Override | ||
public ItemStack getMainMenuIcon() { | ||
return AppliedEIntegration.CABLE_EMC_INTERFACE.stack(); | ||
} | ||
} |
Oops, something went wrong.