WIP 1.20.1 port
1.0.3 update 2 new squirrel anims
This commit is contained in:
1 parent
a1ca3138dd
commit
94c3676dea
189 files changed
+26514
No files matched your search
+293
@@ -0,0 +1,293 @@
|
||||
package com.craisinlord.antarchy.fabric;
|
||||
|
||||
import com.craisinlord.antarchy.Antarchy;
|
||||
import com.craisinlord.antarchy.config.AntarchySettings;
|
||||
import com.craisinlord.antarchy.config.ConfigResetGuard;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParseException;
|
||||
import com.google.gson.JsonParser;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.io.Writer;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public final class AntarchyConfigModuleFabric {
|
||||
private static final Gson GSON = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting().create();
|
||||
private static final Path CONFIG_DIR = FabricLoader.getInstance()
|
||||
.getConfigDir()
|
||||
.resolve(Antarchy.MODID);
|
||||
private static final Path LEGACY_CONFIG_PATH = CONFIG_DIR.resolve("antarchy.json");
|
||||
private static final Map<String, SettingBinding> SETTINGS = buildBindings();
|
||||
|
||||
private AntarchyConfigModuleFabric() {
|
||||
}
|
||||
|
||||
public static void init() {
|
||||
ConfigResetGuard.wipeIfNeeded(
|
||||
CONFIG_DIR,
|
||||
ConfigSection.MOBS.path,
|
||||
ConfigSection.TOOLS.path,
|
||||
ConfigSection.MISC.path,
|
||||
LEGACY_CONFIG_PATH
|
||||
);
|
||||
JsonObject legacy = readConfig(LEGACY_CONFIG_PATH);
|
||||
Map<ConfigSection, JsonObject> loaded = new LinkedHashMap<>();
|
||||
Map<ConfigSection, JsonObject> normalized = new LinkedHashMap<>();
|
||||
|
||||
for (ConfigSection section : ConfigSection.values()) {
|
||||
loaded.put(section, readConfig(section.path));
|
||||
normalized.put(section, new JsonObject());
|
||||
}
|
||||
|
||||
for (Map.Entry<String, SettingBinding> entry : SETTINGS.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
SettingBinding binding = entry.getValue();
|
||||
JsonObject loadedSection = loaded.get(binding.section);
|
||||
JsonElement element = loadedSection != null ? loadedSection.get(key) : null;
|
||||
if (element == null && legacy != null) {
|
||||
element = legacy.get(key);
|
||||
}
|
||||
Object value = binding.readValue(element);
|
||||
binding.apply(value);
|
||||
normalized.get(binding.section).add(key, binding.toJson(value));
|
||||
}
|
||||
|
||||
for (Map.Entry<ConfigSection, JsonObject> entry : normalized.entrySet()) {
|
||||
writeConfig(entry.getKey().path, entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
private static JsonObject readConfig(Path path) {
|
||||
if (!Files.exists(path)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try (Reader reader = Files.newBufferedReader(path)) {
|
||||
JsonElement parsed = JsonParser.parseReader(reader);
|
||||
if (parsed.isJsonObject()) {
|
||||
return parsed.getAsJsonObject();
|
||||
}
|
||||
Antarchy.LOGGER.warn("Fabric config at {} is not a JSON object, using defaults", path);
|
||||
} catch (IOException | JsonParseException e) {
|
||||
Antarchy.LOGGER.warn("Failed to read Fabric config at {}, using defaults", path, e);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static void writeConfig(Path path, JsonObject root) {
|
||||
try {
|
||||
Files.createDirectories(path.getParent());
|
||||
try (Writer writer = Files.newBufferedWriter(path)) {
|
||||
GSON.toJson(root, writer);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Antarchy.LOGGER.warn("Failed to write Fabric config at {}", path, e);
|
||||
}
|
||||
}
|
||||
|
||||
private static Map<String, SettingBinding> buildBindings() {
|
||||
Map<String, Method> getters = new LinkedHashMap<>();
|
||||
for (Method method : AntarchySettings.class.getMethods()) {
|
||||
if (!isPublicStatic(method) || method.getParameterCount() != 0 || method.getReturnType() == Void.TYPE) {
|
||||
continue;
|
||||
}
|
||||
getters.put(method.getName(), method);
|
||||
}
|
||||
|
||||
return Arrays.stream(AntarchySettings.class.getMethods())
|
||||
.filter(AntarchyConfigModuleFabric::isPublicStatic)
|
||||
.filter(method -> method.getName().startsWith("set"))
|
||||
.filter(method -> method.getParameterCount() == 1)
|
||||
.sorted(Comparator.comparing(Method::getName))
|
||||
.collect(LinkedHashMap::new, (bindings, setter) -> {
|
||||
String propertyName = decapitalize(setter.getName().substring(3));
|
||||
Method getter = getters.get(propertyName);
|
||||
if (getter == null) {
|
||||
return;
|
||||
}
|
||||
if (!isSupported(setter.getParameterTypes()[0], getter.getReturnType())) {
|
||||
return;
|
||||
}
|
||||
bindings.put(propertyName, new SettingBinding(propertyName, getter, setter, ConfigSection.forProperty(propertyName)));
|
||||
}, Map::putAll);
|
||||
}
|
||||
|
||||
private static boolean isPublicStatic(Method method) {
|
||||
int modifiers = method.getModifiers();
|
||||
return java.lang.reflect.Modifier.isPublic(modifiers) && java.lang.reflect.Modifier.isStatic(modifiers);
|
||||
}
|
||||
|
||||
private static boolean isSupported(Class<?> setterType, Class<?> getterType) {
|
||||
if (setterType == boolean.class || setterType == int.class || setterType == double.class || setterType == float.class) {
|
||||
return getterType == setterType;
|
||||
}
|
||||
return setterType == String.class && ResourceKey.class.isAssignableFrom(getterType);
|
||||
}
|
||||
|
||||
private static String decapitalize(String value) {
|
||||
if (value.isEmpty()) {
|
||||
return value;
|
||||
}
|
||||
return Character.toLowerCase(value.charAt(0)) + value.substring(1);
|
||||
}
|
||||
|
||||
private enum ConfigSection {
|
||||
MOBS("antarchy_mobs.json"),
|
||||
TOOLS("antarchy_tools.json"),
|
||||
MISC("antarchy_misc.json");
|
||||
|
||||
private final Path path;
|
||||
|
||||
ConfigSection(String fileName) {
|
||||
this.path = CONFIG_DIR.resolve(fileName);
|
||||
}
|
||||
|
||||
private static ConfigSection forProperty(String name) {
|
||||
if (isMiscSetting(name)) {
|
||||
return MISC;
|
||||
}
|
||||
if (isToolSetting(name)) {
|
||||
return TOOLS;
|
||||
}
|
||||
return MOBS;
|
||||
}
|
||||
|
||||
private static boolean isMiscSetting(String name) {
|
||||
return name.equals("disableInfinityBookPortalCreation")
|
||||
|| name.equals("rainbowAntsLeadToInfinityDimensions")
|
||||
|| name.equals("permanentPortalsEnabled")
|
||||
|| name.equals("permanentPortalsFlintAndSteelEnabled")
|
||||
|| name.equals("elythiaPortalEnabled")
|
||||
|| name.equals("thoraxisPortalEnabled")
|
||||
|| name.equals("cavarynPortalEnabled")
|
||||
|| name.equals("hushweedSporeLifetimeSeconds")
|
||||
|| name.equals("elythiaFireflyParticlesEnabled")
|
||||
|| name.equals("duplicatorTreeEnabled")
|
||||
|| name.equals("glowingTorchflowers")
|
||||
|| name.equals("glowVinesUnderLeaves")
|
||||
|| name.equals("swingThroughGrassEnabled")
|
||||
|| name.equals("fabricKeybindingConflictFixEnabled")
|
||||
|| name.equals("experimentalSettingsPopupDisabled")
|
||||
|| name.equals("entitySpecificFireOverlayEnabled")
|
||||
|| name.equals("dreamSandEnabled")
|
||||
|| name.startsWith("dreamSand")
|
||||
|| name.equals("ichorWitherEnabled")
|
||||
|| name.startsWith("diamondMinecart");
|
||||
}
|
||||
|
||||
private static boolean isToolSetting(String name) {
|
||||
return name.equals("sizeChangingRaysEnabled")
|
||||
|| name.startsWith("sizeRay")
|
||||
|| name.equals("shrinkingPotionDelta")
|
||||
|| name.equals("growthPotionDelta")
|
||||
|| name.startsWith("ultimate")
|
||||
|| name.startsWith("battleAxe")
|
||||
|| name.startsWith("bigBertha")
|
||||
|| name.startsWith("attitudeAdjuster")
|
||||
|| name.startsWith("scorpionWhip")
|
||||
|| name.startsWith("bloodCrystal")
|
||||
|| name.startsWith("nightmareHelmet")
|
||||
|| name.startsWith("nightmareChestplate")
|
||||
|| name.startsWith("nightmareLeggings")
|
||||
|| name.startsWith("nightmareBoots")
|
||||
|| name.startsWith("nightmareArmorDreadAura")
|
||||
|| name.startsWith("primordialArmor")
|
||||
|| name.startsWith("nightmareSword")
|
||||
|| name.startsWith("basiliskDagger")
|
||||
|| name.startsWith("squidzooka")
|
||||
|| name.equals("invertProjectilesFromInvertedPlayers")
|
||||
|| name.startsWith("gravityGun")
|
||||
|| name.startsWith("critterCage")
|
||||
|| name.startsWith("minersDream")
|
||||
|| name.equals("potentNyxiteInvertedDurationSeconds")
|
||||
|| name.equals("corneaEarNightVisionSeconds")
|
||||
|| name.startsWith("american")
|
||||
|| name.startsWith("mogglesVision")
|
||||
|| name.equals("ductTapeRepairPercentPerUse")
|
||||
|| name.startsWith("fallenKingCrown");
|
||||
}
|
||||
}
|
||||
|
||||
private static final class SettingBinding {
|
||||
private final String name;
|
||||
private final Method getter;
|
||||
private final Method setter;
|
||||
private final Class<?> setterType;
|
||||
private final ConfigSection section;
|
||||
|
||||
private SettingBinding(String name, Method getter, Method setter, ConfigSection section) {
|
||||
this.name = name;
|
||||
this.getter = getter;
|
||||
this.setter = setter;
|
||||
this.setterType = setter.getParameterTypes()[0];
|
||||
this.section = section;
|
||||
}
|
||||
|
||||
private Object readValue(JsonElement element) {
|
||||
Object defaultValue = getCurrentValue();
|
||||
if (element == null || element.isJsonNull()) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
try {
|
||||
if (setterType == boolean.class) {
|
||||
return element.getAsBoolean();
|
||||
}
|
||||
if (setterType == int.class) {
|
||||
return element.getAsInt();
|
||||
}
|
||||
if (setterType == double.class) {
|
||||
return element.getAsDouble();
|
||||
}
|
||||
if (setterType == float.class) {
|
||||
return element.getAsFloat();
|
||||
}
|
||||
if (setterType == String.class) {
|
||||
return element.getAsString();
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
Antarchy.LOGGER.warn("Invalid Fabric config value for {}, using default", name, e);
|
||||
}
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
private void apply(Object value) {
|
||||
try {
|
||||
setter.invoke(null, value);
|
||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||
throw new IllegalStateException("Failed to apply config value for " + name, e);
|
||||
}
|
||||
}
|
||||
|
||||
private JsonElement toJson(Object value) {
|
||||
return GSON.toJsonTree(value);
|
||||
}
|
||||
|
||||
private Object getCurrentValue() {
|
||||
try {
|
||||
Object value = getter.invoke(null);
|
||||
if (setterType == String.class && value instanceof ResourceKey<?> resourceKey) {
|
||||
return resourceKey.location().toString();
|
||||
}
|
||||
return value;
|
||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||
throw new IllegalStateException("Failed to read config default for " + name, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,328 @@
|
||||
package com.craisinlord.antarchy.fabric;
|
||||
import com.craisinlord.antarchy.fabric.registry.AntarchyFabricEntities;
|
||||
|
||||
import com.craisinlord.antarchy.Antarchy;
|
||||
import com.craisinlord.antarchy.content.AntarchyGameRules;
|
||||
import com.craisinlord.antarchy.content.entity.trades.DrTrayaurusTradeManager;
|
||||
import com.craisinlord.antarchy.content.item.BloodCrystalShardItem;
|
||||
import com.craisinlord.antarchy.fabric.network.AntarchyFabricNetworking;
|
||||
import net.fabricmc.fabric.api.biome.v1.BiomeModifications;
|
||||
import net.fabricmc.fabric.api.biome.v1.BiomeSelectors;
|
||||
import net.fabricmc.fabric.api.gamerule.v1.GameRuleFactory;
|
||||
import net.fabricmc.fabric.api.gamerule.v1.GameRuleRegistry;
|
||||
import net.fabricmc.fabric.api.resource.IdentifiableResourceReloadListener;
|
||||
import net.fabricmc.fabric.api.resource.ResourceManagerHelper;
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.packs.PackType;
|
||||
import net.minecraft.server.packs.resources.PreparableReloadListener;
|
||||
import net.minecraft.server.packs.resources.ResourceManager;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.util.profiling.ProfilerFiller;
|
||||
import net.minecraft.world.level.levelgen.GenerationStep;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
public final class AntarchyFabric implements ModInitializer {
|
||||
private static final TagKey<net.minecraft.world.level.biome.Biome> SHELLSTONE_BIOMES = TagKey.create(
|
||||
Registries.BIOME,
|
||||
new ResourceLocation(Antarchy.MODID, "has_shellstone")
|
||||
);
|
||||
private static final ResourceKey<PlacedFeature> SHELLSTONE_UPPER = ResourceKey.create(
|
||||
Registries.PLACED_FEATURE,
|
||||
new ResourceLocation(Antarchy.MODID, "shellstone_upper")
|
||||
);
|
||||
private static final ResourceKey<PlacedFeature> SHELLSTONE_LOWER = ResourceKey.create(
|
||||
Registries.PLACED_FEATURE,
|
||||
new ResourceLocation(Antarchy.MODID, "shellstone_lower")
|
||||
);
|
||||
private static final TagKey<net.minecraft.world.level.biome.Biome> MISSILE_SQUID_SPAWN_BIOMES = TagKey.create(
|
||||
Registries.BIOME,
|
||||
new ResourceLocation(Antarchy.MODID, "missile_squid_spawn_biomes")
|
||||
);
|
||||
private static final TagKey<net.minecraft.world.level.biome.Biome> OCTOPUS_BOMB_SPAWN_BIOMES = TagKey.create(
|
||||
Registries.BIOME,
|
||||
new ResourceLocation(Antarchy.MODID, "octopus_bomb_spawn_biomes")
|
||||
);
|
||||
private static final TagKey<net.minecraft.world.level.biome.Biome> MANTIS_OVERWORLD_SPAWN_BIOMES = TagKey.create(
|
||||
Registries.BIOME,
|
||||
new ResourceLocation(Antarchy.MODID, "mantis_overworld_spawn_biomes")
|
||||
);
|
||||
private static final TagKey<net.minecraft.world.level.biome.Biome> OVERWORLD_ANT_NEST_SPAWN_BIOMES = TagKey.create(
|
||||
Registries.BIOME,
|
||||
new ResourceLocation(Antarchy.MODID, "overworld_ant_nest_spawn_biomes")
|
||||
);
|
||||
private static final TagKey<net.minecraft.world.level.biome.Biome> RED_ANT_NEST_SPAWN_BIOMES = TagKey.create(
|
||||
Registries.BIOME,
|
||||
new ResourceLocation(Antarchy.MODID, "red_ant_nest_spawn_biomes")
|
||||
);
|
||||
private static final TagKey<net.minecraft.world.level.biome.Biome> IS_ELYTHIA = TagKey.create(
|
||||
Registries.BIOME,
|
||||
new ResourceLocation(Antarchy.MODID, "is_elythia")
|
||||
);
|
||||
private static final TagKey<net.minecraft.world.level.biome.Biome> APPLE_COW_SPAWN_BIOMES = TagKey.create(
|
||||
Registries.BIOME,
|
||||
new ResourceLocation(Antarchy.MODID, "apple_cow_spawn_biomes")
|
||||
);
|
||||
private static final TagKey<net.minecraft.world.level.biome.Biome> GOLDEN_APPLE_COW_SPAWN_BIOMES = TagKey.create(
|
||||
Registries.BIOME,
|
||||
new ResourceLocation(Antarchy.MODID, "golden_apple_cow_spawn_biomes")
|
||||
);
|
||||
private static final TagKey<net.minecraft.world.level.biome.Biome> FLYING_SQUIRREL_SPAWN_BIOMES = TagKey.create(
|
||||
Registries.BIOME,
|
||||
new ResourceLocation(Antarchy.MODID, "flying_squirrel_spawn_biomes")
|
||||
);
|
||||
private static final TagKey<net.minecraft.world.level.biome.Biome> FLOWER_FOREST_BUTTERFLY_SPAWN_BIOMES = TagKey.create(
|
||||
Registries.BIOME,
|
||||
new ResourceLocation(Antarchy.MODID, "flower_forest_butterfly_spawn_biomes")
|
||||
);
|
||||
private static final TagKey<net.minecraft.world.level.biome.Biome> FLOWER_FOREST_CATERPILLAR_SPAWN_BIOMES = TagKey.create(
|
||||
Registries.BIOME,
|
||||
new ResourceLocation(Antarchy.MODID, "flower_forest_caterpillar_spawn_biomes")
|
||||
);
|
||||
private static final TagKey<net.minecraft.world.level.biome.Biome> MILKWEED_SPAWN_BIOMES = TagKey.create(
|
||||
Registries.BIOME,
|
||||
new ResourceLocation(Antarchy.MODID, "milkweed_spawn_biomes")
|
||||
);
|
||||
private static final TagKey<net.minecraft.world.level.biome.Biome> WILD_CORN_SPAWN_BIOMES = TagKey.create(
|
||||
Registries.BIOME,
|
||||
new ResourceLocation(Antarchy.MODID, "wild_corn_spawn_biomes")
|
||||
);
|
||||
private static final ResourceKey<PlacedFeature> BROWN_ANT_NEST = ResourceKey.create(
|
||||
Registries.PLACED_FEATURE,
|
||||
new ResourceLocation(Antarchy.MODID, "brown_ant_nest")
|
||||
);
|
||||
private static final ResourceKey<PlacedFeature> RAINBOW_ANT_NEST = ResourceKey.create(
|
||||
Registries.PLACED_FEATURE,
|
||||
new ResourceLocation(Antarchy.MODID, "rainbow_ant_nest")
|
||||
);
|
||||
private static final ResourceKey<PlacedFeature> TERMITE_NEST = ResourceKey.create(
|
||||
Registries.PLACED_FEATURE,
|
||||
new ResourceLocation(Antarchy.MODID, "termite_nest")
|
||||
);
|
||||
private static final ResourceKey<PlacedFeature> RED_ANT_NEST = ResourceKey.create(
|
||||
Registries.PLACED_FEATURE,
|
||||
new ResourceLocation(Antarchy.MODID, "red_ant_nest")
|
||||
);
|
||||
private static final ResourceKey<PlacedFeature> URANIUM_ORE = ResourceKey.create(
|
||||
Registries.PLACED_FEATURE,
|
||||
new ResourceLocation(Antarchy.MODID, "uranium_ore")
|
||||
);
|
||||
private static final ResourceKey<PlacedFeature> TITANIUM_ORE = ResourceKey.create(
|
||||
Registries.PLACED_FEATURE,
|
||||
new ResourceLocation(Antarchy.MODID, "titanium_ore")
|
||||
);
|
||||
private static final ResourceKey<PlacedFeature> FLOWER_FOREST_MILKWEED = ResourceKey.create(
|
||||
Registries.PLACED_FEATURE,
|
||||
new ResourceLocation(Antarchy.MODID, "flower_forest_milkweed")
|
||||
);
|
||||
private static final ResourceKey<PlacedFeature> CORN_PATCH = ResourceKey.create(
|
||||
Registries.PLACED_FEATURE,
|
||||
new ResourceLocation(Antarchy.MODID, "corn_patch")
|
||||
);
|
||||
private static final TagKey<net.minecraft.world.level.biome.Biome> HAS_SEASHELL = TagKey.create(
|
||||
Registries.BIOME,
|
||||
new ResourceLocation(Antarchy.MODID, "has_seashell")
|
||||
);
|
||||
private static final TagKey<net.minecraft.world.level.biome.Biome> HAS_RARE_SEASHELL = TagKey.create(
|
||||
Registries.BIOME,
|
||||
new ResourceLocation(Antarchy.MODID, "has_rare_seashell")
|
||||
);
|
||||
private static final ResourceKey<PlacedFeature> SEASHELL_PATCH = ResourceKey.create(
|
||||
Registries.PLACED_FEATURE,
|
||||
new ResourceLocation(Antarchy.MODID, "seashell_patch")
|
||||
);
|
||||
private static final ResourceKey<PlacedFeature> SEASHELL_PATCH_RARE = ResourceKey.create(
|
||||
Registries.PLACED_FEATURE,
|
||||
new ResourceLocation(Antarchy.MODID, "seashell_patch_rare")
|
||||
);
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
AntarchyGameRules.bootstrap((name, category, defaultValue) ->
|
||||
GameRuleRegistry.register(name, category, GameRuleFactory.createBooleanRule(defaultValue))
|
||||
);
|
||||
AntarchyFabricNetworking.register();
|
||||
AntarchyFabricNetworking.bootstrapMultipartCommon();
|
||||
AntarchyConfigModuleFabric.init();
|
||||
AntarchyFabricContent.register();
|
||||
registerWorldgenFeatures();
|
||||
AntarchyFabricEvents.register();
|
||||
BloodglassManager.register();
|
||||
Antarchy.init();
|
||||
BloodCrystalShardItem.SYNC_BLOODGLASS = BloodglassManager::syncBloodglass;
|
||||
registerTradeReloadListener();
|
||||
}
|
||||
|
||||
private static void registerTradeReloadListener() {
|
||||
DrTrayaurusTradeManager delegate = new DrTrayaurusTradeManager();
|
||||
ResourceManagerHelper.get(PackType.SERVER_DATA).registerReloadListener(new IdentifiableResourceReloadListener() {
|
||||
@Override
|
||||
public ResourceLocation getFabricId() {
|
||||
return new ResourceLocation(Antarchy.MODID, "trayaurus_trades");
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Void> reload(PreparableReloadListener.PreparationBarrier barrier, ResourceManager manager,
|
||||
ProfilerFiller prepareProfiler, ProfilerFiller applyProfiler,
|
||||
Executor prepareExecutor, Executor applyExecutor) {
|
||||
return delegate.reload(barrier, manager, prepareProfiler, applyProfiler, prepareExecutor, applyExecutor);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static final TagKey<net.minecraft.world.level.biome.Biome> CAVARYN_BIOMES = TagKey.create(
|
||||
Registries.BIOME,
|
||||
new ResourceLocation(Antarchy.MODID, "is_cavaryn")
|
||||
);
|
||||
private static final TagKey<net.minecraft.world.level.biome.Biome> DORRIE_OVERWORLD_SPAWN_BIOMES = TagKey.create(
|
||||
Registries.BIOME,
|
||||
new ResourceLocation(Antarchy.MODID, "dorrie_overworld_spawn_biomes")
|
||||
);
|
||||
private static final TagKey<net.minecraft.world.level.biome.Biome> DORRIE_ELYTHIA_SPAWN_BIOMES = TagKey.create(
|
||||
Registries.BIOME,
|
||||
new ResourceLocation(Antarchy.MODID, "dorrie_elythia_spawn_biomes")
|
||||
);
|
||||
|
||||
private static void registerWorldgenFeatures() {
|
||||
BiomeModifications.addFeature(
|
||||
BiomeSelectors.tag(SHELLSTONE_BIOMES),
|
||||
GenerationStep.Decoration.UNDERGROUND_ORES,
|
||||
SHELLSTONE_UPPER
|
||||
);
|
||||
BiomeModifications.addFeature(
|
||||
BiomeSelectors.tag(SHELLSTONE_BIOMES),
|
||||
GenerationStep.Decoration.UNDERGROUND_ORES,
|
||||
SHELLSTONE_LOWER
|
||||
);
|
||||
BiomeModifications.addSpawn(
|
||||
BiomeSelectors.tag(MISSILE_SQUID_SPAWN_BIOMES),
|
||||
net.minecraft.world.entity.MobCategory.MONSTER,
|
||||
AntarchyFabricEntities.MISSILE_SQUID.get(),
|
||||
2, 1, 2
|
||||
);
|
||||
BiomeModifications.addSpawn(
|
||||
BiomeSelectors.tag(OCTOPUS_BOMB_SPAWN_BIOMES),
|
||||
net.minecraft.world.entity.MobCategory.MONSTER,
|
||||
AntarchyFabricEntities.OCTOPUS_BOMB.get(),
|
||||
2, 1, 2
|
||||
);
|
||||
BiomeModifications.addSpawn(
|
||||
BiomeSelectors.tag(MANTIS_OVERWORLD_SPAWN_BIOMES),
|
||||
net.minecraft.world.entity.MobCategory.MONSTER,
|
||||
AntarchyFabricEntities.MANTIS.get(),
|
||||
8, 1, 1
|
||||
);
|
||||
BiomeModifications.addSpawn(
|
||||
BiomeSelectors.tag(MANTIS_OVERWORLD_SPAWN_BIOMES),
|
||||
net.minecraft.world.entity.MobCategory.MONSTER,
|
||||
AntarchyFabricEntities.ALPHA_MANTIS.get(),
|
||||
1, 1, 1
|
||||
);
|
||||
BiomeModifications.addFeature(
|
||||
BiomeSelectors.tag(OVERWORLD_ANT_NEST_SPAWN_BIOMES),
|
||||
GenerationStep.Decoration.VEGETAL_DECORATION,
|
||||
BROWN_ANT_NEST
|
||||
);
|
||||
BiomeModifications.addFeature(
|
||||
BiomeSelectors.tag(OVERWORLD_ANT_NEST_SPAWN_BIOMES),
|
||||
GenerationStep.Decoration.VEGETAL_DECORATION,
|
||||
RAINBOW_ANT_NEST
|
||||
);
|
||||
BiomeModifications.addFeature(
|
||||
BiomeSelectors.tag(OVERWORLD_ANT_NEST_SPAWN_BIOMES),
|
||||
GenerationStep.Decoration.VEGETAL_DECORATION,
|
||||
TERMITE_NEST
|
||||
);
|
||||
BiomeModifications.addFeature(
|
||||
BiomeSelectors.tag(RED_ANT_NEST_SPAWN_BIOMES),
|
||||
GenerationStep.Decoration.VEGETAL_DECORATION,
|
||||
RED_ANT_NEST
|
||||
);
|
||||
BiomeModifications.addFeature(
|
||||
BiomeSelectors.foundInOverworld(),
|
||||
GenerationStep.Decoration.UNDERGROUND_ORES,
|
||||
URANIUM_ORE
|
||||
);
|
||||
BiomeModifications.addFeature(
|
||||
BiomeSelectors.foundInOverworld(),
|
||||
GenerationStep.Decoration.UNDERGROUND_ORES,
|
||||
TITANIUM_ORE
|
||||
);
|
||||
BiomeModifications.addFeature(
|
||||
BiomeSelectors.tag(IS_ELYTHIA),
|
||||
GenerationStep.Decoration.UNDERGROUND_ORES,
|
||||
URANIUM_ORE
|
||||
);
|
||||
BiomeModifications.addFeature(
|
||||
BiomeSelectors.tag(IS_ELYTHIA),
|
||||
GenerationStep.Decoration.UNDERGROUND_ORES,
|
||||
TITANIUM_ORE
|
||||
);
|
||||
BiomeModifications.addFeature(
|
||||
BiomeSelectors.tag(MILKWEED_SPAWN_BIOMES),
|
||||
GenerationStep.Decoration.VEGETAL_DECORATION,
|
||||
FLOWER_FOREST_MILKWEED
|
||||
);
|
||||
BiomeModifications.addFeature(
|
||||
BiomeSelectors.tag(WILD_CORN_SPAWN_BIOMES),
|
||||
GenerationStep.Decoration.VEGETAL_DECORATION,
|
||||
CORN_PATCH
|
||||
);
|
||||
BiomeModifications.addFeature(
|
||||
BiomeSelectors.tag(HAS_SEASHELL),
|
||||
GenerationStep.Decoration.VEGETAL_DECORATION,
|
||||
SEASHELL_PATCH
|
||||
);
|
||||
BiomeModifications.addFeature(
|
||||
BiomeSelectors.tag(HAS_RARE_SEASHELL),
|
||||
GenerationStep.Decoration.VEGETAL_DECORATION,
|
||||
SEASHELL_PATCH_RARE
|
||||
);
|
||||
BiomeModifications.addSpawn(
|
||||
BiomeSelectors.tag(APPLE_COW_SPAWN_BIOMES),
|
||||
net.minecraft.world.entity.MobCategory.CREATURE,
|
||||
AntarchyFabricEntities.APPLE_COW.get(),
|
||||
10, 2, 4
|
||||
);
|
||||
BiomeModifications.addSpawn(
|
||||
BiomeSelectors.tag(GOLDEN_APPLE_COW_SPAWN_BIOMES),
|
||||
net.minecraft.world.entity.MobCategory.CREATURE,
|
||||
AntarchyFabricEntities.GOLDEN_APPLE_COW.get(),
|
||||
1, 1, 3
|
||||
);
|
||||
BiomeModifications.addSpawn(
|
||||
BiomeSelectors.tag(FLYING_SQUIRREL_SPAWN_BIOMES),
|
||||
net.minecraft.world.entity.MobCategory.CREATURE,
|
||||
AntarchyFabricEntities.FLYING_SQUIRREL.get(),
|
||||
8, 1, 3
|
||||
);
|
||||
BiomeModifications.addSpawn(
|
||||
BiomeSelectors.tag(FLOWER_FOREST_BUTTERFLY_SPAWN_BIOMES),
|
||||
net.minecraft.world.entity.MobCategory.AMBIENT,
|
||||
AntarchyFabricEntities.BUTTERFLY.get(),
|
||||
28, 2, 5
|
||||
);
|
||||
BiomeModifications.addSpawn(
|
||||
BiomeSelectors.tag(FLOWER_FOREST_CATERPILLAR_SPAWN_BIOMES),
|
||||
net.minecraft.world.entity.MobCategory.CREATURE,
|
||||
AntarchyFabricEntities.CATERPILLAR.get(),
|
||||
24, 2, 4
|
||||
);
|
||||
BiomeModifications.addSpawn(
|
||||
BiomeSelectors.tag(DORRIE_OVERWORLD_SPAWN_BIOMES),
|
||||
net.minecraft.world.entity.MobCategory.CREATURE,
|
||||
AntarchyFabricEntities.DORRIE.get(),
|
||||
1, 1, 1
|
||||
);
|
||||
BiomeModifications.addSpawn(
|
||||
BiomeSelectors.tag(DORRIE_ELYTHIA_SPAWN_BIOMES),
|
||||
net.minecraft.world.entity.MobCategory.CREATURE,
|
||||
AntarchyFabricEntities.DORRIE.get(),
|
||||
10, 1, 2
|
||||
);
|
||||
}
|
||||
}
|
||||
+468
@@ -0,0 +1,468 @@
|
||||
package com.craisinlord.antarchy.fabric;
|
||||
|
||||
import com.craisinlord.antarchy.Antarchy;
|
||||
import com.craisinlord.antarchy.compat.infinity.InfinityCompat;
|
||||
import com.craisinlord.antarchy.compat.infinity.InfinityCompatVersion;
|
||||
import com.craisinlord.antarchy.content.AntarchyObjects;
|
||||
import com.craisinlord.antarchy.content.block.*;
|
||||
import com.craisinlord.antarchy.content.AntarchySoundEvents;
|
||||
import com.craisinlord.antarchy.content.item.BloodCrystalKatanaItem;
|
||||
import com.craisinlord.antarchy.fabric.network.AntarchyFabricNetworking;
|
||||
import com.craisinlord.antarchy.fabric.registry.DeferredHolder;
|
||||
import com.craisinlord.antarchy.content.entity.lucid.LucidEntity;
|
||||
import com.craisinlord.antarchy.content.entity.lucid.LucidBoltEntity;
|
||||
import com.craisinlord.antarchy.content.entity.lucid.LucidEyeProjectileEntity;
|
||||
import com.craisinlord.antarchy.content.item.ScorpionWhipTetherSync;
|
||||
import com.craisinlord.antarchy.content.network.ImpactShakeSync;
|
||||
import com.craisinlord.antarchy.content.network.HerculesBeetleImpactShakeSync;
|
||||
import com.craisinlord.antarchy.content.network.HordeIntensitySync;
|
||||
import com.craisinlord.antarchy.content.portal.PermanentPortalType;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.alchemy.Potion;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.alchemy.Potions;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
import net.minecraft.world.level.block.LiquidBlock;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import com.craisinlord.antarchy.fabric.registry.AntarchyFabricBlocks;
|
||||
import com.craisinlord.antarchy.fabric.registry.AntarchyFabricItems;
|
||||
import com.craisinlord.antarchy.fabric.registry.AntarchyFabricEntities;
|
||||
import com.craisinlord.antarchy.fabric.registry.AntarchyFabricCreativeModeTabs;
|
||||
import com.craisinlord.antarchy.fabric.registry.AntarchyFabricSounds;
|
||||
import com.craisinlord.antarchy.fabric.registry.AntarchyFabricMisc;
|
||||
import com.craisinlord.antarchy.fabric.registry.AntarchyFabricEntityAttributes;
|
||||
import com.craisinlord.antarchy.fabric.registry.AntarchyFabricSpawnPlacements;
|
||||
|
||||
public final class AntarchyFabricContent {
|
||||
|
||||
|
||||
public static Potion potionHolder(DeferredHolder<Potion, ? extends Potion> potion) {
|
||||
return potion.get();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static boolean isModLoaded(String modId) {
|
||||
return FabricLoader.getInstance().isModLoaded(modId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static net.minecraft.world.level.material.FlowingFluid lookupFlowingFluid(String path) {
|
||||
return (net.minecraft.world.level.material.FlowingFluid) BuiltInRegistries.FLUID.get(new ResourceLocation(Antarchy.MODID, path));
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static Item lookupItem(String path) {
|
||||
return BuiltInRegistries.ITEM.get(new ResourceLocation(Antarchy.MODID, path));
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static LiquidBlock lookupLiquidBlock(String path) {
|
||||
return (LiquidBlock) BuiltInRegistries.BLOCK.get(new ResourceLocation(Antarchy.MODID, path));
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void register() {
|
||||
com.craisinlord.antarchy.content.entity.UpwardFallingBlockEntity.TYPE = AntarchyFabricEntities.UPWARD_FALLING_BLOCK;
|
||||
net.fabricmc.fabric.api.registry.FabricBrewingRecipeRegistry.registerPotionRecipe(net.minecraft.world.item.alchemy.Potions.AWKWARD, Ingredient.of(AntarchyFabricItems.LUCID_EYE.get()), potionHolder(AntarchyFabricMisc.INVERSION));
|
||||
net.fabricmc.fabric.api.registry.FabricBrewingRecipeRegistry.registerPotionRecipe(potionHolder(AntarchyFabricMisc.INVERSION), Ingredient.of(Items.REDSTONE), potionHolder(AntarchyFabricMisc.LONG_INVERSION));
|
||||
net.fabricmc.fabric.api.registry.FabricBrewingRecipeRegistry.registerPotionRecipe(net.minecraft.world.item.alchemy.Potions.AWKWARD, Ingredient.of(AntarchyFabricItems.STINK_BUG_ITEM.get()), potionHolder(AntarchyFabricMisc.STINKY_POTION));
|
||||
net.fabricmc.fabric.api.registry.FabricBrewingRecipeRegistry.registerPotionRecipe(potionHolder(AntarchyFabricMisc.STINKY_POTION), Ingredient.of(Items.REDSTONE), potionHolder(AntarchyFabricMisc.LONG_STINKY));
|
||||
net.fabricmc.fabric.api.registry.FabricBrewingRecipeRegistry.registerPotionRecipe(net.minecraft.world.item.alchemy.Potions.AWKWARD, Ingredient.of(AntarchyFabricItems.BASILISK_FANG.get()), potionHolder(AntarchyFabricMisc.PARALYSIS));
|
||||
net.fabricmc.fabric.api.registry.FabricBrewingRecipeRegistry.registerPotionRecipe(potionHolder(AntarchyFabricMisc.PARALYSIS), Ingredient.of(Items.REDSTONE), potionHolder(AntarchyFabricMisc.LONG_PARALYSIS));
|
||||
net.fabricmc.fabric.api.registry.FabricBrewingRecipeRegistry.registerPotionRecipe(net.minecraft.world.item.alchemy.Potions.AWKWARD, Ingredient.of(AntarchyFabricItems.MOLEWORM_ITEM.get()), potionHolder(AntarchyFabricMisc.HASTE));
|
||||
net.fabricmc.fabric.api.registry.FabricBrewingRecipeRegistry.registerPotionRecipe(potionHolder(AntarchyFabricMisc.HASTE), Ingredient.of(Items.GLOWSTONE_DUST), potionHolder(AntarchyFabricMisc.STRONG_HASTE));
|
||||
net.fabricmc.fabric.api.registry.FabricBrewingRecipeRegistry.registerPotionRecipe(net.minecraft.world.item.alchemy.Potions.AWKWARD, Ingredient.of(AntarchyFabricItems.URANIUM_NUGGET.get()), potionHolder(AntarchyFabricMisc.SHRINKING));
|
||||
net.fabricmc.fabric.api.registry.FabricBrewingRecipeRegistry.registerPotionRecipe(potionHolder(AntarchyFabricMisc.SHRINKING), Ingredient.of(Items.GLOWSTONE_DUST), potionHolder(AntarchyFabricMisc.STRONG_SHRINKING));
|
||||
net.fabricmc.fabric.api.registry.FabricBrewingRecipeRegistry.registerPotionRecipe(potionHolder(AntarchyFabricMisc.STRONG_SHRINKING), Ingredient.of(Items.GLOWSTONE_DUST), potionHolder(AntarchyFabricMisc.EXTREME_SHRINKING));
|
||||
net.fabricmc.fabric.api.registry.FabricBrewingRecipeRegistry.registerPotionRecipe(net.minecraft.world.item.alchemy.Potions.AWKWARD, Ingredient.of(AntarchyFabricItems.TITANIUM_NUGGET.get()), potionHolder(AntarchyFabricMisc.GROWING));
|
||||
net.fabricmc.fabric.api.registry.FabricBrewingRecipeRegistry.registerPotionRecipe(potionHolder(AntarchyFabricMisc.GROWING), Ingredient.of(Items.GLOWSTONE_DUST), potionHolder(AntarchyFabricMisc.STRONG_GROWING));
|
||||
net.fabricmc.fabric.api.registry.FabricBrewingRecipeRegistry.registerPotionRecipe(potionHolder(AntarchyFabricMisc.STRONG_GROWING), Ingredient.of(Items.GLOWSTONE_DUST), potionHolder(AntarchyFabricMisc.EXTREME_GROWING));
|
||||
net.fabricmc.fabric.api.registry.FabricBrewingRecipeRegistry.registerPotionRecipe(net.minecraft.world.item.alchemy.Potions.AWKWARD, Ingredient.of(AntarchyFabricItems.CLOUD_SHARK_FIN.get()), net.minecraft.world.item.alchemy.Potions.SLOW_FALLING);
|
||||
net.fabricmc.fabric.api.registry.FabricBrewingRecipeRegistry.registerPotionRecipe(net.minecraft.world.item.alchemy.Potions.AWKWARD, Ingredient.of(AntarchyFabricItems.JUMPY_BUG_LEG.get()), Potions.LEAPING);
|
||||
net.fabricmc.fabric.api.registry.FabricBrewingRecipeRegistry.registerPotionRecipe(net.minecraft.world.item.alchemy.Potions.AWKWARD, Ingredient.of(AntarchyFabricItems.CORNEA_EAR.get()), net.minecraft.world.item.alchemy.Potions.NIGHT_VISION);
|
||||
|
||||
AntarchyFabricSounds.SOUND_EVENTS.register();
|
||||
AntarchyFabricMisc.FLUIDS.register();
|
||||
AntarchyFabricBlocks.BLOCKS.register();
|
||||
AntarchyFabricEntities.ENTITY_TYPES.register();
|
||||
AntarchyFabricMisc.ATTRIBUTES.register();
|
||||
AntarchyFabricEntityAttributes.register();
|
||||
AntarchyFabricSpawnPlacements.register();
|
||||
AntarchyFabricBlocks.BLOCK_ENTITY_TYPES.register();
|
||||
AntarchyFabricMisc.PARTICLE_TYPES.register();
|
||||
AntarchyFabricMisc.FEATURES.register();
|
||||
AntarchyFabricMisc.BIOME_SOURCES.register();
|
||||
AntarchyFabricMisc.DENSITY_FUNCTION_TYPES.register();
|
||||
AntarchyFabricMisc.MOB_EFFECTS.register();
|
||||
AntarchyFabricMisc.POTIONS.register();
|
||||
AntarchyFabricItems.ITEMS.register();
|
||||
AntarchyFabricMisc.MENUS.register();
|
||||
AntarchyFabricMisc.RECIPE_SERIALIZERS.register();
|
||||
AntarchyFabricCreativeModeTabs.CREATIVE_MODE_TABS.register();
|
||||
|
||||
PermanentPortalType.bindBlocks(
|
||||
() -> AntarchyFabricBlocks.MOSSY_OURANWOOD_WOOD.get(),
|
||||
() -> AntarchyFabricBlocks.ELYTHIA_PORTAL.get(),
|
||||
() -> AntarchyFabricBlocks.NYXITE.get(),
|
||||
() -> AntarchyFabricBlocks.THORAXIS_PORTAL.get(),
|
||||
() -> AntarchyFabricBlocks.MYRMITE.get(),
|
||||
() -> AntarchyFabricBlocks.CAVARYN_PORTAL.get()
|
||||
);
|
||||
|
||||
AntarchySoundEvents.bind(
|
||||
AntarchyFabricSounds.SQUIDZOOKA_FIRE,
|
||||
AntarchyFabricSounds.SHRINK_RAY_SOUND,
|
||||
AntarchyFabricSounds.GROWTH_RAY_SOUND,
|
||||
AntarchyFabricSounds.SIZE_RAY_CHARGE,
|
||||
AntarchyFabricSounds.ANT_AMBIENT,
|
||||
AntarchyFabricSounds.ANT_IDLE,
|
||||
AntarchyFabricSounds.ANT_HURT,
|
||||
AntarchyFabricSounds.ANT_BITE,
|
||||
AntarchyFabricSounds.ANT_GATHER,
|
||||
AntarchyFabricSounds.ANT_NEST,
|
||||
AntarchyFabricSounds.CLOUD_SHARK_BITE,
|
||||
AntarchyFabricSounds.CLOUD_SHARK_IDLE,
|
||||
AntarchyFabricSounds.CLOUD_SHARK_HURT,
|
||||
AntarchyFabricSounds.CLOUD_SHARK_DEATH,
|
||||
AntarchyFabricSounds.CLOUD_SHARK_FLY,
|
||||
AntarchyFabricSounds.CATERPILLAR_IDLE,
|
||||
AntarchyFabricSounds.CATERPILLAR_HURT,
|
||||
AntarchyFabricSounds.CATERPILLAR_CRAWL,
|
||||
AntarchyFabricSounds.BUTTERFLY_HURT,
|
||||
AntarchyFabricSounds.BRUTALFLY_IDLE,
|
||||
AntarchyFabricSounds.BRUTALFLY_DEATH,
|
||||
AntarchyFabricSounds.ELYTHIA_FIREFLY_AMBIENT,
|
||||
AntarchyFabricSounds.MISSILE_SQUID_AMBIENT,
|
||||
AntarchyFabricSounds.MISSILE_SQUID_HURT,
|
||||
AntarchyFabricSounds.MISSILE_SQUID_DEATH,
|
||||
AntarchyFabricSounds.MISSILE_SQUID_ATTACK,
|
||||
AntarchyFabricSounds.KRAKEN_FLYING_LOOP,
|
||||
AntarchyFabricSounds.KRAKEN_FLYING_SIDEWAYS_LOOP,
|
||||
AntarchyFabricSounds.KRAKEN_ATTACK,
|
||||
AntarchyFabricSounds.KRAKEN_SPIN,
|
||||
AntarchyFabricSounds.KRAKEN_ROAR,
|
||||
AntarchyFabricSounds.KRAKEN_SUMMON,
|
||||
AntarchyFabricSounds.KRAKEN_HURT,
|
||||
AntarchyFabricSounds.KRAKEN_DEATH,
|
||||
AntarchyFabricSounds.BASILISK_IDLE_LOOP,
|
||||
AntarchyFabricSounds.BASILISK_SLITHER_LOOP,
|
||||
AntarchyFabricSounds.BASILISK_BITE,
|
||||
AntarchyFabricSounds.BASILISK_HISS,
|
||||
AntarchyFabricSounds.BASILISK_HURT,
|
||||
AntarchyFabricSounds.BASILISK_DEATH,
|
||||
AntarchyFabricSounds.THORAXIS_NIGHTMARE_WASTES_AMBIENT,
|
||||
AntarchyFabricSounds.THORAXIS_NIGHTMARE_WASTES_ADDITIONS,
|
||||
AntarchyFabricSounds.THORAXIS_NIGHTMARE_WASTES_MOOD,
|
||||
AntarchyFabricSounds.THORAXIS_DREAM_DUNES_AMBIENT,
|
||||
AntarchyFabricSounds.THORAXIS_DREAM_DUNES_ADDITIONS,
|
||||
AntarchyFabricSounds.THORAXIS_DREAM_DUNES_MOOD,
|
||||
AntarchyFabricSounds.THORAXIS_LUCID_POOLS_AMBIENT,
|
||||
AntarchyFabricSounds.THORAXIS_LUCID_POOLS_ADDITIONS,
|
||||
AntarchyFabricSounds.THORAXIS_LUCID_POOLS_MOOD,
|
||||
AntarchyFabricSounds.LUCID_AMBIENT,
|
||||
AntarchyFabricSounds.LUCID_FLYING,
|
||||
AntarchyFabricSounds.LUCID_ATTACK,
|
||||
AntarchyFabricSounds.LUCID_BOLT_SOUND,
|
||||
AntarchyFabricSounds.LUCID_HURT,
|
||||
AntarchyFabricSounds.LUCID_DEATH,
|
||||
AntarchyFabricSounds.REVERIE_IDLE,
|
||||
AntarchyFabricSounds.REVERIE_HURT,
|
||||
AntarchyFabricSounds.REVERIE_WORRY,
|
||||
AntarchyFabricSounds.REVERIE_SAVE,
|
||||
AntarchyFabricSounds.REVERIE_JOIN_PLAYER,
|
||||
AntarchyFabricSounds.REVERIE_ALERT,
|
||||
AntarchyFabricSounds.FLYING_SQUIRREL_IDLE,
|
||||
AntarchyFabricSounds.FLYING_SQUIRREL_BEG,
|
||||
AntarchyFabricSounds.FLYING_SQUIRREL_NUT,
|
||||
AntarchyFabricSounds.FLYING_SQUIRREL_GLIDE_LOOP,
|
||||
AntarchyFabricSounds.FLYING_SQUIRREL_HURT,
|
||||
AntarchyFabricSounds.FLYING_SQUIRREL_DEATH,
|
||||
AntarchyFabricSounds.NIGHTMARE_IDLE,
|
||||
AntarchyFabricSounds.NIGHTMARE_HURT,
|
||||
AntarchyFabricSounds.NIGHTMARE_ROAR,
|
||||
AntarchyFabricSounds.NIGHTMARE_DEATH,
|
||||
AntarchyFabricSounds.NIGHTMARE_BITE,
|
||||
AntarchyFabricSounds.NIGHTMARE_FLAP,
|
||||
AntarchyFabricSounds.TRIFFID_ATTACK,
|
||||
AntarchyFabricSounds.TRIFFID_GRAB,
|
||||
AntarchyFabricSounds.TRIFFID_HURT,
|
||||
AntarchyFabricSounds.TRIFFID_DEATH,
|
||||
AntarchyFabricSounds.TRIFFID_HISS,
|
||||
AntarchyFabricSounds.TRIFFID_GROWL,
|
||||
AntarchyFabricSounds.MANTIS_AMBIENT,
|
||||
AntarchyFabricSounds.MANTIS_HURT,
|
||||
AntarchyFabricSounds.MANTIS_ATTACK,
|
||||
AntarchyFabricSounds.MANTIS_FLY_LOOP,
|
||||
AntarchyFabricSounds.GRAVITY_GUN_PICKUP,
|
||||
AntarchyFabricSounds.GRAVITY_GUN_DROP,
|
||||
AntarchyFabricSounds.GRAVITY_GUN_HOLD_LOOP,
|
||||
AntarchyFabricSounds.GRAVITY_GUN_LAUNCH,
|
||||
AntarchyFabricSounds.GRAVITY_GUN_DRYFIRE,
|
||||
AntarchyFabricSounds.BED_BUG_AMBIENT,
|
||||
AntarchyFabricSounds.BED_BUG_HURT,
|
||||
AntarchyFabricSounds.BED_BUG_ATTACK,
|
||||
AntarchyFabricSounds.WASP_IDLE,
|
||||
AntarchyFabricSounds.WASP_HURT,
|
||||
AntarchyFabricSounds.WASP_ATTACK,
|
||||
AntarchyFabricSounds.WASP_DEATH,
|
||||
AntarchyFabricSounds.SCORPION_AMBIENT,
|
||||
AntarchyFabricSounds.SCORPION_HURT,
|
||||
AntarchyFabricSounds.SCORPION_ATTACK,
|
||||
AntarchyFabricSounds.EMPEROR_SCORPION_AMBIENT,
|
||||
AntarchyFabricSounds.EMPEROR_SCORPION_HURT,
|
||||
AntarchyFabricSounds.EMPEROR_SCORPION_ATTACK,
|
||||
AntarchyFabricSounds.EMPEROR_SCORPION_ROAR,
|
||||
AntarchyFabricSounds.MOLEWORM_AMBIENT,
|
||||
AntarchyFabricSounds.MOLEWORM_HURT,
|
||||
AntarchyFabricSounds.MOLEWORM_ATTACK,
|
||||
AntarchyFabricSounds.MOLEWORM_DIG,
|
||||
AntarchyFabricSounds.MOLEVORE_AMBIENT,
|
||||
AntarchyFabricSounds.MOLEVORE_HURT,
|
||||
AntarchyFabricSounds.MOLEVORE_ATTACK,
|
||||
AntarchyFabricSounds.MOLEVORE_DIG,
|
||||
AntarchyFabricSounds.BOMBER_WALK,
|
||||
AntarchyFabricSounds.BOMBER_KNOCK,
|
||||
AntarchyFabricSounds.BOMBER_EXPLODE,
|
||||
AntarchyFabricSounds.TORETERROR_IDLE,
|
||||
AntarchyFabricSounds.TORETERROR_HURT,
|
||||
AntarchyFabricSounds.TORETERROR_DEATH,
|
||||
AntarchyFabricSounds.TORETERROR_BOMBER_FIRE,
|
||||
AntarchyFabricSounds.TORETERROR_SPIN,
|
||||
AntarchyFabricSounds.TORETERROR_RICOCHET,
|
||||
AntarchyFabricSounds.WATER_CANNON_FIRE,
|
||||
AntarchyFabricSounds.TORETERROR_JUMP_UP,
|
||||
AntarchyFabricSounds.TORETERROR_JUMP_LAND,
|
||||
AntarchyFabricSounds.STINKY_FLY_SOUND,
|
||||
AntarchyFabricSounds.STINK_BUG_FART,
|
||||
AntarchyFabricSounds.STINK_BUG_IDLE,
|
||||
AntarchyFabricSounds.CAVARYN_HEARTBEAT,
|
||||
AntarchyFabricSounds.ROLLY_POLLY_IDLE,
|
||||
AntarchyFabricSounds.CREEPING_HORROR_GROWL,
|
||||
AntarchyFabricSounds.CREEPING_HORROR_HURT,
|
||||
AntarchyFabricSounds.CREEPING_HORROR_BITE,
|
||||
AntarchyFabricSounds.LURKING_TERROR_SNARL,
|
||||
AntarchyFabricSounds.LURKING_TERROR_HURT,
|
||||
AntarchyFabricSounds.LURKING_TERROR_BITE,
|
||||
AntarchyFabricSounds.LURKING_TERROR_FLY_LOOP,
|
||||
AntarchyFabricSounds.DUCT_TAPE_USE,
|
||||
AntarchyFabricSounds.HERCULES_BEETLE_IDLE,
|
||||
AntarchyFabricSounds.HERCULES_BEETLE_HURT,
|
||||
AntarchyFabricSounds.HERCULES_BEETLE_ATTACK,
|
||||
AntarchyFabricSounds.HERCULES_BEETLE_CRY,
|
||||
AntarchyFabricSounds.HERCULES_BEETLE_CHARGE_START,
|
||||
AntarchyFabricSounds.HERCULES_BEETLE_KNOCKED_DOWN,
|
||||
AntarchyFabricSounds.JUMPY_BUG_IDLE,
|
||||
AntarchyFabricSounds.SPIT_BUG_IDLE,
|
||||
AntarchyFabricSounds.JUMPY_BUG_HURT,
|
||||
AntarchyFabricSounds.JUMPY_BUG_JUMP,
|
||||
AntarchyFabricSounds.SPIT_BUG_HURT,
|
||||
AntarchyFabricSounds.SPIT_BUG_SPIT,
|
||||
AntarchyFabricSounds.BRUTALFLY_SPIT,
|
||||
AntarchyFabricSounds.ROLLY_POLLY_WHEEL_MODE,
|
||||
AntarchyFabricSounds.ROLLY_POLLY_NORMAL_MODE,
|
||||
AntarchyFabricSounds.ROLLY_POLLY_ROLL,
|
||||
AntarchyFabricSounds.JERRY_YOUNG_IDLE,
|
||||
AntarchyFabricSounds.JERRY_YOUNG_HURT,
|
||||
AntarchyFabricSounds.JERRY_YOUNG_DEATH,
|
||||
AntarchyFabricSounds.JERRY_YOUNG_ATTACK,
|
||||
AntarchyFabricSounds.JERRY_ADULT_IDLE,
|
||||
AntarchyFabricSounds.JERRY_ADULT_HURT,
|
||||
AntarchyFabricSounds.JERRY_ADULT_DEATH,
|
||||
AntarchyFabricSounds.JERRY_ADULT_ATTACK
|
||||
);
|
||||
|
||||
AntarchyObjects.setOctopusBomb(AntarchyFabricEntities.OCTOPUS_BOMB);
|
||||
AntarchyObjects.setTentacle(AntarchyFabricEntities.TENTACLE);
|
||||
AntarchyObjects.setKrakensGraspTrident(AntarchyFabricEntities.KRAKENS_GRASP_TRIDENT);
|
||||
AntarchyObjects.setLotus(() -> AntarchyFabricBlocks.LOTUS.get());
|
||||
AntarchyObjects.setKrakenTentacle(() -> AntarchyFabricItems.KRAKEN_TENTACLE.get());
|
||||
AntarchyObjects.setKrakensGrasp(() -> AntarchyFabricItems.KRAKENS_GRASP.get());
|
||||
AntarchyObjects.setOuranwoodDeer(AntarchyFabricEntities.OURANWOOD_DEER);
|
||||
AntarchyObjects.setGlimmer(AntarchyFabricEntities.GLIMMER);
|
||||
AntarchyObjects.setSpiritApple(() -> AntarchyFabricItems.SPIRIT_APPLE.get());
|
||||
AntarchyObjects.setElka(AntarchyFabricEntities.ELKA);
|
||||
AntarchyObjects.setPeach(() -> AntarchyFabricItems.PEACH.get());
|
||||
AntarchyObjects.setCorn(() -> AntarchyFabricItems.CORN.get());
|
||||
AntarchyObjects.setCornSeeds(() -> AntarchyFabricItems.CORN_SEEDS.get());
|
||||
AntarchyObjects.setWildCorn(() -> AntarchyFabricBlocks.WILD_CORN.get());
|
||||
AntarchyObjects.setStarCoralBlock(() -> AntarchyFabricBlocks.STAR_CORAL_BLOCK.get());
|
||||
AntarchyObjects.setStarCoral(() -> AntarchyFabricBlocks.STAR_CORAL.get());
|
||||
AntarchyObjects.setStarCoralFan(() -> AntarchyFabricBlocks.STAR_CORAL_FAN.get());
|
||||
AntarchyObjects.setCookedCorndog(() -> AntarchyFabricItems.COOKED_CORNDOG.get());
|
||||
AntarchyObjects.setGlimmerBottle(() -> AntarchyFabricItems.GLIMMER_BOTTLE.get());
|
||||
AntarchyObjects.setLumen(() -> AntarchyFabricMisc.LUMEN.get());
|
||||
AntarchyObjects.setFlowingLumen(() -> AntarchyFabricMisc.FLOWING_LUMEN.get());
|
||||
AntarchyObjects.setLumenBucket(() -> AntarchyFabricItems.LUMEN_BUCKET.get());
|
||||
AntarchyObjects.setLumenBlock(() -> AntarchyFabricBlocks.LUMEN_BLOCK.get());
|
||||
AntarchyObjects.setLumenFroglight(() -> AntarchyFabricBlocks.LUMEN_FROGLIGHT.get());
|
||||
AntarchyObjects.setPeachLeavesParticle(() -> AntarchyFabricMisc.PEACH_LEAVES_PARTICLE.get());
|
||||
AntarchyObjects.setLotusPollen(() -> AntarchyFabricMisc.LOTUS_POLLEN.get());
|
||||
AntarchyObjects.setDorrieInventoryMenu(AntarchyFabricMisc.DORRIE_INVENTORY_MENU);
|
||||
AntarchyObjects.setCritterCage(() -> AntarchyFabricItems.CRITTER_CAGE.get());
|
||||
AntarchyObjects.setCritterCageBlock(() -> AntarchyFabricBlocks.CRITTER_CAGE_BLOCK.get());
|
||||
AntarchyObjects.setCritterCageBlockEntity(() -> AntarchyFabricBlocks.CRITTER_CAGE_BLOCK_ENTITY.get());
|
||||
AntarchyObjects.setCritterCageProjectile(() -> AntarchyFabricEntities.CRITTER_CAGE_PROJECTILE.get());
|
||||
AntarchyObjects.bind(
|
||||
AntarchyFabricEntities.EASTER_BUNNY,
|
||||
AntarchyFabricEntities.FLYING_SQUIRREL,
|
||||
AntarchyFabricEntities.KRAKEN,
|
||||
AntarchyFabricEntities.MISSILE_SQUID,
|
||||
AntarchyFabricEntities.MOLEWORM,
|
||||
AntarchyFabricEntities.MANTIS,
|
||||
AntarchyFabricEntities.BED_BUG,
|
||||
AntarchyFabricEntities.WASP,
|
||||
AntarchyFabricEntities.BOMBER,
|
||||
AntarchyFabricEntities.SCORPION,
|
||||
AntarchyFabricEntities.CATERPILLAR,
|
||||
AntarchyFabricEntities.BUTTERFLY,
|
||||
AntarchyFabricEntities.REVERIE,
|
||||
AntarchyFabricEntities.TRIFFID,
|
||||
AntarchyFabricEntities.BRUTALFLY,
|
||||
AntarchyFabricEntities.BRUTALFLY_ORB,
|
||||
AntarchyFabricEntities.HUSH_PROJECTILE,
|
||||
AntarchyFabricEntities.TORETERROR,
|
||||
AntarchyFabricEntities.WATER_BOMB,
|
||||
AntarchyFabricEntities.CREEPING_HORROR,
|
||||
AntarchyFabricEntities.LURKING_TERROR,
|
||||
AntarchyFabricEntities.STINK_BUG,
|
||||
AntarchyFabricEntities.CHEEP,
|
||||
AntarchyFabricEntities.DORRIE,
|
||||
() -> AntarchyFabricBlocks.DUPLICATOR_LOG.get(),
|
||||
() -> AntarchyFabricBlocks.DUPLICATOR_SAPLING.get(),
|
||||
() -> AntarchyFabricBlocks.DUCT_TAPE.get(),
|
||||
() -> AntarchyFabricBlocks.INFESTED_ROOTED_DIRT.get(),
|
||||
() -> AntarchyFabricBlocks.INFESTED_COARSE_DIRT.get(),
|
||||
() -> AntarchyFabricBlocks.NYXITE.get(),
|
||||
() -> AntarchyFabricBlocks.SHELLSTONE.get(),
|
||||
() -> AntarchyFabricBlocks.POLISHED_SHELLSTONE.get(),
|
||||
() -> AntarchyFabricBlocks.SHELLSTONE_BRICKS.get(),
|
||||
() -> AntarchyFabricBlocks.CHISELED_SHELLSTONE.get(),
|
||||
() -> AntarchyFabricBlocks.MOSSY_SHELLSTONE_BRICKS.get(),
|
||||
() -> AntarchyFabricBlocks.CRACKED_SHELLSTONE_BRICKS.get(),
|
||||
() -> AntarchyFabricBlocks.MOSSY_SHELLSTONE_BRICK_STAIRS.get(),
|
||||
() -> AntarchyFabricBlocks.MOSSY_SHELLSTONE_BRICK_SLAB.get(),
|
||||
() -> AntarchyFabricBlocks.MOSSY_SHELLSTONE_BRICK_WALL.get(),
|
||||
() -> AntarchyFabricBlocks.SHELLSTONE_STAIRS.get(),
|
||||
() -> AntarchyFabricBlocks.SHELLSTONE_SLAB.get(),
|
||||
() -> AntarchyFabricBlocks.SHELLSTONE_WALL.get(),
|
||||
() -> AntarchyFabricBlocks.POLISHED_SHELLSTONE_STAIRS.get(),
|
||||
() -> AntarchyFabricBlocks.POLISHED_SHELLSTONE_SLAB.get(),
|
||||
() -> AntarchyFabricBlocks.POLISHED_SHELLSTONE_WALL.get(),
|
||||
() -> AntarchyFabricBlocks.SHELLSTONE_BRICK_STAIRS.get(),
|
||||
() -> AntarchyFabricBlocks.SHELLSTONE_BRICK_SLAB.get(),
|
||||
() -> AntarchyFabricBlocks.SHELLSTONE_BRICK_WALL.get(),
|
||||
() -> AntarchyFabricBlocks.CLOUD_BLOCK.get(),
|
||||
() -> AntarchyFabricBlocks.TRIFFID_GOO_BLOCK.get(),
|
||||
() -> AntarchyFabricBlocks.PALE_NYXITE.get(),
|
||||
() -> AntarchyFabricBlocks.NYXITE_SPIKE.get(),
|
||||
() -> AntarchyFabricBlocks.CHITEN_BLOCK.get(),
|
||||
() -> AntarchyFabricBlocks.CHITEN_SPIKE.get(),
|
||||
() -> AntarchyFabricBlocks.POTENT_NYXITE.get(),
|
||||
() -> AntarchyFabricBlocks.ANTIMETAL.get(),
|
||||
() -> AntarchyFabricBlocks.POLISHED_ANTIMETAL.get(),
|
||||
() -> AntarchyFabricBlocks.BUDDING_BLOOD_CRYSTAL.get(),
|
||||
() -> AntarchyFabricBlocks.SMALL_BLOOD_CRYSTAL_BUD.get(),
|
||||
() -> AntarchyFabricBlocks.MEDIUM_BLOOD_CRYSTAL_BUD.get(),
|
||||
() -> AntarchyFabricBlocks.LARGE_BLOOD_CRYSTAL_BUD.get(),
|
||||
() -> AntarchyFabricBlocks.BLOOD_CRYSTAL_CRYSTAL.get(),
|
||||
() -> AntarchyFabricItems.OURANWOOD_ACORN.get(),
|
||||
AntarchyFabricItems.KRAKEN_TOOTH,
|
||||
() -> AntarchyFabricItems.MOGGLES.get(),
|
||||
() -> AntarchyFabricItems.REVERIE_BOTTLE.get(),
|
||||
() -> AntarchyFabricItems.STINK_BUG_ITEM.get(),
|
||||
() -> AntarchyFabricMisc.mobEffectHolder(AntarchyFabricMisc.DREAD),
|
||||
() -> AntarchyFabricMisc.mobEffectHolder(AntarchyFabricMisc.PARALYZED),
|
||||
() -> AntarchyFabricMisc.mobEffectHolder(AntarchyFabricMisc.INVERTED),
|
||||
() -> AntarchyFabricMisc.mobEffectHolder(AntarchyFabricMisc.STINKY),
|
||||
() -> AntarchyFabricBlocks.OURANWOOD_ACORN_BLOCK.get(),
|
||||
() -> AntarchyFabricBlocks.MOSSY_OURANWOOD_LOG.get(),
|
||||
() -> AntarchyFabricBlocks.MOSSY_OURANWOOD_WOOD.get(),
|
||||
() -> AntarchyFabricBlocks.UMBRAL_MOSS_BLOCK.get(),
|
||||
() -> AntarchyFabricBlocks.UMBRAL_MOSS_CARPET.get(),
|
||||
() -> AntarchyFabricBlocks.BLUSH_MOSS_BLOCK.get(),
|
||||
() -> AntarchyFabricBlocks.BLUSH_MOSS_CARPET.get(),
|
||||
() -> AntarchyFabricBlocks.ORANGE_MILKWEED.get(),
|
||||
() -> AntarchyFabricBlocks.PINK_MILKWEED.get(),
|
||||
() -> AntarchyFabricBlocks.BED_BUG_EGG.get(),
|
||||
() -> AntarchyFabricBlocks.CREEPING_HORROR_EGG.get(),
|
||||
() -> AntarchyFabricBlocks.LURKING_TERROR_EGG.get(),
|
||||
() -> AntarchyFabricBlocks.WASP_NEST.get(),
|
||||
() -> AntarchyFabricBlocks.HUSHWEED.get(),
|
||||
() -> AntarchyFabricBlocks.OURANWOOD_SQUIRREL_NEST.get(),
|
||||
() -> AntarchyFabricBlocks.BRUTALFLY_COCOON_SPAWNER.get(),
|
||||
() -> AntarchyFabricBlocks.GIANT_LILY_PAD.get(),
|
||||
() -> AntarchyFabricBlocks.SEASHELL.get(),
|
||||
() -> AntarchyFabricBlocks.ANT_NEST_BLOCK_ENTITY.get(),
|
||||
() -> AntarchyFabricBlocks.DREAM_CAMPFIRE_BLOCK_ENTITY.get(),
|
||||
() -> AntarchyFabricBlocks.WASP_NEST_BLOCK_ENTITY.get(),
|
||||
() -> AntarchyFabricBlocks.HUSHWEED_BLOCK_ENTITY.get(),
|
||||
() -> AntarchyFabricBlocks.SEASHELL_BLOCK_ENTITY.get(),
|
||||
() -> AntarchyFabricMisc.STINKY_GAS.get(),
|
||||
() -> AntarchyFabricMisc.STINKY_FLY.get(),
|
||||
() -> AntarchyFabricMisc.PEACH_LEAVES_PARTICLE.get(),
|
||||
() -> AntarchyFabricMisc.attributeHolder(AntarchyFabricMisc.SCALE),
|
||||
() -> AntarchyFabricMisc.attributeHolder(AntarchyFabricMisc.DOUBLE_DAMAGE_CHANCE),
|
||||
() -> AntarchyFabricMisc.attributeHolder(AntarchyFabricMisc.BLOODGLASS_MAX_HEARTS),
|
||||
() -> AntarchyFabricMisc.mobEffectHolder(AntarchyFabricMisc.BLOODGLASS_WARD)
|
||||
);
|
||||
|
||||
LucidEyeProjectileEntity.defaultItemSupplier = () -> AntarchyFabricItems.LUCID_PEARL.get();
|
||||
LucidEntity.invertedEffectSupplier = () -> AntarchyFabricMisc.mobEffectHolder(AntarchyFabricMisc.INVERTED);
|
||||
LucidEntity.boltEntityTypeSupplier = () -> AntarchyFabricEntities.LUCID_BOLT.get();
|
||||
LucidBoltEntity.invertedEffectSupplier = () -> AntarchyFabricMisc.mobEffectHolder(AntarchyFabricMisc.INVERTED);
|
||||
LucidEyeProjectileEntity.invertedEffectSupplier = () -> AntarchyFabricMisc.mobEffectHolder(AntarchyFabricMisc.INVERTED);
|
||||
|
||||
ScorpionWhipTetherSync.setSink(AntarchyFabricNetworking::syncScorpionWhipTether);
|
||||
HerculesBeetleImpactShakeSync.setSink((player, ticks) -> {
|
||||
com.craisinlord.antarchy.content.network.HerculesBeetleImpactShakePayload payload = new com.craisinlord.antarchy.content.network.HerculesBeetleImpactShakePayload(ticks);
|
||||
com.craisinlord.antarchy.fabric.network.AntarchyFabricNetworking.sendToPlayer(player, payload, com.craisinlord.antarchy.content.network.HerculesBeetleImpactShakePayload.STREAM_CODEC, com.craisinlord.antarchy.content.network.HerculesBeetleImpactShakePayload.TYPE);
|
||||
});
|
||||
ImpactShakeSync.setSink((player, payload) ->
|
||||
com.craisinlord.antarchy.fabric.network.AntarchyFabricNetworking.sendToPlayer(player, payload, com.craisinlord.antarchy.content.network.ImpactShakePayload.STREAM_CODEC, com.craisinlord.antarchy.content.network.ImpactShakePayload.TYPE));
|
||||
HordeIntensitySync.setSink((player, payload) ->
|
||||
com.craisinlord.antarchy.fabric.network.AntarchyFabricNetworking.sendToPlayer(player, payload, com.craisinlord.antarchy.content.network.HordeIntensityPayload.STREAM_CODEC, com.craisinlord.antarchy.content.network.HordeIntensityPayload.TYPE));
|
||||
BloodCrystalKatanaItem.setTrailCallback(AntarchyFabricNetworking::syncKatanaTrail);
|
||||
com.craisinlord.antarchy.content.gravity.AntarchyGravityApi.setSyncDispatcher(AntarchyFabricNetworking::syncGravityEntity);
|
||||
AntarchyFabricEvents.register();
|
||||
|
||||
if (isSupportedInfinityLoaded()) {
|
||||
InfinityCompat.bind(new FabricInfinityCompat());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static boolean isSupportedInfinityLoaded() {
|
||||
if (!FabricInfinityCompat.isAvailableOnClasspath()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
String version = FabricLoader.getInstance()
|
||||
.getModContainer("infinity")
|
||||
.map(container -> container.getMetadata().getVersion().getFriendlyString())
|
||||
.orElse(null);
|
||||
if (InfinityCompatVersion.isSupported(version)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Antarchy.LOGGER.warn(
|
||||
"Skipping Infinity integration because version {} is below the supported minimum {}",
|
||||
version,
|
||||
InfinityCompatVersion.requiredVersion()
|
||||
);
|
||||
} catch (Throwable throwable) {
|
||||
Antarchy.LOGGER.warn("Skipping Infinity integration because the installed Infinity version could not be verified", throwable);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
package com.craisinlord.antarchy.fabric;
|
||||
|
||||
import com.craisinlord.antarchy.Antarchy;
|
||||
import com.craisinlord.antarchy.content.dispenser.AntimetalMinecartDispenseBehavior;
|
||||
import com.craisinlord.antarchy.fabric.registry.AntarchyFabricItems;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.BlockSource;
|
||||
import net.minecraft.core.dispenser.DefaultDispenseItemBehavior;
|
||||
import net.minecraft.core.dispenser.DispenseItemBehavior;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.MobSpawnType;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.SpawnEggItem;
|
||||
import net.minecraft.world.level.block.DispenserBlock;
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
|
||||
public final class AntarchyFabricDispenserBehaviors {
|
||||
private static final DispenseItemBehavior ANTIMETAL_MINECART_BEHAVIOR = new AntimetalMinecartDispenseBehavior();
|
||||
private static final DispenseItemBehavior SPAWN_EGG_BEHAVIOR = new DefaultDispenseItemBehavior() {
|
||||
@Override
|
||||
public ItemStack execute(BlockSource source, ItemStack stack) {
|
||||
Direction direction = source.getBlockState().getValue(DispenserBlock.FACING);
|
||||
EntityType<?> entityType = ((SpawnEggItem) stack.getItem()).getType(stack.getTag());
|
||||
|
||||
try {
|
||||
entityType.spawn(source.getLevel(), stack.getTag(), null, source.getPos().relative(direction), MobSpawnType.DISPENSER, direction != Direction.UP, false);
|
||||
} catch (Exception exception) {
|
||||
Antarchy.LOGGER.error("Error while dispensing spawn egg from dispenser at {}", source.getPos(), exception);
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
stack.shrink(1);
|
||||
source.getLevel().gameEvent(null, GameEvent.ENTITY_PLACE, source.getPos());
|
||||
return stack;
|
||||
}
|
||||
};
|
||||
|
||||
private AntarchyFabricDispenserBehaviors() {
|
||||
}
|
||||
|
||||
public static void register() {
|
||||
registerSpawnEggs();
|
||||
registerPotions();
|
||||
registerMinecarts();
|
||||
}
|
||||
|
||||
private static void registerSpawnEggs() {
|
||||
for (var holder : AntarchyFabricItems.ITEMS.getEntries()) {
|
||||
Item item = holder.get();
|
||||
if (item instanceof SpawnEggItem) {
|
||||
DispenserBlock.registerBehavior(item, SPAWN_EGG_BEHAVIOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerPotions() {
|
||||
}
|
||||
|
||||
private static void registerMinecarts() {
|
||||
DispenserBlock.registerBehavior(Items.MINECART, ANTIMETAL_MINECART_BEHAVIOR);
|
||||
DispenserBlock.registerBehavior(Items.CHEST_MINECART, ANTIMETAL_MINECART_BEHAVIOR);
|
||||
DispenserBlock.registerBehavior(Items.FURNACE_MINECART, ANTIMETAL_MINECART_BEHAVIOR);
|
||||
DispenserBlock.registerBehavior(Items.TNT_MINECART, ANTIMETAL_MINECART_BEHAVIOR);
|
||||
DispenserBlock.registerBehavior(Items.HOPPER_MINECART, ANTIMETAL_MINECART_BEHAVIOR);
|
||||
DispenserBlock.registerBehavior(Items.COMMAND_BLOCK_MINECART, ANTIMETAL_MINECART_BEHAVIOR);
|
||||
}
|
||||
}
|
||||
+289
@@ -0,0 +1,289 @@
|
||||
package com.craisinlord.antarchy.fabric;
|
||||
import com.craisinlord.antarchy.fabric.registry.AntarchyFabricBlocks;
|
||||
import com.craisinlord.antarchy.fabric.registry.AntarchyFabricItems;
|
||||
|
||||
import com.craisinlord.antarchy.content.entity.ReverieEntity;
|
||||
import com.craisinlord.antarchy.config.AntarchySettings;
|
||||
import com.craisinlord.antarchy.content.AntarchyObjects;
|
||||
import com.craisinlord.antarchy.content.block.DuctTapeBlock;
|
||||
import com.craisinlord.antarchy.content.item.AttitudeAdjusterItem;
|
||||
import com.craisinlord.antarchy.content.item.AttitudeAdjusterSlamManager;
|
||||
import com.craisinlord.antarchy.content.fluid.AntarchyFluidChecks;
|
||||
import com.craisinlord.antarchy.content.entity.MissileSquidEntity;
|
||||
import com.craisinlord.antarchy.content.entity.kraken.KrakenEntity;
|
||||
import com.craisinlord.antarchy.content.gravity.AntarchyGravityApi;
|
||||
import com.craisinlord.antarchy.content.gravity.AntarchyGravityDirection;
|
||||
import com.craisinlord.antarchy.content.gravity.AntarchyGravityTransition;
|
||||
import com.craisinlord.antarchy.content.horde.CavarynHordeManager;
|
||||
import com.craisinlord.antarchy.content.portal.PermanentPortalManager;
|
||||
import com.craisinlord.antarchy.content.command.CavarynCommand;
|
||||
import com.craisinlord.antarchy.content.command.CaterpillarCommand;
|
||||
import com.craisinlord.antarchy.content.command.GravityCommand;
|
||||
import com.craisinlord.antarchy.content.item.MinersDreamExcavationManager;
|
||||
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
|
||||
import net.fabricmc.fabric.api.entity.event.v1.ServerLivingEntityEvents;
|
||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.trade.TradeOfferHelper;
|
||||
import net.fabricmc.fabric.api.event.player.AttackEntityCallback;
|
||||
import net.fabricmc.fabric.api.event.player.PlayerBlockBreakEvents;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import com.craisinlord.antarchy.content.dispenser.SquidzookaDispenseBehavior;
|
||||
import com.craisinlord.antarchy.content.dispenser.RpoLauncherDispenseBehavior;
|
||||
import com.craisinlord.antarchy.content.dispenser.SizeRayDispenseBehavior;
|
||||
import com.craisinlord.antarchy.content.dispenser.WaterCannonDispenseBehavior;
|
||||
import net.minecraft.world.level.block.ComposterBlock;
|
||||
import net.minecraft.world.level.block.DispenserBlock;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.tags.FluidTags;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.MobSpawnType;
|
||||
import net.minecraft.world.entity.npc.VillagerProfession;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.trading.MerchantOffer;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
public final class AntarchyFabricEvents {
|
||||
private static final AntarchyGravityTransition INVERTED_CLEAR_TRANSITION = new AntarchyGravityTransition(12);
|
||||
private static final Set<UUID> invertedPlayers = new HashSet<>();
|
||||
|
||||
private AntarchyFabricEvents() {
|
||||
}
|
||||
|
||||
public static void register() {
|
||||
CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> {
|
||||
CavarynCommand.register(dispatcher);
|
||||
GravityCommand.register(dispatcher);
|
||||
CaterpillarCommand.register(dispatcher);
|
||||
});
|
||||
|
||||
DispenserBlock.registerBehavior(AntarchyFabricItems.SQUIDZOOKA.get(), new SquidzookaDispenseBehavior());
|
||||
DispenserBlock.registerBehavior(AntarchyFabricItems.RPO_LAUNCHER.get(), new RpoLauncherDispenseBehavior());
|
||||
DispenserBlock.registerBehavior(AntarchyFabricItems.WATER_CANNON.get(), new WaterCannonDispenseBehavior());
|
||||
DispenserBlock.registerBehavior(AntarchyFabricItems.SHRINK_RAY.get(), new SizeRayDispenseBehavior());
|
||||
DispenserBlock.registerBehavior(AntarchyFabricItems.GROWTH_RAY.get(), new SizeRayDispenseBehavior());
|
||||
AntarchyFabricDispenserBehaviors.register();
|
||||
registerTrades();
|
||||
|
||||
ComposterBlock.COMPOSTABLES.put(AntarchyFabricBlocks.UMBRAL_MOSS_BLOCK.get().asItem(), 0.65f);
|
||||
ComposterBlock.COMPOSTABLES.put(AntarchyFabricBlocks.UMBRAL_MOSS_CARPET.get().asItem(), 0.3f);
|
||||
ComposterBlock.COMPOSTABLES.put(AntarchyFabricBlocks.BLUSH_MOSS_BLOCK.get().asItem(), 0.65f);
|
||||
ComposterBlock.COMPOSTABLES.put(AntarchyFabricBlocks.BLUSH_MOSS_CARPET.get().asItem(), 0.3f);
|
||||
ComposterBlock.COMPOSTABLES.put(AntarchyFabricBlocks.HUSHWEED.get().asItem(), 0.65f);
|
||||
ComposterBlock.COMPOSTABLES.put(AntarchyFabricItems.CORNEA_EAR.get(), 0.65f);
|
||||
ComposterBlock.COMPOSTABLES.put(AntarchyFabricBlocks.PEACH_LEAVES.get().asItem(), 0.3f);
|
||||
ComposterBlock.COMPOSTABLES.put(AntarchyFabricItems.PEACH_SAPLING_ITEM.get(), 0.3f);
|
||||
ComposterBlock.COMPOSTABLES.put(AntarchyFabricItems.CORN.get(), 0.65f);
|
||||
ComposterBlock.COMPOSTABLES.put(AntarchyFabricItems.CORN_SEEDS.get(), 0.3f);
|
||||
ComposterBlock.COMPOSTABLES.put(AntarchyFabricItems.PEACH.get(), 0.65f);
|
||||
|
||||
ServerLivingEntityEvents.AFTER_DEATH.register((entity, damageSource) -> {
|
||||
if (entity instanceof ServerPlayer sp) {
|
||||
BloodglassManager.handleDeath(sp);
|
||||
}
|
||||
PermanentPortalManager.handleSacrifice(entity);
|
||||
if (entity.getKillCredit() instanceof ServerPlayer killer) {
|
||||
CavarynHordeManager.recordMobKill(killer, entity);
|
||||
}
|
||||
if (entity instanceof MissileSquidEntity missileSquid) {
|
||||
if (missileSquid.isSpawnedByKraken()) {
|
||||
return;
|
||||
}
|
||||
} else if (entity.getType() != net.minecraft.world.entity.EntityType.SQUID) {
|
||||
return;
|
||||
}
|
||||
if (!(entity.level() instanceof ServerLevel serverLevel)) {
|
||||
return;
|
||||
}
|
||||
if (!(entity.getKillCredit() instanceof Player killer)) {
|
||||
return;
|
||||
}
|
||||
|
||||
boolean requireBadOmen = AntarchySettings.krakenRequireBadOmenToSummon();
|
||||
int badOmenLevel = badOmenLevel(killer);
|
||||
if (requireBadOmen && badOmenLevel <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
BlockPos deathPos = entity.blockPosition();
|
||||
if (AntarchySettings.krakenSquidSpawnEnabled()) {
|
||||
int chanceDenominator = requireBadOmen ? Math.max(1, 100 / badOmenLevel) : 100;
|
||||
if (serverLevel.random.nextInt(chanceDenominator) == 0) {
|
||||
spawnKrakens(serverLevel, deathPos, 1);
|
||||
}
|
||||
}
|
||||
if (AntarchySettings.krakenMassSpawnEnabled() && serverLevel.random.nextInt(500) == 0) {
|
||||
spawnKrakens(serverLevel, deathPos, 10);
|
||||
}
|
||||
});
|
||||
|
||||
AttackEntityCallback.EVENT.register((player, world, hand, entity, hitResult) -> {
|
||||
if (!world.isClientSide && player.getItemInHand(hand).getItem() instanceof AttitudeAdjusterItem && player.getAttackStrengthScale(0.5F) >= 0.95F) {
|
||||
AttitudeAdjusterSlamManager.markSpecialHit(player);
|
||||
}
|
||||
return InteractionResult.PASS;
|
||||
});
|
||||
PlayerBlockBreakEvents.AFTER.register((world, player, pos, state, blockEntity) -> {
|
||||
if (!world.isClientSide && player instanceof ServerPlayer serverPlayer) {
|
||||
CavarynHordeManager.recordBlockBreak(serverPlayer, state, pos);
|
||||
}
|
||||
});
|
||||
|
||||
ServerTickEvents.END_SERVER_TICK.register(server -> {
|
||||
Set<UUID> activeThisTick = new HashSet<>();
|
||||
for (ServerLevel level : server.getAllLevels()) {
|
||||
CavarynHordeManager.tick(level);
|
||||
tickInvertedPlayers(level, activeThisTick);
|
||||
tickDuctTapePlayers(level);
|
||||
tickIchorPlayers(level);
|
||||
tickBloodglassRecharge(level);
|
||||
AttitudeAdjusterSlamManager.tick(level);
|
||||
MinersDreamExcavationManager.tick(level);
|
||||
}
|
||||
invertedPlayers.retainAll(activeThisTick);
|
||||
});
|
||||
}
|
||||
|
||||
private static void registerTrades() {
|
||||
TradeOfferHelper.registerVillagerOffers(VillagerProfession.FARMER, 1, factories ->
|
||||
factories.add((trader, random) -> new MerchantOffer(
|
||||
new ItemStack(AntarchyFabricItems.CORN.get(), 20),
|
||||
new ItemStack(Items.EMERALD),
|
||||
16,
|
||||
2,
|
||||
0.05F
|
||||
)));
|
||||
TradeOfferHelper.registerVillagerOffers(VillagerProfession.BUTCHER, 1, factories ->
|
||||
factories.add((trader, random) -> new MerchantOffer(
|
||||
new ItemStack(AntarchyFabricItems.COOKED_CORNDOG.get(), 5),
|
||||
new ItemStack(Items.EMERALD),
|
||||
16,
|
||||
2,
|
||||
0.05F
|
||||
)));
|
||||
TradeOfferHelper.registerWanderingTraderOffers(0, factories ->
|
||||
factories.add((trader, random) -> new MerchantOffer(
|
||||
new ItemStack(Items.EMERALD, 1),
|
||||
new ItemStack(AntarchyFabricItems.CORN_SEEDS.get(), 3),
|
||||
12,
|
||||
2,
|
||||
0.05F
|
||||
)));
|
||||
}
|
||||
|
||||
private static int badOmenLevel(Player player) {
|
||||
MobEffectInstance effect = player.getEffect(MobEffects.BAD_OMEN);
|
||||
return effect != null ? effect.getAmplifier() + 1 : 0;
|
||||
}
|
||||
|
||||
private static void spawnKrakens(ServerLevel level, BlockPos origin, int count) {
|
||||
for (int i = 0; i < count; i++) {
|
||||
BlockPos spawnPos = findKrakenSpawnPos(level, origin);
|
||||
KrakenEntity kraken = AntarchyObjects.KRAKEN.get().create(level);
|
||||
if (kraken == null) {
|
||||
continue;
|
||||
}
|
||||
kraken.moveTo(spawnPos.getX() + 0.5D, spawnPos.getY() + 1.0D, spawnPos.getZ() + 0.5D,
|
||||
level.random.nextFloat() * 360.0F, 0.0F);
|
||||
kraken.finalizeSpawn(level, level.getCurrentDifficultyAt(spawnPos), MobSpawnType.EVENT, null, null);
|
||||
level.addFreshEntity(kraken);
|
||||
}
|
||||
}
|
||||
|
||||
private static BlockPos findKrakenSpawnPos(ServerLevel level, BlockPos origin) {
|
||||
for (int attempt = 0; attempt < 20; attempt++) {
|
||||
BlockPos candidate = origin.offset(
|
||||
level.random.nextInt(33) - 16,
|
||||
level.random.nextInt(9) - 4,
|
||||
level.random.nextInt(33) - 16
|
||||
);
|
||||
if (level.getFluidState(candidate).is(FluidTags.WATER)) {
|
||||
return candidate;
|
||||
}
|
||||
}
|
||||
return origin.above(3);
|
||||
}
|
||||
|
||||
private static void tickInvertedPlayers(ServerLevel level, Set<UUID> activeThisTick) {
|
||||
for (Player player : level.players()) {
|
||||
LivingEntity livingEntity = player;
|
||||
|
||||
if (livingEntity.hasEffect(AntarchyObjects.INVERTED_EFFECT.get())) {
|
||||
activeThisTick.add(player.getUUID());
|
||||
invertedPlayers.add(player.getUUID());
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!invertedPlayers.remove(player.getUUID())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (AntarchyGravityApi.getGravityDirection(player) == AntarchyGravityDirection.UP
|
||||
|| AntarchyGravityApi.isGravityForced(player)) {
|
||||
AntarchyGravityApi.setGravityDirection(player, AntarchyGravityDirection.DOWN, INVERTED_CLEAR_TRANSITION);
|
||||
}
|
||||
notifyNearbyReveriesOfInversionChange(player);
|
||||
}
|
||||
}
|
||||
|
||||
private static void notifyNearbyReveriesOfInversionChange(Player player) {
|
||||
for (ReverieEntity reverie : player.level().getEntitiesOfClass(
|
||||
ReverieEntity.class,
|
||||
player.getBoundingBox().inflate(48.0D)
|
||||
)) {
|
||||
reverie.syncFocusInversionState();
|
||||
}
|
||||
}
|
||||
|
||||
private static void tickDuctTapePlayers(ServerLevel level) {
|
||||
for (Player player : level.players()) {
|
||||
DuctTapeBlock.tickStuckEntity(player);
|
||||
}
|
||||
}
|
||||
|
||||
private static void tickIchorPlayers(ServerLevel level) {
|
||||
if (!AntarchySettings.ichorWitherEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (Player player : level.players()) {
|
||||
if (!antarchy$isInIchor(player)) {
|
||||
continue;
|
||||
}
|
||||
player.addEffect(new MobEffectInstance(MobEffects.WITHER, 40, 0, false, true, true));
|
||||
}
|
||||
}
|
||||
|
||||
private static void tickBloodglassRecharge(ServerLevel level) {
|
||||
for (Player player : level.players()) {
|
||||
if (player instanceof ServerPlayer sp) {
|
||||
BloodglassManager.tickRecharge(sp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean antarchy$isInIchor(LivingEntity entity) {
|
||||
BlockPos min = BlockPos.containing(entity.getBoundingBox().minX, entity.getBoundingBox().minY, entity.getBoundingBox().minZ);
|
||||
BlockPos max = BlockPos.containing(entity.getBoundingBox().maxX, entity.getBoundingBox().maxY, entity.getBoundingBox().maxZ);
|
||||
BlockPos.MutableBlockPos cursor = new BlockPos.MutableBlockPos();
|
||||
for (int x = min.getX(); x <= max.getX(); x++) {
|
||||
for (int y = min.getY(); y <= max.getY(); y++) {
|
||||
for (int z = min.getZ(); z <= max.getZ(); z++) {
|
||||
cursor.set(x, y, z);
|
||||
if (AntarchyFluidChecks.isIchor(entity.level().getFluidState(cursor))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.craisinlord.antarchy.fabric;
|
||||
|
||||
import com.craisinlord.antarchy.Antarchy;
|
||||
import com.craisinlord.antarchy.fabric.mixin.WoodTypeInvoker;
|
||||
import net.minecraft.world.level.block.state.properties.BlockSetType;
|
||||
import net.minecraft.world.level.block.state.properties.WoodType;
|
||||
|
||||
public final class AntarchyWoodTypes {
|
||||
public static final WoodType OURANWOOD = register("ouranwood");
|
||||
public static final WoodType PEACH = register("peach");
|
||||
|
||||
private AntarchyWoodTypes() {
|
||||
}
|
||||
|
||||
private static WoodType register(String name) {
|
||||
return WoodTypeInvoker.antarchy$register(new WoodType(Antarchy.MODID + ":" + name, BlockSetType.JUNGLE));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,236 @@
|
||||
package com.craisinlord.antarchy.fabric;
|
||||
|
||||
import com.craisinlord.antarchy.config.AntarchySettings;
|
||||
import com.craisinlord.antarchy.content.AntarchyObjects;
|
||||
import com.craisinlord.antarchy.content.bloodglass.BloodglassAccess;
|
||||
import com.craisinlord.antarchy.content.item.BloodCrystalArmorItem;
|
||||
import com.craisinlord.antarchy.fabric.network.AntarchyFabricNetworking;
|
||||
import net.fabricmc.fabric.api.entity.event.v1.ServerLivingEntityEvents;
|
||||
import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents;
|
||||
import net.minecraft.core.particles.DustParticleOptions;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.damagesource.DamageType;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
public final class BloodglassManager {
|
||||
private static final TagKey<DamageType> BYPASSES_BLOODGLASS = TagKey.create(
|
||||
Registries.DAMAGE_TYPE,
|
||||
new ResourceLocation("antarchy", "bypasses_bloodglass")
|
||||
);
|
||||
|
||||
private BloodglassManager() {}
|
||||
|
||||
public static void register() {
|
||||
ServerLivingEntityEvents.ALLOW_DAMAGE.register((entity, source, amount) -> {
|
||||
if (!(entity instanceof Player player)) return true;
|
||||
if (entity.level().isClientSide()) return true;
|
||||
if (amount <= 1.0f) return true;
|
||||
if (source.is(BYPASSES_BLOODGLASS)) return true;
|
||||
|
||||
BloodglassAccess access = (BloodglassAccess) player;
|
||||
if (access.antarchy$getTotalShieldsActive() <= 0) return true;
|
||||
|
||||
if (access.antarchy$getAppleShieldsActive() > 0) {
|
||||
access.antarchy$setAppleShieldsActive(access.antarchy$getAppleShieldsActive() - 1);
|
||||
access.antarchy$setAppleShieldLostCount(access.antarchy$getAppleShieldLostCount() + 1);
|
||||
if (access.antarchy$getAppleRechargeTimer() == 0) {
|
||||
access.antarchy$setAppleRechargeTimer(AntarchySettings.bloodCrystalAppleShieldRechargeTicks());
|
||||
}
|
||||
} else {
|
||||
access.antarchy$setArmorShieldsActive(access.antarchy$getArmorShieldsActive() - 1);
|
||||
access.antarchy$setArmorShieldLostCount(access.antarchy$getArmorShieldLostCount() + 1);
|
||||
if (access.antarchy$getArmorRechargeTimer() == 0) {
|
||||
access.antarchy$setArmorRechargeTimer(AntarchySettings.bloodCrystalArmorShieldRechargeTicks());
|
||||
}
|
||||
}
|
||||
|
||||
ServerLevel serverLevel = (ServerLevel) player.level();
|
||||
serverLevel.broadcastEntityEvent(player, (byte) 2);
|
||||
serverLevel.playSound(null, player.blockPosition(), SoundEvents.GLASS_BREAK, SoundSource.PLAYERS, 1.0f, 1.0f);
|
||||
serverLevel.sendParticles(
|
||||
new DustParticleOptions(new Vector3f(0.85f, 0.18f, 0.38f), 1.2f),
|
||||
player.getX(), player.getEyeY(), player.getZ(),
|
||||
35, 0.35, 0.55, 0.35, 0.12
|
||||
);
|
||||
|
||||
syncBloodglass((ServerPlayer) player);
|
||||
return false;
|
||||
});
|
||||
|
||||
ServerPlayConnectionEvents.JOIN.register((handler, sender, server) -> handleLogin(handler.player));
|
||||
}
|
||||
|
||||
public static void syncBloodglass(ServerPlayer player) {
|
||||
BloodglassAccess access = (BloodglassAccess) player;
|
||||
AntarchyFabricNetworking.syncBloodglass(player,
|
||||
access.antarchy$getTotalShieldsActive(),
|
||||
access.antarchy$getTotalShieldsMax());
|
||||
}
|
||||
|
||||
public static void handleArmorEquipChange(Player player, EquipmentSlot slot, ItemStack from, ItemStack to) {
|
||||
if (player.level().isClientSide()) return;
|
||||
if (slot != EquipmentSlot.HEAD && slot != EquipmentSlot.CHEST
|
||||
&& slot != EquipmentSlot.LEGS && slot != EquipmentSlot.FEET) return;
|
||||
|
||||
boolean fromIsBC = from.getItem() instanceof BloodCrystalArmorItem;
|
||||
boolean toIsBC = to.getItem() instanceof BloodCrystalArmorItem;
|
||||
if (!fromIsBC && !toIsBC) return;
|
||||
|
||||
BloodglassAccess access = (BloodglassAccess) player;
|
||||
|
||||
if (fromIsBC && !toIsBC) {
|
||||
if (access.antarchy$getArmorShieldsActive() > 0) {
|
||||
access.antarchy$setArmorShieldsActive(access.antarchy$getArmorShieldsActive() - 1);
|
||||
} else if (access.antarchy$getArmorShieldLostCount() > 0) {
|
||||
access.antarchy$setArmorShieldLostCount(access.antarchy$getArmorShieldLostCount() - 1);
|
||||
if (access.antarchy$getArmorShieldLostCount() == 0) {
|
||||
access.antarchy$setArmorRechargeTimer(0);
|
||||
}
|
||||
}
|
||||
} else if (!fromIsBC) {
|
||||
// Count BC pieces: explicitly include the new piece (to) since getItemBySlot(slot)
|
||||
// may not reflect the new item yet when onEquipItem fires on Fabric.
|
||||
int bcPieces = 1; // the piece being equipped now
|
||||
for (EquipmentSlot s : new EquipmentSlot[]{EquipmentSlot.HEAD, EquipmentSlot.CHEST, EquipmentSlot.LEGS, EquipmentSlot.FEET}) {
|
||||
if (s == slot) continue;
|
||||
if (player.getItemBySlot(s).getItem() instanceof BloodCrystalArmorItem) bcPieces++;
|
||||
}
|
||||
int currentTotal = access.antarchy$getArmorShieldsActive() + access.antarchy$getArmorShieldLostCount();
|
||||
if (currentTotal < bcPieces) {
|
||||
access.antarchy$setArmorShieldLostCount(access.antarchy$getArmorShieldLostCount() + 1);
|
||||
access.antarchy$setArmorRechargeTimer(AntarchySettings.bloodCrystalArmorShieldRechargeTicks());
|
||||
}
|
||||
} else {
|
||||
// BC → BC swap: remove old slot, queue new one
|
||||
if (access.antarchy$getArmorShieldsActive() > 0) {
|
||||
access.antarchy$setArmorShieldsActive(access.antarchy$getArmorShieldsActive() - 1);
|
||||
} else if (access.antarchy$getArmorShieldLostCount() > 0) {
|
||||
access.antarchy$setArmorShieldLostCount(access.antarchy$getArmorShieldLostCount() - 1);
|
||||
}
|
||||
access.antarchy$setArmorShieldLostCount(access.antarchy$getArmorShieldLostCount() + 1);
|
||||
access.antarchy$setArmorRechargeTimer(AntarchySettings.bloodCrystalArmorShieldRechargeTicks());
|
||||
}
|
||||
|
||||
if (player instanceof ServerPlayer sp) syncBloodglass(sp);
|
||||
}
|
||||
|
||||
public static void handleWardApplied(Player player, int amplifier) {
|
||||
if (player.level().isClientSide()) return;
|
||||
BloodglassAccess access = (BloodglassAccess) player;
|
||||
int cap = Math.max(0, AntarchySettings.bloodCrystalHardMaxShields()
|
||||
- access.antarchy$getArmorShieldsActive()
|
||||
- access.antarchy$getArmorShieldLostCount());
|
||||
int targetCap = Math.min(amplifier + 1, cap);
|
||||
int currentCap = access.antarchy$getAppleShieldsActive() + access.antarchy$getAppleShieldLostCount();
|
||||
// Only grant newly-added capacity (e.g. first application, or a higher amplifier).
|
||||
// A mere duration refresh of an already-active ward must not reset shields that are
|
||||
// already lost, nor restart their recharge timer.
|
||||
if (targetCap > currentCap) {
|
||||
access.antarchy$setAppleShieldsActive(access.antarchy$getAppleShieldsActive() + (targetCap - currentCap));
|
||||
if (player instanceof ServerPlayer sp) syncBloodglass(sp);
|
||||
}
|
||||
}
|
||||
|
||||
public static void handleWardRemoved(Player player) {
|
||||
if (player.level().isClientSide()) return;
|
||||
BloodglassAccess access = (BloodglassAccess) player;
|
||||
access.antarchy$setAppleShieldsActive(0);
|
||||
access.antarchy$setAppleShieldLostCount(0);
|
||||
access.antarchy$setAppleRechargeTimer(0);
|
||||
if (player instanceof ServerPlayer sp) syncBloodglass(sp);
|
||||
}
|
||||
|
||||
public static void tickRecharge(ServerPlayer player) {
|
||||
BloodglassAccess access = (BloodglassAccess) player;
|
||||
boolean changed = false;
|
||||
int hardCap = AntarchySettings.bloodCrystalHardMaxShields();
|
||||
|
||||
if (access.antarchy$getArmorShieldLostCount() > 0) {
|
||||
int timer = access.antarchy$getArmorRechargeTimer();
|
||||
if (timer > 1) {
|
||||
access.antarchy$setArmorRechargeTimer(timer - 1);
|
||||
} else if (timer == 1) {
|
||||
if (access.antarchy$getTotalShieldsActive() < hardCap) {
|
||||
access.antarchy$setArmorShieldsActive(access.antarchy$getArmorShieldsActive() + 1);
|
||||
access.antarchy$setArmorShieldLostCount(access.antarchy$getArmorShieldLostCount() - 1);
|
||||
changed = true;
|
||||
}
|
||||
access.antarchy$setArmorRechargeTimer(access.antarchy$getArmorShieldLostCount() > 0
|
||||
? AntarchySettings.bloodCrystalArmorShieldRechargeTicks() : 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (access.antarchy$getAppleShieldLostCount() > 0 && player.hasEffect(AntarchyObjects.BLOODGLASS_WARD.get())) {
|
||||
int timer = access.antarchy$getAppleRechargeTimer();
|
||||
if (timer > 1) {
|
||||
access.antarchy$setAppleRechargeTimer(timer - 1);
|
||||
} else if (timer == 1) {
|
||||
if (access.antarchy$getTotalShieldsActive() < hardCap) {
|
||||
access.antarchy$setAppleShieldsActive(access.antarchy$getAppleShieldsActive() + 1);
|
||||
access.antarchy$setAppleShieldLostCount(access.antarchy$getAppleShieldLostCount() - 1);
|
||||
changed = true;
|
||||
}
|
||||
access.antarchy$setAppleRechargeTimer(access.antarchy$getAppleShieldLostCount() > 0
|
||||
? AntarchySettings.bloodCrystalAppleShieldRechargeTicks() : 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
syncBloodglass(player);
|
||||
player.playNotifySound(SoundEvents.AMETHYST_BLOCK_CHIME, SoundSource.PLAYERS, 0.6f, 1.6f);
|
||||
}
|
||||
}
|
||||
|
||||
public static void handleDeath(ServerPlayer player) {
|
||||
BloodglassAccess access = (BloodglassAccess) player;
|
||||
access.antarchy$setArmorShieldsActive(0);
|
||||
access.antarchy$setArmorShieldLostCount(0);
|
||||
access.antarchy$setArmorRechargeTimer(0);
|
||||
access.antarchy$setAppleShieldsActive(0);
|
||||
access.antarchy$setAppleShieldLostCount(0);
|
||||
access.antarchy$setAppleRechargeTimer(0);
|
||||
syncBloodglass(player);
|
||||
}
|
||||
|
||||
public static void handleRespawn(ServerPlayer player) {
|
||||
BloodglassAccess access = (BloodglassAccess) player;
|
||||
int shields = Math.min(countBCArmorPieces(player), AntarchySettings.bloodCrystalHardMaxShields());
|
||||
access.antarchy$setArmorShieldsActive(shields);
|
||||
access.antarchy$setArmorShieldLostCount(0);
|
||||
access.antarchy$setArmorRechargeTimer(0);
|
||||
syncBloodglass(player);
|
||||
}
|
||||
|
||||
private static void handleLogin(ServerPlayer player) {
|
||||
BloodglassAccess access = (BloodglassAccess) player;
|
||||
if (player.hasEffect(AntarchyObjects.BLOODGLASS_WARD.get())) {
|
||||
var effect = player.getEffect(AntarchyObjects.BLOODGLASS_WARD.get());
|
||||
if (effect != null) {
|
||||
int cap = Math.max(0, AntarchySettings.bloodCrystalHardMaxShields()
|
||||
- access.antarchy$getArmorShieldsActive()
|
||||
- access.antarchy$getArmorShieldLostCount());
|
||||
access.antarchy$setAppleShieldsActive(Math.min(effect.getAmplifier() + 1, cap));
|
||||
access.antarchy$setAppleShieldLostCount(0);
|
||||
access.antarchy$setAppleRechargeTimer(0);
|
||||
}
|
||||
}
|
||||
syncBloodglass(player);
|
||||
}
|
||||
|
||||
private static int countBCArmorPieces(Player player) {
|
||||
int count = 0;
|
||||
for (EquipmentSlot slot : new EquipmentSlot[]{EquipmentSlot.HEAD, EquipmentSlot.CHEST, EquipmentSlot.LEGS, EquipmentSlot.FEET}) {
|
||||
if (player.getItemBySlot(slot).getItem() instanceof BloodCrystalArmorItem) count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.craisinlord.antarchy.fabric;
|
||||
|
||||
import com.craisinlord.antarchy.Antarchy;
|
||||
import com.craisinlord.antarchy.compat.infinity.InfinityCompatBridge;
|
||||
import net.lerariemann.infinity.util.InfinityMethods;
|
||||
import net.lerariemann.infinity.util.teleport.WarpLogic;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.util.RandomSource;
|
||||
|
||||
public final class FabricInfinityCompat implements InfinityCompatBridge {
|
||||
public static boolean isAvailableOnClasspath() {
|
||||
try {
|
||||
Class.forName("net.lerariemann.infinity.util.InfinityMethods");
|
||||
Class.forName("net.lerariemann.infinity.util.teleport.WarpLogic");
|
||||
return true;
|
||||
} catch (Throwable ignored) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getRandomDimensionId(RandomSource random) {
|
||||
try {
|
||||
return InfinityMethods.getRandomId(random);
|
||||
} catch (Throwable throwable) {
|
||||
Antarchy.LOGGER.error("[Antarchy] Failed to get a random Infinity dimension id", throwable);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requestWarp(ServerPlayer player, ResourceLocation dimensionId) {
|
||||
try {
|
||||
WarpLogic.requestWarp(player, dimensionId, false);
|
||||
return true;
|
||||
} catch (Throwable throwable) {
|
||||
Antarchy.LOGGER.error("[Antarchy] Failed to request an Infinity warp to {}", dimensionId, throwable);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.craisinlord.antarchy.fabric.client;
|
||||
|
||||
import com.craisinlord.antarchy.fabric.network.AntarchyFabricClientNetworking;
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
|
||||
public final class AntarchyFabricClient implements ClientModInitializer {
|
||||
@Override
|
||||
public void onInitializeClient() {
|
||||
AntarchyFabricClientNetworking.register();
|
||||
AntarchyFabricClientNetworking.bootstrapMultipartClient();
|
||||
AntarchyFabricClientBootstrap.register();
|
||||
}
|
||||
}
|
||||
|
||||
+507
@@ -0,0 +1,507 @@
|
||||
package com.craisinlord.antarchy.fabric.client;
|
||||
import com.craisinlord.antarchy.fabric.registry.AntarchyFabricBlocks;
|
||||
import com.craisinlord.antarchy.fabric.registry.AntarchyFabricEntities;
|
||||
import com.craisinlord.antarchy.fabric.registry.AntarchyFabricItems;
|
||||
import com.craisinlord.antarchy.fabric.registry.AntarchyFabricMisc;
|
||||
|
||||
import com.craisinlord.antarchy.Antarchy;
|
||||
import com.craisinlord.antarchy.content.client.CameraShakeClientState;
|
||||
import com.craisinlord.antarchy.content.client.HerculesBeetleImpactShakeClientState;
|
||||
import com.craisinlord.antarchy.content.client.HordeClientState;
|
||||
import com.craisinlord.antarchy.content.client.renderer.*;
|
||||
import com.craisinlord.antarchy.content.client.particle.*;
|
||||
import com.craisinlord.antarchy.content.client.renderer.AntiwaterFluidRenderer;
|
||||
import com.craisinlord.antarchy.fabric.AntarchyFabricContent;
|
||||
import com.craisinlord.antarchy.fabric.client.renderer.MultipartPartRenderer;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.LivingEntityFeatureRendererRegistrationCallback;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
|
||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||
import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandlerRegistry;
|
||||
import net.fabricmc.fabric.api.client.particle.v1.ParticleFactoryRegistry;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.BlockEntityRendererRegistry;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.ColorProviderRegistry;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.EntityModelLayerRegistry;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents;
|
||||
import net.minecraft.client.model.BoatModel;
|
||||
import net.minecraft.client.model.ChestBoatModel;
|
||||
import net.minecraft.client.gui.screens.MenuScreens;
|
||||
import net.minecraft.client.renderer.BiomeColors;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlas;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
import net.minecraft.client.renderer.blockentity.CampfireRenderer;
|
||||
import net.minecraft.client.renderer.entity.ArmorStandRenderer;
|
||||
import net.minecraft.client.renderer.entity.ThrownItemRenderer;
|
||||
import net.minecraft.client.renderer.item.ItemProperties;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.item.CrossbowItem;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.level.FoliageColor;
|
||||
import net.fabricmc.fabric.api.client.render.fluid.v1.SimpleFluidRenderHandler;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraft.world.level.BlockAndTintGetter;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
public final class AntarchyFabricClientBootstrap {
|
||||
private AntarchyFabricClientBootstrap() {
|
||||
}
|
||||
|
||||
public static void register() {
|
||||
AntarchyKeyBindings.register();
|
||||
MenuScreens.register(AntarchyFabricMisc.DORRIE_INVENTORY_MENU.get(), com.craisinlord.antarchy.content.client.screen.DorrieInventoryScreen::new);
|
||||
registerRenderers();
|
||||
registerEntityLayers();
|
||||
registerColors();
|
||||
registerParticles();
|
||||
registerFluids();
|
||||
registerRenderLayers();
|
||||
registerItemProperties();
|
||||
registerClientCallbacks();
|
||||
}
|
||||
|
||||
private static void registerRenderers() {
|
||||
BlockEntityRendererRegistry.register(
|
||||
(net.minecraft.world.level.block.entity.BlockEntityType) AntarchyFabricBlocks.DREAM_CAMPFIRE_BLOCK_ENTITY.get(),
|
||||
(BlockEntityRendererProvider) CampfireRenderer::new
|
||||
);
|
||||
BlockEntityRendererRegistry.register(
|
||||
(net.minecraft.world.level.block.entity.BlockEntityType) AntarchyFabricBlocks.SEASHELL_BLOCK_ENTITY.get(),
|
||||
(BlockEntityRendererProvider) SeashellRenderer::new
|
||||
);
|
||||
BlockEntityRendererRegistry.register(
|
||||
(net.minecraft.world.level.block.entity.BlockEntityType) AntarchyFabricBlocks.CRITTER_CAGE_BLOCK_ENTITY.get(),
|
||||
(BlockEntityRendererProvider) CritterCageRenderer::new
|
||||
);
|
||||
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.EASTER_BUNNY.get(), EasterBunnyRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.FLYING_SQUIRREL.get(), FlyingSquirrelRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.CATERPILLAR.get(), CaterpillarRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.BUTTERFLY.get(), ButterflyRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.REVERIE.get(), ReverieRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.BRUTALFLY.get(), BrutalflyRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.RED_ANT.get(), AntRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.BROWN_ANT.get(), AntRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.RAINBOW_ANT.get(), AntRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.MOLEWORM.get(), MolewormRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.MANTIS.get(), MantisRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.ALPHA_MANTIS.get(), AlphaMantisRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.MOLEVORE.get(), MolevoreRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.TRIFFID.get(), TriffidRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.OURANWOOD_BOAT_ENTITY.get(), context -> new OuranwoodBoatRenderer<>(context, new ResourceLocation(Antarchy.MODID, "textures/entity/boat/ouranwood.png"), false));
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.OURANWOOD_CHEST_BOAT_ENTITY.get(), context -> new OuranwoodBoatRenderer<>(context, new ResourceLocation(Antarchy.MODID, "textures/entity/chest_boat/ouranwood.png"), true));
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.PEACH_BOAT_ENTITY.get(), context -> new PeachBoatRenderer<>(context, new ResourceLocation(Antarchy.MODID, "textures/entity/boat/peach.png"), false));
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.PEACH_CHEST_BOAT_ENTITY.get(), context -> new PeachBoatRenderer<>(context, new ResourceLocation(Antarchy.MODID, "textures/entity/chest_boat/peach.png"), true));
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.APPLE_COW.get(), AppleCowRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.GOLDEN_APPLE_COW.get(), AppleCowRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.ENCHANTED_GOLDEN_APPLE_COW.get(), AppleCowRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.DIAMOND_MINECART.get(), DiamondMinecartRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.DR_TRAYAURUS.get(), context -> new DrTrayaurusRenderer(context, new ResourceLocation(Antarchy.MODID, "textures/entity/dr_trayaurus.png")));
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.CLOUD_SHARK.get(), CloudSharkRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.KRAKEN.get(), KrakenRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.KRAKEN_PART.get(), MultipartPartRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.TENTACLE.get(), com.craisinlord.antarchy.content.client.renderer.TentacleRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.KRAKENS_GRASP_TRIDENT.get(), com.craisinlord.antarchy.content.client.renderer.KrakensGraspThrownTridentRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.MISSILE_SQUID.get(), MissileSquidRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.OCTOPUS_BOMB.get(), OctopusBombRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.NIGHTMARE.get(), NightmareRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.LUCID.get(), LucidRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.BED_BUG.get(), BedBugRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.WASP.get(), WaspRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.BOMBER.get(), BomberRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.BASILISK.get(), BasiliskRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.SHRINK_RAY_PROJECTILE.get(), SizeRayProjectileRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.GROWTH_RAY_PROJECTILE.get(), SizeRayProjectileRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.LUCID_BOLT.get(), LucidBoltRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.LUCID_PEARL_PROJECTILE.get(), ThrownItemRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.CRITTER_CAGE_PROJECTILE.get(), ThrownItemRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.HUSH_PROJECTILE.get(), HushProjectileRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.BRUTALFLY_ORB.get(), BrutalflyOrbRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.UPWARD_FALLING_BLOCK.get(), UpwardFallingBlockRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.SCORPION.get(), ScorpionRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.EMPEROR_SCORPION.get(), EmperorScorpionRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.TORETERROR.get(), ToreterrorRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.WATER_BOMB.get(), WaterBombRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.CHEEP.get(), com.craisinlord.antarchy.content.client.renderer.CheepRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.DORRIE.get(), com.craisinlord.antarchy.content.client.renderer.DorrieRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.OURANWOOD_DEER.get(), com.craisinlord.antarchy.content.client.renderer.OuranwoodDeerRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.GLIMMER.get(), com.craisinlord.antarchy.content.client.renderer.glimmer.GlimmerRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.ELKA.get(), com.craisinlord.antarchy.content.client.renderer.ElkaRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.ROLLY_POLLY.get(), com.craisinlord.antarchy.content.client.renderer.RollyPollyRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.TERMITE.get(), TermiteRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.CREEPING_HORROR.get(), CreepingHorrorRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.LURKING_TERROR.get(), LurkingTerrorRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.HERCULES_BEETLE.get(), HerculesBeetleRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.JERRY.get(), JerryRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.JUMPY_BUG.get(), JumpyBugRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.SPIT_BUG.get(), SpitBugRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.SPIT_BUG_PROJECTILE.get(), SpitBugProjectileRenderer::new);
|
||||
EntityRendererRegistry.register(AntarchyFabricEntities.STINK_BUG.get(), StinkBugRenderer::new);
|
||||
|
||||
EntityModelLayerRegistry.registerModelLayer(OuranwoodBoatRenderer.boatLayer(), BoatModel::createBodyModel);
|
||||
EntityModelLayerRegistry.registerModelLayer(OuranwoodBoatRenderer.chestBoatLayer(), ChestBoatModel::createBodyModel);
|
||||
EntityModelLayerRegistry.registerModelLayer(PeachBoatRenderer.boatLayer(), BoatModel::createBodyModel);
|
||||
EntityModelLayerRegistry.registerModelLayer(PeachBoatRenderer.chestBoatLayer(), ChestBoatModel::createBodyModel);
|
||||
}
|
||||
|
||||
private static void registerColors() {
|
||||
ColorProviderRegistry.BLOCK.register(
|
||||
(state, level, pos, tintIndex) -> tintIndex == 0 ? bluestoneWireColor(state.getValue(com.craisinlord.antarchy.content.block.BluestoneWireBlock.POWER)) : -1,
|
||||
AntarchyFabricBlocks.BLUESTONE_WIRE.get()
|
||||
);
|
||||
ColorProviderRegistry.BLOCK.register(
|
||||
(state, level, pos, tintIndex) -> level != null && pos != null
|
||||
? BiomeColors.getAverageFoliageColor(level, pos)
|
||||
: FoliageColor.getDefaultColor(),
|
||||
AntarchyFabricBlocks.OURANWOOD_LEAVES.get()
|
||||
);
|
||||
ColorProviderRegistry.BLOCK.register((state, level, pos, tintIndex) -> 0xFF4A0000, AntarchyFabricBlocks.ANTIWATER_BLOCK.get());
|
||||
ColorProviderRegistry.BLOCK.register(
|
||||
(state, level, pos, tintIndex) -> level != null && pos != null
|
||||
? BiomeColors.getAverageGrassColor(level, pos)
|
||||
: net.minecraft.world.level.GrassColor.getDefaultColor(),
|
||||
AntarchyFabricBlocks.SPIDER_LILY.get()
|
||||
);
|
||||
ColorProviderRegistry.BLOCK.register(
|
||||
(state, level, pos, tintIndex) -> level != null && pos != null
|
||||
? BiomeColors.getAverageGrassColor(level, pos)
|
||||
: net.minecraft.world.level.GrassColor.getDefaultColor(),
|
||||
AntarchyFabricBlocks.POTTED_SPIDER_LILY.get()
|
||||
);
|
||||
ColorProviderRegistry.ITEM.register((stack, tintIndex) -> FoliageColor.getDefaultColor(), AntarchyFabricItems.OURANWOOD_LEAVES_ITEM.get());
|
||||
ColorProviderRegistry.ITEM.register(
|
||||
(stack, tintIndex) -> tintIndex == 0 ? net.minecraft.world.level.GrassColor.getDefaultColor() : -1,
|
||||
AntarchyFabricItems.SPIDER_LILY_ITEM.get()
|
||||
);
|
||||
ColorProviderRegistry.ITEM.register(
|
||||
(stack, tintIndex) -> {
|
||||
if (!(stack.getItem() instanceof com.craisinlord.antarchy.content.item.CritterCageItem cage)) {
|
||||
return -1;
|
||||
}
|
||||
if (cage.getItemState(stack) != 2) {
|
||||
return -1;
|
||||
}
|
||||
if (tintIndex == 1) {
|
||||
return cage.getPrimaryColor(stack);
|
||||
}
|
||||
if (tintIndex == 2) {
|
||||
return cage.getSecondaryColor(stack);
|
||||
}
|
||||
return -1;
|
||||
},
|
||||
AntarchyFabricItems.CRITTER_CAGE.get()
|
||||
);
|
||||
}
|
||||
|
||||
private static void registerFluids() {
|
||||
FluidRenderHandlerRegistry.INSTANCE.register(
|
||||
AntarchyFabricMisc.BILE.get(),
|
||||
AntarchyFabricMisc.FLOWING_BILE.get(),
|
||||
new SimpleFluidRenderHandler(
|
||||
new ResourceLocation(Antarchy.MODID, "block/bile/bile_still"),
|
||||
new ResourceLocation(Antarchy.MODID, "block/bile/bile_flowing"),
|
||||
new ResourceLocation("block/water_overlay"),
|
||||
0xFFFFFFFF
|
||||
)
|
||||
);
|
||||
|
||||
FluidRenderHandlerRegistry.INSTANCE.register(
|
||||
AntarchyFabricMisc.ICHOR.get(),
|
||||
AntarchyFabricMisc.FLOWING_ICHOR.get(),
|
||||
new SimpleFluidRenderHandler(
|
||||
new ResourceLocation(Antarchy.MODID, "block/bile/bile_still"),
|
||||
new ResourceLocation(Antarchy.MODID, "block/bile/bile_flowing"),
|
||||
new ResourceLocation("block/water_overlay"),
|
||||
0xFF3D0408
|
||||
)
|
||||
);
|
||||
|
||||
FluidRenderHandlerRegistry.INSTANCE.register(
|
||||
AntarchyFabricMisc.ANTIWATER.get(),
|
||||
AntarchyFabricMisc.FLOWING_ANTIWATER.get(),
|
||||
new SimpleFluidRenderHandler(
|
||||
new ResourceLocation("block/water_still"),
|
||||
new ResourceLocation("block/water_flow"),
|
||||
new ResourceLocation("block/water_overlay"),
|
||||
0xFFFF1A1A
|
||||
) {
|
||||
@Override
|
||||
public void renderFluid(BlockPos pos, BlockAndTintGetter world, VertexConsumer vertexConsumer, BlockState blockState, FluidState fluidState) {
|
||||
TextureAtlasSprite[] sprites = this.getFluidSprites(world, pos, fluidState);
|
||||
AntiwaterFluidRenderer.render(
|
||||
world,
|
||||
pos,
|
||||
vertexConsumer,
|
||||
blockState,
|
||||
fluidState,
|
||||
sprites[0],
|
||||
sprites[1],
|
||||
sprites.length > 2 ? sprites[2] : null,
|
||||
this.getFluidColor(world, pos, fluidState)
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
FluidRenderHandlerRegistry.INSTANCE.register(
|
||||
AntarchyFabricMisc.LUMEN.get(),
|
||||
AntarchyFabricMisc.FLOWING_LUMEN.get(),
|
||||
new SimpleFluidRenderHandler(
|
||||
new ResourceLocation(Antarchy.MODID, "block/lumen_still"),
|
||||
new ResourceLocation(Antarchy.MODID, "block/lumen_flow"),
|
||||
new ResourceLocation("block/water_overlay"),
|
||||
0xFFFFFFFF
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
private static void registerParticles() {
|
||||
ParticleFactoryRegistry registry = ParticleFactoryRegistry.getInstance();
|
||||
registry.register(AntarchyFabricMisc.DREAM_FIRE_FLAME.get(), DreamFlameParticle.Provider::new);
|
||||
registry.register(AntarchyFabricMisc.STINKY_GAS.get(), HypnoticGasParticle.Provider::new);
|
||||
registry.register(AntarchyFabricMisc.STINKY_FLY.get(), FireflyParticle.Provider::new);
|
||||
registry.register(AntarchyFabricMisc.PEACH_LEAVES_PARTICLE.get(), PeachLeavesParticle.Provider::new);
|
||||
registry.register(AntarchyFabricMisc.LOTUS_POLLEN.get(), com.craisinlord.antarchy.content.client.particle.LotusPollenParticle.Provider::new);
|
||||
registry.register(AntarchyFabricMisc.HYPNOTIC_GAS.get(), HypnoticGasParticle.Provider::new);
|
||||
registry.register(AntarchyFabricMisc.HYPNOTIC_GAS_DOWN.get(), sprites -> new HypnoticGasParticle.Provider(sprites, true));
|
||||
registry.register(AntarchyFabricMisc.HYPNOTIC_GAS_CLOUD.get(), new HypnoticGasCloudParticle.Provider());
|
||||
registry.register(AntarchyFabricMisc.HYPNOTIC_GAS_CLOUD_DOWN.get(), new HypnoticGasCloudParticle.Provider(true));
|
||||
registry.register(AntarchyFabricMisc.INVERTED_GEYSER_BASE.get(), InvertedGeyserBaseParticle.Provider::new);
|
||||
registry.register(AntarchyFabricMisc.INVERTED_GEYSER_PLUME.get(), InvertedGeyserPlumeParticle.Provider::new);
|
||||
registry.register(AntarchyFabricMisc.INVERTED_GEYSER_POOF.get(), InvertedGeyserBaseParticle.Provider::new);
|
||||
registry.register(AntarchyFabricMisc.INVERTED_GEYSER_ERUPTION.get(), new InvertedGeyserEruptionParticle.Provider());
|
||||
registry.register(AntarchyFabricMisc.FIREFLY.get(), FireflyParticle.Provider::new);
|
||||
registry.register(AntarchyFabricMisc.ORANGE_ASH.get(), OrangeAshParticle.Provider::new);
|
||||
}
|
||||
|
||||
private static void registerRenderLayers() {
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.ANTIMETAL_RAIL.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.ANTIMETAL_POWERED_RAIL.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.ANTIMETAL_DETECTOR_RAIL.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.ANTIMETAL_ACTIVATOR_RAIL.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.OURANWOOD_LEAVES.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.OURANWOOD_DOOR.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.OURANWOOD_TRAPDOOR.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.OURANWOOD_ACORN_BLOCK.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.POTTED_OURANWOOD_ACORN.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.PEACH_LEAVES.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.PEACH_HANGING_PEACH.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.PEACH_DOOR.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.PEACH_TRAPDOOR.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.PEACH_SAPLING.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.POTTED_PEACH_SAPLING.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.DUPLICATOR_SAPLING.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.ORANGE_MILKWEED.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.PINK_MILKWEED.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.AMBER_LICHEN.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.CREEPVINE.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.CAMELLIA.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.SPIDER_LILY.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.POTTED_SPIDER_LILY.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.LOTUS.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.POTTED_LOTUS.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.GIANT_LILY_PAD.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.HUSHWEED.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.CRITTER_CAGE_BLOCK.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.POTTED_GLOWCAP_MUSHROOM.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.CORNEA_STALK.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.CORN_CROP.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.WILD_CORN.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.FALLEN_KING_CROWN_BLOCK.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.ANTIMETAL_SCAFFOLDING.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.UMBRAL_MOSS_CARPET.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.NYXITE_SPIKE.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.CHITEN_SPIKE.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.STAR_CORAL.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.STAR_CORAL_FAN.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.STAR_CORAL_WALL_FAN.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.DEAD_STAR_CORAL.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.DEAD_STAR_CORAL_FAN.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.DEAD_STAR_CORAL_WALL_FAN.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.SMALL_BLOOD_CRYSTAL_BUD.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.MEDIUM_BLOOD_CRYSTAL_BUD.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.LARGE_BLOOD_CRYSTAL_BUD.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.BLOOD_CRYSTAL_CRYSTAL.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.DREAM_TORCH.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.DREAM_WALL_TORCH.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.DREAM_CEILING_TORCH.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.BLUESTONE_WIRE.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.BLUESTONE_REPEATER.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.BLUESTONE_COMPARATOR.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.BLUESTONE_TORCH.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.DREAM_LANTERN.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.DREAM_CAMPFIRE.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.DREAM_FIRE.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.DREAM_CEILING_FIRE.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.ANTIWATER_BLOCK.get(), RenderType.translucent());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.LUMEN_BLOCK.get(), RenderType.translucent());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.ELYTHIA_PORTAL.get(), RenderType.translucent());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.THORAXIS_PORTAL.get(), RenderType.translucent());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.TRIFFID_GOO_BLOCK.get(), RenderType.translucent());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.URANIUM_DOOR.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.TITANIUM_DOOR.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.URANIUM_TRAPDOOR.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.TITANIUM_TRAPDOOR.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.URANIUM_BARS.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.TITANIUM_BARS.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.CLOUD_BLOCK.get(), RenderType.translucent());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.JUMPY_BUG_EGG.get(), RenderType.translucent());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.SPIT_BUG_EGG.get(), RenderType.translucent());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.JERRY_EGG.get(), RenderType.translucent());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.BIOWART_TENDRILS.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.HANGING_CREEPROOTS.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.MOLTING_VINES.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(AntarchyFabricBlocks.GLOWCAP_MUSHROOM.get(), RenderType.cutout());
|
||||
BlockRenderLayerMap.INSTANCE.putFluids(
|
||||
RenderType.translucent(),
|
||||
AntarchyFabricMisc.BILE.get(),
|
||||
AntarchyFabricMisc.FLOWING_BILE.get(),
|
||||
AntarchyFabricMisc.ICHOR.get(),
|
||||
AntarchyFabricMisc.FLOWING_ICHOR.get(),
|
||||
AntarchyFabricMisc.LUMEN.get(),
|
||||
AntarchyFabricMisc.FLOWING_LUMEN.get(),
|
||||
AntarchyFabricMisc.ANTIWATER.get(),
|
||||
AntarchyFabricMisc.FLOWING_ANTIWATER.get()
|
||||
);
|
||||
}
|
||||
|
||||
private static void registerItemProperties() {
|
||||
ItemProperties.register(
|
||||
AntarchyFabricItems.ULTIMATE_BOW.get(),
|
||||
new ResourceLocation("pull"),
|
||||
(stack, level, entity, seed) -> entity == null || entity.getUseItem() != stack
|
||||
? 0.0F
|
||||
: (stack.getItem().getUseDuration(stack) - entity.getUseItemRemainingTicks()) / 20.0F
|
||||
);
|
||||
ItemProperties.register(
|
||||
AntarchyFabricItems.ULTIMATE_BOW.get(),
|
||||
new ResourceLocation("pulling"),
|
||||
(stack, level, entity, seed) -> entity != null && entity.isUsingItem() && entity.getUseItem() == stack ? 1.0F : 0.0F
|
||||
);
|
||||
ItemProperties.register(
|
||||
AntarchyFabricItems.ULTIMATE_CROSSBOW.get(),
|
||||
new ResourceLocation("pull"),
|
||||
(stack, level, entity, seed) -> {
|
||||
if (entity == null || CrossbowItem.isCharged(stack) || entity.getUseItem() != stack) {
|
||||
return 0.0F;
|
||||
}
|
||||
float adjustedChargeDuration = Math.max(1.0F, stack.getItem().getUseDuration(stack) - 3.0F);
|
||||
return Mth.clamp((stack.getItem().getUseDuration(stack) - entity.getUseItemRemainingTicks()) / adjustedChargeDuration, 0.0F, 1.0F);
|
||||
}
|
||||
);
|
||||
ItemProperties.register(
|
||||
AntarchyFabricItems.ULTIMATE_CROSSBOW.get(),
|
||||
new ResourceLocation("pulling"),
|
||||
(stack, level, entity, seed) -> entity != null && entity.isUsingItem() && entity.getUseItem() == stack && !CrossbowItem.isCharged(stack) ? 1.0F : 0.0F
|
||||
);
|
||||
ItemProperties.register(
|
||||
AntarchyFabricItems.ULTIMATE_CROSSBOW.get(),
|
||||
new ResourceLocation("charged"),
|
||||
(stack, level, entity, seed) -> CrossbowItem.isCharged(stack) ? 1.0F : 0.0F
|
||||
);
|
||||
ItemProperties.register(
|
||||
AntarchyFabricItems.ULTIMATE_CROSSBOW.get(),
|
||||
new ResourceLocation("firework"),
|
||||
(stack, level, entity, seed) -> CrossbowItem.isCharged(stack) && CrossbowItem.containsChargedProjectile(stack, Items.FIREWORK_ROCKET) ? 1.0F : 0.0F
|
||||
);
|
||||
ItemProperties.register(
|
||||
AntarchyFabricItems.CRITTER_CAGE.get(),
|
||||
new ResourceLocation(Antarchy.MODID, "critter_cage_state"),
|
||||
(stack, level, entity, seed) -> {
|
||||
if (!(stack.getItem() instanceof com.craisinlord.antarchy.content.item.CritterCageItem cage)) {
|
||||
return 0.0F;
|
||||
}
|
||||
return cage.getItemState(stack);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
private static void registerEntityLayers() {
|
||||
LivingEntityFeatureRendererRegistrationCallback.EVENT.register((entityType, renderer, registrationHelper, context) -> {
|
||||
if (entityType == EntityType.PLAYER) {
|
||||
if (renderer instanceof net.minecraft.client.renderer.entity.player.PlayerRenderer playerRenderer) {
|
||||
registrationHelper.register(new ParalyzedStonePlayerLayer(playerRenderer));
|
||||
registrationHelper.register(new GoopedLivingLayer(playerRenderer));
|
||||
registrationHelper.register(new BrutalflyElytraLayer(playerRenderer));
|
||||
registrationHelper.register(new FallenKingCrownLayer(playerRenderer));
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (entityType == EntityType.ARMOR_STAND && renderer instanceof ArmorStandRenderer armorStandRenderer) {
|
||||
registrationHelper.register(new FallenKingCrownArmorStandLayer((net.minecraft.client.renderer.entity.RenderLayerParent) armorStandRenderer));
|
||||
return;
|
||||
}
|
||||
if (software.bernie.geckolib.renderer.GeoEntityRenderer.class.isAssignableFrom(renderer.getClass())) {
|
||||
software.bernie.geckolib.renderer.GeoEntityRenderer geoRenderer =
|
||||
(software.bernie.geckolib.renderer.GeoEntityRenderer) (Object) renderer;
|
||||
geoRenderer.addRenderLayer(new ParalyzedStoneGeoLayer(geoRenderer));
|
||||
geoRenderer.addRenderLayer(new GoopedGeoLayer(geoRenderer));
|
||||
return;
|
||||
}
|
||||
registrationHelper.register(new ParalyzedStoneLivingLayer(renderer));
|
||||
registrationHelper.register(new GoopedLivingLayer(renderer));
|
||||
});
|
||||
}
|
||||
|
||||
private static void registerClientCallbacks() {
|
||||
ClientTickEvents.END_CLIENT_TICK.register(client -> {
|
||||
CameraShakeClientState.tick();
|
||||
HerculesBeetleImpactShakeClientState.tick();
|
||||
HordeClientState.tick();
|
||||
if (client.player != null) {
|
||||
ParalyzedClientHandler.clampPlayerInput(client.player);
|
||||
}
|
||||
BrutalflyElytraClientHandler.tick();
|
||||
JumpyBootsClientHandler.tick();
|
||||
DiamondMinecartClientHandler.tick();
|
||||
ParalyzedClientHandler.tick();
|
||||
DreadClientHandler.tick();
|
||||
BloodCrystalKatanaTrailHandler.tick();
|
||||
ScorpionWhipTetherRenderHandler.tick();
|
||||
DorrieJumpClientHandler.tick();
|
||||
HerculesBeetleClientHandler.tick();
|
||||
});
|
||||
|
||||
BigBerthaClientHandler.register();
|
||||
GravityGunClientHandler.register();
|
||||
|
||||
ElythiaFireflyManager.register();
|
||||
LucidSoundHandler.register();
|
||||
MogglesClientRenderer.register();
|
||||
StinkySoundHandler.register();
|
||||
ReverieTrailHandler.register();
|
||||
HudRenderCallback.EVENT.register((guiGraphics, partialTick) -> {
|
||||
DreadHudRenderer.render(guiGraphics);
|
||||
com.craisinlord.antarchy.content.client.HordeHudRenderer.render(guiGraphics);
|
||||
com.craisinlord.antarchy.content.client.GoopedHudRenderer.render(guiGraphics);
|
||||
ParalyzedHudRenderer.render(guiGraphics);
|
||||
BrutalflyElytraHudRenderer.render(guiGraphics);
|
||||
JumpyBootsHudRenderer.render(guiGraphics);
|
||||
TriffidGooHudRenderer.render(guiGraphics);
|
||||
DorrieJumpHudRenderer.render(guiGraphics);
|
||||
HerculesBeetleChargeHudRenderer.render(guiGraphics);
|
||||
});
|
||||
|
||||
WorldRenderEvents.AFTER_TRANSLUCENT.register(context -> {
|
||||
BloodCrystalKatanaTrailHandler.render(context);
|
||||
ScorpionWhipTetherRenderHandler.render(context);
|
||||
});
|
||||
}
|
||||
|
||||
private static int bluestoneWireColor(int power) {
|
||||
float normalized = power / 15.0F;
|
||||
int red = (int) (6.0F + normalized * 54.0F);
|
||||
int green = (int) (22.0F + normalized * 132.0F);
|
||||
int blue = (int) (64.0F + normalized * 191.0F);
|
||||
return red << 16 | green << 8 | blue;
|
||||
}
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
package com.craisinlord.antarchy.fabric.client;
|
||||
|
||||
import com.craisinlord.antarchy.Antarchy;
|
||||
import com.mojang.blaze3d.platform.InputConstants;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
|
||||
import net.minecraft.client.KeyMapping;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
public final class AntarchyKeyBindings {
|
||||
public static final String CATEGORY = "key.categories.antarchy";
|
||||
|
||||
public static final KeyMapping BRUTALFLY_FLAP = new KeyMapping(
|
||||
"key.antarchy.brutalfly_flap",
|
||||
InputConstants.Type.KEYSYM,
|
||||
GLFW.GLFW_KEY_G,
|
||||
CATEGORY
|
||||
);
|
||||
|
||||
public static final KeyMapping DORRIE_CHARGE_JUMP = new KeyMapping(
|
||||
"key.antarchy.dorrie_charge_jump",
|
||||
InputConstants.Type.KEYSYM,
|
||||
GLFW.GLFW_KEY_LEFT_CONTROL,
|
||||
CATEGORY
|
||||
);
|
||||
|
||||
public static final KeyMapping HERCULES_BEETLE_CHARGE = new KeyMapping(
|
||||
"key.antarchy.hercules_beetle_charge",
|
||||
InputConstants.Type.KEYSYM,
|
||||
GLFW.GLFW_KEY_LEFT_CONTROL,
|
||||
CATEGORY
|
||||
);
|
||||
|
||||
public static final KeyMapping HERCULES_BEETLE_FLIGHT_TOGGLE = new KeyMapping(
|
||||
"key.antarchy.hercules_beetle_flight_toggle",
|
||||
InputConstants.Type.KEYSYM,
|
||||
GLFW.GLFW_KEY_R,
|
||||
CATEGORY
|
||||
);
|
||||
|
||||
private AntarchyKeyBindings() {}
|
||||
|
||||
public static void register() {
|
||||
KeyBindingHelper.registerKeyBinding(BRUTALFLY_FLAP);
|
||||
KeyBindingHelper.registerKeyBinding(DORRIE_CHARGE_JUMP);
|
||||
KeyBindingHelper.registerKeyBinding(HERCULES_BEETLE_CHARGE);
|
||||
KeyBindingHelper.registerKeyBinding(HERCULES_BEETLE_FLIGHT_TOGGLE);
|
||||
}
|
||||
|
||||
public static boolean isBrutalflyFlapPressed() {
|
||||
return Minecraft.getInstance().screen == null && BRUTALFLY_FLAP.isDown();
|
||||
}
|
||||
|
||||
public static boolean isDorrieChargeJumpPressed() {
|
||||
return Minecraft.getInstance().screen == null && DORRIE_CHARGE_JUMP.isDown();
|
||||
}
|
||||
|
||||
public static boolean isHerculesBeetleChargePressed() {
|
||||
return Minecraft.getInstance().screen == null && HERCULES_BEETLE_CHARGE.isDown();
|
||||
}
|
||||
|
||||
public static boolean isHerculesBeetleFlightTogglePressed() {
|
||||
return Minecraft.getInstance().screen == null && HERCULES_BEETLE_FLIGHT_TOGGLE.isDown();
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
package com.craisinlord.antarchy.fabric.client;
|
||||
|
||||
import com.craisinlord.antarchy.content.item.BigBerthaItem;
|
||||
import com.craisinlord.antarchy.content.network.BigBerthaModeCyclePayload;
|
||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
public final class BigBerthaClientHandler {
|
||||
private static boolean lastUseDown;
|
||||
|
||||
private BigBerthaClientHandler() {
|
||||
}
|
||||
|
||||
public static void register() {
|
||||
ClientTickEvents.END_CLIENT_TICK.register(BigBerthaClientHandler::tick);
|
||||
}
|
||||
|
||||
private static void tick(Minecraft mc) {
|
||||
if (mc.player == null || mc.level == null || mc.screen != null) {
|
||||
lastUseDown = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(mc.player.getMainHandItem().getItem() instanceof BigBerthaItem)) {
|
||||
lastUseDown = false;
|
||||
return;
|
||||
}
|
||||
|
||||
boolean useDown = mc.options.keyUse.isDown();
|
||||
if (useDown
|
||||
&& !lastUseDown
|
||||
&& mc.player.isShiftKeyDown()
|
||||
&& mc.player.getCooldowns().isOnCooldown(mc.player.getMainHandItem().getItem())) {
|
||||
com.craisinlord.antarchy.fabric.network.AntarchyFabricClientNetworking.sendToServer(new BigBerthaModeCyclePayload(), BigBerthaModeCyclePayload.STREAM_CODEC, BigBerthaModeCyclePayload.TYPE);
|
||||
}
|
||||
lastUseDown = useDown;
|
||||
}
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
package com.craisinlord.antarchy.fabric.client;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
public final class BloodCrystalKatanaTrailClientState {
|
||||
private static final Map<Integer, Integer> ACTIVE = new HashMap<>();
|
||||
|
||||
private BloodCrystalKatanaTrailClientState() {}
|
||||
|
||||
public static void trigger(int entityId, int durationTicks) {
|
||||
if (durationTicks <= 0) {
|
||||
ACTIVE.remove(entityId);
|
||||
return;
|
||||
}
|
||||
ACTIVE.put(entityId, durationTicks);
|
||||
}
|
||||
|
||||
public static int getRemainingTicks(int entityId) {
|
||||
return ACTIVE.getOrDefault(entityId, 0);
|
||||
}
|
||||
|
||||
public static void tick() {
|
||||
Iterator<Map.Entry<Integer, Integer>> iterator = ACTIVE.entrySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Map.Entry<Integer, Integer> entry = iterator.next();
|
||||
int remaining = entry.getValue() - 1;
|
||||
if (remaining <= 0) {
|
||||
iterator.remove();
|
||||
} else {
|
||||
entry.setValue(remaining);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void clear() {
|
||||
ACTIVE.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+203
@@ -0,0 +1,203 @@
|
||||
package com.craisinlord.antarchy.fabric.client;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.BufferBuilder;
|
||||
import com.mojang.blaze3d.vertex.BufferUploader;
|
||||
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
|
||||
import com.mojang.blaze3d.vertex.Tesselator;
|
||||
import com.mojang.blaze3d.vertex.VertexFormat;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import net.minecraft.client.Camera;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext;
|
||||
import org.joml.Matrix4f;
|
||||
|
||||
public final class BloodCrystalKatanaTrailHandler {
|
||||
private static final int MAX_TRAIL_POINTS = 16;
|
||||
private static final int POINT_LIFETIME_TICKS = 10;
|
||||
private static final double MIN_DISTANCE_BETWEEN_POINTS = 0.05D;
|
||||
private static final float CORE_WIDTH = 0.06F;
|
||||
private static final float GLOW_WIDTH = 0.16F;
|
||||
private static final Map<Integer, ArrayDeque<TrailPoint>> TRAILS = new HashMap<>();
|
||||
|
||||
private BloodCrystalKatanaTrailHandler() {}
|
||||
|
||||
private static final class TrailPoint {
|
||||
private final Vec3 position;
|
||||
private int age;
|
||||
|
||||
private TrailPoint(Vec3 position) {
|
||||
this.position = position;
|
||||
}
|
||||
|
||||
private float alpha() {
|
||||
return 1.0F - ((float) age / POINT_LIFETIME_TICKS);
|
||||
}
|
||||
|
||||
private boolean expired() {
|
||||
return age >= POINT_LIFETIME_TICKS || alpha() <= 0.01F;
|
||||
}
|
||||
}
|
||||
|
||||
public static void tick() {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
if (mc.level == null) {
|
||||
TRAILS.clear();
|
||||
BloodCrystalKatanaTrailClientState.clear();
|
||||
return;
|
||||
}
|
||||
if (mc.isPaused()) {
|
||||
return;
|
||||
}
|
||||
|
||||
BloodCrystalKatanaTrailClientState.tick();
|
||||
Set<Integer> activeIds = new HashSet<>();
|
||||
|
||||
for (Entity entity : mc.level.entitiesForRendering()) {
|
||||
int remaining = BloodCrystalKatanaTrailClientState.getRemainingTicks(entity.getId());
|
||||
if (remaining <= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
activeIds.add(entity.getId());
|
||||
Vec3 position = entity.position().add(0.0D, entity.getBbHeight() * 0.45D, 0.0D);
|
||||
ArrayDeque<TrailPoint> points = TRAILS.computeIfAbsent(entity.getId(), id -> new ArrayDeque<>());
|
||||
|
||||
if (points.isEmpty() || points.peekFirst().position.distanceToSqr(position) >= MIN_DISTANCE_BETWEEN_POINTS * MIN_DISTANCE_BETWEEN_POINTS) {
|
||||
points.addFirst(new TrailPoint(position));
|
||||
while (points.size() > MAX_TRAIL_POINTS) {
|
||||
points.pollLast();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TRAILS.keySet().removeIf(id -> !activeIds.contains(id));
|
||||
for (ArrayDeque<TrailPoint> points : TRAILS.values()) {
|
||||
Iterator<TrailPoint> iterator = points.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
TrailPoint point = iterator.next();
|
||||
point.age++;
|
||||
if (point.expired()) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
TRAILS.values().removeIf(ArrayDeque::isEmpty);
|
||||
}
|
||||
|
||||
public static void render(WorldRenderContext context) {
|
||||
if (TRAILS.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (context.world() == null || context.matrixStack() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
if (mc.level == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Camera camera = context.camera();
|
||||
Vec3 cameraPos = camera.getPosition();
|
||||
Matrix4f matrix = context.matrixStack().last().pose();
|
||||
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.defaultBlendFunc();
|
||||
RenderSystem.depthMask(false);
|
||||
RenderSystem.disableCull();
|
||||
RenderSystem.setShader(GameRenderer::getPositionColorShader);
|
||||
|
||||
Tesselator tesselator = Tesselator.getInstance();
|
||||
List<List<TrailPoint>> snapshots = new ArrayList<>(TRAILS.size());
|
||||
for (ArrayDeque<TrailPoint> deque : TRAILS.values()) {
|
||||
if (deque.size() >= 2) {
|
||||
snapshots.add(new ArrayList<>(deque));
|
||||
}
|
||||
}
|
||||
|
||||
if (snapshots.isEmpty()) {
|
||||
RenderSystem.enableCull();
|
||||
RenderSystem.depthMask(true);
|
||||
RenderSystem.disableBlend();
|
||||
return;
|
||||
}
|
||||
|
||||
BufferBuilder glowBuffer = tesselator.getBuilder();
|
||||
glowBuffer.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR);
|
||||
for (List<TrailPoint> points : snapshots) {
|
||||
buildTrail(glowBuffer, matrix, points, cameraPos, GLOW_WIDTH, 0.95F, 0.14F, 0.18F, 0.38F);
|
||||
}
|
||||
BufferUploader.drawWithShader(glowBuffer.end());
|
||||
|
||||
BufferBuilder coreBuffer = tesselator.getBuilder();
|
||||
coreBuffer.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR);
|
||||
for (List<TrailPoint> points : snapshots) {
|
||||
buildTrail(coreBuffer, matrix, points, cameraPos, CORE_WIDTH, 1.0F, 0.32F, 0.36F, 0.92F);
|
||||
}
|
||||
BufferUploader.drawWithShader(coreBuffer.end());
|
||||
|
||||
RenderSystem.enableCull();
|
||||
RenderSystem.depthMask(true);
|
||||
RenderSystem.disableBlend();
|
||||
}
|
||||
|
||||
private static void buildTrail(BufferBuilder builder, Matrix4f matrix, List<TrailPoint> points, Vec3 cameraPos,
|
||||
float width, float red, float green, float blue, float alphaScale) {
|
||||
for (int i = 0; i < points.size() - 1; i++) {
|
||||
TrailPoint newer = points.get(i);
|
||||
TrailPoint older = points.get(i + 1);
|
||||
Vec3 side = cameraFacingRight(newer.position, older.position, cameraPos);
|
||||
if (side == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
float nearAlpha = newer.alpha() * alphaScale;
|
||||
float farAlpha = older.alpha() * alphaScale * 0.85F;
|
||||
Vec3 nearOffset = side.scale(width);
|
||||
Vec3 farOffset = side.scale(width);
|
||||
Vec3 nearPos = newer.position.subtract(cameraPos);
|
||||
Vec3 farPos = older.position.subtract(cameraPos);
|
||||
|
||||
builder.vertex(matrix, (float) (nearPos.x + nearOffset.x), (float) (nearPos.y + nearOffset.y), (float) (nearPos.z + nearOffset.z)).color(red, green, blue, nearAlpha).endVertex();
|
||||
builder.vertex(matrix, (float) (nearPos.x - nearOffset.x), (float) (nearPos.y - nearOffset.y), (float) (nearPos.z - nearOffset.z)).color(red, green, blue, nearAlpha).endVertex();
|
||||
builder.vertex(matrix, (float) (farPos.x - farOffset.x), (float) (farPos.y - farOffset.y), (float) (farPos.z - farOffset.z)).color(red, green, blue, farAlpha).endVertex();
|
||||
builder.vertex(matrix, (float) (farPos.x + farOffset.x), (float) (farPos.y + farOffset.y), (float) (farPos.z + farOffset.z)).color(red, green, blue, farAlpha).endVertex();
|
||||
}
|
||||
}
|
||||
|
||||
private static Vec3 cameraFacingRight(Vec3 current, Vec3 next, Vec3 cameraPos) {
|
||||
Vec3 segmentDirection = next.subtract(current);
|
||||
if (segmentDirection.lengthSqr() < 1.0E-8D) {
|
||||
return null;
|
||||
}
|
||||
segmentDirection = segmentDirection.normalize();
|
||||
|
||||
Vec3 midpoint = current.add(next).scale(0.5D);
|
||||
Vec3 cameraDirection = cameraPos.subtract(midpoint);
|
||||
if (cameraDirection.lengthSqr() < 1.0E-8D) {
|
||||
return null;
|
||||
}
|
||||
cameraDirection = cameraDirection.normalize();
|
||||
|
||||
Vec3 side = segmentDirection.cross(cameraDirection);
|
||||
if (side.lengthSqr() < 1.0E-8D) {
|
||||
side = segmentDirection.cross(new Vec3(0.0D, 1.0D, 0.0D));
|
||||
if (side.lengthSqr() < 1.0E-8D) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return side.normalize();
|
||||
}
|
||||
}
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
package com.craisinlord.antarchy.fabric.client;
|
||||
|
||||
import com.craisinlord.antarchy.Antarchy;
|
||||
import com.craisinlord.antarchy.content.client.BloodglassClientState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
|
||||
public final class BloodglassHudRenderer {
|
||||
private static final ResourceLocation HEART_CONTAINER =
|
||||
new ResourceLocation("textures/gui/sprites/hud/heart/container.png");
|
||||
private static final ResourceLocation HEART_FULL =
|
||||
new ResourceLocation(Antarchy.MODID, "textures/gui/sprites/hud/bloodglass_heart.png");
|
||||
private static final ResourceLocation HEART_CRACKED =
|
||||
new ResourceLocation(Antarchy.MODID, "textures/gui/sprites/hud/bloodglass_heart_cracked.png");
|
||||
private static final int HEART_SIZE = 9;
|
||||
private static final int HEART_PITCH = 8;
|
||||
|
||||
private BloodglassHudRenderer() {}
|
||||
|
||||
public static void render(GuiGraphics gui) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
if (mc.options.hideGui) return;
|
||||
Player player = mc.player;
|
||||
if (player == null || player.isDeadOrDying()) return;
|
||||
// Don't show in creative or spectator — no health bar visible there
|
||||
if (player.isCreative() || player.isSpectator()) return;
|
||||
|
||||
int total = BloodglassClientState.getShieldsMax();
|
||||
if (total <= 0) return;
|
||||
|
||||
int active = BloodglassClientState.getShieldsActive();
|
||||
int w = mc.getWindow().getGuiScaledWidth();
|
||||
int h = mc.getWindow().getGuiScaledHeight();
|
||||
|
||||
// Vanilla health bar bottom row is at y = h - 39; each extra row (absorption, extra hearts) is 10px above.
|
||||
// The armor protection icons sit one row above the bottom health row (h - 49).
|
||||
// We place bloodglass hearts above both health+absorption stack AND the armor row.
|
||||
int maxHealth = Mth.ceil(player.getMaxHealth());
|
||||
int absorption = Mth.ceil(player.getAbsorptionAmount());
|
||||
int healthHearts = Mth.ceil(maxHealth / 2.0f);
|
||||
int absorptionHearts = Mth.ceil(absorption / 2.0f);
|
||||
int totalVanillaRows = Mth.ceil((healthHearts + absorptionHearts) / 10.0f);
|
||||
boolean hasArmor = player.getArmorValue() > 0;
|
||||
// +1 to clear the armor icon row only when armor is actually equipped
|
||||
int baseTop = h - 39 - (totalVanillaRows * 10) - (hasArmor ? 10 : 0);
|
||||
|
||||
int left = w / 2 - 91;
|
||||
|
||||
// Wrap across multiple rows if more than 10 bloodglass hearts
|
||||
for (int i = 0; i < total; i++) {
|
||||
int row = i / 10;
|
||||
int col = i % 10;
|
||||
int x = left + col * HEART_PITCH;
|
||||
int y = baseTop - row * 10;
|
||||
ResourceLocation tex = (i < active) ? HEART_FULL : HEART_CRACKED;
|
||||
gui.blit(HEART_CONTAINER, x, y, 0, 0, HEART_SIZE, HEART_SIZE, HEART_SIZE, HEART_SIZE);
|
||||
gui.blit(tex, x, y, 0, 0, HEART_SIZE, HEART_SIZE, HEART_SIZE, HEART_SIZE);
|
||||
}
|
||||
}
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
package com.craisinlord.antarchy.fabric.client;
|
||||
|
||||
import com.craisinlord.antarchy.content.client.BrutalflyElytraClientState;
|
||||
import com.craisinlord.antarchy.content.item.BrutalflyElytraFlightHelper;
|
||||
import com.craisinlord.antarchy.content.item.BrutalflyElytraItem;
|
||||
import com.craisinlord.antarchy.content.network.BrutalflyElytraFlapPayload;
|
||||
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public final class BrutalflyElytraClientHandler {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger("Antarchy/BrutalflyElytra");
|
||||
private static boolean lastJumpDown;
|
||||
private static int chargeTicks;
|
||||
|
||||
static {
|
||||
BrutalflyElytraItem.FLAP_KEY_NAME = () -> AntarchyKeyBindings.BRUTALFLY_FLAP.getTranslatedKeyMessage();
|
||||
}
|
||||
|
||||
private BrutalflyElytraClientHandler() {
|
||||
}
|
||||
|
||||
public static void tick() {
|
||||
BrutalflyElytraClientState.tick();
|
||||
|
||||
Minecraft minecraft = Minecraft.getInstance();
|
||||
if (minecraft.player == null || minecraft.level == null || minecraft.screen != null) {
|
||||
reset();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!BrutalflyElytraItem.isWearingBrutalflyElytra(minecraft.player)) {
|
||||
reset();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!minecraft.player.isFallFlying()) {
|
||||
reset();
|
||||
return;
|
||||
}
|
||||
|
||||
boolean sneakDown = AntarchyKeyBindings.isBrutalflyFlapPressed();
|
||||
boolean wasSneakDown = lastJumpDown;
|
||||
lastJumpDown = sneakDown;
|
||||
|
||||
if (sneakDown) {
|
||||
chargeTicks = Math.min(chargeTicks + 1, BrutalflyElytraFlightHelper.FLAP_CHARGE_TICKS_MAX);
|
||||
return;
|
||||
}
|
||||
|
||||
if (wasSneakDown && chargeTicks > 0) {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("[BrutalflyElytra] Sending flap payload chargeTicks={} fallFlying={} deltaMovement={}", chargeTicks, minecraft.player.isFallFlying(), minecraft.player.getDeltaMovement());
|
||||
}
|
||||
com.craisinlord.antarchy.fabric.network.AntarchyFabricClientNetworking.sendToServer(new BrutalflyElytraFlapPayload(chargeTicks), BrutalflyElytraFlapPayload.STREAM_CODEC, BrutalflyElytraFlapPayload.TYPE);
|
||||
}
|
||||
chargeTicks = 0;
|
||||
}
|
||||
|
||||
private static void reset() {
|
||||
lastJumpDown = false;
|
||||
chargeTicks = 0;
|
||||
}
|
||||
|
||||
public static boolean isCharging() {
|
||||
return chargeTicks > 0 && lastJumpDown;
|
||||
}
|
||||
|
||||
public static int getChargeTicks() {
|
||||
return chargeTicks;
|
||||
}
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
package com.craisinlord.antarchy.fabric.client;
|
||||
|
||||
import com.craisinlord.antarchy.content.item.BrutalflyElytraFlightHelper;
|
||||
import com.craisinlord.antarchy.content.item.BrutalflyElytraItem;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
|
||||
public final class BrutalflyElytraHudRenderer {
|
||||
private static final ResourceLocation JUMP_BAR_BACKGROUND = new ResourceLocation("textures/gui/sprites/hud/jump_bar_background.png");
|
||||
private static final ResourceLocation JUMP_BAR_PROGRESS = new ResourceLocation("textures/gui/sprites/hud/jump_bar_progress.png");
|
||||
private static final int BAR_WIDTH = 182;
|
||||
private static final int BAR_HEIGHT = 5;
|
||||
|
||||
private BrutalflyElytraHudRenderer() {
|
||||
}
|
||||
|
||||
public static void render(GuiGraphics guiGraphics) {
|
||||
Minecraft minecraft = Minecraft.getInstance();
|
||||
Player player = minecraft.player;
|
||||
if (player == null || minecraft.screen != null || player.isDeadOrDying() || minecraft.options.hideGui) {
|
||||
return;
|
||||
}
|
||||
if (!BrutalflyElytraItem.isWearingBrutalflyElytra(player) || !player.isFallFlying()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int width = minecraft.getWindow().getGuiScaledWidth();
|
||||
int height = minecraft.getWindow().getGuiScaledHeight();
|
||||
int x0 = width / 2 - BAR_WIDTH / 2;
|
||||
int y0 = height - 29;
|
||||
|
||||
guiGraphics.blit(JUMP_BAR_BACKGROUND, x0, y0, 0, 0, BAR_WIDTH, BAR_HEIGHT, BAR_WIDTH, BAR_HEIGHT);
|
||||
|
||||
int chargeTicks = BrutalflyElytraClientHandler.getChargeTicks();
|
||||
float chargeRatio = Mth.clamp(chargeTicks / (float) BrutalflyElytraFlightHelper.FLAP_CHARGE_TICKS_MAX, 0.0F, 1.0F);
|
||||
int filledWidth = Mth.clamp((int) (chargeRatio * BAR_WIDTH), 0, BAR_WIDTH);
|
||||
if (filledWidth > 0) {
|
||||
guiGraphics.setColor(1.0F, 1.0F, 1.0F, 0.35F + chargeRatio * 0.65F);
|
||||
guiGraphics.blit(JUMP_BAR_PROGRESS, x0, y0, 0, 0, filledWidth, BAR_HEIGHT, BAR_WIDTH, BAR_HEIGHT);
|
||||
guiGraphics.setColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
package com.craisinlord.antarchy.fabric.client;
|
||||
|
||||
import com.craisinlord.antarchy.Antarchy;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import net.minecraft.client.model.geom.ModelLayerLocation;
|
||||
import net.minecraft.client.model.geom.ModelPart;
|
||||
import net.minecraft.client.model.geom.PartPose;
|
||||
import net.minecraft.client.model.geom.builders.CubeListBuilder;
|
||||
import net.minecraft.client.model.geom.builders.LayerDefinition;
|
||||
import net.minecraft.client.model.geom.builders.MeshDefinition;
|
||||
import net.minecraft.client.model.geom.builders.PartDefinition;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.Mth;
|
||||
|
||||
public final class BrutalflyElytraModel {
|
||||
public static final ModelLayerLocation LAYER_LOCATION =
|
||||
new ModelLayerLocation(new ResourceLocation(Antarchy.MODID, "brutalfly_elytra"), "main");
|
||||
|
||||
private final ModelPart root;
|
||||
private final ModelPart leftWing;
|
||||
private final ModelPart rightWing;
|
||||
|
||||
public BrutalflyElytraModel(ModelPart root) {
|
||||
this.root = root;
|
||||
this.leftWing = root.getChild("left_wing");
|
||||
this.rightWing = root.getChild("right_wing");
|
||||
}
|
||||
|
||||
public static LayerDefinition createBodyLayer() {
|
||||
MeshDefinition meshDefinition = new MeshDefinition();
|
||||
PartDefinition root = meshDefinition.getRoot();
|
||||
root.addOrReplaceChild(
|
||||
"left_wing",
|
||||
CubeListBuilder.create().texOffs(22, 0).addBox(-10.0F, 0.0F, -1.0F, 10.0F, 20.0F, 2.0F),
|
||||
PartPose.offset(5.0F, 0.0F, -1.5F)
|
||||
);
|
||||
root.addOrReplaceChild(
|
||||
"right_wing",
|
||||
CubeListBuilder.create().mirror().texOffs(22, 0).addBox(0.0F, 0.0F, -1.0F, 10.0F, 20.0F, 2.0F),
|
||||
PartPose.offset(-5.0F, 0.0F, -1.5F)
|
||||
);
|
||||
return LayerDefinition.create(meshDefinition, 64, 32);
|
||||
}
|
||||
|
||||
public void setupAnimation(float progress, float strength, boolean crouching) {
|
||||
float wave = Mth.sin(progress * Mth.PI);
|
||||
float flap = wave * strength;
|
||||
float basePitch = crouching ? -0.18F : -0.05F;
|
||||
float wingSpread = 0.55F;
|
||||
this.leftWing.xRot = basePitch - flap * 1.2F;
|
||||
this.rightWing.xRot = basePitch - flap * 1.2F;
|
||||
this.leftWing.yRot = -wingSpread;
|
||||
this.rightWing.yRot = -wingSpread;
|
||||
this.leftWing.zRot = -0.35F - flap * 0.7F;
|
||||
this.rightWing.zRot = -0.35F - flap * 0.7F;
|
||||
}
|
||||
|
||||
public void renderToBuffer(PoseStack poseStack, VertexConsumer consumer, int packedLight, int overlay) {
|
||||
this.root.render(poseStack, consumer, packedLight, overlay);
|
||||
}
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
package com.craisinlord.antarchy.fabric.client;
|
||||
|
||||
import com.craisinlord.antarchy.config.AntarchySettings;
|
||||
import com.craisinlord.antarchy.content.entity.DiamondMinecartEntity;
|
||||
import com.craisinlord.antarchy.content.network.DiamondMinecartInputPayload;
|
||||
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
public final class DiamondMinecartClientHandler {
|
||||
|
||||
private DiamondMinecartClientHandler() {
|
||||
}
|
||||
|
||||
|
||||
private static byte lastFlags = 0;
|
||||
|
||||
public static void tick() {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
|
||||
if (!AntarchySettings.diamondMinecartEnabled()) return;
|
||||
if (mc.player == null || mc.level == null) return;
|
||||
if (!(mc.player.getVehicle() instanceof DiamondMinecartEntity)) return;
|
||||
if (mc.screen != null) {
|
||||
if (lastFlags != 0) {
|
||||
com.craisinlord.antarchy.fabric.network.AntarchyFabricClientNetworking.sendToServer(new DiamondMinecartInputPayload((byte) 0), DiamondMinecartInputPayload.STREAM_CODEC, DiamondMinecartInputPayload.TYPE);
|
||||
lastFlags = 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
byte flags = 0;
|
||||
if (mc.options.keyUp.isDown()) flags |= DiamondMinecartInputPayload.FLAG_FORWARD;
|
||||
if (mc.options.keyDown.isDown()) flags |= DiamondMinecartInputPayload.FLAG_BACK;
|
||||
if (mc.options.keyLeft.isDown()) flags |= DiamondMinecartInputPayload.FLAG_LEFT;
|
||||
if (mc.options.keyRight.isDown()) flags |= DiamondMinecartInputPayload.FLAG_RIGHT;
|
||||
|
||||
if (flags != lastFlags) {
|
||||
com.craisinlord.antarchy.fabric.network.AntarchyFabricClientNetworking.sendToServer(new DiamondMinecartInputPayload(flags), DiamondMinecartInputPayload.STREAM_CODEC, DiamondMinecartInputPayload.TYPE);
|
||||
lastFlags = flags;
|
||||
}
|
||||
}
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
package com.craisinlord.antarchy.fabric.client;
|
||||
|
||||
import com.craisinlord.antarchy.content.entity.DorrieEntity;
|
||||
import com.craisinlord.antarchy.content.network.DorrieChargeJumpPayload;
|
||||
import com.craisinlord.antarchy.content.network.DorrieJumpInputPayload;
|
||||
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.player.LocalPlayer;
|
||||
|
||||
public final class DorrieJumpClientHandler {
|
||||
private static boolean wasPressingJump = false;
|
||||
private static boolean wasPressingCharge = false;
|
||||
|
||||
private DorrieJumpClientHandler() {}
|
||||
|
||||
public static void tick() {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
LocalPlayer player = mc.player;
|
||||
|
||||
if (player == null || mc.screen != null) {
|
||||
resetAll();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(player.getVehicle() instanceof DorrieEntity)) {
|
||||
resetAll();
|
||||
return;
|
||||
}
|
||||
|
||||
// Space bar → upward movement.
|
||||
boolean pressingJump = mc.options.keyJump.isDown();
|
||||
if (pressingJump != wasPressingJump) {
|
||||
com.craisinlord.antarchy.fabric.network.AntarchyFabricClientNetworking.sendToServer(new DorrieJumpInputPayload(pressingJump), DorrieJumpInputPayload.STREAM_CODEC, DorrieJumpInputPayload.TYPE);
|
||||
wasPressingJump = pressingJump;
|
||||
}
|
||||
|
||||
// Left ctrl → charge jump.
|
||||
boolean pressingCharge = AntarchyKeyBindings.isDorrieChargeJumpPressed();
|
||||
if (pressingCharge != wasPressingCharge) {
|
||||
com.craisinlord.antarchy.fabric.network.AntarchyFabricClientNetworking.sendToServer(new DorrieChargeJumpPayload(pressingCharge), DorrieChargeJumpPayload.STREAM_CODEC, DorrieChargeJumpPayload.TYPE);
|
||||
if (!pressingCharge && player.getVehicle() instanceof DorrieEntity dorrie) {
|
||||
dorrie.applyJumpImpulseClient();
|
||||
}
|
||||
wasPressingCharge = pressingCharge;
|
||||
}
|
||||
}
|
||||
|
||||
private static void resetAll() {
|
||||
if (wasPressingJump) {
|
||||
com.craisinlord.antarchy.fabric.network.AntarchyFabricClientNetworking.sendToServer(new DorrieJumpInputPayload(false), DorrieJumpInputPayload.STREAM_CODEC, DorrieJumpInputPayload.TYPE);
|
||||
wasPressingJump = false;
|
||||
}
|
||||
if (wasPressingCharge) {
|
||||
com.craisinlord.antarchy.fabric.network.AntarchyFabricClientNetworking.sendToServer(new DorrieChargeJumpPayload(false), DorrieChargeJumpPayload.STREAM_CODEC, DorrieChargeJumpPayload.TYPE);
|
||||
wasPressingCharge = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
package com.craisinlord.antarchy.fabric.client;
|
||||
|
||||
import com.craisinlord.antarchy.content.entity.DorrieEntity;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
|
||||
public final class DorrieJumpHudRenderer {
|
||||
private static final ResourceLocation JUMP_BAR_BACKGROUND =
|
||||
new ResourceLocation("textures/gui/sprites/hud/jump_bar_background.png");
|
||||
private static final ResourceLocation JUMP_BAR_PROGRESS =
|
||||
new ResourceLocation("textures/gui/sprites/hud/jump_bar_progress.png");
|
||||
private static final int BAR_WIDTH = 182;
|
||||
private static final int BAR_HEIGHT = 5;
|
||||
|
||||
private DorrieJumpHudRenderer() {}
|
||||
|
||||
public static void render(GuiGraphics guiGraphics) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
Player player = mc.player;
|
||||
if (player == null || mc.screen != null || player.isDeadOrDying()) return;
|
||||
|
||||
if (!(player.getVehicle() instanceof DorrieEntity dorrie)) return;
|
||||
|
||||
int charge = dorrie.getJumpCharge();
|
||||
if (charge <= 0) return;
|
||||
|
||||
int width = mc.getWindow().getGuiScaledWidth();
|
||||
int height = mc.getWindow().getGuiScaledHeight();
|
||||
int x0 = width / 2 - BAR_WIDTH / 2;
|
||||
int y0 = height - 29;
|
||||
|
||||
guiGraphics.blit(JUMP_BAR_BACKGROUND, x0, y0, 0, 0, BAR_WIDTH, BAR_HEIGHT, BAR_WIDTH, BAR_HEIGHT);
|
||||
|
||||
float chargeRatio = Mth.clamp(charge / 100.0F, 0.0F, 1.0F);
|
||||
int filledWidth = Mth.clamp((int) (chargeRatio * BAR_WIDTH), 0, BAR_WIDTH);
|
||||
if (filledWidth > 0) {
|
||||
guiGraphics.setColor(0.2F, 0.8F, 1.0F, 0.4F + chargeRatio * 0.6F);
|
||||
guiGraphics.blit(JUMP_BAR_PROGRESS, x0, y0, 0, 0, filledWidth, BAR_HEIGHT, BAR_WIDTH, BAR_HEIGHT);
|
||||
guiGraphics.setColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
+385
@@ -0,0 +1,385 @@
|
||||
package com.craisinlord.antarchy.fabric.client;
|
||||
import com.craisinlord.antarchy.fabric.registry.AntarchyFabricMisc;
|
||||
import com.craisinlord.antarchy.fabric.registry.AntarchyFabricSounds;
|
||||
|
||||
import com.craisinlord.antarchy.config.AntarchySettings;
|
||||
import com.craisinlord.antarchy.content.AntarchyTags;
|
||||
import com.craisinlord.antarchy.fabric.AntarchyFabricContent;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.screens.DeathScreen;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.HolderSet;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
|
||||
public final class DreadClientHandler {
|
||||
private static final net.minecraft.world.effect.MobEffect DREAD_EFFECT = AntarchyFabricMisc.DREAD.get();
|
||||
private static final int FOOTSTEP_MIN_INTERVAL_TICKS = 10;
|
||||
private static final int FOOTSTEP_MAX_INTERVAL_TICKS = 22;
|
||||
private static final int APPARITION_MIN_DURATION_TICKS = 16;
|
||||
private static final int APPARITION_MAX_DURATION_TICKS = 34;
|
||||
private static final int LUNGE_MIN_DURATION_TICKS = 10;
|
||||
private static final int LUNGE_MAX_DURATION_TICKS = 16;
|
||||
|
||||
private static int nextSoundTick = 0;
|
||||
private static int nextApparitionTick = 0;
|
||||
private static int nextFootstepTick = 0;
|
||||
private static final List<ApparitionEntry> ACTIVE_APPARITIONS = new ArrayList<>();
|
||||
private static final Random RANDOM = new Random();
|
||||
|
||||
private DreadClientHandler() {
|
||||
}
|
||||
|
||||
private enum ApparitionType {
|
||||
PERIPHERAL_SILHOUETTE,
|
||||
CROSSING_SHADOW,
|
||||
LUNGE_FLASH
|
||||
}
|
||||
|
||||
private static final class ApparitionEntry {
|
||||
private final ApparitionType type;
|
||||
private final float scale;
|
||||
private final int lifetime;
|
||||
private final int baseColor;
|
||||
private float xNorm;
|
||||
private float yNorm;
|
||||
private float xVelocity;
|
||||
private float yVelocity;
|
||||
private int age;
|
||||
|
||||
private ApparitionEntry(ApparitionType type, float xNorm, float yNorm, float xVelocity, float yVelocity, float scale, int lifetime, int baseColor) {
|
||||
this.type = type;
|
||||
this.xNorm = xNorm;
|
||||
this.yNorm = yNorm;
|
||||
this.xVelocity = xVelocity;
|
||||
this.yVelocity = yVelocity;
|
||||
this.scale = scale;
|
||||
this.lifetime = lifetime;
|
||||
this.baseColor = baseColor;
|
||||
}
|
||||
|
||||
private void tick() {
|
||||
this.age++;
|
||||
this.xNorm += this.xVelocity;
|
||||
this.yNorm += this.yVelocity;
|
||||
}
|
||||
|
||||
private boolean expired() {
|
||||
return this.age >= this.lifetime;
|
||||
}
|
||||
|
||||
private float alpha() {
|
||||
float progress = this.lifetime <= 0 ? 1.0F : (float) this.age / (float) this.lifetime;
|
||||
return Mth.clamp(Mth.sin(progress * (float) Math.PI), 0.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
public static void tick() {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
if (mc.level == null || mc.player == null) {
|
||||
resetState();
|
||||
return;
|
||||
}
|
||||
if (mc.isPaused()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = mc.player;
|
||||
if (!player.isAlive() || player.isRemoved() || player.deathTime > 0 || player.isDeadOrDying() || mc.screen instanceof DeathScreen) {
|
||||
resetState();
|
||||
return;
|
||||
}
|
||||
|
||||
tickApparitions();
|
||||
|
||||
if (!player.hasEffect(DREAD_EFFECT)) {
|
||||
resetState();
|
||||
return;
|
||||
}
|
||||
|
||||
if (AntarchySettings.dreadHallucinationSoundsEnabled()) {
|
||||
nextSoundTick--;
|
||||
if (nextSoundTick <= 0) {
|
||||
playHallucinationSound(mc, player);
|
||||
nextSoundTick = randomIntervalTicks(
|
||||
AntarchySettings.dreadHallucinationSoundMinInterval(),
|
||||
AntarchySettings.dreadHallucinationSoundMaxInterval()
|
||||
);
|
||||
}
|
||||
} else {
|
||||
nextSoundTick = 0;
|
||||
}
|
||||
|
||||
nextFootstepTick--;
|
||||
if (nextFootstepTick <= 0) {
|
||||
if (player.onGround() && player.getDeltaMovement().horizontalDistanceSqr() > 0.0025D) {
|
||||
playFootstepSound(mc, player);
|
||||
nextFootstepTick = randomTickInterval(FOOTSTEP_MIN_INTERVAL_TICKS, FOOTSTEP_MAX_INTERVAL_TICKS);
|
||||
} else {
|
||||
nextFootstepTick = 4;
|
||||
}
|
||||
}
|
||||
|
||||
if (AntarchySettings.dreadHallucinationMobsEnabled()) {
|
||||
nextApparitionTick--;
|
||||
if (nextApparitionTick <= 0) {
|
||||
spawnApparition(mc, player);
|
||||
nextApparitionTick = randomIntervalTicks(
|
||||
AntarchySettings.dreadHallucinationMobMinInterval(),
|
||||
AntarchySettings.dreadHallucinationMobMaxInterval()
|
||||
);
|
||||
}
|
||||
} else {
|
||||
nextApparitionTick = 0;
|
||||
ACTIVE_APPARITIONS.clear();
|
||||
}
|
||||
}
|
||||
|
||||
public static void render(GuiGraphics guiGraphics) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
Player player = mc.player;
|
||||
if (player == null || !player.hasEffect(DREAD_EFFECT) || ACTIVE_APPARITIONS.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int width = mc.getWindow().getGuiScaledWidth();
|
||||
int height = mc.getWindow().getGuiScaledHeight();
|
||||
for (ApparitionEntry entry : ACTIVE_APPARITIONS) {
|
||||
float alpha = entry.alpha();
|
||||
if (alpha <= 0.01F) {
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (entry.type) {
|
||||
case PERIPHERAL_SILHOUETTE -> renderPeripheralSilhouette(guiGraphics, width, height, entry, alpha);
|
||||
case CROSSING_SHADOW -> renderCrossingShadow(guiGraphics, width, height, entry, alpha);
|
||||
case LUNGE_FLASH -> renderLungeFlash(guiGraphics, width, height, entry, alpha);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void tickApparitions() {
|
||||
Iterator<ApparitionEntry> iterator = ACTIVE_APPARITIONS.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
ApparitionEntry entry = iterator.next();
|
||||
entry.tick();
|
||||
if (entry.expired()) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void playHallucinationSound(Minecraft mc, Player player) {
|
||||
Optional<HolderSet.Named<SoundEvent>> tagOpt =
|
||||
BuiltInRegistries.SOUND_EVENT.getTag(AntarchyTags.SoundEvents.DREAD_HALLUCINATION_SOUNDS);
|
||||
if (tagOpt.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<Holder<SoundEvent>> sounds = tagOpt.get().stream().toList();
|
||||
if (sounds.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
SoundEvent soundEvent = sounds.get(RANDOM.nextInt(sounds.size())).value();
|
||||
|
||||
Vec3 look = player.getLookAngle();
|
||||
double baseAngle = Math.atan2(-look.x, -look.z);
|
||||
double spread = (RANDOM.nextDouble() - 0.5D) * Math.PI;
|
||||
double angle = baseAngle + spread;
|
||||
double distance = 10.0D + RANDOM.nextDouble() * 15.0D;
|
||||
|
||||
double soundX = player.getX() + Math.sin(angle) * distance;
|
||||
double soundY = player.getY() + RANDOM.nextDouble() * 4.0D - 1.0D;
|
||||
double soundZ = player.getZ() + Math.cos(angle) * distance;
|
||||
|
||||
mc.level.playLocalSound(
|
||||
soundX,
|
||||
soundY,
|
||||
soundZ,
|
||||
soundEvent,
|
||||
SoundSource.HOSTILE,
|
||||
1.0F,
|
||||
0.85F + RANDOM.nextFloat() * 0.3F,
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
private static void spawnApparition(Minecraft mc, Player player) {
|
||||
double roll = RANDOM.nextDouble();
|
||||
if (roll < 0.5D) {
|
||||
spawnPeripheralSilhouette();
|
||||
return;
|
||||
}
|
||||
if (roll < 0.82D) {
|
||||
spawnCrossingShadow();
|
||||
return;
|
||||
}
|
||||
spawnLungeFlash(mc, player);
|
||||
}
|
||||
|
||||
private static void spawnPeripheralSilhouette() {
|
||||
boolean leftSide = RANDOM.nextBoolean();
|
||||
float xNorm = leftSide ? 0.08F + RANDOM.nextFloat() * 0.08F : 0.84F + RANDOM.nextFloat() * 0.08F;
|
||||
float yNorm = 0.48F + (RANDOM.nextFloat() - 0.5F) * 0.26F;
|
||||
float scale = 0.85F + RANDOM.nextFloat() * 0.4F;
|
||||
int lifetime = randomTickInterval(APPARITION_MIN_DURATION_TICKS, APPARITION_MAX_DURATION_TICKS);
|
||||
ACTIVE_APPARITIONS.add(new ApparitionEntry(
|
||||
ApparitionType.PERIPHERAL_SILHOUETTE,
|
||||
xNorm,
|
||||
yNorm,
|
||||
leftSide ? -0.0015F : 0.0015F,
|
||||
0.0F,
|
||||
scale,
|
||||
lifetime,
|
||||
0x160000
|
||||
));
|
||||
}
|
||||
|
||||
private static void spawnCrossingShadow() {
|
||||
boolean leftToRight = RANDOM.nextBoolean();
|
||||
float xNorm = leftToRight ? -0.18F : 1.18F;
|
||||
float yNorm = 0.38F + RANDOM.nextFloat() * 0.36F;
|
||||
float velocity = leftToRight ? 0.04F + RANDOM.nextFloat() * 0.015F : -(0.04F + RANDOM.nextFloat() * 0.015F);
|
||||
float scale = 0.9F + RANDOM.nextFloat() * 0.45F;
|
||||
int lifetime = randomTickInterval(APPARITION_MIN_DURATION_TICKS, APPARITION_MAX_DURATION_TICKS);
|
||||
ACTIVE_APPARITIONS.add(new ApparitionEntry(
|
||||
ApparitionType.CROSSING_SHADOW,
|
||||
xNorm,
|
||||
yNorm,
|
||||
velocity,
|
||||
0.0F,
|
||||
scale,
|
||||
lifetime,
|
||||
0x1A0000
|
||||
));
|
||||
}
|
||||
|
||||
private static void spawnLungeFlash(Minecraft mc, Player player) {
|
||||
float xNorm = 0.5F + (RANDOM.nextBoolean() ? -1.0F : 1.0F) * (0.12F + RANDOM.nextFloat() * 0.12F);
|
||||
float yNorm = 0.58F + (RANDOM.nextFloat() - 0.5F) * 0.12F;
|
||||
float scale = 0.95F + RANDOM.nextFloat() * 0.35F;
|
||||
int lifetime = randomTickInterval(LUNGE_MIN_DURATION_TICKS, LUNGE_MAX_DURATION_TICKS);
|
||||
ACTIVE_APPARITIONS.add(new ApparitionEntry(
|
||||
ApparitionType.LUNGE_FLASH,
|
||||
xNorm,
|
||||
yNorm,
|
||||
0.0F,
|
||||
-0.002F,
|
||||
scale,
|
||||
lifetime,
|
||||
0x2A0000
|
||||
));
|
||||
mc.level.playLocalSound(
|
||||
player.getX(),
|
||||
player.getY() + 1.0D,
|
||||
player.getZ(),
|
||||
AntarchyFabricSounds.NIGHTMARE_BITE.get(),
|
||||
SoundSource.HOSTILE,
|
||||
0.4F,
|
||||
0.88F + RANDOM.nextFloat() * 0.12F,
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
private static void playFootstepSound(Minecraft mc, Player player) {
|
||||
double soundX = player.getX() + (RANDOM.nextDouble() - 0.5D) * 1.2D;
|
||||
double soundY = player.getY() - 0.95D;
|
||||
double soundZ = player.getZ() + (RANDOM.nextDouble() - 0.5D) * 1.2D;
|
||||
|
||||
mc.level.playLocalSound(
|
||||
soundX,
|
||||
soundY,
|
||||
soundZ,
|
||||
SoundEvents.SILVERFISH_STEP,
|
||||
SoundSource.HOSTILE,
|
||||
0.45F,
|
||||
0.85F + RANDOM.nextFloat() * 0.25F,
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
private static void renderPeripheralSilhouette(GuiGraphics guiGraphics, int width, int height, ApparitionEntry entry, float alpha) {
|
||||
int centerX = Math.round(entry.xNorm * width);
|
||||
int baseY = Math.round(entry.yNorm * height);
|
||||
int bodyWidth = Math.round(width * 0.045F * entry.scale);
|
||||
int bodyHeight = Math.round(height * 0.24F * entry.scale);
|
||||
int headSize = Math.round(bodyWidth * 0.78F);
|
||||
int x0 = centerX - bodyWidth / 2;
|
||||
int y0 = baseY - bodyHeight / 2;
|
||||
|
||||
int outerColor = alphaColor(entry.baseColor, alpha * 0.8F);
|
||||
int innerColor = alphaColor(0x5A0000, alpha * 0.22F);
|
||||
|
||||
guiGraphics.fill(x0, y0, x0 + bodyWidth, y0 + bodyHeight, outerColor);
|
||||
guiGraphics.fill(x0 - headSize / 2 + bodyWidth / 2, y0 - headSize / 2, x0 + bodyWidth / 2 + headSize / 2, y0 + headSize / 2, outerColor);
|
||||
guiGraphics.fill(x0 + bodyWidth / 6, y0 + bodyHeight / 6, x0 + bodyWidth - bodyWidth / 6, y0 + bodyHeight - bodyHeight / 7, innerColor);
|
||||
}
|
||||
|
||||
private static void renderCrossingShadow(GuiGraphics guiGraphics, int width, int height, ApparitionEntry entry, float alpha) {
|
||||
int centerX = Math.round(entry.xNorm * width);
|
||||
int centerY = Math.round(entry.yNorm * height);
|
||||
int shadowWidth = Math.round(width * 0.22F * entry.scale);
|
||||
int shadowHeight = Math.round(height * 0.035F * entry.scale);
|
||||
|
||||
int outerColor = alphaColor(entry.baseColor, alpha * 0.65F);
|
||||
int innerColor = alphaColor(0x340000, alpha * 0.28F);
|
||||
|
||||
guiGraphics.fill(centerX - shadowWidth / 2, centerY - shadowHeight / 2, centerX + shadowWidth / 2, centerY + shadowHeight / 2, outerColor);
|
||||
guiGraphics.fill(centerX - shadowWidth / 3, centerY - shadowHeight, centerX + shadowWidth / 3, centerY + shadowHeight, innerColor);
|
||||
}
|
||||
|
||||
private static void renderLungeFlash(GuiGraphics guiGraphics, int width, int height, ApparitionEntry entry, float alpha) {
|
||||
int centerX = Math.round(entry.xNorm * width);
|
||||
int centerY = Math.round(entry.yNorm * height);
|
||||
int faceWidth = Math.round(width * 0.11F * entry.scale);
|
||||
int faceHeight = Math.round(height * 0.12F * entry.scale);
|
||||
|
||||
int shadowColor = alphaColor(entry.baseColor, alpha * 0.82F);
|
||||
int glowColor = alphaColor(0x4A0000, alpha * 0.25F);
|
||||
int eyeColor = alphaColor(0xB02020, alpha * 0.8F);
|
||||
|
||||
guiGraphics.fill(centerX - faceWidth / 2, centerY - faceHeight / 2, centerX + faceWidth / 2, centerY + faceHeight / 2, shadowColor);
|
||||
guiGraphics.fill(centerX - faceWidth, centerY - faceHeight / 3, centerX + faceWidth, centerY + faceHeight, glowColor);
|
||||
|
||||
int eyeWidth = Math.max(2, faceWidth / 7);
|
||||
int eyeHeight = Math.max(2, faceHeight / 12);
|
||||
int eyeY = centerY - faceHeight / 8;
|
||||
int eyeOffset = faceWidth / 4;
|
||||
guiGraphics.fill(centerX - eyeOffset - eyeWidth, eyeY, centerX - eyeOffset + eyeWidth, eyeY + eyeHeight, eyeColor);
|
||||
guiGraphics.fill(centerX + eyeOffset - eyeWidth, eyeY, centerX + eyeOffset + eyeWidth, eyeY + eyeHeight, eyeColor);
|
||||
}
|
||||
|
||||
private static void resetState() {
|
||||
ACTIVE_APPARITIONS.clear();
|
||||
nextSoundTick = 0;
|
||||
nextApparitionTick = 0;
|
||||
nextFootstepTick = 0;
|
||||
}
|
||||
|
||||
private static int randomIntervalTicks(double minSeconds, double maxSeconds) {
|
||||
double seconds = minSeconds + RANDOM.nextDouble() * Math.max(0.0D, maxSeconds - minSeconds);
|
||||
return Math.max(1, (int) (seconds * 20.0D));
|
||||
}
|
||||
|
||||
private static int randomTickInterval(int minTicks, int maxTicks) {
|
||||
return minTicks + RANDOM.nextInt(Math.max(1, maxTicks - minTicks + 1));
|
||||
}
|
||||
|
||||
private static int alphaColor(int rgb, float alpha) {
|
||||
int alphaByte = Mth.clamp((int) (alpha * 255.0F), 0, 255);
|
||||
return (alphaByte << 24) | rgb;
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
package com.craisinlord.antarchy.fabric.client;
|
||||
import com.craisinlord.antarchy.fabric.registry.AntarchyFabricMisc;
|
||||
|
||||
import com.craisinlord.antarchy.fabric.AntarchyFabricContent;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.effect.MobEffect;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
|
||||
public final class DreadHudRenderer {
|
||||
private static final MobEffect DREAD_EFFECT = AntarchyFabricMisc.DREAD.get();
|
||||
|
||||
private DreadHudRenderer() {
|
||||
}
|
||||
|
||||
public static void render(GuiGraphics guiGraphics) {
|
||||
Minecraft minecraft = Minecraft.getInstance();
|
||||
Player player = minecraft.player;
|
||||
if (player == null || minecraft.screen != null || player.isDeadOrDying() || !player.hasEffect(DREAD_EFFECT)) {
|
||||
return;
|
||||
}
|
||||
|
||||
float pulse = Math.max(0.0F, Mth.sin(player.tickCount * ((float) Math.PI * 2.0F / 80.0F)));
|
||||
int alpha = Mth.clamp(18 + Mth.floor(pulse * 64.0F), 0, 255);
|
||||
int color = (alpha << 24) | 0x120000;
|
||||
int width = minecraft.getWindow().getGuiScaledWidth();
|
||||
int height = minecraft.getWindow().getGuiScaledHeight();
|
||||
guiGraphics.fill(0, 0, width, height, color);
|
||||
DreadClientHandler.render(guiGraphics);
|
||||
}
|
||||
}
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
package com.craisinlord.antarchy.fabric.client;
|
||||
import com.craisinlord.antarchy.fabric.registry.AntarchyFabricMisc;
|
||||
|
||||
import com.craisinlord.antarchy.config.AntarchySettings;
|
||||
import com.craisinlord.antarchy.content.AntarchyTags;
|
||||
import com.craisinlord.antarchy.content.AntarchySoundEvents;
|
||||
import com.craisinlord.antarchy.content.client.renderer.ElythiaSkyRenderer;
|
||||
import com.craisinlord.antarchy.fabric.AntarchyFabricContent;
|
||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
|
||||
public final class ElythiaFireflyManager {
|
||||
private static final long NIGHT_START = 13000L;
|
||||
private static final long NIGHT_END = 23000L;
|
||||
private static final int SPAWN_INTERVAL = 3;
|
||||
private static final int SPAWN_RADIUS_H = 20;
|
||||
private static final int SPAWN_Y_MIN = -2;
|
||||
private static final int SPAWN_Y_MAX = 10;
|
||||
private static final int SOUND_INTERVAL_MIN = 250;
|
||||
private static final int SOUND_INTERVAL_MAX = 450;
|
||||
|
||||
private static int nextSoundTick = SOUND_INTERVAL_MIN;
|
||||
|
||||
private ElythiaFireflyManager() {}
|
||||
|
||||
public static void register() {
|
||||
ClientTickEvents.END_CLIENT_TICK.register(client -> {
|
||||
ClientLevel level = client.level;
|
||||
if (level == null || client.player == null) return;
|
||||
if (client.isPaused()) return;
|
||||
if (!ElythiaSkyRenderer.shouldRender(level)) return;
|
||||
|
||||
long dayTime = level.getDayTime() % 24000L;
|
||||
if (dayTime < NIGHT_START || dayTime > NIGHT_END) return;
|
||||
|
||||
long gameTime = level.getGameTime();
|
||||
boolean fireflyBiome = level.getBiome(client.player.blockPosition()).is(AntarchyTags.Biomes.ELYTHIA_FIREFLY_PARTICLE_BIOMES);
|
||||
|
||||
if (AntarchySettings.elythiaFireflyParticlesEnabled() && fireflyBiome) {
|
||||
if (gameTime % SPAWN_INTERVAL == 0) {
|
||||
Player player = client.player;
|
||||
int px = (int) player.getX();
|
||||
int py = (int) player.getY();
|
||||
int pz = (int) player.getZ();
|
||||
|
||||
int attempts = 1 + level.random.nextInt(3);
|
||||
for (int i = 0; i < attempts; i++) {
|
||||
int ox = level.random.nextInt(SPAWN_RADIUS_H * 2 + 1) - SPAWN_RADIUS_H;
|
||||
int oy = SPAWN_Y_MIN + level.random.nextInt(SPAWN_Y_MAX - SPAWN_Y_MIN + 1);
|
||||
int oz = level.random.nextInt(SPAWN_RADIUS_H * 2 + 1) - SPAWN_RADIUS_H;
|
||||
|
||||
BlockPos candidate = new BlockPos(px + ox, py + oy, pz + oz);
|
||||
if (!level.getBlockState(candidate).isAir()) continue;
|
||||
|
||||
level.addParticle(
|
||||
AntarchyFabricMisc.FIREFLY.get(),
|
||||
candidate.getX() + level.random.nextDouble(),
|
||||
candidate.getY() + level.random.nextDouble(),
|
||||
candidate.getZ() + level.random.nextDouble(),
|
||||
0.0, 0.0, 0.0
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nextSoundTick--;
|
||||
if (nextSoundTick <= 0) {
|
||||
nextSoundTick = SOUND_INTERVAL_MIN + level.random.nextInt(SOUND_INTERVAL_MAX - SOUND_INTERVAL_MIN + 1);
|
||||
Player player = client.player;
|
||||
level.playLocalSound(
|
||||
player.getX(), player.getY(), player.getZ(),
|
||||
AntarchySoundEvents.ELYTHIA_FIREFLY_AMBIENT.get(),
|
||||
SoundSource.AMBIENT,
|
||||
0.6f + level.random.nextFloat() * 0.3f,
|
||||
0.9f + level.random.nextFloat() * 0.2f,
|
||||
false
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
package com.craisinlord.antarchy.fabric.client;
|
||||
import com.craisinlord.antarchy.fabric.registry.AntarchyFabricBlocks;
|
||||
import com.craisinlord.antarchy.fabric.registry.AntarchyFabricItems;
|
||||
|
||||
import com.craisinlord.antarchy.fabric.AntarchyFabricContent;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.math.Axis;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.model.ArmorStandModel;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.block.BlockRenderDispatcher;
|
||||
import net.minecraft.client.renderer.entity.LivingEntityRenderer;
|
||||
import net.minecraft.client.renderer.entity.RenderLayerParent;
|
||||
import net.minecraft.client.renderer.entity.layers.RenderLayer;
|
||||
import net.minecraft.world.entity.decoration.ArmorStand;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
public final class FallenKingCrownArmorStandLayer extends RenderLayer<ArmorStand, ArmorStandModel> {
|
||||
private final BlockRenderDispatcher blockRenderer;
|
||||
|
||||
public FallenKingCrownArmorStandLayer(RenderLayerParent<ArmorStand, ArmorStandModel> renderer) {
|
||||
super(renderer);
|
||||
this.blockRenderer = Minecraft.getInstance().getBlockRenderer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack poseStack, MultiBufferSource buffer, int packedLight, ArmorStand armorStand, float limbSwing, float limbSwingAmount, float partialTick, float ageInTicks, float netHeadYaw, float headPitch) {
|
||||
ItemStack headStack = armorStand.getItemBySlot(net.minecraft.world.entity.EquipmentSlot.HEAD);
|
||||
if (!headStack.is(AntarchyFabricItems.FALLEN_KING_CROWN.get()) || armorStand.isInvisible()) {
|
||||
return;
|
||||
}
|
||||
|
||||
poseStack.pushPose();
|
||||
this.getParentModel().head.translateAndRotate(poseStack);
|
||||
poseStack.translate(0.5D, -0.125D, -0.5D);
|
||||
poseStack.mulPose(Axis.XP.rotationDegrees(180.0F));
|
||||
poseStack.mulPose(Axis.YP.rotationDegrees(180.0F));
|
||||
this.blockRenderer.renderSingleBlock(
|
||||
AntarchyFabricBlocks.FALLEN_KING_CROWN_BLOCK.get().defaultBlockState(),
|
||||
poseStack,
|
||||
buffer,
|
||||
packedLight,
|
||||
LivingEntityRenderer.getOverlayCoords(armorStand, 0.0F)
|
||||
);
|
||||
poseStack.popPose();
|
||||
}
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
package com.craisinlord.antarchy.fabric.client;
|
||||
import com.craisinlord.antarchy.fabric.registry.AntarchyFabricBlocks;
|
||||
import com.craisinlord.antarchy.fabric.registry.AntarchyFabricItems;
|
||||
|
||||
import com.craisinlord.antarchy.fabric.AntarchyFabricContent;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.math.Axis;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.model.PlayerModel;
|
||||
import net.minecraft.client.player.AbstractClientPlayer;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.block.BlockRenderDispatcher;
|
||||
import net.minecraft.client.renderer.entity.LivingEntityRenderer;
|
||||
import net.minecraft.client.renderer.entity.RenderLayerParent;
|
||||
import net.minecraft.client.renderer.entity.layers.RenderLayer;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
public final class FallenKingCrownLayer extends RenderLayer<AbstractClientPlayer, PlayerModel<AbstractClientPlayer>> {
|
||||
private final BlockRenderDispatcher blockRenderer;
|
||||
|
||||
public FallenKingCrownLayer(RenderLayerParent<AbstractClientPlayer, PlayerModel<AbstractClientPlayer>> renderer) {
|
||||
super(renderer);
|
||||
this.blockRenderer = Minecraft.getInstance().getBlockRenderer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(
|
||||
PoseStack poseStack,
|
||||
MultiBufferSource buffer,
|
||||
int packedLight,
|
||||
AbstractClientPlayer player,
|
||||
float limbSwing,
|
||||
float limbSwingAmount,
|
||||
float partialTick,
|
||||
float ageInTicks,
|
||||
float netHeadYaw,
|
||||
float headPitch
|
||||
) {
|
||||
ItemStack headStack = player.getItemBySlot(EquipmentSlot.HEAD);
|
||||
if (!headStack.is(AntarchyFabricItems.FALLEN_KING_CROWN.get()) || player.isInvisible()) {
|
||||
return;
|
||||
}
|
||||
|
||||
poseStack.pushPose();
|
||||
this.getParentModel().head.translateAndRotate(poseStack);
|
||||
poseStack.translate(0.5D, -0.125D, -0.5D);
|
||||
poseStack.mulPose(Axis.XP.rotationDegrees(180.0F));
|
||||
poseStack.mulPose(Axis.YP.rotationDegrees(180.0F));
|
||||
this.blockRenderer.renderSingleBlock(
|
||||
AntarchyFabricBlocks.FALLEN_KING_CROWN_BLOCK.get().defaultBlockState(),
|
||||
poseStack,
|
||||
buffer,
|
||||
packedLight,
|
||||
LivingEntityRenderer.getOverlayCoords(player, 0.0F)
|
||||
);
|
||||
poseStack.popPose();
|
||||
}
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package com.craisinlord.antarchy.fabric.client;
|
||||
|
||||
import com.craisinlord.antarchy.config.AntarchySettings;
|
||||
import com.craisinlord.antarchy.content.item.GravityGunItem;
|
||||
import com.craisinlord.antarchy.content.network.GravityGunPrimaryPayload;
|
||||
import com.craisinlord.antarchy.content.network.GravityGunScrollPayload;
|
||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.util.Mth;
|
||||
|
||||
public final class GravityGunClientHandler {
|
||||
private static final double SCROLL_STEP_DISTANCE = 0.75D;
|
||||
private static boolean lastAttackDown;
|
||||
private static double scrollAccumulator;
|
||||
|
||||
private GravityGunClientHandler() {
|
||||
}
|
||||
|
||||
public static void register() {
|
||||
ClientTickEvents.END_CLIENT_TICK.register(client -> tickMouse(client));
|
||||
}
|
||||
|
||||
private static void tickMouse(Minecraft mc) {
|
||||
if (mc.player == null || mc.level == null || mc.screen != null || !AntarchySettings.gravityGunEnabled()) {
|
||||
lastAttackDown = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(mc.player.getMainHandItem().getItem() instanceof GravityGunItem)) {
|
||||
lastAttackDown = false;
|
||||
return;
|
||||
}
|
||||
|
||||
boolean attackDown = mc.options.keyAttack.isDown();
|
||||
if (attackDown && !lastAttackDown) {
|
||||
com.craisinlord.antarchy.fabric.network.AntarchyFabricClientNetworking.sendToServer(new GravityGunPrimaryPayload(), GravityGunPrimaryPayload.STREAM_CODEC, GravityGunPrimaryPayload.TYPE);
|
||||
}
|
||||
lastAttackDown = attackDown;
|
||||
}
|
||||
|
||||
public static boolean onScroll(double verticalAmount) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
if (mc.player == null || mc.level == null || mc.screen != null || !Screen.hasControlDown() || !AntarchySettings.gravityGunEnabled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(mc.player.getMainHandItem().getItem() instanceof GravityGunItem) || !GravityGunItem.hasHeldTarget(mc.player.getMainHandItem())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
double scrollAmount = Mth.clamp(verticalAmount, -1.0D, 1.0D);
|
||||
if (Math.abs(scrollAmount) < 1.0E-4D) {
|
||||
return false;
|
||||
}
|
||||
|
||||
com.craisinlord.antarchy.fabric.network.AntarchyFabricClientNetworking.sendToServer(new GravityGunScrollPayload(scrollAmount * SCROLL_STEP_DISTANCE), GravityGunScrollPayload.STREAM_CODEC, GravityGunScrollPayload.TYPE);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
package com.craisinlord.antarchy.fabric.client;
|
||||
|
||||
import com.craisinlord.antarchy.content.entity.HerculesBeetleEntity;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
|
||||
public final class HerculesBeetleChargeHudRenderer {
|
||||
private static final ResourceLocation CHARGE_BAR_BACKGROUND =
|
||||
new ResourceLocation("textures/gui/sprites/hud/jump_bar_background.png");
|
||||
private static final ResourceLocation CHARGE_BAR_PROGRESS =
|
||||
new ResourceLocation("textures/gui/sprites/hud/jump_bar_progress.png");
|
||||
private static final int BAR_WIDTH = 182;
|
||||
private static final int BAR_HEIGHT = 5;
|
||||
|
||||
private HerculesBeetleChargeHudRenderer() {
|
||||
}
|
||||
|
||||
public static void render(GuiGraphics guiGraphics) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
Player player = mc.player;
|
||||
if (player == null || mc.screen != null || player.isDeadOrDying()) {
|
||||
return;
|
||||
}
|
||||
if (!(player.getVehicle() instanceof HerculesBeetleEntity beetle)) {
|
||||
return;
|
||||
}
|
||||
|
||||
int charge = beetle.getMountedCharge();
|
||||
if (charge <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
int width = mc.getWindow().getGuiScaledWidth();
|
||||
int height = mc.getWindow().getGuiScaledHeight();
|
||||
int x0 = width / 2 - BAR_WIDTH / 2;
|
||||
int y0 = height - 29;
|
||||
float chargeRatio = Mth.clamp(charge / 100.0F, 0.0F, 1.0F);
|
||||
int filledWidth = Mth.clamp((int) (chargeRatio * BAR_WIDTH), 0, BAR_WIDTH);
|
||||
|
||||
guiGraphics.blit(CHARGE_BAR_BACKGROUND, x0, y0, 0, 0, BAR_WIDTH, BAR_HEIGHT, BAR_WIDTH, BAR_HEIGHT);
|
||||
if (filledWidth > 0) {
|
||||
guiGraphics.setColor(1.0F, 0.78F, 0.2F, 0.45F + chargeRatio * 0.55F);
|
||||
guiGraphics.blit(CHARGE_BAR_PROGRESS, x0, y0, 0, 0, filledWidth, BAR_HEIGHT, BAR_WIDTH, BAR_HEIGHT);
|
||||
guiGraphics.setColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
package com.craisinlord.antarchy.fabric.client;
|
||||
|
||||
import com.craisinlord.antarchy.content.entity.HerculesBeetleEntity;
|
||||
import com.craisinlord.antarchy.content.network.HerculesBeetleFlightTogglePayload;
|
||||
import com.craisinlord.antarchy.content.network.HerculesBeetleJumpInputPayload;
|
||||
import com.craisinlord.antarchy.content.network.HerculesBeetleMountedAttackPayload;
|
||||
import com.craisinlord.antarchy.content.network.HerculesBeetleMountedChargePayload;
|
||||
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.player.LocalPlayer;
|
||||
|
||||
public final class HerculesBeetleClientHandler {
|
||||
private static boolean wasPressingJump;
|
||||
private static boolean wasPressingAttack;
|
||||
private static boolean wasCharging;
|
||||
private static boolean wasPressingFlightToggle;
|
||||
|
||||
private HerculesBeetleClientHandler() {
|
||||
}
|
||||
|
||||
public static void tick() {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
LocalPlayer player = mc.player;
|
||||
if (player == null || mc.screen != null) {
|
||||
resetAll();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(player.getVehicle() instanceof HerculesBeetleEntity)) {
|
||||
resetAll();
|
||||
return;
|
||||
}
|
||||
|
||||
boolean pressingJump = mc.options.keyJump.isDown();
|
||||
if (pressingJump != wasPressingJump) {
|
||||
com.craisinlord.antarchy.fabric.network.AntarchyFabricClientNetworking.sendToServer(new HerculesBeetleJumpInputPayload(pressingJump), HerculesBeetleJumpInputPayload.STREAM_CODEC, HerculesBeetleJumpInputPayload.TYPE);
|
||||
wasPressingJump = pressingJump;
|
||||
}
|
||||
|
||||
boolean pressingAttack = mc.options.keyAttack.isDown();
|
||||
if (pressingAttack && !wasPressingAttack) {
|
||||
com.craisinlord.antarchy.fabric.network.AntarchyFabricClientNetworking.sendToServer(new HerculesBeetleMountedAttackPayload(), HerculesBeetleMountedAttackPayload.STREAM_CODEC, HerculesBeetleMountedAttackPayload.TYPE);
|
||||
}
|
||||
wasPressingAttack = pressingAttack;
|
||||
|
||||
boolean charging = AntarchyKeyBindings.isHerculesBeetleChargePressed();
|
||||
if (charging != wasCharging) {
|
||||
com.craisinlord.antarchy.fabric.network.AntarchyFabricClientNetworking.sendToServer(new HerculesBeetleMountedChargePayload(charging), HerculesBeetleMountedChargePayload.STREAM_CODEC, HerculesBeetleMountedChargePayload.TYPE);
|
||||
}
|
||||
wasCharging = charging;
|
||||
|
||||
boolean pressingFlightToggle = AntarchyKeyBindings.isHerculesBeetleFlightTogglePressed();
|
||||
if (pressingFlightToggle && !wasPressingFlightToggle) {
|
||||
com.craisinlord.antarchy.fabric.network.AntarchyFabricClientNetworking.sendToServer(new HerculesBeetleFlightTogglePayload(), HerculesBeetleFlightTogglePayload.STREAM_CODEC, HerculesBeetleFlightTogglePayload.TYPE);
|
||||
}
|
||||
wasPressingFlightToggle = pressingFlightToggle;
|
||||
}
|
||||
|
||||
private static void resetAll() {
|
||||
if (wasPressingJump) {
|
||||
com.craisinlord.antarchy.fabric.network.AntarchyFabricClientNetworking.sendToServer(new HerculesBeetleJumpInputPayload(false), HerculesBeetleJumpInputPayload.STREAM_CODEC, HerculesBeetleJumpInputPayload.TYPE);
|
||||
wasPressingJump = false;
|
||||
}
|
||||
wasPressingAttack = false;
|
||||
wasCharging = false;
|
||||
wasPressingFlightToggle = false;
|
||||
}
|
||||
}
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
package com.craisinlord.antarchy.fabric.client;
|
||||
import com.craisinlord.antarchy.fabric.registry.AntarchyFabricMisc;
|
||||
|
||||
import com.craisinlord.antarchy.content.client.particle.InvertedGeyserBaseParticleOptions;
|
||||
import com.craisinlord.antarchy.content.client.particle.InvertedGeyserParticleOptions;
|
||||
import com.craisinlord.antarchy.fabric.AntarchyFabricContent;
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.client.particle.NoRenderParticle;
|
||||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.client.particle.ParticleProvider;
|
||||
|
||||
public final class InvertedGeyserEruptionParticle extends NoRenderParticle {
|
||||
private final int fluidBlocks;
|
||||
private final double motionX;
|
||||
private final double motionY;
|
||||
private final double motionZ;
|
||||
private final InvertedGeyserParticleOptions plumeParticle;
|
||||
private final InvertedGeyserBaseParticleOptions baseParticle;
|
||||
private final InvertedGeyserBaseParticleOptions poofParticle;
|
||||
|
||||
protected InvertedGeyserEruptionParticle(
|
||||
ClientLevel level,
|
||||
double x,
|
||||
double y,
|
||||
double z,
|
||||
double xd,
|
||||
double yd,
|
||||
double zd,
|
||||
InvertedGeyserParticleOptions options
|
||||
) {
|
||||
super(level, x, y, z);
|
||||
this.motionX = xd;
|
||||
this.motionY = yd;
|
||||
this.motionZ = zd;
|
||||
this.fluidBlocks = options.fluidBlocks();
|
||||
this.lifetime = 20;
|
||||
this.plumeParticle = new InvertedGeyserParticleOptions(AntarchyFabricMisc.INVERTED_GEYSER_PLUME.get(), this.fluidBlocks, options.direction());
|
||||
this.baseParticle = new InvertedGeyserBaseParticleOptions(AntarchyFabricMisc.INVERTED_GEYSER_BASE.get(), this.fluidBlocks, 1.5F, options.direction());
|
||||
this.poofParticle = new InvertedGeyserBaseParticleOptions(AntarchyFabricMisc.INVERTED_GEYSER_POOF.get(), this.fluidBlocks, 2.0F, options.direction());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
|
||||
if (this.age % 2 == 0) {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
this.level.addParticle(this.baseParticle, this.x, this.y, this.z, this.motionX, this.motionY, this.motionZ);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < this.fluidBlocks + 2; i++) {
|
||||
this.level.addParticle(this.plumeParticle, this.x, this.y, this.z, this.motionX, this.motionY, this.motionZ);
|
||||
}
|
||||
|
||||
if (this.age % 10 == 0) {
|
||||
for (int i = 0; i < 20; i++) {
|
||||
this.level.addParticle(this.poofParticle, this.x, this.y, this.z, this.motionX, this.motionY, this.motionZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static final class Provider implements ParticleProvider<InvertedGeyserParticleOptions> {
|
||||
@Override
|
||||
public Particle createParticle(
|
||||
InvertedGeyserParticleOptions options,
|
||||
ClientLevel level,
|
||||
double x,
|
||||
double y,
|
||||
double z,
|
||||
double xd,
|
||||
double yd,
|
||||
double zd
|
||||
) {
|
||||
return new InvertedGeyserEruptionParticle(level, x, y, z, xd, yd, zd, options);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
package com.craisinlord.antarchy.fabric.client;
|
||||
|
||||
import com.craisinlord.antarchy.content.item.JumpyBootsHelper;
|
||||
import com.craisinlord.antarchy.content.item.JumpyBootsItem;
|
||||
import com.craisinlord.antarchy.content.network.JumpyBootsLaunchPayload;
|
||||
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.player.LocalPlayer;
|
||||
|
||||
public final class JumpyBootsClientHandler {
|
||||
private static int chargeTicks = 0;
|
||||
private static boolean wasCharging = false;
|
||||
private static int primeWindowTicks = 0;
|
||||
private static int storedChargeTicks = 0;
|
||||
|
||||
private JumpyBootsClientHandler() {
|
||||
}
|
||||
|
||||
public static void tick() {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
LocalPlayer player = mc.player;
|
||||
|
||||
if (player == null || mc.level == null || mc.screen != null) {
|
||||
reset();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!JumpyBootsItem.isWearingJumpyBoots(player)) {
|
||||
reset();
|
||||
return;
|
||||
}
|
||||
|
||||
boolean onGround = player.onGround();
|
||||
boolean sneaking = player.input.shiftKeyDown;
|
||||
boolean jumpPressed = mc.options.keyJump.consumeClick();
|
||||
|
||||
if (primeWindowTicks > 0) {
|
||||
primeWindowTicks--;
|
||||
if (jumpPressed) {
|
||||
com.craisinlord.antarchy.fabric.network.AntarchyFabricClientNetworking.sendToServer(new JumpyBootsLaunchPayload(storedChargeTicks, player.isSprinting()), JumpyBootsLaunchPayload.STREAM_CODEC, JumpyBootsLaunchPayload.TYPE);
|
||||
reset();
|
||||
return;
|
||||
}
|
||||
if (primeWindowTicks <= 0) {
|
||||
reset();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (!onGround) {
|
||||
chargeTicks = 0;
|
||||
wasCharging = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (jumpPressed && wasCharging && chargeTicks > 0) {
|
||||
com.craisinlord.antarchy.fabric.network.AntarchyFabricClientNetworking.sendToServer(new JumpyBootsLaunchPayload(chargeTicks, player.isSprinting()), JumpyBootsLaunchPayload.STREAM_CODEC, JumpyBootsLaunchPayload.TYPE);
|
||||
reset();
|
||||
return;
|
||||
}
|
||||
|
||||
if (sneaking) {
|
||||
chargeTicks = Math.min(chargeTicks + 1, JumpyBootsHelper.CHARGE_TICKS_MAX);
|
||||
wasCharging = true;
|
||||
} else if (wasCharging && chargeTicks > 0) {
|
||||
storedChargeTicks = chargeTicks;
|
||||
if (jumpPressed) {
|
||||
com.craisinlord.antarchy.fabric.network.AntarchyFabricClientNetworking.sendToServer(new JumpyBootsLaunchPayload(storedChargeTicks, player.isSprinting()), JumpyBootsLaunchPayload.STREAM_CODEC, JumpyBootsLaunchPayload.TYPE);
|
||||
reset();
|
||||
return;
|
||||
}
|
||||
primeWindowTicks = JumpyBootsHelper.PRIME_WINDOW_TICKS;
|
||||
chargeTicks = 0;
|
||||
wasCharging = false;
|
||||
} else {
|
||||
chargeTicks = 0;
|
||||
wasCharging = false;
|
||||
}
|
||||
}
|
||||
|
||||
private static void reset() {
|
||||
chargeTicks = 0;
|
||||
wasCharging = false;
|
||||
primeWindowTicks = 0;
|
||||
storedChargeTicks = 0;
|
||||
}
|
||||
|
||||
public static boolean isCharging() {
|
||||
return chargeTicks > 0;
|
||||
}
|
||||
|
||||
public static int getChargeTicks() {
|
||||
return chargeTicks;
|
||||
}
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
package com.craisinlord.antarchy.fabric.client;
|
||||
|
||||
import com.craisinlord.antarchy.content.item.JumpyBootsHelper;
|
||||
import com.craisinlord.antarchy.content.item.JumpyBootsItem;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
|
||||
public final class JumpyBootsHudRenderer {
|
||||
private static final ResourceLocation JUMP_BAR_BACKGROUND = new ResourceLocation("textures/gui/sprites/hud/jump_bar_background.png");
|
||||
private static final ResourceLocation JUMP_BAR_PROGRESS = new ResourceLocation("textures/gui/sprites/hud/jump_bar_progress.png");
|
||||
private static final int BAR_WIDTH = 182;
|
||||
private static final int BAR_HEIGHT = 5;
|
||||
|
||||
private JumpyBootsHudRenderer() {
|
||||
}
|
||||
|
||||
public static void render(GuiGraphics guiGraphics) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
Player player = mc.player;
|
||||
if (player == null || mc.screen != null || player.isDeadOrDying()) {
|
||||
return;
|
||||
}
|
||||
if (!JumpyBootsItem.isWearingJumpyBoots(player)) {
|
||||
return;
|
||||
}
|
||||
if (!JumpyBootsClientHandler.isCharging()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int width = mc.getWindow().getGuiScaledWidth();
|
||||
int height = mc.getWindow().getGuiScaledHeight();
|
||||
int x0 = width / 2 - BAR_WIDTH / 2;
|
||||
int y0 = height - 29;
|
||||
|
||||
guiGraphics.blit(JUMP_BAR_BACKGROUND, x0, y0, 0, 0, BAR_WIDTH, BAR_HEIGHT, BAR_WIDTH, BAR_HEIGHT);
|
||||
|
||||
int chargeTicks = JumpyBootsClientHandler.getChargeTicks();
|
||||
float chargeRatio = Mth.clamp(chargeTicks / (float) JumpyBootsHelper.CHARGE_TICKS_MAX, 0.0F, 1.0F);
|
||||
int filledWidth = Mth.clamp((int) (chargeRatio * BAR_WIDTH), 0, BAR_WIDTH);
|
||||
if (filledWidth > 0) {
|
||||
guiGraphics.setColor(1.0F, 1.0F, 1.0F, 0.35F + chargeRatio * 0.65F);
|
||||
guiGraphics.blit(JUMP_BAR_PROGRESS, x0, y0, 0, 0, filledWidth, BAR_HEIGHT, BAR_WIDTH, BAR_HEIGHT);
|
||||
guiGraphics.setColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
package com.craisinlord.antarchy.fabric.client;
|
||||
|
||||
import com.mojang.blaze3d.platform.InputConstants;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import net.minecraft.client.KeyMapping;
|
||||
|
||||
public final class KeybindingConflictFixStore {
|
||||
private static final Map<InputConstants.Key, List<KeyMapping>> MAPPINGS = new HashMap<>();
|
||||
|
||||
private KeybindingConflictFixStore() {
|
||||
}
|
||||
|
||||
public static void add(InputConstants.Key key, KeyMapping mapping) {
|
||||
List<KeyMapping> mappings = MAPPINGS.computeIfAbsent(key, ignored -> new ArrayList<>());
|
||||
if (!mappings.contains(mapping)) {
|
||||
mappings.add(mapping);
|
||||
}
|
||||
}
|
||||
|
||||
public static void clear() {
|
||||
MAPPINGS.clear();
|
||||
}
|
||||
|
||||
public static List<KeyMapping> others(InputConstants.Key key, KeyMapping active) {
|
||||
List<KeyMapping> mappings = MAPPINGS.get(key);
|
||||
if (mappings == null || mappings.size() < 2) {
|
||||
return List.of();
|
||||
}
|
||||
List<KeyMapping> others = new ArrayList<>(mappings.size() - 1);
|
||||
for (KeyMapping mapping : mappings) {
|
||||
if (mapping != active) {
|
||||
others.add(mapping);
|
||||
}
|
||||
}
|
||||
return others;
|
||||
}
|
||||
}
|
||||
+227
@@ -0,0 +1,227 @@
|
||||
package com.craisinlord.antarchy.fabric.client;
|
||||
import com.craisinlord.antarchy.fabric.registry.AntarchyFabricSounds;
|
||||
|
||||
import com.craisinlord.antarchy.content.entity.lucid.LucidEntity;
|
||||
import com.craisinlord.antarchy.fabric.AntarchyFabricContent;
|
||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screens.DeathScreen;
|
||||
import net.minecraft.client.resources.sounds.AbstractTickableSoundInstance;
|
||||
import net.minecraft.client.resources.sounds.SoundInstance;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
public final class LucidSoundHandler {
|
||||
private static final double START_SCAN_RADIUS = 96.0D;
|
||||
private static final int ANIM_ATTACK = 2;
|
||||
private static final int ANIM_DEATH = 3;
|
||||
private static final Map<UUID, LucidLoopSet> ACTIVE_LOOPS = new HashMap<>();
|
||||
|
||||
private LucidSoundHandler() {
|
||||
}
|
||||
|
||||
public static void register() {
|
||||
ClientTickEvents.END_CLIENT_TICK.register(client -> {
|
||||
if (client.level == null || client.player == null || client.isPaused()) {
|
||||
resetAll(client);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!client.player.isAlive() || client.player.isRemoved() || client.player.isDeadOrDying()
|
||||
|| client.screen instanceof DeathScreen) {
|
||||
resetAll(client);
|
||||
return;
|
||||
}
|
||||
|
||||
pruneStaleLoops(client);
|
||||
refreshNearbyLucids(client);
|
||||
});
|
||||
}
|
||||
|
||||
private static void refreshNearbyLucids(Minecraft mc) {
|
||||
List<LucidEntity> lucids = mc.level.getEntitiesOfClass(
|
||||
LucidEntity.class,
|
||||
mc.player.getBoundingBox().inflate(START_SCAN_RADIUS)
|
||||
);
|
||||
|
||||
for (LucidEntity lucid : lucids) {
|
||||
if (!lucid.shouldPlayAmbientLoop()) continue;
|
||||
|
||||
LucidLoopSet set = ACTIVE_LOOPS.get(lucid.getUUID());
|
||||
if (set == null) {
|
||||
set = new LucidLoopSet(lucid);
|
||||
ACTIVE_LOOPS.put(lucid.getUUID(), set);
|
||||
set.start(mc);
|
||||
} else {
|
||||
set.refresh(mc, lucid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void pruneStaleLoops(Minecraft mc) {
|
||||
Iterator<Map.Entry<UUID, LucidLoopSet>> iterator = ACTIVE_LOOPS.entrySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
LucidLoopSet set = iterator.next().getValue();
|
||||
if (!set.isValid()) {
|
||||
set.stop(mc);
|
||||
iterator.remove();
|
||||
} else if (!set.entity.shouldPlayAmbientLoop()) {
|
||||
set.stop(mc);
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void resetAll(Minecraft mc) {
|
||||
for (LucidLoopSet set : ACTIVE_LOOPS.values()) {
|
||||
set.stop(mc);
|
||||
}
|
||||
ACTIVE_LOOPS.clear();
|
||||
}
|
||||
|
||||
private static final class LucidLoopSet {
|
||||
private LucidEntity entity;
|
||||
@Nullable private LucidLoopSound ambient;
|
||||
@Nullable private LucidLoopSound flying;
|
||||
private int lastAnimationState = -1;
|
||||
|
||||
private LucidLoopSet(LucidEntity entity) {
|
||||
this.entity = entity;
|
||||
}
|
||||
|
||||
private boolean isValid() {
|
||||
return entity != null && entity.isAlive() && !entity.isRemoved();
|
||||
}
|
||||
|
||||
private void start(Minecraft mc) {
|
||||
playAttackSoundIfNeeded(mc, entity);
|
||||
|
||||
if (ambient == null || !mc.getSoundManager().isActive(ambient)) {
|
||||
ambient = new LucidLoopSound(entity, AntarchyFabricSounds.LUCID_AMBIENT.get(),
|
||||
SoundSource.HOSTILE, 0.14F, 0.97F, true);
|
||||
mc.getSoundManager().play(ambient);
|
||||
}
|
||||
|
||||
if (entity.shouldPlayFlyingLoop() && (flying == null || !mc.getSoundManager().isActive(flying))) {
|
||||
flying = new LucidLoopSound(entity, AntarchyFabricSounds.LUCID_FLYING.get(),
|
||||
SoundSource.HOSTILE, 0.18F, 1.0F, false);
|
||||
mc.getSoundManager().play(flying);
|
||||
}
|
||||
}
|
||||
|
||||
private void refresh(Minecraft mc, LucidEntity entity) {
|
||||
this.entity = entity;
|
||||
playAttackSoundIfNeeded(mc, entity);
|
||||
|
||||
if (ambient == null || !mc.getSoundManager().isActive(ambient)) {
|
||||
ambient = new LucidLoopSound(entity, AntarchyFabricSounds.LUCID_AMBIENT.get(),
|
||||
SoundSource.HOSTILE, 0.14F, 0.97F, true);
|
||||
mc.getSoundManager().play(ambient);
|
||||
} else {
|
||||
ambient.setEntity(entity);
|
||||
}
|
||||
|
||||
if (entity.shouldPlayFlyingLoop()) {
|
||||
if (flying == null || !mc.getSoundManager().isActive(flying)) {
|
||||
flying = new LucidLoopSound(entity, AntarchyFabricSounds.LUCID_FLYING.get(),
|
||||
SoundSource.HOSTILE, 0.18F, 1.0F, false);
|
||||
mc.getSoundManager().play(flying);
|
||||
} else {
|
||||
flying.setEntity(entity);
|
||||
}
|
||||
} else if (flying != null) {
|
||||
mc.getSoundManager().stop(flying);
|
||||
flying = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void stop(Minecraft mc) {
|
||||
if (ambient != null) { mc.getSoundManager().stop(ambient); ambient = null; }
|
||||
if (flying != null) { mc.getSoundManager().stop(flying); flying = null; }
|
||||
lastAnimationState = -1;
|
||||
}
|
||||
|
||||
private void playAttackSoundIfNeeded(Minecraft mc, LucidEntity entity) {
|
||||
int currentState = entity.getAnimationState();
|
||||
if (currentState == ANIM_ATTACK && lastAnimationState != ANIM_ATTACK) {
|
||||
mc.getSoundManager().play(new LucidOneShotSound(entity, AntarchyFabricSounds.LUCID_ATTACK.get(),
|
||||
SoundSource.HOSTILE, 1.0F, 1.02F + entity.getRandom().nextFloat() * 0.08F));
|
||||
}
|
||||
lastAnimationState = currentState;
|
||||
}
|
||||
}
|
||||
|
||||
private static final class LucidLoopSound extends AbstractTickableSoundInstance {
|
||||
private LucidEntity entity;
|
||||
private final boolean ambient;
|
||||
|
||||
private LucidLoopSound(LucidEntity entity, SoundEvent soundEvent, SoundSource source,
|
||||
float volume, float pitch, boolean ambient) {
|
||||
super(soundEvent, source, RandomSource.create());
|
||||
this.entity = entity;
|
||||
this.ambient = ambient;
|
||||
this.looping = true;
|
||||
this.delay = 0;
|
||||
this.relative = false;
|
||||
this.attenuation = SoundInstance.Attenuation.LINEAR;
|
||||
this.volume = volume;
|
||||
this.pitch = pitch;
|
||||
this.x = entity.getX();
|
||||
this.y = entity.getY();
|
||||
this.z = entity.getZ();
|
||||
}
|
||||
|
||||
private void setEntity(LucidEntity entity) { this.entity = entity; }
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
if (entity == null || entity.isRemoved() || entity.isDeadOrDying()
|
||||
|| entity.getAnimationState() == ANIM_DEATH || !entity.shouldPlayAmbientLoop()) {
|
||||
stop();
|
||||
return;
|
||||
}
|
||||
if (!ambient && !entity.shouldPlayFlyingLoop()) { stop(); return; }
|
||||
x = entity.getX(); y = entity.getY(); z = entity.getZ();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canStartSilent() { return true; }
|
||||
}
|
||||
|
||||
private static final class LucidOneShotSound extends AbstractTickableSoundInstance {
|
||||
private final LucidEntity entity;
|
||||
|
||||
private LucidOneShotSound(LucidEntity entity, SoundEvent soundEvent, SoundSource source,
|
||||
float volume, float pitch) {
|
||||
super(soundEvent, source, RandomSource.create());
|
||||
this.entity = entity;
|
||||
this.looping = false;
|
||||
this.delay = 0;
|
||||
this.relative = false;
|
||||
this.attenuation = SoundInstance.Attenuation.LINEAR;
|
||||
this.volume = volume;
|
||||
this.pitch = pitch;
|
||||
this.x = entity.getX();
|
||||
this.y = entity.getY();
|
||||
this.z = entity.getZ();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
if (entity == null || entity.isRemoved() || entity.isDeadOrDying()
|
||||
|| entity.getAnimationState() == ANIM_DEATH) {
|
||||
stop();
|
||||
return;
|
||||
}
|
||||
x = entity.getX(); y = entity.getY(); z = entity.getZ();
|
||||
}
|
||||
}
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
package com.craisinlord.antarchy.fabric.client;
|
||||
|
||||
import com.craisinlord.antarchy.content.item.MogglesCaveDetector;
|
||||
import com.craisinlord.antarchy.content.item.MogglesLogic;
|
||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
public final class MogglesClientRenderer {
|
||||
private MogglesClientRenderer() {}
|
||||
|
||||
public static void register() {
|
||||
ClientTickEvents.END_CLIENT_TICK.register(client -> {
|
||||
Player player = client.player;
|
||||
Level level = client.level;
|
||||
if (player == null || level == null) return;
|
||||
|
||||
if (!MogglesLogic.isWearingMoggles(player) || level.canSeeSky(player.blockPosition())) {
|
||||
MogglesCaveDetector.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
MogglesCaveDetector.tick(player, level);
|
||||
|
||||
BlockPos target = MogglesCaveDetector.getCaveTarget();
|
||||
if (target == null) return;
|
||||
|
||||
if (level.getGameTime() % 2 != 0) return;
|
||||
|
||||
Vec3 eye = player.getEyePosition();
|
||||
Vec3 end = Vec3.atCenterOf(target);
|
||||
double totalDist = eye.distanceTo(end);
|
||||
if (totalDist < 1.5) return;
|
||||
|
||||
Vec3 dir = end.subtract(eye).normalize();
|
||||
|
||||
int steps = Math.min(5, (int) (totalDist / 1.5));
|
||||
double spacing = (totalDist - 1.5) / Math.max(steps, 1);
|
||||
|
||||
for (int i = 0; i < steps; i++) {
|
||||
double t = 1.5 + i * spacing;
|
||||
Vec3 p = eye.add(dir.scale(t));
|
||||
Vec3 vel = dir.scale(0.04);
|
||||
level.addParticle(ParticleTypes.END_ROD,
|
||||
p.x, p.y, p.z,
|
||||
vel.x, vel.y, vel.z);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
package com.craisinlord.antarchy.fabric.client;
|
||||
import com.craisinlord.antarchy.fabric.registry.AntarchyFabricMisc;
|
||||
|
||||
import com.craisinlord.antarchy.fabric.AntarchyFabricContent;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.client.player.LocalPlayer;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.core.particles.BlockParticleOption;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
public final class ParalyzedClientHandler {
|
||||
private static final net.minecraft.world.effect.MobEffect PARALYZED_EFFECT = AntarchyFabricMisc.PARALYZED.get();
|
||||
|
||||
|
||||
private static final int PARTICLE_INTERVAL = 3;
|
||||
|
||||
private static final int PARTICLES_PER_ENTITY = 4;
|
||||
|
||||
private static final double PARTICLE_RADIUS = 24.0;
|
||||
|
||||
private ParalyzedClientHandler() {
|
||||
}
|
||||
|
||||
|
||||
public static void clampPlayerInput(LocalPlayer player) {
|
||||
if (!player.hasEffect(PARALYZED_EFFECT)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var input = player.input;
|
||||
input.left = false;
|
||||
input.right = false;
|
||||
input.up = false;
|
||||
input.down = false;
|
||||
input.leftImpulse = 0.0F;
|
||||
input.forwardImpulse = 0.0F;
|
||||
input.jumping = false;
|
||||
}
|
||||
|
||||
public static void tick() {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
if (mc.player == null || mc.level == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
LocalPlayer player = mc.player;
|
||||
if (player.hasEffect(PARALYZED_EFFECT)) {
|
||||
while (mc.options.keyAttack.consumeClick()) { }
|
||||
while (mc.options.keyUse.consumeClick()) { }
|
||||
}
|
||||
if (player.tickCount % PARTICLE_INTERVAL != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
ClientLevel level = mc.level;
|
||||
level.getEntitiesOfClass(
|
||||
LivingEntity.class,
|
||||
player.getBoundingBox().inflate(PARTICLE_RADIUS),
|
||||
entity -> entity != player
|
||||
&& entity.isAlive()
|
||||
&& entity.hasEffect(PARALYZED_EFFECT)
|
||||
).forEach(entity -> spawnStoneParticles(level, entity));
|
||||
}
|
||||
|
||||
private static void spawnStoneParticles(ClientLevel level, LivingEntity entity) {
|
||||
BlockState stone = Blocks.STONE.defaultBlockState();
|
||||
BlockParticleOption particle = new BlockParticleOption(ParticleTypes.BLOCK, stone);
|
||||
|
||||
float w = entity.getBbWidth();
|
||||
float h = entity.getBbHeight();
|
||||
|
||||
for (int i = 0; i < PARTICLES_PER_ENTITY; i++) {
|
||||
double px = entity.getX() + (Math.random() - 0.5) * w;
|
||||
double py = entity.getY() + Math.random() * h;
|
||||
double pz = entity.getZ() + (Math.random() - 0.5) * w;
|
||||
|
||||
double vx = (Math.random() - 0.5) * 0.08;
|
||||
double vy = Math.random() * 0.06;
|
||||
double vz = (Math.random() - 0.5) * 0.08;
|
||||
|
||||
level.addParticle(particle, px, py, pz, vx, vy, vz);
|
||||
}
|
||||
}
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
package com.craisinlord.antarchy.fabric.client;
|
||||
import com.craisinlord.antarchy.fabric.registry.AntarchyFabricMisc;
|
||||
|
||||
import com.craisinlord.antarchy.fabric.AntarchyFabricContent;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.effect.MobEffect;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
|
||||
public final class ParalyzedHudRenderer {
|
||||
private static final MobEffect PARALYZED_EFFECT = AntarchyFabricMisc.PARALYZED.get();
|
||||
|
||||
private ParalyzedHudRenderer() {
|
||||
}
|
||||
|
||||
public static void render(GuiGraphics guiGraphics) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
Player player = mc.player;
|
||||
if (player == null || player.isDeadOrDying()) {
|
||||
return;
|
||||
}
|
||||
|
||||
MobEffectInstance effect = player.getEffect(PARALYZED_EFFECT);
|
||||
if (effect == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
int duration = effect.getDuration();
|
||||
float fade = effect.isInfiniteDuration()
|
||||
? 1.0F
|
||||
: Math.min(1.0F, Math.max(duration, 20) / 20.0F);
|
||||
float pulse = 0.85F + 0.15F * Mth.sin(player.tickCount * ((float) Math.PI * 2.0F / 120.0F));
|
||||
|
||||
int alpha = Mth.clamp((int) (fade * pulse * 0xC0), 0, 0xFF);
|
||||
|
||||
int width = mc.getWindow().getGuiScaledWidth();
|
||||
int height = mc.getWindow().getGuiScaledHeight();
|
||||
int color = (alpha << 24) | 0x303030;
|
||||
guiGraphics.fill(0, 0, width, height, color);
|
||||
int innerAlpha = Mth.clamp(alpha / 3, 0, 0xFF);
|
||||
int innerColor = (innerAlpha << 24) | 0x606060;
|
||||
int margin = Math.min(width, height) / 6;
|
||||
guiGraphics.fill(margin, margin, width - margin, height - margin, innerColor);
|
||||
}
|
||||
}
|
||||
+253
@@ -0,0 +1,253 @@
|
||||
package com.craisinlord.antarchy.fabric.client;
|
||||
|
||||
import com.craisinlord.antarchy.content.entity.ReverieEntity;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.BufferBuilder;
|
||||
import com.mojang.blaze3d.vertex.BufferUploader;
|
||||
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
|
||||
import com.mojang.blaze3d.vertex.Tesselator;
|
||||
import com.mojang.blaze3d.vertex.VertexFormat;
|
||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents;
|
||||
import net.minecraft.client.Camera;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import org.joml.Matrix4f;
|
||||
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public final class ReverieTrailHandler {
|
||||
|
||||
private static final int MAX_TRAIL_POINTS = 20;
|
||||
private static final int IDLE_LIFETIME_TICKS = 8;
|
||||
private static final int NORMAL_LIFETIME_TICKS = 14;
|
||||
private static final int DASH_LIFETIME_TICKS = 22;
|
||||
private static final float CORE_LINE_WIDTH = 0.035f;
|
||||
private static final float GLOW_LINE_WIDTH = 0.10f;
|
||||
private static final double MIN_DISTANCE_BETWEEN_POINTS = 0.05;
|
||||
private static final double DASH_DISTANCE_THRESHOLD = 0.35;
|
||||
|
||||
private static final Map<Integer, ArrayDeque<TrailPoint>> TRAILS = new HashMap<>();
|
||||
|
||||
private ReverieTrailHandler() {}
|
||||
|
||||
private static final class TrailPoint {
|
||||
final Vec3 pos;
|
||||
final ReverieEntity.Mood mood;
|
||||
int age;
|
||||
final int lifetime;
|
||||
|
||||
TrailPoint(Vec3 pos, ReverieEntity.Mood mood, int lifetime) {
|
||||
this.pos = pos;
|
||||
this.mood = mood;
|
||||
this.age = 0;
|
||||
this.lifetime = lifetime;
|
||||
}
|
||||
|
||||
float progress() { return lifetime <= 0 ? 1f : (float) age / (float) lifetime; }
|
||||
boolean expired() { return age >= lifetime; }
|
||||
}
|
||||
|
||||
public static void register() {
|
||||
ClientTickEvents.END_CLIENT_TICK.register(client -> {
|
||||
if (client.level == null) { TRAILS.clear(); return; }
|
||||
if (client.isPaused()) return;
|
||||
|
||||
Set<Integer> activeIds = new HashSet<>();
|
||||
|
||||
for (Entity entity : client.level.entitiesForRendering()) {
|
||||
if (!(entity instanceof ReverieEntity reverie)) continue;
|
||||
|
||||
int id = reverie.getId();
|
||||
activeIds.add(id);
|
||||
ReverieEntity.Mood mood = reverie.getMood();
|
||||
Vec3 pos = reverie.position().add(0.0, reverie.getBbHeight() * 0.5, 0.0);
|
||||
|
||||
ArrayDeque<TrailPoint> points = TRAILS.computeIfAbsent(id, k -> new ArrayDeque<>());
|
||||
|
||||
if (points.isEmpty()) {
|
||||
points.addFirst(new TrailPoint(pos, mood, lifetimeFor(mood, false)));
|
||||
} else {
|
||||
Vec3 lastPos = points.peekFirst().pos;
|
||||
double distSq = pos.distanceToSqr(lastPos);
|
||||
if (distSq >= MIN_DISTANCE_BETWEEN_POINTS * MIN_DISTANCE_BETWEEN_POINTS) {
|
||||
boolean isDash = distSq >= DASH_DISTANCE_THRESHOLD * DASH_DISTANCE_THRESHOLD;
|
||||
points.addFirst(new TrailPoint(pos, mood, lifetimeFor(mood, isDash)));
|
||||
while (points.size() > MAX_TRAIL_POINTS) points.pollLast();
|
||||
}
|
||||
}
|
||||
|
||||
Iterator<TrailPoint> it = points.iterator();
|
||||
while (it.hasNext()) {
|
||||
TrailPoint p = it.next();
|
||||
p.age++;
|
||||
if (p.expired()) it.remove();
|
||||
}
|
||||
}
|
||||
|
||||
TRAILS.keySet().removeIf(id -> !activeIds.contains(id));
|
||||
});
|
||||
|
||||
WorldRenderEvents.AFTER_TRANSLUCENT.register(context -> {
|
||||
if (TRAILS.isEmpty()) return;
|
||||
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
if (mc.level == null) return;
|
||||
|
||||
Camera camera = context.camera();
|
||||
Vec3 camPos = camera.getPosition();
|
||||
Matrix4f mat = context.matrixStack().last().pose();
|
||||
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.defaultBlendFunc();
|
||||
RenderSystem.depthMask(false);
|
||||
RenderSystem.disableCull();
|
||||
RenderSystem.setShader(GameRenderer::getPositionColorShader);
|
||||
|
||||
Tesselator tesselator = Tesselator.getInstance();
|
||||
|
||||
List<List<TrailPoint>> snapshots = new ArrayList<>(TRAILS.size());
|
||||
for (ArrayDeque<TrailPoint> deque : TRAILS.values()) {
|
||||
if (deque.size() >= 2) snapshots.add(new ArrayList<>(deque));
|
||||
}
|
||||
|
||||
if (!snapshots.isEmpty()) {
|
||||
BufferBuilder glowBuf = tesselator.getBuilder();
|
||||
glowBuf.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR);
|
||||
for (List<TrailPoint> points : snapshots) buildPass(glowBuf, mat, points, camPos, true);
|
||||
BufferUploader.drawWithShader(glowBuf.end());
|
||||
|
||||
BufferBuilder coreBuf = tesselator.getBuilder();
|
||||
coreBuf.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR);
|
||||
for (List<TrailPoint> points : snapshots) buildPass(coreBuf, mat, points, camPos, false);
|
||||
BufferUploader.drawWithShader(coreBuf.end());
|
||||
}
|
||||
|
||||
RenderSystem.enableCull();
|
||||
RenderSystem.depthMask(true);
|
||||
RenderSystem.disableBlend();
|
||||
});
|
||||
}
|
||||
|
||||
private static int lifetimeFor(ReverieEntity.Mood mood, boolean isDash) {
|
||||
if (isDash || mood == ReverieEntity.Mood.PURPLE) return DASH_LIFETIME_TICKS;
|
||||
if (mood == ReverieEntity.Mood.WHITE) return IDLE_LIFETIME_TICKS;
|
||||
return NORMAL_LIFETIME_TICKS;
|
||||
}
|
||||
|
||||
private static void buildPass(BufferBuilder buf, Matrix4f mat, List<TrailPoint> points, Vec3 camPos, boolean glow) {
|
||||
int n = points.size();
|
||||
for (int i = 0; i < n - 1; i++) {
|
||||
TrailPoint newer = points.get(i);
|
||||
TrailPoint older = points.get(i + 1);
|
||||
|
||||
float alphaNearer = (glow ? glowAlpha(newer.mood) : coreAlpha(newer.mood)) * indexAlpha(i, n) * (1f - newer.progress());
|
||||
float alphaFarther = (glow ? glowAlpha(older.mood) : coreAlpha(older.mood)) * indexAlpha(i + 1, n) * (1f - older.progress());
|
||||
if (alphaNearer < 0.005f && alphaFarther < 0.005f) continue;
|
||||
|
||||
Vec3 right = cameraFacingRight(newer.pos, older.pos, camPos);
|
||||
if (right == null) continue;
|
||||
|
||||
float halfWidth = glow ? glowHalfWidth(newer.mood) : coreHalfWidth(newer.mood);
|
||||
right = right.scale(halfWidth);
|
||||
|
||||
float[] cn = color(newer.mood);
|
||||
float[] co = color(older.mood);
|
||||
Vec3 na = newer.pos.subtract(camPos);
|
||||
Vec3 nb = older.pos.subtract(camPos);
|
||||
|
||||
buf.vertex(mat, (float)(na.x + right.x), (float)(na.y + right.y), (float)(na.z + right.z)).color(cn[0], cn[1], cn[2], alphaNearer).endVertex();
|
||||
buf.vertex(mat, (float)(na.x - right.x), (float)(na.y - right.y), (float)(na.z - right.z)).color(cn[0], cn[1], cn[2], alphaNearer).endVertex();
|
||||
buf.vertex(mat, (float)(nb.x - right.x), (float)(nb.y - right.y), (float)(nb.z - right.z)).color(co[0], co[1], co[2], alphaFarther).endVertex();
|
||||
buf.vertex(mat, (float)(nb.x + right.x), (float)(nb.y + right.y), (float)(nb.z + right.z)).color(co[0], co[1], co[2], alphaFarther).endVertex();
|
||||
}
|
||||
}
|
||||
|
||||
private static Vec3 cameraFacingRight(Vec3 a, Vec3 b, Vec3 camPos) {
|
||||
Vec3 segDir = b.subtract(a);
|
||||
if (segDir.lengthSqr() < 1e-12) return null;
|
||||
segDir = segDir.normalize();
|
||||
Vec3 mid = a.add(b).scale(0.5);
|
||||
Vec3 toCamera = camPos.subtract(mid);
|
||||
if (toCamera.lengthSqr() < 1e-12) return null;
|
||||
toCamera = toCamera.normalize();
|
||||
Vec3 right = segDir.cross(toCamera);
|
||||
if (right.lengthSqr() < 1e-10) {
|
||||
right = segDir.cross(new Vec3(0.0, 1.0, 0.0));
|
||||
if (right.lengthSqr() < 1e-10) return null;
|
||||
}
|
||||
return right.normalize();
|
||||
}
|
||||
|
||||
private static float indexAlpha(int i, int n) {
|
||||
if (n <= 1) return 1f;
|
||||
return 1f - (float) i / (float) (n - 1);
|
||||
}
|
||||
|
||||
private static final float[] COLOR_WHITE = { 1.0f, 1.0f, 1.0f };
|
||||
private static final float[] COLOR_YELLOW = { 1.0f, 0.85f, 0.1f };
|
||||
private static final float[] COLOR_RED = { 1.0f, 0.1f, 0.05f };
|
||||
private static final float[] COLOR_PURPLE = { 0.7f, 0.1f, 1.0f };
|
||||
private static final float[] COLOR_BLUE = { 0.1f, 0.5f, 1.0f };
|
||||
|
||||
private static float[] color(ReverieEntity.Mood mood) {
|
||||
return switch (mood) {
|
||||
case WHITE -> COLOR_WHITE;
|
||||
case YELLOW -> COLOR_YELLOW;
|
||||
case RED -> COLOR_RED;
|
||||
case PURPLE -> COLOR_PURPLE;
|
||||
case BLUE -> COLOR_BLUE;
|
||||
};
|
||||
}
|
||||
|
||||
private static float glowAlpha(ReverieEntity.Mood mood) {
|
||||
return switch (mood) {
|
||||
case WHITE -> 0.15f;
|
||||
case YELLOW -> 0.30f;
|
||||
case RED -> 0.55f;
|
||||
case PURPLE -> 0.65f;
|
||||
case BLUE -> 0.35f;
|
||||
};
|
||||
}
|
||||
|
||||
private static float coreAlpha(ReverieEntity.Mood mood) {
|
||||
return switch (mood) {
|
||||
case WHITE -> 0.35f;
|
||||
case YELLOW -> 0.55f;
|
||||
case RED -> 0.85f;
|
||||
case PURPLE -> 0.95f;
|
||||
case BLUE -> 0.60f;
|
||||
};
|
||||
}
|
||||
|
||||
private static float glowHalfWidth(ReverieEntity.Mood mood) {
|
||||
float base = GLOW_LINE_WIDTH * 0.5f;
|
||||
return switch (mood) {
|
||||
case WHITE -> base * 0.60f;
|
||||
case YELLOW -> base * 0.80f;
|
||||
case RED -> base * 1.00f;
|
||||
case PURPLE -> base * 1.25f;
|
||||
case BLUE -> base * 0.90f;
|
||||
};
|
||||
}
|
||||
|
||||
private static float coreHalfWidth(ReverieEntity.Mood mood) {
|
||||
float base = CORE_LINE_WIDTH * 0.5f;
|
||||
return switch (mood) {
|
||||
case WHITE -> base * 0.60f;
|
||||
case YELLOW -> base * 0.80f;
|
||||
case RED -> base * 1.20f;
|
||||
case PURPLE -> base * 1.50f;
|
||||
case BLUE -> base * 1.00f;
|
||||
};
|
||||
}
|
||||
}
|
||||
+141
@@ -0,0 +1,141 @@
|
||||
package com.craisinlord.antarchy.fabric.client;
|
||||
|
||||
import com.craisinlord.antarchy.content.client.ScorpionWhipTetherClientState;
|
||||
import com.craisinlord.antarchy.content.item.ScorpionWhipItem;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.BufferBuilder;
|
||||
import com.mojang.blaze3d.vertex.BufferUploader;
|
||||
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
|
||||
import com.mojang.blaze3d.vertex.Tesselator;
|
||||
import com.mojang.blaze3d.vertex.VertexFormat;
|
||||
import java.util.Map;
|
||||
import net.minecraft.client.Camera;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.HumanoidArm;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext;
|
||||
import org.joml.Matrix4f;
|
||||
|
||||
public final class ScorpionWhipTetherRenderHandler {
|
||||
private ScorpionWhipTetherRenderHandler() {
|
||||
}
|
||||
|
||||
public static void tick() {
|
||||
Minecraft minecraft = Minecraft.getInstance();
|
||||
if (minecraft.level == null) {
|
||||
ScorpionWhipTetherClientState.clear();
|
||||
}
|
||||
}
|
||||
|
||||
public static void render(WorldRenderContext context) {
|
||||
if (context.world() == null || context.matrixStack() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Minecraft minecraft = Minecraft.getInstance();
|
||||
if (minecraft.level == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Map<Integer, Integer> tethers = ScorpionWhipTetherClientState.snapshot();
|
||||
if (tethers.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Camera camera = context.camera();
|
||||
Vec3 cameraPos = camera.getPosition();
|
||||
Matrix4f pose = context.matrixStack().last().pose();
|
||||
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.defaultBlendFunc();
|
||||
RenderSystem.depthMask(false);
|
||||
RenderSystem.disableCull();
|
||||
RenderSystem.setShader(GameRenderer::getPositionColorShader);
|
||||
|
||||
BufferBuilder buffer = Tesselator.getInstance().getBuilder();
|
||||
buffer.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR);
|
||||
for (Map.Entry<Integer, Integer> entry : tethers.entrySet()) {
|
||||
Entity source = minecraft.level.getEntity(entry.getKey());
|
||||
Entity target = minecraft.level.getEntity(entry.getValue());
|
||||
if (!(source instanceof Player player) || target == null || target.isRemoved()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
buildTether(
|
||||
buffer,
|
||||
pose,
|
||||
tetherStart(player, context.tickDelta()),
|
||||
target.position().add(0.0D, target.getBbHeight() * 0.5D, 0.0D),
|
||||
cameraPos
|
||||
);
|
||||
}
|
||||
|
||||
BufferUploader.drawWithShader(buffer.end());
|
||||
|
||||
RenderSystem.enableCull();
|
||||
RenderSystem.depthMask(true);
|
||||
RenderSystem.disableBlend();
|
||||
}
|
||||
|
||||
private static Vec3 tetherStart(Player player, float partialTick) {
|
||||
Vec3 start = player.getEyePosition(partialTick).add(0.0D, -0.45D, 0.0D);
|
||||
boolean mainHandWhip = player.getMainHandItem().getItem() instanceof ScorpionWhipItem;
|
||||
boolean offHandWhip = player.getOffhandItem().getItem() instanceof ScorpionWhipItem;
|
||||
if (!mainHandWhip && !offHandWhip) {
|
||||
return start;
|
||||
}
|
||||
|
||||
boolean useMainHand = mainHandWhip || !offHandWhip;
|
||||
HumanoidArm arm = useMainHand ? player.getMainArm() : player.getMainArm().getOpposite();
|
||||
float bodyYaw = Mth.rotLerp(partialTick, player.yBodyRotO, player.yBodyRot);
|
||||
double radians = Math.toRadians(bodyYaw + 90.0F);
|
||||
double side = arm == HumanoidArm.RIGHT ? -0.28D : 0.28D;
|
||||
return start.add(Math.cos(radians) * side, -0.12D, Math.sin(radians) * side);
|
||||
}
|
||||
|
||||
private static void buildTether(BufferBuilder buffer, Matrix4f pose, Vec3 start, Vec3 end, Vec3 cameraPos) {
|
||||
Vec3 delta = end.subtract(start);
|
||||
double length = delta.length();
|
||||
if (length < 0.001D) {
|
||||
return;
|
||||
}
|
||||
|
||||
Vec3 forward = delta.scale(1.0D / length);
|
||||
Vec3 right = forward.cross(new Vec3(0.0D, 1.0D, 0.0D));
|
||||
if (right.lengthSqr() < 1.0E-6D) {
|
||||
right = forward.cross(new Vec3(1.0D, 0.0D, 0.0D));
|
||||
}
|
||||
right = right.normalize();
|
||||
|
||||
int segments = Math.max(16, Mth.ceil(length * 8.0D));
|
||||
for (int i = 0; i < segments; i++) {
|
||||
double t0 = (double) i / (double) segments;
|
||||
double t1 = (double) (i + 1) / (double) segments;
|
||||
Vec3 p0 = ropePoint(start, delta, t0, length);
|
||||
Vec3 p1 = ropePoint(start, delta, t1, length);
|
||||
float width = 0.045F;
|
||||
Vec3 offset = right.scale(width);
|
||||
|
||||
Vec3 a = p0.subtract(cameraPos);
|
||||
Vec3 b = p1.subtract(cameraPos);
|
||||
float shade = i % 2 == 0 ? 0.82F : 0.62F;
|
||||
float red = 0.36F * shade;
|
||||
float green = 0.20F * shade;
|
||||
float blue = 0.11F * shade;
|
||||
|
||||
buffer.vertex(pose, (float) (a.x + offset.x), (float) (a.y + offset.y), (float) (a.z + offset.z)).color(red, green, blue, 1.0F).endVertex();
|
||||
buffer.vertex(pose, (float) (a.x - offset.x), (float) (a.y - offset.y), (float) (a.z - offset.z)).color(red, green, blue, 1.0F).endVertex();
|
||||
buffer.vertex(pose, (float) (b.x - offset.x), (float) (b.y - offset.y), (float) (b.z - offset.z)).color(red, green, blue, 1.0F).endVertex();
|
||||
buffer.vertex(pose, (float) (b.x + offset.x), (float) (b.y + offset.y), (float) (b.z + offset.z)).color(red, green, blue, 1.0F).endVertex();
|
||||
}
|
||||
}
|
||||
|
||||
private static Vec3 ropePoint(Vec3 start, Vec3 delta, double t, double length) {
|
||||
double sag = Math.sin(t * Math.PI) * Math.min(0.45D, length * 0.07D);
|
||||
return start.add(delta.scale(t)).add(0.0D, -sag, 0.0D);
|
||||
}
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
package com.craisinlord.antarchy.fabric.client;
|
||||
|
||||
import com.craisinlord.antarchy.content.AntarchySoundEvents;
|
||||
import com.craisinlord.antarchy.content.AntarchyObjects;
|
||||
import com.craisinlord.antarchy.fabric.AntarchyFabricContent;
|
||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
|
||||
public final class StinkySoundHandler {
|
||||
private static final int FIRST_SOUND_DELAY = 20;
|
||||
private static final int MIN_INTERVAL = 60;
|
||||
private static final int MAX_INTERVAL = 120;
|
||||
|
||||
private static int nextSoundTick = FIRST_SOUND_DELAY;
|
||||
|
||||
private StinkySoundHandler() {
|
||||
}
|
||||
|
||||
public static void register() {
|
||||
ClientTickEvents.END_CLIENT_TICK.register(client -> {
|
||||
if (client.level == null || client.player == null || client.isPaused()) {
|
||||
nextSoundTick = FIRST_SOUND_DELAY;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!client.player.hasEffect(AntarchyObjects.STINKY_EFFECT.get())) {
|
||||
nextSoundTick = FIRST_SOUND_DELAY;
|
||||
return;
|
||||
}
|
||||
|
||||
nextSoundTick--;
|
||||
if (nextSoundTick > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
client.level.playLocalSound(
|
||||
client.player.getX(),
|
||||
client.player.getY(),
|
||||
client.player.getZ(),
|
||||
AntarchySoundEvents.STINKY_FLY.get(),
|
||||
SoundSource.AMBIENT,
|
||||
0.14F + client.level.random.nextFloat() * 0.06F,
|
||||
0.92F + client.level.random.nextFloat() * 0.16F,
|
||||
false
|
||||
);
|
||||
nextSoundTick = MIN_INTERVAL + client.level.random.nextInt(MAX_INTERVAL - MIN_INTERVAL + 1);
|
||||
});
|
||||
}
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
package com.craisinlord.antarchy.fabric.client;
|
||||
import com.craisinlord.antarchy.fabric.registry.AntarchyFabricBlocks;
|
||||
|
||||
import com.craisinlord.antarchy.fabric.AntarchyFabricContent;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
|
||||
public final class TriffidGooHudRenderer {
|
||||
private TriffidGooHudRenderer() {
|
||||
}
|
||||
|
||||
private static float fadeProgress = 0f;
|
||||
private static final float FADE_SPEED = 0.05f;
|
||||
private static final int MAX_ALPHA = 0x55;
|
||||
|
||||
public static void render(GuiGraphics guiGraphics) {
|
||||
Minecraft minecraft = Minecraft.getInstance();
|
||||
Player player = minecraft.player;
|
||||
if (player == null || player.isDeadOrDying()) {
|
||||
fadeProgress = Math.max(0f, fadeProgress - FADE_SPEED);
|
||||
if (fadeProgress <= 0f) return;
|
||||
} else {
|
||||
Block goo = AntarchyFabricBlocks.TRIFFID_GOO_BLOCK.get();
|
||||
BlockPos feet = player.blockPosition();
|
||||
boolean inGoo = player.level().getBlockState(feet).is(goo)
|
||||
|| player.level().getBlockState(feet.above()).is(goo);
|
||||
|
||||
if (inGoo) {
|
||||
fadeProgress = Math.min(1f, fadeProgress + FADE_SPEED);
|
||||
} else {
|
||||
fadeProgress = Math.max(0f, fadeProgress - FADE_SPEED);
|
||||
}
|
||||
|
||||
if (fadeProgress <= 0f || minecraft.screen != null) return;
|
||||
}
|
||||
|
||||
int alpha = Mth.floor(MAX_ALPHA * fadeProgress);
|
||||
int color = (alpha << 24) | 0x003300;
|
||||
int width = minecraft.getWindow().getGuiScaledWidth();
|
||||
int height = minecraft.getWindow().getGuiScaledHeight();
|
||||
guiGraphics.fill(0, 0, width, height, color);
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package com.craisinlord.antarchy.fabric.client.multipart;
|
||||
|
||||
import com.craisinlord.antarchy.content.entity.multipart.MultipartEntityOwner;
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
|
||||
public final class MultipartClientPartLevelRegistry {
|
||||
private MultipartClientPartLevelRegistry() {
|
||||
}
|
||||
|
||||
public static void register(MultipartEntityOwner owner) {
|
||||
Entity[] parts = owner.antarchy$getMultipartParts();
|
||||
if (parts == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
ClientLevel clientLevel = (ClientLevel) ((Entity) owner).level();
|
||||
for (Entity part : parts) {
|
||||
if (part != null && clientLevel.getEntity(part.getId()) != part) {
|
||||
clientLevel.putNonPlayerEntity(part.getId(), part);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void unregister(MultipartEntityOwner owner) {
|
||||
Entity[] parts = owner.antarchy$getMultipartParts();
|
||||
if (parts == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (Entity part : parts) {
|
||||
if (part != null && !part.isRemoved()) {
|
||||
part.discard();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package com.craisinlord.antarchy.fabric.client.renderer;
|
||||
|
||||
import com.craisinlord.antarchy.fabric.entity.multipart.MultipartPartEntity;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.entity.EntityRenderer;
|
||||
import net.minecraft.client.renderer.entity.EntityRendererProvider;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
||||
public class MultipartPartRenderer extends EntityRenderer<MultipartPartEntity> {
|
||||
private static final ResourceLocation TEXTURE = new ResourceLocation("textures/misc/white.png");
|
||||
|
||||
public MultipartPartRenderer(EntityRendererProvider.Context context) {
|
||||
super(context);
|
||||
this.shadowRadius = 0.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MultipartPartEntity entity, float entityYaw, float partialTick, PoseStack poseStack, MultiBufferSource buffer, int packedLight) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureLocation(MultipartPartEntity entity) {
|
||||
return TEXTURE;
|
||||
}
|
||||
}
|
||||
+445
@@ -0,0 +1,445 @@
|
||||
package com.craisinlord.antarchy.fabric.content.fluid;
|
||||
import com.craisinlord.antarchy.fabric.registry.AntarchyFabricBlocks;
|
||||
import com.craisinlord.antarchy.fabric.registry.AntarchyFabricItems;
|
||||
import com.craisinlord.antarchy.fabric.registry.AntarchyFabricMisc;
|
||||
|
||||
import com.craisinlord.antarchy.fabric.AntarchyFabricContent;
|
||||
import java.util.HashSet;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
import net.minecraft.world.level.LevelReader;
|
||||
import net.minecraft.world.level.block.LiquidBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.material.FlowingFluid;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraft.world.level.material.Fluids;
|
||||
import net.minecraft.tags.FluidTags;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
public abstract class AntiwaterFluid extends FlowingFluid {
|
||||
private static final int MAX_HORIZONTAL_SPREAD_AMOUNT = 5;
|
||||
private static final int MAX_VERTICAL_FLOW_AMOUNT = 7;
|
||||
|
||||
@Override
|
||||
public Fluid getFlowing() {
|
||||
return AntarchyFabricMisc.FLOWING_ANTIWATER.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fluid getSource() {
|
||||
return AntarchyFabricMisc.ANTIWATER.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getBucket() {
|
||||
return AntarchyFabricItems.ANTIWATER_BUCKET.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSame(Fluid fluid) {
|
||||
return fluid == AntarchyFabricMisc.ANTIWATER.get() || fluid == AntarchyFabricMisc.FLOWING_ANTIWATER.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canConvertToSource(Level level) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void beforeDestroyingBlock(LevelAccessor level, BlockPos pos, BlockState state) {
|
||||
net.minecraft.world.level.block.Block.dropResources(state, level, pos, state.hasBlockEntity() ? level.getBlockEntity(pos) : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getSlopeFindDistance(LevelReader level) {
|
||||
return 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getDropOff(LevelReader level) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTickDelay(LevelReader level) {
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getExplosionResistance() {
|
||||
return 100.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockState createLegacyBlock(FluidState state) {
|
||||
return AntarchyFabricBlocks.ANTIWATER_BLOCK.get()
|
||||
.defaultBlockState()
|
||||
.setValue(LiquidBlock.LEVEL, getLegacyLevel(state));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canBeReplacedWith(FluidState state, BlockGetter level, BlockPos pos, Fluid fluid, Direction direction) {
|
||||
return direction != Direction.DOWN && !this.isSame(fluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canSpreadTo(
|
||||
BlockGetter level,
|
||||
BlockPos fromPos,
|
||||
BlockState fromState,
|
||||
Direction direction,
|
||||
BlockPos toPos,
|
||||
BlockState toState,
|
||||
FluidState toFluidState,
|
||||
Fluid fluid
|
||||
) {
|
||||
if (direction == Direction.DOWN) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return super.canSpreadTo(level, fromPos, fromState, direction, toPos, toState, toFluidState, fluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<SoundEvent> getPickupSound() {
|
||||
return Optional.of(SoundEvents.BUCKET_FILL);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getSpreadDelay(Level level, BlockPos pos, FluidState currentState, FluidState newState) {
|
||||
return this.getTickDelay(level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3 getFlow(BlockGetter level, BlockPos pos, FluidState state) {
|
||||
double flowX = 0.0D;
|
||||
double flowZ = 0.0D;
|
||||
|
||||
for (Direction direction : Direction.Plane.HORIZONTAL) {
|
||||
BlockPos neighborPos = pos.relative(direction);
|
||||
FluidState neighborFluid = level.getFluidState(neighborPos);
|
||||
int neighborAmount = this.isSame(neighborFluid.getType()) ? neighborFluid.getAmount() : 0;
|
||||
int currentAmount = state.getAmount();
|
||||
int delta = neighborAmount - currentAmount;
|
||||
if (delta != 0) {
|
||||
flowX += direction.getStepX() * delta;
|
||||
flowZ += direction.getStepZ() * delta;
|
||||
}
|
||||
}
|
||||
|
||||
Vec3 flow = new Vec3(flowX, 1.0D, flowZ);
|
||||
return flow.lengthSqr() < 1.0E-6D ? new Vec3(0.0D, 1.0D, 0.0D) : flow.normalize();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FluidState getNewLiquid(Level level, BlockPos pos, BlockState blockState) {
|
||||
FluidState currentState = blockState.getFluidState();
|
||||
if (!currentState.isSource() && !this.isFlowingStateValid(level, pos, currentState)) {
|
||||
return Fluids.EMPTY.defaultFluidState();
|
||||
}
|
||||
|
||||
if (this.canCreateSourceAt(level, pos)) {
|
||||
return this.getSource(false);
|
||||
}
|
||||
|
||||
if (this.isValidVerticalSupport(level, pos)) {
|
||||
return this.getFlowing(MAX_VERTICAL_FLOW_AMOUNT, false);
|
||||
}
|
||||
|
||||
int bestNeighborAmount = this.getBestHorizontalNeighborAmount(level, pos);
|
||||
if (bestNeighborAmount > 1) {
|
||||
return this.getFlowing(bestNeighborAmount - 1, false);
|
||||
}
|
||||
|
||||
return Fluids.EMPTY.defaultFluidState();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void spread(Level level, BlockPos pos, FluidState state) {
|
||||
if (state.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!state.isSource() && !this.isFlowingStateValid(level, pos, state)) {
|
||||
level.setBlockAndUpdate(pos, net.minecraft.world.level.block.Blocks.AIR.defaultBlockState());
|
||||
this.scheduleCleanup(level, pos);
|
||||
return;
|
||||
}
|
||||
|
||||
BlockState blockState = level.getBlockState(pos);
|
||||
this.spreadUpward(level, pos, state, blockState);
|
||||
|
||||
if (!this.canHangAt(level, pos)) {
|
||||
return;
|
||||
}
|
||||
|
||||
int nextAmount = state.getAmount() - 1;
|
||||
if (nextAmount <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.spreadHorizontally(level, pos, blockState, nextAmount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick(Level level, BlockPos pos, FluidState state) {
|
||||
if (!state.isSource() && !this.isFlowingStateValid(level, pos, state)) {
|
||||
level.setBlockAndUpdate(pos, net.minecraft.world.level.block.Blocks.AIR.defaultBlockState());
|
||||
this.scheduleDependentCleanup(level, pos);
|
||||
return;
|
||||
}
|
||||
|
||||
super.tick(level, pos, state);
|
||||
}
|
||||
|
||||
public static final class Source extends AntiwaterFluid {
|
||||
@Override
|
||||
public int getAmount(FluidState state) {
|
||||
return 8;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSource(FluidState state) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static final class Flowing extends AntiwaterFluid {
|
||||
public Flowing() {
|
||||
this.registerDefaultState(this.getStateDefinition().any().setValue(LEVEL, 7));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createFluidStateDefinition(net.minecraft.world.level.block.state.StateDefinition.Builder<Fluid, FluidState> builder) {
|
||||
super.createFluidStateDefinition(builder);
|
||||
builder.add(LEVEL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAmount(FluidState state) {
|
||||
return state.getValue(LEVEL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSource(FluidState state) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean hasCeiling(Level level, BlockPos pos) {
|
||||
return level.getBlockState(pos.above()).isSolid();
|
||||
}
|
||||
|
||||
private boolean canHangAt(Level level, BlockPos pos) {
|
||||
return this.hasCeiling(level, pos);
|
||||
}
|
||||
|
||||
private boolean hasHorizontalSupport(Level level, BlockPos pos) {
|
||||
FluidState state = level.getFluidState(pos);
|
||||
if (!this.isAntiwater(state)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int currentAmount = state.getAmount();
|
||||
for (Direction direction : Direction.Plane.HORIZONTAL) {
|
||||
FluidState neighbor = level.getFluidState(pos.relative(direction));
|
||||
if (!this.isAntiwater(neighbor)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (this.getHorizontalSpreadAmount(neighbor) > currentAmount) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean canSpreadHorizontallyInto(Level level, BlockPos pos) {
|
||||
return true;
|
||||
}
|
||||
|
||||
private int getBestHorizontalNeighborAmount(Level level, BlockPos pos) {
|
||||
int bestAmount = 0;
|
||||
for (Direction direction : Direction.Plane.HORIZONTAL) {
|
||||
BlockPos neighborPos = pos.relative(direction);
|
||||
FluidState neighborFluid = level.getFluidState(neighborPos);
|
||||
if (neighborFluid.isEmpty() || !neighborFluid.getType().isSame(this)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!this.hasSourceConnection(level, neighborPos, neighborFluid, new HashSet<>())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
bestAmount = Math.max(bestAmount, this.getHorizontalSpreadAmount(neighborFluid));
|
||||
}
|
||||
|
||||
return bestAmount;
|
||||
}
|
||||
|
||||
private int getHorizontalSpreadAmount(FluidState state) {
|
||||
if (state.isSource() || this.isValidVerticalSupportState(state)) {
|
||||
return MAX_HORIZONTAL_SPREAD_AMOUNT + 1;
|
||||
}
|
||||
|
||||
return state.getAmount();
|
||||
}
|
||||
|
||||
private boolean isValidVerticalSupportState(FluidState state) {
|
||||
return this.isAntiwater(state) && !state.isSource() && state.getAmount() >= MAX_VERTICAL_FLOW_AMOUNT;
|
||||
}
|
||||
|
||||
private boolean isFlowingStateValid(Level level, BlockPos pos, FluidState state) {
|
||||
return state.isSource()
|
||||
|| this.hasImmediateVerticalSupport(level, pos)
|
||||
|| this.hasHorizontalSupport(level, pos);
|
||||
}
|
||||
|
||||
private boolean canCreateSourceAt(Level level, BlockPos pos) {
|
||||
if (!this.canHangAt(level, pos)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int sourceNeighbors = 0;
|
||||
for (Direction direction : Direction.Plane.HORIZONTAL) {
|
||||
FluidState neighbor = level.getFluidState(pos.relative(direction));
|
||||
if (this.isAntiwater(neighbor) && neighbor.isSource()) {
|
||||
sourceNeighbors++;
|
||||
if (sourceNeighbors >= 2) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isValidVerticalSupport(Level level, BlockPos pos) {
|
||||
return this.hasImmediateVerticalSupport(level, pos);
|
||||
}
|
||||
|
||||
private boolean isAntiwater(FluidState state) {
|
||||
return !state.isEmpty() && state.getType().isSame(this);
|
||||
}
|
||||
|
||||
private boolean hasImmediateVerticalSupport(Level level, BlockPos pos) {
|
||||
FluidState below = level.getFluidState(pos.below());
|
||||
return this.isAntiwater(below);
|
||||
}
|
||||
|
||||
private void spreadUpward(Level level, BlockPos pos, FluidState state, BlockState blockState) {
|
||||
BlockPos abovePos = pos.above();
|
||||
BlockState aboveState = level.getBlockState(abovePos);
|
||||
FluidState aboveFluid = level.getFluidState(abovePos);
|
||||
|
||||
if (aboveFluid.is(FluidTags.WATER)) {
|
||||
BlockState result = state.isSource()
|
||||
? AntarchyFabricBlocks.ANTIMETAL.get().defaultBlockState()
|
||||
: AntarchyFabricBlocks.NYXITE.get().defaultBlockState();
|
||||
level.setBlockAndUpdate(pos, result);
|
||||
level.levelEvent(1501, pos, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
FluidState upwardState = this.getFlowing(MAX_VERTICAL_FLOW_AMOUNT, false);
|
||||
if (!this.canSpreadTo(level, pos, blockState, Direction.UP, abovePos, aboveState, aboveFluid, upwardState.getType())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (aboveFluid.getType().isSame(this) && aboveFluid.getAmount() >= upwardState.getAmount()) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.spreadTo(level, abovePos, aboveState, Direction.UP, upwardState);
|
||||
}
|
||||
|
||||
private void spreadHorizontally(Level level, BlockPos pos, BlockState blockState, int nextAmount) {
|
||||
FluidState horizontalState = this.getFlowing(Math.min(nextAmount, MAX_HORIZONTAL_SPREAD_AMOUNT), false);
|
||||
|
||||
for (Direction direction : Direction.Plane.HORIZONTAL) {
|
||||
BlockPos targetPos = pos.relative(direction);
|
||||
BlockState targetState = level.getBlockState(targetPos);
|
||||
FluidState targetFluid = targetState.getFluidState();
|
||||
|
||||
if (!this.canSpreadHorizontallyInto(level, targetPos)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (targetFluid.getType().isSame(this) && targetFluid.getAmount() >= horizontalState.getAmount()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!this.canSpreadTo(level, pos, blockState, direction, targetPos, targetState, targetFluid, horizontalState.getType())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
this.spreadTo(level, targetPos, targetState, direction, horizontalState);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean hasSourceConnection(Level level, BlockPos pos, FluidState state, Set<BlockPos> visited) {
|
||||
if (!this.isAntiwater(state)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (state.isSource()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!visited.add(pos)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
FluidState below = level.getFluidState(pos.below());
|
||||
if (this.hasSourceConnection(level, pos.below(), below, visited)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
int currentAmount = state.getAmount();
|
||||
for (Direction direction : Direction.Plane.HORIZONTAL) {
|
||||
BlockPos neighborPos = pos.relative(direction);
|
||||
FluidState neighbor = level.getFluidState(neighborPos);
|
||||
if (!this.isAntiwater(neighbor)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (this.getHorizontalSpreadAmount(neighbor) <= currentAmount) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (this.hasSourceConnection(level, neighborPos, neighbor, visited)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void scheduleCleanup(Level level, BlockPos pos) {
|
||||
int tickDelay = this.getTickDelay(level);
|
||||
level.scheduleTick(pos, this, tickDelay);
|
||||
level.scheduleTick(pos.above(), this, tickDelay);
|
||||
level.scheduleTick(pos.below(), this, tickDelay);
|
||||
for (Direction direction : Direction.Plane.HORIZONTAL) {
|
||||
level.scheduleTick(pos.relative(direction), this, tickDelay);
|
||||
}
|
||||
}
|
||||
|
||||
private void scheduleDependentCleanup(Level level, BlockPos pos) {
|
||||
int tickDelay = this.getTickDelay(level);
|
||||
level.scheduleTick(pos.above(), this, tickDelay);
|
||||
for (Direction direction : Direction.Plane.HORIZONTAL) {
|
||||
level.scheduleTick(pos.relative(direction), this, tickDelay);
|
||||
}
|
||||
}
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package com.craisinlord.antarchy.fabric.content.fluid;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.LiquidBlock;
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.material.FlowingFluid;
|
||||
|
||||
public class AntiwaterLiquidBlock extends LiquidBlock {
|
||||
public AntiwaterLiquidBlock(FlowingFluid fluid, BlockBehaviour.Properties properties) {
|
||||
super(fluid, properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlace(BlockState state, Level level, BlockPos pos, BlockState oldState, boolean movedByPiston) {
|
||||
super.onPlace(state, level, pos, oldState, movedByPiston);
|
||||
scheduleCurrentAntiwaterTick(level, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void neighborChanged(BlockState state, Level level, BlockPos pos, Block neighborBlock, BlockPos neighborPos, boolean movedByPiston) {
|
||||
super.neighborChanged(state, level, pos, neighborBlock, neighborPos, movedByPiston);
|
||||
scheduleCurrentAntiwaterTick(level, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState updateShape(
|
||||
BlockState state,
|
||||
Direction direction,
|
||||
BlockState neighborState,
|
||||
LevelAccessor level,
|
||||
BlockPos pos,
|
||||
BlockPos neighborPos
|
||||
) {
|
||||
scheduleCurrentAntiwaterTick(level, pos);
|
||||
return super.updateShape(state, direction, neighborState, level, pos, neighborPos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemove(BlockState state, Level level, BlockPos pos, BlockState newState, boolean movedByPiston) {
|
||||
if (!state.is(newState.getBlock())) {
|
||||
scheduleDependentAntiwaterTicks(level, pos);
|
||||
}
|
||||
super.onRemove(state, level, pos, newState, movedByPiston);
|
||||
}
|
||||
|
||||
private void scheduleCurrentAntiwaterTick(LevelAccessor level, BlockPos pos) {
|
||||
level.scheduleTick(pos, this.fluid, this.fluid.getTickDelay(level));
|
||||
}
|
||||
|
||||
private void scheduleDependentAntiwaterTicks(LevelAccessor level, BlockPos pos) {
|
||||
level.scheduleTick(pos.above(), this.fluid, this.fluid.getTickDelay(level));
|
||||
for (Direction direction : Direction.Plane.HORIZONTAL) {
|
||||
level.scheduleTick(pos.relative(direction), this.fluid, this.fluid.getTickDelay(level));
|
||||
}
|
||||
}
|
||||
}
|
||||
+171
@@ -0,0 +1,171 @@
|
||||
package com.craisinlord.antarchy.fabric.content.fluid;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.function.Supplier;
|
||||
import com.craisinlord.antarchy.Antarchy;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
import net.minecraft.world.level.LevelReader;
|
||||
import net.minecraft.world.level.block.LiquidBlock;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.material.FlowingFluid;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
|
||||
public abstract class SimpleFluid extends FlowingFluid {
|
||||
private final Supplier<? extends FlowingFluid> source;
|
||||
private final Supplier<? extends FlowingFluid> flowing;
|
||||
private final Supplier<? extends Item> bucket;
|
||||
private final String blockId;
|
||||
private final int slopeFindDistance;
|
||||
private final int dropOff;
|
||||
private final int tickDelay;
|
||||
|
||||
protected SimpleFluid(
|
||||
Supplier<? extends FlowingFluid> source,
|
||||
Supplier<? extends FlowingFluid> flowing,
|
||||
Supplier<? extends Item> bucket,
|
||||
String blockId,
|
||||
int slopeFindDistance,
|
||||
int dropOff,
|
||||
int tickDelay
|
||||
) {
|
||||
this.source = source;
|
||||
this.flowing = flowing;
|
||||
this.bucket = bucket;
|
||||
this.blockId = blockId;
|
||||
this.slopeFindDistance = slopeFindDistance;
|
||||
this.dropOff = dropOff;
|
||||
this.tickDelay = tickDelay;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fluid getFlowing() {
|
||||
return this.flowing.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fluid getSource() {
|
||||
return this.source.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getBucket() {
|
||||
return this.bucket.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canConvertToSource(Level level) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void beforeDestroyingBlock(LevelAccessor level, BlockPos pos, BlockState state) {
|
||||
BlockEntity blockEntity = state.hasBlockEntity() ? level.getBlockEntity(pos) : null;
|
||||
net.minecraft.world.level.block.Block.dropResources(state, level, pos, blockEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getSlopeFindDistance(LevelReader level) {
|
||||
return this.slopeFindDistance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getDropOff(LevelReader level) {
|
||||
return this.dropOff;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTickDelay(LevelReader level) {
|
||||
return this.tickDelay;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getExplosionResistance() {
|
||||
return 100.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSame(Fluid fluid) {
|
||||
return fluid == this.source.get() || fluid == this.flowing.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockState createLegacyBlock(FluidState state) {
|
||||
LiquidBlock block = (LiquidBlock) BuiltInRegistries.BLOCK.get(new ResourceLocation(Antarchy.MODID, this.blockId));
|
||||
return block.defaultBlockState().setValue(LiquidBlock.LEVEL, getLegacyLevel(state));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<SoundEvent> getPickupSound() {
|
||||
return Optional.of(SoundEvents.BUCKET_FILL);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canBeReplacedWith(FluidState state, BlockGetter level, BlockPos pos, Fluid fluid, Direction direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static final class Flowing extends SimpleFluid {
|
||||
public Flowing(
|
||||
Supplier<? extends FlowingFluid> source,
|
||||
Supplier<? extends FlowingFluid> flowing,
|
||||
Supplier<? extends Item> bucket,
|
||||
String blockId,
|
||||
int slopeFindDistance,
|
||||
int dropOff,
|
||||
int tickDelay
|
||||
) {
|
||||
super(source, flowing, bucket, blockId, slopeFindDistance, dropOff, tickDelay);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createFluidStateDefinition(net.minecraft.world.level.block.state.StateDefinition.Builder<Fluid, FluidState> builder) {
|
||||
super.createFluidStateDefinition(builder);
|
||||
builder.add(LEVEL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAmount(FluidState state) {
|
||||
return state.getValue(LEVEL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSource(FluidState state) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static final class Source extends SimpleFluid {
|
||||
public Source(
|
||||
Supplier<? extends FlowingFluid> source,
|
||||
Supplier<? extends FlowingFluid> flowing,
|
||||
Supplier<? extends Item> bucket,
|
||||
String blockId,
|
||||
int slopeFindDistance,
|
||||
int dropOff,
|
||||
int tickDelay
|
||||
) {
|
||||
super(source, flowing, bucket, blockId, slopeFindDistance, dropOff, tickDelay);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAmount(FluidState state) {
|
||||
return 8;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSource(FluidState state) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
package com.craisinlord.antarchy.fabric.entity.multipart;
|
||||
|
||||
import com.craisinlord.antarchy.content.entity.multipart.MultipartPartDefinition;
|
||||
|
||||
public final class FabricKrakenMultipartLayout {
|
||||
private static final MultipartPartDefinition[] PARTS = {
|
||||
new MultipartPartDefinition(
|
||||
"tentacle_mass",
|
||||
14.0F,
|
||||
18.0F,
|
||||
0.90F,
|
||||
12.0D,
|
||||
13.5D,
|
||||
0.00D,
|
||||
true
|
||||
),
|
||||
new MultipartPartDefinition(
|
||||
"head",
|
||||
15.0F,
|
||||
11.5F,
|
||||
1.00F,
|
||||
26.0D,
|
||||
19.0D,
|
||||
0.00D,
|
||||
true
|
||||
),
|
||||
new MultipartPartDefinition(
|
||||
"back_head",
|
||||
13.0F,
|
||||
11.0F,
|
||||
1.10F,
|
||||
38.0D,
|
||||
20.5D,
|
||||
0.00D,
|
||||
true
|
||||
),
|
||||
new MultipartPartDefinition(
|
||||
"mantle",
|
||||
16.0F,
|
||||
14.0F,
|
||||
1.00F,
|
||||
51.0D,
|
||||
23.0D,
|
||||
0.00D,
|
||||
true
|
||||
),
|
||||
new MultipartPartDefinition(
|
||||
"crest",
|
||||
12.0F,
|
||||
10.0F,
|
||||
1.10F,
|
||||
63.0D,
|
||||
28.0D,
|
||||
0.00D,
|
||||
true
|
||||
)
|
||||
};
|
||||
|
||||
private FabricKrakenMultipartLayout() {
|
||||
}
|
||||
|
||||
public static MultipartPartDefinition part(int partIndex) {
|
||||
return PARTS[partIndex];
|
||||
}
|
||||
}
|
||||
+199
@@ -0,0 +1,199 @@
|
||||
package com.craisinlord.antarchy.fabric.entity.multipart;
|
||||
|
||||
import com.craisinlord.antarchy.content.entity.multipart.MultipartEntityOwner;
|
||||
import com.craisinlord.antarchy.content.entity.multipart.MultipartFramework;
|
||||
import com.craisinlord.antarchy.content.entity.multipart.MultipartPartAccess;
|
||||
import com.craisinlord.antarchy.content.entity.multipart.MultipartPartDefinition;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityDimensions;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.Pose;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class MultipartPartEntity extends Entity implements MultipartPartAccess {
|
||||
@Nullable
|
||||
private MultipartEntityOwner owner;
|
||||
private int partIndex;
|
||||
@Nullable
|
||||
private MultipartPartDefinition definition;
|
||||
|
||||
public MultipartPartEntity(EntityType<? extends MultipartPartEntity> entityType, Level level) {
|
||||
super(entityType, level);
|
||||
this.setNoGravity(true);
|
||||
}
|
||||
|
||||
public MultipartPartEntity antarchy$configure(MultipartEntityOwner owner, int partIndex, MultipartPartDefinition definition) {
|
||||
this.owner = owner;
|
||||
this.partIndex = partIndex;
|
||||
this.definition = definition;
|
||||
this.refreshDimensions();
|
||||
this.antarchy$syncFromParent();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Entity antarchy$getMultipartParent() {
|
||||
return this.owner == null ? null : (Entity) this.owner;
|
||||
}
|
||||
|
||||
public int getPartIndex() {
|
||||
return this.partIndex;
|
||||
}
|
||||
|
||||
public String getPartName() {
|
||||
return this.definition == null ? "" : this.definition.name();
|
||||
}
|
||||
|
||||
public float getDamageMultiplier() {
|
||||
return this.definition == null ? 1.0F : this.definition.damageMultiplier();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void antarchy$syncFromParent() {
|
||||
Entity parent = this.antarchy$getMultipartParent();
|
||||
MultipartPartDefinition definition = this.definition;
|
||||
if (parent == null || definition == null || parent.isRemoved()) {
|
||||
return;
|
||||
}
|
||||
|
||||
double oldX = this.getX();
|
||||
double oldY = this.getY();
|
||||
double oldZ = this.getZ();
|
||||
double yawRadians = Math.toRadians(parent.getYRot());
|
||||
Vec3 forward = new Vec3(-Math.sin(yawRadians), 0.0D, Math.cos(yawRadians));
|
||||
Vec3 right = new Vec3(forward.z, 0.0D, -forward.x);
|
||||
Vec3 position = new Vec3(
|
||||
parent.getX() + forward.x * definition.forwardOffset() + right.x * definition.lateralOffset(),
|
||||
parent.getY() + definition.yOffset(),
|
||||
parent.getZ() + forward.z * definition.forwardOffset() + right.z * definition.lateralOffset()
|
||||
);
|
||||
this.setPos(position.x, position.y, position.z);
|
||||
this.setYRot(parent.getYRot());
|
||||
this.setXRot(parent.getXRot());
|
||||
this.xo = oldX;
|
||||
this.yo = oldY;
|
||||
this.zo = oldZ;
|
||||
this.xOld = oldX;
|
||||
this.yOld = oldY;
|
||||
this.zOld = oldZ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean is(Entity entity) {
|
||||
return entity == this || entity == this.antarchy$getMultipartParent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPickable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAttackable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPushable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeCollidedWith() {
|
||||
return !this.isRemoved();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCollideWith(Entity entity) {
|
||||
MultipartPartDefinition definition = this.definition;
|
||||
if (definition == null || !definition.collisionEnabled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Entity parent = this.antarchy$getMultipartParent();
|
||||
if (entity == parent) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (entity instanceof MultipartPartEntity otherPart && otherPart.antarchy$getMultipartParent() == parent) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return entity.canBeCollidedWith() && !this.isPassengerOfSameVehicle(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldBeSaved() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickResult() {
|
||||
Entity parent = this.antarchy$getMultipartParent();
|
||||
return parent == null ? ItemStack.EMPTY : parent.getPickResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hurt(DamageSource source, float amount) {
|
||||
Entity parent = this.antarchy$getMultipartParent();
|
||||
MultipartPartDefinition definition = this.definition;
|
||||
if (parent == null || definition == null || parent.isRemoved()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.level().isClientSide()) {
|
||||
if (source.getEntity() instanceof Player) {
|
||||
MultipartFramework.sendMultipartAttack(parent.getUUID(), this.partIndex, amount * definition.damageMultiplier());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return this.owner != null && this.owner.antarchy$hurtMultipartPart(this, source, amount * definition.damageMultiplier());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInvulnerableTo(DamageSource source) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InteractionResult interactAt(Player player, Vec3 vec, InteractionHand hand) {
|
||||
Entity parent = this.antarchy$getMultipartParent();
|
||||
if (parent == null || parent.isRemoved()) {
|
||||
return InteractionResult.PASS;
|
||||
}
|
||||
|
||||
if (this.level().isClientSide()) {
|
||||
MultipartFramework.sendMultipartInteract(parent.getUUID(), this.partIndex, hand.ordinal());
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
return this.owner == null ? InteractionResult.PASS : this.owner.antarchy$interactMultipartPart(this, player, vec, hand);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityDimensions getDimensions(Pose pose) {
|
||||
MultipartPartDefinition definition = this.definition;
|
||||
return definition == null ? super.getDimensions(pose) : EntityDimensions.scalable(definition.width(), definition.height());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void defineSynchedData() {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void readAdditionalSaveData(CompoundTag tag) {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addAdditionalSaveData(CompoundTag tag) {
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package com.craisinlord.antarchy.fabric.entity.multipart;
|
||||
|
||||
import com.craisinlord.antarchy.content.entity.multipart.MultipartEntityOwner;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
|
||||
public final class MultipartServerPartLevelRegistry {
|
||||
private MultipartServerPartLevelRegistry() {
|
||||
}
|
||||
|
||||
public static void register(MultipartEntityOwner owner) {
|
||||
Entity[] parts = owner.antarchy$getMultipartParts();
|
||||
if (parts == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
ServerLevel serverLevel = (ServerLevel) ((Entity) owner).level();
|
||||
for (Entity part : parts) {
|
||||
if (part != null && serverLevel.getEntity(part.getId()) != part) {
|
||||
serverLevel.addFreshEntity(part);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void unregister(MultipartEntityOwner owner) {
|
||||
Entity[] parts = owner.antarchy$getMultipartParts();
|
||||
if (parts == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (Entity part : parts) {
|
||||
if (part != null && !part.isRemoved()) {
|
||||
part.discard();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package com.craisinlord.antarchy.fabric.item;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.Mob;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.SpawnEggItem;
|
||||
|
||||
public final class DeferredSpawnEggItem extends SpawnEggItem {
|
||||
public DeferredSpawnEggItem(Supplier<? extends EntityType<? extends Mob>> typeSupplier, int backgroundColor, int highlightColor, Item.Properties properties) {
|
||||
super(typeSupplier.get(), backgroundColor, highlightColor, properties);
|
||||
}
|
||||
}
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
package com.craisinlord.antarchy.fabric.mixin;
|
||||
|
||||
import com.craisinlord.antarchy.content.AntarchyObjects;
|
||||
import com.craisinlord.antarchy.content.gravity.AntarchyGravityApi;
|
||||
import com.craisinlord.antarchy.content.gravity.AntarchyGravityDirection;
|
||||
import com.craisinlord.antarchy.content.gravity.AntarchyGravityTransition;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.particles.DustParticleOptions;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import org.joml.Vector3f;
|
||||
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.CallbackInfo;
|
||||
|
||||
@Mixin(LivingEntity.class)
|
||||
public abstract class AntimetalInversionMixin {
|
||||
|
||||
private static final int ANTIMETAL_INVERTED_REFRESH_TICKS = 20;
|
||||
|
||||
@Inject(method = "tick", at = @At("TAIL"))
|
||||
private void antarchy$tickOverheadInversion(CallbackInfo ci) {
|
||||
LivingEntity entity = (LivingEntity) (Object) this;
|
||||
if (entity.level().isClientSide()) return;
|
||||
if (entity instanceof Player player && player.isSpectator()) return;
|
||||
if (!antarchy$isDirectlyBelowAntimetal(entity)) return;
|
||||
|
||||
MobEffectInstance existing = entity.getEffect(AntarchyObjects.INVERTED_EFFECT.get());
|
||||
if (existing == null || existing.getDuration() <= 5) {
|
||||
entity.addEffect(new MobEffectInstance(AntarchyObjects.INVERTED_EFFECT.get(), ANTIMETAL_INVERTED_REFRESH_TICKS, 0, false, false, false));
|
||||
antarchy$spawnInversionParticles(entity);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean antarchy$isDirectlyBelowAntimetal(LivingEntity entity) {
|
||||
AABB bounds = entity.getBoundingBox().deflate(1.0E-3D);
|
||||
int minX = Mth.floor(bounds.minX);
|
||||
int maxX = Mth.floor(bounds.maxX);
|
||||
int minY = Mth.floor(bounds.minY);
|
||||
int maxY = Mth.floor(bounds.maxY);
|
||||
int minZ = Mth.floor(bounds.minZ);
|
||||
int maxZ = Mth.floor(bounds.maxZ);
|
||||
|
||||
for (int x = minX; x <= maxX; x++) {
|
||||
for (int y = minY; y <= maxY; y++) {
|
||||
for (int z = minZ; z <= maxZ; z++) {
|
||||
BlockPos above = new BlockPos(x, y + 1, z);
|
||||
if (entity.level().getBlockState(above).is(AntarchyObjects.ANTIMETAL.get())
|
||||
|| entity.level().getBlockState(above).is(AntarchyObjects.POLISHED_ANTIMETAL.get())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Inject(method = "onEffectRemoved", at = @At("HEAD"))
|
||||
private void antarchy$onInvertedRemoved(MobEffectInstance effectInstance, CallbackInfo ci) {
|
||||
LivingEntity entity = (LivingEntity) (Object) this;
|
||||
if (entity.level().isClientSide()) return;
|
||||
if (effectInstance.getEffect() != AntarchyObjects.INVERTED_EFFECT.get()) return;
|
||||
AntarchyGravityApi.setGravityDirection(entity, AntarchyGravityDirection.DOWN, new AntarchyGravityTransition(12));
|
||||
}
|
||||
|
||||
private static void antarchy$spawnInversionParticles(LivingEntity entity) {
|
||||
if (!(entity.level() instanceof ServerLevel serverLevel)) return;
|
||||
double x = entity.getX();
|
||||
double y = entity.getBoundingBox().maxY + 0.1D;
|
||||
double z = entity.getZ();
|
||||
serverLevel.sendParticles(
|
||||
new DustParticleOptions(new Vector3f(1.0F, 0.1F, 0.1F), 1.0F),
|
||||
x, y, z, 6, 0.2D, 0.05D, 0.2D, 0.0D
|
||||
);
|
||||
}
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
package com.craisinlord.antarchy.fabric.mixin;
|
||||
|
||||
import com.craisinlord.antarchy.content.fluid.AntarchyFluidChecks;
|
||||
import com.craisinlord.antarchy.fabric.util.CustomFluidPhysicsChecks;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.entity.item.ItemEntity;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
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.CallbackInfo;
|
||||
|
||||
@Mixin(ItemEntity.class)
|
||||
public abstract class AntiwaterItemEntityMixin {
|
||||
@Inject(method = "tick", at = @At("TAIL"))
|
||||
private void antarchy$applyAntiwaterItemMovement(CallbackInfo ci) {
|
||||
ItemEntity entity = (ItemEntity) (Object) this;
|
||||
if (!antarchy$isTouchingAntiwater(entity)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Vec3 motion = entity.getDeltaMovement();
|
||||
Vec3 antiwaterFlow = CustomFluidPhysicsChecks.getAntiwaterFlow(entity);
|
||||
Vec3 push = antiwaterFlow.lengthSqr() > 1.0E-6D ? antiwaterFlow.normalize().scale(0.02D) : Vec3.ZERO;
|
||||
entity.setDeltaMovement(
|
||||
motion.x * 0.99D + push.x,
|
||||
motion.y * 0.8D + 0.025D + push.y,
|
||||
motion.z * 0.99D + push.z
|
||||
);
|
||||
}
|
||||
|
||||
private boolean antarchy$isTouchingAntiwater(ItemEntity entity) {
|
||||
BlockPos min = BlockPos.containing(entity.getBoundingBox().minX, entity.getBoundingBox().minY, entity.getBoundingBox().minZ);
|
||||
BlockPos max = BlockPos.containing(entity.getBoundingBox().maxX, entity.getBoundingBox().maxY, entity.getBoundingBox().maxZ);
|
||||
BlockPos.MutableBlockPos cursor = new BlockPos.MutableBlockPos();
|
||||
for (int x = min.getX(); x <= max.getX(); x++) {
|
||||
for (int y = min.getY(); y <= max.getY(); y++) {
|
||||
for (int z = min.getZ(); z <= max.getZ(); z++) {
|
||||
cursor.set(x, y, z);
|
||||
FluidState fluidState = entity.level().getFluidState(cursor);
|
||||
if (AntarchyFluidChecks.isAntiwater(fluidState)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
package com.craisinlord.antarchy.fabric.mixin;
|
||||
|
||||
import com.craisinlord.antarchy.content.AntarchyObjects;
|
||||
import com.craisinlord.antarchy.content.fluid.AntarchyFluidChecks;
|
||||
import com.craisinlord.antarchy.content.gravity.AntarchyGravityApi;
|
||||
import com.craisinlord.antarchy.content.gravity.AntarchyGravityDirection;
|
||||
import com.craisinlord.antarchy.content.gravity.AntarchyGravityRotationUtil;
|
||||
import com.craisinlord.antarchy.fabric.util.CustomFluidPhysicsChecks;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.MoverType;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
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.CallbackInfo;
|
||||
|
||||
@Mixin(LivingEntity.class)
|
||||
public abstract class AntiwaterLivingEntityMixin {
|
||||
@Inject(method = "travel", at = @At("HEAD"), cancellable = true)
|
||||
private void antarchy$moveInAntiwater(Vec3 travelVector, CallbackInfo ci) {
|
||||
LivingEntity entity = (LivingEntity) (Object) this;
|
||||
if (!antarchy$isTouchingAntiwaterLocal(entity)) {
|
||||
return;
|
||||
}
|
||||
|
||||
double prevY = entity.getY();
|
||||
float swimSpeed = entity.isSprinting() ? 0.026F : 0.02F;
|
||||
entity.moveRelative(swimSpeed, travelVector);
|
||||
entity.move(MoverType.SELF, entity.getDeltaMovement());
|
||||
|
||||
Vec3 motion = entity.getDeltaMovement();
|
||||
double verticalInput = travelVector.y;
|
||||
if (verticalInput == 0.0D && entity instanceof Player player) {
|
||||
verticalInput = player.isShiftKeyDown() ? -1.0D : ((LivingEntityJumpingAccessor) entity).antarchy$isJumping() ? 1.0D : 0.0D;
|
||||
}
|
||||
|
||||
if (entity.horizontalCollision && entity.onClimbable()) {
|
||||
motion = new Vec3(motion.x, 0.2D, motion.z);
|
||||
}
|
||||
|
||||
AntarchyGravityDirection gravityDirection = antarchy$getEffectiveGravityDirection(entity);
|
||||
Vec3 worldMotion = gravityDirection.isInverted()
|
||||
? AntarchyGravityRotationUtil.vecPlayerToWorld(motion, gravityDirection)
|
||||
: motion;
|
||||
|
||||
double drag = entity.isSwimming() ? 0.9D : 0.8D;
|
||||
worldMotion = worldMotion.scale(drag);
|
||||
Vec3 antiwaterFlow = CustomFluidPhysicsChecks.getAntiwaterFlow(entity);
|
||||
if (antiwaterFlow.lengthSqr() > 1.0E-6D) {
|
||||
worldMotion = worldMotion.add(antiwaterFlow.normalize().scale(0.02D));
|
||||
}
|
||||
boolean flying = entity instanceof Player player && player.getAbilities().flying;
|
||||
if (!flying) {
|
||||
worldMotion = worldMotion.add(0.0D, 0.005D + verticalInput * 0.04D, 0.0D);
|
||||
}
|
||||
|
||||
entity.setDeltaMovement(
|
||||
gravityDirection.isInverted()
|
||||
? AntarchyGravityRotationUtil.vecWorldToPlayer(worldMotion, gravityDirection)
|
||||
: worldMotion
|
||||
);
|
||||
|
||||
if (entity.horizontalCollision && entity.isFree(
|
||||
worldMotion.x,
|
||||
worldMotion.y + 0.6D - entity.getY() + prevY,
|
||||
worldMotion.z
|
||||
)) {
|
||||
Vec3 boostedWorldMotion = new Vec3(worldMotion.x, 0.3D, worldMotion.z);
|
||||
entity.setDeltaMovement(
|
||||
gravityDirection.isInverted()
|
||||
? AntarchyGravityRotationUtil.vecWorldToPlayer(boostedWorldMotion, gravityDirection)
|
||||
: boostedWorldMotion
|
||||
);
|
||||
}
|
||||
|
||||
ci.cancel();
|
||||
}
|
||||
|
||||
private AntarchyGravityDirection antarchy$getEffectiveGravityDirection(LivingEntity entity) {
|
||||
AntarchyGravityDirection gravityDirection = AntarchyGravityApi.getGravityDirection(entity);
|
||||
if (gravityDirection.isInverted() || !entity.hasEffect(AntarchyObjects.INVERTED_EFFECT.get())) {
|
||||
return gravityDirection;
|
||||
}
|
||||
|
||||
return AntarchyGravityDirection.UP;
|
||||
}
|
||||
|
||||
private boolean antarchy$isTouchingAntiwaterLocal(LivingEntity entity) {
|
||||
AABB box = entity.getBoundingBox().inflate(0.05D);
|
||||
BlockPos min = BlockPos.containing(box.minX, box.minY, box.minZ);
|
||||
BlockPos max = BlockPos.containing(box.maxX, box.maxY, box.maxZ);
|
||||
BlockPos.MutableBlockPos cursor = new BlockPos.MutableBlockPos();
|
||||
for (int x = min.getX(); x <= max.getX(); x++) {
|
||||
for (int y = min.getY(); y <= max.getY(); y++) {
|
||||
for (int z = min.getZ(); z <= max.getZ(); z++) {
|
||||
cursor.set(x, y, z);
|
||||
FluidState fluidState = entity.level().getFluidState(cursor);
|
||||
if (AntarchyFluidChecks.isAntiwater(fluidState)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package com.craisinlord.antarchy.fabric.mixin;
|
||||
|
||||
import com.craisinlord.antarchy.content.AntarchyObjects;
|
||||
import com.craisinlord.antarchy.fabric.BloodglassManager;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
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.CallbackInfo;
|
||||
|
||||
@Mixin(LivingEntity.class)
|
||||
public abstract class BloodglassEffectMixin {
|
||||
|
||||
@Inject(method = "onEffectAdded", at = @At("TAIL"))
|
||||
private void antarchy$onBloodglassWardAdded(MobEffectInstance effectInstance, @Nullable Entity source, CallbackInfo ci) {
|
||||
LivingEntity entity = (LivingEntity) (Object) this;
|
||||
if (effectInstance.getEffect() != AntarchyObjects.BLOODGLASS_WARD.get()) return;
|
||||
if (!(entity instanceof Player player)) return;
|
||||
BloodglassManager.handleWardApplied(player, effectInstance.getAmplifier());
|
||||
}
|
||||
|
||||
@Inject(method = "onEffectRemoved", at = @At("HEAD"))
|
||||
private void antarchy$onBloodglassWardRemoved(MobEffectInstance effectInstance, CallbackInfo ci) {
|
||||
LivingEntity entity = (LivingEntity) (Object) this;
|
||||
if (effectInstance.getEffect() != AntarchyObjects.BLOODGLASS_WARD.get()) return;
|
||||
if (!(entity instanceof Player player)) return;
|
||||
BloodglassManager.handleWardRemoved(player);
|
||||
}
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package com.craisinlord.antarchy.fabric.mixin;
|
||||
|
||||
import com.craisinlord.antarchy.fabric.BloodglassManager;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
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.CallbackInfo;
|
||||
|
||||
@Mixin(LivingEntity.class)
|
||||
public abstract class BloodglassEquipMixin {
|
||||
|
||||
@Inject(method = "onEquipItem", at = @At("TAIL"))
|
||||
private void antarchy$onBloodglassEquip(EquipmentSlot slot, ItemStack from, ItemStack to, CallbackInfo ci) {
|
||||
LivingEntity entity = (LivingEntity) (Object) this;
|
||||
if (entity instanceof Player player) {
|
||||
BloodglassManager.handleArmorEquipChange(player, slot, from, to);
|
||||
}
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package com.craisinlord.antarchy.fabric.mixin;
|
||||
|
||||
import com.craisinlord.antarchy.fabric.BloodglassManager;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
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.CallbackInfo;
|
||||
|
||||
@Mixin(ServerPlayer.class)
|
||||
public abstract class BloodglassRespawnMixin {
|
||||
|
||||
@Inject(method = "restoreFrom", at = @At("TAIL"))
|
||||
private void antarchy$onRespawn(ServerPlayer oldPlayer, boolean keepEverything, CallbackInfo ci) {
|
||||
BloodglassManager.handleRespawn((ServerPlayer) (Object) this);
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package com.craisinlord.antarchy.fabric.mixin;
|
||||
|
||||
import com.craisinlord.antarchy.content.AntarchyObjects;
|
||||
import com.craisinlord.antarchy.content.block.entity.DreamCampfireBlockEntity;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.entity.CampfireBlockEntity;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyArg;
|
||||
|
||||
@Mixin(CampfireBlockEntity.class)
|
||||
public abstract class DreamCampfireBlockEntityMixin {
|
||||
@ModifyArg(
|
||||
method = "<init>",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/world/level/block/entity/BlockEntity;<init>(Lnet/minecraft/world/level/block/entity/BlockEntityType;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;)V"
|
||||
),
|
||||
index = 0
|
||||
)
|
||||
private static BlockEntityType<? extends BlockEntity> antarchy$useDreamCampfireType(
|
||||
BlockEntityType<? extends BlockEntity> original
|
||||
) {
|
||||
return DreamCampfireBlockEntity.isConstructingDreamCampfire()
|
||||
? AntarchyObjects.DREAM_CAMPFIRE_BLOCK_ENTITY.get()
|
||||
: original;
|
||||
}
|
||||
}
|
||||
+113
@@ -0,0 +1,113 @@
|
||||
package com.craisinlord.antarchy.fabric.mixin;
|
||||
|
||||
import com.craisinlord.antarchy.config.AntarchySettings;
|
||||
import com.craisinlord.antarchy.content.AntarchyTags;
|
||||
import com.craisinlord.antarchy.content.movement.DreamSandLowGravityAccess;
|
||||
import com.craisinlord.antarchy.fabric.registry.AntarchyFabricBlocks;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
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.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(LivingEntity.class)
|
||||
public abstract class DreamSandMovementMixin {
|
||||
@Inject(method = "jumpFromGround", at = @At("TAIL"))
|
||||
private void antarchy$handleDreamSandJump(CallbackInfo ci) {
|
||||
LivingEntity self = (LivingEntity) (Object) this;
|
||||
if (self.level().isClientSide()) return;
|
||||
|
||||
DreamSandLowGravityAccess access = (DreamSandLowGravityAccess) self;
|
||||
if (!AntarchySettings.dreamSandEnabled() || antarchy$isDreamSandLowGravityBlacklisted(self)) {
|
||||
access.antarchy$clearDreamSandLowGravity();
|
||||
} else if (antarchy$isStandingOnDreamSand(self)) {
|
||||
antarchy$startDreamSandLowGravity(self, access);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "tick", at = @At("TAIL"))
|
||||
private void antarchy$tickDreamSandLowGravity(CallbackInfo ci) {
|
||||
LivingEntity self = (LivingEntity) (Object) this;
|
||||
if (self.level().isClientSide()) return;
|
||||
|
||||
DreamSandLowGravityAccess access = (DreamSandLowGravityAccess) self;
|
||||
int landingGraceTicks = access.antarchy$getDreamSandLandingGraceTicks();
|
||||
if (landingGraceTicks > 0) {
|
||||
access.antarchy$setDreamSandLandingGraceTicks(landingGraceTicks - 1);
|
||||
}
|
||||
|
||||
if (!AntarchySettings.dreamSandEnabled() || antarchy$isDreamSandLowGravityBlacklisted(self)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!access.antarchy$isDreamSandLowGravityActive()
|
||||
&& !self.onGround()
|
||||
&& antarchy$isStandingOnDreamSand(self)) {
|
||||
antarchy$startDreamSandLowGravity(self, access);
|
||||
}
|
||||
|
||||
if (!access.antarchy$isDreamSandLowGravityActive()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int remainingTicks = access.antarchy$getDreamSandLowGravityTicksRemaining();
|
||||
if (remainingTicks > 0) {
|
||||
access.antarchy$setDreamSandLowGravityTicksRemaining(remainingTicks - 1);
|
||||
}
|
||||
if (access.antarchy$getDreamSandLowGravityTicksRemaining() <= 0) {
|
||||
access.antarchy$clearDreamSandLowGravity();
|
||||
return;
|
||||
}
|
||||
|
||||
if (antarchy$isOnSolidGround(self)) {
|
||||
access.antarchy$setDreamSandLowGravityActive(false);
|
||||
access.antarchy$setDreamSandLowGravityTicksRemaining(0);
|
||||
access.antarchy$setDreamSandLandingGraceTicks(2);
|
||||
} else if (!self.onGround() && self.getDeltaMovement().y < 0.0D) {
|
||||
self.setDeltaMovement(
|
||||
self.getDeltaMovement().x,
|
||||
self.getDeltaMovement().y * AntarchySettings.dreamSandGravityMultiplier(),
|
||||
self.getDeltaMovement().z
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "causeFallDamage", at = @At("HEAD"), cancellable = true)
|
||||
private void antarchy$handleDreamSandFall(float fallDistance, float multiplier, DamageSource source, CallbackInfoReturnable<Boolean> cir) {
|
||||
LivingEntity self = (LivingEntity) (Object) this;
|
||||
DreamSandLowGravityAccess access = (DreamSandLowGravityAccess) self;
|
||||
if (!AntarchySettings.dreamSandEnabled()
|
||||
|| antarchy$isDreamSandLowGravityBlacklisted(self)
|
||||
|| (!access.antarchy$isDreamSandLowGravityActive() && access.antarchy$getDreamSandLandingGraceTicks() <= 0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
self.resetFallDistance();
|
||||
cir.setReturnValue(false);
|
||||
}
|
||||
|
||||
private static boolean antarchy$isOnSolidGround(LivingEntity livingEntity) {
|
||||
return livingEntity.onGround() && livingEntity.getBlockStateOn().blocksMotion();
|
||||
}
|
||||
|
||||
private static boolean antarchy$isStandingOnDreamSand(LivingEntity livingEntity) {
|
||||
return livingEntity.getBlockStateOn().is(AntarchyFabricBlocks.DREAM_SAND.get());
|
||||
}
|
||||
|
||||
private static void antarchy$startDreamSandLowGravity(LivingEntity self, DreamSandLowGravityAccess access) {
|
||||
self.setDeltaMovement(
|
||||
self.getDeltaMovement().x,
|
||||
self.getDeltaMovement().y * AntarchySettings.dreamSandJumpVelocityMultiplier(),
|
||||
self.getDeltaMovement().z
|
||||
);
|
||||
access.antarchy$setDreamSandLowGravityActive(true);
|
||||
access.antarchy$setDreamSandLowGravityTicksRemaining((int) Math.max(1L, Math.round(AntarchySettings.dreamSandEffectDurationSeconds() * 20.0D)));
|
||||
access.antarchy$setDreamSandLandingGraceTicks(0);
|
||||
}
|
||||
|
||||
private static boolean antarchy$isDreamSandLowGravityBlacklisted(LivingEntity livingEntity) {
|
||||
return livingEntity.getType().is(AntarchyTags.Entities.DREAM_SAND_LOW_GRAVITY_BLACKLIST);
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.craisinlord.antarchy.fabric.mixin;
|
||||
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.item.ElytraItem;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(LivingEntity.class)
|
||||
public abstract class ElytraFallFlyingMixin {
|
||||
|
||||
/**
|
||||
* Redirect to allow any ElytraItem subclass to sustain fall flying.
|
||||
*/
|
||||
@Redirect(
|
||||
method = "updateFallFlying",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/world/item/ItemStack;is(Lnet/minecraft/world/item/Item;)Z"
|
||||
)
|
||||
)
|
||||
private boolean antarchy$allowCustomElytraFallFlying(ItemStack itemStack, Item item) {
|
||||
return itemStack.getItem() instanceof ElytraItem;
|
||||
}
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package com.craisinlord.antarchy.fabric.mixin;
|
||||
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ElytraItem;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(Player.class)
|
||||
public abstract class ElytraStartFlyingMixin {
|
||||
|
||||
@Shadow
|
||||
public abstract void startFallFlying();
|
||||
|
||||
@Inject(method = "tryToStartFallFlying()Z", at = @At("RETURN"), cancellable = true)
|
||||
private void antarchy$allowCustomElytra(CallbackInfoReturnable<Boolean> cir) {
|
||||
if (cir.getReturnValue()) return;
|
||||
Player player = (Player) (Object) this;
|
||||
if (!player.onGround() && !player.isFallFlying() && !player.isInWater()
|
||||
&& !player.hasEffect(net.minecraft.world.effect.MobEffects.LEVITATION)) {
|
||||
ItemStack chest = player.getItemBySlot(EquipmentSlot.CHEST);
|
||||
if (chest.getItem() instanceof ElytraItem && ElytraItem.isFlyEnabled(chest)) {
|
||||
this.startFallFlying();
|
||||
cir.setReturnValue(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
package com.craisinlord.antarchy.fabric.mixin;
|
||||
|
||||
import com.craisinlord.antarchy.content.gravity.AntarchyGravityApi;
|
||||
import com.craisinlord.antarchy.content.item.BloodCrystalArmorItem;
|
||||
import com.craisinlord.antarchy.content.item.JumpyBootsItem;
|
||||
import com.craisinlord.antarchy.fabric.util.JumpyBootsFabricHelper;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
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.ModifyVariable;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(LivingEntity.class)
|
||||
public abstract class JumpyBootsFallDamageMixin {
|
||||
@Inject(method = "causeFallDamage", at = @At("HEAD"), cancellable = true)
|
||||
private void antarchy$cancelBloodCrystalBootsInvertedFallDamage(float fallDistance, float multiplier, DamageSource source, CallbackInfoReturnable<Boolean> cir) {
|
||||
LivingEntity self = (LivingEntity) (Object) this;
|
||||
if (!(self instanceof Player player)) {
|
||||
return;
|
||||
}
|
||||
if (!AntarchyGravityApi.isGravityInverted(player)) {
|
||||
return;
|
||||
}
|
||||
if (!(player.getItemBySlot(EquipmentSlot.FEET).getItem() instanceof BloodCrystalArmorItem)) {
|
||||
return;
|
||||
}
|
||||
|
||||
player.fallDistance = 0.0F;
|
||||
cir.setReturnValue(false);
|
||||
}
|
||||
|
||||
@ModifyVariable(method = "causeFallDamage", at = @At("HEAD"), ordinal = 0, argsOnly = true)
|
||||
private float antarchy$reduceJumpyBootsFallDamage(float fallDistance) {
|
||||
LivingEntity self = (LivingEntity) (Object) this;
|
||||
if (!JumpyBootsItem.isWearingJumpyBoots(self)) return fallDistance;
|
||||
long protectionUntil = JumpyBootsFabricHelper.getProtectionUntil(self);
|
||||
if (self.level().getGameTime() < protectionUntil) {
|
||||
return fallDistance * 0.25F;
|
||||
}
|
||||
return fallDistance;
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.craisinlord.antarchy.fabric.mixin;
|
||||
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
@Mixin(LivingEntity.class)
|
||||
public interface LivingEntityJumpingAccessor {
|
||||
@Accessor("jumping")
|
||||
boolean antarchy$isJumping();
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package com.craisinlord.antarchy.fabric.mixin;
|
||||
|
||||
import com.craisinlord.antarchy.fabric.util.CustomFluidPhysicsChecks;
|
||||
import net.minecraft.world.entity.item.ItemEntity;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
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.CallbackInfo;
|
||||
|
||||
@Mixin(value = ItemEntity.class, priority = 900)
|
||||
public abstract class WaterlikeFluidItemEntityMixin {
|
||||
@Inject(method = "tick", at = @At("TAIL"))
|
||||
private void antarchy$applyWaterlikeFluidItemMovement(CallbackInfo ci) {
|
||||
ItemEntity entity = (ItemEntity) (Object) this;
|
||||
if (CustomFluidPhysicsChecks.isTouchingAntiwater(entity) || !CustomFluidPhysicsChecks.isTouchingWaterlikeFluid(entity)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Vec3 motion = entity.getDeltaMovement();
|
||||
Vec3 fluidFlow = CustomFluidPhysicsChecks.getWaterlikeFlow(entity);
|
||||
Vec3 push = fluidFlow.lengthSqr() > 1.0E-6D ? fluidFlow.normalize().scale(0.03D) : Vec3.ZERO;
|
||||
entity.setDeltaMovement(
|
||||
motion.x * 0.99D + push.x,
|
||||
motion.y + (motion.y < 0.06D ? 5.0E-4D : 0.0D) + push.y,
|
||||
motion.z * 0.99D + push.z
|
||||
);
|
||||
}
|
||||
}
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
package com.craisinlord.antarchy.fabric.mixin;
|
||||
|
||||
import com.craisinlord.antarchy.fabric.util.CustomFluidPhysicsChecks;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.MoverType;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
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.CallbackInfo;
|
||||
|
||||
@Mixin(value = LivingEntity.class, priority = 900)
|
||||
public abstract class WaterlikeFluidLivingEntityMixin {
|
||||
@Inject(method = "travel", at = @At("HEAD"), cancellable = true)
|
||||
private void antarchy$moveInCustomWaterlikeFluid(Vec3 travelVector, CallbackInfo ci) {
|
||||
LivingEntity entity = (LivingEntity) (Object) this;
|
||||
if (CustomFluidPhysicsChecks.isTouchingAntiwater(entity) || !CustomFluidPhysicsChecks.isTouchingWaterlikeFluid(entity)) {
|
||||
return;
|
||||
}
|
||||
|
||||
double prevY = entity.getY();
|
||||
float swimSpeed = entity.isSprinting() ? 0.024F : 0.02F;
|
||||
entity.moveRelative(swimSpeed, travelVector);
|
||||
entity.move(MoverType.SELF, entity.getDeltaMovement());
|
||||
|
||||
Vec3 motion = entity.getDeltaMovement();
|
||||
double verticalInput = travelVector.y;
|
||||
if (verticalInput == 0.0D && entity instanceof Player player) {
|
||||
verticalInput = player.isShiftKeyDown() ? -1.0D : ((LivingEntityJumpingAccessor) entity).antarchy$isJumping() ? 1.0D : 0.0D;
|
||||
}
|
||||
|
||||
if (entity.horizontalCollision && entity.onClimbable()) {
|
||||
motion = new Vec3(motion.x, 0.2D, motion.z);
|
||||
}
|
||||
|
||||
boolean flying = entity instanceof Player player && player.getAbilities().flying;
|
||||
double verticalDrift = verticalInput * 0.04D;
|
||||
if (!flying) {
|
||||
verticalDrift -= 0.004D;
|
||||
}
|
||||
|
||||
Vec3 nextMotion = new Vec3(
|
||||
motion.x * 0.8D,
|
||||
motion.y * 0.8D + verticalDrift,
|
||||
motion.z * 0.8D
|
||||
);
|
||||
Vec3 fluidFlow = CustomFluidPhysicsChecks.getWaterlikeFlow(entity);
|
||||
if (fluidFlow.lengthSqr() > 1.0E-6D) {
|
||||
nextMotion = nextMotion.add(fluidFlow.normalize().scale(0.014D));
|
||||
}
|
||||
entity.setDeltaMovement(nextMotion);
|
||||
|
||||
if (entity.horizontalCollision && entity.isFree(
|
||||
nextMotion.x,
|
||||
nextMotion.y + 0.6D - entity.getY() + prevY,
|
||||
nextMotion.z
|
||||
)) {
|
||||
entity.setDeltaMovement(nextMotion.x, 0.3D, nextMotion.z);
|
||||
}
|
||||
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package com.craisinlord.antarchy.fabric.mixin;
|
||||
|
||||
import net.minecraft.world.level.block.state.properties.WoodType;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||
|
||||
@Mixin(WoodType.class)
|
||||
public interface WoodTypeInvoker {
|
||||
@Invoker("register")
|
||||
static WoodType antarchy$register(WoodType woodType) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package com.craisinlord.antarchy.fabric.mixin.client;
|
||||
|
||||
import com.craisinlord.antarchy.fabric.client.BloodglassHudRenderer;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
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.CallbackInfo;
|
||||
|
||||
@Mixin(Gui.class)
|
||||
public abstract class BloodglassChatOrderMixin {
|
||||
@Inject(method = "render", at = @At("HEAD"))
|
||||
private void antarchy$renderBloodglassBeforeChat(GuiGraphics guiGraphics, float partialTick, CallbackInfo ci) {
|
||||
BloodglassHudRenderer.render(guiGraphics);
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.craisinlord.antarchy.fabric.mixin.client;
|
||||
|
||||
import com.craisinlord.antarchy.content.item.BrutalflyElytraItem;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.player.LocalPlayer;
|
||||
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;
|
||||
|
||||
@Mixin(Gui.class)
|
||||
public abstract class BrutalflyElytraExperienceBarMixin {
|
||||
@Inject(method = "isExperienceBarVisible", at = @At("RETURN"), cancellable = true)
|
||||
private void antarchy$hideExperienceBarForBrutalfly(CallbackInfoReturnable<Boolean> cir) {
|
||||
LocalPlayer player = Minecraft.getInstance().player;
|
||||
if (player != null && BrutalflyElytraItem.isWearingBrutalflyElytra(player) && player.isFallFlying()) {
|
||||
cir.setReturnValue(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
package com.craisinlord.antarchy.fabric.mixin.client;
|
||||
|
||||
import com.craisinlord.antarchy.content.client.CameraShakeClientState;
|
||||
import com.craisinlord.antarchy.content.client.HerculesBeetleImpactShakeClientState;
|
||||
import com.craisinlord.antarchy.content.item.BigBerthaItem;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.math.Axis;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.Mth;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
|
||||
@Mixin(GameRenderer.class)
|
||||
public abstract class CameraShakeMixin {
|
||||
private static final int TORETERROR_SHAKE_TICKS = 25;
|
||||
|
||||
@Shadow @Final private Minecraft minecraft;
|
||||
|
||||
@Inject(method = "bobView", at = @At("TAIL"))
|
||||
private void applyCameraShake(PoseStack poseStack, float partialTick, CallbackInfo ci) {
|
||||
if (minecraft.level == null || minecraft.player == null) {
|
||||
CameraShakeClientState.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
float shakeStrength = CameraShakeClientState.getStrength(minecraft.gameRenderer.getMainCamera().getPosition());
|
||||
|
||||
int beetleShakeTicks = HerculesBeetleImpactShakeClientState.getTicks();
|
||||
if (beetleShakeTicks > 0) {
|
||||
shakeStrength += (float) beetleShakeTicks / TORETERROR_SHAKE_TICKS * 2.0F;
|
||||
}
|
||||
|
||||
int bigBerthaShakeTicks = BigBerthaItem.clientShakeTicks;
|
||||
if (bigBerthaShakeTicks > 0) {
|
||||
shakeStrength += (float) bigBerthaShakeTicks / TORETERROR_SHAKE_TICKS * 2.0F;
|
||||
}
|
||||
|
||||
if (shakeStrength <= 0.0F) return;
|
||||
|
||||
float time = (float) (minecraft.player.tickCount + partialTick);
|
||||
poseStack.mulPose(Axis.YP.rotationDegrees(Mth.sin(time * 1.5F) * shakeStrength * 2.5F));
|
||||
poseStack.mulPose(Axis.XP.rotationDegrees(Mth.cos(time * 1.8F) * shakeStrength * 2.0F));
|
||||
poseStack.mulPose(Axis.ZP.rotationDegrees(Mth.sin(time * 2.2F) * shakeStrength * 1.5F));
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package com.craisinlord.antarchy.fabric.mixin.client;
|
||||
|
||||
import com.craisinlord.antarchy.content.item.GravityGunItem;
|
||||
import com.craisinlord.antarchy.content.item.RpoLauncherItem;
|
||||
import com.craisinlord.antarchy.content.item.SizeRayItem;
|
||||
import com.craisinlord.antarchy.content.item.SquidzookaItem;
|
||||
import com.craisinlord.antarchy.content.item.WaterCannonItem;
|
||||
import net.minecraft.client.model.HumanoidModel;
|
||||
import net.minecraft.client.player.AbstractClientPlayer;
|
||||
import net.minecraft.client.renderer.entity.player.PlayerRenderer;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
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;
|
||||
|
||||
@Mixin(PlayerRenderer.class)
|
||||
public class CrossbowArmPoseMixin {
|
||||
|
||||
@Inject(method = "getArmPose", at = @At("RETURN"), cancellable = true)
|
||||
private static void antarchy$customArmPose(
|
||||
AbstractClientPlayer player, InteractionHand hand,
|
||||
CallbackInfoReturnable<HumanoidModel.ArmPose> cir) {
|
||||
ItemStack stack = player.getItemInHand(hand);
|
||||
Item item = stack.getItem();
|
||||
|
||||
if (item instanceof GravityGunItem || item instanceof SquidzookaItem || item instanceof RpoLauncherItem || item instanceof WaterCannonItem) {
|
||||
cir.setReturnValue(HumanoidModel.ArmPose.CROSSBOW_HOLD);
|
||||
} else if (item instanceof SizeRayItem) {
|
||||
if (player.isUsingItem() && player.getUsedItemHand() == hand) {
|
||||
cir.setReturnValue(HumanoidModel.ArmPose.CROSSBOW_HOLD);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package com.craisinlord.antarchy.fabric.mixin.client;
|
||||
|
||||
import com.craisinlord.antarchy.content.block.DuctTapeBlock;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.player.Input;
|
||||
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.CallbackInfo;
|
||||
|
||||
@Mixin(Input.class)
|
||||
public abstract class DuctTapeInputMixin {
|
||||
|
||||
@Inject(method = "tick", at = @At("RETURN"))
|
||||
private void blockInputInDuctTape(boolean isSneaking, float slowFactor, CallbackInfo ci) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
if (mc.player == null || mc.level == null) return;
|
||||
if (!mc.player.isNoGravity() && !DuctTapeBlock.isTouchingTape(mc.level, mc.player)) return;
|
||||
|
||||
Input self = (Input) (Object) this;
|
||||
self.left = false;
|
||||
self.right = false;
|
||||
self.up = false;
|
||||
self.down = false;
|
||||
self.leftImpulse = 0.0F;
|
||||
self.forwardImpulse = 0.0F;
|
||||
self.jumping = false;
|
||||
self.shiftKeyDown = false;
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.craisinlord.antarchy.fabric.mixin.client;
|
||||
|
||||
import com.craisinlord.antarchy.fabric.client.GravityGunClientHandler;
|
||||
import net.minecraft.client.MouseHandler;
|
||||
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.CallbackInfo;
|
||||
|
||||
@Mixin(MouseHandler.class)
|
||||
public abstract class GravityGunMouseScrollMixin {
|
||||
@Inject(method = "onScroll", at = @At("HEAD"), cancellable = true)
|
||||
private void antarchy$handleGravityGunScroll(long window, double horizontalAmount, double verticalAmount, CallbackInfo ci) {
|
||||
if (GravityGunClientHandler.onScroll(verticalAmount)) {
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
package com.craisinlord.antarchy.fabric.mixin.client;
|
||||
|
||||
import com.craisinlord.antarchy.config.AntarchySettings;
|
||||
import com.craisinlord.antarchy.fabric.client.KeybindingConflictFixStore;
|
||||
import com.mojang.blaze3d.platform.InputConstants;
|
||||
import java.util.Map;
|
||||
import net.minecraft.client.KeyMapping;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(KeyMapping.class)
|
||||
public abstract class KeybindingConflictFixMixin {
|
||||
@Shadow @Final private static Map<InputConstants.Key, KeyMapping> MAP;
|
||||
@Shadow @Final private static Map<String, KeyMapping> ALL;
|
||||
@Shadow private InputConstants.Key key;
|
||||
@Shadow private boolean isDown;
|
||||
@Shadow private int clickCount;
|
||||
|
||||
@Inject(method = "<init>(Ljava/lang/String;Lcom/mojang/blaze3d/platform/InputConstants$Type;ILjava/lang/String;)V", at = @At("TAIL"))
|
||||
private void antarchy$addInitialMapping(String name, InputConstants.Type type, int key, String category, CallbackInfo ci) {
|
||||
KeybindingConflictFixStore.add(this.key, (KeyMapping) (Object) this);
|
||||
}
|
||||
|
||||
@Inject(method = "resetMapping", at = @At("TAIL"))
|
||||
private static void antarchy$rebuildMappings(CallbackInfo ci) {
|
||||
KeybindingConflictFixStore.clear();
|
||||
for (KeyMapping mapping : ALL.values()) {
|
||||
KeybindingConflictFixStore.add(((KeybindingConflictFixMixin) (Object) mapping).key, mapping);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "click", at = @At("TAIL"))
|
||||
private static void antarchy$clickConflicts(InputConstants.Key key, CallbackInfo ci) {
|
||||
if (!AntarchySettings.fabricKeybindingConflictFixEnabled()) {
|
||||
return;
|
||||
}
|
||||
KeyMapping active = MAP.get(key);
|
||||
for (KeyMapping mapping : KeybindingConflictFixStore.others(key, active)) {
|
||||
((KeybindingConflictFixMixin) (Object) mapping).antarchy$click();
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "set", at = @At("TAIL"))
|
||||
private static void antarchy$setConflicts(InputConstants.Key key, boolean down, CallbackInfo ci) {
|
||||
if (!AntarchySettings.fabricKeybindingConflictFixEnabled()) {
|
||||
return;
|
||||
}
|
||||
KeyMapping active = MAP.get(key);
|
||||
for (KeyMapping mapping : KeybindingConflictFixStore.others(key, active)) {
|
||||
((KeybindingConflictFixMixin) (Object) mapping).antarchy$setDown(down);
|
||||
}
|
||||
}
|
||||
|
||||
@Unique
|
||||
private void antarchy$click() {
|
||||
this.clickCount++;
|
||||
}
|
||||
|
||||
@Unique
|
||||
private void antarchy$setDown(boolean down) {
|
||||
this.isDown = down;
|
||||
}
|
||||
}
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
package com.craisinlord.antarchy.fabric.mixin.client;
|
||||
|
||||
import com.craisinlord.antarchy.content.fluid.BileLiquidBlock;
|
||||
import com.craisinlord.antarchy.content.fluid.AntarchyFluidChecks;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.shaders.FogShape;
|
||||
import net.minecraft.client.Camera;
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.client.renderer.FogRenderer;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
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.CallbackInfo;
|
||||
|
||||
@Mixin(FogRenderer.class)
|
||||
public abstract class LiquidFogMixin {
|
||||
private static final int FLUID_NONE = 0;
|
||||
private static final int FLUID_BILE = 1;
|
||||
private static final int FLUID_ANTIWATER = 2;
|
||||
private static final int FLUID_ICHOR = 3;
|
||||
private static final int FLUID_LUMEN = 4;
|
||||
|
||||
@Inject(method = "setupColor", at = @At("TAIL"))
|
||||
private static void antarchy$overrideBileColor(Camera camera, float partialTick, ClientLevel level, int renderDistance, float darkenWorldAmount, CallbackInfo ci) {
|
||||
int fluidKind = antarchy$getFluidKind(camera);
|
||||
if (fluidKind == FLUID_NONE) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (fluidKind == FLUID_BILE) {
|
||||
RenderSystem.clearColor(0.52F, 0.58F, 0.08F, 0.0F);
|
||||
} else if (fluidKind == FLUID_ANTIWATER) {
|
||||
RenderSystem.clearColor(0.48F, 0.06F, 0.06F, 0.0F);
|
||||
} else if (fluidKind == FLUID_ICHOR) {
|
||||
RenderSystem.clearColor(0.18F, 0.01F, 0.02F, 0.0F);
|
||||
} else if (fluidKind == FLUID_LUMEN) {
|
||||
RenderSystem.clearColor(0.42F, 0.82F, 1.0F, 0.0F);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "setupFog", at = @At("TAIL"))
|
||||
private static void antarchy$overrideBileFog(Camera camera, FogRenderer.FogMode mode, float renderDistance, boolean thickFog, float partialTick, CallbackInfo ci) {
|
||||
int fluidKind = antarchy$getFluidKind(camera);
|
||||
if (fluidKind == FLUID_NONE) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (fluidKind == FLUID_BILE) {
|
||||
RenderSystem.setShaderFogStart(0.2F);
|
||||
RenderSystem.setShaderFogEnd(Math.min(renderDistance, 4.5F));
|
||||
} else if (fluidKind == FLUID_ANTIWATER) {
|
||||
RenderSystem.setShaderFogStart(0.18F);
|
||||
RenderSystem.setShaderFogEnd(Math.min(renderDistance, 3.5F));
|
||||
} else if (fluidKind == FLUID_ICHOR) {
|
||||
RenderSystem.setShaderFogStart(0.08F);
|
||||
RenderSystem.setShaderFogEnd(Math.min(renderDistance, 2.25F));
|
||||
} else if (fluidKind == FLUID_LUMEN) {
|
||||
RenderSystem.setShaderFogStart(0.3F);
|
||||
RenderSystem.setShaderFogEnd(Math.min(renderDistance, 6.0F));
|
||||
}
|
||||
RenderSystem.setShaderFogShape(FogShape.CYLINDER);
|
||||
}
|
||||
|
||||
private static int antarchy$getFluidKind(Camera camera) {
|
||||
Entity entity = camera.getEntity();
|
||||
if (entity == null || entity.level() == null) {
|
||||
return FLUID_NONE;
|
||||
}
|
||||
|
||||
BlockPos pos = BlockPos.containing(camera.getPosition());
|
||||
FluidState fluidState = entity.level().getFluidState(pos);
|
||||
if (BileLiquidBlock.isBile(fluidState)) {
|
||||
return FLUID_BILE;
|
||||
}
|
||||
if (AntarchyFluidChecks.isAntiwater(fluidState)) {
|
||||
return FLUID_ANTIWATER;
|
||||
}
|
||||
if (AntarchyFluidChecks.isIchor(fluidState)) {
|
||||
return FLUID_ICHOR;
|
||||
}
|
||||
if (AntarchyFluidChecks.isLumen(fluidState)) {
|
||||
return FLUID_LUMEN;
|
||||
}
|
||||
return FLUID_NONE;
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package com.craisinlord.antarchy.fabric.mixin.client;
|
||||
import com.craisinlord.antarchy.fabric.registry.AntarchyFabricEntities;
|
||||
|
||||
import com.craisinlord.antarchy.fabric.AntarchyFabricContent;
|
||||
import net.minecraft.client.multiplayer.ClientPacketListener;
|
||||
import net.minecraft.network.protocol.game.ClientboundAddEntityPacket;
|
||||
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.CallbackInfo;
|
||||
|
||||
@Mixin(ClientPacketListener.class)
|
||||
public abstract class MultipartClientSpawnMixin {
|
||||
@Inject(method = "handleAddEntity", at = @At("HEAD"), cancellable = true)
|
||||
private void antarchy$skipTrackedMultipartPlaceholders(ClientboundAddEntityPacket packet, CallbackInfo ci) {
|
||||
if (packet.getType() == AntarchyFabricEntities.KRAKEN_PART.get()) {
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
package com.craisinlord.antarchy.fabric.mixin.client;
|
||||
|
||||
import com.craisinlord.antarchy.content.entity.multipart.MultipartEntityOwner;
|
||||
import com.craisinlord.antarchy.fabric.client.multipart.MultipartClientPartLevelRegistry;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.entity.EntityInLevelCallback;
|
||||
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.CallbackInfo;
|
||||
|
||||
@Mixin(Entity.class)
|
||||
public abstract class MultipartEntityLevelRegistryMixin {
|
||||
@Inject(method = "setLevelCallback", at = @At("TAIL"))
|
||||
private void antarchy$registerMultipartParts(EntityInLevelCallback entityInLevelCallback, CallbackInfo ci) {
|
||||
Entity self = (Entity) (Object) this;
|
||||
if (self instanceof MultipartEntityOwner owner
|
||||
&& entityInLevelCallback != EntityInLevelCallback.NULL
|
||||
&& self.level().isClientSide()) {
|
||||
if (owner.antarchy$getMultipartParts() == null) {
|
||||
owner.antarchy$spawnMultipartParts();
|
||||
}
|
||||
MultipartClientPartLevelRegistry.register(owner);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "setRemoved", at = @At("HEAD"))
|
||||
private void antarchy$unregisterMultipartParts(Entity.RemovalReason removalReason, CallbackInfo ci) {
|
||||
Entity self = (Entity) (Object) this;
|
||||
if (self instanceof MultipartEntityOwner owner && self.level().isClientSide()) {
|
||||
MultipartClientPartLevelRegistry.unregister(owner);
|
||||
}
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package com.craisinlord.antarchy.fabric.mixin.entity;
|
||||
|
||||
import com.craisinlord.antarchy.content.entity.multipart.MultipartEntityOwner;
|
||||
import com.craisinlord.antarchy.fabric.entity.multipart.MultipartServerPartLevelRegistry;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.entity.EntityInLevelCallback;
|
||||
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.CallbackInfo;
|
||||
|
||||
@Mixin(Entity.class)
|
||||
/*
|
||||
* Keeps multipart child entities registered in Fabric levels.
|
||||
*/
|
||||
public abstract class MultipartEntityLevelRegistryMixin {
|
||||
@Inject(method = "setLevelCallback", at = @At("TAIL"))
|
||||
private void antarchy$registerMultipartParts(EntityInLevelCallback entityInLevelCallback, CallbackInfo ci) {
|
||||
Entity self = (Entity) (Object) this;
|
||||
if (self instanceof MultipartEntityOwner owner
|
||||
&& entityInLevelCallback != EntityInLevelCallback.NULL
|
||||
&& !self.level().isClientSide()) {
|
||||
if (owner.antarchy$getMultipartParts() == null) {
|
||||
owner.antarchy$spawnMultipartParts();
|
||||
}
|
||||
MultipartServerPartLevelRegistry.register(owner);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "setRemoved", at = @At("HEAD"))
|
||||
private void antarchy$unregisterMultipartParts(Entity.RemovalReason removalReason, CallbackInfo ci) {
|
||||
Entity self = (Entity) (Object) this;
|
||||
if (self instanceof MultipartEntityOwner owner && !self.level().isClientSide()) {
|
||||
MultipartServerPartLevelRegistry.unregister(owner);
|
||||
}
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
package com.craisinlord.antarchy.fabric.mixin.infinity;
|
||||
|
||||
import com.craisinlord.antarchy.config.AntarchySettings;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.entity.item.ItemEntity;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
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.CallbackInfo;
|
||||
|
||||
import net.lerariemann.infinity.util.teleport.PortalCreator;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
|
||||
@Mixin(PortalCreator.class)
|
||||
public interface PortalCreatorMixin {
|
||||
@Inject(
|
||||
method = "tryCreatePortalFromItem(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/entity/item/ItemEntity;)V",
|
||||
at = @At("HEAD"),
|
||||
cancellable = true
|
||||
)
|
||||
private static void antarchy$blockInfinityBookActivation(ServerLevel level, BlockPos pos, ItemEntity itemEntity, CallbackInfo ci) {
|
||||
if (!AntarchySettings.disableInfinityBookPortalCreation()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (itemEntity.isRemoved()) {
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack stack = itemEntity.getItem();
|
||||
if (!stack.is(Items.WRITABLE_BOOK) && !stack.is(Items.WRITTEN_BOOK)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
package com.craisinlord.antarchy.fabric.network;
|
||||
|
||||
import com.craisinlord.antarchy.content.client.BloodglassClientState;
|
||||
import com.craisinlord.antarchy.content.client.BrutalflyElytraClientState;
|
||||
import com.craisinlord.antarchy.content.client.HordeClientState;
|
||||
import com.craisinlord.antarchy.content.client.ScorpionWhipTetherClientState;
|
||||
import com.craisinlord.antarchy.content.client.ThoraxisWeatherClientState;
|
||||
import com.craisinlord.antarchy.content.entity.multipart.MultipartFramework;
|
||||
import com.craisinlord.antarchy.content.entity.multipart.network.MultipartAttackPayload;
|
||||
import com.craisinlord.antarchy.content.entity.multipart.network.MultipartInteractPayload;
|
||||
import com.craisinlord.antarchy.content.network.*;
|
||||
import com.craisinlord.antarchy.content.weather.ThoraxisWeatherKind;
|
||||
import com.craisinlord.antarchy.fabric.client.BloodCrystalKatanaTrailClientState;
|
||||
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
|
||||
import net.fabricmc.fabric.api.networking.v1.PacketByteBufs;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
||||
public final class AntarchyFabricClientNetworking {
|
||||
private AntarchyFabricClientNetworking() {
|
||||
}
|
||||
|
||||
public static void bootstrapMultipartClient() {
|
||||
MultipartFramework.bootstrap(
|
||||
AntarchyFabricNetworking::createMultipartPart,
|
||||
new MultipartFramework.NetworkBridge() {
|
||||
@Override
|
||||
public void sendAttack(java.util.UUID parentId, int partIndex, float damage) {
|
||||
sendToServer(new MultipartAttackPayload(parentId, partIndex, damage), MultipartAttackPayload.STREAM_CODEC, MultipartAttackPayload.TYPE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendInteract(java.util.UUID parentId, int partIndex, int handId) {
|
||||
sendToServer(new MultipartInteractPayload(parentId, partIndex, handId), MultipartInteractPayload.STREAM_CODEC, MultipartInteractPayload.TYPE);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public static <T extends com.craisinlord.antarchy.compat.network.CustomPacketPayload> void sendToServer(
|
||||
T payload,
|
||||
com.craisinlord.antarchy.compat.network.StreamCodec<io.netty.buffer.ByteBuf, T> streamCodec,
|
||||
com.craisinlord.antarchy.compat.network.CustomPacketPayload.Type<T> type
|
||||
) {
|
||||
FriendlyByteBuf buf = PacketByteBufs.create();
|
||||
streamCodec.encode(buf, payload);
|
||||
ClientPlayNetworking.send(type.id(), buf);
|
||||
}
|
||||
|
||||
private static <T extends com.craisinlord.antarchy.compat.network.CustomPacketPayload> void registerReceiver(
|
||||
com.craisinlord.antarchy.compat.network.CustomPacketPayload.Type<T> type,
|
||||
com.craisinlord.antarchy.compat.network.StreamCodec<io.netty.buffer.ByteBuf, T> streamCodec,
|
||||
java.util.function.Consumer<T> handler
|
||||
) {
|
||||
ClientPlayNetworking.registerGlobalReceiver(type.id(), (client, handlerConn, buf, sender) -> {
|
||||
T payload = streamCodec.decode(buf);
|
||||
client.execute(() -> handler.accept(payload));
|
||||
});
|
||||
}
|
||||
|
||||
public static void register() {
|
||||
registerReceiver(GravityStatePayload.TYPE, GravityStatePayload.STREAM_CODEC, payload ->
|
||||
AntarchyFabricNetworking.handleGravityState(Minecraft.getInstance().player, payload));
|
||||
registerReceiver(BloodglassStatePayload.TYPE, BloodglassStatePayload.STREAM_CODEC, payload ->
|
||||
BloodglassClientState.update(payload.shieldsActive(), payload.shieldsMax()));
|
||||
registerReceiver(BloodCrystalKatanaTrailPayload.TYPE, BloodCrystalKatanaTrailPayload.STREAM_CODEC, payload ->
|
||||
BloodCrystalKatanaTrailClientState.trigger(payload.entityId(), payload.durationTicks()));
|
||||
registerReceiver(ScorpionWhipTetherPayload.TYPE, ScorpionWhipTetherPayload.STREAM_CODEC, payload ->
|
||||
ScorpionWhipTetherClientState.update(payload.playerId(), payload.targetId()));
|
||||
registerReceiver(BrutalflyElytraAnimationPayload.TYPE, BrutalflyElytraAnimationPayload.STREAM_CODEC, payload ->
|
||||
BrutalflyElytraClientState.trigger(payload.entityId(), payload.durationTicks(), payload.strength()));
|
||||
registerReceiver(ThoraxisWeatherPayload.TYPE, ThoraxisWeatherPayload.STREAM_CODEC, payload ->
|
||||
ThoraxisWeatherClientState.apply(
|
||||
new ResourceLocation(payload.dimensionId()),
|
||||
ThoraxisWeatherKind.byId(payload.weatherId()),
|
||||
payload.expiresAt(),
|
||||
payload.anchorX(),
|
||||
payload.anchorY(),
|
||||
payload.anchorZ()
|
||||
));
|
||||
registerReceiver(HerculesBeetleImpactShakePayload.TYPE, HerculesBeetleImpactShakePayload.STREAM_CODEC, payload ->
|
||||
AntarchyFabricNetworking.triggerHerculesBeetleImpactShake(payload.durationTicks()));
|
||||
registerReceiver(ImpactShakePayload.TYPE, ImpactShakePayload.STREAM_CODEC, AntarchyFabricNetworking::triggerImpactShake);
|
||||
registerReceiver(HordeIntensityPayload.TYPE, HordeIntensityPayload.STREAM_CODEC, payload ->
|
||||
HordeClientState.update(payload.intensity()));
|
||||
}
|
||||
}
|
||||
+405
@@ -0,0 +1,405 @@
|
||||
package com.craisinlord.antarchy.fabric.network;
|
||||
import com.craisinlord.antarchy.fabric.registry.AntarchyFabricEntities;
|
||||
|
||||
import com.craisinlord.antarchy.content.entity.DiamondMinecartEntity;
|
||||
import com.craisinlord.antarchy.content.client.CameraShakeClientState;
|
||||
import com.craisinlord.antarchy.content.client.HerculesBeetleImpactShakeClientState;
|
||||
import com.craisinlord.antarchy.content.entity.multipart.MultipartEntityOwner;
|
||||
import com.craisinlord.antarchy.content.entity.multipart.MultipartFramework;
|
||||
import com.craisinlord.antarchy.content.entity.multipart.network.MultipartAttackPayload;
|
||||
import com.craisinlord.antarchy.content.entity.multipart.network.MultipartInteractPayload;
|
||||
import com.craisinlord.antarchy.content.gravity.AntarchyGravityApi;
|
||||
import com.craisinlord.antarchy.content.entity.HerculesBeetleEntity;
|
||||
import com.craisinlord.antarchy.content.item.BrutalflyElytraFlightHelper;
|
||||
import com.craisinlord.antarchy.content.item.BrutalflyElytraItem;
|
||||
import com.craisinlord.antarchy.content.item.BigBerthaItem;
|
||||
import com.craisinlord.antarchy.content.item.JumpyBootsHelper;
|
||||
import com.craisinlord.antarchy.fabric.util.JumpyBootsFabricHelper;
|
||||
import com.craisinlord.antarchy.content.item.JumpyBootsItem;
|
||||
import com.craisinlord.antarchy.content.item.GravityGunItem;
|
||||
import com.craisinlord.antarchy.content.network.*;
|
||||
import com.craisinlord.antarchy.content.entity.DorrieEntity;
|
||||
import com.craisinlord.antarchy.content.network.DorrieJumpInputPayload;
|
||||
import com.craisinlord.antarchy.content.network.JumpyBootsLaunchPayload;
|
||||
import com.craisinlord.antarchy.content.weather.ThoraxisWeatherSnapshot;
|
||||
import com.craisinlord.antarchy.fabric.AntarchyFabricContent;
|
||||
import com.craisinlord.antarchy.fabric.entity.multipart.MultipartPartEntity;
|
||||
import net.fabricmc.fabric.api.networking.v1.PacketByteBufs;
|
||||
import net.fabricmc.fabric.api.networking.v1.PlayerLookup;
|
||||
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.network.protocol.game.ClientboundSetEntityMotionPacket;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
public final class AntarchyFabricNetworking {
|
||||
private AntarchyFabricNetworking() {
|
||||
}
|
||||
|
||||
public static void register() {
|
||||
registerServerReceivers();
|
||||
}
|
||||
|
||||
public static <T extends com.craisinlord.antarchy.compat.network.CustomPacketPayload> void sendToPlayer(
|
||||
ServerPlayer player,
|
||||
T payload,
|
||||
com.craisinlord.antarchy.compat.network.StreamCodec<io.netty.buffer.ByteBuf, T> streamCodec,
|
||||
com.craisinlord.antarchy.compat.network.CustomPacketPayload.Type<T> type
|
||||
) {
|
||||
FriendlyByteBuf buf = PacketByteBufs.create();
|
||||
streamCodec.encode(buf, payload);
|
||||
ServerPlayNetworking.send(player, type.id(), buf);
|
||||
}
|
||||
|
||||
private static <T extends com.craisinlord.antarchy.compat.network.CustomPacketPayload> void registerC2SReceiver(
|
||||
com.craisinlord.antarchy.compat.network.CustomPacketPayload.Type<T> type,
|
||||
com.craisinlord.antarchy.compat.network.StreamCodec<io.netty.buffer.ByteBuf, T> streamCodec,
|
||||
java.util.function.BiConsumer<ServerPlayer, T> handler
|
||||
) {
|
||||
ServerPlayNetworking.registerGlobalReceiver(type.id(), (server, player, handlerConn, buf, sender) -> {
|
||||
T payload = streamCodec.decode(buf);
|
||||
server.execute(() -> handler.accept(player, payload));
|
||||
});
|
||||
}
|
||||
|
||||
public static void bootstrapMultipartCommon() {
|
||||
MultipartFramework.bootstrap(
|
||||
AntarchyFabricNetworking::createMultipartPart,
|
||||
new MultipartFramework.NetworkBridge() {
|
||||
@Override
|
||||
public void sendAttack(java.util.UUID parentId, int partIndex, float damage) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendInteract(java.util.UUID parentId, int partIndex, int handId) {
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public static MultipartPartEntity createMultipartPart(MultipartEntityOwner owner, int partIndex, com.craisinlord.antarchy.content.entity.multipart.MultipartPartDefinition spec) {
|
||||
return new MultipartPartEntity(AntarchyFabricEntities.KRAKEN_PART.get(), ((Entity) owner).level())
|
||||
.antarchy$configure(owner, partIndex, spec);
|
||||
}
|
||||
|
||||
private static void registerServerReceivers() {
|
||||
registerC2SReceiver(GravityGunPrimaryPayload.TYPE, GravityGunPrimaryPayload.STREAM_CODEC, AntarchyFabricNetworking::handleGravityGunPrimary);
|
||||
registerC2SReceiver(GravityGunScrollPayload.TYPE, GravityGunScrollPayload.STREAM_CODEC, AntarchyFabricNetworking::handleGravityGunScroll);
|
||||
registerC2SReceiver(BigBerthaModeCyclePayload.TYPE, BigBerthaModeCyclePayload.STREAM_CODEC, AntarchyFabricNetworking::handleBigBerthaModeCycle);
|
||||
registerC2SReceiver(DiamondMinecartInputPayload.TYPE, DiamondMinecartInputPayload.STREAM_CODEC, AntarchyFabricNetworking::handleDiamondMinecartInput);
|
||||
registerC2SReceiver(BrutalflyElytraFlapPayload.TYPE, BrutalflyElytraFlapPayload.STREAM_CODEC, AntarchyFabricNetworking::handleBrutalflyFlap);
|
||||
registerC2SReceiver(JumpyBootsLaunchPayload.TYPE, JumpyBootsLaunchPayload.STREAM_CODEC, AntarchyFabricNetworking::handleJumpyBootsLaunch);
|
||||
registerC2SReceiver(DorrieJumpInputPayload.TYPE, DorrieJumpInputPayload.STREAM_CODEC, AntarchyFabricNetworking::handleDorrieJumpInput);
|
||||
registerC2SReceiver(com.craisinlord.antarchy.content.network.DorrieChargeJumpPayload.TYPE, com.craisinlord.antarchy.content.network.DorrieChargeJumpPayload.STREAM_CODEC, AntarchyFabricNetworking::handleDorrieChargeJumpInput);
|
||||
registerC2SReceiver(HerculesBeetleJumpInputPayload.TYPE, HerculesBeetleJumpInputPayload.STREAM_CODEC, AntarchyFabricNetworking::handleHerculesBeetleJumpInput);
|
||||
registerC2SReceiver(HerculesBeetleFlightTogglePayload.TYPE, HerculesBeetleFlightTogglePayload.STREAM_CODEC, AntarchyFabricNetworking::handleHerculesBeetleFlightToggle);
|
||||
registerC2SReceiver(HerculesBeetleMountedAttackPayload.TYPE, HerculesBeetleMountedAttackPayload.STREAM_CODEC, AntarchyFabricNetworking::handleHerculesBeetleMountedAttack);
|
||||
registerC2SReceiver(HerculesBeetleMountedChargePayload.TYPE, HerculesBeetleMountedChargePayload.STREAM_CODEC, AntarchyFabricNetworking::handleHerculesBeetleMountedCharge);
|
||||
registerC2SReceiver(MultipartAttackPayload.TYPE, MultipartAttackPayload.STREAM_CODEC, AntarchyFabricNetworking::handleMultipartAttack);
|
||||
registerC2SReceiver(MultipartInteractPayload.TYPE, MultipartInteractPayload.STREAM_CODEC, AntarchyFabricNetworking::handleMultipartInteract);
|
||||
}
|
||||
|
||||
public static void syncGravityToPlayer(ServerPlayer target, Entity entity) {
|
||||
GravityStatePayload payload = new GravityStatePayload(
|
||||
entity.getId(),
|
||||
AntarchyGravityApi.getGravityDirection(entity),
|
||||
AntarchyGravityApi.getPrevGravityDirection(entity),
|
||||
AntarchyGravityApi.isGravityForced(entity),
|
||||
AntarchyGravityApi.getTransitionDuration(entity),
|
||||
AntarchyGravityApi.getTransitionRemaining(entity)
|
||||
);
|
||||
sendToPlayer(target, payload, GravityStatePayload.STREAM_CODEC, GravityStatePayload.TYPE);
|
||||
}
|
||||
|
||||
public static void syncGravityEntity(Entity entity) {
|
||||
GravityStatePayload payload = new GravityStatePayload(
|
||||
entity.getId(),
|
||||
AntarchyGravityApi.getGravityDirection(entity),
|
||||
AntarchyGravityApi.getPrevGravityDirection(entity),
|
||||
AntarchyGravityApi.isGravityForced(entity),
|
||||
AntarchyGravityApi.getTransitionDuration(entity),
|
||||
AntarchyGravityApi.getTransitionRemaining(entity)
|
||||
);
|
||||
|
||||
for (ServerPlayer player : PlayerLookup.tracking(entity)) {
|
||||
sendToPlayer(player, payload, GravityStatePayload.STREAM_CODEC, GravityStatePayload.TYPE);
|
||||
}
|
||||
if (entity instanceof ServerPlayer player) {
|
||||
sendToPlayer(player, payload, GravityStatePayload.STREAM_CODEC, GravityStatePayload.TYPE);
|
||||
}
|
||||
}
|
||||
|
||||
public static void syncBloodglass(ServerPlayer player, int shieldsActive, int shieldsMax) {
|
||||
sendToPlayer(player, new BloodglassStatePayload(shieldsActive, shieldsMax), BloodglassStatePayload.STREAM_CODEC, BloodglassStatePayload.TYPE);
|
||||
}
|
||||
|
||||
public static void syncKatanaTrail(Entity entity, int durationTicks) {
|
||||
BloodCrystalKatanaTrailPayload payload = new BloodCrystalKatanaTrailPayload(entity.getId(), durationTicks);
|
||||
for (ServerPlayer player : PlayerLookup.tracking(entity)) {
|
||||
sendToPlayer(player, payload, BloodCrystalKatanaTrailPayload.STREAM_CODEC, BloodCrystalKatanaTrailPayload.TYPE);
|
||||
}
|
||||
if (entity instanceof ServerPlayer serverPlayer) {
|
||||
sendToPlayer(serverPlayer, payload, BloodCrystalKatanaTrailPayload.STREAM_CODEC, BloodCrystalKatanaTrailPayload.TYPE);
|
||||
}
|
||||
}
|
||||
|
||||
public static void syncScorpionWhipTether(ServerPlayer player, int targetId) {
|
||||
ScorpionWhipTetherPayload payload = new ScorpionWhipTetherPayload(player.getId(), targetId);
|
||||
for (ServerPlayer tracking : PlayerLookup.tracking(player)) {
|
||||
sendToPlayer(tracking, payload, ScorpionWhipTetherPayload.STREAM_CODEC, ScorpionWhipTetherPayload.TYPE);
|
||||
}
|
||||
sendToPlayer(player, payload, ScorpionWhipTetherPayload.STREAM_CODEC, ScorpionWhipTetherPayload.TYPE);
|
||||
}
|
||||
|
||||
public static void syncThoraxisWeather(ServerLevel level, ThoraxisWeatherSnapshot snapshot) {
|
||||
ThoraxisWeatherPayload payload = new ThoraxisWeatherPayload(
|
||||
snapshot.dimension(),
|
||||
snapshot.kind(),
|
||||
snapshot.expiresAt(),
|
||||
snapshot.anchor().getX(),
|
||||
snapshot.anchor().getY(),
|
||||
snapshot.anchor().getZ()
|
||||
);
|
||||
for (ServerPlayer player : level.players()) {
|
||||
sendToPlayer(player, payload, ThoraxisWeatherPayload.STREAM_CODEC, ThoraxisWeatherPayload.TYPE);
|
||||
}
|
||||
}
|
||||
|
||||
public static void handleGravityState(Entity contextPlayer, GravityStatePayload payload) {
|
||||
Entity entity = contextPlayer.level().getEntity(payload.entityId());
|
||||
if (entity == null && contextPlayer.getId() == payload.entityId()) {
|
||||
entity = contextPlayer;
|
||||
}
|
||||
if (entity == null) {
|
||||
return;
|
||||
}
|
||||
AntarchyGravityApi.applySyncedState(
|
||||
entity,
|
||||
payload.direction(),
|
||||
payload.previousDirection(),
|
||||
payload.forced(),
|
||||
payload.transitionDuration(),
|
||||
payload.transitionRemaining()
|
||||
);
|
||||
}
|
||||
|
||||
private static void handleGravityGunPrimary(ServerPlayer player, GravityGunPrimaryPayload payload) {
|
||||
if (!(player.getMainHandItem().getItem() instanceof GravityGunItem gravityGunItem)) {
|
||||
return;
|
||||
}
|
||||
gravityGunItem.firePrimary(player.serverLevel(), player, player.getMainHandItem());
|
||||
}
|
||||
|
||||
private static void handleGravityGunScroll(ServerPlayer player, GravityGunScrollPayload payload) {
|
||||
if (!(player.getMainHandItem().getItem() instanceof GravityGunItem)) {
|
||||
return;
|
||||
}
|
||||
GravityGunItem.adjustHeldDistance(player.getMainHandItem(), payload.distanceDelta());
|
||||
}
|
||||
|
||||
private static void handleBigBerthaModeCycle(ServerPlayer player, BigBerthaModeCyclePayload payload) {
|
||||
if (!(player.getMainHandItem().getItem() instanceof BigBerthaItem bigBerthaItem)) {
|
||||
return;
|
||||
}
|
||||
bigBerthaItem.tryCycleModeWhileCoolingDown(player.serverLevel(), player, player.getMainHandItem());
|
||||
}
|
||||
|
||||
private static void handleDiamondMinecartInput(ServerPlayer player, DiamondMinecartInputPayload payload) {
|
||||
if (player.getVehicle() instanceof DiamondMinecartEntity cart) {
|
||||
cart.onInputReceived(payload.inputFlags());
|
||||
}
|
||||
}
|
||||
|
||||
private static void handleBrutalflyFlap(ServerPlayer player, BrutalflyElytraFlapPayload payload) {
|
||||
ItemStack chestStack = player.getItemBySlot(EquipmentSlot.CHEST);
|
||||
if (!(chestStack.getItem() instanceof BrutalflyElytraItem)) {
|
||||
return;
|
||||
}
|
||||
if (player.isSpectator() || !player.isFallFlying() || player.isPassenger()) {
|
||||
return;
|
||||
}
|
||||
if (player.getCooldowns().isOnCooldown(chestStack.getItem())) {
|
||||
return;
|
||||
}
|
||||
|
||||
BrutalflyElytraFlightHelper.FlapTier tier = BrutalflyElytraFlightHelper.resolveFlapTier(payload.chargeTicks());
|
||||
if (tier == BrutalflyElytraFlightHelper.FlapTier.FAIL) {
|
||||
return;
|
||||
}
|
||||
|
||||
float lift = BrutalflyElytraFlightHelper.liftFor(tier);
|
||||
float forwardBoost = BrutalflyElytraFlightHelper.forwardBoostFor(tier);
|
||||
Vec3 look = player.getLookAngle();
|
||||
Vec3 boost = new Vec3(look.x * forwardBoost, lift, look.z * forwardBoost);
|
||||
player.setDeltaMovement(player.getDeltaMovement().add(boost));
|
||||
player.hasImpulse = true;
|
||||
player.hurtMarked = true;
|
||||
player.resetFallDistance();
|
||||
player.connection.send(new ClientboundSetEntityMotionPacket(player));
|
||||
chestStack.hurtAndBreak(1, player, p -> p.broadcastBreakEvent(EquipmentSlot.CHEST));
|
||||
player.getCooldowns().addCooldown(chestStack.getItem(), BrutalflyElytraFlightHelper.FLAP_COOLDOWN_TICKS);
|
||||
player.level().playSound(null, player.blockPosition(), SoundEvents.PHANTOM_FLAP, SoundSource.PLAYERS, 0.9F,
|
||||
tier == BrutalflyElytraFlightHelper.FlapTier.PERFECT ? 0.8F : tier == BrutalflyElytraFlightHelper.FlapTier.GOOD ? 0.95F : 1.1F);
|
||||
|
||||
BrutalflyElytraAnimationPayload animationPayload = new BrutalflyElytraAnimationPayload(
|
||||
player.getId(),
|
||||
BrutalflyElytraFlightHelper.animationTicksFor(tier),
|
||||
lift
|
||||
);
|
||||
for (ServerPlayer tracking : PlayerLookup.tracking(player)) {
|
||||
sendToPlayer(tracking, animationPayload, BrutalflyElytraAnimationPayload.STREAM_CODEC, BrutalflyElytraAnimationPayload.TYPE);
|
||||
}
|
||||
sendToPlayer(player, animationPayload, BrutalflyElytraAnimationPayload.STREAM_CODEC, BrutalflyElytraAnimationPayload.TYPE);
|
||||
}
|
||||
|
||||
private static void handleMultipartAttack(ServerPlayer serverPlayer, MultipartAttackPayload payload) {
|
||||
Entity entity = serverPlayer.serverLevel().getEntity(payload.parentId());
|
||||
if (!(entity instanceof MultipartEntityOwner owner)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Entity[] parts = owner.antarchy$getMultipartParts();
|
||||
if (parts == null) {
|
||||
parts = owner.antarchy$createMultipartParts();
|
||||
owner.antarchy$setMultipartParts(parts);
|
||||
owner.antarchy$syncMultipartParts();
|
||||
}
|
||||
if (payload.partIndex() < 0 || payload.partIndex() >= parts.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
Entity part = parts[payload.partIndex()];
|
||||
if (part == null || part.isRemoved()) {
|
||||
return;
|
||||
}
|
||||
if (serverPlayer.distanceToSqr(part) > 10000.0D) {
|
||||
return;
|
||||
}
|
||||
|
||||
serverPlayer.attack(part);
|
||||
}
|
||||
|
||||
private static void handleMultipartInteract(ServerPlayer serverPlayer, MultipartInteractPayload payload) {
|
||||
Entity entity = serverPlayer.serverLevel().getEntity(payload.parentId());
|
||||
if (!(entity instanceof MultipartEntityOwner owner)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Entity[] parts = owner.antarchy$getMultipartParts();
|
||||
if (parts == null) {
|
||||
parts = owner.antarchy$createMultipartParts();
|
||||
owner.antarchy$setMultipartParts(parts);
|
||||
owner.antarchy$syncMultipartParts();
|
||||
}
|
||||
if (payload.partIndex() < 0 || payload.partIndex() >= parts.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
Entity part = parts[payload.partIndex()];
|
||||
if (part == null || part.isRemoved()) {
|
||||
return;
|
||||
}
|
||||
|
||||
InteractionHand hand = payload.handId() == 0 ? InteractionHand.MAIN_HAND : InteractionHand.OFF_HAND;
|
||||
owner.antarchy$interactMultipartPart(part, serverPlayer, part.position(), hand);
|
||||
}
|
||||
|
||||
private static void handleJumpyBootsLaunch(ServerPlayer player, JumpyBootsLaunchPayload payload) {
|
||||
if (!JumpyBootsItem.isWearingJumpyBoots(player)) return;
|
||||
if (player.isSpectator() || player.isPassenger()) return;
|
||||
|
||||
ItemStack boots = player.getItemBySlot(EquipmentSlot.FEET);
|
||||
if (player.getCooldowns().isOnCooldown(boots.getItem())) return;
|
||||
|
||||
int clampedCharge = Math.min(payload.chargeTicks(), JumpyBootsHelper.CHARGE_TICKS_MAX);
|
||||
if (clampedCharge <= 0) return;
|
||||
|
||||
float verticalBoost = JumpyBootsHelper.verticalBoostFor(clampedCharge);
|
||||
Vec3 current = player.getDeltaMovement();
|
||||
double newX = current.x;
|
||||
double newZ = current.z;
|
||||
|
||||
if (payload.sprinting()) {
|
||||
Vec3 look = player.getLookAngle();
|
||||
newX += look.x * JumpyBootsHelper.SPRINT_FORWARD_BOOST;
|
||||
newZ += look.z * JumpyBootsHelper.SPRINT_FORWARD_BOOST;
|
||||
}
|
||||
|
||||
player.setDeltaMovement(newX, verticalBoost, newZ);
|
||||
player.setPos(player.getX(), player.getY() + 0.001, player.getZ());
|
||||
player.hasImpulse = true;
|
||||
player.hurtMarked = true;
|
||||
player.resetFallDistance();
|
||||
player.connection.send(new ClientboundSetEntityMotionPacket(player));
|
||||
|
||||
player.level().playSound(null, player.blockPosition(), SoundEvents.SLIME_JUMP, SoundSource.PLAYERS,
|
||||
1.0F, 0.6F + (clampedCharge / (float) JumpyBootsHelper.CHARGE_TICKS_MAX) * 0.6F);
|
||||
|
||||
JumpyBootsFabricHelper.setProtectionUntil(player,
|
||||
player.level().getGameTime() + JumpyBootsHelper.FALL_PROTECTION_TICKS);
|
||||
|
||||
player.getCooldowns().addCooldown(boots.getItem(), JumpyBootsHelper.COOLDOWN_TICKS);
|
||||
}
|
||||
|
||||
private static void handleDorrieJumpInput(ServerPlayer player, DorrieJumpInputPayload payload) {
|
||||
if (!(player.getVehicle() instanceof DorrieEntity dorrie)) return;
|
||||
dorrie.setPressingJump(payload.pressing());
|
||||
}
|
||||
|
||||
private static void handleDorrieChargeJumpInput(ServerPlayer player, com.craisinlord.antarchy.content.network.DorrieChargeJumpPayload payload) {
|
||||
if (!(player.getVehicle() instanceof DorrieEntity dorrie)) return;
|
||||
if (payload.pressing()) {
|
||||
dorrie.startJumpCharge();
|
||||
} else {
|
||||
dorrie.releaseJump();
|
||||
}
|
||||
}
|
||||
|
||||
private static void handleHerculesBeetleJumpInput(ServerPlayer player, HerculesBeetleJumpInputPayload payload) {
|
||||
if (player.getVehicle() instanceof HerculesBeetleEntity beetle) {
|
||||
beetle.setRiderJumpPressed(payload.pressing());
|
||||
}
|
||||
}
|
||||
|
||||
private static void handleHerculesBeetleMountedAttack(ServerPlayer player, HerculesBeetleMountedAttackPayload payload) {
|
||||
if (player.getVehicle() instanceof HerculesBeetleEntity beetle) {
|
||||
beetle.handleMountedRegularAttack(player);
|
||||
}
|
||||
}
|
||||
|
||||
private static void handleHerculesBeetleFlightToggle(ServerPlayer player, HerculesBeetleFlightTogglePayload payload) {
|
||||
if (player.getVehicle() instanceof HerculesBeetleEntity beetle) {
|
||||
beetle.toggleMountedFlight(player);
|
||||
}
|
||||
}
|
||||
|
||||
private static void handleHerculesBeetleMountedCharge(ServerPlayer player, HerculesBeetleMountedChargePayload payload) {
|
||||
if (player.getVehicle() instanceof HerculesBeetleEntity beetle) {
|
||||
if (payload.pressing()) {
|
||||
beetle.startMountedCharge(player);
|
||||
} else {
|
||||
beetle.releaseMountedCharge(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void triggerHerculesBeetleImpactShake(int durationTicks) {
|
||||
HerculesBeetleImpactShakeClientState.trigger(durationTicks);
|
||||
}
|
||||
|
||||
public static void triggerImpactShake(ImpactShakePayload payload) {
|
||||
CameraShakeClientState.triggerImpact(
|
||||
new Vec3(payload.x(), payload.y(), payload.z()),
|
||||
payload.intensity(),
|
||||
payload.durationTicks(),
|
||||
payload.radius()
|
||||
);
|
||||
}
|
||||
}
|
||||
+1192
File diff suppressed because it is too large.
Load diff
+53
@@ -0,0 +1,53 @@
|
||||
package com.craisinlord.antarchy.fabric.registry;
|
||||
|
||||
import com.craisinlord.antarchy.Antarchy;
|
||||
import com.craisinlord.antarchy.content.creative.CreativeTabContents;
|
||||
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.world.item.CreativeModeTab;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
public final class AntarchyFabricCreativeModeTabs {
|
||||
|
||||
public static final DeferredRegister<CreativeModeTab> CREATIVE_MODE_TABS = DeferredRegister.create(Registries.CREATIVE_MODE_TAB, Antarchy.MODID);
|
||||
|
||||
|
||||
|
||||
public static final DeferredHolder<CreativeModeTab, CreativeModeTab> ANTARCHY_TAB = CREATIVE_MODE_TABS.register("antarchy",
|
||||
() -> CreativeModeTab.builder(CreativeModeTab.Row.TOP, 0)
|
||||
.title(net.minecraft.network.chat.Component.translatable("itemGroup.antarchy.antarchy"))
|
||||
.icon(() -> new ItemStack(AntarchyFabricItems.GRAVITY_GUN.get()))
|
||||
.displayItems((parameters, output) -> populateCreativeTab(output))
|
||||
.build());
|
||||
private static void populateCreativeTab(CreativeModeTab.Output output) {
|
||||
CreativeTabContents.populateAntarchyTab(new CreativeTabContents.AntarchyTabOutput() {
|
||||
@Override
|
||||
public void accept(net.minecraft.world.level.ItemLike item) {
|
||||
output.accept(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(ItemStack stack) {
|
||||
output.accept(stack);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public static void register() {
|
||||
CREATIVE_MODE_TABS.register();
|
||||
ItemGroupEvents.modifyEntriesEvent(net.minecraft.world.item.CreativeModeTabs.REDSTONE_BLOCKS).register(entries -> {
|
||||
entries.accept(AntarchyFabricItems.BLUESTONE_DUST.get());
|
||||
entries.accept(AntarchyFabricItems.BLUESTONE_BLOCK_ITEM.get());
|
||||
entries.accept(AntarchyFabricItems.BLUESTONE_TORCH_ITEM.get());
|
||||
entries.accept(AntarchyFabricItems.BLUESTONE_REPEATER_ITEM.get());
|
||||
entries.accept(AntarchyFabricItems.BLUESTONE_COMPARATOR_ITEM.get());
|
||||
entries.accept(AntarchyFabricItems.BLUESTONE_ORE_ITEM.get());
|
||||
entries.accept(AntarchyFabricItems.ANTIMETAL_RAIL_ITEM.get());
|
||||
entries.accept(AntarchyFabricItems.ANTIMETAL_POWERED_RAIL_ITEM.get());
|
||||
entries.accept(AntarchyFabricItems.ANTIMETAL_DETECTOR_RAIL_ITEM.get());
|
||||
entries.accept(AntarchyFabricItems.ANTIMETAL_ACTIVATOR_RAIL_ITEM.get());
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
+523
@@ -0,0 +1,523 @@
|
||||
package com.craisinlord.antarchy.fabric.registry;
|
||||
|
||||
import com.craisinlord.antarchy.Antarchy;
|
||||
import com.craisinlord.antarchy.content.entity.AppleCowEntityVariants.AppleCow;
|
||||
import com.craisinlord.antarchy.content.entity.AppleCowEntityVariants.EnchantedGoldenAppleCow;
|
||||
import com.craisinlord.antarchy.content.entity.AppleCowEntityVariants.GoldenAppleCow;
|
||||
import com.craisinlord.antarchy.content.entity.cloud_shark.CloudSharkEntity;
|
||||
import com.craisinlord.antarchy.content.entity.BedBugEntity;
|
||||
import com.craisinlord.antarchy.content.entity.ButterflyEntity;
|
||||
import com.craisinlord.antarchy.content.entity.CaterpillarEntity;
|
||||
import com.craisinlord.antarchy.content.entity.DiamondMinecartEntity;
|
||||
import com.craisinlord.antarchy.content.entity.DrTrayaurusEntity;
|
||||
import com.craisinlord.antarchy.content.entity.brutalfly.BrutalflyEntity;
|
||||
import com.craisinlord.antarchy.content.entity.brutalfly.BrutalflyOrbEntity;
|
||||
import com.craisinlord.antarchy.content.entity.EasterBunnyEntity;
|
||||
import com.craisinlord.antarchy.content.entity.flying_squirrel.FlyingSquirrelEntity;
|
||||
import com.craisinlord.antarchy.content.entity.ReverieEntity;
|
||||
import com.craisinlord.antarchy.content.entity.MissileSquidEntity;
|
||||
import com.craisinlord.antarchy.content.entity.lucid.LucidEntity;
|
||||
import com.craisinlord.antarchy.content.entity.lucid.LucidBoltEntity;
|
||||
import com.craisinlord.antarchy.content.entity.lucid.LucidEyeProjectileEntity;
|
||||
import com.craisinlord.antarchy.content.entity.HushProjectileEntity;
|
||||
import com.craisinlord.antarchy.content.entity.CritterCageProjectileEntity;
|
||||
import com.craisinlord.antarchy.content.entity.JumpyBugEntity;
|
||||
import com.craisinlord.antarchy.content.entity.StinkBugEntity;
|
||||
import com.craisinlord.antarchy.content.entity.OuranwoodBoatEntity;
|
||||
import com.craisinlord.antarchy.content.entity.OuranwoodChestBoatEntity;
|
||||
import com.craisinlord.antarchy.content.entity.AlphaMantisEntity;
|
||||
import com.craisinlord.antarchy.content.entity.MantisEntity;
|
||||
import com.craisinlord.antarchy.content.entity.RollyPollyEntity;
|
||||
import com.craisinlord.antarchy.content.entity.basilisk.BasiliskEntity;
|
||||
import com.craisinlord.antarchy.content.entity.EmperorScorpionEntity;
|
||||
import com.craisinlord.antarchy.content.entity.ScorpionEntity;
|
||||
import com.craisinlord.antarchy.content.entity.nightmare.NightmareEntity;
|
||||
import com.craisinlord.antarchy.content.entity.ToreterrorEntity;
|
||||
import com.craisinlord.antarchy.content.entity.WaterBombEntity;
|
||||
import com.craisinlord.antarchy.content.entity.kraken.KrakenEntity;
|
||||
import com.craisinlord.antarchy.content.entity.kraken.KrakensGraspThrownTrident;
|
||||
import com.craisinlord.antarchy.content.entity.kraken.TentacleEntity;
|
||||
import com.craisinlord.antarchy.content.entity.OctopusBombEntity;
|
||||
import com.craisinlord.antarchy.content.entity.MolevoreEntity;
|
||||
import com.craisinlord.antarchy.content.entity.MolewormEntity;
|
||||
import com.craisinlord.antarchy.content.entity.BomberEntity;
|
||||
import com.craisinlord.antarchy.content.entity.SizeRayProjectileEntity;
|
||||
import com.craisinlord.antarchy.content.entity.TriffidEntity;
|
||||
import com.craisinlord.antarchy.content.entity.WaspEntity;
|
||||
import com.craisinlord.antarchy.content.entity.ant.BaseAntEntity;
|
||||
import com.craisinlord.antarchy.content.entity.ant.BrownAntEntity;
|
||||
import com.craisinlord.antarchy.content.entity.ant.RainbowAntEntity;
|
||||
import com.craisinlord.antarchy.content.entity.ant.RedAntEntity;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.MobCategory;
|
||||
import net.minecraft.world.entity.animal.Cow;
|
||||
|
||||
public final class AntarchyFabricEntities {
|
||||
|
||||
public static final DeferredRegister<EntityType<?>> ENTITY_TYPES = DeferredRegister.create(Registries.ENTITY_TYPE, Antarchy.MODID);
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<RedAntEntity>> RED_ANT = ENTITY_TYPES.register("red_ant",
|
||||
() -> buildAntType(RedAntEntity::new, MobCategory.CREATURE, "red_ant"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<BrownAntEntity>> BROWN_ANT = ENTITY_TYPES.register("brown_ant",
|
||||
() -> buildAntType(BrownAntEntity::new, MobCategory.CREATURE, "brown_ant"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<RainbowAntEntity>> RAINBOW_ANT = ENTITY_TYPES.register("rainbow_ant",
|
||||
() -> buildAntType(RainbowAntEntity::new, MobCategory.CREATURE, "rainbow_ant"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<com.craisinlord.antarchy.content.entity.ant.TermiteEntity>> TERMITE = ENTITY_TYPES.register("termite",
|
||||
() -> buildAntType(com.craisinlord.antarchy.content.entity.ant.TermiteEntity::new, MobCategory.CREATURE, "termite"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<RollyPollyEntity>> ROLLY_POLLY = ENTITY_TYPES.register("rolly_polly",
|
||||
() -> EntityType.Builder.of(RollyPollyEntity::new, MobCategory.CREATURE)
|
||||
.sized(0.95F, 0.85F)
|
||||
.clientTrackingRange(10)
|
||||
.build("rolly_polly"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<MolewormEntity>> MOLEWORM = ENTITY_TYPES.register("moleworm",
|
||||
() -> EntityType.Builder.of(MolewormEntity::new, MobCategory.MONSTER)
|
||||
.sized(0.4F, 0.3F)
|
||||
.clientTrackingRange(8)
|
||||
.build("moleworm"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<MantisEntity>> MANTIS = ENTITY_TYPES.register("mantis",
|
||||
() -> EntityType.Builder.of(MantisEntity::new, MobCategory.MONSTER)
|
||||
.sized(3.125F, 2.5F)
|
||||
.clientTrackingRange(8)
|
||||
.build("mantis"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<AlphaMantisEntity>> ALPHA_MANTIS = ENTITY_TYPES.register("alpha_mantis",
|
||||
() -> EntityType.Builder.of(AlphaMantisEntity::new, MobCategory.MONSTER)
|
||||
.sized(4.25F, 3.35F)
|
||||
.clientTrackingRange(10)
|
||||
.build("alpha_mantis"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<OuranwoodBoatEntity>> OURANWOOD_BOAT_ENTITY = ENTITY_TYPES.register("ouranwood_boat",
|
||||
() -> EntityType.Builder.<OuranwoodBoatEntity>of(OuranwoodBoatEntity::new, MobCategory.MISC)
|
||||
.sized(1.375F, 0.5625F)
|
||||
.clientTrackingRange(10)
|
||||
.updateInterval(10)
|
||||
.build("ouranwood_boat"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<OuranwoodChestBoatEntity>> OURANWOOD_CHEST_BOAT_ENTITY = ENTITY_TYPES.register("ouranwood_chest_boat",
|
||||
() -> EntityType.Builder.<OuranwoodChestBoatEntity>of(OuranwoodChestBoatEntity::new, MobCategory.MISC)
|
||||
.sized(1.375F, 0.5625F)
|
||||
.clientTrackingRange(10)
|
||||
.updateInterval(10)
|
||||
.build("ouranwood_chest_boat"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<com.craisinlord.antarchy.content.entity.PeachBoatEntity>> PEACH_BOAT_ENTITY = ENTITY_TYPES.register("peach_boat",
|
||||
() -> EntityType.Builder.<com.craisinlord.antarchy.content.entity.PeachBoatEntity>of(com.craisinlord.antarchy.content.entity.PeachBoatEntity::new, MobCategory.MISC)
|
||||
.sized(1.375F, 0.5625F)
|
||||
.clientTrackingRange(10)
|
||||
.updateInterval(10)
|
||||
.build("peach_boat"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<com.craisinlord.antarchy.content.entity.PeachChestBoatEntity>> PEACH_CHEST_BOAT_ENTITY = ENTITY_TYPES.register("peach_chest_boat",
|
||||
() -> EntityType.Builder.<com.craisinlord.antarchy.content.entity.PeachChestBoatEntity>of(com.craisinlord.antarchy.content.entity.PeachChestBoatEntity::new, MobCategory.MISC)
|
||||
.sized(1.375F, 0.5625F)
|
||||
.clientTrackingRange(10)
|
||||
.updateInterval(10)
|
||||
.build("peach_chest_boat"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<MolevoreEntity>> MOLEVORE = ENTITY_TYPES.register("molevore",
|
||||
() -> EntityType.Builder.of(MolevoreEntity::new, MobCategory.MONSTER)
|
||||
.sized(1.95F, 1.1F)
|
||||
.clientTrackingRange(10)
|
||||
.build("molevore"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<TriffidEntity>> TRIFFID = ENTITY_TYPES.register("triffid",
|
||||
() -> EntityType.Builder.of(TriffidEntity::new, MobCategory.MONSTER)
|
||||
.sized(2.0F, 5.0F)
|
||||
.clientTrackingRange(10)
|
||||
.build("triffid"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<BedBugEntity>> BED_BUG = ENTITY_TYPES.register("bed_bug",
|
||||
() -> EntityType.Builder.of(BedBugEntity::new, MobCategory.CREATURE)
|
||||
.sized(1.15F, 0.8F)
|
||||
.clientTrackingRange(8)
|
||||
.build("bed_bug"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<StinkBugEntity>> STINK_BUG = ENTITY_TYPES.register("stink_bug",
|
||||
() -> EntityType.Builder.of(StinkBugEntity::new, MobCategory.CREATURE)
|
||||
.sized(0.35F, 0.2F)
|
||||
.clientTrackingRange(8)
|
||||
.build("stink_bug"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<WaspEntity>> WASP = ENTITY_TYPES.register("wasp",
|
||||
() -> EntityType.Builder.of(WaspEntity::new, MobCategory.MONSTER)
|
||||
.sized(0.8625F, 1.365F)
|
||||
.clientTrackingRange(8)
|
||||
.build("wasp"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<BomberEntity>> BOMBER = ENTITY_TYPES.register("bomber",
|
||||
() -> EntityType.Builder.of(BomberEntity::new, MobCategory.MONSTER)
|
||||
.sized(0.55F, 0.75F)
|
||||
.clientTrackingRange(8)
|
||||
.build("bomber"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<JumpyBugEntity>> JUMPY_BUG = ENTITY_TYPES.register("jumpy_bug",
|
||||
() -> EntityType.Builder.of(JumpyBugEntity::new, MobCategory.MONSTER)
|
||||
.sized(3.0F, 6.0F)
|
||||
.clientTrackingRange(8)
|
||||
.build("jumpy_bug"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<com.craisinlord.antarchy.content.entity.SpitBugEntity>> SPIT_BUG = ENTITY_TYPES.register("spit_bug",
|
||||
() -> EntityType.Builder.of(com.craisinlord.antarchy.content.entity.SpitBugEntity::new, MobCategory.MONSTER)
|
||||
.sized(2.5F, 3.0F)
|
||||
.clientTrackingRange(10)
|
||||
.build("spit_bug"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<com.craisinlord.antarchy.content.entity.SpitBugProjectileEntity>> SPIT_BUG_PROJECTILE = ENTITY_TYPES.register("spit_bug_projectile",
|
||||
() -> EntityType.Builder.<com.craisinlord.antarchy.content.entity.SpitBugProjectileEntity>of(com.craisinlord.antarchy.content.entity.SpitBugProjectileEntity::new, MobCategory.MISC)
|
||||
.sized(0.5F, 0.5F)
|
||||
.clientTrackingRange(8)
|
||||
.updateInterval(1)
|
||||
.build("spit_bug_projectile"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<SizeRayProjectileEntity>> SHRINK_RAY_PROJECTILE = ENTITY_TYPES.register("shrink_ray_projectile",
|
||||
() -> EntityType.Builder.<SizeRayProjectileEntity>of(SizeRayProjectileEntity::createShrink, MobCategory.MISC)
|
||||
.sized(0.5F, 0.5F)
|
||||
.clientTrackingRange(8)
|
||||
.updateInterval(1)
|
||||
.build("shrink_ray_projectile"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<SizeRayProjectileEntity>> GROWTH_RAY_PROJECTILE = ENTITY_TYPES.register("growth_ray_projectile",
|
||||
() -> EntityType.Builder.<SizeRayProjectileEntity>of(SizeRayProjectileEntity::createGrowth, MobCategory.MISC)
|
||||
.sized(0.5F, 0.5F)
|
||||
.clientTrackingRange(8)
|
||||
.updateInterval(1)
|
||||
.build("growth_ray_projectile"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<DiamondMinecartEntity>> DIAMOND_MINECART = ENTITY_TYPES.register("diamond_minecart",
|
||||
() -> EntityType.Builder.<DiamondMinecartEntity>of((entityType, level) -> new DiamondMinecartEntity(entityType, level, AntarchyFabricItems.diamondMinecartItem()), MobCategory.MISC)
|
||||
.sized(0.98F, 0.7F)
|
||||
.clientTrackingRange(8)
|
||||
.build("diamond_minecart"));
|
||||
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<EasterBunnyEntity>> EASTER_BUNNY = ENTITY_TYPES.register("easter_bunny",
|
||||
() -> EntityType.Builder.of(EasterBunnyEntity::new, MobCategory.CREATURE)
|
||||
.sized(0.5F, 1.0F)
|
||||
.clientTrackingRange(8)
|
||||
.build("easter_bunny"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<FlyingSquirrelEntity>> FLYING_SQUIRREL = ENTITY_TYPES.register("flying_squirrel",
|
||||
() -> EntityType.Builder.of(FlyingSquirrelEntity::new, MobCategory.CREATURE)
|
||||
.sized(0.6F, 0.7F)
|
||||
.clientTrackingRange(8)
|
||||
.build("flying_squirrel"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<CaterpillarEntity>> CATERPILLAR = ENTITY_TYPES.register("caterpillar",
|
||||
() -> EntityType.Builder.of(CaterpillarEntity::new, MobCategory.CREATURE)
|
||||
.sized(0.8775F, 0.585F)
|
||||
.clientTrackingRange(8)
|
||||
.build("caterpillar"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<ButterflyEntity>> BUTTERFLY = ENTITY_TYPES.register("butterfly",
|
||||
() -> EntityType.Builder.of(ButterflyEntity::new, MobCategory.AMBIENT)
|
||||
.sized(1.125F, 0.6875F)
|
||||
.clientTrackingRange(8)
|
||||
.build("butterfly"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<ReverieEntity>> REVERIE = ENTITY_TYPES.register("reverie",
|
||||
() -> EntityType.Builder.of(ReverieEntity::new, MobCategory.AMBIENT)
|
||||
.sized(0.7F, 0.7F)
|
||||
.clientTrackingRange(8)
|
||||
.build("reverie"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<BrutalflyEntity>> BRUTALFLY = ENTITY_TYPES.register("brutalfly",
|
||||
() -> EntityType.Builder.of(BrutalflyEntity::new, MobCategory.MONSTER)
|
||||
.sized(2.4F, 2.1F)
|
||||
.clientTrackingRange(12)
|
||||
.build("brutalfly"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<AppleCow>> APPLE_COW = ENTITY_TYPES.register("apple_cow",
|
||||
() -> buildCowType(AppleCow::new, "apple_cow"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<GoldenAppleCow>> GOLDEN_APPLE_COW = ENTITY_TYPES.register("golden_apple_cow",
|
||||
() -> buildCowType(GoldenAppleCow::new, "golden_apple_cow"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<EnchantedGoldenAppleCow>> ENCHANTED_GOLDEN_APPLE_COW = ENTITY_TYPES.register("enchanted_golden_apple_cow",
|
||||
() -> buildCowType(EnchantedGoldenAppleCow::new, "enchanted_golden_apple_cow"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<DrTrayaurusEntity>> DR_TRAYAURUS = ENTITY_TYPES.register("dr_trayaurus",
|
||||
() -> EntityType.Builder.of(DrTrayaurusEntity::new, MobCategory.MISC)
|
||||
.sized(0.6F, 1.95F)
|
||||
.clientTrackingRange(10)
|
||||
.build("dr_trayaurus"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<CloudSharkEntity>> CLOUD_SHARK = ENTITY_TYPES.register("cloud_shark",
|
||||
() -> EntityType.Builder.of(CloudSharkEntity::new, MobCategory.MONSTER)
|
||||
.sized(2.4F, 0.9F)
|
||||
.clientTrackingRange(10)
|
||||
.build("cloud_shark"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<KrakenEntity>> KRAKEN = ENTITY_TYPES.register("kraken",
|
||||
() -> EntityType.Builder.of(KrakenEntity::new, MobCategory.MONSTER)
|
||||
.sized(11.4F, 39.0F)
|
||||
.clientTrackingRange(12)
|
||||
.build("kraken"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<com.craisinlord.antarchy.fabric.entity.multipart.MultipartPartEntity>> KRAKEN_PART = ENTITY_TYPES.register("kraken_part",
|
||||
() -> EntityType.Builder.<com.craisinlord.antarchy.fabric.entity.multipart.MultipartPartEntity>of(
|
||||
com.craisinlord.antarchy.fabric.entity.multipart.MultipartPartEntity::new,
|
||||
MobCategory.MISC
|
||||
)
|
||||
.sized(1.0F, 1.0F)
|
||||
.clientTrackingRange(12)
|
||||
.updateInterval(1)
|
||||
.build("kraken_part"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<MissileSquidEntity>> MISSILE_SQUID = ENTITY_TYPES.register("missile_squid",
|
||||
() -> EntityType.Builder.of(MissileSquidEntity::new, MobCategory.MONSTER)
|
||||
.sized(1.62F, 3.18F)
|
||||
.clientTrackingRange(10)
|
||||
.build("missile_squid"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<OctopusBombEntity>> OCTOPUS_BOMB = ENTITY_TYPES.register("octopus_bomb",
|
||||
() -> EntityType.Builder.of(OctopusBombEntity::new, MobCategory.WATER_CREATURE)
|
||||
.sized(2.4F, 2.9F)
|
||||
.clientTrackingRange(10)
|
||||
.build("octopus_bomb"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<NightmareEntity>> NIGHTMARE = ENTITY_TYPES.register("nightmare",
|
||||
() -> EntityType.Builder.of(NightmareEntity::new, MobCategory.MONSTER)
|
||||
.sized(3.2F, 3.8F)
|
||||
.clientTrackingRange(12)
|
||||
.build("nightmare"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<LucidEntity>> LUCID = ENTITY_TYPES.register("lucid",
|
||||
() -> EntityType.Builder.of(LucidEntity::new, MobCategory.MONSTER)
|
||||
.sized(2.0F, 2.0F)
|
||||
.clientTrackingRange(10)
|
||||
.build("lucid"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<LucidBoltEntity>> LUCID_BOLT = ENTITY_TYPES.register("lucid_bolt",
|
||||
() -> EntityType.Builder.<LucidBoltEntity>of(LucidBoltEntity::new, MobCategory.MISC)
|
||||
.sized(0.3F, 0.3F)
|
||||
.clientTrackingRange(8)
|
||||
.updateInterval(1)
|
||||
.build("lucid_bolt"));
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<KrakensGraspThrownTrident>> KRAKENS_GRASP_TRIDENT = ENTITY_TYPES.register("krakens_grasp_trident",
|
||||
() -> EntityType.Builder.<KrakensGraspThrownTrident>of(KrakensGraspThrownTrident::new, MobCategory.MISC)
|
||||
.sized(0.5F, 0.5F)
|
||||
.clientTrackingRange(8)
|
||||
.updateInterval(1)
|
||||
.fireImmune()
|
||||
.build("krakens_grasp_trident"));
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<TentacleEntity>> TENTACLE = ENTITY_TYPES.register("tentacle",
|
||||
() -> EntityType.Builder.of(TentacleEntity::new, MobCategory.MISC)
|
||||
.sized(1.2F, 4.5F)
|
||||
.clientTrackingRange(10)
|
||||
.build("tentacle"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<ScorpionEntity>> SCORPION = ENTITY_TYPES.register("scorpion",
|
||||
() -> EntityType.Builder.of(ScorpionEntity::new, MobCategory.MONSTER)
|
||||
.sized(1.5F, 1.0F)
|
||||
.clientTrackingRange(8)
|
||||
.build("scorpion"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<BasiliskEntity>> BASILISK = ENTITY_TYPES.register("basilisk",
|
||||
() -> EntityType.Builder.of(BasiliskEntity::new, MobCategory.MONSTER)
|
||||
.sized(3.0F, 3.5F)
|
||||
.clientTrackingRange(14)
|
||||
.build("basilisk"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<EmperorScorpionEntity>> EMPEROR_SCORPION = ENTITY_TYPES.register("emperor_scorpion",
|
||||
() -> EntityType.Builder.of(EmperorScorpionEntity::new, MobCategory.MONSTER)
|
||||
.sized(6.0F, 3.0F)
|
||||
.clientTrackingRange(12)
|
||||
.build("emperor_scorpion"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<LucidEyeProjectileEntity>> LUCID_PEARL_PROJECTILE = ENTITY_TYPES.register("lucid_pearl_projectile",
|
||||
() -> EntityType.Builder.<LucidEyeProjectileEntity>of(LucidEyeProjectileEntity::new, MobCategory.MISC)
|
||||
.sized(0.25F, 0.25F)
|
||||
.clientTrackingRange(8)
|
||||
.updateInterval(1)
|
||||
.build("lucid_pearl_projectile"));
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<CritterCageProjectileEntity>> CRITTER_CAGE_PROJECTILE = ENTITY_TYPES.register("critter_cage_projectile",
|
||||
() -> EntityType.Builder.<CritterCageProjectileEntity>of(CritterCageProjectileEntity::new, MobCategory.MISC)
|
||||
.sized(0.25F, 0.25F)
|
||||
.clientTrackingRange(8)
|
||||
.updateInterval(1)
|
||||
.build("critter_cage_projectile"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<HushProjectileEntity>> HUSH_PROJECTILE = ENTITY_TYPES.register("hush_projectile",
|
||||
() -> EntityType.Builder.<HushProjectileEntity>of(HushProjectileEntity::new, MobCategory.MISC)
|
||||
.sized(0.35F, 0.35F)
|
||||
.clientTrackingRange(8)
|
||||
.updateInterval(1)
|
||||
.build("hush_projectile"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<BrutalflyOrbEntity>> BRUTALFLY_ORB = ENTITY_TYPES.register("brutalfly_orb",
|
||||
() -> EntityType.Builder.<BrutalflyOrbEntity>of(BrutalflyOrbEntity::new, MobCategory.MISC)
|
||||
.sized(0.75F, 0.75F)
|
||||
.clientTrackingRange(10)
|
||||
.updateInterval(1)
|
||||
.build("brutalfly_orb"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<com.craisinlord.antarchy.content.entity.UpwardFallingBlockEntity>> UPWARD_FALLING_BLOCK = ENTITY_TYPES.register("upward_falling_block",
|
||||
() -> EntityType.Builder.<com.craisinlord.antarchy.content.entity.UpwardFallingBlockEntity>of(
|
||||
com.craisinlord.antarchy.content.entity.UpwardFallingBlockEntity::new, MobCategory.MISC)
|
||||
.sized(0.98F, 0.98F)
|
||||
.clientTrackingRange(10)
|
||||
.updateInterval(1)
|
||||
.build("upward_falling_block"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<ToreterrorEntity>> TORETERROR = ENTITY_TYPES.register("toreterror",
|
||||
() -> EntityType.Builder.of(ToreterrorEntity::new, MobCategory.MONSTER)
|
||||
.sized(2.0F, 3.0F)
|
||||
.clientTrackingRange(14)
|
||||
.build("toreterror"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<WaterBombEntity>> WATER_BOMB = ENTITY_TYPES.register("water_bomb",
|
||||
() -> EntityType.Builder.<WaterBombEntity>of(WaterBombEntity::new, MobCategory.MISC)
|
||||
.sized(0.4F, 0.4F)
|
||||
.clientTrackingRange(8)
|
||||
.updateInterval(1)
|
||||
.build("water_bomb"));
|
||||
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<com.craisinlord.antarchy.content.entity.CreepingHorrorEntity>> CREEPING_HORROR = ENTITY_TYPES.register("creeping_horror",
|
||||
() -> EntityType.Builder.of(com.craisinlord.antarchy.content.entity.CreepingHorrorEntity::new, MobCategory.MONSTER)
|
||||
.sized(1.3F, 1.5F)
|
||||
.clientTrackingRange(10)
|
||||
.build("creeping_horror"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<com.craisinlord.antarchy.content.entity.LurkingTerrorEntity>> LURKING_TERROR = ENTITY_TYPES.register("lurking_terror",
|
||||
() -> EntityType.Builder.of(com.craisinlord.antarchy.content.entity.LurkingTerrorEntity::new, MobCategory.MONSTER)
|
||||
.sized(1.3F, 1.5F)
|
||||
.clientTrackingRange(10)
|
||||
.build("lurking_terror"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<com.craisinlord.antarchy.content.entity.JerryEntity>> JERRY = ENTITY_TYPES.register("jerry",
|
||||
() -> EntityType.Builder.of(com.craisinlord.antarchy.content.entity.JerryEntity::new, MobCategory.MONSTER)
|
||||
.sized(1.4F, 1.4F)
|
||||
.clientTrackingRange(10)
|
||||
.build("jerry"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<com.craisinlord.antarchy.content.entity.CheepEntity>> CHEEP = ENTITY_TYPES.register("cheep",
|
||||
() -> EntityType.Builder.of(com.craisinlord.antarchy.content.entity.CheepEntity::new, MobCategory.WATER_AMBIENT)
|
||||
.sized(1.0F, 1.2F)
|
||||
.clientTrackingRange(8)
|
||||
.build("cheep"));
|
||||
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<com.craisinlord.antarchy.content.entity.DorrieEntity>> DORRIE = ENTITY_TYPES.register("dorrie",
|
||||
() -> EntityType.Builder.of(com.craisinlord.antarchy.content.entity.DorrieEntity::new, MobCategory.CREATURE)
|
||||
.sized(1.6F, 1.4F)
|
||||
.clientTrackingRange(10)
|
||||
.build("dorrie"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<com.craisinlord.antarchy.content.entity.HerculesBeetleEntity>> HERCULES_BEETLE = ENTITY_TYPES.register("hercules_beetle",
|
||||
() -> EntityType.Builder.of(com.craisinlord.antarchy.content.entity.HerculesBeetleEntity::new, MobCategory.MONSTER)
|
||||
.sized(3.0F, 4.0F)
|
||||
.clientTrackingRange(12)
|
||||
.build("hercules_beetle"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<com.craisinlord.antarchy.content.entity.OuranwoodDeerEntity>> OURANWOOD_DEER = ENTITY_TYPES.register("ouranwood_deer",
|
||||
() -> EntityType.Builder.of(com.craisinlord.antarchy.content.entity.OuranwoodDeerEntity::new, MobCategory.CREATURE)
|
||||
.sized(1.125F, 1.75F)
|
||||
.clientTrackingRange(8)
|
||||
.build("ouranwood_deer"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<com.craisinlord.antarchy.content.entity.glimmer.GlimmerEntity>> GLIMMER = ENTITY_TYPES.register("glimmer",
|
||||
() -> EntityType.Builder.of(com.craisinlord.antarchy.content.entity.glimmer.GlimmerEntity::new, MobCategory.CREATURE)
|
||||
.sized(0.9F, 1.4F)
|
||||
.clientTrackingRange(8)
|
||||
.build("glimmer"));
|
||||
|
||||
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<com.craisinlord.antarchy.content.entity.ElkaEntity>> ELKA = ENTITY_TYPES.register("elka",
|
||||
() -> EntityType.Builder.of(com.craisinlord.antarchy.content.entity.ElkaEntity::new, MobCategory.CREATURE)
|
||||
.sized(2.2F, 3.5F)
|
||||
.clientTrackingRange(10)
|
||||
.build("elka"));
|
||||
|
||||
|
||||
|
||||
private static <T extends Cow> EntityType<T> buildCowType(EntityType.EntityFactory<T> factory, String name) {
|
||||
return EntityType.Builder.of(factory, MobCategory.CREATURE)
|
||||
.sized(0.9F, 1.4F)
|
||||
.clientTrackingRange(10)
|
||||
.build(name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static <T extends BaseAntEntity> EntityType<T> buildAntType(EntityType.EntityFactory<T> factory, MobCategory category, String name) {
|
||||
return EntityType.Builder.of(factory, category)
|
||||
.sized(0.6375F, 0.2125F)
|
||||
.clientTrackingRange(8)
|
||||
.build(name);
|
||||
}
|
||||
|
||||
|
||||
public static void register() {
|
||||
ENTITY_TYPES.register();
|
||||
}
|
||||
|
||||
}
|
||||
+128
@@ -0,0 +1,128 @@
|
||||
package com.craisinlord.antarchy.fabric.registry;
|
||||
|
||||
import com.craisinlord.antarchy.config.AntarchySettings;
|
||||
import com.craisinlord.antarchy.content.entity.cloud_shark.CloudSharkEntity;
|
||||
import com.craisinlord.antarchy.content.entity.BedBugEntity;
|
||||
import com.craisinlord.antarchy.content.entity.ButterflyEntity;
|
||||
import com.craisinlord.antarchy.content.entity.CaterpillarEntity;
|
||||
import com.craisinlord.antarchy.content.entity.brutalfly.BrutalflyEntity;
|
||||
import com.craisinlord.antarchy.content.entity.flying_squirrel.FlyingSquirrelEntity;
|
||||
import com.craisinlord.antarchy.content.entity.ReverieEntity;
|
||||
import com.craisinlord.antarchy.content.entity.MissileSquidEntity;
|
||||
import com.craisinlord.antarchy.content.entity.lucid.LucidEntity;
|
||||
import com.craisinlord.antarchy.content.entity.JumpyBugEntity;
|
||||
import com.craisinlord.antarchy.content.entity.StinkBugEntity;
|
||||
import com.craisinlord.antarchy.content.entity.AlphaMantisEntity;
|
||||
import com.craisinlord.antarchy.content.entity.MantisEntity;
|
||||
import com.craisinlord.antarchy.content.entity.RollyPollyEntity;
|
||||
import com.craisinlord.antarchy.content.entity.basilisk.BasiliskEntity;
|
||||
import com.craisinlord.antarchy.content.entity.EmperorScorpionEntity;
|
||||
import com.craisinlord.antarchy.content.entity.ScorpionEntity;
|
||||
import com.craisinlord.antarchy.content.entity.nightmare.NightmareEntity;
|
||||
import com.craisinlord.antarchy.content.entity.ToreterrorEntity;
|
||||
import com.craisinlord.antarchy.content.entity.kraken.KrakenEntity;
|
||||
import com.craisinlord.antarchy.content.entity.kraken.TentacleEntity;
|
||||
import com.craisinlord.antarchy.content.entity.OctopusBombEntity;
|
||||
import com.craisinlord.antarchy.content.entity.MolevoreEntity;
|
||||
import com.craisinlord.antarchy.content.entity.MolewormEntity;
|
||||
import com.craisinlord.antarchy.content.entity.BomberEntity;
|
||||
import com.craisinlord.antarchy.content.entity.TriffidEntity;
|
||||
import com.craisinlord.antarchy.content.entity.WaspEntity;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.entity.FabricDefaultAttributeRegistry;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
import net.minecraft.world.entity.animal.Cow;
|
||||
import net.minecraft.world.entity.animal.Rabbit;
|
||||
import net.minecraft.world.entity.npc.Villager;
|
||||
|
||||
public final class AntarchyFabricEntityAttributes {
|
||||
|
||||
|
||||
private static AttributeSupplier.Builder buildAntAttributes(double health, double speed, double attackDamage) {
|
||||
return net.minecraft.world.entity.Mob.createMobAttributes()
|
||||
.add(Attributes.MAX_HEALTH, health)
|
||||
.add(Attributes.MOVEMENT_SPEED, speed)
|
||||
.add(Attributes.ATTACK_DAMAGE, attackDamage);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void register() {
|
||||
FabricDefaultAttributeRegistry.register(
|
||||
net.minecraft.world.entity.EntityType.PLAYER,
|
||||
net.minecraft.world.entity.player.Player.createAttributes()
|
||||
.add(AntarchyFabricMisc.SCALE.get())
|
||||
.add(AntarchyFabricMisc.DOUBLE_DAMAGE_CHANCE.get())
|
||||
.add(AntarchyFabricMisc.BLOODGLASS_MAX_HEARTS.get())
|
||||
.build()
|
||||
);
|
||||
|
||||
AttributeSupplier rabbitAttributes = Rabbit.createAttributes().build();
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.EASTER_BUNNY.get(), rabbitAttributes);
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.FLYING_SQUIRREL.get(), FlyingSquirrelEntity.createAttributes().build());
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.CATERPILLAR.get(), CaterpillarEntity.createAttributes().build());
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.BUTTERFLY.get(), ButterflyEntity.createAttributes().build());
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.REVERIE.get(), ReverieEntity.createAttributes().build());
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.BRUTALFLY.get(), BrutalflyEntity.createAttributes().build());
|
||||
|
||||
AttributeSupplier cowAttributes = Cow.createAttributes().build();
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.APPLE_COW.get(), cowAttributes);
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.GOLDEN_APPLE_COW.get(), cowAttributes);
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.ENCHANTED_GOLDEN_APPLE_COW.get(), cowAttributes);
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.DR_TRAYAURUS.get(), Villager.createAttributes().build());
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.CLOUD_SHARK.get(), CloudSharkEntity.createAttributes().build());
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.KRAKEN.get(), KrakenEntity.createAttributes().build());
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.MISSILE_SQUID.get(), MissileSquidEntity.createAttributes().build());
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.OCTOPUS_BOMB.get(), OctopusBombEntity.createAttributes().build());
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.TENTACLE.get(), TentacleEntity.createAttributes().build());
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.NIGHTMARE.get(), NightmareEntity.createAttributes().build());
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.BED_BUG.get(), BedBugEntity.createAttributes().build());
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.STINK_BUG.get(), StinkBugEntity.createAttributes().build());
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.WASP.get(), WaspEntity.createAttributes().build());
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.BOMBER.get(), BomberEntity.createAttributes().build());
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.JUMPY_BUG.get(), JumpyBugEntity.createAttributes().build());
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.SPIT_BUG.get(), com.craisinlord.antarchy.content.entity.SpitBugEntity.createAttributes().build());
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.MANTIS.get(), MantisEntity.createAttributes().build());
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.ALPHA_MANTIS.get(), AlphaMantisEntity.createAttributes().build());
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.ROLLY_POLLY.get(), RollyPollyEntity.createAttributes().build());
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.TRIFFID.get(), TriffidEntity.createAttributes().build());
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.LUCID.get(), LucidEntity.createAttributes().build());
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.SCORPION.get(), ScorpionEntity.createAttributes().build());
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.BASILISK.get(), BasiliskEntity.createAttributes().build());
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.EMPEROR_SCORPION.get(), EmperorScorpionEntity.createAttributes().build());
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.TORETERROR.get(), ToreterrorEntity.createAttributes().build());
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.CREEPING_HORROR.get(), com.craisinlord.antarchy.content.entity.CreepingHorrorEntity.createAttributes().build());
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.LURKING_TERROR.get(), com.craisinlord.antarchy.content.entity.LurkingTerrorEntity.createAttributes().build());
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.JERRY.get(), com.craisinlord.antarchy.content.entity.JerryEntity.createAttributes().build());
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.CHEEP.get(), com.craisinlord.antarchy.content.entity.CheepEntity.createAttributes().build());
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.DORRIE.get(), com.craisinlord.antarchy.content.entity.DorrieEntity.createAttributes().build());
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.HERCULES_BEETLE.get(), com.craisinlord.antarchy.content.entity.HerculesBeetleEntity.createAttributes().build());
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.OURANWOOD_DEER.get(), com.craisinlord.antarchy.content.entity.OuranwoodDeerEntity.createAttributes().build());
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.GLIMMER.get(), com.craisinlord.antarchy.content.entity.glimmer.GlimmerEntity.createAttributes().build());
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.ELKA.get(), com.craisinlord.antarchy.content.entity.ElkaEntity.createAttributes().build());
|
||||
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.RED_ANT.get(), buildAntAttributes(
|
||||
AntarchySettings.redAntHealth(),
|
||||
AntarchySettings.redAntMovementSpeed(),
|
||||
AntarchySettings.redAntAttackDamage()
|
||||
).build());
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.BROWN_ANT.get(), buildAntAttributes(
|
||||
AntarchySettings.brownAntHealth(),
|
||||
AntarchySettings.brownAntMovementSpeed(),
|
||||
AntarchySettings.brownAntAttackDamage()
|
||||
).build());
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.RAINBOW_ANT.get(), buildAntAttributes(
|
||||
AntarchySettings.rainbowAntHealth(),
|
||||
AntarchySettings.rainbowAntMovementSpeed(),
|
||||
AntarchySettings.rainbowAntAttackDamage()
|
||||
).build());
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.TERMITE.get(), buildAntAttributes(
|
||||
AntarchySettings.termiteHealth(),
|
||||
AntarchySettings.termiteMovementSpeed(),
|
||||
AntarchySettings.termiteAttackDamage()
|
||||
).build());
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.MOLEWORM.get(), MolewormEntity.createAttributes().build());
|
||||
FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.MOLEVORE.get(), MolevoreEntity.createAttributes().build());
|
||||
}
|
||||
|
||||
}
|
||||
+1500
File diff suppressed because it is too large.
Load diff
+901
@@ -0,0 +1,901 @@
|
||||
package com.craisinlord.antarchy.fabric.registry;
|
||||
|
||||
import com.craisinlord.antarchy.Antarchy;
|
||||
import com.craisinlord.antarchy.config.AntarchySettings;
|
||||
import com.craisinlord.antarchy.content.recipe.AmericanizeRecipe;
|
||||
import com.craisinlord.antarchy.content.worldgen.ants.BrownAntNestFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.ants.RainbowAntNestFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.ants.RedAntNestFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.ants.TermiteNestFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.cavaryn.CavarynBileCystFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.cavaryn.CavarynBileVeinFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.cavaryn.CavarynCreepvineFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.cavaryn.CavarynWallAmberMossFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.cavaryn.HangingCreeprootsFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.cavaryn.MoltingVinesFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.ocean.SeashellFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.overworld.CornPatchFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.thoraxis.NyxiteSpikeConfiguration;
|
||||
import com.craisinlord.antarchy.content.worldgen.thoraxis.AntiwaterSpringsConfiguration;
|
||||
import com.craisinlord.antarchy.content.worldgen.thoraxis.AntiwaterSpringsFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.thoraxis.NyxiteSpikeFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.thoraxis.PotentNyxiteFeature;
|
||||
import com.craisinlord.antarchy.fabric.content.fluid.AntiwaterFluid;
|
||||
import com.craisinlord.antarchy.content.effect.DreadMobEffect;
|
||||
import com.craisinlord.antarchy.content.effect.GoopedMobEffect;
|
||||
import com.craisinlord.antarchy.content.effect.GrowthMobEffect;
|
||||
import com.craisinlord.antarchy.content.effect.InvertedMobEffect;
|
||||
import com.craisinlord.antarchy.content.effect.ParalyzedMobEffect;
|
||||
import com.craisinlord.antarchy.content.effect.ShrinkMobEffect;
|
||||
import com.craisinlord.antarchy.content.effect.StinkyMobEffect;
|
||||
import com.craisinlord.antarchy.content.worldgen.elythia.CoralSpikeFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.elythia.ElythiaBiomeSource;
|
||||
import com.craisinlord.antarchy.content.worldgen.elythia.ElythiaRiverCarveFunction;
|
||||
import com.craisinlord.antarchy.content.worldgen.elythia.ElythiaFloraFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.elythia.ElythiaLargeTuffBoulderFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.elythia.PeachForestMossyBoulderFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.elythia.PeachForestPondConfiguration;
|
||||
import com.craisinlord.antarchy.content.worldgen.elythia.PeachForestPondFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.elythia.ElythiaPondFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.elythia.ElythiaSurfaceCoverFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.elythia.ElythiaTuffBoulderFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.elythia.ElythiaUndergroundFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.elythia.MolewormCaveEntranceFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.elythia.MolewormSurfaceMoundsFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.elythia.BrutalflyCocoonFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.elythia.LumenPoolFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.elythia.LumenLilyPadFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.elythia.LumenStreamFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.elythia.LumenSpireFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.elythia.MolewormTunnelsFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.elythia.MolewormWarrensFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.elythia.OuranwoodCocoonTreeFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.elythia.OuranwoodTreeConfiguration;
|
||||
import com.craisinlord.antarchy.content.worldgen.elythia.OuranwoodTreeFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.elythia.PeachTreeConfiguration;
|
||||
import com.craisinlord.antarchy.content.worldgen.elythia.PeachTreeFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.elythia.TriffidPatchFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.cavaryn.CavarynEggPatchFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.cavaryn.ChitenSpikeConfiguration;
|
||||
import com.craisinlord.antarchy.content.worldgen.cavaryn.ChitenSpikeFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.thoraxis.BedBugNestFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.thoraxis.BedBugSurfaceClusterFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.thoraxis.CloudSeaCalciteFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.thoraxis.LucidAntiwaterPoolFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.thoraxis.ThoraxisBiomeSource;
|
||||
import com.craisinlord.antarchy.content.worldgen.thoraxis.ThoraxisDuneConfiguration;
|
||||
import com.craisinlord.antarchy.content.worldgen.thoraxis.ThoraxisDuneFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.thoraxis.ThoraxisFissureConfiguration;
|
||||
import com.craisinlord.antarchy.content.worldgen.thoraxis.ThoraxisFissureFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.thoraxis.ThoraxisBloodCrystalConfiguration;
|
||||
import com.craisinlord.antarchy.content.worldgen.thoraxis.ThoraxisBloodCrystalFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.thoraxis.ThoraxisAntiwaterPoolConfiguration;
|
||||
import com.craisinlord.antarchy.content.worldgen.thoraxis.ThoraxisAntiwaterPoolFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.thoraxis.ThoraxisRibColumnsConfiguration;
|
||||
import com.craisinlord.antarchy.content.worldgen.thoraxis.ThoraxisRibColumnsFeature;
|
||||
import com.craisinlord.antarchy.content.worldgen.thoraxis.ThoraxisSpikeConfiguration;
|
||||
import com.craisinlord.antarchy.content.worldgen.thoraxis.ThoraxisSpikeFeature;
|
||||
import com.craisinlord.antarchy.content.client.particle.InvertedGeyserBaseParticleOptions;
|
||||
import com.craisinlord.antarchy.content.client.particle.InvertedGeyserParticleOptions;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import net.minecraft.advancements.critereon.EntitySubPredicate;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.world.item.alchemy.Potion;
|
||||
import net.minecraft.world.effect.MobEffect;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.damagesource.DamageType;
|
||||
import net.minecraft.world.entity.ai.attributes.Attribute;
|
||||
import net.minecraft.world.item.ArmorItem;
|
||||
import net.minecraft.world.item.ArmorMaterial;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
import net.minecraft.world.flag.FeatureFlags;
|
||||
import net.minecraft.core.particles.ParticleType;
|
||||
import net.minecraft.core.particles.SimpleParticleType;
|
||||
import net.minecraft.world.level.biome.BiomeSource;
|
||||
import net.minecraft.world.level.levelgen.DensityFunction;
|
||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.SimpleBlockConfiguration;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import com.craisinlord.antarchy.fabric.AntarchyFabricContent;
|
||||
|
||||
public final class AntarchyFabricMisc {
|
||||
|
||||
private static final java.util.Map<ArmorItem.Type, Integer> BASE_DURABILITY = java.util.Map.of(
|
||||
ArmorItem.Type.BOOTS, 13,
|
||||
ArmorItem.Type.LEGGINGS, 15,
|
||||
ArmorItem.Type.CHESTPLATE, 16,
|
||||
ArmorItem.Type.HELMET, 11
|
||||
);
|
||||
|
||||
private static ArmorMaterial armorMaterial(
|
||||
int durabilityMultiplier,
|
||||
java.util.Map<ArmorItem.Type, Integer> defense,
|
||||
int enchantmentValue,
|
||||
net.minecraft.sounds.SoundEvent equipSound,
|
||||
java.util.function.Supplier<Ingredient> repairIngredient,
|
||||
float toughness,
|
||||
float knockbackResistance,
|
||||
String name
|
||||
) {
|
||||
return new ArmorMaterial() {
|
||||
@Override
|
||||
public int getDurabilityForType(ArmorItem.Type type) {
|
||||
return BASE_DURABILITY.get(type) * durabilityMultiplier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDefenseForType(ArmorItem.Type type) {
|
||||
return defense.getOrDefault(type, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnchantmentValue() {
|
||||
return enchantmentValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public net.minecraft.sounds.SoundEvent getEquipSound() {
|
||||
return equipSound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ingredient getRepairIngredient() {
|
||||
return repairIngredient.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return new ResourceLocation(Antarchy.MODID, name).toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getToughness() {
|
||||
return toughness;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getKnockbackResistance() {
|
||||
return knockbackResistance;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public static final DeferredRegister<ParticleType<?>> PARTICLE_TYPES = DeferredRegister.create(Registries.PARTICLE_TYPE, Antarchy.MODID);
|
||||
|
||||
|
||||
public static final DeferredRegister<Feature<?>> FEATURES = DeferredRegister.create(Registries.FEATURE, Antarchy.MODID);
|
||||
|
||||
|
||||
public static final DeferredRegister<com.mojang.serialization.Codec<? extends BiomeSource>> BIOME_SOURCES = DeferredRegister.create(Registries.BIOME_SOURCE, Antarchy.MODID);
|
||||
|
||||
|
||||
public static final DeferredRegister<com.mojang.serialization.Codec<? extends DensityFunction>> DENSITY_FUNCTION_TYPES = DeferredRegister.create(Registries.DENSITY_FUNCTION_TYPE, Antarchy.MODID);
|
||||
|
||||
|
||||
public static final DeferredRegister<Attribute> ATTRIBUTES = DeferredRegister.create(Registries.ATTRIBUTE, Antarchy.MODID);
|
||||
|
||||
|
||||
private static final TagKey<DamageType> BYPASSES_BLOODGLASS =
|
||||
TagKey.create(net.minecraft.core.registries.Registries.DAMAGE_TYPE, new ResourceLocation("antarchy", "bypasses_bloodglass"));
|
||||
|
||||
|
||||
public static final DeferredHolder<Attribute, Attribute> SCALE = ATTRIBUTES.register(
|
||||
"scale",
|
||||
() -> new net.minecraft.world.entity.ai.attributes.RangedAttribute("attribute.antarchy.scale", 1.0, 0.0625, 16.0).setSyncable(true)
|
||||
);
|
||||
|
||||
|
||||
public static final DeferredHolder<Attribute, Attribute> DOUBLE_DAMAGE_CHANCE = ATTRIBUTES.register(
|
||||
"double_damage_chance",
|
||||
() -> new net.minecraft.world.entity.ai.attributes.RangedAttribute("attribute.antarchy.double_damage_chance", 0.0, 0.0, 1.0).setSyncable(true)
|
||||
);
|
||||
|
||||
|
||||
public static final DeferredRegister<MobEffect> MOB_EFFECTS = DeferredRegister.create(Registries.MOB_EFFECT, Antarchy.MODID);
|
||||
|
||||
|
||||
public static final DeferredRegister<Potion> POTIONS = DeferredRegister.create(Registries.POTION, Antarchy.MODID);
|
||||
|
||||
|
||||
public static final DeferredRegister<Fluid> FLUIDS = DeferredRegister.create(Registries.FLUID, Antarchy.MODID);
|
||||
|
||||
|
||||
public static final DeferredRegister<net.minecraft.world.inventory.MenuType<?>> MENUS = DeferredRegister.create(Registries.MENU, Antarchy.MODID);
|
||||
|
||||
|
||||
public static final DeferredRegister<net.minecraft.world.entity.animal.FrogVariant> FROG_VARIANTS = DeferredRegister.create(Registries.FROG_VARIANT, Antarchy.MODID);
|
||||
|
||||
|
||||
public static final DeferredHolder<net.minecraft.world.entity.animal.FrogVariant, net.minecraft.world.entity.animal.FrogVariant> ELYTHIA_FROG_VARIANT = FROG_VARIANTS.register(
|
||||
"elythia",
|
||||
() -> new net.minecraft.world.entity.animal.FrogVariant(com.craisinlord.antarchy.content.entity.ElythiaFrog.TEXTURE)
|
||||
);
|
||||
|
||||
|
||||
public static final DeferredHolder<net.minecraft.world.inventory.MenuType<?>, net.minecraft.world.inventory.MenuType<com.craisinlord.antarchy.content.menu.DorrieInventoryMenu>> DORRIE_INVENTORY_MENU =
|
||||
MENUS.register("dorrie_inventory", () -> new net.minecraft.world.inventory.MenuType<>(com.craisinlord.antarchy.content.menu.DorrieInventoryMenu::new, FeatureFlags.DEFAULT_FLAGS));
|
||||
|
||||
|
||||
public static final DeferredRegister<net.minecraft.world.item.crafting.RecipeSerializer<?>> RECIPE_SERIALIZERS =
|
||||
DeferredRegister.create(Registries.RECIPE_SERIALIZER, Antarchy.MODID);
|
||||
|
||||
|
||||
public static final DeferredHolder<net.minecraft.world.item.crafting.RecipeSerializer<?>, net.minecraft.world.item.crafting.RecipeSerializer<AmericanizeRecipe>> AMERICANIZE_SERIALIZER =
|
||||
RECIPE_SERIALIZERS.register("americanize", () -> AmericanizeRecipe.SERIALIZER);
|
||||
|
||||
|
||||
public static final ArmorMaterial ULTIMATE_ARMOR_MATERIAL = armorMaterial(
|
||||
40, createUltimateArmorDefense(), 10, SoundEvents.ARMOR_EQUIP_DIAMOND,
|
||||
AntarchyFabricItems::ultimateRepairIngredient, 2.0F,
|
||||
(float) AntarchySettings.ultimateArmorKnockbackResistance(), "ultimate_armor");
|
||||
|
||||
|
||||
public static final ArmorMaterial NIGHTMARE_ARMOR_MATERIAL = armorMaterial(
|
||||
37, createNightmareArmorDefense(), 10, SoundEvents.ARMOR_EQUIP_NETHERITE,
|
||||
() -> Ingredient.of(AntarchyFabricItems.NIGHTMARE_SCALE.get()), 3.0F,
|
||||
(float) AntarchySettings.nightmareArmorKnockbackResistance(), "nightmare_armor");
|
||||
|
||||
|
||||
public static final ArmorMaterial PRIMORDIAL_ARMOR_MATERIAL = armorMaterial(
|
||||
33, createPrimordialArmorDefense(), 15, SoundEvents.ARMOR_EQUIP_NETHERITE,
|
||||
() -> Ingredient.of(AntarchyFabricItems.PRIMORDIAL_SCUTE.get()), 3.0F, 0.1F, "primordial");
|
||||
|
||||
|
||||
public static final ArmorMaterial BLOOD_CRYSTAL_ARMOR_MATERIAL = armorMaterial(
|
||||
33, createBloodCrystalArmorDefense(), 30, SoundEvents.ARMOR_EQUIP_DIAMOND,
|
||||
AntarchyFabricItems::bloodCrystalRepairIngredient, 0.0F, 0.0F, "blood_crystal");
|
||||
|
||||
|
||||
public static final ArmorMaterial MOGGLES_ARMOR_MATERIAL = armorMaterial(
|
||||
25, createMogglesArmorDefense(), 12, SoundEvents.ARMOR_EQUIP_GOLD,
|
||||
() -> Ingredient.of(Items.GOLD_INGOT), 0.0F, 0.0F, "moggles");
|
||||
|
||||
|
||||
public static final ArmorMaterial FALLEN_KING_CROWN_ARMOR_MATERIAL = armorMaterial(
|
||||
25, createFallenKingCrownDefense(), 25, SoundEvents.ARMOR_EQUIP_GOLD,
|
||||
() -> Ingredient.of(Items.GOLD_INGOT), 0.0F, 0.0F, "fallen_king_crown");
|
||||
|
||||
|
||||
public static final DeferredHolder<ParticleType<?>, SimpleParticleType> DREAM_FIRE_FLAME = PARTICLE_TYPES.register("dream_fire_flame",
|
||||
() -> simpleParticleType());
|
||||
|
||||
|
||||
public static final DeferredHolder<ParticleType<?>, SimpleParticleType> STINKY_GAS = PARTICLE_TYPES.register("stinky_gas",
|
||||
() -> simpleParticleType());
|
||||
|
||||
|
||||
public static final DeferredHolder<ParticleType<?>, SimpleParticleType> STINKY_FLY = PARTICLE_TYPES.register("stinky_fly",
|
||||
() -> simpleParticleType());
|
||||
|
||||
|
||||
public static final DeferredHolder<ParticleType<?>, SimpleParticleType> PEACH_LEAVES_PARTICLE = PARTICLE_TYPES.register("peach_leaves_particle",
|
||||
() -> simpleParticleType());
|
||||
public static final DeferredHolder<ParticleType<?>, SimpleParticleType> LOTUS_POLLEN = PARTICLE_TYPES.register("lotus_pollen",
|
||||
() -> simpleParticleType());
|
||||
|
||||
|
||||
public static final DeferredHolder<ParticleType<?>, SimpleParticleType> HYPNOTIC_GAS = PARTICLE_TYPES.register("hypnotic_gas",
|
||||
() -> simpleParticleType());
|
||||
|
||||
|
||||
public static final DeferredHolder<ParticleType<?>, SimpleParticleType> HYPNOTIC_GAS_CLOUD = PARTICLE_TYPES.register("hypnotic_gas_cloud",
|
||||
() -> simpleParticleType());
|
||||
|
||||
|
||||
public static final DeferredHolder<ParticleType<?>, SimpleParticleType> HYPNOTIC_GAS_DOWN = PARTICLE_TYPES.register("hypnotic_gas_down",
|
||||
() -> simpleParticleType());
|
||||
|
||||
|
||||
public static final DeferredHolder<ParticleType<?>, SimpleParticleType> HYPNOTIC_GAS_CLOUD_DOWN = PARTICLE_TYPES.register("hypnotic_gas_cloud_down",
|
||||
() -> simpleParticleType());
|
||||
|
||||
|
||||
public static final DeferredHolder<ParticleType<?>, SimpleParticleType> FIREFLY = PARTICLE_TYPES.register("firefly",
|
||||
() -> simpleParticleType());
|
||||
|
||||
|
||||
public static final DeferredHolder<ParticleType<?>, SimpleParticleType> ORANGE_ASH = PARTICLE_TYPES.register("orange_ash",
|
||||
() -> simpleParticleType());
|
||||
|
||||
|
||||
public static final DeferredHolder<ParticleType<?>, ParticleType<InvertedGeyserBaseParticleOptions>> INVERTED_GEYSER_BASE = PARTICLE_TYPES.register("inverted_geyser_base",
|
||||
() -> particleType(InvertedGeyserBaseParticleOptions.deserializer()));
|
||||
|
||||
|
||||
public static final DeferredHolder<ParticleType<?>, ParticleType<InvertedGeyserParticleOptions>> INVERTED_GEYSER_PLUME = PARTICLE_TYPES.register("inverted_geyser_plume",
|
||||
() -> particleType(InvertedGeyserParticleOptions.deserializer()));
|
||||
|
||||
|
||||
public static final DeferredHolder<ParticleType<?>, ParticleType<InvertedGeyserBaseParticleOptions>> INVERTED_GEYSER_POOF = PARTICLE_TYPES.register("inverted_geyser_poof",
|
||||
() -> particleType(InvertedGeyserBaseParticleOptions.deserializer()));
|
||||
|
||||
|
||||
public static final DeferredHolder<ParticleType<?>, ParticleType<InvertedGeyserParticleOptions>> INVERTED_GEYSER_ERUPTION = PARTICLE_TYPES.register("inverted_geyser_eruption",
|
||||
() -> particleType(InvertedGeyserParticleOptions.deserializer()));
|
||||
|
||||
|
||||
public static final DeferredHolder<MobEffect, DreadMobEffect> DREAD = MOB_EFFECTS.register("dread", DreadMobEffect::new);
|
||||
|
||||
|
||||
public static final DeferredHolder<MobEffect, ParalyzedMobEffect> PARALYZED = MOB_EFFECTS.register("paralyzed", ParalyzedMobEffect::new);
|
||||
|
||||
|
||||
public static final DeferredHolder<MobEffect, InvertedMobEffect> INVERTED = MOB_EFFECTS.register("inverted", InvertedMobEffect::new);
|
||||
|
||||
|
||||
public static final DeferredHolder<MobEffect, StinkyMobEffect> STINKY = MOB_EFFECTS.register("stinky", StinkyMobEffect::new);
|
||||
|
||||
|
||||
public static final DeferredHolder<MobEffect, GoopedMobEffect> GOOPED = MOB_EFFECTS.register("gooped", GoopedMobEffect::new);
|
||||
|
||||
|
||||
public static final DeferredHolder<MobEffect, com.craisinlord.antarchy.content.effect.BloodglassWardEffect> BLOODGLASS_WARD = MOB_EFFECTS.register("bloodglass_ward", com.craisinlord.antarchy.content.effect.BloodglassWardEffect::new);
|
||||
|
||||
|
||||
public static final DeferredHolder<Attribute, Attribute> BLOODGLASS_MAX_HEARTS = ATTRIBUTES.register(
|
||||
"bloodglass_max_hearts",
|
||||
() -> new net.minecraft.world.entity.ai.attributes.RangedAttribute("attribute.antarchy.bloodglass_max_hearts", 0.0, 0.0, 8.0).setSyncable(true)
|
||||
);
|
||||
|
||||
|
||||
public static final DeferredHolder<Potion, Potion> DREAD_POTION = POTIONS.register("dread",
|
||||
() -> new Potion(new MobEffectInstance(mobEffectHolder(DREAD), 600)));
|
||||
|
||||
|
||||
public static final DeferredHolder<Potion, Potion> LONG_DREAD = POTIONS.register("long_dread",
|
||||
() -> new Potion("dread", new MobEffectInstance(mobEffectHolder(DREAD), 2400)));
|
||||
|
||||
|
||||
public static final DeferredHolder<Potion, Potion> INVERSION = POTIONS.register("inversion",
|
||||
() -> new Potion(new MobEffectInstance(mobEffectHolder(INVERTED), 600)));
|
||||
|
||||
|
||||
public static final DeferredHolder<Potion, Potion> LONG_INVERSION = POTIONS.register("long_inversion",
|
||||
() -> new Potion("inversion", new MobEffectInstance(mobEffectHolder(INVERTED), 2400)));
|
||||
|
||||
|
||||
public static final DeferredHolder<Potion, Potion> STINKY_POTION = POTIONS.register("stinky",
|
||||
() -> new Potion(new MobEffectInstance(mobEffectHolder(STINKY), 1200)));
|
||||
|
||||
|
||||
public static final DeferredHolder<Potion, Potion> LONG_STINKY = POTIONS.register("long_stinky",
|
||||
() -> new Potion("stinky", new MobEffectInstance(mobEffectHolder(STINKY), 2400)));
|
||||
|
||||
|
||||
public static final DeferredHolder<MobEffect, ShrinkMobEffect> SHRINKING_EFFECT = MOB_EFFECTS.register("shrinking", ShrinkMobEffect::new);
|
||||
|
||||
|
||||
public static final DeferredHolder<MobEffect, GrowthMobEffect> GROWTH_EFFECT = MOB_EFFECTS.register("growth", GrowthMobEffect::new);
|
||||
|
||||
|
||||
public static final DeferredHolder<Potion, Potion> PARALYSIS = POTIONS.register("paralysis",
|
||||
() -> new Potion(new MobEffectInstance(mobEffectHolder(PARALYZED), 200)));
|
||||
|
||||
|
||||
public static final DeferredHolder<Potion, Potion> LONG_PARALYSIS = POTIONS.register("long_paralysis",
|
||||
() -> new Potion("paralysis", new MobEffectInstance(mobEffectHolder(PARALYZED), 400)));
|
||||
|
||||
|
||||
public static final DeferredHolder<Potion, Potion> HASTE = POTIONS.register("haste",
|
||||
() -> new Potion(new MobEffectInstance(MobEffects.DIG_SPEED, 1200, 0)));
|
||||
|
||||
|
||||
public static final DeferredHolder<Potion, Potion> STRONG_HASTE = POTIONS.register("strong_haste",
|
||||
() -> new Potion("haste", new MobEffectInstance(MobEffects.DIG_SPEED, 600, 1)));
|
||||
|
||||
|
||||
public static final DeferredHolder<Potion, Potion> SHRINKING = POTIONS.register("shrinking",
|
||||
() -> new Potion(new MobEffectInstance(mobEffectHolder(SHRINKING_EFFECT), 1200, 0)));
|
||||
|
||||
|
||||
public static final DeferredHolder<Potion, Potion> STRONG_SHRINKING = POTIONS.register("strong_shrinking",
|
||||
() -> new Potion("shrinking", new MobEffectInstance(mobEffectHolder(SHRINKING_EFFECT), 900, 1)));
|
||||
|
||||
|
||||
public static final DeferredHolder<Potion, Potion> EXTREME_SHRINKING = POTIONS.register("extreme_shrinking",
|
||||
() -> new Potion("shrinking", new MobEffectInstance(mobEffectHolder(SHRINKING_EFFECT), 600, 2)));
|
||||
|
||||
|
||||
public static final DeferredHolder<Potion, Potion> GROWING = POTIONS.register("growing",
|
||||
() -> new Potion(new MobEffectInstance(mobEffectHolder(GROWTH_EFFECT), 1200, 0)));
|
||||
|
||||
|
||||
public static final DeferredHolder<Potion, Potion> STRONG_GROWING = POTIONS.register("strong_growing",
|
||||
() -> new Potion("growing", new MobEffectInstance(mobEffectHolder(GROWTH_EFFECT), 900, 1)));
|
||||
|
||||
|
||||
public static final DeferredHolder<Potion, Potion> EXTREME_GROWING = POTIONS.register("extreme_growing",
|
||||
() -> new Potion("growing", new MobEffectInstance(mobEffectHolder(GROWTH_EFFECT), 600, 2)));
|
||||
|
||||
|
||||
public static final DeferredHolder<Fluid, Fluid> BILE = FLUIDS.register("bile",
|
||||
() -> new com.craisinlord.antarchy.fabric.content.fluid.SimpleFluid.Source(
|
||||
() -> AntarchyFabricContent.lookupFlowingFluid("bile"),
|
||||
() -> AntarchyFabricContent.lookupFlowingFluid("flowing_bile"),
|
||||
() -> AntarchyFabricContent.lookupItem("bile_bucket"),
|
||||
"bile",
|
||||
4,
|
||||
1,
|
||||
5
|
||||
));
|
||||
|
||||
|
||||
public static final DeferredHolder<Fluid, Fluid> FLOWING_BILE = FLUIDS.register("flowing_bile",
|
||||
() -> new com.craisinlord.antarchy.fabric.content.fluid.SimpleFluid.Flowing(
|
||||
() -> AntarchyFabricContent.lookupFlowingFluid("bile"),
|
||||
() -> AntarchyFabricContent.lookupFlowingFluid("flowing_bile"),
|
||||
() -> AntarchyFabricContent.lookupItem("bile_bucket"),
|
||||
"bile",
|
||||
4,
|
||||
1,
|
||||
5
|
||||
));
|
||||
|
||||
|
||||
|
||||
public static final DeferredHolder<Fluid, Fluid> ICHOR = FLUIDS.register("ichor",
|
||||
() -> new com.craisinlord.antarchy.fabric.content.fluid.SimpleFluid.Source(
|
||||
() -> AntarchyFabricContent.lookupFlowingFluid("ichor"),
|
||||
() -> AntarchyFabricContent.lookupFlowingFluid("flowing_ichor"),
|
||||
() -> AntarchyFabricContent.lookupItem("ichor_bucket"),
|
||||
"ichor",
|
||||
4,
|
||||
1,
|
||||
5
|
||||
));
|
||||
|
||||
|
||||
public static final DeferredHolder<Fluid, Fluid> FLOWING_ICHOR = FLUIDS.register("flowing_ichor",
|
||||
() -> new com.craisinlord.antarchy.fabric.content.fluid.SimpleFluid.Flowing(
|
||||
() -> AntarchyFabricContent.lookupFlowingFluid("ichor"),
|
||||
() -> AntarchyFabricContent.lookupFlowingFluid("flowing_ichor"),
|
||||
() -> AntarchyFabricContent.lookupItem("ichor_bucket"),
|
||||
"ichor",
|
||||
4,
|
||||
1,
|
||||
5
|
||||
));
|
||||
|
||||
|
||||
|
||||
public static final DeferredHolder<Fluid, Fluid> ANTIWATER = FLUIDS.register("antiwater",
|
||||
AntiwaterFluid.Source::new);
|
||||
|
||||
|
||||
public static final DeferredHolder<Fluid, Fluid> FLOWING_ANTIWATER = FLUIDS.register("flowing_antiwater",
|
||||
AntiwaterFluid.Flowing::new);
|
||||
|
||||
|
||||
public static final DeferredHolder<Fluid, Fluid> LUMEN = FLUIDS.register("lumen",
|
||||
() -> new com.craisinlord.antarchy.fabric.content.fluid.SimpleFluid.Source(
|
||||
() -> AntarchyFabricContent.lookupFlowingFluid("lumen"),
|
||||
() -> AntarchyFabricContent.lookupFlowingFluid("flowing_lumen"),
|
||||
() -> AntarchyFabricContent.lookupItem("lumen_bucket"),
|
||||
"lumen",
|
||||
4,
|
||||
1,
|
||||
5
|
||||
));
|
||||
|
||||
|
||||
public static final DeferredHolder<Fluid, Fluid> FLOWING_LUMEN = FLUIDS.register("flowing_lumen",
|
||||
() -> new com.craisinlord.antarchy.fabric.content.fluid.SimpleFluid.Flowing(
|
||||
() -> AntarchyFabricContent.lookupFlowingFluid("lumen"),
|
||||
() -> AntarchyFabricContent.lookupFlowingFluid("flowing_lumen"),
|
||||
() -> AntarchyFabricContent.lookupItem("lumen_bucket"),
|
||||
"lumen",
|
||||
4,
|
||||
1,
|
||||
5
|
||||
));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, RedAntNestFeature> RED_ANT_NEST_FEATURE = FEATURES.register("red_ant_nest",
|
||||
() -> new RedAntNestFeature(SimpleBlockConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, BrownAntNestFeature> BROWN_ANT_NEST_FEATURE = FEATURES.register("brown_ant_nest",
|
||||
() -> new BrownAntNestFeature(SimpleBlockConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, RainbowAntNestFeature> RAINBOW_ANT_NEST_FEATURE = FEATURES.register("rainbow_ant_nest",
|
||||
() -> new RainbowAntNestFeature(SimpleBlockConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, TermiteNestFeature> TERMITE_NEST_FEATURE = FEATURES.register("termite_nest",
|
||||
() -> new TermiteNestFeature(SimpleBlockConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, OuranwoodTreeFeature> OURANWOOD_LARGE_TREE = FEATURES.register("ouranwood_large_tree",
|
||||
() -> new OuranwoodTreeFeature(OuranwoodTreeConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, OuranwoodTreeFeature> OURANWOOD_YOUNG_TREE = FEATURES.register("ouranwood_young_tree",
|
||||
() -> new OuranwoodTreeFeature(OuranwoodTreeConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, OuranwoodTreeFeature> OURANWOOD_MEDIUM_TREE = FEATURES.register("ouranwood_medium_tree",
|
||||
() -> new OuranwoodTreeFeature(OuranwoodTreeConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, OuranwoodCocoonTreeFeature> OURANWOOD_COCOON_TREE = FEATURES.register("ouranwood_cocoon_tree",
|
||||
() -> new OuranwoodCocoonTreeFeature(OuranwoodTreeConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, PeachTreeFeature> PEACH_TREE_FEATURE = FEATURES.register("peach_tree",
|
||||
() -> new PeachTreeFeature(PeachTreeConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, PeachTreeFeature> PEACH_LARGE_TREE_FEATURE = FEATURES.register("peach_large_tree",
|
||||
() -> new PeachTreeFeature(PeachTreeConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, ElythiaFloraFeature> ELYTHIA_FOREST_FLORA = FEATURES.register("elythia_forest_flora",
|
||||
() -> new ElythiaFloraFeature(NoneFeatureConfiguration.CODEC, ElythiaFloraFeature.Variant.FOREST));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, ElythiaFloraFeature> ELYTHIA_MEADOW_FLORA = FEATURES.register("elythia_meadow_flora",
|
||||
() -> new ElythiaFloraFeature(NoneFeatureConfiguration.CODEC, ElythiaFloraFeature.Variant.MEADOW));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, ElythiaFloraFeature> PEACH_FOREST_FLORA = FEATURES.register("peach_forest_flora",
|
||||
() -> new ElythiaFloraFeature(NoneFeatureConfiguration.CODEC, ElythiaFloraFeature.Variant.PEACH_FOREST));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, ElythiaFloraFeature> FLOWER_FOREST_MILKWEED = FEATURES.register("flower_forest_milkweed",
|
||||
() -> new ElythiaFloraFeature(NoneFeatureConfiguration.CODEC, ElythiaFloraFeature.Variant.FLOWER_FOREST_MILKWEED));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, CornPatchFeature> CORN_PATCH = FEATURES.register("corn_patch",
|
||||
() -> new CornPatchFeature(NoneFeatureConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, com.craisinlord.antarchy.content.worldgen.ocean.StarCoralPatchFeature> STAR_CORAL_PATCH = FEATURES.register("star_coral_patch",
|
||||
() -> new com.craisinlord.antarchy.content.worldgen.ocean.StarCoralPatchFeature(NoneFeatureConfiguration.CODEC));
|
||||
public static final DeferredHolder<Feature<?>, SeashellFeature> SEASHELL_PATCH = FEATURES.register("seashell_patch",
|
||||
() -> new SeashellFeature(NoneFeatureConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, ElythiaFloraFeature> ELYTHIA_BUTTERFLY_FIELDS_FLORA = FEATURES.register("butterfly_fields_flora",
|
||||
() -> new ElythiaFloraFeature(NoneFeatureConfiguration.CODEC, ElythiaFloraFeature.Variant.BUTTERFLY_FIELDS));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, ElythiaSurfaceCoverFeature> ELYTHIA_SURFACE_COVER = FEATURES.register("elythia_surface_cover",
|
||||
() -> new ElythiaSurfaceCoverFeature(NoneFeatureConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, ElythiaUndergroundFeature> ELYTHIA_UNDERGROUND = FEATURES.register("elythia_underground",
|
||||
() -> new ElythiaUndergroundFeature(NoneFeatureConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, BrutalflyCocoonFeature> BRUTALFLY_COCOON = FEATURES.register("brutalfly_cocoon",
|
||||
() -> new BrutalflyCocoonFeature(NoneFeatureConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, MolewormTunnelsFeature> ELYTHIA_MOLEWORM_TUNNELS = FEATURES.register("elythia_moleworm_tunnels",
|
||||
() -> new MolewormTunnelsFeature(NoneFeatureConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, MolewormCaveEntranceFeature> ELYTHIA_MOLEWORM_CAVE_ENTRANCES = FEATURES.register("elythia_moleworm_cave_entrances",
|
||||
() -> new MolewormCaveEntranceFeature(NoneFeatureConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, MolewormWarrensFeature> ELYTHIA_MOLEWORM_WARRENS = FEATURES.register("elythia_moleworm_warrens",
|
||||
() -> new MolewormWarrensFeature(NoneFeatureConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, MolewormSurfaceMoundsFeature> ELYTHIA_MOLEWORM_SURFACE_MOUNDS = FEATURES.register("elythia_moleworm_surface_mounds",
|
||||
() -> new MolewormSurfaceMoundsFeature(NoneFeatureConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, TriffidPatchFeature> TRIFFID_PATCH = FEATURES.register("triffid_patch",
|
||||
() -> new TriffidPatchFeature(NoneFeatureConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<com.mojang.serialization.Codec<? extends BiomeSource>, com.mojang.serialization.Codec<ElythiaBiomeSource>> ELYTHIA_BIOME_SOURCE = BIOME_SOURCES.register("elythia_biome_source",
|
||||
() -> ElythiaBiomeSource.CODEC.codec());
|
||||
|
||||
|
||||
public static final DeferredHolder<com.mojang.serialization.Codec<? extends DensityFunction>, com.mojang.serialization.Codec<ElythiaRiverCarveFunction>> ELYTHIA_RIVER_CARVE = DENSITY_FUNCTION_TYPES.register("elythia_river_carve",
|
||||
() -> ElythiaRiverCarveFunction.KEY_CODEC.codec());
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, ElythiaPondFeature> ELYTHIA_POND = FEATURES.register("elythia_pond",
|
||||
() -> new ElythiaPondFeature(NoneFeatureConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, LumenPoolFeature> LUMEN_POOL = FEATURES.register("lumen_pools",
|
||||
() -> new LumenPoolFeature(NoneFeatureConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, LumenLilyPadFeature> LUMEN_LILY_PADS = FEATURES.register("lumen_lily_pads",
|
||||
() -> new LumenLilyPadFeature(NoneFeatureConfiguration.CODEC));
|
||||
|
||||
public static final DeferredHolder<Feature<?>, com.craisinlord.antarchy.content.worldgen.elythia.GiantLilyPadPatchFeature> GIANT_LILY_PAD_PATCH = FEATURES.register("giant_lily_pad_patch",
|
||||
() -> new com.craisinlord.antarchy.content.worldgen.elythia.GiantLilyPadPatchFeature(NoneFeatureConfiguration.CODEC));
|
||||
|
||||
public static final DeferredHolder<Feature<?>, com.craisinlord.antarchy.content.worldgen.elythia.GiantLilyPadPatchFeature> GIANT_LILY_PAD_PATCH_PEACH_FOREST = FEATURES.register("giant_lily_pad_patch_peach_forest",
|
||||
() -> new com.craisinlord.antarchy.content.worldgen.elythia.GiantLilyPadPatchFeature(NoneFeatureConfiguration.CODEC, 0.12F));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, LumenStreamFeature> LUMEN_STREAM = FEATURES.register("lumen_streams",
|
||||
() -> new LumenStreamFeature(NoneFeatureConfiguration.CODEC));
|
||||
public static final DeferredHolder<Feature<?>, LumenSpireFeature> LUMEN_SPIRE = FEATURES.register("lumen_spires",
|
||||
() -> new LumenSpireFeature(NoneFeatureConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, ElythiaTuffBoulderFeature> ELYTHIA_TUFF_BOULDER = FEATURES.register("elythia_tuff_boulder",
|
||||
() -> new ElythiaTuffBoulderFeature(NoneFeatureConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, ElythiaLargeTuffBoulderFeature> ELYTHIA_LARGE_TUFF_BOULDER = FEATURES.register("elythia_large_tuff_boulder",
|
||||
() -> new ElythiaLargeTuffBoulderFeature(NoneFeatureConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, PeachForestMossyBoulderFeature> PEACH_FOREST_MOSSY_BOULDER = FEATURES.register("peach_forest_mossy_boulder",
|
||||
() -> new PeachForestMossyBoulderFeature(NoneFeatureConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, PeachForestPondFeature> PEACH_FOREST_POND = FEATURES.register("peach_forest_pond",
|
||||
() -> new PeachForestPondFeature(PeachForestPondConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, ThoraxisFissureFeature> THORAXIS_FISSURE = FEATURES.register("thoraxis_fissure",
|
||||
() -> new ThoraxisFissureFeature(ThoraxisFissureConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, ThoraxisRibColumnsFeature> THORAXIS_RIB_COLUMNS = FEATURES.register("thoraxis_rib_columns",
|
||||
() -> new ThoraxisRibColumnsFeature(ThoraxisRibColumnsConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, ThoraxisSpikeFeature> THORAXIS_SPIKE = FEATURES.register("thoraxis_spike",
|
||||
() -> new ThoraxisSpikeFeature(ThoraxisSpikeConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, NyxiteSpikeFeature> NYXITE_SPIKES = FEATURES.register("nyxite_spikes",
|
||||
() -> new NyxiteSpikeFeature(NyxiteSpikeConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, ChitenSpikeFeature> CAVARYN_CHITEN_SPIKES = FEATURES.register("cavaryn_chiten_spikes",
|
||||
() -> new ChitenSpikeFeature(ChitenSpikeConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, CavarynBileVeinFeature> CAVARYN_BILE_VEINS = FEATURES.register("cavaryn_bile_veins",
|
||||
() -> new CavarynBileVeinFeature(NoneFeatureConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, CavarynBileCystFeature> CAVARYN_BILE_CYSTS = FEATURES.register("cavaryn_bile_cysts",
|
||||
() -> new CavarynBileCystFeature(NoneFeatureConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, CavarynCreepvineFeature> CAVARYN_CREEPVINE = FEATURES.register("cavaryn_creepvine",
|
||||
() -> new CavarynCreepvineFeature(NoneFeatureConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, HangingCreeprootsFeature> HANGING_CREEPROOTS = FEATURES.register("hanging_creeproots",
|
||||
() -> new HangingCreeprootsFeature(NoneFeatureConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, MoltingVinesFeature> MOLTING_VINES = FEATURES.register("molting_vines",
|
||||
() -> new MoltingVinesFeature(NoneFeatureConfiguration.CODEC));
|
||||
public static final DeferredHolder<Feature<?>, com.craisinlord.antarchy.content.worldgen.cavaryn.GroundMoltingVinesFeature> GROUND_MOLTING_VINES = FEATURES.register("ground_molting_vines",
|
||||
() -> new com.craisinlord.antarchy.content.worldgen.cavaryn.GroundMoltingVinesFeature(NoneFeatureConfiguration.CODEC));
|
||||
|
||||
public static final DeferredHolder<Feature<?>, com.craisinlord.antarchy.content.worldgen.cavaryn.JumpyBugEggCeilingFeature> JUMPY_BUG_EGG_CEILING = FEATURES.register("jumpy_bug_egg_ceiling",
|
||||
() -> new com.craisinlord.antarchy.content.worldgen.cavaryn.JumpyBugEggCeilingFeature(NoneFeatureConfiguration.CODEC));
|
||||
public static final DeferredHolder<Feature<?>, com.craisinlord.antarchy.content.worldgen.cavaryn.SpitBugEggPatchFeature> SPIT_BUG_EGG_PATCH = FEATURES.register("spit_bug_egg_patch",
|
||||
() -> new com.craisinlord.antarchy.content.worldgen.cavaryn.SpitBugEggPatchFeature(NoneFeatureConfiguration.CODEC));
|
||||
public static final DeferredHolder<Feature<?>, com.craisinlord.antarchy.content.worldgen.cavaryn.RollyCavesGiantCavernFeature> ROLLY_CAVES_GIANT_CAVERN = FEATURES.register("rolly_caves_giant_cavern",
|
||||
() -> new com.craisinlord.antarchy.content.worldgen.cavaryn.RollyCavesGiantCavernFeature(NoneFeatureConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, CavarynWallAmberMossFeature> CAVARYN_WALL_AMBER_MOSS = FEATURES.register("cavaryn_wall_amber_moss",
|
||||
() -> new CavarynWallAmberMossFeature(NoneFeatureConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, AntiwaterSpringsFeature> ANTIWATER_SPRINGS = FEATURES.register("antiwater_springs",
|
||||
() -> new AntiwaterSpringsFeature(AntiwaterSpringsConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, PotentNyxiteFeature> POTENT_NYXITE_FEATURE = FEATURES.register("potent_nyxite",
|
||||
() -> new PotentNyxiteFeature(NoneFeatureConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, ThoraxisBloodCrystalFeature> THORAXIS_BLOOD_CRYSTAL_SPIRES = FEATURES.register("thoraxis_blood_crystal_spires",
|
||||
() -> new ThoraxisBloodCrystalFeature(ThoraxisBloodCrystalConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, CloudSeaCalciteFeature> CLOUD_SEA_CALCITE_BANKS = FEATURES.register("cloud_sea_calcite_banks",
|
||||
() -> new CloudSeaCalciteFeature(NoneFeatureConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, BedBugNestFeature> BED_BUG_NEST = FEATURES.register("bed_bug_nest",
|
||||
() -> new BedBugNestFeature(NoneFeatureConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, BedBugSurfaceClusterFeature> BED_BUG_SURFACE_CLUSTER = FEATURES.register("bed_bug_surface_cluster",
|
||||
() -> new BedBugSurfaceClusterFeature(NoneFeatureConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, CavarynEggPatchFeature> CAVARYN_TERROR_EGG_PATCH = FEATURES.register("cavaryn_terror_egg_patch",
|
||||
() -> new CavarynEggPatchFeature(NoneFeatureConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, com.craisinlord.antarchy.content.worldgen.mushroom.GlowcapHugeMushroomFeature> HUGE_GLOWCAP_MUSHROOM = FEATURES.register("huge_glowcap_mushroom",
|
||||
() -> new com.craisinlord.antarchy.content.worldgen.mushroom.GlowcapHugeMushroomFeature(NoneFeatureConfiguration.CODEC));
|
||||
public static final DeferredHolder<Feature<?>, com.craisinlord.antarchy.content.worldgen.mushroom.GlowcapHugeMushroomWorldgenFeature> HUGE_GLOWCAP_MUSHROOM_WORLDGEN = FEATURES.register("huge_glowcap_mushroom_worldgen",
|
||||
() -> new com.craisinlord.antarchy.content.worldgen.mushroom.GlowcapHugeMushroomWorldgenFeature(NoneFeatureConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, ThoraxisAntiwaterPoolFeature> THORAXIS_ANTIWATER_POOL = FEATURES.register("thoraxis_antiwater_pool",
|
||||
() -> new ThoraxisAntiwaterPoolFeature(ThoraxisAntiwaterPoolConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, LucidAntiwaterPoolFeature> LUCID_ANTIWATER_POOL = FEATURES.register("lucid_antiwater_pool",
|
||||
() -> new LucidAntiwaterPoolFeature(ThoraxisAntiwaterPoolConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, ThoraxisDuneFeature> THORAXIS_DUNE = FEATURES.register("thoraxis_dune",
|
||||
() -> new ThoraxisDuneFeature(ThoraxisDuneConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, CoralSpikeFeature> ELYTHIA_CORAL_SPIKE = FEATURES.register("elythia_coral_spike",
|
||||
() -> new CoralSpikeFeature(NoneFeatureConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, com.craisinlord.antarchy.content.worldgen.elythia.FallenOuranwoodFeature> FALLEN_OURANWOOD_TREE = FEATURES.register("fallen_ouranwood_tree",
|
||||
() -> new com.craisinlord.antarchy.content.worldgen.elythia.FallenOuranwoodFeature(NoneFeatureConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<Feature<?>, com.craisinlord.antarchy.content.worldgen.elythia.FungalMushroomFeature> FUNGAL_MUSHROOM = FEATURES.register("fungal_mushroom",
|
||||
() -> new com.craisinlord.antarchy.content.worldgen.elythia.FungalMushroomFeature(NoneFeatureConfiguration.CODEC));
|
||||
|
||||
|
||||
public static final DeferredHolder<com.mojang.serialization.Codec<? extends BiomeSource>, com.mojang.serialization.Codec<ThoraxisBiomeSource>> THORAXIS_BIOME_SOURCE = BIOME_SOURCES.register("thoraxis_biome_source",
|
||||
() -> ThoraxisBiomeSource.CODEC.codec());
|
||||
|
||||
|
||||
public static final ArmorMaterial JUMPY_BOOTS_ARMOR_MATERIAL = armorMaterial(
|
||||
37, createJumpyBootsDefense(), 15, net.minecraft.sounds.SoundEvents.ARMOR_EQUIP_NETHERITE,
|
||||
() -> Ingredient.of(net.minecraft.world.item.Items.NETHERITE_BOOTS), 3.0F, 0.1F, "jumpy_boots");
|
||||
|
||||
|
||||
|
||||
public static MobEffect mobEffectHolder(DeferredHolder<MobEffect, ? extends MobEffect> effect) {
|
||||
return effect.get();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static Holder<Attribute> attributeHolder(DeferredHolder<Attribute, ? extends Attribute> attribute) {
|
||||
return BuiltInRegistries.ATTRIBUTE.wrapAsHolder(attribute.get());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private static java.util.EnumMap<ArmorItem.Type, Integer> createUltimateArmorDefense() {
|
||||
java.util.EnumMap<ArmorItem.Type, Integer> defense = new java.util.EnumMap<>(ArmorItem.Type.class);
|
||||
defense.put(ArmorItem.Type.BOOTS, 6);
|
||||
defense.put(ArmorItem.Type.LEGGINGS, 12);
|
||||
defense.put(ArmorItem.Type.CHESTPLATE, 16);
|
||||
defense.put(ArmorItem.Type.HELMET, 6);
|
||||
return defense;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static java.util.EnumMap<ArmorItem.Type, Integer> createNightmareArmorDefense() {
|
||||
java.util.EnumMap<ArmorItem.Type, Integer> defense = new java.util.EnumMap<>(ArmorItem.Type.class);
|
||||
defense.put(ArmorItem.Type.BOOTS, 4);
|
||||
defense.put(ArmorItem.Type.LEGGINGS, 9);
|
||||
defense.put(ArmorItem.Type.CHESTPLATE, 11);
|
||||
defense.put(ArmorItem.Type.HELMET, 4);
|
||||
return defense;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static java.util.EnumMap<ArmorItem.Type, Integer> createJumpyBootsDefense() {
|
||||
java.util.EnumMap<ArmorItem.Type, Integer> defense = new java.util.EnumMap<>(ArmorItem.Type.class);
|
||||
defense.put(ArmorItem.Type.BOOTS, 3);
|
||||
defense.put(ArmorItem.Type.LEGGINGS, 0);
|
||||
defense.put(ArmorItem.Type.CHESTPLATE, 0);
|
||||
defense.put(ArmorItem.Type.HELMET, 0);
|
||||
return defense;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static java.util.EnumMap<ArmorItem.Type, Integer> createBloodCrystalArmorDefense() {
|
||||
java.util.EnumMap<ArmorItem.Type, Integer> defense = new java.util.EnumMap<>(ArmorItem.Type.class);
|
||||
defense.put(ArmorItem.Type.BOOTS, 2);
|
||||
defense.put(ArmorItem.Type.LEGGINGS, 5);
|
||||
defense.put(ArmorItem.Type.CHESTPLATE, 6);
|
||||
defense.put(ArmorItem.Type.HELMET, 2);
|
||||
return defense;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static java.util.EnumMap<ArmorItem.Type, Integer> createMogglesArmorDefense() {
|
||||
java.util.EnumMap<ArmorItem.Type, Integer> defense = new java.util.EnumMap<>(ArmorItem.Type.class);
|
||||
defense.put(ArmorItem.Type.BOOTS, 0);
|
||||
defense.put(ArmorItem.Type.LEGGINGS, 0);
|
||||
defense.put(ArmorItem.Type.CHESTPLATE, 0);
|
||||
defense.put(ArmorItem.Type.HELMET, 2);
|
||||
return defense;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static java.util.EnumMap<ArmorItem.Type, Integer> createPrimordialArmorDefense() {
|
||||
java.util.EnumMap<ArmorItem.Type, Integer> defense = new java.util.EnumMap<>(ArmorItem.Type.class);
|
||||
defense.put(ArmorItem.Type.BOOTS, 3);
|
||||
defense.put(ArmorItem.Type.LEGGINGS, 6);
|
||||
defense.put(ArmorItem.Type.CHESTPLATE, 8);
|
||||
defense.put(ArmorItem.Type.HELMET, 3);
|
||||
return defense;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static java.util.EnumMap<ArmorItem.Type, Integer> createFallenKingCrownDefense() {
|
||||
java.util.EnumMap<ArmorItem.Type, Integer> defense = new java.util.EnumMap<>(ArmorItem.Type.class);
|
||||
defense.put(ArmorItem.Type.BOOTS, 0);
|
||||
defense.put(ArmorItem.Type.LEGGINGS, 0);
|
||||
defense.put(ArmorItem.Type.CHESTPLATE, 0);
|
||||
defense.put(ArmorItem.Type.HELMET, 2);
|
||||
return defense;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static SimpleParticleType simpleParticleType() {
|
||||
return new SimpleParticleType(true) {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static <T extends net.minecraft.core.particles.ParticleOptions> ParticleType<T> particleType(
|
||||
net.minecraft.core.particles.ParticleOptions.Deserializer<T> deserializer
|
||||
) {
|
||||
return new ParticleType<>(false, deserializer) {
|
||||
@Override
|
||||
public com.mojang.serialization.Codec<T> codec() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public static void register() {
|
||||
FLUIDS.register();
|
||||
ATTRIBUTES.register();
|
||||
PARTICLE_TYPES.register();
|
||||
FEATURES.register();
|
||||
BIOME_SOURCES.register();
|
||||
DENSITY_FUNCTION_TYPES.register();
|
||||
MOB_EFFECTS.register();
|
||||
POTIONS.register();
|
||||
MENUS.register();
|
||||
FROG_VARIANTS.register();
|
||||
RECIPE_SERIALIZERS.register();
|
||||
}
|
||||
|
||||
}
|
||||
+469
@@ -0,0 +1,469 @@
|
||||
package com.craisinlord.antarchy.fabric.registry;
|
||||
|
||||
import com.craisinlord.antarchy.Antarchy;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
|
||||
public final class AntarchyFabricSounds {
|
||||
|
||||
public static final DeferredRegister<SoundEvent> SOUND_EVENTS = DeferredRegister.create(Registries.SOUND_EVENT, Antarchy.MODID);
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> SQUIDZOOKA_FIRE = registerSoundEvent("squidzooka_fire");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> SHRINK_RAY_SOUND = registerSoundEvent("shrink_ray");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> GROWTH_RAY_SOUND = registerSoundEvent("growth_ray");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> SIZE_RAY_CHARGE = registerSoundEvent("size_ray_charge");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> ANT_AMBIENT = registerSoundEvent("ant_ambient");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> ANT_IDLE = registerSoundEvent("ant_idle");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> ANT_HURT = registerSoundEvent("ant_hurt");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> ANT_BITE = registerSoundEvent("ant_bite");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> ANT_GATHER = registerSoundEvent("ant_gather");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> ANT_NEST = registerSoundEvent("ant_nest");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> CLOUD_SHARK_BITE = registerSoundEvent("cloud_shark_bite");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> CLOUD_SHARK_IDLE = registerSoundEvent("cloud_shark_idle");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> CLOUD_SHARK_HURT = registerSoundEvent("cloud_shark_hurt");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> CLOUD_SHARK_DEATH = registerSoundEvent("cloud_shark_death");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> CLOUD_SHARK_FLY = registerSoundEvent("cloud_shark_fly");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> CATERPILLAR_IDLE = registerSoundEvent("caterpillar_idle");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> CATERPILLAR_HURT = registerSoundEvent("caterpillar_hurt");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> CATERPILLAR_CRAWL = registerSoundEvent("caterpillar_crawl");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> BUTTERFLY_HURT = registerSoundEvent("butterfly_hurt");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> BRUTALFLY_IDLE = registerSoundEvent("brutalfly_idle");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> BRUTALFLY_DEATH = registerSoundEvent("brutalfly_death");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> ELYTHIA_FIREFLY_AMBIENT = registerSoundEvent("ambient.elythia.firefly");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> MISSILE_SQUID_AMBIENT = registerSoundEvent("missile_squid_ambient");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> MISSILE_SQUID_HURT = registerSoundEvent("missile_squid_hurt");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> MISSILE_SQUID_DEATH = registerSoundEvent("missile_squid_death");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> MISSILE_SQUID_ATTACK = registerSoundEvent("missile_squid_attack");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> KRAKEN_FLYING_LOOP = registerSoundEvent("kraken_flying_loop");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> KRAKEN_FLYING_SIDEWAYS_LOOP = registerSoundEvent("kraken_flying_sideways_loop");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> KRAKEN_ATTACK = registerSoundEvent("kraken_attack");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> KRAKEN_SPIN = registerSoundEvent("kraken_spin");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> KRAKEN_ROAR = registerSoundEvent("kraken_roar");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> KRAKEN_SUMMON = registerSoundEvent("kraken_summon");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> KRAKEN_HURT = registerSoundEvent("kraken_hurt");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> KRAKEN_DEATH = registerSoundEvent("kraken_death");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> BASILISK_IDLE_LOOP = registerSoundEvent("basilisk_idle_loop");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> BASILISK_SLITHER_LOOP = registerSoundEvent("basilisk_slither_loop");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> BASILISK_BITE = registerSoundEvent("basilisk_bite");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> BASILISK_HISS = registerSoundEvent("basilisk_hiss");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> BASILISK_HURT = registerSoundEvent("basilisk_hurt");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> BASILISK_DEATH = registerSoundEvent("basilisk_death");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> THORAXIS_NIGHTMARE_WASTES_AMBIENT = registerSoundEvent("thoraxis_nightmare_wastes_ambient");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> THORAXIS_NIGHTMARE_WASTES_ADDITIONS = registerSoundEvent("thoraxis_nightmare_wastes_additions");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> THORAXIS_NIGHTMARE_WASTES_MOOD = registerSoundEvent("thoraxis_nightmare_wastes_mood");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> THORAXIS_DREAM_DUNES_AMBIENT = registerSoundEvent("thoraxis_dream_dunes_ambient");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> THORAXIS_DREAM_DUNES_ADDITIONS = registerSoundEvent("thoraxis_dream_dunes_additions");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> THORAXIS_DREAM_DUNES_MOOD = registerSoundEvent("thoraxis_dream_dunes_mood");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> THORAXIS_LUCID_POOLS_AMBIENT = registerSoundEvent("thoraxis_lucid_pools_ambient");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> THORAXIS_LUCID_POOLS_ADDITIONS = registerSoundEvent("thoraxis_lucid_pools_additions");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> THORAXIS_LUCID_POOLS_MOOD = registerSoundEvent("thoraxis_lucid_pools_mood");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> LUCID_AMBIENT = registerSoundEvent("lucid_ambient");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> LUCID_FLYING = registerSoundEvent("lucid_flying");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> LUCID_ATTACK = registerSoundEvent("lucid_attack");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> LUCID_BOLT_SOUND = registerSoundEvent("lucid_bolt");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> LUCID_HURT = registerSoundEvent("lucid_hurt");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> LUCID_DEATH = registerSoundEvent("lucid_death");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> REVERIE_IDLE = registerSoundEvent("reverie_idle");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> REVERIE_HURT = registerSoundEvent("reverie_hurt");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> REVERIE_WORRY = registerSoundEvent("reverie_worry");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> REVERIE_SAVE = registerSoundEvent("reverie_save");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> REVERIE_JOIN_PLAYER = registerSoundEvent("reverie_join_player");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> REVERIE_ALERT = registerSoundEvent("reverie_alert");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> FLYING_SQUIRREL_IDLE = registerSoundEvent("flying_squirrel_idle");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> FLYING_SQUIRREL_BEG = registerSoundEvent("flying_squirrel_beg");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> FLYING_SQUIRREL_NUT = registerSoundEvent("flying_squirrel_nut");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> FLYING_SQUIRREL_GLIDE_LOOP = registerSoundEvent("flying_squirrel_glide_loop");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> FLYING_SQUIRREL_HURT = registerSoundEvent("flying_squirrel_hurt");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> FLYING_SQUIRREL_DEATH = registerSoundEvent("flying_squirrel_death");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> NIGHTMARE_IDLE = registerSoundEvent("nightmare_idle");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> NIGHTMARE_HURT = registerSoundEvent("nightmare_hurt");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> NIGHTMARE_ROAR = registerSoundEvent("nightmare_roar");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> NIGHTMARE_DEATH = registerSoundEvent("nightmare_death");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> NIGHTMARE_BITE = registerSoundEvent("nightmare_bite");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> NIGHTMARE_FLAP = registerSoundEvent("nightmare_flap");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> TRIFFID_ATTACK = registerSoundEvent("triffid_attack");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> TRIFFID_GRAB = registerSoundEvent("triffid_grab");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> TRIFFID_HURT = registerSoundEvent("triffid_hurt");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> TRIFFID_DEATH = registerSoundEvent("triffid_death");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> TRIFFID_HISS = registerSoundEvent("triffid_hiss");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> TRIFFID_GROWL = registerSoundEvent("triffid_growl");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> MANTIS_AMBIENT = registerSoundEvent("mantis_ambient");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> MANTIS_HURT = registerSoundEvent("mantis_hurt");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> MANTIS_ATTACK = registerSoundEvent("mantis_attack");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> MANTIS_FLY_LOOP = registerSoundEvent("mantis_fly_loop");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> GRAVITY_GUN_PICKUP = registerSoundEvent("gravity_gun_pickup");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> GRAVITY_GUN_DROP = registerSoundEvent("gravity_gun_drop");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> GRAVITY_GUN_HOLD_LOOP = registerSoundEvent("gravity_gun_hold_loop");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> GRAVITY_GUN_LAUNCH = registerSoundEvent("gravity_gun_launch");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> GRAVITY_GUN_DRYFIRE = registerSoundEvent("gravity_gun_dryfire");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> BED_BUG_AMBIENT = registerSoundEvent("bed_bug_ambient");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> BED_BUG_HURT = registerSoundEvent("bed_bug_hurt");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> BED_BUG_ATTACK = registerSoundEvent("bed_bug_attack");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> WASP_IDLE = registerSoundEvent("wasp_idle");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> WASP_HURT = registerSoundEvent("wasp_hurt");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> WASP_ATTACK = registerSoundEvent("wasp_attack");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> WASP_DEATH = registerSoundEvent("wasp_death");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> SCORPION_AMBIENT = registerSoundEvent("scorpion_ambient");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> SCORPION_HURT = registerSoundEvent("scorpion_hurt");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> SCORPION_ATTACK = registerSoundEvent("scorpion_attack");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> EMPEROR_SCORPION_AMBIENT = registerSoundEvent("emperor_scorpion_ambient");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> EMPEROR_SCORPION_HURT = registerSoundEvent("emperor_scorpion_hurt");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> EMPEROR_SCORPION_ATTACK = registerSoundEvent("emperor_scorpion_attack");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> EMPEROR_SCORPION_ROAR = registerSoundEvent("emperor_scorpion_roar");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> MOLEWORM_AMBIENT = registerSoundEvent("moleworm_ambient");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> MOLEWORM_HURT = registerSoundEvent("moleworm_hurt");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> MOLEWORM_ATTACK = registerSoundEvent("moleworm_attack");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> MOLEWORM_DIG = registerSoundEvent("moleworm_dig");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> MOLEVORE_AMBIENT = registerSoundEvent("molevore_ambient");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> MOLEVORE_HURT = registerSoundEvent("molevore_hurt");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> MOLEVORE_ATTACK = registerSoundEvent("molevore_attack");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> MOLEVORE_DIG = registerSoundEvent("molevore_dig");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> BOMBER_WALK = registerSoundEvent("bomber_walk");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> BOMBER_KNOCK = registerSoundEvent("bomber_knock");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> BOMBER_EXPLODE = registerSoundEvent("bomber_explode");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> TORETERROR_IDLE = registerSoundEvent("toreterror_idle");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> TORETERROR_HURT = registerSoundEvent("toreterror_hurt");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> TORETERROR_DEATH = registerSoundEvent("toreterror_death");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> TORETERROR_BOMBER_FIRE = registerSoundEvent("toreterror_bomber_fire");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> TORETERROR_SPIN = registerSoundEvent("toreterror_spin");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> TORETERROR_RICOCHET = registerSoundEvent("toreterror_ricochet");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> WATER_CANNON_FIRE = registerSoundEvent("water_cannon_fire");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> TORETERROR_JUMP_UP = registerSoundEvent("toreterror_jump_up");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> TORETERROR_JUMP_LAND = registerSoundEvent("toreterror_jump_land");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> STINKY_FLY_SOUND = registerSoundEvent("stinky_fly");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> STINK_BUG_FART = registerSoundEvent("stink_bug_fart");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> STINK_BUG_IDLE = registerSoundEvent("stink_bug_idle");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> CAVARYN_HEARTBEAT = registerSoundEvent("cavaryn_heartbeat");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> ROLLY_POLLY_IDLE = registerSoundEvent("rolly_polly_idle");
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> ROLLY_POLLY_WHEEL_MODE = registerSoundEvent("rolly_polly_wheel_mode");
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> ROLLY_POLLY_NORMAL_MODE = registerSoundEvent("rolly_polly_normal_mode");
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> ROLLY_POLLY_ROLL = registerSoundEvent("rolly_polly_roll");
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> JERRY_YOUNG_IDLE = registerSoundEvent("jerry_young_idle");
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> JERRY_YOUNG_HURT = registerSoundEvent("jerry_young_hurt");
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> JERRY_YOUNG_DEATH = registerSoundEvent("jerry_young_death");
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> JERRY_YOUNG_ATTACK = registerSoundEvent("jerry_young_attack");
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> JERRY_ADULT_IDLE = registerSoundEvent("jerry_adult_idle");
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> JERRY_ADULT_HURT = registerSoundEvent("jerry_adult_hurt");
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> JERRY_ADULT_DEATH = registerSoundEvent("jerry_adult_death");
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> JERRY_ADULT_ATTACK = registerSoundEvent("jerry_adult_attack");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> CREEPING_HORROR_GROWL = registerSoundEvent("creeping_horror_growl");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> CREEPING_HORROR_HURT = registerSoundEvent("creeping_horror_hurt");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> CREEPING_HORROR_BITE = registerSoundEvent("creeping_horror_bite");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> LURKING_TERROR_SNARL = registerSoundEvent("lurking_terror_snarl");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> LURKING_TERROR_HURT = registerSoundEvent("lurking_terror_hurt");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> LURKING_TERROR_BITE = registerSoundEvent("lurking_terror_bite");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> LURKING_TERROR_FLY_LOOP = registerSoundEvent("lurking_terror_fly_loop");
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> HERCULES_BEETLE_IDLE = registerSoundEvent("hercules_beetle_idle");
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> HERCULES_BEETLE_HURT = registerSoundEvent("hercules_beetle_hurt");
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> HERCULES_BEETLE_ATTACK = registerSoundEvent("hercules_beetle_attack");
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> HERCULES_BEETLE_CRY = registerSoundEvent("hercules_beetle_cry");
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> HERCULES_BEETLE_CHARGE_START = registerSoundEvent("hercules_beetle_charge_start");
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> HERCULES_BEETLE_KNOCKED_DOWN = registerSoundEvent("hercules_beetle_knocked_down");
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> JUMPY_BUG_IDLE = registerSoundEvent("jumpy_bug_idle");
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> SPIT_BUG_IDLE = registerSoundEvent("spit_bug_idle");
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> JUMPY_BUG_HURT = registerSoundEvent("jumpy_bug_hurt");
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> JUMPY_BUG_JUMP = registerSoundEvent("jumpy_bug_jump");
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> SPIT_BUG_HURT = registerSoundEvent("spit_bug_hurt");
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> SPIT_BUG_SPIT = registerSoundEvent("spit_bug_spit");
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> BRUTALFLY_SPIT = registerSoundEvent("brutalfly_spit");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> DUCT_TAPE_USE = registerSoundEvent("duct_tape_use");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> POTENT_NYXITE_HYPNOTIC_GAS = registerSoundEvent("potent_nyxite_hypnotic_gas");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> POTENT_NYXITE_GEYSER_ERUPTION_START = registerSoundEvent("potent_nyxite_geyser_eruption_start");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> POTENT_NYXITE_GEYSER_ERUPTION_ACTIVE = registerSoundEvent("potent_nyxite_geyser_eruption_active");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> POTENT_NYXITE_GEYSER_CONTINUOUS_START = registerSoundEvent("potent_nyxite_geyser_continuous_start");
|
||||
|
||||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> POTENT_NYXITE_GEYSER_CONTINUOUS_ACTIVE = registerSoundEvent("potent_nyxite_geyser_continuous_active");
|
||||
|
||||
|
||||
|
||||
|
||||
private static DeferredHolder<SoundEvent, SoundEvent> registerSoundEvent(String path) {
|
||||
return SOUND_EVENTS.register(path,
|
||||
() -> SoundEvent.createVariableRangeEvent(new ResourceLocation(Antarchy.MODID, path)));
|
||||
}
|
||||
|
||||
|
||||
public static void register() {
|
||||
SOUND_EVENTS.register();
|
||||
}
|
||||
|
||||
}
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
package com.craisinlord.antarchy.fabric.registry;
|
||||
|
||||
import com.craisinlord.antarchy.content.entity.cloud_shark.CloudSharkEntity;
|
||||
import com.craisinlord.antarchy.content.entity.BedBugEntity;
|
||||
import com.craisinlord.antarchy.content.entity.ButterflyEntity;
|
||||
import com.craisinlord.antarchy.content.entity.CaterpillarEntity;
|
||||
import com.craisinlord.antarchy.content.entity.flying_squirrel.FlyingSquirrelEntity;
|
||||
import com.craisinlord.antarchy.content.entity.ReverieEntity;
|
||||
import com.craisinlord.antarchy.content.entity.MissileSquidEntity;
|
||||
import com.craisinlord.antarchy.content.entity.lucid.LucidEntity;
|
||||
import com.craisinlord.antarchy.content.entity.JumpyBugEntity;
|
||||
import com.craisinlord.antarchy.content.entity.StinkBugEntity;
|
||||
import com.craisinlord.antarchy.content.entity.AlphaMantisEntity;
|
||||
import com.craisinlord.antarchy.content.entity.MantisEntity;
|
||||
import com.craisinlord.antarchy.content.entity.basilisk.BasiliskEntity;
|
||||
import com.craisinlord.antarchy.content.entity.EmperorScorpionEntity;
|
||||
import com.craisinlord.antarchy.content.entity.ScorpionEntity;
|
||||
import com.craisinlord.antarchy.content.entity.nightmare.NightmareEntity;
|
||||
import com.craisinlord.antarchy.content.entity.ToreterrorEntity;
|
||||
import com.craisinlord.antarchy.content.entity.kraken.KrakenEntity;
|
||||
import com.craisinlord.antarchy.content.entity.OctopusBombEntity;
|
||||
import com.craisinlord.antarchy.content.entity.MolevoreEntity;
|
||||
import com.craisinlord.antarchy.content.entity.MolewormEntity;
|
||||
import com.craisinlord.antarchy.content.entity.BomberEntity;
|
||||
import com.craisinlord.antarchy.content.entity.WaspEntity;
|
||||
import net.minecraft.world.entity.animal.Cow;
|
||||
import net.minecraft.world.entity.SpawnPlacements;
|
||||
import net.minecraft.world.entity.monster.Monster;
|
||||
import net.minecraft.world.level.levelgen.Heightmap;
|
||||
|
||||
public final class AntarchyFabricSpawnPlacements {
|
||||
|
||||
|
||||
public static void register() {
|
||||
SpawnPlacements.register(AntarchyFabricEntities.FLYING_SQUIRREL.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING, FlyingSquirrelEntity::canSpawn);
|
||||
SpawnPlacements.register(AntarchyFabricEntities.CATERPILLAR.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, CaterpillarEntity::canSpawn);
|
||||
SpawnPlacements.register(AntarchyFabricEntities.BUTTERFLY.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, ButterflyEntity::canSpawn);
|
||||
SpawnPlacements.register(AntarchyFabricEntities.REVERIE.get(), SpawnPlacements.Type.NO_RESTRICTIONS, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, ReverieEntity::canSpawn);
|
||||
SpawnPlacements.register(AntarchyFabricEntities.BRUTALFLY.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkMonsterSpawnRules);
|
||||
SpawnPlacements.register(AntarchyFabricEntities.APPLE_COW.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Cow::checkAnimalSpawnRules);
|
||||
SpawnPlacements.register(AntarchyFabricEntities.GOLDEN_APPLE_COW.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Cow::checkAnimalSpawnRules);
|
||||
SpawnPlacements.register(AntarchyFabricEntities.ENCHANTED_GOLDEN_APPLE_COW.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Cow::checkAnimalSpawnRules);
|
||||
SpawnPlacements.register(AntarchyFabricEntities.CLOUD_SHARK.get(), SpawnPlacements.Type.NO_RESTRICTIONS, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, CloudSharkEntity::canSpawn);
|
||||
SpawnPlacements.register(AntarchyFabricEntities.WASP.get(), SpawnPlacements.Type.NO_RESTRICTIONS, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, WaspEntity::canSpawn);
|
||||
SpawnPlacements.register(AntarchyFabricEntities.BOMBER.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, BomberEntity::canSpawn);
|
||||
SpawnPlacements.register(AntarchyFabricEntities.JUMPY_BUG.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, JumpyBugEntity::canSpawn);
|
||||
SpawnPlacements.register(AntarchyFabricEntities.SPIT_BUG.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, com.craisinlord.antarchy.content.entity.SpitBugEntity::canSpawn);
|
||||
SpawnPlacements.register(AntarchyFabricEntities.KRAKEN.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, KrakenEntity::canSpawn);
|
||||
SpawnPlacements.register(AntarchyFabricEntities.MISSILE_SQUID.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, MissileSquidEntity::canSpawn);
|
||||
SpawnPlacements.register(AntarchyFabricEntities.OCTOPUS_BOMB.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, OctopusBombEntity::canSpawn);
|
||||
SpawnPlacements.register(AntarchyFabricEntities.CHEEP.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, net.minecraft.world.entity.animal.AbstractFish::checkSurfaceWaterAnimalSpawnRules);
|
||||
SpawnPlacements.register(AntarchyFabricEntities.DORRIE.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.OCEAN_FLOOR, net.minecraft.world.entity.animal.Animal::checkAnimalSpawnRules);
|
||||
SpawnPlacements.register(AntarchyFabricEntities.OURANWOOD_DEER.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, net.minecraft.world.entity.animal.Animal::checkAnimalSpawnRules);
|
||||
SpawnPlacements.register(AntarchyFabricEntities.GLIMMER.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, com.craisinlord.antarchy.content.entity.glimmer.GlimmerEntity::checkGlimmerSpawnRules);
|
||||
SpawnPlacements.register(AntarchyFabricEntities.ELKA.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, net.minecraft.world.entity.animal.Animal::checkAnimalSpawnRules);
|
||||
SpawnPlacements.register(AntarchyFabricEntities.NIGHTMARE.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, NightmareEntity::canSpawn);
|
||||
SpawnPlacements.register(AntarchyFabricEntities.MOLEWORM.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, MolewormEntity::canSpawn);
|
||||
SpawnPlacements.register(AntarchyFabricEntities.MANTIS.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, MantisEntity::canSpawn);
|
||||
SpawnPlacements.register(AntarchyFabricEntities.ALPHA_MANTIS.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, AlphaMantisEntity::checkAlphaMantisSpawnRules);
|
||||
SpawnPlacements.register(AntarchyFabricEntities.MOLEVORE.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, MolevoreEntity::canSpawn);
|
||||
SpawnPlacements.register(AntarchyFabricEntities.BED_BUG.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, BedBugEntity::canSpawn);
|
||||
SpawnPlacements.register(AntarchyFabricEntities.STINK_BUG.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, StinkBugEntity::canSpawn);
|
||||
SpawnPlacements.register(AntarchyFabricEntities.LUCID.get(), SpawnPlacements.Type.NO_RESTRICTIONS, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, LucidEntity::canSpawn);
|
||||
SpawnPlacements.register(AntarchyFabricEntities.SCORPION.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, ScorpionEntity::canSpawn);
|
||||
SpawnPlacements.register(AntarchyFabricEntities.BASILISK.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, BasiliskEntity::canSpawn);
|
||||
SpawnPlacements.register(AntarchyFabricEntities.EMPEROR_SCORPION.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, EmperorScorpionEntity::canSpawn);
|
||||
SpawnPlacements.register(AntarchyFabricEntities.TORETERROR.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, ToreterrorEntity::canSpawn);
|
||||
SpawnPlacements.register(AntarchyFabricEntities.CREEPING_HORROR.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, com.craisinlord.antarchy.content.entity.CreepingHorrorEntity::canSpawn);
|
||||
SpawnPlacements.register(AntarchyFabricEntities.LURKING_TERROR.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, com.craisinlord.antarchy.content.entity.LurkingTerrorEntity::canSpawn);
|
||||
SpawnPlacements.register(AntarchyFabricEntities.JERRY.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, com.craisinlord.antarchy.content.entity.JerryEntity::canSpawn);
|
||||
SpawnPlacements.register(AntarchyFabricEntities.TERMITE.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, net.minecraft.world.entity.animal.Animal::checkAnimalSpawnRules);
|
||||
SpawnPlacements.register(AntarchyFabricEntities.ROLLY_POLLY.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, com.craisinlord.antarchy.content.entity.RollyPollyEntity::canSpawn);
|
||||
}
|
||||
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.craisinlord.antarchy.fabric.registry;
|
||||
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
|
||||
public final class DeferredBlock<T extends Block> extends DeferredHolder<Block, T> {
|
||||
DeferredBlock(ResourceKey<?> registryKey, ResourceLocation id) {
|
||||
super(registryKey, id);
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package com.craisinlord.antarchy.fabric.registry;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
||||
public class DeferredHolder<R, T extends R> implements Supplier<T> {
|
||||
private final ResourceKey<?> registryKey;
|
||||
private final ResourceLocation id;
|
||||
private T value;
|
||||
|
||||
DeferredHolder(ResourceKey<?> registryKey, ResourceLocation id) {
|
||||
this.registryKey = registryKey;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
void bind(T value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public ResourceLocation getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public ResourceKey<T> getKey() {
|
||||
return (ResourceKey<T>) ResourceKey.create((ResourceKey) this.registryKey, this.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T get() {
|
||||
if (this.value == null) {
|
||||
throw new IllegalStateException("Registry object not yet bound: " + this.id);
|
||||
}
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.craisinlord.antarchy.fabric.registry;
|
||||
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.Item;
|
||||
|
||||
public final class DeferredItem<T extends Item> extends DeferredHolder<Item, T> {
|
||||
DeferredItem(ResourceKey<?> registryKey, ResourceLocation id) {
|
||||
super(registryKey, id);
|
||||
}
|
||||
}
|
||||
+121
@@ -0,0 +1,121 @@
|
||||
package com.craisinlord.antarchy.fabric.registry;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
|
||||
public class DeferredRegister<T> {
|
||||
public static final class Blocks extends DeferredRegister<Block> {
|
||||
private Blocks(String modId) {
|
||||
super(net.minecraft.core.registries.Registries.BLOCK, modId);
|
||||
}
|
||||
|
||||
public <I extends Block> DeferredBlock<I> register(String name, Supplier<? extends I> supplier) {
|
||||
return this.registerTyped(name, supplier, DeferredBlock::new);
|
||||
}
|
||||
}
|
||||
|
||||
public static final class Items extends DeferredRegister<Item> {
|
||||
private Items(String modId) {
|
||||
super(net.minecraft.core.registries.Registries.ITEM, modId);
|
||||
}
|
||||
|
||||
public <I extends Item> DeferredItem<I> register(String name, Supplier<? extends I> supplier) {
|
||||
return this.registerTyped(name, supplier, DeferredItem::new);
|
||||
}
|
||||
|
||||
public DeferredItem<Item> registerSimpleItem(String name) {
|
||||
return this.registerSimpleItem(name, new Item.Properties());
|
||||
}
|
||||
|
||||
public DeferredItem<Item> registerSimpleItem(String name, Item.Properties properties) {
|
||||
return this.register(name, () -> new Item(properties));
|
||||
}
|
||||
|
||||
public DeferredItem<BlockItem> registerSimpleBlockItem(DeferredBlock<? extends Block> block) {
|
||||
return this.register(block.getId().getPath(), () -> new BlockItem(block.get(), new Item.Properties()));
|
||||
}
|
||||
|
||||
public DeferredItem<BlockItem> registerSimpleBlockItem(DeferredBlock<? extends Block> block, Item.Properties properties) {
|
||||
return this.register(block.getId().getPath(), () -> new BlockItem(block.get(), properties));
|
||||
}
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
protected interface HolderFactory<R, T extends R, H extends DeferredHolder<R, T>> {
|
||||
H create(ResourceKey<?> registryKey, ResourceLocation id);
|
||||
}
|
||||
|
||||
private record PendingEntry<T>(ResourceLocation id, Supplier<? extends T> supplier, DeferredHolder<T, ? extends T> holder) {
|
||||
}
|
||||
|
||||
private final ResourceKey<? extends Registry<T>> registryKey;
|
||||
private final String modId;
|
||||
private final List<PendingEntry<T>> entries = new ArrayList<>();
|
||||
|
||||
protected DeferredRegister(ResourceKey<? extends Registry<T>> registryKey, String modId) {
|
||||
this.registryKey = registryKey;
|
||||
this.modId = modId;
|
||||
}
|
||||
|
||||
public static Blocks createBlocks(String modId) {
|
||||
return new Blocks(modId);
|
||||
}
|
||||
|
||||
public static Items createItems(String modId) {
|
||||
return new Items(modId);
|
||||
}
|
||||
|
||||
public static <T> DeferredRegister<T> create(ResourceKey<? extends Registry<T>> registryKey, String modId) {
|
||||
return new DeferredRegister<>(registryKey, modId);
|
||||
}
|
||||
|
||||
public <I extends T> DeferredHolder<T, I> register(String name, Supplier<? extends I> supplier) {
|
||||
return this.registerTyped(name, supplier, DeferredHolder::new);
|
||||
}
|
||||
|
||||
protected <I extends T, H extends DeferredHolder<T, I>> H registerTyped(String name, Supplier<? extends I> supplier, HolderFactory<T, I, H> factory) {
|
||||
ResourceLocation id = new ResourceLocation(this.modId, name);
|
||||
H holder = factory.create(this.registryKey, id);
|
||||
this.entries.add(new PendingEntry<>(id, supplier, holder));
|
||||
return holder;
|
||||
}
|
||||
|
||||
public List<DeferredHolder<T, ? extends T>> getEntries() {
|
||||
List<DeferredHolder<T, ? extends T>> holders = new ArrayList<>(this.entries.size());
|
||||
for (PendingEntry<T> entry : this.entries) {
|
||||
holders.add(entry.holder());
|
||||
}
|
||||
return Collections.unmodifiableList(holders);
|
||||
}
|
||||
|
||||
public void register() {
|
||||
Registry<T> registry = resolveRegistry(this.registryKey);
|
||||
for (PendingEntry<T> entry : this.entries) {
|
||||
T value = Registry.register(registry, entry.id(), entry.supplier().get());
|
||||
bind(entry.holder(), value);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
private static <T> void bind(DeferredHolder<T, ? extends T> holder, T value) {
|
||||
((DeferredHolder) holder).bind(value);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static <T> Registry<T> resolveRegistry(ResourceKey<? extends Registry<T>> registryKey) {
|
||||
Registry<?> registry = BuiltInRegistries.REGISTRY.get(registryKey.location());
|
||||
if (registry == null) {
|
||||
throw new IllegalStateException("Could not resolve registry: " + registryKey.location());
|
||||
}
|
||||
return (Registry<T>) registry;
|
||||
}
|
||||
}
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
package com.craisinlord.antarchy.fabric.util;
|
||||
|
||||
import com.craisinlord.antarchy.content.fluid.AntarchyFluidChecks;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
public final class CustomFluidPhysicsChecks {
|
||||
private CustomFluidPhysicsChecks() {
|
||||
}
|
||||
|
||||
public static boolean isTouchingAntiwater(Entity entity) {
|
||||
AABB box = entity.getBoundingBox().inflate(0.05D);
|
||||
BlockPos min = BlockPos.containing(box.minX, box.minY, box.minZ);
|
||||
BlockPos max = BlockPos.containing(box.maxX, box.maxY, box.maxZ);
|
||||
BlockPos.MutableBlockPos cursor = new BlockPos.MutableBlockPos();
|
||||
for (int x = min.getX(); x <= max.getX(); x++) {
|
||||
for (int y = min.getY(); y <= max.getY(); y++) {
|
||||
for (int z = min.getZ(); z <= max.getZ(); z++) {
|
||||
cursor.set(x, y, z);
|
||||
FluidState fluidState = entity.level().getFluidState(cursor);
|
||||
if (AntarchyFluidChecks.isAntiwater(fluidState)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isTouchingWaterlikeFluid(Entity entity) {
|
||||
AABB box = entity.getBoundingBox().inflate(0.05D);
|
||||
BlockPos min = BlockPos.containing(box.minX, box.minY, box.minZ);
|
||||
BlockPos max = BlockPos.containing(box.maxX, box.maxY, box.maxZ);
|
||||
BlockPos.MutableBlockPos cursor = new BlockPos.MutableBlockPos();
|
||||
for (int x = min.getX(); x <= max.getX(); x++) {
|
||||
for (int y = min.getY(); y <= max.getY(); y++) {
|
||||
for (int z = min.getZ(); z <= max.getZ(); z++) {
|
||||
cursor.set(x, y, z);
|
||||
FluidState fluidState = entity.level().getFluidState(cursor);
|
||||
if (AntarchyFluidChecks.usesWaterLikePhysics(fluidState)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static Vec3 getAntiwaterFlow(Entity entity) {
|
||||
return getAverageFlow(entity, true);
|
||||
}
|
||||
|
||||
public static Vec3 getWaterlikeFlow(Entity entity) {
|
||||
return getAverageFlow(entity, false);
|
||||
}
|
||||
|
||||
private static Vec3 getAverageFlow(Entity entity, boolean antiwater) {
|
||||
AABB box = entity.getBoundingBox().inflate(0.05D);
|
||||
BlockPos min = BlockPos.containing(box.minX, box.minY, box.minZ);
|
||||
BlockPos max = BlockPos.containing(box.maxX, box.maxY, box.maxZ);
|
||||
BlockPos.MutableBlockPos cursor = new BlockPos.MutableBlockPos();
|
||||
Vec3 totalFlow = Vec3.ZERO;
|
||||
int matches = 0;
|
||||
for (int x = min.getX(); x <= max.getX(); x++) {
|
||||
for (int y = min.getY(); y <= max.getY(); y++) {
|
||||
for (int z = min.getZ(); z <= max.getZ(); z++) {
|
||||
cursor.set(x, y, z);
|
||||
FluidState fluidState = entity.level().getFluidState(cursor);
|
||||
boolean matchesFluid = antiwater
|
||||
? AntarchyFluidChecks.isAntiwater(fluidState)
|
||||
: AntarchyFluidChecks.usesWaterLikePhysics(fluidState);
|
||||
if (!matchesFluid) {
|
||||
continue;
|
||||
}
|
||||
|
||||
totalFlow = totalFlow.add(fluidState.getFlow(entity.level(), cursor));
|
||||
matches++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (matches == 0 || totalFlow.lengthSqr() < 1.0E-6D) {
|
||||
return Vec3.ZERO;
|
||||
}
|
||||
|
||||
return totalFlow.scale(1.0D / matches);
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.craisinlord.antarchy.fabric.util;
|
||||
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class JumpyBootsFabricHelper {
|
||||
private static final Map<UUID, Long> PROTECTION_TIMES = new ConcurrentHashMap<>();
|
||||
|
||||
public static long getProtectionUntil(LivingEntity entity) {
|
||||
return PROTECTION_TIMES.getOrDefault(entity.getUUID(), 0L);
|
||||
}
|
||||
|
||||
public static void setProtectionUntil(LivingEntity entity, long gameTime) {
|
||||
PROTECTION_TIMES.put(entity.getUUID(), gameTime);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"required": true,
|
||||
"package": "com.craisinlord.antarchy.fabric.mixin",
|
||||
"refmap": "antarchy.mixins.refmap.json",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [
|
||||
],
|
||||
"client": [
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
},
|
||||
"minVersion": "0.8"
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"id": "${mod_id}",
|
||||
"version": "${version}",
|
||||
"name": "${mod_name}",
|
||||
"description": "${mod_description}",
|
||||
"authors": [
|
||||
"${mod_author}"
|
||||
],
|
||||
"contact": {
|
||||
"homepage": "${homepage_url}",
|
||||
"sources": "${sources_url}",
|
||||
"issues": "${issues_url}"
|
||||
},
|
||||
"license": "${license}",
|
||||
"environment": "*",
|
||||
"icon": "${logo_fabric}",
|
||||
"entrypoints": {
|
||||
"main": [
|
||||
"com.craisinlord.antarchy.fabric.AntarchyFabric"
|
||||
],
|
||||
"client": [
|
||||
"com.craisinlord.antarchy.fabric.client.AntarchyFabricClient"
|
||||
]
|
||||
},
|
||||
"mixins": [
|
||||
"antarchy-common.mixins.json",
|
||||
"antarchy-fabric.mixins.json"
|
||||
],
|
||||
"depends": {
|
||||
"fabricloader": ">=${fabric_loader_version}",
|
||||
"minecraft": "~${minecraft_version}",
|
||||
"java": ">=17",
|
||||
"fabric-api": "*"
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user