-
-
Notifications
You must be signed in to change notification settings - Fork 421
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into pr/IUDevman/904
- Loading branch information
Showing
115 changed files
with
5,835 additions
and
5,331 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,30 @@ | ||
/* | ||
* Copyright (c) 2014-2023 Wurst-Imperium and contributors. | ||
* | ||
* This source code is subject to the terms of the GNU General Public | ||
* License, version 3. If a copy of the GPL was not distributed with this | ||
* file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt | ||
*/ | ||
package net.wurstclient; | ||
|
||
import net.fabricmc.api.ModInitializer; | ||
|
||
public final class WurstInitializer implements ModInitializer | ||
{ | ||
private static boolean initialized; | ||
|
||
@Override | ||
public void onInitialize() | ||
{ | ||
// This code runs as soon as Minecraft is in a mod-load-ready state. | ||
// However, some things (like resources) may still be uninitialized. | ||
// Proceed with mild caution. | ||
|
||
if(initialized) | ||
throw new RuntimeException( | ||
"WurstInitializer.onInitialize() ran twice!"); | ||
|
||
WurstClient.INSTANCE.initialize(); | ||
initialized = true; | ||
} | ||
} | ||
/* | ||
* Copyright (c) 2014-2023 Wurst-Imperium and contributors. | ||
* | ||
* This source code is subject to the terms of the GNU General Public | ||
* License, version 3. If a copy of the GPL was not distributed with this | ||
* file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt | ||
*/ | ||
package net.wurstclient; | ||
|
||
import net.fabricmc.api.ModInitializer; | ||
|
||
public final class WurstInitializer implements ModInitializer | ||
{ | ||
private static boolean initialized; | ||
|
||
@Override | ||
public void onInitialize() | ||
{ | ||
// This code runs as soon as Minecraft is in a mod-load-ready state. | ||
// However, some things (like resources) may still be uninitialized. | ||
// Proceed with mild caution. | ||
|
||
if(initialized) | ||
throw new RuntimeException( | ||
"WurstInitializer.onInitialize() ran twice!"); | ||
|
||
WurstClient.INSTANCE.initialize(); | ||
initialized = true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,89 +1,89 @@ | ||
/* | ||
* Copyright (c) 2014-2023 Wurst-Imperium and contributors. | ||
* | ||
* This source code is subject to the terms of the GNU General Public | ||
* License, version 3. If a copy of the GPL was not distributed with this | ||
* file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt | ||
*/ | ||
package net.wurstclient.commands; | ||
|
||
import net.minecraft.enchantment.Enchantment; | ||
import net.minecraft.enchantment.Enchantments; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.registry.Registries; | ||
import net.wurstclient.command.CmdError; | ||
import net.wurstclient.command.CmdException; | ||
import net.wurstclient.command.CmdSyntaxError; | ||
import net.wurstclient.command.Command; | ||
import net.wurstclient.util.ChatUtils; | ||
import net.wurstclient.util.ItemUtils; | ||
|
||
public final class EnchantCmd extends Command | ||
{ | ||
public EnchantCmd() | ||
{ | ||
super("enchant", "Enchants an item with everything,\n" | ||
+ "except for silk touch and curses.", ".enchant"); | ||
} | ||
|
||
@Override | ||
public void call(String[] args) throws CmdException | ||
{ | ||
if(!MC.player.getAbilities().creativeMode) | ||
throw new CmdError("Creative mode only."); | ||
|
||
if(args.length > 1) | ||
throw new CmdSyntaxError(); | ||
|
||
enchant(getHeldItem(), 127); | ||
ChatUtils.message("Item enchanted."); | ||
} | ||
|
||
private ItemStack getHeldItem() throws CmdError | ||
{ | ||
ItemStack stack = MC.player.getMainHandStack(); | ||
|
||
if(stack.isEmpty()) | ||
stack = MC.player.getOffHandStack(); | ||
|
||
if(stack.isEmpty()) | ||
throw new CmdError("There is no item in your hand."); | ||
|
||
return stack; | ||
} | ||
|
||
private void enchant(ItemStack stack, int level) | ||
{ | ||
for(Enchantment enchantment : Registries.ENCHANTMENT) | ||
{ | ||
// Skip curses | ||
if(enchantment.isCursed()) | ||
continue; | ||
|
||
// Skip Silk Touch so it doesn't remove Fortune | ||
if(enchantment == Enchantments.SILK_TOUCH) | ||
continue; | ||
|
||
// Limit Quick Charge to level 5 so it doesn't break | ||
if(enchantment == Enchantments.QUICK_CHARGE) | ||
{ | ||
stack.addEnchantment(enchantment, Math.min(level, 5)); | ||
continue; | ||
} | ||
|
||
ItemUtils.addEnchantment(stack, enchantment, level); | ||
} | ||
} | ||
|
||
@Override | ||
public String getPrimaryAction() | ||
{ | ||
return "Enchant Held Item"; | ||
} | ||
|
||
@Override | ||
public void doPrimaryAction() | ||
{ | ||
WURST.getCmdProcessor().process("enchant"); | ||
} | ||
} | ||
/* | ||
* Copyright (c) 2014-2023 Wurst-Imperium and contributors. | ||
* | ||
* This source code is subject to the terms of the GNU General Public | ||
* License, version 3. If a copy of the GPL was not distributed with this | ||
* file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt | ||
*/ | ||
package net.wurstclient.commands; | ||
|
||
import net.minecraft.enchantment.Enchantment; | ||
import net.minecraft.enchantment.Enchantments; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.registry.Registries; | ||
import net.wurstclient.command.CmdError; | ||
import net.wurstclient.command.CmdException; | ||
import net.wurstclient.command.CmdSyntaxError; | ||
import net.wurstclient.command.Command; | ||
import net.wurstclient.util.ChatUtils; | ||
import net.wurstclient.util.ItemUtils; | ||
|
||
public final class EnchantCmd extends Command | ||
{ | ||
public EnchantCmd() | ||
{ | ||
super("enchant", "Enchants an item with everything,\n" | ||
+ "except for silk touch and curses.", ".enchant"); | ||
} | ||
|
||
@Override | ||
public void call(String[] args) throws CmdException | ||
{ | ||
if(!MC.player.getAbilities().creativeMode) | ||
throw new CmdError("Creative mode only."); | ||
|
||
if(args.length > 1) | ||
throw new CmdSyntaxError(); | ||
|
||
enchant(getHeldItem(), 127); | ||
ChatUtils.message("Item enchanted."); | ||
} | ||
|
||
private ItemStack getHeldItem() throws CmdError | ||
{ | ||
ItemStack stack = MC.player.getMainHandStack(); | ||
|
||
if(stack.isEmpty()) | ||
stack = MC.player.getOffHandStack(); | ||
|
||
if(stack.isEmpty()) | ||
throw new CmdError("There is no item in your hand."); | ||
|
||
return stack; | ||
} | ||
|
||
private void enchant(ItemStack stack, int level) | ||
{ | ||
for(Enchantment enchantment : Registries.ENCHANTMENT) | ||
{ | ||
// Skip curses | ||
if(enchantment.isCursed()) | ||
continue; | ||
|
||
// Skip Silk Touch so it doesn't remove Fortune | ||
if(enchantment == Enchantments.SILK_TOUCH) | ||
continue; | ||
|
||
// Limit Quick Charge to level 5 so it doesn't break | ||
if(enchantment == Enchantments.QUICK_CHARGE) | ||
{ | ||
stack.addEnchantment(enchantment, Math.min(level, 5)); | ||
continue; | ||
} | ||
|
||
ItemUtils.addEnchantment(stack, enchantment, level); | ||
} | ||
} | ||
|
||
@Override | ||
public String getPrimaryAction() | ||
{ | ||
return "Enchant Held Item"; | ||
} | ||
|
||
@Override | ||
public void doPrimaryAction() | ||
{ | ||
WURST.getCmdProcessor().process("enchant"); | ||
} | ||
} |
Oops, something went wrong.