Skip to content

Commit

Permalink
Polished Hamster goals, added new sound events, set up loot tables, etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sydokiddo committed Dec 7, 2024
1 parent ce87cd2 commit 4167425
Show file tree
Hide file tree
Showing 76 changed files with 2,497 additions and 424 deletions.
1 change: 1 addition & 0 deletions src/main/java/com/starfish_studios/hamsters/Hamsters.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@ public void onInitialize() {
);

HamstersVanillaIntegration.serverInit();
HamstersCreativeModeTabs.addToVanillaCreativeTabs();
}
}
201 changes: 133 additions & 68 deletions src/main/java/com/starfish_studios/hamsters/entities/Hamster.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public boolean hurt(@NotNull DamageSource damageSource, float damageAmount) {
if (gameTime - this.lastHit <= 5L || damageSource.getDirectEntity() instanceof AbstractArrow) {
this.breakHamsterBall();
} else {
this.knockback(0.4F, Objects.requireNonNull(damageSource.getSourcePosition()).x() - this.getX(), Objects.requireNonNull(damageSource.getSourcePosition()).z() - this.getZ());
if (damageSource.getSourcePosition() != null) this.knockback(0.4F, Objects.requireNonNull(damageSource.getSourcePosition()).x() - this.getX(), Objects.requireNonNull(damageSource.getSourcePosition()).z() - this.getZ());
this.level().broadcastEntityEvent(this, (byte) 32);
this.gameEvent(GameEvent.ENTITY_DAMAGE, damageSource.getEntity());
this.lastHit = gameTime;
Expand Down Expand Up @@ -157,7 +157,7 @@ public double getPassengersRidingOffset() {

@Override
public ItemStack getPickResult() {
return new ItemStack(HamstersItems.LIGHT_BLUE_HAMSTER_BALL);
return new ItemStack(HamstersItems.WHITE_HAMSTER_BALL);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public boolean canContinueToUse() {

@Override
public void stop() {
this.mob.setSleeping(false); // Wakes up the mob when the goal ends
this.mob.getNavigation().stop();
super.stop();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
import com.starfish_studios.hamsters.Hamsters;
import com.starfish_studios.hamsters.entities.Hamster;
import com.starfish_studios.hamsters.registry.HamstersEntityTypes;
import com.starfish_studios.hamsters.registry.HamstersSoundEvents;
import net.minecraft.ChatFormatting;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.CommonComponents;
import net.minecraft.network.chat.Component;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Item;
Expand Down Expand Up @@ -47,7 +47,7 @@ public HamsterItem(Properties properties) {
hamster.setOwnerUUID(player.getUUID());
level.addFreshEntity(hamster);

hamster.playSound(SoundEvents.CHICKEN_EGG);
hamster.playSound(HamstersSoundEvents.HAMSTER_PLACE);
hamster.gameEvent(GameEvent.ENTITY_PLACE, useOnContext.getPlayer());

if (!player.getAbilities().instabuild) player.setItemInHand(useOnContext.getHand(), ItemStack.EMPTY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class HamstersBlocks {
// region Common Properties

public static Block cagePanelBlock(DyeColor dyeColor) {
return new CagePanelBlock(FabricBlockSettings.create().strength(0.3F).noOcclusion().isSuffocating(Blocks::never).mapColor(dyeColor));
return new CagePanelBlock(FabricBlockSettings.create().strength(0.3F).noOcclusion().isSuffocating(Blocks::never).mapColor(dyeColor).requiresCorrectToolForDrops());
}

public static Block hamsterBowlBlock(DyeColor dyeColor) {
Expand All @@ -34,59 +34,60 @@ public static Block hamsterBottleBlock(DyeColor dyeColor) {
@SuppressWarnings("unused")
public static final Block TUNNEL = registerBlock("tunnel", new TunnelBlock(FabricBlockSettings.create().strength(0.6F).noOcclusion().isSuffocating((state, world, pos) -> false).pushReaction(PushReaction.IGNORE)));

public static final Block HAMSTER_WHEEL = registerBlockWithoutBlockItem("hamster_wheel", new HamsterWheelBlock(FabricBlockSettings.create().strength(0.6F).noOcclusion().isSuffocating((state, world, pos) -> false).pushReaction(PushReaction.IGNORE)));
public static final Block HAMSTER_WHEEL = registerBlockWithoutBlockItem("hamster_wheel", new HamsterWheelBlock(FabricBlockSettings.create().strength(0.6F)
.noOcclusion().isSuffocating((state, world, pos) -> false).pushReaction(PushReaction.IGNORE).requiresCorrectToolForDrops()));

public static final Block CAGE_PANEL = registerBlock("cage_panel", cagePanelBlock(DyeColor.WHITE));
public static final Block WHITE_CAGE_PANEL = registerBlock("white_cage_panel", cagePanelBlock(DyeColor.WHITE));
public static final Block LIGHT_GRAY_CAGE_PANEL = registerBlock("light_gray_cage_panel", cagePanelBlock(DyeColor.LIGHT_GRAY));
public static final Block GRAY_CAGE_PANEL = registerBlock("gray_cage_panel", cagePanelBlock(DyeColor.GRAY));
public static final Block BLACK_CAGE_PANEL = registerBlock("black_cage_panel", cagePanelBlock(DyeColor.BLACK));
public static final Block BROWN_CAGE_PANEL = registerBlock("brown_cage_panel", cagePanelBlock(DyeColor.BROWN));
public static final Block RED_CAGE_PANEL = registerBlock("red_cage_panel", cagePanelBlock(DyeColor.RED));
public static final Block ORANGE_CAGE_PANEL = registerBlock("orange_cage_panel", cagePanelBlock(DyeColor.ORANGE));
public static final Block YELLOW_CAGE_PANEL = registerBlock("yellow_cage_panel", cagePanelBlock(DyeColor.YELLOW));
public static final Block LIME_CAGE_PANEL = registerBlock("lime_cage_panel", cagePanelBlock(DyeColor.LIME));
public static final Block GREEN_CAGE_PANEL = registerBlock("green_cage_panel", cagePanelBlock(DyeColor.GREEN));
public static final Block CYAN_CAGE_PANEL = registerBlock("cyan_cage_panel", cagePanelBlock(DyeColor.CYAN));
public static final Block BLUE_CAGE_PANEL = registerBlock("blue_cage_panel", cagePanelBlock(DyeColor.BLUE));
public static final Block LIGHT_BLUE_CAGE_PANEL = registerBlock("light_blue_cage_panel", cagePanelBlock(DyeColor.LIGHT_BLUE));
public static final Block PINK_CAGE_PANEL = registerBlock("pink_cage_panel", cagePanelBlock(DyeColor.PINK));
public static final Block MAGENTA_CAGE_PANEL = registerBlock("magenta_cage_panel", cagePanelBlock(DyeColor.MAGENTA));
public static final Block BLUE_CAGE_PANEL = registerBlock("blue_cage_panel", cagePanelBlock(DyeColor.BLUE));
public static final Block PURPLE_CAGE_PANEL = registerBlock("purple_cage_panel", cagePanelBlock(DyeColor.PURPLE));
public static final Block WHITE_CAGE_PANEL = registerBlock("white_cage_panel", cagePanelBlock(DyeColor.WHITE));
public static final Block LIGHT_GRAY_CAGE_PANEL = registerBlock("light_gray_cage_panel", cagePanelBlock(DyeColor.LIGHT_GRAY));
public static final Block GRAY_CAGE_PANEL = registerBlock("gray_cage_panel", cagePanelBlock(DyeColor.GRAY));
public static final Block BLACK_CAGE_PANEL = registerBlock("black_cage_panel", cagePanelBlock(DyeColor.BLACK));
public static final Block BROWN_CAGE_PANEL = registerBlock("brown_cage_panel", cagePanelBlock(DyeColor.BROWN));
public static final Block MAGENTA_CAGE_PANEL = registerBlock("magenta_cage_panel", cagePanelBlock(DyeColor.MAGENTA));
public static final Block PINK_CAGE_PANEL = registerBlock("pink_cage_panel", cagePanelBlock(DyeColor.PINK));

public static final Block WHITE_HAMSTER_BOWL = registerBlock("white_hamster_bowl", hamsterBowlBlock(DyeColor.WHITE));
public static final Block LIGHT_GRAY_HAMSTER_BOWL = registerBlock("light_gray_hamster_bowl", hamsterBowlBlock(DyeColor.LIGHT_GRAY));
public static final Block GRAY_HAMSTER_BOWL = registerBlock("gray_hamster_bowl", hamsterBowlBlock(DyeColor.GRAY));
public static final Block BLACK_HAMSTER_BOWL = registerBlock("black_hamster_bowl", hamsterBowlBlock(DyeColor.BLACK));
public static final Block BROWN_HAMSTER_BOWL = registerBlock("brown_hamster_bowl", hamsterBowlBlock(DyeColor.BROWN));
public static final Block RED_HAMSTER_BOWL = registerBlock("red_hamster_bowl", hamsterBowlBlock(DyeColor.RED));
public static final Block ORANGE_HAMSTER_BOWL = registerBlock("orange_hamster_bowl", hamsterBowlBlock(DyeColor.ORANGE));
public static final Block YELLOW_HAMSTER_BOWL = registerBlock("yellow_hamster_bowl", hamsterBowlBlock(DyeColor.YELLOW));
public static final Block LIME_HAMSTER_BOWL = registerBlock("lime_hamster_bowl", hamsterBowlBlock(DyeColor.LIME));
public static final Block GREEN_HAMSTER_BOWL = registerBlock("green_hamster_bowl", hamsterBowlBlock(DyeColor.GREEN));
public static final Block CYAN_HAMSTER_BOWL = registerBlock("cyan_hamster_bowl", hamsterBowlBlock(DyeColor.CYAN));
public static final Block BLUE_HAMSTER_BOWL = registerBlock("blue_hamster_bowl", hamsterBowlBlock(DyeColor.BLUE));
public static final Block LIGHT_BLUE_HAMSTER_BOWL = registerBlock("light_blue_hamster_bowl", hamsterBowlBlock(DyeColor.LIGHT_BLUE));
public static final Block PINK_HAMSTER_BOWL = registerBlock("pink_hamster_bowl", hamsterBowlBlock(DyeColor.PINK));
public static final Block MAGENTA_HAMSTER_BOWL = registerBlock("magenta_hamster_bowl", hamsterBowlBlock(DyeColor.MAGENTA));
public static final Block BLUE_HAMSTER_BOWL = registerBlock("blue_hamster_bowl", hamsterBowlBlock(DyeColor.BLUE));
public static final Block PURPLE_HAMSTER_BOWL = registerBlock("purple_hamster_bowl", hamsterBowlBlock(DyeColor.PURPLE));
public static final Block WHITE_HAMSTER_BOWL = registerBlock("white_hamster_bowl", hamsterBowlBlock(DyeColor.WHITE));
public static final Block LIGHT_GRAY_HAMSTER_BOWL = registerBlock("light_gray_hamster_bowl", hamsterBowlBlock(DyeColor.LIGHT_GRAY));
public static final Block GRAY_HAMSTER_BOWL = registerBlock("gray_hamster_bowl", hamsterBowlBlock(DyeColor.GRAY));
public static final Block BLACK_HAMSTER_BOWL = registerBlock("black_hamster_bowl", hamsterBowlBlock(DyeColor.BLACK));
public static final Block BROWN_HAMSTER_BOWL = registerBlock("brown_hamster_bowl", hamsterBowlBlock(DyeColor.BROWN));
public static final Block MAGENTA_HAMSTER_BOWL = registerBlock("magenta_hamster_bowl", hamsterBowlBlock(DyeColor.MAGENTA));
public static final Block PINK_HAMSTER_BOWL = registerBlock("pink_hamster_bowl", hamsterBowlBlock(DyeColor.PINK));

public static final Block WHITE_HAMSTER_BOTTLE = registerBlock("white_hamster_bottle", hamsterBottleBlock(DyeColor.WHITE));
public static final Block LIGHT_GRAY_HAMSTER_BOTTLE = registerBlock("light_gray_hamster_bottle", hamsterBottleBlock(DyeColor.LIGHT_GRAY));
public static final Block GRAY_HAMSTER_BOTTLE = registerBlock("gray_hamster_bottle", hamsterBottleBlock(DyeColor.GRAY));
public static final Block BLACK_HAMSTER_BOTTLE = registerBlock("black_hamster_bottle", hamsterBottleBlock(DyeColor.BLACK));
public static final Block BROWN_HAMSTER_BOTTLE = registerBlock("brown_hamster_bottle", hamsterBottleBlock(DyeColor.BROWN));
public static final Block RED_HAMSTER_BOTTLE = registerBlock("red_hamster_bottle", hamsterBottleBlock(DyeColor.RED));
public static final Block ORANGE_HAMSTER_BOTTLE = registerBlock("orange_hamster_bottle", hamsterBottleBlock(DyeColor.ORANGE));
public static final Block YELLOW_HAMSTER_BOTTLE = registerBlock("yellow_hamster_bottle", hamsterBottleBlock(DyeColor.YELLOW));
public static final Block LIME_HAMSTER_BOTTLE = registerBlock("lime_hamster_bottle", hamsterBottleBlock(DyeColor.LIME));
public static final Block GREEN_HAMSTER_BOTTLE = registerBlock("green_hamster_bottle", hamsterBottleBlock(DyeColor.GREEN));
public static final Block CYAN_HAMSTER_BOTTLE = registerBlock("cyan_hamster_bottle", hamsterBottleBlock(DyeColor.CYAN));
public static final Block BLUE_HAMSTER_BOTTLE = registerBlock("blue_hamster_bottle", hamsterBottleBlock(DyeColor.BLUE));
public static final Block LIGHT_BLUE_HAMSTER_BOTTLE = registerBlock("light_blue_hamster_bottle", hamsterBottleBlock(DyeColor.LIGHT_BLUE));
public static final Block PINK_HAMSTER_BOTTLE = registerBlock("pink_hamster_bottle", hamsterBottleBlock(DyeColor.PINK));
public static final Block MAGENTA_HAMSTER_BOTTLE = registerBlock("magenta_hamster_bottle", hamsterBottleBlock(DyeColor.MAGENTA));
public static final Block BLUE_HAMSTER_BOTTLE = registerBlock("blue_hamster_bottle", hamsterBottleBlock(DyeColor.BLUE));
public static final Block PURPLE_HAMSTER_BOTTLE = registerBlock("purple_hamster_bottle", hamsterBottleBlock(DyeColor.PURPLE));
public static final Block WHITE_HAMSTER_BOTTLE = registerBlock("white_hamster_bottle", hamsterBottleBlock(DyeColor.WHITE));
public static final Block LIGHT_GRAY_HAMSTER_BOTTLE = registerBlock("light_gray_hamster_bottle", hamsterBottleBlock(DyeColor.LIGHT_GRAY));
public static final Block GRAY_HAMSTER_BOTTLE = registerBlock("gray_hamster_bottle", hamsterBottleBlock(DyeColor.GRAY));
public static final Block BLACK_HAMSTER_BOTTLE = registerBlock("black_hamster_bottle", hamsterBottleBlock(DyeColor.BLACK));
public static final Block BROWN_HAMSTER_BOTTLE = registerBlock("brown_hamster_bottle", hamsterBottleBlock(DyeColor.BROWN));
public static final Block MAGENTA_HAMSTER_BOTTLE = registerBlock("magenta_hamster_bottle", hamsterBottleBlock(DyeColor.MAGENTA));
public static final Block PINK_HAMSTER_BOTTLE = registerBlock("pink_hamster_bottle", hamsterBottleBlock(DyeColor.PINK));

// endregion

Expand Down
Loading

0 comments on commit 4167425

Please sign in to comment.