Skip to content

Commit

Permalink
feat: make primal membrane consider golems as not alive
Browse files Browse the repository at this point in the history
  • Loading branch information
Elenterius committed Jan 10, 2024
1 parent 0c5af08 commit 98d17e1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,32 @@
import com.github.elenterius.biomancy.init.tags.ModEntityTags;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.tags.EntityTypeTagsProvider;
import net.minecraft.tags.TagKey;
import net.minecraft.world.entity.EntityType;
import net.minecraftforge.common.data.ExistingFileHelper;
import net.minecraftforge.registries.ForgeRegistries;
import org.apache.commons.lang3.StringUtils;

import javax.annotation.Nullable;

public class ForgeEntityTypeTagsProvider extends EntityTypeTagsProvider {

public ForgeEntityTypeTagsProvider(DataGenerator pGenerator, @Nullable ExistingFileHelper existingFileHelper) {
super(pGenerator, "forge", existingFileHelper);
public ForgeEntityTypeTagsProvider(DataGenerator generator, @Nullable ExistingFileHelper existingFileHelper) {
super(generator, "forge", existingFileHelper);
}

@Override
protected void addTags() {
tag(ModEntityTags.FORGE_BOSSES).add(EntityType.WITHER, EntityType.ENDER_DRAGON);
tag(ModEntityTags.FORGE_BOSSES)
.add(EntityType.WITHER, EntityType.ENDER_DRAGON);

createTag(ModEntityTags.FORGE_GOLEMS)
.add(EntityType.IRON_GOLEM, EntityType.SNOW_GOLEM)
.addOptional("strawgolem:strawgolem", "strawgolem:strawnggolem");
}

protected EnhancedTagAppender<EntityType<?>> createTag(TagKey<EntityType<?>> tag) {
return new EnhancedTagAppender<>(tag(tag), ForgeRegistries.ENTITY_TYPES);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.github.elenterius.biomancy.block;

import com.github.elenterius.biomancy.init.tags.ModEntityTags;
import net.minecraft.core.BlockPos;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity;
Expand Down Expand Up @@ -74,7 +75,7 @@ public VoxelShape getCollisionShape(BlockState state, BlockGetter level, BlockPo
public interface IgnoreEntityCollisionPredicate {
IgnoreEntityCollisionPredicate IS_BABY_MOB = (state, level, pos, entity) -> entity instanceof LivingEntity livingEntity && livingEntity.isBaby();
IgnoreEntityCollisionPredicate IS_ADULT_MOB = (state, level, pos, entity) -> entity instanceof LivingEntity livingEntity && !livingEntity.isBaby();
IgnoreEntityCollisionPredicate IS_ALIVE_MOB = (state, level, pos, entity) -> entity instanceof LivingEntity livingEntity && livingEntity.getMobType() != MobType.UNDEAD;
IgnoreEntityCollisionPredicate IS_ALIVE_MOB = (state, level, pos, entity) -> entity instanceof LivingEntity livingEntity && !entity.getType().is(ModEntityTags.FORGE_GOLEMS) && livingEntity.getMobType() != MobType.UNDEAD;
IgnoreEntityCollisionPredicate IS_UNDEAD_MOB = (state, level, pos, entity) -> entity instanceof LivingEntity livingEntity && livingEntity.getMobType() == MobType.UNDEAD;
IgnoreEntityCollisionPredicate IS_ITEM = (state, level, pos, entity) -> entity instanceof ItemEntity;
IgnoreEntityCollisionPredicate NEVER = (state, level, pos, entity) -> false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.TagKey;
import net.minecraft.world.entity.EntityType;
import net.minecraftforge.common.Tags;

public final class ModEntityTags {

public static final TagKey<EntityType<?>> FORGE_BOSSES = forgeTag("bosses");
public static final TagKey<EntityType<?>> FORGE_BOSSES = Tags.EntityTypes.BOSSES;
public static final TagKey<EntityType<?>> FORGE_GOLEMS = forgeTag("golems");
public static final TagKey<EntityType<?>> NOT_CLONEABLE = tag("not_cloneable");

public static final TagKey<EntityType<?>> FLESHKIN = tag("fleshkin");
Expand Down

0 comments on commit 98d17e1

Please sign in to comment.