diff --git a/common/src/main/java/muramasa/gregtech/GregTech.java b/common/src/main/java/muramasa/gregtech/GregTech.java index aaae875ea..8c35888ca 100644 --- a/common/src/main/java/muramasa/gregtech/GregTech.java +++ b/common/src/main/java/muramasa/gregtech/GregTech.java @@ -24,6 +24,7 @@ import muramasa.gregtech.loader.machines.generator.Fuels; import muramasa.gregtech.loader.machines.generator.LargeBoilerLoader; import muramasa.gregtech.loader.multi.*; +import muramasa.gregtech.proxy.CommonHandler; import muramasa.gregtech.proxy.ServerHandler; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -174,6 +175,7 @@ public void onRegistrationEvent(RegistrationEvent event, Side side) { l.addAll(Arrays.asList(CircuitBasicIntegrated, CircuitGoodIntegrated, CircuitWetware, MicroProcessor, IntegratedProcessor, NanoProcessor, QuantumProcessor)); } }); + AntimatterAPI.runLaterCommon(CommonHandler::setup); // if (side == Dist.CLIENT) StructureInfo.init(); TierMaps.providerInit(); } diff --git a/common/src/main/java/muramasa/gregtech/data/GregTechData.java b/common/src/main/java/muramasa/gregtech/data/GregTechData.java index 12ae1caeb..00e4b92fe 100644 --- a/common/src/main/java/muramasa/gregtech/data/GregTechData.java +++ b/common/src/main/java/muramasa/gregtech/data/GregTechData.java @@ -24,6 +24,7 @@ import muramasa.gregtech.cover.*; import muramasa.gregtech.cover.redstone.CoverRedstoneMachineController; import net.minecraft.core.BlockPos; +import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.Block; @@ -34,12 +35,20 @@ import net.minecraft.world.level.material.Fluids; import net.minecraft.world.level.material.MaterialColor; +import java.util.HashSet; +import java.util.Set; + import static muramasa.gregtech.data.Materials.*; public class GregTechData { private static final boolean HC = AntimatterConfig.GAMEPLAY.HARDCORE_CABLES; + private static final String CAPE_PATH = "textures/capes/"; + public static final ResourceLocation[] CAPE_LOCATIONS = new ResourceLocation[] {new ResourceLocation(GTIRef.ID, CAPE_PATH + "braintech.png"), new ResourceLocation(GTIRef.ID, CAPE_PATH + "silver.png"), new ResourceLocation(GTIRef.ID, CAPE_PATH + "mrbrain.png"), new ResourceLocation(GTIRef.ID, CAPE_PATH + "dev.png"), new ResourceLocation(GTIRef.ID, CAPE_PATH + "gold.png"), new ResourceLocation(GTIRef.ID, CAPE_PATH + "crazy.png"), new ResourceLocation(GTIRef.ID, CAPE_PATH + "fake.png")}; + + public static final Set SupporterListSilver = new HashSet<>(), SupporterListGold = new HashSet<>(); + public static void init(Side side) { if (side == Side.CLIENT) RecipeMaps.clientMaps(); diff --git a/common/src/main/java/muramasa/gregtech/mixin/AbstractClientPlayerEntityMixin.java b/common/src/main/java/muramasa/gregtech/mixin/AbstractClientPlayerEntityMixin.java new file mode 100644 index 000000000..d504510cb --- /dev/null +++ b/common/src/main/java/muramasa/gregtech/mixin/AbstractClientPlayerEntityMixin.java @@ -0,0 +1,42 @@ +package muramasa.gregtech.mixin; + +import com.mojang.authlib.GameProfile; +import muramasa.antimatter.AntimatterAPI; +import muramasa.antimatter.util.AntimatterPlatformUtils; +import muramasa.gregtech.data.GregTechData; +import net.minecraft.client.player.AbstractClientPlayer; +import net.minecraft.core.BlockPos; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.Level; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +import java.util.List; + +@Mixin(AbstractClientPlayer.class) +public abstract class AbstractClientPlayerEntityMixin extends Player { + + public AbstractClientPlayerEntityMixin(Level p_i241920_1_, BlockPos p_i241920_2_, float p_i241920_3_, GameProfile p_i241920_4_) { + super(p_i241920_1_, p_i241920_2_, p_i241920_3_, p_i241920_4_); + } + + @Inject(method = "getCloakTextureLocation", at = @At(value = "HEAD"), cancellable = true) + private void getLocationGTCape(CallbackInfoReturnable info){ + String playerName = this.getDisplayName().getString(); + if (!AntimatterPlatformUtils.isProduction()) info.setReturnValue(GregTechData.CAPE_LOCATIONS[3]); + if (orString(playerName, "GregoriusT", "OvermindDL1", "jihuayu123", "Yuesha_Kev14", "Evanvenir", "Trinsdar")) info.setReturnValue(GregTechData.CAPE_LOCATIONS[3]); + if (playerName.equals("CrazyJ1984")) info.setReturnValue(GregTechData.CAPE_LOCATIONS[5]); + if (playerName.equals("Mr_Brain")) info.setReturnValue(GregTechData.CAPE_LOCATIONS[2]); + if (playerName.equals("Friedi4321")) info.setReturnValue(GregTechData.CAPE_LOCATIONS[0]); + if (GregTechData.SupporterListGold.contains(playerName)) info.setReturnValue(GregTechData.CAPE_LOCATIONS[4]); + if (GregTechData.SupporterListSilver.contains(playerName)) info.setReturnValue(GregTechData.CAPE_LOCATIONS[1]); + } + + private boolean orString(String compare, String... strings){ + List list = List.of(strings); + return list.contains(compare); + } +} diff --git a/common/src/main/java/muramasa/gregtech/proxy/CommonHandler.java b/common/src/main/java/muramasa/gregtech/proxy/CommonHandler.java new file mode 100644 index 000000000..8f496019e --- /dev/null +++ b/common/src/main/java/muramasa/gregtech/proxy/CommonHandler.java @@ -0,0 +1,59 @@ +package muramasa.gregtech.proxy; + +import muramasa.gregtech.GregTech; +import net.minecraft.core.NonNullList; + +import java.net.URL; +import java.util.List; +import java.util.Scanner; + +import static muramasa.gregtech.data.GregTechData.SupporterListGold; +import static muramasa.gregtech.data.GregTechData.SupporterListSilver; + +public class CommonHandler { + public static void setup(){ + new Thread(() -> { + + List + tTextFile = downloadTextFile("updates.gregtech.mechaenetia.com/com/gregoriust/gregtech/supporterlist.txt", false); + if (tTextFile != null && tTextFile.size() > 3) { + SupporterListSilver.addAll(tTextFile); + } else try { + Scanner tScanner = new Scanner(GregTech.class.getResourceAsStream("/supporterlist.txt")); + while (tScanner.hasNextLine()) SupporterListSilver.add(tScanner.nextLine().toLowerCase()); + tScanner.close(); + GregTech.LOGGER.warn("GT_DL_Thread: Failed downloading Silver Supporter List, using interal List!"); + } catch(Throwable exc) {exc.printStackTrace();} + + tTextFile = downloadTextFile("updates.gregtech.mechaenetia.com/com/gregoriust/gregtech/supporterlistgold.txt", false); + if (tTextFile != null && tTextFile.size() > 3) { + SupporterListGold.addAll(tTextFile); + } else try { + Scanner tScanner = new Scanner(GregTech.class.getResourceAsStream("/supporterlistgold.txt")); + while (tScanner.hasNextLine()) SupporterListGold.add(tScanner.nextLine().toLowerCase()); + tScanner.close(); + GregTech.LOGGER.warn("GT_DL_Thread: Failed downloading Gold Supporter List, using interal List!"); + } catch(Throwable exc) {exc.printStackTrace();} + + SupporterListSilver.removeAll(SupporterListGold); + + }).start(); + } + + protected static List downloadTextFile(String aURL, boolean aLowercase) { + List rList = NonNullList.create(); + try { + Scanner tScanner = new Scanner(new URL(aURL.startsWith("http")?aURL:"https://"+aURL).openStream()); + while (tScanner.hasNextLine()) rList.add(aLowercase ? tScanner.nextLine().toLowerCase() : tScanner.nextLine()); + tScanner.close(); + for (String tLine : rList) if (tLine.contains("a href")) { + GregTech.LOGGER.error("GT_DL_Thread: Your Internet Connection has Issues, you should probably go check that your ISP or Network don't do stupid Stuff."); + return NonNullList.create(); + } + return rList; + } catch(Throwable f) { + GregTech.LOGGER.error("GT_DL_Thread: Failed to Connect."); + } + return null; + } +} diff --git a/common/src/main/resources/assets/gti/textures/capes/braintech.png b/common/src/main/resources/assets/gti/textures/capes/braintech.png new file mode 100644 index 000000000..4daeb1f18 Binary files /dev/null and b/common/src/main/resources/assets/gti/textures/capes/braintech.png differ diff --git a/common/src/main/resources/assets/gti/textures/capes/braintech.xcf b/common/src/main/resources/assets/gti/textures/capes/braintech.xcf new file mode 100644 index 000000000..a352c708a Binary files /dev/null and b/common/src/main/resources/assets/gti/textures/capes/braintech.xcf differ diff --git a/common/src/main/resources/assets/gti/textures/capes/crazy.png b/common/src/main/resources/assets/gti/textures/capes/crazy.png new file mode 100644 index 000000000..197179ae0 Binary files /dev/null and b/common/src/main/resources/assets/gti/textures/capes/crazy.png differ diff --git a/common/src/main/resources/assets/gti/textures/capes/dev.png b/common/src/main/resources/assets/gti/textures/capes/dev.png new file mode 100644 index 000000000..f5738ccb6 Binary files /dev/null and b/common/src/main/resources/assets/gti/textures/capes/dev.png differ diff --git a/common/src/main/resources/assets/gti/textures/capes/fake.png b/common/src/main/resources/assets/gti/textures/capes/fake.png new file mode 100644 index 000000000..673a74f3d Binary files /dev/null and b/common/src/main/resources/assets/gti/textures/capes/fake.png differ diff --git a/common/src/main/resources/assets/gti/textures/capes/gold.png b/common/src/main/resources/assets/gti/textures/capes/gold.png new file mode 100644 index 000000000..b62e3a618 Binary files /dev/null and b/common/src/main/resources/assets/gti/textures/capes/gold.png differ diff --git a/common/src/main/resources/assets/gti/textures/capes/minecon-2013-128.png b/common/src/main/resources/assets/gti/textures/capes/minecon-2013-128.png new file mode 100644 index 000000000..955daae7a Binary files /dev/null and b/common/src/main/resources/assets/gti/textures/capes/minecon-2013-128.png differ diff --git a/common/src/main/resources/assets/gti/textures/capes/mrbrain.png b/common/src/main/resources/assets/gti/textures/capes/mrbrain.png new file mode 100644 index 000000000..116a5b8c7 Binary files /dev/null and b/common/src/main/resources/assets/gti/textures/capes/mrbrain.png differ diff --git a/common/src/main/resources/assets/gti/textures/capes/silver.png b/common/src/main/resources/assets/gti/textures/capes/silver.png new file mode 100644 index 000000000..6c8771949 Binary files /dev/null and b/common/src/main/resources/assets/gti/textures/capes/silver.png differ diff --git a/common/src/main/resources/forge/GT4ReimaginedForge.java b/common/src/main/resources/forge/GT4ReimaginedForge.java new file mode 100644 index 000000000..57c07a1b3 --- /dev/null +++ b/common/src/main/resources/forge/GT4ReimaginedForge.java @@ -0,0 +1,39 @@ +package trinsdar.gt4r.forge; + +import net.minecraftforge.fml.DistExecutor; +import net.minecraftforge.fml.ModLoadingContext; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.config.ModConfig; +import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; +import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; +import net.minecraftforge.fml.event.lifecycle.FMLDedicatedServerSetupEvent; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; +import trinsdar.gt4r.GT4RConfig; +import trinsdar.gt4r.GT4Reimagined; +import trinsdar.gt4r.Ref; +import trinsdar.gt4r.proxy.ClientHandler; +import trinsdar.gt4r.proxy.CommonHandler; +import trinsdar.gt4r.proxy.ServerHandler; + +@Mod(Ref.ID) +public class GT4ReimaginedForge { + public GT4ReimaginedForge(){ + new GT4Reimagined(); + GT4Reimagined.PROXY = DistExecutor.runForDist(() -> ClientHandler::new, () -> ServerHandler::new); // todo: scheduled to change in new Forge + FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); + FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientSetup); + FMLJavaModLoadingContext.get().getModEventBus().addListener(this::serverSetup); + ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, GT4RConfig.COMMON_SPEC); + } + + private void clientSetup(final FMLClientSetupEvent e) { + ClientHandler.setup(); + } + + private void setup(final FMLCommonSetupEvent e) { + CommonHandler.setup(); + } + + private void serverSetup(final FMLDedicatedServerSetupEvent event){ + } +} diff --git a/common/src/main/resources/forge/mixin/GTCapabilityProviderAccessor.java b/common/src/main/resources/forge/mixin/GTCapabilityProviderAccessor.java new file mode 100644 index 000000000..c2eb54f7f --- /dev/null +++ b/common/src/main/resources/forge/mixin/GTCapabilityProviderAccessor.java @@ -0,0 +1,16 @@ +package trinsdar.gt4r.forge.mixin; + +import net.minecraftforge.common.capabilities.CapabilityDispatcher; +import net.minecraftforge.common.capabilities.CapabilityProvider; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +import javax.annotation.Nullable; + +@Mixin(CapabilityProvider.class) +public interface GTCapabilityProviderAccessor { + + @Accessor(value = "capabilities", remap = false) + @Nullable + CapabilityDispatcher getCapabilitiesGT(); +} diff --git a/common/src/main/resources/gregtech.mixins.json b/common/src/main/resources/gregtech.mixins.json new file mode 100644 index 000000000..6465941e0 --- /dev/null +++ b/common/src/main/resources/gregtech.mixins.json @@ -0,0 +1,9 @@ +{ + "required": true, + "package": "muramasa.gregtech.mixin", + "compatibilityLevel": "JAVA_8", + "client": [ + "AbstractClientPlayerEntityMixin" + ], + "minVersion": "0.8" +} \ No newline at end of file diff --git a/common/src/main/resources/supporterlist.txt b/common/src/main/resources/supporterlist.txt new file mode 100644 index 000000000..817923f8e --- /dev/null +++ b/common/src/main/resources/supporterlist.txt @@ -0,0 +1,248 @@ +OvermindDL1 +Ngar +k0jul +Mehrin +kehaan +Lehran +Yabdat +Goshen +e99999 +leagris +Buuz135 +Vash505 +tyra_oa +jorstar +Ilirith +Totilus +ICaxapI +DragDen +Lagarex +repo_alt +Schlaibi +Axlegear +djflippy +Raganork +TheSkera +DarkYuan +Ferelwing +seregheru +Bear989Sr +Bear989jr +BloodyAsp +kei_kouma +laurynasl +Trilexcom +abestone2 +TOFUFreak +Asturrial +CrazyJ1984 +ElectroBot +buizerd007 +negersvend +KrotanHill +mtimmerije +MTesseracT +MarconosII +pitchcherry +adamcirillo +DarthUmbris +crepes_r_us +TheWorstPHO +GrandKaiser +mrgreenacid +stephen_2015 +PrivateDijon +SweetyLizard +FPSaddiction +InsaneyHaney +WindowsBunny +Demosthenexx +Sovereignty89 +ihategravel22 +GeekTechMedia +123mcprorot123 +Nicholas_Manuel +ArcturusCercilus +DoughnutDev +adamros +alexbegt +manf +Plem +bsaa +Heph +dungi +tworf +Hegik +Stute +SpwnX +Kadah +kanni +Bimgo +Ray_CZ +boredi +cdaser +renadi +x_Fame +Nullav +Onlyme +t3hero +Hotchi +jagoly +BH5432 +Sibmer +Sirbab +inceee +foxxx0 +Hartok +TMSama +Shlnen +Carsso +Cerous +Azuxul +Nohicom +Stijn_A +fry_lad +Moothox +Flaver4 +Jirajha +Dracion +zessirb +meep310 +Seldron +freebug +hohounk +yttr1um +Sylphio +jmarler +semig0d +GeoStyx +Ashleee +XanderT +Asutoro +TexanMD +Xyic0re +estebes +danirpg +Mileaos2 +hanakocz +demanzke +Zero Tw0 +Kris1432 +r00teniy +Neonbeta +yinscape +voooon24 +Quintine +Peach774 +lepthymo +bildeman +Kremnari +Saberawr +Aerosalo +invultri +Axlegear +Lushiita +crdl_pls +Morehatz +stepgoku +__tomm__ +456Xander +cmclouser +phone1246 +Bladezz88 +Ralacroix +kei_kouma +grillo126 +samuraijp +OndraSter +oscares91 +Daxx367x2 +Metonymia +VlexStone +MomoNasty +EGERTRONx +djshiny99 +megatronp +DZCreeper +Kane_Hart +Truculent +vidplace7 +simon6689 +Johnstaal +Abouttabs +aka13_404 +ManuCortex +UltraPeeks +xavier0014 +Resursator +melanclock +bpgames123 +Samalingus +UnknownXLV +goreacraft +9000bowser +malcanteth +BadAlchemy +ultrasn0wz +NanoHeart_ +FenixElite +Spungebubb +ProperSAMA +Cerulean627 +msmilkshake +Thanatos_00 +Beardedflea +MysteryDump +Bkarlsson87 +Fluttermine +Misha999777 +Daddy_Cecil +MrMaleficus +TigersFangs +NikitaBuker +cublikefoot +chainman564 +Berserker66 +Dorfschwein +Briareos1981 +XxinsanityxX +Ultimaheart4 +Ultimabunny4 +MiniKatalyst +Deathlycraft +CaballoCraft +Devilin_Pixy +mattiagraz85 +xander_cage_ +Malevolence_ +25FiveDetail +AntiCivilBoy +Three_Pounds +michaelbrady +sebastiank30 +Sovereignty89 +Speedynutty68 +GarretSidzaka +ArchonCerulean +MatthieuLeDieu +I_h4te_M0nd4ys +HallowCharm977 +mastermind1919 +diamondguy2798 +The_Hypersonic +LuxusDarkangel +Pit_of_Darkness +AndrewAmmerlaan +zF4ll3nPr3d4t0r +Nicholas_Manuel +CodingWithClass +Goshen_Ithilien +SuterusuKusanagi +CrafterOfMines57 +XxELIT3xSNIP3RxX +IAmMinecrafter02 +kastaxoxo +Twigpick +Mine_Sasha +codewarrior +SuperCoder79 diff --git a/common/src/main/resources/supporterlistgold.txt b/common/src/main/resources/supporterlistgold.txt new file mode 100644 index 000000000..528a6253f --- /dev/null +++ b/common/src/main/resources/supporterlistgold.txt @@ -0,0 +1,57 @@ +OvermindDL1 +Ngar +k0jul +Mehrin +kehaan +Lehran +Yabdat +Goshen +e99999 +leagris +Buuz135 +Vash505 +tyra_oa +jorstar +Ilirith +Totilus +ICaxapI +DragDen +Lagarex +repo_alt +Schlaibi +Axlegear +djflippy +DarkYuan +Ferelwing +seregheru +Bear989Sr +BloodyAsp +kei_kouma +laurynasl +Trilexcom +abestone2 +TOFUFreak +Asturrial +CrazyJ1984 +ElectroBot +buizerd007 +KrotanHill +mtimmerije +MTesseracT +MarconosII +adamcirillo +DarthUmbris +GrandKaiser +crepes_r_us +TheWorstPHO +mrgreenacid +stephen_2015 +PrivateDijon +SweetyLizard +FPSaddiction +InsaneyHaney +WindowsBunny +Demosthenexx +Sovereignty89 +ihategravel22 +123mcprorot123 diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index b1b64b9ec..9126d01c7 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -15,6 +15,7 @@ "issues": "https://github.com/GregTech-Intergalactical/GregTech/issues", "discord": "https://discord.gg/9kM4bRj" }, + "mixins": ["gregtech.mixins.json"], "license": "LGPL-3.0", "depends": { "fabricloader": ">=0.14.0", diff --git a/forge/build.gradle b/forge/build.gradle index 2679bb1c9..8b1f7ae5d 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -32,6 +32,7 @@ loom{ arg "--existing", file("src/main/resources").absolutePath } } + mixinConfigs("gregtech.mixins.json") } } @@ -65,8 +66,8 @@ dependencies { //JEI //modRuntimeOnly("mezz.jei:jei-${rootProject.minecraft_version}-forge:${rootProject.jei_version}") modCompileOnly "me.shedaniel:RoughlyEnoughItems-forge:${rootProject.rei_version}" - //modRuntimeOnly "me.shedaniel:RoughlyEnoughItems-forge:${rootProject.rei_version}" - modRuntimeOnly("mezz.jei:jei-1.18.2:9.7.2.281") + modRuntimeOnly "me.shedaniel:RoughlyEnoughItems-forge:${rootProject.rei_version}" + //modRuntimeOnly("mezz.jei:jei-1.18.2:9.7.2.281") modImplementation("com.github.Reforged-Mods:ARRP-forge:0.6.7-1.18.2") modRuntimeOnly("io.github.feltmc:fluidhandler-extras:1.0.1") implementation("io.github.gregtechintergalactical:gtrubber-forge:${rootProject.gt_rubber_version}-${rootProject.minecraft_version}:dev-shadow"){