-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade to V0.1.3, add new trade villager, end_mythril_ore.json with …
…generation in end dimension, new raccoon mob with babies and timing, and refactor mod registries
- Loading branch information
Vladyslav Potapenko
committed
Dec 26, 2022
1 parent
0368abe
commit 50da923
Showing
33 changed files
with
1,591 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/main/java/me/nylestroke/nylemod/block/custom/ModSaplingBlock.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package me.nylestroke.nylemod.block.custom; | ||
|
||
import net.minecraft.block.Block; | ||
import net.minecraft.block.BlockState; | ||
import net.minecraft.block.SaplingBlock; | ||
import net.minecraft.block.sapling.SaplingGenerator; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.world.BlockView; | ||
|
||
import java.util.function.Supplier; | ||
|
||
public class ModSaplingBlock extends SaplingBlock { | ||
private final Supplier<Block> ground; | ||
|
||
public ModSaplingBlock(SaplingGenerator generator, Settings settings, Supplier<Block> ground) { | ||
super(generator, settings); | ||
this.ground = ground; | ||
} | ||
|
||
@Override | ||
protected boolean canPlantOnTop(BlockState floor, BlockView world, BlockPos pos) { | ||
return floor.isOf(ground.get()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/main/java/me/nylestroke/nylemod/entity/ModEntities.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package me.nylestroke.nylemod.entity; | ||
|
||
import me.nylestroke.nylemod.NylemodExample; | ||
import me.nylestroke.nylemod.entity.custom.RaccoonEntity; | ||
import net.fabricmc.fabric.api.object.builder.v1.entity.FabricEntityTypeBuilder; | ||
import net.minecraft.entity.EntityDimensions; | ||
import net.minecraft.entity.EntityType; | ||
import net.minecraft.entity.SpawnGroup; | ||
import net.minecraft.util.Identifier; | ||
import net.minecraft.util.registry.Registry; | ||
|
||
public class ModEntities { | ||
|
||
public static final EntityType<RaccoonEntity> RACCOON = Registry.register( | ||
Registry.ENTITY_TYPE, new Identifier(NylemodExample.MOD_ID, "raccoon"), | ||
FabricEntityTypeBuilder.create(SpawnGroup.CREATURE, RaccoonEntity::new).dimensions( | ||
EntityDimensions.fixed(0.4f, 0.3f)).build() | ||
); | ||
|
||
|
||
|
||
} |
40 changes: 40 additions & 0 deletions
40
src/main/java/me/nylestroke/nylemod/entity/client/RaccoonModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package me.nylestroke.nylemod.entity.client; | ||
|
||
import me.nylestroke.nylemod.NylemodExample; | ||
import me.nylestroke.nylemod.entity.custom.RaccoonEntity; | ||
import net.minecraft.util.Identifier; | ||
import software.bernie.geckolib3.core.event.predicate.AnimationEvent; | ||
import software.bernie.geckolib3.core.processor.IBone; | ||
import software.bernie.geckolib3.model.AnimatedGeoModel; | ||
import software.bernie.geckolib3.model.provider.data.EntityModelData; | ||
|
||
public class RaccoonModel extends AnimatedGeoModel<RaccoonEntity> { | ||
|
||
@Override | ||
public Identifier getModelLocation(RaccoonEntity object) { | ||
return new Identifier(NylemodExample.MOD_ID, "geo/raccoon.geo.json"); | ||
} | ||
|
||
@Override | ||
public Identifier getTextureLocation(RaccoonEntity object) { | ||
return RaccoonRenderer.LOCATION_BY_VARIANT.get(object.getVariant()); | ||
} | ||
|
||
@Override | ||
public Identifier getAnimationFileLocation(RaccoonEntity animatable) { | ||
return new Identifier(NylemodExample.MOD_ID, "animations/raccoon.animation.json"); | ||
} | ||
|
||
@SuppressWarnings({ "unchecked", "rawtypes" }) | ||
@Override | ||
public void setLivingAnimations(RaccoonEntity entity, Integer uniqueID, AnimationEvent customPredicate) { | ||
super.setLivingAnimations(entity, uniqueID, customPredicate); | ||
IBone head = this.getAnimationProcessor().getBone("head"); | ||
|
||
EntityModelData extraData = (EntityModelData) customPredicate.getExtraDataOfType(EntityModelData.class).get(0); | ||
if (head != null) { | ||
head.setRotationX(extraData.headPitch * ((float) Math.PI / 180F)); | ||
head.setRotationY(extraData.netHeadYaw * ((float) Math.PI / 180F)); | ||
} | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
src/main/java/me/nylestroke/nylemod/entity/client/RaccoonRenderer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package me.nylestroke.nylemod.entity.client; | ||
|
||
import com.google.common.collect.Maps; | ||
import me.nylestroke.nylemod.NylemodExample; | ||
import me.nylestroke.nylemod.entity.custom.RaccoonEntity; | ||
import me.nylestroke.nylemod.entity.variant.RaccoonVariant; | ||
import net.minecraft.client.render.RenderLayer; | ||
import net.minecraft.client.render.VertexConsumer; | ||
import net.minecraft.client.render.VertexConsumerProvider; | ||
import net.minecraft.client.render.entity.EntityRendererFactory; | ||
import net.minecraft.client.util.math.MatrixStack; | ||
import net.minecraft.util.Identifier; | ||
import net.minecraft.util.Util; | ||
import software.bernie.geckolib3.renderers.geo.GeoEntityRenderer; | ||
|
||
import java.util.Map; | ||
|
||
public class RaccoonRenderer extends GeoEntityRenderer<RaccoonEntity> { | ||
|
||
public RaccoonRenderer(EntityRendererFactory.Context ctx) { | ||
super(ctx, new RaccoonModel()); | ||
} | ||
|
||
public static final Map<RaccoonVariant, Identifier> LOCATION_BY_VARIANT = | ||
Util.make(Maps.newEnumMap(RaccoonVariant.class), (map) -> { | ||
map.put(RaccoonVariant.DEFAULT, | ||
new Identifier(NylemodExample.MOD_ID, "textures/entity/raccoon/raccoon.png")); | ||
map.put(RaccoonVariant.DARK, | ||
new Identifier(NylemodExample.MOD_ID, "textures/entity/raccoon/raccoondark.png")); | ||
map.put(RaccoonVariant.RED, | ||
new Identifier(NylemodExample.MOD_ID, "textures/entity/raccoon/redraccoon.png")); | ||
}); | ||
|
||
@Override | ||
public Identifier getTextureLocation(RaccoonEntity instance) { | ||
return LOCATION_BY_VARIANT.get(instance.getVariant()); | ||
} | ||
|
||
@Override | ||
public RenderLayer getRenderType(RaccoonEntity animatable, float partialTicks, MatrixStack stack, | ||
VertexConsumerProvider renderTypeBuffer, VertexConsumer vertexBuilder, | ||
int packedLightIn, Identifier textureLocation) { | ||
|
||
if (animatable.isBaby()) { | ||
stack.scale(0.5f, 0.5f, 0.5f); | ||
} else { | ||
stack.scale(1f, 1f, 1f); | ||
} | ||
|
||
return super.getRenderType(animatable, partialTicks, stack, renderTypeBuffer, | ||
vertexBuilder, packedLightIn, textureLocation); | ||
} | ||
} |
Oops, something went wrong.