├── forge ├── gradle.properties └── src │ └── main │ ├── resources │ ├── pack.mcmeta │ ├── morecommands.mixins.json │ └── META-INF │ │ └── mods.toml │ └── java │ └── com │ └── ptsmods │ └── morecommands │ └── mixin │ └── forge │ ├── MixinServerGamePacketListenerImpl.java │ └── MixinHopperBlockEntity.java ├── common ├── Compat │ ├── Compat17 │ │ ├── forge │ │ │ ├── gradle.properties │ │ │ └── build.gradle │ │ ├── src │ │ │ └── main │ │ │ │ ├── resources │ │ │ │ └── morecommands_compat17.mixins.json │ │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── ptsmods │ │ │ │ └── morecommands │ │ │ │ ├── mixin │ │ │ │ └── compat │ │ │ │ │ └── compat17 │ │ │ │ │ └── MixinServerWorld.java │ │ │ │ └── miscellaneous │ │ │ │ ├── EESoundOld.java │ │ │ │ └── CopySoundOld.java │ │ └── build.gradle │ ├── Compat18 │ │ ├── forge │ │ │ ├── gradle.properties │ │ │ ├── build.gradle │ │ │ └── src │ │ │ │ └── main │ │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── ptsmods │ │ │ │ └── morecommands │ │ │ │ └── forge │ │ │ │ └── compat │ │ │ │ └── ForgeCompat18.java │ │ ├── build.gradle │ │ └── src │ │ │ └── main │ │ │ ├── java │ │ │ └── com │ │ │ │ └── ptsmods │ │ │ │ └── morecommands │ │ │ │ ├── compat │ │ │ │ └── Compat18.java │ │ │ │ └── mixin │ │ │ │ └── compat │ │ │ │ └── compat18 │ │ │ │ ├── min │ │ │ │ ├── MixinTitleScreen.java │ │ │ │ ├── MixinSnowBlock.java │ │ │ │ ├── MixinBackgroundRenderer.java │ │ │ │ └── MixinLightmapTextureManager.java │ │ │ │ └── plus │ │ │ │ └── MixinServerWorld.java │ │ │ └── resources │ │ │ └── morecommands_compat18.mixins.json │ ├── Compat180 │ │ ├── forge │ │ │ ├── gradle.properties │ │ │ └── build.gradle │ │ ├── src │ │ │ └── main │ │ │ │ └── resources │ │ │ │ └── morecommands_compat180.mixins.json │ │ └── build.gradle │ ├── Compat182 │ │ ├── forge │ │ │ ├── gradle.properties │ │ │ └── build.gradle │ │ ├── src │ │ │ └── main │ │ │ │ ├── resources │ │ │ │ └── morecommands_compat182.mixins.json │ │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── ptsmods │ │ │ │ └── morecommands │ │ │ │ └── mixin │ │ │ │ └── compat │ │ │ │ └── compat182 │ │ │ │ └── plus │ │ │ │ └── MixinLivingEntity.java │ │ └── build.gradle │ ├── Compat19 │ │ ├── forge │ │ │ ├── gradle.properties │ │ │ └── build.gradle │ │ ├── src │ │ │ └── main │ │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── ptsmods │ │ │ │ │ └── morecommands │ │ │ │ │ ├── mixin │ │ │ │ │ └── compat │ │ │ │ │ │ └── compat19 │ │ │ │ │ │ ├── plus │ │ │ │ │ │ ├── MixinArgumentTypesAccessor.java │ │ │ │ │ │ ├── MixinKeybindResolverAccessor.java │ │ │ │ │ │ ├── MixinLightmapTextureManager.java │ │ │ │ │ │ ├── MixinSnowBlock.java │ │ │ │ │ │ ├── reach │ │ │ │ │ │ │ └── MixinServerGamePacketListenerImpl.java │ │ │ │ │ │ └── MixinBackgroundRenderer.java │ │ │ │ │ │ └── until194 │ │ │ │ │ │ └── MixinTitleScreen.java │ │ │ │ │ └── miscellaneous │ │ │ │ │ ├── ArgumentTypePropertiesImpl.java │ │ │ │ │ ├── EESoundNew.java │ │ │ │ │ └── CopySoundNew.java │ │ │ │ └── resources │ │ │ │ └── morecommands_compat19.mixins.json │ │ └── build.gradle │ ├── Compat190 │ │ ├── forge │ │ │ ├── gradle.properties │ │ │ └── build.gradle │ │ ├── src │ │ │ └── main │ │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── ptsmods │ │ │ │ │ └── morecommands │ │ │ │ │ ├── compat │ │ │ │ │ └── client │ │ │ │ │ │ └── ClientCompat190.java │ │ │ │ │ └── mixin │ │ │ │ │ └── compat │ │ │ │ │ └── compat190 │ │ │ │ │ ├── min │ │ │ │ │ └── MixinChatComponentAccessor.java │ │ │ │ │ ├── MixinLocalPlayer.java │ │ │ │ │ ├── MixinLocalPlayerAccessor.java │ │ │ │ │ └── until192 │ │ │ │ │ └── MixinPainting.java │ │ │ │ └── resources │ │ │ │ └── morecommands_compat190.mixins.json │ │ └── build.gradle │ ├── Compat191 │ │ ├── forge │ │ │ ├── gradle.properties │ │ │ └── build.gradle │ │ ├── src │ │ │ └── main │ │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── ptsmods │ │ │ │ │ └── morecommands │ │ │ │ │ ├── mixin │ │ │ │ │ └── compat │ │ │ │ │ │ └── compat191 │ │ │ │ │ │ ├── plus │ │ │ │ │ │ ├── MixinChatComponentAccessor.java │ │ │ │ │ │ └── MixinGuiMessageLine.java │ │ │ │ │ │ └── until193 │ │ │ │ │ │ └── MixinLocalPlayer.java │ │ │ │ │ └── compat │ │ │ │ │ ├── client │ │ │ │ │ └── ClientCompat191.java │ │ │ │ │ └── Compat191.java │ │ │ │ └── resources │ │ │ │ └── morecommands_compat191.mixins.json │ │ └── build.gradle │ ├── Compat192 │ │ ├── forge │ │ │ ├── gradle.properties │ │ │ └── build.gradle │ │ └── src │ │ │ └── main │ │ │ ├── java │ │ │ └── com │ │ │ │ └── ptsmods │ │ │ │ └── morecommands │ │ │ │ ├── compat │ │ │ │ ├── Compat192.java │ │ │ │ └── client │ │ │ │ │ └── ClientCompat192.java │ │ │ │ └── mixin │ │ │ │ └── compat │ │ │ │ └── compat192 │ │ │ │ └── min │ │ │ │ ├── MixinItem.java │ │ │ │ └── MixinServerPlayerGameMode.java │ │ │ └── resources │ │ │ └── morecommands_compat192.mixins.json │ ├── Compat193 │ │ ├── forge │ │ │ ├── gradle.properties │ │ │ └── build.gradle │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── ptsmods │ │ │ └── morecommands │ │ │ └── mixin │ │ │ └── compat │ │ │ └── compat193 │ │ │ ├── plus │ │ │ ├── MixinServerPlayerGameMode.java │ │ │ └── MixinFlowingFluid.java │ │ │ ├── min │ │ │ ├── MixinDamageSource.java │ │ │ ├── MixinEditBox.java │ │ │ ├── MixinInventoryScreen.java │ │ │ ├── MixinFarmBlock.java │ │ │ └── MixinCreativeModeInventoryScreen.java │ │ │ └── MixinPainting.java │ ├── Compat194 │ │ ├── forge │ │ │ ├── gradle.properties │ │ │ └── build.gradle │ │ └── src │ │ │ └── main │ │ │ ├── java │ │ │ └── com │ │ │ │ └── ptsmods │ │ │ │ └── morecommands │ │ │ │ └── mixin │ │ │ │ └── compat │ │ │ │ └── compat194 │ │ │ │ └── plus │ │ │ │ ├── MixinChatScreenEditBox.java │ │ │ │ ├── MixinEditBox.java │ │ │ │ ├── MixinLogoRenderer.java │ │ │ │ ├── MixinPainting.java │ │ │ │ ├── MixinInventoryScreen.java │ │ │ │ └── MixinFarmBlock.java │ │ │ └── resources │ │ │ └── morecommands_compat194.mixins.json │ └── build.gradle ├── src │ ├── main │ │ ├── resources │ │ │ ├── architectury.common.json │ │ │ ├── data │ │ │ │ ├── minecraft │ │ │ │ │ └── tags │ │ │ │ │ │ └── damage_type │ │ │ │ │ │ └── bypasses_invulnerability.json │ │ │ │ └── morecommands │ │ │ │ │ └── damage_type │ │ │ │ │ └── suicide.json │ │ │ ├── assets │ │ │ │ └── morecommands │ │ │ │ │ ├── icon.png │ │ │ │ │ ├── sounds │ │ │ │ │ ├── ee.ogg │ │ │ │ │ ├── copy1.ogg │ │ │ │ │ ├── copy2.ogg │ │ │ │ │ └── copy3.ogg │ │ │ │ │ ├── blockstates │ │ │ │ │ └── locked_chest.json │ │ │ │ │ ├── textures │ │ │ │ │ ├── cape.png │ │ │ │ │ ├── crown.png │ │ │ │ │ ├── item │ │ │ │ │ │ ├── air.png │ │ │ │ │ │ ├── cave_air.png │ │ │ │ │ │ └── void_air.png │ │ │ │ │ ├── unknown_contents.png │ │ │ │ │ └── gui │ │ │ │ │ │ └── creative_buttons.png │ │ │ │ │ ├── models │ │ │ │ │ └── block │ │ │ │ │ │ └── locked_chest.json │ │ │ │ │ └── sounds.json │ │ │ ├── morecommands.accesswidener │ │ │ └── morecommands_reach.mixins.json │ │ └── java │ │ │ └── com │ │ │ └── ptsmods │ │ │ └── morecommands │ │ │ ├── util │ │ │ └── tuples │ │ │ │ ├── TriConsumer.java │ │ │ │ └── TriFunction.java │ │ │ ├── miscellaneous │ │ │ ├── MoreCommandsGameRuleVisitor.java │ │ │ └── CustomPrimedTnt.java │ │ │ ├── mixin │ │ │ ├── common │ │ │ │ ├── MixinChatFormatting.java │ │ │ │ ├── accessor │ │ │ │ │ ├── MixinLivingEntityAccessor.java │ │ │ │ │ ├── MixinServerPlayerEntityAccessor.java │ │ │ │ │ ├── MixinAbstractBlockAccessor.java │ │ │ │ │ ├── MixinHopperBlockEntityAccessor.java │ │ │ │ │ ├── MixinClientConnectionAccessor.java │ │ │ │ │ ├── MixinTaskAccessor.java │ │ │ │ │ ├── MixinPlayerAbilitiesAccessor.java │ │ │ │ │ ├── MixinIntegerValueAccessor.java │ │ │ │ │ ├── MixinBooleanValueAccessor.java │ │ │ │ │ ├── MixinSignBlockEntityAccessor.java │ │ │ │ │ ├── MixinEntityTrackerAccessor.java │ │ │ │ │ ├── MixinGameRulesAccessor.java │ │ │ │ │ ├── MixinEntityAccessor.java │ │ │ │ │ ├── MixinFormattingAccessor.java │ │ │ │ │ ├── MixinAttributeSupplierBuilderAccessor.java │ │ │ │ │ ├── MixinAttributeSupplierAccessor.java │ │ │ │ │ ├── MixinBlockBoxAccessor.java │ │ │ │ │ ├── MixinGameModeCommandAccessor.java │ │ │ │ │ ├── MixinScoreboardCriterionAccessor.java │ │ │ │ │ └── MixinPlayerEntityAccessor.java │ │ │ │ ├── MixinWallRedstoneTorchBlock.java │ │ │ │ ├── MixinFlowingFluid.java │ │ │ │ ├── MixinPrimedTnt.java │ │ │ │ ├── MixinIceBlock.java │ │ │ │ ├── MixinGoalSelector.java │ │ │ │ ├── MixinTargetPredicate.java │ │ │ │ ├── MixinLivingEntityOriginsCompat.java │ │ │ │ ├── MixinPlayerInventory.java │ │ │ │ ├── MixinTimeCommand.java │ │ │ │ ├── MixinFluidBlock.java │ │ │ │ ├── MixinPlayerManager.java │ │ │ │ ├── MixinWallSignBlock.java │ │ │ │ ├── MixinClientConnection.java │ │ │ │ ├── MixinExplosion.java │ │ │ │ ├── MixinEntityTrackerEntry.java │ │ │ │ └── MixinAbstractContainerMenu.java │ │ │ └── reach │ │ │ │ ├── MixinBrewingStandBlockEntity.java │ │ │ │ ├── MixinAbstractFurnaceBlockEntity.java │ │ │ │ ├── MixinRandomizableContainerBlockEntity.java │ │ │ │ ├── MixinContainerOpenersCounter.java │ │ │ │ ├── MixinItemCombinerMenu.java │ │ │ │ ├── MixinAbstractContainerMenu.java │ │ │ │ ├── MixinItem.java │ │ │ │ └── MixinContainer.java │ │ │ └── commands │ │ │ ├── unelevated │ │ │ ├── PingCommand.java │ │ │ ├── SuicideCommand.java │ │ │ └── TopCommand.java │ │ │ └── elevated │ │ │ ├── TimeLiteralCommand.java │ │ │ ├── DifficultyLiteralCommand.java │ │ │ ├── ConsoleCommand.java │ │ │ └── BroadcastCommand.java │ └── client │ │ ├── java │ │ └── com │ │ │ └── ptsmods │ │ │ └── morecommands │ │ │ └── client │ │ │ ├── mixin │ │ │ ├── MixinClickEventAction.java │ │ │ ├── accessor │ │ │ │ ├── MixinMouseAccessor.java │ │ │ │ ├── MixinWindowAccessor.java │ │ │ │ ├── MixinClickableWidgetAccessor.java │ │ │ │ ├── MixinMinecraftClientAccessor.java │ │ │ │ ├── MixinMapColorAccessor.java │ │ │ │ ├── MixinSuggestionWindowAccessor.java │ │ │ │ ├── MixinAbstractWidgetAccessor.java │ │ │ │ ├── MixinCommandSuggestionsAccessor.java │ │ │ │ └── MixinParticleEngineAccessor.java │ │ │ ├── MixinMouse.java │ │ │ ├── MixinItemModelGenerator.java │ │ │ ├── MixinClientPlayerEntityTweakerooCompat.java │ │ │ ├── MixinEntity.java │ │ │ ├── MixinKeyboard.java │ │ │ ├── MixinStyle.java │ │ │ ├── MixinTextColor.java │ │ │ ├── MixinAbstractClientPlayerEntity.java │ │ │ ├── MixinAbstractButton.java │ │ │ ├── MixinPlayerTabOverlay.java │ │ │ ├── MixinLivingEntityRenderer.java │ │ │ ├── MixinInGameHud.java │ │ │ ├── MixinTitleScreen.java │ │ │ ├── MixinEntityCallbacks.java │ │ │ └── MixinAnvilScreen.java │ │ │ ├── gui │ │ │ └── infohud │ │ │ │ ├── variables │ │ │ │ ├── Variable.java │ │ │ │ ├── DoubleVariable.java │ │ │ │ ├── BooleanVariable.java │ │ │ │ ├── ColourVariable.java │ │ │ │ ├── IntVariable.java │ │ │ │ └── AbstractVariable.java │ │ │ │ └── KeyContext.java │ │ │ ├── util │ │ │ └── VertexConsumerExtensions.java │ │ │ ├── commands │ │ │ ├── CSysInfoCommand.java │ │ │ ├── ScoreCommand.java │ │ │ └── SendCommand.java │ │ │ └── reachmixin │ │ │ ├── MixinGameRenderer.java │ │ │ └── MixinClientPlayerInteractionManager.java │ │ └── resources │ │ └── morecommands_reach-client.mixins.json └── API │ ├── src │ └── main │ │ └── java │ │ └── com │ │ └── ptsmods │ │ └── morecommands │ │ └── api │ │ ├── PTClient.java │ │ ├── addons │ │ ├── ChatComponentAddon.java │ │ ├── SlotAddon.java │ │ ├── AbstractButtonAddon.java │ │ ├── GuiMessageLineAddon.java │ │ ├── PaintingAddon.java │ │ ├── ScalableWidget.java │ │ ├── ItemTabAddon.java │ │ ├── PlayerEntityModelAddon.java │ │ ├── ChatScreenEditBoxMarker.java │ │ ├── ItemModelGeneratorAddon.java │ │ ├── ChatScreenAddon.java │ │ ├── AbstractWidgetAddon.java │ │ ├── CreativeInventoryScreenAddon.java │ │ ├── ScreenAddon.java │ │ ├── GuiMessageAddon.java │ │ ├── EntitySelectorAddon.java │ │ ├── CachedContainerBlockEntity.java │ │ └── BlockModelAddon.java │ │ ├── util │ │ ├── compat │ │ │ ├── ForgeCompatListener.java │ │ │ ├── ForgeCompat.java │ │ │ └── ForgeCompatAdapter.java │ │ ├── extensions │ │ │ ├── StringExtensions.java │ │ │ ├── URLExtensions.java │ │ │ ├── CollectionExtensions.java │ │ │ └── ObjectExtensions.java │ │ └── Util.java │ │ ├── callbacks │ │ ├── PostInitEvent.java │ │ ├── EntityDeathEvent.java │ │ ├── RenderTickEvent.java │ │ ├── CreateWorldEvent.java │ │ ├── PlayerListEvent.java │ │ ├── MouseEvent.java │ │ ├── KeyEvent.java │ │ ├── ClientEntityEvent.java │ │ ├── ChatMessageSendEvent.java │ │ ├── ClientCommandRegistrationEvent.java │ │ ├── EntityTeleportEvent.java │ │ └── PacketReceiveEvent.java │ │ ├── IRainbow.java │ │ ├── arguments │ │ ├── CompatArgumentType.java │ │ ├── ArgumentTypeProperties.java │ │ └── ArgumentTypeSerialiser.java │ │ ├── ClientOnly.java │ │ ├── ClientOnlyDummyImpl.java │ │ ├── miscellaneous │ │ ├── InvSeeScreenHandler.java │ │ └── FormattingColour.java │ │ ├── IDeathTracker.java │ │ ├── MixinAccessWidener.java │ │ └── IDataTrackerHelper.java │ └── build.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── README.md ├── fabric └── src │ ├── main │ ├── resources │ │ └── morecommands.mixins.json │ └── java │ │ └── com │ │ └── ptsmods │ │ └── morecommands │ │ ├── fabric │ │ └── MoreCommandsFabric.java │ │ └── mixin │ │ └── fabric │ │ └── MixinHopperBlockEntity.java │ └── client │ ├── java │ └── com │ │ └── ptsmods │ │ └── morecommands │ │ └── client │ │ ├── fabric │ │ ├── MoreCommandsClientFabric.java │ │ └── ModMenuIntegration.java │ │ └── mixin │ │ └── fabric │ │ └── MixinItemGroupButtonWidgetAccessor.java │ └── resources │ └── morecommands_client_fabric.mixins.json └── gradle.properties /forge/gradle.properties: -------------------------------------------------------------------------------- 1 | loom.platform=forge -------------------------------------------------------------------------------- /common/Compat/Compat17/forge/gradle.properties: -------------------------------------------------------------------------------- 1 | loom.platform = forge 2 | -------------------------------------------------------------------------------- /common/Compat/Compat18/forge/gradle.properties: -------------------------------------------------------------------------------- 1 | loom.platform = forge 2 | -------------------------------------------------------------------------------- /common/Compat/Compat180/forge/gradle.properties: -------------------------------------------------------------------------------- 1 | loom.platform = forge 2 | -------------------------------------------------------------------------------- /common/Compat/Compat182/forge/gradle.properties: -------------------------------------------------------------------------------- 1 | loom.platform = forge 2 | -------------------------------------------------------------------------------- /common/Compat/Compat19/forge/gradle.properties: -------------------------------------------------------------------------------- 1 | loom.platform = forge 2 | -------------------------------------------------------------------------------- /common/Compat/Compat190/forge/gradle.properties: -------------------------------------------------------------------------------- 1 | loom.platform = forge 2 | -------------------------------------------------------------------------------- /common/Compat/Compat191/forge/gradle.properties: -------------------------------------------------------------------------------- 1 | loom.platform = forge 2 | -------------------------------------------------------------------------------- /common/Compat/Compat192/forge/gradle.properties: -------------------------------------------------------------------------------- 1 | loom.platform = forge 2 | -------------------------------------------------------------------------------- /common/Compat/Compat193/forge/gradle.properties: -------------------------------------------------------------------------------- 1 | loom.platform = forge 2 | -------------------------------------------------------------------------------- /common/Compat/Compat194/forge/gradle.properties: -------------------------------------------------------------------------------- 1 | loom.platform = forge 2 | -------------------------------------------------------------------------------- /common/src/main/resources/architectury.common.json: -------------------------------------------------------------------------------- 1 | { 2 | "accessWidener": "morecommands.accesswidener" 3 | } -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PlanetTeamSpeakk/MoreCommands/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /forge/src/main/resources/pack.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "pack": { 3 | "description": "Example Mod", 4 | "pack_format": 8 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /common/src/main/resources/data/minecraft/tags/damage_type/bypasses_invulnerability.json: -------------------------------------------------------------------------------- 1 | { 2 | "values": [ 3 | "morecommands:suicide" 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /common/src/main/resources/data/morecommands/damage_type/suicide.json: -------------------------------------------------------------------------------- 1 | { 2 | "exhaustion": 0.0, 3 | "message_id": "suicide", 4 | "scaling": "never" 5 | } 6 | -------------------------------------------------------------------------------- /common/src/main/resources/assets/morecommands/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PlanetTeamSpeakk/MoreCommands/HEAD/common/src/main/resources/assets/morecommands/icon.png -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/PTClient.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api; 2 | 3 | public interface PTClient { 4 | 5 | void preinit(); 6 | } 7 | -------------------------------------------------------------------------------- /common/src/main/resources/assets/morecommands/sounds/ee.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PlanetTeamSpeakk/MoreCommands/HEAD/common/src/main/resources/assets/morecommands/sounds/ee.ogg -------------------------------------------------------------------------------- /common/src/main/resources/assets/morecommands/blockstates/locked_chest.json: -------------------------------------------------------------------------------- 1 | { 2 | "variants": { 3 | "": { 4 | "model": "morecommands:block/locked_chest" 5 | } 6 | } 7 | } -------------------------------------------------------------------------------- /common/src/main/resources/assets/morecommands/sounds/copy1.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PlanetTeamSpeakk/MoreCommands/HEAD/common/src/main/resources/assets/morecommands/sounds/copy1.ogg -------------------------------------------------------------------------------- /common/src/main/resources/assets/morecommands/sounds/copy2.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PlanetTeamSpeakk/MoreCommands/HEAD/common/src/main/resources/assets/morecommands/sounds/copy2.ogg -------------------------------------------------------------------------------- /common/src/main/resources/assets/morecommands/sounds/copy3.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PlanetTeamSpeakk/MoreCommands/HEAD/common/src/main/resources/assets/morecommands/sounds/copy3.ogg -------------------------------------------------------------------------------- /common/src/main/resources/assets/morecommands/textures/cape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PlanetTeamSpeakk/MoreCommands/HEAD/common/src/main/resources/assets/morecommands/textures/cape.png -------------------------------------------------------------------------------- /common/src/main/resources/assets/morecommands/textures/crown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PlanetTeamSpeakk/MoreCommands/HEAD/common/src/main/resources/assets/morecommands/textures/crown.png -------------------------------------------------------------------------------- /common/src/main/resources/assets/morecommands/textures/item/air.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PlanetTeamSpeakk/MoreCommands/HEAD/common/src/main/resources/assets/morecommands/textures/item/air.png -------------------------------------------------------------------------------- /common/src/main/resources/assets/morecommands/textures/item/cave_air.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PlanetTeamSpeakk/MoreCommands/HEAD/common/src/main/resources/assets/morecommands/textures/item/cave_air.png -------------------------------------------------------------------------------- /common/src/main/resources/assets/morecommands/textures/item/void_air.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PlanetTeamSpeakk/MoreCommands/HEAD/common/src/main/resources/assets/morecommands/textures/item/void_air.png -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/util/tuples/TriConsumer.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.util.tuples; 2 | 3 | public interface TriConsumer { 4 | void accept(T t, U u, V v); 5 | } 6 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/util/tuples/TriFunction.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.util.tuples; 2 | 3 | public interface TriFunction { 4 | R apply(T t, U u, V v); 5 | } 6 | -------------------------------------------------------------------------------- /common/src/main/resources/assets/morecommands/textures/unknown_contents.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PlanetTeamSpeakk/MoreCommands/HEAD/common/src/main/resources/assets/morecommands/textures/unknown_contents.png -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/addons/ChatComponentAddon.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api.addons; 2 | 3 | public interface ChatComponentAddon { 4 | void mc$removeById(int id); 5 | } 6 | -------------------------------------------------------------------------------- /common/src/main/resources/assets/morecommands/textures/gui/creative_buttons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PlanetTeamSpeakk/MoreCommands/HEAD/common/src/main/resources/assets/morecommands/textures/gui/creative_buttons.png -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/addons/SlotAddon.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api.addons; 2 | 3 | public interface SlotAddon { 4 | boolean mc$matchesCurrentSearchItemPredicate(); 5 | } 6 | -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/util/compat/ForgeCompatListener.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api.util.compat; 2 | 3 | public interface ForgeCompatListener { 4 | void registerListeners(); 5 | } 6 | -------------------------------------------------------------------------------- /common/src/main/resources/assets/morecommands/models/block/locked_chest.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "minecraft:block/cube_all", 3 | "textures": { 4 | "all": "minecraft:this_texture_should_be_missing__ignore_the_error" 5 | } 6 | } -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/addons/AbstractButtonAddon.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api.addons; 2 | 3 | public interface AbstractButtonAddon { 4 | void setIgnoreKeys(boolean ignoreKeys); 5 | } 6 | -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/addons/GuiMessageLineAddon.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api.addons; 2 | 3 | public interface GuiMessageLineAddon { 4 | void mc$setParentId(int id); 5 | int mc$getParentId(); 6 | } 7 | -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/addons/PaintingAddon.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api.addons; 2 | 3 | public interface PaintingAddon { 4 | Object mc$getVariant(); 5 | 6 | void mc$setVariant(Object variant); 7 | } 8 | -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/addons/ScalableWidget.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api.addons; 2 | 3 | public interface ScalableWidget { 4 | 5 | void setAutoScale(boolean autoScale); 6 | boolean isAutoScale(); 7 | } 8 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | *.ipr 3 | run/ 4 | *.iws 5 | out/ 6 | *.iml 7 | .gradle/ 8 | output/ 9 | bin/ 10 | libs/ 11 | 12 | .classpath 13 | .project 14 | .idea/ 15 | classes/ 16 | .metadata 17 | .vscode 18 | .settings 19 | *.launch 20 | .architectury-transformer/ -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/addons/ItemTabAddon.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api.addons; 2 | 3 | import net.minecraft.world.item.CreativeModeTab; 4 | 5 | public interface ItemTabAddon { 6 | void setTab(CreativeModeTab tab); 7 | } 8 | -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/addons/PlayerEntityModelAddon.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api.addons; 2 | 3 | import net.minecraft.client.model.geom.ModelPart; 4 | 5 | public interface PlayerEntityModelAddon { 6 | 7 | ModelPart getCrown(); 8 | } 9 | -------------------------------------------------------------------------------- /common/src/main/resources/assets/morecommands/sounds.json: -------------------------------------------------------------------------------- 1 | { 2 | "copy": { 3 | "sounds": [ 4 | "morecommands:copy1", 5 | "morecommands:copy2", 6 | "morecommands:copy3" 7 | ] 8 | }, 9 | "ee": { 10 | "sounds": [ 11 | "morecommands:ee" 12 | ] 13 | } 14 | } -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/addons/ChatScreenEditBoxMarker.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api.addons; 2 | 3 | // Marker interface for the anonymous subclass of EditBox in ChatScreen. 4 | // Used to force focus on it. 5 | public interface ChatScreenEditBoxMarker {} 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MoreCommands 2 | [MoreCommands](https://minecraft.curseforge.com/projects/morecommands) 3 | The source code of my mod, MoreCommands. 4 | 5 | # Documentation [here](https://morecommands.ptsmods.com/) 6 | -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/addons/ItemModelGeneratorAddon.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api.addons; 2 | 3 | public interface ItemModelGeneratorAddon { 4 | 5 | boolean shouldIgnore(); 6 | 7 | void ignoreNext(); 8 | 9 | void resetIgnore(); 10 | } 11 | -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/addons/ChatScreenAddon.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api.addons; 2 | 3 | import net.minecraft.client.gui.components.ChatComponent; 4 | 5 | public interface ChatScreenAddon { 6 | GuiMessageAddon mc$getLine(ChatComponent hud, double x, double y); 7 | } 8 | -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/addons/AbstractWidgetAddon.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api.addons; 2 | 3 | public interface AbstractWidgetAddon { 4 | void setValidButtons(int... buttons); 5 | 6 | int getLastMouseButton(); 7 | 8 | void setFocusable(boolean focusable); 9 | } 10 | -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/addons/CreativeInventoryScreenAddon.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api.addons; 2 | 3 | import net.minecraft.client.gui.components.Button; 4 | 5 | public interface CreativeInventoryScreenAddon { 6 | Button mc$getPagerPrev(); 7 | 8 | Button mc$getPagerNext(); 9 | } 10 | -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/callbacks/PostInitEvent.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api.callbacks; 2 | 3 | import dev.architectury.event.Event; 4 | import dev.architectury.event.EventFactory; 5 | 6 | public interface PostInitEvent { 7 | Event EVENT = EventFactory.createLoop(); 8 | 9 | void postInit(); 10 | } 11 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/miscellaneous/MoreCommandsGameRuleVisitor.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.miscellaneous; 2 | 3 | import net.minecraft.world.level.GameRules; 4 | 5 | public interface MoreCommandsGameRuleVisitor { 6 | default > void visitMCEnum(GameRules.Key> key, GameRules.Type> type) {} 7 | } 8 | -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/util/extensions/StringExtensions.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api.util.extensions; 2 | 3 | import java.util.stream.Stream; 4 | 5 | public class StringExtensions { 6 | 7 | public static Stream charStream(String self) { 8 | return self.chars().mapToObj(i -> (char) i); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/common/MixinChatFormatting.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.common; 2 | 3 | import net.minecraft.ChatFormatting; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | 6 | // Empty mixin, only used so we get the pre-mixin ClassNode in the plugin. 7 | @Mixin(ChatFormatting.class) 8 | public class MixinChatFormatting { 9 | } 10 | -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/util/extensions/URLExtensions.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api.util.extensions; 2 | 3 | import lombok.SneakyThrows; 4 | 5 | import java.net.URI; 6 | import java.net.URL; 7 | 8 | public class URLExtensions { 9 | 10 | @SneakyThrows 11 | public static URI toURISneaky(URL self) { 12 | return self.toURI(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/addons/ScreenAddon.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api.addons; 2 | 3 | import java.util.List; 4 | import net.minecraft.client.gui.components.AbstractWidget; 5 | 6 | public interface ScreenAddon { 7 | void mc$clear(); 8 | 9 | List mc$getButtons(); 10 | 11 | T mc$addButton(T button); 12 | } 13 | -------------------------------------------------------------------------------- /common/Compat/Compat17/src/main/resources/morecommands_compat17.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "minVersion": "0.8", 4 | "package": "com.ptsmods.morecommands.mixin.compat.compat17", 5 | "plugin": "com.ptsmods.morecommands.plugin.Plugin17", 6 | "compatibilityLevel": "JAVA_16", 7 | "mixins": [ 8 | "MixinServerWorld" 9 | ], 10 | "injectors": { 11 | "defaultRequire": 1 12 | } 13 | } -------------------------------------------------------------------------------- /common/src/client/java/com/ptsmods/morecommands/client/mixin/MixinClickEventAction.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.client.mixin; 2 | 3 | import net.minecraft.network.chat.ClickEvent; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | 6 | // Empty mixin, just so we can get the ClassNode to add our own enum values to. 7 | @Mixin(ClickEvent.Action.class) 8 | public class MixinClickEventAction { 9 | } 10 | -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/IRainbow.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api; 2 | 3 | public interface IRainbow { 4 | 5 | @SuppressWarnings("deprecation") // Not API 6 | static IRainbow get() { 7 | return Holder.getRainbow(); 8 | } 9 | 10 | int getRainbowColour(boolean includeIndex); 11 | 12 | int getRainbowColour(boolean includeIndex, float transparency); 13 | } 14 | -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/addons/GuiMessageAddon.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api.addons; 2 | 3 | import net.minecraft.network.chat.Component; 4 | 5 | public interface GuiMessageAddon { 6 | 7 | void mc$setStringContent(String content); 8 | String mc$getStringContent(); 9 | Component mc$getRichContent(); 10 | String mc$getStrippedContent(); 11 | int mc$getId(); 12 | } 13 | -------------------------------------------------------------------------------- /fabric/src/main/resources/morecommands.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "plugin": "com.ptsmods.morecommands.fabric.MixinPlugin", 4 | "package": "com.ptsmods.morecommands.mixin.fabric", 5 | "compatibilityLevel": "JAVA_16", 6 | "minVersion": "0.8", 7 | "mixins": [ 8 | "MixinHopperBlockEntity" 9 | ], 10 | "server": [ 11 | "MixinMain" 12 | ], 13 | "injectors": { 14 | "defaultRequire": 1 15 | } 16 | } -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/arguments/CompatArgumentType.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api.arguments; 2 | 3 | import com.mojang.brigadier.arguments.ArgumentType; 4 | 5 | public interface CompatArgumentType, T, P extends ArgumentTypeProperties> extends ArgumentType { 6 | ArgumentType toVanillaArgumentType(); 7 | 8 | P getProperties(); 9 | } 10 | -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/callbacks/EntityDeathEvent.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api.callbacks; 2 | 3 | import dev.architectury.event.Event; 4 | import dev.architectury.event.EventFactory; 5 | import net.minecraft.world.entity.Entity; 6 | 7 | public interface EntityDeathEvent { 8 | Event EVENT = EventFactory.createLoop(); 9 | 10 | void onDeath(Entity entity); 11 | } 12 | -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/callbacks/RenderTickEvent.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api.callbacks; 2 | 3 | import dev.architectury.event.Event; 4 | import dev.architectury.event.EventFactory; 5 | 6 | public interface RenderTickEvent { 7 | Event PRE = EventFactory.createLoop(); 8 | Event POST = EventFactory.createLoop(); 9 | 10 | void render(boolean tick); 11 | } 12 | -------------------------------------------------------------------------------- /common/Compat/Compat194/src/main/java/com/ptsmods/morecommands/mixin/compat/compat194/plus/MixinChatScreenEditBox.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.compat.compat194.plus; 2 | 3 | import com.ptsmods.morecommands.api.addons.ChatScreenEditBoxMarker; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | 6 | @Mixin(targets = "net/minecraft/client/gui/screens/ChatScreen$1") 7 | public class MixinChatScreenEditBox implements ChatScreenEditBoxMarker {} 8 | -------------------------------------------------------------------------------- /common/src/client/resources/morecommands_reach-client.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "minVersion": "0.8", 4 | "package": "com.ptsmods.morecommands.client.reachmixin", 5 | "compatibilityLevel": "JAVA_16", 6 | "plugin": "com.ptsmods.morecommands.mixin.ReachConfigPlugin", 7 | "client": [ 8 | "MixinClientPlayerInteractionManager", 9 | "MixinGameRenderer" 10 | ], 11 | "injectors": { 12 | "defaultRequire": 1 13 | } 14 | } -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/callbacks/CreateWorldEvent.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api.callbacks; 2 | 3 | import dev.architectury.event.Event; 4 | import dev.architectury.event.EventFactory; 5 | import net.minecraft.server.MinecraftServer; 6 | 7 | public interface CreateWorldEvent { 8 | Event EVENT = EventFactory.createLoop(); 9 | 10 | void createWorlds(MinecraftServer server); 11 | } 12 | -------------------------------------------------------------------------------- /fabric/src/main/java/com/ptsmods/morecommands/fabric/MoreCommandsFabric.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.fabric; 2 | 3 | import com.ptsmods.morecommands.MoreCommands; 4 | import net.fabricmc.api.ModInitializer; 5 | 6 | public class MoreCommandsFabric implements ModInitializer { 7 | @Override 8 | public void onInitialize() { 9 | MoreCommands.init(); 10 | MoreCommands.INSTANCE.registerAttributes(true); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/common/accessor/MixinLivingEntityAccessor.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.common.accessor; 2 | 3 | import net.minecraft.world.entity.LivingEntity; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.gen.Accessor; 6 | 7 | @Mixin(LivingEntity.class) 8 | public interface MixinLivingEntityAccessor { 9 | @Accessor 10 | void setDead(boolean dead); 11 | } 12 | -------------------------------------------------------------------------------- /fabric/src/client/java/com/ptsmods/morecommands/client/fabric/MoreCommandsClientFabric.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.client.fabric; 2 | 3 | import com.ptsmods.morecommands.client.MoreCommandsClient; 4 | import net.fabricmc.api.ClientModInitializer; 5 | 6 | public class MoreCommandsClientFabric implements ClientModInitializer { 7 | @Override 8 | public void onInitializeClient() { 9 | MoreCommandsClient.init(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/common/accessor/MixinServerPlayerEntityAccessor.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.common.accessor; 2 | 3 | import net.minecraft.server.level.ServerPlayer; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.gen.Accessor; 6 | 7 | @Mixin(ServerPlayer.class) 8 | public interface MixinServerPlayerEntityAccessor { 9 | @Accessor void setLastSentExp(int exp); 10 | } 11 | -------------------------------------------------------------------------------- /common/Compat/Compat180/src/main/resources/morecommands_compat180.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "minVersion": "0.8", 4 | "package": "com.ptsmods.morecommands.mixin.compat.compat180", 5 | "plugin": "com.ptsmods.morecommands.plugin.Plugin180", 6 | "compatibilityLevel": "JAVA_16", 7 | "client": [ 8 | "MixinMinecraft" 9 | ], 10 | "mixins": [ 11 | "min.MixinLivingEntity" 12 | ], 13 | "injectors": { 14 | "defaultRequire": 1 15 | } 16 | } -------------------------------------------------------------------------------- /common/Compat/Compat182/src/main/resources/morecommands_compat182.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "minVersion": "0.8", 4 | "package": "com.ptsmods.morecommands.mixin.compat.compat182", 5 | "plugin": "com.ptsmods.morecommands.plugin.Plugin182", 6 | "compatibilityLevel": "JAVA_16", 7 | "client": [ 8 | "MixinMinecraft" 9 | ], 10 | "mixins": [ 11 | "plus.MixinLivingEntity" 12 | ], 13 | "injectors": { 14 | "defaultRequire": 1 15 | } 16 | } -------------------------------------------------------------------------------- /common/src/client/java/com/ptsmods/morecommands/client/mixin/accessor/MixinMouseAccessor.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.client.mixin.accessor; 2 | 3 | import net.minecraft.client.MouseHandler; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.gen.Invoker; 6 | 7 | @Mixin(MouseHandler.class) 8 | public interface MixinMouseAccessor { 9 | @Invoker 10 | void callOnPress(long window, int button, int action, int mods); 11 | } 12 | -------------------------------------------------------------------------------- /common/src/client/java/com/ptsmods/morecommands/client/mixin/accessor/MixinWindowAccessor.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.client.mixin.accessor; 2 | 3 | import com.mojang.blaze3d.platform.Window; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.gen.Invoker; 6 | 7 | @Mixin(Window.class) 8 | public interface MixinWindowAccessor { 9 | @Invoker 10 | void callOnFramebufferResize(long window, int width, int height); 11 | } 12 | -------------------------------------------------------------------------------- /common/src/client/java/com/ptsmods/morecommands/client/mixin/accessor/MixinClickableWidgetAccessor.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.client.mixin.accessor; 2 | 3 | import net.minecraft.client.gui.components.AbstractWidget; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.gen.Accessor; 6 | 7 | @Mixin(AbstractWidget.class) 8 | public interface MixinClickableWidgetAccessor { 9 | @Accessor 10 | void setHeight(int height); 11 | } 12 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/common/accessor/MixinAbstractBlockAccessor.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.common.accessor; 2 | 3 | import net.minecraft.world.level.block.state.BlockBehaviour; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.gen.Accessor; 6 | 7 | @Mixin(BlockBehaviour.class) 8 | public interface MixinAbstractBlockAccessor { 9 | 10 | @Accessor 11 | boolean isHasCollision(); 12 | } 13 | -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/util/compat/ForgeCompat.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api.util.compat; 2 | 3 | import net.minecraft.server.level.ServerPlayer; 4 | 5 | public interface ForgeCompat { 6 | boolean shouldRegisterListeners(); 7 | 8 | void registerListeners(); 9 | 10 | void registerPermission(String permission, int defaultLevel, String desc); 11 | 12 | boolean checkPermission(ServerPlayer player, String permission); 13 | } 14 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/common/accessor/MixinHopperBlockEntityAccessor.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.common.accessor; 2 | 3 | import net.minecraft.world.level.block.entity.HopperBlockEntity; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.gen.Accessor; 6 | 7 | @Mixin(HopperBlockEntity.class) 8 | public interface MixinHopperBlockEntityAccessor { 9 | @Accessor void setCooldownTime(int cooldown); 10 | } 11 | -------------------------------------------------------------------------------- /forge/src/main/resources/morecommands.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "plugin": "com.ptsmods.morecommands.forge.ConfigPlugin", 4 | "package": "com.ptsmods.morecommands.mixin.forge", 5 | "compatibilityLevel": "JAVA_16", 6 | "minVersion": "0.8", 7 | "client": [ 8 | "MixinCreativeInventoryScreen" 9 | ], 10 | "mixins": [ 11 | "MixinServerGamePacketListenerImpl", 12 | "MixinHopperBlockEntity" 13 | ], 14 | "injectors": { 15 | "defaultRequire": 1 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/callbacks/PlayerListEvent.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api.callbacks; 2 | 3 | import dev.architectury.event.Event; 4 | import dev.architectury.event.EventFactory; 5 | import net.minecraft.client.multiplayer.PlayerInfo; 6 | 7 | public interface PlayerListEvent { 8 | Event ADD = EventFactory.createLoop(); 9 | Event REMOVE = EventFactory.createLoop(); 10 | 11 | void call(PlayerInfo entry); 12 | } 13 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/common/accessor/MixinClientConnectionAccessor.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.common.accessor; 2 | 3 | import io.netty.channel.Channel; 4 | import net.minecraft.network.Connection; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.gen.Accessor; 7 | 8 | @Mixin(Connection.class) 9 | public interface MixinClientConnectionAccessor { 10 | 11 | @Accessor 12 | void setChannel(Channel channel); 13 | } 14 | -------------------------------------------------------------------------------- /common/src/client/java/com/ptsmods/morecommands/client/gui/infohud/variables/Variable.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.client.gui.infohud.variables; 2 | 3 | import com.mojang.blaze3d.vertex.PoseStack; 4 | 5 | public interface Variable { 6 | String getName(); 7 | 8 | T getDefaultValue(); 9 | 10 | T fromString(String val); 11 | 12 | void apply(PoseStack matrixStack, Object value); 13 | 14 | void applyDefault(PoseStack matrixStack); 15 | 16 | T upcast(Object value); 17 | } 18 | -------------------------------------------------------------------------------- /common/src/main/resources/morecommands.accesswidener: -------------------------------------------------------------------------------- 1 | accessWidener v2 named 2 | accessible class net/minecraft/world/level/GameRules$Type 3 | accessible method net/minecraft/world/level/GameRules$Type (Ljava/util/function/Supplier;Ljava/util/function/Function;Ljava/util/function/BiConsumer;Lnet/minecraft/world/level/GameRules$VisitorCaller;)V 4 | accessible class net/minecraft/world/level/GameRules$VisitorCaller 5 | accessible class net/minecraft/client/gui/screens/worldselection/EditGameRulesScreen$EntryFactory -------------------------------------------------------------------------------- /common/src/client/java/com/ptsmods/morecommands/client/mixin/accessor/MixinMinecraftClientAccessor.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.client.mixin.accessor; 2 | 3 | import net.minecraft.client.Minecraft; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.gen.Accessor; 6 | 7 | @Mixin(Minecraft.class) 8 | public interface MixinMinecraftClientAccessor { 9 | @Accessor 10 | static int getFps() { 11 | throw new AssertionError("This shouldn't happen."); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /fabric/src/client/resources/morecommands_client_fabric.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "plugin": "com.ptsmods.morecommands.fabric.MixinPlugin", 4 | "package": "com.ptsmods.morecommands.client.mixin.fabric", 5 | "compatibilityLevel": "JAVA_16", 6 | "minVersion": "0.8", 7 | "client": [ 8 | "MixinCreativeInventoryScreen", 9 | "MixinItemGroupButtonWidget", 10 | "MixinItemGroupButtonWidgetAccessor", 11 | "MixinMinecraftClient" 12 | ], 13 | "injectors": { 14 | "defaultRequire": 1 15 | } 16 | } -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/common/accessor/MixinTaskAccessor.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.common.accessor; 2 | 3 | import net.minecraft.world.entity.ai.behavior.Behavior; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.gen.Accessor; 6 | 7 | @Mixin(Behavior.class) 8 | public interface MixinTaskAccessor { 9 | 10 | @Accessor 11 | void setStatus(Behavior.Status status); 12 | 13 | @Accessor 14 | void setEndTimestamp(long endTimestamp); 15 | } 16 | -------------------------------------------------------------------------------- /fabric/src/client/java/com/ptsmods/morecommands/client/fabric/ModMenuIntegration.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.client.fabric; 2 | 3 | import com.ptsmods.morecommands.client.gui.ClientOptionsScreen; 4 | import com.terraformersmc.modmenu.api.ConfigScreenFactory; 5 | import com.terraformersmc.modmenu.api.ModMenuApi; 6 | 7 | public class ModMenuIntegration implements ModMenuApi { 8 | @Override 9 | public ConfigScreenFactory getModConfigScreenFactory() { 10 | return ClientOptionsScreen::new; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/common/accessor/MixinPlayerAbilitiesAccessor.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.common.accessor; 2 | 3 | import net.minecraft.world.entity.player.Abilities; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.gen.Accessor; 6 | 7 | @Mixin(Abilities.class) 8 | public interface MixinPlayerAbilitiesAccessor { 9 | @Accessor("walkingSpeed") void setWalkingSpeed_(float speed); 10 | @Accessor("flyingSpeed") void setFlyingSpeed_(float speed); 11 | } 12 | -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/addons/EntitySelectorAddon.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api.addons; 2 | 3 | import com.mojang.brigadier.exceptions.CommandSyntaxException; 4 | import net.minecraft.commands.CommandSourceStack; 5 | import net.minecraft.world.entity.Entity; 6 | 7 | public interface EntitySelectorAddon { 8 | boolean isTargetOnly(); 9 | 10 | void setTargetOnly(boolean targetOnly); 11 | 12 | Entity getTarget(CommandSourceStack source, boolean playerOnly) throws CommandSyntaxException; 13 | } 14 | -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/callbacks/MouseEvent.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api.callbacks; 2 | 3 | import dev.architectury.event.Event; 4 | import dev.architectury.event.EventFactory; 5 | 6 | public interface MouseEvent { 7 | Event EVENT = EventFactory.of(callbacks -> (button, action, mods) -> { 8 | for (MouseEvent callback : callbacks) if (callback.onMouse(button, action, mods)) return true; 9 | return false; 10 | }); 11 | 12 | boolean onMouse(int button, int action, int mods); 13 | } 14 | -------------------------------------------------------------------------------- /common/src/client/java/com/ptsmods/morecommands/client/mixin/accessor/MixinMapColorAccessor.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.client.mixin.accessor; 2 | 3 | import net.minecraft.world.level.material.MaterialColor; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.gen.Accessor; 6 | 7 | @Mixin(MaterialColor.class) 8 | public interface MixinMapColorAccessor { 9 | 10 | @Accessor("MATERIAL_COLORS") 11 | static MaterialColor[] getMaterialColors() { 12 | throw new AssertionError("This shouldn't happen!"); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx24G 2 | 3 | # https://fabricmc.net/develop 4 | minecraft_version_least=1.17.1 5 | minecraft_version=1.19.4 6 | enabled_platforms=fabric,forge 7 | 8 | archives_base_name=MoreCommands 9 | mod_version=4.1 10 | maven_group=com.ptsmods.morecommands 11 | 12 | # https://juuxel.github.io/architectury-api-versions/ 13 | architectury_version=8.1.79 14 | 15 | # https://fabricmc.net/develop/ 16 | fabric_loader_version=0.14.19 17 | fabric_api_version=0.79.0+1.19.4 18 | 19 | # https://files.minecraftforge.net 20 | forge_version=1.19.4-45.0.49 21 | -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/callbacks/KeyEvent.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api.callbacks; 2 | 3 | import dev.architectury.event.Event; 4 | import dev.architectury.event.EventFactory; 5 | 6 | public interface KeyEvent { 7 | Event EVENT = EventFactory.of(listeners -> (key, scancode, action, mods) -> { 8 | for (KeyEvent listener : listeners) if (listener.onKey(key, scancode, action, mods)) return true; 9 | return false; 10 | }); 11 | 12 | boolean onKey(int key, int scancode, int action, int mods); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/common/accessor/MixinIntegerValueAccessor.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.common.accessor; 2 | 3 | import net.minecraft.world.level.GameRules; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.gen.Invoker; 6 | 7 | @Mixin(GameRules.IntegerValue.class) 8 | public interface MixinIntegerValueAccessor { 9 | @Invoker 10 | static GameRules.Type callCreate(int defaultValue) { 11 | throw new AssertionError("This shouldn't happen."); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/common/accessor/MixinBooleanValueAccessor.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.common.accessor; 2 | 3 | import net.minecraft.world.level.GameRules; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.gen.Invoker; 6 | 7 | @Mixin(GameRules.BooleanValue.class) 8 | public interface MixinBooleanValueAccessor { 9 | @Invoker 10 | static GameRules.Type callCreate(boolean defaultValue) { 11 | throw new AssertionError("This shouldn't happen."); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/callbacks/ClientEntityEvent.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api.callbacks; 2 | 3 | import dev.architectury.event.Event; 4 | import dev.architectury.event.EventFactory; 5 | import net.minecraft.client.multiplayer.ClientLevel; 6 | import net.minecraft.world.entity.Entity; 7 | 8 | public interface ClientEntityEvent { 9 | Event ENTITY_LOAD = EventFactory.createLoop(); 10 | Event ENTITY_UNLOAD = EventFactory.createLoop(); 11 | 12 | void onEntity(ClientLevel world, Entity entity); 13 | } 14 | -------------------------------------------------------------------------------- /common/Compat/Compat17/build.gradle: -------------------------------------------------------------------------------- 1 | architectury { 2 | common(rootProject.enabled_platforms.split(",")) 3 | } 4 | 5 | dependencies { 6 | minecraft "com.mojang:minecraft:1.17.1" 7 | mappings loom.officialMojangMappings() 8 | 9 | // We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies 10 | modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" 11 | modApi "dev.architectury:architectury:2.10.12" 12 | 13 | implementation project(path: ":common:API", configuration: "namedElements") 14 | } 15 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/common/accessor/MixinSignBlockEntityAccessor.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.common.accessor; 2 | 3 | import net.minecraft.network.chat.Component; 4 | import net.minecraft.world.level.block.entity.SignBlockEntity; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.gen.Accessor; 7 | 8 | @Mixin(SignBlockEntity.class) 9 | public interface MixinSignBlockEntityAccessor { 10 | @Accessor 11 | Component[] getMessages(); 12 | 13 | @Accessor 14 | void setIsEditable(boolean editable); 15 | } 16 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/common/accessor/MixinEntityTrackerAccessor.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.common.accessor; 2 | 3 | import net.minecraft.server.level.ServerEntity; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.gen.Accessor; 6 | import org.spongepowered.asm.mixin.gen.Invoker; 7 | 8 | @Mixin(targets = "net/minecraft/server/level/ChunkMap$TrackedEntity") 9 | public interface MixinEntityTrackerAccessor { 10 | @Invoker 11 | void callBroadcastRemoved(); 12 | 13 | @Accessor 14 | ServerEntity getServerEntity(); 15 | } 16 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/common/accessor/MixinGameRulesAccessor.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.common.accessor; 2 | 3 | import net.minecraft.world.level.GameRules; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.gen.Invoker; 6 | 7 | @Mixin(GameRules.class) 8 | public interface MixinGameRulesAccessor { 9 | @Invoker 10 | static > GameRules.Key callRegister(String string, GameRules.Category category, GameRules.Type type) { 11 | throw new AssertionError("This shouldn't happen."); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /fabric/src/client/java/com/ptsmods/morecommands/client/mixin/fabric/MixinItemGroupButtonWidgetAccessor.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.client.mixin.fabric; 2 | 3 | import net.fabricmc.fabric.impl.client.itemgroup.FabricCreativeGuiComponents; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.Pseudo; 6 | import org.spongepowered.asm.mixin.gen.Accessor; 7 | 8 | @Pseudo 9 | @Mixin(FabricCreativeGuiComponents.ItemGroupButtonWidget.class) 10 | public interface MixinItemGroupButtonWidgetAccessor { 11 | @Accessor(remap = false) 12 | FabricCreativeGuiComponents.Type getType(); 13 | } 14 | -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/addons/CachedContainerBlockEntity.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api.addons; 2 | 3 | import net.minecraft.core.BlockPos; 4 | import net.minecraft.world.item.ItemStack; 5 | 6 | import java.util.List; 7 | import java.util.concurrent.atomic.AtomicReference; 8 | import java.util.function.Predicate; 9 | 10 | public interface CachedContainerBlockEntity { 11 | AtomicReference WAITING = new AtomicReference<>(); 12 | 13 | List getCache(); 14 | 15 | void setCache(List cache); 16 | 17 | int contains(Predicate predicate); 18 | } 19 | -------------------------------------------------------------------------------- /common/Compat/Compat190/src/main/java/com/ptsmods/morecommands/compat/client/ClientCompat190.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.compat.client; 2 | 3 | import net.minecraft.client.Minecraft; 4 | import net.minecraft.client.player.LocalPlayer; 5 | 6 | import java.util.Objects; 7 | 8 | public class ClientCompat190 extends ClientCompat19 { 9 | 10 | @Override 11 | public void sendChatOrCmd(String msg, boolean forceChat) { 12 | LocalPlayer player = Objects.requireNonNull(Minecraft.getInstance().player); 13 | if (!msg.startsWith("/") || forceChat) player.chat(msg); 14 | else player.command(msg.substring(1)); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/arguments/ArgumentTypeProperties.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api.arguments; 2 | 3 | import com.ptsmods.morecommands.api.util.compat.Compat; 4 | import net.minecraft.network.FriendlyByteBuf; 5 | 6 | public interface ArgumentTypeProperties, T, P extends ArgumentTypeProperties> { 7 | 8 | A createType(); 9 | 10 | ArgumentTypeSerialiser getSerialiser(); 11 | 12 | void write(FriendlyByteBuf buf); 13 | 14 | default Object toVanillaProperties() { 15 | return Compat.get().newArgumentTypePropertiesImpl(this); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /common/src/client/java/com/ptsmods/morecommands/client/mixin/accessor/MixinSuggestionWindowAccessor.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.client.mixin.accessor; 2 | 3 | import net.minecraft.client.gui.components.CommandSuggestions; 4 | import net.minecraft.client.renderer.Rect2i; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.Mutable; 7 | import org.spongepowered.asm.mixin.gen.Accessor; 8 | 9 | @Mixin(CommandSuggestions.SuggestionsList.class) 10 | public interface MixinSuggestionWindowAccessor { 11 | @Accessor 12 | Rect2i getRect(); 13 | 14 | @Accessor 15 | @Mutable 16 | void setRect(Rect2i area); 17 | } 18 | -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/callbacks/ChatMessageSendEvent.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api.callbacks; 2 | 3 | import dev.architectury.event.Event; 4 | import dev.architectury.event.EventFactory; 5 | import net.fabricmc.api.EnvType; 6 | import net.fabricmc.api.Environment; 7 | 8 | @Environment(EnvType.CLIENT) 9 | public interface ChatMessageSendEvent { 10 | Event EVENT = EventFactory.of(callbacks -> message -> { 11 | for (ChatMessageSendEvent callback : callbacks) message = callback.onMessageSend(message); 12 | return message; 13 | }); 14 | 15 | String onMessageSend(String message); 16 | } 17 | -------------------------------------------------------------------------------- /common/Compat/Compat191/src/main/java/com/ptsmods/morecommands/mixin/compat/compat191/plus/MixinChatComponentAccessor.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.compat.compat191.plus; 2 | 3 | import net.minecraft.client.GuiMessage; 4 | import net.minecraft.client.gui.components.ChatComponent; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.gen.Accessor; 7 | 8 | import java.util.List; 9 | 10 | @Mixin(ChatComponent.class) 11 | public interface MixinChatComponentAccessor { 12 | @Accessor List getAllMessages(); 13 | @Accessor List getTrimmedMessages(); 14 | @Accessor int getChatScrollbarPos(); 15 | } 16 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/common/accessor/MixinEntityAccessor.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.common.accessor; 2 | 3 | import net.minecraft.world.entity.Entity; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.gen.Accessor; 6 | 7 | @Mixin(Entity.class) 8 | public interface MixinEntityAccessor { 9 | 10 | @Accessor("yRot") 11 | float getYRot_(); 12 | 13 | @Accessor("xRot") 14 | float getXRot_(); 15 | 16 | @Accessor("id") 17 | int getId_(); 18 | 19 | @Accessor("yRot") 20 | void setYRot_(float yRot); 21 | 22 | @Accessor("xRot") 23 | void setXRot_(float xRot); 24 | } 25 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/common/accessor/MixinFormattingAccessor.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.common.accessor; 2 | 3 | import net.minecraft.ChatFormatting; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.Mutable; 6 | import org.spongepowered.asm.mixin.gen.Accessor; 7 | 8 | import java.util.regex.Pattern; 9 | 10 | @Mixin(ChatFormatting.class) 11 | public interface MixinFormattingAccessor { 12 | @Accessor("STRIP_FORMATTING_PATTERN") 13 | @Mutable 14 | static void setStripFormattingPattern(Pattern pattern) { 15 | throw new AssertionError("This shouldn't happen."); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /common/Compat/Compat191/src/main/java/com/ptsmods/morecommands/compat/client/ClientCompat191.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.compat.client; 2 | 3 | import net.minecraft.client.Minecraft; 4 | import net.minecraft.client.player.LocalPlayer; 5 | 6 | import java.util.Objects; 7 | 8 | public class ClientCompat191 extends ClientCompat190 { 9 | 10 | @Override 11 | public void sendChatOrCmd(String msg, boolean forceChat) { 12 | LocalPlayer player = Objects.requireNonNull(Minecraft.getInstance().player); 13 | if (!msg.startsWith("/") || forceChat) player.chatSigned(msg, null); 14 | else player.commandSigned(msg.substring(1), null); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/common/accessor/MixinAttributeSupplierBuilderAccessor.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.common.accessor; 2 | 3 | import net.minecraft.world.entity.ai.attributes.Attribute; 4 | import net.minecraft.world.entity.ai.attributes.AttributeInstance; 5 | import net.minecraft.world.entity.ai.attributes.AttributeSupplier; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.gen.Accessor; 8 | 9 | import java.util.Map; 10 | 11 | @Mixin(AttributeSupplier.Builder.class) 12 | public interface MixinAttributeSupplierBuilderAccessor { 13 | @Accessor Map getBuilder(); 14 | } 15 | -------------------------------------------------------------------------------- /common/Compat/Compat18/build.gradle: -------------------------------------------------------------------------------- 1 | architectury { 2 | common(rootProject.enabled_platforms.split(",")) 3 | } 4 | 5 | dependencies { 6 | minecraft "com.mojang:minecraft:1.18" 7 | mappings loom.officialMojangMappings() 8 | 9 | // We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies 10 | modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" 11 | modApi "dev.architectury:architectury:4.9.83" 12 | 13 | implementation project(path: ":common:API", configuration: "namedElements") 14 | implementation project(path: ":common:Compat:Compat17", configuration: "namedElements") 15 | } 16 | -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/callbacks/ClientCommandRegistrationEvent.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api.callbacks; 2 | 3 | import com.mojang.brigadier.CommandDispatcher; 4 | import dev.architectury.event.Event; 5 | import dev.architectury.event.EventFactory; 6 | import net.fabricmc.api.EnvType; 7 | import net.fabricmc.api.Environment; 8 | import net.minecraft.client.multiplayer.ClientSuggestionProvider; 9 | 10 | @Environment(EnvType.CLIENT) 11 | public interface ClientCommandRegistrationEvent { 12 | Event EVENT = EventFactory.createLoop(); 13 | 14 | void register(CommandDispatcher dispatcher); 15 | } 16 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/common/MixinWallRedstoneTorchBlock.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.common; 2 | 3 | import net.minecraft.world.level.block.Blocks; 4 | import net.minecraft.world.level.block.RedstoneWallTorchBlock; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.Overwrite; 7 | 8 | @Mixin(RedstoneWallTorchBlock.class) 9 | public class MixinWallRedstoneTorchBlock { 10 | /** 11 | * @author PlanetTeamSpeak 12 | * @reason Causes StackOverflowErrors otherwise 13 | */ 14 | @Overwrite 15 | public String getDescriptionId() { 16 | return Blocks.REDSTONE_TORCH.getDescriptionId(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /common/Compat/Compat19/src/main/java/com/ptsmods/morecommands/mixin/compat/compat19/plus/MixinArgumentTypesAccessor.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.compat.compat19.plus; 2 | 3 | import net.minecraft.commands.synchronization.ArgumentTypeInfo; 4 | import net.minecraft.commands.synchronization.ArgumentTypeInfos; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.gen.Accessor; 7 | 8 | import java.util.Map; 9 | 10 | @Mixin(ArgumentTypeInfos.class) 11 | public interface MixinArgumentTypesAccessor { 12 | 13 | @Accessor("BY_CLASS") 14 | static Map, ArgumentTypeInfo> getClassMap() { 15 | throw new AssertionError("This shouldn't happen."); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /common/Compat/Compat194/forge/build.gradle: -------------------------------------------------------------------------------- 1 | architectury { 2 | platformSetupLoomIde() 3 | forge() 4 | } 5 | 6 | dependencies { 7 | minecraft "com.mojang:minecraft:1.19.4" 8 | mappings loom.officialMojangMappings() 9 | 10 | forge "net.minecraftforge:forge:1.19.4-45.0.66" 11 | } 12 | 13 | remapJar { 14 | destinationDirectory.set file(destinationDirectory.get().asFile.toPath().resolve("../devlibs")) 15 | inputFile.set jar.archiveFile 16 | archiveClassifier = "remap" 17 | } 18 | 19 | jar { 20 | destinationDirectory.set file(destinationDirectory.get().asFile.toPath().resolve("../devlibs")) 21 | from zipTree(project.parent.transformProductionForge.archiveFile) 22 | archiveClassifier = null 23 | } 24 | -------------------------------------------------------------------------------- /common/src/client/java/com/ptsmods/morecommands/client/gui/infohud/variables/DoubleVariable.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.client.gui.infohud.variables; 2 | 3 | import com.mojang.blaze3d.vertex.PoseStack; 4 | import java.util.function.BiConsumer; 5 | 6 | public class DoubleVariable extends AbstractVariable { 7 | public DoubleVariable(String name, Double defaultValue, BiConsumer applicator) { 8 | super(name, defaultValue, applicator); 9 | } 10 | 11 | @Override 12 | public Double fromString(String val) { 13 | return Double.parseDouble(val); 14 | } 15 | 16 | @Override 17 | public Double upcast(Object value) { 18 | return (Double) value; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/miscellaneous/CustomPrimedTnt.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.miscellaneous; 2 | 3 | import lombok.Getter; 4 | import net.minecraft.world.entity.LivingEntity; 5 | import net.minecraft.world.entity.item.PrimedTnt; 6 | import net.minecraft.world.level.Level; 7 | import org.jetbrains.annotations.Nullable; 8 | 9 | public class CustomPrimedTnt extends PrimedTnt { 10 | @Getter 11 | private final float power; 12 | 13 | public CustomPrimedTnt(Level level, double x, double y, double z, @Nullable LivingEntity owner, 14 | float power, int fuse) { 15 | super(level, x, y, z, owner); 16 | this.power = power; 17 | setFuse(fuse); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /common/Compat/Compat180/forge/build.gradle: -------------------------------------------------------------------------------- 1 | architectury { 2 | platformSetupLoomIde() 3 | forge() 4 | } 5 | 6 | dependencies { 7 | minecraft "com.mojang:minecraft:1.18" 8 | mappings loom.officialMojangMappings() 9 | 10 | forge "net.minecraftforge:forge:1.18-38.0.17" 11 | } 12 | 13 | remapJar { 14 | destinationDirectory.set file(destinationDirectory.get().asFile.toPath().resolve("../devlibs")) 15 | inputFile.set jar.archiveFile 16 | archiveClassifier = "remap" 17 | } 18 | 19 | jar { 20 | destinationDirectory.set file(destinationDirectory.get().asFile.toPath().resolve("../devlibs")) 21 | from zipTree(project(":common:Compat:Compat180").transformProductionForge.archiveFile) 22 | archiveClassifier = null 23 | } 24 | -------------------------------------------------------------------------------- /common/Compat/Compat19/src/main/java/com/ptsmods/morecommands/mixin/compat/compat19/plus/MixinKeybindResolverAccessor.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.compat.compat19.plus; 2 | 3 | import net.minecraft.network.chat.Component; 4 | import net.minecraft.network.chat.contents.KeybindResolver; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.gen.Accessor; 7 | 8 | import java.util.function.Function; 9 | import java.util.function.Supplier; 10 | 11 | @Mixin(KeybindResolver.class) 12 | public interface MixinKeybindResolverAccessor { 13 | 14 | @Accessor 15 | static Function> getKeyResolver() { 16 | throw new AssertionError("This shouldn't happen."); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /common/Compat/Compat190/forge/build.gradle: -------------------------------------------------------------------------------- 1 | architectury { 2 | platformSetupLoomIde() 3 | forge() 4 | } 5 | 6 | dependencies { 7 | minecraft "com.mojang:minecraft:1.19" 8 | mappings loom.officialMojangMappings() 9 | 10 | forge "net.minecraftforge:forge:1.19-41.1.0" 11 | } 12 | 13 | remapJar { 14 | destinationDirectory.set file(destinationDirectory.get().asFile.toPath().resolve("../devlibs")) 15 | inputFile.set jar.archiveFile 16 | archiveClassifier = "remap" 17 | } 18 | 19 | jar { 20 | destinationDirectory.set file(destinationDirectory.get().asFile.toPath().resolve("../devlibs")) 21 | from zipTree(project(":common:Compat:Compat190").transformProductionForge.archiveFile) 22 | archiveClassifier = null 23 | } 24 | -------------------------------------------------------------------------------- /common/Compat/Compat191/src/main/java/com/ptsmods/morecommands/mixin/compat/compat191/plus/MixinGuiMessageLine.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.compat.compat191.plus; 2 | 3 | import com.ptsmods.morecommands.api.addons.GuiMessageLineAddon; 4 | import net.minecraft.client.GuiMessage; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.Unique; 7 | 8 | @Mixin(GuiMessage.Line.class) 9 | public class MixinGuiMessageLine implements GuiMessageLineAddon { 10 | private @Unique int parentId = -1; 11 | 12 | @Override 13 | public void mc$setParentId(int id) { 14 | parentId = id; 15 | } 16 | 17 | @Override 18 | public int mc$getParentId() { 19 | return parentId; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /common/src/client/java/com/ptsmods/morecommands/client/gui/infohud/variables/BooleanVariable.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.client.gui.infohud.variables; 2 | 3 | import com.mojang.blaze3d.vertex.PoseStack; 4 | import java.util.function.BiConsumer; 5 | 6 | public class BooleanVariable extends AbstractVariable { 7 | public BooleanVariable(String name, Boolean defaultValue, BiConsumer applicator) { 8 | super(name, defaultValue, applicator); 9 | } 10 | 11 | @Override 12 | public Boolean fromString(String val) { 13 | return "true".equalsIgnoreCase(val); 14 | } 15 | 16 | @Override 17 | public Boolean upcast(Object value) { 18 | return (Boolean) value; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /common/Compat/Compat191/forge/build.gradle: -------------------------------------------------------------------------------- 1 | architectury { 2 | platformSetupLoomIde() 3 | forge() 4 | } 5 | 6 | dependencies { 7 | minecraft "com.mojang:minecraft:1.19.1" 8 | mappings loom.officialMojangMappings() 9 | 10 | forge "net.minecraftforge:forge:1.19.1-42.0.9" 11 | } 12 | 13 | remapJar { 14 | destinationDirectory.set file(destinationDirectory.get().asFile.toPath().resolve("../devlibs")) 15 | inputFile.set jar.archiveFile 16 | archiveClassifier = "remap" 17 | } 18 | 19 | jar { 20 | destinationDirectory.set file(destinationDirectory.get().asFile.toPath().resolve("../devlibs")) 21 | from zipTree(project(":common:Compat:Compat191").transformProductionForge.archiveFile) 22 | archiveClassifier = null 23 | } 24 | -------------------------------------------------------------------------------- /common/Compat/Compat192/forge/build.gradle: -------------------------------------------------------------------------------- 1 | architectury { 2 | platformSetupLoomIde() 3 | forge() 4 | } 5 | 6 | dependencies { 7 | minecraft "com.mojang:minecraft:1.19.2" 8 | mappings loom.officialMojangMappings() 9 | 10 | forge "net.minecraftforge:forge:1.19.2-43.1.25" 11 | } 12 | 13 | remapJar { 14 | destinationDirectory.set file(destinationDirectory.get().asFile.toPath().resolve("../devlibs")) 15 | inputFile.set jar.archiveFile 16 | archiveClassifier = "remap" 17 | } 18 | 19 | jar { 20 | destinationDirectory.set file(destinationDirectory.get().asFile.toPath().resolve("../devlibs")) 21 | from zipTree(project(":common:Compat:Compat192").transformProductionForge.archiveFile) 22 | archiveClassifier = null 23 | } 24 | -------------------------------------------------------------------------------- /common/Compat/Compat193/forge/build.gradle: -------------------------------------------------------------------------------- 1 | architectury { 2 | platformSetupLoomIde() 3 | forge() 4 | } 5 | 6 | dependencies { 7 | minecraft "com.mojang:minecraft:1.19.3" 8 | mappings loom.officialMojangMappings() 9 | 10 | forge "net.minecraftforge:forge:1.19.3-44.1.0" 11 | } 12 | 13 | remapJar { 14 | destinationDirectory.set file(destinationDirectory.get().asFile.toPath().resolve("../devlibs")) 15 | inputFile.set jar.archiveFile 16 | archiveClassifier = "remap" 17 | } 18 | 19 | jar { 20 | destinationDirectory.set file(destinationDirectory.get().asFile.toPath().resolve("../devlibs")) 21 | from zipTree(project(":common:Compat:Compat193").transformProductionForge.archiveFile) 22 | archiveClassifier = null 23 | } 24 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/common/MixinFlowingFluid.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.common; 2 | 3 | import com.ptsmods.morecommands.miscellaneous.MoreGameRules; 4 | import net.minecraft.core.BlockPos; 5 | import net.minecraft.world.level.Level; 6 | import net.minecraft.world.level.LevelReader; 7 | import net.minecraft.world.level.block.state.BlockState; 8 | import net.minecraft.world.level.material.FlowingFluid; 9 | import org.spongepowered.asm.mixin.Mixin; 10 | import org.spongepowered.asm.mixin.Shadow; 11 | import org.spongepowered.asm.mixin.injection.At; 12 | import org.spongepowered.asm.mixin.injection.Redirect; 13 | 14 | @Mixin(FlowingFluid.class) 15 | public abstract class MixinFlowingFluid { 16 | 17 | 18 | } 19 | -------------------------------------------------------------------------------- /common/Compat/Compat191/src/main/resources/morecommands_compat191.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "minVersion": "0.8", 4 | "package": "com.ptsmods.morecommands.mixin.compat.compat191", 5 | "plugin": "com.ptsmods.morecommands.plugin.Plugin191", 6 | "compatibilityLevel": "JAVA_16", 7 | "client": [ 8 | "plus.MixinGuiMessage", 9 | "plus.MixinChatComponent", 10 | "until193.MixinLocalPlayer", 11 | "plus.MixinGuiMessageLine", 12 | "plus.MixinChatScreen", 13 | "plus.MixinChatComponentAccessor" 14 | ], 15 | "mixins": [ 16 | "plus.MixinServerGamePacketListenerImpl", 17 | "plus.MixinCommandManagerCarpetCompat", 18 | "plus.MixinPlayerList" 19 | ], 20 | "injectors": { 21 | "defaultRequire": 1 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/commands/unelevated/PingCommand.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.commands.unelevated; 2 | 3 | import com.mojang.brigadier.CommandDispatcher; 4 | import com.ptsmods.morecommands.miscellaneous.Command; 5 | import net.minecraft.commands.CommandSourceStack; 6 | 7 | public class PingCommand extends Command { 8 | @Override 9 | public void register(CommandDispatcher dispatcher) { 10 | dispatcher.register(literalReq("ping") 11 | .executes(ctx -> sendMsg(ctx, "Pong! " + ctx.getSource().getPlayerOrException().latency + " ms latency"))); 12 | } 13 | 14 | @Override 15 | public String getDocsPath() { 16 | return "/unelevated/ping"; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/addons/BlockModelAddon.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api.addons; 2 | 3 | import com.mojang.datafixers.util.Either; 4 | import net.minecraft.client.renderer.block.model.BlockModel; 5 | import net.minecraft.client.renderer.block.model.ItemTransforms; 6 | import net.minecraft.client.resources.model.Material; 7 | import net.minecraft.resources.ResourceLocation; 8 | 9 | import java.util.Map; 10 | 11 | public interface BlockModelAddon { 12 | void setTransforms(ItemTransforms transformations); 13 | 14 | ItemTransforms getRawTransforms(); 15 | 16 | BlockModel getParent(); 17 | 18 | ResourceLocation getParentLocation(); 19 | 20 | Map> getTextureMap(); 21 | } 22 | -------------------------------------------------------------------------------- /common/src/client/java/com/ptsmods/morecommands/client/util/VertexConsumerExtensions.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.client.util; 2 | 3 | import com.mojang.blaze3d.vertex.PoseStack; 4 | import com.mojang.blaze3d.vertex.VertexConsumer; 5 | import com.ptsmods.morecommands.api.util.compat.client.ClientCompat; 6 | 7 | public class VertexConsumerExtensions { 8 | public static VertexConsumer compVertex(VertexConsumer self, PoseStack.Pose pose, float x, float y, float z) { 9 | return ClientCompat.get().vertex(self, pose, x, y, z); 10 | } 11 | 12 | public static VertexConsumer compNormal(VertexConsumer self, PoseStack.Pose pose, float nx, float ny, float nz) { 13 | return ClientCompat.get().normal(self, pose, nx, ny, nz); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /common/src/main/resources/morecommands_reach.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "minVersion": "0.8", 4 | "package": "com.ptsmods.morecommands.mixin.reach", 5 | "compatibilityLevel": "JAVA_16", 6 | "plugin": "com.ptsmods.morecommands.mixin.ReachConfigPlugin", 7 | "mixins": [ 8 | "MixinAbstractFurnaceBlockEntity", 9 | "MixinBrewingStandBlockEntity", 10 | "MixinContainer", 11 | "MixinItemCombinerMenu", 12 | "MixinItem", 13 | "MixinRandomizableContainerBlockEntity", 14 | "MixinReachEntityAttributes", 15 | "MixinAbstractContainerMenu", 16 | "MixinServerPlayerGameMode", 17 | "MixinServerGamePacketListenerImpl", 18 | "MixinContainerOpenersCounter" 19 | ], 20 | "injectors": { 21 | "defaultRequire": 1 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /common/Compat/Compat180/build.gradle: -------------------------------------------------------------------------------- 1 | architectury { 2 | common(rootProject.enabled_platforms.split(",")) 3 | } 4 | 5 | dependencies { 6 | minecraft "com.mojang:minecraft:1.18" 7 | mappings loom.officialMojangMappings() 8 | 9 | // We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies 10 | modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" 11 | modApi "dev.architectury:architectury:4.9.83" 12 | 13 | implementation project(path: ":common:API", configuration: "namedElements") 14 | implementation project(path: ":common:Compat:Compat17", configuration: "namedElements") 15 | implementation project(path: ":common:Compat:Compat18", configuration: "namedElements") 16 | } 17 | -------------------------------------------------------------------------------- /common/Compat/Compat192/src/main/java/com/ptsmods/morecommands/compat/Compat192.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.compat; 2 | 3 | import com.mojang.brigadier.CommandDispatcher; 4 | import dev.architectury.event.events.common.CommandRegistrationEvent; 5 | import net.minecraft.commands.CommandSourceStack; 6 | import net.minecraft.commands.Commands; 7 | 8 | import java.util.function.BiConsumer; 9 | 10 | public class Compat192 extends Compat191 { 11 | 12 | @Override 13 | public void registerCommandRegistrationEventListener(BiConsumer, Commands.CommandSelection> listener) { 14 | CommandRegistrationEvent.EVENT.register((dispatcher, registry, commandSelection) -> listener.accept(dispatcher, commandSelection)); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /common/src/client/java/com/ptsmods/morecommands/client/mixin/accessor/MixinAbstractWidgetAccessor.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.client.mixin.accessor; 2 | 3 | import net.minecraft.client.gui.components.AbstractWidget; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.gen.Accessor; 6 | 7 | @Mixin(AbstractWidget.class) 8 | public interface MixinAbstractWidgetAccessor { 9 | // Since 1.19.3, these fields are accessed via get and set methods. 10 | // Before 1.19.3, these fields were public and those methods didn't exist. 11 | @Accessor("y") 12 | int getY_(); 13 | 14 | @Accessor("y") 15 | void setY_(int y); 16 | 17 | @Accessor("x") 18 | int getX_(); 19 | 20 | @Accessor("x") 21 | void setX_(int x); 22 | } 23 | -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/util/compat/ForgeCompatAdapter.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api.util.compat; 2 | 3 | import net.minecraft.server.level.ServerPlayer; 4 | 5 | public class ForgeCompatAdapter implements ForgeCompat { 6 | @Override 7 | public boolean shouldRegisterListeners() { 8 | return false; 9 | } 10 | 11 | @Override 12 | public void registerListeners() {} 13 | 14 | @Override 15 | public void registerPermission(String permission, int defaultLevel, String desc) { 16 | throw new UnsupportedOperationException(); 17 | } 18 | 19 | @Override 20 | public boolean checkPermission(ServerPlayer player, String permission) { 21 | throw new UnsupportedOperationException(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /common/Compat/Compat192/src/main/java/com/ptsmods/morecommands/mixin/compat/compat192/min/MixinItem.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.compat.compat192.min; 2 | 3 | import com.ptsmods.morecommands.api.addons.ItemTabAddon; 4 | import net.minecraft.world.item.CreativeModeTab; 5 | import net.minecraft.world.item.Item; 6 | import org.spongepowered.asm.mixin.Final; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.Mutable; 9 | import org.spongepowered.asm.mixin.Shadow; 10 | 11 | @Mixin(Item.class) 12 | public class MixinItem implements ItemTabAddon { 13 | 14 | @Shadow @Final @Mutable 15 | protected CreativeModeTab category; 16 | 17 | @Override 18 | public void setTab(CreativeModeTab tab) { 19 | category = tab; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /common/Compat/Compat192/src/main/resources/morecommands_compat192.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "minVersion": "0.8", 4 | "package": "com.ptsmods.morecommands.mixin.compat.compat192", 5 | "plugin": "com.ptsmods.morecommands.plugin.Plugin192", 6 | "compatibilityLevel": "JAVA_16", 7 | "client": [ 8 | "min.MixinClientPacketListener", 9 | "min.MixinItemModelGenerator", 10 | "min.MixinLevelRenderer", 11 | "min.MixinModelBakery", 12 | "min.MixinScreen", 13 | "min.MixinSignEditScreen" 14 | ], 15 | "mixins": [ 16 | "min.MixinEnchantCommand", 17 | "min.MixinEntitySelector", 18 | "min.MixinFlowingFluid", 19 | "min.MixinItem", 20 | "min.MixinServerPlayerGameMode" 21 | ], 22 | "injectors": { 23 | "defaultRequire": 1 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/callbacks/EntityTeleportEvent.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api.callbacks; 2 | 3 | import dev.architectury.event.Event; 4 | import dev.architectury.event.EventFactory; 5 | import net.minecraft.world.entity.Entity; 6 | import net.minecraft.world.level.Level; 7 | import net.minecraft.world.phys.Vec3; 8 | 9 | public interface EntityTeleportEvent { 10 | Event EVENT = EventFactory.of(listeners -> (entity, worldFrom, worldTo, from, to) -> { 11 | for (EntityTeleportEvent listener : listeners) if (listener.onTeleport(entity, worldFrom, worldTo, from, to)) return true; 12 | return false; 13 | }); 14 | 15 | boolean onTeleport(Entity entity, Level worldFrom, Level worldTo, Vec3 from, Vec3 to); 16 | } 17 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/common/accessor/MixinAttributeSupplierAccessor.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.common.accessor; 2 | 3 | import net.minecraft.world.entity.ai.attributes.Attribute; 4 | import net.minecraft.world.entity.ai.attributes.AttributeInstance; 5 | import net.minecraft.world.entity.ai.attributes.AttributeSupplier; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.Mutable; 8 | import org.spongepowered.asm.mixin.gen.Accessor; 9 | 10 | import java.util.Map; 11 | 12 | @Mixin(AttributeSupplier.class) 13 | public interface MixinAttributeSupplierAccessor { 14 | @Accessor Map getInstances(); 15 | @Mutable @Accessor void setInstances(Map instances); 16 | } 17 | -------------------------------------------------------------------------------- /common/Compat/Compat190/src/main/java/com/ptsmods/morecommands/mixin/compat/compat190/min/MixinChatComponentAccessor.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.compat.compat190.min; 2 | 3 | import net.minecraft.client.GuiMessage; 4 | import net.minecraft.client.gui.components.ChatComponent; 5 | import net.minecraft.network.chat.Component; 6 | import net.minecraft.util.FormattedCharSequence; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.gen.Accessor; 9 | 10 | import java.util.List; 11 | 12 | @Mixin(ChatComponent.class) 13 | public interface MixinChatComponentAccessor { 14 | @Accessor List> getAllMessages(); 15 | @Accessor List> getTrimmedMessages(); 16 | @Accessor int getChatScrollbarPos(); 17 | } 18 | -------------------------------------------------------------------------------- /common/Compat/Compat192/src/main/java/com/ptsmods/morecommands/mixin/compat/compat192/min/MixinServerPlayerGameMode.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.compat.compat192.min; 2 | 3 | import net.minecraft.server.level.ServerPlayer; 4 | import net.minecraft.server.level.ServerPlayerGameMode; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Redirect; 8 | 9 | @Mixin(ServerPlayerGameMode.class) 10 | public class MixinServerPlayerGameMode { 11 | // Preventing packet from being sent 12 | @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/ServerPlayer;onUpdateAbilities()V"), method = "setGameModeForPlayer") 13 | public void sendAbilitiesUpdate(ServerPlayer player) {} 14 | } 15 | -------------------------------------------------------------------------------- /common/src/client/java/com/ptsmods/morecommands/client/mixin/MixinMouse.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.client.mixin; 2 | 3 | import com.ptsmods.morecommands.api.callbacks.MouseEvent; 4 | import net.minecraft.client.MouseHandler; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 9 | 10 | @Mixin(MouseHandler.class) 11 | public class MixinMouse { 12 | @Inject(at = @At("HEAD"), method = "onPress", cancellable = true) 13 | private void onMouseButton(long window, int button, int action, int mods, CallbackInfo cbi) { 14 | if (MouseEvent.EVENT.invoker().onMouse(button, action, mods)) cbi.cancel(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/arguments/ArgumentTypeSerialiser.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api.arguments; 2 | 3 | import com.google.gson.JsonObject; 4 | import com.ptsmods.morecommands.api.util.compat.Compat; 5 | import net.minecraft.network.FriendlyByteBuf; 6 | 7 | import java.util.HashMap; 8 | import java.util.Map; 9 | 10 | public interface ArgumentTypeSerialiser, T, P extends ArgumentTypeProperties> { 11 | Map, Object> serialisers = new HashMap<>(); 12 | 13 | A fromPacket(FriendlyByteBuf buf); 14 | 15 | void writeJson(P properties, JsonObject json); 16 | 17 | default Object toVanillaSerialiser() { 18 | return Compat.get().newArgumentSerialiserImpl(this); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /common/Compat/Compat193/src/main/java/com/ptsmods/morecommands/mixin/compat/compat193/plus/MixinServerPlayerGameMode.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.compat.compat193.plus; 2 | 3 | import net.minecraft.server.level.ServerPlayer; 4 | import net.minecraft.server.level.ServerPlayerGameMode; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Redirect; 8 | 9 | @Mixin(ServerPlayerGameMode.class) 10 | public class MixinServerPlayerGameMode { 11 | // Preventing packet from being sent 12 | @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/ServerPlayer;onUpdateAbilities()V"), method = "changeGameModeForPlayer") 13 | public void sendAbilitiesUpdate(ServerPlayer instance) {} 14 | } 15 | -------------------------------------------------------------------------------- /common/src/client/java/com/ptsmods/morecommands/client/gui/infohud/variables/ColourVariable.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.client.gui.infohud.variables; 2 | 3 | import com.mojang.blaze3d.vertex.PoseStack; 4 | import java.awt.*; 5 | import java.util.function.BiConsumer; 6 | 7 | public class ColourVariable extends AbstractVariable { 8 | 9 | public ColourVariable(String name, Color defaultValue, BiConsumer applicator) { 10 | super(name, defaultValue, applicator); 11 | } 12 | 13 | @Override 14 | public Color fromString(String val) { 15 | return new Color(Integer.parseInt(val.startsWith("#") ? val.substring(1) : val, 16)); 16 | } 17 | 18 | @Override 19 | public Color upcast(Object value) { 20 | return (Color) value; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /common/Compat/build.gradle: -------------------------------------------------------------------------------- 1 | architectury { 2 | common(rootProject.enabled_platforms.split(",")) 3 | } 4 | 5 | dependencies { 6 | minecraft "com.mojang:minecraft:${rootProject.minecraft_version}" 7 | mappings loom.officialMojangMappings() 8 | 9 | // We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies 10 | modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" 11 | modApi "dev.architectury:architectury:${rootProject.architectury_version}" 12 | } 13 | 14 | subprojects { 15 | if (name != "forge") { 16 | tasks.register("fixRefmap", RefmapFixTask) { 17 | dependsOn(tasks.remapJar) 18 | } 19 | 20 | remapJar { 21 | finalizedBy fixRefmap 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/reach/MixinBrewingStandBlockEntity.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.reach; 2 | 3 | import com.ptsmods.morecommands.commands.elevated.ReachCommand; 4 | import net.minecraft.world.entity.player.Player; 5 | import net.minecraft.world.level.block.entity.BrewingStandBlockEntity; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.injection.Constant; 8 | import org.spongepowered.asm.mixin.injection.ModifyConstant; 9 | 10 | @Mixin(BrewingStandBlockEntity.class) 11 | public class MixinBrewingStandBlockEntity { 12 | @ModifyConstant(method = "stillValid", constant = @Constant(doubleValue = 64.0D)) 13 | public double canPlayerUse_maxReach(double d, Player player) { 14 | return ReachCommand.getReach(player, true); 15 | } 16 | } -------------------------------------------------------------------------------- /common/Compat/Compat17/forge/build.gradle: -------------------------------------------------------------------------------- 1 | architectury { 2 | platformSetupLoomIde() 3 | forge() 4 | } 5 | 6 | dependencies { 7 | minecraft "com.mojang:minecraft:1.17.1" 8 | mappings loom.officialMojangMappings() 9 | 10 | forge "net.minecraftforge:forge:1.17.1-37.1.1" 11 | implementation project(path: ":common:API", configuration: "namedElements") 12 | } 13 | 14 | remapJar { 15 | destinationDirectory.set file(destinationDirectory.get().asFile.toPath().resolve("../devlibs")) 16 | inputFile.set jar.archiveFile 17 | archiveClassifier = "remap" 18 | } 19 | 20 | jar { 21 | destinationDirectory.set file(destinationDirectory.get().asFile.toPath().resolve("../devlibs")) 22 | from zipTree(project(":common:Compat:Compat17").transformProductionForge.archiveFile) 23 | archiveClassifier = null 24 | } 25 | -------------------------------------------------------------------------------- /common/Compat/Compat18/forge/build.gradle: -------------------------------------------------------------------------------- 1 | architectury { 2 | platformSetupLoomIde() 3 | forge() 4 | } 5 | 6 | dependencies { 7 | minecraft "com.mojang:minecraft:1.18" 8 | mappings loom.officialMojangMappings() 9 | 10 | forge "net.minecraftforge:forge:1.18-38.0.17" 11 | implementation project(path: ":common:API", configuration: "namedElements") 12 | } 13 | 14 | remapJar { 15 | destinationDirectory.set file(destinationDirectory.get().asFile.toPath().resolve("../devlibs")) 16 | inputFile.set jar.archiveFile 17 | archiveClassifier = "remap" 18 | } 19 | 20 | jar { 21 | destinationDirectory.set file(destinationDirectory.get().asFile.toPath().resolve("../devlibs")) 22 | from zipTree(project(":common:Compat:Compat18").transformProductionForge.archiveFile) 23 | archiveClassifier = null 24 | } 25 | -------------------------------------------------------------------------------- /common/Compat/Compat19/forge/build.gradle: -------------------------------------------------------------------------------- 1 | architectury { 2 | platformSetupLoomIde() 3 | forge() 4 | } 5 | 6 | dependencies { 7 | minecraft "com.mojang:minecraft:1.19" 8 | mappings loom.officialMojangMappings() 9 | 10 | forge "net.minecraftforge:forge:1.19-41.1.0" 11 | implementation project(path: ":common:API", configuration: "namedElements") 12 | } 13 | 14 | remapJar { 15 | destinationDirectory.set file(destinationDirectory.get().asFile.toPath().resolve("../devlibs")) 16 | inputFile.set jar.archiveFile 17 | archiveClassifier = "remap" 18 | } 19 | 20 | jar { 21 | destinationDirectory.set file(destinationDirectory.get().asFile.toPath().resolve("../devlibs")) 22 | from zipTree(project(":common:Compat:Compat19").transformProductionForge.archiveFile) 23 | archiveClassifier = null 24 | } 25 | -------------------------------------------------------------------------------- /common/src/client/java/com/ptsmods/morecommands/client/commands/CSysInfoCommand.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.client.commands; 2 | 3 | import com.mojang.brigadier.CommandDispatcher; 4 | import com.ptsmods.morecommands.commands.elevated.SysInfoCommand; 5 | import com.ptsmods.morecommands.client.miscellaneous.ClientCommand; 6 | import net.minecraft.client.multiplayer.ClientSuggestionProvider; 7 | 8 | public class CSysInfoCommand extends ClientCommand { 9 | @Override 10 | public void cRegister(CommandDispatcher dispatcher) { 11 | dispatcher.register(cLiteral("csysinfo") 12 | .executes(ctx -> SysInfoCommand.sendSysInfo(ClientCommand::sendMsg))); 13 | } 14 | 15 | @Override 16 | public String getDocsPath() { 17 | return "/c-sys-info"; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/common/accessor/MixinBlockBoxAccessor.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.common.accessor; 2 | 3 | import net.minecraft.world.level.levelgen.structure.BoundingBox; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.gen.Accessor; 6 | 7 | @Mixin(BoundingBox.class) 8 | public interface MixinBlockBoxAccessor { 9 | // According to this comment: https://www.curseforge.com/minecraft/mc-mods/morecommands?comment=296 10 | // these aren't public in some versions or something like that. 11 | @Accessor("minX") int getMinX_(); 12 | @Accessor("minY") int getMinY_(); 13 | @Accessor("minZ") int getMinZ_(); 14 | @Accessor("maxX") int getMaxX_(); 15 | @Accessor("maxY") int getMaxY_(); 16 | @Accessor("maxZ") int getMaxZ_(); 17 | } 18 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/reach/MixinAbstractFurnaceBlockEntity.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.reach; 2 | 3 | import com.ptsmods.morecommands.commands.elevated.ReachCommand; 4 | import net.minecraft.world.entity.player.Player; 5 | import net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.injection.Constant; 8 | import org.spongepowered.asm.mixin.injection.ModifyConstant; 9 | 10 | @Mixin(AbstractFurnaceBlockEntity.class) 11 | public class MixinAbstractFurnaceBlockEntity { 12 | @ModifyConstant(method = "stillValid", constant = @Constant(doubleValue = 64.0D)) 13 | public double canPlayerUse_maxReach(double d, Player player) { 14 | return ReachCommand.getReach(player, true); 15 | } 16 | } -------------------------------------------------------------------------------- /common/Compat/Compat182/forge/build.gradle: -------------------------------------------------------------------------------- 1 | architectury { 2 | platformSetupLoomIde() 3 | forge() 4 | } 5 | 6 | dependencies { 7 | minecraft "com.mojang:minecraft:1.18.2" 8 | mappings loom.officialMojangMappings() 9 | 10 | forge "net.minecraftforge:forge:1.18.2-40.1.80" 11 | implementation project(path: ":common:API", configuration: "namedElements") 12 | } 13 | 14 | remapJar { 15 | destinationDirectory.set file(destinationDirectory.get().asFile.toPath().resolve("../devlibs")) 16 | inputFile.set jar.archiveFile 17 | archiveClassifier = "remap" 18 | } 19 | 20 | jar { 21 | destinationDirectory.set file(destinationDirectory.get().asFile.toPath().resolve("../devlibs")) 22 | from zipTree(project(":common:Compat:Compat182").transformProductionForge.archiveFile) 23 | archiveClassifier = null 24 | } 25 | -------------------------------------------------------------------------------- /common/Compat/Compat190/src/main/resources/morecommands_compat190.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "minVersion": "0.8", 4 | "package": "com.ptsmods.morecommands.mixin.compat.compat190", 5 | "plugin": "com.ptsmods.morecommands.plugin.Plugin190", 6 | "compatibilityLevel": "JAVA_16", 7 | "client": [ 8 | "min.MixinChatComponent", 9 | "min.MixinGuiMessage", 10 | "min.MixinLocalPlayer", 11 | "MixinLocalPlayerAccessor", 12 | "min.MixinChatScreen", 13 | "min.MixinChatComponentAccessor", 14 | "MixinLocalPlayer", 15 | "until192.MixinMinecraft" 16 | ], 17 | "mixins": [ 18 | "MixinServerGamePacketListenerImpl", 19 | "min.MixinCommandManagerCarpetCompat", 20 | "MixinPlayerList", 21 | "until192.MixinPainting" 22 | ], 23 | "injectors": { 24 | "defaultRequire": 1 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/util/extensions/CollectionExtensions.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api.util.extensions; 2 | 3 | import com.google.common.collect.ImmutableList; 4 | import lombok.NonNull; 5 | 6 | import java.util.ArrayList; 7 | import java.util.Collection; 8 | import java.util.List; 9 | import java.util.stream.Collectors; 10 | import java.util.stream.Stream; 11 | 12 | public class CollectionExtensions { 13 | 14 | public static List immutable(Collection self) { 15 | return ImmutableList.copyOf(self); 16 | } 17 | 18 | public static List merge(@NonNull Collection collection, Collection others) { 19 | return others == null ? new ArrayList<>(collection) : Stream.concat(collection.stream(), others.stream()).collect(Collectors.toList()); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/common/MixinPrimedTnt.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.common; 2 | 3 | import com.ptsmods.morecommands.api.ReflectionHelper; 4 | import com.ptsmods.morecommands.miscellaneous.CustomPrimedTnt; 5 | import net.minecraft.world.entity.item.PrimedTnt; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.injection.Constant; 8 | import org.spongepowered.asm.mixin.injection.ModifyConstant; 9 | 10 | @Mixin(PrimedTnt.class) 11 | public class MixinPrimedTnt { 12 | 13 | @ModifyConstant(method = "explode", constant = @Constant(floatValue = 4f), expect = 2) 14 | private float explode(float power) { 15 | PrimedTnt thiz = ReflectionHelper.cast(this); 16 | return thiz instanceof CustomPrimedTnt cpt ? cpt.getPower() : power; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /common/src/client/java/com/ptsmods/morecommands/client/mixin/MixinItemModelGenerator.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.client.mixin; 2 | 3 | import com.ptsmods.morecommands.api.addons.ItemModelGeneratorAddon; 4 | import net.minecraft.client.renderer.block.model.ItemModelGenerator; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.Unique; 7 | 8 | @Mixin(ItemModelGenerator.class) 9 | public class MixinItemModelGenerator implements ItemModelGeneratorAddon { 10 | private @Unique boolean ignoreNext; 11 | 12 | @Override 13 | public boolean shouldIgnore() { 14 | return ignoreNext; 15 | } 16 | 17 | @Override 18 | public void ignoreNext() { 19 | ignoreNext = true; 20 | } 21 | 22 | @Override 23 | public void resetIgnore() { 24 | ignoreNext = false; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /common/src/client/java/com/ptsmods/morecommands/client/mixin/accessor/MixinCommandSuggestionsAccessor.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.client.mixin.accessor; 2 | 3 | import net.minecraft.client.gui.components.CommandSuggestions; 4 | import net.minecraft.util.FormattedCharSequence; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.gen.Accessor; 7 | 8 | import java.util.List; 9 | 10 | 11 | @Mixin(CommandSuggestions.class) 12 | public interface MixinCommandSuggestionsAccessor { 13 | @Accessor CommandSuggestions.SuggestionsList getSuggestions(); 14 | @Accessor void setSuggestions(CommandSuggestions.SuggestionsList suggestions); 15 | 16 | @Accessor List getCommandUsage(); 17 | 18 | @Accessor int getCommandUsagePosition(); 19 | 20 | @Accessor int getCommandUsageWidth(); 21 | } 22 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/reach/MixinRandomizableContainerBlockEntity.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.reach; 2 | 3 | import com.ptsmods.morecommands.commands.elevated.ReachCommand; 4 | import net.minecraft.world.entity.player.Player; 5 | import net.minecraft.world.level.block.entity.RandomizableContainerBlockEntity; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.injection.Constant; 8 | import org.spongepowered.asm.mixin.injection.ModifyConstant; 9 | 10 | @Mixin(RandomizableContainerBlockEntity.class) 11 | public class MixinRandomizableContainerBlockEntity { 12 | @ModifyConstant(method = "stillValid", constant = @Constant(doubleValue = 64.0D)) 13 | public double canPlayerUse_maxReach(double d, Player player) { 14 | return ReachCommand.getReach(player, true); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /common/Compat/Compat19/src/main/java/com/ptsmods/morecommands/mixin/compat/compat19/until194/MixinTitleScreen.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.compat.compat19.until194; 2 | 3 | import com.ptsmods.morecommands.api.clientoptions.ClientOption; 4 | import net.minecraft.client.gui.screens.TitleScreen; 5 | import net.minecraft.util.RandomSource; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.injection.At; 8 | import org.spongepowered.asm.mixin.injection.Redirect; 9 | 10 | @Mixin(TitleScreen.class) 11 | public class MixinTitleScreen { 12 | 13 | @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/util/RandomSource;nextFloat()F"), method = "(Z)V") 14 | private float init_nextFloat(RandomSource random) { 15 | return ClientOption.getBoolean("alwaysMinceraft") ? 0f : random.nextFloat(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/ClientOnly.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api; 2 | 3 | import com.ptsmods.morecommands.api.util.text.TranslatableTextBuilder; 4 | import net.minecraft.network.chat.Style; 5 | import net.minecraft.world.entity.player.Player; 6 | 7 | // Methods that are used on both the server and the client 8 | // but only need an implementation on the client. 9 | public interface ClientOnly { 10 | @SuppressWarnings("deprecation") 11 | static ClientOnly get() { 12 | return Holder.getClientOnly(); 13 | } 14 | 15 | void translateTranslatableText(TranslatableTextBuilder builder, Style style, boolean includeFormattings, StringBuilder sb); 16 | 17 | float getFrameTime(); 18 | 19 | boolean isSingleplayer(); 20 | 21 | boolean isRemotePlayer(Player player); 22 | 23 | PTClient getPTClient(); 24 | } 25 | -------------------------------------------------------------------------------- /common/Compat/Compat182/build.gradle: -------------------------------------------------------------------------------- 1 | architectury { 2 | common(rootProject.enabled_platforms.split(",")) 3 | } 4 | 5 | dependencies { 6 | minecraft "com.mojang:minecraft:1.18.2" 7 | mappings loom.officialMojangMappings() 8 | 9 | // We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies 10 | modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" 11 | modApi "dev.architectury:architectury:4.9.83" 12 | 13 | implementation project(path: ":common:API", configuration: "namedElements") 14 | implementation project(path: ":common:Compat:Compat17", configuration: "namedElements") 15 | implementation project(path: ":common:Compat:Compat18", configuration: "namedElements") 16 | implementation project(path: ":common:Compat:Compat180", configuration: "namedElements") 17 | } 18 | -------------------------------------------------------------------------------- /common/Compat/Compat19/build.gradle: -------------------------------------------------------------------------------- 1 | architectury { 2 | common(rootProject.enabled_platforms.split(",")) 3 | } 4 | 5 | dependencies { 6 | minecraft "com.mojang:minecraft:1.19" 7 | mappings loom.officialMojangMappings() 8 | 9 | // We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies 10 | modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" 11 | modApi "dev.architectury:architectury:5.12.45" 12 | 13 | implementation project(path: ":common:API", configuration: "namedElements") 14 | implementation project(path: ":common:Compat:Compat17", configuration: "namedElements") 15 | implementation project(path: ":common:Compat:Compat18", configuration: "namedElements") 16 | implementation project(path: ":common:Compat:Compat182", configuration: "namedElements") 17 | } 18 | -------------------------------------------------------------------------------- /common/src/client/java/com/ptsmods/morecommands/client/commands/ScoreCommand.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.client.commands; 2 | 3 | import com.mojang.brigadier.CommandDispatcher; 4 | import com.ptsmods.morecommands.client.miscellaneous.ClientCommand; 5 | import net.minecraft.client.multiplayer.ClientSuggestionProvider; 6 | 7 | public class ScoreCommand extends ClientCommand { 8 | @Override 9 | public void cRegister(CommandDispatcher dispatcher) { 10 | dispatcher.register(cLiteral("score") 11 | .executes(ctx -> { 12 | sendMsg("Your score is currently " + SF + getPlayer().getScore() + DF + "."); 13 | return getPlayer().getScore()+1; 14 | })); 15 | } 16 | 17 | @Override 18 | public String getDocsPath() { 19 | return "/score"; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /common/Compat/Compat191/src/main/java/com/ptsmods/morecommands/compat/Compat191.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.compat; 2 | 3 | import net.minecraft.commands.CommandSourceStack; 4 | import net.minecraft.commands.Commands; 5 | import net.minecraft.network.chat.Component; 6 | import net.minecraft.resources.ResourceLocation; 7 | import net.minecraft.server.players.PlayerList; 8 | import net.minecraft.util.Tuple; 9 | 10 | public class Compat191 extends Compat19 { 11 | 12 | @Override 13 | public int performCommand(Commands commands, CommandSourceStack source, String command) { 14 | return commands.performPrefixedCommand(source, command); 15 | } 16 | 17 | @Override 18 | public void broadcast(PlayerList playerManager, Tuple type, Component message) { 19 | playerManager.broadcastSystemMessage(message, false); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /common/src/client/java/com/ptsmods/morecommands/client/mixin/MixinClientPlayerEntityTweakerooCompat.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.client.mixin; 2 | 3 | import com.ptsmods.morecommands.clientoption.ClientOptions; 4 | import net.minecraft.client.gui.screens.Screen; 5 | import net.minecraft.client.player.LocalPlayer; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.injection.At; 8 | import org.spongepowered.asm.mixin.injection.Redirect; 9 | 10 | @Mixin(LocalPlayer.class) 11 | public class MixinClientPlayerEntityTweakerooCompat { 12 | @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/Screen;isPauseScreen()Z"), method = "handleNetherPortalClient") 13 | private boolean updateNausea_isPauseScreen(Screen s) { 14 | return ClientOptions.Tweaks.screensInPortal.getValue() || s.isPauseScreen(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /common/src/client/java/com/ptsmods/morecommands/client/mixin/MixinEntity.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.client.mixin; 2 | 3 | import com.ptsmods.morecommands.api.ReflectionHelper; 4 | import com.ptsmods.morecommands.client.MoreCommandsClient; 5 | import net.minecraft.world.entity.Entity; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.injection.At; 8 | import org.spongepowered.asm.mixin.injection.Inject; 9 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 10 | 11 | @Mixin(Entity.class) 12 | public class MixinEntity { 13 | 14 | @Inject(at = @At("RETURN"), method = "getBbHeight", cancellable = true) 15 | public final void getHeight(CallbackInfoReturnable cbi) { 16 | if (MoreCommandsClient.isCool(ReflectionHelper.cast(this))) cbi.setReturnValue(cbi.getReturnValueF() * 1.5f); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/common/accessor/MixinGameModeCommandAccessor.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.common.accessor; 2 | 3 | import com.mojang.brigadier.context.CommandContext; 4 | import net.minecraft.commands.CommandSourceStack; 5 | import net.minecraft.server.commands.GameModeCommand; 6 | import net.minecraft.server.level.ServerPlayer; 7 | import net.minecraft.world.level.GameType; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.gen.Invoker; 10 | 11 | import java.util.Collection; 12 | 13 | @Mixin(GameModeCommand.class) 14 | public interface MixinGameModeCommandAccessor { 15 | 16 | @Invoker 17 | static int callSetMode(CommandContext commandContext, Collection collection, GameType gameType) { 18 | throw new AssertionError("This shouldn't happen."); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /common/src/client/java/com/ptsmods/morecommands/client/mixin/MixinKeyboard.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.client.mixin; 2 | 3 | import com.ptsmods.morecommands.api.callbacks.KeyEvent; 4 | import net.minecraft.client.KeyboardHandler; 5 | import net.minecraft.client.Minecraft; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.injection.At; 8 | import org.spongepowered.asm.mixin.injection.Inject; 9 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 10 | 11 | @Mixin(KeyboardHandler.class) 12 | public class MixinKeyboard { 13 | 14 | @Inject(at = @At("HEAD"), method = "keyPress", cancellable = true) 15 | public void onKey(long window, int key, int scancode, int i, int j, CallbackInfo cbi) { 16 | if (window == Minecraft.getInstance().getWindow().getWindow() && KeyEvent.EVENT.invoker().onKey(key, scancode, i, j)) cbi.cancel(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/common/accessor/MixinScoreboardCriterionAccessor.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.common.accessor; 2 | 3 | import net.minecraft.world.scores.criteria.ObjectiveCriteria; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.gen.Accessor; 6 | import org.spongepowered.asm.mixin.gen.Invoker; 7 | 8 | import java.util.Map; 9 | 10 | @Mixin(ObjectiveCriteria.class) 11 | public interface MixinScoreboardCriterionAccessor { 12 | 13 | @Accessor("CRITERIA_CACHE") 14 | static Map getCriteria() { 15 | throw new AssertionError("This shouldn't happen."); 16 | } 17 | @Invoker("") 18 | static ObjectiveCriteria newInstance(String name, boolean readOnly, ObjectiveCriteria.RenderType renderType) { 19 | throw new AssertionError("This shouldn't happen."); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/common/accessor/MixinPlayerEntityAccessor.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.common.accessor; 2 | 3 | import net.minecraft.network.syncher.EntityDataAccessor; 4 | import net.minecraft.world.entity.player.Abilities; 5 | import net.minecraft.world.entity.player.Inventory; 6 | import net.minecraft.world.entity.player.Player; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.gen.Accessor; 9 | 10 | @Mixin(Player.class) 11 | public interface MixinPlayerEntityAccessor { 12 | 13 | @Accessor("DATA_PLAYER_MODE_CUSTOMISATION") 14 | static EntityDataAccessor getDataPlayerModeCustomisation() { 15 | throw new AssertionError("This shouldn't happen."); 16 | } 17 | 18 | @Accessor("inventory") 19 | Inventory getInventory_(); 20 | 21 | @Accessor("abilities") 22 | Abilities getAbilities_(); 23 | } 24 | -------------------------------------------------------------------------------- /common/API/build.gradle: -------------------------------------------------------------------------------- 1 | architectury { 2 | common(rootProject.enabled_platforms.split(",")) 3 | } 4 | 5 | loom { 6 | accessWidenerPath = project(":common").loom.accessWidenerPath 7 | } 8 | 9 | dependencies { 10 | minecraft "com.mojang:minecraft:${rootProject.minecraft_version}" 11 | mappings loom.officialMojangMappings() 12 | 13 | // We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies 14 | modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" 15 | modApi "dev.architectury:architectury:${rootProject.architectury_version}" 16 | modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}" 17 | 18 | testImplementation "org.junit.jupiter:junit-jupiter-api:5.9.0" 19 | testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.9.0" 20 | } 21 | 22 | test { 23 | useJUnitPlatform() 24 | } 25 | -------------------------------------------------------------------------------- /common/src/client/java/com/ptsmods/morecommands/client/mixin/accessor/MixinParticleEngineAccessor.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.client.mixin.accessor; 2 | 3 | import net.minecraft.client.particle.ParticleEngine; 4 | import net.minecraft.client.particle.ParticleRenderType; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.Mutable; 7 | import org.spongepowered.asm.mixin.gen.Accessor; 8 | 9 | import java.util.List; 10 | 11 | @Mixin(ParticleEngine.class) 12 | public interface MixinParticleEngineAccessor { 13 | 14 | @Accessor("RENDER_ORDER") 15 | static List getRenderOrder() { 16 | throw new AssertionError("This shouldn't happen."); 17 | } 18 | 19 | @Accessor("RENDER_ORDER") @Mutable 20 | static void setRenderOrder(List renderOrder) { 21 | throw new AssertionError("This shouldn't happen."); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/ClientOnlyDummyImpl.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api; 2 | 3 | import com.ptsmods.morecommands.api.util.text.TranslatableTextBuilder; 4 | import net.minecraft.network.chat.Style; 5 | import net.minecraft.world.entity.player.Player; 6 | 7 | public class ClientOnlyDummyImpl implements ClientOnly { 8 | @Override 9 | public void translateTranslatableText(TranslatableTextBuilder builder, Style style, boolean includeFormattings, StringBuilder sb) {} 10 | 11 | @Override 12 | public float getFrameTime() { 13 | return 1; 14 | } 15 | 16 | @Override 17 | public boolean isSingleplayer() { 18 | return false; 19 | } 20 | 21 | @Override 22 | public boolean isRemotePlayer(Player player) { 23 | return false; 24 | } 25 | 26 | @Override 27 | public PTClient getPTClient() { 28 | return null; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /common/src/client/java/com/ptsmods/morecommands/client/mixin/MixinStyle.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.client.mixin; 2 | 3 | import com.ptsmods.morecommands.clientoption.ClientOptions; 4 | import com.ptsmods.morecommands.util.Rainbow; 5 | import net.minecraft.network.chat.Style; 6 | import net.minecraft.network.chat.TextColor; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Inject; 10 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 11 | 12 | @Mixin(Style.class) 13 | public class MixinStyle { 14 | @Inject(at = @At("RETURN"), method = "getColor", cancellable = true) 15 | public void getColor(CallbackInfoReturnable cbi) { 16 | if (ClientOptions.EasterEggs.rainbows.getValue() && Rainbow.getInstance() != null) cbi.setReturnValue(Rainbow.getInstance().RAINBOW_TC); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /forge/src/main/resources/META-INF/mods.toml: -------------------------------------------------------------------------------- 1 | modLoader = "javafml" 2 | loaderVersion = "[35,)" 3 | issueTrackerURL = "https://github.com/PlanetTeamSpeakk/MoreCommands/issues" 4 | license = "CC0-1.0" 5 | 6 | [[mods]] 7 | modId = "morecommands" 8 | version = "${version}" 9 | displayName = "MoreCommands" 10 | authors = "PlanetTeamSpeak" 11 | description = ''' 12 | Adds loads of commands, gamerules and other neat features. 13 | ''' 14 | logoFile = "assets/morecommands/icon.png" 15 | 16 | [[dependencies.morecommands]] 17 | modId = "forge" 18 | mandatory = true 19 | versionRange = "[35,)" 20 | ordering = "NONE" 21 | side = "BOTH" 22 | 23 | [[dependencies.morecommands]] 24 | modId = "minecraft" 25 | mandatory = true 26 | versionRange = "[1.16.4,)" 27 | ordering = "NONE" 28 | side = "BOTH" 29 | 30 | [[dependencies.morecommands]] 31 | modId = "architectury" 32 | mandatory = true 33 | versionRange = "[2.10.0,)" 34 | ordering = "AFTER" 35 | side = "BOTH" -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/miscellaneous/InvSeeScreenHandler.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api.miscellaneous; 2 | 3 | import net.minecraft.world.Container; 4 | import net.minecraft.world.entity.player.Inventory; 5 | import net.minecraft.world.entity.player.Player; 6 | import net.minecraft.world.inventory.ChestMenu; 7 | import net.minecraft.world.inventory.MenuType; 8 | 9 | // Cancelling slot clicks is handled in MixinScreenHandler in the compat package. 10 | public class InvSeeScreenHandler extends ChestMenu { 11 | public final Player target; 12 | 13 | public InvSeeScreenHandler(int syncId, Inventory playerInventory, Container inventory, Player target) { 14 | super(MenuType.GENERIC_9x4, syncId, playerInventory, inventory, 4); 15 | this.target = target; 16 | } 17 | 18 | @Override 19 | public boolean stillValid(Player player) { 20 | return true; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/reach/MixinContainerOpenersCounter.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.reach; 2 | 3 | import net.minecraft.world.level.block.entity.ContainerOpenersCounter; 4 | import net.minecraft.world.phys.AABB; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.ModifyArg; 8 | 9 | @Mixin(ContainerOpenersCounter.class) 10 | public class MixinContainerOpenersCounter { 11 | 12 | @ModifyArg(method = "getOpenCount", at = @At(value = "INVOKE", 13 | target = "Lnet/minecraft/world/level/Level;getEntities(Lnet/minecraft/world/level/entity/EntityTypeTest;Lnet/minecraft/world/phys/AABB;Ljava/util/function/Predicate;)Ljava/util/List;")) 14 | private AABB fixOpenerRecheckExcludingFarPlayers(AABB box) { 15 | return box.inflate(200); // To account for quite a bit of reach. 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/reach/MixinItemCombinerMenu.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.reach; 2 | 3 | import com.ptsmods.morecommands.commands.elevated.ReachCommand; 4 | import net.minecraft.core.BlockPos; 5 | import net.minecraft.world.entity.player.Player; 6 | import net.minecraft.world.inventory.ItemCombinerMenu; 7 | import net.minecraft.world.level.Level; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.injection.Constant; 10 | import org.spongepowered.asm.mixin.injection.ModifyConstant; 11 | 12 | @Mixin(ItemCombinerMenu.class) 13 | public class MixinItemCombinerMenu { 14 | @ModifyConstant(method = {"method_24924", "m_39783_"}, constant = @Constant(doubleValue = 64.0D), remap = false, require = 1) 15 | public double method_24924_maxReach(double d, Player player, Level world, BlockPos pos) { 16 | return ReachCommand.getReach(player, true); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /common/Compat/Compat190/src/main/java/com/ptsmods/morecommands/mixin/compat/compat190/MixinLocalPlayer.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.compat.compat190; 2 | 3 | import com.ptsmods.morecommands.api.IMoreCommandsClient; 4 | import net.minecraft.client.player.LocalPlayer; 5 | import net.minecraft.network.chat.Component; 6 | import net.minecraft.network.chat.MessageSigner; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Inject; 10 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 11 | 12 | @Mixin(LocalPlayer.class) 13 | public class MixinLocalPlayer { 14 | @Inject(at = @At("HEAD"), method = "sendCommand", require = 0, cancellable = true) 15 | public void sendCommand(MessageSigner signer, String command, Component text, CallbackInfo cbi) { 16 | IMoreCommandsClient.handleCommand(command, cbi); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/commands/elevated/TimeLiteralCommand.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.commands.elevated; 2 | 3 | import com.mojang.brigadier.CommandDispatcher; 4 | import com.ptsmods.morecommands.miscellaneous.Command; 5 | import net.minecraft.commands.CommandSourceStack; 6 | 7 | // Smallest command class in the whole mod? :O 8 | public class TimeLiteralCommand extends Command { 9 | @Override 10 | public void register(CommandDispatcher dispatcher) { 11 | for (String s : new String[] {"day", "noon", "night", "midnight"}) 12 | dispatcher.register(literalReqOp(s) 13 | .executes(ctx -> ctx.getSource().getServer().getCommands().getDispatcher().getRoot().getChild("time").getChild("set").getChild(s).getCommand().run(ctx))); 14 | } 15 | 16 | @Override 17 | public String getDocsPath() { 18 | return "/elevated/time-literal"; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/common/MixinIceBlock.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.common; 2 | 3 | import com.ptsmods.morecommands.miscellaneous.MoreGameRules; 4 | import net.minecraft.core.BlockPos; 5 | import net.minecraft.world.level.Level; 6 | import net.minecraft.world.level.block.IceBlock; 7 | import net.minecraft.world.level.block.state.BlockState; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.injection.At; 10 | import org.spongepowered.asm.mixin.injection.Inject; 11 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 12 | 13 | @Mixin(IceBlock.class) 14 | public class MixinIceBlock { 15 | @Inject(at = @At("HEAD"), method = "melt", cancellable = true) 16 | protected void melt(BlockState state, Level world, BlockPos pos, CallbackInfo cbi) { 17 | if (!world.getGameRules().getBoolean(MoreGameRules.get().doMeltRule())) cbi.cancel(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /forge/src/main/java/com/ptsmods/morecommands/mixin/forge/MixinServerGamePacketListenerImpl.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.forge; 2 | 3 | import com.ptsmods.morecommands.commands.elevated.ReachCommand; 4 | import net.minecraft.server.level.ServerPlayer; 5 | import net.minecraft.server.network.ServerGamePacketListenerImpl; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.Shadow; 8 | import org.spongepowered.asm.mixin.injection.Constant; 9 | import org.spongepowered.asm.mixin.injection.ModifyConstant; 10 | 11 | @Mixin(ServerGamePacketListenerImpl.class) 12 | public class MixinServerGamePacketListenerImpl { 13 | @Shadow public ServerPlayer player; 14 | 15 | // 1.18 and older 16 | @ModifyConstant(method = "handleInteract", constant = @Constant(doubleValue = 36.0)) 17 | private double handleInteract_maxReach(double reach) { 18 | return ReachCommand.getReach(player, true); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /common/Compat/Compat19/src/main/resources/morecommands_compat19.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "minVersion": "0.8", 4 | "package": "com.ptsmods.morecommands.mixin.compat.compat19", 5 | "plugin": "com.ptsmods.morecommands.plugin.Plugin19", 6 | "compatibilityLevel": "JAVA_16", 7 | "client": [ 8 | "plus.MixinBackgroundRenderer", 9 | "plus.MixinClientPlayerInteractionManager", 10 | "plus.MixinKeybindResolverAccessor", 11 | "plus.MixinLightmapTextureManager", 12 | "plus.MixinWorldRenderer", 13 | "until193.MixinWorldOpenFlows", 14 | "until194.MixinTitleScreen" 15 | ], 16 | "mixins": [ 17 | "plus.MixinArgumentTypesAccessor", 18 | "plus.MixinBlock", 19 | "plus.MixinClientboundCommandsPacket", 20 | "plus.MixinClientboundCommandsPacketArgumentNodeStub", 21 | "plus.MixinEnchantmentScreenHandler", 22 | "plus.MixinSnowBlock" 23 | ], 24 | "injectors": { 25 | "defaultRequire": 1 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /common/src/client/java/com/ptsmods/morecommands/client/mixin/MixinTextColor.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.client.mixin; 2 | 3 | import com.ptsmods.morecommands.api.ReflectionHelper; 4 | import com.ptsmods.morecommands.util.Rainbow; 5 | import net.minecraft.network.chat.TextColor; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.injection.At; 8 | import org.spongepowered.asm.mixin.injection.Inject; 9 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 10 | 11 | @Mixin(TextColor.class) 12 | public class MixinTextColor { 13 | 14 | @Inject(at = @At("RETURN"), method = "getValue", cancellable = true) 15 | public void getRgb(CallbackInfoReturnable cbi) { 16 | if (Rainbow.getInstance() != null && ReflectionHelper.cast(this) == Rainbow.getInstance().RAINBOW_TC) 17 | cbi.setReturnValue(Rainbow.getInstance().getRainbowColour(true)); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /common/Compat/Compat192/src/main/java/com/ptsmods/morecommands/compat/client/ClientCompat192.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.compat.client; 2 | 3 | import com.ptsmods.morecommands.api.IMoreCommands; 4 | import dev.architectury.event.CompoundEventResult; 5 | import dev.architectury.event.events.client.ClientChatEvent; 6 | 7 | import java.util.function.Function; 8 | 9 | public class ClientCompat192 extends ClientCompat191 { 10 | 11 | @Override 12 | public void registerChatProcessListener(Function listener) { 13 | ClientChatEvent.RECEIVED.register((bound, message) -> { 14 | String messageString = IMoreCommands.get().textToString(message, null, true); 15 | String output = listener.apply(messageString); 16 | 17 | if (output == null || output.equals(messageString)) return CompoundEventResult.pass(); 18 | return CompoundEventResult.interruptDefault(message); 19 | }); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/IDeathTracker.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api; 2 | 3 | import net.minecraft.resources.ResourceLocation; 4 | import net.minecraft.util.Tuple; 5 | import net.minecraft.world.level.Level; 6 | import net.minecraft.world.phys.Vec3; 7 | 8 | import java.util.List; 9 | 10 | public interface IDeathTracker { 11 | @SuppressWarnings("deprecation") // Holder not API 12 | static IDeathTracker get() { 13 | return Holder.getDeathTracker(); 14 | } 15 | 16 | void addDeath(Level world, Vec3 pos); 17 | 18 | void log(Level world, Vec3 pos); 19 | 20 | List>> getDeaths(); 21 | 22 | void reset(); 23 | 24 | default Tuple> getLastDeath() { 25 | List>> deaths = getDeaths(); 26 | return deaths.isEmpty() ? null : deaths.get(deaths.size() - 1); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /common/Compat/Compat18/src/main/java/com/ptsmods/morecommands/compat/Compat18.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.compat; 2 | 3 | import it.unimi.dsi.fastutil.doubles.DoubleList; 4 | import net.minecraft.core.BlockPos; 5 | import net.minecraft.nbt.CompoundTag; 6 | import net.minecraft.world.level.BaseSpawner; 7 | import net.minecraft.world.level.Level; 8 | import net.minecraft.world.level.block.entity.BlockEntity; 9 | 10 | import java.util.stream.DoubleStream; 11 | 12 | public class Compat18 extends Compat17 { 13 | @Override 14 | public CompoundTag writeBaseSpawnerNbt(BaseSpawner logic, Level world, BlockPos pos, CompoundTag nbt) { 15 | return logic.save(nbt); 16 | } 17 | 18 | @Override 19 | public CompoundTag writeBENBT(BlockEntity be) { 20 | return be.saveWithFullMetadata(); 21 | } 22 | 23 | @Override 24 | public DoubleStream doubleStream(DoubleList doubles) { 25 | return doubles.doubleStream(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/commands/elevated/DifficultyLiteralCommand.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.commands.elevated; 2 | 3 | import com.mojang.brigadier.CommandDispatcher; 4 | import com.ptsmods.morecommands.miscellaneous.Command; 5 | import net.minecraft.commands.CommandSourceStack; 6 | import net.minecraft.world.Difficulty; 7 | 8 | public class DifficultyLiteralCommand extends Command { 9 | 10 | @Override 11 | public void register(CommandDispatcher dispatcher) { 12 | for (Difficulty difficulty : Difficulty.values()) 13 | dispatcher.register(literalReqOp(difficulty.getKey()) 14 | .executes(ctx -> ctx.getSource().getServer().getCommands().getDispatcher().getRoot().getChild("difficulty").getChild(difficulty.getKey()).getCommand().run(ctx))); 15 | } 16 | 17 | @Override 18 | public String getDocsPath() { 19 | return "/elevated/difficulty-literal"; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/common/MixinGoalSelector.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.common; 2 | 3 | import com.ptsmods.morecommands.MoreCommands; 4 | import com.ptsmods.morecommands.miscellaneous.MoreGameRules; 5 | import net.minecraft.world.entity.ai.goal.GoalSelector; 6 | import net.minecraft.world.level.Level; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Inject; 10 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 11 | 12 | import java.util.Objects; 13 | 14 | @Mixin(GoalSelector.class) 15 | public class MixinGoalSelector { 16 | @Inject(at = @At("HEAD"), method = "tick", cancellable = true) 17 | public void tick(CallbackInfo cbi) { 18 | if (!Objects.requireNonNull(MoreCommands.serverInstance.getLevel(Level.OVERWORLD)).getGameRules().getBoolean(MoreGameRules.get().doGoalsRule())) cbi.cancel(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /common/Compat/Compat190/src/main/java/com/ptsmods/morecommands/mixin/compat/compat190/MixinLocalPlayerAccessor.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.compat.compat190; 2 | 3 | import com.mojang.brigadier.ParseResults; 4 | import net.minecraft.client.player.LocalPlayer; 5 | import net.minecraft.commands.SharedSuggestionProvider; 6 | import net.minecraft.commands.arguments.ArgumentSignatures; 7 | import net.minecraft.network.chat.Component; 8 | import net.minecraft.network.chat.MessageSignature; 9 | import net.minecraft.network.chat.MessageSigner; 10 | import org.spongepowered.asm.mixin.Mixin; 11 | import org.spongepowered.asm.mixin.gen.Invoker; 12 | 13 | @Mixin(LocalPlayer.class) 14 | public interface MixinLocalPlayerAccessor { 15 | 16 | @Invoker MessageSignature callSignMessage(MessageSigner signer, Component message); 17 | @Invoker ArgumentSignatures callSignCommandArguments(MessageSigner signer, ParseResults parseResults, Component preview); 18 | } 19 | -------------------------------------------------------------------------------- /common/src/client/java/com/ptsmods/morecommands/client/reachmixin/MixinGameRenderer.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.client.reachmixin; 2 | 3 | import com.ptsmods.morecommands.commands.elevated.ReachCommand; 4 | import net.minecraft.client.Minecraft; 5 | import net.minecraft.client.renderer.GameRenderer; 6 | import org.spongepowered.asm.mixin.Final; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.Shadow; 9 | import org.spongepowered.asm.mixin.injection.At; 10 | import org.spongepowered.asm.mixin.injection.ModifyVariable; 11 | 12 | import java.util.Objects; 13 | 14 | @Mixin(GameRenderer.class) 15 | public class MixinGameRenderer { 16 | @Shadow @Final private Minecraft minecraft; 17 | 18 | @ModifyVariable(at = @At(value = "STORE", ordinal = 0), method = "pick") 19 | public double updateTargetedEntity_maxReach(double maxReach) { 20 | return ReachCommand.getReach(Objects.requireNonNull(minecraft.player), false); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /common/Compat/Compat193/src/main/java/com/ptsmods/morecommands/mixin/compat/compat193/min/MixinDamageSource.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.compat.compat193.min; 2 | 3 | import com.ptsmods.morecommands.api.IMoreCommands; 4 | import com.ptsmods.morecommands.api.ReflectionHelper; 5 | import net.minecraft.world.damagesource.DamageSource; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.injection.At; 8 | import org.spongepowered.asm.mixin.injection.Inject; 9 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 10 | 11 | @Mixin(DamageSource.class) 12 | public class MixinDamageSource { 13 | 14 | @Inject(at = @At("TAIL"), method = "") 15 | private void init(String name, CallbackInfo cbi) { 16 | // Only add normal damage sources to the map, not parameterised ones. 17 | if (ReflectionHelper.cast(this).getClass() == DamageSource.class) IMoreCommands.DAMAGE_SOURCES.put(name, ReflectionHelper.cast(this)); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /common/Compat/Compat193/src/main/java/com/ptsmods/morecommands/mixin/compat/compat193/min/MixinEditBox.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.compat.compat193.min; 2 | 3 | import com.mojang.blaze3d.vertex.PoseStack; 4 | import com.ptsmods.morecommands.api.ReflectionHelper; 5 | import com.ptsmods.morecommands.api.gui.PlaceholderEditBox; 6 | import net.minecraft.client.gui.components.EditBox; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Inject; 10 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 11 | 12 | @Mixin(EditBox.class) 13 | public class MixinEditBox { 14 | 15 | @Inject(at = @At("TAIL"), method = "renderButton") 16 | private void renderWidget(PoseStack poseStack, int i, int j, float f, CallbackInfo ci) { 17 | EditBox thiz = ReflectionHelper.cast(this); 18 | if (thiz instanceof PlaceholderEditBox peb) peb.renderPlaceholder(poseStack); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /common/Compat/Compat194/src/main/resources/morecommands_compat194.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "minVersion": "0.8", 4 | "package": "com.ptsmods.morecommands.mixin.compat.compat194", 5 | "plugin": "com.ptsmods.morecommands.plugin.Plugin194", 6 | "compatibilityLevel": "JAVA_16", 7 | "client": [ 8 | "plus.MixinAbstractButton", 9 | "plus.MixinAbstractContainerEventHandler", 10 | "plus.MixinChatScreenEditBox", 11 | "plus.MixinCreativeModeInventoryScreen", 12 | "plus.MixinEditBox", 13 | "plus.MixinHandledScreen", 14 | "plus.MixinInventoryScreen", 15 | "plus.MixinItemModelGenerator", 16 | "plus.MixinItemRenderer", 17 | "plus.MixinMoreTab", 18 | "plus.MixinPlayerTabOverlay", 19 | "MixinAbstractContainerScreen", 20 | "plus.MixinClientLanguage", 21 | "plus.MixinLogoRenderer" 22 | ], 23 | "mixins": [ 24 | "plus.MixinFarmBlock", 25 | "plus.MixinPainting" 26 | ], 27 | "injectors": { 28 | "defaultRequire": 1 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /common/Compat/Compat194/src/main/java/com/ptsmods/morecommands/mixin/compat/compat194/plus/MixinEditBox.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.compat.compat194.plus; 2 | 3 | import com.mojang.blaze3d.vertex.PoseStack; 4 | import com.ptsmods.morecommands.api.ReflectionHelper; 5 | import com.ptsmods.morecommands.api.gui.PlaceholderEditBox; 6 | import net.minecraft.client.gui.components.EditBox; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Inject; 10 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 11 | 12 | @Mixin(EditBox.class) 13 | public class MixinEditBox { 14 | 15 | @Inject(at = @At("TAIL"), method = "renderWidget") 16 | private void renderWidget(PoseStack poseStack, int i, int j, float f, CallbackInfo ci) { 17 | EditBox thiz = ReflectionHelper.cast(this); 18 | if (thiz instanceof PlaceholderEditBox peb) peb.renderPlaceholder(poseStack); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/commands/elevated/ConsoleCommand.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.commands.elevated; 2 | 3 | import com.mojang.brigadier.CommandDispatcher; 4 | import com.ptsmods.morecommands.miscellaneous.Command; 5 | import net.minecraft.commands.CommandSourceStack; 6 | import org.jetbrains.annotations.Nullable; 7 | 8 | import java.util.Collections; 9 | import java.util.Set; 10 | 11 | public class ConsoleCommand extends Command { 12 | @Override 13 | public void register(CommandDispatcher dispatcher) { 14 | dispatcher.register(literalReqOp("console") 15 | .redirect(dispatcher.getRoot(), ctx -> ctx.getSource().getServer().createCommandSourceStack())); 16 | } 17 | 18 | @Override 19 | public String getDocsPath() { 20 | return "/elevated/console"; 21 | } 22 | 23 | @Override 24 | public @Nullable Set nodeNames() { 25 | return Collections.singleton("console"); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /common/Compat/Compat19/src/main/java/com/ptsmods/morecommands/mixin/compat/compat19/plus/MixinLightmapTextureManager.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.compat.compat19.plus; 2 | 3 | import com.ptsmods.morecommands.api.clientoptions.ClientOption; 4 | import com.ptsmods.morecommands.api.clientoptions.ClientOptionCategory; 5 | import com.ptsmods.morecommands.api.clientoptions.DoubleClientOption; 6 | import net.minecraft.client.renderer.LightTexture; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.ModifyVariable; 10 | 11 | @Mixin(LightTexture.class) 12 | public class MixinLightmapTextureManager { 13 | 14 | @ModifyVariable(at = @At("STORE"), ordinal = 8, method = "updateLightTexture") 15 | public float storeGamma(float gamma) { 16 | return (float) (((DoubleClientOption) ClientOption.getOptions().get(ClientOptionCategory.TWEAKS).get("Brightness Multiplier")).getValue() * gamma); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /common/Compat/Compat18/src/main/resources/morecommands_compat18.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "minVersion": "0.8", 4 | "package": "com.ptsmods.morecommands.mixin.compat.compat18", 5 | "plugin": "com.ptsmods.morecommands.plugin.Plugin18", 6 | "compatibilityLevel": "JAVA_16", 7 | "client": [ 8 | "min.MixinBackgroundRenderer", 9 | "min.MixinClientPlayerInteractionManager", 10 | "min.MixinLightmapTextureManager", 11 | "min.MixinTitleScreen", 12 | "min.MixinWorldRenderer" 13 | ], 14 | "mixins": [ 15 | "min.MixinEnchantmentScreenHandler", 16 | "min.MixinSnowBlock", 17 | "plus.MixinServerWorld", 18 | "min.MixinServerPlayNetworkHandler", 19 | "min.MixinBlock", 20 | "min.MixinServerPlayNetworkHandler", 21 | "min.MixinPlayerManager", 22 | "min.MixinClientboundCommandsPacket", 23 | "min.MixinServerGamePacketListenerImpl", 24 | "min.reach.MixinServerGamePacketListenerImpl" 25 | ], 26 | "injectors": { 27 | "defaultRequire": 1 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/MixinAccessWidener.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api; 2 | 3 | import net.minecraft.network.chat.Component; 4 | import net.minecraft.server.MinecraftServer; 5 | import net.minecraft.server.level.ServerPlayer; 6 | import net.minecraft.server.network.ServerGamePacketListenerImpl; 7 | import net.minecraft.world.level.block.entity.SignBlockEntity; 8 | 9 | // Utility class so Compat subprojects may use certain mixins from the main project. 10 | public interface MixinAccessWidener { 11 | 12 | @SuppressWarnings("deprecation") 13 | static MixinAccessWidener get() { 14 | return Holder.getMixinAccessWidener(); 15 | } 16 | 17 | void serverPlayerEntity$setSyncedExperience(ServerPlayer player, int experience); 18 | 19 | char serverPlayNetworkHandler$gameMsgCharAt(ServerGamePacketListenerImpl thiz, String string, int index, ServerPlayer player, MinecraftServer server); 20 | 21 | Component[] signBlockEntity$getTexts(SignBlockEntity sbe); 22 | } 23 | -------------------------------------------------------------------------------- /common/src/client/java/com/ptsmods/morecommands/client/gui/infohud/variables/IntVariable.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.client.gui.infohud.variables; 2 | 3 | import com.mojang.blaze3d.vertex.PoseStack; 4 | import java.util.function.BiConsumer; 5 | import net.minecraft.util.Mth; 6 | 7 | public class IntVariable extends AbstractVariable { 8 | private int min = Integer.MIN_VALUE, max = Integer.MAX_VALUE; 9 | 10 | public IntVariable(String name, Integer defaultValue, BiConsumer applicator) { 11 | super(name, defaultValue, applicator); 12 | } 13 | 14 | @Override 15 | public Integer fromString(String val) { 16 | return Mth.clamp(Integer.parseInt(val), min, max); 17 | } 18 | 19 | @Override 20 | public Integer upcast(Object value) { 21 | return (Integer) value; 22 | } 23 | 24 | public IntVariable clamped(int min, int max) { 25 | this.min = min; 26 | this.max = max; 27 | 28 | return this; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /common/Compat/Compat190/src/main/java/com/ptsmods/morecommands/mixin/compat/compat190/until192/MixinPainting.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.compat.compat190.until192; 2 | 3 | import com.ptsmods.morecommands.api.addons.PaintingAddon; 4 | import net.minecraft.core.Holder; 5 | import net.minecraft.world.entity.decoration.Painting; 6 | import net.minecraft.world.entity.decoration.PaintingVariant; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.Shadow; 9 | 10 | @Mixin(Painting.class) 11 | public abstract class MixinPainting implements PaintingAddon { 12 | 13 | @Shadow public abstract Holder getVariant(); 14 | 15 | @Shadow public abstract void setVariant(Holder holder); 16 | 17 | @Override 18 | public Object mc$getVariant() { 19 | return getVariant().value(); 20 | } 21 | 22 | @Override 23 | public void mc$setVariant(Object variant) { 24 | setVariant(Holder.direct((PaintingVariant) variant)); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/commands/unelevated/SuicideCommand.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.commands.unelevated; 2 | 3 | import com.mojang.brigadier.CommandDispatcher; 4 | import com.ptsmods.morecommands.api.util.compat.Compat; 5 | import com.ptsmods.morecommands.miscellaneous.Command; 6 | import net.minecraft.commands.CommandSourceStack; 7 | 8 | public class SuicideCommand extends Command { 9 | @Override 10 | public void register(CommandDispatcher dispatcher) { 11 | dispatcher.register(literalReq("suicide") 12 | .executes(ctx -> { 13 | ctx.getSource().getEntityOrException().hurt(Compat.get().getSuicideDamageSource(ctx.getSource().getEntityOrException()), Float.MAX_VALUE); 14 | ctx.getSource().getEntityOrException().kill(); 15 | return 1; 16 | })); 17 | } 18 | 19 | @Override 20 | public String getDocsPath() { 21 | return "/unelevated/suicide"; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/common/MixinTargetPredicate.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.common; 2 | 3 | import com.ptsmods.morecommands.api.IDataTrackerHelper; 4 | import net.minecraft.world.entity.LivingEntity; 5 | import net.minecraft.world.entity.ai.targeting.TargetingConditions; 6 | import net.minecraft.world.entity.player.Player; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Inject; 10 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 11 | 12 | @Mixin(TargetingConditions.class) 13 | public class MixinTargetPredicate { 14 | @Inject(at = @At("HEAD"), method = "test", cancellable = true) 15 | public void test(LivingEntity baseEntity, LivingEntity targetEntity, CallbackInfoReturnable cbi) { 16 | if (targetEntity instanceof Player && targetEntity.getEntityData().get(IDataTrackerHelper.get().vanish())) cbi.setReturnValue(false); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/reach/MixinAbstractContainerMenu.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.reach; 2 | 3 | import com.ptsmods.morecommands.commands.elevated.ReachCommand; 4 | import net.minecraft.core.BlockPos; 5 | import net.minecraft.world.entity.player.Player; 6 | import net.minecraft.world.inventory.AbstractContainerMenu; 7 | import net.minecraft.world.level.Level; 8 | import net.minecraft.world.level.block.Block; 9 | import org.spongepowered.asm.mixin.Mixin; 10 | import org.spongepowered.asm.mixin.injection.Constant; 11 | import org.spongepowered.asm.mixin.injection.ModifyConstant; 12 | 13 | @Mixin(AbstractContainerMenu.class) 14 | public class MixinAbstractContainerMenu { 15 | @ModifyConstant(method = {"method_17696", "m_38913_"}, require = 1, remap = false, constant = @Constant(doubleValue = 64.0D)) 16 | private static double method_17696_maxReach(double reach, Block block, Player player, Level world, BlockPos pos) { 17 | return ReachCommand.getReach(player, true); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /common/src/client/java/com/ptsmods/morecommands/client/mixin/MixinAbstractClientPlayerEntity.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.client.mixin; 2 | 3 | import com.ptsmods.morecommands.api.ReflectionHelper; 4 | import com.ptsmods.morecommands.client.MoreCommandsClient; 5 | import net.minecraft.client.player.AbstractClientPlayer; 6 | import net.minecraft.resources.ResourceLocation; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Inject; 10 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 11 | 12 | @Mixin(AbstractClientPlayer.class) 13 | public class MixinAbstractClientPlayerEntity { 14 | 15 | @Inject(at = @At("RETURN"), method = "getCloakTextureLocation", cancellable = true) 16 | private void getCapeTexture(CallbackInfoReturnable cbi) { 17 | if (MoreCommandsClient.isCool(ReflectionHelper.cast(this))) 18 | cbi.setReturnValue(new ResourceLocation("morecommands:textures/cape.png")); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /common/Compat/Compat18/src/main/java/com/ptsmods/morecommands/mixin/compat/compat18/min/MixinTitleScreen.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.compat.compat18.min; 2 | 3 | import com.ptsmods.morecommands.api.clientoptions.BooleanClientOption; 4 | import com.ptsmods.morecommands.api.clientoptions.ClientOption; 5 | import com.ptsmods.morecommands.api.clientoptions.ClientOptionCategory; 6 | import net.minecraft.client.gui.screens.TitleScreen; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Redirect; 10 | 11 | import java.util.Random; 12 | 13 | @Mixin(TitleScreen.class) 14 | public class MixinTitleScreen { 15 | 16 | @Redirect(at = @At(value = "INVOKE", target = "Ljava/util/Random; nextFloat()F", remap = false), method = "(Z)V") 17 | private float init_nextFloat(Random random) { 18 | return ((BooleanClientOption) ClientOption.getOptions().get(ClientOptionCategory.TWEAKS).get("Always Minceraft")).getValue() ? 0f : random.nextFloat(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /common/src/client/java/com/ptsmods/morecommands/client/mixin/MixinAbstractButton.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.client.mixin; 2 | 3 | import com.ptsmods.morecommands.api.addons.AbstractButtonAddon; 4 | import net.minecraft.client.gui.components.AbstractButton; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.Unique; 7 | import org.spongepowered.asm.mixin.injection.At; 8 | import org.spongepowered.asm.mixin.injection.Inject; 9 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 10 | 11 | @Mixin(AbstractButton.class) 12 | public class MixinAbstractButton implements AbstractButtonAddon { 13 | private @Unique boolean ignoreKeys; 14 | 15 | @Override 16 | public void setIgnoreKeys(boolean ignoreKeys) { 17 | this.ignoreKeys = ignoreKeys; 18 | } 19 | 20 | @Inject(at = @At("HEAD"), method = "keyPressed", cancellable = true) 21 | private void keyPressed(int i, int j, int k, CallbackInfoReturnable cbi) { 22 | if (ignoreKeys) cbi.setReturnValue(false); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /common/Compat/Compat18/src/main/java/com/ptsmods/morecommands/mixin/compat/compat18/min/MixinSnowBlock.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.compat.compat18.min; 2 | 3 | import com.ptsmods.morecommands.api.IMoreGameRules; 4 | import net.minecraft.core.BlockPos; 5 | import net.minecraft.server.level.ServerLevel; 6 | import net.minecraft.world.level.block.SnowLayerBlock; 7 | import net.minecraft.world.level.block.state.BlockState; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.injection.At; 10 | import org.spongepowered.asm.mixin.injection.Inject; 11 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 12 | 13 | import java.util.Random; 14 | 15 | @Mixin(SnowLayerBlock.class) 16 | public class MixinSnowBlock { 17 | 18 | @Inject(at = @At("HEAD"), method = "randomTick", cancellable = true) 19 | public void randomTick(BlockState state, ServerLevel world, BlockPos pos, Random random, CallbackInfo cbi) { 20 | if (!world.getGameRules().getBoolean(IMoreGameRules.get().doMeltRule())) cbi.cancel(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /common/Compat/Compat194/src/main/java/com/ptsmods/morecommands/mixin/compat/compat194/plus/MixinLogoRenderer.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.compat.compat194.plus; 2 | 3 | import com.ptsmods.morecommands.api.clientoptions.ClientOption; 4 | import net.minecraft.client.gui.components.LogoRenderer; 5 | import org.spongepowered.asm.mixin.Final; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.Mutable; 8 | import org.spongepowered.asm.mixin.Shadow; 9 | import org.spongepowered.asm.mixin.injection.At; 10 | import org.spongepowered.asm.mixin.injection.Inject; 11 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 12 | 13 | @Mixin(LogoRenderer.class) 14 | public class MixinLogoRenderer { 15 | 16 | @Shadow @Final @Mutable 17 | private boolean showEasterEgg; 18 | 19 | @Inject(at = @At("RETURN"), method = "") 20 | private void init_easterEgg(boolean keepLogoThroughFade, CallbackInfo ci) { 21 | if (ClientOption.getBoolean("alwaysMinceraft")) 22 | showEasterEgg = true; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/common/MixinLivingEntityOriginsCompat.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.common; 2 | 3 | import com.ptsmods.morecommands.commands.elevated.SpeedCommand; 4 | import net.minecraft.world.entity.LivingEntity; 5 | import net.minecraft.world.entity.player.Player; 6 | import net.minecraft.world.phys.Vec3; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Redirect; 10 | 11 | @Mixin(LivingEntity.class) 12 | public class MixinLivingEntityOriginsCompat { 13 | 14 | @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/LivingEntity;moveRelative(FLnet/minecraft/world/phys/Vec3;)V"), method = "travel") 15 | private void travel_updateVelocity(LivingEntity thiz, float speed, Vec3 movementInput) { 16 | // Applying swim speed 17 | thiz.moveRelative(speed * (thiz instanceof Player ? (float) thiz.getAttributeValue(SpeedCommand.SpeedType.getSwimSpeedAttribute()) : 1f), movementInput); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/miscellaneous/FormattingColour.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api.miscellaneous; 2 | 3 | import com.ptsmods.morecommands.api.util.extensions.ObjectExtensions; 4 | import lombok.Getter; 5 | import lombok.experimental.ExtensionMethod; 6 | import net.minecraft.ChatFormatting; 7 | 8 | @ExtensionMethod(ObjectExtensions.class) 9 | public enum FormattingColour { 10 | BLACK, DARK_BLUE, DARK_GREEN, DARK_AQUA, DARK_RED, DARK_PURPLE, GOLD, GRAY, DARK_GRAY, BLUE, GREEN, AQUA, RED, LIGHT_PURPLE, YELLOW, WHITE, RAINBOW; 11 | 12 | @Getter(lazy = true) 13 | private static final ChatFormatting rainbow = getRainbowLazy(); 14 | 15 | public ChatFormatting asFormatting() { 16 | return this == RAINBOW ? getRainbow().or(ChatFormatting.WHITE) : ChatFormatting.values()[ordinal()]; 17 | } 18 | 19 | private static ChatFormatting getRainbowLazy() { 20 | try { 21 | return ChatFormatting.valueOf("RAINBOW"); 22 | } catch (Exception e) { 23 | return null; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /common/src/client/java/com/ptsmods/morecommands/client/gui/infohud/KeyContext.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.client.gui.infohud; 2 | 3 | import com.mojang.datafixers.util.Either; 4 | import lombok.NonNull; 5 | import net.minecraft.client.Minecraft; 6 | import net.minecraft.client.multiplayer.ClientLevel; 7 | import net.minecraft.client.multiplayer.MultiPlayerGameMode; 8 | import net.minecraft.client.player.LocalPlayer; 9 | import net.minecraft.world.phys.BlockHitResult; 10 | import net.minecraft.world.phys.EntityHitResult; 11 | 12 | import java.util.Objects; 13 | 14 | public record KeyContext(Minecraft client, Either hit) { 15 | @NonNull 16 | public ClientLevel getWorld() { 17 | return Objects.requireNonNull(client().level); 18 | } 19 | 20 | @NonNull 21 | public LocalPlayer getPlayer() { 22 | return Objects.requireNonNull(client().player); 23 | } 24 | 25 | @NonNull 26 | public MultiPlayerGameMode getInteractionManager() { 27 | return Objects.requireNonNull(client().gameMode); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/reach/MixinItem.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.reach; 2 | 3 | import com.ptsmods.morecommands.commands.elevated.ReachCommand; 4 | import net.minecraft.world.entity.player.Player; 5 | import net.minecraft.world.item.Item; 6 | import net.minecraft.world.level.ClipContext; 7 | import net.minecraft.world.level.Level; 8 | import net.minecraft.world.phys.Vec3; 9 | import org.spongepowered.asm.mixin.Mixin; 10 | import org.spongepowered.asm.mixin.injection.At; 11 | import org.spongepowered.asm.mixin.injection.Redirect; 12 | 13 | @Mixin(Item.class) 14 | public class MixinItem { 15 | @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/phys/Vec3;add(DDD)Lnet/minecraft/world/phys/Vec3;"), method = "getPlayerPOVHitResult") 16 | private static Vec3 raycast_add(Vec3 parent, double x, double y, double z, Level world, Player player, ClipContext.Fluid fluidHandling) { 17 | double reach = ReachCommand.getReach(player, false); 18 | return parent.add(x/5 * reach, y/5 * reach, z/5 * reach); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/commands/elevated/BroadcastCommand.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.commands.elevated; 2 | 3 | import com.mojang.brigadier.CommandDispatcher; 4 | import com.mojang.brigadier.arguments.StringArgumentType; 5 | import com.ptsmods.morecommands.api.util.Util; 6 | import com.ptsmods.morecommands.miscellaneous.Command; 7 | import net.minecraft.commands.CommandSourceStack; 8 | 9 | public class BroadcastCommand extends Command { 10 | @Override 11 | public void register(CommandDispatcher dispatcher) { 12 | dispatcher.register(literalReqOp("broadcast") 13 | .then(argument("msg", StringArgumentType.greedyString()) 14 | .executes(ctx -> { 15 | broadcast(ctx.getSource().getServer(), Util.translateFormats(ctx.getArgument("msg", String.class))); 16 | return 1; 17 | }))); 18 | } 19 | 20 | @Override 21 | public String getDocsPath() { 22 | return "/elevated/broadcast"; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /common/Compat/Compat19/src/main/java/com/ptsmods/morecommands/miscellaneous/ArgumentTypePropertiesImpl.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.miscellaneous; 2 | 3 | import com.ptsmods.morecommands.api.arguments.ArgumentTypeProperties; 4 | import com.ptsmods.morecommands.api.arguments.CompatArgumentType; 5 | import net.minecraft.commands.CommandBuildContext; 6 | import net.minecraft.commands.synchronization.ArgumentTypeInfo; 7 | import org.jetbrains.annotations.NotNull; 8 | 9 | public record ArgumentTypePropertiesImpl, T, P extends ArgumentTypeProperties>( 10 | ArgumentTypeProperties properties) implements ArgumentTypeInfo.Template { 11 | 12 | @Override 13 | public @NotNull A instantiate(@NotNull CommandBuildContext commandBuildContext) { 14 | return properties.createType(); 15 | } 16 | 17 | @SuppressWarnings("unchecked") 18 | @Override 19 | public @NotNull ArgumentTypeInfo type() { 20 | return (ArgumentTypeInfo) properties.getSerialiser().toVanillaSerialiser(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /common/Compat/Compat19/src/main/java/com/ptsmods/morecommands/mixin/compat/compat19/plus/MixinSnowBlock.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.compat.compat19.plus; 2 | 3 | import com.ptsmods.morecommands.api.IMoreGameRules; 4 | import net.minecraft.core.BlockPos; 5 | import net.minecraft.server.level.ServerLevel; 6 | import net.minecraft.util.RandomSource; 7 | import net.minecraft.world.level.block.SnowLayerBlock; 8 | import net.minecraft.world.level.block.state.BlockState; 9 | import org.spongepowered.asm.mixin.Mixin; 10 | import org.spongepowered.asm.mixin.injection.At; 11 | import org.spongepowered.asm.mixin.injection.Inject; 12 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 13 | 14 | @Mixin(SnowLayerBlock.class) 15 | public class MixinSnowBlock { 16 | 17 | @Inject(at = @At("HEAD"), method = "randomTick", cancellable = true) 18 | public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random, CallbackInfo cbi) { 19 | if (!world.getGameRules().getBoolean(IMoreGameRules.get().doMeltRule())) cbi.cancel(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /common/Compat/Compat190/build.gradle: -------------------------------------------------------------------------------- 1 | architectury { 2 | common(rootProject.enabled_platforms.split(",")) 3 | } 4 | 5 | dependencies { 6 | minecraft "com.mojang:minecraft:1.19" 7 | mappings loom.officialMojangMappings() 8 | 9 | // We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies 10 | modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" 11 | modApi "dev.architectury:architectury:${rootProject.architectury_version}" 12 | 13 | implementation project(path: ":common:API", configuration: "namedElements") 14 | implementation project(path: ":common:Compat:Compat17", configuration: "namedElements") 15 | implementation project(path: ":common:Compat:Compat18", configuration: "namedElements") 16 | implementation project(path: ":common:Compat:Compat180", configuration: "namedElements") 17 | implementation project(path: ":common:Compat:Compat182", configuration: "namedElements") 18 | implementation project(path: ":common:Compat:Compat19", configuration: "namedElements") 19 | } 20 | -------------------------------------------------------------------------------- /common/Compat/Compat193/src/main/java/com/ptsmods/morecommands/mixin/compat/compat193/min/MixinInventoryScreen.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.compat.compat193.min; 2 | 3 | import com.ptsmods.morecommands.api.clientoptions.ClientOption; 4 | import net.minecraft.client.gui.screens.inventory.InventoryScreen; 5 | import net.minecraft.world.entity.LivingEntity; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.injection.At; 8 | import org.spongepowered.asm.mixin.injection.Redirect; 9 | 10 | @Mixin(InventoryScreen.class) 11 | public class MixinInventoryScreen { 12 | @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/inventory/InventoryScreen;renderEntityInInventory(IIIFFLnet/minecraft/world/entity/LivingEntity;)V"), method = "renderBg") 13 | public void drawBackground_drawEntity(int x, int y, int size, float mouseX, float mouseY, LivingEntity entity) { 14 | InventoryScreen.renderEntityInInventory(x, y, (int) (size * (ClientOption.getBoolean("renderOwnTag") ? 0.95f : 1f)), mouseX, mouseY, entity); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /common/src/client/java/com/ptsmods/morecommands/client/commands/SendCommand.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.client.commands; 2 | 3 | import com.mojang.brigadier.CommandDispatcher; 4 | import com.mojang.brigadier.arguments.StringArgumentType; 5 | import com.ptsmods.morecommands.api.util.compat.client.ClientCompat; 6 | import com.ptsmods.morecommands.client.miscellaneous.ClientCommand; 7 | import net.minecraft.client.multiplayer.ClientSuggestionProvider; 8 | 9 | public class SendCommand extends ClientCommand { 10 | @Override 11 | public void cRegister(CommandDispatcher dispatcher) { 12 | dispatcher.register(cLiteral("send") 13 | .then(cArgument("msg", StringArgumentType.greedyString()) 14 | .executes(ctx -> { 15 | ClientCompat.get().sendChatOrCmd(ctx.getArgument("msg", String.class), false); 16 | return 1; 17 | }))); 18 | } 19 | 20 | @Override 21 | public String getDocsPath() { 22 | return "/send"; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/IDataTrackerHelper.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api; 2 | 3 | import java.util.Optional; 4 | import java.util.UUID; 5 | import net.minecraft.core.BlockPos; 6 | import net.minecraft.nbt.CompoundTag; 7 | import net.minecraft.network.chat.Component; 8 | import net.minecraft.network.syncher.EntityDataAccessor; 9 | 10 | public interface IDataTrackerHelper { 11 | @SuppressWarnings("deprecation") // Holder not API 12 | static IDataTrackerHelper get() { 13 | return Holder.getDataTrackerHelper(); 14 | } 15 | 16 | EntityDataAccessor mayFly(); 17 | EntityDataAccessor invulnerable(); 18 | EntityDataAccessor superpickaxe(); 19 | EntityDataAccessor vanish(); 20 | EntityDataAccessor vanishToggled(); 21 | EntityDataAccessor> chair(); 22 | EntityDataAccessor vaults(); 23 | EntityDataAccessor> nickname(); 24 | EntityDataAccessor> speedModifier(); 25 | EntityDataAccessor jesus(); 26 | } 27 | -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/callbacks/PacketReceiveEvent.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api.callbacks; 2 | 3 | import dev.architectury.event.Event; 4 | import dev.architectury.event.EventFactory; 5 | import net.minecraft.network.PacketListener; 6 | import net.minecraft.network.protocol.Packet; 7 | 8 | public interface PacketReceiveEvent { 9 | Event PRE = EventFactory.of(callbacks -> (packet, listener) -> { 10 | for (PacketReceiveEvent.Pre callback : callbacks) 11 | if (callback.onReceive(packet, listener)) 12 | return true; 13 | return false; 14 | }); 15 | Event POST = EventFactory.of(callbacks -> (packet, listener) -> { 16 | for (PacketReceiveEvent.Post callback : callbacks) 17 | callback.onReceive(packet, listener); 18 | }); 19 | 20 | interface Pre { 21 | boolean onReceive(Packet packet, PacketListener listener); 22 | } 23 | 24 | interface Post { 25 | void onReceive(Packet packet, PacketListener listener); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/util/extensions/ObjectExtensions.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api.util.extensions; 2 | 3 | import lombok.NonNull; 4 | 5 | import java.util.Objects; 6 | import java.util.function.Consumer; 7 | import java.util.function.Function; 8 | import java.util.function.Supplier; 9 | 10 | public class ObjectExtensions { 11 | 12 | @NonNull 13 | public static T or(T self, T other) { 14 | return self == null ? Objects.requireNonNull(other) : self; 15 | } 16 | 17 | @NonNull 18 | public static T or(T self, Supplier supplier) { 19 | return self == null ? Objects.requireNonNull(supplier.get()) : self; 20 | } 21 | 22 | // Lombok (or at least the IntelliJ plugin) cannot handle multiple methods with the same name. 23 | public static R ifNonNull(T self, @NonNull Function mapper) { 24 | return self == null ? null : mapper.apply(self); 25 | } 26 | 27 | public static void ifNonNullV(T self, @NonNull Consumer mapper) { 28 | if (self != null) mapper.accept(self); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /common/Compat/Compat193/src/main/java/com/ptsmods/morecommands/mixin/compat/compat193/MixinPainting.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.compat.compat193; 2 | 3 | import com.ptsmods.morecommands.api.addons.PaintingAddon; 4 | import net.minecraft.core.Holder; 5 | import net.minecraft.world.entity.decoration.Painting; 6 | import net.minecraft.world.entity.decoration.PaintingVariant; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.Shadow; 9 | 10 | @Mixin(Painting.class) 11 | public abstract class MixinPainting implements PaintingAddon { 12 | 13 | @Shadow public abstract Holder getVariant(); 14 | 15 | @Shadow public abstract void setVariant(Holder holder); 16 | 17 | @Override 18 | public Object mc$getVariant() { 19 | // srg name for getVariant() changed in 1.19.3, otherwise no changes from the 1.19 version. 20 | return getVariant().value(); 21 | } 22 | 23 | @Override 24 | public void mc$setVariant(Object variant) { 25 | setVariant(Holder.direct((PaintingVariant) variant)); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /common/src/client/java/com/ptsmods/morecommands/client/mixin/MixinPlayerTabOverlay.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.client.mixin; 2 | 3 | import com.ptsmods.morecommands.clientoption.ClientOptions; 4 | import net.minecraft.client.gui.components.PlayerTabOverlay; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.ModifyArg; 8 | import org.spongepowered.asm.mixin.injection.ModifyVariable; 9 | 10 | @Mixin(PlayerTabOverlay.class) 11 | public class MixinPlayerTabOverlay { 12 | @ModifyVariable(at = @At("STORE"), index = 14, method = "render") 13 | public int render_s(int s) { 14 | return s + (ClientOptions.Rendering.showExactLatency.getValue() ? 15 : 0); 15 | } 16 | 17 | @ModifyArg(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/components/PlayerTabOverlay;fill(Lcom/mojang/blaze3d/vertex/PoseStack;IIIII)V"), index = 3, method = "render") 18 | public int render_fill_x2(int x2) { 19 | return x2 + (ClientOptions.Rendering.showExactLatency.getValue() ? 2 : 1); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/reach/MixinContainer.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.reach; 2 | 3 | import com.ptsmods.morecommands.commands.elevated.ReachCommand; 4 | import net.minecraft.world.Container; 5 | import net.minecraft.world.entity.player.Player; 6 | import net.minecraft.world.level.block.entity.BlockEntity; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.ModifyArg; 10 | 11 | @Mixin(Container.class) 12 | public interface MixinContainer { 13 | @ModifyArg(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/Container;stillValidBlockEntity(Lnet/minecraft/world/level/block/entity/BlockEntity;Lnet/minecraft/world/entity/player/Player;I)Z"), 14 | method = "stillValidBlockEntity(Lnet/minecraft/world/level/block/entity/BlockEntity;Lnet/minecraft/world/entity/player/Player;)Z", index = 2) 15 | private static int stillValidBlockEntity(BlockEntity be, Player player, int reach) { 16 | return (int) Math.ceil(ReachCommand.getReach(player, false)); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /common/Compat/Compat193/src/main/java/com/ptsmods/morecommands/mixin/compat/compat193/plus/MixinFlowingFluid.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.compat.compat193.plus; 2 | 3 | import com.ptsmods.morecommands.api.IMoreGameRules; 4 | import net.minecraft.world.level.Level; 5 | import net.minecraft.world.level.material.FlowingFluid; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.Shadow; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Redirect; 10 | 11 | @Mixin(FlowingFluid.class) 12 | public abstract class MixinFlowingFluid { 13 | @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/material/FlowingFluid;canConvertToSource(Lnet/minecraft/world/level/Level;)Z"), method = "getNewLiquid") 14 | private boolean getNewLiquid_canConvertToSource(FlowingFluid instance, Level level) { 15 | return level.getGameRules().getBoolean(IMoreGameRules.get().fluidsInfiniteRule()) || canConvertToSource(level); 16 | } 17 | 18 | @Shadow 19 | protected abstract boolean canConvertToSource(Level level); 20 | } 21 | -------------------------------------------------------------------------------- /common/Compat/Compat17/src/main/java/com/ptsmods/morecommands/mixin/compat/compat17/MixinServerWorld.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.compat.compat17; 2 | 3 | import com.ptsmods.morecommands.api.IMoreGameRules; 4 | import com.ptsmods.morecommands.api.ReflectionHelper; 5 | import net.minecraft.core.BlockPos; 6 | import net.minecraft.server.level.ServerLevel; 7 | import net.minecraft.world.level.Level; 8 | import net.minecraft.world.level.material.FluidState; 9 | import org.spongepowered.asm.mixin.Mixin; 10 | import org.spongepowered.asm.mixin.injection.At; 11 | import org.spongepowered.asm.mixin.injection.Redirect; 12 | 13 | @Mixin(ServerLevel.class) 14 | public class MixinServerWorld { 15 | @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/material/FluidState;tick(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;)V"), method = "tickLiquid") 16 | private void tickFluid(FluidState state, Level world, BlockPos pos) { 17 | if (ReflectionHelper.cast(this).getGameRules().getBoolean(IMoreGameRules.get().doLiquidFlowRule())) state.tick(world, pos); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /common/Compat/Compat193/src/main/java/com/ptsmods/morecommands/mixin/compat/compat193/min/MixinFarmBlock.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.compat.compat193.min; 2 | 3 | import com.ptsmods.morecommands.api.IMoreGameRules; 4 | import net.minecraft.core.BlockPos; 5 | import net.minecraft.world.level.Level; 6 | import net.minecraft.world.level.block.FarmBlock; 7 | import net.minecraft.world.level.block.state.BlockState; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.injection.At; 10 | import org.spongepowered.asm.mixin.injection.Redirect; 11 | 12 | @Mixin(FarmBlock.class) 13 | public class MixinFarmBlock { 14 | 15 | @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/FarmBlock;turnToDirt(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;)V"), method = "fallOn") 16 | private void onLandedUpon_setToDirt(BlockState state, Level world, BlockPos pos) { 17 | if (world.getGameRules().getBoolean(IMoreGameRules.get().doFarmlandTrampleRule())) FarmBlock.turnToDirt(state, world, pos); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /common/src/client/java/com/ptsmods/morecommands/client/reachmixin/MixinClientPlayerInteractionManager.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.client.reachmixin; 2 | 3 | import com.ptsmods.morecommands.commands.elevated.ReachCommand; 4 | import net.minecraft.client.Minecraft; 5 | import net.minecraft.client.multiplayer.MultiPlayerGameMode; 6 | import org.spongepowered.asm.mixin.Final; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.Shadow; 9 | import org.spongepowered.asm.mixin.injection.At; 10 | import org.spongepowered.asm.mixin.injection.Inject; 11 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 12 | 13 | import java.util.Objects; 14 | 15 | @Mixin(MultiPlayerGameMode.class) 16 | public class MixinClientPlayerInteractionManager { 17 | @Shadow @Final private Minecraft minecraft; 18 | 19 | @Inject(at = @At("RETURN"), method = "getPickRange", cancellable = true) 20 | public void getReachDistance(CallbackInfoReturnable cbi) { 21 | cbi.setReturnValue((float) ReachCommand.getReach(Objects.requireNonNull(minecraft.player), false)); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /common/Compat/Compat18/src/main/java/com/ptsmods/morecommands/mixin/compat/compat18/plus/MixinServerWorld.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.compat.compat18.plus; 2 | 3 | import com.ptsmods.morecommands.api.IMoreGameRules; 4 | import com.ptsmods.morecommands.api.ReflectionHelper; 5 | import net.minecraft.core.BlockPos; 6 | import net.minecraft.server.level.ServerLevel; 7 | import net.minecraft.world.level.Level; 8 | import net.minecraft.world.level.material.FluidState; 9 | import org.spongepowered.asm.mixin.Mixin; 10 | import org.spongepowered.asm.mixin.injection.At; 11 | import org.spongepowered.asm.mixin.injection.Redirect; 12 | 13 | @Mixin(ServerLevel.class) 14 | public class MixinServerWorld { 15 | @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/material/FluidState;tick(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;)V"), method = "tickFluid") 16 | private void tickFluid(FluidState state, Level world, BlockPos pos) { 17 | if (ReflectionHelper.cast(this).getGameRules().getBoolean(IMoreGameRules.get().doLiquidFlowRule())) state.tick(world, pos); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /common/Compat/Compat194/src/main/java/com/ptsmods/morecommands/mixin/compat/compat194/plus/MixinPainting.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.compat.compat194.plus; 2 | 3 | import com.ptsmods.morecommands.api.addons.PaintingAddon; 4 | import net.minecraft.core.Holder; 5 | import net.minecraft.world.entity.decoration.Painting; 6 | import net.minecraft.world.entity.decoration.PaintingVariant; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.Shadow; 9 | 10 | @Mixin(Painting.class) 11 | public abstract class MixinPainting implements PaintingAddon { 12 | 13 | @Shadow public abstract Holder getVariant(); 14 | 15 | @Shadow public abstract void setVariant(Holder holder); 16 | 17 | @Override 18 | public Object mc$getVariant() { 19 | // srg name for getVariant() changed again in 1.19.4, otherwise no changes from the 1.19 or 1.19.3 version. 20 | return getVariant().value(); 21 | } 22 | 23 | @Override 24 | public void mc$setVariant(Object variant) { 25 | setVariant(Holder.direct((PaintingVariant) variant)); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /common/Compat/Compat17/src/main/java/com/ptsmods/morecommands/miscellaneous/EESoundOld.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.miscellaneous; 2 | 3 | import com.ptsmods.morecommands.api.IMoreCommands; 4 | import net.minecraft.client.Minecraft; 5 | import net.minecraft.client.resources.sounds.AbstractTickableSoundInstance; 6 | import net.minecraft.sounds.SoundSource; 7 | import net.minecraft.world.phys.Vec3; 8 | 9 | import java.util.Objects; 10 | 11 | public class EESoundOld extends AbstractTickableSoundInstance { 12 | 13 | public EESoundOld() { 14 | super(IMoreCommands.get().getEESound().get(), SoundSource.MASTER); 15 | pitch = 0f; 16 | looping = true; 17 | tick(); 18 | } 19 | 20 | @Override 21 | public boolean canStartSilent() { 22 | return true; 23 | } 24 | 25 | @Override 26 | public boolean canPlaySound() { 27 | return true; 28 | } 29 | 30 | @Override 31 | public void tick() { 32 | Vec3 pos = Objects.requireNonNull(Minecraft.getInstance().player).position(); 33 | x = pos.x; 34 | y = pos.y; 35 | z = pos.z; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /common/Compat/Compat17/src/main/java/com/ptsmods/morecommands/miscellaneous/CopySoundOld.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.miscellaneous; 2 | 3 | import com.ptsmods.morecommands.api.IMoreCommands; 4 | import net.minecraft.client.Minecraft; 5 | import net.minecraft.client.resources.sounds.AbstractTickableSoundInstance; 6 | import net.minecraft.sounds.SoundSource; 7 | import net.minecraft.world.phys.Vec3; 8 | 9 | import java.util.Objects; 10 | 11 | public class CopySoundOld extends AbstractTickableSoundInstance { 12 | 13 | public CopySoundOld() { 14 | super(IMoreCommands.get().getCopySound().get(), SoundSource.MASTER); 15 | volume = .25f; 16 | looping = false; 17 | tick(); 18 | } 19 | 20 | @Override 21 | public boolean canStartSilent() { 22 | return true; 23 | } 24 | 25 | @Override 26 | public boolean canPlaySound() { 27 | return true; 28 | } 29 | 30 | @Override 31 | public void tick() { 32 | Vec3 pos = Objects.requireNonNull(Minecraft.getInstance().player).position(); 33 | x = pos.x; 34 | y = pos.y; 35 | z = pos.z; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /common/Compat/Compat19/src/main/java/com/ptsmods/morecommands/mixin/compat/compat19/plus/reach/MixinServerGamePacketListenerImpl.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.compat.compat19.plus.reach; 2 | 3 | import com.ptsmods.morecommands.api.IMoreCommands; 4 | import net.minecraft.server.level.ServerPlayer; 5 | import net.minecraft.server.network.ServerGamePacketListenerImpl; 6 | import org.objectweb.asm.Opcodes; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.Shadow; 9 | import org.spongepowered.asm.mixin.injection.At; 10 | import org.spongepowered.asm.mixin.injection.Redirect; 11 | 12 | @Mixin(ServerGamePacketListenerImpl.class) 13 | public class MixinServerGamePacketListenerImpl { 14 | @Shadow public ServerPlayer player; 15 | 16 | @Redirect(at = @At(value = "FIELD", opcode = Opcodes.GETSTATIC, target = "Lnet/minecraft/server/network/ServerGamePacketListenerImpl;MAX_INTERACTION_DISTANCE:D"), 17 | method = {"handleInteract", "handleUseItemOn"}) 18 | public double onPlayerInteractEntity_maxInteractionDistance() { 19 | return IMoreCommands.get().getReach(player, true); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/commands/unelevated/TopCommand.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.commands.unelevated; 2 | 3 | import com.mojang.brigadier.CommandDispatcher; 4 | import com.ptsmods.morecommands.MoreCommands; 5 | import com.ptsmods.morecommands.miscellaneous.Command; 6 | import net.minecraft.commands.CommandSourceStack; 7 | 8 | public class TopCommand extends Command { 9 | @Override 10 | public void register(CommandDispatcher dispatcher) { 11 | dispatcher.register(literalReq("top") 12 | .executes(ctx -> { 13 | ctx.getSource().getEntityOrException().teleportToWithTicket(ctx.getSource().getPosition().x, MoreCommands.getY(ctx.getSource().getLevel(), 14 | (int) ctx.getSource().getPosition().x, (int) ctx.getSource().getPosition().z), ctx.getSource().getPosition().z); 15 | sendMsg(ctx, "You have been teleported through the roof."); 16 | return 1; 17 | })); 18 | } 19 | 20 | @Override 21 | public String getDocsPath() { 22 | return "/unelevated/top"; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /common/Compat/Compat18/src/main/java/com/ptsmods/morecommands/mixin/compat/compat18/min/MixinBackgroundRenderer.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.compat.compat18.min; 2 | 3 | import com.ptsmods.morecommands.api.clientoptions.BooleanClientOption; 4 | import com.ptsmods.morecommands.api.clientoptions.ClientOption; 5 | import com.ptsmods.morecommands.api.clientoptions.ClientOptionCategory; 6 | import net.minecraft.client.Camera; 7 | import net.minecraft.client.renderer.FogRenderer; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.injection.At; 10 | import org.spongepowered.asm.mixin.injection.Inject; 11 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 12 | 13 | @Mixin(FogRenderer.class) 14 | public class MixinBackgroundRenderer { 15 | 16 | @Inject(at = @At("HEAD"), method = "setupFog", cancellable = true) 17 | private static void applyFog(Camera camera, FogRenderer.FogMode fogType, float viewDistance, boolean thickFog, CallbackInfo cbi) { 18 | if (!((BooleanClientOption) ClientOption.getOptions().get(ClientOptionCategory.RENDERING).get("Render Fog")).getValue()) cbi.cancel(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/common/MixinPlayerInventory.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.common; 2 | 3 | import com.ptsmods.morecommands.api.IDataTrackerHelper; 4 | import com.ptsmods.morecommands.api.ReflectionHelper; 5 | import net.minecraft.world.entity.player.Inventory; 6 | import net.minecraft.world.item.PickaxeItem; 7 | import net.minecraft.world.level.block.state.BlockState; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.injection.At; 10 | import org.spongepowered.asm.mixin.injection.Inject; 11 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 12 | 13 | @Mixin(Inventory.class) 14 | public class MixinPlayerInventory { 15 | 16 | @Inject(at = @At("RETURN"), method = "getDestroySpeed", cancellable = true) 17 | public void getBlockBreakingSpeed(BlockState block, CallbackInfoReturnable cbi) { 18 | Inventory thiz = ReflectionHelper.cast(this); 19 | if (thiz.items.get(thiz.selected).getItem() instanceof PickaxeItem && thiz.player.getEntityData().get(IDataTrackerHelper.get().superpickaxe())) cbi.setReturnValue(Float.MAX_VALUE); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /common/Compat/Compat19/src/main/java/com/ptsmods/morecommands/mixin/compat/compat19/plus/MixinBackgroundRenderer.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.compat.compat19.plus; 2 | 3 | import com.ptsmods.morecommands.api.clientoptions.BooleanClientOption; 4 | import com.ptsmods.morecommands.api.clientoptions.ClientOption; 5 | import com.ptsmods.morecommands.api.clientoptions.ClientOptionCategory; 6 | import net.minecraft.client.Camera; 7 | import net.minecraft.client.renderer.FogRenderer; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.injection.At; 10 | import org.spongepowered.asm.mixin.injection.Inject; 11 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 12 | 13 | @Mixin(FogRenderer.class) 14 | public class MixinBackgroundRenderer { 15 | 16 | @Inject(at = @At("HEAD"), method = "setupFog", cancellable = true) 17 | private static void applyFog(Camera camera, FogRenderer.FogMode fogType, float viewDistance, boolean thickFog, float f, CallbackInfo cbi) { 18 | if (!((BooleanClientOption) ClientOption.getOptions().get(ClientOptionCategory.RENDERING).get("Render Fog")).getValue()) cbi.cancel(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /common/src/client/java/com/ptsmods/morecommands/client/mixin/MixinLivingEntityRenderer.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.client.mixin; 2 | 3 | import com.ptsmods.morecommands.clientoption.ClientOptions; 4 | import net.minecraft.client.Minecraft; 5 | import net.minecraft.client.model.EntityModel; 6 | import net.minecraft.client.renderer.entity.LivingEntityRenderer; 7 | import net.minecraft.world.entity.LivingEntity; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.injection.At; 10 | import org.spongepowered.asm.mixin.injection.Inject; 11 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 12 | 13 | @Mixin(LivingEntityRenderer.class) 14 | public class MixinLivingEntityRenderer> { 15 | 16 | @Inject(at = @At("RETURN"), method = "shouldShowName(Lnet/minecraft/world/entity/LivingEntity;)Z", cancellable = true) 17 | public void hasLabel(T livingEntity, CallbackInfoReturnable cbi) { 18 | if (ClientOptions.Rendering.renderOwnTag.getValue() && livingEntity == Minecraft.getInstance().player) 19 | cbi.setReturnValue(true); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/common/MixinTimeCommand.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.common; 2 | 3 | import net.minecraft.commands.CommandSourceStack; 4 | import net.minecraft.network.protocol.game.ClientboundSetTimePacket; 5 | import net.minecraft.server.commands.TimeCommand; 6 | import net.minecraft.world.level.GameRules; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Inject; 10 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 11 | 12 | @Mixin(TimeCommand.class) 13 | public class MixinTimeCommand { 14 | // Applies a fix so the time immediately updates on clients once the command is run. 15 | @Inject(at = @At("RETURN"), method = "setTime") 16 | private static void executeSet(CommandSourceStack source, int time, CallbackInfoReturnable cbi) { 17 | source.getServer().getPlayerList().broadcastAll(new ClientboundSetTimePacket(source.getLevel().getGameTime(), 18 | source.getLevel().getDayTime(), source.getLevel().getGameRules().getBoolean(GameRules.RULE_DAYLIGHT))); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /forge/src/main/java/com/ptsmods/morecommands/mixin/forge/MixinHopperBlockEntity.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.forge; 2 | 3 | import com.ptsmods.morecommands.api.IMoreGameRules; 4 | import net.minecraft.core.BlockPos; 5 | import net.minecraft.world.item.ItemStack; 6 | import net.minecraft.world.level.Level; 7 | import net.minecraft.world.level.block.entity.HopperBlockEntity; 8 | import net.minecraft.world.level.block.state.BlockState; 9 | import org.spongepowered.asm.mixin.Mixin; 10 | import org.spongepowered.asm.mixin.injection.At; 11 | import org.spongepowered.asm.mixin.injection.Redirect; 12 | 13 | @Mixin(HopperBlockEntity.class) 14 | public class MixinHopperBlockEntity { 15 | @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/entity/HopperBlockEntity;removeItem(II)Lnet/minecraft/world/item/ItemStack;"), method = "ejectItems") 16 | private static ItemStack insert_removeStack(HopperBlockEntity hopper, int slot, int amount, Level world, BlockPos blockPos, BlockState blockState, HopperBlockEntity hopper0) { 17 | return hopper.removeItem(slot, world.getGameRules().getInt(IMoreGameRules.get().hopperTransferRateRule())); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /common/Compat/Compat191/build.gradle: -------------------------------------------------------------------------------- 1 | architectury { 2 | common(rootProject.enabled_platforms.split(",")) 3 | } 4 | 5 | dependencies { 6 | minecraft "com.mojang:minecraft:1.19.1" 7 | mappings loom.officialMojangMappings() 8 | 9 | // We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies 10 | modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" 11 | modApi "dev.architectury:architectury:${rootProject.architectury_version}" 12 | 13 | implementation project(path: ":common:API", configuration: "namedElements") 14 | implementation project(path: ":common:Compat:Compat17", configuration: "namedElements") 15 | implementation project(path: ":common:Compat:Compat18", configuration: "namedElements") 16 | implementation project(path: ":common:Compat:Compat180", configuration: "namedElements") 17 | implementation project(path: ":common:Compat:Compat182", configuration: "namedElements") 18 | implementation project(path: ":common:Compat:Compat19", configuration: "namedElements") 19 | implementation project(path: ":common:Compat:Compat190", configuration: "namedElements") 20 | } 21 | -------------------------------------------------------------------------------- /common/src/client/java/com/ptsmods/morecommands/client/mixin/MixinInGameHud.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.client.mixin; 2 | 3 | import com.mojang.blaze3d.vertex.PoseStack; 4 | import com.ptsmods.morecommands.clientoption.ClientOptions; 5 | import com.ptsmods.morecommands.util.Rainbow; 6 | import net.minecraft.client.Minecraft; 7 | import net.minecraft.client.gui.Gui; 8 | import net.minecraft.client.gui.GuiComponent; 9 | import org.spongepowered.asm.mixin.Mixin; 10 | import org.spongepowered.asm.mixin.injection.At; 11 | import org.spongepowered.asm.mixin.injection.Inject; 12 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 13 | 14 | @Mixin(Gui.class) 15 | public class MixinInGameHud { 16 | 17 | @Inject(at = @At("HEAD"), method = "render") 18 | private void render(PoseStack stack, float tickDelta, CallbackInfo cbi) { 19 | if (ClientOptions.EasterEggs.rainbows.getValue() && Rainbow.getInstance() != null) 20 | GuiComponent.fill(stack, 0, 0, Minecraft.getInstance().getWindow().getScreenWidth(), Minecraft.getInstance().getWindow().getScreenHeight(), 21 | Rainbow.getInstance().getRainbowColour(false, 0.1f)); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /common/Compat/Compat182/src/main/java/com/ptsmods/morecommands/mixin/compat/compat182/plus/MixinLivingEntity.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.compat.compat182.plus; 2 | 3 | import com.ptsmods.morecommands.api.IDataTrackerHelper; 4 | import com.ptsmods.morecommands.api.ReflectionHelper; 5 | import net.minecraft.world.entity.LivingEntity; 6 | import net.minecraft.world.entity.player.Player; 7 | import net.minecraft.world.level.material.FluidState; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.injection.At; 10 | import org.spongepowered.asm.mixin.injection.Inject; 11 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 12 | 13 | @Mixin(LivingEntity.class) 14 | public class MixinLivingEntity { 15 | 16 | @Inject(at = @At("HEAD"), method = "canStandOnFluid", cancellable = true) 17 | public void canWalkOnFluid(FluidState fluidState, CallbackInfoReturnable cbi) { 18 | if (ReflectionHelper.cast(this) instanceof Player && 19 | ReflectionHelper.cast(this).getEntityData().get(IDataTrackerHelper.get().jesus())) 20 | cbi.setReturnValue(true); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /common/src/client/java/com/ptsmods/morecommands/client/mixin/MixinTitleScreen.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.client.mixin; 2 | 3 | import com.ptsmods.morecommands.clientoption.ClientOptions; 4 | import com.ptsmods.morecommands.util.Rainbow; 5 | import net.minecraft.client.Minecraft; 6 | import net.minecraft.client.gui.screens.TitleScreen; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.Shadow; 9 | import org.spongepowered.asm.mixin.injection.At; 10 | import org.spongepowered.asm.mixin.injection.Inject; 11 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 12 | 13 | @Mixin(TitleScreen.class) 14 | public class MixinTitleScreen { 15 | @Shadow private String splash; 16 | 17 | @Inject(at = @At("HEAD"), method = "init()V") 18 | private void init(CallbackInfo cbi) { // Couldn't get it to work with ModifyVariable for whatever reason. 19 | if (splash == null) splash = Minecraft.getInstance().getSplashManager().getSplash(); 20 | if (splash != null) splash = ClientOptions.Tweaks.rainbowSplash.getValue() && Rainbow.getInstance() != null ? 21 | Rainbow.getInstance().RAINBOW + splash : splash; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/common/MixinFluidBlock.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.common; 2 | 3 | import com.ptsmods.morecommands.MoreCommands; 4 | import com.ptsmods.morecommands.clientoption.ClientOptions; 5 | import net.minecraft.core.BlockPos; 6 | import net.minecraft.world.level.BlockGetter; 7 | import net.minecraft.world.level.block.LiquidBlock; 8 | import net.minecraft.world.level.block.state.BlockState; 9 | import net.minecraft.world.phys.shapes.CollisionContext; 10 | import net.minecraft.world.phys.shapes.Shapes; 11 | import net.minecraft.world.phys.shapes.VoxelShape; 12 | import org.spongepowered.asm.mixin.Mixin; 13 | import org.spongepowered.asm.mixin.Overwrite; 14 | 15 | @Mixin(LiquidBlock.class) 16 | public class MixinFluidBlock { 17 | /** 18 | * @author PlanetTeamSpeak 19 | * @reason We give fluids an outline shape when the targetFluids client tweak option is enabled. 20 | */ 21 | @Overwrite 22 | public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { 23 | return ClientOptions.Tweaks.targetFluids.getValue() ? MoreCommands.getFluidShape(state) : Shapes.empty(); 24 | } 25 | } -------------------------------------------------------------------------------- /fabric/src/main/java/com/ptsmods/morecommands/mixin/fabric/MixinHopperBlockEntity.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.fabric; 2 | 3 | import com.ptsmods.morecommands.api.IMoreGameRules; 4 | import net.minecraft.core.BlockPos; 5 | import net.minecraft.world.Container; 6 | import net.minecraft.world.item.ItemStack; 7 | import net.minecraft.world.level.Level; 8 | import net.minecraft.world.level.block.entity.HopperBlockEntity; 9 | import net.minecraft.world.level.block.state.BlockState; 10 | import org.spongepowered.asm.mixin.Mixin; 11 | import org.spongepowered.asm.mixin.injection.At; 12 | import org.spongepowered.asm.mixin.injection.Redirect; 13 | 14 | @Mixin(HopperBlockEntity.class) 15 | public class MixinHopperBlockEntity { 16 | @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/Container;removeItem(II)Lnet/minecraft/world/item/ItemStack;"), method = "ejectItems") 17 | private static ItemStack insert_removeStack(Container inventory, int slot, int amount, Level world, BlockPos blockPos, BlockState blockState, Container inventory0) { 18 | return inventory.removeItem(slot, world.getGameRules().getInt(IMoreGameRules.get().hopperTransferRateRule())); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /common/src/client/java/com/ptsmods/morecommands/client/gui/infohud/variables/AbstractVariable.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.client.gui.infohud.variables; 2 | 3 | import com.mojang.blaze3d.vertex.PoseStack; 4 | import java.util.function.BiConsumer; 5 | 6 | abstract class AbstractVariable implements Variable { 7 | protected final String name; 8 | protected final T defaultValue; 9 | private final BiConsumer applicator; 10 | 11 | public AbstractVariable(String name, T defaultValue, BiConsumer applicator) { 12 | this.name = name; 13 | this.defaultValue = defaultValue; 14 | this.applicator = applicator; 15 | } 16 | 17 | @Override 18 | public String getName() { 19 | return name; 20 | } 21 | 22 | @Override 23 | public T getDefaultValue() { 24 | return defaultValue; 25 | } 26 | 27 | @Override 28 | public void apply(PoseStack matrixStack, Object value) { 29 | applicator.accept(matrixStack, upcast(value)); 30 | } 31 | 32 | @Override 33 | public void applyDefault(PoseStack matrixStack) { 34 | applicator.accept(matrixStack, getDefaultValue()); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /common/Compat/Compat193/src/main/java/com/ptsmods/morecommands/mixin/compat/compat193/min/MixinCreativeModeInventoryScreen.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.compat.compat193.min; 2 | 3 | import com.ptsmods.morecommands.api.clientoptions.ClientOption; 4 | import net.minecraft.client.gui.screens.inventory.CreativeModeInventoryScreen; 5 | import net.minecraft.client.gui.screens.inventory.InventoryScreen; 6 | import net.minecraft.world.entity.LivingEntity; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Redirect; 10 | 11 | @Mixin(CreativeModeInventoryScreen.class) 12 | public class MixinCreativeModeInventoryScreen { 13 | @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/inventory/InventoryScreen;renderEntityInInventory(IIIFFLnet/minecraft/world/entity/LivingEntity;)V"), method = "renderBg") 14 | public void drawBackground_drawEntity(int x, int y, int size, float mouseX, float mouseY, LivingEntity entity) { 15 | InventoryScreen.renderEntityInInventory(x, y, (int) (size * (ClientOption.getBoolean("renderOwnTag") ? 0.85f : 1f)), mouseX, mouseY, entity); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /common/Compat/Compat19/src/main/java/com/ptsmods/morecommands/miscellaneous/EESoundNew.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.miscellaneous; 2 | 3 | import com.ptsmods.morecommands.api.IMoreCommands; 4 | import net.minecraft.client.Minecraft; 5 | import net.minecraft.client.resources.sounds.AbstractTickableSoundInstance; 6 | import net.minecraft.sounds.SoundSource; 7 | import net.minecraft.util.RandomSource; 8 | import net.minecraft.world.phys.Vec3; 9 | 10 | import java.util.Objects; 11 | 12 | public class EESoundNew extends AbstractTickableSoundInstance { 13 | 14 | public EESoundNew() { 15 | super(IMoreCommands.get().getEESound().get(), SoundSource.MASTER, RandomSource.create()); 16 | pitch = 0f; 17 | looping = true; 18 | tick(); 19 | } 20 | 21 | @Override 22 | public boolean canStartSilent() { 23 | return true; 24 | } 25 | 26 | @Override 27 | public boolean canPlaySound() { 28 | return true; 29 | } 30 | 31 | @Override 32 | public void tick() { 33 | Vec3 pos = Objects.requireNonNull(Minecraft.getInstance().player).position(); 34 | x = pos.x; 35 | y = pos.y; 36 | z = pos.z; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /common/Compat/Compat191/src/main/java/com/ptsmods/morecommands/mixin/compat/compat191/until193/MixinLocalPlayer.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.compat.compat191.until193; 2 | 3 | import com.ptsmods.morecommands.api.IMoreCommandsClient; 4 | import net.minecraft.client.player.LocalPlayer; 5 | import net.minecraft.network.chat.Component; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.injection.At; 8 | import org.spongepowered.asm.mixin.injection.Inject; 9 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 10 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 11 | 12 | @Mixin(LocalPlayer.class) 13 | public class MixinLocalPlayer { 14 | 15 | @Inject(at = @At("HEAD"), method = "commandUnsigned", cancellable = true) 16 | public void commandUnsigned(String message, CallbackInfoReturnable cbi) { 17 | IMoreCommandsClient.handleCommand(message, cbi); 18 | } 19 | 20 | @Inject(at = @At("HEAD"), method = "sendCommand", cancellable = true) 21 | public void sendCommand(String message, Component component, CallbackInfo cbi) { 22 | IMoreCommandsClient.handleCommand(message, cbi); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /common/Compat/Compat19/src/main/java/com/ptsmods/morecommands/miscellaneous/CopySoundNew.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.miscellaneous; 2 | 3 | import com.ptsmods.morecommands.api.IMoreCommands; 4 | import net.minecraft.client.Minecraft; 5 | import net.minecraft.client.resources.sounds.AbstractTickableSoundInstance; 6 | import net.minecraft.sounds.SoundSource; 7 | import net.minecraft.util.RandomSource; 8 | import net.minecraft.world.phys.Vec3; 9 | 10 | import java.util.Objects; 11 | 12 | public class CopySoundNew extends AbstractTickableSoundInstance { 13 | 14 | public CopySoundNew() { 15 | super(IMoreCommands.get().getCopySound().get(), SoundSource.MASTER, RandomSource.create()); 16 | volume = .25f; 17 | looping = false; 18 | tick(); 19 | } 20 | 21 | @Override 22 | public boolean canStartSilent() { 23 | return true; 24 | } 25 | 26 | @Override 27 | public boolean canPlaySound() { 28 | return true; 29 | } 30 | 31 | @Override 32 | public void tick() { 33 | Vec3 pos = Objects.requireNonNull(Minecraft.getInstance().player).position(); 34 | x = pos.x; 35 | y = pos.y; 36 | z = pos.z; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /common/src/client/java/com/ptsmods/morecommands/client/mixin/MixinEntityCallbacks.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.client.mixin; 2 | 3 | import com.ptsmods.morecommands.api.callbacks.ClientEntityEvent; 4 | import net.minecraft.client.Minecraft; 5 | import net.minecraft.world.entity.Entity; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.injection.At; 8 | import org.spongepowered.asm.mixin.injection.Inject; 9 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 10 | 11 | @Mixin(targets = "net/minecraft/client/multiplayer/ClientLevel$EntityCallbacks") 12 | public class MixinEntityCallbacks { 13 | @Inject(method = "onTrackingStart(Lnet/minecraft/world/entity/Entity;)V", at = @At("TAIL")) 14 | private void invokeLoadEntity(Entity entity, CallbackInfo ci) { 15 | ClientEntityEvent.ENTITY_LOAD.invoker().onEntity(Minecraft.getInstance().level, entity); 16 | } 17 | 18 | @Inject(method = "onTrackingEnd(Lnet/minecraft/world/entity/Entity;)V", at = @At("HEAD")) 19 | private void invokeUnloadEntity(Entity entity, CallbackInfo ci) { 20 | ClientEntityEvent.ENTITY_UNLOAD.invoker().onEntity(Minecraft.getInstance().level, entity); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/common/MixinPlayerManager.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.common; 2 | 3 | import com.ptsmods.morecommands.MoreCommands; 4 | import com.ptsmods.morecommands.api.IDataTrackerHelper; 5 | import com.ptsmods.morecommands.commands.elevated.VanishCommand; 6 | import net.minecraft.network.Connection; 7 | import net.minecraft.server.level.ServerPlayer; 8 | import net.minecraft.server.players.PlayerList; 9 | import org.spongepowered.asm.mixin.Mixin; 10 | import org.spongepowered.asm.mixin.injection.At; 11 | import org.spongepowered.asm.mixin.injection.Inject; 12 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 13 | 14 | @Mixin(PlayerList.class) 15 | public class MixinPlayerManager { 16 | 17 | @Inject(at = @At("TAIL"), method = "placeNewPlayer") 18 | public void onPlayerConnect(Connection connection, ServerPlayer player, CallbackInfo cbi) { 19 | MoreCommands.updateFormatting(player.getServer(), 0, null); // Updating from gamerules 20 | MoreCommands.updateFormatting(player.getServer(), 1, null); 21 | if (player.getEntityData().get(IDataTrackerHelper.get().vanish())) VanishCommand.vanish(player, false); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /common/Compat/Compat194/src/main/java/com/ptsmods/morecommands/mixin/compat/compat194/plus/MixinInventoryScreen.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.compat.compat194.plus; 2 | 3 | import com.mojang.blaze3d.vertex.PoseStack; 4 | import com.ptsmods.morecommands.api.clientoptions.ClientOption; 5 | import net.minecraft.client.gui.screens.inventory.InventoryScreen; 6 | import net.minecraft.world.entity.LivingEntity; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Redirect; 10 | 11 | @Mixin(InventoryScreen.class) 12 | public class MixinInventoryScreen { 13 | @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/inventory/InventoryScreen;renderEntityInInventoryFollowsMouse(Lcom/mojang/blaze3d/vertex/PoseStack;IIIFFLnet/minecraft/world/entity/LivingEntity;)V"), method = "renderBg") 14 | public void drawBackground_drawEntity(PoseStack poseStack, int x, int y, int size, float mouseX, float mouseY, LivingEntity entity) { 15 | InventoryScreen.renderEntityInInventoryFollowsMouse(poseStack, x, y, (int) (size * (ClientOption.getBoolean("renderOwnTag") ? 0.95f : 1f)), mouseX, mouseY, entity); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/common/MixinWallSignBlock.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.common; 2 | 3 | import com.ptsmods.morecommands.api.ReflectionHelper; 4 | import com.ptsmods.morecommands.api.util.compat.Compat; 5 | import net.minecraft.resources.ResourceLocation; 6 | import net.minecraft.world.level.block.Block; 7 | import net.minecraft.world.level.block.WallSignBlock; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.Overwrite; 10 | 11 | @Mixin(WallSignBlock.class) 12 | public class MixinWallSignBlock { 13 | private String mc_translationKey; 14 | 15 | /** 16 | * @author PlanetTeamSpeak 17 | * @reason Causes StackOverflowErrors otherwise 18 | */ 19 | @Overwrite 20 | public String getDescriptionId() { 21 | if (mc_translationKey == null) { 22 | ResourceLocation id = Compat.get().getBuiltInRegistry("block").getKey(ReflectionHelper.cast(this)); 23 | mc_translationKey = Compat.get().getBuiltInRegistry("block").get(new ResourceLocation(id.getNamespace(), id.getPath().replace("wall_", ""))).getDescriptionId(); 24 | } 25 | return mc_translationKey; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/common/MixinClientConnection.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.common; 2 | 3 | import com.ptsmods.morecommands.api.callbacks.PacketReceiveEvent; 4 | import net.minecraft.network.Connection; 5 | import net.minecraft.network.PacketListener; 6 | import net.minecraft.network.protocol.Packet; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Inject; 10 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 11 | 12 | @Mixin(Connection.class) 13 | public class MixinClientConnection { 14 | 15 | @Inject(at = @At("TAIL"), method = "genericsFtw", cancellable = true) 16 | private static void handlePacketPre(Packet packet, PacketListener listener, CallbackInfo cbi) { 17 | if (PacketReceiveEvent.PRE.invoker().onReceive(packet, listener)) cbi.cancel(); 18 | } 19 | 20 | @Inject(at = @At("TAIL"), method = "genericsFtw") 21 | private static void handlePacketPost(Packet packet, PacketListener listener, CallbackInfo cbi) { 22 | PacketReceiveEvent.POST.invoker().onReceive(packet, listener); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/common/MixinExplosion.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.common; 2 | 3 | import com.ptsmods.morecommands.miscellaneous.MoreGameRules; 4 | import net.minecraft.world.level.Explosion; 5 | import net.minecraft.world.level.Level; 6 | import org.spongepowered.asm.mixin.Final; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.Shadow; 9 | import org.spongepowered.asm.mixin.injection.At; 10 | import org.spongepowered.asm.mixin.injection.Inject; 11 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 12 | 13 | @Mixin(Explosion.class) 14 | public class MixinExplosion { 15 | 16 | @Shadow @Final private Level level; 17 | 18 | @Inject(at = @At("HEAD"), method = "explode", cancellable = true) 19 | public void collectBlocksAndDamageEntities(CallbackInfo cbi) { 20 | if (!level.getGameRules().getBoolean(MoreGameRules.get().doExplosionsRule())) cbi.cancel(); 21 | } 22 | 23 | @Inject(at = @At("HEAD"), method = "finalizeExplosion", cancellable = true) 24 | public void affectWorld(boolean bl, CallbackInfo cbi) { 25 | if (!level.getGameRules().getBoolean(MoreGameRules.get().doExplosionsRule())) cbi.cancel(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /common/Compat/Compat18/src/main/java/com/ptsmods/morecommands/mixin/compat/compat18/min/MixinLightmapTextureManager.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.compat.compat18.min; 2 | 3 | import com.ptsmods.morecommands.api.clientoptions.ClientOption; 4 | import com.ptsmods.morecommands.api.clientoptions.ClientOptionCategory; 5 | import com.ptsmods.morecommands.api.clientoptions.DoubleClientOption; 6 | import com.ptsmods.morecommands.api.util.compat.client.ClientCompat; 7 | import net.minecraft.client.Options; 8 | import net.minecraft.client.renderer.LightTexture; 9 | import org.objectweb.asm.Opcodes; 10 | import org.spongepowered.asm.mixin.Mixin; 11 | import org.spongepowered.asm.mixin.injection.At; 12 | import org.spongepowered.asm.mixin.injection.Redirect; 13 | 14 | @Mixin(LightTexture.class) 15 | public class MixinLightmapTextureManager { 16 | 17 | @Redirect(at = @At(value = "FIELD", opcode = Opcodes.GETFIELD, target = "Lnet/minecraft/client/Options;gamma:D"), method = "updateLightTexture") 18 | private double update_gamma(Options gameOptions) { 19 | return ((DoubleClientOption) ClientOption.getOptions().get(ClientOptionCategory.TWEAKS).get("Brightness Multiplier")).getValue() * ClientCompat.get().getGamma(gameOptions); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /common/Compat/Compat194/src/main/java/com/ptsmods/morecommands/mixin/compat/compat194/plus/MixinFarmBlock.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.compat.compat194.plus; 2 | 3 | import com.ptsmods.morecommands.api.IMoreGameRules; 4 | import net.minecraft.core.BlockPos; 5 | import net.minecraft.world.entity.Entity; 6 | import net.minecraft.world.level.Level; 7 | import net.minecraft.world.level.block.FarmBlock; 8 | import net.minecraft.world.level.block.state.BlockState; 9 | import org.spongepowered.asm.mixin.Mixin; 10 | import org.spongepowered.asm.mixin.injection.At; 11 | import org.spongepowered.asm.mixin.injection.Redirect; 12 | 13 | @Mixin(FarmBlock.class) 14 | public class MixinFarmBlock { 15 | 16 | @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/FarmBlock;turnToDirt(Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;)V"), method = "fallOn") 17 | private void onLandedUpon_setToDirt(Entity entity, BlockState blockState, Level level, BlockPos blockPos) { 18 | if (level.getGameRules().getBoolean(IMoreGameRules.get().doFarmlandTrampleRule())) FarmBlock.turnToDirt(entity, blockState, level, blockPos); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/common/MixinEntityTrackerEntry.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.common; 2 | 3 | import com.ptsmods.morecommands.api.IDataTrackerHelper; 4 | import net.minecraft.network.protocol.Packet; 5 | import net.minecraft.server.level.ServerEntity; 6 | import net.minecraft.world.entity.Entity; 7 | import net.minecraft.world.entity.player.Player; 8 | import org.spongepowered.asm.mixin.Final; 9 | import org.spongepowered.asm.mixin.Mixin; 10 | import org.spongepowered.asm.mixin.Shadow; 11 | import org.spongepowered.asm.mixin.injection.At; 12 | import org.spongepowered.asm.mixin.injection.Inject; 13 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 14 | 15 | import java.util.function.Consumer; 16 | 17 | //"net.minecraft.server.world.ThreadedAnvilChunkStorage$EntityTracker" 18 | @Mixin(ServerEntity.class) 19 | public class MixinEntityTrackerEntry { 20 | 21 | @Shadow @Final private Entity entity; 22 | 23 | @Inject(at = @At("HEAD"), method = "sendPairingData", cancellable = true) 24 | public void sendPackets(Consumer> sender, CallbackInfo cbi) { 25 | if (entity instanceof Player && entity.getEntityData().get(IDataTrackerHelper.get().vanish())) cbi.cancel(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /common/src/main/java/com/ptsmods/morecommands/mixin/common/MixinAbstractContainerMenu.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.mixin.common; 2 | 3 | import com.ptsmods.morecommands.api.ClientOnly; 4 | import com.ptsmods.morecommands.api.ReflectionHelper; 5 | import com.ptsmods.morecommands.api.miscellaneous.InvSeeScreenHandler; 6 | import net.minecraft.world.entity.player.Player; 7 | import net.minecraft.world.inventory.AbstractContainerMenu; 8 | import net.minecraft.world.inventory.ClickType; 9 | import org.spongepowered.asm.mixin.Mixin; 10 | import org.spongepowered.asm.mixin.injection.At; 11 | import org.spongepowered.asm.mixin.injection.Inject; 12 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 13 | 14 | @Mixin(AbstractContainerMenu.class) 15 | public class MixinAbstractContainerMenu { 16 | @Inject(at = @At("HEAD"), method = "clicked", cancellable = true) 17 | public void onSlotClick(int slotIndex, int button, ClickType actionType, Player player, CallbackInfo cbi) { 18 | //noinspection ConstantValue 19 | if (ReflectionHelper.cast(this) instanceof InvSeeScreenHandler && !ClientOnly.get().isRemotePlayer(ReflectionHelper.cast(this).target)) 20 | cbi.cancel(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /common/API/src/main/java/com/ptsmods/morecommands/api/util/Util.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.api.util; 2 | 3 | import lombok.experimental.UtilityClass; 4 | import net.minecraft.ChatFormatting; 5 | import net.minecraft.world.item.ItemStack; 6 | 7 | import java.util.Objects; 8 | 9 | @UtilityClass 10 | public class Util { 11 | 12 | public static ChatFormatting formatFromBool(boolean b) { 13 | return b ? ChatFormatting.GREEN : ChatFormatting.RED; 14 | } 15 | 16 | public static String formatFromBool(boolean b, String yes, String no) { 17 | return formatFromBool(b) + (b ? yes : no); 18 | } 19 | 20 | public static String translateFormats(String s) { 21 | for (ChatFormatting f : ChatFormatting.values()) 22 | s = s.replaceAll("&" + f.toString().charAt(1), f.toString()); 23 | return s.replaceAll("&#", "\u00A7#"); 24 | } 25 | 26 | public static boolean stackEquals(ItemStack stack1, ItemStack stack2) { 27 | return stack1 != null && stack2 != null && 28 | (stack1 == stack2 || 29 | stack1.getItem() == stack2.getItem() && 30 | stack1.getCount() == stack2.getCount() && 31 | Objects.equals(stack1.getTag(), stack2.getTag())); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /common/Compat/Compat18/forge/src/main/java/com/ptsmods/morecommands/forge/compat/ForgeCompat18.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.forge.compat; 2 | 3 | import com.ptsmods.morecommands.api.IMoreGameRules; 4 | import com.ptsmods.morecommands.api.Version; 5 | import com.ptsmods.morecommands.api.util.compat.ForgeCompatAdapter; 6 | import net.minecraft.world.level.Level; 7 | import net.minecraftforge.common.MinecraftForge; 8 | import net.minecraftforge.event.world.BlockEvent; 9 | import net.minecraftforge.eventbus.api.Event; 10 | 11 | public class ForgeCompat18 extends ForgeCompatAdapter { 12 | 13 | @Override 14 | public boolean shouldRegisterListeners() { 15 | return Version.getCurrent().isOlderThanOrEqual(Version.V1_18); 16 | } 17 | 18 | @Override 19 | public void registerListeners() { 20 | MinecraftForge.EVENT_BUS.addListener(new Listener()::onCreateFluidSource); 21 | } 22 | 23 | private static class Listener { 24 | private void onCreateFluidSource(BlockEvent.CreateFluidSourceEvent event) { 25 | if (event.getWorld() instanceof Level && ((Level) event.getWorld()).getGameRules().getBoolean(IMoreGameRules.get().fluidsInfiniteRule())) 26 | event.setResult(Event.Result.ALLOW); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /common/src/client/java/com/ptsmods/morecommands/client/mixin/MixinAnvilScreen.java: -------------------------------------------------------------------------------- 1 | package com.ptsmods.morecommands.client.mixin; 2 | 3 | import com.ptsmods.morecommands.api.IMoreCommandsClient; 4 | import com.ptsmods.morecommands.api.ReflectionHelper; 5 | import net.minecraft.client.gui.components.EditBox; 6 | import net.minecraft.client.gui.screens.Screen; 7 | import net.minecraft.client.gui.screens.inventory.AnvilScreen; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.Shadow; 10 | import org.spongepowered.asm.mixin.Unique; 11 | import org.spongepowered.asm.mixin.injection.At; 12 | import org.spongepowered.asm.mixin.injection.Inject; 13 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 14 | 15 | @Mixin(AnvilScreen.class) 16 | public class MixinAnvilScreen { 17 | @Unique private static boolean colourPickerOpen = false; 18 | @Shadow private EditBox name; 19 | 20 | @Inject(at = @At("TAIL"), method = "subInit") 21 | protected void setup(CallbackInfo cbi) { 22 | Screen thiz = ReflectionHelper.cast(this); 23 | IMoreCommandsClient.get().addColourPicker(thiz, thiz.width - 117, thiz.height/2 - 87, 24 | true, colourPickerOpen, name::insertText, b -> colourPickerOpen = b); 25 | } 26 | } 27 | --------------------------------------------------------------------------------