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

@@ -150,7 +150,7 @@ public final class AntarchySettings {
private static int basiliskSpawnMaxLightLevel = 5; private static int basiliskSpawnMaxLightLevel = 5;
private static double basiliskHealth = 150.0D; private static double basiliskHealth = 150.0D;
private static double basiliskAttackDamage = 36.0D; private static double basiliskAttackDamage = 36.0D;
private static double basiliskMovementSpeed = 0.30D; private static double basiliskMovementSpeed = 0.225D;
private static double basiliskArmor = 6.0D; private static double basiliskArmor = 6.0D;
private static double basiliskKnockbackResistance = 0.5D; private static double basiliskKnockbackResistance = 0.5D;
private static double basiliskFollowRange = 28.0D; private static double basiliskFollowRange = 28.0D;
@@ -470,6 +470,9 @@ public final class AntarchySettings {
private static double cheepHealth = 8.0D; private static double cheepHealth = 8.0D;
private static double cheepAttackDamage = 3.0D; private static double cheepAttackDamage = 3.0D;
private static double dorrieHealth = 60.0D; private static double dorrieHealth = 60.0D;
private static double herculesBeetleHealth = 500.0D;
private static double herculesBeetleAttackDamage = 30.0D;
private static double herculesBeetleChargeDamage = 40.0D;
private AntarchySettings() { private AntarchySettings() {
} }
@@ -2398,5 +2401,11 @@ public final class AntarchySettings {
public static double cheepAttackDamage() { return cheepAttackDamage; } public static double cheepAttackDamage() { return cheepAttackDamage; }
public static void setCheepAttackDamage(double v) { cheepAttackDamage = v; } public static void setCheepAttackDamage(double v) { cheepAttackDamage = v; }
public static double dorrieHealth() { return dorrieHealth; } public static double dorrieHealth() { return dorrieHealth; }
public static double herculesBeetleHealth() { return herculesBeetleHealth; }
public static void setHerculesBeetleHealth(double v) { herculesBeetleHealth = v; }
public static double herculesBeetleAttackDamage() { return herculesBeetleAttackDamage; }
public static void setHerculesBeetleAttackDamage(double v) { herculesBeetleAttackDamage = v; }
public static double herculesBeetleChargeDamage() { return herculesBeetleChargeDamage; }
public static void setHerculesBeetleChargeDamage(double v) { herculesBeetleChargeDamage = v; }
public static void setDorrieHealth(double v) { dorrieHealth = v; } public static void setDorrieHealth(double v) { dorrieHealth = v; }
} }
@@ -5,6 +5,7 @@ import com.craisinlord.antarchy.content.entity.BomberEntity;
import com.craisinlord.antarchy.content.entity.ButterflyEntity; import com.craisinlord.antarchy.content.entity.ButterflyEntity;
import com.craisinlord.antarchy.content.entity.CaterpillarEntity; import com.craisinlord.antarchy.content.entity.CaterpillarEntity;
import com.craisinlord.antarchy.content.entity.EasterBunnyEntity; import com.craisinlord.antarchy.content.entity.EasterBunnyEntity;
import com.craisinlord.antarchy.content.entity.HerculesBeetleEntity;
import com.craisinlord.antarchy.content.entity.HushProjectileEntity; import com.craisinlord.antarchy.content.entity.HushProjectileEntity;
import com.craisinlord.antarchy.content.entity.StinkBugEntity; import com.craisinlord.antarchy.content.entity.StinkBugEntity;
import com.craisinlord.antarchy.content.entity.WaterBombEntity; import com.craisinlord.antarchy.content.entity.WaterBombEntity;
@@ -96,6 +97,8 @@ public final class AntarchyObjects {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static Supplier<EntityType<com.craisinlord.antarchy.content.entity.DorrieEntity>> DORRIE = (Supplier<EntityType<com.craisinlord.antarchy.content.entity.DorrieEntity>>) UNBOUND; public static Supplier<EntityType<com.craisinlord.antarchy.content.entity.DorrieEntity>> DORRIE = (Supplier<EntityType<com.craisinlord.antarchy.content.entity.DorrieEntity>>) UNBOUND;
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static Supplier<EntityType<HerculesBeetleEntity>> HERCULES_BEETLE = (Supplier<EntityType<HerculesBeetleEntity>>) UNBOUND;
@SuppressWarnings("unchecked")
public static Supplier<net.minecraft.world.item.Item> CHEEP_ITEM = (Supplier<net.minecraft.world.item.Item>) UNBOUND; public static Supplier<net.minecraft.world.item.Item> CHEEP_ITEM = (Supplier<net.minecraft.world.item.Item>) UNBOUND;
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static Supplier<Block> DUPLICATOR_LOG = (Supplier<Block>) UNBOUND; public static Supplier<Block> DUPLICATOR_LOG = (Supplier<Block>) UNBOUND;
@@ -433,6 +436,10 @@ public final class AntarchyObjects {
OCTOPUS_BOMB = supplier; OCTOPUS_BOMB = supplier;
} }
public static void setHerculesBeetle(Supplier<EntityType<HerculesBeetleEntity>> supplier) {
HERCULES_BEETLE = supplier;
}
public static BlockBehaviour.Properties shellstoneProperties() { public static BlockBehaviour.Properties shellstoneProperties() {
return BlockBehaviour.Properties.ofFullCopy(Blocks.STONE).requiresCorrectToolForDrops(); return BlockBehaviour.Properties.ofFullCopy(Blocks.STONE).requiresCorrectToolForDrops();
} }
@@ -30,6 +30,7 @@ public final class AntarchyTags {
public static final TagKey<Block> MOLEVORE_SEE_THROUGH_BLOCKS = TagKey.create(Registries.BLOCK, id("molevore_see_through_blocks")); public static final TagKey<Block> MOLEVORE_SEE_THROUGH_BLOCKS = TagKey.create(Registries.BLOCK, id("molevore_see_through_blocks"));
public static final TagKey<Block> TERMITE_FOODS = TagKey.create(Registries.BLOCK, id("termite_foods")); public static final TagKey<Block> TERMITE_FOODS = TagKey.create(Registries.BLOCK, id("termite_foods"));
public static final TagKey<Block> UMBRAL_MOSS_REPLACEABLE = TagKey.create(Registries.BLOCK, id("umbral_moss_replaceable")); public static final TagKey<Block> UMBRAL_MOSS_REPLACEABLE = TagKey.create(Registries.BLOCK, id("umbral_moss_replaceable"));
public static final TagKey<Block> HERCULES_BEETLE_CHARGE_IMMUNE_BLOCKS = TagKey.create(Registries.BLOCK, id("hercules_beetle_charge_immune_blocks"));
private Blocks() { private Blocks() {
} }
@@ -88,6 +89,7 @@ public final class AntarchyTags {
public static final TagKey<Item> CATERPILLAR_FOODS = TagKey.create(Registries.ITEM, id("caterpillar_foods")); public static final TagKey<Item> CATERPILLAR_FOODS = TagKey.create(Registries.ITEM, id("caterpillar_foods"));
public static final TagKey<Item> BUTTERFLY_BREEDING_FOODS = TagKey.create(Registries.ITEM, id("butterfly_breeding_foods")); public static final TagKey<Item> BUTTERFLY_BREEDING_FOODS = TagKey.create(Registries.ITEM, id("butterfly_breeding_foods"));
public static final TagKey<Item> REVERIE_DUPLICATION_ITEMS = TagKey.create(Registries.ITEM, id("reverie_duplication_items")); public static final TagKey<Item> REVERIE_DUPLICATION_ITEMS = TagKey.create(Registries.ITEM, id("reverie_duplication_items"));
public static final TagKey<Item> HERCULES_BEETLE_FOOD = TagKey.create(Registries.ITEM, id("hercules_beetle_food"));
private Items() { private Items() {
} }
@@ -104,6 +104,19 @@ public final class StinkyBehavior {
applyNearbyNausea(entity, STINK_BUG_AURA_RADIUS, STINK_BUG_BURST_NAUSEA_DURATION_TICKS); applyNearbyNausea(entity, STINK_BUG_AURA_RADIUS, STINK_BUG_BURST_NAUSEA_DURATION_TICKS);
} }
public static void applyBurstStinkyEffect(LivingEntity source, double radius, int durationTicks) {
if (source.level().isClientSide()) {
return;
}
for (LivingEntity entity : source.level().getEntitiesOfClass(
LivingEntity.class,
source.getBoundingBox().inflate(radius),
e -> e.isAlive() && e != source
)) {
entity.addEffect(new MobEffectInstance(AntarchyObjects.STINKY_EFFECT.get(), durationTicks, 0, false, true, true));
}
}
public static void applyNearbyNausea(LivingEntity source, double radius, int durationTicks) { public static void applyNearbyNausea(LivingEntity source, double radius, int durationTicks) {
if (source.level().isClientSide()) { if (source.level().isClientSide()) {
return; return;
@@ -0,0 +1,26 @@
package com.craisinlord.antarchy.content.client;
public final class HerculesBeetleImpactShakeClientState {
private static int shakeTicks;
private HerculesBeetleImpactShakeClientState() {
}
public static void trigger(int ticks) {
shakeTicks = Math.max(shakeTicks, Math.max(0, ticks));
}
public static void tick() {
if (shakeTicks > 0) {
shakeTicks--;
}
}
public static int getTicks() {
return shakeTicks;
}
public static void clear() {
shakeTicks = 0;
}
}
@@ -0,0 +1,28 @@
package com.craisinlord.antarchy.content.client.model;
import com.craisinlord.antarchy.Antarchy;
import com.craisinlord.antarchy.content.entity.HerculesBeetleEntity;
import net.minecraft.resources.ResourceLocation;
import software.bernie.geckolib.model.GeoModel;
public class HerculesBeetleModel extends GeoModel<HerculesBeetleEntity> {
private static final ResourceLocation TEXTURE =
ResourceLocation.fromNamespaceAndPath(Antarchy.MODID, "textures/entity/hercules_beetle/hercules_beetle.png");
private static final ResourceLocation TEXTURE_SADDLED =
ResourceLocation.fromNamespaceAndPath(Antarchy.MODID, "textures/entity/hercules_beetle/hercules_beetle_saddle.png");
@Override
public ResourceLocation getModelResource(HerculesBeetleEntity animatable) {
return ResourceLocation.fromNamespaceAndPath(Antarchy.MODID, "geo/hercules_beetle.geo.json");
}
@Override
public ResourceLocation getTextureResource(HerculesBeetleEntity animatable) {
return animatable.hasSaddle() ? TEXTURE_SADDLED : TEXTURE;
}
@Override
public ResourceLocation getAnimationResource(HerculesBeetleEntity animatable) {
return ResourceLocation.fromNamespaceAndPath(Antarchy.MODID, "animations/hercules_beetle.animation.json");
}
}
@@ -0,0 +1,12 @@
package com.craisinlord.antarchy.content.client.renderer;
import com.craisinlord.antarchy.content.client.model.HerculesBeetleModel;
import com.craisinlord.antarchy.content.entity.HerculesBeetleEntity;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class HerculesBeetleRenderer extends GeoEntityRenderer<HerculesBeetleEntity> {
public HerculesBeetleRenderer(EntityRendererProvider.Context context) {
super(context, new HerculesBeetleModel());
}
}
@@ -1,40 +0,0 @@
package com.craisinlord.antarchy.content.client.screen;
import com.craisinlord.antarchy.Antarchy;
import com.craisinlord.antarchy.content.menu.DorrieMenu;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Inventory;
public class DorrieScreen extends AbstractContainerScreen<DorrieMenu> {
// A 176 × 130 texture: saddle slot area at top, player inventory below.
// Art file: assets/antarchy/textures/gui/container/dorrie.png
private static final ResourceLocation TEXTURE =
ResourceLocation.fromNamespaceAndPath(Antarchy.MODID, "textures/gui/container/dorrie.png");
public static final int TEXTURE_WIDTH = 176;
public static final int TEXTURE_HEIGHT = 130;
public DorrieScreen(DorrieMenu menu, Inventory playerInventory, Component title) {
super(menu, playerInventory, title);
this.imageWidth = TEXTURE_WIDTH;
this.imageHeight = TEXTURE_HEIGHT;
this.inventoryLabelY = this.imageHeight - 94;
}
@Override
protected void renderBg(GuiGraphics guiGraphics, float partialTick, int mouseX, int mouseY) {
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
guiGraphics.blit(TEXTURE, this.leftPos, this.topPos, 0, 0, this.imageWidth, this.imageHeight);
}
@Override
public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) {
this.renderBackground(guiGraphics, mouseX, mouseY, partialTick);
super.render(guiGraphics, mouseX, mouseY, partialTick);
this.renderTooltip(guiGraphics, mouseX, mouseY);
}
}
@@ -1,13 +1,14 @@
package com.craisinlord.antarchy.content.entity; package com.craisinlord.antarchy.content.entity;
import com.craisinlord.antarchy.content.AntarchyObjects;
import com.craisinlord.antarchy.config.AntarchySettings; import com.craisinlord.antarchy.config.AntarchySettings;
import com.craisinlord.antarchy.content.item.CheepOnAStickItem; import java.util.EnumSet;
import java.util.List;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.EntityDataSerializers;
import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundEvents;
@@ -31,8 +32,6 @@ import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal;
import net.minecraft.world.entity.ai.goal.RandomLookAroundGoal; import net.minecraft.world.entity.ai.goal.RandomLookAroundGoal;
import net.minecraft.world.entity.ai.goal.RandomSwimmingGoal; import net.minecraft.world.entity.ai.goal.RandomSwimmingGoal;
import net.minecraft.world.entity.ai.goal.TryFindWaterGoal; import net.minecraft.world.entity.ai.goal.TryFindWaterGoal;
import java.util.EnumSet;
import java.util.List;
import net.minecraft.world.entity.ai.navigation.PathNavigation; import net.minecraft.world.entity.ai.navigation.PathNavigation;
import net.minecraft.world.entity.ai.navigation.WaterBoundPathNavigation; import net.minecraft.world.entity.ai.navigation.WaterBoundPathNavigation;
import net.minecraft.world.entity.animal.Animal; import net.minecraft.world.entity.animal.Animal;
@@ -40,7 +39,6 @@ import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items; import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import software.bernie.geckolib.animatable.GeoEntity; import software.bernie.geckolib.animatable.GeoEntity;
@@ -54,6 +52,7 @@ import software.bernie.geckolib.util.GeckoLibUtil;
public class DorrieEntity extends Animal implements GeoEntity { public class DorrieEntity extends Animal implements GeoEntity {
private static final ResourceLocation CHEEP_ITEM_ID = ResourceLocation.fromNamespaceAndPath("antarchy", "cheep"); private static final ResourceLocation CHEEP_ITEM_ID = ResourceLocation.fromNamespaceAndPath("antarchy", "cheep");
private static final EntityDataAccessor<Boolean> HAS_SADDLE = private static final EntityDataAccessor<Boolean> HAS_SADDLE =
SynchedEntityData.defineId(DorrieEntity.class, EntityDataSerializers.BOOLEAN); SynchedEntityData.defineId(DorrieEntity.class, EntityDataSerializers.BOOLEAN);
private static final EntityDataAccessor<Boolean> TAMED = private static final EntityDataAccessor<Boolean> TAMED =
@@ -62,8 +61,8 @@ public class DorrieEntity extends Animal implements GeoEntity {
SynchedEntityData.defineId(DorrieEntity.class, EntityDataSerializers.INT); SynchedEntityData.defineId(DorrieEntity.class, EntityDataSerializers.INT);
private static final int MAX_CHARGE_TICKS = 40; private static final int MAX_CHARGE_TICKS = 40;
private static final float BASE_SPEED = 0.6F; private static final float WATER_RIDE_SPEED = 1.26F;
private static final float BOOSTED_SPEED = 1.3F; private static final float LAND_BEACH_SPEED = 0.04F;
private static final RawAnimation IDLE_ANIM = RawAnimation.begin().thenLoop("idle"); private static final RawAnimation IDLE_ANIM = RawAnimation.begin().thenLoop("idle");
private static final RawAnimation SWIM_ANIM = RawAnimation.begin().thenLoop("swim"); private static final RawAnimation SWIM_ANIM = RawAnimation.begin().thenLoop("swim");
@@ -73,16 +72,21 @@ public class DorrieEntity extends Animal implements GeoEntity {
private final AnimatableInstanceCache geoCache = GeckoLibUtil.createInstanceCache(this); private final AnimatableInstanceCache geoCache = GeckoLibUtil.createInstanceCache(this);
private static final int RIDES_TO_TAME = 4;
private static final int BUCK_DELAY_TICKS = 60;
private int chargeTicks = 0; private int chargeTicks = 0;
private boolean isCharging = false; private boolean isCharging = false;
private boolean isLeaping = false; private boolean isLeaping = false;
private boolean wasInAir = false; private boolean wasInAir = false;
private int landAnimTicks = 0; private int landAnimTicks = 0;
private boolean isPressingJump = false; private int rideAttempts = 0;
private int buckTimer = 0;
private int swimForwardTicks = 0;
public DorrieEntity(EntityType<? extends DorrieEntity> entityType, Level level) { public DorrieEntity(EntityType<? extends DorrieEntity> entityType, Level level) {
super(entityType, level); super(entityType, level);
this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, BASE_SPEED, 1.0F, true); this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 1.0F, true);
this.lookControl = new SmoothSwimmingLookControl(this, 10); this.lookControl = new SmoothSwimmingLookControl(this, 10);
} }
@@ -113,12 +117,11 @@ public class DorrieEntity extends Animal implements GeoEntity {
public static AttributeSupplier.Builder createAttributes() { public static AttributeSupplier.Builder createAttributes() {
return Mob.createMobAttributes() return Mob.createMobAttributes()
.add(Attributes.MAX_HEALTH, AntarchySettings.dorrieHealth()) .add(Attributes.MAX_HEALTH, AntarchySettings.dorrieHealth())
.add(Attributes.MOVEMENT_SPEED, BASE_SPEED) .add(Attributes.MOVEMENT_SPEED, 1.0D)
.add(Attributes.FOLLOW_RANGE, 16.0D) .add(Attributes.FOLLOW_RANGE, 16.0D)
.add(Attributes.ATTACK_DAMAGE, 4.0D); .add(Attributes.ATTACK_DAMAGE, 4.0D);
} }
public boolean hasSaddle() { public boolean hasSaddle() {
return this.entityData.get(HAS_SADDLE); return this.entityData.get(HAS_SADDLE);
} }
@@ -143,12 +146,12 @@ public class DorrieEntity extends Animal implements GeoEntity {
this.entityData.set(JUMP_CHARGE, charge); this.entityData.set(JUMP_CHARGE, charge);
} }
@Override @Override
public void addAdditionalSaveData(CompoundTag tag) { public void addAdditionalSaveData(CompoundTag tag) {
super.addAdditionalSaveData(tag); super.addAdditionalSaveData(tag);
tag.putBoolean("Tamed", this.isTamed()); tag.putBoolean("Tamed", this.isTamed());
tag.putBoolean("HasSaddle", this.hasSaddle()); tag.putBoolean("HasSaddle", this.hasSaddle());
tag.putInt("RideAttempts", this.rideAttempts);
} }
@Override @Override
@@ -156,28 +159,20 @@ public class DorrieEntity extends Animal implements GeoEntity {
super.readAdditionalSaveData(tag); super.readAdditionalSaveData(tag);
this.setTamed(tag.getBoolean("Tamed")); this.setTamed(tag.getBoolean("Tamed"));
this.setSaddle(tag.getBoolean("HasSaddle")); this.setSaddle(tag.getBoolean("HasSaddle"));
this.rideAttempts = tag.getInt("RideAttempts");
} }
@Override @Override
public InteractionResult mobInteract(Player player, InteractionHand hand) { public InteractionResult mobInteract(Player player, InteractionHand hand) {
ItemStack stack = player.getItemInHand(hand); ItemStack stack = player.getItemInHand(hand);
if (!this.isTamed()) { if (!this.isTamed()) {
if (!this.level().isClientSide && this.isCheepItem(stack)) { if (!this.level().isClientSide) {
if (!player.getAbilities().instabuild) stack.shrink(1); player.startRiding(this);
if (this.random.nextInt(3) == 0) {
this.setTamed(true);
this.playSound(SoundEvents.HORSE_BREATHE, 0.5F, 1.0F);
} else {
this.playSound(SoundEvents.DOLPHIN_HURT, 0.5F, 1.0F);
}
return InteractionResult.sidedSuccess(this.level().isClientSide);
} }
return super.mobInteract(player, hand); return InteractionResult.sidedSuccess(this.level().isClientSide);
} }
// Remove saddle with empty hand
if (this.hasSaddle() && stack.isEmpty() && !player.isPassengerOfSameVehicle(this)) { if (this.hasSaddle() && stack.isEmpty() && !player.isPassengerOfSameVehicle(this)) {
if (!this.level().isClientSide) { if (!this.level().isClientSide) {
this.setSaddle(false); this.setSaddle(false);
@@ -187,99 +182,112 @@ public class DorrieEntity extends Animal implements GeoEntity {
return InteractionResult.sidedSuccess(this.level().isClientSide); return InteractionResult.sidedSuccess(this.level().isClientSide);
} }
// Apply saddle
if (!this.hasSaddle() && stack.is(Items.SADDLE)) { if (!this.hasSaddle() && stack.is(Items.SADDLE)) {
if (!this.level().isClientSide) { if (!this.level().isClientSide) {
this.setSaddle(true); this.setSaddle(true);
if (!player.getAbilities().instabuild) stack.shrink(1); if (!player.getAbilities().instabuild) {
stack.shrink(1);
}
this.playSound(SoundEvents.HORSE_SADDLE, 1.0F, 1.0F); this.playSound(SoundEvents.HORSE_SADDLE, 1.0F, 1.0F);
} }
return InteractionResult.sidedSuccess(this.level().isClientSide); return InteractionResult.sidedSuccess(this.level().isClientSide);
} }
// Mount
if (this.hasSaddle() && !player.isPassengerOfSameVehicle(this)) { if (this.hasSaddle() && !player.isPassengerOfSameVehicle(this)) {
if (!this.level().isClientSide) player.startRiding(this); if (!this.level().isClientSide) {
player.startRiding(this);
}
return InteractionResult.sidedSuccess(this.level().isClientSide); return InteractionResult.sidedSuccess(this.level().isClientSide);
} }
return super.mobInteract(player, hand); return super.mobInteract(player, hand);
} }
@Override
public boolean isFood(ItemStack stack) {
return this.isCheepItem(stack);
}
@Override @Override
@Nullable @Nullable
public LivingEntity getControllingPassenger() { public LivingEntity getControllingPassenger() {
if (!this.isTamed() || !this.hasSaddle()) return null; if (!this.isTamed() || !this.hasSaddle()) {
return null;
}
Entity passenger = this.getFirstPassenger(); Entity passenger = this.getFirstPassenger();
if (passenger instanceof Player player) return player; if (passenger instanceof Player player) {
return player;
}
return null; return null;
} }
private boolean riderHasCheepStick(Player player) {
return player.getMainHandItem().getItem() instanceof CheepOnAStickItem
|| player.getOffhandItem().getItem() instanceof CheepOnAStickItem;
}
private ItemStack getCheepStick(Player player) {
if (player.getMainHandItem().getItem() instanceof CheepOnAStickItem) return player.getMainHandItem();
if (player.getOffhandItem().getItem() instanceof CheepOnAStickItem) return player.getOffhandItem();
return ItemStack.EMPTY;
}
@Override @Override
protected Vec3 getRiddenInput(Player player, Vec3 travelVector) { protected Vec3 getRiddenInput(Player player, Vec3 travelVector) {
if (!riderHasCheepStick(player)) return Vec3.ZERO; float forward = player.zza;
float forward = player.zza > 0 ? player.zza : player.zza / 4.0F;
float strafe = player.xxa * 0.5F; float strafe = player.xxa * 0.5F;
return new Vec3(strafe, travelVector.y, forward); return new Vec3(strafe, 0, forward);
} }
@Override @Override
protected float getRiddenSpeed(Player player) { protected float getRiddenSpeed(Player player) {
float speed = BASE_SPEED; float speed = (this.isInWater() || this.isInLava())
if (riderHasCheepStick(player)) { ? WATER_RIDE_SPEED * (1.0F + Math.min(this.swimForwardTicks, 60) * 0.025F)
speed = BOOSTED_SPEED; : LAND_BEACH_SPEED;
if (!this.level().isClientSide) {
ItemStack stick = getCheepStick(player);
if (!stick.isEmpty() && this.tickCount % 10 == 0) {
stick.hurtAndBreak(1, player,
player.getMainHandItem().getItem() instanceof CheepOnAStickItem
? net.minecraft.world.entity.EquipmentSlot.MAINHAND
: net.minecraft.world.entity.EquipmentSlot.OFFHAND);
}
}
}
return (float) this.getAttributeValue(Attributes.MOVEMENT_SPEED) * speed; return (float) this.getAttributeValue(Attributes.MOVEMENT_SPEED) * speed;
} }
@Override @Override
public void tick() { public void tick() {
super.tick(); super.tick();
if (!this.level().isClientSide) { if (this.getControllingPassenger() instanceof Player player) {
LivingEntity passenger = this.getControllingPassenger(); this.setYRot(player.getYRot());
this.yRotO = this.getYRot();
if (passenger != null && isPressingJump) { this.yBodyRot = this.getYRot();
Vec3 mov = this.getDeltaMovement(); this.yHeadRot = this.getYRot();
double boost = this.isInWater() ? 0.1D : 0.04D; if (this.isInWater() || this.isInLava()) {
this.setDeltaMovement(mov.x, Math.min(mov.y + boost, 0.5D), mov.z); if (player.zza > 0.05F) {
this.hasImpulse = true; this.swimForwardTicks = Math.min(this.swimForwardTicks + 1, 60);
} } else {
this.swimForwardTicks = Math.max(this.swimForwardTicks - 2, 0);
if (passenger instanceof Player && isCharging) { }
chargeTicks = Math.min(chargeTicks + 1, MAX_CHARGE_TICKS); } else {
setJumpCharge((int) ((chargeTicks / (float) MAX_CHARGE_TICKS) * 100)); this.swimForwardTicks = 0;
} }
} else {
this.swimForwardTicks = 0;
} }
if (landAnimTicks > 0) landAnimTicks--; if (!this.level().isClientSide && !this.isTamed() && this.getFirstPassenger() instanceof Player rider) {
buckTimer++;
if (buckTimer >= BUCK_DELAY_TICKS) {
rider.stopRiding();
buckTimer = 0;
rideAttempts++;
if (rideAttempts >= RIDES_TO_TAME) {
this.setTamed(true);
this.playSound(SoundEvents.HORSE_BREATHE, 0.8F, 1.0F);
} else {
this.playSound(SoundEvents.HORSE_ANGRY, 0.8F, 1.0F);
}
}
} else if (!this.isTamed() && this.getFirstPassenger() == null) {
buckTimer = 0;
}
if (!this.level().isClientSide && this.getControllingPassenger() instanceof Player && isCharging) {
chargeTicks = Math.min(chargeTicks + 1, MAX_CHARGE_TICKS);
setJumpCharge((int) ((chargeTicks / (float) MAX_CHARGE_TICKS) * 100));
}
// Surface buoyancy: when in water and not mid-leap, push toward the waterline.
// Stronger upward force when fully submerged, gentle when at the surface so
// Dorrie glides on top rather than diving or bouncing.
if (this.isInWater() && !isLeaping) {
Vec3 mov = this.getDeltaMovement();
double push = this.isUnderWater() ? 0.07D : 0.015D;
double cappedY = this.isUnderWater() ? 0.3D : 0.05D;
this.setDeltaMovement(mov.x, Math.min(mov.y + push, cappedY), mov.z);
}
if (landAnimTicks > 0) {
landAnimTicks--;
}
boolean inAirNow = !this.onGround() && !this.isInWater() && !this.isInLava(); boolean inAirNow = !this.onGround() && !this.isInWater() && !this.isInLava();
if (wasInAir && !inAirNow && isLeaping) { if (wasInAir && !inAirNow && isLeaping) {
@@ -289,32 +297,29 @@ public class DorrieEntity extends Animal implements GeoEntity {
wasInAir = inAirNow; wasInAir = inAirNow;
} }
public void setPressingJump(boolean pressing) {}
/** Called when the rider presses/releases space (up movement). */
public void setPressingJump(boolean pressing) {
this.isPressingJump = pressing;
}
/** Called when the rider presses left-control (charge start). */
public void startJumpCharge() { public void startJumpCharge() {
if (!this.level().isClientSide) { if (!this.level().isClientSide) {
isCharging = true; isCharging = true;
} }
} }
/** Called when the rider releases left-control (charge release). */
public void releaseJump() { public void releaseJump() {
if (!this.level().isClientSide && isCharging) { if (!this.level().isClientSide && isCharging) {
float power = chargeTicks / (float) MAX_CHARGE_TICKS; float power = chargeTicks / (float) MAX_CHARGE_TICKS;
if (power > 0.05F) { if (power > 0.05F) {
double horizontal = 0.8D + power * 1.4D;
double vertical = 0.4D + power * 0.8D;
Vec3 look = this.getLookAngle(); Vec3 look = this.getLookAngle();
Vec3 current = this.getDeltaMovement(); Vec3 current = this.getDeltaMovement();
// Add to existing momentum — no direction snap. The rider already has
// forward speed, so the jump just launches them upward and slightly
// accelerates in the direction they're already facing.
double forwardAdd = power * 0.5D;
double vertical = 0.55D + power * 0.9D;
this.setDeltaMovement( this.setDeltaMovement(
look.x * horizontal * 0.7D + current.x * 0.3D, current.x + look.x * forwardAdd,
vertical, vertical,
look.z * horizontal * 0.7D + current.z * 0.3D current.z + look.z * forwardAdd
); );
this.hasImpulse = true; this.hasImpulse = true;
isLeaping = true; isLeaping = true;
@@ -325,14 +330,14 @@ public class DorrieEntity extends Animal implements GeoEntity {
} }
} }
@Override @Override
protected void positionRider(Entity passenger, MoveFunction moveFunction) { protected void positionRider(Entity passenger, MoveFunction moveFunction) {
if (this.hasPassenger(passenger)) { if (this.hasPassenger(passenger)) {
Vec3 forward = this.getLookAngle().multiply(1.0D, 0.0D, 1.0D);
moveFunction.accept(passenger, moveFunction.accept(passenger,
this.getX(), this.getX() - forward.x * 0.25D,
this.getY() + this.getPassengersRidingOffset() + passenger.getBbHeight() * 0.5D, this.getY() + 0.5D,
this.getZ()); this.getZ() - forward.z * 0.25D);
} }
} }
@@ -340,7 +345,6 @@ public class DorrieEntity extends Animal implements GeoEntity {
return 0.6D; return 0.6D;
} }
@Override @Override
protected void dropEquipment() { protected void dropEquipment() {
super.dropEquipment(); super.dropEquipment();
@@ -349,14 +353,12 @@ public class DorrieEntity extends Animal implements GeoEntity {
} }
} }
@Override @Override
@Nullable @Nullable
public DorrieEntity getBreedOffspring(ServerLevel level, AgeableMob mob) { public DorrieEntity getBreedOffspring(ServerLevel level, AgeableMob mob) {
return null; return null;
} }
@Override @Override
public boolean canBeLeashed() { public boolean canBeLeashed() {
return true; return true;
@@ -382,14 +384,15 @@ public class DorrieEntity extends Animal implements GeoEntity {
return SoundEvents.DOLPHIN_SWIM; return SoundEvents.DOLPHIN_SWIM;
} }
@Override @Override
public void registerControllers(AnimatableManager.ControllerRegistrar controllers) { public void registerControllers(AnimatableManager.ControllerRegistrar controllers) {
controllers.add(new AnimationController<>(this, "main_controller", 2, this::mainAnimController)); controllers.add(new AnimationController<>(this, "main_controller", 2, this::mainAnimController));
} }
private PlayState mainAnimController(AnimationState<DorrieEntity> state) { private PlayState mainAnimController(AnimationState<DorrieEntity> state) {
if (landAnimTicks > 0) return state.setAndContinue(JUMP_LAND_ANIM); if (landAnimTicks > 0) {
return state.setAndContinue(JUMP_LAND_ANIM);
}
if (isLeaping) { if (isLeaping) {
return state.setAndContinue(wasInAir ? JUMP_LOOP_ANIM : JUMP_START_ANIM); return state.setAndContinue(wasInAir ? JUMP_LOOP_ANIM : JUMP_START_ANIM);
} }
@@ -401,12 +404,17 @@ public class DorrieEntity extends Animal implements GeoEntity {
return this.geoCache; return this.geoCache;
} }
@Override
public boolean isFood(ItemStack stack) {
return this.isCheepItem(stack);
}
private boolean isCheepItem(ItemStack stack) { private boolean isCheepItem(ItemStack stack) {
return !stack.isEmpty() && stack.is(BuiltInRegistries.ITEM.getOptional(CHEEP_ITEM_ID).orElse(Items.AIR)); return !stack.isEmpty() && stack.is(BuiltInRegistries.ITEM.getOptional(CHEEP_ITEM_ID).orElse(Items.AIR));
} }
private static class HuntCheepGoal extends Goal { private static class HuntCheepGoal extends Goal {
private static final int COOLDOWN_TICKS = 600; // 30 seconds private static final int COOLDOWN_TICKS = 600;
private static final double HUNT_RANGE = 16.0D; private static final double HUNT_RANGE = 16.0D;
private static final double ATTACK_RANGE_SQ = 2.5D * 2.5D; private static final double ATTACK_RANGE_SQ = 2.5D * 2.5D;
@@ -421,13 +429,21 @@ public class DorrieEntity extends Animal implements GeoEntity {
@Override @Override
public boolean canUse() { public boolean canUse() {
if (dorrie.level().isClientSide) return false; if (dorrie.level().isClientSide) {
if (cooldown > 0) { cooldown--; return false; } return false;
}
if (cooldown > 0) {
cooldown--;
return false;
}
if (dorrie.getControllingPassenger() != null) {
return false;
}
List<CheepEntity> nearby = dorrie.level().getEntitiesOfClass( List<CheepEntity> nearby = dorrie.level().getEntitiesOfClass(
CheepEntity.class, CheepEntity.class, dorrie.getBoundingBox().inflate(HUNT_RANGE));
dorrie.getBoundingBox().inflate(HUNT_RANGE) if (nearby.isEmpty()) {
); return false;
if (nearby.isEmpty()) return false; }
nearby.sort((a, b) -> Double.compare(a.distanceToSqr(dorrie), b.distanceToSqr(dorrie))); nearby.sort((a, b) -> Double.compare(a.distanceToSqr(dorrie), b.distanceToSqr(dorrie)));
target = nearby.get(0); target = nearby.get(0);
return true; return true;
@@ -435,7 +451,9 @@ public class DorrieEntity extends Animal implements GeoEntity {
@Override @Override
public boolean canContinueToUse() { public boolean canContinueToUse() {
return target != null && target.isAlive() && dorrie.distanceToSqr(target) <= HUNT_RANGE * HUNT_RANGE * 4; return target != null && target.isAlive()
&& dorrie.getControllingPassenger() == null
&& dorrie.distanceToSqr(target) <= HUNT_RANGE * HUNT_RANGE * 4;
} }
@Override @Override
@@ -445,11 +463,14 @@ public class DorrieEntity extends Animal implements GeoEntity {
@Override @Override
public void tick() { public void tick() {
if (target == null) return; if (target == null) {
return;
}
dorrie.getLookControl().setLookAt(target, 30.0F, 30.0F); dorrie.getLookControl().setLookAt(target, 30.0F, 30.0F);
dorrie.getNavigation().moveTo(target, 1.4D); dorrie.getNavigation().moveTo(target, 1.4D);
if (dorrie.distanceToSqr(target) <= ATTACK_RANGE_SQ) { if (dorrie.distanceToSqr(target) <= ATTACK_RANGE_SQ) {
target.hurt(dorrie.damageSources().mobAttack(dorrie), (float) dorrie.getAttributeValue(Attributes.ATTACK_DAMAGE)); target.hurt(dorrie.damageSources().mobAttack(dorrie),
(float) dorrie.getAttributeValue(Attributes.ATTACK_DAMAGE));
stop(); stop();
} }
} }
@@ -460,6 +481,5 @@ public class DorrieEntity extends Animal implements GeoEntity {
dorrie.getNavigation().stop(); dorrie.getNavigation().stop();
cooldown = COOLDOWN_TICKS; cooldown = COOLDOWN_TICKS;
} }
} }
} }
@@ -15,6 +15,7 @@ import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.ai.goal.FloatGoal; import net.minecraft.world.entity.ai.goal.FloatGoal;
import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal; import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal;
import net.minecraft.world.entity.ai.goal.PanicGoal;
import net.minecraft.world.entity.ai.goal.RandomLookAroundGoal; import net.minecraft.world.entity.ai.goal.RandomLookAroundGoal;
import net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal; import net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal;
import net.minecraft.world.entity.animal.Animal; import net.minecraft.world.entity.animal.Animal;
@@ -38,9 +39,12 @@ public class StinkBugEntity extends Animal implements GeoEntity {
private static final RawAnimation FART_ANIM = RawAnimation.begin().thenPlay("fart"); private static final RawAnimation FART_ANIM = RawAnimation.begin().thenPlay("fart");
private static final int FART_ANIMATION_TICKS = 30; private static final int FART_ANIMATION_TICKS = 30;
private static final int STINK_BURST_PARTICLES = 32; private static final int STINK_BURST_PARTICLES = 32;
private static final double STINK_BURST_RADIUS = 8.0D;
private static final int STINK_BURST_DURATION_TICKS = 1200;
private final AnimatableInstanceCache geoCache = GeckoLibUtil.createInstanceCache(this); private final AnimatableInstanceCache geoCache = GeckoLibUtil.createInstanceCache(this);
private int fartAnimationTicks; private int fartAnimationTicks;
private boolean pendingFartBurst;
public StinkBugEntity(EntityType<? extends StinkBugEntity> entityType, Level level) { public StinkBugEntity(EntityType<? extends StinkBugEntity> entityType, Level level) {
super(entityType, level); super(entityType, level);
@@ -65,9 +69,10 @@ public class StinkBugEntity extends Animal implements GeoEntity {
@Override @Override
protected void registerGoals() { protected void registerGoals() {
this.goalSelector.addGoal(0, new FloatGoal(this)); this.goalSelector.addGoal(0, new FloatGoal(this));
this.goalSelector.addGoal(1, new WaterAvoidingRandomStrollGoal(this, 0.9D)); this.goalSelector.addGoal(1, new PanicGoal(this, 1.4D));
this.goalSelector.addGoal(2, new LookAtPlayerGoal(this, Player.class, 6.0F)); this.goalSelector.addGoal(2, new WaterAvoidingRandomStrollGoal(this, 0.9D));
this.goalSelector.addGoal(3, new RandomLookAroundGoal(this)); this.goalSelector.addGoal(3, new LookAtPlayerGoal(this, Player.class, 6.0F));
this.goalSelector.addGoal(4, new RandomLookAroundGoal(this));
} }
@Override @Override
@@ -76,15 +81,20 @@ public class StinkBugEntity extends Animal implements GeoEntity {
if (this.fartAnimationTicks > 0) { if (this.fartAnimationTicks > 0) {
this.fartAnimationTicks--; this.fartAnimationTicks--;
if (this.fartAnimationTicks == 0 && this.pendingFartBurst && !this.level().isClientSide()) {
StinkyBehavior.emitBurst(this, STINK_BURST_PARTICLES);
StinkyBehavior.applyBurstStinkyEffect(this, STINK_BURST_RADIUS, STINK_BURST_DURATION_TICKS);
this.pendingFartBurst = false;
}
} }
} }
@Override @Override
public boolean hurt(DamageSource source, float amount) { public boolean hurt(DamageSource source, float amount) {
boolean hurt = super.hurt(source, amount); boolean hurt = super.hurt(source, amount);
if (hurt) { if (hurt && !this.pendingFartBurst) {
this.triggerFartAnimation(); this.triggerFartAnimation();
StinkyBehavior.emitBurst(this, STINK_BURST_PARTICLES); this.pendingFartBurst = true;
} }
return hurt; return hurt;
} }
@@ -163,6 +163,7 @@ public class ToreterrorEntity extends Monster implements GeoEntity {
@Override @Override
protected void registerGoals() { protected void registerGoals() {
this.goalSelector.addGoal(0, new ToreterrorFloatGoal());
this.goalSelector.addGoal(1, new ToreterrorRangedGoal()); this.goalSelector.addGoal(1, new ToreterrorRangedGoal());
this.goalSelector.addGoal(2, new ToreterrorJumpGoal()); this.goalSelector.addGoal(2, new ToreterrorJumpGoal());
this.goalSelector.addGoal(3, new ToreterrorSpinGoal()); this.goalSelector.addGoal(3, new ToreterrorSpinGoal());
@@ -822,6 +823,28 @@ public class ToreterrorEntity extends Monster implements GeoEntity {
} }
} }
private final class ToreterrorFloatGoal extends Goal {
ToreterrorFloatGoal() {
this.setFlags(EnumSet.of(Flag.JUMP));
}
@Override
public boolean canUse() {
return ToreterrorEntity.this.isInWater() && !ToreterrorEntity.this.onGround();
}
@Override
public boolean canContinueToUse() {
return canUse();
}
@Override
public void tick() {
Vec3 vel = ToreterrorEntity.this.getDeltaMovement();
ToreterrorEntity.this.setDeltaMovement(vel.x, Math.min(vel.y + 0.08D, 0.2D), vel.z);
}
}
private final class ToreterrorSpinGoal extends Goal { private final class ToreterrorSpinGoal extends Goal {
ToreterrorSpinGoal() { ToreterrorSpinGoal() {
this.setFlags(EnumSet.of(Flag.MOVE)); this.setFlags(EnumSet.of(Flag.MOVE));
@@ -55,6 +55,7 @@ import software.bernie.geckolib.animation.AnimationState;
import software.bernie.geckolib.util.GeckoLibUtil; import software.bernie.geckolib.util.GeckoLibUtil;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.Optional;
import java.util.UUID; import java.util.UUID;
public class FlyingSquirrelEntity extends TamableAnimal implements GeoEntity { public class FlyingSquirrelEntity extends TamableAnimal implements GeoEntity {
@@ -71,6 +72,8 @@ public class FlyingSquirrelEntity extends TamableAnimal implements GeoEntity {
SynchedEntityData.defineId(FlyingSquirrelEntity.class, EntityDataSerializers.BOOLEAN); SynchedEntityData.defineId(FlyingSquirrelEntity.class, EntityDataSerializers.BOOLEAN);
private static final EntityDataAccessor<Integer> TEXTURE_VARIANT = private static final EntityDataAccessor<Integer> TEXTURE_VARIANT =
SynchedEntityData.defineId(FlyingSquirrelEntity.class, EntityDataSerializers.INT); SynchedEntityData.defineId(FlyingSquirrelEntity.class, EntityDataSerializers.INT);
private static final EntityDataAccessor<Optional<UUID>> SHOULDER_PLAYER_DATA =
SynchedEntityData.defineId(FlyingSquirrelEntity.class, EntityDataSerializers.OPTIONAL_UUID);
private static final String PICKUP_ANIM_TICKS_KEY = "PickupAnimTicks"; private static final String PICKUP_ANIM_TICKS_KEY = "PickupAnimTicks";
private static final String TEXTURE_VARIANT_KEY = "TextureVariant"; private static final String TEXTURE_VARIANT_KEY = "TextureVariant";
@@ -227,6 +230,7 @@ public class FlyingSquirrelEntity extends TamableAnimal implements GeoEntity {
builder.define(CLIMBING, false); builder.define(CLIMBING, false);
builder.define(PICKING_UP_NUT, false); builder.define(PICKING_UP_NUT, false);
builder.define(TEXTURE_VARIANT, TEXTURE_VARIANT_REGULAR); builder.define(TEXTURE_VARIANT, TEXTURE_VARIANT_REGULAR);
builder.define(SHOULDER_PLAYER_DATA, Optional.empty());
} }
@Override @Override
@@ -376,13 +380,19 @@ public class FlyingSquirrelEntity extends TamableAnimal implements GeoEntity {
} }
if (this.isOnShoulder()) { if (this.isOnShoulder()) {
if (!(this.getVehicle() instanceof Player shoulderPlayer) Player shoulderPlayer = this.getShoulderPlayer();
|| !shoulderPlayer.isAlive()) { if (shoulderPlayer == null || !shoulderPlayer.isAlive()) {
this.dismountShoulder(); this.dismountShoulder();
} else if (this.shoulderSneakGraceTicks <= 0 && shoulderPlayer.isShiftKeyDown()) { } else if (this.shoulderSneakGraceTicks <= 0 && shoulderPlayer.isShiftKeyDown()) {
this.glideOffShoulder(); this.glideOffShoulder();
} else { } else {
Vec3 shoulderPos = this.getShoulderRidePos(shoulderPlayer);
this.setPos(shoulderPos.x, shoulderPos.y, shoulderPos.z);
this.setDeltaMovement(Vec3.ZERO); this.setDeltaMovement(Vec3.ZERO);
this.setYRot(shoulderPlayer.getYHeadRot());
this.setXRot(shoulderPlayer.getXRot());
this.yBodyRot = shoulderPlayer.getYHeadRot();
this.yHeadRot = shoulderPlayer.getYHeadRot();
this.fallDistance = 0.0F; this.fallDistance = 0.0F;
} }
this.setNoGravity(true); this.setNoGravity(true);
@@ -434,22 +444,25 @@ public class FlyingSquirrelEntity extends TamableAnimal implements GeoEntity {
this.tickIdleStallLogging(horizontalSpeed); this.tickIdleStallLogging(horizontalSpeed);
} }
if (this.isOnShoulder() && this.level().isClientSide) {
Player shoulderPlayer = this.getShoulderPlayer();
if (shoulderPlayer != null) {
Vec3 shoulderPos = this.getShoulderRidePos(shoulderPlayer);
this.setPos(shoulderPos.x, shoulderPos.y, shoulderPos.z);
this.setDeltaMovement(Vec3.ZERO);
this.setYRot(shoulderPlayer.getYHeadRot());
this.setXRot(shoulderPlayer.getXRot());
this.yBodyRot = shoulderPlayer.getYHeadRot();
this.yHeadRot = shoulderPlayer.getYHeadRot();
this.fallDistance = 0.0F;
}
}
this.setNoGravity(this.isGliding() || this.isClimbingTrunk() || this.isClimbingToShoulder() || this.isOnShoulder()); this.setNoGravity(this.isGliding() || this.isClimbingTrunk() || this.isClimbingToShoulder() || this.isOnShoulder());
} }
@Override @Override
public void rideTick() { public void rideTick() {
super.rideTick(); super.rideTick();
if (this.getVehicle() instanceof Player player) {
Vec3 shoulderPos = this.getShoulderRidePos(player);
this.setPos(shoulderPos.x, shoulderPos.y, shoulderPos.z);
this.setDeltaMovement(Vec3.ZERO);
this.setYRot(player.getYHeadRot());
this.setXRot(player.getXRot());
this.yBodyRot = player.getYHeadRot();
this.yHeadRot = player.getYHeadRot();
this.fallDistance = 0.0F;
}
} }
@Override @Override
@@ -703,7 +716,14 @@ public class FlyingSquirrelEntity extends TamableAnimal implements GeoEntity {
} }
public boolean isOnShoulder() { public boolean isOnShoulder() {
return this.getVehicle() instanceof Player; return this.entityData.get(SHOULDER_PLAYER_DATA).isPresent();
}
@Nullable
private Player getShoulderPlayer() {
return this.entityData.get(SHOULDER_PLAYER_DATA)
.map(uuid -> this.level().getPlayerByUUID(uuid))
.orElse(null);
} }
public boolean isClimbingToShoulder() { public boolean isClimbingToShoulder() {
@@ -725,10 +745,9 @@ public class FlyingSquirrelEntity extends TamableAnimal implements GeoEntity {
} }
private void dismountShoulder() { private void dismountShoulder() {
Entity vehicle = this.getVehicle(); Player shoulderPlayer = this.getShoulderPlayer();
if (vehicle != null) { if (shoulderPlayer != null) {
this.stopRiding(); Vec3 dismountPos = shoulderPlayer.position().add(0.0D, 0.1D, 0.0D);
Vec3 dismountPos = vehicle.position().add(0.0D, 0.1D, 0.0D);
this.setPos(dismountPos.x, dismountPos.y, dismountPos.z); this.setPos(dismountPos.x, dismountPos.y, dismountPos.z);
} }
this.clearShoulderMountState(); this.clearShoulderMountState();
@@ -737,6 +756,7 @@ public class FlyingSquirrelEntity extends TamableAnimal implements GeoEntity {
} }
private void clearShoulderMountState() { private void clearShoulderMountState() {
this.entityData.set(SHOULDER_PLAYER_DATA, Optional.empty());
this.shoulderPlayerId = null; this.shoulderPlayerId = null;
this.shoulderClimbStartPos = null; this.shoulderClimbStartPos = null;
this.climbingToShoulderTicks = 0; this.climbingToShoulderTicks = 0;
@@ -746,16 +766,15 @@ public class FlyingSquirrelEntity extends TamableAnimal implements GeoEntity {
} }
private void glideOffShoulder() { private void glideOffShoulder() {
Entity vehicle = this.getVehicle(); Player player = this.getShoulderPlayer();
if (!(vehicle instanceof Player player)) { if (player == null) {
this.dismountShoulder(); this.dismountShoulder();
return; return;
} }
Vec3 launchPos = this.getShoulderRidePos(player); Vec3 launchPos = this.getShoulderRidePos(player);
this.stopRiding();
this.setPos(launchPos.x, launchPos.y, launchPos.z);
this.clearShoulderMountState(); this.clearShoulderMountState();
this.setPos(launchPos.x, launchPos.y, launchPos.z);
this.fallDistance = 0.0F; this.fallDistance = 0.0F;
BlockPos glideTarget = this.findFallGlideTarget(); BlockPos glideTarget = this.findFallGlideTarget();
@@ -815,7 +834,7 @@ public class FlyingSquirrelEntity extends TamableAnimal implements GeoEntity {
this.shoulderPlayerId = null; this.shoulderPlayerId = null;
this.shoulderSneakGraceTicks = SHOULDER_SNEAK_GRACE_TICKS; this.shoulderSneakGraceTicks = SHOULDER_SNEAK_GRACE_TICKS;
this.setClimbingTrunk(false); this.setClimbingTrunk(false);
this.startRiding(player, true); this.entityData.set(SHOULDER_PLAYER_DATA, Optional.of(player.getUUID()));
this.setDeltaMovement(Vec3.ZERO); this.setDeltaMovement(Vec3.ZERO);
this.fallDistance = 0.0F; this.fallDistance = 0.0F;
} }
@@ -1,9 +0,0 @@
package com.craisinlord.antarchy.content.item;
import net.minecraft.world.item.Item;
public class CheepOnAStickItem extends Item {
public CheepOnAStickItem(Properties properties) {
super(properties);
}
}
@@ -1,129 +0,0 @@
package com.craisinlord.antarchy.content.menu;
import net.minecraft.world.Container;
import net.minecraft.world.SimpleContainer;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.inventory.MenuType;
import net.minecraft.world.inventory.Slot;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import java.util.function.Supplier;
public class DorrieMenu extends AbstractContainerMenu {
// Set by the Fabric platform during registration so common entity code can open the menu.
@SuppressWarnings("unchecked")
public static Supplier<MenuType<DorrieMenu>> TYPE_SUPPLIER = () -> {
throw new IllegalStateException("DorrieMenu.TYPE_SUPPLIER accessed before registration");
};
private static final int EQUIPMENT_SLOTS = 1;
private static final int PLAYER_INV_ROWS = 3;
private static final int PLAYER_INV_COLS = 9;
// GUI layout constants (relative to background image top-left)
public static final int SADDLE_SLOT_X = 80;
public static final int SADDLE_SLOT_Y = 18;
public static final int PLAYER_INV_X = 8;
public static final int PLAYER_INV_Y = 48;
public static final int HOTBAR_Y = 106;
private final Container equipment;
// Server-side constructor — receives the real Dorrie inventory.
public DorrieMenu(int syncId, Inventory playerInventory, Container equipment) {
super(TYPE_SUPPLIER.get(), syncId);
this.equipment = equipment;
checkContainerSize(equipment, EQUIPMENT_SLOTS);
// Slot 0: saddle
this.addSlot(new Slot(equipment, 0, SADDLE_SLOT_X, SADDLE_SLOT_Y) {
@Override
public boolean mayPlace(ItemStack stack) {
return stack.is(Items.SADDLE);
}
@Override
public int getMaxStackSize() {
return 1;
}
});
// Player inventory (3 × 9)
for (int row = 0; row < PLAYER_INV_ROWS; row++) {
for (int col = 0; col < PLAYER_INV_COLS; col++) {
this.addSlot(new Slot(
playerInventory,
col + row * PLAYER_INV_COLS + PLAYER_INV_COLS,
PLAYER_INV_X + col * 18,
PLAYER_INV_Y + row * 18
));
}
}
// Hotbar (9)
for (int col = 0; col < PLAYER_INV_COLS; col++) {
this.addSlot(new Slot(playerInventory, col, PLAYER_INV_X + col * 18, HOTBAR_Y));
}
}
// Client-side factory — syncs slot data from server.
public static DorrieMenu clientCreate(int syncId, Inventory playerInventory) {
return new DorrieMenu(syncId, playerInventory, new SimpleContainer(EQUIPMENT_SLOTS));
}
@Override
public boolean stillValid(Player player) {
return this.equipment.stillValid(player);
}
@Override
public ItemStack quickMoveStack(Player player, int index) {
ItemStack result = ItemStack.EMPTY;
Slot slot = this.slots.get(index);
if (!slot.hasItem()) return result;
ItemStack stack = slot.getItem();
result = stack.copy();
int equipEnd = EQUIPMENT_SLOTS;
int invEnd = equipEnd + PLAYER_INV_ROWS * PLAYER_INV_COLS;
int totalSlots = invEnd + PLAYER_INV_COLS;
if (index < equipEnd) {
// Equipment slot → player inventory
if (!this.moveItemStackTo(stack, equipEnd, totalSlots, true)) {
return ItemStack.EMPTY;
}
} else {
// Player inventory/hotbar → try equipment slot first
if (stack.is(Items.SADDLE) && this.slots.get(0).mayPlace(stack)) {
if (!this.moveItemStackTo(stack, 0, equipEnd, false)) {
return ItemStack.EMPTY;
}
} else if (index < invEnd) {
// Inventory → hotbar
if (!this.moveItemStackTo(stack, invEnd, totalSlots, false)) {
return ItemStack.EMPTY;
}
} else {
// Hotbar → inventory
if (!this.moveItemStackTo(stack, equipEnd, invEnd, false)) {
return ItemStack.EMPTY;
}
}
}
if (stack.isEmpty()) {
slot.set(ItemStack.EMPTY);
} else {
slot.setChanged();
}
if (stack.getCount() == result.getCount()) return ItemStack.EMPTY;
slot.onTake(player, stack);
return result;
}
}
@@ -0,0 +1,20 @@
package com.craisinlord.antarchy.content.network;
import com.craisinlord.antarchy.Antarchy;
import io.netty.buffer.ByteBuf;
import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
import net.minecraft.resources.ResourceLocation;
public record HerculesBeetleImpactShakePayload(int durationTicks) implements CustomPacketPayload {
public static final Type<HerculesBeetleImpactShakePayload> TYPE =
new Type<>(ResourceLocation.fromNamespaceAndPath(Antarchy.MODID, "hercules_beetle_impact_shake"));
public static final StreamCodec<ByteBuf, HerculesBeetleImpactShakePayload> STREAM_CODEC =
ByteBufCodecs.VAR_INT.map(HerculesBeetleImpactShakePayload::new, HerculesBeetleImpactShakePayload::durationTicks);
@Override
public Type<HerculesBeetleImpactShakePayload> type() {
return TYPE;
}
}
@@ -0,0 +1,22 @@
package com.craisinlord.antarchy.content.network;
import java.util.function.BiConsumer;
import net.minecraft.server.level.ServerPlayer;
public final class HerculesBeetleImpactShakeSync {
private static final BiConsumer<ServerPlayer, Integer> NOOP = (player, ticks) -> {
};
private static volatile BiConsumer<ServerPlayer, Integer> sink = NOOP;
private HerculesBeetleImpactShakeSync() {
}
public static void setSink(BiConsumer<ServerPlayer, Integer> sink) {
HerculesBeetleImpactShakeSync.sink = sink == null ? NOOP : sink;
}
public static void send(ServerPlayer player, int ticks) {
sink.accept(player, ticks);
}
}
@@ -0,0 +1,23 @@
package com.craisinlord.antarchy.content.network;
import com.craisinlord.antarchy.Antarchy;
import io.netty.buffer.ByteBuf;
import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
import net.minecraft.resources.ResourceLocation;
public record HerculesBeetleJumpInputPayload(boolean pressing) implements CustomPacketPayload {
public static final Type<HerculesBeetleJumpInputPayload> TYPE =
new Type<>(ResourceLocation.fromNamespaceAndPath(Antarchy.MODID, "hercules_beetle_jump_input"));
public static final StreamCodec<ByteBuf, HerculesBeetleJumpInputPayload> STREAM_CODEC =
StreamCodec.composite(
ByteBufCodecs.BOOL, HerculesBeetleJumpInputPayload::pressing,
HerculesBeetleJumpInputPayload::new
);
@Override
public Type<HerculesBeetleJumpInputPayload> type() {
return TYPE;
}
}
@@ -0,0 +1,19 @@
package com.craisinlord.antarchy.content.network;
import com.craisinlord.antarchy.Antarchy;
import io.netty.buffer.ByteBuf;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
import net.minecraft.resources.ResourceLocation;
public record HerculesBeetleMountedAttackPayload() implements CustomPacketPayload {
public static final Type<HerculesBeetleMountedAttackPayload> TYPE =
new Type<>(ResourceLocation.fromNamespaceAndPath(Antarchy.MODID, "hercules_beetle_mounted_attack"));
public static final StreamCodec<ByteBuf, HerculesBeetleMountedAttackPayload> STREAM_CODEC =
StreamCodec.unit(new HerculesBeetleMountedAttackPayload());
@Override
public Type<HerculesBeetleMountedAttackPayload> type() {
return TYPE;
}
}
@@ -0,0 +1,20 @@
package com.craisinlord.antarchy.content.network;
import com.craisinlord.antarchy.Antarchy;
import io.netty.buffer.ByteBuf;
import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
import net.minecraft.resources.ResourceLocation;
public record HerculesBeetleMountedChargePayload(int chargeTicks) implements CustomPacketPayload {
public static final Type<HerculesBeetleMountedChargePayload> TYPE =
new Type<>(ResourceLocation.fromNamespaceAndPath(Antarchy.MODID, "hercules_beetle_mounted_charge"));
public static final StreamCodec<ByteBuf, HerculesBeetleMountedChargePayload> STREAM_CODEC =
ByteBufCodecs.VAR_INT.map(HerculesBeetleMountedChargePayload::new, HerculesBeetleMountedChargePayload::chargeTicks);
@Override
public Type<HerculesBeetleMountedChargePayload> type() {
return TYPE;
}
}
@@ -0,0 +1,49 @@
package com.craisinlord.antarchy.mixins.client;
import com.craisinlord.antarchy.content.entity.DorrieEntity;
import com.craisinlord.antarchy.content.entity.HerculesBeetleEntity;
import net.minecraft.client.Camera;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.BlockGetter;
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.ModifyArgs;
import org.spongepowered.asm.mixin.injection.invoke.arg.Args;
@Mixin(Camera.class)
public abstract class MountedVehicleCameraMixin {
@Shadow
private Entity entity;
@ModifyArgs(
method = "setup",
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Camera;move(FFF)V")
)
private void antarchy$adjustMountedCameraOffset(
Args args,
BlockGetter level,
Entity entity,
boolean detached,
boolean mirrored,
float partialTick
) {
if (!detached || this.entity == null || this.entity.getVehicle() == null) {
return;
}
Entity vehicle = this.entity.getVehicle();
if (vehicle instanceof HerculesBeetleEntity) {
args.set(0, (Float) args.get(0) * 1.45F);
args.set(1, (Float) args.get(1) + 0.2F);
args.set(2, (Float) args.get(2) + 0.45F);
return;
}
if (vehicle instanceof DorrieEntity) {
args.set(0, (Float) args.get(0) * 1.6F);
args.set(1, (Float) args.get(1) + 0.15F);
args.set(2, (Float) args.get(2) + 0.55F);
}
}
}
@@ -51,6 +51,7 @@
"client.ElythiaSkyMixin", "client.ElythiaSkyMixin",
"client.ElytraModelAccessor", "client.ElytraModelAccessor",
"client.LightningBoltRendererMixin", "client.LightningBoltRendererMixin",
"client.MountedVehicleCameraMixin",
"client.ParalyzedMouseTurnMixin", "client.ParalyzedMouseTurnMixin",
"client.ScreenEffectRendererFireVisualMixin", "client.ScreenEffectRendererFireVisualMixin",
"client.SplashManagerMixin", "client.SplashManagerMixin",
@@ -766,12 +766,13 @@
"death.attack.water_soaked.player": "%1$s was super soaked to death by %2$s", "death.attack.water_soaked.player": "%1$s was super soaked to death by %2$s",
"entity.antarchy.cheep": "Cheep", "entity.antarchy.cheep": "Cheep",
"entity.antarchy.dorrie": "Dorrie", "entity.antarchy.dorrie": "Dorrie",
"entity.antarchy.hercules_beetle": "Hercules Beetle",
"item.antarchy.cheep": "Cheep", "item.antarchy.cheep": "Cheep",
"item.antarchy.cheep_on_a_stick": "Cheep on a Stick",
"item.antarchy.cheep_spawn_egg": "Cheep Spawn Egg", "item.antarchy.cheep_spawn_egg": "Cheep Spawn Egg",
"item.antarchy.dorrie_spawn_egg": "Dorrie Spawn Egg", "item.antarchy.dorrie_spawn_egg": "Dorrie Spawn Egg",
"container.antarchy.dorrie": "Dorrie", "item.antarchy.hercules_beetle_spawn_egg": "Hercules Beetle Spawn Egg",
"key.antarchy.dorrie_charge_jump": "Dorrie: Charge Jump", "key.antarchy.dorrie_charge_jump": "Dorrie: Charge Jump",
"key.antarchy.hercules_beetle_charge": "Hercules Beetle: Charge",
"entity.antarchy.reverie": "Reverie", "entity.antarchy.reverie": "Reverie",
"biome.antarchy.thoraxis": "Thoraxis", "biome.antarchy.thoraxis": "Thoraxis",
"biome.antarchy.nightmare_wastes": "Nightmare Wastes", "biome.antarchy.nightmare_wastes": "Nightmare Wastes",
@@ -0,0 +1,3 @@
{
"parent": "minecraft:item/template_spawn_egg"
}
@@ -9,7 +9,7 @@
"logical_height": 192, "logical_height": 192,
"infiniburn": "#minecraft:infiniburn_overworld", "infiniburn": "#minecraft:infiniburn_overworld",
"effects": "minecraft:overworld", "effects": "minecraft:overworld",
"ambient_light": 0.01, "ambient_light": 0.015,
"piglin_safe": false, "piglin_safe": false,
"has_raids": false, "has_raids": false,
"monster_spawn_light_level": 0, "monster_spawn_light_level": 0,
@@ -0,0 +1,18 @@
{
"replace": false,
"values": [
"minecraft:bedrock",
"minecraft:obsidian",
"minecraft:crying_obsidian",
"minecraft:barrier",
"minecraft:command_block",
"minecraft:chain_command_block",
"minecraft:repeating_command_block",
"minecraft:structure_block",
"minecraft:jigsaw",
"minecraft:structure_void",
"minecraft:end_portal_frame",
"minecraft:end_portal",
"minecraft:end_gateway"
]
}
@@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"minecraft:glow_berries"
]
}
@@ -18,10 +18,6 @@
} }
}, },
"spawn_costs": { "spawn_costs": {
"antarchy:brutalfly": {
"energy_budget": 0.3,
"charge": 1.2
}
}, },
"carvers": { "carvers": {
"air": [], "air": [],
@@ -22,7 +22,12 @@
} }
} }
}, },
"spawn_costs": {}, "spawn_costs": {
"antarchy:hercules_beetle": {
"energy_budget": 0.1,
"charge": 15
}
},
"carvers": { "carvers": {
"air": [], "air": [],
"liquid": [] "liquid": []
@@ -61,6 +66,12 @@
"weight": 95, "weight": 95,
"minCount": 2, "minCount": 2,
"maxCount": 5 "maxCount": 5
},
{
"type": "antarchy:hercules_beetle",
"weight": 5,
"minCount": 1,
"maxCount": 1
} }
], ],
"creature": [ "creature": [
@@ -11,6 +11,7 @@
"antarchy:jumpy_bug", "antarchy:jumpy_bug",
"antarchy:spit_bug", "antarchy:spit_bug",
"antarchy:stink_bug", "antarchy:stink_bug",
"antarchy:hercules_beetle",
"antarchy:creeping_horror", "antarchy:creeping_horror",
"antarchy:lurking_terror", "antarchy:lurking_terror",
"antarchy:scorpion", "antarchy:scorpion",
@@ -114,6 +114,7 @@ import com.craisinlord.antarchy.content.item.DiamondMinecartItem;
import com.craisinlord.antarchy.content.item.ReverieBottleItem; import com.craisinlord.antarchy.content.item.ReverieBottleItem;
import com.craisinlord.antarchy.content.item.ScorpionWhipItem; import com.craisinlord.antarchy.content.item.ScorpionWhipItem;
import com.craisinlord.antarchy.content.item.ScorpionWhipTetherSync; import com.craisinlord.antarchy.content.item.ScorpionWhipTetherSync;
import com.craisinlord.antarchy.content.network.HerculesBeetleImpactShakeSync;
import com.craisinlord.antarchy.content.item.SizeRayItem; import com.craisinlord.antarchy.content.item.SizeRayItem;
import com.craisinlord.antarchy.content.item.SquidzookaItem; import com.craisinlord.antarchy.content.item.SquidzookaItem;
import com.craisinlord.antarchy.content.item.SimpleToolTier; import com.craisinlord.antarchy.content.item.SimpleToolTier;
@@ -1820,14 +1821,19 @@ public final class AntarchyFabricContent {
.sized(2.4F, 2.0F) .sized(2.4F, 2.0F)
.clientTrackingRange(10) .clientTrackingRange(10)
.build("dorrie")); .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 DeferredItem<Item> CHEEP_ITEM = ITEMS.register("cheep", public static final DeferredItem<Item> CHEEP_ITEM = ITEMS.register("cheep",
() -> new Item(new Item.Properties().food(new FoodProperties.Builder().nutrition(2).saturationModifier(0.2F).build()))); () -> new Item(new Item.Properties().food(new FoodProperties.Builder().nutrition(2).saturationModifier(0.2F).build())));
public static final DeferredItem<com.craisinlord.antarchy.content.item.CheepOnAStickItem> CHEEP_ON_A_STICK = ITEMS.register("cheep_on_a_stick",
() -> new com.craisinlord.antarchy.content.item.CheepOnAStickItem(new Item.Properties().stacksTo(1).durability(25)));
public static final DeferredItem<DeferredSpawnEggItem> CHEEP_SPAWN_EGG = ITEMS.register("cheep_spawn_egg", public static final DeferredItem<DeferredSpawnEggItem> CHEEP_SPAWN_EGG = ITEMS.register("cheep_spawn_egg",
() -> new DeferredSpawnEggItem(CHEEP, 0xFF00AA, 0x00FF44, new Item.Properties())); () -> new DeferredSpawnEggItem(CHEEP, 0xFF00AA, 0x00FF44, new Item.Properties()));
public static final DeferredItem<DeferredSpawnEggItem> DORRIE_SPAWN_EGG = ITEMS.register("dorrie_spawn_egg", public static final DeferredItem<DeferredSpawnEggItem> DORRIE_SPAWN_EGG = ITEMS.register("dorrie_spawn_egg",
() -> new DeferredSpawnEggItem(DORRIE, 0x1B91B3, 0xC0E8FF, new Item.Properties())); () -> new DeferredSpawnEggItem(DORRIE, 0x1B91B3, 0xC0E8FF, new Item.Properties()));
public static final DeferredItem<DeferredSpawnEggItem> HERCULES_BEETLE_SPAWN_EGG = ITEMS.register("hercules_beetle_spawn_egg",
() -> new DeferredSpawnEggItem(HERCULES_BEETLE, 0x6B1F2A, 0xD4AF37, new Item.Properties().rarity(Rarity.RARE)));
public static final DeferredHolder<CreativeModeTab, CreativeModeTab> ANTARCHY_TAB = CREATIVE_MODE_TABS.register("antarchy", public static final DeferredHolder<CreativeModeTab, CreativeModeTab> ANTARCHY_TAB = CREATIVE_MODE_TABS.register("antarchy",
() -> CreativeModeTab.builder(CreativeModeTab.Row.TOP, 0) () -> CreativeModeTab.builder(CreativeModeTab.Row.TOP, 0)
@@ -1917,6 +1923,7 @@ public final class AntarchyFabricContent {
FabricDefaultAttributeRegistry.register(LURKING_TERROR.get(), LurkingTerrorEntity.createAttributes().build()); FabricDefaultAttributeRegistry.register(LURKING_TERROR.get(), LurkingTerrorEntity.createAttributes().build());
FabricDefaultAttributeRegistry.register(CHEEP.get(), com.craisinlord.antarchy.content.entity.CheepEntity.createAttributes().build()); FabricDefaultAttributeRegistry.register(CHEEP.get(), com.craisinlord.antarchy.content.entity.CheepEntity.createAttributes().build());
FabricDefaultAttributeRegistry.register(DORRIE.get(), com.craisinlord.antarchy.content.entity.DorrieEntity.createAttributes().build()); FabricDefaultAttributeRegistry.register(DORRIE.get(), com.craisinlord.antarchy.content.entity.DorrieEntity.createAttributes().build());
FabricDefaultAttributeRegistry.register(HERCULES_BEETLE.get(), com.craisinlord.antarchy.content.entity.HerculesBeetleEntity.createAttributes().build());
FabricDefaultAttributeRegistry.register(RED_ANT.get(), buildAntAttributes( FabricDefaultAttributeRegistry.register(RED_ANT.get(), buildAntAttributes(
AntarchySettings.redAntHealth(), AntarchySettings.redAntHealth(),
@@ -2069,10 +2076,10 @@ public final class AntarchyFabricContent {
"bomber_spawn_egg", "jumpy_bug_spawn_egg", "spit_bug_spawn_egg", "stink_bug_spawn_egg", "cloud_shark_spawn_egg", "kraken_spawn_egg", "missile_squid_spawn_egg", "octopus_bomb_spawn_egg", "bomber_spawn_egg", "jumpy_bug_spawn_egg", "spit_bug_spawn_egg", "stink_bug_spawn_egg", "cloud_shark_spawn_egg", "kraken_spawn_egg", "missile_squid_spawn_egg", "octopus_bomb_spawn_egg",
"nightmare_spawn_egg", "bed_bug_spawn_egg", "lucid_spawn_egg", "scorpion_spawn_egg", "nightmare_spawn_egg", "bed_bug_spawn_egg", "lucid_spawn_egg", "scorpion_spawn_egg",
"basilisk_spawn_egg", "emperor_scorpion_spawn_egg", "toreterror_spawn_egg", "basilisk_spawn_egg", "emperor_scorpion_spawn_egg", "toreterror_spawn_egg",
"hercules_beetle_spawn_egg",
"creeping_horror_spawn_egg", "lurking_terror_spawn_egg" -> 90; "creeping_horror_spawn_egg", "lurking_terror_spawn_egg" -> 90;
case "stink_bug", "chiten" -> 22; case "stink_bug", "chiten" -> 22;
case "cheep" -> 21; case "cheep" -> 21;
case "cheep_on_a_stick" -> 52;
case "water_cannon" -> 52; case "water_cannon" -> 52;
case "primordial_helmet", "primordial_chestplate", "primordial_leggings", "primordial_boots" -> 53; case "primordial_helmet", "primordial_chestplate", "primordial_leggings", "primordial_boots" -> 53;
case "jumpy_boots" -> 54; case "jumpy_boots" -> 54;
@@ -2359,6 +2366,7 @@ public final class AntarchyFabricContent {
// Wire common-module accessors after all registrations are complete. // Wire common-module accessors after all registrations are complete.
AntarchyObjects.CHEEP_ITEM = () -> CHEEP_ITEM.get(); AntarchyObjects.CHEEP_ITEM = () -> CHEEP_ITEM.get();
AntarchyObjects.setHerculesBeetle(() -> HERCULES_BEETLE.get());
AntarchySoundEvents.bind( AntarchySoundEvents.bind(
SQUIDZOOKA_FIRE, SQUIDZOOKA_FIRE,
@@ -2588,6 +2596,7 @@ public final class AntarchyFabricContent {
LucidEyeProjectileEntity.invertedEffectSupplier = () -> mobEffectHolder(INVERTED); LucidEyeProjectileEntity.invertedEffectSupplier = () -> mobEffectHolder(INVERTED);
ScorpionWhipTetherSync.setSink(AntarchyFabricNetworking::syncScorpionWhipTether); ScorpionWhipTetherSync.setSink(AntarchyFabricNetworking::syncScorpionWhipTether);
HerculesBeetleImpactShakeSync.setSink((player, ticks) -> net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking.send(player, new com.craisinlord.antarchy.content.network.HerculesBeetleImpactShakePayload(ticks)));
BloodCrystalKatanaItem.setTrailCallback(AntarchyFabricNetworking::syncKatanaTrail); BloodCrystalKatanaItem.setTrailCallback(AntarchyFabricNetworking::syncKatanaTrail);
com.craisinlord.antarchy.content.gravity.AntarchyGravityApi.setSyncDispatcher(AntarchyFabricNetworking::syncGravityEntity); com.craisinlord.antarchy.content.gravity.AntarchyGravityApi.setSyncDispatcher(AntarchyFabricNetworking::syncGravityEntity);
AntarchyFabricEvents.register(); AntarchyFabricEvents.register();
@@ -1,6 +1,7 @@
package com.craisinlord.antarchy.fabric.client; package com.craisinlord.antarchy.fabric.client;
import com.craisinlord.antarchy.Antarchy; import com.craisinlord.antarchy.Antarchy;
import com.craisinlord.antarchy.content.client.HerculesBeetleImpactShakeClientState;
import com.craisinlord.antarchy.content.client.renderer.*; import com.craisinlord.antarchy.content.client.renderer.*;
import com.craisinlord.antarchy.content.client.particle.*; import com.craisinlord.antarchy.content.client.particle.*;
import com.craisinlord.antarchy.content.client.renderer.AntiwaterFluidRenderer; import com.craisinlord.antarchy.content.client.renderer.AntiwaterFluidRenderer;
@@ -49,10 +50,6 @@ public final class AntarchyFabricClientBootstrap {
public static void register() { public static void register() {
AntarchyKeyBindings.register(); AntarchyKeyBindings.register();
net.minecraft.client.gui.screens.MenuScreens.register(
com.craisinlord.antarchy.fabric.AntarchyFabricContent.DORRIE_MENU.get(),
com.craisinlord.antarchy.content.client.screen.DorrieScreen::new
);
registerRenderers(); registerRenderers();
registerEntityLayers(); registerEntityLayers();
registerColors(); registerColors();
@@ -119,6 +116,7 @@ public final class AntarchyFabricClientBootstrap {
EntityRendererRegistry.register(AntarchyFabricContent.LURKING_TERROR.get(), LurkingTerrorRenderer::new); EntityRendererRegistry.register(AntarchyFabricContent.LURKING_TERROR.get(), LurkingTerrorRenderer::new);
EntityRendererRegistry.register(AntarchyFabricContent.CHEEP.get(), com.craisinlord.antarchy.content.client.renderer.CheepRenderer::new); EntityRendererRegistry.register(AntarchyFabricContent.CHEEP.get(), com.craisinlord.antarchy.content.client.renderer.CheepRenderer::new);
EntityRendererRegistry.register(AntarchyFabricContent.DORRIE.get(), com.craisinlord.antarchy.content.client.renderer.DorrieRenderer::new); EntityRendererRegistry.register(AntarchyFabricContent.DORRIE.get(), com.craisinlord.antarchy.content.client.renderer.DorrieRenderer::new);
EntityRendererRegistry.register(AntarchyFabricContent.HERCULES_BEETLE.get(), com.craisinlord.antarchy.content.client.renderer.HerculesBeetleRenderer::new);
EntityModelLayerRegistry.registerModelLayer(OuranwoodBoatRenderer.boatLayer(), BoatModel::createBodyModel); EntityModelLayerRegistry.registerModelLayer(OuranwoodBoatRenderer.boatLayer(), BoatModel::createBodyModel);
EntityModelLayerRegistry.registerModelLayer(OuranwoodBoatRenderer.chestBoatLayer(), ChestBoatModel::createBodyModel); EntityModelLayerRegistry.registerModelLayer(OuranwoodBoatRenderer.chestBoatLayer(), ChestBoatModel::createBodyModel);
@@ -321,6 +319,7 @@ public final class AntarchyFabricClientBootstrap {
private static void registerClientCallbacks() { private static void registerClientCallbacks() {
ClientTickEvents.END_CLIENT_TICK.register(client -> { ClientTickEvents.END_CLIENT_TICK.register(client -> {
HerculesBeetleImpactShakeClientState.tick();
if (client.player != null) { if (client.player != null) {
ParalyzedClientHandler.clampPlayerInput(client.player); ParalyzedClientHandler.clampPlayerInput(client.player);
} }
@@ -332,6 +331,7 @@ public final class AntarchyFabricClientBootstrap {
BloodCrystalKatanaTrailHandler.tick(); BloodCrystalKatanaTrailHandler.tick();
ScorpionWhipTetherRenderHandler.tick(); ScorpionWhipTetherRenderHandler.tick();
DorrieJumpClientHandler.tick(); DorrieJumpClientHandler.tick();
HerculesBeetleClientHandler.tick();
}); });
GravityGunClientHandler.register(); GravityGunClientHandler.register();
@@ -24,11 +24,19 @@ public final class AntarchyKeyBindings {
CATEGORY CATEGORY
); );
public static final KeyMapping HERCULES_BEETLE_CHARGE = new KeyMapping(
"key.antarchy.hercules_beetle_charge",
InputConstants.Type.KEYSYM,
GLFW.GLFW_KEY_LEFT_CONTROL,
CATEGORY
);
private AntarchyKeyBindings() {} private AntarchyKeyBindings() {}
public static void register() { public static void register() {
KeyBindingHelper.registerKeyBinding(BRUTALFLY_FLAP); KeyBindingHelper.registerKeyBinding(BRUTALFLY_FLAP);
KeyBindingHelper.registerKeyBinding(DORRIE_CHARGE_JUMP); KeyBindingHelper.registerKeyBinding(DORRIE_CHARGE_JUMP);
KeyBindingHelper.registerKeyBinding(HERCULES_BEETLE_CHARGE);
} }
public static boolean isBrutalflyFlapPressed() { public static boolean isBrutalflyFlapPressed() {
@@ -38,4 +46,8 @@ public final class AntarchyKeyBindings {
public static boolean isDorrieChargeJumpPressed() { public static boolean isDorrieChargeJumpPressed() {
return Minecraft.getInstance().screen == null && DORRIE_CHARGE_JUMP.isDown(); return Minecraft.getInstance().screen == null && DORRIE_CHARGE_JUMP.isDown();
} }
public static boolean isHerculesBeetleChargePressed() {
return Minecraft.getInstance().screen == null && HERCULES_BEETLE_CHARGE.isDown();
}
} }
@@ -0,0 +1,66 @@
package com.craisinlord.antarchy.fabric.client;
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.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
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() {
}
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) {
ClientPlayNetworking.send(new HerculesBeetleJumpInputPayload(pressingJump));
wasPressingJump = pressingJump;
}
boolean pressingAttack = mc.options.keyAttack.isDown();
if (pressingAttack && !wasPressingAttack) {
ClientPlayNetworking.send(new HerculesBeetleMountedAttackPayload());
}
wasPressingAttack = pressingAttack;
boolean charging = AntarchyKeyBindings.isHerculesBeetleChargePressed();
if (charging) {
chargeTicks = Math.min(chargeTicks + 1, MAX_CHARGE_TICKS);
} else if (wasCharging && chargeTicks > 0) {
ClientPlayNetworking.send(new HerculesBeetleMountedChargePayload(chargeTicks));
chargeTicks = 0;
}
wasCharging = charging;
}
private static void resetAll() {
if (wasPressingJump) {
ClientPlayNetworking.send(new HerculesBeetleJumpInputPayload(false));
wasPressingJump = false;
}
wasPressingAttack = false;
wasCharging = false;
chargeTicks = 0;
}
}
@@ -1,7 +1,8 @@
package com.craisinlord.antarchy.fabric.mixin.client; package com.craisinlord.antarchy.fabric.mixin.client;
import com.craisinlord.antarchy.content.entity.ToreterrorEntity; import com.craisinlord.antarchy.content.entity.ToreterrorEntity;
import com.craisinlord.antarchy.content.item.BigBerthaItem; import com.craisinlord.antarchy.content.entity.nightmare.NightmareEntity;
import com.craisinlord.antarchy.content.client.HerculesBeetleImpactShakeClientState;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Axis; import com.mojang.math.Axis;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@@ -16,14 +17,15 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(GameRenderer.class) @Mixin(GameRenderer.class)
public abstract class ToreterrorCameraShakeMixin { public abstract class CameraShakeMixin {
private static final double MAX_SHAKE_RANGE = 48.0D; private static final double MAX_SHAKE_RANGE = 48.0D;
private static final int TORETERROR_SHAKE_TICKS = 25; private static final int TORETERROR_SHAKE_TICKS = 25;
private static final double NIGHTMARE_SHAKE_RANGE = 32.0D;
@Shadow @Final private Minecraft minecraft; @Shadow @Final private Minecraft minecraft;
@Inject(method = "bobView", at = @At("TAIL")) @Inject(method = "bobView", at = @At("TAIL"))
private void applyToreterrorShake(PoseStack poseStack, float partialTick, CallbackInfo ci) { private void applyCameraShake(PoseStack poseStack, float partialTick, CallbackInfo ci) {
if (minecraft.level == null || minecraft.player == null) return; if (minecraft.level == null || minecraft.player == null) return;
Vec3 cameraPos = minecraft.gameRenderer.getMainCamera().getPosition(); Vec3 cameraPos = minecraft.gameRenderer.getMainCamera().getPosition();
@@ -39,8 +41,19 @@ public abstract class ToreterrorCameraShakeMixin {
shakeStrength += (float) ((1.0D - distance / MAX_SHAKE_RANGE) * 1.0F); shakeStrength += (float) ((1.0D - distance / MAX_SHAKE_RANGE) * 1.0F);
} }
if (BigBerthaItem.clientShakeTicks > 0) { for (NightmareEntity nightmare : minecraft.level.getEntitiesOfClass(
shakeStrength += (float) BigBerthaItem.clientShakeTicks / TORETERROR_SHAKE_TICKS * 2.0F; NightmareEntity.class,
minecraft.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; if (shakeStrength <= 0.0F) return;
@@ -1,63 +0,0 @@
package com.craisinlord.antarchy.fabric.mixin.client;
import com.craisinlord.antarchy.content.entity.nightmare.NightmareEntity;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Axis;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.util.Mth;
import net.minecraft.world.phys.Vec3;
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.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
//TODO FIX ON FABRIC SIDE
@Mixin(GameRenderer.class)
public abstract class NightmareCameraShakeMixin {
// private static final double MAX_SHAKE_RANGE = 32.0D;
//
// @Shadow @Final private Minecraft minecraft;
//
// @Redirect(
// method = "renderLevel",
// at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/GameRenderer;bobView(Lcom/mojang/blaze3d/vertex/PoseStack;F)V")
// )
// private void applyNightmareCameraShake(GameRenderer instance, PoseStack poseStack, float partialTick) {
// instance.bobView(poseStack, partialTick);
// if (minecraft.level == null || minecraft.player == null) {
// return;
// }
//
// Vec3 cameraPos = minecraft.gameRenderer.getMainCamera().getPosition();
// float shakeStrength = 0.0F;
//
// for (NightmareEntity nightmare : minecraft.level.getEntitiesOfClass(
// NightmareEntity.class,
// minecraft.player.getBoundingBox().inflate(MAX_SHAKE_RANGE),
// e -> e.isAlive() && e.isRoaring()
// )) {
// double distance = Math.sqrt(cameraPos.distanceToSqr(nightmare.position().add(0.0D, nightmare.getBbHeight() * 0.5D, 0.0D)));
// if (distance > MAX_SHAKE_RANGE) {
// continue;
// }
// shakeStrength += (float) ((1.0D - distance / MAX_SHAKE_RANGE) * 1.35D);
// }
//
// if (shakeStrength <= 0.0F) {
// return;
// }
//
// float time = (float) (minecraft.player.tickCount + partialTick);
// float yawOffset = Mth.sin(time * 1.85F) * shakeStrength * 1.8F;
// float pitchOffset = Mth.cos(time * 2.15F) * shakeStrength * 1.45F;
// float rollOffset = Mth.sin(time * 2.65F) * shakeStrength * 1.05F;
//
// poseStack.mulPose(Axis.YP.rotationDegrees(yawOffset));
// poseStack.mulPose(Axis.XP.rotationDegrees(pitchOffset));
// poseStack.mulPose(Axis.ZP.rotationDegrees(rollOffset));
// }
}
@@ -34,5 +34,7 @@ public final class AntarchyFabricClientNetworking {
payload.anchorY(), payload.anchorY(),
payload.anchorZ() payload.anchorZ()
))); )));
ClientPlayNetworking.registerGlobalReceiver(HerculesBeetleImpactShakePayload.TYPE, (payload, context) ->
context.client().execute(() -> AntarchyFabricNetworking.triggerHerculesBeetleImpactShake(payload.durationTicks())));
} }
} }
@@ -1,12 +1,15 @@
package com.craisinlord.antarchy.fabric.network; package com.craisinlord.antarchy.fabric.network;
import com.craisinlord.antarchy.content.entity.DiamondMinecartEntity; import com.craisinlord.antarchy.content.entity.DiamondMinecartEntity;
import com.craisinlord.antarchy.content.client.HerculesBeetleImpactShakeClientState;
import com.craisinlord.antarchy.content.entity.multipart.MultipartEntityOwner; import com.craisinlord.antarchy.content.entity.multipart.MultipartEntityOwner;
import com.craisinlord.antarchy.content.entity.multipart.network.MultipartAttackPayload; import com.craisinlord.antarchy.content.entity.multipart.network.MultipartAttackPayload;
import com.craisinlord.antarchy.content.entity.multipart.network.MultipartInteractPayload; import com.craisinlord.antarchy.content.entity.multipart.network.MultipartInteractPayload;
import com.craisinlord.antarchy.content.gravity.AntarchyGravityApi; 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.BrutalflyElytraFlightHelper;
import com.craisinlord.antarchy.content.item.BrutalflyElytraItem; 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.content.item.JumpyBootsHelper;
import com.craisinlord.antarchy.fabric.util.JumpyBootsFabricHelper; import com.craisinlord.antarchy.fabric.util.JumpyBootsFabricHelper;
import com.craisinlord.antarchy.content.item.JumpyBootsItem; import com.craisinlord.antarchy.content.item.JumpyBootsItem;
@@ -47,6 +50,7 @@ public final class AntarchyFabricNetworking {
PayloadTypeRegistry.playS2C().register(ScorpionWhipTetherPayload.TYPE, ScorpionWhipTetherPayload.STREAM_CODEC); PayloadTypeRegistry.playS2C().register(ScorpionWhipTetherPayload.TYPE, ScorpionWhipTetherPayload.STREAM_CODEC);
PayloadTypeRegistry.playS2C().register(BrutalflyElytraAnimationPayload.TYPE, BrutalflyElytraAnimationPayload.STREAM_CODEC); PayloadTypeRegistry.playS2C().register(BrutalflyElytraAnimationPayload.TYPE, BrutalflyElytraAnimationPayload.STREAM_CODEC);
PayloadTypeRegistry.playS2C().register(ThoraxisWeatherPayload.TYPE, ThoraxisWeatherPayload.STREAM_CODEC); PayloadTypeRegistry.playS2C().register(ThoraxisWeatherPayload.TYPE, ThoraxisWeatherPayload.STREAM_CODEC);
PayloadTypeRegistry.playS2C().register(HerculesBeetleImpactShakePayload.TYPE, HerculesBeetleImpactShakePayload.STREAM_CODEC);
PayloadTypeRegistry.playC2S().register(GravityGunPrimaryPayload.TYPE, GravityGunPrimaryPayload.STREAM_CODEC); PayloadTypeRegistry.playC2S().register(GravityGunPrimaryPayload.TYPE, GravityGunPrimaryPayload.STREAM_CODEC);
PayloadTypeRegistry.playC2S().register(GravityGunScrollPayload.TYPE, GravityGunScrollPayload.STREAM_CODEC); PayloadTypeRegistry.playC2S().register(GravityGunScrollPayload.TYPE, GravityGunScrollPayload.STREAM_CODEC);
@@ -55,6 +59,9 @@ public final class AntarchyFabricNetworking {
PayloadTypeRegistry.playC2S().register(JumpyBootsLaunchPayload.TYPE, JumpyBootsLaunchPayload.STREAM_CODEC); PayloadTypeRegistry.playC2S().register(JumpyBootsLaunchPayload.TYPE, JumpyBootsLaunchPayload.STREAM_CODEC);
PayloadTypeRegistry.playC2S().register(DorrieJumpInputPayload.TYPE, DorrieJumpInputPayload.STREAM_CODEC); PayloadTypeRegistry.playC2S().register(DorrieJumpInputPayload.TYPE, DorrieJumpInputPayload.STREAM_CODEC);
PayloadTypeRegistry.playC2S().register(com.craisinlord.antarchy.content.network.DorrieChargeJumpPayload.TYPE, com.craisinlord.antarchy.content.network.DorrieChargeJumpPayload.STREAM_CODEC); PayloadTypeRegistry.playC2S().register(com.craisinlord.antarchy.content.network.DorrieChargeJumpPayload.TYPE, com.craisinlord.antarchy.content.network.DorrieChargeJumpPayload.STREAM_CODEC);
PayloadTypeRegistry.playC2S().register(HerculesBeetleJumpInputPayload.TYPE, HerculesBeetleJumpInputPayload.STREAM_CODEC);
PayloadTypeRegistry.playC2S().register(HerculesBeetleMountedAttackPayload.TYPE, HerculesBeetleMountedAttackPayload.STREAM_CODEC);
PayloadTypeRegistry.playC2S().register(HerculesBeetleMountedChargePayload.TYPE, HerculesBeetleMountedChargePayload.STREAM_CODEC);
PayloadTypeRegistry.playC2S().register(MultipartAttackPayload.TYPE, MultipartAttackPayload.STREAM_CODEC); PayloadTypeRegistry.playC2S().register(MultipartAttackPayload.TYPE, MultipartAttackPayload.STREAM_CODEC);
PayloadTypeRegistry.playC2S().register(MultipartInteractPayload.TYPE, MultipartInteractPayload.STREAM_CODEC); PayloadTypeRegistry.playC2S().register(MultipartInteractPayload.TYPE, MultipartInteractPayload.STREAM_CODEC);
} }
@@ -74,6 +81,12 @@ public final class AntarchyFabricNetworking {
context.server().execute(() -> handleDorrieJumpInput(context.player(), payload))); context.server().execute(() -> handleDorrieJumpInput(context.player(), payload)));
ServerPlayNetworking.registerGlobalReceiver(com.craisinlord.antarchy.content.network.DorrieChargeJumpPayload.TYPE, (payload, context) -> ServerPlayNetworking.registerGlobalReceiver(com.craisinlord.antarchy.content.network.DorrieChargeJumpPayload.TYPE, (payload, context) ->
context.server().execute(() -> handleDorrieChargeJumpInput(context.player(), payload))); context.server().execute(() -> handleDorrieChargeJumpInput(context.player(), payload)));
ServerPlayNetworking.registerGlobalReceiver(HerculesBeetleJumpInputPayload.TYPE, (payload, context) ->
context.server().execute(() -> handleHerculesBeetleJumpInput(context.player(), payload)));
ServerPlayNetworking.registerGlobalReceiver(HerculesBeetleMountedAttackPayload.TYPE, (payload, context) ->
context.server().execute(() -> handleHerculesBeetleMountedAttack(context.player(), payload)));
ServerPlayNetworking.registerGlobalReceiver(HerculesBeetleMountedChargePayload.TYPE, (payload, context) ->
context.server().execute(() -> handleHerculesBeetleMountedCharge(context.player(), payload)));
ServerPlayNetworking.registerGlobalReceiver(MultipartAttackPayload.TYPE, (payload, context) -> ServerPlayNetworking.registerGlobalReceiver(MultipartAttackPayload.TYPE, (payload, context) ->
context.server().execute(() -> handleMultipartAttack(context.player(), payload))); context.server().execute(() -> handleMultipartAttack(context.player(), payload)));
ServerPlayNetworking.registerGlobalReceiver(MultipartInteractPayload.TYPE, (payload, context) -> ServerPlayNetworking.registerGlobalReceiver(MultipartInteractPayload.TYPE, (payload, context) ->
@@ -328,4 +341,26 @@ public final class AntarchyFabricNetworking {
dorrie.releaseJump(); 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 handleHerculesBeetleMountedCharge(ServerPlayer player, HerculesBeetleMountedChargePayload payload) {
if (player.getVehicle() instanceof HerculesBeetleEntity beetle) {
beetle.handleMountedCharge(player, payload.chargeTicks());
}
}
public static void triggerHerculesBeetleImpactShake(int durationTicks) {
HerculesBeetleImpactShakeClientState.trigger(durationTicks);
}
} }
@@ -20,7 +20,7 @@
], ],
"client": [ "client": [
"client.NightmareCameraShakeMixin", "client.NightmareCameraShakeMixin",
"client.ToreterrorCameraShakeMixin", "client.CameraShakeMixin",
"client.DuctTapeInputMixin", "client.DuctTapeInputMixin",
"client.AntiwaterFogMixin", "client.AntiwaterFogMixin",
"client.GravityGunMouseScrollMixin", "client.GravityGunMouseScrollMixin",
@@ -1,6 +1,9 @@
package com.craisinlord.antarchy.neoforge; package com.craisinlord.antarchy.neoforge;
import com.craisinlord.antarchy.config.AntarchySettings; 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.ModContainer;
import net.neoforged.fml.config.ModConfig; import net.neoforged.fml.config.ModConfig;
import net.neoforged.fml.event.config.ModConfigEvent; 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, AntarchyMobsConfig.SPEC, "antarchy/antarchy_mobs.toml");
modContainer.registerConfig(ModConfig.Type.COMMON, AntarchyToolsConfig.SPEC, "antarchy/antarchy_tools.toml"); modContainer.registerConfig(ModConfig.Type.COMMON, AntarchyToolsConfig.SPEC, "antarchy/antarchy_tools.toml");
modContainer.registerConfig(ModConfig.Type.COMMON, AntarchyMiscConfig.SPEC, "antarchy/antarchy_misc.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); AntarchyNeoforge.modEventBusTempHolder.addListener(AntarchyConfigModuleNeoforge::onConfigChange);
} }
@@ -169,6 +173,9 @@ public final class AntarchyConfigModuleNeoforge {
AntarchySettings.setCheepHealth(AntarchyMobsConfig.cheepHealth()); AntarchySettings.setCheepHealth(AntarchyMobsConfig.cheepHealth());
AntarchySettings.setCheepAttackDamage(AntarchyMobsConfig.cheepAttackDamage()); AntarchySettings.setCheepAttackDamage(AntarchyMobsConfig.cheepAttackDamage());
AntarchySettings.setDorrieHealth(AntarchyMobsConfig.dorrieHealth()); AntarchySettings.setDorrieHealth(AntarchyMobsConfig.dorrieHealth());
AntarchySettings.setHerculesBeetleHealth(AntarchyMobsConfig.herculesBeetleHealth());
AntarchySettings.setHerculesBeetleAttackDamage(AntarchyMobsConfig.herculesBeetleAttackDamage());
AntarchySettings.setHerculesBeetleChargeDamage(AntarchyMobsConfig.herculesBeetleChargeDamage());
} }
private static void bakeToolsConfig() { private static void bakeToolsConfig() {
@@ -193,6 +193,13 @@ public final class AntarchyMobsConfig {
private static final ModConfigSpec.DoubleValue DORRIE_HEALTH; 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 // Lucid
private static final ModConfigSpec.DoubleValue LUCID_ATTACK_RANGE; 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); DORRIE_HEALTH = b.comment("Base max health.").defineInRange("health", 60.0D, 1.0D, 32768.0D);
b.pop(); 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"); b.push("toreterror");
TORETERROR_HEALTH = b.comment("Base max health.").defineInRange("health", 300.0D, 1.0D, 32768.0D); 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); 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 cheepHealth() { return CHEEP_HEALTH.get(); }
static double cheepAttackDamage() { return CHEEP_ATTACK_DAMAGE.get(); } static double cheepAttackDamage() { return CHEEP_ATTACK_DAMAGE.get(); }
static double dorrieHealth() { return DORRIE_HEALTH.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_MAX_HEARTS,
() -> AntarchyNeoforgeMisc.BLOODGLASS_WARD () -> AntarchyNeoforgeMisc.BLOODGLASS_WARD
); );
AntarchyObjects.setHerculesBeetle(AntarchyNeoforgeEntites.HERCULES_BEETLE);
AntarchyObjects.setOctopusBomb(AntarchyNeoforgeEntites.OCTOPUS_BOMB); AntarchyObjects.setOctopusBomb(AntarchyNeoforgeEntites.OCTOPUS_BOMB);
} }
@@ -29,11 +29,20 @@ public final class AntarchyKeyBindings {
CATEGORY 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() {} private AntarchyKeyBindings() {}
@SubscribeEvent @SubscribeEvent
public static void onRegisterKeyMappings(RegisterKeyMappingsEvent event) { public static void onRegisterKeyMappings(RegisterKeyMappingsEvent event) {
event.register(BRUTALFLY_FLAP); event.register(BRUTALFLY_FLAP);
event.register(DORRIE_CHARGE_JUMP); 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.LURKING_TERROR.get(), LurkingTerrorRenderer::new);
event.registerEntityRenderer(AntarchyNeoforgeEntites.CHEEP.get(), context -> withParalyzedGeoLayer(new com.craisinlord.antarchy.content.client.renderer.CheepRenderer(context))); 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.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 @SubscribeEvent
@@ -1,8 +1,9 @@
package com.craisinlord.antarchy.neoforge.client; package com.craisinlord.antarchy.neoforge.client;
import com.craisinlord.antarchy.Antarchy; import com.craisinlord.antarchy.Antarchy;
import com.craisinlord.antarchy.content.client.HerculesBeetleImpactShakeClientState;
import com.craisinlord.antarchy.content.entity.ToreterrorEntity; 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.client.Minecraft;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
@@ -12,11 +13,12 @@ import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.neoforge.client.event.ViewportEvent; import net.neoforged.neoforge.client.event.ViewportEvent;
@EventBusSubscriber(modid = Antarchy.MODID, value = Dist.CLIENT) @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 double MAX_SHAKE_RANGE = 48.0D;
private static final int TORETERROR_SHAKE_TICKS = 25; private static final int TORETERROR_SHAKE_TICKS = 25;
private static final double NIGHTMARE_SHAKE_RANGE = 32.0D;
private ToreterrorCameraShakeHandler() { private CameraShakeHandler() {
} }
@SubscribeEvent @SubscribeEvent
@@ -37,8 +39,19 @@ public final class ToreterrorCameraShakeHandler {
shakeStrength += (float) ((1.0D - distance / MAX_SHAKE_RANGE) * 1.0D); shakeStrength += (float) ((1.0D - distance / MAX_SHAKE_RANGE) * 1.0D);
} }
if (BigBerthaItem.clientShakeTicks > 0) { for (NightmareEntity nightmare : mc.level.getEntitiesOfClass(
shakeStrength += (float) BigBerthaItem.clientShakeTicks / TORETERROR_SHAKE_TICKS * 2.0F; 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; 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) { 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.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.insertAfter(new ItemStack(Items.MINECART), new ItemStack(AntarchyNeoforgeItems.DIAMOND_MINECART_ITEM.get()), CreativeModeTab.TabVisibility.PARENT_AND_SEARCH_TABS);
event.accept(AntarchyNeoforgeItems.BILE_BUCKET.get()); event.accept(AntarchyNeoforgeItems.BILE_BUCKET.get());
@@ -384,7 +383,7 @@ public class AntarchyNeoforgeCreativeModeTabs {
// 8 - Blood crystal blocks (not the shard ingredient) // 8 - Blood crystal blocks (not the shard ingredient)
case "blood_crystal_block", "small_blood_crystal_bud", "medium_blood_crystal_bud", case "blood_crystal_block", "small_blood_crystal_bud", "medium_blood_crystal_bud",
"large_blood_crystal_bud", "budding_blood_crystal", "blood_crystal_cluster", "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 // 9 - Ouranwood leaves
case "ouranwood_leaves" -> 9; case "ouranwood_leaves" -> 9;
@@ -409,7 +408,7 @@ public class AntarchyNeoforgeCreativeModeTabs {
// 15 - Tools // 15 - Tools
case "ultimate_pickaxe", "ultimate_axe", "ultimate_shovel", "ultimate_hoe", 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 // 16 - Liquid buckets
case "bile_bucket", "ichor_bucket", "antiwater_bucket", "cloud_bucket" -> 16; 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.EasterBunnyEntity;
import com.craisinlord.antarchy.content.entity.EmperorScorpionEntity; import com.craisinlord.antarchy.content.entity.EmperorScorpionEntity;
import com.craisinlord.antarchy.content.entity.HushProjectileEntity; 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.JumpyBugEntity;
import com.craisinlord.antarchy.content.entity.MantisEntity; import com.craisinlord.antarchy.content.entity.MantisEntity;
import com.craisinlord.antarchy.content.entity.MissileSquidEntity; import com.craisinlord.antarchy.content.entity.MissileSquidEntity;
@@ -311,6 +312,11 @@ public final class AntarchyNeoforgeEntites {
.sized(2.4F, 2.0F) .sized(2.4F, 2.0F)
.clientTrackingRange(10) .clientTrackingRange(10)
.build("dorrie")); .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", public static final DeferredHolder<EntityType<?>, EntityType<UpwardFallingBlockEntity>> UPWARD_FALLING_BLOCK = ENTITY_TYPES.register("upward_falling_block",
() -> EntityType.Builder.<UpwardFallingBlockEntity>of( () -> EntityType.Builder.<UpwardFallingBlockEntity>of(
UpwardFallingBlockEntity::new, MobCategory.MISC) UpwardFallingBlockEntity::new, MobCategory.MISC)
@@ -74,6 +74,7 @@ public class AntarchyNeoforgeEntityAttributes {
event.put(AntarchyNeoforgeEntites.MOLEVORE.get(), MolevoreEntity.createAttributes().build()); event.put(AntarchyNeoforgeEntites.MOLEVORE.get(), MolevoreEntity.createAttributes().build());
event.put(AntarchyNeoforgeEntites.CHEEP.get(), com.craisinlord.antarchy.content.entity.CheepEntity.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.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) { 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.block.entity.WaspNestBlockEntity;
import com.craisinlord.antarchy.content.entity.SizeRayProjectileEntity; import com.craisinlord.antarchy.content.entity.SizeRayProjectileEntity;
import com.craisinlord.antarchy.content.item.*; 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.BloodCrystalArmorItem;
import com.craisinlord.antarchy.content.item.BloodCrystalAppleItem; import com.craisinlord.antarchy.content.item.BloodCrystalAppleItem;
import com.craisinlord.antarchy.content.item.BloodCrystalKatanaItem; import com.craisinlord.antarchy.content.item.BloodCrystalKatanaItem;
@@ -369,8 +368,6 @@ public final class AntarchyNeoforgeItems {
.nutrition(2) .nutrition(2)
.saturationModifier(0.2F) .saturationModifier(0.2F)
.build()))); .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", public static final DeferredItem<Item> MOLEWORM_ITEM = ITEMS.register("moleworm",
() -> new Item(new Item.Properties() () -> new Item(new Item.Properties()
.food(new FoodProperties.Builder() .food(new FoodProperties.Builder()
@@ -591,6 +588,8 @@ public final class AntarchyNeoforgeItems {
() -> new DeferredSpawnEggItem(AntarchyNeoforgeEntites.CHEEP, 0xAA22FF, 0x22FF44, new Item.Properties())); () -> new DeferredSpawnEggItem(AntarchyNeoforgeEntites.CHEEP, 0xAA22FF, 0x22FF44, new Item.Properties()));
public static final DeferredItem<DeferredSpawnEggItem> DORRIE_SPAWN_EGG = ITEMS.register("dorrie_spawn_egg", public static final DeferredItem<DeferredSpawnEggItem> DORRIE_SPAWN_EGG = ITEMS.register("dorrie_spawn_egg",
() -> new DeferredSpawnEggItem(AntarchyNeoforgeEntites.DORRIE, 0x1B91B3, 0xC0E8FF, new Item.Properties())); () -> 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() {} 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.AntarchyGravityNetworking;
import com.craisinlord.antarchy.neoforge.network.BrutalflyElytraNetworking; import com.craisinlord.antarchy.neoforge.network.BrutalflyElytraNetworking;
import com.craisinlord.antarchy.neoforge.network.DorrieJumpNetworking; 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.JumpyBootsNetworking;
import com.craisinlord.antarchy.neoforge.network.MultipartNetworking; import com.craisinlord.antarchy.neoforge.network.MultipartNetworking;
import net.neoforged.bus.api.IEventBus; import net.neoforged.bus.api.IEventBus;
@@ -22,6 +23,7 @@ public class AntarchyNeoforgePayloadHandlers {
BrutalflyElytraNetworking.register(registrar); BrutalflyElytraNetworking.register(registrar);
JumpyBootsNetworking.register(registrar); JumpyBootsNetworking.register(registrar);
DorrieJumpNetworking.register(registrar); DorrieJumpNetworking.register(registrar);
HerculesBeetleNetworking.register(registrar);
registrar.playToClient( registrar.playToClient(
com.craisinlord.antarchy.content.network.BloodglassStatePayload.TYPE, com.craisinlord.antarchy.content.network.BloodglassStatePayload.TYPE,
com.craisinlord.antarchy.content.network.BloodglassStatePayload.STREAM_CODEC, com.craisinlord.antarchy.content.network.BloodglassStatePayload.STREAM_CODEC,