Skip to content

Commit

Permalink
Merge branch 'dev/0.8' into dev/0.8-bridges
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/main/java/de/srendi/advancedperipherals/common/blocks/blockentities/MeBridgeEntity.java
  • Loading branch information
SirEndii committed Jan 22, 2025
2 parents c399500 + 708c1c7 commit f87ff29
Show file tree
Hide file tree
Showing 61 changed files with 1,257 additions and 876 deletions.
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
// 1.19.2 2024-05-28T14:53:16.653667 Tags for minecraft:item
// 1.19.2 2025-01-20T07:59:27.474151 Tags for minecraft:item
de4b4f45ec18b2b1f0db1c36882981042e20ee23 data/advancedperipherals/tags/items/p2p_attunements/cable_p2p_tunnel.json
72eba3b11f69e16c87488f7c4ba7cfdad42c378e data/advancedperipherals/tags/items/smart_glasses.json
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// 1.19.2 2025-01-16T15:59:34.693839 Languages: en_us
d0fe3ab5a88d6b925369860038c76f23d9910143 assets/advancedperipherals/lang/en_us.json
// 1.19.2 2025-01-20T07:50:09.44057 Languages: en_us
ebf2194b8fece940adb61f1ae317f68799bd498f assets/advancedperipherals/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"block.advancedperipherals.rs_bridge": "RS Bridge",
"curios.identifier.glasses": "Glasses",
"entity.minecraft.villager.advancedperipherals.computer_scientist": "Computer Scientist",
"item.advancedperipherals.cable_p2p_tunnel": "Cable P2P Tunnel",
"item.advancedperipherals.chunk_controller": "Chunk Controller",
"item.advancedperipherals.computer_tool": "Computer Tool",
"item.advancedperipherals.end_automata_core": "End Automata Core",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"values": [
"computercraft:cable",
"computercraft:wired_modem",
"computercraft:wired_modem_full"
]
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package de.srendi.advancedperipherals;

import de.srendi.advancedperipherals.common.addons.APAddons;
import de.srendi.advancedperipherals.common.addons.ae2.AE2Registries;
import de.srendi.advancedperipherals.common.configuration.APConfig;
import de.srendi.advancedperipherals.common.network.APNetworking;
import de.srendi.advancedperipherals.common.setup.APRegistration;
Expand All @@ -11,6 +12,7 @@
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
Expand All @@ -35,6 +37,7 @@ public AdvancedPeripherals() {
APConfig.register(ModLoadingContext.get());

modBus.addListener(this::commonSetup);
modBus.addListener(this::onLoadComplete);
APRegistration.register();
MinecraftForge.EVENT_BUS.register(this);
new APAddons();
Expand Down Expand Up @@ -67,4 +70,11 @@ public void commonSetup(FMLCommonSetupEvent event) {
});
}

public void onLoadComplete(FMLLoadCompleteEvent event) {
event.enqueueWork(() -> {
if (APAddons.appliedEnergisticsLoaded) {
AE2Registries.finishRegister();
}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@ public static void renderingHuds(RenderGuiOverlayEvent.Pre event) {
@SubscribeEvent
public static void playerTryDismount(InputEvent.Key event) {
Minecraft minecraft = Minecraft.getInstance();
if (!minecraft.options.keyShift.matches(event.getKey(), event.getScanCode())) {
boolean isShift = minecraft.options.keyShift.matches(event.getKey(), event.getScanCode());
if (!isShift) {
return;
}
switch (event.getAction()) {
case InputConstants.PRESS:
sneaking = true;
if (ClientRegistry.SADDLE_TURTLE_OVERLAY.isPlayerMountedOnTurtle()) {
if (ClientRegistry.SADDLE_TURTLE_OVERLAY.isPlayerControllingTurtle()) {
minecraft.options.keyShift.setDown(false);
}
break;
Expand Down Expand Up @@ -65,7 +66,7 @@ public static void playerMounting(EntityMountEvent event) {

@SubscribeEvent
public static void playerMove(MovementInputUpdateEvent event) {
if (ClientRegistry.SADDLE_TURTLE_OVERLAY.isPlayerMountedOnTurtle()) {
if (ClientRegistry.SADDLE_TURTLE_OVERLAY.isPlayerControllingTurtle()) {
Input input = event.getInput();
if (sneaking == lastSneak && lastInput != null) {
if (lastInput.up == input.up && lastInput.down == input.down && lastInput.left == input.left && lastInput.right == input.right && lastInput.jumping == input.jumping) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ protected int textWidth(FormattedCharSequence text) {
return getFont().width(text);
}

public static boolean isPlayerControllingTurtle() {
LocalPlayer player = Minecraft.getInstance().player;
return player != null && player.getVehicle() instanceof TurtleSeatEntity;
}

public static boolean isPlayerMountedOnTurtle() {
LocalPlayer player = Minecraft.getInstance().player;
return player != null && player.getRootVehicle() instanceof TurtleSeatEntity;
Expand Down Expand Up @@ -131,6 +136,7 @@ private void renderDismountHint(PoseStack stack) {
getFont().drawShadow(stack, text, x, top, 0xffffff);
}

@Override
public void render(ForgeGui gui, PoseStack poseStack, float partialTick, int screenWidth, int screenHeight) {
if (!isPlayerMountedOnTurtle()) {
return;
Expand All @@ -143,6 +149,8 @@ public void render(ForgeGui gui, PoseStack poseStack, float partialTick, int scr
if (this.shouldRenderFuelBar()) {
this.renderFuelBar(poseStack);
}
this.renderDismountHint(poseStack);
if (isPlayerControllingTurtle()) {
this.renderDismountHint(poseStack);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,38 +23,51 @@
@Mod.EventBusSubscriber(modid = AdvancedPeripherals.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
public class APAddons {

public static final String CURIOS_MODID = "curios";
public static final String REFINEDSTORAGE_MODID = "refinedstorage";
public static final String AE_ADDITIONS_MODID = "ae2additions";
public static final String AE_THINGS_MODID = "ae2things";
public static final String APPLIEDENERGISTICS_MODID = "ae2";
public static final String MEKANISM_MODID = "mekanism";
public static final String AE_ADDITIONS_MODID = "ae2additions";
public static final String APP_MEKANISTICS_MODID = "appmek";
public static final String BOTANIA_MODID = "botania";
public static final String CREATE_MODID = "create";
public static final String CURIOS_MODID = "curios";
public static final String DIMSTORAGE_MODID = "dimstorage";
public static final String MEKANISM_MODID = "mekanism";
public static final String POWAH_MODID = "powah";
public static final String REFINEDSTORAGE_MODID = "refinedstorage";
public static final String VALKYRIEN_SKIES_MODID = "valkyrienskies";

public static boolean curiosLoaded;
public static boolean refinedStorageLoaded;
public static boolean aeAdditionsLoaded;
public static boolean aeThingsLoaded;
public static boolean appMekLoaded;
public static boolean appliedEnergisticsLoaded;
public static boolean botaniaLoaded;
public static boolean createLoaded;
public static boolean curiosLoaded;
public static boolean dimstorageLoaded;
public static boolean mekanismLoaded;
public static boolean aeAdditionsLoaded;
public static boolean appMekLoaded;
public static boolean powahLoaded;
public static boolean refinedStorageLoaded;
public static boolean vs2Loaded;

// Use static so these checks run as early as possible, so we can use them for our registries
static {
ModList modList = ModList.get();
curiosLoaded = modList.isLoaded(CURIOS_MODID);
refinedStorageLoaded = modList.isLoaded(REFINEDSTORAGE_MODID);
appliedEnergisticsLoaded = modList.isLoaded(APPLIEDENERGISTICS_MODID);
mekanismLoaded = modList.isLoaded(MEKANISM_MODID);
aeThingsLoaded = modList.isLoaded(AE_THINGS_MODID);
aeAdditionsLoaded = modList.isLoaded(AE_ADDITIONS_MODID);
aeThingsLoaded = modList.isLoaded(AE_THINGS_MODID);
appMekLoaded = modList.isLoaded(APP_MEKANISTICS_MODID);
appliedEnergisticsLoaded = modList.isLoaded(APPLIEDENERGISTICS_MODID);
botaniaLoaded = modList.isLoaded(BOTANIA_MODID);
createLoaded = modList.isLoaded(CREATE_MODID);
curiosLoaded = modList.isLoaded(CURIOS_MODID);
dimstorageLoaded = modList.isLoaded(DIMSTORAGE_MODID);
mekanismLoaded = modList.isLoaded(MEKANISM_MODID);
powahLoaded = modList.isLoaded(POWAH_MODID);
refinedStorageLoaded = modList.isLoaded(REFINEDSTORAGE_MODID);
vs2Loaded = modList.isLoaded(VALKYRIEN_SKIES_MODID);

if (refinedStorageLoaded)
if (refinedStorageLoaded) {
RefinedStorage.instance = new RefinedStorage();
}
}

@SubscribeEvent
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package de.srendi.advancedperipherals.common.addons.ae2;

import appeng.api.features.P2PTunnelAttunement;
import appeng.api.parts.IPart;
import appeng.api.parts.IPartItem;
import appeng.api.parts.PartModels;
import appeng.items.parts.PartItem;
import appeng.items.parts.PartModelsHelper;
import dan200.computercraft.shared.Registry.ModItems;
import de.srendi.advancedperipherals.common.setup.APRegistration;
import net.minecraft.data.tags.TagsProvider;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Item;
import net.minecraftforge.registries.RegistryObject;

import java.util.function.Function;

public final class AE2Registries {
private AE2Registries() {}

public static final RegistryObject<PartItem<WiredCableP2PTunnelPart>> CABLE_P2P_TUNNEL = registerPart("cable_p2p_tunnel", WiredCableP2PTunnelPart.class, WiredCableP2PTunnelPart::new);

private static <T extends IPart> RegistryObject<PartItem<T>> registerPart(String id, Class<T> clazz, Function<IPartItem<T>, T> factory) {
PartModels.registerModels(PartModelsHelper.createModels(clazz));
return APRegistration.ITEMS.register(id, () -> new PartItem<>(new Item.Properties(), clazz, factory));
}

public static void finishRegister() {
P2PTunnelAttunement.registerAttunementTag(CABLE_P2P_TUNNEL.get());
}

public static TagKey<Item> getCableP2PTag() {
return P2PTunnelAttunement.getAttunementTag(CABLE_P2P_TUNNEL.get());
}

public static void registerTags(Function<TagKey<Item>, TagsProvider.TagAppender<Item>> tagger) {
tagger.apply(getCableP2PTag())
.add(ModItems.CABLE.get())
.add(ModItems.WIRED_MODEM.get())
.add(ModItems.WIRED_MODEM_FULL.get());
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.srendi.advancedperipherals.common.addons.appliedenergistics;
package de.srendi.advancedperipherals.common.addons.ae2;

import appeng.api.crafting.IPatternDetails;
import appeng.api.inventories.InternalInventory;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.srendi.advancedperipherals.common.addons.appliedenergistics;
package de.srendi.advancedperipherals.common.addons.ae2;

import appeng.api.networking.IGrid;
import appeng.api.networking.IGridNode;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.srendi.advancedperipherals.common.addons.appliedenergistics;
package de.srendi.advancedperipherals.common.addons.ae2;

import appeng.api.networking.IGridNode;
import appeng.api.networking.IGridNodeListener;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.srendi.advancedperipherals.common.addons.appliedenergistics;
package de.srendi.advancedperipherals.common.addons.ae2;

import appeng.api.config.Actionable;
import appeng.api.networking.security.IActionSource;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.srendi.advancedperipherals.common.addons.appliedenergistics;
package de.srendi.advancedperipherals.common.addons.ae2;

import appeng.api.config.Actionable;
import appeng.api.networking.security.IActionSource;
Expand Down
Loading

0 comments on commit f87ff29

Please sign in to comment.