Config option for apples dropping from leaves
parent
fb3ca6bdfe
commit
e117a7e25c
|
@ -54,6 +54,8 @@ public class ModConfig {
|
|||
"Allows crafting coal and redstone as blocks for better storage");
|
||||
public static final Option<Boolean> DISABLE_EATING_WHEN_MAX_HP = make("Disable eating when at max HP", false,
|
||||
"Makes it so players can no longer eat if they're at max HP so they don't accidently waste food");
|
||||
public static final Option<Double> APPLE_DROP_RATE = make("Apple Drop Rate", 0.0,
|
||||
"Chance for apples to drop from leaves (decimal between 0.0 and 1.0)");
|
||||
|
||||
public static final Option<Boolean> FIX_BOW_MODEL = make("Fix bow model", true,
|
||||
"Makes the box model held by players and skeletons bigger and facing forward");
|
||||
|
|
|
@ -115,7 +115,7 @@ public class WyHelper {
|
|||
// player.dropItem(new ItemInstance(Tile.SLAB, 64));
|
||||
// player.dropItem(new ItemInstance(ItemType.minecart, 1));
|
||||
// player.dropItem(new ItemInstance(ItemType.minecartFurnace, 1));
|
||||
player.dropItem(new ItemInstance(ItemType.bow, 1));
|
||||
player.dropItem(new ItemInstance(ItemType.flintAndSteel, 1));
|
||||
// player.dropItem(new ItemInstance(Tile.GOLDEN_RAIL, 64));
|
||||
// player.dropItem(new ItemInstance(Tile.COBBLESTONE, 64));
|
||||
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
package xyz.pixelatedw.finalbeta.mixin;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import net.minecraft.entity.ItemEntity;
|
||||
import net.minecraft.entity.player.Player;
|
||||
import net.minecraft.item.ItemInstance;
|
||||
import net.minecraft.item.ItemType;
|
||||
import net.minecraft.level.Level;
|
||||
import net.minecraft.tile.LeavesTile;
|
||||
import xyz.pixelatedw.finalbeta.ModConfig;
|
||||
|
||||
@Mixin(LeavesTile.class)
|
||||
public class LeavesTileMixin {
|
||||
@Inject(method = "afterBreak", at = @At(value = "INVOKE", target = "Lnet/minecraft/tile/FancyTile;afterBreak(Lnet/minecraft/level/Level;Lnet/minecraft/entity/player/Player;IIII)V"))
|
||||
public void afterBreak(Level level, Player player, int x, int y, int z, int meta, CallbackInfo ci) {
|
||||
boolean dropItem = level.rand.nextDouble() <= ModConfig.APPLE_DROP_RATE.get();
|
||||
if (dropItem) {
|
||||
ItemEntity appleItem = new ItemEntity(level, x + 0.5, y - 0.5, z + 0.5, new ItemInstance(ItemType.apple));
|
||||
appleItem.pickupDelay = 20;
|
||||
level.spawnEntity(appleItem);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,8 @@
|
|||
package xyz.pixelatedw.finalbeta.mixin;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.Constant;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
|
||||
import net.minecraft.client.util.ResourceDownloadThread;
|
||||
|
||||
|
@ -9,8 +11,8 @@ public class ResourceDownloadThreadMixin {
|
|||
|
||||
private static final String RESOURCES_URL = "http://mcresources.modification-station.net/MinecraftResources/";
|
||||
|
||||
// @ModifyConstant(method = "run", constant = @Constant(stringValue = "http://s3.amazonaws.com/MinecraftResources/"), remap = false)
|
||||
// private String getResourcesUrl(String def) {
|
||||
// return RESOURCES_URL;
|
||||
// }
|
||||
@ModifyConstant(method = "run", constant = @Constant(stringValue = "http://s3.amazonaws.com/MinecraftResources/"), remap = false)
|
||||
private String getResourcesUrl(String def) {
|
||||
return RESOURCES_URL;
|
||||
}
|
||||
}
|
|
@ -47,7 +47,8 @@
|
|||
"RecipeRegistryAccessor",
|
||||
"FoodItemMixin",
|
||||
"ItemTypeAccessor",
|
||||
"PressurePlateTileMixin"
|
||||
"PressurePlateTileMixin",
|
||||
"LeavesTileMixin"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": -1
|
||||
|
|
Loading…
Reference in New Issue