Skip to content

Commit

Permalink
Fix GTCEu dependency and remove chat messages for other players with …
Browse files Browse the repository at this point in the history
…Lithium Carbonate
  • Loading branch information
bruberu committed Aug 5, 2023
1 parent 6cef7d8 commit a6b52bb
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 31 deletions.
3 changes: 1 addition & 2 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ dependencies {
implementation 'zone.rong:mixinbooter:7.0'

implementation "CraftTweaker2:CraftTweaker2-MC1120-Main:1.12-4.1.20.554"
//deobfCompile "curse.maven:gregtechceu-557242:3612824"
implementation rfg.deobf("curse.maven:gregtech-ce-unofficial-557242:4644635")
implementation "team.chisel.ctm:CTM:MC${project.minecraft.version}-1.0.2.31"
//provided files("libs/gregicality-1.12.2-0.23.1.jar")
implementation "codechicken:ChickenASM:1.12-1.0.2.9"
Expand All @@ -56,7 +56,6 @@ dependencies {
//compile "curse.maven:spiceoflife-220811:2571951"

//implementation files("libs/gregtech-1.12.2-2.6.2-beta-dev.jar")
implementation rfg.deobf("curse.maven:gregtech-ce-unofficial-557242:4641113")
implementation files("libs/AppleSkin-mc1.12-1.0.9.jar")
implementation files("libs/groovyscript-0.4.0.jar")
implementation files("libs/NuclearCraft-2o.6.0-1.12.2.jar")
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
56 changes: 32 additions & 24 deletions gradlew.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
@if "%DEBUG%" == "" @echo off
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
Expand All @@ -9,19 +25,23 @@
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Expand All @@ -35,7 +55,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init
if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
Expand All @@ -45,38 +65,26 @@ echo location of your Java installation.

goto fail

:init
@rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%

:mainEnd
if "%OS%"=="Windows_NT" endlocal
Expand Down
26 changes: 22 additions & 4 deletions src/main/java/gregtechfoodoption/ClientProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ChatType;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraftforge.client.event.ClientChatReceivedEvent;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.client.event.RenderLivingEvent;
import net.minecraftforge.client.event.RenderPlayerEvent;
import net.minecraftforge.event.entity.living.PotionEvent;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.Mod;
Expand Down Expand Up @@ -51,7 +56,7 @@ public void preLoad() {
@Override
public void onLoad() {
super.onLoad();
if(Loader.isModLoaded("appleskin")) {
if (Loader.isModLoaded("appleskin")) {
GTFOMetaTooltipOverlay.init();
GTFOMetaHUDOverlay.init();
}
Expand Down Expand Up @@ -92,11 +97,24 @@ public static void addWaterBucketFertilizerTooltip(@Nonnull ItemTooltipEvent eve
}

@SubscribeEvent
public static void checkIfPlayerIsSane(RenderLivingEvent.Pre event) {
EntityPlayer player = Minecraft.getMinecraft().player;
if (player != null && player.isPotionActive(AntiSchizoPotion.INSTANCE) && event.getEntity() instanceof EntityPlayer && !event.getEntity().isEntityEqual(player)) {
public static void removeOtherPlayerMessages(ClientChatReceivedEvent event) {
if (Minecraft.getMinecraft().player.isPotionActive(AntiSchizoPotion.INSTANCE) && event.getType() == ChatType.CHAT) {
if (event.getMessage() instanceof TextComponentTranslation chatMessage
&& chatMessage.getFormatArgs()[0] instanceof TextComponentString nameWrapperString
&& nameWrapperString.getSiblings().get(0) instanceof TextComponentString nameString) {
if (nameString.getText().equals(Minecraft.getMinecraft().player.getName())) {
return; // Allow the player to see their own messages
}
}
event.setCanceled(true);
}
}

@SubscribeEvent
public static void onPotionApplied(PotionEvent.PotionAddedEvent event) {
if (event.getPotionEffect().getPotion() == AntiSchizoPotion.INSTANCE && event.getEntity().isEntityEqual(Minecraft.getMinecraft().player)) {
Minecraft.getMinecraft().ingameGUI.getChatGUI().clearChatMessages(true);
}
}

}
7 changes: 7 additions & 0 deletions src/main/java/gregtechfoodoption/potion/AntiSchizoPotion.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package gregtechfoodoption.potion;

import net.minecraft.entity.EntityLivingBase;

public class AntiSchizoPotion extends GTFOPotion {
public static AntiSchizoPotion INSTANCE = null;

Expand All @@ -17,4 +19,9 @@ protected boolean canRender() {
public boolean isReady(int duration, int amplifier) {
return true;
}

@Override
public void performEffect(EntityLivingBase entityLivingBaseIn, int amplifier) {
super.performEffect(entityLivingBaseIn, amplifier);
}
}

0 comments on commit a6b52bb

Please sign in to comment.