Skip to content

Commit

Permalink
More explosion stuff, proper taming/breeding
Browse files Browse the repository at this point in the history
  • Loading branch information
crispytwig committed Oct 26, 2024
1 parent 004df64 commit e7b881a
Show file tree
Hide file tree
Showing 8 changed files with 179 additions and 53 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.starfish_studios.hamsters;

public class HamstersConfig {
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ public HamsterNewMarkingLayer(GeoRenderer<HamsterNew> entityRendererIn) {

@Override
public ResourceLocation getTextureResource(HamsterNew animatable) {
if (HamsterNew.Marking.byId(animatable.getMarking()) != HamsterNew.Marking.BLANK) return TEXTURES.get(HamsterNew.Marking.byId(animatable.getMarking()));
if (HamsterNew.Marking.BY_ID[animatable.getMarking()] != HamsterNew.Marking.BLANK) return TEXTURES.get(HamsterNew.Marking.BY_ID[animatable.getMarking()]);
return Hamsters.id("textures/entity/hamster/blank.png");
}

@Override
public void render(PoseStack poseStack, HamsterNew animatable, BakedGeoModel bakedModel, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, float partialTick, int packedLight, int packedOverlay) {

if (HamsterNew.Marking.byId(animatable.getMarking()) != HamsterNew.Marking.BLANK && !animatable.isBaby()) {
if (HamsterNew.Marking.BY_ID[animatable.getMarking()] != HamsterNew.Marking.BLANK) {
RenderType entityTranslucent = RenderType.entityTranslucent(getTextureResource(animatable));
this.getRenderer().actuallyRender(poseStack, animatable, bakedModel, renderType, bufferSource, bufferSource.getBuffer(entityTranslucent), true, partialTick, packedLight, packedOverlay, 1f, 1f, 1f, 1f);
}
Expand Down
195 changes: 150 additions & 45 deletions src/main/java/com/starfish_studios/hamsters/entity/HamsterNew.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class HamstersEntityType {
.entityFactory(HamsterNew::new)
.defaultAttributes(HamsterNew::createAttributes)
.spawnGroup(MobCategory.CREATURE)
.spawnRestriction(SpawnPlacements.Type.ON_GROUND, Heightmap.Types.WORLD_SURFACE_WG, Animal::checkAnimalSpawnRules)
.spawnRestriction(SpawnPlacements.Type.ON_GROUND, Heightmap.Types.WORLD_SURFACE_WG, HamsterNew::checkHamsterNewSpawnRules)
.dimensions(EntityDimensions.scalable(0.5F, 0.5F))
.trackRangeChunks(10)
);
Expand All @@ -49,7 +49,7 @@ public class HamstersEntityType {
public static final Supplier<EntityType<SeatEntity>> SEAT = registerEntityType("seat", (type, world) -> new SeatEntity(world), MobCategory.MISC, 0.0F, 0.0F);

static {
BiomeModifications.addSpawn(BiomeSelectors.tag(HamstersTags.HAS_HAMSTER), MobCategory.CREATURE, HamstersEntityType.HAMSTER, 30, 1, 1);
BiomeModifications.addSpawn(BiomeSelectors.tag(HamstersTags.HAS_HAMSTER), MobCategory.CREATURE, HamstersEntityType.HAMSTER_NEW, 30, 1, 1);
}

public static <T extends Entity> Supplier<EntityType<T>> registerEntityType(String id, EntityType.EntityFactory<T> factory, MobCategory category, float width, float height) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@
import com.starfish_studios.hamsters.Hamsters;
import net.minecraft.core.registries.Registries;
import net.minecraft.tags.TagKey;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.Block;

@SuppressWarnings("unused")
public class HamstersTags {

public static final TagKey<EntityType<?>> HAMSTER_PREDATORS = TagKey.create(Registries.ENTITY_TYPE, Hamsters.id("hamster_predators"));

public static final TagKey<Block> HAMSTERS_SPAWNABLE_ON = TagKey.create(Registries.BLOCK, Hamsters.id("hamsters_spawnable_on"));

public static final TagKey<Item> CAGE_PANELS = TagKey.create(Registries.ITEM, Hamsters.id("cage_panels"));
public static final TagKey<Item> HAMSTER_FOOD = TagKey.create(Registries.ITEM, Hamsters.id("hamster_food"));

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"values": [
"#minecraft:dirt",
"minecraft:sand"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"values": [
"minecraft:fox",
"minecraft:cat",
"minecraft:wolf"
]
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"values": [
"minecraft:plains",
"minecraft:meadow",
"minecraft:sunflower_plains",
"#c:plains"
"#c:plains",
"#c:tree_deciduous",
"#c:is_dry/overworld"
]
}

0 comments on commit e7b881a

Please sign in to comment.