first herc beetle implementation

This commit is contained in:
craisinlord committed 2026-06-30 14:02:16 -05:00
1 parent 14a1dfda1e
commit 8cabdb33bf
52 files changed
+2102 -411

No files matched your search

@@ -1,6 +1,9 @@
package com.craisinlord.antarchy.neoforge;
import com.craisinlord.antarchy.config.AntarchySettings;
import com.craisinlord.antarchy.content.network.HerculesBeetleImpactShakePayload;
import com.craisinlord.antarchy.content.network.HerculesBeetleImpactShakeSync;
import net.neoforged.neoforge.network.PacketDistributor;
import net.neoforged.fml.ModContainer;
import net.neoforged.fml.config.ModConfig;
import net.neoforged.fml.event.config.ModConfigEvent;
@@ -12,6 +15,7 @@ public final class AntarchyConfigModuleNeoforge {
modContainer.registerConfig(ModConfig.Type.COMMON, AntarchyMobsConfig.SPEC, "antarchy/antarchy_mobs.toml");
modContainer.registerConfig(ModConfig.Type.COMMON, AntarchyToolsConfig.SPEC, "antarchy/antarchy_tools.toml");
modContainer.registerConfig(ModConfig.Type.COMMON, AntarchyMiscConfig.SPEC, "antarchy/antarchy_misc.toml");
HerculesBeetleImpactShakeSync.setSink((player, ticks) -> PacketDistributor.sendToPlayer(player, new HerculesBeetleImpactShakePayload(ticks)));
AntarchyNeoforge.modEventBusTempHolder.addListener(AntarchyConfigModuleNeoforge::onConfigChange);
}
@@ -169,6 +173,9 @@ public final class AntarchyConfigModuleNeoforge {
AntarchySettings.setCheepHealth(AntarchyMobsConfig.cheepHealth());
AntarchySettings.setCheepAttackDamage(AntarchyMobsConfig.cheepAttackDamage());
AntarchySettings.setDorrieHealth(AntarchyMobsConfig.dorrieHealth());
AntarchySettings.setHerculesBeetleHealth(AntarchyMobsConfig.herculesBeetleHealth());
AntarchySettings.setHerculesBeetleAttackDamage(AntarchyMobsConfig.herculesBeetleAttackDamage());
AntarchySettings.setHerculesBeetleChargeDamage(AntarchyMobsConfig.herculesBeetleChargeDamage());
}
private static void bakeToolsConfig() {
@@ -193,6 +193,13 @@ public final class AntarchyMobsConfig {
private static final ModConfigSpec.DoubleValue DORRIE_HEALTH;
// Hercules Beetle
private static final ModConfigSpec.DoubleValue HERCULES_BEETLE_HEALTH;
private static final ModConfigSpec.DoubleValue HERCULES_BEETLE_ATTACK_DAMAGE;
private static final ModConfigSpec.DoubleValue HERCULES_BEETLE_CHARGE_DAMAGE;
// Lucid
private static final ModConfigSpec.DoubleValue LUCID_ATTACK_RANGE;
@@ -493,6 +500,12 @@ public final class AntarchyMobsConfig {
DORRIE_HEALTH = b.comment("Base max health.").defineInRange("health", 60.0D, 1.0D, 32768.0D);
b.pop();
b.push("herculesBeetle");
HERCULES_BEETLE_HEALTH = b.comment("Base max health.").defineInRange("health", 500.0D, 1.0D, 32768.0D);
HERCULES_BEETLE_ATTACK_DAMAGE = b.comment("Base melee damage for ground and flying attacks.").defineInRange("attackDamage", 30.0D, 0.0D, 1024.0D);
HERCULES_BEETLE_CHARGE_DAMAGE = b.comment("AOE impact damage dealt when a charge collides.").defineInRange("chargeDamage", 40.0D, 0.0D, 1024.0D);
b.pop();
b.push("toreterror");
TORETERROR_HEALTH = b.comment("Base max health.").defineInRange("health", 300.0D, 1.0D, 32768.0D);
TORETERROR_JUMP_ATTACK_DAMAGE = b.comment("Damage dealt by the jump shockwave.").defineInRange("jumpAttackDamage", 14.0D, 0.0D, 1024.0D);
@@ -652,4 +665,7 @@ public final class AntarchyMobsConfig {
static double cheepHealth() { return CHEEP_HEALTH.get(); }
static double cheepAttackDamage() { return CHEEP_ATTACK_DAMAGE.get(); }
static double dorrieHealth() { return DORRIE_HEALTH.get(); }
static double herculesBeetleHealth() { return HERCULES_BEETLE_HEALTH.get(); }
static double herculesBeetleAttackDamage() { return HERCULES_BEETLE_ATTACK_DAMAGE.get(); }
static double herculesBeetleChargeDamage() { return HERCULES_BEETLE_CHARGE_DAMAGE.get(); }
}
@@ -268,6 +268,7 @@ public class AntarchyNeoforge {
() -> AntarchyNeoforgeMisc.BLOODGLASS_MAX_HEARTS,
() -> AntarchyNeoforgeMisc.BLOODGLASS_WARD
);
AntarchyObjects.setHerculesBeetle(AntarchyNeoforgeEntites.HERCULES_BEETLE);
AntarchyObjects.setOctopusBomb(AntarchyNeoforgeEntites.OCTOPUS_BOMB);
}
@@ -29,11 +29,20 @@ public final class AntarchyKeyBindings {
CATEGORY
);
public static final KeyMapping HERCULES_BEETLE_CHARGE = new KeyMapping(
"key.antarchy.hercules_beetle_charge",
KeyConflictContext.IN_GAME,
InputConstants.Type.KEYSYM,
InputConstants.KEY_LCONTROL,
CATEGORY
);
private AntarchyKeyBindings() {}
@SubscribeEvent
public static void onRegisterKeyMappings(RegisterKeyMappingsEvent event) {
event.register(BRUTALFLY_FLAP);
event.register(DORRIE_CHARGE_JUMP);
event.register(HERCULES_BEETLE_CHARGE);
}
}
@@ -132,6 +132,7 @@ public final class AntarchyNeoForgeClient {
event.registerEntityRenderer(AntarchyNeoforgeEntites.LURKING_TERROR.get(), LurkingTerrorRenderer::new);
event.registerEntityRenderer(AntarchyNeoforgeEntites.CHEEP.get(), context -> withParalyzedGeoLayer(new com.craisinlord.antarchy.content.client.renderer.CheepRenderer(context)));
event.registerEntityRenderer(AntarchyNeoforgeEntites.DORRIE.get(), context -> withParalyzedGeoLayer(new com.craisinlord.antarchy.content.client.renderer.DorrieRenderer(context)));
event.registerEntityRenderer(AntarchyNeoforgeEntites.HERCULES_BEETLE.get(), context -> withParalyzedGeoLayer(new com.craisinlord.antarchy.content.client.renderer.HerculesBeetleRenderer(context)));
}
@SubscribeEvent
@@ -1,8 +1,9 @@
package com.craisinlord.antarchy.neoforge.client;
import com.craisinlord.antarchy.Antarchy;
import com.craisinlord.antarchy.content.client.HerculesBeetleImpactShakeClientState;
import com.craisinlord.antarchy.content.entity.ToreterrorEntity;
import com.craisinlord.antarchy.content.item.BigBerthaItem;
import com.craisinlord.antarchy.content.entity.nightmare.NightmareEntity;
import net.minecraft.client.Minecraft;
import net.minecraft.util.Mth;
import net.minecraft.world.phys.Vec3;
@@ -12,11 +13,12 @@ import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.neoforge.client.event.ViewportEvent;
@EventBusSubscriber(modid = Antarchy.MODID, value = Dist.CLIENT)
public final class ToreterrorCameraShakeHandler {
public final class CameraShakeHandler {
private static final double MAX_SHAKE_RANGE = 48.0D;
private static final int TORETERROR_SHAKE_TICKS = 25;
private static final double NIGHTMARE_SHAKE_RANGE = 32.0D;
private ToreterrorCameraShakeHandler() {
private CameraShakeHandler() {
}
@SubscribeEvent
@@ -37,8 +39,19 @@ public final class ToreterrorCameraShakeHandler {
shakeStrength += (float) ((1.0D - distance / MAX_SHAKE_RANGE) * 1.0D);
}
if (BigBerthaItem.clientShakeTicks > 0) {
shakeStrength += (float) BigBerthaItem.clientShakeTicks / TORETERROR_SHAKE_TICKS * 2.0F;
for (NightmareEntity nightmare : mc.level.getEntitiesOfClass(
NightmareEntity.class,
mc.player.getBoundingBox().inflate(NIGHTMARE_SHAKE_RANGE),
entity -> entity.isAlive() && entity.isRoaring()
)) {
double distance = Math.sqrt(cameraPos.distanceToSqr(nightmare.position().add(0.0D, nightmare.getBbHeight() * 0.5D, 0.0D)));
if (distance > NIGHTMARE_SHAKE_RANGE) continue;
shakeStrength += (float) ((1.0D - distance / NIGHTMARE_SHAKE_RANGE) * 1.35D);
}
int beetleShakeTicks = HerculesBeetleImpactShakeClientState.getTicks();
if (beetleShakeTicks > 0) {
shakeStrength += (float) beetleShakeTicks / TORETERROR_SHAKE_TICKS * 2.0F;
}
if (shakeStrength <= 0.0F) return;
@@ -0,0 +1,76 @@
package com.craisinlord.antarchy.neoforge.client;
import com.craisinlord.antarchy.Antarchy;
import com.craisinlord.antarchy.content.client.HerculesBeetleImpactShakeClientState;
import com.craisinlord.antarchy.content.entity.HerculesBeetleEntity;
import com.craisinlord.antarchy.content.network.HerculesBeetleJumpInputPayload;
import com.craisinlord.antarchy.content.network.HerculesBeetleMountedAttackPayload;
import com.craisinlord.antarchy.content.network.HerculesBeetleMountedChargePayload;
import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.neoforge.client.event.ClientTickEvent;
import net.neoforged.neoforge.network.PacketDistributor;
@EventBusSubscriber(modid = Antarchy.MODID, value = Dist.CLIENT)
public final class HerculesBeetleClientHandler {
private static final int MAX_CHARGE_TICKS = 40;
private static boolean wasPressingJump;
private static boolean wasPressingAttack;
private static boolean wasCharging;
private static int chargeTicks;
private HerculesBeetleClientHandler() {
}
@SubscribeEvent
public static void onClientTick(ClientTickEvent.Post event) {
HerculesBeetleImpactShakeClientState.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) {
PacketDistributor.sendToServer(new HerculesBeetleJumpInputPayload(pressingJump));
wasPressingJump = pressingJump;
}
boolean pressingAttack = mc.options.keyAttack.isDown();
if (pressingAttack && !wasPressingAttack) {
PacketDistributor.sendToServer(new HerculesBeetleMountedAttackPayload());
}
wasPressingAttack = pressingAttack;
boolean charging = AntarchyKeyBindings.HERCULES_BEETLE_CHARGE.isDown();
if (charging) {
chargeTicks = Math.min(chargeTicks + 1, MAX_CHARGE_TICKS);
} else if (wasCharging && chargeTicks > 0) {
PacketDistributor.sendToServer(new HerculesBeetleMountedChargePayload(chargeTicks));
chargeTicks = 0;
}
wasCharging = charging;
}
private static void resetAll() {
if (wasPressingJump) {
PacketDistributor.sendToServer(new HerculesBeetleJumpInputPayload(false));
wasPressingJump = false;
}
wasPressingAttack = false;
wasCharging = false;
chargeTicks = 0;
}
}
@@ -0,0 +1,73 @@
package com.craisinlord.antarchy.neoforge.network;
import com.craisinlord.antarchy.content.client.HerculesBeetleImpactShakeClientState;
import com.craisinlord.antarchy.content.entity.HerculesBeetleEntity;
import com.craisinlord.antarchy.content.network.HerculesBeetleImpactShakePayload;
import com.craisinlord.antarchy.content.network.HerculesBeetleJumpInputPayload;
import com.craisinlord.antarchy.content.network.HerculesBeetleMountedAttackPayload;
import com.craisinlord.antarchy.content.network.HerculesBeetleMountedChargePayload;
import net.minecraft.server.level.ServerPlayer;
import net.neoforged.neoforge.network.handling.IPayloadContext;
import net.neoforged.neoforge.network.registration.PayloadRegistrar;
public final class HerculesBeetleNetworking {
private HerculesBeetleNetworking() {
}
public static void register(PayloadRegistrar registrar) {
registrar.playToServer(
HerculesBeetleJumpInputPayload.TYPE,
HerculesBeetleJumpInputPayload.STREAM_CODEC,
HerculesBeetleNetworking::handleJumpInput
).playToServer(
HerculesBeetleMountedAttackPayload.TYPE,
HerculesBeetleMountedAttackPayload.STREAM_CODEC,
HerculesBeetleNetworking::handleMountedAttack
).playToServer(
HerculesBeetleMountedChargePayload.TYPE,
HerculesBeetleMountedChargePayload.STREAM_CODEC,
HerculesBeetleNetworking::handleMountedCharge
).playToClient(
HerculesBeetleImpactShakePayload.TYPE,
HerculesBeetleImpactShakePayload.STREAM_CODEC,
HerculesBeetleNetworking::handleImpactShake
);
}
private static void handleJumpInput(HerculesBeetleJumpInputPayload payload, IPayloadContext context) {
context.enqueueWork(() -> {
if (!(context.player() instanceof ServerPlayer player)) {
return;
}
if (player.getVehicle() instanceof HerculesBeetleEntity beetle) {
beetle.setRiderJumpPressed(payload.pressing());
}
});
}
private static void handleMountedAttack(HerculesBeetleMountedAttackPayload payload, IPayloadContext context) {
context.enqueueWork(() -> {
if (!(context.player() instanceof ServerPlayer player)) {
return;
}
if (player.getVehicle() instanceof HerculesBeetleEntity beetle) {
beetle.handleMountedRegularAttack(player);
}
});
}
private static void handleMountedCharge(HerculesBeetleMountedChargePayload payload, IPayloadContext context) {
context.enqueueWork(() -> {
if (!(context.player() instanceof ServerPlayer player)) {
return;
}
if (player.getVehicle() instanceof HerculesBeetleEntity beetle) {
beetle.handleMountedCharge(player, payload.chargeTicks());
}
});
}
private static void handleImpactShake(HerculesBeetleImpactShakePayload payload, IPayloadContext context) {
context.enqueueWork(() -> HerculesBeetleImpactShakeClientState.trigger(payload.durationTicks()));
}
}
@@ -115,7 +115,6 @@ public class AntarchyNeoforgeCreativeModeTabs {
}
if (event.getTabKey() == CreativeModeTabs.TOOLS_AND_UTILITIES) {
event.accept(AntarchyNeoforgeItems.CHEEP_ON_A_STICK.get());
event.insertAfter(new ItemStack(Items.SHEARS), new ItemStack(AntarchyNeoforgeItems.DUCT_TAPE_ITEM.get()), CreativeModeTab.TabVisibility.PARENT_AND_SEARCH_TABS);
event.insertAfter(new ItemStack(Items.MINECART), new ItemStack(AntarchyNeoforgeItems.DIAMOND_MINECART_ITEM.get()), CreativeModeTab.TabVisibility.PARENT_AND_SEARCH_TABS);
event.accept(AntarchyNeoforgeItems.BILE_BUCKET.get());
@@ -384,7 +383,7 @@ public class AntarchyNeoforgeCreativeModeTabs {
// 8 - Blood crystal blocks (not the shard ingredient)
case "blood_crystal_block", "small_blood_crystal_bud", "medium_blood_crystal_bud",
"large_blood_crystal_bud", "budding_blood_crystal", "blood_crystal_cluster",
"myrmite", "broodstone", "chiten_block", "amber_moss_block", "amber_moss_carpet" -> 8;
"myrmite", "broodstone", "chiten_block", "chiten_spike", "amber_moss_block", "amber_moss_carpet" -> 8;
// 9 - Ouranwood leaves
case "ouranwood_leaves" -> 9;
@@ -409,7 +408,7 @@ public class AntarchyNeoforgeCreativeModeTabs {
// 15 - Tools
case "ultimate_pickaxe", "ultimate_axe", "ultimate_shovel", "ultimate_hoe",
"duct_tape", "diamond_minecart", "gravity_sculk_sensor", "cheep_on_a_stick" -> 15;
"duct_tape", "diamond_minecart", "gravity_sculk_sensor" -> 15;
// 16 - Liquid buckets
case "bile_bucket", "ichor_bucket", "antiwater_bucket", "cloud_bucket" -> 16;
@@ -15,6 +15,7 @@ import com.craisinlord.antarchy.content.entity.DrTrayaurusEntity;
import com.craisinlord.antarchy.content.entity.EasterBunnyEntity;
import com.craisinlord.antarchy.content.entity.EmperorScorpionEntity;
import com.craisinlord.antarchy.content.entity.HushProjectileEntity;
import com.craisinlord.antarchy.content.entity.HerculesBeetleEntity;
import com.craisinlord.antarchy.content.entity.JumpyBugEntity;
import com.craisinlord.antarchy.content.entity.MantisEntity;
import com.craisinlord.antarchy.content.entity.MissileSquidEntity;
@@ -311,6 +312,11 @@ public final class AntarchyNeoforgeEntites {
.sized(2.4F, 2.0F)
.clientTrackingRange(10)
.build("dorrie"));
public static final DeferredHolder<EntityType<?>, EntityType<HerculesBeetleEntity>> HERCULES_BEETLE = ENTITY_TYPES.register("hercules_beetle",
() -> EntityType.Builder.of(HerculesBeetleEntity::new, MobCategory.MONSTER)
.sized(3.0F, 4.0F)
.clientTrackingRange(12)
.build("hercules_beetle"));
public static final DeferredHolder<EntityType<?>, EntityType<UpwardFallingBlockEntity>> UPWARD_FALLING_BLOCK = ENTITY_TYPES.register("upward_falling_block",
() -> EntityType.Builder.<UpwardFallingBlockEntity>of(
UpwardFallingBlockEntity::new, MobCategory.MISC)
@@ -74,6 +74,7 @@ public class AntarchyNeoforgeEntityAttributes {
event.put(AntarchyNeoforgeEntites.MOLEVORE.get(), MolevoreEntity.createAttributes().build());
event.put(AntarchyNeoforgeEntites.CHEEP.get(), com.craisinlord.antarchy.content.entity.CheepEntity.createAttributes().build());
event.put(AntarchyNeoforgeEntites.DORRIE.get(), com.craisinlord.antarchy.content.entity.DorrieEntity.createAttributes().build());
event.put(AntarchyNeoforgeEntites.HERCULES_BEETLE.get(), com.craisinlord.antarchy.content.entity.HerculesBeetleEntity.createAttributes().build());
}
private static AttributeSupplier.Builder buildAntAttributes(double health, double speed, double attackDamage) {
@@ -7,7 +7,6 @@ import com.craisinlord.antarchy.content.block.entity.PotentNyxiteBlockEntity;
import com.craisinlord.antarchy.content.block.entity.WaspNestBlockEntity;
import com.craisinlord.antarchy.content.entity.SizeRayProjectileEntity;
import com.craisinlord.antarchy.content.item.*;
import com.craisinlord.antarchy.content.item.CheepOnAStickItem;
import com.craisinlord.antarchy.content.item.BloodCrystalArmorItem;
import com.craisinlord.antarchy.content.item.BloodCrystalAppleItem;
import com.craisinlord.antarchy.content.item.BloodCrystalKatanaItem;
@@ -369,8 +368,6 @@ public final class AntarchyNeoforgeItems {
.nutrition(2)
.saturationModifier(0.2F)
.build())));
public static final DeferredItem<CheepOnAStickItem> CHEEP_ON_A_STICK = ITEMS.register("cheep_on_a_stick",
() -> new CheepOnAStickItem(new Item.Properties().stacksTo(1).durability(25)));
public static final DeferredItem<Item> MOLEWORM_ITEM = ITEMS.register("moleworm",
() -> new Item(new Item.Properties()
.food(new FoodProperties.Builder()
@@ -591,6 +588,8 @@ public final class AntarchyNeoforgeItems {
() -> new DeferredSpawnEggItem(AntarchyNeoforgeEntites.CHEEP, 0xAA22FF, 0x22FF44, new Item.Properties()));
public static final DeferredItem<DeferredSpawnEggItem> DORRIE_SPAWN_EGG = ITEMS.register("dorrie_spawn_egg",
() -> new DeferredSpawnEggItem(AntarchyNeoforgeEntites.DORRIE, 0x1B91B3, 0xC0E8FF, new Item.Properties()));
public static final DeferredItem<DeferredSpawnEggItem> HERCULES_BEETLE_SPAWN_EGG = ITEMS.register("hercules_beetle_spawn_egg",
() -> new DeferredSpawnEggItem(AntarchyNeoforgeEntites.HERCULES_BEETLE, 0x6B1F2A, 0xD4AF37, new Item.Properties().rarity(Rarity.RARE)));
private AntarchyNeoforgeItems() {}
@@ -4,6 +4,7 @@ import com.craisinlord.antarchy.content.network.BloodCrystalKatanaTrailPayload;
import com.craisinlord.antarchy.neoforge.network.AntarchyGravityNetworking;
import com.craisinlord.antarchy.neoforge.network.BrutalflyElytraNetworking;
import com.craisinlord.antarchy.neoforge.network.DorrieJumpNetworking;
import com.craisinlord.antarchy.neoforge.network.HerculesBeetleNetworking;
import com.craisinlord.antarchy.neoforge.network.JumpyBootsNetworking;
import com.craisinlord.antarchy.neoforge.network.MultipartNetworking;
import net.neoforged.bus.api.IEventBus;
@@ -22,6 +23,7 @@ public class AntarchyNeoforgePayloadHandlers {
BrutalflyElytraNetworking.register(registrar);
JumpyBootsNetworking.register(registrar);
DorrieJumpNetworking.register(registrar);
HerculesBeetleNetworking.register(registrar);
registrar.playToClient(
com.craisinlord.antarchy.content.network.BloodglassStatePayload.TYPE,
com.craisinlord.antarchy.content.network.BloodglassStatePayload.STREAM_CODEC,