Skip to content

Commit

Permalink
Partial backport from 1.20.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Mechalopa committed Jan 4, 2024
1 parent 6bc0ce0 commit bf9cc69
Show file tree
Hide file tree
Showing 46 changed files with 745 additions and 121 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ More Hostile Mobs and Girls!!!
## Japanese Forum and Descriptions
- [Minecraft Japan Forum Thread](https://forum.civa.jp/viewtopic.php?f=3&t=750)
## Credits
- es_es.json by not-a-java-dev
- ru_ru.json by Tefnya
- zh_cn.json by Kzeroko, SodiumZH
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ public static LayerDefinition createBodyLayer()
ModClientUtils.addC(headpart2pd, "head_part_2_parts_" + k, 16, 96, -1.0F, -5.0F, -0.5F, 2.0F, 4.0F, 1.0F, 0.0F, 0.0F, 0.0F);
}

PartDefinition bodypd = pd.getChild("body");
ModClientUtils.addC(bodypd, "bust", 0, 56, -4.5F, 0.0F, -3.0F, 9.0F, 3.0F, 5.0F, 0.0F, 2.0F, 0.0F);
ModClientUtils.addC(bodypd, "skirt_1", 0, 64, -5.0F, 0.0F, -3.0F, 10.0F, 2.0F, 6.0F, 0.0F, 8.0F, 0.0F);
ModClientUtils.addC(bodypd, "skirt_2", 0, 72, -5.5F, 0.0F, -3.5F, 11.0F, 2.0F, 7.0F, 0.0F, 10.0F, 0.0F);
PartDefinition bodypd = ModClientUtils.addC(pd, "body", 16, 16, -4.0F, 0.0F, -2.0F, 8.0F, 9.0F, 4.0F, 0.0F, 0.0F, 0.0F);
ModClientUtils.addC(bodypd, "bust", 0, 56, -4.5F, 0.0F, -3.0F, 9.0F, 3.0F, 5.0F, 0.0F, 2.0F, -0.005F);
ModClientUtils.addC(bodypd, "skirt_1", 0, 64, -5.0F, 0.0F, -3.0F, 10.0F, 2.0F, 6.0F, 0.0F, 8.25F, 0.0F);
ModClientUtils.addC(bodypd, "skirt_2", 0, 72, -5.5F, 0.0F, -3.5F, 11.0F, 2.0F, 7.0F, 0.0F, 10.25F, 0.0F);
PartDefinition rapd = ModClientUtils.addC(pd, "right_arm", 40, 16, -3.0F, -2.0F, -2.0F, 4.0F, 3.0F, 4.0F, -6.0F, 2.0F, 0.0F);
PartDefinition lapd = ModClientUtils.addC(pd, "left_arm", 40, 16, -1.0F, -2.0F, -2.0F, 4.0F, 3.0F, 4.0F, 6.0F, 2.0F, 0.0F, true);
ModClientUtils.addC(rapd, "right_arm_part_1", 32, 32, -3.0F, 0.0F, -2.0F, 5.0F, 1.0F, 4.0F, -1.0F, 0.0F, 0.0F);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.github.mechalopa.hmag.HMaG;
import com.github.mechalopa.hmag.client.ModModelLayers;
import com.github.mechalopa.hmag.client.model.DoguModel;
import com.github.mechalopa.hmag.client.renderer.layers.DoguEyesLayer;
import com.github.mechalopa.hmag.world.entity.DoguEntity;
import com.mojang.blaze3d.vertex.PoseStack;

Expand All @@ -21,6 +22,7 @@ public class DoguRenderer extends HumanoidMobRenderer<DoguEntity, DoguModel<Dogu
public DoguRenderer(EntityRendererProvider.Context context)
{
super(context, new DoguModel<>(context.bakeLayer(ModModelLayers.DOGU)), 0.5F);
this.addLayer(new DoguEyesLayer<>(this));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.github.mechalopa.hmag.client.renderer.layers;

import com.github.mechalopa.hmag.HMaG;
import com.github.mechalopa.hmag.client.model.DoguModel;
import com.github.mechalopa.hmag.world.entity.DoguEntity;

import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.entity.RenderLayerParent;
import net.minecraft.client.renderer.entity.layers.EyesLayer;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;

@OnlyIn(Dist.CLIENT)
public class DoguEyesLayer<T extends DoguEntity, M extends DoguModel<T>> extends EyesLayer<T, M>
{
private static final RenderType RENDER_TYPE = RenderType.eyes(new ResourceLocation(HMaG.MODID, "textures/entity/dogu_eyes.png"));

public DoguEyesLayer(RenderLayerParent<T, M> renderLayerParent)
{
super(renderLayerParent);
}

@Override
public RenderType renderType()
{
return RENDER_TYPE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public class ModItems
public static final RegistryObject<Item> CATOBLEPAS_SPAWN_EGG = createSpawnEggRegistryObject("catoblepas", ModEntityTypes.CATOBLEPAS, 0x74620B, 0x4E2310);
public static final RegistryObject<Item> SCORPION_SPAWN_EGG = createSpawnEggRegistryObject("scorpion", ModEntityTypes.SCORPION, 0xDAB68F, 0x625358);
public static final RegistryObject<Item> KASHA_SPAWN_EGG = createSpawnEggRegistryObject("kasha", ModEntityTypes.KASHA, 0x200000, 0xFFAE4A);
public static final RegistryObject<Item> DOGU_SPAWN_EGG = createSpawnEggRegistryObject("dogu", ModEntityTypes.DOGU, 0xB45927, 0x692707);
public static final RegistryObject<Item> DOGU_SPAWN_EGG = createSpawnEggRegistryObject("dogu", ModEntityTypes.DOGU, 0x7D4639, 0x5E3739);
public static final RegistryObject<Item> GHASTLY_SEEKER_SPAWN_EGG = createSpawnEggRegistryObject("ghastly_seeker", ModEntityTypes.GHASTLY_SEEKER, 0xF4E6D7, 0xC3B5A6);
public static final RegistryObject<Item> REDCAP_SPAWN_EGG = createSpawnEggRegistryObject("redcap", ModEntityTypes.REDCAP, 0x73530D, 0x8E2323);
public static final RegistryObject<Item> SLIME_GIRL_SPAWN_EGG = createSpawnEggRegistryObject("slime_girl", ModEntityTypes.SLIME_GIRL, 0xFD73AC, 0xFA476B);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.github.mechalopa.hmag.world.entity;

import java.util.EnumSet;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

Expand All @@ -28,7 +26,6 @@
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.ai.goal.FloatGoal;
import net.minecraft.world.entity.ai.goal.Goal;
import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal;
import net.minecraft.world.entity.ai.goal.MeleeAttackGoal;
import net.minecraft.world.entity.ai.goal.RandomLookAroundGoal;
Expand Down Expand Up @@ -74,7 +71,7 @@ protected void registerGoals()
this.goalSelector.addGoal(1, new FloatGoal(this));
this.goalSelector.addGoal(3, new LeapAtTargetGoal2(this, 0.39F, 0.45F, 7.0F, 24));
this.goalSelector.addGoal(4, new MeleeAttackGoal(this, 1.0D, false));
this.goalSelector.addGoal(5, new HarpyEntity.RandomStrollGoal(this));
this.goalSelector.addGoal(5, new WaterAvoidingRandomStrollGoal(this, 1.0D));
this.goalSelector.addGoal(6, new LookAtPlayerGoal(this, Player.class, 8.0F));
this.goalSelector.addGoal(6, new RandomLookAroundGoal(this));
this.targetSelector.addGoal(1, new HurtByTargetGoal(this));
Expand Down Expand Up @@ -269,73 +266,4 @@ public Packet<?> getAddEntityPacket()
{
return NetworkHooks.getEntitySpawningPacket(this);
}

private class RandomStrollGoal extends WaterAvoidingRandomStrollGoal
{
private boolean isLeaped = false;

public RandomStrollGoal(HarpyEntity mob)
{
super(mob, 1.0D);
this.setFlags(EnumSet.of(Goal.Flag.JUMP, Goal.Flag.MOVE));
}

@Override
public void start()
{
super.start();
this.isLeaped = false;
}

@Override
public void stop()
{
super.stop();
this.isLeaped = false;
}

@Override
public boolean canContinueToUse()
{
return super.canContinueToUse() && (!this.isLeaped || !this.mob.isOnGround());
}

@Override
public void tick()
{
super.tick();

BlockPos pos = this.mob.getNavigation().getTargetPos();

if (pos != null)
{
if (!this.isLeaped && this.mob.isOnGround() && this.mob.getRandom().nextInt(32) == 0)
{
if (Math.abs(pos.getY() - this.mob.getY()) <= 1.5D)
{
final double d0 = this.mob.distanceToSqr(pos.getX() + 0.5D, pos.getY(), pos.getZ() + 0.5D);

if (d0 <= 6.0D * 6.0D && d0 > 2.0D * 2.0D)
{
Vec3 vec3 = this.mob.getDeltaMovement();
Vec3 vec31 = new Vec3((pos.getX() + 0.5D) - this.mob.getX(), 0.0D, (pos.getZ() + 0.5D) - this.mob.getZ());

if (vec31.lengthSqr() > 1.0E-7D)
{
vec31 = vec31.normalize().scale(0.4D + this.mob.getRandom().nextFloat() * 0.1F).add(vec3.scale(0.2D));
}

this.mob.setDeltaMovement(vec31.x, 0.4D + this.mob.getRandom().nextFloat() * 0.05F, vec31.z);
this.isLeaped = true;
}
}
}

if (this.isLeaped)
{
this.mob.getLookControl().setLookAt(pos.getX() + 0.5D, pos.getY(), pos.getZ() + 0.5D, 30.0F, 30.0F);
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.GsonHelper;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.storage.loot.Deserializers;
Expand Down Expand Up @@ -41,9 +39,7 @@ public AdditionalEntityLootModifier(LootItemCondition[] conditionsIn, LootItemFu
@Override
public List<ItemStack> doApply(List<ItemStack> generatedLoot, LootContext context)
{
Entity entity = context.getParamOrNull(LootContextParams.THIS_ENTITY);

if (entity != null && entity instanceof LivingEntity && ((LivingEntity)entity).getLootTable() != null && context.getQueriedLootTableId().equals(((LivingEntity)entity).getLootTable()) && this.addition != null)
if (context.getParamOrNull(LootContextParams.THIS_ENTITY) != null && context.getParamOrNull(LootContextParams.BLOCK_STATE) == null && this.addition != null)
{
ItemStack stack = this.addition.getDefaultInstance();

Expand Down
27 changes: 27 additions & 0 deletions src/main/resources/assets/hmag/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,33 @@
"text.hmag.level": "Level %s",
"text.hmag.upgraded_suspicious_stew": "Stronger Potency",
"message.hmag.insomnia_item": "You may not rest now; you have a insomnia item",
"subtitles.hmag.entity.girls.ambient": "Girl-mob mutters",
"subtitles.hmag.entity.girls.hurt": "Girl-mob hurts",
"subtitles.hmag.entity.girls.death": "Girl-mob dies",
"subtitles.hmag.entity.ghost.ambient": "Ghost murmurs",
"subtitles.hmag.entity.ghost.hurt": "Ghost hurts",
"subtitles.hmag.entity.ghost.death": "Ghost dies",
"subtitles.hmag.entity.ogre.ambient": "Ogre groans",
"subtitles.hmag.entity.ogre.hurt": "Ogre hurts",
"subtitles.hmag.entity.ogre.death": "Ogre dies",
"subtitles.hmag.entity.doll.ambient": "Doll-mob moans",
"subtitles.hmag.entity.doll.hurt": "Doll-mob hurts",
"subtitles.hmag.entity.doll.death": "Doll-mob dies",
"subtitles.hmag.entity.spider_nest.ambient": "Spider's Nest hisses",
"subtitles.hmag.entity.spider_nest.hurt": "Spider's Nest hurts",
"subtitles.hmag.entity.spider_nest.death": "Spider's Nest dies",
"subtitles.hmag.entity.spider_nest.summon": "Spider's Nest summons",
"subtitles.hmag.entity.hornet.ambient": "Hornet buzzes",
"subtitles.hmag.entity.catoblepas.ambient": "Catoblepas grunts",
"subtitles.hmag.entity.catoblepas.hurt": "Catoblepas hurts",
"subtitles.hmag.entity.catoblepas.death": "Catoblepas dies",
"subtitles.hmag.entity.kasha.ambient": "Kasha meows",
"subtitles.hmag.entity.kasha.hurt": "Kasha hurts",
"subtitles.hmag.entity.kasha.death": "Kasha dies",
"subtitles.hmag.entity.dyssomnia.ambient": "Dyssomnia screeches",
"subtitles.hmag.entity.dyssomnia.hurt": "Dyssomnia hurts",
"subtitles.hmag.entity.dyssomnia.death": "Dyssomnia dies",
"subtitles.hmag.entity.dyssomnia.summon": "Dyssomnia summons",
"enchantment.hmag.health_boost.desc": "Increases the wearer's max health.",
"enchantment.hmag.water_aspect.desc": "Increases damage against mobs that are hurt by water, such as Blazes and Endermans. Also extinguish mobs that are on fire.",
"enchantment.hmag.anti_air.desc": "Increases damage against mobs in the air.",
Expand Down
Loading

0 comments on commit bf9cc69

Please sign in to comment.