Skip to content

Commit

Permalink
Added: Rideable Mules / Cleanup and Refactors
Browse files Browse the repository at this point in the history
  • Loading branch information
satisfyu committed Dec 23, 2023
1 parent 2a78374 commit bbb0978
Show file tree
Hide file tree
Showing 99 changed files with 230 additions and 395 deletions.
4 changes: 2 additions & 2 deletions License
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ the license below.
/forge/src/main/resources/

All Rights Reserved
Copyright (c) 2022 Satisfy
Copyright (c) 2023 Satisfy

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
Expand All @@ -19,7 +19,7 @@ All other files within this repository are subject to the license below.

MIT License

Copyright (c) 2022 Satisfy
Copyright (c) 2023 Satisfy

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockSt

@Override
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
if(state.getValue(VARIANT) && !state.getValue(HAS_APPLES) && world.getRandom().nextFloat() < 0.4f) world.setBlockAndUpdate(pos, state.setValue(HAS_APPLES, true));
if(state.getValue(VARIANT) && !state.getValue(HAS_APPLES) && world.getRandom().nextFloat() < 0.1f) world.setBlockAndUpdate(pos, state.setValue(HAS_APPLES, true));
super.randomTick(state, world, pos, random);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockSt

@Override
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
if(state.getValue(VARIANT) && !state.getValue(HAS_CHERRIES) && world.getRandom().nextFloat() < 0.4f) world.setBlockAndUpdate(pos, state.setValue(HAS_CHERRIES, true));
if(state.getValue(VARIANT) && !state.getValue(HAS_CHERRIES) && world.getRandom().nextFloat() < 0.1f) world.setBlockAndUpdate(pos, state.setValue(HAS_CHERRIES, true));
super.randomTick(state, world, pos, random);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import java.util.Map;
import java.util.function.Supplier;

@SuppressWarnings("unchecked")
public class FermentationBarrelBlock extends HorizontalDirectionalBlock implements EntityBlock {
private static final Supplier<VoxelShape> voxelShapeSupplier = () -> {
VoxelShape shape = Shapes.empty();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
package satisfyu.vinery.block.entity;

import net.minecraft.client.Minecraft;
import net.minecraft.core.Direction;
import net.minecraft.world.item.crafting.Recipe;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import satisfyu.vinery.Vinery;
import satisfyu.vinery.client.gui.handler.ApplePressGuiHandler;
import satisfyu.vinery.recipe.ApplePressRecipe;
import satisfyu.vinery.registry.ObjectRegistry;
import satisfyu.vinery.registry.VineryBlockEntityTypes;
import net.minecraft.core.BlockPos;
import net.minecraft.core.NonNullList;
Expand All @@ -22,14 +19,12 @@
import net.minecraft.world.inventory.ContainerData;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import org.jetbrains.annotations.Nullable;
import satisfyu.vinery.registry.VineryRecipeTypes;

import java.util.Arrays;
import satisfyu.vinery.util.ImplementedInventory;

public class ApplePressBlockEntity extends BlockEntity implements MenuProvider, ImplementedInventory, BlockEntityTicker<ApplePressBlockEntity> {
private final NonNullList<ItemStack> inventory = NonNullList.withSize(2, ItemStack.EMPTY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import satisfyu.vinery.registry.ObjectRegistry;
import satisfyu.vinery.registry.VineryBlockEntityTypes;
import satisfyu.vinery.registry.VineryRecipeTypes;
import satisfyu.vinery.util.ImplementedInventory;
import satisfyu.vinery.util.WineYears;

public class FermentationBarrelBlockEntity extends BlockEntity implements ImplementedInventory, BlockEntityTicker<FermentationBarrelBlockEntity>, MenuProvider {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,6 @@ public static LayerDefinition getTexturedModelData() {

PartDefinition headstuff = Head.addOrReplaceChild("headstuff", CubeListBuilder.create(), PartPose.offsetAndRotation(0.0F, 0.0F, 0.0F, -0.5236F, 0.0F, 0.0F));

PartDefinition Ear1 = headstuff.addOrReplaceChild("Ear1", CubeListBuilder.create().texOffs(19, 16).mirror().addBox(-0.5F, -18.0F, 2.99F, 2.0F, 3.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(0.0F, 11.0F, 3.0F, 0.5236F, 0.0F, 0.0873F));

PartDefinition Ear2 = headstuff.addOrReplaceChild("Ear2", CubeListBuilder.create().texOffs(19, 16).addBox(-1.5F, -18.0F, 2.99F, 2.0F, 3.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, 11.0F, 3.0F, 0.5236F, 0.0F, -0.0873F));

PartDefinition MuleEarL = headstuff.addOrReplaceChild("MuleEarL", CubeListBuilder.create().texOffs(0, 12).mirror().addBox(-3.0F, -22.0F, 2.99F, 2.0F, 7.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(0.0F, 11.0F, 3.0F, 0.5236F, 0.0F, 0.2618F));

PartDefinition MuleEarR = headstuff.addOrReplaceChild("MuleEarR", CubeListBuilder.create().texOffs(0, 12).addBox(1.0F, -22.0F, 2.99F, 2.0F, 7.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, 11.0F, 3.0F, 0.5236F, 0.0F, -0.2618F));
Expand Down
47 changes: 13 additions & 34 deletions common/src/main/java/satisfyu/vinery/entity/TraderMuleEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,86 +6,65 @@
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.AgeableMob;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.ai.goal.BreedGoal;
import net.minecraft.world.entity.ai.goal.FloatGoal;
import net.minecraft.world.entity.ai.goal.FollowParentGoal;
import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal;
import net.minecraft.world.entity.ai.goal.PanicGoal;
import net.minecraft.world.entity.ai.goal.RandomLookAroundGoal;
import net.minecraft.world.entity.ai.goal.RunAroundLikeCrazyGoal;
import net.minecraft.world.entity.ai.goal.TemptGoal;
import net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal;
import net.minecraft.world.entity.animal.horse.Mule;
import net.minecraft.world.entity.animal.horse.TraderLlama;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.ai.goal.*;
import net.minecraft.world.entity.animal.horse.Horse;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.level.Level;
import org.jetbrains.annotations.Nullable;
import satisfyu.vinery.block.GrapeItem;
import satisfyu.vinery.registry.VineryEntites;

public class TraderMuleEntity extends TraderLlama {
public class TraderMuleEntity extends Horse {

public TraderMuleEntity(EntityType<? extends TraderMuleEntity> entityType, Level world) {
super(entityType, world);
}

@Override
protected void registerGoals() {
this.goalSelector.addGoal(0, new FloatGoal(this));
this.goalSelector.addGoal(1, new RunAroundLikeCrazyGoal(this, 1.0));
this.goalSelector.addGoal(3, new PanicGoal(this, 1.0));
this.goalSelector.addGoal(4, new BreedGoal(this, 1.0));
this.goalSelector.addGoal(5, new TemptGoal(this, 1.0, Ingredient.of(Items.HAY_BLOCK), false));
this.goalSelector.addGoal(6, new FollowParentGoal(this, 1.0));
this.goalSelector.addGoal(7, new WaterAvoidingRandomStrollGoal(this, 1.0));
this.goalSelector.addGoal(8, new LookAtPlayerGoal(this, Player.class, 6.0f));
this.goalSelector.addGoal(9, new RandomLookAroundGoal(this));
}


@Override
public boolean isFood(ItemStack stack) {
return false;
//return super.isFood(stack) || stack.getItem() instanceof GrapeItem;
this.goalSelector.addGoal(8, new RandomLookAroundGoal(this));
}

@Override
public TraderMuleEntity getBreedOffspring(ServerLevel serverWorld, AgeableMob passiveEntity) {
return VineryEntites.MULE.get().create(this.level());
}

@Override
protected SoundEvent getAmbientSound() {
super.getAmbientSound();
return SoundEvents.DONKEY_AMBIENT;
}

@Override
protected SoundEvent getAngrySound() {
super.getAngrySound();
return SoundEvents.DONKEY_ANGRY;
}

@Override
protected SoundEvent getDeathSound() {
super.getDeathSound();
return SoundEvents.DONKEY_DEATH;
}

@Override
@Nullable
protected SoundEvent getEatingSound() {
return SoundEvents.DONKEY_EAT;
}

@Override
protected SoundEvent getHurtSound(DamageSource source) {
super.getHurtSound(source);
return SoundEvents.DONKEY_HURT;
}


}

}
2 changes: 0 additions & 2 deletions common/src/main/java/satisfyu/vinery/item/CherryItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ public CherryItem(Properties settings) {
@Override
public void appendHoverText(ItemStack stack, @Nullable Level world, @NotNull List<Component> tooltip, TooltipFlag context) {
tooltip.add(Component.translatable( "item.vinery.cherry.tooltip").withStyle(ChatFormatting.ITALIC, ChatFormatting.GRAY));


}

}
43 changes: 0 additions & 43 deletions common/src/main/java/satisfyu/vinery/item/FoodItemReturn.java

This file was deleted.

27 changes: 0 additions & 27 deletions common/src/main/java/satisfyu/vinery/item/GlovesItem.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import satisfyu.vinery.block.grape.GrapeType;

Expand All @@ -20,11 +21,6 @@ public GrapeBushSeedItem(Block block, Properties settings, GrapeType type) {
this.type = type;
}

@Override
public void appendHoverText(ItemStack stack, @Nullable Level world, List<Component> tooltip, TooltipFlag context) {
tooltip.add(Component.translatable("item.vinery.grapeseed.tooltip." + this.getDescriptionId()).withStyle(ChatFormatting.ITALIC, ChatFormatting.GRAY));
}

public GrapeType getType() {
return this.type;
}
Expand Down
4 changes: 2 additions & 2 deletions common/src/main/java/satisfyu/vinery/item/StrawHatItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ public class StrawHatItem extends CustomHatItem implements WineMakerArmorItem {


public StrawHatItem(Properties settings) {
super(VineryMaterials.VINEMAKER_ARMOR, Type.HELMET, settings);
super(VineryMaterials.WINEMAKER_ARMOR, Type.HELMET, settings);
}

@Override
public ResourceLocation getTexture() {
return new VineryIdentifier("textures/item/straw_hat.png");
return new VineryIdentifier("textures/entity/straw_hat.png");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ default void tooltip(List<Component> tooltip){
tooltip.add(Component.nullToEmpty(""));
tooltip.add(Component.nullToEmpty(ChatFormatting.AQUA + I18n.get("vinery.tooltip.winemaker_armor")));
tooltip.add(Component.nullToEmpty((helmetB ? ChatFormatting.GREEN.toString() : ChatFormatting.GRAY.toString()) + "- [" + ObjectRegistry.STRAW_HAT.get().getDescription().getString() + "]"));
tooltip.add(Component.nullToEmpty((chestplateB ? ChatFormatting.GREEN.toString() : ChatFormatting.GRAY.toString()) + "- [" + ObjectRegistry.VINEMAKER_APRON.get().getDescription().getString() + "]"));
tooltip.add(Component.nullToEmpty((leggingsB ? ChatFormatting.GREEN.toString() : ChatFormatting.GRAY.toString()) + "- [" + ObjectRegistry.VINEMAKER_LEGGINGS.get().getDescription().getString() + "]"));
tooltip.add(Component.nullToEmpty((bootsB ? ChatFormatting.GREEN.toString() : ChatFormatting.GRAY.toString()) + "- [" + ObjectRegistry.VINEMAKER_BOOTS.get().getDescription().getString() + "]"));
tooltip.add(Component.nullToEmpty((chestplateB ? ChatFormatting.GREEN.toString() : ChatFormatting.GRAY.toString()) + "- [" + ObjectRegistry.WINEMAKER_APRON.get().getDescription().getString() + "]"));
tooltip.add(Component.nullToEmpty((leggingsB ? ChatFormatting.GREEN.toString() : ChatFormatting.GRAY.toString()) + "- [" + ObjectRegistry.WINEMAKER_LEGGINGS.get().getDescription().getString() + "]"));
tooltip.add(Component.nullToEmpty((bootsB ? ChatFormatting.GREEN.toString() : ChatFormatting.GRAY.toString()) + "- [" + ObjectRegistry.WINEMAKER_BOOTS.get().getDescription().getString() + "]"));
tooltip.add(Component.nullToEmpty(""));
tooltip.add(Component.nullToEmpty(ChatFormatting.GRAY + I18n.get("vinery.tooltip.winemaker_armor2")));
tooltip.add(Component.nullToEmpty(((helmetB &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

@Mixin(ShovelItem.class)
public class ShovelItemMixin {

@Inject(method = "useOn", at = @At(value = "HEAD"), cancellable = true)
public void canConvertSlab(UseOnContext useOnContext, CallbackInfoReturnable<InteractionResult> cir) {
Level level = useOnContext.getLevel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,9 @@ public class ObjectRegistry {
public static final RegistrySupplier<Block> STACKABLE_LOG = registerB("stackable_log", () -> new StackableLogBlock(getLogBlockSettings().noOcclusion().lightLevel(state -> state.getValue(StackableLogBlock.FIRED) ? 13 : 0)));
public static final RegistrySupplier<Item> STACKABLE_LOG_ITEM = registerI("stackable_log", () -> new BlockItem(STACKABLE_LOG.get(), getSettings()));
public static final RegistrySupplier<Item> STRAW_HAT = registerI("straw_hat", () -> new StrawHatItem(getSettings().rarity(Rarity.RARE)));
public static final RegistrySupplier<Item> VINEMAKER_APRON = registerI("vinemaker_apron", () -> new WinemakerDefaultArmorItem(VineryMaterials.VINEMAKER_ARMOR, ArmorItem.Type.CHESTPLATE, getSettings().rarity(Rarity.EPIC)));
public static final RegistrySupplier<Item> VINEMAKER_LEGGINGS = registerI("vinemaker_leggings", () -> new WinemakerDefaultArmorItem(VineryMaterials.VINEMAKER_ARMOR, ArmorItem.Type.LEGGINGS, getSettings().rarity(Rarity.RARE)));
public static final RegistrySupplier<Item> VINEMAKER_BOOTS = registerI("vinemaker_boots", () -> new WinemakerDefaultArmorItem(VineryMaterials.VINEMAKER_ARMOR, ArmorItem.Type.BOOTS, getSettings().rarity(Rarity.RARE)));
public static final RegistrySupplier<Item> WINEMAKER_APRON = registerI("winemaker_apron", () -> new WinemakerDefaultArmorItem(VineryMaterials.WINEMAKER_ARMOR, ArmorItem.Type.CHESTPLATE, getSettings().rarity(Rarity.EPIC)));
public static final RegistrySupplier<Item> WINEMAKER_LEGGINGS = registerI("winemaker_leggings", () -> new WinemakerDefaultArmorItem(VineryMaterials.WINEMAKER_ARMOR, ArmorItem.Type.LEGGINGS, getSettings().rarity(Rarity.RARE)));
public static final RegistrySupplier<Item> WINEMAKER_BOOTS = registerI("winemaker_boots", () -> new WinemakerDefaultArmorItem(VineryMaterials.WINEMAKER_ARMOR, ArmorItem.Type.BOOTS, getSettings().rarity(Rarity.RARE)));
public static final RegistrySupplier<Block> CALENDAR = registerB("calendar", () -> new CalendarBlock(BlockBehaviour.Properties.copy(Blocks.FLOWER_POT)));
public static final RegistrySupplier<Item> CALENDAR_ITEM = registerI("calendar", () -> new Calendar(CALENDAR.get(), getSettings()));
public static final RegistrySupplier<Item> MULE_SPAWN_EGG = registerI("mule_spawn_egg", () -> new ArchitecturySpawnEggItem(VineryEntites.MULE, -1, -1, getSettings()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import de.cristelknight.doapi.terraform.sign.TerraformSignHelper;
import dev.architectury.registry.registries.RegistrySupplier;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.HangingSignItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.SignItem;
import net.minecraft.world.level.block.Block;
Expand All @@ -20,14 +21,13 @@ public class VineryBoatsAndSigns {
public static final RegistrySupplier<Block> CHERRY_SIGN = ObjectRegistry.registerB("cherry_sign", () -> TerraformSignHelper.getSign(CHERRY_SIGN_TEXTURE));
public static final RegistrySupplier<Block> CHERRY_WALL_SIGN = ObjectRegistry.registerB("cherry_wall_sign", () -> TerraformSignHelper.getWallSign(CHERRY_SIGN_TEXTURE));
public static final RegistrySupplier<Item> CHERRY_SIGN_ITEM = ObjectRegistry.registerI("cherry_sign", () -> new SignItem(ObjectRegistry.getSettings().stacksTo(16), CHERRY_SIGN.get(), CHERRY_WALL_SIGN.get()));
/*
public static final ResourceLocation CHERRY_HANGING_SIGN_TEXTURE = new VineryIdentifier("entity/signs/hanging/cherry");
public static final ResourceLocation CHERRY_HANGING_SIGN_GUI_TEXTURE = new VineryIdentifier("textures/gui/hanging_signs/cherry");

public static final RegistrySupplier<Block> CHERRY_HANGING_SIGN = ObjectRegistry.registerB("cherry_hanging_sign", () -> TerraformSignHelper.getHangingSign(CHERRY_HANGING_SIGN_TEXTURE, CHERRY_HANGING_SIGN_GUI_TEXTURE));
public static final RegistrySupplier<Block> CHERRY_WALL_HANGING_SIGN = ObjectRegistry.registerB("cherry_wall_hanging_sign", () -> TerraformSignHelper.getWallHangingSign(CHERRY_HANGING_SIGN_TEXTURE, CHERRY_HANGING_SIGN_GUI_TEXTURE));
public static final RegistrySupplier<Item> CHERRY_HANGING_SIGN_ITEM = ObjectRegistry.registerI("cherry_hanging_sign", () -> new HangingSignItem(CHERRY_HANGING_SIGN.get(), CHERRY_WALL_HANGING_SIGN.get(), ObjectRegistry.getSettings().stacksTo(16)));
*/

public static RegistrySupplier<Item> CHERRY_BOAT = TerraformBoatItemHelper.registerBoatItem(ObjectRegistry.ITEMS, "cherry_boat", CHERRY_BOAT_TYPE, false);
public static RegistrySupplier<Item> CHERRY_CHEST_BOAT = TerraformBoatItemHelper.registerBoatItem(ObjectRegistry.ITEMS, "cherry_chest_boat", CHERRY_BOAT_TYPE, true);
public static void init() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

public class VineryMaterials {

public static final ArmorMaterial VINEMAKER_ARMOR = new ArmorMaterial() {
public static final ArmorMaterial WINEMAKER_ARMOR = new ArmorMaterial() {

@Override
public int getDurabilityForType(ArmorItem.Type type) {
Expand Down Expand Up @@ -38,7 +38,7 @@ public Ingredient getRepairIngredient() {

@Override
public String getName() {
return "vinemaker";
return "winemaker";
}

@Override
Expand Down

0 comments on commit bbb0978

Please sign in to comment.