Class Central
java.lang.Object
com.jeff.pets.client.Central
This class is the "central" of the logic that despawns, spawns, and swaps out pets, as well as creating all the commands.
It contains important logic and methods to manage the pets, additionally one of the entrypoints.
to run a large amount of logic in the
Central() method.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic ClientAllaystatic AngryGhaststatic ClientArmadillostatic ClientAxolotlstatic ClientBatstatic Batatostatic ClientBeestatic ClientBlazestatic ClientBoggedstatic ClientBreezestatic ClientCamelstatic ClientCatstatic ClientCaveSpiderstatic ClientChickenstatic ClientCodstatic PetsConfigstatic ClientCopperGolemstatic ClientCowstatic ClientCreakingstatic ClientCreeperstatic final CopyOnWriteArrayList<String> static DiamondChickenstatic com.mojang.brigadier.CommandDispatcher<?> static ClientDolphinstatic ClientDonkeystatic ClientDrownedstatic Duckstatic DumboOctopusstatic ClientElderGuardianstatic ClientEnderDragonstatic ClientEndermanstatic ClientEndermitestatic ClientEvokerstatic ClientFoxstatic ClientFrogstatic ClientGhaststatic ClientGoatstatic com.google.gson.Gsonstatic ClientGuardianstatic ClientHappyGhaststatic Headstatic ClientHoglinstatic ClientHorsestatic ClientHuskstatic ClientIronGolemstatic Koistatic ClientLlamastatic LoveGolemstatic ClientMagmaCubestatic MegaSpudstatic MoonCowstatic ClientMooshroomstatic ClientNautilusstatic NerdCreeperstatic ClientPandastatic ClientParchedstatic ClientParrotstatic Penguinstatic final com.mojang.brigadier.suggestion.SuggestionProvider<net.minecraft.commands.SharedSuggestionProvider> static intstatic ClientPhantomstatic ClientPigstatic ClientPiglinstatic ClientPillagerstatic PinkWitherstatic PlaguewhaleSlabstatic PoisonousPotatoZombiestatic ClientPolarBearstatic PotatoHuskstatic ClientPufferFishstatic ClientRabbitstatic Racoonstatic ClientRavagerstatic RayTracingstatic RedstoneBugstatic ClientSalmonstatic ClientSheepstatic ClientShulkerstatic ClientSilverfishstatic ClientSkeletonstatic ClientSlimestatic SmilingCreeperstatic ClientSnifferstatic ClientSnowGolemstatic ClientSpiderstatic ClientSquidstatic Stingraystatic ClientStraystatic ClientStriderstatic ClientSulfurCubestatic final List<net.minecraft.world.entity.Entity> static ClientTadpolestatic ToxifinSlabstatic Traitorstatic ClientTurtlestatic ClientVexstatic ClientVillagerstatic ClientVindicatorstatic ClientWanderingTraderstatic ClientWardenstatic ClientWitchstatic ClientWitherstatic ClientWitherSkeletonstatic ClientWolfstatic ClientZombiestatic ClientZombieVillager -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidUtilizes theUtilsclass to set anynullStrings that might appear to a default value before they invoke aNullPointerException.static voidcheckValidPet(boolean isValid, com.mojang.brigadier.context.CommandContext<?> ignored, String species) static voidcreatePetCommand(net.neoforged.neoforge.client.event.RegisterClientCommandsEvent event) static voidcreatePetSkinCommand(net.neoforged.neoforge.client.event.RegisterClientCommandsEvent event) Creates the command that allows users to use/petskin.static voidstatic voidDespawns the entity to ensure that only one is present at a time.static net.minecraft.world.level.block.BlockgetBlockFromString(String string) static voidrefreshChatSuggestor(net.minecraft.client.Minecraft client) Refreshes the chat suggestions so that the user sees a fresh set of suggestions when changing their pet.static voidRuns every tick in thecreateTickWatcher(ClientTickEvent.Post)below.static voidstatic voidControls the base logic for how and when to summon the pets.static voidupdateSuggestions(net.minecraft.client.Minecraft client) Assigns the correct matching suggestions depending on what the current active pet is.
-
Field Details
-
summonedEntity
-
currentSuggestions
-
BEE_SKINS
-
FOX_SKINS
-
LLAMA_SKINS
-
NAUTILUS_SKINS
-
PANDA_SKINS
-
PIGLIN_SKINS
-
WOLF_SKINS
-
PETS_LIST
-
PETS
public static final com.mojang.brigadier.suggestion.SuggestionProvider<net.minecraft.commands.SharedSuggestionProvider> PETS -
GSON
public static com.google.gson.Gson GSON -
CONFIG
-
petSkin
public static int petSkin -
duck
-
racoon
-
penguin
-
sheep
-
cat
-
allay
-
armadillo
-
axolotl
-
bat
-
camel
-
chicken
-
cod
-
copperGolem
-
cow
-
donkey
-
frog
-
horse
-
mooshroom
-
parrot
-
happyGhast
-
pig
-
rabbit
-
salmon
-
sniffer
-
snowGolem
-
squid
-
strider
-
tadpole
-
turtle
-
villager
-
wanderingTrader
-
bee
-
caveSpider
-
dolphin
-
enderman
-
fox
-
goat
-
ironGolem
-
llama
-
nautilus
-
panda
-
piglin
-
polarBear
-
pufferFish
-
spider
-
wolf
-
blaze
-
breeze
-
creaking
-
creeper
-
elderGuardian
-
endermite
-
evoker
-
ghast
-
guardian
-
hoglin
-
magmaCube
-
phantom
-
pillager
-
ravager
-
shulker
-
silverfish
-
skeleton
-
slime
-
vex
-
vindicator
-
warden
-
witch
-
zombie
-
zombieVillager
-
husk
-
drowned
-
bogged
-
parched
-
stray
-
witherSkeleton
-
enderDragon
-
wither
-
angryGhast
-
batato
-
diamondChicken
-
loveGolem
-
megaSpud
-
moonCow
-
nerdCreeper
-
pinkWither
-
plaguewhaleSlab
-
poisonousPotatoZombie
-
rayTracing
-
redstoneBug
-
smilingCreeper
-
toxifinSlab
-
potatoHusk
-
head
-
traitor
-
dumboOctopus
-
koi
-
stingray
-
sulfurCube
-
dispatcher
public static com.mojang.brigadier.CommandDispatcher<?> dispatcher
-
-
Constructor Details
-
Central
public Central()Required constructor that calls the initial code.- Initializes all of the commands
- Gets the default head skin
- Registers the config
Do NOT ever call CONFIG before it is called here or in any other mod initializer implementation, as it will cause a
RuntimeException.
-
-
Method Details
-
createPetCommand
public static void createPetCommand(net.neoforged.neoforge.client.event.RegisterClientCommandsEvent event) -
despawnPet
public static void despawnPet()Despawns the entity to ensure that only one is present at a time. For the helper method used, seeUtils.despawnEntity(Entity) -
summonPet
public static void summonPet()Controls the base logic for how and when to summon the pets. For the helper methods used, seeUtils.summonPet(AbstractPet, String) -
refreshPetNames
public static void refreshPetNames()Runs every tick in thecreateTickWatcher(ClientTickEvent.Post)below. Checks if the entities' names match the name defined in the config, and if they don't, assings them the correct name. For the helper methods used, seeUtils.checkName(String, AbstractPet, String) -
updateSuggestions
public static void updateSuggestions(net.minecraft.client.Minecraft client) Assigns the correct matching suggestions depending on what the current active pet is.- See Also:
-
refreshChatSuggestor
public static void refreshChatSuggestor(net.minecraft.client.Minecraft client) Refreshes the chat suggestions so that the user sees a fresh set of suggestions when changing their pet.- See Also:
-
saveConfig
public static void saveConfig() -
createPetSkinCommand
public static void createPetSkinCommand(net.neoforged.neoforge.client.event.RegisterClientCommandsEvent event) Creates the command that allows users to use/petskin. Some of the code is slightly malformed (specifically theswitchstatements) as this file was re-created from a bytecode after a change messed it up around version0.6.0 -
checkValidPet
public static void checkValidPet(boolean isValid, com.mojang.brigadier.context.CommandContext<?> ignored, String species) -
getBlockFromString
-
checkForNullObjects
public void checkForNullObjects()Utilizes theUtilsclass to set anynullStrings that might appear to a default value before they invoke aNullPointerException. -
createPetsList
public static void createPetsList()
-