Skip to content

Commit

Permalink
Get rid of pretty much every warning
Browse files Browse the repository at this point in the history
  • Loading branch information
altrisi committed Jun 27, 2022
1 parent f95fd52 commit 6dc7b62
Show file tree
Hide file tree
Showing 14 changed files with 12 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public static DispenserBehavior getCustomDispenserBehavior(ServerWorld world, Bl
})).isEmpty();

// check if item is a small flower
if(hasFeedableMooshrooms && item.getRegistryEntry().isIn(ItemTags.SMALL_FLOWERS)) {
if(hasFeedableMooshrooms && stack.isIn(ItemTags.SMALL_FLOWERS)) {
return FEED_MOOSHROOM;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import net.minecraft.block.BlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.WorldView;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import net.minecraft.entity.Entity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.WorldView;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
Expand Down
1 change: 0 additions & 1 deletion src/main/java/carpetextra/mixins/ChunkGeneratorMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import carpetextra.CarpetExtraSettings;
import carpetextra.helpers.DragonEggBedrockBreaking;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.world.StructureWorldAccess;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.gen.StructureAccessor;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package carpetextra.mixins;

import carpetextra.CarpetExtraSettings;
import carpetextra.utils.PlaceBlockDispenserBehavior;
import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemStack;
Expand Down
20 changes: 9 additions & 11 deletions src/main/java/carpetextra/mixins/DropperBlock_craftingMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,24 +73,24 @@ private void spawn(World world_1, double double_1, double double_2, double doubl
}

@Inject(method = "dispense", at = @At("HEAD"), cancellable = true)
private void tryCraft(ServerWorld world_1, BlockPos blockPos_1, CallbackInfo ci)
private void tryCraft(ServerWorld world, BlockPos pos, CallbackInfo ci)
{
if (!CarpetExtraSettings.autoCraftingDropper) return;
BlockPos front = blockPos_1.offset(world_1.getBlockState(blockPos_1).get(DispenserBlock.FACING));
if (world_1.getBlockState(front).getBlock() != Blocks.CRAFTING_TABLE) return;
DispenserBlockEntity dispenserBlockEntity_1 = (DispenserBlockEntity) world_1.getBlockEntity(blockPos_1);
BlockPos front = pos.offset(world.getBlockState(pos).get(DispenserBlock.FACING));
if (world.getBlockState(front).getBlock() != Blocks.CRAFTING_TABLE) return;
DispenserBlockEntity dispenserBlockEntity_1 = (DispenserBlockEntity) world.getBlockEntity(pos);
if (dispenserBlockEntity_1 == null) return;
CraftingInventory craftingInventory = new CraftingInventory(new VoidContainer(), 3, 3);
for (int i=0; i < 9; i++) craftingInventory.setStack(i, dispenserBlockEntity_1.getStack(i));
CraftingRecipe recipe = world_1.getRecipeManager().getFirstMatch(RecipeType.CRAFTING, craftingInventory, world_1).orElse(null);
CraftingRecipe recipe = world.getRecipeManager().getFirstMatch(RecipeType.CRAFTING, craftingInventory, world).orElse(null);
if (recipe == null) return;
// crafting it
Vec3d target = Vec3d.ofBottomCenter(front).add(0.0, 0.2, 0.0);
ItemStack result = recipe.craft(craftingInventory);
spawn(world_1, target.x, target.y, target.z, result);
spawn(world, target.x, target.y, target.z, result);

// copied from CraftingResultSlot.onTakeItem()
DefaultedList<ItemStack> defaultedList_1 = world_1.getRecipeManager().getRemainingStacks(RecipeType.CRAFTING, craftingInventory, world_1);
DefaultedList<ItemStack> defaultedList_1 = world.getRecipeManager().getRemainingStacks(RecipeType.CRAFTING, craftingInventory, world);
for(int int_1 = 0; int_1 < defaultedList_1.size(); ++int_1) {
ItemStack itemStack_2 = dispenserBlockEntity_1.getStack(int_1);
ItemStack itemStack_3 = defaultedList_1.get(int_1);
Expand All @@ -106,13 +106,11 @@ private void tryCraft(ServerWorld world_1, BlockPos blockPos_1, CallbackInfo ci)
itemStack_3.increment(itemStack_2.getCount());
dispenserBlockEntity_1.setStack(int_1, itemStack_3);
} else {
spawn(world_1, target.x, target.y, target.z, itemStack_3);
spawn(world, target.x, target.y, target.z, itemStack_3);
}
}
}
Vec3d vec = Vec3d.ofCenter(blockPos_1); //+0.5v
ServerWorld world = (ServerWorld) world_1;
world.playSound(null, blockPos_1, SoundEvents.ENTITY_VILLAGER_WORK_MASON, SoundCategory.BLOCKS, 0.2f, 2.0f);
world.playSound(null, pos, SoundEvents.ENTITY_VILLAGER_WORK_MASON, SoundCategory.BLOCKS, 0.2f, 2.0f);
ci.cancel();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Slice;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import net.minecraft.entity.ai.brain.task.Task;
import net.minecraft.entity.passive.VillagerEntity;
import net.minecraft.inventory.SimpleInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.server.world.ServerWorld;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import carpetextra.CarpetExtraSettings;
import net.minecraft.block.entity.Hopper;
import net.minecraft.block.entity.HopperBlockEntity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.ItemEntity;
import net.minecraft.entity.vehicle.HopperMinecartEntity;
Expand Down Expand Up @@ -45,7 +46,7 @@ private void rememberBlockPos(CallbackInfo ci){

//Bugfix 1: Picking up an item doesn't set the cooldown because the return value is false even when successful
@Inject(method = "canOperate", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/entity/HopperBlockEntity;extract(Lnet/minecraft/inventory/Inventory;Lnet/minecraft/entity/ItemEntity;)Z", shift = At.Shift.BEFORE),cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD)
private void extractAndReturnSuccess(CallbackInfoReturnable<Boolean> cir, List list_1) {
private void extractAndReturnSuccess(CallbackInfoReturnable<Boolean> cir, List<Entity> list_1) {
if (CarpetExtraSettings.hopperMinecart8gtCooldown) {
boolean result = HopperBlockEntity.extract(this, (ItemEntity) list_1.get(0));
cir.setReturnValue(result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;

Expand Down
1 change: 0 additions & 1 deletion src/main/java/carpetextra/mixins/NoteBlockMixin.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package carpetextra.mixins;

import net.minecraft.block.NoteBlock;
import net.minecraft.entity.player.PlayerAbilities;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.Identifier;
import org.spongepowered.asm.mixin.Mixin;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@

import carpetextra.CarpetExtraSettings;
import net.minecraft.block.ScaffoldingBlock;
import net.minecraft.state.property.IntProperty;
import org.objectweb.asm.Opcodes;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
import org.spongepowered.asm.mixin.injection.Redirect;

@Mixin(ScaffoldingBlock.class)
public class ScaffoldingBlock_scaffoldingDistanceMixin {
Expand Down
1 change: 0 additions & 1 deletion src/main/java/carpetextra/mixins/SpiderEntityMixin.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package carpetextra.mixins;

import carpetextra.CarpetExtraSettings;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.mob.HostileEntity;
Expand Down

0 comments on commit 6dc7b62

Please sign in to comment.