Compare commits
	
		
			2 Commits
		
	
	
		
			a757dce854
			...
			9f869668c9
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 9f869668c9 | ||
|  | cc17c5b0c5 | 
| @@ -0,0 +1,96 @@ | |||||||
|  | package de.jottyfan.quickiemod.items; | ||||||
|  |  | ||||||
|  | import java.util.Random; | ||||||
|  |  | ||||||
|  | import net.minecraft.component.DataComponentTypes; | ||||||
|  | import net.minecraft.entity.ItemEntity; | ||||||
|  | import net.minecraft.entity.LivingEntity; | ||||||
|  | import net.minecraft.entity.passive.ChickenEntity; | ||||||
|  | import net.minecraft.entity.passive.CowEntity; | ||||||
|  | import net.minecraft.entity.passive.HorseEntity; | ||||||
|  | import net.minecraft.entity.passive.SheepEntity; | ||||||
|  | import net.minecraft.entity.player.PlayerEntity; | ||||||
|  | import net.minecraft.item.Item; | ||||||
|  | import net.minecraft.item.ItemStack; | ||||||
|  | import net.minecraft.item.Items; | ||||||
|  | import net.minecraft.item.ShearsItem; | ||||||
|  | import net.minecraft.util.ActionResult; | ||||||
|  | import net.minecraft.util.DyeColor; | ||||||
|  | import net.minecraft.util.Hand; | ||||||
|  | import net.minecraft.util.math.Vec3d; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * | ||||||
|  |  * @author jotty | ||||||
|  |  * | ||||||
|  |  */ | ||||||
|  | public class ItemSpeedpowdershears extends ShearsItem { | ||||||
|  |  | ||||||
|  | 	public ItemSpeedpowdershears() { | ||||||
|  | 		super(new Item.Settings().component(DataComponentTypes.TOOL, ShearsItem.createToolComponent())); | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	@Override | ||||||
|  | 	public ActionResult useOnEntity(ItemStack stack, PlayerEntity user, LivingEntity entity, Hand hand) { | ||||||
|  | 		Vec3d pos = entity.getPos(); | ||||||
|  | 		Integer amount = 3 + new Random().nextInt(4); | ||||||
|  | 		if (entity instanceof SheepEntity) { | ||||||
|  | 			SheepEntity sheep = (SheepEntity) entity; | ||||||
|  | 			if (sheep.isShearable()) { | ||||||
|  | 				sheep.setSheared(true); | ||||||
|  | 				sheep.playAmbientSound(); | ||||||
|  | 				DyeColor color = sheep.getColor(); | ||||||
|  | 				Item item = Items.WHITE_WOOL; | ||||||
|  | 				if (color.equals(DyeColor.BLACK)) { | ||||||
|  | 					item = Items.BLACK_WOOL; | ||||||
|  | 				} else if (color.equals(DyeColor.GRAY)) { | ||||||
|  | 					item = Items.GRAY_WOOL; | ||||||
|  | 				} else if (color.equals(DyeColor.LIGHT_GRAY)) { | ||||||
|  | 					item = Items.LIGHT_GRAY_WOOL; | ||||||
|  | 				} else if (color.equals(DyeColor.BROWN)) { | ||||||
|  | 					item = Items.BROWN_WOOL; | ||||||
|  | 				} else if (color.equals(DyeColor.BLUE)) { | ||||||
|  | 					item = Items.BLUE_WOOL; | ||||||
|  | 				} else if (color.equals(DyeColor.LIGHT_BLUE)) { | ||||||
|  | 					item = Items.LIGHT_BLUE_WOOL; | ||||||
|  | 				} else if (color.equals(DyeColor.GREEN)) { | ||||||
|  | 					item = Items.GREEN_WOOL; | ||||||
|  | 				} else if (color.equals(DyeColor.LIME)) { | ||||||
|  | 					item = Items.LIME_WOOL; | ||||||
|  | 				} else if (color.equals(DyeColor.CYAN)) { | ||||||
|  | 					item = Items.CYAN_WOOL; | ||||||
|  | 				} else if (color.equals(DyeColor.MAGENTA)) { | ||||||
|  | 					item = Items.MAGENTA_WOOL; | ||||||
|  | 				} else if (color.equals(DyeColor.ORANGE)) { | ||||||
|  | 					item = Items.ORANGE_WOOL; | ||||||
|  | 				} else if (color.equals(DyeColor.PINK)) { | ||||||
|  | 					item = Items.PINK_WOOL; | ||||||
|  | 				} else if (color.equals(DyeColor.PURPLE)) { | ||||||
|  | 					item = Items.PURPLE_WOOL; | ||||||
|  | 				} else if (color.equals(DyeColor.RED)) { | ||||||
|  | 					item = Items.RED_WOOL; | ||||||
|  | 				} else if (color.equals(DyeColor.YELLOW)) { | ||||||
|  | 					item = Items.YELLOW_WOOL; | ||||||
|  | 				} | ||||||
|  | 				user.getWorld().spawnEntity(new ItemEntity(user.getWorld(), pos.getX(), pos.getY(), pos.getZ(), new ItemStack(item, amount))); | ||||||
|  | 				return ActionResult.SUCCESS; | ||||||
|  | 			} | ||||||
|  | 		} else if (entity instanceof HorseEntity) { | ||||||
|  | 			HorseEntity horse = (HorseEntity) entity; | ||||||
|  | 			horse.playAmbientSound(); | ||||||
|  | 			user.getWorld().spawnEntity(new ItemEntity(user.getWorld(), pos.getX(), pos.getY(), pos.getZ(), new ItemStack(Items.LEATHER, amount))); | ||||||
|  | 			return ActionResult.SUCCESS; | ||||||
|  | 		} else if (entity instanceof CowEntity) { | ||||||
|  | 			CowEntity cow = (CowEntity) entity; | ||||||
|  | 			cow.playAmbientSound(); | ||||||
|  | 			user.getWorld().spawnEntity(new ItemEntity(user.getWorld(), pos.getX(), pos.getY(), pos.getZ(), new ItemStack(Items.LEATHER, amount))); | ||||||
|  | 			return ActionResult.SUCCESS; | ||||||
|  | 		} else if (entity instanceof ChickenEntity) { | ||||||
|  | 			ChickenEntity cow = (ChickenEntity) entity; | ||||||
|  | 			cow.playAmbientSound(); | ||||||
|  | 			user.getWorld().spawnEntity(new ItemEntity(user.getWorld(), pos.getX(), pos.getY(), pos.getZ(), new ItemStack(Items.FEATHER, amount))); | ||||||
|  | 			return ActionResult.SUCCESS; | ||||||
|  | 		} | ||||||
|  | 		return ActionResult.PASS; | ||||||
|  | 	} | ||||||
|  | } | ||||||
| @@ -9,6 +9,7 @@ import net.minecraft.item.Item; | |||||||
|  */ |  */ | ||||||
| public enum QuickieItems { | public enum QuickieItems { | ||||||
| 	// @formatter:off | 	// @formatter:off | ||||||
|  | 	SPEEDPOWDERSHEARS(new ItemSpeedpowdershears(), "speedpowdershears"), | ||||||
| 	ROTTEN_FLESH_STRIPES(new ItemRottenFleshStripes(), "rotten_flesh_stripes"), | 	ROTTEN_FLESH_STRIPES(new ItemRottenFleshStripes(), "rotten_flesh_stripes"), | ||||||
| 	CARROTSTACK(new ItemCarrotstack(), "carrotstack"), | 	CARROTSTACK(new ItemCarrotstack(), "carrotstack"), | ||||||
| 	COTTON(new ItemCotton(), "cotton"), | 	COTTON(new ItemCotton(), "cotton"), | ||||||
|   | |||||||
| @@ -5,6 +5,7 @@ | |||||||
| 	"item.quickiemod.speedpowdershovel": "Fluchtpulverschaufel", | 	"item.quickiemod.speedpowdershovel": "Fluchtpulverschaufel", | ||||||
|   "item.quickiemod.speedpowderhoe": "Fluchtpulverfeldhacke", |   "item.quickiemod.speedpowderhoe": "Fluchtpulverfeldhacke", | ||||||
|   "item.quickiemod.speedpowderwaterhoe": "bewässerte Fluchtpulverfeldhacke", |   "item.quickiemod.speedpowderwaterhoe": "bewässerte Fluchtpulverfeldhacke", | ||||||
|  |   "item.quickiemod.speedpowdershears": "Fluchtpulverschere", | ||||||
| 	"item.quickiemod.speedpowder": "Fluchtpulver", | 	"item.quickiemod.speedpowder": "Fluchtpulver", | ||||||
| 	"item.quickiemod.quickiepowder": "Eilpulver", | 	"item.quickiemod.quickiepowder": "Eilpulver", | ||||||
| 	"item.quickiemod.quickiepowderaxe": "Eilpulveraxt", | 	"item.quickiemod.quickiepowderaxe": "Eilpulveraxt", | ||||||
|   | |||||||
| @@ -5,6 +5,7 @@ | |||||||
| 	"item.quickiemod.speedpowdershovel": "speedpowder shovel", | 	"item.quickiemod.speedpowdershovel": "speedpowder shovel", | ||||||
|   "item.quickiemod.speedpowderhoe": "speedpowder hoe", |   "item.quickiemod.speedpowderhoe": "speedpowder hoe", | ||||||
|   "item.quickiemod.speedpowderwaterhoe": "watered speedpowder hoe", |   "item.quickiemod.speedpowderwaterhoe": "watered speedpowder hoe", | ||||||
|  |   "item.quickiemod.speedpowdershears": "speedpowder shears", | ||||||
| 	"item.quickiemod.speedpowder": "speedpowder", | 	"item.quickiemod.speedpowder": "speedpowder", | ||||||
| 	"item.quickiemod.quickiepowder": "hurrypowder", | 	"item.quickiemod.quickiepowder": "hurrypowder", | ||||||
| 	"item.quickiemod.quickiepowderaxe": "hurrypowder axe", | 	"item.quickiemod.quickiepowderaxe": "hurrypowder axe", | ||||||
|   | |||||||
| @@ -0,0 +1,6 @@ | |||||||
|  | { | ||||||
|  |   "parent": "item/generated", | ||||||
|  |   "textures": { | ||||||
|  |     "layer0": "quickiemod:item/speedpowdershears" | ||||||
|  |   } | ||||||
|  | } | ||||||
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 4.4 KiB | 
| @@ -0,0 +1,5 @@ | |||||||
|  | { | ||||||
|  |   "values": [ | ||||||
|  |     "quickiemod:speedpowdershears" | ||||||
|  |   ] | ||||||
|  | } | ||||||
| @@ -0,0 +1,5 @@ | |||||||
|  | { | ||||||
|  |   "values": [ | ||||||
|  |     "quickiemod:speedpowdershears" | ||||||
|  |   ] | ||||||
|  | } | ||||||
| @@ -0,0 +1,21 @@ | |||||||
|  | { | ||||||
|  |   "parent": "minecraft:recipes/root", | ||||||
|  |   "rewards": { | ||||||
|  |     "recipes": [ | ||||||
|  |       "quickiemod:blocksalpeter" | ||||||
|  |     ] | ||||||
|  |   }, | ||||||
|  |   "criteria": { | ||||||
|  |     "has_the_recipe": { | ||||||
|  |       "trigger": "minecraft:recipe_unlocked", | ||||||
|  |       "conditions": { | ||||||
|  |         "recipe": "quickiemod:blocksalpeter" | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |   }, | ||||||
|  |   "requirements": [ | ||||||
|  |     [ | ||||||
|  |       "has_the_recipe" | ||||||
|  |     ] | ||||||
|  |   ] | ||||||
|  | } | ||||||
| @@ -0,0 +1,16 @@ | |||||||
|  | { | ||||||
|  |   "type": "minecraft:crafting_shaped", | ||||||
|  |   "category": "tools", | ||||||
|  |   "pattern": [ | ||||||
|  |     " #", | ||||||
|  |     "# " | ||||||
|  |   ], | ||||||
|  |   "key": { | ||||||
|  |     "#": { | ||||||
|  |       "item": "quickiemod:speedingot" | ||||||
|  |     } | ||||||
|  |   }, | ||||||
|  |   "result": { | ||||||
|  |     "id": "quickiemod:speedpowdershears" | ||||||
|  |   } | ||||||
|  | } | ||||||
		Reference in New Issue
	
	Block a user