This repository has been archived by the owner on Oct 4, 2024. It is now read-only.
generated from GregTech-Intergalactical/ExampleMod
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added cape stuff from gti/gt4r to de-duplicate it
- Loading branch information
Showing
16 changed files
with
429 additions
and
0 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
18 changes: 18 additions & 0 deletions
18
common/src/main/java/io/github/gregtechintergalactical/gtcore/data/GTCoreData.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,18 @@ | ||
package io.github.gregtechintergalactical.gtcore.data; | ||
|
||
import io.github.gregtechintergalactical.gtcore.GTCore; | ||
import net.minecraft.resources.ResourceLocation; | ||
|
||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
public class GTCoreData { | ||
private static final String CAPE_PATH = "textures/capes/"; | ||
public static final ResourceLocation[] CAPE_LOCATIONS = new ResourceLocation[] {new ResourceLocation(GTCore.ID, CAPE_PATH + "braintech.png"), new ResourceLocation(GTCore.ID, CAPE_PATH + "silver.png"), new ResourceLocation(GTCore.ID, CAPE_PATH + "mrbrain.png"), new ResourceLocation(GTCore.ID, CAPE_PATH + "dev.png"), new ResourceLocation(GTCore.ID, CAPE_PATH + "gold.png"), new ResourceLocation(GTCore.ID, CAPE_PATH + "crazy.png"), new ResourceLocation(GTCore.ID, CAPE_PATH + "fake.png")}; | ||
|
||
public static final Set<String> SupporterListSilver = new HashSet<>(), SupporterListGold = new HashSet<>(); | ||
|
||
public static void init(){ | ||
|
||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
.../java/io/github/gregtechintergalactical/gtcore/mixin/AbstractClientPlayerEntityMixin.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,41 @@ | ||
package io.github.gregtechintergalactical.gtcore.mixin; | ||
|
||
import com.mojang.authlib.GameProfile; | ||
import io.github.gregtechintergalactical.gtcore.data.GTCoreData; | ||
import muramasa.antimatter.util.AntimatterPlatformUtils; | ||
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<ResourceLocation> info){ | ||
String playerName = this.getDisplayName().getString(); | ||
if (!AntimatterPlatformUtils.isProduction()) info.setReturnValue(GTCoreData.CAPE_LOCATIONS[3]); | ||
if (orString(playerName, "GregoriusT", "OvermindDL1", "jihuayu123", "Yuesha_Kev14", "Evanvenir", "Trinsdar")) info.setReturnValue(GTCoreData.CAPE_LOCATIONS[3]); | ||
if (playerName.equals("CrazyJ1984")) info.setReturnValue(GTCoreData.CAPE_LOCATIONS[5]); | ||
if (playerName.equals("Mr_Brain")) info.setReturnValue(GTCoreData.CAPE_LOCATIONS[2]); | ||
if (playerName.equals("Friedi4321")) info.setReturnValue(GTCoreData.CAPE_LOCATIONS[0]); | ||
if (GTCoreData.SupporterListGold.contains(playerName)) info.setReturnValue(GTCoreData.CAPE_LOCATIONS[4]); | ||
if (GTCoreData.SupporterListSilver.contains(playerName)) info.setReturnValue(GTCoreData.CAPE_LOCATIONS[1]); | ||
} | ||
|
||
private boolean orString(String compare, String... strings){ | ||
List<String> list = List.of(strings); | ||
return list.contains(compare); | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
common/src/main/java/io/github/gregtechintergalactical/gtcore/proxy/CommonHandler.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,59 @@ | ||
package io.github.gregtechintergalactical.gtcore.proxy; | ||
|
||
import io.github.gregtechintergalactical.gtcore.GTCore; | ||
import net.minecraft.core.NonNullList; | ||
|
||
import java.net.URL; | ||
import java.util.List; | ||
import java.util.Scanner; | ||
|
||
import static io.github.gregtechintergalactical.gtcore.data.GTCoreData.SupporterListGold; | ||
import static io.github.gregtechintergalactical.gtcore.data.GTCoreData.SupporterListSilver; | ||
|
||
public class CommonHandler { | ||
public static void setup(){ | ||
new Thread(() -> { | ||
|
||
List<String> | ||
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(GTCore.class.getResourceAsStream("/supporterlist.txt")); | ||
while (tScanner.hasNextLine()) SupporterListSilver.add(tScanner.nextLine().toLowerCase()); | ||
tScanner.close(); | ||
GTCore.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(GTCore.class.getResourceAsStream("/supporterlistgold.txt")); | ||
while (tScanner.hasNextLine()) SupporterListGold.add(tScanner.nextLine().toLowerCase()); | ||
tScanner.close(); | ||
GTCore.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<String> downloadTextFile(String aURL, boolean aLowercase) { | ||
List<String> 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")) { | ||
GTCore.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) { | ||
GTCore.LOGGER.error("GT_DL_Thread: Failed to Connect."); | ||
} | ||
return null; | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+8.76 KB
common/src/main/resources/assets/gtcore/textures/capes/minecon-2013-128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
|
@@ -7,5 +7,8 @@ | |
"MixinBlock", | ||
"MixinComposterBlock", | ||
"MixinMerchantOffer" | ||
], | ||
"client": [ | ||
"AbstractClientPlayerEntityMixin" | ||
] | ||
} |
Oops, something went wrong.