diff --git a/src/main/java/com/starfish_studios/seasons_greetings/SeasonsGreetings.java b/src/main/java/com/starfish_studios/seasons_greetings/SeasonsGreetings.java index e4cdf43..87958e9 100644 --- a/src/main/java/com/starfish_studios/seasons_greetings/SeasonsGreetings.java +++ b/src/main/java/com/starfish_studios/seasons_greetings/SeasonsGreetings.java @@ -17,6 +17,11 @@ public static ResourceLocation id(String name) { return ResourceLocation.fromNamespaceAndPath(MOD_ID, name); } + + public static int getColor(int rgb) { + return (255 << 24) | rgb; + } + public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID); @Override diff --git a/src/main/java/com/starfish_studios/seasons_greetings/block/HotCocoaCauldronBlock.java b/src/main/java/com/starfish_studios/seasons_greetings/block/HotCocoaCauldronBlock.java index 46c8275..89f0a13 100644 --- a/src/main/java/com/starfish_studios/seasons_greetings/block/HotCocoaCauldronBlock.java +++ b/src/main/java/com/starfish_studios/seasons_greetings/block/HotCocoaCauldronBlock.java @@ -2,6 +2,7 @@ import com.mojang.serialization.MapCodec; import com.starfish_studios.seasons_greetings.registry.*; +import net.fabricmc.fabric.api.block.BlockPickInteractionAware; import net.minecraft.ChatFormatting; import net.minecraft.core.BlockPos; import net.minecraft.core.cauldron.CauldronInteraction; @@ -15,6 +16,7 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; +import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.AbstractCauldronBlock; import net.minecraft.world.level.block.Block; @@ -23,9 +25,10 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.HitResult; import org.jetbrains.annotations.NotNull; -public class HotCocoaCauldronBlock extends AbstractCauldronBlock { +public class HotCocoaCauldronBlock extends AbstractCauldronBlock implements BlockPickInteractionAware { @Override protected MapCodec codec() { @@ -41,6 +44,10 @@ public HotCocoaCauldronBlock(Properties properties, CauldronInteraction.Interact return InteractionResult.PASS; } + @Override + public ItemStack getPickedStack(BlockState blockState, BlockGetter blockGetter, BlockPos blockPos, Player player, HitResult hitResult) { + return new ItemStack((Items.CAULDRON)); + } @Override protected void createBlockStateDefinition(StateDefinition.Builder stateDefinition) { diff --git a/src/main/java/com/starfish_studios/seasons_greetings/block/MilkCauldronBlock.java b/src/main/java/com/starfish_studios/seasons_greetings/block/MilkCauldronBlock.java index 03a2b76..393e174 100644 --- a/src/main/java/com/starfish_studios/seasons_greetings/block/MilkCauldronBlock.java +++ b/src/main/java/com/starfish_studios/seasons_greetings/block/MilkCauldronBlock.java @@ -2,6 +2,7 @@ import com.mojang.serialization.MapCodec; import com.starfish_studios.seasons_greetings.registry.*; +import net.fabricmc.fabric.api.block.BlockPickInteractionAware; import net.minecraft.core.BlockPos; import net.minecraft.core.cauldron.CauldronInteraction; import net.minecraft.sounds.SoundEvents; @@ -13,6 +14,7 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; +import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.AbstractCauldronBlock; import net.minecraft.world.level.block.Block; @@ -21,9 +23,12 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.HitResult; import org.jetbrains.annotations.NotNull; -public class MilkCauldronBlock extends AbstractCauldronBlock { +import javax.swing.text.html.BlockView; + +public class MilkCauldronBlock extends AbstractCauldronBlock implements BlockPickInteractionAware { @Override protected MapCodec codec() { @@ -44,6 +49,11 @@ protected void createBlockStateDefinition(StateDefinition.Builder + tintIndex > 0 ? -1 : DyedItemColor.getOrDefault(stack, getColor(Color.WHITE.argbInt())), + SGItems.CHRISTMAS_HAT + ); + + ItemProperties.register(SGItems.RED_GIFT_BOX, SeasonsGreetings.id("bow_color"), (stack, world, entity, num) -> { CustomData customData = stack.get(DataComponents.BLOCK_ENTITY_DATA); String variantString = "bow"; diff --git a/src/main/java/com/starfish_studios/seasons_greetings/client/model/ChristmasHatModel.java b/src/main/java/com/starfish_studios/seasons_greetings/client/model/ChristmasHatModel.java new file mode 100644 index 0000000..e3f4931 --- /dev/null +++ b/src/main/java/com/starfish_studios/seasons_greetings/client/model/ChristmasHatModel.java @@ -0,0 +1,50 @@ +package com.starfish_studios.seasons_greetings.client.model; + +import com.starfish_studios.seasons_greetings.SeasonsGreetings; +import com.starfish_studios.seasons_greetings.item.ChristmasHatItem; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.Mth; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.player.Player; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.cache.object.GeoBone; +import software.bernie.geckolib.constant.DataTickets; +import software.bernie.geckolib.model.GeoModel; + +public class ChristmasHatModel extends GeoModel { + + @Override + public ResourceLocation getModelResource(ChristmasHatItem enchantmentRobeItem) { + return SeasonsGreetings.id("geo/armor/christmas_hat.geo.json"); + } + + @Override + public ResourceLocation getTextureResource(ChristmasHatItem enchantmentRobeItem) { + return SeasonsGreetings.id("textures/models/armor/christmas_hat.png"); + } + + @Override + public ResourceLocation getAnimationResource(ChristmasHatItem enchantmentRobeItem) { + return SeasonsGreetings.id("animations/christmas_hat.animation.json"); + } + + @Override + public void setCustomAnimations(ChristmasHatItem animatable, long instanceId, AnimationState animationState) { + + super.setCustomAnimations(animatable, instanceId, animationState); + if (animationState == null) return; + + GeoBone hatTip = this.getAnimationProcessor().getBone("poof"); + GeoBone hatBase = this.getAnimationProcessor().getBone("root"); + + Entity entity = animationState.getData(DataTickets.ENTITY); + + if (entity instanceof Player playerEntity) { + hatBase.setRotX(Mth.lerp(animationState.getPartialTick(), playerEntity.oBob, playerEntity.bob) * -0.25F); + + hatTip.setRotX((Mth.lerp(animationState.getPartialTick(), playerEntity.oBob, playerEntity.bob) * -2F) + + (float) (Mth.lerp(animationState.getPartialTick(), playerEntity.yCloakO, playerEntity.yCloak) + - Mth.lerp(animationState.getPartialTick(), playerEntity.yo, playerEntity.getY())) / -4); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/starfish_studios/seasons_greetings/client/renderer/ChristmasHatRenderer.java b/src/main/java/com/starfish_studios/seasons_greetings/client/renderer/ChristmasHatRenderer.java new file mode 100644 index 0000000..f87b7f8 --- /dev/null +++ b/src/main/java/com/starfish_studios/seasons_greetings/client/renderer/ChristmasHatRenderer.java @@ -0,0 +1,34 @@ +package com.starfish_studios.seasons_greetings.client.renderer; + +import com.starfish_studios.seasons_greetings.client.model.ChristmasHatModel; +import com.starfish_studios.seasons_greetings.client.renderer.layers.ChristmasHatOverlay; +import com.starfish_studios.seasons_greetings.item.ChristmasHatItem; +import net.minecraft.world.entity.Entity; +import org.jetbrains.annotations.NotNull; +import software.bernie.geckolib.cache.object.GeoBone; +import software.bernie.geckolib.renderer.specialty.DyeableGeoArmorRenderer; +import software.bernie.geckolib.util.Color; + +public class ChristmasHatRenderer extends DyeableGeoArmorRenderer { + + public ChristmasHatRenderer() { + super(new ChristmasHatModel()); + this.addRenderLayer(new ChristmasHatOverlay(this)); + } + + @Override + protected boolean isBoneDyeable(GeoBone geoBone) { + return true; + } + + @Override + protected @NotNull Color getColorForBone(GeoBone bone) { + return Color.WHITE; + } + + @Override + public void setupAnim(Entity entity, float f, float g, float h, float i, float j) { + + + } +} diff --git a/src/main/java/com/starfish_studios/seasons_greetings/client/renderer/GingerbreadManRenderer.java b/src/main/java/com/starfish_studios/seasons_greetings/client/renderer/GingerbreadManRenderer.java index f461076..be93996 100644 --- a/src/main/java/com/starfish_studios/seasons_greetings/client/renderer/GingerbreadManRenderer.java +++ b/src/main/java/com/starfish_studios/seasons_greetings/client/renderer/GingerbreadManRenderer.java @@ -44,11 +44,11 @@ protected ItemDisplayContext getTransformTypeForStack(GeoBone bone, ItemStack st @Override protected void renderStackForBone(PoseStack poseStack, GeoBone bone, ItemStack stack, GingerbreadMan animatable, MultiBufferSource bufferSource, float partialTick, int packedLight, int packedOverlay) { - poseStack.mulPose(Axis.XP.rotationDegrees(-75)); + poseStack.mulPose(Axis.XP.rotationDegrees(-60)); poseStack.mulPose(Axis.YP.rotationDegrees(0)); poseStack.mulPose(Axis.ZP.rotationDegrees(0)); - poseStack.scale(0.8F, 0.8F, 0.8F); - poseStack.translate(0.0D, -0.1D, -0.125D); + poseStack.scale(0.7F, 0.7F, 0.7F); + poseStack.translate(0.0D, 0.1D, -0.15D); super.renderStackForBone(poseStack, bone, stack, animatable, bufferSource, partialTick, packedLight, packedOverlay); diff --git a/src/main/java/com/starfish_studios/seasons_greetings/client/renderer/layers/ChristmasHatOverlay.java b/src/main/java/com/starfish_studios/seasons_greetings/client/renderer/layers/ChristmasHatOverlay.java new file mode 100644 index 0000000..3f056fa --- /dev/null +++ b/src/main/java/com/starfish_studios/seasons_greetings/client/renderer/layers/ChristmasHatOverlay.java @@ -0,0 +1,29 @@ +package com.starfish_studios.seasons_greetings.client.renderer.layers; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import com.starfish_studios.seasons_greetings.SeasonsGreetings; +import com.starfish_studios.seasons_greetings.item.ChristmasHatItem; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.resources.ResourceLocation; +import org.jetbrains.annotations.Nullable; +import software.bernie.geckolib.cache.object.BakedGeoModel; +import software.bernie.geckolib.renderer.GeoRenderer; +import software.bernie.geckolib.renderer.layer.GeoRenderLayer; +import software.bernie.geckolib.util.Color; + +public class ChristmasHatOverlay extends GeoRenderLayer { + private static final ResourceLocation TEXTURE = SeasonsGreetings.id("textures/models/armor/christmas_hat_overlay.png"); + + public ChristmasHatOverlay(GeoRenderer entityRenderer) { + super(entityRenderer); + } + + @Override + public void render(PoseStack poseStack, ChristmasHatItem animatable, BakedGeoModel bakedModel, @Nullable RenderType renderType, MultiBufferSource bufferSource, @Nullable VertexConsumer buffer, float partialTick, int packedLight, int packedOverlay) { + RenderType armorRenderType = RenderType.armorCutoutNoCull(TEXTURE); + getRenderer().reRender(bakedModel, poseStack, bufferSource, animatable, armorRenderType, + bufferSource.getBuffer(armorRenderType), partialTick, packedLight, packedOverlay, Color.WHITE.argbInt()); + } +} diff --git a/src/main/java/com/starfish_studios/seasons_greetings/entity/GingerbreadMan.java b/src/main/java/com/starfish_studios/seasons_greetings/entity/GingerbreadMan.java index d542a2b..cb0db32 100644 --- a/src/main/java/com/starfish_studios/seasons_greetings/entity/GingerbreadMan.java +++ b/src/main/java/com/starfish_studios/seasons_greetings/entity/GingerbreadMan.java @@ -1,14 +1,21 @@ package com.starfish_studios.seasons_greetings.entity; import com.starfish_studios.seasons_greetings.registry.SGSoundEvents; -import net.minecraft.advancements.critereon.EntityPredicate; +import net.minecraft.core.Holder; +import net.minecraft.core.Registry; +import net.minecraft.core.RegistryAccess; +import net.minecraft.core.component.DataComponents; +import net.minecraft.core.registries.Registries; import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.syncher.EntityDataAccessor; +import net.minecraft.network.syncher.EntityDataSerializers; +import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; -import net.minecraft.tags.ItemTags; -import net.minecraft.util.RandomSource; +import net.minecraft.util.TimeUtil; +import net.minecraft.util.valueproviders.UniformInt; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; @@ -16,37 +23,42 @@ import net.minecraft.world.entity.*; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; -import net.minecraft.world.entity.ai.behavior.BehaviorUtils; import net.minecraft.world.entity.ai.goal.*; -import net.minecraft.world.entity.ai.goal.target.OwnerHurtByTargetGoal; -import net.minecraft.world.entity.ai.goal.target.OwnerHurtTargetGoal; -import net.minecraft.world.entity.ai.goal.target.ResetUniversalAngerTargetGoal; +import net.minecraft.world.entity.ai.goal.target.*; +import net.minecraft.world.entity.animal.WolfVariant; +import net.minecraft.world.entity.animal.WolfVariants; import net.minecraft.world.entity.animal.horse.AbstractHorse; import net.minecraft.world.entity.decoration.ArmorStand; -import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.monster.Creeper; import net.minecraft.world.entity.monster.Ghast; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; +import net.minecraft.world.food.FoodProperties; +import net.minecraft.world.item.*; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.item.enchantment.EnchantmentEffectComponents; +import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.level.Level; import net.minecraft.world.level.ServerLevelAccessor; -import net.minecraft.world.level.block.Block; import net.minecraft.world.level.pathfinder.PathType; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import software.bernie.geckolib.animatable.GeoAnimatable; import software.bernie.geckolib.animatable.GeoEntity; import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; import software.bernie.geckolib.animation.*; import software.bernie.geckolib.animation.AnimationState; import software.bernie.geckolib.util.GeckoLibUtil; -import java.util.EnumSet; -import java.util.Iterator; import java.util.Objects; +import java.util.Optional; +import java.util.UUID; + +public class GingerbreadMan extends TamableAnimal implements GeoEntity, NeutralMob { + + private static final EntityDataAccessor DATA_REMAINING_ANGER_TIME = SynchedEntityData.defineId(GingerbreadMan.class, EntityDataSerializers.INT); + private static final UniformInt PERSISTENT_ANGER_TIME = TimeUtil.rangeOfSeconds(20, 39); + @Nullable + private UUID persistentAngerTarget; -public class GingerbreadMan extends TamableAnimal implements GeoEntity { protected static final RawAnimation IDLE = RawAnimation.begin().thenLoop("animation.gingerbread_man.idle"); protected static final RawAnimation WALK = RawAnimation.begin().thenLoop("animation.gingerbread_man.walk"); protected static final RawAnimation WALK_ITEM = RawAnimation.begin().thenLoop("animation.gingerbread_man.walk_item"); @@ -65,33 +77,50 @@ public GingerbreadMan(EntityType entityType, Level leve this.setPathfindingMalus(PathType.DANGER_POWDER_SNOW, -1.0F); } -// @Override -// public boolean canPickUpLoot() { -// return true; -// } - -// @Override -// public void onItemPickup(ItemEntity itemEntity) { -// ItemStack itemStack = itemEntity.getItem(); -// if (this.getMainHandItem().isEmpty()) { -// this.setItemInHand(InteractionHand.MAIN_HAND, itemStack.copy()); -// itemEntity.discard(); -// } -// super.onItemPickup(itemEntity); -// } + protected void defineSynchedData(SynchedEntityData.Builder builder) { + super.defineSynchedData(builder); + builder.define(DATA_REMAINING_ANGER_TIME, 0); + } + + public void addAdditionalSaveData(CompoundTag compoundTag) { + super.addAdditionalSaveData(compoundTag); + if (this.persistentAngerTarget != null) { + compoundTag.putUUID("AngerTarget", this.persistentAngerTarget); + } + compoundTag.putInt("AngerTime", this.getRemainingPersistentAngerTime()); + } + + public void readAdditionalSaveData(CompoundTag compoundTag) { + super.readAdditionalSaveData(compoundTag); + this.persistentAngerTarget = compoundTag.hasUUID("AngerTarget") ? compoundTag.getUUID("AngerTarget") : null; + if (compoundTag.contains("AngerTime")) { + this.setRemainingPersistentAngerTime(compoundTag.getInt("AngerTime")); + } + } private void removeInteractionItem(Player player, ItemStack itemStack) { itemStack.consume(1, player); } - // mobInteract + @Override + public void aiStep() { + if (!this.level().isClientSide) { + if (this.isOrderedToSit()) { + this.setDeltaMovement(0.0D, 0.0D, 0.0D); + this.navigation.stop(); + this.setTarget(null); + } + } + super.aiStep(); + } + @Override public @NotNull InteractionResult mobInteract(Player player, InteractionHand hand) { ItemStack itemStack = player.getItemInHand(hand); ItemStack itemStack2 = this.getMainHandItem(); InteractionResult interactionResult = super.mobInteract(player, hand); - if (!interactionResult.consumesAction() && this.isOwnedBy(player)) { + if (!interactionResult.consumesAction() && player.isCrouching() || !interactionResult.consumesAction() && !player.isCrouching() && itemStack2.isEmpty() && itemStack.isEmpty()) { this.setOrderedToSit(!this.isOrderedToSit()); this.jumping = false; this.navigation.stop(); @@ -99,19 +128,42 @@ private void removeInteractionItem(Player player, ItemStack itemStack) { return InteractionResult.SUCCESS_NO_ITEM_USED; } - if (itemStack2.isEmpty() && !itemStack.isEmpty()) { - ItemStack itemStack3 = itemStack.copyWithCount(1); - this.setItemInHand(InteractionHand.MAIN_HAND, itemStack3); - this.removeInteractionItem(player, itemStack); - this.level().playSound(player, this, SoundEvents.CHICKEN_EGG, SoundSource.NEUTRAL, 2.0F, 1.0F); - return InteractionResult.SUCCESS; - } else if (!itemStack2.isEmpty() && hand == InteractionHand.MAIN_HAND && itemStack.isEmpty()) { - this.setItemSlot(EquipmentSlot.MAINHAND, ItemStack.EMPTY); - this.level().playSound(player, this, SoundEvents.ITEM_PICKUP, SoundSource.NEUTRAL, 2.0F, 1.0F); - player.addItem(itemStack2); - return InteractionResult.SUCCESS; + if (this.isOwnedBy(player)) { + if (itemStack2.isEmpty() && !itemStack.isEmpty()) { + ItemStack itemStack3 = itemStack.copyWithCount(1); + this.setItemInHand(InteractionHand.MAIN_HAND, itemStack3); + this.removeInteractionItem(player, itemStack); + this.level().playSound(player, this, SoundEvents.CHICKEN_EGG, SoundSource.NEUTRAL, 2.0F, 1.0F); + return InteractionResult.sidedSuccess(this.level().isClientSide()); + } else if (!itemStack2.isEmpty() && hand == InteractionHand.MAIN_HAND && itemStack.isEmpty()) { + this.setItemSlot(EquipmentSlot.MAINHAND, ItemStack.EMPTY); + this.level().playSound(player, this, SoundEvents.ITEM_PICKUP, SoundSource.NEUTRAL, 2.0F, 1.0F); + player.addItem(itemStack2); + return InteractionResult.sidedSuccess(this.level().isClientSide()); + } } - return InteractionResult.PASS; + return interactionResult; + } + + public int getRemainingPersistentAngerTime() { + return this.entityData.get(DATA_REMAINING_ANGER_TIME); + } + + public void setRemainingPersistentAngerTime(int i) { + this.entityData.set(DATA_REMAINING_ANGER_TIME, i); + } + + public void startPersistentAngerTimer() { + this.setRemainingPersistentAngerTime(PERSISTENT_ANGER_TIME.sample(this.random)); + } + + @Nullable + public UUID getPersistentAngerTarget() { + return this.persistentAngerTarget; + } + + public void setPersistentAngerTarget(@Nullable UUID uUID) { + this.persistentAngerTarget = uUID; } @@ -149,23 +201,24 @@ public static AttributeSupplier.Builder createAttributes() { } protected void registerGoals() { - this.goalSelector.addGoal(0, new FloatGoal(this)); - - this.goalSelector.addGoal(1, new PanicGoal(this, 1.25)); + this.goalSelector.addGoal(1, new FloatGoal(this)); + this.goalSelector.addGoal(1, new TamableAnimal.TamableAnimalPanicGoal(1.5)); this.goalSelector.addGoal(2, new SitWhenOrderedToGoal(this)); - this.goalSelector.addGoal(3, new MeleeAttackGoal(this, 1.0, true)); - - this.goalSelector.addGoal(4, new FollowOwnerGoal(this, 1.25, 10.0F, 2.0F)); - this.goalSelector.addGoal(5, new AvoidEatingPlayerGoal(this, 8.0, 1.0, 1.2)); - - this.goalSelector.addGoal(6, new TemptGoal(this, 1.2, (itemStack) -> itemStack.is(Items.COOKIE), false)); - this.goalSelector.addGoal(7, new CopyOwnerBreakGoal(this, 1.0)); - this.goalSelector.addGoal(8, new WaterAvoidingRandomStrollGoal(this, 1.0)); - this.goalSelector.addGoal(9, new LookAtPlayerGoal(this, Player.class, 6.0F)); - this.goalSelector.addGoal(10, new RandomLookAroundGoal(this)); + this.goalSelector.addGoal(3, new AvoidEatingPlayerGoal(this, 8.0, 1.0, 1.2)); + this.goalSelector.addGoal(4, new TemptGoal(this, 1.2, (itemStack) -> itemStack.is(Items.COOKIE), false)); + this.goalSelector.addGoal(5, new CopyOwnerBreakGoal(this, 1.0)); + this.goalSelector.addGoal(6, new FollowOwnerGoal(this, 1.0, 10.0F, 2.0F)); + this.goalSelector.addGoal(8, new LeapAtTargetGoal(this, 0.3F)); + this.goalSelector.addGoal(9, new MeleeAttackGoal(this, 1.0, true)); + this.goalSelector.addGoal(11, new WaterAvoidingRandomStrollGoal(this, 0.8, 1.0000001E-5F)); + this.goalSelector.addGoal(12, new LookAtPlayerGoal(this, Player.class, 10.0F)); + this.goalSelector.addGoal(13, new RandomLookAroundGoal(this)); this.targetSelector.addGoal(1, new OwnerHurtByTargetGoal(this)); this.targetSelector.addGoal(2, new OwnerHurtTargetGoal(this)); + this.targetSelector.addGoal(3, (new HurtByTargetGoal(this)).setAlertOthers()); + this.targetSelector.addGoal(4, new NearestAttackableTargetGoal<>(this, Player.class, 10, true, false, this::isAngryAt)); + this.targetSelector.addGoal(8, new ResetUniversalAngerTargetGoal<>(this, true)); } public boolean hurt(DamageSource damageSource, float f) { diff --git a/src/main/java/com/starfish_studios/seasons_greetings/inventory/GiftBoxMenu.java b/src/main/java/com/starfish_studios/seasons_greetings/inventory/GiftBoxMenu.java index 09f65d7..2cfcbc0 100644 --- a/src/main/java/com/starfish_studios/seasons_greetings/inventory/GiftBoxMenu.java +++ b/src/main/java/com/starfish_studios/seasons_greetings/inventory/GiftBoxMenu.java @@ -1,8 +1,3 @@ -// -// Source code recreated from a .class file by IntelliJ IDEA -// (powered by FernFlower decompiler) -// - package com.starfish_studios.seasons_greetings.inventory; import com.starfish_studios.seasons_greetings.registry.SGMenus; diff --git a/src/main/java/com/starfish_studios/seasons_greetings/item/ChristmasHatItem.java b/src/main/java/com/starfish_studios/seasons_greetings/item/ChristmasHatItem.java new file mode 100644 index 0000000..7136557 --- /dev/null +++ b/src/main/java/com/starfish_studios/seasons_greetings/item/ChristmasHatItem.java @@ -0,0 +1,49 @@ +package com.starfish_studios.seasons_greetings.item; + +import com.starfish_studios.seasons_greetings.client.renderer.ChristmasHatRenderer; +import net.minecraft.client.model.HumanoidModel; +import net.minecraft.core.Holder; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.ArmorItem; +import net.minecraft.world.item.ArmorMaterial; +import net.minecraft.world.item.ItemStack; +import org.jetbrains.annotations.Nullable; +import software.bernie.geckolib.animatable.GeoItem; +import software.bernie.geckolib.animatable.client.GeoRenderProvider; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.RawAnimation; +import software.bernie.geckolib.util.GeckoLibUtil; + +import java.util.function.Consumer; + +public class ChristmasHatItem extends ArmorItem implements GeoItem { + private final AnimatableInstanceCache geoCache = GeckoLibUtil.createInstanceCache(this); + + public ChristmasHatItem(Holder holder, Type type, Properties properties) { + super(holder, type, properties); + } + + @Override + public void createGeoRenderer(Consumer consumer) { + consumer.accept(new GeoRenderProvider() { + private ChristmasHatRenderer renderer; + @Override + public HumanoidModel getGeoArmorRenderer(@Nullable T livingEntity, ItemStack itemStack, @Nullable EquipmentSlot equipmentSlot, @Nullable HumanoidModel original) { + if (this.renderer == null) + this.renderer = new ChristmasHatRenderer(); + return this.renderer; + } + }); + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllers) { + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return geoCache; + } +} \ No newline at end of file diff --git a/src/main/java/com/starfish_studios/seasons_greetings/mixin/ItemEntityMixin.java b/src/main/java/com/starfish_studios/seasons_greetings/mixin/ItemEntityMixin.java index 1301fe6..300f21a 100644 --- a/src/main/java/com/starfish_studios/seasons_greetings/mixin/ItemEntityMixin.java +++ b/src/main/java/com/starfish_studios/seasons_greetings/mixin/ItemEntityMixin.java @@ -77,7 +77,7 @@ private void shrinkItemStack(ItemEntity itemEntity, Level level, BlockPos blockP if (level.getBlockState(blockPos).is(SGBlocks.MILK_CAULDRON) && level.getBlockState(blockPos).getValue(LayeredCauldronBlock.LEVEL) == 3) { - if (level.getBlockState(blockPos.below()).is(Blocks.FIRE) || level.getBlockState(blockPos.below()).is(Blocks.LAVA)) { + if (level.getBlockState(blockPos.below()).is(SGTags.SGBlockTags.HEAT_SOURCES)) { if (itemStack.is(SGItems.CHOCOLATE)) { level.setBlockAndUpdate(blockPos, SGBlocks.HOT_COCOA_CAULDRON.defaultBlockState().setValue(LayeredCauldronBlock.LEVEL, 3)); diff --git a/src/main/java/com/starfish_studios/seasons_greetings/mixin/SnowGolemMixin.java b/src/main/java/com/starfish_studios/seasons_greetings/mixin/SnowGolemMixin.java index d1f74ef..659863c 100644 --- a/src/main/java/com/starfish_studios/seasons_greetings/mixin/SnowGolemMixin.java +++ b/src/main/java/com/starfish_studios/seasons_greetings/mixin/SnowGolemMixin.java @@ -95,6 +95,7 @@ public void mobInteract(Player player, InteractionHand interactionHand, Callback if (itemStack.is(SGTags.SGItemTags.SNOW_GOLEM_NOSES) && !snowGolem.hasPumpkin() && snowGolem.getItemBySlot(EquipmentSlot.HEAD).isEmpty()) { snowSound(SoundEvents.SNOW_PLACE); snowGolem.setItemSlot(EquipmentSlot.HEAD, new ItemStack(itemStack.getItem())); + itemStack.shrink(1); cir.setReturnValue(InteractionResult.SUCCESS); } @@ -102,6 +103,7 @@ public void mobInteract(Player player, InteractionHand interactionHand, Callback if (itemStack.is(Items.CARVED_PUMPKIN) && !snowGolem.hasPumpkin() && snowGolem.getItemBySlot(EquipmentSlot.HEAD).isEmpty()) { snowSound(SoundEvents.SNOW_PLACE); snowGolem.setPumpkin(true); + itemStack.shrink(1); cir.setReturnValue(InteractionResult.SUCCESS); } @@ -124,6 +126,7 @@ public void mobInteract(Player player, InteractionHand interactionHand, Callback if (itemStack.is(ItemTags.WOOL_CARPETS) && snowGolem.getItemBySlot(EquipmentSlot.BODY).isEmpty()) { snowGolem.setItemSlot(EquipmentSlot.BODY, new ItemStack(itemStack.getItem())); + itemStack.shrink(1); cir.setReturnValue(InteractionResult.SUCCESS); } } diff --git a/src/main/java/com/starfish_studios/seasons_greetings/mixin/SnowGolemModelMixin.java b/src/main/java/com/starfish_studios/seasons_greetings/mixin/SnowGolemModelMixin.java index 1295c36..438aac9 100644 --- a/src/main/java/com/starfish_studios/seasons_greetings/mixin/SnowGolemModelMixin.java +++ b/src/main/java/com/starfish_studios/seasons_greetings/mixin/SnowGolemModelMixin.java @@ -28,15 +28,12 @@ public abstract class SnowGolemModelMixin extends Hierarchical private final ModelPart leftArm; @Unique private final ModelPart rightArm; - @Unique - private final ModelPart nose; public SnowGolemModelMixin(ModelPart modelPart) { this.head = modelPart.getChild("head"); this.leftArm = modelPart.getChild("left_arm"); this.rightArm = modelPart.getChild("right_arm"); this.upperBody = modelPart.getChild("upper_body"); - this.nose = modelPart.getChild("carrot_nose"); } diff --git a/src/main/java/com/starfish_studios/seasons_greetings/mixin/SnowGolemRendererMixin.java b/src/main/java/com/starfish_studios/seasons_greetings/mixin/SnowGolemRendererMixin.java index da3ac0b..b09317f 100644 --- a/src/main/java/com/starfish_studios/seasons_greetings/mixin/SnowGolemRendererMixin.java +++ b/src/main/java/com/starfish_studios/seasons_greetings/mixin/SnowGolemRendererMixin.java @@ -5,15 +5,15 @@ import net.minecraft.client.model.SnowGolemModel; import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.client.renderer.entity.MobRenderer; +import net.minecraft.client.renderer.entity.RenderLayerParent; import net.minecraft.client.renderer.entity.SnowGolemRenderer; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.client.renderer.entity.layers.CustomHeadLayer; import net.minecraft.world.entity.animal.SnowGolem; -import org.jetbrains.annotations.NotNull; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(SnowGolemRenderer.class) public abstract class SnowGolemRendererMixin extends MobRenderer> { @@ -23,9 +23,10 @@ public SnowGolemRendererMixin(EntityRendererProvider.Context context, SnowGolemM @Inject(method = "", at = @At("TAIL")) private void addDecorLayer(EntityRendererProvider.Context context, CallbackInfo ci) { - this.addLayer((new SnowGolemNosesLayer(this))); + this.addLayer(new SnowGolemNosesLayer(this)); this.addLayer(new SnowGolemDecorLayer(this)); } + } diff --git a/src/main/java/com/starfish_studios/seasons_greetings/registry/SGBlocks.java b/src/main/java/com/starfish_studios/seasons_greetings/registry/SGBlocks.java index 3828f4e..ca2ea14 100644 --- a/src/main/java/com/starfish_studios/seasons_greetings/registry/SGBlocks.java +++ b/src/main/java/com/starfish_studios/seasons_greetings/registry/SGBlocks.java @@ -20,6 +20,16 @@ public class SGBlocks { public static final Block STRING_LIGHTS = registerBlock("string_lights", new WrappedBlock(Block.Properties.of().instabreak().noCollission().noOcclusion())); public static final Block WREATH = registerBlock("wreath", new WrappedBlock(Block.Properties.of().instabreak().noCollission().noOcclusion())); + // Snow Block Set : Packed Snow, Snow Bricks, Snow Brick Stairs, Snow Brick Slabs + public static final BlockBehaviour.Properties snowProperties = Block.Properties.of().strength(0.2F).sound(SoundType.SNOW); + + public static final Block PACKED_SNOW = registerBlock("packed_snow", new Block(snowProperties)); + public static final Block SNOW_BRICKS = registerBlock("snow_bricks", new Block(snowProperties)); + public static final Block SNOW_BRICK_STAIRS = registerBlock("snow_brick_stairs", new StairBlock(SNOW_BRICKS.defaultBlockState(), snowProperties)); + public static final Block SNOW_BRICK_SLAB = registerBlock("snow_brick_slab", new SlabBlock(snowProperties)); + public static final Block CHISELED_SNOW = registerBlock("chiseled_snow", new Block(snowProperties)); + + // region Gingerbread House Blocks // Gingerbread Block Set : Gingerbread, Gingerbread Stairs, Gingerbread Slabs, Gingerbread Bricks, Gingerbread Brick Stairs, Gingerbread Brick Slabs, diff --git a/src/main/java/com/starfish_studios/seasons_greetings/registry/SGCreativeTabs.java b/src/main/java/com/starfish_studios/seasons_greetings/registry/SGCreativeTabs.java index c6b4a2f..0d5eb74 100644 --- a/src/main/java/com/starfish_studios/seasons_greetings/registry/SGCreativeTabs.java +++ b/src/main/java/com/starfish_studios/seasons_greetings/registry/SGCreativeTabs.java @@ -11,13 +11,18 @@ import net.minecraft.network.chat.Component; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.CreativeModeTabs; +import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; +import java.util.Objects; + import static com.starfish_studios.seasons_greetings.registry.SGItems.*; public class SGCreativeTabs { @SuppressWarnings("unused") public static final CreativeModeTab SEASONS_GREETINGS_TAB = register("item_group", FabricItemGroup.builder().icon(FRUITCAKE::getDefaultInstance).title(Component.translatable("itemGroup.seasonsgreetings.tab")).displayItems((featureFlagSet, output) -> { + output.accept(CHRISTMAS_HAT); + output.accept(FRUITCAKE); output.accept(GINGERBREAD_COOKIE); output.accept(GINGERBREAD_CRUMBS); @@ -28,6 +33,12 @@ public class SGCreativeTabs { output.accept(WARM_MILK_BOTTLE); output.accept(HOT_COCOA_BOTTLE); + output.accept(PACKED_SNOW); + output.accept(SNOW_BRICKS); + output.accept(SNOW_BRICK_STAIRS); + output.accept(SNOW_BRICK_SLAB); + output.accept(CHISELED_SNOW); + output.accept(RED_GUMDROP_BLOCK); output.accept(ORANGE_GUMDROP_BLOCK); output.accept(YELLOW_GUMDROP_BLOCK); diff --git a/src/main/java/com/starfish_studios/seasons_greetings/registry/SGItems.java b/src/main/java/com/starfish_studios/seasons_greetings/registry/SGItems.java index b785d74..c93d6e8 100644 --- a/src/main/java/com/starfish_studios/seasons_greetings/registry/SGItems.java +++ b/src/main/java/com/starfish_studios/seasons_greetings/registry/SGItems.java @@ -1,6 +1,7 @@ package com.starfish_studios.seasons_greetings.registry; import com.starfish_studios.seasons_greetings.SeasonsGreetings; +import com.starfish_studios.seasons_greetings.item.ChristmasHatItem; import com.starfish_studios.seasons_greetings.item.GiftBoxItem; import com.starfish_studios.seasons_greetings.item.HotCocoaBottleItem; import net.minecraft.core.Registry; @@ -12,6 +13,7 @@ import net.minecraft.world.level.block.StairBlock; public class SGItems { + public static final Item CHRISTMAS_HAT = registerItem("christmas_hat", new ChristmasHatItem(ArmorMaterials.LEATHER, ArmorItem.Type.HELMET, new Item.Properties())); // region Edible Items @@ -23,8 +25,6 @@ public class SGItems { .saturationModifier(0.1f) .build()))); - // Gingerbread Crumbs should drop 2-3 when broken, and 3-4 Crumbs with Fortune 3. - public static final Item GINGERBREAD_CRUMBS = registerItem("gingerbread_crumbs", new Item(new Item.Properties() .food(new FoodProperties.Builder() .nutrition(1) @@ -55,6 +55,12 @@ public class SGItems { public static final Item STRING_LIGHTS = registerItem("string_lights", new BlockItem(SGBlocks.STRING_LIGHTS, new Item.Properties())); public static final Item WREATH = registerItem("wreath", new BlockItem(SGBlocks.WREATH, new Item.Properties())); + public static final Item PACKED_SNOW = registerItem("packed_snow", new BlockItem(SGBlocks.PACKED_SNOW, new Item.Properties())); + public static final Item SNOW_BRICKS = registerItem("snow_bricks", new BlockItem(SGBlocks.SNOW_BRICKS, new Item.Properties())); + public static final Item SNOW_BRICK_STAIRS = registerItem("snow_brick_stairs", new BlockItem(SGBlocks.SNOW_BRICK_STAIRS, new Item.Properties())); + public static final Item SNOW_BRICK_SLAB = registerItem("snow_brick_slab", new BlockItem(SGBlocks.SNOW_BRICK_SLAB, new Item.Properties())); + public static final Item CHISELED_SNOW = registerItem("chiseled_snow", new BlockItem(SGBlocks.CHISELED_SNOW, new Item.Properties())); + // region Gifts public static final Item WHITE_GIFT_BOX = registerItem("white_gift_box", new GiftBoxItem(SGBlocks.WHITE_GIFT_BOX, new Item.Properties())); diff --git a/src/main/resources/assets/seasonsgreetings/animations/christmas_hat.animation.json b/src/main/resources/assets/seasonsgreetings/animations/christmas_hat.animation.json new file mode 100644 index 0000000..ac02ee8 --- /dev/null +++ b/src/main/resources/assets/seasonsgreetings/animations/christmas_hat.animation.json @@ -0,0 +1,9 @@ +{ + "format_version": "1.8.0", + "animations": { + "animation.christmas_hat.blank": { + "loop": true + } + }, + "geckolib_format_version": 2 +} \ No newline at end of file diff --git a/src/main/resources/assets/seasonsgreetings/blockstates/chiseled_snow.json b/src/main/resources/assets/seasonsgreetings/blockstates/chiseled_snow.json new file mode 100644 index 0000000..b8547cd --- /dev/null +++ b/src/main/resources/assets/seasonsgreetings/blockstates/chiseled_snow.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "seasonsgreetings:block/chiseled_snow" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/seasonsgreetings/blockstates/packed_snow.json b/src/main/resources/assets/seasonsgreetings/blockstates/packed_snow.json new file mode 100644 index 0000000..9a9dc9e --- /dev/null +++ b/src/main/resources/assets/seasonsgreetings/blockstates/packed_snow.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "seasonsgreetings:block/packed_snow" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/seasonsgreetings/blockstates/snow_brick_slab.json b/src/main/resources/assets/seasonsgreetings/blockstates/snow_brick_slab.json new file mode 100644 index 0000000..e0f9caf --- /dev/null +++ b/src/main/resources/assets/seasonsgreetings/blockstates/snow_brick_slab.json @@ -0,0 +1,13 @@ +{ + "variants": { + "type=bottom": { + "model": "seasonsgreetings:block/snow_brick_slab" + }, + "type=double": { + "model": "seasonsgreetings:block/snow_bricks" + }, + "type=top": { + "model": "seasonsgreetings:block/snow_brick_slab_top" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/seasonsgreetings/blockstates/snow_brick_stairs.json b/src/main/resources/assets/seasonsgreetings/blockstates/snow_brick_stairs.json new file mode 100644 index 0000000..ed0b9cc --- /dev/null +++ b/src/main/resources/assets/seasonsgreetings/blockstates/snow_brick_stairs.json @@ -0,0 +1,209 @@ +{ + "variants": { + "facing=east,half=bottom,shape=inner_left": { + "model": "seasonsgreetings:block/snow_brick_stairs_inner", + "uvlock": true, + "y": 270 + }, + "facing=east,half=bottom,shape=inner_right": { + "model": "seasonsgreetings:block/snow_brick_stairs_inner" + }, + "facing=east,half=bottom,shape=outer_left": { + "model": "seasonsgreetings:block/snow_brick_stairs_outer", + "uvlock": true, + "y": 270 + }, + "facing=east,half=bottom,shape=outer_right": { + "model": "seasonsgreetings:block/snow_brick_stairs_outer" + }, + "facing=east,half=bottom,shape=straight": { + "model": "seasonsgreetings:block/snow_brick_stairs" + }, + "facing=east,half=top,shape=inner_left": { + "model": "seasonsgreetings:block/snow_brick_stairs_inner", + "uvlock": true, + "x": 180 + }, + "facing=east,half=top,shape=inner_right": { + "model": "seasonsgreetings:block/snow_brick_stairs_inner", + "uvlock": true, + "x": 180, + "y": 90 + }, + "facing=east,half=top,shape=outer_left": { + "model": "seasonsgreetings:block/snow_brick_stairs_outer", + "uvlock": true, + "x": 180 + }, + "facing=east,half=top,shape=outer_right": { + "model": "seasonsgreetings:block/snow_brick_stairs_outer", + "uvlock": true, + "x": 180, + "y": 90 + }, + "facing=east,half=top,shape=straight": { + "model": "seasonsgreetings:block/snow_brick_stairs", + "uvlock": true, + "x": 180 + }, + "facing=north,half=bottom,shape=inner_left": { + "model": "seasonsgreetings:block/snow_brick_stairs_inner", + "uvlock": true, + "y": 180 + }, + "facing=north,half=bottom,shape=inner_right": { + "model": "seasonsgreetings:block/snow_brick_stairs_inner", + "uvlock": true, + "y": 270 + }, + "facing=north,half=bottom,shape=outer_left": { + "model": "seasonsgreetings:block/snow_brick_stairs_outer", + "uvlock": true, + "y": 180 + }, + "facing=north,half=bottom,shape=outer_right": { + "model": "seasonsgreetings:block/snow_brick_stairs_outer", + "uvlock": true, + "y": 270 + }, + "facing=north,half=bottom,shape=straight": { + "model": "seasonsgreetings:block/snow_brick_stairs", + "uvlock": true, + "y": 270 + }, + "facing=north,half=top,shape=inner_left": { + "model": "seasonsgreetings:block/snow_brick_stairs_inner", + "uvlock": true, + "x": 180, + "y": 270 + }, + "facing=north,half=top,shape=inner_right": { + "model": "seasonsgreetings:block/snow_brick_stairs_inner", + "uvlock": true, + "x": 180 + }, + "facing=north,half=top,shape=outer_left": { + "model": "seasonsgreetings:block/snow_brick_stairs_outer", + "uvlock": true, + "x": 180, + "y": 270 + }, + "facing=north,half=top,shape=outer_right": { + "model": "seasonsgreetings:block/snow_brick_stairs_outer", + "uvlock": true, + "x": 180 + }, + "facing=north,half=top,shape=straight": { + "model": "seasonsgreetings:block/snow_brick_stairs", + "uvlock": true, + "x": 180, + "y": 270 + }, + "facing=south,half=bottom,shape=inner_left": { + "model": "seasonsgreetings:block/snow_brick_stairs_inner" + }, + "facing=south,half=bottom,shape=inner_right": { + "model": "seasonsgreetings:block/snow_brick_stairs_inner", + "uvlock": true, + "y": 90 + }, + "facing=south,half=bottom,shape=outer_left": { + "model": "seasonsgreetings:block/snow_brick_stairs_outer" + }, + "facing=south,half=bottom,shape=outer_right": { + "model": "seasonsgreetings:block/snow_brick_stairs_outer", + "uvlock": true, + "y": 90 + }, + "facing=south,half=bottom,shape=straight": { + "model": "seasonsgreetings:block/snow_brick_stairs", + "uvlock": true, + "y": 90 + }, + "facing=south,half=top,shape=inner_left": { + "model": "seasonsgreetings:block/snow_brick_stairs_inner", + "uvlock": true, + "x": 180, + "y": 90 + }, + "facing=south,half=top,shape=inner_right": { + "model": "seasonsgreetings:block/snow_brick_stairs_inner", + "uvlock": true, + "x": 180, + "y": 180 + }, + "facing=south,half=top,shape=outer_left": { + "model": "seasonsgreetings:block/snow_brick_stairs_outer", + "uvlock": true, + "x": 180, + "y": 90 + }, + "facing=south,half=top,shape=outer_right": { + "model": "seasonsgreetings:block/snow_brick_stairs_outer", + "uvlock": true, + "x": 180, + "y": 180 + }, + "facing=south,half=top,shape=straight": { + "model": "seasonsgreetings:block/snow_brick_stairs", + "uvlock": true, + "x": 180, + "y": 90 + }, + "facing=west,half=bottom,shape=inner_left": { + "model": "seasonsgreetings:block/snow_brick_stairs_inner", + "uvlock": true, + "y": 90 + }, + "facing=west,half=bottom,shape=inner_right": { + "model": "seasonsgreetings:block/snow_brick_stairs_inner", + "uvlock": true, + "y": 180 + }, + "facing=west,half=bottom,shape=outer_left": { + "model": "seasonsgreetings:block/snow_brick_stairs_outer", + "uvlock": true, + "y": 90 + }, + "facing=west,half=bottom,shape=outer_right": { + "model": "seasonsgreetings:block/snow_brick_stairs_outer", + "uvlock": true, + "y": 180 + }, + "facing=west,half=bottom,shape=straight": { + "model": "seasonsgreetings:block/snow_brick_stairs", + "uvlock": true, + "y": 180 + }, + "facing=west,half=top,shape=inner_left": { + "model": "seasonsgreetings:block/snow_brick_stairs_inner", + "uvlock": true, + "x": 180, + "y": 180 + }, + "facing=west,half=top,shape=inner_right": { + "model": "seasonsgreetings:block/snow_brick_stairs_inner", + "uvlock": true, + "x": 180, + "y": 270 + }, + "facing=west,half=top,shape=outer_left": { + "model": "seasonsgreetings:block/snow_brick_stairs_outer", + "uvlock": true, + "x": 180, + "y": 180 + }, + "facing=west,half=top,shape=outer_right": { + "model": "seasonsgreetings:block/snow_brick_stairs_outer", + "uvlock": true, + "x": 180, + "y": 270 + }, + "facing=west,half=top,shape=straight": { + "model": "seasonsgreetings:block/snow_brick_stairs", + "uvlock": true, + "x": 180, + "y": 180 + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/seasonsgreetings/blockstates/snow_bricks.json b/src/main/resources/assets/seasonsgreetings/blockstates/snow_bricks.json new file mode 100644 index 0000000..1303ed8 --- /dev/null +++ b/src/main/resources/assets/seasonsgreetings/blockstates/snow_bricks.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "seasonsgreetings:block/snow_bricks" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/seasonsgreetings/geo/armor/christmas_hat.geo.json b/src/main/resources/assets/seasonsgreetings/geo/armor/christmas_hat.geo.json new file mode 100644 index 0000000..e710762 --- /dev/null +++ b/src/main/resources/assets/seasonsgreetings/geo/armor/christmas_hat.geo.json @@ -0,0 +1,144 @@ +{ + "format_version": "1.21.0", + "minecraft:geometry": [ + { + "description": { + "identifier": "geometry.unknown", + "texture_width": 64, + "texture_height": 64, + "visible_bounds_width": 2, + "visible_bounds_height": 3.5, + "visible_bounds_offset": [0, 1.25, 0] + }, + "bones": [ + { + "name": "bipedHead", + "pivot": [0, 24, 0] + }, + { + "name": "armorHead", + "parent": "bipedHead", + "pivot": [0, 24, 0] + }, + { + "name": "root", + "parent": "armorHead", + "pivot": [9, 34, 11], + "cubes": [ + { + "origin": [-4, 30, -4], + "size": [8, 2, 8], + "inflate": 0.5, + "uv": { + "north": {"uv": [0, 19], "uv_size": [8, 2]}, + "east": {"uv": [24, 19], "uv_size": [8, 2]}, + "south": {"uv": [16, 19], "uv_size": [8, 2]}, + "west": {"uv": [8, 19], "uv_size": [8, 2]}, + "up": {"uv": [8, 11], "uv_size": [8, 8], "uv_rotation": 270}, + "down": {"uv": [16, 19], "uv_size": [8, -8], "uv_rotation": 90} + } + }, + { + "origin": [-4, 32, -4], + "size": [8, 3, 8], + "uv": { + "north": {"uv": [0, 8], "uv_size": [8, 3]}, + "east": {"uv": [24, 8], "uv_size": [8, 3]}, + "south": {"uv": [16, 8], "uv_size": [8, 3]}, + "west": {"uv": [8, 8], "uv_size": [8, 3]}, + "up": {"uv": [8, 0], "uv_size": [8, 8], "uv_rotation": 270}, + "down": {"uv": [16, 8], "uv_size": [8, -8], "uv_rotation": 90} + } + }, + { + "origin": [-2, 35, -1], + "size": [4, 3, 5], + "uv": { + "north": {"uv": [0, 25], "uv_size": [4, 3]}, + "east": {"uv": [13, 25], "uv_size": [5, 3]}, + "south": {"uv": [9, 25], "uv_size": [4, 3]}, + "west": {"uv": [4, 25], "uv_size": [5, 3]}, + "up": {"uv": [4, 21], "uv_size": [5, 4], "uv_rotation": 270}, + "down": {"uv": [9, 25], "uv_size": [5, -4], "uv_rotation": 90} + } + } + ] + }, + { + "name": "poof", + "parent": "root", + "pivot": [0, 37, 4], + "cubes": [ + { + "origin": [-2, 33, 4], + "size": [4, 4, 4], + "uv": { + "north": {"uv": [18, 25], "uv_size": [4, 4]}, + "east": {"uv": [30, 25], "uv_size": [4, 4]}, + "south": {"uv": [26, 25], "uv_size": [4, 4]}, + "west": {"uv": [22, 25], "uv_size": [4, 4]}, + "up": {"uv": [22, 21], "uv_size": [4, 4], "uv_rotation": 270}, + "down": {"uv": [26, 25], "uv_size": [4, -4], "uv_rotation": 90} + } + } + ] + }, + { + "name": "bipedBody", + "pivot": [0, 24, 0] + }, + { + "name": "armorBody", + "parent": "bipedBody", + "pivot": [0, 24, 0] + }, + { + "name": "bipedRightArm", + "pivot": [-4, 22, 0] + }, + { + "name": "armorRightArm", + "parent": "bipedRightArm", + "pivot": [-4, 22, 0] + }, + { + "name": "bipedLeftArm", + "pivot": [4, 22, 0] + }, + { + "name": "armorLeftArm", + "parent": "bipedLeftArm", + "pivot": [4, 22, 0] + }, + { + "name": "bipedLeftLeg", + "pivot": [2, 12, 0] + }, + { + "name": "armorLeftLeg", + "parent": "bipedLeftLeg", + "pivot": [2, 12, 0] + }, + { + "name": "armorLeftBoot", + "parent": "bipedLeftLeg", + "pivot": [2, 12, 0] + }, + { + "name": "bipedRightLeg", + "pivot": [-2, 12, 0] + }, + { + "name": "armorRightLeg", + "parent": "bipedRightLeg", + "pivot": [-2, 12, 0] + }, + { + "name": "armorRightBoot", + "parent": "bipedRightLeg", + "pivot": [-2, 12, 0] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/seasonsgreetings/lang/en_us.json b/src/main/resources/assets/seasonsgreetings/lang/en_us.json index 69ec7ee..e44b9e9 100644 --- a/src/main/resources/assets/seasonsgreetings/lang/en_us.json +++ b/src/main/resources/assets/seasonsgreetings/lang/en_us.json @@ -32,6 +32,11 @@ "block.seasonsgreetings.purple_gumdrop_button": "Purple Gumdrop Button", "block.seasonsgreetings.purple_gumdrop_block": "Purple Gumdrop Block", + "block.seasonsgreetings.packed_snow": "Packed Snow", + "block.seasonsgreetings.snow_bricks": "Snow Bricks", + "block.seasonsgreetings.snow_brick_stairs": "Snow Brick Stairs", + "block.seasonsgreetings.snow_brick_slab": "Snow Brick Slab", + "block.seasonsgreetings.chiseled_snow": "Chiseled Snow", "block.seasonsgreetings.peppermint_block": "Peppermint Block", "block.seasonsgreetings.peppermint_stairs": "Peppermint Stairs", diff --git a/src/main/resources/assets/seasonsgreetings/models/block/bricks.py b/src/main/resources/assets/seasonsgreetings/models/block/bricks.py new file mode 100644 index 0000000..24a13f4 --- /dev/null +++ b/src/main/resources/assets/seasonsgreetings/models/block/bricks.py @@ -0,0 +1,97 @@ +import os +import json + +# Define the base JSON structures from the provided files +templates = { + "block": { + "parent": "minecraft:block/cube_all", + "textures": { + "all": "minecraft:block/{material}" + } + }, + "slab": { + "parent": "minecraft:block/slab", + "textures": { + "bottom": "minecraft:block/{material}", + "side": "minecraft:block/{material}", + "top": "minecraft:block/{material}" + } + }, + "slab_top": { + "parent": "minecraft:block/slab_top", + "textures": { + "bottom": "minecraft:block/{material}", + "side": "minecraft:block/{material}", + "top": "minecraft:block/{material}" + } + }, + "stairs": { + "parent": "minecraft:block/stairs", + "textures": { + "bottom": "minecraft:block/{material}", + "side": "minecraft:block/{material}", + "top": "minecraft:block/{material}" + } + }, + "stairs_inner": { + "parent": "minecraft:block/inner_stairs", + "textures": { + "bottom": "minecraft:block/{material}", + "side": "minecraft:block/{material}", + "top": "minecraft:block/{material}" + } + }, + "stairs_outer": { + "parent": "minecraft:block/outer_stairs", + "textures": { + "bottom": "minecraft:block/{material}", + "side": "minecraft:block/{material}", + "top": "minecraft:block/{material}" + } + } +} + +def create_files(material_name): + # Check if the material ends with 's' and adjust for slabs/stairs + adjusted_name = material_name[:-1] if material_name.endswith("s") else material_name + + for file_type, structure in templates.items(): + # Check if the "block" file already exists + if file_type == "block": + block_filename = f"{material_name}.json" + alt_block_filename = f"{material_name}_block.json" + if os.path.exists(block_filename) or os.path.exists(alt_block_filename): + print(f"File '{block_filename}' or '{alt_block_filename}' already exists. Skipping block file generation.") + continue + + # Use original material name for the block file + output_name = material_name + else: + # Use adjusted name for slabs and stairs + output_name = adjusted_name + + # Replace placeholder {material} in the template + updated_structure = json.dumps(structure).replace("{material}", output_name) + + # Convert JSON string to a dictionary + output = json.loads(updated_structure) + + # Modify the texture paths to use "seasonsgreetings" instead of "minecraft" + for key in output.get("textures", {}): + output["textures"][key] = output["textures"][key].replace("minecraft", "seasonsgreetings") + + # Determine the filename for output + filename = f"{output_name}_{file_type}.json" if file_type != "block" else f"{material_name}.json" + + # Write the updated JSON to a file + with open(filename, "w") as f: + json.dump(output, f, indent=2) + print(f"File '{filename}' created.") + +# Input the material name +if __name__ == "__main__": + material = input("Enter the material name: ").strip() + if material: + create_files(material) + else: + print("No material name provided. Exiting.") diff --git a/src/main/resources/assets/seasonsgreetings/models/block/chiseled_snow.json b/src/main/resources/assets/seasonsgreetings/models/block/chiseled_snow.json new file mode 100644 index 0000000..dad1ce3 --- /dev/null +++ b/src/main/resources/assets/seasonsgreetings/models/block/chiseled_snow.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "seasonsgreetings:block/chiseled_snow" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/seasonsgreetings/models/block/packed_snow.json b/src/main/resources/assets/seasonsgreetings/models/block/packed_snow.json new file mode 100644 index 0000000..d6d33a0 --- /dev/null +++ b/src/main/resources/assets/seasonsgreetings/models/block/packed_snow.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "seasonsgreetings:block/packed_snow" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/seasonsgreetings/models/block/packed_snow_slab.json b/src/main/resources/assets/seasonsgreetings/models/block/packed_snow_slab.json new file mode 100644 index 0000000..4134d6f --- /dev/null +++ b/src/main/resources/assets/seasonsgreetings/models/block/packed_snow_slab.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/slab", + "textures": { + "bottom": "seasonsgreetings:block/packed_snow", + "side": "seasonsgreetings:block/packed_snow", + "top": "seasonsgreetings:block/packed_snow" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/seasonsgreetings/models/block/packed_snow_slab_top.json b/src/main/resources/assets/seasonsgreetings/models/block/packed_snow_slab_top.json new file mode 100644 index 0000000..a2a6f17 --- /dev/null +++ b/src/main/resources/assets/seasonsgreetings/models/block/packed_snow_slab_top.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/slab_top", + "textures": { + "bottom": "seasonsgreetings:block/packed_snow", + "side": "seasonsgreetings:block/packed_snow", + "top": "seasonsgreetings:block/packed_snow" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/seasonsgreetings/models/block/snow_brick_slab.json b/src/main/resources/assets/seasonsgreetings/models/block/snow_brick_slab.json new file mode 100644 index 0000000..4a13257 --- /dev/null +++ b/src/main/resources/assets/seasonsgreetings/models/block/snow_brick_slab.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/slab", + "textures": { + "bottom": "seasonsgreetings:block/snow_bricks", + "side": "seasonsgreetings:block/snow_bricks", + "top": "seasonsgreetings:block/snow_bricks" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/seasonsgreetings/models/block/snow_brick_slab_top.json b/src/main/resources/assets/seasonsgreetings/models/block/snow_brick_slab_top.json new file mode 100644 index 0000000..e194f89 --- /dev/null +++ b/src/main/resources/assets/seasonsgreetings/models/block/snow_brick_slab_top.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/slab_top", + "textures": { + "bottom": "seasonsgreetings:block/snow_bricks", + "side": "seasonsgreetings:block/snow_bricks", + "top": "seasonsgreetings:block/snow_bricks" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/seasonsgreetings/models/block/snow_brick_stairs.json b/src/main/resources/assets/seasonsgreetings/models/block/snow_brick_stairs.json new file mode 100644 index 0000000..0b5a656 --- /dev/null +++ b/src/main/resources/assets/seasonsgreetings/models/block/snow_brick_stairs.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/stairs", + "textures": { + "bottom": "seasonsgreetings:block/snow_bricks", + "side": "seasonsgreetings:block/snow_bricks", + "top": "seasonsgreetings:block/snow_bricks" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/seasonsgreetings/models/block/snow_brick_stairs_inner.json b/src/main/resources/assets/seasonsgreetings/models/block/snow_brick_stairs_inner.json new file mode 100644 index 0000000..9aca152 --- /dev/null +++ b/src/main/resources/assets/seasonsgreetings/models/block/snow_brick_stairs_inner.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/inner_stairs", + "textures": { + "bottom": "seasonsgreetings:block/snow_bricks", + "side": "seasonsgreetings:block/snow_bricks", + "top": "seasonsgreetings:block/snow_bricks" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/seasonsgreetings/models/block/snow_brick_stairs_outer.json b/src/main/resources/assets/seasonsgreetings/models/block/snow_brick_stairs_outer.json new file mode 100644 index 0000000..b41a2d0 --- /dev/null +++ b/src/main/resources/assets/seasonsgreetings/models/block/snow_brick_stairs_outer.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/outer_stairs", + "textures": { + "bottom": "seasonsgreetings:block/snow_bricks", + "side": "seasonsgreetings:block/snow_bricks", + "top": "seasonsgreetings:block/snow_bricks" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/seasonsgreetings/models/block/snow_bricks.json b/src/main/resources/assets/seasonsgreetings/models/block/snow_bricks.json new file mode 100644 index 0000000..538a3be --- /dev/null +++ b/src/main/resources/assets/seasonsgreetings/models/block/snow_bricks.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "seasonsgreetings:block/snow_bricks" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/seasonsgreetings/models/block/template/gumdrop_button.json b/src/main/resources/assets/seasonsgreetings/models/block/template/gumdrop_button.json index baaf104..41a2d9b 100644 --- a/src/main/resources/assets/seasonsgreetings/models/block/template/gumdrop_button.json +++ b/src/main/resources/assets/seasonsgreetings/models/block/template/gumdrop_button.json @@ -1,7 +1,8 @@ { "credit": "Made with Blockbench", "textures": { - "all": "seasonsgreetings:block/red_gumdrop_block_button" + "all": "seasonsgreetings:block/red_gumdrop_block_button", + "particle": "#all" }, "elements": [ { diff --git a/src/main/resources/assets/seasonsgreetings/models/block/template/gumdrop_button_pressed.json b/src/main/resources/assets/seasonsgreetings/models/block/template/gumdrop_button_pressed.json index 47f77b5..2913318 100644 --- a/src/main/resources/assets/seasonsgreetings/models/block/template/gumdrop_button_pressed.json +++ b/src/main/resources/assets/seasonsgreetings/models/block/template/gumdrop_button_pressed.json @@ -1,7 +1,8 @@ { "credit": "Made with Blockbench", "textures": { - "all": "seasonsgreetings:block/red_gumdrop_block_button" + "all": "seasonsgreetings:block/red_gumdrop_block_button", + "particle": "#all" }, "elements": [ { diff --git a/src/main/resources/assets/seasonsgreetings/models/item/chiseled_snow.json b/src/main/resources/assets/seasonsgreetings/models/item/chiseled_snow.json new file mode 100644 index 0000000..222a19d --- /dev/null +++ b/src/main/resources/assets/seasonsgreetings/models/item/chiseled_snow.json @@ -0,0 +1,3 @@ +{ + "parent": "seasonsgreetings:block/chiseled_snow" +} \ No newline at end of file diff --git a/src/main/resources/assets/seasonsgreetings/models/item/christmas_hat.json b/src/main/resources/assets/seasonsgreetings/models/item/christmas_hat.json new file mode 100644 index 0000000..c5d3141 --- /dev/null +++ b/src/main/resources/assets/seasonsgreetings/models/item/christmas_hat.json @@ -0,0 +1,7 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "seasonsgreetings:item/christmas_hat", + "layer1": "seasonsgreetings:item/christmas_hat_overlay" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/seasonsgreetings/models/item/packed_snow.json b/src/main/resources/assets/seasonsgreetings/models/item/packed_snow.json new file mode 100644 index 0000000..dd58d03 --- /dev/null +++ b/src/main/resources/assets/seasonsgreetings/models/item/packed_snow.json @@ -0,0 +1,3 @@ +{ + "parent": "seasonsgreetings:block/packed_snow" +} \ No newline at end of file diff --git a/src/main/resources/assets/seasonsgreetings/models/item/snow_brick_slab.json b/src/main/resources/assets/seasonsgreetings/models/item/snow_brick_slab.json new file mode 100644 index 0000000..eb2fc34 --- /dev/null +++ b/src/main/resources/assets/seasonsgreetings/models/item/snow_brick_slab.json @@ -0,0 +1,3 @@ +{ + "parent": "seasonsgreetings:block/snow_brick_slab" +} \ No newline at end of file diff --git a/src/main/resources/assets/seasonsgreetings/models/item/snow_brick_stairs.json b/src/main/resources/assets/seasonsgreetings/models/item/snow_brick_stairs.json new file mode 100644 index 0000000..77ef8a4 --- /dev/null +++ b/src/main/resources/assets/seasonsgreetings/models/item/snow_brick_stairs.json @@ -0,0 +1,3 @@ +{ + "parent": "seasonsgreetings:block/snow_brick_stairs" +} \ No newline at end of file diff --git a/src/main/resources/assets/seasonsgreetings/models/item/snow_bricks.json b/src/main/resources/assets/seasonsgreetings/models/item/snow_bricks.json new file mode 100644 index 0000000..045dfd2 --- /dev/null +++ b/src/main/resources/assets/seasonsgreetings/models/item/snow_bricks.json @@ -0,0 +1,3 @@ +{ + "parent": "seasonsgreetings:block/snow_bricks" +} \ No newline at end of file diff --git a/src/main/resources/assets/seasonsgreetings/textures/block/chiseled_snow.png b/src/main/resources/assets/seasonsgreetings/textures/block/chiseled_snow.png new file mode 100644 index 0000000..a43aba3 Binary files /dev/null and b/src/main/resources/assets/seasonsgreetings/textures/block/chiseled_snow.png differ diff --git a/src/main/resources/assets/seasonsgreetings/textures/block/packed_snow.png b/src/main/resources/assets/seasonsgreetings/textures/block/packed_snow.png new file mode 100644 index 0000000..c7bacfa Binary files /dev/null and b/src/main/resources/assets/seasonsgreetings/textures/block/packed_snow.png differ diff --git a/src/main/resources/assets/seasonsgreetings/textures/block/snow_bricks.png b/src/main/resources/assets/seasonsgreetings/textures/block/snow_bricks.png index 064b924..30ffbbb 100644 Binary files a/src/main/resources/assets/seasonsgreetings/textures/block/snow_bricks.png and b/src/main/resources/assets/seasonsgreetings/textures/block/snow_bricks.png differ diff --git a/src/main/resources/assets/seasonsgreetings/textures/item/christmas_hat.png b/src/main/resources/assets/seasonsgreetings/textures/item/christmas_hat.png new file mode 100644 index 0000000..f2a8cdb Binary files /dev/null and b/src/main/resources/assets/seasonsgreetings/textures/item/christmas_hat.png differ diff --git a/src/main/resources/assets/seasonsgreetings/textures/item/christmas_hat_overlay.png b/src/main/resources/assets/seasonsgreetings/textures/item/christmas_hat_overlay.png new file mode 100644 index 0000000..9453cdd Binary files /dev/null and b/src/main/resources/assets/seasonsgreetings/textures/item/christmas_hat_overlay.png differ diff --git a/src/main/resources/assets/seasonsgreetings/textures/models/armor/christmas_hat.png b/src/main/resources/assets/seasonsgreetings/textures/models/armor/christmas_hat.png new file mode 100644 index 0000000..cac18a6 Binary files /dev/null and b/src/main/resources/assets/seasonsgreetings/textures/models/armor/christmas_hat.png differ diff --git a/src/main/resources/assets/seasonsgreetings/textures/models/armor/christmas_hat_overlay.png b/src/main/resources/assets/seasonsgreetings/textures/models/armor/christmas_hat_overlay.png new file mode 100644 index 0000000..d186d0c Binary files /dev/null and b/src/main/resources/assets/seasonsgreetings/textures/models/armor/christmas_hat_overlay.png differ diff --git a/src/main/resources/data/minecraft/tags/item/dyeable.json b/src/main/resources/data/minecraft/tags/item/dyeable.json new file mode 100644 index 0000000..e702852 --- /dev/null +++ b/src/main/resources/data/minecraft/tags/item/dyeable.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "seasonsgreetings:christmas_hat" + ] +} \ No newline at end of file