Skip to content

Commit

Permalink
Path bugs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Killarexe committed Feb 4, 2024
1 parent 0f886b9 commit f0ed3f8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public InteractionResult useOn(UseOnContext context) {
return InteractionResult.PASS;
}

public static void waxStack(Item waxedItem, Level level, ItemStack stack, Vec3 playerPos, int amount) {
public static <T extends Item> void waxStack(T waxedItem, Level level, ItemStack stack, Vec3 playerPos, int amount) {
stack.shrink(amount);
if(level instanceof ServerLevel serverLevel) {
ItemEntity entity = new ItemEntity(serverLevel, playerPos.x, playerPos.y, playerPos.z, new ItemStack(waxedItem, amount));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
@Mixin(Item.class)
public abstract class ItemMixin implements FeatureElement, ItemLike, FabricItem {

@Inject(method = "inventoryTick(Lnet/minecraft/item/ItemStack;Lnet/minecraft/world/World;Lnet/minecraft/entity/Entity;IZ)V", at = @At("HEAD"))
@Inject(method = "inventoryTick(Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/level/Level;Lnet/minecraft/world/entity/Entity;IZ)V", at = @At("HEAD"))
public void inventoryTick(ItemStack stack, Level level, Entity entity, int slot, boolean selected, CallbackInfo callbackInfo) {
if(entity instanceof Player player && stack.getItem() == Items.COPPER_INGOT) {
int count = stack.getCount();
Expand All @@ -40,7 +40,7 @@ public void inventoryTick(ItemStack stack, Level level, Entity entity, int slot,
}
}

@Inject(method = "useOn(Lnet/minecraft/item/context/UseOnContext;)Lnet/minecraft/world/InteractionResult;", at = @At("HEAD"), cancellable = true)
@Inject(method = "useOn(Lnet/minecraft/world/item/context/UseOnContext;)Lnet/minecraft/world/InteractionResult;", at = @At("HEAD"), cancellable = true)
public void useOn(UseOnContext context, CallbackInfoReturnable<InteractionResult> callbackInfoReturnable) {
if(context.getItemInHand().getItem() == Items.COPPER_INGOT) {
Level level = context.getLevel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ private static void onRightClickEvent(RightClickBlock event) {
if(currentValue >= 1) {
int amount = event.getEntity().isShiftKeyDown() ? currentValue : 1;
Vec3 playerPos = event.getEntity().blockPosition().getCenter();
WaxableItem.waxStack(CEItems.WAXED_COPPER_INGOT.get(), level, stack, state, playerPos, amount);
WaxableItem.waxStack(CEItems.WAXED_COPPER_INGOT.get(), level, stack, playerPos, amount);
level.setBlock(event.getPos(), state.setValue(BeehiveBlock.HONEY_LEVEL, currentValue - amount) ,Block.UPDATE_ALL_IMMEDIATE);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
package github.killarexe.copper_extension.forge.registry;

import java.util.Optional;

import github.killarexe.copper_extension.CEMod;
import github.killarexe.copper_extension.forge.item.*;
import net.minecraft.core.Holder;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.Items;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
Expand Down

0 comments on commit f0ed3f8

Please sign in to comment.