Skip to content

Commit

Permalink
改名
Browse files Browse the repository at this point in the history
  • Loading branch information
MagicHarp committed Oct 12, 2024
1 parent 3dc6b84 commit 08097b0
Show file tree
Hide file tree
Showing 12 changed files with 97 additions and 11 deletions.
3 changes: 1 addition & 2 deletions src/main/java/org/confluence/mod/client/ModClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import net.minecraft.client.renderer.ItemBlockRenderTypes;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.blockentity.SignRenderer;
import net.minecraft.client.renderer.entity.CreeperRenderer;
import net.minecraft.client.renderer.entity.NoopRenderer;
import net.minecraft.client.renderer.entity.ThrownItemRenderer;
import net.minecraft.client.renderer.item.ItemProperties;
Expand Down Expand Up @@ -205,7 +204,7 @@ public static void registerEntityRenderers(EntityRenderersEvent.RegisterRenderer
event.registerEntityRenderer(TEST_WORM.get(), TestWormRenderer::new);
event.registerEntityRenderer(TEST_WORM_PART.get(), TestWormSegmentRenderer::new);

event.registerEntityRenderer(CRIMSON_CREEPER.get(), CrimsonCreeperRenderer::new);
event.registerEntityRenderer(BLOODY_SPORE.get(), BloodySporeRenderer::new);

event.registerEntityRenderer(BASE_BULLET.get(), BulletRenderer::new);
event.registerEntityRenderer(FALLING_STAR_ITEM_ENTITY.get(), FallingStarRenderer::new);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
import org.confluence.mod.Confluence;
import org.jetbrains.annotations.NotNull;

public class CrimsonCreeperRenderer extends CreeperRenderer {
private static final ResourceLocation LOCATION = new ResourceLocation(Confluence.MODID, "textures/entity/crimson_creeper.png");
public class BloodySporeRenderer extends CreeperRenderer {
private static final ResourceLocation LOCATION = new ResourceLocation(Confluence.MODID, "textures/entity/bloody_spore.png");

public CrimsonCreeperRenderer(EntityRendererProvider.Context p_173958_) {
public BloodySporeRenderer(EntityRendererProvider.Context p_173958_) {
super(p_173958_);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ protected void addTranslations() {
add("entity.confluence.lava_slime", "岩浆史莱姆");
add("entity.confluence.demon_eye", "恶魔眼");
add("entity.confluence.blood_crawler", "血爬虫");
add("entity.confluence.bloody_spore", "血腥芽孢");

add("entity.confluence.king_slime", "史莱姆王");
add("entity.confluence.cthulhu_eye", "克苏鲁之眼");
Expand Down Expand Up @@ -1130,6 +1131,7 @@ protected void addTranslations() {
add(Materials.WEAVING_CLOUD_COTTON.get(), "织云棉");
add(Materials.CARRION.get(), "腐肉");
add(Materials.VERTEBRA.get(), "椎骨");
add(Materials.BLOOD_CLOT_POWDER.get(), "血凝粉末");
add(Materials.LENS.get(), "晶状体");
add(Materials.BLACK_LENS.get(), "黑晶状体");
add(Materials.CRYSTAL_SHARDS_ITEM.get(), "水晶碎块");
Expand Down Expand Up @@ -1566,6 +1568,7 @@ protected void addTranslations() {
add(SpawnEggs.LAVA_SLIME_SPAWN_EGG.get(), "岩浆史莱姆刷怪蛋");
add(SpawnEggs.DEMON_EYE_SPAWN_EGG.get(), "恶魔眼刷怪蛋");
add(SpawnEggs.BLOOD_CRAWLER_SPAWN_EGG.get(), "血爬虫刷怪蛋");
add(SpawnEggs.BLOODY_SPORE_SPAWN_EGG.get(), "血腥芽孢刷怪蛋");
add(SpawnEggs.CTHULHU_EYE_SPAWN_EGG.get(), "克苏鲁之眼刷怪蛋");
add(SpawnEggs.KING_SLIME_SPAWN_EGG.get(), "史莱姆王刷怪蛋");
// 光剑
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/confluence/mod/entity/ModEntities.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import org.confluence.mod.entity.boss.KingSlime;
import org.confluence.mod.entity.boss.geoEntity.*;
import org.confluence.mod.entity.chair.ChairEntity;
import org.confluence.mod.entity.monster.CrimsonCreeper;
import org.confluence.mod.entity.monster.BloodySpore;
import org.confluence.mod.entity.monster.demoneye.DemonEye;
import org.confluence.mod.entity.fishing.BaseFishingHook;
import org.confluence.mod.entity.fishing.BloodyFishingHook;
Expand Down Expand Up @@ -58,7 +58,7 @@ public final class ModEntities {
public static final RegistryObject<EntityType<HoneySlime>> HONEY_SLIME = ENTITIES.register("honey_slime", () -> EntityType.Builder.<HoneySlime>of((entityType, level) -> new HoneySlime(entityType, level, 0xf8e234), MobCategory.MONSTER).sized(2.04F, 2.04F).clientTrackingRange(10).build("confluence:honey_slime"));
public static final RegistryObject<EntityType<BlackSlime>> BLACK_SLIME = ENTITIES.register("black_slime", () -> EntityType.Builder.of(BlackSlime::new, MobCategory.MONSTER).sized(2.04F, 2.04F).clientTrackingRange(10).build("confluence:black_slime"));
public static final RegistryObject<EntityType<DemonEye>> DEMON_EYE = ENTITIES.register("demon_eye", () -> EntityType.Builder.of(DemonEye::new, MobCategory.MONSTER).sized(0.6F, 0.6F).clientTrackingRange(10).build("confluence:demon_eye"));
public static final RegistryObject<EntityType<CrimsonCreeper>> CRIMSON_CREEPER = ENTITIES.register("crimson_creeper", () -> EntityType.Builder.of(CrimsonCreeper::new, MobCategory.MONSTER).build("confluence:crimson_creeper"));
public static final RegistryObject<EntityType<BloodySpore>> BLOODY_SPORE = ENTITIES.register("bloody_spore", () -> EntityType.Builder.of(BloodySpore::new, MobCategory.MONSTER).build("confluence:bloody_spore"));

public static final RegistryObject<EntityType<BloodCrawler>> BLOOD_CRAWLER = ENTITIES.register("blood_crawler", () -> EntityType.Builder.of(BloodCrawler::new, MobCategory.MONSTER).sized(1.8F, 1.2F).clientTrackingRange(10).build("confluence:blood_crawler"));

Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
package org.confluence.mod.entity.monster;

import net.minecraft.core.BlockPos;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.MobSpawnType;
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.monster.Creeper;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.gameevent.GameEvent;
import org.confluence.mod.entity.ModEntities;

public class CrimsonCreeper extends Creeper {
public class BloodySpore extends Creeper {
private int oldSwell;
private int swell;
private int maxSwell = 30;

public CrimsonCreeper(EntityType<? extends Creeper> pEntityType, Level pLevel) {
public BloodySpore(EntityType<? extends Creeper> pEntityType, Level pLevel) {
super(pEntityType, pLevel);
}

Expand Down Expand Up @@ -70,6 +74,23 @@ private void explodeCreeper() {
this.discard();
}
}
public static boolean checkBloodySporeSpawn(EntityType<? extends BloodySpore> type, LevelAccessor pLevel, MobSpawnType pSpawnType, BlockPos pPos, RandomSource pRandom) {
if (!(pLevel instanceof Level level)) {
return false; // 如果 pLevel 不是 Level 的实例,返回 false
}

if (!checkMobSpawnRules(type, pLevel, pSpawnType, pPos, pRandom)) {
return false; // 如果不满足基本生成规则,返回 false
}

int y = pPos.getY();
if (y >= 260) {
return false; // 不能生成在 y = 260 或更高的位置
}

return true;
}

@Override
public float getSwelling(float pPartialTicks) {
return Mth.lerp(pPartialTicks, (float)this.oldSwell, (float)this.swell) / (float)(this.maxSwell - 2);
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/org/confluence/mod/event/ModEvents.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import org.confluence.mod.entity.ModEntities;
import org.confluence.mod.entity.boss.geoEntity.CthulhuEye;
import org.confluence.mod.entity.boss.KingSlime;
import org.confluence.mod.entity.monster.CrimsonCreeper;
import org.confluence.mod.entity.monster.BloodySpore;
import org.confluence.mod.entity.monster.demoneye.DemonEye;
import org.confluence.mod.entity.minion.FinchMinionEntity;
import org.confluence.mod.entity.npc.ModVillagers;
Expand Down Expand Up @@ -77,7 +77,7 @@ public static void attributeCreate(EntityAttributeCreationEvent event) {
event.put(ModEntities.BLACK_SLIME.get(), Monster.createMonsterAttributes().build()); // 由finalizeSpawn设置
event.put(ModEntities.DEMON_EYE.get(), DemonEye.createAttributes().build());
event.put(ModEntities.BLOOD_CRAWLER.get(), BloodCrawler.createAttributes().build());
event.put(ModEntities.CRIMSON_CREEPER.get(), CrimsonCreeper.createAttributes().build());
event.put(ModEntities.BLOODY_SPORE.get(), BloodySpore.createAttributes().build());

event.put(ModEntities.KING_SLIME.get(), KingSlime.createSlimeAttributes().build());
event.put(ModEntities.CTHULHU_EYE.get(), CthulhuEye.createAttributes().build());
Expand Down Expand Up @@ -196,6 +196,7 @@ public static void spawnPlacementRegister(SpawnPlacementRegisterEvent event) {

event.register(ModEntities.DEMON_EYE.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, DemonEye::checkDemonEyeSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE);
event.register(ModEntities.BLOOD_CRAWLER.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, BloodCrawler::checkBloodCrawlerSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE);
event.register(ModEntities.BLOODY_SPORE.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, BloodySpore::checkBloodySporeSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE);
}

@SubscribeEvent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public enum Materials implements EnumRegister<Item> {
WEAVING_CLOUD_COTTON("weaving_cloud_cotton", () -> new BaseItem(WHITE)),
CARRION("carrion", () -> new BaseItem(WHITE)),
VERTEBRA("vertebra", () -> new BaseItem(WHITE)),
BLOOD_CLOT_POWDER("blood_clot_powder", () -> new BaseItem(WHITE)),
BLACK_INK("black_ink", () -> new BaseItem(WHITE)),
PURPLE_MUCUS("purple_mucus", () -> new BaseItem(WHITE)),
SHARK_FIN("shark_fin", () -> new BaseItem(WHITE)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public enum SpawnEggs implements EnumRegister<ForgeSpawnEggItem> {
LUMINOUS_SLIME_SPAWN_EGG("evil_slime_spawn_egg", ModEntities.LUMINOUS_SLIME, 0xFF00FF, 0xEDFFFA),
DEMON_EYE_SPAWN_EGG("demon_eye_spawn_egg", ModEntities.DEMON_EYE, 0xffffff, 0xab0d0d),
BLOOD_CRAWLER_SPAWN_EGG("blood_crawler_spawn_egg", ModEntities.BLOOD_CRAWLER, 0xf2d4ca, 0xa75049),
BLOODY_SPORE_SPAWN_EGG("bloody_spore_spawn_egg", ModEntities.BLOODY_SPORE, 0xa75049, 0x65292c),

KING_SLIME_SPAWN_EGG("king_slime_spawn_egg", ModEntities.KING_SLIME, 0x73bcf4, 0xf8e234),
CTHULHU_EYE_SPAWN_EGG("cthulhu_eye_spawn_egg", ModEntities.CTHULHU_EYE, 0xffffff, 0xab0d0d),
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"type": "forge:add_spawns",
"biomes": [
"confluence:tr_crimson"
],
"spawners": {
"type": "confluence:bloody_spore",
"weight": 30,
"minCount": 1,
"maxCount": 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"type": "minecraft:entity",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "confluence:blood_clot_powder",
"weight": 1,
"functions": [
{
"function": "set_count",
"count": {
"min": 1,
"max": 3
}
}
]
}
]
},
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "confluence:vertebra",
"weight": 33,
"functions": [
{
"function": "set_count",
"count": {
"min": 1,
"max": 1
}
}
]
},
{
"type": "minecraft:empty",
"weight": 67
}
]
}
],
"random_sequence": "confluence:entity/bloody_spore"
}

0 comments on commit 08097b0

Please sign in to comment.