This repository has been archived by the owner on Nov 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 32
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
20 changed files
with
485 additions
and
2 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
42 changes: 42 additions & 0 deletions
42
common/src/main/java/muramasa/gregtech/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,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<ResourceLocation> 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<String> list = List.of(strings); | ||
return list.contains(compare); | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
common/src/main/java/muramasa/gregtech/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 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<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(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<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")) { | ||
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; | ||
} | ||
} |
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/gti/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 |
---|---|---|
@@ -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){ | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
common/src/main/resources/forge/mixin/GTCapabilityProviderAccessor.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,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(); | ||
} |
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,9 @@ | ||
{ | ||
"required": true, | ||
"package": "muramasa.gregtech.mixin", | ||
"compatibilityLevel": "JAVA_8", | ||
"client": [ | ||
"AbstractClientPlayerEntityMixin" | ||
], | ||
"minVersion": "0.8" | ||
} |
Oops, something went wrong.