-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 2 block tall crops (corn) now extend from CropBlock thereby resolving some mod compat issues - Expanded animal breeding with crops beyond chickens
- Loading branch information
Showing
15 changed files
with
142 additions
and
325 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
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
33 changes: 33 additions & 0 deletions
33
src/main/java/dev/elexi/hugeblank/bagels_baking/entity/FeedItems.java
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package dev.elexi.hugeblank.bagels_baking.entity; | ||
|
||
import dev.elexi.hugeblank.bagels_baking.Baking; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.recipe.Ingredient; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.stream.Stream; | ||
|
||
public class FeedItems { | ||
public static Item[] COW = {Baking.CORN}; | ||
public static Item[] PIG = {Baking.CORN, Baking.TOMATO}; | ||
public static Item[] CHICKEN = {Baking.CORN_MEAL, Baking.CORN_SEEDS, Baking.WILD_RICE, Baking.RICE}; | ||
|
||
public static ArrayList<ItemStack> getList(Object[] objs) { | ||
Stream<Object> items = Arrays.stream(objs); | ||
ArrayList<ItemStack> stacks = new ArrayList<>(); | ||
items.forEach((Object item) -> { | ||
stacks.add(((Item)item).getDefaultStack()); | ||
}); | ||
return stacks; | ||
} | ||
|
||
public static Ingredient set(Item[] a, Object[] b) { | ||
ArrayList<ItemStack> out = getList(a); | ||
out.addAll(getList(b)); | ||
|
||
return Ingredient.ofStacks(out.stream()); | ||
} | ||
} | ||
|
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
31 changes: 0 additions & 31 deletions
31
src/main/java/dev/elexi/hugeblank/bagels_baking/mixin/entity/ChickenSeeds.java
This file was deleted.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
src/main/java/dev/elexi/hugeblank/bagels_baking/mixin/entity/passive/AnimalBreedItems.java
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package dev.elexi.hugeblank.bagels_baking.mixin.entity.passive; | ||
|
||
import dev.elexi.hugeblank.bagels_baking.Baking; | ||
import net.minecraft.entity.passive.AnimalEntity; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.item.Items; | ||
import net.minecraft.recipe.Ingredient; | ||
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.CallbackInfoReturnable; | ||
|
||
@Mixin(AnimalEntity.class) | ||
public class AnimalBreedItems { | ||
|
||
private static final Ingredient breedingItems = Ingredient.ofItems(Items.WHEAT, Baking.CORN); | ||
|
||
@Inject(at = @At("HEAD"), method = "isBreedingItem(Lnet/minecraft/item/ItemStack;)Z", cancellable = true) | ||
public void isBreedingItem(ItemStack stack, CallbackInfoReturnable<Boolean> cir) { | ||
cir.setReturnValue(breedingItems.test(stack)); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/dev/elexi/hugeblank/bagels_baking/mixin/entity/passive/ChickenSeeds.java
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package dev.elexi.hugeblank.bagels_baking.mixin.entity.passive; | ||
|
||
import dev.elexi.hugeblank.bagels_baking.entity.FeedItems; | ||
import net.minecraft.entity.passive.ChickenEntity; | ||
import net.minecraft.item.ItemConvertible; | ||
import net.minecraft.recipe.Ingredient; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
|
||
@Mixin(ChickenEntity.class) | ||
class ChickenSeeds { | ||
@Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/recipe/Ingredient;ofItems([Lnet/minecraft/item/ItemConvertible;)Lnet/minecraft/recipe/Ingredient;", ordinal = 0), method = "<clinit>") | ||
private static Ingredient validSeeds(ItemConvertible[] items) { | ||
return FeedItems.set(FeedItems.CHICKEN, items); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/dev/elexi/hugeblank/bagels_baking/mixin/entity/passive/CowFeed.java
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package dev.elexi.hugeblank.bagels_baking.mixin.entity.passive; | ||
|
||
import dev.elexi.hugeblank.bagels_baking.entity.FeedItems; | ||
import net.minecraft.entity.passive.CowEntity; | ||
import net.minecraft.item.ItemConvertible; | ||
import net.minecraft.recipe.Ingredient; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
|
||
@Mixin(CowEntity.class) | ||
class CowFeed { | ||
@Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/recipe/Ingredient;ofItems([Lnet/minecraft/item/ItemConvertible;)Lnet/minecraft/recipe/Ingredient;", ordinal = 0), method = "initGoals()V") | ||
private Ingredient breedItems(ItemConvertible[] items) { | ||
return FeedItems.set(FeedItems.COW, items); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/dev/elexi/hugeblank/bagels_baking/mixin/entity/passive/PigFeed.java
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package dev.elexi.hugeblank.bagels_baking.mixin.entity.passive; | ||
|
||
import dev.elexi.hugeblank.bagels_baking.entity.FeedItems; | ||
import net.minecraft.entity.passive.PigEntity; | ||
import net.minecraft.item.ItemConvertible; | ||
import net.minecraft.recipe.Ingredient; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
|
||
@Mixin(PigEntity.class) | ||
class PigFeed { | ||
@Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/recipe/Ingredient;ofItems([Lnet/minecraft/item/ItemConvertible;)Lnet/minecraft/recipe/Ingredient;", ordinal = 0), method = "<clinit>") | ||
private static Ingredient breedItems(ItemConvertible[] items) { | ||
return FeedItems.set(FeedItems.PIG, items); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/dev/elexi/hugeblank/bagels_baking/mixin/entity/passive/SheepFeed.java
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package dev.elexi.hugeblank.bagels_baking.mixin.entity.passive; | ||
|
||
import dev.elexi.hugeblank.bagels_baking.entity.FeedItems; | ||
import net.minecraft.entity.passive.SheepEntity; | ||
import net.minecraft.item.ItemConvertible; | ||
import net.minecraft.recipe.Ingredient; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
|
||
@Mixin(SheepEntity.class) | ||
class SheepFeed { | ||
@Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/recipe/Ingredient;ofItems([Lnet/minecraft/item/ItemConvertible;)Lnet/minecraft/recipe/Ingredient;", ordinal = 0), method = "initGoals()V") | ||
private Ingredient breedItems(ItemConvertible[] items) { | ||
return FeedItems.set(FeedItems.COW, items); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...els_baking/mixin/entity/TrickyRabbit.java → ...ng/mixin/entity/passive/TrickyRabbit.java
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
Oops, something went wrong.