mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-17 19:05:16 +00:00
Merge 1.12
This commit is contained in:
commit
13e56153a9
80 files changed
+1165
-784
No files matched your search
@@ -67,8 +67,8 @@ import vazkii.botania.common.item.ModItems;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
@@ -104,6 +104,7 @@ public final class BotaniaAPI {
|
||||
public static final Set<Item> looniumBlacklist = new LinkedHashSet<>();
|
||||
public static final Map<Block, EnumProperty<EnumDyeColor>> paintableBlocks = new LinkedHashMap<>();
|
||||
public static final Set<Class<? extends Entity>> gravityRodBlacklist = new LinkedHashSet<>();
|
||||
public static final Set<Block> gaiaBreakBlacklist = new HashSet<>();
|
||||
|
||||
// TODO 1.13 move these to eliminate dependence on botania proper in Ingredients
|
||||
private static final int[] MAX_DAMAGE_ARRAY = new int[]{13, 15, 16, 11};
|
||||
@@ -473,6 +474,7 @@ public final class BotaniaAPI {
|
||||
registerPaintableBlock(Blocks.STAINED_HARDENED_CLAY, BlockColored.COLOR);
|
||||
registerPaintableBlock(Blocks.WOOL, BlockColored.COLOR);
|
||||
registerPaintableBlock(Blocks.CARPET, BlockCarpet.COLOR);
|
||||
blacklistBlockFromGaiaGuardian(Blocks.BEACON);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -805,4 +807,7 @@ public final class BotaniaAPI {
|
||||
return subTiles.keySet();
|
||||
}
|
||||
|
||||
public static void blacklistBlockFromGaiaGuardian(Block block) {
|
||||
gaiaBreakBlacklist.add(block);
|
||||
}
|
||||
}
|
||||
@@ -194,12 +194,12 @@ public final class CorporeaHelper {
|
||||
}
|
||||
}
|
||||
|
||||
lastRequestMatches = request.foundItems;
|
||||
lastRequestExtractions = request.extractedItems;
|
||||
|
||||
for(ICorporeaInterceptor interceptor : interceptors.keySet())
|
||||
interceptor.interceptRequestLast(matcher, itemCount, interceptors.get(interceptor), spark, stacks, inventories, doit);
|
||||
|
||||
lastRequestMatches = request.foundItems;
|
||||
lastRequestExtractions = request.extractedItems;
|
||||
|
||||
return stacks;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,2 @@
|
||||
@API(owner = "botania", apiVersion = "92", provides = "BotaniaAPI")
|
||||
package vazkii.botania.api;
|
||||
import net.minecraftforge.fml.common.API;
|
||||
|
||||
@@ -15,6 +15,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import vazkii.botania.common.core.helper.ItemNBTHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -79,19 +80,7 @@ public class RecipePetals {
|
||||
}
|
||||
|
||||
private boolean compareStacks(ItemStack recipe, ItemStack supplied) {
|
||||
if(recipe.getItem() == supplied.getItem() && recipe.getItemDamage() == supplied.getItemDamage()) {
|
||||
//check that the user supplied nbt tag is a superset of the recipe item nbt tag
|
||||
//if the recipe doesn't have an NBT tag, the user supplied one doesn't matter, it is a superset
|
||||
if(!recipe.hasTagCompound()) return true;
|
||||
//if the recipe does have an NBT tag but the user supplied doesn't, also no way it's a superset
|
||||
if(!supplied.hasTagCompound()) return false;
|
||||
|
||||
NBTTagCompound mergedNBT = supplied.getTagCompound().copy();
|
||||
mergedNBT.merge(recipe.getTagCompound());
|
||||
return supplied.getTagCompound().equals(mergedNBT);
|
||||
}
|
||||
|
||||
return false;
|
||||
return recipe.getItem() == supplied.getItem() && recipe.getItemDamage() == supplied.getItemDamage() && ItemNBTHelper.isTagSubset(recipe.getTagCompound(), supplied.getTagCompound());
|
||||
}
|
||||
|
||||
public List<Object> getInputs() {
|
||||
|
||||
@@ -130,7 +130,7 @@ public final class HUDHandler {
|
||||
|
||||
if(PlayerHelper.hasAnyHeldItem(mc.player)) {
|
||||
if(pos != null && PlayerHelper.hasHeldItem(mc.player, ModItems.twigWand)) {
|
||||
renderWandModeDisplay(PlayerHelper.getFirstHeldItem(mc.player, ModItems.twigWand), event.getResolution());
|
||||
renderWandModeDisplay(PlayerHelper.getFirstHeldItem(mc.player, ModItems.twigWand));
|
||||
|
||||
if(block instanceof IWandHUD) {
|
||||
profiler.startSection("wandItem");
|
||||
@@ -138,17 +138,18 @@ public final class HUDHandler {
|
||||
profiler.endSection();
|
||||
}
|
||||
} else if(block != null && PlayerHelper.hasHeldItemClass(mc.player, ILexicon.class))
|
||||
drawLexiconHUD(PlayerHelper.getFirstHeldItemClass(mc.player, ILexicon.class), state, pos, event.getResolution());
|
||||
if(tile != null && tile instanceof TilePool && !mc.player.getHeldItemMainhand().isEmpty())
|
||||
drawLexiconHUD(PlayerHelper.getFirstHeldItemClass(mc.player, ILexicon.class), state, pos);
|
||||
if(tile instanceof TilePool && !mc.player.getHeldItemMainhand().isEmpty())
|
||||
renderPoolRecipeHUD((TilePool) tile, mc.player.getHeldItemMainhand());
|
||||
}
|
||||
if(tile != null && tile instanceof TileAltar)
|
||||
((TileAltar) tile).renderHUD(mc);
|
||||
else if(tile != null && tile instanceof TileRuneAltar)
|
||||
((TileRuneAltar) tile).renderHUD(mc);
|
||||
|
||||
if(tile != null && tile instanceof TileCorporeaCrystalCube)
|
||||
renderCrystalCubeHUD((TileCorporeaCrystalCube) tile);
|
||||
if(!PlayerHelper.hasHeldItemClass(mc.player, ILexicon.class)) {
|
||||
if(tile instanceof TileAltar)
|
||||
((TileAltar) tile).renderHUD(mc);
|
||||
else if(tile instanceof TileRuneAltar)
|
||||
((TileRuneAltar) tile).renderHUD(mc);
|
||||
else if(tile instanceof TileCorporeaCrystalCube)
|
||||
renderCrystalCubeHUD((TileCorporeaCrystalCube) tile);
|
||||
}
|
||||
}
|
||||
|
||||
TileCorporeaIndex.getInputHandler();
|
||||
@@ -354,11 +355,14 @@ public final class HUDHandler {
|
||||
int strlen = Math.max(mc.fontRenderer.getStringWidth(s1), mc.fontRenderer.getStringWidth(s2));
|
||||
int w = mc.mainWindow.getScaledWidth();
|
||||
int h = mc.mainWindow.getScaledHeight();
|
||||
Gui.drawRect(w / 2 + 8, h / 2 - 12, w / 2 + strlen + 32, h / 2 + 10, 0x44000000);
|
||||
Gui.drawRect(w / 2 + 6, h / 2 - 14, w / 2 + strlen + 34, h / 2 + 12, 0x44000000);
|
||||
int boxH = h / 2 + (tile.locked ? 20 : 10);
|
||||
Gui.drawRect(w / 2 + 8, h / 2 - 12, w / 2 + strlen + 32, boxH, 0x44000000);
|
||||
Gui.drawRect(w / 2 + 6, h / 2 - 14, w / 2 + strlen + 34, boxH + 2, 0x44000000);
|
||||
|
||||
mc.fontRenderer.drawStringWithShadow(s1, w / 2 + 30, h / 2 - 10, 0x6666FF);
|
||||
mc.fontRenderer.drawStringWithShadow(tile.getItemCount() + "x", w / 2 + 30, h / 2, 0xFFFFFF);
|
||||
if(tile.locked)
|
||||
mc.fontRenderer.drawStringWithShadow(I18n.format("botaniamisc.locked"), w / 2 + 30, h / 2 + 10, 0xFFAA00);
|
||||
net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
|
||||
GlStateManager.enableRescaleNormal();
|
||||
mc.getItemRenderer().renderItemAndEffectIntoGUI(target, w / 2 + 10, h / 2 - 10);
|
||||
|
||||
@@ -11,10 +11,12 @@ package vazkii.botania.client.integration.jei;
|
||||
import mezz.jei.api.IJeiRuntime;
|
||||
import mezz.jei.api.IModPlugin;
|
||||
import mezz.jei.api.IModRegistry;
|
||||
import mezz.jei.api.IRecipeRegistry;
|
||||
import mezz.jei.api.IRecipesGui;
|
||||
import mezz.jei.api.ISubtypeRegistry;
|
||||
import mezz.jei.api.JEIPlugin;
|
||||
import mezz.jei.api.recipe.IRecipeCategoryRegistration;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import mezz.jei.api.recipe.VanillaRecipeCategoryUid;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
@@ -33,7 +35,10 @@ import vazkii.botania.client.core.handler.CorporeaInputHandler;
|
||||
import vazkii.botania.client.gui.crafting.ContainerCraftingHalo;
|
||||
import vazkii.botania.client.integration.jei.brewery.BreweryRecipeCategory;
|
||||
import vazkii.botania.client.integration.jei.brewery.BreweryRecipeWrapper;
|
||||
import vazkii.botania.client.integration.jei.crafting.AncientWillRecipeWrapper;
|
||||
import vazkii.botania.client.integration.jei.crafting.CompositeLensRecipeWrapper;
|
||||
import vazkii.botania.client.integration.jei.crafting.SpecialFloatingFlowerWrapper;
|
||||
import vazkii.botania.client.integration.jei.crafting.TerraPickTippingRecipeWrapper;
|
||||
import vazkii.botania.client.integration.jei.elventrade.ElvenTradeRecipeCategory;
|
||||
import vazkii.botania.client.integration.jei.elventrade.ElvenTradeRecipeWrapper;
|
||||
import vazkii.botania.client.integration.jei.manapool.ManaPoolRecipeCategory;
|
||||
@@ -49,13 +54,17 @@ import vazkii.botania.client.integration.jei.puredaisy.PureDaisyRecipeWrapper;
|
||||
import vazkii.botania.client.integration.jei.runicaltar.RunicAltarRecipeCategory;
|
||||
import vazkii.botania.client.integration.jei.runicaltar.RunicAltarRecipeWrapper;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.crafting.recipe.AncientWillRecipe;
|
||||
import vazkii.botania.common.crafting.recipe.CompositeLensRecipe;
|
||||
import vazkii.botania.common.crafting.recipe.SpecialFloatingFlowerRecipe;
|
||||
import vazkii.botania.common.crafting.recipe.TerraPickTippingRecipe;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
import vazkii.botania.common.item.brew.ItemBrewBase;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static vazkii.botania.common.lib.LibBlockNames.SUBTILE_ORECHID;
|
||||
@@ -103,8 +112,12 @@ public class JEIBotaniaPlugin implements IModPlugin {
|
||||
registry.handleRecipes(RecipePetals.class, PetalApothecaryRecipeWrapper::new, PetalApothecaryRecipeCategory.UID);
|
||||
registry.handleRecipes(RecipeElvenTrade.class, ElvenTradeRecipeWrapper::new, ElvenTradeRecipeCategory.UID);
|
||||
registry.handleRecipes(RecipeManaInfusion.class, ManaPoolRecipeWrapper::new, ManaPoolRecipeCategory.UID);
|
||||
|
||||
registry.handleRecipes(SpecialFloatingFlowerRecipe.class, SpecialFloatingFlowerWrapper::new, VanillaRecipeCategoryUid.CRAFTING);
|
||||
|
||||
registry.handleRecipes(AncientWillRecipe.class, AncientWillRecipeWrapper::new, VanillaRecipeCategoryUid.CRAFTING);
|
||||
registry.handleRecipes(TerraPickTippingRecipe.class, TerraPickTippingRecipeWrapper::new, VanillaRecipeCategoryUid.CRAFTING);
|
||||
registry.handleRecipes(CompositeLensRecipe.class, r -> new CompositeLensRecipeWrapper(), VanillaRecipeCategoryUid.CRAFTING);
|
||||
|
||||
registry.addRecipes(BotaniaAPI.brewRecipes, BreweryRecipeCategory.UID);
|
||||
registry.addRecipes(BotaniaAPI.pureDaisyRecipes, PureDaisyRecipeCategory.UID);
|
||||
registry.addRecipes(BotaniaAPI.petalRecipes, PetalApothecaryRecipeCategory.UID);
|
||||
@@ -165,6 +178,19 @@ public class JEIBotaniaPlugin implements IModPlugin {
|
||||
|
||||
@Override
|
||||
public void onRuntimeAvailable(IJeiRuntime jeiRuntime) {
|
||||
IRecipeRegistry recipeRegistry = jeiRuntime.getRecipeRegistry();
|
||||
for(RecipeElvenTrade recipe : BotaniaAPI.elvenTradeRecipes) {
|
||||
List<Object> inputs = recipe.getInputs();
|
||||
List<ItemStack> outputs = recipe.getOutputs();
|
||||
if(inputs.size() == 1 && outputs.size() == 1 && inputs.get(0) instanceof ItemStack
|
||||
&& ItemStack.areItemStacksEqual((ItemStack) inputs.get(0), outputs.get(0))) {
|
||||
IRecipeWrapper wrapper = recipeRegistry.getRecipeWrapper(recipe, ElvenTradeRecipeCategory.UID);
|
||||
if(wrapper != null) {
|
||||
recipeRegistry.hideRecipe(wrapper, ElvenTradeRecipeCategory.UID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CorporeaInputHandler.jeiPanelSupplier = () -> {
|
||||
Object o = jeiRuntime.getIngredientListOverlay().getIngredientUnderMouse();
|
||||
|
||||
|
||||
+6
-8
@@ -13,9 +13,9 @@ import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IDrawableStatic;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.ingredients.VanillaTypes;
|
||||
import mezz.jei.api.recipe.IFocus;
|
||||
import mezz.jei.api.recipe.IRecipeCategory;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
@@ -25,7 +25,7 @@ import javax.annotation.Nonnull;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class BreweryRecipeCategory implements IRecipeCategory {
|
||||
public class BreweryRecipeCategory implements IRecipeCategory<BreweryRecipeWrapper> {
|
||||
|
||||
public static final String UID = "botania.brewery";
|
||||
private final IDrawableStatic background;
|
||||
@@ -33,7 +33,7 @@ public class BreweryRecipeCategory implements IRecipeCategory {
|
||||
|
||||
public BreweryRecipeCategory(IGuiHelper guiHelper) {
|
||||
ResourceLocation location = new ResourceLocation("botania", "textures/gui/neiBrewery.png");
|
||||
background = guiHelper.createDrawable(location, 0, 0, 166, 65, 0, 0, 0, 0);
|
||||
background = guiHelper.createDrawable(location, 0, 0, 166, 65);
|
||||
localizedName = I18n.format("botania.nei.brewery");
|
||||
}
|
||||
|
||||
@@ -62,12 +62,10 @@ public class BreweryRecipeCategory implements IRecipeCategory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
|
||||
if(!(recipeWrapper instanceof BreweryRecipeWrapper))
|
||||
return;
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull BreweryRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
|
||||
|
||||
List<List<ItemStack>> inputs = ingredients.getInputs(ItemStack.class);
|
||||
List<List<ItemStack>> outputs = ingredients.getOutputs(ItemStack.class);
|
||||
List<List<ItemStack>> inputs = ingredients.getInputs(VanillaTypes.ITEM);
|
||||
List<List<ItemStack>> outputs = ingredients.getOutputs(VanillaTypes.ITEM);
|
||||
IFocus<?> focus = recipeLayout.getFocus();
|
||||
|
||||
recipeLayout.getItemStacks().init(0, true, 39, 41);
|
||||
|
||||
+6
-5
@@ -10,6 +10,7 @@ package vazkii.botania.client.integration.jei.brewery;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.ingredients.VanillaTypes;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
@@ -24,8 +25,8 @@ public class BreweryRecipeWrapper implements IRecipeWrapper {
|
||||
|
||||
private final List<List<ItemStack>> input;
|
||||
private final List<ItemStack> output;
|
||||
|
||||
private static final List<ItemStack> inputs = Arrays.asList(new ItemStack(ModItems.vial),
|
||||
|
||||
private static final List<ItemStack> inputs = Arrays.asList(new ItemStack(ModItems.vial),
|
||||
new ItemStack(ModItems.flask), new ItemStack(ModItems.incenseStick), new ItemStack(ModItems.bloodPendant));
|
||||
|
||||
public BreweryRecipeWrapper(RecipeBrew recipeBrew) {
|
||||
@@ -41,7 +42,7 @@ public class BreweryRecipeWrapper implements IRecipeWrapper {
|
||||
}
|
||||
}
|
||||
inputBuilder.add(containers.build());
|
||||
|
||||
|
||||
for(Object o : recipeBrew.getInputs()) {
|
||||
if(o instanceof ItemStack) {
|
||||
inputBuilder.add(ImmutableList.of((ItemStack) o));
|
||||
@@ -57,7 +58,7 @@ public class BreweryRecipeWrapper implements IRecipeWrapper {
|
||||
|
||||
@Override
|
||||
public void getIngredients(@Nonnull IIngredients ingredients) {
|
||||
ingredients.setInputLists(ItemStack.class, input);
|
||||
ingredients.setOutputLists(ItemStack.class, ImmutableList.of(output));
|
||||
ingredients.setInputLists(VanillaTypes.ITEM, input);
|
||||
ingredients.setOutputLists(VanillaTypes.ITEM, ImmutableList.of(output));
|
||||
}
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
package vazkii.botania.client.integration.jei.crafting;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.ingredients.VanillaTypes;
|
||||
import mezz.jei.api.recipe.IFocus;
|
||||
import mezz.jei.api.recipe.wrapper.ICustomCraftingRecipeWrapper;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import vazkii.botania.api.item.IAncientWillContainer;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.crafting.recipe.AncientWillRecipe;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
public class AncientWillRecipeWrapper implements ICustomCraftingRecipeWrapper {
|
||||
private final ResourceLocation name;
|
||||
private final List<List<ItemStack>> inputs;
|
||||
private final List<ItemStack> output;
|
||||
|
||||
public AncientWillRecipeWrapper(AncientWillRecipe recipe) {
|
||||
this.name = recipe.getRegistryName();
|
||||
|
||||
ImmutableList.Builder<List<ItemStack>> builder = ImmutableList.builder();
|
||||
ImmutableList.Builder<ItemStack> helmets = ImmutableList.builder();
|
||||
ImmutableList.Builder<ItemStack> wills = ImmutableList.builder();
|
||||
helmets.add(new ItemStack(ModItems.terrasteelHelm));
|
||||
if(Botania.thaumcraftLoaded) {
|
||||
helmets.add(new ItemStack(ModItems.terrasteelHelmRevealing));
|
||||
}
|
||||
for(int i = 0; i < 6; i++) {
|
||||
wills.add(new ItemStack(ModItems.ancientWill, 1, i));
|
||||
}
|
||||
|
||||
output = helmets.build();
|
||||
builder.add(output);
|
||||
builder.add(wills.build());
|
||||
inputs = builder.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getIngredients(@Nonnull IIngredients ingredients) {
|
||||
ingredients.setInputLists(VanillaTypes.ITEM, inputs);
|
||||
ingredients.setOutputLists(VanillaTypes.ITEM, ImmutableList.of(output));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ResourceLocation getRegistryName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IIngredients ingredients) {
|
||||
IFocus<?> focus = recipeLayout.getFocus();
|
||||
IGuiItemStackGroup group = recipeLayout.getItemStacks();
|
||||
group.set(ingredients);
|
||||
|
||||
if(focus != null) {
|
||||
ItemStack focused = (ItemStack) focus.getValue();
|
||||
|
||||
if(focus.getMode() == IFocus.Mode.INPUT && focused.getItem() == ModItems.ancientWill) {
|
||||
group.set(2, new ItemStack(ModItems.ancientWill, 1, focused.getMetadata()));
|
||||
group.set(0, getHelmetsWithWill(focused.getMetadata()));
|
||||
} else if(focused.getItem() instanceof IAncientWillContainer) { //helmet
|
||||
group.set(1, new ItemStack(focused.getItem()));
|
||||
group.set(0, getWillsOnHelmet(focused.getItem()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<ItemStack> getHelmetsWithWill(int meta) {
|
||||
ImmutableList.Builder<ItemStack> builder = ImmutableList.builder();
|
||||
for(ItemStack itemStack : output) {
|
||||
ItemStack toAdd = itemStack.copy();
|
||||
((IAncientWillContainer) toAdd.getItem()).addAncientWill(toAdd, meta);
|
||||
builder.add(toAdd);
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
private List<ItemStack> getWillsOnHelmet(Item item) {
|
||||
if(item instanceof IAncientWillContainer) {
|
||||
ImmutableList.Builder<ItemStack> builder = ImmutableList.builder();
|
||||
for(int i = 0; i < 6; i++) {
|
||||
ItemStack stack = new ItemStack(item);
|
||||
((IAncientWillContainer) item).addAncientWill(stack, i);
|
||||
builder.add(stack);
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
return ImmutableList.of();
|
||||
}
|
||||
}
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
package vazkii.botania.client.integration.jei.crafting;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.ingredients.VanillaTypes;
|
||||
import mezz.jei.api.recipe.wrapper.ICustomCraftingRecipeWrapper;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.item.lens.ItemLens;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class CompositeLensRecipeWrapper implements ICustomCraftingRecipeWrapper {
|
||||
private final List<List<ItemStack>> inputs;
|
||||
private static final List<ItemStack> lenses;
|
||||
|
||||
static {
|
||||
NonNullList<ItemStack> allLenses = NonNullList.create();
|
||||
ItemLens lens = (ItemLens) ModItems.lens;
|
||||
lens.getSubItems(CreativeTabs.SEARCH, allLenses);
|
||||
lenses = ImmutableList.copyOf(allLenses.stream().filter(stack -> !lens.isControlLens(stack)).filter(lens::isCombinable).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
public CompositeLensRecipeWrapper() {
|
||||
inputs = ImmutableList.of(lenses, ImmutableList.of(new ItemStack(Items.SLIME_BALL)), lenses);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getIngredients(@Nonnull IIngredients ingredients) {
|
||||
ingredients.setInputLists(VanillaTypes.ITEM, inputs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IIngredients ingredients) {
|
||||
recipeLayout.getItemStacks().set(ingredients);
|
||||
recipeLayout.setShapeless();
|
||||
if(recipeLayout.getFocus() != null) {
|
||||
ItemStack stack = (ItemStack) recipeLayout.getFocus().getValue();
|
||||
if(stack.getItem() == ModItems.lens) {
|
||||
setLenses(recipeLayout, stack.getMetadata(), stack.getMetadata());
|
||||
return;
|
||||
}
|
||||
}
|
||||
setLenses(recipeLayout, 1, ItemLens.SUBTYPES - 1);
|
||||
}
|
||||
|
||||
private void setLenses(IRecipeLayout recipeLayout, int start, int end) {
|
||||
List<ItemStack> firstInput = new ArrayList<>();
|
||||
List<ItemStack> secondInput = new ArrayList<>();
|
||||
List<ItemStack> outputs = new ArrayList<>();
|
||||
|
||||
if(end >= ItemLens.SUBTYPES)
|
||||
end = ItemLens.SUBTYPES - 1;
|
||||
|
||||
for(int i = start; i <= end; i++) {
|
||||
ItemStack firstLens = new ItemStack(ModItems.lens, 1, i);
|
||||
for(ItemStack secondLens : lenses) {
|
||||
if(secondLens.getMetadata() == i)
|
||||
continue;
|
||||
|
||||
if(((ItemLens) ModItems.lens).canCombineLenses(firstLens, secondLens)) {
|
||||
firstInput.add(firstLens);
|
||||
secondInput.add(secondLens);
|
||||
outputs.add(((ItemLens) ModItems.lens).setCompositeLens(firstLens.copy(), secondLens));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
recipeLayout.getItemStacks().set(1, firstInput);
|
||||
recipeLayout.getItemStacks().set(3, secondInput);
|
||||
recipeLayout.getItemStacks().set(0, outputs);
|
||||
}
|
||||
|
||||
}
|
||||
+30
-19
@@ -2,34 +2,45 @@ package vazkii.botania.client.integration.jei.crafting;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import mezz.jei.api.ingredients.VanillaTypes;
|
||||
import mezz.jei.api.recipe.wrapper.ICraftingRecipeWrapper;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.crafting.recipe.SpecialFloatingFlowerRecipe;
|
||||
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SpecialFloatingFlowerWrapper implements IRecipeWrapper {
|
||||
private final List<List<ItemStack>> inputs = new ArrayList<>();
|
||||
private final ItemStack output;
|
||||
public class SpecialFloatingFlowerWrapper implements ICraftingRecipeWrapper {
|
||||
private final List<List<ItemStack>> inputs = new ArrayList<>();
|
||||
private final ItemStack output;
|
||||
private final ResourceLocation name;
|
||||
|
||||
public SpecialFloatingFlowerWrapper(SpecialFloatingFlowerRecipe recipe) {
|
||||
inputs.add(ImmutableList.of(ItemBlockSpecialFlower.ofType(recipe.type)));
|
||||
List<ItemStack> normalFloaters = new ArrayList<>();
|
||||
for (EnumDyeColor color : EnumDyeColor.values()) {
|
||||
normalFloaters.add(new ItemStack(ModBlocks.floatingFlower, 1, color.getMetadata()));
|
||||
}
|
||||
inputs.add(normalFloaters);
|
||||
output = ItemBlockSpecialFlower.ofType(new ItemStack(ModBlocks.floatingSpecialFlower), recipe.type);
|
||||
}
|
||||
public SpecialFloatingFlowerWrapper(SpecialFloatingFlowerRecipe recipe) {
|
||||
name = recipe.getRegistryName();
|
||||
inputs.add(ImmutableList.of(ItemBlockSpecialFlower.ofType(recipe.type)));
|
||||
List<ItemStack> normalFloaters = new ArrayList<>();
|
||||
for(EnumDyeColor color : EnumDyeColor.values()) {
|
||||
normalFloaters.add(new ItemStack(ModBlocks.floatingFlower, 1, color.getMetadata()));
|
||||
}
|
||||
inputs.add(normalFloaters);
|
||||
output = ItemBlockSpecialFlower.ofType(new ItemStack(ModBlocks.floatingSpecialFlower), recipe.type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getIngredients(IIngredients ingredients) {
|
||||
ingredients.setInputLists(ItemStack.class, inputs);
|
||||
ingredients.setOutput(ItemStack.class, output);
|
||||
}
|
||||
@Override
|
||||
public void getIngredients(@Nonnull IIngredients ingredients) {
|
||||
ingredients.setInputLists(VanillaTypes.ITEM, inputs);
|
||||
ingredients.setOutput(VanillaTypes.ITEM, output);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ResourceLocation getRegistryName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
package vazkii.botania.client.integration.jei.crafting;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.ingredients.VanillaTypes;
|
||||
import mezz.jei.api.recipe.wrapper.ICraftingRecipeWrapper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import vazkii.botania.common.crafting.recipe.TerraPickTippingRecipe;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.item.equipment.tool.terrasteel.ItemTerraPick;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
public class TerraPickTippingRecipeWrapper implements ICraftingRecipeWrapper {
|
||||
private final List<List<ItemStack>> inputs;
|
||||
private final ItemStack output;
|
||||
private final ResourceLocation name;
|
||||
|
||||
public TerraPickTippingRecipeWrapper(TerraPickTippingRecipe recipe) {
|
||||
inputs = ImmutableList.of(ImmutableList.of(new ItemStack(ModItems.terraPick)), ImmutableList.of(new ItemStack(ModItems.elementiumPick)));
|
||||
output = new ItemStack(ModItems.terraPick);
|
||||
ItemTerraPick.setTipped(output);
|
||||
|
||||
this.name = recipe.getRegistryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getIngredients(@Nonnull IIngredients ingredients) {
|
||||
ingredients.setInputLists(VanillaTypes.ITEM, inputs);
|
||||
ingredients.setOutput(VanillaTypes.ITEM, output);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ResourceLocation getRegistryName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
+7
-12
@@ -12,8 +12,8 @@ import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.ingredients.VanillaTypes;
|
||||
import mezz.jei.api.recipe.IRecipeCategory;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
@@ -29,11 +29,9 @@ import vazkii.botania.client.core.handler.MiscellaneousIcons;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ElvenTradeRecipeCategory implements IRecipeCategory {
|
||||
public class ElvenTradeRecipeCategory implements IRecipeCategory<ElvenTradeRecipeWrapper> {
|
||||
|
||||
public static final String UID = "botania.elvenTrade";
|
||||
private final String localizedName;
|
||||
@@ -89,20 +87,17 @@ public class ElvenTradeRecipeCategory implements IRecipeCategory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
|
||||
if(!(recipeWrapper instanceof ElvenTradeRecipeWrapper))
|
||||
return;
|
||||
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull ElvenTradeRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
|
||||
int index = 0, posX = 42;
|
||||
for(List<ItemStack> o : ingredients.getInputs(ItemStack.class)) {
|
||||
for(List<ItemStack> o : ingredients.getInputs(VanillaTypes.ITEM)) {
|
||||
recipeLayout.getItemStacks().init(index, true, posX, 0);
|
||||
recipeLayout.getItemStacks().set(index, o);
|
||||
index++;
|
||||
posX += 18;
|
||||
}
|
||||
|
||||
for (int i = 0; i < ingredients.getOutputs(ItemStack.class).size(); i++) {
|
||||
List<ItemStack> stacks = ingredients.getOutputs(ItemStack.class).get(i);
|
||||
for(int i = 0; i < ingredients.getOutputs(VanillaTypes.ITEM).size(); i++) {
|
||||
List<ItemStack> stacks = ingredients.getOutputs(VanillaTypes.ITEM).get(i);
|
||||
recipeLayout.getItemStacks().init(index + i, false, 93 + i % 2 * 20, 41 + i / 2 * 20);
|
||||
recipeLayout.getItemStacks().set(index + i, stacks);
|
||||
}
|
||||
@@ -113,5 +108,5 @@ public class ElvenTradeRecipeCategory implements IRecipeCategory {
|
||||
public String getModName() {
|
||||
return LibMisc.MOD_NAME;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+3
-3
@@ -10,6 +10,7 @@ package vazkii.botania.client.integration.jei.elventrade;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.ingredients.VanillaTypes;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -24,7 +25,6 @@ public class ElvenTradeRecipeWrapper implements IRecipeWrapper {
|
||||
private final List<List<ItemStack>> input;
|
||||
private final List<ItemStack> outputs;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public ElvenTradeRecipeWrapper(RecipeElvenTrade recipe) {
|
||||
ImmutableList.Builder<List<ItemStack>> builder = ImmutableList.builder();
|
||||
for(Object o : recipe.getInputs()) {
|
||||
@@ -41,7 +41,7 @@ public class ElvenTradeRecipeWrapper implements IRecipeWrapper {
|
||||
|
||||
@Override
|
||||
public void getIngredients(@Nonnull IIngredients ingredients) {
|
||||
ingredients.setInputLists(ItemStack.class, input);
|
||||
ingredients.setOutputs(ItemStack.class, outputs);
|
||||
ingredients.setInputLists(VanillaTypes.ITEM, input);
|
||||
ingredients.setOutputs(VanillaTypes.ITEM, outputs);
|
||||
}
|
||||
}
|
||||
+10
-12
@@ -12,8 +12,8 @@ import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.ingredients.VanillaTypes;
|
||||
import mezz.jei.api.recipe.IRecipeCategory;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
@@ -28,7 +28,7 @@ import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ManaPoolRecipeCategory implements IRecipeCategory {
|
||||
public class ManaPoolRecipeCategory implements IRecipeCategory<ManaPoolRecipeWrapper> {
|
||||
|
||||
public static final String UID = "botania.manaPool";
|
||||
private final IDrawable background;
|
||||
@@ -78,21 +78,18 @@ public class ManaPoolRecipeCategory implements IRecipeCategory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
|
||||
if(!(recipeWrapper instanceof ManaPoolRecipeWrapper))
|
||||
return;
|
||||
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull ManaPoolRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
|
||||
int index = 0;
|
||||
|
||||
recipeLayout.getItemStacks().init(index, true, 40, 12);
|
||||
recipeLayout.getItemStacks().set(index, ingredients.getInputs(ItemStack.class).get(0));
|
||||
recipeLayout.getItemStacks().set(index, ingredients.getInputs(VanillaTypes.ITEM).get(0));
|
||||
|
||||
index++;
|
||||
|
||||
if(ingredients.getInputs(ItemStack.class).size() > 1) {
|
||||
if(ingredients.getInputs(VanillaTypes.ITEM).size() > 1) {
|
||||
// Has catalyst
|
||||
recipeLayout.getItemStacks().init(index, true, 20, 12);
|
||||
recipeLayout.getItemStacks().set(index, ingredients.getInputs(ItemStack.class).get(1));
|
||||
recipeLayout.getItemStacks().set(index, ingredients.getInputs(VanillaTypes.ITEM).get(1));
|
||||
index++;
|
||||
}
|
||||
|
||||
@@ -101,12 +98,13 @@ public class ManaPoolRecipeCategory implements IRecipeCategory {
|
||||
index++;
|
||||
|
||||
recipeLayout.getItemStacks().init(index, false, 99, 12);
|
||||
recipeLayout.getItemStacks().set(index, ingredients.getOutputs(ItemStack.class).get(0));
|
||||
recipeLayout.getItemStacks().set(index, ingredients.getOutputs(VanillaTypes.ITEM).get(0));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List getTooltipStrings(int mouseX, int mouseY) {
|
||||
return new ArrayList();
|
||||
public List<String> getTooltipStrings(int mouseX, int mouseY) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
||||
+3
-2
@@ -10,6 +10,7 @@ package vazkii.botania.client.integration.jei.manapool;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.ingredients.VanillaTypes;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -54,8 +55,8 @@ public class ManaPoolRecipeWrapper implements IRecipeWrapper {
|
||||
|
||||
@Override
|
||||
public void getIngredients(@Nonnull IIngredients ingredients) {
|
||||
ingredients.setInputLists(ItemStack.class, input);
|
||||
ingredients.setOutput(ItemStack.class, output);
|
||||
ingredients.setInputLists(VanillaTypes.ITEM, input);
|
||||
ingredients.setOutput(VanillaTypes.ITEM, output);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+91
-92
@@ -1,92 +1,91 @@
|
||||
/**
|
||||
* This class was created by <codewarrior0>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
* <p/>
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*/
|
||||
package vazkii.botania.client.integration.jei.orechid;
|
||||
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IDrawableStatic;
|
||||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.IRecipeCategory;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class OrechidIgnemRecipeCategory implements IRecipeCategory {
|
||||
|
||||
public static final String UID = "botania.orechid_ignem";
|
||||
private final IDrawableStatic background;
|
||||
private final String localizedName;
|
||||
private final IDrawableStatic overlay;
|
||||
|
||||
public OrechidIgnemRecipeCategory(IGuiHelper guiHelper) {
|
||||
background = guiHelper.createBlankDrawable(168, 64);
|
||||
localizedName = I18n.format("botania.nei.orechidIgnem");
|
||||
overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/pureDaisyOverlay.png"),
|
||||
0, 0, 64, 46);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getUid() {
|
||||
return UID;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return localizedName;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IDrawable getBackground() {
|
||||
return background;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients) {
|
||||
final IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
|
||||
|
||||
itemStacks.init(0, true, 40, 12);
|
||||
itemStacks.set(0, ingredients.getInputs(ItemStack.class).get(0));
|
||||
|
||||
itemStacks.init(1, true, 70, 12);
|
||||
itemStacks.set(1, ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_ORECHID_IGNEM));
|
||||
|
||||
itemStacks.init(2, true, 99, 12);
|
||||
itemStacks.set(2, ingredients.getOutputs(ItemStack.class).get(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(@Nonnull Minecraft minecraft) {
|
||||
GlStateManager.enableAlpha();
|
||||
GlStateManager.enableBlend();
|
||||
overlay.draw(minecraft, 48, 0);
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.disableAlpha();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getModName() {
|
||||
return LibMisc.MOD_NAME;
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* This class was created by <codewarrior0>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
* <p/>
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*/
|
||||
package vazkii.botania.client.integration.jei.orechid;
|
||||
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IDrawableStatic;
|
||||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.ingredients.VanillaTypes;
|
||||
import mezz.jei.api.recipe.IRecipeCategory;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class OrechidIgnemRecipeCategory implements IRecipeCategory<OrechidIgnemRecipeWrapper> {
|
||||
|
||||
public static final String UID = "botania.orechid_ignem";
|
||||
private final IDrawableStatic background;
|
||||
private final String localizedName;
|
||||
private final IDrawableStatic overlay;
|
||||
|
||||
public OrechidIgnemRecipeCategory(IGuiHelper guiHelper) {
|
||||
background = guiHelper.createBlankDrawable(168, 64);
|
||||
localizedName = I18n.format("botania.nei.orechidIgnem");
|
||||
overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/pureDaisyOverlay.png"),
|
||||
0, 0, 64, 46);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getUid() {
|
||||
return UID;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return localizedName;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IDrawable getBackground() {
|
||||
return background;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull OrechidIgnemRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
|
||||
final IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
|
||||
|
||||
itemStacks.init(0, true, 40, 12);
|
||||
itemStacks.set(0, ingredients.getInputs(VanillaTypes.ITEM).get(0));
|
||||
|
||||
itemStacks.init(1, true, 70, 12);
|
||||
itemStacks.set(1, ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_ORECHID_IGNEM));
|
||||
|
||||
itemStacks.init(2, true, 99, 12);
|
||||
itemStacks.set(2, ingredients.getOutputs(VanillaTypes.ITEM).get(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(@Nonnull Minecraft minecraft) {
|
||||
GlStateManager.enableAlpha();
|
||||
GlStateManager.enableBlend();
|
||||
overlay.draw(minecraft, 48, 0);
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.disableAlpha();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getModName() {
|
||||
return LibMisc.MOD_NAME;
|
||||
}
|
||||
|
||||
}
|
||||
+32
-32
@@ -1,32 +1,32 @@
|
||||
/**
|
||||
* This class was created by <codewarrior0>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
* <p/>
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*/
|
||||
package vazkii.botania.client.integration.jei.orechid;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class OrechidIgnemRecipeWrapper extends OrechidRecipeWrapper {
|
||||
|
||||
public OrechidIgnemRecipeWrapper(Map.Entry<String, Integer> entry) {
|
||||
super(entry);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ItemStack getInputStack() {
|
||||
return new ItemStack(Blocks.NETHERRACK, 64);
|
||||
}
|
||||
|
||||
public Map<String, Integer> getOreWeights() {
|
||||
return BotaniaAPI.oreWeightsNether;
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* This class was created by <codewarrior0>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
* <p/>
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*/
|
||||
package vazkii.botania.client.integration.jei.orechid;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class OrechidIgnemRecipeWrapper extends OrechidRecipeWrapper {
|
||||
|
||||
public OrechidIgnemRecipeWrapper(Map.Entry<String, Integer> entry) {
|
||||
super(entry);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ItemStack getInputStack() {
|
||||
return new ItemStack(Blocks.NETHERRACK, 64);
|
||||
}
|
||||
|
||||
public Map<String, Integer> getOreWeights() {
|
||||
return BotaniaAPI.oreWeightsNether;
|
||||
}
|
||||
|
||||
}
|
||||
+91
-92
@@ -1,92 +1,91 @@
|
||||
/**
|
||||
* This class was created by <codewarrior0>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
* <p/>
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*/
|
||||
package vazkii.botania.client.integration.jei.orechid;
|
||||
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IDrawableStatic;
|
||||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.IRecipeCategory;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class OrechidRecipeCategory implements IRecipeCategory {
|
||||
|
||||
public static final String UID = "botania.orechid";
|
||||
private final IDrawableStatic background;
|
||||
private final String localizedName;
|
||||
private final IDrawableStatic overlay;
|
||||
|
||||
public OrechidRecipeCategory(IGuiHelper guiHelper) {
|
||||
background = guiHelper.createBlankDrawable(168, 64);
|
||||
localizedName = I18n.format("botania.nei.orechid");
|
||||
overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/pureDaisyOverlay.png"),
|
||||
0, 0, 64, 46);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getUid() {
|
||||
return UID;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return localizedName;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IDrawable getBackground() {
|
||||
return background;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients) {
|
||||
final IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
|
||||
|
||||
itemStacks.init(0, true, 40, 12);
|
||||
itemStacks.set(0, ingredients.getInputs(ItemStack.class).get(0));
|
||||
|
||||
itemStacks.init(1, true, 70, 12);
|
||||
itemStacks.set(1, ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_ORECHID));
|
||||
|
||||
itemStacks.init(2, true, 99, 12);
|
||||
itemStacks.set(2, ingredients.getOutputs(ItemStack.class).get(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(@Nonnull Minecraft minecraft) {
|
||||
GlStateManager.enableAlpha();
|
||||
GlStateManager.enableBlend();
|
||||
overlay.draw(minecraft, 48, 0);
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.disableAlpha();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getModName() {
|
||||
return LibMisc.MOD_NAME;
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* This class was created by <codewarrior0>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
* <p/>
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*/
|
||||
package vazkii.botania.client.integration.jei.orechid;
|
||||
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IDrawableStatic;
|
||||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.ingredients.VanillaTypes;
|
||||
import mezz.jei.api.recipe.IRecipeCategory;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class OrechidRecipeCategory implements IRecipeCategory<OrechidRecipeWrapper> {
|
||||
|
||||
public static final String UID = "botania.orechid";
|
||||
private final IDrawableStatic background;
|
||||
private final String localizedName;
|
||||
private final IDrawableStatic overlay;
|
||||
|
||||
public OrechidRecipeCategory(IGuiHelper guiHelper) {
|
||||
background = guiHelper.createBlankDrawable(168, 64);
|
||||
localizedName = I18n.format("botania.nei.orechid");
|
||||
overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/pureDaisyOverlay.png"),
|
||||
0, 0, 64, 46);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getUid() {
|
||||
return UID;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return localizedName;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IDrawable getBackground() {
|
||||
return background;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull OrechidRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
|
||||
final IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
|
||||
|
||||
itemStacks.init(0, true, 40, 12);
|
||||
itemStacks.set(0, ingredients.getInputs(VanillaTypes.ITEM).get(0));
|
||||
|
||||
itemStacks.init(1, true, 70, 12);
|
||||
itemStacks.set(1, ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_ORECHID));
|
||||
|
||||
itemStacks.init(2, true, 99, 12);
|
||||
itemStacks.set(2, ingredients.getOutputs(VanillaTypes.ITEM).get(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(@Nonnull Minecraft minecraft) {
|
||||
GlStateManager.enableAlpha();
|
||||
GlStateManager.enableBlend();
|
||||
overlay.draw(minecraft, 48, 0);
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.disableAlpha();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getModName() {
|
||||
return LibMisc.MOD_NAME;
|
||||
}
|
||||
|
||||
}
|
||||
+75
-74
@@ -1,74 +1,75 @@
|
||||
/**
|
||||
* This class was created by <codewarrior0>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
* <p/>
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*/
|
||||
package vazkii.botania.client.integration.jei.orechid;
|
||||
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.ingredients.VanillaTypes;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static vazkii.botania.client.integration.jei.JEIBotaniaPlugin.doesOreExist;
|
||||
|
||||
public class OrechidRecipeWrapper implements IRecipeWrapper, Comparable<OrechidRecipeWrapper> {
|
||||
|
||||
private final int weight;
|
||||
private final List<List<ItemStack>> outputStacks;
|
||||
|
||||
protected ItemStack getInputStack() {
|
||||
return new ItemStack(Blocks.STONE, 64);
|
||||
}
|
||||
|
||||
public OrechidRecipeWrapper(Map.Entry<String, Integer> entry) {
|
||||
this.weight = entry.getValue();
|
||||
|
||||
final int amount = Math.max(1, Math.round((float) weight * 64 / getTotalOreWeight()));
|
||||
|
||||
// Shouldn't ever return an empty list since the ore weight
|
||||
// list is filtered to only have ores with ItemBlocks
|
||||
List<ItemStack> stackList = OreDictionary.getOres(entry.getKey()).stream()
|
||||
.filter(s -> s.getItem() instanceof ItemBlock)
|
||||
.map(ItemStack::copy)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
stackList.forEach(s -> s.setCount(amount));
|
||||
|
||||
outputStacks = Collections.singletonList(stackList);
|
||||
}
|
||||
|
||||
public Map<String, Integer> getOreWeights() {
|
||||
return BotaniaAPI.oreWeights;
|
||||
}
|
||||
|
||||
private float getTotalOreWeight() {
|
||||
return (getOreWeights().entrySet().stream()
|
||||
.filter(e -> doesOreExist(e.getKey()))
|
||||
.map(Map.Entry::getValue)
|
||||
.reduce(Integer::sum)).orElse(weight * 64 * 64);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getIngredients(IIngredients ingredients) {
|
||||
ingredients.setInput(VanillaTypes.ITEM, getInputStack());
|
||||
ingredients.setOutputLists(VanillaTypes.ITEM, outputStacks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(OrechidRecipeWrapper o) {
|
||||
return Integer.compare(o.weight, weight);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* This class was created by <codewarrior0>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
* <p/>
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*/
|
||||
package vazkii.botania.client.integration.jei.orechid;
|
||||
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.ingredients.VanillaTypes;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static vazkii.botania.client.integration.jei.JEIBotaniaPlugin.doesOreExist;
|
||||
|
||||
public class OrechidRecipeWrapper implements IRecipeWrapper, Comparable<OrechidRecipeWrapper> {
|
||||
|
||||
private final int weight;
|
||||
private final List<List<ItemStack>> outputStacks;
|
||||
|
||||
protected ItemStack getInputStack() {
|
||||
return new ItemStack(Blocks.STONE, 64);
|
||||
}
|
||||
|
||||
public OrechidRecipeWrapper(Map.Entry<String, Integer> entry) {
|
||||
this.weight = entry.getValue();
|
||||
|
||||
final int amount = Math.max(1, Math.round((float) weight * 64 / getTotalOreWeight()));
|
||||
|
||||
// Shouldn't ever return an empty list since the ore weight
|
||||
// list is filtered to only have ores with ItemBlocks
|
||||
List<ItemStack> stackList = OreDictionary.getOres(entry.getKey()).stream()
|
||||
.filter(s -> s.getItem() instanceof ItemBlock)
|
||||
.map(ItemStack::copy)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
stackList.forEach(s -> s.setCount(amount));
|
||||
|
||||
outputStacks = Collections.singletonList(stackList);
|
||||
}
|
||||
|
||||
public Map<String, Integer> getOreWeights() {
|
||||
return BotaniaAPI.oreWeights;
|
||||
}
|
||||
|
||||
private float getTotalOreWeight() {
|
||||
return (getOreWeights().entrySet().stream()
|
||||
.filter(e -> doesOreExist(e.getKey()))
|
||||
.map(Map.Entry::getValue)
|
||||
.reduce(Integer::sum)).orElse(weight * 64 * 64);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getIngredients(@Nonnull IIngredients ingredients) {
|
||||
ingredients.setInput(VanillaTypes.ITEM, getInputStack());
|
||||
ingredients.setOutputLists(VanillaTypes.ITEM, outputStacks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(@Nonnull OrechidRecipeWrapper o) {
|
||||
return Integer.compare(o.weight, weight);
|
||||
}
|
||||
}
|
||||
+6
-8
@@ -13,6 +13,7 @@ import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IDrawableStatic;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.ingredients.VanillaTypes;
|
||||
import mezz.jei.api.recipe.IRecipeCategory;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -29,7 +30,7 @@ import java.awt.Point;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PetalApothecaryRecipeCategory implements IRecipeCategory {
|
||||
public class PetalApothecaryRecipeCategory implements IRecipeCategory<PetalApothecaryRecipeWrapper> {
|
||||
|
||||
public static final String UID = "botania.petals";
|
||||
private final IDrawableStatic background;
|
||||
@@ -71,18 +72,15 @@ public class PetalApothecaryRecipeCategory implements IRecipeCategory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
|
||||
if(!(recipeWrapper instanceof PetalApothecaryRecipeWrapper))
|
||||
return;
|
||||
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull PetalApothecaryRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
|
||||
recipeLayout.getItemStacks().init(0, true, 64, 52);
|
||||
recipeLayout.getItemStacks().set(0, new ItemStack(ModBlocks.defaultAltar));
|
||||
|
||||
int index = 1;
|
||||
double angleBetweenEach = 360.0 / ingredients.getInputs(ItemStack.class).size();
|
||||
double angleBetweenEach = 360.0 / ingredients.getInputs(VanillaTypes.ITEM).size();
|
||||
Point point = new Point(64, 20), center = new Point(64, 52);
|
||||
|
||||
for(List<ItemStack> o : ingredients.getInputs(ItemStack.class)) {
|
||||
for(List<ItemStack> o : ingredients.getInputs(VanillaTypes.ITEM)) {
|
||||
recipeLayout.getItemStacks().init(index, true, point.x, point.y);
|
||||
recipeLayout.getItemStacks().set(index, o);
|
||||
index += 1;
|
||||
@@ -90,7 +88,7 @@ public class PetalApothecaryRecipeCategory implements IRecipeCategory {
|
||||
}
|
||||
|
||||
recipeLayout.getItemStacks().init(index, false, 103, 17);
|
||||
recipeLayout.getItemStacks().set(index, ingredients.getOutputs(ItemStack.class).get(0));
|
||||
recipeLayout.getItemStacks().set(index, ingredients.getOutputs(VanillaTypes.ITEM).get(0));
|
||||
}
|
||||
|
||||
private Point rotatePointAbout(Point in, Point about, double degrees) {
|
||||
|
||||
+3
-3
@@ -10,8 +10,8 @@ package vazkii.botania.client.integration.jei.petalapothecary;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.ingredients.VanillaTypes;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import vazkii.botania.api.recipe.RecipePetals;
|
||||
@@ -40,8 +40,8 @@ public class PetalApothecaryRecipeWrapper implements IRecipeWrapper {
|
||||
|
||||
@Override
|
||||
public void getIngredients(@Nonnull IIngredients ingredients) {
|
||||
ingredients.setInputLists(ItemStack.class, input);
|
||||
ingredients.setOutput(ItemStack.class, output);
|
||||
ingredients.setInputLists(VanillaTypes.ITEM, input);
|
||||
ingredients.setOutput(VanillaTypes.ITEM, output);
|
||||
}
|
||||
|
||||
}
|
||||
+9
-11
@@ -12,6 +12,7 @@ import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.ingredients.VanillaTypes;
|
||||
import mezz.jei.api.recipe.IRecipeCategory;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -29,7 +30,7 @@ import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PureDaisyRecipeCategory implements IRecipeCategory {
|
||||
public class PureDaisyRecipeCategory implements IRecipeCategory<PureDaisyRecipeWrapper> {
|
||||
|
||||
public static final String UID = "botania.pureDaisy";
|
||||
private final IDrawable background;
|
||||
@@ -71,19 +72,16 @@ public class PureDaisyRecipeCategory implements IRecipeCategory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
|
||||
if(!(recipeWrapper instanceof PureDaisyRecipeWrapper))
|
||||
return;
|
||||
|
||||
boolean inputFluid = !ingredients.getInputs(FluidStack.class).isEmpty();
|
||||
boolean outputFluid = !ingredients.getOutputs(FluidStack.class).isEmpty();
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull PureDaisyRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
|
||||
boolean inputFluid = !ingredients.getInputs(VanillaTypes.FLUID).isEmpty();
|
||||
boolean outputFluid = !ingredients.getOutputs(VanillaTypes.FLUID).isEmpty();
|
||||
|
||||
if(inputFluid) {
|
||||
recipeLayout.getFluidStacks().init(0, true, 40, 12, 16, 16, 1000, false, null);
|
||||
recipeLayout.getFluidStacks().set(0, ingredients.getInputs(FluidStack.class).get(0));
|
||||
recipeLayout.getFluidStacks().set(0, ingredients.getInputs(VanillaTypes.FLUID).get(0));
|
||||
} else {
|
||||
recipeLayout.getItemStacks().init(0, true, 40, 12);
|
||||
recipeLayout.getItemStacks().set(0, ingredients.getInputs(ItemStack.class).get(0));
|
||||
recipeLayout.getItemStacks().set(0, ingredients.getInputs(VanillaTypes.ITEM).get(0));
|
||||
}
|
||||
|
||||
recipeLayout.getItemStacks().init(1, true, 70, 12);
|
||||
@@ -91,10 +89,10 @@ public class PureDaisyRecipeCategory implements IRecipeCategory {
|
||||
|
||||
if(outputFluid) {
|
||||
recipeLayout.getFluidStacks().init(2, false, 99, 12, 16, 16, 1000, false, null);
|
||||
recipeLayout.getFluidStacks().set(2, ingredients.getOutputs(FluidStack.class).get(0));
|
||||
recipeLayout.getFluidStacks().set(2, ingredients.getOutputs(VanillaTypes.FLUID).get(0));
|
||||
} else {
|
||||
recipeLayout.getItemStacks().init(2, false, 99, 12);
|
||||
recipeLayout.getItemStacks().set(2, ingredients.getOutputs(ItemStack.class).get(0));
|
||||
recipeLayout.getItemStacks().set(2, ingredients.getOutputs(VanillaTypes.ITEM).get(0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
-4
@@ -10,6 +10,7 @@ package vazkii.botania.client.integration.jei.puredaisy;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.ingredients.VanillaTypes;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
@@ -54,18 +55,18 @@ public class PureDaisyRecipeWrapper implements IRecipeWrapper {
|
||||
|
||||
@Override
|
||||
public void getIngredients(@Nonnull IIngredients ingredients) {
|
||||
ingredients.setInputs(ItemStack.class, inputs);
|
||||
ingredients.setInputs(VanillaTypes.ITEM, inputs);
|
||||
|
||||
if (fluidInput != null) {
|
||||
ingredients.setInput(FluidStack.class, fluidInput);
|
||||
ingredients.setInput(VanillaTypes.FLUID, fluidInput);
|
||||
}
|
||||
|
||||
if (!output.isEmpty()) {
|
||||
ingredients.setOutput(ItemStack.class, output);
|
||||
ingredients.setOutput(VanillaTypes.ITEM, output);
|
||||
}
|
||||
|
||||
if (fluidOutput != null) {
|
||||
ingredients.setOutput(FluidStack.class, fluidOutput);
|
||||
ingredients.setOutput(VanillaTypes.FLUID, fluidOutput);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+7
-13
@@ -12,8 +12,8 @@ import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.ingredients.VanillaTypes;
|
||||
import mezz.jei.api.recipe.IRecipeCategory;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
@@ -23,12 +23,10 @@ import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.awt.Point;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RunicAltarRecipeCategory implements IRecipeCategory {
|
||||
public class RunicAltarRecipeCategory implements IRecipeCategory<RunicAltarRecipeWrapper> {
|
||||
|
||||
public static final String UID = "botania.runicAltar";
|
||||
private final IDrawable background;
|
||||
@@ -70,19 +68,15 @@ public class RunicAltarRecipeCategory implements IRecipeCategory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
|
||||
if(!(recipeWrapper instanceof RunicAltarRecipeWrapper))
|
||||
return;
|
||||
RunicAltarRecipeWrapper wrapper = (RunicAltarRecipeWrapper) recipeWrapper;
|
||||
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull RunicAltarRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
|
||||
recipeLayout.getItemStacks().init(0, true, 64, 52);
|
||||
recipeLayout.getItemStacks().set(0, new ItemStack(ModBlocks.runeAltar));
|
||||
|
||||
int index = 1;
|
||||
double angleBetweenEach = 360.0 / ingredients.getInputs(ItemStack.class).size();
|
||||
double angleBetweenEach = 360.0 / ingredients.getInputs(VanillaTypes.ITEM).size();
|
||||
Point point = new Point(64, 20), center = new Point(64, 52);
|
||||
|
||||
for(List<ItemStack> o : ingredients.getInputs(ItemStack.class)) {
|
||||
for(List<ItemStack> o : ingredients.getInputs(VanillaTypes.ITEM)) {
|
||||
recipeLayout.getItemStacks().init(index, true, point.x, point.y);
|
||||
recipeLayout.getItemStacks().set(index, o);
|
||||
index += 1;
|
||||
@@ -90,7 +84,7 @@ public class RunicAltarRecipeCategory implements IRecipeCategory {
|
||||
}
|
||||
|
||||
recipeLayout.getItemStacks().init(index, false, 103, 17);
|
||||
recipeLayout.getItemStacks().set(index, ingredients.getOutputs(ItemStack.class).get(0));
|
||||
recipeLayout.getItemStacks().set(index, ingredients.getOutputs(VanillaTypes.ITEM).get(0));
|
||||
|
||||
}
|
||||
|
||||
@@ -106,5 +100,5 @@ public class RunicAltarRecipeCategory implements IRecipeCategory {
|
||||
public String getModName() {
|
||||
return LibMisc.MOD_NAME;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+3
-3
@@ -10,6 +10,7 @@ package vazkii.botania.client.integration.jei.runicaltar;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.ingredients.VanillaTypes;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
@@ -28,7 +29,6 @@ public class RunicAltarRecipeWrapper implements IRecipeWrapper {
|
||||
private final ItemStack output;
|
||||
private final int manaUsage;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public RunicAltarRecipeWrapper(RecipeRuneAltar recipe) {
|
||||
ImmutableList.Builder<List<ItemStack>> builder = ImmutableList.builder();
|
||||
for(Object o : recipe.getInputs()) {
|
||||
@@ -46,8 +46,8 @@ public class RunicAltarRecipeWrapper implements IRecipeWrapper {
|
||||
|
||||
@Override
|
||||
public void getIngredients(@Nonnull IIngredients ingredients) {
|
||||
ingredients.setInputLists(ItemStack.class, input);
|
||||
ingredients.setOutput(ItemStack.class, output);
|
||||
ingredients.setInputLists(VanillaTypes.ITEM, input);
|
||||
ingredients.setOutput(VanillaTypes.ITEM, output);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -108,6 +108,11 @@ public class FloatingFlowerModel implements IBakedModel {
|
||||
private CompositeBakedModel getModel(IFloatingFlower.IslandType islandType, ResourceLocation identifier) {
|
||||
ModelManager modelManager = Minecraft.getInstance().getItemRenderer().getItemModelMesher().getModelManager();
|
||||
|
||||
if(islandType == null) // This and the next one can be null if obtained from a non-extended state
|
||||
islandType = IFloatingFlower.IslandType.GRASS;
|
||||
if(identifier == null)
|
||||
identifier = "";
|
||||
|
||||
if(CACHE.contains(islandType, identifier)) {
|
||||
return CACHE.get(islandType, identifier);
|
||||
} else {
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
package vazkii.botania.common.block;
|
||||
|
||||
import net.minecraft.block.BlockStem;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
@@ -17,10 +18,12 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Particles;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemHoe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IItemProvider;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
@@ -65,7 +68,19 @@ public class BlockAltGrass extends BlockMod implements ILexiconable {
|
||||
public boolean isToolEffective(IBlockState state, ToolType tool) {
|
||||
return tool.equals(ToolType.SHOVEL);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
ItemStack held = player.getHeldItem(hand);
|
||||
if(held.getItem() instanceof ItemHoe && world.isAirBlock(pos.up())) {
|
||||
held.damageItem(1, player);
|
||||
world.setBlockState(pos, Blocks.FARMLAND.getDefaultState(), 1 | 2);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick(IBlockState state, World world, BlockPos pos, Random rand) {
|
||||
if(!world.isRemote && state.getBlock() == this && world.getLight(pos.up()) >= 9) {
|
||||
@@ -89,7 +104,7 @@ public class BlockAltGrass extends BlockMod implements ILexiconable {
|
||||
@Override
|
||||
public boolean canSustainPlant(@Nonnull IBlockState state, @Nonnull IBlockReader world, BlockPos pos, @Nonnull EnumFacing direction, IPlantable plantable) {
|
||||
EnumPlantType type = plantable.getPlantType(world, pos.down());
|
||||
return type == EnumPlantType.Plains || type == EnumPlantType.Beach;
|
||||
return type == EnumPlantType.Plains || type == EnumPlantType.Beach || plantable instanceof BlockStem;
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
|
||||
@@ -35,6 +35,7 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
import vazkii.botania.api.internal.IManaBurst;
|
||||
import vazkii.botania.api.internal.VanillaPacketDispatcher;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.mana.IManaTrigger;
|
||||
@@ -164,7 +165,9 @@ public class BlockHourglass extends BlockMod implements IManaTrigger, IWandable,
|
||||
public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, BlockPos pos, EnumFacing side) {
|
||||
TileHourglass tile = (TileHourglass) world.getTileEntity(pos);
|
||||
tile.lock = !tile.lock;
|
||||
return false;
|
||||
if(!world.isRemote)
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(tile);
|
||||
return true;
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
|
||||
@@ -26,9 +26,8 @@ import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.IWorldReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import thaumcraft.api.crafting.IInfusionStabiliser;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.client.core.handler.ModelHandler;
|
||||
@@ -54,6 +53,7 @@ public class BlockPylon extends BlockMod implements ILexiconable, IInfusionStabi
|
||||
public BlockPylon(Variant v, Properties builder) {
|
||||
super(builder);
|
||||
this.variant = v;
|
||||
BotaniaAPI.blacklistBlockFromGaiaGuardian(this);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
package vazkii.botania.common.block.corporea;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import javax.annotation.Nonnull;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
@@ -26,6 +27,7 @@ import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
import net.minecraftforge.common.property.ExtendedBlockState;
|
||||
@@ -33,17 +35,18 @@ import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
import net.minecraftforge.common.property.Properties;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import vazkii.botania.api.internal.VanillaPacketDispatcher;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.wand.IWandable;
|
||||
import vazkii.botania.client.core.handler.ModelHandler;
|
||||
import vazkii.botania.common.block.tile.corporea.TileCorporeaBase;
|
||||
import vazkii.botania.common.block.tile.corporea.TileCorporeaCrystalCube;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.lexicon.LexiconData;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class BlockCorporeaCrystalCube extends BlockCorporeaBase implements ILexiconable {
|
||||
public class BlockCorporeaCrystalCube extends BlockCorporeaBase implements ILexiconable, IWandable {
|
||||
|
||||
private static final AxisAlignedBB AABB = new AxisAlignedBB(3.0/16, 0, 3.0/16, 13.0/16, 1, 13.0/16);
|
||||
|
||||
@@ -82,8 +85,26 @@ public class BlockCorporeaCrystalCube extends BlockCorporeaBase implements ILexi
|
||||
public boolean onBlockActivated(IBlockState state, World world, BlockPos pos, EntityPlayer player, EnumHand hand, EnumFacing s, float xs, float ys, float zs) {
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
if(!stack.isEmpty()) {
|
||||
if(stack.getItem() == ModItems.twigWand && player.isSneaking())
|
||||
return false;
|
||||
TileCorporeaCrystalCube cube = (TileCorporeaCrystalCube) world.getTileEntity(pos);
|
||||
cube.setRequestTarget(stack);
|
||||
if(cube.locked) {
|
||||
if(!world.isRemote)
|
||||
player.sendStatusMessage(new TextComponentTranslation("botaniamisc.crystalCubeLocked"), false);
|
||||
} else
|
||||
cube.setRequestTarget(stack);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, BlockPos pos, EnumFacing side) {
|
||||
if(player == null || player.isSneaking()) {
|
||||
TileCorporeaCrystalCube cube = (TileCorporeaCrystalCube) world.getTileEntity(pos);
|
||||
cube.locked = !cube.locked;
|
||||
if(!world.isRemote)
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(cube);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -127,5 +148,4 @@ public class BlockCorporeaCrystalCube extends BlockCorporeaBase implements ILexi
|
||||
ModelHandler.registerInventoryVariant(this);
|
||||
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(this), 0, TileCorporeaCrystalCube.class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -92,13 +92,9 @@ public class BlockPrism extends BlockMod implements IManaTrigger, ILexiconable,
|
||||
player.setHeldItem(hand, ItemStack.EMPTY);
|
||||
|
||||
prism.getItemHandler().setStackInSlot(0, heldItem.copy());
|
||||
prism.markDirty();
|
||||
world.setBlockState(pos, state.with(BotaniaStateProps.HAS_LENS, true), 1 | 2);
|
||||
} else if(!lens.isEmpty()) {
|
||||
ItemHandlerHelper.giveItemToPlayer(player, lens);
|
||||
prism.getItemHandler().setStackInSlot(0, ItemStack.EMPTY);
|
||||
prism.markDirty();
|
||||
world.setBlockState(pos, state.with(BotaniaStateProps.HAS_LENS, false), 1 | 2);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -140,7 +136,7 @@ public class BlockPrism extends BlockMod implements IManaTrigger, ILexiconable,
|
||||
@Override
|
||||
public void onBurstCollision(IManaBurst burst, World world, BlockPos pos) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if(tile != null && tile instanceof TilePrism)
|
||||
if(tile instanceof TilePrism)
|
||||
((TilePrism) tile).onBurstCollision(burst);
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ public class SubTileHopperhock extends SubTileFunctional {
|
||||
for(EnumFacing dir : EnumFacing.BY_INDEX) {
|
||||
BlockPos pos_ = pos.offset(dir);
|
||||
|
||||
InvWithLocation inv = InventoryHelper.getInventoryWithLocation(supertile.getWorld(), pos_, dir);
|
||||
InvWithLocation inv = InventoryHelper.getInventoryWithLocation(supertile.getWorld(), pos_, dir.getOpposite());
|
||||
if(inv != null) {
|
||||
List<ItemStack> filter = getFilterForInventory(pos_, true);
|
||||
boolean canAccept = canAcceptItem(stack, filter, filterType);
|
||||
|
||||
+27
-14
@@ -11,10 +11,13 @@
|
||||
package vazkii.botania.common.block.subtile.functional;
|
||||
|
||||
import net.minecraft.entity.monster.EntityEnderman;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.living.EnderTeleportEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.subtile.RadiusDescriptor;
|
||||
import vazkii.botania.api.subtile.SubTileFunctional;
|
||||
@@ -25,21 +28,26 @@ import vazkii.botania.common.lib.LibMisc;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID)
|
||||
public class SubTileVinculotus extends SubTileFunctional {
|
||||
|
||||
public static final Set<SubTileVinculotus> existingFlowers = Collections.newSetFromMap(new WeakHashMap<>());
|
||||
// Must store position since red string spoofers are only active during onUpdate
|
||||
// But our main logic runs outside, in the event handler
|
||||
public static final Map<SubTileVinculotus, BlockPos> existingFlowers = new WeakHashMap<>();
|
||||
private static final int RANGE = 64;
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
|
||||
if(!supertile.getWorld().isRemote && !existingFlowers.contains(this)) {
|
||||
existingFlowers.add(this);
|
||||
if(!supertile.getWorld().isRemote) {
|
||||
BlockPos pos = existingFlowers.get(this);
|
||||
if (pos == null || !pos.equals(getPos()))
|
||||
existingFlowers.put(this, getPos());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,25 +81,30 @@ public class SubTileVinculotus extends SubTileFunctional {
|
||||
int cost = 50;
|
||||
|
||||
if(event.getEntityLiving() instanceof EntityEnderman) {
|
||||
List<SubTileVinculotus> possibleFlowers = new ArrayList<>();
|
||||
for(SubTileVinculotus flower : existingFlowers) {
|
||||
if(flower.redstoneSignal > 0 || flower.mana <= cost || flower.supertile.getWorld() != event.getEntityLiving().world || flower.supertile.getWorld().getTileEntity(flower.supertile.getPos()) != flower.supertile)
|
||||
List<Pair<SubTileVinculotus, BlockPos>> possibleFlowers = new ArrayList<>();
|
||||
for(Map.Entry<SubTileVinculotus, BlockPos> e : existingFlowers.entrySet()) {
|
||||
SubTileVinculotus flower = e.getKey();
|
||||
BlockPos activePos = e.getValue();
|
||||
|
||||
if(flower == null || flower.redstoneSignal > 0 || flower.mana <= cost || flower.supertile.getWorld() != event.getEntityLiving().world || flower.supertile.getWorld().getTileEntity(flower.supertile.getPos()) != flower.supertile)
|
||||
continue;
|
||||
|
||||
double x = flower.supertile.getPos().getX() + 0.5;
|
||||
double y = flower.supertile.getPos().getY() + 1.5;
|
||||
double z = flower.supertile.getPos().getZ() + 0.5;
|
||||
double x = activePos.getX() + 0.5;
|
||||
double y = activePos.getY() + 1.5;
|
||||
double z = activePos.getZ() + 0.5;
|
||||
|
||||
if(MathHelper.pointDistanceSpace(x, y, z, event.getTargetX(), event.getTargetY(), event.getTargetZ()) < RANGE)
|
||||
possibleFlowers.add(flower);
|
||||
possibleFlowers.add(ImmutablePair.of(flower, activePos));
|
||||
}
|
||||
|
||||
if(!possibleFlowers.isEmpty()) {
|
||||
SubTileVinculotus flower = possibleFlowers.get(event.getEntityLiving().world.rand.nextInt(possibleFlowers.size()));
|
||||
Pair<SubTileVinculotus, BlockPos> p = possibleFlowers.get(event.getEntityLiving().world.rand.nextInt(possibleFlowers.size()));
|
||||
SubTileVinculotus flower = p.getLeft();
|
||||
BlockPos activePos = p.getRight();
|
||||
|
||||
double x = flower.supertile.getPos().getX() + 0.5;
|
||||
double y = flower.supertile.getPos().getY() + 1.5;
|
||||
double z = flower.supertile.getPos().getZ() + 0.5;
|
||||
double x = activePos.getX() + 0.5;
|
||||
double y = activePos.getY() + 1.5;
|
||||
double z = activePos.getZ() + 0.5;
|
||||
|
||||
event.setTargetX(x + Math.random() * 3 - 1);
|
||||
event.setTargetY(y);
|
||||
|
||||
@@ -114,7 +114,9 @@ public class TileCraftCrate extends TileOpenCrate {
|
||||
|
||||
List<ItemStack> remainders = recipe.getRemainingItems(craft);
|
||||
for(int i = 0; i < craft.getSizeInventory(); i++) {
|
||||
itemHandler.setStackInSlot(i, remainders.get(i));
|
||||
ItemStack s = remainders.get(i);
|
||||
if(!s.isEmpty())
|
||||
itemHandler.setStackInSlot(i, s);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraftforge.registries.ObjectHolder;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||
import vazkii.botania.api.item.IFloatingFlower;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
@@ -28,7 +30,7 @@ public class TileFloatingFlower extends TileMod implements IFloatingFlower {
|
||||
private static final String TAG_ISLAND_TYPE = "islandType";
|
||||
public static ItemStack forcedStack = ItemStack.EMPTY;
|
||||
|
||||
IslandType type = IslandType.GRASS;
|
||||
private IslandType type = IslandType.GRASS;
|
||||
|
||||
public TileFloatingFlower() {
|
||||
super(TYPE);
|
||||
@@ -44,6 +46,15 @@ public class TileFloatingFlower extends TileMod implements IFloatingFlower {
|
||||
return new ItemStack(getBlockState().getBlock());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet) {
|
||||
IslandType oldType = getIslandType();
|
||||
super.onDataPacket(net, packet);
|
||||
if(oldType != getIslandType()) {
|
||||
world.markBlockRangeForRenderUpdate(pos, pos);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IslandType getIslandType() {
|
||||
return type;
|
||||
|
||||
@@ -12,13 +12,15 @@ package vazkii.botania.common.block.tile;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||
import vazkii.botania.api.item.IFloatingFlower;
|
||||
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
|
||||
|
||||
public class TileFloatingSpecialFlower extends TileSpecialFlower implements IFloatingFlower {
|
||||
|
||||
public static final String TAG_ISLAND_TYPE = "islandType";
|
||||
IslandType type = IslandType.GRASS;
|
||||
private IslandType type = IslandType.GRASS;
|
||||
|
||||
@Override
|
||||
public boolean isOnSpecialSoil() {
|
||||
@@ -46,6 +48,15 @@ public class TileFloatingSpecialFlower extends TileSpecialFlower implements IFlo
|
||||
cmp.setString(TAG_ISLAND_TYPE, type.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet) {
|
||||
IslandType oldType = getIslandType();
|
||||
super.onDataPacket(net, packet);
|
||||
if(oldType != getIslandType()) {
|
||||
world.markBlockRangeForRenderUpdate(pos, pos);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readPacketNBT(NBTTagCompound cmp) {
|
||||
super.readPacketNBT(cmp);
|
||||
|
||||
+5
-3
@@ -41,13 +41,13 @@ public class TileCorporeaCrystalCube extends TileCorporeaBase implements ICorpor
|
||||
public static TileEntityType<TileCorporeaCrystalCube> TYPE;
|
||||
private static final String TAG_REQUEST_TARGET = "requestTarget";
|
||||
private static final String TAG_ITEM_COUNT = "itemCount";
|
||||
|
||||
private static final double LOG_2 = Math.log(2);
|
||||
private static final String TAG_LOCK = "lock";
|
||||
|
||||
private ItemStack requestTarget = ItemStack.EMPTY;
|
||||
private int itemCount = 0;
|
||||
private int ticks = 0;
|
||||
private int compValue = 0;
|
||||
public boolean locked = false;
|
||||
|
||||
private final IAnimationStateMachine asm;
|
||||
private final LazyOptional<IAnimationStateMachine> asmCap;
|
||||
@@ -71,7 +71,7 @@ public class TileCorporeaCrystalCube extends TileCorporeaBase implements ICorpor
|
||||
}
|
||||
|
||||
public void setRequestTarget(ItemStack stack) {
|
||||
if(!stack.isEmpty()) {
|
||||
if(!stack.isEmpty() && !locked) {
|
||||
ItemStack copy = stack.copy();
|
||||
copy.setCount(1);
|
||||
requestTarget = copy;
|
||||
@@ -135,6 +135,7 @@ public class TileCorporeaCrystalCube extends TileCorporeaBase implements ICorpor
|
||||
cmp = requestTarget.write(cmp);
|
||||
par1nbtTagCompound.put(TAG_REQUEST_TARGET, cmp);
|
||||
par1nbtTagCompound.putInt(TAG_ITEM_COUNT, itemCount);
|
||||
par1nbtTagCompound.putBoolean(TAG_LOCK, locked);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -143,6 +144,7 @@ public class TileCorporeaCrystalCube extends TileCorporeaBase implements ICorpor
|
||||
NBTTagCompound cmp = par1nbtTagCompound.getCompound(TAG_REQUEST_TARGET);
|
||||
requestTarget = ItemStack.read(cmp);
|
||||
itemCount = par1nbtTagCompound.getInt(TAG_ITEM_COUNT);
|
||||
locked = par1nbtTagCompound.getBoolean(TAG_LOCK);
|
||||
}
|
||||
|
||||
public int getComparatorValue() {
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
package vazkii.botania.common.block.tile.mana;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
@@ -20,6 +21,7 @@ import vazkii.botania.api.mana.BurstProperties;
|
||||
import vazkii.botania.api.mana.ILens;
|
||||
import vazkii.botania.api.mana.ITinyPlanetExcempt;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.tile.TileSimpleInventory;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
@@ -82,6 +84,14 @@ public class TilePrism extends TileSimpleInventory {
|
||||
public void markDirty() {
|
||||
super.markDirty();
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this);
|
||||
if(world != null && !world.isRemote) {
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
boolean hasLens = !itemHandler.getStackInSlot(0).isEmpty();
|
||||
if (state.getBlock() != ModBlocks.prism || state.getValue(BotaniaStateProps.HAS_LENS) != hasLens) {
|
||||
IBlockState base = state.getBlock() == ModBlocks.prism ? state : ModBlocks.prism.getDefaultState();
|
||||
world.setBlockState(pos, base.withProperty(BotaniaStateProps.HAS_LENS, hasLens));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,9 +17,11 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.registries.ObjectHolder;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
import net.minecraftforge.items.wrapper.EmptyHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Arrays;
|
||||
@@ -27,6 +29,7 @@ import java.util.Arrays;
|
||||
public class TileRedStringContainer extends TileRedString {
|
||||
@ObjectHolder(LibMisc.MOD_ID + ":" + LibBlockNames.RED_STRING_CONTAINER)
|
||||
public static TileEntityType<TileRedStringContainer> TYPE;
|
||||
private static final LazyOptional<IItemHandler> EMPTY = LazyOptional.of(EmptyHandler::new);
|
||||
|
||||
public TileRedStringContainer() {
|
||||
this(TYPE);
|
||||
@@ -40,7 +43,7 @@ public class TileRedStringContainer extends TileRedString {
|
||||
public boolean acceptBlock(BlockPos pos) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
return tile != null
|
||||
&& Arrays.stream(EnumFacing.BY_INDEX)
|
||||
&& Arrays.stream(EnumFacing.values())
|
||||
.anyMatch(e -> tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, e).isPresent());
|
||||
}
|
||||
|
||||
@@ -48,9 +51,12 @@ public class TileRedStringContainer extends TileRedString {
|
||||
@Override
|
||||
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, EnumFacing side) {
|
||||
// todo 1.13 need to invalidate when binding breaks
|
||||
if(cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY
|
||||
&& getTileAtBinding() != null)
|
||||
return getTileAtBinding().getCapability(cap, side);
|
||||
if(cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
|
||||
if(getTileAtBinding() != null) {
|
||||
return getTileAtBinding().getCapability(cap, side);
|
||||
}
|
||||
return EMPTY.cast();
|
||||
}
|
||||
return super.getCapability(cap, side);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package vazkii.botania.common.core.handler;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.entity.player.PlayerSleepInBedEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import vazkii.botania.common.entity.EntityDoppleganger;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID)
|
||||
public final class SleepingHandler {
|
||||
|
||||
private SleepingHandler() {}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void trySleep(PlayerSleepInBedEvent event) {
|
||||
World world = event.getEntityPlayer().world;
|
||||
for(EntityDoppleganger guardian : world.getEntities(EntityDoppleganger.class, e -> true)) {
|
||||
if(guardian.getPlayersAround().contains(event.getEntityPlayer())) {
|
||||
event.setResult(EntityPlayer.SleepResult.NOT_SAFE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,9 +14,12 @@
|
||||
package vazkii.botania.common.core.helper;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public final class ItemNBTHelper {
|
||||
|
||||
private static final int[] EMPTY_INT_ARRAY = new int[0];
|
||||
@@ -124,4 +127,36 @@ public final class ItemNBTHelper {
|
||||
return verifyExistance(stack, tag) ? stack.getOrCreateTag().getList(tag, objtype) : nullifyOnFail ? null : new NBTTagList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that one tag is a subset of another - that is, it's ok if the superset has more NBT keys than the subset, but the subset has to have at least all the same keys as the superset, and the values of the keys that *are* shared between the two must match.
|
||||
*
|
||||
* This is useful when, e.g. matching NBT tags in recipes.
|
||||
*/
|
||||
public static boolean isTagSubset(@Nullable NBTTagCompound subset, @Nullable NBTTagCompound superset) {
|
||||
//an empty set is a subset of everything
|
||||
if(subset == null || subset.isEmpty()) return true;
|
||||
//an empty set is a superset of only another empty set (which was already checked above)
|
||||
if(superset == null || superset.isEmpty()) return false;
|
||||
//a subset can't be bigger than its superset
|
||||
if(subset.getKeySet().size() > superset.getKeySet().size()) return false;
|
||||
|
||||
//it's not an easy case, so we actually have to check the contents of each tag
|
||||
for(String key : superset.getKeySet()) {
|
||||
//it's ok if the subset is missing a key from the superset
|
||||
if(!subset.hasKey(key)) continue;
|
||||
|
||||
NBTBase supersetEntry = superset.getTag(key);
|
||||
NBTBase subsetEntry = subset.getTag(key);
|
||||
|
||||
//if a value is present on both tags, but they do not match, fail
|
||||
if(supersetEntry instanceof NBTTagCompound && subsetEntry instanceof NBTTagCompound) {
|
||||
//recurse into tag compounds (this properly compares nested tag compounds)
|
||||
if(!isTagSubset((NBTTagCompound) subsetEntry, (NBTTagCompound) supersetEntry)) return false;
|
||||
} else {
|
||||
if(!supersetEntry.equals(subsetEntry)) return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -54,7 +54,7 @@ public class SpellClothRecipe extends IForgeRegistryEntry.Impl<IRecipe> implemen
|
||||
ItemStack stackToDisenchant = ItemStack.EMPTY;
|
||||
for(int i = 0; i < var1.getSizeInventory(); i++) {
|
||||
ItemStack stack = var1.getStackInSlot(i);
|
||||
if(!stack.isEmpty() && stack.isItemEnchanted()) {
|
||||
if(!stack.isEmpty() && stack.isItemEnchanted() && stack.getItem() != ModItems.spellCloth) {
|
||||
stackToDisenchant = stack.copy();
|
||||
stackToDisenchant.setCount(1);
|
||||
break;
|
||||
|
||||
@@ -40,6 +40,7 @@ import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.tileentity.TileEntityBeacon;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
@@ -65,6 +66,7 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.registries.ObjectHolder;
|
||||
import org.lwjgl.opengl.ARBShaderObjects;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.boss.IBotaniaBoss;
|
||||
import vazkii.botania.api.internal.ShaderCallback;
|
||||
import vazkii.botania.api.lexicon.multiblock.Multiblock;
|
||||
@@ -89,8 +91,10 @@ import javax.annotation.Nullable;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -100,6 +104,8 @@ public class EntityDoppleganger extends EntityLiving implements IBotaniaBoss, IE
|
||||
public static EntityType<?> TYPE;
|
||||
|
||||
public static final float ARENA_RANGE = 12F;
|
||||
public static final int ARENA_HEIGHT = 5;
|
||||
|
||||
private static final int SPAWN_TICKS = 160;
|
||||
private static final float MAX_HP = 320F;
|
||||
|
||||
@@ -129,8 +135,8 @@ public class EntityDoppleganger extends EntityLiving implements IBotaniaBoss, IE
|
||||
};
|
||||
|
||||
private static final List<ResourceLocation> CHEATY_BLOCKS = Arrays.asList(
|
||||
new ResourceLocation("openblocks", "beartrap"),
|
||||
new ResourceLocation("thaumictinkerer", "magnet")
|
||||
new ResourceLocation("openblocks", "beartrap"),
|
||||
new ResourceLocation("thaumictinkerer", "magnet")
|
||||
);
|
||||
|
||||
private boolean spawnLandmines = false;
|
||||
@@ -174,43 +180,53 @@ public class EntityDoppleganger extends EntityLiving implements IBotaniaBoss, IE
|
||||
}
|
||||
|
||||
public static boolean spawn(EntityPlayer player, ItemStack stack, World world, BlockPos pos, boolean hard) {
|
||||
if(world.getTileEntity(pos) instanceof TileEntityBeacon && isTruePlayer(player)) {
|
||||
if(world.getDifficulty() == EnumDifficulty.PEACEFUL) {
|
||||
//initial checks
|
||||
if(
|
||||
!(world.getTileEntity(pos) instanceof TileEntityBeacon) ||
|
||||
!isTruePlayer(player) ||
|
||||
countGaiaGuardiansAround(world, pos) > 0
|
||||
)
|
||||
return false;
|
||||
|
||||
//check difficulty
|
||||
if(world.getDifficulty() == EnumDifficulty.PEACEFUL) {
|
||||
if(!world.isRemote)
|
||||
player.sendMessage(new TextComponentTranslation("botaniamisc.peacefulNoob").setStyle(new Style().setColor(TextFormatting.RED)));
|
||||
return false;
|
||||
}
|
||||
|
||||
//check pylons
|
||||
for(BlockPos coords : PYLON_LOCATIONS) {
|
||||
BlockPos pos_ = pos.add(coords);
|
||||
|
||||
IBlockState state = world.getBlockState(pos_);
|
||||
if(state.getBlock() != ModBlocks.gaiaPylon) {
|
||||
if(!world.isRemote)
|
||||
player.sendMessage(new TextComponentTranslation("botaniamisc.peacefulNoob").setStyle(new Style().setColor(TextFormatting.RED)));
|
||||
player.sendMessage(new TextComponentTranslation("botaniamisc.needsCatalysts").setStyle(new Style().setColor(TextFormatting.RED)));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for(BlockPos coords : PYLON_LOCATIONS) {
|
||||
BlockPos pos_ = pos.add(coords);
|
||||
//check arena shape
|
||||
List<BlockPos> invalidArenaBlocks = checkArena(world, pos);
|
||||
if(!invalidArenaBlocks.isEmpty()) {
|
||||
if(world.isRemote) {
|
||||
Botania.proxy.setWispFXDepthTest(false);
|
||||
for(BlockPos pos_ : invalidArenaBlocks)
|
||||
Botania.proxy.wispFX(pos_.getX() + 0.5, pos_.getY() + 0.5, pos_.getZ() + 0.5, 1F, 0.2F, 0.2F, 0.5F, 0F, 8);
|
||||
Botania.proxy.setWispFXDepthTest(true);
|
||||
} else {
|
||||
PacketHandler.sendTo((EntityPlayerMP) player,
|
||||
new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.ARENA_INDICATOR, pos.getX(), pos.getY(), pos.getZ()));
|
||||
|
||||
IBlockState state = world.getBlockState(pos_);
|
||||
Block blockat = state.getBlock();
|
||||
if(blockat != ModBlocks.gaiaPylon) {
|
||||
if(!world.isRemote)
|
||||
player.sendMessage(new TextComponentTranslation("botaniamisc.needsCatalysts").setStyle(new Style().setColor(TextFormatting.RED)));
|
||||
return false;
|
||||
}
|
||||
player.sendMessage(new TextComponentTranslation("botaniamisc.badArena").setStyle(new Style().setColor(TextFormatting.RED)));
|
||||
}
|
||||
|
||||
if(!hasProperArena(world, pos)) {
|
||||
if(!world.isRemote) {
|
||||
PacketHandler.sendTo((EntityPlayerMP) player,
|
||||
new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.ARENA_INDICATOR, pos.getX(), pos.getY(), pos.getZ()));
|
||||
|
||||
player.sendMessage(new TextComponentTranslation("botaniamisc.badArena").setStyle(new Style().setColor(TextFormatting.RED)));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int guardians = getGaiaGuardiansAround(world, pos);
|
||||
if(guardians > 0)
|
||||
return false;
|
||||
|
||||
if(world.isRemote)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
//all checks ok, spawn the boss
|
||||
if(!world.isRemote) {
|
||||
stack.shrink(1);
|
||||
|
||||
EntityDoppleganger e = new EntityDoppleganger(world);
|
||||
@@ -221,72 +237,46 @@ public class EntityDoppleganger extends EntityLiving implements IBotaniaBoss, IE
|
||||
e.mobSpawnTicks = MOB_SPAWN_TICKS;
|
||||
e.hardMode = hard;
|
||||
|
||||
int playerCount = (int) e.getPlayersAround().stream().filter(EntityDoppleganger::isTruePlayer).count();
|
||||
int playerCount = e.getPlayersAround().size();
|
||||
e.playerCount = playerCount;
|
||||
e.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(MAX_HP * playerCount);
|
||||
if (hard)
|
||||
if(hard)
|
||||
e.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.ARMOR).setBaseValue(15);
|
||||
|
||||
e.playSound(SoundEvents.ENTITY_ENDER_DRAGON_GROWL, 10F, 0.1F);
|
||||
e.onInitialSpawn(world.getDifficultyForLocation(new BlockPos(e)), null, null);
|
||||
world.spawnEntity(e);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean hasProperArena(World world, BlockPos startPos) {
|
||||
private static List<BlockPos> checkArena(World world, BlockPos beaconPos) {
|
||||
List<BlockPos> trippedPositions = new ArrayList<>();
|
||||
boolean tripped = false;
|
||||
|
||||
int heightCheck = 3;
|
||||
int heightMin = 2;
|
||||
int range = (int) Math.ceil(ARENA_RANGE);
|
||||
for(int i = -range; i < range + 1; i++)
|
||||
for(int j = -range; j < range + 1; j++) {
|
||||
if(Math.abs(i) == 4 && Math.abs(j) == 4 || vazkii.botania.common.core.helper.MathHelper.pointDistancePlane(i, j, 0, 0) > ARENA_RANGE)
|
||||
BlockPos pos;
|
||||
|
||||
for(int x = -range; x <= range; x++)
|
||||
for(int z = -range; z <= range; z++) {
|
||||
if(Math.abs(x) == 4 && Math.abs(z) == 4 || vazkii.botania.common.core.helper.MathHelper.pointDistancePlane(x, z, 0, 0) > ARENA_RANGE)
|
||||
continue; // Ignore pylons and out of circle
|
||||
|
||||
int air = 0;
|
||||
for(int y = -1; y <= ARENA_HEIGHT; y++) {
|
||||
if(x == 0 && y == 0 && z == 0)
|
||||
continue; //this is the beacon
|
||||
|
||||
yCheck: {
|
||||
BlockPos pos = null;
|
||||
int trippedColumn = 0;
|
||||
pos = beaconPos.add(x, y, z);
|
||||
|
||||
for(int k = heightCheck + heightMin; k >= -heightCheck; k--) {
|
||||
pos = startPos.add(i, k, j);
|
||||
boolean isAir = world.getBlockState(pos).getCollisionBoundingBox(world, pos) == null;
|
||||
if(isAir)
|
||||
air++;
|
||||
else {
|
||||
if(air >= 2)
|
||||
break yCheck;
|
||||
else if(trippedColumn < 2) {
|
||||
trippedPositions.add(pos);
|
||||
trippedColumn++;
|
||||
}
|
||||
air = 0;
|
||||
}
|
||||
}
|
||||
boolean expectedBlockHere = y == -1; //the floor
|
||||
boolean isBlockHere = world.getBlockState(pos).getCollisionBoundingBox(world, pos) != null;
|
||||
|
||||
if(trippedColumn == 0)
|
||||
if(expectedBlockHere != isBlockHere) {
|
||||
trippedPositions.add(pos);
|
||||
|
||||
tripped = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(tripped) {
|
||||
Botania.proxy.setWispFXDepthTest(false);
|
||||
for(BlockPos pos : trippedPositions)
|
||||
Botania.proxy.wispFX(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 1F, 0.2F, 0.2F, 0.5F, 0F, 8);
|
||||
Botania.proxy.setWispFXDepthTest(true);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return trippedPositions;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -314,35 +304,35 @@ public class EntityDoppleganger extends EntityLiving implements IBotaniaBoss, IE
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeAdditional(NBTTagCompound par1nbtTagCompound) {
|
||||
super.writeAdditional(par1nbtTagCompound);
|
||||
par1nbtTagCompound.setInt(TAG_INVUL_TIME, getInvulTime());
|
||||
par1nbtTagCompound.setBoolean(TAG_AGGRO, aggro);
|
||||
par1nbtTagCompound.setInt(TAG_MOB_SPAWN_TICKS, mobSpawnTicks);
|
||||
public void writeAdditional(NBTTagCompound cmp) {
|
||||
super.writeAdditional(cmp);
|
||||
cmp.putInt(TAG_INVUL_TIME, getInvulTime());
|
||||
cmp.putBoolean(TAG_AGGRO, aggro);
|
||||
cmp.putInt(TAG_MOB_SPAWN_TICKS, mobSpawnTicks);
|
||||
|
||||
par1nbtTagCompound.setInt(TAG_SOURCE_X, source.getX());
|
||||
par1nbtTagCompound.setInt(TAG_SOURCE_Y, source.getY());
|
||||
par1nbtTagCompound.setInt(TAG_SOURCE_Z, source.getZ());
|
||||
cmp.putInt(TAG_SOURCE_X, source.getX());
|
||||
cmp.putInt(TAG_SOURCE_Y, source.getY());
|
||||
cmp.putInt(TAG_SOURCE_Z, source.getZ());
|
||||
|
||||
par1nbtTagCompound.setBoolean(TAG_HARD_MODE, hardMode);
|
||||
par1nbtTagCompound.setInt(TAG_PLAYER_COUNT, playerCount);
|
||||
cmp.putBoolean(TAG_HARD_MODE, hardMode);
|
||||
cmp.putInt(TAG_PLAYER_COUNT, playerCount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readAdditional(NBTTagCompound par1nbtTagCompound) {
|
||||
super.readAdditional(par1nbtTagCompound);
|
||||
setInvulTime(par1nbtTagCompound.getInt(TAG_INVUL_TIME));
|
||||
aggro = par1nbtTagCompound.getBoolean(TAG_AGGRO);
|
||||
mobSpawnTicks = par1nbtTagCompound.getInt(TAG_MOB_SPAWN_TICKS);
|
||||
public void readAdditional(NBTTagCompound cmp) {
|
||||
super.readAdditional(cmp);
|
||||
setInvulTime(cmp.getInt(TAG_INVUL_TIME));
|
||||
aggro = cmp.getBoolean(TAG_AGGRO);
|
||||
mobSpawnTicks = cmp.getInt(TAG_MOB_SPAWN_TICKS);
|
||||
|
||||
int x = par1nbtTagCompound.getInt(TAG_SOURCE_X);
|
||||
int y = par1nbtTagCompound.getInt(TAG_SOURCE_Y);
|
||||
int z = par1nbtTagCompound.getInt(TAG_SOURCE_Z);
|
||||
int x = cmp.getInt(TAG_SOURCE_X);
|
||||
int y = cmp.getInt(TAG_SOURCE_Y);
|
||||
int z = cmp.getInt(TAG_SOURCE_Z);
|
||||
source = new BlockPos(x, y, z);
|
||||
|
||||
hardMode = par1nbtTagCompound.getBoolean(TAG_HARD_MODE);
|
||||
if(par1nbtTagCompound.hasKey(TAG_PLAYER_COUNT))
|
||||
playerCount = par1nbtTagCompound.getInt(TAG_PLAYER_COUNT);
|
||||
hardMode = cmp.getBoolean(TAG_HARD_MODE);
|
||||
if(cmp.contains(TAG_PLAYER_COUNT))
|
||||
playerCount = cmp.getInt(TAG_PLAYER_COUNT);
|
||||
else playerCount = 1;
|
||||
|
||||
if (this.hasCustomName()) {
|
||||
@@ -396,10 +386,10 @@ public class EntityDoppleganger extends EntityLiving implements IBotaniaBoss, IE
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void damageEntity(@Nonnull DamageSource par1DamageSource, float par2) {
|
||||
super.damageEntity(par1DamageSource, par2);
|
||||
protected void damageEntity(@Nonnull DamageSource source, float par2) {
|
||||
super.damageEntity(source, par2);
|
||||
|
||||
Entity attacker = par1DamageSource.getImmediateSource();
|
||||
Entity attacker = source.getImmediateSource();
|
||||
if(attacker != null) {
|
||||
Vector3 thisVector = Vector3.fromEntityCenter(this);
|
||||
Vector3 playerVector = Vector3.fromEntityCenter(attacker);
|
||||
@@ -448,8 +438,7 @@ public class EntityDoppleganger extends EntityLiving implements IBotaniaBoss, IE
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dropLoot(boolean wasRecentlyHit, int lootingModifier, @Nonnull DamageSource source)
|
||||
{
|
||||
protected void dropLoot(boolean wasRecentlyHit, int lootingModifier, @Nonnull DamageSource source) {
|
||||
// Save true killer, they get extra loot
|
||||
if (wasRecentlyHit && source.getTrueSource() instanceof EntityPlayer) {
|
||||
trueKiller = (EntityPlayer) source.getTrueSource();
|
||||
@@ -495,12 +484,12 @@ public class EntityDoppleganger extends EntityLiving implements IBotaniaBoss, IE
|
||||
super.remove();
|
||||
}
|
||||
|
||||
private List<EntityPlayer> getPlayersAround() {
|
||||
public List<EntityPlayer> getPlayersAround() {
|
||||
float range = 15F;
|
||||
return world.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(source.getX() + 0.5 - range, source.getY() + 0.5 - range, source.getZ() + 0.5 - range, source.getX() + 0.5 + range, source.getY() + 0.5 + range, source.getZ() + 0.5 + range));
|
||||
return world.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(source.getX() + 0.5 - range, source.getY() + 0.5 - range, source.getZ() + 0.5 - range, source.getX() + 0.5 + range, source.getY() + 0.5 + range, source.getZ() + 0.5 + range), player -> isTruePlayer(player) && !player.isSpectator());
|
||||
}
|
||||
|
||||
private static int getGaiaGuardiansAround(World world, BlockPos source) {
|
||||
private static int countGaiaGuardiansAround(World world, BlockPos source) {
|
||||
float range = 15F;
|
||||
List l = world.getEntitiesWithinAABB(EntityDoppleganger.class, new AxisAlignedBB(source.getX() + 0.5 - range, source.getY() + 0.5 - range, source.getZ() + 0.5 - range, source.getX() + 0.5 + range, source.getY() + 0.5 + range, source.getZ() + 0.5 + range));
|
||||
return l.size();
|
||||
@@ -546,20 +535,31 @@ public class EntityDoppleganger extends EntityLiving implements IBotaniaBoss, IE
|
||||
}
|
||||
}
|
||||
|
||||
private void smashCheatyBlocks() {
|
||||
int radius = 1;
|
||||
int posXInt = MathHelper.floor(posX);
|
||||
int posYInt = MathHelper.floor(posY);
|
||||
int posZInt = MathHelper.floor(posZ);
|
||||
for(int i = -radius; i < radius + 1; i++)
|
||||
for(int j = -radius; j < radius + 1; j++)
|
||||
for(int k = -radius; k < radius + 1; k++) {
|
||||
int xp = posXInt + i;
|
||||
int yp = posYInt + j;
|
||||
int zp = posZInt + k;
|
||||
BlockPos posp = new BlockPos(xp, yp, zp);
|
||||
if(isCheatyBlock(world, posp)) {
|
||||
world.destroyBlock(posp, true);
|
||||
private void smashBlocksAround(int centerX, int centerY, int centerZ, int radius) {
|
||||
for(int dx = -radius; dx <= radius; dx++)
|
||||
for(int dy = -radius; dy <= radius + 1; dy++)
|
||||
for(int dz = -radius; dz <= radius; dz++) {
|
||||
int x = centerX + dx;
|
||||
int y = centerY + dy;
|
||||
int z = centerZ + dz;
|
||||
|
||||
BlockPos pos = new BlockPos(x, y, z);
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
Block block = state.getBlock();
|
||||
|
||||
if(state.getBlockHardness(world, pos) == -1) continue;
|
||||
|
||||
if(CHEATY_BLOCKS.contains(block.getRegistryName())) {
|
||||
world.destroyBlock(pos, true);
|
||||
} else {
|
||||
//don't break blacklisted blocks
|
||||
if(BotaniaAPI.gaiaBreakBlacklist.contains(block)) continue;
|
||||
//don't break the floor
|
||||
if(y == source.getY() - 1) continue;
|
||||
//don't break blocks in pylon columns
|
||||
if(Math.abs(source.getX() - x) == 4 && Math.abs(source.getZ() - z) == 4) continue;
|
||||
|
||||
world.destroyBlock(pos, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -647,28 +647,28 @@ public class EntityDoppleganger extends EntityLiving implements IBotaniaBoss, IE
|
||||
|
||||
int invul = getInvulTime();
|
||||
|
||||
if (world.isRemote) {
|
||||
if(world.isRemote) {
|
||||
particles();
|
||||
EntityPlayer player = Botania.proxy.getClientPlayer();
|
||||
if(getPlayersAround().contains(player))
|
||||
player.abilities.isFlying = player.abilities.isFlying && player.abilities.isCreativeMode;
|
||||
player.abilities.isFlying &= player.abilities.isCreativeMode;
|
||||
return;
|
||||
}
|
||||
|
||||
bossInfo.setPercent(getHealth() / getMaxHealth());
|
||||
|
||||
if(!getPassengers().isEmpty())
|
||||
if(isPassenger())
|
||||
stopRiding();
|
||||
|
||||
if(world.getDifficulty() == EnumDifficulty.PEACEFUL)
|
||||
setDead();
|
||||
remove();
|
||||
|
||||
smashCheatyBlocks();
|
||||
smashBlocksAround(MathHelper.floor(posX), MathHelper.floor(posY), MathHelper.floor(posZ), 1);
|
||||
|
||||
List<EntityPlayer> players = getPlayersAround();
|
||||
|
||||
if(players.isEmpty() && !world.playerEntities.isEmpty())
|
||||
setDead();
|
||||
remove();
|
||||
else {
|
||||
for(EntityPlayer player : players) {
|
||||
for(EntityEquipmentSlot e : EntityEquipmentSlot.values()) {
|
||||
@@ -678,9 +678,12 @@ public class EntityDoppleganger extends EntityLiving implements IBotaniaBoss, IE
|
||||
}
|
||||
}
|
||||
|
||||
//also see SleepingHandler
|
||||
if(player.isPlayerSleeping()) player.wakeUpPlayer(true, true, false);
|
||||
|
||||
clearPotions(player);
|
||||
keepInsideArena(player);
|
||||
player.abilities.isFlying = player.abilities.isFlying && player.abilities.isCreativeMode;
|
||||
player.abilities.isFlying &= player.abilities.isCreativeMode;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -732,18 +735,14 @@ public class EntityDoppleganger extends EntityLiving implements IBotaniaBoss, IE
|
||||
|
||||
tpDelay--;
|
||||
if(tpDelay == 0 && getHealth() > 0) {
|
||||
int tries = 0;
|
||||
while(!teleportRandomly() && tries < 50)
|
||||
tries++;
|
||||
if(tries >= 50)
|
||||
teleportTo(source.getX() + 0.5, source.getY() + 1.6, source.getZ() + 0.5);
|
||||
teleportRandomly();
|
||||
|
||||
if(spawnLandmines) {
|
||||
int count = dying && hardMode ? 7 : 6;
|
||||
for(int i = 0; i < count; i++) {
|
||||
int x = source.getX() - 10 + rand.nextInt(20);
|
||||
int y = (int) players.get(rand.nextInt(players.size())).posY;
|
||||
int z = source.getZ() - 10 + rand.nextInt(20);
|
||||
int y = world.getTopSolidOrLiquidBlock(new BlockPos(x, -1, z)).getY();
|
||||
|
||||
EntityMagicLandmine landmine = new EntityMagicLandmine(world);
|
||||
landmine.setPosition(x + 0.5, y, z + 0.5);
|
||||
@@ -779,21 +778,18 @@ public class EntityDoppleganger extends EntityLiving implements IBotaniaBoss, IE
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNonBoss()
|
||||
{
|
||||
public boolean isNonBoss() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTrackingPlayer(EntityPlayerMP player)
|
||||
{
|
||||
public void addTrackingPlayer(EntityPlayerMP player) {
|
||||
super.addTrackingPlayer(player);
|
||||
bossInfo.addPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeTrackingPlayer(EntityPlayerMP player)
|
||||
{
|
||||
public void removeTrackingPlayer(EntityPlayerMP player) {
|
||||
super.removeTrackingPlayer(player);
|
||||
bossInfo.removePlayer(player);
|
||||
}
|
||||
@@ -818,127 +814,73 @@ public class EntityDoppleganger extends EntityLiving implements IBotaniaBoss, IE
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isCheatyBlock(World world, BlockPos pos) {
|
||||
Block block = world.getBlockState(pos).getBlock();
|
||||
return CHEATY_BLOCKS.contains(block.getRegistryName());
|
||||
}
|
||||
private void teleportRandomly() {
|
||||
//choose a location to teleport to
|
||||
double oldX = posX, oldY = posY, oldZ = posZ;
|
||||
double newX, newY, newZ;
|
||||
int tries = 0;
|
||||
|
||||
// [VanillaCopy] EntityEnderman.teleportRandomly, edits noted.
|
||||
private boolean teleportRandomly() {
|
||||
double d0 = this.posX + (this.rand.nextDouble() - 0.5D) * 64.0D;
|
||||
double d1 = this.posY + (double)(this.rand.nextInt(64) - 32);
|
||||
double d2 = this.posZ + (this.rand.nextDouble() - 0.5D) * 64.0D;
|
||||
return this.teleportTo(d0, d1, d2);
|
||||
}
|
||||
do {
|
||||
newX = source.getX() + (rand.nextDouble() - .5) * ARENA_RANGE;
|
||||
newY = source.getY();
|
||||
newZ = source.getZ() + (rand.nextDouble() - .5) * ARENA_RANGE;
|
||||
tries++;
|
||||
//ensure it's inside the arena ring, and not just its bounding square
|
||||
}
|
||||
while(tries < 50 && vazkii.botania.common.core.helper.MathHelper.pointDistanceSpace(newX, newY, newZ, source.getX(), source.getY(), source.getZ()) > 12);
|
||||
|
||||
// [VanillaCopy] EntityEnderman.teleportTo, edits noted.
|
||||
private boolean teleportTo(double x, double y, double z) {
|
||||
/* Botania - no events
|
||||
net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(this, x, y, z, 0);
|
||||
if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return false;
|
||||
boolean flag = this.attemptTeleport(event.getTargetX(), event.getTargetY(), event.getTargetZ());
|
||||
*/
|
||||
|
||||
boolean flag = this.attemptTeleport(x, y, z);
|
||||
|
||||
if (flag)
|
||||
{
|
||||
this.world.playSound((EntityPlayer)null, this.prevPosX, this.prevPosY, this.prevPosZ, SoundEvents.ENTITY_ENDERMEN_TELEPORT, this.getSoundCategory(), 1.0F, 1.0F);
|
||||
this.playSound(SoundEvents.ENTITY_ENDERMEN_TELEPORT, 1.0F, 1.0F);
|
||||
if(tries == 50) {
|
||||
//failsafe: teleport to the beacon
|
||||
newX = source.getX() + .5;
|
||||
newY = source.getY() + 1.6;
|
||||
newZ = source.getZ() + .5;
|
||||
}
|
||||
|
||||
return flag;
|
||||
}
|
||||
//teleport there
|
||||
setPositionAndUpdate(newX, newY, newZ);
|
||||
|
||||
// [VanillaCopy] of super, edits noted
|
||||
@Override
|
||||
public boolean attemptTeleport(double x, double y, double z) {
|
||||
double d0 = this.posX;
|
||||
double d1 = this.posY;
|
||||
double d2 = this.posZ;
|
||||
this.posX = x;
|
||||
this.posY = y;
|
||||
this.posZ = z;
|
||||
boolean flag = false;
|
||||
BlockPos blockpos = new BlockPos(this);
|
||||
World world = this.world;
|
||||
Random random = this.getRNG();
|
||||
//play sound
|
||||
world.playSound(null, oldX, oldY, oldZ, SoundEvents.ENTITY_ENDERMEN_TELEPORT, this.getSoundCategory(), 1.0F, 1.0F);
|
||||
this.playSound(SoundEvents.ENTITY_ENDERMEN_TELEPORT, 1.0F, 1.0F);
|
||||
|
||||
if (world.isBlockLoaded(blockpos))
|
||||
{
|
||||
boolean flag1 = false;
|
||||
Random random = getRNG();
|
||||
|
||||
while (!flag1 && blockpos.getY() > 0)
|
||||
{
|
||||
BlockPos blockpos1 = blockpos.down();
|
||||
IBlockState iblockstate = world.getBlockState(blockpos1);
|
||||
|
||||
if (iblockstate.getMaterial().blocksMovement())
|
||||
{
|
||||
flag1 = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
--this.posY;
|
||||
blockpos = blockpos1;
|
||||
}
|
||||
}
|
||||
|
||||
if (flag1)
|
||||
{
|
||||
this.setPositionAndUpdate(this.posX, this.posY, this.posZ);
|
||||
|
||||
if (world.getCollisionBoxes(this, this.getEntityBoundingBox()).isEmpty() && !world.containsAnyLiquid(this.getEntityBoundingBox()))
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
|
||||
// Botania - Prevent out of bounds teleporting
|
||||
if(vazkii.botania.common.core.helper.MathHelper.pointDistanceSpace(posX, posY, posZ, source.getX(), source.getY(), source.getZ()) > 12)
|
||||
flag = false;
|
||||
}
|
||||
//spawn particles along the path
|
||||
int particleCount = 128;
|
||||
for(int i = 0; i < particleCount; ++i) {
|
||||
double progress = i / (double) (particleCount - 1);
|
||||
float vx = (random.nextFloat() - 0.5F) * 0.2F;
|
||||
float vy = (random.nextFloat() - 0.5F) * 0.2F;
|
||||
float vz = (random.nextFloat() - 0.5F) * 0.2F;
|
||||
double px = oldX + (newX - oldX) * progress + (random.nextDouble() - 0.5D) * width * 2.0D;
|
||||
double py = oldY + (newY - oldY) * progress + random.nextDouble() * height;
|
||||
double pz = oldZ + (newZ - oldZ) * progress + (random.nextDouble() - 0.5D) * width * 2.0D;
|
||||
world.spawnParticle(EnumParticleTypes.PORTAL, px, py, pz, vx, vy, vz);
|
||||
}
|
||||
|
||||
if (!flag)
|
||||
{
|
||||
this.setPositionAndUpdate(d0, d1, d2);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
int i = 128;
|
||||
Vec3d oldPosVec = new Vec3d(oldX, oldY + height / 2, oldZ);
|
||||
Vec3d newPosVec = new Vec3d(newX, newY + height / 2, newZ);
|
||||
|
||||
for (int j = 0; j < 128; ++j)
|
||||
{
|
||||
double d6 = (double)j / 127.0D;
|
||||
float f = (random.nextFloat() - 0.5F) * 0.2F;
|
||||
float f1 = (random.nextFloat() - 0.5F) * 0.2F;
|
||||
float f2 = (random.nextFloat() - 0.5F) * 0.2F;
|
||||
double d3 = d0 + (this.posX - d0) * d6 + (random.nextDouble() - 0.5D) * (double)this.width * 2.0D;
|
||||
double d4 = d1 + (this.posY - d1) * d6 + random.nextDouble() * (double)this.height;
|
||||
double d5 = d2 + (this.posZ - d2) * d6 + (random.nextDouble() - 0.5D) * (double)this.width * 2.0D;
|
||||
world.spawnParticle(EnumParticleTypes.PORTAL, d3, d4, d5, (double)f, (double)f1, (double)f2, new int[0]);
|
||||
if(oldPosVec.squareDistanceTo(newPosVec) > 1) {
|
||||
//damage players in the path of the teleport
|
||||
for(EntityPlayer player : getPlayersAround()) {
|
||||
RayTraceResult rtr = player.getEntityBoundingBox().grow(0.25).calculateIntercept(oldPosVec, newPosVec);
|
||||
if(rtr != null)
|
||||
player.attackEntityFrom(DamageSource.causeMobDamage(this), 6);
|
||||
}
|
||||
|
||||
// Botania - invalid/unneeded check
|
||||
/*if (this instanceof EntityCreature)
|
||||
{
|
||||
((EntityCreature)this).getNavigator().clearPathEntity();
|
||||
}*/
|
||||
//break blocks in the path of the teleport
|
||||
int breakSteps = (int) oldPosVec.distanceTo(newPosVec);
|
||||
if(breakSteps >= 2) {
|
||||
for(int i = 0; i < breakSteps; i++) {
|
||||
float progress = i / (float) (breakSteps - 1);
|
||||
int breakX = MathHelper.floor(oldX + (newX - oldX) * progress);
|
||||
int breakY = MathHelper.floor(oldY + (newY - oldY) * progress);
|
||||
int breakZ = MathHelper.floor(oldZ + (newZ - oldZ) * progress);
|
||||
|
||||
// Botania - damage any players in our way
|
||||
Vec3d origPos = new Vec3d(d0, d1 + height / 2, d2);
|
||||
Vec3d newPos = new Vec3d(posX, posY + height / 2, posZ);
|
||||
|
||||
if(origPos.squareDistanceTo(newPos) > 1) {
|
||||
for(EntityPlayer player : getPlayersAround()) {
|
||||
RayTraceResult rtr = player.getEntityBoundingBox().grow(0.25).calculateIntercept(origPos, newPos);
|
||||
if(rtr != null)
|
||||
player.attackEntityFrom(DamageSource.causeMobDamage(this), 6);
|
||||
smashBlocksAround(breakX, breakY, breakZ, 1);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.registries.ObjectHolder;
|
||||
import vazkii.botania.common.block.BlockSolidVines;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
@@ -79,11 +80,16 @@ public class EntityVineBall extends EntityThrowable {
|
||||
|
||||
if(dir != null && dir.getAxis() != EnumFacing.Axis.Y) {
|
||||
BlockPos pos = var1.getBlockPos().offset(dir);
|
||||
boolean first = true;
|
||||
while(pos.getY() > 0) {
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
Block block = state.getBlock();
|
||||
if(block.isAir(state, world, pos)) {
|
||||
IBlockState stateSet = ModBlocks.solidVines.getDefaultState().with(propMap.get(dir.getOpposite()), true);
|
||||
|
||||
if(first && !ModBlocks.solidVines.getDefaultState().isValidPosition(world, pos)) break;
|
||||
first = false;
|
||||
|
||||
world.setBlockState(pos, stateSet, 1 | 2);
|
||||
world.playEvent(2001, pos, Block.getStateId(stateSet));
|
||||
pos = pos.down();
|
||||
|
||||
@@ -156,8 +156,6 @@ public class ItemTwigWand extends ItemMod implements ICoordBoundItem {
|
||||
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
|
||||
return EnumActionResult.PASS;
|
||||
}
|
||||
|
||||
if(block instanceof IWandable) {
|
||||
|
||||
@@ -19,7 +19,6 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent;
|
||||
@@ -29,6 +28,7 @@ import net.minecraftforge.items.IItemHandler;
|
||||
import vazkii.botania.client.core.handler.ClientTickHandler;
|
||||
import vazkii.botania.common.core.helper.ItemNBTHelper;
|
||||
import vazkii.botania.common.core.helper.Vector3;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
import vazkii.botania.common.network.PacketDodge;
|
||||
@@ -53,13 +53,11 @@ public class ItemDodgeRing extends ItemBauble {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
|
||||
IItemHandler baublesInv = BaublesApi.getBaublesHandler(mc.player);
|
||||
ItemStack ringStack = baublesInv.getStackInSlot(1);
|
||||
if(ringStack.isEmpty() || !(ringStack.getItem() instanceof ItemDodgeRing)) {
|
||||
ringStack = baublesInv.getStackInSlot(2);
|
||||
if(ringStack.isEmpty() || !(ringStack.getItem() instanceof ItemDodgeRing))
|
||||
int slot = BaublesApi.isBaubleEquipped(mc.player, ModItems.dodgeRing);
|
||||
if(slot < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack ringStack = baublesInv.getStackInSlot(slot);
|
||||
if(ItemNBTHelper.getInt(ringStack, TAG_DODGE_COOLDOWN, 0) > 0)
|
||||
return;
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ public class ItemHolyCloak extends ItemBauble implements IBaubleRender {
|
||||
}
|
||||
|
||||
private void onPlayerDamage(LivingHurtEvent event) {
|
||||
if(event.getEntityLiving() instanceof EntityPlayer) {
|
||||
if(event.getEntityLiving() instanceof EntityPlayer && !event.getSource().canHarmInCreative()) {
|
||||
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
|
||||
ItemStack belt = BaublesApi.getBaublesHandler(player).getStackInSlot(5);
|
||||
if(!belt.isEmpty() && belt.getItem() instanceof ItemHolyCloak && !isInEffect(belt)) {
|
||||
|
||||
@@ -12,7 +12,6 @@ package vazkii.botania.common.item.equipment.bauble;
|
||||
|
||||
import baubles.api.BaubleType;
|
||||
import baubles.api.BaublesApi;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
@@ -109,7 +108,7 @@ public class ItemMagnetRing extends ItemBauble {
|
||||
}
|
||||
|
||||
private boolean canPullItem(EntityItem item) {
|
||||
if(!item.isAlive() || SubTileSolegnolia.hasSolegnoliaAround(item))
|
||||
if(!item.isAlive() || item.pickupDelay >= 40 || SubTileSolegnolia.hasSolegnoliaAround(item))
|
||||
return false;
|
||||
|
||||
ItemStack stack = item.getItem();
|
||||
|
||||
+2
@@ -16,6 +16,7 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Enchantments;
|
||||
import net.minecraft.item.ItemShears;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -98,6 +99,7 @@ public class ItemManasteelShears extends ItemShears implements IManaUsingItem {
|
||||
|
||||
ToolCommons.damageItem(itemstack, 1, player, MANA_PER_DAMAGE);
|
||||
player.addStat(StatList.BLOCK_MINED.get(block), 1);
|
||||
player.world.setBlockState(pos, Blocks.AIR.getDefaultState(), 11);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -173,7 +173,7 @@ public class ItemTerraPick extends ItemManasteelPick implements IManaItem, ISequ
|
||||
|
||||
int fortune = EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, stack);
|
||||
boolean silk = EnchantmentHelper.getEnchantmentLevel(Enchantments.SILK_TOUCH, stack) > 0;
|
||||
boolean thor = ItemThorRing.getThorRing(player) != null;
|
||||
boolean thor = !ItemThorRing.getThorRing(player).isEmpty();
|
||||
boolean doX = thor || side.getXOffset() == 0;
|
||||
boolean doY = thor || side.getYOffset() == 0;
|
||||
boolean doZ = thor || side.getZOffset() == 0;
|
||||
|
||||
@@ -10,15 +10,17 @@
|
||||
*/
|
||||
package vazkii.botania.common.item.relic;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import baubles.api.BaubleType;
|
||||
import baubles.api.BaublesApi;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Enchantments;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
@@ -28,7 +30,6 @@ import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
@@ -46,10 +47,6 @@ import vazkii.botania.common.item.equipment.tool.ToolCommons;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID)
|
||||
public class ItemLokiRing extends ItemRelicBauble implements IWireframeCoordinateListProvider, IManaUsingItem {
|
||||
|
||||
@@ -198,14 +195,13 @@ public class ItemLokiRing extends ItemRelicBauble implements IWireframeCoordinat
|
||||
|
||||
private static ItemStack getLokiRing(EntityPlayer player) {
|
||||
IItemHandler baubles = BaublesApi.getBaublesHandler(player);
|
||||
ItemStack stack1 = baubles.getStackInSlot(1);
|
||||
ItemStack stack2 = baubles.getStackInSlot(2);
|
||||
return isLokiRing(stack1) ? stack1 : isLokiRing(stack2) ? stack2 : ItemStack.EMPTY;
|
||||
int slot = BaublesApi.isBaubleEquipped(player, ModItems.lokiRing);
|
||||
if (slot < 0) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
return baubles.getStackInSlot(slot);
|
||||
}
|
||||
|
||||
private static boolean isLokiRing(ItemStack stack) {
|
||||
return !stack.isEmpty() && stack.getItem() == ModItems.lokiRing;
|
||||
}
|
||||
|
||||
private static BlockPos getOriginPos(ItemStack stack) {
|
||||
int x = ItemNBTHelper.getInt(stack, TAG_X_ORIGIN, 0);
|
||||
|
||||
@@ -64,7 +64,7 @@ public class ItemOdinRing extends ItemRelicBauble {
|
||||
public static void onPlayerAttacked(LivingAttackEvent event) {
|
||||
if(event.getEntityLiving() instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
|
||||
if(getOdinRing(player) != null && damageNegations.contains(event.getSource().damageType))
|
||||
if(!getOdinRing(player).isEmpty() && damageNegations.contains(event.getSource().damageType))
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
@@ -76,13 +76,11 @@ public class ItemOdinRing extends ItemRelicBauble {
|
||||
|
||||
public static ItemStack getOdinRing(EntityPlayer player) {
|
||||
IItemHandler baubles = BaublesApi.getBaublesHandler(player);
|
||||
ItemStack stack1 = baubles.getStackInSlot(1);
|
||||
ItemStack stack2 = baubles.getStackInSlot(2);
|
||||
return isOdinRing(stack1) ? stack1 : isOdinRing(stack2) ? stack2 : null;
|
||||
}
|
||||
|
||||
private static boolean isOdinRing(ItemStack stack) {
|
||||
return !stack.isEmpty() && stack.getItem() == ModItems.odinRing;
|
||||
int slot = BaublesApi.isBaubleEquipped(player, ModItems.odinRing);
|
||||
if (slot < 0) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
return baubles.getStackInSlot(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -38,13 +38,10 @@ public class ItemThorRing extends ItemRelicBauble {
|
||||
|
||||
public static ItemStack getThorRing(EntityPlayer player) {
|
||||
IItemHandler baubles = BaublesApi.getBaublesHandler(player);
|
||||
ItemStack stack1 = baubles.getStackInSlot(1);
|
||||
ItemStack stack2 = baubles.getStackInSlot(2);
|
||||
return isThorRing(stack1) ? stack1 : isThorRing(stack2) ? stack2 : null;
|
||||
int slot = BaublesApi.isBaubleEquipped(player, ModItems.thorRing);
|
||||
if (slot < 0) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
return baubles.getStackInSlot(slot);
|
||||
}
|
||||
|
||||
private static boolean isThorRing(ItemStack stack) {
|
||||
return !stack.isEmpty() && stack.getItem() == ModItems.thorRing;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1118,7 +1118,7 @@ public final class LexiconData {
|
||||
new PageCraftingRecipe("3", ModCraftingRecipes.recipeBlackHoleTalisman));
|
||||
|
||||
corporeaCrystalCube = new AlfheimLexiconEntry(LibLexicon.ENDER_CORPOREA_CRYSTAL_CUBE, categoryEnder);
|
||||
corporeaCrystalCube.setLexiconPages(new PageText("0"), new PageText("1"), new PageText("3"),
|
||||
corporeaCrystalCube.setLexiconPages(new PageText("0"), new PageText("1"), new PageText("3"), new PageText("4"),
|
||||
new PageCraftingRecipe("2", ModCraftingRecipes.recipeCorporeaCrystalCube));
|
||||
|
||||
luminizerTransport = new AlfheimLexiconEntry(LibLexicon.ENDER_LUMINIZER_TRANSPORT, categoryEnder);
|
||||
|
||||
@@ -72,14 +72,14 @@ public class PagePetalRecipe<T extends RecipePetals> extends PageRecipe {
|
||||
List<Object> inputs = recipe.getInputs();
|
||||
int degreePerInput = (int) (360F / inputs.size());
|
||||
float currentDegree = ConfigHandler.lexiconRotatingItems ? GuiScreen.isShiftKeyDown() ? ticksElapsed : ticksElapsed + ClientTickHandler.partialTicks : 0;
|
||||
float baseDegree = currentDegree;
|
||||
|
||||
int inputIndex = ticksElapsed / 40;
|
||||
|
||||
for(Object obj : inputs) {
|
||||
Object input = obj;
|
||||
if(input instanceof String) {
|
||||
NonNullList<ItemStack> list = OreDictionary.getOres((String) input);
|
||||
int size = list.size();
|
||||
input = list.get(size - (int) (baseDegree / 40) % size - 1);
|
||||
input = list.get(size - inputIndex % size - 1);
|
||||
}
|
||||
|
||||
renderItemAtAngle(gui, currentDegree, (ItemStack) input);
|
||||
|
||||
@@ -16,7 +16,6 @@ import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraftforge.fml.network.NetworkEvent;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
@@ -41,14 +40,12 @@ public class PacketDodge {
|
||||
player.world.playSound(null, player.posX, player.posY, player.posZ, ModSounds.dash, SoundCategory.PLAYERS, 1F, 1F);
|
||||
|
||||
IItemHandler baublesInv = BaublesApi.getBaublesHandler(player);
|
||||
ItemStack ringStack = baublesInv.getStackInSlot(1);
|
||||
if(ringStack.isEmpty() || !(ringStack.getItem() instanceof ItemDodgeRing)) {
|
||||
ringStack = baublesInv.getStackInSlot(2);
|
||||
if(ringStack.isEmpty() || !(ringStack.getItem() instanceof ItemDodgeRing))
|
||||
player.connection.disconnect(new TextComponentTranslation("botaniamisc.invalidDodge"));
|
||||
int slot = BaublesApi.isBaubleEquipped(player, ModItems.dodgeRing);
|
||||
if(slot < 0) {
|
||||
ctx.get().getSender().connection.disconnect(new TextComponentTranslation("botaniamisc.invalidDodge"));
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack ringStack = baublesInv.getStackInSlot(slot);
|
||||
player.addExhaustion(0.3F);
|
||||
ItemNBTHelper.setInt(ringStack, ItemDodgeRing.TAG_DODGE_COOLDOWN, ItemDodgeRing.MAX_CD);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user